diff --git a/mozilla/db/LICENSE b/mozilla/db/LICENSE new file mode 100644 index 00000000000..17ee9b937bf --- /dev/null +++ b/mozilla/db/LICENSE @@ -0,0 +1,116 @@ +/*- + * @(#)LICENSE 10.8 (Sleepycat) 5/1/98 + */ + +The following are the copyrights and redistribution conditions that apply to +this copy of the Berkeley DB software. For a license to use, redistribute +or sell Berkeley DB software under conditions other than those described here, +or to purchase support for this software, please contact Sleepycat Software at +one of the following addresses: + + Sleepycat Software db@sleepycat.com + 394 E. Riding Dr. +1-617-633-2429 + Carlisle, MA 01741 + USA + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +/* + * Copyright (c) 1990, 1993, 1994, 1995, 1996, 1997, 1998 + * Sleepycat Software. 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. Redistributions in any form must be accompanied by information on + * how to obtain complete source code for the DB software and any + * accompanying software that uses the DB software. The source code + * must either be included in the distribution or be available for no + * more than the cost of distribution plus a nominal fee, and must be + * freely redistributable under reasonable conditions. For an + * executable file, complete source code means the source code for all + * modules it contains. It does not mean source code for modules or + * files that typically accompany the operating system on which the + * executable file runs, e.g., standard library modules or system + * header files. + * + * THIS SOFTWARE IS PROVIDED BY SLEEPYCAT SOFTWARE ``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 SLEEPYCAT SOFTWARE 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. + */ +/* + * Copyright (c) 1990, 1993, 1994, 1995 + * 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. + */ +/* + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Harvard University + * 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 HARVARD AND ITS 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 HARVARD OR ITS 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. + */ diff --git a/mozilla/db/README b/mozilla/db/README new file mode 100644 index 00000000000..07d0656018f --- /dev/null +++ b/mozilla/db/README @@ -0,0 +1,143 @@ +# @(#)README 10.61 (Sleepycat) 6/2/98 + +This is version 2.4.14 (6/2/98) of the Berkeley DB library. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +To view the documentation for the Berkeley DB release, point your web +browser at the following distribution files: + + man/man.html/index_c.html -- The C API + man/man.html/index_cxx.html -- The C++ API + man/man.html/index_java.html -- The Java API + +The documentation is available in PostScript, UNIX roff and flat text +format as well. We suggest reviewing the following three pages first: + + db_intro(3) + db_appinit(3) + db_open(3) + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Bug fixes, answers to Frequently Asked Questions and updated versions of +this software are available. For more information see: + + http://www.sleepycat.com + +The file LICENSE has Berkeley DB copyright and redistribution information. + +Sleepycat Software maintains an email list of people interested in new +features and future releases of DB. Please send email to the address +below if you would like to be on that list. + +To ask questions about Berkeley DB, report problems, request support +contract and licensing information, or to contact the authors for any +reason, please contact Sleepycat Software at one of the following +addresses: + + Sleepycat Software db@sleepycat.com + 394 E. Riding Dr. +1-617-633-2429 + Carlisle, MA 01741 + USA + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +The distribution layout is as follows: + + LICENSE ............ Copyright, use and redistribution information. + README ............. This file. + btree .............. B+tree access method source code. + build.unix ......... UNIX build directory. + build.unix/README .. UNIX build information. + build.win16 ........ Windows 3.1 build directory + build.win32 ........ Windows/95, Windows/NT build directory. + build.win32/README . Windows/95, Windows/NT build information. + clib ............... C library replacement source code. + common ............. Source code shared by all of DB. + cxx ................ C++ API. + db ................. DB interface source code. + db185 .............. Compatibility source code for DB version 1.85 + db_archive ......... The db_archive(1) utility source code. + db_checkpoint ...... The db_checkpoint(1) utility source code. + db_deadlock ........ The db_deadlock(1) utility source code. + db_dump ............ The db_dump(1) utility source code. + db_dump185 ......... The db_dump185(1) utility source code. + db_load ............ The db_load(1) utility source code. + db_printlog ........ Debugging utility, never installed. + db_recover ......... The db_recover(1) utility source code. + db_stat ............ The db_stat(1) utility source code. + dbm ................ Compatibility source code for dbm(3) and ndbm(3). + dist ............... Various files used to build the DB distribution. + documents .......... DB documents (other than the UNIX-style manual pages). + examples ........... C API example source code for using the DB library. + examples_cxx ....... C++ API example source code for using the DB library. + hash ............... Hash access method source code. + hsearch ............ Compatibility source code for hsearch(3). + include ............ Include files for DB. + java ............... Java API. + java/README ........ General Java API notes. + libdb_java ......... Sources to build the libdb_java shared library. + lock ............... Lock manager source code. + log ................ Log manager source code. + man/man.html ....... C, C++ and Java API HTML format manual pages. + man/man.ps ......... C API PostScript format manual pages. + man/man.roff ....... C API troff format (man macros) manual pages. + man/man.text ....... C API flat text manual pages. + man/mancxx.ps ...... C++ API PostScript format manual pages. + man/mancxx.roff .... C++ API troff format (man macros) manual pages. + man/mancxx.text .... C++ API flat text manual pages. + mp ................. Shared memory buffer pool source code. + mutex .............. Spin-lock source code. + os ................. Operating-system specific functionality. + os.win16 ........... Operating-system specific functionality (Win16). + os.win32 ........... Operating-system specific functionality (Win32/WNT). + test ............... Test directory. + test/README ........ UNIX test information. + test/README.win32 .. UNIX test information. + txn ................ Transaction manager source code. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +To build Berkeley DB for a UNIX platform: + + cd build.unix + ../dist/configure + make + +To build multiple UNIX versions of Berkeley DB in the same source tree, +create a new directory, then configure and build. + + mkdir build.bsdos3.0 + cd build.bsdos3.0 + ../dist/configure + make + +For additional information about building Berkeley DB for UNIX platforms, +the description of possible configuration options and other information +on DB configuration and build issues, see the file build.unix/README. + +To build Berkeley DB for a WIN32 platform, see build.win32/README. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +The C++ API files and directories in the source distribution are: + +db/cxx/ C++ API +db/examples_cxx/ The example programs recoded in C++. +db/include/cxx_int.h Internal C++ include file. +db/include/db_cxx.h External C++ include file. + +C++ support is automatically built on Win32. To configure it under +UNIX, specify --enable-cxx as a configuration argument (see the file +db/build.unix/README for more information). + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +The Java API files and directories in the source distribution are: + +db/java/src/com/sleepycat/db + The Java API +db/java/README Information on building the Java API. +db/man/man.html/index_java.html + The Java API manual pages (available only in HTML). +db/java/src/com/sleepycat/examples/ + The example programs recoded in Java. +db/libdb_java Sources to build the libdb_java shared library. + +Java support is NEVER automatically built. To configure and build the +Java API, see the file db/java/README for more information. diff --git a/mozilla/db/btree/bt_close.c b/mozilla/db/btree/bt_close.c new file mode 100644 index 00000000000..9df5c717e6d --- /dev/null +++ b/mozilla/db/btree/bt_close.c @@ -0,0 +1,177 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * 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. 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)bt_close.c 10.32 (Sleepycat) 5/6/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "btree.h" + +static void __bam_upstat __P((DB *dbp)); + +/* + * __bam_close -- + * Close a btree. + * + * PUBLIC: int __bam_close __P((DB *)); + */ +int +__bam_close(dbp) + DB *dbp; +{ + BTREE *t; + + DEBUG_LWRITE(dbp, NULL, "bam_close", NULL, NULL, 0); + + t = dbp->internal; + + /* Update tree statistics. */ + __bam_upstat(dbp); + + /* Free any allocated memory. */ + if (t->bt_rkey.data) + FREE(t->bt_rkey.data, t->bt_rkey.size); + if (t->bt_rdata.data) + FREE(t->bt_rdata.data, t->bt_rdata.ulen); + if (t->bt_sp != t->bt_stack) + FREE(t->bt_sp, (t->bt_esp - t->bt_sp) * sizeof(EPG)); + + FREE(t, sizeof(BTREE)); + dbp->internal = NULL; + + return (0); +} + +/* + * __bam_sync -- + * Sync the btree to disk. + * + * PUBLIC: int __bam_sync __P((DB *, u_int32_t)); + */ +int +__bam_sync(argdbp, flags) + DB *argdbp; + u_int32_t flags; +{ + DB *dbp; + int ret; + + DEBUG_LWRITE(argdbp, NULL, "bam_sync", NULL, NULL, flags); + + /* Check for invalid flags. */ + if ((ret = __db_syncchk(argdbp, flags)) != 0) + return (ret); + + /* If it wasn't possible to modify the file, we're done. */ + if (F_ISSET(argdbp, DB_AM_INMEM | DB_AM_RDONLY)) + return (0); + + GETHANDLE(argdbp, NULL, &dbp, ret); + + /* Flush any dirty pages from the cache to the backing file. */ + if ((ret = memp_fsync(dbp->mpf)) == DB_INCOMPLETE) + ret = 0; + + PUTHANDLE(dbp); + return (ret); +} + +/* + * __bam_upstat -- + * Update tree statistics. + */ +static void +__bam_upstat(dbp) + DB *dbp; +{ + BTREE *t; + BTMETA *meta; + DB_LOCK metalock; + db_pgno_t pgno; + u_int32_t flags; + + /* + * We use a no-op log call to log the update of the statistics onto the + * metadata page. The Db->close call isn't transaction protected to + * start with, and I'm not sure what undoing a statistics update means, + * anyway. + */ + if (F_ISSET(dbp, DB_AM_INMEM | DB_AM_RDONLY)) + return; + + flags = 0; + pgno = PGNO_METADATA; + + /* Lock and retrieve the page. */ + if (__bam_lget(dbp, 0, pgno, DB_LOCK_WRITE, &metalock) != 0) + return; + if (__bam_pget(dbp, (PAGE **)&meta, &pgno, 0) == 0) { + /* Log the change. */ + if (DB_LOGGING(dbp) && + __db_noop_log(dbp->dbenv->lg_info, dbp->txn, &LSN(meta), 0, + dbp->log_fileid, PGNO_METADATA, &LSN(meta)) != 0) + goto err; + + /* Update the statistics. */ + t = dbp->internal; + __bam_add_mstat(&t->lstat, &meta->stat); + + flags = DB_MPOOL_DIRTY; + } + +err: (void)memp_fput(dbp->mpf, (PAGE *)meta, flags); + (void)__BT_LPUT(dbp, metalock); +} diff --git a/mozilla/db/btree/bt_compare.c b/mozilla/db/btree/bt_compare.c new file mode 100644 index 00000000000..5c6d1e38ca8 --- /dev/null +++ b/mozilla/db/btree/bt_compare.c @@ -0,0 +1,212 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * 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. 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)bt_compare.c 10.9 (Sleepycat) 5/6/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "btree.h" + +/* + * __bam_cmp -- + * Compare a key to a given record. + * + * PUBLIC: int __bam_cmp __P((DB *, const DBT *, EPG *)); + */ +int +__bam_cmp(dbp, k1, e) + DB *dbp; + const DBT *k1; + EPG *e; +{ + BINTERNAL *bi; + BKEYDATA *bk; + BOVERFLOW *bo; + BTREE *t; + DBT k2; + PAGE *h; + + t = dbp->internal; + + /* + * Returns: + * < 0 if k1 is < record + * = 0 if k1 is = record + * > 0 if k1 is > record + * + * The left-most key on internal pages, at any level of the tree, is + * guaranteed, by the following code, to be less than any user key. + * This saves us from having to update the leftmost key on an internal + * page when the user inserts a new key in the tree smaller than + * anything we've yet seen. + */ + h = e->page; + if (e->indx == 0 && + h->prev_pgno == PGNO_INVALID && TYPE(h) != P_LBTREE) + return (1); + + bo = NULL; + if (TYPE(h) == P_LBTREE) { + bk = GET_BKEYDATA(h, e->indx); + if (B_TYPE(bk->type) == B_OVERFLOW) + bo = (BOVERFLOW *)bk; + else { + k2.data = bk->data; + k2.size = bk->len; + } + } else { + bi = GET_BINTERNAL(h, e->indx); + if (B_TYPE(bi->type) == B_OVERFLOW) + bo = (BOVERFLOW *)(bi->data); + else { + k2.data = bi->data; + k2.size = bi->len; + } + } + + /* + * XXX + * We ignore system errors; the only recoverable one is ENOMEM, and we + * don't want to require that comparison routines handle random errors. + * We don't want to return a valid comparison, either, so we stop. + */ + if (bo != NULL) { + /* + * If using the default comparison routine, use __db_moff(), + * which compares the overflow key a page at a time. + */ + if (t->bt_compare == __bam_defcmp) + return (__db_moff(dbp, k1, bo->pgno)); + + /* + * Otherwise, we need a contiguous record so we can hand it + * to the user's routine. + */ + memset(&k2, 0, sizeof(k2)); + if (__db_goff(dbp, &k2, bo->tlen, + bo->pgno, &t->bt_rdata.data, &t->bt_rdata.ulen) != 0) { + (void)__db_panic(dbp); + return (0); + } + } + + /* + * XXX + * Note, we have not cleared the k2 DBT in this path. This should + * be okay, because the user's comparison routine had better not be + * looking at any fields other than the data/size. We don't clear + * it because we go through this path a lot and it's expensive. + */ + return ((*t->bt_compare)(k1, &k2)); +} + +/* + * __bam_defcmp -- + * Default comparison routine. + * + * PUBLIC: int __bam_defcmp __P((const DBT *, const DBT *)); + */ +int +__bam_defcmp(a, b) + const DBT *a, *b; +{ + size_t len; + u_int8_t *p1, *p2; + + /* + * Returns: + * < 0 if a is < b + * = 0 if a is = b + * > 0 if a is > b + * + * XXX + * If a size_t doesn't fit into a long, or if the difference between + * any two characters doesn't fit into an int, this routine can lose. + * What we need is a signed integral type that's guaranteed to be at + * least as large as a size_t, and there is no such thing. + */ + len = a->size > b->size ? b->size : a->size; + for (p1 = a->data, p2 = b->data; len--; ++p1, ++p2) + if (*p1 != *p2) + return ((long)*p1 - (long)*p2); + return ((long)a->size - (long)b->size); +} + +/* + * __bam_defpfx -- + * Default prefix routine. + * + * PUBLIC: size_t __bam_defpfx __P((const DBT *, const DBT *)); + */ +size_t +__bam_defpfx(a, b) + const DBT *a, *b; +{ + size_t cnt, len; + u_int8_t *p1, *p2; + + cnt = 1; + len = a->size > b->size ? b->size : a->size; + for (p1 = a->data, p2 = b->data; len--; ++p1, ++p2, ++cnt) + if (*p1 != *p2) + return (cnt); + + /* + * We know that a->size must be <= b->size, or they wouldn't be + * in this order. + */ + return (a->size < b->size ? a->size + 1 : a->size); +} diff --git a/mozilla/db/btree/bt_conv.c b/mozilla/db/btree/bt_conv.c new file mode 100644 index 00000000000..3da45077230 --- /dev/null +++ b/mozilla/db/btree/bt_conv.c @@ -0,0 +1,107 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)bt_conv.c 10.6 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "db_swap.h" +#include "btree.h" + +/* + * __bam_pgin -- + * Convert host-specific page layout from the host-independent format + * stored on disk. + * + * PUBLIC: int __bam_pgin __P((db_pgno_t, void *, DBT *)); + */ +int +__bam_pgin(pg, pp, cookie) + db_pgno_t pg; + void *pp; + DBT *cookie; +{ + DB_PGINFO *pginfo; + + pginfo = (DB_PGINFO *)cookie->data; + if (!pginfo->needswap) + return (0); + return (pg == PGNO_METADATA ? + __bam_mswap(pp) : __db_pgin(pg, pginfo->db_pagesize, pp)); +} + +/* + * __bam_pgout -- + * Convert host-specific page layout to the host-independent format + * stored on disk. + * + * PUBLIC: int __bam_pgout __P((db_pgno_t, void *, DBT *)); + */ +int +__bam_pgout(pg, pp, cookie) + db_pgno_t pg; + void *pp; + DBT *cookie; +{ + DB_PGINFO *pginfo; + + pginfo = (DB_PGINFO *)cookie->data; + if (!pginfo->needswap) + return (0); + return (pg == PGNO_METADATA ? + __bam_mswap(pp) : __db_pgout(pg, pginfo->db_pagesize, pp)); +} + +/* + * __bam_mswap -- + * Swap the bytes on the btree metadata page. + * + * PUBLIC: int __bam_mswap __P((PAGE *)); + */ +int +__bam_mswap(pg) + PAGE *pg; +{ + u_int8_t *p; + + p = (u_int8_t *)pg; + + /* Swap the meta-data information. */ + SWAP32(p); /* lsn.file */ + SWAP32(p); /* lsn.offset */ + SWAP32(p); /* pgno */ + SWAP32(p); /* magic */ + SWAP32(p); /* version */ + SWAP32(p); /* pagesize */ + SWAP32(p); /* maxkey */ + SWAP32(p); /* minkey */ + SWAP32(p); /* free */ + SWAP32(p); /* flags */ + + /* Swap the statistics. */ + p = (u_int8_t *)&((BTMETA *)pg)->stat; + SWAP32(p); /* bt_freed */ + SWAP32(p); /* bt_pfxsaved */ + SWAP32(p); /* bt_split */ + SWAP32(p); /* bt_rootsplit */ + SWAP32(p); /* bt_fastsplit */ + SWAP32(p); /* bt_added */ + SWAP32(p); /* bt_deleted */ + SWAP32(p); /* bt_get */ + SWAP32(p); /* bt_cache_hit */ + SWAP32(p); /* bt_cache_miss */ + + return (0); +} diff --git a/mozilla/db/btree/bt_cursor.c b/mozilla/db/btree/bt_cursor.c new file mode 100644 index 00000000000..cfa388741eb --- /dev/null +++ b/mozilla/db/btree/bt_cursor.c @@ -0,0 +1,1752 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)bt_cursor.c 10.53 (Sleepycat) 5/25/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "btree.h" + +static int __bam_c_close __P((DBC *)); +static int __bam_c_del __P((DBC *, u_int32_t)); +static int __bam_c_first __P((DB *, CURSOR *)); +static int __bam_c_get __P((DBC *, DBT *, DBT *, u_int32_t)); +static int __bam_c_getstack __P((DB *, CURSOR *)); +static int __bam_c_last __P((DB *, CURSOR *)); +static int __bam_c_next __P((DB *, CURSOR *, int)); +static int __bam_c_physdel __P((DB *, CURSOR *, PAGE *)); +static int __bam_c_prev __P((DB *, CURSOR *)); +static int __bam_c_put __P((DBC *, DBT *, DBT *, u_int32_t)); +static int __bam_c_rget __P((DB *, CURSOR *, DBT *, u_int32_t)); +static int __bam_c_search + __P((DB *, CURSOR *, const DBT *, u_int32_t, int, int *)); + +/* Discard the current page/lock held by a cursor. */ +#undef DISCARD +#define DISCARD(dbp, cp) { \ + if ((cp)->page != NULL) { \ + (void)memp_fput(dbp->mpf, (cp)->page, 0); \ + (cp)->page = NULL; \ + } \ + if ((cp)->lock != LOCK_INVALID) { \ + (void)__BT_TLPUT((dbp), (cp)->lock); \ + (cp)->lock = LOCK_INVALID; \ + } \ +} + +/* + * __bam_cursor -- + * Interface to the cursor functions. + * + * PUBLIC: int __bam_cursor __P((DB *, DB_TXN *, DBC **)); + */ +int +__bam_cursor(dbp, txn, dbcp) + DB *dbp; + DB_TXN *txn; + DBC **dbcp; +{ + CURSOR *cp; + DBC *dbc; + + DEBUG_LWRITE(dbp, txn, "bam_cursor", NULL, NULL, 0); + + if ((dbc = (DBC *)__db_calloc(1, sizeof(DBC))) == NULL) + return (ENOMEM); + if ((cp = (CURSOR *)__db_calloc(1, sizeof(CURSOR))) == NULL) { + __db_free(dbc); + return (ENOMEM); + } + + cp->dbc = dbc; + cp->pgno = cp->dpgno = PGNO_INVALID; + cp->lock = LOCK_INVALID; + + dbc->dbp = dbp; + dbc->txn = txn; + dbc->internal = cp; + dbc->c_close = __bam_c_close; + dbc->c_del = __bam_c_del; + dbc->c_get = __bam_c_get; + dbc->c_put = __bam_c_put; + + /* + * All cursors are queued from the master DB structure. Add the + * cursor to that queue. + */ + CURSOR_SETUP(dbp); + TAILQ_INSERT_HEAD(&dbp->curs_queue, dbc, links); + CURSOR_TEARDOWN(dbp); + + *dbcp = dbc; + return (0); +} + +/* + * __bam_c_close -- + * Close a single cursor. + */ +static int +__bam_c_close(dbc) + DBC *dbc; +{ + DB *dbp; + int ret; + + DEBUG_LWRITE(dbc->dbp, dbc->txn, "bam_c_close", NULL, NULL, 0); + + GETHANDLE(dbc->dbp, dbc->txn, &dbp, ret); + + ret = __bam_c_iclose(dbp, dbc); + + PUTHANDLE(dbp); + return (ret); +} + +/* + * __bam_c_iclose -- + * Close a single cursor -- internal version. + * + * PUBLIC: int __bam_c_iclose __P((DB *, DBC *)); + */ +int +__bam_c_iclose(dbp, dbc) + DB *dbp; + DBC *dbc; +{ + CURSOR *cp; + int ret; + + /* If a cursor key was deleted, perform the actual deletion. */ + cp = dbc->internal; + ret = F_ISSET(cp, C_DELETED) ? __bam_c_physdel(dbp, cp, NULL) : 0; + + /* Discard any lock if we're not inside a transaction. */ + if (cp->lock != LOCK_INVALID) + (void)__BT_TLPUT(dbp, cp->lock); + + /* Remove the cursor from the queue. */ + CURSOR_SETUP(dbp); + TAILQ_REMOVE(&dbp->curs_queue, dbc, links); + CURSOR_TEARDOWN(dbp); + + /* Discard the structures. */ + FREE(dbc->internal, sizeof(CURSOR)); + FREE(dbc, sizeof(DBC)); + + return (ret); +} + +/* + * __bam_c_del -- + * Delete using a cursor. + */ +static int +__bam_c_del(dbc, flags) + DBC *dbc; + u_int32_t flags; +{ + BTREE *t; + CURSOR *cp; + DB *dbp; + DB_LOCK lock; + PAGE *h; + db_pgno_t pgno; + db_indx_t indx; + int ret; + + DEBUG_LWRITE(dbc->dbp, dbc->txn, "bam_c_del", NULL, NULL, flags); + + cp = dbc->internal; + h = NULL; + + /* Check for invalid flags. */ + if ((ret = __db_cdelchk(dbc->dbp, flags, + F_ISSET(dbc->dbp, DB_AM_RDONLY), cp->pgno != PGNO_INVALID)) != 0) + return (ret); + + /* If already deleted, return failure. */ + if (F_ISSET(cp, C_DELETED | C_REPLACE)) + return (DB_KEYEMPTY); + + GETHANDLE(dbc->dbp, dbc->txn, &dbp, ret); + t = dbp->internal; + + /* + * We don't physically delete the record until the cursor moves, + * so we have to have a long-lived write lock on the page instead + * of a long-lived read lock. Note, we have to have a read lock + * to even get here, so we simply discard it. + */ + if (F_ISSET(dbp, DB_AM_LOCKING) && cp->mode != DB_LOCK_WRITE) { + if ((ret = __bam_lget(dbp, + 0, cp->pgno, DB_LOCK_WRITE, &lock)) != 0) + goto err; + (void)__BT_TLPUT(dbp, cp->lock); + cp->lock = lock; + cp->mode = DB_LOCK_WRITE; + } + + /* + * Acquire the underlying page (which may be different from the above + * page because it may be a duplicate page), and set the on-page and + * in-cursor delete flags. We don't need to lock it as we've already + * write-locked the page leading to it. + */ + if (cp->dpgno == PGNO_INVALID) { + pgno = cp->pgno; + indx = cp->indx; + } else { + pgno = cp->dpgno; + indx = cp->dindx; + } + + if ((ret = __bam_pget(dbp, &h, &pgno, 0)) != 0) + goto err; + + /* Log the change. */ + if (DB_LOGGING(dbp) && + (ret = __bam_cdel_log(dbp->dbenv->lg_info, dbp->txn, &LSN(h), + 0, dbp->log_fileid, PGNO(h), &LSN(h), indx)) != 0) { + (void)memp_fput(dbp->mpf, h, 0); + goto err; + } + + /* Set the intent-to-delete flag on the page and in all cursors. */ + if (cp->dpgno == PGNO_INVALID) + B_DSET(GET_BKEYDATA(h, indx + O_INDX)->type); + else + B_DSET(GET_BKEYDATA(h, indx)->type); + (void)__bam_ca_delete(dbp, pgno, indx, NULL, 0); + + ret = memp_fput(dbp->mpf, h, DB_MPOOL_DIRTY); + h = NULL; + + /* + * If it's a btree with record numbers, we have to adjust the + * counts. + */ + if (F_ISSET(dbp, DB_BT_RECNUM) && + (ret = __bam_c_getstack(dbp, cp)) == 0) { + ret = __bam_adjust(dbp, t, -1); + (void)__bam_stkrel(dbp); + } + +err: if (h != NULL) + (void)memp_fput(dbp->mpf, h, 0); + PUTHANDLE(dbp); + return (ret); +} + +/* + * __bam_get -- + * Retrieve a key/data pair from the tree. + * + * PUBLIC: int __bam_get __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); + */ +int +__bam_get(argdbp, txn, key, data, flags) + DB *argdbp; + DB_TXN *txn; + DBT *key, *data; + u_int32_t flags; +{ + DBC dbc; + CURSOR cp; + int ret; + + DEBUG_LREAD(argdbp, txn, "bam_get", key, NULL, flags); + + /* Check for invalid flags. */ + if ((ret = __db_getchk(argdbp, key, data, flags)) != 0) + return (ret); + + /* Build an internal cursor. */ + memset(&cp, 0, sizeof(cp)); + cp.dbc = &dbc; + cp.pgno = cp.dpgno = PGNO_INVALID; + cp.lock = LOCK_INVALID; + cp.flags = C_INTERNAL; + + /* Build an external cursor. */ + memset(&dbc, 0, sizeof(dbc)); + dbc.dbp = argdbp; + dbc.txn = txn; + dbc.internal = &cp; + + /* Get the key. */ + return(__bam_c_get(&dbc, + key, data, LF_ISSET(DB_SET_RECNO) ? DB_SET_RECNO : DB_SET)); +} + +/* + * __bam_c_get -- + * Get using a cursor (btree). + */ +static int +__bam_c_get(dbc, key, data, flags) + DBC *dbc; + DBT *key, *data; + u_int32_t flags; +{ + BTREE *t; + CURSOR *cp, copy; + DB *dbp; + PAGE *h; + int exact, ret; + + DEBUG_LREAD(dbc->dbp, dbc->txn, "bam_c_get", + flags == DB_SET || flags == DB_SET_RANGE ? key : NULL, NULL, flags); + + cp = dbc->internal; + + /* Check for invalid flags. */ + if ((ret = __db_cgetchk(dbc->dbp, + key, data, flags, cp->pgno != PGNO_INVALID)) != 0) + return (ret); + + GETHANDLE(dbc->dbp, dbc->txn, &dbp, ret); + t = dbp->internal; + + /* + * Break out the code to return a cursor's record number. It + * has nothing to do with the cursor get code except that it's + * been rammed into the interface. + */ + if (LF_ISSET(DB_GET_RECNO)) { + ret = __bam_c_rget(dbp, cp, data, flags); + PUTHANDLE(dbp); + return (ret); + } + + /* Initialize the cursor for a new retrieval. */ + copy = *cp; + cp->page = NULL; + cp->lock = LOCK_INVALID; + + switch (flags) { + case DB_CURRENT: + /* It's not possible to return a deleted record. */ + if (F_ISSET(cp, C_DELETED | C_REPLACE)) { + PUTHANDLE(dbp); + return (DB_KEYEMPTY); + } + + /* Get the page with the current item on it. */ + if ((ret = __bam_pget(dbp, &cp->page, &cp->pgno, 0)) != 0) + goto err; + break; + case DB_NEXT: + if (cp->pgno != PGNO_INVALID) { + if ((ret = __bam_c_next(dbp, cp, 1)) != 0) + goto err; + break; + } + /* FALLTHROUGH */ + case DB_FIRST: + if ((ret = __bam_c_first(dbp, cp)) != 0) + goto err; + break; + case DB_PREV: + if (cp->pgno != PGNO_INVALID) { + if ((ret = __bam_c_prev(dbp, cp)) != 0) + goto err; + break; + } + /* FALLTHROUGH */ + case DB_LAST: + if ((ret = __bam_c_last(dbp, cp)) != 0) + goto err; + break; + case DB_SET_RECNO: + exact = 1; + if ((ret = + __bam_c_search(dbp, cp, key, S_FIND, 1, &exact)) != 0) + goto err; + break; + case DB_SET: + exact = 1; + if ((ret = + __bam_c_search(dbp, cp, key, S_FIND, 0, &exact)) != 0) + goto err; + break; + case DB_SET_RANGE: + exact = 0; + if ((ret = + __bam_c_search(dbp, cp, key, S_FIND, 0, &exact)) != 0) + goto err; + break; + } + + /* + * Return the key if the user didn't give us one. If we've moved to + * a duplicate page, we may no longer have a pointer to the main page, + * so we have to go get it. We know that it's already read-locked, + * however, so we don't have to acquire a new lock. + */ + if (flags != DB_SET) { + if (cp->dpgno != PGNO_INVALID) { + if ((ret = __bam_pget(dbp, &h, &cp->pgno, 0)) != 0) + goto err; + } else + h = cp->page; + ret = __db_ret(dbp, + h, cp->indx, key, &t->bt_rkey.data, &t->bt_rkey.ulen); + if (cp->dpgno != PGNO_INVALID) + (void)memp_fput(dbp->mpf, h, 0); + if (ret) + goto err; + } + + /* Return the data. */ + if ((ret = __db_ret(dbp, cp->page, + cp->dpgno == PGNO_INVALID ? cp->indx + O_INDX : cp->dindx, + data, &t->bt_rdata.data, &t->bt_rdata.ulen)) != 0) + goto err; + + /* + * If the previous cursor record has been deleted, delete it. The + * returned key isn't a deleted key, so clear the flag. + */ + if (F_ISSET(©, C_DELETED) && __bam_c_physdel(dbp, ©, cp->page)) + goto err; + F_CLR(cp, C_DELETED | C_REPLACE); + + /* Release the previous lock, if any. */ + if (copy.lock != LOCK_INVALID) + (void)__BT_TLPUT(dbp, copy.lock); + + /* Release the pinned page. */ + ret = memp_fput(dbp->mpf, cp->page, 0); + + /* Internal cursors don't hold locks. */ + if (F_ISSET(cp, C_INTERNAL) && cp->lock != LOCK_INVALID) + (void)__BT_TLPUT(dbp, cp->lock); + + ++t->lstat.bt_get; + + if (0) { +err: if (cp->page != NULL) + (void)memp_fput(dbp->mpf, cp->page, 0); + if (cp->lock != LOCK_INVALID) + (void)__BT_TLPUT(dbp, cp->lock); + *cp = copy; + } + + PUTHANDLE(dbp); + return (ret); +} + +/* + * __bam_c_rget -- + * Return the record number for a cursor. + */ +static int +__bam_c_rget(dbp, cp, data, flags) + DB *dbp; + CURSOR *cp; + DBT *data; + u_int32_t flags; +{ + BTREE *t; + DBT dbt; + db_recno_t recno; + int exact, ret; + + COMPQUIET(flags, 0); + + /* Get the page with the current item on it. */ + if ((ret = __bam_pget(dbp, &cp->page, &cp->pgno, 0)) != 0) + return (ret); + + /* Get a copy of the key. */ + memset(&dbt, 0, sizeof(DBT)); + dbt.flags = DB_DBT_MALLOC | DB_DBT_INTERNAL; + if ((ret = __db_ret(dbp, cp->page, cp->indx, &dbt, NULL, NULL)) != 0) + goto err; + + exact = 1; + if ((ret = __bam_search(dbp, &dbt, S_FIND, 1, &recno, &exact)) != 0) + goto err; + + t = dbp->internal; + ret = __db_retcopy(data, &recno, sizeof(recno), + &t->bt_rdata.data, &t->bt_rdata.ulen, dbp->db_malloc); + + /* Release the stack. */ + __bam_stkrel(dbp); + +err: (void)memp_fput(dbp->mpf, cp->page, 0); + __db_free(dbt.data); + return (ret); +} + +/* + * __bam_c_put -- + * Put using a cursor. + */ +static int +__bam_c_put(dbc, key, data, flags) + DBC *dbc; + DBT *key, *data; + u_int32_t flags; +{ + BTREE *t; + CURSOR *cp, copy; + DB *dbp; + DBT dbt; + db_indx_t indx; + db_pgno_t pgno; + u_int32_t iiflags; + int exact, needkey, ret, stack; + void *arg; + + DEBUG_LWRITE(dbc->dbp, dbc->txn, "bam_c_put", + flags == DB_KEYFIRST || flags == DB_KEYLAST ? key : NULL, + data, flags); + + cp = dbc->internal; + + if ((ret = __db_cputchk(dbc->dbp, key, data, flags, + F_ISSET(dbc->dbp, DB_AM_RDONLY), cp->pgno != PGNO_INVALID)) != 0) + return (ret); + + GETHANDLE(dbc->dbp, dbc->txn, &dbp, ret); + t = dbp->internal; + + /* Initialize the cursor for a new retrieval. */ + copy = *cp; + cp->page = NULL; + cp->lock = LOCK_INVALID; + + /* + * To split, we need a valid key for the page. Since it's a cursor, + * we have to build one. + */ + stack = 0; + if (0) { +split: /* Acquire a copy of a key from the page. */ + if (needkey) { + memset(&dbt, 0, sizeof(DBT)); + if ((ret = __db_ret(dbp, cp->page, indx, + &dbt, &t->bt_rkey.data, &t->bt_rkey.ulen)) != 0) + goto err; + arg = &dbt; + } else + arg = key; + + /* Discard any pinned pages. */ + if (stack) { + (void)__bam_stkrel(dbp); + stack = 0; + } else + DISCARD(dbp, cp); + + if ((ret = __bam_split(dbp, arg)) != 0) + goto err; + } + + ret = 0; + switch (flags) { + case DB_AFTER: + case DB_BEFORE: + case DB_CURRENT: + needkey = 1; + if (cp->dpgno == PGNO_INVALID) { + pgno = cp->pgno; + indx = cp->indx; + } else { + pgno = cp->dpgno; + indx = cp->dindx; + } + /* + * XXX + * This test is right -- we don't currently support duplicates + * in the presence of record numbers, so we don't worry about + * them if DB_BT_RECNUM is set. + */ + if (F_ISSET(dbp, DB_BT_RECNUM) && + (flags != DB_CURRENT || F_ISSET(cp, C_DELETED))) { + /* Acquire a complete stack. */ + if ((ret = __bam_c_getstack(dbp, cp)) != 0) + goto err; + cp->page = t->bt_csp->page; + + stack = 1; + iiflags = BI_DOINCR; + } else { + /* Acquire the current page. */ + if ((ret = __bam_lget(dbp, + 0, cp->pgno, DB_LOCK_WRITE, &cp->lock)) == 0) + ret = __bam_pget(dbp, &cp->page, &pgno, 0); + if (ret != 0) + goto err; + + iiflags = 0; + } + if ((ret = __bam_iitem(dbp, &cp->page, + &indx, key, data, flags, iiflags)) == DB_NEEDSPLIT) + goto split; + break; + case DB_KEYFIRST: + exact = needkey = 0; + if ((ret = + __bam_c_search(dbp, cp, key, S_KEYFIRST, 0, &exact)) != 0) + goto err; + stack = 1; + + indx = cp->dpgno == PGNO_INVALID ? cp->indx : cp->dindx; + if ((ret = __bam_iitem(dbp, &cp->page, &indx, key, + data, DB_BEFORE, exact ? 0 : BI_NEWKEY)) == DB_NEEDSPLIT) + goto split; + break; + case DB_KEYLAST: + exact = needkey = 0; + if ((ret = + __bam_c_search(dbp, cp, key, S_KEYLAST, 0, &exact)) != 0) + goto err; + stack = 1; + + indx = cp->dpgno == PGNO_INVALID ? cp->indx : cp->dindx; + if ((ret = __bam_iitem(dbp, &cp->page, &indx, key, + data, DB_AFTER, exact ? 0 : BI_NEWKEY)) == DB_NEEDSPLIT) + goto split; + break; + } + if (ret) + goto err; + + /* + * Update the cursor to point to the new entry. The new entry was + * stored on the current page, because we split pages until it was + * possible. + */ + if (cp->dpgno == PGNO_INVALID) + cp->indx = indx; + else + cp->dindx = indx; + + /* + * If the previous cursor record has been deleted, delete it. The + * returned key isn't a deleted key, so clear the flag. + */ + if (F_ISSET(©, C_DELETED) && + (ret = __bam_c_physdel(dbp, ©, cp->page)) != 0) + goto err; + F_CLR(cp, C_DELETED | C_REPLACE); + + /* Release the previous lock, if any. */ + if (copy.lock != LOCK_INVALID) + (void)__BT_TLPUT(dbp, copy.lock); + + /* + * Discard any pages pinned in the tree and their locks, except for + * the leaf page, for which we only discard the pin, not the lock. + * + * Note, the leaf page participated in the stack we acquired, and so + * we have to adjust the stack as necessary. If there was only a + * single page on the stack, we don't have to free further stack pages. + */ + + if (stack && BT_STK_POP(t) != NULL) + (void)__bam_stkrel(dbp); + + if ((ret = memp_fput(dbp->mpf, cp->page, 0)) != 0) + goto err; + + if (0) { +err: /* Discard any pinned pages. */ + if (stack) + (void)__bam_stkrel(dbp); + else + DISCARD(dbp, cp); + *cp = copy; + } + + PUTHANDLE(dbp); + return (ret); +} + +/* + * __bam_c_first -- + * Return the first record. + */ +static int +__bam_c_first(dbp, cp) + DB *dbp; + CURSOR *cp; +{ + db_pgno_t pgno; + int ret; + + /* Walk down the left-hand side of the tree. */ + for (pgno = PGNO_ROOT;;) { + if ((ret = + __bam_lget(dbp, 0, pgno, DB_LOCK_READ, &cp->lock)) != 0) + return (ret); + if ((ret = __bam_pget(dbp, &cp->page, &pgno, 0)) != 0) + return (ret); + + /* If we find a leaf page, we're done. */ + if (ISLEAF(cp->page)) + break; + + pgno = GET_BINTERNAL(cp->page, 0)->pgno; + DISCARD(dbp, cp); + } + + cp->pgno = cp->page->pgno; + cp->indx = 0; + cp->dpgno = PGNO_INVALID; + + /* If it's an empty page or a deleted record, go to the next one. */ + if (NUM_ENT(cp->page) == 0 || + B_DISSET(GET_BKEYDATA(cp->page, cp->indx + O_INDX)->type)) + if ((ret = __bam_c_next(dbp, cp, 0)) != 0) + return (ret); + + /* If it's a duplicate reference, go to the first entry. */ + if ((ret = __bam_ovfl_chk(dbp, cp, O_INDX, 0)) != 0) + return (ret); + + /* If it's a deleted record, go to the next one. */ + if (cp->dpgno != PGNO_INVALID && + B_DISSET(GET_BKEYDATA(cp->page, cp->dindx)->type)) + if ((ret = __bam_c_next(dbp, cp, 0)) != 0) + return (ret); + return (0); +} + +/* + * __bam_c_last -- + * Return the last record. + */ +static int +__bam_c_last(dbp, cp) + DB *dbp; + CURSOR *cp; +{ + db_pgno_t pgno; + int ret; + + /* Walk down the right-hand side of the tree. */ + for (pgno = PGNO_ROOT;;) { + if ((ret = + __bam_lget(dbp, 0, pgno, DB_LOCK_READ, &cp->lock)) != 0) + return (ret); + if ((ret = __bam_pget(dbp, &cp->page, &pgno, 0)) != 0) + return (ret); + + /* If we find a leaf page, we're done. */ + if (ISLEAF(cp->page)) + break; + + pgno = + GET_BINTERNAL(cp->page, NUM_ENT(cp->page) - O_INDX)->pgno; + DISCARD(dbp, cp); + } + + cp->pgno = cp->page->pgno; + cp->indx = NUM_ENT(cp->page) == 0 ? 0 : NUM_ENT(cp->page) - P_INDX; + cp->dpgno = PGNO_INVALID; + + /* If it's an empty page or a deleted record, go to the previous one. */ + if (NUM_ENT(cp->page) == 0 || + B_DISSET(GET_BKEYDATA(cp->page, cp->indx + O_INDX)->type)) + if ((ret = __bam_c_prev(dbp, cp)) != 0) + return (ret); + + /* If it's a duplicate reference, go to the last entry. */ + if ((ret = __bam_ovfl_chk(dbp, cp, cp->indx + O_INDX, 1)) != 0) + return (ret); + + /* If it's a deleted record, go to the previous one. */ + if (cp->dpgno != PGNO_INVALID && + B_DISSET(GET_BKEYDATA(cp->page, cp->dindx)->type)) + if ((ret = __bam_c_prev(dbp, cp)) != 0) + return (ret); + return (0); +} + +/* + * __bam_c_next -- + * Move to the next record. + */ +static int +__bam_c_next(dbp, cp, initial_move) + DB *dbp; + CURSOR *cp; + int initial_move; +{ + db_indx_t adjust, indx; + db_pgno_t pgno; + int ret; + + /* + * We're either moving through a page of duplicates or a btree leaf + * page. + */ + if (cp->dpgno == PGNO_INVALID) { + adjust = dbp->type == DB_BTREE ? P_INDX : O_INDX; + pgno = cp->pgno; + indx = cp->indx; + } else { + adjust = O_INDX; + pgno = cp->dpgno; + indx = cp->dindx; + } + if (cp->page == NULL) { + if ((ret = + __bam_lget(dbp, 0, pgno, DB_LOCK_READ, &cp->lock)) != 0) + return (ret); + if ((ret = __bam_pget(dbp, &cp->page, &pgno, 0)) != 0) + return (ret); + } + + /* + * If at the end of the page, move to a subsequent page. + * + * !!! + * Check for >= NUM_ENT. If we're here as the result of a search that + * landed us on NUM_ENT, we'll increment indx before we test. + * + * !!! + * This code handles empty pages and pages with only deleted entries. + */ + if (initial_move) + indx += adjust; + for (;;) { + if (indx >= NUM_ENT(cp->page)) { + pgno = cp->page->next_pgno; + DISCARD(dbp, cp); + + /* + * If we're in a btree leaf page, we've reached the end + * of the tree. If we've reached the end of a page of + * duplicates, continue from the btree leaf page where + * we found this page of duplicates. + */ + if (pgno == PGNO_INVALID) { + /* If in a btree leaf page, it's EOF. */ + if (cp->dpgno == PGNO_INVALID) + return (DB_NOTFOUND); + + /* Continue from the last btree leaf page. */ + cp->dpgno = PGNO_INVALID; + + adjust = P_INDX; + pgno = cp->pgno; + indx = cp->indx + P_INDX; + } else + indx = 0; + + if ((ret = __bam_lget(dbp, + 0, pgno, DB_LOCK_READ, &cp->lock)) != 0) + return (ret); + if ((ret = __bam_pget(dbp, &cp->page, &pgno, 0)) != 0) + return (ret); + continue; + } + + /* Ignore deleted records. */ + if (dbp->type == DB_BTREE && + ((cp->dpgno == PGNO_INVALID && + B_DISSET(GET_BKEYDATA(cp->page, indx + O_INDX)->type)) || + (cp->dpgno != PGNO_INVALID && + B_DISSET(GET_BKEYDATA(cp->page, indx)->type)))) { + indx += adjust; + continue; + } + + /* + * If we're not in a duplicates page, check to see if we've + * found a page of duplicates, in which case we move to the + * first entry. + */ + if (cp->dpgno == PGNO_INVALID) { + cp->pgno = cp->page->pgno; + cp->indx = indx; + + if ((ret = + __bam_ovfl_chk(dbp, cp, indx + O_INDX, 0)) != 0) + return (ret); + if (cp->dpgno != PGNO_INVALID) { + indx = cp->dindx; + adjust = O_INDX; + continue; + } + } else { + cp->dpgno = cp->page->pgno; + cp->dindx = indx; + } + break; + } + return (0); +} + +/* + * __bam_c_prev -- + * Move to the previous record. + */ +static int +__bam_c_prev(dbp, cp) + DB *dbp; + CURSOR *cp; +{ + db_indx_t indx, adjust; + db_pgno_t pgno; + int ret, set_indx; + + /* + * We're either moving through a page of duplicates or a btree leaf + * page. + */ + if (cp->dpgno == PGNO_INVALID) { + adjust = dbp->type == DB_BTREE ? P_INDX : O_INDX; + pgno = cp->pgno; + indx = cp->indx; + } else { + adjust = O_INDX; + pgno = cp->dpgno; + indx = cp->dindx; + } + if (cp->page == NULL) { + if ((ret = + __bam_lget(dbp, 0, pgno, DB_LOCK_READ, &cp->lock)) != 0) + return (ret); + if ((ret = __bam_pget(dbp, &cp->page, &pgno, 0)) != 0) + return (ret); + } + + /* + * If at the beginning of the page, move to any previous one. + * + * !!! + * This code handles empty pages and pages with only deleted entries. + */ + for (;;) { + if (indx == 0) { + pgno = cp->page->prev_pgno; + DISCARD(dbp, cp); + + /* + * If we're in a btree leaf page, we've reached the + * beginning of the tree. If we've reached the first + * of a page of duplicates, continue from the btree + * leaf page where we found this page of duplicates. + */ + if (pgno == PGNO_INVALID) { + /* If in a btree leaf page, it's SOF. */ + if (cp->dpgno == PGNO_INVALID) + return (DB_NOTFOUND); + + /* Continue from the last btree leaf page. */ + cp->dpgno = PGNO_INVALID; + + adjust = P_INDX; + pgno = cp->pgno; + indx = cp->indx; + set_indx = 0; + } else + set_indx = 1; + + if ((ret = __bam_lget(dbp, + 0, pgno, DB_LOCK_READ, &cp->lock)) != 0) + return (ret); + if ((ret = __bam_pget(dbp, &cp->page, &pgno, 0)) != 0) + return (ret); + + if (set_indx) + indx = NUM_ENT(cp->page); + if (indx == 0) + continue; + } + + /* Ignore deleted records. */ + indx -= adjust; + if (dbp->type == DB_BTREE && + ((cp->dpgno == PGNO_INVALID && + B_DISSET(GET_BKEYDATA(cp->page, indx + O_INDX)->type)) || + (cp->dpgno != PGNO_INVALID && + B_DISSET(GET_BKEYDATA(cp->page, indx)->type)))) + continue; + + /* + * If we're not in a duplicates page, check to see if we've + * found a page of duplicates, in which case we move to the + * last entry. + */ + if (cp->dpgno == PGNO_INVALID) { + cp->pgno = cp->page->pgno; + cp->indx = indx; + + if ((ret = + __bam_ovfl_chk(dbp, cp, indx + O_INDX, 1)) != 0) + return (ret); + if (cp->dpgno != PGNO_INVALID) { + indx = cp->dindx + O_INDX; + adjust = O_INDX; + continue; + } + } else { + cp->dpgno = cp->page->pgno; + cp->dindx = indx; + } + break; + } + return (0); +} + +/* + * __bam_c_search -- + * Move to a specified record. + */ +static int +__bam_c_search(dbp, cp, key, flags, isrecno, exactp) + DB *dbp; + CURSOR *cp; + const DBT *key; + u_int32_t flags; + int isrecno, *exactp; +{ + BTREE *t; + db_recno_t recno; + int needexact, ret; + + t = dbp->internal; + needexact = *exactp; + + /* + * Find any matching record; the search function pins the page. Make + * sure it's a valid key (__bam_search may return an index just past + * the end of a page) and return it. + */ + if (isrecno) { + if ((ret = __ram_getno(dbp, key, &recno, 0)) != 0) + return (ret); + ret = __bam_rsearch(dbp, &recno, flags, 1, exactp); + } else + ret = __bam_search(dbp, key, flags, 1, NULL, exactp); + if (ret != 0) + return (ret); + + cp->page = t->bt_csp->page; + cp->pgno = cp->page->pgno; + cp->indx = t->bt_csp->indx; + cp->lock = t->bt_csp->lock; + cp->dpgno = PGNO_INVALID; + + /* + * If we have an exact match, make sure that we're not looking at a + * chain of duplicates -- if so, move to an entry in that chain. + */ + if (*exactp) { + if ((ret = __bam_ovfl_chk(dbp, + cp, cp->indx + O_INDX, LF_ISSET(S_DUPLAST))) != 0) + return (ret); + } else + if (needexact) + return (DB_NOTFOUND); + + /* If past the end of a page, find the next entry. */ + if (cp->indx == NUM_ENT(cp->page) && + (ret = __bam_c_next(dbp, cp, 0)) != 0) + return (ret); + + /* If it's a deleted record, go to the next or previous one. */ + if (cp->dpgno != PGNO_INVALID && + B_DISSET(GET_BKEYDATA(cp->page, cp->dindx)->type)) + if (flags == S_KEYLAST) { + if ((ret = __bam_c_prev(dbp, cp)) != 0) + return (ret); + } else + if ((ret = __bam_c_next(dbp, cp, 0)) != 0) + return (ret); + /* + * If we don't specify an exact match (the DB_KEYFIRST/DB_KEYLAST or + * DB_SET_RANGE flags were set) __bam_search() may return a deleted + * item. For DB_KEYFIRST/DB_KEYLAST, we don't care since we're only + * using it for a tree position. For DB_SET_RANGE, we're returning + * the key, so we have to adjust it. + */ + if (LF_ISSET(S_DELNO) && cp->dpgno == PGNO_INVALID && + B_DISSET(GET_BKEYDATA(cp->page, cp->indx + O_INDX)->type)) + if ((ret = __bam_c_next(dbp, cp, 0)) != 0) + return (ret); + + return (0); +} + +/* + * __bam_ovfl_chk -- + * Check for an overflow record, and if found, move to the correct + * record. + * + * PUBLIC: int __bam_ovfl_chk __P((DB *, CURSOR *, u_int32_t, int)); + */ +int +__bam_ovfl_chk(dbp, cp, indx, to_end) + DB *dbp; + CURSOR *cp; + u_int32_t indx; + int to_end; +{ + BOVERFLOW *bo; + db_pgno_t pgno; + int ret; + + /* Check for an overflow entry. */ + bo = GET_BOVERFLOW(cp->page, indx); + if (B_TYPE(bo->type) != B_DUPLICATE) + return (0); + + /* + * If we find one, go to the duplicates page, and optionally move + * to the last record on that page. + * + * XXX + * We don't lock duplicates pages, we've already got the correct + * lock on the main page. + */ + pgno = bo->pgno; + if ((ret = memp_fput(dbp->mpf, cp->page, 0)) != 0) + return (ret); + cp->page = NULL; + if (to_end) { + if ((ret = __db_dend(dbp, pgno, &cp->page)) != 0) + return (ret); + indx = NUM_ENT(cp->page) - O_INDX; + } else { + if ((ret = __bam_pget(dbp, &cp->page, &pgno, 0)) != 0) + return (ret); + indx = 0; + } + + /* Update the duplicate entry in the cursor. */ + cp->dpgno = cp->page->pgno; + cp->dindx = indx; + + return (0); +} + +#ifdef DEBUG +/* + * __bam_cprint -- + * Display the current btree cursor list. + * + * PUBLIC: int __bam_cprint __P((DB *)); + */ +int +__bam_cprint(dbp) + DB *dbp; +{ + CURSOR *cp; + DBC *dbc; + + CURSOR_SETUP(dbp); + for (dbc = TAILQ_FIRST(&dbp->curs_queue); + dbc != NULL; dbc = TAILQ_NEXT(dbc, links)) { + cp = (CURSOR *)dbc->internal; + fprintf(stderr, + "%#0x: page: %lu index: %lu dpage %lu dindex: %lu", + (u_int)cp, (u_long)cp->pgno, (u_long)cp->indx, + (u_long)cp->dpgno, (u_long)cp->dindx); + if (F_ISSET(cp, C_DELETED)) + fprintf(stderr, "(deleted)"); + fprintf(stderr, "\n"); + } + CURSOR_TEARDOWN(dbp); + + return (0); +} +#endif /* DEBUG */ + +/* + * __bam_ca_delete -- + * Check if any of the cursors refer to the item we are about to delete, + * returning the number of cursors that refer to the item in question. + * + * PUBLIC: int __bam_ca_delete __P((DB *, db_pgno_t, u_int32_t, CURSOR *, int)); + */ +int +__bam_ca_delete(dbp, pgno, indx, curs, key_delete) + DB *dbp; + db_pgno_t pgno; + u_int32_t indx; + CURSOR *curs; + int key_delete; +{ + DBC *dbc; + CURSOR *cp; + int count; /* !!!: Has to contain max number of cursors. */ + + /* + * Adjust the cursors. We don't have to review the cursors for any + * process other than the current one, because we have the page write + * locked at this point, and any other process had better be using a + * different locker ID, meaning that only cursors in our process can + * be on the page. + * + * It's possible for multiple cursors within the thread to have write + * locks on the same page, but, cursors within a thread must be single + * threaded, so all we're locking here is the cursor linked list. + */ + CURSOR_SETUP(dbp); + for (count = 0, dbc = TAILQ_FIRST(&dbp->curs_queue); + dbc != NULL; dbc = TAILQ_NEXT(dbc, links)) { + cp = (CURSOR *)dbc->internal; + + /* + * Optionally, a cursor passed in is the one initiating the + * delete, so we don't want to count it or set its deleted + * flag. Otherwise, if a cursor refers to the item, then we + * set its deleted flag. + */ + if (curs == cp) + continue; + + /* + * If we're deleting the key itself and not just one of its + * duplicates, repoint the cursor to the main-page key/data + * pair, everything else is about to be discarded. + */ + if (key_delete || cp->dpgno == PGNO_INVALID) { + if (cp->pgno == pgno && cp->indx == indx) { + cp->dpgno = PGNO_INVALID; + ++count; + F_SET(cp, C_DELETED); + } + } else + if (cp->dpgno == pgno && cp->dindx == indx) { + ++count; + F_SET(cp, C_DELETED); + } + } + CURSOR_TEARDOWN(dbp); + + return (count); +} + +/* + * __bam_ca_di -- + * Adjust the cursors during a delete or insert. + * + * PUBLIC: void __bam_ca_di __P((DB *, db_pgno_t, u_int32_t, int)); + */ +void +__bam_ca_di(dbp, pgno, indx, adjust) + DB *dbp; + db_pgno_t pgno; + u_int32_t indx; + int adjust; +{ + CURSOR *cp; + DBC *dbc; + + /* Recno is responsible for its own adjustments. */ + if (dbp->type == DB_RECNO) + return; + + /* + * Adjust the cursors. See the comment in __bam_ca_delete(). + */ + CURSOR_SETUP(dbp); + for (dbc = TAILQ_FIRST(&dbp->curs_queue); + dbc != NULL; dbc = TAILQ_NEXT(dbc, links)) { + cp = (CURSOR *)dbc->internal; + if (cp->pgno == pgno && cp->indx >= indx) + cp->indx += adjust; + if (cp->dpgno == pgno && cp->dindx >= indx) + cp->dindx += adjust; + } + CURSOR_TEARDOWN(dbp); +} + +/* + * __bam_ca_dup -- + * Adjust the cursors when moving data items to a duplicates page. + * + * PUBLIC: void __bam_ca_dup __P((DB *, + * PUBLIC: db_pgno_t, u_int32_t, u_int32_t, db_pgno_t, u_int32_t)); + */ +void +__bam_ca_dup(dbp, fpgno, first, fi, tpgno, ti) + DB *dbp; + db_pgno_t fpgno, tpgno; + u_int32_t first, fi, ti; +{ + CURSOR *cp; + DBC *dbc; + + /* + * Adjust the cursors. See the comment in __bam_ca_delete(). + * + * No need to test duplicates, this only gets called when moving + * leaf page data items onto a duplicates page. + */ + CURSOR_SETUP(dbp); + for (dbc = TAILQ_FIRST(&dbp->curs_queue); + dbc != NULL; dbc = TAILQ_NEXT(dbc, links)) { + cp = (CURSOR *)dbc->internal; + /* + * Ignore matching entries that have already been moved, + * we move from the same location on the leaf page more + * than once. + */ + if (cp->dpgno == PGNO_INVALID && + cp->pgno == fpgno && cp->indx == fi) { + cp->indx = first; + cp->dpgno = tpgno; + cp->dindx = ti; + } + } + CURSOR_TEARDOWN(dbp); +} + +/* + * __bam_ca_move -- + * Adjust the cursors when moving data items to another page. + * + * PUBLIC: void __bam_ca_move __P((DB *, db_pgno_t, db_pgno_t)); + */ +void +__bam_ca_move(dbp, fpgno, tpgno) + DB *dbp; + db_pgno_t fpgno, tpgno; +{ + CURSOR *cp; + DBC *dbc; + + /* Recno is responsible for its own adjustments. */ + if (dbp->type == DB_RECNO) + return; + + /* + * Adjust the cursors. See the comment in __bam_ca_delete(). + * + * No need to test duplicates, this only gets called when copying + * over the root page with a leaf or internal page. + */ + CURSOR_SETUP(dbp); + for (dbc = TAILQ_FIRST(&dbp->curs_queue); + dbc != NULL; dbc = TAILQ_NEXT(dbc, links)) { + cp = (CURSOR *)dbc->internal; + if (cp->pgno == fpgno) + cp->pgno = tpgno; + } + CURSOR_TEARDOWN(dbp); +} + +/* + * __bam_ca_replace -- + * Check if any of the cursors refer to the item we are about to replace. + * If so, their flags should be changed from deleted to replaced. + * + * PUBLIC: void __bam_ca_replace + * PUBLIC: __P((DB *, db_pgno_t, u_int32_t, ca_replace_arg)); + */ +void +__bam_ca_replace(dbp, pgno, indx, pass) + DB *dbp; + db_pgno_t pgno; + u_int32_t indx; + ca_replace_arg pass; +{ + CURSOR *cp; + DBC *dbc; + + /* + * Adjust the cursors. See the comment in __bam_ca_delete(). + * + * Find any cursors that have logically deleted a record we're about + * to overwrite. + * + * Pass == REPLACE_SETUP: + * Set C_REPLACE_SETUP so we can find the cursors again. + * + * Pass == REPLACE_SUCCESS: + * Clear C_DELETED and C_REPLACE_SETUP, set C_REPLACE, the + * overwrite was successful. + * + * Pass == REPLACE_FAILED: + * Clear C_REPLACE_SETUP, the overwrite failed. + * + * For REPLACE_SUCCESS and REPLACE_FAILED, we reset the indx value + * for the cursor as it may have been changed by other cursor update + * routines as the item was deleted/inserted. + */ + CURSOR_SETUP(dbp); + switch (pass) { + case REPLACE_SETUP: /* Setup. */ + for (dbc = TAILQ_FIRST(&dbp->curs_queue); + dbc != NULL; dbc = TAILQ_NEXT(dbc, links)) { + cp = (CURSOR *)dbc->internal; + if ((cp->pgno == pgno && cp->indx == indx) || + (cp->dpgno == pgno && cp->dindx == indx)) + F_SET(cp, C_REPLACE_SETUP); + } + break; + case REPLACE_SUCCESS: /* Overwrite succeeded. */ + for (dbc = TAILQ_FIRST(&dbp->curs_queue); + dbc != NULL; dbc = TAILQ_NEXT(dbc, links)) { + cp = (CURSOR *)dbc->internal; + if (F_ISSET(cp, C_REPLACE_SETUP)) { + if (cp->dpgno == pgno) + cp->dindx = indx; + if (cp->pgno == pgno) + cp->indx = indx; + F_SET(cp, C_REPLACE); + F_CLR(cp, C_DELETED | C_REPLACE_SETUP); + } + } + break; + case REPLACE_FAILED: /* Overwrite failed. */ + for (dbc = TAILQ_FIRST(&dbp->curs_queue); + dbc != NULL; dbc = TAILQ_NEXT(dbc, links)) { + cp = (CURSOR *)dbc->internal; + if (F_ISSET(cp, C_REPLACE_SETUP)) { + if (cp->dpgno == pgno) + cp->dindx = indx; + if (cp->pgno == pgno) + cp->indx = indx; + F_CLR(cp, C_REPLACE_SETUP); + } + } + break; + } + CURSOR_TEARDOWN(dbp); +} + +/* + * __bam_ca_split -- + * Adjust the cursors when splitting a page. + * + * PUBLIC: void __bam_ca_split __P((DB *, + * PUBLIC: db_pgno_t, db_pgno_t, db_pgno_t, u_int32_t, int)); + */ +void +__bam_ca_split(dbp, ppgno, lpgno, rpgno, split_indx, cleft) + DB *dbp; + db_pgno_t ppgno, lpgno, rpgno; + u_int32_t split_indx; + int cleft; +{ + DBC *dbc; + CURSOR *cp; + + /* Recno is responsible for its own adjustments. */ + if (dbp->type == DB_RECNO) + return; + + /* + * Adjust the cursors. See the comment in __bam_ca_delete(). + * + * If splitting the page that a cursor was on, the cursor has to be + * adjusted to point to the same record as before the split. Most + * of the time we don't adjust pointers to the left page, because + * we're going to copy its contents back over the original page. If + * the cursor is on the right page, it is decremented by the number of + * records split to the left page. + */ + CURSOR_SETUP(dbp); + for (dbc = TAILQ_FIRST(&dbp->curs_queue); + dbc != NULL; dbc = TAILQ_NEXT(dbc, links)) { + cp = (CURSOR *)dbc->internal; + if (cp->pgno == ppgno) + if (cp->indx < split_indx) { + if (cleft) + cp->pgno = lpgno; + } else { + cp->pgno = rpgno; + cp->indx -= split_indx; + } + if (cp->dpgno == ppgno) + if (cp->dindx < split_indx) { + if (cleft) + cp->dpgno = lpgno; + } else { + cp->dpgno = rpgno; + cp->dindx -= split_indx; + } + } + CURSOR_TEARDOWN(dbp); +} + +/* + * __bam_c_physdel -- + * Actually do the cursor deletion. + */ +static int +__bam_c_physdel(dbp, cp, h) + DB *dbp; + CURSOR *cp; + PAGE *h; +{ + enum { DELETE_ITEM, DELETE_PAGE, NOTHING_FURTHER } cmd; + BOVERFLOW bo; + BTREE *t; + DBT dbt; + DB_LOCK lock; + db_indx_t indx; + db_pgno_t pgno, next_pgno, prev_pgno; + int delete_page, local_page, ret; + + t = dbp->internal; + delete_page = ret = 0; + + /* Figure out what we're deleting. */ + if (cp->dpgno == PGNO_INVALID) { + pgno = cp->pgno; + indx = cp->indx; + } else { + pgno = cp->dpgno; + indx = cp->dindx; + } + + /* + * If the item is referenced by another cursor, leave it up to that + * cursor to do the delete. + */ + if (__bam_ca_delete(dbp, pgno, indx, cp, 0) != 0) + return (0); + + /* + * If we don't already have the page locked, get it and delete the + * items. + */ + if ((h == NULL || h->pgno != pgno)) { + if ((ret = __bam_lget(dbp, 0, pgno, DB_LOCK_WRITE, &lock)) != 0) + return (ret); + if ((ret = __bam_pget(dbp, &h, &pgno, 0)) != 0) + return (ret); + local_page = 1; + } else + local_page = 0; + + /* + * If we're deleting a duplicate entry and there are other duplicate + * entries remaining, call the common code to do the work and fix up + * the parent page as necessary. Otherwise, do a normal btree delete. + * + * There are 5 possible cases: + * + * 1. It's not a duplicate item: do a normal btree delete. + * 2. It's a duplicate item: + * 2a: We delete an item from a page of duplicates, but there are + * more items on the page. + * 2b: We delete the last item from a page of duplicates, deleting + * the last duplicate. + * 2c: We delete the last item from a page of duplicates, but there + * is a previous page of duplicates. + * 2d: We delete the last item from a page of duplicates, but there + * is a following page of duplicates. + * + * In the case of: + * + * 1: There's nothing further to do. + * 2a: There's nothing further to do. + * 2b: Do the normal btree delete instead of a duplicate delete, as + * that deletes both the duplicate chain and the parent page's + * entry. + * 2c: There's nothing further to do. + * 2d: Delete the duplicate, and update the parent page's entry. + */ + if (TYPE(h) == P_DUPLICATE) { + pgno = PGNO(h); + prev_pgno = PREV_PGNO(h); + next_pgno = NEXT_PGNO(h); + + if (NUM_ENT(h) == 1 && + prev_pgno == PGNO_INVALID && next_pgno == PGNO_INVALID) + cmd = DELETE_PAGE; + else { + cmd = DELETE_ITEM; + + /* Delete the duplicate. */ + if ((ret = __db_drem(dbp, &h, indx, __bam_free)) != 0) + goto err; + + /* + * 2a: h != NULL, h->pgno == pgno + * 2b: We don't reach this clause, as the above test + * was true. + * 2c: h == NULL, prev_pgno != PGNO_INVALID + * 2d: h != NULL, next_pgno != PGNO_INVALID + * + * Test for 2a and 2c: if we didn't empty the current + * page or there was a previous page of duplicates, we + * don't need to touch the parent page. + */ + if ((h != NULL && pgno == h->pgno) || + prev_pgno != PGNO_INVALID) + cmd = NOTHING_FURTHER; + } + + /* + * Release any page we're holding and its lock. + * + * !!! + * If there is no subsequent page in the duplicate chain, then + * __db_drem will have put page "h" and set it to NULL. + */ + if (local_page) { + if (h != NULL) + (void)memp_fput(dbp->mpf, h, 0); + (void)__BT_TLPUT(dbp, lock); + local_page = 0; + } + + if (cmd == NOTHING_FURTHER) + goto done; + + /* Acquire the parent page and switch the index to its entry. */ + if ((ret = + __bam_lget(dbp, 0, cp->pgno, DB_LOCK_WRITE, &lock)) != 0) + goto err; + if ((ret = __bam_pget(dbp, &h, &cp->pgno, 0)) != 0) { + (void)__BT_TLPUT(dbp, lock); + goto err; + } + local_page = 1; + indx = cp->indx; + + if (cmd == DELETE_PAGE) + goto btd; + + /* + * Copy, delete, update, add-back the parent page's data entry. + * + * XXX + * This may be a performance/logging problem. We should add a + * log message which simply logs/updates a random set of bytes + * on a page, and use it instead of doing a delete/add pair. + */ + indx += O_INDX; + bo = *GET_BOVERFLOW(h, indx); + (void)__db_ditem(dbp, h, indx, BOVERFLOW_SIZE); + bo.pgno = next_pgno; + memset(&dbt, 0, sizeof(dbt)); + dbt.data = &bo; + dbt.size = BOVERFLOW_SIZE; + (void)__db_pitem(dbp, h, indx, BOVERFLOW_SIZE, &dbt, NULL); + (void)memp_fset(dbp->mpf, h, DB_MPOOL_DIRTY); + goto done; + } + +btd: /* + * If the page is going to be emptied, delete it. To delete a leaf + * page we need a copy of a key from the page. We use the 0th page + * index since it's the last key that the page held. + * + * We malloc the page information instead of using the return key/data + * memory because we've already set them -- the reason we've already + * set them is because we're (potentially) about to do a reverse split, + * which would make our saved page information useless. + * + * XXX + * The following operations to delete a page might deadlock. I think + * that's OK. The problem is if we're deleting an item because we're + * closing cursors because we've already deadlocked and want to call + * txn_abort(). If we fail due to deadlock, we leave a locked empty + * page in the tree, which won't be empty long because we're going to + * undo the delete. + */ + if (NUM_ENT(h) == 2 && h->pgno != PGNO_ROOT) { + memset(&dbt, 0, sizeof(DBT)); + dbt.flags = DB_DBT_MALLOC | DB_DBT_INTERNAL; + if ((ret = __db_ret(dbp, h, 0, &dbt, NULL, NULL)) != 0) + goto err; + delete_page = 1; + } + + /* + * Do a normal btree delete. + * + * XXX + * Delete the key item first, otherwise the duplicate checks in + * __bam_ditem() won't work! + */ + if ((ret = __bam_ditem(dbp, h, indx)) != 0) + goto err; + if ((ret = __bam_ditem(dbp, h, indx)) != 0) + goto err; + + /* Discard any remaining locks/pages. */ + if (local_page) { + (void)memp_fput(dbp->mpf, h, 0); + (void)__BT_TLPUT(dbp, lock); + local_page = 0; + } + + /* Delete the page if it was emptied. */ + if (delete_page) + ret = __bam_dpage(dbp, &dbt); + +err: +done: if (delete_page) + __db_free(dbt.data); + + if (local_page) { + (void)memp_fput(dbp->mpf, h, 0); + (void)__BT_TLPUT(dbp, lock); + } + + if (ret == 0) + ++t->lstat.bt_deleted; + return (ret); +} + +/* + * __bam_c_getstack -- + * Acquire a full stack for a cursor. + */ +static int +__bam_c_getstack(dbp, cp) + DB *dbp; + CURSOR *cp; +{ + DBT dbt; + PAGE *h; + db_pgno_t pgno; + int exact, ret; + + ret = 0; + h = NULL; + memset(&dbt, 0, sizeof(DBT)); + + /* Get the page with the current item on it. */ + pgno = cp->pgno; + if ((ret = __bam_pget(dbp, &h, &pgno, 0)) != 0) + return (ret); + + /* Get a copy of a key from the page. */ + dbt.flags = DB_DBT_MALLOC | DB_DBT_INTERNAL; + if ((ret = __db_ret(dbp, h, 0, &dbt, NULL, NULL)) != 0) + goto err; + + /* Get a write-locked stack for that page. */ + exact = 0; + ret = __bam_search(dbp, &dbt, S_KEYFIRST, 1, NULL, &exact); + + /* We no longer need the key or the page. */ +err: if (h != NULL) + (void)memp_fput(dbp->mpf, h, 0); + if (dbt.data != NULL) + __db_free(dbt.data); + return (ret); +} diff --git a/mozilla/db/btree/bt_delete.c b/mozilla/db/btree/bt_delete.c new file mode 100644 index 00000000000..7e71037e46a --- /dev/null +++ b/mozilla/db/btree/bt_delete.c @@ -0,0 +1,647 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * 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. 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)bt_delete.c 10.31 (Sleepycat) 5/6/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "btree.h" + +static int __bam_dpages __P((DB *, BTREE *)); + +/* + * __bam_delete -- + * Delete the items referenced by a key. + * + * PUBLIC: int __bam_delete __P((DB *, DB_TXN *, DBT *, u_int32_t)); + */ +int +__bam_delete(argdbp, txn, key, flags) + DB *argdbp; + DB_TXN *txn; + DBT *key; + u_int32_t flags; +{ + BTREE *t; + DB *dbp; + PAGE *h; + db_indx_t cnt, i, indx; + int dpage, exact, ret, stack; + + DEBUG_LWRITE(argdbp, txn, "bam_delete", key, NULL, flags); + + stack = 0; + + /* Check for invalid flags. */ + if ((ret = __db_delchk(argdbp, + key, flags, F_ISSET(argdbp, DB_AM_RDONLY))) != 0) + return (ret); + + GETHANDLE(argdbp, txn, &dbp, ret); + t = dbp->internal; + + /* Search the tree for the key; delete only deletes exact matches. */ + if ((ret = __bam_search(dbp, key, S_DELETE, 1, NULL, &exact)) != 0) + goto err; + stack = 1; + h = t->bt_csp->page; + indx = t->bt_csp->indx; + + /* Delete the key/data pair, including any on-or-off page duplicates. */ + for (cnt = 1, i = indx;; ++cnt) + if ((i += P_INDX) >= NUM_ENT(h) || h->inp[i] != h->inp[indx]) + break; + for (; cnt > 0; --cnt, ++t->lstat.bt_deleted) + if (__bam_ca_delete(dbp, h->pgno, indx, NULL, 1) == 0) { + /* + * XXX + * Delete the key item first, otherwise the duplicate + * checks in __bam_ditem() won't work! + */ + if ((ret = __bam_ditem(dbp, h, indx)) != 0) + goto err; + if ((ret = __bam_ditem(dbp, h, indx)) != 0) + goto err; + } else { + B_DSET(GET_BKEYDATA(h, indx + O_INDX)->type); + indx += P_INDX; + } + + /* If we're using record numbers, update internal page record counts. */ + if (F_ISSET(dbp, DB_BT_RECNUM) && (ret = __bam_adjust(dbp, t, -1)) != 0) + goto err; + + /* If the page is now empty, delete it. */ + dpage = NUM_ENT(h) == 0 && h->pgno != PGNO_ROOT; + + __bam_stkrel(dbp); + stack = 0; + + ret = dpage ? __bam_dpage(dbp, key) : 0; + +err: if (stack) + __bam_stkrel(dbp); + PUTHANDLE(dbp); + return (ret); +} + +/* + * __ram_delete -- + * Delete the items referenced by a key. + * + * PUBLIC: int __ram_delete __P((DB *, DB_TXN *, DBT *, u_int32_t)); + */ +int +__ram_delete(argdbp, txn, key, flags) + DB *argdbp; + DB_TXN *txn; + DBT *key; + u_int32_t flags; +{ + BKEYDATA bk; + BTREE *t; + DB *dbp; + DBT hdr, data; + PAGE *h; + db_indx_t indx; + db_recno_t recno; + int exact, ret, stack; + + stack = 0; + + /* Check for invalid flags. */ + if ((ret = __db_delchk(argdbp, + key, flags, F_ISSET(argdbp, DB_AM_RDONLY))) != 0) + return (ret); + + GETHANDLE(argdbp, txn, &dbp, ret); + t = dbp->internal; + + /* Check the user's record number and fill in as necessary. */ + if ((ret = __ram_getno(argdbp, key, &recno, 0)) != 0) + goto err; + + /* Search the tree for the key; delete only deletes exact matches. */ + if ((ret = __bam_rsearch(dbp, &recno, S_DELETE, 1, &exact)) != 0) + goto err; + if (!exact) { + ret = DB_NOTFOUND; + goto err; + } + + h = t->bt_csp->page; + indx = t->bt_csp->indx; + stack = 1; + + /* If the record has already been deleted, we couldn't have found it. */ + if (B_DISSET(GET_BKEYDATA(h, indx)->type)) { + ret = DB_KEYEMPTY; + goto done; + } + + /* + * If we're not renumbering records, replace the record with a marker + * and return. + */ + if (!F_ISSET(dbp, DB_RE_RENUMBER)) { + if ((ret = __bam_ditem(dbp, h, indx)) != 0) + goto err; + + B_TSET(bk.type, B_KEYDATA, 1); + bk.len = 0; + memset(&hdr, 0, sizeof(hdr)); + hdr.data = &bk; + hdr.size = SSZA(BKEYDATA, data); + memset(&data, 0, sizeof(data)); + data.data = (char *)""; + data.size = 0; + if ((ret = __db_pitem(dbp, + h, indx, BKEYDATA_SIZE(0), &hdr, &data)) != 0) + goto err; + + ++t->lstat.bt_deleted; + goto done; + } + + /* Delete the item. */ + if ((ret = __bam_ditem(dbp, h, indx)) != 0) + goto err; + + ++t->lstat.bt_deleted; + if (t->bt_recno != NULL) + F_SET(t->bt_recno, RECNO_MODIFIED); + + /* Adjust the counts. */ + __bam_adjust(dbp, t, -1); + + /* Adjust the cursors. */ + __ram_ca(dbp, recno, CA_DELETE); + + /* + * If the page is now empty, delete it -- we have the whole tree + * locked, so there are no preparations to make. Else, release + * the pages. + */ + if (NUM_ENT(h) == 0 && h->pgno != PGNO_ROOT) { + stack = 0; + ret = __bam_dpages(dbp, t); + } + +done: +err: if (stack) + __bam_stkrel(dbp); + + PUTHANDLE(dbp); + return (ret); +} + +/* + * __bam_ditem -- + * Delete one or more entries from a page. + * + * PUBLIC: int __bam_ditem __P((DB *, PAGE *, u_int32_t)); + */ +int +__bam_ditem(dbp, h, indx) + DB *dbp; + PAGE *h; + u_int32_t indx; +{ + BINTERNAL *bi; + BKEYDATA *bk; + BOVERFLOW *bo; + u_int32_t nbytes; + int ret; + + switch (TYPE(h)) { + case P_IBTREE: + bi = GET_BINTERNAL(h, indx); + switch (B_TYPE(bi->type)) { + case B_DUPLICATE: + case B_OVERFLOW: + nbytes = BINTERNAL_SIZE(bi->len); + bo = (BOVERFLOW *)bi->data; + goto offpage; + case B_KEYDATA: + nbytes = BINTERNAL_SIZE(bi->len); + break; + default: + return (__db_pgfmt(dbp, h->pgno)); + } + break; + case P_IRECNO: + nbytes = RINTERNAL_SIZE; + break; + case P_LBTREE: + /* + * If it's a duplicate key, discard the index and don't touch + * the actual page item. + * + * XXX + * This works because no data item can have an index matching + * any other index so even if the data item is in a key "slot", + * it won't match any other index. + */ + if ((indx % 2) == 0) { + /* + * Check for a duplicate after us on the page. NOTE: + * we have to delete the key item before deleting the + * data item, otherwise the "indx + P_INDX" calculation + * won't work! + */ + if (indx + P_INDX < (u_int32_t)NUM_ENT(h) && + h->inp[indx] == h->inp[indx + P_INDX]) + return (__bam_adjindx(dbp, + h, indx, indx + O_INDX, 0)); + /* + * Check for a duplicate before us on the page. It + * doesn't matter if we delete the key item before or + * after the data item for the purposes of this one. + */ + if (indx > 0 && h->inp[indx] == h->inp[indx - P_INDX]) + return (__bam_adjindx(dbp, + h, indx, indx - P_INDX, 0)); + } + /* FALLTHROUGH */ + case P_LRECNO: + bk = GET_BKEYDATA(h, indx); + switch (B_TYPE(bk->type)) { + case B_DUPLICATE: + case B_OVERFLOW: + nbytes = BOVERFLOW_SIZE; + bo = GET_BOVERFLOW(h, indx); + +offpage: /* Delete duplicate/offpage chains. */ + if (B_TYPE(bo->type) == B_DUPLICATE) { + if ((ret = + __db_ddup(dbp, bo->pgno, __bam_free)) != 0) + return (ret); + } else + if ((ret = + __db_doff(dbp, bo->pgno, __bam_free)) != 0) + return (ret); + break; + case B_KEYDATA: + nbytes = BKEYDATA_SIZE(bk->len); + break; + default: + return (__db_pgfmt(dbp, h->pgno)); + } + break; + default: + return (__db_pgfmt(dbp, h->pgno)); + } + + /* Delete the item. */ + if ((ret = __db_ditem(dbp, h, indx, nbytes)) != 0) + return (ret); + + /* Mark the page dirty. */ + return (memp_fset(dbp->mpf, h, DB_MPOOL_DIRTY)); +} + +/* + * __bam_adjindx -- + * Adjust an index on the page. + * + * PUBLIC: int __bam_adjindx __P((DB *, PAGE *, u_int32_t, u_int32_t, int)); + */ +int +__bam_adjindx(dbp, h, indx, indx_copy, is_insert) + DB *dbp; + PAGE *h; + u_int32_t indx, indx_copy; + int is_insert; +{ + db_indx_t copy; + int ret; + + /* Log the change. */ + if (DB_LOGGING(dbp) && + (ret = __bam_adj_log(dbp->dbenv->lg_info, dbp->txn, &LSN(h), + 0, dbp->log_fileid, PGNO(h), &LSN(h), indx, indx_copy, + (u_int32_t)is_insert)) != 0) + return (ret); + + if (is_insert) { + copy = h->inp[indx_copy]; + if (indx != NUM_ENT(h)) + memmove(&h->inp[indx + O_INDX], &h->inp[indx], + sizeof(db_indx_t) * (NUM_ENT(h) - indx)); + h->inp[indx] = copy; + ++NUM_ENT(h); + } else { + --NUM_ENT(h); + if (indx != NUM_ENT(h)) + memmove(&h->inp[indx], &h->inp[indx + O_INDX], + sizeof(db_indx_t) * (NUM_ENT(h) - indx)); + } + + /* Mark the page dirty. */ + ret = memp_fset(dbp->mpf, h, DB_MPOOL_DIRTY); + + /* Adjust the cursors. */ + __bam_ca_di(dbp, h->pgno, indx, is_insert ? 1 : -1); + return (0); +} + +/* + * __bam_dpage -- + * Delete a page from the tree. + * + * PUBLIC: int __bam_dpage __P((DB *, const DBT *)); + */ +int +__bam_dpage(dbp, key) + DB *dbp; + const DBT *key; +{ + BTREE *t; + DB_LOCK lock; + PAGE *h; + db_pgno_t pgno; + int level; /* !!!: has to hold number of tree levels. */ + int exact, ret; + + ret = 0; + t = dbp->internal; + + /* + * The locking protocol is that we acquire locks by walking down the + * tree, to avoid the obvious deadlocks. + * + * Call __bam_search to reacquire the empty leaf page, but this time + * get both the leaf page and it's parent, locked. Walk back up the + * tree, until we have the top pair of pages that we want to delete. + * Once we have the top page that we want to delete locked, lock the + * underlying pages and check to make sure they're still empty. If + * they are, delete them. + */ + for (level = LEAFLEVEL;; ++level) { + /* Acquire a page and its parent, locked. */ + if ((ret = + __bam_search(dbp, key, S_WRPAIR, level, NULL, &exact)) != 0) + return (ret); + + /* + * If we reach the root or the page isn't going to be empty + * when we delete one record, quit. + */ + h = t->bt_csp[-1].page; + if (h->pgno == PGNO_ROOT || NUM_ENT(h) != 1) + break; + + /* Release the two locked pages. */ + (void)memp_fput(dbp->mpf, t->bt_csp[-1].page, 0); + (void)__BT_TLPUT(dbp, t->bt_csp[-1].lock); + (void)memp_fput(dbp->mpf, t->bt_csp[0].page, 0); + (void)__BT_TLPUT(dbp, t->bt_csp[0].lock); + } + + /* + * Leave the stack pointer one after the last entry, we may be about + * to push more items on the stack. + */ + ++t->bt_csp; + + /* + * t->bt_csp[-2].page is the top page, which we're not going to delete, + * and t->bt_csp[-1].page is the first page we are going to delete. + * + * Walk down the chain, acquiring the rest of the pages until we've + * retrieved the leaf page. If we find any pages that aren't going + * to be emptied by the delete, someone else added something while we + * were walking the tree, and we discontinue the delete. + */ + for (h = t->bt_csp[-1].page;;) { + if (ISLEAF(h)) { + if (NUM_ENT(h) != 0) + goto release; + break; + } else + if (NUM_ENT(h) != 1) + goto release; + + /* + * Get the next page, write lock it and push it onto the stack. + * We know it's index 0, because it can only have one element. + */ + pgno = TYPE(h) == P_IBTREE ? + GET_BINTERNAL(h, 0)->pgno : GET_RINTERNAL(h, 0)->pgno; + + if ((ret = __bam_lget(dbp, 0, pgno, DB_LOCK_WRITE, &lock)) != 0) + goto release; + if ((ret = __bam_pget(dbp, &h, &pgno, 0)) != 0) + goto release; + BT_STK_PUSH(t, h, 0, lock, ret); + if (ret != 0) + goto release; + } + + BT_STK_POP(t); + return (__bam_dpages(dbp, t)); + +release: + /* Discard any locked pages and return. */ + BT_STK_POP(t); + __bam_stkrel(dbp); + return (ret); +} + +/* + * __bam_dpages -- + * Delete a set of locked pages. + */ +static int +__bam_dpages(dbp, t) + DB *dbp; + BTREE *t; +{ + DBT a, b; + DB_LOCK lock; + EPG *epg; + PAGE *h; + db_pgno_t pgno; + db_recno_t rcnt; + int ret; + + COMPQUIET(rcnt, 0); + + epg = t->bt_sp; + + /* + * !!! + * There is an interesting deadlock situation here. We have to relink + * the leaf page chain around the leaf page being deleted. Consider + * a cursor walking through the leaf pages, that has the previous page + * read-locked and is waiting on a lock for the page we're deleting. + * It will deadlock here. This is a problem, because if our process is + * selected to resolve the deadlock, we'll leave an empty leaf page + * that we can never again access by walking down the tree. So, before + * we unlink the subtree, we relink the leaf page chain. + */ + if ((ret = __db_relink(dbp, t->bt_csp->page, NULL, 1)) != 0) + goto release; + + /* + * We have the entire stack of deletable pages locked. Start from the + * top of the tree and move to the bottom, as it's better to release + * the inner pages as soon as possible. + */ + if ((ret = __bam_ditem(dbp, epg->page, epg->indx)) != 0) + goto release; + + /* + * If we just deleted the last or next-to-last item from the root page, + * the tree can collapse a level. Write lock the last page referenced + * by the root page and copy it over the root page. If we can't get a + * write lock, that's okay, the tree just remains a level deeper than + * we'd like. + */ + h = epg->page; + if (h->pgno == PGNO_ROOT && NUM_ENT(h) <= 1) { + pgno = TYPE(epg->page) == P_IBTREE ? + GET_BINTERNAL(epg->page, 0)->pgno : + GET_RINTERNAL(epg->page, 0)->pgno; + if ((ret = __bam_lget(dbp, 0, pgno, DB_LOCK_WRITE, &lock)) != 0) + goto release; + if ((ret = __bam_pget(dbp, &h, &pgno, 0)) != 0) + goto release; + + /* Log the change. */ + if (DB_LOGGING(dbp)) { + memset(&a, 0, sizeof(a)); + a.data = h; + a.size = dbp->pgsize; + memset(&b, 0, sizeof(b)); + b.data = P_ENTRY(epg->page, 0); + b.size = BINTERNAL_SIZE(((BINTERNAL *)b.data)->len); + __bam_rsplit_log(dbp->dbenv->lg_info, dbp->txn, + &h->lsn, 0, dbp->log_fileid, h->pgno, &a, + RE_NREC(epg->page), &b, &epg->page->lsn); + } + + /* + * Make the switch. + * + * One fixup -- if the tree has record numbers and we're not + * converting to a leaf page, we have to preserve the total + * record count. + */ + if (TYPE(h) == P_IRECNO || + (TYPE(h) == P_IBTREE && F_ISSET(dbp, DB_BT_RECNUM))) + rcnt = RE_NREC(epg->page); + memcpy(epg->page, h, dbp->pgsize); + epg->page->pgno = PGNO_ROOT; + if (TYPE(h) == P_IRECNO || + (TYPE(h) == P_IBTREE && F_ISSET(dbp, DB_BT_RECNUM))) + RE_NREC_SET(epg->page, rcnt); + (void)memp_fset(dbp->mpf, epg->page, DB_MPOOL_DIRTY); + + /* + * Free the page copied onto the root page and discard its + * lock. (The call to __bam_free() discards our reference + * to the page.) + * + * It's possible that the reverse split we're doing involves + * pages from the stack of pages we're deleting. Don't free + * the page twice. + */ + if (h->pgno == (epg + 1)->page->pgno) + (void)memp_fput(dbp->mpf, h, 0); + else { + (void)__bam_free(dbp, h); + ++t->lstat.bt_freed; + } + (void)__BT_TLPUT(dbp, lock); + + /* Adjust the cursors. */ + __bam_ca_move(dbp, h->pgno, PGNO_ROOT); + } + + /* Release the top page in the subtree. */ + (void)memp_fput(dbp->mpf, epg->page, 0); + (void)__BT_TLPUT(dbp, epg->lock); + + /* + * Free the rest of the pages. + * + * XXX + * Don't bother checking for errors. We've unlinked the subtree from + * the tree, and there's no possibility of recovery. + */ + while (++epg <= t->bt_csp) { + /* + * XXX + * Why do we need to do this? Isn't the page already empty? + */ + if (NUM_ENT(epg->page) != 0) + (void)__bam_ditem(dbp, epg->page, epg->indx); + + (void)__bam_free(dbp, epg->page); + (void)__BT_TLPUT(dbp, epg->lock); + ++t->lstat.bt_freed; + } + return (0); + +release: + /* Discard any remaining pages and return. */ + for (; epg <= t->bt_csp; ++epg) { + (void)memp_fput(dbp->mpf, epg->page, 0); + (void)__BT_TLPUT(dbp, epg->lock); + } + return (ret); +} diff --git a/mozilla/db/btree/bt_open.c b/mozilla/db/btree/bt_open.c new file mode 100644 index 00000000000..f5974ec61ee --- /dev/null +++ b/mozilla/db/btree/bt_open.c @@ -0,0 +1,348 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * 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. 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)bt_open.c 10.27 (Sleepycat) 5/6/98"; +#endif /* not lint */ + +/* + * Implementation of btree access method for 4.4BSD. + * + * The design here was originally based on that of the btree access method + * used in the Postgres database system at UC Berkeley. This implementation + * is wholly independent of the Postgres code. + */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "btree.h" + +static int __bam_keyalloc __P((BTREE *)); +static int __bam_setmeta __P((DB *, BTREE *)); + +/* + * __bam_open -- + * Open a btree. + * + * PUBLIC: int __bam_open __P((DB *, DBTYPE, DB_INFO *)); + */ +int +__bam_open(dbp, type, dbinfo) + DB *dbp; + DBTYPE type; + DB_INFO *dbinfo; +{ + BTREE *t; + int ret; + + /* Allocate the btree internal structure. */ + if ((t = (BTREE *)__db_calloc(1, sizeof(BTREE))) == NULL) + return (ENOMEM); + + t->bt_sp = t->bt_csp = t->bt_stack; + t->bt_esp = t->bt_stack + sizeof(t->bt_stack) / sizeof(t->bt_stack[0]); + + if ((type == DB_RECNO || F_ISSET(dbp, DB_BT_RECNUM)) && + (ret = __bam_keyalloc(t)) != 0) + goto err; + + /* + * Intention is to make sure all of the user's selections are okay + * here and then use them without checking. + */ + if (dbinfo != NULL) { + /* Minimum number of keys per page. */ + if (dbinfo->bt_minkey == 0) + t->bt_minkey = DEFMINKEYPAGE; + else { + if (dbinfo->bt_minkey < 2) + goto einval; + t->bt_minkey = dbinfo->bt_minkey; + } + + /* Maximum number of keys per page. */ + if (dbinfo->bt_maxkey == 0) + t->bt_maxkey = 0; + else { + if (dbinfo->bt_maxkey < 1) + goto einval; + t->bt_maxkey = dbinfo->bt_maxkey; + } + + /* + * If no comparison, use default comparison. If no comparison + * and no prefix, use default prefix. (We can't default the + * prefix if the user supplies a comparison routine; shortening + * the keys may break their comparison algorithm.) + */ + t->bt_compare = dbinfo->bt_compare == NULL ? + __bam_defcmp : dbinfo->bt_compare; + t->bt_prefix = dbinfo->bt_prefix == NULL ? + (dbinfo->bt_compare == NULL ? + __bam_defpfx : NULL) : dbinfo->bt_prefix; + } else { + t->bt_minkey = DEFMINKEYPAGE; + t->bt_compare = __bam_defcmp; + t->bt_prefix = __bam_defpfx; + } + + /* Initialize the remaining fields of the DB. */ + dbp->type = type; + dbp->internal = t; + dbp->cursor = __bam_cursor; + dbp->del = __bam_delete; + dbp->get = __bam_get; + dbp->put = __bam_put; + dbp->stat = __bam_stat; + dbp->sync = __bam_sync; + + /* + * The btree data structure requires that at least two key/data pairs + * can fit on a page, but other than that there's no fixed requirement. + * Translate the minimum number of items into the bytes a key/data pair + * can use before being placed on an overflow page. We calculate for + * the worst possible alignment by assuming every item requires the + * maximum alignment for padding. + * + * Recno uses the btree bt_ovflsize value -- it's close enough. + */ + t->bt_ovflsize = (dbp->pgsize - P_OVERHEAD) / (t->bt_minkey * P_INDX) + - (BKEYDATA_PSIZE(0) + ALIGN(1, 4)); + + /* Create a root page if new tree. */ + if ((ret = __bam_setmeta(dbp, t)) != 0) + goto err; + + return (0); + +einval: ret = EINVAL; + +err: if (t != NULL) { + /* If we allocated room for key/data return, discard it. */ + if (t->bt_rkey.data != NULL) + __db_free(t->bt_rkey.data); + + FREE(t, sizeof(BTREE)); + } + return (ret); +} + +/* + * __bam_bdup -- + * Create a BTREE handle for a threaded DB handle. + * + * PUBLIC: int __bam_bdup __P((DB *, DB *)); + */ +int +__bam_bdup(orig, new) + DB *orig, *new; +{ + BTREE *t, *ot; + int ret; + + ot = orig->internal; + + if ((t = (BTREE *)__db_calloc(1, sizeof(*t))) == NULL) + return (ENOMEM); + + /* + * !!! + * Ignore the cursor queue, only the first DB has attached cursors. + */ + + t->bt_sp = t->bt_csp = t->bt_stack; + t->bt_esp = t->bt_stack + sizeof(t->bt_stack) / sizeof(t->bt_stack[0]); + + if ((orig->type == DB_RECNO || F_ISSET(orig, DB_BT_RECNUM)) && + (ret = __bam_keyalloc(t)) != 0) { + FREE(t, sizeof(*t)); + return (ret); + } + + t->bt_maxkey = ot->bt_maxkey; + t->bt_minkey = ot->bt_minkey; + t->bt_compare = ot->bt_compare; + t->bt_prefix = ot->bt_prefix; + t->bt_ovflsize = ot->bt_ovflsize; + + /* + * !!! + * The entire RECNO structure is shared. If it breaks, the application + * was misusing it to start with. + */ + t->bt_recno = ot->bt_recno; + + new->internal = t; + + return (0); +} + +/* + * __bam_keyalloc -- + * Allocate return memory for recno keys. + */ +static int +__bam_keyalloc(t) + BTREE *t; +{ + /* + * Recno keys are always the same size, and we don't want to have + * to check for space on each return. Allocate it now. + */ + if ((t->bt_rkey.data = (void *)__db_malloc(sizeof(db_recno_t))) == NULL) + return (ENOMEM); + t->bt_rkey.ulen = sizeof(db_recno_t); + return (0); +} + +/* + * __bam_setmeta -- + * Check (and optionally create) a tree. + */ +static int +__bam_setmeta(dbp, t) + DB *dbp; + BTREE *t; +{ + BTMETA *meta; + PAGE *root; + DB_LOCK metalock, rootlock; + db_pgno_t pgno; + int ret; + + /* Get, and optionally create the metadata page. */ + pgno = PGNO_METADATA; + if ((ret = + __bam_lget(dbp, 0, PGNO_METADATA, DB_LOCK_WRITE, &metalock)) != 0) + return (ret); + if ((ret = + __bam_pget(dbp, (PAGE **)&meta, &pgno, DB_MPOOL_CREATE)) != 0) { + (void)__BT_LPUT(dbp, metalock); + return (ret); + } + + /* + * If the magic number is correct, we're not creating the tree. + * Correct any fields that may not be right. Note, all of the + * local flags were set by db_open(3). + */ + if (meta->magic != 0) { + t->bt_maxkey = meta->maxkey; + t->bt_minkey = meta->minkey; + + (void)memp_fput(dbp->mpf, (PAGE *)meta, 0); + (void)__BT_LPUT(dbp, metalock); + return (0); + } + + /* Initialize the tree structure metadata information. */ + memset(meta, 0, sizeof(BTMETA)); + ZERO_LSN(meta->lsn); + meta->pgno = PGNO_METADATA; + meta->magic = DB_BTREEMAGIC; + meta->version = DB_BTREEVERSION; + meta->pagesize = dbp->pgsize; + meta->maxkey = t->bt_maxkey; + meta->minkey = t->bt_minkey; + meta->free = PGNO_INVALID; + if (dbp->type == DB_RECNO) + F_SET(meta, BTM_RECNO); + if (F_ISSET(dbp, DB_AM_DUP)) + F_SET(meta, BTM_DUP); + if (F_ISSET(dbp, DB_RE_FIXEDLEN)) + F_SET(meta, BTM_FIXEDLEN); + if (F_ISSET(dbp, DB_BT_RECNUM)) + F_SET(meta, BTM_RECNUM); + if (F_ISSET(dbp, DB_RE_RENUMBER)) + F_SET(meta, BTM_RENUMBER); + memcpy(meta->uid, dbp->lock.fileid, DB_FILE_ID_LEN); + + /* Create and initialize a root page. */ + pgno = PGNO_ROOT; + if ((ret = + __bam_lget(dbp, 0, PGNO_ROOT, DB_LOCK_WRITE, &rootlock)) != 0) + return (ret); + if ((ret = __bam_pget(dbp, &root, &pgno, DB_MPOOL_CREATE)) != 0) { + (void)__BT_LPUT(dbp, rootlock); + return (ret); + } + P_INIT(root, dbp->pgsize, PGNO_ROOT, PGNO_INVALID, + PGNO_INVALID, 1, dbp->type == DB_RECNO ? P_LRECNO : P_LBTREE); + ZERO_LSN(root->lsn); + + /* Release the metadata and root pages. */ + if ((ret = memp_fput(dbp->mpf, (PAGE *)meta, DB_MPOOL_DIRTY)) != 0) + return (ret); + if ((ret = memp_fput(dbp->mpf, root, DB_MPOOL_DIRTY)) != 0) + return (ret); + + /* + * Flush the metadata and root pages to disk -- since the user can't + * transaction protect open, the pages have to exist during recovery. + * + * XXX + * It's not useful to return not-yet-flushed here -- convert it to + * an error. + */ + if ((ret = memp_fsync(dbp->mpf)) == DB_INCOMPLETE) + ret = EINVAL; + + /* Release the locks. */ + (void)__BT_LPUT(dbp, metalock); + (void)__BT_LPUT(dbp, rootlock); + + return (ret); +} diff --git a/mozilla/db/btree/bt_page.c b/mozilla/db/btree/bt_page.c new file mode 100644 index 00000000000..87f28113987 --- /dev/null +++ b/mozilla/db/btree/bt_page.c @@ -0,0 +1,316 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * 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. 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)bt_page.c 10.12 (Sleepycat) 5/6/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "btree.h" + +/* + * __bam_new -- + * Get a new page, preferably from the freelist. + * + * PUBLIC: int __bam_new __P((DB *, u_int32_t, PAGE **)); + */ +int +__bam_new(dbp, type, pagepp) + DB *dbp; + u_int32_t type; + PAGE **pagepp; +{ + BTMETA *meta; + DB_LOCK metalock; + PAGE *h; + db_pgno_t pgno; + int ret; + + meta = NULL; + h = NULL; + metalock = LOCK_INVALID; + + pgno = PGNO_METADATA; + if ((ret = __bam_lget(dbp, 0, pgno, DB_LOCK_WRITE, &metalock)) != 0) + goto err; + if ((ret = __bam_pget(dbp, (PAGE **)&meta, &pgno, 0)) != 0) + goto err; + + if (meta->free == PGNO_INVALID) { + if ((ret = __bam_pget(dbp, &h, &pgno, DB_MPOOL_NEW)) != 0) + goto err; + ZERO_LSN(h->lsn); + h->pgno = pgno; + } else { + pgno = meta->free; + if ((ret = __bam_pget(dbp, &h, &pgno, 0)) != 0) + goto err; + meta->free = h->next_pgno; + } + + /* Log the change. */ + if (DB_LOGGING(dbp)) { + if ((ret = __bam_pg_alloc_log(dbp->dbenv->lg_info, dbp->txn, + &meta->lsn, 0, dbp->log_fileid, &meta->lsn, &h->lsn, + h->pgno, (u_int32_t)type, meta->free)) != 0) + goto err; + LSN(h) = LSN(meta); + } + + (void)memp_fput(dbp->mpf, (PAGE *)meta, DB_MPOOL_DIRTY); + (void)__BT_TLPUT(dbp, metalock); + + P_INIT(h, dbp->pgsize, h->pgno, PGNO_INVALID, PGNO_INVALID, 0, type); + *pagepp = h; + return (0); + +err: if (h != NULL) + (void)memp_fput(dbp->mpf, h, 0); + if (meta != NULL) + (void)memp_fput(dbp->mpf, meta, 0); + if (metalock != LOCK_INVALID) + (void)__BT_TLPUT(dbp, metalock); + return (ret); +} + +/* + * __bam_free -- + * Add a page to the head of the freelist. + * + * PUBLIC: int __bam_free __P((DB *, PAGE *)); + */ +int +__bam_free(dbp, h) + DB *dbp; + PAGE *h; +{ + BTMETA *meta; + DBT ldbt; + DB_LOCK metalock; + db_pgno_t pgno; + u_int32_t dirty_flag; + int ret, t_ret; + + /* + * Retrieve the metadata page and insert the page at the head of + * the free list. If either the lock get or page get routines + * fail, then we need to put the page with which we were called + * back because our caller assumes we take care of it. + */ + dirty_flag = 0; + pgno = PGNO_METADATA; + if ((ret = __bam_lget(dbp, 0, pgno, DB_LOCK_WRITE, &metalock)) != 0) + goto err; + if ((ret = __bam_pget(dbp, (PAGE **)&meta, &pgno, 0)) != 0) { + (void)__BT_TLPUT(dbp, metalock); + goto err; + } + + /* Log the change. */ + if (DB_LOGGING(dbp)) { + memset(&ldbt, 0, sizeof(ldbt)); + ldbt.data = h; + ldbt.size = P_OVERHEAD; + if ((ret = __bam_pg_free_log(dbp->dbenv->lg_info, + dbp->txn, &meta->lsn, 0, dbp->log_fileid, h->pgno, + &meta->lsn, &ldbt, meta->free)) != 0) { + (void)memp_fput(dbp->mpf, (PAGE *)meta, 0); + (void)__BT_TLPUT(dbp, metalock); + return (ret); + } + LSN(h) = LSN(meta); + } + + /* + * The page should have nothing interesting on it, re-initialize it, + * leaving only the page number and the LSN. + */ +#ifdef DIAGNOSTIC + { db_pgno_t __pgno; DB_LSN __lsn; + __pgno = h->pgno; + __lsn = h->lsn; + memset(h, 0xff, dbp->pgsize); + h->pgno = __pgno; + h->lsn = __lsn; + } +#endif + P_INIT(h, dbp->pgsize, h->pgno, PGNO_INVALID, meta->free, 0, P_INVALID); + + /* Link the page on the metadata free list. */ + meta->free = h->pgno; + + /* Discard the metadata page. */ + ret = memp_fput(dbp->mpf, (PAGE *)meta, DB_MPOOL_DIRTY); + if ((t_ret = __BT_TLPUT(dbp, metalock)) != 0) + ret = t_ret; + + /* Discard the caller's page reference. */ + dirty_flag = DB_MPOOL_DIRTY; +err: if ((t_ret = memp_fput(dbp->mpf, h, dirty_flag)) != 0 && ret == 0) + ret = t_ret; + + /* + * XXX + * We have to unlock the caller's page in the caller! + */ + return (ret); +} + +#ifdef DEBUG +/* + * __bam_lt -- + * Print out the list of currently held locks. + * + * PUBLIC: int __bam_lt __P((DB *)); + */ +int +__bam_lt(dbp) + DB *dbp; +{ + DB_LOCKREQ req; + + if (F_ISSET(dbp, DB_AM_LOCKING)) { + req.op = DB_LOCK_DUMP; + lock_vec(dbp->dbenv->lk_info, dbp->locker, 0, &req, 1, NULL); + } + return (0); +} +#endif + +/* + * __bam_lget -- + * The standard lock get call. + * + * PUBLIC: int __bam_lget __P((DB *, int, db_pgno_t, db_lockmode_t, DB_LOCK *)); + */ +int +__bam_lget(dbp, do_couple, pgno, mode, lockp) + DB *dbp; + int do_couple; + db_pgno_t pgno; + db_lockmode_t mode; + DB_LOCK *lockp; +{ + DB_LOCKREQ couple[2]; + u_int32_t locker; + int ret; + + if (!F_ISSET(dbp, DB_AM_LOCKING)) { + *lockp = LOCK_INVALID; + return (0); + } + + locker = dbp->txn == NULL ? dbp->locker : dbp->txn->txnid; + dbp->lock.pgno = pgno; + + /* + * If the object not currently locked, acquire the lock and return, + * otherwise, lock couple. If we fail and it's not a system error, + * convert to EAGAIN. + */ + if (do_couple) { + couple[0].op = DB_LOCK_GET; + couple[0].obj = &dbp->lock_dbt; + couple[0].mode = mode; + couple[1].op = DB_LOCK_PUT; + couple[1].lock = *lockp; + + ret = lock_vec(dbp->dbenv->lk_info, locker, 0, couple, 2, NULL); + if (ret != 0) { + /* If we fail, discard the lock we held. */ + __bam_lput(dbp, *lockp); + + return (ret < 0 ? EAGAIN : ret); + } + *lockp = couple[0].lock; + } else { + ret = lock_get(dbp->dbenv->lk_info, + locker, 0, &dbp->lock_dbt, mode, lockp); + return (ret < 0 ? EAGAIN : ret); + } + return (0); +} + +/* + * __bam_lput -- + * The standard lock put call. + * + * PUBLIC: int __bam_lput __P((DB *, DB_LOCK)); + */ +int +__bam_lput(dbp, lock) + DB *dbp; + DB_LOCK lock; +{ + return (__BT_LPUT(dbp, lock)); +} + +/* + * __bam_pget -- + * The standard page get call. + * + * PUBLIC: int __bam_pget __P((DB *, PAGE **, db_pgno_t *, u_int32_t)); + */ +int +__bam_pget(dbp, hp, pgnop, mpool_flags) + DB *dbp; + PAGE **hp; + db_pgno_t *pgnop; + u_int32_t mpool_flags; +{ + return (memp_fget((dbp)->mpf, + pgnop, mpool_flags, hp) == 0 ? 0 : __db_pgerr(dbp, *pgnop)); +} diff --git a/mozilla/db/btree/bt_put.c b/mozilla/db/btree/bt_put.c new file mode 100644 index 00000000000..a93faac98c2 --- /dev/null +++ b/mozilla/db/btree/bt_put.c @@ -0,0 +1,1160 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * 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. 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)bt_put.c 10.45 (Sleepycat) 5/25/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "btree.h" + +static int __bam_fixed __P((BTREE *, DBT *)); +static int __bam_isdeleted __P((DB *, PAGE *, u_int32_t, int *)); +static int __bam_lookup __P((DB *, DBT *, int *)); +static int __bam_ndup __P((DB *, PAGE *, u_int32_t)); +static int __bam_ovput __P((DB *, PAGE *, u_int32_t, DBT *)); +static int __bam_partial __P((DB *, DBT *, PAGE *, u_int32_t, u_int32_t)); +static u_int32_t __bam_partsize __P((DBT *, PAGE *, u_int32_t)); + +/* + * __bam_put -- + * Add a new key/data pair or replace an existing pair (btree). + * + * PUBLIC: int __bam_put __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); + */ +int +__bam_put(argdbp, txn, key, data, flags) + DB *argdbp; + DB_TXN *txn; + DBT *key, *data; + u_int32_t flags; +{ + BTREE *t; + CURSOR c; + DB *dbp; + PAGE *h; + db_indx_t indx; + u_int32_t iitem_flags, insert_flags; + int exact, isdeleted, newkey, ret, stack; + + DEBUG_LWRITE(argdbp, txn, "bam_put", key, data, flags); + + /* Check flags. */ + if ((ret = __db_putchk(argdbp, key, data, flags, + F_ISSET(argdbp, DB_AM_RDONLY), F_ISSET(argdbp, DB_AM_DUP))) != 0) + return (ret); + + GETHANDLE(argdbp, txn, &dbp, ret); + t = dbp->internal; + +retry: /* + * Find the location at which to insert. The call to __bam_lookup + * leaves the returned page pinned. + */ + if ((ret = __bam_lookup(dbp, key, &exact)) != 0) { + PUTHANDLE(dbp); + return (ret); + } + h = t->bt_csp->page; + indx = t->bt_csp->indx; + stack = 1; + + /* + * If DB_NOOVERWRITE is set and there's an identical key in the tree, + * return an error unless the data item has already been marked for + * deletion, or, all the remaining data items have already been marked + * for deletion in the case of duplicates. If all the data items have + * been marked for deletion, we do a replace, otherwise, it has to be + * a set of duplicates, and we simply append a new one to the set. + */ + isdeleted = 0; + if (exact) { + if ((ret = __bam_isdeleted(dbp, h, indx, &isdeleted)) != 0) + goto err; + if (isdeleted) + __bam_ca_replace(dbp, h->pgno, indx, REPLACE_SETUP); + else + if (flags == DB_NOOVERWRITE) { + ret = DB_KEYEXIST; + goto err; + } + } + + /* + * If we're inserting into the first or last page of the tree, + * remember where we did it so we can do fast lookup next time. + * + * XXX + * Does reverse order still work (did it ever!?!?) + */ + t->bt_lpgno = + h->next_pgno == PGNO_INVALID || h->prev_pgno == PGNO_INVALID ? + h->pgno : PGNO_INVALID; + + /* + * Select the arguments for __bam_iitem() and do the insert. If the + * key is an exact match, we're either adding a new duplicate at the + * end of the duplicate set, or we're replacing the data item with a + * new data item. If the key isn't an exact match, we're inserting + * a new key/data pair, before the search location. + */ + newkey = dbp->type == DB_BTREE && !exact; + if (exact) { + if (!isdeleted && F_ISSET(dbp, DB_AM_DUP)) { + /* + * Make sure that we're not looking at a page of + * duplicates -- if so, move to the last entry on + * that page. + */ + c.page = h; + c.pgno = h->pgno; + c.indx = indx; + c.dpgno = PGNO_INVALID; + c.dindx = 0; + if ((ret = + __bam_ovfl_chk(dbp, &c, indx + O_INDX, 1)) != 0) + goto err; + if (c.dpgno != PGNO_INVALID) { + /* + * XXX + * The __bam_ovfl_chk() routine memp_fput() the + * current page and acquired a new one, but did + * not do anything about the lock we're holding. + */ + t->bt_csp->page = h = c.page; + indx = c.dindx; + } + insert_flags = DB_AFTER; + } else + insert_flags = DB_CURRENT; + } else + insert_flags = DB_BEFORE; + + /* + * The pages we're using may be modified by __bam_iitem(), so make + * sure we reset the stack. + */ + iitem_flags = 0; + if (newkey) + iitem_flags |= BI_NEWKEY; + if (isdeleted) + iitem_flags |= BI_DOINCR; + ret = __bam_iitem(dbp, &h, &indx, key, data, insert_flags, iitem_flags); + t->bt_csp->page = h; + t->bt_csp->indx = indx; + + switch (ret) { + case 0: + /* Done. Clean up the cursor. */ + if (isdeleted) + __bam_ca_replace(dbp, h->pgno, indx, REPLACE_SUCCESS); + break; + case DB_NEEDSPLIT: + /* + * We have to split the page. Back out the cursor setup, + * discard the stack of pages, and do the split. + */ + if (isdeleted) + __bam_ca_replace(dbp, h->pgno, indx, REPLACE_FAILED); + + (void)__bam_stkrel(dbp); + stack = 0; + + if ((ret = __bam_split(dbp, key)) != 0) + break; + + goto retry; + /* NOTREACHED */ + default: + if (isdeleted) + __bam_ca_replace(dbp, h->pgno, indx, REPLACE_FAILED); + break; + } + +err: if (stack) + (void)__bam_stkrel(dbp); + + PUTHANDLE(dbp); + return (ret); +} + +/* + * __bam_isdeleted -- + * Return if the only remaining data item for the element has been + * deleted. + */ +static int +__bam_isdeleted(dbp, h, indx, isdeletedp) + DB *dbp; + PAGE *h; + u_int32_t indx; + int *isdeletedp; +{ + BKEYDATA *bk; + db_pgno_t pgno; + int ret; + + *isdeletedp = 1; + for (;;) { + bk = GET_BKEYDATA(h, indx + O_INDX); + switch (B_TYPE(bk->type)) { + case B_KEYDATA: + case B_OVERFLOW: + if (!B_DISSET(bk->type)) { + *isdeletedp = 0; + return (0); + } + break; + case B_DUPLICATE: + /* + * If the data item referencing the off-page duplicates + * is flagged as deleted, we're done. Else, we have to + * walk the chain of duplicate pages. + */ + if (B_DISSET(bk->type)) + return (0); + goto dupchk; + default: + return (__db_pgfmt(dbp, h->pgno)); + } + + /* + * If there are no more on-page duplicate items, then every + * data item for this key must have been deleted. + */ + if (indx + P_INDX >= (u_int32_t)NUM_ENT(h)) + return (0); + if (h->inp[indx] != h->inp[indx + P_INDX]) + return (0); + + /* Check the next item. */ + indx += P_INDX; + } + /* NOTREACHED */ + +dupchk: /* Check a chain of duplicate pages. */ + pgno = ((BOVERFLOW *)bk)->pgno; + for (;;) { + /* Acquire the next page in the duplicate chain. */ + if ((ret = memp_fget(dbp->mpf, &pgno, 0, &h)) != 0) + return (ret); + + /* Check each item for a delete flag. */ + for (indx = 0; indx < NUM_ENT(h); ++indx) + if (!B_DISSET(GET_BKEYDATA(h, indx)->type)) { + *isdeletedp = 0; + goto done; + } + /* + * If we reach the end of the duplicate pages, then every + * item we reviewed must have been deleted. + */ + if ((pgno = NEXT_PGNO(h)) == PGNO_INVALID) + goto done; + + (void)memp_fput(dbp->mpf, h, 0); + } + /* NOTREACHED */ + +done: (void)memp_fput(dbp->mpf, h, 0); + return (0); +} + +/* + * __bam_lookup -- + * Find the right location in the tree for the key. + */ +static int +__bam_lookup(dbp, key, exactp) + DB *dbp; + DBT *key; + int *exactp; +{ + BTREE *t; + DB_LOCK lock; + EPG e; + PAGE *h; + db_indx_t indx; + int cmp, ret; + + t = dbp->internal; + h = NULL; + + /* + * Record numbers can't be fast-tracked, we have to lock the entire + * tree. + */ + if (F_ISSET(dbp, DB_BT_RECNUM)) + goto slow; + + /* Check to see if we've been seeing sorted input. */ + if (t->bt_lpgno == PGNO_INVALID) + goto slow; + + /* + * Retrieve the page on which we did the last insert. It's okay if + * it doesn't exist, or if it's not the page type we expect, it just + * means that the world changed. + */ + if (__bam_lget(dbp, 0, t->bt_lpgno, DB_LOCK_WRITE, &lock)) + goto miss; + if (__bam_pget(dbp, &h, &t->bt_lpgno, 0)) { + (void)__BT_LPUT(dbp, lock); + goto miss; + } + if (TYPE(h) != P_LBTREE) + goto miss; + if (NUM_ENT(h) == 0) + goto miss; + + /* + * We have to be at the end or beginning of the tree to know that + * we're inserting in a sort order. If that's the case and we're + * in the right order in comparison to the first/last key/data pair, + * we have the right position. + */ + if (h->next_pgno == PGNO_INVALID) { + e.page = h; + e.indx = NUM_ENT(h) - P_INDX; + if ((cmp = __bam_cmp(dbp, key, &e)) >= 0) { + if (cmp > 0) + e.indx += P_INDX; + goto fast; + } + } + if (h->prev_pgno == PGNO_INVALID) { + e.page = h; + e.indx = 0; + if ((cmp = __bam_cmp(dbp, key, &e)) <= 0) { + /* + * We're doing a put, so we want to insert as the last + * of any set of duplicates. + */ + if (cmp == 0) { + for (indx = 0; + indx < (db_indx_t)(NUM_ENT(h) - P_INDX) && + h->inp[indx] == h->inp[indx + P_INDX]; + indx += P_INDX) + ; + e.indx = indx; + } + goto fast; + } + } + goto miss; + + /* Set the exact match flag in case we've already inserted this key. */ +fast: *exactp = cmp == 0; + + /* Enter the entry in the stack. */ + BT_STK_CLR(t); + BT_STK_ENTER(t, e.page, e.indx, lock, ret); + if (ret != 0) + return (ret); + + ++t->lstat.bt_cache_hit; + return (0); + +miss: ++t->lstat.bt_cache_miss; + if (h != NULL) { + (void)memp_fput(dbp->mpf, h, 0); + (void)__BT_LPUT(dbp, lock); + } + +slow: return (__bam_search(dbp, key, S_INSERT, 1, NULL, exactp)); +} + +/* + * __bam_iitem -- + * Insert an item into the tree. + * + * PUBLIC: int __bam_iitem __P((DB *, + * PUBLIC: PAGE **, db_indx_t *, DBT *, DBT *, u_int32_t, u_int32_t)); + */ +int +__bam_iitem(dbp, hp, indxp, key, data, op, flags) + DB *dbp; + PAGE **hp; + db_indx_t *indxp; + DBT *key, *data; + u_int32_t op, flags; +{ + BTREE *t; + BKEYDATA *bk; + DBT tdbt; + PAGE *h; + db_indx_t indx, nbytes; + u_int32_t data_size, have_bytes, need_bytes, needed; + int bigkey, bigdata, dupadjust, replace, ret; + + COMPQUIET(bk, NULL); + + t = dbp->internal; + h = *hp; + indx = *indxp; + dupadjust = replace = 0; + + /* + * If it's a page of duplicates, call the common code to do the work. + * + * !!! + * Here's where the hp and indxp are important. The duplicate code + * may decide to rework/rearrange the pages and indices we're using, + * so the caller must understand that the page stack may change. + */ + if (TYPE(h) == P_DUPLICATE) { + /* Adjust the index for the new item if it's a DB_AFTER op. */ + if (op == DB_AFTER) + ++*indxp; + + /* Remove the current item if it's a DB_CURRENT op. */ + if (op == DB_CURRENT) { + bk = GET_BKEYDATA(*hp, *indxp); + switch (B_TYPE(bk->type)) { + case B_KEYDATA: + nbytes = BKEYDATA_SIZE(bk->len); + break; + case B_OVERFLOW: + nbytes = BOVERFLOW_SIZE; + break; + default: + return (__db_pgfmt(dbp, h->pgno)); + } + if ((ret = __db_ditem(dbp, *hp, *indxp, nbytes)) != 0) + return (ret); + } + + /* Put the new/replacement item onto the page. */ + if ((ret = __db_dput(dbp, data, hp, indxp, __bam_new)) != 0) + return (ret); + + goto done; + } + + /* Handle fixed-length records: build the real record. */ + if (F_ISSET(dbp, DB_RE_FIXEDLEN) && data->size != t->bt_recno->re_len) { + tdbt = *data; + if ((ret = __bam_fixed(t, &tdbt)) != 0) + return (ret); + data = &tdbt; + } + + /* + * Figure out how much space the data will take, including if it's a + * partial record. If either of the key or data items won't fit on + * a page, we'll have to store them on overflow pages. + */ + bigkey = LF_ISSET(BI_NEWKEY) && key->size > t->bt_ovflsize; + data_size = F_ISSET(data, DB_DBT_PARTIAL) ? + __bam_partsize(data, h, indx) : data->size; + bigdata = data_size > t->bt_ovflsize; + + needed = 0; + if (LF_ISSET(BI_NEWKEY)) { + /* If BI_NEWKEY is set we're adding a new key and data pair. */ + if (bigkey) + needed += BOVERFLOW_PSIZE; + else + needed += BKEYDATA_PSIZE(key->size); + if (bigdata) + needed += BOVERFLOW_PSIZE; + else + needed += BKEYDATA_PSIZE(data_size); + } else { + /* + * We're either overwriting the data item of a key/data pair + * or we're adding the data item only, i.e. a new duplicate. + */ + if (op == DB_CURRENT) { + bk = GET_BKEYDATA(h, + indx + (TYPE(h) == P_LBTREE ? O_INDX : 0)); + if (B_TYPE(bk->type) == B_KEYDATA) + have_bytes = BKEYDATA_PSIZE(bk->len); + else + have_bytes = BOVERFLOW_PSIZE; + need_bytes = 0; + } else { + have_bytes = 0; + need_bytes = sizeof(db_indx_t); + } + if (bigdata) + need_bytes += BOVERFLOW_PSIZE; + else + need_bytes += BKEYDATA_PSIZE(data_size); + + if (have_bytes < need_bytes) + needed += need_bytes - have_bytes; + } + + /* + * If there's not enough room, or the user has put a ceiling on the + * number of keys permitted in the page, split the page. + * + * XXX + * The t->bt_maxkey test here may be insufficient -- do we have to + * check in the btree split code, so we don't undo it there!?!? + */ + if (P_FREESPACE(h) < needed || + (t->bt_maxkey != 0 && NUM_ENT(h) > t->bt_maxkey)) + return (DB_NEEDSPLIT); + + /* Handle partial puts: build the real record. */ + if (F_ISSET(data, DB_DBT_PARTIAL)) { + tdbt = *data; + if ((ret = __bam_partial(dbp, &tdbt, h, indx, data_size)) != 0) + return (ret); + data = &tdbt; + } + + /* + * The code breaks it up into six cases: + * + * 1. Append a new key/data pair. + * 2. Insert a new key/data pair. + * 3. Append a new data item (a new duplicate). + * 4. Insert a new data item (a new duplicate). + * 5. Overflow item: delete and re-add the data item. + * 6. Replace the data item. + */ + if (LF_ISSET(BI_NEWKEY)) { + switch (op) { + case DB_AFTER: /* 1. Append a new key/data pair. */ + indx += 2; + *indxp += 2; + break; + case DB_BEFORE: /* 2. Insert a new key/data pair. */ + break; + default: + return (EINVAL); + } + + /* Add the key. */ + if (bigkey) { + if ((ret = __bam_ovput(dbp, h, indx, key)) != 0) + return (ret); + } else + if ((ret = __db_pitem(dbp, h, indx, + BKEYDATA_SIZE(key->size), NULL, key)) != 0) + return (ret); + ++indx; + } else { + switch (op) { + case DB_AFTER: /* 3. Append a new data item. */ + if (TYPE(h) == P_LBTREE) { + /* + * Adjust the cursor and copy in the key for + * the duplicate. + */ + if ((ret = __bam_adjindx(dbp, + h, indx + P_INDX, indx, 1)) != 0) + return (ret); + + indx += 3; + dupadjust = 1; + + *indxp += 2; + } else { + ++indx; + __bam_ca_di(dbp, h->pgno, indx, 1); + + *indxp += 1; + } + break; + case DB_BEFORE: /* 4. Insert a new data item. */ + if (TYPE(h) == P_LBTREE) { + /* + * Adjust the cursor and copy in the key for + * the duplicate. + */ + if ((ret = + __bam_adjindx(dbp, h, indx, indx, 1)) != 0) + return (ret); + + ++indx; + dupadjust = 1; + } else + __bam_ca_di(dbp, h->pgno, indx, 1); + break; + case DB_CURRENT: + if (TYPE(h) == P_LBTREE) + ++indx; + + /* + * 5. Delete/re-add the data item. + * + * If we're dealing with offpage items, we have to + * delete and then re-add the item. + */ + if (bigdata || B_TYPE(bk->type) != B_KEYDATA) { + if ((ret = __bam_ditem(dbp, h, indx)) != 0) + return (ret); + break; + } + + /* 6. Replace the data item. */ + replace = 1; + break; + default: + return (EINVAL); + } + } + + /* Add the data. */ + if (bigdata) { + if ((ret = __bam_ovput(dbp, h, indx, data)) != 0) + return (ret); + } else { + BKEYDATA __bk; + DBT __hdr; + + if (LF_ISSET(BI_DELETED)) { + B_TSET(__bk.type, B_KEYDATA, 1); + __bk.len = data->size; + __hdr.data = &__bk; + __hdr.size = SSZA(BKEYDATA, data); + ret = __db_pitem(dbp, h, indx, + BKEYDATA_SIZE(data->size), &__hdr, data); + } else if (replace) + ret = __bam_ritem(dbp, h, indx, data); + else + ret = __db_pitem(dbp, h, indx, + BKEYDATA_SIZE(data->size), NULL, data); + if (ret != 0) + return (ret); + } + + if ((ret = memp_fset(dbp->mpf, h, DB_MPOOL_DIRTY)) != 0) + return (ret); + + /* + * If the page is at least 50% full, and we added a duplicate, see if + * that set of duplicates takes up at least 25% of the space. If it + * does, move it off onto its own page. + */ + if (dupadjust && P_FREESPACE(h) <= dbp->pgsize / 2) { + --indx; + if ((ret = __bam_ndup(dbp, h, indx)) != 0) + return (ret); + } + + /* + * If we've changed the record count, update the tree. Record counts + * need to be updated in recno databases and in btree databases where + * we are supporting records. In both cases, adjust the count if the + * operation wasn't performed on the current record or when the caller + * overrides and wants the adjustment made regardless. + */ +done: if (LF_ISSET(BI_DOINCR) || + (op != DB_CURRENT && + (F_ISSET(dbp, DB_BT_RECNUM) || dbp->type == DB_RECNO))) + if ((ret = __bam_adjust(dbp, t, 1)) != 0) + return (ret); + + /* If we've modified a recno file, set the flag */ + if (t->bt_recno != NULL) + F_SET(t->bt_recno, RECNO_MODIFIED); + + ++t->lstat.bt_added; + + return (ret); +} + +/* + * __bam_partsize -- + * Figure out how much space a partial data item is in total. + */ +static u_int32_t +__bam_partsize(data, h, indx) + DBT *data; + PAGE *h; + u_int32_t indx; +{ + BKEYDATA *bk; + u_int32_t nbytes; + + /* + * Figure out how much total space we'll need. If the record doesn't + * already exist, it's simply the data we're provided. + */ + if (indx >= NUM_ENT(h)) + return (data->doff + data->size); + + /* + * Otherwise, it's the data provided plus any already existing data + * that we're not replacing. + */ + bk = GET_BKEYDATA(h, indx + (TYPE(h) == P_LBTREE ? O_INDX : 0)); + nbytes = + B_TYPE(bk->type) == B_OVERFLOW ? ((BOVERFLOW *)bk)->tlen : bk->len; + + /* + * There are really two cases here: + * + * Case 1: We are replacing some bytes that do not exist (i.e., they + * are past the end of the record). In this case the number of bytes + * we are replacing is irrelevant and all we care about is how many + * bytes we are going to add from offset. So, the new record length + * is going to be the size of the new bytes (size) plus wherever those + * new bytes begin (doff). + * + * Case 2: All the bytes we are replacing exist. Therefore, the new + * size is the oldsize (nbytes) minus the bytes we are replacing (dlen) + * plus the bytes we are adding (size). + */ + if (nbytes < data->doff + data->dlen) /* Case 1 */ + return (data->doff + data->size); + + return (nbytes + data->size - data->dlen); /* Case 2 */ +} + +/* + * OVPUT -- + * Copy an overflow item onto a page. + */ +#undef OVPUT +#define OVPUT(h, indx, bo) do { \ + DBT __hdr; \ + memset(&__hdr, 0, sizeof(__hdr)); \ + __hdr.data = &bo; \ + __hdr.size = BOVERFLOW_SIZE; \ + if ((ret = __db_pitem(dbp, \ + h, indx, BOVERFLOW_SIZE, &__hdr, NULL)) != 0) \ + return (ret); \ +} while (0) + +/* + * __bam_ovput -- + * Build an overflow item and put it on the page. + */ +static int +__bam_ovput(dbp, h, indx, item) + DB *dbp; + PAGE *h; + u_int32_t indx; + DBT *item; +{ + BOVERFLOW bo; + int ret; + + B_TSET(bo.type, B_OVERFLOW, 0); + bo.tlen = item->size; + if ((ret = __db_poff(dbp, item, &bo.pgno, __bam_new)) != 0) + return (ret); + + OVPUT(h, indx, bo); + + return (0); +} + +/* + * __bam_ritem -- + * Replace an item on a page. + * + * PUBLIC: int __bam_ritem __P((DB *, PAGE *, u_int32_t, DBT *)); + */ +int +__bam_ritem(dbp, h, indx, data) + DB *dbp; + PAGE *h; + u_int32_t indx; + DBT *data; +{ + BKEYDATA *bk; + DBT orig, repl; + db_indx_t cnt, lo, ln, min, off, prefix, suffix; + int32_t nbytes; + int ret; + u_int8_t *p, *t; + + /* + * Replace a single item onto a page. The logic figuring out where + * to insert and whether it fits is handled in the caller. All we do + * here is manage the page shuffling. + */ + bk = GET_BKEYDATA(h, indx); + + /* Log the change. */ + if (DB_LOGGING(dbp)) { + /* + * We might as well check to see if the two data items share + * a common prefix and suffix -- it can save us a lot of log + * message if they're large. + */ + min = data->size < bk->len ? data->size : bk->len; + for (prefix = 0, + p = bk->data, t = data->data; + prefix < min && *p == *t; ++prefix, ++p, ++t) + ; + + min -= prefix; + for (suffix = 0, + p = (u_int8_t *)bk->data + bk->len - 1, + t = (u_int8_t *)data->data + data->size - 1; + suffix < min && *p == *t; ++suffix, --p, --t) + ; + + /* We only log the parts of the keys that have changed. */ + orig.data = (u_int8_t *)bk->data + prefix; + orig.size = bk->len - (prefix + suffix); + repl.data = (u_int8_t *)data->data + prefix; + repl.size = data->size - (prefix + suffix); + if ((ret = __bam_repl_log(dbp->dbenv->lg_info, dbp->txn, + &LSN(h), 0, dbp->log_fileid, PGNO(h), &LSN(h), + (u_int32_t)indx, (u_int32_t)B_DISSET(bk->type), + &orig, &repl, (u_int32_t)prefix, (u_int32_t)suffix)) != 0) + return (ret); + } + + /* + * Set references to the first in-use byte on the page and the + * first byte of the item being replaced. + */ + p = (u_int8_t *)h + HOFFSET(h); + t = (u_int8_t *)bk; + + /* + * If the entry is growing in size, shift the beginning of the data + * part of the page down. If the entry is shrinking in size, shift + * the beginning of the data part of the page up. Use memmove(3), + * the regions overlap. + */ + lo = BKEYDATA_SIZE(bk->len); + ln = BKEYDATA_SIZE(data->size); + if (lo != ln) { + nbytes = lo - ln; /* Signed difference. */ + if (p == t) /* First index is fast. */ + h->inp[indx] += nbytes; + else { /* Else, shift the page. */ + memmove(p + nbytes, p, t - p); + + /* Adjust the indices' offsets. */ + off = h->inp[indx]; + for (cnt = 0; cnt < NUM_ENT(h); ++cnt) + if (h->inp[cnt] <= off) + h->inp[cnt] += nbytes; + } + + /* Clean up the page and adjust the item's reference. */ + HOFFSET(h) += nbytes; + t += nbytes; + } + + /* Copy the new item onto the page. */ + bk = (BKEYDATA *)t; + B_TSET(bk->type, B_KEYDATA, 0); + bk->len = data->size; + memcpy(bk->data, data->data, data->size); + + return (0); +} + +/* + * __bam_ndup -- + * Check to see if the duplicate set at indx should have its own page. + * If it should, create it. + */ +static int +__bam_ndup(dbp, h, indx) + DB *dbp; + PAGE *h; + u_int32_t indx; +{ + BKEYDATA *bk; + BOVERFLOW bo; + DBT hdr; + PAGE *cp; + db_indx_t cnt, cpindx, first, sz; + int ret; + + while (indx > 0 && h->inp[indx] == h->inp[indx - P_INDX]) + indx -= P_INDX; + for (cnt = 0, sz = 0, first = indx;; ++cnt, indx += P_INDX) { + if (indx >= NUM_ENT(h) || h->inp[first] != h->inp[indx]) + break; + bk = GET_BKEYDATA(h, indx); + sz += B_TYPE(bk->type) == B_KEYDATA ? + BKEYDATA_PSIZE(bk->len) : BOVERFLOW_PSIZE; + bk = GET_BKEYDATA(h, indx + O_INDX); + sz += B_TYPE(bk->type) == B_KEYDATA ? + BKEYDATA_PSIZE(bk->len) : BOVERFLOW_PSIZE; + } + + /* + * If this set of duplicates is using more than 25% of the page, move + * them off. The choice of 25% is a WAG, but it has to be small enough + * that we can always split regardless of the presence of duplicates. + */ + if (sz < dbp->pgsize / 4) + return (0); + + /* Get a new page. */ + if ((ret = __bam_new(dbp, P_DUPLICATE, &cp)) != 0) + return (ret); + + /* + * Move this set of duplicates off the page. First points to the first + * key of the first duplicate key/data pair, cnt is the number of pairs + * we're dealing with. + */ + memset(&hdr, 0, sizeof(hdr)); + for (indx = first + O_INDX, cpindx = 0;; ++cpindx) { + /* Copy the entry to the new page. */ + bk = GET_BKEYDATA(h, indx); + hdr.data = bk; + hdr.size = B_TYPE(bk->type) == B_KEYDATA ? + BKEYDATA_SIZE(bk->len) : BOVERFLOW_SIZE; + if ((ret = + __db_pitem(dbp, cp, cpindx, hdr.size, &hdr, NULL)) != 0) + goto err; + + /* + * Move cursors referencing the old entry to the new entry. + * Done after the page put because __db_pitem() adjusts + * cursors on the new page, and before the delete because + * __db_ditem adjusts cursors on the old page. + */ + __bam_ca_dup(dbp, + PGNO(h), first, indx - O_INDX, PGNO(cp), cpindx); + + /* Delete the data item. */ + if ((ret = __db_ditem(dbp, h, indx, hdr.size)) != 0) + goto err; + + /* Delete all but the first reference to the key. */ + if (--cnt == 0) + break; + if ((ret = __bam_adjindx(dbp, h, indx, first, 0)) != 0) + goto err; + } + + /* Put in a new data item that points to the duplicates page. */ + B_TSET(bo.type, B_DUPLICATE, 0); + bo.pgno = cp->pgno; + bo.tlen = 0; + + OVPUT(h, indx, bo); + + return (memp_fput(dbp->mpf, cp, DB_MPOOL_DIRTY)); + +err: (void)__bam_free(dbp, cp); + return (ret); +} + +/* + * __bam_fixed -- + * Build the real record for a fixed length put. + */ +static int +__bam_fixed(t, dbt) + BTREE *t; + DBT *dbt; +{ + RECNO *rp; + + rp = t->bt_recno; + + /* + * If database contains fixed-length records, and the record is long, + * return EINVAL. + */ + if (dbt->size > rp->re_len) + return (EINVAL); + + /* + * The caller checked to see if it was just right, so we know it's + * short. Pad it out. We use the record data return memory, it's + * only a short-term use. + */ + if (t->bt_rdata.ulen < rp->re_len) { + t->bt_rdata.data = t->bt_rdata.data == NULL ? + (void *)__db_malloc(rp->re_len) : + (void *)__db_realloc(t->bt_rdata.data, rp->re_len); + if (t->bt_rdata.data == NULL) { + t->bt_rdata.ulen = 0; + return (ENOMEM); + } + t->bt_rdata.ulen = rp->re_len; + } + memcpy(t->bt_rdata.data, dbt->data, dbt->size); + memset((u_int8_t *)t->bt_rdata.data + dbt->size, + rp->re_pad, rp->re_len - dbt->size); + + /* + * Clean up our flags and other information just in case, and + * change the caller's DBT to reference our created record. + */ + t->bt_rdata.size = rp->re_len; + t->bt_rdata.dlen = 0; + t->bt_rdata.doff = 0; + t->bt_rdata.flags = 0; + *dbt = t->bt_rdata; + + return (0); +} + +/* + * __bam_partial -- + * Build the real record for a partial put. + */ +static int +__bam_partial(dbp, dbt, h, indx, nbytes) + DB *dbp; + DBT *dbt; + PAGE *h; + u_int32_t indx, nbytes; +{ + BTREE *t; + BKEYDATA *bk, tbk; + BOVERFLOW *bo; + DBT copy; + u_int32_t len, tlen; + u_int8_t *p; + int ret; + + COMPQUIET(bo, NULL); + + t = dbp->internal; + + /* We use the record data return memory, it's only a short-term use. */ + if (t->bt_rdata.ulen < nbytes) { + t->bt_rdata.data = t->bt_rdata.data == NULL ? + (void *)__db_malloc(nbytes) : + (void *)__db_realloc(t->bt_rdata.data, nbytes); + if (t->bt_rdata.data == NULL) { + t->bt_rdata.ulen = 0; + return (ENOMEM); + } + t->bt_rdata.ulen = nbytes; + } + + /* Find the current record. */ + if (indx < NUM_ENT(h)) { + bk = GET_BKEYDATA(h, indx + (TYPE(h) == P_LBTREE ? O_INDX : 0)); + bo = (BOVERFLOW *)bk; + } else { + bk = &tbk; + B_TSET(bk->type, B_KEYDATA, 0); + bk->len = 0; + } + + /* + * We use nul bytes for any part of the record that isn't specified, + * get it over with. + */ + memset(t->bt_rdata.data, 0, nbytes); + + if (B_TYPE(bk->type) == B_OVERFLOW) { + /* + * In the case of an overflow record, we shift things around + * in the current record rather than allocate a separate copy. + */ + memset(©, 0, sizeof(copy)); + if ((ret = __db_goff(dbp, ©, bo->tlen, + bo->pgno, &t->bt_rdata.data, &t->bt_rdata.ulen)) != 0) + return (ret); + + /* Skip any leading data from the original record. */ + tlen = dbt->doff; + p = (u_int8_t *)t->bt_rdata.data + dbt->doff; + + /* + * Copy in any trailing data from the original record. + * + * If the original record was larger than the original offset + * plus the bytes being deleted, there is trailing data in the + * original record we need to preserve. If we aren't deleting + * the same number of bytes as we're inserting, copy it up or + * down, into place. + * + * Use memmove(), the regions may overlap. + */ + if (bo->tlen > dbt->doff + dbt->dlen) { + len = bo->tlen - (dbt->doff + dbt->dlen); + if (dbt->dlen != dbt->size) + memmove(p + dbt->size, p + dbt->dlen, len); + tlen += len; + } + + /* Copy in the application provided data. */ + memcpy(p, dbt->data, dbt->size); + tlen += dbt->size; + } else { + /* Copy in any leading data from the original record. */ + memcpy(t->bt_rdata.data, + bk->data, dbt->doff > bk->len ? bk->len : dbt->doff); + tlen = dbt->doff; + p = (u_int8_t *)t->bt_rdata.data + dbt->doff; + + /* Copy in the application provided data. */ + memcpy(p, dbt->data, dbt->size); + tlen += dbt->size; + + /* Copy in any trailing data from the original record. */ + len = dbt->doff + dbt->dlen; + if (bk->len > len) { + memcpy(p + dbt->size, bk->data + len, bk->len - len); + tlen += bk->len - len; + } + } + + /* Set the DBT to reference our new record. */ + t->bt_rdata.size = tlen; + t->bt_rdata.dlen = 0; + t->bt_rdata.doff = 0; + t->bt_rdata.flags = 0; + *dbt = t->bt_rdata; + return (0); +} diff --git a/mozilla/db/btree/bt_rec.c b/mozilla/db/btree/bt_rec.c new file mode 100644 index 00000000000..fe33825ec46 --- /dev/null +++ b/mozilla/db/btree/bt_rec.c @@ -0,0 +1,910 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)bt_rec.c 10.21 (Sleepycat) 4/28/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "shqueue.h" +#include "hash.h" +#include "btree.h" +#include "log.h" +#include "common_ext.h" + +/* + * __bam_pg_alloc_recover -- + * Recovery function for pg_alloc. + * + * PUBLIC: int __bam_pg_alloc_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_pg_alloc_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __bam_pg_alloc_args *argp; + BTMETA *meta; + DB_MPOOLFILE *mpf; + PAGE *pagep; + DB *file_dbp, *mdbp; + db_pgno_t pgno; + int cmp_n, cmp_p, modified, ret; + + REC_PRINT(__bam_pg_alloc_print); + REC_INTRO(__bam_pg_alloc_read); + + /* + * Fix up the allocated page. If we're redoing the operation, we have + * to get the page (creating it if it doesn't exist), and update its + * LSN. If we're undoing the operation, we have to reset the page's + * LSN and put it on the free list. + * + * Fix up the metadata page. If we're redoing the operation, we have + * to get the metadata page and update its LSN and its free pointer. + * If we're undoing the operation and the page was ever created, we put + * it on the freelist. + */ + pgno = PGNO_METADATA; + if ((ret = memp_fget(mpf, &pgno, 0, &meta)) != 0) { + /* The metadata page must always exist. */ + (void)__db_pgerr(file_dbp, pgno); + goto out; + } + if ((ret = memp_fget(mpf, &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0) { + /* + * We specify creation and check for it later, because this + * operation was supposed to create the page, and even in + * the undo case it's going to get linked onto the freelist + * which we're also fixing up. + */ + (void)__db_pgerr(file_dbp, argp->pgno); + (void)memp_fput(mpf, meta, 0); + goto out; + } + + /* Fix up the allocated page. */ + modified = 0; + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->page_lsn); + if (cmp_p == 0 && redo) { + /* Need to redo update described. */ + P_INIT(pagep, file_dbp->pgsize, + argp->pgno, PGNO_INVALID, PGNO_INVALID, 0, argp->ptype); + + pagep->lsn = *lsnp; + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + P_INIT(pagep, file_dbp->pgsize, + argp->pgno, PGNO_INVALID, meta->free, 0, P_INVALID); + + pagep->lsn = argp->page_lsn; + modified = 1; + } + if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) != 0) { + (void)__db_panic(file_dbp); + (void)memp_fput(mpf, meta, 0); + goto out; + } + + /* Fix up the metadata page. */ + modified = 0; + cmp_n = log_compare(lsnp, &LSN(meta)); + cmp_p = log_compare(&LSN(meta), &argp->meta_lsn); + if (cmp_p == 0 && redo) { + /* Need to redo update described. */ + meta->lsn = *lsnp; + meta->free = argp->next; + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + meta->lsn = argp->meta_lsn; + meta->free = argp->pgno; + modified = 1; + } + if ((ret = memp_fput(mpf, meta, modified ? DB_MPOOL_DIRTY : 0)) != 0) { + (void)__db_panic(file_dbp); + goto out; + } + + *lsnp = argp->prev_lsn; + ret = 0; + +out: REC_CLOSE; +} + +/* + * __bam_pg_free_recover -- + * Recovery function for pg_free. + * + * PUBLIC: int __bam_pg_free_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_pg_free_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __bam_pg_free_args *argp; + BTMETA *meta; + DB *file_dbp, *mdbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + db_pgno_t pgno; + int cmp_n, cmp_p, modified, ret; + + REC_PRINT(__bam_pg_free_print); + REC_INTRO(__bam_pg_free_read); + + /* + * Fix up the freed page. If we're redoing the operation we get the + * page and explicitly discard its contents, then update its LSN. If + * we're undoing the operation, we get the page and restore its header. + */ + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) { + /* + * We don't automatically create the page. The only way the + * page might not exist is if the alloc never happened, and + * the only way the alloc might never have happened is if we + * are undoing, in which case there's no reason to create the + * page. + */ + if (!redo) + goto done; + (void)__db_pgerr(file_dbp, argp->pgno); + goto out; + } + modified = 0; + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &LSN(argp->header.data)); + if (cmp_p == 0 && redo) { + /* Need to redo update described. */ + P_INIT(pagep, file_dbp->pgsize, + pagep->pgno, PGNO_INVALID, argp->next, 0, P_INVALID); + pagep->lsn = *lsnp; + + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + memcpy(pagep, argp->header.data, argp->header.size); + + modified = 1; + } + if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) != 0) { + (void)__db_panic(file_dbp); + goto out; + } + + /* + * Fix up the metadata page. If we're redoing or undoing the operation + * we get the page and update its LSN and free pointer. + */ + pgno = PGNO_METADATA; + if ((ret = memp_fget(mpf, &pgno, 0, &meta)) != 0) { + /* The metadata page must always exist. */ + (void)__db_pgerr(file_dbp, pgno); + goto out; + } + + modified = 0; + cmp_n = log_compare(lsnp, &LSN(meta)); + cmp_p = log_compare(&LSN(meta), &argp->meta_lsn); + if (cmp_p == 0 && redo) { + /* Need to redo update described. */ + meta->free = argp->pgno; + + meta->lsn = *lsnp; + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + meta->free = argp->next; + + meta->lsn = argp->meta_lsn; + modified = 1; + } + if ((ret = memp_fput(mpf, meta, modified ? DB_MPOOL_DIRTY : 0)) != 0) { + (void)__db_panic(file_dbp); + goto out; + } + +done: *lsnp = argp->prev_lsn; + ret = 0; + +out: REC_CLOSE; +} + +/* + * __bam_split_recover -- + * Recovery function for split. + * + * PUBLIC: int __bam_split_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_split_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __bam_split_args *argp; + DB *file_dbp, *mdbp; + DB_MPOOLFILE *mpf; + PAGE *_lp, *lp, *np, *pp, *_rp, *rp, *sp; + db_pgno_t pgno; + int l_update, p_update, r_update, ret, rootsplit, t_ret; + + REC_PRINT(__bam_split_print); + + mpf = NULL; + _lp = lp = np = pp = _rp = rp = NULL; + + REC_INTRO(__bam_split_read); + + /* + * There are two kinds of splits that we have to recover from. The + * first is a root-page split, where the root page is split from a + * leaf page into an internal page and two new leaf pages are created. + * The second is where a page is split into two pages, and a new key + * is inserted into the parent page. + */ + sp = argp->pg.data; + pgno = PGNO(sp); + rootsplit = pgno == PGNO_ROOT; + if (memp_fget(mpf, &argp->left, 0, &lp) != 0) + lp = NULL; + if (memp_fget(mpf, &argp->right, 0, &rp) != 0) + rp = NULL; + + if (redo) { + l_update = r_update = p_update = 0; + /* + * Decide if we need to resplit the page. + * + * If this is a root split, then the root has to exist, it's + * the page we're splitting and it gets modified. If this is + * not a root split, then the left page has to exist, for the + * same reason. + */ + if (rootsplit) { + if ((ret = memp_fget(mpf, &pgno, 0, &pp)) != 0) { + (void)__db_pgerr(file_dbp, pgno); + pp = NULL; + goto out; + } + p_update = + log_compare(&LSN(pp), &LSN(argp->pg.data)) == 0; + } else + if (lp == NULL) { + (void)__db_pgerr(file_dbp, argp->left); + goto out; + } + if (lp == NULL || log_compare(&LSN(lp), &argp->llsn) == 0) + l_update = 1; + if (rp == NULL || log_compare(&LSN(rp), &argp->rlsn) == 0) + r_update = 1; + if (!p_update && !l_update && !r_update) + goto done; + + /* Allocate and initialize new left/right child pages. */ + if ((_lp = (PAGE *)__db_malloc(file_dbp->pgsize)) == NULL || + (_rp = (PAGE *)__db_malloc(file_dbp->pgsize)) == NULL) { + ret = ENOMEM; + __db_err(file_dbp->dbenv, "%s", strerror(ret)); + goto out; + } + if (rootsplit) { + P_INIT(_lp, file_dbp->pgsize, argp->left, + PGNO_INVALID, + ISINTERNAL(sp) ? PGNO_INVALID : argp->right, + LEVEL(sp), TYPE(sp)); + P_INIT(_rp, file_dbp->pgsize, argp->right, + ISINTERNAL(sp) ? PGNO_INVALID : argp->left, + PGNO_INVALID, LEVEL(sp), TYPE(sp)); + } else { + P_INIT(_lp, file_dbp->pgsize, PGNO(sp), + ISINTERNAL(sp) ? PGNO_INVALID : PREV_PGNO(sp), + ISINTERNAL(sp) ? PGNO_INVALID : argp->right, + LEVEL(sp), TYPE(sp)); + P_INIT(_rp, file_dbp->pgsize, argp->right, + ISINTERNAL(sp) ? PGNO_INVALID : sp->pgno, + ISINTERNAL(sp) ? PGNO_INVALID : NEXT_PGNO(sp), + LEVEL(sp), TYPE(sp)); + } + + /* Split the page. */ + if ((ret = __bam_copy(file_dbp, sp, _lp, 0, argp->indx)) != 0 || + (ret = __bam_copy(file_dbp, sp, _rp, argp->indx, + NUM_ENT(sp))) != 0) + goto out; + + /* If the left child is wrong, update it. */ + if (lp == NULL && (ret = + memp_fget(mpf, &argp->left, DB_MPOOL_CREATE, &lp)) != 0) { + (void)__db_pgerr(file_dbp, argp->left); + lp = NULL; + goto out; + } + if (l_update) { + memcpy(lp, _lp, file_dbp->pgsize); + lp->lsn = *lsnp; + if ((ret = memp_fput(mpf, lp, DB_MPOOL_DIRTY)) != 0) + goto fatal; + lp = NULL; + } + + /* If the right child is wrong, update it. */ + if (rp == NULL && (ret = memp_fget(mpf, + &argp->right, DB_MPOOL_CREATE, &rp)) != 0) { + (void)__db_pgerr(file_dbp, argp->right); + rp = NULL; + goto out; + } + if (r_update) { + memcpy(rp, _rp, file_dbp->pgsize); + rp->lsn = *lsnp; + if ((ret = memp_fput(mpf, rp, DB_MPOOL_DIRTY)) != 0) + goto fatal; + rp = NULL; + } + + /* + * If the parent page is wrong, update it. This is of interest + * only if it was a root split, since root splits create parent + * pages. All other splits modify a parent page, but those are + * separately logged and recovered. + */ + if (rootsplit && p_update) { + if (file_dbp->type == DB_BTREE) + P_INIT(pp, file_dbp->pgsize, + PGNO_ROOT, PGNO_INVALID, PGNO_INVALID, + _lp->level + 1, P_IBTREE); + else + P_INIT(pp, file_dbp->pgsize, + PGNO_ROOT, PGNO_INVALID, PGNO_INVALID, + _lp->level + 1, P_IRECNO); + RE_NREC_SET(pp, + file_dbp->type == DB_RECNO || + F_ISSET(file_dbp, DB_BT_RECNUM) ? + __bam_total(_lp) + __bam_total(_rp) : 0); + pp->lsn = *lsnp; + if ((ret = memp_fput(mpf, pp, DB_MPOOL_DIRTY)) != 0) + goto fatal; + pp = NULL; + } + + /* + * Finally, redo the next-page link if necessary. This is of + * interest only if it wasn't a root split -- inserting a new + * page in the tree requires that any following page have its + * previous-page pointer updated to our new page. The next + * page must exist because we're redoing the operation. + */ + if (!rootsplit && !IS_ZERO_LSN(argp->nlsn)) { + if ((ret = memp_fget(mpf, &argp->npgno, 0, &np)) != 0) { + (void)__db_pgerr(file_dbp, argp->npgno); + np = NULL; + goto out; + } + if (log_compare(&LSN(np), &argp->nlsn) == 0) { + PREV_PGNO(np) = argp->right; + np->lsn = *lsnp; + if ((ret = memp_fput(mpf, + np, DB_MPOOL_DIRTY)) != 0) + goto fatal; + np = NULL; + } + } + } else { + /* + * If the split page is wrong, replace its contents with the + * logged page contents. If the page doesn't exist, it means + * that the create of the page never happened, nor did any of + * the adds onto the page that caused the split, and there's + * really no undo-ing to be done. + */ + if ((ret = memp_fget(mpf, &pgno, 0, &pp)) != 0) { + pp = NULL; + goto lrundo; + } + if (log_compare(lsnp, &LSN(pp)) == 0) { + memcpy(pp, argp->pg.data, argp->pg.size); + if ((ret = memp_fput(mpf, pp, DB_MPOOL_DIRTY)) != 0) + goto fatal; + pp = NULL; + } + + /* + * If it's a root split and the left child ever existed, update + * its LSN. (If it's not a root split, we've updated the left + * page already -- it's the same as the split page.) If the + * right child ever existed, root split or not, update its LSN. + * The undo of the page allocation(s) will restore them to the + * free list. + */ +lrundo: if ((rootsplit && lp != NULL) || rp != NULL) { + if (rootsplit && lp != NULL && + log_compare(lsnp, &LSN(lp)) == 0) { + lp->lsn = argp->llsn; + if ((ret = + memp_fput(mpf, lp, DB_MPOOL_DIRTY)) != 0) + goto fatal; + lp = NULL; + } + if (rp != NULL && + log_compare(lsnp, &LSN(rp)) == 0) { + rp->lsn = argp->rlsn; + if ((ret = + memp_fput(mpf, rp, DB_MPOOL_DIRTY)) != 0) + goto fatal; + rp = NULL; + } + } + + /* + * Finally, undo the next-page link if necessary. This is of + * interest only if it wasn't a root split -- inserting a new + * page in the tree requires that any following page have its + * previous-page pointer updated to our new page. Since it's + * possible that the next-page never existed, we ignore it as + * if there's nothing to undo. + */ + if (!rootsplit && !IS_ZERO_LSN(argp->nlsn)) { + if ((ret = memp_fget(mpf, &argp->npgno, 0, &np)) != 0) { + np = NULL; + goto done; + } + if (log_compare(lsnp, &LSN(np)) == 0) { + PREV_PGNO(np) = argp->left; + np->lsn = argp->nlsn; + if (memp_fput(mpf, np, DB_MPOOL_DIRTY)) + goto fatal; + np = NULL; + } + } + } + +done: *lsnp = argp->prev_lsn; + ret = 0; + + if (0) { +fatal: (void)__db_panic(file_dbp); + } +out: /* Free any pages that weren't dirtied. */ + if (pp != NULL && (t_ret = memp_fput(mpf, pp, 0)) != 0 && ret == 0) + ret = t_ret; + if (lp != NULL && (t_ret = memp_fput(mpf, lp, 0)) != 0 && ret == 0) + ret = t_ret; + if (np != NULL && (t_ret = memp_fput(mpf, np, 0)) != 0 && ret == 0) + ret = t_ret; + if (rp != NULL && (t_ret = memp_fput(mpf, rp, 0)) != 0 && ret == 0) + ret = t_ret; + + /* Free any allocated space. */ + if (_lp != NULL) + __db_free(_lp); + if (_rp != NULL) + __db_free(_rp); + + REC_CLOSE; +} + +/* + * __bam_rsplit_recover -- + * Recovery function for a reverse split. + * + * PUBLIC: int __bam_rsplit_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_rsplit_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __bam_rsplit_args *argp; + DB *file_dbp, *mdbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + db_pgno_t pgno; + int cmp_n, cmp_p, modified, ret; + + REC_PRINT(__bam_rsplit_print); + REC_INTRO(__bam_rsplit_read); + + /* Fix the root page. */ + pgno = PGNO_ROOT; + if ((ret = memp_fget(mpf, &pgno, 0, &pagep)) != 0) { + /* The root page must always exist. */ + __db_pgerr(file_dbp, pgno); + goto out; + } + modified = 0; + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->rootlsn); + if (cmp_p == 0 && redo) { + /* Need to redo update described. */ + memcpy(pagep, argp->pgdbt.data, argp->pgdbt.size); + pagep->pgno = PGNO_ROOT; + pagep->lsn = *lsnp; + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + P_INIT(pagep, file_dbp->pgsize, PGNO_ROOT, + argp->nrec, PGNO_INVALID, pagep->level + 1, + file_dbp->type == DB_BTREE ? P_IBTREE : P_IRECNO); + if ((ret = __db_pitem(file_dbp, pagep, 0, + argp->rootent.size, &argp->rootent, NULL)) != 0) + goto out; + pagep->lsn = argp->rootlsn; + modified = 1; + } + if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) != 0) { + (void)__db_panic(file_dbp); + goto out; + } + + /* + * Fix the page copied over the root page. It's possible that the + * page never made it to disk, so if we're undo-ing and the page + * doesn't exist, it's okay and there's nothing further to do. + */ + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) { + if (!redo) + goto done; + (void)__db_pgerr(file_dbp, argp->pgno); + goto out; + } + modified = 0; + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &LSN(argp->pgdbt.data)); + if (cmp_p == 0 && redo) { + /* Need to redo update described. */ + pagep->lsn = *lsnp; + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + memcpy(pagep, argp->pgdbt.data, argp->pgdbt.size); + modified = 1; + } + if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) != 0) { + (void)__db_panic(file_dbp); + goto out; + } + +done: *lsnp = argp->prev_lsn; + ret = 0; + +out: REC_CLOSE; +} + +/* + * __bam_adj_recover -- + * Recovery function for adj. + * + * PUBLIC: int __bam_adj_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_adj_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __bam_adj_args *argp; + DB *file_dbp, *mdbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + + REC_PRINT(__bam_adj_print); + REC_INTRO(__bam_adj_read); + + /* Get the page; if it never existed and we're undoing, we're done. */ + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) { + if (!redo) + goto done; + (void)__db_pgerr(file_dbp, argp->pgno); + goto out; + } + + modified = 0; + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->lsn); + if (cmp_p == 0 && redo) { + /* Need to redo update described. */ + if ((ret = __bam_adjindx(file_dbp, + pagep, argp->indx, argp->indx_copy, argp->is_insert)) != 0) + goto err; + + LSN(pagep) = *lsnp; + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + if ((ret = __bam_adjindx(file_dbp, + pagep, argp->indx, argp->indx_copy, !argp->is_insert)) != 0) + goto err; + + LSN(pagep) = argp->lsn; + modified = 1; + } + if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) != 0) + goto out; + +done: *lsnp = argp->prev_lsn; + ret = 0; + + if (0) { +err: (void)memp_fput(mpf, pagep, 0); + } +out: REC_CLOSE; +} + +/* + * __bam_cadjust_recover -- + * Recovery function for the adjust of a count change in an internal + * page. + * + * PUBLIC: int __bam_cadjust_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_cadjust_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __bam_cadjust_args *argp; + DB *file_dbp, *mdbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + + REC_PRINT(__bam_cadjust_print); + REC_INTRO(__bam_cadjust_read); + + /* Get the page; if it never existed and we're undoing, we're done. */ + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) { + if (!redo) + goto done; + (void)__db_pgerr(file_dbp, argp->pgno); + goto out; + } + + modified = 0; + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->lsn); + if (cmp_p == 0 && redo) { + /* Need to redo update described. */ + if (file_dbp->type == DB_BTREE && + F_ISSET(file_dbp, DB_BT_RECNUM)) { + GET_BINTERNAL(pagep, argp->indx)->nrecs += argp->adjust; + if (argp->total && PGNO(pagep) == PGNO_ROOT) + RE_NREC_ADJ(pagep, argp->adjust); + } + if (file_dbp->type == DB_RECNO) { + GET_RINTERNAL(pagep, argp->indx)->nrecs += argp->adjust; + if (argp->total && PGNO(pagep) == PGNO_ROOT) + RE_NREC_ADJ(pagep, argp->adjust); + } + + LSN(pagep) = *lsnp; + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + if (file_dbp->type == DB_BTREE && + F_ISSET(file_dbp, DB_BT_RECNUM)) { + GET_BINTERNAL(pagep, argp->indx)->nrecs -= argp->adjust; + if (argp->total && PGNO(pagep) == PGNO_ROOT) + RE_NREC_ADJ(pagep, argp->adjust); + } + if (file_dbp->type == DB_RECNO) { + GET_RINTERNAL(pagep, argp->indx)->nrecs -= argp->adjust; + if (argp->total && PGNO(pagep) == PGNO_ROOT) + RE_NREC_ADJ(pagep, -(argp->adjust)); + } + LSN(pagep) = argp->lsn; + modified = 1; + } + if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) != 0) + goto out; + +done: *lsnp = argp->prev_lsn; + ret = 0; + +out: REC_CLOSE; +} + +/* + * __bam_cdel_recover -- + * Recovery function for the intent-to-delete of a cursor record. + * + * PUBLIC: int __bam_cdel_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_cdel_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __bam_cdel_args *argp; + DB *file_dbp, *mdbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + + REC_PRINT(__bam_cdel_print); + REC_INTRO(__bam_cdel_read); + + /* Get the page; if it never existed and we're undoing, we're done. */ + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) { + if (!redo) + goto done; + (void)__db_pgerr(file_dbp, argp->pgno); + goto out; + } + + modified = 0; + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->lsn); + if (cmp_p == 0 && redo) { + /* Need to redo update described. */ + B_DSET(GET_BKEYDATA(pagep, argp->indx + O_INDX)->type); + + LSN(pagep) = *lsnp; + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + B_DCLR(GET_BKEYDATA(pagep, argp->indx + O_INDX)->type); + + LSN(pagep) = argp->lsn; + modified = 1; + } + if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) != 0) + goto out; + +done: *lsnp = argp->prev_lsn; + ret = 0; + +out: REC_CLOSE; +} + +/* + * __bam_repl_recover -- + * Recovery function for page item replacement. + * + * PUBLIC: int __bam_repl_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_repl_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __bam_repl_args *argp; + BKEYDATA *bk; + DB *file_dbp, *mdbp; + DBT dbt; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + u_int8_t *p; + + REC_PRINT(__bam_repl_print); + REC_INTRO(__bam_repl_read); + + /* Get the page; if it never existed and we're undoing, we're done. */ + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) { + if (!redo) + goto done; + (void)__db_pgerr(file_dbp, argp->pgno); + goto out; + } + bk = GET_BKEYDATA(pagep, argp->indx); + + modified = 0; + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->lsn); + if (cmp_p == 0 && redo) { + /* + * Need to redo update described. + * + * Re-build the replacement item. + */ + memset(&dbt, 0, sizeof(dbt)); + dbt.size = argp->prefix + argp->suffix + argp->repl.size; + if ((dbt.data = __db_malloc(dbt.size)) == NULL) { + ret = ENOMEM; + goto err; + } + p = dbt.data; + memcpy(p, bk->data, argp->prefix); + p += argp->prefix; + memcpy(p, argp->repl.data, argp->repl.size); + p += argp->repl.size; + memcpy(p, bk->data + (bk->len - argp->suffix), argp->suffix); + + ret = __bam_ritem(file_dbp, pagep, argp->indx, &dbt); + __db_free(dbt.data); + if (ret != 0) + goto err; + + LSN(pagep) = *lsnp; + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* + * Need to undo update described. + * + * Re-build the original item. + */ + memset(&dbt, 0, sizeof(dbt)); + dbt.size = argp->prefix + argp->suffix + argp->orig.size; + if ((dbt.data = __db_malloc(dbt.size)) == NULL) { + ret = ENOMEM; + goto err; + } + p = dbt.data; + memcpy(p, bk->data, argp->prefix); + p += argp->prefix; + memcpy(p, argp->orig.data, argp->orig.size); + p += argp->orig.size; + memcpy(p, bk->data + (bk->len - argp->suffix), argp->suffix); + + ret = __bam_ritem(file_dbp, pagep, argp->indx, &dbt); + __db_free(dbt.data); + if (ret != 0) + goto err; + + /* Reset the deleted flag, if necessary. */ + if (argp->isdeleted) + B_DSET(GET_BKEYDATA(pagep, argp->indx)->type); + + LSN(pagep) = argp->lsn; + modified = 1; + } + if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) != 0) + goto out; + +done: *lsnp = argp->prev_lsn; + ret = 0; + + if (0) { +err: (void)memp_fput(mpf, pagep, 0); + } +out: REC_CLOSE; +} diff --git a/mozilla/db/btree/bt_recno.c b/mozilla/db/btree/bt_recno.c new file mode 100644 index 00000000000..38dbbd1c55b --- /dev/null +++ b/mozilla/db/btree/bt_recno.c @@ -0,0 +1,1263 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)bt_recno.c 10.37 (Sleepycat) 5/23/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "btree.h" + +static int __ram_add __P((DB *, db_recno_t *, DBT *, u_int32_t, u_int32_t)); +static int __ram_c_close __P((DBC *)); +static int __ram_c_del __P((DBC *, u_int32_t)); +static int __ram_c_get __P((DBC *, DBT *, DBT *, u_int32_t)); +static int __ram_c_put __P((DBC *, DBT *, DBT *, u_int32_t)); +static int __ram_fmap __P((DB *, db_recno_t)); +static int __ram_get __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); +static int __ram_iget __P((DB *, DBT *, DBT *)); +static int __ram_put __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); +static int __ram_source __P((DB *, RECNO *, const char *)); +static int __ram_sync __P((DB *, u_int32_t)); +static int __ram_update __P((DB *, db_recno_t, int)); +static int __ram_vmap __P((DB *, db_recno_t)); +static int __ram_writeback __P((DB *)); + +/* + * If we're renumbering records, then we have to detect in the cursor that a + * record was deleted, and adjust the cursor as necessary. If not renumbering + * records, then we can detect this by looking at the actual record, so we + * ignore the cursor delete flag. + */ +#define CD_SET(dbp, cp) { \ + if (F_ISSET(dbp, DB_RE_RENUMBER)) \ + F_SET(cp, CR_DELETED); \ +} +#define CD_CLR(dbp, cp) { \ + if (F_ISSET(dbp, DB_RE_RENUMBER)) \ + F_CLR(cp, CR_DELETED); \ +} +#define CD_ISSET(dbp, cp) \ + (F_ISSET(dbp, DB_RE_RENUMBER) && F_ISSET(cp, CR_DELETED)) + +/* + * __ram_open -- + * Recno open function. + * + * PUBLIC: int __ram_open __P((DB *, DBTYPE, DB_INFO *)); + */ +int +__ram_open(dbp, type, dbinfo) + DB *dbp; + DBTYPE type; + DB_INFO *dbinfo; +{ + BTREE *t; + RECNO *rp; + int ret; + + COMPQUIET(type, DB_RECNO); + + ret = 0; + + /* Allocate and initialize the private RECNO structure. */ + if ((rp = (RECNO *)__db_calloc(1, sizeof(*rp))) == NULL) + return (ENOMEM); + + if (dbinfo != NULL) { + /* + * If the user specified a source tree, open it and map it in. + * + * !!! + * We don't complain if the user specified transactions or + * threads. It's possible to make it work, but you'd better + * know what you're doing! + */ + if (dbinfo->re_source == NULL) { + rp->re_fd = -1; + F_SET(rp, RECNO_EOF); + } else { + if ((ret = + __ram_source(dbp, rp, dbinfo->re_source)) != 0) + goto err; + } + + /* Copy delimiter, length and padding values. */ + rp->re_delim = + F_ISSET(dbp, DB_RE_DELIMITER) ? dbinfo->re_delim : '\n'; + rp->re_pad = F_ISSET(dbp, DB_RE_PAD) ? dbinfo->re_pad : ' '; + + if (F_ISSET(dbp, DB_RE_FIXEDLEN)) { + if ((rp->re_len = dbinfo->re_len) == 0) { + __db_err(dbp->dbenv, + "record length must be greater than 0"); + ret = EINVAL; + goto err; + } + } else + rp->re_len = 0; + } else { + rp->re_delim = '\n'; + rp->re_pad = ' '; + rp->re_fd = -1; + F_SET(rp, RECNO_EOF); + } + + /* Open the underlying btree. */ + if ((ret = __bam_open(dbp, DB_RECNO, dbinfo)) != 0) + goto err; + + /* Set the routines necessary to make it look like a recno tree. */ + dbp->cursor = __ram_cursor; + dbp->del = __ram_delete; + dbp->get = __ram_get; + dbp->put = __ram_put; + dbp->sync = __ram_sync; + + /* Link in the private recno structure. */ + ((BTREE *)dbp->internal)->bt_recno = rp; + + /* If we're snapshotting an underlying source file, do it now. */ + if (dbinfo != NULL && F_ISSET(dbinfo, DB_SNAPSHOT)) + if ((ret = __ram_snapshot(dbp)) != 0 && ret != DB_NOTFOUND) + goto err; + + return (0); + +err: /* If we mmap'd a source file, discard it. */ + if (rp->re_smap != NULL) + (void)__db_unmapfile(rp->re_smap, rp->re_msize); + + /* If we opened a source file, discard it. */ + if (rp->re_fd != -1) + (void)__db_close(rp->re_fd); + if (rp->re_source != NULL) + FREES(rp->re_source); + + /* If we allocated room for key/data return, discard it. */ + t = dbp->internal; + if (t != NULL && t->bt_rkey.data != NULL) + __db_free(t->bt_rkey.data); + + FREE(rp, sizeof(*rp)); + + return (ret); +} + +/* + * __ram_cursor -- + * Recno db->cursor function. + * + * PUBLIC: int __ram_cursor __P((DB *, DB_TXN *, DBC **)); + */ +int +__ram_cursor(dbp, txn, dbcp) + DB *dbp; + DB_TXN *txn; + DBC **dbcp; +{ + RCURSOR *cp; + DBC *dbc; + + DEBUG_LWRITE(dbp, txn, "ram_cursor", NULL, NULL, 0); + + if ((dbc = (DBC *)__db_calloc(1, sizeof(DBC))) == NULL) + return (ENOMEM); + if ((cp = (RCURSOR *)__db_calloc(1, sizeof(RCURSOR))) == NULL) { + __db_free(dbc); + return (ENOMEM); + } + + cp->dbc = dbc; + cp->recno = RECNO_OOB; + + dbc->dbp = dbp; + dbc->txn = txn; + dbc->internal = cp; + dbc->c_close = __ram_c_close; + dbc->c_del = __ram_c_del; + dbc->c_get = __ram_c_get; + dbc->c_put = __ram_c_put; + + /* + * All cursors are queued from the master DB structure. Add the + * cursor to that queue. + */ + CURSOR_SETUP(dbp); + TAILQ_INSERT_HEAD(&dbp->curs_queue, dbc, links); + CURSOR_TEARDOWN(dbp); + + *dbcp = dbc; + return (0); +} + +/* + * __ram_get -- + * Recno db->get function. + */ +static int +__ram_get(argdbp, txn, key, data, flags) + DB *argdbp; + DB_TXN *txn; + DBT *key, *data; + u_int32_t flags; +{ + DB *dbp; + int ret; + + DEBUG_LWRITE(argdbp, txn, "ram_get", key, NULL, flags); + + /* Check for invalid flags. */ + if ((ret = __db_getchk(argdbp, key, data, flags)) != 0) + return (ret); + + GETHANDLE(argdbp, txn, &dbp, ret); + + ret = __ram_iget(dbp, key, data); + + PUTHANDLE(dbp); + return (ret); +} + +/* + * __ram_iget -- + * Internal ram get function, called for both standard and cursor + * get after the flags have been checked. + */ +static int +__ram_iget(dbp, key, data) + DB *dbp; + DBT *key, *data; +{ + BTREE *t; + PAGE *h; + db_indx_t indx; + db_recno_t recno; + int exact, ret, stack; + + stack = 0; + t = dbp->internal; + + /* Check the user's record number and fill in as necessary. */ + if ((ret = __ram_getno(dbp, key, &recno, 0)) != 0) + goto done; + + /* Search the tree for the record. */ + if ((ret = __bam_rsearch(dbp, &recno, S_FIND, 1, &exact)) != 0) + goto done; + if (!exact) + return (DB_NOTFOUND); + stack = 1; + + h = t->bt_csp->page; + indx = t->bt_csp->indx; + + /* If the record has already been deleted, we couldn't have found it. */ + if (B_DISSET(GET_BKEYDATA(h, indx)->type)) { + ret = DB_KEYEMPTY; + goto done; + } + + /* Return the data item. */ + ret = __db_ret(dbp, + h, indx, data, &t->bt_rdata.data, &t->bt_rdata.ulen); + ++t->lstat.bt_get; + +done: /* Discard the stack. */ + if (stack) + __bam_stkrel(dbp); + + return (ret); +} + +/* + * __ram_put -- + * Recno db->put function. + */ +static int +__ram_put(argdbp, txn, key, data, flags) + DB *argdbp; + DB_TXN *txn; + DBT *key, *data; + u_int32_t flags; +{ + BTREE *t; + DB *dbp; + db_recno_t recno; + int ret; + + DEBUG_LWRITE(argdbp, txn, "ram_put", key, data, flags); + + /* Check for invalid flags. */ + if ((ret = __db_putchk(argdbp, + key, data, flags, F_ISSET(argdbp, DB_AM_RDONLY), 0)) != 0) + return (ret); + + GETHANDLE(argdbp, txn, &dbp, ret); + + /* + * If we're appending to the tree, make sure we've read in all of + * the backing source file. Otherwise, check the user's record + * number and fill in as necessary. + */ + ret = LF_ISSET(DB_APPEND) ? + __ram_snapshot(dbp) : __ram_getno(dbp, key, &recno, 1); + + /* Add the record. */ + if (ret == 0) + ret = __ram_add(dbp, &recno, data, flags, 0); + + /* If we're appending to the tree, we have to return the record. */ + if (ret == 0 && LF_ISSET(DB_APPEND)) { + t = dbp->internal; + ret = __db_retcopy(key, &recno, sizeof(recno), + &t->bt_rkey.data, &t->bt_rkey.ulen, dbp->db_malloc); + } + + PUTHANDLE(dbp); + return (ret); +} + +/* + * __ram_sync -- + * Recno db->sync function. + */ +static int +__ram_sync(argdbp, flags) + DB *argdbp; + u_int32_t flags; +{ + DB *dbp; + int ret; + + DEBUG_LWRITE(argdbp, NULL, "ram_sync", NULL, NULL, flags); + + /* Sync the underlying btree. */ + if ((ret = __bam_sync(argdbp, flags)) != 0) + return (ret); + + /* Copy back the backing source file. */ + GETHANDLE(argdbp, NULL, &dbp, ret); + ret = __ram_writeback(dbp); + PUTHANDLE(dbp); + + return (ret); +} + +/* + * __ram_close -- + * Recno db->close function. + * + * PUBLIC: int __ram_close __P((DB *)); + */ +int +__ram_close(argdbp) + DB *argdbp; +{ + RECNO *rp; + + DEBUG_LWRITE(argdbp, NULL, "ram_close", NULL, NULL, 0); + + rp = ((BTREE *)argdbp->internal)->bt_recno; + + /* Close any underlying mmap region. */ + if (rp->re_smap != NULL) + (void)__db_unmapfile(rp->re_smap, rp->re_msize); + + /* Close any backing source file descriptor. */ + if (rp->re_fd != -1) + (void)__db_close(rp->re_fd); + + /* Free any backing source file name. */ + if (rp->re_source != NULL) + FREES(rp->re_source); + + /* Free allocated memory. */ + FREE(rp, sizeof(RECNO)); + ((BTREE *)argdbp->internal)->bt_recno = NULL; + + /* Close the underlying btree. */ + return (__bam_close(argdbp)); +} + +/* + * __ram_c_close -- + * Recno cursor->close function. + */ +static int +__ram_c_close(dbc) + DBC *dbc; +{ + DEBUG_LWRITE(dbc->dbp, dbc->txn, "ram_c_close", NULL, NULL, 0); + + return (__ram_c_iclose(dbc->dbp, dbc)); +} + +/* + * __ram_c_iclose -- + * Close a single cursor -- internal version. + * + * PUBLIC: int __ram_c_iclose __P((DB *, DBC *)); + */ +int +__ram_c_iclose(dbp, dbc) + DB *dbp; + DBC *dbc; +{ + /* Remove the cursor from the queue. */ + CURSOR_SETUP(dbp); + TAILQ_REMOVE(&dbp->curs_queue, dbc, links); + CURSOR_TEARDOWN(dbp); + + /* Discard the structures. */ + FREE(dbc->internal, sizeof(RCURSOR)); + FREE(dbc, sizeof(DBC)); + + return (0); +} + +/* + * __ram_c_del -- + * Recno cursor->c_del function. + */ +static int +__ram_c_del(dbc, flags) + DBC *dbc; + u_int32_t flags; +{ + DBT key; + RCURSOR *cp; + int ret; + + DEBUG_LWRITE(dbc->dbp, dbc->txn, "ram_c_del", NULL, NULL, flags); + + cp = dbc->internal; + + /* Check for invalid flags. */ + if ((ret = __db_cdelchk(dbc->dbp, flags, + F_ISSET(dbc->dbp, DB_AM_RDONLY), cp->recno != RECNO_OOB)) != 0) + return (ret); + + /* If already deleted, return failure. */ + if (CD_ISSET(dbc->dbp, cp)) + return (DB_KEYEMPTY); + + /* Build a normal delete request. */ + memset(&key, 0, sizeof(key)); + key.data = &cp->recno; + key.size = sizeof(db_recno_t); + if ((ret = __ram_delete(dbc->dbp, dbc->txn, &key, 0)) == 0) + CD_SET(dbc->dbp, cp); + + return (ret); +} + +/* + * __ram_c_get -- + * Recno cursor->c_get function. + */ +static int +__ram_c_get(dbc, key, data, flags) + DBC *dbc; + DBT *key, *data; + u_int32_t flags; +{ + BTREE *t; + DB *dbp; + RCURSOR *cp, copy; + int ret; + + DEBUG_LREAD(dbc->dbp, dbc->txn, "ram_c_get", + flags == DB_SET || flags == DB_SET_RANGE ? key : NULL, + NULL, flags); + + cp = dbc->internal; + dbp = dbc->dbp; + + /* Check for invalid flags. */ + if ((ret = __db_cgetchk(dbc->dbp, + key, data, flags, cp->recno != RECNO_OOB)) != 0) + return (ret); + + GETHANDLE(dbc->dbp, dbc->txn, &dbp, ret); + t = dbp->internal; + + /* Initialize the cursor for a new retrieval. */ + copy = *cp; + +retry: /* Update the record number. */ + switch (flags) { + case DB_CURRENT: + if (CD_ISSET(dbp, cp)) { + PUTHANDLE(dbp); + return (DB_KEYEMPTY); + } + break; + case DB_NEXT: + if (CD_ISSET(dbp, cp)) + break; + if (cp->recno != RECNO_OOB) { + ++cp->recno; + break; + } + /* FALLTHROUGH */ + case DB_FIRST: + flags = DB_NEXT; + cp->recno = 1; + break; + case DB_PREV: + if (cp->recno != RECNO_OOB) { + if (cp->recno == 1) + return (DB_NOTFOUND); + --cp->recno; + break; + } + /* FALLTHROUGH */ + case DB_LAST: + flags = DB_PREV; + if (((ret = __ram_snapshot(dbp)) != 0) && ret != DB_NOTFOUND) + goto err; + if ((ret = __bam_nrecs(dbp, &cp->recno)) != 0) + goto err; + if (cp->recno == 0) + return (DB_NOTFOUND); + break; + case DB_SET: + case DB_SET_RANGE: + if ((ret = __ram_getno(dbp, key, &cp->recno, 0)) != 0) + goto err; + break; + } + + /* + * Return the key if the user didn't give us one, and then pass it + * into __ram_iget(). + */ + if (flags != DB_SET && flags != DB_SET_RANGE && + (ret = __db_retcopy(key, &cp->recno, sizeof(cp->recno), + &t->bt_rkey.data, &t->bt_rkey.ulen, dbp->db_malloc)) != 0) + return (ret); + + /* + * The cursor was reset, so the delete adjustment is no + * longer necessary. + */ + CD_CLR(dbp, cp); + + /* + * Retrieve the record. + * + * Skip any keys that don't really exist. + */ + if ((ret = __ram_iget(dbp, key, data)) != 0) + if (ret == DB_KEYEMPTY && + (flags == DB_NEXT || flags == DB_PREV)) + goto retry; + +err: if (ret != 0) + *cp = copy; + + PUTHANDLE(dbp); + return (ret); +} + +/* + * __ram_c_put -- + * Recno cursor->c_put function. + */ +static int +__ram_c_put(dbc, key, data, flags) + DBC *dbc; + DBT *key, *data; + u_int32_t flags; +{ + BTREE *t; + RCURSOR *cp, copy; + DB *dbp; + int exact, ret; + void *arg; + + DEBUG_LWRITE(dbc->dbp, dbc->txn, "ram_c_put", NULL, data, flags); + + cp = dbc->internal; + + if ((ret = __db_cputchk(dbc->dbp, key, data, flags, + F_ISSET(dbc->dbp, DB_AM_RDONLY), cp->recno != RECNO_OOB)) != 0) + return (ret); + + GETHANDLE(dbc->dbp, dbc->txn, &dbp, ret); + t = dbp->internal; + + /* Initialize the cursor for a new retrieval. */ + copy = *cp; + + /* + * To split, we need a valid key for the page. Since it's a cursor, + * we have to build one. + * + * The split code discards all short-term locks and stack pages. + */ + if (0) { +split: arg = &cp->recno; + if ((ret = __bam_split(dbp, arg)) != 0) + goto err; + } + + if ((ret = __bam_rsearch(dbp, &cp->recno, S_INSERT, 1, &exact)) != 0) + goto err; + if (!exact) { + ret = DB_NOTFOUND; + goto err; + } + if ((ret = __bam_iitem(dbp, &t->bt_csp->page, + &t->bt_csp->indx, key, data, flags, 0)) == DB_NEEDSPLIT) { + if ((ret = __bam_stkrel(dbp)) != 0) + goto err; + goto split; + } + if ((ret = __bam_stkrel(dbp)) != 0) + goto err; + + switch (flags) { + case DB_AFTER: + /* Adjust the cursors. */ + __ram_ca(dbp, cp->recno, CA_IAFTER); + + /* Set this cursor to reference the new record. */ + cp->recno = copy.recno + 1; + break; + case DB_BEFORE: + /* Adjust the cursors. */ + __ram_ca(dbp, cp->recno, CA_IBEFORE); + + /* Set this cursor to reference the new record. */ + cp->recno = copy.recno; + break; + } + + /* + * The cursor was reset, so the delete adjustment is no + * longer necessary. + */ + CD_CLR(dbp, cp); + +err: if (ret != 0) + *cp = copy; + + PUTHANDLE(dbp); + return (ret); +} + +/* + * __ram_ca -- + * Adjust cursors. + * + * PUBLIC: void __ram_ca __P((DB *, db_recno_t, ca_recno_arg)); + */ +void +__ram_ca(dbp, recno, op) + DB *dbp; + db_recno_t recno; + ca_recno_arg op; +{ + DBC *dbc; + RCURSOR *cp; + + /* + * Adjust the cursors. See the comment in __bam_ca_delete(). + */ + CURSOR_SETUP(dbp); + for (dbc = TAILQ_FIRST(&dbp->curs_queue); + dbc != NULL; dbc = TAILQ_NEXT(dbc, links)) { + cp = (RCURSOR *)dbc->internal; + switch (op) { + case CA_DELETE: + if (recno > cp->recno) + --cp->recno; + break; + case CA_IAFTER: + if (recno > cp->recno) + ++cp->recno; + break; + case CA_IBEFORE: + if (recno >= cp->recno) + ++cp->recno; + break; + } + } + CURSOR_TEARDOWN(dbp); +} + +#ifdef DEBUG +/* + * __ram_cprint -- + * Display the current recno cursor list. + * + * PUBLIC: int __ram_cprint __P((DB *)); + */ +int +__ram_cprint(dbp) + DB *dbp; +{ + DBC *dbc; + RCURSOR *cp; + + CURSOR_SETUP(dbp); + for (dbc = TAILQ_FIRST(&dbp->curs_queue); + dbc != NULL; dbc = TAILQ_NEXT(dbc, links)) { + cp = (RCURSOR *)dbc->internal; + fprintf(stderr, + "%#0x: recno: %lu\n", (u_int)cp, (u_long)cp->recno); + } + CURSOR_TEARDOWN(dbp); + + return (0); +} +#endif /* DEBUG */ + +/* + * __ram_getno -- + * Check the user's record number, and make sure we've seen it. + * + * PUBLIC: int __ram_getno __P((DB *, const DBT *, db_recno_t *, int)); + */ +int +__ram_getno(dbp, key, rep, can_create) + DB *dbp; + const DBT *key; + db_recno_t *rep; + int can_create; +{ + db_recno_t recno; + + /* Check the user's record number. */ + if ((recno = *(db_recno_t *)key->data) == 0) { + __db_err(dbp->dbenv, "illegal record number of 0"); + return (EINVAL); + } + if (rep != NULL) + *rep = recno; + + /* + * Btree can neither create records or read them in. Recno can + * do both, see if we can find the record. + */ + return (dbp->type == DB_RECNO ? + __ram_update(dbp, recno, can_create) : 0); +} + +/* + * __ram_snapshot -- + * Read in any remaining records from the backing input file. + * + * PUBLIC: int __ram_snapshot __P((DB *)); + */ +int +__ram_snapshot(dbp) + DB *dbp; +{ + return (__ram_update(dbp, DB_MAX_RECORDS, 0)); +} + +/* + * __ram_update -- + * Ensure the tree has records up to and including the specified one. + */ +static int +__ram_update(dbp, recno, can_create) + DB *dbp; + db_recno_t recno; + int can_create; +{ + BTREE *t; + RECNO *rp; + db_recno_t nrecs; + int ret; + + t = dbp->internal; + rp = t->bt_recno; + + /* + * If we can't create records and we've read the entire backing input + * file, we're done. + */ + if (!can_create && F_ISSET(rp, RECNO_EOF)) + return (0); + + /* + * If we haven't seen this record yet, try to get it from the original + * file. + */ + if ((ret = __bam_nrecs(dbp, &nrecs)) != 0) + return (ret); + if (!F_ISSET(rp, RECNO_EOF) && recno > nrecs) { + if ((ret = rp->re_irec(dbp, recno)) != 0) + return (ret); + if ((ret = __bam_nrecs(dbp, &nrecs)) != 0) + return (ret); + } + + /* + * If we can create records, create empty ones up to the requested + * record. + */ + if (!can_create || recno <= nrecs + 1) + return (0); + + t->bt_rdata.dlen = 0; + t->bt_rdata.doff = 0; + t->bt_rdata.flags = 0; + if (F_ISSET(dbp, DB_RE_FIXEDLEN)) { + if (t->bt_rdata.ulen < rp->re_len) { + t->bt_rdata.data = t->bt_rdata.data == NULL ? + (void *)__db_malloc(rp->re_len) : + (void *)__db_realloc(t->bt_rdata.data, rp->re_len); + if (t->bt_rdata.data == NULL) { + t->bt_rdata.ulen = 0; + return (ENOMEM); + } + t->bt_rdata.ulen = rp->re_len; + } + t->bt_rdata.size = rp->re_len; + memset(t->bt_rdata.data, rp->re_pad, rp->re_len); + } else + t->bt_rdata.size = 0; + + while (recno > ++nrecs) + if ((ret = __ram_add(dbp, + &nrecs, &t->bt_rdata, 0, BI_DELETED)) != 0) + return (ret); + return (0); +} + +/* + * __ram_source -- + * Load information about the backing file. + */ +static int +__ram_source(dbp, rp, fname) + DB *dbp; + RECNO *rp; + const char *fname; +{ + size_t size; + u_int32_t bytes, mbytes, oflags; + int ret; + + if ((ret = __db_appname(dbp->dbenv, + DB_APP_DATA, NULL, fname, 0, NULL, &rp->re_source)) != 0) + return (ret); + + oflags = F_ISSET(dbp, DB_AM_RDONLY) ? DB_RDONLY : 0; + if ((ret = + __db_open(rp->re_source, oflags, oflags, 0, &rp->re_fd)) != 0) { + __db_err(dbp->dbenv, "%s: %s", rp->re_source, strerror(ret)); + goto err; + } + + /* + * XXX + * We'd like to test to see if the file is too big to mmap. Since we + * don't know what size or type off_t's or size_t's are, or the largest + * unsigned integral type is, or what random insanity the local C + * compiler will perpetrate, doing the comparison in a portable way is + * flatly impossible. Hope that mmap fails if the file is too large. + */ + if ((ret = __db_ioinfo(rp->re_source, + rp->re_fd, &mbytes, &bytes, NULL)) != 0) { + __db_err(dbp->dbenv, "%s: %s", rp->re_source, strerror(ret)); + goto err; + } + if (mbytes == 0 && bytes == 0) { + F_SET(rp, RECNO_EOF); + return (0); + } + + size = mbytes * MEGABYTE + bytes; + if ((ret = __db_mapfile(rp->re_source, + rp->re_fd, (size_t)size, 1, &rp->re_smap)) != 0) + goto err; + rp->re_cmap = rp->re_smap; + rp->re_emap = (u_int8_t *)rp->re_smap + (rp->re_msize = size); + rp->re_irec = F_ISSET(dbp, DB_RE_FIXEDLEN) ? __ram_fmap : __ram_vmap; + return (0); + +err: FREES(rp->re_source) + return (ret); +} + +/* + * __ram_writeback -- + * Rewrite the backing file. + */ +static int +__ram_writeback(dbp) + DB *dbp; +{ + RECNO *rp; + DBT key, data; + db_recno_t keyno; + ssize_t nw; + int fd, ret, t_ret; + u_int8_t delim, *pad; + + rp = ((BTREE *)dbp->internal)->bt_recno; + + /* If the file wasn't modified, we're done. */ + if (!F_ISSET(rp, RECNO_MODIFIED)) + return (0); + + /* If there's no backing source file, we're done. */ + if (rp->re_source == NULL) { + F_CLR(rp, RECNO_MODIFIED); + return (0); + } + + /* + * Read any remaining records into the tree. + * + * XXX + * This is why we can't support transactions when applications specify + * backing (re_source) files. At this point we have to read in the + * rest of the records from the file so that we can write all of the + * records back out again, which could modify a page for which we'd + * have to log changes and which we don't have locked. This could be + * partially fixed by taking a snapshot of the entire file during the + * db_open(), or, since db_open() isn't transaction protected, as part + * of the first DB operation. But, if a checkpoint occurs then, the + * part of the log holding the copy of the file could be discarded, and + * that would make it impossible to recover in the face of disaster. + * This could all probably be fixed, but it would require transaction + * protecting the backing source file, i.e. mpool would have to know + * about it, and we don't want to go there. + */ + if ((ret = __ram_snapshot(dbp)) != 0 && ret != DB_NOTFOUND) + return (ret); + + /* + * !!! + * Close any underlying mmap region. This is required for Windows NT + * (4.0, Service Pack 2) -- if the file is still mapped, the following + * open will fail. + */ + if (rp->re_smap != NULL) { + (void)__db_unmapfile(rp->re_smap, rp->re_msize); + rp->re_smap = NULL; + } + + /* Get rid of any backing file descriptor, just on GP's. */ + if (rp->re_fd != -1) { + (void)__db_close(rp->re_fd); + rp->re_fd = -1; + } + + /* Open the file, truncating it. */ + if ((ret = __db_open(rp->re_source, + DB_SEQUENTIAL | DB_TRUNCATE, + DB_SEQUENTIAL | DB_TRUNCATE, 0, &fd)) != 0) { + __db_err(dbp->dbenv, "%s: %s", rp->re_source, strerror(ret)); + return (ret); + } + + /* + * We step through the records, writing each one out. Use the record + * number and the dbp->get() function, instead of a cursor, so we find + * and write out "deleted" or non-existent records. + */ + memset(&key, 0, sizeof(key)); + memset(&data, 0, sizeof(data)); + key.size = sizeof(db_recno_t); + key.data = &keyno; + + /* + * We'll need the delimiter if we're doing variable-length records, + * and the pad character if we're doing fixed-length records. + */ + delim = rp->re_delim; + if (F_ISSET(dbp, DB_RE_FIXEDLEN)) { + if ((pad = (u_int8_t *)__db_malloc(rp->re_len)) == NULL) { + ret = ENOMEM; + goto err; + } + memset(pad, rp->re_pad, rp->re_len); + } else + COMPQUIET(pad, NULL); + for (keyno = 1;; ++keyno) { + switch (ret = dbp->get(dbp, NULL, &key, &data, 0)) { + case 0: + if ((ret = + __db_write(fd, data.data, data.size, &nw)) != 0) + goto err; + if (nw != (ssize_t)data.size) { + ret = EIO; + goto err; + } + break; + case DB_KEYEMPTY: + if (F_ISSET(dbp, DB_RE_FIXEDLEN)) { + if ((ret = + __db_write(fd, pad, rp->re_len, &nw)) != 0) + goto err; + if (nw != (ssize_t)rp->re_len) { + ret = EIO; + goto err; + } + } + break; + case DB_NOTFOUND: + ret = 0; + goto done; + } + if (!F_ISSET(dbp, DB_RE_FIXEDLEN)) { + if ((ret = __db_write(fd, &delim, 1, &nw)) != 0) + goto err; + if (nw != 1) { + ret = EIO; + goto err; + } + } + } + +err: +done: /* Close the file descriptor. */ + if ((t_ret = __db_close(fd)) != 0 || ret == 0) + ret = t_ret; + + if (ret == 0) + F_CLR(rp, RECNO_MODIFIED); + return (ret); +} + +/* + * __ram_fmap -- + * Get fixed length records from a file. + */ +static int +__ram_fmap(dbp, top) + DB *dbp; + db_recno_t top; +{ + BTREE *t; + DBT data; + RECNO *rp; + db_recno_t recno; + u_int32_t len; + u_int8_t *sp, *ep, *p; + int ret; + + if ((ret = __bam_nrecs(dbp, &recno)) != 0) + return (ret); + + t = dbp->internal; + rp = t->bt_recno; + if (t->bt_rdata.ulen < rp->re_len) { + t->bt_rdata.data = t->bt_rdata.data == NULL ? + (void *)__db_malloc(rp->re_len) : + (void *)__db_realloc(t->bt_rdata.data, rp->re_len); + if (t->bt_rdata.data == NULL) { + t->bt_rdata.ulen = 0; + return (ENOMEM); + } + t->bt_rdata.ulen = rp->re_len; + } + + memset(&data, 0, sizeof(data)); + data.data = t->bt_rdata.data; + data.size = rp->re_len; + + sp = (u_int8_t *)rp->re_cmap; + ep = (u_int8_t *)rp->re_emap; + while (recno < top) { + if (sp >= ep) { + F_SET(rp, RECNO_EOF); + return (DB_NOTFOUND); + } + len = rp->re_len; + for (p = t->bt_rdata.data; + sp < ep && len > 0; *p++ = *sp++, --len) + ; + + /* + * Another process may have read this record from the input + * file and stored it into the database already, in which + * case we don't need to repeat that operation. We detect + * this by checking if the last record we've read is greater + * or equal to the number of records in the database. + * + * XXX + * We should just do a seek, since the records are fixed + * length. + */ + if (rp->re_last >= recno) { + if (len != 0) + memset(p, rp->re_pad, len); + + ++recno; + if ((ret = __ram_add(dbp, &recno, &data, 0, 0)) != 0) + return (ret); + } + ++rp->re_last; + } + rp->re_cmap = sp; + return (0); +} + +/* + * __ram_vmap -- + * Get variable length records from a file. + */ +static int +__ram_vmap(dbp, top) + DB *dbp; + db_recno_t top; +{ + BTREE *t; + DBT data; + RECNO *rp; + db_recno_t recno; + u_int8_t *sp, *ep; + int delim, ret; + + t = dbp->internal; + rp = t->bt_recno; + + if ((ret = __bam_nrecs(dbp, &recno)) != 0) + return (ret); + + memset(&data, 0, sizeof(data)); + + delim = rp->re_delim; + + sp = (u_int8_t *)rp->re_cmap; + ep = (u_int8_t *)rp->re_emap; + while (recno < top) { + if (sp >= ep) { + F_SET(rp, RECNO_EOF); + return (DB_NOTFOUND); + } + for (data.data = sp; sp < ep && *sp != delim; ++sp) + ; + + /* + * Another process may have read this record from the input + * file and stored it into the database already, in which + * case we don't need to repeat that operation. We detect + * this by checking if the last record we've read is greater + * or equal to the number of records in the database. + */ + if (rp->re_last >= recno) { + data.size = sp - (u_int8_t *)data.data; + ++recno; + if ((ret = __ram_add(dbp, &recno, &data, 0, 0)) != 0) + return (ret); + } + ++rp->re_last; + ++sp; + } + rp->re_cmap = sp; + return (0); +} + +/* + * __ram_add -- + * Add records into the tree. + */ +static int +__ram_add(dbp, recnop, data, flags, bi_flags) + DB *dbp; + db_recno_t *recnop; + DBT *data; + u_int32_t flags, bi_flags; +{ + BKEYDATA *bk; + BTREE *t; + PAGE *h; + db_indx_t indx; + int exact, isdeleted, ret, stack; + + t = dbp->internal; + +retry: /* Find the slot for insertion. */ + if ((ret = __bam_rsearch(dbp, recnop, + S_INSERT | (LF_ISSET(DB_APPEND) ? S_APPEND : 0), 1, &exact)) != 0) + return (ret); + h = t->bt_csp->page; + indx = t->bt_csp->indx; + stack = 1; + + /* + * If DB_NOOVERWRITE is set and the item already exists in the tree, + * return an error unless the item has been marked for deletion. + */ + isdeleted = 0; + if (exact) { + bk = GET_BKEYDATA(h, indx); + if (B_DISSET(bk->type)) { + isdeleted = 1; + __bam_ca_replace(dbp, h->pgno, indx, REPLACE_SETUP); + } else + if (LF_ISSET(DB_NOOVERWRITE)) { + ret = DB_KEYEXIST; + goto err; + } + } + + /* + * Select the arguments for __bam_iitem() and do the insert. If the + * key is an exact match, or we're replacing the data item with a + * new data item, replace the current item. If the key isn't an exact + * match, we're inserting a new key/data pair, before the search + * location. + */ + switch (ret = __bam_iitem(dbp, + &h, &indx, NULL, data, exact ? DB_CURRENT : DB_BEFORE, bi_flags)) { + case 0: + /* + * Done. Clean up the cursor and adjust the internal page + * counts. + */ + if (isdeleted) + __bam_ca_replace(dbp, h->pgno, indx, REPLACE_SUCCESS); + break; + case DB_NEEDSPLIT: + /* + * We have to split the page. Back out the cursor setup, + * discard the stack of pages, and do the split. + */ + if (isdeleted) + __bam_ca_replace(dbp, h->pgno, indx, REPLACE_FAILED); + + (void)__bam_stkrel(dbp); + stack = 0; + + if ((ret = __bam_split(dbp, recnop)) != 0) + break; + + goto retry; + /* NOTREACHED */ + default: + if (isdeleted) + __bam_ca_replace(dbp, h->pgno, indx, REPLACE_FAILED); + break; + } + +err: if (stack) + __bam_stkrel(dbp); + + return (ret); +} diff --git a/mozilla/db/btree/bt_rsearch.c b/mozilla/db/btree/bt_rsearch.c new file mode 100644 index 00000000000..caa6b3515e1 --- /dev/null +++ b/mozilla/db/btree/bt_rsearch.c @@ -0,0 +1,383 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1990, 1993, 1994, 1995, 1996 + * Keith Bostic. All rights reserved. + */ +/* + * Copyright (c) 1990, 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)bt_rsearch.c 10.15 (Sleepycat) 5/6/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "btree.h" + +/* + * __bam_rsearch -- + * Search a btree for a record number. + * + * PUBLIC: int __bam_rsearch __P((DB *, db_recno_t *, u_int32_t, int, int *)); + */ +int +__bam_rsearch(dbp, recnop, flags, stop, exactp) + DB *dbp; + db_recno_t *recnop; + u_int32_t flags; + int stop, *exactp; +{ + BINTERNAL *bi; + BTREE *t; + DB_LOCK lock; + PAGE *h; + RINTERNAL *ri; + db_indx_t indx, top; + db_pgno_t pg; + db_recno_t i, recno, total; + int isappend, ret, stack; + + t = dbp->internal; + + /* + * We test for groups of flags, S_APPEND is the only one that can be + * OR'd into the set. Clear it now so that the tests for equality + * will work. + */ + if ((isappend = LF_ISSET(S_APPEND)) != 0) + LF_CLR(S_APPEND); + + /* + * There are several ways we search a btree tree. The flags argument + * specifies if we're acquiring read or write locks and if we are + * locking pairs of pages. See btree.h for more details. + * + * If write-locking pages, we need to know whether or not to acquire a + * write lock on a page before getting it. This depends on how deep it + * is in tree, which we don't know until we acquire the root page. So, + * if we need to lock the root page we may have to upgrade it later, + * because we won't get the correct lock initially. + * + * Retrieve the root page. + */ + pg = PGNO_ROOT; + if ((ret = __bam_lget(dbp, 0, PGNO_ROOT, + flags == S_INSERT || flags == S_DELETE ? + DB_LOCK_WRITE : DB_LOCK_READ, &lock)) != 0) + return (ret); + if ((ret = __bam_pget(dbp, &h, &pg, 0)) != 0) { + (void)__BT_LPUT(dbp, lock); + return (ret); + } + total = RE_NREC(h); + + /* + * If appending to the tree, set the record number now -- we have the + * root page locked. + * + * Delete only deletes exact matches, read only returns exact matches. + * Note, this is different from __bam_search(), which returns non-exact + * matches for read. + * + * The record may not exist. We can only return the correct location + * for the record immediately after the last record in the tree, so do + * a fast check now. + */ + if (isappend) { + *exactp = 0; + *recnop = recno = total + 1; + } else { + recno = *recnop; + if (recno <= total) + *exactp = 1; + else { + *exactp = 0; + if (!PAST_END_OK(flags) || recno > total + 1) { + (void)memp_fput(dbp->mpf, h, 0); + (void)__BT_LPUT(dbp, lock); + return (DB_NOTFOUND); + } + } + } + + /* Decide if we're building a stack based on the operation. */ + BT_STK_CLR(t); + stack = flags == S_DELETE || flags == S_INSERT; + + /* + * Decide if we need to save this page; if we do, write lock it, and + * start to build a stack. + */ + if (LF_ISSET(S_PARENT) && (u_int8_t)(stop + 1) >= h->level) { + (void)memp_fput(dbp->mpf, h, 0); + if ((ret = __bam_lget(dbp, 1, pg, DB_LOCK_WRITE, &lock)) != 0) + return (ret); + if ((ret = __bam_pget(dbp, &h, &pg, 0)) != 0) { + (void)__BT_LPUT(dbp, lock); + return (ret); + } + stack = 1; + } + + /* + * !!! + * Record numbers in the tree are 0-based, but the recno is + * 1-based. All of the calculations below have to take this + * into account. + */ + for (total = 0;;) { + switch (TYPE(h)) { + case P_LBTREE: + recno -= total; + + /* + * There may be logically deleted records on the page, + * walk the page correcting for them. The record may + * not exist if there are enough deleted records in the + * page. + */ + if (recno <= NUM_ENT(h)) + for (i = recno - 1;; --i) { + if (B_DISSET(GET_BKEYDATA(h, + i * P_INDX + O_INDX)->type)) + ++recno; + if (i == 0) + break; + } + if (recno > NUM_ENT(h)) { + *exactp = 0; + if (!PAST_END_OK(flags) || + recno > (db_recno_t)(NUM_ENT(h) + 1)) { + ret = DB_NOTFOUND; + goto err; + } + + } + + /* Correct from 1-based to 0-based for a page offset. */ + --recno; + BT_STK_ENTER(t, h, recno * P_INDX, lock, ret); + return (ret); + case P_IBTREE: + for (indx = 0, top = NUM_ENT(h);;) { + bi = GET_BINTERNAL(h, indx); + if (++indx == top || total + bi->nrecs >= recno) + break; + total += bi->nrecs; + } + pg = bi->pgno; + break; + case P_LRECNO: + recno -= total; + + /* Correct from 1-based to 0-based for a page offset. */ + --recno; + BT_STK_ENTER(t, h, recno, lock, ret); + return (ret); + case P_IRECNO: + for (indx = 0, top = NUM_ENT(h);;) { + ri = GET_RINTERNAL(h, indx); + if (++indx == top || total + ri->nrecs >= recno) + break; + total += ri->nrecs; + } + pg = ri->pgno; + break; + default: + return (__db_pgfmt(dbp, h->pgno)); + } + --indx; + + if (stack) { + /* Return if this is the lowest page wanted. */ + if (LF_ISSET(S_PARENT) && stop == h->level) { + BT_STK_ENTER(t, h, indx, lock, ret); + return (ret); + } + BT_STK_PUSH(t, h, indx, lock, ret); + if (ret) + goto err; + + if ((ret = __bam_lget(dbp, 0, pg, + LF_ISSET(S_WRITE) ? DB_LOCK_WRITE : DB_LOCK_READ, + &lock)) != 0) + goto err; + } else { + (void)memp_fput(dbp->mpf, h, 0); + + /* + * Decide if we want to return a pointer to the next + * page in the stack. If we do, write lock it and + * never unlock it. + */ + if (LF_ISSET(S_PARENT) && + (u_int8_t)(stop + 1) >= (u_int8_t)(h->level - 1)) + stack = 1; + + if ((ret = __bam_lget(dbp, 1, pg, + LF_ISSET(S_WRITE) ? DB_LOCK_WRITE : DB_LOCK_READ, + &lock)) != 0) + goto err; + } + + if ((ret = __bam_pget(dbp, &h, &pg, 0)) != 0) + goto err; + } + /* NOTREACHED */ + +err: BT_STK_POP(t); + __bam_stkrel(dbp); + return (ret); +} + +/* + * __bam_adjust -- + * Adjust the tree after adding or deleting a record. + * + * PUBLIC: int __bam_adjust __P((DB *, BTREE *, int32_t)); + */ +int +__bam_adjust(dbp, t, adjust) + DB *dbp; + BTREE *t; + int32_t adjust; +{ + EPG *epg; + PAGE *h; + int ret; + + /* Update the record counts for the tree. */ + for (epg = t->bt_sp; epg <= t->bt_csp; ++epg) { + h = epg->page; + if (TYPE(h) == P_IBTREE || TYPE(h) == P_IRECNO) { + if (DB_LOGGING(dbp) && + (ret = __bam_cadjust_log(dbp->dbenv->lg_info, + dbp->txn, &LSN(h), 0, dbp->log_fileid, + PGNO(h), &LSN(h), (u_int32_t)epg->indx, + adjust, 1)) != 0) + return (ret); + + if (TYPE(h) == P_IBTREE) + GET_BINTERNAL(h, epg->indx)->nrecs += adjust; + else + GET_RINTERNAL(h, epg->indx)->nrecs += adjust; + + if (PGNO(h) == PGNO_ROOT) + RE_NREC_ADJ(h, adjust); + + if ((ret = memp_fset(dbp->mpf, h, DB_MPOOL_DIRTY)) != 0) + return (ret); + } + } + return (0); +} + +/* + * __bam_nrecs -- + * Return the number of records in the tree. + * + * PUBLIC: int __bam_nrecs __P((DB *, db_recno_t *)); + */ +int +__bam_nrecs(dbp, rep) + DB *dbp; + db_recno_t *rep; +{ + DB_LOCK lock; + PAGE *h; + db_pgno_t pgno; + int ret; + + pgno = PGNO_ROOT; + if ((ret = __bam_lget(dbp, 0, pgno, DB_LOCK_READ, &lock)) != 0) + return (ret); + if ((ret = __bam_pget(dbp, &h, &pgno, 0)) != 0) + return (ret); + + *rep = RE_NREC(h); + + (void)memp_fput(dbp->mpf, h, 0); + (void)__BT_TLPUT(dbp, lock); + + return (0); +} + +/* + * __bam_total -- + * Return the number of records below a page. + * + * PUBLIC: db_recno_t __bam_total __P((PAGE *)); + */ +db_recno_t +__bam_total(h) + PAGE *h; +{ + db_recno_t nrecs; + db_indx_t indx, top; + + nrecs = 0; + top = NUM_ENT(h); + + switch (TYPE(h)) { + case P_LBTREE: + /* Check for logically deleted records. */ + for (indx = 0; indx < top; indx += P_INDX) + if (!B_DISSET(GET_BKEYDATA(h, indx + O_INDX)->type)) + ++nrecs; + break; + case P_IBTREE: + for (indx = 0; indx < top; indx += O_INDX) + nrecs += GET_BINTERNAL(h, indx)->nrecs; + break; + case P_LRECNO: + nrecs = NUM_ENT(h); + break; + case P_IRECNO: + for (indx = 0; indx < top; indx += O_INDX) + nrecs += GET_RINTERNAL(h, indx)->nrecs; + break; + } + + return (nrecs); +} diff --git a/mozilla/db/btree/bt_search.c b/mozilla/db/btree/bt_search.c new file mode 100644 index 00000000000..09ce46d90ac --- /dev/null +++ b/mozilla/db/btree/bt_search.c @@ -0,0 +1,351 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * 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. 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)bt_search.c 10.15 (Sleepycat) 5/6/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "btree.h" + +/* + * __bam_search -- + * Search a btree for a key. + * + * PUBLIC: int __bam_search __P((DB *, + * PUBLIC: const DBT *, u_int32_t, int, db_recno_t *, int *)); + */ +int +__bam_search(dbp, key, flags, stop, recnop, exactp) + DB *dbp; + const DBT *key; + u_int32_t flags; + int stop, *exactp; + db_recno_t *recnop; +{ + BTREE *t; + DB_LOCK lock; + EPG cur; + PAGE *h; + db_indx_t base, i, indx, lim; + db_pgno_t pg; + db_recno_t recno; + int cmp, jump, ret, stack; + + t = dbp->internal; + recno = 0; + + BT_STK_CLR(t); + + /* + * There are several ways we search a btree tree. The flags argument + * specifies if we're acquiring read or write locks, if we position + * to the first or last item in a set of duplicates, if we return + * deleted items, and if we are locking pairs of pages. See btree.h + * for more details. In addition, if we're doing record numbers, we + * have to lock the entire tree regardless. + * + * If write-locking pages, we need to know whether or not to acquire a + * write lock on a page before getting it. This depends on how deep it + * is in tree, which we don't know until we acquire the root page. So, + * if we need to lock the root page we may have to upgrade it later, + * because we won't get the correct lock initially. + * + * Retrieve the root page. + */ + pg = PGNO_ROOT; + stack = F_ISSET(dbp, DB_BT_RECNUM) && LF_ISSET(S_STACK); + if ((ret = __bam_lget(dbp, + 0, pg, stack ? DB_LOCK_WRITE : DB_LOCK_READ, &lock)) != 0) + return (ret); + if ((ret = __bam_pget(dbp, &h, &pg, 0)) != 0) { + (void)__BT_LPUT(dbp, lock); + return (ret); + } + + /* + * Decide if we need to save this page; if we do, write lock it. + * We deliberately don't lock-couple on this call. If the tree + * is tiny, i.e., one page, and two threads are busily updating + * the root page, we're almost guaranteed deadlocks galore, as + * each one gets a read lock and then blocks the other's attempt + * for a write lock. + */ + if (!stack && + ((LF_ISSET(S_PARENT) && (u_int8_t)(stop + 1) >= h->level) || + (LF_ISSET(S_WRITE) && h->level == LEAFLEVEL))) { + (void)memp_fput(dbp->mpf, h, 0); + (void)__BT_LPUT(dbp, lock); + if ((ret = __bam_lget(dbp, 0, pg, DB_LOCK_WRITE, &lock)) != 0) + return (ret); + if ((ret = __bam_pget(dbp, &h, &pg, 0)) != 0) { + (void)__BT_LPUT(dbp, lock); + return (ret); + } + + stack = 1; + } + + for (;;) { + /* + * Do a binary search on the current page. If we're searching + * a leaf page, we have to manipulate the indices in groups of + * two. If we're searching an internal page, they're an index + * per page item. If we find an exact match on a leaf page, + * we're done. + */ + cur.page = h; + jump = TYPE(h) == P_LBTREE ? P_INDX : O_INDX; + for (base = 0, + lim = NUM_ENT(h) / (db_indx_t)jump; lim != 0; lim >>= 1) { + cur.indx = indx = base + ((lim >> 1) * jump); + if ((cmp = __bam_cmp(dbp, key, &cur)) == 0) { + if (TYPE(h) == P_LBTREE) + goto match; + goto next; + } + if (cmp > 0) { + base = indx + jump; + --lim; + } + } + + /* + * No match found. Base is the smallest index greater than + * key and may be zero or a last + O_INDX index. + * + * If it's a leaf page, return base as the "found" value. + * Delete only deletes exact matches. + */ + if (TYPE(h) == P_LBTREE) { + *exactp = 0; + + if (LF_ISSET(S_EXACT)) + goto notfound; + + /* + * !!! + * Possibly returning a deleted record -- DB_SET_RANGE, + * DB_KEYFIRST and DB_KEYLAST don't require an exact + * match, and we don't want to walk multiple pages here + * to find an undeleted record. This is handled in the + * __bam_c_search() routine. + */ + BT_STK_ENTER(t, h, base, lock, ret); + return (ret); + } + + /* + * If it's not a leaf page, record the internal page (which is + * a parent page for the key). Decrement the base by 1 if it's + * non-zero so that if a split later occurs, the inserted page + * will be to the right of the saved page. + */ + indx = base > 0 ? base - O_INDX : base; + + /* + * If we're trying to calculate the record number, sum up + * all the record numbers on this page up to the indx point. + */ + if (recnop != NULL) + for (i = 0; i < indx; ++i) + recno += GET_BINTERNAL(h, i)->nrecs; + +next: pg = GET_BINTERNAL(h, indx)->pgno; + if (stack) { + /* Return if this is the lowest page wanted. */ + if (LF_ISSET(S_PARENT) && stop == h->level) { + BT_STK_ENTER(t, h, indx, lock, ret); + return (ret); + } + BT_STK_PUSH(t, h, indx, lock, ret); + if (ret != 0) + goto err; + + if ((ret = + __bam_lget(dbp, 0, pg, DB_LOCK_WRITE, &lock)) != 0) + goto err; + } else { + (void)memp_fput(dbp->mpf, h, 0); + + /* + * Decide if we want to return a pointer to the next + * page in the stack. If we do, write lock it and + * never unlock it. + */ + if ((LF_ISSET(S_PARENT) && + (u_int8_t)(stop + 1) >= (u_int8_t)(h->level - 1)) || + (h->level - 1) == LEAFLEVEL) + stack = 1; + + if ((ret = + __bam_lget(dbp, 1, pg, stack && LF_ISSET(S_WRITE) ? + DB_LOCK_WRITE : DB_LOCK_READ, &lock)) != 0) + goto err; + } + if ((ret = __bam_pget(dbp, &h, &pg, 0)) != 0) + goto err; + } + + /* NOTREACHED */ +match: *exactp = 1; + + /* + * If we're trying to calculate the record number, add in the + * offset on this page and correct for the fact that records + * in the tree are 0-based. + */ + if (recnop != NULL) + *recnop = recno + (indx / P_INDX) + 1; + + /* + * If we got here, we know that we have a btree leaf page. + * + * If there are duplicates, go to the first/last one. This is + * safe because we know that we're not going to leave the page, + * all duplicate sets that are not on overflow pages exist on a + * single leaf page. + */ + if (LF_ISSET(S_DUPLAST)) + while (indx < (db_indx_t)(NUM_ENT(h) - P_INDX) && + h->inp[indx] == h->inp[indx + P_INDX]) + indx += P_INDX; + else + while (indx > 0 && + h->inp[indx] == h->inp[indx - P_INDX]) + indx -= P_INDX; + + /* + * Now check if we are allowed to return deleted items; if not + * find the next (or previous) non-deleted item. + */ + if (LF_ISSET(S_DELNO)) { + if (LF_ISSET(S_DUPLAST)) + while (B_DISSET(GET_BKEYDATA(h, indx + O_INDX)->type) && + indx > 0 && + h->inp[indx] == h->inp[indx - P_INDX]) + indx -= P_INDX; + else + while (B_DISSET(GET_BKEYDATA(h, indx + O_INDX)->type) && + indx < (db_indx_t)(NUM_ENT(h) - P_INDX) && + h->inp[indx] == h->inp[indx + P_INDX]) + indx += P_INDX; + + if (B_DISSET(GET_BKEYDATA(h, indx + O_INDX)->type)) + goto notfound; + } + + BT_STK_ENTER(t, h, indx, lock, ret); + return (ret); + +notfound: + (void)memp_fput(dbp->mpf, h, 0); + (void)__BT_LPUT(dbp, lock); + ret = DB_NOTFOUND; + +err: if (t->bt_csp > t->bt_sp) { + BT_STK_POP(t); + __bam_stkrel(dbp); + } + return (ret); +} + +/* + * __bam_stkrel -- + * Release all pages currently held in the stack. + * + * PUBLIC: int __bam_stkrel __P((DB *)); + */ +int +__bam_stkrel(dbp) + DB *dbp; +{ + BTREE *t; + EPG *epg; + + t = dbp->internal; + for (epg = t->bt_sp; epg <= t->bt_csp; ++epg) { + (void)memp_fput(dbp->mpf, epg->page, 0); + (void)__BT_TLPUT(dbp, epg->lock); + } + return (0); +} + +/* + * __bam_stkgrow -- + * Grow the stack. + * + * PUBLIC: int __bam_stkgrow __P((BTREE *)); + */ +int +__bam_stkgrow(t) + BTREE *t; +{ + EPG *p; + size_t entries; + + entries = t->bt_esp - t->bt_sp; + + if ((p = (EPG *)__db_calloc(entries * 2, sizeof(EPG))) == NULL) + return (ENOMEM); + memcpy(p, t->bt_sp, entries * sizeof(EPG)); + if (t->bt_sp != t->bt_stack) + FREE(t->bt_sp, entries * sizeof(EPG)); + t->bt_sp = p; + t->bt_csp = p + entries; + t->bt_esp = p + entries * 2; + return (0); +} diff --git a/mozilla/db/btree/bt_split.c b/mozilla/db/btree/bt_split.c new file mode 100644 index 00000000000..da9417c781e --- /dev/null +++ b/mozilla/db/btree/bt_split.c @@ -0,0 +1,950 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * 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. + * + * 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)bt_split.c 10.23 (Sleepycat) 5/23/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "btree.h" + +static int __bam_page __P((DB *, EPG *, EPG *)); +static int __bam_pinsert __P((DB *, EPG *, PAGE *, PAGE *)); +static int __bam_psplit __P((DB *, EPG *, PAGE *, PAGE *, int)); +static int __bam_root __P((DB *, EPG *)); + +/* + * __bam_split -- + * Split a page. + * + * PUBLIC: int __bam_split __P((DB *, void *)); + */ +int +__bam_split(dbp, arg) + DB *dbp; + void *arg; +{ + BTREE *t; + enum { UP, DOWN } dir; + int exact, level, ret; + + t = dbp->internal; + + /* + * The locking protocol we use to avoid deadlock to acquire locks by + * walking down the tree, but we do it as lazily as possible, locking + * the root only as a last resort. We expect all stack pages to have + * been discarded before we're called; we discard all short-term locks. + * + * When __bam_split is first called, we know that a leaf page was too + * full for an insert. We don't know what leaf page it was, but we + * have the key/recno that caused the problem. We call XX_search to + * reacquire the leaf page, but this time get both the leaf page and + * its parent, locked. We then split the leaf page and see if the new + * internal key will fit into the parent page. If it will, we're done. + * + * If it won't, we discard our current locks and repeat the process, + * only this time acquiring the parent page and its parent, locked. + * This process repeats until we succeed in the split, splitting the + * root page as the final resort. The entire process then repeats, + * as necessary, until we split a leaf page. + * + * XXX + * A traditional method of speeding this up is to maintain a stack of + * the pages traversed in the original search. You can detect if the + * stack is correct by storing the page's LSN when it was searched and + * comparing that LSN with the current one when it's locked during the + * split. This would be an easy change for this code, but I have no + * numbers that indicate it's worthwhile. + */ + for (dir = UP, level = LEAFLEVEL;; dir == UP ? ++level : --level) { + /* + * Acquire a page and its parent, locked. + */ + if ((ret = (dbp->type == DB_BTREE ? + __bam_search(dbp, arg, S_WRPAIR, level, NULL, &exact) : + __bam_rsearch(dbp, + (db_recno_t *)arg, S_WRPAIR, level, &exact))) != 0) + return (ret); + + /* Split the page. */ + ret = t->bt_csp[0].page->pgno == PGNO_ROOT ? + __bam_root(dbp, &t->bt_csp[0]) : + __bam_page(dbp, &t->bt_csp[-1], &t->bt_csp[0]); + + switch (ret) { + case 0: + /* Once we've split the leaf page, we're done. */ + if (level == LEAFLEVEL) + return (0); + + /* Switch directions. */ + if (dir == UP) + dir = DOWN; + break; + case DB_NEEDSPLIT: + /* + * It's possible to fail to split repeatedly, as other + * threads may be modifying the tree, or the page usage + * is sufficiently bad that we don't get enough space + * the first time. + */ + if (dir == DOWN) + dir = UP; + break; + default: + return (ret); + } + } + /* NOTREACHED */ +} + +/* + * __bam_root -- + * Split the root page of a btree. + */ +static int +__bam_root(dbp, cp) + DB *dbp; + EPG *cp; +{ + BTREE *t; + PAGE *lp, *rp; + int ret; + + t = dbp->internal; + + /* Yeah, right. */ + if (cp->page->level >= MAXBTREELEVEL) { + ret = ENOSPC; + goto err; + } + + /* Create new left and right pages for the split. */ + lp = rp = NULL; + if ((ret = __bam_new(dbp, TYPE(cp->page), &lp)) != 0 || + (ret = __bam_new(dbp, TYPE(cp->page), &rp)) != 0) + goto err; + P_INIT(lp, dbp->pgsize, lp->pgno, + PGNO_INVALID, ISINTERNAL(cp->page) ? PGNO_INVALID : rp->pgno, + cp->page->level, TYPE(cp->page)); + P_INIT(rp, dbp->pgsize, rp->pgno, + ISINTERNAL(cp->page) ? PGNO_INVALID : lp->pgno, PGNO_INVALID, + cp->page->level, TYPE(cp->page)); + + /* Split the page. */ + if ((ret = __bam_psplit(dbp, cp, lp, rp, 1)) != 0) + goto err; + + /* Log the change. */ + if (DB_LOGGING(dbp)) { + DBT __a; + DB_LSN __lsn; + memset(&__a, 0, sizeof(__a)); + __a.data = cp->page; + __a.size = dbp->pgsize; + ZERO_LSN(__lsn); + if ((ret = __bam_split_log(dbp->dbenv->lg_info, dbp->txn, + &LSN(cp->page), 0, dbp->log_fileid, PGNO(lp), &LSN(lp), + PGNO(rp), &LSN(rp), (u_int32_t)NUM_ENT(lp), 0, &__lsn, + &__a)) != 0) + goto err; + LSN(lp) = LSN(rp) = LSN(cp->page); + } + + /* Clean up the new root page. */ + if ((ret = (dbp->type == DB_RECNO ? + __ram_root(dbp, cp->page, lp, rp) : + __bam_broot(dbp, cp->page, lp, rp))) != 0) + goto err; + + /* Success -- write the real pages back to the store. */ + (void)memp_fput(dbp->mpf, cp->page, DB_MPOOL_DIRTY); + (void)__BT_TLPUT(dbp, cp->lock); + (void)memp_fput(dbp->mpf, lp, DB_MPOOL_DIRTY); + (void)memp_fput(dbp->mpf, rp, DB_MPOOL_DIRTY); + + ++t->lstat.bt_split; + ++t->lstat.bt_rootsplit; + return (0); + +err: if (lp != NULL) + (void)__bam_free(dbp, lp); + if (rp != NULL) + (void)__bam_free(dbp, rp); + (void)memp_fput(dbp->mpf, cp->page, 0); + (void)__BT_TLPUT(dbp, cp->lock); + return (ret); +} + +/* + * __bam_page -- + * Split the non-root page of a btree. + */ +static int +__bam_page(dbp, pp, cp) + DB *dbp; + EPG *pp, *cp; +{ + DB_LOCK tplock; + PAGE *lp, *rp, *tp; + int ret; + + lp = rp = tp = NULL; + ret = -1; + + /* Create new right page for the split. */ + if ((ret = __bam_new(dbp, TYPE(cp->page), &rp)) != 0) + goto err; + P_INIT(rp, dbp->pgsize, rp->pgno, + ISINTERNAL(cp->page) ? PGNO_INVALID : cp->page->pgno, + ISINTERNAL(cp->page) ? PGNO_INVALID : cp->page->next_pgno, + cp->page->level, TYPE(cp->page)); + + /* Create new left page for the split. */ + if ((lp = (PAGE *)__db_malloc(dbp->pgsize)) == NULL) { + ret = ENOMEM; + goto err; + } +#ifdef DIAGNOSTIC + memset(lp, 0xff, dbp->pgsize); +#endif + P_INIT(lp, dbp->pgsize, cp->page->pgno, + ISINTERNAL(cp->page) ? PGNO_INVALID : cp->page->prev_pgno, + ISINTERNAL(cp->page) ? PGNO_INVALID : rp->pgno, + cp->page->level, TYPE(cp->page)); + ZERO_LSN(lp->lsn); + + /* + * Split right. + * + * Only the indices are sorted on the page, i.e., the key/data pairs + * aren't, so it's simpler to copy the data from the split page onto + * two new pages instead of copying half the data to the right page + * and compacting the left page in place. Since the left page can't + * change, we swap the original and the allocated left page after the + * split. + */ + if ((ret = __bam_psplit(dbp, cp, lp, rp, 0)) != 0) + goto err; + + /* + * Fix up the previous pointer of any leaf page following the split + * page. + * + * !!! + * There are interesting deadlock situations here as we write-lock a + * page that's not in our direct ancestry. Consider a cursor walking + * through the leaf pages, that has the previous page read-locked and + * is waiting on a lock for the page we just split. It will deadlock + * here. If this is a problem, we can fail in the split; it's not a + * problem as the split will succeed after the cursor passes through + * the page we're splitting. + */ + if (TYPE(cp->page) == P_LBTREE && rp->next_pgno != PGNO_INVALID) { + if ((ret = __bam_lget(dbp, + 0, rp->next_pgno, DB_LOCK_WRITE, &tplock)) != 0) + goto err; + if ((ret = __bam_pget(dbp, &tp, &rp->next_pgno, 0)) != 0) + goto err; + } + + /* Insert the new pages into the parent page. */ + if ((ret = __bam_pinsert(dbp, pp, lp, rp)) != 0) + goto err; + + /* Log the change. */ + if (DB_LOGGING(dbp)) { + DBT __a; + DB_LSN __lsn; + memset(&__a, 0, sizeof(__a)); + __a.data = cp->page; + __a.size = dbp->pgsize; + if (tp == NULL) + ZERO_LSN(__lsn); + if ((ret = __bam_split_log(dbp->dbenv->lg_info, dbp->txn, + &cp->page->lsn, 0, dbp->log_fileid, PGNO(cp->page), + &LSN(cp->page), PGNO(rp), &LSN(rp), (u_int32_t)NUM_ENT(lp), + tp == NULL ? 0 : PGNO(tp), + tp == NULL ? &__lsn : &LSN(tp), &__a)) != 0) + goto err; + + LSN(lp) = LSN(rp) = LSN(cp->page); + if (tp != NULL) + LSN(tp) = LSN(cp->page); + } + + /* Copy the allocated page into place. */ + memcpy(cp->page, lp, LOFFSET(lp)); + memcpy((u_int8_t *)cp->page + HOFFSET(lp), + (u_int8_t *)lp + HOFFSET(lp), dbp->pgsize - HOFFSET(lp)); + FREE(lp, dbp->pgsize); + lp = NULL; + + /* Finish the next-page link. */ + if (tp != NULL) + tp->prev_pgno = rp->pgno; + + /* Success -- write the real pages back to the store. */ + (void)memp_fput(dbp->mpf, pp->page, DB_MPOOL_DIRTY); + (void)__BT_TLPUT(dbp, pp->lock); + (void)memp_fput(dbp->mpf, cp->page, DB_MPOOL_DIRTY); + (void)__BT_TLPUT(dbp, cp->lock); + (void)memp_fput(dbp->mpf, rp, DB_MPOOL_DIRTY); + if (tp != NULL) { + (void)memp_fput(dbp->mpf, tp, DB_MPOOL_DIRTY); + (void)__BT_TLPUT(dbp, tplock); + } + return (0); + +err: if (lp != NULL) + FREE(lp, dbp->pgsize); + if (rp != NULL) + (void)__bam_free(dbp, rp); + if (tp != NULL) { + (void)memp_fput(dbp->mpf, tp, 0); + (void)__BT_TLPUT(dbp, tplock); + } + (void)memp_fput(dbp->mpf, pp->page, 0); + (void)__BT_TLPUT(dbp, pp->lock); + (void)memp_fput(dbp->mpf, cp->page, 0); + (void)__BT_TLPUT(dbp, cp->lock); + return (ret); +} + +/* + * __bam_broot -- + * Fix up the btree root page after it has been split. + * + * PUBLIC: int __bam_broot __P((DB *, PAGE *, PAGE *, PAGE *)); + */ +int +__bam_broot(dbp, rootp, lp, rp) + DB *dbp; + PAGE *rootp, *lp, *rp; +{ + BINTERNAL bi, *child_bi; + BKEYDATA *child_bk; + DBT hdr, data; + int ret; + + /* + * If the root page was a leaf page, change it into an internal page. + * We copy the key we split on (but not the key's data, in the case of + * a leaf page) to the new root page. + */ + P_INIT(rootp, dbp->pgsize, + PGNO_ROOT, PGNO_INVALID, PGNO_INVALID, lp->level + 1, P_IBTREE); + + memset(&data, 0, sizeof(data)); + memset(&hdr, 0, sizeof(hdr)); + + /* + * The btree comparison code guarantees that the left-most key on any + * level of the tree is never used, so it doesn't need to be filled in. + */ + memset(&bi, 0, sizeof(bi)); + bi.len = 0; + B_TSET(bi.type, B_KEYDATA, 0); + bi.pgno = lp->pgno; + if (F_ISSET(dbp, DB_BT_RECNUM)) { + bi.nrecs = __bam_total(lp); + RE_NREC_SET(rootp, bi.nrecs); + } + hdr.data = &bi; + hdr.size = SSZA(BINTERNAL, data); + if ((ret = + __db_pitem(dbp, rootp, 0, BINTERNAL_SIZE(0), &hdr, NULL)) != 0) + return (ret); + + switch (TYPE(rp)) { + case P_IBTREE: + /* Copy the first key of the child page onto the root page. */ + child_bi = GET_BINTERNAL(rp, 0); + + bi.len = child_bi->len; + B_TSET(bi.type, child_bi->type, 0); + bi.pgno = rp->pgno; + if (F_ISSET(dbp, DB_BT_RECNUM)) { + bi.nrecs = __bam_total(rp); + RE_NREC_ADJ(rootp, bi.nrecs); + } + hdr.data = &bi; + hdr.size = SSZA(BINTERNAL, data); + data.data = child_bi->data; + data.size = child_bi->len; + if ((ret = __db_pitem(dbp, rootp, 1, + BINTERNAL_SIZE(child_bi->len), &hdr, &data)) != 0) + return (ret); + + /* Increment the overflow ref count. */ + if (B_TYPE(child_bi->type) == B_OVERFLOW) + if ((ret = __db_ovref(dbp, + ((BOVERFLOW *)(child_bi->data))->pgno, 1)) != 0) + return (ret); + break; + case P_LBTREE: + /* Copy the first key of the child page onto the root page. */ + child_bk = GET_BKEYDATA(rp, 0); + switch (B_TYPE(child_bk->type)) { + case B_KEYDATA: + bi.len = child_bk->len; + B_TSET(bi.type, child_bk->type, 0); + bi.pgno = rp->pgno; + if (F_ISSET(dbp, DB_BT_RECNUM)) { + bi.nrecs = __bam_total(rp); + RE_NREC_ADJ(rootp, bi.nrecs); + } + hdr.data = &bi; + hdr.size = SSZA(BINTERNAL, data); + data.data = child_bk->data; + data.size = child_bk->len; + if ((ret = __db_pitem(dbp, rootp, 1, + BINTERNAL_SIZE(child_bk->len), &hdr, &data)) != 0) + return (ret); + break; + case B_DUPLICATE: + case B_OVERFLOW: + bi.len = BOVERFLOW_SIZE; + B_TSET(bi.type, child_bk->type, 0); + bi.pgno = rp->pgno; + if (F_ISSET(dbp, DB_BT_RECNUM)) { + bi.nrecs = __bam_total(rp); + RE_NREC_ADJ(rootp, bi.nrecs); + } + hdr.data = &bi; + hdr.size = SSZA(BINTERNAL, data); + data.data = child_bk; + data.size = BOVERFLOW_SIZE; + if ((ret = __db_pitem(dbp, rootp, 1, + BINTERNAL_SIZE(BOVERFLOW_SIZE), &hdr, &data)) != 0) + return (ret); + + /* Increment the overflow ref count. */ + if (B_TYPE(child_bk->type) == B_OVERFLOW) + if ((ret = __db_ovref(dbp, + ((BOVERFLOW *)child_bk)->pgno, 1)) != 0) + return (ret); + break; + default: + return (__db_pgfmt(dbp, rp->pgno)); + } + break; + default: + return (__db_pgfmt(dbp, rp->pgno)); + } + return (0); +} + +/* + * __ram_root -- + * Fix up the recno root page after it has been split. + * + * PUBLIC: int __ram_root __P((DB *, PAGE *, PAGE *, PAGE *)); + */ +int +__ram_root(dbp, rootp, lp, rp) + DB *dbp; + PAGE *rootp, *lp, *rp; +{ + DBT hdr; + RINTERNAL ri; + int ret; + + /* Initialize the page. */ + P_INIT(rootp, dbp->pgsize, + PGNO_ROOT, PGNO_INVALID, PGNO_INVALID, lp->level + 1, P_IRECNO); + + /* Initialize the header. */ + memset(&hdr, 0, sizeof(hdr)); + hdr.data = &ri; + hdr.size = RINTERNAL_SIZE; + + /* Insert the left and right keys, set the header information. */ + ri.pgno = lp->pgno; + ri.nrecs = __bam_total(lp); + if ((ret = __db_pitem(dbp, rootp, 0, RINTERNAL_SIZE, &hdr, NULL)) != 0) + return (ret); + RE_NREC_SET(rootp, ri.nrecs); + ri.pgno = rp->pgno; + ri.nrecs = __bam_total(rp); + if ((ret = __db_pitem(dbp, rootp, 1, RINTERNAL_SIZE, &hdr, NULL)) != 0) + return (ret); + RE_NREC_ADJ(rootp, ri.nrecs); + return (0); +} + +/* + * __bam_pinsert -- + * Insert a new key into a parent page, completing the split. + */ +static int +__bam_pinsert(dbp, parent, lchild, rchild) + DB *dbp; + EPG *parent; + PAGE *lchild, *rchild; +{ + BINTERNAL bi, *child_bi; + BKEYDATA *child_bk, *tmp_bk; + BTREE *t; + DBT a, b, hdr, data; + PAGE *ppage; + RINTERNAL ri; + db_indx_t off; + db_recno_t nrecs; + u_int32_t n, nbytes, nksize; + int ret; + + t = dbp->internal; + ppage = parent->page; + + /* If handling record numbers, count records split to the right page. */ + nrecs = dbp->type == DB_RECNO || F_ISSET(dbp, DB_BT_RECNUM) ? + __bam_total(rchild) : 0; + + /* + * Now we insert the new page's first key into the parent page, which + * completes the split. The parent points to a PAGE and a page index + * offset, where the new key goes ONE AFTER the index, because we split + * to the right. + * + * XXX + * Some btree algorithms replace the key for the old page as well as + * the new page. We don't, as there's no reason to believe that the + * first key on the old page is any better than the key we have, and, + * in the case of a key being placed at index 0 causing the split, the + * key is unavailable. + */ + off = parent->indx + O_INDX; + + /* + * Calculate the space needed on the parent page. + * + * Prefix trees: space hack used when inserting into BINTERNAL pages. + * Retain only what's needed to distinguish between the new entry and + * the LAST entry on the page to its left. If the keys compare equal, + * retain the entire key. We ignore overflow keys, and the entire key + * must be retained for the next-to-leftmost key on the leftmost page + * of each level, or the search will fail. Applicable ONLY to internal + * pages that have leaf pages as children. Further reduction of the + * key between pairs of internal pages loses too much information. + */ + switch (TYPE(rchild)) { + case P_IBTREE: + child_bi = GET_BINTERNAL(rchild, 0); + nbytes = BINTERNAL_PSIZE(child_bi->len); + + if (P_FREESPACE(ppage) < nbytes) + return (DB_NEEDSPLIT); + + /* Add a new record for the right page. */ + memset(&bi, 0, sizeof(bi)); + bi.len = child_bi->len; + B_TSET(bi.type, child_bi->type, 0); + bi.pgno = rchild->pgno; + bi.nrecs = nrecs; + memset(&hdr, 0, sizeof(hdr)); + hdr.data = &bi; + hdr.size = SSZA(BINTERNAL, data); + memset(&data, 0, sizeof(data)); + data.data = child_bi->data; + data.size = child_bi->len; + if ((ret = __db_pitem(dbp, ppage, off, + BINTERNAL_SIZE(child_bi->len), &hdr, &data)) != 0) + return (ret); + + /* Increment the overflow ref count. */ + if (B_TYPE(child_bi->type) == B_OVERFLOW) + if ((ret = __db_ovref(dbp, + ((BOVERFLOW *)(child_bi->data))->pgno, 1)) != 0) + return (ret); + break; + case P_LBTREE: + child_bk = GET_BKEYDATA(rchild, 0); + switch (B_TYPE(child_bk->type)) { + case B_KEYDATA: + nbytes = BINTERNAL_PSIZE(child_bk->len); + nksize = child_bk->len; + if (t->bt_prefix == NULL) + goto noprefix; + if (ppage->prev_pgno == PGNO_INVALID && off <= 1) + goto noprefix; + tmp_bk = GET_BKEYDATA(lchild, NUM_ENT(lchild) - P_INDX); + if (B_TYPE(tmp_bk->type) != B_KEYDATA) + goto noprefix; + memset(&a, 0, sizeof(a)); + a.size = tmp_bk->len; + a.data = tmp_bk->data; + memset(&b, 0, sizeof(b)); + b.size = child_bk->len; + b.data = child_bk->data; + nksize = t->bt_prefix(&a, &b); + if ((n = BINTERNAL_PSIZE(nksize)) < nbytes) { + t->lstat.bt_pfxsaved += nbytes - n; + nbytes = n; + } else +noprefix: nksize = child_bk->len; + + if (P_FREESPACE(ppage) < nbytes) + return (DB_NEEDSPLIT); + + memset(&bi, 0, sizeof(bi)); + bi.len = nksize; + B_TSET(bi.type, child_bk->type, 0); + bi.pgno = rchild->pgno; + bi.nrecs = nrecs; + memset(&hdr, 0, sizeof(hdr)); + hdr.data = &bi; + hdr.size = SSZA(BINTERNAL, data); + memset(&data, 0, sizeof(data)); + data.data = child_bk->data; + data.size = nksize; + if ((ret = __db_pitem(dbp, ppage, off, + BINTERNAL_SIZE(nksize), &hdr, &data)) != 0) + return (ret); + break; + case B_DUPLICATE: + case B_OVERFLOW: + nbytes = BINTERNAL_PSIZE(BOVERFLOW_SIZE); + + if (P_FREESPACE(ppage) < nbytes) + return (DB_NEEDSPLIT); + + memset(&bi, 0, sizeof(bi)); + bi.len = BOVERFLOW_SIZE; + B_TSET(bi.type, child_bk->type, 0); + bi.pgno = rchild->pgno; + bi.nrecs = nrecs; + memset(&hdr, 0, sizeof(hdr)); + hdr.data = &bi; + hdr.size = SSZA(BINTERNAL, data); + memset(&data, 0, sizeof(data)); + data.data = child_bk; + data.size = BOVERFLOW_SIZE; + if ((ret = __db_pitem(dbp, ppage, off, + BINTERNAL_SIZE(BOVERFLOW_SIZE), &hdr, &data)) != 0) + return (ret); + + /* Increment the overflow ref count. */ + if (B_TYPE(child_bk->type) == B_OVERFLOW) + if ((ret = __db_ovref(dbp, + ((BOVERFLOW *)child_bk)->pgno, 1)) != 0) + return (ret); + break; + default: + return (__db_pgfmt(dbp, rchild->pgno)); + } + break; + case P_IRECNO: + case P_LRECNO: + nbytes = RINTERNAL_PSIZE; + + if (P_FREESPACE(ppage) < nbytes) + return (DB_NEEDSPLIT); + + /* Add a new record for the right page. */ + memset(&hdr, 0, sizeof(hdr)); + hdr.data = &ri; + hdr.size = RINTERNAL_SIZE; + ri.pgno = rchild->pgno; + ri.nrecs = nrecs; + if ((ret = __db_pitem(dbp, + ppage, off, RINTERNAL_SIZE, &hdr, NULL)) != 0) + return (ret); + break; + default: + return (__db_pgfmt(dbp, rchild->pgno)); + } + + /* Adjust the parent page's left page record count. */ + if (dbp->type == DB_RECNO || F_ISSET(dbp, DB_BT_RECNUM)) { + /* Log the change. */ + if (DB_LOGGING(dbp) && + (ret = __bam_cadjust_log(dbp->dbenv->lg_info, + dbp->txn, &LSN(ppage), 0, dbp->log_fileid, + PGNO(ppage), &LSN(ppage), (u_int32_t)parent->indx, + -(int32_t)nrecs, (int32_t)0)) != 0) + return (ret); + + /* Update the left page count. */ + if (dbp->type == DB_RECNO) + GET_RINTERNAL(ppage, parent->indx)->nrecs -= nrecs; + else + GET_BINTERNAL(ppage, parent->indx)->nrecs -= nrecs; + } + + return (0); +} + +/* + * __bam_psplit -- + * Do the real work of splitting the page. + */ +static int +__bam_psplit(dbp, cp, lp, rp, cleft) + DB *dbp; + EPG *cp; + PAGE *lp, *rp; + int cleft; +{ + BTREE *t; + PAGE *pp; + db_indx_t half, nbytes, off, splitp, top; + int adjust, cnt, isbigkey, ret; + + t = dbp->internal; + pp = cp->page; + adjust = TYPE(pp) == P_LBTREE ? P_INDX : O_INDX; + + /* + * If we're splitting the first (last) page on a level because we're + * inserting (appending) a key to it, it's likely that the data is + * sorted. Moving a single item to the new page is less work and can + * push the fill factor higher than normal. If we're wrong it's not + * a big deal, we'll just do the split the right way next time. + */ + off = 0; + if (NEXT_PGNO(pp) == PGNO_INVALID && + ((ISINTERNAL(pp) && cp->indx == NUM_ENT(cp->page) - 1) || + (!ISINTERNAL(pp) && cp->indx == NUM_ENT(cp->page)))) + off = NUM_ENT(cp->page) - adjust; + else if (PREV_PGNO(pp) == PGNO_INVALID && cp->indx == 0) + off = adjust; + + ++t->lstat.bt_split; + if (off != 0) { + ++t->lstat.bt_fastsplit; + goto sort; + } + + /* + * Split the data to the left and right pages. Try not to split on + * an overflow key. (Overflow keys on internal pages will slow down + * searches.) Refuse to split in the middle of a set of duplicates. + * + * First, find the optimum place to split. + * + * It's possible to try and split past the last record on the page if + * there's a very large record at the end of the page. Make sure this + * doesn't happen by bounding the check at the next-to-last entry on + * the page. + * + * Note, we try and split half the data present on the page. This is + * because another process may have already split the page and left + * it half empty. We don't try and skip the split -- we don't know + * how much space we're going to need on the page, and we may need up + * to half the page for a big item, so there's no easy test to decide + * if we need to split or not. Besides, if two threads are inserting + * data into the same place in the database, we're probably going to + * need more space soon anyway. + */ + top = NUM_ENT(pp) - adjust; + half = (dbp->pgsize - HOFFSET(pp)) / 2; + for (nbytes = 0, off = 0; off < top && nbytes < half; ++off) + switch (TYPE(pp)) { + case P_IBTREE: + if (B_TYPE(GET_BINTERNAL(pp, off)->type) == B_KEYDATA) + nbytes += + BINTERNAL_SIZE(GET_BINTERNAL(pp, off)->len); + else + nbytes += BINTERNAL_SIZE(BOVERFLOW_SIZE); + break; + case P_LBTREE: + if (B_TYPE(GET_BKEYDATA(pp, off)->type) == B_KEYDATA) + nbytes += + BKEYDATA_SIZE(GET_BKEYDATA(pp, off)->len); + else + nbytes += BOVERFLOW_SIZE; + + ++off; + if (B_TYPE(GET_BKEYDATA(pp, off)->type) == B_KEYDATA) + nbytes += + BKEYDATA_SIZE(GET_BKEYDATA(pp, off)->len); + else + nbytes += BOVERFLOW_SIZE; + break; + case P_IRECNO: + nbytes += RINTERNAL_SIZE; + break; + case P_LRECNO: + nbytes += BKEYDATA_SIZE(GET_BKEYDATA(pp, off)->len); + break; + default: + return (__db_pgfmt(dbp, pp->pgno)); + } +sort: splitp = off; + + /* + * Splitp is either at or just past the optimum split point. If + * it's a big key, try and find something close by that's not. + */ + if (TYPE(pp) == P_IBTREE) + isbigkey = B_TYPE(GET_BINTERNAL(pp, off)->type) != B_KEYDATA; + else if (TYPE(pp) == P_LBTREE) + isbigkey = B_TYPE(GET_BKEYDATA(pp, off)->type) != B_KEYDATA; + else + isbigkey = 0; + if (isbigkey) + for (cnt = 1; cnt <= 3; ++cnt) { + off = splitp + cnt * adjust; + if (off < (db_indx_t)NUM_ENT(pp) && + ((TYPE(pp) == P_IBTREE && + B_TYPE(GET_BINTERNAL(pp,off)->type) == B_KEYDATA) || + B_TYPE(GET_BKEYDATA(pp, off)->type) == B_KEYDATA)) { + splitp = off; + break; + } + if (splitp <= (db_indx_t)(cnt * adjust)) + continue; + off = splitp - cnt * adjust; + if (TYPE(pp) == P_IBTREE ? + B_TYPE(GET_BINTERNAL(pp, off)->type) == B_KEYDATA : + B_TYPE(GET_BKEYDATA(pp, off)->type) == B_KEYDATA) { + splitp = off; + break; + } + } + + /* + * We can't split in the middle a set of duplicates. We know that + * no duplicate set can take up more than about 25% of the page, + * because that's the point where we push it off onto a duplicate + * page set. So, this loop can't be unbounded. + */ + if (F_ISSET(dbp, DB_AM_DUP) && TYPE(pp) == P_LBTREE && + pp->inp[splitp] == pp->inp[splitp - adjust]) + for (cnt = 1;; ++cnt) { + off = splitp + cnt * adjust; + if (off < NUM_ENT(pp) && + pp->inp[splitp] != pp->inp[off]) { + splitp = off; + break; + } + if (splitp <= (db_indx_t)(cnt * adjust)) + continue; + off = splitp - cnt * adjust; + if (pp->inp[splitp] != pp->inp[off]) { + splitp = off + adjust; + break; + } + } + + + /* We're going to split at splitp. */ + if ((ret = __bam_copy(dbp, pp, lp, 0, splitp)) != 0) + return (ret); + if ((ret = __bam_copy(dbp, pp, rp, splitp, NUM_ENT(pp))) != 0) + return (ret); + + /* Adjust the cursors. */ + __bam_ca_split(dbp, pp->pgno, lp->pgno, rp->pgno, splitp, cleft); + return (0); +} + +/* + * __bam_copy -- + * Copy a set of records from one page to another. + * + * PUBLIC: int __bam_copy __P((DB *, PAGE *, PAGE *, u_int32_t, u_int32_t)); + */ +int +__bam_copy(dbp, pp, cp, nxt, stop) + DB *dbp; + PAGE *pp, *cp; + u_int32_t nxt, stop; +{ + db_indx_t nbytes, off; + + /* + * Copy the rest of the data to the right page. Nxt is the next + * offset placed on the target page. + */ + for (off = 0; nxt < stop; ++nxt, ++NUM_ENT(cp), ++off) { + switch (TYPE(pp)) { + case P_IBTREE: + if (B_TYPE(GET_BINTERNAL(pp, nxt)->type) == B_KEYDATA) + nbytes = + BINTERNAL_SIZE(GET_BINTERNAL(pp, nxt)->len); + else + nbytes = BINTERNAL_SIZE(BOVERFLOW_SIZE); + break; + case P_LBTREE: + /* + * If we're on a key and it's a duplicate, just copy + * the offset. + */ + if (off != 0 && (nxt % P_INDX) == 0 && + pp->inp[nxt] == pp->inp[nxt - P_INDX]) { + cp->inp[off] = cp->inp[off - P_INDX]; + continue; + } + /* FALLTHROUGH */ + case P_LRECNO: + if (B_TYPE(GET_BKEYDATA(pp, nxt)->type) == B_KEYDATA) + nbytes = + BKEYDATA_SIZE(GET_BKEYDATA(pp, nxt)->len); + else + nbytes = BOVERFLOW_SIZE; + break; + case P_IRECNO: + nbytes = RINTERNAL_SIZE; + break; + default: + return (__db_pgfmt(dbp, pp->pgno)); + } + cp->inp[off] = HOFFSET(cp) -= nbytes; + memcpy(P_ENTRY(cp, off), P_ENTRY(pp, nxt), nbytes); + } + return (0); +} diff --git a/mozilla/db/btree/bt_stat.c b/mozilla/db/btree/bt_stat.c new file mode 100644 index 00000000000..2236434b384 --- /dev/null +++ b/mozilla/db/btree/bt_stat.c @@ -0,0 +1,254 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)bt_stat.c 10.17 (Sleepycat) 4/26/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "btree.h" + +static void __bam_add_rstat __P((DB_BTREE_LSTAT *, DB_BTREE_STAT *)); + +/* + * __bam_stat -- + * Gather/print the btree statistics + * + * PUBLIC: int __bam_stat __P((DB *, void *, void *(*)(size_t), u_int32_t)); + */ +int +__bam_stat(argdbp, spp, db_malloc, flags) + DB *argdbp; + void *spp; + void *(*db_malloc) __P((size_t)); + u_int32_t flags; +{ + BTMETA *meta; + BTREE *t; + DB *dbp; + DB_BTREE_STAT *sp; + DB_LOCK lock; + PAGE *h; + db_pgno_t lastpgno, pgno; + int ret; + + DEBUG_LWRITE(argdbp, NULL, "bam_stat", NULL, NULL, flags); + + /* Check for invalid flags. */ + if ((ret = __db_statchk(argdbp, flags)) != 0) + return (ret); + + if (spp == NULL) + return (0); + + GETHANDLE(argdbp, NULL, &dbp, ret); + t = dbp->internal; + + /* Allocate and clear the structure. */ + if ((sp = db_malloc == NULL ? + (DB_BTREE_STAT *)__db_malloc(sizeof(*sp)) : + (DB_BTREE_STAT *)db_malloc(sizeof(*sp))) == NULL) { + ret = ENOMEM; + goto err; + } + memset(sp, 0, sizeof(*sp)); + + /* If the app just wants the record count, make it fast. */ + if (LF_ISSET(DB_RECORDCOUNT)) { + pgno = PGNO_ROOT; + if ((ret = __bam_lget(dbp, 0, pgno, DB_LOCK_READ, &lock)) != 0) + goto err; + if ((ret = __bam_pget(dbp, (PAGE **)&h, &pgno, 0)) != 0) + goto err; + + sp->bt_nrecs = RE_NREC(h); + + (void)memp_fput(dbp->mpf, h, 0); + (void)__BT_LPUT(dbp, lock); + goto done; + } + + /* Get the meta-data page. */ + pgno = PGNO_METADATA; + if ((ret = __bam_lget(dbp, 0, pgno, DB_LOCK_READ, &lock)) != 0) + goto err; + if ((ret = __bam_pget(dbp, (PAGE **)&meta, &pgno, 0)) != 0) + goto err; + + /* Translate the metadata flags. */ + if (F_ISSET(meta, BTM_DUP)) + sp->bt_flags |= DB_DUP; + if (F_ISSET(meta, BTM_FIXEDLEN)) + sp->bt_flags |= DB_FIXEDLEN; + if (F_ISSET(meta, BTM_RECNUM)) + sp->bt_flags |= DB_RECNUM; + if (F_ISSET(meta, BTM_RENUMBER)) + sp->bt_flags |= DB_RENUMBER; + + /* Get the remaining metadata fields. */ + sp->bt_minkey = meta->minkey; + sp->bt_maxkey = meta->maxkey; + sp->bt_re_len = meta->re_len; + sp->bt_re_pad = meta->re_pad; + sp->bt_magic = meta->magic; + sp->bt_version = meta->version; + + /* Get the page size from the DB. */ + sp->bt_pagesize = dbp->pgsize; + + /* Initialize counters with the meta-data page information. */ + __bam_add_rstat(&meta->stat, sp); + + /* + * Add in the local information from this handle. + * + * !!! + * This is a bit odd, but it gets us closer to the truth. + */ + __bam_add_rstat(&t->lstat, sp); + + /* Walk the free list, counting pages. */ + for (sp->bt_free = 0, pgno = meta->free; pgno != PGNO_INVALID;) { + ++sp->bt_free; + + if ((ret = __bam_pget(dbp, &h, &pgno, 0)) != 0) { + (void)memp_fput(dbp->mpf, meta, 0); + (void)__BT_TLPUT(dbp, lock); + goto err; + } + pgno = h->next_pgno; + (void)memp_fput(dbp->mpf, h, 0); + } + + /* Discard the meta-data page. */ + (void)memp_fput(dbp->mpf, meta, 0); + (void)__BT_TLPUT(dbp, lock); + + /* Determine the last page of the database. */ + if ((ret = memp_fget(dbp->mpf, &lastpgno, DB_MPOOL_LAST, &h)) != 0) + goto err; + (void)memp_fput(dbp->mpf, h, 0); + + /* Get the root page. */ + pgno = PGNO_ROOT; + if ((ret = __bam_lget(dbp, 0, PGNO_ROOT, DB_LOCK_READ, &lock)) != 0) + goto err; + if ((ret = __bam_pget(dbp, &h, &pgno, 0)) != 0) { + (void)__BT_LPUT(dbp, lock); + goto err; + } + + /* Get the levels from the root page. */ + sp->bt_levels = h->level; + + /* Walk the page list, counting things. */ + for (;;) { + switch (TYPE(h)) { + case P_INVALID: + break; + case P_IBTREE: + case P_IRECNO: + ++sp->bt_int_pg; + sp->bt_int_pgfree += HOFFSET(h) - LOFFSET(h); + break; + case P_LBTREE: + ++sp->bt_leaf_pg; + sp->bt_leaf_pgfree += HOFFSET(h) - LOFFSET(h); + sp->bt_nrecs += NUM_ENT(h) / P_INDX; + break; + case P_LRECNO: + ++sp->bt_leaf_pg; + sp->bt_leaf_pgfree += HOFFSET(h) - LOFFSET(h); + sp->bt_nrecs += NUM_ENT(h); + break; + case P_DUPLICATE: + ++sp->bt_dup_pg; + /* XXX MARGO: sp->bt_dup_pgfree; */ + break; + case P_OVERFLOW: + ++sp->bt_over_pg; + /* XXX MARGO: sp->bt_over_pgfree; */ + break; + default: + (void)memp_fput(dbp->mpf, h, 0); + (void)__BT_LPUT(dbp, lock); + return (__db_pgfmt(dbp, pgno)); + } + + (void)memp_fput(dbp->mpf, h, 0); + (void)__BT_LPUT(dbp, lock); + + if (++pgno > lastpgno) + break; + if (__bam_lget(dbp, 0, pgno, DB_LOCK_READ, &lock)) + break; + if (memp_fget(dbp->mpf, &pgno, 0, &h) != 0) { + (void)__BT_LPUT(dbp, lock); + break; + } + } + +done: *(DB_BTREE_STAT **)spp = sp; + ret = 0; + +err: PUTHANDLE(dbp); + return (ret); +} + +/* + * __bam_add_mstat -- + * Add the local statistics to the meta-data page statistics. + * + * PUBLIC: void __bam_add_mstat __P((DB_BTREE_LSTAT *, DB_BTREE_LSTAT *)); + */ +void +__bam_add_mstat(from, to) + DB_BTREE_LSTAT *from; + DB_BTREE_LSTAT *to; +{ + to->bt_freed += from->bt_freed; + to->bt_pfxsaved += from->bt_pfxsaved; + to->bt_split += from->bt_split; + to->bt_rootsplit += from->bt_rootsplit; + to->bt_fastsplit += from->bt_fastsplit; + to->bt_added += from->bt_added; + to->bt_deleted += from->bt_deleted; + to->bt_get += from->bt_get; + to->bt_cache_hit += from->bt_cache_hit; + to->bt_cache_miss += from->bt_cache_miss; +} + +/* + * __bam_add_rstat -- + * Add the local statistics to the returned statistics. + */ +static void +__bam_add_rstat(from, to) + DB_BTREE_LSTAT *from; + DB_BTREE_STAT *to; +{ + to->bt_freed += from->bt_freed; + to->bt_pfxsaved += from->bt_pfxsaved; + to->bt_split += from->bt_split; + to->bt_rootsplit += from->bt_rootsplit; + to->bt_fastsplit += from->bt_fastsplit; + to->bt_added += from->bt_added; + to->bt_deleted += from->bt_deleted; + to->bt_get += from->bt_get; + to->bt_cache_hit += from->bt_cache_hit; + to->bt_cache_miss += from->bt_cache_miss; +} diff --git a/mozilla/db/btree/btree.src b/mozilla/db/btree/btree.src new file mode 100644 index 00000000000..928dce21960 --- /dev/null +++ b/mozilla/db/btree/btree.src @@ -0,0 +1,156 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)btree.src 10.8 (Sleepycat) 4/10/98 + */ + +PREFIX bam + +/* + * BTREE-pg_alloc: used to record allocating a new page. + * + * meta_lsn: the meta-data page's original lsn. + * page_lsn: the allocated page's original lsn. + * pgno: the page allocated. + * next: the next page on the free list. + */ +BEGIN pg_alloc +ARG fileid u_int32_t lu +POINTER meta_lsn DB_LSN * lu +POINTER page_lsn DB_LSN * lu +ARG pgno db_pgno_t lu +ARG ptype u_int32_t lu +ARG next db_pgno_t lu +END + +/* + * BTREE-pg_free: used to record freeing a page. + * + * pgno: the page being freed. + * meta_lsn: the meta-data page's original lsn. + * header: the header from the free'd page. + * next: the previous next pointer on the metadata page. + */ +BEGIN pg_free +ARG fileid u_int32_t lu +ARG pgno db_pgno_t lu +POINTER meta_lsn DB_LSN * lu +DBT header DBT s +ARG next db_pgno_t lu +END + +/* + * BTREE-split: used to log a page split. + * + * left: the page number for the low-order contents. + * llsn: the left page's original LSN. + * right: the page number for the high-order contents. + * rlsn: the right page's original LSN. + * indx: the number of entries that went to the left page. + * npgno: the next page number + * nlsn: the next page's original LSN (or 0 if no next page). + * pg: the split page's contents before the split. + */ +BEGIN split +ARG fileid u_int32_t lu +ARG left db_pgno_t lu +POINTER llsn DB_LSN * lu +ARG right db_pgno_t lu +POINTER rlsn DB_LSN * lu +ARG indx u_int32_t lu +ARG npgno db_pgno_t lu +POINTER nlsn DB_LSN * lu +DBT pg DBT s +END + +/* + * BTREE-rsplit: used to log a reverse-split + * + * pgno: the page number of the page copied over the root. + * pgdbt: the page being copied on the root page. + * nrec: the tree's record count. + * rootent: last entry on the root page. + * rootlsn: the root page's original lsn. + */ +BEGIN rsplit +ARG fileid u_int32_t lu +ARG pgno db_pgno_t lu +DBT pgdbt DBT s +ARG nrec db_pgno_t lu +DBT rootent DBT s +POINTER rootlsn DB_LSN * lu +END + +/* + * BTREE-adj: used to log the adjustment of an index. + * + * pgno: the page modified. + * lsn: the page's original lsn. + * indx: the index adjusted. + * indx_copy: the index to copy if inserting. + * is_insert: 0 if a delete, 1 if an insert. + */ +BEGIN adj +ARG fileid u_int32_t lu +ARG pgno db_pgno_t lu +POINTER lsn DB_LSN * lu +ARG indx u_int32_t lu +ARG indx_copy u_int32_t lu +ARG is_insert u_int32_t lu +END + +/* + * BTREE-cadjust: used to adjust the count change in an internal page. + * + * pgno: the page modified. + * lsn: the page's original lsn. + * indx: the index to be adjusted. + * adjust: the signed adjustment. + * total: if the total tree entries count should be adjusted + */ +BEGIN cadjust +ARG fileid u_int32_t lu +ARG pgno db_pgno_t lu +POINTER lsn DB_LSN * lu +ARG indx u_int32_t lu +ARG adjust int32_t ld +ARG total int32_t ld +END + +/* + * BTREE-cdel: used to log the intent-to-delete of a cursor record. + * + * pgno: the page modified. + * lsn: the page's original lsn. + * indx: the index to be deleted. + */ +BEGIN cdel +ARG fileid u_int32_t lu +ARG pgno db_pgno_t lu +POINTER lsn DB_LSN * lu +ARG indx u_int32_t lu +END + +/* + * BTREE-repl: used to log the replacement of an item. + * + * pgno: the page modified. + * lsn: the page's original lsn. + * orig: the original data. + * new: the replacement data. + * duplicate: the prefix of the replacement that matches the original. + */ +BEGIN repl +ARG fileid u_int32_t lu +ARG pgno db_pgno_t lu +POINTER lsn DB_LSN * lu +ARG indx u_int32_t lu +ARG isdeleted u_int32_t lu +DBT orig DBT s +DBT repl DBT s +ARG prefix u_int32_t lu +ARG suffix u_int32_t lu +END diff --git a/mozilla/db/btree/btree_auto.c b/mozilla/db/btree/btree_auto.c new file mode 100644 index 00000000000..75eadb1d62e --- /dev/null +++ b/mozilla/db/btree/btree_auto.c @@ -0,0 +1,1509 @@ +/* Do not edit: automatically built by dist/db_gen.sh. */ +#include "config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include +#include +#include +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_page.h" +#include "db_dispatch.h" +#include "btree.h" +#include "db_am.h" +/* + * PUBLIC: int __bam_pg_alloc_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, DB_LSN *, DB_LSN *, db_pgno_t, + * PUBLIC: u_int32_t, db_pgno_t)); + */ +int __bam_pg_alloc_log(logp, txnid, ret_lsnp, flags, + fileid, meta_lsn, page_lsn, pgno, ptype, next) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t fileid; + DB_LSN * meta_lsn; + DB_LSN * page_lsn; + db_pgno_t pgno; + u_int32_t ptype; + db_pgno_t next; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_bam_pg_alloc; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(fileid) + + sizeof(*meta_lsn) + + sizeof(*page_lsn) + + sizeof(pgno) + + sizeof(ptype) + + sizeof(next); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + if (meta_lsn != NULL) + memcpy(bp, meta_lsn, sizeof(*meta_lsn)); + else + memset(bp, 0, sizeof(*meta_lsn)); + bp += sizeof(*meta_lsn); + if (page_lsn != NULL) + memcpy(bp, page_lsn, sizeof(*page_lsn)); + else + memset(bp, 0, sizeof(*page_lsn)); + bp += sizeof(*page_lsn); + memcpy(bp, &pgno, sizeof(pgno)); + bp += sizeof(pgno); + memcpy(bp, &ptype, sizeof(ptype)); + bp += sizeof(ptype); + memcpy(bp, &next, sizeof(next)); + bp += sizeof(next); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __bam_pg_alloc_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_pg_alloc_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __bam_pg_alloc_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __bam_pg_alloc_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]bam_pg_alloc: 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); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tmeta_lsn: [%lu][%lu]\n", + (u_long)argp->meta_lsn.file, (u_long)argp->meta_lsn.offset); + printf("\tpage_lsn: [%lu][%lu]\n", + (u_long)argp->page_lsn.file, (u_long)argp->page_lsn.offset); + printf("\tpgno: %lu\n", (u_long)argp->pgno); + printf("\tptype: %lu\n", (u_long)argp->ptype); + printf("\tnext: %lu\n", (u_long)argp->next); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __bam_pg_alloc_read __P((void *, __bam_pg_alloc_args **)); + */ +int +__bam_pg_alloc_read(recbuf, argpp) + void *recbuf; + __bam_pg_alloc_args **argpp; +{ + __bam_pg_alloc_args *argp; + u_int8_t *bp; + + argp = (__bam_pg_alloc_args *)__db_malloc(sizeof(__bam_pg_alloc_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->meta_lsn, bp, sizeof(argp->meta_lsn)); + bp += sizeof(argp->meta_lsn); + memcpy(&argp->page_lsn, bp, sizeof(argp->page_lsn)); + bp += sizeof(argp->page_lsn); + memcpy(&argp->pgno, bp, sizeof(argp->pgno)); + bp += sizeof(argp->pgno); + memcpy(&argp->ptype, bp, sizeof(argp->ptype)); + bp += sizeof(argp->ptype); + memcpy(&argp->next, bp, sizeof(argp->next)); + bp += sizeof(argp->next); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __bam_pg_free_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, const DBT *, + * PUBLIC: db_pgno_t)); + */ +int __bam_pg_free_log(logp, txnid, ret_lsnp, flags, + fileid, pgno, meta_lsn, header, next) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t fileid; + db_pgno_t pgno; + DB_LSN * meta_lsn; + const DBT *header; + db_pgno_t next; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t zero; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_bam_pg_free; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(fileid) + + sizeof(pgno) + + sizeof(*meta_lsn) + + sizeof(u_int32_t) + (header == NULL ? 0 : header->size) + + sizeof(next); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + memcpy(bp, &pgno, sizeof(pgno)); + bp += sizeof(pgno); + if (meta_lsn != NULL) + memcpy(bp, meta_lsn, sizeof(*meta_lsn)); + else + memset(bp, 0, sizeof(*meta_lsn)); + bp += sizeof(*meta_lsn); + if (header == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &header->size, sizeof(header->size)); + bp += sizeof(header->size); + memcpy(bp, header->data, header->size); + bp += header->size; + } + memcpy(bp, &next, sizeof(next)); + bp += sizeof(next); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __bam_pg_free_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_pg_free_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __bam_pg_free_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __bam_pg_free_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]bam_pg_free: 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); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tpgno: %lu\n", (u_long)argp->pgno); + printf("\tmeta_lsn: [%lu][%lu]\n", + (u_long)argp->meta_lsn.file, (u_long)argp->meta_lsn.offset); + printf("\theader: "); + for (i = 0; i < argp->header.size; i++) { + ch = ((u_int8_t *)argp->header.data)[i]; + if (isprint(ch) || ch == 0xa) + putchar(ch); + else + printf("%#x ", ch); + } + printf("\n"); + printf("\tnext: %lu\n", (u_long)argp->next); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __bam_pg_free_read __P((void *, __bam_pg_free_args **)); + */ +int +__bam_pg_free_read(recbuf, argpp) + void *recbuf; + __bam_pg_free_args **argpp; +{ + __bam_pg_free_args *argp; + u_int8_t *bp; + + argp = (__bam_pg_free_args *)__db_malloc(sizeof(__bam_pg_free_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->pgno, bp, sizeof(argp->pgno)); + bp += sizeof(argp->pgno); + memcpy(&argp->meta_lsn, bp, sizeof(argp->meta_lsn)); + bp += sizeof(argp->meta_lsn); + memcpy(&argp->header.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->header.data = bp; + bp += argp->header.size; + memcpy(&argp->next, bp, sizeof(argp->next)); + bp += sizeof(argp->next); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __bam_split_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t, + * PUBLIC: DB_LSN *, u_int32_t, db_pgno_t, DB_LSN *, + * PUBLIC: const DBT *)); + */ +int __bam_split_log(logp, txnid, ret_lsnp, flags, + fileid, left, llsn, right, rlsn, indx, + npgno, nlsn, pg) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_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; + const DBT *pg; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t zero; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_bam_split; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(fileid) + + sizeof(left) + + sizeof(*llsn) + + sizeof(right) + + sizeof(*rlsn) + + sizeof(indx) + + sizeof(npgno) + + sizeof(*nlsn) + + sizeof(u_int32_t) + (pg == NULL ? 0 : pg->size); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + memcpy(bp, &left, sizeof(left)); + bp += sizeof(left); + if (llsn != NULL) + memcpy(bp, llsn, sizeof(*llsn)); + else + memset(bp, 0, sizeof(*llsn)); + bp += sizeof(*llsn); + memcpy(bp, &right, sizeof(right)); + bp += sizeof(right); + if (rlsn != NULL) + memcpy(bp, rlsn, sizeof(*rlsn)); + else + memset(bp, 0, sizeof(*rlsn)); + bp += sizeof(*rlsn); + memcpy(bp, &indx, sizeof(indx)); + bp += sizeof(indx); + memcpy(bp, &npgno, sizeof(npgno)); + bp += sizeof(npgno); + if (nlsn != NULL) + memcpy(bp, nlsn, sizeof(*nlsn)); + else + memset(bp, 0, sizeof(*nlsn)); + bp += sizeof(*nlsn); + if (pg == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &pg->size, sizeof(pg->size)); + bp += sizeof(pg->size); + memcpy(bp, pg->data, pg->size); + bp += pg->size; + } +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __bam_split_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_split_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __bam_split_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __bam_split_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]bam_split: 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); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tleft: %lu\n", (u_long)argp->left); + printf("\tllsn: [%lu][%lu]\n", + (u_long)argp->llsn.file, (u_long)argp->llsn.offset); + printf("\tright: %lu\n", (u_long)argp->right); + printf("\trlsn: [%lu][%lu]\n", + (u_long)argp->rlsn.file, (u_long)argp->rlsn.offset); + printf("\tindx: %lu\n", (u_long)argp->indx); + printf("\tnpgno: %lu\n", (u_long)argp->npgno); + printf("\tnlsn: [%lu][%lu]\n", + (u_long)argp->nlsn.file, (u_long)argp->nlsn.offset); + printf("\tpg: "); + for (i = 0; i < argp->pg.size; i++) { + ch = ((u_int8_t *)argp->pg.data)[i]; + if (isprint(ch) || ch == 0xa) + putchar(ch); + else + printf("%#x ", ch); + } + printf("\n"); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __bam_split_read __P((void *, __bam_split_args **)); + */ +int +__bam_split_read(recbuf, argpp) + void *recbuf; + __bam_split_args **argpp; +{ + __bam_split_args *argp; + u_int8_t *bp; + + argp = (__bam_split_args *)__db_malloc(sizeof(__bam_split_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->left, bp, sizeof(argp->left)); + bp += sizeof(argp->left); + memcpy(&argp->llsn, bp, sizeof(argp->llsn)); + bp += sizeof(argp->llsn); + memcpy(&argp->right, bp, sizeof(argp->right)); + bp += sizeof(argp->right); + memcpy(&argp->rlsn, bp, sizeof(argp->rlsn)); + bp += sizeof(argp->rlsn); + memcpy(&argp->indx, bp, sizeof(argp->indx)); + bp += sizeof(argp->indx); + memcpy(&argp->npgno, bp, sizeof(argp->npgno)); + bp += sizeof(argp->npgno); + memcpy(&argp->nlsn, bp, sizeof(argp->nlsn)); + bp += sizeof(argp->nlsn); + memcpy(&argp->pg.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->pg.data = bp; + bp += argp->pg.size; + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __bam_rsplit_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, db_pgno_t, const DBT *, db_pgno_t, + * PUBLIC: const DBT *, DB_LSN *)); + */ +int __bam_rsplit_log(logp, txnid, ret_lsnp, flags, + fileid, pgno, pgdbt, nrec, rootent, rootlsn) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t fileid; + db_pgno_t pgno; + const DBT *pgdbt; + db_pgno_t nrec; + const DBT *rootent; + DB_LSN * rootlsn; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t zero; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_bam_rsplit; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(fileid) + + sizeof(pgno) + + sizeof(u_int32_t) + (pgdbt == NULL ? 0 : pgdbt->size) + + sizeof(nrec) + + sizeof(u_int32_t) + (rootent == NULL ? 0 : rootent->size) + + sizeof(*rootlsn); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + memcpy(bp, &pgno, sizeof(pgno)); + bp += sizeof(pgno); + if (pgdbt == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &pgdbt->size, sizeof(pgdbt->size)); + bp += sizeof(pgdbt->size); + memcpy(bp, pgdbt->data, pgdbt->size); + bp += pgdbt->size; + } + memcpy(bp, &nrec, sizeof(nrec)); + bp += sizeof(nrec); + if (rootent == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &rootent->size, sizeof(rootent->size)); + bp += sizeof(rootent->size); + memcpy(bp, rootent->data, rootent->size); + bp += rootent->size; + } + if (rootlsn != NULL) + memcpy(bp, rootlsn, sizeof(*rootlsn)); + else + memset(bp, 0, sizeof(*rootlsn)); + bp += sizeof(*rootlsn); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __bam_rsplit_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_rsplit_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __bam_rsplit_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __bam_rsplit_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]bam_rsplit: 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); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tpgno: %lu\n", (u_long)argp->pgno); + printf("\tpgdbt: "); + for (i = 0; i < argp->pgdbt.size; i++) { + ch = ((u_int8_t *)argp->pgdbt.data)[i]; + if (isprint(ch) || ch == 0xa) + putchar(ch); + else + printf("%#x ", ch); + } + printf("\n"); + printf("\tnrec: %lu\n", (u_long)argp->nrec); + printf("\trootent: "); + for (i = 0; i < argp->rootent.size; i++) { + ch = ((u_int8_t *)argp->rootent.data)[i]; + if (isprint(ch) || ch == 0xa) + putchar(ch); + else + printf("%#x ", ch); + } + printf("\n"); + printf("\trootlsn: [%lu][%lu]\n", + (u_long)argp->rootlsn.file, (u_long)argp->rootlsn.offset); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __bam_rsplit_read __P((void *, __bam_rsplit_args **)); + */ +int +__bam_rsplit_read(recbuf, argpp) + void *recbuf; + __bam_rsplit_args **argpp; +{ + __bam_rsplit_args *argp; + u_int8_t *bp; + + argp = (__bam_rsplit_args *)__db_malloc(sizeof(__bam_rsplit_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->pgno, bp, sizeof(argp->pgno)); + bp += sizeof(argp->pgno); + memcpy(&argp->pgdbt.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->pgdbt.data = bp; + bp += argp->pgdbt.size; + memcpy(&argp->nrec, bp, sizeof(argp->nrec)); + bp += sizeof(argp->nrec); + memcpy(&argp->rootent.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->rootent.data = bp; + bp += argp->rootent.size; + memcpy(&argp->rootlsn, bp, sizeof(argp->rootlsn)); + bp += sizeof(argp->rootlsn); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __bam_adj_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, u_int32_t)); + */ +int __bam_adj_log(logp, txnid, ret_lsnp, flags, + fileid, pgno, lsn, indx, indx_copy, is_insert) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t fileid; + db_pgno_t pgno; + DB_LSN * lsn; + u_int32_t indx; + u_int32_t indx_copy; + u_int32_t is_insert; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_bam_adj; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(fileid) + + sizeof(pgno) + + sizeof(*lsn) + + sizeof(indx) + + sizeof(indx_copy) + + sizeof(is_insert); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + memcpy(bp, &pgno, sizeof(pgno)); + bp += sizeof(pgno); + if (lsn != NULL) + memcpy(bp, lsn, sizeof(*lsn)); + else + memset(bp, 0, sizeof(*lsn)); + bp += sizeof(*lsn); + memcpy(bp, &indx, sizeof(indx)); + bp += sizeof(indx); + memcpy(bp, &indx_copy, sizeof(indx_copy)); + bp += sizeof(indx_copy); + memcpy(bp, &is_insert, sizeof(is_insert)); + bp += sizeof(is_insert); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __bam_adj_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_adj_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __bam_adj_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __bam_adj_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]bam_adj: 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); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tpgno: %lu\n", (u_long)argp->pgno); + printf("\tlsn: [%lu][%lu]\n", + (u_long)argp->lsn.file, (u_long)argp->lsn.offset); + printf("\tindx: %lu\n", (u_long)argp->indx); + printf("\tindx_copy: %lu\n", (u_long)argp->indx_copy); + printf("\tis_insert: %lu\n", (u_long)argp->is_insert); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __bam_adj_read __P((void *, __bam_adj_args **)); + */ +int +__bam_adj_read(recbuf, argpp) + void *recbuf; + __bam_adj_args **argpp; +{ + __bam_adj_args *argp; + u_int8_t *bp; + + argp = (__bam_adj_args *)__db_malloc(sizeof(__bam_adj_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->pgno, bp, sizeof(argp->pgno)); + bp += sizeof(argp->pgno); + memcpy(&argp->lsn, bp, sizeof(argp->lsn)); + bp += sizeof(argp->lsn); + memcpy(&argp->indx, bp, sizeof(argp->indx)); + bp += sizeof(argp->indx); + memcpy(&argp->indx_copy, bp, sizeof(argp->indx_copy)); + bp += sizeof(argp->indx_copy); + memcpy(&argp->is_insert, bp, sizeof(argp->is_insert)); + bp += sizeof(argp->is_insert); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __bam_cadjust_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, + * PUBLIC: int32_t, int32_t)); + */ +int __bam_cadjust_log(logp, txnid, ret_lsnp, flags, + fileid, pgno, lsn, indx, adjust, total) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t fileid; + db_pgno_t pgno; + DB_LSN * lsn; + u_int32_t indx; + int32_t adjust; + int32_t total; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_bam_cadjust; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(fileid) + + sizeof(pgno) + + sizeof(*lsn) + + sizeof(indx) + + sizeof(adjust) + + sizeof(total); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + memcpy(bp, &pgno, sizeof(pgno)); + bp += sizeof(pgno); + if (lsn != NULL) + memcpy(bp, lsn, sizeof(*lsn)); + else + memset(bp, 0, sizeof(*lsn)); + bp += sizeof(*lsn); + memcpy(bp, &indx, sizeof(indx)); + bp += sizeof(indx); + memcpy(bp, &adjust, sizeof(adjust)); + bp += sizeof(adjust); + memcpy(bp, &total, sizeof(total)); + bp += sizeof(total); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __bam_cadjust_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_cadjust_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __bam_cadjust_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __bam_cadjust_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]bam_cadjust: 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); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tpgno: %lu\n", (u_long)argp->pgno); + printf("\tlsn: [%lu][%lu]\n", + (u_long)argp->lsn.file, (u_long)argp->lsn.offset); + printf("\tindx: %lu\n", (u_long)argp->indx); + printf("\tadjust: %ld\n", (long)argp->adjust); + printf("\ttotal: %ld\n", (long)argp->total); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __bam_cadjust_read __P((void *, __bam_cadjust_args **)); + */ +int +__bam_cadjust_read(recbuf, argpp) + void *recbuf; + __bam_cadjust_args **argpp; +{ + __bam_cadjust_args *argp; + u_int8_t *bp; + + argp = (__bam_cadjust_args *)__db_malloc(sizeof(__bam_cadjust_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->pgno, bp, sizeof(argp->pgno)); + bp += sizeof(argp->pgno); + memcpy(&argp->lsn, bp, sizeof(argp->lsn)); + bp += sizeof(argp->lsn); + memcpy(&argp->indx, bp, sizeof(argp->indx)); + bp += sizeof(argp->indx); + memcpy(&argp->adjust, bp, sizeof(argp->adjust)); + bp += sizeof(argp->adjust); + memcpy(&argp->total, bp, sizeof(argp->total)); + bp += sizeof(argp->total); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __bam_cdel_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, u_int32_t)); + */ +int __bam_cdel_log(logp, txnid, ret_lsnp, flags, + fileid, pgno, lsn, indx) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t fileid; + db_pgno_t pgno; + DB_LSN * lsn; + u_int32_t indx; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_bam_cdel; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(fileid) + + sizeof(pgno) + + sizeof(*lsn) + + sizeof(indx); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + memcpy(bp, &pgno, sizeof(pgno)); + bp += sizeof(pgno); + if (lsn != NULL) + memcpy(bp, lsn, sizeof(*lsn)); + else + memset(bp, 0, sizeof(*lsn)); + bp += sizeof(*lsn); + memcpy(bp, &indx, sizeof(indx)); + bp += sizeof(indx); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __bam_cdel_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_cdel_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __bam_cdel_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __bam_cdel_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]bam_cdel: 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); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tpgno: %lu\n", (u_long)argp->pgno); + printf("\tlsn: [%lu][%lu]\n", + (u_long)argp->lsn.file, (u_long)argp->lsn.offset); + printf("\tindx: %lu\n", (u_long)argp->indx); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __bam_cdel_read __P((void *, __bam_cdel_args **)); + */ +int +__bam_cdel_read(recbuf, argpp) + void *recbuf; + __bam_cdel_args **argpp; +{ + __bam_cdel_args *argp; + u_int8_t *bp; + + argp = (__bam_cdel_args *)__db_malloc(sizeof(__bam_cdel_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->pgno, bp, sizeof(argp->pgno)); + bp += sizeof(argp->pgno); + memcpy(&argp->lsn, bp, sizeof(argp->lsn)); + bp += sizeof(argp->lsn); + memcpy(&argp->indx, bp, sizeof(argp->indx)); + bp += sizeof(argp->indx); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __bam_repl_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, const DBT *, const DBT *, u_int32_t, + * PUBLIC: u_int32_t)); + */ +int __bam_repl_log(logp, txnid, ret_lsnp, flags, + fileid, pgno, lsn, indx, isdeleted, orig, + repl, prefix, suffix) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t fileid; + db_pgno_t pgno; + DB_LSN * lsn; + u_int32_t indx; + u_int32_t isdeleted; + const DBT *orig; + const DBT *repl; + u_int32_t prefix; + u_int32_t suffix; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t zero; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_bam_repl; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(fileid) + + sizeof(pgno) + + sizeof(*lsn) + + sizeof(indx) + + sizeof(isdeleted) + + sizeof(u_int32_t) + (orig == NULL ? 0 : orig->size) + + sizeof(u_int32_t) + (repl == NULL ? 0 : repl->size) + + sizeof(prefix) + + sizeof(suffix); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + memcpy(bp, &pgno, sizeof(pgno)); + bp += sizeof(pgno); + if (lsn != NULL) + memcpy(bp, lsn, sizeof(*lsn)); + else + memset(bp, 0, sizeof(*lsn)); + bp += sizeof(*lsn); + memcpy(bp, &indx, sizeof(indx)); + bp += sizeof(indx); + memcpy(bp, &isdeleted, sizeof(isdeleted)); + bp += sizeof(isdeleted); + if (orig == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &orig->size, sizeof(orig->size)); + bp += sizeof(orig->size); + memcpy(bp, orig->data, orig->size); + bp += orig->size; + } + if (repl == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &repl->size, sizeof(repl->size)); + bp += sizeof(repl->size); + memcpy(bp, repl->data, repl->size); + bp += repl->size; + } + memcpy(bp, &prefix, sizeof(prefix)); + bp += sizeof(prefix); + memcpy(bp, &suffix, sizeof(suffix)); + bp += sizeof(suffix); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __bam_repl_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_repl_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __bam_repl_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __bam_repl_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]bam_repl: 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); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tpgno: %lu\n", (u_long)argp->pgno); + printf("\tlsn: [%lu][%lu]\n", + (u_long)argp->lsn.file, (u_long)argp->lsn.offset); + printf("\tindx: %lu\n", (u_long)argp->indx); + printf("\tisdeleted: %lu\n", (u_long)argp->isdeleted); + printf("\torig: "); + for (i = 0; i < argp->orig.size; i++) { + ch = ((u_int8_t *)argp->orig.data)[i]; + if (isprint(ch) || ch == 0xa) + putchar(ch); + else + printf("%#x ", ch); + } + printf("\n"); + printf("\trepl: "); + for (i = 0; i < argp->repl.size; i++) { + ch = ((u_int8_t *)argp->repl.data)[i]; + if (isprint(ch) || ch == 0xa) + putchar(ch); + else + printf("%#x ", ch); + } + printf("\n"); + printf("\tprefix: %lu\n", (u_long)argp->prefix); + printf("\tsuffix: %lu\n", (u_long)argp->suffix); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __bam_repl_read __P((void *, __bam_repl_args **)); + */ +int +__bam_repl_read(recbuf, argpp) + void *recbuf; + __bam_repl_args **argpp; +{ + __bam_repl_args *argp; + u_int8_t *bp; + + argp = (__bam_repl_args *)__db_malloc(sizeof(__bam_repl_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->pgno, bp, sizeof(argp->pgno)); + bp += sizeof(argp->pgno); + memcpy(&argp->lsn, bp, sizeof(argp->lsn)); + bp += sizeof(argp->lsn); + memcpy(&argp->indx, bp, sizeof(argp->indx)); + bp += sizeof(argp->indx); + memcpy(&argp->isdeleted, bp, sizeof(argp->isdeleted)); + bp += sizeof(argp->isdeleted); + memcpy(&argp->orig.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->orig.data = bp; + bp += argp->orig.size; + memcpy(&argp->repl.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->repl.data = bp; + bp += argp->repl.size; + memcpy(&argp->prefix, bp, sizeof(argp->prefix)); + bp += sizeof(argp->prefix); + memcpy(&argp->suffix, bp, sizeof(argp->suffix)); + bp += sizeof(argp->suffix); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __bam_init_print __P((DB_ENV *)); + */ +int +__bam_init_print(dbenv) + DB_ENV *dbenv; +{ + int ret; + + if ((ret = __db_add_recovery(dbenv, + __bam_pg_alloc_print, DB_bam_pg_alloc)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __bam_pg_free_print, DB_bam_pg_free)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __bam_split_print, DB_bam_split)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __bam_rsplit_print, DB_bam_rsplit)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __bam_adj_print, DB_bam_adj)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __bam_cadjust_print, DB_bam_cadjust)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __bam_cdel_print, DB_bam_cdel)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __bam_repl_print, DB_bam_repl)) != 0) + return (ret); + return (0); +} + +/* + * PUBLIC: int __bam_init_recover __P((DB_ENV *)); + */ +int +__bam_init_recover(dbenv) + DB_ENV *dbenv; +{ + int ret; + + if ((ret = __db_add_recovery(dbenv, + __bam_pg_alloc_recover, DB_bam_pg_alloc)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __bam_pg_free_recover, DB_bam_pg_free)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __bam_split_recover, DB_bam_split)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __bam_rsplit_recover, DB_bam_rsplit)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __bam_adj_recover, DB_bam_adj)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __bam_cadjust_recover, DB_bam_cadjust)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __bam_cdel_recover, DB_bam_cdel)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __bam_repl_recover, DB_bam_repl)) != 0) + return (ret); + return (0); +} + diff --git a/mozilla/db/build.unix/README b/mozilla/db/build.unix/README new file mode 100644 index 00000000000..9a0abb19c1a --- /dev/null +++ b/mozilla/db/build.unix/README @@ -0,0 +1,242 @@ +# @(#)README 8.24 (Sleepycat) 6/2/98 + +This is a directory for building UNIX versions of DB. + +To build the default configuration of DB, simply enter the two commands: + + ../dist/configure + make + +in this directory. This will build the DB library. To install the DB +library, enter: + + make install + +See below for specific information on what files are installed and in what +directories, and how to configure installation on a per-system basis. + +If you want to rebuild DB, enter: + + make clean + make + +If you change your mind about how DB is configured, you must start from +scratch by entering: + + make distclean + ../dist/configure + make + +To build multiple UNIX versions of DB in the same source tree, create a +new directory at the same level as build.unix, and then configure and build. + + mkdir build.bsdos3.0 + cd build.bsdos3.0 + ../dist/configure + make + +If you have trouble with any of these commands, please send email to the +addresses found in the ../README file. In that email, please provide a +complete copy of the commands that you entered and their output. + +=-=-=-=-=-=-= +DB'S OPTIONS TO THE CONFIGURE PROGRAM +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +There are many options that you can enter to the configuration program, +only a few of which are DB specific. To see a complete list of the +options, enter "../dist/configure --help". + +The DB specific options are as follows: + +--enable-cxx: + If you want to include C++ interfaces in the library, enter: + + --enable-cxx + + as an argument to configure. + +--enable-debug: + If you want to build DB with -g as a compiler flag and with DEBUG + #defined during compilation, enter: + + --enable-debug + + as an argument to configure. This will create DB with debugging + symbols, as well as load various routines that can be called from + a debugger to display pages, cursor queues and so forth. This + flag should probably not be defined when configuring to build + production binaries, although there shouldn't be any significant + performance degradation. + +--enable-diagnostic: + If you want to build DB with debugging run-time sanity checks and + with DIAGNOSTIC #defined during compilation, enter: + + --enable-diagnostic + + as an argument to configure. This will cause a number of special + checks to be performed when DB is running. This flag should NOT + be defined when configuring to build production binaries, as you + will lose a significant amount of performance. + +--enable-compat185 + If you want to compile or load DB 1.85 applications against the + DB 2.0 library, enter: + + --enable-compat185 + + as an argument to configure. This will include DB 1.85 API + compatibility code in the library. + +--enable-dump185: + If you need to convert DB 1.85 (or earlier) databases to DB 2.0 + databases, enter: + + --enable-dump185 + + as an argument to configure. This will build the dump_185(1) + utility. This utility will dump DB 1.85 databases in a format + readable by the db_load(1) utility. For more information, see + db_dump(1) and db_load(1). + + The system libraries with which you are loading the dump_185(1) + utility MUST already contain the DB 1.85 library routines for this + to work, as the DB distribution does not include them. If you + are using a non-standard library for the DB 1.85 library routines, + you will have to change the Makefile that configure creates to + load dump_185 with that library. + +--enable-test: + If you want to build the Tcl test suite, enter: + + --enable-test + + as an argument to configure. Note, the Tcl test suite will only + build if the Tcl libraries and include files are found. + +--disable-bigfile: + Some systems, notably versions of AIX, HP/UX and Solaris, require + special compile-time options in order to create files larger than + 2^32 bytes. These options are automatically enabled when DB is + compiled. For this reason, binaries built on current versions of + these systems may not run on earlier versions of the system, as + the library and system calls necessary for large files are not + available. To disable building with these compile-time options, + enter: + + --disable-bigfile + + as an argument to configure. + +=-=-=-=-=-=-= +RUNNING THE DB TEST SUITE +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +The DB test suite is built if you specify --enable-test as an argument to +configure and the Tcl libraries are found on your system. (The libraries +that DB needs to build the test suite are -ltcl and -lm.) For more +information on running DB's test suite and debugging the DB package, see +the file file ../test/README. + +=-=-=-=-=-=-= +CHANGING COMPILERS, LIBRARIES OR COMPILER AND LOADER OPTIONS +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +You can specify a compiler and/or compile and load time flags by using +environment variables during configuration. For example, if you want +to use a specific compiler, specify the CC environment variable before +running configure: + + env CC=gcc ../dist/configure + +Using anything other than the native compiler will almost certainly +mean that you'll want to check the compile and load line flags, too. + +To specify debugging and optimization options for the C compiler, +use the CFLAGS environment variable: + + env CFLAGS=-O2 ../dist/configure + +To specify header file search directories and other miscellaneous options +for the C preprocessor and compiler, use the CPPFLAGS environment variable: + + env CPPFLAGS=-I/usr/contrib/include ../dist/configure + +To specify debugging and optimization options for the C++ compiler, +use the CXXFLAGS environment variable: + + env CXXFLAGS=-Woverloaded-virtual ../dist/configure + +To specify miscellaneous options for the linker, use the LDFLAGS +environment variable: + + env LDFLAGS="-N32" ../dist/configure + +If the Tcl or any other include files or libraries are in non-standard +places on your system, you will need to specify the directory path where +they can be found. + +If you want to specify additional libraries and library directories, set +the LIBS environment variable before running configure. For example: + + env LIBS="-L/a/b -L/e/f -lposix" ../dist/configure + +would specify two additional directories to search for libraries, /a/b +and /e/f, and one additional library to load, "posix". + +Make sure that you prepend -L to any library directory names and that you +prepend -I to any include file directory names! Also, make sure that you +quote the arguments as shown above, i.e. with single or double quotes +around the values you're specifying for LIBS, if they contain blank or +tab characters. + +The env command is available on most systems, and simply sets one or more +environment variables before running a command. If the env command is +not available to you, you can set the environment variables in your shell +before running configure. For example, in sh or ksh, you could do: + + LIBS="-L/a/b -L/e/f -ldb" ../dist/configure + +and in csh or tcsh, you could do: + + setenv LIBS "-L/a/b -L/e/f -ldb" + ../dist/configure + +See your shell's manual page for further information. + +=-=-=-=-=-=-= +INSTALLING DB +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +DB installs the following files into the following locations, with the +following default values: + +Variables: Default value: +prefix /usr/local +exec_prefix $(prefix) +includedir $(prefix)/include +bindir $(prefix)/bin +libdir $(prefix)/lib +mandir $(prefix)/man + +File(s): Default location +---------------------------------------- +db.h, db_185.h $(includedir) +libdb.a $(libdir) +utilities $(bindir) +formatted man pages $(mandir)/cat1/ +formatted man pages $(mandir)/cat3/ + +Unformatted man pages are not installed by default. + +To move the entire installation tree somewhere besides /usr/local, change +the value "prefix". To move the binaries to a different place, change +the value of "bindir". Similarly, to move the man pages to a different +location, change the value of "mandir". These values can be changed as +part of configuration: + + ../dist/configure --prefix=/usr/contrib + +or when doing the install itself: + + make prefix=/usr/contrib install + +Note, the installation process will attempt to create any directories +that are not already in place on the system. diff --git a/mozilla/db/build.win16/config.h b/mozilla/db/build.win16/config.h new file mode 100644 index 00000000000..f41c9615097 --- /dev/null +++ b/mozilla/db/build.win16/config.h @@ -0,0 +1,241 @@ +/* + * @(#)config.h 10.6 (Sleepycat) 5/2/98 + * + * Generated by hand. + */ + +/* Define to empty if the keyword does not work. */ +/* #undef const */ + +/* Define if your struct stat has st_blksize. */ +/* #undef HAVE_ST_BLKSIZE */ + +/* Define to `int' if doesn't define. */ +#define mode_t int + +/* Define to `long' if doesn't define. */ +/* #undef off_t */ + +/* Define to `int' if doesn't define. */ +#define pid_t long + +/* Define to `unsigned' if doesn't define. */ +/* #undef size_t */ + +/* Define if the `S_IS*' macros in do not work properly. */ +/* #undef STAT_MACROS_BROKEN */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if your processor stores words with the most significant + byte first (like Motorola and SPARC, unlike Intel and VAX). */ +/* #undef WORDS_BIGENDIAN */ + +/* Define to `int' if doesn't define. */ +typedef int ssize_t; + +/* Define if you want a debugging version. */ +/* #undef DEBUG */ +#if defined(_DEBUG) +#if !defined(DEBUG) +#define DEBUG 1 +#endif +#endif + +/* Define if you want a version with run-time diagnostic checking. */ +/* #undef DIAGNOSTIC */ + +/* Define if you have sigfillset (and sigprocmask). */ +/* #undef HAVE_SIGFILLSET */ + +/* Define if building on AIX, HP, Solaris to get big-file environment. */ +/* #undef HAVE_FILE_OFFSET_BITS */ +#ifdef HAVE_FILE_OFFSET_BITS +#define _FILE_OFFSET_BITS 64 +#endif + +/* Define if you have spinlocks. */ +#define HAVE_SPINLOCKS 1 + +/* Define if you want to use mc68020/gcc assembly spinlocks. */ +/* #undef HAVE_ASSEM_MC68020_GCC */ + +/* Define if you want to use parisc/gcc assembly spinlocks. */ +/* #undef HAVE_ASSEM_PARISC_GCC */ + +/* Define if you want to use sco/cc assembly spinlocks. */ +/* #undef HAVE_ASSEM_SCO_CC */ + +/* Define if you want to use sparc/gcc assembly spinlocks. */ +/* #undef HAVE_ASSEM_SPARC_GCC */ + +/* Define if you want to use uts4/cc assembly spinlocks. */ +/* #undef HAVE_ASSEM_UTS4_CC */ + +/* Define if you want to use x86/gcc assembly spinlocks. */ +/* #undef HAVE_ASSEM_X86_GCC */ + +/* Define if you have the AIX _check_lock spinlocks. */ +/* #undef HAVE_FUNC_AIX */ + +/* Define if you have the OSF1 or HPPA msemaphore spinlocks. */ +/* #undef HAVE_FUNC_MSEM */ + +/* Define if you have the SGI abilock_t spinlocks. */ +/* #undef HAVE_FUNC_SGI */ + +/* Define if you have the ReliantUNIX spinlock_t spinlocks. */ +/* #undef HAVE_FUNC_RELIANT */ + +/* Define if you have the Solaris mutex_t spinlocks. */ +/* #undef HAVE_FUNC_SOLARIS */ + +/* Define if your sprintf returns a pointer, not a length. */ +/* #undef SPRINTF_RET_CHARPNT */ + +/* Define if you have the directio function. */ +/* #undef HAVE_DIRECTIO */ + +/* Define if you have the getcwd function. */ +#define HAVE_GETCWD + +/* Define if you have the getopt function. */ +/* #undef HAVE_GETOPT */ +extern int getopt(int, char * const *, const char *); + +/* Define if you have the getuid function. */ +/* #undef HAVE_GETUID */ + +/* Define if you have the memcmp function. */ +#define HAVE_MEMCMP 1 + +/* Define if you have the memcpy function. */ +#define HAVE_MEMCPY 1 + +/* Define if you have the memmove function. */ +#define HAVE_MEMMOVE 1 + +/* Define if you have the mmap function. */ +/* #undef HAVE_MMAP */ + +/* Define if you have the raise function. */ +#define HAVE_RAISE 1 + +/* Define if you have the select function. */ +/* #undef HAVE_SELECT */ + +/* Define if you have the shmget function. */ +/* #undef HAVE_SHMGET */ + +/* Define if you have the snprintf function. */ +#define HAVE_SNPRINTF 1 + +/* Define if you have the strerror function. */ +#define HAVE_STRERROR 1 + +/* Define if you have the strsep function. */ +/* #undef HAVE_STRSEP */ + +/* Define if you have the sysconf function. */ +/* #undef HAVE_SYSCONF */ + +/* Define if you have the vsnprintf function. */ +#define HAVE_VSNPRINTF 1 + +/* Define if you have the header file. */ +/* #undef HAVE_DIRENT_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_NDIR_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_SELECT_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_TIME_H */ + +/* + * XXX + * The following is not part of the automatic configuration setup, + * but provides the information necessary to build DB. + */ +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(__cplusplus) +#include +#endif + +#define WIN32_LEAN_AND_MEAN +#include + +#include "queue.h" +#include "shqueue.h" + +#define snprintf _snprintf +#define vsnprintf _vsnprintf + +#define NO_SYSTEM_INCLUDES + +/* + * Arrange to use the far versions of these functions by default. + */ +#define memcmp _fmemcmp +#define memcpy _fmemcpy +#define memmove _fmemmove +#define strdup _fstrdup + +/* + * Callbacks need to be so tagged. + */ +#define DB_CALLBACK __cdecl __loadds + +/* + * The maximum region on Win16 is 64K. + */ +#define DB_REGIONSIZE_MAX (64 * 1024) + +/* + * include/lock.h: + * The maximum region size on Win16 is 64K. + */ +#define DB_LOCK_DEFAULT_N 400 + +/* + * include/mp.h: + * The maximum region size on Win16 is 64K. + */ +#define DB_CACHESIZE_DEF DB_REGIONSIZE_MAX + +/* + * include/log.h: + * File names can only have 3 characters after the dot. + */ +#define MAXLFNAME 999 /* Maximum log file name. */ +#define LFNAME "log.%03d" /* Log file name template. */ + +#define WIN16 diff --git a/mozilla/db/build.win16/db.h b/mozilla/db/build.win16/db.h new file mode 100644 index 00000000000..ae2d85fb656 --- /dev/null +++ b/mozilla/db/build.win16/db.h @@ -0,0 +1,997 @@ +/* DO NOT EDIT: automatically built by dist/distrib. */ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)db.h.src 10.131 (Sleepycat) 6/2/98 + */ + +#ifndef _DB_H_ +#define _DB_H_ + +#ifndef __NO_SYSTEM_INCLUDES +#include + +#include +#endif + +/* + * XXX + * MacOS: ensure that Metrowerks C makes enumeration types int sized. + */ +#ifdef __MWERKS__ +#pragma enumsalwaysint on +#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 + +/* + * !!! + * DB needs basic information about 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__ +typedef unsigned char u_int8_t; +typedef short int16_t; +typedef unsigned short u_int16_t; +typedef long int32_t; +typedef unsigned long u_int32_t; +#endif + +#if !defined(_WINSOCKAPI_) +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; +#endif + +#define DB_VERSION_MAJOR 2 +#define DB_VERSION_MINOR 4 +#define DB_VERSION_PATCH 14 +#define DB_VERSION_STRING "Sleepycat Software: DB 2.4.14: (6/2/98)" + +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. */ +typedef size_t DB_LOCK; /* Object returned by lock manager. */ +#define DB_MAX_RECORDS 0xffffffff /* >= # of records in a tree */ + +#define DB_FILE_ID_LEN 20 /* DB file ID length. */ + +/* Forward structure declarations, so applications get type checking. */ +struct __db; typedef struct __db DB; +#ifdef DB_DBM_HSEARCH + typedef struct __db DBM; +#endif +struct __db_bt_stat; typedef struct __db_bt_stat DB_BTREE_STAT; +struct __db_dbt; typedef struct __db_dbt DBT; +struct __db_env; typedef struct __db_env DB_ENV; +struct __db_info; typedef struct __db_info DB_INFO; +struct __db_lock_stat; typedef struct __db_lock_stat DB_LOCK_STAT; +struct __db_lockregion; typedef struct __db_lockregion DB_LOCKREGION; +struct __db_lockreq; typedef struct __db_lockreq DB_LOCKREQ; +struct __db_locktab; typedef struct __db_locktab DB_LOCKTAB; +struct __db_log; typedef struct __db_log DB_LOG; +struct __db_log_stat; typedef struct __db_log_stat DB_LOG_STAT; +struct __db_lsn; typedef struct __db_lsn DB_LSN; +struct __db_mpool; typedef struct __db_mpool DB_MPOOL; +struct __db_mpool_finfo;typedef struct __db_mpool_finfo DB_MPOOL_FINFO; +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_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 __db_txnregion; typedef struct __db_txnregion DB_TXNREGION; +struct __dbc; typedef struct __dbc DBC; + +/* Key/data structure -- a Data-Base Thang. */ +struct __db_dbt { + 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_INTERNAL 0x01 /* Perform any mallocs using regular + malloc, not the user's malloc. */ +#define DB_DBT_MALLOC 0x02 /* Return in allocated memory. */ +#define DB_DBT_PARTIAL 0x04 /* Partial put/get. */ +#define DB_DBT_USERMEM 0x08 /* Return in user's memory. */ + u_int32_t flags; +}; + +/* + * DB internal configuration. + * + * There are a set of functions that the application can replace with its + * own versions, and some other knobs which can be turned at run-time. + */ +#define DB_FUNC_CALLOC 1 /* DELETED: ANSI C calloc. */ +#define DB_FUNC_CLOSE 2 /* POSIX 1003.1 close. */ +#define DB_FUNC_DIRFREE 3 /* DB: free directory list. */ +#define DB_FUNC_DIRLIST 4 /* DB: create directory list. */ +#define DB_FUNC_EXISTS 5 /* DB: return if file exists. */ +#define DB_FUNC_FREE 6 /* ANSI C free. */ +#define DB_FUNC_FSYNC 7 /* POSIX 1003.1 fsync. */ +#define DB_FUNC_IOINFO 8 /* DB: return file I/O information. */ +#define DB_FUNC_MALLOC 9 /* ANSI C malloc. */ +#define DB_FUNC_MAP 10 /* DB: map file into shared memory. */ +#define DB_FUNC_OPEN 11 /* POSIX 1003.1 open. */ +#define DB_FUNC_READ 12 /* POSIX 1003.1 read. */ +#define DB_FUNC_REALLOC 13 /* ANSI C realloc. */ +#define DB_FUNC_SEEK 14 /* POSIX 1003.1 lseek. */ +#define DB_FUNC_SLEEP 15 /* DB: sleep secs/usecs. */ +#define DB_FUNC_STRDUP 16 /* DELETED: DB: strdup(3). */ +#define DB_FUNC_UNLINK 17 /* POSIX 1003.1 unlink. */ +#define DB_FUNC_UNMAP 18 /* DB: unmap shared memory file. */ +#define DB_FUNC_WRITE 19 /* POSIX 1003.1 write. */ +#define DB_FUNC_YIELD 20 /* DB: yield thread to scheduler. */ +#define DB_TSL_SPINS 21 /* DB: initialize spin count. */ +#define DB_FUNC_RUNLINK 22 /* DB: remove a shared region. */ +#define DB_REGION_ANON 23 /* DB: anonymous, unnamed regions. */ +#define DB_REGION_INIT 24 /* DB: page-fault regions in create. */ +#define DB_REGION_NAME 25 /* DB: anonymous, named regions. */ +#define DB_MUTEXLOCKS 26 /* DB: turn off all mutex locks. */ +#define DB_PAGEYIELD 27 /* DB: yield the CPU on pool get. */ + +/* + * Database configuration and initialization. + */ + /* + * Flags understood by both db_open(3) and db_appinit(3). + */ +#define DB_CREATE 0x000001 /* O_CREAT: create file as necessary. */ +#define DB_NOMMAP 0x000002 /* Don't mmap underlying file. */ +#define DB_THREAD 0x000004 /* Free-thread DB package handles. */ + +/* + * Flags understood by db_appinit(3). + */ +/* 0x000007 COMMON MASK. */ +#define DB_INIT_LOCK 0x000008 /* Initialize locking. */ +#define DB_INIT_LOG 0x000010 /* Initialize logging. */ +#define DB_INIT_MPOOL 0x000020 /* Initialize mpool. */ +#define DB_INIT_TXN 0x000040 /* Initialize transactions. */ +#define DB_MPOOL_PRIVATE 0x000080 /* Mpool: private memory pool. */ +#define __UNUSED_100 0x000100 +#define DB_RECOVER 0x000200 /* Run normal recovery. */ +#define DB_RECOVER_FATAL 0x000400 /* Run catastrophic recovery. */ +#define DB_TXN_NOSYNC 0x000800 /* Do not sync log on commit. */ +#define DB_USE_ENVIRON 0x001000 /* Use the environment. */ +#define DB_USE_ENVIRON_ROOT 0x002000 /* Use the environment if root. */ + +/* CURRENTLY UNUSED LOCK FLAGS. */ +#define DB_TXN_LOCK_2PL 0x000000 /* Two-phase locking. */ +#define DB_TXN_LOCK_OPTIMIST 0x000000 /* Optimistic locking. */ +#define DB_TXN_LOCK_MASK 0x000000 /* Lock flags mask. */ + +/* CURRENTLY UNUSED LOG FLAGS. */ +#define DB_TXN_LOG_REDO 0x000000 /* Redo-only logging. */ +#define DB_TXN_LOG_UNDO 0x000000 /* Undo-only logging. */ +#define DB_TXN_LOG_UNDOREDO 0x000000 /* Undo/redo write-ahead logging. */ +#define DB_TXN_LOG_MASK 0x000000 /* Log flags mask. */ + +/* + * Flags understood by db_open(3). + * + * DB_EXCL and DB_TEMPORARY are internal only, and are not documented. + * DB_SEQUENTIAL is currently internal, but may be exported some day. + */ +/* 0x000007 COMMON MASK. */ +/* 0x003fff ALREADY USED. */ +#define __UNUSED_4000 0x004000 +#define DB_EXCL 0x008000 /* O_EXCL: exclusive open. */ +#define DB_RDONLY 0x010000 /* O_RDONLY: read-only. */ +#define DB_SEQUENTIAL 0x020000 /* Indicate sequential access. */ +#define DB_TEMPORARY 0x040000 /* Remove on last close. */ +#define DB_TRUNCATE 0x080000 /* O_TRUNCATE: replace existing DB. */ + +/* + * Deadlock detector modes; used in the DBENV structure to configure the + * locking subsystem. + */ +#define DB_LOCK_NORUN 0x0 +#define DB_LOCK_DEFAULT 0x1 /* Default policy. */ +#define DB_LOCK_OLDEST 0x2 /* Abort oldest transaction. */ +#define DB_LOCK_RANDOM 0x3 /* Abort random transaction. */ +#define DB_LOCK_YOUNGEST 0x4 /* Abort youngest transaction. */ + +struct __db_env { + int db_lorder; /* Byte order. */ + + /* Error message callback. */ + void (DB_CALLBACK *db_errcall) __P((const char *, char *)); + FILE *db_errfile; /* Error message file stream. */ + const char *db_errpfx; /* Error message prefix. */ + int db_verbose; /* Generate debugging messages. */ + + /* User 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. */ + + /* Locking. */ + DB_LOCKTAB *lk_info; /* Return from lock_open(). */ + 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_detect; /* Deadlock detect on all conflicts. */ + + /* Logging. */ + DB_LOG *lg_info; /* Return from log_open(). */ + u_int32_t lg_max; /* Maximum file size. */ + + /* Memory pool. */ + DB_MPOOL *mp_info; /* Return from memp_open(). */ + size_t mp_mmapsize; /* Maximum file size for mmap. */ + size_t mp_size; /* Bytes in the mpool cache. */ + + /* Transactions. */ + DB_TXNMGR *tx_info; /* Return from txn_open(). */ + u_int32_t tx_max; /* Maximum number of transactions. */ + int (DB_CALLBACK *tx_recover) /* Dispatch function for recovery. */ + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + +#define DB_ENV_APPINIT 0x01 /* Paths initialized by db_appinit(). */ +#define DB_ENV_STANDALONE 0x02 /* Test: freestanding environment. */ +#define DB_ENV_THREAD 0x04 /* DB_ENV is multi-threaded. */ + u_int32_t flags; /* Flags. */ +}; + +/******************************************************* + * Access methods. + *******************************************************/ +/* + * XXX + * Changes here must be reflected in java/src/com/sleepycat/db/Db.java. + */ +typedef enum { + DB_BTREE=1, /* B+tree. */ + DB_HASH, /* Extended Linear Hashing. */ + DB_RECNO, /* Fixed and variable-length records. */ + DB_UNKNOWN /* Figure it out on open. */ +} DBTYPE; + +#define DB_BTREEVERSION 6 /* Current btree version. */ +#define DB_BTREEOLDVER 6 /* Oldest btree version supported. */ +#define DB_BTREEMAGIC 0x053162 + +#define DB_HASHVERSION 5 /* Current hash version. */ +#define DB_HASHOLDVER 4 /* Oldest hash version supported. */ +#define DB_HASHMAGIC 0x061561 + +#define DB_LOGVERSION 2 /* Current log version. */ +#define DB_LOGOLDVER 2 /* Oldest log version supported. */ +#define DB_LOGMAGIC 0x040988 + +struct __db_info { + int db_lorder; /* Byte order. */ + size_t db_cachesize; /* Underlying cache size. */ + size_t db_pagesize; /* Underlying page size. */ + + /* Local heap allocation. */ + void *(DB_CALLBACK *db_malloc) __P((size_t)); + + /* Btree access method. */ + u_int32_t bt_maxkey; /* Maximum keys per page. */ + u_int32_t bt_minkey; /* Minimum keys per page. */ + int (DB_CALLBACK *bt_compare) /* Comparison function. */ + __P((const DBT *, const DBT *)); + size_t (DB_CALLBACK *bt_prefix) /* Prefix function. */ + __P((const DBT *, const DBT *)); + + /* Hash access method. */ + u_int32_t h_ffactor; /* Fill factor. */ + u_int32_t h_nelem; /* Number of elements. */ + u_int32_t (DB_CALLBACK *h_hash) /* Hash function. */ + __P((const void *, u_int32_t)); + + /* 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. */ + +#define DB_DELIMITER 0x0001 /* Recno: re_delim set. */ +#define DB_DUP 0x0002 /* Btree, Hash: duplicate keys. */ +#define DB_FIXEDLEN 0x0004 /* Recno: fixed-length records. */ +#define DB_PAD 0x0008 /* Recno: re_pad set. */ +#define DB_RECNUM 0x0010 /* Btree: record numbers. */ +#define DB_RENUMBER 0x0020 /* Recno: renumber on insert/delete. */ +#define DB_SNAPSHOT 0x0040 /* Recno: snapshot the input. */ + u_int32_t flags; +}; + +/* + * DB access method and cursor operation codes. These are implemented as + * bit fields for future flexibility, but currently only a single one may + * be specified to any function. + */ +#define DB_AFTER 0x000001 /* c_put() */ +#define DB_APPEND 0x000002 /* put() */ +#define DB_BEFORE 0x000004 /* c_put() */ +#define DB_CHECKPOINT 0x000008 /* log_put(), log_get() */ +#define DB_CURRENT 0x000010 /* c_get(), c_put(), log_get() */ +#define DB_FIRST 0x000020 /* c_get(), log_get() */ +#define DB_FLUSH 0x000040 /* log_put() */ +#define DB_GET_RECNO 0x000080 /* get(), c_get() */ +#define DB_KEYFIRST 0x000100 /* c_put() */ +#define DB_KEYLAST 0x000200 /* c_put() */ +#define DB_LAST 0x000400 /* c_get(), log_get() */ +#define DB_NEXT 0x000800 /* c_get(), log_get() */ +#define DB_NOOVERWRITE 0x001000 /* put() */ +#define DB_NOSYNC 0x002000 /* close() */ +#define DB_PREV 0x004000 /* c_get(), log_get() */ +#define DB_RECORDCOUNT 0x008000 /* stat() */ +#define DB_SET 0x010000 /* c_get(), log_get() */ +#define DB_SET_RANGE 0x020000 /* c_get() */ +#define DB_SET_RECNO 0x040000 /* c_get() */ +#define DB_CURLSN 0x080000 /* log_put() */ + +/* + * DB (user visible) error return codes. + * + * XXX + * Changes to any of the user visible error return codes must be reflected + * in java/src/com/sleepycat/db/Db.java. + */ +#define DB_INCOMPLETE ( -1) /* Sync didn't finish. */ +#define DB_KEYEMPTY ( -2) /* The key/data pair was deleted or + was never created by the user. */ +#define DB_KEYEXIST ( -3) /* The key/data pair already exists. */ +#define DB_LOCK_DEADLOCK ( -4) /* Locker killed to resolve deadlock. */ +#define DB_LOCK_NOTGRANTED ( -5) /* Lock unavailable, no-wait set. */ +#define DB_LOCK_NOTHELD ( -6) /* Lock not held by locker. */ +#define DB_NOTFOUND ( -7) /* Key/data pair not found (EOF). */ + +/* DB (private) error return codes. */ +#define DB_DELETED ( -8) /* Recovery file marked deleted. */ +#define DB_NEEDSPLIT ( -9) /* Page needs to be split. */ +#define DB_REGISTERED (-10) /* Entry was previously registered. */ +#define DB_SWAPBYTES (-11) /* Database needs byte swapping. */ +#define DB_TXN_CKP (-12) /* Encountered ckp record in log. */ + +struct __db_ilock { /* Internal DB access method lock. */ + db_pgno_t pgno; /* Page being locked. */ + /* File id. */ + u_int8_t fileid[DB_FILE_ID_LEN]; +}; + +/* DB access method description structure. */ +struct __db { + void *mutexp; /* Synchronization for free threading */ + DBTYPE type; /* DB access method. */ + DB_ENV *dbenv; /* DB_ENV structure. */ + DB_ENV *mp_dbenv; /* DB_ENV for local mpool creation. */ + + DB *master; /* Original DB created by db_open. */ + void *internal; /* Access method private. */ + + DB_MPOOL *mp; /* The access method's mpool. */ + DB_MPOOLFILE *mpf; /* The access method's mpool file. */ + + /* + * XXX + * Explicit representations of structures in queue.h. + * + * TAILQ_HEAD(curs_queue, __dbc); + */ + struct { + struct __dbc *tqh_first; + struct __dbc **tqh_last; + } curs_queue; + + /* + * XXX + * Explicit representations of structures in queue.h. + * + * LIST_HEAD(handleq, __db); + * LIST_ENTRY(__db); + */ + struct { + struct __db *lh_first; + } handleq; /* List of handles for this DB. */ + struct { + struct __db *le_next; + struct __db **le_prev; + } links; /* Links for the handle list. */ + + u_int32_t log_fileid; /* Logging file id. */ + + DB_TXN *txn; /* Current transaction. */ + u_int32_t locker; /* Default process' locker id. */ + DBT lock_dbt; /* DBT referencing lock. */ + struct __db_ilock lock; /* Lock. */ + + size_t pgsize; /* Logical page size of file. */ + + /* Local heap allocation. */ + void *(DB_CALLBACK *db_malloc) __P((size_t)); + + /* Functions. */ + int (DB_CALLBACK *close) __P((DB *, u_int32_t)); + int (DB_CALLBACK *cursor) __P((DB *, DB_TXN *, DBC **)); + int (DB_CALLBACK *del) __P((DB *, DB_TXN *, DBT *, u_int32_t)); + int (DB_CALLBACK *fd) __P((DB *, int *)); + int (DB_CALLBACK *get) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); + int (DB_CALLBACK *put) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); + int (DB_CALLBACK *stat) __P((DB *, void *, void *(*)(size_t), u_int32_t)); + int (DB_CALLBACK *sync) __P((DB *, u_int32_t)); + +#define DB_AM_DUP 0x000001 /* DB_DUP (internal). */ +#define DB_AM_INMEM 0x000002 /* In-memory; no sync on close. */ +#define DB_AM_LOCKING 0x000004 /* Perform locking. */ +#define DB_AM_LOGGING 0x000008 /* Perform logging. */ +#define DB_AM_MLOCAL 0x000010 /* Database memory pool is local. */ +#define DB_AM_PGDEF 0x000020 /* Page size was defaulted. */ +#define DB_AM_RDONLY 0x000040 /* Database is readonly. */ +#define DB_AM_RECOVER 0x000080 /* In recovery (do not log or lock). */ +#define DB_AM_SWAP 0x000100 /* Pages need to be byte-swapped. */ +#define DB_AM_THREAD 0x000200 /* DB is multi-threaded. */ +#define DB_BT_RECNUM 0x000400 /* DB_RECNUM (internal) */ +#define DB_HS_DIRTYMETA 0x000800 /* Hash: Metadata page modified. */ +#define DB_RE_DELIMITER 0x001000 /* DB_DELIMITER (internal). */ +#define DB_RE_FIXEDLEN 0x002000 /* DB_FIXEDLEN (internal). */ +#define DB_RE_PAD 0x004000 /* DB_PAD (internal). */ +#define DB_RE_RENUMBER 0x008000 /* DB_RENUMBER (internal). */ +#define DB_RE_SNAPSHOT 0x010000 /* DB_SNAPSHOT (internal). */ + u_int32_t flags; +}; + +/* Cursor description structure. */ +struct __dbc { + DB *dbp; /* Related DB access method. */ + DB_TXN *txn; /* Associated transaction. */ + + /* + * XXX + * Explicit representations of structures in queue.h. + * + * TAILQ_ENTRY(__dbc); + */ + struct { + struct __dbc *tqe_next; + struct __dbc **tqe_prev; + } links; + + void *internal; /* Access method private. */ + + int (DB_CALLBACK *c_close) __P((DBC *)); + int (DB_CALLBACK *c_del) __P((DBC *, u_int32_t)); + int (__cdecl __loadds *c_get) __P((DBC *, DBT *, DBT *, u_int32_t)); + int (__cdecl __loadds *c_put) __P((DBC *, DBT *, DBT *, u_int32_t)); +}; + +/* Btree/recno statistics structure. */ +struct __db_bt_stat { + u_int32_t bt_flags; /* Open flags. */ + 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_pagesize; /* Page size. */ + u_int32_t bt_levels; /* Tree levels. */ + u_int32_t bt_nrecs; /* Number of records. */ + 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_freed; /* Pages freed for reuse. */ + 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. */ + u_int32_t bt_pfxsaved; /* Bytes saved by prefix compression. */ + u_int32_t bt_split; /* Total number of splits. */ + u_int32_t bt_rootsplit; /* Root page splits. */ + u_int32_t bt_fastsplit; /* Fast splits. */ + u_int32_t bt_added; /* Items added. */ + u_int32_t bt_deleted; /* Items deleted. */ + u_int32_t bt_get; /* Items retrieved. */ + u_int32_t bt_cache_hit; /* Hits in fast-insert code. */ + u_int32_t bt_cache_miss; /* Misses in fast-insert code. */ + u_int32_t bt_magic; /* Magic number. */ + u_int32_t bt_version; /* Version number. */ +}; + +#if defined(__cplusplus) +extern "C" { +#endif +int db_appinit __P((const char *, char * const *, DB_ENV *, u_int32_t)); +int db_appexit __P((DB_ENV *)); +int db_jump_set __P((void *, int)); +int db_open __P((const char *, + DBTYPE, u_int32_t, int, DB_ENV *, DB_INFO *, DB **)); +int db_value_set __P((int, int)); +char *db_version __P((int *, int *, int *)); +#if defined(__cplusplus) +} +#endif + +/******************************************************* + * Locking + *******************************************************/ +#define DB_LOCKVERSION 1 +#define DB_LOCKMAGIC 0x090193 + +/* Flag values for lock_vec(). */ +#define DB_LOCK_NOWAIT 0x01 /* Don't wait on unavailable lock. */ + +/* Flag values for lock_detect(). */ +#define DB_LOCK_CONFLICT 0x01 /* Run on any conflict. */ + +/* + * Request types. + * + * XXX + * Changes here must be reflected in java/src/com/sleepycat/db/Db.java. + */ +typedef enum { + DB_LOCK_DUMP=0, /* Display held locks. */ + DB_LOCK_GET, /* Get the lock. */ + DB_LOCK_PUT, /* Release the lock. */ + DB_LOCK_PUT_ALL, /* Release locker's locks. */ + DB_LOCK_PUT_OBJ /* Release locker's locks on obj. */ +} db_lockop_t; + +/* + * Simple R/W lock modes and for multi-granularity intention locking. + * + * XXX + * Changes here must be reflected in java/src/com/sleepycat/db/Db.java. + */ +typedef enum { + DB_LOCK_NG=0, /* Not granted. */ + DB_LOCK_READ, /* Shared/read. */ + DB_LOCK_WRITE, /* Exclusive/write. */ + DB_LOCK_IREAD, /* Intent to share/read. */ + DB_LOCK_IWRITE, /* Intent exclusive/write. */ + DB_LOCK_IWR /* Intent to read and write. */ +} db_lockmode_t; + +/* + * Status of a lock. + */ +typedef enum { + DB_LSTAT_ABORTED, /* Lock belongs to an aborted txn. */ + DB_LSTAT_ERR, /* Lock is bad. */ + DB_LSTAT_FREE, /* Lock is unallocated. */ + DB_LSTAT_HELD, /* Lock is currently held. */ + DB_LSTAT_NOGRANT, /* Lock was not granted. */ + DB_LSTAT_PENDING, /* Lock was waiting and has been + * promoted; waiting for the owner + * to run and upgrade it to held. */ + DB_LSTAT_WAITING /* Lock is on the wait queue. */ +} db_status_t; + +/* Lock request structure. */ +struct __db_lockreq { + db_lockop_t op; /* Operation. */ + db_lockmode_t mode; /* Requested mode. */ + u_int32_t locker; /* Locker identity. */ + DBT *obj; /* Object being locked. */ + DB_LOCK lock; /* Lock returned. */ +}; + +/* + * Commonly used conflict matrices. + * + * Standard Read/Write (or exclusive/shared) locks. + */ +#define DB_LOCK_RW_N 3 +extern const u_int8_t db_rw_conflicts[]; + +/* Multi-granularity locking. */ +#define DB_LOCK_RIW_N 6 +extern const u_int8_t db_riw_conflicts[]; + +struct __db_lock_stat { + u_int32_t st_magic; /* Lock file magic number. */ + u_int32_t st_version; /* Lock file version number. */ + u_int32_t st_maxlocks; /* Maximum number of locks in table. */ + u_int32_t st_nmodes; /* Number of lock modes. */ + u_int32_t st_numobjs; /* Number of objects. */ + u_int32_t st_nlockers; /* Number of lockers. */ + 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_ndeadlocks; /* Number of lock deadlocks. */ + 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_refcnt; /* Region reference count. */ + u_int32_t st_regsize; /* Region size. */ +}; + +#if defined(__cplusplus) +extern "C" { +#endif +int lock_close __P((DB_LOCKTAB *)); +int lock_detect __P((DB_LOCKTAB *, u_int32_t, u_int32_t)); +int lock_get __P((DB_LOCKTAB *, + u_int32_t, u_int32_t, const DBT *, db_lockmode_t, DB_LOCK *)); +int lock_id __P((DB_LOCKTAB *, u_int32_t *)); +int lock_open __P((const char *, + u_int32_t, int, DB_ENV *, DB_LOCKTAB **)); +int lock_put __P((DB_LOCKTAB *, DB_LOCK)); +int lock_stat __P((DB_LOCKTAB *, DB_LOCK_STAT **, void *(*)(size_t))); +int lock_unlink __P((const char *, int, DB_ENV *)); +int lock_vec __P((DB_LOCKTAB *, + u_int32_t, u_int32_t, DB_LOCKREQ *, int, DB_LOCKREQ **)); +#if defined(__cplusplus) +} +#endif + +/******************************************************* + * Logging. + *******************************************************/ +/* 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. */ +}; + +/* Log statistics structure. */ +struct __db_log_stat { + u_int32_t st_magic; /* Log file magic number. */ + u_int32_t st_version; /* Log file version number. */ + int st_mode; /* Log file mode. */ + u_int32_t st_lg_max; /* Maximum log file size. */ + u_int32_t st_w_bytes; /* Bytes to log. */ + u_int32_t st_w_mbytes; /* Megabytes to log. */ + u_int32_t st_wc_bytes; /* Bytes to log since checkpoint. */ + u_int32_t st_wc_mbytes; /* Megabytes to log since checkpoint. */ + u_int32_t st_wcount; /* Total syncs to the log. */ + u_int32_t st_scount; /* Total writes to the log. */ + u_int32_t st_region_wait; /* Region lock granted after wait. */ + u_int32_t st_region_nowait; /* Region lock granted without wait. */ + u_int32_t st_cur_file; /* Current log file number. */ + u_int32_t st_cur_offset; /* Current log file offset. */ + u_int32_t st_refcnt; /* Region reference count. */ + u_int32_t st_regsize; /* Region size. */ +}; + +#if defined(__cplusplus) +extern "C" { +#endif +int log_archive __P((DB_LOG *, char **[], u_int32_t, void *(*)(size_t))); +int log_close __P((DB_LOG *)); +int log_compare __P((const DB_LSN *, const DB_LSN *)); +int log_file __P((DB_LOG *, const DB_LSN *, char *, size_t)); +int log_flush __P((DB_LOG *, const DB_LSN *)); +int log_get __P((DB_LOG *, DB_LSN *, DBT *, u_int32_t)); +int log_open __P((const char *, u_int32_t, int, DB_ENV *, DB_LOG **)); +int log_put __P((DB_LOG *, DB_LSN *, const DBT *, u_int32_t)); +int log_register __P((DB_LOG *, DB *, const char *, DBTYPE, u_int32_t *)); +int log_stat __P((DB_LOG *, DB_LOG_STAT **, void *(*)(size_t))); +int log_unlink __P((const char *, int, DB_ENV *)); +int log_unregister __P((DB_LOG *, u_int32_t)); +#if defined(__cplusplus) +} +#endif + +/******************************************************* + * Mpool + *******************************************************/ +/* Flag values for memp_fget(). */ +#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 memp_fput(), memp_fset(). */ +#define DB_MPOOL_CLEAN 0x001 /* Clear modified bit. */ +#define DB_MPOOL_DIRTY 0x002 /* Page is modified. */ +#define DB_MPOOL_DISCARD 0x004 /* Don't cache the page. */ + +/* Mpool statistics structure. */ +struct __db_mpool_stat { + size_t st_cachesize; /* Cache size. */ + u_int32_t st_cache_hit; /* Pages found in the cache. */ + u_int32_t st_cache_miss; /* Pages not found in the cache. */ + u_int32_t st_map; /* Pages from mapped files. */ + u_int32_t st_page_create; /* Pages created in the cache. */ + u_int32_t st_page_in; /* Pages read in. */ + u_int32_t st_page_out; /* Pages written out. */ + u_int32_t st_ro_evict; /* Clean pages forced from the cache. */ + u_int32_t st_rw_evict; /* Dirty pages forced from the cache. */ + u_int32_t st_hash_buckets; /* Number of hash buckets. */ + u_int32_t st_hash_searches; /* Total hash chain searches. */ + u_int32_t st_hash_longest; /* Longest hash chain searched. */ + u_int32_t st_hash_examined; /* Total hash entries searched. */ + u_int32_t st_page_clean; /* Clean pages. */ + u_int32_t st_page_dirty; /* Dirty pages. */ + u_int32_t st_page_trickle; /* Pages written by memp_trickle. */ + u_int32_t st_region_wait; /* Region lock granted after wait. */ + u_int32_t st_region_nowait; /* Region lock granted without wait. */ + u_int32_t st_refcnt; /* Region reference count. */ + u_int32_t st_regsize; /* Region size. */ +}; + +/* Mpool file open information structure. */ +struct __db_mpool_finfo { + 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. */ +}; + +/* Mpool file statistics structure. */ +struct __db_mpool_fstat { + char *file_name; /* File name. */ + size_t st_pagesize; /* Page size. */ + u_int32_t st_cache_hit; /* Pages found in the cache. */ + u_int32_t st_cache_miss; /* Pages not found in the cache. */ + u_int32_t st_map; /* Pages from mapped files. */ + u_int32_t st_page_create; /* Pages created in the cache. */ + u_int32_t st_page_in; /* Pages read in. */ + u_int32_t st_page_out; /* Pages written out. */ +}; + +#if defined(__cplusplus) +extern "C" { +#endif +int memp_close __P((DB_MPOOL *)); +int memp_fclose __P((DB_MPOOLFILE *)); +int memp_fget __P((DB_MPOOLFILE *, db_pgno_t *, u_int32_t, void *)); +int memp_fopen __P((DB_MPOOL *, const char *, + u_int32_t, int, size_t, DB_MPOOL_FINFO *, DB_MPOOLFILE **)); +int memp_fput __P((DB_MPOOLFILE *, void *, u_int32_t)); +int memp_fset __P((DB_MPOOLFILE *, void *, u_int32_t)); +int memp_fsync __P((DB_MPOOLFILE *)); +int memp_open __P((const char *, u_int32_t, int, DB_ENV *, DB_MPOOL **)); +int memp_register __P((DB_MPOOL *, int, + int (*)(db_pgno_t, void *, DBT *), + int (*)(db_pgno_t, void *, DBT *))); +int memp_stat __P((DB_MPOOL *, + DB_MPOOL_STAT **, DB_MPOOL_FSTAT ***, void *(*)(size_t))); +int memp_sync __P((DB_MPOOL *, DB_LSN *)); +int memp_trickle __P((DB_MPOOL *, int, int *)); +int memp_unlink __P((const char *, int, DB_ENV *)); +#if defined(__cplusplus) +} +#endif + +/******************************************************* + * Transactions. + *******************************************************/ +#define DB_TXNVERSION 1 +#define DB_TXNMAGIC 0x041593 + +/* Operations values to the tx_recover() function. */ +#define DB_TXN_BACKWARD_ROLL 1 /* Read the log backwards. */ +#define DB_TXN_FORWARD_ROLL 2 /* Read the log forwards. */ +#define DB_TXN_OPENFILES 3 /* Read for open files. */ +#define DB_TXN_REDO 4 /* Redo the operation. */ +#define DB_TXN_UNDO 5 /* Undo the operation. */ + +/* Internal transaction status values. */ + +/* Transaction statistics structure. */ +struct __db_txn_active { + u_int32_t txnid; /* Transaction ID */ + DB_LSN lsn; /* Lsn of the begin record */ +}; + +struct __db_txn_stat { + DB_LSN st_last_ckp; /* lsn of the last checkpoint */ + DB_LSN st_pending_ckp; /* last checkpoint did not finish */ + 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 number of active txns */ + 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 */ + 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_refcnt; /* Region reference count. */ + u_int32_t st_regsize; /* Region size. */ +}; + +#if defined(__cplusplus) +extern "C" { +#endif +int txn_abort __P((DB_TXN *)); +int txn_begin __P((DB_TXNMGR *, DB_TXN *, DB_TXN **)); +int txn_checkpoint __P((const DB_TXNMGR *, u_int32_t, u_int32_t)); +int txn_commit __P((DB_TXN *)); +int txn_close __P((DB_TXNMGR *)); +u_int32_t txn_id __P((DB_TXN *)); +int txn_open __P((const char *, u_int32_t, int, DB_ENV *, DB_TXNMGR **)); +int txn_prepare __P((DB_TXN *)); +int txn_stat __P((DB_TXNMGR *, DB_TXN_STAT **, void *(*)(size_t))); +int txn_unlink __P((const char *, int, DB_ENV *)); +#if defined(__cplusplus) +} +#endif + +#ifndef DB_DBM_HSEARCH +#define DB_DBM_HSEARCH 0 /* No historic interfaces by default. */ +#endif +#if DB_DBM_HSEARCH != 0 +/******************************************************* + * Dbm/Ndbm historic interfaces. + *******************************************************/ +#define DBM_INSERT 0 /* Flags to dbm_store(). */ +#define DBM_REPLACE 1 + +/* + * The db(3) 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 DBM calls into DB calls so that DB doesn't step on the + * application's name space. + * + * The global variables dbrdonly, dirf and pagf were not retained when + * 4BSD replaced the dbm interface with ndbm, and are not support here. + */ +#define dbminit(a) __db_dbm_init(a) +#if !defined(__cplusplus) +#define delete(a) __db_dbm_delete(a) +#endif +#define fetch(a) __db_dbm_fetch(a) +#define firstkey __db_dbm_firstkey +#define nextkey(a) __db_dbm_nextkey(a) +#define store(a, b) __db_dbm_store(a, b) + +/* Prototype the DB calls. */ +#if defined(__cplusplus) +extern "C" { +#endif +int __db_dbm_init __P((char *)); +int __db_dbm_delete __P((datum)); +int __db_dbm_dbrdonly __P((void)); +int __db_dbm_dirf __P((void)); +datum __db_dbm_fetch __P((datum)); +datum __db_dbm_firstkey __P((void)); +datum __db_dbm_nextkey __P((datum)); +int __db_dbm_pagf __P((void)); +int __db_dbm_store __P((datum, datum)); +#if defined(__cplusplus) +} +#endif + +/* + * 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(a) +#define dbm_close(a) __db_ndbm_close(a) +#define dbm_delete(a, b) __db_ndbm_delete(a, b) +#define dbm_dirfno(a) __db_ndbm_dirfno(a) +#define dbm_error(a) __db_ndbm_error(a) +#define dbm_fetch(a, b) __db_ndbm_fetch(a, b) +#define dbm_firstkey(a) __db_ndbm_firstkey(a) +#define dbm_nextkey(a) __db_ndbm_nextkey(a) +#define dbm_open(a, b, c) __db_ndbm_open(a, b, c) +#define dbm_pagfno(a) __db_ndbm_pagfno(a) +#define dbm_rdonly(a) __db_ndbm_rdonly(a) +#define dbm_store(a, b, c, d) __db_ndbm_store(a, b, c, d) + +/* Prototype the DB calls. */ +#if defined(__cplusplus) +extern "C" { +#endif +int __db_ndbm_clearerr __P((DBM *)); +void __db_ndbm_close __P((DBM *)); +int __db_ndbm_delete __P((DBM *, datum)); +int __db_ndbm_dirfno __P((DBM *)); +int __db_ndbm_error __P((DBM *)); +datum __db_ndbm_fetch __P((DBM *, datum)); +datum __db_ndbm_firstkey __P((DBM *)); +datum __db_ndbm_nextkey __P((DBM *)); +DBM *__db_ndbm_open __P((const char *, int, int)); +int __db_ndbm_pagfno __P((DBM *)); +int __db_ndbm_rdonly __P((DBM *)); +int __db_ndbm_store __P((DBM *, datum, datum, int)); +#if defined(__cplusplus) +} +#endif + +/******************************************************* + * Hsearch historic interface. + *******************************************************/ +typedef enum { + FIND, ENTER +} ACTION; + +typedef struct entry { + char *key; + char *data; +} ENTRY; + +/* + * Translate HSEARCH calls into DB calls so that DB doesn't step on the + * application's name space. + */ +#define hcreate(a) __db_hcreate(a) +#define hdestroy __db_hdestroy +#define hsearch(a, b) __db_hsearch(a, b) + +/* Prototype the DB calls. */ +#if defined(__cplusplus) +extern "C" { +#endif +int __db_hcreate __P((size_t)); +void __db_hdestroy __P((void)); +ENTRY *__db_hsearch __P((ENTRY, ACTION)); +#if defined(__cplusplus) +} +#endif +#endif /* DB_DBM_HSEARCH */ + +/* + * XXX + * MacOS: Reset Metrowerks C enum sizes. + */ +#ifdef __MWERKS__ +#pragma enumsalwaysint reset +#endif +#endif /* !_DB_H_ */ diff --git a/mozilla/db/build.win16/db_int.h b/mozilla/db/build.win16/db_int.h new file mode 100644 index 00000000000..910fcc2452a --- /dev/null +++ b/mozilla/db/build.win16/db_int.h @@ -0,0 +1,401 @@ +/* DO NOT EDIT: automatically built by dist/distrib. */ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)db_int.h.src 10.62 (Sleepycat) 5/23/98 + */ + +#ifndef _DB_INTERNAL_H_ +#define _DB_INTERNAL_H_ + +#include "db.h" /* Standard DB include file. */ +#include "queue.h" + +/******************************************************* + * General purpose constants and macros. + *******************************************************/ +#define UINT16_T_MAX 0xffff /* Maximum 16 bit unsigned. */ +#define UINT32_T_MAX 0xffffffff /* Maximum 32 bit unsigned. */ + +#define DB_MIN_PGSIZE 0x000200 /* Minimum page size. */ +#define DB_MAX_PGSIZE 0x010000 /* Maximum page size. */ + +#define DB_MINCACHE 10 /* Minimum cached pages */ + +#define MEGABYTE 1048576 + +/* + * If we are unable to determine the underlying filesystem block size, use + * 8K on the grounds that most OS's use less than 8K as their VM page size. + */ +#define DB_DEF_IOSIZE (8 * 1024) + +/* + * Aligning items to particular sizes or in pages or memory. ALIGNP is a + * separate macro, as we've had to cast the pointer to different integral + * types on different architectures. + * + * We cast pointers into unsigned longs when manipulating them because C89 + * guarantees that u_long is the largest available integral type and further, + * to never generate overflows. However, neither C89 or C9X requires that + * any integer type be large enough to hold a pointer, although C9X created + * the intptr_t type, which is guaranteed to hold a pointer but may or may + * not exist. At some point in the future, we should test for intptr_t and + * use it where available. + */ +#undef ALIGNTYPE +#define ALIGNTYPE u_long +#undef ALIGNP +#define ALIGNP(value, bound) ALIGN((ALIGNTYPE)value, bound) +#undef ALIGN +#define ALIGN(value, bound) (((value) + (bound) - 1) & ~((bound) - 1)) + +/* + * 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) ((int)&(((name *)0)->field)) + +#undef SSZA +#define SSZA(name, field) ((int)&(((name *)0)->field[0])) + +/* Macros to return per-process address, offsets based on shared regions. */ +#define R_ADDR(base, offset) ((void *)((u_int8_t *)((base)->addr) + offset)) +#define R_OFFSET(base, p) ((u_int8_t *)(p) - (u_int8_t *)(base)->addr) + +/* Free and free-string macros that overwrite memory. */ +#ifdef DIAGNOSTIC +#undef FREE +#define FREE(p, len) { \ + memset(p, 0xff, len); \ + __db_free(p); \ +} +#undef FREES +#define FREES(p) { \ + FREE(p, strlen(p)); \ +} +#else +#undef FREE +#define FREE(p, len) { \ + __db_free(p); \ +} +#undef FREES +#define FREES(p) { \ + __db_free(p); \ +} +#endif + +/* 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 F_SET(p, f) (p)->flags |= (f) +#define F_CLR(p, f) (p)->flags &= ~(f) +#define F_ISSET(p, f) ((p)->flags & (f)) +#define LF_SET(f) (flags |= (f)) +#define LF_CLR(f) (flags &= ~(f)) +#define LF_ISSET(f) (flags & (f)) + +/* Display separator string. */ +#undef DB_LINE +#define DB_LINE "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" + +/* Global variables. */ +typedef struct __db_globals { + int db_mutexlocks; /* DB_MUTEXLOCKS */ + int db_region_anon; /* DB_REGION_ANON, DB_REGION_NAME */ + int db_region_init; /* DB_REGION_INIT */ + int db_tsl_spins; /* DB_TSL_SPINS */ + int db_pageyield; /* DB_PAGEYIELD */ +} DB_GLOBALS; +extern DB_GLOBALS __db_global_values; +#define DB_GLOBAL(v) __db_global_values.v + +/* Unused, or not-used-yet variable. "Shut that bloody compiler up!" */ +#define COMPQUIET(n, v) (n) = (v) + +/* + * Win16 needs specific syntax on callback functions. Nobody else cares. + */ +#ifndef DB_CALLBACK +#define DB_CALLBACK /* Nothing. */ +#endif + +/******************************************************* + * 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 , + * and that file isn't always available. + */ +#undef MAXPATHLEN +#define MAXPATHLEN 1024 + +#define PATH_DOT "." /* Current working directory. */ +#define PATH_SEPARATOR "\\/" /* Path separator character. */ + +/******************************************************* + * Mutex support. + *******************************************************/ +typedef unsigned int tsl_t; + +/* + * !!! + * Various systems require different alignments for mutexes (the worst we've + * seen so far is 16-bytes on some HP architectures). The mutex (tsl_t) must + * be first in the db_mutex_t structure, which must itself be first in the + * region. This ensures the alignment is as returned by mmap(2), which should + * be sufficient. All other mutex users must ensure proper alignment locally. + */ +#define MUTEX_ALIGNMENT sizeof(unsigned int) + +/* + * The offset of a mutex in memory. + * + * !!! + * Not an u_int32_t, so backing file offsets MUST be less than 4Gb. See the + * off field of the db_mutex_t as well. + */ +#define MUTEX_LOCK_OFFSET(a, b) ((u_int32_t)((u_int8_t *)b - (u_int8_t *)a)) + +typedef struct _db_mutex_t { +#ifdef HAVE_SPINLOCKS + tsl_t tsl_resource; /* Resource test and set. */ +#ifdef DIAGNOSTIC + u_int32_t pid; /* Lock holder: 0 or process pid. */ +#endif +#else + u_int32_t off; /* Backing file offset. */ + u_int32_t pid; /* Lock holder: 0 or process pid. */ +#endif + u_int32_t spins; /* Spins before block. */ + u_int32_t mutex_set_wait; /* Granted after wait. */ + u_int32_t mutex_set_nowait; /* Granted without waiting. */ +} db_mutex_t; + +#include "mutex_ext.h" + +/******************************************************* + * Access methods. + *******************************************************/ +/* Lock/unlock a DB thread. */ +#define DB_THREAD_LOCK(dbp) \ + if (F_ISSET(dbp, DB_AM_THREAD)) \ + (void)__db_mutex_lock((db_mutex_t *)(dbp)->mutexp, -1); +#define DB_THREAD_UNLOCK(dbp) \ + if (F_ISSET(dbp, DB_AM_THREAD)) \ + (void)__db_mutex_unlock((db_mutex_t *)(dbp)->mutexp, -1); + +/* Btree/recno local statistics structure. */ +struct __db_bt_lstat; typedef struct __db_bt_lstat DB_BTREE_LSTAT; +struct __db_bt_lstat { + u_int32_t bt_freed; /* Pages freed for reuse. */ + u_int32_t bt_pfxsaved; /* Bytes saved by prefix compression. */ + u_int32_t bt_split; /* Total number of splits. */ + u_int32_t bt_rootsplit; /* Root page splits. */ + u_int32_t bt_fastsplit; /* Fast splits. */ + u_int32_t bt_added; /* Items added. */ + u_int32_t bt_deleted; /* Items deleted. */ + u_int32_t bt_get; /* Items retrieved. */ + u_int32_t bt_cache_hit; /* Hits in fast-insert code. */ + u_int32_t bt_cache_miss; /* Misses in fast-insert code. */ +}; + +/******************************************************* + * 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; + +/******************************************************* + * Shared memory regions. + *******************************************************/ +/* + * The shared memory regions share an initial structure so that the general + * region code can handle races between the region being deleted and other + * processes waiting on the region mutex. + * + * !!! + * Note, the mutex must be the first entry in the region; see comment above. + */ +typedef struct _rlayout { + db_mutex_t lock; /* Region mutex. */ +#define DB_REGIONMAGIC 0x120897 + u_int32_t valid; /* Valid magic number. */ + u_int32_t refcnt; /* Region reference count. */ + size_t size; /* Region length. */ + int majver; /* Major version number. */ + int minver; /* Minor version number. */ + int patch; /* Patch version number. */ +#define INVALID_SEGID -1 + int segid; /* shmget(2) ID, or Win16 segment ID. */ + +#define REGION_ANONYMOUS 0x01 /* Region is/should be in anon mem. */ + u_int32_t flags; +} RLAYOUT; + +/* + * DB creates all regions on 4K boundaries out of sheer paranoia, so that + * we don't make the underlying VM unhappy. + */ +#define DB_VMPAGESIZE (4 * 1024) +#define DB_ROUNDOFF(i) { \ + (i) += DB_VMPAGESIZE - 1; \ + (i) -= (i) % DB_VMPAGESIZE; \ +} + +/* + * The interface to region attach is nasty, there is a lot of complex stuff + * going on, which has to be retained between create/attach and detach. The + * REGINFO structure keeps track of it. + */ +struct __db_reginfo; typedef struct __db_reginfo REGINFO; +struct __db_reginfo { + /* Arguments. */ + DB_ENV *dbenv; /* Region naming info. */ + APPNAME appname; /* Region naming info. */ + char *path; /* Region naming info. */ + const char *file; /* Region naming info. */ + int mode; /* Region mode, if a file. */ + size_t size; /* Region size. */ + u_int32_t dbflags; /* Region file open flags, if a file. */ + + /* Results. */ + char *name; /* Region name. */ + void *addr; /* Region address. */ + int fd; /* Fcntl(2) locking file descriptor. + NB: this is only valid if a regular + file is backing the shared region, + and mmap(2) is being used to map it + into our address space. */ + int segid; /* shmget(2) ID, or Win16 segment ID. */ + + /* Shared flags. */ +/* 0x0001 COMMON MASK with RLAYOUT structure. */ +#define REGION_CANGROW 0x0002 /* Can grow. */ +#define REGION_CREATED 0x0004 /* Created. */ +#define REGION_HOLDINGSYS 0x0008 /* Holding system resources. */ +#define REGION_LASTDETACH 0x0010 /* Delete on last detach. */ +#define REGION_MALLOC 0x0020 /* Created in malloc'd memory. */ +#define REGION_PRIVATE 0x0040 /* Private to thread/process. */ +#define REGION_REMOVED 0x0080 /* Already deleted. */ +#define REGION_SIZEDEF 0x0100 /* Use default region size if exists. */ + u_int32_t flags; +}; + +/******************************************************* + * Mpool. + *******************************************************/ +/* + * File types for DB access methods. Negative numbers are reserved to DB. + */ +#define DB_FTYPE_BTREE -1 /* Btree. */ +#define DB_FTYPE_HASH -2 /* Hash. */ + +/* Structure used as the DB pgin/pgout pgcookie. */ +typedef struct __dbpginfo { + size_t db_pagesize; /* Underlying page size. */ + int needswap; /* If swapping required. */ +} DB_PGINFO; + +/******************************************************* + * Log. + *******************************************************/ +/* Initialize an LSN to 'zero'. */ +#define ZERO_LSN(LSN) { \ + (LSN).file = 0; \ + (LSN).offset = 0; \ +} + +/* Return 1 if LSN is a 'zero' lsn, otherwise return 0. */ +#define IS_ZERO_LSN(LSN) ((LSN).file == 0) + +/* Test if we need to log a change. */ +#define DB_LOGGING(dbp) \ + (F_ISSET(dbp, DB_AM_LOGGING) && !F_ISSET(dbp, DB_AM_RECOVER)) + +#ifdef DIAGNOSTIC +/* + * 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(D, T, O, K, A, F) { \ + DB_LSN _lsn; \ + DBT _op; \ + if (DB_LOGGING((D))) { \ + memset(&_op, 0, sizeof(_op)); \ + _op.data = O; \ + _op.size = strlen(O) + 1; \ + (void)__db_debug_log((D)->dbenv->lg_info, \ + T, &_lsn, 0, &_op, (D)->log_fileid, K, A, F); \ + } \ +} +#ifdef DEBUG_ROP +#define DEBUG_LREAD(D, T, O, K, A, F) LOG_OP(D, T, O, K, A, F) +#else +#define DEBUG_LREAD(D, T, O, K, A, F) +#endif +#ifdef DEBUG_WOP +#define DEBUG_LWRITE(D, T, O, K, A, F) LOG_OP(D, T, O, K, A, F) +#else +#define DEBUG_LWRITE(D, T, O, K, A, F) +#endif +#else +#define DEBUG_LREAD(D, T, O, K, A, F) +#define DEBUG_LWRITE(D, T, O, K, A, F) +#endif /* DIAGNOSTIC */ + +/******************************************************* + * Transactions and recovery. + *******************************************************/ +/* + * Out of band value for a lock. The locks are returned to callers as offsets + * into the lock regions. Since the RLAYOUT structure begins all regions, an + * offset of 0 is guaranteed not to be a valid lock. + */ +#define LOCK_INVALID 0 + +/* The structure allocated for every transaction. */ +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. */ + size_t off; /* Detail structure within region. */ + TAILQ_ENTRY(__db_txn) links; +}; + +#include "os_func.h" +#include "os_ext.h" + +#endif /* !_DB_INTERNAL_H_ */ diff --git a/mozilla/db/build.win16/dllmain.c b/mozilla/db/build.win16/dllmain.c new file mode 100644 index 00000000000..4381e9467a6 --- /dev/null +++ b/mozilla/db/build.win16/dllmain.c @@ -0,0 +1,28 @@ +/* + * "@(#)dllmain.c 10.2 (Netscape) 4/25/98"; + */ + +#include + +extern int __os_segdata_init(void); +extern int __os_segdata_destroy(void); + +int FAR PASCAL LibMain(HANDLE hInstance, WORD wDataSeg, + WORD wHeapSize, LPSTR lpszCmdLine) +{ + if( wHeapSize > 0 ) { + UnlockData(0); + } + + if( 0 != __os_segdata_init() ) { + return 0; + } + + return 1; +} + +int FAR PASCAL _export WEP(int nParam) +{ + (void)__os_segdata_destroy(); + return 1; +} diff --git a/mozilla/db/build.win32/.dbtestrc b/mozilla/db/build.win32/.dbtestrc new file mode 100644 index 00000000000..6adbc51473f --- /dev/null +++ b/mozilla/db/build.win32/.dbtestrc @@ -0,0 +1,326 @@ +# DO NOT EDIT: automatically built by dist/distrib. +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test.tcl 10.28 (Sleepycat) 5/31/98 + +source ./include.tcl +source ../test/testutils.tcl +source ../test/byteorder.tcl + +set testdir ./TESTDIR +if { [file exists $testdir] != 1 } { + exec $MKDIR $testdir +} + +set is_windows_test 1 + +set parms(test001) 10000 +set parms(test002) 10000 +set parms(test003) "" +set parms(test004) {10000 4 0} +set parms(test005) 10000 +set parms(test006) {10000 6} +set parms(test007) 10000 +set parms(test008) {10000 8 0} +set parms(test009) 10000 +set parms(test010) {10000 5 10} +set parms(test011) {10000 5 11} +set parms(test012) "" +set parms(test013) 10000 +set parms(test014) 10000 +set parms(test015) {7500 0} +set parms(test016) 10000 +set parms(test017) 10000 +set parms(test018) 10000 +set parms(test019) 10000 +set parms(test020) 10000 +set parms(test021) 10000 +set parms(test022) "" +set parms(test023) "" +set parms(test024) 10000 +set parms(test025) 10000 +set parms(test026) {2000 5 26} +set parms(test027) {100} +set parms(test028) "" +set parms(test029) 10000 + +set dict ../test/wordlist +set alphabet "abcdefghijklmnopqrstuvwxyz" +set recd_debug 0 + +set loadtests 33 +set runtests 29 +set recdtests 5 +set deadtests 2 +set bugtests 7 +set rsrctests 1 +for { set i 1 } { $i <= $loadtests } {incr i} { + set name [format "test%03d.tcl" $i] + source ../test/$name +} +for { set i 1 } { $i <= $recdtests } {incr i} { + set name [format "recd%03d.tcl" $i] + source ../test/$name +} +for { set i 1 } { $i <= $deadtests } {incr i} { + set name [format "dead%03d.tcl" $i] + source ../test/$name +} +for { set i 1 } { $i <= $bugtests } {incr i} { + set name [format "bug%03d.tcl" $i] + source ../test/$name +} +for { set i 1 } { $i <= $rsrctests } {incr i} { + set name [format "rsrc%03d.tcl" $i] + source ../test/$name +} + +source ../test/archive.tcl +source ../test/dbm.tcl +source ../test/hsearch.tcl +source ../test/lock.tcl +source ../test/mpool.tcl +source ../test/mlock.tcl +source ../test/mutex.tcl +source ../test/ndbm.tcl +source ../test/randomlock.tcl +source ../test/log.tcl +source ../test/txn.tcl + +# Test driver programs + +# Use args for options +proc run_method { method {start 1} {stop 0} args } { + global parms + global debug_print + global debug_on + global runtests + if { $stop == 0 } { + set stop $runtests + } + puts "run_method: $method $start $stop $args" + + for { set i $start } { $i <= $stop } {incr i} { + puts "[timestamp]" + set name [format "test%03d" $i] + eval $name $method $parms($name) $args + if { $debug_print != 0 } { + puts "" + } + if { $debug_on != 0 } { + debug + } + flush stdout + flush stderr + } +} + +proc r { args } { + global recdtests + + set l [ lindex $args 0 ] + switch $l { + ampool { eval mpool -shmem anon [lrange $args 1 end] } + archive { eval archive [lrange $args 1 end] } + byte { + foreach method "DB_HASH DB_BTREE DB_RECNO DB_RRECNO" { + byteorder $method + } + } + dbm { eval dbm } + dead { + eval dead001 [lrange $args 1 end] + eval dead002 [lrange $args 1 end] + } + hsearch { eval htest } + lock { eval locktest [lrange $args 1 end] } + log { eval logtest [lrange $args 1 end] } + mpool { eval mpool [lrange $args 1 end] } + nmpool { eval mpool -shmem named [lrange $args 1 end] } + mutex { eval mutex [lrange $args 1 end] } + ndbm { eval ndbm } + recd { + foreach method "DB_HASH DB_BTREE DB_RECNO DB_RRECNO" { + for { set i 1 } {$i <= $recdtests} {incr i} { + set name [format "recd%03d" $i] + eval $name $method + flush stdout + flush stderr + } + } + } + rsrc { + eval rsrc001 + } + txn { eval txntest [lrange $args 1 end] } + default { eval run_method $args } + } + flush stdout + flush stderr +} + +proc run_all { } { +source include.tcl +global runtests +global recdtests + exec $RM -rf ALL.OUT + foreach i "archive byte lock log mpool ampool nmpool mutex txn" { + puts "Running $i tests" + if [catch {exec ./dbtest << "r $i" >>& ALL.OUT } res] { + set o [open ALL.OUT a] + puts $o "FAIL: $i test" + close $o + } + } + + # Add deadlock detector tests + puts "Running deadlock detection tests." + if [catch {exec ./dbtest << "r dead" >>& ALL.OUT} res] { + set o [open ALL.OUT a] + puts $o "FAIL: deadlock detector test" + close $o + } + + + foreach i "DB_BTREE DB_RBTREE DB_HASH DB_RECNO DB_RRECNO" { + puts "Running $i tests" + for { set j 1 } { $j <= $runtests } {incr j} { + if [catch {exec ./dbtest << "run_method $i $j $j" \ + >>& ALL.OUT } res] { + set o [open ALL.OUT a] + puts $o "FAIL: [format "test%03d" $j] $i" + close $o + } + } + } + + puts "Running RECNO source tests" + if [catch {exec ./dbtest << "r rsrc" >>& ALL.OUT } res] { + set o [open ALL.OUT a] + puts $o "FAIL: $i test" + close $o + } + + # Run recovery tests + foreach method "DB_HASH DB_BTREE DB_RECNO DB_RRECNO" { + puts "Running recovery tests for $method" + for { set i 1 } {$i <= $recdtests} {incr i} { + set name [format "recd%03d" $i] + if [catch {exec ./dbtest << "$name $method" \ + >>& ALL.OUT } res] { + set o [open ALL.OUT a] + puts $o "FAIL: $name $method" + close $o + } + } + } + + # Check historic interfaces + foreach t "dbm ndbm hsearch" { + if [catch {exec ./dbtest << "r $t" >>& ALL.OUT} res] { + set o [open ALL.OUT a] + puts $o "FAIL: $t test" + close $o + } + } + + catch { exec $SED -e /^FAIL/p -e d ALL.OUT } res + if { [string length $res] == 0 } { + puts "Regression Tests Succeeded" + } else { + puts "Regression Tests Failed; see ALL.OUT for log" + } +} + +proc convert_method { method } { + switch $method { + rrecno { return DB_RECNO } + RRECNO { return DB_RECNO } + db_rrecno { return DB_RECNO } + DB_RRECNO { return DB_RECNO } + rrec { return DB_RECNO } + recno { return DB_RECNO } + RECNO { return DB_RECNO } + db_recno { return DB_RECNO } + DB_RECNO { return DB_RECNO } + rec { return DB_RECNO } + btree { return DB_BTREE } + BTREE { return DB_BTREE } + db_btree { return DB_BTREE } + DB_BTREE { return DB_BTREE } + bt { return DB_BTREE } + rbtree { return DB_BTREE } + RBTREE { return DB_BTREE } + db_rbtree { return DB_BTREE } + DB_RBTREE { return DB_BTREE } + rbt { return DB_BTREE } + hash { return DB_HASH } + HASH { return DB_HASH } + db_hash { return DB_HASH } + DB_HASH { return DB_HASH } + h { return DB_HASH } + } +} + +proc is_rrecno { method } { + set names { rrecno RRECNO db_rrecno DB_RRECNO rrec } + if { [lsearch $names $method] >= 0 } { + return 1 + } else { + return 0 + } +} + +proc is_rbtree { method } { + set names { rbtree RBTREE db_rbtree DB_RBTREE rbt } + if { [lsearch $names $method] >= 0 } { + return 1 + } else { + return 0 + } +} + + +# If recno-with-renumbering or btree-with-renumbering is specified, then +# fix the arguments to specify the DB_RENUMBER/DB_RECNUM option for the +# -flags argument. +proc convert_args { method {largs ""} } { +source ./include.tcl + set do_flags 0 + if { [is_rrecno $method] == 1 } { + return [add_to_args $DB_RENUMBER $largs] + } elseif { [is_rbtree $method] == 1 } { + return [add_to_args $DB_RECNUM $largs] + } + return $largs +} + +# Make sure the DB_RECNUM flag is set if we are doing btree. +proc number_btree { method {largs ""} } { +source ./include.tcl + if { [string compare $method "DB_BTREE"] == 0 } { + return [add_to_args $DB_RECNUM $largs] + } + return $largs +} + +# We want to set a flag value. Since there already might be one in +# args, we need to add to it. +proc add_to_args { flag_val {largs ""} } { +source ./include.tcl + set ndx [lsearch $largs -flags] + if { $ndx >= 0 } { + # There is already a flags argument + incr ndx + set f [lindex $largs $ndx] + set f [expr $f | $flag_val] + set largs [lreplace $largs $ndx $ndx $f] + } else { + # There is no flags argument + lappend largs -flags $flag_val + } + return $largs +} diff --git a/mozilla/db/build.win32/Berkeley_DB.dsw b/mozilla/db/build.win32/Berkeley_DB.dsw new file mode 100644 index 00000000000..c74ae53f02f --- /dev/null +++ b/mozilla/db/build.win32/Berkeley_DB.dsw @@ -0,0 +1,398 @@ +Microsoft Developer Studio Workspace File, Format Version 5.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "DB_DLL"=.\DB_DLL.DSP - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "DB_Static"=.\DB_Static.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "db_archive"=.\db_archive.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name DB_DLL + End Project Dependency +}}} + +############################################################################### + +Project: "db_buildall"=.\db_buildall.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name db_archive + End Project Dependency + Begin Project Dependency + Project_Dep_Name db_checkpoint + End Project Dependency + Begin Project Dependency + Project_Dep_Name db_deadlock + End Project Dependency + Begin Project Dependency + Project_Dep_Name DB_DLL + End Project Dependency + Begin Project Dependency + Project_Dep_Name db_dump + End Project Dependency + Begin Project Dependency + Project_Dep_Name db_load + End Project Dependency + Begin Project Dependency + Project_Dep_Name db_printlog + End Project Dependency + Begin Project Dependency + Project_Dep_Name db_recover + End Project Dependency + Begin Project Dependency + Project_Dep_Name db_stat + End Project Dependency + Begin Project Dependency + Project_Dep_Name DB_Static + End Project Dependency + Begin Project Dependency + Project_Dep_Name ex_access + End Project Dependency + Begin Project Dependency + Project_Dep_Name ex_appinit + End Project Dependency + Begin Project Dependency + Project_Dep_Name ex_lock + End Project Dependency + Begin Project Dependency + Project_Dep_Name ex_mpool + End Project Dependency + Begin Project Dependency + Project_Dep_Name ex_tpcb + End Project Dependency + Begin Project Dependency + Project_Dep_Name excxx_access + End Project Dependency + Begin Project Dependency + Project_Dep_Name excxx_appinit + End Project Dependency + Begin Project Dependency + Project_Dep_Name excxx_lock + End Project Dependency + Begin Project Dependency + Project_Dep_Name excxx_mpool + End Project Dependency + Begin Project Dependency + Project_Dep_Name excxx_tpcb + End Project Dependency +}}} + +############################################################################### + +Project: "db_checkpoint"=.\db_checkpoint.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name DB_DLL + End Project Dependency +}}} + +############################################################################### + +Project: "db_deadlock"=.\db_deadlock.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name DB_DLL + End Project Dependency +}}} + +############################################################################### + +Project: "db_dump"=.\db_dump.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name DB_DLL + End Project Dependency +}}} + +############################################################################### + +Project: "db_load"=.\db_load.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name DB_DLL + End Project Dependency +}}} + +############################################################################### + +Project: "db_printlog"=.\db_printlog.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name DB_DLL + End Project Dependency +}}} + +############################################################################### + +Project: "db_recover"=.\db_recover.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name DB_DLL + End Project Dependency +}}} + +############################################################################### + +Project: "db_stat"=.\db_stat.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name DB_DLL + End Project Dependency +}}} + +############################################################################### + +Project: "dbtest"=.\dbtest.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name DB_Static + End Project Dependency +}}} + +############################################################################### + +Project: "ex_access"=.\ex_access.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name DB_DLL + End Project Dependency +}}} + +############################################################################### + +Project: "ex_appinit"=.\ex_appinit.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name DB_DLL + End Project Dependency +}}} + +############################################################################### + +Project: "ex_lock"=.\ex_lock.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name DB_DLL + End Project Dependency +}}} + +############################################################################### + +Project: "ex_mpool"=.\ex_mpool.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name DB_DLL + End Project Dependency +}}} + +############################################################################### + +Project: "ex_tpcb"=.\ex_tpcb.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name DB_DLL + End Project Dependency +}}} + +############################################################################### + +Project: "excxx_access"=.\excxx_access.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name DB_DLL + End Project Dependency +}}} + +############################################################################### + +Project: "excxx_appinit"=.\excxx_appinit.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name DB_DLL + End Project Dependency +}}} + +############################################################################### + +Project: "excxx_lock"=.\excxx_lock.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name DB_DLL + End Project Dependency +}}} + +############################################################################### + +Project: "excxx_mpool"=.\excxx_mpool.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name DB_DLL + End Project Dependency +}}} + +############################################################################### + +Project: "excxx_tpcb"=.\excxx_tpcb.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name DB_DLL + End Project Dependency +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/mozilla/db/build.win32/DB_DLL.mak b/mozilla/db/build.win32/DB_DLL.mak new file mode 100644 index 00000000000..7aad4dd06a8 --- /dev/null +++ b/mozilla/db/build.win32/DB_DLL.mak @@ -0,0 +1,3086 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +!IF "$(CFG)" == "" +CFG=DB_DLL - Win32 Debug +!MESSAGE No configuration specified. Defaulting to DB_DLL - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "DB_DLL - Win32 Release" && "$(CFG)" != "DB_DLL - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "DB_DLL.mak" CFG="DB_DLL - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "DB_DLL - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "DB_DLL - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "DB_DLL - Win32 Debug" +CPP=cl.exe +MTL=mktyplib.exe +RSC=rc.exe + +!IF "$(CFG)" == "DB_DLL - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "DB_DLL__" +# PROP BASE Intermediate_Dir "DB_DLL__" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +OUTDIR=.\Release +INTDIR=.\Release + +ALL : "$(OUTDIR)\libdb.dll" + +CLEAN : + -@erase "$(INTDIR)\bt_close.obj" + -@erase "$(INTDIR)\bt_compare.obj" + -@erase "$(INTDIR)\bt_conv.obj" + -@erase "$(INTDIR)\bt_cursor.obj" + -@erase "$(INTDIR)\bt_delete.obj" + -@erase "$(INTDIR)\bt_open.obj" + -@erase "$(INTDIR)\bt_page.obj" + -@erase "$(INTDIR)\bt_put.obj" + -@erase "$(INTDIR)\bt_rec.obj" + -@erase "$(INTDIR)\bt_recno.obj" + -@erase "$(INTDIR)\bt_rsearch.obj" + -@erase "$(INTDIR)\bt_search.obj" + -@erase "$(INTDIR)\bt_split.obj" + -@erase "$(INTDIR)\bt_stat.obj" + -@erase "$(INTDIR)\btree_auto.obj" + -@erase "$(INTDIR)\cxx_app.obj" + -@erase "$(INTDIR)\cxx_except.obj" + -@erase "$(INTDIR)\cxx_lock.obj" + -@erase "$(INTDIR)\cxx_log.obj" + -@erase "$(INTDIR)\cxx_mpool.obj" + -@erase "$(INTDIR)\cxx_table.obj" + -@erase "$(INTDIR)\cxx_txn.obj" + -@erase "$(INTDIR)\db.obj" + -@erase "$(INTDIR)\db_appinit.obj" + -@erase "$(INTDIR)\db_apprec.obj" + -@erase "$(INTDIR)\db_auto.obj" + -@erase "$(INTDIR)\db_byteorder.obj" + -@erase "$(INTDIR)\db_conv.obj" + -@erase "$(INTDIR)\db_dispatch.obj" + -@erase "$(INTDIR)\db_dup.obj" + -@erase "$(INTDIR)\db_err.obj" + -@erase "$(INTDIR)\db_log2.obj" + -@erase "$(INTDIR)\db_overflow.obj" + -@erase "$(INTDIR)\db_pr.obj" + -@erase "$(INTDIR)\db_rec.obj" + -@erase "$(INTDIR)\db_region.obj" + -@erase "$(INTDIR)\db_ret.obj" + -@erase "$(INTDIR)\db_salloc.obj" + -@erase "$(INTDIR)\db_shash.obj" + -@erase "$(INTDIR)\db_thread.obj" + -@erase "$(INTDIR)\dbm.obj" + -@erase "$(INTDIR)\hash.obj" + -@erase "$(INTDIR)\hash_auto.obj" + -@erase "$(INTDIR)\hash_conv.obj" + -@erase "$(INTDIR)\hash_debug.obj" + -@erase "$(INTDIR)\hash_dup.obj" + -@erase "$(INTDIR)\hash_func.obj" + -@erase "$(INTDIR)\hash_page.obj" + -@erase "$(INTDIR)\hash_rec.obj" + -@erase "$(INTDIR)\hash_stat.obj" + -@erase "$(INTDIR)\lock.obj" + -@erase "$(INTDIR)\lock_conflict.obj" + -@erase "$(INTDIR)\lock_deadlock.obj" + -@erase "$(INTDIR)\lock_util.obj" + -@erase "$(INTDIR)\log.obj" + -@erase "$(INTDIR)\log_archive.obj" + -@erase "$(INTDIR)\log_auto.obj" + -@erase "$(INTDIR)\log_compare.obj" + -@erase "$(INTDIR)\log_findckp.obj" + -@erase "$(INTDIR)\log_get.obj" + -@erase "$(INTDIR)\log_put.obj" + -@erase "$(INTDIR)\log_rec.obj" + -@erase "$(INTDIR)\log_register.obj" + -@erase "$(INTDIR)\mp_bh.obj" + -@erase "$(INTDIR)\mp_fget.obj" + -@erase "$(INTDIR)\mp_fopen.obj" + -@erase "$(INTDIR)\mp_fput.obj" + -@erase "$(INTDIR)\mp_fset.obj" + -@erase "$(INTDIR)\mp_open.obj" + -@erase "$(INTDIR)\mp_pr.obj" + -@erase "$(INTDIR)\mp_region.obj" + -@erase "$(INTDIR)\mp_sync.obj" + -@erase "$(INTDIR)\mutex.obj" + -@erase "$(INTDIR)\os_abs.obj" + -@erase "$(INTDIR)\os_alloc.obj" + -@erase "$(INTDIR)\os_config.obj" + -@erase "$(INTDIR)\os_dir.obj" + -@erase "$(INTDIR)\os_fid.obj" + -@erase "$(INTDIR)\os_fsync.obj" + -@erase "$(INTDIR)\os_map.obj" + -@erase "$(INTDIR)\os_oflags.obj" + -@erase "$(INTDIR)\os_open.obj" + -@erase "$(INTDIR)\os_rpath.obj" + -@erase "$(INTDIR)\os_rw.obj" + -@erase "$(INTDIR)\os_seek.obj" + -@erase "$(INTDIR)\os_sleep.obj" + -@erase "$(INTDIR)\os_spin.obj" + -@erase "$(INTDIR)\os_stat.obj" + -@erase "$(INTDIR)\os_unlink.obj" + -@erase "$(INTDIR)\strsep.obj" + -@erase "$(INTDIR)\txn.obj" + -@erase "$(INTDIR)\txn_auto.obj" + -@erase "$(INTDIR)\txn_rec.obj" + -@erase "$(OUTDIR)\libdb.dll" + -@erase "$(OUTDIR)\libdb.exp" + -@erase "$(OUTDIR)\libdb.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MD /W3 /GX /O2 /Ob2 /I "." /I "../include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "DB_CREATE_DLL" /YX /c +CPP_PROJ=/nologo /MD /W3 /GX /O2 /Ob2 /I "." /I "../include" /D "NDEBUG" /D\ + "WIN32" /D "_WINDOWS" /D "DB_CREATE_DLL" /Fp"$(INTDIR)/DB_DLL.pch" /YX\ + /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Release/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/DB_DLL.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 /nologo /base:0x13000000 /subsystem:windows /dll /machine:I386 /out:"Release/libdb.dll" +LINK32_FLAGS=/nologo /base:0x13000000 /subsystem:windows /dll /incremental:no\ + /pdb:"$(OUTDIR)/libdb.pdb" /machine:I386 /out:"$(OUTDIR)/libdb.dll"\ + /implib:"$(OUTDIR)/libdb.lib" +LINK32_OBJS= \ + "$(INTDIR)\bt_close.obj" \ + "$(INTDIR)\bt_compare.obj" \ + "$(INTDIR)\bt_conv.obj" \ + "$(INTDIR)\bt_cursor.obj" \ + "$(INTDIR)\bt_delete.obj" \ + "$(INTDIR)\bt_open.obj" \ + "$(INTDIR)\bt_page.obj" \ + "$(INTDIR)\bt_put.obj" \ + "$(INTDIR)\bt_rec.obj" \ + "$(INTDIR)\bt_recno.obj" \ + "$(INTDIR)\bt_rsearch.obj" \ + "$(INTDIR)\bt_search.obj" \ + "$(INTDIR)\bt_split.obj" \ + "$(INTDIR)\bt_stat.obj" \ + "$(INTDIR)\btree_auto.obj" \ + "$(INTDIR)\cxx_app.obj" \ + "$(INTDIR)\cxx_except.obj" \ + "$(INTDIR)\cxx_lock.obj" \ + "$(INTDIR)\cxx_log.obj" \ + "$(INTDIR)\cxx_mpool.obj" \ + "$(INTDIR)\cxx_table.obj" \ + "$(INTDIR)\cxx_txn.obj" \ + "$(INTDIR)\db.obj" \ + "$(INTDIR)\db_appinit.obj" \ + "$(INTDIR)\db_apprec.obj" \ + "$(INTDIR)\db_auto.obj" \ + "$(INTDIR)\db_byteorder.obj" \ + "$(INTDIR)\db_conv.obj" \ + "$(INTDIR)\db_dispatch.obj" \ + "$(INTDIR)\db_dup.obj" \ + "$(INTDIR)\db_err.obj" \ + "$(INTDIR)\db_log2.obj" \ + "$(INTDIR)\db_overflow.obj" \ + "$(INTDIR)\db_pr.obj" \ + "$(INTDIR)\db_rec.obj" \ + "$(INTDIR)\db_region.obj" \ + "$(INTDIR)\db_ret.obj" \ + "$(INTDIR)\db_salloc.obj" \ + "$(INTDIR)\db_shash.obj" \ + "$(INTDIR)\db_thread.obj" \ + "$(INTDIR)\dbm.obj" \ + "$(INTDIR)\hash.obj" \ + "$(INTDIR)\hash_auto.obj" \ + "$(INTDIR)\hash_conv.obj" \ + "$(INTDIR)\hash_debug.obj" \ + "$(INTDIR)\hash_dup.obj" \ + "$(INTDIR)\hash_func.obj" \ + "$(INTDIR)\hash_page.obj" \ + "$(INTDIR)\hash_rec.obj" \ + "$(INTDIR)\hash_stat.obj" \ + "$(INTDIR)\lock.obj" \ + "$(INTDIR)\lock_conflict.obj" \ + "$(INTDIR)\lock_deadlock.obj" \ + "$(INTDIR)\lock_util.obj" \ + "$(INTDIR)\log.obj" \ + "$(INTDIR)\log_archive.obj" \ + "$(INTDIR)\log_auto.obj" \ + "$(INTDIR)\log_compare.obj" \ + "$(INTDIR)\log_findckp.obj" \ + "$(INTDIR)\log_get.obj" \ + "$(INTDIR)\log_put.obj" \ + "$(INTDIR)\log_rec.obj" \ + "$(INTDIR)\log_register.obj" \ + "$(INTDIR)\mp_bh.obj" \ + "$(INTDIR)\mp_fget.obj" \ + "$(INTDIR)\mp_fopen.obj" \ + "$(INTDIR)\mp_fput.obj" \ + "$(INTDIR)\mp_fset.obj" \ + "$(INTDIR)\mp_open.obj" \ + "$(INTDIR)\mp_pr.obj" \ + "$(INTDIR)\mp_region.obj" \ + "$(INTDIR)\mp_sync.obj" \ + "$(INTDIR)\mutex.obj" \ + "$(INTDIR)\os_abs.obj" \ + "$(INTDIR)\os_alloc.obj" \ + "$(INTDIR)\os_config.obj" \ + "$(INTDIR)\os_dir.obj" \ + "$(INTDIR)\os_fid.obj" \ + "$(INTDIR)\os_fsync.obj" \ + "$(INTDIR)\os_map.obj" \ + "$(INTDIR)\os_oflags.obj" \ + "$(INTDIR)\os_open.obj" \ + "$(INTDIR)\os_rpath.obj" \ + "$(INTDIR)\os_rw.obj" \ + "$(INTDIR)\os_seek.obj" \ + "$(INTDIR)\os_sleep.obj" \ + "$(INTDIR)\os_spin.obj" \ + "$(INTDIR)\os_stat.obj" \ + "$(INTDIR)\os_unlink.obj" \ + "$(INTDIR)\strsep.obj" \ + "$(INTDIR)\txn.obj" \ + "$(INTDIR)\txn_auto.obj" \ + "$(INTDIR)\txn_rec.obj" + +"$(OUTDIR)\libdb.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "DB_DLL - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "DB_DLL_0" +# PROP BASE Intermediate_Dir "DB_DLL_0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +OUTDIR=.\Debug +INTDIR=.\Debug + +ALL : "$(OUTDIR)\libdb.dll" + +CLEAN : + -@erase "$(INTDIR)\bt_close.obj" + -@erase "$(INTDIR)\bt_compare.obj" + -@erase "$(INTDIR)\bt_conv.obj" + -@erase "$(INTDIR)\bt_cursor.obj" + -@erase "$(INTDIR)\bt_delete.obj" + -@erase "$(INTDIR)\bt_open.obj" + -@erase "$(INTDIR)\bt_page.obj" + -@erase "$(INTDIR)\bt_put.obj" + -@erase "$(INTDIR)\bt_rec.obj" + -@erase "$(INTDIR)\bt_recno.obj" + -@erase "$(INTDIR)\bt_rsearch.obj" + -@erase "$(INTDIR)\bt_search.obj" + -@erase "$(INTDIR)\bt_split.obj" + -@erase "$(INTDIR)\bt_stat.obj" + -@erase "$(INTDIR)\btree_auto.obj" + -@erase "$(INTDIR)\cxx_app.obj" + -@erase "$(INTDIR)\cxx_except.obj" + -@erase "$(INTDIR)\cxx_lock.obj" + -@erase "$(INTDIR)\cxx_log.obj" + -@erase "$(INTDIR)\cxx_mpool.obj" + -@erase "$(INTDIR)\cxx_table.obj" + -@erase "$(INTDIR)\cxx_txn.obj" + -@erase "$(INTDIR)\db.obj" + -@erase "$(INTDIR)\db_appinit.obj" + -@erase "$(INTDIR)\db_apprec.obj" + -@erase "$(INTDIR)\db_auto.obj" + -@erase "$(INTDIR)\db_byteorder.obj" + -@erase "$(INTDIR)\db_conv.obj" + -@erase "$(INTDIR)\db_dispatch.obj" + -@erase "$(INTDIR)\db_dup.obj" + -@erase "$(INTDIR)\db_err.obj" + -@erase "$(INTDIR)\db_log2.obj" + -@erase "$(INTDIR)\db_overflow.obj" + -@erase "$(INTDIR)\db_pr.obj" + -@erase "$(INTDIR)\db_rec.obj" + -@erase "$(INTDIR)\db_region.obj" + -@erase "$(INTDIR)\db_ret.obj" + -@erase "$(INTDIR)\db_salloc.obj" + -@erase "$(INTDIR)\db_shash.obj" + -@erase "$(INTDIR)\db_thread.obj" + -@erase "$(INTDIR)\dbm.obj" + -@erase "$(INTDIR)\hash.obj" + -@erase "$(INTDIR)\hash_auto.obj" + -@erase "$(INTDIR)\hash_conv.obj" + -@erase "$(INTDIR)\hash_debug.obj" + -@erase "$(INTDIR)\hash_dup.obj" + -@erase "$(INTDIR)\hash_func.obj" + -@erase "$(INTDIR)\hash_page.obj" + -@erase "$(INTDIR)\hash_rec.obj" + -@erase "$(INTDIR)\hash_stat.obj" + -@erase "$(INTDIR)\lock.obj" + -@erase "$(INTDIR)\lock_conflict.obj" + -@erase "$(INTDIR)\lock_deadlock.obj" + -@erase "$(INTDIR)\lock_util.obj" + -@erase "$(INTDIR)\log.obj" + -@erase "$(INTDIR)\log_archive.obj" + -@erase "$(INTDIR)\log_auto.obj" + -@erase "$(INTDIR)\log_compare.obj" + -@erase "$(INTDIR)\log_findckp.obj" + -@erase "$(INTDIR)\log_get.obj" + -@erase "$(INTDIR)\log_put.obj" + -@erase "$(INTDIR)\log_rec.obj" + -@erase "$(INTDIR)\log_register.obj" + -@erase "$(INTDIR)\mp_bh.obj" + -@erase "$(INTDIR)\mp_fget.obj" + -@erase "$(INTDIR)\mp_fopen.obj" + -@erase "$(INTDIR)\mp_fput.obj" + -@erase "$(INTDIR)\mp_fset.obj" + -@erase "$(INTDIR)\mp_open.obj" + -@erase "$(INTDIR)\mp_pr.obj" + -@erase "$(INTDIR)\mp_region.obj" + -@erase "$(INTDIR)\mp_sync.obj" + -@erase "$(INTDIR)\mutex.obj" + -@erase "$(INTDIR)\os_abs.obj" + -@erase "$(INTDIR)\os_alloc.obj" + -@erase "$(INTDIR)\os_config.obj" + -@erase "$(INTDIR)\os_dir.obj" + -@erase "$(INTDIR)\os_fid.obj" + -@erase "$(INTDIR)\os_fsync.obj" + -@erase "$(INTDIR)\os_map.obj" + -@erase "$(INTDIR)\os_oflags.obj" + -@erase "$(INTDIR)\os_open.obj" + -@erase "$(INTDIR)\os_rpath.obj" + -@erase "$(INTDIR)\os_rw.obj" + -@erase "$(INTDIR)\os_seek.obj" + -@erase "$(INTDIR)\os_sleep.obj" + -@erase "$(INTDIR)\os_spin.obj" + -@erase "$(INTDIR)\os_stat.obj" + -@erase "$(INTDIR)\os_unlink.obj" + -@erase "$(INTDIR)\strsep.obj" + -@erase "$(INTDIR)\txn.obj" + -@erase "$(INTDIR)\txn_auto.obj" + -@erase "$(INTDIR)\txn_rec.obj" + -@erase "$(INTDIR)\vc40.idb" + -@erase "$(INTDIR)\vc40.pdb" + -@erase "$(OUTDIR)\libdb.dll" + -@erase "$(OUTDIR)\libdb.exp" + -@erase "$(OUTDIR)\libdb.ilk" + -@erase "$(OUTDIR)\libdb.lib" + -@erase "$(OUTDIR)\libdb.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "../include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "DB_CREATE_DLL" /YX /c +CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "../include" /D "_DEBUG" /D\ + "WIN32" /D "_WINDOWS" /D "DB_CREATE_DLL" /Fp"$(INTDIR)/DB_DLL.pch" /YX\ + /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c +CPP_OBJS=.\Debug/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/DB_DLL.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 +# ADD LINK32 /nologo /base:0x13000000 /subsystem:windows /dll /debug /machine:I386 /out:"Debug/libdb.dll" +LINK32_FLAGS=/nologo /base:0x13000000 /subsystem:windows /dll /incremental:yes\ + /pdb:"$(OUTDIR)/libdb.pdb" /debug /machine:I386 /out:"$(OUTDIR)/libdb.dll"\ + /implib:"$(OUTDIR)/libdb.lib" +LINK32_OBJS= \ + "$(INTDIR)\bt_close.obj" \ + "$(INTDIR)\bt_compare.obj" \ + "$(INTDIR)\bt_conv.obj" \ + "$(INTDIR)\bt_cursor.obj" \ + "$(INTDIR)\bt_delete.obj" \ + "$(INTDIR)\bt_open.obj" \ + "$(INTDIR)\bt_page.obj" \ + "$(INTDIR)\bt_put.obj" \ + "$(INTDIR)\bt_rec.obj" \ + "$(INTDIR)\bt_recno.obj" \ + "$(INTDIR)\bt_rsearch.obj" \ + "$(INTDIR)\bt_search.obj" \ + "$(INTDIR)\bt_split.obj" \ + "$(INTDIR)\bt_stat.obj" \ + "$(INTDIR)\btree_auto.obj" \ + "$(INTDIR)\cxx_app.obj" \ + "$(INTDIR)\cxx_except.obj" \ + "$(INTDIR)\cxx_lock.obj" \ + "$(INTDIR)\cxx_log.obj" \ + "$(INTDIR)\cxx_mpool.obj" \ + "$(INTDIR)\cxx_table.obj" \ + "$(INTDIR)\cxx_txn.obj" \ + "$(INTDIR)\db.obj" \ + "$(INTDIR)\db_appinit.obj" \ + "$(INTDIR)\db_apprec.obj" \ + "$(INTDIR)\db_auto.obj" \ + "$(INTDIR)\db_byteorder.obj" \ + "$(INTDIR)\db_conv.obj" \ + "$(INTDIR)\db_dispatch.obj" \ + "$(INTDIR)\db_dup.obj" \ + "$(INTDIR)\db_err.obj" \ + "$(INTDIR)\db_log2.obj" \ + "$(INTDIR)\db_overflow.obj" \ + "$(INTDIR)\db_pr.obj" \ + "$(INTDIR)\db_rec.obj" \ + "$(INTDIR)\db_region.obj" \ + "$(INTDIR)\db_ret.obj" \ + "$(INTDIR)\db_salloc.obj" \ + "$(INTDIR)\db_shash.obj" \ + "$(INTDIR)\db_thread.obj" \ + "$(INTDIR)\dbm.obj" \ + "$(INTDIR)\hash.obj" \ + "$(INTDIR)\hash_auto.obj" \ + "$(INTDIR)\hash_conv.obj" \ + "$(INTDIR)\hash_debug.obj" \ + "$(INTDIR)\hash_dup.obj" \ + "$(INTDIR)\hash_func.obj" \ + "$(INTDIR)\hash_page.obj" \ + "$(INTDIR)\hash_rec.obj" \ + "$(INTDIR)\hash_stat.obj" \ + "$(INTDIR)\lock.obj" \ + "$(INTDIR)\lock_conflict.obj" \ + "$(INTDIR)\lock_deadlock.obj" \ + "$(INTDIR)\lock_util.obj" \ + "$(INTDIR)\log.obj" \ + "$(INTDIR)\log_archive.obj" \ + "$(INTDIR)\log_auto.obj" \ + "$(INTDIR)\log_compare.obj" \ + "$(INTDIR)\log_findckp.obj" \ + "$(INTDIR)\log_get.obj" \ + "$(INTDIR)\log_put.obj" \ + "$(INTDIR)\log_rec.obj" \ + "$(INTDIR)\log_register.obj" \ + "$(INTDIR)\mp_bh.obj" \ + "$(INTDIR)\mp_fget.obj" \ + "$(INTDIR)\mp_fopen.obj" \ + "$(INTDIR)\mp_fput.obj" \ + "$(INTDIR)\mp_fset.obj" \ + "$(INTDIR)\mp_open.obj" \ + "$(INTDIR)\mp_pr.obj" \ + "$(INTDIR)\mp_region.obj" \ + "$(INTDIR)\mp_sync.obj" \ + "$(INTDIR)\mutex.obj" \ + "$(INTDIR)\os_abs.obj" \ + "$(INTDIR)\os_alloc.obj" \ + "$(INTDIR)\os_config.obj" \ + "$(INTDIR)\os_dir.obj" \ + "$(INTDIR)\os_fid.obj" \ + "$(INTDIR)\os_fsync.obj" \ + "$(INTDIR)\os_map.obj" \ + "$(INTDIR)\os_oflags.obj" \ + "$(INTDIR)\os_open.obj" \ + "$(INTDIR)\os_rpath.obj" \ + "$(INTDIR)\os_rw.obj" \ + "$(INTDIR)\os_seek.obj" \ + "$(INTDIR)\os_sleep.obj" \ + "$(INTDIR)\os_spin.obj" \ + "$(INTDIR)\os_stat.obj" \ + "$(INTDIR)\os_unlink.obj" \ + "$(INTDIR)\strsep.obj" \ + "$(INTDIR)\txn.obj" \ + "$(INTDIR)\txn_auto.obj" \ + "$(INTDIR)\txn_rec.obj" + +"$(OUTDIR)\libdb.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "DB_DLL - Win32 Release" +# Name "DB_DLL - Win32 Debug" + +!IF "$(CFG)" == "DB_DLL - Win32 Release" + +!ELSEIF "$(CFG)" == "DB_DLL - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=\db\btree\btree_auto.c +DEP_CPP_BTREE=\ + "..\include\btree_auto.h"\ + "..\include\btree_ext.h"\ + "..\include\db_auto.h"\ + ".\../include\btree.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_dispatch.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\btree_auto.obj" : $(SOURCE) $(DEP_CPP_BTREE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\btree\bt_compare.c +DEP_CPP_BT_CO=\ + "..\include\btree_auto.h"\ + "..\include\btree_ext.h"\ + "..\include\db_auto.h"\ + ".\../include\btree.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\bt_compare.obj" : $(SOURCE) $(DEP_CPP_BT_CO) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\btree\bt_conv.c +DEP_CPP_BT_CON=\ + "..\include\btree_auto.h"\ + "..\include\btree_ext.h"\ + "..\include\db_auto.h"\ + ".\../include\btree.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\db_swap.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\bt_conv.obj" : $(SOURCE) $(DEP_CPP_BT_CON) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\btree\bt_cursor.c +DEP_CPP_BT_CU=\ + "..\include\btree_auto.h"\ + "..\include\btree_ext.h"\ + "..\include\db_auto.h"\ + ".\../include\btree.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\bt_cursor.obj" : $(SOURCE) $(DEP_CPP_BT_CU) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\btree\bt_delete.c +DEP_CPP_BT_DE=\ + "..\include\btree_auto.h"\ + "..\include\btree_ext.h"\ + "..\include\db_auto.h"\ + ".\../include\btree.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\bt_delete.obj" : $(SOURCE) $(DEP_CPP_BT_DE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\btree\bt_open.c +DEP_CPP_BT_OP=\ + "..\include\btree_auto.h"\ + "..\include\btree_ext.h"\ + "..\include\db_auto.h"\ + ".\../include\btree.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\bt_open.obj" : $(SOURCE) $(DEP_CPP_BT_OP) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\btree\bt_page.c +DEP_CPP_BT_PA=\ + "..\include\btree_auto.h"\ + "..\include\btree_ext.h"\ + "..\include\db_auto.h"\ + ".\../include\btree.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\bt_page.obj" : $(SOURCE) $(DEP_CPP_BT_PA) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\btree\bt_put.c +DEP_CPP_BT_PU=\ + "..\include\btree_auto.h"\ + "..\include\btree_ext.h"\ + "..\include\db_auto.h"\ + ".\../include\btree.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\bt_put.obj" : $(SOURCE) $(DEP_CPP_BT_PU) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\btree\bt_rec.c +DEP_CPP_BT_RE=\ + "..\include\btree_auto.h"\ + "..\include\btree_ext.h"\ + "..\include\db_auto.h"\ + "..\include\hash_auto.h"\ + "..\include\hash_ext.h"\ + "..\include\log_auto.h"\ + "..\include\log_ext.h"\ + ".\../include\btree.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_dispatch.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\hash.h"\ + ".\../include\log.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\bt_rec.obj" : $(SOURCE) $(DEP_CPP_BT_RE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\btree\bt_rsearch.c +DEP_CPP_BT_RS=\ + "..\include\btree_auto.h"\ + "..\include\btree_ext.h"\ + "..\include\db_auto.h"\ + ".\../include\btree.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\bt_rsearch.obj" : $(SOURCE) $(DEP_CPP_BT_RS) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\btree\bt_search.c +DEP_CPP_BT_SE=\ + "..\include\btree_auto.h"\ + "..\include\btree_ext.h"\ + "..\include\db_auto.h"\ + ".\../include\btree.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\bt_search.obj" : $(SOURCE) $(DEP_CPP_BT_SE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\btree\bt_split.c +DEP_CPP_BT_SP=\ + "..\include\btree_auto.h"\ + "..\include\btree_ext.h"\ + "..\include\db_auto.h"\ + ".\../include\btree.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\bt_split.obj" : $(SOURCE) $(DEP_CPP_BT_SP) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\btree\bt_stat.c +DEP_CPP_BT_ST=\ + "..\include\btree_auto.h"\ + "..\include\btree_ext.h"\ + "..\include\db_auto.h"\ + ".\../include\btree.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\bt_stat.obj" : $(SOURCE) $(DEP_CPP_BT_ST) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\btree\bt_close.c +DEP_CPP_BT_CL=\ + "..\include\btree_auto.h"\ + "..\include\btree_ext.h"\ + "..\include\db_auto.h"\ + ".\../include\btree.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\bt_close.obj" : $(SOURCE) $(DEP_CPP_BT_CL) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\cxx\cxx_txn.cpp +DEP_CPP_CXX_T=\ + ".\../include\cxx_int.h"\ + ".\../include\db_cxx.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\cxx_txn.obj" : $(SOURCE) $(DEP_CPP_CXX_T) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\cxx\cxx_except.cpp +DEP_CPP_CXX_E=\ + ".\../include\cxx_int.h"\ + ".\../include\db_cxx.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\cxx_except.obj" : $(SOURCE) $(DEP_CPP_CXX_E) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\cxx\cxx_lock.cpp +DEP_CPP_CXX_L=\ + ".\../include\cxx_int.h"\ + ".\../include\db_cxx.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\cxx_lock.obj" : $(SOURCE) $(DEP_CPP_CXX_L) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\cxx\cxx_log.cpp +DEP_CPP_CXX_LO=\ + ".\../include\cxx_int.h"\ + ".\../include\db_cxx.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\cxx_log.obj" : $(SOURCE) $(DEP_CPP_CXX_LO) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\cxx\cxx_mpool.cpp +DEP_CPP_CXX_M=\ + ".\../include\cxx_int.h"\ + ".\../include\db_cxx.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\cxx_mpool.obj" : $(SOURCE) $(DEP_CPP_CXX_M) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\cxx\cxx_table.cpp +DEP_CPP_CXX_TA=\ + ".\../include\cxx_int.h"\ + ".\../include\db_cxx.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\cxx_table.obj" : $(SOURCE) $(DEP_CPP_CXX_TA) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\cxx\cxx_app.cpp +DEP_CPP_CXX_A=\ + ".\../include\cxx_int.h"\ + ".\../include\db_cxx.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\cxx_app.obj" : $(SOURCE) $(DEP_CPP_CXX_A) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\db\db_thread.c +DEP_CPP_DB_TH=\ + "..\include\db_auto.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\db_thread.obj" : $(SOURCE) $(DEP_CPP_DB_TH) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\db\db_auto.c +DEP_CPP_DB_AU=\ + "..\include\db_auto.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_dispatch.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\db_auto.obj" : $(SOURCE) $(DEP_CPP_DB_AU) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\db\db_conv.c +DEP_CPP_DB_CO=\ + "..\include\db_auto.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\db_swap.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\db_conv.obj" : $(SOURCE) $(DEP_CPP_DB_CO) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\db\db_dispatch.c +DEP_CPP_DB_DI=\ + "..\include\db_auto.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_dispatch.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\db_dispatch.obj" : $(SOURCE) $(DEP_CPP_DB_DI) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\db\db_dup.c +DEP_CPP_DB_DU=\ + "..\include\btree_auto.h"\ + "..\include\btree_ext.h"\ + "..\include\db_auto.h"\ + ".\../include\btree.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\db_swap.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\db_dup.obj" : $(SOURCE) $(DEP_CPP_DB_DU) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\db\db_overflow.c +DEP_CPP_DB_OV=\ + "..\include\db_auto.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\db_overflow.obj" : $(SOURCE) $(DEP_CPP_DB_OV) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\db\db_pr.c +DEP_CPP_DB_PR=\ + "..\include\btree_auto.h"\ + "..\include\btree_ext.h"\ + "..\include\db_auto.h"\ + "..\include\hash_auto.h"\ + "..\include\hash_ext.h"\ + ".\../include\btree.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\hash.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\db_pr.obj" : $(SOURCE) $(DEP_CPP_DB_PR) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\db\db_rec.c +DEP_CPP_DB_RE=\ + "..\include\btree_auto.h"\ + "..\include\btree_ext.h"\ + "..\include\db_auto.h"\ + "..\include\hash_auto.h"\ + "..\include\hash_ext.h"\ + "..\include\log_auto.h"\ + "..\include\log_ext.h"\ + ".\../include\btree.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_dispatch.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\hash.h"\ + ".\../include\log.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\db_rec.obj" : $(SOURCE) $(DEP_CPP_DB_RE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\db\db_ret.c +DEP_CPP_DB_RET=\ + "..\include\btree_auto.h"\ + "..\include\btree_ext.h"\ + "..\include\db_auto.h"\ + "..\include\hash_auto.h"\ + "..\include\hash_ext.h"\ + ".\../include\btree.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\hash.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\db_ret.obj" : $(SOURCE) $(DEP_CPP_DB_RET) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\db\db.c +DEP_CPP_DB_C3c=\ + "..\include\btree_auto.h"\ + "..\include\btree_ext.h"\ + "..\include\db_auto.h"\ + "..\include\hash_auto.h"\ + "..\include\hash_ext.h"\ + "..\include\mp_ext.h"\ + ".\../include\btree.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\db_shash.h"\ + ".\../include\db_swap.h"\ + ".\../include\hash.h"\ + ".\../include\mp.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\db.obj" : $(SOURCE) $(DEP_CPP_DB_C3c) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\common\db_shash.c +DEP_CPP_DB_SH=\ + ".\../include\common_ext.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\db_shash.obj" : $(SOURCE) $(DEP_CPP_DB_SH) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\common\db_apprec.c +DEP_CPP_DB_AP=\ + "..\include\db_auto.h"\ + "..\include\log_auto.h"\ + "..\include\log_ext.h"\ + "..\include\txn_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_dispatch.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\log.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\../include\txn.h"\ + ".\../include\txn_auto.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\db_apprec.obj" : $(SOURCE) $(DEP_CPP_DB_AP) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\common\db_byteorder.c +DEP_CPP_DB_BY=\ + ".\../include\common_ext.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\db_byteorder.obj" : $(SOURCE) $(DEP_CPP_DB_BY) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\common\db_err.c +DEP_CPP_DB_ER=\ + ".\../include\common_ext.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\db_err.obj" : $(SOURCE) $(DEP_CPP_DB_ER) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\common\db_log2.c +DEP_CPP_DB_LO=\ + ".\../include\common_ext.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\db_log2.obj" : $(SOURCE) $(DEP_CPP_DB_LO) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\common\db_region.c +DEP_CPP_DB_REG=\ + ".\../include\common_ext.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\db_region.obj" : $(SOURCE) $(DEP_CPP_DB_REG) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\common\db_salloc.c +DEP_CPP_DB_SA=\ + ".\../include\common_ext.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\db_salloc.obj" : $(SOURCE) $(DEP_CPP_DB_SA) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\common\db_appinit.c +DEP_CPP_DB_APP=\ + "..\include\btree_auto.h"\ + "..\include\btree_ext.h"\ + "..\include\db_auto.h"\ + "..\include\hash_auto.h"\ + "..\include\hash_ext.h"\ + "..\include\log_auto.h"\ + "..\include\log_ext.h"\ + "..\include\txn_ext.h"\ + ".\../include\btree.h"\ + ".\../include\clib_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\hash.h"\ + ".\../include\log.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\../include\txn.h"\ + ".\../include\txn_auto.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\db_appinit.obj" : $(SOURCE) $(DEP_CPP_DB_APP) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\dbm\dbm.c +DEP_CPP_DBM_C=\ + "..\include\db_auto.h"\ + "..\include\hash_auto.h"\ + "..\include\hash_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\hash.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\dbm.obj" : $(SOURCE) $(DEP_CPP_DBM_C) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\hash\hash_stat.c +DEP_CPP_HASH_=\ + "..\include\db_auto.h"\ + "..\include\hash_auto.h"\ + "..\include\hash_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\hash.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\hash_stat.obj" : $(SOURCE) $(DEP_CPP_HASH_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\hash\hash_auto.c +DEP_CPP_HASH_A=\ + "..\include\db_auto.h"\ + "..\include\hash_auto.h"\ + "..\include\hash_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_dispatch.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\hash.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\hash_auto.obj" : $(SOURCE) $(DEP_CPP_HASH_A) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\hash\hash_conv.c +DEP_CPP_HASH_C=\ + "..\include\db_auto.h"\ + "..\include\hash_auto.h"\ + "..\include\hash_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\db_swap.h"\ + ".\../include\hash.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\hash_conv.obj" : $(SOURCE) $(DEP_CPP_HASH_C) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\hash\hash_debug.c +DEP_CPP_HASH_D=\ + "..\include\db_auto.h"\ + "..\include\hash_auto.h"\ + "..\include\hash_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\hash.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\hash_debug.obj" : $(SOURCE) $(DEP_CPP_HASH_D) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\hash\hash_dup.c +DEP_CPP_HASH_DU=\ + "..\include\db_auto.h"\ + "..\include\hash_auto.h"\ + "..\include\hash_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\db_swap.h"\ + ".\../include\hash.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\hash_dup.obj" : $(SOURCE) $(DEP_CPP_HASH_DU) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\hash\hash_func.c +DEP_CPP_HASH_F=\ + "..\include\db_auto.h"\ + "..\include\hash_auto.h"\ + "..\include\hash_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\hash.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\hash_func.obj" : $(SOURCE) $(DEP_CPP_HASH_F) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\hash\hash_page.c +DEP_CPP_HASH_P=\ + "..\include\db_auto.h"\ + "..\include\hash_auto.h"\ + "..\include\hash_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\db_swap.h"\ + ".\../include\hash.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\hash_page.obj" : $(SOURCE) $(DEP_CPP_HASH_P) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\hash\hash_rec.c +DEP_CPP_HASH_R=\ + "..\include\btree_auto.h"\ + "..\include\btree_ext.h"\ + "..\include\db_auto.h"\ + "..\include\hash_auto.h"\ + "..\include\hash_ext.h"\ + "..\include\log_auto.h"\ + "..\include\log_ext.h"\ + ".\../include\btree.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_dispatch.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\hash.h"\ + ".\../include\log.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\hash_rec.obj" : $(SOURCE) $(DEP_CPP_HASH_R) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\hash\hash.c +DEP_CPP_HASH_C60=\ + "..\include\db_auto.h"\ + "..\include\hash_auto.h"\ + "..\include\hash_ext.h"\ + "..\include\log_auto.h"\ + "..\include\log_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\hash.h"\ + ".\../include\log.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\hash.obj" : $(SOURCE) $(DEP_CPP_HASH_C60) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\lock\lock_util.c +DEP_CPP_LOCK_=\ + "..\include\db_auto.h"\ + "..\include\hash_auto.h"\ + "..\include\hash_ext.h"\ + "..\include\lock_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\db_shash.h"\ + ".\../include\hash.h"\ + ".\../include\lock.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\lock_util.obj" : $(SOURCE) $(DEP_CPP_LOCK_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\lock\lock_conflict.c +DEP_CPP_LOCK_C=\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\lock_conflict.obj" : $(SOURCE) $(DEP_CPP_LOCK_C) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\lock\lock_deadlock.c +DEP_CPP_LOCK_D=\ + "..\include\lock_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_shash.h"\ + ".\../include\lock.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\lock_deadlock.obj" : $(SOURCE) $(DEP_CPP_LOCK_D) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\lock\lock.c +DEP_CPP_LOCK_C68=\ + "..\include\db_auto.h"\ + "..\include\lock_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\db_shash.h"\ + ".\../include\lock.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\lock.obj" : $(SOURCE) $(DEP_CPP_LOCK_C68) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\log\log_register.c +DEP_CPP_LOG_R=\ + "..\include\log_auto.h"\ + "..\include\log_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\log.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\log_register.obj" : $(SOURCE) $(DEP_CPP_LOG_R) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\log\log_archive.c +DEP_CPP_LOG_A=\ + "..\include\log_auto.h"\ + "..\include\log_ext.h"\ + ".\../include\clib_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_dispatch.h"\ + ".\../include\log.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\log_archive.obj" : $(SOURCE) $(DEP_CPP_LOG_A) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\log\log_auto.c +DEP_CPP_LOG_AU=\ + "..\include\db_auto.h"\ + "..\include\log_auto.h"\ + "..\include\log_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_dispatch.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\log.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\log_auto.obj" : $(SOURCE) $(DEP_CPP_LOG_AU) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\log\log_compare.c +DEP_CPP_LOG_C=\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\log_compare.obj" : $(SOURCE) $(DEP_CPP_LOG_C) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\log\log_findckp.c +DEP_CPP_LOG_F=\ + "..\include\log_auto.h"\ + "..\include\log_ext.h"\ + "..\include\txn_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\log.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\../include\txn.h"\ + ".\../include\txn_auto.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\log_findckp.obj" : $(SOURCE) $(DEP_CPP_LOG_F) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\log\log_get.c +DEP_CPP_LOG_G=\ + "..\include\db_auto.h"\ + "..\include\hash_auto.h"\ + "..\include\hash_ext.h"\ + "..\include\log_auto.h"\ + "..\include\log_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\hash.h"\ + ".\../include\log.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\log_get.obj" : $(SOURCE) $(DEP_CPP_LOG_G) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\log\log_put.c +DEP_CPP_LOG_P=\ + "..\include\db_auto.h"\ + "..\include\hash_auto.h"\ + "..\include\hash_ext.h"\ + "..\include\log_auto.h"\ + "..\include\log_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\hash.h"\ + ".\../include\log.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\log_put.obj" : $(SOURCE) $(DEP_CPP_LOG_P) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\log\log_rec.c +DEP_CPP_LOG_RE=\ + "..\include\log_auto.h"\ + "..\include\log_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_dispatch.h"\ + ".\../include\log.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\log_rec.obj" : $(SOURCE) $(DEP_CPP_LOG_RE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\log\log.c +DEP_CPP_LOG_C7a=\ + "..\include\log_auto.h"\ + "..\include\log_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_dispatch.h"\ + ".\../include\db_shash.h"\ + ".\../include\log.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\../include\txn_auto.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\log.obj" : $(SOURCE) $(DEP_CPP_LOG_C7a) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\mp\mp_sync.c +DEP_CPP_MP_SY=\ + "..\include\mp_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_shash.h"\ + ".\../include\mp.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\mp_sync.obj" : $(SOURCE) $(DEP_CPP_MP_SY) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\mp\mp_fget.c +DEP_CPP_MP_FG=\ + "..\include\mp_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_shash.h"\ + ".\../include\mp.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\mp_fget.obj" : $(SOURCE) $(DEP_CPP_MP_FG) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\mp\mp_fopen.c +DEP_CPP_MP_FO=\ + "..\include\mp_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_shash.h"\ + ".\../include\mp.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\mp_fopen.obj" : $(SOURCE) $(DEP_CPP_MP_FO) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\mp\mp_fput.c +DEP_CPP_MP_FP=\ + "..\include\mp_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_shash.h"\ + ".\../include\mp.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\mp_fput.obj" : $(SOURCE) $(DEP_CPP_MP_FP) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\mp\mp_fset.c +DEP_CPP_MP_FS=\ + "..\include\mp_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_shash.h"\ + ".\../include\mp.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\mp_fset.obj" : $(SOURCE) $(DEP_CPP_MP_FS) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\mp\mp_open.c +DEP_CPP_MP_OP=\ + "..\include\mp_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_shash.h"\ + ".\../include\mp.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\mp_open.obj" : $(SOURCE) $(DEP_CPP_MP_OP) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\mp\mp_pr.c +DEP_CPP_MP_PR=\ + "..\include\mp_ext.h"\ + ".\../include\db_shash.h"\ + ".\../include\mp.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\mp_pr.obj" : $(SOURCE) $(DEP_CPP_MP_PR) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\mp\mp_region.c +DEP_CPP_MP_RE=\ + "..\include\mp_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_shash.h"\ + ".\../include\mp.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\mp_region.obj" : $(SOURCE) $(DEP_CPP_MP_RE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\mp\mp_bh.c +DEP_CPP_MP_BH=\ + "..\include\mp_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_shash.h"\ + ".\../include\mp.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\mp_bh.obj" : $(SOURCE) $(DEP_CPP_MP_BH) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\mutex\mutex.c +DEP_CPP_MUTEX=\ + "..\mutex\68020.gcc"\ + "..\mutex\sco.cc"\ + "..\mutex\sparc.gcc"\ + "..\mutex\x86.gcc"\ + ".\../include\common_ext.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\mutex.obj" : $(SOURCE) $(DEP_CPP_MUTEX) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\txn\txn_rec.c +DEP_CPP_TXN_R=\ + "..\include\db_auto.h"\ + "..\include\txn_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_dispatch.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\../include\txn.h"\ + ".\../include\txn_auto.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\txn_rec.obj" : $(SOURCE) $(DEP_CPP_TXN_R) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\txn\txn_auto.c +DEP_CPP_TXN_A=\ + "..\include\db_auto.h"\ + "..\include\txn_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_dispatch.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\../include\txn.h"\ + ".\../include\txn_auto.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\txn_auto.obj" : $(SOURCE) $(DEP_CPP_TXN_A) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\txn\txn.c +DEP_CPP_TXN_C=\ + "..\include\db_auto.h"\ + "..\include\lock_ext.h"\ + "..\include\log_auto.h"\ + "..\include\log_ext.h"\ + "..\include\txn_ext.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_dispatch.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\db_shash.h"\ + ".\../include\lock.h"\ + ".\../include\log.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\../include\txn.h"\ + ".\../include\txn_auto.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\txn.obj" : $(SOURCE) $(DEP_CPP_TXN_C) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\clib\strsep.c +DEP_CPP_STRSE=\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\strsep.obj" : $(SOURCE) $(DEP_CPP_STRSE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\btree\bt_recno.c +DEP_CPP_BT_REC=\ + "..\include\btree_auto.h"\ + "..\include\btree_ext.h"\ + "..\include\db_auto.h"\ + ".\../include\btree.h"\ + ".\../include\common_ext.h"\ + ".\../include\db_am.h"\ + ".\../include\db_ext.h"\ + ".\../include\db_page.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\bt_recno.obj" : $(SOURCE) $(DEP_CPP_BT_REC) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\os.win32\os_sleep.c +DEP_CPP_OS_SL=\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\os_sleep.obj" : $(SOURCE) $(DEP_CPP_OS_SL) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\os.win32\os_dir.c +DEP_CPP_OS_DI=\ + ".\../include\common_ext.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\os_dir.obj" : $(SOURCE) $(DEP_CPP_OS_DI) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\os.win32\os_fid.c +DEP_CPP_OS_FI=\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\os_fid.obj" : $(SOURCE) $(DEP_CPP_OS_FI) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\os.win32\os_map.c +DEP_CPP_OS_MA=\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\os_map.obj" : $(SOURCE) $(DEP_CPP_OS_MA) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\os.win32\os_seek.c +DEP_CPP_OS_SE=\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\os_seek.obj" : $(SOURCE) $(DEP_CPP_OS_SE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\os.win32\os_abs.c +DEP_CPP_OS_AB=\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\os_abs.obj" : $(SOURCE) $(DEP_CPP_OS_AB) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\os\os_fsync.c +DEP_CPP_OS_FS=\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\os_fsync.obj" : $(SOURCE) $(DEP_CPP_OS_FS) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\os\os_oflags.c +DEP_CPP_OS_OF=\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\os_oflags.obj" : $(SOURCE) $(DEP_CPP_OS_OF) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\os\os_open.c +DEP_CPP_OS_OP=\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\os_open.obj" : $(SOURCE) $(DEP_CPP_OS_OP) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\os\os_rpath.c +DEP_CPP_OS_RP=\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\os_rpath.obj" : $(SOURCE) $(DEP_CPP_OS_RP) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\os\os_rw.c +DEP_CPP_OS_RW=\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\os_rw.obj" : $(SOURCE) $(DEP_CPP_OS_RW) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\os\os_stat.c +DEP_CPP_OS_ST=\ + ".\../include\common_ext.h"\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\os_stat.obj" : $(SOURCE) $(DEP_CPP_OS_ST) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\os\os_unlink.c +DEP_CPP_OS_UN=\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\os_unlink.obj" : $(SOURCE) $(DEP_CPP_OS_UN) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\os\os_config.c +DEP_CPP_OS_CO=\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\os_config.obj" : $(SOURCE) $(DEP_CPP_OS_CO) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\os.win32\os_spin.c +DEP_CPP_OS_SP=\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\os_spin.obj" : $(SOURCE) $(DEP_CPP_OS_SP) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=\db\os\os_alloc.c +DEP_CPP_OS_AL=\ + ".\../include\mutex_ext.h"\ + ".\../include\os_ext.h"\ + ".\../include\os_func.h"\ + ".\../include\queue.h"\ + ".\../include\shqueue.h"\ + ".\config.h"\ + ".\db.h"\ + ".\db_int.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\os_alloc.obj" : $(SOURCE) $(DEP_CPP_OS_AL) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/mozilla/db/build.win32/DB_DLL.mdp b/mozilla/db/build.win32/DB_DLL.mdp new file mode 100644 index 00000000000..6354782b629 Binary files /dev/null and b/mozilla/db/build.win32/DB_DLL.mdp differ diff --git a/mozilla/db/build.win32/README b/mozilla/db/build.win32/README new file mode 100644 index 00000000000..b3003c2f7b1 --- /dev/null +++ b/mozilla/db/build.win32/README @@ -0,0 +1,19 @@ +Building the Win32 version of DB: + +This directory contains project files for both MSVC4.X and 5.0: + + DB_DLL.mdp Visual C++ 4.0 project file + DB_DLL.mak Makefile exported by Visual C++ 4.0. + Berkeley_DB.dsw Visual C++ 5.0 project file + *.dsp Visual C++ 5.0 subprojects + +In MSVC5.0, open the file "Berkeley_DB.dsw". The 5.0 project files are +fully developed, allowing you to build both DLL and static versions of +libdb, the test harness and the command-line utilities. If you want to +build absolutely everything, select the "db_buildall" subproject and +build. + +In MSVC4.X, first move your distribution directory to \db (so that this +file is \db\build.win32\README for some drive letter). Then open the file +"DB_DLL.mdp". The 4.X project files currently only allow you to build +the DLL version of libdb. diff --git a/mozilla/db/build.win32/config.h b/mozilla/db/build.win32/config.h new file mode 100644 index 00000000000..70994571995 --- /dev/null +++ b/mozilla/db/build.win32/config.h @@ -0,0 +1,209 @@ +/* + * @(#)config.h 8.28 (Sleepycat) 5/2/98 + * + * Generated by hand. + */ + +/* Define to empty if the keyword does not work. */ +/* #undef const */ + +/* Define if your struct stat has st_blksize. */ +/* #undef HAVE_ST_BLKSIZE */ + +/* Define to `int' if doesn't define. */ +/* #undef mode_t */ + +/* Define to `long' if doesn't define. */ +/* #undef off_t */ + +/* Define to `int' if doesn't define. */ +/* #undef pid_t */ + +/* Define to `unsigned' if doesn't define. */ +/* #undef size_t */ + +/* Define if the `S_IS*' macros in do not work properly. */ +/* #undef STAT_MACROS_BROKEN */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if your processor stores words with the most significant + byte first (like Motorola and SPARC, unlike Intel and VAX). */ +/* #undef WORDS_BIGENDIAN */ + +/* Define to `int' if doesn't define. */ +typedef int ssize_t; + +/* Define if you want a debugging version. */ +/* #undef DEBUG */ +#if defined(_DEBUG) +#if !defined(DEBUG) +#define DEBUG 1 +#endif +#endif + +/* Define if you want a version with run-time diagnostic checking. */ +/* #undef DIAGNOSTIC */ + +/* Define if you have sigfillset (and sigprocmask). */ +/* #undef HAVE_SIGFILLSET */ + +/* Define if building on AIX, HP, Solaris to get big-file environment. */ +/* #undef HAVE_FILE_OFFSET_BITS */ +#ifdef HAVE_FILE_OFFSET_BITS +#define _FILE_OFFSET_BITS 64 +#endif + +/* Define if you have spinlocks. */ +#define HAVE_SPINLOCKS 1 + +/* Define if you want to use mc68020/gcc assembly spinlocks. */ +/* #undef HAVE_ASSEM_MC68020_GCC */ + +/* Define if you want to use parisc/gcc assembly spinlocks. */ +/* #undef HAVE_ASSEM_PARISC_GCC */ + +/* Define if you want to use sco/cc assembly spinlocks. */ +/* #undef HAVE_ASSEM_SCO_CC */ + +/* Define if you want to use sparc/gcc assembly spinlocks. */ +/* #undef HAVE_ASSEM_SPARC_GCC */ + +/* Define if you want to use uts4/cc assembly spinlocks. */ +/* #undef HAVE_ASSEM_UTS4_CC */ + +/* Define if you want to use x86/gcc assembly spinlocks. */ +/* #undef HAVE_ASSEM_X86_GCC */ + +/* Define if you have the AIX _check_lock spinlocks. */ +/* #undef HAVE_FUNC_AIX */ + +/* Define if you have the OSF1 or HPPA msemaphore spinlocks. */ +/* #undef HAVE_FUNC_MSEM */ + +/* Define if you have the SGI abilock_t spinlocks. */ +/* #undef HAVE_FUNC_SGI */ + +/* Define if you have the ReliantUNIX spinlock_t spinlocks. */ +/* #undef HAVE_FUNC_RELIANT */ + +/* Define if you have the Solaris mutex_t spinlocks. */ +/* #undef HAVE_FUNC_SOLARIS */ + +/* Define if your sprintf returns a pointer, not a length. */ +/* #undef SPRINTF_RET_CHARPNT */ + +/* Define if you have the directio function. */ +/* #undef HAVE_DIRECTIO */ + +/* Define if you have the getcwd function. */ +/* #undef HAVE_GETCWD */ + +/* Define if you have the getopt function. */ +/* #undef HAVE_GETOPT */ +extern int getopt(int, char * const *, const char *); + +/* Define if you have the getuid function. */ +/* #undef HAVE_GETUID */ + +/* Define if you have the memcmp function. */ +#define HAVE_MEMCMP 1 + +/* Define if you have the memcpy function. */ +#define HAVE_MEMCPY 1 + +/* Define if you have the memmove function. */ +#define HAVE_MEMMOVE 1 + +/* Define if you have the mmap function. */ +/* #undef HAVE_MMAP */ + +/* Define if you have the raise function. */ +#define HAVE_RAISE 1 + +/* Define if you have the select function. */ +/* #undef HAVE_SELECT */ + +/* Define if you have the shmget function. */ +/* #undef HAVE_SHMGET */ + +/* Define if you have the snprintf function. */ +#define HAVE_SNPRINTF 1 + +/* Define if you have the strerror function. */ +#define HAVE_STRERROR 1 + +/* Define if you have the strsep function. */ +/* #undef HAVE_STRSEP */ + +/* Define if you have the sysconf function. */ +/* #undef HAVE_SYSCONF */ + +/* Define if you have the vsnprintf function. */ +#define HAVE_VSNPRINTF 1 + +/* Define if you have the header file. */ +/* #undef HAVE_DIRENT_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_NDIR_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_SELECT_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_TIME_H */ + +/* + * XXX + * The following is not part of the automatic configuration setup, + * but provides the information necessary to build DB. + */ +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(__cplusplus) +#include +#endif + +#define WIN32_LEAN_AND_MEAN +#include + +#include "queue.h" +#include "shqueue.h" + +#define snprintf _snprintf +#define vsnprintf _vsnprintf + +#define NO_SYSTEM_INCLUDES + +/* + * 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/mozilla/db/build.win32/db.h b/mozilla/db/build.win32/db.h new file mode 100644 index 00000000000..16dbfaf0c47 --- /dev/null +++ b/mozilla/db/build.win32/db.h @@ -0,0 +1,997 @@ +/* DO NOT EDIT: automatically built by dist/distrib. */ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)db.h.src 10.131 (Sleepycat) 6/2/98 + */ + +#ifndef _DB_H_ +#define _DB_H_ + +#ifndef __NO_SYSTEM_INCLUDES +#include + +#include +#endif + +/* + * XXX + * MacOS: ensure that Metrowerks C makes enumeration types int sized. + */ +#ifdef __MWERKS__ +#pragma enumsalwaysint on +#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 + +/* + * !!! + * DB needs basic information about 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__ +typedef unsigned char u_int8_t; +typedef short int16_t; +typedef unsigned short u_int16_t; +typedef int int32_t; +typedef unsigned int u_int32_t; +#endif + +#if !defined(_WINSOCKAPI_) +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; +#endif + +#define DB_VERSION_MAJOR 2 +#define DB_VERSION_MINOR 4 +#define DB_VERSION_PATCH 14 +#define DB_VERSION_STRING "Sleepycat Software: DB 2.4.14: (6/2/98)" + +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. */ +typedef size_t DB_LOCK; /* Object returned by lock manager. */ +#define DB_MAX_RECORDS 0xffffffff /* >= # of records in a tree */ + +#define DB_FILE_ID_LEN 20 /* DB file ID length. */ + +/* Forward structure declarations, so applications get type checking. */ +struct __db; typedef struct __db DB; +#ifdef DB_DBM_HSEARCH + typedef struct __db DBM; +#endif +struct __db_bt_stat; typedef struct __db_bt_stat DB_BTREE_STAT; +struct __db_dbt; typedef struct __db_dbt DBT; +struct __db_env; typedef struct __db_env DB_ENV; +struct __db_info; typedef struct __db_info DB_INFO; +struct __db_lock_stat; typedef struct __db_lock_stat DB_LOCK_STAT; +struct __db_lockregion; typedef struct __db_lockregion DB_LOCKREGION; +struct __db_lockreq; typedef struct __db_lockreq DB_LOCKREQ; +struct __db_locktab; typedef struct __db_locktab DB_LOCKTAB; +struct __db_log; typedef struct __db_log DB_LOG; +struct __db_log_stat; typedef struct __db_log_stat DB_LOG_STAT; +struct __db_lsn; typedef struct __db_lsn DB_LSN; +struct __db_mpool; typedef struct __db_mpool DB_MPOOL; +struct __db_mpool_finfo;typedef struct __db_mpool_finfo DB_MPOOL_FINFO; +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_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 __db_txnregion; typedef struct __db_txnregion DB_TXNREGION; +struct __dbc; typedef struct __dbc DBC; + +/* Key/data structure -- a Data-Base Thang. */ +struct __db_dbt { + 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_INTERNAL 0x01 /* Perform any mallocs using regular + malloc, not the user's malloc. */ +#define DB_DBT_MALLOC 0x02 /* Return in allocated memory. */ +#define DB_DBT_PARTIAL 0x04 /* Partial put/get. */ +#define DB_DBT_USERMEM 0x08 /* Return in user's memory. */ + u_int32_t flags; +}; + +/* + * DB internal configuration. + * + * There are a set of functions that the application can replace with its + * own versions, and some other knobs which can be turned at run-time. + */ +#define DB_FUNC_CALLOC 1 /* DELETED: ANSI C calloc. */ +#define DB_FUNC_CLOSE 2 /* POSIX 1003.1 close. */ +#define DB_FUNC_DIRFREE 3 /* DB: free directory list. */ +#define DB_FUNC_DIRLIST 4 /* DB: create directory list. */ +#define DB_FUNC_EXISTS 5 /* DB: return if file exists. */ +#define DB_FUNC_FREE 6 /* ANSI C free. */ +#define DB_FUNC_FSYNC 7 /* POSIX 1003.1 fsync. */ +#define DB_FUNC_IOINFO 8 /* DB: return file I/O information. */ +#define DB_FUNC_MALLOC 9 /* ANSI C malloc. */ +#define DB_FUNC_MAP 10 /* DB: map file into shared memory. */ +#define DB_FUNC_OPEN 11 /* POSIX 1003.1 open. */ +#define DB_FUNC_READ 12 /* POSIX 1003.1 read. */ +#define DB_FUNC_REALLOC 13 /* ANSI C realloc. */ +#define DB_FUNC_SEEK 14 /* POSIX 1003.1 lseek. */ +#define DB_FUNC_SLEEP 15 /* DB: sleep secs/usecs. */ +#define DB_FUNC_STRDUP 16 /* DELETED: DB: strdup(3). */ +#define DB_FUNC_UNLINK 17 /* POSIX 1003.1 unlink. */ +#define DB_FUNC_UNMAP 18 /* DB: unmap shared memory file. */ +#define DB_FUNC_WRITE 19 /* POSIX 1003.1 write. */ +#define DB_FUNC_YIELD 20 /* DB: yield thread to scheduler. */ +#define DB_TSL_SPINS 21 /* DB: initialize spin count. */ +#define DB_FUNC_RUNLINK 22 /* DB: remove a shared region. */ +#define DB_REGION_ANON 23 /* DB: anonymous, unnamed regions. */ +#define DB_REGION_INIT 24 /* DB: page-fault regions in create. */ +#define DB_REGION_NAME 25 /* DB: anonymous, named regions. */ +#define DB_MUTEXLOCKS 26 /* DB: turn off all mutex locks. */ +#define DB_PAGEYIELD 27 /* DB: yield the CPU on pool get. */ + +/* + * Database configuration and initialization. + */ + /* + * Flags understood by both db_open(3) and db_appinit(3). + */ +#define DB_CREATE 0x000001 /* O_CREAT: create file as necessary. */ +#define DB_NOMMAP 0x000002 /* Don't mmap underlying file. */ +#define DB_THREAD 0x000004 /* Free-thread DB package handles. */ + +/* + * Flags understood by db_appinit(3). + */ +/* 0x000007 COMMON MASK. */ +#define DB_INIT_LOCK 0x000008 /* Initialize locking. */ +#define DB_INIT_LOG 0x000010 /* Initialize logging. */ +#define DB_INIT_MPOOL 0x000020 /* Initialize mpool. */ +#define DB_INIT_TXN 0x000040 /* Initialize transactions. */ +#define DB_MPOOL_PRIVATE 0x000080 /* Mpool: private memory pool. */ +#define __UNUSED_100 0x000100 +#define DB_RECOVER 0x000200 /* Run normal recovery. */ +#define DB_RECOVER_FATAL 0x000400 /* Run catastrophic recovery. */ +#define DB_TXN_NOSYNC 0x000800 /* Do not sync log on commit. */ +#define DB_USE_ENVIRON 0x001000 /* Use the environment. */ +#define DB_USE_ENVIRON_ROOT 0x002000 /* Use the environment if root. */ + +/* CURRENTLY UNUSED LOCK FLAGS. */ +#define DB_TXN_LOCK_2PL 0x000000 /* Two-phase locking. */ +#define DB_TXN_LOCK_OPTIMIST 0x000000 /* Optimistic locking. */ +#define DB_TXN_LOCK_MASK 0x000000 /* Lock flags mask. */ + +/* CURRENTLY UNUSED LOG FLAGS. */ +#define DB_TXN_LOG_REDO 0x000000 /* Redo-only logging. */ +#define DB_TXN_LOG_UNDO 0x000000 /* Undo-only logging. */ +#define DB_TXN_LOG_UNDOREDO 0x000000 /* Undo/redo write-ahead logging. */ +#define DB_TXN_LOG_MASK 0x000000 /* Log flags mask. */ + +/* + * Flags understood by db_open(3). + * + * DB_EXCL and DB_TEMPORARY are internal only, and are not documented. + * DB_SEQUENTIAL is currently internal, but may be exported some day. + */ +/* 0x000007 COMMON MASK. */ +/* 0x003fff ALREADY USED. */ +#define __UNUSED_4000 0x004000 +#define DB_EXCL 0x008000 /* O_EXCL: exclusive open. */ +#define DB_RDONLY 0x010000 /* O_RDONLY: read-only. */ +#define DB_SEQUENTIAL 0x020000 /* Indicate sequential access. */ +#define DB_TEMPORARY 0x040000 /* Remove on last close. */ +#define DB_TRUNCATE 0x080000 /* O_TRUNCATE: replace existing DB. */ + +/* + * Deadlock detector modes; used in the DBENV structure to configure the + * locking subsystem. + */ +#define DB_LOCK_NORUN 0x0 +#define DB_LOCK_DEFAULT 0x1 /* Default policy. */ +#define DB_LOCK_OLDEST 0x2 /* Abort oldest transaction. */ +#define DB_LOCK_RANDOM 0x3 /* Abort random transaction. */ +#define DB_LOCK_YOUNGEST 0x4 /* Abort youngest transaction. */ + +struct __db_env { + int db_lorder; /* Byte order. */ + + /* Error message callback. */ + void (*db_errcall) __P((const char *, char *)); + FILE *db_errfile; /* Error message file stream. */ + const char *db_errpfx; /* Error message prefix. */ + int db_verbose; /* Generate debugging messages. */ + + /* User 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. */ + + /* Locking. */ + DB_LOCKTAB *lk_info; /* Return from lock_open(). */ + 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_detect; /* Deadlock detect on all conflicts. */ + + /* Logging. */ + DB_LOG *lg_info; /* Return from log_open(). */ + u_int32_t lg_max; /* Maximum file size. */ + + /* Memory pool. */ + DB_MPOOL *mp_info; /* Return from memp_open(). */ + size_t mp_mmapsize; /* Maximum file size for mmap. */ + size_t mp_size; /* Bytes in the mpool cache. */ + + /* Transactions. */ + DB_TXNMGR *tx_info; /* Return from txn_open(). */ + u_int32_t tx_max; /* Maximum number of transactions. */ + int (*tx_recover) /* Dispatch function for recovery. */ + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + +#define DB_ENV_APPINIT 0x01 /* Paths initialized by db_appinit(). */ +#define DB_ENV_STANDALONE 0x02 /* Test: freestanding environment. */ +#define DB_ENV_THREAD 0x04 /* DB_ENV is multi-threaded. */ + u_int32_t flags; /* Flags. */ +}; + +/******************************************************* + * Access methods. + *******************************************************/ +/* + * XXX + * Changes here must be reflected in java/src/com/sleepycat/db/Db.java. + */ +typedef enum { + DB_BTREE=1, /* B+tree. */ + DB_HASH, /* Extended Linear Hashing. */ + DB_RECNO, /* Fixed and variable-length records. */ + DB_UNKNOWN /* Figure it out on open. */ +} DBTYPE; + +#define DB_BTREEVERSION 6 /* Current btree version. */ +#define DB_BTREEOLDVER 6 /* Oldest btree version supported. */ +#define DB_BTREEMAGIC 0x053162 + +#define DB_HASHVERSION 5 /* Current hash version. */ +#define DB_HASHOLDVER 4 /* Oldest hash version supported. */ +#define DB_HASHMAGIC 0x061561 + +#define DB_LOGVERSION 2 /* Current log version. */ +#define DB_LOGOLDVER 2 /* Oldest log version supported. */ +#define DB_LOGMAGIC 0x040988 + +struct __db_info { + int db_lorder; /* Byte order. */ + size_t db_cachesize; /* Underlying cache size. */ + size_t db_pagesize; /* Underlying page size. */ + + /* Local heap allocation. */ + void *(*db_malloc) __P((size_t)); + + /* Btree access method. */ + u_int32_t bt_maxkey; /* Maximum keys per page. */ + u_int32_t bt_minkey; /* Minimum keys per page. */ + int (*bt_compare) /* Comparison function. */ + __P((const DBT *, const DBT *)); + size_t (*bt_prefix) /* Prefix function. */ + __P((const DBT *, const DBT *)); + + /* Hash access method. */ + u_int32_t h_ffactor; /* Fill factor. */ + u_int32_t h_nelem; /* Number of elements. */ + u_int32_t (*h_hash) /* Hash function. */ + __P((const void *, u_int32_t)); + + /* 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. */ + +#define DB_DELIMITER 0x0001 /* Recno: re_delim set. */ +#define DB_DUP 0x0002 /* Btree, Hash: duplicate keys. */ +#define DB_FIXEDLEN 0x0004 /* Recno: fixed-length records. */ +#define DB_PAD 0x0008 /* Recno: re_pad set. */ +#define DB_RECNUM 0x0010 /* Btree: record numbers. */ +#define DB_RENUMBER 0x0020 /* Recno: renumber on insert/delete. */ +#define DB_SNAPSHOT 0x0040 /* Recno: snapshot the input. */ + u_int32_t flags; +}; + +/* + * DB access method and cursor operation codes. These are implemented as + * bit fields for future flexibility, but currently only a single one may + * be specified to any function. + */ +#define DB_AFTER 0x000001 /* c_put() */ +#define DB_APPEND 0x000002 /* put() */ +#define DB_BEFORE 0x000004 /* c_put() */ +#define DB_CHECKPOINT 0x000008 /* log_put(), log_get() */ +#define DB_CURRENT 0x000010 /* c_get(), c_put(), log_get() */ +#define DB_FIRST 0x000020 /* c_get(), log_get() */ +#define DB_FLUSH 0x000040 /* log_put() */ +#define DB_GET_RECNO 0x000080 /* get(), c_get() */ +#define DB_KEYFIRST 0x000100 /* c_put() */ +#define DB_KEYLAST 0x000200 /* c_put() */ +#define DB_LAST 0x000400 /* c_get(), log_get() */ +#define DB_NEXT 0x000800 /* c_get(), log_get() */ +#define DB_NOOVERWRITE 0x001000 /* put() */ +#define DB_NOSYNC 0x002000 /* close() */ +#define DB_PREV 0x004000 /* c_get(), log_get() */ +#define DB_RECORDCOUNT 0x008000 /* stat() */ +#define DB_SET 0x010000 /* c_get(), log_get() */ +#define DB_SET_RANGE 0x020000 /* c_get() */ +#define DB_SET_RECNO 0x040000 /* c_get() */ +#define DB_CURLSN 0x080000 /* log_put() */ + +/* + * DB (user visible) error return codes. + * + * XXX + * Changes to any of the user visible error return codes must be reflected + * in java/src/com/sleepycat/db/Db.java. + */ +#define DB_INCOMPLETE ( -1) /* Sync didn't finish. */ +#define DB_KEYEMPTY ( -2) /* The key/data pair was deleted or + was never created by the user. */ +#define DB_KEYEXIST ( -3) /* The key/data pair already exists. */ +#define DB_LOCK_DEADLOCK ( -4) /* Locker killed to resolve deadlock. */ +#define DB_LOCK_NOTGRANTED ( -5) /* Lock unavailable, no-wait set. */ +#define DB_LOCK_NOTHELD ( -6) /* Lock not held by locker. */ +#define DB_NOTFOUND ( -7) /* Key/data pair not found (EOF). */ + +/* DB (private) error return codes. */ +#define DB_DELETED ( -8) /* Recovery file marked deleted. */ +#define DB_NEEDSPLIT ( -9) /* Page needs to be split. */ +#define DB_REGISTERED (-10) /* Entry was previously registered. */ +#define DB_SWAPBYTES (-11) /* Database needs byte swapping. */ +#define DB_TXN_CKP (-12) /* Encountered ckp record in log. */ + +struct __db_ilock { /* Internal DB access method lock. */ + db_pgno_t pgno; /* Page being locked. */ + /* File id. */ + u_int8_t fileid[DB_FILE_ID_LEN]; +}; + +/* DB access method description structure. */ +struct __db { + void *mutexp; /* Synchronization for free threading */ + DBTYPE type; /* DB access method. */ + DB_ENV *dbenv; /* DB_ENV structure. */ + DB_ENV *mp_dbenv; /* DB_ENV for local mpool creation. */ + + DB *master; /* Original DB created by db_open. */ + void *internal; /* Access method private. */ + + DB_MPOOL *mp; /* The access method's mpool. */ + DB_MPOOLFILE *mpf; /* The access method's mpool file. */ + + /* + * XXX + * Explicit representations of structures in queue.h. + * + * TAILQ_HEAD(curs_queue, __dbc); + */ + struct { + struct __dbc *tqh_first; + struct __dbc **tqh_last; + } curs_queue; + + /* + * XXX + * Explicit representations of structures in queue.h. + * + * LIST_HEAD(handleq, __db); + * LIST_ENTRY(__db); + */ + struct { + struct __db *lh_first; + } handleq; /* List of handles for this DB. */ + struct { + struct __db *le_next; + struct __db **le_prev; + } links; /* Links for the handle list. */ + + u_int32_t log_fileid; /* Logging file id. */ + + DB_TXN *txn; /* Current transaction. */ + u_int32_t locker; /* Default process' locker id. */ + DBT lock_dbt; /* DBT referencing lock. */ + struct __db_ilock lock; /* Lock. */ + + size_t pgsize; /* Logical page size of file. */ + + /* Local heap allocation. */ + void *(*db_malloc) __P((size_t)); + + /* Functions. */ + int (*close) __P((DB *, u_int32_t)); + int (*cursor) __P((DB *, DB_TXN *, DBC **)); + int (*del) __P((DB *, DB_TXN *, DBT *, u_int32_t)); + int (*fd) __P((DB *, int *)); + int (*get) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); + int (*put) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); + int (*stat) __P((DB *, void *, void *(*)(size_t), u_int32_t)); + int (*sync) __P((DB *, u_int32_t)); + +#define DB_AM_DUP 0x000001 /* DB_DUP (internal). */ +#define DB_AM_INMEM 0x000002 /* In-memory; no sync on close. */ +#define DB_AM_LOCKING 0x000004 /* Perform locking. */ +#define DB_AM_LOGGING 0x000008 /* Perform logging. */ +#define DB_AM_MLOCAL 0x000010 /* Database memory pool is local. */ +#define DB_AM_PGDEF 0x000020 /* Page size was defaulted. */ +#define DB_AM_RDONLY 0x000040 /* Database is readonly. */ +#define DB_AM_RECOVER 0x000080 /* In recovery (do not log or lock). */ +#define DB_AM_SWAP 0x000100 /* Pages need to be byte-swapped. */ +#define DB_AM_THREAD 0x000200 /* DB is multi-threaded. */ +#define DB_BT_RECNUM 0x000400 /* DB_RECNUM (internal) */ +#define DB_HS_DIRTYMETA 0x000800 /* Hash: Metadata page modified. */ +#define DB_RE_DELIMITER 0x001000 /* DB_DELIMITER (internal). */ +#define DB_RE_FIXEDLEN 0x002000 /* DB_FIXEDLEN (internal). */ +#define DB_RE_PAD 0x004000 /* DB_PAD (internal). */ +#define DB_RE_RENUMBER 0x008000 /* DB_RENUMBER (internal). */ +#define DB_RE_SNAPSHOT 0x010000 /* DB_SNAPSHOT (internal). */ + u_int32_t flags; +}; + +/* Cursor description structure. */ +struct __dbc { + DB *dbp; /* Related DB access method. */ + DB_TXN *txn; /* Associated transaction. */ + + /* + * XXX + * Explicit representations of structures in queue.h. + * + * TAILQ_ENTRY(__dbc); + */ + struct { + struct __dbc *tqe_next; + struct __dbc **tqe_prev; + } links; + + void *internal; /* Access method private. */ + + int (*c_close) __P((DBC *)); + int (*c_del) __P((DBC *, u_int32_t)); + int (*c_get) __P((DBC *, DBT *, DBT *, u_int32_t)); + int (*c_put) __P((DBC *, DBT *, DBT *, u_int32_t)); +}; + +/* Btree/recno statistics structure. */ +struct __db_bt_stat { + u_int32_t bt_flags; /* Open flags. */ + 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_pagesize; /* Page size. */ + u_int32_t bt_levels; /* Tree levels. */ + u_int32_t bt_nrecs; /* Number of records. */ + 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_freed; /* Pages freed for reuse. */ + 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. */ + u_int32_t bt_pfxsaved; /* Bytes saved by prefix compression. */ + u_int32_t bt_split; /* Total number of splits. */ + u_int32_t bt_rootsplit; /* Root page splits. */ + u_int32_t bt_fastsplit; /* Fast splits. */ + u_int32_t bt_added; /* Items added. */ + u_int32_t bt_deleted; /* Items deleted. */ + u_int32_t bt_get; /* Items retrieved. */ + u_int32_t bt_cache_hit; /* Hits in fast-insert code. */ + u_int32_t bt_cache_miss; /* Misses in fast-insert code. */ + u_int32_t bt_magic; /* Magic number. */ + u_int32_t bt_version; /* Version number. */ +}; + +#if defined(__cplusplus) +extern "C" { +#endif +int db_appinit __P((const char *, char * const *, DB_ENV *, u_int32_t)); +int db_appexit __P((DB_ENV *)); +int db_jump_set __P((void *, int)); +int db_open __P((const char *, + DBTYPE, u_int32_t, int, DB_ENV *, DB_INFO *, DB **)); +int db_value_set __P((int, int)); +char *db_version __P((int *, int *, int *)); +#if defined(__cplusplus) +} +#endif + +/******************************************************* + * Locking + *******************************************************/ +#define DB_LOCKVERSION 1 +#define DB_LOCKMAGIC 0x090193 + +/* Flag values for lock_vec(). */ +#define DB_LOCK_NOWAIT 0x01 /* Don't wait on unavailable lock. */ + +/* Flag values for lock_detect(). */ +#define DB_LOCK_CONFLICT 0x01 /* Run on any conflict. */ + +/* + * Request types. + * + * XXX + * Changes here must be reflected in java/src/com/sleepycat/db/Db.java. + */ +typedef enum { + DB_LOCK_DUMP=0, /* Display held locks. */ + DB_LOCK_GET, /* Get the lock. */ + DB_LOCK_PUT, /* Release the lock. */ + DB_LOCK_PUT_ALL, /* Release locker's locks. */ + DB_LOCK_PUT_OBJ /* Release locker's locks on obj. */ +} db_lockop_t; + +/* + * Simple R/W lock modes and for multi-granularity intention locking. + * + * XXX + * Changes here must be reflected in java/src/com/sleepycat/db/Db.java. + */ +typedef enum { + DB_LOCK_NG=0, /* Not granted. */ + DB_LOCK_READ, /* Shared/read. */ + DB_LOCK_WRITE, /* Exclusive/write. */ + DB_LOCK_IREAD, /* Intent to share/read. */ + DB_LOCK_IWRITE, /* Intent exclusive/write. */ + DB_LOCK_IWR /* Intent to read and write. */ +} db_lockmode_t; + +/* + * Status of a lock. + */ +typedef enum { + DB_LSTAT_ABORTED, /* Lock belongs to an aborted txn. */ + DB_LSTAT_ERR, /* Lock is bad. */ + DB_LSTAT_FREE, /* Lock is unallocated. */ + DB_LSTAT_HELD, /* Lock is currently held. */ + DB_LSTAT_NOGRANT, /* Lock was not granted. */ + DB_LSTAT_PENDING, /* Lock was waiting and has been + * promoted; waiting for the owner + * to run and upgrade it to held. */ + DB_LSTAT_WAITING /* Lock is on the wait queue. */ +} db_status_t; + +/* Lock request structure. */ +struct __db_lockreq { + db_lockop_t op; /* Operation. */ + db_lockmode_t mode; /* Requested mode. */ + u_int32_t locker; /* Locker identity. */ + DBT *obj; /* Object being locked. */ + DB_LOCK lock; /* Lock returned. */ +}; + +/* + * Commonly used conflict matrices. + * + * Standard Read/Write (or exclusive/shared) locks. + */ +#define DB_LOCK_RW_N 3 +extern const u_int8_t db_rw_conflicts[]; + +/* Multi-granularity locking. */ +#define DB_LOCK_RIW_N 6 +extern const u_int8_t db_riw_conflicts[]; + +struct __db_lock_stat { + u_int32_t st_magic; /* Lock file magic number. */ + u_int32_t st_version; /* Lock file version number. */ + u_int32_t st_maxlocks; /* Maximum number of locks in table. */ + u_int32_t st_nmodes; /* Number of lock modes. */ + u_int32_t st_numobjs; /* Number of objects. */ + u_int32_t st_nlockers; /* Number of lockers. */ + 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_ndeadlocks; /* Number of lock deadlocks. */ + 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_refcnt; /* Region reference count. */ + u_int32_t st_regsize; /* Region size. */ +}; + +#if defined(__cplusplus) +extern "C" { +#endif +int lock_close __P((DB_LOCKTAB *)); +int lock_detect __P((DB_LOCKTAB *, u_int32_t, u_int32_t)); +int lock_get __P((DB_LOCKTAB *, + u_int32_t, u_int32_t, const DBT *, db_lockmode_t, DB_LOCK *)); +int lock_id __P((DB_LOCKTAB *, u_int32_t *)); +int lock_open __P((const char *, + u_int32_t, int, DB_ENV *, DB_LOCKTAB **)); +int lock_put __P((DB_LOCKTAB *, DB_LOCK)); +int lock_stat __P((DB_LOCKTAB *, DB_LOCK_STAT **, void *(*)(size_t))); +int lock_unlink __P((const char *, int, DB_ENV *)); +int lock_vec __P((DB_LOCKTAB *, + u_int32_t, u_int32_t, DB_LOCKREQ *, int, DB_LOCKREQ **)); +#if defined(__cplusplus) +} +#endif + +/******************************************************* + * Logging. + *******************************************************/ +/* 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. */ +}; + +/* Log statistics structure. */ +struct __db_log_stat { + u_int32_t st_magic; /* Log file magic number. */ + u_int32_t st_version; /* Log file version number. */ + int st_mode; /* Log file mode. */ + u_int32_t st_lg_max; /* Maximum log file size. */ + u_int32_t st_w_bytes; /* Bytes to log. */ + u_int32_t st_w_mbytes; /* Megabytes to log. */ + u_int32_t st_wc_bytes; /* Bytes to log since checkpoint. */ + u_int32_t st_wc_mbytes; /* Megabytes to log since checkpoint. */ + u_int32_t st_wcount; /* Total syncs to the log. */ + u_int32_t st_scount; /* Total writes to the log. */ + u_int32_t st_region_wait; /* Region lock granted after wait. */ + u_int32_t st_region_nowait; /* Region lock granted without wait. */ + u_int32_t st_cur_file; /* Current log file number. */ + u_int32_t st_cur_offset; /* Current log file offset. */ + u_int32_t st_refcnt; /* Region reference count. */ + u_int32_t st_regsize; /* Region size. */ +}; + +#if defined(__cplusplus) +extern "C" { +#endif +int log_archive __P((DB_LOG *, char **[], u_int32_t, void *(*)(size_t))); +int log_close __P((DB_LOG *)); +int log_compare __P((const DB_LSN *, const DB_LSN *)); +int log_file __P((DB_LOG *, const DB_LSN *, char *, size_t)); +int log_flush __P((DB_LOG *, const DB_LSN *)); +int log_get __P((DB_LOG *, DB_LSN *, DBT *, u_int32_t)); +int log_open __P((const char *, u_int32_t, int, DB_ENV *, DB_LOG **)); +int log_put __P((DB_LOG *, DB_LSN *, const DBT *, u_int32_t)); +int log_register __P((DB_LOG *, DB *, const char *, DBTYPE, u_int32_t *)); +int log_stat __P((DB_LOG *, DB_LOG_STAT **, void *(*)(size_t))); +int log_unlink __P((const char *, int, DB_ENV *)); +int log_unregister __P((DB_LOG *, u_int32_t)); +#if defined(__cplusplus) +} +#endif + +/******************************************************* + * Mpool + *******************************************************/ +/* Flag values for memp_fget(). */ +#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 memp_fput(), memp_fset(). */ +#define DB_MPOOL_CLEAN 0x001 /* Clear modified bit. */ +#define DB_MPOOL_DIRTY 0x002 /* Page is modified. */ +#define DB_MPOOL_DISCARD 0x004 /* Don't cache the page. */ + +/* Mpool statistics structure. */ +struct __db_mpool_stat { + size_t st_cachesize; /* Cache size. */ + u_int32_t st_cache_hit; /* Pages found in the cache. */ + u_int32_t st_cache_miss; /* Pages not found in the cache. */ + u_int32_t st_map; /* Pages from mapped files. */ + u_int32_t st_page_create; /* Pages created in the cache. */ + u_int32_t st_page_in; /* Pages read in. */ + u_int32_t st_page_out; /* Pages written out. */ + u_int32_t st_ro_evict; /* Clean pages forced from the cache. */ + u_int32_t st_rw_evict; /* Dirty pages forced from the cache. */ + u_int32_t st_hash_buckets; /* Number of hash buckets. */ + u_int32_t st_hash_searches; /* Total hash chain searches. */ + u_int32_t st_hash_longest; /* Longest hash chain searched. */ + u_int32_t st_hash_examined; /* Total hash entries searched. */ + u_int32_t st_page_clean; /* Clean pages. */ + u_int32_t st_page_dirty; /* Dirty pages. */ + u_int32_t st_page_trickle; /* Pages written by memp_trickle. */ + u_int32_t st_region_wait; /* Region lock granted after wait. */ + u_int32_t st_region_nowait; /* Region lock granted without wait. */ + u_int32_t st_refcnt; /* Region reference count. */ + u_int32_t st_regsize; /* Region size. */ +}; + +/* Mpool file open information structure. */ +struct __db_mpool_finfo { + 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. */ +}; + +/* Mpool file statistics structure. */ +struct __db_mpool_fstat { + char *file_name; /* File name. */ + size_t st_pagesize; /* Page size. */ + u_int32_t st_cache_hit; /* Pages found in the cache. */ + u_int32_t st_cache_miss; /* Pages not found in the cache. */ + u_int32_t st_map; /* Pages from mapped files. */ + u_int32_t st_page_create; /* Pages created in the cache. */ + u_int32_t st_page_in; /* Pages read in. */ + u_int32_t st_page_out; /* Pages written out. */ +}; + +#if defined(__cplusplus) +extern "C" { +#endif +int memp_close __P((DB_MPOOL *)); +int memp_fclose __P((DB_MPOOLFILE *)); +int memp_fget __P((DB_MPOOLFILE *, db_pgno_t *, u_int32_t, void *)); +int memp_fopen __P((DB_MPOOL *, const char *, + u_int32_t, int, size_t, DB_MPOOL_FINFO *, DB_MPOOLFILE **)); +int memp_fput __P((DB_MPOOLFILE *, void *, u_int32_t)); +int memp_fset __P((DB_MPOOLFILE *, void *, u_int32_t)); +int memp_fsync __P((DB_MPOOLFILE *)); +int memp_open __P((const char *, u_int32_t, int, DB_ENV *, DB_MPOOL **)); +int memp_register __P((DB_MPOOL *, int, + int (*)(db_pgno_t, void *, DBT *), + int (*)(db_pgno_t, void *, DBT *))); +int memp_stat __P((DB_MPOOL *, + DB_MPOOL_STAT **, DB_MPOOL_FSTAT ***, void *(*)(size_t))); +int memp_sync __P((DB_MPOOL *, DB_LSN *)); +int memp_trickle __P((DB_MPOOL *, int, int *)); +int memp_unlink __P((const char *, int, DB_ENV *)); +#if defined(__cplusplus) +} +#endif + +/******************************************************* + * Transactions. + *******************************************************/ +#define DB_TXNVERSION 1 +#define DB_TXNMAGIC 0x041593 + +/* Operations values to the tx_recover() function. */ +#define DB_TXN_BACKWARD_ROLL 1 /* Read the log backwards. */ +#define DB_TXN_FORWARD_ROLL 2 /* Read the log forwards. */ +#define DB_TXN_OPENFILES 3 /* Read for open files. */ +#define DB_TXN_REDO 4 /* Redo the operation. */ +#define DB_TXN_UNDO 5 /* Undo the operation. */ + +/* Internal transaction status values. */ + +/* Transaction statistics structure. */ +struct __db_txn_active { + u_int32_t txnid; /* Transaction ID */ + DB_LSN lsn; /* Lsn of the begin record */ +}; + +struct __db_txn_stat { + DB_LSN st_last_ckp; /* lsn of the last checkpoint */ + DB_LSN st_pending_ckp; /* last checkpoint did not finish */ + 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 number of active txns */ + 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 */ + 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_refcnt; /* Region reference count. */ + u_int32_t st_regsize; /* Region size. */ +}; + +#if defined(__cplusplus) +extern "C" { +#endif +int txn_abort __P((DB_TXN *)); +int txn_begin __P((DB_TXNMGR *, DB_TXN *, DB_TXN **)); +int txn_checkpoint __P((const DB_TXNMGR *, u_int32_t, u_int32_t)); +int txn_commit __P((DB_TXN *)); +int txn_close __P((DB_TXNMGR *)); +u_int32_t txn_id __P((DB_TXN *)); +int txn_open __P((const char *, u_int32_t, int, DB_ENV *, DB_TXNMGR **)); +int txn_prepare __P((DB_TXN *)); +int txn_stat __P((DB_TXNMGR *, DB_TXN_STAT **, void *(*)(size_t))); +int txn_unlink __P((const char *, int, DB_ENV *)); +#if defined(__cplusplus) +} +#endif + +#ifndef DB_DBM_HSEARCH +#define DB_DBM_HSEARCH 0 /* No historic interfaces by default. */ +#endif +#if DB_DBM_HSEARCH != 0 +/******************************************************* + * Dbm/Ndbm historic interfaces. + *******************************************************/ +#define DBM_INSERT 0 /* Flags to dbm_store(). */ +#define DBM_REPLACE 1 + +/* + * The db(3) 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 DBM calls into DB calls so that DB doesn't step on the + * application's name space. + * + * The global variables dbrdonly, dirf and pagf were not retained when + * 4BSD replaced the dbm interface with ndbm, and are not support here. + */ +#define dbminit(a) __db_dbm_init(a) +#if !defined(__cplusplus) +#define delete(a) __db_dbm_delete(a) +#endif +#define fetch(a) __db_dbm_fetch(a) +#define firstkey __db_dbm_firstkey +#define nextkey(a) __db_dbm_nextkey(a) +#define store(a, b) __db_dbm_store(a, b) + +/* Prototype the DB calls. */ +#if defined(__cplusplus) +extern "C" { +#endif +int __db_dbm_init __P((char *)); +int __db_dbm_delete __P((datum)); +int __db_dbm_dbrdonly __P((void)); +int __db_dbm_dirf __P((void)); +datum __db_dbm_fetch __P((datum)); +datum __db_dbm_firstkey __P((void)); +datum __db_dbm_nextkey __P((datum)); +int __db_dbm_pagf __P((void)); +int __db_dbm_store __P((datum, datum)); +#if defined(__cplusplus) +} +#endif + +/* + * 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(a) +#define dbm_close(a) __db_ndbm_close(a) +#define dbm_delete(a, b) __db_ndbm_delete(a, b) +#define dbm_dirfno(a) __db_ndbm_dirfno(a) +#define dbm_error(a) __db_ndbm_error(a) +#define dbm_fetch(a, b) __db_ndbm_fetch(a, b) +#define dbm_firstkey(a) __db_ndbm_firstkey(a) +#define dbm_nextkey(a) __db_ndbm_nextkey(a) +#define dbm_open(a, b, c) __db_ndbm_open(a, b, c) +#define dbm_pagfno(a) __db_ndbm_pagfno(a) +#define dbm_rdonly(a) __db_ndbm_rdonly(a) +#define dbm_store(a, b, c, d) __db_ndbm_store(a, b, c, d) + +/* Prototype the DB calls. */ +#if defined(__cplusplus) +extern "C" { +#endif +int __db_ndbm_clearerr __P((DBM *)); +void __db_ndbm_close __P((DBM *)); +int __db_ndbm_delete __P((DBM *, datum)); +int __db_ndbm_dirfno __P((DBM *)); +int __db_ndbm_error __P((DBM *)); +datum __db_ndbm_fetch __P((DBM *, datum)); +datum __db_ndbm_firstkey __P((DBM *)); +datum __db_ndbm_nextkey __P((DBM *)); +DBM *__db_ndbm_open __P((const char *, int, int)); +int __db_ndbm_pagfno __P((DBM *)); +int __db_ndbm_rdonly __P((DBM *)); +int __db_ndbm_store __P((DBM *, datum, datum, int)); +#if defined(__cplusplus) +} +#endif + +/******************************************************* + * Hsearch historic interface. + *******************************************************/ +typedef enum { + FIND, ENTER +} ACTION; + +typedef struct entry { + char *key; + char *data; +} ENTRY; + +/* + * Translate HSEARCH calls into DB calls so that DB doesn't step on the + * application's name space. + */ +#define hcreate(a) __db_hcreate(a) +#define hdestroy __db_hdestroy +#define hsearch(a, b) __db_hsearch(a, b) + +/* Prototype the DB calls. */ +#if defined(__cplusplus) +extern "C" { +#endif +int __db_hcreate __P((size_t)); +void __db_hdestroy __P((void)); +ENTRY *__db_hsearch __P((ENTRY, ACTION)); +#if defined(__cplusplus) +} +#endif +#endif /* DB_DBM_HSEARCH */ + +/* + * XXX + * MacOS: Reset Metrowerks C enum sizes. + */ +#ifdef __MWERKS__ +#pragma enumsalwaysint reset +#endif +#endif /* !_DB_H_ */ diff --git a/mozilla/db/build.win32/db_archive.dsp b/mozilla/db/build.win32/db_archive.dsp new file mode 100644 index 00000000000..4adb2f6ad0d --- /dev/null +++ b/mozilla/db/build.win32/db_archive.dsp @@ -0,0 +1,99 @@ +# Microsoft Developer Studio Project File - Name="db_archive" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=db_archive - 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_archive.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_archive.mak" CFG="db_archive - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "db_archive - Win32 Release" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "db_archive - Win32 Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "db_archive - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "db_archi" +# PROP BASE Intermediate_Dir "db_archi" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 release/libdb.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "db_archive - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "db_arch0" +# PROP BASE Intermediate_Dir "db_arch0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "." /I "../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 debug/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /fixed:no + +!ENDIF + +# Begin Target + +# Name "db_archive - Win32 Release" +# Name "db_archive - Win32 Debug" +# Begin Source File + +SOURCE=..\db_archive\db_archive.c +# End Source File +# Begin Source File + +SOURCE=..\clib\err.c +# End Source File +# Begin Source File + +SOURCE=..\clib\getopt.c +# End Source File +# End Target +# End Project diff --git a/mozilla/db/build.win32/db_buildall.dsp b/mozilla/db/build.win32/db_buildall.dsp new file mode 100644 index 00000000000..b180a5ce96a --- /dev/null +++ b/mozilla/db/build.win32/db_buildall.dsp @@ -0,0 +1,80 @@ +# Microsoft Developer Studio Project File - Name="db_buildall" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) External Target" 0x0106 + +CFG=DB_BUILDALL - 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_buildall.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_buildall.mak" CFG="DB_BUILDALL - WIN32 DEBUG" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "db_buildall - Win32 Release" (based on "Win32 (x86) External Target") +!MESSAGE "db_buildall - Win32 Debug" (based on "Win32 (x86) External Target") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" + +!IF "$(CFG)" == "db_buildall - 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_buildall.mak" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "db_buildall.exe" +# PROP BASE Bsc_Name "db_buildall.bsc" +# PROP BASE Target_Dir "" +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Cmd_Line "echo DB release version built." +# PROP Rebuild_Opt "" +# PROP Target_File "db_buildall.exe" +# PROP Bsc_Name "db_buildall.bsc" +# PROP Target_Dir "" + +!ELSEIF "$(CFG)" == "db_buildall - 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_buildall.mak" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "db_buildall.exe" +# PROP BASE Bsc_Name "db_buildall.bsc" +# PROP BASE Target_Dir "" +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Cmd_Line "echo DB debug version built." +# PROP Rebuild_Opt "" +# PROP Target_File "db_buildall.exe" +# PROP Bsc_Name "db_buildall.bsc" +# PROP Target_Dir "" + +!ENDIF + +# Begin Target + +# Name "db_buildall - Win32 Release" +# Name "db_buildall - Win32 Debug" + +!IF "$(CFG)" == "db_buildall - Win32 Release" + +!ELSEIF "$(CFG)" == "db_buildall - Win32 Debug" + +!ENDIF + +# End Target +# End Project diff --git a/mozilla/db/build.win32/db_checkpoint.dsp b/mozilla/db/build.win32/db_checkpoint.dsp new file mode 100644 index 00000000000..52684907ba4 --- /dev/null +++ b/mozilla/db/build.win32/db_checkpoint.dsp @@ -0,0 +1,103 @@ +# Microsoft Developer Studio Project File - Name="db_checkpoint" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=db_checkpoint - 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_checkpoint.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_checkpoint.mak" CFG="db_checkpoint - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "db_checkpoint - Win32 Release" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "db_checkpoint - Win32 Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "db_checkpoint - 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 Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 release/libdb.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "db_checkpoint - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "db_check" +# PROP BASE Intermediate_Dir "db_check" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "." /I "../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 debug/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /fixed:no + +!ENDIF + +# Begin Target + +# Name "db_checkpoint - Win32 Release" +# Name "db_checkpoint - Win32 Debug" +# Begin Source File + +SOURCE=..\db_checkpoint\db_checkpoint.c +# End Source File +# Begin Source File + +SOURCE=..\clib\err.c +# End Source File +# Begin Source File + +SOURCE=..\clib\getlong.c +# End Source File +# Begin Source File + +SOURCE=..\clib\getopt.c +# End Source File +# End Target +# End Project diff --git a/mozilla/db/build.win32/db_deadlock.dsp b/mozilla/db/build.win32/db_deadlock.dsp new file mode 100644 index 00000000000..15683bb6928 --- /dev/null +++ b/mozilla/db/build.win32/db_deadlock.dsp @@ -0,0 +1,103 @@ +# Microsoft Developer Studio Project File - Name="db_deadlock" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=db_deadlock - 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_deadlock.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_deadlock.mak" CFG="db_deadlock - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "db_deadlock - Win32 Release" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "db_deadlock - Win32 Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "db_deadlock - 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 Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 release/libdb.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "db_deadlock - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "db_deadl" +# PROP BASE Intermediate_Dir "db_deadl" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "." /I "../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 debug/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /fixed:no + +!ENDIF + +# Begin Target + +# Name "db_deadlock - Win32 Release" +# Name "db_deadlock - Win32 Debug" +# Begin Source File + +SOURCE=..\db_deadlock\db_deadlock.c +# End Source File +# Begin Source File + +SOURCE=..\clib\err.c +# End Source File +# Begin Source File + +SOURCE=..\clib\getlong.c +# End Source File +# Begin Source File + +SOURCE=..\clib\getopt.c +# End Source File +# End Target +# End Project diff --git a/mozilla/db/build.win32/db_dll.dsp b/mozilla/db/build.win32/db_dll.dsp new file mode 100644 index 00000000000..2908135ebf4 --- /dev/null +++ b/mozilla/db/build.win32/db_dll.dsp @@ -0,0 +1,491 @@ +# Microsoft Developer Studio Project File - Name="DB_DLL" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=DB_DLL - 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_DLL.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_DLL.MAK" CFG="DB_DLL - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "DB_DLL - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "DB_DLL - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "DB_DLL - 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 Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /Ob2 /I "." /I "../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "DB_CREATE_DLL" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 /nologo /base:"0x13000000" /subsystem:windows /dll /machine:I386 /out:"Release/libdb.dll" + +!ELSEIF "$(CFG)" == "DB_DLL - 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 Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "." /I "../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "DB_CREATE_DLL" /YX"config.h" /FD /c +# SUBTRACT CPP /Fr +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 /nologo /base:"0x13000000" /subsystem:windows /dll /pdb:none /debug /machine:I386 /out:"Debug/libdb.dll" /fixed:no + +!ENDIF + +# Begin Target + +# Name "DB_DLL - Win32 Release" +# Name "DB_DLL - Win32 Debug" +# Begin Source File + +SOURCE=..\btree\bt_close.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_compare.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_conv.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_cursor.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_delete.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_open.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_page.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_put.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_rec.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_recno.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_rsearch.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_search.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_split.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_stat.c +# End Source File +# Begin Source File + +SOURCE=..\btree\btree_auto.c +# End Source File +# Begin Source File + +SOURCE=..\cxx\cxx_app.cpp +# End Source File +# Begin Source File + +SOURCE=..\cxx\cxx_except.cpp +# End Source File +# Begin Source File + +SOURCE=..\cxx\cxx_lock.cpp +# End Source File +# Begin Source File + +SOURCE=..\cxx\cxx_log.cpp +# End Source File +# Begin Source File + +SOURCE=..\cxx\cxx_mpool.cpp +# End Source File +# Begin Source File + +SOURCE=..\cxx\cxx_table.cpp +# End Source File +# Begin Source File + +SOURCE=..\cxx\cxx_txn.cpp +# End Source File +# Begin Source File + +SOURCE=..\db\db.c +# End Source File +# Begin Source File + +SOURCE=.\db.h +# End Source File +# Begin Source File + +SOURCE=..\common\db_appinit.c +# End Source File +# Begin Source File + +SOURCE=..\common\db_apprec.c +# End Source File +# Begin Source File + +SOURCE=..\db\db_auto.c +# End Source File +# Begin Source File + +SOURCE=..\common\db_byteorder.c +# End Source File +# Begin Source File + +SOURCE=..\db\db_conv.c +# End Source File +# Begin Source File + +SOURCE=..\db\db_dispatch.c +# End Source File +# Begin Source File + +SOURCE=..\db\db_dup.c +# End Source File +# Begin Source File + +SOURCE=..\common\db_err.c +# End Source File +# Begin Source File + +SOURCE=.\db_int.h +# End Source File +# Begin Source File + +SOURCE=..\common\db_log2.c +# End Source File +# Begin Source File + +SOURCE=..\db\db_overflow.c +# End Source File +# Begin Source File + +SOURCE=..\db\db_pr.c +# End Source File +# Begin Source File + +SOURCE=..\db\db_rec.c +# End Source File +# Begin Source File + +SOURCE=..\common\db_region.c +# End Source File +# Begin Source File + +SOURCE=..\db\db_ret.c +# End Source File +# Begin Source File + +SOURCE=..\common\db_salloc.c +# End Source File +# Begin Source File + +SOURCE=..\common\db_shash.c +# End Source File +# Begin Source File + +SOURCE=..\db\db_thread.c +# End Source File +# Begin Source File + +SOURCE=..\dbm\dbm.c +# End Source File +# Begin Source File + +SOURCE=.\dllmain.c +# End Source File +# Begin Source File + +SOURCE=..\hash\hash.c +# End Source File +# Begin Source File + +SOURCE=..\hash\hash_auto.c +# End Source File +# Begin Source File + +SOURCE=..\hash\hash_conv.c +# End Source File +# Begin Source File + +SOURCE=..\hash\hash_debug.c +# End Source File +# Begin Source File + +SOURCE=..\hash\hash_dup.c +# End Source File +# Begin Source File + +SOURCE=..\hash\hash_func.c +# End Source File +# Begin Source File + +SOURCE=..\hash\hash_page.c +# End Source File +# Begin Source File + +SOURCE=..\hash\hash_rec.c +# End Source File +# Begin Source File + +SOURCE=..\hash\hash_stat.c +# End Source File +# Begin Source File + +SOURCE=..\hsearch\hsearch.c +# End Source File +# Begin Source File + +SOURCE=.\libdb.def +# End Source File +# Begin Source File + +SOURCE=.\libdb.rc +# End Source File +# Begin Source File + +SOURCE=..\lock\lock.c +# End Source File +# Begin Source File + +SOURCE=..\lock\lock_conflict.c +# End Source File +# Begin Source File + +SOURCE=..\lock\lock_deadlock.c +# End Source File +# Begin Source File + +SOURCE=..\lock\lock_region.c +# End Source File +# Begin Source File + +SOURCE=..\lock\lock_util.c +# End Source File +# Begin Source File + +SOURCE=..\log\log.c +# End Source File +# Begin Source File + +SOURCE=..\log\log_archive.c +# End Source File +# Begin Source File + +SOURCE=..\log\log_auto.c +# End Source File +# Begin Source File + +SOURCE=..\log\log_compare.c +# End Source File +# Begin Source File + +SOURCE=..\log\log_findckp.c +# End Source File +# Begin Source File + +SOURCE=..\log\log_get.c +# End Source File +# Begin Source File + +SOURCE=..\log\log_put.c +# End Source File +# Begin Source File + +SOURCE=..\log\log_rec.c +# End Source File +# Begin Source File + +SOURCE=..\log\log_register.c +# End Source File +# Begin Source File + +SOURCE=..\mp\mp_bh.c +# End Source File +# Begin Source File + +SOURCE=..\mp\mp_fget.c +# End Source File +# Begin Source File + +SOURCE=..\mp\mp_fopen.c +# End Source File +# Begin Source File + +SOURCE=..\mp\mp_fput.c +# End Source File +# Begin Source File + +SOURCE=..\mp\mp_fset.c +# End Source File +# Begin Source File + +SOURCE=..\mp\mp_open.c +# End Source File +# Begin Source File + +SOURCE=..\mp\mp_pr.c +# End Source File +# Begin Source File + +SOURCE=..\mp\mp_region.c +# End Source File +# Begin Source File + +SOURCE=..\mp\mp_sync.c +# End Source File +# Begin Source File + +SOURCE=..\mutex\mutex.c +# End Source File +# Begin Source File + +SOURCE=..\os.win32\os_abs.c +# End Source File +# Begin Source File + +SOURCE=..\os\os_alloc.c +# End Source File +# Begin Source File + +SOURCE=..\os\os_config.c +# End Source File +# Begin Source File + +SOURCE=..\os.win32\os_dir.c +# End Source File +# Begin Source File + +SOURCE=..\os.win32\os_fid.c +# End Source File +# Begin Source File + +SOURCE=..\os\os_fsync.c +# End Source File +# Begin Source File + +SOURCE=..\os.win32\os_map.c +# End Source File +# Begin Source File + +SOURCE=..\os\os_oflags.c +# End Source File +# Begin Source File + +SOURCE=..\os\os_open.c +# End Source File +# Begin Source File + +SOURCE=..\os\os_rpath.c +# End Source File +# Begin Source File + +SOURCE=..\os\os_rw.c +# End Source File +# Begin Source File + +SOURCE=..\os.win32\os_seek.c +# End Source File +# Begin Source File + +SOURCE=..\os.win32\os_sleep.c +# End Source File +# Begin Source File + +SOURCE=..\os.win32\os_spin.c +# End Source File +# Begin Source File + +SOURCE=..\os\os_stat.c +# End Source File +# Begin Source File + +SOURCE=..\os\os_unlink.c +# End Source File +# Begin Source File + +SOURCE=..\clib\strsep.c +# End Source File +# Begin Source File + +SOURCE=..\txn\txn.c +# End Source File +# Begin Source File + +SOURCE=..\txn\txn_auto.c +# End Source File +# Begin Source File + +SOURCE=..\txn\txn_rec.c +# End Source File +# End Target +# End Project diff --git a/mozilla/db/build.win32/db_dump.dsp b/mozilla/db/build.win32/db_dump.dsp new file mode 100644 index 00000000000..403245943ca --- /dev/null +++ b/mozilla/db/build.win32/db_dump.dsp @@ -0,0 +1,101 @@ +# Microsoft Developer Studio Project File - Name="db_dump" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=db_dump - 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_dump.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_dump.mak" CFG="db_dump - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "db_dump - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "db_dump - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "db_dump - 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 Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 release/libdb.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "db_dump - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "db_dump_" +# PROP BASE Intermediate_Dir "db_dump_" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "." /I "../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 debug/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /fixed:no + +!ENDIF + +# Begin Target + +# Name "db_dump - Win32 Release" +# Name "db_dump - Win32 Debug" +# Begin Source File + +SOURCE=.\db.h +# End Source File +# Begin Source File + +SOURCE=..\db_dump\db_dump.c +# End Source File +# Begin Source File + +SOURCE=..\clib\err.c +# End Source File +# Begin Source File + +SOURCE=..\clib\getopt.c +# End Source File +# End Target +# End Project diff --git a/mozilla/db/build.win32/db_int.h b/mozilla/db/build.win32/db_int.h new file mode 100644 index 00000000000..cfff519c520 --- /dev/null +++ b/mozilla/db/build.win32/db_int.h @@ -0,0 +1,401 @@ +/* DO NOT EDIT: automatically built by dist/distrib. */ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)db_int.h.src 10.62 (Sleepycat) 5/23/98 + */ + +#ifndef _DB_INTERNAL_H_ +#define _DB_INTERNAL_H_ + +#include "db.h" /* Standard DB include file. */ +#include "queue.h" + +/******************************************************* + * General purpose constants and macros. + *******************************************************/ +#define UINT16_T_MAX 0xffff /* Maximum 16 bit unsigned. */ +#define UINT32_T_MAX 0xffffffff /* Maximum 32 bit unsigned. */ + +#define DB_MIN_PGSIZE 0x000200 /* Minimum page size. */ +#define DB_MAX_PGSIZE 0x010000 /* Maximum page size. */ + +#define DB_MINCACHE 10 /* Minimum cached pages */ + +#define MEGABYTE 1048576 + +/* + * If we are unable to determine the underlying filesystem block size, use + * 8K on the grounds that most OS's use less than 8K as their VM page size. + */ +#define DB_DEF_IOSIZE (8 * 1024) + +/* + * Aligning items to particular sizes or in pages or memory. ALIGNP is a + * separate macro, as we've had to cast the pointer to different integral + * types on different architectures. + * + * We cast pointers into unsigned longs when manipulating them because C89 + * guarantees that u_long is the largest available integral type and further, + * to never generate overflows. However, neither C89 or C9X requires that + * any integer type be large enough to hold a pointer, although C9X created + * the intptr_t type, which is guaranteed to hold a pointer but may or may + * not exist. At some point in the future, we should test for intptr_t and + * use it where available. + */ +#undef ALIGNTYPE +#define ALIGNTYPE u_long +#undef ALIGNP +#define ALIGNP(value, bound) ALIGN((ALIGNTYPE)value, bound) +#undef ALIGN +#define ALIGN(value, bound) (((value) + (bound) - 1) & ~((bound) - 1)) + +/* + * 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) ((int)&(((name *)0)->field)) + +#undef SSZA +#define SSZA(name, field) ((int)&(((name *)0)->field[0])) + +/* Macros to return per-process address, offsets based on shared regions. */ +#define R_ADDR(base, offset) ((void *)((u_int8_t *)((base)->addr) + offset)) +#define R_OFFSET(base, p) ((u_int8_t *)(p) - (u_int8_t *)(base)->addr) + +/* Free and free-string macros that overwrite memory. */ +#ifdef DIAGNOSTIC +#undef FREE +#define FREE(p, len) { \ + memset(p, 0xff, len); \ + __db_free(p); \ +} +#undef FREES +#define FREES(p) { \ + FREE(p, strlen(p)); \ +} +#else +#undef FREE +#define FREE(p, len) { \ + __db_free(p); \ +} +#undef FREES +#define FREES(p) { \ + __db_free(p); \ +} +#endif + +/* 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 F_SET(p, f) (p)->flags |= (f) +#define F_CLR(p, f) (p)->flags &= ~(f) +#define F_ISSET(p, f) ((p)->flags & (f)) +#define LF_SET(f) (flags |= (f)) +#define LF_CLR(f) (flags &= ~(f)) +#define LF_ISSET(f) (flags & (f)) + +/* Display separator string. */ +#undef DB_LINE +#define DB_LINE "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" + +/* Global variables. */ +typedef struct __db_globals { + int db_mutexlocks; /* DB_MUTEXLOCKS */ + int db_region_anon; /* DB_REGION_ANON, DB_REGION_NAME */ + int db_region_init; /* DB_REGION_INIT */ + int db_tsl_spins; /* DB_TSL_SPINS */ + int db_pageyield; /* DB_PAGEYIELD */ +} DB_GLOBALS; +extern DB_GLOBALS __db_global_values; +#define DB_GLOBAL(v) __db_global_values.v + +/* Unused, or not-used-yet variable. "Shut that bloody compiler up!" */ +#define COMPQUIET(n, v) (n) = (v) + +/* + * Win16 needs specific syntax on callback functions. Nobody else cares. + */ +#ifndef DB_CALLBACK +#define DB_CALLBACK /* Nothing. */ +#endif + +/******************************************************* + * 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 , + * and that file isn't always available. + */ +#undef MAXPATHLEN +#define MAXPATHLEN 1024 + +#define PATH_DOT "." /* Current working directory. */ +#define PATH_SEPARATOR "\\/" /* Path separator character. */ + +/******************************************************* + * Mutex support. + *******************************************************/ +typedef unsigned int tsl_t; + +/* + * !!! + * Various systems require different alignments for mutexes (the worst we've + * seen so far is 16-bytes on some HP architectures). The mutex (tsl_t) must + * be first in the db_mutex_t structure, which must itself be first in the + * region. This ensures the alignment is as returned by mmap(2), which should + * be sufficient. All other mutex users must ensure proper alignment locally. + */ +#define MUTEX_ALIGNMENT sizeof(unsigned int) + +/* + * The offset of a mutex in memory. + * + * !!! + * Not an off_t, so backing file offsets MUST be less than 4Gb. See the + * off field of the db_mutex_t as well. + */ +#define MUTEX_LOCK_OFFSET(a, b) ((u_int32_t)((u_int8_t *)b - (u_int8_t *)a)) + +typedef struct _db_mutex_t { +#ifdef HAVE_SPINLOCKS + tsl_t tsl_resource; /* Resource test and set. */ +#ifdef DIAGNOSTIC + u_int32_t pid; /* Lock holder: 0 or process pid. */ +#endif +#else + u_int32_t off; /* Backing file offset. */ + u_int32_t pid; /* Lock holder: 0 or process pid. */ +#endif + u_int32_t spins; /* Spins before block. */ + u_int32_t mutex_set_wait; /* Granted after wait. */ + u_int32_t mutex_set_nowait; /* Granted without waiting. */ +} db_mutex_t; + +#include "mutex_ext.h" + +/******************************************************* + * Access methods. + *******************************************************/ +/* Lock/unlock a DB thread. */ +#define DB_THREAD_LOCK(dbp) \ + if (F_ISSET(dbp, DB_AM_THREAD)) \ + (void)__db_mutex_lock((db_mutex_t *)(dbp)->mutexp, -1); +#define DB_THREAD_UNLOCK(dbp) \ + if (F_ISSET(dbp, DB_AM_THREAD)) \ + (void)__db_mutex_unlock((db_mutex_t *)(dbp)->mutexp, -1); + +/* Btree/recno local statistics structure. */ +struct __db_bt_lstat; typedef struct __db_bt_lstat DB_BTREE_LSTAT; +struct __db_bt_lstat { + u_int32_t bt_freed; /* Pages freed for reuse. */ + u_int32_t bt_pfxsaved; /* Bytes saved by prefix compression. */ + u_int32_t bt_split; /* Total number of splits. */ + u_int32_t bt_rootsplit; /* Root page splits. */ + u_int32_t bt_fastsplit; /* Fast splits. */ + u_int32_t bt_added; /* Items added. */ + u_int32_t bt_deleted; /* Items deleted. */ + u_int32_t bt_get; /* Items retrieved. */ + u_int32_t bt_cache_hit; /* Hits in fast-insert code. */ + u_int32_t bt_cache_miss; /* Misses in fast-insert code. */ +}; + +/******************************************************* + * 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; + +/******************************************************* + * Shared memory regions. + *******************************************************/ +/* + * The shared memory regions share an initial structure so that the general + * region code can handle races between the region being deleted and other + * processes waiting on the region mutex. + * + * !!! + * Note, the mutex must be the first entry in the region; see comment above. + */ +typedef struct _rlayout { + db_mutex_t lock; /* Region mutex. */ +#define DB_REGIONMAGIC 0x120897 + u_int32_t valid; /* Valid magic number. */ + u_int32_t refcnt; /* Region reference count. */ + size_t size; /* Region length. */ + int majver; /* Major version number. */ + int minver; /* Minor version number. */ + int patch; /* Patch version number. */ +#define INVALID_SEGID -1 + int segid; /* shmget(2) ID, or Win16 segment ID. */ + +#define REGION_ANONYMOUS 0x01 /* Region is/should be in anon mem. */ + u_int32_t flags; +} RLAYOUT; + +/* + * DB creates all regions on 4K boundaries out of sheer paranoia, so that + * we don't make the underlying VM unhappy. + */ +#define DB_VMPAGESIZE (4 * 1024) +#define DB_ROUNDOFF(i) { \ + (i) += DB_VMPAGESIZE - 1; \ + (i) -= (i) % DB_VMPAGESIZE; \ +} + +/* + * The interface to region attach is nasty, there is a lot of complex stuff + * going on, which has to be retained between create/attach and detach. The + * REGINFO structure keeps track of it. + */ +struct __db_reginfo; typedef struct __db_reginfo REGINFO; +struct __db_reginfo { + /* Arguments. */ + DB_ENV *dbenv; /* Region naming info. */ + APPNAME appname; /* Region naming info. */ + char *path; /* Region naming info. */ + const char *file; /* Region naming info. */ + int mode; /* Region mode, if a file. */ + size_t size; /* Region size. */ + u_int32_t dbflags; /* Region file open flags, if a file. */ + + /* Results. */ + char *name; /* Region name. */ + void *addr; /* Region address. */ + int fd; /* Fcntl(2) locking file descriptor. + NB: this is only valid if a regular + file is backing the shared region, + and mmap(2) is being used to map it + into our address space. */ + int segid; /* shmget(2) ID, or Win16 segment ID. */ + + /* Shared flags. */ +/* 0x0001 COMMON MASK with RLAYOUT structure. */ +#define REGION_CANGROW 0x0002 /* Can grow. */ +#define REGION_CREATED 0x0004 /* Created. */ +#define REGION_HOLDINGSYS 0x0008 /* Holding system resources. */ +#define REGION_LASTDETACH 0x0010 /* Delete on last detach. */ +#define REGION_MALLOC 0x0020 /* Created in malloc'd memory. */ +#define REGION_PRIVATE 0x0040 /* Private to thread/process. */ +#define REGION_REMOVED 0x0080 /* Already deleted. */ +#define REGION_SIZEDEF 0x0100 /* Use default region size if exists. */ + u_int32_t flags; +}; + +/******************************************************* + * Mpool. + *******************************************************/ +/* + * File types for DB access methods. Negative numbers are reserved to DB. + */ +#define DB_FTYPE_BTREE -1 /* Btree. */ +#define DB_FTYPE_HASH -2 /* Hash. */ + +/* Structure used as the DB pgin/pgout pgcookie. */ +typedef struct __dbpginfo { + size_t db_pagesize; /* Underlying page size. */ + int needswap; /* If swapping required. */ +} DB_PGINFO; + +/******************************************************* + * Log. + *******************************************************/ +/* Initialize an LSN to 'zero'. */ +#define ZERO_LSN(LSN) { \ + (LSN).file = 0; \ + (LSN).offset = 0; \ +} + +/* Return 1 if LSN is a 'zero' lsn, otherwise return 0. */ +#define IS_ZERO_LSN(LSN) ((LSN).file == 0) + +/* Test if we need to log a change. */ +#define DB_LOGGING(dbp) \ + (F_ISSET(dbp, DB_AM_LOGGING) && !F_ISSET(dbp, DB_AM_RECOVER)) + +#ifdef DIAGNOSTIC +/* + * 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(D, T, O, K, A, F) { \ + DB_LSN _lsn; \ + DBT _op; \ + if (DB_LOGGING((D))) { \ + memset(&_op, 0, sizeof(_op)); \ + _op.data = O; \ + _op.size = strlen(O) + 1; \ + (void)__db_debug_log((D)->dbenv->lg_info, \ + T, &_lsn, 0, &_op, (D)->log_fileid, K, A, F); \ + } \ +} +#ifdef DEBUG_ROP +#define DEBUG_LREAD(D, T, O, K, A, F) LOG_OP(D, T, O, K, A, F) +#else +#define DEBUG_LREAD(D, T, O, K, A, F) +#endif +#ifdef DEBUG_WOP +#define DEBUG_LWRITE(D, T, O, K, A, F) LOG_OP(D, T, O, K, A, F) +#else +#define DEBUG_LWRITE(D, T, O, K, A, F) +#endif +#else +#define DEBUG_LREAD(D, T, O, K, A, F) +#define DEBUG_LWRITE(D, T, O, K, A, F) +#endif /* DIAGNOSTIC */ + +/******************************************************* + * Transactions and recovery. + *******************************************************/ +/* + * Out of band value for a lock. The locks are returned to callers as offsets + * into the lock regions. Since the RLAYOUT structure begins all regions, an + * offset of 0 is guaranteed not to be a valid lock. + */ +#define LOCK_INVALID 0 + +/* The structure allocated for every transaction. */ +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. */ + size_t off; /* Detail structure within region. */ + TAILQ_ENTRY(__db_txn) links; +}; + +#include "os_func.h" +#include "os_ext.h" + +#endif /* !_DB_INTERNAL_H_ */ diff --git a/mozilla/db/build.win32/db_load.dsp b/mozilla/db/build.win32/db_load.dsp new file mode 100644 index 00000000000..95519b84bcc --- /dev/null +++ b/mozilla/db/build.win32/db_load.dsp @@ -0,0 +1,101 @@ +# Microsoft Developer Studio Project File - Name="db_load" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=db_load - 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_load.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_load.mak" CFG="db_load - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "db_load - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "db_load - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "db_load - 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 Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 release/libdb.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "db_load - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "db_load_" +# PROP BASE Intermediate_Dir "db_load_" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "." /I "../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 debug/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /fixed:no + +!ENDIF + +# Begin Target + +# Name "db_load - Win32 Release" +# Name "db_load - Win32 Debug" +# Begin Source File + +SOURCE=..\db_load\db_load.c +# End Source File +# Begin Source File + +SOURCE=..\clib\err.c +# End Source File +# Begin Source File + +SOURCE=..\clib\getlong.c +# End Source File +# Begin Source File + +SOURCE=..\clib\getopt.c +# End Source File +# End Target +# End Project diff --git a/mozilla/db/build.win32/db_printlog.dsp b/mozilla/db/build.win32/db_printlog.dsp new file mode 100644 index 00000000000..56063134ece --- /dev/null +++ b/mozilla/db/build.win32/db_printlog.dsp @@ -0,0 +1,99 @@ +# Microsoft Developer Studio Project File - Name="db_printlog" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=db_printlog - 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_printlog.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_printlog.mak" CFG="db_printlog - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "db_printlog - Win32 Release" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "db_printlog - Win32 Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "db_printlog - 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 Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 release/libdb.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "db_printlog - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "db_printlog_" +# PROP BASE Intermediate_Dir "db_printlog_" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "." /I "../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 debug/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /fixed:no + +!ENDIF + +# Begin Target + +# Name "db_printlog - Win32 Release" +# Name "db_printlog - Win32 Debug" +# Begin Source File + +SOURCE=..\db_printlog\db_printlog.c +# End Source File +# Begin Source File + +SOURCE=..\clib\err.c +# End Source File +# Begin Source File + +SOURCE=..\clib\getopt.c +# End Source File +# End Target +# End Project diff --git a/mozilla/db/build.win32/db_recover.dsp b/mozilla/db/build.win32/db_recover.dsp new file mode 100644 index 00000000000..f8e1d9818e3 --- /dev/null +++ b/mozilla/db/build.win32/db_recover.dsp @@ -0,0 +1,99 @@ +# Microsoft Developer Studio Project File - Name="db_recover" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=db_recover - 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_recover.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_recover.mak" CFG="db_recover - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "db_recover - Win32 Release" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "db_recover - Win32 Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "db_recover - 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 Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 release/libdb.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "db_recover - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "db_recov" +# PROP BASE Intermediate_Dir "db_recov" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "." /I "../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 debug/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /fixed:no + +!ENDIF + +# Begin Target + +# Name "db_recover - Win32 Release" +# Name "db_recover - Win32 Debug" +# Begin Source File + +SOURCE=..\db_recover\db_recover.c +# End Source File +# Begin Source File + +SOURCE=..\clib\err.c +# End Source File +# Begin Source File + +SOURCE=..\clib\getopt.c +# End Source File +# End Target +# End Project diff --git a/mozilla/db/build.win32/db_stat.dsp b/mozilla/db/build.win32/db_stat.dsp new file mode 100644 index 00000000000..1c053e6eb82 --- /dev/null +++ b/mozilla/db/build.win32/db_stat.dsp @@ -0,0 +1,97 @@ +# Microsoft Developer Studio Project File - Name="db_stat" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=db_stat - 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_stat.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_stat.mak" CFG="db_stat - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "db_stat - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "db_stat - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "db_stat - 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 Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 release/libdb.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "db_stat - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "db_stat_" +# PROP BASE Intermediate_Dir "db_stat_" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "." /I "../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 debug/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /fixed:no + +!ENDIF + +# Begin Target + +# Name "db_stat - Win32 Release" +# Name "db_stat - Win32 Debug" +# Begin Source File + +SOURCE=..\db_stat\db_stat.c +# End Source File +# Begin Source File + +SOURCE=..\clib\err.c +# End Source File +# Begin Source File + +SOURCE=..\clib\getopt.c +# End Source File +# End Target +# End Project diff --git a/mozilla/db/build.win32/db_static.dsp b/mozilla/db/build.win32/db_static.dsp new file mode 100644 index 00000000000..99c63deb6a4 --- /dev/null +++ b/mozilla/db/build.win32/db_static.dsp @@ -0,0 +1,466 @@ +# Microsoft Developer Studio Project File - Name="DB_Static" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=DB_Static - 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_Static.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_Static.mak" CFG="DB_Static - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "DB_Static - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "DB_Static - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe + +!IF "$(CFG)" == "DB_Static - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "DB_Stati" +# PROP BASE Intermediate_Dir "DB_Stati" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release_libdbs" +# PROP Intermediate_Dir "Release_libdbs" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX"config.h" /FD /c +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /out:"release\libdbs.lib" + +!ELSEIF "$(CFG)" == "DB_Static - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "DB_Stat0" +# PROP BASE Intermediate_Dir "DB_Stat0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug_libdbs" +# PROP Intermediate_Dir "Debug_libdbs" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "." /I "../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX"config.h" /FD /c +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /out:"debug\libdbs.lib" + +!ENDIF + +# Begin Target + +# Name "DB_Static - Win32 Release" +# Name "DB_Static - Win32 Debug" +# Begin Source File + +SOURCE=..\btree\bt_close.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_compare.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_conv.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_cursor.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_delete.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_open.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_page.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_put.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_rec.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_recno.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_rsearch.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_search.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_split.c +# End Source File +# Begin Source File + +SOURCE=..\btree\bt_stat.c +# End Source File +# Begin Source File + +SOURCE=..\btree\btree_auto.c +# End Source File +# Begin Source File + +SOURCE=..\cxx\cxx_app.cpp +# End Source File +# Begin Source File + +SOURCE=..\cxx\cxx_except.cpp +# End Source File +# Begin Source File + +SOURCE=..\cxx\cxx_lock.cpp +# End Source File +# Begin Source File + +SOURCE=..\cxx\cxx_log.cpp +# End Source File +# Begin Source File + +SOURCE=..\cxx\cxx_mpool.cpp +# End Source File +# Begin Source File + +SOURCE=..\cxx\cxx_table.cpp +# End Source File +# Begin Source File + +SOURCE=..\cxx\cxx_txn.cpp +# End Source File +# Begin Source File + +SOURCE=..\db\db.c +# End Source File +# Begin Source File + +SOURCE=.\db.h +# End Source File +# Begin Source File + +SOURCE=..\common\db_appinit.c +# End Source File +# Begin Source File + +SOURCE=..\common\db_apprec.c +# End Source File +# Begin Source File + +SOURCE=..\db\db_auto.c +# End Source File +# Begin Source File + +SOURCE=..\common\db_byteorder.c +# End Source File +# Begin Source File + +SOURCE=..\db\db_conv.c +# End Source File +# Begin Source File + +SOURCE=..\db\db_dispatch.c +# End Source File +# Begin Source File + +SOURCE=..\db\db_dup.c +# End Source File +# Begin Source File + +SOURCE=..\common\db_err.c +# End Source File +# Begin Source File + +SOURCE=.\db_int.h +# End Source File +# Begin Source File + +SOURCE=..\common\db_log2.c +# End Source File +# Begin Source File + +SOURCE=..\db\db_overflow.c +# End Source File +# Begin Source File + +SOURCE=..\db\db_pr.c +# End Source File +# Begin Source File + +SOURCE=..\db\db_rec.c +# End Source File +# Begin Source File + +SOURCE=..\common\db_region.c +# End Source File +# Begin Source File + +SOURCE=..\db\db_ret.c +# End Source File +# Begin Source File + +SOURCE=..\common\db_salloc.c +# End Source File +# Begin Source File + +SOURCE=..\common\db_shash.c +# End Source File +# Begin Source File + +SOURCE=..\db\db_thread.c +# End Source File +# Begin Source File + +SOURCE=..\dbm\dbm.c +# End Source File +# Begin Source File + +SOURCE=..\hash\hash.c +# End Source File +# Begin Source File + +SOURCE=..\hash\hash_auto.c +# End Source File +# Begin Source File + +SOURCE=..\hash\hash_conv.c +# End Source File +# Begin Source File + +SOURCE=..\hash\hash_debug.c +# End Source File +# Begin Source File + +SOURCE=..\hash\hash_dup.c +# End Source File +# Begin Source File + +SOURCE=..\hash\hash_func.c +# End Source File +# Begin Source File + +SOURCE=..\hash\hash_page.c +# End Source File +# Begin Source File + +SOURCE=..\hash\hash_rec.c +# End Source File +# Begin Source File + +SOURCE=..\hash\hash_stat.c +# End Source File +# Begin Source File + +SOURCE=..\hsearch\hsearch.c +# End Source File +# Begin Source File + +SOURCE=..\lock\lock.c +# End Source File +# Begin Source File + +SOURCE=..\lock\lock_conflict.c +# End Source File +# Begin Source File + +SOURCE=..\lock\lock_deadlock.c +# End Source File +# Begin Source File + +SOURCE=..\lock\lock_region.c +# End Source File +# Begin Source File + +SOURCE=..\lock\lock_util.c +# End Source File +# Begin Source File + +SOURCE=..\log\log.c +# End Source File +# Begin Source File + +SOURCE=..\log\log_archive.c +# End Source File +# Begin Source File + +SOURCE=..\log\log_auto.c +# End Source File +# Begin Source File + +SOURCE=..\log\log_compare.c +# End Source File +# Begin Source File + +SOURCE=..\log\log_findckp.c +# End Source File +# Begin Source File + +SOURCE=..\log\log_get.c +# End Source File +# Begin Source File + +SOURCE=..\log\log_put.c +# End Source File +# Begin Source File + +SOURCE=..\log\log_rec.c +# End Source File +# Begin Source File + +SOURCE=..\log\log_register.c +# End Source File +# Begin Source File + +SOURCE=..\mp\mp_bh.c +# End Source File +# Begin Source File + +SOURCE=..\mp\mp_fget.c +# End Source File +# Begin Source File + +SOURCE=..\mp\mp_fopen.c +# End Source File +# Begin Source File + +SOURCE=..\mp\mp_fput.c +# End Source File +# Begin Source File + +SOURCE=..\mp\mp_fset.c +# End Source File +# Begin Source File + +SOURCE=..\mp\mp_open.c +# End Source File +# Begin Source File + +SOURCE=..\mp\mp_pr.c +# End Source File +# Begin Source File + +SOURCE=..\mp\mp_region.c +# End Source File +# Begin Source File + +SOURCE=..\mp\mp_sync.c +# End Source File +# Begin Source File + +SOURCE=..\mutex\mutex.c +# End Source File +# Begin Source File + +SOURCE=..\os.win32\os_abs.c +# End Source File +# Begin Source File + +SOURCE=..\os\os_alloc.c +# End Source File +# Begin Source File + +SOURCE=..\os\os_config.c +# End Source File +# Begin Source File + +SOURCE=..\os.win32\os_dir.c +# End Source File +# Begin Source File + +SOURCE=..\os.win32\os_fid.c +# End Source File +# Begin Source File + +SOURCE=..\os\os_fsync.c +# End Source File +# Begin Source File + +SOURCE=..\os.win32\os_map.c +# End Source File +# Begin Source File + +SOURCE=..\os\os_oflags.c +# End Source File +# Begin Source File + +SOURCE=..\os\os_open.c +# End Source File +# Begin Source File + +SOURCE=..\os\os_rpath.c +# End Source File +# Begin Source File + +SOURCE=..\os\os_rw.c +# End Source File +# Begin Source File + +SOURCE=..\os.win32\os_seek.c +# End Source File +# Begin Source File + +SOURCE=..\os.win32\os_sleep.c +# End Source File +# Begin Source File + +SOURCE=..\os.win32\os_spin.c +# End Source File +# Begin Source File + +SOURCE=..\os\os_stat.c +# End Source File +# Begin Source File + +SOURCE=..\os\os_unlink.c +# End Source File +# Begin Source File + +SOURCE=..\clib\strsep.c +# End Source File +# Begin Source File + +SOURCE=..\txn\txn.c +# End Source File +# Begin Source File + +SOURCE=..\txn\txn_auto.c +# End Source File +# Begin Source File + +SOURCE=..\txn\txn_rec.c +# End Source File +# End Target +# End Project diff --git a/mozilla/db/build.win32/dbtest.dsp b/mozilla/db/build.win32/dbtest.dsp new file mode 100644 index 00000000000..69756aac32f --- /dev/null +++ b/mozilla/db/build.win32/dbtest.dsp @@ -0,0 +1,129 @@ +# Microsoft Developer Studio Project File - Name="dbtest" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=dbtest - 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 "dbtest.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 "dbtest.mak" CFG="dbtest - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "dbtest - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "dbtest - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "dbtest - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "dbtest__" +# PROP BASE Intermediate_Dir "dbtest__" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 release/libdbs.lib tcl80vc.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "dbtest - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "dbtest_0" +# PROP BASE Intermediate_Dir "dbtest_0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "." /I "../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 debug/libdbs.lib tcl80.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /fixed:no + +!ENDIF + +# Begin Target + +# Name "dbtest - Win32 Release" +# Name "dbtest - Win32 Debug" +# Begin Source File + +SOURCE=..\test\tcl_dbm.c +# End Source File +# Begin Source File + +SOURCE=..\test\tcl_hsearch.c +# End Source File +# Begin Source File + +SOURCE=..\test\tcl_lock.c +# End Source File +# Begin Source File + +SOURCE=..\test\tcl_log.c +# End Source File +# Begin Source File + +SOURCE=..\test\tcl_mpool.c +# End Source File +# Begin Source File + +SOURCE=..\test\tcl_mutex.c +# End Source File +# Begin Source File + +SOURCE=..\test\tcl_ndbm.c +# End Source File +# Begin Source File + +SOURCE=..\test\tcl_txn.c +# End Source File +# Begin Source File + +SOURCE=..\test\tclAppInit.c +# End Source File +# Begin Source File + +SOURCE=..\test\tclWin32Init.cpp +# End Source File +# Begin Source File + +SOURCE=..\test\utils.c +# End Source File +# End Target +# End Project diff --git a/mozilla/db/build.win32/dllmain.c b/mozilla/db/build.win32/dllmain.c new file mode 100644 index 00000000000..1bb162c9309 --- /dev/null +++ b/mozilla/db/build.win32/dllmain.c @@ -0,0 +1,94 @@ +//--------------------------------------------------------------------------// +// Copyright (C) 1997 Netscape Communications Corporation // +//--------------------------------------------------------------------------// +/* + * @(#)dllmain.c 8.1 (Sleepycat) 3/5/97 + */ + +#define WIN32_LEAN_AND_MEAN +#include + +static int ProcessesAttached = 0; +static HINSTANCE Instance; /* Global library instance handle. */ + +/* + * The following declaration is for the VC++ DLL entry point. + */ + +BOOL APIENTRY DllMain (HINSTANCE hInst, + DWORD reason, LPVOID reserved); + +/* + *---------------------------------------------------------------------- + * + * DllEntryPoint -- + * + * This wrapper function is used by Borland to invoke the + * initialization code for Tcl. It simply calls the DllMain + * routine. + * + * Results: + * See DllMain. + * + * Side effects: + * See DllMain. + * + *---------------------------------------------------------------------- + */ + +BOOL APIENTRY +DllEntryPoint(hInst, reason, reserved) + HINSTANCE hInst; /* Library instance handle. */ + DWORD reason; /* Reason this function is being called. */ + LPVOID reserved; /* Not used. */ +{ + return DllMain(hInst, reason, reserved); +} + +/* + *---------------------------------------------------------------------- + * + * DllMain -- + * + * This routine is called by the VC++ C run time library init + * code, or the DllEntryPoint routine. It is responsible for + * initializing various dynamically loaded libraries. + * + * Results: + * TRUE on sucess, FALSE on failure. + * + * Side effects: + * Establishes 32-to-16 bit thunk and initializes sockets library. + * + *---------------------------------------------------------------------- + */ +BOOL APIENTRY +DllMain(hInst, reason, reserved) + HINSTANCE hInst; /* Library instance handle. */ + DWORD reason; /* Reason this function is being called. */ + LPVOID reserved; /* Not used. */ +{ + switch (reason) { + case DLL_PROCESS_ATTACH: + + /* + * Registration of UT need to be done only once for first + * attaching process. At that time set the tclWin32s flag + * to indicate if the DLL is executing under Win32s or not. + */ + + if (ProcessesAttached++) { + return FALSE; /* Not the first initialization. */ + } + + Instance = hInst; + return TRUE; + + case DLL_PROCESS_DETACH: + + ProcessesAttached--; + break; + } + + return TRUE; +} diff --git a/mozilla/db/build.win32/ex_access.dsp b/mozilla/db/build.win32/ex_access.dsp new file mode 100644 index 00000000000..3295822362d --- /dev/null +++ b/mozilla/db/build.win32/ex_access.dsp @@ -0,0 +1,98 @@ +# Microsoft Developer Studio Project File - Name="ex_access" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=ex_access - 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 "ex_access.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 "ex_access.mak" CFG="ex_access - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "ex_access - Win32 Release" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "ex_access - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "ex_access - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ex_acces" +# PROP BASE Intermediate_Dir "ex_acces" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 Release/libdb.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "ex_access - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ex_acce0" +# PROP BASE Intermediate_Dir "ex_acce0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "." /I "../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 debug/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /fixed:no + +!ENDIF + +# Begin Target + +# Name "ex_access - Win32 Release" +# Name "ex_access - Win32 Debug" +# Begin Source File + +SOURCE=..\clib\err.c +# End Source File +# Begin Source File + +SOURCE=..\examples\ex_access.c +# End Source File +# Begin Source File + +SOURCE=..\clib\getopt.c +# End Source File +# End Target +# End Project diff --git a/mozilla/db/build.win32/ex_appinit.dsp b/mozilla/db/build.win32/ex_appinit.dsp new file mode 100644 index 00000000000..769b274714d --- /dev/null +++ b/mozilla/db/build.win32/ex_appinit.dsp @@ -0,0 +1,99 @@ +# Microsoft Developer Studio Project File - Name="ex_appinit" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=ex_appinit - 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 "ex_appinit.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 "ex_appinit.mak" CFG="ex_appinit - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "ex_appinit - Win32 Release" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "ex_appinit - Win32 Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "ex_appinit - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ex_appin" +# PROP BASE Intermediate_Dir "ex_appin" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 Release/libdb.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "ex_appinit - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ex_appi0" +# PROP BASE Intermediate_Dir "ex_appi0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "." /I "../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 debug/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /fixed:no + +!ENDIF + +# Begin Target + +# Name "ex_appinit - Win32 Release" +# Name "ex_appinit - Win32 Debug" +# Begin Source File + +SOURCE=..\clib\err.c +# End Source File +# Begin Source File + +SOURCE=..\examples\ex_appinit.c +# End Source File +# Begin Source File + +SOURCE=..\clib\getopt.c +# End Source File +# End Target +# End Project diff --git a/mozilla/db/build.win32/ex_lock.dsp b/mozilla/db/build.win32/ex_lock.dsp new file mode 100644 index 00000000000..58c1a8121e4 --- /dev/null +++ b/mozilla/db/build.win32/ex_lock.dsp @@ -0,0 +1,97 @@ +# Microsoft Developer Studio Project File - Name="ex_lock" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=ex_lock - 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 "ex_lock.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 "ex_lock.mak" CFG="ex_lock - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "ex_lock - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "ex_lock - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "ex_lock - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ex_lock_" +# PROP BASE Intermediate_Dir "ex_lock_" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 release/libdb.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "ex_lock - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ex_lock0" +# PROP BASE Intermediate_Dir "ex_lock0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 debug/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /fixed:no + +!ENDIF + +# Begin Target + +# Name "ex_lock - Win32 Release" +# Name "ex_lock - Win32 Debug" +# Begin Source File + +SOURCE=..\clib\err.c +# End Source File +# Begin Source File + +SOURCE=..\examples\ex_lock.c +# End Source File +# Begin Source File + +SOURCE=..\clib\getopt.c +# End Source File +# End Target +# End Project diff --git a/mozilla/db/build.win32/ex_mpool.dsp b/mozilla/db/build.win32/ex_mpool.dsp new file mode 100644 index 00000000000..57095c4d8c7 --- /dev/null +++ b/mozilla/db/build.win32/ex_mpool.dsp @@ -0,0 +1,98 @@ +# Microsoft Developer Studio Project File - Name="ex_mpool" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=ex_mpool - 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 "ex_mpool.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 "ex_mpool.mak" CFG="ex_mpool - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "ex_mpool - Win32 Release" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "ex_mpool - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "ex_mpool - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ex_mpool" +# PROP BASE Intermediate_Dir "ex_mpool" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 release\libdb.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "ex_mpool - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ex_mpoo0" +# PROP BASE Intermediate_Dir "ex_mpoo0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "." /I "../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 debug/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /fixed:no + +!ENDIF + +# Begin Target + +# Name "ex_mpool - Win32 Release" +# Name "ex_mpool - Win32 Debug" +# Begin Source File + +SOURCE=..\clib\err.c +# End Source File +# Begin Source File + +SOURCE=..\examples\ex_mpool.c +# End Source File +# Begin Source File + +SOURCE=..\clib\getopt.c +# End Source File +# End Target +# End Project diff --git a/mozilla/db/build.win32/ex_tpcb.dsp b/mozilla/db/build.win32/ex_tpcb.dsp new file mode 100644 index 00000000000..25e51baa72e --- /dev/null +++ b/mozilla/db/build.win32/ex_tpcb.dsp @@ -0,0 +1,99 @@ +# Microsoft Developer Studio Project File - Name="ex_tpcb" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=ex_tpcb - 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 "ex_tpcb.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 "ex_tpcb.mak" CFG="ex_tpcb - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "ex_tpcb - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "ex_tpcb - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "ex_tpcb - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ex_tpcb_" +# PROP BASE Intermediate_Dir "ex_tpcb_" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 release\libdb.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "ex_tpcb - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ex_tpcb0" +# PROP BASE Intermediate_Dir "ex_tpcb0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "." /I "../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# SUBTRACT CPP /Fr +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 debug/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /pdb:none /debug /debugtype:both /machine:I386 /fixed:no +# SUBTRACT LINK32 /profile + +!ENDIF + +# Begin Target + +# Name "ex_tpcb - Win32 Release" +# Name "ex_tpcb - Win32 Debug" +# Begin Source File + +SOURCE=..\clib\err.c +# End Source File +# Begin Source File + +SOURCE=..\examples\ex_tpcb.c +# End Source File +# Begin Source File + +SOURCE=..\clib\getopt.c +# End Source File +# End Target +# End Project diff --git a/mozilla/db/build.win32/excxx_access.dsp b/mozilla/db/build.win32/excxx_access.dsp new file mode 100644 index 00000000000..8752567177d --- /dev/null +++ b/mozilla/db/build.win32/excxx_access.dsp @@ -0,0 +1,91 @@ +# Microsoft Developer Studio Project File - Name="excxx_access" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=excxx_access - 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 "excxx_access.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 "excxx_access.mak" CFG="excxx_access - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "excxx_access - Win32 Release" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "excxx_access - Win32 Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "excxx_access - 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 Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "DB_USE_DLL" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 release/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "excxx_access - 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 Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "DB_USE_DLL" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 debug/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "excxx_access - Win32 Release" +# Name "excxx_access - Win32 Debug" +# Begin Source File + +SOURCE=..\examples_cxx\AccessExample.cpp +# End Source File +# End Target +# End Project diff --git a/mozilla/db/build.win32/excxx_appinit.dsp b/mozilla/db/build.win32/excxx_appinit.dsp new file mode 100644 index 00000000000..813e78de0f0 --- /dev/null +++ b/mozilla/db/build.win32/excxx_appinit.dsp @@ -0,0 +1,91 @@ +# Microsoft Developer Studio Project File - Name="excxx_appinit" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=excxx_appinit - 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 "excxx_appinit.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 "excxx_appinit.mak" CFG="excxx_appinit - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "excxx_appinit - Win32 Release" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "excxx_appinit - Win32 Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "excxx_appinit - 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 Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "DB_USE_DLL" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 release/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "excxx_appinit - 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 Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "DB_USE_DLL" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 debug/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "excxx_appinit - Win32 Release" +# Name "excxx_appinit - Win32 Debug" +# Begin Source File + +SOURCE=..\examples_cxx\AppinitExample.cpp +# End Source File +# End Target +# End Project diff --git a/mozilla/db/build.win32/excxx_lock.dsp b/mozilla/db/build.win32/excxx_lock.dsp new file mode 100644 index 00000000000..28935a7088b --- /dev/null +++ b/mozilla/db/build.win32/excxx_lock.dsp @@ -0,0 +1,91 @@ +# Microsoft Developer Studio Project File - Name="excxx_lock" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=excxx_lock - 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 "excxx_lock.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 "excxx_lock.mak" CFG="excxx_lock - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "excxx_lock - Win32 Release" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "excxx_lock - Win32 Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "excxx_lock - 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 Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "DB_USE_DLL" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 release/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "excxx_lock - 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 Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "DB_USE_DLL" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 debug/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "excxx_lock - Win32 Release" +# Name "excxx_lock - Win32 Debug" +# Begin Source File + +SOURCE=..\examples_cxx\LockExample.cpp +# End Source File +# End Target +# End Project diff --git a/mozilla/db/build.win32/excxx_mpool.dsp b/mozilla/db/build.win32/excxx_mpool.dsp new file mode 100644 index 00000000000..0b6b174ed40 --- /dev/null +++ b/mozilla/db/build.win32/excxx_mpool.dsp @@ -0,0 +1,91 @@ +# Microsoft Developer Studio Project File - Name="excxx_mpool" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=excxx_mpool - 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 "excxx_mpool.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 "excxx_mpool.mak" CFG="excxx_mpool - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "excxx_mpool - Win32 Release" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "excxx_mpool - Win32 Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "excxx_mpool - 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 Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "DB_USE_DLL" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 release/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "excxx_mpool - 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 Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "DB_USE_DLL" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 debug/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "excxx_mpool - Win32 Release" +# Name "excxx_mpool - Win32 Debug" +# Begin Source File + +SOURCE=..\examples_cxx\MpoolExample.cpp +# End Source File +# End Target +# End Project diff --git a/mozilla/db/build.win32/excxx_tpcb.dsp b/mozilla/db/build.win32/excxx_tpcb.dsp new file mode 100644 index 00000000000..d9c06cdda34 --- /dev/null +++ b/mozilla/db/build.win32/excxx_tpcb.dsp @@ -0,0 +1,91 @@ +# Microsoft Developer Studio Project File - Name="excxx_tpcb" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=excxx_tpcb - 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 "excxx_tpcb.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 "excxx_tpcb.mak" CFG="excxx_tpcb - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "excxx_tpcb - Win32 Release" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "excxx_tpcb - Win32 Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "excxx_tpcb - 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 Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "DB_USE_DLL" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 release/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "excxx_tpcb - 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 Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "DB_USE_DLL" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 debug/libdb.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "excxx_tpcb - Win32 Release" +# Name "excxx_tpcb - Win32 Debug" +# Begin Source File + +SOURCE=..\examples_cxx\TpcbExample.cpp +# End Source File +# End Target +# End Project diff --git a/mozilla/db/build.win32/include.tcl b/mozilla/db/build.win32/include.tcl new file mode 100644 index 00000000000..313b8ffc846 --- /dev/null +++ b/mozilla/db/build.win32/include.tcl @@ -0,0 +1,184 @@ +# DO NOT EDIT: automatically built by dist/distrib. +global dict +global testdir + +set CP c:/tools/cp.exe +set DIFF c:/tools/diff.exe +set KILL c:/tools/kill.exe +set LS c:/tools/ls.exe +set MKDIR c:/tools/mkdir.exe +set MV c:/tools/mv.exe +set RM c:/tools/rm.exe +set SED c:/tools/sed.exe +set SLEEP c:/tools/sleep.exe +set SORT c:/tools/sort.exe +set TR c:/tools/tr.exe + +set DB_LOCK_GET 0 +set DB_LOCK_PUT 1 +set DB_LOCK_PUT_ALL 2 +set DB_LOCK_PUT_OBJ 3 +set DB_LOCK_NG 0 +set DB_LOCK_READ 1 +set DB_LOCK_WRITE 2 +set DB_LOCK_IREAD 3 +set DB_LOCK_IWRITE 4 +set DB_LOCK_IWR 5 +set DB_VERSION_MAJOR 2 +set DB_VERSION_MINOR 4 +set DB_VERSION_PATCH 14 +set DB_MAX_PAGES 0xffffffff +set DB_MAX_RECORDS 0xffffffff +set DB_FILE_ID_LEN 20 +set DB_DBT_INTERNAL 0x01 +set DB_DBT_MALLOC 0x02 +set DB_DBT_PARTIAL 0x04 +set DB_DBT_USERMEM 0x08 +set DB_FUNC_CALLOC 1 +set DB_FUNC_CLOSE 2 +set DB_FUNC_DIRFREE 3 +set DB_FUNC_DIRLIST 4 +set DB_FUNC_EXISTS 5 +set DB_FUNC_FREE 6 +set DB_FUNC_FSYNC 7 +set DB_FUNC_IOINFO 8 +set DB_FUNC_MALLOC 9 +set DB_FUNC_MAP 10 +set DB_FUNC_OPEN 11 +set DB_FUNC_READ 12 +set DB_FUNC_REALLOC 13 +set DB_FUNC_SEEK 14 +set DB_FUNC_SLEEP 15 +set DB_FUNC_STRDUP 16 +set DB_FUNC_UNLINK 17 +set DB_FUNC_UNMAP 18 +set DB_FUNC_WRITE 19 +set DB_FUNC_YIELD 20 +set DB_TSL_SPINS 21 +set DB_FUNC_RUNLINK 22 +set DB_REGION_ANON 23 +set DB_REGION_INIT 24 +set DB_REGION_NAME 25 +set DB_MUTEXLOCKS 26 +set DB_PAGEYIELD 27 +set DB_CREATE 0x000001 +set DB_NOMMAP 0x000002 +set DB_THREAD 0x000004 +set DB_INIT_LOCK 0x000008 +set DB_INIT_LOG 0x000010 +set DB_INIT_MPOOL 0x000020 +set DB_INIT_TXN 0x000040 +set DB_MPOOL_PRIVATE 0x000080 +set DB_RECOVER 0x000200 +set DB_RECOVER_FATAL 0x000400 +set DB_TXN_NOSYNC 0x000800 +set DB_USE_ENVIRON 0x001000 +set DB_USE_ENVIRON_ROOT 0x002000 +set DB_TXN_LOCK_2PL 0x000000 +set DB_TXN_LOCK_OPTIMIST 0x000000 +set DB_TXN_LOCK_MASK 0x000000 +set DB_TXN_LOG_REDO 0x000000 +set DB_TXN_LOG_UNDO 0x000000 +set DB_TXN_LOG_UNDOREDO 0x000000 +set DB_TXN_LOG_MASK 0x000000 +set DB_EXCL 0x008000 +set DB_RDONLY 0x010000 +set DB_SEQUENTIAL 0x020000 +set DB_TEMPORARY 0x040000 +set DB_TRUNCATE 0x080000 +set DB_LOCK_NORUN 0x0 +set DB_LOCK_DEFAULT 0x1 +set DB_LOCK_OLDEST 0x2 +set DB_LOCK_RANDOM 0x3 +set DB_LOCK_YOUNGEST 0x4 +set DB_ENV_APPINIT 0x01 +set DB_ENV_STANDALONE 0x02 +set DB_ENV_THREAD 0x04 +set DB_BTREEVERSION 6 +set DB_BTREEOLDVER 6 +set DB_BTREEMAGIC 0x053162 +set DB_HASHVERSION 5 +set DB_HASHOLDVER 4 +set DB_HASHMAGIC 0x061561 +set DB_LOGVERSION 2 +set DB_LOGOLDVER 2 +set DB_LOGMAGIC 0x040988 +set DB_DELIMITER 0x0001 +set DB_DUP 0x0002 +set DB_FIXEDLEN 0x0004 +set DB_PAD 0x0008 +set DB_RECNUM 0x0010 +set DB_RENUMBER 0x0020 +set DB_SNAPSHOT 0x0040 +set DB_AFTER 0x000001 +set DB_APPEND 0x000002 +set DB_BEFORE 0x000004 +set DB_CHECKPOINT 0x000008 +set DB_CURRENT 0x000010 +set DB_FIRST 0x000020 +set DB_FLUSH 0x000040 +set DB_GET_RECNO 0x000080 +set DB_KEYFIRST 0x000100 +set DB_KEYLAST 0x000200 +set DB_LAST 0x000400 +set DB_NEXT 0x000800 +set DB_NOOVERWRITE 0x001000 +set DB_NOSYNC 0x002000 +set DB_PREV 0x004000 +set DB_RECORDCOUNT 0x008000 +set DB_SET 0x010000 +set DB_SET_RANGE 0x020000 +set DB_SET_RECNO 0x040000 +set DB_CURLSN 0x080000 +set DB_INCOMPLETE -1 +set DB_KEYEMPTY -2 +set DB_KEYEXIST -3 +set DB_LOCK_DEADLOCK -4 +set DB_LOCK_NOTGRANTED -5 +set DB_LOCK_NOTHELD -6 +set DB_NOTFOUND -7 +set DB_DELETED -8 +set DB_NEEDSPLIT -9 +set DB_REGISTERED -10 +set DB_SWAPBYTES -11 +set DB_TXN_CKP -12 +set DB_AM_DUP 0x000001 +set DB_AM_INMEM 0x000002 +set DB_AM_LOCKING 0x000004 +set DB_AM_LOGGING 0x000008 +set DB_AM_MLOCAL 0x000010 +set DB_AM_PGDEF 0x000020 +set DB_AM_RDONLY 0x000040 +set DB_AM_RECOVER 0x000080 +set DB_AM_SWAP 0x000100 +set DB_AM_THREAD 0x000200 +set DB_BT_RECNUM 0x000400 +set DB_HS_DIRTYMETA 0x000800 +set DB_RE_DELIMITER 0x001000 +set DB_RE_FIXEDLEN 0x002000 +set DB_RE_PAD 0x004000 +set DB_RE_RENUMBER 0x008000 +set DB_RE_SNAPSHOT 0x010000 +set DB_LOCKVERSION 1 +set DB_LOCKMAGIC 0x090193 +set DB_LOCK_NOWAIT 0x01 +set DB_LOCK_CONFLICT 0x01 +set DB_LOCK_RW_N 3 +set DB_LOCK_RIW_N 6 +set DB_ARCH_ABS 0x001 +set DB_ARCH_DATA 0x002 +set DB_ARCH_LOG 0x004 +set DB_MPOOL_CREATE 0x001 +set DB_MPOOL_LAST 0x002 +set DB_MPOOL_NEW 0x004 +set DB_MPOOL_CLEAN 0x001 +set DB_MPOOL_DIRTY 0x002 +set DB_MPOOL_DISCARD 0x004 +set DB_TXNVERSION 1 +set DB_TXNMAGIC 0x041593 +set DB_TXN_BACKWARD_ROLL 1 +set DB_TXN_FORWARD_ROLL 2 +set DB_TXN_OPENFILES 3 +set DB_TXN_REDO 4 +set DB_TXN_UNDO 5 +set DB_DBM_HSEARCH 0 diff --git a/mozilla/db/build.win32/libdb.def b/mozilla/db/build.win32/libdb.def new file mode 100644 index 00000000000..3d1e3c0ae15 --- /dev/null +++ b/mozilla/db/build.win32/libdb.def @@ -0,0 +1,112 @@ +; @(#)libdb.def 8.16 (Sleepycat) 5/23/98 + +DESCRIPTION 'Berkeley DB 2.0 Library' +CODE SHARED READ EXECUTE +DATA SHARED READ WRITE +EXPORTS + db_open @2 + lock_close @3 + lock_get @4 + lock_id @5 + lock_open @6 + lock_put @7 + lock_unlink @8 + lock_vec @9 + log_close @10 + log_compare @11 + log_file @12 + log_flush @13 + log_get @14 + log_open @15 + log_put @16 + log_register @17 + log_unlink @19 + log_unregister @20 + memp_close @21 + memp_fclose @22 + memp_fget @23 + memp_fopen @24 + memp_fput @25 + memp_fset @26 + memp_fsync @27 + memp_open @28 + memp_register @29 + memp_sync @30 + memp_unlink @31 + txn_abort @32 + txn_begin @33 + txn_checkpoint @34 + txn_commit @35 + txn_close @36 + txn_open @37 + txn_prepare @38 + txn_unlink @39 + db_appexit @48 + db_version @49 + db_appinit @50 + memp_stat @51 + log_archive @52 + lock_detect @53 + txn_id @54 + txn_stat @55 + memp_trickle @56 + db_jump_set @57 + db_value_set @58 + log_stat @59 + lock_stat @60 +; these are only for testing + __db_loadme @201 + __db_mutex_unlock @207 + __db_mutex_init @208 + __db_runlink @210 + __db_mutex_lock @211 + __ham_func2 @214 + __ham_func3 @215 + __ham_func4 @216 + __ham_func5 @217 + __db_hcreate @218 + __db_hsearch @219 + __db_hdestroy @220 + __db_dbm_init @221 + __db_dbm_delete @222 + __db_dbm_fetch @223 + __db_dbm_store @224 + __db_dbm_firstkey @225 + __db_dbm_nextkey @226 + __db_rdetach @227 + __db_rattach @228 + __db_ndbm_open @229 + __db_ndbm_store @230 + __db_ndbm_rdonly @231 + __db_ndbm_pagfno @232 + __db_ndbm_nextkey @233 + __db_ndbm_firstkey @234 + __db_ndbm_fetch @235 + __db_ndbm_error @236 + __db_ndbm_dirfno @237 + __db_ndbm_delete @238 + __db_ndbm_close @239 + __db_ndbm_clearerr @240 + __db_close @241 + __db_read @242 + __db_open @243 + __db_write @244 + __lock_dump_region @245 + __memp_dump_region @246 +; these are needed for linking tools + __db_dump @401 + __db_rpath @402 + __db_dispatch @403 + __db_err @404 + __db_init_print @405 + __txn_init_print @406 + __log_init_print @407 + __ham_init_print @408 + __bam_init_print @409 + __db_jump @410 + __ham_pgin @411 + __ham_pgout @412 + __bam_pgin @413 + __bam_pgout @414 + __db_omode @415 + __db_prdbt @416 diff --git a/mozilla/db/build.win32/libdb.rc b/mozilla/db/build.win32/libdb.rc new file mode 100644 index 00000000000..0e16648c3cb --- /dev/null +++ b/mozilla/db/build.win32/libdb.rc @@ -0,0 +1,33 @@ +1 VERSIONINFO + FILEVERSION 2,0,4,14 + PRODUCTVERSION 2,0,4,14 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L + +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Sleepycat Software\0" + VALUE "FileDescription", "Berkeley DB 2.0 DLL\0" + VALUE "FileVersion", "2.4.14\0" + VALUE "InternalName", "libdb.dll\0" + VALUE "LegalCopyright", "Copyright © Sleepycat Software Inc. 1997, 1998\0" + VALUE "OriginalFilename", "libdb.dll\0" + VALUE "ProductName", "Sleepycat Software libdb\0" + VALUE "ProductVersion", "2.4.14\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/mozilla/db/build.win32/libdb.rc.src b/mozilla/db/build.win32/libdb.rc.src new file mode 100644 index 00000000000..13d7b6a3426 --- /dev/null +++ b/mozilla/db/build.win32/libdb.rc.src @@ -0,0 +1,33 @@ +1 VERSIONINFO + FILEVERSION %MAJOR%,0,%MINOR%,%PATCH% + PRODUCTVERSION %MAJOR%,0,%MINOR%,%PATCH% + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L + +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Sleepycat Software\0" + VALUE "FileDescription", "Berkeley DB 2.0 DLL\0" + VALUE "FileVersion", "%MAJOR%.%MINOR%.%PATCH%\0" + VALUE "InternalName", "libdb.dll\0" + VALUE "LegalCopyright", "Copyright © Sleepycat Software Inc. 1997, 1998\0" + VALUE "OriginalFilename", "libdb.dll\0" + VALUE "ProductName", "Sleepycat Software libdb\0" + VALUE "ProductVersion", "%MAJOR%.%MINOR%.%PATCH%\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/mozilla/db/clib/err.c b/mozilla/db/clib/err.c new file mode 100644 index 00000000000..3ecf6c47f06 --- /dev/null +++ b/mozilla/db/clib/err.c @@ -0,0 +1,168 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)err.c 10.4 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#include +#include +#include + +#ifdef __STDC__ +#include +#else +#include +#endif +#endif + +#include "db.h" +#include "clib_ext.h" + +extern char *progname; + +/* + * err, warn -- + * Error routines. + * + * PUBLIC: #ifdef __STDC__ + * PUBLIC: void err __P((int eval, const char *, ...)); + * PUBLIC: #else + * PUBLIC: void err(); + * PUBLIC: #endif + */ +void +#ifdef __STDC__ +err(int eval, const char *fmt, ...) +#else +err(eval, fmt, va_alist) + int eval; + const char *fmt; + va_dcl +#endif +{ + va_list ap; + int sverrno; + +#ifdef __STDC__ + va_start(ap, fmt); +#else + va_start(ap); +#endif + + sverrno = errno; + (void)fprintf(stderr, "%s: ", progname); + if (fmt != NULL) { + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, ": "); + } + (void)fprintf(stderr, "%s\n", strerror(sverrno)); + + exit(eval); +} + +/* + * PUBLIC: #ifdef __STDC__ + * PUBLIC: void errx __P((int eval, const char *, ...)); + * PUBLIC: #else + * PUBLIC: void errx(); + * PUBLIC: #endif + */ +void +#ifdef __STDC__ +errx(int eval, const char *fmt, ...) +#else +errx(eval, fmt, va_alist) + int eval; + const char *fmt; + va_dcl +#endif +{ + va_list ap; +#ifdef __STDC__ + va_start(ap, fmt); +#else + va_start(ap); +#endif + + (void)fprintf(stderr, "%s: ", progname); + if (fmt != NULL) + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, "\n"); + + exit(eval); +} + +/* + * PUBLIC: #ifdef __STDC__ + * PUBLIC: void warn __P((const char *, ...)); + * PUBLIC: #else + * PUBLIC: void warn(); + * PUBLIC: #endif + */ +void +#ifdef __STDC__ +warn(const char *fmt, ...) +#else +warn(fmt, va_alist) + const char *fmt; + va_dcl +#endif +{ + va_list ap; + int sverrno; + +#ifdef __STDC__ + va_start(ap, fmt); +#else + va_start(ap); +#endif + sverrno = errno; + + (void)fprintf(stderr, "%s: ", progname); + if (fmt != NULL) { + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, ": "); + } + (void)fprintf(stderr, "%s\n", strerror(sverrno)); + va_end(ap); +} + +/* + * PUBLIC: #ifdef __STDC__ + * PUBLIC: void warnx __P((const char *, ...)); + * PUBLIC: #else + * PUBLIC: void warnx(); + * PUBLIC: #endif + */ +void +#ifdef __STDC__ +warnx(const char *fmt, ...) +#else +warnx(fmt, va_alist) + const char *fmt; + va_dcl +#endif +{ + va_list ap; + +#ifdef __STDC__ + va_start(ap, fmt); +#else + va_start(ap); +#endif + + (void)fprintf(stderr, "%s: ", progname); + if (fmt != NULL) + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, "\n"); + va_end(ap); +} diff --git a/mozilla/db/clib/getcwd.c b/mozilla/db/clib/getcwd.c new file mode 100644 index 00000000000..a923aca622e --- /dev/null +++ b/mozilla/db/clib/getcwd.c @@ -0,0 +1,274 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1989, 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. 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)getcwd.c 10.7 (Sleepycat) 4/18/98"; +#endif /* not lint */ + +#include +#include + +#if HAVE_DIRENT_H +# include +# define NAMLEN(dirent) strlen((dirent)->d_name) +#else +# define dirent direct +# define NAMLEN(dirent) (dirent)->d_namlen +# if HAVE_SYS_NDIR_H +# include +# endif +# if HAVE_SYS_DIR_H +# include +# endif +# if HAVE_NDIR_H +# include +# endif +#endif + +#include +#include +#include +#include +#include + +#include "db_int.h" + +#define ISDOT(dp) \ + (dp->d_name[0] == '.' && (dp->d_name[1] == '\0' || \ + (dp->d_name[1] == '.' && dp->d_name[2] == '\0'))) + +#ifndef dirfd +#define dirfd(dirp) ((dirp)->dd_fd) +#endif + +/* + * getcwd -- + * Get the current working directory. + * + * PUBLIC: #ifndef HAVE_GETCWD + * PUBLIC: char *getcwd __P((char *, size_t)); + * PUBLIC: #endif + */ +char * +getcwd(pt, size) + char *pt; + size_t size; +{ + register struct dirent *dp; + register DIR *dir; + register dev_t dev; + register ino_t ino; + register int first; + register char *bpt, *bup; + struct stat s; + dev_t root_dev; + ino_t root_ino; + size_t ptsize, upsize; + int save_errno; + char *ept, *eup, *up; + + /* + * If no buffer specified by the user, allocate one as necessary. + * If a buffer is specified, the size has to be non-zero. The path + * is built from the end of the buffer backwards. + */ + if (pt) { + ptsize = 0; + if (!size) { + errno = EINVAL; + return (NULL); + } + if (size == 1) { + errno = ERANGE; + return (NULL); + } + ept = pt + size; + } else { + if ((pt = (char *)__db_malloc(ptsize = 1024 - 4)) == NULL) + return (NULL); + ept = pt + ptsize; + } + bpt = ept - 1; + *bpt = '\0'; + + /* + * Allocate bytes (1024 - malloc space) for the string of "../"'s. + * Should always be enough (it's 340 levels). If it's not, allocate + * as necessary. Special case the first stat, it's ".", not "..". + */ + if ((up = (char *)__db_malloc(upsize = 1024 - 4)) == NULL) + goto err; + eup = up + 1024; + bup = up; + up[0] = '.'; + up[1] = '\0'; + + /* Save root values, so know when to stop. */ + if (stat("/", &s)) + goto err; + root_dev = s.st_dev; + root_ino = s.st_ino; + + errno = 0; /* XXX readdir has no error return. */ + + for (first = 1;; first = 0) { + /* Stat the current level. */ + if (lstat(up, &s)) + goto err; + + /* Save current node values. */ + ino = s.st_ino; + dev = s.st_dev; + + /* Check for reaching root. */ + if (root_dev == dev && root_ino == ino) { + *--bpt = PATH_SEPARATOR[0]; + /* + * It's unclear that it's a requirement to copy the + * path to the beginning of the buffer, but it's always + * been that way and stuff would probably break. + */ + bcopy(bpt, pt, ept - bpt); + __db_free(up); + return (pt); + } + + /* + * Build pointer to the parent directory, allocating memory + * as necessary. Max length is 3 for "../", the largest + * possible component name, plus a trailing NULL. + */ + if (bup + 3 + MAXNAMLEN + 1 >= eup) { + if ((up = + (char *)__db_realloc(up, upsize *= 2)) == NULL) + goto err; + bup = up; + eup = up + upsize; + } + *bup++ = '.'; + *bup++ = '.'; + *bup = '\0'; + + /* Open and stat parent directory. */ + if (!(dir = opendir(up)) || fstat(dirfd(dir), &s)) + goto err; + + /* Add trailing slash for next directory. */ + *bup++ = PATH_SEPARATOR[0]; + + /* + * If it's a mount point, have to stat each element because + * the inode number in the directory is for the entry in the + * parent directory, not the inode number of the mounted file. + */ + save_errno = 0; + if (s.st_dev == dev) { + for (;;) { + if (!(dp = readdir(dir))) + goto notfound; + if (dp->d_fileno == ino) + break; + } + } else + for (;;) { + if (!(dp = readdir(dir))) + goto notfound; + if (ISDOT(dp)) + continue; + bcopy(dp->d_name, bup, dp->d_namlen + 1); + + /* Save the first error for later. */ + if (lstat(up, &s)) { + if (!save_errno) + save_errno = errno; + errno = 0; + continue; + } + if (s.st_dev == dev && s.st_ino == ino) + break; + } + + /* + * Check for length of the current name, preceding slash, + * leading slash. + */ + if (bpt - pt < dp->d_namlen + (first ? 1 : 2)) { + size_t len, off; + + if (!ptsize) { + errno = ERANGE; + goto err; + } + off = bpt - pt; + len = ept - bpt; + if ((pt = + (char *)__db_realloc(pt, ptsize *= 2)) == NULL) + goto err; + bpt = pt + off; + ept = pt + ptsize; + bcopy(bpt, ept - len, len); + bpt = ept - len; + } + if (!first) + *--bpt = PATH_SEPARATOR[0]; + bpt -= dp->d_namlen; + bcopy(dp->d_name, bpt, dp->d_namlen); + (void)closedir(dir); + + /* Truncate any file name. */ + *bup = '\0'; + } + +notfound: + /* + * If readdir set errno, use it, not any saved error; otherwise, + * didn't find the current directory in its parent directory, set + * errno to ENOENT. + */ + if (!errno) + errno = save_errno ? save_errno : ENOENT; + /* FALLTHROUGH */ +err: + if (ptsize) + __db_free(pt); + __db_free(up); + return (NULL); +} diff --git a/mozilla/db/clib/getlong.c b/mozilla/db/clib/getlong.c new file mode 100644 index 00000000000..fabd0f0fb2f --- /dev/null +++ b/mozilla/db/clib/getlong.c @@ -0,0 +1,48 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)getlong.c 10.3 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#include +#include +#endif + +#include "db.h" +#include "clib_ext.h" + +/* + * get_long -- + * Return a long value inside of basic parameters. + * + * PUBLIC: void get_long __P((char *, long, long, long *)); + */ +void +get_long(p, min, max, storep) + char *p; + long min, max, *storep; +{ + long val; + char *end; + + errno = 0; + val = strtol(p, &end, 10); + if ((val == LONG_MIN || val == LONG_MAX) && errno == ERANGE) + err(1, "%s", p); + if (p[0] == '\0' || end[0] != '\0') + errx(1, "%s: Invalid numeric argument", p); + if (val < min) + errx(1, "%s: Less than minimum value (%ld)", p, min); + if (val > max) + errx(1, "%s: Greater than maximum value (%ld)", p, max); + *storep = val; +} diff --git a/mozilla/db/clib/getopt.c b/mozilla/db/clib/getopt.c new file mode 100644 index 00000000000..891b26f2575 --- /dev/null +++ b/mozilla/db/clib/getopt.c @@ -0,0 +1,143 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1987, 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. 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)getopt.c 10.6 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#include +#include +#endif + +#include "db_int.h" + +int opterr = 1, /* if error message should be printed */ + optind = 1, /* index into parent argv vector */ + optopt, /* character checked for validity */ + optreset; /* reset getopt */ +char *optarg; /* argument associated with option */ + +#undef BADCH +#define BADCH (int)'?' +#undef BADARG +#define BADARG (int)':' +#undef EMSG +#define EMSG "" + +/* + * getopt -- + * Parse argc/argv argument vector. + * + * PUBLIC: #ifndef HAVE_GETOPT + * PUBLIC: int getopt __P((int, char * const *, const char *)); + * PUBLIC: #endif + */ +int +getopt(nargc, nargv, ostr) + int nargc; + char * const *nargv; + const char *ostr; +{ + static char *progname; + static char *place = EMSG; /* option letter processing */ + char *oli; /* option letter list index */ + + if (!progname) { + if ((progname = __db_rpath(*nargv)) == NULL) + progname = *nargv; + else + ++progname; + } + + if (optreset || !*place) { /* update scanning pointer */ + optreset = 0; + if (optind >= nargc || *(place = nargv[optind]) != '-') { + place = EMSG; + return (EOF); + } + if (place[1] && *++place == '-') { /* found "--" */ + ++optind; + place = EMSG; + return (EOF); + } + } /* option letter okay? */ + if ((optopt = (int)*place++) == (int)':' || + !(oli = strchr(ostr, optopt))) { + /* + * if the user didn't specify '-' as an option, + * assume it means EOF. + */ + if (optopt == (int)'-') + return (EOF); + if (!*place) + ++optind; + if (opterr && *ostr != ':') + (void)fprintf(stderr, + "%s: illegal option -- %c\n", progname, optopt); + return (BADCH); + } + if (*++oli != ':') { /* don't need argument */ + optarg = NULL; + if (!*place) + ++optind; + } + else { /* need an argument */ + if (*place) /* no white space */ + optarg = place; + else if (nargc <= ++optind) { /* no arg */ + place = EMSG; + if (*ostr == ':') + return (BADARG); + if (opterr) + (void)fprintf(stderr, + "%s: option requires an argument -- %c\n", + progname, optopt); + return (BADCH); + } + else /* white space */ + optarg = nargv[optind]; + place = EMSG; + ++optind; + } + return (optopt); /* dump back option letter */ +} diff --git a/mozilla/db/clib/memcmp.c b/mozilla/db/clib/memcmp.c new file mode 100644 index 00000000000..b4d373ad041 --- /dev/null +++ b/mozilla/db/clib/memcmp.c @@ -0,0 +1,69 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1990, 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)memcmp.c 10.3 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include + +/* + * memcmp -- + * + * PUBLIC: #ifndef HAVE_MEMCMP + * PUBLIC: int memcmp __P((const void *, const void *, size_t)); + * PUBLIC: #endif + */ +int +memcmp(s1, s2, n) + char *s1, *s2; + size_t n; +{ + if (n != 0) { + unsigned char *p1 = (unsigned char *)s1, + *p2 = (unsigned char *)s2; + do { + if (*p1++ != *p2++) + return (*--p1 - *--p2); + } while (--n != 0); + } + return (0); +} diff --git a/mozilla/db/clib/memcpy.c b/mozilla/db/clib/memcpy.c new file mode 100644 index 00000000000..9daa89feb89 --- /dev/null +++ b/mozilla/db/clib/memcpy.c @@ -0,0 +1,159 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1990, 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)memmove.c 10.2 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#endif + +/* + * sizeof(word) MUST BE A POWER OF TWO + * SO THAT wmask BELOW IS ALL ONES + */ +typedef int word; /* "word" used for optimal copy speed */ + +#undef wsize +#define wsize sizeof(word) +#undef wmask +#define wmask (wsize - 1) + +/* + * Copy a block of memory, handling overlap. + * This is the routine that actually implements + * (the portable versions of) bcopy, memcpy, and memmove. + */ +#ifdef MEMCOPY +/* + * PUBLIC: #ifndef HAVE_MEMCPY + * PUBLIC: void *memcpy __P((void *, const void *, size_t)); + * PUBLIC: #endif + */ +void * +memcpy(dst0, src0, length) +#else +#ifdef MEMMOVE +/* + * PUBLIC: #ifndef HAVE_MEMMOVE + * PUBLIC: void *memmove __P((void *, const void *, size_t)); + * PUBLIC: #endif + */ +void * +memmove(dst0, src0, length) +#else +void +bcopy(src0, dst0, length) +#endif +#endif + void *dst0; + const void *src0; + register size_t length; +{ + register char *dst = dst0; + register const char *src = src0; + register size_t t; + + if (length == 0 || dst == src) /* nothing to do */ + goto done; + + /* + * Macros: loop-t-times; and loop-t-times, t>0 + */ +#undef TLOOP +#define TLOOP(s) if (t) TLOOP1(s) +#undef TLOOP1 +#define TLOOP1(s) do { s; } while (--t) + + if ((unsigned long)dst < (unsigned long)src) { + /* + * Copy forward. + */ + t = (int)src; /* only need low bits */ + if ((t | (int)dst) & wmask) { + /* + * Try to align operands. This cannot be done + * unless the low bits match. + */ + if ((t ^ (int)dst) & wmask || length < wsize) + t = length; + else + t = wsize - (t & wmask); + length -= t; + TLOOP1(*dst++ = *src++); + } + /* + * Copy whole words, then mop up any trailing bytes. + */ + t = length / wsize; + TLOOP(*(word *)dst = *(word *)src; src += wsize; dst += wsize); + t = length & wmask; + TLOOP(*dst++ = *src++); + } else { + /* + * Copy backwards. Otherwise essentially the same. + * Alignment works as before, except that it takes + * (t&wmask) bytes to align, not wsize-(t&wmask). + */ + src += length; + dst += length; + t = (int)src; + if ((t | (int)dst) & wmask) { + if ((t ^ (int)dst) & wmask || length <= wsize) + t = length; + else + t &= wmask; + length -= t; + TLOOP1(*--dst = *--src); + } + t = length / wsize; + TLOOP(src -= wsize; dst -= wsize; *(word *)dst = *(word *)src); + t = length & wmask; + TLOOP(*--dst = *--src); + } +done: +#if defined(MEMCOPY) || defined(MEMMOVE) + return (dst0); +#else + return; +#endif +} diff --git a/mozilla/db/clib/memmove.c b/mozilla/db/clib/memmove.c new file mode 100644 index 00000000000..9daa89feb89 --- /dev/null +++ b/mozilla/db/clib/memmove.c @@ -0,0 +1,159 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1990, 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)memmove.c 10.2 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#endif + +/* + * sizeof(word) MUST BE A POWER OF TWO + * SO THAT wmask BELOW IS ALL ONES + */ +typedef int word; /* "word" used for optimal copy speed */ + +#undef wsize +#define wsize sizeof(word) +#undef wmask +#define wmask (wsize - 1) + +/* + * Copy a block of memory, handling overlap. + * This is the routine that actually implements + * (the portable versions of) bcopy, memcpy, and memmove. + */ +#ifdef MEMCOPY +/* + * PUBLIC: #ifndef HAVE_MEMCPY + * PUBLIC: void *memcpy __P((void *, const void *, size_t)); + * PUBLIC: #endif + */ +void * +memcpy(dst0, src0, length) +#else +#ifdef MEMMOVE +/* + * PUBLIC: #ifndef HAVE_MEMMOVE + * PUBLIC: void *memmove __P((void *, const void *, size_t)); + * PUBLIC: #endif + */ +void * +memmove(dst0, src0, length) +#else +void +bcopy(src0, dst0, length) +#endif +#endif + void *dst0; + const void *src0; + register size_t length; +{ + register char *dst = dst0; + register const char *src = src0; + register size_t t; + + if (length == 0 || dst == src) /* nothing to do */ + goto done; + + /* + * Macros: loop-t-times; and loop-t-times, t>0 + */ +#undef TLOOP +#define TLOOP(s) if (t) TLOOP1(s) +#undef TLOOP1 +#define TLOOP1(s) do { s; } while (--t) + + if ((unsigned long)dst < (unsigned long)src) { + /* + * Copy forward. + */ + t = (int)src; /* only need low bits */ + if ((t | (int)dst) & wmask) { + /* + * Try to align operands. This cannot be done + * unless the low bits match. + */ + if ((t ^ (int)dst) & wmask || length < wsize) + t = length; + else + t = wsize - (t & wmask); + length -= t; + TLOOP1(*dst++ = *src++); + } + /* + * Copy whole words, then mop up any trailing bytes. + */ + t = length / wsize; + TLOOP(*(word *)dst = *(word *)src; src += wsize; dst += wsize); + t = length & wmask; + TLOOP(*dst++ = *src++); + } else { + /* + * Copy backwards. Otherwise essentially the same. + * Alignment works as before, except that it takes + * (t&wmask) bytes to align, not wsize-(t&wmask). + */ + src += length; + dst += length; + t = (int)src; + if ((t | (int)dst) & wmask) { + if ((t ^ (int)dst) & wmask || length <= wsize) + t = length; + else + t &= wmask; + length -= t; + TLOOP1(*--dst = *--src); + } + t = length / wsize; + TLOOP(src -= wsize; dst -= wsize; *(word *)dst = *(word *)src); + t = length & wmask; + TLOOP(*--dst = *--src); + } +done: +#if defined(MEMCOPY) || defined(MEMMOVE) + return (dst0); +#else + return; +#endif +} diff --git a/mozilla/db/clib/raise.c b/mozilla/db/clib/raise.c new file mode 100644 index 00000000000..3338d67bbda --- /dev/null +++ b/mozilla/db/clib/raise.c @@ -0,0 +1,32 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)raise.c 10.4 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#include +#endif + +/* + * raise -- + * Send a signal to the current process. + * + * PUBLIC: #ifndef HAVE_RAISE + * PUBLIC: int raise __P((int)); + * PUBLIC: #endif + */ +int +raise(s) + int s; +{ + return (kill(getpid(), s)); +} diff --git a/mozilla/db/clib/snprintf.c b/mozilla/db/clib/snprintf.c new file mode 100644 index 00000000000..48ca7696c88 --- /dev/null +++ b/mozilla/db/clib/snprintf.c @@ -0,0 +1,65 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)snprintf.c 10.3 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#ifdef __STDC__ +#include +#else +#include +#endif +#endif + +/* + * snprintf -- + * Bounded version of sprintf. + * + * PUBLIC: #ifndef HAVE_SNPRINTF + * PUBLIC: #ifdef __STDC__ + * PUBLIC: int snprintf __P((char *, size_t, const char *, ...)); + * PUBLIC: #else + * PUBLIC: int snprintf(); + * PUBLIC: #endif + * PUBLIC: #endif + */ +#ifndef HAVE_SNPRINTF +int +#ifdef __STDC__ +snprintf(char *str, size_t n, const char *fmt, ...) +#else +snprintf(str, n, fmt, va_alist) + char *str; + size_t n; + const char *fmt; + va_dcl +#endif +{ + va_list ap; + int rval; +#ifdef __STDC__ + va_start(ap, fmt); +#else + va_start(ap); +#endif +#ifdef SPRINTF_RET_CHARPNT + (void)vsprintf(str, fmt, ap); + va_end(ap); + return (strlen(str)); +#else + rval = vsprintf(str, fmt, ap); + va_end(ap); + return (rval); +#endif +} +#endif diff --git a/mozilla/db/clib/strerror.c b/mozilla/db/clib/strerror.c new file mode 100644 index 00000000000..bd39d4bd82b --- /dev/null +++ b/mozilla/db/clib/strerror.c @@ -0,0 +1,81 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +/* + * 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)strerror.c 10.3 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +/* + * strerror -- + * Return the string associated with an errno. + * + * PUBLIC: #ifndef HAVE_STRERROR + * PUBLIC: char *strerror __P((int)); + * PUBLIC: #endif + */ +char * +strerror(num) + int num; +{ + extern int sys_nerr; + extern char *sys_errlist[]; +#undef UPREFIX +#define UPREFIX "Unknown error: " + static char ebuf[40] = UPREFIX; /* 64-bit number + slop */ + int errnum; + char *p, *t, tmp[40]; + + errnum = num; /* convert to unsigned */ + if (errnum < sys_nerr) + return(sys_errlist[errnum]); + + /* Do this by hand, so we don't include stdio(3). */ + t = tmp; + do { + *t++ = "0123456789"[errnum % 10]; + } while (errnum /= 10); + for (p = ebuf + sizeof(UPREFIX) - 1;;) { + *p++ = *--t; + if (t <= tmp) + break; + } + return(ebuf); +} diff --git a/mozilla/db/clib/strsep.c b/mozilla/db/clib/strsep.c new file mode 100644 index 00000000000..c506502226d --- /dev/null +++ b/mozilla/db/clib/strsep.c @@ -0,0 +1,93 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1990, 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)strsep.c 10.2 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#include +#endif + +/* + * Get next token from string *stringp, where tokens are possibly-empty + * strings separated by characters from delim. + * + * Writes NULs into the string at *stringp to end tokens. + * delim need not remain constant from call to call. + * On return, *stringp points past the last NUL written (if there might + * be further tokens), or is NULL (if there are definitely no more tokens). + * + * If *stringp is NULL, strsep returns NULL. + * + * PUBLIC: #ifndef HAVE_STRSEP + * PUBLIC: char *strsep __P((char **, const char *)); + * PUBLIC: #endif + */ +char * +strsep(stringp, delim) + register char **stringp; + register const char *delim; +{ + register char *s; + register const char *spanp; + register int c, sc; + char *tok; + + if ((s = *stringp) == NULL) + return (NULL); + for (tok = s;;) { + c = *s++; + spanp = delim; + do { + if ((sc = *spanp++) == c) { + if (c == 0) + s = NULL; + else + s[-1] = 0; + *stringp = s; + return (tok); + } + } while (sc != 0); + } + /* NOTREACHED */ +} diff --git a/mozilla/db/clib/vsnprintf.c b/mozilla/db/clib/vsnprintf.c new file mode 100644 index 00000000000..e283f85c967 --- /dev/null +++ b/mozilla/db/clib/vsnprintf.c @@ -0,0 +1,47 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)vsnprintf.c 10.2 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#ifdef __STDC__ +#include +#else +#include +#endif +#endif + +/* + * vsnprintf -- + * Bounded version of vsprintf. + * + * PUBLIC: #ifndef HAVE_VSNPRINTF + * PUBLIC: int vsnprintf(); + * PUBLIC: #endif + */ +#ifndef HAVE_VSNPRINTF +int +vsnprintf(str, n, fmt, ap) + char *str; + size_t n; + const char *fmt; + va_list ap; +{ +#ifdef SPRINTF_RET_CHARPNT + (void)vsprintf(str, fmt, ap); + return (strlen(str)); +#else + return (vsprintf(str, fmt, ap)); +#endif +} +#endif diff --git a/mozilla/db/common/db_appinit.c b/mozilla/db/common/db_appinit.c new file mode 100644 index 00000000000..63f1dd544ba --- /dev/null +++ b/mozilla/db/common/db_appinit.c @@ -0,0 +1,795 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)db_appinit.c 10.52 (Sleepycat) 6/2/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_page.h" +#include "btree.h" +#include "hash.h" +#include "log.h" +#include "txn.h" +#include "clib_ext.h" +#include "common_ext.h" + +static int __db_home __P((DB_ENV *, const char *, u_int32_t)); +static int __db_parse __P((DB_ENV *, char *)); +static int __db_tmp_dir __P((DB_ENV *, u_int32_t)); +static int __db_tmp_open __P((DB_ENV *, u_int32_t, char *, int *)); + +/* + * db_version -- + * Return version information. + */ +char * +db_version(majverp, minverp, patchp) + int *majverp, *minverp, *patchp; +{ + if (majverp != NULL) + *majverp = DB_VERSION_MAJOR; + if (minverp != NULL) + *minverp = DB_VERSION_MINOR; + if (patchp != NULL) + *patchp = DB_VERSION_PATCH; + return ((char *)DB_VERSION_STRING); +} + +/* + * db_appinit -- + * Initialize the application environment. + */ +int +db_appinit(db_home, db_config, dbenv, flags) + const char *db_home; + char * const *db_config; + DB_ENV *dbenv; + u_int32_t flags; +{ + FILE *fp; + int mode, ret; + char * const *p; + char *lp, buf[MAXPATHLEN * 2]; + + /* Validate arguments. */ + if (dbenv == NULL) + return (EINVAL); + + +#ifdef HAVE_SPINLOCKS +#define OKFLAGS \ + (DB_CREATE | DB_NOMMAP | DB_THREAD | DB_INIT_LOCK | DB_INIT_LOG | \ + DB_INIT_MPOOL | DB_INIT_TXN | DB_MPOOL_PRIVATE | DB_RECOVER | \ + DB_RECOVER_FATAL | DB_TXN_NOSYNC | DB_USE_ENVIRON | DB_USE_ENVIRON_ROOT) +#else +#define OKFLAGS \ + (DB_CREATE | DB_NOMMAP | DB_INIT_LOCK | DB_INIT_LOG | \ + DB_INIT_MPOOL | DB_INIT_TXN | DB_MPOOL_PRIVATE | DB_RECOVER | \ + DB_RECOVER_FATAL | DB_TXN_NOSYNC | DB_USE_ENVIRON | DB_USE_ENVIRON_ROOT) +#endif + if ((ret = __db_fchk(dbenv, "db_appinit", flags, OKFLAGS)) != 0) + return (ret); + + /* Transactions imply logging. */ + if (LF_ISSET(DB_INIT_TXN)) + LF_SET(DB_INIT_LOG); + + /* Convert the db_appinit(3) flags. */ + if (LF_ISSET(DB_THREAD)) + F_SET(dbenv, DB_ENV_THREAD); + + fp = NULL; + + /* Set the database home. */ + if ((ret = __db_home(dbenv, db_home, flags)) != 0) + goto err; + + /* Parse the config array. */ + for (p = db_config; p != NULL && *p != NULL; ++p) + if ((ret = __db_parse(dbenv, *p)) != 0) + goto err; + + /* + * Parse the config file. + * + * XXX + * Don't use sprintf(3)/snprintf(3) -- the former is dangerous, and + * the latter isn't standard, and we're manipulating strings handed + * us by the application. + */ + if (dbenv->db_home != NULL) { +#define CONFIG_NAME "/DB_CONFIG" + if (strlen(dbenv->db_home) + + strlen(CONFIG_NAME) + 1 > sizeof(buf)) { + ret = ENAMETOOLONG; + goto err; + } + (void)strcpy(buf, dbenv->db_home); + (void)strcat(buf, CONFIG_NAME); + if ((fp = fopen(buf, "r")) != NULL) { + while (fgets(buf, sizeof(buf), fp) != NULL) { + if ((lp = strchr(buf, '\n')) != NULL) + *lp = '\0'; + if ((ret = __db_parse(dbenv, buf)) != 0) + goto err; + } + (void)fclose(fp); + fp = NULL; + } + } + + /* Set up the tmp directory path. */ + if (dbenv->db_tmp_dir == NULL && + (ret = __db_tmp_dir(dbenv, flags)) != 0) + goto err; + + /* Indicate that the path names have been set. */ + F_SET(dbenv, DB_ENV_APPINIT); + + /* + * If we are doing recovery, remove all the old shared memory + * regions. + */ + if (LF_ISSET(DB_RECOVER | DB_RECOVER_FATAL)) { + if ((ret = log_unlink(NULL, 1, dbenv)) != 0) + goto err; + if ((ret = memp_unlink(NULL, 1, dbenv)) != 0) + goto err; + if ((ret = lock_unlink(NULL, 1, dbenv)) != 0) + goto err; + if ((ret = txn_unlink(NULL, 1, dbenv)) != 0) + goto err; + } + + /* + * Create the new shared regions. + * + * Default permissions are read-write for both owner and group. + */ + mode = __db_omode("rwrw--"); + if (LF_ISSET(DB_INIT_LOCK) && (ret = lock_open(NULL, + LF_ISSET(DB_CREATE | DB_THREAD), + mode, dbenv, &dbenv->lk_info)) != 0) + goto err; + if (LF_ISSET(DB_INIT_LOG) && (ret = log_open(NULL, + LF_ISSET(DB_CREATE | DB_THREAD), + mode, dbenv, &dbenv->lg_info)) != 0) + goto err; + if (LF_ISSET(DB_INIT_MPOOL) && (ret = memp_open(NULL, + LF_ISSET(DB_CREATE | DB_MPOOL_PRIVATE | DB_NOMMAP | DB_THREAD), + mode, dbenv, &dbenv->mp_info)) != 0) + goto err; + if (LF_ISSET(DB_INIT_TXN) && (ret = txn_open(NULL, + LF_ISSET(DB_CREATE | DB_THREAD | DB_TXN_NOSYNC), + mode, dbenv, &dbenv->tx_info)) != 0) + goto err; + + /* + * If the application is running with transactions, initialize the + * function tables. Once that's done, do recovery for any previous + * run. + */ + if (LF_ISSET(DB_INIT_TXN)) { + if ((ret = __bam_init_recover(dbenv)) != 0) + goto err; + if ((ret = __db_init_recover(dbenv)) != 0) + goto err; + if ((ret = __ham_init_recover(dbenv)) != 0) + goto err; + if ((ret = __log_init_recover(dbenv)) != 0) + goto err; + if ((ret = __txn_init_recover(dbenv)) != 0) + goto err; + + if (LF_ISSET(DB_RECOVER | DB_RECOVER_FATAL) && + (ret = __db_apprec(dbenv, + LF_ISSET(DB_RECOVER | DB_RECOVER_FATAL))) != 0) + goto err; + } + + return (ret); + +err: if (fp != NULL) + (void)fclose(fp); + + (void)db_appexit(dbenv); + return (ret); +} + +/* + * db_appexit -- + * Close down the default application environment. + */ +int +db_appexit(dbenv) + DB_ENV *dbenv; +{ + int ret, t_ret; + char **p; + + ret = 0; + + /* Close subsystems. */ + if (dbenv->tx_info && (t_ret = txn_close(dbenv->tx_info)) != 0) + if (ret == 0) + ret = t_ret; + if (dbenv->mp_info && (t_ret = memp_close(dbenv->mp_info)) != 0) + if (ret == 0) + ret = t_ret; + if (dbenv->lg_info && (t_ret = log_close(dbenv->lg_info)) != 0) + if (ret == 0) + ret = t_ret; + if (dbenv->lk_info && (t_ret = lock_close(dbenv->lk_info)) != 0) + if (ret == 0) + ret = t_ret; + + /* Free allocated memory. */ + if (dbenv->db_home != NULL) + FREES(dbenv->db_home); + if ((p = dbenv->db_data_dir) != NULL) { + for (; *p != NULL; ++p) + FREES(*p); + FREE(dbenv->db_data_dir, dbenv->data_cnt * sizeof(char **)); + } + if (dbenv->db_log_dir != NULL) + FREES(dbenv->db_log_dir); + if (dbenv->db_tmp_dir != NULL) + FREES(dbenv->db_tmp_dir); + + return (ret); +} + +#define DB_ADDSTR(str) { \ + if ((str) != NULL) { \ + /* If leading slash, start over. */ \ + if (__db_abspath(str)) { \ + p = start; \ + slash = 0; \ + } \ + /* Append to the current string. */ \ + len = strlen(str); \ + if (slash) \ + *p++ = PATH_SEPARATOR[0]; \ + memcpy(p, str, len); \ + p += len; \ + slash = strchr(PATH_SEPARATOR, p[-1]) == NULL; \ + } \ +} + +/* + * __db_appname -- + * Given an optional DB environment, directory and file name and type + * of call, build a path based on the db_appinit(3) rules, and return + * it in allocated space. + * + * PUBLIC: int __db_appname __P((DB_ENV *, + * PUBLIC: APPNAME, const char *, const char *, u_int32_t, int *, char **)); + */ +int +__db_appname(dbenv, appname, dir, file, tmp_oflags, fdp, namep) + DB_ENV *dbenv; + APPNAME appname; + const char *dir, *file; + u_int32_t tmp_oflags; + int *fdp; + char **namep; +{ + DB_ENV etmp; + size_t len; + int data_entry, ret, slash, tmp_create, tmp_free; + const char *a, *b, *c; + char *p, *start; + + a = b = c = NULL; + data_entry = -1; + tmp_create = tmp_free = 0; + + /* + * We don't return a name when creating temporary files, just an fd. + * Default to error now. + */ + if (fdp != NULL) + *fdp = -1; + if (namep != NULL) + *namep = NULL; + + /* + * Absolute path names are never modified. If the file is an absolute + * path, we're done. If the directory is, simply append the file and + * return. + */ + if (file != NULL && __db_abspath(file)) + return ((*namep = + (char *)__db_strdup(file)) == NULL ? ENOMEM : 0); + if (dir != NULL && __db_abspath(dir)) { + a = dir; + goto done; + } + + /* + * DB_ENV DIR APPNAME RESULT + * ------------------------------------------- + * null null none /file + * null set none DIR/file + * set null none DB_HOME/file + * set set none DB_HOME/DIR/file + * + * DB_ENV FILE APPNAME RESULT + * ------------------------------------------- + * null null DB_APP_DATA / + * null set DB_APP_DATA ./file + * set null DB_APP_DATA / + * set set DB_APP_DATA DB_HOME/DB_DATA_DIR/file + * + * DB_ENV DIR APPNAME RESULT + * ------------------------------------------- + * null null DB_APP_LOG /file + * null set DB_APP_LOG DIR/file + * set null DB_APP_LOG DB_HOME/DB_LOG_DIR/file + * set set DB_APP_LOG DB_HOME/DB_LOG_DIR/DIR/file + * + * DB_ENV APPNAME RESULT + * ------------------------------------------- + * null DB_APP_TMP* / + * set DB_APP_TMP* DB_HOME/DB_TMP_DIR/ + */ +retry: switch (appname) { + case DB_APP_NONE: + if (dbenv == NULL || !F_ISSET(dbenv, DB_ENV_APPINIT)) { + if (dir == NULL) + goto tmp; + a = dir; + } else { + a = dbenv->db_home; + b = dir; + } + break; + case DB_APP_DATA: + if (dir != NULL) { + __db_err(dbenv, + "DB_APP_DATA: illegal directory specification"); + return (EINVAL); + } + + if (file == NULL) { + tmp_create = 1; + goto tmp; + } + if (dbenv == NULL || !F_ISSET(dbenv, DB_ENV_APPINIT)) + a = PATH_DOT; + else { + a = dbenv->db_home; + if (dbenv->db_data_dir != NULL && + (b = dbenv->db_data_dir[++data_entry]) == NULL) { + data_entry = -1; + b = dbenv->db_data_dir[0]; + } + } + break; + case DB_APP_LOG: + if (dbenv == NULL || !F_ISSET(dbenv, DB_ENV_APPINIT)) { + if (dir == NULL) + goto tmp; + a = dir; + } else { + a = dbenv->db_home; + b = dbenv->db_log_dir; + c = dir; + } + break; + case DB_APP_TMP: + if (dir != NULL || file != NULL) { + __db_err(dbenv, + "DB_APP_TMP: illegal directory or file specification"); + return (EINVAL); + } + + tmp_create = 1; + if (dbenv == NULL || !F_ISSET(dbenv, DB_ENV_APPINIT)) + goto tmp; + else { + a = dbenv->db_home; + b = dbenv->db_tmp_dir; + } + break; + } + + /* Reference a file from the appropriate temporary directory. */ + if (0) { +tmp: if (dbenv == NULL || !F_ISSET(dbenv, DB_ENV_APPINIT)) { + memset(&etmp, 0, sizeof(etmp)); + if ((ret = __db_tmp_dir(&etmp, DB_USE_ENVIRON)) != 0) + return (ret); + tmp_free = 1; + a = etmp.db_tmp_dir; + } else + a = dbenv->db_tmp_dir; + } + +done: len = + (a == NULL ? 0 : strlen(a) + 1) + + (b == NULL ? 0 : strlen(b) + 1) + + (c == NULL ? 0 : strlen(c) + 1) + + (file == NULL ? 0 : strlen(file) + 1); + + /* + * Allocate space to hold the current path information, as well as any + * temporary space that we're going to need to create a temporary file + * name. + */ +#define DB_TRAIL "XXXXXX" + if ((start = + (char *)__db_malloc(len + sizeof(DB_TRAIL) + 10)) == NULL) { + __db_err(dbenv, "%s", strerror(ENOMEM)); + if (tmp_free) + FREES(etmp.db_tmp_dir); + return (ENOMEM); + } + + slash = 0; + p = start; + DB_ADDSTR(a); + DB_ADDSTR(b); + DB_ADDSTR(file); + *p = '\0'; + + /* + * If we're opening a data file, see if it exists. If it does, + * return it, otherwise, try and find another one to open. + */ + if (data_entry != -1 && __db_exists(start, NULL) != 0) { + FREES(start); + a = b = c = NULL; + goto retry; + } + + /* Discard any space allocated to find the temp directory. */ + if (tmp_free) + FREES(etmp.db_tmp_dir); + + /* Create the file if so requested. */ + if (tmp_create && + (ret = __db_tmp_open(dbenv, tmp_oflags, start, fdp)) != 0) { + FREES(start); + return (ret); + } + + if (namep != NULL) + *namep = start; + return (0); +} + +/* + * __db_home -- + * Find the database home. + */ +static int +__db_home(dbenv, db_home, flags) + DB_ENV *dbenv; + const char *db_home; + u_int32_t flags; +{ + const char *p; + + p = db_home; + + /* Use the environment if it's permitted and initialized. */ +#ifdef HAVE_GETUID + if (LF_ISSET(DB_USE_ENVIRON) || + (LF_ISSET(DB_USE_ENVIRON_ROOT) && getuid() == 0)) { +#else + if (LF_ISSET(DB_USE_ENVIRON)) { +#endif + if ((p = getenv("DB_HOME")) == NULL) + p = db_home; + else if (p[0] == '\0') { + __db_err(dbenv, + "illegal DB_HOME environment variable"); + return (EINVAL); + } + } + + if (p == NULL) + return (0); + + if ((dbenv->db_home = (char *)__db_strdup(p)) == NULL) { + __db_err(dbenv, "%s", strerror(ENOMEM)); + return (ENOMEM); + } + return (0); +} + +/* + * __db_parse -- + * Parse a single NAME VALUE pair. + */ +static int +__db_parse(dbenv, s) + DB_ENV *dbenv; + char *s; +{ + int ret; + char *local_s, *name, *value, **p, *tp; + + ret = 0; + + /* + * We need to strdup the argument in case the caller passed us + * static data. + */ + if ((local_s = (char *)__db_strdup(s)) == NULL) + return (ENOMEM); + + tp = local_s; + while ((name = strsep(&tp, " \t")) != NULL && *name == '\0') + ; + if (name == NULL) + goto illegal; + while ((value = strsep(&tp, " \t")) != NULL && *value == '\0') + ; + if (value == NULL) { +illegal: ret = EINVAL; + __db_err(dbenv, "illegal name-value pair: %s", s); + goto err; + } + +#define DATA_INIT_CNT 20 /* Start with 20 data slots. */ + if (!strcmp(name, "DB_DATA_DIR")) { + if (dbenv->db_data_dir == NULL) { + if ((dbenv->db_data_dir = + (char **)__db_calloc(DATA_INIT_CNT, + sizeof(char **))) == NULL) + goto nomem; + dbenv->data_cnt = DATA_INIT_CNT; + } else if (dbenv->data_next == dbenv->data_cnt - 1) { + dbenv->data_cnt *= 2; + if ((dbenv->db_data_dir = + (char **)__db_realloc(dbenv->db_data_dir, + dbenv->data_cnt * sizeof(char **))) == NULL) + goto nomem; + } + p = &dbenv->db_data_dir[dbenv->data_next++]; + } else if (!strcmp(name, "DB_LOG_DIR")) { + if (dbenv->db_log_dir != NULL) + FREES(dbenv->db_log_dir); + p = &dbenv->db_log_dir; + } else if (!strcmp(name, "DB_TMP_DIR")) { + if (dbenv->db_tmp_dir != NULL) + FREES(dbenv->db_tmp_dir); + p = &dbenv->db_tmp_dir; + } else + goto err; + + if ((*p = (char *)__db_strdup(value)) == NULL) { +nomem: ret = ENOMEM; + __db_err(dbenv, "%s", strerror(ENOMEM)); + } + +err: FREES(local_s); + return (ret); +} + +#ifdef macintosh +#include + +static char *sTempFolder; +#endif + +/* + * tmp -- + * Set the temporary directory path. + */ +static int +__db_tmp_dir(dbenv, flags) + DB_ENV *dbenv; + u_int32_t flags; +{ + static const char * list[] = { /* Ordered: see db_appinit(3). */ + "/var/tmp", + "/usr/tmp", + "/temp", /* WIN32. */ + "/tmp", + "C:/temp", /* WIN32. */ + "C:/tmp", /* WIN32. */ + NULL + }; + const char **lp, *p; + + /* Use the environment if it's permitted and initialized. */ + p = NULL; +#ifdef HAVE_GETEUID + if (LF_ISSET(DB_USE_ENVIRON) || + (LF_ISSET(DB_USE_ENVIRON_ROOT) && getuid() == 0)) { +#else + if (LF_ISSET(DB_USE_ENVIRON)) { +#endif + if ((p = getenv("TMPDIR")) != NULL && p[0] == '\0') { + __db_err(dbenv, "illegal TMPDIR environment variable"); + return (EINVAL); + } + /* WIN32 */ + if (p == NULL && (p = getenv("TEMP")) != NULL && p[0] == '\0') { + __db_err(dbenv, "illegal TEMP environment variable"); + return (EINVAL); + } + /* WIN32 */ + if (p == NULL && (p = getenv("TMP")) != NULL && p[0] == '\0') { + __db_err(dbenv, "illegal TMP environment variable"); + return (EINVAL); + } + /* Macintosh */ + if (p == NULL && + (p = getenv("TempFolder")) != NULL && p[0] == '\0') { + __db_err(dbenv, + "illegal TempFolder environment variable"); + return (EINVAL); + } + } + +#ifdef macintosh + /* Get the path to the temporary folder. */ + if (p == NULL) { + FSSpec spec; + + if (!Special2FSSpec(kTemporaryFolderType, + kOnSystemDisk, 0, &spec)) { + p = FSp2FullPath(&spec); + sTempFolder = __db_malloc(strlen(p) + 1); + strcpy(sTempFolder, p); + p = sTempFolder; + } + } +#endif + + /* Step through the list looking for a possibility. */ + if (p == NULL) + for (lp = list; *lp != NULL; ++lp) + if (__db_exists(p = *lp, NULL) == 0) + break; + + if (p == NULL) + return (0); + + if ((dbenv->db_tmp_dir = (char *)__db_strdup(p)) == NULL) { + __db_err(dbenv, "%s", strerror(ENOMEM)); + return (ENOMEM); + } + return (0); +} + +/* + * __db_tmp_open -- + * Create a temporary file. + */ +static int +__db_tmp_open(dbenv, flags, path, fdp) + DB_ENV *dbenv; + u_int32_t flags; + char *path; + int *fdp; +{ +#ifdef HAVE_SIGFILLSET + sigset_t set, oset; +#endif + u_long pid; + int mode, isdir, ret; + char *p, *trv; + + /* + * Check the target directory; if you have six X's and it doesn't + * exist, this runs for a *very* long time. + */ + if ((ret = __db_exists(path, &isdir)) != 0) { + __db_err(dbenv, "%s: %s", path, strerror(ret)); + return (ret); + } + if (!isdir) { + __db_err(dbenv, "%s: %s", path, strerror(EINVAL)); + return (EINVAL); + } + + /* Build the path. */ + for (trv = path; *trv != '\0'; ++trv) + ; + *trv = PATH_SEPARATOR[0]; + for (p = DB_TRAIL; (*++trv = *p) != '\0'; ++p) + ; + + /* + * Replace the X's with the process ID. Pid should be a pid_t, + * but we use unsigned long for portability. + */ + for (pid = getpid(); *--trv == 'X'; pid /= 10) + switch (pid % 10) { + case 0: *trv = '0'; break; + case 1: *trv = '1'; break; + case 2: *trv = '2'; break; + case 3: *trv = '3'; break; + case 4: *trv = '4'; break; + case 5: *trv = '5'; break; + case 6: *trv = '6'; break; + case 7: *trv = '7'; break; + case 8: *trv = '8'; break; + case 9: *trv = '9'; break; + } + ++trv; + + /* Set up open flags and mode. */ + LF_SET(DB_CREATE | DB_EXCL); + mode = __db_omode("rw----"); + + /* + * Try to open a file. We block every signal we can get our hands + * on so that, if we're interrupted at the wrong time, the temporary + * file isn't left around -- of course, if we drop core in-between + * the calls we'll hang forever, but that's probably okay. ;-} + */ +#ifdef HAVE_SIGFILLSET + if (LF_ISSET(DB_TEMPORARY)) + (void)sigfillset(&set); +#endif + for (;;) { +#ifdef HAVE_SIGFILLSET + if (LF_ISSET(DB_TEMPORARY)) + (void)sigprocmask(SIG_BLOCK, &set, &oset); +#endif + ret = __db_open(path, flags, flags, mode, fdp); +#ifdef HAVE_SIGFILLSET + if (LF_ISSET(DB_TEMPORARY)) + (void)sigprocmask(SIG_SETMASK, &oset, NULL); +#endif + if (ret == 0) + return (0); + + /* + * XXX: + * If we don't get an EEXIST error, then there's something + * seriously wrong. Unfortunately, if the implementation + * doesn't return EEXIST for O_CREAT and O_EXCL regardless + * of other possible errors, we've lost. + */ + if (ret != EEXIST) { + __db_err(dbenv, + "tmp_open: %s: %s", path, strerror(ret)); + return (ret); + } + + /* + * Tricky little algorithm for backward compatibility. + * Assumes the ASCII ordering of lower-case characters. + */ + for (;;) { + if (*trv == '\0') + return (EINVAL); + if (*trv == 'z') + *trv++ = 'a'; + else { + if (isdigit(*trv)) + *trv = 'a'; + else + ++*trv; + break; + } + } + } + /* NOTREACHED */ +} diff --git a/mozilla/db/common/db_apprec.c b/mozilla/db/common/db_apprec.c new file mode 100644 index 00000000000..df707eafefd --- /dev/null +++ b/mozilla/db/common/db_apprec.c @@ -0,0 +1,210 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char copyright[] = +"@(#) Copyright (c) 1996, 1997, 1998\n\ + Sleepycat Software Inc. All rights reserved.\n"; +static const char sccsid[] = "@(#)db_apprec.c 10.30 (Sleepycat) 5/3/98"; +#endif + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_page.h" +#include "db_dispatch.h" +#include "db_am.h" +#include "log.h" +#include "txn.h" +#include "common_ext.h" + +/* + * __db_apprec -- + * Perform recovery. + * + * PUBLIC: int __db_apprec __P((DB_ENV *, u_int32_t)); + */ +int +__db_apprec(dbenv, flags) + DB_ENV *dbenv; + u_int32_t flags; +{ + DBT data; + DB_LOG *lp; + DB_LSN ckp_lsn, first_lsn, lsn; + time_t now; + u_int32_t is_thread; + int ret; + void *txninfo; + + lp = dbenv->lg_info; + + /* Initialize the transaction list. */ + if ((ret = __db_txnlist_init(&txninfo)) != 0) + return (ret); + + /* + * Save the state of the thread flag -- we don't need it on at the + * moment because we're single-threaded until recovery is complete. + */ + is_thread = F_ISSET(lp, DB_AM_THREAD); + F_CLR(lp, DB_AM_THREAD); + + /* + * Recovery is done in three passes: + * Pass #1: + * Read forward through the log from the last checkpoint to the + * end of the log, opening and closing files so that at the end + * of the log we have the "current" set of files open. + * Pass #2: + * Read backward through the log undoing any uncompleted TXNs. + * If doing catastrophic recovery, we read to the beginning of + * the log, otherwise, to the most recent checkpoint that occurs + * before the most recent checkpoint LSN, which is returned by + * __log_findckp(). During this pass, checkpoint file information + * is ignored, and file openings and closings are undone. + * Pass #3: + * Read forward through the log from the LSN found in pass #2, + * redoing any committed TXNs. During this pass, checkpoint + * file information is ignored, and file openings and closings + * are redone. + */ + + /* + * Find the last checkpoint in the log. This is the point from which + * we want to begin pass #1 (the TXN_OPENFILES pass). + */ + memset(&data, 0, sizeof(data)); + if ((ret = log_get(lp, &ckp_lsn, &data, DB_CHECKPOINT)) != 0) { + /* + * If we don't find a checkpoint, start from the beginning. + * If that fails, we're done. Note, we do not require that + * there be log records if we're performing recovery. + */ + if ((ret = log_get(lp, &ckp_lsn, &data, DB_FIRST)) != 0) { + if (ret == DB_NOTFOUND) + ret = 0; + else + __db_err(dbenv, "First log record not found"); + goto out; + } + } + + /* + * Now, ckp_lsn is either the lsn of the last checkpoint or the lsn + * of the first record in the log. Begin the TXN_OPENFILES pass from + * that lsn, and proceed to the end of the log. + */ + lsn = ckp_lsn; + for (;;) { + ret = __db_dispatch(lp, &data, &lsn, TXN_OPENFILES, txninfo); + if (ret != 0 && ret != DB_TXN_CKP) + goto msgerr; + if ((ret = log_get(lp, &lsn, &data, DB_NEXT)) != 0) { + if (ret == DB_NOTFOUND) + break; + goto out; + } + } + + /* + * Pass #2. + * + * Before we can begin pass #2, backward roll phase, we determine how + * far back in the log to recover. If we are doing catastrophic + * recovery, then we go as far back as we have files. If we are + * doing normal recovery, we go as back to the most recent checkpoint + * that occurs before the most recent checkpoint LSN. + */ + if (LF_ISSET(DB_RECOVER_FATAL)) { + ZERO_LSN(first_lsn); + } else + if ((ret = __log_findckp(lp, &first_lsn)) == DB_NOTFOUND) { + /* + * We don't require that log files exist if recovery + * was specified. + */ + ret = 0; + goto out; + } + + if (dbenv->db_verbose) + __db_err(lp->dbenv, "Recovery starting from [%lu][%lu]", + (u_long)first_lsn.file, (u_long)first_lsn.offset); + + for (ret = log_get(lp, &lsn, &data, DB_LAST); + ret == 0 && log_compare(&lsn, &first_lsn) > 0; + ret = log_get(lp, &lsn, &data, DB_PREV)) { + ret = __db_dispatch(lp, + &data, &lsn, TXN_BACKWARD_ROLL, txninfo); + if (ret != 0) + if (ret != DB_TXN_CKP) + goto msgerr; + else + ret = 0; + } + if (ret != 0 && ret != DB_NOTFOUND) + goto out; + + /* + * Pass #3. + */ + for (ret = log_get(lp, &lsn, &data, DB_NEXT); + ret == 0; ret = log_get(lp, &lsn, &data, DB_NEXT)) { + ret = __db_dispatch(lp, &data, &lsn, TXN_FORWARD_ROLL, txninfo); + if (ret != 0) + if (ret != DB_TXN_CKP) + goto msgerr; + else + ret = 0; + } + if (ret != DB_NOTFOUND) + goto out; + + /* Now close all the db files that are open. */ + __log_close_files(lp); + + /* + * Now set the last checkpoint lsn and the current time, + * take a checkpoint, and reset the txnid. + */ + (void)time(&now); + dbenv->tx_info->region->last_ckp = ckp_lsn; + dbenv->tx_info->region->time_ckp = (u_int32_t)now; + if ((ret = txn_checkpoint(dbenv->tx_info, 0, 0)) != 0) + goto out; + dbenv->tx_info->region->last_txnid = TXN_MINIMUM; + + if (dbenv->db_verbose) { + __db_err(lp->dbenv, "Recovery complete at %.24s", ctime(&now)); + __db_err(lp->dbenv, "%s %lx %s [%lu][%lu]", + "Maximum transaction id", + ((DB_TXNHEAD *)txninfo)->maxid, + "Recovery checkpoint", + (u_long)dbenv->tx_info->region->last_ckp.file, + (u_long)dbenv->tx_info->region->last_ckp.offset); + } + + if (0) { +msgerr: __db_err(dbenv, "Recovery function for LSN %lu %lu failed", + (u_long)lsn.file, (u_long)lsn.offset); + } + +out: F_SET(lp, is_thread); + __db_txnlist_end(txninfo); + + return (ret); +} diff --git a/mozilla/db/common/db_byteorder.c b/mozilla/db/common/db_byteorder.c new file mode 100644 index 00000000000..cadf7428516 --- /dev/null +++ b/mozilla/db/common/db_byteorder.c @@ -0,0 +1,63 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)db_byteorder.c 10.5 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#ifdef HAVE_ENDIAN_H +#include +#if BYTE_ORDER == BIG_ENDIAN +#define WORDS_BIGENDIAN 1 +#endif +#endif + +#include +#endif + +#include "db_int.h" +#include "common_ext.h" + +/* + * __db_byteorder -- + * Return if we need to do byte swapping, checking for illegal + * values. + * + * PUBLIC: int __db_byteorder __P((DB_ENV *, int)); + */ +int +__db_byteorder(dbenv, lorder) + DB_ENV *dbenv; + int lorder; +{ + switch (lorder) { + case 0: + break; + case 1234: +#if defined(WORDS_BIGENDIAN) + return (DB_SWAPBYTES); +#else + break; +#endif + case 4321: +#if defined(WORDS_BIGENDIAN) + break; +#else + return (DB_SWAPBYTES); +#endif + default: + __db_err(dbenv, + "illegal byte order, only big and little-endian supported"); + return (EINVAL); + } + return (0); +} diff --git a/mozilla/db/common/db_err.c b/mozilla/db/common/db_err.c new file mode 100644 index 00000000000..98a414279e1 --- /dev/null +++ b/mozilla/db/common/db_err.c @@ -0,0 +1,615 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)db_err.c 10.25 (Sleepycat) 5/2/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include + +#ifdef __STDC__ +#include +#else +#include +#endif +#endif + +#include "db_int.h" +#include "common_ext.h" + +static int __db_keyempty __P((const DB_ENV *)); +static int __db_rdonly __P((const DB_ENV *, const char *)); + +/* + * __db_err -- + * Standard DB error routine. + * + * PUBLIC: #ifdef __STDC__ + * PUBLIC: void __db_err __P((const DB_ENV *dbenv, const char *fmt, ...)); + * PUBLIC: #else + * PUBLIC: void __db_err(); + * PUBLIC: #endif + */ +void +#ifdef __STDC__ +__db_err(const DB_ENV *dbenv, const char *fmt, ...) +#else +__db_err(dbenv, fmt, va_alist) + const DB_ENV *dbenv; + const char *fmt; + va_dcl +#endif +{ + va_list ap; + char errbuf[2048]; /* XXX: END OF THE STACK DON'T TRUST SPRINTF. */ + + if (dbenv == NULL) + return; + +#ifdef __STDC__ + va_start(ap, fmt); +#else + va_start(ap); +#endif + if (dbenv->db_errcall != NULL) { + (void)vsnprintf(errbuf, sizeof(errbuf), fmt, ap); + dbenv->db_errcall(dbenv->db_errpfx, errbuf); + } + if (dbenv->db_errfile != NULL) { + if (dbenv->db_errpfx != NULL) + (void)fprintf(dbenv->db_errfile, "%s: ", + dbenv->db_errpfx); + (void)vfprintf(dbenv->db_errfile, fmt, ap); + (void)fprintf(dbenv->db_errfile, "\n"); + (void)fflush(dbenv->db_errfile); + } + va_end(ap); +} + +/* + * XXX + * Provide ANSI C prototypes for the panic functions. Some compilers, (e.g., + * MS VC 4.2) get upset if they aren't here, even though the K&R declaration + * appears before the assignment in the __db__panic() call. + */ +static int __db_ecursor __P((DB *, DB_TXN *, DBC **)); +static int __db_edel __P((DB *, DB_TXN *, DBT *, u_int32_t)); +static int __db_efd __P((DB *, int *)); +static int __db_egp __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); +static int __db_estat __P((DB *, void *, void *(*)(size_t), u_int32_t)); +static int __db_esync __P((DB *, u_int32_t)); + +/* + * __db_ecursor -- + * After-panic cursor routine. + */ +static int +__db_ecursor(a, b, c) + DB *a; + DB_TXN *b; + DBC **c; +{ + COMPQUIET(a, NULL); + COMPQUIET(b, NULL); + COMPQUIET(c, NULL); + + return (EPERM); +} + +/* + * __db_edel -- + * After-panic delete routine. + */ +static int +__db_edel(a, b, c, d) + DB *a; + DB_TXN *b; + DBT *c; + u_int32_t d; +{ + COMPQUIET(a, NULL); + COMPQUIET(b, NULL); + COMPQUIET(c, NULL); + COMPQUIET(d, 0); + + return (EPERM); +} + +/* + * __db_efd -- + * After-panic fd routine. + */ +static int +__db_efd(a, b) + DB *a; + int *b; +{ + COMPQUIET(a, NULL); + COMPQUIET(b, NULL); + + return (EPERM); +} + +/* + * __db_egp -- + * After-panic get/put routine. + */ +static int +__db_egp(a, b, c, d, e) + DB *a; + DB_TXN *b; + DBT *c, *d; + u_int32_t e; +{ + COMPQUIET(a, NULL); + COMPQUIET(b, NULL); + COMPQUIET(c, NULL); + COMPQUIET(d, NULL); + COMPQUIET(e, 0); + + return (EPERM); +} + +/* + * __db_estat -- + * After-panic stat routine. + */ +static int +__db_estat(a, b, c, d) + DB *a; + void *b; + void *(*c) __P((size_t)); + u_int32_t d; +{ + COMPQUIET(a, NULL); + COMPQUIET(b, NULL); + COMPQUIET(c, NULL); + COMPQUIET(d, 0); + + return (EPERM); +} + +/* + * __db_esync -- + * After-panic sync routine. + */ +static int +__db_esync(a, b) + DB *a; + u_int32_t b; +{ + COMPQUIET(a, NULL); + COMPQUIET(b, 0); + + return (EPERM); +} + +/* + * __db_panic -- + * Lock out the tree due to unrecoverable error. + * + * PUBLIC: int __db_panic __P((DB *)); + */ +int +__db_panic(dbp) + DB *dbp; +{ + /* + * XXX + * We should shut down all of the process's cursors, too. + * + * We should call mpool and have it shut down the file, so we get + * other processes sharing this file as well. + * + * Chaos reigns within. + * Reflect, repent, and reboot. + * Order shall return. + */ + dbp->cursor = __db_ecursor; + dbp->del = __db_edel; + dbp->fd = __db_efd; + dbp->get = __db_egp; + dbp->put = __db_egp; + dbp->stat = __db_estat; + dbp->sync = __db_esync; + + return (EPERM); +} + +/* Check for invalid flags. */ +#undef DB_CHECK_FLAGS +#define DB_CHECK_FLAGS(dbenv, name, flags, ok_flags) \ + if ((flags) & ~(ok_flags)) \ + return (__db_ferr(dbenv, name, 0)); +/* Check for invalid flag combinations. */ +#undef DB_CHECK_FCOMBO +#define DB_CHECK_FCOMBO(dbenv, name, flags, flag1, flag2) \ + if ((flags) & (flag1) && (flags) & (flag2)) \ + return (__db_ferr(dbenv, name, 1)); + +/* + * __db_fchk -- + * General flags checking routine. + * + * PUBLIC: int __db_fchk __P((DB_ENV *, const char *, u_int32_t, u_int32_t)); + */ +int +__db_fchk(dbenv, name, flags, ok_flags) + DB_ENV *dbenv; + const char *name; + u_int32_t flags, ok_flags; +{ + DB_CHECK_FLAGS(dbenv, name, flags, ok_flags); + return (0); +} + +/* + * __db_fcchk -- + * General combination flags checking routine. + * + * PUBLIC: int __db_fcchk + * PUBLIC: __P((DB_ENV *, const char *, u_int32_t, u_int32_t, u_int32_t)); + */ +int +__db_fcchk(dbenv, name, flags, flag1, flag2) + DB_ENV *dbenv; + const char *name; + u_int32_t flags, flag1, flag2; +{ + DB_CHECK_FCOMBO(dbenv, name, flags, flag1, flag2); + return (0); +} + +/* + * __db_cdelchk -- + * Common cursor delete argument checking routine. + * + * PUBLIC: int __db_cdelchk __P((const DB *, u_int32_t, int, int)); + */ +int +__db_cdelchk(dbp, flags, isrdonly, isvalid) + const DB *dbp; + u_int32_t flags; + int isrdonly, isvalid; +{ + /* Check for changes to a read-only tree. */ + if (isrdonly) + return (__db_rdonly(dbp->dbenv, "c_del")); + + /* Check for invalid dbc->c_del() function flags. */ + DB_CHECK_FLAGS(dbp->dbenv, "c_del", flags, 0); + + /* + * The cursor must be initialized, return -1 for an invalid cursor, + * otherwise 0. + */ + return (isvalid ? 0 : EINVAL); +} + +/* + * __db_cgetchk -- + * Common cursor get argument checking routine. + * + * PUBLIC: int __db_cgetchk __P((const DB *, DBT *, DBT *, u_int32_t, int)); + */ +int +__db_cgetchk(dbp, key, data, flags, isvalid) + const DB *dbp; + DBT *key, *data; + u_int32_t flags; + int isvalid; +{ + int key_einval, key_flags; + + key_flags = key_einval = 0; + + /* Check for invalid dbc->c_get() function flags. */ + switch (flags) { + case DB_CURRENT: + case DB_FIRST: + case DB_LAST: + case DB_NEXT: + case DB_PREV: + key_flags = 1; + break; + case DB_SET_RANGE: + key_einval = key_flags = 1; + break; + case DB_SET: + key_einval = 1; + break; + case DB_GET_RECNO: + if (!F_ISSET(dbp, DB_BT_RECNUM)) + goto err; + break; + case DB_SET_RECNO: + if (!F_ISSET(dbp, DB_BT_RECNUM)) + goto err; + key_einval = key_flags = 1; + break; + default: +err: return (__db_ferr(dbp->dbenv, "c_get", 0)); + } + + /* Check for invalid key/data flags. */ + if (key_flags) + DB_CHECK_FLAGS(dbp->dbenv, "key", key->flags, + DB_DBT_MALLOC | DB_DBT_USERMEM | DB_DBT_PARTIAL); + DB_CHECK_FLAGS(dbp->dbenv, "data", data->flags, + DB_DBT_MALLOC | DB_DBT_USERMEM | DB_DBT_PARTIAL); + + /* Check dbt's for valid flags when multi-threaded. */ + if (F_ISSET(dbp, DB_AM_THREAD)) { + if (!F_ISSET(data, DB_DBT_USERMEM | DB_DBT_MALLOC)) + return (__db_ferr(dbp->dbenv, "threaded data", 1)); + if (key_flags && + !F_ISSET(key, DB_DBT_USERMEM | DB_DBT_MALLOC)) + return (__db_ferr(dbp->dbenv, "threaded key", 1)); + } + + /* Check for missing keys. */ + if (key_einval && (key->data == NULL || key->size == 0)) + return (__db_keyempty(dbp->dbenv)); + + /* + * The cursor must be initialized for DB_CURRENT, return -1 for an + * invalid cursor, otherwise 0. + */ + return (isvalid || flags != DB_CURRENT ? 0 : EINVAL); +} + +/* + * __db_cputchk -- + * Common cursor put argument checking routine. + * + * PUBLIC: int __db_cputchk __P((const DB *, + * PUBLIC: const DBT *, DBT *, u_int32_t, int, int)); + */ +int +__db_cputchk(dbp, key, data, flags, isrdonly, isvalid) + const DB *dbp; + const DBT *key; + DBT *data; + u_int32_t flags; + int isrdonly, isvalid; +{ + int key_einval, key_flags; + + /* Check for changes to a read-only tree. */ + if (isrdonly) + return (__db_rdonly(dbp->dbenv, "c_put")); + + /* Check for invalid dbc->c_put() function flags. */ + key_einval = key_flags = 0; + switch (flags) { + case DB_AFTER: + case DB_BEFORE: + if (dbp->type == DB_RECNO && !F_ISSET(dbp, DB_RE_RENUMBER)) + goto err; + if (dbp->type != DB_RECNO && !F_ISSET(dbp, DB_AM_DUP)) + goto err; + break; + case DB_CURRENT: + break; + case DB_KEYFIRST: + case DB_KEYLAST: + if (dbp->type == DB_RECNO) + goto err; + key_einval = key_flags = 1; + break; + default: +err: return (__db_ferr(dbp->dbenv, "c_put", 0)); + } + + /* Check for invalid key/data flags. */ + if (key_flags) + DB_CHECK_FLAGS(dbp->dbenv, "key", key->flags, + DB_DBT_MALLOC | DB_DBT_USERMEM | DB_DBT_PARTIAL); + DB_CHECK_FLAGS(dbp->dbenv, "data", data->flags, + DB_DBT_MALLOC | DB_DBT_USERMEM | DB_DBT_PARTIAL); + + /* Check for missing keys. */ + if (key_einval && (key->data == NULL || key->size == 0)) + return (__db_keyempty(dbp->dbenv)); + + /* + * The cursor must be initialized for anything other than DB_KEYFIRST + * and DB_KEYLAST, return -1 for an invalid cursor, otherwise 0. + */ + return (isvalid || + (flags != DB_KEYFIRST && flags != DB_KEYLAST) ? 0 : EINVAL); +} + +/* + * __db_delchk -- + * Common delete argument checking routine. + * + * PUBLIC: int __db_delchk __P((const DB *, DBT *, u_int32_t, int)); + */ +int +__db_delchk(dbp, key, flags, isrdonly) + const DB *dbp; + DBT *key; + u_int32_t flags; + int isrdonly; +{ + /* Check for changes to a read-only tree. */ + if (isrdonly) + return (__db_rdonly(dbp->dbenv, "delete")); + + /* Check for invalid db->del() function flags. */ + DB_CHECK_FLAGS(dbp->dbenv, "delete", flags, 0); + + /* Check for missing keys. */ + if (key->data == NULL || key->size == 0) + return (__db_keyempty(dbp->dbenv)); + + return (0); +} + +/* + * __db_getchk -- + * Common get argument checking routine. + * + * PUBLIC: int __db_getchk __P((const DB *, const DBT *, DBT *, u_int32_t)); + */ +int +__db_getchk(dbp, key, data, flags) + const DB *dbp; + const DBT *key; + DBT *data; + u_int32_t flags; +{ + /* Check for invalid db->get() function flags. */ + DB_CHECK_FLAGS(dbp->dbenv, + "get", flags, F_ISSET(dbp, DB_BT_RECNUM) ? DB_SET_RECNO : 0); + + /* Check for invalid key/data flags. */ + DB_CHECK_FLAGS(dbp->dbenv, "key", key->flags, 0); + DB_CHECK_FLAGS(dbp->dbenv, "data", data->flags, + DB_DBT_MALLOC | DB_DBT_USERMEM | DB_DBT_PARTIAL); + DB_CHECK_FCOMBO(dbp->dbenv, + "data", data->flags, DB_DBT_MALLOC, DB_DBT_USERMEM); + if (F_ISSET(dbp, DB_AM_THREAD) && + !F_ISSET(data, DB_DBT_MALLOC | DB_DBT_USERMEM)) + return (__db_ferr(dbp->dbenv, "threaded data", 1)); + + /* Check for missing keys. */ + if (key->data == NULL || key->size == 0) + return (__db_keyempty(dbp->dbenv)); + + return (0); +} + +/* + * __db_putchk -- + * Common put argument checking routine. + * + * PUBLIC: int __db_putchk + * PUBLIC: __P((const DB *, DBT *, const DBT *, u_int32_t, int, int)); + */ +int +__db_putchk(dbp, key, data, flags, isrdonly, isdup) + const DB *dbp; + DBT *key; + const DBT *data; + u_int32_t flags; + int isrdonly, isdup; +{ + /* Check for changes to a read-only tree. */ + if (isrdonly) + return (__db_rdonly(dbp->dbenv, "put")); + + /* Check for invalid db->put() function flags. */ + DB_CHECK_FLAGS(dbp->dbenv, "put", flags, + DB_NOOVERWRITE | (dbp->type == DB_RECNO ? DB_APPEND : 0)); + + /* Check for invalid key/data flags. */ + DB_CHECK_FLAGS(dbp->dbenv, "key", key->flags, 0); + DB_CHECK_FLAGS(dbp->dbenv, "data", data->flags, + DB_DBT_MALLOC | DB_DBT_USERMEM | DB_DBT_PARTIAL); + DB_CHECK_FCOMBO(dbp->dbenv, + "data", data->flags, DB_DBT_MALLOC, DB_DBT_USERMEM); + + /* Check for missing keys. */ + if (key->data == NULL || key->size == 0) + return (__db_keyempty(dbp->dbenv)); + + /* Check for partial puts in the presence of duplicates. */ + if (isdup && F_ISSET(data, DB_DBT_PARTIAL)) { + __db_err(dbp->dbenv, +"a partial put in the presence of duplicates requires a cursor operation"); + return (EINVAL); + } + + return (0); +} + +/* + * __db_statchk -- + * Common stat argument checking routine. + * + * PUBLIC: int __db_statchk __P((const DB *, u_int32_t)); + */ +int +__db_statchk(dbp, flags) + const DB *dbp; + u_int32_t flags; +{ + /* Check for invalid db->stat() function flags. */ + DB_CHECK_FLAGS(dbp->dbenv, "stat", flags, DB_RECORDCOUNT); + + if (LF_ISSET(DB_RECORDCOUNT) && + dbp->type == DB_BTREE && !F_ISSET(dbp, DB_BT_RECNUM)) + return (__db_ferr(dbp->dbenv, "stat", 0)); + + return (0); +} + +/* + * __db_syncchk -- + * Common sync argument checking routine. + * + * PUBLIC: int __db_syncchk __P((const DB *, u_int32_t)); + */ +int +__db_syncchk(dbp, flags) + const DB *dbp; + u_int32_t flags; +{ + /* Check for invalid db->sync() function flags. */ + DB_CHECK_FLAGS(dbp->dbenv, "sync", flags, 0); + + return (0); +} + +/* + * __db_ferr -- + * Common flag errors. + * + * PUBLIC: int __db_ferr __P((const DB_ENV *, const char *, int)); + */ +int +__db_ferr(dbenv, name, iscombo) + const DB_ENV *dbenv; + const char *name; + int iscombo; +{ + __db_err(dbenv, "illegal flag %sspecified to %s", + iscombo ? "combination " : "", name); + return (EINVAL); +} + +/* + * __db_rdonly -- + * Common readonly message. + */ +static int +__db_rdonly(dbenv, name) + const DB_ENV *dbenv; + const char *name; +{ + __db_err(dbenv, "%s: attempt to modify a read-only tree", name); + return (EACCES); +} + +/* + * __db_keyempty -- + * Common missing or empty key value message. + */ +static int +__db_keyempty(dbenv) + const DB_ENV *dbenv; +{ + __db_err(dbenv, "missing or empty key value specified"); + return (EINVAL); +} diff --git a/mozilla/db/common/db_log2.c b/mozilla/db/common/db_log2.c new file mode 100644 index 00000000000..d6b14f540b7 --- /dev/null +++ b/mozilla/db/common/db_log2.c @@ -0,0 +1,69 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1995, 1996 + * 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. 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)db_log2.c 10.5 (Sleepycat) 4/26/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#endif + +#include "db_int.h" +#include "common_ext.h" + +/* + * PUBLIC: u_int32_t __db_log2 __P((u_int32_t)); + */ +u_int32_t +__db_log2(num) + u_int32_t num; +{ + u_int32_t i, limit; + + limit = 1; + for (i = 0; limit < num; limit = limit << 1, i++) + ; + return (i); +} diff --git a/mozilla/db/common/db_region.c b/mozilla/db/common/db_region.c new file mode 100644 index 00000000000..6d15f7f092e --- /dev/null +++ b/mozilla/db/common/db_region.c @@ -0,0 +1,861 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)db_region.c 10.46 (Sleepycat) 5/26/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#endif + +#include "db_int.h" +#include "common_ext.h" + +static int __db_growregion __P((REGINFO *, size_t)); + +/* + * __db_rattach -- + * Optionally create and attach to a shared memory region. + * + * PUBLIC: int __db_rattach __P((REGINFO *)); + */ +int +__db_rattach(infop) + REGINFO *infop; +{ + RLAYOUT *rlp, rl; + size_t grow_region, size; + ssize_t nr, nw; + u_int32_t flags, mbytes, bytes; + u_int8_t *p; + int malloc_possible, ret, retry_cnt; + + grow_region = 0; + malloc_possible = 1; + ret = retry_cnt = 0; + + /* Round off the requested size to the next page boundary. */ + DB_ROUNDOFF(infop->size); + + /* Some architectures have hard limits on the maximum region size. */ +#ifdef DB_REGIONSIZE_MAX + if (infop->size > DB_REGIONSIZE_MAX) { + __db_err(infop->dbenv, "__db_rattach: cache size too large"); + return (EINVAL); + } +#endif + + /* Intialize the return information in the REGINFO structure. */ +loop: infop->addr = NULL; + infop->fd = -1; + infop->segid = INVALID_SEGID; + if (infop->name != NULL) { + FREES(infop->name); + infop->name = NULL; + } + F_CLR(infop, REGION_CANGROW | REGION_CREATED); + +#ifndef HAVE_SPINLOCKS + /* + * XXX + * Lacking spinlocks, we must have a file descriptor for fcntl(2) + * locking, which implies using mmap(2) to map in a regular file. + * (Theoretically, we could probably get a file descriptor to lock + * other types of shared regions, but I don't see any reason to + * bother.) + */ + malloc_possible = 0; +#endif + +#ifdef __hppa + /* + * XXX + * HP-UX won't permit mutexes to live in anything but shared memory. + * Instantiate a shared region file on that architecture, regardless. + */ + malloc_possible = 0; +#endif + /* + * If a region is truly private, malloc the memory. That's faster + * than either anonymous memory or a shared file. + */ + if (malloc_possible && F_ISSET(infop, REGION_PRIVATE)) { + if ((infop->addr = __db_malloc(infop->size)) == NULL) + return (ENOMEM); + + /* + * It's sometimes significantly faster to page-fault in all + * of the region's pages before we run the application, as + * we can see fairly nasty side-effects when we page-fault + * while holding various locks, i.e., the lock takes a long + * time, and other threads convoy behind the lock holder. + */ + if (DB_GLOBAL(db_region_init)) + for (p = infop->addr; + p < (u_int8_t *)infop->addr + infop->size; + p += DB_VMPAGESIZE) + p[0] = '\0'; + + F_SET(infop, REGION_CREATED | REGION_MALLOC); + goto region_init; + } + + /* + * Get the name of the region (creating the file if a temporary file + * is being used). The dbenv contains the current DB environment, + * including naming information. The path argument may be a file or + * a directory. If path is a directory, it must exist and file is the + * file name to be created inside the directory. If path is a file, + * then file must be NULL. + */ + if ((ret = __db_appname(infop->dbenv, infop->appname, infop->path, + infop->file, infop->dbflags, &infop->fd, &infop->name)) != 0) + return (ret); + if (infop->fd != -1) + F_SET(infop, REGION_CREATED); + + /* + * Try to create the file, if we have authority. We have to make sure + * that multiple threads/processes attempting to simultaneously create + * the region are properly ordered, so we open it using DB_CREATE and + * DB_EXCL, so two attempts to create the region will return failure in + * one. + */ + if (infop->fd == -1 && infop->dbflags & DB_CREATE) { + flags = infop->dbflags; + LF_SET(DB_EXCL); + if ((ret = __db_open(infop->name, + flags, flags, infop->mode, &infop->fd)) == 0) + F_SET(infop, REGION_CREATED); + else + if (ret != EEXIST) + goto errmsg; + } + + /* If we couldn't create the file, try and open it. */ + if (infop->fd == -1) { + flags = infop->dbflags; + LF_CLR(DB_CREATE | DB_EXCL); + if ((ret = __db_open(infop->name, + flags, flags, infop->mode, &infop->fd)) != 0) + goto errmsg; + } + + /* + * There are three cases we support: + * 1. Named anonymous memory (shmget(2)). + * 2. Unnamed anonymous memory (mmap(2): MAP_ANON/MAP_ANONYMOUS). + * 3. Memory backed by a regular file (mmap(2)). + * + * We instantiate a backing file in all cases, which contains at least + * the RLAYOUT structure, and in case #4, contains the actual region. + * This is necessary for a couple of reasons: + * + * First, the mpool region uses temporary files to name regions, and + * since you may have multiple regions in the same directory, we need + * a filesystem name to ensure that they don't collide. + * + * Second, applications are allowed to forcibly remove regions, even + * if they don't know anything about them other than the name. If a + * region is backed by anonymous memory, there has to be some way for + * the application to find out that information, and, in some cases, + * determine ID information for the anonymous memory. + */ + if (F_ISSET(infop, REGION_CREATED)) { + /* + * If we're using anonymous memory to back this region, set + * the flag. + */ + if (DB_GLOBAL(db_region_anon)) + F_SET(infop, REGION_ANONYMOUS); + + /* + * If we're using a regular file to back a region we created, + * grow it to the specified size. + */ + if (!DB_GLOBAL(db_region_anon) && + (ret = __db_growregion(infop, infop->size)) != 0) + goto err; + } else { + /* + * If we're joining a region, figure out what it looks like. + * + * XXX + * We have to figure out if the file is a regular file backing + * a region that we want to map into our address space, or a + * file with the information we need to find a shared anonymous + * region that we want to map into our address space. + * + * All this noise is because some systems don't have a coherent + * VM and buffer cache, and worse, if you mix operations on the + * VM and buffer cache, half the time you hang the system. + * + * There are two possibilities. If the file is the size of an + * RLAYOUT structure, then we know that the real region is in + * shared memory, because otherwise it would be bigger. (As + * the RLAYOUT structure size is smaller than a disk sector, + * the only way it can be this size is if deliberately written + * that way.) In which case, retrieve the information we need + * from the RLAYOUT structure and use it to acquire the shared + * memory. + * + * If the structure is larger than an RLAYOUT structure, then + * the file is backing the shared memory region, and we use + * the current size of the file without reading any information + * from the file itself so that we don't confuse the VM. + * + * And yes, this makes me want to take somebody and kill them, + * but I can't think of any other solution. + */ + if ((ret = __db_ioinfo(infop->name, + infop->fd, &mbytes, &bytes, NULL)) != 0) + goto errmsg; + size = mbytes * MEGABYTE + bytes; + + if (size <= sizeof(RLAYOUT)) { + /* + * If the size is too small, the read fails or the + * valid flag is incorrect, assume it's because the + * RLAYOUT information hasn't been written out yet, + * and retry. + */ + if (size < sizeof(RLAYOUT)) + goto retry; + if ((ret = + __db_read(infop->fd, &rl, sizeof(rl), &nr)) != 0) + goto retry; + if (rl.valid != DB_REGIONMAGIC) + goto retry; + + /* Copy the size, memory id and characteristics. */ + size = rl.size; + infop->segid = rl.segid; + if (F_ISSET(&rl, REGION_ANONYMOUS)) + F_SET(infop, REGION_ANONYMOUS); + } + + /* + * If the region is larger than we think, that's okay, use the + * current size. If it's smaller than we think, and we were + * just using the default size, that's okay, use the current + * size. If it's smaller than we think and we really care, + * save the size and we'll catch that further down -- we can't + * correct it here because we have to have a lock to grow the + * region. + */ + if (infop->size > size && !F_ISSET(infop, REGION_SIZEDEF)) + grow_region = infop->size; + infop->size = size; + } + + /* + * Map the region into our address space. If we're creating it, the + * underlying routines will make it the right size. + * + * There are at least two cases where we can "reasonably" fail when + * we attempt to map in the region. On Windows/95, closing the last + * reference to a region causes it to be zeroed out. On UNIX, when + * using the shmget(2) interfaces, the region will no longer exist + * if the system was rebooted. In these cases, the underlying map call + * returns EAGAIN, and we *remove* our file and try again. There are + * obvious races in doing this, but it should eventually settle down + * to a winner and then things should proceed normally. + */ + if ((ret = __db_mapregion(infop->name, infop)) != 0) + if (ret == EAGAIN) { + /* + * Pretend we created the region even if we didn't so + * that our error processing unlinks it. + */ + F_SET(infop, REGION_CREATED); + ret = 0; + goto retry; + } else + goto err; + +region_init: + /* + * Initialize the common region information. + * + * !!! + * We have to order the region creates so that two processes don't try + * to simultaneously create the region. This is handled by using the + * DB_CREATE and DB_EXCL flags when we create the "backing" region file. + * + * We also have to order region joins so that processes joining regions + * never see inconsistent data. We'd like to play permissions games + * with the backing file, but we can't because WNT filesystems won't + * open a file mode 0. + */ + rlp = (RLAYOUT *)infop->addr; + if (F_ISSET(infop, REGION_CREATED)) { + /* + * The process creating the region acquires a lock before it + * sets the valid flag. Any processes joining the region will + * check the valid flag before acquiring the lock. + * + * Check the return of __db_mutex_init() and __db_mutex_lock(), + * even though we don't usually check elsewhere. This is the + * first lock we initialize and acquire, and we have to know if + * it fails. (It CAN fail, e.g., SunOS, when using fcntl(2) + * for locking, with an in-memory filesystem specified as the + * database home.) + */ + if ((ret = __db_mutex_init(&rlp->lock, + MUTEX_LOCK_OFFSET(rlp, &rlp->lock))) != 0 || + (ret = __db_mutex_lock(&rlp->lock, infop->fd)) != 0) + goto err; + + /* Initialize the remaining region information. */ + rlp->refcnt = 1; + rlp->size = infop->size; + db_version(&rlp->majver, &rlp->minver, &rlp->patch); + rlp->segid = infop->segid; + rlp->flags = 0; + if (F_ISSET(infop, REGION_ANONYMOUS)) + F_SET(rlp, REGION_ANONYMOUS); + + /* + * Fill in the valid field last -- use a magic number, memory + * may not be zero-filled, and we want to minimize the chance + * for collision. + */ + rlp->valid = DB_REGIONMAGIC; + + /* + * If the region is anonymous, write the RLAYOUT information + * into the backing file so that future region join and unlink + * calls can find it. + * + * XXX + * We MUST do the seek before we do the write. On Win95, while + * closing the last reference to an anonymous shared region + * doesn't discard the region, it does zero it out. So, the + * REGION_CREATED may be set, but the file may have already + * been written and the file descriptor may be at the end of + * the file. + */ + if (F_ISSET(infop, REGION_ANONYMOUS)) { + if ((ret = __db_seek(infop->fd, 0, 0, 0, 0, 0)) != 0) + goto err; + if ((ret = + __db_write(infop->fd, rlp, sizeof(*rlp), &nw)) != 0) + goto err; + } + } else { + /* + * Check the valid flag to ensure the region is initialized. + * If the valid flag has not been set, the mutex may not have + * been initialized, and an attempt to get it could lead to + * random behavior. + */ + if (rlp->valid != DB_REGIONMAGIC) + goto retry; + + /* Get the region lock. */ + (void)__db_mutex_lock(&rlp->lock, infop->fd); + + /* + * We now own the region. There are a couple of things that + * may have gone wrong, however. + * + * Problem #1: while we were waiting for the lock, the region + * was deleted. Detected by re-checking the valid flag, since + * it's cleared by the delete region routines. + */ + if (rlp->valid != DB_REGIONMAGIC) { + (void)__db_mutex_unlock(&rlp->lock, infop->fd); + goto retry; + } + + /* + * Problem #2: We want a bigger region than has previously been + * created. Detected by checking if the region is smaller than + * our caller requested. If it is, we grow the region, (which + * does the detach and re-attach for us). + */ + if (grow_region != 0 && + (ret = __db_rgrow(infop, grow_region)) != 0) { + (void)__db_mutex_unlock(&rlp->lock, infop->fd); + goto err; + } + + /* + * Problem #3: when we checked the size of the file, it was + * still growing as part of creation. Detected by the fact + * that infop->size isn't the same size as the region. + */ + if (infop->size != rlp->size) { + (void)__db_mutex_unlock(&rlp->lock, infop->fd); + goto retry; + } + + /* Increment the reference count. */ + ++rlp->refcnt; + } + + /* Return the region in a locked condition. */ + + if (0) { +errmsg: __db_err(infop->dbenv, "%s: %s", infop->name, strerror(ret)); + +err: +retry: /* Discard the region. */ + if (infop->addr != NULL) { + (void)__db_unmapregion(infop); + infop->addr = NULL; + } + + /* Discard the backing file. */ + if (infop->fd != -1) { + (void)__db_close(infop->fd); + infop->fd = -1; + + if (F_ISSET(infop, REGION_CREATED)) + (void)__db_unlink(infop->name); + } + + /* Discard the name. */ + if (infop->name != NULL) { + FREES(infop->name); + infop->name = NULL; + } + + /* + * If we had a temporary error, wait a few seconds and + * try again. + */ + if (ret == 0) { + if (++retry_cnt <= 3) { + __db_sleep(retry_cnt * 2, 0); + goto loop; + } + ret = EAGAIN; + } + } + + /* + * XXX + * HP-UX won't permit mutexes to live in anything but shared memory. + * Instantiate a shared region file on that architecture, regardless. + * + * XXX + * There's a problem in cleaning this up on application exit, or on + * application failure. If an application opens a database without + * an environment, we create a temporary backing mpool region for it. + * That region is marked REGION_PRIVATE, but as HP-UX won't permit + * mutexes to live in anything but shared memory, we instantiate a + * real file plus a memory region of some form. If the application + * crashes, the necessary information to delete the backing file and + * any system region (e.g., the shmget(2) segment ID) is no longer + * available. We can't completely fix the problem, but we try. + * + * The underlying UNIX __db_mapregion() code preferentially uses the + * mmap(2) interface with the MAP_ANON/MAP_ANONYMOUS flags for regions + * that are marked REGION_PRIVATE. This means that we normally aren't + * holding any system resources when we get here, in which case we can + * delete the backing file. This results in a short race, from the + * __db_open() call above to here. + * + * If, for some reason, we are holding system resources when we get + * here, we don't have any choice -- we can't delete the backing file + * because we may need it to detach from the resources. Set the + * REGION_LASTDETACH flag, so that we do all necessary cleanup when + * the application closes the region. + */ + if (F_ISSET(infop, REGION_PRIVATE) && !F_ISSET(infop, REGION_MALLOC)) + if (F_ISSET(infop, REGION_HOLDINGSYS)) + F_SET(infop, REGION_LASTDETACH); + else { + F_SET(infop, REGION_REMOVED); + F_CLR(infop, REGION_CANGROW); + + (void)__db_close(infop->fd); + (void)__db_unlink(infop->name); + } + + return (ret); +} + +/* + * __db_rdetach -- + * De-attach from a shared memory region. + * + * PUBLIC: int __db_rdetach __P((REGINFO *)); + */ +int +__db_rdetach(infop) + REGINFO *infop; +{ + RLAYOUT *rlp; + int detach, ret, t_ret; + + ret = 0; + + /* + * If the region was removed when it was created, no further action + * is required. + */ + if (F_ISSET(infop, REGION_REMOVED)) + goto done; + /* + * If the region was created in memory returned by malloc, the only + * action required is freeing the memory. + */ + if (F_ISSET(infop, REGION_MALLOC)) { + __db_free(infop->addr); + goto done; + } + + /* Otherwise, attach to the region and optionally delete it. */ + rlp = infop->addr; + + /* Get the lock. */ + (void)__db_mutex_lock(&rlp->lock, infop->fd); + + /* Decrement the reference count. */ + if (rlp->refcnt == 0) + __db_err(infop->dbenv, + "region rdetach: reference count went to zero!"); + else + --rlp->refcnt; + + /* + * If we're going to remove the region, clear the valid flag so + * that any region join that's blocked waiting for us will know + * what happened. + */ + detach = 0; + if (F_ISSET(infop, REGION_LASTDETACH)) + if (rlp->refcnt == 0) { + detach = 1; + rlp->valid = 0; + } else + ret = EBUSY; + + /* Release the lock. */ + (void)__db_mutex_unlock(&rlp->lock, infop->fd); + + /* Close the backing file descriptor. */ + (void)__db_close(infop->fd); + infop->fd = -1; + + /* Discard our mapping of the region. */ + if ((t_ret = __db_unmapregion(infop)) != 0 && ret == 0) + ret = t_ret; + + /* Discard the region itself. */ + if (detach) { + if ((t_ret = + __db_unlinkregion(infop->name, infop) != 0) && ret == 0) + ret = t_ret; + if ((t_ret = __db_unlink(infop->name) != 0) && ret == 0) + ret = t_ret; + } + +done: /* Discard the name. */ + if (infop->name != NULL) { + FREES(infop->name); + infop->name = NULL; + } + + return (ret); +} + +/* + * __db_runlink -- + * Remove a region. + * + * PUBLIC: int __db_runlink __P((REGINFO *, int)); + */ +int +__db_runlink(infop, force) + REGINFO *infop; + int force; +{ + RLAYOUT rl, *rlp; + size_t size; + ssize_t nr; + u_int32_t mbytes, bytes; + int fd, ret, t_ret; + char *name; + + /* + * XXX + * We assume that we've created a new REGINFO structure for this + * call, not used one that was already initialized. Regardless, + * if anyone is planning to use it after we're done, they're going + * to be sorely disappointed. + * + * If force isn't set, we attach to the region, set a flag to delete + * the region on last close, and let the region delete code do the + * work. + */ + if (!force) { + if ((ret = __db_rattach(infop)) != 0) + return (ret); + + rlp = (RLAYOUT *)infop->addr; + (void)__db_mutex_unlock(&rlp->lock, infop->fd); + + F_SET(infop, REGION_LASTDETACH); + + return (__db_rdetach(infop)); + } + + /* + * Otherwise, we don't want to attach to the region. We may have been + * called to clean up if a process died leaving a region locked and/or + * corrupted, which could cause the attach to hang. + */ + if ((ret = __db_appname(infop->dbenv, infop->appname, + infop->path, infop->file, infop->dbflags, NULL, &name)) != 0) + return (ret); + + /* + * An underlying file is created for all regions other than private + * (REGION_PRIVATE) ones, regardless of whether or not it's used to + * back the region. If that file doesn't exist, we're done. + */ + if (__db_exists(name, NULL) != 0) { + FREES(name); + return (0); + } + + /* + * See the comments in __db_rattach -- figure out if this is a regular + * file backing a region or if it's a regular file with information + * about a region. + */ + if ((ret = __db_open(name, DB_RDONLY, DB_RDONLY, 0, &fd)) != 0) + goto errmsg; + if ((ret = __db_ioinfo(name, fd, &mbytes, &bytes, NULL)) != 0) + goto errmsg; + size = mbytes * MEGABYTE + bytes; + + if (size <= sizeof(RLAYOUT)) { + if ((ret = __db_read(fd, &rl, sizeof(rl), &nr)) != 0) + goto errmsg; + if (rl.valid != DB_REGIONMAGIC) { + __db_err(infop->dbenv, + "%s: illegal region magic number", name); + ret = EINVAL; + goto err; + } + + /* Set the size, memory id and characteristics. */ + infop->size = rl.size; + infop->segid = rl.segid; + if (F_ISSET(&rl, REGION_ANONYMOUS)) + F_SET(infop, REGION_ANONYMOUS); + } else { + infop->size = size; + infop->segid = INVALID_SEGID; + } + + /* Remove the underlying region. */ + ret = __db_unlinkregion(name, infop); + + /* + * Unlink the backing file. Close the open file descriptor first, + * because some architectures (e.g., Win32) won't unlink a file if + * open file descriptors remain. + */ + (void)__db_close(fd); + if ((t_ret = __db_unlink(name)) != 0 && ret == 0) + ret = t_ret; + + if (0) { +errmsg: __db_err(infop->dbenv, "%s: %s", name, strerror(ret)); +err: (void)__db_close(fd); + } + + FREES(name); + return (ret); +} + +/* + * __db_rgrow -- + * Extend a region. + * + * PUBLIC: int __db_rgrow __P((REGINFO *, size_t)); + */ +int +__db_rgrow(infop, new_size) + REGINFO *infop; + size_t new_size; +{ + RLAYOUT *rlp; + size_t increment; + int ret; + + /* + * !!! + * This routine MUST be called with the region already locked. + */ + + /* The underlying routines have flagged if this region can grow. */ + if (!F_ISSET(infop, REGION_CANGROW)) + return (EINVAL); + + /* + * Round off the requested size to the next page boundary, and + * determine the additional space required. + */ + rlp = (RLAYOUT *)infop->addr; + DB_ROUNDOFF(new_size); + increment = new_size - rlp->size; + + if ((ret = __db_growregion(infop, increment)) != 0) + return (ret); + + /* Update the on-disk region size. */ + rlp->size = new_size; + + /* Detach from and reattach to the region. */ + return (__db_rreattach(infop, new_size)); +} + +/* + * __db_growregion -- + * Grow a shared memory region. + */ +static int +__db_growregion(infop, increment) + REGINFO *infop; + size_t increment; +{ + db_pgno_t pages; + size_t i; + ssize_t nr, nw; + u_int32_t relative; + int ret; + char buf[DB_VMPAGESIZE]; + + /* Seek to the end of the region. */ + if ((ret = __db_seek(infop->fd, 0, 0, 0, 0, SEEK_END)) != 0) + goto err; + + /* Write nuls to the new bytes. */ + memset(buf, 0, sizeof(buf)); + + /* + * Some systems require that all of the bytes of the region be + * written before it can be mapped and accessed randomly, and + * other systems don't zero out the pages. + */ + if (__db_mapinit()) + /* Extend the region by writing each new page. */ + for (i = 0; i < increment; i += DB_VMPAGESIZE) { + if ((ret = + __db_write(infop->fd, buf, sizeof(buf), &nw)) != 0) + goto err; + if (nw != sizeof(buf)) + goto eio; + } + else { + /* + * 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). + */ + pages = (increment - DB_VMPAGESIZE) / MEGABYTE; + relative = (increment - DB_VMPAGESIZE) % MEGABYTE; + if ((ret = __db_seek(infop->fd, + MEGABYTE, pages, relative, 0, SEEK_CUR)) != 0) + goto err; + if ((ret = __db_write(infop->fd, buf, sizeof(buf), &nw)) != 0) + goto err; + if (nw != sizeof(buf)) + goto eio; + + /* + * It's sometimes significantly faster to page-fault in all + * of the region's pages before we run the application, as + * we can see fairly nasty side-effects when we page-fault + * while holding various locks, i.e., the lock takes a long + * time, and other threads convoy behind the lock holder. + */ + if (DB_GLOBAL(db_region_init)) { + pages = increment / MEGABYTE; + relative = increment % MEGABYTE; + if ((ret = __db_seek(infop->fd, + MEGABYTE, pages, relative, 1, SEEK_END)) != 0) + goto err; + + /* Read a byte from each page. */ + for (i = 0; i < increment; i += DB_VMPAGESIZE) { + if ((ret = + __db_read(infop->fd, buf, 1, &nr)) != 0) + goto err; + if (nr != 1) + goto eio; + if ((ret = __db_seek(infop->fd, + 0, 0, DB_VMPAGESIZE - 1, 0, SEEK_CUR)) != 0) + goto err; + } + } + } + return (0); + +eio: ret = EIO; +err: __db_err(infop->dbenv, "region grow: %s", strerror(ret)); + return (ret); +} + +/* + * __db_rreattach -- + * Detach from and reattach to a region. + * + * PUBLIC: int __db_rreattach __P((REGINFO *, size_t)); + */ +int +__db_rreattach(infop, new_size) + REGINFO *infop; + size_t new_size; +{ + int ret; + +#ifdef DIAGNOSTIC + if (infop->name == NULL) { + __db_err(infop->dbenv, "__db_rreattach: name was NULL"); + return (EINVAL); + } +#endif + /* + * If we're growing an already mapped region, we have to unmap it + * and get it back. We have it locked, so nobody else can get in, + * which makes it fairly straight-forward to do, as everybody else + * is going to block while we do the unmap/remap. NB: if we fail + * to get it back, the pooch is genuinely screwed, because we can + * never release the lock we're holding. + * + * Detach from the region. We have to do this first so architectures + * that don't permit a file to be mapped into different places in the + * address space simultaneously, e.g., HP's PaRisc, will work. + */ + if ((ret = __db_unmapregion(infop)) != 0) + return (ret); + + /* Update the caller's REGINFO size to the new map size. */ + infop->size = new_size; + + /* Attach to the region. */ + ret = __db_mapregion(infop->name, infop); + + return (ret); +} diff --git a/mozilla/db/common/db_salloc.c b/mozilla/db/common/db_salloc.c new file mode 100644 index 00000000000..0fa696bf7eb --- /dev/null +++ b/mozilla/db/common/db_salloc.c @@ -0,0 +1,301 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)db_salloc.c 10.13 (Sleepycat) 5/10/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "common_ext.h" + +/* + * Implement shared memory region allocation, using simple first-fit algorithm. + * The model is that we take a "chunk" of shared memory store and begin carving + * it up into areas, similarly to how malloc works. We do coalescing on free. + * + * The "len" field in the __data struct contains the length of the free region + * (less the size_t bytes that holds the length). We use the address provided + * by the caller to find this length, which allows us to free a chunk without + * requiring that the caller pass in the length of the chunk they're freeing. + */ +SH_LIST_HEAD(__head); +struct __data { + size_t len; + SH_LIST_ENTRY links; +}; + +/* + * __db_shalloc_init -- + * Initialize the area as one large chunk. + * + * PUBLIC: void __db_shalloc_init __P((void *, size_t)); + */ +void +__db_shalloc_init(area, size) + void *area; + size_t size; +{ + struct __data *elp; + struct __head *hp; + + hp = area; + SH_LIST_INIT(hp); + + elp = (struct __data *)(hp + 1); + elp->len = size - sizeof(struct __head) - sizeof(elp->len); + SH_LIST_INSERT_HEAD(hp, elp, links, __data); +} + +/* + * __db_shalloc -- + * Allocate some space from the shared region. + * + * PUBLIC: int __db_shalloc __P((void *, size_t, size_t, void *)); + */ +int +__db_shalloc(p, len, align, retp) + void *p, *retp; + size_t len, align; +{ + struct __data *elp; + size_t *sp; + void *rp; + + /* + * We never allocate less than the size of a struct __data, align + * to less than a size_t boundary, or align to something that's not + * a multiple of a size_t. + */ + if (len < sizeof(struct __data)) + len = sizeof(struct __data); + align = align <= sizeof(size_t) ? + sizeof(size_t) : ALIGN(align, sizeof(size_t)); + + /* Walk the list, looking for a slot. */ + for (elp = SH_LIST_FIRST((struct __head *)p, __data); + elp != NULL; + elp = SH_LIST_NEXT(elp, links, __data)) { + /* + * Calculate the value of the returned pointer if we were to + * use this chunk. + * + Find the end of the chunk. + * + Subtract the memory the user wants. + * + Find the closest previous correctly-aligned address. + */ + rp = (u_int8_t *)elp + sizeof(size_t) + elp->len; + rp = (u_int8_t *)rp - len; + rp = (u_int8_t *)((ALIGNTYPE)rp & ~(align - 1)); + + /* + * Rp may now point before elp->links, in which case the chunk + * was too small, and we have to try again. + */ + if ((u_int8_t *)rp < (u_int8_t *)&elp->links) + continue; + + *(void **)retp = rp; + +#define SHALLOC_FRAGMENT 32 + /* + * If there are at least SHALLOC_FRAGMENT additional bytes of + * memory, divide the chunk into two chunks. + */ + if ((u_int8_t *)rp >= + (u_int8_t *)&elp->links + SHALLOC_FRAGMENT) { + sp = rp; + *--sp = elp->len - + ((u_int8_t *)rp - (u_int8_t *)&elp->links); + elp->len -= *sp + sizeof(size_t); + return (0); + } + + /* + * Otherwise, we return the entire chunk, wasting some amount + * of space to keep the list compact. However, because the + * address we're returning to the user may not be the address + * of the start of the region for alignment reasons, set the + * size_t length fields back to the "real" length field to a + * flag value, so that we can find the real length during free. + */ +#define ILLEGAL_SIZE 1 + SH_LIST_REMOVE(elp, links, __data); + for (sp = rp; (u_int8_t *)--sp >= (u_int8_t *)&elp->links;) + *sp = ILLEGAL_SIZE; + return (0); + } + + /* Nothing found large enough; need to grow the region. */ + return (ENOMEM); +} + +/* + * __db_shalloc_free -- + * Free a shared memory allocation. + * + * PUBLIC: void __db_shalloc_free __P((void *, void *)); + */ +void +__db_shalloc_free(regionp, ptr) + void *regionp, *ptr; +{ + struct __data *elp, *lastp, *newp; + struct __head *hp; + size_t free_size, *sp; + int merged; + + /* + * Step back over flagged length fields to find the beginning of + * the object and its real size. + */ + for (sp = (size_t *)ptr; sp[-1] == ILLEGAL_SIZE; --sp) + ; + ptr = sp; + + newp = (struct __data *)((u_int8_t *)ptr - sizeof(size_t)); + free_size = newp->len; + + /* Trash the returned memory. */ +#ifdef DIAGNOSTIC + memset(ptr, 0xff, free_size); +#endif + + /* + * Walk the list, looking for where this entry goes. + * + * We keep the free list sorted by address so that coalescing is + * trivial. + * + * XXX + * Probably worth profiling this to see how expensive it is. + */ + hp = (struct __head *)regionp; + for (elp = SH_LIST_FIRST(hp, __data), lastp = NULL; + elp != NULL && (void *)elp < (void *)ptr; + lastp = elp, elp = SH_LIST_NEXT(elp, links, __data)) + ; + + /* + * Elp is either NULL (we reached the end of the list), or the slot + * after the one that's being returned. Lastp is either NULL (we're + * returning the first element of the list) or the element before the + * one being returned. + * + * Check for coalescing with the next element. + */ + merged = 0; + if ((u_int8_t *)ptr + free_size == (u_int8_t *)elp) { + newp->len += elp->len + sizeof(size_t); + SH_LIST_REMOVE(elp, links, __data); + if (lastp != NULL) + SH_LIST_INSERT_AFTER(lastp, newp, links, __data); + else + SH_LIST_INSERT_HEAD(hp, newp, links, __data); + merged = 1; + } + + /* Check for coalescing with the previous element. */ + if (lastp != NULL && (u_int8_t *)lastp + + lastp->len + sizeof(size_t) == (u_int8_t *)newp) { + lastp->len += newp->len + sizeof(size_t); + + /* + * If we have already put the new element into the list take + * it back off again because it's just been merged with the + * previous element. + */ + if (merged) + SH_LIST_REMOVE(newp, links, __data); + merged = 1; + } + + if (!merged) + if (lastp == NULL) + SH_LIST_INSERT_HEAD(hp, newp, links, __data); + else + SH_LIST_INSERT_AFTER(lastp, newp, links, __data); +} + +/* + * __db_shalloc_count -- + * Return the amount of memory on the free list. + * + * PUBLIC: size_t __db_shalloc_count __P((void *)); + */ +size_t +__db_shalloc_count(addr) + void *addr; +{ + struct __data *elp; + size_t count; + + count = 0; + for (elp = SH_LIST_FIRST((struct __head *)addr, __data); + elp != NULL; + elp = SH_LIST_NEXT(elp, links, __data)) + count += elp->len; + + return (count); +} + +/* + * __db_shsizeof -- + * Return the size of a shalloc'd piece of memory. + * + * PUBLIC: size_t __db_shsizeof __P((void *)); + */ +size_t +__db_shsizeof(ptr) + void *ptr; +{ + struct __data *elp; + size_t *sp; + + /* + * Step back over flagged length fields to find the beginning of + * the object and its real size. + */ + for (sp = (size_t *)ptr; sp[-1] == ILLEGAL_SIZE; --sp) + ; + + elp = (struct __data *)((u_int8_t *)sp - sizeof(size_t)); + return (elp->len); +} + +/* + * __db_shalloc_dump -- + * + * PUBLIC: void __db_shalloc_dump __P((void *, FILE *)); + */ +void +__db_shalloc_dump(addr, fp) + void *addr; + FILE *fp; +{ + struct __data *elp; + + /* Make it easy to call from the debugger. */ + if (fp == NULL) + fp = stderr; + + fprintf(fp, "%s\nMemory free list\n", DB_LINE); + + for (elp = SH_LIST_FIRST((struct __head *)addr, __data); + elp != NULL; + elp = SH_LIST_NEXT(elp, links, __data)) + fprintf(fp, "%#lx: %lu\t", (u_long)elp, (u_long)elp->len); + fprintf(fp, "\n"); +} diff --git a/mozilla/db/common/db_shash.c b/mozilla/db/common/db_shash.c new file mode 100644 index 00000000000..3f48a559077 --- /dev/null +++ b/mozilla/db/common/db_shash.c @@ -0,0 +1,126 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)db_shash.c 10.9 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "common_ext.h" + +/* + * Table of good hash values. Up to ~250,000 buckets, we use powers of 2. + * After that, we slow the rate of increase by half. For each choice, we + * then use a nearby prime number as the hash value. + * + * If a terabyte is the maximum cache we'll see, and we assume there are + * 10 1K buckets on each hash chain, then 107374182 is the maximum number + * of buckets we'll ever need. + */ +static const struct { + u_int32_t power; + u_int32_t prime; +} list[] = { + { 64, 67}, /* 2^6 */ + { 128, 131}, /* 2^7 */ + { 256, 257}, /* 2^8 */ + { 512, 521}, /* 2^9 */ + { 1024, 1031}, /* 2^10 */ + { 2048, 2053}, /* 2^11 */ + { 4096, 4099}, /* 2^12 */ + { 8192, 8191}, /* 2^13 */ + { 16384, 16381}, /* 2^14 */ + { 32768, 32771}, /* 2^15 */ + { 65536, 65537}, /* 2^16 */ + { 131072, 131071}, /* 2^17 */ + { 262144, 262147}, /* 2^18 */ + { 393216, 393209}, /* 2^18 + 2^18/2 */ + { 524288, 524287}, /* 2^19 */ + { 786432, 786431}, /* 2^19 + 2^19/2 */ + { 1048576, 1048573}, /* 2^20 */ + { 1572864, 1572869}, /* 2^20 + 2^20/2 */ + { 2097152, 2097169}, /* 2^21 */ + { 3145728, 3145721}, /* 2^21 + 2^21/2 */ + { 4194304, 4194301}, /* 2^22 */ + { 6291456, 6291449}, /* 2^22 + 2^22/2 */ + { 8388608, 8388617}, /* 2^23 */ + { 12582912, 12582917}, /* 2^23 + 2^23/2 */ + { 16777216, 16777213}, /* 2^24 */ + { 25165824, 25165813}, /* 2^24 + 2^24/2 */ + { 33554432, 33554393}, /* 2^25 */ + { 50331648, 50331653}, /* 2^25 + 2^25/2 */ + { 67108864, 67108859}, /* 2^26 */ + { 100663296, 100663291}, /* 2^26 + 2^26/2 */ + { 134217728, 134217757}, /* 2^27 */ + { 201326592, 201326611}, /* 2^27 + 2^27/2 */ + { 268435456, 268435459}, /* 2^28 */ + { 402653184, 402653189}, /* 2^28 + 2^28/2 */ + { 536870912, 536870909}, /* 2^29 */ + { 805306368, 805306357}, /* 2^29 + 2^29/2 */ + {1073741824, 1073741827}, /* 2^30 */ + {0, 0} +}; + +/* + * __db_tablesize -- + * Choose a size for the hash table. + * + * PUBLIC: int __db_tablesize __P((u_int32_t)); + */ +int +__db_tablesize(n_buckets) + u_int32_t n_buckets; +{ + int i; + + /* + * We try to be clever about how big we make the hash tables. Use a + * prime number close to the "suggested" number of elements that will + * be in the hash table. Use 64 as the minimum hash table size. + * + * Ref: Sedgewick, Algorithms in C, "Hash Functions" + */ + if (n_buckets < 64) + n_buckets = 64; + + for (i = 0;; ++i) { + if (list[i].power == 0) { + --i; + break; + } + if (list[i].power >= n_buckets) + break; + } + return (list[i].prime); +} + +/* + * __db_hashinit -- + * Initialize a hash table that resides in shared memory. + * + * PUBLIC: void __db_hashinit __P((void *, u_int32_t)); + */ +void +__db_hashinit(begin, nelements) + void *begin; + u_int32_t nelements; +{ + u_int32_t i; + SH_TAILQ_HEAD(hash_head) *headp; + + headp = (struct hash_head *)begin; + + for (i = 0; i < nelements; i++, headp++) + SH_TAILQ_INIT(headp); +} diff --git a/mozilla/db/cxx/cxx_app.cpp b/mozilla/db/cxx/cxx_app.cpp new file mode 100644 index 00000000000..83f2092b651 --- /dev/null +++ b/mozilla/db/cxx/cxx_app.cpp @@ -0,0 +1,256 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)cxx_app.cpp 10.14 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include "db_cxx.h" +#include "cxx_int.h" + +#include +#include +#include +#include // needed for setErrorStream + +//////////////////////////////////////////////////////////////////////// +// // +// DbEnv // +// // +//////////////////////////////////////////////////////////////////////// + +static DbEnv *currentApp = 0; + +ostream *DbEnv::error_stream_ = 0; + +DbEnv::DbEnv(const char *homeDir, char *const *db_config, u_int32_t flags_arg) +: error_model_(Exception) +{ + DB_ENV *env = this; + memset(env, 0, sizeof(DB_ENV)); + + int err; + + if ((err = db_appinit(homeDir, db_config, env, flags_arg)) != 0) { + DB_ERROR("DbEnv::DbEnv", err); + } + currentApp = this; +} + +DbEnv::DbEnv() +: error_model_(Exception) +{ + DB_ENV *env = this; + memset(env, 0, sizeof(DB_ENV)); +} + +DbEnv::~DbEnv() +{ + if (currentApp == this) + currentApp = 0; + DB_ENV *env = this; + + // having a zeroed environment is a signal that + // appexit() has already been done. + // + DB_ENV zeroed; + memset(&zeroed, 0, sizeof(DB_ENV)); + if (memcmp(&zeroed, env, sizeof(DB_ENV)) != 0) { + (void)appexit(); // ignore error return + } +} + +int DbEnv::appinit(const char *homeDir, char *const *db_config, u_int32_t flags_arg) +{ + DB_ENV *env = this; + + int err; + + if ((err = db_appinit(homeDir, db_config, env, flags_arg)) != 0) { + DB_ERROR("DbEnv::appinit", err); + } + currentApp = this; + return err; +} + +int DbEnv::appexit() +{ + DB_ENV *env = this; + + int err; + + if ((err = db_appexit(env)) != 0) { + DB_ERROR("DbEnv::appexit", err); + } + memset(env, 0, sizeof(DB_ENV)); + currentApp = 0; + return err; +} + +void DbEnv::set_error_model(ErrorModel model) +{ + error_model_ = model; +} + +int DbEnv::runtime_error(const char *caller, int err, int in_destructor) +{ + int throwit = (!currentApp || + (currentApp && currentApp->error_model_ == Exception)); + + if (throwit && !in_destructor) { + throw DbException(caller, err); + } + return err; +} + +// Note: This actually behaves a bit like a static function, +// since DB_ENV.db_errcall has no information about which +// db_env triggered the call. A user that has multiple DB_ENVs +// will simply not be able to have different streams for each one. +// +void DbEnv::set_error_stream(class ostream *stream) +{ + error_stream_ = stream; + + db_errcall = stream_error_function; +} + +ostream *DbEnv::get_error_stream() const +{ + return error_stream_; +} + +void DbEnv::stream_error_function(const char *prefix, char *message) +{ + if (error_stream_) { + if (prefix) { + (*error_stream_) << prefix << ": "; + } + if (message) { + (*error_stream_) << message; + } + (*error_stream_) << "\n"; + } +} + +DB_RW_ACCESS(DbEnv, int, lorder, db_lorder) +DB_RW_ACCESS(DbEnv, DbEnv::db_errcall_fcn, errcall, db_errcall) +DB_RW_ACCESS(DbEnv, FILE *, errfile, db_errfile) +DB_RW_ACCESS(DbEnv, const char *, errpfx, db_errpfx) +DB_RW_ACCESS(DbEnv, int, verbose, db_verbose) +DB_RW_ACCESS(DbEnv, char *, home, db_home) +DB_RW_ACCESS(DbEnv, char *, log_dir, db_log_dir) +DB_RW_ACCESS(DbEnv, char *, tmp_dir, db_tmp_dir) +DB_RW_ACCESS(DbEnv, char **, data_dir, db_data_dir) +DB_RW_ACCESS(DbEnv, int, data_cnt, data_cnt) +DB_RW_ACCESS(DbEnv, int, data_next, data_next) +DB_RW_ACCESS(DbEnv, u_int8_t *, lk_conflicts, lk_conflicts) +DB_RW_ACCESS(DbEnv, int, lk_modes, lk_modes) +DB_RW_ACCESS(DbEnv, unsigned int, lk_max, lk_max) +DB_RW_ACCESS(DbEnv, u_int32_t, lk_detect, lk_detect) +DB_RW_ACCESS(DbEnv, u_int32_t, lg_max, lg_max) +DB_RW_ACCESS(DbEnv, size_t, mp_mmapsize, mp_mmapsize) +DB_RW_ACCESS(DbEnv, size_t, mp_size, mp_size) +DB_RW_ACCESS(DbEnv, unsigned int, tx_max, tx_max) +DB_RW_ACCESS(DbEnv, DbEnv::tx_recover_fcn, tx_recover, tx_recover) +DB_RW_ACCESS(DbEnv, u_int32_t, flags, flags) + +// These access methods require construction of +// wrapper options DB_FOO* to DbFoo* . +// + +DbLockTab *DbEnv::get_lk_info() const +{ + if (!lk_info) + return 0; + DbLockTab *result = new DbLockTab(); + result->imp_ = wrap(lk_info); + return result; +} + +DbLog *DbEnv::get_lg_info() const +{ + if (!lg_info) + return 0; + DbLog *result = new DbLog(); + result->imp_ = wrap(lg_info); + return result; +} + +DbMpool *DbEnv::get_mp_info() const +{ + if (!mp_info) + return 0; + DbMpool *result = new DbMpool(); + result->imp_ = wrap(mp_info); + return result; +} + +DbTxnMgr *DbEnv::get_tx_info() const +{ + if (!tx_info) + return 0; + DbTxnMgr *result = new DbTxnMgr(); + result->imp_ = wrap(tx_info); + return result; +} + +//////////////////////////////////////////////////////////////////////// +// // +// DbInfo // +// // +//////////////////////////////////////////////////////////////////////// + +// Note: in theory, the db_home and db_*_dir fields will always be zero +// when managed by DbInfo. That's because they are set by +// db_appinit, not by the user, and we make a copy of the db_env used by +// the application. +// + +DbInfo::DbInfo() +{ + DB_INFO *info = this; + memset(info, 0, sizeof(DB_INFO)); +} + +DbInfo::~DbInfo() +{ +} + +DbInfo::DbInfo(const DbInfo &that) +{ + DB_INFO *to = this; + const DB_INFO *from = &that; + memcpy(to, from, sizeof(DB_INFO)); +} + +DbInfo &DbInfo::operator = (const DbInfo &that) +{ + DB_INFO *to = this; + const DB_INFO *from = &that; + memcpy(to, from, sizeof(DB_INFO)); + return *this; +} + +DB_RW_ACCESS(DbInfo, int, lorder, db_lorder) +DB_RW_ACCESS(DbInfo, size_t, cachesize, db_cachesize) +DB_RW_ACCESS(DbInfo, size_t, pagesize, db_pagesize) +DB_RW_ACCESS(DbInfo, DbInfo::db_malloc_fcn, malloc, db_malloc) +DB_RW_ACCESS(DbInfo, int, bt_maxkey, bt_maxkey) +DB_RW_ACCESS(DbInfo, int, bt_minkey, bt_minkey) +DB_RW_ACCESS(DbInfo, DbInfo::bt_compare_fcn, bt_compare, bt_compare) +DB_RW_ACCESS(DbInfo, DbInfo::bt_prefix_fcn, bt_prefix, bt_prefix) +DB_RW_ACCESS(DbInfo, unsigned int, h_ffactor, h_ffactor) +DB_RW_ACCESS(DbInfo, unsigned int, h_nelem, h_nelem) +DB_RW_ACCESS(DbInfo, DbInfo::h_hash_fcn, h_hash, h_hash) +DB_RW_ACCESS(DbInfo, int, re_pad, re_pad) +DB_RW_ACCESS(DbInfo, int, re_delim, re_delim) +DB_RW_ACCESS(DbInfo, u_int32_t, re_len, re_len) +DB_RW_ACCESS(DbInfo, char *, re_source, re_source) +DB_RW_ACCESS(DbInfo, u_int32_t, flags, flags) diff --git a/mozilla/db/cxx/cxx_except.cpp b/mozilla/db/cxx/cxx_except.cpp new file mode 100644 index 00000000000..4aab4a738ee --- /dev/null +++ b/mozilla/db/cxx/cxx_except.cpp @@ -0,0 +1,126 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)cxx_except.cpp 10.6 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include "db_cxx.h" +#include "cxx_int.h" +#include + +// tmpString is used to create strings on the stack +// +class tmpString +{ +public: + tmpString(const char *str1, + const char *str2 = 0, + const char *str3 = 0, + const char *str4 = 0, + const char *str5 = 0) + { + int len = strlen(str1); + if (str2) + len += strlen(str2); + if (str3) + len += strlen(str3); + if (str4) + len += strlen(str4); + if (str5) + len += strlen(str5); + + s_ = new char[len+1]; + + strcpy(s_, str1); + if (str2) + strcat(s_, str2); + if (str3) + strcat(s_, str3); + if (str4) + strcat(s_, str4); + if (str5) + strcat(s_, str5); + } + ~tmpString() { delete [] s_; } + operator const char *() { return s_; } + +private: + char *s_; +}; + +// Note: would not be needed if we can inherit from exception +// It does not appear to be possible to inherit from exception +// with the current Microsoft library (VC5.0). +// +static char *dupString(const char *s) +{ + char *r = new char[strlen(s)+1]; + strcpy(r, s); + return r; +} + +//////////////////////////////////////////////////////////////////////// +// // +// DbException // +// // +//////////////////////////////////////////////////////////////////////// + +DbException::~DbException() +{ + if (what_) + delete [] what_; +} + +DbException::DbException(int err) +: err_(err) +{ + what_ = dupString(strerror(err)); +} + +DbException::DbException(const char *description) +: err_(0) +{ + what_ = dupString(tmpString(description)); +} + +DbException::DbException(const char *prefix, int err) +: err_(err) +{ + what_ = dupString(tmpString(prefix, ": ", strerror(err))); +} + +DbException::DbException(const char *prefix1, const char *prefix2, int err) +: err_(err) +{ + what_ = dupString(tmpString(prefix1, ": ", prefix2, ": ", strerror(err))); +} + +DbException::DbException(const DbException &that) +: err_(that.err_) +{ + what_ = dupString(that.what_); +} + +DbException &DbException::operator = (const DbException &that) +{ + err_ = that.err_; + what_ = dupString(that.what_); + return *this; +} + +const int DbException::get_errno() +{ + return err_; +} + +const char *DbException::what() const +{ + return what_; +} diff --git a/mozilla/db/cxx/cxx_lock.cpp b/mozilla/db/cxx/cxx_lock.cpp new file mode 100644 index 00000000000..e0859d34b77 --- /dev/null +++ b/mozilla/db/cxx/cxx_lock.cpp @@ -0,0 +1,201 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)cxx_lock.cpp 10.7 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include "db_cxx.h" +#include "cxx_int.h" +#include + +//////////////////////////////////////////////////////////////////////// +// // +// DbLockTab // +// // +//////////////////////////////////////////////////////////////////////// + +DbLockTab::DbLockTab() +: imp_(0) +{ +} + +DbLockTab::~DbLockTab() +{ +} + +int DbLockTab::close() +{ + DB_LOCKTAB *locktab = unwrap(this); + int err; + + if (!locktab) { + return EINVAL; // handle never assigned + } + + if ((err = lock_close(locktab)) != 0) { + DB_ERROR("DbLockTab::close", err); + return err; + } + imp_ = 0; // extra safety + + // This may seem weird, but is legal as long as we don't access + // any data before returning. + // + delete this; + return 0; +} + +int DbLockTab::detect(u_int32_t flags, int atype) +{ + DB_LOCKTAB *locktab = unwrap(this); + + if (!locktab) { + return EINVAL; // handle never assigned + } + + int err = 0; + if ((err = lock_detect(locktab, flags, atype)) != 0) { + DB_ERROR("DbLockTab::detect", err); + return err; + } + return err; +} + +int DbLockTab::get(u_int32_t locker, u_int32_t flags, const Dbt *obj, + db_lockmode_t lock_mode, DbLock *lock) +{ + DB_LOCKTAB *locktab = unwrap(this); + + if (!locktab) { + return EINVAL; // handle never assigned + } + + int err = 0; + if ((err = lock_get(locktab, locker, flags, obj, + lock_mode, &lock->lock_)) != 0) { + DB_ERROR("DbLockTab::get", err); + return err; + } + return err; +} + +int DbLockTab::id(u_int32_t *idp) +{ + DB_LOCKTAB *locktab = unwrap(this); + + if (!locktab) { + return EINVAL; // handle never assigned + } + + int err; + if ((err = lock_id(locktab, idp)) != 0) { + DB_ERROR("DbLockTab::id", err); + } + return err; +} + +int DbLockTab::vec(u_int32_t locker, u_int32_t flags, + DB_LOCKREQ list[], + int nlist, DB_LOCKREQ **elist_returned) +{ + DB_LOCKTAB *locktab = unwrap(this); + + if (!locktab) { + return EINVAL; // handle never assigned + } + + int err; + if ((err = lock_vec(locktab, locker, flags, list, + nlist, elist_returned)) != 0) { + DB_ERROR("DbLockTab::vec", err); + return err; + } + return err; +} + +// static method +int DbLockTab::open(const char *dir, u_int32_t flags, int mode, + DbEnv *dbenv, DbLockTab **regionp) +{ + *regionp = 0; + DB_LOCKTAB *result = 0; + int err; + if ((err = lock_open(dir, flags, mode, dbenv, &result)) != 0) { + DB_ERROR("DbLockTab::open", err); + return err; + } + + *regionp = new DbLockTab(); + (*regionp)->imp_ = wrap(result); + return 0; +} + +// static method +int DbLockTab::unlink(const char *dir, int force, DbEnv *dbenv) +{ + int err; + if ((err = lock_unlink(dir, force, dbenv)) != 0) { + DB_ERROR("DbLockTab::unlink", err); + return err; + } + return err; +} + +//////////////////////////////////////////////////////////////////////// +// // +// DbLock // +// // +//////////////////////////////////////////////////////////////////////// + +DbLock::DbLock(unsigned int value) +: lock_(value) +{ +} + +DbLock::DbLock() +: lock_(0) +{ +} + +DbLock::DbLock(const DbLock &that) +: lock_(that.lock_) +{ +} + +DbLock &DbLock::operator = (const DbLock &that) +{ + lock_ = that.lock_; + return *this; +} + +unsigned int DbLock::get_lock_id() +{ + return lock_; +} + +void DbLock::set_lock_id(unsigned int value) +{ + lock_ = value; +} + +int DbLock::put(DbLockTab *locktab) +{ + DB_LOCKTAB *db_locktab = unwrap(locktab); + + if (!db_locktab) { + return EINVAL; // handle never assigned + } + + int err; + if ((err = lock_put(db_locktab, lock_)) != 0) { + DB_ERROR("DbLock::put", err); + } + return err; +} diff --git a/mozilla/db/cxx/cxx_log.cpp b/mozilla/db/cxx/cxx_log.cpp new file mode 100644 index 00000000000..4d57b696671 --- /dev/null +++ b/mozilla/db/cxx/cxx_log.cpp @@ -0,0 +1,157 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)cxx_log.cpp 10.7 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include "db_cxx.h" +#include "cxx_int.h" +#include + +//////////////////////////////////////////////////////////////////////// +// // +// DbLog // +// // +//////////////////////////////////////////////////////////////////////// + +DbLog::DbLog() +: imp_(0) +{ +} + +DbLog::~DbLog() +{ +} + +int DbLog::archive(char **list[], u_int32_t flags, void *(*db_malloc)(size_t)) +{ + int err; + DB_LOG *log = unwrap(this); + if ((err = log_archive(log, list, flags, db_malloc)) != 0) { + DB_ERROR("DbLog::archive", err); + return err; + } + return 0; +} + +int DbLog::close() +{ + int err; + DB_LOG *log = unwrap(this); + if ((err = log_close(log)) != 0) { + DB_ERROR("DbLog::close", err); + return err; + } + imp_ = 0; // extra safety + + // This may seem weird, but is legal as long as we don't access + // any data before returning. + // + delete this; + return 0; +} + +int DbLog::compare(const DbLsn *lsn0, const DbLsn *lsn1) +{ + return log_compare(lsn0, lsn1); +} + +int DbLog::file(DbLsn *lsn, char *namep, int len) +{ + int err; + DB_LOG *log = unwrap(this); + if ((err = log_file(log, lsn, namep, len)) != 0) { + DB_ERROR("DbLog::file", err); + return err; + } + return 0; +} + +int DbLog::flush(const DbLsn *lsn) +{ + int err; + DB_LOG *log = unwrap(this); + if ((err = log_flush(log, lsn)) != 0) { + DB_ERROR("DbLog::flush", err); + return err; + } + return 0; +} + +int DbLog::get(DbLsn *lsn, Dbt *data, u_int32_t flags) +{ + int err; + DB_LOG *log = unwrap(this); + if ((err = log_get(log, lsn, data, flags)) != 0) { + DB_ERROR("DbLog::get", err); + return err; + } + return 0; +} + +int DbLog::put(DbLsn *lsn, const Dbt *data, u_int32_t flags) +{ + int err = 0; + DB_LOG *log = unwrap(this); + if ((err = log_put(log, lsn, data, flags)) != 0) { + DB_ERROR("DbLog::put", err); + return err; + } + return 0; +} + +int DbLog::db_register(Db *dbp, const char *name, DBTYPE type, u_int32_t *fidp) +{ + int err = 0; + DB_LOG *log = unwrap(this); + if ((err = log_register(log, unwrap(dbp), name, type, fidp)) != 0) { + DB_ERROR("DbLog::db_register", err); + return err; + } + return 0; +} + +int DbLog::db_unregister(u_int32_t fid) +{ + int err; + DB_LOG *log = unwrap(this); + if ((err = log_unregister(log, fid)) != 0) { + DB_ERROR("DbLog::db_unregister", err); + return err; + } + return 0; +} + +// static method +int DbLog::open(const char *dir, u_int32_t flags, int mode, + DbEnv *dbenv, DbLog **regionp) +{ + *regionp = 0; + DB_LOG *result = 0; + int err; + if ((err = log_open(dir, flags, mode, dbenv, &result)) != 0) { + DB_ERROR("DbLog::open", err); + return err; + } + *regionp = new DbLog(); + (*regionp)->imp_ = wrap(result); + return err; +} + +// static method +int DbLog::unlink(const char *dir, int force, DbEnv *dbenv) +{ + int err; + if ((err = log_unlink(dir, force, dbenv)) != 0) { + DB_ERROR("DbLog::unlink", err); + return err; + } + return err; +} diff --git a/mozilla/db/cxx/cxx_mpool.cpp b/mozilla/db/cxx/cxx_mpool.cpp new file mode 100644 index 00000000000..427225e580c --- /dev/null +++ b/mozilla/db/cxx/cxx_mpool.cpp @@ -0,0 +1,243 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)cxx_mpool.cpp 10.9 (Sleepycat) 5/2/98"; +#endif /* not lint */ + +#include "db_cxx.h" +#include "cxx_int.h" +#include + +//////////////////////////////////////////////////////////////////////// +// // +// DbMpoolFile // +// // +//////////////////////////////////////////////////////////////////////// + +DbMpoolFile::DbMpoolFile() +: imp_(0) +{ +} + +DbMpoolFile::~DbMpoolFile() +{ +} + +int DbMpoolFile::open(DbMpool *mp, const char *file, + u_int32_t flags, int mode, size_t pagesize, + DB_MPOOL_FINFO *finfop, DbMpoolFile **result) +{ + int err; + + DB_MPOOLFILE *mpf; + if ((err = memp_fopen(unwrap(mp), file, flags, mode, pagesize, + finfop, &mpf)) != 0) { + DB_ERROR("DbMpoolFile::open", err); + return err; + } + *result = new DbMpoolFile(); + (*result)->imp_ = wrap(mpf); + return 0; +} + +int DbMpoolFile::close() +{ + DB_MPOOLFILE *mpf = unwrap(this); + int err = 0; + if (!mpf) { + err = EINVAL; + } + else if ((err = memp_fclose(mpf)) != 0) { + DB_ERROR("DbMpoolFile::close", err); + return err; + } + imp_ = 0; // extra safety + + // This may seem weird, but is legal as long as we don't access + // any data before returning. + // + delete this; + return 0; +} + +int DbMpoolFile::get(db_pgno_t *pgnoaddr, u_int32_t flags, void *pagep) +{ + DB_MPOOLFILE *mpf = unwrap(this); + int err = 0; + if (!mpf) { + err = EINVAL; + } + else if ((err = memp_fget(mpf, pgnoaddr, flags, pagep)) != 0) { + DB_ERROR("DbMpoolFile::get", err); + } + return err; +} + +int DbMpoolFile::put(void *pgaddr, u_int32_t flags) +{ + DB_MPOOLFILE *mpf = unwrap(this); + int err = 0; + if (!mpf) { + err = EINVAL; + } + else if ((err = memp_fput(mpf, pgaddr, flags)) != 0) { + DB_ERROR("DbMpoolFile::put", err); + } + return err; +} + +int DbMpoolFile::set(void *pgaddr, u_int32_t flags) +{ + DB_MPOOLFILE *mpf = unwrap(this); + int err = 0; + if (!mpf) { + err = EINVAL; + } + else if ((err = memp_fset(mpf, pgaddr, flags)) != 0) { + DB_ERROR("DbMpoolFile::set", err); + } + return err; +} + +int DbMpoolFile::sync() +{ + DB_MPOOLFILE *mpf = unwrap(this); + int err = 0; + if (!mpf) { + err = EINVAL; + } + else if ((err = memp_fsync(mpf)) != 0) { + DB_ERROR("DbMpoolFile::sync", err); + } + return err; +} + +//////////////////////////////////////////////////////////////////////// +// // +// DbMpool // +// // +//////////////////////////////////////////////////////////////////////// + +DbMpool::DbMpool() +: imp_(0) +{ +} + +DbMpool::~DbMpool() +{ +} + +int DbMpool::close() +{ + DB_MPOOL *mpool = unwrap(this); + int err; + + if (!mpool) { + return EINVAL; // already closed + } + + if ((err = memp_close(mpool)) != 0) { + DB_ERROR("DbMpool::close", err); + return err; + } + imp_ = 0; // extra safety + + // This may seem weird, but is legal as long as we don't access + // any data before returning. + // + delete this; + return 0; +} + +int DbMpool::db_register(int ftype, + int (*pgin)(db_pgno_t pgno, void *pgaddr, DBT *pgcookie), + int (*pgout)(db_pgno_t pgno, void *pgaddr, DBT *pgcookie)) +{ + DB_MPOOL *mpool = unwrap(this); + int err = 0; + if (!mpool) { + err = EINVAL; + } + else if ((err = memp_register(mpool, ftype, pgin, pgout)) != 0) { + DB_ERROR("DbMpool::db_register", err); + return err; + } + return err; +} + +int DbMpool::stat(DB_MPOOL_STAT **gsp, DB_MPOOL_FSTAT ***fsp, + void *(*alternate_malloc)(size_t)) +{ + DB_MPOOL *mpool = unwrap(this); + int err = 0; + if (!mpool) { + err = EINVAL; + } + else if ((err = memp_stat(mpool, gsp, fsp, alternate_malloc)) != 0) { + DB_ERROR("DbMpool::stat", err); + return err; + } + return err; +} + +int DbMpool::sync(DbLsn *sn) +{ + DB_MPOOL *mpool = unwrap(this); + int err = 0; + if (!mpool) { + err = EINVAL; + } + else if ((err = memp_sync(mpool, sn)) != 0) { + DB_ERROR("DbMpool::sync", err); + return err; + } + return err; +} + +int DbMpool::trickle(int pct, int *nwrotep) +{ + DB_MPOOL *mpool = unwrap(this); + int err = 0; + if (!mpool) { + err = EINVAL; + } + else if ((err = memp_trickle(mpool, pct, nwrotep)) != 0) { + DB_ERROR("DbMpool::trickle", err); + return err; + } + return err; +} +// static method +int DbMpool::open(const char *dir, u_int32_t flags, int mode, + DbEnv *dbenv, DbMpool **regionp) +{ + *regionp = 0; + DB_MPOOL *result = 0; + int err; + if ((err = memp_open(dir, flags, mode, dbenv, &result)) != 0) { + DB_ERROR("DbMpool::open", err); + return err; + } + + *regionp = new DbMpool(); + (*regionp)->imp_ = wrap(result); + return 0; +} + +// static method +int DbMpool::unlink(const char *dir, int force, DbEnv *dbenv) +{ + int err; + if ((err = memp_unlink(dir, force, dbenv)) != 0) { + DB_ERROR("DbMpool::unlink", err); + return err; + } + return err; +} diff --git a/mozilla/db/cxx/cxx_table.cpp b/mozilla/db/cxx/cxx_table.cpp new file mode 100644 index 00000000000..5360739af35 --- /dev/null +++ b/mozilla/db/cxx/cxx_table.cpp @@ -0,0 +1,310 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)cxx_table.cpp 10.11 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include "db_cxx.h" +#include "cxx_int.h" +#include +#include + +//////////////////////////////////////////////////////////////////////// +// // +// Db // +// // +//////////////////////////////////////////////////////////////////////// + +Db::Db() +: imp_(0) +{ +} + +Db::~Db() +{ +} + +int Db::close(u_int32_t flags) +{ + DB *db = unwrap(this); + if (!db) { + DB_ERROR("Db::close", EINVAL); + return EINVAL; + } + int err; + if ((err = db->close(db, flags)) != 0) { + DB_ERROR("Db::close", err); + return err; + } + imp_ = 0; // extra safety + + // This may seem weird, but is legal as long as we don't access + // any data before returning. + // + delete this; + return 0; +} + +int Db::cursor(DbTxn *txnid, Dbc **cursorp) +{ + DB *db = unwrap(this); + int err; + + if (!db) { + DB_ERROR("Db::cursor", EINVAL); + return EINVAL; + } + DBC *dbc = 0; + if ((err = db->cursor(db, unwrap(txnid), &dbc)) != 0) { + DB_ERROR("Db::cursor", err); + return err; + } + + // The following cast implies that Dbc can be no larger than DBC + *cursorp = (Dbc*)dbc; + return 0; +} + +int Db::del(DbTxn *txnid, Dbt *key, u_int32_t flags) +{ + DB *db = unwrap(this); + int err; + + if (!db) { + DB_ERROR("Db::del", EINVAL); + return EINVAL; + } + if ((err = db->del(db, unwrap(txnid), key, flags)) != 0) { + DB_ERROR("Db::del", err); + return err; + } + return 0; +} + +int Db::fd(int *fdp) +{ + DB *db = unwrap(this); + if (!db) { + DB_ERROR("Db::fd", EINVAL); + return EINVAL; + } + int err; + if ((err = db->fd(db, fdp)) != 0) { + DB_ERROR("Db::fd", err); + return err; + } + return 0; +} + +int Db::get(DbTxn *txnid, Dbt *key, Dbt *value, u_int32_t flags) +{ + + DB *db = unwrap(this); + int err; + + if (!db) { + DB_ERROR("Db::get", EINVAL); + return EINVAL; + } + if ((err = db->get(db, unwrap(txnid), key, value, flags)) != 0) { + // DB_NOTFOUND is a "normal" return, so should not be + // thrown as an error + // + if (err != DB_NOTFOUND) { + DB_ERROR("Db::get", err); + return err; + } + } + return err; +} + +// static method +int Db::open(const char *fname, DBTYPE type, u_int32_t flags, + int mode, DbEnv *dbenv, DbInfo *info, Db **table_returned) +{ + *table_returned = 0; + DB *newtable; + int err; + if ((err = db_open(fname, type, flags, mode, dbenv, + info, &newtable)) != 0) { + DB_ERROR("Db::open", err); + return err; + } + *table_returned = new Db(); + (*table_returned)->imp_ = wrap(newtable); + return 0; +} + +int Db::put(DbTxn *txnid, Dbt *key, Dbt *value, u_int32_t flags) +{ + DB *db = unwrap(this); + int err; + + if (!db) { + DB_ERROR("Db::put", EINVAL); + return EINVAL; + } + if ((err = db->put(db, unwrap(txnid), key, value, flags)) != 0) { + + // DB_KEYEXIST is a "normal" return, so should not be + // thrown as an error + // + if (err != DB_KEYEXIST) { + DB_ERROR("Db::put", err); + return err; + } + } + return err; +} + +int Db::stat(void *sp, void *(*db_malloc)(size_t), u_int32_t flags) +{ + DB *db = unwrap(this); + if (!db) { + DB_ERROR("Db::stat", EINVAL); + return EINVAL; + } + int err; + if ((err = db->stat(db, sp, db_malloc, flags)) != 0) { + DB_ERROR("Db::stat", err); + return err; + } + return 0; +} + +int Db::sync(u_int32_t flags) +{ + DB *db = unwrap(this); + if (!db) { + DB_ERROR("Db::sync", EINVAL); + return EINVAL; + } + int err; + if ((err = db->sync(db, flags)) != 0) { + DB_ERROR("Db::sync", err); + return err; + } + return 0; +} + +DBTYPE Db::get_type() const +{ + const DB *db = unwrapConst(this); + return db->type; +} + + +//////////////////////////////////////////////////////////////////////// +// // +// Dbc // +// // +//////////////////////////////////////////////////////////////////////// + +// It's private, and should never be called, but VC4.0 needs it resolved +// +Dbc::~Dbc() +{ +} + +int Dbc::close() +{ + DBC *cursor = this; + int err; + + if ((err = cursor->c_close(cursor)) != 0) { + DB_ERROR("Db::close", err); + return err; + } + return 0; +} + +int Dbc::del(u_int32_t flags) +{ + DBC *cursor = this; + int err; + + if ((err = cursor->c_del(cursor, flags)) != 0) { + DB_ERROR("Db::del", err); + return err; + } + return 0; +} + +int Dbc::get(Dbt* key, Dbt *data, u_int32_t flags) +{ + DBC *cursor = this; + int err; + + if ((err = cursor->c_get(cursor, key, data, flags)) != 0) { + if (err != DB_NOTFOUND) { + DB_ERROR("Db::get", err); + return err; + } + } + return err; +} + +int Dbc::put(Dbt* key, Dbt *data, u_int32_t flags) +{ + DBC *cursor = this; + int err; + + if ((err = cursor->c_put(cursor, key, data, flags)) != 0) { + DB_ERROR("Db::put", err); + return err; + } + return 0; +} + +//////////////////////////////////////////////////////////////////////// +// // +// Dbt // +// // +//////////////////////////////////////////////////////////////////////// + +Dbt::Dbt() +{ + DBT *dbt = this; + memset(dbt, 0, sizeof(DBT)); +} + +Dbt::Dbt(void *data_arg, size_t size_arg) +{ + DBT *dbt = this; + memset(dbt, 0, sizeof(DBT)); + set_data(data_arg); + set_size(size_arg); +} + +Dbt::~Dbt() +{ +} + +Dbt::Dbt(const Dbt &that) +{ + const DBT *from = &that; + DBT *to = this; + memcpy(to, from, sizeof(DBT)); +} + +Dbt &Dbt::operator = (const Dbt &that) +{ + const DBT *from = &that; + DBT *to = this; + memcpy(to, from, sizeof(DBT)); + return *this; +} + +DB_RW_ACCESS(Dbt, void *, data, data) +DB_RW_ACCESS(Dbt, u_int32_t, size, size) +DB_RW_ACCESS(Dbt, u_int32_t, ulen, ulen) +DB_RW_ACCESS(Dbt, u_int32_t, dlen, dlen) +DB_RW_ACCESS(Dbt, u_int32_t, doff, doff) +DB_RW_ACCESS(Dbt, u_int32_t, flags, flags) diff --git a/mozilla/db/cxx/cxx_txn.cpp b/mozilla/db/cxx/cxx_txn.cpp new file mode 100644 index 00000000000..3607ad4a501 --- /dev/null +++ b/mozilla/db/cxx/cxx_txn.cpp @@ -0,0 +1,178 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)cxx_txn.cpp 10.8 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include "db_cxx.h" +#include "cxx_int.h" +#include + +//////////////////////////////////////////////////////////////////////// +// // +// DbTxnMgr // +// // +//////////////////////////////////////////////////////////////////////// + +DbTxnMgr::DbTxnMgr() +: imp_(0) +{ +} + +DbTxnMgr::~DbTxnMgr() +{ +} + +int DbTxnMgr::begin(DbTxn *pid, DbTxn **tid) +{ + int err; + DB_TXNMGR *mgr = unwrap(this); + DB_TXN *txn; + + if ((err = txn_begin(mgr, unwrap(pid), &txn)) != 0) { + DB_ERROR("DbTxn::begin", err); + return err; + } + DbTxn *result = new DbTxn(); + result->imp_ = wrap(txn); + *tid = result; + return err; +} + +int DbTxnMgr::checkpoint(u_int32_t kbyte, u_int32_t min) const +{ + int err; + const DB_TXNMGR *mgr = unwrapConst(this); + if ((err = txn_checkpoint(mgr, kbyte, min)) != 0) { + DB_ERROR("DbTxnMgr::checkpoint", err); + return err; + } + return 0; +} + +int DbTxnMgr::close() +{ + int err; + DB_TXNMGR *mgr = unwrap(this); + if ((err = txn_close(mgr)) != 0) { + DB_ERROR("DbTxnMgr::close", err); + return err; + } + imp_ = 0; // extra safety + + // This may seem weird, but is legal as long as we don't access + // any data before returning. + // + delete this; + return 0; +} + +// static method +int DbTxnMgr::open(const char *dir, u_int32_t flags, int mode, + DbEnv *dbenv, DbTxnMgr **regionp) +{ + *regionp = 0; + DB_TXNMGR *result = 0; + int err; + if ((err = txn_open(dir, flags, mode, dbenv, &result)) != 0) { + DB_ERROR("DbTxnMgr::open", err); + return err; + } + + *regionp = new DbTxnMgr(); + (*regionp)->imp_ = wrap(result); + return 0; +} + +int DbTxnMgr::stat(DB_TXN_STAT **statp, void *(*db_malloc)(size_t)) +{ + int err; + DB_TXNMGR *mgr = unwrap(this); + if ((err = txn_stat(mgr, statp, db_malloc)) != 0) { + DB_ERROR("DbTxnMgr::stat", err); + return err; + } + return 0; +} + +// static method +int DbTxnMgr::unlink(const char *dir, int force, DbEnv *dbenv) +{ + int err; + if ((err = txn_unlink(dir, force, dbenv)) != 0) { + DB_ERROR("DbTxnMgr::unlink", err); + return err; + } + return err; +} + +//////////////////////////////////////////////////////////////////////// +// // +// DbTxn // +// // +//////////////////////////////////////////////////////////////////////// + +DbTxn::DbTxn() +: imp_(0) +{ +} + +DbTxn::~DbTxn() +{ +} + +int DbTxn::abort() +{ + int err; + DB_TXN *txn = unwrap(this); + if ((err = txn_abort(txn)) != 0) { + DB_ERROR("DbTxn::abort", err); + return err; + } + + // This may seem weird, but is legal as long as we don't access + // any data before returning. + // + delete this; + return 0; +} + +int DbTxn::commit() +{ + int err; + DB_TXN *txn = unwrap(this); + if ((err = txn_commit(txn)) != 0) { + DB_ERROR("DbTxn::commit", err); + return err; + } + + // This may seem weird, but is legal as long as we don't access + // any data before returning. + // + delete this; + return 0; +} + +u_int32_t DbTxn::id() +{ + DB_TXN *txn = unwrap(this); + return txn_id(txn); // no error +} + +int DbTxn::prepare() +{ + int err; + DB_TXN *txn = unwrap(this); + if ((err = txn_prepare(txn)) != 0) { + DB_ERROR("DbTxn::prepare", err); + return err; + } + return 0; +} diff --git a/mozilla/db/cxx/namemap.txt b/mozilla/db/cxx/namemap.txt new file mode 100644 index 00000000000..bd8357517f2 --- /dev/null +++ b/mozilla/db/cxx/namemap.txt @@ -0,0 +1,53 @@ +@(#)namemap.txt 10.1 (Sleepycat) 7/17/97 + +The bulk of DB provides for wrapper classes and appropriately named methods +that call into DB. For the most part, there is a straightforward mapping of +names. For the purposes of referencing documentation, this chart shows the +underlying C structure name for each C++ class. In some cases, using the +given C prefix with a C++ method name gives the underlying C function name. +For example, DBMemPoolFile::close() is implemented by memp_fclose(). + + +C++ C C prefix + +DBApp none +DBAppOptions DB_ENV +DBConfig none +DBException none +DBIterator DBC (cursor) +DBLock DB_LOCK lock_ +DBLockRequest DB_LOCKREQ +DBLockTable DB_LOCKTAB +DBLog DB_LOG log_ +DBMemPool DB_MPOOL memp_ +DBMemPoolFile DB_MPOOLFILE memp_f +DBMemPoolFileStat reserved +DBMemPoolStat reserved +DBOpenType DBTYPE +DBOpenParams DB_INFO +DBSequenceNumber DB_LSN +DBTable DB +DBThunk DBT +DBTransaction DB_TXN txn_ +DBTransactionManager DB_TXNMGR txn_ +DBVersion none + + +There are a few exceptions to the above, mostly to allow for +natural constructors or to avoid conflicts with reserved words: + +C++ name C name + +DBLog::identify log_register +DBLog::unidentify log_unregister +DBTransaction::DBTransaction txn_begin +DBTransactionManager::DBTransactionManager txn_open +DBLockTable::DBLockTable lock_open +DBLog::DBLog log_open +DBMemPool::DBMemPool memp_open +DBMemPoolFile::DBMemPoolFile memp_fopen +DBApp::removeLockTableFile lock_unlink +DBApp::removeMemPoolFile memp_unlink +DBApp::removeLoggingFile log_unlink +DBApp::removeTransactionManagerFile txn_unlink +DBTable::remove (*del) diff --git a/mozilla/db/db/db.c b/mozilla/db/db/db.c new file mode 100644 index 00000000000..9951ebd9445 --- /dev/null +++ b/mozilla/db/db/db.c @@ -0,0 +1,866 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * 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. + * + * 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)db.c 10.57 (Sleepycat) 5/7/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_page.h" +#include "db_shash.h" +#include "db_swap.h" +#include "btree.h" +#include "hash.h" +#include "mp.h" +#include "db_am.h" +#include "common_ext.h" + +static int db_close __P((DB *, u_int32_t)); +static int db_fd __P((DB *, int *)); + +/* + * If the metadata page has the flag set, set the local flag. If the page + * does NOT have the flag set, return EINVAL if the user's dbinfo argument + * caused us to already set the local flag. + */ +#define DBINFO_FCHK(dbp, fn, meta_flags, m_name, dbp_name) { \ + if ((meta_flags) & (m_name)) \ + F_SET(dbp, dbp_name); \ + else \ + if (F_ISSET(dbp, dbp_name)) { \ + __db_err(dbenv, \ + "%s: %s specified in dbinfo argument but not set in file", \ + fname, fn); \ + goto einval; \ + } \ +} + +/* + * db_open -- + * Main library interface to the DB access methods. + */ +int +db_open(fname, type, flags, mode, dbenv, dbinfo, dbpp) + const char *fname; + DBTYPE type; + u_int32_t flags; + int mode; + DB_ENV *dbenv; + DB_INFO *dbinfo; + DB **dbpp; +{ + BTMETA *btm; + DB *dbp; + DBT pgcookie; + DB_ENV *envp, t_dbenv; + DB_MPOOL_FINFO finfo; + DB_PGINFO pginfo; + HASHHDR *hashm; + size_t cachesize; + ssize_t nr; + u_int32_t iopsize; + int fd, ftype, need_fileid, restore, ret, retry_cnt, swapped; + char *real_name, mbuf[512]; + + /* Validate arguments. */ +#ifdef HAVE_SPINLOCKS +#define OKFLAGS (DB_CREATE | DB_NOMMAP | DB_RDONLY | DB_THREAD | DB_TRUNCATE) +#else +#define OKFLAGS (DB_CREATE | DB_NOMMAP | DB_RDONLY | DB_TRUNCATE) +#endif + if ((ret = __db_fchk(dbenv, "db_open", flags, OKFLAGS)) != 0) + return (ret); + + if (dbenv != NULL) { + /* + * You can't specify threads during the db_open() if the + * environment wasn't configured with them. + */ + if (LF_ISSET(DB_THREAD) && !F_ISSET(dbenv, DB_ENV_THREAD)) { + __db_err(dbenv, + "environment not created using DB_THREAD"); + return (EINVAL); + } + + /* + * Specifying a cachesize to db_open(3), after creating an + * environment, is a common mistake. + */ + if (dbinfo != NULL && dbinfo->db_cachesize != 0) { + __db_err(dbenv, + "cachesize will be ignored if environment exists"); + return (EINVAL); + } + } + + /* Initialize for error return. */ + fd = -1; + need_fileid = 1; + real_name = NULL; + + /* Allocate the DB structure, reference the DB_ENV structure. */ + if ((dbp = (DB *)__db_calloc(1, sizeof(DB))) == NULL) { + __db_err(dbenv, "%s", strerror(ENOMEM)); + return (ENOMEM); + } + dbp->dbenv = dbenv; + + /* Convert the db_open(3) flags. */ + if (LF_ISSET(DB_RDONLY)) + F_SET(dbp, DB_AM_RDONLY); + if (LF_ISSET(DB_THREAD)) + F_SET(dbp, DB_AM_THREAD); + + /* Convert the dbinfo structure flags. */ + if (dbinfo != NULL) { + /* + * !!! + * We can't check for illegal flags until we know what type + * of open we're doing. + */ + if (F_ISSET(dbinfo, DB_DELIMITER)) + F_SET(dbp, DB_RE_DELIMITER); + if (F_ISSET(dbinfo, DB_DUP)) + F_SET(dbp, DB_AM_DUP); + if (F_ISSET(dbinfo, DB_FIXEDLEN)) + F_SET(dbp, DB_RE_FIXEDLEN); + if (F_ISSET(dbinfo, DB_PAD)) + F_SET(dbp, DB_RE_PAD); + if (F_ISSET(dbinfo, DB_RECNUM)) + F_SET(dbp, DB_BT_RECNUM); + if (F_ISSET(dbinfo, DB_RENUMBER)) + F_SET(dbp, DB_RE_RENUMBER); + if (F_ISSET(dbinfo, DB_SNAPSHOT)) + F_SET(dbp, DB_RE_SNAPSHOT); + } + + /* + * Always set the master and initialize the queues, so we can + * use these fields without checking the thread bit. + */ + dbp->master = dbp; + LIST_INIT(&dbp->handleq); + LIST_INSERT_HEAD(&dbp->handleq, dbp, links); + TAILQ_INIT(&dbp->curs_queue); + + /* + * Set based on the dbenv fields, although no logging or transactions + * are possible for temporary files. + */ + if (dbenv != NULL) { + if (dbenv->lk_info != NULL) + F_SET(dbp, DB_AM_LOCKING); + if (fname != NULL && dbenv->lg_info != NULL) + F_SET(dbp, DB_AM_LOGGING); + } + + /* Set the common fields. */ + if (dbinfo == NULL) { + dbp->pgsize = 0; + dbp->db_malloc = NULL; + } else { + dbp->pgsize = dbinfo->db_pagesize; + dbp->db_malloc = dbinfo->db_malloc; + } + + /* Fill in the default file mode. */ + if (mode == 0) + mode = __db_omode("rwrw--"); + + /* Check if the user wants us to swap byte order. */ + if (dbinfo != NULL) + switch (ret = __db_byteorder(dbenv, dbinfo->db_lorder)) { + case 0: + break; + case DB_SWAPBYTES: + F_SET(dbp, DB_AM_SWAP); + break; + default: + goto err; + } + + /* + * If we have a file name, try and read the first page, figure out + * what type of file it is, and initialize everything we can based + * on that file's meta-data page. + * + * XXX + * We don't actually expect zero-length strings as arguments. We + * do the check, permitting them, because scripting languages, e.g., + * the Tcl test suite, doesn't know anything about passing NULL's. + */ + if (fname != NULL && fname[0] != '\0') { + /* Get the real file name. */ + if ((ret = __db_appname(dbenv, + DB_APP_DATA, NULL, fname, 0, NULL, &real_name)) != 0) + goto err; + + /* + * Open the backing file. We need to make sure that multiple + * processes attempting to create the file at the same time + * are properly ordered so that only one of them creates the + * "unique" file id, so we open it O_EXCL and O_CREAT so two + * simultaneous attempts to create the region will return + * failure in one of the attempts. If we're one of the ones + * that fail, we simply retry without the O_CREAT flag, which + * will require that the meta-data page exist. + */ + retry_cnt = 0; +open_retry: if (LF_ISSET(DB_CREATE)) { + if ((ret = __db_open(real_name, flags | DB_EXCL, + OKFLAGS | DB_EXCL, mode, &fd)) != 0) + if (ret == EEXIST) { + LF_CLR(DB_CREATE); + goto open_retry; + } else { + __db_err(dbenv, + "%s: %s", fname, strerror(ret)); + goto err; + } + } else + if ((ret = __db_open(real_name, + flags, OKFLAGS, mode, &fd)) != 0) { + __db_err(dbenv, "%s: %s", fname, strerror(ret)); + goto err; + } + + /* + * Use the 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 impossibly large default cache + * sizes, we limit the default pagesize to 16K. + */ + if (dbp->pgsize == 0) { + if ((ret = __db_ioinfo(real_name, + fd, NULL, NULL, &iopsize)) != 0) { + __db_err(dbenv, + "%s: %s", real_name, strerror(ret)); + goto err; + } + if (iopsize < 512) + iopsize = 512; + if (iopsize > 16 * 1024) + iopsize = 16 * 1024; + dbp->pgsize = iopsize; + F_SET(dbp, DB_AM_PGDEF); + } + + /* + * Try and read the first disk sector -- this code assumes + * that the meta-data for all access methods fits in 512 + * bytes, and that no database will be smaller than that. + */ + if ((ret = __db_read(fd, mbuf, sizeof(mbuf), &nr)) != 0) + goto err; + + /* The fd is no longer needed. */ + (void)__db_close(fd); + fd = -1; + + if (nr != sizeof(mbuf)) { + if (nr != 0) { + __db_err(dbenv, + "%s: unexpected file format", fname); + goto einval; + } + /* + * The only way we can reach here with the DB_CREATE + * flag set is if we created the file. If that's not + * the case, then a) someone else created the file + * but has not yet written out the meta-data page, or + * b) we truncated the file (DB_TRUNCATE) leaving it + * zero-length. In the case of a), we want to sleep + * and give the file creator some time to write the + * metadata page. In the case of b), charge forward. + * Note, there is a race in the case of two processes + * opening the file with the DB_TRUNCATE flag set at + * roughly the same time, and they could theoretically + * hurt each other, although it's pretty unlikely. + */ + if (retry_cnt++ < 3 && + !LF_ISSET(DB_CREATE | DB_TRUNCATE)) { + __db_sleep(1, 0); + goto open_retry; + } + if (type == DB_UNKNOWN) { + __db_err(dbenv, + "%s: DBTYPE of unknown with empty file", + fname); + goto einval; + } + goto empty; + } + + /* + * A found file overrides some user information. We'll check + * for possible error conditions based on conflicts between + * the file and the user's arguments below. + */ + swapped = 0; + F_CLR(dbp, DB_AM_SWAP); + +retry: switch (((BTMETA *)mbuf)->magic) { + case DB_BTREEMAGIC: + if (type != DB_BTREE && + type != DB_RECNO && type != DB_UNKNOWN) + goto einval; + + btm = (BTMETA *)mbuf; + if (swapped && (ret = __bam_mswap((PAGE *)btm)) != 0) + goto err; + + if (btm->version < DB_BTREEOLDVER || + btm->version > DB_BTREEVERSION) { + __db_err(dbenv, + "%s: unsupported btree version number %lu", + fname, (u_long)btm->version); + goto einval; + } + dbp->pgsize = btm->pagesize; + F_CLR(dbp, DB_AM_PGDEF); + + if ((ret = __db_fchk(dbenv, + "db_open", btm->flags, BTM_MASK)) != 0) + goto err; + DBINFO_FCHK(dbp, "DB_DUP", + btm->flags, BTM_DUP, DB_AM_DUP); + if (F_ISSET(btm, BTM_RECNO)) { + DBINFO_FCHK(dbp, "DB_FIXEDLEN", + btm->flags, BTM_FIXEDLEN, DB_RE_FIXEDLEN); + DBINFO_FCHK(dbp, "DB_RENUMBER", + btm->flags, BTM_RENUMBER, DB_RE_RENUMBER); + type = DB_RECNO; + } else { + DBINFO_FCHK(dbp, "DB_RECNUM", + btm->flags, BTM_RECNUM, DB_BT_RECNUM); + type = DB_BTREE; + } + + /* Copy the file's unique id. */ + need_fileid = 0; + memcpy(dbp->lock.fileid, btm->uid, DB_FILE_ID_LEN); + break; + case DB_HASHMAGIC: + if (type != DB_HASH && type != DB_UNKNOWN) + goto einval; + + hashm = (HASHHDR *)mbuf; + if (swapped && (ret = __ham_mswap((PAGE *)hashm)) != 0) + goto err; + + if (hashm->version < DB_HASHOLDVER || + hashm->version > DB_HASHVERSION) { + __db_err(dbenv, + "%s: unsupported hash version number %lu", + fname, hashm->version); + goto einval; + } + dbp->pgsize = hashm->pagesize; + F_CLR(dbp, DB_AM_PGDEF); + + if ((ret = __db_fchk(dbenv, + "db_open", hashm->flags, DB_HASH_DUP)) != 0) + goto err; + DBINFO_FCHK(dbp, "DB_DUP", + hashm->flags, DB_HASH_DUP, DB_AM_DUP); + type = DB_HASH; + + /* Copy the file's unique id. */ + need_fileid = 0; + memcpy(dbp->lock.fileid, hashm->uid, DB_FILE_ID_LEN); + break; + default: + if (swapped) { + __db_err(dbenv, "unrecognized file type"); + goto einval; + } + M_32_SWAP(((BTMETA *)mbuf)->magic); + F_SET(dbp, DB_AM_SWAP); + + swapped = 1; + goto retry; + } + } else { + fname = real_name = NULL; + + if (type == DB_UNKNOWN) { + __db_err(dbenv, + "DBTYPE of unknown without existing file"); + goto einval; + } + F_SET(dbp, DB_AM_INMEM); + } + +empty: /* + * By the time we get here we've either set the type or we're taking + * it from the user. + */ + dbp->type = type; + + /* + * Set the page size to the best value for I/O to this file. Don't + * overflow the page offset type. The page size must be db_indx_t + * aligned and >= MIN_PAGE_SIZE. + * + * XXX + * Should we be checking for a page size that's not a multiple of 512? + */ + if (dbp->pgsize == 0) { + F_SET(dbp, DB_AM_PGDEF); + dbp->pgsize = 8 * 1024; + } + if (dbp->pgsize < DB_MIN_PGSIZE || + dbp->pgsize > DB_MAX_PGSIZE || + dbp->pgsize & (sizeof(db_indx_t) - 1)) { + __db_err(dbenv, "illegal page size"); + goto einval; + } + + /* + * If no mpool supplied by the application, attach to a local, + * created buffer pool. + * + * XXX + * If the user has a DB_ENV structure, we have to use a temporary + * one so that we don't step on their values. If the user doesn't, + * we have to create one, and keep it around until the call to the + * memp_close() function. This is all so the mpool functions get + * the error stuff right. + */ + if (dbenv == NULL || dbenv->mp_info == NULL) { + F_SET(dbp, DB_AM_MLOCAL); + + if (dbenv == NULL) { + if ((dbp->mp_dbenv = + (DB_ENV *)__db_calloc(sizeof(DB_ENV), 1)) == NULL) { + ret = ENOMEM; + goto err; + } + + envp = dbp->mp_dbenv; + restore = 0; + } else { + t_dbenv = *dbenv; + + envp = dbenv; + restore = 1; + } + + /* + * Set and/or correct the cache size; must be a multiple of + * the page size. + */ + if (dbinfo == NULL || dbinfo->db_cachesize == 0) + cachesize = dbp->pgsize * DB_MINCACHE; + else { + cachesize = dbinfo->db_cachesize; + if (cachesize & (dbp->pgsize - 1)) + cachesize += + (~cachesize & (dbp->pgsize - 1)) + 1; + if (cachesize < dbp->pgsize * DB_MINCACHE) + cachesize = dbp->pgsize * DB_MINCACHE; + if (cachesize < 20 * 1024) + cachesize = 20 * 1024; + } + envp->mp_size = cachesize; + + if ((ret = memp_open(NULL, DB_CREATE | DB_MPOOL_PRIVATE | + (F_ISSET(dbp, DB_AM_THREAD) ? DB_THREAD : 0), + __db_omode("rw----"), envp, &dbp->mp)) != 0) + goto err; + if (restore) + *dbenv = t_dbenv; + } else + dbp->mp = dbenv->mp_info; + + /* Register DB's pgin/pgout functions. */ + if ((ret = memp_register(dbp->mp, + DB_FTYPE_BTREE, __bam_pgin, __bam_pgout)) != 0) + goto err; + if ((ret = memp_register(dbp->mp, + DB_FTYPE_HASH, __ham_pgin, __ham_pgout)) != 0) + goto err; + + /* + * If we don't already have one, get a unique file ID. If the file + * is a temporary file, then we have to create a unique file ID -- + * no backing file will be created until the mpool cache is filled + * forcing it to go to disk. The created ID must never match any + * potential real file ID -- we know it won't because real file IDs + * contain a time stamp after the dev/ino pair, and we're simply + * storing a 4-byte locker ID. + * + * XXX + * Store the file id in the locker structure -- we can get it from + * there as necessary, and it saves having two copies. + */ + if (need_fileid) + if (fname == NULL) { + memset(dbp->lock.fileid, 0, DB_FILE_ID_LEN); + if (F_ISSET(dbp, DB_AM_LOCKING) && + (ret = lock_id(dbenv->lk_info, + (u_int32_t *)dbp->lock.fileid)) != 0) + goto err; + } else + if ((ret = __db_fileid(dbenv, + real_name, 1, dbp->lock.fileid)) != 0) + goto err; + + /* No further use for the real name. */ + if (real_name != NULL) + FREES(real_name); + real_name = NULL; + + /* + * Open a backing file in the memory pool. + * + * If we need to process the file's pages on I/O, set the file type. + * If it's a hash file, always call pgin and pgout routines. This + * means that hash files can never be mapped into process memory. If + * it's a btree file and requires swapping, we need to page the file + * in and out. This has to be right -- we can't mmap files that are + * being paged in and out. + */ + if (type == DB_HASH) + ftype = DB_FTYPE_HASH; + else + ftype = F_ISSET(dbp, DB_AM_SWAP) ? DB_FTYPE_BTREE : 0; + pginfo.db_pagesize = dbp->pgsize; + pginfo.needswap = F_ISSET(dbp, DB_AM_SWAP); + pgcookie.data = &pginfo; + pgcookie.size = sizeof(DB_PGINFO); + + /* + * Set up additional memp_fopen information. + */ + memset(&finfo, 0, sizeof(finfo)); + finfo.ftype = ftype; + finfo.pgcookie = &pgcookie; + finfo.fileid = dbp->lock.fileid; + finfo.lsn_offset = 0; + finfo.clear_len = DB_PAGE_CLEAR_LEN; + if ((ret = memp_fopen(dbp->mp, fname, + F_ISSET(dbp, DB_AM_RDONLY) ? DB_RDONLY : 0, + 0, dbp->pgsize, &finfo, &dbp->mpf)) != 0) + goto err; + + /* + * XXX + * Truly spectacular layering violation. We need a per-thread mutex + * that lives in shared memory (thanks, HP-UX!) and so we acquire a + * pointer to the mpool one. + */ + if (F_ISSET(dbp, DB_AM_THREAD)) + dbp->mutexp = dbp->mpf->mutexp; + + /* Get a log file id. */ + if (F_ISSET(dbp, DB_AM_LOGGING) && + (ret = log_register(dbenv->lg_info, + dbp, fname, type, &dbp->log_fileid)) != 0) + goto err; + + /* + * Get a locker id for this DB, and build the lock cookie: the first + * db_pgno_t bytes are the page number, the next N bytes are the file + * id. + */ + if (F_ISSET(dbp, DB_AM_LOCKING)) { + if ((ret = lock_id(dbenv->lk_info, &dbp->locker)) != 0) + goto err; + dbp->lock_dbt.size = sizeof(dbp->lock); + dbp->lock_dbt.data = &dbp->lock; + } + + /* Call the real open function. */ + switch (type) { + case DB_BTREE: + if (dbinfo != NULL && (ret = __db_fchk(dbenv, + "db_open", dbinfo->flags, DB_RECNUM | DB_DUP)) != 0) + goto err; + if (dbinfo != NULL && (ret = __db_fcchk(dbenv, + "db_open", dbinfo->flags, DB_DUP, DB_RECNUM)) != 0) + goto err; + if ((ret = __bam_open(dbp, type, dbinfo)) != 0) + goto err; + break; + case DB_HASH: + if (dbinfo != NULL && (ret = __db_fchk(dbenv, + "db_open", dbinfo->flags, DB_DUP)) != 0) + goto err; + if ((ret = __ham_open(dbp, dbinfo)) != 0) + goto err; + break; + case DB_RECNO: +#define DB_INFO_FLAGS \ + (DB_DELIMITER | DB_FIXEDLEN | DB_PAD | DB_RENUMBER | DB_SNAPSHOT) + if (dbinfo != NULL && (ret = __db_fchk(dbenv, + "db_open", dbinfo->flags, DB_INFO_FLAGS)) != 0) + goto err; + if ((ret = __ram_open(dbp, type, dbinfo)) != 0) + goto err; + break; + default: + abort(); + } + + /* Call a local close routine. */ + dbp->close = db_close; + dbp->fd = db_fd; + + *dbpp = dbp; + return (0); + +einval: ret = EINVAL; +err: /* Close the file descriptor. */ + if (fd != -1) + (void)__db_close(fd); + + /* Discard the log file id. */ + if (dbp->log_fileid != 0) + (void)log_unregister(dbenv->lg_info, dbp->log_fileid); + + /* Close the memory pool file. */ + if (dbp->mpf != NULL) + (void)memp_fclose(dbp->mpf); + + /* If the memory pool was local, close it. */ + if (F_ISSET(dbp, DB_AM_MLOCAL) && dbp->mp != NULL) + (void)memp_close(dbp->mp); + + /* If we allocated a DB_ENV, discard it. */ + if (dbp->mp_dbenv != NULL) + FREE(dbp->mp_dbenv, sizeof(DB_ENV)); + + if (real_name != NULL) + FREES(real_name); + if (dbp != NULL) + FREE(dbp, sizeof(DB)); + + return (ret); +} + +/* + * db_close -- + * Close a DB tree. + */ +static int +db_close(dbp, flags) + DB *dbp; + u_int32_t flags; +{ + DBC *dbc; + DB *tdbp; + int ret, t_ret; + + /* Validate arguments. */ + if ((ret = __db_fchk(dbp->dbenv, "db_close", flags, DB_NOSYNC)) != 0) + return (ret); + + /* Sync the underlying file. */ + if (!LF_ISSET(DB_NOSYNC) && + (t_ret = dbp->sync(dbp, 0)) != 0 && ret == 0) + ret = t_ret; + + /* + * Call the underlying access method close routine for all the + * cursors and handles. + */ + for (tdbp = LIST_FIRST(&dbp->handleq); + tdbp != NULL; tdbp = LIST_NEXT(tdbp, links)) { + while ((dbc = TAILQ_FIRST(&tdbp->curs_queue)) != NULL) + switch (tdbp->type) { + case DB_BTREE: + if ((t_ret = + __bam_c_iclose(tdbp, dbc)) != 0 && ret == 0) + ret = t_ret; + break; + case DB_HASH: + if ((t_ret = + __ham_c_iclose(tdbp, dbc)) != 0 && ret == 0) + ret = t_ret; + break; + case DB_RECNO: + if ((t_ret = + __ram_c_iclose(tdbp, dbc)) != 0 && ret == 0) + ret = t_ret; + break; + default: + abort(); + } + + switch (tdbp->type) { + case DB_BTREE: + if ((t_ret = __bam_close(tdbp)) != 0 && ret == 0) + ret = t_ret; + break; + case DB_HASH: + if ((t_ret = __ham_close(tdbp)) != 0 && ret == 0) + ret = t_ret; + break; + case DB_RECNO: + if ((t_ret = __ram_close(tdbp)) != 0 && ret == 0) + ret = t_ret; + break; + default: + abort(); + } + } + + /* Sync the memory pool. */ + if (!LF_ISSET(DB_NOSYNC) && (t_ret = memp_fsync(dbp->mpf)) != 0 && + t_ret != DB_INCOMPLETE && ret == 0) + ret = t_ret; + + /* Close the memory pool file. */ + if ((t_ret = memp_fclose(dbp->mpf)) != 0 && ret == 0) + ret = t_ret; + + /* If the memory pool was local, close it. */ + if (F_ISSET(dbp, DB_AM_MLOCAL) && + (t_ret = memp_close(dbp->mp)) != 0 && ret == 0) + ret = t_ret; + + /* Discard the log file id. */ + if (F_ISSET(dbp, DB_AM_LOGGING)) + (void)log_unregister(dbp->dbenv->lg_info, dbp->log_fileid); + + /* Discard the lock cookie for all handles. */ + for (tdbp = LIST_FIRST(&dbp->handleq); + tdbp != NULL; tdbp = LIST_NEXT(tdbp, links)) + if (F_ISSET(tdbp, DB_AM_LOCKING)) { +#ifdef DEBUG + DB_LOCKREQ request; + + /* + * If we're running tests, display any locks currently + * held. It's possible that some applications may hold + * locks for long periods, e.g., conference room locks, + * but the DB tests should never close holding locks. + */ + request.op = DB_LOCK_DUMP; + if ((t_ret = lock_vec(tdbp->dbenv->lk_info, + tdbp->locker, 0, &request, 1, NULL)) != 0 && + ret == 0) + ret = EAGAIN; +#endif + } + + /* If we allocated a DB_ENV, discard it. */ + if (dbp->mp_dbenv != NULL) + FREE(dbp->mp_dbenv, sizeof(DB_ENV)); + + /* Free all of the DB's. */ + LIST_REMOVE(dbp, links); + while ((tdbp = LIST_FIRST(&dbp->handleq)) != NULL) { + LIST_REMOVE(tdbp, links); + FREE(tdbp, sizeof(*tdbp)); + } + FREE(dbp, sizeof(*dbp)); + + return (ret); +} + +/* + * db_fd -- + * Return a file descriptor for flock'ing. + */ +static int +db_fd(dbp, fdp) + DB *dbp; + int *fdp; +{ + /* + * XXX + * Truly spectacular layering violation. + */ + return (__mp_xxx_fd(dbp->mpf, fdp)); +} + +/* + * __db_pgerr -- + * Error when unable to retrieve a specified page. + * + * PUBLIC: int __db_pgerr __P((DB *, db_pgno_t)); + */ +int +__db_pgerr(dbp, pgno) + DB *dbp; + db_pgno_t pgno; +{ + /* + * Three things are certain: + * Death, taxes, and lost data. + * Guess which has occurred. + */ + __db_err(dbp->dbenv, + "unable to create/retrieve page %lu", (u_long)pgno); + return (__db_panic(dbp)); +} + +/* + * __db_pgfmt -- + * Error when a page has the wrong format. + * + * PUBLIC: int __db_pgfmt __P((DB *, db_pgno_t)); + */ +int +__db_pgfmt(dbp, pgno) + DB *dbp; + db_pgno_t pgno; +{ + __db_err(dbp->dbenv, + "page %lu: illegal page type or format", (u_long)pgno); + return (__db_panic(dbp)); +} diff --git a/mozilla/db/db/db.src b/mozilla/db/db/db.src new file mode 100644 index 00000000000..91d8b390a1b --- /dev/null +++ b/mozilla/db/db/db.src @@ -0,0 +1,159 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)db.src 10.6 (Sleepycat) 4/28/98 + */ + +PREFIX db + +/* + * addrem -- Add or remove an entry from a duplicate page. + * + * opcode: identifies if this is an add or delete. + * fileid: file identifier of the file being modified. + * pgno: duplicate page number. + * indx: location at which to insert or delete. + * nbytes: number of bytes added/removed to/from the page. + * hdr: header for the data item. + * dbt: data that is deleted or is to be added. + * pagelsn: former lsn of the page. + * + * If the hdr was NULL then, the dbt is a regular B_KEYDATA. + * If the dbt was NULL then the hdr is a complete item to be + * pasted on the page. + */ +BEGIN addrem +ARG opcode u_int32_t lu +ARG fileid u_int32_t lu +ARG pgno db_pgno_t lu +ARG indx u_int32_t lu +ARG nbytes size_t lu +DBT hdr DBT s +DBT dbt DBT s +POINTER pagelsn DB_LSN * lu +END + +/* + * split -- Handles the split of a duplicate page. + * + * opcode: defines whether we are splitting from or splitting onto + * fileid: file identifier of the file being modified. + * pgno: page number being split. + * pageimage: entire page contents. + * pagelsn: former lsn of the page. + */ +BEGIN split +ARG opcode u_int32_t lu +ARG fileid u_int32_t lu +ARG pgno db_pgno_t lu +DBT pageimage DBT s +POINTER pagelsn DB_LSN * lu +END + +/* + * big -- Handles addition and deletion of big key/data items. + * + * opcode: identifies get/put. + * fileid: file identifier of the file being modified. + * pgno: page onto which data is being added/removed. + * prev_pgno: the page before the one we are logging. + * next_pgno: the page after the one we are logging. + * dbt: data being written onto the page. + * pagelsn: former lsn of the orig_page. + * prevlsn: former lsn of the prev_pgno. + * nextlsn: former lsn of the next_pgno. This is not currently used, but + * may be used later if we actually do overwrites of big key/ + * data items in place. + */ +BEGIN big +ARG opcode u_int32_t lu +ARG fileid u_int32_t lu +ARG pgno db_pgno_t lu +ARG prev_pgno db_pgno_t lu +ARG next_pgno db_pgno_t lu +DBT dbt DBT s +POINTER pagelsn DB_LSN * lu +POINTER prevlsn DB_LSN * lu +POINTER nextlsn DB_LSN * lu +END + +/* + * ovref -- Handles increment/decrement of overflow page reference count. + * + * fileid: identifies the file being modified. + * pgno: page number whose ref count is being incremented/decremented. + * adjust: the adjustment being made. + * lsn: the page's original lsn. + */ +BEGIN ovref +ARG fileid u_int32_t lu +ARG pgno db_pgno_t lu +ARG adjust int32_t ld +POINTER lsn DB_LSN * lu +END + +/* + * relink -- Handles relinking around a page. + * + * pgno: the page being changed. + * lsn the page's original lsn. + * prev: the previous page. + * lsn_prev: the previous page's original lsn. + * next: the next page. + * lsn_next: the previous page's original lsn. + */ +BEGIN relink +ARG fileid u_int32_t lu +ARG pgno db_pgno_t lu +POINTER lsn DB_LSN * lu +ARG prev db_pgno_t lu +POINTER lsn_prev DB_LSN * lu +ARG next db_pgno_t lu +POINTER lsn_next DB_LSN * lu +END + +/* + * Addpage -- Handles adding a new duplicate page onto the end of + * an existing duplicate page. + * fileid: identifies the file being changed. + * pgno: page number to which a new page is being added. + * lsn: lsn of pgno + * nextpgno: new page number being added. + * nextlsn: lsn of nextpgno; + */ +BEGIN addpage +ARG fileid u_int32_t lu +ARG pgno db_pgno_t lu +POINTER lsn DB_LSN * lu +ARG nextpgno db_pgno_t lu +POINTER nextlsn DB_LSN * lu +END + +/* + * Debug -- log an operation upon entering an access method. + * op: Operation (cursor, c_close, c_get, c_put, c_del, + * get, put, delete). + * fileid: identifies the file being acted upon. + * key: key paramater + * data: data parameter + * flags: flags parameter + */ +BEGIN debug +DBT op DBT s +ARG fileid u_int32_t lu +DBT key DBT s +DBT data DBT s +ARG arg_flags u_int32_t lu +END + +/* + * noop -- do nothing, but get an LSN. + */ +BEGIN noop +ARG fileid u_int32_t lu +ARG pgno db_pgno_t lu +POINTER prevlsn DB_LSN * lu +END diff --git a/mozilla/db/db/db_auto.c b/mozilla/db/db/db_auto.c new file mode 100644 index 00000000000..5203e0a94c6 --- /dev/null +++ b/mozilla/db/db/db_auto.c @@ -0,0 +1,1494 @@ +/* Do not edit: automatically built by dist/db_gen.sh. */ +#include "config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include +#include +#include +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_page.h" +#include "db_dispatch.h" +#include "db_am.h" +/* + * PUBLIC: int __db_addrem_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, u_int32_t, db_pgno_t, u_int32_t, + * PUBLIC: size_t, const DBT *, const DBT *, DB_LSN *)); + */ +int __db_addrem_log(logp, txnid, ret_lsnp, flags, + opcode, fileid, pgno, indx, nbytes, hdr, + dbt, pagelsn) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t opcode; + u_int32_t fileid; + db_pgno_t pgno; + u_int32_t indx; + size_t nbytes; + const DBT *hdr; + const DBT *dbt; + DB_LSN * pagelsn; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t zero; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_db_addrem; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(opcode) + + sizeof(fileid) + + sizeof(pgno) + + sizeof(indx) + + sizeof(nbytes) + + sizeof(u_int32_t) + (hdr == NULL ? 0 : hdr->size) + + sizeof(u_int32_t) + (dbt == NULL ? 0 : dbt->size) + + sizeof(*pagelsn); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &opcode, sizeof(opcode)); + bp += sizeof(opcode); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + memcpy(bp, &pgno, sizeof(pgno)); + bp += sizeof(pgno); + memcpy(bp, &indx, sizeof(indx)); + bp += sizeof(indx); + memcpy(bp, &nbytes, sizeof(nbytes)); + bp += sizeof(nbytes); + if (hdr == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &hdr->size, sizeof(hdr->size)); + bp += sizeof(hdr->size); + memcpy(bp, hdr->data, hdr->size); + bp += hdr->size; + } + if (dbt == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &dbt->size, sizeof(dbt->size)); + bp += sizeof(dbt->size); + memcpy(bp, dbt->data, dbt->size); + bp += dbt->size; + } + if (pagelsn != NULL) + memcpy(bp, pagelsn, sizeof(*pagelsn)); + else + memset(bp, 0, sizeof(*pagelsn)); + bp += sizeof(*pagelsn); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __db_addrem_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_addrem_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __db_addrem_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __db_addrem_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]db_addrem: 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); + printf("\topcode: %lu\n", (u_long)argp->opcode); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tpgno: %lu\n", (u_long)argp->pgno); + printf("\tindx: %lu\n", (u_long)argp->indx); + printf("\tnbytes: %lu\n", (u_long)argp->nbytes); + printf("\thdr: "); + for (i = 0; i < argp->hdr.size; i++) { + ch = ((u_int8_t *)argp->hdr.data)[i]; + if (isprint(ch) || ch == 0xa) + putchar(ch); + else + printf("%#x ", ch); + } + printf("\n"); + printf("\tdbt: "); + for (i = 0; i < argp->dbt.size; i++) { + ch = ((u_int8_t *)argp->dbt.data)[i]; + if (isprint(ch) || ch == 0xa) + putchar(ch); + else + printf("%#x ", ch); + } + printf("\n"); + printf("\tpagelsn: [%lu][%lu]\n", + (u_long)argp->pagelsn.file, (u_long)argp->pagelsn.offset); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __db_addrem_read __P((void *, __db_addrem_args **)); + */ +int +__db_addrem_read(recbuf, argpp) + void *recbuf; + __db_addrem_args **argpp; +{ + __db_addrem_args *argp; + u_int8_t *bp; + + argp = (__db_addrem_args *)__db_malloc(sizeof(__db_addrem_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->opcode, bp, sizeof(argp->opcode)); + bp += sizeof(argp->opcode); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->pgno, bp, sizeof(argp->pgno)); + bp += sizeof(argp->pgno); + memcpy(&argp->indx, bp, sizeof(argp->indx)); + bp += sizeof(argp->indx); + memcpy(&argp->nbytes, bp, sizeof(argp->nbytes)); + bp += sizeof(argp->nbytes); + memcpy(&argp->hdr.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->hdr.data = bp; + bp += argp->hdr.size; + memcpy(&argp->dbt.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->dbt.data = bp; + bp += argp->dbt.size; + memcpy(&argp->pagelsn, bp, sizeof(argp->pagelsn)); + bp += sizeof(argp->pagelsn); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __db_split_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, u_int32_t, db_pgno_t, const DBT *, + * PUBLIC: DB_LSN *)); + */ +int __db_split_log(logp, txnid, ret_lsnp, flags, + opcode, fileid, pgno, pageimage, pagelsn) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t opcode; + u_int32_t fileid; + db_pgno_t pgno; + const DBT *pageimage; + DB_LSN * pagelsn; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t zero; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_db_split; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(opcode) + + sizeof(fileid) + + sizeof(pgno) + + sizeof(u_int32_t) + (pageimage == NULL ? 0 : pageimage->size) + + sizeof(*pagelsn); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &opcode, sizeof(opcode)); + bp += sizeof(opcode); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + memcpy(bp, &pgno, sizeof(pgno)); + bp += sizeof(pgno); + if (pageimage == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &pageimage->size, sizeof(pageimage->size)); + bp += sizeof(pageimage->size); + memcpy(bp, pageimage->data, pageimage->size); + bp += pageimage->size; + } + if (pagelsn != NULL) + memcpy(bp, pagelsn, sizeof(*pagelsn)); + else + memset(bp, 0, sizeof(*pagelsn)); + bp += sizeof(*pagelsn); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __db_split_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_split_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __db_split_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __db_split_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]db_split: 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); + printf("\topcode: %lu\n", (u_long)argp->opcode); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tpgno: %lu\n", (u_long)argp->pgno); + printf("\tpageimage: "); + for (i = 0; i < argp->pageimage.size; i++) { + ch = ((u_int8_t *)argp->pageimage.data)[i]; + if (isprint(ch) || ch == 0xa) + putchar(ch); + else + printf("%#x ", ch); + } + printf("\n"); + printf("\tpagelsn: [%lu][%lu]\n", + (u_long)argp->pagelsn.file, (u_long)argp->pagelsn.offset); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __db_split_read __P((void *, __db_split_args **)); + */ +int +__db_split_read(recbuf, argpp) + void *recbuf; + __db_split_args **argpp; +{ + __db_split_args *argp; + u_int8_t *bp; + + argp = (__db_split_args *)__db_malloc(sizeof(__db_split_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->opcode, bp, sizeof(argp->opcode)); + bp += sizeof(argp->opcode); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->pgno, bp, sizeof(argp->pgno)); + bp += sizeof(argp->pgno); + memcpy(&argp->pageimage.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->pageimage.data = bp; + bp += argp->pageimage.size; + memcpy(&argp->pagelsn, bp, sizeof(argp->pagelsn)); + bp += sizeof(argp->pagelsn); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __db_big_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, u_int32_t, db_pgno_t, db_pgno_t, + * PUBLIC: db_pgno_t, const DBT *, DB_LSN *, DB_LSN *, + * PUBLIC: DB_LSN *)); + */ +int __db_big_log(logp, txnid, ret_lsnp, flags, + opcode, fileid, pgno, prev_pgno, next_pgno, dbt, + pagelsn, prevlsn, nextlsn) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t opcode; + u_int32_t fileid; + db_pgno_t pgno; + db_pgno_t prev_pgno; + db_pgno_t next_pgno; + const DBT *dbt; + DB_LSN * pagelsn; + DB_LSN * prevlsn; + DB_LSN * nextlsn; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t zero; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_db_big; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(opcode) + + sizeof(fileid) + + sizeof(pgno) + + sizeof(prev_pgno) + + sizeof(next_pgno) + + sizeof(u_int32_t) + (dbt == NULL ? 0 : dbt->size) + + sizeof(*pagelsn) + + sizeof(*prevlsn) + + sizeof(*nextlsn); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &opcode, sizeof(opcode)); + bp += sizeof(opcode); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + memcpy(bp, &pgno, sizeof(pgno)); + bp += sizeof(pgno); + memcpy(bp, &prev_pgno, sizeof(prev_pgno)); + bp += sizeof(prev_pgno); + memcpy(bp, &next_pgno, sizeof(next_pgno)); + bp += sizeof(next_pgno); + if (dbt == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &dbt->size, sizeof(dbt->size)); + bp += sizeof(dbt->size); + memcpy(bp, dbt->data, dbt->size); + bp += dbt->size; + } + if (pagelsn != NULL) + memcpy(bp, pagelsn, sizeof(*pagelsn)); + else + memset(bp, 0, sizeof(*pagelsn)); + bp += sizeof(*pagelsn); + if (prevlsn != NULL) + memcpy(bp, prevlsn, sizeof(*prevlsn)); + else + memset(bp, 0, sizeof(*prevlsn)); + bp += sizeof(*prevlsn); + if (nextlsn != NULL) + memcpy(bp, nextlsn, sizeof(*nextlsn)); + else + memset(bp, 0, sizeof(*nextlsn)); + bp += sizeof(*nextlsn); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __db_big_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_big_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __db_big_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __db_big_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]db_big: 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); + printf("\topcode: %lu\n", (u_long)argp->opcode); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tpgno: %lu\n", (u_long)argp->pgno); + printf("\tprev_pgno: %lu\n", (u_long)argp->prev_pgno); + printf("\tnext_pgno: %lu\n", (u_long)argp->next_pgno); + printf("\tdbt: "); + for (i = 0; i < argp->dbt.size; i++) { + ch = ((u_int8_t *)argp->dbt.data)[i]; + if (isprint(ch) || ch == 0xa) + putchar(ch); + else + printf("%#x ", ch); + } + printf("\n"); + printf("\tpagelsn: [%lu][%lu]\n", + (u_long)argp->pagelsn.file, (u_long)argp->pagelsn.offset); + printf("\tprevlsn: [%lu][%lu]\n", + (u_long)argp->prevlsn.file, (u_long)argp->prevlsn.offset); + printf("\tnextlsn: [%lu][%lu]\n", + (u_long)argp->nextlsn.file, (u_long)argp->nextlsn.offset); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __db_big_read __P((void *, __db_big_args **)); + */ +int +__db_big_read(recbuf, argpp) + void *recbuf; + __db_big_args **argpp; +{ + __db_big_args *argp; + u_int8_t *bp; + + argp = (__db_big_args *)__db_malloc(sizeof(__db_big_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->opcode, bp, sizeof(argp->opcode)); + bp += sizeof(argp->opcode); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->pgno, bp, sizeof(argp->pgno)); + bp += sizeof(argp->pgno); + memcpy(&argp->prev_pgno, bp, sizeof(argp->prev_pgno)); + bp += sizeof(argp->prev_pgno); + memcpy(&argp->next_pgno, bp, sizeof(argp->next_pgno)); + bp += sizeof(argp->next_pgno); + memcpy(&argp->dbt.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->dbt.data = bp; + bp += argp->dbt.size; + memcpy(&argp->pagelsn, bp, sizeof(argp->pagelsn)); + bp += sizeof(argp->pagelsn); + memcpy(&argp->prevlsn, bp, sizeof(argp->prevlsn)); + bp += sizeof(argp->prevlsn); + memcpy(&argp->nextlsn, bp, sizeof(argp->nextlsn)); + bp += sizeof(argp->nextlsn); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __db_ovref_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, db_pgno_t, int32_t, DB_LSN *)); + */ +int __db_ovref_log(logp, txnid, ret_lsnp, flags, + fileid, pgno, adjust, lsn) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t fileid; + db_pgno_t pgno; + int32_t adjust; + DB_LSN * lsn; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_db_ovref; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(fileid) + + sizeof(pgno) + + sizeof(adjust) + + sizeof(*lsn); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + memcpy(bp, &pgno, sizeof(pgno)); + bp += sizeof(pgno); + memcpy(bp, &adjust, sizeof(adjust)); + bp += sizeof(adjust); + if (lsn != NULL) + memcpy(bp, lsn, sizeof(*lsn)); + else + memset(bp, 0, sizeof(*lsn)); + bp += sizeof(*lsn); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __db_ovref_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_ovref_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __db_ovref_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __db_ovref_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]db_ovref: 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); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tpgno: %lu\n", (u_long)argp->pgno); + printf("\tadjust: %ld\n", (long)argp->adjust); + printf("\tlsn: [%lu][%lu]\n", + (u_long)argp->lsn.file, (u_long)argp->lsn.offset); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __db_ovref_read __P((void *, __db_ovref_args **)); + */ +int +__db_ovref_read(recbuf, argpp) + void *recbuf; + __db_ovref_args **argpp; +{ + __db_ovref_args *argp; + u_int8_t *bp; + + argp = (__db_ovref_args *)__db_malloc(sizeof(__db_ovref_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->pgno, bp, sizeof(argp->pgno)); + bp += sizeof(argp->pgno); + memcpy(&argp->adjust, bp, sizeof(argp->adjust)); + bp += sizeof(argp->adjust); + memcpy(&argp->lsn, bp, sizeof(argp->lsn)); + bp += sizeof(argp->lsn); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __db_relink_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t, + * PUBLIC: DB_LSN *, db_pgno_t, DB_LSN *)); + */ +int __db_relink_log(logp, txnid, ret_lsnp, flags, + fileid, pgno, lsn, prev, lsn_prev, next, + lsn_next) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_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; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_db_relink; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(fileid) + + sizeof(pgno) + + sizeof(*lsn) + + sizeof(prev) + + sizeof(*lsn_prev) + + sizeof(next) + + sizeof(*lsn_next); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + memcpy(bp, &pgno, sizeof(pgno)); + bp += sizeof(pgno); + if (lsn != NULL) + memcpy(bp, lsn, sizeof(*lsn)); + else + memset(bp, 0, sizeof(*lsn)); + bp += sizeof(*lsn); + memcpy(bp, &prev, sizeof(prev)); + bp += sizeof(prev); + if (lsn_prev != NULL) + memcpy(bp, lsn_prev, sizeof(*lsn_prev)); + else + memset(bp, 0, sizeof(*lsn_prev)); + bp += sizeof(*lsn_prev); + memcpy(bp, &next, sizeof(next)); + bp += sizeof(next); + if (lsn_next != NULL) + memcpy(bp, lsn_next, sizeof(*lsn_next)); + else + memset(bp, 0, sizeof(*lsn_next)); + bp += sizeof(*lsn_next); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __db_relink_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_relink_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __db_relink_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __db_relink_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]db_relink: 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); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tpgno: %lu\n", (u_long)argp->pgno); + printf("\tlsn: [%lu][%lu]\n", + (u_long)argp->lsn.file, (u_long)argp->lsn.offset); + printf("\tprev: %lu\n", (u_long)argp->prev); + printf("\tlsn_prev: [%lu][%lu]\n", + (u_long)argp->lsn_prev.file, (u_long)argp->lsn_prev.offset); + printf("\tnext: %lu\n", (u_long)argp->next); + printf("\tlsn_next: [%lu][%lu]\n", + (u_long)argp->lsn_next.file, (u_long)argp->lsn_next.offset); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __db_relink_read __P((void *, __db_relink_args **)); + */ +int +__db_relink_read(recbuf, argpp) + void *recbuf; + __db_relink_args **argpp; +{ + __db_relink_args *argp; + u_int8_t *bp; + + argp = (__db_relink_args *)__db_malloc(sizeof(__db_relink_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->pgno, bp, sizeof(argp->pgno)); + bp += sizeof(argp->pgno); + memcpy(&argp->lsn, bp, sizeof(argp->lsn)); + bp += sizeof(argp->lsn); + memcpy(&argp->prev, bp, sizeof(argp->prev)); + bp += sizeof(argp->prev); + memcpy(&argp->lsn_prev, bp, sizeof(argp->lsn_prev)); + bp += sizeof(argp->lsn_prev); + memcpy(&argp->next, bp, sizeof(argp->next)); + bp += sizeof(argp->next); + memcpy(&argp->lsn_next, bp, sizeof(argp->lsn_next)); + bp += sizeof(argp->lsn_next); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __db_addpage_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t, + * PUBLIC: DB_LSN *)); + */ +int __db_addpage_log(logp, txnid, ret_lsnp, flags, + fileid, pgno, lsn, nextpgno, nextlsn) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t fileid; + db_pgno_t pgno; + DB_LSN * lsn; + db_pgno_t nextpgno; + DB_LSN * nextlsn; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_db_addpage; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(fileid) + + sizeof(pgno) + + sizeof(*lsn) + + sizeof(nextpgno) + + sizeof(*nextlsn); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + memcpy(bp, &pgno, sizeof(pgno)); + bp += sizeof(pgno); + if (lsn != NULL) + memcpy(bp, lsn, sizeof(*lsn)); + else + memset(bp, 0, sizeof(*lsn)); + bp += sizeof(*lsn); + memcpy(bp, &nextpgno, sizeof(nextpgno)); + bp += sizeof(nextpgno); + if (nextlsn != NULL) + memcpy(bp, nextlsn, sizeof(*nextlsn)); + else + memset(bp, 0, sizeof(*nextlsn)); + bp += sizeof(*nextlsn); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __db_addpage_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_addpage_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __db_addpage_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __db_addpage_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]db_addpage: 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); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tpgno: %lu\n", (u_long)argp->pgno); + printf("\tlsn: [%lu][%lu]\n", + (u_long)argp->lsn.file, (u_long)argp->lsn.offset); + printf("\tnextpgno: %lu\n", (u_long)argp->nextpgno); + printf("\tnextlsn: [%lu][%lu]\n", + (u_long)argp->nextlsn.file, (u_long)argp->nextlsn.offset); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __db_addpage_read __P((void *, __db_addpage_args **)); + */ +int +__db_addpage_read(recbuf, argpp) + void *recbuf; + __db_addpage_args **argpp; +{ + __db_addpage_args *argp; + u_int8_t *bp; + + argp = (__db_addpage_args *)__db_malloc(sizeof(__db_addpage_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->pgno, bp, sizeof(argp->pgno)); + bp += sizeof(argp->pgno); + memcpy(&argp->lsn, bp, sizeof(argp->lsn)); + bp += sizeof(argp->lsn); + memcpy(&argp->nextpgno, bp, sizeof(argp->nextpgno)); + bp += sizeof(argp->nextpgno); + memcpy(&argp->nextlsn, bp, sizeof(argp->nextlsn)); + bp += sizeof(argp->nextlsn); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __db_debug_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: const DBT *, u_int32_t, const DBT *, const DBT *, + * PUBLIC: u_int32_t)); + */ +int __db_debug_log(logp, txnid, ret_lsnp, flags, + op, fileid, key, data, arg_flags) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + const DBT *op; + u_int32_t fileid; + const DBT *key; + const DBT *data; + u_int32_t arg_flags; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t zero; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_db_debug; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(u_int32_t) + (op == NULL ? 0 : op->size) + + sizeof(fileid) + + sizeof(u_int32_t) + (key == NULL ? 0 : key->size) + + sizeof(u_int32_t) + (data == NULL ? 0 : data->size) + + sizeof(arg_flags); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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 (op == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &op->size, sizeof(op->size)); + bp += sizeof(op->size); + memcpy(bp, op->data, op->size); + bp += op->size; + } + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + if (key == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &key->size, sizeof(key->size)); + bp += sizeof(key->size); + memcpy(bp, key->data, key->size); + bp += key->size; + } + if (data == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &data->size, sizeof(data->size)); + bp += sizeof(data->size); + memcpy(bp, data->data, data->size); + bp += data->size; + } + memcpy(bp, &arg_flags, sizeof(arg_flags)); + bp += sizeof(arg_flags); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __db_debug_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_debug_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __db_debug_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __db_debug_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]db_debug: 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); + printf("\top: "); + for (i = 0; i < argp->op.size; i++) { + ch = ((u_int8_t *)argp->op.data)[i]; + if (isprint(ch) || ch == 0xa) + putchar(ch); + else + printf("%#x ", ch); + } + printf("\n"); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tkey: "); + for (i = 0; i < argp->key.size; i++) { + ch = ((u_int8_t *)argp->key.data)[i]; + if (isprint(ch) || ch == 0xa) + putchar(ch); + else + printf("%#x ", ch); + } + printf("\n"); + printf("\tdata: "); + for (i = 0; i < argp->data.size; i++) { + ch = ((u_int8_t *)argp->data.data)[i]; + if (isprint(ch) || ch == 0xa) + putchar(ch); + else + printf("%#x ", ch); + } + printf("\n"); + printf("\targ_flags: %lu\n", (u_long)argp->arg_flags); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __db_debug_read __P((void *, __db_debug_args **)); + */ +int +__db_debug_read(recbuf, argpp) + void *recbuf; + __db_debug_args **argpp; +{ + __db_debug_args *argp; + u_int8_t *bp; + + argp = (__db_debug_args *)__db_malloc(sizeof(__db_debug_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->op.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->op.data = bp; + bp += argp->op.size; + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->key.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->key.data = bp; + bp += argp->key.size; + memcpy(&argp->data.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->data.data = bp; + bp += argp->data.size; + memcpy(&argp->arg_flags, bp, sizeof(argp->arg_flags)); + bp += sizeof(argp->arg_flags); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __db_noop_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *)); + */ +int __db_noop_log(logp, txnid, ret_lsnp, flags, + fileid, pgno, prevlsn) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t fileid; + db_pgno_t pgno; + DB_LSN * prevlsn; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_db_noop; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(fileid) + + sizeof(pgno) + + sizeof(*prevlsn); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + memcpy(bp, &pgno, sizeof(pgno)); + bp += sizeof(pgno); + if (prevlsn != NULL) + memcpy(bp, prevlsn, sizeof(*prevlsn)); + else + memset(bp, 0, sizeof(*prevlsn)); + bp += sizeof(*prevlsn); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __db_noop_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_noop_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __db_noop_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __db_noop_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]db_noop: 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); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tpgno: %lu\n", (u_long)argp->pgno); + printf("\tprevlsn: [%lu][%lu]\n", + (u_long)argp->prevlsn.file, (u_long)argp->prevlsn.offset); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __db_noop_read __P((void *, __db_noop_args **)); + */ +int +__db_noop_read(recbuf, argpp) + void *recbuf; + __db_noop_args **argpp; +{ + __db_noop_args *argp; + u_int8_t *bp; + + argp = (__db_noop_args *)__db_malloc(sizeof(__db_noop_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->pgno, bp, sizeof(argp->pgno)); + bp += sizeof(argp->pgno); + memcpy(&argp->prevlsn, bp, sizeof(argp->prevlsn)); + bp += sizeof(argp->prevlsn); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __db_init_print __P((DB_ENV *)); + */ +int +__db_init_print(dbenv) + DB_ENV *dbenv; +{ + int ret; + + if ((ret = __db_add_recovery(dbenv, + __db_addrem_print, DB_db_addrem)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __db_split_print, DB_db_split)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __db_big_print, DB_db_big)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __db_ovref_print, DB_db_ovref)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __db_relink_print, DB_db_relink)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __db_addpage_print, DB_db_addpage)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __db_debug_print, DB_db_debug)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __db_noop_print, DB_db_noop)) != 0) + return (ret); + return (0); +} + +/* + * PUBLIC: int __db_init_recover __P((DB_ENV *)); + */ +int +__db_init_recover(dbenv) + DB_ENV *dbenv; +{ + int ret; + + if ((ret = __db_add_recovery(dbenv, + __db_addrem_recover, DB_db_addrem)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __db_split_recover, DB_db_split)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __db_big_recover, DB_db_big)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __db_ovref_recover, DB_db_ovref)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __db_relink_recover, DB_db_relink)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __db_addpage_recover, DB_db_addpage)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __db_debug_recover, DB_db_debug)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __db_noop_recover, DB_db_noop)) != 0) + return (ret); + return (0); +} + diff --git a/mozilla/db/db/db_conv.c b/mozilla/db/db/db_conv.c new file mode 100644 index 00000000000..8b5cf5f4a7b --- /dev/null +++ b/mozilla/db/db/db_conv.c @@ -0,0 +1,255 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * 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. + * + * 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)db_conv.c 10.13 (Sleepycat) 4/26/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "db_swap.h" +#include "db_am.h" + +static int __db_convert __P((db_pgno_t, void *, size_t, int)); + +/* + * __db_pgin -- + * + * PUBLIC: int __db_pgin __P((db_pgno_t, size_t, void *)); + */ +int +__db_pgin(pg, pagesize, pp) + db_pgno_t pg; + size_t pagesize; + void *pp; +{ + return (__db_convert(pg, pp, pagesize, 1)); +} + +/* + * __db_pgout -- + * + * PUBLIC: int __db_pgout __P((db_pgno_t, size_t, void *)); + */ +int +__db_pgout(pg, pagesize, pp) + db_pgno_t pg; + size_t pagesize; + void *pp; +{ + return (__db_convert(pg, pp, pagesize, 0)); +} + +/* + * __db_convert -- + * Actually convert a page. + */ +static int +__db_convert(pg, pp, pagesize, pgin) + db_pgno_t pg; + void *pp; + size_t pagesize; + int pgin; +{ + BINTERNAL *bi; + BKEYDATA *bk; + BOVERFLOW *bo; + PAGE *h; + RINTERNAL *ri; + db_indx_t i, len, tmp; + u_int8_t *p, *end; + + COMPQUIET(pg, 0); + + h = pp; + if (pgin) { + M_32_SWAP(h->lsn.file); + M_32_SWAP(h->lsn.offset); + M_32_SWAP(h->pgno); + M_32_SWAP(h->prev_pgno); + M_32_SWAP(h->next_pgno); + M_16_SWAP(h->entries); + M_16_SWAP(h->hf_offset); + } + + switch (h->type) { + case P_HASH: + for (i = 0; i < NUM_ENT(h); i++) { + if (pgin) + M_16_SWAP(h->inp[i]); + + switch (HPAGE_TYPE(h, i)) { + case H_KEYDATA: + break; + case H_DUPLICATE: + len = LEN_HKEYDATA(h, pagesize, i); + p = HKEYDATA_DATA(P_ENTRY(h, i)); + for (end = p + len; p < end;) { + if (pgin) { + P_16_SWAP(p); + memcpy(&tmp, + p, sizeof(db_indx_t)); + p += sizeof(db_indx_t); + } else { + memcpy(&tmp, + p, sizeof(db_indx_t)); + SWAP16(p); + } + p += tmp; + SWAP16(p); + } + break; + case H_OFFDUP: + p = HOFFPAGE_PGNO(P_ENTRY(h, i)); + SWAP32(p); /* pgno */ + break; + case H_OFFPAGE: + p = HOFFPAGE_PGNO(P_ENTRY(h, i)); + SWAP32(p); /* pgno */ + SWAP32(p); /* tlen */ + break; + } + + } + + /* + * The offsets in the inp array are used to determine + * the size of entries on a page; therefore they + * cannot be converted until we've done all the + * entries. + */ + if (!pgin) + for (i = 0; i < NUM_ENT(h); i++) + M_16_SWAP(h->inp[i]); + break; + case P_LBTREE: + case P_LRECNO: + case P_DUPLICATE: + for (i = 0; i < NUM_ENT(h); i++) { + if (pgin) + M_16_SWAP(h->inp[i]); + + bk = GET_BKEYDATA(h, i); + switch (B_TYPE(bk->type)) { + case B_KEYDATA: + M_16_SWAP(bk->len); + break; + case B_DUPLICATE: + case B_OVERFLOW: + bo = (BOVERFLOW *)bk; + M_32_SWAP(bo->pgno); + M_32_SWAP(bo->tlen); + break; + } + + if (!pgin) + M_16_SWAP(h->inp[i]); + } + break; + case P_IBTREE: + for (i = 0; i < NUM_ENT(h); i++) { + if (pgin) + M_16_SWAP(h->inp[i]); + + bi = GET_BINTERNAL(h, i); + M_16_SWAP(bi->len); + M_32_SWAP(bi->pgno); + M_32_SWAP(bi->nrecs); + + switch (B_TYPE(bi->type)) { + case B_KEYDATA: + break; + case B_DUPLICATE: + case B_OVERFLOW: + bo = (BOVERFLOW *)bi->data; + M_32_SWAP(bo->pgno); + M_32_SWAP(bo->tlen); + break; + } + + if (!pgin) + M_16_SWAP(h->inp[i]); + } + break; + case P_IRECNO: + for (i = 0; i < NUM_ENT(h); i++) { + if (pgin) + M_16_SWAP(h->inp[i]); + + ri = GET_RINTERNAL(h, i); + M_32_SWAP(ri->pgno); + M_32_SWAP(ri->nrecs); + + if (!pgin) + M_16_SWAP(h->inp[i]); + } + break; + case P_OVERFLOW: + case P_INVALID: + /* Nothing to do. */ + break; + default: + return (EINVAL); + } + + if (!pgin) { + /* Swap the header information. */ + M_32_SWAP(h->lsn.file); + M_32_SWAP(h->lsn.offset); + M_32_SWAP(h->pgno); + M_32_SWAP(h->prev_pgno); + M_32_SWAP(h->next_pgno); + M_16_SWAP(h->entries); + M_16_SWAP(h->hf_offset); + } + return (0); +} diff --git a/mozilla/db/db/db_dispatch.c b/mozilla/db/db/db_dispatch.c new file mode 100644 index 00000000000..8645948614e --- /dev/null +++ b/mozilla/db/db/db_dispatch.c @@ -0,0 +1,323 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1995, 1996 + * The President and Fellows of Harvard University. 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. 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)db_dispatch.c 10.14 (Sleepycat) 5/3/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "db_dispatch.h" +#include "db_am.h" +#include "common_ext.h" +#include "log_auto.h" +#include "txn_auto.h" + +/* + * Data structures to manage the DB dispatch table. The dispatch table + * is a dynamically allocated array of pointers to dispatch functions. + * The dispatch_size is the number of entries possible in the current + * dispatch table and the dispatch_valid is the number of valid entries + * in the dispatch table. + */ +static int (**dispatch_table) __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +static u_int32_t dispatch_size = 0; + +/* + * __db_dispatch -- + * + * This is the transaction dispatch function used by the db access methods. + * It is designed to handle the record format used by all the access + * methods (the one automatically generated by the db_{h,log,read}.sh + * scripts in the tools directory). An application using a different + * recovery paradigm will supply a different dispatch function to txn_open. + * + * PUBLIC: int __db_dispatch __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_dispatch(logp, db, lsnp, redo, info) + DB_LOG *logp; /* The log file. */ + DBT *db; /* The log record upon which to dispatch. */ + DB_LSN *lsnp; /* The lsn of the record being dispatched. */ + int redo; /* Redo this op (or undo it). */ + void *info; +{ + u_int32_t rectype, txnid; + + memcpy(&rectype, db->data, sizeof(rectype)); + memcpy(&txnid, (u_int8_t *)db->data + sizeof(rectype), sizeof(txnid)); + + switch (redo) { + case TXN_REDO: + case TXN_UNDO: + return ((dispatch_table[rectype])(logp, db, lsnp, redo, info)); + case TXN_OPENFILES: + if (rectype < DB_txn_BEGIN ) + return ((dispatch_table[rectype])(logp, + db, lsnp, redo, info)); + break; + case TXN_BACKWARD_ROLL: + /* + * Running full recovery in the backward pass. If we've + * seen this txnid before and added to it our commit list, + * then we do nothing during this pass. If we've never + * seen it, then we call the appropriate recovery routine + * in "abort mode". + */ + if (rectype == DB_log_register || rectype == DB_txn_ckp || + __db_txnlist_find(info, txnid) == DB_NOTFOUND) + return ((dispatch_table[rectype])(logp, + db, lsnp, TXN_UNDO, info)); + break; + case TXN_FORWARD_ROLL: + /* + * In the forward pass, if we haven't seen the transaction, + * do nothing, else recovery it. + */ + if (rectype == DB_log_register || rectype == DB_txn_ckp || + __db_txnlist_find(info, txnid) != DB_NOTFOUND) + return ((dispatch_table[rectype])(logp, + db, lsnp, TXN_REDO, info)); + break; + default: + abort(); + } + return (0); +} + +/* + * __db_add_recovery -- + * + * PUBLIC: int __db_add_recovery __P((DB_ENV *, + * PUBLIC: int (*)(DB_LOG *, DBT *, DB_LSN *, int, void *), u_int32_t)); + */ +int +__db_add_recovery(dbenv, func, ndx) + DB_ENV *dbenv; + int (*func) __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + u_int32_t ndx; +{ + u_int32_t i; + + /* Check if function is already registered. */ + if (dispatch_table && ndx < dispatch_size && + dispatch_table[ndx] != 0 && dispatch_table[ndx] != func) + return (DB_REGISTERED); + + /* Check if we have to grow the table. */ + if (ndx >= dispatch_size) { + if (dispatch_table == NULL) + dispatch_table = (int (**) + __P((DB_LOG *, DBT *, DB_LSN *, int, void *))) + __db_malloc(DB_user_BEGIN * sizeof(dispatch_table[0])); + else + dispatch_table = (int (**) + __P((DB_LOG *, DBT *, DB_LSN *, int, void *))) + __db_realloc(dispatch_table, (DB_user_BEGIN + + dispatch_size) * sizeof(dispatch_table[0])); + if (dispatch_table == NULL) { + __db_err(dbenv, "%s", strerror(ENOMEM)); + return (ENOMEM); + } + for (i = dispatch_size, + dispatch_size += DB_user_BEGIN; i < dispatch_size; ++i) + dispatch_table[i] = NULL; + } + + dispatch_table[ndx] = func; + return (0); +} + +/* + * __db_txnlist_init -- + * Initialize transaction linked list. + * + * PUBLIC: int __db_txnlist_init __P((void *)); + */ +int +__db_txnlist_init(retp) + void *retp; +{ + DB_TXNHEAD *headp; + + if ((headp = (DB_TXNHEAD *)__db_malloc(sizeof(DB_TXNHEAD))) == NULL) + return (ENOMEM); + + LIST_INIT(&headp->head); + headp->maxid = 0; + headp->generation = 1; + + *(void **)retp = headp; + return (0); +} + +/* + * __db_txnlist_add -- + * Add an element to our transaction linked list. + * + * PUBLIC: int __db_txnlist_add __P((void *, u_int32_t)); + */ +int +__db_txnlist_add(listp, txnid) + void *listp; + u_int32_t txnid; +{ + DB_TXNHEAD *hp; + DB_TXNLIST *elp; + + if ((elp = (DB_TXNLIST *)__db_malloc(sizeof(DB_TXNLIST))) == NULL) + return (ENOMEM); + + elp->txnid = txnid; + hp = (DB_TXNHEAD *)listp; + LIST_INSERT_HEAD(&hp->head, elp, links); + if (txnid > hp->maxid) + hp->maxid = txnid; + elp->generation = hp->generation; + + return (0); +} + +/* + * __db_txnlist_find -- + * Checks to see if a txnid with the current generation is in the + * txnid list. + * + * PUBLIC: int __db_txnlist_find __P((void *, u_int32_t)); + */ +int +__db_txnlist_find(listp, txnid) + void *listp; + u_int32_t txnid; +{ + DB_TXNHEAD *hp; + DB_TXNLIST *p; + + if ((hp = (DB_TXNHEAD *)listp) == NULL) + return (DB_NOTFOUND); + + for (p = hp->head.lh_first; p != NULL; p = p->links.le_next) + if (p->txnid == txnid && hp->generation == p->generation) + return (0); + + return (DB_NOTFOUND); +} + +/* + * __db_txnlist_end -- + * Discard transaction linked list. + * + * PUBLIC: void __db_txnlist_end __P((void *)); + */ +void +__db_txnlist_end(listp) + void *listp; +{ + DB_TXNHEAD *hp; + DB_TXNLIST *p; + + hp = (DB_TXNHEAD *)listp; + while ((p = LIST_FIRST(&hp->head)) != LIST_END(&hp->head)) { + LIST_REMOVE(p, links); + __db_free(p); + } + __db_free(listp); +} + +/* + * __db_txnlist_gen -- + * Change the current generation number. + * + * PUBLIC: void __db_txnlist_gen __P((void *, int)); + */ +void +__db_txnlist_gen(listp, incr) + void *listp; + int incr; +{ + DB_TXNHEAD *hp; + + /* + * During recovery generation numbers keep track of how many "restart" + * checkpoints we've seen. Restart checkpoints occur whenever we take + * a checkpoint and there are no outstanding transactions. When that + * happens, we can reset transaction IDs back to 1. It always happens + * at recovery and it prevents us from exhausting the transaction IDs + * name space. + */ + hp = (DB_TXNHEAD *)listp; + hp->generation += incr; +} + +#ifdef DEBUG +/* + * __db_txnlist_print -- + * Print out the transaction list. + * + * PUBLIC: void __db_txnlist_print __P((void *)); + */ +void +__db_txnlist_print(listp) + void *listp; +{ + DB_TXNHEAD *hp; + DB_TXNLIST *p; + + hp = (DB_TXNHEAD *)listp; + printf("Maxid: %lu Generation: %lu\n", (u_long)hp->maxid, + (u_long)hp->generation); + for (p = hp->head.lh_first; p != NULL; p = p->links.le_next) + printf("TXNID: %lu(%lu)\n", (u_long)p->txnid, + (u_long)p->generation); +} +#endif diff --git a/mozilla/db/db/db_dup.c b/mozilla/db/db/db_dup.c new file mode 100644 index 00000000000..6379fc1729c --- /dev/null +++ b/mozilla/db/db/db_dup.c @@ -0,0 +1,668 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)db_dup.c 10.18 (Sleepycat) 5/31/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "btree.h" +#include "db_am.h" + +static int __db_addpage __P((DB *, + PAGE **, db_indx_t *, int (*)(DB *, u_int32_t, PAGE **))); +static int __db_dsplit __P((DB *, + PAGE **, db_indx_t *, u_int32_t, int (*)(DB *, u_int32_t, PAGE **))); + +/* + * __db_dput -- + * Put a duplicate item onto a duplicate page at the given index. + * + * PUBLIC: int __db_dput __P((DB *, + * PUBLIC: DBT *, PAGE **, db_indx_t *, int (*)(DB *, u_int32_t, PAGE **))); + */ +int +__db_dput(dbp, dbt, pp, indxp, newfunc) + DB *dbp; + DBT *dbt; + PAGE **pp; + db_indx_t *indxp; + int (*newfunc) __P((DB *, u_int32_t, PAGE **)); +{ + BOVERFLOW bo; + DBT *data_dbtp, hdr_dbt, *hdr_dbtp; + PAGE *pagep; + db_indx_t size, isize; + db_pgno_t pgno; + int ret; + + /* + * We need some access method independent threshold for when we put + * a duplicate item onto an overflow page. + */ + if (dbt->size > 0.25 * dbp->pgsize) { + if ((ret = __db_poff(dbp, dbt, &pgno, newfunc)) != 0) + return (ret); + B_TSET(bo.type, B_OVERFLOW, 0); + bo.tlen = dbt->size; + bo.pgno = pgno; + hdr_dbt.data = &bo; + hdr_dbt.size = isize = BOVERFLOW_SIZE; + hdr_dbtp = &hdr_dbt; + size = BOVERFLOW_PSIZE; + data_dbtp = NULL; + } else { + size = BKEYDATA_PSIZE(dbt->size); + isize = BKEYDATA_SIZE(dbt->size); + hdr_dbtp = NULL; + data_dbtp = dbt; + } + + pagep = *pp; + if (size > P_FREESPACE(pagep)) { + if (*indxp == NUM_ENT(*pp) && NEXT_PGNO(*pp) == PGNO_INVALID) + ret = __db_addpage(dbp, pp, indxp, newfunc); + else + ret = __db_dsplit(dbp, pp, indxp, isize, newfunc); + if (ret != 0) + /* XXX: Pages not returned to free list. */ + return (ret); + pagep = *pp; + } + + /* + * Now, pagep references the page on which to insert and indx is the + * the location to insert. + */ + if ((ret = __db_pitem(dbp, + pagep, (u_int32_t)*indxp, isize, hdr_dbtp, data_dbtp)) != 0) + return (ret); + + (void)memp_fset(dbp->mpf, pagep, DB_MPOOL_DIRTY); + return (0); +} + +/* + * __db_drem -- + * Remove a duplicate at the given index on the given page. + * + * PUBLIC: int __db_drem __P((DB *, + * PUBLIC: PAGE **, u_int32_t, int (*)(DB *, PAGE *))); + */ +int +__db_drem(dbp, pp, indx, freefunc) + DB *dbp; + PAGE **pp; + u_int32_t indx; + int (*freefunc) __P((DB *, PAGE *)); +{ + PAGE *pagep; + int ret; + + pagep = *pp; + + /* Check if we are freeing a big item. */ + if (B_TYPE(GET_BKEYDATA(pagep, indx)->type) == B_OVERFLOW) { + if ((ret = __db_doff(dbp, + GET_BOVERFLOW(pagep, indx)->pgno, freefunc)) != 0) + return (ret); + ret = __db_ditem(dbp, pagep, indx, BOVERFLOW_SIZE); + } else + ret = __db_ditem(dbp, pagep, indx, + BKEYDATA_SIZE(GET_BKEYDATA(pagep, indx)->len)); + if (ret != 0) + return (ret); + + if (NUM_ENT(pagep) == 0) { + /* + * If the page is emptied, then the page is freed and the pp + * parameter is set to reference the next, locked page in the + * duplicate chain, if one exists. If there was no such page, + * then it is set to NULL. + * + * !!! + * __db_relink will set the dirty bit for us. + */ + if ((ret = __db_relink(dbp, pagep, pp, 0)) != 0) + return (ret); + if ((ret = freefunc(dbp, pagep)) != 0) + return (ret); + } else + (void)memp_fset(dbp->mpf, pagep, DB_MPOOL_DIRTY); + + return (0); +} + +/* + * __db_dend -- + * Find the last page in a set of offpage duplicates. + * + * PUBLIC: int __db_dend __P((DB *, db_pgno_t, PAGE **)); + */ +int +__db_dend(dbp, pgno, pagep) + DB *dbp; + db_pgno_t pgno; + PAGE **pagep; +{ + PAGE *h; + int ret; + + /* + * This implements DB_KEYLAST. The last page is returned in pp; pgno + * should be the page number of the first page of the duplicate chain. + */ + for (;;) { + if ((ret = memp_fget(dbp->mpf, &pgno, 0, &h)) != 0) { + (void)__db_pgerr(dbp, pgno); + return (ret); + } + if ((pgno = NEXT_PGNO(h)) == PGNO_INVALID) + break; + (void)memp_fput(dbp->mpf, h, 0); + } + + *pagep = h; + return (0); +} + +/* + * __db_dsplit -- + * Split a page of duplicates, calculating the split point based + * on an element of size "size" being added at "*indxp". + * On entry hp contains a pointer to the page-pointer of the original + * page. On exit, it returns a pointer to the page containing "*indxp" + * and "indxp" has been modified to reflect the index on the new page + * where the element should be added. The function returns with + * the page on which the insert should happen, not yet put. + */ +static int +__db_dsplit(dbp, hp, indxp, size, newfunc) + DB *dbp; + PAGE **hp; + db_indx_t *indxp; + u_int32_t size; + int (*newfunc) __P((DB *, u_int32_t, PAGE **)); +{ + PAGE *h, *np, *tp; + BKEYDATA *bk; + DBT page_dbt; + db_indx_t halfbytes, i, indx, lastsum, nindex, oindex, s, sum; + int did_indx, ret; + + h = *hp; + indx = *indxp; + + /* Create a temporary page to do compaction onto. */ + if ((tp = (PAGE *)__db_malloc(dbp->pgsize)) == NULL) + return (ENOMEM); +#ifdef DIAGNOSTIC + memset(tp, 0xff, dbp->pgsize); +#endif + /* Create new page for the split. */ + if ((ret = newfunc(dbp, P_DUPLICATE, &np)) != 0) { + FREE(tp, dbp->pgsize); + return (ret); + } + + P_INIT(np, dbp->pgsize, PGNO(np), PGNO(h), NEXT_PGNO(h), 0, + P_DUPLICATE); + P_INIT(tp, dbp->pgsize, PGNO(h), PREV_PGNO(h), PGNO(np), 0, + P_DUPLICATE); + + /* Figure out the split point */ + halfbytes = (dbp->pgsize - HOFFSET(h)) / 2; + did_indx = 0; + for (sum = 0, lastsum = 0, i = 0; i < NUM_ENT(h); i++) { + if (i == indx) { + sum += size; + did_indx = 1; + if (lastsum < halfbytes && sum >= halfbytes) { + /* We've crossed the halfway point. */ + if ((db_indx_t)(halfbytes - lastsum) < + (db_indx_t)(sum - halfbytes)) { + *hp = np; + *indxp = 0; + i--; + } else + *indxp = i; + break; + } + *indxp = i; + lastsum = sum; + } + if (B_TYPE(GET_BKEYDATA(h, i)->type) == B_KEYDATA) + sum += BKEYDATA_SIZE(GET_BKEYDATA(h, i)->len); + else + sum += BOVERFLOW_SIZE; + + if (lastsum < halfbytes && sum >= halfbytes) { + /* We've crossed the halfway point. */ + if ((db_indx_t)(halfbytes - lastsum) < + (db_indx_t)(sum - halfbytes)) + i--; + break; + } + } + + /* + * Check if we have set the return values of the index pointer and + * page pointer. + */ + if (!did_indx) { + *hp = np; + *indxp = indx - i - 1; + } + + if (DB_LOGGING(dbp)) { + page_dbt.size = dbp->pgsize; + page_dbt.data = h; + if ((ret = __db_split_log(dbp->dbenv->lg_info, + dbp->txn, &LSN(h), 0, DB_SPLITOLD, dbp->log_fileid, + PGNO(h), &page_dbt, &LSN(h))) != 0) { + FREE(tp, dbp->pgsize); + return (ret); + } + LSN(tp) = LSN(h); + } + + /* + * If it's a btree, adjust the cursors. + * + * i is the index of the last element to stay on the page. + */ + if (dbp->type == DB_BTREE || dbp->type == DB_RECNO) + __bam_ca_split(dbp, PGNO(h), PGNO(h), PGNO(np), i + 1, 0); + + for (nindex = 0, oindex = i + 1; oindex < NUM_ENT(h); oindex++) { + bk = GET_BKEYDATA(h, oindex); + if (B_TYPE(bk->type) == B_KEYDATA) + s = BKEYDATA_SIZE(bk->len); + else + s = BOVERFLOW_SIZE; + + np->inp[nindex++] = HOFFSET(np) -= s; + memcpy((u_int8_t *)np + HOFFSET(np), bk, s); + NUM_ENT(np)++; + } + + /* + * Now do data compaction by copying the remaining stuff onto the + * temporary page and then copying it back to the real page. + */ + for (nindex = 0, oindex = 0; oindex <= i; oindex++) { + bk = GET_BKEYDATA(h, oindex); + if (B_TYPE(bk->type) == B_KEYDATA) + s = BKEYDATA_SIZE(bk->len); + else + s = BOVERFLOW_SIZE; + + tp->inp[nindex++] = HOFFSET(tp) -= s; + memcpy((u_int8_t *)tp + HOFFSET(tp), bk, s); + NUM_ENT(tp)++; + } + + /* + * This page (the temporary) should be only half full, so we do two + * memcpy's, one for the top of the page and one for the bottom of + * the page. This way we avoid copying the middle which should be + * about half a page. + */ + memcpy(h, tp, LOFFSET(tp)); + memcpy((u_int8_t *)h + HOFFSET(tp), + (u_int8_t *)tp + HOFFSET(tp), dbp->pgsize - HOFFSET(tp)); + FREE(tp, dbp->pgsize); + + if (DB_LOGGING(dbp)) { + page_dbt.size = dbp->pgsize; + page_dbt.data = h; + if ((ret = __db_split_log(dbp->dbenv->lg_info, + dbp->txn, &LSN(h), 0, DB_SPLITNEW, dbp->log_fileid, + PGNO(h), &page_dbt, &LSN(h))) != 0) + return (ret); + + page_dbt.size = dbp->pgsize; + page_dbt.data = np; + if ((ret = __db_split_log(dbp->dbenv->lg_info, + dbp->txn, &LSN(np), 0, DB_SPLITNEW, dbp->log_fileid, + PGNO(np), &page_dbt, &LSN(np))) != 0) + return (ret); + } + + /* + * Figure out if the location we're interested in is on the new + * page, and if so, reset the callers' pointer. Push the other + * page back to the store. + */ + if (*hp == h) + ret = memp_fput(dbp->mpf, np, DB_MPOOL_DIRTY); + else + ret = memp_fput(dbp->mpf, h, DB_MPOOL_DIRTY); + + return (ret); +} + +/* + * __db_ditem -- + * Remove an item from a page. + * + * PUBLIC: int __db_ditem __P((DB *, PAGE *, u_int32_t, u_int32_t)); + */ +int +__db_ditem(dbp, pagep, indx, nbytes) + DB *dbp; + PAGE *pagep; + u_int32_t indx, nbytes; +{ + DBT ldbt; + db_indx_t cnt, offset; + int ret; + u_int8_t *from; + + if (DB_LOGGING(dbp)) { + ldbt.data = P_ENTRY(pagep, indx); + ldbt.size = nbytes; + if ((ret = __db_addrem_log(dbp->dbenv->lg_info, dbp->txn, + &LSN(pagep), 0, DB_REM_DUP, dbp->log_fileid, PGNO(pagep), + (u_int32_t)indx, nbytes, &ldbt, NULL, &LSN(pagep))) != 0) + return (ret); + } + + /* + * If there's only a single item on the page, we don't have to + * work hard. + */ + if (NUM_ENT(pagep) == 1) { + NUM_ENT(pagep) = 0; + HOFFSET(pagep) = dbp->pgsize; + return (0); + } + + /* + * Pack the remaining key/data items at the end of the page. Use + * memmove(3), the regions may overlap. + */ + from = (u_int8_t *)pagep + HOFFSET(pagep); + memmove(from + nbytes, from, pagep->inp[indx] - HOFFSET(pagep)); + HOFFSET(pagep) += nbytes; + + /* Adjust the indices' offsets. */ + offset = pagep->inp[indx]; + for (cnt = 0; cnt < NUM_ENT(pagep); ++cnt) + if (pagep->inp[cnt] < offset) + pagep->inp[cnt] += nbytes; + + /* Shift the indices down. */ + --NUM_ENT(pagep); + if (indx != NUM_ENT(pagep)) + memmove(&pagep->inp[indx], &pagep->inp[indx + 1], + sizeof(db_indx_t) * (NUM_ENT(pagep) - indx)); + + /* If it's a btree, adjust the cursors. */ + if (dbp->type == DB_BTREE || dbp->type == DB_RECNO) + __bam_ca_di(dbp, PGNO(pagep), indx, -1); + + return (0); +} + +/* + * __db_pitem -- + * Put an item on a page. + * + * PUBLIC: int __db_pitem + * PUBLIC: __P((DB *, PAGE *, u_int32_t, u_int32_t, DBT *, DBT *)); + */ +int +__db_pitem(dbp, pagep, indx, nbytes, hdr, data) + DB *dbp; + PAGE *pagep; + u_int32_t indx; + u_int32_t nbytes; + DBT *hdr, *data; +{ + BKEYDATA bk; + DBT thdr; + int ret; + u_int8_t *p; + + /* + * Put a single item onto a page. The logic figuring out where to + * insert and whether it fits is handled in the caller. All we do + * here is manage the page shuffling. We cheat a little bit in that + * we don't want to copy the dbt on a normal put twice. If hdr is + * NULL, we create a BKEYDATA structure on the page, otherwise, just + * copy the caller's information onto the page. + * + * This routine is also used to put entries onto the page where the + * entry is pre-built, e.g., during recovery. In this case, the hdr + * will point to the entry, and the data argument will be NULL. + * + * !!! + * There's a tremendous potential for off-by-one errors here, since + * the passed in header sizes must be adjusted for the structure's + * placeholder for the trailing variable-length data field. + */ + if (DB_LOGGING(dbp)) + if ((ret = __db_addrem_log(dbp->dbenv->lg_info, dbp->txn, + &LSN(pagep), 0, DB_ADD_DUP, dbp->log_fileid, PGNO(pagep), + (u_int32_t)indx, nbytes, hdr, data, &LSN(pagep))) != 0) + return (ret); + + if (hdr == NULL) { + B_TSET(bk.type, B_KEYDATA, 0); + bk.len = data == NULL ? 0 : data->size; + + thdr.data = &bk; + thdr.size = SSZA(BKEYDATA, data); + hdr = &thdr; + } + + /* Adjust the index table, then put the item on the page. */ + if (indx != NUM_ENT(pagep)) + memmove(&pagep->inp[indx + 1], &pagep->inp[indx], + sizeof(db_indx_t) * (NUM_ENT(pagep) - indx)); + HOFFSET(pagep) -= nbytes; + pagep->inp[indx] = HOFFSET(pagep); + ++NUM_ENT(pagep); + + p = P_ENTRY(pagep, indx); + memcpy(p, hdr->data, hdr->size); + if (data != NULL) + memcpy(p + hdr->size, data->data, data->size); + + /* If it's a btree, adjust the cursors. */ + if (dbp->type == DB_BTREE || dbp->type == DB_RECNO) + __bam_ca_di(dbp, PGNO(pagep), indx, 1); + + return (0); +} + +/* + * __db_relink -- + * Relink around a deleted page. + * + * PUBLIC: int __db_relink __P((DB *, PAGE *, PAGE **, int)); + */ +int +__db_relink(dbp, pagep, new_next, needlock) + DB *dbp; + PAGE *pagep, **new_next; + int needlock; +{ + PAGE *np, *pp; + DB_LOCK npl, ppl; + DB_LSN *nlsnp, *plsnp; + int ret; + + ret = 0; + np = pp = NULL; + npl = ppl = LOCK_INVALID; + nlsnp = plsnp = NULL; + + /* Retrieve and lock the two pages. */ + if (pagep->next_pgno != PGNO_INVALID) { + if (needlock && (ret = __bam_lget(dbp, + 0, pagep->next_pgno, DB_LOCK_WRITE, &npl)) != 0) + goto err; + if ((ret = memp_fget(dbp->mpf, + &pagep->next_pgno, 0, &np)) != 0) { + (void)__db_pgerr(dbp, pagep->next_pgno); + goto err; + } + nlsnp = &np->lsn; + } + if (pagep->prev_pgno != PGNO_INVALID) { + if (needlock && (ret = __bam_lget(dbp, + 0, pagep->prev_pgno, DB_LOCK_WRITE, &ppl)) != 0) + goto err; + if ((ret = memp_fget(dbp->mpf, + &pagep->prev_pgno, 0, &pp)) != 0) { + (void)__db_pgerr(dbp, pagep->next_pgno); + goto err; + } + plsnp = &pp->lsn; + } + + /* Log the change. */ + if (DB_LOGGING(dbp)) { + if ((ret = __db_relink_log(dbp->dbenv->lg_info, dbp->txn, + &pagep->lsn, 0, dbp->log_fileid, pagep->pgno, &pagep->lsn, + pagep->prev_pgno, plsnp, pagep->next_pgno, nlsnp)) != 0) + goto err; + if (np != NULL) + np->lsn = pagep->lsn; + if (pp != NULL) + pp->lsn = pagep->lsn; + } + + /* + * Modify and release the two pages. + * + * !!! + * The parameter new_next gets set to the page following the page we + * are removing. If there is no following page, then new_next gets + * set to NULL. + */ + if (np != NULL) { + np->prev_pgno = pagep->prev_pgno; + if (new_next == NULL) + ret = memp_fput(dbp->mpf, np, DB_MPOOL_DIRTY); + else { + *new_next = np; + ret = memp_fset(dbp->mpf, np, DB_MPOOL_DIRTY); + } + if (ret != 0) + goto err; + if (needlock) + (void)__bam_lput(dbp, npl); + } else if (new_next != NULL) + *new_next = NULL; + + if (pp != NULL) { + pp->next_pgno = pagep->next_pgno; + if ((ret = memp_fput(dbp->mpf, pp, DB_MPOOL_DIRTY)) != 0) + goto err; + if (needlock) + (void)__bam_lput(dbp, ppl); + } + return (0); + +err: if (np != NULL) + (void)memp_fput(dbp->mpf, np, 0); + if (needlock && npl != LOCK_INVALID) + (void)__bam_lput(dbp, npl); + if (pp != NULL) + (void)memp_fput(dbp->mpf, pp, 0); + if (needlock && ppl != LOCK_INVALID) + (void)__bam_lput(dbp, ppl); + return (ret); +} + +/* + * __db_ddup -- + * Delete an offpage chain of duplicates. + * + * PUBLIC: int __db_ddup __P((DB *, db_pgno_t, int (*)(DB *, PAGE *))); + */ +int +__db_ddup(dbp, pgno, freefunc) + DB *dbp; + db_pgno_t pgno; + int (*freefunc) __P((DB *, PAGE *)); +{ + PAGE *pagep; + DBT tmp_dbt; + int ret; + + do { + if ((ret = memp_fget(dbp->mpf, &pgno, 0, &pagep)) != 0) { + (void)__db_pgerr(dbp, pgno); + return (ret); + } + + if (DB_LOGGING(dbp)) { + tmp_dbt.data = pagep; + tmp_dbt.size = dbp->pgsize; + if ((ret = __db_split_log(dbp->dbenv->lg_info, dbp->txn, + &LSN(pagep), 0, DB_SPLITOLD, dbp->log_fileid, + PGNO(pagep), &tmp_dbt, &LSN(pagep))) != 0) + return (ret); + } + pgno = pagep->next_pgno; + if ((ret = freefunc(dbp, pagep)) != 0) + return (ret); + } while (pgno != PGNO_INVALID); + + return (0); +} + +/* + * __db_addpage -- + * Create a new page and link it onto the next_pgno field of the + * current page. + */ +static int +__db_addpage(dbp, hp, indxp, newfunc) + DB *dbp; + PAGE **hp; + db_indx_t *indxp; + int (*newfunc) __P((DB *, u_int32_t, PAGE **)); +{ + PAGE *newpage; + int ret; + + if ((ret = newfunc(dbp, P_DUPLICATE, &newpage)) != 0) + return (ret); + + if (DB_LOGGING(dbp)) { + if ((ret = __db_addpage_log(dbp->dbenv->lg_info, + dbp->txn, &LSN(*hp), 0, dbp->log_fileid, + PGNO(*hp), &LSN(*hp), PGNO(newpage), &LSN(newpage))) != 0) { + return (ret); + } + LSN(newpage) = LSN(*hp); + } + + PREV_PGNO(newpage) = PGNO(*hp); + NEXT_PGNO(*hp) = PGNO(newpage); + + if ((ret = memp_fput(dbp->mpf, *hp, DB_MPOOL_DIRTY)) != 0) + return (ret); + *hp = newpage; + *indxp = 0; + return (0); +} diff --git a/mozilla/db/db/db_overflow.c b/mozilla/db/db/db_overflow.c new file mode 100644 index 00000000000..d28740dcbea --- /dev/null +++ b/mozilla/db/db/db_overflow.c @@ -0,0 +1,382 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * 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. 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)db_overflow.c 10.11 (Sleepycat) 5/7/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "db_am.h" + +/* + * Big key/data code. + * + * Big key and data entries are stored on linked lists of pages. The initial + * reference is a structure with the total length of the item and the page + * number where it begins. Each entry in the linked list contains a pointer + * to the next page of data, and so on. + */ + +/* + * __db_goff -- + * Get an offpage item. + * + * PUBLIC: int __db_goff __P((DB *, DBT *, + * PUBLIC: u_int32_t, db_pgno_t, void **, u_int32_t *)); + */ +int +__db_goff(dbp, dbt, tlen, pgno, bpp, bpsz) + DB *dbp; + DBT *dbt; + u_int32_t tlen; + db_pgno_t pgno; + void **bpp; + u_int32_t *bpsz; +{ + PAGE *h; + db_indx_t bytes; + u_int32_t curoff, needed, start; + u_int8_t *p, *src; + int ret; + + /* + * Check if the buffer is big enough; if it is not and we are + * allowed to malloc space, then we'll malloc it. If we are + * not (DB_DBT_USERMEM), then we'll set the dbt and return + * appropriately. + */ + if (F_ISSET(dbt, DB_DBT_PARTIAL)) { + start = dbt->doff; + needed = dbt->dlen; + } else { + start = 0; + needed = tlen; + } + + /* + * Allocate any necessary memory. + * + * XXX: Never allocate 0 bytes; + */ + if (F_ISSET(dbt, DB_DBT_USERMEM)) { + if (needed > dbt->ulen) { + dbt->size = needed; + return (ENOMEM); + } + } else if (F_ISSET(dbt, DB_DBT_MALLOC)) { + dbt->data = dbp->db_malloc == NULL ? + (void *)__db_malloc(needed + 1) : + (void *)dbp->db_malloc(needed + 1); + if (dbt->data == NULL) + return (ENOMEM); + } else if (*bpsz == 0 || *bpsz < needed) { + *bpp = (*bpp == NULL ? + (void *)__db_malloc(needed + 1) : + (void *)__db_realloc(*bpp, needed + 1)); + if (*bpp == NULL) + return (ENOMEM); + *bpsz = needed + 1; + dbt->data = *bpp; + } else + dbt->data = *bpp; + + /* + * Step through the linked list of pages, copying the data on each + * one into the buffer. Never copy more than the total data length. + */ + dbt->size = needed; + for (curoff = 0, p = dbt->data; pgno != P_INVALID && needed > 0;) { + if ((ret = memp_fget(dbp->mpf, &pgno, 0, &h)) != 0) { + (void)__db_pgerr(dbp, pgno); + return (ret); + } + /* Check if we need any bytes from this page. */ + if (curoff + OV_LEN(h) >= start) { + src = (u_int8_t *)h + P_OVERHEAD; + bytes = OV_LEN(h); + if (start > curoff) { + src += start - curoff; + bytes -= start - curoff; + } + if (bytes > needed) + bytes = needed; + memcpy(p, src, bytes); + p += bytes; + needed -= bytes; + } + curoff += OV_LEN(h); + pgno = h->next_pgno; + memp_fput(dbp->mpf, h, 0); + } + return (0); +} + +/* + * __db_poff -- + * Put an offpage item. + * + * PUBLIC: int __db_poff __P((DB *, const DBT *, db_pgno_t *, + * PUBLIC: int (*)(DB *, u_int32_t, PAGE **))); + */ +int +__db_poff(dbp, dbt, pgnop, newfunc) + DB *dbp; + const DBT *dbt; + db_pgno_t *pgnop; + int (*newfunc) __P((DB *, u_int32_t, PAGE **)); +{ + PAGE *pagep, *lastp; + DB_LSN new_lsn, null_lsn; + DBT tmp_dbt; + db_indx_t pagespace; + u_int32_t sz; + u_int8_t *p; + int ret; + + /* + * Allocate pages and copy the key/data item into them. Calculate the + * number of bytes we get for pages we fill completely with a single + * item. + */ + pagespace = P_MAXSPACE(dbp->pgsize); + + lastp = NULL; + for (p = dbt->data, + sz = dbt->size; sz > 0; p += pagespace, sz -= pagespace) { + /* + * Reduce pagespace so we terminate the loop correctly and + * don't copy too much data. + */ + if (sz < pagespace) + pagespace = sz; + + /* + * Allocate and initialize a new page and copy all or part of + * the item onto the page. If sz is less than pagespace, we + * have a partial record. + */ + if ((ret = newfunc(dbp, P_OVERFLOW, &pagep)) != 0) + return (ret); + if (DB_LOGGING(dbp)) { + tmp_dbt.data = p; + tmp_dbt.size = pagespace; + ZERO_LSN(null_lsn); + if ((ret = __db_big_log(dbp->dbenv->lg_info, dbp->txn, + &new_lsn, 0, DB_ADD_BIG, dbp->log_fileid, + PGNO(pagep), lastp ? PGNO(lastp) : PGNO_INVALID, + PGNO_INVALID, &tmp_dbt, &LSN(pagep), + lastp == NULL ? &null_lsn : &LSN(lastp), + &null_lsn)) != 0) + return (ret); + + /* Move lsn onto page. */ + if (lastp) + LSN(lastp) = new_lsn; + LSN(pagep) = new_lsn; + } + + P_INIT(pagep, dbp->pgsize, + PGNO(pagep), PGNO_INVALID, PGNO_INVALID, 0, P_OVERFLOW); + OV_LEN(pagep) = pagespace; + OV_REF(pagep) = 1; + memcpy((u_int8_t *)pagep + P_OVERHEAD, p, pagespace); + + /* + * If this is the first entry, update the user's info. + * Otherwise, update the entry on the last page filled + * in and release that page. + */ + if (lastp == NULL) + *pgnop = PGNO(pagep); + else { + lastp->next_pgno = PGNO(pagep); + pagep->prev_pgno = PGNO(lastp); + (void)memp_fput(dbp->mpf, lastp, DB_MPOOL_DIRTY); + } + lastp = pagep; + } + (void)memp_fput(dbp->mpf, lastp, DB_MPOOL_DIRTY); + return (0); +} + +/* + * __db_ovref -- + * Increment/decrement the reference count on an overflow page. + * + * PUBLIC: int __db_ovref __P((DB *, db_pgno_t, int32_t)); + */ +int +__db_ovref(dbp, pgno, adjust) + DB *dbp; + db_pgno_t pgno; + int32_t adjust; +{ + PAGE *h; + int ret; + + if ((ret = memp_fget(dbp->mpf, &pgno, 0, &h)) != 0) { + (void)__db_pgerr(dbp, pgno); + return (ret); + } + + if (DB_LOGGING(dbp)) + if ((ret = __db_ovref_log(dbp->dbenv->lg_info, dbp->txn, + &LSN(h), 0, dbp->log_fileid, h->pgno, adjust, + &LSN(h))) != 0) + return (ret); + OV_REF(h) += adjust; + + (void)memp_fput(dbp->mpf, h, DB_MPOOL_DIRTY); + return (0); +} + +/* + * __db_doff -- + * Delete an offpage chain of overflow pages. + * + * PUBLIC: int __db_doff __P((DB *, db_pgno_t, int (*)(DB *, PAGE *))); + */ +int +__db_doff(dbp, pgno, freefunc) + DB *dbp; + db_pgno_t pgno; + int (*freefunc) __P((DB *, PAGE *)); +{ + PAGE *pagep; + DB_LSN null_lsn; + DBT tmp_dbt; + int ret; + + do { + if ((ret = memp_fget(dbp->mpf, &pgno, 0, &pagep)) != 0) { + (void)__db_pgerr(dbp, pgno); + return (ret); + } + + /* + * If it's an overflow page and it's referenced by more than + * one key/data item, decrement the reference count and return. + */ + if (TYPE(pagep) == P_OVERFLOW && OV_REF(pagep) > 1) { + (void)memp_fput(dbp->mpf, pagep, 0); + return (__db_ovref(dbp, pgno, -1)); + } + + if (DB_LOGGING(dbp)) { + tmp_dbt.data = (u_int8_t *)pagep + P_OVERHEAD; + tmp_dbt.size = OV_LEN(pagep); + ZERO_LSN(null_lsn); + if ((ret = __db_big_log(dbp->dbenv->lg_info, dbp->txn, + &LSN(pagep), 0, DB_REM_BIG, dbp->log_fileid, + PGNO(pagep), PREV_PGNO(pagep), NEXT_PGNO(pagep), + &tmp_dbt, &LSN(pagep), &null_lsn, &null_lsn)) != 0) + return (ret); + } + pgno = pagep->next_pgno; + if ((ret = freefunc(dbp, pagep)) != 0) + return (ret); + } while (pgno != PGNO_INVALID); + + return (0); +} + +/* + * __db_moff -- + * Match on overflow pages. + * + * Given a starting page number and a key, return <0, 0, >0 to indicate if the + * key on the page is less than, equal to or greater than the key specified. + * + * PUBLIC: int __db_moff __P((DB *, const DBT *, db_pgno_t)); + */ +int +__db_moff(dbp, dbt, pgno) + DB *dbp; + const DBT *dbt; + db_pgno_t pgno; +{ + PAGE *pagep; + u_int32_t cmp_bytes, key_left; + u_int8_t *p1, *p2; + int ret; + + /* While there are both keys to compare. */ + for (ret = 0, p1 = dbt->data, + key_left = dbt->size; key_left > 0 && pgno != PGNO_INVALID;) { + if (memp_fget(dbp->mpf, &pgno, 0, &pagep) != 0) { + (void)__db_pgerr(dbp, pgno); + return (0); /* No system error return. */ + } + + cmp_bytes = OV_LEN(pagep) < key_left ? OV_LEN(pagep) : key_left; + key_left -= cmp_bytes; + for (p2 = + (u_int8_t *)pagep + P_OVERHEAD; cmp_bytes-- > 0; ++p1, ++p2) + if (*p1 != *p2) { + ret = (long)*p1 - (long)*p2; + break; + } + pgno = NEXT_PGNO(pagep); + (void)memp_fput(dbp->mpf, pagep, 0); + if (ret != 0) + return (ret); + } + if (key_left > 0) /* DBT is longer than page key. */ + return (-1); + if (pgno != PGNO_INVALID) /* DBT is shorter than page key. */ + return (1); + return (0); +} diff --git a/mozilla/db/db/db_pr.c b/mozilla/db/db/db_pr.c new file mode 100644 index 00000000000..a294cdd1355 --- /dev/null +++ b/mozilla/db/db/db_pr.c @@ -0,0 +1,829 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)db_pr.c 10.29 (Sleepycat) 5/23/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "btree.h" +#include "hash.h" +#include "db_am.h" + +static void __db_proff __P((void *)); +static void __db_psize __P((DB_MPOOLFILE *)); + +/* + * __db_loadme -- + * Force loading of this file. + * + * PUBLIC: void __db_loadme __P((void)); + */ +void +__db_loadme() +{ + getpid(); +} + +static FILE *set_fp; + +/* + * 64K is the maximum page size, so by default we check for offsets + * larger than that, and, where possible, we refine the test. + */ +#define PSIZE_BOUNDARY (64 * 1024 + 1) +static size_t set_psize = PSIZE_BOUNDARY; + +/* + * __db_prinit -- + * Initialize tree printing routines. + * + * PUBLIC: FILE *__db_prinit __P((FILE *)); + */ +FILE * +__db_prinit(fp) + FILE *fp; +{ + if (set_fp == NULL) + set_fp = fp == NULL ? stdout : fp; + return (set_fp); +} + +/* + * __db_dump -- + * Dump the tree to a file. + * + * PUBLIC: int __db_dump __P((DB *, char *, int)); + */ +int +__db_dump(dbp, name, all) + DB *dbp; + char *name; + int all; +{ + FILE *fp, *save_fp; + + COMPQUIET(save_fp, NULL); + + if (set_psize == PSIZE_BOUNDARY) + __db_psize(dbp->mpf); + + if (name != NULL) { + if ((fp = fopen(name, "w")) == NULL) + return (errno); + save_fp = set_fp; + set_fp = fp; + } else + fp = __db_prinit(NULL); + + (void)__db_prdb(dbp); + if (dbp->type == DB_HASH) + (void)__db_prhash(dbp); + else + (void)__db_prbtree(dbp); + fprintf(fp, "%s\n", DB_LINE); + __db_prtree(dbp->mpf, all); + + if (name != NULL) { + (void)fclose(fp); + set_fp = save_fp; + } + return (0); +} + +/* + * __db_prdb -- + * Print out the DB structure information. + * + * PUBLIC: int __db_prdb __P((DB *)); + */ +int +__db_prdb(dbp) + DB *dbp; +{ + static const FN fn[] = { + { DB_AM_DUP, "duplicates" }, + { DB_AM_INMEM, "in-memory" }, + { DB_AM_LOCKING, "locking" }, + { DB_AM_LOGGING, "logging" }, + { DB_AM_MLOCAL, "local mpool" }, + { DB_AM_PGDEF, "default page size" }, + { DB_AM_RDONLY, "read-only" }, + { DB_AM_RECOVER, "recover" }, + { DB_AM_SWAP, "needswap" }, + { DB_AM_THREAD, "thread" }, + { DB_BT_RECNUM, "btree:records" }, + { DB_HS_DIRTYMETA, "hash:dirty-meta" }, + { DB_RE_DELIMITER, "recno:delimiter" }, + { DB_RE_FIXEDLEN, "recno:fixed-length" }, + { DB_RE_PAD, "recno:pad" }, + { DB_RE_RENUMBER, "recno:renumber" }, + { DB_RE_SNAPSHOT, "recno:snapshot" }, + { 0 }, + }; + FILE *fp; + const char *t; + + fp = __db_prinit(NULL); + + switch (dbp->type) { + case DB_BTREE: + t = "btree"; + break; + case DB_HASH: + t = "hash"; + break; + case DB_RECNO: + t = "recno"; + break; + default: + t = "UNKNOWN"; + break; + } + + fprintf(fp, "%s ", t); + __db_prflags(dbp->flags, fn, fp); + fprintf(fp, "\n"); + + return (0); +} + +/* + * __db_prbtree -- + * Print out the btree internal information. + * + * PUBLIC: int __db_prbtree __P((DB *)); + */ +int +__db_prbtree(dbp) + DB *dbp; +{ + static const FN mfn[] = { + { BTM_DUP, "duplicates" }, + { BTM_RECNO, "recno" }, + { BTM_RECNUM, "btree:records" }, + { BTM_FIXEDLEN, "recno:fixed-length" }, + { BTM_RENUMBER, "recno:renumber" }, + { 0 }, + }; + BTMETA *mp; + BTREE *t; + EPG *epg; + FILE *fp; + PAGE *h; + RECNO *rp; + db_pgno_t i; + int ret; + + t = dbp->internal; + fp = __db_prinit(NULL); + + (void)fprintf(fp, "%s\nOn-page metadata:\n", DB_LINE); + + i = PGNO_METADATA; + if ((ret = __bam_pget(dbp, (PAGE **)&mp, &i, 0)) != 0) + return (ret); + + (void)fprintf(fp, "magic %#lx\n", (u_long)mp->magic); + (void)fprintf(fp, "version %#lx\n", (u_long)mp->version); + (void)fprintf(fp, "pagesize %lu\n", (u_long)mp->pagesize); + (void)fprintf(fp, "maxkey: %lu minkey: %lu\n", + (u_long)mp->maxkey, (u_long)mp->minkey); + + (void)fprintf(fp, "free %lu", (u_long)mp->free); + for (i = mp->free; i != PGNO_INVALID;) { + if ((ret = __bam_pget(dbp, &h, &i, 0)) != 0) + return (ret); + i = h->next_pgno; + (void)memp_fput(dbp->mpf, h, 0); + (void)fprintf(fp, ", %lu", (u_long)i); + } + (void)fprintf(fp, "\n"); + + (void)fprintf(fp, "flags %#lx", (u_long)mp->flags); + __db_prflags(mp->flags, mfn, fp); + (void)fprintf(fp, "\n"); + (void)memp_fput(dbp->mpf, mp, 0); + + (void)fprintf(fp, "%s\nDB_INFO:\n", DB_LINE); + (void)fprintf(fp, "bt_maxkey: %lu bt_minkey: %lu\n", + (u_long)t->bt_maxkey, (u_long)t->bt_minkey); + (void)fprintf(fp, "bt_compare: %#lx bt_prefix: %#lx\n", + (u_long)t->bt_compare, (u_long)t->bt_prefix); + if ((rp = t->bt_recno) != NULL) { + (void)fprintf(fp, + "re_delim: %#lx re_pad: %#lx re_len: %lu re_source: %s\n", + (u_long)rp->re_delim, (u_long)rp->re_pad, + (u_long)rp->re_len, + rp->re_source == NULL ? "" : rp->re_source); + (void)fprintf(fp, + "cmap: %#lx smap: %#lx emap: %#lx msize: %lu\n", + (u_long)rp->re_cmap, (u_long)rp->re_smap, + (u_long)rp->re_emap, (u_long)rp->re_msize); + } + (void)fprintf(fp, "stack:"); + for (epg = t->bt_stack; epg < t->bt_sp; ++epg) + (void)fprintf(fp, " %lu", (u_long)epg->page->pgno); + (void)fprintf(fp, "\n"); + (void)fprintf(fp, "ovflsize: %lu\n", (u_long)t->bt_ovflsize); + (void)fflush(fp); + return (0); +} + +/* + * __db_prhash -- + * Print out the hash internal information. + * + * PUBLIC: int __db_prhash __P((DB *)); + */ +int +__db_prhash(dbp) + DB *dbp; +{ + FILE *fp; + HTAB *t; + int i, put_page, ret; + db_pgno_t pgno; + + t = dbp->internal; + + fp = __db_prinit(NULL); + + fprintf(fp, "\thash_accesses %lu\n", (u_long)t->hash_accesses); + fprintf(fp, "\thash_collisions %lu\n", (u_long)t->hash_collisions); + fprintf(fp, "\thash_expansions %lu\n", (u_long)t->hash_expansions); + fprintf(fp, "\thash_overflows %lu\n", (u_long)t->hash_overflows); + fprintf(fp, "\thash_bigpages %lu\n", (u_long)t->hash_bigpages); + fprintf(fp, "\n"); + + if (t->hdr == NULL) { + pgno = PGNO_METADATA; + if ((ret = memp_fget(dbp->mpf, &pgno, 0, &t->hdr)) != 0) + return (ret); + put_page = 1; + } else + put_page = 0; + + fprintf(fp, "\tmagic %#lx\n", (u_long)t->hdr->magic); + fprintf(fp, "\tversion %lu\n", (u_long)t->hdr->version); + fprintf(fp, "\tpagesize %lu\n", (u_long)t->hdr->pagesize); + fprintf(fp, "\tovfl_point %lu\n", (u_long)t->hdr->ovfl_point); + fprintf(fp, "\tlast_freed %lu\n", (u_long)t->hdr->last_freed); + fprintf(fp, "\tmax_bucket %lu\n", (u_long)t->hdr->max_bucket); + fprintf(fp, "\thigh_mask %#lx\n", (u_long)t->hdr->high_mask); + fprintf(fp, "\tlow_mask %#lx\n", (u_long)t->hdr->low_mask); + fprintf(fp, "\tffactor %lu\n", (u_long)t->hdr->ffactor); + fprintf(fp, "\tnelem %lu\n", (u_long)t->hdr->nelem); + fprintf(fp, "\th_charkey %#lx\n", (u_long)t->hdr->h_charkey); + + for (i = 0; i < NCACHED; i++) + fprintf(fp, "%lu ", (u_long)t->hdr->spares[i]); + fprintf(fp, "\n"); + + (void)fflush(fp); + if (put_page) { + (void)memp_fput(dbp->mpf, (PAGE *)t->hdr, 0); + t->hdr = NULL; + } + return (0); +} + +/* + * __db_prtree -- + * Print out the entire tree. + * + * PUBLIC: int __db_prtree __P((DB_MPOOLFILE *, int)); + */ +int +__db_prtree(mpf, all) + DB_MPOOLFILE *mpf; + int all; +{ + PAGE *h; + db_pgno_t i; + int ret, t_ret; + + if (set_psize == PSIZE_BOUNDARY) + __db_psize(mpf); + + ret = 0; + for (i = PGNO_ROOT;; ++i) { + if ((ret = memp_fget(mpf, &i, 0, &h)) != 0) + break; + if (TYPE(h) != P_INVALID) + if ((t_ret = __db_prpage(h, all)) != 0 && ret == 0) + ret = t_ret; + (void)memp_fput(mpf, h, 0); + } + (void)fflush(__db_prinit(NULL)); + return (ret); +} + +/* + * __db_prnpage + * -- Print out a specific page. + * + * PUBLIC: int __db_prnpage __P((DB_MPOOLFILE *, db_pgno_t)); + */ +int +__db_prnpage(mpf, pgno) + DB_MPOOLFILE *mpf; + db_pgno_t pgno; +{ + PAGE *h; + int ret; + + if (set_psize == PSIZE_BOUNDARY) + __db_psize(mpf); + + if ((ret = memp_fget(mpf, &pgno, 0, &h)) != 0) + return (ret); + + ret = __db_prpage(h, 1); + (void)fflush(__db_prinit(NULL)); + + (void)memp_fput(mpf, h, 0); + return (ret); +} + +/* + * __db_prpage + * -- Print out a page. + * + * PUBLIC: int __db_prpage __P((PAGE *, int)); + */ +int +__db_prpage(h, all) + PAGE *h; + int all; +{ + BINTERNAL *bi; + BKEYDATA *bk; + HOFFPAGE a_hkd; + FILE *fp; + RINTERNAL *ri; + db_indx_t dlen, len, i; + db_pgno_t pgno; + int deleted, ret; + const char *s; + u_int8_t *ep, *hk, *p; + void *sp; + + fp = __db_prinit(NULL); + + switch (TYPE(h)) { + case P_DUPLICATE: + s = "duplicate"; + break; + case P_HASH: + s = "hash"; + break; + case P_IBTREE: + s = "btree internal"; + break; + case P_INVALID: + s = "invalid"; + break; + case P_IRECNO: + s = "recno internal"; + break; + case P_LBTREE: + s = "btree leaf"; + break; + case P_LRECNO: + s = "recno leaf"; + break; + case P_OVERFLOW: + s = "overflow"; + break; + default: + fprintf(fp, "ILLEGAL PAGE TYPE: page: %lu type: %lu\n", + (u_long)h->pgno, (u_long)TYPE(h)); + return (1); + } + fprintf(fp, "page %4lu: (%s)\n", (u_long)h->pgno, s); + fprintf(fp, " lsn.file: %lu lsn.offset: %lu", + (u_long)LSN(h).file, (u_long)LSN(h).offset); + if (TYPE(h) == P_IBTREE || TYPE(h) == P_IRECNO || + (TYPE(h) == P_LRECNO && h->pgno == PGNO_ROOT)) + fprintf(fp, " total records: %4lu", (u_long)RE_NREC(h)); + fprintf(fp, "\n"); + if (TYPE(h) == P_LBTREE || TYPE(h) == P_LRECNO || + TYPE(h) == P_DUPLICATE || TYPE(h) == P_OVERFLOW) + fprintf(fp, " prev: %4lu next: %4lu", + (u_long)PREV_PGNO(h), (u_long)NEXT_PGNO(h)); + if (TYPE(h) == P_IBTREE || TYPE(h) == P_LBTREE) + fprintf(fp, " level: %2lu", (u_long)h->level); + if (TYPE(h) == P_OVERFLOW) { + fprintf(fp, " ref cnt: %4lu ", (u_long)OV_REF(h)); + __db_pr((u_int8_t *)h + P_OVERHEAD, OV_LEN(h)); + return (0); + } + fprintf(fp, " entries: %4lu", (u_long)NUM_ENT(h)); + fprintf(fp, " offset: %4lu\n", (u_long)HOFFSET(h)); + + if (!all || TYPE(h) == P_INVALID) + return (0); + + ret = 0; + for (i = 0; i < NUM_ENT(h); i++) { + if (P_ENTRY(h, i) - (u_int8_t *)h < P_OVERHEAD || + (size_t)(P_ENTRY(h, i) - (u_int8_t *)h) >= set_psize) { + fprintf(fp, + "ILLEGAL PAGE OFFSET: indx: %lu of %lu\n", + (u_long)i, (u_long)h->inp[i]); + ret = EINVAL; + continue; + } + deleted = 0; + switch (TYPE(h)) { + case P_HASH: + case P_IBTREE: + case P_IRECNO: + sp = P_ENTRY(h, i); + break; + case P_LBTREE: + sp = P_ENTRY(h, i); + deleted = i % 2 == 0 && + B_DISSET(GET_BKEYDATA(h, i + O_INDX)->type); + break; + case P_LRECNO: + case P_DUPLICATE: + sp = P_ENTRY(h, i); + deleted = B_DISSET(GET_BKEYDATA(h, i)->type); + break; + default: + fprintf(fp, + "ILLEGAL PAGE ITEM: %lu\n", (u_long)TYPE(h)); + ret = EINVAL; + continue; + } + fprintf(fp, " %s[%03lu] %4lu ", + deleted ? "D" : " ", (u_long)i, (u_long)h->inp[i]); + switch (TYPE(h)) { + case P_HASH: + hk = sp; + switch (HPAGE_PTYPE(hk)) { + case H_OFFDUP: + memcpy(&pgno, + HOFFDUP_PGNO(hk), sizeof(db_pgno_t)); + fprintf(fp, + "%4lu [offpage dups]\n", (u_long)pgno); + break; + case H_DUPLICATE: + /* + * If this is the first item on a page, then + * we cannot figure out how long it is, so + * we only print the first one in the duplicate + * set. + */ + if (i != 0) + len = LEN_HKEYDATA(h, 0, i); + else + len = 1; + + fprintf(fp, "Duplicates:\n"); + for (p = HKEYDATA_DATA(hk), + ep = p + len; p < ep;) { + memcpy(&dlen, p, sizeof(db_indx_t)); + p += sizeof(db_indx_t); + fprintf(fp, "\t\t"); + __db_pr(p, dlen); + p += sizeof(db_indx_t) + dlen; + } + break; + case H_KEYDATA: + if (i != 0) + __db_pr(HKEYDATA_DATA(hk), + LEN_HKEYDATA(h, 0, i)); + else + fprintf(fp, "%s\n", HKEYDATA_DATA(hk)); + break; + case H_OFFPAGE: + memcpy(&a_hkd, hk, HOFFPAGE_SIZE); + fprintf(fp, + "overflow: total len: %4lu page: %4lu\n", + (u_long)a_hkd.tlen, (u_long)a_hkd.pgno); + break; + } + break; + case P_IBTREE: + bi = sp; + fprintf(fp, "count: %4lu pgno: %4lu ", + (u_long)bi->nrecs, (u_long)bi->pgno); + switch (B_TYPE(bi->type)) { + case B_KEYDATA: + __db_pr(bi->data, bi->len); + break; + case B_DUPLICATE: + case B_OVERFLOW: + __db_proff(bi->data); + break; + default: + fprintf(fp, "ILLEGAL BINTERNAL TYPE: %lu\n", + (u_long)B_TYPE(bi->type)); + ret = EINVAL; + break; + } + break; + case P_IRECNO: + ri = sp; + fprintf(fp, "entries %4lu pgno %4lu\n", + (u_long)ri->nrecs, (u_long)ri->pgno); + break; + case P_LBTREE: + case P_LRECNO: + case P_DUPLICATE: + bk = sp; + switch (B_TYPE(bk->type)) { + case B_KEYDATA: + __db_pr(bk->data, bk->len); + break; + case B_DUPLICATE: + case B_OVERFLOW: + __db_proff(bk); + break; + default: + fprintf(fp, + "ILLEGAL DUPLICATE/LBTREE/LRECNO TYPE: %lu\n", + (u_long)B_TYPE(bk->type)); + ret = EINVAL; + break; + } + break; + } + } + (void)fflush(fp); + return (ret); +} + +/* + * __db_isbad + * -- Decide if a page is corrupted. + * + * PUBLIC: int __db_isbad __P((PAGE *, int)); + */ +int +__db_isbad(h, die) + PAGE *h; + int die; +{ + BINTERNAL *bi; + BKEYDATA *bk; + FILE *fp; + db_indx_t i; + u_int type; + + fp = __db_prinit(NULL); + + switch (TYPE(h)) { + case P_DUPLICATE: + case P_HASH: + case P_IBTREE: + case P_INVALID: + case P_IRECNO: + case P_LBTREE: + case P_LRECNO: + case P_OVERFLOW: + break; + default: + fprintf(fp, "ILLEGAL PAGE TYPE: page: %lu type: %lu\n", + (u_long)h->pgno, (u_long)TYPE(h)); + goto bad; + } + + for (i = 0; i < NUM_ENT(h); i++) { + if (P_ENTRY(h, i) - (u_int8_t *)h < P_OVERHEAD || + (size_t)(P_ENTRY(h, i) - (u_int8_t *)h) >= set_psize) { + fprintf(fp, + "ILLEGAL PAGE OFFSET: indx: %lu of %lu\n", + (u_long)i, (u_long)h->inp[i]); + goto bad; + } + switch (TYPE(h)) { + case P_HASH: + type = HPAGE_TYPE(h, i); + if (type != H_OFFDUP && + type != H_DUPLICATE && + type != H_KEYDATA && + type != H_OFFPAGE) { + fprintf(fp, "ILLEGAL HASH TYPE: %lu\n", + (u_long)type); + goto bad; + } + break; + case P_IBTREE: + bi = GET_BINTERNAL(h, i); + if (B_TYPE(bi->type) != B_KEYDATA && + B_TYPE(bi->type) != B_DUPLICATE && + B_TYPE(bi->type) != B_OVERFLOW) { + fprintf(fp, "ILLEGAL BINTERNAL TYPE: %lu\n", + (u_long)B_TYPE(bi->type)); + goto bad; + } + break; + case P_IRECNO: + case P_LBTREE: + case P_LRECNO: + break; + case P_DUPLICATE: + bk = GET_BKEYDATA(h, i); + if (B_TYPE(bk->type) != B_KEYDATA && + B_TYPE(bk->type) != B_DUPLICATE && + B_TYPE(bk->type) != B_OVERFLOW) { + fprintf(fp, + "ILLEGAL DUPLICATE/LBTREE/LRECNO TYPE: %lu\n", + (u_long)B_TYPE(bk->type)); + goto bad; + } + break; + default: + fprintf(fp, + "ILLEGAL PAGE ITEM: %lu\n", (u_long)TYPE(h)); + goto bad; + } + } + return (0); + +bad: if (die) { + abort(); + /* NOTREACHED */ + } + return (1); +} + +/* + * __db_pr -- + * Print out a data element. + * + * PUBLIC: void __db_pr __P((u_int8_t *, u_int32_t)); + */ +void +__db_pr(p, len) + u_int8_t *p; + u_int32_t len; +{ + FILE *fp; + u_int lastch; + int i; + + fp = __db_prinit(NULL); + + fprintf(fp, "len: %3lu", (u_long)len); + lastch = '.'; + if (len != 0) { + fprintf(fp, " data: "); + for (i = len <= 20 ? len : 20; i > 0; --i, ++p) { + lastch = *p; + if (isprint(*p) || *p == '\n') + fprintf(fp, "%c", *p); + else + fprintf(fp, "0x%.2x", (u_int)*p); + } + if (len > 20) { + fprintf(fp, "..."); + lastch = '.'; + } + } + if (lastch != '\n') + fprintf(fp, "\n"); +} + +/* + * __db_prdbt -- + * Print out a DBT data element. + * + * PUBLIC: int __db_prdbt __P((DBT *, int, FILE *)); + */ +int +__db_prdbt(dbtp, checkprint, fp) + DBT *dbtp; + int checkprint; + FILE *fp; +{ + static const char hex[] = "0123456789abcdef"; + u_int8_t *p; + u_int32_t len; + + /* + * !!! + * This routine is the routine that dumps out items in the format + * used by db_dump(1) and db_load(1). This means that the format + * cannot change. + */ + if (checkprint) { + for (len = dbtp->size, p = dbtp->data; len--; ++p) + if (isprint(*p)) { + if (*p == '\\' && fprintf(fp, "\\") != 1) + return (EIO); + if (fprintf(fp, "%c", *p) != 1) + return (EIO); + } else + if (fprintf(fp, "\\%c%c", + hex[(u_int8_t)(*p & 0xf0) >> 4], + hex[*p & 0x0f]) != 3) + return (EIO); + } else + for (len = dbtp->size, p = dbtp->data; len--; ++p) + if (fprintf(fp, "%c%c", + hex[(u_int8_t)(*p & 0xf0) >> 4], + hex[*p & 0x0f]) != 2) + return (EIO); + + return (fprintf(fp, "\n") == 1 ? 0 : EIO); +} + +/* + * __db_proff -- + * Print out an off-page element. + */ +static void +__db_proff(vp) + void *vp; +{ + FILE *fp; + BOVERFLOW *bo; + + fp = __db_prinit(NULL); + + bo = vp; + switch (B_TYPE(bo->type)) { + case B_OVERFLOW: + fprintf(fp, "overflow: total len: %4lu page: %4lu\n", + (u_long)bo->tlen, (u_long)bo->pgno); + break; + case B_DUPLICATE: + fprintf(fp, "duplicate: page: %4lu\n", (u_long)bo->pgno); + break; + } +} + +/* + * __db_prflags -- + * Print out flags values. + * + * PUBLIC: void __db_prflags __P((u_int32_t, const FN *, FILE *)); + */ +void +__db_prflags(flags, fn, fp) + u_int32_t flags; + FN const *fn; + FILE *fp; +{ + const FN *fnp; + int found; + const char *sep; + + sep = " ("; + for (found = 0, fnp = fn; fnp->mask != 0; ++fnp) + if (LF_ISSET(fnp->mask)) { + fprintf(fp, "%s%s", sep, fnp->name); + sep = ", "; + found = 1; + } + if (found) + fprintf(fp, ")"); +} + +/* + * __db_psize -- + * Get the page size. + */ +static void +__db_psize(mpf) + DB_MPOOLFILE *mpf; +{ + BTMETA *mp; + db_pgno_t pgno; + + set_psize = PSIZE_BOUNDARY - 1; + + pgno = PGNO_METADATA; + if (memp_fget(mpf, &pgno, 0, &mp) != 0) + return; + + switch (mp->magic) { + case DB_BTREEMAGIC: + case DB_HASHMAGIC: + set_psize = mp->pagesize; + break; + } + (void)memp_fput(mpf, mp, 0); +} diff --git a/mozilla/db/db/db_rec.c b/mozilla/db/db/db_rec.c new file mode 100644 index 00000000000..fe7c8073844 --- /dev/null +++ b/mozilla/db/db/db_rec.c @@ -0,0 +1,639 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)db_rec.c 10.16 (Sleepycat) 4/28/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_page.h" +#include "log.h" +#include "hash.h" +#include "btree.h" + +/* + * PUBLIC: int __db_addrem_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + * + * This log message is generated whenever we add or remove a duplicate + * to/from a duplicate page. On recover, we just do the opposite. + */ +int +__db_addrem_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __db_addrem_args *argp; + DB *file_dbp, *mdbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + u_int32_t change; + int cmp_n, cmp_p, ret; + + REC_PRINT(__db_addrem_print); + REC_INTRO(__db_addrem_read); + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) { + if (!redo) { + /* + * We are undoing and the page doesn't exist. That + * is equivalent to having a pagelsn of 0, so we + * would not have to undo anything. In this case, + * don't bother creating a page. + */ + *lsnp = argp->prev_lsn; + ret = 0; + goto out; + } else + if ((ret = memp_fget(mpf, + &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + } + + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->pagelsn); + change = 0; + if ((cmp_p == 0 && redo && argp->opcode == DB_ADD_DUP) || + (cmp_n == 0 && !redo && argp->opcode == DB_REM_DUP)) { + + /* Need to redo an add, or undo a delete. */ + if ((ret = __db_pitem(file_dbp, pagep, argp->indx, argp->nbytes, + argp->hdr.size == 0 ? NULL : &argp->hdr, + argp->dbt.size == 0 ? NULL : &argp->dbt)) != 0) + goto out; + + change = DB_MPOOL_DIRTY; + + } else if ((cmp_n == 0 && !redo && argp->opcode == DB_ADD_DUP) || + (cmp_p == 0 && redo && argp->opcode == DB_REM_DUP)) { + /* Need to undo an add, or redo a delete. */ + if ((ret = __db_ditem(file_dbp, + pagep, argp->indx, argp->nbytes)) != 0) + goto out; + change = DB_MPOOL_DIRTY; + } + + if (change) + if (redo) + LSN(pagep) = *lsnp; + else + LSN(pagep) = argp->pagelsn; + + if ((ret = memp_fput(mpf, pagep, change)) == 0) + *lsnp = argp->prev_lsn; + +out: REC_CLOSE; +} + +/* + * PUBLIC: int __db_split_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_split_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __db_split_args *argp; + DB *file_dbp, *mdbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int change, cmp_n, cmp_p, ret; + + REC_PRINT(__db_split_print); + REC_INTRO(__db_split_read); + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) { + if (!redo) { + /* + * We are undoing and the page doesn't exist. That + * is equivalent to having a pagelsn of 0, so we + * would not have to undo anything. In this case, + * don't bother creating a page. + */ + *lsnp = argp->prev_lsn; + ret = 0; + goto out; + } else + if ((ret = memp_fget(mpf, + &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + } + + /* + * There are two types of log messages here, one for the old page + * and one for the new pages created. The original image in the + * SPLITOLD record is used for undo. The image in the SPLITNEW + * is used for redo. We should never have a case where there is + * a redo operation and the SPLITOLD record is on disk, but not + * the SPLITNEW record. Therefore, we only redo NEW messages + * and only undo OLD messages. + */ + + change = 0; + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->pagelsn); + if (cmp_p == 0 && redo) { + if (argp->opcode == DB_SPLITNEW) { + /* Need to redo the split described. */ + memcpy(pagep, + argp->pageimage.data, argp->pageimage.size); + } + LSN(pagep) = *lsnp; + change = DB_MPOOL_DIRTY; + } else if (cmp_n == 0 && !redo) { + if (argp->opcode == DB_SPLITOLD) { + /* Put back the old image. */ + memcpy(pagep, + argp->pageimage.data, argp->pageimage.size); + } + LSN(pagep) = argp->pagelsn; + change = DB_MPOOL_DIRTY; + } + if ((ret = memp_fput(mpf, pagep, change)) == 0) + *lsnp = argp->prev_lsn; + +out: REC_CLOSE; +} + +/* + * PUBLIC: int __db_big_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_big_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __db_big_args *argp; + DB *file_dbp, *mdbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + u_int32_t change; + int cmp_n, cmp_p, ret; + + REC_PRINT(__db_big_print); + REC_INTRO(__db_big_read); + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) { + if (!redo) { + /* + * We are undoing and the page doesn't exist. That + * is equivalent to having a pagelsn of 0, so we + * would not have to undo anything. In this case, + * don't bother creating a page. + */ + ret = 0; + goto ppage; + } else + if ((ret = memp_fget(mpf, + &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + } + + /* + * There are three pages we need to check. The one on which we are + * adding data, the previous one whose next_pointer may have + * been updated, and the next one whose prev_pointer may have + * been updated. + */ + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->pagelsn); + change = 0; + if ((cmp_p == 0 && redo && argp->opcode == DB_ADD_BIG) || + (cmp_n == 0 && !redo && argp->opcode == DB_REM_BIG)) { + /* We are either redo-ing an add, or undoing a delete. */ + P_INIT(pagep, file_dbp->pgsize, argp->pgno, argp->prev_pgno, + argp->next_pgno, 0, P_OVERFLOW); + OV_LEN(pagep) = argp->dbt.size; + OV_REF(pagep) = 1; + memcpy((u_int8_t *)pagep + P_OVERHEAD, argp->dbt.data, + argp->dbt.size); + PREV_PGNO(pagep) = argp->prev_pgno; + change = DB_MPOOL_DIRTY; + } else if ((cmp_n == 0 && !redo && argp->opcode == DB_ADD_BIG) || + (cmp_p == 0 && redo && argp->opcode == DB_REM_BIG)) { + /* + * We are either undo-ing an add or redo-ing a delete. + * The page is about to be reclaimed in either case, so + * there really isn't anything to do here. + */ + change = DB_MPOOL_DIRTY; + } + if (change) + LSN(pagep) = redo ? *lsnp : argp->pagelsn; + + if ((ret = memp_fput(mpf, pagep, change)) != 0) + goto out; + + /* Now check the previous page. */ +ppage: if (argp->prev_pgno != PGNO_INVALID) { + change = 0; + if ((ret = memp_fget(mpf, &argp->prev_pgno, 0, &pagep)) != 0) + if (!redo) { + /* + * We are undoing and the page doesn't exist. + * That is equivalent to having a pagelsn of 0, + * so we would not have to undo anything. In + * this case, don't bother creating a page. + */ + *lsnp = argp->prev_lsn; + ret = 0; + goto npage; + } else + if ((ret = memp_fget(mpf, &argp->prev_pgno, + DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->prevlsn); + + if ((cmp_p == 0 && redo && argp->opcode == DB_ADD_BIG) || + (cmp_n == 0 && !redo && argp->opcode == DB_REM_BIG)) { + /* Redo add, undo delete. */ + NEXT_PGNO(pagep) = argp->pgno; + change = DB_MPOOL_DIRTY; + } else if ((cmp_n == 0 && + !redo && argp->opcode == DB_ADD_BIG) || + (cmp_p == 0 && redo && argp->opcode == DB_REM_BIG)) { + /* Redo delete, undo add. */ + NEXT_PGNO(pagep) = argp->next_pgno; + change = DB_MPOOL_DIRTY; + } + if (change) + LSN(pagep) = redo ? *lsnp : argp->prevlsn; + if ((ret = memp_fput(mpf, pagep, change)) != 0) + goto out; + } + + /* Now check the next page. Can only be set on a delete. */ +npage: if (argp->next_pgno != PGNO_INVALID) { + change = 0; + if ((ret = memp_fget(mpf, &argp->next_pgno, 0, &pagep)) != 0) + if (!redo) { + /* + * We are undoing and the page doesn't exist. + * That is equivalent to having a pagelsn of 0, + * so we would not have to undo anything. In + * this case, don't bother creating a page. + */ + *lsnp = argp->prev_lsn; + ret = 0; + goto out; + } else + if ((ret = memp_fget(mpf, &argp->next_pgno, + DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->nextlsn); + if (cmp_p == 0 && redo) { + PREV_PGNO(pagep) = PGNO_INVALID; + change = DB_MPOOL_DIRTY; + } else if (cmp_n == 0 && !redo) { + PREV_PGNO(pagep) = argp->pgno; + change = DB_MPOOL_DIRTY; + } + if (change) + LSN(pagep) = redo ? *lsnp : argp->nextlsn; + if ((ret = memp_fput(mpf, pagep, change)) != 0) + goto out; + } + + *lsnp = argp->prev_lsn; + +out: REC_CLOSE; +} + +/* + * __db_ovref_recover -- + * Recovery function for __db_ovref(). + * + * PUBLIC: int __db_ovref_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_ovref_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __db_ovref_args *argp; + DB *file_dbp, *mdbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int modified, ret; + + REC_PRINT(__db_ovref_print); + REC_INTRO(__db_ovref_read); + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) { + (void)__db_pgerr(file_dbp, argp->pgno); + goto out; + } + + modified = 0; + if (log_compare(&LSN(pagep), &argp->lsn) == 0 && redo) { + /* Need to redo update described. */ + OV_REF(pagep) += argp->adjust; + + pagep->lsn = *lsnp; + modified = 1; + } else if (log_compare(lsnp, &LSN(pagep)) == 0 && !redo) { + /* Need to undo update described. */ + OV_REF(pagep) -= argp->adjust; + + pagep->lsn = argp->lsn; + modified = 1; + } + if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) == 0) + *lsnp = argp->prev_lsn; + +out: REC_CLOSE; +} + +/* + * __db_relink_recover -- + * Recovery function for relink. + * + * PUBLIC: int __db_relink_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_relink_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __db_relink_args *argp; + DB *file_dbp, *mdbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int modified, ret; + + REC_PRINT(__db_relink_print); + REC_INTRO(__db_relink_read); + + /* + * There are three pages we need to check -- the page, and the + * previous and next pages, if they existed. + */ + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) { + if (redo) { + (void)__db_pgerr(file_dbp, argp->pgno); + goto out; + } + goto next; + } + modified = 0; + if (log_compare(&LSN(pagep), &argp->lsn) == 0 && redo) { + /* Redo the relink. */ + pagep->lsn = *lsnp; + modified = 1; + } else if (log_compare(lsnp, &LSN(pagep)) == 0 && !redo) { + /* Undo the relink. */ + pagep->next_pgno = argp->next; + pagep->prev_pgno = argp->prev; + + pagep->lsn = argp->lsn; + modified = 1; + } + if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) != 0) { + (void)__db_panic(file_dbp); + goto out; + } + +next: if ((ret = memp_fget(mpf, &argp->next, 0, &pagep)) != 0) { + if (redo) { + (void)__db_pgerr(file_dbp, argp->next); + goto out; + } + goto prev; + } + modified = 0; + if (log_compare(&LSN(pagep), &argp->lsn_next) == 0 && redo) { + /* Redo the relink. */ + pagep->prev_pgno = argp->prev; + + pagep->lsn = *lsnp; + modified = 1; + } else if (log_compare(lsnp, &LSN(pagep)) == 0 && !redo) { + /* Undo the relink. */ + pagep->prev_pgno = argp->pgno; + + pagep->lsn = argp->lsn_next; + modified = 1; + } + if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) != 0) { + (void)__db_panic(file_dbp); + goto out; + } + +prev: if ((ret = memp_fget(mpf, &argp->prev, 0, &pagep)) != 0) { + if (redo) { + (void)__db_pgerr(file_dbp, argp->prev); + goto out; + } + goto done; + } + modified = 0; + if (log_compare(&LSN(pagep), &argp->lsn_prev) == 0 && redo) { + /* Redo the relink. */ + pagep->next_pgno = argp->next; + + pagep->lsn = *lsnp; + modified = 1; + } else if (log_compare(lsnp, &LSN(pagep)) == 0 && !redo) { + /* Undo the relink. */ + pagep->next_pgno = argp->pgno; + + pagep->lsn = argp->lsn_prev; + modified = 1; + } + if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) != 0) { + (void) __db_panic(file_dbp); + goto out; + } + +done: *lsnp = argp->prev_lsn; + ret = 0; + +out: REC_CLOSE; +} + +/* + * PUBLIC: int __db_addpage_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_addpage_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __db_addpage_args *argp; + DB *file_dbp, *mdbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + u_int32_t change; + int cmp_n, cmp_p, ret; + + REC_PRINT(__db_addpage_print); + REC_INTRO(__db_addpage_read); + + /* + * We need to check two pages: the old one and the new one onto + * which we're going to add duplicates. Do the old one first. + */ + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + goto out; + + change = 0; + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->lsn); + if (cmp_p == 0 && redo) { + NEXT_PGNO(pagep) = argp->nextpgno; + + LSN(pagep) = *lsnp; + change = DB_MPOOL_DIRTY; + } else if (cmp_n == 0 && !redo) { + NEXT_PGNO(pagep) = PGNO_INVALID; + + LSN(pagep) = argp->lsn; + change = DB_MPOOL_DIRTY; + } + if ((ret = memp_fput(mpf, pagep, change)) != 0) + goto out; + + if ((ret = memp_fget(mpf, &argp->nextpgno, 0, &pagep)) != 0) + if (!redo) { + /* + * We are undoing and the page doesn't exist. That + * is equivalent to having a pagelsn of 0, so we + * would not have to undo anything. In this case, + * don't bother creating a page. + */ + ret = 0; + goto out; + } else + if ((ret = memp_fget(mpf, + &argp->nextpgno, DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + + change = 0; + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->nextlsn); + if (cmp_p == 0 && redo) { + PREV_PGNO(pagep) = argp->pgno; + + LSN(pagep) = *lsnp; + change = DB_MPOOL_DIRTY; + } else if (cmp_n == 0 && !redo) { + PREV_PGNO(pagep) = PGNO_INVALID; + + LSN(pagep) = argp->nextlsn; + change = DB_MPOOL_DIRTY; + } + ret = memp_fput(mpf, pagep, change); + +out: if (ret == 0) + *lsnp = argp->prev_lsn; + REC_CLOSE; +} + +/* + * __db_debug_recover -- + * Recovery function for debug. + * + * PUBLIC: int __db_debug_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_debug_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __db_debug_args *argp; + int ret; + + COMPQUIET(redo, 0); + COMPQUIET(logp, NULL); + + REC_PRINT(__db_debug_print); + REC_NOOP_INTRO(__db_debug_read); + + *lsnp = argp->prev_lsn; + ret = 0; + + REC_NOOP_CLOSE; +} + +/* + * __db_noop_recover -- + * Recovery function for noop. + * + * PUBLIC: int __db_noop_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_noop_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __db_noop_args *argp; + DB *file_dbp, *mdbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + u_int32_t change; + int cmp_n, cmp_p, ret; + + REC_PRINT(__db_noop_print); + REC_INTRO(__db_noop_read); + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + goto out; + + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->prevlsn); + change = 0; + if (cmp_p == 0 && redo) { + LSN(pagep) = *lsnp; + change = DB_MPOOL_DIRTY; + } else if (cmp_n == 0 && !redo) { + LSN(pagep) = argp->prevlsn; + change = DB_MPOOL_DIRTY; + } + *lsnp = argp->prev_lsn; + ret = memp_fput(mpf, pagep, change); + +out: REC_CLOSE; +} diff --git a/mozilla/db/db/db_ret.c b/mozilla/db/db/db_ret.c new file mode 100644 index 00000000000..9d9b599ad6a --- /dev/null +++ b/mozilla/db/db/db_ret.c @@ -0,0 +1,160 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)db_ret.c 10.13 (Sleepycat) 5/7/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "btree.h" +#include "db_am.h" + +/* + * __db_ret -- + * Build return DBT. + * + * PUBLIC: int __db_ret __P((DB *, + * PUBLIC: PAGE *, u_int32_t, DBT *, void **, u_int32_t *)); + */ +int +__db_ret(dbp, h, indx, dbt, memp, memsize) + DB *dbp; + PAGE *h; + u_int32_t indx; + DBT *dbt; + void **memp; + u_int32_t *memsize; +{ + BKEYDATA *bk; + HOFFPAGE ho; + BOVERFLOW *bo; + u_int32_t len; + u_int8_t *hk; + void *data; + + switch (TYPE(h)) { + case P_HASH: + hk = P_ENTRY(h, indx); + if (HPAGE_PTYPE(hk) == H_OFFPAGE) { + memcpy(&ho, hk, sizeof(HOFFPAGE)); + return (__db_goff(dbp, dbt, + ho.tlen, ho.pgno, memp, memsize)); + } + len = LEN_HKEYDATA(h, dbp->pgsize, indx); + data = HKEYDATA_DATA(hk); + break; + case P_DUPLICATE: + case P_LBTREE: + case P_LRECNO: + bk = GET_BKEYDATA(h, indx); + if (B_TYPE(bk->type) == B_OVERFLOW) { + bo = (BOVERFLOW *)bk; + return (__db_goff(dbp, dbt, + bo->tlen, bo->pgno, memp, memsize)); + } + len = bk->len; + data = bk->data; + break; + default: + return (__db_pgfmt(dbp, h->pgno)); + } + + return (__db_retcopy(dbt, data, len, memp, memsize, + F_ISSET(dbt, DB_DBT_INTERNAL) ? NULL : dbp->db_malloc)); +} + +/* + * __db_retcopy -- + * Copy the returned data into the user's DBT, handling special flags. + * + * PUBLIC: int __db_retcopy __P((DBT *, + * PUBLIC: void *, u_int32_t, void **, u_int32_t *, void *(*)(size_t))); + */ +int +__db_retcopy(dbt, data, len, memp, memsize, db_malloc) + DBT *dbt; + void *data; + u_int32_t len; + void **memp; + u_int32_t *memsize; + void *(*db_malloc) __P((size_t)); +{ + /* If returning a partial record, reset the length. */ + if (F_ISSET(dbt, DB_DBT_PARTIAL)) { + data = (u_int8_t *)data + dbt->doff; + if (len > dbt->doff) { + len -= dbt->doff; + if (len > dbt->dlen) + len = dbt->dlen; + } else + len = 0; + } + + /* + * Return the length of the returned record in the DBT size field. + * This satisfies the requirement that if we're using user memory + * and insufficient memory was provided, return the amount necessary + * in the size field. + */ + dbt->size = len; + + /* + * Allocate memory to be owned by the application: DB_DBT_MALLOC. + * + * !!! + * We always allocate memory, even if we're copying out 0 bytes. This + * guarantees consistency, i.e., the application can always free memory + * without concern as to how many bytes of the record were requested. + * + * XXX + * Never allocate 0 bytes, it's known to make malloc/realloc unhappy. + * + * Use the memory specified by the application: DB_DBT_USERMEM. + * + * !!! + * If the length we're going to copy is 0, the application-supplied + * memory pointer is allowed to be NULL. + */ + if (F_ISSET(dbt, DB_DBT_MALLOC)) { + dbt->data = db_malloc == NULL ? + (void *)__db_malloc(len) : + (void *)db_malloc(len + 1); + if (dbt->data == NULL) + return (ENOMEM); + } else if (F_ISSET(dbt, DB_DBT_USERMEM)) { + if (len != 0 && (dbt->data == NULL || dbt->ulen < len)) + return (ENOMEM); + } else if (memp == NULL || memsize == NULL) { + return (EINVAL); + } else { + if (len != 0 && (*memsize == 0 || *memsize < len)) { + *memp = *memp == NULL ? + (void *)__db_malloc(len) : + (void *)__db_realloc(*memp, len); + if (*memp == NULL) { + *memsize = 0; + return (ENOMEM); + } + *memsize = len; + } + dbt->data = *memp; + } + + if (len != 0) + memcpy(dbt->data, data, len); + return (0); +} diff --git a/mozilla/db/db/db_thread.c b/mozilla/db/db/db_thread.c new file mode 100644 index 00000000000..73e2a512869 --- /dev/null +++ b/mozilla/db/db/db_thread.c @@ -0,0 +1,121 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)db_thread.c 8.15 (Sleepycat) 4/26/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "db_am.h" + +static int __db_getlockid __P((DB *, DB *)); + +/* + * __db_gethandle -- + * Called by db access method routines when the DB_THREAD flag is set. + * This routine returns a handle, either an existing handle from the + * chain of handles, or creating one if necessary. + * + * PUBLIC: int __db_gethandle __P((DB *, int (*)(DB *, DB *), DB **)); + */ +int +__db_gethandle(dbp, am_func, dbpp) + DB *dbp, **dbpp; + int (*am_func) __P((DB *, DB *)); +{ + DB *ret_dbp; + int ret, t_ret; + + if ((ret = __db_mutex_lock((db_mutex_t *)dbp->mutexp, -1)) != 0) + return (ret); + + if ((ret_dbp = LIST_FIRST(&dbp->handleq)) != NULL) + /* Simply take one off the list. */ + LIST_REMOVE(ret_dbp, links); + else { + /* Allocate a new handle. */ + if ((ret_dbp = (DB *)__db_malloc(sizeof(*dbp))) == NULL) { + ret = ENOMEM; + goto err; + } + memcpy(ret_dbp, dbp, sizeof(*dbp)); + ret_dbp->internal = NULL; + TAILQ_INIT(&ret_dbp->curs_queue); + + /* Set the locker, the lock structure and the lock DBT. */ + if ((ret = __db_getlockid(dbp, ret_dbp)) != 0) + goto err; + + /* Finally, call the access method specific dup function. */ + if ((ret = am_func(dbp, ret_dbp)) != 0) + goto err; + } + + *dbpp = ret_dbp; + + if (0) { +err: if (ret_dbp != NULL) + FREE(ret_dbp, sizeof(*ret_dbp)); + } + if ((t_ret = + __db_mutex_unlock((db_mutex_t *)dbp->mutexp, -1)) != 0 && ret == 0) + ret = t_ret; + return (ret); +} + +/* + * __db_puthandle -- + * Return a DB handle to the pool for later use. + * + * PUBLIC: int __db_puthandle __P((DB *)); + */ +int +__db_puthandle(dbp) + DB *dbp; +{ + DB *master; + int ret; + + master = dbp->master; + if ((ret = __db_mutex_lock((db_mutex_t *)master->mutexp, -1)) != 0) + return (ret); + + LIST_INSERT_HEAD(&master->handleq, dbp, links); + + return (__db_mutex_unlock((db_mutex_t *)master->mutexp, -1)); +} + +/* + * __db_getlockid -- + * Create a new locker ID and copy the file lock information from + * the old DB into the new one. + */ +static int +__db_getlockid(dbp, new_dbp) + DB *dbp, *new_dbp; +{ + int ret; + + if (F_ISSET(dbp, DB_AM_LOCKING)) { + if ((ret = lock_id(dbp->dbenv->lk_info, &new_dbp->locker)) != 0) + return (ret); + memcpy(new_dbp->lock.fileid, dbp->lock.fileid, DB_FILE_ID_LEN); + new_dbp->lock_dbt.size = sizeof(new_dbp->lock); + new_dbp->lock_dbt.data = &new_dbp->lock; + } + return (0); +} diff --git a/mozilla/db/db185/db185.c b/mozilla/db/db185/db185.c new file mode 100644 index 00000000000..905ed88043e --- /dev/null +++ b/mozilla/db/db185/db185.c @@ -0,0 +1,484 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char copyright[] = +"@(#) Copyright (c) 1996, 1997, 1998\n\ + Sleepycat Software Inc. All rights reserved.\n"; +static const char sccsid[] = "@(#)db185.c 8.17 (Sleepycat) 5/7/98"; +#endif + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#include +#endif + +#include "db_int.h" +#include "db185_int.h" +#include "common_ext.h" + +static int db185_close __P((DB185 *)); +static int db185_del __P((const DB185 *, const DBT185 *, u_int)); +static int db185_fd __P((const DB185 *)); +static int db185_get __P((const DB185 *, const DBT185 *, DBT185 *, u_int)); +static int db185_put __P((const DB185 *, DBT185 *, const DBT185 *, u_int)); +static int db185_seq __P((const DB185 *, DBT185 *, DBT185 *, u_int)); +static int db185_sync __P((const DB185 *, u_int)); + +DB185 * +dbopen(file, oflags, mode, type, openinfo) + const char *file; + int oflags, mode; + DBTYPE type; + const void *openinfo; +{ + const BTREEINFO *bi; + const HASHINFO *hi; + const RECNOINFO *ri; + DB *dbp; + DB185 *db185p; + DB_INFO dbinfo, *dbinfop; + int s_errno; + + if ((db185p = (DB185 *)__db_calloc(1, sizeof(DB185))) == NULL) + return (NULL); + dbinfop = NULL; + memset(&dbinfo, 0, sizeof(dbinfo)); + + /* + * !!! + * The DBTYPE enum wasn't initialized in DB 185, so it's off-by-one + * from DB 2.0. + */ + switch (type) { + case 0: /* DB_BTREE */ + type = DB_BTREE; + if ((bi = openinfo) != NULL) { + dbinfop = &dbinfo; + if (bi->flags & ~R_DUP) + goto einval; + if (bi->flags & R_DUP) + dbinfop->flags |= DB_DUP; + dbinfop->db_cachesize = bi->cachesize; + dbinfop->bt_maxkey = bi->maxkeypage; + dbinfop->bt_minkey = bi->minkeypage; + dbinfop->db_pagesize = bi->psize; + /* + * !!! + * Comparisons and prefix calls work because the DBT + * structures in 1.85 and 2.0 have the same initial + * fields. + */ + dbinfop->bt_compare = bi->compare; + dbinfop->bt_prefix = bi->prefix; + dbinfop->db_lorder = bi->lorder; + } + break; + case 1: /* DB_HASH */ + type = DB_HASH; + if ((hi = openinfo) != NULL) { + dbinfop = &dbinfo; + dbinfop->db_pagesize = hi->bsize; + dbinfop->h_ffactor = hi->ffactor; + dbinfop->h_nelem = hi->nelem; + dbinfop->db_cachesize = hi->cachesize; + dbinfop->h_hash = hi->hash; + dbinfop->db_lorder = hi->lorder; + } + + break; + case 2: /* DB_RECNO */ + type = DB_RECNO; + dbinfop = &dbinfo; + + /* DB 1.85 did renumbering by default. */ + dbinfop->flags |= DB_RENUMBER; + + /* + * !!! + * The file name given to DB 1.85 recno is the name of the DB + * 2.0 backing file. If the file doesn't exist, create it if + * the user has the O_CREAT flag set, DB 1.85 did it for you, + * and DB 2.0 doesn't. + * + * !!! + * Setting the file name to NULL specifies that we're creating + * a temporary backing file, in DB 2.X. If we're opening the + * DB file read-only, change the flags to read-write, because + * temporary backing files cannot be opened read-only, and DB + * 2.X will return an error. We are cheating here -- if the + * application does a put on the database, it will succeed -- + * although that would be a stupid thing for the application + * to do. + * + * !!! + * Note, the file name in DB 1.85 was a const -- we don't do + * that in DB 2.0, so do that cast. + */ + if (file != NULL) { + if (oflags & O_CREAT && __db_exists(file, NULL) != 0) + (void)__os_close(__os_open(file, oflags, mode)); + dbinfop->re_source = (char *)file; + + if (O_RDONLY) + oflags &= ~O_RDONLY; + oflags |= O_RDWR; + file = NULL; + } + + if ((ri = openinfo) != NULL) { + /* + * !!! + * We can't support the bfname field. + */ +#define BFMSG "DB: DB 1.85's recno bfname field is not supported.\n" + if (ri->bfname != NULL) { + (void)__os_write(2, BFMSG, sizeof(BFMSG) - 1); + goto einval; + } + + if (ri->flags & ~(R_FIXEDLEN | R_NOKEY | R_SNAPSHOT)) + goto einval; + if (ri->flags & R_FIXEDLEN) { + dbinfop->flags |= DB_FIXEDLEN; + if (ri->bval != 0) { + dbinfop->flags |= DB_PAD; + dbinfop->re_pad = ri->bval; + } + } else + if (ri->bval != 0) { + dbinfop->flags |= DB_DELIMITER; + dbinfop->re_delim = ri->bval; + } + + /* + * !!! + * We ignore the R_NOKEY flag, but that's okay, it was + * only an optimization that was never implemented. + */ + + if (ri->flags & R_SNAPSHOT) + dbinfop->flags |= DB_SNAPSHOT; + + dbinfop->db_cachesize = ri->cachesize; + dbinfop->db_pagesize = ri->psize; + dbinfop->db_lorder = ri->lorder; + dbinfop->re_len = ri->reclen; + } + break; + default: + goto einval; + } + + db185p->close = db185_close; + db185p->del = db185_del; + db185p->fd = db185_fd; + db185p->get = db185_get; + db185p->put = db185_put; + db185p->seq = db185_seq; + db185p->sync = db185_sync; + + /* + * !!! + * Store the returned pointer to the real DB 2.0 structure in the + * internal pointer. Ugly, but we're not going for pretty, here. + */ + if ((errno = db_open(file, + type, __db_oflags(oflags), mode, NULL, dbinfop, &dbp)) != 0) { + __db_free(db185p); + return (NULL); + } + + /* Create the cursor used for sequential ops. */ + if ((errno = dbp->cursor(dbp, NULL, &((DB185 *)db185p)->dbc)) != 0) { + s_errno = errno; + (void)dbp->close(dbp, 0); + __db_free(db185p); + errno = s_errno; + return (NULL); + } + + db185p->internal = dbp; + return (db185p); + +einval: __db_free(db185p); + errno = EINVAL; + return (NULL); +} + +static int +db185_close(db185p) + DB185 *db185p; +{ + DB *dbp; + + dbp = (DB *)db185p->internal; + + errno = dbp->close(dbp, 0); + + __db_free(db185p); + + return (errno == 0 ? 0 : -1); +} + +static int +db185_del(db185p, key185, flags) + const DB185 *db185p; + const DBT185 *key185; + u_int flags; +{ + DB *dbp; + DBT key; + + dbp = (DB *)db185p->internal; + + memset(&key, 0, sizeof(key)); + key.data = key185->data; + key.size = key185->size; + + if (flags & ~R_CURSOR) + goto einval; + if (flags & R_CURSOR) + errno = db185p->dbc->c_del(db185p->dbc, 0); + else + errno = dbp->del(dbp, NULL, &key, 0); + + switch (errno) { + case 0: + return (0); + case DB_NOTFOUND: + return (1); + } + return (-1); + +einval: errno = EINVAL; + return (-1); +} + +static int +db185_fd(db185p) + const DB185 *db185p; +{ + DB *dbp; + int fd; + + dbp = (DB *)db185p->internal; + + return ((errno = dbp->fd(dbp, &fd)) == 0 ? fd : -1); +} + +static int +db185_get(db185p, key185, data185, flags) + const DB185 *db185p; + const DBT185 *key185; + DBT185 *data185; + u_int flags; +{ + DB *dbp; + DBT key, data; + + dbp = (DB *)db185p->internal; + + memset(&key, 0, sizeof(key)); + key.data = key185->data; + key.size = key185->size; + memset(&data, 0, sizeof(data)); + data.data = data185->data; + data.size = data185->size; + + if (flags) + goto einval; + + switch (errno = dbp->get(dbp, NULL, &key, &data, 0)) { + case 0: + data185->data = data.data; + data185->size = data.size; + return (0); + case DB_NOTFOUND: + return (1); + } + return (-1); + +einval: errno = EINVAL; + return (-1); +} + +static int +db185_put(db185p, key185, data185, flags) + const DB185 *db185p; + DBT185 *key185; + const DBT185 *data185; + u_int flags; +{ + DB *dbp; + DBC *dbcp_put; + DBT key, data; + int s_errno; + + dbp = (DB *)db185p->internal; + + memset(&key, 0, sizeof(key)); + key.data = key185->data; + key.size = key185->size; + memset(&data, 0, sizeof(data)); + data.data = data185->data; + data.size = data185->size; + + switch (flags) { + case 0: + errno = dbp->put(dbp, NULL, &key, &data, 0); + break; + case R_CURSOR: + errno = + db185p->dbc->c_put(db185p->dbc, &key, &data, DB_CURRENT); + break; + case R_IAFTER: + case R_IBEFORE: + if (dbp->type != DB_RECNO) + goto einval; + + if ((errno = dbp->cursor(dbp, NULL, &dbcp_put)) != 0) + return (-1); + if ((errno = + dbcp_put->c_get(dbcp_put, &key, &data, DB_SET)) != 0) { + s_errno = errno; + (void)dbcp_put->c_close(dbcp_put); + errno = s_errno; + return (-1); + } + memset(&data, 0, sizeof(data)); + data.data = data185->data; + data.size = data185->size; + errno = dbcp_put->c_put(dbcp_put, + &key, &data, flags == R_IAFTER ? DB_AFTER : DB_BEFORE); + s_errno = errno; + (void)dbcp_put->c_close(dbcp_put); + errno = s_errno; + break; + case R_NOOVERWRITE: + errno = dbp->put(dbp, NULL, &key, &data, DB_NOOVERWRITE); + break; + case R_SETCURSOR: + if (dbp->type != DB_BTREE && dbp->type != DB_RECNO) + goto einval; + + if ((errno = dbp->put(dbp, NULL, &key, &data, 0)) != 0) + break; + errno = + db185p->dbc->c_get(db185p->dbc, &key, &data, DB_SET_RANGE); + break; + default: + goto einval; + } + + switch (errno) { + case 0: + key185->data = key.data; + key185->size = key.size; + return (0); + case DB_KEYEXIST: + return (1); + } + return (-1); + +einval: errno = EINVAL; + return (-1); +} + +static int +db185_seq(db185p, key185, data185, flags) + const DB185 *db185p; + DBT185 *key185, *data185; + u_int flags; +{ + DB *dbp; + DBT key, data; + + dbp = (DB *)db185p->internal; + + memset(&key, 0, sizeof(key)); + key.data = key185->data; + key.size = key185->size; + memset(&data, 0, sizeof(data)); + data.data = data185->data; + data.size = data185->size; + + switch (flags) { + case R_CURSOR: + flags = DB_SET_RANGE; + break; + case R_FIRST: + flags = DB_FIRST; + break; + case R_LAST: + if (dbp->type != DB_BTREE && dbp->type != DB_RECNO) + goto einval; + flags = DB_LAST; + break; + case R_NEXT: + flags = DB_NEXT; + break; + case R_PREV: + if (dbp->type != DB_BTREE && dbp->type != DB_RECNO) + goto einval; + flags = DB_PREV; + break; + default: + goto einval; + } + switch (errno = db185p->dbc->c_get(db185p->dbc, &key, &data, flags)) { + case 0: + key185->data = key.data; + key185->size = key.size; + data185->data = data.data; + data185->size = data.size; + return (0); + case DB_NOTFOUND: + return (1); + } + return (-1); + +einval: errno = EINVAL; + return (-1); +} + +static int +db185_sync(db185p, flags) + const DB185 *db185p; + u_int flags; +{ + DB *dbp; + + dbp = (DB *)db185p->internal; + + switch (flags) { + case 0: + break; + case R_RECNOSYNC: + /* + * !!! + * We can't support the R_RECNOSYNC flag. + */ +#define RSMSG "DB: DB 1.85's R_RECNOSYNC sync flag is not supported.\n" + (void)__os_write(2, RSMSG, sizeof(RSMSG) - 1); + goto einval; + default: + goto einval; + } + + return ((errno = dbp->sync(dbp, 0)) == 0 ? 0 : -1); + +einval: errno = EINVAL; + return (-1); +} diff --git a/mozilla/db/db185/db185_int.h b/mozilla/db/db185/db185_int.h new file mode 100644 index 00000000000..a6520c64f6f --- /dev/null +++ b/mozilla/db/db185/db185_int.h @@ -0,0 +1,137 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1990, 1993, 1994, 1995, 1996 + * Keith Bostic. 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. 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. + * + * @(#)db185_int.h 8.7 (Sleepycat) 4/10/98 + */ + +#ifndef _DB185_H_ +#define _DB185_H_ + +/* 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 struct { + void *data; /* data */ + size_t size; /* data length */ +} DBT185; + +/* Access method description structure. */ +typedef struct __db185 { + DBTYPE type; /* Underlying db type. */ + int (*close) __P((struct __db185 *)); + int (*del) __P((const struct __db185 *, const DBT185 *, u_int)); + int (*get) + __P((const struct __db185 *, const DBT185 *, DBT185 *, u_int)); + int (*put) + __P((const struct __db185 *, DBT185 *, const DBT185 *, u_int)); + int (*seq) + __P((const struct __db185 *, DBT185 *, DBT185 *, u_int)); + int (*sync) __P((const struct __db185 *, u_int)); + void *internal; /* Access method private. */ + int (*fd) __P((const struct __db185 *)); + + /* + * !!! + * Added to the end of the DB 1.85 DB structure, it's needed to + * hold the DB 2.0 cursor used for DB 1.85 sequential operations. + */ + DBC *dbc; /* DB 1.85 sequential cursor. */ +} DB185; + +/* 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; + +/* 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; + +#if defined(__cplusplus) +extern "C" { +#endif +DB185 *dbopen __P((const char *, int, int, DBTYPE, const void *)); +#if defined(__cplusplus) +}; +#endif +#endif /* !_DB185_H_ */ diff --git a/mozilla/db/db_archive/db_archive.c b/mozilla/db/db_archive/db_archive.c new file mode 100644 index 00000000000..691824c2ab0 --- /dev/null +++ b/mozilla/db/db_archive/db_archive.c @@ -0,0 +1,167 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char copyright[] = +"@(#) Copyright (c) 1996, 1997, 1998\n\ + Sleepycat Software Inc. All rights reserved.\n"; +static const char sccsid[] = "@(#)db_archive.c 10.17 (Sleepycat) 4/10/98"; +#endif + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "log.h" +#include "db_dispatch.h" +#include "clib_ext.h" +#include "common_ext.h" + +DB_ENV *db_init __P((char *, int)); +void onint __P((int)); +int main __P((int, char *[])); +void siginit __P((void)); +void usage __P((void)); + +int interrupted; +const char + *progname = "db_archive"; /* Program name. */ + +int +main(argc, argv) + int argc; + char *argv[]; +{ + extern char *optarg; + extern int optind; + DB_ENV *dbenv; + u_int32_t flags; + int ch, verbose; + char *home, **list; + + flags = verbose = 0; + home = NULL; + while ((ch = getopt(argc, argv, "ah:lsv")) != EOF) + switch (ch) { + case 'a': + flags |= DB_ARCH_ABS; + break; + case 'h': + home = optarg; + break; + case 'l': + flags |= DB_ARCH_LOG; + break; + case 's': + flags |= DB_ARCH_DATA; + break; + case 'v': + verbose = 1; + break; + case '?': + default: + usage(); + } + argc -= optind; + argv += optind; + + if (argc != 0) + usage(); + + /* Initialize the environment. */ + dbenv = db_init(home, verbose); + + /* Get the list of names. */ + if ((errno = log_archive(dbenv->lg_info, &list, flags, NULL)) != 0) { + (void)db_appexit(dbenv); + err(1, "log_archive"); + } + + /* Print the names. */ + if (list != NULL) + for (; *list != NULL; ++list) + printf("%s\n", *list); + + return (db_appexit(dbenv) ? 1 : 0); +} + +/* + * db_init -- + * Initialize the environment. + */ +DB_ENV * +db_init(home, verbose) + char *home; + int verbose; +{ + DB_ENV *dbenv; + + if ((dbenv = (DB_ENV *)calloc(sizeof(DB_ENV), 1)) == NULL) { + errno = ENOMEM; + err(1, NULL); + } + dbenv->db_errfile = stderr; + dbenv->db_errpfx = progname; + dbenv->db_verbose = verbose; + + if ((errno = db_appinit(home, NULL, dbenv, + DB_CREATE | DB_INIT_LOG | DB_INIT_TXN | DB_USE_ENVIRON)) != 0) + err(1, "db_appinit"); + + siginit(); + + return (dbenv); +} + +/* + * siginit -- + * Initialize the set of signals for which we want to clean up. + * Generally, we try not to leave the shared regions locked if + * we can. + */ +void +siginit() +{ +#ifdef SIGHUP + (void)signal(SIGHUP, onint); +#endif + (void)signal(SIGINT, onint); +#ifdef SIGKILL + (void)signal(SIGKILL, onint); +#endif + (void)signal(SIGTERM, onint); +} + +/* + * oninit -- + * Interrupt signal handler. + */ +void +onint(signo) + int signo; +{ + if ((interrupted = signo) == 0) + interrupted = SIGINT; +} + +void +usage() +{ + (void)fprintf(stderr, "usage: db_archive [-alsv] [-h home]\n"); + exit(1); +} diff --git a/mozilla/db/db_checkpoint/db_checkpoint.c b/mozilla/db/db_checkpoint/db_checkpoint.c new file mode 100644 index 00000000000..74f95ccce25 --- /dev/null +++ b/mozilla/db/db_checkpoint/db_checkpoint.c @@ -0,0 +1,264 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char copyright[] = +"@(#) Copyright (c) 1996, 1997, 1998\n\ + Sleepycat Software Inc. All rights reserved.\n"; +static const char sccsid[] = "@(#)db_checkpoint.c 10.17 (Sleepycat) 5/3/98"; +#endif + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_page.h" +#include "log.h" +#include "btree.h" +#include "hash.h" +#include "clib_ext.h" +#include "common_ext.h" + +char *check __P((DB_ENV *, long, long)); +DB_ENV *db_init __P((char *)); +int logpid __P((char *, int)); +int main __P((int, char *[])); +void onint __P((int)); +void siginit __P((void)); +void usage __P((void)); + +int interrupted; +const char + *progname = "db_checkpoint"; /* Program name. */ + +int +main(argc, argv) + int argc; + char *argv[]; +{ + extern char *optarg; + extern int optind; + DB_ENV *dbenv; + time_t now; + long argval; + u_int32_t kbytes, minutes, seconds; + int ch, eval, once, verbose; + char *home, *logfile; + + /* + * XXX + * Don't allow a fully unsigned 32-bit number, some compilers get + * upset and require it to be specified in hexadecimal and so on. + */ +#define MAX_UINT32_T 2147483647 + + kbytes = minutes = 0; + once = verbose = 0; + home = logfile = NULL; + while ((ch = getopt(argc, argv, "1h:k:L:p:v")) != EOF) + switch (ch) { + case '1': + once = 1; + break; + case 'h': + home = optarg; + break; + case 'k': + get_long(optarg, 1, (long)MAX_UINT32_T, &argval); + kbytes = argval; + break; + case 'L': + logfile = optarg; + break; + case 'p': + get_long(optarg, 1, (long)MAX_UINT32_T, &argval); + minutes = argval; + break; + case 'v': + verbose = 1; + break; + case '?': + default: + usage(); + } + argc -= optind; + argv += optind; + + if (argc != 0) + usage(); + + if (once == 0 && kbytes == 0 && minutes == 0) { + warnx("at least one of -1, -k and -p must be specified"); + usage(); + } + + /* Initialize the environment. */ + dbenv = db_init(home); + + if (logfile != NULL && logpid(logfile, 1)) { + (void)db_appexit(dbenv); + return (1); + } + + /* + * If we have only a time delay, then we'll sleep the right amount + * to wake up when a checkpoint is necessary. If we have a "kbytes" + * field set, then we'll check every 30 seconds. + */ + eval = 0; + seconds = kbytes != 0 ? 30 : minutes * 60; + while (!interrupted) { + if (verbose) { + (void)time(&now); + printf("checkpoint: %s", ctime(&now)); + } + errno = txn_checkpoint(dbenv->tx_info, kbytes, minutes); + + while (errno == DB_INCOMPLETE) { + if (verbose) + __db_err(dbenv, + "checkpoint did not finish, retrying"); + (void)__db_sleep(2, 0); + errno = txn_checkpoint(dbenv->tx_info, 0, 0); + } + + if (errno != 0) { + eval = 1; + __db_err(dbenv, "checkpoint: %s", strerror(errno)); + break; + } + + if (once) + break; + + (void)__db_sleep(seconds, 0); + } + + if (logfile != NULL && logpid(logfile, 0)) + eval = 1; + + if (interrupted) { + (void)signal(interrupted, SIG_DFL); + (void)raise(interrupted); + /* NOTREACHED */ + } + + return (db_appexit(dbenv) || eval ? 1 : 0); +} + +/* + * db_init -- + * Initialize the environment. + */ +DB_ENV * +db_init(home) + char *home; +{ + DB_ENV *dbenv; + + if ((dbenv = (DB_ENV *)calloc(sizeof(DB_ENV), 1)) == NULL) { + errno = ENOMEM; + err(1, NULL); + } + dbenv->db_errfile = stderr; + dbenv->db_errpfx = progname; + + if ((errno = db_appinit(home, NULL, dbenv, + DB_INIT_LOG | DB_INIT_TXN | DB_INIT_MPOOL | DB_USE_ENVIRON)) != 0) + err(1, "db_appinit"); + + if (memp_register(dbenv->mp_info, + DB_FTYPE_BTREE, __bam_pgin, __bam_pgout) || + memp_register(dbenv->mp_info, + DB_FTYPE_HASH, __ham_pgin, __ham_pgout)) { + (void)db_appexit(dbenv); + errx(1, + "db_appinit: failed to register access method functions"); + } + + siginit(); + + return (dbenv); +} + +/* + * logpid -- + * Log that we're running. + */ +int +logpid(fname, is_open) + char *fname; + int is_open; +{ + FILE *fp; + time_t now; + + if (is_open) { + if ((fp = fopen(fname, "w")) == NULL) { + warn("%s", fname); + return (1); + } + (void)time(&now); + fprintf(fp, + "%.24s: %lu %s", progname, (u_long)getpid(), ctime(&now)); + fclose(fp); + } else + (void)remove(fname); + return (0); +} + +/* + * siginit -- + * Initialize the set of signals for which we want to clean up. + * Generally, we try not to leave the shared regions locked if + * we can. + */ +void +siginit() +{ +#ifdef SIGHUP + (void)signal(SIGHUP, onint); +#endif + (void)signal(SIGINT, onint); +#ifdef SIGKILL + (void)signal(SIGKILL, onint); +#endif + (void)signal(SIGTERM, onint); +} + +/* + * oninit -- + * Interrupt signal handler. + */ +void +onint(signo) + int signo; +{ + if ((interrupted = signo) == 0) + interrupted = SIGINT; +} + +void +usage() +{ + (void)fprintf(stderr, + "usage: db_checkpoint [-1v] [-h home] [-k kbytes] [-L file] [-p min]\n"); + exit(1); +} diff --git a/mozilla/db/db_deadlock/db_deadlock.c b/mozilla/db/db_deadlock/db_deadlock.c new file mode 100644 index 00000000000..49a52416dd0 --- /dev/null +++ b/mozilla/db/db_deadlock/db_deadlock.c @@ -0,0 +1,241 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char copyright[] = +"@(#) Copyright (c) 1996, 1997, 1998\n\ + Sleepycat Software Inc. All rights reserved.\n"; +static const char sccsid[] = "@(#)db_deadlock.c 10.19 (Sleepycat) 4/10/98"; +#endif + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#include +#include +#include +#endif + +#include "db_int.h" +#include "clib_ext.h" +#include "common_ext.h" + +#define BAD_KILLID 0xffffffff + +DB_ENV *db_init __P((char *, int)); +int logpid __P((char *, int)); +int main __P((int, char *[])); +void onint __P((int)); +void siginit __P((void)); +void usage __P((void)); + +int interrupted; +const char + *progname = "db_deadlock"; /* Program name. */ + +int +main(argc, argv) + int argc; + char *argv[]; +{ + extern char *optarg; + extern int optind; + DB_ENV *dbenv; + u_int32_t atype; + time_t now; + long usecs; + u_int32_t flags; + int ch, verbose; + char *home, *logfile; + + atype = DB_LOCK_DEFAULT; + home = logfile = NULL; + usecs = 0; + flags = 0; + verbose = 0; + while ((ch = getopt(argc, argv, "a:h:L:t:vw")) != EOF) + switch (ch) { + case 'a': + switch (optarg[0]) { + case 'o': + atype = DB_LOCK_OLDEST; + break; + case 'y': + atype = DB_LOCK_YOUNGEST; + break; + default: + usage(); + /* NOTREACHED */ + } + if (optarg[1] != '\0') + usage(); + break; + case 'h': + home = optarg; + break; + case 'L': + logfile = optarg; + break; + case 't': + get_long(optarg, 1, LONG_MAX, &usecs); + usecs *= 1000000; + break; + case 'v': + verbose = 1; + break; + case 'w': + LF_SET(DB_LOCK_CONFLICT); + break; + case '?': + default: + usage(); + } + argc -= optind; + argv += optind; + + if (argc != 0) + usage(); + + if (usecs == 0 && !LF_ISSET(DB_LOCK_CONFLICT)) { + warnx("at least one of -t and -w must be specified"); + usage(); + } + + /* + * We detect every 100ms (100000 us) when we're running in + * DB_LOCK_CONFLICT mode. + */ + if (usecs == 0) + usecs = 100000; + + /* Initialize the deadlock detector by opening the lock manager. */ + dbenv = db_init(home, verbose); + + if (logfile != NULL && logpid(logfile, 1)) { + (void)db_appexit(dbenv); + return (1); + } + + while (!interrupted) { + if (dbenv->db_verbose != 0) { + time(&now); + __db_err(dbenv, "Running at %.24s", ctime(&now)); + } + + if ((errno = lock_detect(dbenv->lk_info, flags, atype)) != 0) + break; + + /* Make a pass every "usecs" usecs. */ + (void)__db_sleep(0, usecs); + } + + if (logfile != NULL) + (void)logpid(logfile, 0); + + if (interrupted) { + (void)signal(interrupted, SIG_DFL); + (void)raise(interrupted); + /* NOTREACHED */ + } + + return (db_appexit(dbenv)); +} + +DB_ENV * +db_init(home, verbose) + char *home; + int verbose; +{ + DB_ENV *dbenv; + + if ((dbenv = (DB_ENV *)calloc(sizeof(DB_ENV), 1)) == NULL) { + errno = ENOMEM; + err(1, NULL); + } + dbenv->db_errfile = stderr; + dbenv->db_errpfx = progname; + dbenv->db_verbose = verbose; + + if ((errno = db_appinit(home, + NULL, dbenv, DB_INIT_LOCK | DB_USE_ENVIRON)) != 0) + err(1, "db_appinit"); + + siginit(); + + return (dbenv); +} + +/* + * logpid -- + * Log that we're running. + */ +int +logpid(fname, is_open) + char *fname; + int is_open; +{ + FILE *fp; + time_t now; + + if (is_open) { + if ((fp = fopen(fname, "w")) == NULL) { + warn("%s", fname); + return (1); + } + (void)time(&now); + fprintf(fp, + "%.24s: %lu %s", progname, (u_long)getpid(), ctime(&now)); + fclose(fp); + } else + (void)remove(fname); + return (0); +} + +/* + * siginit -- + * Initialize the set of signals for which we want to clean up. + * Generally, we try not to leave the shared regions locked if + * we can. + */ +void +siginit() +{ +#ifdef SIGHUP + (void)signal(SIGHUP, onint); +#endif + (void)signal(SIGINT, onint); +#ifdef SIGKILL + (void)signal(SIGKILL, onint); +#endif + (void)signal(SIGTERM, onint); +} + +/* + * oninit -- + * Interrupt signal handler. + */ +void +onint(signo) + int signo; +{ + if ((interrupted = signo) == 0) + interrupted = SIGINT; +} + +void +usage() +{ + (void)fprintf(stderr, + "usage: db_deadlock [-vw] [-a m | o | y] [-h home] [-L file] [-t sec]\n"); + exit(1); +} diff --git a/mozilla/db/db_dump/db_dump.c b/mozilla/db/db_dump/db_dump.c new file mode 100644 index 00000000000..f1b3f2f6c16 --- /dev/null +++ b/mozilla/db/db_dump/db_dump.c @@ -0,0 +1,234 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char copyright[] = +"@(#) Copyright (c) 1996, 1997, 1998\n\ + Sleepycat Software Inc. All rights reserved.\n"; +static const char sccsid[] = "@(#)db_dump.c 10.19 (Sleepycat) 5/23/98"; +#endif + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#include +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "btree.h" +#include "hash.h" +#include "clib_ext.h" + +void configure __P((char *)); +DB_ENV *db_init __P((char *)); +int main __P((int, char *[])); +void pheader __P((DB *, int)); +void usage __P((void)); + +const char + *progname = "db_dump"; /* Program name. */ + +int +main(argc, argv) + int argc; + char *argv[]; +{ + extern char *optarg; + extern int optind; + DB *dbp; + DBC *dbcp; + DBT key, data; + DB_ENV *dbenv; + int ch, checkprint, dflag; + char *home; + + home = NULL; + checkprint = dflag = 0; + while ((ch = getopt(argc, argv, "df:h:p")) != EOF) + switch (ch) { + case 'd': + dflag = 1; + break; + case 'f': + if (freopen(optarg, "w", stdout) == NULL) + err(1, "%s", optarg); + break; + case 'h': + home = optarg; + break; + case 'p': + checkprint = 1; + break; + case '?': + default: + usage(); + } + argc -= optind; + argv += optind; + + if (argc != 1) + usage(); + + if (dflag) { + if (home != NULL) + errx(1, + "the -d and -h options may not both be specified"); + if (checkprint) + errx(1, + "the -d and -p options may not both be specified"); + } + /* Initialize the environment. */ + dbenv = dflag ? NULL : db_init(home); + + /* Open the DB file. */ + if ((errno = + db_open(argv[0], DB_UNKNOWN, DB_RDONLY, 0, dbenv, NULL, &dbp)) != 0) + err(1, "%s", argv[0]); + + /* DB dump. */ + if (dflag) { + (void)__db_dump(dbp, NULL, 1); + if ((errno = dbp->close(dbp, 0)) != 0) + err(1, "close"); + exit (0); + } + + /* Get a cursor and step through the database. */ + if ((errno = dbp->cursor(dbp, NULL, &dbcp)) != 0) { + (void)dbp->close(dbp, 0); + err(1, "cursor"); + } + + /* Print out the header. */ + pheader(dbp, checkprint); + + /* Print out the key/data pairs. */ + memset(&key, 0, sizeof(key)); + memset(&data, 0, sizeof(data)); + while ((errno = dbcp->c_get(dbcp, &key, &data, DB_NEXT)) == 0) { + if (dbp->type != DB_RECNO && + (errno = __db_prdbt(&key, checkprint, stdout)) != 0) + break; + if ((errno = __db_prdbt(&data, checkprint, stdout)) != 0) + break; + } + + if (errno != DB_NOTFOUND) + err(1, "cursor get"); + + if ((errno = dbp->close(dbp, 0)) != 0) + err(1, "close"); + return (0); +} + +/* + * db_init -- + * Initialize the environment. + */ +DB_ENV * +db_init(home) + char *home; +{ + DB_ENV *dbenv; + + if ((dbenv = (DB_ENV *)calloc(sizeof(DB_ENV), 1)) == NULL) { + errno = ENOMEM; + err(1, NULL); + } + dbenv->db_errfile = stderr; + dbenv->db_errpfx = progname; + + if ((errno = + db_appinit(home, NULL, dbenv, DB_CREATE | DB_USE_ENVIRON)) != 0) + err(1, "db_appinit"); + return (dbenv); +} + +/* + * pheader -- + * Write out the header information. + */ +void +pheader(dbp, pflag) + DB *dbp; + int pflag; +{ + DB_BTREE_STAT *btsp; + HTAB *hashp; + HASHHDR *hdr; + db_pgno_t pgno; + + printf("format=%s\n", pflag ? "print" : "bytevalue"); + switch (dbp->type) { + case DB_BTREE: + printf("type=btree\n"); + if ((errno = dbp->stat(dbp, &btsp, NULL, 0)) != 0) + err(1, "dbp->stat"); + if (F_ISSET(dbp, DB_BT_RECNUM)) + printf("recnum=1\n"); + if (btsp->bt_maxkey != 0) + printf("bt_maxkey=%lu\n", (u_long)btsp->bt_maxkey); + if (btsp->bt_minkey != 0) + printf("bt_minkey=%lu\n", (u_long)btsp->bt_minkey); + break; + case DB_HASH: + printf("type=hash\n"); + hashp = dbp->internal; + pgno = PGNO_METADATA; + if (memp_fget(dbp->mpf, &pgno, 0, &hdr) == 0) { + if (hdr->ffactor != 0) + printf("h_ffactor=%lu\n", (u_long)hdr->ffactor); + if (hdr->nelem != 0) + printf("h_nelem=%lu\n", (u_long)hdr->nelem); + (void)memp_fput(dbp->mpf, hdr, 0); + } + break; + case DB_RECNO: + printf("type=recno\n"); + if (F_ISSET(dbp, DB_RE_RENUMBER)) + printf("renumber=1\n"); + if (F_ISSET(dbp, DB_RE_FIXEDLEN)) + printf("re_len=%lu\n", (u_long)btsp->bt_re_len); + if (F_ISSET(dbp, DB_RE_PAD)) + printf("re_pad=%#x\n", btsp->bt_re_pad); + break; + case DB_UNKNOWN: + abort(); + /* NOTREACHED */ + } + + if (F_ISSET(dbp, DB_AM_DUP)) + printf("duplicates=1\n"); + + if (dbp->dbenv->db_lorder != 0) + printf("db_lorder=%lu\n", (u_long)dbp->dbenv->db_lorder); + + if (!F_ISSET(dbp, DB_AM_PGDEF)) + printf("db_pagesize=%lu\n", (u_long)dbp->pgsize); + + printf("HEADER=END\n"); +} + +/* + * usage -- + * Display the usage message. + */ +void +usage() +{ + (void)fprintf(stderr, + "usage: db_dump [-dp] [-f file] [-h home] db_file\n"); + exit(1); +} diff --git a/mozilla/db/db_dump185/db_dump185.c b/mozilla/db/db_dump185/db_dump185.c new file mode 100644 index 00000000000..17451100f9a --- /dev/null +++ b/mozilla/db/db_dump185/db_dump185.c @@ -0,0 +1,353 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char copyright[] = +"@(#) Copyright (c) 1996, 1997, 1998\n\ + Sleepycat Software Inc. All rights reserved.\n"; +static const char sccsid[] = "@(#)db_dump185.c 10.10 (Sleepycat) 4/10/98"; +#endif + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#include +#include +#include +#endif + +#include "db_185.h" +#include "clib_ext.h" + +/* Hash Table Information */ +typedef struct hashhdr185 { /* Disk resident portion */ + int magic; /* Magic NO for hash tables */ + int version; /* Version ID */ + u_int32_t lorder; /* Byte Order */ + int bsize; /* Bucket/Page Size */ + int bshift; /* Bucket shift */ + int dsize; /* Directory Size */ + int ssize; /* Segment Size */ + int sshift; /* Segment shift */ + int ovfl_point; /* Where overflow pages are being + * allocated */ + int last_freed; /* Last overflow page freed */ + int max_bucket; /* ID of Maximum bucket in use */ + int high_mask; /* Mask to modulo into entire table */ + int low_mask; /* Mask to modulo into lower half of + * table */ + int ffactor; /* Fill factor */ + int nkeys; /* Number of keys in hash table */ +} HASHHDR185; +typedef struct htab185 { /* Memory resident data structure */ + HASHHDR185 hdr; /* Header */ +} HTAB185; + +/* Hash Table Information */ +typedef struct hashhdr186 { /* Disk resident portion */ + int32_t magic; /* Magic NO for hash tables */ + int32_t version; /* Version ID */ + int32_t lorder; /* Byte Order */ + int32_t bsize; /* Bucket/Page Size */ + int32_t bshift; /* Bucket shift */ + int32_t ovfl_point; /* Where overflow pages are being allocated */ + int32_t last_freed; /* Last overflow page freed */ + int32_t max_bucket; /* ID of Maximum bucket in use */ + int32_t high_mask; /* Mask to modulo into entire table */ + int32_t low_mask; /* Mask to modulo into lower half of table */ + int32_t ffactor; /* Fill factor */ + int32_t nkeys; /* Number of keys in hash table */ + int32_t hdrpages; /* Size of table header */ + int32_t h_charkey; /* value of hash(CHARKEY) */ +#define NCACHED 32 /* number of bit maps and spare points */ + int32_t spares[NCACHED];/* spare pages for overflow */ + u_int16_t bitmaps[NCACHED]; /* address of overflow page bitmaps */ +} HASHHDR186; +typedef struct htab186 { /* Memory resident data structure */ + HASHHDR186 hdr; /* Header */ +} HTAB186; + +typedef struct _epgno { + u_int32_t pgno; /* the page number */ + u_int16_t index; /* the index on the page */ +} EPGNO; + +typedef struct _epg { + void *page; /* the (pinned) page */ + u_int16_t index; /* the index on the page */ +} EPG; + +typedef struct _cursor { + EPGNO pg; /* B: Saved tree reference. */ + DBT key; /* B: Saved key, or key.data == NULL. */ + u_int32_t rcursor; /* R: recno cursor (1-based) */ + +#define CURS_ACQUIRE 0x01 /* B: Cursor needs to be reacquired. */ +#define CURS_AFTER 0x02 /* B: Unreturned cursor after key. */ +#define CURS_BEFORE 0x04 /* B: Unreturned cursor before key. */ +#define CURS_INIT 0x08 /* RB: Cursor initialized. */ + u_int8_t flags; +} CURSOR; + +/* The in-memory btree/recno data structure. */ +typedef struct _btree { + void *bt_mp; /* memory pool cookie */ + + void *bt_dbp; /* pointer to enclosing DB */ + + EPG bt_cur; /* current (pinned) page */ + void *bt_pinned; /* page pinned across calls */ + + CURSOR bt_cursor; /* cursor */ + + EPGNO bt_stack[50]; /* stack of parent pages */ + EPGNO *bt_sp; /* current stack pointer */ + + DBT bt_rkey; /* returned key */ + DBT bt_rdata; /* returned data */ + + int bt_fd; /* tree file descriptor */ + + u_int32_t bt_free; /* next free page */ + u_int32_t bt_psize; /* page size */ + u_int16_t bt_ovflsize; /* cut-off for key/data overflow */ + int bt_lorder; /* byte order */ + /* sorted order */ + enum { NOT, BACK, FORWARD } bt_order; + EPGNO bt_last; /* last insert */ + + /* B: key comparison function */ + int (*bt_cmp) __P((const DBT *, const DBT *)); + /* B: prefix comparison function */ + size_t (*bt_pfx) __P((const DBT *, const DBT *)); + /* R: recno input function */ + int (*bt_irec) __P((struct _btree *, u_int32_t)); + + FILE *bt_rfp; /* R: record FILE pointer */ + int bt_rfd; /* R: record file descriptor */ + + void *bt_cmap; /* R: current point in mapped space */ + void *bt_smap; /* R: start of mapped space */ + void *bt_emap; /* R: end of mapped space */ + size_t bt_msize; /* R: size of mapped region. */ + + u_int32_t bt_nrecs; /* R: number of records */ + size_t bt_reclen; /* R: fixed record length */ + u_char bt_bval; /* R: delimiting byte/pad character */ + +/* + * NB: + * B_NODUPS and R_RECNO are stored on disk, and may not be changed. + */ +#define B_INMEM 0x00001 /* in-memory tree */ +#define B_METADIRTY 0x00002 /* need to write metadata */ +#define B_MODIFIED 0x00004 /* tree modified */ +#define B_NEEDSWAP 0x00008 /* if byte order requires swapping */ +#define B_RDONLY 0x00010 /* read-only tree */ + +#define B_NODUPS 0x00020 /* no duplicate keys permitted */ +#define R_RECNO 0x00080 /* record oriented tree */ + +#define R_CLOSEFP 0x00040 /* opened a file pointer */ +#define R_EOF 0x00100 /* end of input file reached. */ +#define R_FIXLEN 0x00200 /* fixed length records */ +#define R_MEMMAPPED 0x00400 /* memory mapped file. */ +#define R_INMEM 0x00800 /* in-memory file */ +#define R_MODIFIED 0x01000 /* modified file */ +#define R_RDONLY 0x02000 /* read-only file */ + +#define B_DB_LOCK 0x04000 /* DB_LOCK specified. */ +#define B_DB_SHMEM 0x08000 /* DB_SHMEM specified. */ +#define B_DB_TXN 0x10000 /* DB_TXN specified. */ + u_int32_t flags; +} BTREE; + +void db_btree __P((DB *, int)); +void db_hash __P((DB *, int)); +void dbt_dump __P((DBT *)); +void dbt_print __P((DBT *)); +int main __P((int, char *[])); +void usage __P((void)); + +const char + *progname = "db_dump185"; /* Program name. */ + +int +main(argc, argv) + int argc; + char *argv[]; +{ + extern char *optarg; + extern int optind; + DB *dbp; + DBT key, data; + int ch, pflag, rval; + + pflag = 0; + while ((ch = getopt(argc, argv, "f:p")) != EOF) + switch (ch) { + case 'f': + if (freopen(optarg, "w", stdout) == NULL) + err(1, "%s", optarg); + break; + case 'p': + pflag = 1; + break; + case '?': + default: + usage(); + } + argc -= optind; + argv += optind; + + if (argc != 1) + usage(); + + if ((dbp = dbopen(argv[0], O_RDONLY, 0, DB_BTREE, NULL)) == NULL) { + if ((dbp = dbopen(argv[0], O_RDONLY, 0, DB_HASH, NULL)) == NULL) + err(1, "%s", argv[0]); + db_hash(dbp, pflag); + } else + db_btree(dbp, pflag); + + /* + * !!! + * DB 1.85 DBTs are a subset of DB 2.0 DBTs, so we just use the + * new dump/print routines. + */ + if (pflag) + while (!(rval = dbp->seq(dbp, &key, &data, R_NEXT))) { + dbt_print(&key); + dbt_print(&data); + } + else + while (!(rval = dbp->seq(dbp, &key, &data, R_NEXT))) { + dbt_dump(&key); + dbt_dump(&data); + } + + if (rval == -1) + err(1, "seq"); + return (0); +} + +/* + * db_hash -- + * Dump out hash header information. + */ +void +db_hash(dbp, pflag) + DB *dbp; + int pflag; +{ + HTAB185 *hash185p; + HTAB186 *hash186p; + + printf("format=%s\n", pflag ? "print" : "bytevalue"); + printf("type=hash\n"); + + /* DB 1.85 was version 2, DB 1.86 was version 3. */ + hash185p = dbp->internal; + if (hash185p->hdr.version > 2) { + hash186p = dbp->internal; + printf("h_ffactor=%lu\n", (u_long)hash186p->hdr.ffactor); + if (hash186p->hdr.lorder != 0) + printf("db_lorder=%lu\n", (u_long)hash186p->hdr.lorder); + printf("db_pagesize=%lu\n", (u_long)hash186p->hdr.bsize); + } else { + printf("h_ffactor=%lu\n", (u_long)hash185p->hdr.ffactor); + if (hash185p->hdr.lorder != 0) + printf("db_lorder=%lu\n", (u_long)hash185p->hdr.lorder); + printf("db_pagesize=%lu\n", (u_long)hash185p->hdr.bsize); + } + printf("HEADER=END\n"); +} + +/* + * db_btree -- + * Dump out btree header information. + */ +void +db_btree(dbp, pflag) + DB *dbp; + int pflag; +{ + BTREE *btp; + + btp = dbp->internal; + + printf("format=%s\n", pflag ? "print" : "bytevalue"); + printf("type=btree\n"); +#ifdef NOT_AVAILABLE_IN_185 + printf("bt_minkey=%lu\n", (u_long)XXX); + printf("bt_maxkey=%lu\n", (u_long)XXX); +#endif + if (btp->bt_lorder != 0) + printf("db_lorder=%lu\n", (u_long)btp->bt_lorder); + printf("db_pagesize=%lu\n", (u_long)btp->bt_psize); + if (!(btp->flags & B_NODUPS)) + printf("duplicates=1\n"); + printf("HEADER=END\n"); +} + +static char hex[] = "0123456789abcdef"; + +/* + * dbt_dump -- + * Write out a key or data item using byte values. + */ +void +dbt_dump(dbtp) + DBT *dbtp; +{ + size_t len; + u_int8_t *p; + + for (len = dbtp->size, p = dbtp->data; len--; ++p) + (void)printf("%c%c", + hex[(*p & 0xf0) >> 4], hex[*p & 0x0f]); + printf("\n"); +} + +/* + * dbt_print -- + * Write out a key or data item using printable characters. + */ +void +dbt_print(dbtp) + DBT *dbtp; +{ + size_t len; + u_int8_t *p; + + for (len = dbtp->size, p = dbtp->data; len--; ++p) + if (isprint(*p)) { + if (*p == '\\') + (void)printf("\\"); + (void)printf("%c", *p); + } else + (void)printf("\\%c%c", + hex[(*p & 0xf0) >> 4], hex[*p & 0x0f]); + printf("\n"); +} + +/* + * usage -- + * Display the usage message. + */ +void +usage() +{ + (void)fprintf(stderr, "usage: db_dump [-p] [-f file] db_file\n"); + exit(1); +} diff --git a/mozilla/db/db_load/db_load.c b/mozilla/db/db_load/db_load.c new file mode 100644 index 00000000000..5ac17753f55 --- /dev/null +++ b/mozilla/db/db_load/db_load.c @@ -0,0 +1,512 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char copyright[] = +"@(#) Copyright (c) 1996, 1997, 1998\n\ + Sleepycat Software Inc. All rights reserved.\n"; +static const char sccsid[] = "@(#)db_load.c 10.20 (Sleepycat) 6/2/98"; +#endif + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#include +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "db_am.h" +#include "clib_ext.h" + +void badnum __P((void)); +void configure __P((DB_INFO *, char **)); +DB_ENV *db_init __P((char *)); +int dbt_rdump __P((DBT *)); +int dbt_rprint __P((DBT *)); +int digitize __P((int)); +int main __P((int, char *[])); +void rheader __P((DBTYPE *, int *, DB_INFO *)); +void usage __P((void)); + +const char + *progname = "db_load"; /* Program name. */ + +int +main(argc, argv) + int argc; + char *argv[]; +{ + extern char *optarg; + extern int optind; + DB *dbp; + DBT key, data; + DBTYPE argtype, dbtype; + DB_ENV *dbenv; + DB_INFO dbinfo; + db_recno_t recno; + u_int32_t db_nooverwrite; + int ch, checkprint, existed, no_header; + char **clist, **clp, *home; + + /* Allocate enough room for configuration arguments. */ + if ((clp = clist = (char **)calloc(argc + 1, sizeof(char *))) == NULL) + err(1, NULL); + + home = NULL; + db_nooverwrite = 0; + existed = checkprint = no_header = 0; + argtype = dbtype = DB_UNKNOWN; + while ((ch = getopt(argc, argv, "c:f:h:nTt:")) != EOF) + switch (ch) { + case 'c': + *clp++ = optarg; + break; + case 'f': + if (freopen(optarg, "r", stdin) == NULL) + err(1, "%s", optarg); + break; + case 'h': + home = optarg; + break; + case 'n': + db_nooverwrite = DB_NOOVERWRITE; + break; + case 'T': + no_header = checkprint = 1; + break; + case 't': + if (strcmp(optarg, "btree") == 0) { + argtype = DB_BTREE; + break; + } + if (strcmp(optarg, "hash") == 0) { + argtype = DB_HASH; + break; + } + if (strcmp(optarg, "recno") == 0) { + argtype = DB_RECNO; + break; + } + usage(); + /* NOTREACHED */ + case '?': + default: + usage(); + } + argc -= optind; + argv += optind; + + if (argc != 1) + usage(); + + /* Initialize the environment if the user specified one. */ + dbenv = home == NULL ? NULL : db_init(home); + + /* + * Read the header. If there isn't any header, we're expecting flat + * text, set the checkprint flag appropriately. + */ + memset(&dbinfo, 0, sizeof(DB_INFO)); + if (no_header) + dbtype = argtype; + else { + rheader(&dbtype, &checkprint, &dbinfo); + if (argtype != DB_UNKNOWN) { + /* Conversion to/from recno is prohibited. */ + if ((dbtype == DB_RECNO && argtype != DB_RECNO) || + (argtype == DB_RECNO && dbtype != DB_RECNO)) + errx(1, + "databases of type recno may not be converted"); + dbtype = argtype; + } + } + if (dbtype == DB_UNKNOWN) + errx(1, "no database type specified"); + + /* Apply command-line configuration changes. */ + configure(&dbinfo, clist); + + /* Open the DB file. */ + if ((errno = db_open(argv[0], dbtype, DB_CREATE, + __db_omode("rwrwrw"), dbenv, &dbinfo, &dbp)) != 0) + err(1, "%s", argv[0]); + + /* Initialize the key/data pair. */ + memset(&key, 0, sizeof(DBT)); + if (dbtype == DB_RECNO) { + key.data = &recno; + key.size = sizeof(recno); + } else + if ((key.data = (void *)malloc(key.ulen = 1024)) == NULL) { + errno = ENOMEM; + err(1, NULL); + } + memset(&data, 0, sizeof(DBT)); + if ((data.data = (void *)malloc(data.ulen = 1024)) == NULL) { + errno = ENOMEM; + err(1, NULL); + } + + /* Get each key/data pair and add them to the database. */ + for (recno = 1;; ++recno) { + if (dbtype == DB_RECNO) + if (checkprint) { + if (dbt_rprint(&data)) + break; + } else { + if (dbt_rdump(&data)) + break; + } + else + if (checkprint) { + if (dbt_rprint(&key)) + break; + if (dbt_rprint(&data)) + goto fmt; + } else { + if (dbt_rdump(&key)) + break; + if (dbt_rdump(&data)) +fmt: err(1, "odd number of key/data pairs"); + } + switch (errno = + dbp->put(dbp, NULL, &key, &data, db_nooverwrite)) { + case 0: + break; + case DB_KEYEXIST: + existed = 1; + warnx("%s: line %d: key already exists, not loaded:", + argv[0], + dbtype == DB_RECNO ? recno : recno * 2 - 1); + (void)__db_prdbt(&key, checkprint, stderr); + break; + default: + err(1, "%s", argv[0]); + /* NOTREACHED */ + } + } + + if ((errno = dbp->close(dbp, 0)) != 0) + err(1, "%s", argv[0]); + return (existed ? 1 : 0); +} + +/* + * db_init -- + * Initialize the environment. + */ +DB_ENV * +db_init(home) + char *home; +{ + DB_ENV *dbenv; + + if ((dbenv = (DB_ENV *)calloc(sizeof(DB_ENV), 1)) == NULL) { + errno = ENOMEM; + err(1, NULL); + } + + /* + * The database may be live, try and use the shared regions. + * + * If it works, we're done. Set the error output options so that + * future errors are correctly reported. + */ + if ((errno = db_appinit(home, NULL, dbenv, DB_INIT_LOCK | + DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_USE_ENVIRON)) == 0) { + dbenv->db_errfile = stderr; + dbenv->db_errpfx = progname; + return (dbenv); + } + + /* + * If the db_appinit fails, assume the database isn't live, and don't + * bother with an environment. + */ + free(dbenv); + return (NULL); +} + +#define FLAG(name, value, keyword, flag) \ + if (strcmp(name, keyword) == 0) { \ + switch (*value) { \ + case '1': \ + dbinfop->flags |= (flag); \ + break; \ + case '0': \ + dbinfop->flags &= ~(flag); \ + break; \ + default: \ + badnum(); \ + /* NOTREACHED */ \ + } \ + continue; \ + } +#define NUMBER(name, value, keyword, field, flag) \ + if (strcmp(name, keyword) == 0) { \ + get_long(value, 1, LONG_MAX, &val); \ + dbinfop->field = val; \ + if (flag != 0) \ + dbinfop->flags |= (flag); \ + continue; \ + } +#define STRING(name, value, keyword, field, flag) \ + if (strcmp(name, keyword) == 0) { \ + dbinfop->field = value[0]; \ + if (flag != 0) \ + dbinfop->flags |= (flag); \ + continue; \ + } + +/* + * configure -- + * Handle command-line configuration options. + */ +void +configure(dbinfop, clp) + DB_INFO *dbinfop; + char **clp; +{ + long val; + char *name, *value; + + for (; (name = *clp) != NULL; ++clp) { + if ((value = strchr(name, '=')) == NULL) + errx(1, + "command-line configuration uses name=value format"); + *value++ = '\0'; + + NUMBER(name, value, "bt_maxkey", bt_maxkey, 0); + NUMBER(name, value, "bt_minkey", bt_minkey, 0); + NUMBER(name, value, "db_lorder", db_lorder, 0); + NUMBER(name, value, "db_pagesize", db_pagesize, 0); + FLAG(name, value, "duplicates", DB_DUP); + NUMBER(name, value, "h_ffactor", h_ffactor, 0); + NUMBER(name, value, "h_nelem", h_nelem, 0); + NUMBER(name, value, "re_len", re_len, DB_FIXEDLEN); + STRING(name, value, "re_pad", re_pad, DB_PAD); + FLAG(name, value, "recnum", DB_RECNUM); + FLAG(name, value, "renumber", DB_RENUMBER); + + errx(1, "unknown command-line configuration keyword"); + } +} + +/* + * rheader -- + * Read the header message. + */ +void +rheader(dbtypep, checkprintp, dbinfop) + DBTYPE *dbtypep; + int *checkprintp; + DB_INFO *dbinfop; +{ + long lineno, val; + char name[256], value[256]; + + *dbtypep = DB_UNKNOWN; + *checkprintp = 0; + + for (lineno = 1;; ++lineno) { + /* If we don't see the expected information, it's an error. */ + if (fscanf(stdin, "%[^=]=%s\n", name, value) != 2) + errx(1, "line %lu: unexpected format", lineno); + + /* Check for the end of the header lines. */ + if (strcmp(name, "HEADER") == 0) + break; + + if (strcmp(name, "format") == 0) { + if (strcmp(value, "bytevalue") == 0) { + *checkprintp = 0; + continue; + } + if (strcmp(value, "print") == 0) { + *checkprintp = 1; + continue; + } + errx(1, "line %d: unknown format", lineno); + } + if (strcmp(name, "type") == 0) { + if (strcmp(value, "btree") == 0) { + *dbtypep = DB_BTREE; + continue; + } + if (strcmp(value, "hash") == 0) { + *dbtypep = DB_HASH; + continue; + } + if (strcmp(value, "recno") == 0) { + *dbtypep = DB_RECNO; + continue; + } + errx(1, "line %d: unknown type", lineno); + } + NUMBER(name, value, "bt_maxkey", bt_maxkey, 0); + NUMBER(name, value, "bt_minkey", bt_minkey, 0); + NUMBER(name, value, "db_lorder", db_lorder, 0); + NUMBER(name, value, "db_pagesize", db_pagesize, 0); + FLAG(name, value, "duplicates", DB_DUP); + NUMBER(name, value, "h_ffactor", h_ffactor, 0); + NUMBER(name, value, "h_nelem", h_nelem, 0); + NUMBER(name, value, "re_len", re_len, DB_FIXEDLEN); + STRING(name, value, "re_pad", re_pad, DB_PAD); + FLAG(name, value, "recnum", DB_RECNUM); + FLAG(name, value, "renumber", DB_RENUMBER); + + errx(1, "unknown input-file header configuration keyword"); + } +} + +/* + * dbt_rprint -- + * Read a printable line into a DBT structure. + */ +int +dbt_rprint(dbtp) + DBT *dbtp; +{ + u_int32_t len; + u_int8_t *p; + int c1, c2, escape; + + escape = 0; + for (p = dbtp->data, len = 0; (c1 = getchar()) != '\n';) { + if (c1 == EOF) { + if (len == 0) + return (1); + err(1, "unexpected end of key/data pair"); + } + if (escape) { + if (c1 != '\\') { + if ((c2 = getchar()) == EOF) + err(1, + "unexpected end of key/data pair"); + c1 = digitize(c1) << 4 | digitize(c2); + } + escape = 0; + } else + if (c1 == '\\') { + escape = 1; + continue; + } + if (len >= dbtp->ulen - 10) { + dbtp->ulen *= 2; + if ((dbtp->data = + (void *)realloc(dbtp->data, dbtp->ulen)) == NULL) { + errno = ENOMEM; + err(1, NULL); + } + p = (u_int8_t *)dbtp->data + len; + } + ++len; + *p++ = c1; + } + dbtp->size = len; + return (0); +} + +/* + * dbt_rdump -- + * Read a byte dump line into a DBT structure. + */ +int +dbt_rdump(dbtp) + DBT *dbtp; +{ + u_int32_t len; + u_int8_t *p; + int c1, c2; + + for (p = dbtp->data, len = 0; (c1 = getchar()) != '\n';) { + if (c1 == EOF) { + if (len == 0) + return (1); + err(1, "unexpected end of key/data pair"); + } + if ((c2 = getchar()) == EOF) + err(1, "unexpected end of key/data pair"); + if (len >= dbtp->ulen - 10) { + dbtp->ulen *= 2; + if ((dbtp->data = + (void *)realloc(dbtp->data, dbtp->ulen)) == NULL) { + errno = ENOMEM; + err(1, NULL); + } + p = (u_int8_t *)dbtp->data + len; + } + ++len; + *p++ = digitize(c1) << 4 | digitize(c2); + } + dbtp->size = len; + return (0); +} + +/* + * digitize -- + * Convert a character to an integer. + */ +int +digitize(c) + int c; +{ + switch (c) { /* Don't depend on ASCII ordering. */ + case '0': return (0); + case '1': return (1); + case '2': return (2); + case '3': return (3); + case '4': return (4); + case '5': return (5); + case '6': return (6); + case '7': return (7); + case '8': return (8); + case '9': return (9); + case 'a': return (10); + case 'b': return (11); + case 'c': return (12); + case 'd': return (13); + case 'e': return (14); + case 'f': return (15); + } + + err(1, "unexpected hexadecimal value"); + /* NOTREACHED */ + + return (0); +} + +/* + * badnum -- + * Display the bad number message. + */ +void +badnum() +{ + err(1, "boolean name=value pairs require a value of 0 or 1"); +} + +/* + * usage -- + * Display the usage message. + */ +void +usage() +{ + (void)fprintf(stderr, "%s\n\t%s\n", + "usage: db_load [-nT]", + "[-c name=value] [-f file] [-h home] [-t btree | hash | recno] db_file"); + exit(1); +} diff --git a/mozilla/db/db_printlog/README b/mozilla/db/db_printlog/README new file mode 100644 index 00000000000..7134ee02340 --- /dev/null +++ b/mozilla/db/db_printlog/README @@ -0,0 +1,5 @@ +# @(#)README 10.2 (Sleepycat) 4/24/98 + +DB log dump utility. This utility dumps out a DB log in human readable +form, a record at a time, to assist in recovery and transaction abort +debugging. diff --git a/mozilla/db/db_printlog/db_printlog.c b/mozilla/db/db_printlog/db_printlog.c new file mode 100644 index 00000000000..3b48ad96437 --- /dev/null +++ b/mozilla/db/db_printlog/db_printlog.c @@ -0,0 +1,163 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char copyright[] = +"@(#) Copyright (c) 1996, 1997, 1998\n\ + Sleepycat Software Inc. All rights reserved.\n"; +static const char sccsid[] = "@(#)db_printlog.c 10.12 (Sleepycat) 4/10/98"; +#endif + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_page.h" +#include "btree.h" +#include "hash.h" +#include "log.h" +#include "txn.h" +#include "db_am.h" +#include "clib_ext.h" + +DB_ENV *db_init __P((char *)); +int main __P((int, char *[])); +void onint __P((int)); +void usage __P((void)); + +int interrupted; +const char + *progname = "db_printlog"; /* Program name. */ + +int +main(argc, argv) + int argc; + char *argv[]; +{ + extern char *optarg; + extern int optind; + DB_ENV *dbenv; + DBT data; + DB_LSN key; + int ch, eval; + char *home; + + home = NULL; + while ((ch = getopt(argc, argv, "h:")) != EOF) + switch (ch) { + case 'h': + home = optarg; + break; + case '?': + default: + usage(); + } + argc -= optind; + argv += optind; + + if ((home != NULL && argc > 0) || argc > 1) + usage(); + + /* XXX: backward compatibility, first argument is home. */ + if (argc == 1) + home = argv[0]; + + dbenv = db_init(home); + + eval = 0; + if ((errno = __bam_init_print(dbenv)) != 0 || + (errno = __db_init_print(dbenv)) != 0 || + (errno = __ham_init_print(dbenv)) != 0 || + (errno = __log_init_print(dbenv)) != 0 || + (errno = __txn_init_print(dbenv)) != 0) { + warn("initialization"); + eval = 1; + (void)db_appexit(dbenv); + } + + (void)signal(SIGINT, onint); + + memset(&data, 0, sizeof(data)); + while (!interrupted) { + if ((errno = + log_get(dbenv->lg_info, &key, &data, DB_NEXT)) != 0) { + if (errno == DB_NOTFOUND) + break; + eval = 1; + warn("log_get"); + break; + } + if ((errno = + __db_dispatch(dbenv->lg_info, &data, &key, 0, NULL)) != 0) { + eval = 1; + warn("dispatch"); + break; + } + } + + (void)db_appexit(dbenv); + + if (interrupted) { + (void)signal(SIGINT, SIG_DFL); + (void)raise(SIGINT); + /* NOTREACHED */ + } + return (eval); +} + +/* + * db_init -- + * Initialize the environment. + */ +DB_ENV * +db_init(home) + char *home; +{ + DB_ENV *dbenv; + + if ((dbenv = (DB_ENV *)calloc(sizeof(DB_ENV), 1)) == NULL) { + errno = ENOMEM; + err(1, NULL); + } + dbenv->db_errfile = stderr; + dbenv->db_errpfx = progname; + + if ((errno = + db_appinit(home, NULL, dbenv, DB_CREATE | DB_INIT_LOG)) != 0) + err(1, "db_appinit"); + return (dbenv); +} + +/* + * oninit -- + * Interrupt signal handler. + */ +void +onint(signo) + int signo; +{ + COMPQUIET(signo, 0); + + interrupted = 1; +} + +void +usage() +{ + fprintf(stderr, "usage: db_printlog [-h home]\n"); + exit (1); +} diff --git a/mozilla/db/db_recover/db_recover.c b/mozilla/db/db_recover/db_recover.c new file mode 100644 index 00000000000..a2845725b83 --- /dev/null +++ b/mozilla/db/db_recover/db_recover.c @@ -0,0 +1,126 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char copyright[] = +"@(#) Copyright (c) 1996, 1997, 1998\n\ + Sleepycat Software Inc. All rights reserved.\n"; +static const char sccsid[] = "@(#)db_recover.c 10.19 (Sleepycat) 4/10/98"; +#endif + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "txn.h" +#include "common_ext.h" +#include "clib_ext.h" + +DB_ENV *db_init __P((char *, u_int32_t, int)); +int main __P((int, char *[])); +void usage __P((void)); + +const char + *progname = "db_recover"; /* Program name. */ + +int +main(argc, argv) + int argc; + char *argv[]; +{ + extern char *optarg; + extern int optind; + DB_ENV *dbenv; + time_t now; + u_int32_t flags; + int ch, verbose; + char *home; + + home = NULL; + flags = verbose = 0; + while ((ch = getopt(argc, argv, "ch:v")) != EOF) + switch (ch) { + case 'c': + LF_SET(DB_RECOVER_FATAL); + break; + case 'h': + home = optarg; + break; + case 'v': + verbose = 1; + break; + case '?': + default: + usage(); + } + argc -= optind; + argv += optind; + + if (argc != 0) + usage(); + + dbenv = db_init(home, flags, verbose); + if (verbose) { + __db_err(dbenv, "Recovery complete at %.24s", ctime(&now)); + __db_err(dbenv, "%s %lu %s [%lu][%lu]", + "Maximum transaction id", + (u_long)dbenv->tx_info->region->last_txnid, + "Recovery checkpoint", + (u_long)dbenv->tx_info->region->last_ckp.file, + (u_long)dbenv->tx_info->region->last_ckp.offset); + } + + return (db_appexit(dbenv)); +} + +DB_ENV * +db_init(home, flags, verbose) + char *home; + u_int32_t flags; + int verbose; +{ + DB_ENV *dbenv; + u_int32_t local_flags; + + if ((dbenv = (DB_ENV *)calloc(sizeof(DB_ENV), 1)) == NULL) { + errno = ENOMEM; + err(1, NULL); + } + dbenv->db_errfile = stderr; + dbenv->db_errpfx = "db_recover"; + dbenv->db_verbose = verbose; + + /* Initialize environment for pathnames only. */ + local_flags = DB_CREATE | DB_INIT_LOG | + DB_INIT_MPOOL | DB_INIT_LOCK | DB_INIT_TXN | DB_USE_ENVIRON; + + if (LF_ISSET(DB_RECOVER_FATAL)) + local_flags |= DB_RECOVER_FATAL; + else + local_flags |= DB_RECOVER; + + if ((errno = db_appinit(home, NULL, dbenv, local_flags)) != 0) + err(1, "appinit failed"); + + return (dbenv); +} + +void +usage() +{ + (void)fprintf(stderr, "usage: db_recover [-cv] [-h home]\n"); + exit(1); +} diff --git a/mozilla/db/db_stat/db_stat.c b/mozilla/db/db_stat/db_stat.c new file mode 100644 index 00000000000..215d0ed48ed --- /dev/null +++ b/mozilla/db/db_stat/db_stat.c @@ -0,0 +1,629 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char copyright[] = +"@(#) Copyright (c) 1996, 1997, 1998\n\ + Sleepycat Software Inc. All rights reserved.\n"; +static const char sccsid[] = "@(#)db_stat.c 8.38 (Sleepycat) 5/30/98"; +#endif + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#include +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_shash.h" +#include "lock.h" +#include "mp.h" +#include "clib_ext.h" + +typedef enum { T_NOTSET, T_DB, T_LOCK, T_LOG, T_MPOOL, T_TXN } test_t; + +int argcheck __P((char *, const char *)); +void btree_stats __P((DB *)); +DB_ENV *db_init __P((char *, test_t)); +void dl __P((const char *, u_long)); +void hash_stats __P((DB *)); +int lock_ok __P((char *)); +void lock_stats __P((DB_ENV *)); +void log_stats __P((DB_ENV *)); +int main __P((int, char *[])); +int mpool_ok __P((char *)); +void mpool_stats __P((DB_ENV *)); +void onint __P((int)); +void prflags __P((u_int32_t, const FN *)); +int txn_compare __P((const void *, const void *)); +void txn_stats __P((DB_ENV *)); +void usage __P((void)); + +int interrupted; +char *internal; +const char + *progname = "db_stat"; /* Program name. */ + +int +main(argc, argv) + int argc; + char *argv[]; +{ + extern char *optarg; + extern int optind; + DB *dbp; + DB_ENV *dbenv; + test_t ttype; + int ch; + char *db, *home; + + ttype = T_NOTSET; + db = home = NULL; + while ((ch = getopt(argc, argv, "C:cd:h:lM:mNt")) != EOF) + switch (ch) { + case 'C': + ttype = T_LOCK; + if (!argcheck(internal = optarg, "Acflmo")) + usage(); + break; + case 'c': + ttype = T_LOCK; + break; + case 'd': + db = optarg; + ttype = T_DB; + break; + case 'h': + home = optarg; + break; + case 'l': + ttype = T_LOG; + break; + case 'M': + ttype = T_MPOOL; + if (!argcheck(internal = optarg, "Ahlm")) + usage(); + break; + case 'm': + ttype = T_MPOOL; + break; + case 'N': + (void)db_value_set(0, DB_MUTEXLOCKS); + break; + case 't': + ttype = T_TXN; + break; + case '?': + default: + usage(); + } + argc -= optind; + argv += optind; + + if (argc != 0 || ttype == T_NOTSET) + usage(); + + dbenv = db_init(home, ttype); + + (void)signal(SIGINT, onint); + + switch (ttype) { + case T_DB: + if ((errno = db_open(db, DB_UNKNOWN, + DB_RDONLY, 0, dbenv, NULL, &dbp)) != 0) + return (1); + switch (dbp->type) { + case DB_BTREE: + case DB_RECNO: + btree_stats(dbp); + break; + case DB_HASH: + hash_stats(dbp); + break; + case DB_UNKNOWN: + abort(); /* Impossible. */ + /* NOTREACHED */ + } + (void)dbp->close(dbp, 0); + break; + case T_LOCK: + lock_stats(dbenv); + break; + case T_LOG: + log_stats(dbenv); + break; + case T_MPOOL: + mpool_stats(dbenv); + break; + case T_TXN: + txn_stats(dbenv); + break; + case T_NOTSET: + abort(); /* Impossible. */ + /* NOTREACHED */ + } + + (void)db_appexit(dbenv); + + if (interrupted) { + (void)signal(SIGINT, SIG_DFL); + (void)raise(SIGINT); + /* NOTREACHED */ + } + return (0); +} + +/* + * btree_stats -- + * Display btree/recno statistics. + */ +void +btree_stats(dbp) + DB *dbp; +{ + static const FN fn[] = { + { DB_DUP, "DB_DUP" }, + { DB_FIXEDLEN, "DB_FIXEDLEN" }, + { DB_RECNUM, "DB_RECNUM" }, + { DB_RENUMBER, "DB_RENUMBER" }, + { 0 } + }; + DB_BTREE_STAT *sp; + + if (dbp->stat(dbp, &sp, NULL, 0)) + err(1, "dbp->stat"); + +#define PCT(f, t) \ + (t == 0 ? 0 : \ + (((double)((t * sp->bt_pagesize) - f) / (t * sp->bt_pagesize)) * 100)) + + printf("%#lx\tBtree magic number.\n", (u_long)sp->bt_magic); + printf("%lu\tBtree version number.\n", (u_long)sp->bt_version); + prflags(sp->bt_flags, fn); + if (dbp->type == DB_BTREE) { +#ifdef NOT_IMPLEMENTED + dl("Maximum keys per-page.\n", (u_long)sp->bt_maxkey); +#endif + dl("Minimum keys per-page.\n", (u_long)sp->bt_minkey); + } + if (dbp->type == DB_RECNO) { + dl("Fixed-length record size.\n", (u_long)sp->bt_re_len); + if (isprint(sp->bt_re_pad)) + printf("%c\tFixed-length record pad.\n", + (int)sp->bt_re_pad); + else + printf("0x%x\tFixed-length record pad.\n", + (int)sp->bt_re_pad); + } + dl("Underlying tree page size.\n", (u_long)sp->bt_pagesize); + dl("Number of levels in the tree.\n", (u_long)sp->bt_levels); + dl("Number of keys in the tree.\n", (u_long)sp->bt_nrecs); + dl("Number of tree internal pages.\n", (u_long)sp->bt_int_pg); + dl("Number of tree leaf pages.\n", (u_long)sp->bt_leaf_pg); + dl("Number of tree duplicate pages.\n", (u_long)sp->bt_dup_pg); + dl("Number of tree overflow pages.\n", (u_long)sp->bt_over_pg); + dl("Number of pages on the free list.\n", (u_long)sp->bt_free); + dl("Number of pages freed for reuse.\n", (u_long)sp->bt_freed); + dl("Number of bytes free in tree internal pages", + (u_long)sp->bt_int_pgfree); + printf(" (%.0f%% ff).\n", PCT(sp->bt_int_pgfree, sp->bt_int_pg)); + dl("Number of bytes free in tree leaf pages", + (u_long)sp->bt_leaf_pgfree); + printf(" (%.0f%% ff).\n", PCT(sp->bt_leaf_pgfree, sp->bt_leaf_pg)); + dl("Number of bytes free in tree duplicate pages", + (u_long)sp->bt_dup_pgfree); + printf(" (%.0f%% ff).\n", PCT(sp->bt_dup_pgfree, sp->bt_dup_pg)); + dl("Number of bytes free in tree overflow pages", + (u_long)sp->bt_over_pgfree); + printf(" (%.0f%% ff).\n", PCT(sp->bt_over_pgfree, sp->bt_over_pg)); + dl("Number of bytes saved by prefix compression.\n", + (u_long)sp->bt_pfxsaved); + dl("Total number of tree page splits.\n", (u_long)sp->bt_split); + dl("Number of root page splits.\n", (u_long)sp->bt_rootsplit); + dl("Number of fast splits.\n", (u_long)sp->bt_fastsplit); + dl("Number of hits in tree fast-insert code.\n", + (u_long)sp->bt_cache_hit); + dl("Number of misses in tree fast-insert code.\n", + (u_long)sp->bt_cache_miss); + dl("Number of keys added.\n", (u_long)sp->bt_added); + dl("Number of keys deleted.\n", (u_long)sp->bt_deleted); +} + +/* + * hash_stats -- + * Display hash statistics. + */ +void +hash_stats(dbp) + DB *dbp; +{ + COMPQUIET(dbp, NULL); + + printf("Hash statistics not currently available.\n"); + return; +} + +/* + * lock_stats -- + * Display lock statistics. + */ +void +lock_stats(dbenv) + DB_ENV *dbenv; +{ + DB_LOCK_STAT *sp; + + if (internal != NULL) { + __lock_dump_region(dbenv->lk_info, internal, stdout); + return; + } + + if (lock_stat(dbenv->lk_info, &sp, NULL)) + err(1, NULL); + + printf("%#lx\tLock magic number.\n", (u_long)sp->st_magic); + printf("%lu\tLock version number.\n", (u_long)sp->st_version); + dl("Lock region reference count.\n", (u_long)sp->st_refcnt); + dl("Lock region size.\n", (u_long)sp->st_regsize); + dl("Maximum number of locks.\n", (u_long)sp->st_maxlocks); + dl("Number of lock modes.\n", (u_long)sp->st_nmodes); + dl("Number of lock objects.\n", (u_long)sp->st_numobjs); + dl("Number of lockers.\n", (u_long)sp->st_nlockers); + dl("Number of lock conflicts.\n", (u_long)sp->st_nconflicts); + dl("Number of lock requests.\n", (u_long)sp->st_nrequests); + dl("Number of lock releases.\n", (u_long)sp->st_nreleases); + dl("Number of deadlocks.\n", (u_long)sp->st_ndeadlocks); + dl("The number of region locks granted without waiting.\n", + (u_long)sp->st_region_nowait); + dl("The number of region locks granted after waiting.\n", + (u_long)sp->st_region_wait); +} + +/* + * log_stats -- + * Display log statistics. + */ +void +log_stats(dbenv) + DB_ENV *dbenv; +{ + DB_LOG_STAT *sp; + + if (log_stat(dbenv->lg_info, &sp, NULL)) + err(1, NULL); + + printf("%#lx\tLog magic number.\n", (u_long)sp->st_magic); + printf("%lu\tLog version number.\n", (u_long)sp->st_version); + dl("Log region reference count.\n", (u_long)sp->st_refcnt); + dl("Log region size.\n", (u_long)sp->st_regsize); + printf("%#o\tLog file mode.\n", sp->st_mode); + if (sp->st_lg_max % MEGABYTE == 0) + printf("%luMb\tLog file size.\n", + (u_long)sp->st_lg_max / MEGABYTE); + else if (sp->st_lg_max % 1024 == 0) + printf("%luKb\tLog file size.\n", (u_long)sp->st_lg_max / 1024); + else + printf("%lu\tLog file size.\n", (u_long)sp->st_lg_max); + printf("%luMb\tLog bytes written (+%lu bytes).\n", + (u_long)sp->st_w_mbytes, (u_long)sp->st_w_bytes); + printf("%luMb\tLog bytes written since last checkpoint (+%lu bytes).\n", + (u_long)sp->st_wc_mbytes, (u_long)sp->st_wc_bytes); + dl("Total log file writes.\n", (u_long)sp->st_wcount); + dl("Total log file flushes.\n", (u_long)sp->st_scount); + printf("%lu\tCurrent log file number.\n", (u_long)sp->st_cur_file); + printf("%lu\tCurrent log file offset.\n", (u_long)sp->st_cur_offset); + dl("The number of region locks granted without waiting.\n", + (u_long)sp->st_region_nowait); + dl("The number of region locks granted after waiting.\n", + (u_long)sp->st_region_wait); +} + +/* + * mpool_stats -- + * Display mpool statistics. + */ +void +mpool_stats(dbenv) + DB_ENV *dbenv; +{ + DB_MPOOL_FSTAT **fsp; + DB_MPOOL_STAT *gsp; + + if (internal != NULL) { + __memp_dump_region(dbenv->mp_info, internal, stdout); + return; + } + + if (memp_stat(dbenv->mp_info, &gsp, &fsp, NULL)) + err(1, NULL); + + dl("Pool region reference count.\n", (u_long)gsp->st_refcnt); + dl("Pool region size.\n", (u_long)gsp->st_regsize); + dl("Cache size", (u_long)gsp->st_cachesize); + printf(" (%luK).\n", (u_long)gsp->st_cachesize / 1024); + dl("Requested pages found in the cache", (u_long)gsp->st_cache_hit); + if (gsp->st_cache_hit + gsp->st_cache_miss != 0) + printf(" (%.0f%%)", ((double)gsp->st_cache_hit / + (gsp->st_cache_hit + gsp->st_cache_miss)) * 100); + printf(".\n"); + dl("Requested pages mapped into the process' address space.\n", + (u_long)gsp->st_map); + dl("Requested pages not found in the cache.\n", + (u_long)gsp->st_cache_miss); + dl("Pages created in the cache.\n", (u_long)gsp->st_page_create); + dl("Pages read into the cache.\n", (u_long)gsp->st_page_in); + dl("Pages written from the cache to the backing file.\n", + (u_long)gsp->st_page_out); + dl("Clean pages forced from the cache.\n", + (u_long)gsp->st_ro_evict); + dl("Dirty pages forced from the cache.\n", + (u_long)gsp->st_rw_evict); + dl("Dirty buffers written by trickle-sync thread.\n", + (u_long)gsp->st_page_trickle); + dl("Current clean buffer count.\n", + (u_long)gsp->st_page_clean); + dl("Current dirty buffer count.\n", + (u_long)gsp->st_page_dirty); + dl("Number of hash buckets used for page location.\n", + (u_long)gsp->st_hash_buckets); + dl("Total number of times hash chains searched for a page.\n", + (u_long)gsp->st_hash_searches); + dl("The longest hash chain searched for a page.\n", + (u_long)gsp->st_hash_longest); + dl("Total number of hash buckets examined for page location.\n", + (u_long)gsp->st_hash_examined); + dl("The number of region locks granted without waiting.\n", + (u_long)gsp->st_region_nowait); + dl("The number of region locks granted after waiting.\n", + (u_long)gsp->st_region_wait); + + for (; fsp != NULL && *fsp != NULL; ++fsp) { + printf("%s\n", DB_LINE); + printf("%s\n", (*fsp)->file_name); + dl("Page size.\n", (u_long)(*fsp)->st_pagesize); + dl("Requested pages found in the cache", + (u_long)(*fsp)->st_cache_hit); + if ((*fsp)->st_cache_hit + (*fsp)->st_cache_miss != 0) + printf(" (%.0f%%)", ((double)(*fsp)->st_cache_hit / + ((*fsp)->st_cache_hit + (*fsp)->st_cache_miss)) * + 100); + printf(".\n"); + dl("Requested pages mapped into the process' address space.\n", + (u_long)(*fsp)->st_map); + dl("Requested pages not found in the cache.\n", + (u_long)(*fsp)->st_cache_miss); + dl("Pages created in the cache.\n", + (u_long)(*fsp)->st_page_create); + dl("Pages read into the cache.\n", + (u_long)(*fsp)->st_page_in); + dl("Pages written from the cache to the backing file.\n", + (u_long)(*fsp)->st_page_out); + } +} + +/* + * txn_stats -- + * Display transaction statistics. + */ +void +txn_stats(dbenv) + DB_ENV *dbenv; +{ + DB_TXN_STAT *sp; + u_int32_t i; + const char *p; + + if (txn_stat(dbenv->tx_info, &sp, NULL)) + err(1, NULL); + + dl("Txn region reference count.\n", (u_long)sp->st_refcnt); + dl("Txn region size.\n", (u_long)sp->st_regsize); + p = sp->st_last_ckp.file == 0 ? + "No checkpoint LSN." : "File/offset for last checkpoint LSN."; + printf("%lu/%lu\t%s\n", + (u_long)sp->st_last_ckp.file, (u_long)sp->st_last_ckp.offset, p); + p = sp->st_pending_ckp.file == 0 ? + "No pending checkpoint LSN." : + "File/offset for last pending checkpoint LSN."; + printf("%lu/%lu\t%s\n", + (u_long)sp->st_pending_ckp.file, + (u_long)sp->st_pending_ckp.offset, p); + if (sp->st_time_ckp == 0) + printf("0\tNo checkpoint timestamp.\n"); + else + printf("%.24s\tCheckpoint timestamp.\n", + ctime(&sp->st_time_ckp)); + printf("%lx\tLast transaction ID allocated.\n", + (u_long)sp->st_last_txnid); + dl("Maximum number of active transactions.\n", (u_long)sp->st_maxtxns); + dl("Number of transactions begun.\n", (u_long)sp->st_nbegins); + dl("Number of transactions aborted.\n", (u_long)sp->st_naborts); + dl("Number of transactions committed.\n", (u_long)sp->st_ncommits); + dl("The number of region locks granted without waiting.\n", + (u_long)sp->st_region_nowait); + dl("The number of region locks granted after waiting.\n", + (u_long)sp->st_region_wait); + dl("Active transactions.\n", (u_long)sp->st_nactive); + qsort(sp->st_txnarray, + sp->st_nactive, sizeof(sp->st_txnarray[0]), txn_compare); + for (i = 0; i < sp->st_nactive; ++i) + printf("\tid: %lx; initial LSN file/offest %lu/%lu\n", + (u_long)sp->st_txnarray[i].txnid, + (u_long)sp->st_txnarray[i].lsn.file, + (u_long)sp->st_txnarray[i].lsn.offset); +} + +int +txn_compare(a1, b1) + const void *a1, *b1; +{ + const DB_TXN_ACTIVE *a, *b; + + a = a1; + b = b1; + + if (a->txnid > b->txnid) + return (1); + if (a->txnid < b->txnid) + return (-1); + return (0); +} + +/* + * dl -- + * Display a big value. + */ +void +dl(msg, value) + const char *msg; + u_long value; +{ + /* + * Two formats: if less than 10 million, display as the number, if + * greater than 10 million display as ###M. + */ + if (value < 10000000) + printf("%lu\t%s", value, msg); + else + printf("%luM\t%s", value / 1000000, msg); +} + +/* + * prflags -- + * Print out flag values. + */ +void +prflags(flags, fnp) + u_int32_t flags; + const FN *fnp; +{ + const char *sep; + + sep = " "; + printf("Flags:"); + for (; fnp->mask != 0; ++fnp) + if (fnp->mask & flags) { + printf("%s%s", sep, fnp->name); + sep = ", "; + } + printf("\n"); +} + +/* + * db_init -- + * Initialize the environment. + */ +DB_ENV * +db_init(home, ttype) + char *home; + test_t ttype; +{ + DB_ENV *dbenv; + u_int32_t flags; + + if ((dbenv = (DB_ENV *)malloc(sizeof(DB_ENV))) == NULL) { + errno = ENOMEM; + err(1, NULL); + } + + /* + * Try and use the shared regions when reporting statistics on the + * DB databases, so our information is as up-to-date as possible, + * even if the mpool cache hasn't been flushed. If that fails, we + * turn off the DB_INIT_MPOOL flag and try again. + */ + flags = DB_USE_ENVIRON; + switch (ttype) { + case T_DB: + case T_MPOOL: + LF_SET(DB_INIT_MPOOL); + break; + case T_LOCK: + LF_SET(DB_INIT_LOCK); + break; + case T_LOG: + LF_SET(DB_INIT_LOG); + break; + case T_TXN: + LF_SET(DB_INIT_TXN); + break; + case T_NOTSET: + abort(); + /* NOTREACHED */ + } + + /* + * If it works, we're done. Set the error output options so that + * future errors are correctly reported. + */ + memset(dbenv, 0, sizeof(*dbenv)); + if ((errno = db_appinit(home, NULL, dbenv, flags)) == 0) { + dbenv->db_errfile = stderr; + dbenv->db_errpfx = progname; + return (dbenv); + } + + /* Turn off the DB_INIT_MPOOL flag if it's a database. */ + if (ttype == T_DB) + LF_CLR(DB_INIT_MPOOL); + + /* Set the error output options -- this time we want a message. */ + memset(dbenv, 0, sizeof(*dbenv)); + dbenv->db_errfile = stderr; + dbenv->db_errpfx = progname; + + /* Try again, and it's fatal if we fail. */ + if ((errno = db_appinit(home, NULL, dbenv, flags)) != 0) + err(1, "db_appinit"); + + return (dbenv); +} + +/* + * argcheck -- + * Return if argument flags are okay. + */ +int +argcheck(arg, ok_args) + char *arg; + const char *ok_args; +{ + for (; *arg != '\0'; ++arg) + if (strchr(ok_args, *arg) == NULL) + return (0); + return (1); +} + +/* + * oninit -- + * Interrupt signal handler. + */ +void +onint(signo) + int signo; +{ + COMPQUIET(signo, 0); + + interrupted = 1; +} + +void +usage() +{ + fprintf(stderr, + "usage: db_stat [-clmNt] [-C Acflmo] [-d file] [-h home] [-M Ahlm]\n"); + exit (1); +} diff --git a/mozilla/db/dbm/dbm.c b/mozilla/db/dbm/dbm.c new file mode 100644 index 00000000000..140eb604d19 --- /dev/null +++ b/mozilla/db/dbm/dbm.c @@ -0,0 +1,430 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1990, 1993 + * Margo Seltzer. All rights reserved. + */ +/* + * Copyright (c) 1990, 1993 + * 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. 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)dbm.c 10.16 (Sleepycat) 5/7/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#endif + +#define DB_DBM_HSEARCH 1 +#include "db_int.h" + +#include "db_page.h" +#include "hash.h" + +/* + * + * This package provides dbm and ndbm compatible interfaces to DB. + * + * The DBM routines, which call the NDBM routines. + */ +static DBM *__cur_db; + +static void __db_no_open __P((void)); + +int +__db_dbm_init(file) + char *file; +{ + if (__cur_db != NULL) + (void)dbm_close(__cur_db); + if ((__cur_db = + dbm_open(file, O_CREAT | O_RDWR, __db_omode("rw----"))) != NULL) + return (0); + if ((__cur_db = dbm_open(file, O_RDONLY, 0)) != NULL) + return (0); + return (-1); +} + +datum +__db_dbm_fetch(key) + datum key; +{ + datum item; + + if (__cur_db == NULL) { + __db_no_open(); + item.dptr = 0; + return (item); + } + return (dbm_fetch(__cur_db, key)); +} + +datum +__db_dbm_firstkey() +{ + datum item; + + if (__cur_db == NULL) { + __db_no_open(); + item.dptr = 0; + return (item); + } + return (dbm_firstkey(__cur_db)); +} + +datum +__db_dbm_nextkey(key) + datum key; +{ + datum item; + + COMPQUIET(key.dsize, 0); + + if (__cur_db == NULL) { + __db_no_open(); + item.dptr = 0; + return (item); + } + return (dbm_nextkey(__cur_db)); +} + +int +__db_dbm_delete(key) + datum key; +{ + int ret; + + if (__cur_db == NULL) { + __db_no_open(); + return (-1); + } + ret = dbm_delete(__cur_db, key); + if (ret == 0) + ret = (((DB *)__cur_db)->sync)((DB *)__cur_db, 0); + return (ret); +} + +int +__db_dbm_store(key, dat) + datum key, dat; +{ + int ret; + + if (__cur_db == NULL) { + __db_no_open(); + return (-1); + } + ret = dbm_store(__cur_db, key, dat, DBM_REPLACE); + if (ret == 0) + ret = (((DB *)__cur_db)->sync)((DB *)__cur_db, 0); + return (ret); +} + +static void +__db_no_open() +{ + (void)fprintf(stderr, "dbm: no open database.\n"); +} + +/* + * This package provides dbm and ndbm compatible interfaces to DB. + * + * The NDBM routines, which call the DB routines. + */ +/* + * Returns: + * *DBM on success + * NULL on failure + */ +DBM * +__db_ndbm_open(file, oflags, mode) + const char *file; + int oflags, mode; +{ + DB *dbp; + DB_INFO dbinfo; + char path[MAXPATHLEN]; + + memset(&dbinfo, 0, sizeof(dbinfo)); + dbinfo.db_pagesize = 4096; + dbinfo.h_ffactor = 40; + dbinfo.h_nelem = 1; + + /* + * XXX + * Don't use sprintf(3)/snprintf(3) -- the former is dangerous, and + * the latter isn't standard, and we're manipulating strings handed + * us by the application. + */ + if (strlen(file) + strlen(DBM_SUFFIX) + 1 > sizeof(path)) { + errno = ENAMETOOLONG; + return (NULL); + } + (void)strcpy(path, file); + (void)strcat(path, DBM_SUFFIX); + if ((errno = db_open(path, + DB_HASH, __db_oflags(oflags), mode, NULL, &dbinfo, &dbp)) != 0) + return (NULL); + return ((DBM *)dbp); +} + +/* + * Returns: + * Nothing. + */ +void +__db_ndbm_close(db) + DBM *db; +{ + (void)db->close(db, 0); +} + +/* + * Returns: + * DATUM on success + * NULL on failure + */ +datum +__db_ndbm_fetch(db, key) + DBM *db; + datum key; +{ + DBT _key, _data; + datum data; + int ret; + + memset(&_key, 0, sizeof(DBT)); + memset(&_data, 0, sizeof(DBT)); + _key.size = key.dsize; + _key.data = key.dptr; + if ((ret = db->get((DB *)db, NULL, &_key, &_data, 0)) == 0) { + data.dptr = _data.data; + data.dsize = _data.size; + } else { + data.dptr = NULL; + data.dsize = 0; + errno = ret == DB_NOTFOUND ? ENOENT : ret; + } + return (data); +} + +/* + * Returns: + * DATUM on success + * NULL on failure + */ +datum +__db_ndbm_firstkey(db) + DBM *db; +{ + DBT _key, _data; + datum key; + int ret; + + DBC *cp; + + if ((cp = TAILQ_FIRST(&db->curs_queue)) == NULL) + if ((errno = db->cursor(db, NULL, &cp)) != 0) { + memset(&key, 0, sizeof(key)); + return (key); + } + + memset(&_key, 0, sizeof(DBT)); + memset(&_data, 0, sizeof(DBT)); + if ((ret = (cp->c_get)(cp, &_key, &_data, DB_FIRST)) == 0) { + key.dptr = _key.data; + key.dsize = _key.size; + } else { + key.dptr = NULL; + key.dsize = 0; + errno = ret == DB_NOTFOUND ? ENOENT : ret; + } + return (key); +} + +/* + * Returns: + * DATUM on success + * NULL on failure + */ +datum +__db_ndbm_nextkey(db) + DBM *db; +{ + DBC *cp; + DBT _key, _data; + datum key; + int ret; + + if ((cp = TAILQ_FIRST(&db->curs_queue)) == NULL) + if ((errno = db->cursor(db, NULL, &cp)) != 0) { + memset(&key, 0, sizeof(key)); + return (key); + } + + memset(&_key, 0, sizeof(DBT)); + memset(&_data, 0, sizeof(DBT)); + if ((ret = (cp->c_get)(cp, &_key, &_data, DB_NEXT)) == 0) { + key.dptr = _key.data; + key.dsize = _key.size; + } else { + key.dptr = NULL; + key.dsize = 0; + errno = ret == DB_NOTFOUND ? ENOENT : ret; + } + return (key); +} + +/* + * Returns: + * 0 on success + * <0 failure + */ +int +__db_ndbm_delete(db, key) + DBM *db; + datum key; +{ + DBT _key; + int ret; + + memset(&_key, 0, sizeof(DBT)); + _key.data = key.dptr; + _key.size = key.dsize; + if ((ret = (((DB *)db)->del)((DB *)db, NULL, &_key, 0)) == 0) + return (0); + errno = ret == DB_NOTFOUND ? ENOENT : ret; + return (-1); +} + +/* + * Returns: + * 0 on success + * <0 failure + * 1 if DBM_INSERT and entry exists + */ +int +__db_ndbm_store(db, key, data, flags) + DBM *db; + datum key, data; + int flags; +{ + DBT _key, _data; + int ret; + + memset(&_key, 0, sizeof(DBT)); + memset(&_data, 0, sizeof(DBT)); + _key.data = key.dptr; + _key.size = key.dsize; + _data.data = data.dptr; + _data.size = data.dsize; + if ((ret = db->put((DB *)db, NULL, + &_key, &_data, flags == DBM_INSERT ? DB_NOOVERWRITE : 0)) == 0) + return (0); + if (ret == DB_KEYEXIST) + return (1); + errno = ret; + return (-1); +} + +int +__db_ndbm_error(db) + DBM *db; +{ + HTAB *hp; + + hp = (HTAB *)db->internal; + return (hp->local_errno); +} + +int +__db_ndbm_clearerr(db) + DBM *db; +{ + HTAB *hp; + + hp = (HTAB *)db->internal; + hp->local_errno = 0; + return (0); +} + +/* + * Returns: + * 1 if read-only + * 0 if not read-only + */ +int +__db_ndbm_rdonly(db) + DBM *db; +{ + return (F_ISSET((DB *)db, DB_AM_RDONLY) ? 1 : 0); +} + +/* + * XXX + * We only have a single file descriptor that we can return, not two. Return + * the same one for both files. Hopefully, the user is using it for locking + * and picked one to use at random. + */ +int +__db_ndbm_dirfno(db) + DBM *db; +{ + int fd; + + (void)db->fd(db, &fd); + return (fd); +} + +int +__db_ndbm_pagfno(db) + DBM *db; +{ + int fd; + + (void)db->fd(db, &fd); + return (fd); +} diff --git a/mozilla/db/dist/Makefile.in b/mozilla/db/dist/Makefile.in new file mode 100644 index 00000000000..b3111b8af67 --- /dev/null +++ b/mozilla/db/dist/Makefile.in @@ -0,0 +1,542 @@ +# @(#)Makefile.in 10.47 (Sleepycat) 4/25/98 + +srcdir= @srcdir@/.. +CPPFLAGS=-I. -I$(srcdir)/include @CPPFLAGS@ +CFLAGS= -c @CFLAGS@ $(CPPFLAGS) +CC= @CC@ +CXXFLAGS=-c @CXXFLAGS@ $(CPPFLAGS) +CXX= @CXX@ +LDFLAGS=@LDFLAGS@ +LIBS= @LIBS@ + +SHELL= @db_cv_path_sh@ +ar= @db_cv_path_ar@ cq +chmod= @db_cv_path_chmod@ +cp= @db_cv_path_cp@ +mkdir= @db_cv_path_mkdir@ +ranlib= @db_cv_path_ranlib@ +rm= @db_cv_path_rm@ +strip= @db_cv_path_strip@ + +OBJS= bt_close.o bt_compare.o bt_conv.o bt_cursor.o bt_delete.o \ + bt_open.o bt_page.o bt_put.o bt_rec.o bt_recno.o bt_rsearch.o \ + bt_search.o bt_split.o bt_stat.o btree_auto.o db.o db_appinit.o \ + db_apprec.o db_auto.o db_byteorder.o db_conv.o db_dispatch.o \ + db_dup.o db_err.o db_log2.o db_overflow.o db_pr.o db_rec.o \ + db_region.o db_ret.o db_salloc.o db_shash.o db_thread.o dbm.o \ + hash.o hash_auto.o hash_conv.o hash_debug.o hash_dup.o hash_func.o \ + hash_page.o hash_rec.o hash_stat.o hsearch.o lock.o \ + lock_conflict.o lock_deadlock.o lock_util.o lock_region.o log.o \ + log_archive.o log_auto.o log_compare.o log_findckp.o log_get.o \ + log_put.o log_rec.o log_register.o mp_bh.o mp_fget.o mp_fopen.o \ + mp_fput.o mp_fset.o mp_open.o mp_pr.o mp_region.o mp_sync.o \ + mutex.o os_abs.o os_alloc.o os_config.o os_dir.o os_fid.o \ + os_fsync.o os_map.o os_oflags.o os_open.o os_rpath.o os_rw.o \ + os_seek.o os_sleep.o os_spin.o os_stat.o os_unlink.o txn.o \ + txn_auto.o txn_rec.o +COBJS= cxx_app.o cxx_except.o cxx_lock.o cxx_log.o cxx_mpool.o cxx_table.o \ + cxx_txn.o + +PROGS= @build_additional@ db_archive db_checkpoint db_deadlock \ + db_dump db_load db_printlog db_recover db_stat + +LOBJS= @LIBOBJS@ +POBJS= err.o getlong.o + +libdb= libdb.a +all: $(libdb) $(PROGS) + +$(libdb): db.h $(OBJS) $(LOBJS) + $(rm) -f $@ + $(ar) $@ $(OBJS) $(LOBJS) + test ! -f $(ranlib) || $(ranlib) $@ + +DBA= db_archive.o $(POBJS) +db_archive: $(DBA) $(libdb) + $(CC) -o $@ $(LDFLAGS) $(DBA) $(libdb) $(LIBS) + +DBB= db_checkpoint.o $(POBJS) +db_checkpoint: $(DBB) $(libdb) + $(CC) -o $@ $(LDFLAGS) $(DBB) $(libdb) $(LIBS) + +DBC= db_deadlock.o $(POBJS) +db_deadlock: $(DBC) $(libdb) + $(CC) -o $@ $(LDFLAGS) $(DBC) $(libdb) $(LIBS) + +DBD= db_dump.o $(POBJS) +db_dump: $(DBD) $(libdb) + $(CC) -o $@ $(LDFLAGS) $(DBD) $(libdb) $(LIBS) + +DBE= db_dump185.o $(POBJS) +db_dump185: $(DBE) + $(CC) -o $@ $(LDFLAGS) $(DBE) $(LIBS) + +DBF= db_load.o $(POBJS) +db_load: $(DBF) $(libdb) + $(CC) -o $@ $(LDFLAGS) $(DBF) $(libdb) $(LIBS) + +DBG= db_printlog.o $(POBJS) +db_printlog: $(DBG) $(libdb) + $(CC) -o $@ $(LDFLAGS) $(DBG) $(libdb) $(LIBS) + +DBH= db_recover.o $(POBJS) +db_recover: $(DBH) $(libdb) + $(CC) -o $@ $(LDFLAGS) $(DBH) $(libdb) $(LIBS) + +DBI= db_stat.o $(POBJS) +db_stat: $(DBI) $(libdb) + $(CC) -o $@ $(LDFLAGS) $(DBI) $(libdb) $(LIBS) + +EPROGS= ex_access ex_appinit ex_btrec ex_lock ex_mpool ex_thread ex_tpcb +DBJ= ex_access.o +ex_access: $(DBJ) $(libdb) + $(CC) -o $@ $(LDFLAGS) $(DBJ) $(libdb) $(LIBS) + +DBK= ex_appinit.o +ex_appinit: $(DBK) $(libdb) + $(CC) -o $@ $(LDFLAGS) $(DBK) $(libdb) $(LIBS) + +DBL= ex_btrec.o +ex_btrec: $(DBL) $(libdb) + $(CC) -o $@ $(LDFLAGS) $(DBL) $(libdb) $(LIBS) + +DBM= ex_lock.o $(POBJS) +ex_lock: $(DBM) $(libdb) + $(CC) -o $@ $(LDFLAGS) $(DBM) $(libdb) $(LIBS) + +DBN= ex_mpool.o +ex_mpool: $(DBN) $(libdb) + $(CC) -o $@ $(LDFLAGS) $(DBN) $(libdb) $(LIBS) + +DBO= ex_thread.o +ex_thread: $(DBO) $(libdb) + $(CC) -o $@ $(LDFLAGS) $(DBO) $(libdb) $(LIBS) + +DBP= ex_tpcb.o $(POBJS) +ex_tpcb: $(DBP) $(libdb) + $(CC) -o $@ $(LDFLAGS) $(DBP) $(libdb) $(LIBS) + +DBT= tclAppInit.o tcl_dbm.o tcl_hsearch.o tcl_lock.o tcl_log.o tcl_mpool.o \ + tcl_mutex.o tcl_ndbm.o tcl_txn.o utils.o $(POBJS) + +dbtest: .dbtestrc +dbtest: $(DBT) $(libdb) + $(CC) -o $@ $(LDFLAGS) $(DBT) $(libdb) $(LIBS) + +AOBJS= err.o getcwd.o getlong.o getopt.o memcmp.o memcpy.o memmove.o \ + raise.o snprintf.o strerror.o strsep.o vsnprintf.o + +clean: + $(rm) -f $(OBJS) $(AOBJS) + $(rm) -f $(DBA) $(DBB) $(DBC) $(DBD) $(DBE) $(DBF) $(DBG) $(DBH) + $(rm) -f $(DBI) $(DBJ) $(DBK) $(DBL) $(DBM) $(DBN) $(DBO) $(DBP) + $(rm) -f $(DBT) + $(rm) -f $(PROGS) $(EPROGS) $(POBJS) $(LOBJS) @build_test@ + $(rm) -f core *.core .dbtestrc $(libdb) + +depend obj: + +realclean distclean: clean + $(rm) -f Makefile config.cache config.h config.log config.status + $(rm) -f confdefs.h db.h db_int.h db_185.h include.tcl + +prefix= @prefix@ +sprefix=@prefix@ +bindir= @bindir@ +datadir=@datadir@ +exec_prefix=@exec_prefix@ +includedir=@includedir@ +libdir= @libdir@ +mandir= @mandir@ + +dmode= 755 +emode= 555 +fmode= 444 + +transform=@program_transform_name@ + +man1= db_archive.1 db_checkpoint.1 db_deadlock.1 db_dump.1 db_load.1 \ + db_recover.1 db_stat.1 +man10= db_archive.0 db_checkpoint.0 db_deadlock.0 db_dump.0 db_load.0 \ + db_recover.0 db_stat.0 +man3= db_appinit.3 db_cursor.3 db_dbm.3 db_dbt.3 db_hsearch.3 db_internal.3 \ + db_intro.3 db_lock.3 db_log.3 db_mpool.3 db_open.3 db_thread.3 db_txn.3 +manx3= Db.3 DbEnv.3 DbException.3 DbInfo.3 DbLock.3 DbLockTab.3 DbLog.3 \ + DbLsn.3 DbMpool.3 DbMpoolFile.3 DbTxn.3 DbTxnMgr.3 Dbc.3 Dbt.3 +man30= db_appinit.0 db_cursor.0 db_dbm.0 db_dbt.0 db_hsearch.0 db_internal.0 \ + db_intro.0 db_lock.0 db_log.0 db_mpool.0 db_open.0 db_thread.0 db_txn.0 +manx30= Db.0 DbEnv.0 DbException.0 DbInfo.0 DbLock.0 DbLockTab.0 DbLog.0 \ + DbLsn.0 DbMpool.0 DbMpoolFile.0 DbTxn.0 DbTxnMgr.0 Dbc.0 Dbt.0 + +install: all + @test -f $(chmod) || (echo 'chmod not found.'; exit 1) + @test -f $(cp) || (echo 'cp not found.'; exit 1) + @test -f $(mkdir) || (echo 'mkdir not found.'; exit 1) + @test -f $(rm) || (echo 'rm not found.'; exit 1) + @test -d $(prefix) || \ + ($(mkdir) $(prefix) && $(chmod) $(dmode) $(prefix)) + @test -d $(exec_prefix) || \ + ($(mkdir) $(exec_prefix) && $(chmod) $(dmode) $(exec_prefix)) + @echo "Installing DB include file: $(includedir) ..." + @test -d $(includedir) || \ + ($(mkdir) $(includedir) && $(chmod) $(dmode) $(includedir)) + @cd $(includedir) && $(rm) -f db.h db_185.h db_cxx.h + @$(cp) -p db.h db_185.h $(srcdir)/include/db_cxx.h $(includedir) + @cd $(includedir) && $(chmod) $(fmode) db.h db_185.h db_cxx.h + @echo "Installing DB library: $(libdir) ..." + @test -d $(libdir) || \ + ($(mkdir) $(libdir) && $(chmod) $(dmode) $(libdir)) + @cd $(libdir) && $(rm) -f $(libdb) + @$(cp) -p $(libdb) $(libdir) + @cd $(libdir) && $(chmod) $(fmode) $(libdb) + @echo "Installing DB utilities: $(bindir) ..." + @test -d $(bindir) || \ + ($(mkdir) $(bindir) && $(chmod) $(dmode) $(bindir)) + @cd $(bindir) && $(rm) -f $(PROGS) + @$(cp) -p $(PROGS) $(bindir) + @cd $(bindir) && (test ! -f $(strip) || $(strip) $(PROGS)) + @cd $(bindir) && $(chmod) $(emode) $(PROGS) + @test -d $(mandir) || \ + ($(mkdir) $(mandir) && $(chmod) $(dmode) $(mandir)) + @echo "Installing formatted man pages: $(mandir)/cat1 ..." + @test -d $(mandir)/cat1 || \ + ($(mkdir) $(mandir)/cat1 && $(chmod) $(dmode) $(mandir)/cat1) + @cd $(mandir)/cat1 && $(rm) -f $(man10) + @cd $(srcdir)/man/man.text && $(cp) -p $(man10) $(mandir)/cat1 + @cd $(mandir)/cat1 && $(chmod) $(fmode) $(man10) + @echo "Installing formatted man pages: $(mandir)/cat3 ..." + @test -d $(mandir)/cat3 || \ + ($(mkdir) $(mandir)/cat3 && $(chmod) $(dmode) $(mandir)/cat3) + @cd $(mandir)/cat3 && $(rm) -f $(man30) $(manx30) + @cd $(srcdir)/man/man.text && $(cp) -p $(man30) $(mandir)/cat3 + @cd $(srcdir)/man/mancxx.text && $(cp) -p $(manx30) $(mandir)/cat3 + @cd $(mandir)/cat3 && $(chmod) $(fmode) $(man30) $(manx30) + @echo "Installing unformatted man pages: $(mandir)/man1 ..." + @test -d $(mandir)/man1 || \ + ($(mkdir) $(mandir)/man1 && $(chmod) $(dmode) $(mandir)/man1) + @cd $(mandir)/man1 && $(rm) -f $(man1) + @cd $(srcdir)/man/man.roff && $(cp) -p $(man1) $(mandir)/man1 + @cd $(mandir)/man1 && $(chmod) $(fmode) $(man1) + @echo "Installing unformatted man pages: $(mandir)/man3 ..." + @test -d $(mandir)/man3 || \ + ($(mkdir) $(mandir)/man3 && $(chmod) $(dmode) $(mandir)/man3) + @cd $(mandir)/man3 && $(rm) -f $(man3) $(manx3) + @cd $(srcdir)/man/man.roff && $(cp) -p $(man3) $(mandir)/man3 + @cd $(srcdir)/man/mancxx.roff && $(cp) -p $(manx3) $(mandir)/man3 + @cd $(mandir)/man3 && $(chmod) $(fmode) $(man3) $(manx3) + +uninstall: + -cd $(includedir) && $(rm) -f db.h db_185.h db_cxx.h + -cd $(libdir) && $(rm) -f $(libdb) + -cd $(bindir) && $(rm) -f $(PROGS) + -cd $(mandir)/man1 && $(rm) -f $(man1) + -cd $(mandir)/cat1 && $(rm) -f $(man10) + -cd $(mandir)/man3 && $(rm) -f $(man3) $(manx3) + -cd $(mandir)/cat3 && $(rm) -f $(man30) $(manx30) + +# Programs. +db_archive.o: $(srcdir)/db_archive/db_archive.c + $(CC) $(CFLAGS) $? +db_checkpoint.o: $(srcdir)/db_checkpoint/db_checkpoint.c + $(CC) $(CFLAGS) $? +db_deadlock.o: $(srcdir)/db_deadlock/db_deadlock.c + $(CC) $(CFLAGS) $? +db_dump.o: $(srcdir)/db_dump/db_dump.c + $(CC) $(CFLAGS) $? +db_dump185.o: $(srcdir)/db_dump185/db_dump185.c + $(CC) $(CFLAGS) $? +db_load.o: $(srcdir)/db_load/db_load.c + $(CC) $(CFLAGS) $? +db_printlog.o: $(srcdir)/db_printlog/db_printlog.c + $(CC) $(CFLAGS) $? +db_recover.o: $(srcdir)/db_recover/db_recover.c + $(CC) $(CFLAGS) $? +db_stat.o: $(srcdir)/db_stat/db_stat.c + $(CC) $(CFLAGS) $? + +# Examples. +ex_access.o: $(srcdir)/examples/ex_access.c + $(CC) $(CFLAGS) $? +ex_appinit.o: $(srcdir)/examples/ex_appinit.c + $(CC) $(CFLAGS) $? +ex_btrec.o: $(srcdir)/examples/ex_btrec.c + $(CC) $(CFLAGS) $? +ex_lock.o: $(srcdir)/examples/ex_lock.c + $(CC) $(CFLAGS) $? +ex_mpool.o: $(srcdir)/examples/ex_mpool.c + $(CC) $(CFLAGS) $? +ex_thread.o: $(srcdir)/examples/ex_thread.c + $(CC) $(CFLAGS) $? +ex_tpcb.o: $(srcdir)/examples/ex_tpcb.c + $(CC) $(CFLAGS) $? + +# DB files. +db.o: $(srcdir)/db/db.c + $(CC) $(CFLAGS) $? +db_auto.o: $(srcdir)/db/db_auto.c + $(CC) $(CFLAGS) $? +db_conv.o: $(srcdir)/db/db_conv.c + $(CC) $(CFLAGS) $? +db_dispatch.o: $(srcdir)/db/db_dispatch.c + $(CC) $(CFLAGS) $? +db_dup.o: $(srcdir)/db/db_dup.c + $(CC) $(CFLAGS) $? +db_overflow.o: $(srcdir)/db/db_overflow.c + $(CC) $(CFLAGS) $? +db_pr.o: $(srcdir)/db/db_pr.c + $(CC) $(CFLAGS) $? +db_rec.o: $(srcdir)/db/db_rec.c + $(CC) $(CFLAGS) $? +db_ret.o: $(srcdir)/db/db_ret.c + $(CC) $(CFLAGS) $? +db_thread.o: $(srcdir)/db/db_thread.c + $(CC) $(CFLAGS) $? + +# Btree source files. +bt_close.o: $(srcdir)/btree/bt_close.c + $(CC) $(CFLAGS) $? +bt_compare.o: $(srcdir)/btree/bt_compare.c + $(CC) $(CFLAGS) $? +bt_conv.o: $(srcdir)/btree/bt_conv.c + $(CC) $(CFLAGS) $? +bt_cursor.o: $(srcdir)/btree/bt_cursor.c + $(CC) $(CFLAGS) $? +bt_delete.o: $(srcdir)/btree/bt_delete.c + $(CC) $(CFLAGS) $? +bt_open.o: $(srcdir)/btree/bt_open.c + $(CC) $(CFLAGS) $? +bt_page.o: $(srcdir)/btree/bt_page.c + $(CC) $(CFLAGS) $? +bt_put.o: $(srcdir)/btree/bt_put.c + $(CC) $(CFLAGS) $? +bt_rec.o: $(srcdir)/btree/bt_rec.c + $(CC) $(CFLAGS) $? +bt_recno.o: $(srcdir)/btree/bt_recno.c + $(CC) $(CFLAGS) $? +bt_rsearch.o: $(srcdir)/btree/bt_rsearch.c + $(CC) $(CFLAGS) $? +bt_search.o: $(srcdir)/btree/bt_search.c + $(CC) $(CFLAGS) $? +bt_split.o: $(srcdir)/btree/bt_split.c + $(CC) $(CFLAGS) $? +bt_stack.o: $(srcdir)/btree/bt_stack.c + $(CC) $(CFLAGS) $? +bt_stat.o: $(srcdir)/btree/bt_stat.c + $(CC) $(CFLAGS) $? +btree_auto.o: $(srcdir)/btree/btree_auto.c + $(CC) $(CFLAGS) $? + +# C++ interface files. +cxx_app.o: $(srcdir)/cxx/cxx_app.cpp + $(CXX) $(CXXFLAGS) $? +cxx_except.o: $(srcdir)/cxx/cxx_except.cpp + $(CXX) $(CXXFLAGS) $? +cxx_lock.o: $(srcdir)/cxx/cxx_lock.cpp + $(CXX) $(CXXFLAGS) $? +cxx_log.o: $(srcdir)/cxx/cxx_log.cpp + $(CXX) $(CXXFLAGS) $? +cxx_mpool.o: $(srcdir)/cxx/cxx_mpool.cpp + $(CXX) $(CXXFLAGS) $? +cxx_table.o: $(srcdir)/cxx/cxx_table.cpp + $(CXX) $(CXXFLAGS) $? +cxx_txn.o: $(srcdir)/cxx/cxx_txn.cpp + $(CXX) $(CXXFLAGS) $? + +# Hash source files. +hash_auto.o: $(srcdir)/hash/hash_auto.c + $(CC) $(CFLAGS) $? +hash.o: $(srcdir)/hash/hash.c + $(CC) $(CFLAGS) $? +hash_conv.o: $(srcdir)/hash/hash_conv.c + $(CC) $(CFLAGS) $? +hash_debug.o: $(srcdir)/hash/hash_debug.c + $(CC) $(CFLAGS) $? +hash_dup.o: $(srcdir)/hash/hash_dup.c + $(CC) $(CFLAGS) $? +hash_func.o: $(srcdir)/hash/hash_func.c + $(CC) $(CFLAGS) $? +hash_page.o: $(srcdir)/hash/hash_page.c + $(CC) $(CFLAGS) $? +hash_rec.o: $(srcdir)/hash/hash_rec.c + $(CC) $(CFLAGS) $? +hash_stat.o: $(srcdir)/hash/hash_stat.c + $(CC) $(CFLAGS) $? + +# Lock source files. +lock.o: $(srcdir)/lock/lock.c + $(CC) $(CFLAGS) $? +lock_conflict.o:$(srcdir)/lock/lock_conflict.c + $(CC) $(CFLAGS) $? +lock_deadlock.o:$(srcdir)/lock/lock_deadlock.c + $(CC) $(CFLAGS) $? +lock_region.o:$(srcdir)/lock/lock_region.c + $(CC) $(CFLAGS) $? +lock_util.o:$(srcdir)/lock/lock_util.c + $(CC) $(CFLAGS) $? + +# Log source files. +log.o: $(srcdir)/log/log.c + $(CC) $(CFLAGS) $? +log_archive.o: $(srcdir)/log/log_archive.c + $(CC) $(CFLAGS) $? +log_auto.o: $(srcdir)/log/log_auto.c + $(CC) $(CFLAGS) $? +log_compare.o: $(srcdir)/log/log_compare.c + $(CC) $(CFLAGS) $? +log_findckp.o: $(srcdir)/log/log_findckp.c + $(CC) $(CFLAGS) $? +log_get.o: $(srcdir)/log/log_get.c + $(CC) $(CFLAGS) $? +log_put.o: $(srcdir)/log/log_put.c + $(CC) $(CFLAGS) $? +log_rec.o: $(srcdir)/log/log_rec.c + $(CC) $(CFLAGS) $? +log_register.o: $(srcdir)/log/log_register.c + $(CC) $(CFLAGS) $? + +# Mpool source files. +mp_bh.o: $(srcdir)/mp/mp_bh.c + $(CC) $(CFLAGS) $? +mp_fget.o: $(srcdir)/mp/mp_fget.c + $(CC) $(CFLAGS) $? +mp_fopen.o: $(srcdir)/mp/mp_fopen.c + $(CC) $(CFLAGS) $? +mp_fput.o: $(srcdir)/mp/mp_fput.c + $(CC) $(CFLAGS) $? +mp_fset.o: $(srcdir)/mp/mp_fset.c + $(CC) $(CFLAGS) $? +mp_open.o: $(srcdir)/mp/mp_open.c + $(CC) $(CFLAGS) $? +mp_pr.o: $(srcdir)/mp/mp_pr.c + $(CC) $(CFLAGS) $? +mp_region.o: $(srcdir)/mp/mp_region.c + $(CC) $(CFLAGS) $? +mp_sync.o: $(srcdir)/mp/mp_sync.c + $(CC) $(CFLAGS) $? + +# Mutex source files. +mutex.o: $(srcdir)/mutex/mutex.c + $(CC) $(CFLAGS) $? +# XXX +# UTS4 spinlocks +uts4.cc.o: $(srcdir)/mutex/uts4.cc.s + $(AS) $(ASFLAGS) -o $@ $? + +# Transaction source files. +txn.o: $(srcdir)/txn/txn.c + $(CC) $(CFLAGS) $? +txn_auto.o: $(srcdir)/txn/txn_auto.c + $(CC) $(CFLAGS) $? +txn_rec.o: $(srcdir)/txn/txn_rec.c + $(CC) $(CFLAGS) $? + +# Historic interfaces. +hsearch.o: $(srcdir)/hsearch/hsearch.c + $(CC) $(CFLAGS) $? +dbm.o: $(srcdir)/dbm/dbm.c + $(CC) $(CFLAGS) $? +db185.o: $(srcdir)/db185/db185.c + $(CC) $(CFLAGS) $? + +# Common source files. +db_appinit.o: $(srcdir)/common/db_appinit.c + $(CC) $(CFLAGS) $? +db_apprec.o: $(srcdir)/common/db_apprec.c + $(CC) $(CFLAGS) $? +db_byteorder.o: $(srcdir)/common/db_byteorder.c + $(CC) $(CFLAGS) $? +db_err.o: $(srcdir)/common/db_err.c + $(CC) $(CFLAGS) $? +db_log2.o: $(srcdir)/common/db_log2.c + $(CC) $(CFLAGS) $? +db_region.o: $(srcdir)/common/db_region.c + $(CC) $(CFLAGS) $? +db_salloc.o: $(srcdir)/common/db_salloc.c + $(CC) $(CFLAGS) $? +db_shash.o: $(srcdir)/common/db_shash.c + $(CC) $(CFLAGS) $? + +# OS specific source files. +os_abs.o: $(srcdir)/os/os_abs.c + $(CC) $(CFLAGS) $? +os_alloc.o: $(srcdir)/os/os_alloc.c + $(CC) $(CFLAGS) $? +os_config.o: $(srcdir)/os/os_config.c + $(CC) $(CFLAGS) $? +os_dir.o: $(srcdir)/os/os_dir.c + $(CC) $(CFLAGS) $? +os_fid.o: $(srcdir)/os/os_fid.c + $(CC) $(CFLAGS) $? +os_fsync.o: $(srcdir)/os/os_fsync.c + $(CC) $(CFLAGS) $? +os_map.o: $(srcdir)/os/os_map.c + $(CC) $(CFLAGS) $? +os_oflags.o: $(srcdir)/os/os_oflags.c + $(CC) $(CFLAGS) $? +os_open.o: $(srcdir)/os/os_open.c + $(CC) $(CFLAGS) $? +os_rpath.o: $(srcdir)/os/os_rpath.c + $(CC) $(CFLAGS) $? +os_rw.o: $(srcdir)/os/os_rw.c + $(CC) $(CFLAGS) $? +os_seek.o: $(srcdir)/os/os_seek.c + $(CC) $(CFLAGS) $? +os_sleep.o: $(srcdir)/os/os_sleep.c + $(CC) $(CFLAGS) $? +os_spin.o: $(srcdir)/os/os_spin.c + $(CC) $(CFLAGS) $? +os_stat.o: $(srcdir)/os/os_stat.c + $(CC) $(CFLAGS) $? +os_unlink.o: $(srcdir)/os/os_unlink.c + $(CC) $(CFLAGS) $? + +# Test programs. +.dbtestrc: db.h $(srcdir)/test/test.tcl + $(rm) -f $@ + cat $(srcdir)/test/test.tcl > $@ +tclAppInit.o: $(srcdir)/test/tclAppInit.c + $(CC) $(CFLAGS) $? +tcl_dbm.o: $(srcdir)/test/tcl_dbm.c + $(CC) $(CFLAGS) $? +tcl_hsearch.o: $(srcdir)/test/tcl_hsearch.c + $(CC) $(CFLAGS) $? +tcl_lock.o: $(srcdir)/test/tcl_lock.c + $(CC) $(CFLAGS) $? +tcl_log.o: $(srcdir)/test/tcl_log.c + $(CC) $(CFLAGS) $? +tcl_mpool.o: $(srcdir)/test/tcl_mpool.c + $(CC) $(CFLAGS) $? +tcl_mutex.o: $(srcdir)/test/tcl_mutex.c + $(CC) $(CFLAGS) $? +tcl_ndbm.o: $(srcdir)/test/tcl_ndbm.c + $(CC) $(CFLAGS) $? +tcl_txn.o: $(srcdir)/test/tcl_txn.c + $(CC) $(CFLAGS) $? +utils.o: $(srcdir)/test/utils.c + $(CC) $(CFLAGS) $? + +# Replacement source files. +err.o: $(srcdir)/clib/err.c + $(CC) $(CFLAGS) $? +getcwd.o: $(srcdir)/clib/getcwd.c + $(CC) $(CFLAGS) $? +getlong.o: $(srcdir)/clib/getlong.c + $(CC) $(CFLAGS) $? +getopt.o: $(srcdir)/clib/getopt.c + $(CC) $(CFLAGS) $? +memcmp.o: $(srcdir)/clib/memcmp.c + $(CC) $(CFLAGS) $? +memcpy.o: $(srcdir)/clib/memcpy.c + $(CC) -DMEMCOPY $(CFLAGS) $? +memmove.o: $(srcdir)/clib/memmove.c + $(CC) -DMEMMOVE $(CFLAGS) $? +raise.o: $(srcdir)/clib/raise.c + $(CC) $(CFLAGS) $? +snprintf.o: $(srcdir)/clib/snprintf.c + $(CC) $(CFLAGS) $? +strerror.o: $(srcdir)/clib/strerror.c + $(CC) $(CFLAGS) $? +strsep.o: $(srcdir)/clib/strsep.c + $(CC) $(CFLAGS) $? +vsnprintf.o: $(srcdir)/clib/vsnprintf.c + $(CC) $(CFLAGS) $? diff --git a/mozilla/db/dist/acconfig.h b/mozilla/db/dist/acconfig.h new file mode 100644 index 00000000000..1ed32211681 --- /dev/null +++ b/mozilla/db/dist/acconfig.h @@ -0,0 +1,59 @@ +/* Define to `int' if doesn't define. */ +#undef ssize_t + +/* Define if you want a debugging version. */ +#undef DEBUG + +/* Define if you want a version with run-time diagnostic checking. */ +#undef DIAGNOSTIC + +/* Define if you have sigfillset (and sigprocmask). */ +#undef HAVE_SIGFILLSET + +/* Define if building on AIX, HP, Solaris to get big-file environment. */ +#undef HAVE_FILE_OFFSET_BITS +#ifdef HAVE_FILE_OFFSET_BITS +#define _FILE_OFFSET_BITS 64 +#endif + +/* Define if you have spinlocks. */ +#undef HAVE_SPINLOCKS + +/* Define if you want to use mc68020/gcc assembly spinlocks. */ +#undef HAVE_ASSEM_MC68020_GCC + +/* Define if you want to use parisc/gcc assembly spinlocks. */ +#undef HAVE_ASSEM_PARISC_GCC + +/* Define if you want to use sco/cc assembly spinlocks. */ +#undef HAVE_ASSEM_SCO_CC + +/* Define if you want to use sparc/gcc assembly spinlocks. */ +#undef HAVE_ASSEM_SPARC_GCC + +/* Define if you want to use uts4/cc assembly spinlocks. */ +#undef HAVE_ASSEM_UTS4_CC + +/* Define if you want to use x86/gcc assembly spinlocks. */ +#undef HAVE_ASSEM_X86_GCC + +/* Define if you have the AIX _check_lock spinlocks. */ +#undef HAVE_FUNC_AIX + +/* Define if you have the OSF1 or HPPA msemaphore spinlocks. */ +#undef HAVE_FUNC_MSEM + +/* Define if you have the SGI abilock_t spinlocks. */ +#undef HAVE_FUNC_SGI + +/* Define if you have the ReliantUNIX spinlock_t spinlocks. */ +#undef HAVE_FUNC_RELIANT + +/* Define if you have the Solaris mutex_t spinlocks. */ +#undef HAVE_FUNC_SOLARIS + +/* Define if you have to initialize the entire shared region. */ +#undef REGION_INIT_NEEDED + +/* Define if your sprintf returns a pointer, not a length. */ +#undef SPRINTF_RET_CHARPNT diff --git a/mozilla/db/dist/config.guess b/mozilla/db/dist/config.guess new file mode 100755 index 00000000000..07eb23c2211 --- /dev/null +++ b/mozilla/db/dist/config.guess @@ -0,0 +1,696 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner . +# The master version of this file is at the FSF in /home/gd/gnu/lib. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit system type (host/target name). +# +# Only a few systems have been added to this list; please add others +# (but try to keep the structure clean). +# + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 8/24/94.) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15 + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + alpha:OSF1:*:*) + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'` + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-cbm-sysv4 + exit 0;; + amiga:NetBSD:*:*) + echo m68k-cbm-netbsd${UNAME_RELEASE} + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-cbm-openbsd${UNAME_RELEASE} + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + Pyramid*:OSx*:*:*|MIS*:OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + atari*:NetBSD:*:*) + echo m68k-atari-netbsd${UNAME_RELEASE} + exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-atari-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3*:NetBSD:*:*) + echo m68k-sun-netbsd${UNAME_RELEASE} + exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-sun-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:NetBSD:*:*) + echo m68k-apple-netbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-apple-openbsd${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + sed 's/^ //' << EOF >dummy.c + int main (argc, argv) int argc; char **argv; { + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + ${CC-cc} dummy.c -o dummy \ + && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ + -o ${TARGET_BINARY_INTERFACE}x = x ] ; then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i?86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + sed 's/^ //' << EOF >dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:4) + if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=4.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:uts:4:*) + echo uts-amdahl-sysv4 + exit 0 ;; + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[3478]??:HP-UX:*:*) + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;; + 9000/8?? ) HP_ARCH=hppa1.0 ;; + esac + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + sed 's/^ //' << EOF >dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i?86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F300:UNIX_System_V:*:*) + FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + F301:UNIX_System_V:*:*) + echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` + exit 0 ;; + hp3[0-9][05]:NetBSD:*:*) + echo m68k-hp-netbsd${UNAME_RELEASE} + exit 0 ;; + hp3[0-9][05]:OpenBSD:*:*) + echo m68k-hp-openbsd${UNAME_RELEASE} + exit 0 ;; + i?86:BSD/386:*:* | *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:NetBSD:*:*) + echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + i*:CYGWIN*:*) + echo i386-pc-cygwin32 + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin32 + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + *:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. + ld_help_string=`ld --help 2>&1` + if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i.86"; then + echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86linux"; then + echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86coff"; then + echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then + echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32ppc"; then + echo "powerpc-unknown-linux-gnu" ; exit 0 + elif test "${UNAME_MACHINE}" = "alpha" ; then + echo alpha-unknown-linux-gnu ; exit 0 + elif test "${UNAME_MACHINE}" = "sparc" ; then + echo sparc-unknown-linux-gnu ; exit 0 + else + # Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us + # useful --help. Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout. + test ! -d /usr/lib/ldscripts/. \ + && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 + # Determine whether the default compiler is a.out or elf + cat >dummy.c </dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + fi ;; +# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions +# are messed up and put the nodename in both sysname and nodename. + i?86:DYNIX/ptx:4*:*) + echo i386-sequent-sysv4 + exit 0 ;; + i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + fi + exit 0 ;; + i?86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i?86:LynxOS:2.*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +cat >dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +#if !defined (ultrix) + printf ("vax-dec-bsd\n"); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0 +rm -f dummy.c dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +#echo '(Unable to guess system type)' 1>&2 + +exit 1 diff --git a/mozilla/db/dist/config.h.in b/mozilla/db/dist/config.h.in new file mode 100644 index 00000000000..9e04841a252 --- /dev/null +++ b/mozilla/db/dist/config.h.in @@ -0,0 +1,149 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define to empty if the keyword does not work. */ +#undef const + +/* Define if your struct stat has st_blksize. */ +#undef HAVE_ST_BLKSIZE + +/* Define to `int' if doesn't define. */ +#undef mode_t + +/* Define to `long' if doesn't define. */ +#undef off_t + +/* Define to `int' if doesn't define. */ +#undef pid_t + +/* Define to `unsigned' if doesn't define. */ +#undef size_t + +/* Define if the `S_IS*' macros in do not work properly. */ +#undef STAT_MACROS_BROKEN + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if your processor stores words with the most significant + byte first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + +/* Define to `int' if doesn't define. */ +#undef ssize_t + +/* Define if you want a debugging version. */ +#undef DEBUG + +/* Define if you want a version with run-time diagnostic checking. */ +#undef DIAGNOSTIC + +/* Define if you have sigfillset (and sigprocmask). */ +#undef HAVE_SIGFILLSET + +/* Define if building on AIX, HP, Solaris to get big-file environment. */ +#undef HAVE_FILE_OFFSET_BITS +#ifdef HAVE_FILE_OFFSET_BITS +#define _FILE_OFFSET_BITS 64 +#endif + +/* Define if you have spinlocks. */ +#undef HAVE_SPINLOCKS + +/* Define if you want to use mc68020/gcc assembly spinlocks. */ +#undef HAVE_ASSEM_MC68020_GCC + +/* Define if you want to use parisc/gcc assembly spinlocks. */ +#undef HAVE_ASSEM_PARISC_GCC + +/* Define if you want to use sco/cc assembly spinlocks. */ +#undef HAVE_ASSEM_SCO_CC + +/* Define if you want to use sparc/gcc assembly spinlocks. */ +#undef HAVE_ASSEM_SPARC_GCC + +/* Define if you want to use uts4/cc assembly spinlocks. */ +#undef HAVE_ASSEM_UTS4_CC + +/* Define if you want to use x86/gcc assembly spinlocks. */ +#undef HAVE_ASSEM_X86_GCC + +/* Define if you have the AIX _check_lock spinlocks. */ +#undef HAVE_FUNC_AIX + +/* Define if you have the OSF1 or HPPA msemaphore spinlocks. */ +#undef HAVE_FUNC_MSEM + +/* Define if you have the SGI abilock_t spinlocks. */ +#undef HAVE_FUNC_SGI + +/* Define if you have the ReliantUNIX spinlock_t spinlocks. */ +#undef HAVE_FUNC_RELIANT + +/* Define if you have the Solaris mutex_t spinlocks. */ +#undef HAVE_FUNC_SOLARIS + +/* Define if your sprintf returns a pointer, not a length. */ +#undef SPRINTF_RET_CHARPNT + +/* Define if you have the getcwd function. */ +#undef HAVE_GETCWD + +/* Define if you have the getopt function. */ +#undef HAVE_GETOPT + +/* Define if you have the getuid function. */ +#undef HAVE_GETUID + +/* Define if you have the memcmp function. */ +#undef HAVE_MEMCMP + +/* Define if you have the memcpy function. */ +#undef HAVE_MEMCPY + +/* Define if you have the memmove function. */ +#undef HAVE_MEMMOVE + +/* Define if you have the mmap function. */ +#undef HAVE_MMAP + +/* Define if you have the raise function. */ +#undef HAVE_RAISE + +/* Define if you have the select function. */ +#undef HAVE_SELECT + +/* Define if you have the shmget function. */ +#undef HAVE_SHMGET + +/* Define if you have the snprintf function. */ +#undef HAVE_SNPRINTF + +/* Define if you have the strerror function. */ +#undef HAVE_STRERROR + +/* Define if you have the strsep function. */ +#undef HAVE_STRSEP + +/* Define if you have the sysconf function. */ +#undef HAVE_SYSCONF + +/* Define if you have the vsnprintf function. */ +#undef HAVE_VSNPRINTF + +/* Define if you have the header file. */ +#undef HAVE_DIRENT_H + +/* Define if you have the header file. */ +#undef HAVE_NDIR_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_DIR_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_NDIR_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_TIME_H diff --git a/mozilla/db/dist/config.sub b/mozilla/db/dist/config.sub new file mode 100755 index 00000000000..e5dc717a6d2 --- /dev/null +++ b/mozilla/db/dist/config.sub @@ -0,0 +1,927 @@ +#! /bin/sh +# Configuration validation subroutine script, version 1.1. +# Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +if [ x$1 = x ] +then + echo Configuration name missing. 1>&2 + echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 + echo "or $0 ALIAS" 1>&2 + echo where ALIAS is a recognized configuration type. 1>&2 + exit 1 +fi + +# First pass through any local machine types. +case $1 in + *local*) + echo $1 + exit 0 + ;; + *) + ;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + linux-gnu*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple) + os= + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + tahoe | i860 | m68k | m68000 | m88k | ns32k | arm \ + | arme[lb] | pyramid \ + | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \ + | alpha | we32k | ns16k | clipper | i370 | sh \ + | powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \ + | pdp11 | mips64el | mips64orion | mips64orionel \ + | sparc | sparclet | sparclite | sparc64) + basic_machine=$basic_machine-unknown + ;; + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i[3456]86) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \ + | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \ + | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \ + | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \ + | pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* | uts-* \ + | mips64el-* | mips64orion-* | mips64orionel-* | f301-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-cbm + ;; + amigados) + basic_machine=m68k-cbm + os=-amigados + ;; + amigaunix | amix) + basic_machine=m68k-cbm + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [ctj]90-cray) + basic_machine=c90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + os=-mvs + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i[3456]86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i[3456]86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i[3456]86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i[3456]86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + miniframe) + basic_machine=m68000-convergent + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + np1) + basic_machine=np1-gould + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5) + basic_machine=i586-intel + ;; + pentiumpro | p6) + basic_machine=i686-intel + ;; + pentium-* | p5-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + k5) + # We don't have specific support for AMD's K5 yet, so just call it a Pentium + basic_machine=i586-amd + ;; + nexen) + # We don't have specific support for Nexgen yet, so just call it a Pentium + basic_machine=i586-nexgen + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=rs6000-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + mips) + basic_machine=mips-mips + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sparc) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -unixware* | svr4*) + os=-sysv4 + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -linux-gnu* | -uxpv*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -xenix) + os=-xenix + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-semi) + os=-aout + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-ibm) + os=-aix + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigados + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f301-fujitsu) + os=-uxpv + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -hpux*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os diff --git a/mozilla/db/dist/configure b/mozilla/db/dist/configure new file mode 100755 index 00000000000..145831eaddf --- /dev/null +++ b/mozilla/db/dist/configure @@ -0,0 +1,4408 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --enable-debug Build a debugging version." +ac_help="$ac_help + --enable-diagnostic Build a version with run-time diagnostics." +ac_help="$ac_help + --enable-cxx Provide C++ interfaces." +ac_help="$ac_help + --enable-compat185 Include DB 1.85 compatibility API." +ac_help="$ac_help + --enable-dump185 Build db_dump185(1) to dump 1.85 databases." +ac_help="$ac_help + --disable-bigfile Disable AIX, HP/UX, Solaris big files." +ac_help="$ac_help + --enable-test Build the Tcl-based test suite." + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=../db/db.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:568: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + for ac_prog in ginstall installbsd scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + # OSF/1 installbsd also uses dspmsg, but is usable. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +# Make sure we can run config.sub. +if $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:624: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`$ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`$ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + + + + + + + +case "$host_os" in +aix4.1*) CFLAGS=${CFLAGS-"-O3"};; +bsd4.4) CFLAGS=${CFLAGS-"-O2"};; +bsdi4*) CFLAGS=${CFLAGS-"-O2"};; +bsdi*) CC=${CC-"shlicc2"} + CFLAGS=${CFLAGS-"-O2"} + LIBS="-lipc $LIBS";; +irix*) CFLAGS=${CFLAGS-"-O2"};; +nextstep3) CFLAGS=${CFLAGS-"-O2"};; +linux*) CFLAGS=${CFLAGS-"-O2"};; +mpeix*) CPPFLAGS="-D_POSIX_SOURCE -D_SOCKET_SOURCE $CPPFLAGS" + LIBS="-lsocket -lsvipc $LIBS";; +sco*) CFLAGS="$CFLAGS -b elf" + LIBS="-lsocket -lnsl $LIBS";; +*) CFLAGS=${CFLAGS-"-O"};; +esac +CXXFLAGS=${CXXFLAGS-"$CFLAGS"} + +echo $ac_n "checking if --enable-debug option specified""... $ac_c" 1>&6 +echo "configure:688: checking if --enable-debug option specified" >&5 +# Check whether --enable-debug or --disable-debug was given. +if test "${enable_debug+set}" = set; then + enableval="$enable_debug" + db_cv_debug="$enable_debug" +else + db_cv_debug="no" +fi + +echo "$ac_t""$db_cv_debug" 1>&6 +if test "$db_cv_debug" = yes; then + cat >> confdefs.h <<\EOF +#define DEBUG 1 +EOF + + CFLAGS="$CFLAGS -g" + CXXFLAGS="$CXXFLAGS -g" +fi + + +CC=${CC-"cc"} +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:712: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:741: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:789: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:823: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:828: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:852: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + + +echo $ac_n "checking if --enable-diagnostic option specified""... $ac_c" 1>&6 +echo "configure:881: checking if --enable-diagnostic option specified" >&5 +# Check whether --enable-diagnostic or --disable-diagnostic was given. +if test "${enable_diagnostic+set}" = set; then + enableval="$enable_diagnostic" + db_cv_diagnostic="$enable_diagnostic" +else + db_cv_diagnostic="no" +fi + +echo "$ac_t""$db_cv_diagnostic" 1>&6 +if test "$db_cv_diagnostic" = yes; then + cat >> confdefs.h <<\EOF +#define DIAGNOSTIC 1 +EOF + +fi + +echo $ac_n "checking if --enable-cxx option specified""... $ac_c" 1>&6 +echo "configure:899: checking if --enable-cxx option specified" >&5 +# Check whether --enable-cxx or --disable-cxx was given. +if test "${enable_cxx+set}" = set; then + enableval="$enable_cxx" + db_cv_cxx="$enable_cxx" +else + db_cv_cxx="no" +fi + +echo "$ac_t""$db_cv_cxx" 1>&6 +if test "$db_cv_cxx" = "yes"; then + for ac_prog in $CCC c++ g++ gcc CC cxx cc++ +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:915: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CXX="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CXX="$ac_cv_prog_CXX" +if test -n "$CXX"; then + echo "$ac_t""$CXX" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$CXX" && break +done +test -n "$CXX" || CXX="gcc" + + +echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:946: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 + +ac_ext=C +# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cxx_cross + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + ac_cv_prog_cxx_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cxx_cross=no + else + ac_cv_prog_cxx_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cxx_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6 +if test $ac_cv_prog_cxx_works = no; then + { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:986: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 +cross_compiling=$ac_cv_prog_cxx_cross + +echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 +echo "configure:991: checking whether we are using GNU C++" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.C <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gxx=yes +else + ac_cv_prog_gxx=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gxx" 1>&6 + +if test $ac_cv_prog_gxx = yes; then + GXX=yes + ac_test_CXXFLAGS="${CXXFLAGS+set}" + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS= + echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 +echo "configure:1015: checking whether ${CXX-g++} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.cc +if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then + ac_cv_prog_cxx_g=yes +else + ac_cv_prog_cxx_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6 + if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS="$ac_save_CXXFLAGS" + elif test $ac_cv_prog_cxx_g = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-O2" + fi +else + GXX= + test "${CXXFLAGS+set}" = set || CXXFLAGS="-g" +fi + + + if test "$GXX" = "yes"; then + CXXFLAGS="-fhandle-exceptions $CXXFLAGS" + fi + + LIBOBJS="$LIBOBJS \$(COBJS)" +fi + + + +echo $ac_n "checking if --enable-compat185 option specified""... $ac_c" 1>&6 +echo "configure:1053: checking if --enable-compat185 option specified" >&5 +# Check whether --enable-compat185 or --disable-compat185 was given. +if test "${enable_compat185+set}" = set; then + enableval="$enable_compat185" + db_cv_compat185="$enable_compat185" +else + db_cv_compat185="no" +fi + +echo "$ac_t""$db_cv_compat185" 1>&6 +if test "$db_cv_compat185" = "yes"; then + LIBOBJS="db185.o $LIBOBJS" +fi + + +echo $ac_n "checking if --enable-dump185 option specified""... $ac_c" 1>&6 +echo "configure:1069: checking if --enable-dump185 option specified" >&5 +# Check whether --enable-dump185 or --disable-dump185 was given. +if test "${enable_dump185+set}" = set; then + enableval="$enable_dump185" + db_cv_dump185="$enable_dump185" +else + db_cv_dump185="no" +fi + +echo "$ac_t""$db_cv_dump185" 1>&6 +if test "$db_cv_dump185" = "yes"; then + build_additional="db_dump185 $build_additional" +fi + +# Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1086: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_db_cv_path_ar'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$db_cv_path_ar" in + /*) + ac_cv_path_db_cv_path_ar="$db_cv_path_ar" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_db_cv_path_ar="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_db_cv_path_ar" && ac_cv_path_db_cv_path_ar="missing_ar" + ;; +esac +fi +db_cv_path_ar="$ac_cv_path_db_cv_path_ar" +if test -n "$db_cv_path_ar"; then + echo "$ac_t""$db_cv_path_ar" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test "$db_cv_path_ar" = missing_ar; then + { echo "configure: error: No ar utility found." 1>&2; exit 1; } +fi +# Extract the first word of "chmod", so it can be a program name with args. +set dummy chmod; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1121: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_db_cv_path_chmod'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$db_cv_path_chmod" in + /*) + ac_cv_path_db_cv_path_chmod="$db_cv_path_chmod" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_db_cv_path_chmod="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_db_cv_path_chmod" && ac_cv_path_db_cv_path_chmod="missing_chmod" + ;; +esac +fi +db_cv_path_chmod="$ac_cv_path_db_cv_path_chmod" +if test -n "$db_cv_path_chmod"; then + echo "$ac_t""$db_cv_path_chmod" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test "$db_cv_path_chmod" = missing_chmod; then + { echo "configure: error: No chmod utility found." 1>&2; exit 1; } +fi +# Extract the first word of "cp", so it can be a program name with args. +set dummy cp; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1156: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_db_cv_path_cp'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$db_cv_path_cp" in + /*) + ac_cv_path_db_cv_path_cp="$db_cv_path_cp" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_db_cv_path_cp="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_db_cv_path_cp" && ac_cv_path_db_cv_path_cp="missing_cp" + ;; +esac +fi +db_cv_path_cp="$ac_cv_path_db_cv_path_cp" +if test -n "$db_cv_path_cp"; then + echo "$ac_t""$db_cv_path_cp" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test "$db_cv_path_cp" = missing_cp; then + { echo "configure: error: No cp utility found." 1>&2; exit 1; } +fi +# Extract the first word of "mkdir", so it can be a program name with args. +set dummy mkdir; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1191: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_db_cv_path_mkdir'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$db_cv_path_mkdir" in + /*) + ac_cv_path_db_cv_path_mkdir="$db_cv_path_mkdir" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_db_cv_path_mkdir="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_db_cv_path_mkdir" && ac_cv_path_db_cv_path_mkdir="missing_mkdir" + ;; +esac +fi +db_cv_path_mkdir="$ac_cv_path_db_cv_path_mkdir" +if test -n "$db_cv_path_mkdir"; then + echo "$ac_t""$db_cv_path_mkdir" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test "$db_cv_path_mkdir" = missing_mkdir; then + { echo "configure: error: No mkdir utility found." 1>&2; exit 1; } +fi +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1226: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_db_cv_path_ranlib'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$db_cv_path_ranlib" in + /*) + ac_cv_path_db_cv_path_ranlib="$db_cv_path_ranlib" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_db_cv_path_ranlib="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_db_cv_path_ranlib" && ac_cv_path_db_cv_path_ranlib="missing_ranlib" + ;; +esac +fi +db_cv_path_ranlib="$ac_cv_path_db_cv_path_ranlib" +if test -n "$db_cv_path_ranlib"; then + echo "$ac_t""$db_cv_path_ranlib" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "rm", so it can be a program name with args. +set dummy rm; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1258: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_db_cv_path_rm'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$db_cv_path_rm" in + /*) + ac_cv_path_db_cv_path_rm="$db_cv_path_rm" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_db_cv_path_rm="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_db_cv_path_rm" && ac_cv_path_db_cv_path_rm="missing_rm" + ;; +esac +fi +db_cv_path_rm="$ac_cv_path_db_cv_path_rm" +if test -n "$db_cv_path_rm"; then + echo "$ac_t""$db_cv_path_rm" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test "$db_cv_path_rm" = missing_rm; then + { echo "configure: error: No rm utility found." 1>&2; exit 1; } +fi +# Extract the first word of "sh", so it can be a program name with args. +set dummy sh; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1293: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_db_cv_path_sh'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$db_cv_path_sh" in + /*) + ac_cv_path_db_cv_path_sh="$db_cv_path_sh" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_db_cv_path_sh="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_db_cv_path_sh" && ac_cv_path_db_cv_path_sh="missing_sh" + ;; +esac +fi +db_cv_path_sh="$ac_cv_path_db_cv_path_sh" +if test -n "$db_cv_path_sh"; then + echo "$ac_t""$db_cv_path_sh" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test "$db_cv_path_sh" = missing_sh; then + { echo "configure: error: No sh utility found." 1>&2; exit 1; } +fi +# Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1328: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_db_cv_path_strip'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$db_cv_path_strip" in + /*) + ac_cv_path_db_cv_path_strip="$db_cv_path_strip" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_db_cv_path_strip="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_db_cv_path_strip" && ac_cv_path_db_cv_path_strip="missing_strip" + ;; +esac +fi +db_cv_path_strip="$ac_cv_path_db_cv_path_strip" +if test -n "$db_cv_path_strip"; then + echo "$ac_t""$db_cv_path_strip" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test "$db_cv_path_strip" = missing_strip; then + { echo "configure: error: No strip utility found." 1>&2; exit 1; } +fi + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1362: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1383: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1400: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:1423: checking for ANSI C header files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#include +#include +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1436: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + : +else + cat > conftest.$ac_ext < +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:1503: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 +echo "configure:1527: checking for ssize_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "ssize_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_ssize_t=yes +else + rm -rf conftest* + ac_cv_type_ssize_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_ssize_t" 1>&6 +if test $ac_cv_type_ssize_t = no; then + cat >> confdefs.h <<\EOF +#define ssize_t int +EOF + +fi + +echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 +echo "configure:1560: checking whether byte ordering is bigendian" >&5 +if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_c_bigendian=unknown +# See if sys/param.h defines the BYTE_ORDER macro. +cat > conftest.$ac_ext < +#include +int main() { + +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif +; return 0; } +EOF +if { (eval echo configure:1578: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + # It does; now see whether it defined to BIG_ENDIAN or not. +cat > conftest.$ac_ext < +#include +int main() { + +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif +; return 0; } +EOF +if { (eval echo configure:1593: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_bigendian=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_bigendian=no +fi +rm -f conftest* +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +if test $ac_cv_c_bigendian = unknown; then +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_c_bigendian=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_bigendian=yes +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_c_bigendian" 1>&6 +if test $ac_cv_c_bigendian = yes; then + cat >> confdefs.h <<\EOF +#define WORDS_BIGENDIAN 1 +EOF + +fi + +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:1650: checking for working const" >&5 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } +EOF +if { (eval echo configure:1704: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_const=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + +fi + +echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 +echo "configure:1725: checking for st_blksize in struct stat" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +int main() { +struct stat s; s.st_blksize; +; return 0; } +EOF +if { (eval echo configure:1738: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_st_blksize=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_st_blksize=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_st_blksize" 1>&6 +if test $ac_cv_struct_st_blksize = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ST_BLKSIZE 1 +EOF + +fi + +echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6 +echo "configure:1759: checking whether stat file-mode macros are broken" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include + +#if defined(S_ISBLK) && defined(S_IFDIR) +# if S_ISBLK (S_IFDIR) +You lose. +# endif +#endif + +#if defined(S_ISBLK) && defined(S_IFCHR) +# if S_ISBLK (S_IFCHR) +You lose. +# endif +#endif + +#if defined(S_ISLNK) && defined(S_IFREG) +# if S_ISLNK (S_IFREG) +You lose. +# endif +#endif + +#if defined(S_ISSOCK) && defined(S_IFREG) +# if S_ISSOCK (S_IFREG) +You lose. +# endif +#endif + +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "You lose" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_header_stat_broken=yes +else + rm -rf conftest* + ac_cv_header_stat_broken=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_header_stat_broken" 1>&6 +if test $ac_cv_header_stat_broken = yes; then + cat >> confdefs.h <<\EOF +#define STAT_MACROS_BROKEN 1 +EOF + +fi + +echo $ac_n "checking for mode_t""... $ac_c" 1>&6 +echo "configure:1815: checking for mode_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "mode_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_mode_t=yes +else + rm -rf conftest* + ac_cv_type_mode_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_mode_t" 1>&6 +if test $ac_cv_type_mode_t = no; then + cat >> confdefs.h <<\EOF +#define mode_t int +EOF + +fi + +echo $ac_n "checking for off_t""... $ac_c" 1>&6 +echo "configure:1848: checking for off_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_off_t=yes +else + rm -rf conftest* + ac_cv_type_off_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_off_t" 1>&6 +if test $ac_cv_type_off_t = no; then + cat >> confdefs.h <<\EOF +#define off_t long +EOF + +fi + +echo $ac_n "checking for pid_t""... $ac_c" 1>&6 +echo "configure:1881: checking for pid_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_pid_t=yes +else + rm -rf conftest* + ac_cv_type_pid_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_pid_t" 1>&6 +if test $ac_cv_type_pid_t = no; then + cat >> confdefs.h <<\EOF +#define pid_t int +EOF + +fi + +echo $ac_n "checking for size_t""... $ac_c" 1>&6 +echo "configure:1914: checking for size_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_size_t=yes +else + rm -rf conftest* + ac_cv_type_size_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_size_t" 1>&6 +if test $ac_cv_type_size_t = no; then + cat >> confdefs.h <<\EOF +#define size_t unsigned +EOF + +fi + + +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 +echo "configure:1952: checking for $ac_hdr that defines DIR" >&5 +if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include <$ac_hdr> +int main() { +DIR *dirp = 0; +; return 0; } +EOF +if { (eval echo configure:1965: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then +echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 +echo "configure:1990: checking for opendir in -ldir" >&5 +ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldir $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -ldir" +else + echo "$ac_t""no" 1>&6 +fi + +else +echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 +echo "configure:2031: checking for opendir in -lx" >&5 +ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lx $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -lx" +else + echo "$ac_t""no" 1>&6 +fi + +fi + +for ac_hdr in sys/select.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2076: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2086: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + +for ac_hdr in sys/time.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2116: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2126: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + +for ac_func in getcwd getopt memcmp memcpy memmove +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2156: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +LIBOBJS="$LIBOBJS ${ac_func}.o" +fi +done + + +for ac_func in raise snprintf strerror strsep vsnprintf +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2213: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2241: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +LIBOBJS="$LIBOBJS ${ac_func}.o" +fi +done + + + +case "$host_os" in +aux*) LIBOBJS="getopt.o $LIBOBJS";; +esac + +case "$host_os" in +hpux*) + ac_cv_func_shmget="no" + echo "configure: warning: shmget(2) interface ignored on the HP/UX architecture." 1>&2;; +sunos*) + ac_cv_func_shmget="no" + echo "configure: warning: shmget(2) interface ignored on the SunOS architecture." 1>&2;; +*) + echo $ac_n "checking for ftok""... $ac_c" 1>&6 +echo "configure:2281: checking for ftok" >&5 +if eval "test \"`echo '$''{'ac_cv_func_ftok'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char ftok(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_ftok) || defined (__stub___ftok) +choke me +#else +ftok(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2309: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_ftok=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_ftok=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'ftok`\" = yes"; then + echo "$ac_t""yes" 1>&6 + for ac_func in shmget +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2326: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + +else + echo "$ac_t""no" 1>&6 +fi +;; +esac + +echo $ac_n "checking for munmap""... $ac_c" 1>&6 +echo "configure:2385: checking for munmap" >&5 +if eval "test \"`echo '$''{'ac_cv_func_munmap'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char munmap(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_munmap) || defined (__stub___munmap) +choke me +#else +munmap(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2413: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_munmap=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_munmap=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'munmap`\" = yes"; then + echo "$ac_t""yes" 1>&6 + for ac_func in mmap +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2430: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + +else + echo "$ac_t""no" 1>&6 +fi + + +for ac_func in getuid select sysconf +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2490: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2518: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + +if test "$ac_cv_func_mmap" = no -a "$ac_cv_func_shmget" = no; then + { echo "configure: error: Neither mmap/munmap(2) or shmget(2) library functions." 1>&2; exit 1; } +fi +if test "$ac_cv_func_select" = no; then + { echo "configure: error: No select(2) library function." 1>&2; exit 1; } +fi + +echo $ac_n "checking for sigfillset""... $ac_c" 1>&6 +echo "configure:2551: checking for sigfillset" >&5 +if eval "test \"`echo '$''{'db_cv_have_sigfillset'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +sigset_t set; sigfillset(&set); +; return 0; } +EOF +if { (eval echo configure:2563: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + db_cv_have_sigfillset=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + db_cv_have_sigfillset=no +fi +rm -f conftest* +fi + +echo "$ac_t""$db_cv_have_sigfillset" 1>&6 +if test "$db_cv_have_sigfillset" = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_SIGFILLSET 1 +EOF + +fi + +echo $ac_n "checking for int type sprintf return value""... $ac_c" 1>&6 +echo "configure:2584: checking for int type sprintf return value" >&5 +if eval "test \"`echo '$''{'db_cv_sprintf_count'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + db_cv_sprintf_count=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + db_cv_sprintf_count=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$db_cv_sprintf_count" 1>&6 +if test "$db_cv_sprintf_count" = no; then + cat >> confdefs.h <<\EOF +#define SPRINTF_RET_CHARPNT 1 +EOF + +fi + +echo $ac_n "checking if --disable-bigfile option specified""... $ac_c" 1>&6 +echo "configure:2619: checking if --disable-bigfile option specified" >&5 +# Check whether --enable-bigfile or --disable-bigfile was given. +if test "${enable_bigfile+set}" = set; then + enableval="$enable_bigfile" + db_cv_bigfile="$enable_bigfile" +else + db_cv_bigfile="yes" +fi + +if test "$db_cv_bigfile" = yes; then + case "$host_os" in + bsdi*|aix*|hpux*|solaris*) cat >> confdefs.h <<\EOF +#define HAVE_FILE_OFFSET_BITS 1 +EOF +;; + esac + echo "$ac_t"""no"" 1>&6 +else + echo "$ac_t"""yes"" 1>&6 +fi + +echo $ac_n "checking for spinlocks""... $ac_c" 1>&6 +echo "configure:2641: checking for spinlocks" >&5 +if eval "test \"`echo '$''{'db_cv_spinlocks'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + db_cv_spinlocks=no + +if test "$db_cv_spinlocks" = no; then +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext < +typedef msemaphore tsl_t; +msemaphore x; msem_init(&x, 0); msem_lock(&x, 0); msem_unlock(&x, 0); +exit(0); +#else +exit(1); +#endif +} +EOF +if { (eval echo configure:2665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + db_cv_spinlocks=msem-hppa/func +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -fr conftest* +fi + +fi + +if test "$db_cv_spinlocks" = no; then +cat > conftest.$ac_ext < +int main() { +#include ; + typedef msemaphore tsl_t; +msemaphore x; msem_init(&x, 0); msem_lock(&x, 0); msem_unlock(&x, 0); +; return 0; } +EOF +if { (eval echo configure:2688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + db_cv_spinlocks=msem/func +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +fi + +if test "$db_cv_spinlocks" = no; then +saved_libs="$LIBS" +LIBS="$LIBS -lmproc" +cat > conftest.$ac_ext < +int main() { +typedef spinlock_t tsl_t; + spinlock_t x; initspin(&x, 1); cspinlock(&x); spinunlock(&x); +; return 0; } +EOF +if { (eval echo configure:2710: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + db_cv_spinlocks=reliant/func +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + LIBS="$saved_libs" +fi +rm -f conftest* +fi + +if test "$db_cv_spinlocks" = no; then +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + db_cv_spinlocks=sco/cc +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -fr conftest* +fi + +fi + +if test "$db_cv_spinlocks" = no; then +cat > conftest.$ac_ext < +int main() { +typedef abilock_t tsl_t; + abilock_t x; init_lock(&x); acquire_lock(&x); release_lock(&x); +; return 0; } +EOF +if { (eval echo configure:2757: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + db_cv_spinlocks=sgi/func +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +fi + +if test "$db_cv_spinlocks" = NOTYET; then +cat > conftest.$ac_ext < +int main() { +typedef sema_t tsl_t; + sema_t x; + sema_init(&x, 1, USYNC_PROCESS, NULL); sema_wait(&x); sema_post(&x); +; return 0; } +EOF +if { (eval echo configure:2778: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + db_cv_spinlocks=solaris/func +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +fi + +if test "$db_cv_spinlocks" = no; then +cat > conftest.$ac_ext < +int main() { +typedef lock_t tsl_t; + lock_t x; + _lock_try(&x); _lock_clear(&x); +; return 0; } +EOF +if { (eval echo configure:2799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + db_cv_spinlocks=solaris/func +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +fi + +if test "$db_cv_spinlocks" = no; then +cat > conftest.$ac_ext < +int main() { +int x; _check_lock(x,0,1); _clear_lock(x,0); +; return 0; } +EOF +if { (eval echo configure:2818: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + db_cv_spinlocks=aix/func +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +fi + +if test "$db_cv_spinlocks" = no; then +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + db_cv_spinlocks=parisc/gcc +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -fr conftest* +fi + +fi + +if test "$db_cv_spinlocks" = no; then +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + db_cv_spinlocks=sparc/gcc +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -fr conftest* +fi + +fi + +if test "$db_cv_spinlocks" = no; then +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + db_cv_spinlocks=mc68020/gcc +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -fr conftest* +fi + +fi + +if test "$db_cv_spinlocks" = no; then +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + db_cv_spinlocks=x86/gcc +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -fr conftest* +fi + +fi + +if test "$db_cv_spinlocks" = no; then +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + db_cv_spinlocks=uts4/cc +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -fr conftest* +fi + +fi + + +fi + +echo "$ac_t""$db_cv_spinlocks" 1>&6 + +if test "$db_cv_spinlocks" = no; then + echo "configure: warning: SPINLOCKS NOT IMPLEMENTED FOR THIS COMPILER/ARCHITECTURE." 1>&2 +else + cat >> confdefs.h <<\EOF +#define HAVE_SPINLOCKS 1 +EOF + +fi + +case "$host_os" in +irix*) CPPFLAGS="-D_SGI_MP_SOURCE $CPPFLAGS";; +osf*) CPPFLAGS="-D_REENTRANT $CPPFLAGS";; +solaris*) CPPFLAGS="-D_REENTRANT $CPPFLAGS" + LIBS="-lthread $LIBS";; +esac + + + + + +case "$db_cv_spinlocks" in +aix/func) + cat >> confdefs.h <<\EOF +#define HAVE_FUNC_AIX 1 +EOF + + mutex_align="sizeof(int)" + spin_line1="#include " + spin_line2="typedef int tsl_t;";; +mc68020/gcc) + cat >> confdefs.h <<\EOF +#define HAVE_ASSEM_MC68020_GCC 1 +EOF + + mutex_align="1" + spin_line1="typedef unsigned char tsl_t;";; +msem-hppa/func) + cat >> confdefs.h <<\EOF +#define HAVE_FUNC_MSEM 1 +EOF + + mutex_align="16" + spin_line1="#include " + spin_line2="typedef msemaphore tsl_t;";; +msem/func) + cat >> confdefs.h <<\EOF +#define HAVE_FUNC_MSEM 1 +EOF + + mutex_align="sizeof(int)" + spin_line1="#include " + spin_line2="typedef msemaphore tsl_t;";; +parisc/gcc) + cat >> confdefs.h <<\EOF +#define HAVE_ASSEM_PARISC_GCC 1 +EOF + + mutex_align="16" + spin_line1="typedef u_int32_t tsl_t;";; +reliant/func) + cat >> confdefs.h <<\EOF +#define HAVE_FUNC_RELIANT 1 +EOF + + mutex_align="1" + spin_line1="#include " + spin_line2="typedef spinlock_t tsl_t;";; +sgi/func) + cat >> confdefs.h <<\EOF +#define HAVE_FUNC_SGI 1 +EOF + + mutex_align="sizeof(int)" + spin_line1="#include " + spin_line2="typedef abilock_t tsl_t;";; +NOTYET_solaris/func) + cat >> confdefs.h <<\EOF +#define HAVE_FUNC_SOLARIS 1 +EOF + + mutex_align="sizeof(int)" + spin_line1="#include " + spin_line2="typedef sema_t tsl_t;";; +sco/cc) + cat >> confdefs.h <<\EOF +#define HAVE_ASSEM_SCO_CC 1 +EOF + + mutex_align="1" + spin_line1="typedef unsigned char tsl_t;";; +solaris/func) + cat >> confdefs.h <<\EOF +#define HAVE_FUNC_SOLARIS 1 +EOF + + mutex_align="sizeof(int)" + spin_line1="#include " + spin_line2="typedef lock_t tsl_t;";; +sparc/gcc) + cat >> confdefs.h <<\EOF +#define HAVE_ASSEM_SPARC_GCC 1 +EOF + + mutex_align="1" + spin_line1="typedef unsigned char tsl_t;";; +uts4/cc) + cat >> confdefs.h <<\EOF +#define HAVE_ASSEM_UTS4_CC 1 +EOF + + mutex_align="sizeof(int)" + spin_line1="typedef int tsl_t;" + LIBOBJS="$LIBOBJS uts4.cc.o";; +x86/gcc) + cat >> confdefs.h <<\EOF +#define HAVE_ASSEM_X86_GCC 1 +EOF + + mutex_align="1" + spin_line1="typedef unsigned char tsl_t;";; +*) + mutex_align="1";; +esac + + +echo $ac_n "checking for u_char""... $ac_c" 1>&6 +echo "configure:3092: checking for u_char" >&5 +if eval "test \"`echo '$''{'db_cv_uchar'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +u_char foo; +; return 0; } +EOF +if { (eval echo configure:3104: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + db_cv_uchar=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + db_cv_uchar=no +fi +rm -f conftest* +fi + +echo "$ac_t""$db_cv_uchar" 1>&6 +if test "$db_cv_uchar" = no; then + u_char_decl="typedef unsigned char u_char;" +fi + + +echo $ac_n "checking for u_short""... $ac_c" 1>&6 +echo "configure:3123: checking for u_short" >&5 +if eval "test \"`echo '$''{'db_cv_ushort'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +u_short foo; +; return 0; } +EOF +if { (eval echo configure:3135: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + db_cv_ushort=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + db_cv_ushort=no +fi +rm -f conftest* +fi + +echo "$ac_t""$db_cv_ushort" 1>&6 +if test "$db_cv_ushort" = no; then + u_short_decl="typedef unsigned short u_short;" +fi + + +echo $ac_n "checking for u_int""... $ac_c" 1>&6 +echo "configure:3154: checking for u_int" >&5 +if eval "test \"`echo '$''{'db_cv_uint'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +u_int foo; +; return 0; } +EOF +if { (eval echo configure:3166: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + db_cv_uint=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + db_cv_uint=no +fi +rm -f conftest* +fi + +echo "$ac_t""$db_cv_uint" 1>&6 +if test "$db_cv_uint" = no; then + u_int_decl="typedef unsigned int u_int;" +fi + + +echo $ac_n "checking for u_long""... $ac_c" 1>&6 +echo "configure:3185: checking for u_long" >&5 +if eval "test \"`echo '$''{'db_cv_ulong'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +u_long foo; +; return 0; } +EOF +if { (eval echo configure:3197: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + db_cv_ulong=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + db_cv_ulong=no +fi +rm -f conftest* +fi + +echo "$ac_t""$db_cv_ulong" 1>&6 +if test "$db_cv_ulong" = no; then + u_long_decl="typedef unsigned long u_long;" +fi + + +echo $ac_n "checking for u_int8_t""... $ac_c" 1>&6 +echo "configure:3216: checking for u_int8_t" >&5 +if eval "test \"`echo '$''{'db_cv_uint8'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +u_int8_t foo; +; return 0; } +EOF +if { (eval echo configure:3228: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + db_cv_uint8=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + db_cv_uint8="unsigned char" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + db_cv_uint8=no +fi +rm -fr conftest* +fi + +fi +rm -f conftest* +fi + +echo "$ac_t""$db_cv_uint8" 1>&6 +if test "$db_cv_uint8" = no; then + { echo "configure: error: No unsigned 8-bit integral type." 1>&2; exit 1; } +fi +if test "$db_cv_uint8" != yes; then + u_int8_decl="typedef $db_cv_uint8 u_int8_t;" +fi + + +echo $ac_n "checking for u_int16_t""... $ac_c" 1>&6 +echo "configure:3269: checking for u_int16_t" >&5 +if eval "test \"`echo '$''{'db_cv_uint16'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +u_int16_t foo; +; return 0; } +EOF +if { (eval echo configure:3281: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + db_cv_uint16=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + db_cv_uint16="unsigned short" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + db_cv_uint16="unsigned int" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + db_cv_uint16=no +fi +rm -fr conftest* +fi + +fi +rm -fr conftest* +fi + +fi +rm -f conftest* +fi + +echo "$ac_t""$db_cv_uint16" 1>&6 +if test "$db_cv_uint16" = no; then + { echo "configure: error: No unsigned 16-bit integral type." 1>&2; exit 1; } +fi +if test "$db_cv_uint16" != yes; then + u_int16_decl="typedef $db_cv_uint16 u_int16_t;" +fi + + +echo $ac_n "checking for int16_t""... $ac_c" 1>&6 +echo "configure:3341: checking for int16_t" >&5 +if eval "test \"`echo '$''{'db_cv_int16'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +int16_t foo; +; return 0; } +EOF +if { (eval echo configure:3353: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + db_cv_int16=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + db_cv_int16="short" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + db_cv_int16="int" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + db_cv_int16=no +fi +rm -fr conftest* +fi + +fi +rm -fr conftest* +fi + +fi +rm -f conftest* +fi + +echo "$ac_t""$db_cv_int16" 1>&6 +if test "$db_cv_int16" = no; then + { echo "configure: error: No signed 16-bit integral type." 1>&2; exit 1; } +fi +if test "$db_cv_int16" != yes; then + int16_decl="typedef $db_cv_int16 int16_t;" +fi + + +echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6 +echo "configure:3413: checking for u_int32_t" >&5 +if eval "test \"`echo '$''{'db_cv_uint32'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +u_int32_t foo; +; return 0; } +EOF +if { (eval echo configure:3425: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + db_cv_uint32=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + db_cv_uint32="unsigned int" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + db_cv_uint32="unsigned long" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + db_cv_uint32=no +fi +rm -fr conftest* +fi + +fi +rm -fr conftest* +fi + +fi +rm -f conftest* +fi + +echo "$ac_t""$db_cv_uint32" 1>&6 +if test "$db_cv_uint32" = no; then + { echo "configure: error: No unsigned 32-bit integral type." 1>&2; exit 1; } +fi +if test "$db_cv_uint32" != yes; then + u_int32_decl="typedef $db_cv_uint32 u_int32_t;" +fi + + +echo $ac_n "checking for int32_t""... $ac_c" 1>&6 +echo "configure:3485: checking for int32_t" >&5 +if eval "test \"`echo '$''{'db_cv_int32'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +int32_t foo; +; return 0; } +EOF +if { (eval echo configure:3497: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + db_cv_int32=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + db_cv_int32="int" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + db_cv_int32="long" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + db_cv_int32=no +fi +rm -fr conftest* +fi + +fi +rm -fr conftest* +fi + +fi +rm -f conftest* +fi + +echo "$ac_t""$db_cv_int32" 1>&6 +if test "$db_cv_int32" = no; then + { echo "configure: error: No signed 32-bit integral type." 1>&2; exit 1; } +fi +if test "$db_cv_int32" != yes; then + int32_decl="typedef $db_cv_int32 int32_t;" +fi + +echo $ac_n "checking if --enable-test option specified""... $ac_c" 1>&6 +echo "configure:3556: checking if --enable-test option specified" >&5 +# Check whether --enable-test or --disable-test was given. +if test "${enable_test+set}" = set; then + enableval="$enable_test" + db_cv_test="$enable_test" +else + db_cv_test="no" +fi + +echo "$ac_t""$db_cv_test" 1>&6 + +if test "$db_cv_test" = yes; then + echo $ac_n "checking for Tcl_Eval in -ltcl""... $ac_c" 1>&6 +echo "configure:3569: checking for Tcl_Eval in -ltcl" >&5 +ac_lib_var=`echo tcl'_'Tcl_Eval | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ltcl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + db_cv_tcl="-ltcl" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for Tcl_VarEval in -ltcl""... $ac_c" 1>&6 +echo "configure:3607: checking for Tcl_VarEval in -ltcl" >&5 +ac_lib_var=`echo tcl'_'Tcl_VarEval | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ltcl -ldl -lm $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + db_cv_tcl="-ltcl -ldl -lm" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for Tcl_EvalFile in -ltcl""... $ac_c" 1>&6 +echo "configure:3645: checking for Tcl_EvalFile in -ltcl" >&5 +ac_lib_var=`echo tcl'_'Tcl_EvalFile | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ltcl -lm $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + db_cv_tcl="-ltcl -lm" +else + echo "$ac_t""no" 1>&6 +db_cv_tcl=no +fi + +fi + +fi + + + if test "$db_cv_tcl" = "no"; then + { echo "configure: error: No Tcl library: unable to build test program." 1>&2; exit 1; } + else + build_additional="dbtest $build_additional" + LIBS="$LIBS $db_cv_tcl" + fi + + # Extract the first word of "cmp", so it can be a program name with args. +set dummy cmp; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3700: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_db_cv_path_cmp'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$db_cv_path_cmp" in + /*) + ac_cv_path_db_cv_path_cmp="$db_cv_path_cmp" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_db_cv_path_cmp="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_db_cv_path_cmp" && ac_cv_path_db_cv_path_cmp="missing_cmp" + ;; +esac +fi +db_cv_path_cmp="$ac_cv_path_db_cv_path_cmp" +if test -n "$db_cv_path_cmp"; then + echo "$ac_t""$db_cv_path_cmp" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test "$db_cv_path_cmp" = missing_cmp; then + { echo "configure: error: No cmp utility found." 1>&2; exit 1; } + fi + # Extract the first word of "diff", so it can be a program name with args. +set dummy diff; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3735: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_db_cv_path_diff'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$db_cv_path_diff" in + /*) + ac_cv_path_db_cv_path_diff="$db_cv_path_diff" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_db_cv_path_diff="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_db_cv_path_diff" && ac_cv_path_db_cv_path_diff="missing_diff" + ;; +esac +fi +db_cv_path_diff="$ac_cv_path_db_cv_path_diff" +if test -n "$db_cv_path_diff"; then + echo "$ac_t""$db_cv_path_diff" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test "$db_cv_path_diff" = missing_diff; then + { echo "configure: error: No diff utility found." 1>&2; exit 1; } + fi + # Extract the first word of "kill", so it can be a program name with args. +set dummy kill; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3770: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_db_cv_path_kill'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$db_cv_path_kill" in + /*) + ac_cv_path_db_cv_path_kill="$db_cv_path_kill" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_db_cv_path_kill="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_db_cv_path_kill" && ac_cv_path_db_cv_path_kill="missing_kill" + ;; +esac +fi +db_cv_path_kill="$ac_cv_path_db_cv_path_kill" +if test -n "$db_cv_path_kill"; then + echo "$ac_t""$db_cv_path_kill" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test "$db_cv_path_kill" = missing_kill; then + { echo "configure: error: No kill utility found." 1>&2; exit 1; } + fi + # Extract the first word of "ls", so it can be a program name with args. +set dummy ls; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3805: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_db_cv_path_ls'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$db_cv_path_ls" in + /*) + ac_cv_path_db_cv_path_ls="$db_cv_path_ls" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_db_cv_path_ls="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_db_cv_path_ls" && ac_cv_path_db_cv_path_ls="missing_ls" + ;; +esac +fi +db_cv_path_ls="$ac_cv_path_db_cv_path_ls" +if test -n "$db_cv_path_ls"; then + echo "$ac_t""$db_cv_path_ls" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test "$db_cv_path_ls" = missing_ls; then + { echo "configure: error: No ls utility found." 1>&2; exit 1; } + fi + # Extract the first word of "mv", so it can be a program name with args. +set dummy mv; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3840: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_db_cv_path_mv'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$db_cv_path_mv" in + /*) + ac_cv_path_db_cv_path_mv="$db_cv_path_mv" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_db_cv_path_mv="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_db_cv_path_mv" && ac_cv_path_db_cv_path_mv="missing_mv" + ;; +esac +fi +db_cv_path_mv="$ac_cv_path_db_cv_path_mv" +if test -n "$db_cv_path_mv"; then + echo "$ac_t""$db_cv_path_mv" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test "$db_cv_path_mv" = missing_mv; then + { echo "configure: error: No mv utility found." 1>&2; exit 1; } + fi + # Extract the first word of "sed", so it can be a program name with args. +set dummy sed; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3875: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_db_cv_path_sed'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$db_cv_path_sed" in + /*) + ac_cv_path_db_cv_path_sed="$db_cv_path_sed" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_db_cv_path_sed="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_db_cv_path_sed" && ac_cv_path_db_cv_path_sed="missing_sed" + ;; +esac +fi +db_cv_path_sed="$ac_cv_path_db_cv_path_sed" +if test -n "$db_cv_path_sed"; then + echo "$ac_t""$db_cv_path_sed" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test "$db_cv_path_sed" = missing_sed; then + { echo "configure: error: No sed utility found." 1>&2; exit 1; } + fi + # Extract the first word of "sleep", so it can be a program name with args. +set dummy sleep; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3910: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_db_cv_path_sleep'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$db_cv_path_sleep" in + /*) + ac_cv_path_db_cv_path_sleep="$db_cv_path_sleep" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_db_cv_path_sleep="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_db_cv_path_sleep" && ac_cv_path_db_cv_path_sleep="missing_sleep" + ;; +esac +fi +db_cv_path_sleep="$ac_cv_path_db_cv_path_sleep" +if test -n "$db_cv_path_sleep"; then + echo "$ac_t""$db_cv_path_sleep" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test "$db_cv_path_sleep" = missing_sleep; then + { echo "configure: error: No sleep utility found." 1>&2; exit 1; } + fi + # Extract the first word of "sort", so it can be a program name with args. +set dummy sort; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3945: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_db_cv_path_sort'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$db_cv_path_sort" in + /*) + ac_cv_path_db_cv_path_sort="$db_cv_path_sort" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_db_cv_path_sort="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_db_cv_path_sort" && ac_cv_path_db_cv_path_sort="missing_sort" + ;; +esac +fi +db_cv_path_sort="$ac_cv_path_db_cv_path_sort" +if test -n "$db_cv_path_sort"; then + echo "$ac_t""$db_cv_path_sort" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test "$db_cv_path_sort" = missing_sort; then + { echo "configure: error: No sort utility found." 1>&2; exit 1; } + fi + # Extract the first word of "tr", so it can be a program name with args. +set dummy tr; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3980: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_db_cv_path_tr'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$db_cv_path_tr" in + /*) + ac_cv_path_db_cv_path_tr="$db_cv_path_tr" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_db_cv_path_tr="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_db_cv_path_tr" && ac_cv_path_db_cv_path_tr="missing_tr" + ;; +esac +fi +db_cv_path_tr="$ac_cv_path_db_cv_path_tr" +if test -n "$db_cv_path_tr"; then + echo "$ac_t""$db_cv_path_tr" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test "$db_cv_path_tr" = missing_tr; then + { echo "configure: error: No tr utility found." 1>&2; exit 1; } + fi +fi + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile include.tcl:../test/include.tcl.src \ + db.h:../include/db.h.src db_int.h:../include/db_int.h.src \ + db_185.h:../include/db_185.h.src config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@CXX@%$CXX%g +s%@CC@%$CC%g +s%@build_additional@%$build_additional%g +s%@db_cv_path_ar@%$db_cv_path_ar%g +s%@db_cv_path_chmod@%$db_cv_path_chmod%g +s%@db_cv_path_cp@%$db_cv_path_cp%g +s%@db_cv_path_mkdir@%$db_cv_path_mkdir%g +s%@db_cv_path_ranlib@%$db_cv_path_ranlib%g +s%@db_cv_path_rm@%$db_cv_path_rm%g +s%@db_cv_path_sh@%$db_cv_path_sh%g +s%@db_cv_path_strip@%$db_cv_path_strip%g +s%@CPP@%$CPP%g +s%@LIBOBJS@%$LIBOBJS%g +s%@spin_line1@%$spin_line1%g +s%@spin_line2@%$spin_line2%g +s%@spin_line3@%$spin_line3%g +s%@mutex_align@%$mutex_align%g +s%@u_char_decl@%$u_char_decl%g +s%@u_short_decl@%$u_short_decl%g +s%@u_int_decl@%$u_int_decl%g +s%@u_long_decl@%$u_long_decl%g +s%@u_int8_decl@%$u_int8_decl%g +s%@u_int16_decl@%$u_int16_decl%g +s%@int16_decl@%$int16_decl%g +s%@u_int32_decl@%$u_int32_decl%g +s%@int32_decl@%$int32_decl%g +s%@db_cv_path_cmp@%$db_cv_path_cmp%g +s%@db_cv_path_diff@%$db_cv_path_diff%g +s%@db_cv_path_kill@%$db_cv_path_kill%g +s%@db_cv_path_ls@%$db_cv_path_ls%g +s%@db_cv_path_mv@%$db_cv_path_mv%g +s%@db_cv_path_sed@%$db_cv_path_sed%g +s%@db_cv_path_sleep@%$db_cv_path_sleep%g +s%@db_cv_path_sort@%$db_cv_path_sort%g +s%@db_cv_path_tr@%$db_cv_path_tr%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/mozilla/db/dist/configure.in b/mozilla/db/dist/configure.in new file mode 100644 index 00000000000..2690ae44d77 --- /dev/null +++ b/mozilla/db/dist/configure.in @@ -0,0 +1,647 @@ +dnl @(#)configure.in 10.63 (Sleepycat) 5/26/98 +dnl Process this file with autoconf to produce a configure script. + +AC_INIT(../db/db.c) +AC_CONFIG_HEADER(config.h) + +dnl Configure setup. +AC_PROG_INSTALL() +AC_CANONICAL_HOST +AC_ARG_PROGRAM() + +dnl This is where we handle stuff that autoconf can't handle: compiler, +dnl preprocessor and load flags, libraries that the standard tests don't +dnl look for. The default optimization is -O. +dnl +dnl XXX +dnl Don't override anything if it's already set from the environment. +AC_SUBST(CFLAGS) +AC_SUBST(CPPFLAGS) +AC_SUBST(CXX) +AC_SUBST(CXXFLAGS) +AC_SUBST(LDFLAGS) +case "$host_os" in +aix4.1*) CFLAGS=${CFLAGS-"-O3"};; +bsd4.4) CFLAGS=${CFLAGS-"-O2"};; +bsdi4*) CFLAGS=${CFLAGS-"-O2"};; +bsdi*) CC=${CC-"shlicc2"} + CFLAGS=${CFLAGS-"-O2"} + LIBS="-lipc $LIBS";; +irix*) CFLAGS=${CFLAGS-"-O2"};; +nextstep3) CFLAGS=${CFLAGS-"-O2"};; +linux*) CFLAGS=${CFLAGS-"-O2"};; +mpeix*) CPPFLAGS="-D_POSIX_SOURCE -D_SOCKET_SOURCE $CPPFLAGS" + LIBS="-lsocket -lsvipc $LIBS";; +sco*) CFLAGS="$CFLAGS -b elf" + LIBS="-lsocket -lnsl $LIBS";; +*) CFLAGS=${CFLAGS-"-O"};; +esac +CXXFLAGS=${CXXFLAGS-"$CFLAGS"} + +dnl If the user wants a debugging environment, add -g to the CFLAGS value. +dnl +dnl XXX +dnl Some compilers can't mix optimizing and debug flags. The only way to +dnl handle this is to specify CFLAGS in the environment before configuring. +AC_MSG_CHECKING(if --enable-debug option specified) +AC_ARG_ENABLE(debug, + [ --enable-debug Build a debugging version.], + [db_cv_debug="$enable_debug"], [db_cv_debug="no"]) +AC_MSG_RESULT($db_cv_debug) +if test "$db_cv_debug" = yes; then + AC_DEFINE(DEBUG) + CFLAGS="$CFLAGS -g" + CXXFLAGS="$CXXFLAGS -g" +fi + +dnl The default compiler is cc (NOT gcc), the default CFLAGS is as specified +dnl above, NOT what is set by AC_PROG_CC, as it won't set optimization flags. +AC_SUBST(CC) +CC=${CC-"cc"} +AC_PROG_CC + +dnl If the user wants run-time checks, define DIAGNOSTIC. +AC_MSG_CHECKING(if --enable-diagnostic option specified) +AC_ARG_ENABLE(diagnostic, + [ --enable-diagnostic Build a version with run-time diagnostics.], + [db_cv_diagnostic="$enable_diagnostic"], [db_cv_diagnostic="no"]) +AC_MSG_RESULT($db_cv_diagnostic) +if test "$db_cv_diagnostic" = yes; then + AC_DEFINE(DIAGNOSTIC) +fi + +dnl Optional C++ API.. +dnl +dnl XXX +dnl Versions of GCC up to 2.8.0 required -fhandle-exceptions, but it is +dnl the default in versions 2.8.0 and after. +AC_MSG_CHECKING(if --enable-cxx option specified) +AC_ARG_ENABLE(cxx, + [ --enable-cxx Provide C++ interfaces.], + [db_cv_cxx="$enable_cxx"], [db_cv_cxx="no"]) +AC_MSG_RESULT($db_cv_cxx) +if test "$db_cv_cxx" = "yes"; then + AC_PROG_CXX + + if test "$GXX" = "yes"; then + CXXFLAGS="-fhandle-exceptions $CXXFLAGS" + fi + + LIBOBJS="$LIBOBJS \$(COBJS)" +fi + +dnl There are additional libraries we need for some compiler/architecture +dnl combinations. +AC_SUBST(LIBS) + +dnl Optional DB 1.85 compatibility API. +AC_MSG_CHECKING(if --enable-compat185 option specified) +AC_ARG_ENABLE(compat185, + [ --enable-compat185 Include DB 1.85 compatibility API.], + [db_cv_compat185="$enable_compat185"], [db_cv_compat185="no"]) +AC_MSG_RESULT($db_cv_compat185) +if test "$db_cv_compat185" = "yes"; then + LIBOBJS="db185.o $LIBOBJS" +fi + +dnl Optional utilities. +AC_SUBST(build_additional) +AC_MSG_CHECKING(if --enable-dump185 option specified) +AC_ARG_ENABLE(dump185, + [ --enable-dump185 Build db_dump185(1) to dump 1.85 databases.], + [db_cv_dump185="$enable_dump185"], [db_cv_dump185="no"]) +AC_MSG_RESULT($db_cv_dump185) +if test "$db_cv_dump185" = "yes"; then + build_additional="db_dump185 $build_additional" +fi + +dnl Check for programs used in building and installation. +AC_PATH_PROG(db_cv_path_ar, ar, missing_ar) +if test "$db_cv_path_ar" = missing_ar; then + AC_MSG_ERROR([No ar utility found.]) +fi +AC_PATH_PROG(db_cv_path_chmod, chmod, missing_chmod) +if test "$db_cv_path_chmod" = missing_chmod; then + AC_MSG_ERROR([No chmod utility found.]) +fi +AC_PATH_PROG(db_cv_path_cp, cp, missing_cp) +if test "$db_cv_path_cp" = missing_cp; then + AC_MSG_ERROR([No cp utility found.]) +fi +AC_PATH_PROG(db_cv_path_mkdir, mkdir, missing_mkdir) +if test "$db_cv_path_mkdir" = missing_mkdir; then + AC_MSG_ERROR([No mkdir utility found.]) +fi +AC_PATH_PROG(db_cv_path_ranlib, ranlib, missing_ranlib) +AC_PATH_PROG(db_cv_path_rm, rm, missing_rm) +if test "$db_cv_path_rm" = missing_rm; then + AC_MSG_ERROR([No rm utility found.]) +fi +AC_PATH_PROG(db_cv_path_sh, sh, missing_sh) +if test "$db_cv_path_sh" = missing_sh; then + AC_MSG_ERROR([No sh utility found.]) +fi +AC_PATH_PROG(db_cv_path_strip, strip, missing_strip) +if test "$db_cv_path_strip" = missing_strip; then + AC_MSG_ERROR([No strip utility found.]) +fi + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_CHECK_TYPE(ssize_t, int) +AC_C_BIGENDIAN +AC_C_CONST +AC_STRUCT_ST_BLKSIZE +AC_HEADER_STAT +AC_TYPE_MODE_T +AC_TYPE_OFF_T +AC_TYPE_PID_T +AC_TYPE_SIZE_T + +dnl Checks for header files. +AC_HEADER_DIRENT +AC_CHECK_HEADERS(sys/select.h) +AC_CHECK_HEADERS(sys/time.h) + +dnl Checks for library functions for which we have replacements. +dnl +dnl XXX +dnl The only portable getcwd call is getcwd(char *, size_t), where the +dnl buffer is non-NULL -- Solaris can't handle a NULL buffer, and they +dnl deleted getwd(). +AC_REPLACE_FUNCS(getcwd getopt memcmp memcpy memmove) +AC_REPLACE_FUNCS(raise snprintf strerror strsep vsnprintf) + +dnl A/UX has a broken getopt(3). +case "$host_os" in +aux*) LIBOBJS="getopt.o $LIBOBJS";; +esac + +dnl Checks for library functions for which we don't have replacements. +dnl +dnl XXX +dnl FreeBSD has the shmget(2) interfaces, but as ftok(3) is not in the C +dnl library, so we ignore them. +dnl +dnl HP/UX has the shmget(2) interfaces, but you can't use them to hold +dnl mutexes, so they're useless. +dnl +dnl SunOS has the shmget(2) interfaces, but there appears to be a missing +dnl #include file!? +case "$host_os" in +hpux*) + ac_cv_func_shmget="no" + AC_MSG_WARN([shmget(2) interface ignored on the HP/UX architecture.]);; +sunos*) + ac_cv_func_shmget="no" + AC_MSG_WARN([shmget(2) interface ignored on the SunOS architecture.]);; +*) + AC_CHECK_FUNC(ftok, AC_CHECK_FUNCS(shmget));; +esac + +dnl Nextstep (version 3.3) apparently supports mmap(2) (the mmap symbol is +dnl defined in the C library) but does not support munmap(2). +AC_CHECK_FUNC(munmap, AC_CHECK_FUNCS(mmap)) + +AC_CHECK_FUNCS(getuid select sysconf) + +dnl We require mmap/munmap(2) or shmget(2), and select(2). +if test "$ac_cv_func_mmap" = no -a "$ac_cv_func_shmget" = no; then + AC_MSG_ERROR([Neither mmap/munmap(2) or shmget(2) library functions.]) +fi +if test "$ac_cv_func_select" = no; then + AC_MSG_ERROR([No select(2) library function.]) +fi + +dnl Check for the sigfillset macro/function. If it exists, we assume we can +dnl use it and sigprocmask to we block signals when creating temporary files. +AC_CACHE_CHECK([for sigfillset], db_cv_have_sigfillset, [dnl +AC_TRY_LINK([#include ], [sigset_t set; sigfillset(&set);], + [db_cv_have_sigfillset=yes], [db_cv_have_sigfillset=no])]) +if test "$db_cv_have_sigfillset" = yes; then + AC_DEFINE(HAVE_SIGFILLSET) +fi + +dnl Some versions of sprintf return a pointer to the first argument instead +dnl of a character count. We assume that the return value of snprintf and +dnl vsprintf etc. will be the same as sprintf, and check the easy one. +AC_CACHE_CHECK([for int type sprintf return value], db_cv_sprintf_count, [dnl +AC_TRY_RUN([main(){char buf[20]; exit(sprintf(buf, "XXX") != 3);}], + [db_cv_sprintf_count=yes], [db_cv_sprintf_count=no])]) +if test "$db_cv_sprintf_count" = no; then + AC_DEFINE(SPRINTF_RET_CHARPNT) +fi + +dnl Vendors are doing 64-bit lseek in different ways. +dnl AIX, HP/UX and Solaris all use _FILE_OFFSET_BITS to specify a "big-file" +dnl environment. +AC_MSG_CHECKING(if --disable-bigfile option specified) +AC_ARG_ENABLE(bigfile, + [ --disable-bigfile Disable AIX, HP/UX, Solaris big files.], + [db_cv_bigfile="$enable_bigfile"], [db_cv_bigfile="yes"]) +if test "$db_cv_bigfile" = yes; then + case "$host_os" in + bsdi*|aix*|hpux*|solaris*) AC_DEFINE(HAVE_FILE_OFFSET_BITS);; + esac + AC_MSG_RESULT("no") +else + AC_MSG_RESULT("yes") +fi + +dnl Figure out if we have spinlocks for the compiler/architecture. +AC_CACHE_CHECK([for spinlocks], db_cv_spinlocks, [dnl +db_cv_spinlocks=no + +dnl msemaphore: HPPA +dnl Try HPPA before general msem test, it needs special mutex alignment. +if test "$db_cv_spinlocks" = no; then +AC_TRY_RUN([main(){ +#if defined(__hppa) +#include +typedef msemaphore tsl_t; +msemaphore x; msem_init(&x, 0); msem_lock(&x, 0); msem_unlock(&x, 0); +exit(0); +#else +exit(1); +#endif +}], [db_cv_spinlocks=msem-hppa/func]) +fi + +dnl msemaphore: OSF/1 +if test "$db_cv_spinlocks" = no; then +AC_TRY_LINK([#include ], +[#include ; + typedef msemaphore tsl_t; +msemaphore x; msem_init(&x, 0); msem_lock(&x, 0); msem_unlock(&x, 0);], +[db_cv_spinlocks=msem/func]) +fi + +dnl ReliantUNIX +if test "$db_cv_spinlocks" = no; then +saved_libs="$LIBS" +LIBS="$LIBS -lmproc" +AC_TRY_LINK([#include ], +[typedef spinlock_t tsl_t; + spinlock_t x; initspin(&x, 1); cspinlock(&x); spinunlock(&x);], +[db_cv_spinlocks=reliant/func],[LIBS="$saved_libs"]) +fi + +dnl SCO: UnixWare has threads in libthread, but OpenServer doesn't. +if test "$db_cv_spinlocks" = no; then +AC_TRY_RUN([main(){ +#if defined(__USLC__) +exit(0); +#endif +exit(1);}], [db_cv_spinlocks=sco/cc]) +fi + +dnl abilock_t: SGI +if test "$db_cv_spinlocks" = no; then +AC_TRY_LINK([#include ], +[typedef abilock_t tsl_t; + abilock_t x; init_lock(&x); acquire_lock(&x); release_lock(&x);], +[db_cv_spinlocks=sgi/func]) +fi + +dnl sema_t: Solaris +dnl The semaphore calls do not work on Solaris 5.5. +if test "$db_cv_spinlocks" = NOTYET; then +AC_TRY_LINK([#include ], +[typedef sema_t tsl_t; + sema_t x; + sema_init(&x, 1, USYNC_PROCESS, NULL); sema_wait(&x); sema_post(&x);], +[db_cv_spinlocks=solaris/func]) +fi + +dnl _lock_try/_lock_clear: Solaris +if test "$db_cv_spinlocks" = no; then +AC_TRY_LINK([#include ], +[typedef lock_t tsl_t; + lock_t x; + _lock_try(&x); _lock_clear(&x);], +[db_cv_spinlocks=solaris/func]) +fi + +dnl _check_lock/_clear_lock: AIX +if test "$db_cv_spinlocks" = no; then +AC_TRY_LINK([#include ], +[int x; _check_lock(x,0,1); _clear_lock(x,0);], +[db_cv_spinlocks=aix/func]) +fi + +dnl PaRisc/gcc: HP/UX +if test "$db_cv_spinlocks" = no; then +AC_TRY_RUN([main(){ +#if defined(__hppa) +#if defined(__GNUC__) +exit(0); +#endif +#endif +exit(1);}], [db_cv_spinlocks=parisc/gcc]) +fi + +dnl Sparc/gcc: Solaris +if test "$db_cv_spinlocks" = no; then +AC_TRY_RUN([main(){ +#if defined(__sparc__) +#if defined(__GNUC__) +exit(0); +#endif +#endif +exit(1);}], [db_cv_spinlocks=sparc/gcc]) +fi + +dnl 68K/gcc: SunOS +if test "$db_cv_spinlocks" = no; then +AC_TRY_RUN([main(){ +#if (defined(mc68020) || defined(sun3)) +#if defined(__GNUC__) +exit(0); +#endif +#endif +exit(1);}], [db_cv_spinlocks=mc68020/gcc]) +fi + +dnl x86/gcc: BSD/OS, FreeBSD, NetBSD, Linux +if test "$db_cv_spinlocks" = no; then +AC_TRY_RUN([main(){ +#if defined(i386) +#if defined(__GNUC__) +exit(0); +#endif +#endif +exit(1);}], [db_cv_spinlocks=x86/gcc]) +fi + +dnl: uts/cc: UTS +if test "$db_cv_spinlocks" = no; then +AC_TRY_RUN([main(){ +#if defined(_UTS) +exit(0); +#endif +exit(1);}], [db_cv_spinlocks=uts4/cc]) +fi + +]) + +if test "$db_cv_spinlocks" = no; then + AC_MSG_WARN([SPINLOCKS NOT IMPLEMENTED FOR THIS COMPILER/ARCHITECTURE.]) +else + AC_DEFINE(HAVE_SPINLOCKS) +fi + +dnl Some architectures require special flags and/or libraries for threaded +dnl applications. +case "$host_os" in +irix*) CPPFLAGS="-D_SGI_MP_SOURCE $CPPFLAGS";; +osf*) CPPFLAGS="-D_REENTRANT $CPPFLAGS";; +solaris*) CPPFLAGS="-D_REENTRANT $CPPFLAGS" + LIBS="-lthread $LIBS";; +esac + +AC_SUBST(spin_line1) +AC_SUBST(spin_line2) +AC_SUBST(spin_line3) +AC_SUBST(mutex_align) +case "$db_cv_spinlocks" in +aix/func) + AC_DEFINE(HAVE_FUNC_AIX) + mutex_align="sizeof(int)" + spin_line1="#include " + spin_line2="typedef int tsl_t;";; +mc68020/gcc) + AC_DEFINE(HAVE_ASSEM_MC68020_GCC) + mutex_align="1" + spin_line1="typedef unsigned char tsl_t;";; +msem-hppa/func) + AC_DEFINE(HAVE_FUNC_MSEM) + mutex_align="16" + spin_line1="#include " + spin_line2="typedef msemaphore tsl_t;";; +msem/func) + AC_DEFINE(HAVE_FUNC_MSEM) + mutex_align="sizeof(int)" + spin_line1="#include " + spin_line2="typedef msemaphore tsl_t;";; +parisc/gcc) + AC_DEFINE(HAVE_ASSEM_PARISC_GCC) + mutex_align="16" + spin_line1="typedef u_int32_t tsl_t;";; +reliant/func) + AC_DEFINE(HAVE_FUNC_RELIANT) + mutex_align="1" + spin_line1="#include " + spin_line2="typedef spinlock_t tsl_t;";; +sgi/func) + AC_DEFINE(HAVE_FUNC_SGI) + mutex_align="sizeof(int)" + spin_line1="#include " + spin_line2="typedef abilock_t tsl_t;";; +NOTYET_solaris/func) + AC_DEFINE(HAVE_FUNC_SOLARIS) + mutex_align="sizeof(int)" + spin_line1="#include " + spin_line2="typedef sema_t tsl_t;";; +sco/cc) + AC_DEFINE(HAVE_ASSEM_SCO_CC) + mutex_align="1" + spin_line1="typedef unsigned char tsl_t;";; +solaris/func) + AC_DEFINE(HAVE_FUNC_SOLARIS) + mutex_align="sizeof(int)" + spin_line1="#include " + spin_line2="typedef lock_t tsl_t;";; +sparc/gcc) + AC_DEFINE(HAVE_ASSEM_SPARC_GCC) + mutex_align="1" + spin_line1="typedef unsigned char tsl_t;";; +uts4/cc) + AC_DEFINE(HAVE_ASSEM_UTS4_CC) + mutex_align="sizeof(int)" + spin_line1="typedef int tsl_t;" + LIBOBJS="$LIBOBJS uts4.cc.o";; +x86/gcc) + AC_DEFINE(HAVE_ASSEM_X86_GCC) + mutex_align="1" + spin_line1="typedef unsigned char tsl_t;";; +*) + mutex_align="1";; +esac + +dnl Check for the standard shorthand types. +AC_SUBST(u_char_decl) +AC_CACHE_CHECK([for u_char], db_cv_uchar, [dnl +AC_TRY_COMPILE([#include ], u_char foo;, + [db_cv_uchar=yes], [db_cv_uchar=no])]) +if test "$db_cv_uchar" = no; then + u_char_decl="typedef unsigned char u_char;" +fi + +AC_SUBST(u_short_decl) +AC_CACHE_CHECK([for u_short], db_cv_ushort, [dnl +AC_TRY_COMPILE([#include ], u_short foo;, + [db_cv_ushort=yes], [db_cv_ushort=no])]) +if test "$db_cv_ushort" = no; then + u_short_decl="typedef unsigned short u_short;" +fi + +AC_SUBST(u_int_decl) +AC_CACHE_CHECK([for u_int], db_cv_uint, [dnl +AC_TRY_COMPILE([#include ], u_int foo;, + [db_cv_uint=yes], [db_cv_uint=no])]) +if test "$db_cv_uint" = no; then + u_int_decl="typedef unsigned int u_int;" +fi + +AC_SUBST(u_long_decl) +AC_CACHE_CHECK([for u_long], db_cv_ulong, [dnl +AC_TRY_COMPILE([#include ], u_long foo;, + [db_cv_ulong=yes], [db_cv_ulong=no])]) +if test "$db_cv_ulong" = no; then + u_long_decl="typedef unsigned long u_long;" +fi + +dnl DB/Vi use specific integer sizes. +AC_SUBST(u_int8_decl) +AC_CACHE_CHECK([for u_int8_t], db_cv_uint8, [dnl +AC_TRY_COMPILE([#include ], u_int8_t foo;, + [db_cv_uint8=yes], + AC_TRY_RUN([main(){exit(sizeof(unsigned char) != 1);}], + [db_cv_uint8="unsigned char"], [db_cv_uint8=no]))]) +if test "$db_cv_uint8" = no; then + AC_MSG_ERROR(No unsigned 8-bit integral type.) +fi +if test "$db_cv_uint8" != yes; then + u_int8_decl="typedef $db_cv_uint8 u_int8_t;" +fi + +AC_SUBST(u_int16_decl) +AC_CACHE_CHECK([for u_int16_t], db_cv_uint16, [dnl +AC_TRY_COMPILE([#include ], u_int16_t foo;, + [db_cv_uint16=yes], +AC_TRY_RUN([main(){exit(sizeof(unsigned short) != 2);}], + [db_cv_uint16="unsigned short"], +AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 2);}], + [db_cv_uint16="unsigned int"], [db_cv_uint16=no])))]) +if test "$db_cv_uint16" = no; then + AC_MSG_ERROR([No unsigned 16-bit integral type.]) +fi +if test "$db_cv_uint16" != yes; then + u_int16_decl="typedef $db_cv_uint16 u_int16_t;" +fi + +AC_SUBST(int16_decl) +AC_CACHE_CHECK([for int16_t], db_cv_int16, [dnl +AC_TRY_COMPILE([#include ], int16_t foo;, + [db_cv_int16=yes], +AC_TRY_RUN([main(){exit(sizeof(short) != 2);}], + [db_cv_int16="short"], +AC_TRY_RUN([main(){exit(sizeof(int) != 2);}], + [db_cv_int16="int"], [db_cv_int16=no])))]) +if test "$db_cv_int16" = no; then + AC_MSG_ERROR([No signed 16-bit integral type.]) +fi +if test "$db_cv_int16" != yes; then + int16_decl="typedef $db_cv_int16 int16_t;" +fi + +AC_SUBST(u_int32_decl) +AC_CACHE_CHECK([for u_int32_t], db_cv_uint32, [dnl +AC_TRY_COMPILE([#include ], u_int32_t foo;, + [db_cv_uint32=yes], +AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 4);}], + [db_cv_uint32="unsigned int"], +AC_TRY_RUN([main(){exit(sizeof(unsigned long) != 4);}], + [db_cv_uint32="unsigned long"], [db_cv_uint32=no])))]) +if test "$db_cv_uint32" = no; then + AC_MSG_ERROR([No unsigned 32-bit integral type.]) +fi +if test "$db_cv_uint32" != yes; then + u_int32_decl="typedef $db_cv_uint32 u_int32_t;" +fi + +AC_SUBST(int32_decl) +AC_CACHE_CHECK([for int32_t], db_cv_int32, [dnl +AC_TRY_COMPILE([#include ], int32_t foo;, + [db_cv_int32=yes], +AC_TRY_RUN([main(){exit(sizeof(int) != 4);}], + [db_cv_int32="int"], +AC_TRY_RUN([main(){exit(sizeof(long) != 4);}], + [db_cv_int32="long"], [db_cv_int32=no])))]) +if test "$db_cv_int32" = no; then + AC_MSG_ERROR([No signed 32-bit integral type.]) +fi +if test "$db_cv_int32" != yes; then + int32_decl="typedef $db_cv_int32 int32_t;" +fi + +AC_MSG_CHECKING(if --enable-test option specified) +AC_ARG_ENABLE(test, + [ --enable-test Build the Tcl-based test suite.], + [db_cv_test="$enable_test"], [db_cv_test="no"]) +AC_MSG_RESULT($db_cv_test) + +if test "$db_cv_test" = yes; then + dnl Try to find the Tk/Tcl library. + dnl + dnl XXX + dnl Some systems require -ldl (Linux, BSD/OS 3.X), and we have to + dnl figure that out. There are two problems here: (1) assume that + dnl loading Tcl_Eval, Tcl_VarEval and Tcl_EvalFile will force a + dnl load error if -ldl or -lm are needed and not there. (2) use + dnl different function names on each test, otherwise we find the + dnl result of the first test in the cache and don't do subsequent + dnl checks. + AC_CHECK_LIB(tcl, Tcl_Eval, [db_cv_tcl="-ltcl"], + [AC_CHECK_LIB(tcl, Tcl_VarEval, [db_cv_tcl="-ltcl -ldl -lm"], + [AC_CHECK_LIB(tcl, Tcl_EvalFile, [db_cv_tcl="-ltcl -lm"], + [db_cv_tcl=no], -lm)], -ldl -lm)]) + + if test "$db_cv_tcl" = "no"; then + AC_MSG_ERROR([No Tcl library: unable to build test program.]) + else + build_additional="dbtest $build_additional" + LIBS="$LIBS $db_cv_tcl" + fi + + dnl Check for programs used in testing. + AC_PATH_PROG(db_cv_path_cmp, cmp, missing_cmp) + if test "$db_cv_path_cmp" = missing_cmp; then + AC_MSG_ERROR([No cmp utility found.]) + fi + AC_PATH_PROG(db_cv_path_diff, diff, missing_diff) + if test "$db_cv_path_diff" = missing_diff; then + AC_MSG_ERROR([No diff utility found.]) + fi + AC_PATH_PROG(db_cv_path_kill, kill, missing_kill) + if test "$db_cv_path_kill" = missing_kill; then + AC_MSG_ERROR([No kill utility found.]) + fi + AC_PATH_PROG(db_cv_path_ls, ls, missing_ls) + if test "$db_cv_path_ls" = missing_ls; then + AC_MSG_ERROR([No ls utility found.]) + fi + AC_PATH_PROG(db_cv_path_mv, mv, missing_mv) + if test "$db_cv_path_mv" = missing_mv; then + AC_MSG_ERROR([No mv utility found.]) + fi + AC_PATH_PROG(db_cv_path_sed, sed, missing_sed) + if test "$db_cv_path_sed" = missing_sed; then + AC_MSG_ERROR([No sed utility found.]) + fi + AC_PATH_PROG(db_cv_path_sleep, sleep, missing_sleep) + if test "$db_cv_path_sleep" = missing_sleep; then + AC_MSG_ERROR([No sleep utility found.]) + fi + AC_PATH_PROG(db_cv_path_sort, sort, missing_sort) + if test "$db_cv_path_sort" = missing_sort; then + AC_MSG_ERROR([No sort utility found.]) + fi + AC_PATH_PROG(db_cv_path_tr, tr, missing_tr) + if test "$db_cv_path_tr" = missing_tr; then + AC_MSG_ERROR([No tr utility found.]) + fi +fi + +AC_OUTPUT(Makefile include.tcl:../test/include.tcl.src \ + db.h:../include/db.h.src db_int.h:../include/db_int.h.src \ + db_185.h:../include/db_185.h.src) diff --git a/mozilla/db/dist/db_gen.sh b/mozilla/db/dist/db_gen.sh new file mode 100644 index 00000000000..5cd116f5988 --- /dev/null +++ b/mozilla/db/dist/db_gen.sh @@ -0,0 +1,456 @@ +#!/bin/sh - +# +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)db_gen.sh 10.17 (Sleepycat) 5/2/98 +# + +# This script generates all the log, print, and read routines for the db +# package logging. It also generates the template for the recovery +# functions (these must be hand-written, but are highly stylized so that +# the initial template gets you a fair way along the path). For a given +# file prefix.src, we generate a file prefix_auto.c. This file contains +# PUBLIC declarations that will help us generate the appropriate extern +# declarations. It also creates a file prefix_auto.h that contains: +# defines for the physical record types (logical types are +# defined in eacy subsystem manually) +# structures to contain the data unmarshalled from the log. +PROG=db_gen.sh +if [ $# -ne 2 ]; then + echo "Usage: db_gen.sh .src dir" + exit 1 +fi + +ifile=$1 +dir=$2 +dname=`basename $ifile .src` +hfile=../include/$dname"_auto.h" +cfile=$dir/$dname"_auto.c" +rfile=template/"rec_"$dname + +# Create the files as automagically generated files +echo "Building $hfile, $cfile, $rfile" +msg="/* Do not edit: automatically built by dist/db_gen.sh. */" +echo "$msg" > $hfile; chmod 444 $hfile +echo "$msg" > $cfile; chmod 444 $cfile +echo "$msg" > $rfile; chmod 444 $rfile + +# Start processing the input file +awk ' +/^[ ]*PREFIX/ { + prefix = $2 + + # Write Cfile headers + + printf("#include \"config.h\"\n\n") >> CFILE + printf("#ifndef NO_SYSTEM_INCLUDES\n") >> CFILE + printf("#include \n") >> CFILE + printf("#include \n") >> CFILE + printf("#include \n") >> CFILE + printf("#include \n") >> CFILE + printf("#include \n") >> CFILE + printf("#endif\n\n") >> CFILE + printf("#include \"db_int.h\"\n") >> CFILE + printf("#include \"shqueue.h\"\n") >> CFILE + printf("#include \"db_page.h\"\n") >> CFILE + printf("#include \"db_dispatch.h\"\n") >> CFILE + if (prefix != "db") + printf("#include \"%s.h\"\n", DIR) >> CFILE + printf("#include \"db_am.h\"\n", DIR) >> CFILE + + # Write Recover file headers + cmd = sprintf("sed -e s/PREF/%s/ < \ + template/rec_htemp > %s", prefix, RFILE); + system(cmd); + + num_funcs = 0; + printf("#ifndef %s_AUTO_H\n#define %s_AUTO_H\n", prefix, prefix) \ + >> HFILE; +} +/^[ ]*BEGIN/ { + if (in_begin) { + print "Invalid format: missing END statement" + error++; + } + in_begin = 1; + is_sync = $3; + structs++; + nvars=0; + funcname=sprintf("%s_%s", prefix, $2); + thisfunc = $2; + funcs[num_funcs] = funcname; + num_funcs++; + is_dbt = 0; +} +/^[ ]*(ARG|DBT|POINTER)/ { + vars[nvars] = $2; + types[nvars] = $3; + atypes[nvars] = $1; + modes[nvars] = $1; + formats[nvars] = $NF; + for (i = 4; i < NF; i++) + types[nvars] = sprintf("%s %s", types[nvars], $i); + + if ($1 == "ARG") + sizes[nvars] = sprintf("sizeof(%s)", $2); + else if ($1 == "POINTER") + sizes[nvars] = sprintf("sizeof(*%s)", $2); + else { # DBT + sizes[nvars] = \ + sprintf("sizeof(u_int32_t) + (%s == NULL ? 0 : %s->size)", \ + $2, $2); + is_dbt = 1; + } + nvars++; +} +/^[ ]*END/ { + if (!in_begin) { + print "Invalid format: missing BEGIN statement" + next; + } + + # Make the entire H file conditional + # Define the record type in the H file + printf("\n#define\tDB_%s\t(DB_%s_BEGIN + %d)\n\n", \ + funcname, prefix, structs) >> HFILE + + # structure declarations + printf("typedef struct _%s_args {\n", funcname) >> HFILE + + # Here are the required fields for every structure + printf("\tu_int32_t type;\n\tDB_TXN *txnid;\n") >> HFILE + printf("\tDB_LSN prev_lsn;\n") >>HFILE + + # Here are the specified fields. + for (i = 0; i < nvars; i++) { + t = types[i]; + if (modes[i] == "POINTER") { + ndx = index(t, "*"); + t = substr(types[i], 0, ndx - 1); + } + printf("\t%s\t%s;\n", t, vars[i]) >> HFILE + } + printf("} __%s_args;\n\n", funcname) >> HFILE + +# Now write the log function out to the cfile + # PUBLIC declaration + printf("/*\n * PUBLIC: ") >> CFILE; + printf("int __%s_log\n * PUBLIC: __P((", funcname) >> CFILE; + printf("DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t") >> CFILE; + for (i = 0; i < nvars; i++) { + printf(",") >> CFILE; + if ((i % 4) == 0) + printf("\n * PUBLIC: ") >> CFILE; + else + printf(" ") >> CFILE; + if (modes[i] == "DBT") + printf("const ") >> CFILE; + printf("%s", types[i]) >> CFILE; + if (modes[i] == "DBT") + printf(" *") >> CFILE; + } + printf("));\n */\n") >> CFILE; + + # Function declaration + printf("int __%s_log(logp, txnid, ret_lsnp, flags", funcname) >> CFILE; + for (i = 0; i < nvars; i++) { + printf(",") >> CFILE; + if ((i % 6) == 0) + printf("\n\t") >> CFILE; + else + printf(" ") >> CFILE; + printf("%s", vars[i]) >> CFILE; + } + printf(")\n") >> CFILE; + + # Now print the parameters + printf("\tDB_LOG *logp;\n") >> CFILE; + printf("\tDB_TXN *txnid;\n\tDB_LSN *ret_lsnp;\n") >> CFILE; + printf("\tu_int32_t flags;\n") >> CFILE; + for (i = 0; i < nvars; i++) { + if (modes[i] == "DBT") + printf("\tconst %s *%s;\n", types[i], vars[i]) >> CFILE; + else + printf("\t%s %s;\n", types[i], vars[i]) >> CFILE; + } + + # Function body and local decls + printf("{\n") >> CFILE; + printf("\tDBT logrec;\n") >> CFILE; + printf("\tDB_LSN *lsnp, null_lsn;\n") >> CFILE; + if (is_dbt == 1) + printf("\tu_int32_t zero;\n") >> CFILE; + printf("\tu_int32_t rectype, txn_num;\n") >> CFILE; + printf("\tint ret;\n") >> CFILE; + printf("\tu_int8_t *bp;\n\n") >> CFILE; + + # Initialization + printf("\trectype = DB_%s;\n", funcname) >> CFILE; + printf("\ttxn_num = txnid == NULL ? 0 : txnid->txnid;\n") >> CFILE; + printf("\tif (txnid == NULL) {\n") >> CFILE; + printf("\t\tnull_lsn.file = 0;\n\t\tnull_lsn.offset = 0;\n") >> CFILE; + printf("\t\tlsnp = &null_lsn;\n") >> CFILE; + printf("\t} else\n\t\tlsnp = &txnid->last_lsn;\n") >> CFILE; + + # MALLOC + printf("\tlogrec.size = sizeof(rectype) + ") >> CFILE; + printf("sizeof(txn_num) + sizeof(DB_LSN)") >> CFILE; + for (i = 0; i < nvars; i++) + printf("\n\t + %s", sizes[i]) >> CFILE; + printf(";\n\tif ((logrec.data = (void *)") >> CFILE; + printf("__db_malloc(logrec.size)) == NULL)\n") >> CFILE; + printf("\t\treturn (ENOMEM);\n\n") >> CFILE; + + # Copy args into buffer + + printf("\tbp = logrec.data;\n") >> CFILE; + printf("\tmemcpy(bp, &rectype, sizeof(rectype));\n") >> CFILE; + printf("\tbp += sizeof(rectype);\n") >> CFILE; + printf("\tmemcpy(bp, &txn_num, sizeof(txn_num));\n") >> CFILE; + printf("\tbp += sizeof(txn_num);\n") >> CFILE; + printf("\tmemcpy(bp, lsnp, sizeof(DB_LSN));\n") >> CFILE; + printf("\tbp += sizeof(DB_LSN);\n") >> CFILE; + + for (i = 0; i < nvars; i ++) { + if (modes[i] == "ARG") { + printf("\tmemcpy(bp, &%s, %s);\n", \ + vars[i], sizes[i]) >> CFILE; + printf("\tbp += %s;\n", sizes[i]) >> CFILE; + } else if (modes[i] == "DBT") { + printf("\tif (%s == NULL) {\n", vars[i]) >> CFILE; + printf("\t\tzero = 0;\n") >> CFILE; + printf("\t\tmemcpy(bp, &zero, sizeof(u_int32_t));\n") \ + >> CFILE; + printf("\t\tbp += sizeof(u_int32_t);\n") >> CFILE; + printf("\t} else {\n") >> CFILE; + printf("\t\tmemcpy(bp, &%s->size, ", vars[i]) >> CFILE; + printf("sizeof(%s->size));\n", vars[i]) >> CFILE; + printf("\t\tbp += sizeof(%s->size);\n", vars[i]) \ + >> CFILE; + printf("\t\tmemcpy(bp, %s->data, %s->size);\n", \ + vars[i], vars[i]) >> CFILE; + printf("\t\tbp += %s->size;\n\t}\n", vars[i]) >> CFILE; + } else { # POINTER + printf("\tif (%s != NULL)\n", vars[i]) >> CFILE; + printf("\t\tmemcpy(bp, %s, %s);\n", vars[i], \ + sizes[i]) >> CFILE; + printf("\telse\n") >> CFILE; + printf("\t\tmemset(bp, 0, %s);\n", sizes[i]) >> CFILE; + printf("\tbp += %s;\n", sizes[i]) >> CFILE; + } + } + + # Error checking + printf("#ifdef DIAGNOSTIC\n") >> CFILE; + printf("\tif ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size)") >> CFILE; + printf("\n\t\tfprintf(stderr, \"%s\");\n", \ + "Error in log record length") >> CFILE; + printf("#endif\n") >> CFILE; + + # Issue log call + # The logging system cannot call the public log_put routine + # due to mutual exclusion constraints. So, if we are + # generating code for the log subsystem, use the internal + # __log_put. + if (prefix == "log") + printf("\tret = __log_put\(logp, ret_lsnp, ") >> CFILE; + else + printf("\tret = log_put(logp, ret_lsnp, ") >> CFILE; + printf("(DBT *)&logrec, flags);\n") >> CFILE; + + # Update the transactions last_lsn + printf("\tif (txnid != NULL)\n") >> CFILE; + printf("\t\ttxnid->last_lsn = *ret_lsnp;\n") >> CFILE; + + # Free and return + printf("\t__db_free(logrec.data);\n") >> CFILE; + printf("\treturn (ret);\n}\n\n") >> CFILE; + +# Write the print function + # PUBLIC declaration + printf("/*\n * PUBLIC: int __%s_print\n * PUBLIC:", funcname) >> CFILE; + printf(" __P((DB_LOG *, DBT *, DB_LSN *, int, void *));\n") >> CFILE; + printf(" */\n") >> CFILE; + + # Function declaration + printf("int\n__%s_print(notused1, ", funcname) >> CFILE; + printf("dbtp, lsnp, notused2, notused3)\n") >> CFILE; + printf("\tDB_LOG *notused1;\n\tDBT *dbtp;\n") >> CFILE; + printf("\tDB_LSN *lsnp;\n") >> CFILE; + printf("\tint notused2;\n\tvoid *notused3;\n{\n") >> CFILE; + + # Locals + printf("\t__%s_args *argp;\n", funcname) >> CFILE; + printf("\tu_int32_t i;\n\tu_int ch;\n\tint ret;\n\n") >> CFILE; + + # Get rid of complaints about unused parameters. + printf("\ti = 0;\n\tch = 0;\n") >> CFILE; + printf("\tnotused1 = NULL;\n") >> CFILE; + printf("\tnotused2 = 0;\n\tnotused3 = NULL;\n\n") >> CFILE; + + # Call read routine to initialize structure + printf("\tif ((ret = __%s_read(dbtp->data, &argp)) != 0)\n", \ + funcname) >> CFILE; + printf("\t\treturn (ret);\n") >> CFILE; + + # Print values in every record + printf("\tprintf(\"[%%lu][%%lu]%s: ", funcname) >> CFILE; + printf("rec: %%lu txnid %%lx ") >> CFILE; + printf("prevlsn [%%lu][%%lu]\\n\",\n") >> CFILE; + printf("\t (u_long)lsnp->file,\n") >> CFILE; + printf("\t (u_long)lsnp->offset,\n") >> CFILE; + printf("\t (u_long)argp->type,\n") >> CFILE; + printf("\t (u_long)argp->txnid->txnid,\n") >> CFILE; + printf("\t (u_long)argp->prev_lsn.file,\n") >> CFILE; + printf("\t (u_long)argp->prev_lsn.offset);\n") >> CFILE; + + # Now print fields of argp + for (i = 0; i < nvars; i ++) { + printf("\tprintf(\"\\t%s: ", vars[i]) >> CFILE; + + if (modes[i] == "DBT") { + printf("\");\n") >> CFILE; + printf("\tfor (i = 0; i < ") >> CFILE; + printf("argp->%s.size; i++) {\n", vars[i]) >> CFILE; + printf("\t\tch = ((u_int8_t *)argp->%s.data)[i];\n", \ + vars[i]) >> CFILE; + printf("\t\tif (isprint(ch) || ch == 0xa)\n") >> CFILE; + printf("\t\t\tputchar(ch);\n") >> CFILE; + printf("\t\telse\n") >> CFILE; + printf("\t\t\tprintf(\"%%#x \", ch);\n") >> CFILE; + printf("\t}\n\tprintf(\"\\n\");\n") >> CFILE; + } else if (types[i] == "DB_LSN *") { + printf("[%%%s][%%%s]\\n\",\n", \ + formats[i], formats[i]) >> CFILE; + printf("\t (u_long)argp->%s.file,", \ + vars[i]) >> CFILE; + printf(" (u_long)argp->%s.offset);\n", \ + vars[i]) >> CFILE; + } else { + if (formats[i] == "lx") + printf("0x") >> CFILE; + printf("%%%s\\n\", ", formats[i]) >> CFILE; + if (formats[i] == "lx" || formats[i] == "lu") + printf("(u_long)") >> CFILE; + if (formats[i] == "ld") + printf("(long)") >> CFILE; + printf("argp->%s);\n", vars[i]) >> CFILE; + } + } + printf("\tprintf(\"\\n\");\n") >> CFILE; + printf("\t__db_free(argp);\n") >> CFILE; + printf("\treturn (0);\n") >> CFILE; + printf("}\n\n") >> CFILE; + +# Now write the read function out to the cfile + printf("/*\n * PUBLIC: int __%s_read __P((void *, ", funcname) >> CFILE; + printf("__%s_args **));\n */\n", funcname) >> CFILE; + + # Function declaration + printf("int\n__%s_read(recbuf, argpp)\n", funcname) >> CFILE; + + # Now print the parameters + printf("\tvoid *recbuf;\n") >> CFILE; + printf("\t__%s_args **argpp;\n", funcname) >> CFILE; + + # Function body and local decls + printf("{\n\t__%s_args *argp;\n", funcname) >> CFILE; + printf("\tu_int8_t *bp;\n") >> CFILE; + + printf("\n\targp = (__%s_args *)__db_malloc(sizeof(", \ + funcname) >> CFILE; + printf("__%s_args) +\n\t sizeof(DB_TXN));\n", funcname) >> CFILE; + printf("\tif (argp == NULL)\n\t\treturn (ENOMEM);\n") >> CFILE; + + # Set up the pointers to the txnid and the prev lsn + printf("\targp->txnid = (DB_TXN *)&argp[1];\n") >> CFILE; + + # First get the record type, prev_lsn, and txnid fields. + + printf("\tbp = recbuf;\n") >> CFILE; + printf("\tmemcpy(&argp->type, bp, sizeof(argp->type));\n") >> CFILE; + printf("\tbp += sizeof(argp->type);\n") >> CFILE; + printf("\tmemcpy(&argp->txnid->txnid, bp, ") >> CFILE; + printf("sizeof(argp->txnid->txnid));\n") >> CFILE; + printf("\tbp += sizeof(argp->txnid->txnid);\n") >> CFILE; + printf("\tmemcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));\n") >> CFILE; + printf("\tbp += sizeof(DB_LSN);\n") >> CFILE; + + # Now get rest of data. + + for (i = 0; i < nvars; i ++) { + if (modes[i] == "DBT") { + printf("\tmemcpy(&argp->%s.size, ", vars[i]) >> CFILE; + printf("bp, sizeof(u_int32_t));\n") >> CFILE; + printf("\tbp += sizeof(u_int32_t);\n") >> CFILE; + printf("\targp->%s.data = bp;\n", vars[i]) >> CFILE; + printf("\tbp += argp->%s.size;\n", vars[i]) >> CFILE; + } else if (modes[i] == "ARG") { + printf("\tmemcpy(&argp->%s, bp, %s%s));\n", \ + vars[i], "sizeof(argp->", vars[i]) >> CFILE; + printf("\tbp += sizeof(argp->%s);\n", vars[i]) >> CFILE; + } else { # POINTER + printf("\tmemcpy(&argp->%s, bp, ", vars[i]) >> CFILE; + printf(" sizeof(argp->%s));\n", vars[i]) >> CFILE; + printf("\tbp += sizeof(argp->%s);\n", vars[i]) >> CFILE; + } + } + + # Free and return + printf("\t*argpp = argp;\n") >> CFILE; + printf("\treturn (0);\n}\n\n") >> CFILE; + +# Recovery template + + cmd = sprintf("sed -e s/PREF/%s/ -e s/FUNC/%s/ < \ + template/rec_ctemp >> %s", prefix, thisfunc, RFILE) + system(cmd); + + # Done writing stuff, reset and continue. + in_begin = 0; +} +END { + if (error || in_begin) + print "Unsuccessful" + +# Print initialization routine + # Write PUBLIC declaration + printf("/*\n * PUBLIC: ") >> CFILE; + printf("int __%s_init_print __P((DB_ENV *));\n", prefix) >> CFILE; + printf(" */\n") >> CFILE; + + # Create the routine to call db_add_recovery(print_fn, id) + printf("int\n__%s_init_print(dbenv)\n", prefix) >> CFILE; + printf("\tDB_ENV *dbenv;\n{\n\tint ret;\n\n") >> CFILE; + for (i = 0; i < num_funcs; i++) { + printf("\tif ((ret = __db_add_recovery(dbenv,\n") >> CFILE; + printf("\t __%s_print, DB_%s)) != 0)\n", \ + funcs[i], funcs[i]) >> CFILE; + printf("\t\treturn (ret);\n") >> CFILE; + } + printf("\treturn (0);\n}\n\n") >> CFILE; + +# Recover initialization routine + printf("/*\n * PUBLIC: ") >> CFILE; + printf("int __%s_init_recover __P((DB_ENV *));\n", prefix) >> CFILE; + printf(" */\n") >> CFILE; + + # Create the routine to call db_add_recovery(func, id) + printf("int\n__%s_init_recover(dbenv)\n", prefix) >> CFILE; + printf("\tDB_ENV *dbenv;\n{\n\tint ret;\n\n") >> CFILE; + for (i = 0; i < num_funcs; i++) { + printf("\tif ((ret = __db_add_recovery(dbenv,\n") >> CFILE; + printf("\t __%s_recover, DB_%s)) != 0)\n", \ + funcs[i], funcs[i]) >> CFILE; + printf("\t\treturn (ret);\n") >> CFILE; + } + printf("\treturn (0);\n}\n\n") >> CFILE; + + # End the conditional for the HFILE + printf("#endif\n") >> HFILE; + +} +' CFILE=$cfile DIR=$dname HFILE=$hfile RFILE=$rfile < $ifile diff --git a/mozilla/db/dist/distrib b/mozilla/db/dist/distrib new file mode 100644 index 00000000000..6a9e730f0e8 --- /dev/null +++ b/mozilla/db/dist/distrib @@ -0,0 +1,258 @@ +#!/bin/sh - +# @(#)distrib 10.26 (Sleepycat) 5/26/98 + +# Build autoconf structure. +echo "Running autoheader" +autoheader 2>&1 | sed '/warning: AC_TRY_RUN called without default/d' +chmod 444 config.h.in +echo "Running autoconf" +autoconf 2>&1 | sed '/warning: AC_TRY_RUN called without default/d' +chmod 555 configure config.guess config.sub install-sh + +msgc="/* DO NOT EDIT: automatically built by dist/distrib. */" +msgsh="# DO NOT EDIT: automatically built by dist/distrib." +msgcxx="// DO NOT EDIT: automatically built by dist/distrib." + +# Build the automatically generated logging/recovery files. +for i in db btree hash log txn; do + sh ./db_gen.sh ../$i/$i.src ../$i +done + +# Build the automatically generated function prototype files. +for i in db btree clib common hash lock log mp mutex os txn; do + f=../include/${i}_ext.h + echo "Building $f" + (echo "$msgc" && + echo "#ifndef _${i}_ext_h_" && + echo "#define _${i}_ext_h_" && + sed -n "s/^ \* PUBLIC: \(.*\)/\1/p" ../$i/*.c && + echo "#endif /* _${i}_ext_h_ */") > $f + chmod 444 $f +done + +# Build the Win32 files. +f=../build.win32/db.h +echo "Building $f" +(echo "$msgc" && sed \ + -e 's/@u_int8_decl@/typedef unsigned char u_int8_t;/' \ + -e 's/@int16_decl@/typedef short int16_t;/' \ + -e 's/@u_int16_decl@/typedef unsigned short u_int16_t;/' \ + -e 's/@int32_decl@/typedef int int32_t;/' \ + -e 's/@u_int32_decl@/typedef unsigned int u_int32_t;/' \ + -e '/@u_char_decl@/{' \ + -e 'i\' \ + -e '#if !defined(_WINSOCKAPI_)' \ + -e 's/@u_char_decl@/typedef unsigned char u_char;/' \ + -e '}' \ + -e 's/@u_short_decl@/typedef unsigned short u_short;/' \ + -e 's/@u_int_decl@/typedef unsigned int u_int;/' \ + -e '/@u_long_decl@/{' \ + -e 's/@u_long_decl@/typedef unsigned long u_long;/' \ + -e 'a\' \ + -e '#endif' \ + -e '}' \ + < ../include/db.h.src) > $f +chmod 444 $f + +f=../build.win32/db_int.h +echo "Building $f" +(echo "$msgc" && sed \ + -e 's/\(PATH_SEPARATOR[^"]*"\)\/"/\1\\\\\/"/' \ + -e 's/@spin_line1@/typedef unsigned int tsl_t;/' \ + -e '/@spin_line2@/d' \ + -e '/@spin_line3@/d' \ + -e 's/@mutex_align@/sizeof(unsigned int)/' \ + < ../include/db_int.h.src) > $f +chmod 444 $f + +f=../build.win32/libdb.rc +echo "Building $f" +major=`egrep DB_VERSION_MAJOR ../include/db.h.src | awk '{print $3}'` +minor=`egrep DB_VERSION_MINOR ../include/db.h.src | awk '{print $3}'` +patch=`egrep DB_VERSION_PATCH ../include/db.h.src | awk '{print $3}'` +sed -e "s/%MAJOR%/$major/" \ + -e "s/%MINOR%/$minor/" \ + -e "s/%PATCH%/$patch/" \ + < ../build.win32/libdb.rc.src > $f +chmod 444 $f + +f=../build.win32/.dbtestrc +echo "Building $f" +(echo "$msgsh" && \ + sed -e "s/is_windows_test[ ]0/is_windows_test 1/" ../test/test.tcl) > $f +chmod 444 $f + +# Build the Win16 files. +f=../build.win16/db.h +echo "Building $f" +(echo "$msgc" && sed \ + -e 's/@u_int8_decl@/typedef unsigned char u_int8_t;/' \ + -e 's/@int16_decl@/typedef short int16_t;/' \ + -e 's/@u_int16_decl@/typedef unsigned short u_int16_t;/' \ + -e 's/@int32_decl@/typedef long int32_t;/' \ + -e 's/@u_int32_decl@/typedef unsigned long u_int32_t;/' \ + -e '/@u_char_decl@/{' \ + -e 'i\' \ + -e '#if !defined(_WINSOCKAPI_)' \ + -e 's/@u_char_decl@/typedef unsigned char u_char;/' \ + -e '}' \ + -e 's/@u_short_decl@/typedef unsigned short u_short;/' \ + -e 's/@u_int_decl@/typedef unsigned int u_int;/' \ + -e '/@u_long_decl@/{' \ + -e 's/@u_long_decl@/typedef unsigned long u_long;/' \ + -e 'a\' \ + -e '#endif' \ + -e '}' \ + -e 's/(\*\(db_errcall\))/(DB_CALLBACK *\1)/' \ + -e 's/(\*\(tx_recover\))/(DB_CALLBACK *\1)/' \ + -e 's/(\*\(db_malloc\))/(DB_CALLBACK *\1)/' \ + -e 's/(\*\(bt_compare\))/(DB_CALLBACK *\1)/' \ + -e 's/(\*\(bt_prefix\))/(DB_CALLBACK *\1)/' \ + -e 's/(\*\(h_hash\))/(DB_CALLBACK *\1)/' \ + -e 's/(\*\(close\))/(DB_CALLBACK *\1)/' \ + -e 's/(\*\(cursor\))/(DB_CALLBACK *\1)/' \ + -e 's/(\*\(del\))/(DB_CALLBACK *\1)/' \ + -e 's/(\*\(fd\))/(DB_CALLBACK *\1)/' \ + -e 's/(\*\(get\))/(DB_CALLBACK *\1)/' \ + -e 's/(\*\(put\))/(DB_CALLBACK *\1)/' \ + -e 's/(\*\(stat\))/(DB_CALLBACK *\1)/' \ + -e 's/(\*\(sync\))/(DB_CALLBACK *\1)/' \ + -e 's/(\*\(c_close\))/(DB_CALLBACK *\1)/' \ + -e 's/(\*\(c_del\))/(DB_CALLBACK *\1)/' \ + -e 's/(\*\(c_get\))/(__cdecl __loadds *\1)/' \ + -e 's/(\*\(c_put\))/(__cdecl __loadds *\1)/' \ + < ../include/db.h.src) > $f +chmod 444 $f + +f=../build.win16/db_int.h +echo "Building $f" +(echo "$msgc" && sed \ + -e 's/\(PATH_SEPARATOR[^"]*"\)\/"/\1\\\\\/"/' \ + -e 's/@spin_line1@/typedef unsigned int tsl_t;/' \ + -e '/@spin_line2@/d' \ + -e '/@spin_line3@/d' \ + -e 's/@mutex_align@/sizeof(unsigned int)/' \ + -e 's/off_t/u_int32_t/' \ + < ../include/db_int.h.src) > $f +chmod 444 $f + +# Build the MacOS files. +#f=../build.macos/db.h +#echo "Building $f" +#(echo "$msgc" && sed \ +# -e 's/@u_int8_decl@/typedef unsigned char u_int8_t;/' \ +# -e 's/@int16_decl@/typedef short int16_t;/' \ +# -e 's/@u_int16_decl@/typedef unsigned short u_int16_t;/' \ +# -e 's/@int32_decl@/typedef int int32_t;/' \ +# -e 's/@u_int32_decl@/typedef unsigned int u_int32_t;/' \ +# -e '/@u_char_decl@/d' \ +# -e '/@u_short_decl@/d' \ +# -e '/@u_int_decl@/d' \ +# -e '/@u_long_decl@/d' \ +# < ../include/db.h.src) > $f +#chmod 444 $f + +#f=../build.macos/db_int.h +#echo "Building $f" +#(echo "$msgc" && sed \ +# -e 's/^#include."db.h".*/#include "::build.macintosh:db.h"/' \ +# -e 's/\(PATH_SEPARATOR[^"]*"\)\/"/\1:"/' \ +# -e 's/@spin_line1@/typedef unsigned char tsl_t;/' \ +# -e '/@spin_line2@/d' \ +# -e 's/@mutex_align@/sizeof(unsigned char)/' \ +# < ../include/db_int.h.src) > $f +#chmod 444 $f + +# Build the Java files. +f=../java/src/com/sleepycat/db/DbConstants.java +echo "Building $f" +(echo "$msgcxx" && \ + echo && + echo 'package com.sleepycat.db;' && + echo && + echo 'public class DbConstants' && + echo '{' && + grep '#define.DB_' ../include/db.h.src | \ + sed -e '/"/d' -e 's/[()]//g' | \ + awk '{ print "\tpublic static final int " $2 " = " $3 ";" }' && \ + echo '}') > $f +chmod 444 $f + +# Build the Tcl test files. +f=../test/include.tcl.src +echo "Building $f" +rm -f $f +(echo "$msgsh" && \ + echo 'global dict' && \ + echo 'global testdir' && \ + echo '' && \ + echo 'set CP @db_cv_path_cp@' && \ + echo 'set DIFF @db_cv_path_diff@' && \ + echo 'set KILL @db_cv_path_kill@' && \ + echo 'set LS @db_cv_path_ls@' && \ + echo 'set MKDIR @db_cv_path_mkdir@' && \ + echo 'set MV @db_cv_path_mv@' && \ + echo 'set RM @db_cv_path_rm@' && \ + echo 'set SED @db_cv_path_sed@' && \ + echo 'set SLEEP @db_cv_path_sleep@' && \ + echo 'set SORT @db_cv_path_sort@' && \ + echo 'set TR @db_cv_path_tr@' && \ + echo '' && \ + echo 'set DB_LOCK_GET 0' && \ + echo 'set DB_LOCK_PUT 1' && \ + echo 'set DB_LOCK_PUT_ALL 2' && \ + echo 'set DB_LOCK_PUT_OBJ 3' && \ + echo 'set DB_LOCK_NG 0' && \ + echo 'set DB_LOCK_READ 1' && \ + echo 'set DB_LOCK_WRITE 2' && \ + echo 'set DB_LOCK_IREAD 3' && \ + echo 'set DB_LOCK_IWRITE 4' && \ + echo 'set DB_LOCK_IWR 5' && \ + grep '#define.DB_' ../include/db.h.src | sed -e '/"/d' -e 's/[()]//g' | \ + awk '{ print "set " $2 " " $3}') > $f +chmod 444 $f + +f=../build.win32/include.tcl +echo "Building $f" +rm -f $f +(echo "$msgsh" && \ + echo 'global dict' && \ + echo 'global testdir' && \ + echo '' && \ + echo 'set CP c:/tools/cp.exe' && \ + echo 'set DIFF c:/tools/diff.exe' && \ + echo 'set KILL c:/tools/kill.exe' && \ + echo 'set LS c:/tools/ls.exe' && \ + echo 'set MKDIR c:/tools/mkdir.exe' && \ + echo 'set MV c:/tools/mv.exe' && \ + echo 'set RM c:/tools/rm.exe' && \ + echo 'set SED c:/tools/sed.exe' && \ + echo 'set SLEEP c:/tools/sleep.exe' && \ + echo 'set SORT c:/tools/sort.exe' && \ + echo 'set TR c:/tools/tr.exe' && \ + echo '' && \ + echo 'set DB_LOCK_GET 0' && \ + echo 'set DB_LOCK_PUT 1' && \ + echo 'set DB_LOCK_PUT_ALL 2' && \ + echo 'set DB_LOCK_PUT_OBJ 3' && \ + echo 'set DB_LOCK_NG 0' && \ + echo 'set DB_LOCK_READ 1' && \ + echo 'set DB_LOCK_WRITE 2' && \ + echo 'set DB_LOCK_IREAD 3' && \ + echo 'set DB_LOCK_IWRITE 4' && \ + echo 'set DB_LOCK_IWR 5' && \ + grep '#define.DB_' ../include/db.h.src | sed -e '/"/d' -e 's/[()]//g' | \ + awk '{ print "set " $2 " " $3}') > $f +chmod 444 $f + +# Build tags files. +f=tags +echo "Building $f" +rm -f $f +ctags -d -w \ + ../include/*.src ../include/*.h ../btree/*.[ch] ../clib/*.[ch] \ + ../common/*.[ch] ../db/*.[ch] ../db185/*.[ch] ../dbm/*.[ch] \ + ../hash/*.[ch] ../hsearch/*.[ch] ../lock/*.[ch] ../log/*.[ch] \ + ../mp/*.[ch] ../mutex/*.[ch] ../os/*.[ch] ../txn/*.[ch] \ + ../test/*.[ch] +chmod 444 $f diff --git a/mozilla/db/dist/install-sh b/mozilla/db/dist/install-sh new file mode 100755 index 00000000000..ab74c882e92 --- /dev/null +++ b/mozilla/db/dist/install-sh @@ -0,0 +1,238 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. +# + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +tranformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/mozilla/db/dist/man.error/clean.awk b/mozilla/db/dist/man.error/clean.awk new file mode 100644 index 00000000000..c3560a1d205 --- /dev/null +++ b/mozilla/db/dist/man.error/clean.awk @@ -0,0 +1,19 @@ +# @(#)clean.awk 8.2 (Sleepycat) 3/22/97 +# Minimize the set of function calls per routine. + +BEGIN { + o="awk.out" +} +/!START/,/!STOP/ { + print $0 >> o +} +/!STOP/ { + cmd = sprintf("sed -e '/START/d' -e '/STOP/d' %s | sort -u; >%s", \ + o, o); + print " !START" + system(cmd); + print " !STOP" +} +!/^ / { + print $0 +} diff --git a/mozilla/db/dist/man.error/conv.sed b/mozilla/db/dist/man.error/conv.sed new file mode 100644 index 00000000000..a30d531e0fe --- /dev/null +++ b/mozilla/db/dist/man.error/conv.sed @@ -0,0 +1,198 @@ +# @(#)conv.sed 8.6 (Sleepycat) 9/18/97 +# +# Convert output into man page references. + +# Discard empty lines. +/^$/d + +# Discard START/STOP lines. +/^ !START/d +/^ !STOP/d + +# Function names get a leading keyword. +/^ /!{ + s/^/FUNCTION / + p + d +} + +# Functions that never return an error. +/^ !_exit$/d +/^ !abort$/d +/^ !ctime$/d +/^ !fprintf$/d +/^ !free$/d +/^ !getenv$/d +/^ !getpid$/d +/^ !getuid$/d +/^ !isalpha$/d +/^ !isdigit$/d +/^ !isprint$/d +/^ !printf$/d +/^ !snprintf$/d +/^ !sprintf$/d +/^ !vfprintf$/d +/^ !vsnprintf$/d + +# Section 2 list from BSD/OS. +s/ !_exit$/_exit(2),/ +s/ !accept$/accept(2),/ +s/ !access$/access(2),/ +s/ !acct$/acct(2),/ +s/ !adjtime$/adjtime(2),/ +s/ !bind$/bind(2),/ +s/ !brk$/brk(2),/ +s/ !chdir$/chdir(2),/ +s/ !chflags$/chflags(2),/ +s/ !chmod$/chmod(2),/ +s/ !chown$/chown(2),/ +s/ !chroot$/chroot(2),/ +s/ !close$/close(2),/ +s/ !connect$/connect(2),/ +s/ !dup$/dup(2),/ +s/ !dup2$/dup2(2),/ +s/ !exec$/exec(2),/ +s/ !execve$/execve(2),/ +s/ !fchdir$/fchdir(2),/ +s/ !fchflags$/fchflags(2),/ +s/ !fchmod$/fchmod(2),/ +s/ !fchown$/fchown(2),/ +s/ !fcntl$/fcntl(2),/ +s/ !fd_alloc$/fd_alloc(2),/ +s/ !fd_copy$/fd_copy(2),/ +s/ !fd_realloc$/fd_realloc(2),/ +s/ !fd_zero$/fd_zero(2),/ +s/ !flock$/flock(2),/ +s/ !fork$/fork(2),/ +s/ !fpathconf$/fpathconf(2),/ +s/ !free$/free(2),/ +s/ !fstat$/fstat(2),/ +s/ !fstatfs$/fstatfs(2),/ +s/ !fsync$/fsync(2),/ +s/ !ftok$/ftok(2),/ +s/ !ftruncate$/ftruncate(2),/ +s/ !getdirentries$/getdirentries(2),/ +s/ !getdtablesize$/getdtablesize(2),/ +s/ !getegid$/getegid(2),/ +s/ !geteuid$/geteuid(2),/ +s/ !getfh$/getfh(2),/ +s/ !getfsstat$/getfsstat(2),/ +s/ !getgid$/getgid(2),/ +s/ !getgroups$/getgroups(2),/ +s/ !getitimer$/getitimer(2),/ +s/ !getlogin$/getlogin(2),/ +s/ !getpeername$/getpeername(2),/ +s/ !getpgrp$/getpgrp(2),/ +s/ !getpid$/getpid(2),/ +s/ !getppid$/getppid(2),/ +s/ !getpriority$/getpriority(2),/ +s/ !getrlimit$/getrlimit(2),/ +s/ !getrusage$/getrusage(2),/ +s/ !getsockname$/getsockname(2),/ +s/ !getsockopt$/getsockopt(2),/ +s/ !gettimeofday$/gettimeofday(2),/ +s/ !getuid$/getuid(2),/ +s/ !ioctl$/ioctl(2),/ +s/ !kill$/kill(2),/ +s/ !ktrace$/ktrace(2),/ +s/ !link$/link(2),/ +s/ !listen$/listen(2),/ +s/ !lseek$/lseek(2),/ +s/ !lstat$/lstat(2),/ +s/ !madvise$/madvise(2),/ +s/ !mincore$/mincore(2),/ +s/ !mkdir$/mkdir(2),/ +s/ !mkfifo$/mkfifo(2),/ +s/ !mknod$/mknod(2),/ +s/ !mlock$/mlock(2),/ +s/ !mmap$/mmap(2),/ +s/ !mount$/mount(2),/ +s/ !mprotect$/mprotect(2),/ +s/ !msgctl$/msgctl(2),/ +s/ !msgget$/msgget(2),/ +s/ !msgrcv$/msgrcv(2),/ +s/ !msgsnd$/msgsnd(2),/ +s/ !msync$/msync(2),/ +s/ !munlock$/munlock(2),/ +s/ !munmap$/munmap(2),/ +s/ !nfssvc$/nfssvc(2),/ +s/ !open$/open(2),/ +s/ !pathconf$/pathconf(2),/ +s/ !pipe$/pipe(2),/ +s/ !profil$/profil(2),/ +s/ !profile$/profile(2),/ +s/ !ptrace$/ptrace(2),/ +s/ !quotactl$/quotactl(2),/ +s/ !read$/read(2),/ +s/ !readlink$/readlink(2),/ +s/ !readv$/readv(2),/ +s/ !reboot$/reboot(2),/ +s/ !recv$/recv(2),/ +s/ !recvfrom$/recvfrom(2),/ +s/ !recvmsg$/recvmsg(2),/ +s/ !rename$/rename(2),/ +s/ !rmdir$/rmdir(2),/ +s/ !sbrk$/sbrk(2),/ +s/ !select$/select(2),/ +s/ !semctl$/semctl(2),/ +s/ !semget$/semget(2),/ +s/ !semop$/semop(2),/ +s/ !send$/send(2),/ +s/ !sendmsg$/sendmsg(2),/ +s/ !sendto$/sendto(2),/ +s/ !setegid$/setegid(2),/ +s/ !seteuid$/seteuid(2),/ +s/ !setgid$/setgid(2),/ +s/ !setgroups$/setgroups(2),/ +s/ !setitimer$/setitimer(2),/ +s/ !setlogin$/setlogin(2),/ +s/ !setpgid$/setpgid(2),/ +s/ !setpgrp$/setpgrp(2),/ +s/ !setpriority$/setpriority(2),/ +s/ !setrlimit$/setrlimit(2),/ +s/ !setsockopt$/setsockopt(2),/ +s/ !settimeofday$/settimeofday(2),/ +s/ !setuid$/setuid(2),/ +s/ !setuid.2:.pq$/setuid.2:.pq(2),/ +s/ !shmat$/shmat(2),/ +s/ !shmctl$/shmctl(2),/ +s/ !shmdt$/shmdt(2),/ +s/ !shmget$/shmget(2),/ +s/ !shutdown$/shutdown(2),/ +s/ !sigaction$/sigaction(2),/ +s/ !sigaltstack$/sigaltstack(2),/ +s/ !sigprocmask$/sigprocmask(2),/ +s/ !sigreturn$/sigreturn(2),/ +s/ !sigstack$/sigstack(2),/ +s/ !sigsuspend$/sigsuspend(2),/ +s/ !socket$/socket(2),/ +s/ !socketpair$/socketpair(2),/ +s/ !stat$/stat(2),/ +s/ !statfs$/statfs(2),/ +s/ !swapon$/swapon(2),/ +s/ !sync$/sync(2),/ +s/ !syscall$/syscall(2),/ +s/ !tcgetpgrp$/tcgetpgrp(2),/ +s/ !tcsetpgrp$/tcsetpgrp(2),/ +s/ !truncate$/truncate(2),/ +s/ !umask$/umask(2),/ +s/ !undelete$/undelete(2),/ +s/ !unlink$/unlink(2),/ +s/ !unmount$/unmount(2),/ +s/ !utimes$/utimes(2),/ +s/ !vfork$/vfork(2),/ +s/ !wait$/wait(2),/ +s/ !wait3$/wait3(2),/ +s/ !wait4$/wait4(2),/ +s/ !waitpid$/waitpid(2),/ +s/ !wcoredump$/wcoredump(2),/ +s/ !wifexited$/wifexited(2),/ +s/ !wifsignaled$/wifsignaled(2),/ +s/ !wifstopped$/wifstopped(2),/ +s/ !write$/write(2),/ +s/ !writev$/writev(2),/ + +# Anything else is section 3. +/(2)/!{ + s/ *!\(.*\)/\1(3),/ +} diff --git a/mozilla/db/dist/man.error/cxx.sed b/mozilla/db/dist/man.error/cxx.sed new file mode 100644 index 00000000000..800501b0acb --- /dev/null +++ b/mozilla/db/dist/man.error/cxx.sed @@ -0,0 +1,62 @@ +# @(#)cxx.sed 10.1 (Sleepycat) 9/18/97 +# +# Corrections for the C++ wrapper for DB. + +# DB +s/DB->/Db::/ +s/DBcursor->c_/Dbc::/ + +s/db_appexit/DbEnv::appexit/ +s/db_appinit/DbEnv::appinit/ + +# Lock +s/lock_detect/DbLock::detect/ +s/lock_get/DbLock::get/ +s/lock_put/DbLock::put/ +s/lock_unlink/DbLock::unlink/ + +s/lock_close/DbLockTab::close/ +s/lock_id/DbLockTab::id/ +s/lock_open/DbLockTab::open/ +s/lock_vec/DbLockTab::vec/ + +# Log +s/log_archive/DbLog::archive/ +s/log_close/DbLog::close/ +s/log_compare/DbLog::compare/ +s/log_file/DbLog::file/ +s/log_flush/DbLog::flush/ +s/log_get/DbLog::get/ +s/log_open/DbLog::open/ +s/log_put/DbLog::put/ +s/log_register/DbLog::db_register/ +s/log_unlink/DbLog::unlink/ +s/log_unregister/DbLog::db_register/ + +# Mpool +s/memp_close/DbMpool::close/ +s/memp_open/DbMpool::open/ +s/memp_register/DbMpool::db_register/ +s/memp_stat/DbMpool::stat/ +s/memp_sync/DbMpool::sync/ +s/memp_unlink/DbMpool::unlink/ + +s/memp_fclose/DbMpoolFile::close/ +s/memp_fget/DbMpoolFile::get/ +s/memp_fopen/DbMpoolFile::open/ +s/memp_fput/DbMpoolFile::put/ +s/memp_fset/DbMpoolFile::set/ +s/memp_fsync/DbMpoolFile::sync/ + +# Txn +s/txn_abort/DbTxn::abort/ +s/txn_commit/DbTxn::commit/ +s/txn_id/DbTxn::id/ +s/txn_prepare/DbTxn::prepare/ + +s/txn_begin/DbTxnMgr::begin/ +s/txn_checkpoint/DbTxnMgr::checkpoint/ +s/txn_close/DbTxnMgr::close/ +s/txn_open/DbTxnMgr::open/ +s/txn_stat/DbTxnMgr::stat/ +s/txn_unlink/DbTxnMgr::unlink/ diff --git a/mozilla/db/dist/man.error/db.sed b/mozilla/db/dist/man.error/db.sed new file mode 100644 index 00000000000..ed827d61bde --- /dev/null +++ b/mozilla/db/dist/man.error/db.sed @@ -0,0 +1,189 @@ +# @(#)db.sed 8.6 (Sleepycat) 11/12/97 +# +# Various corrections for the DB package. + +# Translate macros that call functions. +s/^DB_ADDSTR$/__db_abspath\ +strlen\ +memcpy/ +s/^DISCARD$/memp_fput\ +lock_put/ +s/^GET_META$/lock_get\ +__ham_get_page\ +lock_put/ +s/^RELEASE_META$/lock_put\ +__ham_put_page/ +s/^DIRTY_META$/lock_get\ +lock_put/ + +s/^BT_STK_ENTER$/__bam_stkgrow/ +s/^DB_CHECK_FCOMBO$/__db_ferr/ +s/^DB_CHECK_FLAGS$/__db_ferr/ +s/^FREE$/free/ +s/^FREES$/free/ +s/^GETHANDLE$/__db_gethandle/ +s/^H_GETHANDLE$/__db_gethandle/ +s/^H_PUTHANDLE$/__db_puthandle/ +s/^LOCKBUFFER$/__db_mutex_lock/ +s/^LOCKBUFFER$/__db_mutex_lock/ +s/^LOCKHANDLE$/__db_mutex_lock/ +s/^LOCKINIT$/__db_mutex_init/ +s/^LOCKREGION$/__db_mutex_lock/ +s/^LOCKREGION$/__db_mutex_lock/ +s/^LOCK_LOCKREGION$/__db_mutex_lock/ +s/^LOCK_LOGREGION$/__db_mutex_lock/ +s/^LOCK_LOGTHREAD$/__db_mutex_lock/ +s/^LOCK_TXNREGION$/__db_mutex_lock/ +s/^LOCK_TXNTHREAD$/__db_mutex_lock/ +s/^PUTHANDLE$/__db_puthandle/ +s/^PUT_HKEYDATA$/memcpy/ +s/^UNLOCKBUFFER$/__db_mutex_unlock/ +s/^UNLOCKBUFFER$/__db_mutex_unlock/ +s/^UNLOCKHANDLE$/__db_mutex_unlock/ +s/^UNLOCKREGION$/__db_mutex_unlock/ +s/^UNLOCKREGION$/__db_mutex_unlock/ +s/^UNLOCK_LOCKREGION$/__db_mutex_unlock/ +s/^UNLOCK_LOGREGION$/__db_mutex_unlock/ +s/^UNLOCK_LOGTHREAD$/__db_mutex_unlock/ +s/^UNLOCK_TXNREGION$/__db_mutex_unlock/ +s/^UNLOCK_TXNTHREAD$/__db_mutex_unlock/ +s/^__BT_LPUT$/lock_put/ +s/^__BT_TLPUT$/lock_put/ + +# Discard all other macro names. +/^[A-Z][A-Z0-9_]*$/d + +# Per-OS spooge. +/^CloseHandle$/d +/^FSp2FullPath$/d +/^GetFileInformationByHandle$/d +/^Special2FSSpec$/d +/^UnmapViewOfFile$/d +/^_findclose$/d +/^_findfirst$/d +/^_findnext$/d +/^_get_osfhandle$/d +/^_lseeki64$/d +/^llseek$/d + +# Db +/^db_errcall$/d +/^dbenv->db_errcall$/d +/^dbenv->yield$/d +/^dbmp->dbenv->db_yield$/d +/^dbmp->dbenv->yield$/d +/^yield$/d + +/^dbp->db_malloc$/s/.*/malloc/ +/^db_malloc$/s/.*/malloc/ +s/^freefunc$/__bam_free\ +__ham_del_page/ +s/^newfunc$/__bam_new\ +__ham_overflow_page/ +s/^am_func$/__bam_bdup\ +__ham_hdup/ + +s/^dbc->c_close$/xxxDBcursor->c_close/ +s/^dbc->c_del$/xxxDBcursor->c_del/ +s/^dbc->c_get$/xxxDBcursor->c_get/ +s/^dbc->c_put$/xxxDBcursor->c_put/ + +s/^db->close$/xxxDB->close/ +s/^db_close$/xxxDB->close/ +s/^db->cursor$/xxxDB->cursor/ +s/^db->del$/xxxDB->del/ +s/^db->fd$/xxxDB->fd/ +s/^db_fd$/xxxDB->fd/ +s/^db->get$/xxxDB->get/ +s/^db->put$/xxxDB->put/ +s/^db->stat$/xxxDB->stat/ +s/^db->sync$/xxxDB->sync/ + +s/^dbp->close$/xxxDB->close/ +s/^dbp->cursor$/xxxDB->cursor/ +s/^dbp->del$/xxxDB->del/ +s/^dbp->fd$/xxxDB->fd/ +s/^dbp->get$/xxxDB->get/ +s/^dbp->put$/xxxDB->put/ +s/^dbp->stat$/xxxDB->stat/ +s/^dbp->sync$/xxxDB->sync/ + +# Btree. +/^t->bt_prefix$/d + +s/^__bam_c_close$/xxxDBcursor->c_close/ +s/^__bam_c_del$/xxxDBcursor->c_del/ +s/^__bam_c_get$/xxxDBcursor->c_get/ +s/^__bam_c_put$/xxxDBcursor->c_put/ +s/^__bam_cursor$/xxxDB->cursor/ +s/^__bam_delete$/xxxDB->del/ +s/^__bam_get$/xxxDB->get/ +s/^__bam_put$/xxxDB->put/ +s/^__bam_stat$/xxxDB->stat/ +s/^__bam_sync$/xxxDB->sync/ + +# Hash. +/^hashp->hash$/d +/^__is_bitmap_pgno$/d + +s/^__ham_c_close$/xxxDBcursor->c_close/ +s/^__ham_c_del$/xxxDBcursor->c_del/ +s/^__ham_c_get$/xxxDBcursor->c_get/ +s/^__ham_c_put$/xxxDBcursor->c_put/ +s/^__ham_cursor$/xxxDB->cursor/ +s/^__ham_delete$/xxxDB->del/ +s/^__ham_get$/xxxDB->get/ +s/^__ham_put$/xxxDB->put/ +s/^__ham_stat$/xxxDB->stat/ +s/^__ham_sync$/xxxDB->sync/ + +# Recno. +/^__ram_fmap$/s/.*/__ram_fmap/ +/^rp->re_irec$/s/.*/__ram_fmap\ +__ram_vmap/ +/^re_irec$/s/.*/__ram_fmap\ +__ram_vmap/ + +s/^__ram_c_close$/xxxDBcursor->c_close/ +s/^__ram_c_del$/xxxDBcursor->c_del/ +s/^__ram_c_get$/xxxDBcursor->c_get/ +s/^__ram_c_put$/xxxDBcursor->c_put/ +s/^__ram_cursor$/xxxDB->cursor/ +s/^__ram_delete$/xxxDB->del/ +s/^__ram_get$/xxxDB->get/ +s/^__ram_put$/xxxDB->put/ +s/^__ram_stat$/xxxDB->stat/ +s/^__ram_sync$/xxxDB->sync/ + +# Log. +/^cmpfunc$/d + +# Mpool. +s/^mpreg->pgin$/xxxDBmemp->pgin/ +s/^mpreg->pgout$/xxxDBmemp->pgout/ + +# Txn. +/^mgr->recover$/s/.*/xxxDBenv->tx_recover/ + +# Db jump table entries. +s/^__db_calloc/calloc/ +s/^__db_close$/close/ +s/^__db_dirfree/free/ +s/^__db_dirlist/opendir\ +readdir/ +s/^__db_exists$/stat/ +s/^__db_free$/free/ +s/^__db_ioinfo$/stat/ +s/^__db_malloc$/malloc/ +s/^__db_map$/mmap/ +s/^__db_realloc$/realloc/ +s/^__db_seek$/lseek/ +s/^__db_strdup$/strdup/ +s/^__db_unmap$/munmap/ +/^__db_yield$/d +s/^__os_close/close/ +s/^__os_fsync/fsync/ +s/^__os_open/open/ +s/^__os_read/read/ +s/^__os_unlink/unlink/ +s/^__os_write/write/ diff --git a/mozilla/db/dist/man.error/delete.sed b/mozilla/db/dist/man.error/delete.sed new file mode 100644 index 00000000000..8f13f59ef0d --- /dev/null +++ b/mozilla/db/dist/man.error/delete.sed @@ -0,0 +1,17 @@ +# @(#)delete.sed 8.5 (Sleepycat) 9/17/97 +# +#Delete strings that we know aren't functions. + +# Empty lines, whitespace. +/^$/d +/^[ ]*$/d + +# Function prototypes. +/^__P$/d + +# C language keywords. +/^defined$/d +/^return$/d +/^sizeof$/d +/^va_end$/d +/^va_start$/d diff --git a/mozilla/db/dist/man.error/func.sed b/mozilla/db/dist/man.error/func.sed new file mode 100644 index 00000000000..5ea46a79884 --- /dev/null +++ b/mozilla/db/dist/man.error/func.sed @@ -0,0 +1,29 @@ +# @(#)func.sed 10.2 (Sleepycat) 9/17/97 + +# Delete anything that looks like a comment. (We get screwed by comments +# that list calls to functions that aren't used by the current function.) +/^ \* /d +/^[ ][ ]*\* /d +/^[ ][ ]*\/\* /d + +# Surround all function call strings in the source code with ^A^BXXX^B^A, +# and bracket each function from which they're called with ^A^B@START^B^A +# and ^A^B@STOP^B^A. +# +# The ^A characters are used to ensure that we have can tokenize the +# strings and each function call will be distinct. +# +# The ^B characters are used to identify the strings we want. +# +# The @ characters are used to ensure that we don't delete START and STOP +# because they look like macro names. +# +# The sed expression is repeated because using a global flag doesn't get +# embedded calls correct. +s/\([A-Za-z_][->A-Za-z_0-9]*\)\(([^0123456789]\)/\1\2/ +s/\([A-Za-z_][->A-Za-z_0-9]*\)\(([^0123456789]\)/\1\2/ +s/\([A-Za-z_][->A-Za-z_0-9]*\)\(([^0123456789]\)/\1\2/ +s/\([A-Za-z_][->A-Za-z_0-9]*\)\(([^0123456789]\)/\1\2/ +s/\([A-Za-z_][->A-Za-z_0-9]*\)\(([^0123456789]\)/\1\2/g +s/^{/@START/ +s/^}/@STOP/ diff --git a/mozilla/db/dist/man.error/pub.awk b/mozilla/db/dist/man.error/pub.awk new file mode 100644 index 00000000000..41bd0f4c287 --- /dev/null +++ b/mozilla/db/dist/man.error/pub.awk @@ -0,0 +1,3 @@ +/^[a-z]/,/!STOP/ { + print $0 +} diff --git a/mozilla/db/dist/man.error/run b/mozilla/db/dist/man.error/run new file mode 100644 index 00000000000..0ef11d2e7cc --- /dev/null +++ b/mozilla/db/dist/man.error/run @@ -0,0 +1,204 @@ +# @(#)run 8.14 (Sleepycat) 11/6/97 + +# run -- +# A mother of a shell script. It creates lists of functions which +# can cause the public functions to fail. It depends on the code +# using a Kernel Normal Form (KNF) coding style, but it shouldn't +# be horrible to adapt to other styles. + +s=../../ +TF="_1 _2 _3 _4 _5 _6 _7 _8 _9 _10 OK awk.out diff.out r_sub.1 r_sub.2" + +trap "rm -f $TF INPUT; exit 1" 1 2 3 13 15 + +rm -f $TF INPUT + +# Clean out the error file directory -- it must exist. +edir=../../man/man.error +[ ! -d $edir ] && { + echo "$edir: no such directory." + exit 1 +} +rm -f $edir/* + +# Clean out the debug directory if it exists. +dd=./dd +[ -d $dd ] && rm -f $dd/* + +# Find all the function calls. +echo "find the function calls..." +>_1 +for i in btree common db dbm hash hsearch lock log mp mutex os txn; do + cat $s/$i/*.c | sed -f func.sed >> _1 +done + +# Tokenize, converting all whitespace and ^A characters into single +# characters. +echo "tokenize..." +cat _1 | tr '[:space:]' '\n' | tr -s '\001' '\n' > _2 +[ -d $dd ] && mv _1 $dd || rm -f _1 + +# Pull out all the tokens that interest us, i.e. the ones that have a ^B, +# and then delete that character. +echo "extract function names/calls..." +cat _2 | egrep '' | tr -d '\002' > _3 +[ -d $dd ] && mv _2 $dd || rm -f _2 + +# Delete the strings that we know can't be function calls in any package. +# This has to happen before the next step so that we know that function +# calls immediately precede their respective @START lines. +echo "delete impossible function names/calls..." +cat _3 | sed -f delete.sed > _4 +[ -d $dd ] && mv _3 $dd || rm -f _3 + +# It's easy to end up with STOP lines that don't have matching START lines, +# as it's not uncommon to find closing } characters on lines by themselves. +# Delete anything between a STOP and the line before the next START. +echo "delete singleton STOP lines..." +cat _4 | awk -f stop.awk > _5 +[ -d $dd ] && mv _4 $dd || rm -f _4 + +# Make adjustments for special DB names. +echo "apply special DB corrections..." +cat _5 | sed -f db.sed > _6 +[ -d $dd ] && mv _5 $dd || rm -f _5 + +# Indent the function calls inside of the function names, and delete the +# leading @ characters. +echo "indent function call lines..." +cat _6 | sed '/@START/,/@STOP/s/^/ !/' | tr -d '@' > _7 +[ -d $dd ] && mv _6 $dd || rm -f _6 + +# Eliminate duplicate calls inside of each function. +echo "eliminate duplicate function calls..." +cat _7 | awk -f clean.awk > INPUT +[ -d $dd ] && mv _7 $dd || rm -f _7 + +# Build a set of sed commands that will do substitution on the names. +echo "build sed commands for substitution..." +cat INPUT | sed -n -f sub.sed | tr '' '\012' > r_sub.1 + +# Put a list of the public names into _8. +echo "extract public names..." +awk -f pub.awk < INPUT > _8 +[ -d $dd ] && mv INPUT $dd + +# Loop, substituting names until there are no more names to substitute. +# +# We can get into a place where we're just shuffling stuff and not making +# any forward progress -- you'll see the reference count climb and then +# drop, and eventually it's staying about the same over several iterations. +# That's what OK is for. Create the OK file and we break out of the loop +# and continue on. +echo "loop, substituting inside public names..." +echo "create file named \"OK\" to terminate loop." +cnt=0 +while (true); do + cnt=`expr $cnt + 1` + printf "run #%02d... " $cnt + + # Do a substitution pass, and then sort the names, eliminating + # any duplicates. + sed -f r_sub.1 < _8 | sed '/^$/d' | awk -f clean.awk > _9 + + # If you want to see what changed. + # diff _8 _9 > diff.out + + # Print out a progress report. + a=`egrep __ _8 | wc -l` + b=`egrep __ _9 | wc -l` + printf "unexpanded calls: orig: %d new: %d\n" $a $b + + # If no substitution was done, then we're finished. This never + # happens, at least in DB, because we have places where A calls + # B and B calls A, so we end up simply swapping call expansions + # forever. Once the reference counts aren't getting any further, + # create the file "OK" and the script will proceed. + if cmp _8 _9 > /dev/null; then + break; + fi + mv _9 _8 + if [ -f OK ]; then + break; + fi +done +rm -f OK + +# Check for stuff we missed... +#echo "Functions that were never resolved:" +#egrep __ _8 + +# At this point, we're simply swapping calls between routines that call each +# other and we're not making any forward progress. Strip out all of the DB +# internal routines from the replacement process and do a final replacement +# to finish up. +echo "final substitution pass for co-routines..." +sed -e '/^ /s/__.*\(.\)$/DISCARD\1/' < r_sub.1 > r_sub.2 +sed -f r_sub.2 < _8 | sed -e '/DISCARD/d' -e '/^$/d' > _9 +[ -d $dd ] && mv _8 $dd || rm -f _8 +[ -d $dd ] && mv r_sub.1 $dd || rm -f r_sub.1 +[ -d $dd ] && mv r_sub.2 $dd || rm -f r_sub.2 + +# Convert all of the entries into man page references. +echo "convert to man page references..." +sed -f conv.sed < _9 > _10 +[ -d $dd ] && mv _9 $dd || rm -f _9 + +# Put each function's information into a separate file, which we include +# from the actual man page. +echo "create error return files..." +cat _10 | while read one rest; do + if [ "$one" = "FUNCTION" ]; then + file=`echo "$rest" | sed 's/.*->//'` + else + echo "$one $rest" >> "$edir/$file" + fi +done +[ -d $dd ] && mv _10 $dd || rm -f _10 + +# We translated all the special function names into xxxDB, convert them +# back to the correct name here. +echo "clean up DB names in error files..." +for i in $edir/*; do + sed -e 's/xxxDB/DB/g' < $i > _1 + mv _1 $i +done +rm -f _1 + +# Create the C++ version of the file. +echo "create c++ error files..." +for i in $edir/*; do + sed -f cxx.sed < $i > $i.cxx +done + +# Sort the names in each file, eliminating duplicates. +echo "sort and discard duplicates..." +for i in $edir/*; do + sort -u < $i > _1 + mv _1 $i +done +rm -f _1 + +# Replace the last comma with a period. If it's more than a single entry, +# add an "and" before the last line. +echo "final cleanup of error files..." +for i in $edir/*; do + cnt=`wc -l $i | awk '{print $1}'` + if [ $cnt -gt 1 ] ; then + sed -e '1i\' -e '.na\' -e '.Nh' -e '$s/,/./' \ + -e '$i\' -e 'and' -e '$a\' -e '.Hy\' -e '.ad' < $i > _1 + else + sed -e '1i\' -e '.na\' -e '.Nh' -e '$s/,/./' \ + -e '$a\' -e '.Hy\' -e '.ad' < $i > _1 + fi + mv _1 $i +done +rm -f _1 + +# Set the permissions. +chmod 444 $edir/* + +# Cleanup. +rm -f $TF INPUT + +exit 0 diff --git a/mozilla/db/dist/man.error/stop.awk b/mozilla/db/dist/man.error/stop.awk new file mode 100644 index 00000000000..3f8379bffa7 --- /dev/null +++ b/mozilla/db/dist/man.error/stop.awk @@ -0,0 +1,23 @@ +BEGIN { + out = 0 + saved = "" +} +/@START/{ + print saved + print $0 + out = 1 + next +} +/@STOP/{ + if (out == 1) { + print $0 + out = 0 + } + next +} +{ + if (out == 1) + print $0 + else + saved = $0 +} diff --git a/mozilla/db/dist/man.error/sub.sed b/mozilla/db/dist/man.error/sub.sed new file mode 100644 index 00000000000..a030e984377 --- /dev/null +++ b/mozilla/db/dist/man.error/sub.sed @@ -0,0 +1,20 @@ +# @(#)sub 8.3 (Sleepycat) 3/22/97 +# Build of set of sed commands to do substitution on the names. + +H +/ !STOP/{ + x + /^_/{ + y/\n/ / + s; *; ;g + s; $;; + s; !START;$/; + s; !STOP;/; + s; !;\\ !;g + s;^;s/ !; + p + } + n + h +} +d diff --git a/mozilla/db/dist/tags b/mozilla/db/dist/tags new file mode 100644 index 00000000000..205fe74f748 --- /dev/null +++ b/mozilla/db/dist/tags @@ -0,0 +1,1527 @@ +ALIGN ../include/db_int.h.src /^#define ALIGN(value, bound) (((value) + (bound) - / +ALIGNP ../include/db_int.h.src /^#define ALIGNP(value, bound) ALIGN((ALIGNTYPE)valu/ +ALIGNTYPE ../include/db_int.h.src /^#define ALIGNTYPE u_long$/ +ALLOCPGNO ../include/hash.h /^#define ALLOCPGNO 0x60$/ +ARGS_USAGE ../test/utils.c /^#define ARGS_USAGE "args"$/ +BADARG ../clib/getopt.c /^#define BADARG (int)':'$/ +BADCH ../clib/getopt.c /^#define BADCH (int)'?'$/ +BAD_KILLID ../lock/lock_deadlock.c /^#define BAD_KILLID 0xffffffff$/ +BFMSG ../db185/db185.c /^#define BFMSG "DB: DB 1.85's recno bfname field is/ +BH_CALLPGIN ../include/mp.h /^#define BH_CALLPGIN 0x001 \/* Page needs to be re/ +BH_DIRTY ../include/mp.h /^#define BH_DIRTY 0x002 \/* Page was modified. *\// +BH_DISCARD ../include/mp.h /^#define BH_DISCARD 0x004 \/* Page is useless. *\// +BH_LOCKED ../include/mp.h /^#define BH_LOCKED 0x008 \/* Page is locked (I\/O / +BH_TRASH ../include/mp.h /^#define BH_TRASH 0x010 \/* Page is garbage. *\/$/ +BH_WRITE ../include/mp.h /^#define BH_WRITE 0x020 \/* Page scheduled for wri/ +BINTERNAL_PSIZE ../include/db_page.h /^#define BINTERNAL_PSIZE(len) \\$/ +BINTERNAL_SIZE ../include/db_page.h /^#define BINTERNAL_SIZE(len) \\$/ +BI_DELETED ../include/btree.h /^#define BI_DELETED 0x01 \/* Key\/data pair only p/ +BI_DOINCR ../include/btree.h /^#define BI_DOINCR 0x02 \/* Increment the record c/ +BI_NEWKEY ../include/btree.h /^#define BI_NEWKEY 0x04 \/* New key. *\/$/ +BKEYDATA_PSIZE ../include/db_page.h /^#define BKEYDATA_PSIZE(len) \\$/ +BKEYDATA_SIZE ../include/db_page.h /^#define BKEYDATA_SIZE(len) \\$/ +BOVERFLOW_PSIZE ../include/db_page.h /^#define BOVERFLOW_PSIZE \\$/ +BOVERFLOW_SIZE ../include/db_page.h /^#define BOVERFLOW_SIZE \\$/ +BTM_DUP ../include/db_page.h /^#define BTM_DUP 0x001 \/* Duplicates. *\/$/ +BTM_FIXEDLEN ../include/db_page.h /^#define BTM_FIXEDLEN 0x008 \/* Recno: fixed leng/ +BTM_MASK ../include/db_page.h /^#define BTM_MASK 0x01f$/ +BTM_RECNO ../include/db_page.h /^#define BTM_RECNO 0x002 \/* Recno tree. *\/$/ +BTM_RECNUM ../include/db_page.h /^#define BTM_RECNUM 0x004 \/* Btree: maintain rec/ +BTM_RENUMBER ../include/db_page.h /^#define BTM_RENUMBER 0x010 \/* Recno: renumber o/ +BTREEMAGIC ../include/db_185.h.src /^#define BTREEMAGIC 0x053162$/ +BTREEVERSION ../include/db_185.h.src /^#define BTREEVERSION 3$/ +BT_STK_CLR ../include/btree.h /^#define BT_STK_CLR(t) \\$/ +BT_STK_ENTER ../include/btree.h /^#define BT_STK_ENTER(t, pagep, page_indx, lock, re/ +BT_STK_POP ../include/btree.h /^#define BT_STK_POP(t) \\$/ +BT_STK_PUSH ../include/btree.h /^#define BT_STK_PUSH(t, pagep, page_indx, lock, ret/ +BUCKET ../include/mp.h /^#define BUCKET(mp, mf_offset, pgno) \\$/ +BUCKET_INVALID ../include/hash.h /^#define BUCKET_INVALID 0xFFFFFFFF$/ +BUCKET_TO_PAGE ../include/hash.h /^#define BUCKET_TO_PAGE(H, B) \\$/ +B_DCLR ../include/db_page.h /^#define B_DCLR(t) (t) &= ~B_DELETE$/ +B_DELETE ../include/db_page.h /^#define B_DELETE (0x80)$/ +B_DISSET ../include/db_page.h /^#define B_DISSET(t) ((t) & B_DELETE)$/ +B_DSET ../include/db_page.h /^#define B_DSET(t) (t) |= B_DELETE$/ +B_DUPLICATE ../include/db_page.h /^#define B_DUPLICATE 2 \/* Duplicate key\/data item/ +B_KEYDATA ../include/db_page.h /^#define B_KEYDATA 1 \/* Key\/data item. *\/$/ +B_OVERFLOW ../include/db_page.h /^#define B_OVERFLOW 3 \/* Overflow key\/data item. / +B_TSET ../include/db_page.h /^#define B_TSET(t, type, deleted) { \\$/ +B_TYPE ../include/db_page.h /^#define B_TYPE(t) ((t) & ~B_DELETE)$/ +CD_CLR ../btree/bt_recno.c /^#define CD_CLR(dbp, cp) { \\$/ +CD_ISSET ../btree/bt_recno.c /^#define CD_ISSET(dbp, cp) \\$/ +CD_SET ../btree/bt_recno.c /^#define CD_SET(dbp, cp) { \\$/ +CHARKEY ../include/hash.h /^#define CHARKEY "%$sniglet^&"$/ +CIRCLEQ_END ../include/queue.h /^#define CIRCLEQ_END(head) ((void *)(head))$/ +CIRCLEQ_ENTRY ../include/queue.h /^#define CIRCLEQ_ENTRY(type) \\$/ +CIRCLEQ_FIRST ../include/queue.h /^#define CIRCLEQ_FIRST(head) ((head)->cqh_first)$/ +CIRCLEQ_HEAD ../include/queue.h /^#define CIRCLEQ_HEAD(name, type) \\$/ +CIRCLEQ_INIT ../include/queue.h /^#define CIRCLEQ_INIT(head) do { \\$/ +CIRCLEQ_INSERT_AFTER ../include/queue.h /^#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, f/ +CIRCLEQ_INSERT_BEFORE ../include/queue.h /^#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, / +CIRCLEQ_INSERT_HEAD ../include/queue.h /^#define CIRCLEQ_INSERT_HEAD(head, elm, field) do {/ +CIRCLEQ_INSERT_TAIL ../include/queue.h /^#define CIRCLEQ_INSERT_TAIL(head, elm, field) do {/ +CIRCLEQ_LAST ../include/queue.h /^#define CIRCLEQ_LAST(head) ((head)->cqh_last)$/ +CIRCLEQ_NEXT ../include/queue.h /^#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe/ +CIRCLEQ_PREV ../include/queue.h /^#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe/ +CIRCLEQ_REMOVE ../include/queue.h /^#define CIRCLEQ_REMOVE(head, elm, field) do { / +CLEAR_MAP ../lock/lock_deadlock.c /^#define CLEAR_MAP(M, N) { \\$/ +CLR_MAP ../lock/lock_deadlock.c /^#define CLR_MAP(M, B) (M[(B) \/ 32] &= ~(1 << ((B)/ +COMPQUIET ../include/db_int.h.src /^#define COMPQUIET(n, v) (n) = (v)$/ +CONFIG_NAME ../common/db_appinit.c /^#define CONFIG_NAME "\/DB_CONFIG"$/ +CONFLICTS ../include/lock.h /^#define CONFLICTS(T, HELD, WANTED) \\$/ +CR_DELETED ../include/btree.h /^#define CR_DELETED 0x0001 \/* Record deleted. *\// +CURSOR_SETUP ../include/btree.h /^#define CURSOR_SETUP(dbp) { \\$/ +CURSOR_TEARDOWN ../include/btree.h /^#define CURSOR_TEARDOWN(dbp) \\$/ +C_DELETED ../include/btree.h /^#define C_DELETED 0x0001$/ +C_INTERNAL ../include/btree.h /^#define C_INTERNAL 0x0008$/ +C_REPLACE ../include/btree.h /^#define C_REPLACE 0x0002$/ +C_REPLACE_SETUP ../include/btree.h /^#define C_REPLACE_SETUP 0x0004$/ +DATA_INIT_CNT ../common/db_appinit.c /^#define DATA_INIT_CNT 20 \/* Start with 20 data / +DBCCLOSE_USAGE ../test/utils.c /^#define DBCCLOSE_USAGE "dbN.cursorM close"$/ +DBCDEL_USAGE ../test/utils.c /^#define DBCDEL_USAGE "cursorN del flags"$/ +DBCGETBIN_USAGE ../test/utils.c /^#define DBCGETBIN_USAGE "cursorN getbin file key f/ +DBCGET_USAGE ../test/utils.c /^#define DBCGET_USAGE "cursorN get key flags [beg l/ +DBCLOSE_USAGE ../test/utils.c /^#define DBCLOSE_USAGE "dbN close"$/ +DBCPUT_USAGE ../test/utils.c /^#define DBCPUT_USAGE "cursorN put key data flags"$/ +DBCURSOR_USAGE ../test/utils.c /^#define DBCURSOR_USAGE "dbN.cursorM ?arg arg ...?"/ +DBCURS_USAGE ../test/utils.c /^#define DBCURS_USAGE "dbN cursor txn"$/ +DBDEL_USAGE ../test/utils.c /^#define DBDEL_USAGE "dbN del txn key flags"$/ +DBENV_USAGE ../test/utils.c /^#define DBENV_USAGE "dbenv "$/ +DBFD_USAGE ../test/utils.c /^#define DBFD_USAGE "dbN fd"$/ +DBGETBIN_USAGE ../test/utils.c /^#define DBGETBIN_USAGE "dbN getbin path txn key fl/ +DBGET_USAGE ../test/utils.c /^#define DBGET_USAGE "dbN get txn key flags [beg le/ +DBINFO_FCHK ../db/db.c /^#define DBINFO_FCHK(dbp, fn, meta_flags, m_name, d/ +DBLOCKER_USAGE ../test/utils.c /^#define DBLOCKER_USAGE "dbN locker"$/ +DBMDEL_USAGE ../test/tcl_dbm.c /^#define DBMDEL_USAGE "delete key"$/ +DBMFETCH_USAGE ../test/tcl_dbm.c /^#define DBMFETCH_USAGE "fetch key"$/ +DBMFIRST_USAGE ../test/tcl_dbm.c /^#define DBMFIRST_USAGE "firstkey"$/ +DBMINIT_USAGE ../test/tcl_dbm.c /^#define DBMINIT_USAGE "dbminit file"$/ +DBMNEXT_USAGE ../test/tcl_dbm.c /^#define DBMNEXT_USAGE "nextkey key"$/ +DBMSTORE_USAGE ../test/tcl_dbm.c /^#define DBMSTORE_USAGE "store key data"$/ +DBM_INSERT ../include/db.h.src /^#define DBM_INSERT 0 \/* Flags to dbm_store(). */ +DBM_REPLACE ../include/db.h.src /^#define DBM_REPLACE 1$/ +DBM_SUFFIX ../include/db.h.src /^#define DBM_SUFFIX ".db"$/ +DBOPEN_USAGE ../test/utils.c /^#define DBOPEN_USAGE "dbopen file flags mode type / +DBPPUT_USAGE ../test/utils.c /^#define DBPPUT_USAGE "dbN put txn key data flags d/ +DBPUTBIN_USAGE ../test/utils.c /^#define DBPUTBIN_USAGE "dbN put txn key data flags/ +DBPUT_USAGE ../test/utils.c /^#define DBPUT_USAGE "dbN put txn key data flags"$/ +DBSYNC_USAGE ../test/utils.c /^#define DBSYNC_USAGE "dbN sync flags"$/ +DBWIDGET_USAGE ../test/utils.c /^#define DBWIDGET_USAGE "dbN option ?arg arg ...?"$/ +DB_ADDSTR ../common/db_appinit.c /^#define DB_ADDSTR(str) { \\$/ +DB_ADD_BIG ../include/db_am.h /^#define DB_ADD_BIG 0x30$/ +DB_ADD_DUP ../include/db_am.h /^#define DB_ADD_DUP 0x10$/ +DB_AFTER ../include/db.h.src /^#define DB_AFTER 0x000001 \/* c_put() *\/$/ +DB_AM_DUP ../include/db.h.src /^#define DB_AM_DUP 0x000001 \/* DB_DUP (internal). / +DB_AM_INMEM ../include/db.h.src /^#define DB_AM_INMEM 0x000002 \/* In-memory; no syn/ +DB_AM_LOCKING ../include/db.h.src /^#define DB_AM_LOCKING 0x000004 \/* Perform locking/ +DB_AM_LOGGING ../include/db.h.src /^#define DB_AM_LOGGING 0x000008 \/* Perform logging/ +DB_AM_MLOCAL ../include/db.h.src /^#define DB_AM_MLOCAL 0x000010 \/* Database memory / +DB_AM_PGDEF ../include/db.h.src /^#define DB_AM_PGDEF 0x000020 \/* Page size was def/ +DB_AM_RDONLY ../include/db.h.src /^#define DB_AM_RDONLY 0x000040 \/* Database is read/ +DB_AM_RECOVER ../include/db.h.src /^#define DB_AM_RECOVER 0x000080 \/* In recovery (do/ +DB_AM_SWAP ../include/db.h.src /^#define DB_AM_SWAP 0x000100 \/* Pages need to be b/ +DB_AM_THREAD ../include/db.h.src /^#define DB_AM_THREAD 0x000200 \/* DB is multi-thre/ +DB_APPEND ../include/db.h.src /^#define DB_APPEND 0x000002 \/* put() *\/$/ +DB_ARCH_ABS ../include/db.h.src /^#define DB_ARCH_ABS 0x001 \/* Absolute pathnames./ +DB_ARCH_DATA ../include/db.h.src /^#define DB_ARCH_DATA 0x002 \/* Data files. *\/$/ +DB_ARCH_LOG ../include/db.h.src /^#define DB_ARCH_LOG 0x004 \/* Log files. *\/$/ +DB_BEFORE ../include/db.h.src /^#define DB_BEFORE 0x000004 \/* c_put() *\/$/ +DB_BTREEMAGIC ../include/db.h.src /^#define DB_BTREEMAGIC 0x053162$/ +DB_BTREEOLDVER ../include/db.h.src /^#define DB_BTREEOLDVER 6 \/* Oldest btree version/ +DB_BTREEVERSION ../include/db.h.src /^#define DB_BTREEVERSION 6 \/* Current btree versi/ +DB_BT_RECNUM ../include/db.h.src /^#define DB_BT_RECNUM 0x000400 \/* DB_RECNUM (inter/ +DB_CACHESIZE_DEF ../include/mp.h /^#define DB_CACHESIZE_DEF (128 * 1024)$/ +DB_CACHESIZE_MIN ../include/mp.h /^#define DB_CACHESIZE_MIN ( 20 * 1024)$/ +DB_CALLBACK ../include/db_int.h.src /^#define DB_CALLBACK \/* Nothing. *\/$/ +DB_CHECKPOINT ../include/db.h.src /^#define DB_CHECKPOINT 0x000008 \/* log_put(), log_/ +DB_CHECK_FCOMBO ../common/db_err.c /^#define DB_CHECK_FCOMBO(dbenv, name, flags, flag1,/ +DB_CHECK_FLAGS ../common/db_err.c /^#define DB_CHECK_FLAGS(dbenv, name, flags, ok_flag/ +DB_CREATE ../include/db.h.src /^#define DB_CREATE 0x000001 \/* O_CREAT: crea/ +DB_CURLSN ../include/db.h.src /^#define DB_CURLSN 0x080000 \/* log_put() *\/$/ +DB_CURRENT ../include/db.h.src /^#define DB_CURRENT 0x000010 \/* c_get(), c_put(), / +DB_DBM_HSEARCH ../include/db.h.src /^#define DB_DBM_HSEARCH 0 \/* No historic interfac/ +DB_DBT_INTERNAL ../include/db.h.src /^#define DB_DBT_INTERNAL 0x01 \/* Perform any mall/ +DB_DBT_MALLOC ../include/db.h.src /^#define DB_DBT_MALLOC 0x02 \/* Return in allocate/ +DB_DBT_PARTIAL ../include/db.h.src /^#define DB_DBT_PARTIAL 0x04 \/* Partial put\/get./ +DB_DBT_USERMEM ../include/db.h.src /^#define DB_DBT_USERMEM 0x08 \/* Return in user's / +DB_DEFAULT_LOCK_FILE ../include/lock.h /^#define DB_DEFAULT_LOCK_FILE "__db_lock.share"$/ +DB_DEFAULT_LOG_FILE ../include/log.h /^#define DB_DEFAULT_LOG_FILE "__db_log.share"$/ +DB_DEFAULT_MPOOL_FILE ../include/mp.h /^#define DB_DEFAULT_MPOOL_FILE "__db_mpool.share"$/ +DB_DEF_IOSIZE ../include/db_int.h.src /^#define DB_DEF_IOSIZE (8 * 1024)$/ +DB_DELETED ../include/db.h.src /^#define DB_DELETED ( -8) \/* Recovery file marked/ +DB_DELIMITER ../include/db.h.src /^#define DB_DELIMITER 0x0001 \/* Recno: re_delim s/ +DB_DUP ../include/db.h.src /^#define DB_DUP 0x0002 \/* Btree, Hash: duplicate/ +DB_ENV_APPINIT ../include/db.h.src /^#define DB_ENV_APPINIT 0x01 \/* Paths initialized/ +DB_ENV_FLAGS ../test/dbtest.h /^#define DB_ENV_FLAGS \\$/ +DB_ENV_STANDALONE ../include/db.h.src /^#define DB_ENV_STANDALONE 0x02 \/* Test: freestand/ +DB_ENV_THREAD ../include/db.h.src /^#define DB_ENV_THREAD 0x04 \/* DB_ENV is multi-th/ +DB_EXCL ../include/db.h.src /^#define DB_EXCL 0x008000 \/* O_EXCL: exclus/ +DB_FILE_ID_LEN ../include/db.h.src /^#define DB_FILE_ID_LEN 20 \/* DB file ID length. / +DB_FIRST ../include/db.h.src /^#define DB_FIRST 0x000020 \/* c_get(), log_get() */ +DB_FIXEDLEN ../include/db.h.src /^#define DB_FIXEDLEN 0x0004 \/* Recno: fixed-lengt/ +DB_FLUSH ../include/db.h.src /^#define DB_FLUSH 0x000040 \/* log_put() *\/$/ +DB_FTYPE_BTREE ../include/db_int.h.src /^#define DB_FTYPE_BTREE -1 \/* Btree. *\/$/ +DB_FTYPE_HASH ../include/db_int.h.src /^#define DB_FTYPE_HASH -2 \/* Hash. *\/$/ +DB_FUNC_CALLOC ../include/db.h.src /^#define DB_FUNC_CALLOC 1 \/* DELETED: ANSI C call/ +DB_FUNC_CLOSE ../include/db.h.src /^#define DB_FUNC_CLOSE 2 \/* POSIX 1003.1 close. / +DB_FUNC_DIRFREE ../include/db.h.src /^#define DB_FUNC_DIRFREE 3 \/* DB: free directory/ +DB_FUNC_DIRLIST ../include/db.h.src /^#define DB_FUNC_DIRLIST 4 \/* DB: create directo/ +DB_FUNC_EXISTS ../include/db.h.src /^#define DB_FUNC_EXISTS 5 \/* DB: return if file / +DB_FUNC_FREE ../include/db.h.src /^#define DB_FUNC_FREE 6 \/* ANSI C free. *\/$/ +DB_FUNC_FSYNC ../include/db.h.src /^#define DB_FUNC_FSYNC 7 \/* POSIX 1003.1 fsync. / +DB_FUNC_IOINFO ../include/db.h.src /^#define DB_FUNC_IOINFO 8 \/* DB: return file I\// +DB_FUNC_MALLOC ../include/db.h.src /^#define DB_FUNC_MALLOC 9 \/* ANSI C malloc. *\/$/ +DB_FUNC_MAP ../include/db.h.src /^#define DB_FUNC_MAP 10 \/* DB: map file into shar/ +DB_FUNC_OPEN ../include/db.h.src /^#define DB_FUNC_OPEN 11 \/* POSIX 1003.1 open. */ +DB_FUNC_READ ../include/db.h.src /^#define DB_FUNC_READ 12 \/* POSIX 1003.1 read. */ +DB_FUNC_REALLOC ../include/db.h.src /^#define DB_FUNC_REALLOC 13 \/* ANSI C realloc. */ +DB_FUNC_RUNLINK ../include/db.h.src /^#define DB_FUNC_RUNLINK 22 \/* DB: remove a share/ +DB_FUNC_SEEK ../include/db.h.src /^#define DB_FUNC_SEEK 14 \/* POSIX 1003.1 lseek. */ +DB_FUNC_SLEEP ../include/db.h.src /^#define DB_FUNC_SLEEP 15 \/* DB: sleep secs\/usec/ +DB_FUNC_STRDUP ../include/db.h.src /^#define DB_FUNC_STRDUP 16 \/* DELETED: DB: strdup(/ +DB_FUNC_UNLINK ../include/db.h.src /^#define DB_FUNC_UNLINK 17 \/* POSIX 1003.1 unlink/ +DB_FUNC_UNMAP ../include/db.h.src /^#define DB_FUNC_UNMAP 18 \/* DB: unmap shared mem/ +DB_FUNC_WRITE ../include/db.h.src /^#define DB_FUNC_WRITE 19 \/* POSIX 1003.1 write. / +DB_FUNC_YIELD ../include/db.h.src /^#define DB_FUNC_YIELD 20 \/* DB: yield thread to / +DB_GET_RECNO ../include/db.h.src /^#define DB_GET_RECNO 0x000080 \/* get(), c_get() */ +DB_GLOBAL ../include/db_int.h.src /^#define DB_GLOBAL(v) __db_global_values.v$/ +DB_GROW_SIZE ../include/log.h /^#define DB_GROW_SIZE 64$/ +DB_HASHMAGIC ../include/db.h.src /^#define DB_HASHMAGIC 0x061561$/ +DB_HASHOLDVER ../include/db.h.src /^#define DB_HASHOLDVER 4 \/* Oldest hash version s/ +DB_HASHVERSION ../include/db.h.src /^#define DB_HASHVERSION 5 \/* Current hash version/ +DB_HASH_DUP ../include/db_page.h /^#define DB_HASH_DUP 0x01$/ +DB_HS_DIRTYMETA ../include/db.h.src /^#define DB_HS_DIRTYMETA 0x000800 \/* Hash: Metadat/ +DB_INCOMPLETE ../include/db.h.src /^#define DB_INCOMPLETE ( -1) \/* Sync didn't finis/ +DB_INFO_FLAGS ../db/db.c /^#define DB_INFO_FLAGS \\$/ +DB_INIT_LOCK ../include/db.h.src /^#define DB_INIT_LOCK 0x000008 \/* Initialize/ +DB_INIT_LOG ../include/db.h.src /^#define DB_INIT_LOG 0x000010 \/* Initialize / +DB_INIT_MPOOL ../include/db.h.src /^#define DB_INIT_MPOOL 0x000020 \/* Initializ/ +DB_INIT_TXN ../include/db.h.src /^#define DB_INIT_TXN 0x000040 \/* Initialize / +DB_ISBIG ../include/db_am.h /^#define DB_ISBIG 0x01$/ +DB_KEYEMPTY ../include/db.h.src /^#define DB_KEYEMPTY ( -2) \/* The key\/data pair / +DB_KEYEXIST ../include/db.h.src /^#define DB_KEYEXIST ( -3) \/* The key\/data pair / +DB_KEYFIRST ../include/db.h.src /^#define DB_KEYFIRST 0x000100 \/* c_put() *\/$/ +DB_KEYLAST ../include/db.h.src /^#define DB_KEYLAST 0x000200 \/* c_put() *\/$/ +DB_LAST ../include/db.h.src /^#define DB_LAST 0x000400 \/* c_get(), log_get() */ +DB_LINE ../include/db_int.h.src /^#define DB_LINE "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=/ +DB_LOCKMAGIC ../include/db.h.src /^#define DB_LOCKMAGIC 0x090193$/ +DB_LOCKVERSION ../include/db.h.src /^#define DB_LOCKVERSION 1$/ +DB_LOCK_CONFLICT ../include/db.h.src /^#define DB_LOCK_CONFLICT 0x01 \/* Run on any confl/ +DB_LOCK_DEADLOCK ../include/db.h.src /^#define DB_LOCK_DEADLOCK ( -4) \/* Locker killed t/ +DB_LOCK_DEFAULT ../include/db.h.src /^#define DB_LOCK_DEFAULT 0x1 \/* Default policy. */ +DB_LOCK_DEFAULT_N ../include/lock.h /^#define DB_LOCK_DEFAULT_N 5000 \/* Default # of lo/ +DB_LOCK_LOCKER ../include/lock.h /^#define DB_LOCK_LOCKER 2$/ +DB_LOCK_MAXID ../include/lock.h /^#define DB_LOCK_MAXID 0x7fffffff$/ +DB_LOCK_NORUN ../include/db.h.src /^#define DB_LOCK_NORUN 0x0$/ +DB_LOCK_NOTGRANTED ../include/db.h.src /^#define DB_LOCK_NOTGRANTED ( -5) \/* Lock unavaila/ +DB_LOCK_NOTHELD ../include/db.h.src /^#define DB_LOCK_NOTHELD ( -6) \/* Lock not held b/ +DB_LOCK_NOWAIT ../include/db.h.src /^#define DB_LOCK_NOWAIT 0x01 \/* Don't wait on una/ +DB_LOCK_OBJTYPE ../include/lock.h /^#define DB_LOCK_OBJTYPE 1$/ +DB_LOCK_OLDEST ../include/db.h.src /^#define DB_LOCK_OLDEST 0x2 \/* Abort oldest trans/ +DB_LOCK_RANDOM ../include/db.h.src /^#define DB_LOCK_RANDOM 0x3 \/* Abort random trans/ +DB_LOCK_RIW_N ../include/db.h.src /^#define DB_LOCK_RIW_N 6$/ +DB_LOCK_RW_N ../include/db.h.src /^#define DB_LOCK_RW_N 3$/ +DB_LOCK_YOUNGEST ../include/db.h.src /^#define DB_LOCK_YOUNGEST 0x4 \/* Abort youngest tr/ +DB_LOGGING ../include/db_int.h.src /^#define DB_LOGGING(dbp) \\$/ +DB_LOGMAGIC ../include/db.h.src /^#define DB_LOGMAGIC 0x040988$/ +DB_LOGOLDVER ../include/db.h.src /^#define DB_LOGOLDVER 2 \/* Oldest log version sup/ +DB_LOGVERSION ../include/db.h.src /^#define DB_LOGVERSION 2 \/* Current log version. / +DB_MAXMMAPSIZE ../mp/mp_fopen.c /^#define DB_MAXMMAPSIZE (10 * 1024 * 1024) \/* 10 M/ +DB_MAX_PAGES ../include/db.h.src /^#define DB_MAX_PAGES 0xffffffff \/* >= # of pages / +DB_MAX_PGSIZE ../include/db_int.h.src /^#define DB_MAX_PGSIZE 0x010000 \/* Maximum page si/ +DB_MAX_RECORDS ../include/db.h.src /^#define DB_MAX_RECORDS 0xffffffff \/* >= # of reco/ +DB_MINCACHE ../include/db_int.h.src /^#define DB_MINCACHE 10 \/* Minimum cached pages */ +DB_MIN_PGSIZE ../include/db_int.h.src /^#define DB_MIN_PGSIZE 0x000200 \/* Minimum page si/ +DB_MPOOL_CLEAN ../include/db.h.src /^#define DB_MPOOL_CLEAN 0x001 \/* Clear modified b/ +DB_MPOOL_CREATE ../include/db.h.src /^#define DB_MPOOL_CREATE 0x001 \/* Create a page. / +DB_MPOOL_DIRTY ../include/db.h.src /^#define DB_MPOOL_DIRTY 0x002 \/* Page is modified/ +DB_MPOOL_DISCARD ../include/db.h.src /^#define DB_MPOOL_DISCARD 0x004 \/* Don't cache the/ +DB_MPOOL_LAST ../include/db.h.src /^#define DB_MPOOL_LAST 0x002 \/* Return the last p/ +DB_MPOOL_NEW ../include/db.h.src /^#define DB_MPOOL_NEW 0x004 \/* Create a new page./ +DB_MPOOL_PRIVATE ../include/db.h.src /^#define DB_MPOOL_PRIVATE 0x000080 \/* Mpool: / +DB_MUTEXLOCKS ../include/db.h.src /^#define DB_MUTEXLOCKS 26 \/* DB: turn off all mut/ +DB_NEEDSPLIT ../include/db.h.src /^#define DB_NEEDSPLIT ( -9) \/* Page needs to be s/ +DB_NEXT ../include/db.h.src /^#define DB_NEXT 0x000800 \/* c_get(), log_get() */ +DB_NOMMAP ../include/db.h.src /^#define DB_NOMMAP 0x000002 \/* Don't mmap un/ +DB_NOOVERWRITE ../include/db.h.src /^#define DB_NOOVERWRITE 0x001000 \/* put() *\/$/ +DB_NOSYNC ../include/db.h.src /^#define DB_NOSYNC 0x002000 \/* close() *\/$/ +DB_NOTFOUND ../include/db.h.src /^#define DB_NOTFOUND ( -7) \/* Key\/data pair not / +DB_PAD ../include/db.h.src /^#define DB_PAD 0x0008 \/* Recno: re_pad set. *\// +DB_PAGEYIELD ../include/db.h.src /^#define DB_PAGEYIELD 27 \/* DB: yield the CPU on / +DB_PAGE_CLEAR_LEN ../include/db_page.h /^#define DB_PAGE_CLEAR_LEN 32$/ +DB_PREV ../include/db.h.src /^#define DB_PREV 0x004000 \/* c_get(), log_get() */ +DB_RDONLY ../include/db.h.src /^#define DB_RDONLY 0x010000 \/* O_RDONLY: rea/ +DB_RECNUM ../include/db.h.src /^#define DB_RECNUM 0x0010 \/* Btree: record number/ +DB_RECORDCOUNT ../include/db.h.src /^#define DB_RECORDCOUNT 0x008000 \/* stat() *\/$/ +DB_RECOVER ../include/db.h.src /^#define DB_RECOVER 0x000200 \/* Run normal r/ +DB_RECOVER_FATAL ../include/db.h.src /^#define DB_RECOVER_FATAL 0x000400 \/* Run cat/ +DB_REGIONMAGIC ../include/db_int.h.src /^#define DB_REGIONMAGIC 0x120897$/ +DB_REGION_ANON ../include/db.h.src /^#define DB_REGION_ANON 23 \/* DB: anonymous, unna/ +DB_REGION_INIT ../include/db.h.src /^#define DB_REGION_INIT 24 \/* DB: page-fault regi/ +DB_REGION_NAME ../include/db.h.src /^#define DB_REGION_NAME 25 \/* DB: anonymous, name/ +DB_REGISTERED ../include/db.h.src /^#define DB_REGISTERED (-10) \/* Entry was previou/ +DB_REM_BIG ../include/db_am.h /^#define DB_REM_BIG 0x40$/ +DB_REM_DUP ../include/db_am.h /^#define DB_REM_DUP 0x20$/ +DB_RENUMBER ../include/db.h.src /^#define DB_RENUMBER 0x0020 \/* Recno: renumber on/ +DB_RE_DELIMITER ../include/db.h.src /^#define DB_RE_DELIMITER 0x001000 \/* DB_DELIMITER / +DB_RE_FIXEDLEN ../include/db.h.src /^#define DB_RE_FIXEDLEN 0x002000 \/* DB_FIXEDLEN (i/ +DB_RE_PAD ../include/db.h.src /^#define DB_RE_PAD 0x004000 \/* DB_PAD (internal). / +DB_RE_RENUMBER ../include/db.h.src /^#define DB_RE_RENUMBER 0x008000 \/* DB_RENUMBER (i/ +DB_RE_SNAPSHOT ../include/db.h.src /^#define DB_RE_SNAPSHOT 0x010000 \/* DB_SNAPSHOT (i/ +DB_ROUNDOFF ../include/db_int.h.src /^#define DB_ROUNDOFF(i) { \\$/ +DB_SEQUENTIAL ../include/db.h.src /^#define DB_SEQUENTIAL 0x020000 \/* Indicate / +DB_SET ../include/db.h.src /^#define DB_SET 0x010000 \/* c_get(), log_get() */ +DB_SET_RANGE ../include/db.h.src /^#define DB_SET_RANGE 0x020000 \/* c_get() *\/$/ +DB_SET_RECNO ../include/db.h.src /^#define DB_SET_RECNO 0x040000 \/* c_get() *\/$/ +DB_SNAPSHOT ../include/db.h.src /^#define DB_SNAPSHOT 0x0040 \/* Recno: snapshot th/ +DB_SPLITNEW ../include/db_am.h /^#define DB_SPLITNEW 0x60$/ +DB_SPLITOLD ../include/db_am.h /^#define DB_SPLITOLD 0x50$/ +DB_SWAPBYTES ../include/db.h.src /^#define DB_SWAPBYTES (-11) \/* Database needs byt/ +DB_TEMPORARY ../include/db.h.src /^#define DB_TEMPORARY 0x040000 \/* Remove on / +DB_THREAD ../include/db.h.src /^#define DB_THREAD 0x000004 \/* Free-thread D/ +DB_THREAD_LOCK ../include/db_int.h.src /^#define DB_THREAD_LOCK(dbp) \\$/ +DB_THREAD_UNLOCK ../include/db_int.h.src /^#define DB_THREAD_UNLOCK(dbp) \\$/ +DB_TRAIL ../common/db_appinit.c /^#define DB_TRAIL "XXXXXX"$/ +DB_TRUNCATE ../include/db.h.src /^#define DB_TRUNCATE 0x080000 \/* O_TRUNCATE:/ +DB_TSL_SPINS ../include/db.h.src /^#define DB_TSL_SPINS 21 \/* DB: initialize spin c/ +DB_TXNMAGIC ../include/db.h.src /^#define DB_TXNMAGIC 0x041593$/ +DB_TXNVERSION ../include/db.h.src /^#define DB_TXNVERSION 1$/ +DB_TXN_BACKWARD_ROLL ../include/db.h.src /^#define DB_TXN_BACKWARD_ROLL 1 \/* Read the log ba/ +DB_TXN_CKP ../include/db.h.src /^#define DB_TXN_CKP (-12) \/* Encountered ckp reco/ +DB_TXN_FORWARD_ROLL ../include/db.h.src /^#define DB_TXN_FORWARD_ROLL 2 \/* Read the log for/ +DB_TXN_LOCK_2PL ../include/db.h.src /^#define DB_TXN_LOCK_2PL 0x000000 \/* Two-pha/ +DB_TXN_LOCK_MASK ../include/db.h.src /^#define DB_TXN_LOCK_MASK 0x000000 \/* Lock fl/ +DB_TXN_LOCK_OPTIMIST ../include/db.h.src /^#define DB_TXN_LOCK_OPTIMIST 0x000000 \/* Optimis/ +DB_TXN_LOG_MASK ../include/db.h.src /^#define DB_TXN_LOG_MASK 0x000000 \/* Log fla/ +DB_TXN_LOG_REDO ../include/db.h.src /^#define DB_TXN_LOG_REDO 0x000000 \/* Redo-on/ +DB_TXN_LOG_UNDO ../include/db.h.src /^#define DB_TXN_LOG_UNDO 0x000000 \/* Undo-on/ +DB_TXN_LOG_UNDOREDO ../include/db.h.src /^#define DB_TXN_LOG_UNDOREDO 0x000000 \/* Undo\/r/ +DB_TXN_NOSYNC ../include/db.h.src /^#define DB_TXN_NOSYNC 0x000800 \/* Do not sy/ +DB_TXN_OPENFILES ../include/db.h.src /^#define DB_TXN_OPENFILES 3 \/* Read for open files/ +DB_TXN_REDO ../include/db.h.src /^#define DB_TXN_REDO 4 \/* Redo the operation. *\// +DB_TXN_UNDO ../include/db.h.src /^#define DB_TXN_UNDO 5 \/* Undo the operation. *\// +DB_USE_ENVIRON ../include/db.h.src /^#define DB_USE_ENVIRON 0x001000 \/* Use the / +DB_USE_ENVIRON_ROOT ../include/db.h.src /^#define DB_USE_ENVIRON_ROOT 0x002000 \/* Use the/ +DB_VERSION_MAJOR ../include/db.h.src /^#define DB_VERSION_MAJOR 2$/ +DB_VERSION_MINOR ../include/db.h.src /^#define DB_VERSION_MINOR 4$/ +DB_VERSION_PATCH ../include/db.h.src /^#define DB_VERSION_PATCH 14$/ +DB_VERSION_STRING ../include/db.h.src /^#define DB_VERSION_STRING "Sleepycat Software: DB / +DB_VMPAGESIZE ../include/db_int.h.src /^#define DB_VMPAGESIZE (4 * 1024)$/ +DB_bam_BEGIN ../include/db_dispatch.h /^#define DB_bam_BEGIN 50$/ +DB_bam_adj ../include/btree_auto.h /^#define DB_bam_adj (DB_bam_BEGIN + 5)$/ +DB_bam_cadjust ../include/btree_auto.h /^#define DB_bam_cadjust (DB_bam_BEGIN + 6)$/ +DB_bam_cdel ../include/btree_auto.h /^#define DB_bam_cdel (DB_bam_BEGIN + 7)$/ +DB_bam_pg_alloc ../include/btree_auto.h /^#define DB_bam_pg_alloc (DB_bam_BEGIN + 1)$/ +DB_bam_pg_free ../include/btree_auto.h /^#define DB_bam_pg_free (DB_bam_BEGIN + 2)$/ +DB_bam_repl ../include/btree_auto.h /^#define DB_bam_repl (DB_bam_BEGIN + 8)$/ +DB_bam_rsplit ../include/btree_auto.h /^#define DB_bam_rsplit (DB_bam_BEGIN + 4)$/ +DB_bam_split ../include/btree_auto.h /^#define DB_bam_split (DB_bam_BEGIN + 3)$/ +DB_db_BEGIN ../include/db_dispatch.h /^#define DB_db_BEGIN 40$/ +DB_db_addpage ../include/db_auto.h /^#define DB_db_addpage (DB_db_BEGIN + 6)$/ +DB_db_addrem ../include/db_auto.h /^#define DB_db_addrem (DB_db_BEGIN + 1)$/ +DB_db_big ../include/db_auto.h /^#define DB_db_big (DB_db_BEGIN + 3)$/ +DB_db_debug ../include/db_auto.h /^#define DB_db_debug (DB_db_BEGIN + 7)$/ +DB_db_noop ../include/db_auto.h /^#define DB_db_noop (DB_db_BEGIN + 8)$/ +DB_db_ovref ../include/db_auto.h /^#define DB_db_ovref (DB_db_BEGIN + 4)$/ +DB_db_relink ../include/db_auto.h /^#define DB_db_relink (DB_db_BEGIN + 5)$/ +DB_db_split ../include/db_auto.h /^#define DB_db_split (DB_db_BEGIN + 2)$/ +DB_ham_BEGIN ../include/db_dispatch.h /^#define DB_ham_BEGIN 20$/ +DB_ham_copypage ../include/hash_auto.h /^#define DB_ham_copypage (DB_ham_BEGIN + 8)$/ +DB_ham_insdel ../include/hash_auto.h /^#define DB_ham_insdel (DB_ham_BEGIN + 1)$/ +DB_ham_newpage ../include/hash_auto.h /^#define DB_ham_newpage (DB_ham_BEGIN + 2)$/ +DB_ham_newpgno ../include/hash_auto.h /^#define DB_ham_newpgno (DB_ham_BEGIN + 6)$/ +DB_ham_ovfl ../include/hash_auto.h /^#define DB_ham_ovfl (DB_ham_BEGIN + 7)$/ +DB_ham_replace ../include/hash_auto.h /^#define DB_ham_replace (DB_ham_BEGIN + 5)$/ +DB_ham_splitdata ../include/hash_auto.h /^#define DB_ham_splitdata (DB_ham_BEGIN + 4)$/ +DB_ham_splitmeta ../include/hash_auto.h /^#define DB_ham_splitmeta (DB_ham_BEGIN + 3)$/ +DB_log_BEGIN ../include/db_dispatch.h /^#define DB_log_BEGIN 0$/ +DB_log_register ../include/log_auto.h /^#define DB_log_register (DB_log_BEGIN + 1)$/ +DB_ram_BEGIN ../include/db_dispatch.h /^#define DB_ram_BEGIN 100$/ +DB_txn_BEGIN ../include/db_dispatch.h /^#define DB_txn_BEGIN 5$/ +DB_txn_ckp ../include/txn_auto.h /^#define DB_txn_ckp (DB_txn_BEGIN + 2)$/ +DB_txn_regop ../include/txn_auto.h /^#define DB_txn_regop (DB_txn_BEGIN + 1)$/ +DB_user_BEGIN ../include/db_dispatch.h /^#define DB_user_BEGIN 150$/ +DCHARHASH ../hash/hash_func.c /^#define DCHARHASH(h, c) ((h) = 0x63c63cd9*(h) + 0x/ +DEBUG_CHECK_USAGE ../test/utils.c /^#define DEBUG_CHECK_USAGE "debug_check"$/ +DEBUG_LREAD ../include/db_int.h.src /^#define DEBUG_LREAD(D, T, O, K, A, F) LOG_OP(D, T,/ +DEBUG_LWRITE ../include/db_int.h.src /^#define DEBUG_LWRITE(D, T, O, K, A, F) LOG_OP(D, T/ +DEFAULT_MAX ../include/log.h /^#define DEFAULT_MAX (10 * MEGABYTE) \/* 10 Mb. *\// +DEFAULT_TXN_FILE ../include/txn.h /^#define DEFAULT_TXN_FILE "__db_txn.share"$/ +DEFMINKEYPAGE ../include/btree.h /^#define DEFMINKEYPAGE (2)$/ +DEF_LOG_SIZE ../log/log.c /^#define DEF_LOG_SIZE (30 * 1024)$/ +DELOVFL ../include/hash.h /^#define DELOVFL 0x50$/ +DELPAIR ../include/hash.h /^#define DELPAIR 0x30$/ +DELPGNO ../include/hash.h /^#define DELPGNO 0x70$/ +DIRTY_META ../include/hash.h /^#define DIRTY_META(H, R) { \\$/ +DISCARD ../btree/bt_cursor.c /^#define DISCARD(dbp, cp) { \\$/ +DO_ENV ../test/test_ext.h /^#define DO_ENV 0x1$/ +DO_INFO ../test/test_ext.h /^#define DO_INFO 0x2$/ +DUP_SIZE ../include/hash.h /^#define DUP_SIZE(len) ((len) + 2 * sizeof(db_indx_/ +EMSG ../clib/getopt.c /^#define EMSG ""$/ +ENVWIDGET_SIMPLEDUP ../test/utils.c /^#define ENVWIDGET_SIMPLEDUP "envN simpledup"$/ +ENVWIDGET_USAGE ../test/utils.c /^#define ENVWIDGET_USAGE "envN"$/ +E_ERROR ../test/test_ext.h /^#define E_ERROR(S) / +FAST_HASH ../lock/lock_util.c /^#define FAST_HASH(P) { \\$/ +FMAP_ENTRIES ../mp/mp_pr.c /^#define FMAP_ENTRIES 200 \/* Files we map. *\/$/ +FREE ../include/db_int.h.src /^#define FREE(p, len) { \\$/ +FREES ../include/db_int.h.src /^#define FREES(p) { \\$/ +F_CLR ../include/db_int.h.src /^#define F_CLR(p, f) (p)->flags &= ~(f)$/ +F_ISSET ../include/db_int.h.src /^#define F_ISSET(p, f) ((p)->flags & (f))$/ +F_SET ../include/db_int.h.src /^#define F_SET(p, f) (p)->flags |= (f)$/ +GETHANDLE ../include/btree.h /^#define GETHANDLE(dbp, set_txn, dbpp, ret) { \\/ +GET_BINTERNAL ../include/db_page.h /^#define GET_BINTERNAL(pg, indx) \\$/ +GET_BKEYDATA ../include/db_page.h /^#define GET_BKEYDATA(pg, indx) \\$/ +GET_BOVERFLOW ../include/db_page.h /^#define GET_BOVERFLOW(pg, indx) \\$/ +GET_META ../include/hash.h /^#define GET_META(D, H) { \\$/ +GET_RINTERNAL ../include/db_page.h /^#define GET_RINTERNAL(pg, indx) \\$/ +HASH4 ../hash/hash_func.c /^#define HASH4 HASH4b$/ +HASH4a ../hash/hash_func.c /^#define HASH4a h = (h << 5) - h + *k++;$/ +HASH4b ../hash/hash_func.c /^#define HASH4b h = (h << 5) + h + *k++;$/ +HASHC ../hash/hash_func.c /^#define HASHC n = *k++ + 65599 * n$/ +HASHINSERT ../include/db_shash.h /^#define HASHINSERT(begin, type, field, elt, n, has/ +HASHMAGIC ../include/db_185.h.src /^#define HASHMAGIC 0x061561$/ +HASHREMOVE ../include/db_shash.h /^#define HASHREMOVE(begin, type, field, elt, n, has/ +HASHREMOVE_EL ../include/db_shash.h /^#define HASHREMOVE_EL(begin, type, field, obj, n, / +HASHVERSION ../include/db_185.h.src /^#define HASHVERSION 2$/ +HAVE_MMAP_ANONYMOUS ../os/os_map.c /^#define HAVE_MMAP_ANONYMOUS 1$/ +HCREATE_USAGE ../test/tcl_hsearch.c /^#define HCREATE_USAGE "hcreate nelem"$/ +HDESTROY_USAGE ../test/tcl_hsearch.c /^#define HDESTROY_USAGE "hdestroy"$/ +HKEYDATA_DATA ../include/db_page.h /^#define HKEYDATA_DATA(p) (((u_int8_t *)p) + SSZA(H/ +HKEYDATA_PSIZE ../include/db_page.h /^#define HKEYDATA_PSIZE(len) \\$/ +HKEYDATA_SIZE ../include/db_page.h /^#define HKEYDATA_SIZE(len) \\$/ +HOFFDUP_PGNO ../include/db_page.h /^#define HOFFDUP_PGNO(p) (((u_int8_t *)p) + SSZ(HO/ +HOFFDUP_PSIZE ../include/db_page.h /^#define HOFFDUP_PSIZE (HOFFDUP_SIZE + sizeof(db_i/ +HOFFDUP_SIZE ../include/db_page.h /^#define HOFFDUP_SIZE (sizeof(HOFFDUP))$/ +HOFFPAGE_PGNO ../include/db_page.h /^#define HOFFPAGE_PGNO(p) (((u_int8_t *)p) + SSZ(HO/ +HOFFPAGE_PSIZE ../include/db_page.h /^#define HOFFPAGE_PSIZE (HOFFPAGE_SIZE + sizeof(db/ +HOFFPAGE_SIZE ../include/db_page.h /^#define HOFFPAGE_SIZE (sizeof(HOFFPAGE))$/ +HOFFPAGE_TLEN ../include/db_page.h /^#define HOFFPAGE_TLEN(p) (((u_int8_t *)p) + SSZ(HO/ +HOFFSET ../include/db_page.h /^#define HOFFSET(p) (((PAGE *)p)->hf_offset)$/ +HPAGE_PTYPE ../include/db_page.h /^#define HPAGE_PTYPE(p) (*(u_int8_t *)p)$/ +HPAGE_TYPE ../include/db_page.h /^#define HPAGE_TYPE(pg, indx) (*P_ENTRY(pg, indx))$/ +HSEARCH_USAGE ../test/tcl_hsearch.c /^#define HSEARCH_USAGE "hsearch key data find\/ente/ +H_DATAINDEX ../include/db_page.h /^#define H_DATAINDEX(pindx) ((2 * (pindx)) + 1)$/ +H_DELETED ../include/hash.h /^#define H_DELETED 0x0004$/ +H_DUPLICATE ../include/db_page.h /^#define H_DUPLICATE 2 \/* Duplicate key\/data item/ +H_EXPAND ../include/hash.h /^#define H_EXPAND 0x0020$/ +H_GETHANDLE ../include/hash.h /^#define H_GETHANDLE(dbp, dbpp, ret) \\$/ +H_ISDUP ../include/hash.h /^#define H_ISDUP 0x0008$/ +H_KEYDATA ../include/db_page.h /^#define H_KEYDATA 1 \/* Key\/data item. *\/$/ +H_KEYINDEX ../include/db_page.h /^#define H_KEYINDEX(pindx) (2 * (pindx))$/ +H_NOMORE ../include/hash.h /^#define H_NOMORE 0x0002$/ +H_NUMPAIRS ../include/db_page.h /^#define H_NUMPAIRS(pg) (NUM_ENT(pg) \/ 2)$/ +H_OFFDUP ../include/db_page.h /^#define H_OFFDUP 4 \/* Overflow page of duplicates/ +H_OFFPAGE ../include/db_page.h /^#define H_OFFPAGE 3 \/* Overflow key\/data item. */ +H_OK ../include/hash.h /^#define H_OK 0x0001$/ +H_PAIRDATA ../include/db_page.h /^#define H_PAIRDATA(pg, pindx) P_ENTRY(pg, H_DATAI/ +H_PAIRKEY ../include/db_page.h /^#define H_PAIRKEY(pg, pindx) P_ENTRY(pg, H_KEYIND/ +H_PAIRSIZE ../include/db_page.h /^#define H_PAIRSIZE(pg, psize, pindx) \\$/ +H_PUTHANDLE ../include/hash.h /^#define H_PUTHANDLE(dbp) { \\$/ +ILLEGAL_SIZE ../common/db_salloc.c /^#define ILLEGAL_SIZE 1$/ +INVALID ../include/mp.h /^#define INVALID 0 \/* Invalid shared memory offs/ +INVALID_SEGID ../include/db_int.h.src /^#define INVALID_SEGID -1$/ +ISBIG ../include/hash.h /^#define ISBIG(H, N) (((N) > ((H)->hdr->pagesize \// +ISDOT ../clib/getcwd.c /^#define ISDOT(dp) \\$/ +ISINTERNAL ../include/btree.h /^#define ISINTERNAL(p) (TYPE(p) == P_IBTREE || TYPE/ +ISLEAF ../include/btree.h /^#define ISLEAF(p) (TYPE(p) == P_LBTREE || TYPE(p) / +ISSET_MAP ../lock/lock_deadlock.c /^#define ISSET_MAP(M, N) (M[(N) \/ 32] & (1 << (N) / +ISTEMPORARY ../mp/mp_fopen.c /^#define ISTEMPORARY (path == NULL)$/ +IS_VALID ../include/hash.h /^#define IS_VALID(C) ((C)->bucket != BUCKET_INVALID/ +IS_ZERO_LSN ../include/db_int.h.src /^#define IS_ZERO_LSN(LSN) ((LSN).file == 0)$/ +LEAFLEVEL ../include/db_page.h /^#define LEAFLEVEL 1$/ +LEN_HDATA ../include/db_page.h /^#define LEN_HDATA(p, psize, pindx) LEN_HKEYDATA(p,/ +LEN_HITEM ../include/db_page.h /^#define LEN_HITEM(pg, pgsize, indx) \\$/ +LEN_HKEY ../include/db_page.h /^#define LEN_HKEY(p, psize, pindx) LEN_HKEYDATA(p, / +LEN_HKEYDATA ../include/db_page.h /^#define LEN_HKEYDATA(pg, psize, indx) \\$/ +LEVEL ../include/db_page.h /^#define LEVEL(p) (((PAGE *)p)->level)$/ +LFNAME ../include/log.h /^#define LFNAME "log.%05d" \/* Log file name templ/ +LF_CLR ../include/db_int.h.src /^#define LF_CLR(f) (flags &= ~(f))$/ +LF_ISSET ../include/db_int.h.src /^#define LF_ISSET(f) (flags & (f))$/ +LF_SET ../include/db_int.h.src /^#define LF_SET(f) (flags |= (f))$/ +LIST_END ../include/queue.h /^#define LIST_END(head) NULL$/ +LIST_ENTRY ../include/queue.h /^#define LIST_ENTRY(type) \\$/ +LIST_FIRST ../include/queue.h /^#define LIST_FIRST(head) ((head)->lh_first)$/ +LIST_HEAD ../include/queue.h /^#define LIST_HEAD(name, type) \\$/ +LIST_INCREMENT ../log/log_archive.c /^#define LIST_INCREMENT 64$/ +LIST_INIT ../include/queue.h /^#define LIST_INIT(head) { \\$/ +LIST_INSERT_AFTER ../include/queue.h /^#define LIST_INSERT_AFTER(listelm, elm, field) do / +LIST_INSERT_BEFORE ../include/queue.h /^#define LIST_INSERT_BEFORE(listelm, elm, field) do/ +LIST_INSERT_HEAD ../include/queue.h /^#define LIST_INSERT_HEAD(head, elm, field) do { / +LIST_NEXT ../include/queue.h /^#define LIST_NEXT(elm, field) ((elm)->field.le_ne/ +LIST_REMOVE ../include/queue.h /^#define LIST_REMOVE(elm, field) do { \\$/ +LOCKBUFFER ../include/mp.h /^#define LOCKBUFFER(dbmp, bhp) \\$/ +LOCKCLOSE_USAGE ../test/tcl_lock.c /^#define LOCKCLOSE_USAGE "lockmgrN close"$/ +LOCKDUMP_USAGE ../test/tcl_lock.c /^#define LOCKDUMP_USAGE "lockmgrN dump flags"$/ +LOCKGET_USAGE ../test/tcl_lock.c /^#define LOCKGET_USAGE "lockmgrN get locker obj mod/ +LOCKHANDLE ../include/mp.h /^#define LOCKHANDLE(dbmp, mutexp) \\$/ +LOCKINIT ../include/mp.h /^#define LOCKINIT(dbmp, mutexp) \\$/ +LOCKMGR_USAGE ../test/tcl_lock.c /^#define LOCKMGR_USAGE "lock_open path flags mode [/ +LOCKPUT_USAGE ../test/tcl_lock.c /^#define LOCKPUT_USAGE "lockmgrN.lockM put"$/ +LOCKREGION ../include/mp.h /^#define LOCKREGION(dbmp) \\$/ +LOCKUNLINK_USAGE ../test/tcl_lock.c /^#define LOCKUNLINK_USAGE "lock_unlink path force"$/ +LOCKVEC_USAGE ../test/tcl_lock.c /^#define LOCKVEC_USAGE \\$/ +LOCKWIDGET_USAGE ../test/tcl_lock.c /^#define LOCKWIDGET_USAGE "lockmgrN option ?arg arg/ +LOCK_DUMP_ALL ../lock/lock_region.c /^#define LOCK_DUMP_ALL 0x01f \/* Display all. *\// +LOCK_DUMP_CONF ../lock/lock_region.c /^#define LOCK_DUMP_CONF 0x001 \/* Conflict matrix/ +LOCK_DUMP_FREE ../lock/lock_region.c /^#define LOCK_DUMP_FREE 0x002 \/* Display lock fr/ +LOCK_DUMP_LOCKERS ../lock/lock_region.c /^#define LOCK_DUMP_LOCKERS 0x004 \/* Display locke/ +LOCK_DUMP_MEM ../lock/lock_region.c /^#define LOCK_DUMP_MEM 0x008 \/* Display region m/ +LOCK_DUMP_OBJECTS ../lock/lock_region.c /^#define LOCK_DUMP_OBJECTS 0x010 \/* Display objec/ +LOCK_HASH_ALIGN ../include/lock.h /^#define LOCK_HASH_ALIGN 8$/ +LOCK_HEADER_SIZE ../include/lock.h /^#define LOCK_HEADER_SIZE(M) \\$/ +LOCK_INVALID ../include/db_int.h.src /^#define LOCK_INVALID 0$/ +LOCK_LOCKREGION ../include/lock.h /^#define LOCK_LOCKREGION(lt) \\$/ +LOCK_LOGREGION ../include/log.h /^#define LOCK_LOGREGION(dblp) \\$/ +LOCK_LOGTHREAD ../include/log.h /^#define LOCK_LOGTHREAD(dblp) \\$/ +LOCK_REGION_SIZE ../include/lock.h /^#define LOCK_REGION_SIZE(M, N, H) \\$/ +LOCK_TO_OFFSET ../include/lock.h /^#define LOCK_TO_OFFSET(lt, lock) \\$/ +LOCK_TXNREGION ../include/txn.h /^#define LOCK_TXNREGION(tmgrp) \\$/ +LOCK_TXNTHREAD ../include/txn.h /^#define LOCK_TXNTHREAD(tmgrp) \\$/ +LOCK_USAGE ../test/tcl_lock.c /^#define LOCK_USAGE "lockmgrN.lockM cmd ?arg arg ../ +LOFFSET ../include/db_page.h /^#define LOFFSET(pg) (P_OVERHEAD + NUM_ENT(pg) * s/ +LOGCLOSE_USAGE ../test/tcl_log.c /^#define LOGCLOSE_USAGE "logN close"$/ +LOGCMP_USAGE ../test/tcl_log.c /^#define LOGCMP_USAGE "logN compare lsn1 lsn2"$/ +LOGFILE_USAGE ../test/tcl_log.c /^#define LOGFILE_USAGE "logN file lsn"$/ +LOGFLUSH_USAGE ../test/tcl_log.c /^#define LOGFLUSH_USAGE "logN flush lsn"$/ +LOGGET_USAGE ../test/tcl_log.c /^#define LOGGET_USAGE "logN get lsn flags"$/ +LOGLAST_USAGE ../test/tcl_log.c /^#define LOGLAST_USAGE "logN last"$/ +LOGPUT_USAGE ../test/tcl_log.c /^#define LOGPUT_USAGE "logN put record flags"$/ +LOGREG_USAGE ../test/tcl_log.c /^#define LOGREG_USAGE "logN register db name type"$/ +LOGUNLINK_USAGE ../test/tcl_log.c /^#define LOGUNLINK_USAGE "log_unlink path force"$/ +LOGWIDGET_USAGE ../test/tcl_log.c /^#define LOGWIDGET_USAGE "logN option ?arg arg ...?/ +LOG_CHECKPOINT ../include/log.h /^#define LOG_CHECKPOINT 1 \/* Checkpoint: file nam/ +LOG_CLOSE ../include/log.h /^#define LOG_CLOSE 2 \/* File close. *\/$/ +LOG_OP ../include/db_int.h.src /^#define LOG_OP(D, T, O, K, A, F) { \\$/ +LOG_OPEN ../include/log.h /^#define LOG_OPEN 3 \/* File open. *\/$/ +LOG_UNREG ../test/tcl_log.c /^#define LOG_UNREG "logN unregister id"$/ +LOG_USAGE ../test/tcl_log.c /^#define LOG_USAGE "log path flags mode [options]\\/ +LSN ../include/db_page.h /^#define LSN(p) (((PAGE *)p)->lsn)$/ +MAP_FAILED ../os/os_map.c /^#define MAP_FAILED -1$/ +MAXBTREELEVEL ../include/db_page.h /^#define MAXBTREELEVEL 255$/ +MAXLFNAME ../include/log.h /^#define MAXLFNAME 99999 \/* Maximum log file name/ +MAXPATHLEN ../include/db_int.h.src /^#define MAXPATHLEN 1024$/ +MAX_PAGES ../include/hash.h /^#define MAX_PAGES(H) UINT32_T_MAX$/ +MAX_PAGE_NUMBER ../include/db_185.h.src /^#define MAX_PAGE_NUMBER 0xffffffff \/* >= # of pag/ +MAX_PAGE_OFFSET ../include/db_185.h.src /^#define MAX_PAGE_OFFSET 65535 \/* >= # of bytes i/ +MAX_REC_NUMBER ../include/db_185.h.src /^#define MAX_REC_NUMBER 0xffffffff \/* >= # of reco/ +MEGABYTE ../include/db_int.h.src /^#define MEGABYTE 1048576$/ +MINFILL ../include/hash.h /^#define MINFILL 4$/ +MPCLOSE_USAGE ../test/tcl_mpool.c /^#define MPCLOSE_USAGE "mpN close"$/ +MPFCLOSE_USAGE ../test/tcl_mpool.c /^#define MPFCLOSE_USAGE "mpN.mpfM close"$/ +MPFGET_USAGE ../test/tcl_mpool.c /^#define MPFGET_USAGE "mpN.mpfM get pgno flags"$/ +MPFOPEN_USAGE ../test/tcl_mpool.c /^#define MPFOPEN_USAGE "mpN open path pagesize flag/ +MPFSYNC_USAGE ../test/tcl_mpool.c /^#define MPFSYNC_USAGE "mpN.mpfM sync"$/ +MPF_USAGE ../test/tcl_mpool.c /^#define MPF_USAGE "mpN.mpfM cmd ?arg arg ...?"$/ +MPOOLUNLINK_USAGE ../test/tcl_mpool.c /^#define MPOOLUNLINK_USAGE "memp_unlink path force"/ +MPOOL_DUMP_ALL ../mp/mp_pr.c /^#define MPOOL_DUMP_ALL 0x07 \/* Debug all. *\/$/ +MPOOL_DUMP_HASH ../mp/mp_pr.c /^#define MPOOL_DUMP_HASH 0x01 \/* Debug hash chai/ +MPOOL_DUMP_LRU ../mp/mp_pr.c /^#define MPOOL_DUMP_LRU 0x02 \/* Debug LRU chains/ +MPOOL_DUMP_MEM ../mp/mp_pr.c /^#define MPOOL_DUMP_MEM 0x04 \/* Debug region mem/ +MPOOL_USAGE ../test/tcl_mpool.c /^#define MPOOL_USAGE "memp path mode flags options / +MPSTAT_USAGE ../test/tcl_mpool.c /^#define MPSTAT_USAGE "mpN stat"$/ +MPWIDGET_USAGE ../test/tcl_mpool.c /^#define MPWIDGET_USAGE "mpN option ?arg arg ...?"$/ +MP_CAN_MMAP ../include/mp.h /^#define MP_CAN_MMAP 0x01 \/* If the file can be m/ +MP_LOCKHANDLE ../include/mp.h /^#define MP_LOCKHANDLE 0x01 \/* Threaded, lock han/ +MP_LOCKREGION ../include/mp.h /^#define MP_LOCKREGION 0x02 \/* Concurrent access,/ +MP_LSN_RETRY ../include/mp.h /^#define MP_LSN_RETRY 0x01 \/* Retry all BH_WRITE / +MP_READONLY ../include/mp.h /^#define MP_READONLY 0x01 \/* File is readonly. */ +MP_TEMP ../include/mp.h /^#define MP_TEMP 0x02 \/* Backing file is a tempo/ +MP_UPGRADE ../include/mp.h /^#define MP_UPGRADE 0x02 \/* File descriptor is re/ +MP_UPGRADE_FAIL ../include/mp.h /^#define MP_UPGRADE_FAIL 0x04 \/* Upgrade wasn't p/ +MS ../mutex/mutex.c /^#define MS(n) ((n) * 1000) \/* Milliseconds to mi/ +MUTEXCLOSE_USAGE ../test/tcl_mutex.c /^#define MUTEXCLOSE_USAGE "mutexN close"$/ +MUTEXGR_USAGE ../test/tcl_mutex.c /^#define MUTEXGR_USAGE "mutexN {get,release} id"$/ +MUTEXUNLINK_USAGE ../test/tcl_mutex.c /^#define MUTEXUNLINK_USAGE "mutex_unlink path"$/ +MUTEXV_USAGE ../test/tcl_mutex.c /^#define MUTEXV_USAGE "mutexN {set,get}val id val"$/ +MUTEXWIDGET_USAGE ../test/tcl_mutex.c /^#define MUTEXWIDGET_USAGE "mutexN option ?arg arg / +MUTEX_ALIGNMENT ../include/db_int.h.src /^#define MUTEX_ALIGNMENT @mutex_align@$/ +MUTEX_FILE ../test/tcl_mutex.c /^#define MUTEX_FILE "__mutex.share"$/ +MUTEX_LOCK_OFFSET ../include/db_int.h.src /^#define MUTEX_LOCK_OFFSET(a, b) ((u_int32_t)((u_in/ +MUTEX_USAGE ../test/tcl_mutex.c /^#define MUTEX_USAGE "mutex_init path nitems flags / +M_16_SWAP ../include/db_swap.h /^#define M_16_SWAP(a) { \\$/ +M_32_SWAP ../include/db_swap.h /^#define M_32_SWAP(a) { \\$/ +NCACHED ../include/db_page.h /^#define NCACHED 32 \/* number of spare points *\// +NDBMCLEAR_USAGE ../test/tcl_ndbm.c /^#define NDBMCLEAR_USAGE "ndbmN clearerr"$/ +NDBMCLOSE_USAGE ../test/tcl_ndbm.c /^#define NDBMCLOSE_USAGE "ndbmN close"$/ +NDBMDEL_USAGE ../test/tcl_ndbm.c /^#define NDBMDEL_USAGE "ndbmN delete key"$/ +NDBMDIRFNO_USAGE ../test/tcl_ndbm.c /^#define NDBMDIRFNO_USAGE "ndbmM dirfno"$/ +NDBMERROR_USAGE ../test/tcl_ndbm.c /^#define NDBMERROR_USAGE "ndbmN error"$/ +NDBMFETCH_USAGE ../test/tcl_ndbm.c /^#define NDBMFETCH_USAGE "ndbmN fetch key"$/ +NDBMFIRST_USAGE ../test/tcl_ndbm.c /^#define NDBMFIRST_USAGE "ndbmN firstkey"$/ +NDBMNEXT_USAGE ../test/tcl_ndbm.c /^#define NDBMNEXT_USAGE "ndbmN nextkey"$/ +NDBMOPEN_USAGE ../test/tcl_ndbm.c /^#define NDBMOPEN_USAGE "ndbm_open file flags mode"/ +NDBMPAGFNO_USAGE ../test/tcl_ndbm.c /^#define NDBMPAGFNO_USAGE "ndbmM pagfno"$/ +NDBMRDONLY_USAGE ../test/tcl_ndbm.c /^#define NDBMRDONLY_USAGE "ndbmM rdonly"$/ +NDBMSTORE_USAGE ../test/tcl_ndbm.c /^#define NDBMSTORE_USAGE "ndbmN store key datum fla/ +NDBMWIDGET_USAGE ../test/tcl_ndbm.c /^#define NDBMWIDGET_USAGE "ndbmN option ?arg arg ../ +NDX_INVALID ../include/hash.h /^#define NDX_INVALID 0xFFFF$/ +NEXT_PGNO ../include/db_page.h /^#define NEXT_PGNO(p) (((PAGE *)p)->next_pgno)$/ +NUM_ENT ../include/db_page.h /^#define NUM_ENT(p) (((PAGE *)p)->entries)$/ +OBJ_TO_OFFSET ../include/lock.h /^#define OBJ_TO_OFFSET(lt, obj) \\$/ +OFFSET_TO_LOCK ../include/lock.h /^#define OFFSET_TO_LOCK(lt, off) \\$/ +OFFSET_TO_OBJ ../include/lock.h /^#define OFFSET_TO_OBJ(lt, off) \\$/ +OKFLAGS ../common/db_appinit.c /^#define OKFLAGS \\$/ +OPCODE_OF ../include/hash.h /^#define OPCODE_OF(N) (N & ~(PAIR_KEYMASK | PAI/ +OR_MAP ../lock/lock_deadlock.c /^#define OR_MAP(D, S, N) { \\$/ +OVPUT ../btree/bt_put.c /^#define OVPUT(h, indx, bo) do { \\$/ +OV_LEN ../include/db_page.h /^#define OV_LEN(p) (((PAGE *)p)->hf_offset)$/ +OV_REF ../include/db_page.h /^#define OV_REF(p) (((PAGE *)p)->entries)$/ +O_INDX ../include/db_page.h /^#define O_INDX 1$/ +PAGECHECK_USAGE ../test/tcl_mpool.c /^#define PAGECHECK_USAGE "pageN check str"$/ +PAGEGET_USAGE ../test/tcl_mpool.c /^#define PAGEGET_USAGE "pageN get"$/ +PAGEINIT_USAGE ../test/tcl_mpool.c /^#define PAGEINIT_USAGE "pageN init str"$/ +PAGEPUT_USAGE ../test/tcl_mpool.c /^#define PAGEPUT_USAGE "pageN put flags"$/ +PAGE_USAGE ../test/tcl_mpool.c /^#define PAGE_USAGE "pageN option ?arg arg ...?"$/ +PAIR_DATAMASK ../include/hash.h /^#define PAIR_DATAMASK 0x2$/ +PAIR_ISDATABIG ../include/hash.h /^#define PAIR_ISDATABIG(N) (N & PAIR_DATAMASK)$/ +PAIR_ISKEYBIG ../include/hash.h /^#define PAIR_ISKEYBIG(N) (N & PAIR_KEYMASK)$/ +PAIR_KEYMASK ../include/hash.h /^#define PAIR_KEYMASK 0x1$/ +PAST_END_OK ../include/btree.h /^#define PAST_END_OK(f) \\$/ +PATH_DOT ../include/db_int.h.src /^#define PATH_DOT "." \/* Current working directory/ +PATH_SEPARATOR ../include/db_int.h.src /^#define PATH_SEPARATOR "\/" \/* Path separator cha/ +PGNO ../include/db_page.h /^#define PGNO(p) (((PAGE *)p)->pgno)$/ +PGNO_INVALID ../include/db_page.h /^#define PGNO_INVALID 0 \/* Metadata page number, t/ +PGNO_METADATA ../include/db_page.h /^#define PGNO_METADATA 0 \/* Metadata page number. / +PGNO_OF ../include/hash.h /^#define PGNO_OF(H, S, O) (BUCKET_TO_PAGE((H), (1 prev_pgno)$/ +PSIZE_BOUNDARY ../db/db_pr.c /^#define PSIZE_BOUNDARY (64 * 1024 + 1)$/ +PUTHANDLE ../include/btree.h /^#define PUTHANDLE(dbp) { \\$/ +PUTOVFL ../include/hash.h /^#define PUTOVFL 0x40$/ +PUTPAIR ../include/hash.h /^#define PUTPAIR 0x20$/ +PUT_HKEYDATA ../include/db_page.h /^#define PUT_HKEYDATA(pe, kd, len, type) { \\$/ +P_16_COPY ../include/db_swap.h /^#define P_16_COPY(a, b) { \\$/ +P_16_SWAP ../include/db_swap.h /^#define P_16_SWAP(a) { \\$/ +P_32_COPY ../include/db_swap.h /^#define P_32_COPY(a, b) { \\$/ +P_32_SWAP ../include/db_swap.h /^#define P_32_SWAP(a) { \\$/ +P_DUPLICATE ../include/db_page.h /^#define P_DUPLICATE 1 \/* Duplicate. *\/$/ +P_ENTRY ../include/db_page.h /^#define P_ENTRY(pg, indx) ((u_int8_t *)pg + ((PAGE/ +P_FREESPACE ../include/db_page.h /^#define P_FREESPACE(pg) (HOFFSET(pg) - LOFFSET(pg/ +P_HASH ../include/db_page.h /^#define P_HASH 2 \/* Hash. *\/$/ +P_IBTREE ../include/db_page.h /^#define P_IBTREE 3 \/* Btree internal. *\/$/ +P_INDX ../include/db_page.h /^#define P_INDX 2$/ +P_INIT ../include/db_page.h /^#define P_INIT(pg, pg_size, n, pg_prev, pg_next, b/ +P_INVALID ../include/db_page.h /^#define P_INVALID 0 \/* Invalid page type. *\/$/ +P_IRECNO ../include/db_page.h /^#define P_IRECNO 4 \/* Recno internal. *\/$/ +P_LBTREE ../include/db_page.h /^#define P_LBTREE 5 \/* Btree leaf. *\/$/ +P_LRECNO ../include/db_page.h /^#define P_LRECNO 6 \/* Recno leaf. *\/$/ +P_MAXSPACE ../include/db_page.h /^#define P_MAXSPACE(psize) ((psize) - P_OVERHEAD)$/ +P_OVERFLOW ../include/db_page.h /^#define P_OVERFLOW 7 \/* Overflow. *\/$/ +P_OVERHEAD ../include/db_page.h /^#define P_OVERHEAD (SSZA(PAGE, inp))$/ +RANDOMINT_USAGE ../test/utils.c /^#define RANDOMINT_USAGE "random_int lo hi"$/ +RAND_MAX ../test/utils.c /^#define RAND_MAX 0x7fffffff$/ +RAND_USAGE ../test/utils.c /^#define RAND_USAGE "rand"$/ +RECNO_EOF ../include/btree.h /^#define RECNO_EOF 0x0001 \/* EOF on backing sourc/ +RECNO_MODIFIED ../include/btree.h /^#define RECNO_MODIFIED 0x0002 \/* Tree was modifi/ +RECNO_OOB ../include/btree.h /^#define RECNO_OOB 0 \/* Illegal record number. */ +REC_CLOSE ../include/db_am.h /^#define REC_CLOSE { \\$/ +REC_INTRO ../include/db_am.h /^#define REC_INTRO(func) { \\$/ +REC_NOOP_CLOSE ../include/db_am.h /^#define REC_NOOP_CLOSE { \\$/ +REC_NOOP_INTRO ../include/db_am.h /^#define REC_NOOP_INTRO(func) { \\$/ +REC_PRINT ../include/db_am.h /^#define REC_PRINT(func) \\$/ +REGION_ANONYMOUS ../include/db_int.h.src /^#define REGION_ANONYMOUS 0x01 \/* Region is\/shoul/ +REGION_CANGROW ../include/db_int.h.src /^#define REGION_CANGROW 0x0002 \/* Can grow. *\/$/ +REGION_CREATED ../include/db_int.h.src /^#define REGION_CREATED 0x0004 \/* Created. *\/$/ +REGION_HOLDINGSYS ../include/db_int.h.src /^#define REGION_HOLDINGSYS 0x0008 \/* Holding syste/ +REGION_LASTDETACH ../include/db_int.h.src /^#define REGION_LASTDETACH 0x0010 \/* Delete on las/ +REGION_MALLOC ../include/db_int.h.src /^#define REGION_MALLOC 0x0020 \/* Created in mallo/ +REGION_PRIVATE ../include/db_int.h.src /^#define REGION_PRIVATE 0x0040 \/* Private to thre/ +REGION_REMOVED ../include/db_int.h.src /^#define REGION_REMOVED 0x0080 \/* Already deleted/ +REGION_SIZEDEF ../include/db_int.h.src /^#define REGION_SIZEDEF 0x0100 \/* Use default reg/ +RELEASE_META ../include/hash.h /^#define RELEASE_META(D, H) { \\$/ +RET_ERROR ../include/db_185.h.src /^#define RET_ERROR -1 \/* Return values. *\/$/ +RET_SPECIAL ../include/db_185.h.src /^#define RET_SPECIAL 1$/ +RET_SUCCESS ../include/db_185.h.src /^#define RET_SUCCESS 0$/ +RE_NREC ../include/db_page.h /^#define RE_NREC(p) \\$/ +RE_NREC_ADJ ../include/db_page.h /^#define RE_NREC_ADJ(p, adj) \\$/ +RE_NREC_SET ../include/db_page.h /^#define RE_NREC_SET(p, num) \\$/ +RINTERNAL_PSIZE ../include/db_page.h /^#define RINTERNAL_PSIZE \\$/ +RINTERNAL_SIZE ../include/db_page.h /^#define RINTERNAL_SIZE \\$/ +RSMSG ../db185/db185.c /^#define RSMSG "DB: DB 1.85's R_RECNOSYNC sync flag/ +R_ADDR ../include/db_int.h.src /^#define R_ADDR(base, offset) ((void *)((u_int8_t */ +R_CURSOR ../include/db_185.h.src /^#define R_CURSOR 1 \/* del, put, seq *\/$/ +R_DUP ../include/db_185.h.src /^#define R_DUP 0x01 \/* duplicate keys *\/$/ +R_FIRST ../include/db_185.h.src /^#define R_FIRST 3 \/* seq *\/$/ +R_FIXEDLEN ../include/db_185.h.src /^#define R_FIXEDLEN 0x01 \/* fixed-length records */ +R_IAFTER ../include/db_185.h.src /^#define R_IAFTER 4 \/* put (RECNO) *\/$/ +R_IBEFORE ../include/db_185.h.src /^#define R_IBEFORE 5 \/* put (RECNO) *\/$/ +R_LAST ../include/db_185.h.src /^#define R_LAST 6 \/* seq (BTREE, RECNO) *\/$/ +R_NEXT ../include/db_185.h.src /^#define R_NEXT 7 \/* seq *\/$/ +R_NOKEY ../include/db_185.h.src /^#define R_NOKEY 0x02 \/* key not required *\/$/ +R_NOOVERWRITE ../include/db_185.h.src /^#define R_NOOVERWRITE 8 \/* put *\/$/ +R_OFFSET ../include/db_int.h.src /^#define R_OFFSET(base, p) ((u_int8_t *)(p) - (u_in/ +R_PREV ../include/db_185.h.src /^#define R_PREV 9 \/* seq (BTREE, RECNO) *\/$/ +R_RECNOSYNC ../include/db_185.h.src /^#define R_RECNOSYNC 11 \/* sync (RECNO) *\/$/ +R_SETCURSOR ../include/db_185.h.src /^#define R_SETCURSOR 10 \/* put (RECNO) *\/$/ +R_SNAPSHOT ../include/db_185.h.src /^#define R_SNAPSHOT 0x04 \/* snapshot the input *\// +SECOND ../mutex/mutex.c /^#define SECOND (MS(1000)) \/* A second's worth of/ +SET_LOCKER ../include/hash.h /^#define SET_LOCKER(D, T) ((D)->txn = (T))$/ +SET_MAP ../lock/lock_deadlock.c /^#define SET_MAP(M, B) (M[(B) \/ 32] |= (1 << ((B) / +SHALLOC_FRAGMENT ../common/db_salloc.c /^#define SHALLOC_FRAGMENT 32$/ +SH_CIRCLEQ_END ../include/shqueue.h /^#define SH_CIRCLEQ_END(head) ((void *)(head))$/ +SH_CIRCLEQ_ENTRY ../include/shqueue.h /^#define SH_CIRCLEQ_ENTRY \\$/ +SH_CIRCLEQ_FIRST ../include/shqueue.h /^#define SH_CIRCLEQ_FIRST(head, type) \\$/ +SH_CIRCLEQ_FIRSTP ../include/shqueue.h /^#define SH_CIRCLEQ_FIRSTP(head, type) \\$/ +SH_CIRCLEQ_HEAD ../include/shqueue.h /^#define SH_CIRCLEQ_HEAD(name) \\$/ +SH_CIRCLEQ_INIT ../include/shqueue.h /^#define SH_CIRCLEQ_INIT(head) { \\$/ +SH_CIRCLEQ_INSERT_AFTER ../include/shqueue.h /^#define SH_CIRCLEQ_INSERT_AFTER(head, listelm, elm/ +SH_CIRCLEQ_INSERT_BEFORE ../include/shqueue.h /^#define SH_CIRCLEQ_INSERT_BEFORE(head, listelm, el/ +SH_CIRCLEQ_INSERT_HEAD ../include/shqueue.h /^#define SH_CIRCLEQ_INSERT_HEAD(head, elm, field, t/ +SH_CIRCLEQ_INSERT_TAIL ../include/shqueue.h /^#define SH_CIRCLEQ_INSERT_TAIL(head, elm, field, t/ +SH_CIRCLEQ_LAST ../include/shqueue.h /^#define SH_CIRCLEQ_LAST(head, type) \\$/ +SH_CIRCLEQ_LASTP ../include/shqueue.h /^#define SH_CIRCLEQ_LASTP(head, type) \\$/ +SH_CIRCLEQ_NEXT ../include/shqueue.h /^#define SH_CIRCLEQ_NEXT(head, elm, field, type) / +SH_CIRCLEQ_NEXTP ../include/shqueue.h /^#define SH_CIRCLEQ_NEXTP(elm, field, type) \\$/ +SH_CIRCLEQ_PREV ../include/shqueue.h /^#define SH_CIRCLEQ_PREV(head, elm, field, type) / +SH_CIRCLEQ_PREVP ../include/shqueue.h /^#define SH_CIRCLEQ_PREVP(elm, field, type) \\$/ +SH_CIRCLEQ_REMOVE ../include/shqueue.h /^#define SH_CIRCLEQ_REMOVE(head, elm, field, type) / +SH_DBT_PTR ../include/lock.h /^#define SH_DBT_PTR(p) ((void *)(((u_int8_t *)(p)) / +SH_LIST_END ../include/shqueue.h /^#define SH_LIST_END(head) NULL$/ +SH_LIST_ENTRY ../include/shqueue.h /^#define SH_LIST_ENTRY \\$/ +SH_LIST_FIRST ../include/shqueue.h /^#define SH_LIST_FIRST(head, type) \\$/ +SH_LIST_FIRSTP ../include/shqueue.h /^#define SH_LIST_FIRSTP(head, type) \\$/ +SH_LIST_HEAD ../include/shqueue.h /^#define SH_LIST_HEAD(name) \\$/ +SH_LIST_INIT ../include/shqueue.h /^#define SH_LIST_INIT(head) (head)->slh_first = -1$/ +SH_LIST_INSERT_AFTER ../include/shqueue.h /^#define SH_LIST_INSERT_AFTER(listelm, elm, field, / +SH_LIST_INSERT_HEAD ../include/shqueue.h /^#define SH_LIST_INSERT_HEAD(head, elm, field, type/ +SH_LIST_NEXT ../include/shqueue.h /^#define SH_LIST_NEXT(elm, field, type) \\$/ +SH_LIST_NEXTP ../include/shqueue.h /^#define SH_LIST_NEXTP(elm, field, type) \\$/ +SH_LIST_NEXT_TO_PREV ../include/shqueue.h /^#define SH_LIST_NEXT_TO_PREV(elm, field) \\$/ +SH_LIST_PREV ../include/shqueue.h /^#define SH_LIST_PREV(elm, field) \\$/ +SH_LIST_REMOVE ../include/shqueue.h /^#define SH_LIST_REMOVE(elm, field, type) do { / +SH_PTR_TO_OFF ../include/shqueue.h /^#define SH_PTR_TO_OFF(src, dest) \\$/ +SH_TAILQ_END ../include/shqueue.h /^#define SH_TAILQ_END(head) NULL$/ +SH_TAILQ_ENTRY ../include/shqueue.h /^#define SH_TAILQ_ENTRY \\$/ +SH_TAILQ_FIRST ../include/shqueue.h /^#define SH_TAILQ_FIRST(head, type) \\$/ +SH_TAILQ_FIRSTP ../include/shqueue.h /^#define SH_TAILQ_FIRSTP(head, type) \\$/ +SH_TAILQ_HEAD ../include/db_shash.h /^typedef SH_TAILQ_HEAD(hash_head) DB_HASHTAB;$/ +SH_TAILQ_INIT ../include/shqueue.h /^#define SH_TAILQ_INIT(head) { \\$/ +SH_TAILQ_INSERT_AFTER ../include/shqueue.h /^#define SH_TAILQ_INSERT_AFTER(head, listelm, elm, / +SH_TAILQ_INSERT_HEAD ../include/shqueue.h /^#define SH_TAILQ_INSERT_HEAD(head, elm, field, typ/ +SH_TAILQ_INSERT_TAIL ../include/shqueue.h /^#define SH_TAILQ_INSERT_TAIL(head, elm, field) do / +SH_TAILQ_LAST ../include/shqueue.h /^#define SH_TAILQ_LAST(head) \\$/ +SH_TAILQ_NEXT ../include/shqueue.h /^#define SH_TAILQ_NEXT(elm, field, type) \\$/ +SH_TAILQ_NEXTP ../include/shqueue.h /^#define SH_TAILQ_NEXTP(elm, field, type) \\$/ +SH_TAILQ_NEXT_TO_PREV ../include/shqueue.h /^#define SH_TAILQ_NEXT_TO_PREV(elm, field) \\$/ +SH_TAILQ_PREVP ../include/shqueue.h /^#define SH_TAILQ_PREVP(elm, field) \\$/ +SH_TAILQ_REMOVE ../include/shqueue.h /^#define SH_TAILQ_REMOVE(head, elm, field, type) do/ +SPLITNEW ../include/hash.h /^#define SPLITNEW 0x90$/ +SPLITOLD ../include/hash.h /^#define SPLITOLD 0x80$/ +SRAND_USAGE ../test/utils.c /^#define SRAND_USAGE "srand seed"$/ +SSZ ../include/db_int.h.src /^#define SSZ(name, field) ((int)&(((name *)0)->fiel/ +SSZA ../include/db_int.h.src /^#define SSZA(name, field) ((int)&(((name *)0)->fie/ +STAMP_USAGE ../test/utils.c /^#define STAMP_USAGE "timestamp [-r]"$/ +STRING_SIZE ../include/lock.h /^#define STRING_SIZE(N) (16 * N)$/ +SWAP16 ../include/db_swap.h /^#define SWAP16(p) { \\$/ +SWAP32 ../include/db_swap.h /^#define SWAP32(p) { \\$/ +S_APPEND ../include/btree.h /^#define S_APPEND 0x00040 \/* Append to the tree. / +S_DELETE ../include/btree.h /^#define S_DELETE (S_WRITE | S_DUPFIRST | S_DELNO |/ +S_DELNO ../include/btree.h /^#define S_DELNO 0x00080 \/* Don't return deleted/ +S_DUPFIRST ../include/btree.h /^#define S_DUPFIRST 0x00100 \/* Return first dupli/ +S_DUPLAST ../include/btree.h /^#define S_DUPLAST 0x00200 \/* Return last duplica/ +S_EXACT ../include/btree.h /^#define S_EXACT 0x00400 \/* Exact items only. */ +S_FIND ../include/btree.h /^#define S_FIND (S_READ | S_DUPFIRST | S_DELNO)$/ +S_INSERT ../include/btree.h /^#define S_INSERT (S_WRITE | S_DUPLAST | S_STACK)$/ +S_IRGRP ../os/os_oflags.c /^#define S_IRGRP 0 \/* R for group *\/$/ +S_IROTH ../os/os_oflags.c /^#define S_IROTH 0 \/* R for other *\/$/ +S_IRUSR ../os/os_oflags.c /^#define S_IRUSR S_IREAD \/* R for owner *\/$/ +S_ISDIR ../os/os_stat.c /^#define S_ISDIR(m) (_S_IFDIR & (m))$/ +S_IWGRP ../os/os_oflags.c /^#define S_IWGRP 0 \/* W for group *\/$/ +S_IWOTH ../os/os_oflags.c /^#define S_IWOTH 0 \/* W for other *\/$/ +S_IWUSR ../os/os_oflags.c /^#define S_IWUSR S_IWRITE \/* W for owner *\/$/ +S_KEYFIRST ../include/btree.h /^#define S_KEYFIRST (S_WRITE | S_DUPFIRST | S_STACK/ +S_KEYLAST ../include/btree.h /^#define S_KEYLAST (S_WRITE | S_DUPLAST | S_STACK)$/ +S_PARENT ../include/btree.h /^#define S_PARENT 0x00800 \/* Lock page pair. *\/$/ +S_READ ../include/btree.h /^#define S_READ 0x00001 \/* Read locks. *\/$/ +S_STACK ../include/btree.h /^#define S_STACK 0x01000 \/* Need a complete stac/ +S_WRITE ../include/btree.h /^#define S_WRITE 0x00002 \/* Write locks. *\/$/ +S_WRPAIR ../include/btree.h /^#define S_WRPAIR (S_WRITE | S_DUPLAST | S_PARENT)$/ +TAILQ_END ../include/queue.h /^#define TAILQ_END(head) NULL$/ +TAILQ_ENTRY ../include/queue.h /^#define TAILQ_ENTRY(type) \\$/ +TAILQ_FIRST ../include/queue.h /^#define TAILQ_FIRST(head) ((head)->tqh_first)$/ +TAILQ_HEAD ../include/queue.h /^#define TAILQ_HEAD(name, type) \\$/ +TAILQ_INIT ../include/queue.h /^#define TAILQ_INIT(head) do { \\$/ +TAILQ_INSERT_AFTER ../include/queue.h /^#define TAILQ_INSERT_AFTER(head, listelm, elm, fie/ +TAILQ_INSERT_BEFORE ../include/queue.h /^#define TAILQ_INSERT_BEFORE(listelm, elm, field) d/ +TAILQ_INSERT_HEAD ../include/queue.h /^#define TAILQ_INSERT_HEAD(head, elm, field) do { / +TAILQ_INSERT_TAIL ../include/queue.h /^#define TAILQ_INSERT_TAIL(head, elm, field) do { / +TAILQ_NEXT ../include/queue.h /^#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_/ +TAILQ_REMOVE ../include/queue.h /^#define TAILQ_REMOVE(head, elm, field) do { \\$/ +TLOOP ../clib/memcpy.c /^#define TLOOP(s) if (t) TLOOP1(s)$/ +TLOOP1 ../clib/memcpy.c /^#define TLOOP1(s) do { s; } while (--t)$/ +TSL_INIT ../mutex/mutex.c /^#define TSL_INIT(x)$/ +TSL_INIT_ERROR ../mutex/mutex.c /^#define TSL_INIT_ERROR 1$/ +TSL_SET ../mutex/mutex.c /^#define TSL_SET(x) (!_check_lock(x, 0, 1))$/ +TSL_UNSET ../mutex/mutex.c /^#define TSL_UNSET(x) _clear_lock(x, 0)$/ +TXNABORT_USAGE ../test/tcl_txn.c /^#define TXNABORT_USAGE "mgrN.txnM abort"$/ +TXNBEGIN_USAGE ../test/tcl_txn.c /^#define TXNBEGIN_USAGE "mgrN begin [parent]"$/ +TXNCHECK_USAGE ../test/tcl_txn.c /^#define TXNCHECK_USAGE "mgrN checkpoint [kbytes] [/ +TXNCLOSE_USAGE ../test/tcl_txn.c /^#define TXNCLOSE_USAGE "mgrN close"$/ +TXNCOMMIT_USAGE ../test/tcl_txn.c /^#define TXNCOMMIT_USAGE "mgrN.txnM commit"$/ +TXNID_USAGE ../test/tcl_txn.c /^#define TXNID_USAGE "mgrN.txnM id"$/ +TXNMGR_USAGE ../test/tcl_txn.c /^#define TXNMGR_USAGE "txn path flags mode [options/ +TXNPREP_USAGE ../test/tcl_txn.c /^#define TXNPREP_USAGE "mgrN.txnM prep"$/ +TXNSTAT_USAGE ../test/tcl_txn.c /^#define TXNSTAT_USAGE "mgrN stat"$/ +TXNUNLINK_USAGE ../test/tcl_txn.c /^#define TXNUNLINK_USAGE "txn_unlink path force"$/ +TXNWIDGET_USAGE ../test/tcl_txn.c /^#define TXNWIDGET_USAGE "mgrN option ?arg arg ...?/ +TXN_ABORTED ../include/txn.h /^#define TXN_ABORTED 2$/ +TXN_BACKWARD_ROLL ../include/db_dispatch.h /^#define TXN_BACKWARD_ROLL -1$/ +TXN_CHECKPOINT ../include/txn.h /^#define TXN_CHECKPOINT 3$/ +TXN_COMMIT ../include/txn.h /^#define TXN_COMMIT 1$/ +TXN_FORWARD_ROLL ../include/db_dispatch.h /^#define TXN_FORWARD_ROLL -2$/ +TXN_INVALID ../include/txn.h /^#define TXN_INVALID 0xffffffff \/* Maxi/ +TXN_MINIMUM ../include/txn.h /^#define TXN_MINIMUM 0x80000000$/ +TXN_OPENFILES ../include/db_dispatch.h /^#define TXN_OPENFILES -3$/ +TXN_PREPARE ../include/txn.h /^#define TXN_PREPARE 2$/ +TXN_PREPARED ../include/txn.h /^#define TXN_PREPARED 3$/ +TXN_REDO ../include/db_dispatch.h /^#define TXN_REDO 1$/ +TXN_REGION_SIZE ../include/txn.h /^#define TXN_REGION_SIZE(N) \\$/ +TXN_RUNNING ../include/txn.h /^#define TXN_RUNNING 1$/ +TXN_UNALLOC ../include/txn.h /^#define TXN_UNALLOC 0$/ +TXN_UNDO ../include/db_dispatch.h /^#define TXN_UNDO 0$/ +TXN_USAGE ../test/tcl_txn.c /^#define TXN_USAGE "mgrN.txnM cmd ?arg arg ...?"$/ +TYPE ../include/db_page.h /^#define TYPE(p) (((PAGE *)p)->type)$/ +Tcl_AppInit ../test/tclAppInit.c /^Tcl_AppInit(interp)$/ +UINT16_T_MAX ../include/db_int.h.src /^#define UINT16_T_MAX 0xffff \/* Maximum 16 bit/ +UINT32_T_MAX ../include/db_int.h.src /^#define UINT32_T_MAX 0xffffffff \/* Maximum 32 bit/ +UNLOCKBUFFER ../include/mp.h /^#define UNLOCKBUFFER(dbmp, bhp) \\$/ +UNLOCKHANDLE ../include/mp.h /^#define UNLOCKHANDLE(dbmp, mutexp) \\$/ +UNLOCKREGION ../include/mp.h /^#define UNLOCKREGION(dbmp) \\$/ +UNLOCK_LOCKREGION ../include/lock.h /^#define UNLOCK_LOCKREGION(lt) \\$/ +UNLOCK_LOGREGION ../include/log.h /^#define UNLOCK_LOGREGION(dblp) \\$/ +UNLOCK_LOGTHREAD ../include/log.h /^#define UNLOCK_LOGTHREAD(dblp) \\$/ +UNLOCK_TXNREGION ../include/txn.h /^#define UNLOCK_TXNREGION(tmgrp) \\$/ +UNLOCK_TXNTHREAD ../include/txn.h /^#define UNLOCK_TXNTHREAD(tmgrp) \\$/ +UPREFIX ../clib/strerror.c /^#define UPREFIX "Unknown error: "$/ +USAGE ../test/test_ext.h /^#define USAGE(AC, R, STR, F) \\$/ +USAGE_GE ../test/test_ext.h /^#define USAGE_GE(AC, DAC, STR, F) \\$/ +USAGE_RANGE ../test/test_ext.h /^#define USAGE_RANGE(AC, RL, RH, STR, F) \\$/ +VERSION_USAGE ../test/utils.c /^#define VERSION_USAGE "db_version"$/ +WORDS_BIGENDIAN ../common/db_byteorder.c /^#define WORDS_BIGENDIAN 1$/ +WRAPPED_CLASS ../include/cxx_int.h /^WRAPPED_CLASS(DbLockTab, DbLockTabImp, DB_LOCKTAB*/ +ZERO_LSN ../include/db_int.h.src /^#define ZERO_LSN(LSN) { \\$/ +_CXX_INT_H_ ../include/cxx_int.h /^#define _CXX_INT_H_$/ +_DB185_H_ ../db185/db185_int.h /^#define _DB185_H_$/ +_DB_185_H_ ../include/db_185.h.src /^#define _DB_185_H_$/ +_DB_AM_H ../include/db_am.h /^#define _DB_AM_H$/ +_DB_CXX_H_ ../include/db_cxx.h /^#define _DB_CXX_H_$/ +_DB_DISPATCH_H ../include/db_dispatch.h /^#define _DB_DISPATCH_H$/ +_DB_H_ ../include/db.h.src /^#define _DB_H_$/ +_DB_INTERNAL_H_ ../include/db_int.h.src /^#define _DB_INTERNAL_H_$/ +_DB_PAGE_H_ ../include/db_page.h /^#define _DB_PAGE_H_$/ +_DB_SWAP_H_ ../include/db_swap.h /^#define _DB_SWAP_H_$/ +_LOG_H_ ../include/log.h /^#define _LOG_H_$/ +_SYS_QUEUE_H_ ../include/queue.h /^#define _SYS_QUEUE_H_$/ +_SYS_SHQUEUE_H_ ../include/shqueue.h /^#define _SYS_SHQUEUE_H_$/ +_TXN_H_ ../include/txn.h /^#define _TXN_H_$/ +__BIT_TYPES_DEFINED__ ../include/db.h.src /^#define __BIT_TYPES_DEFINED__$/ +__BT_LPUT ../include/btree.h /^#define __BT_LPUT(dbp, lock) \\$/ +__BT_TLPUT ../include/btree.h /^#define __BT_TLPUT(dbp, lock) \\$/ +__P ../include/db.h.src /^#define __P(protos) protos \/* ANSI C prototypes / +__R_UNUSED ../include/db_185.h.src /^#define __R_UNUSED 2 \/* UNUSED *\/$/ +__UNUSED_100 ../include/db.h.src /^#define __UNUSED_100 0x000100$/ +__UNUSED_4000 ../include/db.h.src /^#define __UNUSED_4000 0x004000$/ +__absname ../log/log_archive.c /^__absname(pref, name, newnamep)$/ +__account_page ../hash/hash_page.c /^__account_page(hashp, pgno, inout)$/ +__bam_add_mstat ../btree/bt_stat.c /^__bam_add_mstat(from, to)$/ +__bam_add_rstat ../btree/bt_stat.c /^__bam_add_rstat(from, to)$/ +__bam_adj_log ../btree/btree_auto.c /^int __bam_adj_log(logp, txnid, ret_lsnp, flags,$/ +__bam_adj_print ../btree/btree_auto.c /^__bam_adj_print(notused1, dbtp, lsnp, notused2, no/ +__bam_adj_read ../btree/btree_auto.c /^__bam_adj_read(recbuf, argpp)$/ +__bam_adj_recover ../btree/bt_rec.c /^__bam_adj_recover(logp, dbtp, lsnp, redo, info)$/ +__bam_adjindx ../btree/bt_delete.c /^__bam_adjindx(dbp, h, indx, indx_copy, is_insert)$/ +__bam_adjust ../btree/bt_rsearch.c /^__bam_adjust(dbp, t, adjust)$/ +__bam_bdup ../btree/bt_open.c /^__bam_bdup(orig, new)$/ +__bam_broot ../btree/bt_split.c /^__bam_broot(dbp, rootp, lp, rp)$/ +__bam_c_close ../btree/bt_cursor.c /^__bam_c_close(dbc)$/ +__bam_c_del ../btree/bt_cursor.c /^__bam_c_del(dbc, flags)$/ +__bam_c_first ../btree/bt_cursor.c /^__bam_c_first(dbp, cp)$/ +__bam_c_get ../btree/bt_cursor.c /^__bam_c_get(dbc, key, data, flags)$/ +__bam_c_getstack ../btree/bt_cursor.c /^__bam_c_getstack(dbp, cp)$/ +__bam_c_iclose ../btree/bt_cursor.c /^__bam_c_iclose(dbp, dbc)$/ +__bam_c_last ../btree/bt_cursor.c /^__bam_c_last(dbp, cp)$/ +__bam_c_next ../btree/bt_cursor.c /^__bam_c_next(dbp, cp, initial_move)$/ +__bam_c_physdel ../btree/bt_cursor.c /^__bam_c_physdel(dbp, cp, h)$/ +__bam_c_prev ../btree/bt_cursor.c /^__bam_c_prev(dbp, cp)$/ +__bam_c_put ../btree/bt_cursor.c /^__bam_c_put(dbc, key, data, flags)$/ +__bam_c_rget ../btree/bt_cursor.c /^__bam_c_rget(dbp, cp, data, flags)$/ +__bam_c_search ../btree/bt_cursor.c /^__bam_c_search(dbp, cp, key, flags, isrecno, exact/ +__bam_ca_delete ../btree/bt_cursor.c /^__bam_ca_delete(dbp, pgno, indx, curs, key_delete)/ +__bam_ca_di ../btree/bt_cursor.c /^__bam_ca_di(dbp, pgno, indx, adjust)$/ +__bam_ca_dup ../btree/bt_cursor.c /^__bam_ca_dup(dbp, fpgno, first, fi, tpgno, ti)$/ +__bam_ca_move ../btree/bt_cursor.c /^__bam_ca_move(dbp, fpgno, tpgno)$/ +__bam_ca_replace ../btree/bt_cursor.c /^__bam_ca_replace(dbp, pgno, indx, pass)$/ +__bam_ca_split ../btree/bt_cursor.c /^__bam_ca_split(dbp, ppgno, lpgno, rpgno, split_ind/ +__bam_cadjust_log ../btree/btree_auto.c /^int __bam_cadjust_log(logp, txnid, ret_lsnp, flags/ +__bam_cadjust_print ../btree/btree_auto.c /^__bam_cadjust_print(notused1, dbtp, lsnp, notused2/ +__bam_cadjust_read ../btree/btree_auto.c /^__bam_cadjust_read(recbuf, argpp)$/ +__bam_cadjust_recover ../btree/bt_rec.c /^__bam_cadjust_recover(logp, dbtp, lsnp, redo, info/ +__bam_cdel_log ../btree/btree_auto.c /^int __bam_cdel_log(logp, txnid, ret_lsnp, flags,$/ +__bam_cdel_print ../btree/btree_auto.c /^__bam_cdel_print(notused1, dbtp, lsnp, notused2, n/ +__bam_cdel_read ../btree/btree_auto.c /^__bam_cdel_read(recbuf, argpp)$/ +__bam_cdel_recover ../btree/bt_rec.c /^__bam_cdel_recover(logp, dbtp, lsnp, redo, info)$/ +__bam_close ../btree/bt_close.c /^__bam_close(dbp)$/ +__bam_cmp ../btree/bt_compare.c /^__bam_cmp(dbp, k1, e)$/ +__bam_copy ../btree/bt_split.c /^__bam_copy(dbp, pp, cp, nxt, stop)$/ +__bam_cprint ../btree/bt_cursor.c /^__bam_cprint(dbp)$/ +__bam_cursor ../btree/bt_cursor.c /^__bam_cursor(dbp, txn, dbcp)$/ +__bam_defcmp ../btree/bt_compare.c /^__bam_defcmp(a, b)$/ +__bam_defpfx ../btree/bt_compare.c /^__bam_defpfx(a, b)$/ +__bam_delete ../btree/bt_delete.c /^__bam_delete(argdbp, txn, key, flags)$/ +__bam_ditem ../btree/bt_delete.c /^__bam_ditem(dbp, h, indx)$/ +__bam_dpage ../btree/bt_delete.c /^__bam_dpage(dbp, key)$/ +__bam_dpages ../btree/bt_delete.c /^__bam_dpages(dbp, t)$/ +__bam_fixed ../btree/bt_put.c /^__bam_fixed(t, dbt)$/ +__bam_free ../btree/bt_page.c /^__bam_free(dbp, h)$/ +__bam_get ../btree/bt_cursor.c /^__bam_get(argdbp, txn, key, data, flags)$/ +__bam_iitem ../btree/bt_put.c /^__bam_iitem(dbp, hp, indxp, key, data, op, flags)$/ +__bam_init_print ../btree/btree_auto.c /^__bam_init_print(dbenv)$/ +__bam_init_recover ../btree/btree_auto.c /^__bam_init_recover(dbenv)$/ +__bam_isdeleted ../btree/bt_put.c /^__bam_isdeleted(dbp, h, indx, isdeletedp)$/ +__bam_keyalloc ../btree/bt_open.c /^__bam_keyalloc(t)$/ +__bam_lget ../btree/bt_page.c /^__bam_lget(dbp, do_couple, pgno, mode, lockp)$/ +__bam_lookup ../btree/bt_put.c /^__bam_lookup(dbp, key, exactp)$/ +__bam_lput ../btree/bt_page.c /^__bam_lput(dbp, lock)$/ +__bam_lt ../btree/bt_page.c /^__bam_lt(dbp)$/ +__bam_mswap ../btree/bt_conv.c /^__bam_mswap(pg)$/ +__bam_ndup ../btree/bt_put.c /^__bam_ndup(dbp, h, indx)$/ +__bam_new ../btree/bt_page.c /^__bam_new(dbp, type, pagepp)$/ +__bam_nrecs ../btree/bt_rsearch.c /^__bam_nrecs(dbp, rep)$/ +__bam_open ../btree/bt_open.c /^__bam_open(dbp, type, dbinfo)$/ +__bam_ovfl_chk ../btree/bt_cursor.c /^__bam_ovfl_chk(dbp, cp, indx, to_end)$/ +__bam_ovput ../btree/bt_put.c /^__bam_ovput(dbp, h, indx, item)$/ +__bam_page ../btree/bt_split.c /^__bam_page(dbp, pp, cp)$/ +__bam_partial ../btree/bt_put.c /^__bam_partial(dbp, dbt, h, indx, nbytes)$/ +__bam_partsize ../btree/bt_put.c /^__bam_partsize(data, h, indx)$/ +__bam_pg_alloc_log ../btree/btree_auto.c /^int __bam_pg_alloc_log(logp, txnid, ret_lsnp, flag/ +__bam_pg_alloc_print ../btree/btree_auto.c /^__bam_pg_alloc_print(notused1, dbtp, lsnp, notused/ +__bam_pg_alloc_read ../btree/btree_auto.c /^__bam_pg_alloc_read(recbuf, argpp)$/ +__bam_pg_alloc_recover ../btree/bt_rec.c /^__bam_pg_alloc_recover(logp, dbtp, lsnp, redo, inf/ +__bam_pg_free_log ../btree/btree_auto.c /^int __bam_pg_free_log(logp, txnid, ret_lsnp, flags/ +__bam_pg_free_print ../btree/btree_auto.c /^__bam_pg_free_print(notused1, dbtp, lsnp, notused2/ +__bam_pg_free_read ../btree/btree_auto.c /^__bam_pg_free_read(recbuf, argpp)$/ +__bam_pg_free_recover ../btree/bt_rec.c /^__bam_pg_free_recover(logp, dbtp, lsnp, redo, info/ +__bam_pget ../btree/bt_page.c /^__bam_pget(dbp, hp, pgnop, mpool_flags)$/ +__bam_pgin ../btree/bt_conv.c /^__bam_pgin(pg, pp, cookie)$/ +__bam_pgout ../btree/bt_conv.c /^__bam_pgout(pg, pp, cookie)$/ +__bam_pinsert ../btree/bt_split.c /^__bam_pinsert(dbp, parent, lchild, rchild)$/ +__bam_psplit ../btree/bt_split.c /^__bam_psplit(dbp, cp, lp, rp, cleft)$/ +__bam_put ../btree/bt_put.c /^__bam_put(argdbp, txn, key, data, flags)$/ +__bam_repl_log ../btree/btree_auto.c /^int __bam_repl_log(logp, txnid, ret_lsnp, flags,$/ +__bam_repl_print ../btree/btree_auto.c /^__bam_repl_print(notused1, dbtp, lsnp, notused2, n/ +__bam_repl_read ../btree/btree_auto.c /^__bam_repl_read(recbuf, argpp)$/ +__bam_repl_recover ../btree/bt_rec.c /^__bam_repl_recover(logp, dbtp, lsnp, redo, info)$/ +__bam_ritem ../btree/bt_put.c /^__bam_ritem(dbp, h, indx, data)$/ +__bam_root ../btree/bt_split.c /^__bam_root(dbp, cp)$/ +__bam_rsearch ../btree/bt_rsearch.c /^__bam_rsearch(dbp, recnop, flags, stop, exactp)$/ +__bam_rsplit_log ../btree/btree_auto.c /^int __bam_rsplit_log(logp, txnid, ret_lsnp, flags,/ +__bam_rsplit_print ../btree/btree_auto.c /^__bam_rsplit_print(notused1, dbtp, lsnp, notused2,/ +__bam_rsplit_read ../btree/btree_auto.c /^__bam_rsplit_read(recbuf, argpp)$/ +__bam_rsplit_recover ../btree/bt_rec.c /^__bam_rsplit_recover(logp, dbtp, lsnp, redo, info)/ +__bam_search ../btree/bt_search.c /^__bam_search(dbp, key, flags, stop, recnop, exactp/ +__bam_setmeta ../btree/bt_open.c /^__bam_setmeta(dbp, t)$/ +__bam_split ../btree/bt_split.c /^__bam_split(dbp, arg)$/ +__bam_split_log ../btree/btree_auto.c /^int __bam_split_log(logp, txnid, ret_lsnp, flags,$/ +__bam_split_print ../btree/btree_auto.c /^__bam_split_print(notused1, dbtp, lsnp, notused2, / +__bam_split_read ../btree/btree_auto.c /^__bam_split_read(recbuf, argpp)$/ +__bam_split_recover ../btree/bt_rec.c /^__bam_split_recover(logp, dbtp, lsnp, redo, info)$/ +__bam_stat ../btree/bt_stat.c /^__bam_stat(argdbp, spp, db_malloc, flags)$/ +__bam_stkgrow ../btree/bt_search.c /^__bam_stkgrow(t)$/ +__bam_stkrel ../btree/bt_search.c /^__bam_stkrel(dbp)$/ +__bam_sync ../btree/bt_close.c /^__bam_sync(argdbp, flags)$/ +__bam_total ../btree/bt_rsearch.c /^__bam_total(h)$/ +__bam_upstat ../btree/bt_close.c /^__bam_upstat(dbp)$/ +__bhcmp ../mp/mp_sync.c /^__bhcmp(p1, p2)$/ +__bucket_to_page ../hash/hash_page.c /^__bucket_to_page(hashp, n)$/ +__build_data ../log/log_archive.c /^__build_data(dblp, pref, listp, db_malloc)$/ +__cmpfunc ../log/log_archive.c /^__cmpfunc(p1, p2)$/ +__db_abspath ../os/os_abs.c /^__db_abspath(path)$/ +__db_add_recovery ../db/db_dispatch.c /^__db_add_recovery(dbenv, func, ndx)$/ +__db_addpage ../db/db_dup.c /^__db_addpage(dbp, hp, indxp, newfunc)$/ +__db_addpage_log ../db/db_auto.c /^int __db_addpage_log(logp, txnid, ret_lsnp, flags,/ +__db_addpage_print ../db/db_auto.c /^__db_addpage_print(notused1, dbtp, lsnp, notused2,/ +__db_addpage_read ../db/db_auto.c /^__db_addpage_read(recbuf, argpp)$/ +__db_addpage_recover ../db/db_rec.c /^__db_addpage_recover(logp, dbtp, lsnp, redo, info)/ +__db_addrem_log ../db/db_auto.c /^int __db_addrem_log(logp, txnid, ret_lsnp, flags,$/ +__db_addrem_print ../db/db_auto.c /^__db_addrem_print(notused1, dbtp, lsnp, notused2, / +__db_addrem_read ../db/db_auto.c /^__db_addrem_read(recbuf, argpp)$/ +__db_addrem_recover ../db/db_rec.c /^__db_addrem_recover(logp, dbtp, lsnp, redo, info)$/ +__db_appname ../common/db_appinit.c /^__db_appname(dbenv, appname, dir, file, tmp_oflags/ +__db_apprec ../common/db_apprec.c /^__db_apprec(dbenv, flags)$/ +__db_big_log ../db/db_auto.c /^int __db_big_log(logp, txnid, ret_lsnp, flags,$/ +__db_big_print ../db/db_auto.c /^__db_big_print(notused1, dbtp, lsnp, notused2, not/ +__db_big_read ../db/db_auto.c /^__db_big_read(recbuf, argpp)$/ +__db_big_recover ../db/db_rec.c /^__db_big_recover(logp, dbtp, lsnp, redo, info)$/ +__db_byteorder ../common/db_byteorder.c /^__db_byteorder(dbenv, lorder)$/ +__db_calloc ../os/os_alloc.c /^__db_calloc(num, size)$/ +__db_cdelchk ../common/db_err.c /^__db_cdelchk(dbp, flags, isrdonly, isvalid)$/ +__db_cgetchk ../common/db_err.c /^__db_cgetchk(dbp, key, data, flags, isvalid)$/ +__db_close ../os/os_open.c /^__db_close(fd)$/ +__db_convert ../db/db_conv.c /^__db_convert(pg, pp, pagesize, pgin)$/ +__db_cputchk ../common/db_err.c /^__db_cputchk(dbp, key, data, flags, isrdonly, isva/ +__db_dbm_delete ../dbm/dbm.c /^__db_dbm_delete(key)$/ +__db_dbm_fetch ../dbm/dbm.c /^__db_dbm_fetch(key)$/ +__db_dbm_firstkey ../dbm/dbm.c /^__db_dbm_firstkey()$/ +__db_dbm_init ../dbm/dbm.c /^__db_dbm_init(file)$/ +__db_dbm_nextkey ../dbm/dbm.c /^__db_dbm_nextkey(key)$/ +__db_dbm_store ../dbm/dbm.c /^__db_dbm_store(key, dat)$/ +__db_ddup ../db/db_dup.c /^__db_ddup(dbp, pgno, freefunc)$/ +__db_debug_log ../db/db_auto.c /^int __db_debug_log(logp, txnid, ret_lsnp, flags,$/ +__db_debug_print ../db/db_auto.c /^__db_debug_print(notused1, dbtp, lsnp, notused2, n/ +__db_debug_read ../db/db_auto.c /^__db_debug_read(recbuf, argpp)$/ +__db_debug_recover ../db/db_rec.c /^__db_debug_recover(logp, dbtp, lsnp, redo, info)$/ +__db_delchk ../common/db_err.c /^__db_delchk(dbp, key, flags, isrdonly)$/ +__db_dend ../db/db_dup.c /^__db_dend(dbp, pgno, pagep)$/ +__db_dirfree ../include/os_func.h /^#define __db_dirfree __db_jump.j_dirfree$/ +__db_dirlist ../include/os_func.h /^#define __db_dirlist __db_jump.j_dirlist$/ +__db_ditem ../db/db_dup.c /^__db_ditem(dbp, pagep, indx, nbytes)$/ +__db_doff ../db/db_overflow.c /^__db_doff(dbp, pgno, freefunc)$/ +__db_dput ../db/db_dup.c /^__db_dput(dbp, dbt, pp, indxp, newfunc)$/ +__db_drem ../db/db_dup.c /^__db_drem(dbp, pp, indx, freefunc)$/ +__db_dsplit ../db/db_dup.c /^__db_dsplit(dbp, hp, indxp, size, newfunc)$/ +__db_dump ../db/db_pr.c /^__db_dump(dbp, name, all)$/ +__db_ecursor ../common/db_err.c /^__db_ecursor(a, b, c)$/ +__db_edel ../common/db_err.c /^__db_edel(a, b, c, d)$/ +__db_efd ../common/db_err.c /^__db_efd(a, b)$/ +__db_egp ../common/db_err.c /^__db_egp(a, b, c, d, e)$/ +__db_err ../common/db_err.c /^__db_err(dbenv, fmt, va_alist)$/ +__db_estat ../common/db_err.c /^__db_estat(a, b, c, d)$/ +__db_esync ../common/db_err.c /^__db_esync(a, b)$/ +__db_exists ../include/os_func.h /^#define __db_exists __db_jump.j_exists$/ +__db_fcchk ../common/db_err.c /^__db_fcchk(dbenv, name, flags, flag1, flag2)$/ +__db_fchk ../common/db_err.c /^__db_fchk(dbenv, name, flags, ok_flags)$/ +__db_ferr ../common/db_err.c /^__db_ferr(dbenv, name, iscombo)$/ +__db_fileid ../os/os_fid.c /^__db_fileid(dbenv, fname, timestamp, fidp)$/ +__db_fileid_to_db ../log/log_rec.c /^__db_fileid_to_db(logp, dbpp, ndx)$/ +__db_free ../include/os_func.h /^#define __db_free __db_jump.j_free$/ +__db_fsync ../os/os_fsync.c /^__db_fsync(fd)$/ +__db_getchk ../common/db_err.c /^__db_getchk(dbp, key, data, flags)$/ +__db_gethandle ../db/db_thread.c /^__db_gethandle(dbp, am_func, dbpp)$/ +__db_getlockid ../db/db_thread.c /^__db_getlockid(dbp, new_dbp)$/ +__db_goff ../db/db_overflow.c /^__db_goff(dbp, dbt, tlen, pgno, bpp, bpsz)$/ +__db_growregion ../common/db_region.c /^__db_growregion(infop, increment)$/ +__db_hashinit ../common/db_shash.c /^__db_hashinit(begin, nelements)$/ +__db_hcreate ../hsearch/hsearch.c /^__db_hcreate(nel)$/ +__db_hdestroy ../hsearch/hsearch.c /^__db_hdestroy()$/ +__db_home ../common/db_appinit.c /^__db_home(dbenv, db_home, flags)$/ +__db_hsearch ../hsearch/hsearch.c /^__db_hsearch(item, action)$/ +__db_init_print ../db/db_auto.c /^__db_init_print(dbenv)$/ +__db_init_recover ../db/db_auto.c /^__db_init_recover(dbenv)$/ +__db_ioinfo ../include/os_func.h /^#define __db_ioinfo __db_jump.j_ioinfo$/ +__db_isbad ../db/db_pr.c /^__db_isbad(h, die)$/ +__db_keyempty ../common/db_err.c /^__db_keyempty(dbenv)$/ +__db_loadme ../db/db_pr.c /^__db_loadme()$/ +__db_log2 ../common/db_log2.c /^__db_log2(num)$/ +__db_malloc ../os/os_alloc.c /^__db_malloc(size)$/ +__db_mapanon_ok ../os/os_map.c /^__db_mapanon_ok(need_names)$/ +__db_mapfile ../os/os_map.c /^__db_mapfile(path, fd, len, is_rdonly, addr)$/ +__db_mapinit ../os/os_map.c /^__db_mapinit()$/ +__db_mapregion ../os/os_map.c /^__db_mapregion(path, infop)$/ +__db_moff ../db/db_overflow.c /^__db_moff(dbp, dbt, pgno)$/ +__db_mutex_init ../mutex/mutex.c /^__db_mutex_init(mp, off)$/ +__db_mutex_lock ../mutex/mutex.c /^__db_mutex_lock(mp, fd)$/ +__db_mutex_unlock ../mutex/mutex.c /^__db_mutex_unlock(mp, fd)$/ +__db_ndbm_clearerr ../dbm/dbm.c /^__db_ndbm_clearerr(db)$/ +__db_ndbm_close ../dbm/dbm.c /^__db_ndbm_close(db)$/ +__db_ndbm_delete ../dbm/dbm.c /^__db_ndbm_delete(db, key)$/ +__db_ndbm_dirfno ../dbm/dbm.c /^__db_ndbm_dirfno(db)$/ +__db_ndbm_error ../dbm/dbm.c /^__db_ndbm_error(db)$/ +__db_ndbm_fetch ../dbm/dbm.c /^__db_ndbm_fetch(db, key)$/ +__db_ndbm_firstkey ../dbm/dbm.c /^__db_ndbm_firstkey(db)$/ +__db_ndbm_nextkey ../dbm/dbm.c /^__db_ndbm_nextkey(db)$/ +__db_ndbm_open ../dbm/dbm.c /^__db_ndbm_open(file, oflags, mode)$/ +__db_ndbm_pagfno ../dbm/dbm.c /^__db_ndbm_pagfno(db)$/ +__db_ndbm_rdonly ../dbm/dbm.c /^__db_ndbm_rdonly(db)$/ +__db_ndbm_store ../dbm/dbm.c /^__db_ndbm_store(db, key, data, flags)$/ +__db_no_open ../dbm/dbm.c /^__db_no_open()$/ +__db_noop_log ../db/db_auto.c /^int __db_noop_log(logp, txnid, ret_lsnp, flags,$/ +__db_noop_print ../db/db_auto.c /^__db_noop_print(notused1, dbtp, lsnp, notused2, no/ +__db_noop_read ../db/db_auto.c /^__db_noop_read(recbuf, argpp)$/ +__db_noop_recover ../db/db_rec.c /^__db_noop_recover(logp, dbtp, lsnp, redo, info)$/ +__db_oflags ../os/os_oflags.c /^__db_oflags(oflags)$/ +__db_omode ../os/os_oflags.c /^__db_omode(perm)$/ +__db_open ../os/os_open.c /^__db_open(name, arg_flags, ok_flags, mode, fdp)$/ +__db_ovref ../db/db_overflow.c /^__db_ovref(dbp, pgno, adjust)$/ +__db_ovref_log ../db/db_auto.c /^int __db_ovref_log(logp, txnid, ret_lsnp, flags,$/ +__db_ovref_print ../db/db_auto.c /^__db_ovref_print(notused1, dbtp, lsnp, notused2, n/ +__db_ovref_read ../db/db_auto.c /^__db_ovref_read(recbuf, argpp)$/ +__db_ovref_recover ../db/db_rec.c /^__db_ovref_recover(logp, dbtp, lsnp, redo, info)$/ +__db_panic ../common/db_err.c /^__db_panic(dbp)$/ +__db_pgerr ../db/db.c /^__db_pgerr(dbp, pgno)$/ +__db_pgfmt ../db/db.c /^__db_pgfmt(dbp, pgno)$/ +__db_pgin ../db/db_conv.c /^__db_pgin(pg, pagesize, pp)$/ +__db_pgout ../db/db_conv.c /^__db_pgout(pg, pagesize, pp)$/ +__db_pitem ../db/db_dup.c /^__db_pitem(dbp, pagep, indx, nbytes, hdr, data)$/ +__db_poff ../db/db_overflow.c /^__db_poff(dbp, dbt, pgnop, newfunc)$/ +__db_pr ../db/db_pr.c /^__db_pr(p, len)$/ +__db_prbtree ../db/db_pr.c /^__db_prbtree(dbp)$/ +__db_prdb ../db/db_pr.c /^__db_prdb(dbp)$/ +__db_prdbt ../db/db_pr.c /^__db_prdbt(dbtp, checkprint, fp)$/ +__db_prflags ../db/db_pr.c /^__db_prflags(flags, fn, fp)$/ +__db_prhash ../db/db_pr.c /^__db_prhash(dbp)$/ +__db_prinit ../db/db_pr.c /^__db_prinit(fp)$/ +__db_prnpage ../db/db_pr.c /^__db_prnpage(mpf, pgno)$/ +__db_proff ../db/db_pr.c /^__db_proff(vp)$/ +__db_prpage ../db/db_pr.c /^__db_prpage(h, all)$/ +__db_prtree ../db/db_pr.c /^__db_prtree(mpf, all)$/ +__db_psize ../db/db_pr.c /^__db_psize(mpf)$/ +__db_putchk ../common/db_err.c /^__db_putchk(dbp, key, data, flags, isrdonly, isdup/ +__db_puthandle ../db/db_thread.c /^__db_puthandle(dbp)$/ +__db_rattach ../common/db_region.c /^__db_rattach(infop)$/ +__db_rdetach ../common/db_region.c /^__db_rdetach(infop)$/ +__db_rdonly ../common/db_err.c /^__db_rdonly(dbenv, name)$/ +__db_read ../os/os_rw.c /^__db_read(fd, addr, len, nrp)$/ +__db_realloc ../os/os_alloc.c /^__db_realloc(ptr, size)$/ +__db_relink ../db/db_dup.c /^__db_relink(dbp, pagep, new_next, needlock)$/ +__db_relink_log ../db/db_auto.c /^int __db_relink_log(logp, txnid, ret_lsnp, flags,$/ +__db_relink_print ../db/db_auto.c /^__db_relink_print(notused1, dbtp, lsnp, notused2, / +__db_relink_read ../db/db_auto.c /^__db_relink_read(recbuf, argpp)$/ +__db_relink_recover ../db/db_rec.c /^__db_relink_recover(logp, dbtp, lsnp, redo, info)$/ +__db_ret ../db/db_ret.c /^__db_ret(dbp, h, indx, dbt, memp, memsize)$/ +__db_retcopy ../db/db_ret.c /^__db_retcopy(dbt, data, len, memp, memsize, db_mal/ +__db_rgrow ../common/db_region.c /^__db_rgrow(infop, new_size)$/ +__db_rpath ../os/os_rpath.c /^__db_rpath(path)$/ +__db_rreattach ../common/db_region.c /^__db_rreattach(infop, new_size)$/ +__db_runlink ../common/db_region.c /^__db_runlink(infop, force)$/ +__db_seek ../include/os_func.h /^#define __db_seek __db_jump.j_seek$/ +__db_shalloc ../common/db_salloc.c /^__db_shalloc(p, len, align, retp)$/ +__db_shalloc_count ../common/db_salloc.c /^__db_shalloc_count(addr)$/ +__db_shalloc_dump ../common/db_salloc.c /^__db_shalloc_dump(addr, fp)$/ +__db_shalloc_free ../common/db_salloc.c /^__db_shalloc_free(regionp, ptr)$/ +__db_shalloc_init ../common/db_salloc.c /^__db_shalloc_init(area, size)$/ +__db_shsizeof ../common/db_salloc.c /^__db_shsizeof(ptr)$/ +__db_sleep ../include/os_func.h /^#define __db_sleep __db_jump.j_sleep$/ +__db_split_log ../db/db_auto.c /^int __db_split_log(logp, txnid, ret_lsnp, flags,$/ +__db_split_print ../db/db_auto.c /^__db_split_print(notused1, dbtp, lsnp, notused2, n/ +__db_split_read ../db/db_auto.c /^__db_split_read(recbuf, argpp)$/ +__db_split_recover ../db/db_rec.c /^__db_split_recover(logp, dbtp, lsnp, redo, info)$/ +__db_statchk ../common/db_err.c /^__db_statchk(dbp, flags)$/ +__db_strdup ../os/os_alloc.c /^__db_strdup(str)$/ +__db_syncchk ../common/db_err.c /^__db_syncchk(dbp, flags)$/ +__db_tablesize ../common/db_shash.c /^__db_tablesize(n_buckets)$/ +__db_txnlist_add ../db/db_dispatch.c /^__db_txnlist_add(listp, txnid)$/ +__db_txnlist_end ../db/db_dispatch.c /^__db_txnlist_end(listp)$/ +__db_txnlist_find ../db/db_dispatch.c /^__db_txnlist_find(listp, txnid)$/ +__db_txnlist_gen ../db/db_dispatch.c /^__db_txnlist_gen(listp, incr)$/ +__db_txnlist_init ../db/db_dispatch.c /^__db_txnlist_init(retp)$/ +__db_txnlist_print ../db/db_dispatch.c /^__db_txnlist_print(listp)$/ +__db_unlink ../os/os_unlink.c /^__db_unlink(path)$/ +__db_unlinkregion ../os/os_map.c /^__db_unlinkregion(name, infop)$/ +__db_unmapfile ../os/os_map.c /^__db_unmapfile(addr, len)$/ +__db_unmapregion ../os/os_map.c /^__db_unmapregion(infop)$/ +__db_write ../os/os_rw.c /^__db_write(fd, addr, len, nwp)$/ +__db_yield ../include/os_func.h /^#define __db_yield __db_jump.j_yield$/ +__dd_abort ../lock/lock_deadlock.c /^__dd_abort(dbenv, info)$/ +__dd_build ../lock/lock_deadlock.c /^__dd_build(dbenv, bmp, nlockers, idmap)$/ +__dd_debug ../lock/lock_deadlock.c /^__dd_debug(dbenv, idmap, bitmap, nlockers)$/ +__dd_find ../lock/lock_deadlock.c /^__dd_find(bmp, idmap, nlockers)$/ +__ham_add_dup ../hash/hash_dup.c /^__ham_add_dup(hashp, hcp, nval, flags)$/ +__ham_add_el ../hash/hash_page.c /^__ham_add_el(hashp, hcp, key, val, type)$/ +__ham_add_ovflpage ../hash/hash_page.c /^__ham_add_ovflpage(hashp, pagep, release, pp)$/ +__ham_c_close ../hash/hash.c /^__ham_c_close(cursor)$/ +__ham_c_del ../hash/hash.c /^__ham_c_del(cursor, flags)$/ +__ham_c_get ../hash/hash.c /^__ham_c_get(cursor, key, data, flags)$/ +__ham_c_iclose ../hash/hash.c /^__ham_c_iclose(dbp, dbc)$/ +__ham_c_init ../hash/hash.c /^__ham_c_init(dbp, txnid, dbcp)$/ +__ham_c_put ../hash/hash.c /^__ham_c_put(cursor, key, data, flags)$/ +__ham_c_update ../hash/hash.c /^__ham_c_update(hcp, chg_pgno, len, add, is_dup)$/ +__ham_call_hash ../hash/hash.c /^__ham_call_hash(hashp, k, len)$/ +__ham_check_move ../hash/hash_dup.c /^__ham_check_move(hashp, hcp, add_len)$/ +__ham_close ../hash/hash.c /^__ham_close(dbp)$/ +__ham_copy_item ../hash/hash_page.c /^__ham_copy_item(hashp, src_page, src_ndx, dest_pag/ +__ham_copypage_log ../hash/hash_auto.c /^int __ham_copypage_log(logp, txnid, ret_lsnp, flag/ +__ham_copypage_print ../hash/hash_auto.c /^__ham_copypage_print(notused1, dbtp, lsnp, notused/ +__ham_copypage_read ../hash/hash_auto.c /^__ham_copypage_read(recbuf, argpp)$/ +__ham_copypage_recover ../hash/hash_rec.c /^__ham_copypage_recover(logp, dbtp, lsnp, redo, inf/ +__ham_cursor ../hash/hash.c /^__ham_cursor(dbp, txnid, dbcp)$/ +__ham_del_page ../hash/hash_page.c /^__ham_del_page(dbp, pagep)$/ +__ham_del_pair ../hash/hash_page.c /^__ham_del_pair(hashp, cursorp, reclaim_page)$/ +__ham_delete ../hash/hash.c /^__ham_delete(dbp, txn, key, flags)$/ +__ham_dirty_page ../hash/hash_page.c /^__ham_dirty_page(hashp, pagep)$/ +__ham_dpair ../hash/hash_page.c /^__ham_dpair(dbp, p, pndx)$/ +__ham_dump_bucket ../hash/hash_debug.c /^__ham_dump_bucket(hashp, bucket)$/ +__ham_dup_convert ../hash/hash_dup.c /^__ham_dup_convert(hashp, hcp)$/ +__ham_dup_return ../hash/hash.c /^__ham_dup_return(hashp, hcp, val, flags)$/ +__ham_expand_table ../hash/hash.c /^__ham_expand_table(hashp)$/ +__ham_func2 ../hash/hash_func.c /^__ham_func2(key, len)$/ +__ham_func3 ../hash/hash_func.c /^__ham_func3(key, len)$/ +__ham_func4 ../hash/hash_func.c /^__ham_func4(key, len)$/ +__ham_func5 ../hash/hash_func.c /^__ham_func5(key, len)$/ +__ham_get ../hash/hash.c /^__ham_get(dbp, txn, key, data, flags)$/ +__ham_get_cpage ../hash/hash_page.c /^__ham_get_cpage(hashp, hcp, mode)$/ +__ham_get_page ../hash/hash_page.c /^__ham_get_page(dbp, addr, pagep)$/ +__ham_hdup ../hash/hash.c /^__ham_hdup(orig, new)$/ +__ham_init_dbt ../hash/hash.c /^__ham_init_dbt(dbt, size, bufp, sizep)$/ +__ham_init_htab ../hash/hash.c /^__ham_init_htab(hashp, nelem, ffactor)$/ +__ham_init_ovflpages ../hash/hash_page.c /^__ham_init_ovflpages(hp)$/ +__ham_init_print ../hash/hash_auto.c /^__ham_init_print(dbenv)$/ +__ham_init_recover ../hash/hash_auto.c /^__ham_init_recover(dbenv)$/ +__ham_insdel_log ../hash/hash_auto.c /^int __ham_insdel_log(logp, txnid, ret_lsnp, flags,/ +__ham_insdel_print ../hash/hash_auto.c /^__ham_insdel_print(notused1, dbtp, lsnp, notused2,/ +__ham_insdel_read ../hash/hash_auto.c /^__ham_insdel_read(recbuf, argpp)$/ +__ham_insdel_recover ../hash/hash_rec.c /^__ham_insdel_recover(logp, dbtp, lsnp, redo, info)/ +__ham_item ../hash/hash_page.c /^__ham_item(hashp, cursorp, mode)$/ +__ham_item_done ../hash/hash_page.c /^__ham_item_done(hashp, cursorp, dirty)$/ +__ham_item_first ../hash/hash_page.c /^__ham_item_first(hashp, cursorp, mode)$/ +__ham_item_init ../hash/hash_page.c /^__ham_item_init(cursorp)$/ +__ham_item_last ../hash/hash_page.c /^__ham_item_last(hashp, cursorp, mode)$/ +__ham_item_next ../hash/hash_page.c /^__ham_item_next(hashp, cursorp, mode)$/ +__ham_item_prev ../hash/hash_page.c /^__ham_item_prev(hashp, cursorp, mode)$/ +__ham_item_reset ../hash/hash_page.c /^__ham_item_reset(hashp, cursorp)$/ +__ham_lock_bucket ../hash/hash_page.c /^__ham_lock_bucket(dbp, hcp, mode)$/ +__ham_lookup ../hash/hash.c /^__ham_lookup(hashp, hcp, key, sought, mode)$/ +__ham_make_dup ../hash/hash_dup.c /^__ham_make_dup(notdup, duplicate, bufp, sizep)$/ +__ham_move_offpage ../hash/hash_dup.c /^__ham_move_offpage(hashp, pagep, ndx, pgno)$/ +__ham_mswap ../hash/hash_conv.c /^__ham_mswap(pg)$/ +__ham_new_page ../hash/hash_page.c /^__ham_new_page(hashp, addr, type, pp)$/ +__ham_newpage_log ../hash/hash_auto.c /^int __ham_newpage_log(logp, txnid, ret_lsnp, flags/ +__ham_newpage_print ../hash/hash_auto.c /^__ham_newpage_print(notused1, dbtp, lsnp, notused2/ +__ham_newpage_read ../hash/hash_auto.c /^__ham_newpage_read(recbuf, argpp)$/ +__ham_newpage_recover ../hash/hash_rec.c /^__ham_newpage_recover(logp, dbtp, lsnp, redo, info/ +__ham_newpgno_log ../hash/hash_auto.c /^int __ham_newpgno_log(logp, txnid, ret_lsnp, flags/ +__ham_newpgno_print ../hash/hash_auto.c /^__ham_newpgno_print(notused1, dbtp, lsnp, notused2/ +__ham_newpgno_read ../hash/hash_auto.c /^__ham_newpgno_read(recbuf, argpp)$/ +__ham_newpgno_recover ../hash/hash_rec.c /^__ham_newpgno_recover(logp, dbtp, lsnp, redo, info/ +__ham_next_cpage ../hash/hash_page.c /^__ham_next_cpage(hashp, hcp, pgno, dirty, flags)$/ +__ham_onpage_replace ../hash/hash_page.c /^__ham_onpage_replace(pagep, pgsize, ndx, off, chan/ +__ham_open ../hash/hash.c /^__ham_open(dbp, dbinfo)$/ +__ham_overflow_page ../hash/hash_page.c /^__ham_overflow_page(dbp, type, pp)$/ +__ham_overwrite ../hash/hash.c /^__ham_overwrite(hashp, hcp, nval)$/ +__ham_ovfl_log ../hash/hash_auto.c /^int __ham_ovfl_log(logp, txnid, ret_lsnp, flags,$/ +__ham_ovfl_print ../hash/hash_auto.c /^__ham_ovfl_print(notused1, dbtp, lsnp, notused2, n/ +__ham_ovfl_read ../hash/hash_auto.c /^__ham_ovfl_read(recbuf, argpp)$/ +__ham_ovfl_recover ../hash/hash_rec.c /^__ham_ovfl_recover(logp, dbtp, lsnp, redo, info)$/ +__ham_pgin ../hash/hash_conv.c /^__ham_pgin(pg, pp, cookie)$/ +__ham_pgout ../hash/hash_conv.c /^__ham_pgout(pg, pp, cookie)$/ +__ham_put ../hash/hash.c /^__ham_put(dbp, txn, key, data, flags)$/ +__ham_put_page ../hash/hash_page.c /^__ham_put_page(dbp, pagep, is_dirty)$/ +__ham_putitem ../hash/hash_page.c /^__ham_putitem(p, dbt, type)$/ +__ham_replace_log ../hash/hash_auto.c /^int __ham_replace_log(logp, txnid, ret_lsnp, flags/ +__ham_replace_print ../hash/hash_auto.c /^__ham_replace_print(notused1, dbtp, lsnp, notused2/ +__ham_replace_read ../hash/hash_auto.c /^__ham_replace_read(recbuf, argpp)$/ +__ham_replace_recover ../hash/hash_rec.c /^__ham_replace_recover(logp, dbtp, lsnp, redo, info/ +__ham_replpair ../hash/hash_page.c /^__ham_replpair(hashp, hcp, dbt, make_dup)$/ +__ham_reputpair ../hash/hash_page.c /^__ham_reputpair(p, psize, ndx, key, data)$/ +__ham_split_page ../hash/hash_page.c /^__ham_split_page(hashp, obucket, nbucket)$/ +__ham_splitdata_log ../hash/hash_auto.c /^int __ham_splitdata_log(logp, txnid, ret_lsnp, fla/ +__ham_splitdata_print ../hash/hash_auto.c /^__ham_splitdata_print(notused1, dbtp, lsnp, notuse/ +__ham_splitdata_read ../hash/hash_auto.c /^__ham_splitdata_read(recbuf, argpp)$/ +__ham_splitdata_recover ../hash/hash_rec.c /^__ham_splitdata_recover(logp, dbtp, lsnp, redo, in/ +__ham_splitmeta_log ../hash/hash_auto.c /^int __ham_splitmeta_log(logp, txnid, ret_lsnp, fla/ +__ham_splitmeta_print ../hash/hash_auto.c /^__ham_splitmeta_print(notused1, dbtp, lsnp, notuse/ +__ham_splitmeta_read ../hash/hash_auto.c /^__ham_splitmeta_read(recbuf, argpp)$/ +__ham_splitmeta_recover ../hash/hash_rec.c /^__ham_splitmeta_recover(logp, dbtp, lsnp, redo, in/ +__ham_stat ../hash/hash_stat.c /^__ham_stat(dbp, fp)$/ +__ham_sync ../hash/hash.c /^__ham_sync(dbp, flags)$/ +__lock_checklocker ../lock/lock.c /^__lock_checklocker(lt, lockp, do_remove)$/ +__lock_cmp ../lock/lock_util.c /^__lock_cmp(dbt, lock_obj)$/ +__lock_count_locks ../lock/lock_region.c /^__lock_count_locks(lrp)$/ +__lock_count_objs ../lock/lock_region.c /^__lock_count_objs(lrp)$/ +__lock_dump_locker ../lock/lock_region.c /^__lock_dump_locker(lt, op, fp)$/ +__lock_dump_object ../lock/lock_region.c /^__lock_dump_object(lt, op, fp)$/ +__lock_dump_region ../lock/lock_region.c /^__lock_dump_region(lt, area, fp)$/ +__lock_dump_status ../lock/lock_region.c /^__lock_dump_status(status)$/ +__lock_freeobj ../lock/lock.c /^__lock_freeobj(lt, obj)$/ +__lock_get_internal ../lock/lock.c /^__lock_get_internal(lt, locker, flags, obj, lock_m/ +__lock_getobj ../lock/lock.c /^__lock_getobj(lt, locker, dbt, type, objp)$/ +__lock_grow_region ../lock/lock_region.c /^__lock_grow_region(lt, which, howmuch)$/ +__lock_is_locked ../lock/lock.c /^__lock_is_locked(lt, locker, dbt, mode)$/ +__lock_lhash ../lock/lock_util.c /^__lock_lhash(lock_obj)$/ +__lock_locker_cmp ../lock/lock_util.c /^__lock_locker_cmp(locker, lock_obj)$/ +__lock_locker_hash ../lock/lock_util.c /^__lock_locker_hash(locker)$/ +__lock_ohash ../lock/lock_util.c /^__lock_ohash(dbt)$/ +__lock_printlock ../lock/lock.c /^__lock_printlock(lt, lp, ispgno)$/ +__lock_put_internal ../lock/lock.c /^__lock_put_internal(lt, lockp, do_all)$/ +__lock_remove_waiter ../lock/lock.c /^__lock_remove_waiter(lt, sh_obj, lockp, status)$/ +__lock_reset_region ../lock/lock_region.c /^__lock_reset_region(lt)$/ +__lock_tabinit ../lock/lock_region.c /^__lock_tabinit(dbenv, lrp)$/ +__lock_validate_region ../lock/lock_region.c /^__lock_validate_region(lt)$/ +__log_add_logid ../log/log_rec.c /^__log_add_logid(logp, dbp, ndx)$/ +__log_close_files ../log/log_rec.c /^__log_close_files(logp)$/ +__log_fill ../log/log_put.c /^__log_fill(dblp, lsn, addr, len)$/ +__log_find ../log/log.c /^__log_find(dblp, find_first, valp)$/ +__log_findckp ../log/log_findckp.c /^__log_findckp(lp, lsnp)$/ +__log_flush ../log/log_put.c /^__log_flush(dblp, lsn)$/ +__log_get ../log/log_get.c /^__log_get(dblp, alsn, dbt, flags, silent)$/ +__log_init_print ../log/log_auto.c /^__log_init_print(dbenv)$/ +__log_init_recover ../log/log_auto.c /^__log_init_recover(dbenv)$/ +__log_name ../log/log_put.c /^__log_name(dblp, filenumber, namep)$/ +__log_newfd ../log/log_put.c /^__log_newfd(dblp)$/ +__log_open_file ../log/log_rec.c /^__log_open_file(lp, uid, name, ftype, ndx)$/ +__log_put ../log/log_put.c /^__log_put(dblp, lsn, dbt, flags)$/ +__log_putr ../log/log_put.c /^__log_putr(dblp, lsn, dbt, prev)$/ +__log_recover ../log/log.c /^__log_recover(dblp)$/ +__log_register_log ../log/log_auto.c /^int __log_register_log(logp, txnid, ret_lsnp, flag/ +__log_register_print ../log/log_auto.c /^__log_register_print(notused1, dbtp, lsnp, notused/ +__log_register_read ../log/log_auto.c /^__log_register_read(recbuf, argpp)$/ +__log_register_recover ../log/log_rec.c /^__log_register_recover(logp, dbtp, lsnp, redo, inf/ +__log_rem_logid ../log/log_rec.c /^__log_rem_logid(logp, ndx)$/ +__log_valid ../log/log.c /^__log_valid(dblp, lp, cnt)$/ +__log_write ../log/log_put.c /^__log_write(dblp, addr, len)$/ +__memp_bhfree ../mp/mp_bh.c /^__memp_bhfree(dbmp, mfp, bhp, free_mem)$/ +__memp_bhwrite ../mp/mp_bh.c /^__memp_bhwrite(dbmp, mfp, bhp, restartp, wrotep)$/ +__memp_dump_region ../mp/mp_pr.c /^__memp_dump_region(dbmp, area, fp)$/ +__memp_fn ../mp/mp_pr.c /^__memp_fn(dbmfp)$/ +__memp_fns ../mp/mp_pr.c /^__memp_fns(dbmp, mfp)$/ +__memp_fopen ../mp/mp_fopen.c /^__memp_fopen(dbmp, mfp, path, flags, mode, pagesiz/ +__memp_fsync ../mp/mp_sync.c /^__memp_fsync(dbmfp)$/ +__memp_mf_close ../mp/mp_fopen.c /^__memp_mf_close(dbmp, dbmfp)$/ +__memp_mf_open ../mp/mp_fopen.c /^__memp_mf_open(dbmp, path, pagesize, last_pgno, fi/ +__memp_pbh ../mp/mp_pr.c /^__memp_pbh(dbmp, bhp, fmap, fp)$/ +__memp_pg ../mp/mp_bh.c /^__memp_pg(dbmfp, bhp, is_pgin)$/ +__memp_pgread ../mp/mp_bh.c /^__memp_pgread(dbmfp, bhp, can_create)$/ +__memp_pgwrite ../mp/mp_bh.c /^__memp_pgwrite(dbmfp, bhp, restartp, wrotep)$/ +__memp_ralloc ../mp/mp_region.c /^__memp_ralloc(dbmp, len, offsetp, retp)$/ +__memp_ropen ../mp/mp_region.c /^__memp_ropen(dbmp, path, cachesize, mode, is_priva/ +__memp_upgrade ../mp/mp_bh.c /^__memp_upgrade(dbmp, dbmfp, mfp)$/ +__mp_xxx_fd ../mp/mp_sync.c /^__mp_xxx_fd(dbmfp, fdp)$/ +__mpe_fsync ../os/os_fsync.c /^__mpe_fsync(fd)$/ +__os_close ../include/os_func.h /^#define __os_close __db_jump.j_close \/* __db_clos/ +__os_dirfree ../os/os_dir.c /^__os_dirfree(names, cnt)$/ +__os_dirlist ../os/os_dir.c /^__os_dirlist(dir, namesp, cntp)$/ +__os_exists ../os/os_stat.c /^__os_exists(path, isdirp)$/ +__os_fsync ../include/os_func.h /^#define __os_fsync __db_jump.j_fsync \/* __db_fsyn/ +__os_ioinfo ../os/os_stat.c /^__os_ioinfo(path, fd, mbytesp, bytesp, iosizep)$/ +__os_map ../os/os_map.c /^__os_map(path, fd, len, is_region, is_anonymous, i/ +__os_open ../include/os_func.h /^#define __os_open __db_jump.j_open \/* __db_open i/ +__os_read ../include/os_func.h /^#define __os_read __db_jump.j_read \/* __db_read i/ +__os_seek ../os/os_seek.c /^__os_seek(fd, pgsize, pageno, relative, isrewind, / +__os_shmget ../os/os_map.c /^__os_shmget(path, infop)$/ +__os_sleep ../os/os_sleep.c /^__os_sleep(secs, usecs)$/ +__os_spin ../os/os_spin.c /^__os_spin()$/ +__os_unlink ../include/os_func.h /^#define __os_unlink __db_jump.j_unlink \/* __db_un/ +__os_write ../include/os_func.h /^#define __os_write __db_jump.j_write \/* __db_writ/ +__ram_add ../btree/bt_recno.c /^__ram_add(dbp, recnop, data, flags, bi_flags)$/ +__ram_c_close ../btree/bt_recno.c /^__ram_c_close(dbc)$/ +__ram_c_del ../btree/bt_recno.c /^__ram_c_del(dbc, flags)$/ +__ram_c_get ../btree/bt_recno.c /^__ram_c_get(dbc, key, data, flags)$/ +__ram_c_iclose ../btree/bt_recno.c /^__ram_c_iclose(dbp, dbc)$/ +__ram_c_put ../btree/bt_recno.c /^__ram_c_put(dbc, key, data, flags)$/ +__ram_ca ../btree/bt_recno.c /^__ram_ca(dbp, recno, op)$/ +__ram_close ../btree/bt_recno.c /^__ram_close(argdbp)$/ +__ram_cprint ../btree/bt_recno.c /^__ram_cprint(dbp)$/ +__ram_cursor ../btree/bt_recno.c /^__ram_cursor(dbp, txn, dbcp)$/ +__ram_delete ../btree/bt_delete.c /^__ram_delete(argdbp, txn, key, flags)$/ +__ram_fmap ../btree/bt_recno.c /^__ram_fmap(dbp, top)$/ +__ram_get ../btree/bt_recno.c /^__ram_get(argdbp, txn, key, data, flags)$/ +__ram_getno ../btree/bt_recno.c /^__ram_getno(dbp, key, rep, can_create)$/ +__ram_iget ../btree/bt_recno.c /^__ram_iget(dbp, key, data)$/ +__ram_open ../btree/bt_recno.c /^__ram_open(dbp, type, dbinfo)$/ +__ram_put ../btree/bt_recno.c /^__ram_put(argdbp, txn, key, data, flags)$/ +__ram_root ../btree/bt_split.c /^__ram_root(dbp, rootp, lp, rp)$/ +__ram_snapshot ../btree/bt_recno.c /^__ram_snapshot(dbp)$/ +__ram_source ../btree/bt_recno.c /^__ram_source(dbp, rp, fname)$/ +__ram_sync ../btree/bt_recno.c /^__ram_sync(argdbp, flags)$/ +__ram_update ../btree/bt_recno.c /^__ram_update(dbp, recno, can_create)$/ +__ram_vmap ../btree/bt_recno.c /^__ram_vmap(dbp, top)$/ +__ram_writeback ../btree/bt_recno.c /^__ram_writeback(dbp)$/ +__txn_check_running ../txn/txn.c /^__txn_check_running(txnp)$/ +__txn_ckp_log ../txn/txn_auto.c /^int __txn_ckp_log(logp, txnid, ret_lsnp, flags,$/ +__txn_ckp_print ../txn/txn_auto.c /^__txn_ckp_print(notused1, dbtp, lsnp, notused2, no/ +__txn_ckp_read ../txn/txn_auto.c /^__txn_ckp_read(recbuf, argpp)$/ +__txn_ckp_recover ../txn/txn_rec.c /^__txn_ckp_recover(logp, dbtp, lsnp, redo, info)$/ +__txn_end ../txn/txn.c /^__txn_end(txnp, is_commit)$/ +__txn_grow_region ../txn/txn.c /^__txn_grow_region(tp)$/ +__txn_init ../txn/txn.c /^__txn_init(txn_region)$/ +__txn_init_print ../txn/txn_auto.c /^__txn_init_print(dbenv)$/ +__txn_init_recover ../txn/txn_auto.c /^__txn_init_recover(dbenv)$/ +__txn_regop_log ../txn/txn_auto.c /^int __txn_regop_log(logp, txnid, ret_lsnp, flags,$/ +__txn_regop_print ../txn/txn_auto.c /^__txn_regop_print(notused1, dbtp, lsnp, notused2, / +__txn_regop_read ../txn/txn_auto.c /^__txn_regop_read(recbuf, argpp)$/ +__txn_regop_recover ../txn/txn_rec.c /^__txn_regop_recover(logp, dbtp, lsnp, redo, info)$/ +__txn_undo ../txn/txn.c /^__txn_undo(txnp)$/ +__txn_validate_region ../txn/txn.c /^__txn_validate_region(tp)$/ +__usermem ../log/log_archive.c /^__usermem(listp, cmpfunc)$/ +_btree_ext_h_ ../include/btree_ext.h /^#define _btree_ext_h_$/ +_clib_ext_h_ ../include/clib_ext.h /^#define _clib_ext_h_$/ +_common_ext_h_ ../include/common_ext.h /^#define _common_ext_h_$/ +_db_ext_h_ ../include/db_ext.h /^#define _db_ext_h_$/ +_hash_ext_h_ ../include/hash_ext.h /^#define _hash_ext_h_$/ +_lock_ext_h_ ../include/lock_ext.h /^#define _lock_ext_h_$/ +_log_ext_h_ ../include/log_ext.h /^#define _log_ext_h_$/ +_mp_ext_h_ ../include/mp_ext.h /^#define _mp_ext_h_$/ +_mutex_ext_h_ ../include/mutex_ext.h /^#define _mutex_ext_h_$/ +_os_ext_h_ ../include/os_ext.h /^#define _os_ext_h_$/ +_txn_ext_h_ ../include/txn_ext.h /^#define _txn_ext_h_$/ +appinit ../include/db_cxx.h /^\/\/ call appinit() before any other db activity (/ +args_cmd ../test/utils.c /^args_cmd(cd, interp, argc, argv)$/ +bam_AUTO_H ../include/btree_auto.h /^#define bam_AUTO_H$/ +const ../include/db.h.src /^#define const$/ +db185_close ../db185/db185.c /^db185_close(db185p)$/ +db185_del ../db185/db185.c /^db185_del(db185p, key185, flags)$/ +db185_fd ../db185/db185.c /^db185_fd(db185p)$/ +db185_get ../db185/db185.c /^db185_get(db185p, key185, data185, flags)$/ +db185_put ../db185/db185.c /^db185_put(db185p, key185, data185, flags)$/ +db185_seq ../db185/db185.c /^db185_seq(db185p, key185, data185, flags)$/ +db185_sync ../db185/db185.c /^db185_sync(db185p, flags)$/ +db_AUTO_H ../include/db_auto.h /^#define db_AUTO_H$/ +db_appexit ../common/db_appinit.c /^db_appexit(dbenv)$/ +db_appinit ../common/db_appinit.c /^db_appinit(db_home, db_config, dbenv, flags)$/ +db_close ../db/db.c /^db_close(dbp, flags)$/ +db_del_cmd ../test/utils.c /^db_del_cmd(interp, argc, argv, dbp)$/ +db_fd ../db/db.c /^db_fd(dbp, fdp)$/ +db_get_cmd ../test/utils.c /^db_get_cmd(interp, argc, argv, dbp)$/ +db_getbin_cmd ../test/utils.c /^db_getbin_cmd(interp, argc, argv, dbp)$/ +db_jump_set ../os/os_config.c /^db_jump_set(func, which)$/ +db_open ../db/db.c /^db_open(fname, type, flags, mode, dbenv, dbinfo, d/ +db_put_cmd ../test/utils.c /^db_put_cmd(interp, argc, argv, dbp)$/ +db_putbin_cmd ../test/utils.c /^db_putbin_cmd(interp, argc, argv, dbp)$/ +db_value_set ../os/os_config.c /^db_value_set(value, which)$/ +db_version ../common/db_appinit.c /^db_version(majverp, minverp, patchp)$/ +dbc_del_cmd ../test/utils.c /^dbc_del_cmd(interp, argc, argv, dbc)$/ +dbc_get_cmd ../test/utils.c /^dbc_get_cmd(interp, argc, argv, dbc)$/ +dbc_getbin_cmd ../test/utils.c /^dbc_getbin_cmd(interp, argc, argv, dbc)$/ +dbc_put_cmd ../test/utils.c /^dbc_put_cmd(interp, argc, argv, dbc)$/ +dbcursor_cmd ../test/utils.c /^dbcursor_cmd(cd_dbc, interp, argc, argv)$/ +dbenv_cmd ../test/utils.c /^dbenv_cmd(notused, interp, argc, argv)$/ +dbm_clearerr ../include/db.h.src /^#define dbm_clearerr(a) __db_ndbm_clearerr(a)$/ +dbm_close ../include/db.h.src /^#define dbm_close(a) __db_ndbm_close(a)$/ +dbm_delete ../include/db.h.src /^#define dbm_delete(a, b) __db_ndbm_delete(a, b)$/ +dbm_delete_cmd ../test/tcl_dbm.c /^dbm_delete_cmd(notused, interp, argc, argv)$/ +dbm_dirfno ../include/db.h.src /^#define dbm_dirfno(a) __db_ndbm_dirfno(a)$/ +dbm_error ../include/db.h.src /^#define dbm_error(a) __db_ndbm_error(a)$/ +dbm_fetch ../include/db.h.src /^#define dbm_fetch(a, b) __db_ndbm_fetch(a, b)$/ +dbm_fetch_cmd ../test/tcl_dbm.c /^dbm_fetch_cmd(notused, interp, argc, argv)$/ +dbm_first_cmd ../test/tcl_dbm.c /^dbm_first_cmd(notused, interp, argc, argv)$/ +dbm_firstkey ../include/db.h.src /^#define dbm_firstkey(a) __db_ndbm_firstkey(a)$/ +dbm_next_cmd ../test/tcl_dbm.c /^dbm_next_cmd(notused, interp, argc, argv)$/ +dbm_nextkey ../include/db.h.src /^#define dbm_nextkey(a) __db_ndbm_nextkey(a)$/ +dbm_open ../include/db.h.src /^#define dbm_open(a, b, c) __db_ndbm_open(a, b, c)$/ +dbm_pagfno ../include/db.h.src /^#define dbm_pagfno(a) __db_ndbm_pagfno(a)$/ +dbm_rdonly ../include/db.h.src /^#define dbm_rdonly(a) __db_ndbm_rdonly(a)$/ +dbm_store ../include/db.h.src /^#define dbm_store(a, b, c, d) __db_ndbm_store(a, b/ +dbm_store_cmd ../test/tcl_dbm.c /^dbm_store_cmd(notused, interp, argc, argv)$/ +dbminit ../include/db.h.src /^#define dbminit(a) __db_dbm_init(a)$/ +dbminit_cmd ../test/tcl_dbm.c /^dbminit_cmd(notused, interp, argc, argv)$/ +dbopen ../db185/db185.c /^dbopen(file, oflags, mode, type, openinfo)$/ +dbopen_cmd ../test/utils.c /^dbopen_cmd(notused, interp, argc, argv)$/ +dbt_from_file ../test/utils.c /^dbt_from_file(interp, file, dbt)$/ +dbt_to_file ../test/utils.c /^dbt_to_file(interp, file, dbt)$/ +dbversion_cmd ../test/utils.c /^dbversion_cmd(notused, interp, argc, notused2)$/ +dbwidget_cmd ../test/utils.c /^dbwidget_cmd(cd_dbp, interp, argc, argv)$/ +dd_id ../include/lock.h /^#define dd_id wlinks._dd_id$/ +debug_check ../test/utils.c /^debug_check()$/ +debugcheck_cmd ../test/utils.c /^debugcheck_cmd(notused1, interp, argc, notused2)$/ +delete ../include/db.h.src /^#define delete(a) __db_dbm_delete(a)$/ +dirfd ../clib/getcwd.c /^#define dirfd(dirp) ((dirp)->dd_fd)$/ +do_lockvec ../test/tcl_lock.c /^do_lockvec(interp, mgr, argc, argv)$/ +envwidget_cmd ../test/utils.c /^envwidget_cmd(cd, interp, argc, argv)$/ +envwidget_delcmd ../test/utils.c /^envwidget_delcmd(cd)$/ +err ../clib/err.c /^err(eval, fmt, va_alist)$/ +errx ../clib/err.c /^errx(eval, fmt, va_alist)$/ +fetch ../include/db.h.src /^#define fetch(a) __db_dbm_fetch(a)$/ +firstkey ../include/db.h.src /^#define firstkey __db_dbm_firstkey$/ +fsync ../os/os_config.c /^#define fsync _commit$/ +get_long ../clib/getlong.c /^get_long(p, min, max, storep)$/ +get_lsn ../test/tcl_log.c /^get_lsn(interp, str, lsnp)$/ +getcwd ../clib/getcwd.c /^getcwd(pt, size)$/ +getopt ../clib/getopt.c /^getopt(nargc, nargv, ostr)$/ +ham_AUTO_H ../include/hash_auto.h /^#define ham_AUTO_H$/ +hcreate ../include/db.h.src /^#define hcreate(a) __db_hcreate(a)$/ +hcreate_cmd ../test/tcl_hsearch.c /^hcreate_cmd(notused, interp, argc, argv)$/ +hdestroy ../include/db.h.src /^#define hdestroy __db_hdestroy$/ +hdestroy_cmd ../test/tcl_hsearch.c /^hdestroy_cmd(notused, interp, argc, argv)$/ +heldby ../include/lock.h /^#define heldby dlinks._heldby$/ +holders ../include/lock.h /^#define holders dlinks._holders$/ +hsearch ../include/db.h.src /^#define hsearch(a, b) __db_hsearch(a, b)$/ +hsearch_cmd ../test/tcl_hsearch.c /^hsearch_cmd(notused, interp, argc, argv)$/ +imp ../include/db_cxx.h /^\/\/ DEFINE_DB_CLASS defines an imp_ data member a/ +imported ../os/os_config.c /^#define imported __declspec(dllimport)$/ +int ../db/db_dispatch.c /^static int (**dispatch_table) __P((DB_LOG *, DBT */ +list_to_numarray ../test/utils.c /^list_to_numarray(interp, str)$/ +lock_close ../lock/lock_region.c /^lock_close(lt)$/ +lock_cmd ../test/tcl_lock.c /^lock_cmd(cd_lock, interp, argc, argv)$/ +lock_detect ../lock/lock_deadlock.c /^lock_detect(lt, flags, atype)$/ +lock_get ../lock/lock.c /^lock_get(lt, locker, flags, obj, lock_mode, lock)$/ +lock_id ../lock/lock.c /^lock_id(lt, idp)$/ +lock_open ../lock/lock_region.c /^lock_open(path, flags, mode, dbenv, ltp)$/ +lock_put ../lock/lock.c /^lock_put(lt, lock)$/ +lock_stat ../lock/lock_region.c /^lock_stat(lt, gspp, db_malloc)$/ +lock_unlink ../lock/lock_region.c /^lock_unlink(path, force, dbenv)$/ +lock_vec ../lock/lock.c /^lock_vec(lt, locker, flags, list, nlist, elistp)$/ +lockmgr_cmd ../test/tcl_lock.c /^lockmgr_cmd(notused, interp, argc, argv)$/ +lockunlink_cmd ../test/tcl_lock.c /^lockunlink_cmd(notused, interp, argc, argv)$/ +lockwidget_cmd ../test/tcl_lock.c /^lockwidget_cmd(cd_mgr, interp, argc, argv)$/ +log_AUTO_H ../include/log_auto.h /^#define log_AUTO_H$/ +log_archive ../log/log_archive.c /^log_archive(dblp, listp, flags, db_malloc)$/ +log_close ../log/log.c /^log_close(dblp)$/ +log_cmd ../test/tcl_log.c /^log_cmd(notused, interp, argc, argv)$/ +log_compare ../log/log_compare.c /^log_compare(lsn0, lsn1)$/ +log_compare_cmd ../test/tcl_log.c /^log_compare_cmd(interp, argc, argv)$/ +log_file ../log/log_put.c /^log_file(dblp, lsn, namep, len)$/ +log_file_cmd ../test/tcl_log.c /^log_file_cmd(lp, interp, argc, argv)$/ +log_flush ../log/log_put.c /^log_flush(dblp, lsn)$/ +log_flush_cmd ../test/tcl_log.c /^log_flush_cmd(lp, interp, argc, argv)$/ +log_get ../log/log_get.c /^log_get(dblp, alsn, dbt, flags)$/ +log_get_cmd ../test/tcl_log.c /^log_get_cmd(lp, interp, argc, argv)$/ +log_open ../log/log.c /^log_open(path, flags, mode, dbenv, lpp)$/ +log_put ../log/log_put.c /^log_put(dblp, lsn, dbt, flags)$/ +log_put_cmd ../test/tcl_log.c /^log_put_cmd(lp, interp, argc, argv)$/ +log_reg_cmd ../test/tcl_log.c /^log_reg_cmd(lp, interp, argc, argv)$/ +log_register ../log/log_register.c /^log_register(dblp, dbp, name, type, idp)$/ +log_stat ../log/log.c /^log_stat(dblp, gspp, db_malloc)$/ +log_unlink ../log/log.c /^log_unlink(path, force, dbenv)$/ +log_unregister ../log/log_register.c /^log_unregister(dblp, fid)$/ +logunlink_cmd ../test/tcl_log.c /^logunlink_cmd(notused, interp, argc, argv)$/ +logwidget_cmd ../test/tcl_log.c /^logwidget_cmd(cd_lp, interp, argc, argv)$/ +m ../test/tcl_mutex.c /^#define m u.r.real_m$/ +memcmp ../clib/memcmp.c /^memcmp(s1, s2, n)$/ +memp_close ../mp/mp_open.c /^memp_close(dbmp)$/ +memp_cmd ../test/tcl_mpool.c /^memp_cmd(notused, interp, argc, argv)$/ +memp_fclose ../mp/mp_fopen.c /^memp_fclose(dbmfp)$/ +memp_fget ../mp/mp_fget.c /^memp_fget(dbmfp, pgnoaddr, flags, addrp)$/ +memp_fopen ../mp/mp_fopen.c /^memp_fopen(dbmp, path, flags, mode, pagesize, finf/ +memp_fput ../mp/mp_fput.c /^memp_fput(dbmfp, pgaddr, flags)$/ +memp_fset ../mp/mp_fset.c /^memp_fset(dbmfp, pgaddr, flags)$/ +memp_fsync ../mp/mp_sync.c /^memp_fsync(dbmfp)$/ +memp_open ../mp/mp_open.c /^memp_open(path, flags, mode, dbenv, retp)$/ +memp_register ../mp/mp_open.c /^memp_register(dbmp, ftype, pgin, pgout)$/ +memp_stat ../mp/mp_pr.c /^memp_stat(dbmp, gspp, fspp, db_malloc)$/ +memp_sync ../mp/mp_sync.c /^memp_sync(dbmp, lsnp)$/ +memp_trickle ../mp/mp_sync.c /^memp_trickle(dbmp, pct, nwrotep)$/ +memp_unlink ../mp/mp_open.c /^memp_unlink(path, force, dbenv)$/ +mempunlink_cmd ../test/tcl_mpool.c /^mempunlink_cmd(notused, interp, argc, argv)$/ +mpf_cmd ../test/tcl_mpool.c /^mpf_cmd(cd_mfi, interp, argc, argv)$/ +mpwidget_cmd ../test/tcl_mpool.c /^mpwidget_cmd(cd_mp, interp, argc, argv)$/ +mutex_cmd ../test/tcl_mutex.c /^mutex_cmd(notused, interp, argc, argv)$/ +mutexunlink_cmd ../test/tcl_mutex.c /^mutexunlink_cmd(notused, interp, argc, argv)$/ +mutexwidget_cmd ../test/tcl_mutex.c /^mutexwidget_cmd(cd_md, interp, argc, argv)$/ +ndbmopen_cmd ../test/tcl_ndbm.c /^ndbmopen_cmd(notused, interp, argc, argv)$/ +ndbmwidget_cmd ../test/tcl_ndbm.c /^ndbmwidget_cmd(cd_dbm, interp, argc, argv)$/ +nextkey ../include/db.h.src /^#define nextkey(a) __db_dbm_nextkey(a)$/ +pgno_t ../include/db_185.h.src /^#define pgno_t db_pgno_t$/ +pgwidget_cmd ../test/tcl_mpool.c /^pgwidget_cmd(cd_page, interp, argc, argv)$/ +process_am_options ../test/utils.c /^process_am_options(interp, argc, argv, openinfo)$/ +process_env_options ../test/utils.c /^process_env_options(interp, argc, argv, envinfo)$/ +raise ../clib/raise.c /^raise(s)$/ +rand_cmd ../test/utils.c /^rand_cmd(notused, interp, argc, argv)$/ +randomint_cmd ../test/utils.c /^randomint_cmd(notused, interp, argc, argv)$/ +set_get_result ../test/utils.c /^set_get_result(interp, dbt)$/ +snprintf ../clib/snprintf.c /^snprintf(str, n, fmt, va_alist)$/ +srand_cmd ../test/utils.c /^srand_cmd(notused, interp, argc, argv)$/ +stamp_cmd ../test/utils.c /^stamp_cmd(notused, interp, argc, argv)$/ +store ../include/db.h.src /^#define store(a, b) __db_dbm_store(a, b)$/ +strerror ../clib/strerror.c /^strerror(num)$/ +strsep ../clib/strsep.c /^strsep(stringp, delim)$/ +txn_AUTO_H ../include/txn_auto.h /^#define txn_AUTO_H$/ +txn_abort ../txn/txn.c /^txn_abort(txnp)$/ +txn_begin ../txn/txn.c /^txn_begin(tmgrp, parent, txnpp)$/ +txn_checkpoint ../txn/txn.c /^txn_checkpoint(mgr, kbytes, minutes)$/ +txn_close ../txn/txn.c /^txn_close(tmgrp)$/ +txn_cmd ../test/tcl_txn.c /^txn_cmd(cd_txn, interp, argc, argv)$/ +txn_commit ../txn/txn.c /^txn_commit(txnp)$/ +txn_id ../txn/txn.c /^txn_id(txnp)$/ +txn_open ../txn/txn.c /^txn_open(path, flags, mode, dbenv, mgrpp)$/ +txn_prepare ../txn/txn.c /^txn_prepare(txnp)$/ +txn_stat ../txn/txn.c /^txn_stat(mgr, statp, db_malloc)$/ +txn_unlink ../txn/txn.c /^txn_unlink(path, force, dbenv)$/ +txnmgr_cmd ../test/tcl_txn.c /^txnmgr_cmd(notused, interp, argc, argv)$/ +txnunlink_cmd ../test/tcl_txn.c /^txnunlink_cmd(notused, interp, argc, argv)$/ +txnwidget_cmd ../test/tcl_txn.c /^txnwidget_cmd(cd_mgr, interp, argc, argv)$/ +unwrap ../include/cxx_int.h /^\/\/ back and forth using the various overloaded w/ +val ../test/tcl_mutex.c /^#define val u.r.real_val$/ +vsnprintf ../clib/vsnprintf.c /^vsnprintf(str, n, fmt, ap)$/ +waiters ../include/lock.h /^#define waiters wlinks._waiters$/ +warn ../clib/err.c /^warn(fmt, va_alist)$/ +warnx ../clib/err.c /^warnx(fmt, va_alist)$/ +wmask ../clib/memcpy.c /^#define wmask (wsize - 1)$/ +wsize ../clib/memcpy.c /^#define wsize sizeof(word)$/ diff --git a/mozilla/db/dist/template/rec_btree b/mozilla/db/dist/template/rec_btree new file mode 100644 index 00000000000..adb7dfdc019 --- /dev/null +++ b/mozilla/db/dist/template/rec_btree @@ -0,0 +1,631 @@ +/* Do not edit: automatically built by dist/distrib. */ +#include +#include + +#include +#include +#include +#include + +#include "db_int.h" +#include "db_page.h" +#include "../log/log.h" +#include "bam.h" +#include "../common/db_dispatch.h" +#include "../common/extern.h" + +/* + * __bam_pg_alloc_recover -- + * Recovery function for pg_alloc. + * + * PUBLIC: int __bam_pg_alloc_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_pg_alloc_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __bam_pg_alloc_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__bam_pg_alloc_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __bam_pg_alloc_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} + +/* + * __bam_pg_free_recover -- + * Recovery function for pg_free. + * + * PUBLIC: int __bam_pg_free_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_pg_free_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __bam_pg_free_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__bam_pg_free_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __bam_pg_free_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} + +/* + * __bam_split_recover -- + * Recovery function for split. + * + * PUBLIC: int __bam_split_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_split_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __bam_split_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__bam_split_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __bam_split_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} + +/* + * __bam_rsplit_recover -- + * Recovery function for rsplit. + * + * PUBLIC: int __bam_rsplit_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_rsplit_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __bam_rsplit_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__bam_rsplit_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __bam_rsplit_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} + +/* + * __bam_adj_recover -- + * Recovery function for adj. + * + * PUBLIC: int __bam_adj_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_adj_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __bam_adj_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__bam_adj_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __bam_adj_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} + +/* + * __bam_cadjust_recover -- + * Recovery function for cadjust. + * + * PUBLIC: int __bam_cadjust_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_cadjust_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __bam_cadjust_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__bam_cadjust_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __bam_cadjust_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} + +/* + * __bam_cdel_recover -- + * Recovery function for cdel. + * + * PUBLIC: int __bam_cdel_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_cdel_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __bam_cdel_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__bam_cdel_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __bam_cdel_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} + +/* + * __bam_repl_recover -- + * Recovery function for repl. + * + * PUBLIC: int __bam_repl_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__bam_repl_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __bam_repl_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__bam_repl_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __bam_repl_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} diff --git a/mozilla/db/dist/template/rec_ctemp b/mozilla/db/dist/template/rec_ctemp new file mode 100644 index 00000000000..49b49c992d2 --- /dev/null +++ b/mozilla/db/dist/template/rec_ctemp @@ -0,0 +1,77 @@ + +/* + * __PREF_FUNC_recover -- + * Recovery function for FUNC. + * + * PUBLIC: int __PREF_FUNC_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__PREF_FUNC_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __PREF_FUNC_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__PREF_FUNC_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __PREF_FUNC_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} diff --git a/mozilla/db/dist/template/rec_db b/mozilla/db/dist/template/rec_db new file mode 100644 index 00000000000..ada5ab18ad6 --- /dev/null +++ b/mozilla/db/dist/template/rec_db @@ -0,0 +1,631 @@ +/* Do not edit: automatically built by dist/distrib. */ +#include +#include + +#include +#include +#include +#include + +#include "db_int.h" +#include "db_page.h" +#include "../log/log.h" +#include "db.h" +#include "../common/db_dispatch.h" +#include "../common/extern.h" + +/* + * __db_addrem_recover -- + * Recovery function for addrem. + * + * PUBLIC: int __db_addrem_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_addrem_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __db_addrem_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__db_addrem_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __db_addrem_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} + +/* + * __db_split_recover -- + * Recovery function for split. + * + * PUBLIC: int __db_split_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_split_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __db_split_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__db_split_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __db_split_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} + +/* + * __db_big_recover -- + * Recovery function for big. + * + * PUBLIC: int __db_big_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_big_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __db_big_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__db_big_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __db_big_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} + +/* + * __db_ovref_recover -- + * Recovery function for ovref. + * + * PUBLIC: int __db_ovref_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_ovref_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __db_ovref_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__db_ovref_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __db_ovref_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} + +/* + * __db_relink_recover -- + * Recovery function for relink. + * + * PUBLIC: int __db_relink_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_relink_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __db_relink_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__db_relink_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __db_relink_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} + +/* + * __db_addpage_recover -- + * Recovery function for addpage. + * + * PUBLIC: int __db_addpage_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_addpage_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __db_addpage_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__db_addpage_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __db_addpage_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} + +/* + * __db_debug_recover -- + * Recovery function for debug. + * + * PUBLIC: int __db_debug_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_debug_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __db_debug_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__db_debug_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __db_debug_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} + +/* + * __db_noop_recover -- + * Recovery function for noop. + * + * PUBLIC: int __db_noop_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__db_noop_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __db_noop_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__db_noop_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __db_noop_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} diff --git a/mozilla/db/dist/template/rec_hash b/mozilla/db/dist/template/rec_hash new file mode 100644 index 00000000000..848a8b52ce4 --- /dev/null +++ b/mozilla/db/dist/template/rec_hash @@ -0,0 +1,631 @@ +/* Do not edit: automatically built by dist/distrib. */ +#include +#include + +#include +#include +#include +#include + +#include "db_int.h" +#include "db_page.h" +#include "../log/log.h" +#include "ham.h" +#include "../common/db_dispatch.h" +#include "../common/extern.h" + +/* + * __ham_insdel_recover -- + * Recovery function for insdel. + * + * PUBLIC: int __ham_insdel_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_insdel_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __ham_insdel_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__ham_insdel_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __ham_insdel_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} + +/* + * __ham_newpage_recover -- + * Recovery function for newpage. + * + * PUBLIC: int __ham_newpage_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_newpage_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __ham_newpage_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__ham_newpage_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __ham_newpage_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} + +/* + * __ham_splitmeta_recover -- + * Recovery function for splitmeta. + * + * PUBLIC: int __ham_splitmeta_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_splitmeta_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __ham_splitmeta_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__ham_splitmeta_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __ham_splitmeta_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} + +/* + * __ham_splitdata_recover -- + * Recovery function for splitdata. + * + * PUBLIC: int __ham_splitdata_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_splitdata_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __ham_splitdata_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__ham_splitdata_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __ham_splitdata_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} + +/* + * __ham_replace_recover -- + * Recovery function for replace. + * + * PUBLIC: int __ham_replace_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_replace_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __ham_replace_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__ham_replace_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __ham_replace_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} + +/* + * __ham_newpgno_recover -- + * Recovery function for newpgno. + * + * PUBLIC: int __ham_newpgno_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_newpgno_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __ham_newpgno_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__ham_newpgno_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __ham_newpgno_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} + +/* + * __ham_ovfl_recover -- + * Recovery function for ovfl. + * + * PUBLIC: int __ham_ovfl_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_ovfl_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __ham_ovfl_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__ham_ovfl_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __ham_ovfl_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} + +/* + * __ham_copypage_recover -- + * Recovery function for copypage. + * + * PUBLIC: int __ham_copypage_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_copypage_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __ham_copypage_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__ham_copypage_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __ham_copypage_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} diff --git a/mozilla/db/dist/template/rec_htemp b/mozilla/db/dist/template/rec_htemp new file mode 100644 index 00000000000..9f686eb3aa4 --- /dev/null +++ b/mozilla/db/dist/template/rec_htemp @@ -0,0 +1,15 @@ +/* Do not edit: automatically built by dist/distrib. */ +#include +#include + +#include +#include +#include +#include + +#include "db_int.h" +#include "db_page.h" +#include "../log/log.h" +#include "PREF.h" +#include "../common/db_dispatch.h" +#include "../common/extern.h" diff --git a/mozilla/db/dist/template/rec_log b/mozilla/db/dist/template/rec_log new file mode 100644 index 00000000000..42bd143e956 --- /dev/null +++ b/mozilla/db/dist/template/rec_log @@ -0,0 +1,92 @@ +/* Do not edit: automatically built by dist/distrib. */ +#include +#include + +#include +#include +#include +#include + +#include "db_int.h" +#include "db_page.h" +#include "../log/log.h" +#include "log.h" +#include "../common/db_dispatch.h" +#include "../common/extern.h" + +/* + * __log_register_recover -- + * Recovery function for register. + * + * PUBLIC: int __log_register_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__log_register_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __log_register_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__log_register_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __log_register_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} diff --git a/mozilla/db/dist/template/rec_txn b/mozilla/db/dist/template/rec_txn new file mode 100644 index 00000000000..7fb3c14ba12 --- /dev/null +++ b/mozilla/db/dist/template/rec_txn @@ -0,0 +1,169 @@ +/* Do not edit: automatically built by dist/distrib. */ +#include +#include + +#include +#include +#include +#include + +#include "db_int.h" +#include "db_page.h" +#include "../log/log.h" +#include "txn.h" +#include "../common/db_dispatch.h" +#include "../common/extern.h" + +/* + * __txn_regop_recover -- + * Recovery function for regop. + * + * PUBLIC: int __txn_regop_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__txn_regop_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __txn_regop_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__txn_regop_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __txn_regop_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} + +/* + * __txn_ckp_recover -- + * Recovery function for ckp. + * + * PUBLIC: int __txn_ckp_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__txn_ckp_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __txn_ckp_args *argp; + DB *file_dbp; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + +#ifdef DEBUG_RECOVER + (void)__txn_ckp_print(logp, dbtp, lsnp, redo, info); +#endif + info = info; /* XXX: Shut the compiler up. */ + + if ((ret = __txn_ckp_read(dbtp->data, &argp)) != 0) + goto out; + if (__db_fileid_to_db(logp, &file_dbp, argp->fileid)) { + ret = 0; + goto out; + } + if (file_dbp == NULL) + goto out; + + F_SET(file_dbp, DB_AM_RECOVER); + mpf = file_dbp->mpf; + + if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0) + if (redo) { + if ((ret = memp_fget(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 && redo) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = *argp->prev_lsn; + +out: if (argp != NULL) + free (argp); + F_CLR(file_dbp, DB_AM_RECOVER); + return (ret); +} diff --git a/mozilla/db/documents/hash.usenix.ps b/mozilla/db/documents/hash.usenix.ps new file mode 100644 index 00000000000..94fad6e1b5b --- /dev/null +++ b/mozilla/db/documents/hash.usenix.ps @@ -0,0 +1,12209 @@ +%!PS-Adobe-1.0 +%%Creator: utopia:margo (& Seltzer,608-13E,8072,) +%%Title: stdin (ditroff) +%%CreationDate: Tue Dec 11 15:06:45 1990 +%%EndComments +% @(#)psdit.pro 1.3 4/15/88 +% lib/psdit.pro -- prolog for psdit (ditroff) files +% Copyright (c) 1984, 1985 Adobe Systems Incorporated. All Rights Reserved. +% last edit: shore Sat Nov 23 20:28:03 1985 +% RCSID: $Header: /home/befator/cvs/jail/cvsroot/mozilla/db/documents/Attic/hash.usenix.ps,v 1.1.1.1 1998-10-15 03:56:35 roeber%netscape.com Exp $ + +% Changed by Edward Wang (edward@ucbarpa.berkeley.edu) to handle graphics, +% 17 Feb, 87. + +/$DITroff 140 dict def $DITroff begin +/fontnum 1 def /fontsize 10 def /fontheight 10 def /fontslant 0 def +/xi{0 72 11 mul translate 72 resolution div dup neg scale 0 0 moveto + /fontnum 1 def /fontsize 10 def /fontheight 10 def /fontslant 0 def F + /pagesave save def}def +/PB{save /psv exch def currentpoint translate + resolution 72 div dup neg scale 0 0 moveto}def +/PE{psv restore}def +/arctoobig 90 def /arctoosmall .05 def +/m1 matrix def /m2 matrix def /m3 matrix def /oldmat matrix def +/tan{dup sin exch cos div}def +/point{resolution 72 div mul}def +/dround {transform round exch round exch itransform}def +/xT{/devname exch def}def +/xr{/mh exch def /my exch def /resolution exch def}def +/xp{}def +/xs{docsave restore end}def +/xt{}def +/xf{/fontname exch def /slotno exch def fontnames slotno get fontname eq not + {fonts slotno fontname findfont put fontnames slotno fontname put}if}def +/xH{/fontheight exch def F}def +/xS{/fontslant exch def F}def +/s{/fontsize exch def /fontheight fontsize def F}def +/f{/fontnum exch def F}def +/F{fontheight 0 le{/fontheight fontsize def}if + fonts fontnum get fontsize point 0 0 fontheight point neg 0 0 m1 astore + fontslant 0 ne{1 0 fontslant tan 1 0 0 m2 astore m3 concatmatrix}if + makefont setfont .04 fontsize point mul 0 dround pop setlinewidth}def +/X{exch currentpoint exch pop moveto show}def +/N{3 1 roll moveto show}def +/Y{exch currentpoint pop exch moveto show}def +/S{show}def +/ditpush{}def/ditpop{}def +/AX{3 -1 roll currentpoint exch pop moveto 0 exch ashow}def +/AN{4 2 roll moveto 0 exch ashow}def +/AY{3 -1 roll currentpoint pop exch moveto 0 exch ashow}def +/AS{0 exch ashow}def +/MX{currentpoint exch pop moveto}def +/MY{currentpoint pop exch moveto}def +/MXY{moveto}def +/cb{pop}def % action on unknown char -- nothing for now +/n{}def/w{}def +/p{pop showpage pagesave restore /pagesave save def}def +/Dt{/Dlinewidth exch def}def 1 Dt +/Ds{/Ddash exch def}def -1 Ds +/Di{/Dstipple exch def}def 1 Di +/Dsetlinewidth{2 Dlinewidth mul setlinewidth}def +/Dsetdash{Ddash 4 eq{[8 12]}{Ddash 16 eq{[32 36]} + {Ddash 20 eq{[32 12 8 12]}{[]}ifelse}ifelse}ifelse 0 setdash}def +/Dstroke{gsave Dsetlinewidth Dsetdash 1 setlinecap stroke grestore + currentpoint newpath moveto}def +/Dl{rlineto Dstroke}def +/arcellipse{/diamv exch def /diamh exch def oldmat currentmatrix pop + currentpoint translate 1 diamv diamh div scale /rad diamh 2 div def + currentpoint exch rad add exch rad -180 180 arc oldmat setmatrix}def +/Dc{dup arcellipse Dstroke}def +/De{arcellipse Dstroke}def +/Da{/endv exch def /endh exch def /centerv exch def /centerh exch def + /cradius centerv centerv mul centerh centerh mul add sqrt def + /eradius endv endv mul endh endh mul add sqrt def + /endang endv endh atan def + /startang centerv neg centerh neg atan def + /sweep startang endang sub dup 0 lt{360 add}if def + sweep arctoobig gt + {/midang startang sweep 2 div sub def /midrad cradius eradius add 2 div def + /midh midang cos midrad mul def /midv midang sin midrad mul def + midh neg midv neg endh endv centerh centerv midh midv Da + Da} + {sweep arctoosmall ge + {/controldelt 1 sweep 2 div cos sub 3 sweep 2 div sin mul div 4 mul def + centerv neg controldelt mul centerh controldelt mul + endv neg controldelt mul centerh add endh add + endh controldelt mul centerv add endv add + centerh endh add centerv endv add rcurveto Dstroke} + {centerh endh add centerv endv add rlineto Dstroke} + ifelse} + ifelse}def +/Dpatterns[ +[%cf[widthbits] +[8<0000000000000010>] +[8<0411040040114000>] +[8<0204081020408001>] +[8<0000103810000000>] +[8<6699996666999966>] +[8<0000800100001008>] +[8<81c36666c3810000>] +[8<0f0e0c0800000000>] +[8<0000000000000010>] +[8<0411040040114000>] +[8<0204081020408001>] +[8<0000001038100000>] +[8<6699996666999966>] +[8<0000800100001008>] +[8<81c36666c3810000>] +[8<0f0e0c0800000000>] +[8<0042660000246600>] +[8<0000990000990000>] +[8<0804020180402010>] +[8<2418814242811824>] +[8<6699996666999966>] +[8<8000000008000000>] +[8<00001c3e363e1c00>] +[8<0000000000000000>] +[32<00000040000000c00000004000000040000000e0000000000000000000000000>] +[32<00000000000060000000900000002000000040000000f0000000000000000000>] +[32<000000000000000000e0000000100000006000000010000000e0000000000000>] +[32<00000000000000002000000060000000a0000000f00000002000000000000000>] +[32<0000000e0000000000000000000000000000000f000000080000000e00000001>] +[32<0000090000000600000000000000000000000000000007000000080000000e00>] +[32<00010000000200000004000000040000000000000000000000000000000f0000>] +[32<0900000006000000090000000600000000000000000000000000000006000000>]] +[%ug +[8<0000020000000000>] +[8<0000020000002000>] +[8<0004020000002000>] +[8<0004020000402000>] +[8<0004060000402000>] +[8<0004060000406000>] +[8<0006060000406000>] +[8<0006060000606000>] +[8<00060e0000606000>] +[8<00060e000060e000>] +[8<00070e000060e000>] +[8<00070e000070e000>] +[8<00070e020070e000>] +[8<00070e020070e020>] +[8<04070e020070e020>] +[8<04070e024070e020>] +[8<04070e064070e020>] +[8<04070e064070e060>] +[8<06070e064070e060>] +[8<06070e066070e060>] +[8<06070f066070e060>] +[8<06070f066070f060>] +[8<060f0f066070f060>] +[8<060f0f0660f0f060>] +[8<060f0f0760f0f060>] +[8<060f0f0760f0f070>] +[8<0e0f0f0760f0f070>] +[8<0e0f0f07e0f0f070>] +[8<0e0f0f0fe0f0f070>] +[8<0e0f0f0fe0f0f0f0>] +[8<0f0f0f0fe0f0f0f0>] +[8<0f0f0f0ff0f0f0f0>] +[8<1f0f0f0ff0f0f0f0>] +[8<1f0f0f0ff1f0f0f0>] +[8<1f0f0f8ff1f0f0f0>] +[8<1f0f0f8ff1f0f0f8>] +[8<9f0f0f8ff1f0f0f8>] +[8<9f0f0f8ff9f0f0f8>] +[8<9f0f0f9ff9f0f0f8>] +[8<9f0f0f9ff9f0f0f9>] +[8<9f8f0f9ff9f0f0f9>] +[8<9f8f0f9ff9f8f0f9>] +[8<9f8f1f9ff9f8f0f9>] +[8<9f8f1f9ff9f8f1f9>] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8]] +[%mg +[8<8000000000000000>] +[8<0822080080228000>] +[8<0204081020408001>] +[8<40e0400000000000>] +[8<66999966>] +[8<8001000010080000>] +[8<81c36666c3810000>] +[8] +[16<07c00f801f003e007c00f800f001e003c007800f001f003e007c00f801f003e0>] +[16<1f000f8007c003e001f000f8007c003e001f800fc007e003f001f8007c003e00>] +[8] +[16<0040008001000200040008001000200040008000000100020004000800100020>] +[16<0040002000100008000400020001800040002000100008000400020001000080>] +[16<1fc03fe07df0f8f8f07de03fc01f800fc01fe03ff07df8f87df03fe01fc00f80>] +[8<80>] +[8<8040201000000000>] +[8<84cc000048cc0000>] +[8<9900009900000000>] +[8<08040201804020100800020180002010>] +[8<2418814242811824>] +[8<66999966>] +[8<8000000008000000>] +[8<70f8d8f870000000>] +[8<0814224180402010>] +[8] +[8<018245aa45820100>] +[8<221c224180808041>] +[8<88000000>] +[8<0855800080550800>] +[8<2844004482440044>] +[8<0810204080412214>] +[8<00>]]]def +/Dfill{ + transform /maxy exch def /maxx exch def + transform /miny exch def /minx exch def + minx maxx gt{/minx maxx /maxx minx def def}if + miny maxy gt{/miny maxy /maxy miny def def}if + Dpatterns Dstipple 1 sub get exch 1 sub get + aload pop /stip exch def /stipw exch def /stiph 128 def + /imatrix[stipw 0 0 stiph 0 0]def + /tmatrix[stipw 0 0 stiph 0 0]def + /minx minx cvi stiph idiv stiph mul def + /miny miny cvi stipw idiv stipw mul def + gsave eoclip 0 setgray + miny stiph maxy{ + tmatrix exch 5 exch put + minx stipw maxx{ + tmatrix exch 4 exch put tmatrix setmatrix + stipw stiph true imatrix {stip} imagemask + }for + }for + grestore +}def +/Dp{Dfill Dstroke}def +/DP{Dfill currentpoint newpath moveto}def +end + +/ditstart{$DITroff begin + /nfonts 60 def % NFONTS makedev/ditroff dependent! + /fonts[nfonts{0}repeat]def + /fontnames[nfonts{()}repeat]def +/docsave save def +}def + +% character outcalls +/oc{ + /pswid exch def /cc exch def /name exch def + /ditwid pswid fontsize mul resolution mul 72000 div def + /ditsiz fontsize resolution mul 72 div def + ocprocs name known{ocprocs name get exec}{name cb}ifelse +}def +/fractm [.65 0 0 .6 0 0] def +/fraction{ + /fden exch def /fnum exch def gsave /cf currentfont def + cf fractm makefont setfont 0 .3 dm 2 copy neg rmoveto + fnum show rmoveto currentfont cf setfont(\244)show setfont fden show + grestore ditwid 0 rmoveto +}def +/oce{grestore ditwid 0 rmoveto}def +/dm{ditsiz mul}def +/ocprocs 50 dict def ocprocs begin +(14){(1)(4)fraction}def +(12){(1)(2)fraction}def +(34){(3)(4)fraction}def +(13){(1)(3)fraction}def +(23){(2)(3)fraction}def +(18){(1)(8)fraction}def +(38){(3)(8)fraction}def +(58){(5)(8)fraction}def +(78){(7)(8)fraction}def +(sr){gsave 0 .06 dm rmoveto(\326)show oce}def +(is){gsave 0 .15 dm rmoveto(\362)show oce}def +(->){gsave 0 .02 dm rmoveto(\256)show oce}def +(<-){gsave 0 .02 dm rmoveto(\254)show oce}def +(==){gsave 0 .05 dm rmoveto(\272)show oce}def +(uc){gsave currentpoint 400 .009 dm mul add translate + 8 -8 scale ucseal oce}def +end + +% an attempt at a PostScript FONT to implement ditroff special chars +% this will enable us to +% cache the little buggers +% generate faster, more compact PS out of psdit +% confuse everyone (including myself)! +50 dict dup begin +/FontType 3 def +/FontName /DIThacks def +/FontMatrix [.001 0 0 .001 0 0] def +/FontBBox [-260 -260 900 900] def% a lie but ... +/Encoding 256 array def +0 1 255{Encoding exch /.notdef put}for +Encoding + dup 8#040/space put %space + dup 8#110/rc put %right ceil + dup 8#111/lt put %left top curl + dup 8#112/bv put %bold vert + dup 8#113/lk put %left mid curl + dup 8#114/lb put %left bot curl + dup 8#115/rt put %right top curl + dup 8#116/rk put %right mid curl + dup 8#117/rb put %right bot curl + dup 8#120/rf put %right floor + dup 8#121/lf put %left floor + dup 8#122/lc put %left ceil + dup 8#140/sq put %square + dup 8#141/bx put %box + dup 8#142/ci put %circle + dup 8#143/br put %box rule + dup 8#144/rn put %root extender + dup 8#145/vr put %vertical rule + dup 8#146/ob put %outline bullet + dup 8#147/bu put %bullet + dup 8#150/ru put %rule + dup 8#151/ul put %underline + pop +/DITfd 100 dict def +/BuildChar{0 begin + /cc exch def /fd exch def + /charname fd /Encoding get cc get def + /charwid fd /Metrics get charname get def + /charproc fd /CharProcs get charname get def + charwid 0 fd /FontBBox get aload pop setcachedevice + 2 setlinejoin 40 setlinewidth + newpath 0 0 moveto gsave charproc grestore + end}def +/BuildChar load 0 DITfd put +/CharProcs 50 dict def +CharProcs begin +/space{}def +/.notdef{}def +/ru{500 0 rls}def +/rn{0 840 moveto 500 0 rls}def +/vr{0 800 moveto 0 -770 rls}def +/bv{0 800 moveto 0 -1000 rls}def +/br{0 840 moveto 0 -1000 rls}def +/ul{0 -140 moveto 500 0 rls}def +/ob{200 250 rmoveto currentpoint newpath 200 0 360 arc closepath stroke}def +/bu{200 250 rmoveto currentpoint newpath 200 0 360 arc closepath fill}def +/sq{80 0 rmoveto currentpoint dround newpath moveto + 640 0 rlineto 0 640 rlineto -640 0 rlineto closepath stroke}def +/bx{80 0 rmoveto currentpoint dround newpath moveto + 640 0 rlineto 0 640 rlineto -640 0 rlineto closepath fill}def +/ci{500 360 rmoveto currentpoint newpath 333 0 360 arc + 50 setlinewidth stroke}def + +/lt{0 -200 moveto 0 550 rlineto currx 800 2cx s4 add exch s4 a4p stroke}def +/lb{0 800 moveto 0 -550 rlineto currx -200 2cx s4 add exch s4 a4p stroke}def +/rt{0 -200 moveto 0 550 rlineto currx 800 2cx s4 sub exch s4 a4p stroke}def +/rb{0 800 moveto 0 -500 rlineto currx -200 2cx s4 sub exch s4 a4p stroke}def +/lk{0 800 moveto 0 300 -300 300 s4 arcto pop pop 1000 sub + 0 300 4 2 roll s4 a4p 0 -200 lineto stroke}def +/rk{0 800 moveto 0 300 s2 300 s4 arcto pop pop 1000 sub + 0 300 4 2 roll s4 a4p 0 -200 lineto stroke}def +/lf{0 800 moveto 0 -1000 rlineto s4 0 rls}def +/rf{0 800 moveto 0 -1000 rlineto s4 neg 0 rls}def +/lc{0 -200 moveto 0 1000 rlineto s4 0 rls}def +/rc{0 -200 moveto 0 1000 rlineto s4 neg 0 rls}def +end + +/Metrics 50 dict def Metrics begin +/.notdef 0 def +/space 500 def +/ru 500 def +/br 0 def +/lt 416 def +/lb 416 def +/rt 416 def +/rb 416 def +/lk 416 def +/rk 416 def +/rc 416 def +/lc 416 def +/rf 416 def +/lf 416 def +/bv 416 def +/ob 350 def +/bu 350 def +/ci 750 def +/bx 750 def +/sq 750 def +/rn 500 def +/ul 500 def +/vr 0 def +end + +DITfd begin +/s2 500 def /s4 250 def /s3 333 def +/a4p{arcto pop pop pop pop}def +/2cx{2 copy exch}def +/rls{rlineto stroke}def +/currx{currentpoint pop}def +/dround{transform round exch round exch itransform} def +end +end +/DIThacks exch definefont pop +ditstart +(psc)xT +576 1 1 xr +1(Times-Roman)xf 1 f +2(Times-Italic)xf 2 f +3(Times-Bold)xf 3 f +4(Times-BoldItalic)xf 4 f +5(Helvetica)xf 5 f +6(Helvetica-Bold)xf 6 f +7(Courier)xf 7 f +8(Courier-Bold)xf 8 f +9(Symbol)xf 9 f +10(DIThacks)xf 10 f +10 s +1 f +xi +%%EndProlog + +%%Page: 1 1 +10 s 10 xH 0 xS 1 f +3 f +22 s +1249 626(A)N +1420(N)X +1547(ew)X +1796(H)X +1933(ashing)X +2467(P)X +2574(ackage)X +3136(for)X +3405(U)X +3532(N)X +3659(IX)X +2 f +20 s +3855 562(1)N +1 f +12 s +1607 779(Margo)N +1887(Seltzer)X +9 f +2179(-)X +1 f +2256(University)X +2686(of)X +2790(California,)X +3229(Berkeley)X +2015 875(Ozan)N +2242(Yigit)X +9 f +2464(-)X +1 f +2541(York)X +2762(University)X +3 f +2331 1086(ABSTRACT)N +1 f +10 s +1152 1222(UNIX)N +1385(support)X +1657(of)X +1756(disk)X +1921(oriented)X +2216(hashing)X +2497(was)X +2654(originally)X +2997(provided)X +3314(by)X +2 f +3426(dbm)X +1 f +3595([ATT79])X +3916(and)X +1152 1310(subsequently)N +1595(improved)X +1927(upon)X +2112(in)X +2 f +2199(ndbm)X +1 f +2402([BSD86].)X +2735(In)X +2826(AT&T)X +3068(System)X +3327(V,)X +3429(in-memory)X +3809(hashed)X +1152 1398(storage)N +1420(and)X +1572(access)X +1814(support)X +2090(was)X +2251(added)X +2479(in)X +2577(the)X +2 f +2711(hsearch)X +1 f +3000(library)X +3249(routines)X +3542([ATT85].)X +3907(The)X +1152 1486(result)N +1367(is)X +1457(a)X +1530(system)X +1789(with)X +1968(two)X +2125(incompatible)X +2580(hashing)X +2865(schemes,)X +3193(each)X +3377(with)X +3555(its)X +3666(own)X +3840(set)X +3965(of)X +1152 1574(shortcomings.)N +1152 1688(This)N +1316(paper)X +1517(presents)X +1802(the)X +1922(design)X +2152(and)X +2289(performance)X +2717(characteristics)X +3198(of)X +3286(a)X +3343(new)X +3498(hashing)X +3768(package)X +1152 1776(providing)N +1483(a)X +1539(superset)X +1822(of)X +1909(the)X +2027(functionality)X +2456(provided)X +2761(by)X +2 f +2861(dbm)X +1 f +3019(and)X +2 f +3155(hsearch)X +1 f +3409(.)X +3469(The)X +3614(new)X +3768(package)X +1152 1864(uses)N +1322(linear)X +1537(hashing)X +1818(to)X +1912(provide)X +2189(ef\256cient)X +2484(support)X +2755(of)X +2853(both)X +3026(memory)X +3324(based)X +3538(and)X +3685(disk)X +3849(based)X +1152 1952(hash)N +1319(tables)X +1526(with)X +1688(performance)X +2115(superior)X +2398(to)X +2480(both)X +2 f +2642(dbm)X +1 f +2800(and)X +2 f +2936(hsearch)X +1 f +3210(under)X +3413(most)X +3588(conditions.)X +3 f +1380 2128(Introduction)N +1 f +892 2260(Current)N +1196(UNIX)X +1456(systems)X +1768(offer)X +1984(two)X +2163(forms)X +2409(of)X +720 2348(hashed)N +973(data)X +1137(access.)X +2 f +1413(Dbm)X +1 f +1599(and)X +1745(its)X +1850(derivatives)X +2231(provide)X +720 2436(keyed)N +939(access)X +1171(to)X +1259(disk)X +1418(resident)X +1698(data)X +1858(while)X +2 f +2062(hsearch)X +1 f +2342(pro-)X +720 2524(vides)N +929(access)X +1175(for)X +1309(memory)X +1616(resident)X +1910(data.)X +2124(These)X +2356(two)X +720 2612(access)N +979(methods)X +1302(are)X +1453(incompatible)X +1923(in)X +2037(that)X +2209(memory)X +720 2700(resident)N +1011(hash)X +1195(tables)X +1419(may)X +1593(not)X +1731(be)X +1843(stored)X +2075(on)X +2191(disk)X +2360(and)X +720 2788(disk)N +884(resident)X +1169(tables)X +1387(cannot)X +1632(be)X +1739(read)X +1909(into)X +2063(memory)X +2360(and)X +720 2876(accessed)N +1022(using)X +1215(the)X +1333(in-memory)X +1709(routines.)X +2 f +892 2990(Dbm)N +1 f +1091(has)X +1241(several)X +1512(shortcomings.)X +2026(Since)X +2247(data)X +2423(is)X +720 3078(assumed)N +1032(to)X +1130(be)X +1242(disk)X +1411(resident,)X +1721(each)X +1905(access)X +2146(requires)X +2440(a)X +720 3166(system)N +963(call,)X +1120(and)X +1257(almost)X +1491(certainly,)X +1813(a)X +1869(disk)X +2022(operation.)X +2365(For)X +720 3254(extremely)N +1072(large)X +1264(databases,)X +1623(where)X +1851(caching)X +2131(is)X +2214(unlikely)X +720 3342(to)N +810(be)X +914(effective,)X +1244(this)X +1386(is)X +1466(acceptable,)X +1853(however,)X +2177(when)X +2378(the)X +720 3430(database)N +1022(is)X +1100(small)X +1298(\(i.e.)X +1447(the)X +1569(password)X +1896(\256le\),)X +2069(performance)X +720 3518(improvements)N +1204(can)X +1342(be)X +1443(obtained)X +1744(through)X +2018(caching)X +2293(pages)X +720 3606(of)N +818(the)X +947(database)X +1255(in)X +1348(memory.)X +1685(In)X +1782(addition,)X +2 f +2094(dbm)X +1 f +2262(cannot)X +720 3694(store)N +902(data)X +1062(items)X +1261(whose)X +1492(total)X +1660(key)X +1802(and)X +1943(data)X +2102(size)X +2252(exceed)X +720 3782(the)N +850(page)X +1034(size)X +1191(of)X +1290(the)X +1420(hash)X +1599(table.)X +1827(Similarly,)X +2176(if)X +2257(two)X +2409(or)X +720 3870(more)N +907(keys)X +1076(produce)X +1357(the)X +1477(same)X +1664(hash)X +1833(value)X +2029(and)X +2166(their)X +2334(total)X +720 3958(size)N +876(exceeds)X +1162(the)X +1291(page)X +1474(size,)X +1650(the)X +1779(table)X +1966(cannot)X +2210(store)X +2396(all)X +720 4046(the)N +838(colliding)X +1142(keys.)X +892 4160(The)N +1050(in-memory)X +2 f +1439(hsearch)X +1 f +1725(routines)X +2015(have)X +2199(different)X +720 4248(shortcomings.)N +1219(First,)X +1413(the)X +1539(notion)X +1771(of)X +1865(a)X +1928(single)X +2146(hash)X +2320(table)X +720 4336(is)N +807(embedded)X +1171(in)X +1266(the)X +1397(interface,)X +1732(preventing)X +2108(an)X +2217(applica-)X +720 4424(tion)N +902(from)X +1116(accessing)X +1482(multiple)X +1806(tables)X +2050(concurrently.)X +720 4512(Secondly,)N +1063(the)X +1186(routine)X +1438(to)X +1525(create)X +1743(a)X +1804(hash)X +1976(table)X +2157(requires)X +2440(a)X +720 4600(parameter)N +1066(which)X +1286(declares)X +1573(the)X +1694(size)X +1842(of)X +1932(the)X +2053(hash)X +2223(table.)X +2422(If)X +720 4688(this)N +856(size)X +1001(is)X +1074(set)X +1183(too)X +1305(low,)X +1465(performance)X +1892(degradation)X +2291(or)X +2378(the)X +720 4776(inability)N +1008(to)X +1092(add)X +1230(items)X +1425(to)X +1509(the)X +1628(table)X +1805(may)X +1964(result.)X +2223(In)X +2311(addi-)X +720 4864(tion,)N +2 f +910(hsearch)X +1 f +1210(requires)X +1515(that)X +1681(the)X +1825(application)X +2226(allocate)X +720 4952(memory)N +1037(for)X +1181(the)X +1329(key)X +1495(and)X +1661(data)X +1845(items.)X +2108(Lastly,)X +2378(the)X +2 f +720 5040(hsearch)N +1 f +1013(routines)X +1310(provide)X +1594(no)X +1713(interface)X +2034(to)X +2135(store)X +2329(hash)X +720 5128(tables)N +927(on)X +1027(disk.)X +16 s +720 5593 MXY +864 0 Dl +2 f +8 s +760 5648(1)N +1 f +9 s +5673(UNIX)Y +990(is)X +1056(a)X +1106(registered)X +1408(trademark)X +1718(of)X +1796(AT&T.)X +10 s +2878 2128(The)N +3032(goal)X +3199(of)X +3295(our)X +3431(work)X +3625(was)X +3779(to)X +3870(design)X +4108(and)X +4253(imple-)X +2706 2216(ment)N +2900(a)X +2970(new)X +3138(package)X +3436(that)X +3590(provides)X +3899(a)X +3968(superset)X +4264(of)X +4364(the)X +2706 2304(functionality)N +3144(of)X +3240(both)X +2 f +3411(dbm)X +1 f +3578(and)X +2 f +3723(hsearch)X +1 f +3977(.)X +4045(The)X +4198(package)X +2706 2392(had)N +2871(to)X +2982(overcome)X +3348(the)X +3495(interface)X +3826(shortcomings)X +4306(cited)X +2706 2480(above)N +2930(and)X +3078(its)X +3185(implementation)X +3719(had)X +3867(to)X +3961(provide)X +4238(perfor-)X +2706 2568(mance)N +2942(equal)X +3142(or)X +3235(superior)X +3524(to)X +3612(that)X +3758(of)X +3851(the)X +3975(existing)X +4253(imple-)X +2706 2656(mentations.)N +3152(In)X +3274(order)X +3498(to)X +3614(provide)X +3913(a)X +4003(compact)X +4329(disk)X +2706 2744(representation,)N +3224(graceful)X +3531(table)X +3729(growth,)X +4018(and)X +4176(expected)X +2706 2832(constant)N +3033(time)X +3234(performance,)X +3720(we)X +3873(selected)X +4191(Litwin's)X +2706 2920(linear)N +2923(hashing)X +3206(algorithm)X +3551([LAR88,)X +3872(LIT80].)X +4178(We)X +4324(then)X +2706 3008(enhanced)N +3037(the)X +3161(algorithm)X +3498(to)X +3586(handle)X +3826(page)X +4004(over\257ows)X +4346(and)X +2706 3096(large)N +2900(key)X +3049(handling)X +3362(with)X +3537(a)X +3606(single)X +3830(mechanism,)X +4248(named)X +2706 3184(buddy-in-waiting.)N +3 f +2975 3338(Existing)N +3274(UNIX)X +3499(Hashing)X +3802(Techniques)X +1 f +2878 3470(Over)N +3076(the)X +3210(last)X +3357(decade,)X +3637(several)X +3901(dynamic)X +4213(hashing)X +2706 3558(schemes)N +3000(have)X +3174(been)X +3348(developed)X +3700(for)X +3816(the)X +3936(UNIX)X +4159(timeshar-)X +2706 3646(ing)N +2856(system,)X +3146(starting)X +3433(with)X +3622(the)X +3767(inclusion)X +4107(of)X +2 f +4221(dbm)X +1 f +4359(,)X +4426(a)X +2706 3734(minimal)N +3008(database)X +3321(library)X +3571(written)X +3834(by)X +3950(Ken)X +4120(Thompson)X +2706 3822([THOM90],)N +3141(in)X +3248(the)X +3391(Seventh)X +3694(Edition)X +3974(UNIX)X +4220(system.)X +2706 3910(Since)N +2916(then,)X +3106(an)X +3214(extended)X +3536(version)X +3804(of)X +3903(the)X +4032(same)X +4228(library,)X +2 f +2706 3998(ndbm)N +1 f +2884(,)X +2933(and)X +3078(a)X +3142(public-domain)X +3637(clone)X +3839(of)X +3934(the)X +4060(latter,)X +2 f +4273(sdbm)X +1 f +4442(,)X +2706 4086(have)N +2902(been)X +3098(developed.)X +3491(Another)X +3797 0.1645(interface-compatible)AX +2706 4174(library)N +2 f +2950(gdbm)X +1 f +3128(,)X +3178(was)X +3333(recently)X +3622(made)X +3826(available)X +4145(as)X +4241(part)X +4395(of)X +2706 4262(the)N +2829(Free)X +2997(Software)X +3312(Foundation's)X +3759(\(FSF\))X +3970(software)X +4271(distri-)X +2706 4350(bution.)N +2878 4464(All)N +3017(of)X +3121(these)X +3323(implementations)X +3893(are)X +4029(based)X +4248(on)X +4364(the)X +2706 4552(idea)N +2871(of)X +2969(revealing)X +3299(just)X +3445(enough)X +3711(bits)X +3856(of)X +3953(a)X +4019(hash)X +4196(value)X +4400(to)X +2706 4640(locate)N +2920(a)X +2978(page)X +3151(in)X +3234(a)X +3291(single)X +3503(access.)X +3770(While)X +2 f +3987(dbm/ndbm)X +1 f +4346(and)X +2 f +2706 4728(sdbm)N +1 f +2908(map)X +3079(the)X +3210(hash)X +3390(value)X +3597(directly)X +3874(to)X +3968(a)X +4036(disk)X +4201(address,)X +2 f +2706 4816(gdbm)N +1 f +2921(uses)X +3096(the)X +3231(hash)X +3414(value)X +3624(to)X +3722(index)X +3936(into)X +4096(a)X +2 f +4168(directory)X +1 f +2706 4904([ENB88])N +3020(containing)X +3378(disk)X +3531(addresses.)X +2878 5018(The)N +2 f +3033(hsearch)X +1 f +3317(routines)X +3605(in)X +3697(System)X +3962(V)X +4049(are)X +4177(designed)X +2706 5106(to)N +2804(provide)X +3085(memory-resident)X +3669(hash)X +3852(tables.)X +4115(Since)X +4328(data)X +2706 5194(access)N +2948(does)X +3131(not)X +3269(require)X +3533(disk)X +3702(access,)X +3964(simple)X +4213(hashing)X +2706 5282(schemes)N +3010(which)X +3238(may)X +3408(require)X +3667(multiple)X +3964(probes)X +4209(into)X +4364(the)X +2706 5370(table)N +2889(are)X +3015(used.)X +3209(A)X +3294(more)X +3486(interesting)X +3851(version)X +4114(of)X +2 f +4208(hsearch)X +1 f +2706 5458(is)N +2784(a)X +2845(public)X +3070(domain)X +3335(library,)X +2 f +3594(dynahash)X +1 f +3901(,)X +3945(that)X +4089(implements)X +2706 5546(Larson's)N +3036(in-memory)X +3440(adaptation)X +3822([LAR88])X +4164(of)X +4279(linear)X +2706 5634(hashing)N +2975([LIT80].)X +3 f +720 5960(USENIX)N +9 f +1042(-)X +3 f +1106(Winter)X +1371('91)X +9 f +1498(-)X +3 f +1562(Dallas,)X +1815(TX)X +1 f +4424(1)X + +2 p +%%Page: 2 2 +10 s 10 xH 0 xS 1 f +3 f +432 258(A)N +510(New)X +682(Hashing)X +985(Package)X +1290(for)X +1413(UNIX)X +3663(Seltzer)X +3920(&)X +4007(Yigit)X +2 f +1074 538(dbm)N +1 f +1232(and)X +2 f +1368(ndbm)X +1 f +604 670(The)N +2 f +760(dbm)X +1 f +928(and)X +2 f +1074(ndbm)X +1 f +1282(library)X +1526(implementations)X +2089(are)X +432 758(based)N +667(on)X +799(the)X +949(same)X +1166(algorithm)X +1529(by)X +1661(Ken)X +1846(Thompson)X +432 846([THOM90,)N +824(TOR88,)X +1113(WAL84],)X +1452(but)X +1582(differ)X +1789(in)X +1879(their)X +2054(pro-)X +432 934(grammatic)N +801(interfaces.)X +1160(The)X +1311(latter)X +1502(is)X +1581(a)X +1643(modi\256ed)X +1952(version)X +432 1022(of)N +533(the)X +665(former)X +918(which)X +1148(adds)X +1328(support)X +1601(for)X +1728(multiple)X +2027(data-)X +432 1110(bases)N +634(to)X +724(be)X +828(open)X +1011(concurrently.)X +1484(The)X +1636(discussion)X +1996(of)X +2090(the)X +432 1198(algorithm)N +774(that)X +925(follows)X +1196(is)X +1280(applicable)X +1640(to)X +1732(both)X +2 f +1904(dbm)X +1 f +2072(and)X +2 f +432 1286(ndbm)N +1 f +610(.)X +604 1400(The)N +760(basic)X +956(structure)X +1268(of)X +2 f +1366(dbm)X +1 f +1535(calls)X +1712(for)X +1836(\256xed-sized)X +432 1488(disk)N +612(blocks)X +868(\(buckets\))X +1214(and)X +1377(an)X +2 f +1499(access)X +1 f +1755(function)X +2068(that)X +432 1576(maps)N +623(a)X +681(key)X +819(to)X +902(a)X +959(bucket.)X +1234(The)X +1380(interface)X +1683(routines)X +1962(use)X +2090(the)X +2 f +432 1664(access)N +1 f +673(function)X +970(to)X +1062(obtain)X +1292(the)X +1420(appropriate)X +1816(bucket)X +2060(in)X +2152(a)X +432 1752(single)N +643(disk)X +796(access.)X +604 1866(Within)N +869(the)X +2 f +1010(access)X +1 f +1263(function,)X +1593(a)X +1672(bit-randomizing)X +432 1954(hash)N +610(function)X +2 f +8 s +877 1929(2)N +1 f +10 s +940 1954(is)N +1024(used)X +1202(to)X +1294(convert)X +1565(a)X +1631(key)X +1777(into)X +1931(a)X +1997(32-bit)X +432 2042(hash)N +605(value.)X +825(Out)X +971(of)X +1064(these)X +1254(32)X +1359(bits,)X +1519(only)X +1686(as)X +1778(many)X +1981(bits)X +2121(as)X +432 2130(necessary)N +773(are)X +900(used)X +1075(to)X +1165(determine)X +1514(the)X +1639(particular)X +1974(bucket)X +432 2218(on)N +533(which)X +750(a)X +807(key)X +944(resides.)X +1228(An)X +1347(in-memory)X +1724(bitmap)X +1967(is)X +2041(used)X +432 2306(to)N +533(determine)X +893(how)X +1070(many)X +1287(bits)X +1441(are)X +1579(required.)X +1905(Each)X +2104(bit)X +432 2394(indicates)N +746(whether)X +1033(its)X +1136(associated)X +1494(bucket)X +1736(has)X +1871(been)X +2051(split)X +432 2482(yet)N +562(\(a)X +657(0)X +728(indicating)X +1079(that)X +1230(the)X +1359(bucket)X +1604(has)X +1742(not)X +1875(yet)X +2004(split\).)X +432 2570(The)N +590(use)X +730(of)X +830(the)X +961(hash)X +1141(function)X +1441(and)X +1590(the)X +1720(bitmap)X +1974(is)X +2059(best)X +432 2658(described)N +769(by)X +878(stepping)X +1177(through)X +1454(database)X +1759(creation)X +2046(with)X +432 2746(multiple)N +718(invocations)X +1107(of)X +1194(a)X +2 f +1250(store)X +1 f +1430(operation.)X +604 2860(Initially,)N +906(the)X +1033(hash)X +1209(table)X +1394(contains)X +1690(a)X +1755(single)X +1974(bucket)X +432 2948(\(bucket)N +711(0\),)X +836(the)X +972(bit)X +1094(map)X +1270(contains)X +1575(a)X +1649(single)X +1878(bit)X +2000(\(bit)X +2148(0)X +432 3036(corresponding)N +913(to)X +997(bucket)X +1233(0\),)X +1342(and)X +1480(0)X +1542(bits)X +1699(of)X +1788(a)X +1846(hash)X +2014(value)X +432 3124(are)N +560(examined)X +901(to)X +992(determine)X +1342(where)X +1568(a)X +1633(key)X +1778(is)X +1860(placed)X +2099(\(in)X +432 3212(bucket)N +670(0\).)X +801(When)X +1017(bucket)X +1255(0)X +1319(is)X +1396(full,)X +1551(its)X +1650(bit)X +1758(in)X +1844(the)X +1966(bitmap)X +432 3300(\(bit)N +564(0\))X +652(is)X +726(set,)X +856(and)X +993(its)X +1089(contents)X +1377(are)X +1497(split)X +1655(between)X +1943(buckets)X +432 3388(0)N +499(and)X +641(1,)X +727(by)X +833(considering)X +1233(the)X +1357(0)X +2 f +7 s +3356(th)Y +10 s +1 f +1480 3388(bit)N +1590(\(the)X +1741(lowest)X +1976(bit)X +2086(not)X +432 3476(previously)N +800(examined\))X +1169(of)X +1266(the)X +1393(hash)X +1569(value)X +1772(for)X +1895(each)X +2072(key)X +432 3564(within)N +668(the)X +798(bucket.)X +1064(Given)X +1292(a)X +1359(well-designed)X +1840(hash)X +2018(func-)X +432 3652(tion,)N +613(approximately)X +1112(half)X +1273(of)X +1376(the)X +1510(keys)X +1693(will)X +1853(have)X +2041(hash)X +432 3740(values)N +666(with)X +837(the)X +964(0)X +2 f +7 s +3708(th)Y +10 s +1 f +1090 3740(bit)N +1203(set.)X +1341(All)X +1471(such)X +1646(keys)X +1821(and)X +1965(associ-)X +432 3828(ated)N +586(data)X +740(are)X +859(moved)X +1097(to)X +1179(bucket)X +1413(1,)X +1493(and)X +1629(the)X +1747(rest)X +1883(remain)X +2126(in)X +432 3916(bucket)N +666(0.)X +604 4030(After)N +804(this)X +949(split,)X +1135(the)X +1262(\256le)X +1393(now)X +1560(contains)X +1856(two)X +2005(buck-)X +432 4118(ets,)N +562(and)X +699(the)X +818(bitmap)X +1061(contains)X +1349(three)X +1530(bits:)X +1687(the)X +1805(0)X +2 f +7 s +4086(th)Y +10 s +1 f +1922 4118(bit)N +2026(is)X +2099(set)X +432 4206(to)N +525(indicate)X +810(a)X +876(bucket)X +1120(0)X +1190(split)X +1357(when)X +1561(no)X +1671(bits)X +1816(of)X +1913(the)X +2041(hash)X +432 4294(value)N +648(are)X +789(considered,)X +1199(and)X +1357(two)X +1519(more)X +1726(unset)X +1937(bits)X +2094(for)X +432 4382(buckets)N +706(0)X +775(and)X +920(1.)X +1029(The)X +1183(placement)X +1542(of)X +1638(an)X +1742(incoming)X +2072(key)X +432 4470(now)N +604(requires)X +897(examination)X +1327(of)X +1428(the)X +1560(0)X +2 f +7 s +4438(th)Y +10 s +1 f +1691 4470(bit)N +1809(of)X +1910(the)X +2041(hash)X +432 4558(value,)N +667(and)X +824(the)X +963(key)X +1119(is)X +1212(placed)X +1462(either)X +1685(in)X +1787(bucket)X +2041(0)X +2121(or)X +432 4646(bucket)N +674(1.)X +782(If)X +864(either)X +1075(bucket)X +1317(0)X +1385(or)X +1480(bucket)X +1722(1)X +1790(\256lls)X +1937(up,)X +2064(it)X +2135(is)X +432 4734(split)N +598(as)X +693(before,)X +947(its)X +1050(bit)X +1162(is)X +1243(set)X +1360(in)X +1450(the)X +1576(bitmap,)X +1846(and)X +1990(a)X +2054(new)X +432 4822(set)N +541(of)X +628(unset)X +817(bits)X +952(are)X +1071(added)X +1283(to)X +1365(the)X +1483(bitmap.)X +604 4936(Each)N +791(time)X +959(we)X +1079(consider)X +1376(a)X +1437(new)X +1596(bit)X +1705(\(bit)X +1841(n\),)X +1953(we)X +2072(add)X +432 5024(2)N +2 f +7 s +4992(n)Y +9 f +509(+)X +1 f +540(1)X +10 s +595 5024(bits)N +737(to)X +826(the)X +951(bitmap)X +1199(and)X +1341(obtain)X +1567(2)X +2 f +7 s +4992(n)Y +9 f +1644(+)X +1 f +1675(1)X +10 s +1729 5024(more)N +1920(address-)X +432 5112(able)N +595(buckets)X +869(in)X +960(the)X +1087(\256le.)X +1258(As)X +1376(a)X +1441(result,)X +1668(the)X +1795(bitmap)X +2045(con-)X +432 5200(tains)N +618(the)X +751(previous)X +1062(2)X +2 f +7 s +5168(n)Y +9 f +1139(+)X +1 f +1170(1)X +2 f +10 s +9 f +5200(-)Y +1 f +1242(1)X +1317(bits)X +1467(\(1)X +2 f +9 f +1534(+)X +1 f +1578(2)X +2 f +9 f +(+)S +1 f +1662(4)X +2 f +9 f +(+)S +1 f +1746(...)X +2 f +9 f +(+)S +1 f +1850(2)X +2 f +7 s +5168(n)Y +10 s +1 f +1931 5200(\))N +1992(which)X +432 5288(trace)N +649(the)X +807(entire)X +2 f +1050(split)X +1247(history)X +1 f +1529(of)X +1656(the)X +1813(addressable)X +16 s +432 5433 MXY +864 0 Dl +2 f +8 s +472 5488(2)N +1 f +9 s +523 5513(This)N +670(bit-randomizing)X +1153(property)X +1416(is)X +1482(important)X +1780(to)X +1854(obtain)X +2052(radi-)X +432 5593(cally)N +599(different)X +874(hash)X +1033(values)X +1244(for)X +1355(nearly)X +1562(identical)X +1836(keys,)X +2012(which)X +432 5673(in)N +506(turn)X +640(avoids)X +846(clustering)X +1148(of)X +1226(such)X +1376(keys)X +1526(in)X +1600(a)X +1650(single)X +1840(bucket.)X +10 s +2418 538(buckets.)N +2590 652(Given)N +2809(a)X +2868(key)X +3007(and)X +3146(the)X +3267(bitmap)X +3512(created)X +3768(by)X +3871(this)X +4009(algo-)X +2418 740(rithm,)N +2638(we)X +2759(\256rst)X +2910(examine)X +3209(bit)X +3320(0)X +3386(of)X +3479(the)X +3603(bitmap)X +3851(\(the)X +4002(bit)X +4112(to)X +2418 828(consult)N +2673(when)X +2871(0)X +2934(bits)X +3072(of)X +3162(the)X +3283(hash)X +3453(value)X +3650(are)X +3772(being)X +3973(exam-)X +2418 916(ined\).)N +2631(If)X +2713(it)X +2785(is)X +2866(set)X +2982(\(indicating)X +3356(that)X +3503(the)X +3628(bucket)X +3869(split\),)X +4080(we)X +2418 1004(begin)N +2617(considering)X +3012(the)X +3131(bits)X +3267(of)X +3355(the)X +3473(32-bit)X +3684(hash)X +3851(value.)X +4085(As)X +2418 1092(bit)N +2525(n)X +2587(is)X +2662(revealed,)X +2977(a)X +3035(mask)X +3226(equal)X +3422(to)X +3506(2)X +2 f +7 s +1060(n)Y +9 f +3583(+)X +1 f +3614(1)X +2 f +10 s +9 f +1092(-)Y +1 f +3686(1)X +3748(will)X +3894(yield)X +4076(the)X +2418 1180(current)N +2675(bucket)X +2918(address.)X +3228(Adding)X +3496(2)X +2 f +7 s +1148(n)Y +9 f +3573(+)X +1 f +3604(1)X +2 f +10 s +9 f +1180(-)Y +1 f +3676(1)X +3744(to)X +3834(the)X +3960(bucket)X +2418 1268(address)N +2701(identi\256es)X +3035(which)X +3272(bit)X +3397(in)X +3500(the)X +3639(bitmap)X +3902(must)X +4098(be)X +2418 1356(checked.)N +2743(We)X +2876(continue)X +3173(revealing)X +3493(bits)X +3628(of)X +3715(the)X +3833(hash)X +4000(value)X +2418 1444(until)N +2591(all)X +2698(set)X +2814(bits)X +2955(in)X +3043(the)X +3167(bitmap)X +3415(are)X +3540(exhausted.)X +3907(The)X +4058(fol-)X +2418 1532(lowing)N +2682(algorithm,)X +3055(a)X +3133(simpli\256cation)X +3614(of)X +3723(the)X +3863(algorithm)X +2418 1620(due)N +2565(to)X +2658(Ken)X +2823(Thompson)X +3196([THOM90,)X +3590(TOR88],)X +3908(uses)X +4076(the)X +2418 1708(hash)N +2625(value)X +2839(and)X +2995(the)X +3133(bitmap)X +3395(to)X +3497(calculate)X +3823(the)X +3960(bucket)X +2418 1796(address)N +2679(as)X +2766(discussed)X +3093(above.)X +0(Courier)xf 0 f +1 f +0 f +8 s +2418 2095(hash)N +2608(=)X +2684 -0.4038(calchash\(key\);)AX +2418 2183(mask)N +2608(=)X +2684(0;)X +2418 2271(while)N +2646 -0.4018(\(isbitset\(\(hash)AX +3254(&)X +3330(mask\))X +3558(+)X +3634(mask\)\))X +2706 2359(mask)N +2896(=)X +2972(\(mask)X +3200(<<)X +3314(1\))X +3428(+)X +3504(1;)X +2418 2447(bucket)N +2684(=)X +2760(hash)X +2950(&)X +3026(mask;)X +2 f +10 s +3211 2812(sdbm)N +1 f +2590 2944(The)N +2 f +2738(sdbm)X +1 f +2930(library)X +3167(is)X +3243(a)X +3302(public-domain)X +3791(clone)X +3987(of)X +4076(the)X +2 f +2418 3032(ndbm)N +1 f +2638(library,)X +2914(developed)X +3286(by)X +3408(Ozan)X +3620(Yigit)X +3826(to)X +3929(provide)X +2 f +2418 3120(ndbm)N +1 f +2596('s)X +2692(functionality)X +3139(under)X +3359(some)X +3565(versions)X +3869(of)X +3973(UNIX)X +2418 3208(that)N +2559(exclude)X +2830(it)X +2894(for)X +3008(licensing)X +3317(reasons)X +3578([YIG89].)X +3895(The)X +4040(pro-)X +2418 3296(grammer)N +2735(interface,)X +3064(and)X +3207(the)X +3332(basic)X +3524(structure)X +3832(of)X +2 f +3926(sdbm)X +1 f +4121(is)X +2418 3384(identical)N +2733(to)X +2 f +2834(ndbm)X +1 f +3051(but)X +3192(internal)X +3476(details)X +3723(of)X +3828(the)X +2 f +3964(access)X +1 f +2418 3472(function,)N +2726(such)X +2894(as)X +2982(the)X +3101(calculation)X +3474(of)X +3561(the)X +3679(bucket)X +3913(address,)X +2418 3560(and)N +2563(the)X +2690(use)X +2825(of)X +2920(different)X +3225(hash)X +3400(functions)X +3726(make)X +3928(the)X +4054(two)X +2418 3648(incompatible)N +2856(at)X +2934(the)X +3052(database)X +3349(level.)X +2590 3762(The)N +2 f +2740(sdbm)X +1 f +2934(library)X +3173(is)X +3251(based)X +3458(on)X +3562(a)X +3622(simpli\256ed)X +3965(imple-)X +2418 3850(mentation)N +2778(of)X +2885(Larson's)X +3206(1978)X +2 f +3406(dynamic)X +3717(hashing)X +1 f +4009(algo-)X +2418 3938(rithm)N +2616(including)X +2943(the)X +2 f +3066(re\256nements)X +3461(and)X +3605(variations)X +1 f +3953(of)X +4044(sec-)X +2418 4026(tion)N +2562(5)X +2622([LAR78].)X +2956(Larson's)X +3257(original)X +3526(algorithm)X +3857(calls)X +4024(for)X +4138(a)X +2418 4114(forest)N +2635(of)X +2736(binary)X +2975(hash)X +3156(trees)X +3341(that)X +3494(are)X +3626(accessed)X +3941(by)X +4054(two)X +2418 4202(hash)N +2586(functions.)X +2925(The)X +3071(\256rst)X +3216(hash)X +3384(function)X +3672(selects)X +3907(a)X +3964(partic-)X +2418 4290(ular)N +2571(tree)X +2720(within)X +2952(the)X +3078(forest.)X +3309(The)X +3462(second)X +3713(hash)X +3887(function,)X +2418 4378(which)N +2659(is)X +2757(required)X +3070(to)X +3177(be)X +3297(a)X +3377(boolean)X +3675(pseudo-random)X +2418 4466(number)N +2687(generator)X +3015(that)X +3159(is)X +3236(seeded)X +3479(by)X +3583(the)X +3705(key,)X +3865(is)X +3942(used)X +4112(to)X +2418 4554(traverse)N +2733(the)X +2890(tree)X +3070(until)X +3275(internal)X +3579(\(split\))X +3829(nodes)X +4075(are)X +2418 4642(exhausted)N +2763(and)X +2903(an)X +3003(external)X +3286(\(non-split\))X +3648(node)X +3827(is)X +3903(reached.)X +2418 4730(The)N +2571(bucket)X +2813(addresses)X +3149(are)X +3276(stored)X +3500(directly)X +3772(in)X +3861(the)X +3986(exter-)X +2418 4818(nal)N +2536(nodes.)X +2590 4932(Larson's)N +2903(re\256nements)X +3309(are)X +3440(based)X +3655(on)X +3767(the)X +3897(observa-)X +2418 5020(tion)N +2570(that)X +2718(the)X +2844(nodes)X +3059(can)X +3199(be)X +3303(represented)X +3702(by)X +3809(a)X +3872(single)X +4090(bit)X +2418 5108(that)N +2569(is)X +2653(set)X +2773(for)X +2898(internal)X +3174(nodes)X +3392(and)X +3539(not)X +3672(set)X +3791(for)X +3915(external)X +2418 5196(nodes,)N +2652(resulting)X +2959(in)X +3048(a)X +3111(radix)X +3303(search)X +3536(trie.)X +3709(Figure)X +3944(1)X +4010(illus-)X +2418 5284(trates)N +2621(this.)X +2804(Nodes)X +3037(A)X +3123(and)X +3267(B)X +3348(are)X +3475(internal)X +3748(\(split\))X +3967(nodes,)X +2418 5372(thus)N +2573(having)X +2813(no)X +2915(bucket)X +3151(addresses)X +3480(associated)X +3831(with)X +3994(them.)X +2418 5460(Instead,)N +2693(the)X +2814(external)X +3096(nodes)X +3306(\(C,)X +3429(D,)X +3530(and)X +3669(E\))X +3768(each)X +3938(need)X +4112(to)X +2418 5548(refer)N +2594(to)X +2679(a)X +2738(bucket)X +2975(address.)X +3279(These)X +3494(bucket)X +3731(addresses)X +4062(can)X +2418 5636(be)N +2529(stored)X +2760(in)X +2857(the)X +2990(trie)X +3132(itself)X +3327(where)X +3559(the)X +3691(subtries)X +3974(would)X +3 f +432 5960(2)N +2970(USENIX)X +9 f +3292(-)X +3 f +3356(Winter)X +3621('91)X +9 f +3748(-)X +3 f +3812(Dallas,)X +4065(TX)X + +3 p +%%Page: 3 3 +0(Courier)xf 0 f +10 s 10 xH 0 xS 0 f +3 f +720 258(Seltzer)N +977(&)X +1064(Yigit)X +3278(A)X +3356(New)X +3528(Hashing)X +3831(Package)X +4136(for)X +4259(UNIX)X +1 f +720 538(live)N +862(if)X +933(they)X +1092(existed)X +1340([KNU68].)X +1709(For)X +1841(example,)X +2154(if)X +2224(nodes)X +2432(F)X +720 626(and)N +858(G)X +938(were)X +1117(the)X +1237(children)X +1522(of)X +1610(node)X +1787(C,)X +1881(the)X +2000(bucket)X +2235(address)X +720 714(L00)N +886(could)X +1101(reside)X +1330(in)X +1429(the)X +1563(bits)X +1714(that)X +1870(will)X +2030(eventually)X +2400(be)X +720 802(used)N +887(to)X +969(store)X +1145(nodes)X +1352(F)X +1416(and)X +1552(G)X +1630(and)X +1766(all)X +1866(their)X +2033(children.)X +10 f +720 890 -0.0930(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)AN +3 f +1894 2247(L1)N +784 1925(A)N +1431(E)X +1106 2247(D)N +1428 1281(C)N +1109 1603(B)N +1884 1930(L01)N +1879 1286(L00)N +1221 1814(1)N +903 2131(1)N +1221 1402(0)N +903 1714(0)N +1 Dt +1397 1821 MXY +-8 -32 Dl +-5 19 Dl +-20 6 Dl +33 7 Dl +-187 -182 Dl +1397 1322 MXY +-33 7 Dl +20 6 Dl +5 19 Dl +8 -32 Dl +-187 182 Dl +1069 1639 MXY +-32 7 Dl +20 6 Dl +5 19 Dl +7 -32 Dl +-186 182 Dl +1374 1891 MXY +185 Dc +1779 2133 MXY +0 161 Dl +322 0 Dl +0 -161 Dl +-322 0 Dl +1811 MY +0 161 Dl +322 0 Dl +0 -161 Dl +-322 0 Dl +1166 MY +0 161 Dl +322 0 Dl +0 -161 Dl +-322 0 Dl +1052 2213 MXY +185 Dc +1569 MY +185 Dc +720 1881 MXY +185 Dc +1779 2213 MXY +-28 -17 Dl +10 17 Dl +-10 18 Dl +28 -18 Dl +-543 0 Dl +1769 1891 MXY +-28 -18 Dl +10 18 Dl +-10 18 Dl +28 -18 Dl +-201 0 Dl +1364 1247 MXY +185 Dc +1769 MX +-28 -18 Dl +10 18 Dl +-10 18 Dl +28 -18 Dl +-201 0 Dl +1064 2143 MXY +-7 -32 Dl +-5 19 Dl +-20 6 Dl +32 7 Dl +-181 -181 Dl +3 Dt +-1 Ds +8 s +720 2482(Figure)N +925(1:)X +1 f +1002(Radix)X +1179(search)X +1365(trie)X +1474(with)X +1612(internal)X +1831(nodes)X +2004(A)X +2074(and)X +2189(B,)X +2271(external)X +720 2570(nodes)N +891(C,)X +972(D,)X +1056(and)X +1170(E,)X +1247(and)X +1361(bucket)X +1553(addresses)X +1819(stored)X +1997(in)X +2069(the)X +2168(unused)X +2370(por-)X +720 2658(tion)N +836(of)X +905(the)X +999(trie.)X +10 s +10 f +720 2922 -0.0930(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)AN +1 f +892 3124(Further)N +1153(simpli\256cations)X +1647(of)X +1738(the)X +1860(above)X +2076([YIG89])X +2377(are)X +720 3212(possible.)N +1038(Using)X +1265(a)X +1337(single)X +1564(radix)X +1765(trie)X +1908(to)X +2006(avoid)X +2219(the)X +2352(\256rst)X +720 3300(hash)N +904(function,)X +1227(replacing)X +1562(the)X +1696(pseudo-random)X +2231(number)X +720 3388(generator)N +1052(with)X +1222(a)X +1286(well)X +1452(designed,)X +1785(bit-randomizing)X +2329(hash)X +720 3476(function,)N +1053(and)X +1215(using)X +1434(the)X +1578(portion)X +1855(of)X +1967(the)X +2110(hash)X +2302(value)X +720 3564(exposed)N +1021(during)X +1268(the)X +1404(trie)X +1549(traversal)X +1864(as)X +1969(a)X +2042(direct)X +2262(bucket)X +720 3652(address)N +990(results)X +1228(in)X +1319(an)X +2 f +1424(access)X +1 f +1663(function)X +1959(that)X +2108(works)X +2333(very)X +720 3740(similar)N +974(to)X +1068(Thompson's)X +1499(algorithm)X +1841(above.)X +2084(The)X +2240(follow-)X +720 3828(ing)N +847(algorithm)X +1183(uses)X +1346(the)X +1469(hash)X +1641(value)X +1840(to)X +1927(traverse)X +2206(a)X +2266(linear-)X +720 3916(ized)N +874(radix)X +1059(trie)X +2 f +8 s +1166 3891(3)N +1 f +10 s +1218 3916(starting)N +1478(at)X +1556(the)X +1674(0)X +2 f +7 s +3884(th)Y +10 s +1 f +1791 3916(bit.)N +0 f +8 s +720 4215(tbit)N +910(=)X +986(0;)X +1296(/*)X +1410(radix)X +1638(trie)X +1828(index)X +2056(*/)X +720 4303(hbit)N +910(=)X +986(0;)X +1296(/*)X +1410(hash)X +1600(bit)X +1752(index)X +2056(*/)X +720 4391(mask)N +910(=)X +986(0;)X +720 4479(hash)N +910(=)X +986 -0.4038(calchash\(key\);)AX +720 4655(for)N +872(\(mask)X +1100(=)X +1176(0;)X +910 4743 -0.4018(isbitset\(tbit\);)AN +910 4831(mask)N +1100(=)X +1176(\(mask)X +1404(<<)X +1518(1\))X +1632(+)X +1708(1\))X +1008 4919(if)N +1122(\(hash)X +1350(&)X +1426(\(1)X +1540(<<)X +1654 -0.4219(hbit++\)\)\))AX +1160 5007(/*)N +1274(right)X +1502(son)X +1692(*/)X +1160 5095(tbit)N +1350(=)X +1426(2)X +1502(*)X +1578(tbit)X +1768(+)X +1844(2;)X +1008 5183(else)N +1 f +16 s +720 5353 MXY +864 0 Dl +2 f +8 s +760 5408(3)N +1 f +9 s +818 5433(A)N +896(linearized)X +1206(radix)X +1380(trie)X +1502(is)X +1576(merely)X +1802(an)X +1895(array)X +2068(representation)X +720 5513(of)N +800(the)X +908(radix)X +1076(search)X +1280(trie)X +1396(described)X +1692(above.)X +1920(The)X +2052(children)X +2308(of)X +2388(the)X +720 5593(node)N +885(with)X +1038(index)X +1223(i)X +1267(can)X +1391(be)X +1483(found)X +1675(at)X +1751(the)X +1863(nodes)X +2055(indexed)X +2307(2*i+1)X +720 5673(and)N +842(2*i+2.)X +0 f +8 s +3146 538(/*)N +3260(left)X +3450(son)X +3678(*/)X +3146 626(tbit)N +3336(=)X +3412(2)X +3488(*)X +3564(tbit)X +3754(+)X +3830(1;)X +2706 802(bucket)N +2972(=)X +3048(hash)X +3238(&)X +3314(mask;)X +2 f +10 s +3495 1167(gdbm)N +1 f +2878 1299(The)N +3027(gdbm)X +3233(\(GNU)X +3458(data)X +3616(base)X +3783(manager\))X +4111(library)X +4349(is)X +4426(a)X +2706 1387(UNIX)N +2933(database)X +3236(manager)X +3539(written)X +3792(by)X +3897(Philip)X +4112(A.)X +4215(Nelson,)X +2706 1475(and)N +2848(made)X +3048(available)X +3364(as)X +3457(a)X +3518(part)X +3668(of)X +3760(the)X +3883(FSF)X +4040(software)X +4342(dis-)X +2706 1563(tribution.)N +3052(The)X +3207(gdbm)X +3419(library)X +3663(provides)X +3969(the)X +4097(same)X +4292(func-)X +2706 1651(tionality)N +3028(of)X +3151(the)X +2 f +3304(dbm)X +1 f +3442(/)X +2 f +3464(ndbm)X +1 f +3697(libraries)X +4015([NEL90])X +4360(but)X +2706 1739(attempts)N +3018(to)X +3121(avoid)X +3340(some)X +3550(of)X +3658(their)X +3846(shortcomings.)X +4337(The)X +2706 1827(gdbm)N +2918(library)X +3162(allows)X +3401(for)X +3525(arbitrary-length)X +4059(data,)X +4242(and)X +4387(its)X +2706 1915(database)N +3027(is)X +3124(a)X +3203(singular,)X +3524(non-sparse)X +2 f +8 s +3872 1890(4)N +1 f +10 s +3947 1915(\256le.)N +4112(The)X +4280(gdbm)X +2706 2003(library)N +2947(also)X +3103(includes)X +2 f +3396(dbm)X +1 f +3560(and)X +2 f +3702(ndbm)X +1 f +3906(compatible)X +4288(inter-)X +2706 2091(faces.)N +2878 2205(The)N +3025(gdbm)X +3229(library)X +3465(is)X +3540(based)X +3745(on)X +2 f +3847(extensible)X +4189(hashing)X +1 f +4442(,)X +2706 2293(a)N +2766(dynamic)X +3066(hashing)X +3339(algorithm)X +3674(by)X +3778(Fagin)X +3984(et)X +4066(al)X +4148([FAG79].)X +2706 2381(This)N +2881(algorithm)X +3225(differs)X +3467(from)X +3655(the)X +3785(previously)X +4155(discussed)X +2706 2469(algorithms)N +3069(in)X +3152(that)X +3293(it)X +3358(uses)X +3517(a)X +2 f +3574(directory)X +1 f +3889(that)X +4030(is)X +4103(a)X +4159(collapsed)X +2706 2557(representation)N +3192([ENB88])X +3517(of)X +3615(the)X +3744(radix)X +3940(search)X +4177(trie)X +4315(used)X +2706 2645(by)N +2 f +2806(sdbm)X +1 f +2975(.)X +10 f +2706 2733 -0.0930(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)AN +3 f +7 s +3572 3761(L1)N +1 Dt +3485 3738 MXY +-20 -13 Dl +7 13 Dl +-7 13 Dl +20 -13 Dl +-400 0 Dl +3180 3027 MXY +136 Dc +2706 3494 MXY +136 Dc +2950 3264 MXY +136 Dc +3738 MY +136 Dc +3485 2968 MXY +0 118 Dl +238 0 Dl +0 -118 Dl +-238 0 Dl +3442 MY +0 119 Dl +238 0 Dl +0 -119 Dl +-238 0 Dl +3679 MY +0 119 Dl +238 0 Dl +0 -119 Dl +-238 0 Dl +3187 3501 MXY +136 Dc +2963 3316 MXY +-24 5 Dl +15 4 Dl +4 15 Dl +5 -24 Dl +-137 134 Dl +3204 3083 MXY +-24 5 Dl +15 4 Dl +3 14 Dl +6 -23 Dl +-137 133 Dl +3204 3450 MXY +-6 -24 Dl +-3 14 Dl +-15 5 Dl +24 5 Dl +-137 -134 Dl +2842 3369(0)N +3075 3139(0)N +2842 3676(1)N +3075 3443(1)N +3562 3054(L00)N +3565 3528(L01)N +4197 2968 MXY +0 118 Dl +237 0 Dl +0 -118 Dl +-237 0 Dl +3205 MY +0 119 Dl +237 0 Dl +0 -119 Dl +-237 0 Dl +3561 MY +0 118 Dl +237 0 Dl +0 -118 Dl +-237 0 Dl +3960 2909 MXY +0 237 Dl +118 0 Dl +0 -237 Dl +-118 0 Dl +3146 MY +0 237 Dl +118 0 Dl +0 -237 Dl +-118 0 Dl +3383 MY +0 237 Dl +118 0 Dl +0 -237 Dl +-118 0 Dl +3620 MY +0 237 Dl +118 0 Dl +0 -237 Dl +-118 0 Dl +4197 3027 MXY +-21 -13 Dl +8 13 Dl +-8 13 Dl +21 -13 Dl +-119 0 Dl +4197 3264 MXY +-21 -13 Dl +8 13 Dl +-8 13 Dl +21 -13 Dl +-119 0 Dl +3501 MY +59 0 Dl +0 89 Dl +4078 3738 MXY +59 0 Dl +0 -88 Dl +4197 3590 MXY +-21 -13 Dl +8 13 Dl +-8 13 Dl +21 -13 Dl +-60 0 Dl +4197 3650 MXY +-21 -13 Dl +8 13 Dl +-8 13 Dl +21 -13 Dl +-60 0 Dl +3991 3050(00)N +3991 3287(01)N +3991 3524(10)N +3991 3761(11)N +4269 3050(L00)N +4269 3287(L01)N +4283 3643(L1)N +3485 3501 MXY +-20 -13 Dl +7 13 Dl +-7 13 Dl +20 -13 Dl +-155 0 Dl +3485 3027 MXY +-20 -13 Dl +7 13 Dl +-7 13 Dl +20 -13 Dl +-163 0 Dl +2967 3687 MXY +-5 -24 Dl +-4 14 Dl +-15 4 Dl +24 6 Dl +-141 -141 Dl +3 Dt +-1 Ds +8 s +2706 4033(Figure)N +2903(2:)X +1 f +2972(A)X +3034(radix)X +3181(search)X +3359(trie)X +3460(and)X +3568(a)X +3612(directory)X +3858(representing)X +4189(the)X +4283(trie.)X +10 s +10 f +2706 4209 -0.0930(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)AN +1 f +2878 4411(In)N +2968(this)X +3106(algorithm,)X +3460(a)X +3519(directory)X +3832(consists)X +4108(of)X +4198(a)X +4256(search)X +2706 4499(trie)N +2847(of)X +2947(depth)X +2 f +3158(n)X +1 f +3211(,)X +3264(containing)X +3635(2)X +2 f +7 s +4467(n)Y +10 s +1 f +3749 4499(bucket)N +3996(addresses)X +4337(\(i.e.)X +2706 4587(each)N +2897(element)X +3194(of)X +3304(the)X +3445(trie)X +3594(is)X +3689(a)X +3767(bucket)X +4023(address\).)X +4373(To)X +2706 4675(access)N +2935(the)X +3056(hash)X +3226(table,)X +3425(a)X +3483(32-bit)X +3696(hash)X +3865(value)X +4061(is)X +4136(calculated)X +2706 4763(and)N +2 f +2861(n)X +1 f +2953(bits)X +3107(of)X +3213(the)X +3350(value)X +3563(are)X +3701(used)X +3886(to)X +3986(index)X +4202(into)X +4364(the)X +2706 4851(directory)N +3018(to)X +3102(obtain)X +3324(a)X +3382(bucket)X +3618(address.)X +3921(It)X +3992(is)X +4067(important)X +4400(to)X +2706 4939(note)N +2866(that)X +3008(multiple)X +3296(entries)X +3532(of)X +3620(this)X +3756(directory)X +4067(may)X +4226(contain)X +2706 5027(the)N +2833(same)X +3026(bucket)X +3268(address)X +3537(as)X +3632(a)X +3696(result)X +3902(of)X +3997(directory)X +4315(dou-)X +2706 5115(bling)N +2903(during)X +3145(bucket)X +3392(splitting.)X +3706(Figure)X +3948(2)X +4021(illustrates)X +4364(the)X +2706 5203(relationship)N +3126(between)X +3436(a)X +3513(typical)X +3772(\(skewed\))X +4108(search)X +4355(trie)X +2706 5291(and)N +2850(its)X +2953(directory)X +3271(representation.)X +3774(The)X +3927(formation)X +4270(of)X +4364(the)X +2706 5379(directory)N +3016(shown)X +3245(in)X +3327(the)X +3445(\256gure)X +3652(is)X +3725(as)X +3812(follows.)X +16 s +2706 5593 MXY +864 0 Dl +2 f +8 s +2746 5648(4)N +1 f +9 s +2796 5673(It)N +2858(does)X +3008(not)X +3118(contain)X +3348(holes.)X +3 f +10 s +720 5960(USENIX)N +9 f +1042(-)X +3 f +1106(Winter)X +1371('91)X +9 f +1498(-)X +3 f +1562(Dallas,)X +1815(TX)X +4424(3)X + +4 p +%%Page: 4 4 +0(Courier)xf 0 f +10 s 10 xH 0 xS 0 f +3 f +432 258(A)N +510(New)X +682(Hashing)X +985(Package)X +1290(for)X +1413(UNIX)X +3663(Seltzer)X +3920(&)X +4007(Yigit)X +1 f +604 538(Initially,)N +937(there)X +1158(is)X +1271(one)X +1446(slot)X +1620(in)X +1741(the)X +1898(directory)X +432 626(addressing)N +802(a)X +865(single)X +1083(bucket.)X +1364(The)X +1515(depth)X +1719(of)X +1812(the)X +1936(trie)X +2069(is)X +2148(0)X +432 714(and)N +577(0)X +646(bits)X +790(of)X +886(each)X +1063(hash)X +1239(value)X +1442(are)X +1570(examined)X +1910(to)X +2000(deter-)X +432 802(mine)N +624(in)X +718(which)X +946(bucket)X +1192(to)X +1286(place)X +1488(a)X +1556(key;)X +1726(all)X +1837(keys)X +2015(go)X +2126(in)X +432 890(bucket)N +682(0.)X +797(When)X +1024(this)X +1174(bucket)X +1423(is)X +1511(full,)X +1677(its)X +1787(contents)X +2089(are)X +432 978(divided)N +698(between)X +992(L0)X +1107(and)X +1249(L1)X +1363(as)X +1455(was)X +1605(done)X +1786(in)X +1873(the)X +1996(previ-)X +432 1066(ously)N +664(discussed)X +1030(algorithms.)X +1471(After)X +1700(this)X +1874(split,)X +2090(the)X +432 1154(address)N +710(of)X +814(the)X +948(second)X +1207(bucket)X +1457(must)X +1648(be)X +1760(stored)X +1992(in)X +2090(the)X +432 1242(directory.)N +796(To)X +939(accommodate)X +1438(the)X +1589(new)X +1776(address,)X +2090(the)X +432 1330(directory)N +752(is)X +835(split)X +2 f +8 s +972 1305(5)N +1 f +10 s +1330(,)Y +1054(by)X +1163(doubling)X +1476(it,)X +1569(thus)X +1731(increasing)X +2090(the)X +432 1418(depth)N +630(of)X +717(the)X +835(directory)X +1145(by)X +1245(one.)X +604 1532(After)N +813(this)X +967(split,)X +1163(a)X +1237(single)X +1466(bit)X +1588(of)X +1693(the)X +1829(hash)X +2014(value)X +432 1620(needs)N +663(to)X +773(be)X +896(examined)X +1255(to)X +1364(decide)X +1621(whether)X +1927(the)X +2072(key)X +432 1708(belongs)N +711(to)X +803(L0)X +922(or)X +1019(L1.)X +1158(Once)X +1358(one)X +1504(of)X +1601(these)X +1795(buckets)X +2069(\256lls)X +432 1796(\(L0)N +578(for)X +702(example\),)X +1051(it)X +1125(is)X +1208(split)X +1375(as)X +1472(before,)X +1728(and)X +1873(the)X +2000(direc-)X +432 1884(tory)N +585(is)X +662(split)X +823(again)X +1021(to)X +1107(make)X +1305(room)X +1498(for)X +1615(the)X +1736(address)X +2000(of)X +2090(the)X +432 1972(third)N +618(bucket.)X +927(This)X +1104(splitting)X +1400(causes)X +1645(the)X +1778(addresses)X +2121(of)X +432 2060(the)N +567(non-splitting)X +1012(bucket)X +1263(\(L1\))X +1443(to)X +1541(be)X +1653(duplicated.)X +2063(The)X +432 2148(directory)N +766(now)X +948(has)X +1099(four)X +1277(entries,)X +1555(a)X +1635(depth)X +1857(of)X +1968(2,)X +2072(and)X +432 2236(indexes)N +700(the)X +821(buckets)X +1089(L00,)X +1261(L01)X +1413(and)X +1552(L1,)X +1684(as)X +1774(shown)X +2006(in)X +2090(the)X +432 2324(Figure)N +661(2.)X +604 2438(The)N +756(crucial)X +1002(part)X +1154(of)X +1247(the)X +1371(algorithm)X +1708(is)X +1787(the)X +1911(observa-)X +432 2526(tion)N +580(that)X +724(L1)X +837(is)X +914(addressed)X +1255(twice)X +1453(in)X +1539(the)X +1661(directory.)X +1995(If)X +2073(this)X +432 2614(bucket)N +679(were)X +869(to)X +964(split)X +1134(now,)X +1324(the)X +1454(directory)X +1776(already)X +2045(con-)X +432 2702(tains)N +611(room)X +808(to)X +898(hold)X +1067(the)X +1192(address)X +1460(of)X +1554(the)X +1679(new)X +1840(bucket.)X +2121(In)X +432 2790(general,)N +711(the)X +831(relationship)X +1231(between)X +1521(the)X +1641(directory)X +1953(and)X +2090(the)X +432 2878(number)N +704(of)X +798(bucket)X +1039(addresses)X +1374(contained)X +1713(therein)X +1962(is)X +2041(used)X +432 2966(to)N +517(decide)X +750(when)X +947(to)X +1031(split)X +1190(the)X +1310(directory.)X +1662(Each)X +1845(bucket)X +2081(has)X +432 3054(a)N +505(depth,)X +740(\()X +2 f +767(n)X +7 s +3070(b)Y +10 s +1 f +848 3054(\),)N +932(associated)X +1299(with)X +1478(it)X +1558(and)X +1710(appears)X +1992(in)X +2090(the)X +432 3142(directory)N +744(exactly)X +998(2)X +2 f +7 s +3106(n)Y +9 f +1075(-)X +2 f +1106(n)X +4 s +3110(b)Y +7 s +1 f +10 s +1181 3142(times.)N +1396(When)X +1610(a)X +1668(bucket)X +1904(splits,)X +2113(its)X +432 3230(depth)N +638(increases)X +961(by)X +1069(one.)X +1253(The)X +1406(directory)X +1724(must)X +1907(split)X +2072(any)X +432 3318(time)N +602(a)X +665(bucket's)X +964(depth)X +1169(exceeds)X +1451(the)X +1576(depth)X +1781(of)X +1875(the)X +2000(direc-)X +432 3406(tory.)N +630(The)X +784(following)X +1123(code)X +1303(fragment)X +1621(helps)X +1818(to)X +1908(illustrate)X +432 3494(the)N +554(extendible)X +912(hashing)X +1185(algorithm)X +1520([FAG79])X +1838(for)X +1955(access-)X +432 3582(ing)N +554(individual)X +898(buckets)X +1163(and)X +1299(maintaining)X +1701(the)X +1819(directory.)X +0 f +8 s +432 3881(hash)N +622(=)X +698 -0.4038(calchash\(key\);)AX +432 3969(mask)N +622(=)X +698 -0.4018(maskvec[depth];)AX +432 4145(bucket)N +698(=)X +774 -0.4038(directory[hash)AX +1344(&)X +1420(mask];)X +432 4321(/*)N +546(Key)X +698 -0.4219(Insertion)AX +1078(*/)X +432 4409(if)N +546 -0.4038(\(store\(bucket,)AX +1116(key,)X +1306(data\))X +1534(==)X +1648(FAIL\))X +1876({)X +720 4497(newbl)N +948(=)X +1024 -0.4167(getpage\(\);)AX +720 4585 -0.4000(bucket->depth++;)AN +720 4673 -0.4091(newbl->depth)AN +1214(=)X +1290 -0.4038(bucket->depth;)AX +720 4761(if)N +834 -0.4038(\(bucket->depth)AX +1404(>)X +1480(depth\))X +1746({)X +1008 4849(/*)N +1122(double)X +1388 -0.4219(directory)AX +1768(*/)X +1008 4937(depth++;)N +1 f +16 s +432 5033 MXY +864 0 Dl +2 f +8 s +472 5088(5)N +1 f +9 s +534 5113(This)N +692(decision)X +962(to)X +1048(split)X +1202(the)X +1319(directory)X +1608(is)X +1685(based)X +1878(on)X +1979(a)X +2040(com-)X +432 5193(parison)N +666(of)X +748(the)X +858(depth)X +1040(of)X +1121(the)X +1230(page)X +1387(being)X +1568(split)X +1713(and)X +1838(the)X +1947(depth)X +2128(of)X +432 5273(the)N +543(trie.)X +698(In)X +781(Figure)X +992(2,)X +1069(the)X +1180(depths)X +1390(of)X +1472(both)X +1622(L00)X +1760(and)X +1886(L01)X +2024(are)X +2134(2,)X +432 5353(whereas)N +689(the)X +798(depth)X +979(of)X +1060(L1)X +1161(is)X +1230(1.)X +1323(Therefore,)X +1646(if)X +1710(L1)X +1810(were)X +1970(to)X +2046(split,)X +432 5433(the)N +543(directory)X +826(would)X +1029(not)X +1144(need)X +1303(to)X +1382(split.)X +1565(In)X +1648(reality,)X +1872(a)X +1926(bucket)X +2140(is)X +432 5513(allocated)N +727(for)X +846(the)X +969(directory)X +1264(at)X +1351(the)X +1474(time)X +1637(of)X +1732(\256le)X +1858(creation)X +2124(so)X +432 5593(although)N +707(the)X +818(directory)X +1100(splits)X +1274(logically,)X +1566(physical)X +1828(splits)X +2002(do)X +2096(not)X +432 5673(occur)N +610(until)X +760(the)X +866(\256le)X +976(becomes)X +1246(quite)X +1408(large.)X +0 f +8 s +2994 538 -0.4219(directory)AN +3374(=)X +3450 -0.3971(double\(directory\);)AX +2706 626(})N +2706 714 -0.3958(splitbucket\(bucket,)AN +3466(newbl\))X +2706 802(...)N +2418 890(})N +2 f +10 s +3169 1255(hsearch)N +1 f +2590 1387(Since)N +2 f +2807(hsearch)X +1 f +3100(does)X +3286(not)X +3427(have)X +3617(to)X +3717(translate)X +4027(hash)X +2418 1475(values)N +2659(into)X +2819(disk)X +2988(addresses,)X +3352(it)X +3432(can)X +3579(use)X +3721(much)X +3934(simpler)X +2418 1563(algorithms)N +2808(than)X +2994(those)X +3211(de\256ned)X +3495(above.)X +3775(System)X +4058(V's)X +2 f +2418 1651(hsearch)N +1 f +2708(constructs)X +3069(a)X +3141(\256xed-size)X +3489(hash)X +3671(table)X +3862(\(speci\256ed)X +2418 1739(by)N +2519(the)X +2637(user)X +2791(at)X +2869(table)X +3045(creation\).)X +3391(By)X +3504(default,)X +3767(a)X +3823(multiplica-)X +2418 1827(tive)N +2570(hash)X +2748(function)X +3046(based)X +3260(on)X +3371(that)X +3522(described)X +3861(in)X +3954(Knuth,)X +2418 1915(Volume)N +2710(3,)X +2804(section)X +3065(6.4)X +3199([KNU68])X +3541(is)X +3628(used)X +3809(to)X +3905(obtain)X +4138(a)X +2418 2003(primary)N +2694(bucket)X +2930(address.)X +3233(If)X +3309(this)X +3446(bucket)X +3681(is)X +3755(full,)X +3907(a)X +3964(secon-)X +2418 2091(dary)N +2593(multiplicative)X +3069(hash)X +3248(value)X +3454(is)X +3538(computed)X +3885(to)X +3978(de\256ne)X +2418 2179(the)N +2542(probe)X +2751(interval.)X +3062(The)X +3213(probe)X +3422(interval)X +3693(is)X +3772(added)X +3989(to)X +4076(the)X +2418 2267(original)N +2712(bucket)X +2971(address)X +3257(\(modulo)X +3573(the)X +3716(table)X +3916(size\))X +4112(to)X +2418 2355(obtain)N +2658(a)X +2734(new)X +2908(bucket)X +3162(address.)X +3483(This)X +3665(process)X +3946(repeats)X +2418 2443(until)N +2588(an)X +2688(empty)X +2911(bucket)X +3148(is)X +3224(found.)X +3474(If)X +3551(no)X +3654(bucket)X +3891(is)X +3967(found,)X +2418 2531(an)N +2514(insertion)X +2814(fails)X +2972(with)X +3134(a)X +3190(``table)X +3420(full'')X +3605(condition.)X +2590 2645(The)N +2768(basic)X +2986(algorithm)X +3350(may)X +3541(be)X +3670(modi\256ed)X +4006(by)X +4138(a)X +2418 2733(number)N +2705(of)X +2813(compile)X +3112(time)X +3295(options)X +3571(available)X +3902(to)X +4005(those)X +2418 2821(users)N +2604(with)X +2767(AT&T)X +3006(source)X +3237(code.)X +3450(First,)X +3637(the)X +3756(package)X +4040(pro-)X +2418 2909(vides)N +2638(two)X +2809(options)X +3094(for)X +3238(hash)X +3435(functions.)X +3803(Users)X +4036(may)X +2418 2997(specify)N +2690(their)X +2877(own)X +3055(hash)X +3242(function)X +3549(by)X +3669(compiling)X +4032(with)X +2418 3085(``USCR'')N +2757(de\256ned)X +3016(and)X +3155(declaring)X +3477(and)X +3616(de\256ning)X +3901(the)X +4022(vari-)X +2418 3173(able)N +2 f +2578(hcompar)X +1 f +2863(,)X +2909(a)X +2971(function)X +3263(taking)X +3488(two)X +3633(string)X +3840(arguments)X +2418 3261(and)N +2560(returning)X +2880(an)X +2982(integer.)X +3271(Users)X +3480(may)X +3643(also)X +3797(request)X +4054(that)X +2418 3349(hash)N +2587(values)X +2814(be)X +2912(computed)X +3250(simply)X +3489(by)X +3590(taking)X +3811(the)X +3930(modulo)X +2418 3437(of)N +2521(key)X +2673(\(using)X +2909(division)X +3201(rather)X +3424(than)X +3597(multiplication)X +4080(for)X +2418 3525(hash)N +2589(value)X +2787(calculation\).)X +3230(If)X +3308(this)X +3447(technique)X +3783(is)X +3859(used,)X +4049(col-)X +2418 3613(lisions)N +2651(are)X +2775(resolved)X +3072(by)X +3176(scanning)X +3485(sequentially)X +3896(from)X +4076(the)X +2418 3701(selected)N +2702(bucket)X +2941(\(linear)X +3176(probing\).)X +3517(This)X +3684(option)X +3913(is)X +3991(avail-)X +2418 3789(able)N +2572(by)X +2672(de\256ning)X +2954(the)X +3072(variable)X +3351(``DIV'')X +3622(at)X +3700(compile)X +3978(time.)X +2590 3903(A)N +2720(second)X +3015(option,)X +3311(based)X +3565(on)X +3716(an)X +3863(algorithm)X +2418 3991(discovered)N +2787(by)X +2888(Richard)X +3163(P.)X +3248(Brent,)X +3466(rearranges)X +3822(the)X +3940(table)X +4116(at)X +2418 4079(the)N +2549(time)X +2724(of)X +2824(insertion)X +3137(in)X +3232(order)X +3434(to)X +3528(speed)X +3743(up)X +3855(retrievals.)X +2418 4167(The)N +2571(basic)X +2764(idea)X +2926(is)X +3007(to)X +3097(shorten)X +3361(long)X +3531(probe)X +3741(sequences)X +4094(by)X +2418 4255(lengthening)N +2833(short)X +3030(probe)X +3249(sequences.)X +3651(Once)X +3857(the)X +3991(probe)X +2418 4343(chain)N +2613(has)X +2741(exceeded)X +3062(some)X +3252(threshold)X +3571(\(Brent)X +3796(suggests)X +4087(2\),)X +2418 4431(we)N +2541(attempt)X +2809(to)X +2899(shuf\257e)X +3145(any)X +3289(colliding)X +3601(keys)X +3776(\(keys)X +3978(which)X +2418 4519(appeared)N +2734(in)X +2821(the)X +2944(probe)X +3152(sequence)X +3471(of)X +3562(the)X +3684(new)X +3842(key\).)X +4049(The)X +2418 4607(details)N +2652(of)X +2744(this)X +2884(key)X +3025(shuf\257ing)X +3333(can)X +3469(be)X +3569(found)X +3780(in)X +3866([KNU68])X +2418 4695(and)N +2576([BRE73].)X +2946(This)X +3129(algorithm)X +3481(may)X +3660(be)X +3777(obtained)X +4094(by)X +2418 4783(de\256ning)N +2700(the)X +2818(variable)X +3097(``BRENT'')X +3487(at)X +3565(compile)X +3843(time.)X +2590 4897(A)N +2698(third)X +2899(set)X +3038(of)X +3154(options,)X +3458(obtained)X +3783(by)X +3912(de\256ning)X +2418 4985(``CHAINED'',)N +2943(use)X +3086(linked)X +3321(lists)X +3484(to)X +3581(resolve)X +3848(collisions.)X +2418 5073(Either)N +2647(of)X +2747(the)X +2878(primary)X +3164(hash)X +3343(function)X +3642(described)X +3982(above)X +2418 5161(may)N +2584(be)X +2688(used,)X +2882(but)X +3011(all)X +3118(collisions)X +3451(are)X +3577(resolved)X +3876(by)X +3983(build-)X +2418 5249(ing)N +2554(a)X +2623(linked)X +2856(list)X +2986(of)X +3086(entries)X +3333(from)X +3522(the)X +3653(primary)X +3940(bucket.)X +2418 5337(By)N +2542(default,)X +2816(new)X +2981(entries)X +3226(will)X +3381(be)X +3488(added)X +3711(to)X +3804(a)X +3871(bucket)X +4116(at)X +2418 5425(the)N +2541(beginning)X +2886(of)X +2978(the)X +3101(bucket)X +3339(chain.)X +3577(However,)X +3916(compile)X +2418 5513(options)N +2706(``SORTUP'')X +3173(or)X +3293(``SORTDOWN'')X +3908(may)X +4098(be)X +2418 5601(speci\256ed)N +2723(to)X +2805(order)X +2995(the)X +3113(hash)X +3280(chains)X +3505(within)X +3729(each)X +3897(bucket.)X +3 f +432 5960(4)N +2970(USENIX)X +9 f +3292(-)X +3 f +3356(Winter)X +3621('91)X +9 f +3748(-)X +3 f +3812(Dallas,)X +4065(TX)X + +5 p +%%Page: 5 5 +0(Courier)xf 0 f +10 s 10 xH 0 xS 0 f +3 f +720 258(Seltzer)N +977(&)X +1064(Yigit)X +3278(A)X +3356(New)X +3528(Hashing)X +3831(Package)X +4136(for)X +4259(UNIX)X +2 f +1444 538(dynahash)N +1 f +892 670(The)N +2 f +1054(dynahash)X +1 f +1398(library,)X +1669(written)X +1932(by)X +2048(Esmond)X +2346(Pitt,)X +720 758(implements)N +1183(Larson's)X +1554(linear)X +1827(hashing)X +2165(algorithm)X +720 846([LAR88])N +1097(with)X +1302(an)X +2 f +1440(hsearch)X +1 f +1756(compatible)X +2174(interface.)X +720 934(Intuitively,)N +1099(a)X +1161(hash)X +1334(table)X +1516(begins)X +1751(as)X +1844(a)X +1905(single)X +2121(bucket)X +2360(and)X +720 1022(grows)N +941(in)X +1028(generations,)X +1443(where)X +1665(a)X +1725(generation)X +2088(corresponds)X +720 1110(to)N +815(a)X +884(doubling)X +1201(in)X +1296(the)X +1427(size)X +1585(of)X +1685(the)X +1815(hash)X +1994(table.)X +2222(The)X +2379(0)X +2 f +7 s +1078(th)Y +10 s +1 f +720 1198(generation)N +1085(occurs)X +1321(as)X +1414(the)X +1538(table)X +1719(grows)X +1940(from)X +2121(one)X +2262(bucket)X +720 1286(to)N +814(two.)X +1006(In)X +1105(the)X +1235(next)X +1405(generation)X +1776(the)X +1906(table)X +2093(grows)X +2320(from)X +720 1374(two)N +862(to)X +946(four.)X +1122(During)X +1371(each)X +1541(generation,)X +1921(every)X +2121(bucket)X +2356(that)X +720 1462(existed)N +967(at)X +1045(the)X +1163(beginning)X +1503(of)X +1590(the)X +1708(generation)X +2067(is)X +2140(split.)X +892 1576(The)N +1041(table)X +1221(starts)X +1414(as)X +1505(a)X +1565(single)X +1780(bucket)X +2018(\(numbered)X +2389(0\),)X +720 1664(the)N +839(current)X +1088(split)X +1245(bucket)X +1479(is)X +1552(set)X +1661(to)X +1743(bucket)X +1977(0,)X +2057(and)X +2193(the)X +2311(max-)X +720 1752(imum)N +933(split)X +1097(point)X +1288(is)X +1368(set)X +1483(to)X +1571(twice)X +1771(the)X +1895(current)X +2149(split)X +2312(point)X +720 1840(\(0\).)N +863(When)X +1084(it)X +1157(is)X +1239(time)X +1410(for)X +1532(a)X +1596(bucket)X +1838(to)X +1928(split,)X +2113(the)X +2239(keys)X +2414(in)X +720 1928(the)N +872(current)X +1154(split)X +1345(bucket)X +1612(are)X +1764(divided)X +2057(between)X +2378(the)X +720 2016(current)N +981(split)X +1151(bucket)X +1397(and)X +1545(a)X +1613(new)X +1779(bucket)X +2025(whose)X +2262(bucket)X +720 2104(number)N +1000(is)X +1088(equal)X +1297(to)X +1394(1)X +1469(+)X +1549(current)X +1812(split)X +1984(bucket)X +2232(+)X +2311(max-)X +720 2192(imum)N +927(split)X +1085(point.)X +1310(We)X +1442(can)X +1574(determine)X +1915(which)X +2131(keys)X +2298(move)X +720 2280(to)N +807(the)X +929(new)X +1087(bucket)X +1325(by)X +1429(examining)X +1791(the)X +2 f +1913(n)X +7 s +1962 2248(th)N +10 s +1 f +2043 2280(bit)N +2151(of)X +2242(a)X +2302(key's)X +720 2368(hash)N +899(value)X +1105(where)X +1334(n)X +1406(is)X +1491(the)X +1620(generation)X +1990(number.)X +2306(After)X +720 2456(the)N +846(bucket)X +1088(at)X +1174(the)X +1300(maximum)X +1651(split)X +1815(point)X +2006(has)X +2140(been)X +2319(split,)X +720 2544(the)N +839(generation)X +1198(number)X +1463(is)X +1536(incremented,)X +1973(the)X +2091(current)X +2339(split)X +720 2632(point)N +908(is)X +985(set)X +1098(back)X +1274(to)X +1360(zero,)X +1543(and)X +1683(the)X +1805(maximum)X +2152(split)X +2312(point)X +720 2720(is)N +815(set)X +946(to)X +1050(the)X +1190(number)X +1477(of)X +1586(the)X +1725(last)X +1877(bucket)X +2132(in)X +2235(the)X +2374(\256le)X +720 2808(\(which)N +971(is)X +1052(equal)X +1253(to)X +1342(twice)X +1543(the)X +1668(old)X +1797(maximum)X +2148(split)X +2312(point)X +720 2896(plus)N +873(1\).)X +892 3010(To)N +1031(facilitate)X +1361(locating)X +1668(keys,)X +1884(we)X +2027(maintain)X +2356(two)X +720 3098(masks.)N +989(The)X +1143(low)X +1291(mask)X +1488(is)X +1569(equal)X +1771(to)X +1861(the)X +1987(maximum)X +2339(split)X +720 3186(bucket)N +967(and)X +1116(the)X +1247(high)X +1422(mask)X +1624(is)X +1710(equal)X +1917(to)X +2011(the)X +2141(next)X +2311(max-)X +720 3274(imum)N +931(split)X +1093(bucket.)X +1372(To)X +1486(locate)X +1703(a)X +1764(speci\256c)X +2033(key,)X +2193(we)X +2311(com-)X +720 3362(pute)N +881(a)X +940(32-bit)X +1154(hash)X +1324(value)X +1520(using)X +1715(a)X +1773(bit-randomizing)X +2311(algo-)X +720 3450(rithm)N +932(such)X +1118(as)X +1224(the)X +1361(one)X +1516(described)X +1862(in)X +1962([LAR88].)X +2334(This)X +720 3538(hash)N +893(value)X +1093(is)X +1172(then)X +1336(masked)X +1607(with)X +1775(the)X +1898(high)X +2065(mask.)X +2299(If)X +2378(the)X +720 3626(resulting)N +1026(number)X +1297(is)X +1376(greater)X +1626(than)X +1790(the)X +1913(maximum)X +2262(bucket)X +720 3714(in)N +823(the)X +962(table)X +1159(\(current)X +1455(split)X +1633(bucket)X +1888(+)X +1974(maximum)X +2339(split)X +720 3802(point\),)N +962(the)X +1091(hash)X +1269(value)X +1474(is)X +1558(masked)X +1834(with)X +2007(the)X +2136(low)X +2287(mask.)X +720 3890(In)N +825(either)X +1046(case,)X +1242(the)X +1377(result)X +1592(of)X +1696(the)X +1831(mask)X +2037(is)X +2127(the)X +2262(bucket)X +720 3978(number)N +989(for)X +1107(the)X +1229(given)X +1431(key.)X +1611(The)X +1759(algorithm)X +2093(below)X +2312(illus-)X +720 4066(trates)N +914(this)X +1049(process.)X +0 f +8 s +720 4365(h)N +796(=)X +872 -0.4038(calchash\(key\);)AX +720 4453(bucket)N +986(=)X +1062(h)X +1138(&)X +1214 -0.4167(high_mask;)AX +720 4541(if)N +834(\()X +910(bucket)X +1176(>)X +1252 -0.4167(max_bucket)AX +1670(\))X +1008 4629(bucket)N +1274(=)X +1350(h)X +1426(&)X +1502 -0.4219(low_mask;)AX +720 4717 -0.4018(return\(bucket\);)AN +1 f +10 s +892 5042(In)N +1013(order)X +1237(to)X +1353(decide)X +1617(when)X +1845(to)X +1961(split)X +2152(a)X +2242(bucket,)X +2 f +720 5130(dynahash)N +1 f +1050(uses)X +2 f +1210(controlled)X +1561(splitting)X +1 f +1822(.)X +1884(A)X +1964(hash)X +2133(table)X +2311(has)X +2440(a)X +720 5218(\256ll)N +837(factor)X +1054(which)X +1279(is)X +1361(expressed)X +1707(in)X +1798(terms)X +2004(of)X +2099(the)X +2225(average)X +720 5306(number)N +990(of)X +1082(keys)X +1253(in)X +1339(each)X +1511(bucket.)X +1789(Each)X +1974(time)X +2140(the)X +2262(table's)X +720 5394(total)N +885(number)X +1153(of)X +1243(keys)X +1413(divided)X +1676(by)X +1778(its)X +1875(number)X +2142(of)X +2231(buckets)X +720 5482(exceeds)N +995(this)X +1130(\256ll)X +1238(factor,)X +1466(a)X +1522(bucket)X +1756(is)X +1829(split.)X +2878 538(Since)N +3079(the)X +2 f +3200(hsearch)X +1 f +3477(create)X +3693(interface)X +3998(\()X +2 f +4025(hcreate)X +1 f +4266(\))X +4315(calls)X +2706 626(for)N +2842(an)X +2960(estimate)X +3269(of)X +3378(the)X +3518(\256nal)X +3702(size)X +3869(of)X +3978(the)X +4118(hash)X +4306(table)X +2706 714(\()N +2 f +2733(nelem)X +1 f +2925(\),)X +2 f +3007(dynahash)X +1 f +3349(uses)X +3522(this)X +3672(information)X +4085(to)X +4182(initialize)X +2706 802(the)N +2848(table.)X +3088(The)X +3257(initial)X +3486(number)X +3774(of)X +3884(buckets)X +4172(is)X +4268(set)X +4400(to)X +2 f +2706 890(nelem)N +1 f +2926(rounded)X +3217(to)X +3306(the)X +3431(next)X +3596(higher)X +3828(power)X +4056(of)X +4150(two.)X +4337(The)X +2706 978(current)N +2958(split)X +3118(point)X +3305(is)X +3381(set)X +3493(to)X +3578(0)X +3641(and)X +3780(the)X +3901(maximum)X +4248(bucket)X +2706 1066(and)N +2842(maximum)X +3186(split)X +3343(point)X +3527(are)X +3646(set)X +3755(to)X +3837(this)X +3972(rounded)X +4255(value.)X +3 f +3148 1220(The)N +3301(New)X +3473(Implementation)X +1 f +2878 1352(Our)N +3042(implementation)X +3583(is)X +3675(also)X +3842(based)X +4063(on)X +4181(Larson's)X +2706 1440(linear)N +2939(hashing)X +3238([LAR88])X +3582(algorithm)X +3943(as)X +4060(well)X +4248(as)X +4364(the)X +2 f +2706 1528(dynahash)N +1 f +3047(implementation.)X +3623(The)X +2 f +3782(dbm)X +1 f +3954(family)X +4197(of)X +4297(algo-)X +2706 1616(rithms)N +2942(decide)X +3184(dynamically)X +3612(which)X +3840(bucket)X +4085(to)X +4178(split)X +4346(and)X +2706 1704(when)N +2914(to)X +3010(split)X +3180(it)X +3257(\(when)X +3491(it)X +3568(over\257ows\))X +3944(while)X +2 f +4155(dynahash)X +1 f +2706 1792(splits)N +2933(in)X +3054(a)X +3149(prede\256ned)X +3547(order)X +3776(\(linearly\))X +4134(and)X +4309(at)X +4426(a)X +2706 1880(prede\256ned)N +3116(time)X +3328(\(when)X +3599(the)X +3767(table)X +3993(\256ll)X +4151(factor)X +4409(is)X +2706 1968(exceeded\).)N +3121(We)X +3280(use)X +3434(a)X +3517(hybrid)X +3773(of)X +3887(these)X +4099(techniques.)X +2706 2056(Splits)N +2913(occur)X +3118(in)X +3206(the)X +3330(prede\256ned)X +3695(order)X +3891(of)X +3984(linear)X +4193(hashing,)X +2706 2144(but)N +2845(the)X +2980(time)X +3159(at)X +3253(which)X +3485(pages)X +3704(are)X +3839(split)X +4012(is)X +4101(determined)X +2706 2232(both)N +2869(by)X +2970(page)X +3143(over\257ows)X +3480(\()X +2 f +3507(uncontrolled)X +3937(splitting)X +1 f +4198(\))X +4246(and)X +4382(by)X +2706 2320(exceeding)N +3052(the)X +3170(\256ll)X +3278(factor)X +3486(\()X +2 f +3513(controlled)X +3862(splitting)X +1 f +4123(\))X +2878 2434(A)N +2962(hash)X +3135(table)X +3317(is)X +3395(parameterized)X +3876(by)X +3981(both)X +4148(its)X +4248(bucket)X +2706 2522(size)N +2904(\()X +2 f +2931(bsize)X +1 f +(\))S +3191(and)X +3380(\256ll)X +3541(factor)X +3801(\()X +2 f +3828(ffactor)X +1 f +4041(\).)X +4180(Whereas)X +2 f +2706 2610(dynahash's)N +1 f +3095(buckets)X +3364(can)X +3500(be)X +3599(represented)X +3993(as)X +4083(a)X +4142(linked)X +4365(list)X +2706 2698(of)N +2798(elements)X +3108(in)X +3195(memory,)X +3507(our)X +3639(package)X +3928(needs)X +4136(to)X +4222(support)X +2706 2786(disk)N +2874(access,)X +3135(and)X +3286(must)X +3476(represent)X +3806(buckets)X +4086(in)X +4183(terms)X +4395(of)X +2706 2874(pages.)N +2955(The)X +2 f +3106(bsize)X +1 f +3291(is)X +3369(the)X +3492(size)X +3642(\(in)X +3756(bytes\))X +3977(of)X +4069(these)X +4259(pages.)X +2706 2962(As)N +2833(in)X +2933(linear)X +3154(hashing,)X +3461(the)X +3597(number)X +3879(of)X +3983(buckets)X +4265(in)X +4364(the)X +2706 3050(table)N +2906(is)X +3003(equal)X +3221(to)X +3327(the)X +3469(number)X +3758(of)X +3869(keys)X +4060(in)X +4165(the)X +4306(table)X +2706 3138(divided)N +2988(by)X +2 f +3110(ffactor)X +1 f +3323(.)X +2 f +8 s +3113(6)Y +1 f +10 s +3417 3138(The)N +3584(controlled)X +3950(splitting)X +4252(occurs)X +2706 3226(each)N +2878(time)X +3044(the)X +3166(number)X +3435(of)X +3526(keys)X +3697(in)X +3783(the)X +3905(table)X +4085(exceeds)X +4364(the)X +2706 3314(\256ll)N +2814(factor)X +3022(multiplied)X +3370(by)X +3470(the)X +3588(number)X +3853(of)X +3940(buckets.)X +2878 3428(Inserting)N +3187(keys)X +3358(and)X +3498(splitting)X +3783(buckets)X +4051(is)X +4127(performed)X +2706 3516(precisely)N +3018(as)X +3107(described)X +3437(previously)X +3796(for)X +2 f +3911(dynahash)X +1 f +4218(.)X +4279(How-)X +2706 3604(ever,)N +2897(since)X +3094(buckets)X +3371(are)X +3502(now)X +3671(comprised)X +4036(of)X +4134(pages,)X +4368(we)X +2706 3692(must)N +2883(be)X +2981(prepared)X +3284(to)X +3367(handle)X +3602(cases)X +3793(where)X +4011(the)X +4130(size)X +4276(of)X +4364(the)X +2706 3780(keys)N +2873(and)X +3009(data)X +3163(in)X +3245(a)X +3301(bucket)X +3535(exceed)X +3779(the)X +3897(bucket)X +4131(size.)X +3 f +3318 3934(Over\257ow)N +3654(Pages)X +1 f +2878 4066(There)N +3095(are)X +3223(two)X +3372(cases)X +3571(where)X +3797(a)X +3862(key)X +4007(may)X +4174(not)X +4305(\256t)X +4400(in)X +2706 4154(its)N +2802(designated)X +3166(bucket.)X +3441(In)X +3529(the)X +3647(\256rst)X +3791(case,)X +3970(the)X +4088(total)X +4250(size)X +4395(of)X +2706 4242(the)N +2833(key)X +2978(and)X +3123(data)X +3286(may)X +3453(exceed)X +3706(the)X +3833(bucket)X +4076(size.)X +4269(In)X +4364(the)X +2706 4330(second,)N +3008(addition)X +3328(of)X +3453(a)X +3547(new)X +3739(key)X +3913(could)X +4149(cause)X +4386(an)X +2706 4418(over\257ow,)N +3068(but)X +3227(the)X +3382(bucket)X +3652(in)X +3770(question)X +4097(is)X +4206(not)X +4364(yet)X +2706 4506(scheduled)N +3049(to)X +3133(be)X +3230(split.)X +3428(In)X +3516(existing)X +3790(implementations,)X +4364(the)X +2706 4594(second)N +2953(case)X +3115(never)X +3317(arises)X +3523(\(since)X +3738(buckets)X +4006(are)X +4128(split)X +4288(when)X +2706 4682(they)N +2871(over\257ow\))X +3210(and)X +3352(the)X +3476(\256rst)X +3626(case)X +3791(is)X +3870(not)X +3998(handled)X +4278(at)X +4362(all.)X +2706 4770(Although)N +3036(large)X +3225(key/data)X +3525(pair)X +3678(handling)X +3986(is)X +4066(dif\256cult)X +4346(and)X +2706 4858(expensive,)N +3083(it)X +3163(is)X +3252(essential.)X +3604(In)X +3706(a)X +3777(linear)X +3995(hashed)X +4253(imple-)X +2706 4946(mentation,)N +3087(over\257ow)X +3413(pages)X +3636(are)X +3775(required)X +4083(for)X +4217(buckets)X +2706 5034(which)N +2935(over\257ow)X +3253(before)X +3492(they)X +3662(are)X +3793(split,)X +3982(so)X +4085(we)X +4211(can)X +4355(use)X +2706 5122(the)N +2833(same)X +3027(mechanism)X +3421(for)X +3544(large)X +3734(key/data)X +4035(pairs)X +4220(that)X +4368(we)X +2706 5210(use)N +2837(for)X +2955(over\257ow)X +3264(pages.)X +3511(Logically,)X +3862(we)X +3980(chain)X +4177(over\257ow)X +16 s +2706 5353 MXY +864 0 Dl +2 f +8 s +2746 5408(6)N +1 f +9 s +2801 5433(This)N +2952(is)X +3023(not)X +3138(strictly)X +3361(true.)X +3532(The)X +3667(\256le)X +3782(does)X +3937(not)X +4052(contract)X +4306(when)X +2706 5513(keys)N +2861(are)X +2972(deleted,)X +3221(so)X +3308(the)X +3419(number)X +3662(of)X +3744(buckets)X +3986(is)X +4056(actually)X +4306(equal)X +2706 5593(to)N +2782(the)X +2890(maximum)X +3202(number)X +3441(of)X +3520(keys)X +3671(ever)X +3814(present)X +4041(in)X +4116(the)X +4223(table)X +4382(di-)X +2706 5673(vided)N +2884(by)X +2974(the)X +3080(\256ll)X +3178(factor.)X +3 f +10 s +720 5960(USENIX)N +9 f +1042(-)X +3 f +1106(Winter)X +1371('91)X +9 f +1498(-)X +3 f +1562(Dallas,)X +1815(TX)X +4424(5)X + +6 p +%%Page: 6 6 +0(Courier)xf 0 f +10 s 10 xH 0 xS 0 f +3 f +432 258(A)N +510(New)X +682(Hashing)X +985(Package)X +1290(for)X +1413(UNIX)X +3663(Seltzer)X +3920(&)X +4007(Yigit)X +1 f +432 538(pages)N +639(to)X +725(the)X +847(buckets)X +1116(\(also)X +1296(called)X +1512(primary)X +1789(pages\).)X +2062(In)X +2152(a)X +432 626(memory)N +730(based)X +943(representation,)X +1448(over\257ow)X +1763(pages)X +1976(do)X +2086(not)X +432 714(pose)N +628(any)X +792(special)X +1063(problems)X +1409(because)X +1712(we)X +1854(can)X +2014(chain)X +432 802(over\257ow)N +776(pages)X +1017(to)X +1137(primary)X +1449(pages)X +1690(using)X +1921(memory)X +432 890(pointers.)N +776(However,)X +1137(mapping)X +1463(these)X +1674(over\257ow)X +2005(pages)X +432 978(into)N +584(a)X +648(disk)X +809(\256le)X +939(is)X +1019(more)X +1211(of)X +1305(a)X +1368(challenge,)X +1723(since)X +1915(we)X +2036(need)X +432 1066(to)N +547(be)X +675(able)X +861(to)X +975(address)X +1268(both)X +1462(bucket)X +1728(pages,)X +1983(whose)X +432 1154(numbers)N +729(are)X +849(growing)X +1137(linearly,)X +1422(and)X +1558(some)X +1747(indeterminate)X +432 1242(number)N +715(of)X +820(over\257ow)X +1143(pages)X +1364(without)X +1646(reorganizing)X +2090(the)X +432 1330(\256le.)N +604 1444(One)N +789(simple)X +1053(solution)X +1361(would)X +1612(be)X +1739(to)X +1852(allocate)X +2152(a)X +432 1532(separate)N +737(\256le)X +880(for)X +1015(over\257ow)X +1341(pages.)X +1604(The)X +1769(disadvantage)X +432 1620(with)N +605(such)X +783(a)X +850(technique)X +1193(is)X +1276(that)X +1426(it)X +1500(requires)X +1789(an)X +1895(extra)X +2086(\256le)X +432 1708(descriptor,)N +794(an)X +891(extra)X +1073(system)X +1316(call)X +1453(on)X +1554(open)X +1731(and)X +1867(close,)X +2072(and)X +432 1796(logically)N +739(associating)X +1122(two)X +1269(independent)X +1687(\256les.)X +1886(For)X +2023(these)X +432 1884(reasons,)N +728(we)X +857(wanted)X +1123(to)X +1219(map)X +1391(both)X +1567(primary)X +1855(pages)X +2072(and)X +432 1972(over\257ow)N +737(pages)X +940(into)X +1084(the)X +1202(same)X +1387(\256le)X +1509(space.)X +604 2086(The)N +799(buddy-in-waiting)X +1425(algorithm)X +1806(provides)X +2152(a)X +432 2174(mechanism)N +851(to)X +966(support)X +1259(multiple)X +1578(pages)X +1814(per)X +1970(logical)X +432 2262(bucket)N +685(while)X +902(retaining)X +1226(the)X +1362(simple)X +1613(split)X +1788(sequence)X +2121(of)X +432 2350(linear)N +681(hashing.)X +1015(Over\257ow)X +1383(pages)X +1631(are)X +1795(preallocated)X +432 2438(between)N +781(generations)X +1232(of)X +1379(primary)X +1713(pages.)X +1996(These)X +432 2526(over\257ow)N +759(pages)X +984(are)X +1125(used)X +1314(by)X +1436(any)X +1594(bucket)X +1850(containing)X +432 2614(more)N +646(keys)X +842(than)X +1029(\256t)X +1144(on)X +1273(the)X +1420(primary)X +1723(page)X +1924(and)X +2089(are)X +432 2702(reclaimed,)N +808(if)X +896(possible,)X +1217(when)X +1430(the)X +1567(bucket)X +1819(later)X +2000(splits.)X +432 2790(Figure)N +687(3)X +773(depicts)X +1045(the)X +1188(layout)X +1433(of)X +1545(primary)X +1844(pages)X +2072(and)X +432 2878(over\257ow)N +752(pages)X +970(within)X +1209(the)X +1342(same)X +1542(\256le.)X +1699(Over\257ow)X +2036(page)X +432 2966(use)N +586(information)X +1011(is)X +1111(recorded)X +1440(in)X +1548(bitmaps)X +1847(which)X +2089(are)X +432 3054(themselves)N +819(stored)X +1046(on)X +1157(over\257ow)X +1472(pages.)X +1725(The)X +1880(addresses)X +432 3142(of)N +520(the)X +639(bitmap)X +882(pages)X +1086(and)X +1223(the)X +1342(number)X +1608(of)X +1695(pages)X +1898(allocated)X +432 3230(at)N +515(each)X +688(split)X +850(point)X +1039(are)X +1163(stored)X +1384(in)X +1470(the)X +1592(\256le)X +1718(header.)X +1997(Using)X +432 3318(this)N +577(information,)X +1005(both)X +1177(over\257ow)X +1492(addresses)X +1829(and)X +1974(bucket)X +432 3406(addresses)N +764(can)X +900(be)X +999(mapped)X +1276(to)X +1361(disk)X +1517(addresses)X +1848(by)X +1951(the)X +2072(fol-)X +432 3494(lowing)N +674(calculation:)X +0 f +8 s +432 3793(int)N +736(bucket;)X +1192(/*)X +1306(bucket)X +1572(address)X +1876(*/)X +432 3881(u_short)N +736(oaddr;)X +1192(/*)X +1306(OVERFLOW)X +1648(address)X +1952(*/)X +432 3969(int)N +736 -0.4125(nhdr_pages;)AX +1192(/*)X +1306(npages)X +1572(in)X +1686 -112.4062(\256le)AX +1838(header)X +2104(*/)X +432 4057(int)N +736 -0.4125(spares[32];)AX +1192(/*)X +1306(npages)X +1572(at)X +1686(each)X +1876(split)X +2104(*/)X +432 4145(int)N +736(log2\(\);)X +1198(/*)X +1312(ceil\(log)X +1654(base)X +1844(2\))X +1958(*/)X +432 4321(#DEFINE)N +736 -0.3929(BUCKET_TO_PAGE\(bucket\))AX +1610(\\)X +584 4409(bucket)N +850(+)X +926 -0.4167(nhdr_pages)AX +1344(+)X +1420(\\)X +584 4497 -0.3894(\(bucket?spares[logs2\(bucket)AN +1648(+)X +1724(1\)-1]:0\))X +432 4673(#DEFINE)N +736 -0.3947(OADDR_TO_PAGE\(oaddr\))AX +1534(\\)X +584 4761 -0.3984(BUCKET_TO_PAGE\(\(1)AN +1268(<<)X +1382 -0.4091(\(oaddr>>11\)\))AX +1876(-)X +1952(1\))X +2066(+)X +2142(\\)X +584 4849(oaddr)N +812(&)X +888(0x7ff;)X +1 f +10 s +604 5262(An)N +728(over\257ow)X +1039(page)X +1217(is)X +1295(addressed)X +1637(by)X +1742(its)X +1842(split)X +2004(point,)X +432 5350(identifying)N +858(the)X +1031(generations)X +1476(between)X +1819(which)X +2090(the)X +432 5438(over\257ow)N +740(page)X +915(is)X +991(allocated,)X +1324(and)X +1463(its)X +1561(page)X +1736(number,)X +2023(iden-)X +432 5526(tifying)N +665(the)X +783(particular)X +1111(page)X +1283(within)X +1507(the)X +1625(split)X +1782(point.)X +1986(In)X +2073(this)X +432 5614(implementation,)N +983(offsets)X +1225(within)X +1457(pages)X +1668(are)X +1795(16)X +1903(bits)X +2046(long)X +432 5702(\(limiting)N +732(the)X +851(maximum)X +1196(page)X +1368(size)X +1513(to)X +1595(32K\),)X +1800(so)X +1891(we)X +2005(select)X +2418 538(an)N +2535(over\257ow)X +2860(page)X +3052(addressing)X +3435(algorithm)X +3786(that)X +3946(can)X +4098(be)X +2418 626(expressed)N +2760(in)X +2847(16)X +2952(bits)X +3091(and)X +3231(which)X +3451(allows)X +3684(quick)X +3886(retrieval.)X +2418 714(The)N +2568(top)X +2695(\256ve)X +2840(bits)X +2980(indicate)X +3258(the)X +3380(split)X +3541(point)X +3729(and)X +3869(the)X +3991(lower)X +2418 802(eleven)N +2650(indicate)X +2926(the)X +3046(page)X +3220(number)X +3487(within)X +3713(the)X +3832(split)X +3990(point.)X +2418 890(Since)N +2633(\256ve)X +2789(bits)X +2940(are)X +3075(reserved)X +3384(for)X +3514(the)X +3648(split)X +3821(point,)X +4041(\256les)X +2418 978(may)N +2578(split)X +2737(32)X +2839(times)X +3034(yielding)X +3318(a)X +3376(maximum)X +3721(\256le)X +3844(size)X +3990(of)X +4078(2)X +7 s +946(32)Y +10 s +2418 1066(buckets)N +2698(and)X +2849(32)X +2 f +(*)S +1 f +2982(2)X +7 s +1034(11)Y +10 s +3113 1066(over\257ow)N +3433(pages.)X +3691(The)X +3850(maximum)X +2418 1154(page)N +2597(size)X +2749(is)X +2829(2)X +7 s +1122(15)Y +10 s +1154(,)Y +2971(yielding)X +3259(a)X +3321(maximum)X +3671(\256le)X +3799(size)X +3950(greater)X +2418 1242(than)N +2601(131,000)X +2906(GB)X +3061(\(on)X +3212(\256le)X +3358(systems)X +3655(supporting)X +4041(\256les)X +2418 1330(larger)N +2626(than)X +2784(4GB\).)X +10 f +2418 1418 -0.0930(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)AN +1 Dt +4014 2275 MXY +0 133 Dl +3881 2275 MXY +0 133 Dl +3748 2275 MXY +0 133 Dl +3083 2275 MXY +0 133 Dl +5 s +1 f +3523 2475(2/3)N +3390(2/2)X +3257(2/1)X +2859(1/2)X +2726(1/1)X +5 Dt +3814 1743 MXY +0 133 Dl +3282 1743 MXY +0 133 Dl +3017 1743 MXY +0 133 Dl +2884 1743 MXY +0 133 Dl +1 Dt +3681 1743 MXY +0 133 Dl +133 0 Dl +0 -133 Dl +-133 0 Dl +3548 MX +0 133 Dl +133 0 Dl +0 -133 Dl +-133 0 Dl +3415 MX +0 133 Dl +133 0 Dl +0 -133 Dl +-133 0 Dl +3282 MX +0 133 Dl +133 0 Dl +0 -133 Dl +-133 0 Dl +3150 MX +0 133 Dl +132 0 Dl +0 -133 Dl +-132 0 Dl +3017 MX +0 133 Dl +133 0 Dl +0 -133 Dl +-133 0 Dl +2884 MX +0 133 Dl +133 0 Dl +0 -133 Dl +-133 0 Dl +3 f +8 s +3017 2601(Over\257ow)N +3285(Addresses)X +3515 2833(Over\257ow)N +3783(Pages)X +2850(Buckets)X +1 Di +3349 2740 MXY + 3349 2740 lineto + 3482 2740 lineto + 3482 2873 lineto + 3349 2873 lineto + 3349 2740 lineto +closepath 3 3349 2740 3482 2873 Dp +2684 MX +0 133 Dl +133 0 Dl +0 -133 Dl +-133 0 Dl +5 Dt +4146 2275 MXY +0 133 Dl +3216 2275 MXY +0 133 Dl +2684 2275 MXY +0 133 Dl +2551 2275 MXY +0 133 Dl +1 f +3798 1963(3)N +3266 1980(2)N +3001(1)X +2868(0)X +1 Dt +2751 1743 MXY +0 133 Dl +133 0 Dl +0 -133 Dl +-133 0 Dl +3548 2275 MXY +-15 -22 Dl +2 16 Dl +-13 11 Dl +26 -5 Dl +-282 -117 Dl +3432 2275 MXY +-10 -25 Dl +-2 16 Dl +-15 8 Dl +27 1 Dl +-166 -117 Dl +3282 2275 MXY +12 -25 Dl +-14 10 Dl +-15 -6 Dl +17 21 Dl +-16 -117 Dl +2884 2275 MXY +26 7 Dl +-12 -12 Dl +3 -16 Dl +-17 21 Dl +382 -117 Dl +2751 2275 MXY +25 9 Dl +-11 -12 Dl +5 -17 Dl +-19 20 Dl +515 -117 Dl +3 f +3070 2152(Over\257ow)N +3338(Pages)X +3482 2275 MXY + 3482 2275 lineto + 3615 2275 lineto + 3615 2408 lineto + 3482 2408 lineto + 3482 2275 lineto +closepath 3 3482 2275 3615 2408 Dp +3349 MX + 3349 2275 lineto + 3482 2275 lineto + 3482 2408 lineto + 3349 2408 lineto + 3349 2275 lineto +closepath 3 3349 2275 3482 2408 Dp +3216 MX + 3216 2275 lineto + 3349 2275 lineto + 3349 2408 lineto + 3216 2408 lineto + 3216 2275 lineto +closepath 3 3216 2275 3349 2408 Dp +2817 MX + 2817 2275 lineto + 2950 2275 lineto + 2950 2408 lineto + 2817 2408 lineto + 2817 2275 lineto +closepath 3 2817 2275 2950 2408 Dp +2684 MX + 2684 2275 lineto + 2817 2275 lineto + 2817 2408 lineto + 2684 2408 lineto + 2684 2275 lineto +closepath 3 2684 2275 2817 2408 Dp +3615 MX +0 133 Dl +531 0 Dl +0 -133 Dl +-531 0 Dl +2950 MX +0 133 Dl +266 0 Dl +0 -133 Dl +-266 0 Dl +2551 MX +0 133 Dl +133 0 Dl +0 -133 Dl +-133 0 Dl +3798 1726 MXY +-21 -18 Dl +6 16 Dl +-10 13 Dl +25 -11 Dl +-599 -99 Dl +3266 1726 MXY +-1 -27 Dl +-7 15 Dl +-17 1 Dl +25 11 Dl +-67 -99 Dl +3033 1726 MXY +27 1 Dl +-14 -8 Dl +-1 -17 Dl +-12 24 Dl +166 -99 Dl +2900 1726 MXY +27 7 Dl +-13 -11 Dl +3 -17 Dl +-17 21 Dl +299 -99 Dl +3058 1621(Split)N +3203(Points)X +2418 2275 MXY +0 133 Dl +133 0 Dl +0 -133 Dl +-133 0 Dl +3 Dt +-1 Ds +3137(Figure)Y +2619(3:)X +1 f +2691(Split)X +2832(points)X +3008(occur)X +3168(between)X +3399(generations)X +3712(and)X +3823(are)X +3919(numbered)X +2418 3225(from)N +2560(0.)X +2642(In)X +2713(this)X +2824(\256gure)X +2991(there)X +3136(are)X +3231(two)X +3345(over\257ow)X +3590(pages)X +3753(allocated)X +4000(at)X +4063(split)X +2418 3313(point)N +2566(1)X +2614(and)X +2722(three)X +2865(allocated)X +3111(at)X +3173(split)X +3300(point)X +3448(2.)X +10 s +10 f +2418 3489 -0.0930(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)AN +3 f +2949 3731(Buffer)N +3192(Management)X +1 f +2590 3863(The)N +2744(hash)X +2920(table)X +3105(is)X +3187(stored)X +3412(in)X +3502(memory)X +3797(as)X +3892(a)X +3956(logical)X +2418 3951(array)N +2633(of)X +2749(bucket)X +3012(pointers.)X +3359(Physically,)X +3761(the)X +3907(array)X +4121(is)X +2418 4039(arranged)N +2728(in)X +2818(segments)X +3144(of)X +3239(256)X +3387(pointers.)X +3713(Initially,)X +4013(there)X +2418 4127(is)N +2530(space)X +2767(to)X +2887(allocate)X +3195(256)X +3373(segments.)X +3769(Reallocation)X +2418 4215(occurs)N +2651(when)X +2847(the)X +2967(number)X +3234(of)X +3323(buckets)X +3590(exceeds)X +3867(32K)X +4027(\(256)X +2418 4303(*)N +2508(256\).)X +2745(Primary)X +3053(pages)X +3286(may)X +3473(be)X +3598(accessed)X +3929(directly)X +2418 4391(through)N +2711(the)X +2853(array)X +3062(by)X +3185(bucket)X +3442(number)X +3730(and)X +3889(over\257ow)X +2418 4479(pages)N +2628(are)X +2754 0.4028(referenced)AX +3122(logically)X +3429(by)X +3536(their)X +3710(over\257ow)X +4022(page)X +2418 4567(address.)N +2726(For)X +2864(small)X +3063(hash)X +3236(tables,)X +3469(it)X +3539(is)X +3618(desirable)X +3934(to)X +4022(keep)X +2418 4655(all)N +2525(pages)X +2735(in)X +2823(main)X +3009(memory)X +3302(while)X +3506(on)X +3612(larger)X +3826(tables,)X +4059(this)X +2418 4743(is)N +2523(probably)X +2860(impossible.)X +3298(To)X +3438(satisfy)X +3698(both)X +3891(of)X +4009(these)X +2418 4831(requirements,)N +2900(the)X +3041(package)X +3348(includes)X +3658(buffer)X +3897(manage-)X +2418 4919(ment)N +2598(with)X +2760(LRU)X +2940(\(least)X +3134(recently)X +3413(used\))X +3607(replacement.)X +2590 5033(By)N +2730(default,)X +3020(the)X +3165(package)X +3475(allocates)X +3802(up)X +3928(to)X +4036(64K)X +2418 5121(bytes)N +2616(of)X +2712(buffered)X +3014(pages.)X +3246(All)X +3377(pages)X +3589(in)X +3680(the)X +3807(buffer)X +4032(pool)X +2418 5209(are)N +2542(linked)X +2766(in)X +2852(LRU)X +3036(order)X +3230(to)X +3316(facilitate)X +3621(fast)X +3761(replacement.)X +2418 5297(Whereas)N +2724(ef\256cient)X +3011(access)X +3241(to)X +3327(primary)X +3605(pages)X +3812(is)X +3889(provided)X +2418 5385(by)N +2521(the)X +2642(bucket)X +2879(array,)X +3087(ef\256cient)X +3372(access)X +3600(to)X +3684(over\257ow)X +3991(pages)X +2418 5473(is)N +2501(provided)X +2816(by)X +2926(linking)X +3182(over\257ow)X +3497(page)X +3679(buffers)X +3936(to)X +4027(their)X +2418 5561(predecessor)N +2827(page)X +3008(\(either)X +3247(the)X +3374(primary)X +3657(page)X +3838(or)X +3933(another)X +2418 5649(over\257ow)N +2742(page\).)X +3000(This)X +3181(means)X +3425(that)X +3584(an)X +3699(over\257ow)X +4022(page)X +3 f +432 5960(6)N +2970(USENIX)X +9 f +3292(-)X +3 f +3356(Winter)X +3621('91)X +9 f +3748(-)X +3 f +3812(Dallas,)X +4065(TX)X + +7 p +%%Page: 7 7 +0(Courier)xf 0 f +10 s 10 xH 0 xS 0 f +3 f +720 258(Seltzer)N +977(&)X +1064(Yigit)X +3278(A)X +3356(New)X +3528(Hashing)X +3831(Package)X +4136(for)X +4259(UNIX)X +1 f +720 538(cannot)N +955(be)X +1052(present)X +1305(in)X +1388(the)X +1507(buffer)X +1724(pool)X +1886(if)X +1955(its)X +2050(primary)X +2324(page)X +720 626(is)N +804(not)X +937(present.)X +1240(This)X +1413(does)X +1591(not)X +1724(impact)X +1972(performance)X +2409(or)X +720 714(functionality,)N +1209(because)X +1524(an)X +1660(over\257ow)X +2005(page)X +2217(will)X +2400(be)X +720 802(accessed)N +1048(only)X +1236(after)X +1430(its)X +1550(predecessor)X +1975(page)X +2172(has)X +2324(been)X +720 890(accessed.)N +1068(Figure)X +1303(4)X +1369(depicts)X +1622(the)X +1746(data)X +1905(structures)X +2242(used)X +2414(to)X +720 978(manage)N +990(the)X +1108(buffer)X +1325(pool.)X +892 1092(The)N +1040(in-memory)X +1419(bucket)X +1656(array)X +1845(contains)X +2134(pointers)X +2414(to)X +720 1180(buffer)N +975(header)X +1248(structures)X +1617(which)X +1870(represent)X +2222(primary)X +720 1268(pages.)N +968(Buffer)X +1203(headers)X +1474(contain)X +1735(modi\256ed)X +2043(bits,)X +2202(the)X +2324(page)X +720 1356(address)N +995(of)X +1096(the)X +1228(buffer,)X +1479(a)X +1548(pointer)X +1808(to)X +1903(the)X +2034(actual)X +2259(buffer,)X +720 1444(and)N +875(a)X +950(pointer)X +1216(to)X +1317(the)X +1454(buffer)X +1690(header)X +1944(for)X +2077(an)X +2191(over\257ow)X +720 1532(page)N +901(if)X +979(it)X +1052(exists,)X +1283(in)X +1374(addition)X +1665(to)X +1756(the)X +1883(LRU)X +2072(links.)X +2296(If)X +2378(the)X +720 1620(buffer)N +950(corresponding)X +1442(to)X +1537(a)X +1606(particular)X +1947(bucket)X +2194(is)X +2280(not)X +2414(in)X +720 1708(memory,)N +1048(its)X +1164(pointer)X +1432(is)X +1526(NULL.)X +1801(In)X +1909(effect,)X +2154(pages)X +2377(are)X +720 1796(linked)N +950(in)X +1042(three)X +1233(ways.)X +1468(Using)X +1689(the)X +1817(buffer)X +2043(headers,)X +2338(they)X +720 1884(are)N +851(linked)X +1083(physically)X +1444(through)X +1725(the)X +1854(LRU)X +2045(links)X +2231(and)X +2378(the)X +720 1972(over\257ow)N +1036(links.)X +1241(Using)X +1462(the)X +1590(pages)X +1803(themselves,)X +2209(they)X +2377(are)X +720 2060(linked)N +943(logically)X +1246(through)X +1518(the)X +1639(over\257ow)X +1946(addresses)X +2276(on)X +2378(the)X +720 2148(page.)N +948(Since)X +1162(over\257ow)X +1482(pages)X +1700(are)X +1834(accessed)X +2151(only)X +2328(after)X +720 2236(their)N +904(predecessor)X +1321(pages,)X +1560(they)X +1734(are)X +1869(removed)X +2186(from)X +2378(the)X +720 2324(buffer)N +937(pool)X +1099(when)X +1293(their)X +1460(primary)X +1734(is)X +1807(removed.)X +10 f +720 2412 -0.0930(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)AN +1 Dt +2309 3177 MXY +24 15 Dl +-8 -15 Dl +8 -15 Dl +-24 15 Dl +52 0 Dl +789 3160 MXY +-35 0 Dl +0 -156 Dl +1607 0 Dl +0 173 Dl +789 3091 MXY +-24 -15 Dl +9 15 Dl +-9 15 Dl +24 -15 Dl +-69 0 Dl +2309 3125 MXY +104 0 Dl +0 -155 Dl +-1693 0 Dl +0 121 Dl +927 3160 MXY +24 15 Dl +-9 -15 Dl +9 -15 Dl +-24 15 Dl +553 0 Dl +1618 3177 MXY +8 27 Dl +4 -17 Dl +16 -6 Dl +-28 -4 Dl +138 121 Dl +1895 3315 MXY +28 3 Dl +-15 -9 Dl +1 -18 Dl +-14 24 Dl +276 -138 Dl +3108 MY +-28 -3 Dl +15 10 Dl +-1 17 Dl +14 -24 Dl +-276 138 Dl +1756 3229 MXY +-8 -27 Dl +-3 17 Dl +-16 6 Dl +27 4 Dl +-138 -121 Dl +1480 MX +-24 -15 Dl +9 15 Dl +-9 15 Dl +24 -15 Dl +-553 0 Dl +3 f +5 s +1083 3073(LRU)N +1178(chain)X +4 Ds +1402 3851 MXY + 1402 3851 lineto + 1471 3851 lineto + 1471 3920 lineto + 1402 3920 lineto + 1402 3851 lineto +closepath 19 1402 3851 1471 3920 Dp +1445 3747(Over\257ow)N +1613(Address)X +1549 3609 MXY +0 69 Dl +1756 MX +-23 -15 Dl +8 15 Dl +-8 15 Dl +23 -15 Dl +-207 0 Dl +-1 Ds +3 Dt +1756 3419 MXY +-6 -28 Dl +-4 17 Dl +-17 5 Dl +27 6 Dl +-138 -138 Dl +2240 3471 MXY +15 -24 Dl +-15 9 Dl +-15 -9 Dl +15 24 Dl +0 -138 Dl +1826 3609 MXY +15 -24 Dl +-15 9 Dl +-16 -9 Dl +16 24 Dl +0 -138 Dl +1549 MX +15 -24 Dl +-15 9 Dl +-15 -9 Dl +15 24 Dl +0 -138 Dl +858 3471 MXY +15 -24 Dl +-15 9 Dl +-15 -9 Dl +15 24 Dl +0 -138 Dl +2240 3056 MXY +15 -24 Dl +-15 9 Dl +-15 -9 Dl +15 24 Dl +0 -138 Dl +1549 3056 MXY +15 -24 Dl +-15 9 Dl +-15 -9 Dl +15 24 Dl +0 -138 Dl +858 3056 MXY +15 -24 Dl +-15 9 Dl +-15 -9 Dl +15 24 Dl +0 -138 Dl +1 Dt +2171 3471 MXY + 2171 3471 lineto + 2448 3471 lineto + 2448 3609 lineto + 2171 3609 lineto + 2171 3471 lineto +closepath 19 2171 3471 2448 3609 Dp +1756 3609 MXY + 1756 3609 lineto + 2033 3609 lineto + 2033 3747 lineto + 1756 3747 lineto + 1756 3609 lineto +closepath 3 1756 3609 2033 3747 Dp +1480 3471 MXY + 1480 3471 lineto + 1756 3471 lineto + 1756 3609 lineto + 1480 3609 lineto + 1480 3471 lineto +closepath 19 1480 3471 1756 3609 Dp +789 MX + 789 3471 lineto + 1065 3471 lineto + 1065 3609 lineto + 789 3609 lineto + 789 3471 lineto +closepath 19 789 3471 1065 3609 Dp +962 3903(Buffer)N +1083(Header)X +849 3851 MXY + 849 3851 lineto + 918 3851 lineto + 918 3920 lineto + 849 3920 lineto + 849 3851 lineto +closepath 14 849 3851 918 3920 Dp +1756 3194 MXY + 1756 3194 lineto + 1895 3194 lineto + 1895 3471 lineto + 1756 3471 lineto + 1756 3194 lineto +closepath 14 1756 3194 1895 3471 Dp +2171 3056 MXY + 2171 3056 lineto + 2309 3056 lineto + 2309 3333 lineto + 2171 3333 lineto + 2171 3056 lineto +closepath 14 2171 3056 2309 3333 Dp +1480 MX + 1480 3056 lineto + 1618 3056 lineto + 1618 3333 lineto + 1480 3333 lineto + 1480 3056 lineto +closepath 14 1480 3056 1618 3333 Dp +789 MX + 789 3056 lineto + 927 3056 lineto + 927 3333 lineto + 789 3333 lineto + 789 3056 lineto +closepath 14 789 3056 927 3333 Dp +2780 MY +0 138 Dl +138 0 Dl +0 -138 Dl +-138 0 Dl +927 MX +0 138 Dl +138 0 Dl +0 -138 Dl +-138 0 Dl +1065 MX +0 138 Dl +138 0 Dl +0 -138 Dl +-138 0 Dl +1203 MX +0 138 Dl +139 0 Dl +0 -138 Dl +-139 0 Dl +1342 MX +0 138 Dl +138 0 Dl +0 -138 Dl +-138 0 Dl +1480 MX +0 138 Dl +138 0 Dl +0 -138 Dl +-138 0 Dl +1618 MX +0 138 Dl +138 0 Dl +0 -138 Dl +-138 0 Dl +1756 MX +0 138 Dl +139 0 Dl +0 -138 Dl +-139 0 Dl +1895 MX +0 138 Dl +138 0 Dl +0 -138 Dl +-138 0 Dl +2033 MX +0 138 Dl +138 0 Dl +0 -138 Dl +-138 0 Dl +2171 MX +0 138 Dl +138 0 Dl +0 -138 Dl +-138 0 Dl +2309 MX +0 138 Dl +139 0 Dl +0 -138 Dl +-139 0 Dl +13 s +1048 2720(In)N +1173(Memory)X +1580(Bucket)X +1918(Array)X +867 3584(B0)N +1558(B5)X +2223(B10)X +1788 3722(O1/1)N +5 s +1515 3903(Primay)N +1651(Buffer)X +4 Ds +1990 3851 MXY + 1990 3851 lineto + 2059 3851 lineto + 2059 3920 lineto + 1990 3920 lineto + 1990 3851 lineto +closepath 3 1990 3851 2059 3920 Dp +2102 3903(Over\257ow)N +2270(Buffer)X +3 Dt +-1 Ds +8 s +720 4184(Figure)N +922(4:)X +1 f +996(Three)X +1164(primary)X +1386(pages)X +1551(\(B0,)X +1683(B5,)X +1794(B10\))X +1942(are)X +2039(accessed)X +2281(directly)X +720 4272(from)N +862(the)X +958(bucket)X +1146(array.)X +1326(The)X +1443(one)X +1553(over\257ow)X +1798(page)X +1935(\(O1/1\))X +2122(is)X +2182(linked)X +2359(phy-)X +720 4360(sically)N +915(from)X +1067(its)X +1155(primary)X +1384(page's)X +1577(buffer)X +1759(header)X +1955(as)X +2035(well)X +2172(as)X +2252(logically)X +720 4448(from)N +860(its)X +937(predecessor)X +1253(page)X +1389(buffer)X +1560(\(B5\).)X +10 s +10 f +720 4624 -0.0930(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)AN +3 f +1191 4954(Table)N +1406(Parameterization)X +1 f +892 5086(When)N +1107(a)X +1166(hash)X +1336(table)X +1515(is)X +1590(created,)X +1865(the)X +1985(bucket)X +2221(size,)X +2388(\256ll)X +720 5174(factor,)N +953(initial)X +1164(number)X +1434(of)X +1526(elements,)X +1856(number)X +2125(of)X +2216(bytes)X +2409(of)X +720 5262(main)N +919(memory)X +1225(used)X +1411(for)X +1543(caching,)X +1851(and)X +2005(a)X +2079(user-de\256ned)X +720 5350(hash)N +892(function)X +1184(may)X +1347(be)X +1448(speci\256ed.)X +1797(The)X +1946(bucket)X +2184(size)X +2333(\(and)X +720 5438(page)N +906(size)X +1064(for)X +1191(over\257ow)X +1509(pages\))X +1752(defaults)X +2039(to)X +2134(256)X +2287(bytes.)X +720 5526(For)N +858(tables)X +1072(with)X +1241(large)X +1429(data)X +1590(items,)X +1810(it)X +1881(may)X +2046(be)X +2149(preferable)X +720 5614(to)N +803(increase)X +1088(the)X +1207(page)X +1380(size,)X +1545(and,)X +1701(conversely,)X +2089(applications)X +720 5702(storing)N +1002(small)X +1235(items)X +1467(exclusively)X +1891(in)X +2012(memory)X +2338(may)X +2706 538(bene\256t)N +2966(from)X +3164(a)X +3242(smaller)X +3520(bucket)X +3776(size.)X +3983(A)X +4082(bucket)X +4337(size)X +2706 626(smaller)N +2962(than)X +3120(64)X +3220(bytes)X +3409(is)X +3482(not)X +3604(recommended.)X +2878 740(The)N +3031(\256ll)X +3147(factor)X +3363(indicates)X +3676(a)X +3740(desired)X +4000(density)X +4258(within)X +2706 828(the)N +2833(hash)X +3009(table.)X +3234(It)X +3312(is)X +3394(an)X +3499(approximation)X +3995(of)X +4091(the)X +4217(number)X +2706 916(of)N +2815(keys)X +3004(allowed)X +3300(to)X +3404(accumulate)X +3811(in)X +3914(any)X +4071(one)X +4228(bucket,)X +2706 1004(determining)N +3119(when)X +3319(the)X +3442(hash)X +3614(table)X +3795(grows.)X +4056(Its)X +4161(default)X +4409(is)X +2706 1092(eight.)N +2953(If)X +3054(the)X +3199(user)X +3380(knows)X +3636(the)X +3781(average)X +4079(size)X +4251(of)X +4364(the)X +2706 1180(key/data)N +3008(pairs)X +3194(being)X +3402(stored)X +3627(in)X +3718(the)X +3845(table,)X +4050(near)X +4218(optimal)X +2706 1268(bucket)N +2943(sizes)X +3122(and)X +3261(\256ll)X +3372(factors)X +3614(may)X +3775(be)X +3874(selected)X +4155(by)X +4257(apply-)X +2706 1356(ing)N +2828(the)X +2946(equation:)X +0 f +8 s +2706 1655(\(1\))N +2994 -0.3938(\(\(average_pair_length)AX +3830(+)X +3906(4\))X +4020(*)X +3032 1743(ffactor\))N +3374(>=)X +3488(bsize)X +1 f +10 s +2706 2042(For)N +2859(highly)X +3104(time)X +3287(critical)X +3551(applications,)X +3999(experimenting)X +2706 2130(with)N +2919(different)X +3266(bucket)X +3550(sizes)X +3776(and)X +3962(\256ll)X +4120(factors)X +4409(is)X +2706 2218(encouraged.)N +2878 2332(Figures)N +3144(5a,b,)X +3326(and)X +3468(c)X +3530(illustrate)X +3836(the)X +3960(effects)X +4200(of)X +4292(vary-)X +2706 2420(ing)N +2841(page)X +3026(sizes)X +3215(and)X +3363(\256ll)X +3483(factors)X +3734(for)X +3860(the)X +3990(same)X +4187(data)X +4353(set.)X +2706 2508(The)N +2864(data)X +3031(set)X +3152(consisted)X +3482(of)X +3581(24474)X +3813(keys)X +3992(taken)X +4198(from)X +4386(an)X +2706 2596(online)N +2931(dictionary.)X +3301(The)X +3451(data)X +3609(value)X +3807(for)X +3925(each)X +4097(key)X +4237(was)X +4386(an)X +2706 2684(ASCII)N +2938(string)X +3143(for)X +3260(an)X +3359(integer)X +3605(from)X +3784(1)X +3847(to)X +3931(24474)X +4153(inclusive.)X +2706 2772(The)N +2867(test)X +3013(run)X +3155(consisted)X +3488(of)X +3590(creating)X +3884(a)X +3955(new)X +4124(hash)X +4306(table)X +2706 2860(\(where)N +2966(the)X +3100(ultimate)X +3398(size)X +3559(of)X +3662(the)X +3796(table)X +3987(was)X +4147(known)X +4400(in)X +2706 2948(advance\),)N +3054(entering)X +3354(each)X +3539(key/data)X +3848(pair)X +4010(into)X +4171(the)X +4306(table)X +2706 3036(and)N +2849(then)X +3014(retrieving)X +3353(each)X +3528(key/data)X +3827(pair)X +3979(from)X +4162(the)X +4286(table.)X +2706 3124(Each)N +2898(of)X +2996(the)X +3125(graphs)X +3369(shows)X +3599(the)X +3727(timings)X +3996(resulting)X +4306(from)X +2706 3212(varying)N +2973(the)X +3093(pagesize)X +3392(from)X +3570(128)X +3712(bytes)X +3903(to)X +3986(1M)X +4118(and)X +4255(the)X +4374(\256ll)X +2706 3300(factor)N +2929(from)X +3120(1)X +3195(to)X +3292(128.)X +3486(For)X +3631(each)X +3813(run,)X +3974(the)X +4106(buffer)X +4337(size)X +2706 3388(was)N +2874(set)X +3006(at)X +3106(1M.)X +3299(The)X +3466(tests)X +3650(were)X +3849(all)X +3971(run)X +4120(on)X +4242(an)X +4360(HP)X +2706 3476(9000/370)N +3077(\(33.3)X +3312(Mhz)X +3527(MC68030\),)X +3966(with)X +4176(16M)X +4395(of)X +2706 3564(memory,)N +3042(64K)X +3228(physically)X +3605(addressed)X +3970(cache,)X +4222(and)X +4386(an)X +2706 3652(HP7959S)N +3055(disk)X +3231(drive,)X +3459(running)X +3751(4.3BSD-Reno)X +4244(single-)X +2706 3740(user.)N +2878 3854(Both)N +3066(system)X +3321(time)X +3496(\(Figure)X +3764(5a\))X +3899(and)X +4047(elapsed)X +4320(time)X +2706 3942(\(Figure)N +2966(5b\))X +3097(show)X +3290(that)X +3434(for)X +3552(all)X +3655(bucket)X +3892(sizes,)X +4091(the)X +4212(greatest)X +2706 4030(performance)N +3137(gains)X +3329(are)X +3451(made)X +3648(by)X +3751(increasing)X +4104(the)X +4225(\256ll)X +4336(fac-)X +2706 4118(tor)N +2822(until)X +2995(equation)X +3298(1)X +3365(is)X +3445(satis\256ed.)X +3774(The)X +3925(user)X +4085(time)X +4253(shown)X +2706 4206(in)N +2791(Figure)X +3023(5c)X +3122(gives)X +3314(a)X +3373(more)X +3561(detailed)X +3838(picture)X +4083(of)X +4172(how)X +4332(per-)X +2706 4294(formance)N +3054(varies.)X +3330(The)X +3499(smaller)X +3778(bucket)X +4035(sizes)X +4234(require)X +2706 4382(fewer)N +2921(keys)X +3099(per)X +3233(page)X +3416(to)X +3509(satisfy)X +3749(equation)X +4056(1)X +4127(and)X +4274(there-)X +2706 4470(fore)N +2860(incur)X +3049(fewer)X +3257(collisions.)X +3607(However,)X +3946(when)X +4144(the)X +4265(buffer)X +2706 4558(pool)N +2884(size)X +3045(is)X +3134(\256xed,)X +3349(smaller)X +3620(pages)X +3838(imply)X +4059(more)X +4259(pages.)X +2706 4646(An)N +2830(increased)X +3160(number)X +3430(of)X +3522(pages)X +3730(means)X +3960(more)X +2 f +4150(malloc\(3\))X +1 f +2706 4734(calls)N +2879(and)X +3021(more)X +3212(overhead)X +3533(in)X +3621(the)X +3745(hash)X +3918(package's)X +4265(buffer)X +2706 4822(manager)N +3003(to)X +3085(manage)X +3355(the)X +3473(additional)X +3813(pages.)X +2878 4936(The)N +3028(tradeoff)X +3308(works)X +3529(out)X +3655(most)X +3834(favorably)X +4166(when)X +4364(the)X +2706 5024(page)N +2886(size)X +3039(is)X +3120(256)X +3268(and)X +3412(the)X +3538(\256ll)X +3654(factor)X +3870(is)X +3950(8.)X +4057(Similar)X +4319(con-)X +2706 5112(clusions)N +3009(were)X +3207(obtained)X +3524(if)X +3614(the)X +3753(test)X +3905(was)X +4071(run)X +4218(without)X +2706 5200(knowing)N +3007(the)X +3126(\256nal)X +3289(table)X +3466(size)X +3612(in)X +3695(advance.)X +4020(If)X +4095(the)X +4214(\256le)X +4337(was)X +2706 5288(closed)N +2942(and)X +3088(written)X +3345(to)X +3437(disk,)X +3620(the)X +3748(conclusions)X +4156(were)X +4343(still)X +2706 5376(the)N +2832(same.)X +3065(However,)X +3408(rereading)X +3740(the)X +3865(\256le)X +3994(from)X +4177(disk)X +4337(was)X +2706 5464(slightly)N +2983(faster)X +3199(if)X +3285(a)X +3358(larger)X +3583(bucket)X +3834(size)X +3996(and)X +4149(\256ll)X +4274(factor)X +2706 5552(were)N +2898(used)X +3079(\(1K)X +3238(bucket)X +3486(size)X +3645(and)X +3795(32)X +3909(\256ll)X +4031(factor\).)X +4320(This)X +2706 5640(follows)N +2987(intuitively)X +3356(from)X +3553(the)X +3691(improved)X +4038(ef\256ciency)X +4395(of)X +3 f +720 5960(USENIX)N +9 f +1042(-)X +3 f +1106(Winter)X +1371('91)X +9 f +1498(-)X +3 f +1562(Dallas,)X +1815(TX)X +4424(7)X + +8 p +%%Page: 8 8 +0(Courier)xf 0 f +10 s 10 xH 0 xS 0 f +3 f +432 258(A)N +510(New)X +682(Hashing)X +985(Package)X +1290(for)X +1413(UNIX)X +3663(Seltzer)X +3920(&)X +4007(Yigit)X +1 f +432 538(performing)N +830(1K)X +965(reads)X +1172(from)X +1365(the)X +1500(disk)X +1670(rather)X +1894(than)X +2068(256)X +432 626(byte)N +609(reads.)X +857(In)X +962(general,)X +1257(performance)X +1702(for)X +1834(disk)X +2005(based)X +432 714(tables)N +639(is)X +712(best)X +861(when)X +1055(the)X +1173(page)X +1345(size)X +1490(is)X +1563(approximately)X +2046(1K.)X +10 f +432 802 -0.0930(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)AN +619 2380 MXY +-12 24 Dl +24 0 Dl +-12 -24 Dl +629 2437 MXY +-12 24 Dl +24 0 Dl +-12 -24 Dl +648 2504 MXY +-12 25 Dl +24 0 Dl +-12 -25 Dl +686 2515 MXY +-12 24 Dl +24 0 Dl +-12 -24 Dl +762 2516 MXY +-12 24 Dl +25 0 Dl +-13 -24 Dl +916 2515 MXY +-13 24 Dl +25 0 Dl +-12 -24 Dl +1222 2516 MXY +-12 24 Dl +24 0 Dl +-12 -24 Dl +1834 2515 MXY +-12 24 Dl +24 0 Dl +-12 -24 Dl +1 Dt +619 2392 MXY +10 57 Dl +19 67 Dl +38 11 Dl +76 1 Dl +154 -1 Dl +306 1 Dl +612 -1 Dl +8 s +1 f +1628 2522(128)N +3 Dt +607 2245 MXY +24 Dc +617 2375 MXY +23 Dc +635 2442 MXY +24 Dc +674 2525 MXY +23 Dc +750 2529 MXY +24 Dc +904 2527 MXY +23 Dc +1210 MX +23 Dc +1822 2528 MXY +23 Dc +20 Ds +1 Dt +619 2245 MXY +10 130 Dl +19 67 Dl +38 83 Dl +76 4 Dl +154 -2 Dl +306 0 Dl +612 1 Dl +678 2482(256)N +-1 Ds +3 Dt +619 2127 MXY +0 24 Dl +0 -12 Dl +12 0 Dl +-24 0 Dl +629 2191 MXY +0 25 Dl +0 -12 Dl +12 0 Dl +-24 0 Dl +648 2334 MXY +0 24 Dl +0 -12 Dl +12 0 Dl +-24 0 Dl +686 2409 MXY +0 25 Dl +0 -13 Dl +12 0 Dl +-24 0 Dl +762 2516 MXY +0 25 Dl +0 -12 Dl +13 0 Dl +-25 0 Dl +916 2516 MXY +0 24 Dl +0 -12 Dl +12 0 Dl +-25 0 Dl +1222 2515 MXY +0 24 Dl +0 -12 Dl +12 0 Dl +-24 0 Dl +1834 2515 MXY +0 24 Dl +0 -12 Dl +12 0 Dl +-24 0 Dl +5 Dt +619 2139 MXY +10 65 Dl +19 142 Dl +38 75 Dl +76 108 Dl +154 -1 Dl +306 -1 Dl +612 0 Dl +694 2401(512)N +3 Dt +631 2064 MXY +-24 24 Dl +12 -12 Dl +-12 -12 Dl +24 24 Dl +641 2077 MXY +-24 25 Dl +12 -12 Dl +-12 -13 Dl +24 25 Dl +660 2132 MXY +-24 24 Dl +12 -12 Dl +-12 -12 Dl +24 24 Dl +698 2292 MXY +-24 24 Dl +12 -12 Dl +-12 -12 Dl +24 24 Dl +775 2382 MXY +-25 24 Dl +12 -12 Dl +-12 -12 Dl +25 24 Dl +928 2516 MXY +-25 24 Dl +13 -12 Dl +-13 -12 Dl +25 24 Dl +1234 2516 MXY +-24 25 Dl +12 -12 Dl +-12 -13 Dl +24 25 Dl +1846 2516 MXY +-24 24 Dl +12 -12 Dl +-12 -12 Dl +24 24 Dl +16 Ds +1 Dt +619 2076 MXY +10 14 Dl +19 54 Dl +38 160 Dl +76 90 Dl +154 134 Dl +306 1 Dl +612 -1 Dl +694 2257(1024)N +-1 Ds +3 Dt +619 1877 MXY +12 -24 Dl +-24 0 Dl +12 24 Dl +629 1855 MXY +12 -24 Dl +-24 0 Dl +12 24 Dl +648 1838 MXY +12 -24 Dl +-24 0 Dl +12 24 Dl +686 1860 MXY +12 -25 Dl +-24 0 Dl +12 25 Dl +762 1923 MXY +13 -24 Dl +-25 0 Dl +12 24 Dl +916 2087 MXY +12 -24 Dl +-25 0 Dl +13 24 Dl +1222 2256 MXY +12 -24 Dl +-24 0 Dl +12 24 Dl +1834 2541 MXY +12 -25 Dl +-24 0 Dl +12 25 Dl +619 1865 MXY +10 -22 Dl +19 -17 Dl +38 21 Dl +76 64 Dl +154 164 Dl +306 169 Dl +612 285 Dl +1645 2427(4096)N +619 1243 MXY +0 24 Dl +0 -12 Dl +12 0 Dl +-24 0 Dl +629 1196 MXY +0 24 Dl +0 -12 Dl +12 0 Dl +-24 0 Dl +648 1146 MXY +0 24 Dl +0 -12 Dl +12 0 Dl +-24 0 Dl +686 1174 MXY +0 25 Dl +0 -13 Dl +12 0 Dl +-24 0 Dl +762 1249 MXY +0 24 Dl +0 -12 Dl +13 0 Dl +-25 0 Dl +916 1371 MXY +0 24 Dl +0 -12 Dl +12 0 Dl +-25 0 Dl +1222 1680 MXY +0 24 Dl +0 -12 Dl +12 0 Dl +-24 0 Dl +1834 1999 MXY +0 24 Dl +0 -12 Dl +12 0 Dl +-24 0 Dl +619 1255 MXY +10 -47 Dl +19 -50 Dl +38 28 Dl +76 75 Dl +154 122 Dl +306 309 Dl +612 319 Dl +1741 1934(8192)N +5 Dt +609 2531 MXY +1225 0 Dl +609 MX +0 -1553 Dl +2531 MY +0 16 Dl +4 Ds +1 Dt +2531 MY +0 -1553 Dl +593 2625(0)N +-1 Ds +5 Dt +916 2531 MXY +0 16 Dl +4 Ds +1 Dt +2531 MY +0 -1553 Dl +884 2625(32)N +-1 Ds +5 Dt +1222 2531 MXY +0 16 Dl +4 Ds +1 Dt +2531 MY +0 -1553 Dl +1190 2625(64)N +-1 Ds +5 Dt +1528 2531 MXY +0 16 Dl +4 Ds +1 Dt +2531 MY +0 -1553 Dl +1496 2625(96)N +-1 Ds +5 Dt +1834 2531 MXY +0 16 Dl +4 Ds +1 Dt +2531 MY +0 -1553 Dl +1786 2625(128)N +-1 Ds +5 Dt +609 2531 MXY +-16 0 Dl +4 Ds +1 Dt +609 MX +1225 0 Dl +545 2558(0)N +-1 Ds +5 Dt +609 2013 MXY +-16 0 Dl +4 Ds +1 Dt +609 MX +1225 0 Dl +481 2040(100)N +-1 Ds +5 Dt +609 1496 MXY +-16 0 Dl +4 Ds +1 Dt +609 MX +1225 0 Dl +481 1523(200)N +-1 Ds +5 Dt +609 978 MXY +-16 0 Dl +4 Ds +1 Dt +609 MX +1225 0 Dl +481 1005(300)N +1088 2724(Fill)N +1194(Factor)X +422 1611(S)N +426 1667(e)N +426 1724(c)N +424 1780(o)N +424 1837(n)N +424 1893(d)N +428 1949(s)N +3 Dt +-1 Ds +3 f +432 2882(Figure)N +636(5a:)X +1 f +744(System)X +956(Time)X +1113(for)X +1209(dictionary)X +1490(data)X +1618(set)X +1711(with)X +1847(1M)X +1958(of)X +2033(buffer)X +432 2970(space)N +594(and)X +707(varying)X +923(bucket)X +1114(sizes)X +1259(and)X +1372(\256ll)X +1465(factors.)X +1675(Each)X +1823(line)X +1940(is)X +2004(labeled)X +432 3058(with)N +562(its)X +639(bucket)X +825(size.)X +10 s +10 f +432 3234 -0.0930(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)AN +8 s +1 f +428 4381(s)N +424 4325(d)N +424 4269(n)N +424 4212(o)N +426 4156(c)N +426 4099(e)N +422 4043(S)N +1116 5156(Fill)N +1222(Factor)X +506 3437(3200)N +4 Ds +1 Dt +666 3410 MXY +1168 0 Dl +-1 Ds +5 Dt +666 MX +-16 0 Dl +506 3825(2400)N +4 Ds +1 Dt +666 3799 MXY +1168 0 Dl +-1 Ds +5 Dt +666 MX +-16 0 Dl +506 4214(1600)N +4 Ds +1 Dt +666 4186 MXY +1168 0 Dl +-1 Ds +5 Dt +666 MX +-16 0 Dl +538 4602(800)N +4 Ds +1 Dt +666 4575 MXY +1168 0 Dl +-1 Ds +5 Dt +666 MX +-16 0 Dl +602 4990(0)N +4 Ds +1 Dt +666 4963 MXY +1168 0 Dl +-1 Ds +5 Dt +666 MX +-16 0 Dl +1786 5057(128)N +4 Ds +1 Dt +1834 4963 MXY +0 -1553 Dl +-1 Ds +5 Dt +4963 MY +0 16 Dl +1510 5057(96)N +4 Ds +1 Dt +1542 4963 MXY +0 -1553 Dl +-1 Ds +5 Dt +4963 MY +0 16 Dl +1218 5057(64)N +4 Ds +1 Dt +1250 4963 MXY +0 -1553 Dl +-1 Ds +5 Dt +4963 MY +0 16 Dl +926 5057(32)N +4 Ds +1 Dt +958 4963 MXY +0 -1553 Dl +-1 Ds +5 Dt +4963 MY +0 16 Dl +650 5057(0)N +4 Ds +1 Dt +666 4963 MXY +0 -1553 Dl +-1 Ds +5 Dt +4963 MY +0 16 Dl +4963 MY +0 -1553 Dl +4963 MY +1168 0 Dl +1741 4752(8192)N +3 Dt +675 3732 MXY +9 -172 Dl +18 -118 Dl +37 128 Dl +73 -121 Dl +146 623 Dl +292 497 Dl +584 245 Dl +4802 MY +0 24 Dl +0 -12 Dl +12 0 Dl +-24 0 Dl +1250 4557 MXY +0 25 Dl +0 -13 Dl +12 0 Dl +-24 0 Dl +958 4060 MXY +0 24 Dl +0 -12 Dl +12 0 Dl +-24 0 Dl +812 3437 MXY +0 24 Dl +0 -12 Dl +12 0 Dl +-24 0 Dl +739 3558 MXY +0 24 Dl +0 -12 Dl +12 0 Dl +-24 0 Dl +702 3430 MXY +0 25 Dl +0 -13 Dl +13 0 Dl +-25 0 Dl +684 3548 MXY +0 24 Dl +0 -12 Dl +12 0 Dl +-24 0 Dl +675 3720 MXY +0 24 Dl +0 -12 Dl +12 0 Dl +-24 0 Dl +1637 4912(4096)N +675 4307 MXY +9 -58 Dl +18 30 Dl +37 89 Dl +73 144 Dl +146 235 Dl +292 122 Dl +584 89 Dl +4970 MY +12 -24 Dl +-24 0 Dl +12 24 Dl +1250 4881 MXY +12 -24 Dl +-24 0 Dl +12 24 Dl +958 4759 MXY +12 -24 Dl +-24 0 Dl +12 24 Dl +812 4524 MXY +12 -24 Dl +-24 0 Dl +12 24 Dl +739 4380 MXY +12 -24 Dl +-24 0 Dl +12 24 Dl +702 4291 MXY +13 -24 Dl +-25 0 Dl +12 24 Dl +684 4261 MXY +12 -24 Dl +-24 0 Dl +12 24 Dl +675 4319 MXY +12 -24 Dl +-24 0 Dl +12 24 Dl +734 4662(1024)N +16 Ds +1 Dt +675 4352 MXY +9 60 Dl +18 134 Dl +37 266 Dl +73 117 Dl +146 30 Dl +292 0 Dl +584 -1 Dl +-1 Ds +3 Dt +1846 4946 MXY +-24 24 Dl +12 -12 Dl +-12 -12 Dl +24 24 Dl +1262 4946 MXY +-24 25 Dl +12 -12 Dl +-12 -13 Dl +24 25 Dl +970 4947 MXY +-24 24 Dl +12 -12 Dl +-12 -12 Dl +24 24 Dl +824 4917 MXY +-24 24 Dl +12 -12 Dl +-12 -12 Dl +24 24 Dl +751 4800 MXY +-24 24 Dl +12 -12 Dl +-12 -12 Dl +24 24 Dl +715 4534 MXY +-25 25 Dl +12 -13 Dl +-12 -12 Dl +25 25 Dl +696 4400 MXY +-24 24 Dl +12 -12 Dl +-12 -12 Dl +24 24 Dl +687 4339 MXY +-24 25 Dl +12 -12 Dl +-12 -13 Dl +24 25 Dl +718 4792(512)N +5 Dt +675 4422 MXY +9 137 Dl +18 278 Dl +37 105 Dl +73 18 Dl +146 -1 Dl +292 0 Dl +584 -1 Dl +3 Dt +4946 MY +0 24 Dl +0 -12 Dl +12 0 Dl +-24 0 Dl +1250 4946 MXY +0 25 Dl +0 -12 Dl +12 0 Dl +-24 0 Dl +958 4947 MXY +0 24 Dl +0 -12 Dl +12 0 Dl +-24 0 Dl +812 4948 MXY +0 24 Dl +0 -12 Dl +12 0 Dl +-24 0 Dl +739 4930 MXY +0 24 Dl +0 -12 Dl +12 0 Dl +-24 0 Dl +702 4824 MXY +0 25 Dl +0 -12 Dl +13 0 Dl +-25 0 Dl +684 4547 MXY +0 24 Dl +0 -12 Dl +12 0 Dl +-24 0 Dl +675 4410 MXY +0 25 Dl +0 -13 Dl +12 0 Dl +-24 0 Dl +750 4921(256)N +20 Ds +1 Dt +675 4597 MXY +9 246 Dl +18 106 Dl +37 10 Dl +73 0 Dl +146 0 Dl +292 0 Dl +584 -1 Dl +-1 Ds +3 Dt +1822 MX +23 Dc +1238 4959 MXY +23 Dc +946 MX +23 Dc +800 MX +23 Dc +727 MX +23 Dc +691 4949 MXY +23 Dc +672 4843 MXY +24 Dc +663 4597 MXY +24 Dc +1395 4961(128)N +1 Dt +675 4855 MXY +9 93 Dl +18 10 Dl +37 1 Dl +73 0 Dl +146 -1 Dl +292 0 Dl +584 0 Dl +3 Dt +4946 MY +-12 24 Dl +24 0 Dl +-12 -24 Dl +1250 MX +-12 24 Dl +24 0 Dl +-12 -24 Dl +958 MX +-12 24 Dl +24 0 Dl +-12 -24 Dl +812 MX +-12 25 Dl +24 0 Dl +-12 -25 Dl +739 4947 MXY +-12 24 Dl +24 0 Dl +-12 -24 Dl +702 4946 MXY +-12 24 Dl +25 0 Dl +-13 -24 Dl +684 4936 MXY +-12 24 Dl +24 0 Dl +-12 -24 Dl +675 4843 MXY +-12 24 Dl +24 0 Dl +-12 -24 Dl +3 Dt +-1 Ds +3 f +432 5314(Figure)N +634(5b:)X +1 f +744(Elapsed)X +967(Time)X +1123(for)X +1218(dictionary)X +1498(data)X +1625(set)X +1717(with)X +1851(1M)X +1960(of)X +2033(buffer)X +432 5402(space)N +593(and)X +705(varying)X +920(bucket)X +1110(sizes)X +1254(and)X +1366(\256ll)X +1457(factors.)X +1681(Each)X +1827(line)X +1942(is)X +2004(labeled)X +432 5490(with)N +562(its)X +639(bucket)X +825(size.)X +10 s +2590 538(If)N +2677(an)X +2785(approximation)X +3284(of)X +3383(the)X +3513(number)X +3790(of)X +3889(elements)X +2418 626(ultimately)N +2773(to)X +2866(be)X +2973(stored)X +3200(in)X +3293(the)X +3422(hash)X +3599(table)X +3785(is)X +3868(known)X +4116(at)X +2418 714(the)N +2564(time)X +2754(of)X +2869(creation,)X +3196(the)X +3342(hash)X +3536(package)X +3847(takes)X +4059(this)X +2418 802(number)N +2688(as)X +2779(a)X +2839(parameter)X +3185(and)X +3325(uses)X +3487(it)X +3555(to)X +3641(hash)X +3812(entries)X +4050(into)X +2418 890(the)N +2541(full)X +2677(sized)X +2867(table)X +3048(rather)X +3261(than)X +3424(growing)X +3716(the)X +3838(table)X +4018(from)X +2418 978(a)N +2477(single)X +2691(bucket.)X +2968(If)X +3044(this)X +3181(number)X +3448(is)X +3523(not)X +3647(known,)X +3907(the)X +4027(hash)X +2418 1066(table)N +2632(starts)X +2859(with)X +3059(a)X +3153(single)X +3402(bucket)X +3674(and)X +3848(gracefully)X +2418 1154(expands)N +2707(as)X +2800(elements)X +3111(are)X +3236(added,)X +3474(although)X +3780(a)X +3842(slight)X +4044(per-)X +2418 1242(formance)N +2747(degradation)X +3151(may)X +3313(be)X +3413(noticed.)X +3713(Figure)X +3946(6)X +4010(illus-)X +2418 1330(trates)N +2625(the)X +2756(difference)X +3116(in)X +3211(performance)X +3651(between)X +3952(storing)X +2418 1418(keys)N +2588(in)X +2673(a)X +2732(\256le)X +2857(when)X +3054(the)X +3174(ultimate)X +3458(size)X +3605(is)X +3680(known)X +3920(\(the)X +4067(left)X +2418 1506(bars)N +2581(in)X +2672(each)X +2849(set\),)X +3014(compared)X +3360(to)X +3450(building)X +3744(the)X +3870(\256le)X +4000(when)X +2418 1594(the)N +2550(ultimate)X +2846(size)X +3005(is)X +3091(unknown)X +3422(\(the)X +3580(right)X +3764(bars)X +3931(in)X +4026(each)X +2418 1682(set\).)N +2609(Once)X +2814(the)X +2947(\256ll)X +3069(factor)X +3291(is)X +3378(suf\256ciently)X +3772(high)X +3948(for)X +4076(the)X +2418 1770(page)N +2596(size)X +2747(\(8\),)X +2887(growing)X +3180(the)X +3304(table)X +3486(dynamically)X +3908(does)X +4081(lit-)X +2418 1858(tle)N +2518(to)X +2600(degrade)X +2875(performance.)X +10 f +2418 1946 -0.0930(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)AN +9 s +1 f +2413 3238(s)N +2409 3173(d)N +2409 3108(n)N +2409 3043(o)N +2411 2979(c)N +2411 2914(e)N +2407 2849(S)N +3143 4129(Fill)N +3261(Factor)X +2448 2152(15)N +4 Ds +1 Dt +2557 2122 MXY +1473 0 Dl +-1 Ds +5 Dt +2557 MX +-19 0 Dl +2448 2747(10)N +4 Ds +1 Dt +2557 2717 MXY +1473 0 Dl +-1 Ds +5 Dt +2557 MX +-19 0 Dl +2484 3343(5)N +4 Ds +1 Dt +2557 3313 MXY +1473 0 Dl +-1 Ds +5 Dt +2557 MX +-19 0 Dl +2484 3938(0)N +4 Ds +1 Dt +2557 3908 MXY +1473 0 Dl +-1 Ds +5 Dt +2557 MX +-19 0 Dl +3976 4015(128)N +4 Ds +1 Dt +4030 3908 MXY +0 -1786 Dl +-1 Ds +5 Dt +3908 MY +0 19 Dl +3626 4015(96)N +4 Ds +1 Dt +3662 3908 MXY +0 -1786 Dl +-1 Ds +5 Dt +3908 MY +0 19 Dl +3258 4015(64)N +4 Ds +1 Dt +3294 3908 MXY +0 -1786 Dl +-1 Ds +5 Dt +3908 MY +0 19 Dl +2889 4015(32)N +4 Ds +1 Dt +2925 3908 MXY +0 -1786 Dl +-1 Ds +5 Dt +3908 MY +0 19 Dl +2539 4015(0)N +4 Ds +1 Dt +2557 3908 MXY +0 -1786 Dl +-1 Ds +5 Dt +3908 MY +0 19 Dl +3908 MY +0 -1786 Dl +3908 MY +1473 0 Dl +4053 2378(8192)N +3 Dt +2569 2277 MXY +11 0 Dl +23 48 Dl +46 -167 Dl +92 35 Dl +184 12 Dl +369 143 Dl +736 0 Dl +2334 MY +0 28 Dl +0 -14 Dl +14 0 Dl +-28 0 Dl +3294 2334 MXY +0 28 Dl +0 -14 Dl +13 0 Dl +-27 0 Dl +2925 2192 MXY +0 27 Dl +0 -14 Dl +14 0 Dl +-28 0 Dl +2741 2180 MXY +0 27 Dl +0 -14 Dl +14 0 Dl +-28 0 Dl +2649 2144 MXY +0 28 Dl +0 -14 Dl +14 0 Dl +-28 0 Dl +2603 2311 MXY +0 27 Dl +0 -13 Dl +14 0 Dl +-28 0 Dl +2580 2263 MXY +0 28 Dl +0 -14 Dl +14 0 Dl +-28 0 Dl +2569 2263 MXY +0 28 Dl +0 -14 Dl +13 0 Dl +-27 0 Dl +4053 2591(4096)N +2569 2348 MXY +11 -11 Dl +23 -96 Dl +46 71 Dl +92 72 Dl +184 226 Dl +369 48 Dl +736 -60 Dl +2612 MY +14 -28 Dl +-28 0 Dl +14 28 Dl +3294 2672 MXY +13 -28 Dl +-27 0 Dl +14 28 Dl +2925 2624 MXY +14 -28 Dl +-28 0 Dl +14 28 Dl +2741 2398 MXY +14 -28 Dl +-28 0 Dl +14 28 Dl +2649 2326 MXY +14 -27 Dl +-28 0 Dl +14 27 Dl +2603 2255 MXY +14 -28 Dl +-28 0 Dl +14 28 Dl +2580 2350 MXY +14 -27 Dl +-28 0 Dl +14 27 Dl +2569 2362 MXY +13 -28 Dl +-27 0 Dl +14 28 Dl +4053 2681(1024)N +16 Ds +1 Dt +2569 2300 MXY +11 48 Dl +23 96 Dl +46 95 Dl +92 274 Dl +184 202 Dl +369 -155 Dl +736 -190 Dl +-1 Ds +3 Dt +4044 2656 MXY +-28 28 Dl +14 -14 Dl +-14 -14 Dl +28 28 Dl +3307 2846 MXY +-27 28 Dl +14 -14 Dl +-14 -14 Dl +27 28 Dl +2939 3001 MXY +-28 28 Dl +14 -14 Dl +-14 -14 Dl +28 28 Dl +2755 2799 MXY +-28 28 Dl +14 -14 Dl +-14 -14 Dl +28 28 Dl +2663 2525 MXY +-28 28 Dl +14 -14 Dl +-14 -14 Dl +28 28 Dl +2617 2430 MXY +-28 28 Dl +14 -14 Dl +-14 -14 Dl +28 28 Dl +2594 2334 MXY +-28 28 Dl +14 -14 Dl +-14 -14 Dl +28 28 Dl +2582 2287 MXY +-27 27 Dl +14 -14 Dl +-14 -13 Dl +27 27 Dl +4053 2851(512)N +5 Dt +2569 2372 MXY +11 -24 Dl +23 405 Dl +46 83 Dl +92 227 Dl +184 -72 Dl +369 -119 Dl +736 -107 Dl +3 Dt +2751 MY +0 28 Dl +0 -14 Dl +14 0 Dl +-28 0 Dl +3294 2858 MXY +0 28 Dl +0 -14 Dl +13 0 Dl +-27 0 Dl +2925 2977 MXY +0 28 Dl +0 -14 Dl +14 0 Dl +-28 0 Dl +2741 3049 MXY +0 27 Dl +0 -13 Dl +14 0 Dl +-28 0 Dl +2649 2823 MXY +0 27 Dl +0 -14 Dl +14 0 Dl +-28 0 Dl +2603 2739 MXY +0 28 Dl +0 -14 Dl +14 0 Dl +-28 0 Dl +2580 2334 MXY +0 28 Dl +0 -14 Dl +14 0 Dl +-28 0 Dl +2569 2358 MXY +0 28 Dl +0 -14 Dl +13 0 Dl +-27 0 Dl +4053 2795(256)N +20 Ds +1 Dt +2569 2456 MXY +11 285 Dl +23 95 Dl +46 251 Dl +92 -60 Dl +184 -84 Dl +369 -107 Dl +736 -71 Dl +-1 Ds +3 Dt +4016 MX +27 Dc +3280 2836 MXY +27 Dc +2912 2943 MXY +27 Dc +2728 3027 MXY +27 Dc +2635 3087 MXY +28 Dc +2589 2836 MXY +28 Dc +2566 2741 MXY +27 Dc +2554 2456 MXY +28 Dc +4053 2741(128)N +1 Dt +2569 2729 MXY +11 203 Dl +23 131 Dl +46 -60 Dl +92 -119 Dl +184 -60 Dl +369 -83 Dl +736 -12 Dl +3 Dt +2716 MY +-14 27 Dl +28 0 Dl +-14 -27 Dl +3294 2727 MXY +-14 28 Dl +27 0 Dl +-13 -28 Dl +2925 2811 MXY +-14 27 Dl +28 0 Dl +-14 -27 Dl +2741 2870 MXY +-14 28 Dl +28 0 Dl +-14 -28 Dl +2649 2989 MXY +-14 28 Dl +28 0 Dl +-14 -28 Dl +2603 3049 MXY +-14 27 Dl +28 0 Dl +-14 -27 Dl +2580 2918 MXY +-14 28 Dl +28 0 Dl +-14 -28 Dl +2569 2716 MXY +-14 27 Dl +27 0 Dl +-13 -27 Dl +3 Dt +-1 Ds +3 f +8 s +2418 4286(Figure)N +2628(5c:)X +1 f +2738(User)X +2887(Time)X +3051(for)X +3154(dictionary)X +3442(data)X +3577(set)X +3677(with)X +3820(1M)X +3938(of)X +4019(buffer)X +2418 4374(space)N +2579(and)X +2691(varying)X +2906(bucket)X +3096(sizes)X +3240(and)X +3352(\256ll)X +3443(factors.)X +3667(Each)X +3813(line)X +3928(is)X +3990(labeled)X +2418 4462(with)N +2548(its)X +2625(bucket)X +2811(size.)X +10 s +10 f +2418 4638 -0.0930(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)AN +1 f +2590 4840(Since)N +2796(no)X +2904(known)X +3150(hash)X +3325(function)X +3620(performs)X +3938(equally)X +2418 4928(well)N +2589(on)X +2702(all)X +2815(possible)X +3110(data,)X +3297(the)X +3428(user)X +3595(may)X +3766(\256nd)X +3923(that)X +4076(the)X +2418 5016(built-in)N +2678(hash)X +2849(function)X +3140(does)X +3311(poorly)X +3544(on)X +3648(a)X +3708(particular)X +4040(data)X +2418 5104(set.)N +2548(In)X +2636(this)X +2771(case,)X +2950(a)X +3006(hash)X +3173(function,)X +3480(taking)X +3700(two)X +3840(arguments)X +2418 5192(\(a)N +2507(pointer)X +2760(to)X +2848(a)X +2910(byte)X +3074(string)X +3282(and)X +3424(a)X +3486(length\))X +3739(and)X +3880(returning)X +2418 5280(an)N +2517(unsigned)X +2829(long)X +2993(to)X +3077(be)X +3175(used)X +3344(as)X +3433(the)X +3553(hash)X +3722(value,)X +3938(may)X +4098(be)X +2418 5368(speci\256ed)N +2731(at)X +2817(hash)X +2992(table)X +3176(creation)X +3463(time.)X +3673(When)X +3893(an)X +3996(exist-)X +2418 5456(ing)N +2570(hash)X +2767(table)X +2973(is)X +3076(opened)X +3358(and)X +3524(a)X +3609(hash)X +3805(function)X +4121(is)X +2418 5544(speci\256ed,)N +2752(the)X +2879(hash)X +3054(package)X +3346(will)X +3498(try)X +3615(to)X +3705(determine)X +4054(that)X +2418 5632(the)N +2546(hash)X +2723(function)X +3020(supplied)X +3321(is)X +3404(the)X +3532(one)X +3678(with)X +3850(which)X +4076(the)X +2418 5720(table)N +2630(was)X +2811(created.)X +3139(There)X +3382(are)X +3536(a)X +3627(variety)X +3905(of)X +4027(hash)X +3 f +432 5960(8)N +2970(USENIX)X +9 f +3292(-)X +3 f +3356(Winter)X +3621('91)X +9 f +3748(-)X +3 f +3812(Dallas,)X +4065(TX)X + +9 p +%%Page: 9 9 +0(Courier)xf 0 f +10 s 10 xH 0 xS 0 f +3 f +720 258(Seltzer)N +977(&)X +1064(Yigit)X +3278(A)X +3356(New)X +3528(Hashing)X +3831(Package)X +4136(for)X +4259(UNIX)X +1 f +720 538(functions)N +1065(provided)X +1397(with)X +1586(the)X +1731(package.)X +2082(The)X +2253(default)X +720 626(function)N +1014(for)X +1135(the)X +1260(package)X +1551(is)X +1631(the)X +1755(one)X +1897(which)X +2119(offered)X +2378(the)X +720 714(best)N +875(performance)X +1308(in)X +1396(terms)X +1600(of)X +1693(cycles)X +1920(executed)X +2232(per)X +2360(call)X +720 802(\(it)N +827(did)X +965(not)X +1103(produce)X +1398(the)X +1531(fewest)X +1776(collisions)X +2117(although)X +2432(it)X +720 890(was)N +866(within)X +1091(a)X +1148(small)X +1341(percentage)X +1710(of)X +1797(the)X +1915(function)X +2202(that)X +2342(pro-)X +720 978(duced)N +947(the)X +1080(fewest)X +1324(collisions\).)X +1731(Again,)X +1981(in)X +2077(time)X +2253(critical)X +720 1066(applications,)N +1152(users)X +1342(are)X +1466(encouraged)X +1862(to)X +1949(experiment)X +2334(with)X +720 1154(a)N +783(variety)X +1032(of)X +1125(hash)X +1298(functions)X +1622(to)X +1710(achieve)X +1982(optimal)X +2252(perfor-)X +720 1242(mance.)N +10 f +720 1330 -0.0930(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)AN +3 f +7 s +1038 2925(Full)N +1149(size)X +1251(table)X +1384(\(left\))X +1547 2718(Fill)N +1643(Factor)X +2268 2662(64)N +1964(32)X +1674(16)X +1384(8)X +1093(4)X +4 Ds +1 Dt +900 2280 MXY +1548 0 Dl +900 1879 MXY +1548 0 Dl +900 1506 MXY +1548 0 Dl +1563 2902 MXY +111 0 Dl +-1 Ds +900 MX +110 0 Dl +1425 2828(System)N +983(User)X +1895 2778 MXY + 1895 2778 lineto + 1950 2778 lineto + 1950 2833 lineto + 1895 2833 lineto + 1895 2778 lineto +closepath 21 1895 2778 1950 2833 Dp +1342 MX + 1342 2778 lineto + 1397 2778 lineto + 1397 2833 lineto + 1342 2833 lineto + 1342 2778 lineto +closepath 14 1342 2778 1397 2833 Dp +900 MX + 900 2778 lineto + 955 2778 lineto + 955 2833 lineto + 900 2833 lineto + 900 2778 lineto +closepath 3 900 2778 955 2833 Dp +5 Dt +2283 2211 MXY +96 0 Dl +1992 MX +97 0 Dl +1702 MX +97 0 Dl +1411 2252 MXY +97 0 Dl +4 Ds +1 Dt +2283 2211 MXY + 2283 2211 lineto + 2379 2211 lineto + 2379 2252 lineto + 2283 2252 lineto + 2283 2211 lineto +closepath 14 2283 2211 2379 2252 Dp +1992 MX + 1992 2211 lineto + 2089 2211 lineto + 2089 2252 lineto + 1992 2252 lineto + 1992 2211 lineto +closepath 14 1992 2211 2089 2252 Dp +1702 MX + 1702 2211 lineto + 1799 2211 lineto + 1799 2252 lineto + 1702 2252 lineto + 1702 2211 lineto +closepath 14 1702 2211 1799 2252 Dp +1411 2252 MXY + 1411 2252 lineto + 1508 2252 lineto + 1508 2294 lineto + 1411 2294 lineto + 1411 2252 lineto +closepath 14 1411 2252 1508 2294 Dp +2283 MX + 2283 2252 lineto + 2379 2252 lineto + 2379 2612 lineto + 2283 2612 lineto + 2283 2252 lineto +closepath 3 2283 2252 2379 2612 Dp +1992 MX + 1992 2252 lineto + 2089 2252 lineto + 2089 2612 lineto + 1992 2612 lineto + 1992 2252 lineto +closepath 3 1992 2252 2089 2612 Dp +1702 MX + 1702 2252 lineto + 1799 2252 lineto + 1799 2612 lineto + 1702 2612 lineto + 1702 2252 lineto +closepath 3 1702 2252 1799 2612 Dp +1411 2294 MXY + 1411 2294 lineto + 1508 2294 lineto + 1508 2612 lineto + 1411 2612 lineto + 1411 2294 lineto +closepath 3 1411 2294 1508 2612 Dp +-1 Ds +2158 2238 MXY + 2158 2238 lineto + 2255 2238 lineto + 2255 2252 lineto + 2158 2252 lineto + 2158 2238 lineto +closepath 21 2158 2238 2255 2252 Dp +1868 MX + 1868 2238 lineto + 1965 2238 lineto + 1965 2280 lineto + 1868 2280 lineto + 1868 2238 lineto +closepath 21 1868 2238 1965 2280 Dp +1577 MX + 1577 2238 lineto + 1674 2238 lineto + 1674 2308 lineto + 1577 2308 lineto + 1577 2238 lineto +closepath 21 1577 2238 1674 2308 Dp +1287 2308 MXY + 1287 2308 lineto + 1287 2280 lineto + 1384 2280 lineto + 1384 2308 lineto + 1287 2308 lineto +closepath 21 1287 2280 1384 2308 Dp +2158 2280 MXY + 2158 2280 lineto + 2158 2252 lineto + 2255 2252 lineto + 2255 2280 lineto + 2158 2280 lineto +closepath 14 2158 2252 2255 2280 Dp +1868 2308 MXY + 1868 2308 lineto + 1868 2280 lineto + 1965 2280 lineto + 1965 2308 lineto + 1868 2308 lineto +closepath 14 1868 2280 1965 2308 Dp +1577 2335 MXY + 1577 2335 lineto + 1577 2308 lineto + 1674 2308 lineto + 1674 2335 lineto + 1577 2335 lineto +closepath 14 1577 2308 1674 2335 Dp +1287 2363 MXY + 1287 2363 lineto + 1287 2308 lineto + 1384 2308 lineto + 1384 2363 lineto + 1287 2363 lineto +closepath 14 1287 2308 1384 2363 Dp +2158 2280 MXY + 2158 2280 lineto + 2255 2280 lineto + 2255 2612 lineto + 2158 2612 lineto + 2158 2280 lineto +closepath 3 2158 2280 2255 2612 Dp +1868 2308 MXY + 1868 2308 lineto + 1965 2308 lineto + 1965 2612 lineto + 1868 2612 lineto + 1868 2308 lineto +closepath 3 1868 2308 1965 2612 Dp +1577 2335 MXY + 1577 2335 lineto + 1674 2335 lineto + 1674 2612 lineto + 1577 2612 lineto + 1577 2335 lineto +closepath 3 1577 2335 1674 2612 Dp +1287 2363 MXY + 1287 2363 lineto + 1384 2363 lineto + 1384 2612 lineto + 1287 2612 lineto + 1287 2363 lineto +closepath 3 1287 2363 1384 2612 Dp +4 Ds +1121 2066 MXY + 1121 2066 lineto + 1218 2066 lineto + 1224 2080 lineto + 1127 2080 lineto + 1121 2066 lineto +closepath 21 1121 2066 1224 2080 Dp +2080 MY + 1121 2080 lineto + 1218 2080 lineto + 1218 2273 lineto + 1121 2273 lineto + 1121 2080 lineto +closepath 14 1121 2080 1218 2273 Dp +2273 MY + 1121 2273 lineto + 1218 2273 lineto + 1218 2612 lineto + 1121 2612 lineto + 1121 2273 lineto +closepath 3 1121 2273 1218 2612 Dp +-1 Ds +997 1589 MXY + 997 1589 lineto + 1093 1589 lineto + 1093 1644 lineto + 997 1644 lineto + 997 1589 lineto +closepath 21 997 1589 1093 1644 Dp +1644 MY + 997 1644 lineto + 1093 1644 lineto + 1093 2280 lineto + 997 2280 lineto + 997 1644 lineto +closepath 14 997 1644 1093 2280 Dp +2280 MY + 997 2280 lineto + 1093 2280 lineto + 1093 2612 lineto + 997 2612 lineto + 997 2280 lineto +closepath 3 997 2280 1093 2612 Dp +10 s +719 2093(s)N +712 2037(d)N +712 1982(n)N +714 1927(o)N +716 1872(c)N +716 1816(e)N +712 1761(S)N +804 2286(10)N +804 1899(20)N +804 1540(30)N +3 Dt +900 1506 MXY +0 1106 Dl +1548 0 Dl +7 s +1978 2828(Elapsed)N +1701 2925(Dynamically)N +2018(grown)X +2184(table)X +2317(\(right\))X +3 Dt +-1 Ds +8 s +720 3180(Figure)N +934(6:)X +1 f +1020(The)X +1152(total)X +1299(regions)X +1520(indicate)X +1755(the)X +1865(difference)X +2154(between)X +2398(the)X +720 3268(elapsed)N +931(time)X +1065(and)X +1177(the)X +1275(sum)X +1402(of)X +1475(the)X +1573(system)X +1771(and)X +1883(user)X +2008(time.)X +2173(The)X +2291(left)X +2395(bar)X +720 3356(of)N +798(each)X +939(set)X +1035(depicts)X +1241(the)X +1344(timing)X +1537(of)X +1615(the)X +1718(test)X +1831(run)X +1940(when)X +2102(the)X +2204(number)X +2423(of)X +720 3444(entries)N +910(is)X +973(known)X +1167(in)X +1237(advance.)X +1496(The)X +1614(right)X +1754(bars)X +1879(depict)X +2054(the)X +2151(timing)X +2338(when)X +720 3532(the)N +814(\256le)X +912(is)X +971(grown)X +1150(from)X +1290(a)X +1334(single)X +1503(bucket.)X +10 s +10 f +720 3708 -0.0930(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)AN +1 f +892 3910(Since)N +1131(this)X +1307(hashing)X +1617(package)X +1942(provides)X +2279(buffer)X +720 3998(management,)N +1188(the)X +1323(amount)X +1600(of)X +1704(space)X +1920(allocated)X +2247(for)X +2378(the)X +720 4086(buffer)N +948(pool)X +1121(may)X +1290(be)X +1397(speci\256ed)X +1713(by)X +1824(the)X +1953(user.)X +2157(Using)X +2378(the)X +720 4174(same)N +910(data)X +1069(set)X +1183(and)X +1324(test)X +1459(procedure)X +1805(as)X +1896(used)X +2067(to)X +2153(derive)X +2378(the)X +720 4262(graphs)N +962(in)X +1052(Figures)X +1320(5a-c,)X +1507(Figure)X +1744(7)X +1812(shows)X +2039(the)X +2164(impact)X +2409(of)X +720 4350(varying)N +997(the)X +1126(size)X +1282(of)X +1380(the)X +1509(buffer)X +1737(pool.)X +1950(The)X +2106(bucket)X +2351(size)X +720 4438(was)N +873(set)X +989(to)X +1078(256)X +1225(bytes)X +1421(and)X +1564(the)X +1689(\256ll)X +1804(factor)X +2019(was)X +2171(set)X +2287(to)X +2376(16.)X +720 4526(The)N +869(buffer)X +1090(pool)X +1256(size)X +1404(was)X +1552(varied)X +1776(from)X +1955(0)X +2018(\(the)X +2166(minimum)X +720 4614(number)N +986(of)X +1074(pages)X +1277(required)X +1565(to)X +1647(be)X +1743(buffered\))X +2063(to)X +2145(1M.)X +2316(With)X +720 4702(1M)N +854(of)X +944(buffer)X +1164(space,)X +1386(the)X +1507(package)X +1794(performed)X +2151(no)X +2253(I/O)X +2382(for)X +720 4790(this)N +871(data)X +1040(set.)X +1204(As)X +1328(Figure)X +1572(7)X +1647(illustrates,)X +2013(increasing)X +2378(the)X +720 4878(buffer)N +944(pool)X +1113(size)X +1265(can)X +1404(have)X +1583(a)X +1646(dramatic)X +1954(affect)X +2165(on)X +2271(result-)X +720 4966(ing)N +842(performance.)X +2 f +8 s +1269 4941(7)N +1 f +16 s +720 5353 MXY +864 0 Dl +2 f +8 s +760 5408(7)N +1 f +9 s +826 5433(Some)N +1024(allocators)X +1338(are)X +1460(extremely)X +1782(inef\256cient)X +2107(at)X +2192(allocating)X +720 5513(memory.)N +1029(If)X +1110(you)X +1251(\256nd)X +1396(that)X +1536(applications)X +1916(are)X +2036(running)X +2292(out)X +2416(of)X +720 5593(memory)N +1005(before)X +1234(you)X +1386(think)X +1578(they)X +1746(should,)X +2000(try)X +2124(varying)X +2388(the)X +720 5673(pagesize)N +986(to)X +1060(get)X +1166(better)X +1348(utilization)X +1658(from)X +1816(the)X +1922(memory)X +2180(allocator.)X +10 s +2830 1975 MXY +0 -28 Dl +28 0 Dl +0 28 Dl +-28 0 Dl +2853 2004 MXY +0 -27 Dl +28 0 Dl +0 27 Dl +-28 0 Dl +2876 2016 MXY +0 -27 Dl +27 0 Dl +0 27 Dl +-27 0 Dl +2922 1998 MXY +0 -27 Dl +27 0 Dl +0 27 Dl +-27 0 Dl +2967 2025 MXY +0 -28 Dl +28 0 Dl +0 28 Dl +-28 0 Dl +3013 2031 MXY +0 -28 Dl +28 0 Dl +0 28 Dl +-28 0 Dl +3059 MX +0 -28 Dl +27 0 Dl +0 28 Dl +-27 0 Dl +3196 2052 MXY +0 -28 Dl +27 0 Dl +0 28 Dl +-27 0 Dl +3561 2102 MXY +0 -28 Dl +28 0 Dl +0 28 Dl +-28 0 Dl +4292 2105 MXY +0 -28 Dl +27 0 Dl +0 28 Dl +-27 0 Dl +4 Ds +1 Dt +2844 1961 MXY +23 30 Dl +23 12 Dl +45 -18 Dl +46 26 Dl +46 6 Dl +45 0 Dl +137 21 Dl +366 50 Dl +730 3 Dl +9 s +4227 2158(User)N +-1 Ds +3 Dt +2830 1211 MXY +27 Dc +2853 1261 MXY +27 Dc +2876 1267 MXY +27 Dc +2921 1341 MXY +27 Dc +2967 1385 MXY +27 Dc +3013 1450 MXY +27 Dc +3059 1497 MXY +27 Dc +3196 1686 MXY +27 Dc +3561 2109 MXY +27 Dc +4292 2295 MXY +27 Dc +20 Ds +1 Dt +2844 1211 MXY +23 50 Dl +23 6 Dl +45 74 Dl +46 44 Dl +46 65 Dl +45 47 Dl +137 189 Dl +366 423 Dl +730 186 Dl +4181 2270(System)N +-1 Ds +3 Dt +2844 583 MXY +0 28 Dl +0 -14 Dl +14 0 Dl +-28 0 Dl +2867 672 MXY +0 27 Dl +0 -14 Dl +14 0 Dl +-28 0 Dl +2890 701 MXY +0 28 Dl +0 -14 Dl +13 0 Dl +-27 0 Dl +2935 819 MXY +0 28 Dl +0 -14 Dl +14 0 Dl +-27 0 Dl +2981 849 MXY +0 28 Dl +0 -14 Dl +14 0 Dl +-28 0 Dl +3027 908 MXY +0 27 Dl +0 -13 Dl +14 0 Dl +-28 0 Dl +3072 1026 MXY +0 27 Dl +0 -13 Dl +14 0 Dl +-27 0 Dl +3209 1292 MXY +0 27 Dl +0 -14 Dl +14 0 Dl +-27 0 Dl +3575 1823 MXY +0 28 Dl +0 -14 Dl +14 0 Dl +-28 0 Dl +4305 2059 MXY +0 28 Dl +0 -14 Dl +14 0 Dl +-27 0 Dl +5 Dt +2844 597 MXY +23 88 Dl +23 30 Dl +45 118 Dl +46 30 Dl +46 59 Dl +45 118 Dl +137 265 Dl +366 532 Dl +730 236 Dl +4328 2103(Total)N +2844 2310 MXY +1461 0 Dl +2844 MX +0 -1772 Dl +2310 MY +0 18 Dl +4 Ds +1 Dt +2310 MY +0 -1772 Dl +2826 2416(0)N +-1 Ds +5 Dt +3209 2310 MXY +0 18 Dl +4 Ds +1 Dt +2310 MY +0 -1772 Dl +3155 2416(256)N +-1 Ds +5 Dt +3575 2310 MXY +0 18 Dl +4 Ds +1 Dt +2310 MY +0 -1772 Dl +3521 2416(512)N +-1 Ds +5 Dt +3940 2310 MXY +0 18 Dl +4 Ds +1 Dt +2310 MY +0 -1772 Dl +3886 2416(768)N +-1 Ds +5 Dt +4305 2310 MXY +0 18 Dl +4 Ds +1 Dt +2310 MY +0 -1772 Dl +4233 2416(1024)N +-1 Ds +5 Dt +2844 2310 MXY +-18 0 Dl +4 Ds +1 Dt +2844 MX +1461 0 Dl +2771 2340(0)N +-1 Ds +5 Dt +2844 2014 MXY +-18 0 Dl +2844 1719 MXY +-18 0 Dl +4 Ds +1 Dt +2844 MX +1461 0 Dl +2735 1749(20)N +-1 Ds +5 Dt +2844 1423 MXY +-18 0 Dl +2844 1128 MXY +-18 0 Dl +4 Ds +1 Dt +2844 MX +1461 0 Dl +2735 1158(40)N +-1 Ds +5 Dt +2844 833 MXY +-18 0 Dl +2844 538 MXY +-18 0 Dl +4 Ds +1 Dt +2844 MX +1461 0 Dl +2735 568(60)N +3239 2529(Buffer)N +3445(Pool)X +3595(Size)X +3737(\(in)X +3835(K\))X +2695 1259(S)N +2699 1324(e)N +2699 1388(c)N +2697 1452(o)N +2697 1517(n)N +2697 1581(d)N +2701 1645(s)N +3 Dt +-1 Ds +3 f +8 s +2706 2773(Figure)N +2908(7:)X +1 f +2982(User)X +3123(time)X +3258(is)X +3322(virtually)X +3560(insensitive)X +3854(to)X +3924(the)X +4022(amount)X +4234(of)X +4307(buffer)X +2706 2861(pool)N +2852(available,)X +3130(however,)X +3396(both)X +3541(system)X +3750(time)X +3895(and)X +4018(elapsed)X +4240(time)X +4385(are)X +2706 2949(inversely)N +2960(proportional)X +3296(to)X +3366(the)X +3464(size)X +3583(of)X +3656(the)X +3753(buffer)X +3927(pool.)X +4092(Even)X +4242(for)X +4335(large)X +2706 3037(data)N +2831(sets)X +2946(where)X +3120(one)X +3230(expects)X +3439(few)X +3552(collisions,)X +3832(specifying)X +4116(a)X +4162(large)X +4307(buffer)X +2706 3125(pool)N +2836(dramatically)X +3171(improves)X +3425(performance.)X +10 s +10 f +2706 3301 -0.0930(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)AN +3 f +3175 3543(Enhanced)N +3536(Functionality)X +1 f +2878 3675(This)N +3046(hashing)X +3320(package)X +3609(provides)X +3910(a)X +3971(set)X +4085(of)X +4177(compati-)X +2706 3763(bility)N +2895(routines)X +3174(to)X +3257(implement)X +3620(the)X +2 f +3739(ndbm)X +1 f +3937(interface.)X +4279(How-)X +2706 3851(ever,)N +2893(when)X +3095(the)X +3220(native)X +3443(interface)X +3752(is)X +3832(used,)X +4026(the)X +4151(following)X +2706 3939(additional)N +3046(functionality)X +3475(is)X +3548(provided:)X +10 f +2798 4071(g)N +1 f +2946(Inserts)X +3197(never)X +3413(fail)X +3556(because)X +3847(too)X +3985(many)X +4199(keys)X +2946 4159(hash)N +3113(to)X +3195(the)X +3313(same)X +3498(value.)X +10 f +2798 4247(g)N +1 f +2946(Inserts)X +3187(never)X +3393(fail)X +3527(because)X +3808(key)X +3950(and/or)X +4181(asso-)X +2946 4335(ciated)N +3158(data)X +3312(is)X +3385(too)X +3507(large)X +10 f +2798 4423(g)N +1 f +2946(Hash)X +3131(functions)X +3449(may)X +3607(be)X +3703(user-speci\256ed.)X +10 f +2798 4511(g)N +1 f +2946(Multiple)X +3268(pages)X +3498(may)X +3683(be)X +3806(cached)X +4077(in)X +4186(main)X +2946 4599(memory.)N +2706 4731(It)N +2801(also)X +2976(provides)X +3298(a)X +3380(set)X +3514(of)X +3626(compatibility)X +4097(routines)X +4400(to)X +2706 4819(implement)N +3087(the)X +2 f +3224(hsearch)X +1 f +3516(interface.)X +3876(Again,)X +4130(the)X +4266(native)X +2706 4907(interface)N +3008(offers)X +3216(enhanced)X +3540(functionality:)X +10 f +2798 5039(g)N +1 f +2946(Files)X +3121(may)X +3279(grow)X +3464(beyond)X +2 f +3720(nelem)X +1 f +3932(elements.)X +10 f +2798 5127(g)N +1 f +2946(Multiple)X +3247(hash)X +3420(tables)X +3632(may)X +3795(be)X +3896(accessed)X +4203(con-)X +2946 5215(currently.)N +10 f +2798 5303(g)N +1 f +2946(Hash)X +3134(tables)X +3344(may)X +3505(be)X +3604(stored)X +3823(and)X +3962(accessed)X +4266(on)X +2946 5391(disk.)N +10 f +2798 5479(g)N +1 f +2946(Hash)X +3155(functions)X +3497(may)X +3679(be)X +3799(user-speci\256ed)X +4288(at)X +2946 5567(runtime.)N +3 f +720 5960(USENIX)N +9 f +1042(-)X +3 f +1106(Winter)X +1371('91)X +9 f +1498(-)X +3 f +1562(Dallas,)X +1815(TX)X +4424(9)X + +10 p +%%Page: 10 10 +0(Courier)xf 0 f +10 s 10 xH 0 xS 0 f +3 f +432 258(A)N +510(New)X +682(Hashing)X +985(Package)X +1290(for)X +1413(UNIX)X +3663(Seltzer)X +3920(&)X +4007(Yigit)X +459 538(Relative)N +760(Performance)X +1227(of)X +1314(the)X +1441(New)X +1613(Implementation)X +1 f +604 670(The)N +761(performance)X +1200(testing)X +1445(of)X +1544(the)X +1674(new)X +1840(package)X +2135(is)X +432 758(divided)N +711(into)X +874(two)X +1033(test)X +1183(suites.)X +1424(The)X +1588(\256rst)X +1751(suite)X +1941(of)X +2046(tests)X +432 846(requires)N +727(that)X +882(the)X +1015(tables)X +1237(be)X +1348(read)X +1522(from)X +1713(and)X +1864(written)X +2126(to)X +432 934(disk.)N +640(In)X +742(these)X +942(tests,)X +1139(the)X +1272(basis)X +1467(for)X +1595(comparison)X +2003(is)X +2090(the)X +432 1022(4.3BSD-Reno)N +908(version)X +1169(of)X +2 f +1260(ndbm)X +1 f +1438(.)X +1502(Based)X +1722(on)X +1826(the)X +1948(designs)X +432 1110(of)N +2 f +521(sdbm)X +1 f +712(and)X +2 f +850(gdbm)X +1 f +1028(,)X +1070(they)X +1230(are)X +1351(expected)X +1659(to)X +1743(perform)X +2024(simi-)X +432 1198(larly)N +605(to)X +2 f +693(ndbm)X +1 f +871(,)X +917(and)X +1059(we)X +1179(do)X +1285(not)X +1413(show)X +1608(their)X +1781(performance)X +432 1286(numbers.)N +800(The)X +977(second)X +1252(suite)X +1454(contains)X +1772(the)X +1921(memory)X +432 1374(resident)N +712(test)X +849(which)X +1071(does)X +1243(not)X +1370(require)X +1623(that)X +1768(the)X +1891(\256les)X +2049(ever)X +432 1462(be)N +533(written)X +784(to)X +870(disk,)X +1047(only)X +1213(that)X +1357(hash)X +1528(tables)X +1739(may)X +1901(be)X +2001(mani-)X +432 1550(pulated)N +692(in)X +778(main)X +961(memory.)X +1291(In)X +1381(this)X +1519(test,)X +1673(we)X +1790(compare)X +2090(the)X +432 1638(performance)N +859(to)X +941(that)X +1081(of)X +1168(the)X +2 f +1286(hsearch)X +1 f +1560(routines.)X +604 1752(For)N +760(both)X +947(suites,)X +1194(two)X +1358(different)X +1679(databases)X +2031(were)X +432 1840(used.)N +656(The)X +818(\256rst)X +979(is)X +1069(the)X +1204(dictionary)X +1566(database)X +1880(described)X +432 1928(previously.)N +836(The)X +987(second)X +1236(was)X +1386(constructed)X +1781(from)X +1962(a)X +2023(pass-)X +432 2016(word)N +647(\256le)X +799(with)X +990(approximately)X +1502(300)X +1671(accounts.)X +2041(Two)X +432 2104(records)N +700(were)X +887(constructed)X +1287(for)X +1411(each)X +1589(account.)X +1909(The)X +2064(\256rst)X +432 2192(used)N +604(the)X +727(logname)X +1028(as)X +1120(the)X +1243(key)X +1384(and)X +1525(the)X +1648(remainder)X +1999(of)X +2090(the)X +432 2280(password)N +768(entry)X +965(for)X +1091(the)X +1221(data.)X +1427(The)X +1584(second)X +1839(was)X +1996(keyed)X +432 2368(by)N +541(uid)X +672(and)X +817(contained)X +1157(the)X +1283(entire)X +1494(password)X +1825(entry)X +2018(as)X +2113(its)X +432 2456(data)N +589(\256eld.)X +794(The)X +942(tests)X +1107(were)X +1287(all)X +1389(run)X +1518(on)X +1620(the)X +1740(HP)X +1864(9000)X +2046(with)X +432 2544(the)N +574(same)X +783(con\256guration)X +1254(previously)X +1636(described.)X +2027(Each)X +432 2632(test)N +576(was)X +734(run)X +874(\256ve)X +1027(times)X +1232(and)X +1380(the)X +1510(timing)X +1750(results)X +1991(of)X +2090(the)X +432 2720(runs)N +602(were)X +791(averaged.)X +1154(The)X +1311(variance)X +1616(across)X +1849(the)X +1979(5)X +2050(runs)X +432 2808(was)N +591(approximately)X +1088(1%)X +1229(of)X +1330(the)X +1462(average)X +1746(yielding)X +2041(95%)X +432 2896(con\256dence)N +800(intervals)X +1096(of)X +1183(approximately)X +1666(2%.)X +3 f +1021 3050(Disk)N +1196(Based)X +1420(Tests)X +1 f +604 3182(In)N +693(these)X +880(tests,)X +1064(we)X +1180(use)X +1308(a)X +1365(bucket)X +1600(size)X +1746(of)X +1834(1024)X +2015(and)X +2152(a)X +432 3270(\256ll)N +540(factor)X +748(of)X +835(32.)X +3 f +432 3384(create)N +663(test)X +1 f +547 3498(The)N +703(keys)X +881(are)X +1011(entered)X +1279(into)X +1433(the)X +1561(hash)X +1738(table,)X +1944(and)X +2090(the)X +547 3586(\256le)N +669(is)X +742(\257ushed)X +993(to)X +1075(disk.)X +3 f +432 3700(read)N +608(test)X +1 f +547 3814(A)N +640(lookup)X +897(is)X +984(performed)X +1353(for)X +1481(each)X +1663(key)X +1813(in)X +1909(the)X +2041(hash)X +547 3902(table.)N +3 f +432 4016(verify)N +653(test)X +1 f +547 4130(A)N +640(lookup)X +897(is)X +984(performed)X +1353(for)X +1481(each)X +1663(key)X +1813(in)X +1909(the)X +2041(hash)X +547 4218(table,)N +759(and)X +911(the)X +1045(data)X +1215(returned)X +1519(is)X +1608(compared)X +1961(against)X +547 4306(that)N +687(originally)X +1018(stored)X +1234(in)X +1316(the)X +1434(hash)X +1601(table.)X +3 f +432 4420(sequential)N +798(retrieve)X +1 f +547 4534(All)N +674(keys)X +846(are)X +970(retrieved)X +1281(in)X +1367(sequential)X +1716(order)X +1910(from)X +2090(the)X +547 4622(hash)N +724(table.)X +950(The)X +2 f +1105(ndbm)X +1 f +1313(interface)X +1625(allows)X +1863(sequential)X +547 4710(retrieval)N +848(of)X +948(the)X +1079(keys)X +1259(from)X +1448(the)X +1578(database,)X +1907(but)X +2041(does)X +547 4798(not)N +701(return)X +945(the)X +1094(data)X +1279(associated)X +1660(with)X +1853(each)X +2052(key.)X +547 4886(Therefore,)N +929(we)X +1067(compare)X +1388(the)X +1530(performance)X +1980(of)X +2090(the)X +547 4974(new)N +703(package)X +989(to)X +1073(two)X +1215(different)X +1514(runs)X +1674(of)X +2 f +1763(ndbm)X +1 f +1941(.)X +2002(In)X +2090(the)X +547 5062(\256rst)N +697(case,)X +2 f +882(ndbm)X +1 f +1086(returns)X +1335(only)X +1503(the)X +1627(keys)X +1800(while)X +2003(in)X +2090(the)X +547 5150(second,)N +2 f +823(ndbm)X +1 f +1034(returns)X +1290(both)X +1465(the)X +1596(keys)X +1776(and)X +1924(the)X +2054(data)X +547 5238(\(requiring)N +894(a)X +956(second)X +1204(call)X +1345(to)X +1432(the)X +1555(library\).)X +1861(There)X +2074(is)X +2152(a)X +547 5326(single)N +764(run)X +897(for)X +1017(the)X +1141(new)X +1300(library)X +1539(since)X +1729(it)X +1798(returns)X +2046(both)X +547 5414(the)N +665(key)X +801(and)X +937(the)X +1055(data.)X +3 f +3014 538(In-Memory)N +3431(Test)X +1 f +2590 670(This)N +2757(test)X +2892(uses)X +3054(a)X +3114(bucket)X +3352(size)X +3501(of)X +3592(256)X +3736(and)X +3876(a)X +3936(\256ll)X +4048(fac-)X +2418 758(tor)N +2527(of)X +2614(8.)X +3 f +2418 872(create/read)N +2827(test)X +1 f +2533 986(In)N +2627(this)X +2769(test,)X +2927(a)X +2989(hash)X +3162(table)X +3344(is)X +3423(created)X +3682(by)X +3788(inserting)X +4094(all)X +2533 1074(the)N +2660(key/data)X +2961(pairs.)X +3186(Then)X +3380(a)X +3445(keyed)X +3666(retrieval)X +3963(is)X +4044(per-)X +2533 1162(formed)N +2801(for)X +2931(each)X +3115(pair,)X +3295(and)X +3446(the)X +3579(hash)X +3761(table)X +3952(is)X +4040(des-)X +2533 1250(troyed.)N +3 f +2938 1404(Performance)N +3405(Results)X +1 f +2590 1536(Figures)N +2866(8a)X +2978(and)X +3130(8b)X +3246(show)X +3451(the)X +3585(user)X +3755(time,)X +3952(system)X +2418 1624(time,)N +2608(and)X +2752(elapsed)X +3021(time)X +3191(for)X +3312(each)X +3487(test)X +3625(for)X +3746(both)X +3915(the)X +4040(new)X +2418 1712(implementation)N +2951(and)X +3098(the)X +3227(old)X +3360(implementation)X +3893(\()X +2 f +3920(hsearch)X +1 f +2418 1800(or)N +2 f +2528(ndbm)X +1 f +2706(,)X +2769(whichever)X +3147(is)X +3243(appropriate\))X +3678(as)X +3787(well)X +3967(as)X +4076(the)X +2418 1888(improvement.)N +2929(The)X +3098(improvement)X +3569(is)X +3666(expressed)X +4027(as)X +4138(a)X +2418 1976(percentage)N +2787(of)X +2874(the)X +2992(old)X +3114(running)X +3383(time:)X +0 f +8 s +2418 2275(%)N +2494(=)X +2570(100)X +2722(*)X +2798 -0.4219(\(old_time)AX +3178(-)X +3254 -0.4219(new_time\))AX +3634(/)X +3710(old_time)X +1 f +10 s +2590 2600(In)N +2700(nearly)X +2944(all)X +3067(cases,)X +3299(the)X +3439(new)X +3615(routines)X +3915(perform)X +2418 2688(better)N +2628(than)X +2793(the)X +2918(old)X +3047(routines)X +3332(\(both)X +2 f +3527(hsearch)X +1 f +3807(and)X +2 f +3949(ndbm)X +1 f +4127(\).)X +2418 2776(Although)N +2755(the)X +3 f +2888(create)X +1 f +3134(tests)X +3311(exhibit)X +3567(superior)X +3864(user)X +4032(time)X +2418 2864(performance,)N +2869(the)X +2991(test)X +3126(time)X +3292(is)X +3369(dominated)X +3731(by)X +3834(the)X +3955(cost)X +4107(of)X +2418 2952(writing)N +2677(the)X +2803(actual)X +3023(\256le)X +3153(to)X +3243(disk.)X +3444(For)X +3583(the)X +3709(large)X +3897(database)X +2418 3040(\(the)N +2564(dictionary\),)X +2957(this)X +3093(completely)X +3470(overwhelmed)X +3927(the)X +4045(sys-)X +2418 3128(tem)N +2570(time.)X +2783(However,)X +3129(for)X +3254(the)X +3383(small)X +3587(data)X +3752(base,)X +3946(we)X +4071(see)X +2418 3216(that)N +2569(differences)X +2958(in)X +3051(both)X +3224(user)X +3389(and)X +3536(system)X +3788(time)X +3960(contri-)X +2418 3304(bute)N +2576(to)X +2658(the)X +2776(superior)X +3059(performance)X +3486(of)X +3573(the)X +3691(new)X +3845(package.)X +2590 3418(The)N +3 f +2764(read)X +1 f +2920(,)X +3 f +2989(verify)X +1 f +3190(,)X +3259(and)X +3 f +3424(sequential)X +1 f +3818(results)X +4075(are)X +2418 3506(deceptive)N +2758(for)X +2883(the)X +3012(small)X +3216(database)X +3524(since)X +3720(the)X +3849(entire)X +4063(test)X +2418 3594(ran)N +2551(in)X +2643(under)X +2856(a)X +2922(second.)X +3215(However,)X +3560(on)X +3669(the)X +3796(larger)X +4013(data-)X +2418 3682(base)N +2590(the)X +3 f +2716(read)X +1 f +2900(and)X +3 f +3044(verify)X +1 f +3273(tests)X +3443(bene\256t)X +3689(from)X +3873(the)X +3999(cach-)X +2418 3770(ing)N +2546(of)X +2639(buckets)X +2910(in)X +2998(the)X +3122(new)X +3282(package)X +3571(to)X +3658(improve)X +3950(perfor-)X +2418 3858(mance)N +2666(by)X +2784(over)X +2965(80%.)X +3169(Since)X +3384(the)X +3519(\256rst)X +3 f +3680(sequential)X +1 f +4063(test)X +2418 3946(does)N +2598(not)X +2733(require)X +2 f +2994(ndbm)X +1 f +3205(to)X +3299(return)X +3523(the)X +3653(data)X +3819(values,)X +4076(the)X +2418 4034(user)N +2573(time)X +2735(is)X +2808(lower)X +3011(than)X +3169(for)X +3283(the)X +3401(new)X +3555(package.)X +3879(However)X +2418 4122(when)N +2613(we)X +2728(require)X +2977(both)X +3139(packages)X +3454(to)X +3536(return)X +3748(data,)X +3922(the)X +4040(new)X +2418 4210(package)N +2702(excels)X +2923(in)X +3005(all)X +3105(three)X +3286(timings.)X +2590 4324(The)N +2773(small)X +3003(database)X +3337(runs)X +3532(so)X +3660(quickly)X +3957(in)X +4076(the)X +2418 4412(memory-resident)N +3000(case)X +3173(that)X +3326(the)X +3457(results)X +3699(are)X +3831(uninterest-)X +2418 4500(ing.)N +2589(However,)X +2933(for)X +3056(the)X +3183(larger)X +3400(database)X +3706(the)X +3833(new)X +3995(pack-)X +2418 4588(age)N +2567(pays)X +2751(a)X +2824(small)X +3033(penalty)X +3305(in)X +3403(system)X +3661(time)X +3839(because)X +4130(it)X +2418 4676(limits)N +2636(its)X +2748(main)X +2944(memory)X +3247(utilization)X +3607(and)X +3759(swaps)X +3991(pages)X +2418 4764(out)N +2550(to)X +2642(temporary)X +3002(storage)X +3264(in)X +3356(the)X +3484(\256le)X +3616(system)X +3868(while)X +4076(the)X +2 f +2418 4852(hsearch)N +1 f +2698(package)X +2988(requires)X +3273(that)X +3419(the)X +3543(application)X +3924(allocate)X +2418 4940(enough)N +2692(space)X +2909(for)X +3041(all)X +3159(key/data)X +3468(pair.)X +3670(However,)X +4022(even)X +2418 5028(with)N +2600(the)X +2738(system)X +3000(time)X +3182(penalty,)X +3477(the)X +3614(resulting)X +3933(elapsed)X +2418 5116(time)N +2580(improves)X +2898(by)X +2998(over)X +3161(50%.)X +3 f +432 5960(10)N +2970(USENIX)X +9 f +3292(-)X +3 f +3356(Winter)X +3621('91)X +9 f +3748(-)X +3 f +3812(Dallas,)X +4065(TX)X + +11 p +%%Page: 11 11 +0(Courier)xf 0 f +10 s 10 xH 0 xS 0 f +3 f +720 258(Seltzer)N +977(&)X +1064(Yigit)X +3278(A)X +3356(New)X +3528(Hashing)X +3831(Package)X +4136(for)X +4259(UNIX)X +1 f +10 f +908 454(i)N +927(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +2 f +1379 546(hash)N +1652(ndbm)X +1950(%change)X +1 f +10 f +908 550(i)N +927(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +948 642(CREATE)N +10 f +908 646(i)N +927(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +1125 738(user)N +1424(6.4)X +1671(12.2)X +2073(48)X +1157 826(sys)N +1384(32.5)X +1671(34.7)X +2113(6)X +3 f +1006 914(elapsed)N +10 f +1310 922(c)N +890(c)Y +810(c)Y +730(c)Y +3 f +1384 914(90.4)N +10 f +1581 922(c)N +890(c)Y +810(c)Y +730(c)Y +3 f +1671 914(99.6)N +10 f +1883 922(c)N +890(c)Y +810(c)Y +730(c)Y +3 f +2113 914(9)N +1 f +10 f +908 910(i)N +927(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +908 926(i)N +927(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +948 1010(READ)N +10 f +908 1014(i)N +927(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +1125 1106(user)N +1424(3.4)X +1711(6.1)X +2073(44)X +1157 1194(sys)N +1424(1.2)X +1671(15.3)X +2073(92)X +3 f +1006 1282(elapsed)N +10 f +1310 1290(c)N +1258(c)Y +1178(c)Y +1098(c)Y +3 f +1424 1282(4.0)N +10 f +1581 1290(c)N +1258(c)Y +1178(c)Y +1098(c)Y +3 f +1671 1282(21.2)N +10 f +1883 1290(c)N +1258(c)Y +1178(c)Y +1098(c)Y +3 f +2073 1282(81)N +1 f +10 f +908 1278(i)N +927(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +908 1294(i)N +927(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +948 1378(VERIFY)N +10 f +908 1382(i)N +927(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +1125 1474(user)N +1424(3.5)X +1711(6.3)X +2073(44)X +1157 1562(sys)N +1424(1.2)X +1671(15.3)X +2073(92)X +3 f +1006 1650(elapsed)N +10 f +1310 1658(c)N +1626(c)Y +1546(c)Y +1466(c)Y +3 f +1424 1650(4.0)N +10 f +1581 1658(c)N +1626(c)Y +1546(c)Y +1466(c)Y +3 f +1671 1650(21.2)N +10 f +1883 1658(c)N +1626(c)Y +1546(c)Y +1466(c)Y +3 f +2073 1650(81)N +1 f +10 f +908 1646(i)N +927(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +908 1662(i)N +927(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +948 1746(SEQUENTIAL)N +10 f +908 1750(i)N +927(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +1125 1842(user)N +1424(2.7)X +1711(1.9)X +2046(-42)X +1157 1930(sys)N +1424(0.7)X +1711(3.9)X +2073(82)X +3 f +1006 2018(elapsed)N +10 f +1310 2026(c)N +1994(c)Y +1914(c)Y +1834(c)Y +3 f +1424 2018(3.0)N +10 f +1581 2026(c)N +1994(c)Y +1914(c)Y +1834(c)Y +3 f +1711 2018(5.0)N +10 f +1883 2026(c)N +1994(c)Y +1914(c)Y +1834(c)Y +3 f +2073 2018(40)N +1 f +10 f +908 2014(i)N +927(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +908 2030(i)N +927(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +948 2114(SEQUENTIAL)N +1467(\(with)X +1656(data)X +1810(retrieval\))X +10 f +908 2118(i)N +927(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +1125 2210(user)N +1424(2.7)X +1711(8.2)X +2073(67)X +1157 2298(sys)N +1424(0.7)X +1711(4.3)X +2073(84)X +3 f +1006 2386(elapsed)N +1424(3.0)X +1671(12.0)X +2073(75)X +1 f +10 f +908 2390(i)N +927(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +899 2394(c)N +2378(c)Y +2298(c)Y +2218(c)Y +2138(c)Y +2058(c)Y +1978(c)Y +1898(c)Y +1818(c)Y +1738(c)Y +1658(c)Y +1578(c)Y +1498(c)Y +1418(c)Y +1338(c)Y +1258(c)Y +1178(c)Y +1098(c)Y +1018(c)Y +938(c)Y +858(c)Y +778(c)Y +698(c)Y +618(c)Y +538(c)Y +1310 2394(c)N +2362(c)Y +2282(c)Y +2202(c)Y +1581 2394(c)N +2362(c)Y +2282(c)Y +2202(c)Y +1883 2394(c)N +2362(c)Y +2282(c)Y +2202(c)Y +2278 2394(c)N +2378(c)Y +2298(c)Y +2218(c)Y +2138(c)Y +2058(c)Y +1978(c)Y +1898(c)Y +1818(c)Y +1738(c)Y +1658(c)Y +1578(c)Y +1498(c)Y +1418(c)Y +1338(c)Y +1258(c)Y +1178(c)Y +1098(c)Y +1018(c)Y +938(c)Y +858(c)Y +778(c)Y +698(c)Y +618(c)Y +538(c)Y +905 2574(i)N +930(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +2 f +1318 2666(hash)N +1585(hsearch)X +1953(%change)X +1 f +10 f +905 2670(i)N +930(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +945 2762(CREATE/READ)N +10 f +905 2766(i)N +930(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +1064 2858(user)N +1343(6.6)X +1642(17.2)X +2096(62)X +1096 2946(sys)N +1343(1.1)X +1682(0.3)X +2029(-266)X +3 f +945 3034(elapsed)N +1343(7.8)X +1642(17.0)X +2096(54)X +1 f +10 f +905 3038(i)N +930(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +896 3050(c)N +2978(c)Y +2898(c)Y +2818(c)Y +2738(c)Y +2658(c)Y +1249 3034(c)N +3010(c)Y +2930(c)Y +2850(c)Y +1520 3034(c)N +3010(c)Y +2930(c)Y +2850(c)Y +1886 3034(c)N +3010(c)Y +2930(c)Y +2850(c)Y +2281 3050(c)N +2978(c)Y +2898(c)Y +2818(c)Y +2738(c)Y +2658(c)Y +3 f +720 3174(Figure)N +967(8a:)X +1 f +1094(Timing)X +1349(results)X +1578(for)X +1692(the)X +1810(dictionary)X +2155(database.)X +10 f +720 3262 -0.0930(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)AN +3 f +1407 3504(Conclusion)N +1 f +892 3636(This)N +1063(paper)X +1271(has)X +1407(presented)X +1744(the)X +1871(design,)X +2129(implemen-)X +720 3724(tation)N +928(and)X +1070(performance)X +1503(of)X +1596(a)X +1658(new)X +1818(hashing)X +2093(package)X +2382(for)X +720 3812(UNIX.)N +993(The)X +1150(new)X +1316(package)X +1612(provides)X +1919(a)X +1986(superset)X +2280(of)X +2378(the)X +720 3900(functionality)N +1159(of)X +1255(existing)X +1537(hashing)X +1815(packages)X +2139(and)X +2284(incor-)X +720 3988(porates)N +975(additional)X +1318(features)X +1596(such)X +1766(as)X +1855(large)X +2038(key)X +2176(handling,)X +720 4076(user)N +876(de\256ned)X +1134(hash)X +1302(functions,)X +1641(multiple)X +1928(hash)X +2096(tables,)X +2324(vari-)X +720 4164(able)N +894(sized)X +1099(pages,)X +1342(and)X +1498(linear)X +1721(hashing.)X +2050(In)X +2156(nearly)X +2396(all)X +720 4252(cases,)N +954(the)X +1096(new)X +1274(package)X +1582(provides)X +1902(improved)X +2252(perfor-)X +720 4340(mance)N +974(on)X +1098(the)X +1240(order)X +1454(of)X +1565(50-80%)X +1863(for)X +2001(the)X +2142(workloads)X +720 4428(shown.)N +990(Applications)X +1420(such)X +1588(as)X +1676(the)X +1794(loader,)X +2035(compiler,)X +2360(and)X +720 4516(mail,)N +921(which)X +1156(currently)X +1485(implement)X +1866(their)X +2051(own)X +2227(hashing)X +720 4604(routines,)N +1032(should)X +1279(be)X +1389(modi\256ed)X +1706(to)X +1801(use)X +1941(the)X +2072(generic)X +2342(rou-)X +720 4692(tines.)N +892 4806(This)N +1087(hashing)X +1389(package)X +1705(is)X +1810(one)X +1978(access)X +2236(method)X +720 4894(which)N +953(is)X +1043(part)X +1205(of)X +1309(a)X +1382(generic)X +1656(database)X +1970(access)X +2212(package)X +720 4982(being)N +955(developed)X +1342(at)X +1457(the)X +1612(University)X +2007(of)X +2131(California,)X +720 5070(Berkeley.)N +1089(It)X +1177(will)X +1340(include)X +1614(a)X +1688(btree)X +1887(access)X +2131(method)X +2409(as)X +720 5158(well)N +916(as)X +1041(\256xed)X +1259(and)X +1433(variable)X +1750(length)X +2007(record)X +2270(access)X +720 5246(methods)N +1024(in)X +1119(addition)X +1414(to)X +1509(the)X +1640(hashed)X +1896(support)X +2168(presented)X +720 5334(here.)N +948(All)X +1099(of)X +1215(the)X +1361(access)X +1615(methods)X +1934(are)X +2081(based)X +2312(on)X +2440(a)X +720 5422(key/data)N +1037(pair)X +1207(interface)X +1533(and)X +1693(appear)X +1952(identical)X +2272(to)X +2378(the)X +720 5510(application)N +1121(layer,)X +1347(allowing)X +1671(application)X +2071(implementa-)X +720 5598(tions)N +906(to)X +999(be)X +1106(largely)X +1360(independent)X +1783(of)X +1881(the)X +2010(database)X +2318(type.)X +720 5686(The)N +873(package)X +1165(is)X +1246(expected)X +1560(to)X +1650(be)X +1754(an)X +1858(integral)X +2131(part)X +2284(of)X +2378(the)X +2706 538(4.4BSD)N +3006(system,)X +3293(with)X +3479(various)X +3759(standard)X +4075(applications)X +2706 626(such)N +2879(as)X +2972(more\(1\),)X +3277(sort\(1\))X +3517(and)X +3659(vi\(1\))X +3841(based)X +4050(on)X +4156(it.)X +4266(While)X +2706 714(the)N +2833(current)X +3089(design)X +3326(does)X +3501(not)X +3631(support)X +3899(multi-user)X +4256(access)X +2706 802(or)N +2804(transactions,)X +3238(they)X +3407(could)X +3616(be)X +3723(incorporated)X +4159(relatively)X +2706 890(easily.)N +10 f +2894 938(i)N +2913(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +2 f +3365 1030(hash)N +3638(ndbm)X +3936(%change)X +1 f +10 f +2894 1034(i)N +2913(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +2934 1126(CREATE)N +10 f +2894 1130(i)N +2913(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +3111 1222(user)N +3390(0.2)X +3677(0.4)X +4079(50)X +3143 1310(sys)N +3390(0.1)X +3677(1.0)X +4079(90)X +3 f +2992 1398(elapsed)N +10 f +3296 1406(c)N +1374(c)Y +1294(c)Y +1214(c)Y +3 f +3390 1398(0)N +10 f +3567 1406(c)N +1374(c)Y +1294(c)Y +1214(c)Y +3 f +3677 1398(3.2)N +10 f +3869 1406(c)N +1374(c)Y +1294(c)Y +1214(c)Y +3 f +4039 1398(100)N +1 f +10 f +2894 1394(i)N +2913(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +2894 1410(i)N +2913(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +2934 1494(READ)N +10 f +2894 1498(i)N +2913(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +3111 1590(user)N +3390(0.1)X +3677(0.1)X +4119(0)X +3143 1678(sys)N +3390(0.1)X +3677(0.4)X +4079(75)X +3 f +2992 1766(elapsed)N +10 f +3296 1774(c)N +1742(c)Y +1662(c)Y +1582(c)Y +3 f +3390 1766(0.0)N +10 f +3567 1774(c)N +1742(c)Y +1662(c)Y +1582(c)Y +3 f +3677 1766(0.0)N +10 f +3869 1774(c)N +1742(c)Y +1662(c)Y +1582(c)Y +3 f +4119 1766(0)N +1 f +10 f +2894 1762(i)N +2913(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +2894 1778(i)N +2913(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +2934 1862(VERIFY)N +10 f +2894 1866(i)N +2913(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +3111 1958(user)N +3390(0.1)X +3677(0.2)X +4079(50)X +3143 2046(sys)N +3390(0.1)X +3677(0.3)X +4079(67)X +3 f +2992 2134(elapsed)N +10 f +3296 2142(c)N +2110(c)Y +2030(c)Y +1950(c)Y +3 f +3390 2134(0.0)N +10 f +3567 2142(c)N +2110(c)Y +2030(c)Y +1950(c)Y +3 f +3677 2134(0.0)N +10 f +3869 2142(c)N +2110(c)Y +2030(c)Y +1950(c)Y +3 f +4119 2134(0)N +1 f +10 f +2894 2130(i)N +2913(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +2894 2146(i)N +2913(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +2934 2230(SEQUENTIAL)N +10 f +2894 2234(i)N +2913(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +3111 2326(user)N +3390(0.1)X +3677(0.0)X +4012(-100)X +3143 2414(sys)N +3390(0.1)X +3677(0.1)X +4119(0)X +3 f +2992 2502(elapsed)N +10 f +3296 2510(c)N +2478(c)Y +2398(c)Y +2318(c)Y +3 f +3390 2502(0.0)N +10 f +3567 2510(c)N +2478(c)Y +2398(c)Y +2318(c)Y +3 f +3677 2502(0.0)N +10 f +3869 2510(c)N +2478(c)Y +2398(c)Y +2318(c)Y +3 f +4119 2502(0)N +1 f +10 f +2894 2498(i)N +2913(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +2894 2514(i)N +2913(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +2934 2598(SEQUENTIAL)N +3453(\(with)X +3642(data)X +3796(retrieval\))X +10 f +2894 2602(i)N +2913(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +3111 2694(user)N +3390(0.1)X +3677(0.1)X +4119(0)X +3143 2782(sys)N +3390(0.1)X +3677(0.1)X +4119(0)X +3 f +2992 2870(elapsed)N +3390(0.0)X +3677(0.0)X +4119(0)X +1 f +10 f +2894 2874(i)N +2913(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +2885 2878(c)N +2862(c)Y +2782(c)Y +2702(c)Y +2622(c)Y +2542(c)Y +2462(c)Y +2382(c)Y +2302(c)Y +2222(c)Y +2142(c)Y +2062(c)Y +1982(c)Y +1902(c)Y +1822(c)Y +1742(c)Y +1662(c)Y +1582(c)Y +1502(c)Y +1422(c)Y +1342(c)Y +1262(c)Y +1182(c)Y +1102(c)Y +1022(c)Y +3296 2878(c)N +2846(c)Y +2766(c)Y +2686(c)Y +3567 2878(c)N +2846(c)Y +2766(c)Y +2686(c)Y +3869 2878(c)N +2846(c)Y +2766(c)Y +2686(c)Y +4264 2878(c)N +2862(c)Y +2782(c)Y +2702(c)Y +2622(c)Y +2542(c)Y +2462(c)Y +2382(c)Y +2302(c)Y +2222(c)Y +2142(c)Y +2062(c)Y +1982(c)Y +1902(c)Y +1822(c)Y +1742(c)Y +1662(c)Y +1582(c)Y +1502(c)Y +1422(c)Y +1342(c)Y +1262(c)Y +1182(c)Y +1102(c)Y +1022(c)Y +2891 3058(i)N +2916(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +2 f +3304 3150(hash)N +3571(hsearch)X +3939(%change)X +1 f +10 f +2891 3154(i)N +2916(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +2931 3246(CREATE/READ)N +10 f +2891 3250(i)N +2916(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +3050 3342(user)N +3329(0.3)X +3648(0.4)X +4048(25)X +3082 3430(sys)N +3329(0.0)X +3648(0.0)X +4088(0)X +3 f +2931 3518(elapsed)N +3329(0.0)X +3648(0.0)X +4088(0)X +1 f +10 f +2891 3522(i)N +2916(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +2882 3534(c)N +3462(c)Y +3382(c)Y +3302(c)Y +3222(c)Y +3142(c)Y +3235 3518(c)N +3494(c)Y +3414(c)Y +3334(c)Y +3506 3518(c)N +3494(c)Y +3414(c)Y +3334(c)Y +3872 3518(c)N +3494(c)Y +3414(c)Y +3334(c)Y +4267 3534(c)N +3462(c)Y +3382(c)Y +3302(c)Y +3222(c)Y +3142(c)Y +3 f +2706 3658(Figure)N +2953(8b:)X +1 f +3084(Timing)X +3339(results)X +3568(for)X +3682(the)X +3800(password)X +4123(database.)X +10 f +2706 3746 -0.0930(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)AN +3 f +3396 3988(References)N +1 f +2706 4120([ATT79])N +3058(AT&T,)X +3358(DBM\(3X\),)X +2 f +3773(Unix)X +3990(Programmer's)X +2878 4208(Manual,)N +3194(Seventh)X +3491(Edition,)X +3793(Volume)X +4085(1)X +1 f +(,)S +4192(January,)X +2878 4296(1979.)N +2706 4472([ATT85])N +3027(AT&T,)X +3296(HSEARCH\(BA_LIB\),)X +2 f +4053(Unix)X +4239(System)X +2878 4560(User's)N +3112(Manual,)X +3401(System)X +3644(V.3)X +1 f +3753(,)X +3793(pp.)X +3913(506-508,)X +4220(1985.)X +2706 4736([BRE73])N +3025(Brent,)X +3253(Richard)X +3537(P.,)X +3651(``Reducing)X +4041(the)X +4168(Retrieval)X +2878 4824(Time)N +3071(of)X +3162(Scatter)X +3409(Storage)X +3678(Techniques'',)X +2 f +4146(Commun-)X +2878 4912(ications)N +3175(of)X +3281(the)X +3422(ACM)X +1 f +3591(,)X +3654(Volume)X +3955(16,)X +4098(No.)X +4259(2,)X +4362(pp.)X +2878 5000(105-109,)N +3185(February,)X +3515(1973.)X +2706 5176([BSD86])N +3055(NDBM\(3\),)X +2 f +3469(4.3BSD)X +3775(Unix)X +3990(Programmer's)X +2878 5264(Manual)N +3155(Reference)X +3505(Guide)X +1 f +3701(,)X +3749(University)X +4114(of)X +4208(Califor-)X +2878 5352(nia,)N +3016(Berkeley,)X +3346(1986.)X +2706 5528([ENB88])N +3025(Enbody,)X +3319(R.)X +3417(J.,)X +3533(Du,)X +3676(H.)X +3779(C.,)X +3897(``Dynamic)X +4270(Hash-)X +2878 5616(ing)N +3034(Schemes'',)X +2 f +3427(ACM)X +3630(Computing)X +4019(Surveys)X +1 f +4269(,)X +4322(Vol.)X +2878 5704(20,)N +2998(No.)X +3136(2,)X +3216(pp.)X +3336(85-113,)X +3603(June)X +3770(1988.)X +3 f +720 5960(USENIX)N +9 f +1042(-)X +3 f +1106(Winter)X +1371('91)X +9 f +1498(-)X +3 f +1562(Dallas,)X +1815(TX)X +4384(11)X + +12 p +%%Page: 12 12 +0(Courier)xf 0 f +10 s 10 xH 0 xS 0 f +3 f +432 258(A)N +510(New)X +682(Hashing)X +985(Package)X +1290(for)X +1413(UNIX)X +3663(Seltzer)X +3920(&)X +4007(Yigit)X +1 f +432 538([FAG79])N +776(Ronald)X +1057(Fagin,)X +1308(Jurg)X +1495(Nievergelt,)X +1903(Nicholas)X +604 626(Pippenger,)N +1003(H.)X +1135(Raymond)X +1500(Strong,)X +1787(``Extendible)X +604 714(Hashing)N +901(--)X +985(A)X +1073(Fast)X +1236(Access)X +1493(Method)X +1771(for)X +1894(Dynamic)X +604 802(Files'',)N +2 f +855(ACM)X +1046(Transactions)X +1485(on)X +1586(Database)X +1914(Systems)X +1 f +2168(,)X +604 890(Volume)N +882(4,)X +962(No.)X +1100(3.,)X +1200(September)X +1563(1979,)X +1763(pp)X +1863(315-34)X +432 1066([KNU68],)N +802(Knuth,)X +1064(D.E.,)X +2 f +1273(The)X +1434(Art)X +1577(of)X +1680(Computer)X +2041(Pro-)X +604 1154(gramming)N +971(Vol.)X +1140(3:)X +1245(Sorting)X +1518(and)X +1676(Searching)X +1 f +2001(,)X +2058(sec-)X +604 1242(tions)N +779(6.3-6.4,)X +1046(pp)X +1146(481-550.)X +432 1418([LAR78])N +747(Larson,)X +1011(Per-Ake,)X +1319(``Dynamic)X +1687(Hashing'',)X +2 f +2048(BIT)X +1 f +(,)S +604 1506(Vol.)N +764(18,)X +884(1978,)X +1084(pp.)X +1204(184-201.)X +432 1682([LAR88])N +752(Larson,)X +1021(Per-Ake,)X +1335(``Dynamic)X +1709(Hash)X +1900(Tables'',)X +2 f +604 1770(Communications)N +1183(of)X +1281(the)X +1415(ACM)X +1 f +1584(,)X +1640(Volume)X +1934(31,)X +2070(No.)X +604 1858(4.,)N +704(April)X +893(1988,)X +1093(pp)X +1193(446-457.)X +432 2034([LIT80])N +731(Witold,)X +1013(Litwin,)X +1286(``Linear)X +1590(Hashing:)X +1939(A)X +2036(New)X +604 2122(Tool)N +786(for)X +911(File)X +1065(and)X +1211(Table)X +1424(Addressing'',)X +2 f +1893(Proceed-)X +604 2210(ings)N +761(of)X +847(the)X +969(6th)X +1095(International)X +1540(Conference)X +1933(on)X +2036(Very)X +604 2298(Large)N +815(Databases)X +1 f +1153(,)X +1193(1980.)X +432 2474([NEL90])N +743(Nelson,)X +1011(Philip)X +1222(A.,)X +2 f +1341(Gdbm)X +1558(1.4)X +1679(source)X +1913(distribu-)X +604 2562(tion)N +748(and)X +888(README)X +1 f +1209(,)X +1249(August)X +1500(1990.)X +432 2738([THOM90])N +840(Ken)X +1011(Thompson,)X +1410(private)X +1670(communication,)X +604 2826(Nov.)N +782(1990.)X +432 3002([TOR87])N +790(Torek,)X +1066(C.,)X +1222(``Re:)X +1470(dbm.a)X +1751(and)X +1950(ndbm.a)X +604 3090(archives'',)N +2 f +966(USENET)X +1279(newsgroup)X +1650(comp.unix)X +1 f +2002(1987.)X +432 3266([TOR88])N +760(Torek,)X +1006(C.,)X +1133(``Re:)X +1351(questions)X +1686(regarding)X +2027(data-)X +604 3354(bases)N +826(created)X +1106(with)X +1295(dbm)X +1484(and)X +1647(ndbm)X +1876(routines'')X +2 f +604 3442(USENET)N +937(newsgroup)X +1328(comp.unix.questions)X +1 f +1982(,)X +2041(June)X +604 3530(1988.)N +432 3706([WAL84])N +773(Wales,)X +1018(R.,)X +1135(``Discussion)X +1564(of)X +1655("dbm")X +1887(data)X +2045(base)X +604 3794(system'',)N +2 f +973(USENET)X +1339(newsgroup)X +1762(unix.wizards)X +1 f +2168(,)X +604 3882(January,)N +894(1984.)X +432 4058([YIG89])N +751(Ozan)X +963(S.)X +1069(Yigit,)X +1294(``How)X +1545(to)X +1648(Roll)X +1826(Your)X +2032(Own)X +604 4146(Dbm/Ndbm'',)N +2 f +1087(unpublished)X +1504(manuscript)X +1 f +(,)S +1910(Toronto,)X +604 4234(July,)N +777(1989)X +3 f +432 5960(12)N +2970(USENIX)X +9 f +3292(-)X +3 f +3356(Winter)X +3621('91)X +9 f +3748(-)X +3 f +3812(Dallas,)X +4065(TX)X + +13 p +%%Page: 13 13 +0(Courier)xf 0 f +10 s 10 xH 0 xS 0 f +3 f +720 258(Seltzer)N +977(&)X +1064(Yigit)X +3278(A)X +3356(New)X +3528(Hashing)X +3831(Package)X +4136(for)X +4259(UNIX)X +1 f +720 538(Margo)N +960(I.)X +1033(Seltzer)X +1282(is)X +1361(a)X +1423(Ph.D.)X +1631(student)X +1887(in)X +1974(the)X +2097(Department)X +720 626(of)N +823(Electrical)X +1167(Engineering)X +1595(and)X +1747(Computer)X +2102(Sciences)X +2418(at)X +720 714(the)N +850(University)X +1220(of)X +1318(California,)X +1694(Berkeley.)X +2055(Her)X +2207(research)X +720 802(interests)N +1017(include)X +1283(\256le)X +1415(systems,)X +1718(databases,)X +2076(and)X +2221(transac-)X +720 890(tion)N +896(processing)X +1291(systems.)X +1636(She)X +1807(spent)X +2027(several)X +2306(years)X +720 978(working)N +1026(at)X +1123(startup)X +1380(companies)X +1762(designing)X +2112(and)X +2267(imple-)X +720 1066(menting)N +1048(\256le)X +1216(systems)X +1535(and)X +1716(transaction)X +2133(processing)X +720 1154(software)N +1026(and)X +1170(designing)X +1509(microprocessors.)X +2103(Ms.)X +2253(Seltzer)X +720 1242(received)N +1057(her)X +1223(AB)X +1397(in)X +1522(Applied)X +1843(Mathematics)X +2320(from)X +720 1330 0.1953(Harvard/Radcliffe)AN +1325(College)X +1594(in)X +1676(1983.)X +720 1444(In)N +810(her)X +936(spare)X +1129(time,)X +1313(Margo)X +1549(can)X +1683(usually)X +1936(be)X +2034(found)X +2243(prepar-)X +720 1532(ing)N +868(massive)X +1171(quantities)X +1527(of)X +1639(food)X +1831(for)X +1970(hungry)X +2242(hoards,)X +720 1620(studying)N +1022(Japanese,)X +1355(or)X +1449(playing)X +1716(soccer)X +1948(with)X +2116(an)X +2218(exciting)X +720 1708(Bay)N +912(Area)X +1132(Women's)X +1507(Soccer)X +1788(team,)X +2026(the)X +2186(Berkeley)X +720 1796(Bruisers.)N +720 1910(Ozan)N +915(\()X +3 f +942(Oz)X +1 f +1040(\))X +1092(Yigit)X +1281(is)X +1358(currently)X +1672(a)X +1732(software)X +2033(engineer)X +2334(with)X +720 1998(the)N +886(Communications)X +1499(Research)X +1861(and)X +2044(Development)X +720 2086(group,)N +948(Computing)X +1328(Services,)X +1641(York)X +1826(University.)X +2224(His)X +2355(for-)X +720 2174(mative)N +967(years)X +1166(were)X +1352(also)X +1510(spent)X +1708(at)X +1795(York,)X +2009(where)X +2234(he)X +2338(held)X +720 2262(system)N +985(programmer)X +1425(and)X +1583(administrator)X +2052(positions)X +2382(for)X +720 2350(various)N +995(mixtures)X +1314(of)X +1420(of)X +1526(UNIX)X +1765(systems)X +2056(starting)X +2334(with)X +720 2438(Berkeley)N +1031(4.1)X +1151(in)X +1233(1982,)X +1433(while)X +1631(at)X +1709(the)X +1827(same)X +2012(time)X +2174(obtaining)X +720 2526(a)N +776(degree)X +1011(in)X +1093(Computer)X +1433(Science.)X +720 2640(In)N +813(his)X +931(copious)X +1205(free)X +1356(time,)X +1543(Oz)X +1662(enjoys)X +1896(working)X +2188(on)X +2293(what-)X +720 2728(ever)N +890(software)X +1197(looks)X +1400(interesting,)X +1788(which)X +2014(often)X +2209(includes)X +720 2816(language)N +1044(interpreters,)X +1464(preprocessors,)X +1960(and)X +2110(lately,)X +2342(pro-)X +720 2904(gram)N +905(generators)X +1260(and)X +1396(expert)X +1617(systems.)X +720 3018(Oz)N +836(has)X +964(authored)X +1266(several)X +1515(public-domain)X +2003(software)X +2301(tools,)X +720 3106(including)N +1069(an)X +1191(nroff-like)X +1545(text)X +1711(formatter)X +2 f +2056(proff)X +1 f +2257(that)X +2423(is)X +720 3194(apparently)N +1083(still)X +1226(used)X +1397(in)X +1483(some)X +1676(basement)X +2002(PCs.)X +2173(His)X +2307(latest)X +720 3282(obsessions)N +1143(include)X +1460(the)X +1639(incredible)X +2040(programming)X +720 3370(language)N +1030(Scheme,)X +1324(and)X +1460(Chinese)X +1738(Brush)X +1949(painting.)X +3 f +720 5960(USENIX)N +9 f +1042(-)X +3 f +1106(Winter)X +1371('91)X +9 f +1498(-)X +3 f +1562(Dallas,)X +1815(TX)X +4384(13)X + +14 p +%%Page: 14 14 +0(Courier)xf 0 f +10 s 10 xH 0 xS 0 f +3 f +432 5960(14)N +2970(USENIX)X +9 f +3292(-)X +3 f +3356(Winter)X +3621('91)X +9 f +3748(-)X +3 f +3812(Dallas,)X +4065(TX)X + +14 p +%%Trailer +xt + +xs diff --git a/mozilla/db/documents/libtp.usenix.ps b/mozilla/db/documents/libtp.usenix.ps new file mode 100644 index 00000000000..e7d1b9f5258 --- /dev/null +++ b/mozilla/db/documents/libtp.usenix.ps @@ -0,0 +1,12340 @@ +%!PS-Adobe-1.0 +%%Creator: utopia:margo (& Seltzer,608-13E,8072,) +%%Title: stdin (ditroff) +%%CreationDate: Thu Dec 12 15:32:11 1991 +%%EndComments +% @(#)psdit.pro 1.3 4/15/88 +% lib/psdit.pro -- prolog for psdit (ditroff) files +% Copyright (c) 1984, 1985 Adobe Systems Incorporated. All Rights Reserved. +% last edit: shore Sat Nov 23 20:28:03 1985 +% RCSID: $Header: /home/befator/cvs/jail/cvsroot/mozilla/db/documents/Attic/libtp.usenix.ps,v 1.1.1.1 1998-10-15 03:56:35 roeber%netscape.com Exp $ + +% Changed by Edward Wang (edward@ucbarpa.berkeley.edu) to handle graphics, +% 17 Feb, 87. + +/$DITroff 140 dict def $DITroff begin +/fontnum 1 def /fontsize 10 def /fontheight 10 def /fontslant 0 def +/xi{0 72 11 mul translate 72 resolution div dup neg scale 0 0 moveto + /fontnum 1 def /fontsize 10 def /fontheight 10 def /fontslant 0 def F + /pagesave save def}def +/PB{save /psv exch def currentpoint translate + resolution 72 div dup neg scale 0 0 moveto}def +/PE{psv restore}def +/arctoobig 90 def /arctoosmall .05 def +/m1 matrix def /m2 matrix def /m3 matrix def /oldmat matrix def +/tan{dup sin exch cos div}def +/point{resolution 72 div mul}def +/dround {transform round exch round exch itransform}def +/xT{/devname exch def}def +/xr{/mh exch def /my exch def /resolution exch def}def +/xp{}def +/xs{docsave restore end}def +/xt{}def +/xf{/fontname exch def /slotno exch def fontnames slotno get fontname eq not + {fonts slotno fontname findfont put fontnames slotno fontname put}if}def +/xH{/fontheight exch def F}def +/xS{/fontslant exch def F}def +/s{/fontsize exch def /fontheight fontsize def F}def +/f{/fontnum exch def F}def +/F{fontheight 0 le{/fontheight fontsize def}if + fonts fontnum get fontsize point 0 0 fontheight point neg 0 0 m1 astore + fontslant 0 ne{1 0 fontslant tan 1 0 0 m2 astore m3 concatmatrix}if + makefont setfont .04 fontsize point mul 0 dround pop setlinewidth}def +/X{exch currentpoint exch pop moveto show}def +/N{3 1 roll moveto show}def +/Y{exch currentpoint pop exch moveto show}def +/S{show}def +/ditpush{}def/ditpop{}def +/AX{3 -1 roll currentpoint exch pop moveto 0 exch ashow}def +/AN{4 2 roll moveto 0 exch ashow}def +/AY{3 -1 roll currentpoint pop exch moveto 0 exch ashow}def +/AS{0 exch ashow}def +/MX{currentpoint exch pop moveto}def +/MY{currentpoint pop exch moveto}def +/MXY{moveto}def +/cb{pop}def % action on unknown char -- nothing for now +/n{}def/w{}def +/p{pop showpage pagesave restore /pagesave save def}def +/Dt{/Dlinewidth exch def}def 1 Dt +/Ds{/Ddash exch def}def -1 Ds +/Di{/Dstipple exch def}def 1 Di +/Dsetlinewidth{2 Dlinewidth mul setlinewidth}def +/Dsetdash{Ddash 4 eq{[8 12]}{Ddash 16 eq{[32 36]} + {Ddash 20 eq{[32 12 8 12]}{[]}ifelse}ifelse}ifelse 0 setdash}def +/Dstroke{gsave Dsetlinewidth Dsetdash 1 setlinecap stroke grestore + currentpoint newpath moveto}def +/Dl{rlineto Dstroke}def +/arcellipse{/diamv exch def /diamh exch def oldmat currentmatrix pop + currentpoint translate 1 diamv diamh div scale /rad diamh 2 div def + currentpoint exch rad add exch rad -180 180 arc oldmat setmatrix}def +/Dc{dup arcellipse Dstroke}def +/De{arcellipse Dstroke}def +/Da{/endv exch def /endh exch def /centerv exch def /centerh exch def + /cradius centerv centerv mul centerh centerh mul add sqrt def + /eradius endv endv mul endh endh mul add sqrt def + /endang endv endh atan def + /startang centerv neg centerh neg atan def + /sweep startang endang sub dup 0 lt{360 add}if def + sweep arctoobig gt + {/midang startang sweep 2 div sub def /midrad cradius eradius add 2 div def + /midh midang cos midrad mul def /midv midang sin midrad mul def + midh neg midv neg endh endv centerh centerv midh midv Da + Da} + {sweep arctoosmall ge + {/controldelt 1 sweep 2 div cos sub 3 sweep 2 div sin mul div 4 mul def + centerv neg controldelt mul centerh controldelt mul + endv neg controldelt mul centerh add endh add + endh controldelt mul centerv add endv add + centerh endh add centerv endv add rcurveto Dstroke} + {centerh endh add centerv endv add rlineto Dstroke} + ifelse} + ifelse}def +/Dpatterns[ +[%cf[widthbits] +[8<0000000000000010>] +[8<0411040040114000>] +[8<0204081020408001>] +[8<0000103810000000>] +[8<6699996666999966>] +[8<0000800100001008>] +[8<81c36666c3810000>] +[8<0f0e0c0800000000>] +[8<0000000000000010>] +[8<0411040040114000>] +[8<0204081020408001>] +[8<0000001038100000>] +[8<6699996666999966>] +[8<0000800100001008>] +[8<81c36666c3810000>] +[8<0f0e0c0800000000>] +[8<0042660000246600>] +[8<0000990000990000>] +[8<0804020180402010>] +[8<2418814242811824>] +[8<6699996666999966>] +[8<8000000008000000>] +[8<00001c3e363e1c00>] +[8<0000000000000000>] +[32<00000040000000c00000004000000040000000e0000000000000000000000000>] +[32<00000000000060000000900000002000000040000000f0000000000000000000>] +[32<000000000000000000e0000000100000006000000010000000e0000000000000>] +[32<00000000000000002000000060000000a0000000f00000002000000000000000>] +[32<0000000e0000000000000000000000000000000f000000080000000e00000001>] +[32<0000090000000600000000000000000000000000000007000000080000000e00>] +[32<00010000000200000004000000040000000000000000000000000000000f0000>] +[32<0900000006000000090000000600000000000000000000000000000006000000>]] +[%ug +[8<0000020000000000>] +[8<0000020000002000>] +[8<0004020000002000>] +[8<0004020000402000>] +[8<0004060000402000>] +[8<0004060000406000>] +[8<0006060000406000>] +[8<0006060000606000>] +[8<00060e0000606000>] +[8<00060e000060e000>] +[8<00070e000060e000>] +[8<00070e000070e000>] +[8<00070e020070e000>] +[8<00070e020070e020>] +[8<04070e020070e020>] +[8<04070e024070e020>] +[8<04070e064070e020>] +[8<04070e064070e060>] +[8<06070e064070e060>] +[8<06070e066070e060>] +[8<06070f066070e060>] +[8<06070f066070f060>] +[8<060f0f066070f060>] +[8<060f0f0660f0f060>] +[8<060f0f0760f0f060>] +[8<060f0f0760f0f070>] +[8<0e0f0f0760f0f070>] +[8<0e0f0f07e0f0f070>] +[8<0e0f0f0fe0f0f070>] +[8<0e0f0f0fe0f0f0f0>] +[8<0f0f0f0fe0f0f0f0>] +[8<0f0f0f0ff0f0f0f0>] +[8<1f0f0f0ff0f0f0f0>] +[8<1f0f0f0ff1f0f0f0>] +[8<1f0f0f8ff1f0f0f0>] +[8<1f0f0f8ff1f0f0f8>] +[8<9f0f0f8ff1f0f0f8>] +[8<9f0f0f8ff9f0f0f8>] +[8<9f0f0f9ff9f0f0f8>] +[8<9f0f0f9ff9f0f0f9>] +[8<9f8f0f9ff9f0f0f9>] +[8<9f8f0f9ff9f8f0f9>] +[8<9f8f1f9ff9f8f0f9>] +[8<9f8f1f9ff9f8f1f9>] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8] +[8]] +[%mg +[8<8000000000000000>] +[8<0822080080228000>] +[8<0204081020408001>] +[8<40e0400000000000>] +[8<66999966>] +[8<8001000010080000>] +[8<81c36666c3810000>] +[8] +[16<07c00f801f003e007c00f800f001e003c007800f001f003e007c00f801f003e0>] +[16<1f000f8007c003e001f000f8007c003e001f800fc007e003f001f8007c003e00>] +[8] +[16<0040008001000200040008001000200040008000000100020004000800100020>] +[16<0040002000100008000400020001800040002000100008000400020001000080>] +[16<1fc03fe07df0f8f8f07de03fc01f800fc01fe03ff07df8f87df03fe01fc00f80>] +[8<80>] +[8<8040201000000000>] +[8<84cc000048cc0000>] +[8<9900009900000000>] +[8<08040201804020100800020180002010>] +[8<2418814242811824>] +[8<66999966>] +[8<8000000008000000>] +[8<70f8d8f870000000>] +[8<0814224180402010>] +[8] +[8<018245aa45820100>] +[8<221c224180808041>] +[8<88000000>] +[8<0855800080550800>] +[8<2844004482440044>] +[8<0810204080412214>] +[8<00>]]]def +/Dfill{ + transform /maxy exch def /maxx exch def + transform /miny exch def /minx exch def + minx maxx gt{/minx maxx /maxx minx def def}if + miny maxy gt{/miny maxy /maxy miny def def}if + Dpatterns Dstipple 1 sub get exch 1 sub get + aload pop /stip exch def /stipw exch def /stiph 128 def + /imatrix[stipw 0 0 stiph 0 0]def + /tmatrix[stipw 0 0 stiph 0 0]def + /minx minx cvi stiph idiv stiph mul def + /miny miny cvi stipw idiv stipw mul def + gsave eoclip 0 setgray + miny stiph maxy{ + tmatrix exch 5 exch put + minx stipw maxx{ + tmatrix exch 4 exch put tmatrix setmatrix + stipw stiph true imatrix {stip} imagemask + }for + }for + grestore +}def +/Dp{Dfill Dstroke}def +/DP{Dfill currentpoint newpath moveto}def +end + +/ditstart{$DITroff begin + /nfonts 60 def % NFONTS makedev/ditroff dependent! + /fonts[nfonts{0}repeat]def + /fontnames[nfonts{()}repeat]def +/docsave save def +}def + +% character outcalls +/oc{ + /pswid exch def /cc exch def /name exch def + /ditwid pswid fontsize mul resolution mul 72000 div def + /ditsiz fontsize resolution mul 72 div def + ocprocs name known{ocprocs name get exec}{name cb}ifelse +}def +/fractm [.65 0 0 .6 0 0] def +/fraction{ + /fden exch def /fnum exch def gsave /cf currentfont def + cf fractm makefont setfont 0 .3 dm 2 copy neg rmoveto + fnum show rmoveto currentfont cf setfont(\244)show setfont fden show + grestore ditwid 0 rmoveto +}def +/oce{grestore ditwid 0 rmoveto}def +/dm{ditsiz mul}def +/ocprocs 50 dict def ocprocs begin +(14){(1)(4)fraction}def +(12){(1)(2)fraction}def +(34){(3)(4)fraction}def +(13){(1)(3)fraction}def +(23){(2)(3)fraction}def +(18){(1)(8)fraction}def +(38){(3)(8)fraction}def +(58){(5)(8)fraction}def +(78){(7)(8)fraction}def +(sr){gsave 0 .06 dm rmoveto(\326)show oce}def +(is){gsave 0 .15 dm rmoveto(\362)show oce}def +(->){gsave 0 .02 dm rmoveto(\256)show oce}def +(<-){gsave 0 .02 dm rmoveto(\254)show oce}def +(==){gsave 0 .05 dm rmoveto(\272)show oce}def +(uc){gsave currentpoint 400 .009 dm mul add translate + 8 -8 scale ucseal oce}def +end + +% an attempt at a PostScript FONT to implement ditroff special chars +% this will enable us to +% cache the little buggers +% generate faster, more compact PS out of psdit +% confuse everyone (including myself)! +50 dict dup begin +/FontType 3 def +/FontName /DIThacks def +/FontMatrix [.001 0 0 .001 0 0] def +/FontBBox [-260 -260 900 900] def% a lie but ... +/Encoding 256 array def +0 1 255{Encoding exch /.notdef put}for +Encoding + dup 8#040/space put %space + dup 8#110/rc put %right ceil + dup 8#111/lt put %left top curl + dup 8#112/bv put %bold vert + dup 8#113/lk put %left mid curl + dup 8#114/lb put %left bot curl + dup 8#115/rt put %right top curl + dup 8#116/rk put %right mid curl + dup 8#117/rb put %right bot curl + dup 8#120/rf put %right floor + dup 8#121/lf put %left floor + dup 8#122/lc put %left ceil + dup 8#140/sq put %square + dup 8#141/bx put %box + dup 8#142/ci put %circle + dup 8#143/br put %box rule + dup 8#144/rn put %root extender + dup 8#145/vr put %vertical rule + dup 8#146/ob put %outline bullet + dup 8#147/bu put %bullet + dup 8#150/ru put %rule + dup 8#151/ul put %underline + pop +/DITfd 100 dict def +/BuildChar{0 begin + /cc exch def /fd exch def + /charname fd /Encoding get cc get def + /charwid fd /Metrics get charname get def + /charproc fd /CharProcs get charname get def + charwid 0 fd /FontBBox get aload pop setcachedevice + 2 setlinejoin 40 setlinewidth + newpath 0 0 moveto gsave charproc grestore + end}def +/BuildChar load 0 DITfd put +/CharProcs 50 dict def +CharProcs begin +/space{}def +/.notdef{}def +/ru{500 0 rls}def +/rn{0 840 moveto 500 0 rls}def +/vr{0 800 moveto 0 -770 rls}def +/bv{0 800 moveto 0 -1000 rls}def +/br{0 840 moveto 0 -1000 rls}def +/ul{0 -140 moveto 500 0 rls}def +/ob{200 250 rmoveto currentpoint newpath 200 0 360 arc closepath stroke}def +/bu{200 250 rmoveto currentpoint newpath 200 0 360 arc closepath fill}def +/sq{80 0 rmoveto currentpoint dround newpath moveto + 640 0 rlineto 0 640 rlineto -640 0 rlineto closepath stroke}def +/bx{80 0 rmoveto currentpoint dround newpath moveto + 640 0 rlineto 0 640 rlineto -640 0 rlineto closepath fill}def +/ci{500 360 rmoveto currentpoint newpath 333 0 360 arc + 50 setlinewidth stroke}def + +/lt{0 -200 moveto 0 550 rlineto currx 800 2cx s4 add exch s4 a4p stroke}def +/lb{0 800 moveto 0 -550 rlineto currx -200 2cx s4 add exch s4 a4p stroke}def +/rt{0 -200 moveto 0 550 rlineto currx 800 2cx s4 sub exch s4 a4p stroke}def +/rb{0 800 moveto 0 -500 rlineto currx -200 2cx s4 sub exch s4 a4p stroke}def +/lk{0 800 moveto 0 300 -300 300 s4 arcto pop pop 1000 sub + 0 300 4 2 roll s4 a4p 0 -200 lineto stroke}def +/rk{0 800 moveto 0 300 s2 300 s4 arcto pop pop 1000 sub + 0 300 4 2 roll s4 a4p 0 -200 lineto stroke}def +/lf{0 800 moveto 0 -1000 rlineto s4 0 rls}def +/rf{0 800 moveto 0 -1000 rlineto s4 neg 0 rls}def +/lc{0 -200 moveto 0 1000 rlineto s4 0 rls}def +/rc{0 -200 moveto 0 1000 rlineto s4 neg 0 rls}def +end + +/Metrics 50 dict def Metrics begin +/.notdef 0 def +/space 500 def +/ru 500 def +/br 0 def +/lt 416 def +/lb 416 def +/rt 416 def +/rb 416 def +/lk 416 def +/rk 416 def +/rc 416 def +/lc 416 def +/rf 416 def +/lf 416 def +/bv 416 def +/ob 350 def +/bu 350 def +/ci 750 def +/bx 750 def +/sq 750 def +/rn 500 def +/ul 500 def +/vr 0 def +end + +DITfd begin +/s2 500 def /s4 250 def /s3 333 def +/a4p{arcto pop pop pop pop}def +/2cx{2 copy exch}def +/rls{rlineto stroke}def +/currx{currentpoint pop}def +/dround{transform round exch round exch itransform} def +end +end +/DIThacks exch definefont pop +ditstart +(psc)xT +576 1 1 xr +1(Times-Roman)xf 1 f +2(Times-Italic)xf 2 f +3(Times-Bold)xf 3 f +4(Times-BoldItalic)xf 4 f +5(Helvetica)xf 5 f +6(Helvetica-Bold)xf 6 f +7(Courier)xf 7 f +8(Courier-Bold)xf 8 f +9(Symbol)xf 9 f +10(DIThacks)xf 10 f +10 s +1 f +xi +%%EndProlog + +%%Page: 1 1 +10 s 10 xH 0 xS 1 f +3 f +14 s +1205 1206(LIBTP:)N +1633(Portable,)X +2100(M)X +2206(odular)X +2551(Transactions)X +3202(for)X +3374(UNIX)X +1 f +11 s +3661 1162(1)N +2 f +12 s +2182 1398(Margo)N +2467(Seltzer)X +2171 1494(Michael)N +2511(Olson)X +1800 1590(University)N +2225(of)X +2324(California,)X +2773(Berkeley)X +3 f +2277 1878(Abstract)N +1 f +10 s +755 2001(Transactions)N +1198(provide)X +1475(a)X +1543(useful)X +1771(programming)X +2239(paradigm)X +2574(for)X +2700(maintaining)X +3114(logical)X +3364(consistency,)X +3790(arbitrating)X +4156(con-)X +555 2091(current)N +808(access,)X +1059(and)X +1200(managing)X +1540(recovery.)X +1886(In)X +1977(traditional)X +2330(UNIX)X +2555(systems,)X +2852(the)X +2974(only)X +3140(easy)X +3307(way)X +3465(of)X +3556(using)X +3753(transactions)X +4160(is)X +4237(to)X +555 2181(purchase)N +876(a)X +947(database)X +1258(system.)X +1554(Such)X +1748(systems)X +2035(are)X +2168(often)X +2367(slow,)X +2572(costly,)X +2817(and)X +2967(may)X +3139(not)X +3275(provide)X +3554(the)X +3686(exact)X +3890(functionality)X +555 2271(desired.)N +848(This)X +1011(paper)X +1210(presents)X +1493(the)X +1611(design,)X +1860(implementation,)X +2402(and)X +2538(performance)X +2965(of)X +3052(LIBTP,)X +3314(a)X +3370(simple,)X +3623(non-proprietary)X +4147(tran-)X +555 2361(saction)N +809(library)X +1050(using)X +1249(the)X +1373(4.4BSD)X +1654(database)X +1957(access)X +2189(routines)X +2473(\()X +3 f +2500(db)X +1 f +2588(\(3\)\).)X +2775(On)X +2899(a)X +2961(conventional)X +3401(transaction)X +3779(processing)X +4148(style)X +555 2451(benchmark,)N +959(its)X +1061(performance)X +1495(is)X +1575(approximately)X +2065(85%)X +2239(that)X +2386(of)X +2480(the)X +2604(database)X +2907(access)X +3139(routines)X +3423(without)X +3693(transaction)X +4071(protec-)X +555 2541(tion,)N +725(200%)X +938(that)X +1084(of)X +1177(using)X +3 f +1376(fsync)X +1 f +1554(\(2\))X +1674(to)X +1761(commit)X +2030(modi\256cations)X +2490(to)X +2577(disk,)X +2755(and)X +2896(125%)X +3108(that)X +3253(of)X +3345(a)X +3406(commercial)X +3810(relational)X +4138(data-)X +555 2631(base)N +718(system.)X +3 f +555 2817(1.)N +655(Introduction)X +1 f +755 2940(Transactions)N +1186(are)X +1306(used)X +1474(in)X +1557(database)X +1855(systems)X +2129(to)X +2212(enable)X +2443(concurrent)X +2807(users)X +2992(to)X +3074(apply)X +3272(multi-operation)X +3790(updates)X +4055(without)X +555 3030(violating)N +863(the)X +985(integrity)X +1280(of)X +1371(the)X +1493(database.)X +1814(They)X +2003(provide)X +2271(the)X +2392(properties)X +2736(of)X +2826(atomicity,)X +3171(consistency,)X +3588(isolation,)X +3906(and)X +4045(durabil-)X +555 3120(ity.)N +701(By)X +816(atomicity,)X +1160(we)X +1276(mean)X +1472(that)X +1614(the)X +1734(set)X +1845(of)X +1934(updates)X +2200(comprising)X +2581(a)X +2638(transaction)X +3011(must)X +3187(be)X +3284(applied)X +3541(as)X +3629(a)X +3686(single)X +3898(unit;)X +4085(that)X +4226(is,)X +555 3210(they)N +714(must)X +890(either)X +1094(all)X +1195(be)X +1292(applied)X +1549(to)X +1632(the)X +1751(database)X +2049(or)X +2137(all)X +2238(be)X +2335(absent.)X +2601(Consistency)X +3013(requires)X +3293(that)X +3434(a)X +3491(transaction)X +3864(take)X +4019(the)X +4138(data-)X +555 3300(base)N +725(from)X +908(one)X +1051(logically)X +1358(consistent)X +1704(state)X +1877(to)X +1965(another.)X +2272(The)X +2423(property)X +2721(of)X +2814(isolation)X +3115(requires)X +3400(that)X +3546(concurrent)X +3916(transactions)X +555 3390(yield)N +750(results)X +994(which)X +1225(are)X +1358(indistinguishable)X +1938(from)X +2128(the)X +2260(results)X +2503(which)X +2733(would)X +2967(be)X +3077(obtained)X +3387(by)X +3501(running)X +3784(the)X +3916(transactions)X +555 3480(sequentially.)N +1002(Finally,)X +1268(durability)X +1599(requires)X +1878(that)X +2018(once)X +2190(transactions)X +2593(have)X +2765(been)X +2937(committed,)X +3319(their)X +3486(results)X +3715(must)X +3890(be)X +3986(preserved)X +555 3570(across)N +776(system)X +1018(failures)X +1279([TPCB90].)X +755 3693(Although)N +1080(these)X +1268(properties)X +1612(are)X +1734(most)X +1912(frequently)X +2265(discussed)X +2595(in)X +2680(the)X +2801(context)X +3060(of)X +3150(databases,)X +3501(they)X +3661(are)X +3782(useful)X +4000(program-)X +555 3783(ming)N +750(paradigms)X +1114(for)X +1238(more)X +1433(general)X +1700(purpose)X +1984(applications.)X +2441(There)X +2659(are)X +2788(several)X +3046(different)X +3353(situations)X +3689(where)X +3916(transactions)X +555 3873(can)N +687(be)X +783(used)X +950(to)X +1032(replace)X +1285(current)X +1533(ad-hoc)X +1772(mechanisms.)X +755 3996(One)N +910(situation)X +1206(is)X +1280(when)X +1475(multiple)X +1762(\256les)X +1916(or)X +2004(parts)X +2181(of)X +2269(\256les)X +2422(need)X +2594(to)X +2676(be)X +2772(updated)X +3046(in)X +3128(an)X +3224(atomic)X +3462(fashion.)X +3758(For)X +3889(example,)X +4201(the)X +555 4086(traditional)N +907(UNIX)X +1131(\256le)X +1256(system)X +1501(uses)X +1661(ordering)X +1955(constraints)X +2324(to)X +2408(achieve)X +2676(recoverability)X +3144(in)X +3228(the)X +3348(face)X +3505(of)X +3594(crashes.)X +3893(When)X +4107(a)X +4165(new)X +555 4176(\256le)N +678(is)X +752(created,)X +1026(its)X +1122(inode)X +1321(is)X +1395(written)X +1642(to)X +1724(disk)X +1877(before)X +2103(the)X +2221(new)X +2375(\256le)X +2497(is)X +2570(added)X +2782(to)X +2864(the)X +2982(directory)X +3292(structure.)X +3633(This)X +3795(guarantees)X +4159(that,)X +555 4266(if)N +627(the)X +748(system)X +993(crashes)X +1253(between)X +1544(the)X +1665(two)X +1808(I/O's,)X +2016(the)X +2137(directory)X +2450(does)X +2620(not)X +2744(contain)X +3002(a)X +3060 0.4531(reference)AX +3383(to)X +3467(an)X +3565(invalid)X +3809(inode.)X +4049(In)X +4138(actu-)X +555 4356(ality,)N +741(the)X +863(desired)X +1119(effect)X +1326(is)X +1402(that)X +1545(these)X +1733(two)X +1876(updates)X +2144(have)X +2319(the)X +2440(transactional)X +2873(property)X +3168(of)X +3258(atomicity)X +3583(\(either)X +3816(both)X +3981(writes)X +4200(are)X +555 4446(visible)N +790(or)X +879(neither)X +1124(is\).)X +1266(Rather)X +1501(than)X +1660(building)X +1947(special)X +2191(purpose)X +2466(recovery)X +2769(mechanisms)X +3186(into)X +3331(the)X +3450(\256le)X +3573(system)X +3816(or)X +3904(related)X +4144(tools)X +555 4536(\()N +2 f +582(e.g.)X +3 f +726(fsck)X +1 f +864(\(8\)\),)X +1033(one)X +1177(could)X +1383(use)X +1518(general)X +1783(purpose)X +2064(transaction)X +2443(recovery)X +2752(protocols)X +3077(after)X +3252(system)X +3501(failure.)X +3778(Any)X +3943(application)X +555 4626(that)N +705(needs)X +918(to)X +1010(keep)X +1192(multiple,)X +1508(related)X +1757(\256les)X +1920(\(or)X +2044(directories\))X +2440(consistent)X +2790(should)X +3032(do)X +3141(so)X +3241(using)X +3443(transactions.)X +3895(Source)X +4147(code)X +555 4716(control)N +805(systems,)X +1101(such)X +1271(as)X +1361(RCS)X +1534(and)X +1673(SCCS,)X +1910(should)X +2146(use)X +2276(transaction)X +2651(semantics)X +2990(to)X +3075(allow)X +3276(the)X +3397(``checking)X +3764(in'')X +3903(of)X +3992(groups)X +4232(of)X +555 4806(related)N +801(\256les.)X +1001(In)X +1095(this)X +1237(way,)X +1418(if)X +1493(the)X +1617 0.2841(``check-in'')AX +2028(fails,)X +2212(the)X +2336(transaction)X +2714(may)X +2878(be)X +2980(aborted,)X +3267(backing)X +3547(out)X +3675(the)X +3799(partial)X +4030(``check-)X +555 4896(in'')N +691(leaving)X +947(the)X +1065(source)X +1295(repository)X +1640(in)X +1722(a)X +1778(consistent)X +2118(state.)X +755 5019(A)N +842(second)X +1094(situation)X +1398(where)X +1624(transactions)X +2036(can)X +2177(be)X +2282(used)X +2458(to)X +2549(replace)X +2811(current)X +3068(ad-hoc)X +3316(mechanisms)X +3741(is)X +3822(in)X +3912(applications)X +555 5109(where)N +776(concurrent)X +1144(updates)X +1413(to)X +1499(a)X +1559(shared)X +1793(\256le)X +1919(are)X +2042(desired,)X +2318(but)X +2444(there)X +2629(is)X +2706(logical)X +2948(consistency)X +3345(of)X +3435(the)X +3556(data)X +3713(which)X +3932(needs)X +4138(to)X +4223(be)X +555 5199(preserved.)N +928(For)X +1059(example,)X +1371(when)X +1565(the)X +1683(password)X +2006(\256le)X +2128(is)X +2201(updated,)X +2495(\256le)X +2617(locking)X +2877(is)X +2950(used)X +3117(to)X +3199(disallow)X +3490(concurrent)X +3854(access.)X +4120(Tran-)X +555 5289(saction)N +804(semantics)X +1142(on)X +1244(the)X +1364(password)X +1689(\256les)X +1844(would)X +2066(allow)X +2266(concurrent)X +2632(updates,)X +2919(while)X +3119(preserving)X +3479(the)X +3598(logical)X +3837(consistency)X +4232(of)X +555 5379(the)N +681(password)X +1012(database.)X +1357(Similarly,)X +1702(UNIX)X +1930(utilities)X +2196(which)X +2419(rewrite)X +2674(\256les)X +2834(face)X +2996(a)X +3059(potential)X +3366(race)X +3528(condition)X +3857(between)X +4152(their)X +555 5469(rewriting)N +871(a)X +929(\256le)X +1053(and)X +1191(another)X +1453(process)X +1715(reading)X +1977(the)X +2096(\256le.)X +2259(For)X +2391(example,)X +2704(the)X +2823(compiler)X +3129(\(more)X +3342(precisely,)X +3673(the)X +3792(assembler\))X +4161(may)X +8 s +10 f +555 5541(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)N +5 s +1 f +727 5619(1)N +8 s +763 5644(To)N +850(appear)X +1035(in)X +1101(the)X +2 f +1195(Proceedings)X +1530(of)X +1596(the)X +1690(1992)X +1834(Winter)X +2024(Usenix)X +1 f +2201(,)X +2233(San)X +2345(Francisco,)X +2625(CA,)X +2746(January)X +2960(1992.)X + +2 p +%%Page: 2 2 +8 s 8 xH 0 xS 1 f +10 s +3 f +1 f +555 630(have)N +737(to)X +829(rewrite)X +1087(a)X +1152(\256le)X +1283(to)X +1374(which)X +1599(it)X +1672(has)X +1808(write)X +2002(permission)X +2382(in)X +2473(a)X +2538(directory)X +2857(to)X +2948(which)X +3173(it)X +3246(does)X +3422(not)X +3553(have)X +3734(write)X +3928(permission.)X +555 720(While)N +779(the)X +904(``.o'')X +1099(\256le)X +1228(is)X +1308(being)X +1513(written,)X +1787(another)X +2055(utility)X +2272(such)X +2446(as)X +3 f +2540(nm)X +1 f +2651(\(1\))X +2772(or)X +3 f +2866(ar)X +1 f +2942(\(1\))X +3063(may)X +3228(read)X +3394(the)X +3519(\256le)X +3648(and)X +3791(produce)X +4077(invalid)X +555 810(results)N +790(since)X +981(the)X +1105(\256le)X +1233(has)X +1366(not)X +1494(been)X +1672(completely)X +2054(written.)X +2347(Currently,)X +2700(some)X +2895(utilities)X +3160(use)X +3293(special)X +3542(purpose)X +3821(code)X +3998(to)X +4085(handle)X +555 900(such)N +722(cases)X +912(while)X +1110(others)X +1326(ignore)X +1551(the)X +1669(problem)X +1956(and)X +2092(force)X +2278(users)X +2463(to)X +2545(live)X +2685(with)X +2847(the)X +2965(consequences.)X +755 1023(In)N +845(this)X +983(paper,)X +1205(we)X +1322(present)X +1577(a)X +1635(simple)X +1870(library)X +2106(which)X +2324(provides)X +2622(transaction)X +2996(semantics)X +3334(\(atomicity,)X +3705(consistency,)X +4121(isola-)X +555 1113(tion,)N +720(and)X +857(durability\).)X +1236(The)X +1382(4.4BSD)X +1658(database)X +1956(access)X +2182(methods)X +2473(have)X +2645(been)X +2817(modi\256ed)X +3121(to)X +3203(use)X +3330(this)X +3465(library,)X +3719(optionally)X +4063(provid-)X +555 1203(ing)N +682(shared)X +917(buffer)X +1139(management)X +1574(between)X +1867(applications,)X +2298(locking,)X +2582(and)X +2722(transaction)X +3098(semantics.)X +3478(Any)X +3640(UNIX)X +3865(program)X +4161(may)X +555 1293(transaction)N +930(protect)X +1176(its)X +1274(data)X +1430(by)X +1532(requesting)X +1888(transaction)X +2262(protection)X +2609(with)X +2773(the)X +3 f +2893(db)X +1 f +2981(\(3\))X +3097(library)X +3333(or)X +3422(by)X +3524(adding)X +3764(appropriate)X +4152(calls)X +555 1383(to)N +646(the)X +773(transaction)X +1154(manager,)X +1480(buffer)X +1706(manager,)X +2032(lock)X +2199(manager,)X +2525(and)X +2670(log)X +2801(manager.)X +3147(The)X +3301(library)X +3543(routines)X +3829(may)X +3995(be)X +4099(linked)X +555 1473(into)N +708(the)X +834(host)X +995(application)X +1379(and)X +1523(called)X +1743(by)X +1851(subroutine)X +2217(interface,)X +2547(or)X +2642(they)X +2808(may)X +2974(reside)X +3194(in)X +3284(a)X +3348(separate)X +3640(server)X +3865(process.)X +4174(The)X +555 1563(server)N +772(architecture)X +1172(provides)X +1468(for)X +1582(network)X +1865(access)X +2091(and)X +2227(better)X +2430(protection)X +2775(mechanisms.)X +3 f +555 1749(2.)N +655(Related)X +938(Work)X +1 f +755 1872(There)N +1000(has)X +1164(been)X +1373(much)X +1608(discussion)X +1998(in)X +2117(recent)X +2371(years)X +2597(about)X +2831(new)X +3021(transaction)X +3429(models)X +3716(and)X +3888(architectures)X +555 1962 0.1172([SPEC88][NODI90][CHEN91][MOHA91].)AN +2009(Much)X +2220(of)X +2310(this)X +2448(work)X +2636(focuses)X +2900(on)X +3003(new)X +3160(ways)X +3348(to)X +3433(model)X +3656(transactions)X +4062(and)X +4201(the)X +555 2052(interactions)N +953(between)X +1245(them,)X +1449(while)X +1651(the)X +1772(work)X +1960(presented)X +2291(here)X +2453(focuses)X +2717(on)X +2820(the)X +2941(implementation)X +3466(and)X +3605(performance)X +4035(of)X +4125(tradi-)X +555 2142(tional)N +757(transaction)X +1129(techniques)X +1492(\(write-ahead)X +1919(logging)X +2183(and)X +2319(two-phase)X +2669(locking\))X +2956(on)X +3056(a)X +3112(standard)X +3404(operating)X +3727(system)X +3969(\(UNIX\).)X +755 2265(Such)N +947(traditional)X +1308(operating)X +1643(systems)X +1928(are)X +2059(often)X +2256(criticized)X +2587(for)X +2713(their)X +2892(inability)X +3190(to)X +3283(perform)X +3573(transaction)X +3956(processing)X +555 2355(adequately.)N +971([STON81])X +1342(cites)X +1517(three)X +1706(main)X +1894(areas)X +2088(of)X +2183(inadequate)X +2559(support:)X +2849(buffer)X +3074(management,)X +3532(the)X +3658(\256le)X +3788(system,)X +4058(and)X +4201(the)X +555 2445(process)N +823(structure.)X +1191(These)X +1410(arguments)X +1771(are)X +1897(summarized)X +2316(in)X +2405(table)X +2587(one.)X +2769(Fortunately,)X +3184(much)X +3388(has)X +3521(changed)X +3815(since)X +4006(1981.)X +4232(In)X +555 2535(the)N +683(area)X +848(of)X +945(buffer)X +1172(management,)X +1632(most)X +1817(UNIX)X +2048(systems)X +2331(provide)X +2606(the)X +2734(ability)X +2968(to)X +3060(memory)X +3357(map)X +3525(\256les,)X +3708(thus)X +3870(obviating)X +4201(the)X +555 2625(need)N +734(for)X +855(a)X +918(copy)X +1101(between)X +1396(kernel)X +1624(and)X +1766(user)X +1926(space.)X +2171(If)X +2251(a)X +2313(database)X +2616(system)X +2864(is)X +2943(going)X +3151(to)X +3239(use)X +3372(the)X +3496(\256le)X +3624(system)X +3872(buffer)X +4095(cache,)X +555 2715(then)N +719(a)X +781(system)X +1029(call)X +1171(is)X +1250(required.)X +1584(However,)X +1924(if)X +1998(buffering)X +2322(is)X +2400(provided)X +2710(at)X +2793(user)X +2952(level)X +3133(using)X +3331(shared)X +3566(memory,)X +3878(as)X +3970(in)X +4057(LIBTP,)X +555 2805(buffer)N +776(management)X +1210(is)X +1287(only)X +1452(as)X +1542(slow)X +1716(as)X +1806(access)X +2035(to)X +2120(shared)X +2353(memory)X +2643(and)X +2782(any)X +2921(replacement)X +3337(algorithm)X +3671(may)X +3832(be)X +3931(used.)X +4121(Since)X +555 2895(multiple)N +849(processes)X +1185(can)X +1325(access)X +1559(the)X +1685(shared)X +1923(data,)X +2105(prefetching)X +2499(may)X +2665(be)X +2769(accomplished)X +3238(by)X +3346(separate)X +3638(processes)X +3973(or)X +4067(threads)X +555 2985(whose)N +782(sole)X +932(purpose)X +1207(is)X +1281(to)X +1364(prefetch)X +1649(pages)X +1853(and)X +1990(wait)X +2149(on)X +2250(them.)X +2471(There)X +2680(is)X +2754(still)X +2894(no)X +2995(way)X +3150(to)X +3233(enforce)X +3496(write)X +3682(ordering)X +3975(other)X +4161(than)X +555 3075(keeping)N +829(pages)X +1032(in)X +1114(user)X +1268(memory)X +1555(and)X +1691(using)X +1884(the)X +3 f +2002(fsync)X +1 f +2180(\(3\))X +2294(system)X +2536(call)X +2672(to)X +2754(perform)X +3033(synchronous)X +3458(writes.)X +755 3198(In)N +845(the)X +966(area)X +1124(of)X +1214(\256le)X +1339(systems,)X +1635(the)X +1756(fast)X +1895(\256le)X +2020(system)X +2265(\(FFS\))X +2474([MCKU84])X +2871(allows)X +3103(allocation)X +3442(in)X +3527(units)X +3704(up)X +3806(to)X +3890(64KBytes)X +4232(as)X +555 3288(opposed)N +846(to)X +932(the)X +1054(4KByte)X +1327(and)X +1466(8KByte)X +1738(\256gures)X +1979(quoted)X +2220(in)X +2305([STON81].)X +2711(The)X +2859(measurements)X +3341(in)X +3426(this)X +3564(paper)X +3766(were)X +3946(taken)X +4143(from)X +555 3378(an)N +655(8KByte)X +928(FFS,)X +1104(but)X +1230(as)X +1320(LIBTP)X +1565(runs)X +1726(exclusively)X +2114(in)X +2199(user)X +2356(space,)X +2578(there)X +2762(is)X +2838(nothing)X +3105(to)X +3190(prevent)X +3454(it)X +3521(from)X +3700(being)X +3901(run)X +4031(on)X +4134(other)X +555 3468(UNIX)N +776(compatible)X +1152(\256le)X +1274(systems)X +1547(\(e.g.)X +1710(log-structured)X +2180([ROSE91],)X +2558(extent-based,)X +3004(or)X +3091(multi-block)X +3484([SELT91]\).)X +755 3591(Finally,)N +1029(with)X +1199(regard)X +1433(to)X +1523(the)X +1648(process)X +1916(structure,)X +2244(neither)X +2494(context)X +2757(switch)X +2993(time)X +3162(nor)X +3296(scheduling)X +3670(around)X +3920(semaphores)X +555 3681(seems)N +785(to)X +881(affect)X +1099(the)X +1231(system)X +1487(performance.)X +1968(However,)X +2317(the)X +2449(implementation)X +2984(of)X +3084(semaphores)X +3496(can)X +3641(impact)X +3892(performance)X +555 3771(tremendously.)N +1051(This)X +1213(is)X +1286(discussed)X +1613(in)X +1695(more)X +1880(detail)X +2078(in)X +2160(section)X +2407(4.3.)X +755 3894(The)N +908(Tuxedo)X +1181(system)X +1431(from)X +1615(AT&T)X +1861(is)X +1941(a)X +2004(transaction)X +2383(manager)X +2687(which)X +2910(coordinates)X +3307(distributed)X +3676(transaction)X +4055(commit)X +555 3984(from)N +738(a)X +801(variety)X +1051(of)X +1145(different)X +1449(local)X +1632(transaction)X +2011(managers.)X +2386(At)X +2493(this)X +2634(time,)X +2822(LIBTP)X +3070(does)X +3243(not)X +3371(have)X +3549(its)X +3650(own)X +3814(mechanism)X +4205(for)X +555 4074(distributed)N +942(commit)X +1231(processing,)X +1639(but)X +1786(could)X +2009(be)X +2130(used)X +2322(as)X +2434(a)X +2515(local)X +2716(transaction)X +3113(agent)X +3331(by)X +3455(systems)X +3752(such)X +3943(as)X +4054(Tuxedo)X +555 4164([ANDR89].)N +10 f +863 4393(i)N +870(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +903 4483(Buffer)N +1133(Management)X +10 f +1672(g)X +1 f +1720(Data)X +1892(must)X +2067(be)X +2163(copied)X +2397(between)X +2685(kernel)X +2906(space)X +3105(and)X +3241(user)X +3395(space.)X +10 f +1672 4573(g)N +1 f +1720(Buffer)X +1950(pool)X +2112(access)X +2338(is)X +2411(too)X +2533(slow.)X +10 f +1672 4663(g)N +1 f +1720(There)X +1928(is)X +2001(no)X +2101(way)X +2255(to)X +2337(request)X +2589(prefetch.)X +10 f +1672 4753(g)N +1 f +1720(Replacement)X +2159(is)X +2232(usually)X +2483(LRU)X +2663(which)X +2879(may)X +3037(be)X +3133(suboptimal)X +3508(for)X +3622(databases.)X +10 f +1672 4843(g)N +1 f +1720(There)X +1928(is)X +2001(no)X +2101(way)X +2255(to)X +2337(guarantee)X +2670(write)X +2855(ordering.)X +10 f +863 4853(i)N +870(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +903 4943(File)N +1047(System)X +10 f +1672(g)X +1 f +1720(Allocation)X +2078(is)X +2151(done)X +2327(in)X +2409(small)X +2602(blocks)X +2831(\(usually)X +3109(4K)X +3227(or)X +3314(8K\).)X +10 f +1672 5033(g)N +1 f +1720(Logical)X +1985(organization)X +2406(of)X +2493(\256les)X +2646(is)X +2719(redundantly)X +3122(expressed.)X +10 f +863 5043(i)N +870(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +903 5133(Process)N +1168(Structure)X +10 f +1672(g)X +1 f +1720(Context)X +1993(switching)X +2324(and)X +2460(message)X +2752(passing)X +3012(are)X +3131(too)X +3253(slow.)X +10 f +1672 5223(g)N +1 f +1720(A)X +1798(process)X +2059(may)X +2217(be)X +2313(descheduled)X +2730(while)X +2928(holding)X +3192(a)X +3248(semaphore.)X +10 f +863 5233(i)N +870(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +863(c)X +5193(c)Y +5113(c)Y +5033(c)Y +4953(c)Y +4873(c)Y +4793(c)Y +4713(c)Y +4633(c)Y +4553(c)Y +4473(c)Y +3990 5233(c)N +5193(c)Y +5113(c)Y +5033(c)Y +4953(c)Y +4873(c)Y +4793(c)Y +4713(c)Y +4633(c)Y +4553(c)Y +4473(c)Y +3 f +1156 5446(Table)N +1371(One:)X +1560(Shortcomings)X +2051(of)X +2138(UNIX)X +2363(transaction)X +2770(support)X +3056(cited)X +3241(in)X +3327([STON81].)X + +3 p +%%Page: 3 3 +10 s 10 xH 0 xS 3 f +1 f +755 630(The)N +901(transaction)X +1274(architecture)X +1675(presented)X +2004(in)X +2087([YOUN91])X +2474(is)X +2548(very)X +2712(similar)X +2955(to)X +3038(that)X +3179(implemented)X +3618(in)X +3701(the)X +3820(LIBTP.)X +4103(While)X +555 720([YOUN91])N +947(presents)X +1236(a)X +1298(model)X +1524(for)X +1644(providing)X +1981(transaction)X +2359(services,)X +2663(this)X +2803(paper)X +3007(focuses)X +3273(on)X +3378(the)X +3501(implementation)X +4028(and)X +4169(per-)X +555 810(formance)N +881(of)X +970(a)X +1028(particular)X +1358(system.)X +1642(In)X +1731(addition,)X +2034(we)X +2149(provide)X +2415(detailed)X +2690(comparisons)X +3116(with)X +3279(alternative)X +3639(solutions:)X +3970(traditional)X +555 900(UNIX)N +776(services)X +1055(and)X +1191(commercial)X +1590(database)X +1887(management)X +2317(systems.)X +3 f +555 1086(3.)N +655(Architecture)X +1 f +755 1209(The)N +906(library)X +1146(is)X +1224(designed)X +1534(to)X +1621(provide)X +1891(well)X +2054(de\256ned)X +2315(interfaces)X +2653(to)X +2740(the)X +2863(services)X +3147(required)X +3440(for)X +3559(transaction)X +3936(processing.)X +555 1299(These)N +777(services)X +1066(are)X +1195(recovery,)X +1527(concurrency)X +1955(control,)X +2232(and)X +2378(the)X +2506(management)X +2946(of)X +3043(shared)X +3283(data.)X +3487(First)X +3663(we)X +3787(will)X +3941(discuss)X +4201(the)X +555 1389(design)N +795(tradeoffs)X +1112(in)X +1205(the)X +1334(selection)X +1650(of)X +1748(recovery,)X +2081(concurrency)X +2510(control,)X +2787(and)X +2933(buffer)X +3160(management)X +3600(implementations,)X +4183(and)X +555 1479(then)N +713(we)X +827(will)X +971(present)X +1223(the)X +1341(overall)X +1584(library)X +1818(architecture)X +2218(and)X +2354(module)X +2614(descriptions.)X +3 f +555 1665(3.1.)N +715(Design)X +966(Tradeoffs)X +1 f +3 f +555 1851(3.1.1.)N +775(Crash)X +1004(Recovery)X +1 f +755 1974(The)N +909(recovery)X +1220(protocol)X +1516(is)X +1598(responsible)X +1992(for)X +2115(providing)X +2455(the)X +2582(transaction)X +2963(semantics)X +3308(discussed)X +3644(earlier.)X +3919(There)X +4136(are)X +4263(a)X +555 2064(wide)N +739(range)X +946(of)X +1041(recovery)X +1351(protocols)X +1677(available)X +1995([HAER83],)X +2395(but)X +2525(we)X +2647(can)X +2786(crudely)X +3054(divide)X +3281(them)X +3468(into)X +3619(two)X +3766(main)X +3953(categories.)X +555 2154(The)N +706(\256rst)X +856(category)X +1159(records)X +1422(all)X +1528(modi\256cations)X +1989(to)X +2077(the)X +2201(database)X +2504(in)X +2592(a)X +2653(separate)X +2942(\256le,)X +3089(and)X +3230(uses)X +3393(this)X +3533(\256le)X +3660(\(log\))X +3841(to)X +3928(back)X +4105(out)X +4232(or)X +555 2244(reapply)N +825(these)X +1019(modi\256cations)X +1483(if)X +1561(a)X +1626(transaction)X +2007(aborts)X +2232(or)X +2328(the)X +2455(system)X +2706(crashes.)X +3012(We)X +3153(call)X +3298(this)X +3442(set)X +3560(the)X +3 f +3687(logging)X +3963(protocols)X +1 f +4279(.)X +555 2334(The)N +703(second)X +949(category)X +1249(avoids)X +1481(the)X +1602(use)X +1732(of)X +1822(a)X +1881(log)X +2006(by)X +2109(carefully)X +2418(controlling)X +2792(when)X +2989(data)X +3146(are)X +3268(written)X +3518(to)X +3603(disk.)X +3799(We)X +3934(call)X +4073(this)X +4210(set)X +555 2424(the)N +3 f +673(non-logging)X +1096(protocols)X +1 f +1412(.)X +755 2547(Non-logging)N +1185(protocols)X +1504(hold)X +1666(dirty)X +1837(buffers)X +2085(in)X +2167(main)X +2347(memory)X +2634(or)X +2721(temporary)X +3071(\256les)X +3224(until)X +3390(commit)X +3654(and)X +3790(then)X +3948(force)X +4134(these)X +555 2637(pages)N +769(to)X +862(disk)X +1026(at)X +1115(transaction)X +1498(commit.)X +1813(While)X +2040(we)X +2165(can)X +2308(use)X +2446(temporary)X +2807(\256les)X +2971(to)X +3064(hold)X +3237(dirty)X +3418(pages)X +3631(that)X +3781(may)X +3949(need)X +4131(to)X +4223(be)X +555 2727(evicted)N +810(from)X +988(memory)X +1277(during)X +1508(a)X +1566(long-running)X +2006(transaction,)X +2400(the)X +2520(only)X +2684(user-level)X +3023(mechanism)X +3410(to)X +3494(force)X +3682(pages)X +3887(to)X +3971(disk)X +4126(is)X +4201(the)X +3 f +555 2817(fsync)N +1 f +733(\(2\))X +850(system)X +1095(call.)X +1274(Unfortunately,)X +3 f +1767(fsync)X +1 f +1945(\(2\))X +2062(is)X +2138(an)X +2237(expensive)X +2581(system)X +2826(call)X +2965(in)X +3050(that)X +3193(it)X +3260(forces)X +3480(all)X +3583(pages)X +3789(of)X +3879(a)X +3938(\256le)X +4062(to)X +4146(disk,)X +555 2907(and)N +691(transactions)X +1094(that)X +1234(manage)X +1504(more)X +1689(than)X +1847(one)X +1983(\256le)X +2105(must)X +2280(issue)X +2460(one)X +2596(call)X +2732(per)X +2855(\256le.)X +755 3030(In)N +853(addition,)X +3 f +1166(fsync)X +1 f +1344(\(2\))X +1469(provides)X +1776(no)X +1887(way)X +2051(to)X +2143(control)X +2400(the)X +2528(order)X +2728(in)X +2820(which)X +3046(dirty)X +3227(pages)X +3440(are)X +3569(written)X +3826(to)X +3918(disk.)X +4121(Since)X +555 3120(non-logging)N +976(protocols)X +1304(must)X +1489(sometimes)X +1861(order)X +2061(writes)X +2287(carefully)X +2603([SULL92],)X +2987(they)X +3155(are)X +3284(dif\256cult)X +3567(to)X +3659(implement)X +4030(on)X +4139(Unix)X +555 3210(systems.)N +868(As)X +977(a)X +1033(result,)X +1251(we)X +1365(have)X +1537(chosen)X +1780(to)X +1862(implement)X +2224(a)X +2280(logging)X +2544(protocol.)X +755 3333(Logging)N +1050(protocols)X +1372(may)X +1534(be)X +1634(categorized)X +2029(based)X +2236(on)X +2340(how)X +2502(information)X +2904(is)X +2981(logged)X +3223(\(physically)X +3602(or)X +3692(logically\))X +4022(and)X +4161(how)X +555 3423(much)N +767(is)X +854(logged)X +1106(\(before)X +1373(images,)X +1654(after)X +1836(images)X +2097(or)X +2198(both\).)X +2441(In)X +3 f +2542(physical)X +2855(logging)X +1 f +3103(,)X +3157(images)X +3417(of)X +3517(complete)X +3844(physical)X +4144(units)X +555 3513(\(pages)N +786(or)X +874(buffers\))X +1150(are)X +1270(recorded,)X +1593(while)X +1792(in)X +3 f +1875(logical)X +2118(logging)X +1 f +2387(a)X +2444(description)X +2820(of)X +2907(the)X +3025(operation)X +3348(is)X +3421(recorded.)X +3763(Therefore,)X +4121(while)X +555 3603(we)N +675(may)X +839(record)X +1071(entire)X +1280(pages)X +1489(in)X +1577(a)X +1639(physical)X +1932(log,)X +2080(we)X +2200(need)X +2378(only)X +2546(record)X +2777(the)X +2900(records)X +3162(being)X +3365(modi\256ed)X +3674(in)X +3761(a)X +3822(logical)X +4065(log.)X +4232(In)X +555 3693(fact,)N +718(physical)X +1006(logging)X +1271(can)X +1404(be)X +1501(thought)X +1766(of)X +1854(as)X +1942(a)X +1999(special)X +2243(case)X +2403(of)X +2491(logical)X +2730(logging,)X +3015(since)X +3201(the)X +3320 0.3125(``records'')AX +3686(that)X +3827(we)X +3942(log)X +4065(in)X +4148(logi-)X +555 3783(cal)N +673(logging)X +941(might)X +1151(be)X +1251(physical)X +1542(pages.)X +1789(Since)X +1991(logical)X +2233(logging)X +2501(is)X +2578(both)X +2743(more)X +2931(space-ef\256cient)X +3423(and)X +3562(more)X +3750(general,)X +4030(we)X +4147(have)X +555 3873(chosen)N +798(it)X +862(for)X +976(our)X +1103(logging)X +1367(protocol.)X +755 3996(In)N +3 f +843(before-image)X +1315(logging)X +1 f +1563(,)X +1604(we)X +1719(log)X +1842(a)X +1899(copy)X +2076(of)X +2164(the)X +2283(data)X +2438(before)X +2665(the)X +2784(update,)X +3039(while)X +3238(in)X +3 f +3321(after-image)X +3739(logging)X +1 f +3987(,)X +4027(we)X +4141(log)X +4263(a)X +555 4086(copy)N +740(of)X +836(the)X +963(data)X +1126(after)X +1303(the)X +1429(update.)X +1711(If)X +1793(we)X +1915(log)X +2045(only)X +2215(before-images,)X +2723(then)X +2889(there)X +3078(is)X +3159(suf\256cient)X +3485(information)X +3891(in)X +3981(the)X +4107(log)X +4237(to)X +555 4176(allow)N +761(us)X +860(to)X +3 f +950(undo)X +1 f +1150(the)X +1276(transaction)X +1656(\(go)X +1791(back)X +1971(to)X +2061(the)X +2187(state)X +2361(represented)X +2759(by)X +2866(the)X +2991(before-image\).)X +3514(However,)X +3876(if)X +3952(the)X +4077(system)X +555 4266(crashes)N +814(and)X +952(a)X +1010(committed)X +1374(transaction's)X +1806(changes)X +2087(have)X +2261(not)X +2385(reached)X +2658(the)X +2778(disk,)X +2953(we)X +3068(have)X +3241(no)X +3342(means)X +3568(to)X +3 f +3651(redo)X +1 f +3828(the)X +3947(transaction)X +555 4356(\(reapply)N +849(the)X +973(updates\).)X +1311(Therefore,)X +1675(logging)X +1945(only)X +2113(before-images)X +2599(necessitates)X +3004(forcing)X +3262(dirty)X +3439(pages)X +3648(at)X +3732(commit)X +4002(time.)X +4210(As)X +555 4446(mentioned)N +913(above,)X +1145(forcing)X +1397(pages)X +1600(at)X +1678(commit)X +1942(is)X +2015(considered)X +2383(too)X +2505(costly.)X +755 4569(If)N +834(we)X +953(log)X +1080(only)X +1247(after-images,)X +1694(then)X +1857(there)X +2043(is)X +2121(suf\256cient)X +2444(information)X +2847(in)X +2934(the)X +3057(log)X +3184(to)X +3271(allow)X +3474(us)X +3570(to)X +3657(redo)X +3825(the)X +3947(transaction)X +555 4659(\(go)N +687(forward)X +967(to)X +1054(the)X +1177(state)X +1348(represented)X +1743(by)X +1847(the)X +1969(after-image\),)X +2411(but)X +2537(we)X +2655(do)X +2759(not)X +2885(have)X +3061(the)X +3183(information)X +3585(required)X +3877(to)X +3963(undo)X +4147(tran-)X +555 4749(sactions)N +845(which)X +1073(aborted)X +1346(after)X +1526(dirty)X +1709(pages)X +1924(were)X +2113(written)X +2372(to)X +2466(disk.)X +2670(Therefore,)X +3039(logging)X +3314(only)X +3487(after-images)X +3920(necessitates)X +555 4839(holding)N +819(all)X +919(dirty)X +1090(buffers)X +1338(in)X +1420(main)X +1600(memory)X +1887(until)X +2053(commit)X +2317(or)X +2404(writing)X +2655(them)X +2835(to)X +2917(a)X +2973(temporary)X +3323(\256le.)X +755 4962(Since)N +956(neither)X +1202(constraint)X +1541(\(forcing)X +1823(pages)X +2029(on)X +2132(commit)X +2399(or)X +2489(buffering)X +2811(pages)X +3016(until)X +3184(commit\))X +3477(was)X +3624(feasible,)X +3916(we)X +4032(chose)X +4237(to)X +555 5052(log)N +683(both)X +851(before)X +1083(and)X +1225(after)X +1399(images.)X +1672(The)X +1823(only)X +1991(remaining)X +2342(consideration)X +2800(is)X +2879(when)X +3079(changes)X +3363(get)X +3486(written)X +3738(to)X +3825(disk.)X +4023(Changes)X +555 5142(affect)N +764(both)X +931(data)X +1090(pages)X +1298(and)X +1438(the)X +1560(log.)X +1726(If)X +1804(the)X +1926(changed)X +2218(data)X +2376(page)X +2552(is)X +2629(written)X +2880(before)X +3110(the)X +3232(log)X +3358(page,)X +3554(and)X +3694(the)X +3816(system)X +4062(crashes)X +555 5232(before)N +787(the)X +911(log)X +1039(page)X +1217(is)X +1296(written,)X +1569(the)X +1693(log)X +1820(will)X +1969(contain)X +2230(insuf\256cient)X +2615(information)X +3018(to)X +3105(undo)X +3290(the)X +3413(change.)X +3706(This)X +3873(violates)X +4147(tran-)X +555 5322(saction)N +803(semantics,)X +1160(since)X +1346(some)X +1536(changed)X +1825(data)X +1980(pages)X +2184(may)X +2343(not)X +2466(have)X +2638(been)X +2810(written,)X +3077(and)X +3213(the)X +3331(database)X +3628(cannot)X +3862(be)X +3958(restored)X +4237(to)X +555 5412(its)N +650(pre-transaction)X +1152(state.)X +755 5535(The)N +914(log)X +1050(record)X +1290(describing)X +1658(an)X +1768(update)X +2016(must)X +2205(be)X +2315(written)X +2576(to)X +2672(stable)X +2893(storage)X +3159(before)X +3398(the)X +3529(modi\256ed)X +3846(page.)X +4071(This)X +4246(is)X +3 f +555 5625(write-ahead)N +992(logging)X +1 f +1240(.)X +1307(If)X +1388(log)X +1517(records)X +1781(are)X +1907(safely)X +2126(written)X +2380(to)X +2469(disk,)X +2649(data)X +2810(pages)X +3020(may)X +3185(be)X +3288(written)X +3542(at)X +3627(any)X +3770(time)X +3939(afterwards.)X +555 5715(This)N +721(means)X +950(that)X +1094(the)X +1216(only)X +1382(\256le)X +1508(that)X +1652(ever)X +1815(needs)X +2022(to)X +2108(be)X +2208(forced)X +2438(to)X +2524(disk)X +2681(is)X +2758(the)X +2880(log.)X +3046(Since)X +3248(the)X +3370(log)X +3495(is)X +3571(append-only,)X +4015(modi\256ed)X + +4 p +%%Page: 4 4 +10 s 10 xH 0 xS 1 f +3 f +1 f +555 630(pages)N +760(always)X +1005(appear)X +1242(at)X +1322(the)X +1442(end)X +1580(and)X +1718(may)X +1878(be)X +1976(written)X +2224(to)X +2307(disk)X +2461(ef\256ciently)X +2807(in)X +2890(any)X +3027(\256le)X +3150(system)X +3393(that)X +3534(favors)X +3756(sequential)X +4102(order-)X +555 720(ing)N +677(\()X +2 f +704(e.g.)X +1 f +820(,)X +860(FFS,)X +1032(log-structured)X +1502(\256le)X +1624(system,)X +1886(or)X +1973(an)X +2069(extent-based)X +2495(system\).)X +3 f +555 906(3.1.2.)N +775(Concurrency)X +1245(Control)X +1 f +755 1029(The)N +918(concurrency)X +1354(control)X +1619(protocol)X +1923(is)X +2013(responsible)X +2415(for)X +2546(maintaining)X +2965(consistency)X +3376(in)X +3475(the)X +3610(presence)X +3929(of)X +4033(multiple)X +555 1119(accesses.)N +897(There)X +1114(are)X +1242(several)X +1499(alternative)X +1867(solutions)X +2183(such)X +2358(as)X +2453(locking,)X +2741(optimistic)X +3088(concurrency)X +3514(control)X +3769([KUNG81],)X +4183(and)X +555 1209(timestamp)N +912(ordering)X +1208([BERN80].)X +1619(Since)X +1821(optimistic)X +2164(methods)X +2459(and)X +2599(timestamp)X +2956(ordering)X +3252(are)X +3374(generally)X +3696(more)X +3884(complex)X +4183(and)X +555 1299(restrict)N +804(concurrency)X +1228(without)X +1498(eliminating)X +1888(starvation)X +2230(or)X +2323(deadlocks,)X +2690(we)X +2810(chose)X +3018(two-phase)X +3373(locking)X +3638(\(2PL\).)X +3890(Strict)X +4088(2PL)X +4246(is)X +555 1389(suboptimal)N +935(for)X +1054(certain)X +1297(data)X +1455(structures)X +1791(such)X +1962(as)X +2053(B-trees)X +2309(because)X +2588(it)X +2656(can)X +2792(limit)X +2966(concurrency,)X +3408(so)X +3503(we)X +3621(use)X +3752(a)X +3812(special)X +4059(locking)X +555 1479(protocol)N +842(based)X +1045(on)X +1145(one)X +1281(described)X +1609(in)X +1691([LEHM81].)X +755 1602(The)N +901(B-tree)X +1123(locking)X +1384(protocol)X +1672(we)X +1787(implemented)X +2226(releases)X +2502(locks)X +2691(at)X +2769(internal)X +3034(nodes)X +3241(in)X +3323(the)X +3441(tree)X +3582(as)X +3669(it)X +3733(descends.)X +4083(A)X +4161(lock)X +555 1692(on)N +658(an)X +757(internal)X +1025(page)X +1200(is)X +1276(always)X +1522(released)X +1808(before)X +2036(a)X +2094(lock)X +2254(on)X +2356(its)X +2453(child)X +2635(is)X +2710(obtained)X +3008(\(that)X +3177(is,)X +3272(locks)X +3463(are)X +3584(not)X +3 f +3708(coupled)X +1 f +3996([BAY77])X +555 1782(during)N +786(descent\).)X +1116(When)X +1330(a)X +1388(leaf)X +1531(\(or)X +1647(internal\))X +1941(page)X +2115(is)X +2190(split,)X +2369(a)X +2427(write)X +2614(lock)X +2774(is)X +2849(acquired)X +3148(on)X +3250(the)X +3370(parent)X +3593(before)X +3821(the)X +3941(lock)X +4100(on)X +4201(the)X +555 1872(just-split)N +855(page)X +1028(is)X +1102(released)X +1387(\(locks)X +1604(are)X +3 f +1724(coupled)X +1 f +2011(during)X +2241(ascent\).)X +2530(Write)X +2734(locks)X +2924(on)X +3025(internal)X +3291(pages)X +3495(are)X +3615(released)X +3899(immediately)X +555 1962(after)N +723(the)X +841(page)X +1013(is)X +1086(updated,)X +1380(but)X +1502(locks)X +1691(on)X +1791(leaf)X +1932(pages)X +2135(are)X +2254(held)X +2412(until)X +2578(the)X +2696(end)X +2832(of)X +2919(the)X +3037(transaction.)X +755 2085(Since)N +964(locks)X +1164(are)X +1294(released)X +1589(during)X +1828(descent,)X +2119(the)X +2247(structure)X +2558(of)X +2655(the)X +2783(tree)X +2934(may)X +3102(change)X +3360(above)X +3582(a)X +3648(node)X +3834(being)X +4042(used)X +4219(by)X +555 2175(some)N +752(process.)X +1061(If)X +1143(that)X +1291(process)X +1560(must)X +1743(later)X +1914(ascend)X +2161(the)X +2287(tree)X +2435(because)X +2717(of)X +2811(a)X +2874(page)X +3053(split,)X +3237(any)X +3380(such)X +3554(change)X +3809(must)X +3991(not)X +4120(cause)X +555 2265(confusion.)N +938(We)X +1077(use)X +1211(the)X +1336(technique)X +1675(described)X +2010(in)X +2099([LEHM81])X +2487(which)X +2710(exploits)X +2989(the)X +3113(ordering)X +3411(of)X +3504(data)X +3664(on)X +3770(a)X +3832(B-tree)X +4059(page)X +4237(to)X +555 2355(guarantee)N +888(that)X +1028(no)X +1128(process)X +1389(ever)X +1548(gets)X +1697(lost)X +1832(as)X +1919(a)X +1975(result)X +2173(of)X +2260(internal)X +2525(page)X +2697(updates)X +2962(made)X +3156(by)X +3256(other)X +3441(processes.)X +755 2478(If)N +836(a)X +899(transaction)X +1278(that)X +1425(updates)X +1697(a)X +1760(B-tree)X +1988(aborts,)X +2231(the)X +2356(user-visible)X +2757(changes)X +3043(to)X +3131(the)X +3255(tree)X +3402(must)X +3583(be)X +3685(rolled)X +3898(back.)X +4116(How-)X +555 2568(ever,)N +735(changes)X +1015(to)X +1097(the)X +1215(internal)X +1480(nodes)X +1687(of)X +1774(the)X +1892(tree)X +2033(need)X +2205(not)X +2327(be)X +2423(rolled)X +2630(back,)X +2822(since)X +3007(these)X +3192(pages)X +3395(contain)X +3651(no)X +3751(user-visible)X +4145(data.)X +555 2658(When)N +771(rolling)X +1008(back)X +1184(a)X +1244(transaction,)X +1640(we)X +1758(roll)X +1893(back)X +2069(all)X +2173(leaf)X +2318(page)X +2494(updates,)X +2783(but)X +2909(no)X +3013(internal)X +3281(insertions)X +3615(or)X +3705(page)X +3880(splits.)X +4111(In)X +4201(the)X +555 2748(worst)N +759(case,)X +944(this)X +1085(will)X +1235(leave)X +1431(a)X +1493(leaf)X +1640(page)X +1818(less)X +1964(than)X +2128(half)X +2279(full.)X +2456(This)X +2624(may)X +2788(cause)X +2993(poor)X +3166(space)X +3371(utilization,)X +3741(but)X +3869(does)X +4042(not)X +4170(lose)X +555 2838(user)N +709(data.)X +755 2961(Holding)N +1038(locks)X +1228(on)X +1329(leaf)X +1471(pages)X +1675(until)X +1842(transaction)X +2215(commit)X +2480(guarantees)X +2845(that)X +2986(no)X +3087(other)X +3273(process)X +3535(can)X +3668(insert)X +3866(or)X +3953(delete)X +4165(data)X +555 3051(that)N +711(has)X +854(been)X +1042(touched)X +1332(by)X +1448(this)X +1598(process.)X +1914(Rolling)X +2188(back)X +2375(insertions)X +2721(and)X +2872(deletions)X +3196(on)X +3311(leaf)X +3467(pages)X +3685(guarantees)X +4064(that)X +4219(no)X +555 3141(aborted)N +819(updates)X +1087(are)X +1209(ever)X +1371(visible)X +1607(to)X +1692(other)X +1880(transactions.)X +2326(Leaving)X +2612(page)X +2787(splits)X +2978(intact)X +3179(permits)X +3442(us)X +3536(to)X +3621(release)X +3867(internal)X +4134(write)X +555 3231(locks)N +744(early.)X +965(Thus)X +1145(transaction)X +1517(semantics)X +1853(are)X +1972(preserved,)X +2325(and)X +2461(locks)X +2650(are)X +2769(held)X +2927(for)X +3041(shorter)X +3284(periods.)X +755 3354(The)N +901(extra)X +1083(complexity)X +1464(introduced)X +1828(by)X +1929(this)X +2065(locking)X +2326(protocol)X +2614(appears)X +2881(substantial,)X +3264(but)X +3387(it)X +3452(is)X +3525(important)X +3856(for)X +3970(multi-user)X +555 3444(execution.)N +950(The)X +1118(bene\256ts)X +1410(of)X +1520(non-two-phase)X +2040(locking)X +2323(on)X +2446(B-trees)X +2721(are)X +2863(well)X +3044(established)X +3443(in)X +3548(the)X +3689(database)X +4009(literature)X +555 3534([BAY77],)N +899([LEHM81].)X +1320(If)X +1394(a)X +1450(process)X +1711(held)X +1869(locks)X +2058(until)X +2224(it)X +2288(committed,)X +2670(then)X +2828(a)X +2884(long-running)X +3322(update)X +3556(could)X +3754(lock)X +3912(out)X +4034(all)X +4134(other)X +555 3624(transactions)N +967(by)X +1076(preventing)X +1448(any)X +1593(other)X +1787(process)X +2057(from)X +2241(locking)X +2509(the)X +2635(root)X +2792(page)X +2972(of)X +3067(the)X +3193(tree.)X +3382(The)X +3535(B-tree)X +3764(locking)X +4032(protocol)X +555 3714(described)N +884(above)X +1096(guarantees)X +1460(that)X +1600(locks)X +1789(on)X +1889(internal)X +2154(pages)X +2357(are)X +2476(held)X +2634(for)X +2748(extremely)X +3089(short)X +3269(periods,)X +3545(thereby)X +3806(increasing)X +4156(con-)X +555 3804(currency.)N +3 f +555 3990(3.1.3.)N +775(Management)X +1245(of)X +1332(Shared)X +1596(Data)X +1 f +755 4113(Database)N +1075(systems)X +1353(permit)X +1587(many)X +1790(users)X +1980(to)X +2067(examine)X +2364(and)X +2505(update)X +2744(the)X +2866(same)X +3055(data)X +3213(concurrently.)X +3683(In)X +3774(order)X +3968(to)X +4054(provide)X +555 4203(this)N +702(concurrent)X +1078(access)X +1316(and)X +1464(enforce)X +1738(the)X +1868(write-ahead)X +2280(logging)X +2556(protocol)X +2855(described)X +3195(in)X +3289(section)X +3548(3.1.1,)X +3759(we)X +3884(use)X +4022(a)X +4089(shared)X +555 4293(memory)N +848(buffer)X +1071(manager.)X +1414(Not)X +1559(only)X +1726(does)X +1898(this)X +2038(provide)X +2308(the)X +2431(guarantees)X +2800(we)X +2919(require,)X +3192(but)X +3319(a)X +3380(user-level)X +3722(buffer)X +3944(manager)X +4246(is)X +555 4383(frequently)N +916(faster)X +1126(than)X +1295(using)X +1498(the)X +1626(\256le)X +1758(system)X +2010(buffer)X +2237(cache.)X +2491(Reads)X +2717(or)X +2814(writes)X +3040(involving)X +3376(the)X +3504(\256le)X +3636(system)X +3888(buffer)X +4115(cache)X +555 4473(often)N +746(require)X +1000(copying)X +1284(data)X +1444(between)X +1738(user)X +1898(and)X +2040(kernel)X +2266(space)X +2470(while)X +2673(a)X +2734(user-level)X +3076(buffer)X +3298(manager)X +3600(can)X +3737(return)X +3954(pointers)X +4237(to)X +555 4563(data)N +709(pages)X +912(directly.)X +1217(Additionally,)X +1661(if)X +1730(more)X +1915(than)X +2073(one)X +2209(process)X +2470(uses)X +2628(the)X +2746(same)X +2931(page,)X +3123(then)X +3281(fewer)X +3485(copies)X +3710(may)X +3868(be)X +3964(required.)X +3 f +555 4749(3.2.)N +715(Module)X +997(Architecture)X +1 f +755 4872(The)N +913(preceding)X +1262(sections)X +1552(described)X +1892(modules)X +2195(for)X +2321(managing)X +2669(the)X +2799(transaction)X +3183(log,)X +3337(locks,)X +3558(and)X +3706(a)X +3774(cache)X +3990(of)X +4089(shared)X +555 4962(buffers.)N +847(In)X +938(addition,)X +1244(we)X +1362(need)X +1538(to)X +1624(provide)X +1893(functionality)X +2326(for)X +2444(transaction)X +2 f +2819(begin)X +1 f +2997(,)X +2 f +3040(commit)X +1 f +3276(,)X +3319(and)X +2 f +3458(abort)X +1 f +3654(processing,)X +4040(necessi-)X +555 5052(tating)N +769(a)X +837(transaction)X +1221(manager.)X +1570(In)X +1669(order)X +1871(to)X +1965(arbitrate)X +2265(concurrent)X +2641(access)X +2879(to)X +2973(locks)X +3173(and)X +3320(buffers,)X +3599(we)X +3724(include)X +3991(a)X +4058(process)X +555 5142(management)N +995(module)X +1264(which)X +1489(manages)X +1799(a)X +1864(collection)X +2209(of)X +2305(semaphores)X +2713(used)X +2889(to)X +2980(block)X +3187(and)X +3332(release)X +3585(processes.)X +3962(Finally,)X +4237(in)X +555 5232(order)N +752(to)X +841(provide)X +1113(a)X +1176(simple,)X +1436(standard)X +1735(interface)X +2044(we)X +2165(have)X +2344(modi\256ed)X +2655(the)X +2780(database)X +3084(access)X +3317(routines)X +3602(\()X +3 f +3629(db)X +1 f +3717(\(3\)\).)X +3904(For)X +4041(the)X +4165(pur-)X +555 5322(poses)N +758(of)X +850(this)X +990(paper)X +1194(we)X +1313(call)X +1453(the)X +1575(modi\256ed)X +1883(package)X +2171(the)X +3 f +2293(Record)X +2567(Manager)X +1 f +2879(.)X +2943(Figure)X +3176(one)X +3316(shows)X +3540(the)X +3662(main)X +3846(interfaces)X +4183(and)X +555 5412(architecture)N +955(of)X +1042(LIBTP.)X + +5 p +%%Page: 5 5 +10 s 10 xH 0 xS 1 f +3 f +1 f +11 s +1851 1520(log_commit)N +2764 2077(buf_unpin)N +2764 1987(buf_get)N +3633 1408(buf_unpin)N +3633 1319(buf_pin)N +3633 1230(buf_get)N +3 f +17 s +1163 960(Txn)N +1430(M)X +1559(anager)X +2582(Record)X +3040(M)X +3169(anager)X +1 Dt +2363 726 MXY +0 355 Dl +1426 0 Dl +0 -355 Dl +-1426 0 Dl +3255 1616 MXY +0 535 Dl +534 0 Dl +0 -535 Dl +-534 0 Dl +2185 MX +0 535 Dl +535 0 Dl +0 -535 Dl +-535 0 Dl +1116 MX +0 535 Dl +534 0 Dl +0 -535 Dl +-534 0 Dl +726 MY +0 355 Dl +891 0 Dl +0 -355 Dl +-891 0 Dl +1 f +11 s +2207 1297(lock)N +2564 1386(log)N +865(unlock_all)X +1851 1609(log_unroll)N +1650 2508 MXY +0 178 Dl +1605 0 Dl +0 -178 Dl +-1605 0 Dl +1294 1616 MXY +19 -30 Dl +-19 11 Dl +-20 -11 Dl +20 30 Dl +0 -535 Dl +2319 2508 MXY +-22 -30 Dl +4 23 Dl +-18 14 Dl +36 -7 Dl +-936 -357 Dl +3277 2455(sleep_on)N +1405 1616 MXY +36 4 Dl +-18 -13 Dl +1 -22 Dl +-19 31 Dl +1070 -535 Dl +2631 2508 MXY +36 6 Dl +-18 -14 Dl +3 -22 Dl +-21 30 Dl +891 -357 Dl +1426 2455(sleep_on)N +3255 1884 MXY +-31 -20 Dl +11 20 Dl +-11 19 Dl +31 -19 Dl +-535 0 Dl +1554 2366(wake)N +3277(wake)X +2185 1884 MXY +-31 -20 Dl +12 20 Dl +-12 19 Dl +31 -19 Dl +-356 0 Dl +0 -803 Dl +3 f +17 s +1236 1851(Lock)N +1118 2030(M)N +1247(anager)X +2339 1851(Log)N +2187 2030(M)N +2316(anager)X +3333 1851(Buffer)N +3257 2030(M)N +3386(anager)X +3522 1616 MXY +20 -30 Dl +-20 11 Dl +-20 -11 Dl +20 30 Dl +0 -535 Dl +1950 2654(Process)N +2424(M)X +2553(anager)X +2542 1616 MXY +19 -30 Dl +-19 11 Dl +-20 -11 Dl +20 30 Dl +0 -535 Dl +1 f +11 s +2207 1364(unlock)N +2452 2508 MXY +20 -31 Dl +-20 11 Dl +-19 -11 Dl +19 31 Dl +0 -357 Dl +2497 2322(sleep_on)N +2497 2233(wake)N +3 Dt +-1 Ds +3 f +10 s +1790 2830(Figure)N +2037(1:)X +2144(Library)X +2435(module)X +2708(interfaces.)X +1 f +10 f +555 3010(h)N +579(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)X +3 f +555 3286(3.2.1.)N +775(The)X +928(Log)X +1081(Manager)X +1 f +755 3409(The)N +3 f +907(Log)X +1067(Manager)X +1 f +1406(enforces)X +1706(the)X +1831(write-ahead)X +2238(logging)X +2509(protocol.)X +2843(Its)X +2949(primitive)X +3268(operations)X +3628(are)X +2 f +3753(log)X +1 f +3855(,)X +2 f +3901(log_commit)X +1 f +4279(,)X +2 f +555 3499(log_read)N +1 f +844(,)X +2 f +889(log_roll)X +1 f +1171(and)X +2 f +1312(log_unroll)X +1 f +1649(.)X +1714(The)X +2 f +1864(log)X +1 f +1991(call)X +2132(performs)X +2447(a)X +2508(buffered)X +2806(write)X +2996(of)X +3088(the)X +3211(speci\256ed)X +3520(log)X +3646(record)X +3876(and)X +4016(returns)X +4263(a)X +555 3589(unique)N +809(log)X +947(sequence)X +1278(number)X +1559(\(LSN\).)X +1840(This)X +2017(LSN)X +2203(may)X +2376(then)X +2549(be)X +2660(used)X +2842(to)X +2939(retrieve)X +3220(a)X +3291(record)X +3532(from)X +3723(the)X +3856(log)X +3993(using)X +4201(the)X +2 f +555 3679(log_read)N +1 f +865(call.)X +1042(The)X +2 f +1188(log)X +1 f +1311(interface)X +1614(knows)X +1844(very)X +2008(little)X +2175(about)X +2374(the)X +2493(internal)X +2759(format)X +2993(of)X +3080(the)X +3198(log)X +3320(records)X +3577(it)X +3641(receives.)X +3965(Rather,)X +4219(all)X +555 3769(log)N +681(records)X +942(are)X +1065 0.4028(referenced)AX +1430(by)X +1534(a)X +1594(header)X +1833(structure,)X +2158(a)X +2218(log)X +2344(record)X +2574(type,)X +2756(and)X +2896(a)X +2956(character)X +3276(buffer)X +3497(containing)X +3859(the)X +3981(data)X +4138(to)X +4223(be)X +555 3859(logged.)N +834(The)X +980(log)X +1103(record)X +1330(type)X +1489(is)X +1563(used)X +1731(to)X +1814(call)X +1951(the)X +2070(appropriate)X +2457(redo)X +2621(and)X +2758(undo)X +2939(routines)X +3217(during)X +2 f +3446(abort)X +1 f +3639(and)X +2 f +3775(commit)X +1 f +4031(process-)X +555 3949(ing.)N +721(While)X +941(we)X +1059(have)X +1235(used)X +1406(the)X +3 f +1528(Log)X +1684(Manager)X +1 f +2019(to)X +2104(provide)X +2372(before)X +2601(and)X +2740(after)X +2911(image)X +3130(logging,)X +3417(it)X +3484(may)X +3645(also)X +3797(be)X +3896(used)X +4066(for)X +4183(any)X +555 4039(of)N +642(the)X +760(logging)X +1024(algorithms)X +1386(discussed.)X +755 4162(The)N +2 f +905(log_commit)X +1 f +1308(operation)X +1636(behaves)X +1920(exactly)X +2177(like)X +2322(the)X +2 f +2445(log)X +1 f +2572(operation)X +2900(but)X +3026(guarantees)X +3394(that)X +3538(the)X +3660(log)X +3786(has)X +3917(been)X +4093(forced)X +555 4252(to)N +643(disk)X +802(before)X +1034(returning.)X +1394(A)X +1478(discussion)X +1837(of)X +1930(our)X +2063(commit)X +2333(strategy)X +2613(appears)X +2884(in)X +2971(the)X +3094(implementation)X +3621(section)X +3873(\(section)X +4152(4.2\).)X +2 f +555 4342(Log_unroll)N +1 f +935(reads)X +1126(log)X +1249(records)X +1507(from)X +1684(the)X +1803(log,)X +1946(following)X +2278(backward)X +2611(transaction)X +2983(pointers)X +3261(and)X +3397(calling)X +3635(the)X +3753(appropriate)X +4139(undo)X +555 4432(routines)N +839(to)X +927(implement)X +1295(transaction)X +1673(abort.)X +1904(In)X +1997(a)X +2059(similar)X +2307(manner,)X +2 f +2594(log_roll)X +1 f +2877(reads)X +3073(log)X +3201(records)X +3464(sequentially)X +3877(forward,)X +4178(cal-)X +555 4522(ling)N +699(the)X +817(appropriate)X +1203(redo)X +1366(routines)X +1644(to)X +1726(recover)X +1988(committed)X +2350(transactions)X +2753(after)X +2921(a)X +2977(system)X +3219(crash.)X +3 f +555 4708(3.2.2.)N +775(The)X +928(Buffer)X +1171(Manager)X +1 f +755 4831(The)N +3 f +912(Buffer)X +1167(Manager)X +1 f +1511(uses)X +1681(a)X +1749(pool)X +1923(of)X +2022(shared)X +2264(memory)X +2563(to)X +2657(provide)X +2934(a)X +3002(least-recently-used)X +3641(\(LRU\))X +3886(block)X +4095(cache.)X +555 4921(Although)N +886(the)X +1013(current)X +1270(library)X +1513(provides)X +1818(an)X +1923(LRU)X +2112(cache,)X +2345(it)X +2418(would)X +2647(be)X +2752(simple)X +2994(to)X +3085(add)X +3229(alternate)X +3534(replacement)X +3955(policies)X +4232(as)X +555 5011(suggested)N +903(by)X +1015([CHOU85])X +1408(or)X +1507(to)X +1601(provide)X +1878(multiple)X +2176(buffer)X +2405(pools)X +2610(with)X +2784(different)X +3092(policies.)X +3412(Transactions)X +3853(request)X +4116(pages)X +555 5101(from)N +736(the)X +859(buffer)X +1081(manager)X +1383(and)X +1524(keep)X +1701(them)X +3 f +1886(pinned)X +1 f +2145(to)X +2232(ensure)X +2466(that)X +2610(they)X +2772(are)X +2895(not)X +3021(written)X +3272(to)X +3358(disk)X +3515(while)X +3717(they)X +3879(are)X +4002(in)X +4088(a)X +4148(logi-)X +555 5191(cally)N +732(inconsistent)X +1135(state.)X +1343(When)X +1556(page)X +1729(replacement)X +2143(is)X +2217(necessary,)X +2571(the)X +3 f +2689(Buffer)X +2932(Manager)X +1 f +3264(\256nds)X +3439(an)X +3535(unpinned)X +3853(page)X +4025(and)X +4161(then)X +555 5281(checks)N +794(with)X +956(the)X +3 f +1074(Log)X +1227(Manager)X +1 f +1559(to)X +1641(ensure)X +1871(that)X +2011(the)X +2129(write-ahead)X +2529(protocol)X +2816(is)X +2889(enforced.)X +3 f +555 5467(3.2.3.)N +775(The)X +928(Lock)X +1121(Manager)X +1 f +755 5590(The)N +3 f +901(Lock)X +1095(Manager)X +1 f +1428(supports)X +1720(general)X +1978(purpose)X +2253(locking)X +2514(\(single)X +2753(writer,)X +2986(multiple)X +3273(readers\))X +3553(which)X +3769(is)X +3842(currently)X +4152(used)X +555 5680(to)N +638(provide)X +904(two-phase)X +1254(locking)X +1514(and)X +1650(high)X +1812(concurrency)X +2230(B-tree)X +2451(locking.)X +2751(However,)X +3086(the)X +3204(general)X +3461(purpose)X +3735(nature)X +3956(of)X +4043(the)X +4161(lock)X + +6 p +%%Page: 6 6 +10 s 10 xH 0 xS 1 f +3 f +1 f +555 630(manager)N +857(provides)X +1158(the)X +1281(ability)X +1510(to)X +1597(support)X +1862(a)X +1923(variety)X +2171(of)X +2263(locking)X +2528(protocols.)X +2890(Currently,)X +3241(all)X +3345(locks)X +3538(are)X +3661(issued)X +3885(at)X +3967(the)X +4089(granu-)X +555 720(larity)N +747(of)X +837(a)X +896(page)X +1071(\(the)X +1219(size)X +1367(of)X +1457(a)X +1516(buffer)X +1736(in)X +1821(the)X +1942(buffer)X +2161(pool\))X +2352(which)X +2570(is)X +2645(identi\256ed)X +2969(by)X +3071(two)X +3213(4-byte)X +3440(integers)X +3716(\(a)X +3801(\256le)X +3925(id)X +4009(and)X +4147(page)X +555 810(number\).)N +898(This)X +1071(provides)X +1378(the)X +1507(necessary)X +1851(information)X +2259(to)X +2351(extend)X +2595(the)X +3 f +2723(Lock)X +2926(Manager)X +1 f +3268(to)X +3360(perform)X +3649(hierarchical)X +4059(locking)X +555 900([GRAY76].)N +982(The)X +1133(current)X +1387(implementation)X +1915(does)X +2088(not)X +2216(support)X +2482(locks)X +2677(at)X +2760(other)X +2950(granularities)X +3376(and)X +3517(does)X +3689(not)X +3816(promote)X +4108(locks;)X +555 990(these)N +740(are)X +859(obvious)X +1132(future)X +1344(additions)X +1657(to)X +1739(the)X +1857(system.)X +755 1113(If)N +831(an)X +929(incoming)X +1253(lock)X +1413(request)X +1667(cannot)X +1903(be)X +2001(granted,)X +2284(the)X +2404(requesting)X +2760(process)X +3023(is)X +3098(queued)X +3352(for)X +3467(the)X +3586(lock)X +3745(and)X +3882(descheduled.)X +555 1203(When)N +769(a)X +827(lock)X +987(is)X +1062(released,)X +1368(the)X +1488(wait)X +1647(queue)X +1860(is)X +1934(traversed)X +2250(and)X +2387(any)X +2524(newly)X +2741(compatible)X +3118(locks)X +3308(are)X +3428(granted.)X +3730(Locks)X +3947(are)X +4067(located)X +555 1293(via)N +680(a)X +743(\256le)X +872(and)X +1015(page)X +1194(hash)X +1368(table)X +1551(and)X +1694(are)X +1820(chained)X +2097(both)X +2266(by)X +2373(object)X +2595(and)X +2737(by)X +2843(transaction,)X +3241(facilitating)X +3614(rapid)X +3805(traversal)X +4108(of)X +4201(the)X +555 1383(lock)N +713(table)X +889(during)X +1118(transaction)X +1490(commit)X +1754(and)X +1890(abort.)X +755 1506(The)N +907(primary)X +1188(interfaces)X +1528(to)X +1617(the)X +1742(lock)X +1907(manager)X +2211(are)X +2 f +2337(lock)X +1 f +2471(,)X +2 f +2518(unlock)X +1 f +2732(,)X +2779(and)X +2 f +2922(lock_unlock_all)X +1 f +3434(.)X +2 f +3500(Lock)X +1 f +3682(obtains)X +3939(a)X +4001(new)X +4161(lock)X +555 1596(for)N +680(a)X +747(speci\256c)X +1023(object.)X +1290(There)X +1509(are)X +1638(also)X +1797(two)X +1947(variants)X +2231(of)X +2328(the)X +2 f +2456(lock)X +1 f +2620(request,)X +2 f +2902(lock_upgrade)X +1 f +3373(and)X +2 f +3519(lock_downgrade)X +1 f +4053(,)X +4103(which)X +555 1686(allow)N +755(the)X +875(caller)X +1076(to)X +1160(atomically)X +1519(trade)X +1701(a)X +1758(lock)X +1917(of)X +2005(one)X +2142(type)X +2301(for)X +2416(a)X +2473(lock)X +2632(of)X +2720(another.)X +2 f +3022(Unlock)X +1 f +3275(releases)X +3551(a)X +3608(speci\256c)X +3874(mode)X +4073(of)X +4161(lock)X +555 1776(on)N +655(a)X +711(speci\256c)X +976(object.)X +2 f +1232(Lock_unlock_all)X +1 f +1786(releases)X +2061(all)X +2161(the)X +2279(locks)X +2468(associated)X +2818(with)X +2980(a)X +3036(speci\256c)X +3301(transaction.)X +3 f +555 1962(3.2.4.)N +775(The)X +928(Process)X +1207(Manager)X +1 f +755 2085(The)N +3 f +900(Process)X +1179(Manager)X +1 f +1511(acts)X +1656(as)X +1743(a)X +1799(user-level)X +2136(scheduler)X +2464(to)X +2546(make)X +2740(processes)X +3068(wait)X +3226(on)X +3326(unavailable)X +3716(locks)X +3905(and)X +4041(pending)X +555 2175(buffer)N +778(cache)X +988(I/O.)X +1161(For)X +1297(each)X +1470(process,)X +1756(a)X +1817(semaphore)X +2190(is)X +2268(maintained)X +2649(upon)X +2834(which)X +3055(that)X +3200(process)X +3466(waits)X +3660(when)X +3859(it)X +3928(needs)X +4136(to)X +4223(be)X +555 2265(descheduled.)N +1014(When)X +1228(a)X +1286(process)X +1549(needs)X +1754(to)X +1838(be)X +1936(run,)X +2084(its)X +2180(semaphore)X +2549(is)X +2623(cleared,)X +2897(and)X +3034(the)X +3153(operating)X +3477(system)X +3720(reschedules)X +4116(it.)X +4201(No)X +555 2355(sophisticated)N +1002(scheduling)X +1378(algorithm)X +1718(is)X +1799(applied;)X +2085(if)X +2162(the)X +2288(lock)X +2454(for)X +2576(which)X +2800(a)X +2864(process)X +3133(was)X +3286(waiting)X +3554(becomes)X +3863(available,)X +4201(the)X +555 2445(process)N +824(is)X +905(made)X +1107(runnable.)X +1456(It)X +1533(would)X +1761(have)X +1941(been)X +2121(possible)X +2411(to)X +2501(change)X +2757(the)X +2883(kernel's)X +3170(process)X +3439(scheduler)X +3775(to)X +3865(interact)X +4134(more)X +555 2535(ef\256ciently)N +900(with)X +1062(the)X +1180(lock)X +1338(manager,)X +1655(but)X +1777(doing)X +1979(so)X +2070(would)X +2290(have)X +2462(compromised)X +2918(our)X +3045(commitment)X +3469(to)X +3551(a)X +3607(user-level)X +3944(package.)X +3 f +555 2721(3.2.5.)N +775(The)X +928(Transaction)X +1361(Manager)X +1 f +755 2844(The)N +3 f +901(Transaction)X +1335(Manager)X +1 f +1668(provides)X +1965(the)X +2084(standard)X +2377(interface)X +2680(of)X +2 f +2768(txn_begin)X +1 f +3084(,)X +2 f +3125(txn_commit)X +1 f +3499(,)X +3540(and)X +2 f +3676(txn_abort)X +1 f +3987(.)X +4047(It)X +4116(keeps)X +555 2934(track)N +742(of)X +835(all)X +941(active)X +1159(transactions,)X +1588(assigns)X +1845(unique)X +2089(transaction)X +2467(identi\256ers,)X +2833(and)X +2974(directs)X +3213(the)X +3336(abort)X +3526(and)X +3667(commit)X +3936(processing.)X +555 3024(When)N +772(a)X +2 f +833(txn_begin)X +1 f +1174(is)X +1252(issued,)X +1497(the)X +3 f +1620(Transaction)X +2058(Manager)X +1 f +2395(assigns)X +2651(the)X +2773(next)X +2935(available)X +3249(transaction)X +3625(identi\256er,)X +3958(allocates)X +4263(a)X +555 3114(per-process)N +948(transaction)X +1322(structure)X +1625(in)X +1709(shared)X +1941(memory,)X +2249(increments)X +2622(the)X +2741(count)X +2940(of)X +3028(active)X +3241(transactions,)X +3665(and)X +3802(returns)X +4046(the)X +4165(new)X +555 3204(transaction)N +937(identi\256er)X +1256(to)X +1348(the)X +1476(calling)X +1724(process.)X +2034(The)X +2188(in-memory)X +2573(transaction)X +2954(structure)X +3264(contains)X +3560(a)X +3625(pointer)X +3881(into)X +4034(the)X +4161(lock)X +555 3294(table)N +734(for)X +851(locks)X +1043(held)X +1204(by)X +1307(this)X +1445(transaction,)X +1840(the)X +1961(last)X +2095(log)X +2220(sequence)X +2538(number,)X +2826(a)X +2885(transaction)X +3260(state)X +3430(\()X +2 f +3457(idle)X +1 f +(,)S +2 f +3620(running)X +1 f +3873(,)X +2 f +3915(aborting)X +1 f +4190(,)X +4232(or)X +2 f +555 3384(committing\))N +1 f +942(,)X +982(an)X +1078(error)X +1255(code,)X +1447(and)X +1583(a)X +1639(semaphore)X +2007(identi\256er.)X +755 3507(At)N +859(commit,)X +1147(the)X +3 f +1269(Transaction)X +1706(Manager)X +1 f +2042(calls)X +2 f +2213(log_commit)X +1 f +2615(to)X +2700(record)X +2929(the)X +3050(end)X +3189(of)X +3279(transaction)X +3654(and)X +3793(to)X +3878(\257ush)X +4056(the)X +4177(log.)X +555 3597(Then)N +743(it)X +810(directs)X +1047(the)X +3 f +1168(Lock)X +1364(Manager)X +1 f +1699(to)X +1784(release)X +2031(all)X +2134(locks)X +2325(associated)X +2677(with)X +2841(the)X +2961(given)X +3161(transaction.)X +3575(If)X +3651(a)X +3709(transaction)X +4083(aborts,)X +555 3687(the)N +3 f +680(Transaction)X +1120(Manager)X +1 f +1459(calls)X +1633(on)X +2 f +1739(log_unroll)X +1 f +2102(to)X +2190(read)X +2355(the)X +2479(transaction's)X +2915(log)X +3043(records)X +3306(and)X +3448(undo)X +3634(any)X +3776(modi\256cations)X +4237(to)X +555 3777(the)N +673(database.)X +1010(As)X +1119(in)X +1201(the)X +1319(commit)X +1583(case,)X +1762(it)X +1826(then)X +1984(calls)X +2 f +2151(lock_unlock_all)X +1 f +2683(to)X +2765(release)X +3009(the)X +3127(transaction's)X +3557(locks.)X +3 f +555 3963(3.2.6.)N +775(The)X +928(Record)X +1198(Manager)X +1 f +755 4086(The)N +3 f +919(Record)X +1208(Manager)X +1 f +1559(supports)X +1869(the)X +2006(abstraction)X +2397(of)X +2503(reading)X +2783(and)X +2938(writing)X +3208(records)X +3484(to)X +3585(a)X +3660(database.)X +3996(We)X +4147(have)X +555 4176(modi\256ed)N +861(the)X +981(the)X +1101(database)X +1399(access)X +1626(routines)X +3 f +1905(db)X +1 f +1993(\(3\))X +2108([BSD91])X +2418(to)X +2501(call)X +2638(the)X +2757(log,)X +2900(lock,)X +3079(and)X +3216(buffer)X +3434(managers.)X +3803(In)X +3891(order)X +4082(to)X +4165(pro-)X +555 4266(vide)N +718(functionality)X +1152(to)X +1239(perform)X +1523(undo)X +1708(and)X +1849(redo,)X +2037(the)X +3 f +2160(Record)X +2434(Manager)X +1 f +2770(de\256nes)X +3021(a)X +3081(collection)X +3421(of)X +3512(log)X +3638(record)X +3868(types)X +4061(and)X +4201(the)X +555 4356(associated)N +920(undo)X +1115(and)X +1266(redo)X +1444(routines.)X +1777(The)X +3 f +1937(Log)X +2105(Manager)X +1 f +2452(performs)X +2777(a)X +2848(table)X +3039(lookup)X +3296(on)X +3411(the)X +3543(record)X +3783(type)X +3955(to)X +4051(call)X +4201(the)X +555 4446(appropriate)N +951(routines.)X +1299(For)X +1440(example,)X +1762(the)X +1890(B-tree)X +2121(access)X +2356(method)X +2625(requires)X +2913(two)X +3062(log)X +3193(record)X +3428(types:)X +3648(insert)X +3855(and)X +4000(delete.)X +4241(A)X +555 4536(replace)N +808(operation)X +1131(is)X +1204(implemented)X +1642(as)X +1729(a)X +1785(delete)X +1997(followed)X +2302(by)X +2402(an)X +2498(insert)X +2696(and)X +2832(is)X +2905(logged)X +3143(accordingly.)X +3 f +555 4722(3.3.)N +715(Application)X +1134(Architectures)X +1 f +755 4845(The)N +907(structure)X +1215(of)X +1309(LIBTP)X +1558(allows)X +1794(application)X +2177(designers)X +2507(to)X +2596(trade)X +2784(off)X +2905(performance)X +3339(and)X +3481(protection.)X +3872(Since)X +4076(a)X +4138(large)X +555 4935(portion)N +810(of)X +901(LIBTP's)X +1205(functionality)X +1638(is)X +1715(provided)X +2024(by)X +2128(managing)X +2468(structures)X +2804(in)X +2889(shared)X +3122(memory,)X +3432(its)X +3530(structures)X +3865(are)X +3987(subject)X +4237(to)X +555 5025(corruption)N +926(by)X +1043(applications)X +1467(when)X +1678(the)X +1813(library)X +2064(is)X +2154(linked)X +2391(directly)X +2673(with)X +2852(the)X +2987(application.)X +3420(For)X +3568(this)X +3720(reason,)X +3987(LIBTP)X +4246(is)X +555 5115(designed)N +864(to)X +950(allow)X +1152(compilation)X +1558(into)X +1706(a)X +1766(separate)X +2053(server)X +2273(process)X +2537(which)X +2756(may)X +2917(be)X +3016(accessed)X +3321(via)X +3442(a)X +3501(socket)X +3729(interface.)X +4094(In)X +4184(this)X +555 5205(way)N +712(LIBTP's)X +1015(data)X +1172(structures)X +1507(are)X +1629(protected)X +1951(from)X +2130(application)X +2509(code,)X +2704(but)X +2829(communication)X +3349(overhead)X +3666(is)X +3741(increased.)X +4107(When)X +555 5295(applications)N +975(are)X +1107(trusted,)X +1377(LIBTP)X +1631(may)X +1801(be)X +1909(compiled)X +2239(directly)X +2516(into)X +2672(the)X +2802(application)X +3190(providing)X +3533(improved)X +3872(performance.)X +555 5385(Figures)N +815(two)X +955(and)X +1091(three)X +1272(show)X +1461(the)X +1579(two)X +1719(alternate)X +2016(application)X +2392(architectures.)X +755 5508(There)N +964(are)X +1084(potentially)X +1447(two)X +1588(modes)X +1818(in)X +1901(which)X +2118(one)X +2255(might)X +2462(use)X +2590(LIBTP)X +2833(in)X +2916(a)X +2972(server)X +3189(based)X +3392(architecture.)X +3832(In)X +3919(the)X +4037(\256rst,)X +4201(the)X +555 5598(server)N +778(would)X +1004(provide)X +1275(the)X +1399(capability)X +1741(to)X +1829(respond)X +2109(to)X +2197(requests)X +2486(to)X +2574(each)X +2747(of)X +2839(the)X +2962(low)X +3107(level)X +3288(modules)X +3584(\(lock,)X +3794(log,)X +3941(buffer,)X +4183(and)X +555 5688(transaction)N +944(managers\).)X +1356(Unfortunately,)X +1863(the)X +1998(performance)X +2442(of)X +2546(such)X +2730(a)X +2803(system)X +3062(is)X +3152(likely)X +3371(to)X +3470(be)X +3583(blindingly)X +3947(slow)X +4134(since)X + +7 p +%%Page: 7 7 +10 s 10 xH 0 xS 1 f +3 f +1 f +1 Dt +1864 1125 MXY +15 -26 Dl +-15 10 Dl +-14 -10 Dl +14 26 Dl +0 -266 Dl +1315 1125 MXY +15 -26 Dl +-15 10 Dl +-14 -10 Dl +14 26 Dl +0 -266 Dl +3 Dt +1133 1125 MXY +0 798 Dl +931 0 Dl +0 -798 Dl +-931 0 Dl +1 Dt +1266 1257 MXY +0 133 Dl +665 0 Dl +0 -133 Dl +-665 0 Dl +3 f +8 s +1513 1351(driver)N +1502 1617(LIBTP)N +1266 1390 MXY +0 400 Dl +665 0 Dl +0 -400 Dl +-665 0 Dl +3 Dt +1133 726 MXY +0 133 Dl +931 0 Dl +0 -133 Dl +-931 0 Dl +1 f +1029 1098(txn_abort)N +964 1015(txn_commit)N +1018 932(txn_begin)N +1910 1015(db_ops)N +3 f +1308 820(Application)N +1645(Program)X +1398 1218(Server)N +1594(Process)X +1 f +1390 986(socket)N +1569(interface)X +1 Dt +1848 967 MXY +-23 -14 Dl +8 14 Dl +-8 15 Dl +23 -15 Dl +-50 0 Dl +1324 MX +23 15 Dl +-9 -15 Dl +9 -14 Dl +-23 14 Dl +50 0 Dl +3 Dt +2862 859 MXY +0 1064 Dl +932 0 Dl +0 -1064 Dl +-932 0 Dl +1 Dt +3178 1390 MXY +24 -12 Dl +-17 0 Dl +-8 -15 Dl +1 27 Dl +150 -265 Dl +3494 1390 MXY +0 -27 Dl +-8 15 Dl +-16 1 Dl +24 11 Dl +-166 -265 Dl +3 f +3232 1617(LIBTP)N +2995 1390 MXY +0 400 Dl +666 0 Dl +0 -400 Dl +-666 0 Dl +992 MY +0 133 Dl +666 0 Dl +0 -133 Dl +-666 0 Dl +3168 1086(Application)N +1 f +2939 1201(txn_begin)N +2885 1284(txn_commit)N +2950 1368(txn_abort)N +3465 1284(db_ops)N +3 f +3155 766(Single)N +3339(Process)X +3 Dt +-1 Ds +811 2100(Figure)N +1023(2:)X +1107(Server)X +1318(Architecture.)X +1 f +1727(In)X +1811(this)X +1934(con\256guration,)X +811 2190(the)N +916(library)X +1113(is)X +1183(loaded)X +1380(into)X +1507(a)X +1562(server)X +1744(process)X +1962(which)X +2145(is)X +2214(ac-)X +811 2280(cessed)N +993(via)X +1087(a)X +1131(socket)X +1310(interface.)X +3 f +2563 2100(Figure)N +2803(3:)X +2914(Single)X +3140(Process)X +3403(Architecture.)X +1 f +3839(In)X +3950(this)X +2563 2190(con\256guration,)N +2948(the)X +3053(library)X +3250(routines)X +3483(are)X +3587(loaded)X +3784(as)X +3864(part)X +3990(of)X +2563 2280(the)N +2657(application)X +2957(and)X +3065(accessed)X +3303(via)X +3397(a)X +3441(subroutine)X +3727(interface.)X +10 s +10 f +555 2403(h)N +579(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)X +1 f +555 2679(modifying)N +909(a)X +966(piece)X +1157(of)X +1245(data)X +1400(would)X +1621(require)X +1870(three)X +2051(or)X +2138(possibly)X +2424(four)X +2578(separate)X +2862(communications:)X +3433(one)X +3569(to)X +3651(lock)X +3809(the)X +3927(data,)X +4101(one)X +4237(to)X +555 2769(obtain)N +781(the)X +905(data,)X +1085(one)X +1227(to)X +1315(log)X +1443(the)X +1567(modi\256cation,)X +2017(and)X +2159(possibly)X +2451(one)X +2593(to)X +2681(transmit)X +2969(the)X +3093(modi\256ed)X +3403(data.)X +3583(Figure)X +3817(four)X +3976(shows)X +4201(the)X +555 2859(relative)N +826(performance)X +1263(for)X +1387(retrieving)X +1728(a)X +1793(single)X +2013(record)X +2248(using)X +2450(the)X +2577(record)X +2812(level)X +2997(call)X +3142(versus)X +3376(using)X +3578(the)X +3705(lower)X +3917(level)X +4102(buffer)X +555 2949(management)N +987(and)X +1125(locking)X +1387(calls.)X +1616(The)X +1763(2:1)X +1887(ratio)X +2056(observed)X +2367(in)X +2450(the)X +2569(single)X +2781(process)X +3043(case)X +3203(re\257ects)X +3456(the)X +3575(additional)X +3916(overhead)X +4232(of)X +555 3039(parsing)N +819(eight)X +1006(commands)X +1380(rather)X +1595(than)X +1760(one)X +1903(while)X +2108(the)X +2233(3:1)X +2362(ratio)X +2536(observed)X +2853(in)X +2942(the)X +3067(client/server)X +3491(architecture)X +3898(re\257ects)X +4157(both)X +555 3129(the)N +679(parsing)X +941(and)X +1083(the)X +1207(communication)X +1731(overheard.)X +2118(Although)X +2445(there)X +2631(may)X +2794(be)X +2895(applications)X +3307(which)X +3528(could)X +3731(tolerate)X +3997(such)X +4169(per-)X +555 3219(formance,)N +904(it)X +973(seems)X +1194(far)X +1309(more)X +1499(feasible)X +1774(to)X +1861(support)X +2126(a)X +2187(higher)X +2417(level)X +2597(interface,)X +2923(such)X +3094(as)X +3185(that)X +3329(provided)X +3638(by)X +3742(a)X +3802(query)X +4009(language)X +555 3309(\()N +2 f +582(e.g.)X +1 f +718(SQL)X +889([SQL86]\).)X +755 3432(Although)N +1081(LIBTP)X +1327(does)X +1498(not)X +1624(have)X +1800(an)X +1900(SQL)X +2075(parser,)X +2316(we)X +2433(have)X +2608(built)X +2777(a)X +2836(server)X +3056(application)X +3435(using)X +3631(the)X +3752(toolkit)X +3983(command)X +555 3522(language)N +882(\(TCL\))X +1124([OUST90].)X +1544(The)X +1706(server)X +1940(supports)X +2248(a)X +2321(command)X +2674(line)X +2831(interface)X +3150(similar)X +3409(to)X +3508(the)X +3643(subroutine)X +4017(interface)X +555 3612(de\256ned)N +811(in)X +3 f +893(db)X +1 f +981(\(3\).)X +1135(Since)X +1333(it)X +1397(is)X +1470(based)X +1673(on)X +1773(TCL,)X +1964(it)X +2028(provides)X +2324(control)X +2571(structures)X +2903(as)X +2990(well.)X +3 f +555 3798(4.)N +655(Implementation)X +1 f +3 f +555 3984(4.1.)N +715(Locking)X +1014(and)X +1162(Deadlock)X +1502(Detection)X +1 f +755 4107(LIBTP)N +1007(uses)X +1175(two-phase)X +1535(locking)X +1805(for)X +1929(user)X +2093(data.)X +2297(Strictly)X +2562(speaking,)X +2897(the)X +3024(two)X +3173(phases)X +3416(in)X +3507(two-phase)X +3866(locking)X +4135(are)X +4263(a)X +3 f +555 4197(grow)N +1 f +756(phase,)X +986(during)X +1221(which)X +1443(locks)X +1638(are)X +1763(acquired,)X +2086(and)X +2228(a)X +3 f +2290(shrink)X +1 f +2537(phase,)X +2766(during)X +3001(which)X +3223(locks)X +3418(are)X +3543(released.)X +3873(No)X +3997(lock)X +4161(may)X +555 4287(ever)N +720(be)X +822(acquired)X +1124(during)X +1358(the)X +1481(shrink)X +1706(phase.)X +1954(The)X +2104(grow)X +2294(phase)X +2502(lasts)X +2669(until)X +2840(the)X +2963(\256rst)X +3112(release,)X +3381(which)X +3602(marks)X +3823(the)X +3946(start)X +4109(of)X +4201(the)X +555 4377(shrink)N +780(phase.)X +1028(In)X +1120(practice,)X +1420(the)X +1543(grow)X +1733(phase)X +1941(lasts)X +2108(for)X +2227(the)X +2350(duration)X +2642(of)X +2734(a)X +2795(transaction)X +3172(in)X +3259(LIBTP)X +3506(and)X +3647(in)X +3734(commercial)X +4138(data-)X +555 4467(base)N +721(systems.)X +1037(The)X +1184(shrink)X +1406(phase)X +1611(takes)X +1798(place)X +1990(during)X +2221(transaction)X +2595(commit)X +2861(or)X +2950(abort.)X +3177(This)X +3341(means)X +3568(that)X +3710(locks)X +3901(are)X +4022(acquired)X +555 4557(on)N +655(demand)X +929(during)X +1158(the)X +1276(lifetime)X +1545(of)X +1632(a)X +1688(transaction,)X +2080(and)X +2216(held)X +2374(until)X +2540(commit)X +2804(time,)X +2986(at)X +3064(which)X +3280(point)X +3464(all)X +3564(locks)X +3753(are)X +3872(released.)X +755 4680(If)N +832(multiple)X +1121(transactions)X +1527(are)X +1649(active)X +1864(concurrently,)X +2313(deadlocks)X +2657(can)X +2792(occur)X +2994(and)X +3133(must)X +3311(be)X +3410(detected)X +3701(and)X +3840(resolved.)X +4174(The)X +555 4770(lock)N +715(table)X +893(can)X +1027(be)X +1125(thought)X +1391(of)X +1480(as)X +1569(a)X +1627(representation)X +2104(of)X +2193(a)X +2251(directed)X +2532(graph.)X +2777(The)X +2924(nodes)X +3133(in)X +3216(the)X +3335(graph)X +3539(are)X +3659(transactions.)X +4103(Edges)X +555 4860(represent)N +878(the)X +3 f +1004(waits-for)X +1 f +1340(relation)X +1613(between)X +1909(transactions;)X +2342(if)X +2419(transaction)X +2 f +2799(A)X +1 f +2876(is)X +2957(waiting)X +3225(for)X +3347(a)X +3411(lock)X +3577(held)X +3743(by)X +3851(transaction)X +2 f +4230(B)X +1 f +4279(,)X +555 4950(then)N +716(a)X +775(directed)X +1057(edge)X +1232(exists)X +1437(from)X +2 f +1616(A)X +1 f +1687(to)X +2 f +1771(B)X +1 f +1842(in)X +1926(the)X +2046(graph.)X +2291(A)X +2371(deadlock)X +2683(exists)X +2887(if)X +2958(a)X +3016(cycle)X +3208(appears)X +3476(in)X +3560(the)X +3680(graph.)X +3925(By)X +4040(conven-)X +555 5040(tion,)N +719(no)X +819(transaction)X +1191(ever)X +1350(waits)X +1539(for)X +1653(a)X +1709(lock)X +1867(it)X +1931(already)X +2188(holds,)X +2401(so)X +2492(re\257exive)X +2793(edges)X +2996(are)X +3115(impossible.)X +755 5163(A)N +836(distinguished)X +1285(process)X +1549(monitors)X +1856(the)X +1977(lock)X +2138(table,)X +2337(searching)X +2668(for)X +2785(cycles.)X +3048(The)X +3195(frequency)X +3539(with)X +3703(which)X +3921(this)X +4058(process)X +555 5253(runs)N +716(is)X +792(user-settable;)X +1243(for)X +1360(the)X +1481(multi-user)X +1833(tests)X +1998(discussed)X +2328(in)X +2413(section)X +2663(5.1.2,)X +2866(it)X +2933(has)X +3063(been)X +3238(set)X +3350(to)X +3435(wake)X +3628(up)X +3731(every)X +3932(second,)X +4197(but)X +555 5343(more)N +742(sophisticated)X +1182(schedules)X +1516(are)X +1636(certainly)X +1938(possible.)X +2261(When)X +2474(a)X +2531(cycle)X +2722(is)X +2796(detected,)X +3105(one)X +3242(of)X +3330(the)X +3449(transactions)X +3853(in)X +3936(the)X +4055(cycle)X +4246(is)X +555 5433(nominated)N +917(and)X +1057(aborted.)X +1362(When)X +1578(the)X +1700(transaction)X +2076(aborts,)X +2315(it)X +2382(rolls)X +2547(back)X +2722(its)X +2820(changes)X +3102(and)X +3241(releases)X +3519(its)X +3617(locks,)X +3829(thereby)X +4093(break-)X +555 5523(ing)N +677(the)X +795(cycle)X +985(in)X +1067(the)X +1185(graph.)X + +8 p +%%Page: 8 8 +10 s 10 xH 0 xS 1 f +3 f +1 f +4 Ds +1 Dt +1866 865 MXY +1338 0 Dl +1866 1031 MXY +1338 0 Dl +1866 1199 MXY +1338 0 Dl +1866 1366 MXY +1338 0 Dl +1866 1533 MXY +1338 0 Dl +1866 1701 MXY +1338 0 Dl +-1 Ds +5 Dt +1866 1868 MXY +1338 0 Dl +1 Dt +1 Di +2981 MX + 2981 1868 lineto + 2981 1575 lineto + 3092 1575 lineto + 3092 1868 lineto + 2981 1868 lineto +closepath 21 2981 1575 3092 1868 Dp +2646 MX + 2646 1868 lineto + 2646 949 lineto + 2758 949 lineto + 2758 1868 lineto + 2646 1868 lineto +closepath 14 2646 949 2758 1868 Dp +2312 MX + 2312 1868 lineto + 2312 1701 lineto + 2423 1701 lineto + 2423 1868 lineto + 2312 1868 lineto +closepath 3 2312 1701 2423 1868 Dp +1977 MX + 1977 1868 lineto + 1977 1512 lineto + 2089 1512 lineto + 2089 1868 lineto + 1977 1868 lineto +closepath 19 1977 1512 2089 1868 Dp +3 f +2640 2047(Client/Server)N +1957(Single)X +2185(Process)X +7 s +2957 1957(record)N +2570(component)X +2289(record)X +1890(components)X +1733 1724(.1)N +1733 1556(.2)N +1733 1389(.3)N +1733 1222(.4)N +1733 1055(.5)N +1733 889(.6)N +1590 726(Elapsed)N +1794(Time)X +1613 782(\(in)N +1693(seconds\))X +3 Dt +-1 Ds +8 s +555 2255(Figure)N +756(4:)X +829(Comparison)X +1187(of)X +1260(High)X +1416(and)X +1540(Low)X +1681(Level)X +1850(Interfaces.)X +1 f +2174(Elapsed)X +2395(time)X +2528(in)X +2597(seconds)X +2818(to)X +2887(perform)X +3111(a)X +3158(single)X +3330(record)X +3511(retrieval)X +3742(from)X +3885(a)X +3932(command)X +4203(line)X +555 2345(\(rather)N +751(than)X +888(a)X +943(procedural)X +1241(interface\))X +1510(is)X +1579(shown)X +1772(on)X +1862(the)X +1966(y)X +2024(axis.)X +2185(The)X +2310(``component'')X +2704(numbers)X +2950(re\257ect)X +3135(the)X +3239(timings)X +3458(when)X +3622(the)X +3726(record)X +3914(is)X +3983(retrieved)X +4235(by)X +555 2435(separate)N +785(calls)X +924(to)X +996(the)X +1096(lock)X +1228(manager)X +1469(and)X +1583(buffer)X +1760(manager)X +2001(while)X +2165(the)X +2264(``record'')X +2531(timings)X +2745(were)X +2889(obtained)X +3130(by)X +3215(using)X +3375(a)X +3424(single)X +3598(call)X +3711(to)X +3782(the)X +3881(record)X +4064(manager.)X +555 2525(The)N +674(2:1)X +776(ratio)X +913(observed)X +1163(for)X +1257(the)X +1355(single)X +1528(process)X +1739(case)X +1868(is)X +1930(a)X +1977(re\257ection)X +2237(of)X +2309(the)X +2406(parsing)X +2613(overhead)X +2865(for)X +2958(executing)X +3225(eight)X +3372(separate)X +3599(commands)X +3895(rather)X +4062(than)X +4191(one.)X +555 2615(The)N +673(additional)X +948(factor)X +1115(of)X +1187(one)X +1298(re\257ected)X +1536(in)X +1605(the)X +1702(3:1)X +1803(ratio)X +1939(for)X +2031(the)X +2127(client/server)X +2460(architecture)X +2794(is)X +2855(due)X +2965(to)X +3033(the)X +3129(communication)X +3545(overhead.)X +3828(The)X +3945(true)X +4062(ratios)X +4222(are)X +555 2705(actually)N +775(worse)X +945(since)X +1094(the)X +1190(component)X +1492(timings)X +1703(do)X +1785(not)X +1884(re\257ect)X +2060(the)X +2155(search)X +2334(times)X +2490(within)X +2671(each)X +2804(page)X +2941(or)X +3011(the)X +3106(time)X +3237(required)X +3466(to)X +3533(transmit)X +3760(the)X +3855(page)X +3992(between)X +4221(the)X +555 2795(two)N +667(processes.)X +10 s +10 f +555 2885(h)N +579(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)X +3 f +555 3161(4.2.)N +715(Group)X +961(Commit)X +1 f +755 3284(Since)N +959(the)X +1083(log)X +1211(must)X +1392(be)X +1494(\257ushed)X +1751(to)X +1839(disk)X +1997(at)X +2080(commit)X +2349(time,)X +2536(disk)X +2694(bandwidth)X +3057(fundamentally)X +3545(limits)X +3751(the)X +3874(rate)X +4020(at)X +4103(which)X +555 3374(transactions)N +959(complete.)X +1314(Since)X +1513(most)X +1688(transactions)X +2091(write)X +2276(only)X +2438(a)X +2494(few)X +2635(small)X +2828(records)X +3085(to)X +3167(the)X +3285(log,)X +3427(the)X +3545(last)X +3676(page)X +3848(of)X +3935(the)X +4053(log)X +4175(will)X +555 3464(be)N +658(\257ushed)X +916(once)X +1095(by)X +1202(every)X +1408(transaction)X +1787(which)X +2010(writes)X +2233(to)X +2322(it.)X +2433(In)X +2527(the)X +2652(naive)X +2853(implementation,)X +3402(these)X +3593(\257ushes)X +3841(would)X +4067(happen)X +555 3554(serially.)N +755 3677(LIBTP)N +1008(uses)X +3 f +1177(group)X +1412(commit)X +1 f +1702([DEWI84])X +2077(in)X +2170(order)X +2371(to)X +2464(amortize)X +2775(the)X +2903(cost)X +3062(of)X +3159(one)X +3305(synchronous)X +3740(disk)X +3903(write)X +4098(across)X +555 3767(multiple)N +851(transactions.)X +1304(Group)X +1539(commit)X +1812(provides)X +2117(a)X +2182(way)X +2345(for)X +2468(a)X +2533(group)X +2749(of)X +2845(transactions)X +3257(to)X +3348(commit)X +3621(simultaneously.)X +4174(The)X +555 3857(\256rst)N +709(several)X +967(transactions)X +1380(to)X +1472(commit)X +1745(write)X +1939(their)X +2115(changes)X +2403(to)X +2494(the)X +2621(in-memory)X +3006(log)X +3137(page,)X +3338(then)X +3505(sleep)X +3699(on)X +3808(a)X +3873(distinguished)X +555 3947(semaphore.)N +966(Later,)X +1179(a)X +1238(committing)X +1629(transaction)X +2004(\257ushes)X +2249(the)X +2370(page)X +2545(to)X +2630(disk,)X +2805(and)X +2943(wakes)X +3166(up)X +3268(all)X +3370(its)X +3467(sleeping)X +3756(peers.)X +3988(The)X +4135(point)X +555 4037(at)N +635(which)X +853(changes)X +1134(are)X +1255(actually)X +1531(written)X +1780(is)X +1855(determined)X +2238(by)X +2340(three)X +2523(thresholds.)X +2914(The)X +3061(\256rst)X +3207(is)X +3281(the)X +2 f +3400(group)X +3612(threshold)X +1 f +3935(and)X +4072(de\256nes)X +555 4127(the)N +674(minimum)X +1005(number)X +1271(of)X +1359(transactions)X +1763(which)X +1979(must)X +2154(be)X +2250(active)X +2462(in)X +2544(the)X +2662(system)X +2904(before)X +3130(transactions)X +3533(are)X +3652(forced)X +3878(to)X +3960(participate)X +555 4217(in)N +646(a)X +711(group)X +927(commit.)X +1240(The)X +1394(second)X +1646(is)X +1728(the)X +2 f +1855(wait)X +2021(threshold)X +1 f +2352(which)X +2577(is)X +2658(expressed)X +3003(as)X +3098(the)X +3224(percentage)X +3601(of)X +3696(active)X +3916(transactions)X +555 4307(waiting)N +826(to)X +919(be)X +1026(committed.)X +1439(The)X +1595(last)X +1737(is)X +1821(the)X +2 f +1950(logdelay)X +2257(threshold)X +1 f +2590(which)X +2816(indicates)X +3131(how)X +3299(much)X +3507(un\257ushed)X +3848(log)X +3980(should)X +4223(be)X +555 4397(allowed)N +829(to)X +911(accumulate)X +1297(before)X +1523(a)X +1579(waiting)X +1839(transaction's)X +2289(commit)X +2553(record)X +2779(is)X +2852(\257ushed.)X +755 4520(Group)N +981(commit)X +1246(can)X +1379(substantially)X +1803(improve)X +2090(performance)X +2517(for)X +2631(high-concurrency)X +3218(environments.)X +3714(If)X +3788(only)X +3950(a)X +4006(few)X +4147(tran-)X +555 4610(sactions)N +836(are)X +957(running,)X +1248(it)X +1314(is)X +1389(unlikely)X +1673(to)X +1757(improve)X +2046(things)X +2263(at)X +2343(all.)X +2485(The)X +2632(crossover)X +2962(point)X +3148(is)X +3223(the)X +3343(point)X +3529(at)X +3609(which)X +3827(the)X +3947(transaction)X +555 4700(commit)N +823(rate)X +968(is)X +1045(limited)X +1295(by)X +1399(the)X +1521(bandwidth)X +1883(of)X +1974(the)X +2096(device)X +2330(on)X +2434(which)X +2654(the)X +2776(log)X +2902(resides.)X +3189(If)X +3267(processes)X +3599(are)X +3722(trying)X +3937(to)X +4023(\257ush)X +4201(the)X +555 4790(log)N +677(faster)X +876(than)X +1034(the)X +1152(log)X +1274(disk)X +1427(can)X +1559(accept)X +1785(data,)X +1959(then)X +2117(group)X +2324(commit)X +2588(will)X +2732(increase)X +3016(the)X +3134(commit)X +3398(rate.)X +3 f +555 4976(4.3.)N +715(Kernel)X +971(Intervention)X +1418(for)X +1541(Synchronization)X +1 f +755 5099(Since)N +954(LIBTP)X +1197(uses)X +1356(data)X +1511(in)X +1594(shared)X +1825(memory)X +2113(\()X +2 f +2140(e.g.)X +1 f +2277(the)X +2395(lock)X +2553(table)X +2729(and)X +2865(buffer)X +3082(pool\))X +3271(it)X +3335(must)X +3510(be)X +3606(possible)X +3888(for)X +4002(a)X +4058(process)X +555 5189(to)N +640(acquire)X +900(exclusive)X +1226(access)X +1454(to)X +1538(shared)X +1770(data)X +1926(in)X +2010(order)X +2202(to)X +2286(prevent)X +2549(corruption.)X +2945(In)X +3034(addition,)X +3338(the)X +3458(process)X +3721(manager)X +4020(must)X +4197(put)X +555 5279(processes)N +886(to)X +971(sleep)X +1159(when)X +1356(the)X +1477(lock)X +1638(or)X +1728(buffer)X +1948(they)X +2109(request)X +2364(is)X +2440(in)X +2525(use)X +2655(by)X +2758(some)X +2950(other)X +3138(process.)X +3441(In)X +3530(the)X +3650(LIBTP)X +3894(implementa-)X +555 5385(tion)N +705(under)X +914(Ultrix)X +1131(4.0)X +7 s +5353(2)Y +10 s +5385(,)Y +1305(we)X +1424(use)X +1556(System)X +1816(V)X +1899(semaphores)X +2303(to)X +2390(provide)X +2660(this)X +2800(synchronization.)X +3377(Semaphores)X +3794(implemented)X +4237(in)X +555 5475(this)N +701(fashion)X +968(turn)X +1128(out)X +1261(to)X +1354(be)X +1461(an)X +1568(expensive)X +1920(choice)X +2161(for)X +2285(synchronization,)X +2847(because)X +3132(each)X +3310(access)X +3546(traps)X +3732(to)X +3824(the)X +3952(kernel)X +4183(and)X +8 s +10 f +555 5547(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)N +5 s +1 f +727 5625(2)N +8 s +763 5650(Ultrix)N +932(and)X +1040(DEC)X +1184(are)X +1277(trademarks)X +1576(of)X +1645(Digital)X +1839(Equipment)X +2136(Corporation.)X + +9 p +%%Page: 9 9 +8 s 8 xH 0 xS 1 f +10 s +3 f +1 f +555 630(executes)N +852(atomically)X +1210(there.)X +755 753(On)N +878(architectures)X +1314(that)X +1459(support)X +1724(atomic)X +1967(test-and-set,)X +2382(a)X +2443(much)X +2646(better)X +2854(choice)X +3089(would)X +3314(be)X +3415(to)X +3502(attempt)X +3767(to)X +3854(obtain)X +4079(a)X +4139(spin-)X +555 843(lock)N +714(with)X +877(a)X +934(test-and-set,)X +1345(and)X +1482(issue)X +1663(a)X +1720(system)X +1963(call)X +2100(only)X +2263(if)X +2333(the)X +2452(spinlock)X +2744(is)X +2818(unavailable.)X +3249(Since)X +3447(virtually)X +3738(all)X +3838(semaphores)X +4237(in)X +555 933(LIBTP)N +801(are)X +924(uncontested)X +1330(and)X +1469(are)X +1591(held)X +1752(for)X +1869(very)X +2035(short)X +2218(periods)X +2477(of)X +2567(time,)X +2752(this)X +2890(would)X +3113(improve)X +3403(performance.)X +3873(For)X +4007(example,)X +555 1023(processes)N +885(must)X +1062(acquire)X +1321(exclusive)X +1646(access)X +1874(to)X +1958(buffer)X +2177(pool)X +2341(metadata)X +2653(in)X +2737(order)X +2929(to)X +3013(\256nd)X +3159(and)X +3297(pin)X +3421(a)X +3479(buffer)X +3698(in)X +3781(shared)X +4012(memory.)X +555 1113(This)N +721(semaphore)X +1093(is)X +1170(requested)X +1502(most)X +1681(frequently)X +2034(in)X +2119(LIBTP.)X +2404(However,)X +2742(once)X +2917(it)X +2984(is)X +3060(acquired,)X +3380(only)X +3545(a)X +3604(few)X +3748(instructions)X +4144(must)X +555 1203(be)N +656(executed)X +966(before)X +1196(it)X +1264(is)X +1341(released.)X +1669(On)X +1791(one)X +1931(architecture)X +2335(for)X +2453(which)X +2673(we)X +2791(were)X +2972(able)X +3130(to)X +3216(gather)X +3441(detailed)X +3719(pro\256ling)X +4018(informa-)X +555 1293(tion,)N +729(the)X +857(cost)X +1015(of)X +1111(the)X +1238(semaphore)X +1615(calls)X +1791(accounted)X +2146(for)X +2269(25%)X +2445(of)X +2541(the)X +2668(total)X +2839(time)X +3010(spent)X +3208(updating)X +3517(the)X +3644(metadata.)X +4003(This)X +4174(was)X +555 1383(fairly)N +749(consistent)X +1089(across)X +1310(most)X +1485(of)X +1572(the)X +1690(critical)X +1933(sections.)X +755 1506(In)N +848(an)X +950(attempt)X +1216(to)X +1304(quantify)X +1597(the)X +1720(overhead)X +2040(of)X +2132(kernel)X +2358(synchronization,)X +2915(we)X +3034(ran)X +3162(tests)X +3329(on)X +3434(a)X +3495(version)X +3756(of)X +3848(4.3BSD-Reno)X +555 1596(which)N +786(had)X +937(been)X +1123(modi\256ed)X +1441(to)X +1537(support)X +1811(binary)X +2050(semaphore)X +2432(facilities)X +2742(similar)X +2998(to)X +3094(those)X +3297(described)X +3639(in)X +3735([POSIX91].)X +4174(The)X +555 1686(hardware)N +880(platform)X +1181(consisted)X +1504(of)X +1595(an)X +1695(HP300)X +1941(\(33MHz)X +2237(MC68030\))X +2612(workstation)X +3014(with)X +3180(16MBytes)X +3537(of)X +3628(main)X +3812(memory,)X +4123(and)X +4263(a)X +555 1776(600MByte)N +920(HP7959)X +1205(SCSI)X +1396(disk)X +1552(\(17)X +1682(ms)X +1798(average)X +2072(seek)X +2237(time\).)X +2468(We)X +2602(ran)X +2727(three)X +2910(sets)X +3052(of)X +3141(comparisons)X +3568(which)X +3786(are)X +3907(summarized)X +555 1866(in)N +645(\256gure)X +860(\256ve.)X +1028(In)X +1123(each)X +1299(comparison)X +1701(we)X +1823(ran)X +1954(two)X +2102(tests,)X +2292(one)X +2436(using)X +2637(hardware)X +2965(spinlocks)X +3295(and)X +3438(the)X +3563(other)X +3755(using)X +3955(kernel)X +4183(call)X +555 1956(synchronization.)N +1135(Since)X +1341(the)X +1467(test)X +1606(was)X +1758(run)X +1892(single-user,)X +2291(none)X +2474(of)X +2568(the)X +2693(the)X +2818(locks)X +3014(were)X +3198(contested.)X +3568(In)X +3662(the)X +3787(\256rst)X +3938(two)X +4085(sets)X +4232(of)X +555 2046(tests,)N +743(we)X +863(ran)X +992(the)X +1116(full)X +1253(transaction)X +1631(processing)X +2000(benchmark)X +2383(described)X +2717(in)X +2805(section)X +3058(5.1.)X +3223(In)X +3315(one)X +3456(case)X +3620(we)X +3739(ran)X +3867(with)X +4034(both)X +4201(the)X +555 2136(database)N +854(and)X +992(log)X +1116(on)X +1218(the)X +1338(same)X +1525(disk)X +1680(\(1)X +1769(Disk\))X +1969(and)X +2107(in)X +2191(the)X +2311(second,)X +2576(we)X +2692(ran)X +2817(with)X +2981(the)X +3101(database)X +3400(and)X +3538(log)X +3661(on)X +3762(separate)X +4047(disks)X +4232(\(2)X +555 2226(Disk\).)N +800(In)X +894(the)X +1019(last)X +1157(test,)X +1315(we)X +1436(wanted)X +1695(to)X +1784(create)X +2004(a)X +2067(CPU)X +2249(bound)X +2476(environment,)X +2928(so)X +3026(we)X +3146(used)X +3319(a)X +3381(database)X +3684(small)X +3883(enough)X +4145(to)X +4233(\256t)X +555 2316(completely)N +941(in)X +1033(the)X +1161(cache)X +1375(and)X +1521(issued)X +1751(read-only)X +2089(transactions.)X +2541(The)X +2695(results)X +2933(in)X +3024(\256gure)X +3240(\256ve)X +3389(express)X +3659(the)X +3786(kernel)X +4016(call)X +4161(syn-)X +555 2406(chronization)N +980(performance)X +1411(as)X +1502(a)X +1562(percentage)X +1935(of)X +2026(the)X +2148(spinlock)X +2443(performance.)X +2914(For)X +3049(example,)X +3365(in)X +3451(the)X +3573(1)X +3637(disk)X +3794(case,)X +3977(the)X +4098(kernel)X +555 2496(call)N +697(implementation)X +1225(achieved)X +1537(4.4)X +1662(TPS)X +1824(\(transactions)X +2259(per)X +2387(second\))X +2662(while)X +2865(the)X +2988(semaphore)X +3361(implementation)X +3888(achieved)X +4199(4.6)X +555 2586(TPS,)N +735(and)X +874(the)X +995(relative)X +1259(performance)X +1689(of)X +1779(the)X +1900(kernel)X +2123(synchronization)X +2657(is)X +2732(96%)X +2901(that)X +3043(of)X +3132(the)X +3252(spinlock)X +3545(\(100)X +3714(*)X +3776(4.4)X +3898(/)X +3942(4.6\).)X +4111(There)X +555 2676(are)N +674(two)X +814(striking)X +1078(observations)X +1503(from)X +1679(these)X +1864(results:)X +10 f +635 2799(g)N +1 f +755(even)X +927(when)X +1121(the)X +1239(system)X +1481(is)X +1554(disk)X +1707(bound,)X +1947(the)X +2065(CPU)X +2240(cost)X +2389(of)X +2476(synchronization)X +3008(is)X +3081(noticeable,)X +3451(and)X +10 f +635 2922(g)N +1 f +755(when)X +949(we)X +1063(are)X +1182(CPU)X +1357(bound,)X +1597(the)X +1715(difference)X +2062(is)X +2135(dramatic)X +2436(\(67%\).)X +3 f +555 3108(4.4.)N +715(Transaction)X +1148(Protected)X +1499(Access)X +1747(Methods)X +1 f +755 3231(The)N +903(B-tree)X +1127(and)X +1266(\256xed)X +1449(length)X +1671(recno)X +1872(\(record)X +2127(number\))X +2421(access)X +2649(methods)X +2942(have)X +3116(been)X +3290(modi\256ed)X +3596(to)X +3680(provide)X +3947(transaction)X +555 3321(protection.)N +941(Whereas)X +1244(the)X +1363(previously)X +1722(published)X +2054(interface)X +2357(to)X +2440(the)X +2559(access)X +2786(routines)X +3065(had)X +3202(separate)X +3487(open)X +3664(calls)X +3832(for)X +3946(each)X +4114(of)X +4201(the)X +10 f +555 3507(h)N +579(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)X +1 Dt +2978 5036 MXY + 2978 5036 lineto + 2978 4662 lineto + 3093 4662 lineto + 3093 5036 lineto + 2978 5036 lineto +closepath 21 2978 4662 3093 5036 Dp +2518 MX + 2518 5036 lineto + 2518 3960 lineto + 2633 3960 lineto + 2633 5036 lineto + 2518 5036 lineto +closepath 3 2518 3960 2633 5036 Dp +2059 MX + 2059 5036 lineto + 2059 3946 lineto + 2174 3946 lineto + 2174 5036 lineto + 2059 5036 lineto +closepath 1 2059 3946 2174 5036 Dp +3 f +7 s +2912 5141(Read-only)N +1426 3767(of)N +1487(Spinlock)X +1710(Throughput)X +1480 3710(Throughput)N +1786(as)X +1850(a)X +1892(%)X +11 s +1670 4843(20)N +1670 4614(40)N +1670 4384(60)N +1670 4155(80)N +1648 3925(100)N +7 s +2041 5141(1)N +2083(Disk)X +2490(2)X +2532(Disks)X +5 Dt +1829 5036 MXY +1494 0 Dl +4 Ds +1 Dt +1829 4806 MXY +1494 0 Dl +1829 4577 MXY +1494 0 Dl +1829 4347 MXY +1494 0 Dl +1829 4118 MXY +1494 0 Dl +1829 3888 MXY +1494 0 Dl +3 Dt +-1 Ds +8 s +555 5360(Figure)N +753(5:)X +823(Kernel)X +1028(Overhead)X +1315(for)X +1413(System)X +1625(Call)X +1756(Synchronization.)X +1 f +2254(The)X +2370(performance)X +2708(of)X +2778(the)X +2873(kernel)X +3049(call)X +3158(synchronization)X +3583(is)X +3643(expressed)X +3911(as)X +3980(a)X +4024(percentage)X +555 5450(of)N +625(the)X +720(spinlock)X +954(synchronization)X +1379(performance.)X +1749(In)X +1819(disk)X +1943(bound)X +2120(cases)X +2271(\(1)X +2341(Disk)X +2479(and)X +2588(2)X +2637(Disks\),)X +2837(we)X +2928(see)X +3026(that)X +3139(4-6%)X +3294(of)X +3364(the)X +3459(performance)X +3797(is)X +3857(lost)X +3966(due)X +4074(to)X +4140(kernel)X +555 5540(calls)N +688(while)X +846(in)X +912(the)X +1006(CPU)X +1147(bound)X +1323(case,)X +1464(we)X +1554(have)X +1690(lost)X +1799(67%)X +1932(of)X +2001(the)X +2095(performance)X +2432(due)X +2540(to)X +2606(kernel)X +2781(calls.)X + +10 p +%%Page: 10 10 +8 s 8 xH 0 xS 1 f +10 s +3 f +1 f +555 630(access)N +781(methods,)X +1092(we)X +1206(now)X +1364(have)X +1536(an)X +1632(integrated)X +1973(open)X +2149(call)X +2285(with)X +2447(the)X +2565(following)X +2896(calling)X +3134(conventions:)X +7 f +715 753(DB)N +859(*dbopen)X +1243(\(const)X +1579(char)X +1819(*file,)X +2155(int)X +2347(flags,)X +2683(int)X +2875(mode,)X +3163(DBTYPE)X +3499(type,)X +1291 843(int)N +1483(dbflags,)X +1915(const)X +2203(void)X +2443(*openinfo\))X +1 f +555 966(where)N +2 f +774(\256le)X +1 f +894(is)X +969(the)X +1089(name)X +1285(of)X +1374(the)X +1494(\256le)X +1618(being)X +1818(opened,)X +2 f +2092(\257ags)X +1 f +2265(and)X +2 f +2402(mode)X +1 f +2597(are)X +2717(the)X +2836(standard)X +3129(arguments)X +3484(to)X +3 f +3567(open)X +1 f +3731(\(2\),)X +2 f +3866(type)X +1 f +4021(is)X +4095(one)X +4232(of)X +555 1056(the)N +680(access)X +913(method)X +1180(types,)X +2 f +1396(db\257ags)X +1 f +1654(indicates)X +1966(the)X +2091(mode)X +2296(of)X +2390(the)X +2515(buffer)X +2739(pool)X +2907(and)X +3049(transaction)X +3427(protection,)X +3798(and)X +2 f +3940(openinfo)X +1 f +4246(is)X +555 1146(the)N +681(access)X +915(method)X +1183(speci\256c)X +1456(information.)X +1902(Currently,)X +2257(the)X +2383(possible)X +2673(values)X +2906(for)X +2 f +3028(db\257ags)X +1 f +3287(are)X +3414(DB_SHARED)X +3912(and)X +4055(DB_TP)X +555 1236(indicating)N +895(that)X +1035(buffers)X +1283(should)X +1516(be)X +1612(kept)X +1770(in)X +1852(a)X +1908(shared)X +2138(buffer)X +2355(pool)X +2517(and)X +2653(that)X +2793(the)X +2911(\256le)X +3033(should)X +3266(be)X +3362(transaction)X +3734(protected.)X +755 1359(The)N +900(modi\256cations)X +1355(required)X +1643(to)X +1725(add)X +1861(transaction)X +2233(protection)X +2578(to)X +2660(an)X +2756(access)X +2982(method)X +3242(are)X +3361(quite)X +3541(simple)X +3774(and)X +3910(localized.)X +715 1482(1.)N +795(Replace)X +1074(\256le)X +2 f +1196(open)X +1 f +1372(with)X +2 f +1534(buf_open)X +1 f +1832(.)X +715 1572(2.)N +795(Replace)X +1074(\256le)X +2 f +1196(read)X +1 f +1363(and)X +2 f +1499(write)X +1 f +1683(calls)X +1850(with)X +2012(buffer)X +2229(manager)X +2526(calls)X +2693(\()X +2 f +2720(buf_get)X +1 f +(,)S +2 f +3000(buf_unpin)X +1 f +3324(\).)X +715 1662(3.)N +795(Precede)X +1070(buffer)X +1287(manager)X +1584(calls)X +1751(with)X +1913(an)X +2009(appropriate)X +2395(\(read)X +2581(or)X +2668(write\))X +2880(lock)X +3038(call.)X +715 1752(4.)N +795(Before)X +1034(updates,)X +1319(issue)X +1499(a)X +1555(logging)X +1819(operation.)X +715 1842(5.)N +795(After)X +985(data)X +1139(have)X +1311(been)X +1483(accessed,)X +1805(release)X +2049(the)X +2167(buffer)X +2384(manager)X +2681(pin.)X +715 1932(6.)N +795(Provide)X +1064(undo/redo)X +1409(code)X +1581(for)X +1695(each)X +1863(type)X +2021(of)X +2108(log)X +2230(record)X +2456(de\256ned.)X +555 2071(The)N +702(following)X +1035(code)X +1209(fragments)X +1552(show)X +1743(how)X +1903(to)X +1987(transaction)X +2361(protect)X +2606(several)X +2856(updates)X +3123(to)X +3206(a)X +3263(B-tree.)X +7 s +3484 2039(3)N +10 s +3533 2071(In)N +3621(the)X +3740(unprotected)X +4140(case,)X +555 2161(an)N +652(open)X +829(call)X +966(is)X +1040(followed)X +1346(by)X +1447(a)X +1504(read)X +1664(call)X +1801(to)X +1884(obtain)X +2105(the)X +2224(meta-data)X +2562(for)X +2677(the)X +2796(B-tree.)X +3058(Instead,)X +3331(we)X +3446(issue)X +3627(an)X +3724(open)X +3901(to)X +3984(the)X +4102(buffer)X +555 2251(manager)N +852(to)X +934(obtain)X +1154(a)X +1210(\256le)X +1332(id)X +1414(and)X +1550(a)X +1606(buffer)X +1823(request)X +2075(to)X +2157(obtain)X +2377(the)X +2495(meta-data)X +2832(as)X +2919(shown)X +3148(below.)X +7 f +715 2374(char)N +955(*path;)X +715 2464(int)N +907(fid,)X +1147(flags,)X +1483(len,)X +1723(mode;)X +715 2644(/*)N +859(Obtain)X +1195(a)X +1291(file)X +1531(id)X +1675(with)X +1915(which)X +2203(to)X +2347(access)X +2683(the)X +2875(buffer)X +3211(pool)X +3451(*/)X +715 2734(fid)N +907(=)X +1003(buf_open\(path,)X +1723(flags,)X +2059(mode\);)X +715 2914(/*)N +859(Read)X +1099(the)X +1291(meta)X +1531(data)X +1771(\(page)X +2059(0\))X +2203(for)X +2395(the)X +2587(B-tree)X +2923(*/)X +715 3004(if)N +859(\(tp_lock\(fid,)X +1531(0,)X +1675(READ_LOCK\)\))X +1003 3094(return)N +1339(error;)X +715 3184(meta_data_ptr)N +1387(=)X +1483(buf_get\(fid,)X +2107(0,)X +2251(BF_PIN,)X +2635(&len\);)X +1 f +555 3307(The)N +714(BF_PIN)X +1014(argument)X +1350(to)X +2 f +1445(buf_get)X +1 f +1718(indicates)X +2036(that)X +2189(we)X +2316(wish)X +2500(to)X +2595(leave)X +2798(this)X +2946(page)X +3131(pinned)X +3382(in)X +3477(memory)X +3777(so)X +3881(that)X +4034(it)X +4111(is)X +4197(not)X +555 3397(swapped)N +862(out)X +990(while)X +1194(we)X +1314(are)X +1439(accessing)X +1772(it.)X +1881(The)X +2031(last)X +2167(argument)X +2495(to)X +2 f +2582(buf_get)X +1 f +2847(returns)X +3095(the)X +3218(number)X +3488(of)X +3580(bytes)X +3774(on)X +3879(the)X +4002(page)X +4179(that)X +555 3487(were)N +732(valid)X +912(so)X +1003(that)X +1143(the)X +1261(access)X +1487(method)X +1747(may)X +1905(initialize)X +2205(the)X +2323(page)X +2495(if)X +2564(necessary.)X +755 3610(Next,)N +955(consider)X +1251(inserting)X +1555(a)X +1615(record)X +1845(on)X +1949(a)X +2009(particular)X +2341(page)X +2517(of)X +2608(a)X +2668(B-tree.)X +2932(In)X +3022(the)X +3143(unprotected)X +3545(case,)X +3727(we)X +3844(read)X +4006(the)X +4127(page,)X +555 3700(call)N +2 f +693(_bt_insertat)X +1 f +1079(,)X +1121(and)X +1258(write)X +1444(the)X +1563(page.)X +1776(Instead,)X +2049(we)X +2164(lock)X +2323(the)X +2442(page,)X +2635(request)X +2888(the)X +3007(buffer,)X +3245(log)X +3368(the)X +3487(change,)X +3756(modify)X +4008(the)X +4127(page,)X +555 3790(and)N +691(release)X +935(the)X +1053(buffer.)X +7 f +715 3913(int)N +907(fid,)X +1147(len,)X +1387(pageno;)X +1867(/*)X +2011(Identifies)X +2539(the)X +2731(buffer)X +3067(*/)X +715 4003(int)N +907(index;)X +1867(/*)X +2011(Location)X +2443(at)X +2587(which)X +2875(to)X +3019(insert)X +3355(the)X +3547(new)X +3739(pair)X +3979(*/)X +715 4093(DBT)N +907(*keyp,)X +1243(*datap;)X +1867(/*)X +2011(Key/Data)X +2443(pair)X +2683(to)X +2827(be)X +2971(inserted)X +3403(*/)X +715 4183(DATUM)N +1003(*d;)X +1867(/*)X +2011(Key/data)X +2443(structure)X +2923(to)X +3067(insert)X +3403(*/)X +715 4363(/*)N +859(Lock)X +1099(and)X +1291(request)X +1675(the)X +1867(buffer)X +2203(*/)X +715 4453(if)N +859(\(tp_lock\(fid,)X +1531(pageno,)X +1915(WRITE_LOCK\)\))X +1003 4543(return)N +1339(error;)X +715 4633(buffer_ptr)N +1243(=)X +1339(buf_get\(fid,)X +1963(pageno,)X +2347(BF_PIN,)X +2731(&len\);)X +715 4813(/*)N +859(Log)X +1051(and)X +1243(perform)X +1627(the)X +1819(update)X +2155(*/)X +715 4903(log_insdel\(BTREE_INSERT,)N +1915(fid,)X +2155(pageno,)X +2539(keyp,)X +2827(datap\);)X +715 4993(_bt_insertat\(buffer_ptr,)N +1915(d,)X +2059(index\);)X +715 5083(buf_unpin\(buffer_ptr\);)N +1 f +555 5206(Succinctly,)N +942(the)X +1068(algorithm)X +1407(for)X +1529(turning)X +1788(unprotected)X +2195(code)X +2375(into)X +2527(protected)X +2854(code)X +3034(is)X +3115(to)X +3205(replace)X +3466(read)X +3633(operations)X +3995(with)X +2 f +4165(lock)X +1 f +555 5296(and)N +2 f +691(buf_get)X +1 f +951(operations)X +1305(and)X +1441(write)X +1626(operations)X +1980(with)X +2 f +2142(log)X +1 f +2264(and)X +2 f +2400(buf_unpin)X +1 f +2744(operations.)X +8 s +10 f +555 5458(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)N +5 s +1 f +727 5536(3)N +8 s +766 5561(The)N +884(following)X +1152(code)X +1291(fragments)X +1565(are)X +1661(examples,)X +1937(but)X +2038(do)X +2120(not)X +2220(de\256ne)X +2394(the)X +2490(\256nal)X +2622(interface.)X +2894(The)X +3011(\256nal)X +3143(interface)X +3383(will)X +3501(be)X +3579(determined)X +3884(after)X +4018(LIBTP)X +4214(has)X +555 5633(been)N +691(fully)X +828(integrated)X +1099(with)X +1229(the)X +1323(most)X +1464(recent)X +3 f +1635(db)X +1 f +1707(\(3\))X +1797(release)X +1989(from)X +2129(the)X +2223(Computer)X +2495(Systems)X +2725(Research)X +2974(Group)X +3153(at)X +3215(University)X +3501(of)X +3570(California,)X +3861(Berkeley.)X + +11 p +%%Page: 11 11 +8 s 8 xH 0 xS 1 f +10 s +3 f +555 630(5.)N +655(Performance)X +1 f +755 753(In)N +845(this)X +983(section,)X +1253(we)X +1370(present)X +1625(the)X +1746(results)X +1978(of)X +2067(two)X +2209(very)X +2374(different)X +2673(benchmarks.)X +3103(The)X +3250(\256rst)X +3396(is)X +3471(an)X +3569(online)X +3791(transaction)X +4165(pro-)X +555 843(cessing)N +824(benchmark,)X +1234(similar)X +1489(to)X +1584(the)X +1715(standard)X +2020(TPCB,)X +2272(but)X +2407(has)X +2547(been)X +2732(adapted)X +3015(to)X +3110(run)X +3250(in)X +3345(a)X +3414(desktop)X +3696(environment.)X +4174(The)X +555 933(second)N +798(emulates)X +1103(a)X +1159(computer-aided)X +1683(design)X +1912(environment)X +2337(and)X +2473(provides)X +2769(more)X +2954(complex)X +3250(query)X +3453(processing.)X +3 f +555 1119(5.1.)N +715(Transaction)X +1148(Processing)X +1533(Benchmark)X +1 f +755 1242(For)N +887(this)X +1023(section,)X +1291(all)X +1392(performance)X +1820(numbers)X +2117(shown)X +2346(except)X +2576(for)X +2690(the)X +2808(commercial)X +3207(database)X +3504(system)X +3746(were)X +3923(obtained)X +4219(on)X +555 1332(a)N +614(DECstation)X +1009(5000/200)X +1333(with)X +1497(32MBytes)X +1852(of)X +1941(memory)X +2230(running)X +2501(Ultrix)X +2714(V4.0,)X +2914(accessing)X +3244(a)X +3302(DEC)X +3484(RZ57)X +3688(1GByte)X +3959(disk)X +4114(drive.)X +555 1422(The)N +720(commercial)X +1139(relational)X +1482(database)X +1799(system)X +2061(tests)X +2242(were)X +2438(run)X +2584(on)X +2703(a)X +2778(comparable)X +3192(machine,)X +3523(a)X +3598(Sparcstation)X +4033(1+)X +4157(with)X +555 1512(32MBytes)N +915(memory)X +1209(and)X +1352(a)X +1415(1GByte)X +1691(external)X +1976(disk)X +2135(drive.)X +2366(The)X +2517(database,)X +2840(binaries)X +3120(and)X +3262(log)X +3390(resided)X +3648(on)X +3754(the)X +3878(same)X +4069(device.)X +555 1602(Reported)N +869(times)X +1062(are)X +1181(the)X +1299(means)X +1524(of)X +1611(\256ve)X +1751(tests)X +1913(and)X +2049(have)X +2221(standard)X +2513(deviations)X +2862(within)X +3086(two)X +3226(percent)X +3483(of)X +3570(the)X +3688(mean.)X +755 1725(The)N +905(test)X +1041(database)X +1343(was)X +1493(con\256gured)X +1861(according)X +2203(to)X +2290(the)X +2413(TPCB)X +2637(scaling)X +2889(rules)X +3070(for)X +3189(a)X +3250(10)X +3355(transaction)X +3732(per)X +3860(second)X +4108(\(TPS\))X +555 1815(system)N +817(with)X +999(1,000,000)X +1359(account)X +1649(records,)X +1946(100)X +2106(teller)X +2311(records,)X +2607(and)X +2762(10)X +2881(branch)X +3139(records.)X +3455(Where)X +3709(TPS)X +3885(numbers)X +4200(are)X +555 1905(reported,)N +865(we)X +981(are)X +1102(running)X +1373(a)X +1431(modi\256ed)X +1737(version)X +1995(of)X +2084(the)X +2203(industry)X +2486(standard)X +2779(transaction)X +3152(processing)X +3516(benchmark,)X +3914(TPCB.)X +4174(The)X +555 1995(TPCB)N +780(benchmark)X +1163(simulates)X +1491(a)X +1553(withdrawal)X +1940(performed)X +2301(by)X +2407(a)X +2469(hypothetical)X +2891(teller)X +3082(at)X +3166(a)X +3228(hypothetical)X +3650(bank.)X +3872(The)X +4022(database)X +555 2085(consists)N +831(of)X +921(relations)X +1220(\(\256les\))X +1430(for)X +1547(accounts,)X +1871(branches,)X +2200(tellers,)X +2439(and)X +2578(history.)X +2863(For)X +2997(each)X +3168(transaction,)X +3563(the)X +3684(account,)X +3976(teller,)X +4183(and)X +555 2175(branch)N +795(balances)X +1093(must)X +1269(be)X +1366(updated)X +1641(to)X +1724(re\257ect)X +1946(the)X +2065(withdrawal)X +2447(and)X +2584(a)X +2640(history)X +2882(record)X +3108(is)X +3181(written)X +3428(which)X +3644(contains)X +3931(the)X +4049(account)X +555 2265(id,)N +657(branch)X +896(id,)X +998(teller)X +1183(id,)X +1285(and)X +1421(the)X +1539(amount)X +1799(of)X +1886(the)X +2004(withdrawal)X +2385([TPCB90].)X +755 2388(Our)N +914(implementation)X +1450(of)X +1551(the)X +1683(benchmark)X +2074(differs)X +2317(from)X +2506(the)X +2637(speci\256cation)X +3075(in)X +3170(several)X +3431(aspects.)X +3736(The)X +3894(speci\256cation)X +555 2478(requires)N +840(that)X +985(the)X +1108(database)X +1410(keep)X +1587(redundant)X +1933(logs)X +2091(on)X +2196(different)X +2498(devices,)X +2784(but)X +2911(we)X +3030(use)X +3162(a)X +3223(single)X +3439(log.)X +3606(Furthermore,)X +4052(all)X +4157(tests)X +555 2568(were)N +734(run)X +863(on)X +965(a)X +1023(single,)X +1256(centralized)X +1631(system)X +1875(so)X +1968(there)X +2151(is)X +2226(no)X +2328(notion)X +2553(of)X +2641(remote)X +2885(accesses.)X +3219(Finally,)X +3486(we)X +3601(calculated)X +3948(throughput)X +555 2658(by)N +662(dividing)X +955(the)X +1080(total)X +1249(elapsed)X +1517(time)X +1686(by)X +1793(the)X +1918(number)X +2190(of)X +2284(transactions)X +2694(processed)X +3038(rather)X +3253(than)X +3418(by)X +3525(computing)X +3894(the)X +4018(response)X +555 2748(time)N +717(for)X +831(each)X +999(transaction.)X +755 2871(The)N +912(performance)X +1351(comparisons)X +1788(focus)X +1993(on)X +2104(traditional)X +2464(Unix)X +2655(techniques)X +3029(\(unprotected,)X +3486(using)X +3 f +3690(\257ock)X +1 f +3854(\(2\))X +3979(and)X +4126(using)X +3 f +555 2961(fsync)N +1 f +733(\(2\)\))X +884(and)X +1030(a)X +1096(commercial)X +1504(relational)X +1836(database)X +2142(system.)X +2433(Well-behaved)X +2913(applications)X +3329(using)X +3 f +3531(\257ock)X +1 f +3695(\(2\))X +3818(are)X +3946(guaranteed)X +555 3051(that)N +704(concurrent)X +1077(processes')X +1441(updates)X +1715(do)X +1824(not)X +1955(interact)X +2225(with)X +2396(one)X +2541(another,)X +2831(but)X +2962(no)X +3070(guarantees)X +3442(about)X +3648(atomicity)X +3978(are)X +4105(made.)X +555 3141(That)N +731(is,)X +833(if)X +911(the)X +1038(system)X +1289(crashes)X +1555(in)X +1646(mid-transaction,)X +2198(only)X +2369(parts)X +2554(of)X +2649(that)X +2797(transaction)X +3177(will)X +3329(be)X +3433(re\257ected)X +3738(in)X +3828(the)X +3954 0.3125(after-crash)AX +555 3231(state)N +725(of)X +815(the)X +936(database.)X +1276(The)X +1424(use)X +1554(of)X +3 f +1643(fsync)X +1 f +1821(\(2\))X +1937(at)X +2017(transaction)X +2391(commit)X +2657(time)X +2821(provides)X +3119(guarantees)X +3485(of)X +3574(durability)X +3907(after)X +4077(system)X +555 3321(failure.)N +825(However,)X +1160(there)X +1341(is)X +1414(no)X +1514(mechanism)X +1899(to)X +1981(perform)X +2260(transaction)X +2632(abort.)X +3 f +555 3507(5.1.1.)N +775(Single-User)X +1191(Tests)X +1 f +755 3630(These)N +978(tests)X +1151(compare)X +1459(LIBTP)X +1712(in)X +1804(a)X +1870(variety)X +2123(of)X +2220(con\256gurations)X +2708(to)X +2800(traditional)X +3159(UNIX)X +3390(solutions)X +3708(and)X +3854(a)X +3920(commercial)X +555 3720(relational)N +884(database)X +1187(system)X +1435(\(RDBMS\).)X +1814(To)X +1929(demonstrate)X +2347(the)X +2471(server)X +2694(architecture)X +3100(we)X +3220(built)X +3392(a)X +3454(front)X +3636(end)X +3777(test)X +3913(process)X +4179(that)X +555 3810(uses)N +732(TCL)X +922([OUST90])X +1304(to)X +1405(parse)X +1614(database)X +1930(access)X +2175(commands)X +2561(and)X +2716(call)X +2870(the)X +3006(database)X +3321(access)X +3565(routines.)X +3901(In)X +4006(one)X +4160(case)X +555 3900(\(SERVER\),)N +956(frontend)X +1249(and)X +1386(backend)X +1675(processes)X +2004(were)X +2181(created)X +2434(which)X +2650(communicated)X +3142(via)X +3260(an)X +3356(IP)X +3447(socket.)X +3712(In)X +3799(the)X +3917(second)X +4160(case)X +555 3990(\(TCL\),)N +802(a)X +860(single)X +1073(process)X +1336(read)X +1497(queries)X +1751(from)X +1929(standard)X +2223(input,)X +2429(parsed)X +2660(them,)X +2861(and)X +2998(called)X +3211(the)X +3330(database)X +3628(access)X +3855(routines.)X +4174(The)X +555 4080(performance)N +987(difference)X +1338(between)X +1630(the)X +1752(TCL)X +1927(and)X +2067(SERVER)X +2397(tests)X +2563(quanti\256es)X +2898(the)X +3020(communication)X +3542(overhead)X +3861(of)X +3952(the)X +4074(socket.)X +555 4170(The)N +732(RDBMS)X +1063(implementation)X +1617(used)X +1816(embedded)X +2198(SQL)X +2401(in)X +2515(C)X +2620(with)X +2814(stored)X +3062(database)X +3391(procedures.)X +3835(Therefore,)X +4224(its)X +555 4260(con\256guration)N +1003(is)X +1076(a)X +1132(hybrid)X +1361(of)X +1448(the)X +1566(single)X +1777(process)X +2038(architecture)X +2438(and)X +2574(the)X +2692(server)X +2909(architecture.)X +3349(The)X +3494(graph)X +3697(in)X +3779(\256gure)X +3986(six)X +4099(shows)X +555 4350(a)N +611(comparison)X +1005(of)X +1092(the)X +1210(following)X +1541(six)X +1654(con\256gurations:)X +1126 4506(LIBTP)N +1552(Uses)X +1728(the)X +1846(LIBTP)X +2088(library)X +2322(in)X +2404(a)X +2460(single)X +2671(application.)X +1126 4596(TCL)N +1552(Uses)X +1728(the)X +1846(LIBTP)X +2088(library)X +2322(in)X +2404(a)X +2460(single)X +2671(application,)X +3067(requires)X +3346(query)X +3549(parsing.)X +1126 4686(SERVER)N +1552(Uses)X +1728(the)X +1846(LIBTP)X +2088(library)X +2322(in)X +2404(a)X +2460(server)X +2677(con\256guration,)X +3144(requires)X +3423(query)X +3626(parsing.)X +1126 4776(NOTP)N +1552(Uses)X +1728(no)X +1828(locking,)X +2108(logging,)X +2392(or)X +2479(concurrency)X +2897(control.)X +1126 4866(FLOCK)N +1552(Uses)X +3 f +1728(\257ock)X +1 f +1892(\(2\))X +2006(for)X +2120(concurrency)X +2538(control)X +2785(and)X +2921(nothing)X +3185(for)X +3299(durability.)X +1126 4956(FSYNC)N +1552(Uses)X +3 f +1728(fsync)X +1 f +1906(\(2\))X +2020(for)X +2134(durability)X +2465(and)X +2601(nothing)X +2865(for)X +2979(concurrency)X +3397(control.)X +1126 5046(RDBMS)N +1552(Uses)X +1728(a)X +1784(commercial)X +2183(relational)X +2506(database)X +2803(system.)X +755 5235(The)N +902(results)X +1133(show)X +1324(that)X +1466(LIBTP,)X +1730(both)X +1894(in)X +1978(the)X +2098(procedural)X +2464(and)X +2602(parsed)X +2834(environments,)X +3312(is)X +3387(competitive)X +3787(with)X +3951(a)X +4009(commer-)X +555 5325(cial)N +692(system)X +935(\(comparing)X +1326(LIBTP,)X +1589(TCL,)X +1781(and)X +1917(RDBMS\).)X +2263(Compared)X +2617(to)X +2699(existing)X +2972(UNIX)X +3193(solutions,)X +3521(LIBTP)X +3763(is)X +3836(approximately)X +555 5415(15%)N +738(slower)X +988(than)X +1162(using)X +3 f +1371(\257ock)X +1 f +1535(\(2\))X +1665(or)X +1768(no)X +1884(protection)X +2245(but)X +2383(over)X +2562(80%)X +2745(better)X +2964(than)X +3137(using)X +3 f +3345(fsync)X +1 f +3523(\(2\))X +3652(\(comparing)X +4057(LIBTP,)X +555 5505(FLOCK,)N +857(NOTP,)X +1106(and)X +1242(FSYNC\).)X + +12 p +%%Page: 12 12 +10 s 10 xH 0 xS 1 f +3 f +8 s +3500 2184(RDBMS)N +1 Dt +3553 2085 MXY + 3553 2085 lineto + 3676 2085 lineto + 3676 1351 lineto + 3553 1351 lineto + 3553 2085 lineto +closepath 16 3553 1351 3676 2085 Dp +2018 2184(SERVER)N +1720 1168 MXY +0 917 Dl +122 0 Dl +0 -917 Dl +-122 0 Dl +1715 2184(TCL)N +2087 1534 MXY + 2087 1534 lineto + 2209 1534 lineto + 2209 2085 lineto + 2087 2085 lineto + 2087 1534 lineto +closepath 12 2087 1534 2209 2085 Dp +3187 MX + 3187 1534 lineto + 3309 1534 lineto + 3309 2085 lineto + 3187 2085 lineto + 3187 1534 lineto +closepath 19 3187 1534 3309 2085 Dp +3142 2184(FSYNC)N +2425(NOTP)X +2453 955 MXY + 2453 955 lineto + 2576 955 lineto + 2576 2085 lineto + 2453 2085 lineto + 2453 955 lineto +closepath 21 2453 955 2576 2085 Dp +2820 1000 MXY + 2820 1000 lineto + 2942 1000 lineto + 2942 2085 lineto + 2820 2085 lineto + 2820 1000 lineto +closepath 14 2820 1000 2942 2085 Dp +5 Dt +1231 2085 MXY +2567 0 Dl +4 Ds +1 Dt +1231 1840 MXY +2567 0 Dl +1231 1596 MXY +2567 0 Dl +1231 1351 MXY +2567 0 Dl +1231 1108 MXY +2567 0 Dl +1231 863 MXY +2567 0 Dl +11 s +1087 1877(2)N +1087 1633(4)N +1087 1388(6)N +1087 1145(8)N +1065 900(10)N +1028 763(TPS)N +-1 Ds +1353 2085 MXY + 1353 2085 lineto + 1353 1151 lineto + 1476 1151 lineto + 1476 2085 lineto + 1353 2085 lineto +closepath 3 1353 1151 1476 2085 Dp +8 s +1318 2184(LIBTP)N +2767(FLOCK)X +3 Dt +-1 Ds +10 s +1597 2399(Figure)N +1844(6:)X +1931(Single-User)X +2347(Performance)X +2814(Comparison.)X +1 f +10 f +555 2579(h)N +579(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)X +3 f +555 2855(5.1.2.)N +775(Multi-User)X +1174(Tests)X +1 f +755 2978(While)N +975(the)X +1097(single-user)X +1473(tests)X +1639(form)X +1819(a)X +1878(basis)X +2061(for)X +2178(comparing)X +2544(LIBTP)X +2789(to)X +2874(other)X +3062(systems,)X +3358(our)X +3488(goal)X +3649(in)X +3734(multi-user)X +4086(testing)X +555 3068(was)N +714(to)X +810(analyze)X +1089(its)X +1197(scalability.)X +1579(To)X +1701(this)X +1849(end,)X +2018(we)X +2145(have)X +2330(run)X +2470(the)X +2601(benchmark)X +2991(in)X +3086(three)X +3280(modes,)X +3542(the)X +3673(normal)X +3933(disk)X +4099(bound)X +555 3158(con\256guration)N +1010(\(\256gure)X +1252(seven\),)X +1510(a)X +1573(CPU)X +1755(bound)X +1982(con\256guration)X +2436(\(\256gure)X +2677(eight,)X +2884(READ-ONLY\),)X +3426(and)X +3569(lock)X +3734(contention)X +4099(bound)X +555 3248(\(\256gure)N +796(eight,)X +1003(NO_FSYNC\).)X +1510(Since)X +1715(the)X +1840(normal)X +2094(con\256guration)X +2548(is)X +2628(completely)X +3011(disk)X +3171(bound)X +3398(\(each)X +3600(transaction)X +3978(requires)X +4263(a)X +555 3354(random)N +823(read,)X +1005(a)X +1064(random)X +1332(write,)X +1540(and)X +1679(a)X +1738(sequential)X +2086(write)X +7 s +2251 3322(4)N +10 s +3354(\))Y +2329(we)X +2446(expect)X +2679(to)X +2764(see)X +2890(little)X +3059(performance)X +3489(improvement)X +3939(as)X +4028(the)X +4148(mul-)X +555 3444(tiprogramming)N +1064(level)X +1249(increases.)X +1613(In)X +1709(fact,)X +1879(\256gure)X +2095(seven)X +2307(reveals)X +2564(that)X +2713(we)X +2836(are)X +2964(able)X +3127(to)X +3218(overlap)X +3487(CPU)X +3670(and)X +3814(disk)X +3975(utilization)X +555 3534(slightly)N +825(producing)X +1181(approximately)X +1674(a)X +1740(10%)X +1917(performance)X +2354(improvement)X +2811(with)X +2983(two)X +3133(processes.)X +3511(After)X +3711(that)X +3861(point,)X +4075(perfor-)X +555 3624(mance)N +785(drops)X +983(off,)X +1117(and)X +1253(at)X +1331(a)X +1387(multi-programming)X +2038(level)X +2214(of)X +2301(4,)X +2381(we)X +2495(are)X +2614(performing)X +2995(worse)X +3207(than)X +3365(in)X +3447(the)X +3565(single)X +3776(process)X +4037(case.)X +755 3747(Similar)N +1021(behavior)X +1333(was)X +1489(reported)X +1787(on)X +1897(the)X +2025(commercial)X +2434(relational)X +2767(database)X +3074(system)X +3326(using)X +3529(the)X +3657(same)X +3852(con\256guration.)X +555 3837(The)N +707(important)X +1045(conclusion)X +1419(to)X +1508(draw)X +1696(from)X +1879(this)X +2021(is)X +2101(that)X +2248(you)X +2395(cannot)X +2636(attain)X +2841(good)X +3028(multi-user)X +3384(scaling)X +3638(on)X +3745(a)X +3808(badly)X +4013(balanced)X +555 3927(system.)N +839(If)X +915(multi-user)X +1266(performance)X +1695(on)X +1797(applications)X +2205(of)X +2293(this)X +2429(sort)X +2570(is)X +2644(important,)X +2996(one)X +3133(must)X +3309(have)X +3482(a)X +3539(separate)X +3824(logging)X +4089(device)X +555 4017(and)N +697(horizontally)X +1110(partition)X +1407(the)X +1531(database)X +1834(to)X +1921(allow)X +2124(a)X +2185(suf\256ciently)X +2570(high)X +2737(degree)X +2977(of)X +3069(multiprogramming)X +3698(that)X +3843(group)X +4055(commit)X +555 4107(can)N +687(amortize)X +988(the)X +1106(cost)X +1255(of)X +1342(log)X +1464(\257ushing.)X +755 4230(By)N +871(using)X +1067(a)X +1126(very)X +1292(small)X +1488(database)X +1788(\(one)X +1954(that)X +2097(can)X +2232(be)X +2331(entirely)X +2599(cached)X +2846(in)X +2930(main)X +3112(memory\))X +3428(and)X +3566(read-only)X +3896(transactions,)X +555 4320(we)N +670(generated)X +1004(a)X +1061(CPU)X +1236(bound)X +1456(environment.)X +1921(By)X +2034(using)X +2227(the)X +2345(same)X +2530(small)X +2723(database,)X +3040(the)X +3158(complete)X +3472(TPCB)X +3691(transaction,)X +4083(and)X +4219(no)X +3 f +555 4410(fsync)N +1 f +733(\(2\))X +862(on)X +977(the)X +1110(log)X +1247(at)X +1340(commit,)X +1639(we)X +1768(created)X +2036(a)X +2107(lock)X +2280(contention)X +2652(bound)X +2886(environment.)X +3365(The)X +3524(small)X +3731(database)X +4042(used)X +4223(an)X +555 4500(account)N +828(\256le)X +953(containing)X +1314(only)X +1479(1000)X +1662(records)X +1922(rather)X +2133(than)X +2294(the)X +2415(full)X +2549(1,000,000)X +2891(records)X +3150(and)X +3288(ran)X +3413(enough)X +3671(transactions)X +4076(to)X +4160(read)X +555 4590(the)N +677(entire)X +883(database)X +1183(into)X +1330(the)X +1451(buffer)X +1671(pool)X +1836(\(2000\))X +2073(before)X +2302(beginning)X +2645(measurements.)X +3147(The)X +3295(read-only)X +3626(transaction)X +4001(consisted)X +555 4680(of)N +646(three)X +831(database)X +1132(reads)X +1326(\(from)X +1533(the)X +1655(1000)X +1839(record)X +2069(account)X +2343(\256le,)X +2489(the)X +2611(100)X +2754(record)X +2983(teller)X +3171(\256le,)X +3316(and)X +3455(the)X +3576(10)X +3679(record)X +3908(branch)X +4150(\256le\).)X +555 4770(Since)N +759(no)X +865(data)X +1025(were)X +1208(modi\256ed)X +1518(and)X +1660(no)X +1766(history)X +2014(records)X +2277(were)X +2460(written,)X +2733(no)X +2839(log)X +2966(records)X +3228(were)X +3410(written.)X +3702(For)X +3838(the)X +3961(contention)X +555 4860(bound)N +780(con\256guration,)X +1252(we)X +1371(used)X +1543(the)X +1666(normal)X +1918(TPCB)X +2142(transaction)X +2519(\(against)X +2798(the)X +2920(small)X +3117(database\))X +3445(and)X +3585(disabled)X +3876(the)X +3998(log)X +4124(\257ush.)X +555 4950(Figure)N +784(eight)X +964(shows)X +1184(both)X +1346(of)X +1433(these)X +1618(results.)X +755 5073(The)N +902(read-only)X +1231(test)X +1363(indicates)X +1669(that)X +1810(we)X +1925(barely)X +2147(scale)X +2329(at)X +2408(all)X +2509(in)X +2592(the)X +2711(CPU)X +2887(bound)X +3108(case.)X +3308(The)X +3454(explanation)X +3849(for)X +3964(that)X +4105(is)X +4179(that)X +555 5163(even)N +735(with)X +905(a)X +969(single)X +1188(process,)X +1477(we)X +1599(are)X +1726(able)X +1888(to)X +1978(drive)X +2171(the)X +2297(CPU)X +2480(utilization)X +2832(to)X +2922(96%.)X +3137(As)X +3254(a)X +3317(result,)X +3542(that)X +3689(gives)X +3885(us)X +3983(very)X +4153(little)X +555 5253(room)N +753(for)X +876(improvement,)X +1352(and)X +1497(it)X +1570(takes)X +1764(a)X +1829(multiprogramming)X +2462(level)X +2647(of)X +2743(four)X +2906(to)X +2997(approach)X +3321(100%)X +3537(CPU)X +3721(saturation.)X +4106(In)X +4201(the)X +555 5343(case)N +718(where)X +939(we)X +1057(do)X +1161(perform)X +1444(writes,)X +1684(we)X +1802(are)X +1925(interested)X +2261(in)X +2347(detecting)X +2665(when)X +2863(lock)X +3025(contention)X +3387(becomes)X +3691(a)X +3750(dominant)X +4075(perfor-)X +555 5433(mance)N +787(factor.)X +1037(Contention)X +1414(will)X +1560(cause)X +1761(two)X +1903(phenomena;)X +2317(we)X +2433(will)X +2579(see)X +2704(transactions)X +3109(queueing)X +3425(behind)X +3665(frequently)X +4017(accessed)X +555 5523(data,)N +731(and)X +869(we)X +985(will)X +1131(see)X +1256(transaction)X +1629(abort)X +1815(rates)X +1988(increasing)X +2339(due)X +2476(to)X +2559(deadlock.)X +2910(Given)X +3127(that)X +3268(the)X +3387(branch)X +3627(\256le)X +3750(contains)X +4038(only)X +4201(ten)X +8 s +10 f +555 5595(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)N +5 s +1 f +727 5673(4)N +8 s +763 5698(Although)N +1021(the)X +1115(log)X +1213(is)X +1272(written)X +1469(sequentially,)X +1810(we)X +1900(do)X +1980(not)X +2078(get)X +2172(the)X +2266(bene\256t)X +2456(of)X +2525(sequentiality)X +2868(since)X +3015(the)X +3109(log)X +3207(and)X +3315(database)X +3550(reside)X +3718(on)X +3798(the)X +3892(same)X +4039(disk.)X + +13 p +%%Page: 13 13 +8 s 8 xH 0 xS 1 f +10 s +3 f +1 f +3187 2051 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +3286 2028 MXY +0 17 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +3384 1926 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +3483 1910 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +3581 1910 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +3680 1832 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +3778 1909 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +3877 1883 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +3975 1679 MXY +0 17 Dl +0 -8 Dl +9 0 Dl +-18 0 Dl +4074 1487 MXY +0 17 Dl +0 -8 Dl +9 0 Dl +-18 0 Dl +5 Dt +3187 2060 MXY +99 -24 Dl +98 -101 Dl +99 -16 Dl +98 0 Dl +99 -78 Dl +98 77 Dl +99 -26 Dl +98 -204 Dl +99 -192 Dl +3 f +6 s +4088 1516(SMALL)N +3 Dt +3187 2051 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +3286 2051 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +3384 2041 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +3483 1990 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +3581 1843 MXY +0 17 Dl +0 -8 Dl +9 0 Dl +-18 0 Dl +3680 1578 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +3778 1496 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +3877 1430 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +3975 1269 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +4074 1070 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +1 Dt +3187 2060 MXY +99 0 Dl +98 -10 Dl +99 -51 Dl +98 -147 Dl +99 -265 Dl +98 -82 Dl +99 -66 Dl +98 -161 Dl +99 -199 Dl +4088 1099(LARGE)N +5 Dt +3089 2060 MXY +985 0 Dl +3089 MX +0 -1174 Dl +4 Ds +1 Dt +3581 2060 MXY +0 -1174 Dl +4074 2060 MXY +0 -1174 Dl +3089 1825 MXY +985 0 Dl +9 s +2993 1855(25)N +3089 1591 MXY +985 0 Dl +2993 1621(50)N +3089 1356 MXY +985 0 Dl +2993 1386(75)N +3089 1121 MXY +985 0 Dl +2957 1151(100)N +3089 886 MXY +985 0 Dl +2957 916(125)N +3281 2199(Multiprogramming)N +3071 2152(0)N +3569(5)X +4038(10)X +2859 787(Aborts)N +3089(per)X +3211(500)X +2901 847(transactions)N +-1 Ds +3 Dt +2037 1342 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +2125 1358 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +2213 1341 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +2301 1191 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +2388 1124 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-17 0 Dl +2476 1157 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +2564 1157 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +2652 1161 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +2740 1153 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +2828 1150 MXY +0 18 Dl +0 -9 Dl +8 0 Dl +-17 0 Dl +5 Dt +2037 1351 MXY +88 16 Dl +88 -17 Dl +88 -150 Dl +87 -67 Dl +88 33 Dl +88 0 Dl +88 4 Dl +88 -8 Dl +88 -3 Dl +6 s +2685 1234(READ-ONLY)N +3 Dt +2037 1464 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +2125 1640 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +2213 1854 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +2301 1872 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +2388 1871 MXY +0 17 Dl +0 -9 Dl +9 0 Dl +-17 0 Dl +2476 1933 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +2564 1914 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +2652 1903 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +2740 1980 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +2828 2004 MXY +0 18 Dl +0 -9 Dl +8 0 Dl +-17 0 Dl +1 Dt +2037 1473 MXY +88 176 Dl +88 214 Dl +88 18 Dl +87 -2 Dl +88 63 Dl +88 -19 Dl +88 -11 Dl +88 77 Dl +88 24 Dl +2759 1997(NO-FSYNC)N +5 Dt +1949 2060 MXY +879 0 Dl +1949 MX +0 -1174 Dl +4 Ds +1 Dt +2388 2060 MXY +0 -1174 Dl +2828 2060 MXY +0 -1174 Dl +1949 1825 MXY +879 0 Dl +9 s +1842 1855(40)N +1949 1591 MXY +879 0 Dl +1842 1621(80)N +1949 1356 MXY +879 0 Dl +1806 1386(120)N +1949 1121 MXY +879 0 Dl +1806 1151(160)N +1949 886 MXY +879 0 Dl +1806 916(200)N +2088 2199(Multiprogramming)N +1844 863(in)N +1922(TPS)X +1761 792(Throughput)N +1931 2121(0)N +2370 2133(5)N +2792(10)X +6 s +1679 1833(LIBTP)N +-1 Ds +3 Dt +837 1019 MXY +0 17 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +929 878 MXY +0 17 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +1021 939 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +1113 1043 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +1205 1314 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +1297 1567 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +1389 1665 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +1481 1699 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +1573 1828 MXY +0 18 Dl +0 -9 Dl +9 0 Dl +-18 0 Dl +1665 1804 MXY +0 18 Dl +0 -9 Dl +8 0 Dl +-17 0 Dl +5 Dt +837 1027 MXY +92 -141 Dl +92 62 Dl +92 104 Dl +92 271 Dl +92 253 Dl +92 98 Dl +92 34 Dl +92 129 Dl +92 -24 Dl +745 2060 MXY +920 0 Dl +745 MX +0 -1174 Dl +4 Ds +1 Dt +1205 2060 MXY +0 -1174 Dl +1665 2060 MXY +0 -1174 Dl +745 1766 MXY +920 0 Dl +9 s +673 1796(3)N +745 1473 MXY +920 0 Dl +673 1503(5)N +745 1180 MXY +920 0 Dl +673 1210(8)N +745 886 MXY +920 0 Dl +637 916(10)N +905 2199(Multiprogramming)N +622 851(in)N +700(TPS)X +575 792(Throughput)N +733 2152(0)N +1196(5)X +1629(10)X +3 Dt +-1 Ds +8 s +655 2441(Figure)N +872(7:)X +960(Multi-user)X +1286(Performance.)X +1 f +655 2531(Since)N +825(the)X +931(con\256guration)X +1300(is)X +1371(completely)X +655 2621(disk)N +790(bound,)X +994(we)X +1096(see)X +1204(only)X +1345(a)X +1400(small)X +1566(im-)X +655 2711(provement)N +964(by)X +1064(adding)X +1274(a)X +1337(second)X +1549(pro-)X +655 2801(cess.)N +849(Adding)X +1081(any)X +1213(more)X +1383(concurrent)X +655 2891(processes)N +935(causes)X +1137(performance)X +1493(degra-)X +655 2981(dation.)N +3 f +1927 2441(Figure)N +2149(8:)X +2243(Multi-user)X +2574(Performance)X +1927 2531(on)N +2021(a)X +2079(small)X +2251(database.)X +1 f +2551(With)X +2704(one)X +2821(pro-)X +1927 2621(cess,)N +2075(we)X +2174(are)X +2276(driving)X +2486(the)X +2589(CPU)X +2739(at)X +2810(96%)X +1927 2711(utilization)N +2215(leaving)X +2430(little)X +2575(room)X +2737(for)X +2838(im-)X +1927 2801(provement)N +2238(as)X +2328(the)X +2443(multiprogramming)X +1927 2891(level)N +2091(increases.)X +2396(In)X +2489(the)X +2607(NO-FSYNC)X +1927 2981(case,)N +2076(lock)X +2209(contention)X +2502(degrades)X +2751(perfor-)X +1927 3071(mance)N +2117(as)X +2194(soon)X +2339(as)X +2416(a)X +2468(second)X +2669(process)X +2884(is)X +1927 3161(added.)N +3 f +3199 2441(Figure)N +3405(9:)X +3482(Abort)X +3669(rates)X +3827(on)X +3919(the)X +4028(TPCB)X +3199 2531(Benchmark.)N +1 f +3589(The)X +3726(abort)X +3895(rate)X +4028(climbs)X +3199 2621(more)N +3366(quickly)X +3594(for)X +3704(the)X +3818(large)X +3980(database)X +3199 2711(test)N +3324(since)X +3491(processes)X +3771(are)X +3884(descheduled)X +3199 2801(more)N +3409(frequently,)X +3766(allowing)X +4068(more)X +3199 2891(processes)N +3459(to)X +3525(vie)X +3619(for)X +3709(the)X +3803(same)X +3950(locks.)X +10 s +10 f +555 3284(h)N +579(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)X +1 f +555 3560(records,)N +835(we)X +952(expect)X +1185(contention)X +1546(to)X +1631(become)X +1904(a)X +1963(factor)X +2174(quickly)X +2437(and)X +2576(the)X +2697(NO-FSYNC)X +3120(line)X +3263(in)X +3348(\256gure)X +3557(eight)X +3739(demonstrates)X +4184(this)X +555 3650(dramatically.)N +1022(Each)X +1209(additional)X +1555(process)X +1822(causes)X +2058(both)X +2226(more)X +2417(waiting)X +2682(and)X +2823(more)X +3013(deadlocking.)X +3470(Figure)X +3704(nine)X +3867(shows)X +4092(that)X +4237(in)X +555 3740(the)N +681(small)X +882(database)X +1187(case)X +1353(\(SMALL\),)X +1725(waiting)X +1992(is)X +2072(the)X +2197(dominant)X +2526(cause)X +2732(of)X +2826(declining)X +3151(performance)X +3585(\(the)X +3737(number)X +4009(of)X +4103(aborts)X +555 3830(increases)N +878(less)X +1026(steeply)X +1281(than)X +1447(the)X +1573(performance)X +2008(drops)X +2214(off)X +2336(in)X +2426(\256gure)X +2641(eight\),)X +2876(while)X +3082(in)X +3172(the)X +3298(large)X +3487(database)X +3792(case)X +3958(\(LARGE\),)X +555 3920(deadlocking)N +967(contributes)X +1343(more)X +1528(to)X +1610(the)X +1728(declining)X +2046(performance.)X +755 4043(Deadlocks)N +1116(are)X +1237(more)X +1424(likely)X +1628(to)X +1712(occur)X +1913(in)X +1997(the)X +2116(LARGE)X +2404(test)X +2536(than)X +2695(in)X +2778(the)X +2897(SMALL)X +3189(test)X +3321(because)X +3597(there)X +3779(are)X +3899(more)X +4085(oppor-)X +555 4133(tunities)N +814(to)X +900(wait.)X +1082(In)X +1173(the)X +1295(SMALL)X +1590(case,)X +1773(processes)X +2105(never)X +2307(do)X +2410(I/O)X +2540(and)X +2679(are)X +2801(less)X +2944(likely)X +3149(to)X +3234(be)X +3333(descheduled)X +3753(during)X +3985(a)X +4044(transac-)X +555 4223(tion.)N +740(In)X +828(the)X +947(LARGE)X +1235(case,)X +1415(processes)X +1744(will)X +1889(frequently)X +2240(be)X +2337(descheduled)X +2755(since)X +2941(they)X +3100(have)X +3273(to)X +3356(perform)X +3636(I/O.)X +3804(This)X +3967(provides)X +4263(a)X +555 4313(window)N +837(where)X +1058(a)X +1118(second)X +1365(process)X +1630(can)X +1766(request)X +2022(locks)X +2215(on)X +2318(already)X +2578(locked)X +2815(pages,)X +3041(thus)X +3197(increasing)X +3550(the)X +3671(likelihood)X +4018(of)X +4108(build-)X +555 4403(ing)N +677(up)X +777(long)X +939(chains)X +1164(of)X +1251(waiting)X +1511(processes.)X +1879(Eventually,)X +2266(this)X +2401(leads)X +2586(to)X +2668(deadlock.)X +3 f +555 4589(5.2.)N +715(The)X +868(OO1)X +1052(Benchmark)X +1 f +755 4712(The)N +903(TPCB)X +1125(benchmark)X +1505(described)X +1836(in)X +1921(the)X +2042(previous)X +2341(section)X +2591(measures)X +2913(performance)X +3343(under)X +3549(a)X +3608(conventional)X +4044(transac-)X +555 4802(tion)N +706(processing)X +1076(workload.)X +1446(Other)X +1656(application)X +2039(domains,)X +2357(such)X +2531(as)X +2625(computer-aided)X +3156(design,)X +3412(have)X +3591(substantially)X +4022(different)X +555 4892(access)N +786(patterns.)X +1105(In)X +1197(order)X +1392(to)X +1479(measure)X +1772(the)X +1895(performance)X +2327(of)X +2418(LIBTP)X +2664(under)X +2871(workloads)X +3229(of)X +3320(this)X +3459(type,)X +3641(we)X +3759(implemented)X +4201(the)X +555 4982(OO1)N +731(benchmark)X +1108(described)X +1436(in)X +1518([CATT91].)X +755 5105(The)N +908(database)X +1213(models)X +1472(a)X +1535(set)X +1651(of)X +1745(electronics)X +2120(components)X +2534(with)X +2703(connections)X +3113(among)X +3358(them.)X +3585(One)X +3746(table)X +3929(stores)X +4143(parts)X +555 5195(and)N +696(another)X +962(stores)X +1174(connections.)X +1622(There)X +1835(are)X +1959(three)X +2145(connections)X +2552(originating)X +2927(at)X +3009(any)X +3149(given)X +3351(part.)X +3540(Ninety)X +3782(percent)X +4043(of)X +4134(these)X +555 5285(connections)N +960(are)X +1081(to)X +1165(nearby)X +1406(parts)X +1584(\(those)X +1802(with)X +1966(nearby)X +2 f +2207(ids)X +1 f +2300(\))X +2348(to)X +2431(model)X +2652(the)X +2771(spatial)X +3001(locality)X +3262(often)X +3448(exhibited)X +3767(in)X +3850(CAD)X +4040(applica-)X +555 5375(tions.)N +779(Ten)X +933(percent)X +1198(of)X +1293(the)X +1419(connections)X +1830(are)X +1957(randomly)X +2292(distributed)X +2662(among)X +2908(all)X +3016(other)X +3209(parts)X +3393(in)X +3483(the)X +3609(database.)X +3954(Every)X +4174(part)X +555 5465(appears)N +829(exactly)X +1089(three)X +1278(times)X +1479(in)X +1569(the)X +2 f +1695(from)X +1 f +1874(\256eld)X +2043(of)X +2137(a)X +2200(connection)X +2579(record,)X +2832(and)X +2975(zero)X +3141(or)X +3235(more)X +3427(times)X +3627(in)X +3716(the)X +2 f +3841(to)X +1 f +3930(\256eld.)X +4139(Parts)X +555 5555(have)N +2 f +727(x)X +1 f +783(and)X +2 f +919(y)X +1 f +975(locations)X +1284(set)X +1393(randomly)X +1720(in)X +1802(an)X +1898(appropriate)X +2284(range.)X + +14 p +%%Page: 14 14 +10 s 10 xH 0 xS 1 f +3 f +1 f +755 630(The)N +900(intent)X +1102(of)X +1189(OO1)X +1365(is)X +1438(to)X +1520(measure)X +1808(the)X +1926(overall)X +2169(cost)X +2318(of)X +2405(a)X +2461(query)X +2664(mix)X +2808(characteristic)X +3257(of)X +3344(engineering)X +3743(database)X +4040(applica-)X +555 720(tions.)N +770(There)X +978(are)X +1097(three)X +1278(tests:)X +10 f +635 843(g)N +2 f +755(Lookup)X +1 f +1022(generates)X +1353(1,000)X +1560(random)X +1832(part)X +2 f +1984(ids)X +1 f +2077(,)X +2124(fetches)X +2378(the)X +2502(corresponding)X +2987(parts)X +3169(from)X +3351(the)X +3475(database,)X +3798(and)X +3940(calls)X +4113(a)X +4175(null)X +755 933(procedure)N +1097(in)X +1179(the)X +1297(host)X +1450(programming)X +1906(language)X +2216(with)X +2378(the)X +2496(parts')X +2 f +2699(x)X +1 f +2755(and)X +2 f +2891(y)X +1 f +2947(positions.)X +10 f +635 1056(g)N +2 f +755(Traverse)X +1 f +1067(retrieves)X +1371(a)X +1434(random)X +1706(part)X +1858(from)X +2041(the)X +2166(database)X +2470(and)X +2613(follows)X +2880(connections)X +3290(from)X +3473(it)X +3544(to)X +3632(other)X +3823(parts.)X +4045(Each)X +4232(of)X +755 1146(those)N +947(parts)X +1126(is)X +1202(retrieved,)X +1531(and)X +1670(all)X +1773(connections)X +2179(from)X +2358(it)X +2424(followed.)X +2771(This)X +2935(procedure)X +3279(is)X +3354(repeated)X +3649(depth-\256rst)X +4000(for)X +4116(seven)X +755 1236(hops)N +930(from)X +1110(the)X +1232(original)X +1505(part,)X +1674(for)X +1792(a)X +1852(total)X +2018(of)X +2109(3280)X +2293(parts.)X +2513(Backward)X +2862(traversal)X +3162(also)X +3314(exists,)X +3539(and)X +3678(follows)X +3941(all)X +4044(connec-)X +755 1326(tions)N +930(into)X +1074(a)X +1130(given)X +1328(part)X +1473(to)X +1555(their)X +1722(origin.)X +10 f +635 1449(g)N +2 f +755(Insert)X +1 f +962(adds)X +1129(100)X +1269(new)X +1423(parts)X +1599(and)X +1735(their)X +1902(connections.)X +755 1572(The)N +913(benchmark)X +1303(is)X +1389(single-user,)X +1794(but)X +1929(multi-user)X +2291(access)X +2530(controls)X +2821(\(locking)X +3120(and)X +3268(transaction)X +3652(protection\))X +4036(must)X +4223(be)X +555 1662(enforced.)N +898(It)X +968(is)X +1042(designed)X +1348(to)X +1431(be)X +1528(run)X +1656(on)X +1757(a)X +1814(database)X +2112(with)X +2275(20,000)X +2516(parts,)X +2713(and)X +2850(on)X +2951(one)X +3087(with)X +3249(200,000)X +3529(parts.)X +3745(Because)X +4033(we)X +4147(have)X +555 1752(insuf\256cient)N +935(disk)X +1088(space)X +1287(for)X +1401(the)X +1519(larger)X +1727(database,)X +2044(we)X +2158(report)X +2370(results)X +2599(only)X +2761(for)X +2875(the)X +2993(20,000)X +3233(part)X +3378(database.)X +3 f +555 1938(5.2.1.)N +775(Implementation)X +1 f +755 2061(The)N +920(LIBTP)X +1182(implementation)X +1724(of)X +1831(OO1)X +2027(uses)X +2205(the)X +2342(TCL)X +2532([OUST90])X +2914(interface)X +3235(described)X +3582(earlier.)X +3867(The)X +4031(backend)X +555 2151(accepts)N +813(commands)X +1181(over)X +1345(an)X +1442(IP)X +1534(socket)X +1760(and)X +1897(performs)X +2208(the)X +2327(requested)X +2656(database)X +2954(actions.)X +3242(The)X +3387(frontend)X +3679(opens)X +3886(and)X +4022(executes)X +555 2241(a)N +618(TCL)X +796(script.)X +1041(This)X +1210(script)X +1415(contains)X +1709(database)X +2013(accesses)X +2313(interleaved)X +2697(with)X +2866(ordinary)X +3165(program)X +3463(control)X +3716(statements.)X +4120(Data-)X +555 2331(base)N +718(commands)X +1085(are)X +1204(submitted)X +1539(to)X +1621(the)X +1739(backend)X +2027(and)X +2163(results)X +2392(are)X +2511(bound)X +2731(to)X +2813(program)X +3105(variables.)X +755 2454(The)N +903(parts)X +1082(table)X +1261(was)X +1409(stored)X +1628(as)X +1718(a)X +1776(B-tree)X +1999(indexed)X +2275(by)X +2 f +2377(id)X +1 f +2439(.)X +2501(The)X +2648(connection)X +3022(table)X +3200(was)X +3347(stored)X +3565(as)X +3654(a)X +3712(set)X +3823(of)X +3912(\256xed-length)X +555 2544(records)N +824(using)X +1029(the)X +1159(4.4BSD)X +1446(recno)X +1657(access)X +1895(method.)X +2207(In)X +2306(addition,)X +2620(two)X +2771(B-tree)X +3003(indices)X +3261(were)X +3449(maintained)X +3836(on)X +3947(connection)X +555 2634(table)N +732(entries.)X +1007(One)X +1162(index)X +1360(mapped)X +1634(the)X +2 f +1752(from)X +1 f +1923(\256eld)X +2085(to)X +2167(a)X +2223(connection)X +2595(record)X +2821(number,)X +3106(and)X +3242(the)X +3360(other)X +3545(mapped)X +3819(the)X +2 f +3937(to)X +1 f +4019(\256eld)X +4181(to)X +4263(a)X +555 2724(connection)N +932(record)X +1163(number.)X +1473(These)X +1690(indices)X +1941(support)X +2205(fast)X +2345(lookups)X +2622(on)X +2726(connections)X +3133(in)X +3219(both)X +3385(directions.)X +3765(For)X +3900(the)X +4022(traversal)X +555 2814(tests,)N +743(the)X +867(frontend)X +1165(does)X +1338(an)X +1439(index)X +1642(lookup)X +1889(to)X +1976(discover)X +2273(the)X +2396(connected)X +2747(part's)X +2 f +2955(id)X +1 f +3017(,)X +3062(and)X +3203(then)X +3366(does)X +3538(another)X +3804(lookup)X +4051(to)X +4138(fetch)X +555 2904(the)N +673(part)X +818(itself.)X +3 f +555 3090(5.2.2.)N +775(Performance)X +1242(Measurements)X +1766(for)X +1889(OO1)X +1 f +755 3213(We)N +888(compare)X +1186(LIBTP's)X +1487(OO1)X +1664(performance)X +2092(to)X +2174(that)X +2314(reported)X +2602(in)X +2684([CATT91].)X +3087(Those)X +3303(results)X +3532(were)X +3709(collected)X +4019(on)X +4119(a)X +4175(Sun)X +555 3303(3/280)N +759(\(25)X +888(MHz)X +1075(MC68020\))X +1448(with)X +1612(16)X +1714(MBytes)X +1989(of)X +2078(memory)X +2367(and)X +2505(two)X +2647(Hitachi)X +2904(892MByte)X +3267(disks)X +3452(\(15)X +3580(ms)X +3694(average)X +3966(seek)X +4130(time\))X +555 3393(behind)N +793(an)X +889(SMD-4)X +1149(controller.)X +1521(Frontends)X +1861(ran)X +1984(on)X +2084(an)X +2180(8MByte)X +2462(Sun)X +2606(3/260.)X +755 3516(In)N +844(order)X +1036(to)X +1120(measure)X +1410(performance)X +1839(on)X +1941(a)X +1999(machine)X +2293(of)X +2382(roughly)X +2653(equivalent)X +3009(processor)X +3339(power,)X +3582(we)X +3698(ran)X +3822(one)X +3959(set)X +4069(of)X +4157(tests)X +555 3606(on)N +666(a)X +733(standalone)X +1107(MC68030-based)X +1671(HP300)X +1923(\(33MHz)X +2225(MC68030\).)X +2646(The)X +2801(database)X +3108(was)X +3263(stored)X +3489(on)X +3599(a)X +3665(300MByte)X +4037(HP7959)X +555 3696(SCSI)N +744(disk)X +898(\(17)X +1026(ms)X +1139(average)X +1410(seek)X +1573(time\).)X +1802(Since)X +2000(this)X +2135(machine)X +2427(is)X +2500(not)X +2622(connected)X +2968(to)X +3050(a)X +3106(network,)X +3409(we)X +3523(ran)X +3646(local)X +3822(tests)X +3984(where)X +4201(the)X +555 3786(frontend)N +855(and)X +999(backend)X +1295(run)X +1430(on)X +1538(the)X +1664(same)X +1856(machine.)X +2195(We)X +2334(compare)X +2638(these)X +2830(measurements)X +3316(with)X +3485(Cattell's)X +3783(local)X +3966(Sun)X +4117(3/280)X +555 3876(numbers.)N +755 3999(Because)N +1051(the)X +1177(benchmark)X +1562(requires)X +1849(remote)X +2100(access,)X +2354(we)X +2476(ran)X +2607(another)X +2876(set)X +2993(of)X +3088(tests)X +3258(on)X +3365(a)X +3428(DECstation)X +3828(5000/200)X +4157(with)X +555 4089(32M)N +732(of)X +825(memory)X +1118(running)X +1393(Ultrix)X +1610(V4.0)X +1794(and)X +1936(a)X +1998(DEC)X +2184(1GByte)X +2459(RZ57)X +2666(SCSI)X +2859(disk.)X +3057(We)X +3194(compare)X +3496(the)X +3619(local)X +3800(performance)X +4232(of)X +555 4179(OO1)N +734(on)X +837(the)X +958(DECstation)X +1354(to)X +1439(its)X +1536(remote)X +1781(performance.)X +2250(For)X +2383(the)X +2503(remote)X +2748(case,)X +2929(we)X +3045(ran)X +3170(the)X +3290(frontend)X +3584(on)X +3686(a)X +3744(DECstation)X +4139(3100)X +555 4269(with)N +717(16)X +817(MBytes)X +1090(of)X +1177(main)X +1357(memory.)X +755 4392(The)N +900(databases)X +1228(tested)X +1435(in)X +1517([CATT91])X +1880(are)X +10 f +635 4515(g)N +1 f +755(INDEX,)X +1045(a)X +1101(highly-optimized)X +1672(access)X +1898(method)X +2158(package)X +2442(developed)X +2792(at)X +2870(Sun)X +3014(Microsystems.)X +10 f +635 4638(g)N +1 f +755(OODBMS,)X +1137(a)X +1193(beta)X +1347(release)X +1591(of)X +1678(a)X +1734(commercial)X +2133(object-oriented)X +2639(database)X +2936(management)X +3366(system.)X +10 f +635 4761(g)N +1 f +755(RDBMS,)X +1076(a)X +1133(UNIX-based)X +1565(commercial)X +1965(relational)X +2289(data)X +2444(manager)X +2742(at)X +2821(production)X +3189(release.)X +3474(The)X +3620(OO1)X +3797(implementation)X +755 4851(used)N +922(embedded)X +1272(SQL)X +1443(in)X +1525(C.)X +1638(Stored)X +1867(procedures)X +2240(were)X +2417(de\256ned)X +2673(to)X +2755(reduce)X +2990(client-server)X +3412(traf\256c.)X +755 4974(Table)N +974(two)X +1130(shows)X +1366(the)X +1500(measurements)X +1995(from)X +2187([CATT91])X +2566(and)X +2718(LIBTP)X +2976(for)X +3106(a)X +3178(local)X +3370(test)X +3517(on)X +3632(the)X +3765(MC680x0-based)X +555 5064(hardware.)N +915(All)X +1037(caches)X +1272(are)X +1391(cleared)X +1644(before)X +1870(each)X +2038(test.)X +2209(All)X +2331(times)X +2524(are)X +2643(in)X +2725(seconds.)X +755 5187(Table)N +960(two)X +1102(shows)X +1324(that)X +1466(LIBTP)X +1710(outperforms)X +2123(the)X +2242(commercial)X +2642(relational)X +2966(system,)X +3229(but)X +3352(is)X +3426(slower)X +3661(than)X +3820(OODBMS)X +4183(and)X +555 5277(INDEX.)N +872(Since)X +1077(the)X +1202(caches)X +1444(were)X +1628(cleared)X +1888(at)X +1973(the)X +2098(start)X +2263(of)X +2356(each)X +2530(test,)X +2687(disk)X +2846(throughput)X +3223(is)X +3302(critical)X +3551(in)X +3639(this)X +3780(test.)X +3957(The)X +4108(single)X +555 5367(SCSI)N +749(HP)X +877(drive)X +1068(used)X +1241(by)X +1347(LIBTP)X +1595(is)X +1674(approximately)X +2163(13%)X +2336(slower)X +2576(than)X +2739(the)X +2862(disks)X +3051(used)X +3223(in)X +3310([CATT91])X +3678(which)X +3899(accounts)X +4205(for)X +555 5457(part)N +700(of)X +787(the)X +905(difference.)X +755 5580(OODBMS)N +1118(and)X +1255(INDEX)X +1525(outperform)X +1906(LIBTP)X +2148(most)X +2323(dramatically)X +2744(on)X +2844(traversal.)X +3181(This)X +3343(is)X +3416(because)X +3691(we)X +3805(use)X +3932(index)X +4130(look-)X +555 5670(ups)N +689(to)X +774(\256nd)X +921(connections,)X +1347(whereas)X +1634(the)X +1755(other)X +1942(two)X +2084(systems)X +2359(use)X +2488(a)X +2546(link)X +2692(access)X +2920(method.)X +3222(The)X +3369(index)X +3569(requires)X +3850(us)X +3943(to)X +4027(examine)X + +15 p +%%Page: 15 15 +10 s 10 xH 0 xS 1 f +3 f +1 f +10 f +555 679(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)N +2 f +606 769(Measure)N +1 f +1019(INDEX)X +1389(OODBMS)X +1851(RDBMS)X +2250(LIBTP)X +10 f +555 771(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)N +555 787(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)N +1 f +595 869(Lookup)N +1114(5.4)X +1490(12.9)X +1950(27)X +2291(27.2)X +595 959(Traversal)N +1074(13)X +1530(9.8)X +1950(90)X +2291(47.3)X +595 1049(Insert)N +1114(7.4)X +1530(1.5)X +1950(22)X +2331(9.7)X +10 f +555 1059(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)N +555(c)X +999(c)Y +919(c)Y +839(c)Y +759(c)Y +959 1059(c)N +999(c)Y +919(c)Y +839(c)Y +759(c)Y +1329 1059(c)N +999(c)Y +919(c)Y +839(c)Y +759(c)Y +1791 1059(c)N +999(c)Y +919(c)Y +839(c)Y +759(c)Y +2190 1059(c)N +999(c)Y +919(c)Y +839(c)Y +759(c)Y +2512 1059(c)N +999(c)Y +919(c)Y +839(c)Y +759(c)Y +2618 679(i)N +2629(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +2 f +2829 769(Measure)N +3401(Cache)X +3726(Local)X +4028(Remote)X +1 f +10 f +2618 771(i)N +2629(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +2618 787(i)N +2629(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +2658 869(Lookup)N +3401(cold)X +3747(15.7)X +4078(20.6)X +3401 959(warm)N +3787(7.8)X +4078(12.4)X +10 f +2618 969(i)N +2629(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +2658 1059(Forward)N +2950(traversal)X +3401(cold)X +3747(28.4)X +4078(52.6)X +3401 1149(warm)N +3747(23.5)X +4078(47.4)X +10 f +2618 1159(i)N +2629(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +2658 1249(Backward)N +3004(traversal)X +3401(cold)X +3747(24.2)X +4078(47.4)X +3401 1339(warm)N +3747(24.3)X +4078(47.6)X +10 f +2618 1349(i)N +2629(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +1 f +2658 1439(Insert)N +3401(cold)X +3787(7.5)X +4078(10.3)X +3401 1529(warm)N +3787(6.7)X +4078(10.9)X +10 f +2618 1539(i)N +2629(iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)X +2618(c)X +1479(c)Y +1399(c)Y +1319(c)Y +1239(c)Y +1159(c)Y +1079(c)Y +999(c)Y +919(c)Y +839(c)Y +759(c)Y +3341 1539(c)N +1479(c)Y +1399(c)Y +1319(c)Y +1239(c)Y +1159(c)Y +1079(c)Y +999(c)Y +919(c)Y +839(c)Y +759(c)Y +3666 1539(c)N +1479(c)Y +1399(c)Y +1319(c)Y +1239(c)Y +1159(c)Y +1079(c)Y +999(c)Y +919(c)Y +839(c)Y +759(c)Y +3968 1539(c)N +1479(c)Y +1399(c)Y +1319(c)Y +1239(c)Y +1159(c)Y +1079(c)Y +999(c)Y +919(c)Y +839(c)Y +759(c)Y +4309 1539(c)N +1479(c)Y +1399(c)Y +1319(c)Y +1239(c)Y +1159(c)Y +1079(c)Y +999(c)Y +919(c)Y +839(c)Y +759(c)Y +3 f +587 1785(Table)N +823(2:)X +931(Local)X +1163(MC680x0)X +1538(Performance)X +2026(of)X +2133(Several)X +587 1875(Systems)N +883(on)X +987(OO1.)X +2667 1785(Table)N +2909(3:)X +3023(Local)X +3260(vs.)X +3397(Remote)X +3707(Performance)X +4200(of)X +2667 1875(LIBTP)N +2926(on)X +3030(OO1.)X +1 f +10 f +555 1998(h)N +579(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)X +1 f +555 2274(two)N +696(disk)X +850(pages,)X +1074(but)X +1197(the)X +1316(links)X +1492(require)X +1741(only)X +1904(one,)X +2061(regardless)X +2408(of)X +2496(database)X +2794(size.)X +2980(Cattell)X +3214(reports)X +3458(that)X +3599(lookups)X +3873(using)X +4067(B-trees)X +555 2364(instead)N +808(of)X +901(links)X +1082(makes)X +1313(traversal)X +1616(take)X +1776(twice)X +1976(as)X +2069(long)X +2237(in)X +2325(INDEX.)X +2641(Adding)X +2907(a)X +2969(link)X +3119(access)X +3351(method)X +3617(to)X +3 f +3704(db)X +1 f +3792(\(3\))X +3911(or)X +4003(using)X +4201(the)X +555 2454(existing)N +828(hash)X +995(method)X +1255(would)X +1475(apparently)X +1834(be)X +1930(a)X +1986(good)X +2166(idea.)X +755 2577(Both)N +936(OODBMS)X +1304(and)X +1446(INDEX)X +1722(issue)X +1908 0.1944(coarser-granularity)AX +2545(locks)X +2739(than)X +2902(LIBTP.)X +3189(This)X +3356(limits)X +3562(concurrency)X +3985(for)X +4104(multi-)X +555 2667(user)N +711(applications,)X +1140(but)X +1264(helps)X +1455(single-user)X +1829(applications.)X +2278(In)X +2367(addition,)X +2671(the)X +2791(fact)X +2934(that)X +3076(LIBTP)X +3319(releases)X +3595(B-tree)X +3817(locks)X +4007(early)X +4189(is)X +4263(a)X +555 2757(drawback)N +896(in)X +986(OO1.)X +1210(Since)X +1416(there)X +1605(is)X +1686(no)X +1793(concurrency)X +2218(in)X +2307(the)X +2432(benchmark,)X +2836(high-concurrency)X +3430(strategies)X +3760(only)X +3929(show)X +4125(up)X +4232(as)X +555 2847(increased)N +882(locking)X +1145(overhead.)X +1503(Finally,)X +1772(the)X +1892(architecture)X +2294(of)X +2383(the)X +2503(LIBTP)X +2747(implementation)X +3271(was)X +3418(substantially)X +3844(different)X +4143(from)X +555 2937(that)N +702(of)X +796(either)X +1006(OODBMS)X +1375(or)X +1469(INDEX.)X +1786(Both)X +1968(of)X +2062(those)X +2258(systems)X +2538(do)X +2645(the)X +2770(searches)X +3070(in)X +3159(the)X +3284(user's)X +3503(address)X +3771(space,)X +3997(and)X +4139(issue)X +555 3027(requests)N +844(for)X +964(pages)X +1173(to)X +1260(the)X +1383(server)X +1605(process.)X +1911(Pages)X +2123(are)X +2247(cached)X +2496(in)X +2583(the)X +2706(client,)X +2929(and)X +3070(many)X +3273(queries)X +3530(can)X +3667(be)X +3768(satis\256ed)X +4055(without)X +555 3117(contacting)N +910(the)X +1029(server)X +1247(at)X +1326(all.)X +1467(LIBTP)X +1710(submits)X +1979(all)X +2080(the)X +2199(queries)X +2452(to)X +2535(the)X +2653(server)X +2870(process,)X +3151(and)X +3287(receives)X +3571(database)X +3868(records)X +4125(back;)X +555 3207(it)N +619(does)X +786(no)X +886(client)X +1084(caching.)X +755 3330(The)N +911(RDBMS)X +1221(architecture)X +1632(is)X +1716(much)X +1925(closer)X +2148(to)X +2241(that)X +2392(of)X +2490(LIBTP.)X +2783(A)X +2872(server)X +3100(process)X +3372(receives)X +3667(queries)X +3930(and)X +4076(returns)X +555 3420(results)N +786(to)X +870(a)X +928(client.)X +1168(The)X +1315(timing)X +1545(results)X +1776(in)X +1860(table)X +2038(two)X +2180(clearly)X +2421(show)X +2612(that)X +2754(the)X +2874(conventional)X +3309(database)X +3607(client/server)X +4025(model)X +4246(is)X +555 3510(expensive.)N +941(LIBTP)X +1188(outperforms)X +1605(the)X +1728(RDBMS)X +2032(on)X +2136(traversal)X +2437(and)X +2577(insertion.)X +2921(We)X +3057(speculate)X +3380(that)X +3524(this)X +3663(is)X +3740(due)X +3880(in)X +3966(part)X +4115(to)X +4201(the)X +555 3600(overhead)N +870(of)X +957(query)X +1160(parsing,)X +1436(optimization,)X +1880(and)X +2016(repeated)X +2309(interpretation)X +2761(of)X +2848(the)X +2966(plan)X +3124(tree)X +3265(in)X +3347(the)X +3465(RDBMS')X +3791(query)X +3994(executor.)X +755 3723(Table)N +962(three)X +1147(shows)X +1371(the)X +1492(differences)X +1873(between)X +2164(local)X +2343(and)X +2482(remote)X +2728(execution)X +3063(of)X +3153(LIBTP's)X +3456(OO1)X +3635(implementation)X +4160(on)X +4263(a)X +555 3813(DECstation.)N +989(We)X +1122(measured)X +1451(performance)X +1879(with)X +2042(a)X +2099(populated)X +2436(\(warm\))X +2694(cache)X +2899(and)X +3036(an)X +3133(empty)X +3354(\(cold\))X +3567(cache.)X +3812(Reported)X +4126(times)X +555 3903(are)N +681(the)X +806(means)X +1037(of)X +1130(twenty)X +1374(tests,)X +1562(and)X +1704(are)X +1829(in)X +1917(seconds.)X +2237(Standard)X +2548(deviations)X +2903(were)X +3086(within)X +3316(seven)X +3525(percent)X +3788(of)X +3881(the)X +4005(mean)X +4205(for)X +555 3993(remote,)N +818(and)X +954(two)X +1094(percent)X +1351(of)X +1438(the)X +1556(mean)X +1750(for)X +1864(local.)X +755 4116(The)N +914(20ms)X +1121(overhead)X +1450(of)X +1551(TCP/IP)X +1824(on)X +1938(an)X +2048(Ethernet)X +2354(entirely)X +2633(accounts)X +2948(for)X +3076(the)X +3207(difference)X +3567(in)X +3662(speed.)X +3918(The)X +4076(remote)X +555 4206(traversal)N +857(times)X +1055(are)X +1179(nearly)X +1405(double)X +1648(the)X +1771(local)X +1952(times)X +2150(because)X +2430(we)X +2549(do)X +2653(index)X +2855(lookups)X +3132(and)X +3272(part)X +3421(fetches)X +3673(in)X +3759(separate)X +4047(queries.)X +555 4296(It)N +629(would)X +854(make)X +1053(sense)X +1252(to)X +1339(do)X +1444(indexed)X +1723(searches)X +2021(on)X +2126(the)X +2248(server,)X +2489(but)X +2615(we)X +2733(were)X +2914(unwilling)X +3244(to)X +3330(hard-code)X +3676(knowledge)X +4052(of)X +4143(OO1)X +555 4386(indices)N +803(into)X +948(our)X +1075(LIBTP)X +1317(TCL)X +1488(server.)X +1745(Cold)X +1920(and)X +2056(warm)X +2259(insertion)X +2559(times)X +2752(are)X +2871(identical)X +3167(since)X +3352(insertions)X +3683(do)X +3783(not)X +3905(bene\256t)X +4143(from)X +555 4476(caching.)N +755 4599(One)N +915(interesting)X +1279(difference)X +1632(shown)X +1867(by)X +1973(table)X +2155(three)X +2342(is)X +2421(the)X +2545(cost)X +2700(of)X +2793(forward)X +3074(versus)X +3305(backward)X +3644(traversal.)X +3987(When)X +4205(we)X +555 4689(built)N +725(the)X +847(database,)X +1168(we)X +1285(inserted)X +1562(parts)X +1741(in)X +1826(part)X +2 f +1974(id)X +1 f +2059(order.)X +2292(We)X +2427(built)X +2596(the)X +2717(indices)X +2967(at)X +3048(the)X +3169(same)X +3357(time.)X +3562(Therefore,)X +3923(the)X +4044(forward)X +555 4779(index)N +757(had)X +897(keys)X +1068(inserted)X +1346(in)X +1432(order,)X +1646(while)X +1848(the)X +1970(backward)X +2307(index)X +2509(had)X +2649(keys)X +2820(inserted)X +3098(more)X +3286(randomly.)X +3656(In-order)X +3943(insertion)X +4246(is)X +555 4885(pessimal)N +858(for)X +975(B-tree)X +1199(indices,)X +1469(so)X +1563(the)X +1684(forward)X +1962(index)X +2163(is)X +2239(much)X +2440(larger)X +2651(than)X +2812(the)X +2933(backward)X +3269(one)X +7 s +3385 4853(5)N +10 s +4885(.)Y +3476(This)X +3640(larger)X +3850(size)X +3997(shows)X +4219(up)X +555 4975(as)N +642(extra)X +823(disk)X +976(reads)X +1166(in)X +1248(the)X +1366(cold)X +1524(benchmark.)X +3 f +555 5161(6.)N +655(Conclusions)X +1 f +755 5284(LIBTP)N +1006(provides)X +1311(the)X +1438(basic)X +1632(building)X +1927(blocks)X +2165(to)X +2256(support)X +2525(transaction)X +2906(protection.)X +3300(In)X +3396(comparison)X +3799(with)X +3970(traditional)X +555 5374(Unix)N +746(libraries)X +1040(and)X +1187(commercial)X +1597(systems,)X +1900(it)X +1974(offers)X +2192(a)X +2258(variety)X +2511(of)X +2608(tradeoffs.)X +2964(Using)X +3185(complete)X +3509(transaction)X +3891(protection)X +4246(is)X +555 5464(more)N +747(complicated)X +1166(than)X +1331(simply)X +1575(adding)X +3 f +1820(fsync)X +1 f +1998(\(2\))X +2119(and)X +3 f +2262(\257ock)X +1 f +2426(\(2\))X +2547(calls)X +2721(to)X +2810(code,)X +3008(but)X +3136(it)X +3206(is)X +3285(faster)X +3490(in)X +3578(some)X +3773(cases)X +3969(and)X +4111(offers)X +8 s +10 f +555 5536(hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)N +5 s +1 f +727 5614(5)N +8 s +763 5639(The)N +878(next)X +1004(release)X +1196(of)X +1265(the)X +1359(4.4BSD)X +1580(access)X +1758(method)X +1966(will)X +2082(automatically)X +2446(detect)X +2614(and)X +2722(compensate)X +3039(for)X +3129(in-order)X +3350(insertion,)X +3606(eliminating)X +3914(this)X +4023(problem.)X + +16 p +%%Page: 16 16 +8 s 8 xH 0 xS 1 f +10 s +3 f +1 f +555 630(stricter)N +801(guarantees)X +1168(\(atomicity,)X +1540(consistency,)X +1957(isolation,)X +2275(and)X +2414(durability\).)X +2815(If)X +2892(the)X +3013(data)X +3170(to)X +3255(be)X +3354(protected)X +3676(are)X +3798(already)X +4058(format-)X +555 720(ted)N +675(\()X +2 f +702(i.e.)X +1 f +821(use)X +949(one)X +1086(of)X +1174(the)X +1293(database)X +1591(access)X +1818(methods\),)X +2157(then)X +2316(adding)X +2555(transaction)X +2928(protection)X +3274(requires)X +3554(no)X +3655(additional)X +3996(complex-)X +555 810(ity,)N +679(but)X +801(incurs)X +1017(a)X +1073(performance)X +1500(penalty)X +1756(of)X +1843(approximately)X +2326(15%.)X +755 933(In)N +844(comparison)X +1240(with)X +1404(commercial)X +1805(database)X +2104(systems,)X +2399(the)X +2519(tradeoffs)X +2827(are)X +2948(more)X +3135(complex.)X +3473(LIBTP)X +3717(does)X +3886(not)X +4009(currently)X +555 1023(support)N +825(a)X +891(standard)X +1193(query)X +1406(language.)X +1766(The)X +1921(TCL-based)X +2312(server)X +2539(process)X +2810(allows)X +3049(a)X +3115(certain)X +3364(ease)X +3533(of)X +3630(use)X +3767(which)X +3993(would)X +4223(be)X +555 1113(enhanced)N +882(with)X +1047(a)X +1106(more)X +1294(user-friendly)X +1732(interface)X +2037(\()X +2 f +2064(e.g.)X +1 f +2203(a)X +2261(windows)X +2572(based)X +2777(query-by-form)X +3272(application\),)X +3697(for)X +3813(which)X +4031(we)X +4147(have)X +555 1203(a)N +620(working)X +916(prototype.)X +1292(When)X +1513(accesses)X +1815(do)X +1924(not)X +2055(require)X +2312(sophisticated)X +2758(query)X +2969(processing,)X +3360(the)X +3486(TCL)X +3665(interface)X +3975(is)X +4056(an)X +4160(ade-)X +555 1293(quate)N +756(solution.)X +1080(What)X +1281(LIBTP)X +1529(fails)X +1693(to)X +1781(provide)X +2052(in)X +2140(functionality,)X +2595(it)X +2665(makes)X +2896(up)X +3002(for)X +3122(in)X +3210(performance)X +3643(and)X +3785(\257exibility.)X +4161(Any)X +555 1383(application)N +931(may)X +1089(make)X +1283(use)X +1410(of)X +1497(its)X +1592(record)X +1818(interface)X +2120(or)X +2207(the)X +2325(more)X +2510(primitive)X +2823(log,)X +2965(lock,)X +3143(and)X +3279(buffer)X +3496(calls.)X +755 1506(Future)N +987(work)X +1175(will)X +1322(focus)X +1519(on)X +1621(overcoming)X +2026(some)X +2217(of)X +2306(the)X +2426(areas)X +2614(in)X +2698(which)X +2916(LIBTP)X +3160(is)X +3235(currently)X +3547(de\256cient)X +3845(and)X +3983(extending)X +555 1596(its)N +652(transaction)X +1026(model.)X +1288(The)X +1435(addition)X +1719(of)X +1808(an)X +1905(SQL)X +2077(parser)X +2295(and)X +2432(forms)X +2640(front)X +2817(end)X +2954(will)X +3099(improve)X +3387(the)X +3506(system's)X +3807(ease)X +3967(of)X +4055(use)X +4183(and)X +555 1686(make)N +750(it)X +815(more)X +1001(competitive)X +1400(with)X +1563(commercial)X +1963(systems.)X +2277(In)X +2365(the)X +2484(long)X +2647(term,)X +2835(we)X +2950(would)X +3170(like)X +3310(to)X +3392(add)X +3528(generalized)X +3919(hierarchical)X +555 1776(locking,)N +836(nested)X +1062(transactions,)X +1486(parallel)X +1748(transactions,)X +2171(passing)X +2431(of)X +2518(transactions)X +2921(between)X +3209(processes,)X +3557(and)X +3693(distributed)X +4055(commit)X +555 1866(handling.)N +900(In)X +992(the)X +1115(short)X +1300(term,)X +1492(the)X +1614(next)X +1776(step)X +1929(is)X +2006(to)X +2092(integrate)X +2397(LIBTP)X +2643(with)X +2809(the)X +2931(most)X +3110(recent)X +3331(release)X +3579(of)X +3670(the)X +3792(database)X +4093(access)X +555 1956(routines)N +833(and)X +969(make)X +1163(it)X +1227(freely)X +1435(available)X +1745(via)X +1863(anonymous)X +2252(ftp.)X +3 f +555 2142(7.)N +655(Acknowledgements)X +1 f +755 2265(We)N +888(would)X +1109(like)X +1250(to)X +1332(thank)X +1530(John)X +1701(Wilkes)X +1948(and)X +2084(Carl)X +2242(Staelin)X +2484(of)X +2571(Hewlett-Packard)X +3131(Laboratories)X +3557(and)X +3693(Jon)X +3824(Krueger.)X +4148(John)X +555 2355(and)N +694(Carl)X +855(provided)X +1162(us)X +1255(with)X +1419(an)X +1517(extra)X +1700(disk)X +1855(for)X +1971(the)X +2091(HP)X +2215(testbed)X +2464(less)X +2606(than)X +2766(24)X +2868(hours)X +3068(after)X +3238(we)X +3354(requested)X +3684(it.)X +3770(Jon)X +3903(spent)X +4094(count-)X +555 2445(less)N +699(hours)X +901(helping)X +1164(us)X +1258(understand)X +1633(the)X +1754(intricacies)X +2107(of)X +2197(commercial)X +2599(database)X +2899(products)X +3198(and)X +3337(their)X +3507(behavior)X +3811(under)X +4017(a)X +4076(variety)X +555 2535(of)N +642(system)X +884(con\256gurations.)X +3 f +555 2721(8.)N +655(References)X +1 f +555 2901([ANDR89])N +942(Andrade,)X +1265(J.,)X +1361(Carges,)X +1629(M.,)X +1765(Kovach,)X +2060(K.,)X +2183(``Building)X +2541(an)X +2642(On-Line)X +2939(Transaction)X +3343(Processing)X +3715(System)X +3975(On)X +4098(UNIX)X +727 2991(System)N +982(V'',)X +2 f +1134(CommUNIXations)X +1 f +1725(,)X +1765 0.2188(November/December)AX +2477(1989.)X +555 3171([BAY77])N +878(Bayer,)X +1110(R.,)X +1223(Schkolnick,)X +1623(M.,)X +1754(``Concurrency)X +2243(of)X +2330(Operations)X +2702(on)X +2802(B-Trees'',)X +2 f +3155(Acta)X +3322(Informatica)X +1 f +3700(,)X +3740(1977.)X +555 3351([BERN80])N +936(Bernstein,)X +1297(P.,)X +1415(Goodman,)X +1785(N.,)X +1917(``Timestamp)X +2365(Based)X +2595(Algorithms)X +2992(for)X +3119(Concurrency)X +3567(Control)X +3844(in)X +3939(Distributed)X +727 3441(Database)N +1042(Systems'',)X +2 f +1402(Proceedings)X +1823(6th)X +1945(International)X +2387(Conference)X +2777(on)X +2877(Very)X +3049(Large)X +3260(Data)X +3440(Bases)X +1 f +3627(,)X +3667(October)X +3946(1980.)X +555 3621([BSD91])N +864(DB\(3\),)X +2 f +1109(4.4BSD)X +1376(Unix)X +1552(Programmer's)X +2044(Manual)X +2313(Reference)X +2655(Guide)X +1 f +2851(,)X +2891(University)X +3249(of)X +3336(California,)X +3701(Berkeley,)X +4031(1991.)X +555 3801([CATT91])N +923(Cattell,)X +1181(R.G.G.,)X +1455(``An)X +1632(Engineering)X +2049(Database)X +2369(Benchmark'',)X +2 f +2838(The)X +2983(Benchmark)X +3373(Handbook)X +3731(for)X +3848(Database)X +4179(and)X +727 3891(Transaction)N +1133(Processing)X +1509(Systems)X +1 f +1763(,)X +1803(J.)X +1874(Gray,)X +2075(editor,)X +2302(Morgan)X +2576(Kaufman)X +2895(1991.)X +555 4071([CHEN91])N +929(Cheng,)X +1180(E.,)X +1291(Chang,)X +1542(E.,)X +1653(Klein,)X +1872(J.,)X +1964(Lee,)X +2126(D.,)X +2245(Lu,)X +2375(E.,)X +2485(Lutgardo,)X +2820(A.,)X +2939(Obermarck,)X +3342(R.,)X +3456(``An)X +3629(Open)X +3824(and)X +3961(Extensible)X +727 4161(Event-Based)N +1157(Transaction)X +1556(Manager'',)X +2 f +1936(Proceedings)X +2357(1991)X +2537(Summer)X +2820(Usenix)X +1 f +3043(,)X +3083(Nashville,)X +3430(TN,)X +3577(June)X +3744(1991.)X +555 4341([CHOU85])N +943(Chou,)X +1163(H.,)X +1288(DeWitt,)X +1570(D.,)X +1694(``An)X +1872(Evaluation)X +2245(of)X +2338(Buffer)X +2574(Management)X +3019(Strategies)X +3361(for)X +3481(Relational)X +3836(Database)X +4157(Sys-)X +727 4431(tems'',)N +2 f +972(Proceedings)X +1393(of)X +1475(the)X +1593(11th)X +1755(International)X +2197(Conference)X +2587(on)X +2687(Very)X +2859(Large)X +3070(Databases)X +1 f +3408(,)X +3448(1985.)X +555 4611([DEWI84])N +925(DeWitt,)X +1207(D.,)X +1331(Katz,)X +1529(R.,)X +1648(Olken,)X +1890(F.,)X +2000(Shapiro,)X +2295(L.,)X +2410(Stonebraker,)X +2843(M.,)X +2979(Wood,)X +3220(D.,)X +3343(``Implementation)X +3929(Techniques)X +727 4701(for)N +841(Main)X +1030(Memory)X +1326(Database)X +1641(Systems'',)X +2 f +2001(Proceedings)X +2422(of)X +2504(SIGMOD)X +1 f +2812(,)X +2852(pp.)X +2972(1-8,)X +3119(June)X +3286(1984.)X +555 4881([GRAY76])N +944(Gray,)X +1153(J.,)X +1252(Lorie,)X +1474(R.,)X +1595(Putzolu,)X +1887(F.,)X +1999(and)X +2143(Traiger,)X +2428(I.,)X +2522(``Granularity)X +2973(of)X +3067(locks)X +3263(and)X +3406(degrees)X +3679(of)X +3773(consistency)X +4174(in)X +4263(a)X +727 4971(large)N +909(shared)X +1140(data)X +1295(base'',)X +2 f +1533(Modeling)X +1861(in)X +1944(Data)X +2125(Base)X +2301(Management)X +2740(Systems)X +1 f +2994(,)X +3034(Elsevier)X +3317(North)X +3524(Holland,)X +3822(New)X +3994(York,)X +4199(pp.)X +727 5061(365-394.)N +555 5241([HAER83])N +931(Haerder,)X +1235(T.)X +1348(Reuter,)X +1606(A.)X +1728(``Principles)X +2126(of)X +2217(Transaction-Oriented)X +2928(Database)X +3246(Recovery'',)X +2 f +3651(Computing)X +4029(Surveys)X +1 f +4279(,)X +727 5331(15\(4\);)N +943(237-318,)X +1250(1983.)X +555 5511([KUNG81])N +943(Kung,)X +1162(H.)X +1261(T.,)X +1371(Richardson,)X +1777(J.,)X +1869(``On)X +2042(Optimistic)X +2400(Methods)X +2701(for)X +2816(Concurrency)X +3252(Control'',)X +2 f +3591(ACM)X +3781(Transactions)X +4219(on)X +727 5601(Database)N +1054(Systems)X +1 f +1328(6\(2\);)X +1504(213-226,)X +1811(1981.)X + +17 p +%%Page: 17 17 +10 s 10 xH 0 xS 1 f +3 f +1 f +555 630([LEHM81])N +939(Lehman,)X +1245(P.,)X +1352(Yao,)X +1529(S.,)X +1636(``Ef\256cient)X +1989(Locking)X +2279(for)X +2396(Concurrent)X +2780(Operations)X +3155(on)X +3258(B-trees'',)X +2 f +3587(ACM)X +3779(Transactions)X +4219(on)X +727 720(Database)N +1054(Systems)X +1 f +1308(,)X +1348(6\(4\),)X +1522(December)X +1873(1981.)X +555 900([MOHA91])N +964(Mohan,)X +1241(C.,)X +1364(Pirahesh,)X +1690(H.,)X +1818(``ARIES-RRH:)X +2366(Restricted)X +2721(Repeating)X +3076(of)X +3173(History)X +3442(in)X +3533(the)X +3660(ARIES)X +3920(Transaction)X +727 990(Recovery)N +1055(Method'',)X +2 f +1398(Proceedings)X +1819(7th)X +1941(International)X +2383(Conference)X +2773(on)X +2873(Data)X +3053(Engineering)X +1 f +3449(,)X +3489(Kobe,)X +3703(Japan,)X +3926(April)X +4115(1991.)X +555 1170([NODI90])N +914(Nodine,)X +1194(M.,)X +1328(Zdonik,)X +1602(S.,)X +1709(``Cooperative)X +2178(Transaction)X +2580(Hierarchies:)X +2996(A)X +3077(Transaction)X +3479(Model)X +3711(to)X +3796(Support)X +4072(Design)X +727 1260(Applications'',)N +2 f +1242(Proceedings)X +1675(16th)X +1849(International)X +2303(Conference)X +2704(on)X +2815(Very)X +2998(Large)X +3220(Data)X +3411(Bases)X +1 f +3598(,)X +3649(Brisbane,)X +3985(Australia,)X +727 1350(August)N +978(1990.)X +555 1530([OUST90])N +923(Ousterhout,)X +1324(J.,)X +1420(``Tcl:)X +1648(An)X +1771(Embeddable)X +2197(Command)X +2555(Language'',)X +2 f +2971(Proceedings)X +3396(1990)X +3580(Winter)X +3822(Usenix)X +1 f +4045(,)X +4089(Wash-)X +727 1620(ington,)N +971(D.C.,)X +1162(January)X +1432(1990.)X +555 1800([POSIX91])N +955(``Unapproved)X +1441(Draft)X +1645(for)X +1773(Realtime)X +2096(Extension)X +2450(for)X +2578(Portable)X +2879(Operating)X +3234(Systems'',)X +3608(Draft)X +3812(11,)X +3946(October)X +4239(7,)X +727 1890(1991,)N +927(IEEE)X +1121(Computer)X +1461(Society.)X +555 2070([ROSE91])N +925(Rosenblum,)X +1341(M.,)X +1484(Ousterhout,)X +1892(J.,)X +1995(``The)X +2206(Design)X +2464(and)X +2611(Implementation)X +3149(of)X +3247(a)X +3314(Log-Structured)X +3835(File)X +3990(System'',)X +2 f +727 2160(Proceedings)N +1148(of)X +1230(the)X +1348(13th)X +1510(Symposium)X +1895(on)X +1995(Operating)X +2344(Systems)X +2618(Principles)X +1 f +2947(,)X +2987(1991.)X +555 2340([SELT91])N +904(Seltzer,)X +1171(M.,)X +1306(Stonebraker,)X +1738(M.,)X +1873(``Read)X +2116(Optimized)X +2478(File)X +2626(Systems:)X +2938(A)X +3020(Performance)X +3454(Evaluation'',)X +2 f +3898(Proceedings)X +727 2430(7th)N +849(Annual)X +1100(International)X +1542(Conference)X +1932(on)X +2032(Data)X +2212(Engineering)X +1 f +2608(,)X +2648(Kobe,)X +2862(Japan,)X +3085(April)X +3274(1991.)X +555 2610([SPEC88])N +907(Spector,)X +1200(Rausch,)X +1484(Bruell,)X +1732(``Camelot:)X +2107(A)X +2192(Flexible,)X +2501(Distributed)X +2888(Transaction)X +3294(Processing)X +3668(System'',)X +2 f +4004(Proceed-)X +727 2700(ings)N +880(of)X +962(Spring)X +1195(COMPCON)X +1606(1988)X +1 f +(,)S +1806(February)X +2116(1988.)X +555 2880([SQL86])N +862(American)X +1201(National)X +1499(Standards)X +1836(Institute,)X +2139(``Database)X +2509(Language)X +2847(SQL'',)X +3093(ANSI)X +3301(X3.135-1986)X +3747(\(ISO)X +3924(9075\),)X +4152(May)X +727 2970(1986.)N +555 3150([STON81])N +919(Stonebraker,)X +1348(M.,)X +1480(``Operating)X +1876(System)X +2132(Support)X +2406(for)X +2520(Database)X +2835(Management'',)X +2 f +3348(Communications)X +3910(of)X +3992(the)X +4110(ACM)X +1 f +4279(,)X +727 3240(1981.)N +555 3420([SULL92])N +925(Sullivan,)X +1247(M.,)X +1394(Olson,)X +1641(M.,)X +1788(``An)X +1976(Index)X +2195(Implementation)X +2737(Supporting)X +3127(Fast)X +3295(Recovery)X +3638(for)X +3767(the)X +3900(POSTGRES)X +727 3510(Storage)N +1014(System'',)X +1365(to)X +1469(appear)X +1726(in)X +2 f +1830(Proceedings)X +2272(8th)X +2415(Annual)X +2687(International)X +3150(Conference)X +3561(on)X +3682(Data)X +3883(Engineering)X +1 f +4279(,)X +727 3600(Tempe,)N +990(Arizona,)X +1289(February)X +1599(1992.)X +555 3780([TPCB90])N +914(Transaction)X +1319(Processing)X +1692(Performance)X +2129(Council,)X +2428(``TPC)X +2653(Benchmark)X +3048(B'',)X +3200(Standard)X +3510(Speci\256cation,)X +3973(Waterside)X +727 3870(Associates,)N +1110(Fremont,)X +1421(CA.,)X +1592(1990.)X +555 4050([YOUN91])N +947(Young,)X +1211(M.)X +1328(W.,)X +1470(Thompson,)X +1858(D.)X +1962(S.,)X +2072(Jaffe,)X +2274(E.,)X +2388(``A)X +2525(Modular)X +2826(Architecture)X +3253(for)X +3372(Distributed)X +3757(Transaction)X +4161(Pro-)X +727 4140(cessing'',)N +2 f +1057(Proceedings)X +1478(1991)X +1658(Winter)X +1896(Usenix)X +1 f +2119(,)X +2159(Dallas,)X +2404(TX,)X +2551(January)X +2821(1991.)X +3 f +755 4263(Margo)N +1008(I.)X +1080(Seltzer)X +1 f +1338(is)X +1411(a)X +1467(Ph.D.)X +1669(student)X +1920(in)X +2002(the)X +2120(Department)X +2519(of)X +2606(Electrical)X +2934(Engineering)X +3346(and)X +3482(Computer)X +3822(Sciences)X +4123(at)X +4201(the)X +555 4353(University)N +919(of)X +1012(California,)X +1383(Berkeley.)X +1739(Her)X +1886(research)X +2181(interests)X +2474(include)X +2735(\256le)X +2862(systems,)X +3160(databases,)X +3513(and)X +3654(transaction)X +4031(process-)X +555 4443(ing)N +686(systems.)X +1008(She)X +1157(spent)X +1355(several)X +1612(years)X +1811(working)X +2107(at)X +2194(startup)X +2441(companies)X +2813(designing)X +3153(and)X +3298(implementing)X +3771(\256le)X +3902(systems)X +4183(and)X +555 4533(transaction)N +929(processing)X +1294(software)X +1592(and)X +1729(designing)X +2061(microprocessors.)X +2648(Ms.)X +2791(Seltzer)X +3035(received)X +3329(her)X +3453(AB)X +3585(in)X +3668(Applied)X +3947(Mathemat-)X +555 4623(ics)N +664(from)X +840 0.1953(Harvard/Radcliffe)AX +1445(College)X +1714(in)X +1796(1983.)X +755 4746(In)N +845(her)X +971(spare)X +1163(time,)X +1347(Margo)X +1583(can)X +1717(usually)X +1970(be)X +2068(found)X +2277(preparing)X +2607(massive)X +2887(quantities)X +3220(of)X +3309(food)X +3478(for)X +3594(hungry)X +3843(hordes,)X +4099(study-)X +555 4836(ing)N +677(Japanese,)X +1003(or)X +1090(playing)X +1350(soccer)X +1576(with)X +1738(an)X +1834(exciting)X +2112(Bay)X +2261(Area)X +2438(Women's)X +2770(Soccer)X +3009(team,)X +3205(the)X +3323(Berkeley)X +3633(Bruisers.)X +3 f +755 5049(Michael)N +1056(A.)X +1159(Olson)X +1 f +1383(is)X +1461(a)X +1522(Master's)X +1828(student)X +2084(in)X +2170(the)X +2292(Department)X +2695(of)X +2786(Electrical)X +3118(Engineering)X +3534(and)X +3674(Computer)X +4018(Sciences)X +555 5139(at)N +645(the)X +774(University)X +1143(of)X +1241(California,)X +1617(Berkeley.)X +1978(His)X +2120(primary)X +2405(interests)X +2703(are)X +2833(database)X +3141(systems)X +3425(and)X +3572(mass)X +3763(storage)X +4026(systems.)X +555 5229(Mike)N +759(spent)X +963(two)X +1118(years)X +1323(working)X +1625(for)X +1754(a)X +1825(commercial)X +2239(database)X +2551(system)X +2808(vendor)X +3066(before)X +3307(joining)X +3567(the)X +3699(Postgres)X +4004(Research)X +555 5319(Group)N +780(at)X +858(Berkeley)X +1168(in)X +1250(1988.)X +1470(He)X +1584(received)X +1877(his)X +1990(B.A.)X +2161(in)X +2243(Computer)X +2583(Science)X +2853(from)X +3029(Berkeley)X +3339(in)X +3421(May)X +3588(1991.)X +755 5442(Mike)N +945(only)X +1108(recently)X +1388(transferred)X +1758(into)X +1903(Sin)X +2030(City,)X +2208(but)X +2330(is)X +2403(rapidly)X +2650(adopting)X +2950(local)X +3126(customs)X +3408(and)X +3544(coloration.)X +3929(In)X +4016(his)X +4129(spare)X +555 5532(time,)N +742(he)X +843(organizes)X +1176(informal)X +1477(Friday)X +1711(afternoon)X +2043(study)X +2240(groups)X +2482(to)X +2568(discuss)X +2823(recent)X +3044(technical)X +3358(and)X +3498(economic)X +3834(developments.)X +555 5622(Among)N +815(his)X +928(hobbies)X +1197(are)X +1316(Charles)X +1581(Dickens,)X +1884(Red)X +2033(Rock,)X +2242(and)X +2378(speaking)X +2683(Dutch)X +2899(to)X +2981(anyone)X +3233(who)X +3391(will)X +3535(permit)X +3764(it.)X + +17 p +%%Trailer +xt + +xs + diff --git a/mozilla/db/examples/README b/mozilla/db/examples/README new file mode 100644 index 00000000000..8aeb085cd84 --- /dev/null +++ b/mozilla/db/examples/README @@ -0,0 +1,25 @@ +# @(#)README 10.3 (Sleepycat) 8/21/97 + +ex_access.c Using just the DB access methods. + +ex_appinit.c Setting up the DB environment. + +ex_btrec.c Using the BTREE access method with record numbers. + +ex_lock.c Locking. + +ex_mpool.c Shared memory buffer pools. + +ex_tpcb.c TPC/B. + Ex_tpcb sets up a framework in which to run a TPC/B test. + Database initialization (the -i flag) and running the + benchmark (-n flag) must take place separately (i.e., + first create the database, then run 1 or more copies of + the benchmark). Furthermore, when running more than one + TPCB process, it is necessary to run the deadlock detector + (db_deadlock), since it is possible for concurrent tpcb + processes to deadlock. For performance measurement, it + will also be beneficial to run the db_checkpoint process + as well. + +ex_trans.c -- NOT YET IMPLEMENTED diff --git a/mozilla/db/examples/ex_access.c b/mozilla/db/examples/ex_access.c new file mode 100644 index 00000000000..41c84ef01b4 --- /dev/null +++ b/mozilla/db/examples/ex_access.c @@ -0,0 +1,171 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)ex_access.c 10.14 (Sleepycat) 4/10/98 + */ + +#include "config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#endif + +#include + +#define DATABASE "access.db" + +DB_ENV *db_init(char *); +int main __P((int, char *[])); +void usage(void); + +const char + *progname = "ex_access"; /* Program name. */ + +int +main(argc, argv) + int argc; + char *argv[]; +{ + extern char *optarg; + extern int errno, optind; + DB *dbp; + DBC *dbcp; + DBT key, data; + DB_ENV *dbenv; + DB_INFO dbinfo; + u_int32_t len; + int ch; + char *home, *p, *t, buf[1024], rbuf[1024]; + + home = NULL; + while ((ch = getopt(argc, argv, "h:")) != EOF) + switch (ch) { + case 'h': + home = optarg; + break; + case '?': + default: + usage(); + } + argc -= optind; + argv += optind; + + /* Remove the previous database. */ + (void)unlink(DATABASE); + + /* Initialize the database environment. */ + dbenv = db_init(home); + + /* Initialize the database. */ + memset(&dbinfo, 0, sizeof(dbinfo)); + dbinfo.db_pagesize = 1024; /* Page size: 1K. */ + + /* Create the database. */ + if ((errno = db_open(DATABASE, + DB_BTREE, DB_CREATE, 0664, dbenv, &dbinfo, &dbp)) != 0) { + fprintf(stderr, + "%s: %s: %s\n", progname, DATABASE, strerror(errno)); + exit (1); + } + + /* + * 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 ((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 (errno = + dbp->put(dbp, NULL, &key, &data, DB_NOOVERWRITE)) { + case 0: + break; + default: + fprintf(stderr, + "%s: put: %s\n", progname, strerror(errno)); + exit (1); + case DB_KEYEXIST: + printf("%s: key already exists\n", buf); + break; + } + } + printf("\n"); + + /* Acquire a cursor for the database. */ + if ((errno = dbp->cursor(dbp, NULL, &dbcp)) != 0) { + fprintf(stderr, "%s: cursor: %s\n", progname, strerror(errno)); + exit (1); + } + + /* 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 ((errno = 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 (errno != DB_NOTFOUND) + fprintf(stderr, "%s: get: %s\n", progname, strerror(errno)); + + (void)dbcp->c_close(dbcp); + (void)dbp->close(dbp, 0); + + return (db_appexit(dbenv)); +} + +/* + * db_init -- + * Initialize the environment. + */ +DB_ENV * +db_init(home) + char *home; +{ + DB_ENV *dbenv; + + /* Rely on calloc to initialize the structure. */ + if ((dbenv = (DB_ENV *)calloc(sizeof(DB_ENV), 1)) == NULL) { + fprintf(stderr, "%s: %s\n", progname, strerror(ENOMEM)); + exit (1); + } + dbenv->db_errfile = stderr; + dbenv->db_errpfx = progname; + dbenv->mp_size = 32 * 1024; /* Cachesize: 32K. */ + + if ((errno = db_appinit(home, NULL, dbenv, DB_CREATE)) != 0) { + fprintf(stderr, + "%s: db_appinit: %s\n", progname, strerror(errno)); + exit (1); + } + return (dbenv); +} + +void +usage() +{ + (void)fprintf(stderr, "usage: %s [-h home]\n", progname); + exit(1); +} diff --git a/mozilla/db/examples/ex_appinit.c b/mozilla/db/examples/ex_appinit.c new file mode 100644 index 00000000000..b23bfcbf37d --- /dev/null +++ b/mozilla/db/examples/ex_appinit.c @@ -0,0 +1,101 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)ex_appinit.c 10.16 (Sleepycat) 4/11/98 + */ + +#include "config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#include +#endif + +#include + +#ifdef macintosh +#define DATABASE_HOME ":database" +#define CONFIG_DATA_DIR "DB_DATA_DIR :database" +#else +#ifdef _WIN32 +#define DATABASE_HOME "\\home\\database" +#define CONFIG_DATA_DIR "DB_DATA_DIR \\database\\files" +#else +#define DATABASE_HOME "/home/database" +#define CONFIG_DATA_DIR "DB_DATA_DIR /database/files" +#endif +#endif + +DB_ENV *db_setup __P((FILE *)); +int main __P((int, char *[])); + +const char + *progname = "ex_appinit"; /* Program name. */ + +/* + * An example of a program using db_appinit(3) to configure its DB + * environment. + */ +int +main(argc, argv) + int argc; + char *argv[]; +{ + DB_ENV *dbenv; + + dbenv = db_setup(stderr); + return (0); +} + +DB_ENV * +db_setup(errfp) + FILE *errfp; +{ + DB_ENV *dbenv; + char *config[2]; + + /* Allocate and initialize the DB environment. */ + if ((dbenv = (DB_ENV *)malloc(sizeof(DB_ENV))) == NULL) { + fprintf(stderr, "%s: %s\n", progname, strerror(ENOMEM)); + exit (1); + } + memset(dbenv, 0, sizeof(DB_ENV)); + + /* Output errors to the application's log. */ + dbenv->db_errfile = errfp; + dbenv->db_errpfx = progname; + + /* + * All of the shared database files live in /home/database, + * but data files live in /database. + */ + config[0] = CONFIG_DATA_DIR; + config[1] = NULL; + + /* + * We want to specify the shared memory buffer pool cachesize, + * but everything else is the default. + */ + dbenv->mp_size = 64 * 1024; + + /* + * We have multiple processes reading/writing these files, so + * we need concurrency control and a shared buffer pool, but + * not logging or transactions. + */ + if ((errno = db_appinit(DATABASE_HOME, + config, dbenv, DB_CREATE | DB_INIT_LOCK | DB_INIT_MPOOL)) != 0) { + fprintf(stderr, + "%s: db_appinit: %s\n", progname, strerror(errno)); + exit (1); + } + return (dbenv); +} diff --git a/mozilla/db/examples/ex_btrec.c b/mozilla/db/examples/ex_btrec.c new file mode 100644 index 00000000000..d8a2ee8e0bf --- /dev/null +++ b/mozilla/db/examples/ex_btrec.c @@ -0,0 +1,246 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)ex_btrec.c 10.8 (Sleepycat) 4/11/98 + */ + +#include "config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#endif + +#include + +#define DATABASE "access.db" +#define WORDLIST "../test/wordlist" + +DB_ENV *db_init __P((char *)); +int main __P((int, char *[])); +void show __P((char *, DBT *, DBT *)); +void usage __P((void)); + +const char *progname = "ex_btrec"; /* Program name. */ + +int +main(argc, argv) + int argc; + char *argv[]; +{ + extern char *optarg; + extern int errno, optind; + DB *dbp; + DBC *dbcp; + DBT key, data; + DB_ENV *dbenv; + DB_INFO dbinfo; + FILE *fp; + db_recno_t recno; + u_int32_t len; + int ch, cnt; + char *home, *p, *t, buf[1024], rbuf[1024]; + + home = NULL; + while ((ch = getopt(argc, argv, "h:")) != EOF) + switch (ch) { + case 'h': + home = optarg; + break; + case '?': + default: + usage(); + } + argc -= optind; + argv += optind; + + /* Open the word database. */ + if ((fp = fopen(WORDLIST, "r")) == NULL) { + fprintf(stderr, + "%s: %s: %s\n", progname, WORDLIST, strerror(errno)); + exit (1); + } + + /* Remove the previous database. */ + (void)unlink(DATABASE); + + /* Initialize the database environment. */ + dbenv = db_init(home); + + /* Initialize the database. */ + memset(&dbinfo, 0, sizeof(dbinfo)); + dbinfo.db_cachesize = 32 * 1024; /* Cachesize: 32K. */ + dbinfo.db_pagesize = 1024; /* Page size: 1K. */ + dbinfo.flags |= DB_RECNUM; /* Record numbers! */ + + /* Create the database. */ + if ((errno = db_open(DATABASE, + DB_BTREE, DB_CREATE, 0664, dbenv, &dbinfo, &dbp)) != 0) { + fprintf(stderr, + "%s: %s: %s\n", progname, DATABASE, strerror(errno)); + exit (1); + } + + /* + * Insert records into the database, where the key is the word + * preceded by its record number, and the data is the same, but + * in reverse order. + */ + memset(&key, 0, sizeof(DBT)); + memset(&data, 0, sizeof(DBT)); + for (cnt = 1; cnt <= 1000; ++cnt) { + (void)sprintf(buf, "%04d_", cnt); + if (fgets(buf + 4, sizeof(buf) - 4, fp) == NULL) + 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 (errno = + dbp->put(dbp, NULL, &key, &data, DB_NOOVERWRITE)) { + case 0: + break; + default: + fprintf(stderr, + "%s: put: %s\n", progname, strerror(errno)); + exit (1); + case DB_KEYEXIST: + printf("%s: key already exists\n", buf); + break; + } + } + + /* Close the word database. */ + (void)fclose(fp); + + /* Acquire a cursor for the database. */ + if ((errno = dbp->cursor(dbp, NULL, &dbcp)) != 0) { + fprintf(stderr, "%s: cursor: %s\n", progname, strerror(errno)); + exit (1); + } + + /* + * Prompt the user for a record number, then retrieve and display + * that record. + */ + for (;;) { + /* Get a record number. */ + printf("recno #> "); + fflush(stdout); + if (fgets(buf, sizeof(buf), stdin) == NULL) + break; + recno = atoi(buf); + + /* + * Reset the key each time, the dbp->c_get() routine returns + * the key and data pair, not just the key! + */ + key.data = &recno; + key.size = sizeof(recno); + if ((errno = dbcp->c_get(dbcp, &key, &data, DB_SET_RECNO)) != 0) + goto err; + + /* Display the key and data. */ + show("k/d\t", &key, &data); + + /* Move the cursor a record forward. */ + if ((errno = dbcp->c_get(dbcp, &key, &data, DB_NEXT)) != 0) + goto err; + + /* Display the key and data. */ + show("next\t", &key, &data); + + /* + * Retrieve the record number for the following record into + * local memory. + */ + data.data = &recno; + data.size = sizeof(recno); + data.ulen = sizeof(recno); + data.flags |= DB_DBT_USERMEM; + if ((errno = dbcp->c_get(dbcp, &key, &data, DB_GET_RECNO)) != 0) +err: switch (errno) { + case DB_NOTFOUND: + fprintf(stderr, + "%s: get: record not found\n", progname); + continue; + case DB_KEYEMPTY: + fprintf(stderr, + "%s: get: key empty/deleted\n", progname); + continue; + default: + fprintf(stderr, + "%s: get: %s\n", progname, strerror(errno)); + exit (1); + } + printf("retrieved recno: %lu\n", (u_long)recno); + + /* Reset the data DBT. */ + memset(&data, 0, sizeof(data)); + } + + (void)dbcp->c_close(dbcp); + (void)dbp->close(dbp, 0); + + return (db_appexit(dbenv)); +} + +/* + * show -- + * Display a key/data pair. + */ +void +show(msg, key, data) + DBT *key, *data; + char *msg; +{ + printf("%s%.*s : %.*s\n", msg, + (int)key->size, (char *)key->data, + (int)data->size, (char *)data->data); +} + +/* + * db_init -- + * Initialize the environment. + */ +DB_ENV * +db_init(home) + char *home; +{ + DB_ENV *dbenv; + + /* Rely on calloc to initialize the structure. */ + if ((dbenv = (DB_ENV *)calloc(sizeof(DB_ENV), 1)) == NULL) { + fprintf(stderr, "%s: %s\n", progname, strerror(ENOMEM)); + exit (1); + } + dbenv->db_errfile = stderr; + dbenv->db_errpfx = progname; + + if ((errno = db_appinit(home, NULL, dbenv, DB_CREATE)) != 0) { + fprintf(stderr, + "%s: db_appinit: %s\n", progname, strerror(errno)); + exit (1); + } + return (dbenv); +} + +void +usage() +{ + (void)fprintf(stderr, "usage: %s [-h home]\n", progname); + exit(1); +} diff --git a/mozilla/db/examples/ex_lock.c b/mozilla/db/examples/ex_lock.c new file mode 100644 index 00000000000..09da604e6c8 --- /dev/null +++ b/mozilla/db/examples/ex_lock.c @@ -0,0 +1,218 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)ex_lock.c 10.14 (Sleepycat) 4/10/98 + */ + +#include "config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#endif + +#include + +#ifdef _WIN32 +#define LOCK_HOME "lock" +#else +#define LOCK_HOME "/var/tmp/lock" +#endif + +DB_ENV *db_init(char *, u_int32_t, int); +int main __P((int, char *[])); +void usage(void); + +const char + *progname = "ex_lock"; /* Program name. */ + +int +main(argc, argv) + int argc; + char *argv[]; +{ + extern char *optarg; + extern int errno, optind; + DBT lock_dbt; + DB_ENV *dbenv; + DB_LOCK lock; + db_lockmode_t lock_type; + long held; + u_int32_t len, locker, maxlocks; + int ch, do_unlink, did_get, i, ret; + char *home, opbuf[16], objbuf[1024], lockbuf[16]; + + home = LOCK_HOME; + maxlocks = 0; + do_unlink = 0; + while ((ch = getopt(argc, argv, "h:m:u")) != EOF) + switch (ch) { + case 'h': + home = optarg; + break; + case 'm': + if ((i = atoi(optarg)) <= 0) + usage(); + maxlocks = (u_int32_t)i; /* XXX: possible overflow. */ + break; + case 'u': + do_unlink = 1; + break; + case '?': + default: + usage(); + } + argc -= optind; + argv += optind; + + if (argc != 0) + usage(); + + /* Initialize the database environment. */ + dbenv = db_init(home, maxlocks, do_unlink); + + /* + * Accept lock requests. + */ + ret = lock_id(dbenv->lk_info, &locker); + if (ret != 0) { + fprintf(stderr, "Unable to get locker id, %s\n", + strerror(ret)); + (void)db_appexit(dbenv); + exit (1); + } + for (held = 0;;) { + printf("Operation get/release [get]> "); + fflush(stdout); + if (fgets(opbuf, sizeof(opbuf), stdin) == NULL) + break; + if ((len = strlen(opbuf)) <= 1 || strcmp(opbuf, "get\n") == 0) { + /* Acquire a lock. */ + printf("input object (text string) to lock> "); + fflush(stdout); + if (fgets(objbuf, sizeof(objbuf), stdin) == NULL) + break; + if ((len = strlen(objbuf)) <= 1) + continue; + + do { + printf("lock type read/write [read]> "); + fflush(stdout); + if (fgets(lockbuf, + sizeof(lockbuf), stdin) == NULL) + break; + len = strlen(lockbuf); + } while (len >= 1 && + strcmp(lockbuf, "read\n") != 0 && + strcmp(lockbuf, "write\n") != 0); + if (len == 1 || strcmp(lockbuf, "read\n") == 0) + lock_type = DB_LOCK_READ; + else + lock_type = DB_LOCK_WRITE; + + lock_dbt.data = objbuf; + lock_dbt.size = strlen(objbuf); + ret = lock_get(dbenv->lk_info, locker, + DB_LOCK_NOWAIT, &lock_dbt, lock_type, &lock); + did_get = 1; + } else { + /* Release a lock. */ + do { + printf("input lock to release> "); + fflush(stdout); + if (fgets(objbuf, + sizeof(objbuf), stdin) == NULL) + break; + } while ((len = strlen(objbuf)) <= 1); + lock = (DB_LOCK)strtoul(objbuf, NULL, 16); + ret = lock_put(dbenv->lk_info, lock); + did_get = 0; + } + switch (ret) { + case 0: + printf("Lock 0x%lx %s\n", (unsigned long)lock, + did_get ? "granted" : "released"); + held += did_get ? 1 : -1; + break; + case DB_LOCK_NOTHELD: + printf("You do not hold the lock %lu\n", + (unsigned long)lock); + break; + case DB_LOCK_NOTGRANTED: + printf("Lock not granted\n"); + break; + case DB_LOCK_DEADLOCK: + fprintf(stderr, "%s: lock_%s: %s", + progname, did_get ? "get" : "put", + "returned DEADLOCK"); + break; + default: + fprintf(stderr, "%s: lock_get: %s", + progname, strerror(errno)); + } + } + printf("\n"); + printf("Closing lock region %ld locks held\n", held); + + return (db_appexit(dbenv)); +} + +/* + * db_init -- + * Initialize the environment. + */ +DB_ENV * +db_init(home, maxlocks, do_unlink) + char *home; + u_int32_t maxlocks; + int do_unlink; +{ + DB_ENV *dbenv; + + /* Rely on calloc to initialize the structure. */ + if ((dbenv = (DB_ENV *)calloc(sizeof(DB_ENV), 1)) == NULL) { + fprintf(stderr, "%s: %s", progname, strerror(ENOMEM)); + exit (1); + } + dbenv->db_errfile = stderr; + dbenv->db_errpfx = progname; + dbenv->lk_max = maxlocks; + + /* Open for naming only if we need to remove the old lock region. */ + if (do_unlink) { + if ((errno = db_appinit(home, NULL, dbenv, 0)) != 0) + fprintf(stderr, + "%s: db_appinit: %s", progname, strerror(errno)); + if (lock_unlink(NULL, 1, dbenv)) + fprintf(stderr, + "%s: lock_unlink: %s", progname, strerror(errno)); + if ((errno = db_appexit(dbenv)) != 0) + fprintf(stderr, + "%s: db_appexit: %s", progname, strerror(errno)); + + memset(dbenv, 0, sizeof(DB_ENV)); + } + + if ((errno = + db_appinit(home, NULL, dbenv, DB_CREATE | DB_INIT_LOCK)) != 0) { + fprintf(stderr, + "%s: db_appinit: %s", progname, strerror(errno)); + exit (1); + } + return (dbenv); +} + +void +usage() +{ + (void)fprintf(stderr, + "usage: %s [-u] [-h home] [-m maxlocks]\n", progname); + exit(1); +} diff --git a/mozilla/db/examples/ex_mpool.c b/mozilla/db/examples/ex_mpool.c new file mode 100644 index 00000000000..eb3d36437b4 --- /dev/null +++ b/mozilla/db/examples/ex_mpool.c @@ -0,0 +1,202 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)ex_mpool.c 10.19 (Sleepycat) 5/1/98 + */ + +#include "config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#include +#include +#endif + +#include + +#define MPOOL "mpool" + +void init(char *, int, int); +int main __P((int, char *[])); +void run(DB_ENV *, int, int, int); +void usage(void); + +const char + *progname = "ex_mpool"; /* Program name. */ + +int +main(argc, argv) + int argc; + char *argv[]; +{ + extern char *optarg; + extern int optind; + DB_ENV dbenv; + int cachesize, ch, hits, npages, pagesize; + + cachesize = 20 * 1024; + hits = 1000; + npages = 50; + pagesize = 1024; + while ((ch = getopt(argc, argv, "c:h:n:p:")) != EOF) + switch (ch) { + case 'c': + if ((cachesize = atoi(optarg)) < 20 * 1024) + usage(); + break; + case 'h': + if ((hits = atoi(optarg)) <= 0) + usage(); + case 'n': + if ((npages = atoi(optarg)) <= 0) + usage(); + break; + case 'p': + if ((pagesize = atoi(optarg)) <= 0) + usage(); + break; + case '?': + default: + usage(); + } + argc -= optind; + argv += optind; + + /* Initialize the file. */ + init(MPOOL, pagesize, npages); + + /* + * Initialize the environment. + * + * Output error messages to stderr. + * Specify the cachesize. + * The memory pool is private. + */ + memset(&dbenv, 0, sizeof(dbenv)); + dbenv.db_errfile = stderr; + dbenv.db_errpfx = progname; + dbenv.mp_size = (size_t)cachesize; /* XXX: Possible overflow. */ + + /* Get the pages. */ + run(&dbenv, hits, pagesize, npages); + + return (0); +} + +/* + * init -- + * Create a backing file. + */ +void +init(file, pagesize, npages) + char *file; + int pagesize, npages; +{ + int cnt, flags, fd; + char *p; + + /* + * Create a file with the right number of pages, and store a page + * number on each page. + */ + flags = O_CREAT | O_RDWR | O_TRUNC; +#ifdef WIN32 + flags |= O_BINARY; +#endif + if ((fd = open(file, flags, 0666)) < 0) { + fprintf(stderr, + "%s: %s: %s\n", progname, file, strerror(errno)); + exit (1); + } + if ((p = (char *)malloc(pagesize)) == NULL) { + fprintf(stderr, "%s: %s\n", progname, strerror(ENOMEM)); + exit (1); + } + + /* The pages are numbered from 0. */ + for (cnt = 0; cnt <= npages; ++cnt) { + *(int *)p = cnt; + if (write(fd, p, pagesize) != pagesize) { + fprintf(stderr, + "%s: %s: %s\n", progname, file, strerror(errno)); + exit (1); + } + } + free(p); +} + +/* + * run -- + * Get a set of pages. + */ +void +run(dbenv, hits, pagesize, npages) + DB_ENV *dbenv; + int hits, pagesize, npages; +{ + DB_MPOOL *dbmp; + DB_MPOOLFILE *dbmfp; + db_pgno_t pageno; + int cnt; + void *p; + + /* Open a memory pool. */ + if ((errno = memp_open(NULL, + DB_CREATE | DB_MPOOL_PRIVATE, 0666, dbenv, &dbmp)) != 0) { + fprintf(stderr, "%s: %s\n", progname, strerror(errno)); + exit (1); + } + /* Open the file in the pool. */ + if ((errno = + memp_fopen(dbmp, MPOOL, 0, 0, pagesize, NULL, &dbmfp)) != 0) { + fprintf(stderr, + "%s: %s: %s\n", progname, MPOOL, strerror(errno)); + exit (1); + } + + srand((u_int)time(NULL)); + for (cnt = 0; cnt < hits; ++cnt) { + pageno = (rand() % npages) + 1; + if ((errno = memp_fget(dbmfp, &pageno, 0, &p)) != 0) { + fprintf(stderr, + "%s: unable to retrieve page %lu: %s\n", + progname, (u_long)pageno, strerror(errno)); + exit (1); + } + if (*(db_pgno_t *)p != pageno) { + fprintf(stderr, + "%s: wrong page retrieved (%lu != %d)\n", + progname, (u_long)pageno, *(int *)p); + exit (1); + } + if ((errno = memp_fput(dbmfp, p, 0)) != 0) { + fprintf(stderr, + "%s: unable to return page %lu: %s\n", + progname, (u_long)pageno, strerror(errno)); + exit (1); + } + } + + /* Close the pool. */ + if ((errno = memp_close(dbmp)) != 0) { + fprintf(stderr, "%s: %s\n", progname, strerror(errno)); + exit (1); + } +} + +void +usage() +{ + (void)fprintf(stderr, + "usage: %s [-c cachesize] [-h hits] [-n npages] [-p pagesize]\n", + progname); + exit(1); +} diff --git a/mozilla/db/examples/ex_thread.c b/mozilla/db/examples/ex_thread.c new file mode 100644 index 00000000000..9d714b83040 --- /dev/null +++ b/mozilla/db/examples/ex_thread.c @@ -0,0 +1,616 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)ex_thread.c 10.6 (Sleepycat) 5/31/98 + */ + +#include "config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#include +#include +#include +#endif + +#include + +/* + * NB: This application is written using POSIX 1003.1b-1993 pthreads + * interfaces, which may not be portable to your system. + */ +extern int sched_yield(void); /* Pthread yield function. */ + +DB_ENV *db_init(char *); +void *deadlock(void *); +void fatal(char *, int); +int main __P((int, char *[])); +int reader(int); +void stats(void); +void *trickle(void *); +void *tstart(void *); +void usage(void); +void word(void); +int writer(int); + +struct _statistics { + int aborted; /* Write. */ + int aborts; /* Read/write. */ + int adds; /* Write. */ + int deletes; /* Write. */ + int txns; /* Write. */ + int found; /* Read. */ + int notfound; /* Read. */ +} *perf; + +const char + *progname = "ex_thread"; /* Program name. */ + +#define DATABASE "access.db" /* Database name. */ + +#define WORDLIST "../test/wordlist" /* Dictionary. */ + +/* + * We can seriously increase the number of collisions and transaction + * aborts by yielding the scheduler after every DB call. Specify the + * -p option to do this. + */ +int punish; /* -p */ +int nlist; /* -n */ +int nreaders; /* -r */ +int verbose; /* -v */ +int nwriters; /* -w */ + +DB *dbp; /* Database handle. */ +DB_ENV *dbenv; /* Database environment. */ +int nthreads; /* Total threads. */ +char **list; /* Word list. */ + +/* + * ex_thread -- + * Run a simple threaded application of some numbers of readers and + * writers competing for a set of words. + * + * Example UNIX shell script to run this program: + * % rm -rf TESTDIR + * % mkdir TESTDIR + * % ex_thread -h TESTDIR + */ +int +main(argc, argv) + int argc; + char *argv[]; +{ + extern char *optarg; + extern int errno, optind; + DB_INFO dbinfo; + pthread_t *tids; + int ch, i; + char *home; + void *retp; + + home = "TESTDIR"; + nlist = 1000; + nreaders = nwriters = 4; + while ((ch = getopt(argc, argv, "h:pn:r:vw:")) != EOF) + switch (ch) { + case 'h': + home = optarg; + break; + case 'p': + punish = 1; + break; + case 'n': + nlist = atoi(optarg); + break; + case 'r': + nreaders = atoi(optarg); + break; + case 'v': + verbose = 1; + break; + case 'w': + nwriters = atoi(optarg); + break; + case '?': + default: + usage(); + } + argc -= optind; + argv += optind; + + /* Initialize the random number generator. */ + srand(getpid() | time(NULL)); + + /* Build the key list. */ + word(); + + /* Remove the previous database. */ + (void)unlink(DATABASE); + + /* Initialize the database environment. */ + dbenv = db_init(home); + + /* Initialize the database. */ + memset(&dbinfo, 0, sizeof(dbinfo)); + dbinfo.db_pagesize = 1024; /* Page size: 1K. */ + + if ((errno = db_open(DATABASE, DB_BTREE, + DB_CREATE | DB_THREAD, 0664, dbenv, &dbinfo, &dbp)) != 0) { + fprintf(stderr, + "%s: %s: %s\n", progname, DATABASE, strerror(errno)); + exit (1); + } + + nthreads = nreaders + nwriters + 2; + printf("Running: readers %d, writers %d\n", nreaders, nwriters); + fflush(stdout); + + /* Create statistics structures, offset by 1. */ + if ((perf = calloc(nreaders + nwriters + 1, sizeof(*perf))) == NULL) + fatal(NULL, 1); + + /* Create thread ID structures. */ + if ((tids = malloc(nthreads * sizeof(pthread_t))) == NULL) + fatal(NULL, 1); + + /* Create reader/writer threads. */ + for (i = 0; i < nreaders + nwriters; ++i) + if (pthread_create(&tids[i], NULL, tstart, &i)) + fatal("pthread_create", 1); + + /* Create buffer pool trickle thread. */ + if (pthread_create(&tids[i], NULL, trickle, &i)) + fatal("pthread_create", 1); + + /* Create deadlock detector thread. */ + if (pthread_create(&tids[i], NULL, deadlock, &i)) + fatal("pthread_create", 1); + + /* Wait for the threads. */ + for (i = 0; i < nthreads; ++i) + (void)pthread_join(tids[i], &retp); + + (void)dbp->close(dbp, 0); + + return (db_appexit(dbenv)); +} + +int +reader(id) + int id; +{ + DBT key, data; + int n; + char buf[64]; + + /* + * DBT's must use local memory or malloc'd memory if the DB handle + * is accessed in a threaded fashion. + */ + memset(&key, 0, sizeof(DBT)); + memset(&data, 0, sizeof(DBT)); + data.flags = DB_DBT_MALLOC; + + /* + * Read-only threads do not require transaction protection, unless + * there's a need for repeatable reads. + */ + for (;;) { + /* + * Randomly yield the scheduler 20% of the time. Not + * normal for an application, but useful here to stir + * things up. + */ + if (rand() % 5 == 0) + sched_yield(); + + /* Pick a key at random, and look it up. */ + n = rand() % nlist; + key.data = list[n]; + key.size = strlen(key.data); + + if (verbose) { + sprintf(buf, "reader: %d: list entry %d\n", id, n); + write(STDOUT_FILENO, buf, strlen(buf)); + } + + switch (errno = dbp->get(dbp, NULL, &key, &data, 0)) { + case EAGAIN: /* Deadlock. */ + ++perf[id].aborts; + break; + case 0: /* Success. */ + ++perf[id].found; + free(data.data); + break; + case DB_NOTFOUND: /* Not found. */ + ++perf[id].notfound; + break; + default: + sprintf(buf, + "reader %d: dbp->get: %s", id, (char *)key.data); + fatal(buf, 0); + } + } + return (0); +} + +int +writer(id) + int id; +{ + DBT key, data; + DB_TXNMGR *txnp; + DB_TXN *tid; + time_t now, then; + int n; + char buf[256], dbuf[10000]; + + time(&now); + then = now; + txnp = dbenv->tx_info; + + /* + * DBT's must use local memory or malloc'd memory if the DB handle + * is accessed in a threaded fashion. + */ + memset(&key, 0, sizeof(DBT)); + memset(&data, 0, sizeof(DBT)); + data.data = dbuf; + data.ulen = sizeof(dbuf); + data.flags = DB_DBT_USERMEM; + + for (;;) { + /* + * Randomly yield the scheduler 20% of the time. Not + * normal for an application, but useful here to stir + * things up. + */ + if (rand() % 5 == 0) + sched_yield(); + + /* Pick a random key. */ + n = rand() % nlist; + key.data = list[n]; + key.size = strlen(key.data); + + if (verbose) { + sprintf(buf, "writer: %d: list entry %d\n", id, n); + write(STDOUT_FILENO, buf, strlen(buf)); + } + + /* Abort and retry. */ + if (0) { +retry: if (txn_abort(tid)) + fatal("txn_abort", 1); + ++perf[id].aborts; + ++perf[id].aborted; + } + + /* Thread #1 prints out the stats every 20 seconds. */ + if (id == 1) { + time(&now); + if (now - then >= 20) { + stats(); + then = now; + } + } + + /* Begin the transaction. */ + if ((errno = txn_begin(txnp, NULL, &tid)) != 0) + fatal("txn_begin", 1); + + if (punish) /* See -p option comment. */ + sched_yield(); + + /* + * Get the key. If it doesn't exist, add it. If it does + * exist, delete it. + */ + switch (errno = dbp->get(dbp, tid, &key, &data, 0)) { + case EAGAIN: + goto retry; + case 0: + goto delete; + case DB_NOTFOUND: + goto add; + } + + sprintf(buf, "writer: %d: dbp->get", id); + fatal(buf, 1); + /* NOTREACHED */ + +delete: if (punish) /* See -p option comment. */ + sched_yield(); + + /* Delete the key. */ + switch (errno = dbp->del(dbp, tid, &key, 0)) { + case EAGAIN: + goto retry; + case 0: + ++perf[id].deletes; + goto commit; + } + + sprintf(buf, "writer: %d: dbp->del", id); + fatal(buf, 1); + /* NOTREACHED */ + +add: if (punish) /* See -p option comment. */ + sched_yield(); + + /* Add the key. 1 data item in 30 is an overflow item. */ + data.size = 20 + rand() % 128; + if (rand() % 30 == 0) + data.size += 8192; + + switch (errno = dbp->put(dbp, tid, &key, &data, 0)) { + case EAGAIN: + goto retry; + case 0: + ++perf[id].adds; + goto commit; + default: + sprintf(buf, "writer: %d: dbp->put", id); + fatal(buf, 1); + } + +commit: if (punish) /* See -p option comment. */ + sched_yield(); + + /* The transaction finished, commit it. */ + if ((errno = txn_commit(tid)) != 0) + fatal("txn_commit", 1); + + /* + * Every time the thread completes 20 transactions, show + * our progress. + */ + if (++perf[id].txns % 20 == 0) { + sprintf(buf, +"writer: %2d: adds: %4d: deletes: %4d: aborts: %4d: txns: %4d\n", + id, perf[id].adds, perf[id].deletes, + perf[id].aborts, perf[id].txns); + write(STDOUT_FILENO, buf, strlen(buf)); + } + + /* + * If this thread was aborted more than 5 times before + * the transaction finished, complain. + */ + if (perf[id].aborted > 5) { + sprintf(buf, +"writer: %2d: adds: %4d: deletes: %4d: aborts: %4d: txns: %4d: ABORTED: %2d\n", + id, perf[id].adds, perf[id].deletes, + perf[id].aborts, perf[id].txns, perf[id].aborted); + write(STDOUT_FILENO, buf, strlen(buf)); + } + perf[id].aborted = 0; + } + return (0); +} + +/* + * stats -- + * Display reader/writer thread statistics. To display the statistics + * for the mpool trickle or deadlock threads, use db_stat(1). + */ +void +stats() +{ + int id; + char *p, buf[8192]; + + p = buf + sprintf(buf, "-------------\n"); + for (id = 0; id < nreaders + nwriters;) + if (id++ < nwriters) + p += sprintf(p, + "writer: %2d: adds: %4d: deletes: %4d: aborts: %4d: txns: %4d\n", + id, perf[id].adds, + perf[id].deletes, perf[id].aborts, perf[id].txns); + else + p += sprintf(p, + "reader: %2d: found: %5d: notfound: %5d: aborts: %4d\n", + id, perf[id].found, + perf[id].notfound, perf[id].aborts); + p += sprintf(p, "-------------\n"); + + write(STDOUT_FILENO, buf, p - buf); +} + +/* + * db_init -- + * Initialize the environment. + */ +DB_ENV * +db_init(home) + char *home; +{ + DB_ENV *dbenv; + + /* Define our own yield function. */ + db_jump_set(sched_yield, DB_FUNC_YIELD); + + /* Rely on calloc to initialize the structure. */ + if ((dbenv = (DB_ENV *)calloc(sizeof(DB_ENV), 1)) == NULL) { + fprintf(stderr, "%s: %s\n", progname, strerror(ENOMEM)); + exit (1); + } + dbenv->lg_max = 200000; + dbenv->db_errfile = stderr; + dbenv->db_errpfx = progname; + dbenv->mp_size = 100 * 1024; /* Cachesize: 100K. */ + + if ((errno = db_appinit(home, NULL, dbenv, + DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG | + DB_INIT_MPOOL | DB_INIT_TXN | DB_THREAD)) != 0) { + fprintf(stderr, + "%s: db_appinit: %s\n", progname, strerror(errno)); + exit (1); + } + return (dbenv); +} + +/* + * tstart -- + * Thread start function for readers and writers. + */ +void * +tstart(arg) + void *arg; +{ + pthread_t tid; + int id; + + id = *(int *)arg + 1; + + tid = pthread_self(); + + if (id <= nwriters) { + printf("write thread %d starting: tid: %lu\n", id, (u_long)tid); + fflush(stdout); + writer(id); + } else { + printf("read thread %d starting: tid: %lu\n", id, (u_long)tid); + fflush(stdout); + reader(id); + } + + /* NOTREACHED */ + return (NULL); +} + +/* + * deadlock -- + * Thread start function for lock_detect(). + */ +void * +deadlock(arg) + void *arg; +{ + struct timeval t; + pthread_t tid; + + arg = arg; /* XXX: shut the compiler up. */ + tid = pthread_self(); + + printf("deadlock thread starting: tid: %lu\n", (u_long)tid); + fflush(stdout); + + t.tv_sec = 0; + t.tv_usec = 100000; + for (;;) { + (void)lock_detect(dbenv->lk_info, + DB_LOCK_CONFLICT, DB_LOCK_DEFAULT); + + /* Check every 100ms. */ + (void)select(0, NULL, NULL, NULL, &t); + } + + /* NOTREACHED */ + return (NULL); +} + +/* + * trickle -- + * Thread start function for memp_trickle(). + */ +void * +trickle(arg) + void *arg; +{ + pthread_t tid; + int wrote; + char buf[64]; + + arg = arg; /* XXX: shut the compiler up. */ + tid = pthread_self(); + + printf("trickle thread starting: tid: %lu\n", (u_long)tid); + fflush(stdout); + + for (;;) { + (void)memp_trickle(dbenv->mp_info, 10, &wrote); + if (verbose) { + sprintf(buf, "trickle: wrote %d\n", wrote); + write(STDOUT_FILENO, buf, strlen(buf)); + } + if (wrote == 0) { + sleep(1); + sched_yield(); + } + } + + /* NOTREACHED */ + return (NULL); +} + +/* + * word -- + * Build the dictionary word list. + */ +void +word() +{ + FILE *fp; + int cnt; + char buf[256]; + + if ((fp = fopen(WORDLIST, "r")) == NULL) + fatal(WORDLIST, 1); + + if ((list = malloc(nlist * sizeof(char *))) == NULL) + fatal(NULL, 1); + + for (cnt = 0; cnt < nlist; ++cnt) { + if (fgets(buf, sizeof(buf), fp) == NULL) + break; + if ((list[cnt] = strdup(buf)) == NULL) + fatal(NULL, 1); + } + nlist = cnt; /* In case nlist was larger than possible. */ +} + +/* + * fatal -- + * Report a fatal error and quit. + */ +void +fatal(msg, syserr) + char *msg; + int syserr; +{ + fprintf(stderr, "%s: ", progname); + if (msg != NULL) { + fprintf(stderr, "%s", msg); + if (syserr) + fprintf(stderr, ": "); + } + if (syserr) + fprintf(stderr, "%s", strerror(errno)); + fprintf(stderr, "\n"); + exit (1); + + /* NOTREACHED */ +} + +/* + * usage -- + * Usage message. + */ +void +usage() +{ + (void)fprintf(stderr, + "usage: %s [-pv] [-h home] [-n words] [-r readers] [-w writers]\n", + progname); + exit(1); +} diff --git a/mozilla/db/examples/ex_tpcb.c b/mozilla/db/examples/ex_tpcb.c new file mode 100644 index 00000000000..d76521d7d4f --- /dev/null +++ b/mozilla/db/examples/ex_tpcb.c @@ -0,0 +1,760 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)ex_tpcb.c 10.24 (Sleepycat) 4/10/98 + */ + +#include "config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#include +#endif + +#ifdef _WIN32 +#include +#include +#endif + + +#include + +typedef enum { ACCOUNT, BRANCH, TELLER } FTYPE; + +DB_ENV *db_init(char *, int, int, int); +void hpopulate(DB *, u_int, u_int32_t, u_int32_t, u_int32_t); +void invarg(int, char *); +int main __P((int, char *[])); +void populate(DB *, u_int32_t, u_int32_t, u_int, char *); +u_int32_t random_id(FTYPE, u_int32_t, u_int32_t, u_int32_t); +u_int32_t random_int(u_int32_t, u_int32_t); +void tp_populate(DB_ENV *, int, int, int, int); +void tp_run(DB_ENV *, int, int, int, int); +int tp_txn(DB_TXNMGR *, DB *, DB *, DB *, DB *, int, int, int); +void usage(void); + +int verbose; +const char + *progname = "ex_tpcb"; /* Program name. */ + +/* + * This program implements a basic TPC/B driver program. To create the + * TPC/B database, run with the -i (init) flag. The number of records + * with which to populate the account, history, branch, and teller tables + * is specified by the a, s, b, and t flags respectively. To run a TPC/B + * test, use the n flag to indicate a number of transactions to run (note + * that you can run many of these processes in parallel to simulate a + * multiuser test run). + */ +#define TELLERS_PER_BRANCH 10 +#define ACCOUNTS_PER_TELLER 10000 +#define HISTORY_PER_BRANCH 2592000 + +/* + * The default configuration that adheres to TPCB scaling rules requires + * nearly 3 GB of space. To avoid requiring that much space for testing, + * we set the parameters much lower. If you want to run a valid 10 TPS + * configuration, define VALID_SCALING. + */ +#ifdef VALID_SCALING +#define ACCOUNTS 1000000 +#define BRANCHES 10 +#define TELLERS 100 +#define HISTORY 25920000 +#else +#define ACCOUNTS 100000 +#define BRANCHES 10 +#define TELLERS 100 +#define HISTORY 259200 +#endif + +#define HISTORY_LEN 100 +#define RECLEN 100 +#define BEGID 1000000 + +typedef struct _defrec { + u_int32_t id; + u_int32_t balance; + u_int8_t pad[RECLEN - sizeof(u_int32_t) - sizeof(u_int32_t)]; +} defrec; + +typedef struct _histrec { + u_int32_t aid; + u_int32_t bid; + u_int32_t tid; + u_int32_t amount; + u_int8_t pad[RECLEN - 4 * sizeof(u_int32_t)]; +} histrec; + +#ifdef _WIN32 +/* Simulation of UNIX gettimeofday(2). */ +struct timeval { + long tv_sec; + long tv_usec; +}; + +struct timezone { + int tz_minuteswest; + int tz_dsttime; +}; + +int +gettimeofday(tp, tzp) + struct timeval *tp; + struct timezone *tzp; +{ + struct _timeb tb; + + _ftime(&tb); + if (tp != 0) { + tp->tv_sec = tb.time; + tp->tv_usec = tb.millitm * 1000; + } + if (tzp != 0) { + tzp->tz_minuteswest = tb.timezone; + tzp->tz_dsttime = tb.dstflag; + } + return (0); +} +#endif + +int +main(argc, argv) + int argc; + char *argv[]; +{ + extern char *optarg; + extern int optind; + DB_ENV *dbenv; + u_long seed; + int accounts, branches, tellers, history; + int ch, iflag, mpool, ntxns, txn_no_sync; + char *home, *endarg; + + home = NULL; + accounts = branches = history = tellers = 0; + txn_no_sync = 0; + mpool = ntxns = 0; + verbose = 0; + iflag = 0; + seed = (u_long)getpid(); + while ((ch = getopt(argc, argv, "a:b:fh:im:n:S:s:t:v")) != EOF) + switch (ch) { + case 'a': /* Number of account records */ + if ((accounts = atoi(optarg)) <= 0) + invarg(ch, optarg); + break; + case 'b': /* Number of branch records */ + if ((branches = atoi(optarg)) <= 0) + invarg(ch, optarg); + break; + case 'c': /* Cachesize in bytes */ + if ((mpool = atoi(optarg)) <= 0) + invarg(ch, optarg); + break; + case 'f': /* Fast mode: no txn sync. */ + txn_no_sync = 1; + break; + case 'h': /* DB home. */ + home = optarg; + break; + case 'i': /* Initialize the test. */ + iflag = 1; + break; + case 'n': /* Number of transactions */ + if ((ntxns = atoi(optarg)) <= 0) + invarg(ch, optarg); + break; + case 'S': /* Random number seed. */ + seed = strtoul(optarg, &endarg, 0); + if (*endarg != '\0') + invarg(ch, optarg); + break; + case 's': /* Number of history records */ + if ((history = atoi(optarg)) <= 0) + invarg(ch, optarg); + break; + case 't': /* Number of teller records */ + if ((tellers = atoi(optarg)) <= 0) + invarg(ch, optarg); + break; + case 'v': /* Verbose option. */ + verbose = 1; + break; + case '?': + default: + usage(); + } + argc -= optind; + argv += optind; + + srand((u_int)seed); + + /* Initialize the database environment. */ + dbenv = db_init(home, mpool, iflag, txn_no_sync ? DB_TXN_NOSYNC : 0); + + accounts = accounts == 0 ? ACCOUNTS : accounts; + branches = branches == 0 ? BRANCHES : branches; + tellers = tellers == 0 ? TELLERS : tellers; + history = history == 0 ? HISTORY : history; + + if (verbose) + printf("%ld Accounts, %ld Branches, %ld Tellers, %ld History\n", + (long)accounts, (long)branches, + (long)tellers, (long)history); + + if (iflag) { + if (ntxns != 0) + usage(); + tp_populate(dbenv, accounts, branches, history, tellers); + } else { + if (ntxns == 0) + usage(); + tp_run(dbenv, ntxns, accounts, branches, tellers); + } + + if ((errno = db_appexit(dbenv)) != 0) { + fprintf(stderr, "%s: %s\n", progname, strerror(errno)); + exit (1); + } + + return (0); +} + +/* + * db_init -- + * Initialize the environment. + */ +DB_ENV * +db_init(home, mp_size, initializing, flags) + char *home; + int mp_size; + int initializing; + int flags; +{ + DB_ENV *dbenv; + u_int32_t local_flags; + + /* Rely on calloc to initialize the structure. */ + if ((dbenv = (DB_ENV *)calloc(sizeof(DB_ENV), 1)) == NULL) { + fprintf(stderr, "%s: ", progname); + if (errno < 0) + fprintf(stderr, "returned %ld\n", (long)errno); + else + fprintf(stderr, "%s\n", strerror(errno)); + exit (1); + } + + dbenv->db_errfile = stderr; + dbenv->db_errpfx = progname; + dbenv->mp_size = mp_size == 0 ? 4 * 1024 * 1024 : (size_t)mp_size; + + local_flags = flags | DB_CREATE | (initializing ? DB_INIT_MPOOL : + DB_INIT_TXN | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL); + if ((errno = db_appinit(home, NULL, dbenv, local_flags)) != 0) { + fprintf(stderr, "%s: db_appinit: ", progname); + if (errno < 0) + fprintf(stderr, "returned %ld\n", (long)errno); + else + fprintf(stderr, "%s\n", strerror(errno)); + exit (1); + } + + return (dbenv); +} + +void +invarg(arg, str) + int arg; + char *str; +{ + (void)fprintf(stderr, + "%s: invalid argument for -%c: %s\n", progname, arg, str); + exit (1); +} + +void +usage() +{ + char *a1, *a2; + + a1 = "[-v] [-a accounts] [-b branches] [-h home]\n"; + a2 = " [-m mpool_size] [-S seed] [-s history] [-t tellers]"; + (void)fprintf(stderr, "usage: %s -i %s %s\n", progname, a1, a2); + (void)fprintf(stderr, + " %s -n transactions %s %s\n", progname, a1, a2); + exit(1); +} + +/* + * Initialize the database to the specified number of accounts, branches, + * history records, and tellers. + */ +void +tp_populate(env, num_a, num_b, num_h, num_t) + DB_ENV *env; + int num_a, num_b, num_h, num_t; +{ + DB *dbp; + DB_INFO dbi; + u_int32_t balance, idnum; + u_int32_t end_anum, end_bnum, end_tnum; + u_int32_t start_anum, start_bnum, start_tnum; + + idnum = BEGID; + balance = 500000; + + memset(&dbi, 0, sizeof(dbi)); + + dbi.h_nelem = (u_int)num_a; + if ((errno = db_open("account", + DB_HASH, DB_CREATE | DB_TRUNCATE, 0644, env, &dbi, &dbp)) != 0) { + fprintf(stderr, "%s: Account file open failed: ", progname); + if (errno < 0) + fprintf(stderr, "returned %ld\n", (long)errno); + else + fprintf(stderr, "%s\n", strerror(errno)); + exit (1); + } + + start_anum = idnum; + populate(dbp, idnum, balance, dbi.h_nelem, "account"); + idnum += dbi.h_nelem; + end_anum = idnum - 1; + if ((errno = dbp->close(dbp, 0)) != 0) { + fprintf(stderr, "%s: Account file close failed: ", progname); + if (errno < 0) + fprintf(stderr, "returned %ld\n", (long)errno); + else + fprintf(stderr, "%s\n", strerror(errno)); + exit (1); + } + if (verbose) + printf("Populated accounts: %ld - %ld\n", + (long)start_anum, (long)end_anum); + + + /* + * Since the number of branches is very small, we want to use very + * small pages and only 1 key per page. This is the poor-man's way + * of getting key locking instead of page locking. + */ + dbi.h_nelem = (u_int)num_b; + dbi.h_ffactor = 1; + dbi.db_pagesize = 512; + if ((errno = db_open("branch", + DB_HASH, DB_CREATE | DB_TRUNCATE, 0644, env, &dbi, &dbp)) != 0) { + fprintf(stderr, "%s: Branch file create failed: ", progname); + if (errno < 0) + fprintf(stderr, "returned %ld\n", (long)errno); + else + fprintf(stderr, "%s\n", strerror(errno)); + exit (1); + } + start_bnum = idnum; + populate(dbp, idnum, balance, dbi.h_nelem, "branch"); + idnum += dbi.h_nelem; + end_bnum = idnum - 1; + if ((errno = dbp->close(dbp, 0)) != 0) { + fprintf(stderr, "%s: Close of branch file failed: ", progname); + if (errno < 0) + fprintf(stderr, "returned %ld\n", (long)errno); + else + fprintf(stderr, "%s\n", strerror(errno)); + exit (1); + } + + if (verbose) + printf("Populated branches: %ld - %ld\n", + (long)start_bnum, (long)end_bnum); + + + /* + * In the case of tellers, we also want small pages, but we'll let + * the fill factor dynamically adjust itself. + */ + dbi.h_nelem = (u_int)num_t; + dbi.h_ffactor = 0; + dbi.db_pagesize = 512; + if ((errno = db_open("teller", + DB_HASH, DB_CREATE | DB_TRUNCATE, 0644, env, &dbi, &dbp)) != 0) { + fprintf(stderr, "%s: Teller file create failed: ", progname); + if (errno < 0) + fprintf(stderr, "returned %ld\n", (long)errno); + else + fprintf(stderr, "%s\n", strerror(errno)); + exit (1); + } + + start_tnum = idnum; + populate(dbp, idnum, balance, dbi.h_nelem, "teller"); + idnum += dbi.h_nelem; + end_tnum = idnum - 1; + if ((errno = dbp->close(dbp, 0)) != 0) { + fprintf(stderr, "%s: Teller file close failed: ", progname); + if (errno < 0) + fprintf(stderr, "returned %ld\n", (long)errno); + else + fprintf(stderr, "%s\n", strerror(errno)); + exit (1); + } + if (verbose) + printf("Populated tellers: %ld - %ld\n", + (long)start_tnum, (long)end_tnum); + + memset(&dbi, 0, sizeof(dbi)); + dbi.re_len = HISTORY_LEN; + dbi.flags = DB_FIXEDLEN; + if ((errno = db_open("history", + DB_RECNO, DB_CREATE | DB_TRUNCATE, 0644, env, &dbi, &dbp)) != 0) { + fprintf(stderr, "%s: History file create failed: ", progname); + if (errno < 0) + fprintf(stderr, "returned %ld\n", (long)errno); + else + fprintf(stderr, "%s\n", strerror(errno)); + exit (1); + } + + hpopulate(dbp, num_h, num_a, num_b, num_t); + if ((errno = dbp->close(dbp, 0)) != 0) { + fprintf(stderr, "%s: History file close failed: ", progname); + if (errno < 0) + fprintf(stderr, "returned %ld\n", (long)errno); + else + fprintf(stderr, "%s\n", strerror(errno)); + exit (1); + } +} + +void +populate(dbp, start_id, balance, nrecs, msg) + DB *dbp; + u_int32_t start_id, balance; + u_int nrecs; + char *msg; +{ + DBT kdbt, ddbt; + defrec drec; + u_int i; + + kdbt.flags = 0; + kdbt.data = &drec.id; + kdbt.size = sizeof(u_int32_t); + ddbt.flags = 0; + ddbt.data = &drec; + ddbt.size = sizeof(drec); + memset(&drec.pad[0], 1, sizeof(drec.pad)); + + for (i = 0; i < nrecs; i++) { + drec.id = start_id + (u_int32_t)i; + drec.balance = balance; + if ((errno = + (dbp->put)(dbp, NULL, &kdbt, &ddbt, DB_NOOVERWRITE)) != 0) { + fprintf(stderr, "%s: Failure initializing %s file\n", + progname, msg); + exit (1); + } + } +} + +void +hpopulate(dbp, nrecs, anum, bnum, tnum) + DB *dbp; + u_int nrecs; + u_int32_t anum, bnum, tnum; +{ + DBT kdbt, ddbt; + histrec hrec; + db_recno_t key; + u_int32_t i; + + memset(&kdbt, 0, sizeof(kdbt)); + memset(&ddbt, 0, sizeof(ddbt)); + ddbt.data = &hrec; + ddbt.size = sizeof(hrec); + kdbt.data = &key; + kdbt.size = sizeof(key); + memset(&hrec.pad[0], 1, sizeof(hrec.pad)); + hrec.amount = 10; + + for (i = 1; i <= nrecs; i++) { + hrec.aid = random_id(ACCOUNT, anum, bnum, tnum); + hrec.bid = random_id(BRANCH, anum, bnum, tnum); + hrec.tid = random_id(TELLER, anum, bnum, tnum); + if ((errno = dbp->put(dbp, + NULL, &kdbt, &ddbt, DB_APPEND | DB_NOOVERWRITE)) != 0) { + fprintf(stderr, + "%s: Failure initializing history file: ", + progname); + if (errno < 0) + fprintf(stderr, "returned %ld\n", (long)errno); + else + fprintf(stderr, "%s\n", strerror(errno)); + exit (1); + } + } +} + +u_int32_t +random_int(lo, hi) + u_int32_t lo, hi; +{ + u_int32_t ret; + int t; + + t = rand(); + ret = (u_int32_t)(((double)t / ((double)(RAND_MAX) + 1)) * + (hi - lo + 1)); + ret += lo; + return (ret); +} + +u_int32_t +random_id(type, accounts, branches, tellers) + FTYPE type; + u_int32_t accounts, branches, tellers; +{ + u_int32_t min, max, num; + + max = min = BEGID; + num = accounts; + switch(type) { + case TELLER: + min += branches; + num = tellers; + /* FALLTHROUGH */ + case BRANCH: + if (type == BRANCH) + num = branches; + min += accounts; + /* FALLTHROUGH */ + case ACCOUNT: + max = min + num - 1; + } + return (random_int(min, max)); +} + +void +tp_run(dbenv, n, accounts, branches, tellers) + DB_ENV *dbenv; + int n, accounts, branches, tellers; +{ + DB *adb, *bdb, *hdb, *tdb; + double gtps, itps; + int failed, ifailed, ret, txns, gus, ius; + struct timeval starttime, curtime, lasttime; +#ifndef _WIN32 + pid_t pid; + + pid = getpid(); +#else + int pid; + + pid = 0; +#endif + + /* + * Open the database files. + */ + if ((errno = + db_open("account", DB_UNKNOWN, 0, 0, dbenv, NULL, &adb)) != 0) { + fprintf(stderr, "%s: Open of account file failed: ", progname); + if (errno < 0) + fprintf(stderr, "returned %ld\n", (long)errno); + else + fprintf(stderr, "%s\n", strerror(errno)); + exit (1); + } + if ((errno = + db_open("branch", DB_UNKNOWN, 0, 0, dbenv, NULL, &bdb)) != 0) { + fprintf(stderr, "%s: Open of branch file failed: ", progname); + if (errno < 0) + fprintf(stderr, "returned %ld\n", (long)errno); + else + fprintf(stderr, "%s\n", strerror(errno)); + exit (1); + } + if ((errno = + db_open("teller", DB_UNKNOWN, 0, 0, dbenv, NULL, &tdb)) != 0) { + fprintf(stderr, "%s: Open of teller file failed: ", progname); + if (errno < 0) + fprintf(stderr, "returned %ld\n", (long)errno); + else + fprintf(stderr, "%s\n", strerror(errno)); + exit (1); + } + if ((errno = + db_open("history", DB_UNKNOWN, 0, 0, dbenv, NULL, &hdb)) != 0) { + fprintf(stderr, "%s: Open of history file failed: ", progname); + if (errno < 0) + fprintf(stderr, "returned %ld\n", (long)errno); + else + fprintf(stderr, "%s\n", strerror(errno)); + exit (1); + } + + txns = failed = ifailed = 0; + (void)gettimeofday(&starttime, NULL); + lasttime = starttime; + while (n-- >= 0) { + txns++; + ret = tp_txn(dbenv->tx_info, + adb, bdb, tdb, hdb, accounts, branches, tellers); + if (ret != 0) { + failed++; + ifailed++; + } + if (n % 1000 == 0) { + (void)gettimeofday(&curtime, NULL); + gus = curtime.tv_usec >= starttime.tv_usec ? + curtime.tv_usec - starttime.tv_usec + + 1000000 * (curtime.tv_sec - starttime.tv_sec) : + 1000000 + curtime.tv_usec - starttime.tv_usec + + 1000000 * (curtime.tv_sec - starttime.tv_sec - 1); + ius = curtime.tv_usec >= lasttime.tv_usec ? + curtime.tv_usec - lasttime.tv_usec + + 1000000 * (curtime.tv_sec - lasttime.tv_sec) : + 1000000 + curtime.tv_usec - lasttime.tv_usec + + 1000000 * (curtime.tv_sec - lasttime.tv_sec - 1); + gtps = (double)(txns - failed) / + ((double)gus / 1000000); + itps = (double)(1000 - ifailed) / + ((double)ius / 1000000); + printf("[%d] %d txns %d failed ", (int)pid, + txns, failed); + printf("%6.2f TPS (gross) %6.2f TPS (interval)\n", + gtps, itps); + lasttime = curtime; + ifailed = 0; + } + } + + (void)adb->close(adb, 0); + (void)bdb->close(bdb, 0); + (void)tdb->close(tdb, 0); + (void)hdb->close(hdb, 0); + + printf("%ld transactions begun %ld failed\n", (long)txns, (long)failed); +} + +/* + * XXX Figure out the appropriate way to pick out IDs. + */ +int +tp_txn(txmgr, adb, bdb, tdb, hdb, anum, bnum, tnum) + DB_TXNMGR *txmgr; + DB *adb, *bdb, *tdb, *hdb; + int anum, bnum, tnum; +{ + DBC *acurs, *bcurs, *tcurs; + DBT d_dbt, d_histdbt, k_dbt, k_histdbt; + DB_TXN *t; + db_recno_t key; + defrec rec; + histrec hrec; + int account, branch, teller; + + t = NULL; + acurs = bcurs = tcurs = NULL; + + /* + * XXX We could move a lot of this into the driver to make this + * faster. + */ + account = random_id(ACCOUNT, anum, bnum, tnum); + branch = random_id(BRANCH, anum, bnum, tnum); + teller = random_id(TELLER, anum, bnum, tnum); + + memset(&d_histdbt, 0, sizeof(d_histdbt)); + + memset(&k_histdbt, 0, sizeof(k_histdbt)); + k_histdbt.data = &key; + k_histdbt.size = sizeof(key); + + memset(&k_dbt, 0, sizeof(k_dbt)); + k_dbt.size = sizeof(int); + + memset(&d_dbt, 0, sizeof(d_dbt)); + d_dbt.flags = DB_DBT_USERMEM; + d_dbt.data = &rec; + d_dbt.ulen = sizeof(rec); + + hrec.aid = account; + hrec.bid = branch; + hrec.tid = teller; + hrec.amount = 10; + /* Request 0 bytes since we're just positioning. */ + d_histdbt.flags = DB_DBT_PARTIAL; + + /* START TIMING */ + if (txn_begin(txmgr, NULL, &t) != 0) + goto err; + + if (adb->cursor(adb, t, &acurs) != 0 || + bdb->cursor(bdb, t, &bcurs) != 0 || + tdb->cursor(tdb, t, &tcurs) != 0) + goto err; + + /* Account record */ + k_dbt.data = &account; + if (acurs->c_get(acurs, &k_dbt, &d_dbt, DB_SET) != 0) + goto err; + rec.balance += 10; + if (acurs->c_put(acurs, &k_dbt, &d_dbt, DB_CURRENT) != 0) + goto err; + + /* Branch record */ + k_dbt.data = &branch; + if (bcurs->c_get(bcurs, &k_dbt, &d_dbt, DB_SET) != 0) + goto err; + rec.balance += 10; + if (bcurs->c_put(bcurs, &k_dbt, &d_dbt, DB_CURRENT) != 0) + goto err; + + /* Teller record */ + k_dbt.data = &teller; + if (tcurs->c_get(tcurs, &k_dbt, &d_dbt, DB_SET) != 0) + goto err; + rec.balance += 10; + if (tcurs->c_put(tcurs, &k_dbt, &d_dbt, DB_CURRENT) != 0) + goto err; + + /* History record */ + d_histdbt.flags = 0; + d_histdbt.data = &hrec; + d_histdbt.ulen = sizeof(hrec); + if (hdb->put(hdb, t, &k_histdbt, &d_histdbt, DB_APPEND) != 0) + goto err; + + if (acurs->c_close(acurs) != 0 || bcurs->c_close(bcurs) != 0 || + tcurs->c_close(tcurs) != 0) + goto err; + + if (txn_commit(t) != 0) + goto err; + + /* END TIMING */ + return (0); + +err: if (acurs != NULL) + (void)acurs->c_close(acurs); + if (bcurs != NULL) + (void)bcurs->c_close(bcurs); + if (tcurs != NULL) + (void)tcurs->c_close(tcurs); + if (t != NULL) + (void)txn_abort(t); + + if (verbose) + printf("Transaction A=%ld B=%ld T=%ld failed\n", + (long)account, (long)branch, (long)teller); + return (-1); +} diff --git a/mozilla/db/examples/ex_tpcb.h b/mozilla/db/examples/ex_tpcb.h new file mode 100644 index 00000000000..327e3a6a440 --- /dev/null +++ b/mozilla/db/examples/ex_tpcb.h @@ -0,0 +1,39 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)ex_tpcb.h 10.2 (Sleepycat) 4/10/98 + */ + +#ifndef _TPCB_H_ +#define _TPCB_H_ + +typedef enum { ACCOUNT, BRANCH, TELLER } FTYPE; + +#define TELLERS_PER_BRANCH 100 +#define ACCOUNTS_PER_TELLER 1000 + +#define ACCOUNTS 1000000 +#define BRANCHES 10 +#define TELLERS 1000 +#define HISTORY 1000000 +#define HISTORY_LEN 100 +#define RECLEN 100 +#define BEGID 1000000 + +typedef struct _defrec { + u_int32_t id; + u_int32_t balance; + u_int8_t pad[RECLEN - sizeof(u_int32_t) - sizeof(u_int32_t)]; +} defrec; + +typedef struct _histrec { + u_int32_t aid; + u_int32_t bid; + u_int32_t tid; + u_int32_t amount; + u_int8_t pad[RECLEN - 4 * sizeof(u_int32_t)]; +} histrec; +#endif /* _TPCB_H_ */ diff --git a/mozilla/db/examples_cxx/AccessExample.cpp b/mozilla/db/examples_cxx/AccessExample.cpp new file mode 100644 index 00000000000..aaf189a0771 --- /dev/null +++ b/mozilla/db/examples_cxx/AccessExample.cpp @@ -0,0 +1,148 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)AccessExample.cpp 10.6 (Sleepycat) 4/10/98 + */ + +#include "config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#ifndef _MSC_VER +#include +#endif +#endif + +#include + +class AccessExample : public DbEnv +{ +public: + void run(); + + AccessExample(const char *home); + +private: + static const char FileName[]; + + // no need for copy and assignment + AccessExample(const AccessExample &); + operator = (const AccessExample &); +}; + +static void usage(); // forward + +int main(int argc, char *argv[]) +{ + const char *home = 0; + for (int i = 1; i < argc; ++i) + { + if (strcmp(argv[i], "-h") == 0) + { + home = argv[++i]; + } + else + { + usage(); + } + } + + try + { + AccessExample app(home); + app.run(); + return 0; + } + catch (DbException &dbe) + { + cerr << "AccessExample: " << dbe.what() << "\n"; + return 1; + } +} + +static void usage() +{ + cerr << "usage: AccessExample [-h home]\n"; + exit(1); +} + +const char AccessExample::FileName[] = "access.db"; + +AccessExample::AccessExample(const char *home) +: DbEnv(home, 0, 0) +{ + set_error_stream(&cerr); + set_errpfx("AccessExample"); +} + +void AccessExample::run() +{ + Db *table; + Db::open(FileName, DB_BTREE, DB_CREATE, 0644, this, 0, &table); + + // + // Insert records into the database, where the key is the user + // input and the data is the user input in reverse order. + // + char buf[1024]; + char rbuf[1024]; + + for (;;) { + cout << "input> "; + cout.flush(); + + cin.getline(buf, sizeof(buf)); + if (cin.eof()) + break; + + int len = strlen(buf); + if (len <= 0) + continue; + + char *t = rbuf; + char *p = buf + len - 1; + while (p >= buf) + *t++ = *p--; + *t = '\0'; + + Dbt key(buf, len+1); + Dbt data(rbuf, len+1); + + try + { + int err; + if ((err = table->put(0, &key, &data, 0)) == DB_KEYEXIST) { + cout << "Key " << buf << " already exists.\n"; + } + } + catch (DbException &dbe) + { + cout << dbe.what() << "\n"; + } + cout << "\n"; + } + + // Acquire an iterator for the table. + Dbc *iterator; + table->cursor(NULL, &iterator); + + // Walk through the table, printing the key/data pairs. + Dbt key; + Dbt data; + while (iterator->get(&key, &data, DB_NEXT) == 0) + { + char *key_string = (char *)key.get_data(); + char *data_string = (char *)data.get_data(); + cout << key_string << " : " << data_string << "\n"; + } + iterator->close(); + table->close(0); +} diff --git a/mozilla/db/examples_cxx/AppinitExample.cpp b/mozilla/db/examples_cxx/AppinitExample.cpp new file mode 100644 index 00000000000..e0bd82b45bd --- /dev/null +++ b/mozilla/db/examples_cxx/AppinitExample.cpp @@ -0,0 +1,96 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)AppinitExample.cpp 10.6 (Sleepycat) 4/10/98 + */ + +#include "config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#include +#include +#include +#endif + +#include + +#define DATABASE_HOME "/home/database" + +DB_ENV *db_setup(FILE *); + +char *progname = "AppinitExample"; /* Program name. */ + +/* + * An example of a program using DbEnv to configure its DB + * environment. + */ +DbEnv * +init() +{ + DbEnv *dbenv = new DbEnv(); + char *config[2]; + + // Output errors to the application's log. + // + dbenv->set_error_stream(&cerr); + dbenv->set_errpfx(progname); + + // + // All of the shared database files live in /home/database, + // but data files live in /database. + // + config[0] = "DB_DATA_DIR /database/files"; + config[1] = NULL; + + // + // We want to specify the shared memory buffer pool cachesize, + // but everything else is the default. + // + dbenv->set_mp_size(64 * 1024); + + // + // We have multiple processes reading/writing these files, so + // we need concurrency control and a shared buffer pool, but + // not logging or transactions. + // + if ((errno = dbenv->appinit(DATABASE_HOME, + config, DB_CREATE | DB_INIT_LOCK | DB_INIT_MPOOL)) != 0) { + cerr << progname << ": db_appinit: " << strerror(errno); + exit (1); + } + return dbenv; +} + +int +main(int, char **) +{ + // + // Note: it may be easiest to put all DB operations in a try block, as + // seen here. Alternatively, you can change the ErrorModel in the DbEnv + // so that exceptions are never thrown and check error returns from all + // methods. + // + try + { + DbEnv *dbenv = init(); + + // ... your application here ... + + delete dbenv; + return 0; + } + catch (DbException &dbe) + { + cerr << "AccessExample: " << dbe.what() << "\n"; + return 1; + } +} diff --git a/mozilla/db/examples_cxx/LockExample.cpp b/mozilla/db/examples_cxx/LockExample.cpp new file mode 100644 index 00000000000..08d9d87325e --- /dev/null +++ b/mozilla/db/examples_cxx/LockExample.cpp @@ -0,0 +1,198 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)LockExample.cpp 10.5 (Sleepycat) 4/10/98 + */ + +#include "config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#include +#endif + +#include + +#define LOCK_HOME "/var/tmp/lock" + +char *progname = "LockExample"; // Program name. + +// +// An example of a program using DBLock and related classes. +// +class LockExample : public DbEnv +{ +public: + void run(); + + LockExample(const char *home); + +private: + static const char FileName[]; + + // no need for copy and assignment + LockExample(const LockExample &); + operator = (const LockExample &); +}; + +static void usage(); // forward + +int +main(int argc, char *argv[]) +{ + const char *home = LOCK_HOME; + int do_unlink = 0; + + for (int i = 1; i < argc; ++i) { + if (strcmp(argv[i], "-h") == 0) { + home = argv[++i]; + } + else if (strcmp(argv[i], "-u") == 0) { + do_unlink = 1; + } + else { + usage(); + } + } + + try { + if (do_unlink) { + LockExample temp(home); + DbLockTab::unlink(home, 1, &temp); + } + + LockExample app(home); + app.run(); + return 0; + } + catch (DbException &dbe) { + cerr << "AccessExample: " << dbe.what() << "\n"; + return 1; + } +} + +LockExample::LockExample(const char *home) +: DbEnv(home, 0, DB_CREATE|DB_INIT_LOCK) +{ + set_error_stream(&cerr); + set_errpfx("LockExample"); +} + + +void LockExample::run() +{ + long held; + u_int32_t len, locker; + int did_get, ret; + char objbuf[1024]; + unsigned int lockid = 0; + + DbLockTab *lockTable = get_lk_info(); + if (!lockTable) { + cerr << "LockExample: lock table not initialized\n"; + return; + } + + // + // Accept lock requests. + // + lockTable->id(&locker); + for (held = 0;;) { + cout << "Operation get/release [get]> "; + cout.flush(); + + char opbuf[16]; + cin.getline(opbuf, sizeof(opbuf)); + if (cin.eof()) + break; + if ((len = strlen(opbuf)) <= 1 || strcmp(opbuf, "get") == 0) { + // Acquire a lock. + cout << "input object (text string) to lock> "; + cout.flush(); + cin.getline(objbuf, sizeof(objbuf)); + if (cin.eof()) + break; + if ((len = strlen(objbuf)) <= 0) + continue; + + char lockbuf[16]; + do { + cout << "lock type read/write [read]> "; + cout.flush(); + cin.getline(lockbuf, sizeof(lockbuf)); + if (cin.eof()) + break; + len = strlen(lockbuf); + } while (len >= 1 && + strcmp(lockbuf, "read") != 0 && + strcmp(lockbuf, "write") != 0); + + db_lockmode_t lock_type; + if (len <= 1 || strcmp(lockbuf, "read") == 0) + lock_type = DB_LOCK_READ; + else + lock_type = DB_LOCK_WRITE; + + Dbt dbt(objbuf, strlen(objbuf)); + + DbLock lock; + ret = lockTable->get(locker, + DB_LOCK_NOWAIT, &dbt, lock_type, &lock); + lockid = lock.get_lock_id(); + did_get = 1; + } else { + // Release a lock. + do { + cout << "input lock to release> "; + cout.flush(); + cin.getline(objbuf, sizeof(objbuf)); + if (cin.eof()) + break; + } while ((len = strlen(objbuf)) <= 1); + lockid = strtoul(objbuf, NULL, 16); + DbLock lock(lockid); + ret = lock.put(lockTable); + did_get = 0; + } + + switch (ret) { + case 0: + cout << "Lock 0x" << hex << lockid << " " + << (did_get ? "granted" : "released") + << "\n"; + held += did_get ? 1 : -1; + break; + case DB_LOCK_NOTHELD: + cout << "You do not hold the lock " << lockid << "\n"; + break; + case DB_LOCK_NOTGRANTED: + cout << "Lock not granted\n"; + break; + case DB_LOCK_DEADLOCK: + cerr << "LockExample: lock_" + << (did_get ? "get" : "put") + << ": " << "returned DEADLOCK"; + break; + default: + cerr << "LockExample: lock_get: %s", + strerror(errno); + } + } + cout << "\n"; + cout << "Closing lock region " << held << " locks held\n"; +} + +static void +usage() +{ + cerr << "usage: LockExample [-u] [-h home]\n"; + exit(1); +} diff --git a/mozilla/db/examples_cxx/MpoolExample.cpp b/mozilla/db/examples_cxx/MpoolExample.cpp new file mode 100644 index 00000000000..44c89ec77d2 --- /dev/null +++ b/mozilla/db/examples_cxx/MpoolExample.cpp @@ -0,0 +1,209 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)MpoolExample.cpp 10.7 (Sleepycat) 5/2/98 + */ + +#include "config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#include +#include +#include +#endif + +#include + +#define MPOOL "mpool" + +void init(char *, int, int); +void run(DB_ENV *, int, int, int); + +static void usage(); + +char *progname = "MpoolExample"; // Program name. + +class MpoolExample : public DbEnv +{ +public: + MpoolExample(); + void initdb(const char *home, int cachesize); + void run(int hits, int pagesize, int npages); + +private: + static const char FileName[]; + + // no need for copy and assignment + MpoolExample(const MpoolExample &); + operator = (const MpoolExample &); +}; + +int main(int argc, char *argv[]) +{ + int cachesize = 20 * 1024; + int hits = 1000; + int npages = 50; + int pagesize = 1024; + + for (int i = 1; i < argc; ++i) + { + if (strcmp(argv[i], "-c") == 0) + { + if ((cachesize = atoi(argv[++i])) < 20 * 1024) + usage(); + } + else if (strcmp(argv[i], "-h") == 0) + { + if ((hits = atoi(argv[++i])) <= 0) + usage(); + } + else if (strcmp(argv[i], "-n") == 0) + { + if ((npages = atoi(argv[++i])) <= 0) + usage(); + } + else if (strcmp(argv[i], "-p") == 0) + { + if ((pagesize = atoi(argv[++i])) <= 0) + usage(); + } + else + { + usage(); + } + } + + // Initialize the file. + init(MPOOL, pagesize, npages); + + try { + MpoolExample app; + app.initdb(NULL, cachesize); + app.run(hits, pagesize, npages); + cout << "MpoolExample: completed\n"; + return 0; + } + catch (DbException &dbe) + { + cerr << "MpoolExample: " << dbe.what() << "\n"; + return 1; + } +} + +// +// init -- +// Create a backing file. +// +void +init(char *file, int pagesize, int npages) +{ + // + // Create a file with the right number of pages, and store a page + // number on each page. + // + int fd; + int flags = O_CREAT | O_RDWR | O_TRUNC; +#ifdef WIN32 + flags |= O_BINARY; +#endif + if ((fd = open(file, flags, 0666)) < 0) { + cerr << "MpoolExample: " << file << ": " << strerror(errno) << "\n"; + exit(1); + } + char *p = new char[pagesize]; + memset(p, 0, pagesize); + + // The pages are numbered from 0. + for (int cnt = 0; cnt <= npages; ++cnt) { + *(db_pgno_t *)p = cnt; + if (write(fd, p, pagesize) != pagesize) { + cerr << "MpoolExample: " << file << ": " << strerror(errno) << "\n"; + exit(1); + } + } + delete [] p; +} + +static void +usage() +{ + cerr << "usage: MpoolExample [-c cachesize] " + << "[-h hits] [-n npages] [-p pagesize]\n"; + exit(1); +} + +MpoolExample::MpoolExample() +: DbEnv() // using default constructor means we must call appinit() +{ +} + +void MpoolExample::initdb(const char *home, int cachesize) +{ + set_error_stream(&cerr); + set_errpfx("MpoolExample"); + set_mp_size(cachesize); + + appinit(home, NULL, DB_MPOOL_PRIVATE); +} + + +// +// run -- +// Get a set of pages. +// +void +MpoolExample::run(int hits, int pagesize, int npages) +{ + db_pgno_t pageno; + int cnt; + void *p; + + // Open a memory pool. + DbMpool *dbmp; + DbMpool::open(NULL, DB_CREATE, 0666, this, &dbmp); + + // Open the file in the pool. + DbMpoolFile *dbmfp; + + DbMpoolFile::open(dbmp, MPOOL, 0, 0, pagesize, NULL, &dbmfp); + + // get explicit error returns rather than exceptions so + // we can report more information with each error. + // + set_error_model(DbEnv::ErrorReturn); + + srand((unsigned int)time(NULL)); + for (cnt = 0; cnt < hits; ++cnt) { + pageno = (rand() % npages) + 1; + if ((errno = dbmfp->get(&pageno, 0, &p)) != 0) { + cerr << "MpoolExample: unable to retrieve page " + << (unsigned long)pageno << ": " << strerror(errno) << "\n"; + exit(1); + } + if (*(db_pgno_t *)p != pageno) { + cerr << "MpoolExample: wrong page retrieved (" + << (unsigned long)pageno << " != " << *(int *)p << ")\n"; + exit(1); + } + if ((errno = dbmfp->put(p, 0)) != 0) { + cerr << "MpoolExample: unable to return page " + << (unsigned long)pageno << ": " << strerror(errno) << "\n"; + exit(1); + } + } + + // Close the pool. + if ((errno = dbmp->close()) != 0) { + cerr << "MpoolExample: " << strerror(errno) << "\n"; + exit(1); + } +} diff --git a/mozilla/db/examples_cxx/TpcbExample.cpp b/mozilla/db/examples_cxx/TpcbExample.cpp new file mode 100644 index 00000000000..d2b121bb6f4 --- /dev/null +++ b/mozilla/db/examples_cxx/TpcbExample.cpp @@ -0,0 +1,661 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)TpcbExample.cpp 10.8 (Sleepycat) 4/10/98 + */ + +#include "config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#include +#endif + +#ifdef _WIN32 +#include +#include +#endif + +#include + +typedef enum { ACCOUNT, BRANCH, TELLER } FTYPE; + +void errExit(int err, const char *); // show err as errno and exit + +void invarg(int, char *); +u_int32_t random_id(FTYPE, u_int32_t, u_int32_t, u_int32_t); +u_int32_t random_int(u_int32_t, u_int32_t); +static void usage(void); + +int verbose; +char *progname = "TpcbExample"; // Program name. + +#ifdef _WIN32 +/* Simulation of gettimeofday */ + +struct timeval { + long tv_sec; + long tv_usec; +}; + +struct timezone { + int tz_minuteswest; + int tz_dsttime; +}; + +int gettimeofday(struct timeval *tp, struct timezone *tzp) +{ + struct _timeb tb; + + _ftime(&tb); + if (tp != 0) { + tp->tv_sec = tb.time; + tp->tv_usec = tb.millitm * 1000; + } + if (tzp != 0) { + tzp->tz_minuteswest = tb.timezone; + tzp->tz_dsttime = tb.dstflag; + } + return 0; +} + +#endif + +class TpcbExample : public DbEnv +{ +public: + void populate(int, int, int, int); + void run(int, int, int, int); + int txn(DbTxnMgr *, + Db *, Db *, Db *, Db *, + int, int, int); + void populateHistory(Db *, unsigned int, u_int32_t, + u_int32_t, u_int32_t); + void populateTable(Db *, u_int32_t, u_int32_t, unsigned int, char *); + + // Note: the constructor uses the default DbEnv() constructor, + // which means that appinit() can be called after all options + // have been set in the DbEnv. + // + TpcbExample() : DbEnv() {} + +private: + static const char FileName[]; + + // no need for copy and assignment + TpcbExample(const TpcbExample &); + operator = (const TpcbExample &); +}; + +// +// This program implements a basic TPC/B driver program. To create the +// TPC/B database, run with the -i (init) flag. The number of records +// with which to populate the account, history, branch, and teller tables +// is specified by the a, s, b, and t flags respectively. To run a TPC/B +// test, use the n flag to indicate a number of transactions to run (note +// that you can run many of these processes in parallel to simulate a +// multiuser test run). +// +// XXX Margo, check these ratios and record sizes. +// +#define TELLERS_PER_BRANCH 100 +#define ACCOUNTS_PER_TELLER 1000 + +#define ACCOUNTS 1000000 +#define BRANCHES 10 +#define TELLERS 1000 +#define HISTORY 1000000 +#define HISTORY_LEN 100 +#define RECLEN 100 +#define BEGID 1000000 + +struct Defrec { + u_int32_t id; + u_int32_t balance; + u_int8_t pad[RECLEN - sizeof(u_int32_t) - sizeof(u_int32_t)]; +}; + +struct Histrec { + u_int32_t aid; + u_int32_t bid; + u_int32_t tid; + u_int32_t amount; + u_int8_t pad[RECLEN - 4 * sizeof(u_int32_t)]; +}; + +int +main(int argc, char *argv[]) +{ + unsigned long seed; + int accounts, branches, tellers, history; + int iflag, mpool, ntxns; + char *home, *endarg; + + home = NULL; + accounts = branches = history = tellers = 0; + mpool = ntxns = 0; + verbose = 0; + iflag = 0; + seed = (unsigned long)getpid(); + + for (int i = 1; i < argc; ++i) + { + + if (strcmp(argv[i], "-a") == 0) { + // Number of account records + if ((accounts = atoi(argv[++i])) <= 0) + invarg('a', argv[i]); + } + else if (strcmp(argv[i], "-b") == 0) { + // Number of branch records + if ((branches = atoi(argv[++i])) <= 0) + invarg('b', argv[i]); + } + else if (strcmp(argv[i], "-h") == 0) { + // DB home. + home = argv[++i]; + } + else if (strcmp(argv[i], "-i") == 0) { + // Initialize the test. + iflag = 1; + } + else if (strcmp(argv[i], "-m") == 0) { + // Bytes in buffer pool + if ((mpool = atoi(argv[++i])) <= 0) + invarg('m', argv[i]); + } + else if (strcmp(argv[i], "-n") == 0) { + // Number of transactions + if ((ntxns = atoi(argv[++i])) <= 0) + invarg('n', argv[i]); + } + else if (strcmp(argv[i], "-S") == 0) { + // Random number seed. + seed = strtoul(argv[++i], &endarg, 0); + if (*endarg != '\0') + invarg('S', argv[i]); + } + else if (strcmp(argv[i], "-s") == 0) { + // Number of history records + if ((history = atoi(argv[++i])) <= 0) + invarg('s', argv[i]); + } + else if (strcmp(argv[i], "-t") == 0) { + // Number of teller records + if ((tellers = atoi(argv[++i])) <= 0) + invarg('t', argv[i]); + } + else if (strcmp(argv[i], "-v") == 0) { + // Verbose option. + verbose = 1; + } + else + { + usage(); + } + } + + srand((unsigned int)seed); + + accounts = accounts == 0 ? ACCOUNTS : accounts; + branches = branches == 0 ? BRANCHES : branches; + tellers = tellers == 0 ? TELLERS : tellers; + history = history == 0 ? HISTORY : history; + + if (verbose) + cout << (long)accounts << " Accounts " + << (long)branches << " Branches " + << (long)tellers << " Tellers " + << (long)history << " History\n"; + + // Declaring and setting options does not need + // to be done in a try block, as it will never + // raise an exception. + // + TpcbExample app; + u_int32_t flags = DB_CREATE | DB_INIT_MPOOL; + + app.set_error_stream(&cerr); + app.set_errpfx("TpcbExample"); + + if (mpool == 0) { + mpool = 4 * 1024 * 1024; + } + app.set_mp_size(mpool); + + if (!iflag) { + flags |= DB_INIT_TXN | DB_INIT_LOCK | DB_INIT_LOG; + } + + try { + // Initialize the database environment. + // Must be done in within a try block, unless you + // change the error model in the options. + // + app.appinit(home, NULL, flags); + + if (iflag && ntxns != 0) { + cerr << "specify only one of -i and -n\n"; + exit(1); + } + if (iflag) + app.populate(accounts, branches, history, tellers); + if (ntxns != 0) + app.run(ntxns, accounts, branches, tellers); + + return 0; + } + catch (DbException &dbe) + { + cerr << "TpcbExample: " << dbe.what() << "\n"; + return 1; + } +} + +void +invarg(int arg, char *str) +{ + cerr << "TpcbExample: invalid argument for -" + << (char)arg << ": " << str << "\n"; + exit(1); +} + +static void +usage() +{ + cerr << "usage: TpcbExample " + << "[-iv] [-a accounts] [-b branches] [-h home] [-m mpool_size] " + << "[-n transactions ] [-S seed] [-s history] [-t tellers] \n"; + exit(1); +} + +// +// Initialize the database to the specified number of accounts, branches, +// history records, and tellers. +// +// Note: num_h was unused in the original ex_tpcb.c example. +// +void +TpcbExample::populate(int num_a, int num_b, int num_h, int num_t) +{ + Db *dbp; + + int err; + u_int32_t balance, idnum; + u_int32_t end_anum, end_bnum, end_tnum; + u_int32_t start_anum, start_bnum, start_tnum; + + idnum = BEGID; + balance = 500000; + + DbInfo dbi; + + dbi.set_h_nelem((unsigned int)num_a); + + if ((err = Db::open("account", + DB_HASH, DB_CREATE | DB_TRUNCATE, 0644, this, &dbi, &dbp)) != 0) { + errExit(err, "Open of account file failed"); + } + + start_anum = idnum; + populateTable(dbp, idnum, balance, dbi.get_h_nelem(), "account"); + idnum += dbi.get_h_nelem(); + end_anum = idnum - 1; + if ((err = dbp->close(0)) != 0) { + errExit(err, "Account file close failed"); + } + if (verbose) + cout << "Populated accounts: " + << (long)start_anum << " - " << (long)end_anum << "\n"; + + // + // Since the number of branches is very small, we want to use very + // small pages and only 1 key per page. This is the poor-man's way + // of getting key locking instead of page locking. + // + dbi.set_h_nelem((unsigned int)num_b); + dbi.set_h_ffactor(1); + dbi.set_pagesize(512); + + if ((err = Db::open("branch", + DB_HASH, DB_CREATE | DB_TRUNCATE, 0644, this, &dbi, &dbp)) != 0) { + errExit(err, "Branch file create failed"); + } + start_bnum = idnum; + populateTable(dbp, idnum, balance, dbi.get_h_nelem(), "branch"); + idnum += dbi.get_h_nelem(); + end_bnum = idnum - 1; + if ((err = dbp->close(0)) != 0) { + errExit(err, "Close of branch file failed"); + } + + if (verbose) + cout << "Populated branches: " + << (long)start_bnum << " - " << (long)end_bnum << "\n"; + + // + // In the case of tellers, we also want small pages, but we'll let + // the fill factor dynamically adjust itself. + // + dbi.set_h_nelem((unsigned int)num_t); + dbi.set_h_ffactor(0); + dbi.set_pagesize(512); + + if ((err = Db::open("teller", + DB_HASH, DB_CREATE | DB_TRUNCATE, 0644, this, &dbi, &dbp)) != 0) { + errExit(err, "Teller file create failed"); + } + + start_tnum = idnum; + populateTable(dbp, idnum, balance, dbi.get_h_nelem(), "teller"); + idnum += dbi.get_h_nelem(); + end_tnum = idnum - 1; + if ((err = dbp->close(0)) != 0) { + errExit(err, "Close of teller file failed"); + } + if (verbose) + cout << "Populated tellers: " + << (long)start_tnum << " - " << (long)end_tnum << "\n"; + + // start with a fresh DbInfo + // + DbInfo histDbi; + + histDbi.set_re_len(HISTORY_LEN); + histDbi.set_flags(DB_FIXEDLEN | DB_RENUMBER); + if ((err = Db::open("history", DB_RECNO, DB_CREATE | DB_TRUNCATE, 0644, + this, &histDbi, &dbp)) != 0) { + errExit(err, "Create of history file failed"); + } + + populateHistory(dbp, num_h, num_a, num_b, num_t); + if ((err = dbp->close(0)) != 0) { + errExit(err, "Close of history file failed"); + } +} + +void +TpcbExample::populateTable(Db *dbp, + u_int32_t start_id, u_int32_t balance, + unsigned int nrecs, char *msg) +{ + Defrec drec; + memset(&drec.pad[0], 1, sizeof(drec.pad)); + + Dbt kdbt(&drec.id, sizeof(u_int32_t)); + Dbt ddbt(&drec, sizeof(drec)); + + for (unsigned int i = 0; i < nrecs; i++) { + drec.id = start_id + (u_int32_t)i; + drec.balance = balance; + int err; + if ((err = + dbp->put(NULL, &kdbt, &ddbt, DB_NOOVERWRITE)) != 0) { + cerr << "Failure initializing " << msg << " file: " + << strerror(err) << "\n"; + exit(1); + } + } +} + +void +TpcbExample::populateHistory(Db *dbp, unsigned int nrecs, + u_int32_t anum, u_int32_t bnum, u_int32_t tnum) +{ + Histrec hrec; + memset(&hrec.pad[0], 1, sizeof(hrec.pad)); + hrec.amount = 10; + + u_int32_t i; + Dbt kdbt(&i, sizeof(u_int32_t)); + Dbt ddbt(&hrec, sizeof(hrec)); + + for (i = 1; i <= nrecs; i++) { + hrec.aid = random_id(ACCOUNT, anum, bnum, tnum); + hrec.bid = random_id(BRANCH, anum, bnum, tnum); + hrec.tid = random_id(TELLER, anum, bnum, tnum); + + int err; + if ((err = dbp->put(NULL, &kdbt, &ddbt, DB_NOOVERWRITE)) != 0) { + errExit(err, "Failure initializing history file"); + } + } +} + +u_int32_t +random_int(u_int32_t lo, u_int32_t hi) +{ + u_int32_t ret; + int t; + + t = rand(); + ret = (u_int32_t)(((double)t / ((double)(RAND_MAX) + 1)) * + (hi - lo + 1)); + ret += lo; + return (ret); +} + +u_int32_t +random_id(FTYPE type, u_int32_t accounts, u_int32_t branches, u_int32_t tellers) +{ + u_int32_t min, max, num; + + max = min = BEGID; + num = accounts; + switch(type) { + case TELLER: + min += branches; + num = tellers; + // Fallthrough + case BRANCH: + if (type == BRANCH) + num = branches; + min += accounts; + // Fallthrough + case ACCOUNT: + max = min + num - 1; + } + return (random_int(min, max)); +} + +void +TpcbExample::run(int n, int accounts, int branches, int tellers) +{ + Db *adb, *bdb, *hdb, *tdb; + double gtps, itps; + int failed, ifailed, ret, txns, gus, ius; + struct timeval starttime, curtime, lasttime; + + // + // Open the database files. + // + int err; + if ((err = Db::open("account", DB_UNKNOWN, 0, 0, this, NULL, &adb)) != 0) + errExit(err, "Open of account file failed"); + + if ((err = Db::open("branch", DB_UNKNOWN, 0, 0, this, NULL, &bdb)) != 0) + errExit(err, "Open of branch file failed"); + + if ((err = Db::open("teller", DB_UNKNOWN, 0, 0, this, NULL, &tdb)) != 0) + errExit(err, "Open of teller file failed"); + + if ((err = Db::open("history", DB_UNKNOWN, 0, 0, this, NULL, &hdb)) != 0) + errExit(err, "Open of history file failed"); + + txns = failed = ifailed = 0; + (void)gettimeofday(&starttime, NULL); + lasttime = starttime; + while (n-- >= 0) { + txns++; + DbTxnMgr *txnmgr = get_tx_info(); + ret = txn(txnmgr, adb, bdb, tdb, hdb, accounts, branches, tellers); + if (ret != 0) { + failed++; + ifailed++; + } + if (n % 1000 == 0) { + (void)gettimeofday(&curtime, NULL); + gus = curtime.tv_usec >= starttime.tv_usec ? + curtime.tv_usec - starttime.tv_usec + + 1000000 * (curtime.tv_sec - starttime.tv_sec) : + 1000000 + curtime.tv_usec - starttime.tv_usec + + 1000000 * (curtime.tv_sec - starttime.tv_sec - 1); + ius = curtime.tv_usec >= lasttime.tv_usec ? + curtime.tv_usec - lasttime.tv_usec + + 1000000 * (curtime.tv_sec - lasttime.tv_sec) : + 1000000 + curtime.tv_usec - lasttime.tv_usec + + 1000000 * (curtime.tv_sec - lasttime.tv_sec - 1); + gtps = (double)(txns - failed) / + ((double)gus / 1000000); + itps = (double)(1000 - ifailed) / + ((double)ius / 1000000); + printf("%d txns %d failed ", txns, failed); + printf("%6.2f TPS (gross) %6.2f TPS (interval)\n", + gtps, itps); + lasttime = curtime; + ifailed = 0; + } + } + + (void)adb->close(0); + (void)bdb->close(0); + (void)tdb->close(0); + (void)hdb->close(0); + + cout << (long)txns << " transactions begun " + << (long)failed << " failed\n"; +} + +// +// XXX Figure out the appropriate way to pick out IDs. +// +int +TpcbExample::txn(DbTxnMgr *txmgr, + Db *adb, Db *bdb, Db *tdb, Db *hdb, + int anum, int bnum, int tnum) +{ + Dbc *acurs = NULL; + Dbc *bcurs = NULL; + Dbc *hcurs = NULL; + Dbc *tcurs = NULL; + DbTxn *t = NULL; + + Defrec rec; + Histrec hrec; + int account, branch, teller; + + Dbt d_dbt; + Dbt d_histdbt; + Dbt k_dbt; + Dbt k_histdbt; + + // + // XXX We could move a lot of this into the driver to make this + // faster. + // + account = random_id(ACCOUNT, anum, bnum, tnum); + branch = random_id(BRANCH, anum, bnum, tnum); + teller = random_id(TELLER, anum, bnum, tnum); + + k_dbt.set_size(sizeof(int)); + + d_dbt.set_flags(DB_DBT_USERMEM); + d_dbt.set_data(&rec); + d_dbt.set_ulen(sizeof(rec)); + + hrec.aid = account; + hrec.bid = branch; + hrec.tid = teller; + hrec.amount = 10; + // Request 0 bytes since we're just positioning. + d_histdbt.set_flags(DB_DBT_PARTIAL); + + // START TIMING + if (txmgr->begin(NULL, &t) != 0) + goto err; + + if (adb->cursor(t, &acurs) != 0 || + bdb->cursor(t, &bcurs) != 0 || + tdb->cursor(t, &tcurs) != 0 || + hdb->cursor(t, &hcurs) != 0) + goto err; + + // Account record + k_dbt.set_data(&account); + if (acurs->get(&k_dbt, &d_dbt, DB_SET) != 0) + goto err; + rec.balance += 10; + if (acurs->put(&k_dbt, &d_dbt, DB_CURRENT) != 0) + goto err; + + // Branch record + k_dbt.set_data(&branch); + if (bcurs->get(&k_dbt, &d_dbt, DB_SET) != 0) + goto err; + rec.balance += 10; + if (bcurs->put(&k_dbt, &d_dbt, DB_CURRENT) != 0) + goto err; + + // Teller record + k_dbt.set_data(&teller); + if (tcurs->get(&k_dbt, &d_dbt, DB_SET) != 0) + goto err; + rec.balance += 10; + if (tcurs->put(&k_dbt, &d_dbt, DB_CURRENT) != 0) + goto err; + + // History record + if (hcurs->get(&k_histdbt, &d_histdbt, DB_LAST) != 0) + goto err; + d_histdbt.set_flags(0); + d_histdbt.set_data(&hrec); + d_histdbt.set_ulen(sizeof(hrec)); + if (hcurs->put(&k_histdbt, &d_histdbt, DB_AFTER) != 0) + goto err; + + if (acurs->close() != 0 || bcurs->close() != 0 || + tcurs->close() != 0 || hcurs->close() != 0) + goto err; + + if (t->commit() != 0) + goto err; + + // END TIMING + return (0); + + err: + if (acurs != NULL) + (void)acurs->close(); + if (bcurs != NULL) + (void)bcurs->close(); + if (tcurs != NULL) + (void)tcurs->close(); + if (hcurs != NULL) + (void)hcurs->close(); + if (t != NULL) + (void)t->abort(); + + if (verbose) + cout << "Transaction A=" << (long)account + << " B=" << (long)branch + << " T=" << (long)teller << " failed\n"; + return (-1); +} + +void errExit(int err, const char *s) +{ + cerr << progname << ": "; + if (s != NULL) { + cerr << s << ": "; + } + cerr << strerror(err) << "\n"; + exit(1); +} diff --git a/mozilla/db/hash/hash.c b/mozilla/db/hash/hash.c new file mode 100644 index 00000000000..5e0660b727b --- /dev/null +++ b/mozilla/db/hash/hash.c @@ -0,0 +1,1479 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * 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. 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)hash.c 10.45 (Sleepycat) 5/11/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_page.h" +#include "db_am.h" +#include "db_ext.h" +#include "hash.h" +#include "log.h" + +static int __ham_c_close __P((DBC *)); +static int __ham_c_del __P((DBC *, u_int32_t)); +static int __ham_c_get __P((DBC *, DBT *, DBT *, u_int32_t)); +static int __ham_c_put __P((DBC *, DBT *, DBT *, u_int32_t)); +static int __ham_c_init __P((DB *, DB_TXN *, DBC **)); +static int __ham_cursor __P((DB *, DB_TXN *, DBC **)); +static int __ham_delete __P((DB *, DB_TXN *, DBT *, u_int32_t)); +static int __ham_dup_return __P((HTAB *, HASH_CURSOR *, DBT *, u_int32_t)); +static int __ham_get __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); +static void __ham_init_htab __P((HTAB *, u_int32_t, u_int32_t)); +static int __ham_lookup __P((HTAB *, + HASH_CURSOR *, const DBT *, u_int32_t, db_lockmode_t)); +static int __ham_overwrite __P((HTAB *, HASH_CURSOR *, DBT *)); +static int __ham_put __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); +static int __ham_sync __P((DB *, u_int32_t)); + +/************************** INTERFACE ROUTINES ***************************/ +/* OPEN/CLOSE */ + +/* + * __ham_open -- + * + * PUBLIC: int __ham_open __P((DB *, DB_INFO *)); + */ +int +__ham_open(dbp, dbinfo) + DB *dbp; + DB_INFO *dbinfo; +{ + DB_ENV *dbenv; + DBC *curs; + HTAB *hashp; + int file_existed, ret; + + dbenv = dbp->dbenv; + + if ((hashp = (HTAB *)__db_calloc(1, sizeof(HTAB))) == NULL) + return (ENOMEM); + hashp->dbp = dbp; + + /* Set the hash function if specified by the user. */ + if (dbinfo != NULL && dbinfo->h_hash != NULL) + hashp->hash = dbinfo->h_hash; + + /* + * Initialize the remaining fields of the dbp. The type, close and + * fd functions are all set in db_open. + */ + dbp->internal = hashp; + dbp->cursor = __ham_cursor; + dbp->del = __ham_delete; + dbp->get = __ham_get; + dbp->put = __ham_put; + dbp->sync = __ham_sync; + + /* If locking is turned on, lock the meta data page. */ + if (F_ISSET(dbp, DB_AM_LOCKING)) { + dbp->lock.pgno = BUCKET_INVALID; + if ((ret = lock_get(dbenv->lk_info, dbp->locker, + 0, &dbp->lock_dbt, DB_LOCK_READ, &hashp->hlock)) != 0) { + if (ret < 0) + ret = EAGAIN; + goto out; + } + } + + /* + * Now, we can try to read the meta-data page and figure out + * if we set up locking and get the meta-data page properly. + * If this is a new file, initialize it, and put it back dirty. + */ + if ((ret = __ham_get_page(hashp->dbp, 0, (PAGE **)&hashp->hdr)) != 0) + goto out; + + /* Initialize the hashp structure */ + if (hashp->hdr->magic == DB_HASHMAGIC) { + file_existed = 1; + /* File exists, verify the data in the header. */ + if (hashp->hash == NULL) + hashp->hash = + hashp->hdr->version < 5 ? __ham_func4 : __ham_func5; + if (hashp->hash(CHARKEY, sizeof(CHARKEY)) != + hashp->hdr->h_charkey) { + __db_err(hashp->dbp->dbenv, + "hash: incompatible hash function"); + ret = EINVAL; + goto out; + } + if (F_ISSET(hashp->hdr, DB_HASH_DUP)) + F_SET(dbp, DB_AM_DUP); + } else { + /* + * File does not exist, we must initialize the header. If + * locking is enabled that means getting a write lock first. + */ + file_existed = 0; + if (F_ISSET(dbp, DB_AM_LOCKING) && + ((ret = lock_put(dbenv->lk_info, hashp->hlock)) != 0 || + (ret = lock_get(dbenv->lk_info, dbp->locker, 0, + &dbp->lock_dbt, DB_LOCK_WRITE, &hashp->hlock)) != 0)) { + if (ret < 0) + ret = EAGAIN; + goto out; + } + + __ham_init_htab(hashp, + dbinfo != NULL ? dbinfo->h_nelem : 0, + dbinfo != NULL ? dbinfo->h_ffactor : 0); + if (F_ISSET(dbp, DB_AM_DUP)) + F_SET(hashp->hdr, DB_HASH_DUP); + if ((ret = __ham_dirty_page(hashp, (PAGE *)hashp->hdr)) != 0) + goto out; + } + + /* Initialize the default cursor. */ + __ham_c_init(dbp, NULL, &curs); + TAILQ_INSERT_TAIL(&dbp->curs_queue, curs, links); + + /* Allocate memory for our split buffer. */ + if ((hashp->split_buf = (PAGE *)__db_malloc(dbp->pgsize)) == NULL) { + ret = ENOMEM; + goto out; + } + +#ifdef NO_STATISTICS_FOR_DB_ERR + __db_err(dbp->dbenv, + "%s%lx\n%s%ld\n%s%ld\n%s%ld\n%s%ld\n%s0x%lx\n%s0x%lx\n%s%ld\n%s%ld\n%s0x%lx", + "TABLE POINTER ", (long)hashp, + "BUCKET SIZE ", (long)hashp->hdr->pagesize, + "FILL FACTOR ", (long)hashp->hdr->ffactor, + "MAX BUCKET ", (long)hashp->hdr->max_bucket, + "OVFL POINT ", (long)hashp->hdr->ovfl_point, + "LAST FREED ", (long)hashp->hdr->last_freed, + "HIGH MASK ", (long)hashp->hdr->high_mask, + "LOW MASK ", (long)hashp->hdr->low_mask, + "NELEM ", (long)hashp->hdr->nelem, + "FLAGS ", (long)hashp->hdr->flags); +#endif + + /* Release the meta data page */ + (void)__ham_put_page(hashp->dbp, (PAGE *)hashp->hdr, 0); + if (F_ISSET(dbp, DB_AM_LOCKING) && + (ret = lock_put(dbenv->lk_info, hashp->hlock)) != 0) { + if (ret < 0) + ret = EAGAIN; + goto out; + } + + hashp->hlock = 0; + hashp->hdr = NULL; + /* Sync the file so that we know that the meta data goes to disk. */ + if (!file_existed && (ret = dbp->sync(dbp, 0)) != 0) + goto out; + return (0); + +out: (void)__ham_close(dbp); + return (ret); +} + +/* + * PUBLIC: int __ham_close __P((DB *)); + */ +int +__ham_close(dbp) + DB *dbp; +{ + HTAB *hashp; + int ret, t_ret; + + DEBUG_LWRITE(dbp, NULL, "ham_close", NULL, NULL, 0); + hashp = (HTAB *)dbp->internal; + ret = 0; + + /* Free the split page. */ + if (hashp->split_buf) + FREE(hashp->split_buf, dbp->pgsize); + + if (hashp->hdr && (t_ret = __ham_put_page(hashp->dbp, + (PAGE *)hashp->hdr, 0)) != 0 && ret == 0) + ret = t_ret; + if (hashp->hlock && (t_ret = lock_put(hashp->dbp->dbenv->lk_info, + hashp->hlock)) != 0 && ret == 0) + ret = t_ret; + + FREE(hashp, sizeof(HTAB)); + dbp->internal = NULL; + return (ret); +} + +/************************** LOCAL CREATION ROUTINES **********************/ +/* + * Returns 0 on No Error + */ +static void +__ham_init_htab(hashp, nelem, ffactor) + HTAB *hashp; + u_int32_t nelem, ffactor; +{ + int32_t l2, nbuckets; + + memset(hashp->hdr, 0, sizeof(HASHHDR)); + hashp->hdr->ffactor = ffactor; + hashp->hdr->pagesize = hashp->dbp->pgsize; + ZERO_LSN(hashp->hdr->lsn); + hashp->hdr->magic = DB_HASHMAGIC; + hashp->hdr->version = DB_HASHVERSION; + if (hashp->hash == NULL) + hashp->hash = + hashp->hdr->version < 5 ? __ham_func4 : __ham_func5; + hashp->hdr->h_charkey = hashp->hash(CHARKEY, sizeof(CHARKEY)); + if (nelem != 0 && hashp->hdr->ffactor != 0) { + nelem = (nelem - 1) / hashp->hdr->ffactor + 1; + l2 = __db_log2(nelem > 2 ? nelem : 2); + } else + l2 = 2; + + nbuckets = 1 << l2; + + hashp->hdr->ovfl_point = l2; + hashp->hdr->last_freed = PGNO_INVALID; + + hashp->hdr->max_bucket = hashp->hdr->high_mask = nbuckets - 1; + hashp->hdr->low_mask = (nbuckets >> 1) - 1; + memcpy(hashp->hdr->uid, hashp->dbp->lock.fileid, DB_FILE_ID_LEN); +} + +/********************** DESTROY/CLOSE ROUTINES ************************/ + + +/* + * Write modified pages to disk + * + * Returns: + * 0 == OK + * -1 ERROR + */ +static int +__ham_sync(dbp, flags) + DB *dbp; + u_int32_t flags; +{ + int ret; + + DEBUG_LWRITE(dbp, NULL, "ham_sync", NULL, NULL, flags); + if ((ret = __db_syncchk(dbp, flags)) != 0) + return (ret); + if (F_ISSET(dbp, DB_AM_RDONLY)) + return (0); + + if ((ret = memp_fsync(dbp->mpf)) == DB_INCOMPLETE) + ret = 0; + + return (ret); +} + +/*******************************SEARCH ROUTINES *****************************/ +/* + * All the access routines return + * + * Returns: + * 0 on SUCCESS + * 1 to indicate an external ERROR (i.e. key not found, etc) + * -1 to indicate an internal ERROR (i.e. out of memory, etc) + */ + +static int +__ham_get(dbp, txn, key, data, flags) + DB *dbp; + DB_TXN *txn; + DBT *key; + DBT *data; + u_int32_t flags; +{ + DB *ldbp; + HTAB *hashp; + HASH_CURSOR *hcp; + int ret, t_ret; + + DEBUG_LREAD(dbp, txn, "ham_get", key, NULL, flags); + if ((ret = __db_getchk(dbp, key, data, flags)) != 0) + return (ret); + + ldbp = dbp; + if (F_ISSET(dbp, DB_AM_THREAD) && + (ret = __db_gethandle(dbp, __ham_hdup, &ldbp)) != 0) + return (ret); + + hashp = (HTAB *)ldbp->internal; + SET_LOCKER(ldbp, txn); + GET_META(ldbp, hashp); + + hashp->hash_accesses++; + hcp = (HASH_CURSOR *)TAILQ_FIRST(&ldbp->curs_queue)->internal; + if ((ret = __ham_lookup(hashp, hcp, key, 0, DB_LOCK_READ)) == 0) + if (F_ISSET(hcp, H_OK)) + ret = __ham_dup_return(hashp, hcp, data, DB_FIRST); + else /* Key was not found */ + ret = DB_NOTFOUND; + + if ((t_ret = __ham_item_done(hashp, hcp, 0)) != 0 && ret == 0) + ret = t_ret; + RELEASE_META(ldbp, hashp); + if (F_ISSET(dbp, DB_AM_THREAD)) + __db_puthandle(ldbp); + return (ret); +} + +static int +__ham_put(dbp, txn, key, data, flags) + DB *dbp; + DB_TXN *txn; + DBT *key; + DBT *data; + u_int32_t flags; +{ + DB *ldbp; + DBT tmp_val, *myval; + HASH_CURSOR *hcp; + HTAB *hashp; + u_int32_t nbytes; + int ret, t_ret; + + DEBUG_LWRITE(dbp, txn, "ham_put", key, data, flags); + if ((ret = __db_putchk(dbp, key, data, + flags, F_ISSET(dbp, DB_AM_RDONLY), F_ISSET(dbp, DB_AM_DUP))) != 0) + return (ret); + + ldbp = dbp; + if (F_ISSET(dbp, DB_AM_THREAD) && + (ret = __db_gethandle(dbp, __ham_hdup, &ldbp)) != 0) + return (ret); + + hashp = (HTAB *)ldbp->internal; + SET_LOCKER(ldbp, txn); + GET_META(ldbp, hashp); + hcp = TAILQ_FIRST(&ldbp->curs_queue)->internal; + + nbytes = (ISBIG(hashp, key->size) ? HOFFPAGE_PSIZE : + HKEYDATA_PSIZE(key->size)) + + (ISBIG(hashp, data->size) ? HOFFPAGE_PSIZE : + HKEYDATA_PSIZE(data->size)); + + hashp->hash_accesses++; + ret = __ham_lookup(hashp, hcp, key, nbytes, DB_LOCK_WRITE); + + if (ret == DB_NOTFOUND) { + ret = 0; + if (hcp->seek_found_page != PGNO_INVALID && + hcp->seek_found_page != hcp->pgno) { + if ((ret = __ham_item_done(hashp, hcp, 0)) != 0) + goto out; + hcp->pgno = hcp->seek_found_page; + hcp->bndx = NDX_INVALID; + } + + if (F_ISSET(data, DB_DBT_PARTIAL) && data->doff != 0) { + /* + * Doing a partial put, but the key does not exist + * and we are not beginning the write at 0. We + * must create a data item padded up to doff and + * then write the new bytes represented by val. + */ + ret = __ham_init_dbt(&tmp_val, data->size + data->doff, + &hcp->big_data, &hcp->big_datalen); + if (ret == 0) { + memset(tmp_val.data, 0, data->doff); + memcpy((u_int8_t *)tmp_val.data + data->doff, + data->data, data->size); + myval = &tmp_val; + } + } else + myval = (DBT *)data; + + if (ret == 0) + ret = __ham_add_el(hashp, hcp, key, myval, H_KEYDATA); + } else if (ret == 0 && F_ISSET(hcp, H_OK)) { + if (flags == DB_NOOVERWRITE) + ret = DB_KEYEXIST; + else if (F_ISSET(ldbp, DB_AM_DUP)) + ret = __ham_add_dup(hashp, hcp, data, DB_KEYLAST); + else + ret = __ham_overwrite(hashp, hcp, data); + } + + /* Free up all the cursor pages. */ + if ((t_ret = __ham_item_done(hashp, hcp, ret == 0)) != 0 && ret == 0) + ret = t_ret; + /* Now check if we have to grow. */ +out: if (ret == 0 && F_ISSET(hcp, H_EXPAND)) { + ret = __ham_expand_table(hashp); + F_CLR(hcp, H_EXPAND); + } + + if ((t_ret = __ham_item_done(hashp, hcp, ret == 0)) != 0 && ret == 0) + ret = t_ret; + RELEASE_META(ldbp, hashp); + if (F_ISSET(dbp, DB_AM_THREAD)) + __db_puthandle(ldbp); + return (ret); +} + +static int +__ham_cursor(dbp, txnid, dbcp) + DB *dbp; + DB_TXN *txnid; + DBC **dbcp; +{ + int ret; + + DEBUG_LWRITE(dbp, txnid, "ham_cursor", NULL, NULL, 0); + if ((ret = __ham_c_init(dbp, txnid, dbcp)) != 0) + return (ret); + + DB_THREAD_LOCK(dbp); + TAILQ_INSERT_TAIL(&dbp->curs_queue, *dbcp, links); + DB_THREAD_UNLOCK(dbp); + return (ret); +} + +static int +__ham_c_init(dbp, txnid, dbcp) + DB *dbp; + DB_TXN *txnid; + DBC **dbcp; +{ + DBC *db_curs; + HASH_CURSOR *new_curs; + + if ((db_curs = (DBC *)__db_calloc(sizeof(DBC), 1)) == NULL) + return (ENOMEM); + + if ((new_curs = + (HASH_CURSOR *)__db_calloc(sizeof(struct cursor_t), 1)) == NULL) { + FREE(db_curs, sizeof(DBC)); + return (ENOMEM); + } + + db_curs->internal = new_curs; + db_curs->c_close = __ham_c_close; + db_curs->c_del = __ham_c_del; + db_curs->c_get = __ham_c_get; + db_curs->c_put = __ham_c_put; + db_curs->txn = txnid; + db_curs->dbp = dbp; + + new_curs->db_cursor = db_curs; + __ham_item_init(new_curs); + + if (dbcp != NULL) + *dbcp = db_curs; + return (0); +} + +static int +__ham_delete(dbp, txn, key, flags) + DB *dbp; + DB_TXN *txn; + DBT *key; + u_int32_t flags; +{ + DB *ldbp; + HTAB *hashp; + HASH_CURSOR *hcp; + int ret, t_ret; + + DEBUG_LWRITE(dbp, txn, "ham_delete", key, NULL, flags); + if ((ret = + __db_delchk(dbp, key, flags, F_ISSET(dbp, DB_AM_RDONLY))) != 0) + return (ret); + + ldbp = dbp; + if (F_ISSET(dbp, DB_AM_THREAD) && + (ret = __db_gethandle(dbp, __ham_hdup, &ldbp)) != 0) + return (ret); + hashp = (HTAB *)ldbp->internal; + SET_LOCKER(ldbp, txn); + GET_META(ldbp, hashp); + hcp = TAILQ_FIRST(&ldbp->curs_queue)->internal; + + hashp->hash_accesses++; + if ((ret = __ham_lookup(hashp, hcp, key, 0, DB_LOCK_WRITE)) == 0) + if (F_ISSET(hcp, H_OK)) + ret = __ham_del_pair(hashp, hcp, 1); + else + ret = DB_NOTFOUND; + + if ((t_ret = __ham_item_done(hashp, hcp, ret == 0)) != 0 && ret == 0) + ret = t_ret; + RELEASE_META(ldbp, hashp); + if (F_ISSET(dbp, DB_AM_THREAD)) + __db_puthandle(ldbp); + return (ret); +} + +/* ****************** CURSORS ********************************** */ +static int +__ham_c_close(cursor) + DBC *cursor; +{ + DB *ldbp; + int ret; + + DEBUG_LWRITE(cursor->dbp, cursor->txn, "ham_c_close", NULL, NULL, 0); + /* + * If the pagep, dpagep, and lock fields of the cursor are all NULL, + * then there really isn't a need to get a handle here. However, + * the normal case is that at least one of those fields is non-NULL, + * and putting those checks in here would couple the ham_item_done + * functionality with cursor close which would be pretty disgusting. + * Instead, we pay the overhead here of always getting the handle. + */ + ldbp = cursor->dbp; + if (F_ISSET(cursor->dbp, DB_AM_THREAD) && + (ret = __db_gethandle(cursor->dbp, __ham_hdup, &ldbp)) != 0) + return (ret); + + ret = __ham_c_iclose(ldbp, cursor); + + if (F_ISSET(ldbp, DB_AM_THREAD)) + __db_puthandle(ldbp); + return (ret); +} +/* + * __ham_c_iclose -- + * + * Internal cursor close routine; assumes it is being passed the correct + * handle, rather than getting and putting a handle. + * + * PUBLIC: int __ham_c_iclose __P((DB *, DBC *)); + */ +int +__ham_c_iclose(dbp, dbc) + DB *dbp; + DBC *dbc; +{ + HASH_CURSOR *hcp; + HTAB *hashp; + int ret; + + hashp = (HTAB *)dbp->internal; + hcp = (HASH_CURSOR *)dbc->internal; + ret = __ham_item_done(hashp, hcp, 0); + + if (hcp->big_key) + FREE(hcp->big_key, hcp->big_keylen); + if (hcp->big_data) + FREE(hcp->big_data, hcp->big_datalen); + + /* + * All cursors (except the default ones) are linked off the master. + * Therefore, when we close the cursor, we have to remove it from + * the master, not the local one. + * XXX I am always removing from the master; what about local cursors? + */ + DB_THREAD_LOCK(dbc->dbp); + TAILQ_REMOVE(&dbc->dbp->curs_queue, dbc, links); + DB_THREAD_UNLOCK(dbc->dbp); + + FREE(hcp, sizeof(HASH_CURSOR)); + FREE(dbc, sizeof(DBC)); + + return (ret); +} + +static int +__ham_c_del(cursor, flags) + DBC *cursor; + u_int32_t flags; +{ + DB *ldbp; + HASH_CURSOR *hcp; + HASH_CURSOR save_curs; + HTAB *hashp; + db_pgno_t ppgno, chg_pgno; + int ret, t_ret; + + DEBUG_LWRITE(cursor->dbp, cursor->txn, "ham_c_del", NULL, NULL, flags); + ldbp = cursor->dbp; + if (F_ISSET(cursor->dbp, DB_AM_THREAD) && + (ret = __db_gethandle(cursor->dbp, __ham_hdup, &ldbp)) != 0) + return (ret); + hashp = (HTAB *)ldbp->internal; + hcp = (HASH_CURSOR *)cursor->internal; + save_curs = *hcp; + if ((ret = __db_cdelchk(ldbp, flags, + F_ISSET(ldbp, DB_AM_RDONLY), IS_VALID(hcp))) != 0) + return (ret); + if (F_ISSET(hcp, H_DELETED)) + return (DB_NOTFOUND); + + SET_LOCKER(hashp->dbp, cursor->txn); + GET_META(hashp->dbp, hashp); + hashp->hash_accesses++; + if ((ret = __ham_get_cpage(hashp, hcp, DB_LOCK_WRITE)) != 0) + goto out; + if (F_ISSET(hcp, H_ISDUP) && hcp->dpgno != PGNO_INVALID) { + /* + * We are about to remove a duplicate from offpage. + * + * There are 4 cases. + * 1. We will remove an item on a page, but there are more + * items on that page. + * 2. We will remove the last item on a page, but there is a + * following page of duplicates. + * 3. We will remove the last item on a page, this page was the + * last page in a duplicate set, but there were dups before + * it. + * 4. We will remove the last item on a page, removing the last + * duplicate. + * In case 1 hcp->dpagep is unchanged. + * In case 2 hcp->dpagep comes back pointing to the next dup + * page. + * In case 3 hcp->dpagep comes back NULL. + * In case 4 hcp->dpagep comes back NULL. + * + * Case 4 results in deleting the pair off the master page. + * The normal code for doing this knows how to delete the + * duplicates, so we will handle this case in the normal code. + */ + ppgno = PREV_PGNO(hcp->dpagep); + if (ppgno == PGNO_INVALID && + NEXT_PGNO(hcp->dpagep) == PGNO_INVALID && + NUM_ENT(hcp->dpagep) == 1) + goto normal; + + /* Remove item from duplicate page. */ + chg_pgno = hcp->dpgno; + if ((ret = __db_drem(hashp->dbp, + &hcp->dpagep, hcp->dndx, __ham_del_page)) != 0) + goto out; + + if (hcp->dpagep == NULL) { + if (ppgno != PGNO_INVALID) { /* Case 3 */ + hcp->dpgno = ppgno; + if ((ret = __ham_get_cpage(hashp, hcp, + DB_LOCK_READ)) != 0) + goto out; + hcp->dndx = NUM_ENT(hcp->dpagep); + F_SET(hcp, H_DELETED); + } else { /* Case 4 */ + ret = __ham_del_pair(hashp, hcp, 1); + hcp->dpgno = PGNO_INVALID; + /* + * Delpair updated the cursor queue, so we + * don't have to do that here. + */ + chg_pgno = PGNO_INVALID; + } + } else if (PGNO(hcp->dpagep) != hcp->dpgno) { + hcp->dndx = 0; /* Case 2 */ + hcp->dpgno = PGNO(hcp->dpagep); + if (ppgno == PGNO_INVALID) + memcpy(HOFFDUP_PGNO(P_ENTRY(hcp->pagep, + H_DATAINDEX(hcp->bndx))), + &hcp->dpgno, sizeof(db_pgno_t)); + F_SET(hcp, H_DELETED); + } else /* Case 1 */ + F_SET(hcp, H_DELETED); + if (chg_pgno != PGNO_INVALID) + __ham_c_update(hcp, chg_pgno, 0, 0, 1); + } else if (F_ISSET(hcp, H_ISDUP)) { /* on page */ + if (hcp->dup_off == 0 && DUP_SIZE(hcp->dup_len) == + LEN_HDATA(hcp->pagep, hashp->hdr->pagesize, hcp->bndx)) + ret = __ham_del_pair(hashp, hcp, 1); + else { + DBT repldbt; + + repldbt.flags = 0; + F_SET(&repldbt, DB_DBT_PARTIAL); + repldbt.doff = hcp->dup_off; + repldbt.dlen = DUP_SIZE(hcp->dup_len); + repldbt.size = 0; + ret = __ham_replpair(hashp, hcp, &repldbt, 0); + hcp->dup_tlen -= DUP_SIZE(hcp->dup_len); + F_SET(hcp, H_DELETED); + __ham_c_update(hcp, hcp->pgno, + DUP_SIZE(hcp->dup_len), 0, 1); + } + + } else + /* Not a duplicate */ +normal: ret = __ham_del_pair(hashp, hcp, 1); + +out: if ((t_ret = __ham_item_done(hashp, hcp, ret == 0)) != 0 && ret == 0) + ret = t_ret; + if (ret != 0) + *hcp = save_curs; + RELEASE_META(hashp->dbp, hashp); + if (F_ISSET(cursor->dbp, DB_AM_THREAD)) + __db_puthandle(ldbp); + return (ret); +} + +static int +__ham_c_get(cursor, key, data, flags) + DBC *cursor; + DBT *key; + DBT *data; + u_int32_t flags; +{ + DB *ldbp; + HTAB *hashp; + HASH_CURSOR *hcp, save_curs; + int get_key, ret, t_ret; + + DEBUG_LREAD(cursor->dbp, cursor->txn, "ham_c_get", + flags == DB_SET || flags == DB_SET_RANGE ? key : NULL, + NULL, flags); + ldbp = cursor->dbp; + if (F_ISSET(cursor->dbp, DB_AM_THREAD) && + (ret = __db_gethandle(cursor->dbp, __ham_hdup, &ldbp)) != 0) + return (ret); + hashp = (HTAB *)(ldbp->internal); + hcp = (HASH_CURSOR *)cursor->internal; + save_curs = *hcp; + if ((ret = + __db_cgetchk(hashp->dbp, key, data, flags, IS_VALID(hcp))) != 0) + return (ret); + + SET_LOCKER(hashp->dbp, cursor->txn); + GET_META(hashp->dbp, hashp); + hashp->hash_accesses++; + + hcp->seek_size = 0; + + ret = 0; + get_key = 1; + switch (flags) { + case DB_PREV: + if (hcp->bucket != BUCKET_INVALID) { + ret = __ham_item_prev(hashp, hcp, DB_LOCK_READ); + break; + } + /* FALLTHROUGH */ + case DB_LAST: + ret = __ham_item_last(hashp, hcp, DB_LOCK_READ); + break; + case DB_FIRST: + ret = __ham_item_first(hashp, hcp, DB_LOCK_READ); + break; + case DB_NEXT: + if (hcp->bucket == BUCKET_INVALID) + hcp->bucket = 0; + ret = __ham_item_next(hashp, hcp, DB_LOCK_READ); + break; + case DB_SET: + case DB_SET_RANGE: + ret = __ham_lookup(hashp, hcp, key, 0, DB_LOCK_READ); + get_key = 0; + break; + case DB_CURRENT: + if (F_ISSET(hcp, H_DELETED)) { + ret = DB_KEYEMPTY; + goto out; + } + + ret = __ham_item(hashp, hcp, DB_LOCK_READ); + break; + } + + /* + * Must always enter this loop to do error handling and + * check for big key/data pair. + */ + while (1) { + if (ret != 0 && ret != DB_NOTFOUND) + goto out1; + else if (F_ISSET(hcp, H_OK)) { + /* Get the key. */ + if (get_key && (ret = __db_ret(hashp->dbp, hcp->pagep, + H_KEYINDEX(hcp->bndx), key, &hcp->big_key, + &hcp->big_keylen)) != 0) + goto out1; + + ret = __ham_dup_return(hashp, hcp, data, flags); + break; + } else if (!F_ISSET(hcp, H_NOMORE)) { + abort(); + break; + } + + /* + * Ran out of entries in a bucket; change buckets. + */ + switch (flags) { + case DB_LAST: + case DB_PREV: + ret = __ham_item_done(hashp, hcp, 0); + if (hcp->bucket == 0) { + ret = DB_NOTFOUND; + goto out1; + } + hcp->bucket--; + hcp->bndx = NDX_INVALID; + if (ret == 0) + ret = __ham_item_prev(hashp, + hcp, DB_LOCK_READ); + break; + case DB_FIRST: + case DB_NEXT: + ret = __ham_item_done(hashp, hcp, 0); + hcp->bndx = NDX_INVALID; + hcp->bucket++; + hcp->pgno = PGNO_INVALID; + hcp->pagep = NULL; + if (hcp->bucket > hashp->hdr->max_bucket) { + ret = DB_NOTFOUND; + goto out1; + } + if (ret == 0) + ret = __ham_item_next(hashp, + hcp, DB_LOCK_READ); + break; + case DB_SET: + case DB_SET_RANGE: + /* Key not found. */ + ret = DB_NOTFOUND; + goto out1; + } + } +out1: if ((t_ret = __ham_item_done(hashp, hcp, 0)) != 0 && ret == 0) + ret = t_ret; +out: if (ret) + *hcp = save_curs; + RELEASE_META(hashp->dbp, hashp); + if (F_ISSET(cursor->dbp, DB_AM_THREAD)) + __db_puthandle(ldbp); + return (ret); +} + +static int +__ham_c_put(cursor, key, data, flags) + DBC *cursor; + DBT *key; + DBT *data; + u_int32_t flags; +{ + DB *ldbp; + HASH_CURSOR *hcp, save_curs; + HTAB *hashp; + u_int32_t nbytes; + int ret, t_ret; + + DEBUG_LWRITE(cursor->dbp, cursor->txn, "ham_c_put", + flags == DB_KEYFIRST || flags == DB_KEYLAST ? key : NULL, + data, flags); + ldbp = cursor->dbp; + if (F_ISSET(cursor->dbp, DB_AM_THREAD) && + (ret = __db_gethandle(cursor->dbp, __ham_hdup, &ldbp)) != 0) + return (ret); + hashp = (HTAB *)(ldbp->internal); + hcp = (HASH_CURSOR *)cursor->internal; + save_curs = *hcp; + + if ((ret = __db_cputchk(hashp->dbp, key, data, flags, + F_ISSET(ldbp, DB_AM_RDONLY), IS_VALID(hcp))) != 0) + return (ret); + if (F_ISSET(hcp, H_DELETED)) + return (DB_NOTFOUND); + + SET_LOCKER(hashp->dbp, cursor->txn); + GET_META(hashp->dbp, hashp); + ret = 0; + + switch (flags) { + case DB_KEYLAST: + case DB_KEYFIRST: + nbytes = (ISBIG(hashp, key->size) ? HOFFPAGE_PSIZE : + HKEYDATA_PSIZE(key->size)) + + (ISBIG(hashp, data->size) ? HOFFPAGE_PSIZE : + HKEYDATA_PSIZE(data->size)); + ret = __ham_lookup(hashp, hcp, key, nbytes, DB_LOCK_WRITE); + break; + case DB_BEFORE: + case DB_AFTER: + case DB_CURRENT: + ret = __ham_item(hashp, hcp, DB_LOCK_WRITE); + break; + } + + if (ret == 0) { + if (flags == DB_CURRENT && !F_ISSET(ldbp, DB_AM_DUP)) + ret = __ham_overwrite(hashp, hcp, data); + else + ret = __ham_add_dup(hashp, hcp, data, flags); + } + + if (ret == 0 && F_ISSET(hcp, H_EXPAND)) { + ret = __ham_expand_table(hashp); + F_CLR(hcp, H_EXPAND); + } + + if ((t_ret = __ham_item_done(hashp, hcp, ret == 0)) != 0 && ret == 0) + ret = t_ret; + if (ret != 0) + *hcp = save_curs; + RELEASE_META(hashp->dbp, hashp); + if (F_ISSET(cursor->dbp, DB_AM_THREAD)) + __db_puthandle(ldbp); + return (ret); +} + +/********************************* UTILITIES ************************/ + +/* + * __ham_expand_table -- + * + * PUBLIC: int __ham_expand_table __P((HTAB *)); + */ +int +__ham_expand_table(hashp) + HTAB *hashp; +{ + DB_LSN new_lsn; + u_int32_t old_bucket, new_bucket, spare_ndx; + int ret; + + ret = 0; + DIRTY_META(hashp, ret); + if (ret) + return (ret); + + /* + * If the split point is about to increase, make sure that we + * have enough extra pages. The calculation here is weird. + * We'd like to do this after we've upped max_bucket, but it's + * too late then because we've logged the meta-data split. What + * we'll do between then and now is increment max bucket and then + * see what the log of one greater than that is; here we have to + * look at the log of max + 2. VERY NASTY STUFF. + */ + if (__db_log2(hashp->hdr->max_bucket + 2) > hashp->hdr->ovfl_point) { + /* + * We are about to shift the split point. Make sure that + * if the next doubling is going to be big (more than 8 + * pages), we have some extra pages around. + */ + if (hashp->hdr->max_bucket + 1 >= 8 && + hashp->hdr->spares[hashp->hdr->ovfl_point] < + hashp->hdr->spares[hashp->hdr->ovfl_point - 1] + + hashp->hdr->ovfl_point + 1) + __ham_init_ovflpages(hashp); + } + + /* Now we can log the meta-data split. */ + if (DB_LOGGING(hashp->dbp)) { + if ((ret = __ham_splitmeta_log(hashp->dbp->dbenv->lg_info, + (DB_TXN *)hashp->dbp->txn, &new_lsn, 0, + hashp->dbp->log_fileid, + hashp->hdr->max_bucket, hashp->hdr->ovfl_point, + hashp->hdr->spares[hashp->hdr->ovfl_point], + &hashp->hdr->lsn)) != 0) + return (ret); + + hashp->hdr->lsn = new_lsn; + } + + hashp->hash_expansions++; + new_bucket = ++hashp->hdr->max_bucket; + old_bucket = (hashp->hdr->max_bucket & hashp->hdr->low_mask); + + /* + * If the split point is increasing, copy the current contents + * of the spare split bucket to the next bucket. + */ + spare_ndx = __db_log2(hashp->hdr->max_bucket + 1); + if (spare_ndx > hashp->hdr->ovfl_point) { + hashp->hdr->spares[spare_ndx] = + hashp->hdr->spares[hashp->hdr->ovfl_point]; + hashp->hdr->ovfl_point = spare_ndx; + } + + if (new_bucket > hashp->hdr->high_mask) { + /* Starting a new doubling */ + hashp->hdr->low_mask = hashp->hdr->high_mask; + hashp->hdr->high_mask = new_bucket | hashp->hdr->low_mask; + } + + if (BUCKET_TO_PAGE(hashp, new_bucket) > MAX_PAGES(hashp)) { + __db_err(hashp->dbp->dbenv, + "hash: Cannot allocate new bucket. Pages exhausted."); + return (ENOSPC); + } + + /* Relocate records to the new bucket */ + return (__ham_split_page(hashp, old_bucket, new_bucket)); +} + +/* + * PUBLIC: u_int32_t __ham_call_hash __P((HTAB *, u_int8_t *, int32_t)); + */ +u_int32_t +__ham_call_hash(hashp, k, len) + HTAB *hashp; + u_int8_t *k; + int32_t len; +{ + u_int32_t n, bucket; + + n = (u_int32_t)hashp->hash(k, len); + bucket = n & hashp->hdr->high_mask; + if (bucket > hashp->hdr->max_bucket) + bucket = bucket & hashp->hdr->low_mask; + return (bucket); +} + +/* + * Check for duplicates, and call __db_ret appropriately. Release + * everything held by the cursor. + */ +static int +__ham_dup_return(hashp, hcp, val, flags) + HTAB *hashp; + HASH_CURSOR *hcp; + DBT *val; + u_int32_t flags; +{ + PAGE *pp; + DBT *myval, tmp_val; + db_indx_t ndx; + db_pgno_t pgno; + u_int8_t *hk, type; + int ret; + db_indx_t len; + + /* Check for duplicate and return the first one. */ + ndx = H_DATAINDEX(hcp->bndx); + type = HPAGE_TYPE(hcp->pagep, ndx); + pp = hcp->pagep; + myval = val; + + /* + * There are 3 cases: + * 1. We are not in duplicate, simply call db_ret. + * 2. We are looking at keys and stumbled onto a duplicate. + * 3. We are in the middle of a duplicate set. (ISDUP set) + */ + + /* + * Here we check for the case where we just stumbled onto a + * duplicate. In this case, we do initialization and then + * let the normal duplicate code handle it. + */ + if (!F_ISSET(hcp, H_ISDUP)) + if (type == H_DUPLICATE) { + F_SET(hcp, H_ISDUP); + hcp->dup_tlen = LEN_HDATA(hcp->pagep, + hashp->hdr->pagesize, hcp->bndx); + hk = H_PAIRDATA(hcp->pagep, hcp->bndx); + if (flags == DB_LAST || flags == DB_PREV) { + hcp->dndx = 0; + hcp->dup_off = 0; + do { + memcpy(&len, + HKEYDATA_DATA(hk) + hcp->dup_off, + sizeof(db_indx_t)); + hcp->dup_off += DUP_SIZE(len); + hcp->dndx++; + } while (hcp->dup_off < hcp->dup_tlen); + hcp->dup_off -= DUP_SIZE(len); + hcp->dndx--; + } else { + memcpy(&len, + HKEYDATA_DATA(hk), sizeof(db_indx_t)); + hcp->dup_off = 0; + hcp->dndx = 0; + } + hcp->dup_len = len; + } else if (type == H_OFFDUP) { + F_SET(hcp, H_ISDUP); + memcpy(&pgno, HOFFDUP_PGNO(P_ENTRY(hcp->pagep, ndx)), + sizeof(db_pgno_t)); + if (flags == DB_LAST || flags == DB_PREV) { + if ((ret = __db_dend(hashp->dbp, + pgno, &hcp->dpagep)) != 0) + return (ret); + hcp->dpgno = PGNO(hcp->dpagep); + hcp->dndx = NUM_ENT(hcp->dpagep) - 1; + } else if ((ret = __ham_next_cpage(hashp, + hcp, pgno, 0, H_ISDUP)) != 0) + return (ret); + } + + + /* + * Now, everything is initialized, grab a duplicate if + * necessary. + */ + if (F_ISSET(hcp, H_ISDUP)) + if (hcp->dpgno != PGNO_INVALID) { + pp = hcp->dpagep; + ndx = hcp->dndx; + } else { + /* + * Copy the DBT in case we are retrieving into + * user memory and we need the parameters for + * it. + */ + memcpy(&tmp_val, val, sizeof(*val)); + F_SET(&tmp_val, DB_DBT_PARTIAL); + tmp_val.dlen = hcp->dup_len; + tmp_val.doff = hcp->dup_off + sizeof(db_indx_t); + myval = &tmp_val; + } + + + /* + * Finally, if we had a duplicate, pp, ndx, and myval should be + * set appropriately. + */ + if ((ret = __db_ret(hashp->dbp, pp, ndx, myval, &hcp->big_data, + &hcp->big_datalen)) != 0) + return (ret); + + /* + * In case we sent a temporary off to db_ret, set the real + * return values. + */ + val->data = myval->data; + val->size = myval->size; + + return (0); +} + +static int +__ham_overwrite(hashp, hcp, nval) + HTAB *hashp; + HASH_CURSOR *hcp; + DBT *nval; +{ + DBT *myval, tmp_val; + u_int8_t *hk; + + if (F_ISSET(hashp->dbp, DB_AM_DUP)) + return (__ham_add_dup(hashp, hcp, nval, DB_KEYLAST)); + else if (!F_ISSET(nval, DB_DBT_PARTIAL)) { + /* Put/overwrite */ + memcpy(&tmp_val, nval, sizeof(*nval)); + F_SET(&tmp_val, DB_DBT_PARTIAL); + tmp_val.doff = 0; + hk = H_PAIRDATA(hcp->pagep, hcp->bndx); + if (HPAGE_PTYPE(hk) == H_OFFPAGE) + memcpy(&tmp_val.dlen, + HOFFPAGE_TLEN(hk), sizeof(u_int32_t)); + else + tmp_val.dlen = LEN_HDATA(hcp->pagep, + hashp->hdr->pagesize,hcp->bndx); + myval = &tmp_val; + } else /* Regular partial put */ + myval = nval; + + return (__ham_replpair(hashp, hcp, myval, 0)); +} + +/* + * Given a key and a cursor, sets the cursor to the page/ndx on which + * the key resides. If the key is found, the cursor H_OK flag is set + * and the pagep, bndx, pgno (dpagep, dndx, dpgno) fields are set. + * If the key is not found, the H_OK flag is not set. If the sought + * field is non-0, the pagep, bndx, pgno (dpagep, dndx, dpgno) fields + * are set indicating where an add might take place. If it is 0, + * non of the cursor pointer field are valid. + */ +static int +__ham_lookup(hashp, hcp, key, sought, mode) + HTAB *hashp; + HASH_CURSOR *hcp; + const DBT *key; + u_int32_t sought; + db_lockmode_t mode; +{ + db_pgno_t pgno; + u_int32_t tlen; + int match, ret, t_ret; + u_int8_t *hk; + + /* + * Set up cursor so that we're looking for space to add an item + * as we cycle through the pages looking for the key. + */ + if ((ret = __ham_item_reset(hashp, hcp)) != 0) + return (ret); + hcp->seek_size = sought; + + hcp->bucket = __ham_call_hash(hashp, (u_int8_t *)key->data, key->size); + while (1) { + if ((ret = __ham_item_next(hashp, hcp, mode)) != 0) + return (ret); + + if (F_ISSET(hcp, H_NOMORE)) + break; + + hk = H_PAIRKEY(hcp->pagep, hcp->bndx); + switch (HPAGE_PTYPE(hk)) { + case H_OFFPAGE: + memcpy(&tlen, HOFFPAGE_TLEN(hk), sizeof(u_int32_t)); + if (tlen == key->size) { + memcpy(&pgno, + HOFFPAGE_PGNO(hk), sizeof(db_pgno_t)); + match = __db_moff(hashp->dbp, key, pgno); + if (match == 0) { + F_SET(hcp, H_OK); + return (0); + } + } + break; + case H_KEYDATA: + if (key->size == LEN_HKEY(hcp->pagep, + hashp->hdr->pagesize, hcp->bndx) && + memcmp(key->data, + HKEYDATA_DATA(hk), key->size) == 0) { + F_SET(hcp, H_OK); + return (0); + } + break; + case H_DUPLICATE: + case H_OFFDUP: + /* + * These are errors because keys are never + * duplicated, only data items are. + */ + return (__db_pgfmt(hashp->dbp, PGNO(hcp->pagep))); + } + hashp->hash_collisions++; + } + + /* + * Item was not found, adjust cursor properly. + */ + + if (sought != 0) + return (ret); + + if ((t_ret = __ham_item_done(hashp, hcp, 0)) != 0 && ret == 0) + ret = t_ret; + return (ret); +} + +/* + * Initialize a dbt using some possibly already allocated storage + * for items. + * PUBLIC: int __ham_init_dbt __P((DBT *, u_int32_t, void **, u_int32_t *)); + */ +int +__ham_init_dbt(dbt, size, bufp, sizep) + DBT *dbt; + u_int32_t size; + void **bufp; + u_int32_t *sizep; +{ + memset(dbt, 0, sizeof(*dbt)); + if (*sizep < size) { + if ((*bufp = (void *)(*bufp == NULL ? + __db_malloc(size) : __db_realloc(*bufp, size))) == NULL) { + *sizep = 0; + return (ENOMEM); + } + *sizep = size; + } + dbt->data = *bufp; + dbt->size = size; + return (0); +} + +/* + * Adjust the cursor after an insert or delete. The cursor passed is + * the one that was operated upon; we just need to check any of the + * others. + * + * len indicates the length of the item added/deleted + * add indicates if the item indicated by the cursor has just been + * added (add == 1) or deleted (add == 0). + * dup indicates if the addition occurred into a duplicate set. + * + * PUBLIC: void __ham_c_update + * PUBLIC: __P((HASH_CURSOR *, db_pgno_t, u_int32_t, int, int)); + */ +void +__ham_c_update(hcp, chg_pgno, len, add, is_dup) + HASH_CURSOR *hcp; + db_pgno_t chg_pgno; + u_int32_t len; + int add, is_dup; +{ + DBC *cp; + HTAB *hp; + HASH_CURSOR *lcp; + int page_deleted; + + /* + * Regular adds are always at the end of a given page, so we never + * have to adjust anyone's cursor after a regular add. + */ + if (!is_dup && add) + return; + + /* + * Determine if a page was deleted. If this is a regular update + * (i.e., not is_dup) then the deleted page's number will be that in + * chg_pgno, and the pgno in the cursor will be different. If this + * was an onpage-duplicate, then the same conditions apply. If this + * was an off-page duplicate, then we need to verify if hcp->dpgno + * is the same (no delete) or different (delete) than chg_pgno. + */ + if (!is_dup || hcp->dpgno == PGNO_INVALID) + page_deleted = + chg_pgno != PGNO_INVALID && chg_pgno != hcp->pgno; + else + page_deleted = + chg_pgno != PGNO_INVALID && chg_pgno != hcp->dpgno; + + hp = hcp->db_cursor->dbp->master->internal; + DB_THREAD_LOCK(hp->dbp); + + for (cp = TAILQ_FIRST(&hp->dbp->curs_queue); cp != NULL; + cp = TAILQ_NEXT(cp, links)) { + if (cp->internal == hcp) + continue; + + lcp = (HASH_CURSOR *)cp->internal; + + if (!is_dup && lcp->pgno != chg_pgno) + continue; + + if (is_dup) { + if (F_ISSET(hcp, H_DELETED) && lcp->pgno != chg_pgno) + continue; + if (!F_ISSET(hcp, H_DELETED) && lcp->dpgno != chg_pgno) + continue; + } + + if (page_deleted) { + if (is_dup) { + lcp->dpgno = hcp->dpgno; + lcp->dndx = hcp->dndx; + } else { + lcp->pgno = hcp->pgno; + lcp->bndx = hcp->bndx; + lcp->bucket = hcp->bucket; + } + F_CLR(lcp, H_ISDUP); + continue; + } + + if (!is_dup && lcp->bndx > hcp->bndx) + lcp->bndx--; + else if (!is_dup && lcp->bndx == hcp->bndx) + F_SET(lcp, H_DELETED); + else if (is_dup && lcp->bndx == hcp->bndx) { + /* Assign dpgno in case there was page conversion. */ + lcp->dpgno = hcp->dpgno; + if (add && lcp->dndx >= hcp->dndx ) + lcp->dndx++; + else if (!add && lcp->dndx > hcp->dndx) + lcp->dndx--; + else if (!add && lcp->dndx == hcp->dndx) + F_SET(lcp, H_DELETED); + + /* Now adjust on-page information. */ + if (lcp->dpgno == PGNO_INVALID) + if (add) { + lcp->dup_tlen += len; + if (lcp->dndx > hcp->dndx) + lcp->dup_off += len; + } else { + lcp->dup_tlen -= len; + if (lcp->dndx > hcp->dndx) + lcp->dup_off -= len; + } + } + } + DB_THREAD_UNLOCK(hp->dbp); +} + +/* + * __ham_hdup -- + * This function gets called when we create a duplicate handle for a + * threaded DB. It should create the private part of the DB structure. + * + * PUBLIC: int __ham_hdup __P((DB *, DB *)); + */ +int +__ham_hdup(orig, new) + DB *orig, *new; +{ + DBC *curs; + HTAB *hashp; + int ret; + + if ((hashp = (HTAB *)__db_malloc(sizeof(HTAB))) == NULL) + return (ENOMEM); + + new->internal = hashp; + + hashp->dbp = new; + hashp->hlock = 0; + hashp->hdr = NULL; + hashp->hash = ((HTAB *)orig->internal)->hash; + if ((hashp->split_buf = (PAGE *)__db_malloc(orig->pgsize)) == NULL) + return (ENOMEM); + hashp->local_errno = 0; + hashp->hash_accesses = 0; + hashp->hash_collisions = 0; + hashp->hash_expansions = 0; + hashp->hash_overflows = 0; + hashp->hash_bigpages = 0; + /* Initialize the cursor queue. */ + ret = __ham_c_init(new, NULL, &curs); + TAILQ_INSERT_TAIL(&new->curs_queue, curs, links); + return (ret); +} diff --git a/mozilla/db/hash/hash.src b/mozilla/db/hash/hash.src new file mode 100644 index 00000000000..8a512830b88 --- /dev/null +++ b/mozilla/db/hash/hash.src @@ -0,0 +1,231 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1995, 1996 + * Margo Seltzer. All rights reserved. + */ +/* + * Copyright (c) 1995, 1996 + * The President and Fellows of Harvard University. 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. 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. + * + * @(#)hash.src 10.3 (Sleepycat) 4/10/98 + */ + +/* + * This is the source file used to create the logging functions for the + * hash package. Each access method (or set of routines wishing to register + * record types with the transaction system) should have a file like this. + * Each type of log record and its parameters is defined. The basic + * format of a record definition is: + * + * BEGIN + * ARG|STRING|POINTER + * ... + * END + * ARG the argument is a simple parameter of the type * specified. + * DBT the argument is a DBT (db.h) containing a length and pointer. + * PTR the argument is a pointer to the data type specified; the entire + * type should be logged. + * + * There are a set of shell scripts of the form xxx.sh that generate c + * code and or h files to process these. (This is probably better done + * in a single PERL script, but for now, this works.) + * + * The DB recovery system requires the following three fields appear in + * every record, and will assign them to the per-record-type structures + * as well as making them the first parameters to the appropriate logging + * call. + * rectype: record-type, identifies the structure and log/read call + * txnid: transaction id, a DBT in this implementation + * prev: the last LSN for this transaction + */ + +/* + * Use the argument of PREFIX as the prefix for all record types, + * routines, id numbers, etc. + */ +PREFIX ham + +/* + * HASH-insdel: used for hash to insert/delete a pair of entries onto a master + * page. The pair might be regular key/data pairs or they might be the + * structures that refer to off page items, duplicates or offpage duplicates. + * opcode - PUTPAIR/DELPAIR + big masks + * fileid - identifies the file referenced + * pgno - page within file + * ndx - index on the page of the item being added (item index) + * pagelsn - lsn on the page before the update + * key - the key being inserted + * data - the data being inserted + */ +BEGIN insdel +ARG opcode u_int32_t lu +ARG fileid u_int32_t lu +ARG pgno db_pgno_t lu +ARG ndx u_int32_t lu +POINTER pagelsn DB_LSN * lu +DBT key DBT s +DBT data DBT s +END + +/* + * Used to add and remove overflow pages. + * prev_pgno is the previous page that is going to get modified to + * point to this one. If this is the first page in a chain + * then prev_pgno should be PGNO_INVALID. + * new_pgno is the page being allocated. + * next_pgno is the page that follows this one. On allocation, + * this should be PGNO_INVALID. For deletes, it may exist. + * pagelsn is the old lsn on the page. + */ +BEGIN newpage +ARG opcode u_int32_t lu +ARG fileid u_int32_t lu +ARG prev_pgno db_pgno_t lu +POINTER prevlsn DB_LSN * lu +ARG new_pgno db_pgno_t lu +POINTER pagelsn DB_LSN * lu +ARG next_pgno db_pgno_t lu +POINTER nextlsn DB_LSN * lu +END + +/* + * Splitting requires two types of log messages. The first + * logs the meta-data of the split. The second logs the + * data on the original page. To redo the split, we have + * to visit the new page (pages) and add the items back + * on the page if they are not yet there. + * For the meta-data split + * bucket: max_bucket in table before split + * ovflpoint: overflow point before split. + * spares: spares[ovflpoint] before split. + */ +BEGIN splitmeta +ARG fileid u_int32_t lu +ARG bucket u_int32_t lu +ARG ovflpoint u_int32_t lu +ARG spares u_int32_t lu +POINTER metalsn DB_LSN * lu +END + +BEGIN splitdata +ARG fileid u_int32_t lu +ARG opcode u_int32_t lu +ARG pgno db_pgno_t lu +DBT pageimage DBT s +POINTER pagelsn DB_LSN * lu +END + +/* + * HASH-replace: is used for hash to handle partial puts that only + * affect a single master page. + * fileid - identifies the file referenced + * pgno - page within file + * ndx - index on the page of the item being modified (item index) + * pagelsn - lsn on the page before the update + * off - offset in the old item where the new item is going. + * olditem - DBT that describes the part of the item being replaced. + * newitem - DBT of the new item. + * makedup - this was a replacement that made an item a duplicate. + */ +BEGIN replace +ARG fileid u_int32_t lu +ARG pgno db_pgno_t lu +ARG ndx u_int32_t lu +POINTER pagelsn DB_LSN * lu +ARG off int32_t ld +DBT olditem DBT s +DBT newitem DBT s +ARG makedup u_int32_t lu +END + +/* + * HASH-newpgno: is used to record getting/deleting a new page number. + * This doesn't require much data modification, just modifying the + * meta-data. + * pgno is the page being allocated/freed. + * free_pgno is the next_pgno on the free list. + * old_type was the type of a page being deallocated. + * old_pgno was the next page number before the deallocation. We use it + * to indicate whether we incremented the spares count or not + * during this allocation. + */ +BEGIN newpgno +ARG opcode u_int32_t lu +ARG fileid u_int32_t lu +ARG pgno db_pgno_t lu +ARG free_pgno db_pgno_t lu +ARG old_type u_int32_t lu +ARG old_pgno db_pgno_t lu +ARG new_type u_int32_t lu +POINTER pagelsn DB_LSN * lu +POINTER metalsn DB_LSN * lu +END + +/* + * ovfl: initialize a set of overflow pages. + */ +BEGIN ovfl +ARG fileid u_int32_t lu +ARG start_pgno db_pgno_t lu +ARG npages u_int32_t lu +ARG free_pgno db_pgno_t lu +ARG ovflpoint u_int32_t lu +POINTER metalsn DB_LSN * lu +END + +/* + * Used when we empty the first page in a bucket and there are pages + * after it. The page after it gets copied into the bucket page (since + * bucket pages have to be in fixed locations). + * pgno: the bucket page + * pagelsn: the old LSN on the bucket page + * next_pgno: the page number of the next page + * nnext_pgno: page after next_pgno (may need to change its prev) + * nnextlsn: the LSN of nnext_pgno. + */ +BEGIN copypage +ARG fileid u_int32_t lu +ARG pgno db_pgno_t lu +POINTER pagelsn DB_LSN * lu +ARG next_pgno db_pgno_t lu +POINTER nextlsn DB_LSN * lu +ARG nnext_pgno db_pgno_t lu +POINTER nnextlsn DB_LSN * lu +DBT page DBT s +END diff --git a/mozilla/db/hash/hash_auto.c b/mozilla/db/hash/hash_auto.c new file mode 100644 index 00000000000..41b1ebed016 --- /dev/null +++ b/mozilla/db/hash/hash_auto.c @@ -0,0 +1,1555 @@ +/* Do not edit: automatically built by dist/db_gen.sh. */ +#include "config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include +#include +#include +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_page.h" +#include "db_dispatch.h" +#include "hash.h" +#include "db_am.h" +/* + * PUBLIC: int __ham_insdel_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, u_int32_t, db_pgno_t, u_int32_t, + * PUBLIC: DB_LSN *, const DBT *, const DBT *)); + */ +int __ham_insdel_log(logp, txnid, ret_lsnp, flags, + opcode, fileid, pgno, ndx, pagelsn, key, + data) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t opcode; + u_int32_t fileid; + db_pgno_t pgno; + u_int32_t ndx; + DB_LSN * pagelsn; + const DBT *key; + const DBT *data; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t zero; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_ham_insdel; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(opcode) + + sizeof(fileid) + + sizeof(pgno) + + sizeof(ndx) + + sizeof(*pagelsn) + + sizeof(u_int32_t) + (key == NULL ? 0 : key->size) + + sizeof(u_int32_t) + (data == NULL ? 0 : data->size); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &opcode, sizeof(opcode)); + bp += sizeof(opcode); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + memcpy(bp, &pgno, sizeof(pgno)); + bp += sizeof(pgno); + memcpy(bp, &ndx, sizeof(ndx)); + bp += sizeof(ndx); + if (pagelsn != NULL) + memcpy(bp, pagelsn, sizeof(*pagelsn)); + else + memset(bp, 0, sizeof(*pagelsn)); + bp += sizeof(*pagelsn); + if (key == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &key->size, sizeof(key->size)); + bp += sizeof(key->size); + memcpy(bp, key->data, key->size); + bp += key->size; + } + if (data == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &data->size, sizeof(data->size)); + bp += sizeof(data->size); + memcpy(bp, data->data, data->size); + bp += data->size; + } +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __ham_insdel_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_insdel_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __ham_insdel_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __ham_insdel_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]ham_insdel: 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); + printf("\topcode: %lu\n", (u_long)argp->opcode); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tpgno: %lu\n", (u_long)argp->pgno); + printf("\tndx: %lu\n", (u_long)argp->ndx); + printf("\tpagelsn: [%lu][%lu]\n", + (u_long)argp->pagelsn.file, (u_long)argp->pagelsn.offset); + printf("\tkey: "); + for (i = 0; i < argp->key.size; i++) { + ch = ((u_int8_t *)argp->key.data)[i]; + if (isprint(ch) || ch == 0xa) + putchar(ch); + else + printf("%#x ", ch); + } + printf("\n"); + printf("\tdata: "); + for (i = 0; i < argp->data.size; i++) { + ch = ((u_int8_t *)argp->data.data)[i]; + if (isprint(ch) || ch == 0xa) + putchar(ch); + else + printf("%#x ", ch); + } + printf("\n"); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __ham_insdel_read __P((void *, __ham_insdel_args **)); + */ +int +__ham_insdel_read(recbuf, argpp) + void *recbuf; + __ham_insdel_args **argpp; +{ + __ham_insdel_args *argp; + u_int8_t *bp; + + argp = (__ham_insdel_args *)__db_malloc(sizeof(__ham_insdel_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->opcode, bp, sizeof(argp->opcode)); + bp += sizeof(argp->opcode); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->pgno, bp, sizeof(argp->pgno)); + bp += sizeof(argp->pgno); + memcpy(&argp->ndx, bp, sizeof(argp->ndx)); + bp += sizeof(argp->ndx); + memcpy(&argp->pagelsn, bp, sizeof(argp->pagelsn)); + bp += sizeof(argp->pagelsn); + memcpy(&argp->key.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->key.data = bp; + bp += argp->key.size; + memcpy(&argp->data.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->data.data = bp; + bp += argp->data.size; + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __ham_newpage_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, u_int32_t, db_pgno_t, DB_LSN *, + * PUBLIC: db_pgno_t, DB_LSN *, db_pgno_t, DB_LSN *)); + */ +int __ham_newpage_log(logp, txnid, ret_lsnp, flags, + opcode, fileid, prev_pgno, prevlsn, new_pgno, pagelsn, + next_pgno, nextlsn) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t opcode; + u_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; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_ham_newpage; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(opcode) + + sizeof(fileid) + + sizeof(prev_pgno) + + sizeof(*prevlsn) + + sizeof(new_pgno) + + sizeof(*pagelsn) + + sizeof(next_pgno) + + sizeof(*nextlsn); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &opcode, sizeof(opcode)); + bp += sizeof(opcode); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + memcpy(bp, &prev_pgno, sizeof(prev_pgno)); + bp += sizeof(prev_pgno); + if (prevlsn != NULL) + memcpy(bp, prevlsn, sizeof(*prevlsn)); + else + memset(bp, 0, sizeof(*prevlsn)); + bp += sizeof(*prevlsn); + memcpy(bp, &new_pgno, sizeof(new_pgno)); + bp += sizeof(new_pgno); + if (pagelsn != NULL) + memcpy(bp, pagelsn, sizeof(*pagelsn)); + else + memset(bp, 0, sizeof(*pagelsn)); + bp += sizeof(*pagelsn); + memcpy(bp, &next_pgno, sizeof(next_pgno)); + bp += sizeof(next_pgno); + if (nextlsn != NULL) + memcpy(bp, nextlsn, sizeof(*nextlsn)); + else + memset(bp, 0, sizeof(*nextlsn)); + bp += sizeof(*nextlsn); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __ham_newpage_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_newpage_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __ham_newpage_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __ham_newpage_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]ham_newpage: 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); + printf("\topcode: %lu\n", (u_long)argp->opcode); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tprev_pgno: %lu\n", (u_long)argp->prev_pgno); + printf("\tprevlsn: [%lu][%lu]\n", + (u_long)argp->prevlsn.file, (u_long)argp->prevlsn.offset); + printf("\tnew_pgno: %lu\n", (u_long)argp->new_pgno); + printf("\tpagelsn: [%lu][%lu]\n", + (u_long)argp->pagelsn.file, (u_long)argp->pagelsn.offset); + printf("\tnext_pgno: %lu\n", (u_long)argp->next_pgno); + printf("\tnextlsn: [%lu][%lu]\n", + (u_long)argp->nextlsn.file, (u_long)argp->nextlsn.offset); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __ham_newpage_read __P((void *, __ham_newpage_args **)); + */ +int +__ham_newpage_read(recbuf, argpp) + void *recbuf; + __ham_newpage_args **argpp; +{ + __ham_newpage_args *argp; + u_int8_t *bp; + + argp = (__ham_newpage_args *)__db_malloc(sizeof(__ham_newpage_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->opcode, bp, sizeof(argp->opcode)); + bp += sizeof(argp->opcode); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->prev_pgno, bp, sizeof(argp->prev_pgno)); + bp += sizeof(argp->prev_pgno); + memcpy(&argp->prevlsn, bp, sizeof(argp->prevlsn)); + bp += sizeof(argp->prevlsn); + memcpy(&argp->new_pgno, bp, sizeof(argp->new_pgno)); + bp += sizeof(argp->new_pgno); + memcpy(&argp->pagelsn, bp, sizeof(argp->pagelsn)); + bp += sizeof(argp->pagelsn); + memcpy(&argp->next_pgno, bp, sizeof(argp->next_pgno)); + bp += sizeof(argp->next_pgno); + memcpy(&argp->nextlsn, bp, sizeof(argp->nextlsn)); + bp += sizeof(argp->nextlsn); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __ham_splitmeta_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, u_int32_t, u_int32_t, u_int32_t, + * PUBLIC: DB_LSN *)); + */ +int __ham_splitmeta_log(logp, txnid, ret_lsnp, flags, + fileid, bucket, ovflpoint, spares, metalsn) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t fileid; + u_int32_t bucket; + u_int32_t ovflpoint; + u_int32_t spares; + DB_LSN * metalsn; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_ham_splitmeta; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(fileid) + + sizeof(bucket) + + sizeof(ovflpoint) + + sizeof(spares) + + sizeof(*metalsn); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + memcpy(bp, &bucket, sizeof(bucket)); + bp += sizeof(bucket); + memcpy(bp, &ovflpoint, sizeof(ovflpoint)); + bp += sizeof(ovflpoint); + memcpy(bp, &spares, sizeof(spares)); + bp += sizeof(spares); + if (metalsn != NULL) + memcpy(bp, metalsn, sizeof(*metalsn)); + else + memset(bp, 0, sizeof(*metalsn)); + bp += sizeof(*metalsn); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __ham_splitmeta_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_splitmeta_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __ham_splitmeta_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __ham_splitmeta_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]ham_splitmeta: 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); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tbucket: %lu\n", (u_long)argp->bucket); + printf("\tovflpoint: %lu\n", (u_long)argp->ovflpoint); + printf("\tspares: %lu\n", (u_long)argp->spares); + printf("\tmetalsn: [%lu][%lu]\n", + (u_long)argp->metalsn.file, (u_long)argp->metalsn.offset); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __ham_splitmeta_read __P((void *, __ham_splitmeta_args **)); + */ +int +__ham_splitmeta_read(recbuf, argpp) + void *recbuf; + __ham_splitmeta_args **argpp; +{ + __ham_splitmeta_args *argp; + u_int8_t *bp; + + argp = (__ham_splitmeta_args *)__db_malloc(sizeof(__ham_splitmeta_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->bucket, bp, sizeof(argp->bucket)); + bp += sizeof(argp->bucket); + memcpy(&argp->ovflpoint, bp, sizeof(argp->ovflpoint)); + bp += sizeof(argp->ovflpoint); + memcpy(&argp->spares, bp, sizeof(argp->spares)); + bp += sizeof(argp->spares); + memcpy(&argp->metalsn, bp, sizeof(argp->metalsn)); + bp += sizeof(argp->metalsn); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __ham_splitdata_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, u_int32_t, db_pgno_t, const DBT *, + * PUBLIC: DB_LSN *)); + */ +int __ham_splitdata_log(logp, txnid, ret_lsnp, flags, + fileid, opcode, pgno, pageimage, pagelsn) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t fileid; + u_int32_t opcode; + db_pgno_t pgno; + const DBT *pageimage; + DB_LSN * pagelsn; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t zero; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_ham_splitdata; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(fileid) + + sizeof(opcode) + + sizeof(pgno) + + sizeof(u_int32_t) + (pageimage == NULL ? 0 : pageimage->size) + + sizeof(*pagelsn); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + memcpy(bp, &opcode, sizeof(opcode)); + bp += sizeof(opcode); + memcpy(bp, &pgno, sizeof(pgno)); + bp += sizeof(pgno); + if (pageimage == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &pageimage->size, sizeof(pageimage->size)); + bp += sizeof(pageimage->size); + memcpy(bp, pageimage->data, pageimage->size); + bp += pageimage->size; + } + if (pagelsn != NULL) + memcpy(bp, pagelsn, sizeof(*pagelsn)); + else + memset(bp, 0, sizeof(*pagelsn)); + bp += sizeof(*pagelsn); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __ham_splitdata_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_splitdata_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __ham_splitdata_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __ham_splitdata_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]ham_splitdata: 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); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\topcode: %lu\n", (u_long)argp->opcode); + printf("\tpgno: %lu\n", (u_long)argp->pgno); + printf("\tpageimage: "); + for (i = 0; i < argp->pageimage.size; i++) { + ch = ((u_int8_t *)argp->pageimage.data)[i]; + if (isprint(ch) || ch == 0xa) + putchar(ch); + else + printf("%#x ", ch); + } + printf("\n"); + printf("\tpagelsn: [%lu][%lu]\n", + (u_long)argp->pagelsn.file, (u_long)argp->pagelsn.offset); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __ham_splitdata_read __P((void *, __ham_splitdata_args **)); + */ +int +__ham_splitdata_read(recbuf, argpp) + void *recbuf; + __ham_splitdata_args **argpp; +{ + __ham_splitdata_args *argp; + u_int8_t *bp; + + argp = (__ham_splitdata_args *)__db_malloc(sizeof(__ham_splitdata_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->opcode, bp, sizeof(argp->opcode)); + bp += sizeof(argp->opcode); + memcpy(&argp->pgno, bp, sizeof(argp->pgno)); + bp += sizeof(argp->pgno); + memcpy(&argp->pageimage.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->pageimage.data = bp; + bp += argp->pageimage.size; + memcpy(&argp->pagelsn, bp, sizeof(argp->pagelsn)); + bp += sizeof(argp->pagelsn); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __ham_replace_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, db_pgno_t, u_int32_t, DB_LSN *, + * PUBLIC: int32_t, const DBT *, const DBT *, u_int32_t)); + */ +int __ham_replace_log(logp, txnid, ret_lsnp, flags, + fileid, pgno, ndx, pagelsn, off, olditem, + newitem, makedup) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t fileid; + db_pgno_t pgno; + u_int32_t ndx; + DB_LSN * pagelsn; + int32_t off; + const DBT *olditem; + const DBT *newitem; + u_int32_t makedup; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t zero; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_ham_replace; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(fileid) + + sizeof(pgno) + + sizeof(ndx) + + sizeof(*pagelsn) + + sizeof(off) + + sizeof(u_int32_t) + (olditem == NULL ? 0 : olditem->size) + + sizeof(u_int32_t) + (newitem == NULL ? 0 : newitem->size) + + sizeof(makedup); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + memcpy(bp, &pgno, sizeof(pgno)); + bp += sizeof(pgno); + memcpy(bp, &ndx, sizeof(ndx)); + bp += sizeof(ndx); + if (pagelsn != NULL) + memcpy(bp, pagelsn, sizeof(*pagelsn)); + else + memset(bp, 0, sizeof(*pagelsn)); + bp += sizeof(*pagelsn); + memcpy(bp, &off, sizeof(off)); + bp += sizeof(off); + if (olditem == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &olditem->size, sizeof(olditem->size)); + bp += sizeof(olditem->size); + memcpy(bp, olditem->data, olditem->size); + bp += olditem->size; + } + if (newitem == NULL) { + zero = 0; + memcpy(bp, &zero, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + } else { + memcpy(bp, &newitem->size, sizeof(newitem->size)); + bp += sizeof(newitem->size); + memcpy(bp, newitem->data, newitem->size); + bp += newitem->size; + } + memcpy(bp, &makedup, sizeof(makedup)); + bp += sizeof(makedup); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __ham_replace_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_replace_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __ham_replace_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __ham_replace_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]ham_replace: 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); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tpgno: %lu\n", (u_long)argp->pgno); + printf("\tndx: %lu\n", (u_long)argp->ndx); + printf("\tpagelsn: [%lu][%lu]\n", + (u_long)argp->pagelsn.file, (u_long)argp->pagelsn.offset); + printf("\toff: %ld\n", (long)argp->off); + printf("\tolditem: "); + for (i = 0; i < argp->olditem.size; i++) { + ch = ((u_int8_t *)argp->olditem.data)[i]; + if (isprint(ch) || ch == 0xa) + putchar(ch); + else + printf("%#x ", ch); + } + printf("\n"); + printf("\tnewitem: "); + for (i = 0; i < argp->newitem.size; i++) { + ch = ((u_int8_t *)argp->newitem.data)[i]; + if (isprint(ch) || ch == 0xa) + putchar(ch); + else + printf("%#x ", ch); + } + printf("\n"); + printf("\tmakedup: %lu\n", (u_long)argp->makedup); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __ham_replace_read __P((void *, __ham_replace_args **)); + */ +int +__ham_replace_read(recbuf, argpp) + void *recbuf; + __ham_replace_args **argpp; +{ + __ham_replace_args *argp; + u_int8_t *bp; + + argp = (__ham_replace_args *)__db_malloc(sizeof(__ham_replace_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->pgno, bp, sizeof(argp->pgno)); + bp += sizeof(argp->pgno); + memcpy(&argp->ndx, bp, sizeof(argp->ndx)); + bp += sizeof(argp->ndx); + memcpy(&argp->pagelsn, bp, sizeof(argp->pagelsn)); + bp += sizeof(argp->pagelsn); + memcpy(&argp->off, bp, sizeof(argp->off)); + bp += sizeof(argp->off); + memcpy(&argp->olditem.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->olditem.data = bp; + bp += argp->olditem.size; + memcpy(&argp->newitem.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->newitem.data = bp; + bp += argp->newitem.size; + memcpy(&argp->makedup, bp, sizeof(argp->makedup)); + bp += sizeof(argp->makedup); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __ham_newpgno_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, u_int32_t, db_pgno_t, db_pgno_t, + * PUBLIC: u_int32_t, db_pgno_t, u_int32_t, DB_LSN *, + * PUBLIC: DB_LSN *)); + */ +int __ham_newpgno_log(logp, txnid, ret_lsnp, flags, + opcode, fileid, pgno, free_pgno, old_type, old_pgno, + new_type, pagelsn, metalsn) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t opcode; + u_int32_t fileid; + db_pgno_t pgno; + db_pgno_t free_pgno; + u_int32_t old_type; + db_pgno_t old_pgno; + u_int32_t new_type; + DB_LSN * pagelsn; + DB_LSN * metalsn; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_ham_newpgno; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(opcode) + + sizeof(fileid) + + sizeof(pgno) + + sizeof(free_pgno) + + sizeof(old_type) + + sizeof(old_pgno) + + sizeof(new_type) + + sizeof(*pagelsn) + + sizeof(*metalsn); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &opcode, sizeof(opcode)); + bp += sizeof(opcode); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + memcpy(bp, &pgno, sizeof(pgno)); + bp += sizeof(pgno); + memcpy(bp, &free_pgno, sizeof(free_pgno)); + bp += sizeof(free_pgno); + memcpy(bp, &old_type, sizeof(old_type)); + bp += sizeof(old_type); + memcpy(bp, &old_pgno, sizeof(old_pgno)); + bp += sizeof(old_pgno); + memcpy(bp, &new_type, sizeof(new_type)); + bp += sizeof(new_type); + if (pagelsn != NULL) + memcpy(bp, pagelsn, sizeof(*pagelsn)); + else + memset(bp, 0, sizeof(*pagelsn)); + bp += sizeof(*pagelsn); + if (metalsn != NULL) + memcpy(bp, metalsn, sizeof(*metalsn)); + else + memset(bp, 0, sizeof(*metalsn)); + bp += sizeof(*metalsn); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __ham_newpgno_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_newpgno_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __ham_newpgno_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __ham_newpgno_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]ham_newpgno: 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); + printf("\topcode: %lu\n", (u_long)argp->opcode); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tpgno: %lu\n", (u_long)argp->pgno); + printf("\tfree_pgno: %lu\n", (u_long)argp->free_pgno); + printf("\told_type: %lu\n", (u_long)argp->old_type); + printf("\told_pgno: %lu\n", (u_long)argp->old_pgno); + printf("\tnew_type: %lu\n", (u_long)argp->new_type); + printf("\tpagelsn: [%lu][%lu]\n", + (u_long)argp->pagelsn.file, (u_long)argp->pagelsn.offset); + printf("\tmetalsn: [%lu][%lu]\n", + (u_long)argp->metalsn.file, (u_long)argp->metalsn.offset); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __ham_newpgno_read __P((void *, __ham_newpgno_args **)); + */ +int +__ham_newpgno_read(recbuf, argpp) + void *recbuf; + __ham_newpgno_args **argpp; +{ + __ham_newpgno_args *argp; + u_int8_t *bp; + + argp = (__ham_newpgno_args *)__db_malloc(sizeof(__ham_newpgno_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->opcode, bp, sizeof(argp->opcode)); + bp += sizeof(argp->opcode); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->pgno, bp, sizeof(argp->pgno)); + bp += sizeof(argp->pgno); + memcpy(&argp->free_pgno, bp, sizeof(argp->free_pgno)); + bp += sizeof(argp->free_pgno); + memcpy(&argp->old_type, bp, sizeof(argp->old_type)); + bp += sizeof(argp->old_type); + memcpy(&argp->old_pgno, bp, sizeof(argp->old_pgno)); + bp += sizeof(argp->old_pgno); + memcpy(&argp->new_type, bp, sizeof(argp->new_type)); + bp += sizeof(argp->new_type); + memcpy(&argp->pagelsn, bp, sizeof(argp->pagelsn)); + bp += sizeof(argp->pagelsn); + memcpy(&argp->metalsn, bp, sizeof(argp->metalsn)); + bp += sizeof(argp->metalsn); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __ham_ovfl_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, db_pgno_t, u_int32_t, db_pgno_t, + * PUBLIC: u_int32_t, DB_LSN *)); + */ +int __ham_ovfl_log(logp, txnid, ret_lsnp, flags, + fileid, start_pgno, npages, free_pgno, ovflpoint, metalsn) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t fileid; + db_pgno_t start_pgno; + u_int32_t npages; + db_pgno_t free_pgno; + u_int32_t ovflpoint; + DB_LSN * metalsn; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_ham_ovfl; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(fileid) + + sizeof(start_pgno) + + sizeof(npages) + + sizeof(free_pgno) + + sizeof(ovflpoint) + + sizeof(*metalsn); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + memcpy(bp, &start_pgno, sizeof(start_pgno)); + bp += sizeof(start_pgno); + memcpy(bp, &npages, sizeof(npages)); + bp += sizeof(npages); + memcpy(bp, &free_pgno, sizeof(free_pgno)); + bp += sizeof(free_pgno); + memcpy(bp, &ovflpoint, sizeof(ovflpoint)); + bp += sizeof(ovflpoint); + if (metalsn != NULL) + memcpy(bp, metalsn, sizeof(*metalsn)); + else + memset(bp, 0, sizeof(*metalsn)); + bp += sizeof(*metalsn); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __ham_ovfl_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_ovfl_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __ham_ovfl_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __ham_ovfl_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]ham_ovfl: 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); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tstart_pgno: %lu\n", (u_long)argp->start_pgno); + printf("\tnpages: %lu\n", (u_long)argp->npages); + printf("\tfree_pgno: %lu\n", (u_long)argp->free_pgno); + printf("\tovflpoint: %lu\n", (u_long)argp->ovflpoint); + printf("\tmetalsn: [%lu][%lu]\n", + (u_long)argp->metalsn.file, (u_long)argp->metalsn.offset); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __ham_ovfl_read __P((void *, __ham_ovfl_args **)); + */ +int +__ham_ovfl_read(recbuf, argpp) + void *recbuf; + __ham_ovfl_args **argpp; +{ + __ham_ovfl_args *argp; + u_int8_t *bp; + + argp = (__ham_ovfl_args *)__db_malloc(sizeof(__ham_ovfl_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->start_pgno, bp, sizeof(argp->start_pgno)); + bp += sizeof(argp->start_pgno); + memcpy(&argp->npages, bp, sizeof(argp->npages)); + bp += sizeof(argp->npages); + memcpy(&argp->free_pgno, bp, sizeof(argp->free_pgno)); + bp += sizeof(argp->free_pgno); + memcpy(&argp->ovflpoint, bp, sizeof(argp->ovflpoint)); + bp += sizeof(argp->ovflpoint); + memcpy(&argp->metalsn, bp, sizeof(argp->metalsn)); + bp += sizeof(argp->metalsn); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __ham_copypage_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t, + * PUBLIC: DB_LSN *, db_pgno_t, DB_LSN *, const DBT *)); + */ +int __ham_copypage_log(logp, txnid, ret_lsnp, flags, + fileid, pgno, pagelsn, next_pgno, nextlsn, nnext_pgno, + nnextlsn, page) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t fileid; + db_pgno_t pgno; + DB_LSN * pagelsn; + db_pgno_t next_pgno; + DB_LSN * nextlsn; + db_pgno_t nnext_pgno; + DB_LSN * nnextlsn; + const DBT *page; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t zero; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_ham_copypage; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(fileid) + + sizeof(pgno) + + sizeof(*pagelsn) + + sizeof(next_pgno) + + sizeof(*nextlsn) + + sizeof(nnext_pgno) + + sizeof(*nnextlsn) + + sizeof(u_int32_t) + (page == NULL ? 0 : page->size); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &fileid, sizeof(fileid)); + bp += sizeof(fileid); + memcpy(bp, &pgno, sizeof(pgno)); + bp += sizeof(pgno); + if (pagelsn != NULL) + memcpy(bp, pagelsn, sizeof(*pagelsn)); + else + memset(bp, 0, sizeof(*pagelsn)); + bp += sizeof(*pagelsn); + memcpy(bp, &next_pgno, sizeof(next_pgno)); + bp += sizeof(next_pgno); + if (nextlsn != NULL) + memcpy(bp, nextlsn, sizeof(*nextlsn)); + else + memset(bp, 0, sizeof(*nextlsn)); + bp += sizeof(*nextlsn); + memcpy(bp, &nnext_pgno, sizeof(nnext_pgno)); + bp += sizeof(nnext_pgno); + if (nnextlsn != NULL) + memcpy(bp, nnextlsn, sizeof(*nnextlsn)); + else + memset(bp, 0, sizeof(*nnextlsn)); + bp += sizeof(*nnextlsn); + 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; + } +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __ham_copypage_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_copypage_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __ham_copypage_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __ham_copypage_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]ham_copypage: 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); + printf("\tfileid: %lu\n", (u_long)argp->fileid); + printf("\tpgno: %lu\n", (u_long)argp->pgno); + printf("\tpagelsn: [%lu][%lu]\n", + (u_long)argp->pagelsn.file, (u_long)argp->pagelsn.offset); + printf("\tnext_pgno: %lu\n", (u_long)argp->next_pgno); + printf("\tnextlsn: [%lu][%lu]\n", + (u_long)argp->nextlsn.file, (u_long)argp->nextlsn.offset); + printf("\tnnext_pgno: %lu\n", (u_long)argp->nnext_pgno); + printf("\tnnextlsn: [%lu][%lu]\n", + (u_long)argp->nnextlsn.file, (u_long)argp->nnextlsn.offset); + printf("\tpage: "); + for (i = 0; i < argp->page.size; i++) { + ch = ((u_int8_t *)argp->page.data)[i]; + if (isprint(ch) || ch == 0xa) + putchar(ch); + else + printf("%#x ", ch); + } + printf("\n"); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __ham_copypage_read __P((void *, __ham_copypage_args **)); + */ +int +__ham_copypage_read(recbuf, argpp) + void *recbuf; + __ham_copypage_args **argpp; +{ + __ham_copypage_args *argp; + u_int8_t *bp; + + argp = (__ham_copypage_args *)__db_malloc(sizeof(__ham_copypage_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->fileid, bp, sizeof(argp->fileid)); + bp += sizeof(argp->fileid); + memcpy(&argp->pgno, bp, sizeof(argp->pgno)); + bp += sizeof(argp->pgno); + memcpy(&argp->pagelsn, bp, sizeof(argp->pagelsn)); + bp += sizeof(argp->pagelsn); + memcpy(&argp->next_pgno, bp, sizeof(argp->next_pgno)); + bp += sizeof(argp->next_pgno); + memcpy(&argp->nextlsn, bp, sizeof(argp->nextlsn)); + bp += sizeof(argp->nextlsn); + memcpy(&argp->nnext_pgno, bp, sizeof(argp->nnext_pgno)); + bp += sizeof(argp->nnext_pgno); + memcpy(&argp->nnextlsn, bp, sizeof(argp->nnextlsn)); + bp += sizeof(argp->nnextlsn); + memcpy(&argp->page.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->page.data = bp; + bp += argp->page.size; + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __ham_init_print __P((DB_ENV *)); + */ +int +__ham_init_print(dbenv) + DB_ENV *dbenv; +{ + int ret; + + if ((ret = __db_add_recovery(dbenv, + __ham_insdel_print, DB_ham_insdel)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __ham_newpage_print, DB_ham_newpage)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __ham_splitmeta_print, DB_ham_splitmeta)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __ham_splitdata_print, DB_ham_splitdata)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __ham_replace_print, DB_ham_replace)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __ham_newpgno_print, DB_ham_newpgno)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __ham_ovfl_print, DB_ham_ovfl)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __ham_copypage_print, DB_ham_copypage)) != 0) + return (ret); + return (0); +} + +/* + * PUBLIC: int __ham_init_recover __P((DB_ENV *)); + */ +int +__ham_init_recover(dbenv) + DB_ENV *dbenv; +{ + int ret; + + if ((ret = __db_add_recovery(dbenv, + __ham_insdel_recover, DB_ham_insdel)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __ham_newpage_recover, DB_ham_newpage)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __ham_splitmeta_recover, DB_ham_splitmeta)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __ham_splitdata_recover, DB_ham_splitdata)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __ham_replace_recover, DB_ham_replace)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __ham_newpgno_recover, DB_ham_newpgno)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __ham_ovfl_recover, DB_ham_ovfl)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __ham_copypage_recover, DB_ham_copypage)) != 0) + return (ret); + return (0); +} + diff --git a/mozilla/db/hash/hash_conv.c b/mozilla/db/hash/hash_conv.c new file mode 100644 index 00000000000..c6d0ba4d4ea --- /dev/null +++ b/mozilla/db/hash/hash_conv.c @@ -0,0 +1,109 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)hash_conv.c 10.5 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "db_swap.h" +#include "hash.h" + +/* + * __ham_pgin -- + * Convert host-specific page layout from the host-independent format + * stored on disk. + * + * PUBLIC: int __ham_pgin __P((db_pgno_t, void *, DBT *)); + */ +int +__ham_pgin(pg, pp, cookie) + db_pgno_t pg; + void *pp; + DBT *cookie; +{ + DB_PGINFO *pginfo; + u_int32_t tpgno; + + pginfo = (DB_PGINFO *)cookie->data; + tpgno = PGNO((PAGE *)pp); + if (pginfo->needswap) + M_32_SWAP(tpgno); + + if (pg != PGNO_METADATA && pg != tpgno) { + P_INIT(pp, pginfo->db_pagesize, + pg, PGNO_INVALID, PGNO_INVALID, 0, P_HASH); + return (0); + } + + if (!pginfo->needswap) + return (0); + return (pg == PGNO_METADATA ? + __ham_mswap(pp) : __db_pgin(pg, pginfo->db_pagesize, pp)); +} + +/* + * __ham_pgout -- + * Convert host-specific page layout to the host-independent format + * stored on disk. + * + * PUBLIC: int __ham_pgout __P((db_pgno_t, void *, DBT *)); + */ +int +__ham_pgout(pg, pp, cookie) + db_pgno_t pg; + void *pp; + DBT *cookie; +{ + DB_PGINFO *pginfo; + + pginfo = (DB_PGINFO *)cookie->data; + if (!pginfo->needswap) + return (0); + return (pg == PGNO_METADATA ? + __ham_mswap(pp) : __db_pgout(pg, pginfo->db_pagesize, pp)); +} + +/* + * __ham_mswap -- + * Swap the bytes on the hash metadata page. + * + * PUBLIC: int __ham_mswap __P((void *)); + */ +int +__ham_mswap(pg) + void *pg; +{ + u_int8_t *p; + int i; + + p = (u_int8_t *)pg; + SWAP32(p); /* lsn part 1 */ + SWAP32(p); /* lsn part 2 */ + SWAP32(p); /* pgno */ + SWAP32(p); /* magic */ + SWAP32(p); /* version */ + SWAP32(p); /* pagesize */ + SWAP32(p); /* ovfl_point */ + SWAP32(p); /* last_freed */ + SWAP32(p); /* max_bucket */ + SWAP32(p); /* high_mask */ + SWAP32(p); /* low_mask */ + SWAP32(p); /* ffactor */ + SWAP32(p); /* nelem */ + SWAP32(p); /* h_charkey */ + SWAP32(p); /* flags */ + for (i = 0; i < NCACHED; ++i) + SWAP32(p); /* spares */ + return (0); +} diff --git a/mozilla/db/hash/hash_debug.c b/mozilla/db/hash/hash_debug.c new file mode 100644 index 00000000000..232906ae342 --- /dev/null +++ b/mozilla/db/hash/hash_debug.c @@ -0,0 +1,92 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1995 + * The President and Fellows of Harvard University. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Jeremy Rassen. + * + * 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)hash_debug.c 10.6 (Sleepycat) 5/7/98"; +#endif /* not lint */ + +#ifdef DEBUG +/* + * PACKAGE: hashing + * + * DESCRIPTION: + * Debug routines. + * + * ROUTINES: + * + * External + * __dump_bucket + */ +#ifndef NO_SYSTEM_INCLUDES +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "hash.h" + +/* + * __ham_dump_bucket -- + * + * PUBLIC: #ifdef DEBUG + * PUBLIC: void __ham_dump_bucket __P((HTAB *, u_int32_t)); + * PUBLIC: #endif + */ +void +__ham_dump_bucket(hashp, bucket) + HTAB *hashp; + u_int32_t bucket; +{ + PAGE *p; + db_pgno_t pgno; + + for (pgno = BUCKET_TO_PAGE(hashp, bucket); pgno != PGNO_INVALID;) { + if (memp_fget(hashp->dbp->mpf, &pgno, 0, &p) != 0) + break; + (void)__db_prpage(p, 1); + pgno = p->next_pgno; + (void)memp_fput(hashp->dbp->mpf, p, 0); + } +} +#endif /* DEBUG */ diff --git a/mozilla/db/hash/hash_dup.c b/mozilla/db/hash/hash_dup.c new file mode 100644 index 00000000000..ba248ddb170 --- /dev/null +++ b/mozilla/db/hash/hash_dup.c @@ -0,0 +1,541 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. 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. 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)hash_dup.c 10.14 (Sleepycat) 5/7/98"; +#endif /* not lint */ + +/* + * PACKAGE: hashing + * + * DESCRIPTION: + * Manipulation of duplicates for the hash package. + * + * ROUTINES: + * + * External + * __add_dup + * Internal + */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "hash.h" + +static int __ham_check_move __P((HTAB *, HASH_CURSOR *, int32_t)); +static int __ham_dup_convert __P((HTAB *, HASH_CURSOR *)); +static int __ham_make_dup __P((const DBT *, DBT *d, void **, u_int32_t *)); + +/* + * Called from hash_access to add a duplicate key. nval is the new + * value that we want to add. The flags correspond to the flag values + * to cursor_put indicating where to add the new element. + * There are 4 cases. + * Case 1: The existing duplicate set already resides on a separate page. + * We can use common code for this. + * Case 2: The element is small enough to just be added to the existing set. + * Case 3: The element is large enough to be a big item, so we're going to + * have to push the set onto a new page. + * Case 4: The element is large enough to push the duplicate set onto a + * separate page. + * + * PUBLIC: int __ham_add_dup __P((HTAB *, HASH_CURSOR *, DBT *, u_int32_t)); + */ +int +__ham_add_dup(hashp, hcp, nval, flags) + HTAB *hashp; + HASH_CURSOR *hcp; + DBT *nval; + u_int32_t flags; +{ + DBT pval, tmp_val; + u_int32_t del_len, new_size; + int ret; + u_int8_t *hk; + + if (flags == DB_CURRENT && hcp->dpgno == PGNO_INVALID) + del_len = hcp->dup_len; + else + del_len = 0; + + if ((ret = __ham_check_move(hashp, hcp, + (int32_t)DUP_SIZE(nval->size) - (int32_t)del_len)) != 0) + return (ret); + + /* + * Check if resulting duplicate set is going to need to go + * onto a separate duplicate page. If so, convert the + * duplicate set and add the new one. After conversion, + * hcp->dndx is the first free ndx or the index of the + * current pointer into the duplicate set. + */ + hk = H_PAIRDATA(hcp->pagep, hcp->bndx); + new_size = DUP_SIZE(nval->size) - del_len + LEN_HKEYDATA(hcp->pagep, + hashp->hdr->pagesize, H_DATAINDEX(hcp->bndx)); + + /* + * We convert to off-page duplicates if the item is a big item, + * the addition of the new item will make the set large, or + * if there isn't enough room on this page to add the next item. + */ + if (HPAGE_PTYPE(hk) != H_OFFDUP && + (HPAGE_PTYPE(hk) == H_OFFPAGE || ISBIG(hashp, new_size) || + DUP_SIZE(nval->size) - del_len > P_FREESPACE(hcp->pagep))) { + + if ((ret = __ham_dup_convert(hashp, hcp)) != 0) + return (ret); + else + hk = H_PAIRDATA(hcp->pagep, hcp->bndx); + } + + /* There are two separate cases here: on page and off page. */ + if (HPAGE_PTYPE(hk) != H_OFFDUP) { + if (HPAGE_PTYPE(hk) != H_DUPLICATE) { + HPAGE_PTYPE(hk) = H_DUPLICATE; + pval.flags = 0; + pval.data = HKEYDATA_DATA(hk); + pval.size = LEN_HDATA(hcp->pagep, hashp->hdr->pagesize, + hcp->bndx); + if ((ret = + __ham_make_dup(&pval, &tmp_val, &hcp->big_data, + &hcp->big_datalen)) != 0 || (ret = + __ham_replpair(hashp, hcp, &tmp_val, 1)) != 0) + return (ret); + } + + /* Now make the new entry a duplicate. */ + if ((ret = __ham_make_dup(nval, + &tmp_val, &hcp->big_data, &hcp->big_datalen)) != 0) + return (ret); + + tmp_val.dlen = 0; + switch (flags) { /* On page. */ + case DB_KEYFIRST: + tmp_val.doff = 0; + break; + case DB_KEYLAST: + tmp_val.doff = LEN_HDATA(hcp->pagep, + hashp->hdr->pagesize, hcp->bndx); + break; + case DB_CURRENT: + tmp_val.doff = hcp->dup_off; + tmp_val.dlen = DUP_SIZE(hcp->dup_len); + break; + case DB_BEFORE: + tmp_val.doff = hcp->dup_off; + break; + case DB_AFTER: + tmp_val.doff = hcp->dup_off + DUP_SIZE(hcp->dup_len); + break; + } + /* Add the duplicate. */ + ret = __ham_replpair(hashp, hcp, &tmp_val, 0); + if (ret == 0) + ret = __ham_dirty_page(hashp, hcp->pagep); + __ham_c_update(hcp, hcp->pgno, tmp_val.size, 1, 1); + return (ret); + } + + /* If we get here, then we're on duplicate pages. */ + if (hcp->dpgno == PGNO_INVALID) { + memcpy(&hcp->dpgno, HOFFDUP_PGNO(hk), sizeof(db_pgno_t)); + hcp->dndx = 0; + } + + switch (flags) { + case DB_KEYFIRST: + /* + * The only way that we are already on a dup page is + * if we just converted the on-page representation. + * In that case, we've only got one page of duplicates. + */ + if (hcp->dpagep == NULL && (ret = + __db_dend(hashp->dbp, hcp->dpgno, &hcp->dpagep)) != 0) + return (ret); + hcp->dndx = 0; + break; + case DB_KEYLAST: + if (hcp->dpagep == NULL && (ret = + __db_dend(hashp->dbp, hcp->dpgno, &hcp->dpagep)) != 0) + return (ret); + hcp->dpgno = PGNO(hcp->dpagep); + hcp->dndx = NUM_ENT(hcp->dpagep); + break; + case DB_CURRENT: + if ((ret = __db_ditem(hashp->dbp, hcp->dpagep, hcp->dndx, + BKEYDATA_SIZE(GET_BKEYDATA(hcp->dpagep, hcp->dndx)->len))) + != 0) + return (ret); + break; + case DB_BEFORE: /* The default behavior is correct. */ + break; + case DB_AFTER: + hcp->dndx++; + break; + } + + ret = __db_dput(hashp->dbp, + nval, &hcp->dpagep, &hcp->dndx, __ham_overflow_page); + hcp->pgno = PGNO(hcp->pagep); + __ham_c_update(hcp, hcp->pgno, nval->size, 1, 1); + return (ret); +} + +/* + * Convert an on-page set of duplicates to an offpage set of duplicates. + */ +static int +__ham_dup_convert(hashp, hcp) + HTAB *hashp; + HASH_CURSOR *hcp; +{ + BOVERFLOW bo; + DBT dbt; + HOFFPAGE ho; + db_indx_t dndx, len; + int ret; + u_int8_t *p, *pend; + + /* + * Create a new page for the duplicates. + */ + if ((ret = + __ham_overflow_page(hashp->dbp, P_DUPLICATE, &hcp->dpagep)) != 0) + return (ret); + hcp->dpagep->type = P_DUPLICATE; + hcp->dpgno = PGNO(hcp->dpagep); + + /* + * Now put the duplicates onto the new page. + */ + dbt.flags = 0; + switch (HPAGE_PTYPE(H_PAIRDATA(hcp->pagep, hcp->bndx))) { + case H_KEYDATA: + /* Simple case, one key on page; move it to dup page. */ + dndx = 0; + dbt.size = + LEN_HDATA(hcp->pagep, hashp->hdr->pagesize, hcp->bndx); + dbt.data = HKEYDATA_DATA(H_PAIRDATA(hcp->pagep, hcp->bndx)); + ret = __db_pitem(hashp->dbp, hcp->dpagep, + (u_int32_t)dndx, BKEYDATA_SIZE(dbt.size), NULL, &dbt); + if (ret == 0) + __ham_dirty_page(hashp, hcp->dpagep); + break; + case H_OFFPAGE: + /* Simple case, one key on page; move it to dup page. */ + dndx = 0; + memcpy(&ho, + P_ENTRY(hcp->pagep, H_DATAINDEX(hcp->bndx)), HOFFPAGE_SIZE); + B_TSET(bo.type, ho.type, 0); + bo.pgno = ho.pgno; + bo.tlen = ho.tlen; + dbt.size = BOVERFLOW_SIZE; + dbt.data = &bo; + + ret = __db_pitem(hashp->dbp, hcp->dpagep, + (u_int32_t)dndx, dbt.size, &dbt, NULL); + if (ret == 0) + __ham_dirty_page(hashp, hcp->dpagep); + break; + case H_DUPLICATE: + p = HKEYDATA_DATA(H_PAIRDATA(hcp->pagep, hcp->bndx)); + pend = p + + LEN_HDATA(hcp->pagep, hashp->hdr->pagesize, hcp->bndx); + + for (dndx = 0; p < pend; dndx++) { + memcpy(&len, p, sizeof(db_indx_t)); + dbt.size = len; + p += sizeof(db_indx_t); + dbt.data = p; + p += len + sizeof(db_indx_t); + ret = __db_dput(hashp->dbp, &dbt, + &hcp->dpagep, &dndx, __ham_overflow_page); + if (ret != 0) + break; + } + break; + default: + ret = __db_pgfmt(hashp->dbp, (u_long)hcp->pgno); + } + if (ret == 0) { + /* + * Now attach this to the source page in place of + * the old duplicate item. + */ + __ham_move_offpage(hashp, hcp->pagep, + (u_int32_t)H_DATAINDEX(hcp->bndx), hcp->dpgno); + + /* Can probably just do a "put" here. */ + ret = __ham_dirty_page(hashp, hcp->pagep); + } else { + (void)__ham_del_page(hashp->dbp, hcp->dpagep); + hcp->dpagep = NULL; + } + return (ret); +} + +static int +__ham_make_dup(notdup, duplicate, bufp, sizep) + const DBT *notdup; + DBT *duplicate; + void **bufp; + u_int32_t *sizep; +{ + db_indx_t tsize, item_size; + int ret; + u_int8_t *p; + + item_size = (db_indx_t)notdup->size; + tsize = DUP_SIZE(item_size); + if ((ret = __ham_init_dbt(duplicate, tsize, bufp, sizep)) != 0) + return (ret); + + duplicate->dlen = 0; + duplicate->flags = notdup->flags; + F_SET(duplicate, DB_DBT_PARTIAL); + + p = duplicate->data; + memcpy(p, &item_size, sizeof(db_indx_t)); + p += sizeof(db_indx_t); + memcpy(p, notdup->data, notdup->size); + p += notdup->size; + memcpy(p, &item_size, sizeof(db_indx_t)); + + duplicate->doff = 0; + duplicate->dlen = notdup->size; + + return (0); +} + +static int +__ham_check_move(hashp, hcp, add_len) + HTAB *hashp; + HASH_CURSOR *hcp; + int32_t add_len; +{ + DBT k, d; + DB_LSN new_lsn; + PAGE *next_pagep; + db_pgno_t next_pgno; + u_int32_t new_datalen, old_len, rectype; + u_int8_t *hk; + int ret; + + /* + * Check if we can do whatever we need to on this page. If not, + * then we'll have to move the current element to a new page. + */ + hk = H_PAIRDATA(hcp->pagep, hcp->bndx); + + /* + * If the item is already off page duplicates or an offpage item, + * then we know we can do whatever we need to do in-place + */ + if (HPAGE_PTYPE(hk) == H_OFFDUP || HPAGE_PTYPE(hk) == H_OFFPAGE) + return (0); + + old_len = + LEN_HITEM(hcp->pagep, hashp->hdr->pagesize, H_DATAINDEX(hcp->bndx)); + new_datalen = old_len - HKEYDATA_SIZE(0) + add_len; + + /* + * We need to add a new page under two conditions: + * 1. The addition makes the total data length cross the BIG + * threshold and the OFFDUP structure won't fit on this page. + * 2. The addition does not make the total data cross the + * threshold, but the new data won't fit on the page. + * If neither of these is true, then we can return. + */ + if (ISBIG(hashp, new_datalen) && (old_len > HOFFDUP_SIZE || + HOFFDUP_SIZE - old_len <= P_FREESPACE(hcp->pagep))) + return (0); + + if (!ISBIG(hashp, new_datalen) && + add_len <= (int32_t)P_FREESPACE(hcp->pagep)) + return (0); + + /* + * If we get here, then we need to move the item to a new page. + * Check if there are more pages in the chain. + */ + + new_datalen = ISBIG(hashp, new_datalen) ? + HOFFDUP_SIZE : HKEYDATA_SIZE(new_datalen); + + next_pagep = NULL; + for (next_pgno = NEXT_PGNO(hcp->pagep); next_pgno != PGNO_INVALID; + next_pgno = NEXT_PGNO(next_pagep)) { + if (next_pagep != NULL && + (ret = __ham_put_page(hashp->dbp, next_pagep, 0)) != 0) + return (ret); + + if ((ret = + __ham_get_page(hashp->dbp, next_pgno, &next_pagep)) != 0) + return (ret); + + if (P_FREESPACE(next_pagep) >= new_datalen) + break; + } + + /* No more pages, add one. */ + if (next_pagep == NULL && + (ret = __ham_add_ovflpage(hashp, hcp->pagep, 0, &next_pagep)) != 0) + return (ret); + + /* Add new page at the end of the chain. */ + if (P_FREESPACE(next_pagep) < new_datalen && + (ret = __ham_add_ovflpage(hashp, next_pagep, 1, &next_pagep)) != 0) + return (ret); + + /* Copy the item to the new page. */ + if (DB_LOGGING(hashp->dbp)) { + rectype = PUTPAIR; + k.flags = 0; + d.flags = 0; + if (HPAGE_PTYPE( + H_PAIRKEY(hcp->pagep, hcp->bndx)) == H_OFFPAGE) { + rectype |= PAIR_KEYMASK; + k.data = H_PAIRKEY(hcp->pagep, hcp->bndx); + k.size = HOFFPAGE_SIZE; + } else { + k.data = + HKEYDATA_DATA(H_PAIRKEY(hcp->pagep, hcp->bndx)); + k.size = LEN_HKEY(hcp->pagep, + hashp->hdr->pagesize, hcp->bndx); + } + + if (HPAGE_PTYPE(hk) == H_OFFPAGE) { + rectype |= PAIR_DATAMASK; + d.data = H_PAIRDATA(hcp->pagep, hcp->bndx); + d.size = HOFFPAGE_SIZE; + } else { + d.data = + HKEYDATA_DATA(H_PAIRDATA(hcp->pagep, hcp->bndx)); + d.size = LEN_HDATA(hcp->pagep, + hashp->hdr->pagesize, hcp->bndx); + } + + + if ((ret = __ham_insdel_log(hashp->dbp->dbenv->lg_info, + (DB_TXN *)hashp->dbp->txn, &new_lsn, 0, rectype, + hashp->dbp->log_fileid, PGNO(next_pagep), + (u_int32_t)H_NUMPAIRS(next_pagep), &LSN(next_pagep), + &k, &d)) != 0) + return (ret); + + /* Move lsn onto page. */ + LSN(next_pagep) = new_lsn; /* Structure assignment. */ + } + + __ham_copy_item(hashp, hcp->pagep, H_KEYINDEX(hcp->bndx), next_pagep); + __ham_copy_item(hashp, hcp->pagep, H_DATAINDEX(hcp->bndx), next_pagep); + + /* Now delete the pair from the current page. */ + ret = __ham_del_pair(hashp, hcp, 0); + + (void)__ham_put_page(hashp->dbp, hcp->pagep, 1); + hcp->pagep = next_pagep; + hcp->pgno = PGNO(hcp->pagep); + hcp->bndx = H_NUMPAIRS(hcp->pagep) - 1; + F_SET(hcp, H_EXPAND); + return (ret); +} + +/* + * Replace an onpage set of duplicates with the OFFDUP structure that + * references the duplicate page. + * XXX This is really just a special case of __onpage_replace; we should + * probably combine them. + * PUBLIC: void __ham_move_offpage __P((HTAB *, PAGE *, u_int32_t, db_pgno_t)); + */ +void +__ham_move_offpage(hashp, pagep, ndx, pgno) + HTAB *hashp; + PAGE *pagep; + u_int32_t ndx; + db_pgno_t pgno; +{ + DBT new_dbt; + DBT old_dbt; + HOFFDUP od; + db_indx_t i; + int32_t shrink; + u_int8_t *src; + + od.type = H_OFFDUP; + od.pgno = pgno; + + if (DB_LOGGING(hashp->dbp)) { + new_dbt.data = &od; + new_dbt.size = HOFFDUP_SIZE; + old_dbt.data = P_ENTRY(pagep, ndx); + old_dbt.size = LEN_HITEM(pagep, hashp->hdr->pagesize, ndx); + (void)__ham_replace_log(hashp->dbp->dbenv->lg_info, + (DB_TXN *)hashp->dbp->txn, &LSN(pagep), 0, + hashp->dbp->log_fileid, PGNO(pagep), (u_int32_t)ndx, + &LSN(pagep), -1, &old_dbt, &new_dbt, 0); + } + + shrink = + LEN_HITEM(pagep, hashp->hdr->pagesize, ndx) - HOFFDUP_SIZE; + + if (shrink != 0) { + /* Copy data. */ + src = (u_int8_t *)(pagep) + HOFFSET(pagep); + memmove(src + shrink, src, pagep->inp[ndx] - HOFFSET(pagep)); + HOFFSET(pagep) += shrink; + + /* Update index table. */ + for (i = ndx; i < NUM_ENT(pagep); i++) + pagep->inp[i] += shrink; + } + + /* Now copy the offdup entry onto the page. */ + memcpy(P_ENTRY(pagep, ndx), &od, HOFFDUP_SIZE); +} diff --git a/mozilla/db/hash/hash_func.c b/mozilla/db/hash/hash_func.c new file mode 100644 index 00000000000..9131098e5e5 --- /dev/null +++ b/mozilla/db/hash/hash_func.c @@ -0,0 +1,219 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1990, 1993 + * Margo Seltzer. All rights reserved. + */ +/* + * Copyright (c) 1990, 1993 + * 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. 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)hash_func.c 10.8 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "hash.h" + +/* + * __ham_func2 -- + * Phong Vo's linear congruential hash. + * + * PUBLIC: u_int32_t __ham_func2 __P((const void *, u_int32_t)); + */ +#define DCHARHASH(h, c) ((h) = 0x63c63cd9*(h) + 0x9c39c33d + (c)) + +u_int32_t +__ham_func2(key, len) + const void *key; + u_int32_t len; +{ + const u_int8_t *e, *k; + u_int32_t h; + u_int8_t c; + + k = key; + e = k + len; + for (h = 0; k != e;) { + c = *k++; + if (!c && k > e) + break; + DCHARHASH(h, c); + } + return (h); +} + +/* + * __ham_func3 -- + * Ozan Yigit's original sdbm hash. + * + * Ugly, but fast. Break the string up into 8 byte units. On the first time + * through the loop get the "leftover bytes" (strlen % 8). On every other + * iteration, perform 8 HASHC's so we handle all 8 bytes. Essentially, this + * saves us 7 cmp & branch instructions. + * + * PUBLIC: u_int32_t __ham_func3 __P((const void *, u_int32_t)); + */ +u_int32_t +__ham_func3(key, len) + const void *key; + u_int32_t len; +{ + const u_int8_t *k; + u_int32_t n, loop; + + if (len == 0) + return (0); + +#define HASHC n = *k++ + 65599 * n + n = 0; + k = key; + + 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); + } + return (n); +} + +/* + * __ham_func4 -- + * Chris Torek's hash function. Although this function performs only + * slightly worse than __ham_func5 on strings, it performs horribly on + * numbers. + * + * PUBLIC: u_int32_t __ham_func4 __P((const void *, u_int32_t)); + */ +u_int32_t +__ham_func4(key, len) + const void *key; + u_int32_t len; +{ + const u_int8_t *k; + u_int32_t h, loop; + + if (len == 0) + return (0); + +#define HASH4a h = (h << 5) - h + *k++; +#define HASH4b h = (h << 5) + h + *k++; +#define HASH4 HASH4b + h = 0; + k = key; + + loop = (len + 8 - 1) >> 3; + switch (len & (8 - 1)) { + case 0: + do { + HASH4; + case 7: + HASH4; + case 6: + HASH4; + case 5: + HASH4; + case 4: + HASH4; + case 3: + HASH4; + case 2: + HASH4; + case 1: + HASH4; + } while (--loop); + } + return (h); +} + +/* + * Fowler/Noll/Vo hash + * + * The basis of the hash algorithm was taken from an idea sent by email to the + * IEEE Posix P1003.2 mailing list from Phong Vo (kpv@research.att.com) and + * Glenn Fowler (gsf@research.att.com). Landon Curt Noll (chongo@toad.com) + * later improved on their algorithm. + * + * The magic is in the interesting relationship between the special prime + * 16777619 (2^24 + 403) and 2^32 and 2^8. + * + * This hash produces the fewest collisions of any function that we've seen so + * far, and works well on both numbers and strings. + * + * PUBLIC: u_int32_t __ham_func5 __P((const void *, u_int32_t)); + */ +u_int32_t +__ham_func5(key, len) + const void *key; + u_int32_t len; +{ + const u_int8_t *k, *e; + u_int32_t h; + + k = key; + e = k + len; + for (h = 0; k < e; ++k) { + h *= 16777619; + h ^= *k; + } + return (h); +} diff --git a/mozilla/db/hash/hash_page.c b/mozilla/db/hash/hash_page.c new file mode 100644 index 00000000000..ce692f2e41f --- /dev/null +++ b/mozilla/db/hash/hash_page.c @@ -0,0 +1,1870 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * 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. 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)hash_page.c 10.40 (Sleepycat) 6/2/98"; +#endif /* not lint */ + +/* + * PACKAGE: hashing + * + * DESCRIPTION: + * Page manipulation for hashing package. + * + * ROUTINES: + * + * External + * __get_page + * __add_ovflpage + * __overflow_page + * Internal + * open_temp + */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "hash.h" + +static int __ham_lock_bucket __P((DB *, HASH_CURSOR *, db_lockmode_t)); + +#ifdef DEBUG_SLOW +static void __account_page(HTAB *, db_pgno_t, int); +#endif + +/* + * PUBLIC: int __ham_item __P((HTAB *, HASH_CURSOR *, db_lockmode_t)); + */ +int +__ham_item(hashp, cursorp, mode) + HTAB *hashp; + HASH_CURSOR *cursorp; + db_lockmode_t mode; +{ + db_pgno_t next_pgno; + int ret; + + if (F_ISSET(cursorp, H_DELETED)) + return (EINVAL); + F_CLR(cursorp, H_OK | H_NOMORE); + + /* Check if we need to get a page for this cursor. */ + if ((ret = __ham_get_cpage(hashp, cursorp, mode)) != 0) + return (ret); + + /* Check if we are looking for space in which to insert an item. */ + if (cursorp->seek_size && cursorp->seek_found_page == PGNO_INVALID + && cursorp->seek_size < P_FREESPACE(cursorp->pagep)) + cursorp->seek_found_page = cursorp->pgno; + + /* Check if we need to go on to the next page. */ + if (F_ISSET(cursorp, H_ISDUP) && cursorp->dpgno == PGNO_INVALID) + /* + * ISDUP is set, and offset is at the beginning of the datum. + * We need to grab the length of the datum, then set the datum + * pointer to be the beginning of the datum. + */ + memcpy(&cursorp->dup_len, + HKEYDATA_DATA(H_PAIRDATA(cursorp->pagep, cursorp->bndx)) + + cursorp->dup_off, sizeof(db_indx_t)); + else if (F_ISSET(cursorp, H_ISDUP)) { + /* Make sure we're not about to run off the page. */ + if (cursorp->dpagep == NULL && (ret = __ham_get_page(hashp->dbp, + cursorp->dpgno, &cursorp->dpagep)) != 0) + return (ret); + + if (cursorp->dndx >= NUM_ENT(cursorp->dpagep)) { + if (NEXT_PGNO(cursorp->dpagep) == PGNO_INVALID) { + if ((ret = __ham_put_page(hashp->dbp, + cursorp->dpagep, 0)) != 0) + return (ret); + F_CLR(cursorp, H_ISDUP); + cursorp->dpagep = NULL; + cursorp->dpgno = PGNO_INVALID; + cursorp->dndx = NDX_INVALID; + cursorp->bndx++; + } else if ((ret = __ham_next_cpage(hashp, cursorp, + NEXT_PGNO(cursorp->dpagep), 0, H_ISDUP)) != 0) + return (ret); + } + } + + if (cursorp->bndx >= (db_indx_t)H_NUMPAIRS(cursorp->pagep)) { + /* Fetch next page. */ + if (NEXT_PGNO(cursorp->pagep) == PGNO_INVALID) { + F_SET(cursorp, H_NOMORE); + if (cursorp->dpagep != NULL && + (ret = __ham_put_page(hashp->dbp, + cursorp->dpagep, 0)) != 0) + return (ret); + cursorp->dpgno = PGNO_INVALID; + return (DB_NOTFOUND); + } + next_pgno = NEXT_PGNO(cursorp->pagep); + cursorp->bndx = 0; + if ((ret = __ham_next_cpage(hashp, + cursorp, next_pgno, 0, 0)) != 0) + return (ret); + } + + F_SET(cursorp, H_OK); + return (0); +} + +/* + * PUBLIC: int __ham_item_reset __P((HTAB *, HASH_CURSOR *)); + */ +int +__ham_item_reset(hashp, cursorp) + HTAB *hashp; + HASH_CURSOR *cursorp; +{ + int ret; + + if (cursorp->pagep) + ret = __ham_put_page(hashp->dbp, cursorp->pagep, 0); + else + ret = 0; + + __ham_item_init(cursorp); + return (ret); +} + +/* + * PUBLIC: void __ham_item_init __P((HASH_CURSOR *)); + */ +void +__ham_item_init(cursorp) + HASH_CURSOR *cursorp; +{ + cursorp->pagep = NULL; + cursorp->bucket = BUCKET_INVALID; + cursorp->lock = 0; + cursorp->bndx = NDX_INVALID; + cursorp->pgno = PGNO_INVALID; + cursorp->dpgno = PGNO_INVALID; + cursorp->dndx = NDX_INVALID; + cursorp->dpagep = NULL; + cursorp->flags = 0; + cursorp->seek_size = 0; + cursorp->seek_found_page = PGNO_INVALID; +} + +/* + * PUBLIC: int __ham_item_done __P((HTAB *, HASH_CURSOR *, int)); + */ +int +__ham_item_done(hashp, cursorp, dirty) + HTAB *hashp; + HASH_CURSOR *cursorp; + int dirty; +{ + int ret, t_ret; + + t_ret = ret = 0; + + if (cursorp->pagep) + ret = __ham_put_page(hashp->dbp, cursorp->pagep, + dirty && cursorp->dpagep == NULL); + cursorp->pagep = NULL; + + if (cursorp->dpagep) + t_ret = __ham_put_page(hashp->dbp, cursorp->dpagep, dirty); + cursorp->dpagep = NULL; + + if (ret == 0 && t_ret != 0) + ret = t_ret; + + /* + * If we are running with transactions, then we must + * not relinquish locks explicitly. + */ + if (cursorp->lock && hashp->dbp->txn == NULL) + t_ret = lock_put(hashp->dbp->dbenv->lk_info, cursorp->lock); + cursorp->lock = 0; + + + /* + * We don't throw out the page number since we might want to + * continue getting on this page. + */ + return (ret != 0 ? ret : t_ret); +} + +/* + * Returns the last item in a bucket. + * + * PUBLIC: int __ham_item_last __P((HTAB *, HASH_CURSOR *, db_lockmode_t)); + */ +int +__ham_item_last(hashp, cursorp, mode) + HTAB *hashp; + HASH_CURSOR *cursorp; + db_lockmode_t mode; +{ + int ret; + + if ((ret = __ham_item_reset(hashp, cursorp)) != 0) + return (ret); + + cursorp->bucket = hashp->hdr->max_bucket; + F_SET(cursorp, H_OK); + return (__ham_item_prev(hashp, cursorp, mode)); +} + +/* + * PUBLIC: int __ham_item_first __P((HTAB *, HASH_CURSOR *, db_lockmode_t)); + */ +int +__ham_item_first(hashp, cursorp, mode) + HTAB *hashp; + HASH_CURSOR *cursorp; + db_lockmode_t mode; +{ + int ret; + + if ((ret = __ham_item_reset(hashp, cursorp)) != 0) + return (ret); + F_SET(cursorp, H_OK); + cursorp->bucket = 0; + return (__ham_item_next(hashp, cursorp, mode)); +} + +/* + * __ham_item_prev -- + * Returns a pointer to key/data pair on a page. In the case of + * bigkeys, just returns the page number and index of the bigkey + * pointer pair. + * + * PUBLIC: int __ham_item_prev __P((HTAB *, HASH_CURSOR *, db_lockmode_t)); + */ +int +__ham_item_prev(hashp, cursorp, mode) + HTAB *hashp; + HASH_CURSOR *cursorp; + db_lockmode_t mode; +{ + db_pgno_t next_pgno; + int ret; + + /* + * There are N cases for backing up in a hash file. + * Case 1: In the middle of a page, no duplicates, just dec the index. + * Case 2: In the middle of a duplicate set, back up one. + * Case 3: At the beginning of a duplicate set, get out of set and + * back up to next key. + * Case 4: At the beginning of a page; go to previous page. + * Case 5: At the beginning of a bucket; go to prev bucket. + */ + F_CLR(cursorp, H_OK | H_NOMORE | H_DELETED); + + /* + * First handle the duplicates. Either you'll get the key here + * or you'll exit the duplicate set and drop into the code below + * to handle backing up through keys. + */ + if (F_ISSET(cursorp, H_ISDUP)) { + if (cursorp->dpgno == PGNO_INVALID) { + /* Duplicates are on-page. */ + if (cursorp->dup_off != 0) + if ((ret = __ham_get_cpage(hashp, + cursorp, mode)) != 0) + return (ret); + else { + HASH_CURSOR *h; + h = cursorp; + memcpy(&h->dup_len, HKEYDATA_DATA( + H_PAIRDATA(h->pagep, h->bndx)) + + h->dup_off - sizeof(db_indx_t), + sizeof(db_indx_t)); + cursorp->dup_off -= + DUP_SIZE(cursorp->dup_len); + cursorp->dndx--; + return (__ham_item(hashp, + cursorp, mode)); + } + } else if (cursorp->dndx > 0) { /* Duplicates are off-page. */ + cursorp->dndx--; + return (__ham_item(hashp, cursorp, mode)); + } else if ((ret = __ham_get_cpage(hashp, cursorp, mode)) != 0) + return (ret); + else if (PREV_PGNO(cursorp->dpagep) == PGNO_INVALID) { + F_CLR(cursorp, H_ISDUP); /* End of dups */ + cursorp->dpgno = PGNO_INVALID; + if (cursorp->dpagep != NULL) + (void)__ham_put_page(hashp->dbp, + cursorp->dpagep, 0); + cursorp->dpagep = NULL; + } else if ((ret = __ham_next_cpage(hashp, cursorp, + PREV_PGNO(cursorp->dpagep), 0, H_ISDUP)) != 0) + return (ret); + else { + cursorp->dndx = NUM_ENT(cursorp->pagep) - 1; + return (__ham_item(hashp, cursorp, mode)); + } + } + + /* + * If we get here, we are not in a duplicate set, and just need + * to back up the cursor. There are still three cases: + * midpage, beginning of page, beginning of bucket. + */ + + if (cursorp->bndx == 0) { /* Beginning of page. */ + if ((ret = __ham_get_cpage(hashp, cursorp, mode)) != 0) + return (ret); + cursorp->pgno = PREV_PGNO(cursorp->pagep); + if (cursorp->pgno == PGNO_INVALID) { + /* Beginning of bucket. */ + F_SET(cursorp, H_NOMORE); + return (DB_NOTFOUND); + } else if ((ret = __ham_next_cpage(hashp, + cursorp, cursorp->pgno, 0, 0)) != 0) + return (ret); + else + cursorp->bndx = H_NUMPAIRS(cursorp->pagep); + } + + /* + * Either we've got the cursor set up to be decremented, or we + * have to find the end of a bucket. + */ + if (cursorp->bndx == NDX_INVALID) { + if (cursorp->pagep == NULL) + next_pgno = BUCKET_TO_PAGE(hashp, cursorp->bucket); + else + goto got_page; + + do { + if ((ret = __ham_next_cpage(hashp, + cursorp, next_pgno, 0, 0)) != 0) + return (ret); +got_page: next_pgno = NEXT_PGNO(cursorp->pagep); + cursorp->bndx = H_NUMPAIRS(cursorp->pagep); + } while (next_pgno != PGNO_INVALID); + + if (cursorp->bndx == 0) { + /* Bucket was empty. */ + F_SET(cursorp, H_NOMORE); + return (DB_NOTFOUND); + } + } + + cursorp->bndx--; + + return (__ham_item(hashp, cursorp, mode)); +} + +/* + * Sets the cursor to the next key/data pair on a page. + * + * PUBLIC: int __ham_item_next __P((HTAB *, HASH_CURSOR *, db_lockmode_t)); + */ +int +__ham_item_next(hashp, cursorp, mode) + HTAB *hashp; + HASH_CURSOR *cursorp; + db_lockmode_t mode; +{ + /* + * Deleted on-page duplicates are a weird case. If we delete the last + * one, then our cursor is at the very end of a duplicate set and + * we actually need to go on to the next key. + */ + if (F_ISSET(cursorp, H_DELETED)) { + if (cursorp->bndx != NDX_INVALID && + F_ISSET(cursorp, H_ISDUP) && + cursorp->dpgno == PGNO_INVALID && + cursorp->dup_tlen == cursorp->dup_off) { + F_CLR(cursorp, H_ISDUP); + cursorp->dpgno = PGNO_INVALID; + cursorp->bndx++; + } + F_CLR(cursorp, H_DELETED); + } else if (cursorp->bndx == NDX_INVALID) { + cursorp->bndx = 0; + cursorp->dpgno = PGNO_INVALID; + F_CLR(cursorp, H_ISDUP); + } else if (F_ISSET(cursorp, H_ISDUP) && cursorp->dpgno != PGNO_INVALID) + cursorp->dndx++; + else if (F_ISSET(cursorp, H_ISDUP)) { + cursorp->dndx++; + cursorp->dup_off += DUP_SIZE(cursorp->dup_len); + if (cursorp->dup_off >= cursorp->dup_tlen) { + F_CLR(cursorp, H_ISDUP); + cursorp->dpgno = PGNO_INVALID; + cursorp->bndx++; + } + } else + cursorp->bndx++; + + return (__ham_item(hashp, cursorp, mode)); +} + +/* + * PUBLIC: void __ham_putitem __P((PAGE *p, const DBT *, int)); + * + * This is a little bit sleazy in that we're overloading the meaning + * of the H_OFFPAGE type here. When we recover deletes, we have the + * entire entry instead of having only the DBT, so we'll pass type + * H_OFFPAGE to mean, "copy the whole entry" as opposed to constructing + * an H_KEYDATA around it. + */ +void +__ham_putitem(p, dbt, type) + PAGE *p; + const DBT *dbt; + int type; +{ + u_int16_t n, off; + + n = NUM_ENT(p); + + /* Put the item element on the page. */ + if (type == H_OFFPAGE) { + off = HOFFSET(p) - dbt->size; + HOFFSET(p) = p->inp[n] = off; + memcpy(P_ENTRY(p, n), dbt->data, dbt->size); + } else { + off = HOFFSET(p) - HKEYDATA_SIZE(dbt->size); + HOFFSET(p) = p->inp[n] = off; + PUT_HKEYDATA(P_ENTRY(p, n), dbt->data, dbt->size, type); + } + + /* Adjust page info. */ + NUM_ENT(p) += 1; +} + +/* + * PUBLIC: void __ham_reputpair + * PUBLIC: __P((PAGE *p, u_int32_t, u_int32_t, const DBT *, const DBT *)); + * + * This is a special case to restore a key/data pair to its original + * location during recovery. We are guaranteed that the pair fits + * on the page and is not the last pair on the page (because if it's + * the last pair, the normal insert works). + */ +void +__ham_reputpair(p, psize, ndx, key, data) + PAGE *p; + u_int32_t psize, ndx; + const DBT *key, *data; +{ + db_indx_t i, movebytes, newbytes; + u_int8_t *from; + + /* First shuffle the existing items up on the page. */ + movebytes = + (ndx == 0 ? psize : p->inp[H_DATAINDEX(ndx - 1)]) - HOFFSET(p); + newbytes = key->size + data->size; + from = (u_int8_t *)p + HOFFSET(p); + memmove(from - newbytes, from, movebytes); + + /* + * Adjust the indices and move them up 2 spaces. Note that we + * have to check the exit condition inside the loop just in case + * we are dealing with index 0 (db_indx_t's are unsigned). + */ + for (i = NUM_ENT(p) - 1; ; i-- ) { + p->inp[i + 2] = p->inp[i] - newbytes; + if (i == H_KEYINDEX(ndx)) + break; + } + + /* Put the key and data on the page. */ + p->inp[H_KEYINDEX(ndx)] = + (ndx == 0 ? psize : p->inp[H_DATAINDEX(ndx - 1)]) - key->size; + p->inp[H_DATAINDEX(ndx)] = p->inp[H_KEYINDEX(ndx)] - data->size; + memcpy(P_ENTRY(p, H_KEYINDEX(ndx)), key->data, key->size); + memcpy(P_ENTRY(p, H_DATAINDEX(ndx)), data->data, data->size); + + /* Adjust page info. */ + HOFFSET(p) -= newbytes; + NUM_ENT(p) += 2; +} + + +/* + * PUBLIC: int __ham_del_pair __P((HTAB *, HASH_CURSOR *, int)); + * + * XXX + * TODO: if the item is an offdup, delete the other pages and then remove + * the pair. If the offpage page is 0, then you can just remove the pair. + */ +int +__ham_del_pair(hashp, cursorp, reclaim_page) + HTAB *hashp; + HASH_CURSOR *cursorp; + int reclaim_page; +{ + DBT data_dbt, key_dbt; + DB_ENV *dbenv; + DB_LSN new_lsn, *n_lsn, tmp_lsn; + PAGE *p; + db_indx_t ndx; + db_pgno_t chg_pgno, pgno; + int ret, tret; + + dbenv = hashp->dbp->dbenv; + ndx = cursorp->bndx; + if (cursorp->pagep == NULL && (ret = + __ham_get_page(hashp->dbp, cursorp->pgno, &cursorp->pagep)) != 0) + return (ret); + + p = cursorp->pagep; + + /* + * We optimize for the normal case which is when neither the key nor + * the data are large. In this case, we write a single log record + * and do the delete. If either is large, we'll call __big_delete + * to remove the big item and then update the page to remove the + * entry referring to the big item. + */ + ret = 0; + if (HPAGE_PTYPE(H_PAIRKEY(p, ndx)) == H_OFFPAGE) { + memcpy(&pgno, HOFFPAGE_PGNO(P_ENTRY(p, H_KEYINDEX(ndx))), + sizeof(db_pgno_t)); + ret = __db_doff(hashp->dbp, pgno, __ham_del_page); + } + + if (ret == 0) + switch (HPAGE_PTYPE(H_PAIRDATA(p, ndx))) { + case H_OFFPAGE: + memcpy(&pgno, + HOFFPAGE_PGNO(P_ENTRY(p, H_DATAINDEX(ndx))), + sizeof(db_pgno_t)); + ret = __db_doff(hashp->dbp, pgno, __ham_del_page); + break; + case H_OFFDUP: + memcpy(&pgno, + HOFFDUP_PGNO(P_ENTRY(p, H_DATAINDEX(ndx))), + sizeof(db_pgno_t)); + ret = __db_ddup(hashp->dbp, pgno, __ham_del_page); + F_CLR(cursorp, H_ISDUP); + break; + case H_DUPLICATE: + /* + * If we delete a pair that is/was a duplicate, then + * we had better clear the flag so that we update the + * cursor appropriately. + */ + F_CLR(cursorp, H_ISDUP); + break; + } + + if (ret) + return (ret); + + /* Now log the delete off this page. */ + if (DB_LOGGING(hashp->dbp)) { + key_dbt.data = P_ENTRY(p, H_KEYINDEX(ndx)); + key_dbt.size = + LEN_HITEM(p, hashp->hdr->pagesize, H_KEYINDEX(ndx)); + data_dbt.data = P_ENTRY(p, H_DATAINDEX(ndx)); + data_dbt.size = + LEN_HITEM(p, hashp->hdr->pagesize, H_DATAINDEX(ndx)); + + if ((ret = __ham_insdel_log(dbenv->lg_info, + (DB_TXN *)hashp->dbp->txn, &new_lsn, 0, DELPAIR, + hashp->dbp->log_fileid, PGNO(p), (u_int32_t)ndx, + &LSN(p), &key_dbt, &data_dbt)) != 0) + return (ret); + + /* Move lsn onto page. */ + LSN(p) = new_lsn; + } + + __ham_dpair(hashp->dbp, p, ndx); + + /* + * If we are locking, we will not maintain this. + * XXXX perhaps we can retain incremental numbers and apply them + * later. + */ + if (!F_ISSET(hashp->dbp, DB_AM_LOCKING)) + --hashp->hdr->nelem; + + /* + * If we need to reclaim the page, then check if the page is empty. + * There are two cases. If it's empty and it's not the first page + * in the bucket (i.e., the bucket page) then we can simply remove + * it. If it is the first chain in the bucket, then we need to copy + * the second page into it and remove the second page. + */ + if (reclaim_page && NUM_ENT(p) == 0 && PREV_PGNO(p) == PGNO_INVALID && + NEXT_PGNO(p) != PGNO_INVALID) { + PAGE *n_pagep, *nn_pagep; + db_pgno_t tmp_pgno; + + /* + * First page in chain is empty and we know that there + * are more pages in the chain. + */ + if ((ret = + __ham_get_page(hashp->dbp, NEXT_PGNO(p), &n_pagep)) != 0) + return (ret); + + if (NEXT_PGNO(n_pagep) != PGNO_INVALID) { + if ((ret = + __ham_get_page(hashp->dbp, NEXT_PGNO(n_pagep), + &nn_pagep)) != 0) { + (void) __ham_put_page(hashp->dbp, n_pagep, 0); + return (ret); + } + } + + if (DB_LOGGING(hashp->dbp)) { + key_dbt.data = n_pagep; + key_dbt.size = hashp->hdr->pagesize; + if ((ret = __ham_copypage_log(dbenv->lg_info, + (DB_TXN *)hashp->dbp->txn, &new_lsn, 0, + hashp->dbp->log_fileid, PGNO(p), &LSN(p), + PGNO(n_pagep), &LSN(n_pagep), NEXT_PGNO(n_pagep), + NEXT_PGNO(n_pagep) == PGNO_INVALID ? NULL : + &LSN(nn_pagep), &key_dbt)) != 0) + return (ret); + + /* Move lsn onto page. */ + LSN(p) = new_lsn; /* Structure assignment. */ + LSN(n_pagep) = new_lsn; + if (NEXT_PGNO(n_pagep) != PGNO_INVALID) + LSN(nn_pagep) = new_lsn; + } + if (NEXT_PGNO(n_pagep) != PGNO_INVALID) { + PREV_PGNO(nn_pagep) = PGNO(p); + (void)__ham_put_page(hashp->dbp, nn_pagep, 1); + } + + tmp_pgno = PGNO(p); + tmp_lsn = LSN(p); + memcpy(p, n_pagep, hashp->hdr->pagesize); + PGNO(p) = tmp_pgno; + LSN(p) = tmp_lsn; + PREV_PGNO(p) = PGNO_INVALID; + + /* + * Cursor is advanced to the beginning of the next page. + */ + cursorp->bndx = 0; + cursorp->pgno = PGNO(p); + F_SET(cursorp, H_DELETED); + chg_pgno = PGNO(p); + if ((ret = __ham_dirty_page(hashp, p)) != 0 || + (ret = __ham_del_page(hashp->dbp, n_pagep)) != 0) + return (ret); + } else if (reclaim_page && + NUM_ENT(p) == 0 && PREV_PGNO(p) != PGNO_INVALID) { + PAGE *n_pagep, *p_pagep; + + if ((ret = + __ham_get_page(hashp->dbp, PREV_PGNO(p), &p_pagep)) != 0) + return (ret); + + if (NEXT_PGNO(p) != PGNO_INVALID) { + if ((ret = __ham_get_page(hashp->dbp, + NEXT_PGNO(p), &n_pagep)) != 0) { + (void)__ham_put_page(hashp->dbp, p_pagep, 0); + return (ret); + } + n_lsn = &LSN(n_pagep); + } else { + n_pagep = NULL; + n_lsn = NULL; + } + + NEXT_PGNO(p_pagep) = NEXT_PGNO(p); + if (n_pagep != NULL) + PREV_PGNO(n_pagep) = PGNO(p_pagep); + + if (DB_LOGGING(hashp->dbp)) { + if ((ret = __ham_newpage_log(dbenv->lg_info, + (DB_TXN *)hashp->dbp->txn, &new_lsn, 0, DELOVFL, + hashp->dbp->log_fileid, PREV_PGNO(p), &LSN(p_pagep), + PGNO(p), &LSN(p), NEXT_PGNO(p), n_lsn)) != 0) + return (ret); + + /* Move lsn onto page. */ + LSN(p_pagep) = new_lsn; /* Structure assignment. */ + if (n_pagep) + LSN(n_pagep) = new_lsn; + LSN(p) = new_lsn; + } + cursorp->pgno = NEXT_PGNO(p); + cursorp->bndx = 0; + /* + * Since we are about to delete the cursor page and we have + * just moved the cursor, we need to make sure that the + * old page pointer isn't left hanging around in the cursor. + */ + cursorp->pagep = NULL; + chg_pgno = PGNO(p); + ret = __ham_del_page(hashp->dbp, p); + if ((tret = __ham_put_page(hashp->dbp, p_pagep, 1)) != 0 && + ret == 0) + ret = tret; + if (n_pagep != NULL && + (tret = __ham_put_page(hashp->dbp, n_pagep, 1)) != 0 && + ret == 0) + ret = tret; + if (ret != 0) + return (ret); + } else { + /* + * Mark item deleted so that we don't try to return it, and + * so that we update the cursor correctly on the next call + * to next. + */ + F_SET(cursorp, H_DELETED); + chg_pgno = cursorp->pgno; + ret = __ham_dirty_page(hashp, p); + } + __ham_c_update(cursorp, chg_pgno, 0, 0, 0); + + /* + * Since we just deleted a pair from the master page, anything + * in cursorp->dpgno should be cleared. + */ + cursorp->dpgno = PGNO_INVALID; + + F_CLR(cursorp, H_OK); + return (ret); +} + +/* + * __ham_replpair -- + * Given the key data indicated by the cursor, replace part/all of it + * according to the fields in the dbt. + * + * PUBLIC: int __ham_replpair __P((HTAB *, HASH_CURSOR *, DBT *, u_int32_t)); + */ +int +__ham_replpair(hashp, hcp, dbt, make_dup) + HTAB *hashp; + HASH_CURSOR *hcp; + DBT *dbt; + u_int32_t make_dup; +{ + DBT old_dbt, tdata, tmp; + DB_LSN new_lsn; + int32_t change; /* XXX: Possible overflow. */ + u_int32_t len; + int is_big, ret, type; + u_int8_t *beg, *dest, *end, *hk, *src; + + /* + * Big item replacements are handled in generic code. + * Items that fit on the current page fall into 4 classes. + * 1. On-page element, same size + * 2. On-page element, new is bigger (fits) + * 3. On-page element, new is bigger (does not fit) + * 4. On-page element, old is bigger + * Numbers 1, 2, and 4 are essentially the same (and should + * be the common case). We handle case 3 as a delete and + * add. + */ + + /* + * We need to compute the number of bytes that we are adding or + * removing from the entry. Normally, we can simply substract + * the number of bytes we are replacing (dbt->dlen) from the + * number of bytes we are inserting (dbt->size). However, if + * we are doing a partial put off the end of a record, then this + * formula doesn't work, because we are essentially adding + * new bytes. + */ + change = dbt->size - dbt->dlen; + + hk = H_PAIRDATA(hcp->pagep, hcp->bndx); + is_big = HPAGE_PTYPE(hk) == H_OFFPAGE; + + if (is_big) + memcpy(&len, HOFFPAGE_TLEN(hk), sizeof(u_int32_t)); + else + len = LEN_HKEYDATA(hcp->pagep, + hashp->dbp->pgsize, H_DATAINDEX(hcp->bndx)); + + if (dbt->doff + dbt->dlen > len) + change += dbt->doff + dbt->dlen - len; + + + if (change > (int32_t)P_FREESPACE(hcp->pagep) || is_big) { + /* + * Case 3 -- two subcases. + * A. This is not really a partial operation, but an overwrite. + * Simple del and add works. + * B. This is a partial and we need to construct the data that + * we are really inserting (yuck). + * In both cases, we need to grab the key off the page (in + * some cases we could do this outside of this routine; for + * cleanliness we do it here. If you happen to be on a big + * key, this could be a performance hit). + */ + tmp.flags = 0; + F_SET(&tmp, DB_DBT_MALLOC | DB_DBT_INTERNAL); + if ((ret = + __db_ret(hashp->dbp, hcp->pagep, H_KEYINDEX(hcp->bndx), + &tmp, &hcp->big_key, &hcp->big_keylen)) != 0) + return (ret); + + if (dbt->doff == 0 && dbt->dlen == len) { + ret = __ham_del_pair(hashp, hcp, 0); + if (ret == 0) + ret = __ham_add_el(hashp, + hcp, &tmp, dbt, H_KEYDATA); + } else { /* Case B */ + type = HPAGE_PTYPE(hk) != H_OFFPAGE ? + HPAGE_PTYPE(hk) : H_KEYDATA; + tdata.flags = 0; + F_SET(&tdata, DB_DBT_MALLOC | DB_DBT_INTERNAL); + + if ((ret = __db_ret(hashp->dbp, hcp->pagep, + H_DATAINDEX(hcp->bndx), &tdata, &hcp->big_data, + &hcp->big_datalen)) != 0) + goto err; + + /* Now we can delete the item. */ + if ((ret = __ham_del_pair(hashp, hcp, 0)) != 0) { + __db_free(tdata.data); + goto err; + } + + /* Now shift old data around to make room for new. */ + if (change > 0) { + tdata.data = (void *)__db_realloc(tdata.data, + tdata.size + change); + memset((u_int8_t *)tdata.data + tdata.size, + 0, change); + } + if (tdata.data == NULL) + return (ENOMEM); + end = (u_int8_t *)tdata.data + tdata.size; + + src = (u_int8_t *)tdata.data + dbt->doff + dbt->dlen; + if (src < end && tdata.size > dbt->doff + dbt->dlen) { + len = tdata.size - dbt->doff - dbt->dlen; + dest = src + change; + memmove(dest, src, len); + } + memcpy((u_int8_t *)tdata.data + dbt->doff, + dbt->data, dbt->size); + tdata.size += change; + + /* Now add the pair. */ + ret = __ham_add_el(hashp, hcp, &tmp, &tdata, type); + __db_free(tdata.data); + } +err: __db_free(tmp.data); + return (ret); + } + + /* + * Set up pointer into existing data. Do it before the log + * message so we can use it inside of the log setup. + */ + beg = HKEYDATA_DATA(H_PAIRDATA(hcp->pagep, hcp->bndx)); + beg += dbt->doff; + + /* + * If we are going to have to move bytes at all, figure out + * all the parameters here. Then log the call before moving + * anything around. + */ + if (DB_LOGGING(hashp->dbp)) { + old_dbt.data = beg; + old_dbt.size = dbt->dlen; + if ((ret = __ham_replace_log(hashp->dbp->dbenv->lg_info, + (DB_TXN *)hashp->dbp->txn, &new_lsn, 0, + hashp->dbp->log_fileid, PGNO(hcp->pagep), + (u_int32_t)H_DATAINDEX(hcp->bndx), &LSN(hcp->pagep), + (u_int32_t)dbt->doff, &old_dbt, dbt, make_dup)) != 0) + return (ret); + + LSN(hcp->pagep) = new_lsn; /* Structure assignment. */ + } + + __ham_onpage_replace(hcp->pagep, hashp->dbp->pgsize, + (u_int32_t)H_DATAINDEX(hcp->bndx), (int32_t)dbt->doff, change, dbt); + + return (0); +} + +/* + * Replace data on a page with new data, possibly growing or shrinking what's + * there. This is called on two different occasions. On one (from replpair) + * we are interested in changing only the data. On the other (from recovery) + * we are replacing the entire data (header and all) with a new element. In + * the latter case, the off argument is negative. + * pagep: the page that we're changing + * ndx: page index of the element that is growing/shrinking. + * off: Offset at which we are beginning the replacement. + * change: the number of bytes (+ or -) that the element is growing/shrinking. + * dbt: the new data that gets written at beg. + * PUBLIC: void __ham_onpage_replace __P((PAGE *, size_t, u_int32_t, int32_t, + * PUBLIC: int32_t, DBT *)); + */ +void +__ham_onpage_replace(pagep, pgsize, ndx, off, change, dbt) + PAGE *pagep; + size_t pgsize; + u_int32_t ndx; + int32_t off; + int32_t change; + DBT *dbt; +{ + db_indx_t i; + int32_t len; + u_int8_t *src, *dest; + int zero_me; + + if (change != 0) { + zero_me = 0; + src = (u_int8_t *)(pagep) + HOFFSET(pagep); + if (off < 0) + len = pagep->inp[ndx] - HOFFSET(pagep); + else if ((u_int32_t)off >= LEN_HKEYDATA(pagep, pgsize, ndx)) { + len = HKEYDATA_DATA(P_ENTRY(pagep, ndx)) + + LEN_HKEYDATA(pagep, pgsize, ndx) - src; + zero_me = 1; + } else + len = (HKEYDATA_DATA(P_ENTRY(pagep, ndx)) + off) - src; + dest = src - change; + memmove(dest, src, len); + if (zero_me) + memset(dest + len, 0, change); + + /* Now update the indices. */ + for (i = ndx; i < NUM_ENT(pagep); i++) + pagep->inp[i] -= change; + HOFFSET(pagep) -= change; + } + if (off >= 0) + memcpy(HKEYDATA_DATA(P_ENTRY(pagep, ndx)) + off, + dbt->data, dbt->size); + else + memcpy(P_ENTRY(pagep, ndx), dbt->data, dbt->size); +} + +/* + * PUBLIC: int __ham_split_page __P((HTAB *, u_int32_t, u_int32_t)); + */ +int +__ham_split_page(hashp, obucket, nbucket) + HTAB *hashp; + u_int32_t obucket, nbucket; +{ + DBT key, page_dbt; + DB_ENV *dbenv; + DB_LSN new_lsn; + PAGE **pp, *old_pagep, *temp_pagep, *new_pagep; + db_indx_t n; + db_pgno_t bucket_pgno, next_pgno; + u_int32_t big_len, len; + int ret, tret; + void *big_buf; + + dbenv = hashp->dbp->dbenv; + temp_pagep = old_pagep = new_pagep = NULL; + + bucket_pgno = BUCKET_TO_PAGE(hashp, obucket); + if ((ret = __ham_get_page(hashp->dbp, bucket_pgno, &old_pagep)) != 0) + return (ret); + if ((ret = __ham_new_page(hashp, BUCKET_TO_PAGE(hashp, nbucket), P_HASH, + &new_pagep)) != 0) + goto err; + + temp_pagep = hashp->split_buf; + memcpy(temp_pagep, old_pagep, hashp->hdr->pagesize); + + if (DB_LOGGING(hashp->dbp)) { + page_dbt.size = hashp->hdr->pagesize; + page_dbt.data = old_pagep; + if ((ret = __ham_splitdata_log(dbenv->lg_info, + (DB_TXN *)hashp->dbp->txn, &new_lsn, 0, + hashp->dbp->log_fileid, SPLITOLD, PGNO(old_pagep), + &page_dbt, &LSN(old_pagep))) != 0) + goto err; + } + + P_INIT(old_pagep, hashp->hdr->pagesize, PGNO(old_pagep), PGNO_INVALID, + PGNO_INVALID, 0, P_HASH); + + if (DB_LOGGING(hashp->dbp)) + LSN(old_pagep) = new_lsn; /* Structure assignment. */ + + big_len = 0; + big_buf = NULL; + key.flags = 0; + while (temp_pagep != NULL) { + for (n = 0; n < (db_indx_t)H_NUMPAIRS(temp_pagep); n++) { + if ((ret = + __db_ret(hashp->dbp, temp_pagep, H_KEYINDEX(n), + &key, &big_buf, &big_len)) != 0) + goto err; + + if (__ham_call_hash(hashp, key.data, key.size) + == obucket) + pp = &old_pagep; + else + pp = &new_pagep; + + /* + * Figure out how many bytes we need on the new + * page to store the key/data pair. + */ + + len = LEN_HITEM(temp_pagep, hashp->hdr->pagesize, + H_DATAINDEX(n)) + + LEN_HITEM(temp_pagep, hashp->hdr->pagesize, + H_KEYINDEX(n)) + + 2 * sizeof(db_indx_t); + + if (P_FREESPACE(*pp) < len) { + if (DB_LOGGING(hashp->dbp)) { + page_dbt.size = hashp->hdr->pagesize; + page_dbt.data = *pp; + if ((ret = __ham_splitdata_log( + dbenv->lg_info, + (DB_TXN *)hashp->dbp->txn, + &new_lsn, 0, + hashp->dbp->log_fileid, SPLITNEW, + PGNO(*pp), &page_dbt, + &LSN(*pp))) != 0) + goto err; + LSN(*pp) = new_lsn; + } + if ((ret = __ham_add_ovflpage(hashp, + *pp, 1, pp)) != 0) + goto err; + } + __ham_copy_item(hashp, temp_pagep, H_KEYINDEX(n), *pp); + __ham_copy_item(hashp, temp_pagep, H_DATAINDEX(n), *pp); + } + next_pgno = NEXT_PGNO(temp_pagep); + + /* Clear temp_page; if it's a link overflow page, free it. */ + if (PGNO(temp_pagep) != bucket_pgno && (ret = + __ham_del_page(hashp->dbp, temp_pagep)) != 0) + goto err; + + if (next_pgno == PGNO_INVALID) + temp_pagep = NULL; + else if ((ret = + __ham_get_page(hashp->dbp, next_pgno, &temp_pagep)) != 0) + goto err; + + if (temp_pagep != NULL && DB_LOGGING(hashp->dbp)) { + page_dbt.size = hashp->hdr->pagesize; + page_dbt.data = temp_pagep; + if ((ret = __ham_splitdata_log(dbenv->lg_info, + (DB_TXN *)hashp->dbp->txn, &new_lsn, 0, + hashp->dbp->log_fileid, SPLITOLD, PGNO(temp_pagep), + &page_dbt, &LSN(temp_pagep))) != 0) + goto err; + LSN(temp_pagep) = new_lsn; + } + } + if (big_buf != NULL) + __db_free(big_buf); + + /* + * If the original bucket spanned multiple pages, then we've got + * a pointer to a page that used to be on the bucket chain. It + * should be deleted. + */ + if (temp_pagep != NULL && PGNO(temp_pagep) != bucket_pgno && + (ret = __ham_del_page(hashp->dbp, temp_pagep)) != 0) + goto err; + + /* + * Write new buckets out. + */ + if (DB_LOGGING(hashp->dbp)) { + page_dbt.size = hashp->hdr->pagesize; + page_dbt.data = old_pagep; + if ((ret = __ham_splitdata_log(dbenv->lg_info, + (DB_TXN *)hashp->dbp->txn, &new_lsn, 0, + hashp->dbp->log_fileid, SPLITNEW, PGNO(old_pagep), + &page_dbt, &LSN(old_pagep))) != 0) + goto err; + LSN(old_pagep) = new_lsn; + + page_dbt.data = new_pagep; + if ((ret = __ham_splitdata_log(dbenv->lg_info, + (DB_TXN *)hashp->dbp->txn, &new_lsn, 0, + hashp->dbp->log_fileid, SPLITNEW, PGNO(new_pagep), + &page_dbt, &LSN(new_pagep))) != 0) + goto err; + LSN(new_pagep) = new_lsn; + } + ret = __ham_put_page(hashp->dbp, old_pagep, 1); + if ((tret = __ham_put_page(hashp->dbp, new_pagep, 1)) != 0 && + ret == 0) + ret = tret; + + if (0) { +err: if (old_pagep != NULL) + (void)__ham_put_page(hashp->dbp, old_pagep, 1); + if (new_pagep != NULL) + (void)__ham_put_page(hashp->dbp, new_pagep, 1); + if (temp_pagep != NULL && PGNO(temp_pagep) != bucket_pgno) + (void)__ham_put_page(hashp->dbp, temp_pagep, 1); + } + return (ret); +} + +/* + * Add the given pair to the page. The page in question may already be + * held (i.e. it was already gotten). If it is, then the page is passed + * in via the pagep parameter. On return, pagep will contain the page + * to which we just added something. This allows us to link overflow + * pages and return the new page having correctly put the last page. + * + * PUBLIC: int __ham_add_el + * PUBLIC: __P((HTAB *, HASH_CURSOR *, const DBT *, const DBT *, int)); + */ +int +__ham_add_el(hashp, hcp, key, val, type) + HTAB *hashp; + HASH_CURSOR *hcp; + const DBT *key, *val; + int type; +{ + const DBT *pkey, *pdata; + DBT key_dbt, data_dbt; + DB_LSN new_lsn; + HOFFPAGE doff, koff; + db_pgno_t next_pgno; + u_int32_t data_size, key_size, pairsize, rectype; + int do_expand, is_keybig, is_databig, ret; + int key_type, data_type; + + do_expand = 0; + + if (hcp->pagep == NULL && (ret = __ham_get_page(hashp->dbp, + hcp->seek_found_page != PGNO_INVALID ? hcp->seek_found_page : + hcp->pgno, &hcp->pagep)) != 0) + return (ret); + + key_size = HKEYDATA_PSIZE(key->size); + data_size = HKEYDATA_PSIZE(val->size); + is_keybig = ISBIG(hashp, key->size); + is_databig = ISBIG(hashp, val->size); + if (is_keybig) + key_size = HOFFPAGE_PSIZE; + if (is_databig) + data_size = HOFFPAGE_PSIZE; + + pairsize = key_size + data_size; + + /* Advance to first page in chain with room for item. */ + while (H_NUMPAIRS(hcp->pagep) && NEXT_PGNO(hcp->pagep) != + PGNO_INVALID) { + /* + * This may not be the end of the chain, but the pair may fit + * anyway. Check if it's a bigpair that fits or a regular + * pair that fits. + */ + if (P_FREESPACE(hcp->pagep) >= pairsize) + break; + next_pgno = NEXT_PGNO(hcp->pagep); + if ((ret = + __ham_next_cpage(hashp, hcp, next_pgno, 0, 0)) != 0) + return (ret); + } + + /* + * Check if we need to allocate a new page. + */ + if (P_FREESPACE(hcp->pagep) < pairsize) { + do_expand = 1; + if ((ret = __ham_add_ovflpage(hashp, + hcp->pagep, 1, &hcp->pagep)) != 0) + return (ret); + hcp->pgno = PGNO(hcp->pagep); + } + + /* + * Update cursor. + */ + hcp->bndx = H_NUMPAIRS(hcp->pagep); + F_CLR(hcp, H_DELETED); + if (is_keybig) { + if ((ret = __db_poff(hashp->dbp, + key, &koff.pgno, __ham_overflow_page)) != 0) + return (ret); + koff.type = H_OFFPAGE; + koff.tlen = key->size; + key_dbt.data = &koff; + key_dbt.size = sizeof(koff); + pkey = &key_dbt; + key_type = H_OFFPAGE; + } else { + pkey = key; + key_type = H_KEYDATA; + } + + if (is_databig) { + if ((ret = __db_poff(hashp->dbp, + val, &doff.pgno, __ham_overflow_page)) != 0) + return (ret); + doff.type = H_OFFPAGE; + doff.tlen = val->size; + data_dbt.data = &doff; + data_dbt.size = sizeof(doff); + pdata = &data_dbt; + data_type = H_OFFPAGE; + } else { + pdata = val; + data_type = type; + } + + if (DB_LOGGING(hashp->dbp)) { + rectype = PUTPAIR; + if (is_databig) + rectype |= PAIR_DATAMASK; + if (is_keybig) + rectype |= PAIR_KEYMASK; + + if ((ret = __ham_insdel_log(hashp->dbp->dbenv->lg_info, + (DB_TXN *)hashp->dbp->txn, &new_lsn, 0, rectype, + hashp->dbp->log_fileid, PGNO(hcp->pagep), + (u_int32_t)H_NUMPAIRS(hcp->pagep), + &LSN(hcp->pagep), pkey, pdata)) != 0) + return (ret); + + /* Move lsn onto page. */ + LSN(hcp->pagep) = new_lsn; /* Structure assignment. */ + } + + __ham_putitem(hcp->pagep, pkey, key_type); + __ham_putitem(hcp->pagep, pdata, data_type); + + /* + * For splits, we are going to update item_info's page number + * field, so that we can easily return to the same page the + * next time we come in here. For other operations, this shouldn't + * matter, since odds are this is the last thing that happens before + * we return to the user program. + */ + hcp->pgno = PGNO(hcp->pagep); + + /* + * XXX Maybe keep incremental numbers here + */ + if (!F_ISSET(hashp->dbp, DB_AM_LOCKING)) + hashp->hdr->nelem++; + + if (do_expand || (hashp->hdr->ffactor != 0 && + (u_int32_t)H_NUMPAIRS(hcp->pagep) > hashp->hdr->ffactor)) + F_SET(hcp, H_EXPAND); + return (0); +} + + +/* + * Special __putitem call used in splitting -- copies one entry to + * another. Works for all types of hash entries (H_OFFPAGE, H_KEYDATA, + * H_DUPLICATE, H_OFFDUP). Since we log splits at a high level, we + * do not need to do any logging here. + * + * PUBLIC: void __ham_copy_item __P((HTAB *, PAGE *, u_int32_t, PAGE *)); + */ +void +__ham_copy_item(hashp, src_page, src_ndx, dest_page) + HTAB *hashp; + PAGE *src_page; + u_int32_t src_ndx; + PAGE *dest_page; +{ + u_int32_t len; + void *src, *dest; + + /* + * Copy the key and data entries onto this new page. + */ + src = P_ENTRY(src_page, src_ndx); + + /* Set up space on dest. */ + len = LEN_HITEM(src_page, hashp->hdr->pagesize, src_ndx); + HOFFSET(dest_page) -= len; + dest_page->inp[NUM_ENT(dest_page)] = HOFFSET(dest_page); + dest = P_ENTRY(dest_page, NUM_ENT(dest_page)); + NUM_ENT(dest_page)++; + + memcpy(dest, src, len); +} + +/* + * + * Returns: + * pointer on success + * NULL on error + * + * PUBLIC: int __ham_add_ovflpage __P((HTAB *, PAGE *, int, PAGE **)); + */ +int +__ham_add_ovflpage(hashp, pagep, release, pp) + HTAB *hashp; + PAGE *pagep; + int release; + PAGE **pp; +{ + DB_ENV *dbenv; + DB_LSN new_lsn; + PAGE *new_pagep; + int ret; + + dbenv = hashp->dbp->dbenv; + + if ((ret = __ham_overflow_page(hashp->dbp, P_HASH, &new_pagep)) != 0) + return (ret); + + if (DB_LOGGING(hashp->dbp)) { + if ((ret = __ham_newpage_log(dbenv->lg_info, + (DB_TXN *)hashp->dbp->txn, &new_lsn, 0, PUTOVFL, + hashp->dbp->log_fileid, PGNO(pagep), &LSN(pagep), + PGNO(new_pagep), &LSN(new_pagep), PGNO_INVALID, NULL)) != 0) + return (ret); + + /* Move lsn onto page. */ + LSN(pagep) = LSN(new_pagep) = new_lsn; + } + NEXT_PGNO(pagep) = PGNO(new_pagep); + PREV_PGNO(new_pagep) = PGNO(pagep); + + if (release) + ret = __ham_put_page(hashp->dbp, pagep, 1); + + hashp->hash_overflows++; + *pp = new_pagep; + return (ret); +} + + +/* + * PUBLIC: int __ham_new_page __P((HTAB *, u_int32_t, u_int32_t, PAGE **)); + */ +int +__ham_new_page(hashp, addr, type, pp) + HTAB *hashp; + u_int32_t addr, type; + PAGE **pp; +{ + PAGE *pagep; + int ret; + + if ((ret = memp_fget(hashp->dbp->mpf, + &addr, DB_MPOOL_CREATE, &pagep)) != 0) + return (ret); + +#ifdef DEBUG_SLOW + __account_page(hashp, addr, 1); +#endif + /* This should not be necessary because page-in should do it. */ + P_INIT(pagep, + hashp->hdr->pagesize, addr, PGNO_INVALID, PGNO_INVALID, 0, type); + + *pp = pagep; + return (0); +} + +/* + * PUBLIC: int __ham_del_page __P((DB *, PAGE *)); + */ +int +__ham_del_page(dbp, pagep) + DB *dbp; + PAGE *pagep; +{ + DB_LSN new_lsn; + HTAB *hashp; + int ret; + + hashp = (HTAB *)dbp->internal; + ret = 0; + DIRTY_META(hashp, ret); + if (ret != 0) { + if (ret != EAGAIN) + __db_err(hashp->dbp->dbenv, + "free_ovflpage: unable to lock meta data page %s\n", + strerror(ret)); + /* + * If we are going to return an error, then we should free + * the page, so it doesn't stay pinned forever. + */ + (void)__ham_put_page(hashp->dbp, pagep, 0); + return (ret); + } + + if (DB_LOGGING(hashp->dbp)) { + if ((ret = __ham_newpgno_log(hashp->dbp->dbenv->lg_info, + (DB_TXN *)hashp->dbp->txn, &new_lsn, 0, DELPGNO, + hashp->dbp->log_fileid, PGNO(pagep), hashp->hdr->last_freed, + (u_int32_t)TYPE(pagep), NEXT_PGNO(pagep), P_INVALID, + &LSN(pagep), &hashp->hdr->lsn)) != 0) + return (ret); + + hashp->hdr->lsn = new_lsn; + LSN(pagep) = new_lsn; + } + +#ifdef DIAGNOSTIC + { + db_pgno_t __pgno; + DB_LSN __lsn; + __pgno = pagep->pgno; + __lsn = pagep->lsn; + memset(pagep, 0xff, dbp->pgsize); + pagep->pgno = __pgno; + pagep->lsn = __lsn; + } +#endif + TYPE(pagep) = P_INVALID; + NEXT_PGNO(pagep) = hashp->hdr->last_freed; + hashp->hdr->last_freed = PGNO(pagep); + + return (__ham_put_page(hashp->dbp, pagep, 1)); +} + + +/* + * PUBLIC: int __ham_put_page __P((DB *, PAGE *, int32_t)); + */ +int +__ham_put_page(dbp, pagep, is_dirty) + DB *dbp; + PAGE *pagep; + int32_t is_dirty; +{ +#ifdef DEBUG_SLOW + __account_page((HTAB *)dbp->cookie, + ((BKT *)((char *)pagep - sizeof(BKT)))->pgno, -1); +#endif + return (memp_fput(dbp->mpf, pagep, (is_dirty ? DB_MPOOL_DIRTY : 0))); +} + +/* + * __ham_dirty_page -- + * Mark a page dirty. + * + * PUBLIC: int __ham_dirty_page __P((HTAB *, PAGE *)); + */ +int +__ham_dirty_page(hashp, pagep) + HTAB *hashp; + PAGE *pagep; +{ + return (memp_fset(hashp->dbp->mpf, pagep, DB_MPOOL_DIRTY)); +} + +/* + * PUBLIC: int __ham_get_page __P((DB *, db_pgno_t, PAGE **)); + */ +int +__ham_get_page(dbp, addr, pagep) + DB *dbp; + db_pgno_t addr; + PAGE **pagep; +{ + int ret; + + ret = memp_fget(dbp->mpf, &addr, DB_MPOOL_CREATE, pagep); +#ifdef DEBUG_SLOW + if (*pagep != NULL) + __account_page((HTAB *)dbp->internal, addr, 1); +#endif + return (ret); +} + +/* + * PUBLIC: int __ham_overflow_page __P((DB *, u_int32_t, PAGE **)); + */ +int +__ham_overflow_page(dbp, type, pp) + DB *dbp; + u_int32_t type; + PAGE **pp; +{ + DB_LSN *lsnp, new_lsn; + HTAB *hashp; + PAGE *p; + db_pgno_t new_addr, next_free, newalloc_flag; + u_int32_t offset, splitnum; + int ret; + + hashp = (HTAB *)dbp->internal; + + ret = 0; + DIRTY_META(hashp, ret); + if (ret != 0) + return (ret); + + /* + * This routine is split up into two parts. First we have + * to figure out the address of the new page that we are + * allocating. Then we have to log the allocation. Only + * after the log do we get to complete allocation of the + * new page. + */ + new_addr = hashp->hdr->last_freed; + if (new_addr != PGNO_INVALID) { + if ((ret = __ham_get_page(hashp->dbp, new_addr, &p)) != 0) + return (ret); + next_free = NEXT_PGNO(p); + lsnp = &LSN(p); + newalloc_flag = 0; + } else { + splitnum = hashp->hdr->ovfl_point; + hashp->hdr->spares[splitnum]++; + offset = hashp->hdr->spares[splitnum] - + (splitnum ? hashp->hdr->spares[splitnum - 1] : 0); + new_addr = PGNO_OF(hashp, hashp->hdr->ovfl_point, offset); + if (new_addr > MAX_PAGES(hashp)) { + __db_err(hashp->dbp->dbenv, "hash: out of file pages"); + hashp->hdr->spares[splitnum]--; + return (ENOMEM); + } + next_free = PGNO_INVALID; + p = NULL; + lsnp = NULL; + newalloc_flag = 1; + } + + if (DB_LOGGING(hashp->dbp)) { + if ((ret = __ham_newpgno_log(hashp->dbp->dbenv->lg_info, + (DB_TXN *)hashp->dbp->txn, &new_lsn, 0, ALLOCPGNO, + hashp->dbp->log_fileid, new_addr, next_free, + 0, newalloc_flag, type, lsnp, &hashp->hdr->lsn)) != 0) + return (ret); + + hashp->hdr->lsn = new_lsn; + if (lsnp != NULL) + *lsnp = new_lsn; + } + + if (p != NULL) { + /* We just took something off the free list, initialize it. */ + hashp->hdr->last_freed = next_free; + P_INIT(p, hashp->hdr->pagesize, PGNO(p), PGNO_INVALID, + PGNO_INVALID, 0, (u_int8_t)type); + } else { + /* Get the new page. */ + if ((ret = __ham_new_page(hashp, new_addr, type, &p)) != 0) + return (ret); + } + if (DB_LOGGING(hashp->dbp)) + LSN(p) = new_lsn; + + *pp = p; + return (0); +} + +#ifdef DEBUG +/* + * PUBLIC: #ifdef DEBUG + * PUBLIC: db_pgno_t __bucket_to_page __P((HTAB *, db_pgno_t)); + * PUBLIC: #endif + */ +db_pgno_t +__bucket_to_page(hashp, n) + HTAB *hashp; + db_pgno_t n; +{ + int ret_val; + + ret_val = n + 1; + if (n != 0) + ret_val += hashp->hdr->spares[__db_log2(n + 1) - 1]; + return (ret_val); +} +#endif + +/* + * Create a bunch of overflow pages at the current split point. + * PUBLIC: void __ham_init_ovflpages __P((HTAB *)); + */ +void +__ham_init_ovflpages(hp) + HTAB *hp; +{ + DB_LSN new_lsn; + PAGE *p; + db_pgno_t last_pgno, new_pgno; + u_int32_t i, curpages, numpages; + + curpages = hp->hdr->spares[hp->hdr->ovfl_point] - + hp->hdr->spares[hp->hdr->ovfl_point - 1]; + numpages = hp->hdr->ovfl_point + 1 - curpages; + + last_pgno = hp->hdr->last_freed; + new_pgno = PGNO_OF(hp, hp->hdr->ovfl_point, curpages + 1); + if (DB_LOGGING(hp->dbp)) { + (void)__ham_ovfl_log(hp->dbp->dbenv->lg_info, + (DB_TXN *)hp->dbp->txn, &new_lsn, 0, + hp->dbp->log_fileid, new_pgno, + numpages, last_pgno, hp->hdr->ovfl_point, &hp->hdr->lsn); + hp->hdr->lsn = new_lsn; + } else + ZERO_LSN(new_lsn); + + hp->hdr->spares[hp->hdr->ovfl_point] += numpages; + for (i = numpages; i > 0; i--) { + if (__ham_new_page(hp, + PGNO_OF(hp, hp->hdr->ovfl_point, curpages + i), + P_INVALID, &p) != 0) + break; + LSN(p) = new_lsn; + NEXT_PGNO(p) = last_pgno; + last_pgno = PGNO(p); + (void)__ham_put_page(hp->dbp, p, 1); + } + hp->hdr->last_freed = last_pgno; +} + +/* + * PUBLIC: int __ham_get_cpage __P((HTAB *, HASH_CURSOR *, db_lockmode_t)); + */ +int +__ham_get_cpage(hashp, hcp, mode) + HTAB *hashp; + HASH_CURSOR *hcp; + db_lockmode_t mode; +{ + int ret; + + if (hcp->lock == 0 && F_ISSET(hashp->dbp, DB_AM_LOCKING) && + (ret = __ham_lock_bucket(hashp->dbp, hcp, mode)) != 0) + return (ret); + + if (hcp->pagep == NULL) { + if (hcp->pgno == PGNO_INVALID) { + hcp->pgno = BUCKET_TO_PAGE(hashp, hcp->bucket); + hcp->bndx = 0; + } + + if ((ret = + __ham_get_page(hashp->dbp, hcp->pgno, &hcp->pagep)) != 0) + return (ret); + } + + if (hcp->dpgno != PGNO_INVALID && hcp->dpagep == NULL) + if ((ret = + __ham_get_page(hashp->dbp, hcp->dpgno, &hcp->dpagep)) != 0) + return (ret); + return (0); +} + +/* + * Get a new page at the cursor, putting the last page if necessary. + * If the flag is set to H_ISDUP, then we are talking about the + * duplicate page, not the main page. + * + * PUBLIC: int __ham_next_cpage + * PUBLIC: __P((HTAB *, HASH_CURSOR *, db_pgno_t, int, u_int32_t)); + */ +int +__ham_next_cpage(hashp, hcp, pgno, dirty, flags) + HTAB *hashp; + HASH_CURSOR *hcp; + db_pgno_t pgno; + int dirty; + u_int32_t flags; +{ + PAGE *p; + int ret; + + if (LF_ISSET(H_ISDUP) && hcp->dpagep != NULL && + (ret = __ham_put_page(hashp->dbp, hcp->dpagep, dirty)) != 0) + return (ret); + else if (!LF_ISSET(H_ISDUP) && hcp->pagep != NULL && + (ret = __ham_put_page(hashp->dbp, hcp->pagep, dirty)) != 0) + return (ret); + + if ((ret = __ham_get_page(hashp->dbp, pgno, &p)) != 0) + return (ret); + + if (LF_ISSET(H_ISDUP)) { + hcp->dpagep = p; + hcp->dpgno = pgno; + hcp->dndx = 0; + } else { + hcp->pagep = p; + hcp->pgno = pgno; + hcp->bndx = 0; + } + + return (0); +} + +/* + * __ham_lock_bucket -- + * Get the lock on a particular bucket. + */ +static int +__ham_lock_bucket(dbp, hcp, mode) + DB *dbp; + HASH_CURSOR *hcp; + db_lockmode_t mode; +{ + int ret; + + /* + * What a way to trounce on the memory system. It might be + * worth copying the lk_info into the hashp. + */ + ret = 0; + dbp->lock.pgno = (db_pgno_t)(hcp->bucket); + ret = lock_get(dbp->dbenv->lk_info, + dbp->txn == NULL ? dbp->locker : dbp->txn->txnid, 0, + &dbp->lock_dbt, mode, &hcp->lock); + + return (ret < 0 ? EAGAIN : ret); +} + +/* + * __ham_dpair -- + * Delete a pair on a page, paying no attention to what the pair + * represents. The caller is responsible for freeing up duplicates + * or offpage entries that might be referenced by this pair. + * + * PUBLIC: void __ham_dpair __P((DB *, PAGE *, u_int32_t)); + */ +void +__ham_dpair(dbp, p, pndx) + DB *dbp; + PAGE *p; + u_int32_t pndx; +{ + db_indx_t delta, n; + u_int8_t *dest, *src; + + /* + * Compute "delta", the amount we have to shift all of the + * offsets. To find the delta, we just need to calculate + * the size of the pair of elements we are removing. + */ + delta = H_PAIRSIZE(p, dbp->pgsize, pndx); + + /* + * The hard case: we want to remove something other than + * the last item on the page. We need to shift data and + * offsets down. + */ + if ((db_indx_t)pndx != H_NUMPAIRS(p) - 1) { + /* + * Move the data: src is the first occupied byte on + * the page. (Length is delta.) + */ + src = (u_int8_t *)p + HOFFSET(p); + + /* + * Destination is delta bytes beyond src. This might + * be an overlapping copy, so we have to use memmove. + */ + dest = src + delta; + memmove(dest, src, p->inp[H_DATAINDEX(pndx)] - HOFFSET(p)); + } + + /* Adjust the offsets. */ + for (n = (db_indx_t)pndx; n < (db_indx_t)(H_NUMPAIRS(p) - 1); n++) { + p->inp[H_KEYINDEX(n)] = p->inp[H_KEYINDEX(n+1)] + delta; + p->inp[H_DATAINDEX(n)] = p->inp[H_DATAINDEX(n+1)] + delta; + } + + /* Adjust page metadata. */ + HOFFSET(p) = HOFFSET(p) + delta; + NUM_ENT(p) = NUM_ENT(p) - 2; +} + +#ifdef DEBUG_SLOW +static void +__account_page(hashp, pgno, inout) + HTAB *hashp; + db_pgno_t pgno; + int inout; +{ + static struct { + db_pgno_t pgno; + int times; + } list[100]; + static int last; + int i, j; + + if (inout == -1) /* XXX: Kluge */ + inout = 0; + + /* Find page in list. */ + for (i = 0; i < last; i++) + if (list[i].pgno == pgno) + break; + /* Not found. */ + if (i == last) { + list[last].times = inout; + list[last].pgno = pgno; + last++; + } + list[i].times = inout; + if (list[i].times == 0) { + for (j = i; j < last; j++) + list[j] = list[j + 1]; + last--; + } + for (i = 0; i < last; i++, list[i].times++) + if (list[i].times > 20 && + !__is_bitmap_pgno(hashp, list[i].pgno)) + (void)fprintf(stderr, + "Warning: pg %lu has been out for %d times\n", + (u_long)list[i].pgno, list[i].times); +} +#endif /* DEBUG_SLOW */ diff --git a/mozilla/db/hash/hash_rec.c b/mozilla/db/hash/hash_rec.c new file mode 100644 index 00000000000..efaf61c638c --- /dev/null +++ b/mozilla/db/hash/hash_rec.c @@ -0,0 +1,956 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1995, 1996 + * Margo Seltzer. All rights reserved. + */ +/* + * Copyright (c) 1995, 1996 + * The President and Fellows of Harvard University. 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. 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)hash_rec.c 10.19 (Sleepycat) 5/23/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_page.h" +#include "hash.h" +#include "btree.h" +#include "log.h" +#include "common_ext.h" + +/* + * __ham_insdel_recover -- + * + * PUBLIC: int __ham_insdel_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_insdel_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __ham_insdel_args *argp; + DB *mdbp, *file_dbp; + DB_MPOOLFILE *mpf; + HTAB *hashp; + PAGE *pagep; + u_int32_t op; + int cmp_n, cmp_p, getmeta, ret; + + getmeta = 0; + hashp = NULL; /* XXX: shut the compiler up. */ + REC_PRINT(__ham_insdel_print); + REC_INTRO(__ham_insdel_read); + + ret = memp_fget(mpf, &argp->pgno, 0, &pagep); + if (ret != 0) + if (!redo) { + /* + * We are undoing and the page doesn't exist. That + * is equivalent to having a pagelsn of 0, so we + * would not have to undo anything. In this case, + * don't bother creating a page. + */ + *lsnp = argp->prev_lsn; + ret = 0; + goto out; + } else if ((ret = memp_fget(mpf, &argp->pgno, + DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + + + hashp = (HTAB *)file_dbp->internal; + GET_META(file_dbp, hashp); + getmeta = 1; + + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->pagelsn); + /* + * Two possible things going on: + * redo a delete/undo a put: delete the item from the page. + * redo a put/undo a delete: add the item to the page. + * If we are undoing a delete, then the information logged is the + * entire entry off the page, not just the data of a dbt. In + * this case, we want to copy it back onto the page verbatim. + * We do this by calling __putitem with the type H_OFFPAGE instead + * of H_KEYDATA. + */ + op = OPCODE_OF(argp->opcode); + + if ((op == DELPAIR && cmp_n == 0 && !redo) || + (op == PUTPAIR && cmp_p == 0 && redo)) { + /* + * Need to redo a PUT or undo a delete. If we are undoing a + * delete, we've got to restore the item back to its original + * position. That's a royal pain in the butt (because we do + * not store item lengths on the page), but there's no choice. + */ + if (op != DELPAIR || + argp->ndx == (u_int32_t)H_NUMPAIRS(pagep)) { + __ham_putitem(pagep, &argp->key, + !redo || PAIR_ISKEYBIG(argp->opcode) ? + H_OFFPAGE : H_KEYDATA); + __ham_putitem(pagep, &argp->data, + !redo || PAIR_ISDATABIG(argp->opcode) ? + H_OFFPAGE : H_KEYDATA); + } else + (void) __ham_reputpair(pagep, hashp->hdr->pagesize, + argp->ndx, &argp->key, &argp->data); + + LSN(pagep) = redo ? *lsnp : argp->pagelsn; + if ((ret = __ham_put_page(file_dbp, pagep, 1)) != 0) + goto out; + + } else if ((op == DELPAIR && cmp_p == 0 && redo) + || (op == PUTPAIR && cmp_n == 0 && !redo)) { + /* Need to undo a put or redo a delete. */ + __ham_dpair(file_dbp, pagep, argp->ndx); + LSN(pagep) = redo ? *lsnp : argp->pagelsn; + if ((ret = __ham_put_page(file_dbp, (PAGE *)pagep, 1)) != 0) + goto out; + } else + if ((ret = __ham_put_page(file_dbp, (PAGE *)pagep, 0)) != 0) + goto out; + + /* Return the previous LSN. */ + *lsnp = argp->prev_lsn; + +out: if (getmeta) + RELEASE_META(file_dbp, hashp); + REC_CLOSE; +} + +/* + * __ham_newpage_recover -- + * This log message is used when we add/remove overflow pages. This + * message takes care of the pointer chains, not the data on the pages. + * + * PUBLIC: int __ham_newpage_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_newpage_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __ham_newpage_args *argp; + DB *mdbp, *file_dbp; + DB_MPOOLFILE *mpf; + HTAB *hashp; + PAGE *pagep; + int cmp_n, cmp_p, change, getmeta, ret; + + getmeta = 0; + hashp = NULL; /* XXX: shut the compiler up. */ + REC_PRINT(__ham_newpage_print); + REC_INTRO(__ham_newpage_read); + + ret = memp_fget(mpf, &argp->new_pgno, 0, &pagep); + if (ret != 0) + if (!redo) { + /* + * We are undoing and the page doesn't exist. That + * is equivalent to having a pagelsn of 0, so we + * would not have to undo anything. In this case, + * don't bother creating a page. + */ + ret = 0; + goto ppage; + } else if ((ret = memp_fget(mpf, &argp->new_pgno, + DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + + hashp = (HTAB *)file_dbp->internal; + GET_META(file_dbp, hashp); + getmeta = 1; + + /* + * There are potentially three pages we need to check: the one + * that we created/deleted, the one before it and the one after + * it. + */ + + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->pagelsn); + change = 0; + + if ((cmp_p == 0 && redo && argp->opcode == PUTOVFL) || + (cmp_n == 0 && !redo && argp->opcode == DELOVFL)) { + /* Redo a create new page or undo a delete new page. */ + P_INIT(pagep, file_dbp->pgsize, argp->new_pgno, + argp->prev_pgno, argp->next_pgno, 0, P_HASH); + change = 1; + } else if ((cmp_p == 0 && redo && argp->opcode == DELOVFL) || + (cmp_n == 0 && !redo && argp->opcode == PUTOVFL)) { + /* + * Redo a delete or undo a create new page. All we + * really need to do is change the LSN. + */ + change = 1; + } + + if (!change) { + if ((ret = __ham_put_page(file_dbp, (PAGE *)pagep, 0)) != 0) + goto out; + } else { + LSN(pagep) = redo ? *lsnp : argp->pagelsn; + if ((ret = __ham_put_page(file_dbp, (PAGE *)pagep, 1)) != 0) + goto out; + } + + /* Now do the prev page. */ +ppage: if (argp->prev_pgno != PGNO_INVALID) { + ret = memp_fget(mpf, &argp->prev_pgno, 0, &pagep); + + if (ret != 0) + if (!redo) { + /* + * We are undoing and the page doesn't exist. + * That is equivalent to having a pagelsn of 0, + * so we would not have to undo anything. In + * this case, don't bother creating a page. + */ + ret = 0; + goto npage; + } else if ((ret = + memp_fget(mpf, &argp->prev_pgno, + DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->prevlsn); + change = 0; + + if ((cmp_p == 0 && redo && argp->opcode == PUTOVFL) || + (cmp_n == 0 && !redo && argp->opcode == DELOVFL)) { + /* Redo a create new page or undo a delete new page. */ + pagep->next_pgno = argp->new_pgno; + change = 1; + } else if ((cmp_p == 0 && redo && argp->opcode == DELOVFL) || + (cmp_n == 0 && !redo && argp->opcode == PUTOVFL)) { + /* Redo a delete or undo a create new page. */ + pagep->next_pgno = argp->next_pgno; + change = 1; + } + + if (!change) { + if ((ret = __ham_put_page(file_dbp, (PAGE *)pagep, 0)) != 0) + goto out; + } else { + LSN(pagep) = redo ? *lsnp : argp->prevlsn; + if ((ret = __ham_put_page(file_dbp, (PAGE *)pagep, 1)) != 0) + goto out; + } + } + + /* Now time to do the next page */ +npage: if (argp->next_pgno != PGNO_INVALID) { + ret = memp_fget(mpf, &argp->next_pgno, 0, &pagep); + + if (ret != 0) + if (!redo) { + /* + * We are undoing and the page doesn't exist. + * That is equivalent to having a pagelsn of 0, + * so we would not have to undo anything. In + * this case, don't bother creating a page. + */ + *lsnp = argp->prev_lsn; + ret = 0; + goto out; + } else if ((ret = + memp_fget(mpf, &argp->next_pgno, + DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->nextlsn); + change = 0; + + if ((cmp_p == 0 && redo && argp->opcode == PUTOVFL) || + (cmp_n == 0 && !redo && argp->opcode == DELOVFL)) { + /* Redo a create new page or undo a delete new page. */ + pagep->prev_pgno = argp->new_pgno; + change = 1; + } else if ((cmp_p == 0 && redo && argp->opcode == DELOVFL) || + (cmp_n == 0 && !redo && argp->opcode == PUTOVFL)) { + /* Redo a delete or undo a create new page. */ + pagep->prev_pgno = argp->prev_pgno; + change = 1; + } + + if (!change) { + if ((ret = + __ham_put_page(file_dbp, (PAGE *)pagep, 0)) != 0) + goto out; + } else { + LSN(pagep) = redo ? *lsnp : argp->nextlsn; + if ((ret = + __ham_put_page(file_dbp, (PAGE *)pagep, 1)) != 0) + goto out; + } + } + *lsnp = argp->prev_lsn; + +out: if (getmeta) + RELEASE_META(file_dbp, hashp); + REC_CLOSE; +} + + +/* + * __ham_replace_recover -- + * This log message refers to partial puts that are local to a single + * page. You can think of them as special cases of the more general + * insdel log message. + * + * PUBLIC: int __ham_replace_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_replace_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __ham_replace_args *argp; + DB *mdbp, *file_dbp; + DB_MPOOLFILE *mpf; + DBT dbt; + HTAB *hashp; + PAGE *pagep; + int32_t grow; + int change, cmp_n, cmp_p, getmeta, ret; + u_int8_t *hk; + + getmeta = 0; + hashp = NULL; /* XXX: shut the compiler up. */ + REC_PRINT(__ham_replace_print); + REC_INTRO(__ham_replace_read); + + ret = memp_fget(mpf, &argp->pgno, 0, &pagep); + if (ret != 0) + if (!redo) { + /* + * We are undoing and the page doesn't exist. That + * is equivalent to having a pagelsn of 0, so we + * would not have to undo anything. In this case, + * don't bother creating a page. + */ + *lsnp = argp->prev_lsn; + ret = 0; + goto out; + } else if ((ret = memp_fget(mpf, &argp->pgno, + DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + + hashp = (HTAB *)file_dbp->internal; + GET_META(file_dbp, hashp); + getmeta = 1; + + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->pagelsn); + + if (cmp_p == 0 && redo) { + change = 1; + /* Reapply the change as specified. */ + dbt.data = argp->newitem.data; + dbt.size = argp->newitem.size; + grow = argp->newitem.size - argp->olditem.size; + LSN(pagep) = *lsnp; + } else if (cmp_n == 0 && !redo) { + change = 1; + /* Undo the already applied change. */ + dbt.data = argp->olditem.data; + dbt.size = argp->olditem.size; + grow = argp->olditem.size - argp->newitem.size; + LSN(pagep) = argp->pagelsn; + } else { + change = 0; + grow = 0; + } + + if (change) { + __ham_onpage_replace(pagep, + file_dbp->pgsize, argp->ndx, argp->off, grow, &dbt); + if (argp->makedup) { + hk = P_ENTRY(pagep, argp->ndx); + if (redo) + HPAGE_PTYPE(hk) = H_DUPLICATE; + else + HPAGE_PTYPE(hk) = H_KEYDATA; + } + } + + if ((ret = __ham_put_page(file_dbp, pagep, change)) != 0) + goto out; + + *lsnp = argp->prev_lsn; + +out: if (getmeta) + RELEASE_META(file_dbp, hashp); + REC_CLOSE; +} + +/* + * __ham_newpgno_recover -- + * This log message is used when allocating or deleting an overflow + * page. It takes care of modifying the meta data. + * + * PUBLIC: int __ham_newpgno_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_newpgno_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __ham_newpgno_args *argp; + DB *mdbp, *file_dbp; + DB_MPOOLFILE *mpf; + HTAB *hashp; + PAGE *pagep; + int change, cmp_n, cmp_p, getmeta, ret; + + getmeta = 0; + hashp = NULL; /* XXX: shut the compiler up. */ + REC_PRINT(__ham_newpgno_print); + REC_INTRO(__ham_newpgno_read); + + hashp = (HTAB *)file_dbp->internal; + GET_META(file_dbp, hashp); + getmeta = 1; + + /* + * There are two phases to the recovery here. First we need + * to update the meta data; then we need to update the page. + * We'll do the meta-data first. + */ + cmp_n = log_compare(lsnp, &hashp->hdr->lsn); + cmp_p = log_compare(&hashp->hdr->lsn, &argp->metalsn); + + change = 0; + if ((cmp_p == 0 && redo && argp->opcode == ALLOCPGNO) || + (cmp_n == 0 && !redo && argp->opcode == DELPGNO)) { + /* Need to redo an allocation or undo a deletion. */ + hashp->hdr->last_freed = argp->free_pgno; + if (redo && argp->old_pgno != 0) /* Must be ALLOCPGNO */ + hashp->hdr->spares[hashp->hdr->ovfl_point]++; + change = 1; + } else if (cmp_p == 0 && redo && argp->opcode == DELPGNO) { + /* Need to redo a deletion */ + hashp->hdr->last_freed = argp->pgno; + change = 1; + } else if (cmp_n == 0 && !redo && argp->opcode == ALLOCPGNO) { + /* undo an allocation. */ + if (argp->old_pgno == 0) + hashp->hdr->last_freed = argp->pgno; + else { + hashp->hdr->spares[hashp->hdr->ovfl_point]--; + hashp->hdr->last_freed = 0; + } + change = 1; + } + if (change) { + hashp->hdr->lsn = redo ? *lsnp : argp->metalsn; + F_SET(file_dbp, DB_HS_DIRTYMETA); + } + + + /* Now check the newly allocated/freed page. */ + ret = memp_fget(mpf, &argp->pgno, 0, &pagep); + + if (ret != 0) + if (!redo) { + /* + * We are undoing and the page doesn't exist. That + * is equivalent to having a pagelsn of 0, so we + * would not have to undo anything. In this case, + * don't bother creating a page. + */ + *lsnp = argp->prev_lsn; + ret = 0; + goto out; + } else if ((ret = memp_fget(mpf, &argp->pgno, + DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->pagelsn); + + change = 0; + if (cmp_p == 0 && redo && argp->opcode == ALLOCPGNO) { + /* Need to redo an allocation. */ + P_INIT(pagep, file_dbp->pgsize, argp->pgno, PGNO_INVALID, + PGNO_INVALID, 0, argp->new_type); + change = 1; + } else if (cmp_n == 0 && !redo && argp->opcode == DELPGNO) { + /* Undoing a delete. */ + P_INIT(pagep, file_dbp->pgsize, argp->pgno, PGNO_INVALID, + argp->old_pgno, 0, argp->old_type); + change = 1; + } else if ((cmp_p == 0 && redo && argp->opcode == DELPGNO) || + (cmp_n == 0 && !redo && argp->opcode == ALLOCPGNO)) { + /* Need to redo a deletion or undo an allocation. */ + NEXT_PGNO(pagep) = argp->free_pgno; + TYPE(pagep) = P_INVALID; + change = 1; + } + if (change) + LSN(pagep) = redo ? *lsnp : argp->pagelsn; + + if ((ret = __ham_put_page(file_dbp, pagep, change)) != 0) + goto out; + + *lsnp = argp->prev_lsn; + +out: if (getmeta) + RELEASE_META(file_dbp, hashp); + REC_CLOSE; + +} + +/* + * __ham_splitmeta_recover -- + * This is the meta-data part of the split. Records the new and old + * bucket numbers and the new/old mask information. + * + * PUBLIC: int __ham_splitmeta_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_splitmeta_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __ham_splitmeta_args *argp; + DB *mdbp, *file_dbp; + DB_MPOOLFILE *mpf; + HTAB *hashp; + int change, cmp_n, cmp_p, getmeta, ret; + u_int32_t pow; + + getmeta = 0; + hashp = NULL; /* XXX: shut the compiler up. */ + REC_PRINT(__ham_splitmeta_print); + REC_INTRO(__ham_splitmeta_read); + + hashp = (HTAB *)file_dbp->internal; + GET_META(file_dbp, hashp); + getmeta = 1; + + /* + * There are two phases to the recovery here. First we need + * to update the meta data; then we need to update the page. + * We'll do the meta-data first. + */ + cmp_n = log_compare(lsnp, &hashp->hdr->lsn); + cmp_p = log_compare(&hashp->hdr->lsn, &argp->metalsn); + + change = 0; + if (cmp_p == 0 && redo) { + /* Need to redo the split information. */ + hashp->hdr->max_bucket = argp->bucket + 1; + pow = __db_log2(hashp->hdr->max_bucket + 1); + if (pow > hashp->hdr->ovfl_point) { + hashp->hdr->spares[pow] = + hashp->hdr->spares[hashp->hdr->ovfl_point]; + hashp->hdr->ovfl_point = pow; + } + if (hashp->hdr->max_bucket > hashp->hdr->high_mask) { + hashp->hdr->low_mask = hashp->hdr->high_mask; + hashp->hdr->high_mask = + hashp->hdr->max_bucket | hashp->hdr->low_mask; + } + change = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo the split information. */ + hashp->hdr->max_bucket = argp->bucket; + hashp->hdr->ovfl_point = argp->ovflpoint; + hashp->hdr->spares[hashp->hdr->ovfl_point] = argp->spares; + pow = 1 << __db_log2(hashp->hdr->max_bucket + 1); + hashp->hdr->high_mask = pow - 1; + hashp->hdr->low_mask = (pow >> 1) - 1; + change = 1; + } + if (change) { + hashp->hdr->lsn = redo ? *lsnp : argp->metalsn; + F_SET(file_dbp, DB_HS_DIRTYMETA); + } + *lsnp = argp->prev_lsn; + +out: if (getmeta) + RELEASE_META(file_dbp, hashp); + REC_CLOSE; +} + +/* + * __ham_splitdata_recover -- + * + * PUBLIC: int __ham_splitdata_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_splitdata_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __ham_splitdata_args *argp; + DB *mdbp, *file_dbp; + DB_MPOOLFILE *mpf; + HTAB *hashp; + PAGE *pagep; + int change, cmp_n, cmp_p, getmeta, ret; + + getmeta = 0; + hashp = NULL; /* XXX: shut the compiler up. */ + REC_PRINT(__ham_splitdata_print); + REC_INTRO(__ham_splitdata_read); + + ret = memp_fget(mpf, &argp->pgno, 0, &pagep); + if (ret != 0) + if (!redo) { + /* + * We are undoing and the page doesn't exist. That + * is equivalent to having a pagelsn of 0, so we + * would not have to undo anything. In this case, + * don't bother creating a page. + */ + *lsnp = argp->prev_lsn; + ret = 0; + goto out; + } else if ((ret = memp_fget(mpf, &argp->pgno, + DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + + hashp = (HTAB *)file_dbp->internal; + GET_META(file_dbp, hashp); + getmeta = 1; + + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->pagelsn); + + /* + * There are two types of log messages here, one for the old page + * and one for the new pages created. The original image in the + * SPLITOLD record is used for undo. The image in the SPLITNEW + * is used for redo. We should never have a case where there is + * a redo operation and the SPLITOLD record is on disk, but not + * the SPLITNEW record. Therefore, we only have work to do when + * redo NEW messages and undo OLD messages, but we have to update + * LSNs in both cases. + */ + change = 0; + if (cmp_p == 0 && redo) { + if (argp->opcode == SPLITNEW) + /* Need to redo the split described. */ + memcpy(pagep, argp->pageimage.data, + argp->pageimage.size); + LSN(pagep) = *lsnp; + change = 1; + } else if (cmp_n == 0 && !redo) { + if (argp->opcode == SPLITOLD) { + /* Put back the old image. */ + memcpy(pagep, argp->pageimage.data, + argp->pageimage.size); + } else + P_INIT(pagep, file_dbp->pgsize, argp->pgno, + PGNO_INVALID, PGNO_INVALID, 0, P_HASH); + LSN(pagep) = argp->pagelsn; + change = 1; + } + if ((ret = __ham_put_page(file_dbp, pagep, change)) != 0) + goto out; + + *lsnp = argp->prev_lsn; + +out: if (getmeta) + RELEASE_META(file_dbp, hashp); + REC_CLOSE; +} + +/* + * __ham_ovfl_recover -- + * This message is generated when we initialize a set of overflow pages. + * + * PUBLIC: int __ham_ovfl_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_ovfl_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __ham_ovfl_args *argp; + DB *mdbp, *file_dbp; + DB_MPOOLFILE *mpf; + HTAB *hashp; + PAGE *pagep; + db_pgno_t max_pgno, pgno; + int cmp_n, cmp_p, getmeta, ret; + + getmeta = 0; + hashp = NULL; /* XXX: shut the compiler up. */ + REC_PRINT(__ham_ovfl_print); + REC_INTRO(__ham_ovfl_read); + + hashp = (HTAB *)file_dbp->internal; + GET_META(file_dbp, hashp); + getmeta = 1; + + cmp_n = log_compare(lsnp, &hashp->hdr->lsn); + cmp_p = log_compare(&hashp->hdr->lsn, &argp->metalsn); + + if (cmp_p == 0 && redo) { + /* Redo the allocation. */ + hashp->hdr->last_freed = argp->start_pgno; + hashp->hdr->spares[argp->ovflpoint] += argp->npages; + hashp->hdr->lsn = *lsnp; + F_SET(file_dbp, DB_HS_DIRTYMETA); + } else if (cmp_n == 0 && !redo) { + hashp->hdr->last_freed = argp->free_pgno; + hashp->hdr->spares[argp->ovflpoint] -= argp->npages; + hashp->hdr->lsn = argp->metalsn; + F_SET(file_dbp, DB_HS_DIRTYMETA); + } + + max_pgno = argp->start_pgno + argp->npages - 1; + ret = 0; + for (pgno = argp->start_pgno; pgno <= max_pgno; pgno++) { + ret = memp_fget(mpf, &pgno, 0, &pagep); + if (ret != 0) { + if (redo && (ret = memp_fget(mpf, &pgno, + DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + else if (!redo) { + (void)__ham_put_page(file_dbp, pagep, 0); + continue; + } + } + if (redo && log_compare((const DB_LSN *)lsnp, + (const DB_LSN *)&LSN(pagep)) > 0) { + P_INIT(pagep, file_dbp->pgsize, pgno, PGNO_INVALID, + pgno == max_pgno ? argp->free_pgno : pgno + 1, + 0, P_HASH); + LSN(pagep) = *lsnp; + ret = __ham_put_page(file_dbp, pagep, 1); + } else if (!redo) { + ZERO_LSN(pagep->lsn); + ret = __ham_put_page(file_dbp, pagep, 1); + } else + ret = __ham_put_page(file_dbp, pagep, 0); + if (ret) + goto out; + } + + *lsnp = argp->prev_lsn; +out: if (getmeta) + RELEASE_META(file_dbp, hashp); + REC_CLOSE; +} + +/* + * __ham_copypage_recover -- + * Recovery function for copypage. + * + * PUBLIC: int __ham_copypage_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__ham_copypage_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __ham_copypage_args *argp; + DB *file_dbp, *mdbp; + DB_MPOOLFILE *mpf; + HTAB *hashp; + PAGE *pagep; + int cmp_n, cmp_p, getmeta, modified, ret; + + getmeta = 0; + hashp = NULL; /* XXX: shut the compiler up. */ + REC_PRINT(__ham_copypage_print); + REC_INTRO(__ham_copypage_read); + + hashp = (HTAB *)file_dbp->internal; + GET_META(file_dbp, hashp); + getmeta = 1; + modified = 0; + + /* This is the bucket page. */ + ret = memp_fget(mpf, &argp->pgno, 0, &pagep); + if (ret != 0) + if (!redo) { + /* + * We are undoing and the page doesn't exist. That + * is equivalent to having a pagelsn of 0, so we + * would not have to undo anything. In this case, + * don't bother creating a page. + */ + ret = 0; + goto donext; + } else if ((ret = memp_fget(mpf, &argp->pgno, + DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->pagelsn); + + if (cmp_p == 0 && redo) { + /* Need to redo update described. */ + memcpy(pagep, argp->page.data, argp->page.size); + LSN(pagep) = *lsnp; + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + P_INIT(pagep, hashp->hdr->pagesize, argp->pgno, PGNO_INVALID, + argp->next_pgno, 0, P_HASH); + LSN(pagep) = argp->pagelsn; + modified = 1; + } + if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) != 0) + goto out; + + /* Now fix up the "next" page. */ +donext: ret = memp_fget(mpf, &argp->next_pgno, 0, &pagep); + if (ret != 0) + if (!redo) { + /* + * We are undoing and the page doesn't exist. That + * is equivalent to having a pagelsn of 0, so we + * would not have to undo anything. In this case, + * don't bother creating a page. + */ + ret = 0; + goto do_nn; + } else if ((ret = memp_fget(mpf, &argp->next_pgno, + DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + + /* There is nothing to do in the REDO case; only UNDO. */ + + cmp_n = log_compare(lsnp, &LSN(pagep)); + if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + memcpy(pagep, argp->page.data, argp->page.size); + modified = 1; + } + if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) != 0) + goto out; + + /* Now fix up the next's next page. */ +do_nn: if (argp->nnext_pgno == PGNO_INVALID) { + *lsnp = argp->prev_lsn; + goto out; + } + + ret = memp_fget(mpf, &argp->nnext_pgno, 0, &pagep); + if (ret != 0) + if (!redo) { + /* + * We are undoing and the page doesn't exist. That + * is equivalent to having a pagelsn of 0, so we + * would not have to undo anything. In this case, + * don't bother creating a page. + */ + ret = 0; + *lsnp = argp->prev_lsn; + goto out; + } else if ((ret = memp_fget(mpf, &argp->nnext_pgno, + DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + + cmp_n = log_compare(lsnp, &LSN(pagep)); + cmp_p = log_compare(&LSN(pagep), &argp->nnextlsn); + + if (cmp_p == 0 && redo) { + /* Need to redo update described. */ + PREV_PGNO(pagep) = argp->pgno; + LSN(pagep) = *lsnp; + modified = 1; + } else if (cmp_n == 0 && !redo) { + /* Need to undo update described. */ + PREV_PGNO(pagep) = argp->next_pgno; + LSN(pagep) = argp->nnextlsn; + modified = 1; + } + if ((ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) != 0) + goto out; + + *lsnp = argp->prev_lsn; + +out: if (getmeta) + RELEASE_META(file_dbp, hashp); + REC_CLOSE; +} diff --git a/mozilla/db/hash/hash_stat.c b/mozilla/db/hash/hash_stat.c new file mode 100644 index 00000000000..b57ca0950dc --- /dev/null +++ b/mozilla/db/hash/hash_stat.c @@ -0,0 +1,57 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)hash_stat.c 10.8 (Sleepycat) 4/26/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "hash.h" + +/* + * __ham_stat -- + * Gather/print the hash statistics. + * + * PUBLIC: int __ham_stat __P((DB *, FILE *)); + */ +int +__ham_stat(dbp, fp) + DB *dbp; + FILE *fp; +{ + HTAB *hashp; + int i; + + hashp = (HTAB *)dbp->internal; + + fprintf(fp, "hash: accesses %lu collisions %lu\n", + hashp->hash_accesses, hashp->hash_collisions); + fprintf(fp, "hash: expansions %lu\n", hashp->hash_expansions); + fprintf(fp, "hash: overflows %lu\n", hashp->hash_overflows); + fprintf(fp, "hash: big key/data pages %lu\n", hashp->hash_bigpages); + + SET_LOCKER(dbp, NULL); + GET_META(dbp, hashp); + fprintf(fp, "keys %lu maxp %lu\n", + (u_long)hashp->hdr->nelem, (u_long)hashp->hdr->max_bucket); + + for (i = 0; i < NCACHED; i++) + fprintf(fp, + "spares[%d] = %lu\n", i, (u_long)hashp->hdr->spares[i]); + + RELEASE_META(dbp, hashp); + return (0); +} diff --git a/mozilla/db/hsearch/hsearch.c b/mozilla/db/hsearch/hsearch.c new file mode 100644 index 00000000000..c375a88fd66 --- /dev/null +++ b/mozilla/db/hsearch/hsearch.c @@ -0,0 +1,142 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1990, 1993 + * Margo Seltzer. All rights reserved. + */ +/* + * Copyright (c) 1990, 1993 + * 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. 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)hsearch.c 10.9 (Sleepycat) 4/18/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#define DB_DBM_HSEARCH 1 +#include "db_int.h" + +static DB *dbp; +static ENTRY retval; + +int +__db_hcreate(nel) + size_t nel; +{ + DB_INFO dbinfo; + + memset(&dbinfo, 0, sizeof(dbinfo)); + dbinfo.db_pagesize = 512; + dbinfo.h_ffactor = 16; + dbinfo.h_nelem = (u_int32_t)nel; /* XXX: Possible overflow. */ + + errno = db_open(NULL, + DB_HASH, DB_CREATE, __db_omode("rw----"), NULL, &dbinfo, &dbp); + return (errno == 0 ? 1 : 0); +} + +ENTRY * +__db_hsearch(item, action) + ENTRY item; + ACTION action; +{ + DBT key, val; + + if (dbp == NULL) { + errno = EINVAL; + return (NULL); + } + memset(&key, 0, sizeof(key)); + memset(&val, 0, sizeof(val)); + key.data = item.key; + key.size = strlen(item.key) + 1; + + switch (action) { + case ENTER: + val.data = item.data; + val.size = strlen(item.data) + 1; + + /* + * Try and add the key to the database. If we fail because + * the key already exists, return the existing key. + */ + if ((errno = + dbp->put(dbp, NULL, &key, &val, DB_NOOVERWRITE)) == 0) + break; + if (errno != DB_KEYEXIST) + return (NULL); + if ((errno = dbp->get(dbp, NULL, &key, &val, 0)) == 0) + break; + + if (errno == DB_NOTFOUND) /* XXX: can't happen. */ + errno = EINVAL; + break; + case FIND: + if ((errno = dbp->get(dbp, NULL, &key, &val, 0)) != 0) { + if (errno == DB_NOTFOUND) + errno = 0; + return (NULL); + } + item.data = (char *)val.data; + break; + default: + errno = EINVAL; + return (NULL); + } + retval.key = item.key; + retval.data = item.data; + return (&retval); +} + +void +__db_hdestroy() +{ + if (dbp != NULL) { + (void)dbp->close(dbp, 0); + dbp = NULL; + } +} diff --git a/mozilla/db/include/btree.h b/mozilla/db/include/btree.h new file mode 100644 index 00000000000..1660d331e70 --- /dev/null +++ b/mozilla/db/include/btree.h @@ -0,0 +1,344 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * 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. 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. + * + * @(#)btree.h 10.21 (Sleepycat) 5/23/98 + */ + +/* Forward structure declarations. */ +struct __btree; typedef struct __btree BTREE; +struct __cursor; typedef struct __cursor CURSOR; +struct __epg; typedef struct __epg EPG; +struct __rcursor; typedef struct __rcursor RCURSOR; +struct __recno; typedef struct __recno RECNO; + +#undef DEFMINKEYPAGE /* Minimum keys per page */ +#define DEFMINKEYPAGE (2) + +#undef ISINTERNAL /* If an internal page. */ +#define ISINTERNAL(p) (TYPE(p) == P_IBTREE || TYPE(p) == P_IRECNO) +#undef ISLEAF /* If a leaf page. */ +#define ISLEAF(p) (TYPE(p) == P_LBTREE || TYPE(p) == P_LRECNO) + +/* Allocate and discard thread structures. */ +#define GETHANDLE(dbp, set_txn, dbpp, ret) { \ + if (F_ISSET(dbp, DB_AM_THREAD)) { \ + if ((ret = __db_gethandle(dbp, __bam_bdup, dbpp)) != 0) \ + return (ret); \ + } else \ + *dbpp = dbp; \ + *dbpp->txn = set_txn; \ +} +#define PUTHANDLE(dbp) { \ + dbp->txn = NULL; \ + if (F_ISSET(dbp, DB_AM_THREAD)) \ + __db_puthandle(dbp); \ +} + +/* + * 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 __BT_LPUT(dbp, lock) \ + (F_ISSET((dbp), DB_AM_LOCKING) ? \ + lock_put((dbp)->dbenv->lk_info, lock) : 0) +#define __BT_TLPUT(dbp, lock) \ + (F_ISSET((dbp), DB_AM_LOCKING) && (dbp)->txn == NULL ? \ + lock_put((dbp)->dbenv->lk_info, lock) : 0) + +/* + * Flags to __bt_search() and __rec_search(). + * + * 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_DELETE (S_WRITE | S_DUPFIRST | S_DELNO | S_EXACT | S_STACK) +#define S_FIND (S_READ | S_DUPFIRST | S_DELNO) +#define S_INSERT (S_WRITE | S_DUPLAST | S_STACK) +#define S_KEYFIRST (S_WRITE | S_DUPFIRST | S_STACK) +#define S_KEYLAST (S_WRITE | S_DUPLAST | S_STACK) +#define S_WRPAIR (S_WRITE | S_DUPLAST | S_PARENT) + +/* + * If doing insert search (including keyfirst or keylast operations) or a + * split search on behalf of an insert, it's okay to return the entry one + * past the end of the page. + */ +#define PAST_END_OK(f) \ + ((f) == S_INSERT || \ + (f) == S_KEYFIRST || (f) == S_KEYLAST || (f) == S_WRPAIR) + +/* + * Flags to __bam_iitem(). + */ +#define BI_DELETED 0x01 /* Key/data pair only placeholder. */ +#define BI_DOINCR 0x02 /* Increment the record count. */ +#define BI_NEWKEY 0x04 /* New key. */ + +/* + * Various routines pass around page references. A page reference can be a + * pointer to the page or a page number; for either, an indx can designate + * an item on the page. + */ +struct __epg { + PAGE *page; /* The page. */ + db_indx_t indx; /* The index on the page. */ + DB_LOCK lock; /* The page's lock. */ +}; + +/* + * All cursors are queued from the master DB structure. Convert the user's + * DB reference to the master DB reference. We lock the master DB mutex + * so that we can walk the cursor queue. There's no race in accessing the + * cursors, because if we're modifying a page, we have a write lock on it, + * and therefore no other thread than the current one can have a cursor that + * references the page. + */ +#define CURSOR_SETUP(dbp) { \ + (dbp) = (dbp)->master; \ + DB_THREAD_LOCK(dbp); \ +} +#define CURSOR_TEARDOWN(dbp) \ + DB_THREAD_UNLOCK(dbp); + +/* + * Btree cursor. + * + * Arguments passed to __bam_ca_replace(). + */ +typedef enum { + REPLACE_SETUP, + REPLACE_SUCCESS, + REPLACE_FAILED +} ca_replace_arg; +struct __cursor { + DBC *dbc; /* Enclosing DBC. */ + + PAGE *page; /* Cursor page. */ + + db_pgno_t pgno; /* Page. */ + db_indx_t indx; /* Page item ref'd by the cursor. */ + + db_pgno_t dpgno; /* Duplicate page. */ + db_indx_t dindx; /* Page item ref'd by the cursor. */ + + DB_LOCK lock; /* Cursor read lock. */ + db_lockmode_t mode; /* Lock mode. */ + + /* + * If a cursor record is deleted, the key/data pair has to remain on + * the page so that subsequent inserts/deletes don't interrupt the + * cursor progression through the file. This results in interesting + * cases when "standard" operations, e.g., dbp->put() are done in the + * context of "deleted" cursors. + * + * C_DELETED -- The item referenced by the cursor has been "deleted" + * but not physically removed from the page. + * C_REPLACE -- The "deleted" item referenced by a cursor has been + * replaced by a dbp->put(), so the cursor is no longer + * responsible for physical removal from the page. + * C_REPLACE_SETUP -- + * We are about to overwrite a "deleted" item, flag any + * cursors referencing it for transition to C_REPLACE + * state. + */ +#define C_DELETED 0x0001 +#define C_REPLACE 0x0002 +#define C_REPLACE_SETUP 0x0004 + + /* + * Internal cursor held for DB->get; don't hold locks unless involved + * in a TXN. + */ +#define C_INTERNAL 0x0008 + u_int32_t flags; +}; + +/* + * Recno cursor. + * + * Arguments passed to __ram_ca(). + */ +typedef enum { + CA_DELETE, + CA_IAFTER, + CA_IBEFORE +} ca_recno_arg; +struct __rcursor { + DBC *dbc; /* Enclosing DBC. */ + + db_recno_t recno; /* Current record number. */ + + /* + * Cursors referencing "deleted" records are positioned between + * two records, and so must be specially adjusted until they are + * moved. + */ +#define CR_DELETED 0x0001 /* Record deleted. */ + u_int32_t flags; +}; + +/* + * We maintain a stack of the pages that we're locking in the tree. Btree's + * (currently) only save two levels of the tree at a time, so the default + * stack is always large enough. Recno trees have to lock the entire tree to + * do inserts/deletes, however. Grow the stack as necessary. + */ +#undef BT_STK_CLR +#define BT_STK_CLR(t) \ + ((t)->bt_csp = (t)->bt_sp) + +#undef BT_STK_ENTER +#define BT_STK_ENTER(t, pagep, page_indx, lock, ret) do { \ + if ((ret = \ + (t)->bt_csp == (t)->bt_esp ? __bam_stkgrow(t) : 0) == 0) { \ + (t)->bt_csp->page = pagep; \ + (t)->bt_csp->indx = page_indx; \ + (t)->bt_csp->lock = lock; \ + } \ +} while (0) + +#undef BT_STK_PUSH +#define BT_STK_PUSH(t, pagep, page_indx, lock, ret) do { \ + BT_STK_ENTER(t, pagep, page_indx, lock, ret); \ + ++(t)->bt_csp; \ +} while (0) + +#undef BT_STK_POP +#define BT_STK_POP(t) \ + ((t)->bt_csp == (t)->bt_stack ? NULL : --(t)->bt_csp) + +/* + * The in-memory recno data structure. + * + * !!! + * 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. + */ +#undef RECNO_OOB +#define RECNO_OOB 0 /* Illegal record number. */ + +struct __recno { + int re_delim; /* Variable-length delimiting byte. */ + int re_pad; /* Fixed-length padding byte. */ + u_int32_t re_len; /* Length for fixed-length records. */ + + char *re_source; /* Source file name. */ + int re_fd; /* Source file descriptor */ + db_recno_t re_last; /* Last record number read. */ + void *re_cmap; /* Current point in mapped space. */ + void *re_smap; /* Start of mapped space. */ + void *re_emap; /* End of mapped space. */ + size_t re_msize; /* Size of mapped region. */ + /* Recno input function. */ + int (*re_irec) __P((DB *, db_recno_t)); + +#define RECNO_EOF 0x0001 /* EOF on backing source file. */ +#define RECNO_MODIFIED 0x0002 /* Tree was modified. */ + u_int32_t flags; +}; + +/* + * The in-memory btree data structure. + */ +struct __btree { +/* + * These fields are per-thread and are initialized when the BTREE structure + * is created. + */ + db_pgno_t bt_lpgno; /* Last insert location. */ + + DBT bt_rkey; /* Returned key. */ + DBT bt_rdata; /* Returned data. */ + + EPG *bt_sp; /* Stack pointer. */ + EPG *bt_csp; /* Current stack entry. */ + EPG *bt_esp; /* End stack pointer. */ + EPG bt_stack[5]; + + RECNO *bt_recno; /* Private recno structure. */ + + DB_BTREE_LSTAT lstat; /* Btree local statistics. */ + +/* + * These fields are copied from the original BTREE structure and never + * change. + */ + db_indx_t bt_maxkey; /* Maximum keys per page. */ + db_indx_t bt_minkey; /* Minimum keys per page. */ + + int (*bt_compare) /* Comparison function. */ + __P((const DBT *, const DBT *)); + size_t(*bt_prefix) /* Prefix function. */ + __P((const DBT *, const DBT *)); + + db_indx_t bt_ovflsize; /* Maximum key/data on-page size. */ +}; + +#include "btree_auto.h" +#include "btree_ext.h" +#include "db_am.h" +#include "common_ext.h" diff --git a/mozilla/db/include/btree_auto.h b/mozilla/db/include/btree_auto.h new file mode 100644 index 00000000000..041b80f1968 --- /dev/null +++ b/mozilla/db/include/btree_auto.h @@ -0,0 +1,127 @@ +/* Do not edit: automatically built by dist/db_gen.sh. */ +#ifndef bam_AUTO_H +#define bam_AUTO_H + +#define DB_bam_pg_alloc (DB_bam_BEGIN + 1) + +typedef struct _bam_pg_alloc_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t fileid; + DB_LSN meta_lsn; + DB_LSN page_lsn; + db_pgno_t pgno; + u_int32_t ptype; + db_pgno_t next; +} __bam_pg_alloc_args; + + +#define DB_bam_pg_free (DB_bam_BEGIN + 2) + +typedef struct _bam_pg_free_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t fileid; + db_pgno_t pgno; + DB_LSN meta_lsn; + DBT header; + db_pgno_t next; +} __bam_pg_free_args; + + +#define DB_bam_split (DB_bam_BEGIN + 3) + +typedef struct _bam_split_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_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; + DBT pg; +} __bam_split_args; + + +#define DB_bam_rsplit (DB_bam_BEGIN + 4) + +typedef struct _bam_rsplit_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t fileid; + db_pgno_t pgno; + DBT pgdbt; + db_pgno_t nrec; + DBT rootent; + DB_LSN rootlsn; +} __bam_rsplit_args; + + +#define DB_bam_adj (DB_bam_BEGIN + 5) + +typedef struct _bam_adj_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t fileid; + db_pgno_t pgno; + DB_LSN lsn; + u_int32_t indx; + u_int32_t indx_copy; + u_int32_t is_insert; +} __bam_adj_args; + + +#define DB_bam_cadjust (DB_bam_BEGIN + 6) + +typedef struct _bam_cadjust_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t fileid; + db_pgno_t pgno; + DB_LSN lsn; + u_int32_t indx; + int32_t adjust; + int32_t total; +} __bam_cadjust_args; + + +#define DB_bam_cdel (DB_bam_BEGIN + 7) + +typedef struct _bam_cdel_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t fileid; + db_pgno_t pgno; + DB_LSN lsn; + u_int32_t indx; +} __bam_cdel_args; + + +#define DB_bam_repl (DB_bam_BEGIN + 8) + +typedef struct _bam_repl_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t fileid; + db_pgno_t pgno; + DB_LSN lsn; + u_int32_t indx; + u_int32_t isdeleted; + DBT orig; + DBT repl; + u_int32_t prefix; + u_int32_t suffix; +} __bam_repl_args; + +#endif diff --git a/mozilla/db/include/btree_ext.h b/mozilla/db/include/btree_ext.h new file mode 100644 index 00000000000..b8a137364c2 --- /dev/null +++ b/mozilla/db/include/btree_ext.h @@ -0,0 +1,140 @@ +/* DO NOT EDIT: automatically built by dist/distrib. */ +#ifndef _btree_ext_h_ +#define _btree_ext_h_ +int __bam_close __P((DB *)); +int __bam_sync __P((DB *, u_int32_t)); +int __bam_cmp __P((DB *, const DBT *, EPG *)); +int __bam_defcmp __P((const DBT *, const DBT *)); +size_t __bam_defpfx __P((const DBT *, const DBT *)); +int __bam_pgin __P((db_pgno_t, void *, DBT *)); +int __bam_pgout __P((db_pgno_t, void *, DBT *)); +int __bam_mswap __P((PAGE *)); +int __bam_cursor __P((DB *, DB_TXN *, DBC **)); +int __bam_c_iclose __P((DB *, DBC *)); +int __bam_get __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); +int __bam_ovfl_chk __P((DB *, CURSOR *, u_int32_t, int)); +int __bam_cprint __P((DB *)); +int __bam_ca_delete __P((DB *, db_pgno_t, u_int32_t, CURSOR *, int)); +void __bam_ca_di __P((DB *, db_pgno_t, u_int32_t, int)); +void __bam_ca_dup __P((DB *, + db_pgno_t, u_int32_t, u_int32_t, db_pgno_t, u_int32_t)); +void __bam_ca_move __P((DB *, db_pgno_t, db_pgno_t)); +void __bam_ca_replace + __P((DB *, db_pgno_t, u_int32_t, ca_replace_arg)); +void __bam_ca_split __P((DB *, + db_pgno_t, db_pgno_t, db_pgno_t, u_int32_t, int)); +int __bam_delete __P((DB *, DB_TXN *, DBT *, u_int32_t)); +int __ram_delete __P((DB *, DB_TXN *, DBT *, u_int32_t)); +int __bam_ditem __P((DB *, PAGE *, u_int32_t)); +int __bam_adjindx __P((DB *, PAGE *, u_int32_t, u_int32_t, int)); +int __bam_dpage __P((DB *, const DBT *)); +int __bam_open __P((DB *, DBTYPE, DB_INFO *)); +int __bam_bdup __P((DB *, DB *)); +int __bam_new __P((DB *, u_int32_t, PAGE **)); +int __bam_free __P((DB *, PAGE *)); +int __bam_lt __P((DB *)); +int __bam_lget __P((DB *, int, db_pgno_t, db_lockmode_t, DB_LOCK *)); +int __bam_lput __P((DB *, DB_LOCK)); +int __bam_pget __P((DB *, PAGE **, db_pgno_t *, u_int32_t)); +int __bam_put __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); +int __bam_iitem __P((DB *, + PAGE **, db_indx_t *, DBT *, DBT *, u_int32_t, u_int32_t)); +int __bam_ritem __P((DB *, PAGE *, u_int32_t, DBT *)); +int __bam_pg_alloc_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __bam_pg_free_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __bam_split_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __bam_rsplit_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __bam_adj_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __bam_cadjust_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __bam_cdel_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __bam_repl_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __ram_open __P((DB *, DBTYPE, DB_INFO *)); +int __ram_cursor __P((DB *, DB_TXN *, DBC **)); +int __ram_close __P((DB *)); +int __ram_c_iclose __P((DB *, DBC *)); +void __ram_ca __P((DB *, db_recno_t, ca_recno_arg)); +int __ram_cprint __P((DB *)); +int __ram_getno __P((DB *, const DBT *, db_recno_t *, int)); +int __ram_snapshot __P((DB *)); +int __bam_rsearch __P((DB *, db_recno_t *, u_int32_t, int, int *)); +int __bam_adjust __P((DB *, BTREE *, int32_t)); +int __bam_nrecs __P((DB *, db_recno_t *)); +db_recno_t __bam_total __P((PAGE *)); +int __bam_search __P((DB *, + const DBT *, u_int32_t, int, db_recno_t *, int *)); +int __bam_stkrel __P((DB *)); +int __bam_stkgrow __P((BTREE *)); +int __bam_split __P((DB *, void *)); +int __bam_broot __P((DB *, PAGE *, PAGE *, PAGE *)); +int __ram_root __P((DB *, PAGE *, PAGE *, PAGE *)); +int __bam_copy __P((DB *, PAGE *, PAGE *, u_int32_t, u_int32_t)); +int __bam_stat __P((DB *, void *, void *(*)(size_t), u_int32_t)); +void __bam_add_mstat __P((DB_BTREE_LSTAT *, DB_BTREE_LSTAT *)); +int __bam_pg_alloc_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, DB_LSN *, DB_LSN *, db_pgno_t, + u_int32_t, db_pgno_t)); +int __bam_pg_alloc_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __bam_pg_alloc_read __P((void *, __bam_pg_alloc_args **)); +int __bam_pg_free_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, db_pgno_t, DB_LSN *, const DBT *, + db_pgno_t)); +int __bam_pg_free_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __bam_pg_free_read __P((void *, __bam_pg_free_args **)); +int __bam_split_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t, + DB_LSN *, u_int32_t, db_pgno_t, DB_LSN *, + const DBT *)); +int __bam_split_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __bam_split_read __P((void *, __bam_split_args **)); +int __bam_rsplit_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, db_pgno_t, const DBT *, db_pgno_t, + const DBT *, DB_LSN *)); +int __bam_rsplit_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __bam_rsplit_read __P((void *, __bam_rsplit_args **)); +int __bam_adj_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, + u_int32_t, u_int32_t)); +int __bam_adj_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __bam_adj_read __P((void *, __bam_adj_args **)); +int __bam_cadjust_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, + int32_t, int32_t)); +int __bam_cadjust_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __bam_cadjust_read __P((void *, __bam_cadjust_args **)); +int __bam_cdel_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, db_pgno_t, DB_LSN *, u_int32_t)); +int __bam_cdel_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __bam_cdel_read __P((void *, __bam_cdel_args **)); +int __bam_repl_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, + u_int32_t, const DBT *, const DBT *, u_int32_t, + u_int32_t)); +int __bam_repl_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __bam_repl_read __P((void *, __bam_repl_args **)); +int __bam_init_print __P((DB_ENV *)); +int __bam_init_recover __P((DB_ENV *)); +#endif /* _btree_ext_h_ */ diff --git a/mozilla/db/include/clib_ext.h b/mozilla/db/include/clib_ext.h new file mode 100644 index 00000000000..f5510a1629c --- /dev/null +++ b/mozilla/db/include/clib_ext.h @@ -0,0 +1,65 @@ +/* DO NOT EDIT: automatically built by dist/distrib. */ +#ifndef _clib_ext_h_ +#define _clib_ext_h_ +#ifdef __STDC__ +void err __P((int eval, const char *, ...)); +#else +void err(); +#endif +#ifdef __STDC__ +void errx __P((int eval, const char *, ...)); +#else +void errx(); +#endif +#ifdef __STDC__ +void warn __P((const char *, ...)); +#else +void warn(); +#endif +#ifdef __STDC__ +void warnx __P((const char *, ...)); +#else +void warnx(); +#endif +#ifndef HAVE_GETCWD +char *getcwd __P((char *, size_t)); +#endif +void get_long __P((char *, long, long, long *)); +#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_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 +#ifdef __STDC__ +int snprintf __P((char *, size_t, const char *, ...)); +#else +int snprintf(); +#endif +#endif +#ifndef HAVE_STRERROR +char *strerror __P((int)); +#endif +#ifndef HAVE_STRSEP +char *strsep __P((char **, const char *)); +#endif +#ifndef HAVE_VSNPRINTF +int vsnprintf(); +#endif +#endif /* _clib_ext_h_ */ diff --git a/mozilla/db/include/common_ext.h b/mozilla/db/include/common_ext.h new file mode 100644 index 00000000000..4674f9ce015 --- /dev/null +++ b/mozilla/db/include/common_ext.h @@ -0,0 +1,42 @@ +/* DO NOT EDIT: automatically built by dist/distrib. */ +#ifndef _common_ext_h_ +#define _common_ext_h_ +int __db_appname __P((DB_ENV *, + APPNAME, const char *, const char *, u_int32_t, int *, char **)); +int __db_apprec __P((DB_ENV *, u_int32_t)); +int __db_byteorder __P((DB_ENV *, int)); +#ifdef __STDC__ +void __db_err __P((const DB_ENV *dbenv, const char *fmt, ...)); +#else +void __db_err(); +#endif +int __db_panic __P((DB *)); +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_cdelchk __P((const DB *, u_int32_t, int, 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)); +int __db_delchk __P((const DB *, DBT *, u_int32_t, int)); +int __db_getchk __P((const DB *, const DBT *, DBT *, u_int32_t)); +int __db_putchk + __P((const DB *, DBT *, const DBT *, u_int32_t, int, int)); +int __db_statchk __P((const DB *, u_int32_t)); +int __db_syncchk __P((const DB *, u_int32_t)); +int __db_ferr __P((const DB_ENV *, const char *, int)); +u_int32_t __db_log2 __P((u_int32_t)); +int __db_rattach __P((REGINFO *)); +int __db_rdetach __P((REGINFO *)); +int __db_runlink __P((REGINFO *, int)); +int __db_rgrow __P((REGINFO *, size_t)); +int __db_rreattach __P((REGINFO *, size_t)); +void __db_shalloc_init __P((void *, size_t)); +int __db_shalloc __P((void *, size_t, size_t, void *)); +void __db_shalloc_free __P((void *, void *)); +size_t __db_shalloc_count __P((void *)); +size_t __db_shsizeof __P((void *)); +void __db_shalloc_dump __P((void *, FILE *)); +int __db_tablesize __P((u_int32_t)); +void __db_hashinit __P((void *, u_int32_t)); +#endif /* _common_ext_h_ */ diff --git a/mozilla/db/include/cxx_int.h b/mozilla/db/include/cxx_int.h new file mode 100644 index 00000000000..0a59de4391d --- /dev/null +++ b/mozilla/db/include/cxx_int.h @@ -0,0 +1,118 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)cxx_int.h 10.5 (Sleepycat) 4/10/98 + */ + +#ifndef _CXX_INT_H_ +#define _CXX_INT_H_ + +// private data structures known to the implementation only + +#include // used by defines below + +// +// 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)(val->imp()); \ + } \ + \ + inline const _WRAPPED_TYPE unwrapConst(const _WRAPPER_CLASS *val) \ + { \ + if (!val) return 0; \ + return (const _WRAPPED_TYPE)(val->imp()); \ + } \ + \ + inline _IMP_CLASS *wrap(_WRAPPED_TYPE val) \ + { \ + return (_IMP_CLASS*)val; \ + } + +WRAPPED_CLASS(DbLockTab, DbLockTabImp, DB_LOCKTAB*) +WRAPPED_CLASS(DbLog, DbLogImp, DB_LOG*) +WRAPPED_CLASS(DbMpool, DbMpoolImp, DB_MPOOL*) +WRAPPED_CLASS(DbMpoolFile, DbMpoolFileImp, DB_MPOOLFILE*) +WRAPPED_CLASS(Db, DbImp, DB*) +WRAPPED_CLASS(DbTxn, DbTxnImp, DB_TXN*) +WRAPPED_CLASS(DbTxnMgr, DbTxnMgrImp, DB_TXNMGR*) + +// Macros that handle detected errors, in case we want to +// change the default behavior. runtime_error() throws an +// exception by default. +// +// Since it's unusual to throw an exception in a destructor, +// we have a separate macro. For now, we silently ignore such +// detected errors. +// +#define DB_ERROR(caller, ecode) \ + DbEnv::runtime_error(caller, ecode) + +#define DB_DESTRUCTOR_ERROR(caller, ecode) \ + DbEnv::runtime_error(caller, ecode, 1) + + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// These defines are for tedious flag or field set/get access methods. +// + +// Define setName() and getName() methods that twiddle +// the _flags field. +// +#define DB_FLAG_METHODS(_class, _flags, _cxx_name, _flag_name) \ + \ +void _class::set##_cxx_name(int onOrOff) \ +{ \ + if (onOrOff) \ + _flags |= _flag_name; \ + else \ + _flags &= ~(_flag_name); \ +} \ + \ +int _class::get##_cxx_name() const \ +{ \ + return (_flags & _flag_name) ? 1 : 0; \ +} + + +#define DB_RO_ACCESS(_class, _type, _cxx_name, _field) \ + \ +_type _class::get_##_cxx_name() const \ +{ \ + return _field; \ +} + +#define DB_WO_ACCESS(_class, _type, _cxx_name, _field) \ + \ +void _class::set_##_cxx_name(_type value) \ +{ \ + _field = value; \ +} \ + +#define DB_RW_ACCESS(_class, _type, _cxx_name, _field) \ + DB_RO_ACCESS(_class, _type, _cxx_name, _field) \ + DB_WO_ACCESS(_class, _type, _cxx_name, _field) + +#endif /* !_CXX_INT_H_ */ diff --git a/mozilla/db/include/db.h.src b/mozilla/db/include/db.h.src new file mode 100644 index 00000000000..97ad55693f5 --- /dev/null +++ b/mozilla/db/include/db.h.src @@ -0,0 +1,994 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)db.h.src 10.131 (Sleepycat) 6/2/98 + */ + +#ifndef _DB_H_ +#define _DB_H_ + +#ifndef __NO_SYSTEM_INCLUDES +#include + +#include +#endif + +/* + * XXX + * MacOS: ensure that Metrowerks C makes enumeration types int sized. + */ +#ifdef __MWERKS__ +#pragma enumsalwaysint on +#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 + +/* + * !!! + * DB needs basic information about 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@ + +#define DB_VERSION_MAJOR 2 +#define DB_VERSION_MINOR 4 +#define DB_VERSION_PATCH 14 +#define DB_VERSION_STRING "Sleepycat Software: DB 2.4.14: (6/2/98)" + +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. */ +typedef size_t DB_LOCK; /* Object returned by lock manager. */ +#define DB_MAX_RECORDS 0xffffffff /* >= # of records in a tree */ + +#define DB_FILE_ID_LEN 20 /* DB file ID length. */ + +/* Forward structure declarations, so applications get type checking. */ +struct __db; typedef struct __db DB; +#ifdef DB_DBM_HSEARCH + typedef struct __db DBM; +#endif +struct __db_bt_stat; typedef struct __db_bt_stat DB_BTREE_STAT; +struct __db_dbt; typedef struct __db_dbt DBT; +struct __db_env; typedef struct __db_env DB_ENV; +struct __db_info; typedef struct __db_info DB_INFO; +struct __db_lock_stat; typedef struct __db_lock_stat DB_LOCK_STAT; +struct __db_lockregion; typedef struct __db_lockregion DB_LOCKREGION; +struct __db_lockreq; typedef struct __db_lockreq DB_LOCKREQ; +struct __db_locktab; typedef struct __db_locktab DB_LOCKTAB; +struct __db_log; typedef struct __db_log DB_LOG; +struct __db_log_stat; typedef struct __db_log_stat DB_LOG_STAT; +struct __db_lsn; typedef struct __db_lsn DB_LSN; +struct __db_mpool; typedef struct __db_mpool DB_MPOOL; +struct __db_mpool_finfo;typedef struct __db_mpool_finfo DB_MPOOL_FINFO; +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_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 __db_txnregion; typedef struct __db_txnregion DB_TXNREGION; +struct __dbc; typedef struct __dbc DBC; + +/* Key/data structure -- a Data-Base Thang. */ +struct __db_dbt { + 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_INTERNAL 0x01 /* Perform any mallocs using regular + malloc, not the user's malloc. */ +#define DB_DBT_MALLOC 0x02 /* Return in allocated memory. */ +#define DB_DBT_PARTIAL 0x04 /* Partial put/get. */ +#define DB_DBT_USERMEM 0x08 /* Return in user's memory. */ + u_int32_t flags; +}; + +/* + * DB internal configuration. + * + * There are a set of functions that the application can replace with its + * own versions, and some other knobs which can be turned at run-time. + */ +#define DB_FUNC_CALLOC 1 /* DELETED: ANSI C calloc. */ +#define DB_FUNC_CLOSE 2 /* POSIX 1003.1 close. */ +#define DB_FUNC_DIRFREE 3 /* DB: free directory list. */ +#define DB_FUNC_DIRLIST 4 /* DB: create directory list. */ +#define DB_FUNC_EXISTS 5 /* DB: return if file exists. */ +#define DB_FUNC_FREE 6 /* ANSI C free. */ +#define DB_FUNC_FSYNC 7 /* POSIX 1003.1 fsync. */ +#define DB_FUNC_IOINFO 8 /* DB: return file I/O information. */ +#define DB_FUNC_MALLOC 9 /* ANSI C malloc. */ +#define DB_FUNC_MAP 10 /* DB: map file into shared memory. */ +#define DB_FUNC_OPEN 11 /* POSIX 1003.1 open. */ +#define DB_FUNC_READ 12 /* POSIX 1003.1 read. */ +#define DB_FUNC_REALLOC 13 /* ANSI C realloc. */ +#define DB_FUNC_SEEK 14 /* POSIX 1003.1 lseek. */ +#define DB_FUNC_SLEEP 15 /* DB: sleep secs/usecs. */ +#define DB_FUNC_STRDUP 16 /* DELETED: DB: strdup(3). */ +#define DB_FUNC_UNLINK 17 /* POSIX 1003.1 unlink. */ +#define DB_FUNC_UNMAP 18 /* DB: unmap shared memory file. */ +#define DB_FUNC_WRITE 19 /* POSIX 1003.1 write. */ +#define DB_FUNC_YIELD 20 /* DB: yield thread to scheduler. */ +#define DB_TSL_SPINS 21 /* DB: initialize spin count. */ +#define DB_FUNC_RUNLINK 22 /* DB: remove a shared region. */ +#define DB_REGION_ANON 23 /* DB: anonymous, unnamed regions. */ +#define DB_REGION_INIT 24 /* DB: page-fault regions in create. */ +#define DB_REGION_NAME 25 /* DB: anonymous, named regions. */ +#define DB_MUTEXLOCKS 26 /* DB: turn off all mutex locks. */ +#define DB_PAGEYIELD 27 /* DB: yield the CPU on pool get. */ + +/* + * Database configuration and initialization. + */ + /* + * Flags understood by both db_open(3) and db_appinit(3). + */ +#define DB_CREATE 0x000001 /* O_CREAT: create file as necessary. */ +#define DB_NOMMAP 0x000002 /* Don't mmap underlying file. */ +#define DB_THREAD 0x000004 /* Free-thread DB package handles. */ + +/* + * Flags understood by db_appinit(3). + */ +/* 0x000007 COMMON MASK. */ +#define DB_INIT_LOCK 0x000008 /* Initialize locking. */ +#define DB_INIT_LOG 0x000010 /* Initialize logging. */ +#define DB_INIT_MPOOL 0x000020 /* Initialize mpool. */ +#define DB_INIT_TXN 0x000040 /* Initialize transactions. */ +#define DB_MPOOL_PRIVATE 0x000080 /* Mpool: private memory pool. */ +#define __UNUSED_100 0x000100 +#define DB_RECOVER 0x000200 /* Run normal recovery. */ +#define DB_RECOVER_FATAL 0x000400 /* Run catastrophic recovery. */ +#define DB_TXN_NOSYNC 0x000800 /* Do not sync log on commit. */ +#define DB_USE_ENVIRON 0x001000 /* Use the environment. */ +#define DB_USE_ENVIRON_ROOT 0x002000 /* Use the environment if root. */ + +/* CURRENTLY UNUSED LOCK FLAGS. */ +#define DB_TXN_LOCK_2PL 0x000000 /* Two-phase locking. */ +#define DB_TXN_LOCK_OPTIMIST 0x000000 /* Optimistic locking. */ +#define DB_TXN_LOCK_MASK 0x000000 /* Lock flags mask. */ + +/* CURRENTLY UNUSED LOG FLAGS. */ +#define DB_TXN_LOG_REDO 0x000000 /* Redo-only logging. */ +#define DB_TXN_LOG_UNDO 0x000000 /* Undo-only logging. */ +#define DB_TXN_LOG_UNDOREDO 0x000000 /* Undo/redo write-ahead logging. */ +#define DB_TXN_LOG_MASK 0x000000 /* Log flags mask. */ + +/* + * Flags understood by db_open(3). + * + * DB_EXCL and DB_TEMPORARY are internal only, and are not documented. + * DB_SEQUENTIAL is currently internal, but may be exported some day. + */ +/* 0x000007 COMMON MASK. */ +/* 0x003fff ALREADY USED. */ +#define __UNUSED_4000 0x004000 +#define DB_EXCL 0x008000 /* O_EXCL: exclusive open. */ +#define DB_RDONLY 0x010000 /* O_RDONLY: read-only. */ +#define DB_SEQUENTIAL 0x020000 /* Indicate sequential access. */ +#define DB_TEMPORARY 0x040000 /* Remove on last close. */ +#define DB_TRUNCATE 0x080000 /* O_TRUNCATE: replace existing DB. */ + +/* + * Deadlock detector modes; used in the DBENV structure to configure the + * locking subsystem. + */ +#define DB_LOCK_NORUN 0x0 +#define DB_LOCK_DEFAULT 0x1 /* Default policy. */ +#define DB_LOCK_OLDEST 0x2 /* Abort oldest transaction. */ +#define DB_LOCK_RANDOM 0x3 /* Abort random transaction. */ +#define DB_LOCK_YOUNGEST 0x4 /* Abort youngest transaction. */ + +struct __db_env { + int db_lorder; /* Byte order. */ + + /* Error message callback. */ + void (*db_errcall) __P((const char *, char *)); + FILE *db_errfile; /* Error message file stream. */ + const char *db_errpfx; /* Error message prefix. */ + int db_verbose; /* Generate debugging messages. */ + + /* User 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. */ + + /* Locking. */ + DB_LOCKTAB *lk_info; /* Return from lock_open(). */ + 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_detect; /* Deadlock detect on all conflicts. */ + + /* Logging. */ + DB_LOG *lg_info; /* Return from log_open(). */ + u_int32_t lg_max; /* Maximum file size. */ + + /* Memory pool. */ + DB_MPOOL *mp_info; /* Return from memp_open(). */ + size_t mp_mmapsize; /* Maximum file size for mmap. */ + size_t mp_size; /* Bytes in the mpool cache. */ + + /* Transactions. */ + DB_TXNMGR *tx_info; /* Return from txn_open(). */ + u_int32_t tx_max; /* Maximum number of transactions. */ + int (*tx_recover) /* Dispatch function for recovery. */ + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + +#define DB_ENV_APPINIT 0x01 /* Paths initialized by db_appinit(). */ +#define DB_ENV_STANDALONE 0x02 /* Test: freestanding environment. */ +#define DB_ENV_THREAD 0x04 /* DB_ENV is multi-threaded. */ + u_int32_t flags; /* Flags. */ +}; + +/******************************************************* + * Access methods. + *******************************************************/ +/* + * XXX + * Changes here must be reflected in java/src/com/sleepycat/db/Db.java. + */ +typedef enum { + DB_BTREE=1, /* B+tree. */ + DB_HASH, /* Extended Linear Hashing. */ + DB_RECNO, /* Fixed and variable-length records. */ + DB_UNKNOWN /* Figure it out on open. */ +} DBTYPE; + +#define DB_BTREEVERSION 6 /* Current btree version. */ +#define DB_BTREEOLDVER 6 /* Oldest btree version supported. */ +#define DB_BTREEMAGIC 0x053162 + +#define DB_HASHVERSION 5 /* Current hash version. */ +#define DB_HASHOLDVER 4 /* Oldest hash version supported. */ +#define DB_HASHMAGIC 0x061561 + +#define DB_LOGVERSION 2 /* Current log version. */ +#define DB_LOGOLDVER 2 /* Oldest log version supported. */ +#define DB_LOGMAGIC 0x040988 + +struct __db_info { + int db_lorder; /* Byte order. */ + size_t db_cachesize; /* Underlying cache size. */ + size_t db_pagesize; /* Underlying page size. */ + + /* Local heap allocation. */ + void *(*db_malloc) __P((size_t)); + + /* Btree access method. */ + u_int32_t bt_maxkey; /* Maximum keys per page. */ + u_int32_t bt_minkey; /* Minimum keys per page. */ + int (*bt_compare) /* Comparison function. */ + __P((const DBT *, const DBT *)); + size_t (*bt_prefix) /* Prefix function. */ + __P((const DBT *, const DBT *)); + + /* Hash access method. */ + u_int32_t h_ffactor; /* Fill factor. */ + u_int32_t h_nelem; /* Number of elements. */ + u_int32_t (*h_hash) /* Hash function. */ + __P((const void *, u_int32_t)); + + /* 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. */ + +#define DB_DELIMITER 0x0001 /* Recno: re_delim set. */ +#define DB_DUP 0x0002 /* Btree, Hash: duplicate keys. */ +#define DB_FIXEDLEN 0x0004 /* Recno: fixed-length records. */ +#define DB_PAD 0x0008 /* Recno: re_pad set. */ +#define DB_RECNUM 0x0010 /* Btree: record numbers. */ +#define DB_RENUMBER 0x0020 /* Recno: renumber on insert/delete. */ +#define DB_SNAPSHOT 0x0040 /* Recno: snapshot the input. */ + u_int32_t flags; +}; + +/* + * DB access method and cursor operation codes. These are implemented as + * bit fields for future flexibility, but currently only a single one may + * be specified to any function. + */ +#define DB_AFTER 0x000001 /* c_put() */ +#define DB_APPEND 0x000002 /* put() */ +#define DB_BEFORE 0x000004 /* c_put() */ +#define DB_CHECKPOINT 0x000008 /* log_put(), log_get() */ +#define DB_CURRENT 0x000010 /* c_get(), c_put(), log_get() */ +#define DB_FIRST 0x000020 /* c_get(), log_get() */ +#define DB_FLUSH 0x000040 /* log_put() */ +#define DB_GET_RECNO 0x000080 /* get(), c_get() */ +#define DB_KEYFIRST 0x000100 /* c_put() */ +#define DB_KEYLAST 0x000200 /* c_put() */ +#define DB_LAST 0x000400 /* c_get(), log_get() */ +#define DB_NEXT 0x000800 /* c_get(), log_get() */ +#define DB_NOOVERWRITE 0x001000 /* put() */ +#define DB_NOSYNC 0x002000 /* close() */ +#define DB_PREV 0x004000 /* c_get(), log_get() */ +#define DB_RECORDCOUNT 0x008000 /* stat() */ +#define DB_SET 0x010000 /* c_get(), log_get() */ +#define DB_SET_RANGE 0x020000 /* c_get() */ +#define DB_SET_RECNO 0x040000 /* c_get() */ +#define DB_CURLSN 0x080000 /* log_put() */ + +/* + * DB (user visible) error return codes. + * + * XXX + * Changes to any of the user visible error return codes must be reflected + * in java/src/com/sleepycat/db/Db.java. + */ +#define DB_INCOMPLETE ( -1) /* Sync didn't finish. */ +#define DB_KEYEMPTY ( -2) /* The key/data pair was deleted or + was never created by the user. */ +#define DB_KEYEXIST ( -3) /* The key/data pair already exists. */ +#define DB_LOCK_DEADLOCK ( -4) /* Locker killed to resolve deadlock. */ +#define DB_LOCK_NOTGRANTED ( -5) /* Lock unavailable, no-wait set. */ +#define DB_LOCK_NOTHELD ( -6) /* Lock not held by locker. */ +#define DB_NOTFOUND ( -7) /* Key/data pair not found (EOF). */ + +/* DB (private) error return codes. */ +#define DB_DELETED ( -8) /* Recovery file marked deleted. */ +#define DB_NEEDSPLIT ( -9) /* Page needs to be split. */ +#define DB_REGISTERED (-10) /* Entry was previously registered. */ +#define DB_SWAPBYTES (-11) /* Database needs byte swapping. */ +#define DB_TXN_CKP (-12) /* Encountered ckp record in log. */ + +struct __db_ilock { /* Internal DB access method lock. */ + db_pgno_t pgno; /* Page being locked. */ + /* File id. */ + u_int8_t fileid[DB_FILE_ID_LEN]; +}; + +/* DB access method description structure. */ +struct __db { + void *mutexp; /* Synchronization for free threading */ + DBTYPE type; /* DB access method. */ + DB_ENV *dbenv; /* DB_ENV structure. */ + DB_ENV *mp_dbenv; /* DB_ENV for local mpool creation. */ + + DB *master; /* Original DB created by db_open. */ + void *internal; /* Access method private. */ + + DB_MPOOL *mp; /* The access method's mpool. */ + DB_MPOOLFILE *mpf; /* The access method's mpool file. */ + + /* + * XXX + * Explicit representations of structures in queue.h. + * + * TAILQ_HEAD(curs_queue, __dbc); + */ + struct { + struct __dbc *tqh_first; + struct __dbc **tqh_last; + } curs_queue; + + /* + * XXX + * Explicit representations of structures in queue.h. + * + * LIST_HEAD(handleq, __db); + * LIST_ENTRY(__db); + */ + struct { + struct __db *lh_first; + } handleq; /* List of handles for this DB. */ + struct { + struct __db *le_next; + struct __db **le_prev; + } links; /* Links for the handle list. */ + + u_int32_t log_fileid; /* Logging file id. */ + + DB_TXN *txn; /* Current transaction. */ + u_int32_t locker; /* Default process' locker id. */ + DBT lock_dbt; /* DBT referencing lock. */ + struct __db_ilock lock; /* Lock. */ + + size_t pgsize; /* Logical page size of file. */ + + /* Local heap allocation. */ + void *(*db_malloc) __P((size_t)); + + /* Functions. */ + int (*close) __P((DB *, u_int32_t)); + int (*cursor) __P((DB *, DB_TXN *, DBC **)); + int (*del) __P((DB *, DB_TXN *, DBT *, u_int32_t)); + int (*fd) __P((DB *, int *)); + int (*get) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); + int (*put) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); + int (*stat) __P((DB *, void *, void *(*)(size_t), u_int32_t)); + int (*sync) __P((DB *, u_int32_t)); + +#define DB_AM_DUP 0x000001 /* DB_DUP (internal). */ +#define DB_AM_INMEM 0x000002 /* In-memory; no sync on close. */ +#define DB_AM_LOCKING 0x000004 /* Perform locking. */ +#define DB_AM_LOGGING 0x000008 /* Perform logging. */ +#define DB_AM_MLOCAL 0x000010 /* Database memory pool is local. */ +#define DB_AM_PGDEF 0x000020 /* Page size was defaulted. */ +#define DB_AM_RDONLY 0x000040 /* Database is readonly. */ +#define DB_AM_RECOVER 0x000080 /* In recovery (do not log or lock). */ +#define DB_AM_SWAP 0x000100 /* Pages need to be byte-swapped. */ +#define DB_AM_THREAD 0x000200 /* DB is multi-threaded. */ +#define DB_BT_RECNUM 0x000400 /* DB_RECNUM (internal) */ +#define DB_HS_DIRTYMETA 0x000800 /* Hash: Metadata page modified. */ +#define DB_RE_DELIMITER 0x001000 /* DB_DELIMITER (internal). */ +#define DB_RE_FIXEDLEN 0x002000 /* DB_FIXEDLEN (internal). */ +#define DB_RE_PAD 0x004000 /* DB_PAD (internal). */ +#define DB_RE_RENUMBER 0x008000 /* DB_RENUMBER (internal). */ +#define DB_RE_SNAPSHOT 0x010000 /* DB_SNAPSHOT (internal). */ + u_int32_t flags; +}; + +/* Cursor description structure. */ +struct __dbc { + DB *dbp; /* Related DB access method. */ + DB_TXN *txn; /* Associated transaction. */ + + /* + * XXX + * Explicit representations of structures in queue.h. + * + * TAILQ_ENTRY(__dbc); + */ + struct { + struct __dbc *tqe_next; + struct __dbc **tqe_prev; + } links; + + void *internal; /* Access method private. */ + + int (*c_close) __P((DBC *)); + int (*c_del) __P((DBC *, u_int32_t)); + int (*c_get) __P((DBC *, DBT *, DBT *, u_int32_t)); + int (*c_put) __P((DBC *, DBT *, DBT *, u_int32_t)); +}; + +/* Btree/recno statistics structure. */ +struct __db_bt_stat { + u_int32_t bt_flags; /* Open flags. */ + 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_pagesize; /* Page size. */ + u_int32_t bt_levels; /* Tree levels. */ + u_int32_t bt_nrecs; /* Number of records. */ + 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_freed; /* Pages freed for reuse. */ + 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. */ + u_int32_t bt_pfxsaved; /* Bytes saved by prefix compression. */ + u_int32_t bt_split; /* Total number of splits. */ + u_int32_t bt_rootsplit; /* Root page splits. */ + u_int32_t bt_fastsplit; /* Fast splits. */ + u_int32_t bt_added; /* Items added. */ + u_int32_t bt_deleted; /* Items deleted. */ + u_int32_t bt_get; /* Items retrieved. */ + u_int32_t bt_cache_hit; /* Hits in fast-insert code. */ + u_int32_t bt_cache_miss; /* Misses in fast-insert code. */ + u_int32_t bt_magic; /* Magic number. */ + u_int32_t bt_version; /* Version number. */ +}; + +#if defined(__cplusplus) +extern "C" { +#endif +int db_appinit __P((const char *, char * const *, DB_ENV *, u_int32_t)); +int db_appexit __P((DB_ENV *)); +int db_jump_set __P((void *, int)); +int db_open __P((const char *, + DBTYPE, u_int32_t, int, DB_ENV *, DB_INFO *, DB **)); +int db_value_set __P((int, int)); +char *db_version __P((int *, int *, int *)); +#if defined(__cplusplus) +} +#endif + +/******************************************************* + * Locking + *******************************************************/ +#define DB_LOCKVERSION 1 +#define DB_LOCKMAGIC 0x090193 + +/* Flag values for lock_vec(). */ +#define DB_LOCK_NOWAIT 0x01 /* Don't wait on unavailable lock. */ + +/* Flag values for lock_detect(). */ +#define DB_LOCK_CONFLICT 0x01 /* Run on any conflict. */ + +/* + * Request types. + * + * XXX + * Changes here must be reflected in java/src/com/sleepycat/db/Db.java. + */ +typedef enum { + DB_LOCK_DUMP=0, /* Display held locks. */ + DB_LOCK_GET, /* Get the lock. */ + DB_LOCK_PUT, /* Release the lock. */ + DB_LOCK_PUT_ALL, /* Release locker's locks. */ + DB_LOCK_PUT_OBJ /* Release locker's locks on obj. */ +} db_lockop_t; + +/* + * Simple R/W lock modes and for multi-granularity intention locking. + * + * XXX + * Changes here must be reflected in java/src/com/sleepycat/db/Db.java. + */ +typedef enum { + DB_LOCK_NG=0, /* Not granted. */ + DB_LOCK_READ, /* Shared/read. */ + DB_LOCK_WRITE, /* Exclusive/write. */ + DB_LOCK_IREAD, /* Intent to share/read. */ + DB_LOCK_IWRITE, /* Intent exclusive/write. */ + DB_LOCK_IWR /* Intent to read and write. */ +} db_lockmode_t; + +/* + * Status of a lock. + */ +typedef enum { + DB_LSTAT_ABORTED, /* Lock belongs to an aborted txn. */ + DB_LSTAT_ERR, /* Lock is bad. */ + DB_LSTAT_FREE, /* Lock is unallocated. */ + DB_LSTAT_HELD, /* Lock is currently held. */ + DB_LSTAT_NOGRANT, /* Lock was not granted. */ + DB_LSTAT_PENDING, /* Lock was waiting and has been + * promoted; waiting for the owner + * to run and upgrade it to held. */ + DB_LSTAT_WAITING /* Lock is on the wait queue. */ +} db_status_t; + +/* Lock request structure. */ +struct __db_lockreq { + db_lockop_t op; /* Operation. */ + db_lockmode_t mode; /* Requested mode. */ + u_int32_t locker; /* Locker identity. */ + DBT *obj; /* Object being locked. */ + DB_LOCK lock; /* Lock returned. */ +}; + +/* + * Commonly used conflict matrices. + * + * Standard Read/Write (or exclusive/shared) locks. + */ +#define DB_LOCK_RW_N 3 +extern const u_int8_t db_rw_conflicts[]; + +/* Multi-granularity locking. */ +#define DB_LOCK_RIW_N 6 +extern const u_int8_t db_riw_conflicts[]; + +struct __db_lock_stat { + u_int32_t st_magic; /* Lock file magic number. */ + u_int32_t st_version; /* Lock file version number. */ + u_int32_t st_maxlocks; /* Maximum number of locks in table. */ + u_int32_t st_nmodes; /* Number of lock modes. */ + u_int32_t st_numobjs; /* Number of objects. */ + u_int32_t st_nlockers; /* Number of lockers. */ + 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_ndeadlocks; /* Number of lock deadlocks. */ + 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_refcnt; /* Region reference count. */ + u_int32_t st_regsize; /* Region size. */ +}; + +#if defined(__cplusplus) +extern "C" { +#endif +int lock_close __P((DB_LOCKTAB *)); +int lock_detect __P((DB_LOCKTAB *, u_int32_t, u_int32_t)); +int lock_get __P((DB_LOCKTAB *, + u_int32_t, u_int32_t, const DBT *, db_lockmode_t, DB_LOCK *)); +int lock_id __P((DB_LOCKTAB *, u_int32_t *)); +int lock_open __P((const char *, + u_int32_t, int, DB_ENV *, DB_LOCKTAB **)); +int lock_put __P((DB_LOCKTAB *, DB_LOCK)); +int lock_stat __P((DB_LOCKTAB *, DB_LOCK_STAT **, void *(*)(size_t))); +int lock_unlink __P((const char *, int, DB_ENV *)); +int lock_vec __P((DB_LOCKTAB *, + u_int32_t, u_int32_t, DB_LOCKREQ *, int, DB_LOCKREQ **)); +#if defined(__cplusplus) +} +#endif + +/******************************************************* + * Logging. + *******************************************************/ +/* 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. */ +}; + +/* Log statistics structure. */ +struct __db_log_stat { + u_int32_t st_magic; /* Log file magic number. */ + u_int32_t st_version; /* Log file version number. */ + int st_mode; /* Log file mode. */ + u_int32_t st_lg_max; /* Maximum log file size. */ + u_int32_t st_w_bytes; /* Bytes to log. */ + u_int32_t st_w_mbytes; /* Megabytes to log. */ + u_int32_t st_wc_bytes; /* Bytes to log since checkpoint. */ + u_int32_t st_wc_mbytes; /* Megabytes to log since checkpoint. */ + u_int32_t st_wcount; /* Total syncs to the log. */ + u_int32_t st_scount; /* Total writes to the log. */ + u_int32_t st_region_wait; /* Region lock granted after wait. */ + u_int32_t st_region_nowait; /* Region lock granted without wait. */ + u_int32_t st_cur_file; /* Current log file number. */ + u_int32_t st_cur_offset; /* Current log file offset. */ + u_int32_t st_refcnt; /* Region reference count. */ + u_int32_t st_regsize; /* Region size. */ +}; + +#if defined(__cplusplus) +extern "C" { +#endif +int log_archive __P((DB_LOG *, char **[], u_int32_t, void *(*)(size_t))); +int log_close __P((DB_LOG *)); +int log_compare __P((const DB_LSN *, const DB_LSN *)); +int log_file __P((DB_LOG *, const DB_LSN *, char *, size_t)); +int log_flush __P((DB_LOG *, const DB_LSN *)); +int log_get __P((DB_LOG *, DB_LSN *, DBT *, u_int32_t)); +int log_open __P((const char *, u_int32_t, int, DB_ENV *, DB_LOG **)); +int log_put __P((DB_LOG *, DB_LSN *, const DBT *, u_int32_t)); +int log_register __P((DB_LOG *, DB *, const char *, DBTYPE, u_int32_t *)); +int log_stat __P((DB_LOG *, DB_LOG_STAT **, void *(*)(size_t))); +int log_unlink __P((const char *, int, DB_ENV *)); +int log_unregister __P((DB_LOG *, u_int32_t)); +#if defined(__cplusplus) +} +#endif + +/******************************************************* + * Mpool + *******************************************************/ +/* Flag values for memp_fget(). */ +#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 memp_fput(), memp_fset(). */ +#define DB_MPOOL_CLEAN 0x001 /* Clear modified bit. */ +#define DB_MPOOL_DIRTY 0x002 /* Page is modified. */ +#define DB_MPOOL_DISCARD 0x004 /* Don't cache the page. */ + +/* Mpool statistics structure. */ +struct __db_mpool_stat { + size_t st_cachesize; /* Cache size. */ + u_int32_t st_cache_hit; /* Pages found in the cache. */ + u_int32_t st_cache_miss; /* Pages not found in the cache. */ + u_int32_t st_map; /* Pages from mapped files. */ + u_int32_t st_page_create; /* Pages created in the cache. */ + u_int32_t st_page_in; /* Pages read in. */ + u_int32_t st_page_out; /* Pages written out. */ + u_int32_t st_ro_evict; /* Clean pages forced from the cache. */ + u_int32_t st_rw_evict; /* Dirty pages forced from the cache. */ + u_int32_t st_hash_buckets; /* Number of hash buckets. */ + u_int32_t st_hash_searches; /* Total hash chain searches. */ + u_int32_t st_hash_longest; /* Longest hash chain searched. */ + u_int32_t st_hash_examined; /* Total hash entries searched. */ + u_int32_t st_page_clean; /* Clean pages. */ + u_int32_t st_page_dirty; /* Dirty pages. */ + u_int32_t st_page_trickle; /* Pages written by memp_trickle. */ + u_int32_t st_region_wait; /* Region lock granted after wait. */ + u_int32_t st_region_nowait; /* Region lock granted without wait. */ + u_int32_t st_refcnt; /* Region reference count. */ + u_int32_t st_regsize; /* Region size. */ +}; + +/* Mpool file open information structure. */ +struct __db_mpool_finfo { + 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. */ +}; + +/* Mpool file statistics structure. */ +struct __db_mpool_fstat { + char *file_name; /* File name. */ + size_t st_pagesize; /* Page size. */ + u_int32_t st_cache_hit; /* Pages found in the cache. */ + u_int32_t st_cache_miss; /* Pages not found in the cache. */ + u_int32_t st_map; /* Pages from mapped files. */ + u_int32_t st_page_create; /* Pages created in the cache. */ + u_int32_t st_page_in; /* Pages read in. */ + u_int32_t st_page_out; /* Pages written out. */ +}; + +#if defined(__cplusplus) +extern "C" { +#endif +int memp_close __P((DB_MPOOL *)); +int memp_fclose __P((DB_MPOOLFILE *)); +int memp_fget __P((DB_MPOOLFILE *, db_pgno_t *, u_int32_t, void *)); +int memp_fopen __P((DB_MPOOL *, const char *, + u_int32_t, int, size_t, DB_MPOOL_FINFO *, DB_MPOOLFILE **)); +int memp_fput __P((DB_MPOOLFILE *, void *, u_int32_t)); +int memp_fset __P((DB_MPOOLFILE *, void *, u_int32_t)); +int memp_fsync __P((DB_MPOOLFILE *)); +int memp_open __P((const char *, u_int32_t, int, DB_ENV *, DB_MPOOL **)); +int memp_register __P((DB_MPOOL *, int, + int (*)(db_pgno_t, void *, DBT *), + int (*)(db_pgno_t, void *, DBT *))); +int memp_stat __P((DB_MPOOL *, + DB_MPOOL_STAT **, DB_MPOOL_FSTAT ***, void *(*)(size_t))); +int memp_sync __P((DB_MPOOL *, DB_LSN *)); +int memp_trickle __P((DB_MPOOL *, int, int *)); +int memp_unlink __P((const char *, int, DB_ENV *)); +#if defined(__cplusplus) +} +#endif + +/******************************************************* + * Transactions. + *******************************************************/ +#define DB_TXNVERSION 1 +#define DB_TXNMAGIC 0x041593 + +/* Operations values to the tx_recover() function. */ +#define DB_TXN_BACKWARD_ROLL 1 /* Read the log backwards. */ +#define DB_TXN_FORWARD_ROLL 2 /* Read the log forwards. */ +#define DB_TXN_OPENFILES 3 /* Read for open files. */ +#define DB_TXN_REDO 4 /* Redo the operation. */ +#define DB_TXN_UNDO 5 /* Undo the operation. */ + +/* Internal transaction status values. */ + +/* Transaction statistics structure. */ +struct __db_txn_active { + u_int32_t txnid; /* Transaction ID */ + DB_LSN lsn; /* Lsn of the begin record */ +}; + +struct __db_txn_stat { + DB_LSN st_last_ckp; /* lsn of the last checkpoint */ + DB_LSN st_pending_ckp; /* last checkpoint did not finish */ + 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 number of active txns */ + 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 */ + 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_refcnt; /* Region reference count. */ + u_int32_t st_regsize; /* Region size. */ +}; + +#if defined(__cplusplus) +extern "C" { +#endif +int txn_abort __P((DB_TXN *)); +int txn_begin __P((DB_TXNMGR *, DB_TXN *, DB_TXN **)); +int txn_checkpoint __P((const DB_TXNMGR *, u_int32_t, u_int32_t)); +int txn_commit __P((DB_TXN *)); +int txn_close __P((DB_TXNMGR *)); +u_int32_t txn_id __P((DB_TXN *)); +int txn_open __P((const char *, u_int32_t, int, DB_ENV *, DB_TXNMGR **)); +int txn_prepare __P((DB_TXN *)); +int txn_stat __P((DB_TXNMGR *, DB_TXN_STAT **, void *(*)(size_t))); +int txn_unlink __P((const char *, int, DB_ENV *)); +#if defined(__cplusplus) +} +#endif + +#ifndef DB_DBM_HSEARCH +#define DB_DBM_HSEARCH 0 /* No historic interfaces by default. */ +#endif +#if DB_DBM_HSEARCH != 0 +/******************************************************* + * Dbm/Ndbm historic interfaces. + *******************************************************/ +#define DBM_INSERT 0 /* Flags to dbm_store(). */ +#define DBM_REPLACE 1 + +/* + * The db(3) 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 DBM calls into DB calls so that DB doesn't step on the + * application's name space. + * + * The global variables dbrdonly, dirf and pagf were not retained when + * 4BSD replaced the dbm interface with ndbm, and are not support here. + */ +#define dbminit(a) __db_dbm_init(a) +#if !defined(__cplusplus) +#define delete(a) __db_dbm_delete(a) +#endif +#define fetch(a) __db_dbm_fetch(a) +#define firstkey __db_dbm_firstkey +#define nextkey(a) __db_dbm_nextkey(a) +#define store(a, b) __db_dbm_store(a, b) + +/* Prototype the DB calls. */ +#if defined(__cplusplus) +extern "C" { +#endif +int __db_dbm_init __P((char *)); +int __db_dbm_delete __P((datum)); +int __db_dbm_dbrdonly __P((void)); +int __db_dbm_dirf __P((void)); +datum __db_dbm_fetch __P((datum)); +datum __db_dbm_firstkey __P((void)); +datum __db_dbm_nextkey __P((datum)); +int __db_dbm_pagf __P((void)); +int __db_dbm_store __P((datum, datum)); +#if defined(__cplusplus) +} +#endif + +/* + * 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(a) +#define dbm_close(a) __db_ndbm_close(a) +#define dbm_delete(a, b) __db_ndbm_delete(a, b) +#define dbm_dirfno(a) __db_ndbm_dirfno(a) +#define dbm_error(a) __db_ndbm_error(a) +#define dbm_fetch(a, b) __db_ndbm_fetch(a, b) +#define dbm_firstkey(a) __db_ndbm_firstkey(a) +#define dbm_nextkey(a) __db_ndbm_nextkey(a) +#define dbm_open(a, b, c) __db_ndbm_open(a, b, c) +#define dbm_pagfno(a) __db_ndbm_pagfno(a) +#define dbm_rdonly(a) __db_ndbm_rdonly(a) +#define dbm_store(a, b, c, d) __db_ndbm_store(a, b, c, d) + +/* Prototype the DB calls. */ +#if defined(__cplusplus) +extern "C" { +#endif +int __db_ndbm_clearerr __P((DBM *)); +void __db_ndbm_close __P((DBM *)); +int __db_ndbm_delete __P((DBM *, datum)); +int __db_ndbm_dirfno __P((DBM *)); +int __db_ndbm_error __P((DBM *)); +datum __db_ndbm_fetch __P((DBM *, datum)); +datum __db_ndbm_firstkey __P((DBM *)); +datum __db_ndbm_nextkey __P((DBM *)); +DBM *__db_ndbm_open __P((const char *, int, int)); +int __db_ndbm_pagfno __P((DBM *)); +int __db_ndbm_rdonly __P((DBM *)); +int __db_ndbm_store __P((DBM *, datum, datum, int)); +#if defined(__cplusplus) +} +#endif + +/******************************************************* + * Hsearch historic interface. + *******************************************************/ +typedef enum { + FIND, ENTER +} ACTION; + +typedef struct entry { + char *key; + char *data; +} ENTRY; + +/* + * Translate HSEARCH calls into DB calls so that DB doesn't step on the + * application's name space. + */ +#define hcreate(a) __db_hcreate(a) +#define hdestroy __db_hdestroy +#define hsearch(a, b) __db_hsearch(a, b) + +/* Prototype the DB calls. */ +#if defined(__cplusplus) +extern "C" { +#endif +int __db_hcreate __P((size_t)); +void __db_hdestroy __P((void)); +ENTRY *__db_hsearch __P((ENTRY, ACTION)); +#if defined(__cplusplus) +} +#endif +#endif /* DB_DBM_HSEARCH */ + +/* + * XXX + * MacOS: Reset Metrowerks C enum sizes. + */ +#ifdef __MWERKS__ +#pragma enumsalwaysint reset +#endif +#endif /* !_DB_H_ */ diff --git a/mozilla/db/include/db_185.h.src b/mozilla/db/include/db_185.h.src new file mode 100644 index 00000000000..a928ca8fd52 --- /dev/null +++ b/mozilla/db/include/db_185.h.src @@ -0,0 +1,178 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * 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. 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. + * + * @(#)db_185.h.src 8.7 (Sleepycat) 4/10/98 + */ + +#ifndef _DB_185_H_ +#define _DB_185_H_ + +#include + +#include + +/* + * 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; + +#if defined(__cplusplus) +extern "C" { +#endif +DB *dbopen __P((const char *, int, int, DBTYPE, const void *)); + +#if defined(__cplusplus) +} +#endif +#endif /* !_DB_185_H_ */ diff --git a/mozilla/db/include/db_am.h b/mozilla/db/include/db_am.h new file mode 100644 index 00000000000..0c189244a2d --- /dev/null +++ b/mozilla/db/include/db_am.h @@ -0,0 +1,87 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)db_am.h 10.9 (Sleepycat) 4/10/98 + */ +#ifndef _DB_AM_H +#define _DB_AM_H + +#define DB_ISBIG 0x01 +#define DB_ADD_DUP 0x10 +#define DB_REM_DUP 0x20 +#define DB_ADD_BIG 0x30 +#define DB_REM_BIG 0x40 +#define DB_SPLITOLD 0x50 +#define DB_SPLITNEW 0x60 + +/* + * Standard initialization and shutdown macros for all recovery functions. + * + * Requires the following local variables: + * + * DB *file_dbp, *mdbp; + * DB_MPOOLFILE *mpf; + * int ret; + */ +#define REC_INTRO(func) { \ + file_dbp = mdbp = NULL; \ + if ((ret = func(dbtp->data, &argp)) != 0) \ + goto out; \ + if ((ret = __db_fileid_to_db(logp, &mdbp, argp->fileid)) != 0) {\ + if (ret == DB_DELETED) \ + ret = 0; \ + goto out; \ + } \ + if (mdbp == NULL) \ + goto out; \ + if (F_ISSET(mdbp, DB_AM_THREAD)) { \ + if ((ret = __db_gethandle(mdbp, \ + mdbp->type == DB_HASH ? __ham_hdup : __bam_bdup, \ + &file_dbp)) != 0) \ + goto out; \ + } else \ + file_dbp = mdbp; \ + F_SET(file_dbp, DB_AM_RECOVER); \ + mpf = file_dbp->mpf; \ +} +#define REC_CLOSE { \ + if (argp != NULL) \ + __db_free(argp); \ + if (file_dbp != NULL) { \ + F_CLR(file_dbp, DB_AM_RECOVER); \ + if (F_ISSET(file_dbp, DB_AM_THREAD)) \ + __db_puthandle(file_dbp); \ + } \ + return (ret); \ +} + +/* + * No-op versions of the same macros. + */ +#define REC_NOOP_INTRO(func) { \ + if ((ret = func(dbtp->data, &argp)) != 0) \ + return (ret); \ +} +#define REC_NOOP_CLOSE { \ + if (argp != NULL) \ + __db_free(argp); \ + return (ret); \ +} + +/* + * Standard debugging macro for all recovery functions. + */ +#ifdef DEBUG_RECOVER +#define REC_PRINT(func) \ + (void)func(logp, dbtp, lsnp, redo, info); +#else +#define REC_PRINT(func) \ + COMPQUIET(info, NULL); +#endif + +#include "db_auto.h" +#include "db_ext.h" +#endif diff --git a/mozilla/db/include/db_auto.h b/mozilla/db/include/db_auto.h new file mode 100644 index 00000000000..1b07c748e88 --- /dev/null +++ b/mozilla/db/include/db_auto.h @@ -0,0 +1,122 @@ +/* Do not edit: automatically built by dist/db_gen.sh. */ +#ifndef db_AUTO_H +#define db_AUTO_H + +#define DB_db_addrem (DB_db_BEGIN + 1) + +typedef struct _db_addrem_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t opcode; + u_int32_t fileid; + db_pgno_t pgno; + u_int32_t indx; + size_t nbytes; + DBT hdr; + DBT dbt; + DB_LSN pagelsn; +} __db_addrem_args; + + +#define DB_db_split (DB_db_BEGIN + 2) + +typedef struct _db_split_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t opcode; + u_int32_t fileid; + db_pgno_t pgno; + DBT pageimage; + DB_LSN pagelsn; +} __db_split_args; + + +#define DB_db_big (DB_db_BEGIN + 3) + +typedef struct _db_big_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t opcode; + u_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 (DB_db_BEGIN + 4) + +typedef struct _db_ovref_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t fileid; + db_pgno_t pgno; + int32_t adjust; + DB_LSN lsn; +} __db_ovref_args; + + +#define DB_db_relink (DB_db_BEGIN + 5) + +typedef struct _db_relink_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_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_addpage (DB_db_BEGIN + 6) + +typedef struct _db_addpage_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t fileid; + db_pgno_t pgno; + DB_LSN lsn; + db_pgno_t nextpgno; + DB_LSN nextlsn; +} __db_addpage_args; + + +#define DB_db_debug (DB_db_BEGIN + 7) + +typedef struct _db_debug_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + DBT op; + u_int32_t fileid; + DBT key; + DBT data; + u_int32_t arg_flags; +} __db_debug_args; + + +#define DB_db_noop (DB_db_BEGIN + 8) + +typedef struct _db_noop_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t fileid; + db_pgno_t pgno; + DB_LSN prevlsn; +} __db_noop_args; + +#endif diff --git a/mozilla/db/include/db_cxx.h b/mozilla/db/include/db_cxx.h new file mode 100644 index 00000000000..fc04d5d66bb --- /dev/null +++ b/mozilla/db/include/db_cxx.h @@ -0,0 +1,887 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)db_cxx.h 10.17 (Sleepycat) 5/2/98 + */ + +#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, see setErrorModel(). +// +// 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 many 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 "db.h" + +class Db; // forward +class Dbc; // forward +class DbEnv; // forward +class DbException; // forward +class DbInfo; // forward +class DbLock; // forward +class DbLockTab; // forward +class DbLog; // forward +class DbLsn; // forward +class DbMpool; // forward +class DbMpoolFile; // forward +class Dbt; // forward +class DbTxn; // forward +class DbTxnMgr; // forward + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// 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 + +# define _exported + +#endif + +// 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* imp() 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 +// +// 4514: unreferenced inline function has been removed +// certain include files in MSVC define methods that are not called +// +#pragma warning(disable: 4201 4514) + +#endif + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// 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 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); + const int get_errno(); + virtual const char *what() const; + + DbException(const DbException &); + DbException &operator = (const DbException &); + +private: + char *what_; + int err_; // errno +}; + + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// Lock classes +// + +class _exported DbLock +{ + friend DbLockTab; + +public: + DbLock(u_int); + DbLock(); + + u_int get_lock_id(); + void set_lock_id(u_int); + + int put(DbLockTab *locktab); + + 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) + + DB_LOCK lock_; +}; + +class _exported DbLockTab +{ +friend DbEnv; +public: + int close(); + int detect(u_int32_t flags, int atype); + int get(u_int32_t locker, u_int32_t flags, const Dbt *obj, + db_lockmode_t lock_mode, DbLock *lock); + int id(u_int32_t *idp); + int vec(u_int32_t locker, u_int32_t flags, DB_LOCKREQ list[], + int nlist, DB_LOCKREQ **elistp); + + // Create or remove new locktab files + // + static int open(const char *dir, u_int32_t flags, int mode, + DbEnv* dbenv, DbLockTab **regionp); + static int unlink(const char *dir, int force, DbEnv* dbenv); + +private: + // We can add data to this class if needed + // since it is implemented via a pointer. + // (see comment at top) + + // copying not allowed + // + DbLockTab(const DbLockTab &); + DbLockTab &operator = (const DbLockTab &); + + // Note: use DbLockTab::open() or DbEnv::get_lk_info() + // to get pointers to a DbLockTab, + // and call DbLockTab::close() rather than delete to release them. + // + DbLockTab(); + ~DbLockTab(); + + DEFINE_DB_CLASS(DbLockTab); +}; + + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// Log classes +// + +class _exported DbLsn : protected DB_LSN +{ + friend DbLog; // friendship needed to cast to base class + friend DbMpool; +}; + +class _exported DbLog +{ +friend DbEnv; +public: + int archive(char **list[], u_int32_t flags, void *(*db_malloc)(size_t)); + int close(); + static int compare(const DbLsn *lsn0, const DbLsn *lsn1); + int file(DbLsn *lsn, char *namep, int len); + int flush(const DbLsn *lsn); + int get(DbLsn *lsn, Dbt *data, u_int32_t flags); + int put(DbLsn *lsn, const Dbt *data, u_int32_t flags); + + // Normally these would be called register and unregister to + // parallel the C interface, but "register" is a reserved word. + // + int db_register(Db *dbp, const char *name, DBTYPE type, u_int32_t *fidp); + int db_unregister(u_int32_t fid); + + // Create or remove new log files + // + static int open(const char *dir, u_int32_t flags, int mode, + DbEnv* dbenv, DbLog **regionp); + static int unlink(const char *dir, int force, DbEnv* dbenv); + +private: + // We can add data to this class if needed + // since it is implemented via a pointer. + // (see comment at top) + + // Note: use DbLog::open() or DbEnv::get_lg_info() + // to get pointers to a DbLog, + // and call DbLog::close() rather than delete to release them. + // + DbLog(); + ~DbLog(); + + // no copying + DbLog(const DbLog &); + operator = (const DbLog &); + + DEFINE_DB_CLASS(DbLog); +}; + + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// Memory pool classes +// + +class _exported DbMpoolFile +{ +friend DbEnv; +public: + int close(); + int get(db_pgno_t *pgnoaddr, u_int32_t flags, void *pagep); + int put(void *pgaddr, u_int32_t flags); + int set(void *pgaddr, u_int32_t flags); + int sync(); + + static int open(DbMpool *mp, const char *file, + u_int32_t flags, int mode, size_t pagesize, + DB_MPOOL_FINFO *finfop, DbMpoolFile **mpf); + +private: + // We can add data to this class if needed + // since it is implemented via a pointer. + // (see comment at top) + + // Note: use DbMpoolFile::open() + // to get pointers to a DbMpoolFile, + // and call DbMpoolFile::close() rather than delete to release them. + // + DbMpoolFile(); + + // Shut g++ up. +protected: + ~DbMpoolFile(); + +private: + // no copying + DbMpoolFile(const DbMpoolFile &); + operator = (const DbMpoolFile &); + + DEFINE_DB_CLASS(DbMpoolFile); +}; + +class _exported DbMpool +{ +friend DbEnv; +public: + int close(); + + // access to low level interface + // Normally this would be called register to parallel + // the C interface, but "register" is a reserved word. + // + int db_register(int ftype, + int (*pgin)(db_pgno_t pgno, void *pgaddr, DBT *pgcookie), + int (*pgout)(db_pgno_t pgno, void *pgaddr, DBT *pgcookie)); + + int stat(DB_MPOOL_STAT **gsp, DB_MPOOL_FSTAT ***fsp, + void *(*db_malloc)(size_t)); + int sync(DbLsn *lsn); + int trickle(int pct, int *nwrotep); + + // Create or remove new mpool files + // + static int open(const char *dir, u_int32_t flags, int mode, + DbEnv* dbenv, DbMpool **regionp); + static int unlink(const char *dir, int force, DbEnv* dbenv); + +private: + // We can add data to this class if needed + // since it is implemented via a pointer. + // (see comment at top) + + // Note: use DbMpool::open() or DbEnv::get_mp_info() + // to get pointers to a DbMpool, + // and call DbMpool::close() rather than delete to release them. + // + DbMpool(); + ~DbMpool(); + + // no copying + DbMpool(const DbMpool &); + DbMpool &operator = (const DbMpool &); + + DEFINE_DB_CLASS(DbMpool); +}; + + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// Transaction classes +// + +class _exported DbTxnMgr +{ +friend DbEnv; +public: + int begin(DbTxn *pid, DbTxn **tid); + int checkpoint(u_int32_t kbyte, u_int32_t min) const; + int close(); + int stat(DB_TXN_STAT **statp, void *(*db_malloc)(size_t)); + + // Create or remove new txnmgr files + // + static int open(const char *dir, u_int32_t flags, int mode, + DbEnv* dbenv, DbTxnMgr **regionp); + static int unlink(const char *dir, int force, DbEnv* dbenv); + +private: + // We can add data to this class if needed + // since it is implemented via a pointer. + // (see comment at top) + + // Note: use DbTxnMgr::open() or DbEnv::get_tx_info() + // to get pointers to a DbTxnMgr, + // and call DbTxnMgr::close() rather than delete to release them. + // + DbTxnMgr(); + ~DbTxnMgr(); + + // no copying + DbTxnMgr(const DbTxnMgr &); + operator = (const DbTxnMgr &); + + DEFINE_DB_CLASS(DbTxnMgr); +}; + +class _exported DbTxn +{ +friend DbTxnMgr; +public: + int abort(); + int commit(); + u_int32_t id(); + int prepare(); + +private: + // We can add data to this class if needed + // since it is implemented via a pointer. + // (see comment at top) + + // Note: use DbTxnMgr::begin() to get pointers to a DbTxn, + // and call DbTxn::abort() or DbTxn::commit rather than + // delete to release them. + // + DbTxn(); + ~DbTxn(); + + // no copying + DbTxn(const DbTxn &); + operator = (const DbTxn &); + + DEFINE_DB_CLASS(DbTxn); +}; + + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// Application classes +// + +// +// A set of application options - define how this application uses +// the db library. +// +class _exported DbInfo : protected DB_INFO +{ + friend DbEnv; + friend Db; + +public: + DbInfo(); + ~DbInfo(); + + // Byte order. + int get_lorder() const; + void set_lorder(int); + + // Underlying cache size. + size_t get_cachesize() const; + void set_cachesize(size_t); + + // Underlying page size. + size_t get_pagesize() const; + void set_pagesize(size_t); + + // Local heap allocation. + typedef void *(*db_malloc_fcn)(size_t); + db_malloc_fcn get_malloc() const; + void set_malloc(db_malloc_fcn); + + //////////////////////////////////////////////////////////////// + // Btree access method. + + // Maximum keys per page. + int get_bt_maxkey() const; + void set_bt_maxkey(int); + + // Minimum keys per page. + int get_bt_minkey() const; + void set_bt_minkey(int); + + // Comparison function. + typedef int (*bt_compare_fcn)(const DBT *, const DBT *); + bt_compare_fcn get_bt_compare() const; + void set_bt_compare(bt_compare_fcn); + + // Prefix function. + typedef size_t (*bt_prefix_fcn)(const DBT *, const DBT *); + bt_prefix_fcn get_bt_prefix() const; + void set_bt_prefix(bt_prefix_fcn); + + //////////////////////////////////////////////////////////////// + // Hash access method. + + // Fill factor. + u_int32_t get_h_ffactor() const; + void set_h_ffactor(u_int32_t); + + // Number of elements. + u_int32_t get_h_nelem() const; + void set_h_nelem(u_int32_t); + + // Hash function. + typedef u_int32_t (*h_hash_fcn)(const void *, u_int32_t); + h_hash_fcn get_h_hash() const; + void set_h_hash(h_hash_fcn); + + //////////////////////////////////////////////////////////////// + // Recno access method. + + // Fixed-length padding byte. + int get_re_pad() const; + void set_re_pad(int); + + // Variable-length delimiting byte. + int get_re_delim() const; + void set_re_delim(int); + + // Length for fixed-length records. + u_int32_t get_re_len() const; + void set_re_len(u_int32_t); + + // Source file name. + char *get_re_source() const; + void set_re_source(char *); + + // Note: some flags are set as side effects of calling + // above "set" methods. + // + u_int32_t get_flags() const; + void set_flags(u_int32_t); + + + // (deep) copying of this object is allowed. + // + DbInfo(const DbInfo &); + DbInfo &operator = (const DbInfo &); + +private: + // We can add data to this class if needed + // since parent class is not allocated by db. + // (see comment at top) +}; + +// +// Base application class. Provides functions for opening a database. +// 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 : protected DB_ENV +{ +friend DbTxnMgr; +friend DbLog; +friend DbLockTab; +friend DbMpool; +friend Db; + +public: + + ~DbEnv(); + + // This constructor can be used to immediately initialize the + // application with these arguments. Do not use it if you + // need to set other parameters via the access methods. + // + DbEnv(const char *homeDir, char *const *db_config, u_int32_t flags); + + // Use this constructor if you wish to *delay* the initialization + // of the db library. This is useful if you need to set + // any particular parameters via the access methods below. + // Then call appinit() to complete the initialization. + // + DbEnv(); + + // Used in conjunction with the default constructor to + // complete the initialization of the db library. + // + int appinit(const char *homeDir, char *const *db_config, u_int32_t flags); + + // Called automatically when DbEnv is destroyed, or can be + // called at any time to shut down Db. + // + int appexit(); + + //////////////////////////////////////////////////////////////// + // simple get/set access methods + // + // If you are calling set_ methods, you need to + // use the default constructor along with appinit(). + + // Byte order. + int get_lorder() const; + void set_lorder(int); + + // Error message callback. + typedef void (*db_errcall_fcn)(const char *, char *); + db_errcall_fcn get_errcall() const; + void set_errcall(db_errcall_fcn); + + // Error message file stream. + FILE *get_errfile() const; + void set_errfile(FILE *); + + // Error message prefix. + const char *get_errpfx() const; + void set_errpfx(const char *); + + // Generate debugging messages. + int get_verbose() const; + void set_verbose(int); + + //////////////////////////////////////////////////////////////// + // User paths. + + // Database home. + char *get_home() const; + void set_home(char *); + + // Database log file directory. + char *get_log_dir() const; + void set_log_dir(char *); + + // Database tmp file directory. + char *get_tmp_dir() const; + void set_tmp_dir(char *); + + // Database data file directories. + char **get_data_dir() const; + void set_data_dir(char **); + + // Database data file slots. + int get_data_cnt() const; + void set_data_cnt(int); + + // Next Database data file slot. + int get_data_next() const; + void set_data_next(int); + + + //////////////////////////////////////////////////////////////// + // Locking. + + // Return from lock_open(). + DbLockTab *get_lk_info() const; + + // Two dimensional conflict matrix. + u_int8_t *get_lk_conflicts() const; + void set_lk_conflicts(u_int8_t *); + + // Number of lock modes in table. + int get_lk_modes() const; + void set_lk_modes(int); + + // Maximum number of locks. + u_int32_t get_lk_max() const; + void set_lk_max(u_int32_t); + + // Deadlock detect on every conflict. + u_int32_t get_lk_detect() const; + void set_lk_detect(u_int32_t); + + + //////////////////////////////////////////////////////////////// + // Logging. + + // Return from log_open(). + DbLog *get_lg_info() const; + + // Maximum file size. + u_int32_t get_lg_max() const; + void set_lg_max(u_int32_t); + + + //////////////////////////////////////////////////////////////// + // Memory pool. + + // Return from memp_open(). + DbMpool *get_mp_info() const; + + // Maximum file size for mmap. + size_t get_mp_mmapsize() const; + void set_mp_mmapsize(size_t); + + // Bytes in the mpool cache. + size_t get_mp_size() const; + void set_mp_size(size_t); + + + //////////////////////////////////////////////////////////////// + // Transactions. + + // Return from txn_open(). + DbTxnMgr *get_tx_info() const; + + // Maximum number of transactions. + u_int32_t get_tx_max() const; + void set_tx_max(u_int32_t); + + // Dispatch function for recovery. + typedef int (*tx_recover_fcn)(DB_LOG *, DBT *, DB_LSN *, int, void *); + tx_recover_fcn get_tx_recover() const; + void set_tx_recover(tx_recover_fcn); + + // Flags. + u_int32_t get_flags() const; + void set_flags(u_int32_t); + + //////////////////////////////////////////////////////////////// + // The default error model is to throw an exception whenever + // an error occurs. This generally allows for cleaner logic + // for transaction processing, as a try block can surround a + // single transaction. Alternatively, since almost every method + // returns an error code (errno), the error model can be set to + // not throw exceptions, and instead return the appropriate code. + // + enum ErrorModel { Exception, ErrorReturn }; + void set_error_model(ErrorModel); + ErrorModel get_error_model() const; + + // 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 using a C model. Alternatively, you can + // call set_error_stream() to force all errors to a C++ stream. + // It is unwise to mix these approaches. + // + class ostream* get_error_stream() const; + void set_error_stream(class ostream*); + + // used internally + static int runtime_error(const char *caller, int err, int in_destructor = 0); + +private: + // We can add data to this class if needed + // since parent class is not allocated by db. + // (see comment at top) + + // no copying + DbEnv(const DbEnv &); + operator = (const DbEnv &); + + ErrorModel error_model_; + static void stream_error_function(const char *, char *); + static ostream *error_stream_; +}; + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// Table access classes +// + +// +// Represents a database table = a set of keys with associated values. +// +class _exported Db +{ + friend DbEnv; + +public: + int close(u_int32_t flags); + int cursor(DbTxn *txnid, Dbc **cursorp); + int del(DbTxn *txnid, Dbt *key, u_int32_t flags); + int fd(int *fdp); + int get(DbTxn *txnid, Dbt *key, Dbt *data, u_int32_t flags); + int put(DbTxn *txnid, Dbt *key, Dbt *data, u_int32_t flags); + int stat(void *sp, void *(*db_malloc)(size_t), u_int32_t flags); + int sync(u_int32_t flags); + + DBTYPE get_type() const; + + static int open(const char *fname, DBTYPE type, u_int32_t flags, + int mode, DbEnv *dbenv, DbInfo *info, Db **dbpp); + +private: + // We can add data to this class if needed + // since it is implemented via a pointer. + // (see comment at top) + + // Note: use Db::open() to get initialize pointers to a Db, + // and call Db::close() rather than delete to release them. + Db(); + ~Db(); + + // no copying + Db(const Db &); + Db &operator = (const Db &); + + DEFINE_DB_CLASS(Db); +}; + +// +// A chunk of data, maybe a key or value. +// +class _exported Dbt : private DBT +{ + friend Dbc; + friend Db; + friend DbLog; + friend DbMpoolFile; + friend DbLockTab; + +public: + + // key/data + void *get_data() const; + void set_data(void *); + + // key/data length + u_int32_t get_size() const; + void set_size(u_int32_t); + + // RO: length of user buffer. + u_int32_t get_ulen() const; + void set_ulen(u_int32_t); + + // RO: get/put record length. + u_int32_t get_dlen() const; + void set_dlen(u_int32_t); + + // RO: get/put record offset. + u_int32_t get_doff() const; + void set_doff(u_int32_t); + + // flags + u_int32_t get_flags() const; + void set_flags(u_int32_t); + + Dbt(void *data, size_t size); + Dbt(); + ~Dbt(); + Dbt(const Dbt &); + Dbt &operator = (const Dbt &); + +private: + // We can add data to this class if needed + // since parent class is not allocated by db. + // (see comment at top) +}; + +class _exported Dbc : protected DBC +{ + friend Db; + +public: + int close(); + int del(u_int32_t flags); + int get(Dbt* key, 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 &); +}; +#endif /* !_DB_CXX_H_ */ diff --git a/mozilla/db/include/db_dispatch.h b/mozilla/db/include/db_dispatch.h new file mode 100644 index 00000000000..8f5e2174021 --- /dev/null +++ b/mozilla/db/include/db_dispatch.h @@ -0,0 +1,77 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * 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. 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. + * + * @(#)db_dispatch.h 10.4 (Sleepycat) 5/3/98 + */ + +#ifndef _DB_DISPATCH_H +#define _DB_DISPATCH_H + +struct __db_txnhead; typedef struct __db_txnhead DB_TXNHEAD; +struct __db_txnlist; typedef struct __db_txnlist DB_TXNLIST; + +/* + * Declarations and typedefs for the list of transaction IDs used during + * recovery. + */ +struct __db_txnhead { + LIST_HEAD(__db_headlink, __db_txnlist) head; + u_int32_t maxid; + int32_t generation; +}; + +struct __db_txnlist { + LIST_ENTRY(__db_txnlist) links; + u_int32_t txnid; + int32_t generation; +}; + +#define DB_log_BEGIN 0 +#define DB_txn_BEGIN 5 +#define DB_ham_BEGIN 20 +#define DB_db_BEGIN 40 +#define DB_bam_BEGIN 50 +#define DB_ram_BEGIN 100 +#define DB_user_BEGIN 150 + +#define TXN_UNDO 0 +#define TXN_REDO 1 +#define TXN_BACKWARD_ROLL -1 +#define TXN_FORWARD_ROLL -2 +#define TXN_OPENFILES -3 +#endif diff --git a/mozilla/db/include/db_ext.h b/mozilla/db/include/db_ext.h new file mode 100644 index 00000000000..8a03db9f64b --- /dev/null +++ b/mozilla/db/include/db_ext.h @@ -0,0 +1,121 @@ +/* DO NOT EDIT: automatically built by dist/distrib. */ +#ifndef _db_ext_h_ +#define _db_ext_h_ +int __db_pgerr __P((DB *, db_pgno_t)); +int __db_pgfmt __P((DB *, db_pgno_t)); +int __db_addrem_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, u_int32_t, db_pgno_t, u_int32_t, + size_t, const DBT *, const DBT *, DB_LSN *)); +int __db_addrem_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __db_addrem_read __P((void *, __db_addrem_args **)); +int __db_split_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, u_int32_t, db_pgno_t, const DBT *, + DB_LSN *)); +int __db_split_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __db_split_read __P((void *, __db_split_args **)); +int __db_big_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, u_int32_t, db_pgno_t, db_pgno_t, + db_pgno_t, const DBT *, DB_LSN *, DB_LSN *, + DB_LSN *)); +int __db_big_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __db_big_read __P((void *, __db_big_args **)); +int __db_ovref_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, db_pgno_t, int32_t, DB_LSN *)); +int __db_ovref_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __db_ovref_read __P((void *, __db_ovref_args **)); +int __db_relink_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t, + DB_LSN *, db_pgno_t, DB_LSN *)); +int __db_relink_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __db_relink_read __P((void *, __db_relink_args **)); +int __db_addpage_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t, + DB_LSN *)); +int __db_addpage_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __db_addpage_read __P((void *, __db_addpage_args **)); +int __db_debug_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + const DBT *, u_int32_t, const DBT *, const DBT *, + u_int32_t)); +int __db_debug_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __db_debug_read __P((void *, __db_debug_args **)); +int __db_noop_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, db_pgno_t, DB_LSN *)); +int __db_noop_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __db_noop_read __P((void *, __db_noop_args **)); +int __db_init_print __P((DB_ENV *)); +int __db_init_recover __P((DB_ENV *)); +int __db_pgin __P((db_pgno_t, size_t, void *)); +int __db_pgout __P((db_pgno_t, size_t, void *)); +int __db_dispatch __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __db_add_recovery __P((DB_ENV *, + int (*)(DB_LOG *, DBT *, DB_LSN *, int, void *), u_int32_t)); +int __db_txnlist_init __P((void *)); +int __db_txnlist_add __P((void *, u_int32_t)); +int __db_txnlist_find __P((void *, u_int32_t)); +void __db_txnlist_end __P((void *)); +void __db_txnlist_gen __P((void *, int)); +void __db_txnlist_print __P((void *)); +int __db_dput __P((DB *, + DBT *, PAGE **, db_indx_t *, int (*)(DB *, u_int32_t, PAGE **))); +int __db_drem __P((DB *, + PAGE **, u_int32_t, int (*)(DB *, PAGE *))); +int __db_dend __P((DB *, db_pgno_t, PAGE **)); + int __db_ditem __P((DB *, PAGE *, u_int32_t, u_int32_t)); +int __db_pitem + __P((DB *, PAGE *, u_int32_t, u_int32_t, DBT *, DBT *)); +int __db_relink __P((DB *, PAGE *, PAGE **, int)); +int __db_ddup __P((DB *, db_pgno_t, int (*)(DB *, PAGE *))); +int __db_goff __P((DB *, DBT *, + u_int32_t, db_pgno_t, void **, u_int32_t *)); +int __db_poff __P((DB *, const DBT *, db_pgno_t *, + int (*)(DB *, u_int32_t, PAGE **))); +int __db_ovref __P((DB *, db_pgno_t, int32_t)); +int __db_doff __P((DB *, db_pgno_t, int (*)(DB *, PAGE *))); +int __db_moff __P((DB *, const DBT *, db_pgno_t)); +void __db_loadme __P((void)); +FILE *__db_prinit __P((FILE *)); +int __db_dump __P((DB *, char *, int)); +int __db_prdb __P((DB *)); +int __db_prbtree __P((DB *)); +int __db_prhash __P((DB *)); +int __db_prtree __P((DB_MPOOLFILE *, int)); +int __db_prnpage __P((DB_MPOOLFILE *, db_pgno_t)); +int __db_prpage __P((PAGE *, int)); +int __db_isbad __P((PAGE *, int)); +void __db_pr __P((u_int8_t *, u_int32_t)); +int __db_prdbt __P((DBT *, int, FILE *)); +void __db_prflags __P((u_int32_t, const FN *, FILE *)); +int __db_addrem_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __db_split_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __db_big_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __db_ovref_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __db_relink_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __db_addpage_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __db_debug_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __db_noop_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __db_ret __P((DB *, + PAGE *, u_int32_t, DBT *, void **, u_int32_t *)); +int __db_retcopy __P((DBT *, + void *, u_int32_t, void **, u_int32_t *, void *(*)(size_t))); +int __db_gethandle __P((DB *, int (*)(DB *, DB *), DB **)); +int __db_puthandle __P((DB *)); +#endif /* _db_ext_h_ */ diff --git a/mozilla/db/include/db_int.h.src b/mozilla/db/include/db_int.h.src new file mode 100644 index 00000000000..d67e2c428c0 --- /dev/null +++ b/mozilla/db/include/db_int.h.src @@ -0,0 +1,402 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)db_int.h.src 10.62 (Sleepycat) 5/23/98 + */ + +#ifndef _DB_INTERNAL_H_ +#define _DB_INTERNAL_H_ + +#include "db.h" /* Standard DB include file. */ +#include "queue.h" + +/******************************************************* + * General purpose constants and macros. + *******************************************************/ +#define UINT16_T_MAX 0xffff /* Maximum 16 bit unsigned. */ +#define UINT32_T_MAX 0xffffffff /* Maximum 32 bit unsigned. */ + +#define DB_MIN_PGSIZE 0x000200 /* Minimum page size. */ +#define DB_MAX_PGSIZE 0x010000 /* Maximum page size. */ + +#define DB_MINCACHE 10 /* Minimum cached pages */ + +#define MEGABYTE 1048576 + +/* + * If we are unable to determine the underlying filesystem block size, use + * 8K on the grounds that most OS's use less than 8K as their VM page size. + */ +#define DB_DEF_IOSIZE (8 * 1024) + +/* + * Aligning items to particular sizes or in pages or memory. ALIGNP is a + * separate macro, as we've had to cast the pointer to different integral + * types on different architectures. + * + * We cast pointers into unsigned longs when manipulating them because C89 + * guarantees that u_long is the largest available integral type and further, + * to never generate overflows. However, neither C89 or C9X requires that + * any integer type be large enough to hold a pointer, although C9X created + * the intptr_t type, which is guaranteed to hold a pointer but may or may + * not exist. At some point in the future, we should test for intptr_t and + * use it where available. + */ +#undef ALIGNTYPE +#define ALIGNTYPE u_long +#undef ALIGNP +#define ALIGNP(value, bound) ALIGN((ALIGNTYPE)value, bound) +#undef ALIGN +#define ALIGN(value, bound) (((value) + (bound) - 1) & ~((bound) - 1)) + +/* + * 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) ((int)&(((name *)0)->field)) + +#undef SSZA +#define SSZA(name, field) ((int)&(((name *)0)->field[0])) + +/* Macros to return per-process address, offsets based on shared regions. */ +#define R_ADDR(base, offset) ((void *)((u_int8_t *)((base)->addr) + offset)) +#define R_OFFSET(base, p) ((u_int8_t *)(p) - (u_int8_t *)(base)->addr) + +/* Free and free-string macros that overwrite memory. */ +#ifdef DIAGNOSTIC +#undef FREE +#define FREE(p, len) { \ + memset(p, 0xff, len); \ + __db_free(p); \ +} +#undef FREES +#define FREES(p) { \ + FREE(p, strlen(p)); \ +} +#else +#undef FREE +#define FREE(p, len) { \ + __db_free(p); \ +} +#undef FREES +#define FREES(p) { \ + __db_free(p); \ +} +#endif + +/* 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 F_SET(p, f) (p)->flags |= (f) +#define F_CLR(p, f) (p)->flags &= ~(f) +#define F_ISSET(p, f) ((p)->flags & (f)) +#define LF_SET(f) (flags |= (f)) +#define LF_CLR(f) (flags &= ~(f)) +#define LF_ISSET(f) (flags & (f)) + +/* Display separator string. */ +#undef DB_LINE +#define DB_LINE "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" + +/* Global variables. */ +typedef struct __db_globals { + int db_mutexlocks; /* DB_MUTEXLOCKS */ + int db_region_anon; /* DB_REGION_ANON, DB_REGION_NAME */ + int db_region_init; /* DB_REGION_INIT */ + int db_tsl_spins; /* DB_TSL_SPINS */ + int db_pageyield; /* DB_PAGEYIELD */ +} DB_GLOBALS; +extern DB_GLOBALS __db_global_values; +#define DB_GLOBAL(v) __db_global_values.v + +/* Unused, or not-used-yet variable. "Shut that bloody compiler up!" */ +#define COMPQUIET(n, v) (n) = (v) + +/* + * Win16 needs specific syntax on callback functions. Nobody else cares. + */ +#ifndef DB_CALLBACK +#define DB_CALLBACK /* Nothing. */ +#endif + +/******************************************************* + * 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 , + * and that file isn't always available. + */ +#undef MAXPATHLEN +#define MAXPATHLEN 1024 + +#define PATH_DOT "." /* Current working directory. */ +#define PATH_SEPARATOR "/" /* Path separator character. */ + +/******************************************************* + * Mutex support. + *******************************************************/ +@spin_line1@ +@spin_line2@ +@spin_line3@ + +/* + * !!! + * Various systems require different alignments for mutexes (the worst we've + * seen so far is 16-bytes on some HP architectures). The mutex (tsl_t) must + * be first in the db_mutex_t structure, which must itself be first in the + * region. This ensures the alignment is as returned by mmap(2), which should + * be sufficient. All other mutex users must ensure proper alignment locally. + */ +#define MUTEX_ALIGNMENT @mutex_align@ + +/* + * The offset of a mutex in memory. + * + * !!! + * Not an off_t, so backing file offsets MUST be less than 4Gb. See the + * off field of the db_mutex_t as well. + */ +#define MUTEX_LOCK_OFFSET(a, b) ((u_int32_t)((u_int8_t *)b - (u_int8_t *)a)) + +typedef struct _db_mutex_t { +#ifdef HAVE_SPINLOCKS + tsl_t tsl_resource; /* Resource test and set. */ +#ifdef DIAGNOSTIC + u_int32_t pid; /* Lock holder: 0 or process pid. */ +#endif +#else + u_int32_t off; /* Backing file offset. */ + u_int32_t pid; /* Lock holder: 0 or process pid. */ +#endif + u_int32_t spins; /* Spins before block. */ + u_int32_t mutex_set_wait; /* Granted after wait. */ + u_int32_t mutex_set_nowait; /* Granted without waiting. */ +} db_mutex_t; + +#include "mutex_ext.h" + +/******************************************************* + * Access methods. + *******************************************************/ +/* Lock/unlock a DB thread. */ +#define DB_THREAD_LOCK(dbp) \ + if (F_ISSET(dbp, DB_AM_THREAD)) \ + (void)__db_mutex_lock((db_mutex_t *)(dbp)->mutexp, -1); +#define DB_THREAD_UNLOCK(dbp) \ + if (F_ISSET(dbp, DB_AM_THREAD)) \ + (void)__db_mutex_unlock((db_mutex_t *)(dbp)->mutexp, -1); + +/* Btree/recno local statistics structure. */ +struct __db_bt_lstat; typedef struct __db_bt_lstat DB_BTREE_LSTAT; +struct __db_bt_lstat { + u_int32_t bt_freed; /* Pages freed for reuse. */ + u_int32_t bt_pfxsaved; /* Bytes saved by prefix compression. */ + u_int32_t bt_split; /* Total number of splits. */ + u_int32_t bt_rootsplit; /* Root page splits. */ + u_int32_t bt_fastsplit; /* Fast splits. */ + u_int32_t bt_added; /* Items added. */ + u_int32_t bt_deleted; /* Items deleted. */ + u_int32_t bt_get; /* Items retrieved. */ + u_int32_t bt_cache_hit; /* Hits in fast-insert code. */ + u_int32_t bt_cache_miss; /* Misses in fast-insert code. */ +}; + +/******************************************************* + * 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; + +/******************************************************* + * Shared memory regions. + *******************************************************/ +/* + * The shared memory regions share an initial structure so that the general + * region code can handle races between the region being deleted and other + * processes waiting on the region mutex. + * + * !!! + * Note, the mutex must be the first entry in the region; see comment above. + */ +typedef struct _rlayout { + db_mutex_t lock; /* Region mutex. */ +#define DB_REGIONMAGIC 0x120897 + u_int32_t valid; /* Valid magic number. */ + u_int32_t refcnt; /* Region reference count. */ + size_t size; /* Region length. */ + int majver; /* Major version number. */ + int minver; /* Minor version number. */ + int patch; /* Patch version number. */ +#define INVALID_SEGID -1 + int segid; /* shmget(2) ID, or Win16 segment ID. */ + +#define REGION_ANONYMOUS 0x01 /* Region is/should be in anon mem. */ + u_int32_t flags; +} RLAYOUT; + +/* + * DB creates all regions on 4K boundaries out of sheer paranoia, so that + * we don't make the underlying VM unhappy. + */ +#define DB_VMPAGESIZE (4 * 1024) +#define DB_ROUNDOFF(i) { \ + (i) += DB_VMPAGESIZE - 1; \ + (i) -= (i) % DB_VMPAGESIZE; \ +} + +/* + * The interface to region attach is nasty, there is a lot of complex stuff + * going on, which has to be retained between create/attach and detach. The + * REGINFO structure keeps track of it. + */ +struct __db_reginfo; typedef struct __db_reginfo REGINFO; +struct __db_reginfo { + /* Arguments. */ + DB_ENV *dbenv; /* Region naming info. */ + APPNAME appname; /* Region naming info. */ + char *path; /* Region naming info. */ + const char *file; /* Region naming info. */ + int mode; /* Region mode, if a file. */ + size_t size; /* Region size. */ + u_int32_t dbflags; /* Region file open flags, if a file. */ + + /* Results. */ + char *name; /* Region name. */ + void *addr; /* Region address. */ + int fd; /* Fcntl(2) locking file descriptor. + NB: this is only valid if a regular + file is backing the shared region, + and mmap(2) is being used to map it + into our address space. */ + int segid; /* shmget(2) ID, or Win16 segment ID. */ + + /* Shared flags. */ +/* 0x0001 COMMON MASK with RLAYOUT structure. */ +#define REGION_CANGROW 0x0002 /* Can grow. */ +#define REGION_CREATED 0x0004 /* Created. */ +#define REGION_HOLDINGSYS 0x0008 /* Holding system resources. */ +#define REGION_LASTDETACH 0x0010 /* Delete on last detach. */ +#define REGION_MALLOC 0x0020 /* Created in malloc'd memory. */ +#define REGION_PRIVATE 0x0040 /* Private to thread/process. */ +#define REGION_REMOVED 0x0080 /* Already deleted. */ +#define REGION_SIZEDEF 0x0100 /* Use default region size if exists. */ + u_int32_t flags; +}; + +/******************************************************* + * Mpool. + *******************************************************/ +/* + * File types for DB access methods. Negative numbers are reserved to DB. + */ +#define DB_FTYPE_BTREE -1 /* Btree. */ +#define DB_FTYPE_HASH -2 /* Hash. */ + +/* Structure used as the DB pgin/pgout pgcookie. */ +typedef struct __dbpginfo { + size_t db_pagesize; /* Underlying page size. */ + int needswap; /* If swapping required. */ +} DB_PGINFO; + +/******************************************************* + * Log. + *******************************************************/ +/* Initialize an LSN to 'zero'. */ +#define ZERO_LSN(LSN) { \ + (LSN).file = 0; \ + (LSN).offset = 0; \ +} + +/* Return 1 if LSN is a 'zero' lsn, otherwise return 0. */ +#define IS_ZERO_LSN(LSN) ((LSN).file == 0) + +/* Test if we need to log a change. */ +#define DB_LOGGING(dbp) \ + (F_ISSET(dbp, DB_AM_LOGGING) && !F_ISSET(dbp, DB_AM_RECOVER)) + +#ifdef DIAGNOSTIC +/* + * 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(D, T, O, K, A, F) { \ + DB_LSN _lsn; \ + DBT _op; \ + if (DB_LOGGING((D))) { \ + memset(&_op, 0, sizeof(_op)); \ + _op.data = O; \ + _op.size = strlen(O) + 1; \ + (void)__db_debug_log((D)->dbenv->lg_info, \ + T, &_lsn, 0, &_op, (D)->log_fileid, K, A, F); \ + } \ +} +#ifdef DEBUG_ROP +#define DEBUG_LREAD(D, T, O, K, A, F) LOG_OP(D, T, O, K, A, F) +#else +#define DEBUG_LREAD(D, T, O, K, A, F) +#endif +#ifdef DEBUG_WOP +#define DEBUG_LWRITE(D, T, O, K, A, F) LOG_OP(D, T, O, K, A, F) +#else +#define DEBUG_LWRITE(D, T, O, K, A, F) +#endif +#else +#define DEBUG_LREAD(D, T, O, K, A, F) +#define DEBUG_LWRITE(D, T, O, K, A, F) +#endif /* DIAGNOSTIC */ + +/******************************************************* + * Transactions and recovery. + *******************************************************/ +/* + * Out of band value for a lock. The locks are returned to callers as offsets + * into the lock regions. Since the RLAYOUT structure begins all regions, an + * offset of 0 is guaranteed not to be a valid lock. + */ +#define LOCK_INVALID 0 + +/* The structure allocated for every transaction. */ +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. */ + size_t off; /* Detail structure within region. */ + TAILQ_ENTRY(__db_txn) links; +}; + +#include "os_func.h" +#include "os_ext.h" + +#endif /* !_DB_INTERNAL_H_ */ diff --git a/mozilla/db/include/db_page.h b/mozilla/db/include/db_page.h new file mode 100644 index 00000000000..e1846cbbbdc --- /dev/null +++ b/mozilla/db/include/db_page.h @@ -0,0 +1,562 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)db_page.h 10.15 (Sleepycat) 5/1/98 + */ + +#ifndef _DB_PAGE_H_ +#define _DB_PAGE_H_ + +/* + * 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_METADATA 0 /* Metadata page number. */ +#define PGNO_INVALID 0 /* Metadata page number, therefore illegal. */ +#define PGNO_ROOT 1 /* Root is page #1. */ + +/* + * 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 magic and version numbers. + */ +#define DB_PAGE_CLEAR_LEN 32 + +/************************************************************************ + BTREE METADATA PAGE LAYOUT + ************************************************************************/ + +/* + * Btree metadata page layout: + * + * +-----------------------------------+ + * | lsn | pgno | magic | + * +-----------------------------------+ + * | version | pagesize | free | + * +-----------------------------------+ + * | flags | unused ... | + * +-----------------------------------+ + */ +typedef struct _btmeta { + 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. */ +#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_MASK 0x01f + 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]; + + u_int32_t spare[13]; /* 68-123: Save some room for growth. */ + + DB_BTREE_LSTAT stat; /* 124-163: Statistics. */ +} BTMETA; + +/************************************************************************ + HASH METADATA PAGE LAYOUT + ************************************************************************/ + +/* + * Hash metadata page layout: + * + * +-----------------------------------+ + * | lsn | magic | version | + * +-----------------------------------+ + * | pagesize | ovfl_point| last_freed| + * +-----------------------------------+ + * | max_bucket| high_mask | low_mask | + * +-----------------------------------+ + * | ffactor | nelem | charkey | + * +-----------------------------------+ + * | spares[32]| flags | unused | + * +-----------------------------------+ + */ +/* 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) */ +#define DB_HASH_DUP 0x01 + u_int32_t flags; /* 56-59: Allow duplicates. */ +#define NCACHED 32 /* number of spare points */ + /* 60-187: Spare pages for overflow */ + u_int32_t spares[NCACHED]; + /* 188-207: Unique file ID. */ + u_int8_t uid[DB_FILE_ID_LEN]; + + /* + * Minimum page size is 256. + */ +} HASHHDR; + +/************************************************************************ + MAIN PAGE LAYOUT + ************************************************************************/ + +/* + * +-----------------------------------+ + * | lsn | pgno | prev pgno | + * +-----------------------------------+ + * | next pgno | entries | hf offset | + * +-----------------------------------+ + * | level | type | index | + * +-----------------------------------+ + * | index | free --> | + * +-----------+-----------------------+ + * | F R E E A R E A | + * +-----------------------------------+ + * | <-- free | item | + * +-----------------------------------+ + * | item | item | item | + * +-----------------------------------+ + * + * sizeof(PAGE) == 26 bytes, and the following indices are guaranteed to be + * two-byte aligned. + * + * 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 _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 item pairs 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. */ + +#define P_INVALID 0 /* Invalid page type. */ +#define P_DUPLICATE 1 /* Duplicate. */ +#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. */ + u_int8_t type; /* 25: Page type. */ + db_indx_t inp[1]; /* Variable length index of items. */ +} 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) + +/* + * !!! + * The next_pgno and prev_pgno fields are not maintained for btree and recno + * internal pages. It's a minor performance improvement, and more, it's + * hard to do when deleting internal pages, and it decreases the chance of + * deadlock during deletes and splits. + * + * !!! + * 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_LBTREE ? NUM_ENT(p) / 2 : \ + TYPE(p) == P_LRECNO ? NUM_ENT(p) : PREV_PGNO(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 (SSZA(PAGE, inp)) + +/* First free byte. */ +#define LOFFSET(pg) (P_OVERHEAD + NUM_ENT(pg) * sizeof(db_indx_t)) + +/* Free space on the page. */ +#define P_FREESPACE(pg) (HOFFSET(pg) - LOFFSET(pg)) + +/* Get a pointer to the bytes at a specific index. */ +#define P_ENTRY(pg, indx) ((u_int8_t *)pg + ((PAGE *)pg)->inp[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(psize) ((psize) - P_OVERHEAD) + +/************************************************************************ + 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(pg, indx) (*P_ENTRY(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(pg, pgsize, indx) \ + (((indx) == 0 ? pgsize : pg->inp[indx - 1]) - pg->inp[indx]) + +#define LEN_HKEYDATA(pg, psize, indx) \ + (((indx) == 0 ? psize : pg->inp[indx - 1]) - \ + pg->inp[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. + * The use of "pindex" indicates that the argument is the index + * expressed in pairs instead of individual elements. + */ +#define H_NUMPAIRS(pg) (NUM_ENT(pg) / 2) +#define H_KEYINDEX(pindx) (2 * (pindx)) +#define H_DATAINDEX(pindx) ((2 * (pindx)) + 1) +#define H_PAIRKEY(pg, pindx) P_ENTRY(pg, H_KEYINDEX(pindx)) +#define H_PAIRDATA(pg, pindx) P_ENTRY(pg, H_DATAINDEX(pindx)) +#define H_PAIRSIZE(pg, psize, pindx) \ + (LEN_HITEM(pg, psize, H_KEYINDEX(pindx)) + \ + LEN_HITEM(pg, psize, H_DATAINDEX(pindx))) +#define LEN_HDATA(p, psize, pindx) LEN_HKEYDATA(p, psize, H_DATAINDEX(pindx)) +#define LEN_HKEY(p, psize, pindx) LEN_HKEYDATA(p, psize, H_KEYINDEX(pindx)) + +/* + * The third type is the H_OFFPAGE, represented by the HOFFPAGE structure: + * + * +-----------------------------------+ + * | type | pgno_t | total len | + * +-----------------------------------+ + */ +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: + * + * +-----------------------+ + * | type | pgno_t | + * +-----------------------+ + */ +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)) +#define HOFFDUP_PSIZE (HOFFDUP_SIZE + sizeof(db_indx_t)) + +/************************************************************************ + 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: + * + * +-----------------------------------+ + * | length | type | key/data | + * +-----------------------------------+ + */ +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(pg, indx) \ + ((BKEYDATA *)P_ENTRY(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), 4) +#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: + * + * +-----------------------------------+ + * | total len | type | unused | + * +-----------------------------------+ + * | nxt: page | nxt: off | nxt: len | + * +-----------------------------------+ + */ +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(pg, indx) \ + ((BOVERFLOW *)P_ENTRY(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), 4) +#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. I 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. + * + * +-----------------------------------+ + * | leaf pgno | type | data ... | + * +-----------------------------------+ + */ +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(pg, indx) \ + ((BINTERNAL *)P_ENTRY(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), 4) +#define BINTERNAL_PSIZE(len) \ + (BINTERNAL_SIZE(len) + sizeof(db_indx_t)) + +/************************************************************************ + RECNO INTERNAL PAGE LAYOUT + ************************************************************************/ + +/* + * The recno internal entry. + * + * +-----------------------+ + * | leaf pgno | # of recs | + * +-----------------------+ + * + * XXX + * Why not fold this into the db_indx_t structure, it's fixed length. + */ +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(pg, indx) \ + ((RINTERNAL *)P_ENTRY(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), 4) +#define RINTERNAL_PSIZE \ + (RINTERNAL_SIZE + sizeof(db_indx_t)) +#endif /* _DB_PAGE_H_ */ diff --git a/mozilla/db/include/db_shash.h b/mozilla/db/include/db_shash.h new file mode 100644 index 00000000000..35ade395fca --- /dev/null +++ b/mozilla/db/include/db_shash.h @@ -0,0 +1,106 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)db_shash.h 10.3 (Sleepycat) 4/10/98 + */ + +/* 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 + * cmp_func is called as: cmp_func(lookup_elt, table_elt); + * begin: address of the beginning of the hash table. + * 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. + * result: the variable into which we'll store the element if we find it. + * nelems: the number of buckets in the hash table. + * hash_func: the hash function that operates on elements of the type of elt + * cmp_func: compare elements of the type of elt with those in the table (of + * type "type"). + * + * If the element is not in the hash table, this macro exits with result + * set to NULL. + */ +#define HASHLOOKUP(begin, type, field, elt, r, n, hash, cmp) do { \ + DB_HASHTAB *__bucket; \ + u_int32_t __ndx; \ + \ + __ndx = hash(elt) % (n); \ + __bucket = &begin[__ndx]; \ + for (r = SH_TAILQ_FIRST(__bucket, type); \ + r != NULL; r = SH_TAILQ_NEXT(r, field, type)) \ + if (cmp(elt, r)) \ + break; \ +} while(0) + +/* + * HASHINSERT -- + * + * Insert a new entry into the hash table. This assumes that lookup has + * failed; don't call it if you haven't already called HASHLOOKUP. + * begin: the beginning address of the hash table. + * 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. + * nelems: the number of buckets in the hash table. + * hash_func: the hash function that operates on elements of the type of elt + */ +#define HASHINSERT(begin, type, field, elt, n, hash) do { \ + u_int32_t __ndx; \ + DB_HASHTAB *__bucket; \ + \ + __ndx = hash(elt) % (n); \ + __bucket = &begin[__ndx]; \ + SH_TAILQ_INSERT_HEAD(__bucket, elt, field, type); \ +} while(0) + +/* + * HASHREMOVE -- + * Remove the entry with a key == elt. + * begin: address of the beginning of the hash table. + * 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 deleted. + * nelems: the number of buckets in the hash table. + * hash_func: the hash function that operates on elements of the type of elt + * cmp_func: compare elements of the type of elt with those in the table (of + * type "type"). + */ +#define HASHREMOVE(begin, type, field, elt, n, hash, cmp) { \ + u_int32_t __ndx; \ + DB_HASHTAB *__bucket; \ + SH_TAILQ_ENTRY *__entp; \ + \ + __ndx = hash(elt) % (n); \ + __bucket = &begin[__ndx]; \ + HASHLOOKUP(begin, type, field, elt, __entp, n, hash, cmp); \ + SH_TAILQ_REMOVE(__bucket, __entp, field, type); \ +} + +/* + * HASHREMOVE_EL -- + * Given the object "obj" in the table, remove it. + * begin: address of the beginning of the hash table. + * 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. + * nelems: the number of buckets in the hash table. + * hash_func: the hash function that operates on elements of the type of elt + */ +#define HASHREMOVE_EL(begin, type, field, obj, n, hash) { \ + u_int32_t __ndx; \ + DB_HASHTAB *__bucket; \ + \ + __ndx = hash(obj) % (n); \ + __bucket = &begin[__ndx]; \ + SH_TAILQ_REMOVE(__bucket, obj, field, type); \ +} diff --git a/mozilla/db/include/db_swap.h b/mozilla/db/include/db_swap.h new file mode 100644 index 00000000000..9f94ed721b1 --- /dev/null +++ b/mozilla/db/include/db_swap.h @@ -0,0 +1,105 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * 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. 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. + * + * @(#)db_swap.h 10.5 (Sleepycat) 4/10/98 + */ + +#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); \ +} +#endif /* !_DB_SWAP_H_ */ diff --git a/mozilla/db/include/hash.h b/mozilla/db/include/hash.h new file mode 100644 index 00000000000..e55c2102cb3 --- /dev/null +++ b/mozilla/db/include/hash.h @@ -0,0 +1,211 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * 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. 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. + * + * @(#)hash.h 10.8 (Sleepycat) 4/10/98 + */ + +/* Cursor structure definitions. */ +typedef struct cursor_t { + DBC *db_cursor; + db_pgno_t bucket; /* Bucket we are traversing. */ + DB_LOCK lock; /* Lock held on the current bucket. */ + PAGE *pagep; /* The current page. */ + db_pgno_t pgno; /* Current page number. */ + db_indx_t bndx; /* Index within the current page. */ + PAGE *dpagep; /* Duplicate page pointer. */ + db_pgno_t dpgno; /* Duplicate page number. */ + db_indx_t dndx; /* Index within a duplicate set. */ + 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 big_keylen; /* Length of big_key buffer. */ + void *big_key; /* Temporary buffer for big keys. */ + u_int32_t big_datalen; /* Length of big_data buffer. */ + void *big_data; /* Temporary buffer for big data. */ +#define H_OK 0x0001 +#define H_NOMORE 0x0002 +#define H_DELETED 0x0004 +#define H_ISDUP 0x0008 +#define H_EXPAND 0x0020 + u_int32_t flags; /* Is cursor inside a dup set. */ +} HASH_CURSOR; + +#define IS_VALID(C) ((C)->bucket != BUCKET_INVALID) + + +typedef struct htab { /* Memory resident data structure. */ + DB *dbp; /* Pointer to parent db structure. */ + DB_LOCK hlock; /* Metadata page lock. */ + HASHHDR *hdr; /* Pointer to meta-data page. */ + u_int32_t (*hash) __P((const void *, u_int32_t)); /* Hash Function */ + PAGE *split_buf; /* Temporary buffer for splits. */ + int local_errno; /* Error Number -- for DBM compatability */ + u_long hash_accesses; /* Number of accesses to this table. */ + u_long hash_collisions; /* Number of collisions on search. */ + u_long hash_expansions; /* Number of times we added a bucket. */ + u_long hash_overflows; /* Number of overflow pages. */ + u_long hash_bigpages; /* Number of big key/data pages. */ +} HTAB; + +/* + * Macro used for interface functions to set the txnid in the DBP. + */ +#define SET_LOCKER(D, T) ((D)->txn = (T)) + +/* + * More interface macros used to get/release the meta data page. + */ +#define GET_META(D, H) { \ + int _r; \ + if (F_ISSET(D, DB_AM_LOCKING) && !F_ISSET(D, DB_AM_RECOVER)) { \ + (D)->lock.pgno = BUCKET_INVALID; \ + if ((_r = lock_get((D)->dbenv->lk_info, \ + (D)->txn == NULL ? (D)->locker : (D)->txn->txnid, \ + 0, &(D)->lock_dbt, DB_LOCK_READ, \ + &(H)->hlock)) != 0) \ + return (_r < 0 ? EAGAIN : _r); \ + } \ + if ((_r = __ham_get_page(D, 0, (PAGE **)&((H)->hdr))) != 0) { \ + if ((H)->hlock) { \ + (void)lock_put((D)->dbenv->lk_info, (H)->hlock);\ + (H)->hlock = 0; \ + } \ + return (_r); \ + } \ +} + +#define RELEASE_META(D, H) { \ + if (!F_ISSET(D, DB_AM_RECOVER) && \ + (D)->txn == NULL && (H)->hlock) \ + (void)lock_put((H)->dbp->dbenv->lk_info, (H)->hlock); \ + (H)->hlock = 0; \ + if ((H)->hdr) \ + (void)__ham_put_page(D, (PAGE *)(H)->hdr, \ + F_ISSET(D, DB_HS_DIRTYMETA) ? 1 : 0); \ + (H)->hdr = NULL; \ + F_CLR(D, DB_HS_DIRTYMETA); \ +} + +#define DIRTY_META(H, R) { \ + if (F_ISSET((H)->dbp, DB_AM_LOCKING) && \ + !F_ISSET((H)->dbp, DB_AM_RECOVER)) { \ + DB_LOCK _tmp; \ + (H)->dbp->lock.pgno = BUCKET_INVALID; \ + if (((R) = lock_get((H)->dbp->dbenv->lk_info, \ + (H)->dbp->txn ? (H)->dbp->txn->txnid : \ + (H)->dbp->locker, 0, &(H)->dbp->lock_dbt, \ + DB_LOCK_WRITE, &_tmp)) == 0) \ + (R) = lock_put((H)->dbp->dbenv->lk_info, \ + (H)->hlock); \ + else if ((R) < 0) \ + (R) = EAGAIN; \ + (H)->hlock = _tmp; \ + } \ + F_SET((H)->dbp, DB_HS_DIRTYMETA); \ +} + +/* Allocate and discard thread structures. */ +#define H_GETHANDLE(dbp, dbpp, ret) \ + if (F_ISSET(dbp, DB_AM_THREAD)) \ + ret = __db_gethandle(dbp, __ham_hdup, dbpp); \ + else { \ + ret = 0; \ + *dbpp = dbp; \ + } + +#define H_PUTHANDLE(dbp) { \ + if (F_ISSET(dbp, DB_AM_THREAD)) \ + __db_puthandle(dbp); \ +} + +/* Test string. */ +#define CHARKEY "%$sniglet^&" + +/* Overflow management */ +/* + * Overflow page numbers are allocated per split point. At each doubling of + * the table, we can allocate extra pages. We keep track of how many pages + * we've allocated at each point to calculate bucket to page number mapping. + */ +#define BUCKET_TO_PAGE(H, B) \ + ((B) + 1 + ((B) ? (H)->hdr->spares[__db_log2((B)+1)-1] : 0)) + +#define PGNO_OF(H, S, O) (BUCKET_TO_PAGE((H), (1 << (S)) - 1) + (O)) + +/* Constraints about number of pages and how much data goes on a page. */ + +#define MAX_PAGES(H) UINT32_T_MAX +#define MINFILL 4 +#define ISBIG(H, N) (((N) > ((H)->hdr->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_ISKEYBIG(N) (N & PAIR_KEYMASK) +#define PAIR_ISDATABIG(N) (N & PAIR_DATAMASK) +#define OPCODE_OF(N) (N & ~(PAIR_KEYMASK | PAIR_DATAMASK)) + +#define PUTPAIR 0x20 +#define DELPAIR 0x30 +#define PUTOVFL 0x40 +#define DELOVFL 0x50 +#define ALLOCPGNO 0x60 +#define DELPGNO 0x70 +#define SPLITOLD 0x80 +#define SPLITNEW 0x90 + +#include "hash_auto.h" +#include "hash_ext.h" +#include "db_am.h" +#include "common_ext.h" diff --git a/mozilla/db/include/hash_auto.h b/mozilla/db/include/hash_auto.h new file mode 100644 index 00000000000..2b8aea8d869 --- /dev/null +++ b/mozilla/db/include/hash_auto.h @@ -0,0 +1,132 @@ +/* Do not edit: automatically built by dist/db_gen.sh. */ +#ifndef ham_AUTO_H +#define ham_AUTO_H + +#define DB_ham_insdel (DB_ham_BEGIN + 1) + +typedef struct _ham_insdel_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t opcode; + u_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 (DB_ham_BEGIN + 2) + +typedef struct _ham_newpage_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t opcode; + u_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_splitmeta (DB_ham_BEGIN + 3) + +typedef struct _ham_splitmeta_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t fileid; + u_int32_t bucket; + u_int32_t ovflpoint; + u_int32_t spares; + DB_LSN metalsn; +} __ham_splitmeta_args; + + +#define DB_ham_splitdata (DB_ham_BEGIN + 4) + +typedef struct _ham_splitdata_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t fileid; + u_int32_t opcode; + db_pgno_t pgno; + DBT pageimage; + DB_LSN pagelsn; +} __ham_splitdata_args; + + +#define DB_ham_replace (DB_ham_BEGIN + 5) + +typedef struct _ham_replace_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_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_newpgno (DB_ham_BEGIN + 6) + +typedef struct _ham_newpgno_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t opcode; + u_int32_t fileid; + db_pgno_t pgno; + db_pgno_t free_pgno; + u_int32_t old_type; + db_pgno_t old_pgno; + u_int32_t new_type; + DB_LSN pagelsn; + DB_LSN metalsn; +} __ham_newpgno_args; + + +#define DB_ham_ovfl (DB_ham_BEGIN + 7) + +typedef struct _ham_ovfl_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t fileid; + db_pgno_t start_pgno; + u_int32_t npages; + db_pgno_t free_pgno; + u_int32_t ovflpoint; + DB_LSN metalsn; +} __ham_ovfl_args; + + +#define DB_ham_copypage (DB_ham_BEGIN + 8) + +typedef struct _ham_copypage_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t fileid; + db_pgno_t pgno; + DB_LSN pagelsn; + db_pgno_t next_pgno; + DB_LSN nextlsn; + db_pgno_t nnext_pgno; + DB_LSN nnextlsn; + DBT page; +} __ham_copypage_args; + +#endif diff --git a/mozilla/db/include/hash_ext.h b/mozilla/db/include/hash_ext.h new file mode 100644 index 00000000000..7086adcc44f --- /dev/null +++ b/mozilla/db/include/hash_ext.h @@ -0,0 +1,135 @@ +/* DO NOT EDIT: automatically built by dist/distrib. */ +#ifndef _hash_ext_h_ +#define _hash_ext_h_ +int __ham_open __P((DB *, DB_INFO *)); +int __ham_close __P((DB *)); +int __ham_c_iclose __P((DB *, DBC *)); +int __ham_expand_table __P((HTAB *)); +u_int32_t __ham_call_hash __P((HTAB *, u_int8_t *, int32_t)); +int __ham_init_dbt __P((DBT *, u_int32_t, void **, u_int32_t *)); +void __ham_c_update + __P((HASH_CURSOR *, db_pgno_t, u_int32_t, int, int)); +int __ham_hdup __P((DB *, DB *)); +int __ham_insdel_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, u_int32_t, db_pgno_t, u_int32_t, + DB_LSN *, const DBT *, const DBT *)); +int __ham_insdel_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __ham_insdel_read __P((void *, __ham_insdel_args **)); +int __ham_newpage_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, u_int32_t, db_pgno_t, DB_LSN *, + db_pgno_t, DB_LSN *, db_pgno_t, DB_LSN *)); +int __ham_newpage_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __ham_newpage_read __P((void *, __ham_newpage_args **)); +int __ham_splitmeta_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, u_int32_t, u_int32_t, u_int32_t, + DB_LSN *)); +int __ham_splitmeta_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __ham_splitmeta_read __P((void *, __ham_splitmeta_args **)); +int __ham_splitdata_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, u_int32_t, db_pgno_t, const DBT *, + DB_LSN *)); +int __ham_splitdata_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __ham_splitdata_read __P((void *, __ham_splitdata_args **)); +int __ham_replace_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, db_pgno_t, u_int32_t, DB_LSN *, + int32_t, const DBT *, const DBT *, u_int32_t)); +int __ham_replace_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __ham_replace_read __P((void *, __ham_replace_args **)); +int __ham_newpgno_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, u_int32_t, db_pgno_t, db_pgno_t, + u_int32_t, db_pgno_t, u_int32_t, DB_LSN *, + DB_LSN *)); +int __ham_newpgno_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __ham_newpgno_read __P((void *, __ham_newpgno_args **)); +int __ham_ovfl_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, db_pgno_t, u_int32_t, db_pgno_t, + u_int32_t, DB_LSN *)); +int __ham_ovfl_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __ham_ovfl_read __P((void *, __ham_ovfl_args **)); +int __ham_copypage_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t, + DB_LSN *, db_pgno_t, DB_LSN *, const DBT *)); +int __ham_copypage_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __ham_copypage_read __P((void *, __ham_copypage_args **)); +int __ham_init_print __P((DB_ENV *)); +int __ham_init_recover __P((DB_ENV *)); +int __ham_pgin __P((db_pgno_t, void *, DBT *)); +int __ham_pgout __P((db_pgno_t, void *, DBT *)); +int __ham_mswap __P((void *)); +#ifdef DEBUG +void __ham_dump_bucket __P((HTAB *, u_int32_t)); +#endif +int __ham_add_dup __P((HTAB *, HASH_CURSOR *, DBT *, u_int32_t)); +void __ham_move_offpage __P((HTAB *, PAGE *, u_int32_t, db_pgno_t)); +u_int32_t __ham_func2 __P((const void *, u_int32_t)); +u_int32_t __ham_func3 __P((const void *, u_int32_t)); +u_int32_t __ham_func4 __P((const void *, u_int32_t)); +u_int32_t __ham_func5 __P((const void *, u_int32_t)); +int __ham_item __P((HTAB *, HASH_CURSOR *, db_lockmode_t)); +int __ham_item_reset __P((HTAB *, HASH_CURSOR *)); +void __ham_item_init __P((HASH_CURSOR *)); +int __ham_item_done __P((HTAB *, HASH_CURSOR *, int)); +int __ham_item_last __P((HTAB *, HASH_CURSOR *, db_lockmode_t)); +int __ham_item_first __P((HTAB *, HASH_CURSOR *, db_lockmode_t)); +int __ham_item_prev __P((HTAB *, HASH_CURSOR *, db_lockmode_t)); +int __ham_item_next __P((HTAB *, HASH_CURSOR *, db_lockmode_t)); +void __ham_putitem __P((PAGE *p, const DBT *, int)); +void __ham_reputpair + __P((PAGE *p, u_int32_t, u_int32_t, const DBT *, const DBT *)); +int __ham_del_pair __P((HTAB *, HASH_CURSOR *, int)); +int __ham_replpair __P((HTAB *, HASH_CURSOR *, DBT *, u_int32_t)); +void __ham_onpage_replace __P((PAGE *, size_t, u_int32_t, int32_t, + int32_t, DBT *)); +int __ham_split_page __P((HTAB *, u_int32_t, u_int32_t)); +int __ham_add_el + __P((HTAB *, HASH_CURSOR *, const DBT *, const DBT *, int)); +void __ham_copy_item __P((HTAB *, PAGE *, u_int32_t, PAGE *)); +int __ham_add_ovflpage __P((HTAB *, PAGE *, int, PAGE **)); +int __ham_new_page __P((HTAB *, u_int32_t, u_int32_t, PAGE **)); +int __ham_del_page __P((DB *, PAGE *)); +int __ham_put_page __P((DB *, PAGE *, int32_t)); +int __ham_dirty_page __P((HTAB *, PAGE *)); +int __ham_get_page __P((DB *, db_pgno_t, PAGE **)); +int __ham_overflow_page __P((DB *, u_int32_t, PAGE **)); +#ifdef DEBUG +db_pgno_t __bucket_to_page __P((HTAB *, db_pgno_t)); +#endif +void __ham_init_ovflpages __P((HTAB *)); +int __ham_get_cpage __P((HTAB *, HASH_CURSOR *, db_lockmode_t)); +int __ham_next_cpage + __P((HTAB *, HASH_CURSOR *, db_pgno_t, int, u_int32_t)); +void __ham_dpair __P((DB *, PAGE *, u_int32_t)); +int __ham_insdel_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __ham_newpage_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __ham_replace_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __ham_newpgno_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __ham_splitmeta_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __ham_splitdata_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __ham_ovfl_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __ham_copypage_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __ham_stat __P((DB *, FILE *)); +#endif /* _hash_ext_h_ */ diff --git a/mozilla/db/include/lock.h b/mozilla/db/include/lock.h new file mode 100644 index 00000000000..47a38b8783c --- /dev/null +++ b/mozilla/db/include/lock.h @@ -0,0 +1,177 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)lock.h 10.15 (Sleepycat) 5/10/98 + */ + +typedef struct __db_lockobj DB_LOCKOBJ; + +#define DB_DEFAULT_LOCK_FILE "__db_lock.share" + +#ifndef DB_LOCK_DEFAULT_N +#define DB_LOCK_DEFAULT_N 5000 /* Default # of locks in region. */ +#endif + +/* + * The locker id space is divided between the transaction manager and the lock + * manager. Lockid's start at 0 and go to DB_LOCK_MAXID. Txn Id's start at + * DB_LOCK_MAXID + 1 and go up to TXN_INVALID. + */ +#define DB_LOCK_MAXID 0x7fffffff + +/* + * The lock region consists of: + * The DB_LOCKREGION structure (sizeof(DB_LOCKREGION)). + * The conflict matrix of nmodes * nmodes bytes (nmodes * nmodes). + * The hash table for object lookup (hashsize * sizeof(DB_OBJ *)). + * The locks themselves (maxlocks * sizeof(struct __db_lock). + * The objects being locked (maxlocks * sizeof(DB_OBJ)). + * String space to represent the DBTs that are the objects being locked. + */ +struct __db_lockregion { + RLAYOUT hdr; /* Shared region header. */ + u_int32_t magic; /* lock magic number */ + u_int32_t version; /* version number */ + u_int32_t id; /* unique id generator */ + u_int32_t need_dd; /* flag for deadlock detector */ + u_int32_t detect; /* run dd on every conflict */ + SH_TAILQ_HEAD(lock_header) free_locks; /* free lock header */ + SH_TAILQ_HEAD(obj_header) free_objs; /* free obj header */ + u_int32_t maxlocks; /* maximum number of locks in table */ + u_int32_t table_size; /* size of hash table */ + u_int32_t nmodes; /* number of lock modes */ + u_int32_t numobjs; /* number of objects */ + u_int32_t nlockers; /* number of lockers */ + size_t increment; /* how much to grow region */ + size_t hash_off; /* offset of hash table */ + size_t mem_off; /* offset of memory region */ + size_t mem_bytes; /* number of bytes in memory region */ + u_int32_t nconflicts; /* number of lock conflicts */ + u_int32_t nrequests; /* number of lock gets */ + u_int32_t nreleases; /* number of lock puts */ + u_int32_t ndeadlocks; /* number of deadlocks */ +}; + +/* Macros to lock/unlock the region. */ +#define LOCK_LOCKREGION(lt) \ + (void)__db_mutex_lock(&(lt)->region->hdr.lock, (lt)->reginfo.fd) +#define UNLOCK_LOCKREGION(lt) \ + (void)__db_mutex_unlock(&(lt)->region->hdr.lock, (lt)->reginfo.fd) + +/* + * Since we will be keeping 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; + ssize_t off; +} SH_DBT; + +#define SH_DBT_PTR(p) ((void *)(((u_int8_t *)(p)) + (p)->off)) + +struct __db_lockobj { + SH_DBT lockobj; /* Identifies object locked. */ + SH_TAILQ_ENTRY links; /* Links for free list. */ + union { + SH_TAILQ_HEAD(_wait) _waiters; /* List of waiting locks. */ + u_int32_t _dd_id; /* Deadlock detector id. */ + } wlinks; + union { + SH_LIST_HEAD(_held) _heldby; /* Locks held by this locker. */ + SH_TAILQ_HEAD(_hold) _holders; /* List of held locks. */ + } dlinks; +#define DB_LOCK_OBJTYPE 1 +#define DB_LOCK_LOCKER 2 + /* Allocate room in the object to + * hold typical DB lock structures + * so that we do not have to + * allocate them from shalloc. */ + u_int8_t objdata[sizeof(struct __db_ilock)]; + u_int8_t type; /* Real object or locker id. */ +}; + +#define dd_id wlinks._dd_id +#define waiters wlinks._waiters +#define holders dlinks._holders +#define heldby dlinks._heldby + +/* + * The lock table is the per-process cookie returned from a lock_open call. + */ +struct __db_locktab { + DB_ENV *dbenv; /* Environment. */ + REGINFO reginfo; /* Region information. */ + DB_LOCKREGION *region; /* Address of shared memory region. */ + DB_HASHTAB *hashtab; /* Beginning of hash table. */ + void *mem; /* Beginning of string space. */ + u_int8_t *conflicts; /* Pointer to conflict matrix. */ +}; + +/* Test for conflicts. */ +#define CONFLICTS(T, HELD, WANTED) \ + T->conflicts[HELD * T->region->nmodes + WANTED] + +/* + * Resources in the lock region. Used to indicate which resource + * is running low when we need to grow the region. + */ +typedef enum { + DB_LOCK_MEM, DB_LOCK_OBJ, DB_LOCK_LOCK +} db_resource_t; + +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_t mutex; + + u_int32_t holder; /* Who holds this lock. */ + 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. */ +}; + +/* + * We cannot return pointers to the user (else we cannot easily grow regions), + * so we return offsets in the region. These must be converted to and from + * regular pointers. Always use the macros below. + */ +#define OFFSET_TO_LOCK(lt, off) \ + ((struct __db_lock *)((u_int8_t *)((lt)->region) + (off))) +#define LOCK_TO_OFFSET(lt, lock) \ + ((size_t)((u_int8_t *)(lock) - (u_int8_t *)lt->region)) +#define OFFSET_TO_OBJ(lt, off) \ + ((DB_LOCKOBJ *)((u_int8_t *)((lt)->region) + (off))) +#define OBJ_TO_OFFSET(lt, obj) \ + ((size_t)((u_int8_t *)(obj) - (u_int8_t *)lt->region)) + +/* + * The lock header contains the region structure and the conflict matrix. + * Aligned to a large boundary because we don't know what the underlying + * type of the hash table elements are. + */ +#define LOCK_HASH_ALIGN 8 +#define LOCK_HEADER_SIZE(M) \ + ((size_t)(sizeof(DB_LOCKREGION) + ALIGN((M * M), LOCK_HASH_ALIGN))) + +/* + * For the full region, we need to add the locks, the objects, the hash table + * and the string space (which is 16 bytes per lock). + */ +#define STRING_SIZE(N) (16 * N) + +#define LOCK_REGION_SIZE(M, N, H) \ + (ALIGN(LOCK_HEADER_SIZE(M) + \ + (H) * sizeof(DB_HASHTAB), MUTEX_ALIGNMENT) + \ + (N) * ALIGN(sizeof(struct __db_lock), MUTEX_ALIGNMENT) + \ + ALIGN((N) * sizeof(DB_LOCKOBJ), sizeof(size_t)) + \ + ALIGN(STRING_SIZE(N), sizeof(size_t))) + +#include "lock_ext.h" diff --git a/mozilla/db/include/lock_ext.h b/mozilla/db/include/lock_ext.h new file mode 100644 index 00000000000..1e0522c6b5b --- /dev/null +++ b/mozilla/db/include/lock_ext.h @@ -0,0 +1,17 @@ +/* DO NOT EDIT: automatically built by dist/distrib. */ +#ifndef _lock_ext_h_ +#define _lock_ext_h_ +int __lock_is_locked + __P((DB_LOCKTAB *, u_int32_t, DBT *, db_lockmode_t)); +void __lock_printlock __P((DB_LOCKTAB *, struct __db_lock *, int)); +int __lock_getobj __P((DB_LOCKTAB *, + u_int32_t, const DBT *, u_int32_t type, DB_LOCKOBJ **)); +int __lock_validate_region __P((DB_LOCKTAB *)); +int __lock_grow_region __P((DB_LOCKTAB *, int, size_t)); +void __lock_dump_region __P((DB_LOCKTAB *, char *, FILE *)); +int __lock_cmp __P((const DBT *, DB_LOCKOBJ *)); +int __lock_locker_cmp __P((u_int32_t, DB_LOCKOBJ *)); +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)); +#endif /* _lock_ext_h_ */ diff --git a/mozilla/db/include/log.h b/mozilla/db/include/log.h new file mode 100644 index 00000000000..7d5161cc9dd --- /dev/null +++ b/mozilla/db/include/log.h @@ -0,0 +1,175 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)log.h 10.25 (Sleepycat) 4/10/98 + */ + +#ifndef _LOG_H_ +#define _LOG_H_ + +struct __fname; typedef struct __fname FNAME; +struct __hdr; typedef struct __hdr HDR; +struct __log; typedef struct __log LOG; +struct __log_persist; typedef struct __log_persist LOGP; + +#ifndef MAXLFNAME +#define MAXLFNAME 99999 /* Maximum log file name. */ +#define LFNAME "log.%05d" /* Log file name template. */ +#endif + /* Default log name. */ +#define DB_DEFAULT_LOG_FILE "__db_log.share" + +#define DEFAULT_MAX (10 * MEGABYTE) /* 10 Mb. */ + +/* Macros to lock/unlock the region and threads. */ +#define LOCK_LOGTHREAD(dblp) \ + if (F_ISSET(dblp, DB_AM_THREAD)) \ + (void)__db_mutex_lock((dblp)->mutexp, -1) +#define UNLOCK_LOGTHREAD(dblp) \ + if (F_ISSET(dblp, DB_AM_THREAD)) \ + (void)__db_mutex_unlock((dblp)->mutexp, -1); +#define LOCK_LOGREGION(dblp) \ + (void)__db_mutex_lock(&((RLAYOUT *)(dblp)->lp)->lock, \ + (dblp)->reginfo.fd) +#define UNLOCK_LOGREGION(dblp) \ + (void)__db_mutex_unlock(&((RLAYOUT *)(dblp)->lp)->lock, \ + (dblp)->reginfo.fd) + +/* + * The per-process table that maps log file-id's to DB structures. + */ +typedef struct __db_entry { + DB *dbp; /* Associated DB structure. */ + u_int32_t refcount; /* Reference counted. */ + 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. */ + db_mutex_t *mutexp; /* Mutex for thread protection. */ + + DB_ENTRY *dbentry; /* Recovery file-id mapping. */ +#define DB_GROW_SIZE 64 + u_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". */ + int lfd; /* Log file descriptor. */ + + DB_LSN c_lsn; /* Cursor: current LSN. */ + DBT c_dbt; /* Cursor: return DBT structure. */ + int c_fd; /* Cursor: file descriptor. */ + u_int32_t c_off; /* Cursor: previous record offset. */ + u_int32_t c_len; /* Cursor: current record length. */ + +/* These fields are not protected. */ + LOG *lp; /* Address of the shared LOG. */ + + DB_ENV *dbenv; /* Reference to error information. */ + REGINFO reginfo; /* Region information. */ + + void *addr; /* Address of shalloc() region. */ + + char *dir; /* Directory argument. */ + + u_int32_t flags; /* Support the DB_AM_XXX flags. */ +}; + +/* + * HDR -- + * Log record header. + */ +struct __hdr { + u_int32_t prev; /* Previous offset. */ + u_int32_t cksum; /* Current checksum. */ + u_int32_t len; /* Current length. */ +}; + +struct __log_persist { + u_int32_t magic; /* DB_LOGMAGIC */ + u_int32_t version; /* DB_LOGVERSION */ + + u_int32_t lg_max; /* Maximum file size. */ + int mode; /* Log file mode. */ +}; + +/* + * LOG -- + * Shared log region. One of these is allocated in shared memory, + * and describes the log. + */ +struct __log { + RLAYOUT rlayout; /* General region information. */ + + LOGP persist; /* Persistent information. */ + + SH_TAILQ_HEAD(__fq) fq; /* List of file names. */ + + /* + * The lsn LSN is the file offset that we're about to write and which + * we will return to the user. + */ + DB_LSN lsn; /* LSN at current file offset. */ + + /* + * The s_lsn LSN is the last LSN that we know is on disk, not just + * written, but synced. + */ + DB_LSN s_lsn; /* LSN of the last sync. */ + + u_int32_t len; /* Length of the last record. */ + + u_int32_t w_off; /* Current write offset in the file. */ + + DB_LSN chkpt_lsn; /* LSN of the last checkpoint. */ + time_t chkpt; /* Time of the last checkpoint. */ + + DB_LOG_STAT stat; /* Log statistics. */ + + /* + * The f_lsn LSN is the LSN (returned to the user) that "owns" the + * first byte of the buffer. If the record associated with the LSN + * spans buffers, it may not reflect the physical file location of + * the first byte of the buffer. + */ + DB_LSN f_lsn; /* LSN of first byte in the buffer. */ + size_t b_off; /* Current offset in the buffer. */ + u_int8_t buf[4 * 1024]; /* Log buffer. */ +}; + +/* + * FNAME -- + * File name and id. + */ +struct __fname { + SH_TAILQ_ENTRY q; /* File name queue. */ + + u_int16_t ref; /* Reference count. */ + + u_int32_t id; /* Logging file id. */ + DBTYPE s_type; /* Saved DB type. */ + + size_t name_off; /* Name offset. */ + u_int8_t ufid[DB_FILE_ID_LEN]; /* Unique file id. */ +}; + +/* File open/close register log record opcodes. */ +#define LOG_CHECKPOINT 1 /* Checkpoint: file name/id dump. */ +#define LOG_CLOSE 2 /* File close. */ +#define LOG_OPEN 3 /* File open. */ + +#include "log_auto.h" +#include "log_ext.h" +#endif /* _LOG_H_ */ diff --git a/mozilla/db/include/log_auto.h b/mozilla/db/include/log_auto.h new file mode 100644 index 00000000000..5717e140d72 --- /dev/null +++ b/mozilla/db/include/log_auto.h @@ -0,0 +1,18 @@ +/* Do not edit: automatically built by dist/db_gen.sh. */ +#ifndef log_AUTO_H +#define log_AUTO_H + +#define DB_log_register (DB_log_BEGIN + 1) + +typedef struct _log_register_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t opcode; + DBT name; + DBT uid; + u_int32_t id; + DBTYPE ftype; +} __log_register_args; + +#endif diff --git a/mozilla/db/include/log_ext.h b/mozilla/db/include/log_ext.h new file mode 100644 index 00000000000..bf3bcb02ced --- /dev/null +++ b/mozilla/db/include/log_ext.h @@ -0,0 +1,25 @@ +/* DO NOT EDIT: automatically built by dist/distrib. */ +#ifndef _log_ext_h_ +#define _log_ext_h_ +int __log_find __P((DB_LOG *, int, int *)); +int __log_valid __P((DB_LOG *, LOG *, int)); +int __log_register_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t, const DBT *, const DBT *, u_int32_t, + DBTYPE)); +int __log_register_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __log_register_read __P((void *, __log_register_args **)); +int __log_init_print __P((DB_ENV *)); +int __log_init_recover __P((DB_ENV *)); +int __log_findckp __P((DB_LOG *, DB_LSN *)); +int __log_get __P((DB_LOG *, DB_LSN *, DBT *, u_int32_t, int)); +int __log_put __P((DB_LOG *, DB_LSN *, const DBT *, u_int32_t)); +int __log_name __P((DB_LOG *, int, char **)); +int __log_register_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __log_add_logid __P((DB_LOG *, DB *, u_int32_t)); +int __db_fileid_to_db __P((DB_LOG *, DB **, u_int32_t)); +void __log_close_files __P((DB_LOG *)); +void __log_rem_logid __P((DB_LOG *, u_int32_t)); +#endif /* _log_ext_h_ */ diff --git a/mozilla/db/include/mp.h b/mozilla/db/include/mp.h new file mode 100644 index 00000000000..8635efa722c --- /dev/null +++ b/mozilla/db/include/mp.h @@ -0,0 +1,281 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)mp.h 10.33 (Sleepycat) 5/4/98 + */ + +struct __bh; typedef struct __bh BH; +struct __db_mpreg; typedef struct __db_mpreg DB_MPREG; +struct __mpool; typedef struct __mpool MPOOL; +struct __mpoolfile; typedef struct __mpoolfile MPOOLFILE; + + /* Default mpool name. */ +#define DB_DEFAULT_MPOOL_FILE "__db_mpool.share" + +/* + * We default to 128K (16 8K pages) if the user doesn't specify, and + * require a minimum of 20K. + */ +#ifndef DB_CACHESIZE_DEF +#define DB_CACHESIZE_DEF (128 * 1024) +#endif +#define DB_CACHESIZE_MIN ( 20 * 1024) + +#define INVALID 0 /* Invalid shared memory offset. */ + +/* + * There are three ways we do locking in the mpool code: + * + * Locking a handle mutex to provide concurrency for DB_THREAD operations. + * Locking the region mutex to provide mutual exclusion while reading and + * writing structures in the shared region. + * Locking buffer header mutexes during I/O. + * + * The first will not be further described here. We use the shared mpool + * region lock to provide mutual exclusion while reading/modifying all of + * the data structures, including the buffer headers. We use a per-buffer + * header lock to wait on buffer I/O. The order of locking is as follows: + * + * Searching for a buffer: + * Acquire the region lock. + * Find the buffer header. + * Increment the reference count (guarantee the buffer stays). + * While the BH_LOCKED flag is set (I/O is going on) { + * Release the region lock. + * Explicitly yield the processor if it's not the first pass + * through this loop, otherwise, we can simply spin because + * we'll be simply switching between the two locks. + * Request the buffer lock. + * The I/O will complete... + * Acquire the buffer lock. + * Release the buffer lock. + * Acquire the region lock. + * } + * Return the buffer. + * + * Reading/writing a buffer: + * Acquire the region lock. + * Find/create the buffer header. + * If reading, increment the reference count (guarantee the buffer stays). + * Set the BH_LOCKED flag. + * Acquire the buffer lock (guaranteed not to block). + * Release the region lock. + * Do the I/O and/or initialize the buffer contents. + * Release the buffer lock. + * At this point, the buffer lock is available, but the logical + * operation (flagged by BH_LOCKED) is not yet completed. For + * this reason, among others, threads checking the BH_LOCKED flag + * must loop around their test. + * Acquire the region lock. + * Clear the BH_LOCKED flag. + * Release the region lock. + * Return/discard the buffer. + * + * Pointers to DB_MPOOL, MPOOL, DB_MPOOLFILE and MPOOLFILE structures are not + * reacquired when a region lock is reacquired because they couldn't have been + * closed/discarded and because they never move in memory. + */ +#define LOCKINIT(dbmp, mutexp) \ + if (F_ISSET(dbmp, MP_LOCKHANDLE | MP_LOCKREGION)) \ + (void)__db_mutex_init(mutexp, \ + MUTEX_LOCK_OFFSET((dbmp)->reginfo.addr, mutexp)) + +#define LOCKHANDLE(dbmp, mutexp) \ + if (F_ISSET(dbmp, MP_LOCKHANDLE)) \ + (void)__db_mutex_lock(mutexp, (dbmp)->reginfo.fd) +#define UNLOCKHANDLE(dbmp, mutexp) \ + if (F_ISSET(dbmp, MP_LOCKHANDLE)) \ + (void)__db_mutex_unlock(mutexp, (dbmp)->reginfo.fd) + +#define LOCKREGION(dbmp) \ + if (F_ISSET(dbmp, MP_LOCKREGION)) \ + (void)__db_mutex_lock(&((RLAYOUT *)(dbmp)->mp)->lock, \ + (dbmp)->reginfo.fd) +#define UNLOCKREGION(dbmp) \ + if (F_ISSET(dbmp, MP_LOCKREGION)) \ + (void)__db_mutex_unlock(&((RLAYOUT *)(dbmp)->mp)->lock, \ + (dbmp)->reginfo.fd) + +#define LOCKBUFFER(dbmp, bhp) \ + if (F_ISSET(dbmp, MP_LOCKREGION)) \ + (void)__db_mutex_lock(&(bhp)->mutex, (dbmp)->reginfo.fd) +#define UNLOCKBUFFER(dbmp, bhp) \ + if (F_ISSET(dbmp, MP_LOCKREGION)) \ + (void)__db_mutex_unlock(&(bhp)->mutex, (dbmp)->reginfo.fd) + +/* + * DB_MPOOL -- + * Per-process memory pool structure. + */ +struct __db_mpool { +/* These fields need to be protected for multi-threaded support. */ + db_mutex_t *mutexp; /* Structure 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; + +/* These fields are not protected. */ + DB_ENV *dbenv; /* Reference to error information. */ + REGINFO reginfo; /* Region information. */ + + MPOOL *mp; /* Address of the shared MPOOL. */ + + void *addr; /* Address of shalloc() region. */ + + DB_HASHTAB *htab; /* Hash table of bucket headers. */ + +#define MP_LOCKHANDLE 0x01 /* Threaded, lock handles and region. */ +#define MP_LOCKREGION 0x02 /* Concurrent access, lock region. */ + u_int32_t flags; +}; + +/* + * DB_MPREG -- + * DB_MPOOL registry of pgin/pgout functions. + */ +struct __db_mpreg { + LIST_ENTRY(__db_mpreg) q; /* Linked list. */ + + int ftype; /* File type. */ + /* Pgin, pgout routines. */ + int (DB_CALLBACK *pgin) __P((db_pgno_t, void *, DBT *)); + int (DB_CALLBACK *pgout) __P((db_pgno_t, void *, DBT *)); +}; + +/* + * DB_MPOOLFILE -- + * Per-process DB_MPOOLFILE information. + */ +struct __db_mpoolfile { +/* These fields need to be protected for multi-threaded support. */ + db_mutex_t *mutexp; /* Structure lock. */ + + int fd; /* Underlying file descriptor. */ + + u_int32_t pinref; /* Pinned block reference count. */ + +/* These fields are not protected. */ + TAILQ_ENTRY(__db_mpoolfile) q; /* Linked list of DB_MPOOLFILE's. */ + + 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. */ + +/* These fields need to be protected for multi-threaded support. */ +#define MP_READONLY 0x01 /* File is readonly. */ +#define MP_UPGRADE 0x02 /* File descriptor is readwrite. */ +#define MP_UPGRADE_FAIL 0x04 /* Upgrade wasn't possible. */ + u_int32_t flags; +}; + +/* + * MPOOL -- + * Shared memory pool region. One of these is allocated in shared + * memory, and describes the pool. + */ +struct __mpool { + RLAYOUT rlayout; /* General region information. */ + + SH_TAILQ_HEAD(__bhq) bhq; /* LRU list of buckets. */ + SH_TAILQ_HEAD(__bhfq) bhfq; /* Free buckets. */ + SH_TAILQ_HEAD(__mpfq) mpfq; /* List of MPOOLFILEs. */ + + /* + * We make the assumption that the early pages of the file are far + * more likely to be retrieved than the later pages, which means + * that the top bits are more interesting for hashing since they're + * less likely to collide. On the other hand, since 512 4K pages + * represents a 2MB file, only the bottom 9 bits of the page number + * are likely to be set. We XOR in the offset in the MPOOL of the + * MPOOLFILE that backs this particular page, since that should also + * be unique for the page. + */ +#define BUCKET(mp, mf_offset, pgno) \ + (((pgno) ^ ((mf_offset) << 9)) % (mp)->htab_buckets) + + size_t htab; /* Hash table offset. */ + size_t htab_buckets; /* Number of hash table entries. */ + + DB_LSN lsn; /* Maximum checkpoint LSN. */ + u_int32_t lsn_cnt; /* Checkpoint buffers left to write. */ + + DB_MPOOL_STAT stat; /* Global mpool statistics. */ + +#define MP_LSN_RETRY 0x01 /* Retry all BH_WRITE buffers. */ + u_int32_t flags; +}; + +/* + * MPOOLFILE -- + * Shared DB_MPOOLFILE information. + */ +struct __mpoolfile { + SH_TAILQ_ENTRY q; /* List of MPOOLFILEs */ + + u_int32_t ref; /* Reference count. */ + + int ftype; /* File type. */ + + int32_t lsn_off; /* Page's LSN offset. */ + u_int32_t clear_len; /* Bytes to clear on page create. */ + + size_t path_off; /* File name location. */ + size_t fileid_off; /* File identification location. */ + + size_t pgcookie_len; /* Pgin/pgout cookie length. */ + size_t pgcookie_off; /* Pgin/pgout cookie location. */ + + u_int32_t lsn_cnt; /* Checkpoint buffers left to write. */ + + db_pgno_t last_pgno; /* Last page in the file. */ + db_pgno_t orig_last_pgno; /* Original last page in the file. */ + +#define MP_CAN_MMAP 0x01 /* If the file can be mmap'd. */ +#define MP_TEMP 0x02 /* Backing file is a temporary. */ + u_int32_t flags; + + DB_MPOOL_FSTAT stat; /* Per-file mpool statistics. */ +}; + +/* + * BH -- + * Buffer header. + */ +struct __bh { + db_mutex_t mutex; /* Structure lock. */ + + u_int16_t ref; /* Reference count. */ + +#define BH_CALLPGIN 0x001 /* Page needs to be reworked... */ +#define BH_DIRTY 0x002 /* Page was modified. */ +#define BH_DISCARD 0x004 /* Page is useless. */ +#define BH_LOCKED 0x008 /* Page is locked (I/O in progress). */ +#define BH_TRASH 0x010 /* Page is garbage. */ +#define BH_WRITE 0x020 /* Page scheduled for writing. */ + u_int16_t flags; + + SH_TAILQ_ENTRY q; /* LRU queue. */ + SH_TAILQ_ENTRY hq; /* MPOOL hash bucket queue. */ + + db_pgno_t pgno; /* Underlying MPOOLFILE page number. */ + size_t mf_offset; /* Associated MPOOLFILE offset. */ + + /* + * !!! + * This array must be size_t aligned -- the DB access methods put PAGE + * and other structures into it, and expect to be able to access them + * directly. (We guarantee size_t alignment in the db_mpool(3) manual + * page as well.) + */ + u_int8_t buf[1]; /* Variable length data. */ +}; + +#include "mp_ext.h" diff --git a/mozilla/db/include/mp_ext.h b/mozilla/db/include/mp_ext.h new file mode 100644 index 00000000000..36508394758 --- /dev/null +++ b/mozilla/db/include/mp_ext.h @@ -0,0 +1,19 @@ +/* DO NOT EDIT: automatically built by dist/distrib. */ +#ifndef _mp_ext_h_ +#define _mp_ext_h_ +int __memp_bhwrite + __P((DB_MPOOL *, MPOOLFILE *, BH *, int *, int *)); +int __memp_pgread __P((DB_MPOOLFILE *, BH *, int)); +int __memp_pgwrite __P((DB_MPOOLFILE *, BH *, int *, int *)); +int __memp_pg __P((DB_MPOOLFILE *, BH *, int)); +void __memp_bhfree __P((DB_MPOOL *, MPOOLFILE *, BH *, int)); +int __memp_fopen __P((DB_MPOOL *, MPOOLFILE *, const char *, + u_int32_t, int, size_t, int, DB_MPOOL_FINFO *, DB_MPOOLFILE **)); +char * __memp_fn __P((DB_MPOOLFILE *)); +char * __memp_fns __P((DB_MPOOL *, MPOOLFILE *)); +void __memp_dump_region __P((DB_MPOOL *, char *, FILE *)); +int __memp_ralloc __P((DB_MPOOL *, size_t, size_t *, void *)); +int __memp_ropen + __P((DB_MPOOL *, const char *, size_t, int, int, u_int32_t)); +int __mp_xxx_fd __P((DB_MPOOLFILE *, int *)); +#endif /* _mp_ext_h_ */ diff --git a/mozilla/db/include/mutex_ext.h b/mozilla/db/include/mutex_ext.h new file mode 100644 index 00000000000..b48da5d2f44 --- /dev/null +++ b/mozilla/db/include/mutex_ext.h @@ -0,0 +1,7 @@ +/* DO NOT EDIT: automatically built by dist/distrib. */ +#ifndef _mutex_ext_h_ +#define _mutex_ext_h_ +int __db_mutex_init __P((db_mutex_t *, u_int32_t)); +int __db_mutex_lock __P((db_mutex_t *, int)); +int __db_mutex_unlock __P((db_mutex_t *, int)); +#endif /* _mutex_ext_h_ */ diff --git a/mozilla/db/include/os_ext.h b/mozilla/db/include/os_ext.h new file mode 100644 index 00000000000..889a45a44e4 --- /dev/null +++ b/mozilla/db/include/os_ext.h @@ -0,0 +1,34 @@ +/* DO NOT EDIT: automatically built by dist/distrib. */ +#ifndef _os_ext_h_ +#define _os_ext_h_ +int __db_abspath __P((const char *)); +char *__db_strdup __P((const char *)); +void *__db_calloc __P((size_t, size_t)); +void *__db_malloc __P((size_t)); +void *__db_realloc __P((void *, size_t)); +int __os_dirlist __P((const char *, char ***, int *)); +void __os_dirfree __P((char **, int)); +int __db_fileid __P((DB_ENV *, const char *, int, u_int8_t *)); +int __db_fsync __P((int)); +int __db_mapanon_ok __P((int)); +int __db_mapinit __P((void)); +int __db_mapregion __P((char *, REGINFO *)); +int __db_unmapregion __P((REGINFO *)); +int __db_unlinkregion __P((char *, REGINFO *)); +int __db_mapfile __P((char *, int, size_t, int, void **)); +int __db_unmapfile __P((void *, size_t)); +u_int32_t __db_oflags __P((int)); +int __db_omode __P((const char *)); +int __db_open __P((const char *, u_int32_t, u_int32_t, int, int *)); +int __db_close __P((int)); +char *__db_rpath __P((const char *)); +int __db_read __P((int, void *, size_t, ssize_t *)); +int __db_write __P((int, void *, size_t, ssize_t *)); +int __os_seek __P((int, size_t, db_pgno_t, u_int32_t, int, int)); +int __os_sleep __P((u_long, u_long)); +int __os_spin __P((void)); +int __os_exists __P((const char *, int *)); +int __os_ioinfo + __P((const char *, int, u_int32_t *, u_int32_t *, u_int32_t *)); +int __db_unlink __P((const char *)); +#endif /* _os_ext_h_ */ diff --git a/mozilla/db/include/os_func.h b/mozilla/db/include/os_func.h new file mode 100644 index 00000000000..12794d550d2 --- /dev/null +++ b/mozilla/db/include/os_func.h @@ -0,0 +1,69 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)os_func.h 10.8 (Sleepycat) 4/19/98 + */ + +/* Calls which can be replaced by the application. */ +struct __db_jumptab { + int (*j_close) __P((int)); /* DB_FUNC_CLOSE */ + void (*j_dirfree) __P((char **, int)); /* DB_FUNC_DIRFREE */ + int (*j_dirlist) /* DB_FUNC_DIRLIST */ + __P((const char *, char ***, int *)); + int (*j_exists) /* DB_FUNC_EXISTS */ + __P((const char *, int *)); + void (*j_free) __P((void *)); /* DB_FUNC_FREE */ + int (*j_fsync) __P((int)); /* DB_FUNC_FSYNC */ + int (*j_ioinfo) __P((const char *, /* DB_FUNC_IOINFO */ + int, u_int32_t *, u_int32_t *, u_int32_t *)); + void *(*j_malloc) __P((size_t)); /* DB_FUNC_MALLOC */ + int (*j_map) /* DB_FUNC_MAP */ + __P((char *, int, size_t, int, int, int, void **)); + int (*j_open) /* DB_FUNC_OPEN */ + __P((const char *, int, ...)); + ssize_t (*j_read) __P((int, void *, size_t)); /* DB_FUNC_READ */ + void *(*j_realloc) __P((void *, size_t)); /* DB_FUNC_REALLOC */ + int (*j_runlink) __P((char *)); /* DB_FUNC_RUNLINK */ + int (*j_seek) /* DB_FUNC_SEEK */ + __P((int, size_t, db_pgno_t, u_int32_t, int, int)); + int (*j_sleep) __P((u_long, u_long)); /* DB_FUNC_SLEEP */ + int (*j_unlink) __P((const char *)); /* DB_FUNC_UNLINK */ + int (*j_unmap) __P((void *, size_t)); /* DB_FUNC_UNMAP */ + ssize_t (*j_write) /* DB_FUNC_WRITE */ + __P((int, const void *, size_t)); + int (*j_yield) __P((void)); /* DB_FUNC_YIELD */ +}; + +extern struct __db_jumptab __db_jump; + +/* + * Names used by DB to call through the jump table. + * + * The naming scheme goes like this: if the functionality the application can + * replace is the same as the DB functionality, e.g., malloc, or dirlist, then + * we use the name __db_XXX, and the application is expected to replace the + * complete functionality, which may or may not map directly to an ANSI C or + * POSIX 1003.1 interface. If the functionality that the aplication replaces + * only underlies what the DB os directory exports to other parts of DB, e.g., + * read, then the name __os_XXX is used, and the application can only replace + * the underlying functionality. Under most circumstances, the os directory + * part of DB is the only code that should use the __os_XXX names, all other + * parts of DB should be calling __db_XXX functions. + */ +#define __os_close __db_jump.j_close /* __db_close is a wrapper. */ +#define __db_dirfree __db_jump.j_dirfree +#define __db_dirlist __db_jump.j_dirlist +#define __db_exists __db_jump.j_exists +#define __db_free __db_jump.j_free +#define __os_fsync __db_jump.j_fsync /* __db_fsync is a wrapper. */ +#define __db_ioinfo __db_jump.j_ioinfo +#define __os_open __db_jump.j_open /* __db_open is a wrapper. */ +#define __os_read __db_jump.j_read /* __db_read is a wrapper. */ +#define __db_seek __db_jump.j_seek +#define __db_sleep __db_jump.j_sleep +#define __os_unlink __db_jump.j_unlink /* __db_unlink is a wrapper. */ +#define __os_write __db_jump.j_write /* __db_write is a wrapper. */ +#define __db_yield __db_jump.j_yield diff --git a/mozilla/db/include/queue.h b/mozilla/db/include/queue.h new file mode 100644 index 00000000000..05d7cd6975d --- /dev/null +++ b/mozilla/db/include/queue.h @@ -0,0 +1,275 @@ +/* BSDI $Id: queue.h,v 1.1.1.1 1998-10-15 03:56:31 roeber%netscape.com Exp $ */ + +/* + * 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. 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. + * + * @(#)queue.h 8.5 (Berkeley) 8/20/94 + */ + +#ifndef _SYS_QUEUE_H_ +#define _SYS_QUEUE_H_ + +/* + * 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. + */ + +/* + * 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) +#define LIST_END(head) NULL + +/* + * 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) +#define TAILQ_END(head) NULL + +/* + * 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) + +/* + * 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_END(head) ((void *)(head)) +#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) +#endif /* !_SYS_QUEUE_H_ */ diff --git a/mozilla/db/include/shqueue.h b/mozilla/db/include/shqueue.h new file mode 100644 index 00000000000..00e5d76251f --- /dev/null +++ b/mozilla/db/include/shqueue.h @@ -0,0 +1,334 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)shqueue.h 8.13 (Sleepycat) 4/10/98 + */ +#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 . + * + * 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. + */ + +/* + * 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)))) + +#define SH_LIST_END(head) NULL + +/* + * 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_END(head) NULL + +#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_END(head) ((void *)(head)) + +#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) +#endif /* !_SYS_SHQUEUE_H_ */ diff --git a/mozilla/db/include/txn.h b/mozilla/db/include/txn.h new file mode 100644 index 00000000000..a2512ed152f --- /dev/null +++ b/mozilla/db/include/txn.h @@ -0,0 +1,117 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)txn.h 10.15 (Sleepycat) 4/21/98 + */ +#ifndef _TXN_H_ +#define _TXN_H_ + +/* + * The name of the transaction shared memory region is DEFAULT_TXN_FILE and + * the region is always created group RW of the group owning the directory. + */ +#define DEFAULT_TXN_FILE "__db_txn.share" +/* TXN_MINIMUM = (DB_LOCK_MAXID + 1) but this makes compilers complain. */ +#define TXN_MINIMUM 0x80000000 +#define TXN_INVALID 0xffffffff /* Maximum number of txn ids. */ + +/* + * Transaction type declarations. + */ + +/* + * 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 */ + size_t last_lock; /* offset in lock region of last lock + for this transaction. */ +#define TXN_UNALLOC 0 +#define TXN_RUNNING 1 +#define TXN_ABORTED 2 +#define TXN_PREPARED 3 + u_int32_t status; /* status of the transaction */ + SH_TAILQ_ENTRY links; /* free/active list */ +} TXN_DETAIL; + +/* + * The transaction manager encapsulates the transaction system. It contains + * references to the log and lock managers as well as the state that keeps + * track of the shared memory region. + */ +struct __db_txnmgr { +/* These fields need to be protected for multi-threaded support. */ + db_mutex_t *mutexp; /* Synchronization. */ + /* list of active transactions */ + TAILQ_HEAD(_chain, __db_txn) txn_chain; + +/* These fields are not protected. */ + REGINFO reginfo; /* Region information. */ + DB_ENV *dbenv; /* Environment. */ + int (*recover) /* Recovery dispatch routine */ + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + u_int32_t flags; /* DB_TXN_NOSYNC, DB_THREAD */ + DB_TXNREGION *region; /* address of shared memory region */ + void *mem; /* address of the shalloc space */ +}; + +/* + * Layout of the shared memory region. + * The region consists of a DB_TXNREGION structure followed by a large + * pool of shalloc'd memory which is used to hold TXN_DETAIL structures + * and thread mutexes (which are dynamically allocated). + */ +struct __db_txnregion { + RLAYOUT hdr; /* Shared memory region header. */ + u_int32_t magic; /* transaction magic number */ + u_int32_t version; /* version number */ + u_int32_t maxtxns; /* maximum number of active txns */ + u_int32_t last_txnid; /* last transaction id given out */ + DB_LSN pending_ckp; /* last checkpoint did not finish */ + 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 */ + u_int32_t naborts; /* number of aborted transactions */ + u_int32_t ncommits; /* number of committed transactions */ + u_int32_t nbegins; /* number of begun transactions */ + SH_TAILQ_HEAD(_active) active_txn; /* active transaction list */ +}; + +/* + * Make the region large enough to hold N transaction detail structures + * plus some space to hold thread handles and the beginning of the shalloc + * region. + */ +#define TXN_REGION_SIZE(N) \ + (sizeof(DB_TXNREGION) + N * sizeof(TXN_DETAIL) + 1000) + +/* Macros to lock/unlock the region and threads. */ +#define LOCK_TXNTHREAD(tmgrp) \ + if (F_ISSET(tmgrp, DB_THREAD)) \ + (void)__db_mutex_lock((tmgrp)->mutexp, -1) +#define UNLOCK_TXNTHREAD(tmgrp) \ + if (F_ISSET(tmgrp, DB_THREAD)) \ + (void)__db_mutex_unlock((tmgrp)->mutexp, -1) + +#define LOCK_TXNREGION(tmgrp) \ + (void)__db_mutex_lock(&(tmgrp)->region->hdr.lock, (tmgrp)->reginfo.fd) +#define UNLOCK_TXNREGION(tmgrp) \ + (void)__db_mutex_unlock(&(tmgrp)->region->hdr.lock, (tmgrp)->reginfo.fd) + +/* + * Log record types. + */ +#define TXN_COMMIT 1 +#define TXN_PREPARE 2 +#define TXN_CHECKPOINT 3 + +#include "txn_auto.h" +#include "txn_ext.h" +#endif /* !_TXN_H_ */ diff --git a/mozilla/db/include/txn_auto.h b/mozilla/db/include/txn_auto.h new file mode 100644 index 00000000000..fd5a456115c --- /dev/null +++ b/mozilla/db/include/txn_auto.h @@ -0,0 +1,25 @@ +/* Do not edit: automatically built by dist/db_gen.sh. */ +#ifndef txn_AUTO_H +#define txn_AUTO_H + +#define DB_txn_regop (DB_txn_BEGIN + 1) + +typedef struct _txn_regop_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + u_int32_t opcode; +} __txn_regop_args; + + +#define DB_txn_ckp (DB_txn_BEGIN + 2) + +typedef struct _txn_ckp_args { + u_int32_t type; + DB_TXN *txnid; + DB_LSN prev_lsn; + DB_LSN ckp_lsn; + DB_LSN last_ckp; +} __txn_ckp_args; + +#endif diff --git a/mozilla/db/include/txn_ext.h b/mozilla/db/include/txn_ext.h new file mode 100644 index 00000000000..7d694f070d8 --- /dev/null +++ b/mozilla/db/include/txn_ext.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT: automatically built by dist/distrib. */ +#ifndef _txn_ext_h_ +#define _txn_ext_h_ +int __txn_regop_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + u_int32_t)); +int __txn_regop_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __txn_regop_read __P((void *, __txn_regop_args **)); +int __txn_ckp_log + __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + DB_LSN *, DB_LSN *)); +int __txn_ckp_print + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __txn_ckp_read __P((void *, __txn_ckp_args **)); +int __txn_init_print __P((DB_ENV *)); +int __txn_init_recover __P((DB_ENV *)); +int __txn_regop_recover + __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +int __txn_ckp_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); +#endif /* _txn_ext_h_ */ diff --git a/mozilla/db/java/Makefile.unix b/mozilla/db/java/Makefile.unix new file mode 100644 index 00000000000..ec66c38f518 --- /dev/null +++ b/mozilla/db/java/Makefile.unix @@ -0,0 +1,30 @@ +# @(#)Makefile.unix 10.2 (Sleepycat) 4/8/98 +# +# build java source code, UNIX version +# + +# Set JAVAC to your java compiler +# +JAVAC=javac + +# Do not change. +# Location of DB java class directory, +# relative to the source directories. +# +DBJAVA_CLASSES=../../../../classes + +# Normally, you shouldn't have to change these. +# Whether or not your CLASSPATH environment variable is +# set, the compiler should pick up the core classes. +# +JAVACFLAGS= +CLASSPATH=$(DBJAVA_CLASSES):$(CLASSPATH) + +all: build_java + +build_java: + mkdir -p classes + cd src/com/sleepycat/db; \ + $(JAVAC) $(JAVACFLAGS) -d $(DBJAVA_CLASSES) *.java + cd src/com/sleepycat/examples; \ + $(JAVAC) $(JAVACFLAGS) -d $(DBJAVA_CLASSES) *.java diff --git a/mozilla/db/java/Makefile.win32 b/mozilla/db/java/Makefile.win32 new file mode 100644 index 00000000000..6603c0d4d1e --- /dev/null +++ b/mozilla/db/java/Makefile.win32 @@ -0,0 +1,35 @@ +# @(#)Makefile.win32 10.2 (Sleepycat) 4/8/98 +# +# build java source code, win32 version - tested with Microsoft nmake +# This makefile is very simple, but it is different from the UNIX makefile +# in a significant way. Commands are not grouped together on a line using +# the ';' separator, but on separate lines. This is done since the +# current directory for commands is remembered between commands, and +# the DOS shell does not have a ';' connector. +# + +# Set JAVAC to your java compiler +# +JAVAC=javac + +# Do not change. +# Location of DB java class directory, +# relative to the source directories. +# +DBJAVA_CLASSES=../../../../classes + +# Normally, you shouldn't have to change these. +# Whether or not your CLASSPATH environment variable is +# set, the compiler should pick up the core classes. +# +JAVACFLAGS= +CLASSPATH=$(DBJAVA_CLASSES);$(CLASSPATH) + +all: build_java + +build_java: + if not exist classes mkdir classes + cd src/com/sleepycat/db + $(JAVAC) $(JAVACFLAGS) -d $(DBJAVA_CLASSES) *.java + cd ../examples + $(JAVAC) $(JAVACFLAGS) -d $(DBJAVA_CLASSES) *.java diff --git a/mozilla/db/java/README b/mozilla/db/java/README new file mode 100644 index 00000000000..20b1c66192f --- /dev/null +++ b/mozilla/db/java/README @@ -0,0 +1,229 @@ +# @(#)README 10.7 (Sleepycat) 5/2/98 + + Notes for Java users of DB + +These are notes to help you install and program to the Java DB library. +For the most part, the installation and usage is quite straightforward. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +COMPATIBILITY: + +Java DB has been tested with the Sun JDK 1.1 (http://www.javasoft.com) on +Windows/NT and SunOS 5.5, and it should work with any JDK 1.1 compatible +environment. The most important thing to understand is whether the target +Java environment supports the JNI (Java Native Interface) which we use, +rather than some other way for DLLs to interface to java. The JNI is new +to JDK 1.1, but more likely to be implementable across many platforms. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +INSTALLATION: + +We expect that you've already installed the Java JDK or equivalent on your +system. Since you are reading this, you also already have a copy of the +Berkeley DB package. For the sake of discussion, we'll assume it's in a +directory called db-VERSION, e.g., you extracted DB version 2.3.12 and +you did not change the top-level directory name. The files related to +Java are in two subdirectories of db-VERSION: java, the java source files, +and libdb_java, the C++ files that provide the "glue" between java and +DB. The directory tree looks like this: + + db-VERSION + / \ + java libdb_java + | | + src ... + | + sleepycat + / \ + db examples + | | + ... ... + +This naming conforms to the emerging standard for naming java packages. +When the java code is built, it is placed into a "classes" subdirectory +that is parallel to the "src" subdirectory. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +BUILDING JAVA: + +Both db-VERSION/java and db-VERSION/libdb_java have Makefiles: + + Makefile.win32 + Makefile.unix + +The java directory can be built using your make command and the +appropriate Makefile. If you've never built java code before, there +are two things you will need to do before issuing the make command. + +First, make sure the java compiler (usually "javac") is in your path. If +you installed the sun JDK distribution in /usr/java , then the java tools +are in the directory /usr/java/bin. + +Make sure your classpath is set correctly. Set your environment variable +CLASSPATH to contain at least the standard class library (perhaps in +/usr/java/lib/classes.zip) and add the DB classes in as well. Using the +UNIX csh, this might be: + + setenv CLASSPATH "/usr/java/lib/classes.zip:/db-VERSION/java/classes" + +On Windows/95, your autoexec.bat would need to have something like: + + set CLASSPATH="c:/java/lib/classes.zip;c:/db-VERSION/java/classes" + +Note the use of semicolons on Windows. On Windows/NT, you'll set this +variable in the control panel. + +Now you can run make to build the java directory, e.g.: + + cd db-VERSION/java + make -f Makefile.unix + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +BUILDING A SHARED LIB VERSION of DB: + +If you are on Windows/NT or Windows, you can build a shared lib version +of DB by opening the build.win32/Berkeley_DB.dsw workspace and selecting +target DB_DLL. Set the configuration to Win32 Debug, and build. Make +sure there is a build.win32/Debug/libdb.dll as a result. + +If you are on UNIX, you will need to do a little extra work to build a +shared library version of DB. By default, DB builds as a static library. +If you've already built DB, you can copy your build directory to use as +a work space, e.g.: + + % cd db-VERSION + % cp -r build.unix build.shlib + % cd build.shlib + % make clean + +Now you'll need to consult your system documentation to understand how to +build DB as a shared library. As UNIX architectures do not all build +shared libraries the same way, DB is not distributed with support for +building shared libraries. You MUST build DB as a shared library before +you proceed beyond this step. + +For some examples of building shared library versions of DB, please see +the directory SHARED.example. If you build a shared library version of +DB for a compiler/architecture combination that is not represented by a +file in that directory, please email it to us at db@sleepycat.com, and +we'll add it to the collection. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +BUILDING LIBDB_JAVA: + +Before building libdb_java, make sure you have a shared library version +of DB (see above). + +On UNIX: + +NB: The libdb_java/Makefile.unix Makefile is written to expect that the +system compiler is named "gcc" and is the GNU C compiler. In addition, +it uses compiler-specific options when building. If you are using a +different compiler than gcc, you'll need to modify Makefile.unix to work +with it. + +First, edit the line at the beginning of libdb_java/Makefile.unix: + + JAVAINSDIR= /usr/java1.1/ + +Change JAVAINSDIR to be the top level directory of your java JDK tree. +This is the level above the bin and include directories. Then issue a +make command in the libdb_java directory: + + % cd db-VERSION/libdb_java + % make -f Makefile.unix + +On Win/: + +Issue the nmake command in the libdb_java directory: + + C:\db_distribution\libdb_java> nmake /f Makefile.win32 + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +GENERAL USAGE NOTES: + +For your application to use Db successfully, you must set your CLASSPATH +environment variable to include db-VERSION/java/classes as well as the +classes in your java distribution. See the section above on "BUILDING +JAVA" for further information. + +On Windows, you will want to set your PATH variable to include: + + db-VERSION/java/java_db;db-VERSION/build.win32/debug + +On UNIX, you will want to set LD_LIBRARY_PATH to include: + + db-VERSION/java/java_db;db-VERSION/build.unix + +These are the locations of your shared libraries. If you get a: + + java.lang.UnsatisfiedLinkError + +exception when you run, chances are you do not have the PATH set up +correctly. + +Or, of course, you may copy the built dynamic libraries (libdb and +java_db) to a directory already in your path. + +To ensure that everything is running correctly, you may want to try a +simple test from the example programs in: + + db-VERSION/java/src/com/sleepycat/examples + +(which should have been built in the "BUILDING JAVA" section above): + + % java com.sleepycat.examples.AccessExample + +This example program will prompt for text input lines which are then +stored with their reversed text in a simple Btree named "db.access" in +your current directly. Try giving it two lines of text and then +end-of-file. Before it exits, you should see the reversed text. If you +run it again, lines will be there from your previous run. This is an +excellent check to make sure the fundamental things are working right. + +NOTE: when you run some of the other examples on Solaris, you may get an +"rmutex" libc error message. This is a known bug in Solaris 2.5, and it +is fixed by Sun patch 103187-25. See the Sleepycat Software Release FAQ +web page (www.sleepycat.com) for further information on this problem. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +PROGRAMMING NOTES: + +The API closely parallels the DB/C++ interface, and to a great degree, +the DB C interface. If you are currently using either of those APIs, +there will be very little to surprise you in Java DB. We've even taken +great care to make the names of classes, constants, methods, and even +method arguments identical, where possible, across all three APIs. + +If there are embedded null strings in the db_config argument for +DbEnv.appinit(), they will be treated as the end of the list of config +strings, even though you may have allocated a longer array. Fill in all +the strings in your array unless you intend to cut it short. + +The callback installed for DbEnv.set_errcall will run in the same thread +as the caller to DbEnv.set_errcall. Make sure that thread remains running +until your application exits or DbEnv.appexit() is called. + +The DB package requires that you explicitly call close on each individual +Db, Dbc that you obtained or any DbLocktab or DbTxnMgr that you explicitly +opened. Your database activity may not be synchronized to disk unless you +do so. + +The DbMpool class has a small subset of the corresponding DB/C++ +functionality. This has been provided to allow you to perform certain +administrative actions on underlying MPOOL's opened as a consequence +of DbEnv.appinit(). Direct access to other MPOOL functionality is +not appropriate for the Java environment. + +The Java runtime DOES NOT automatically close Db* objects on finalization, +whether they be Db, Dbc, DbTxn, etc. There are a couple reasons for +this. One is that finalization is generally run only when GC occurs and +there is no guarantee that this occurs at all (even on exit). Allowing +specific DB actions to occur in ways that cannot be replicated seems +wrong. Secondly, finalization of objects may happen in an arbitrary +order, so we would have to do a lot of extra bookkeeping to make sure +everything got closed in the proper order. The best word of advice is to +always do a close() for any matching open() call or equivalent. + +DbEnv.appinit() always turns on the DB_THREAD flag since threads are +commonly used in Java. diff --git a/mozilla/db/java/SHARED.example/gcc.default b/mozilla/db/java/SHARED.example/gcc.default new file mode 100644 index 00000000000..463c5b7c325 --- /dev/null +++ b/mozilla/db/java/SHARED.example/gcc.default @@ -0,0 +1,24 @@ +# @(#)gcc.default 10.1 (Sleepycat) 11/13/97 + +If you're using gcc and there's no better shared library example for your +architecture, the following shared library build procedure will probably +work. + +First, add the "-fpic" option to the CFLAGS value in the Makefile. + +Then, rebuild all of your .o files. This will create a DB library that +contains .o files with PIC code. To build the shared library, then take +the following steps in the library build directory: + + % mkdir tmp + % cd tmp + % ar xv ../libdb.a + % gcc -shared -o libdb.so *.o + % mv libdb.so .. + % cd .. + % rm -rf tmp + +Note, you may have to change the gcc line depending on the requirements +of your system. + +The file libdb.so is your shared library. diff --git a/mozilla/db/java/spell.ok b/mozilla/db/java/spell.ok new file mode 100644 index 00000000000..903a67cb566 --- /dev/null +++ b/mozilla/db/java/spell.ok @@ -0,0 +1,57 @@ +API +APIs +AccessExample +Btree +CLASSPATH +DLL +DLLs +Db +DbEnv +DbLocktab +DbLog +DbMpool +DbMpoolFile +DbMpools +DbTxnMgr +Dbc +GC +JAVAINSDIR +JDK +JNI +LD +LIBDB +MPOOL +NB +NT +Sleepycat +Solaris +SunOS +UnsatisfiedLinkError +appexit +appinit +autoexec +cd +classpath +config +cp +csh +db +dll +dsw +errcall +gcc +http +javac +javasoft +lang +libc +libdb +nmake +rmutex +setenv +shlib +sleepycat +src +unix +usr +www diff --git a/mozilla/db/java/src/com/sleepycat/db/Db.java b/mozilla/db/java/src/com/sleepycat/db/Db.java new file mode 100644 index 00000000000..81022dcb3a6 --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/db/Db.java @@ -0,0 +1,328 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)Db.java 10.5 (Sleepycat) 6/2/98 + */ + +package com.sleepycat.db; + +/** + * + * @author Donald D. Anderson + */ +public class Db +{ + // All constant and flag values used with Db* classes are defined here. + + // Collectively, these constants are known by the name + // "DBTYPE" in the documentation. + // + public static final int DB_BTREE = 1; // B+tree + public static final int DB_HASH = 2; // Extended Linear Hashing. + public static final int DB_RECNO = 3; // Fixed and variable-length records. + public static final int DB_UNKNOWN = 4; // Figure it out on open. + + // Flags understood by Db.open(), DbEnv.appinit(), DbEnv.DbEnv(). + // + public static final int DB_CREATE; // O_CREAT: create file as necessary. + public static final int DB_NOMMAP; // Don't mmap underlying file. + public static final int DB_THREAD; // Free-thread DB package handles. + + // + // Flags understood by db_open(3). + // + public static final int DB_EXCL; // O_EXCL: exclusive open. + public static final int DB_RDONLY; // O_RDONLY: read-only. + public static final int DB_SEQUENTIAL; // Indicate sequential access. + public static final int DB_TEMPORARY; // Remove on last close. + public static final int DB_TRUNCATE; // O_TRUNCATE: replace existing DB. + + + // + // DB (user visible) error return codes. + // + public static final int DB_INCOMPLETE = -1; // Sync didn't finish. + public static final int DB_KEYEMPTY = -2; // The key/data pair was deleted or + // was never created by the user. + public static final int DB_KEYEXIST = -3; // The key/data pair already exists. + public static final int DB_LOCK_DEADLOCK = -4; // Locker killed to resolve deadlock. + public static final int DB_LOCK_NOTGRANTED = -5; // Lock unavailable, no-wait set. + public static final int DB_LOCK_NOTHELD = -6; // Lock not held by locker. + public static final int DB_NOTFOUND = -7; // Key/data pair not found (EOF). + + // + // Flags used by DbEnv.appinit() + // + public static final int DB_INIT_LOCK; // Initialize locking. + public static final int DB_INIT_LOG; // Initialize logging. + public static final int DB_INIT_MPOOL; // Initialize mpool. + public static final int DB_INIT_TXN; // Initialize transactions. + public static final int DB_MPOOL_PRIVATE; // Mpool: private memory pool. + public static final int DB_RECOVER; // Run normal recovery. + public static final int DB_RECOVER_FATAL; // Run catastrophic recovery. + public static final int DB_TXN_NOSYNC; // Do not sync log on commit. + public static final int DB_USE_ENVIRON; // Use the environment. + public static final int DB_USE_ENVIRON_ROOT; // Use the environment if root. + + // + // Deadlock detector modes; used in the DBENV structure to configure the + // locking subsystem. + // + public static final int DB_LOCK_NORUN; + public static final int DB_LOCK_DEFAULT; + public static final int DB_LOCK_OLDEST; + public static final int DB_LOCK_RANDOM; + public static final int DB_LOCK_YOUNGEST; + + // + // Values for DbInfo flags + // + public static final int DB_DELIMITER; // Recno: re_delim set. + public static final int DB_DUP; // Btree, Hash: duplicate keys. + public static final int DB_FIXEDLEN; // Recno: fixed-length records. + public static final int DB_PAD; // Recno: re_pad set. + public static final int DB_RECNUM; // Btree: record numbers. + public static final int DB_RENUMBER; // Recno: renumber on insert/delete. + public static final int DB_SNAPSHOT; // Recno: snapshot the input. + + // Collectively, these constants are known by the name + // "db_lockmode_t" in the documentation. + // + public static final int DB_LOCK_NG = 0; // Not granted. + public static final int DB_LOCK_READ = 1; // Shared/read. + public static final int DB_LOCK_WRITE = 2; // Exclusive/write. + public static final int DB_LOCK_IREAD = 3; // Intent to share/read. + public static final int DB_LOCK_IWRITE = 4; // Intent exclusive/write. + public static final int DB_LOCK_IWR = 5; // Intent to read and write. + + // Collectively, these constants are known by the name + // "db_lockop_t" in the documentation. + // + public static final int DB_LOCK_DUMP = 0; // Display held locks. + public static final int DB_LOCK_GET = 1; // Get the lock. + public static final int DB_LOCK_PUT = 2; // Release the lock. + public static final int DB_LOCK_PUT_ALL = 3;// Release locker's locks. + public static final int DB_LOCK_PUT_OBJ = 4;// Release locker's locks on obj. + + // Flag values for DbLock.vec() + public static final int DB_LOCK_NOWAIT; // Don't wait on unavailable lock. + + // Flag values for DbLock.detect() + public static final int DB_LOCK_CONFLICT; // Run on any conflict. + + // + // Flag values for DbLog.archive() + // + public static final int DB_ARCH_ABS; // Absolute pathnames. + public static final int DB_ARCH_DATA; // Data files. + public static final int DB_ARCH_LOG; // Log files. + + // + // DB access method and cursor operation codes. These are implemented as + // bit fields for future flexibility, but currently only a single one may + // be specified to any function. + /// + public static final int DB_AFTER; // Dbc.put() + public static final int DB_APPEND; // Db.put() + public static final int DB_BEFORE; // Dbc.put() + public static final int DB_CHECKPOINT; // DbLog.put(), DbLog.get() + public static final int DB_CURRENT; // Dbc.get(), Dbc.put(), DbLog.get() + public static final int DB_FIRST; // Dbc.get(), DbLog.get() + public static final int DB_FLUSH; // DbLog.put() + public static final int DB_GET_RECNO; // Db.get(), Dbc.get() + public static final int DB_KEYFIRST; // Dbc.put() + public static final int DB_KEYLAST; // Dbc.put() + public static final int DB_LAST; // Dbc.get(), DbLog.get() + public static final int DB_NEXT; // Dbc.get(), DbLog.get() + public static final int DB_NOOVERWRITE;// Db.put() + public static final int DB_NOSYNC; // Db.close() + public static final int DB_PREV; // Dbc.get(), DbLog.get() + public static final int DB_RECORDCOUNT;// Db.stat() + public static final int DB_SET; // Dbc.get(), DbLog.get() + public static final int DB_SET_RANGE; // Dbc.get() + public static final int DB_SET_RECNO; // Dbc.get() + + // Collectively, these values are used for Dbt flags + // + // Perform any mallocs using regular malloc, not the user's malloc. + public static final int DB_DBT_INTERNAL; + + // Return in allocated memory. + public static final int DB_DBT_MALLOC; + + // Partial put/get. + public static final int DB_DBT_PARTIAL; + + // Return in user's memory. + public static final int DB_DBT_USERMEM; + + + + // methods + // + + public native void close(int flags) + throws DbException; + + public native Dbc cursor(DbTxn txnid) + throws DbException; + + public native void del(DbTxn txnid, Dbt key, int flags) + throws DbException; + + public native int fd() + throws DbException; + + // returns: 0, DB_NOTFOUND, or throws error + public native int get(DbTxn txnid, Dbt key, Dbt data, int flags) + throws DbException; + + // returns: 0, DB_KEYEXIST, or throws error + public native int put(DbTxn txnid, Dbt key, Dbt data, int flags) + throws DbException; + + public native DbBtreeStat stat(int flags) + throws DbException; + + public native void sync(int flags) + throws DbException; + + public native /*DBTYPE*/ int get_type(); + + public native static Db open(String fname, /*DBTYPE*/ int type, int flags, + int mode, DbEnv dbenv, DbInfo info) + throws DbException; + + protected native void finalize() + throws Throwable; + + // get/set methods + // + + // private data + // + private long private_info_ = 0; + + private static boolean already_loaded_ = false; + + public static void load_db() + { + if (already_loaded_) + return; + + String os = System.getProperty("os.name"); + if (os != null && os.startsWith("Windows")) { + // called libdb.dll, libdb_java.dll on Win/* + System.loadLibrary("libdb"); + System.loadLibrary("libdb_java"); + } + else { + // called libdb.so, libdb_java.so on UNIX + System.loadLibrary("db"); + System.loadLibrary("db_java"); + } + + already_loaded_ = true; + } + + static private void check_constant(int c1, int c2) + { + if (c1 != c2) { + System.err.println("Db: constant mismatch"); + System.exit(1); + } + } + + static { + Db.load_db(); + + // Note: constant values are stored in DbConstants, which + // is automatically generated. Initializing constants in + // static code insulates users from the possibility of + // changing constants. + // + DB_CREATE = DbConstants.DB_CREATE; + DB_NOMMAP = DbConstants.DB_NOMMAP; + DB_THREAD = DbConstants.DB_THREAD; + + DB_EXCL = DbConstants.DB_EXCL; + DB_RDONLY = DbConstants.DB_RDONLY; + DB_SEQUENTIAL = DbConstants.DB_SEQUENTIAL; + DB_TEMPORARY = DbConstants.DB_TEMPORARY; + DB_TRUNCATE = DbConstants.DB_TRUNCATE; + + // These constants are not assigned, but rather checked. + // Having initialized constants for these values allows + // them to be used as case values in switch statements. + // + check_constant(DB_INCOMPLETE, DbConstants.DB_INCOMPLETE); + check_constant(DB_KEYEMPTY, DbConstants.DB_KEYEMPTY); + check_constant(DB_KEYEXIST, DbConstants.DB_KEYEXIST); + check_constant(DB_LOCK_DEADLOCK, DbConstants.DB_LOCK_DEADLOCK); + check_constant(DB_LOCK_NOTGRANTED, DbConstants.DB_LOCK_NOTGRANTED); + check_constant(DB_LOCK_NOTHELD, DbConstants.DB_LOCK_NOTHELD); + check_constant(DB_NOTFOUND, DbConstants.DB_NOTFOUND); + + DB_INIT_LOCK = DbConstants.DB_INIT_LOCK; + DB_INIT_LOG = DbConstants.DB_INIT_LOG; + DB_INIT_MPOOL = DbConstants.DB_INIT_MPOOL; + DB_INIT_TXN = DbConstants.DB_INIT_TXN; + DB_MPOOL_PRIVATE = DbConstants.DB_MPOOL_PRIVATE; + DB_RECOVER = DbConstants.DB_RECOVER; + DB_RECOVER_FATAL = DbConstants.DB_RECOVER_FATAL; + DB_TXN_NOSYNC = DbConstants.DB_TXN_NOSYNC; + DB_USE_ENVIRON = DbConstants.DB_USE_ENVIRON; + DB_USE_ENVIRON_ROOT = DbConstants.DB_USE_ENVIRON_ROOT; + + DB_LOCK_NORUN = DbConstants.DB_LOCK_NORUN; + DB_LOCK_DEFAULT = DbConstants.DB_LOCK_DEFAULT; + DB_LOCK_OLDEST = DbConstants.DB_LOCK_OLDEST; + DB_LOCK_RANDOM = DbConstants.DB_LOCK_RANDOM; + DB_LOCK_YOUNGEST = DbConstants.DB_LOCK_YOUNGEST; + + DB_DELIMITER = DbConstants.DB_DELIMITER; + DB_DUP = DbConstants.DB_DUP; + DB_FIXEDLEN = DbConstants.DB_FIXEDLEN; + DB_PAD = DbConstants.DB_PAD; + DB_RECNUM = DbConstants.DB_RECNUM; + DB_RENUMBER = DbConstants.DB_RENUMBER; + DB_SNAPSHOT = DbConstants.DB_SNAPSHOT; + + DB_LOCK_NOWAIT = DbConstants.DB_LOCK_NOWAIT; + DB_LOCK_CONFLICT = DbConstants.DB_LOCK_CONFLICT; + + DB_ARCH_ABS = DbConstants.DB_ARCH_ABS; + DB_ARCH_DATA = DbConstants.DB_ARCH_DATA; + DB_ARCH_LOG = DbConstants.DB_ARCH_LOG; + + DB_AFTER = DbConstants.DB_AFTER; + DB_APPEND = DbConstants.DB_APPEND; + DB_BEFORE = DbConstants.DB_BEFORE; + DB_CHECKPOINT = DbConstants.DB_CHECKPOINT; + DB_CURRENT = DbConstants.DB_CURRENT; + DB_FIRST = DbConstants.DB_FIRST; + DB_FLUSH = DbConstants.DB_FLUSH; + DB_GET_RECNO = DbConstants.DB_GET_RECNO; + DB_KEYFIRST = DbConstants.DB_KEYFIRST; + DB_KEYLAST = DbConstants.DB_KEYLAST; + DB_LAST = DbConstants.DB_LAST; + DB_NEXT = DbConstants.DB_NEXT; + DB_NOOVERWRITE = DbConstants.DB_NOOVERWRITE; + DB_NOSYNC = DbConstants.DB_NOSYNC; + DB_PREV = DbConstants.DB_PREV; + DB_RECORDCOUNT = DbConstants.DB_RECORDCOUNT; + DB_SET = DbConstants.DB_SET; + DB_SET_RANGE = DbConstants.DB_SET_RANGE; + DB_SET_RECNO = DbConstants.DB_SET_RECNO; + + DB_DBT_INTERNAL = DbConstants.DB_DBT_INTERNAL; + DB_DBT_MALLOC = DbConstants.DB_DBT_MALLOC; + DB_DBT_PARTIAL = DbConstants.DB_DBT_PARTIAL; + DB_DBT_USERMEM = DbConstants.DB_DBT_USERMEM; + } +} + +// end of Db.java diff --git a/mozilla/db/java/src/com/sleepycat/db/DbBtreeStat.java b/mozilla/db/java/src/com/sleepycat/db/DbBtreeStat.java new file mode 100644 index 00000000000..cd843c65d10 --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/db/DbBtreeStat.java @@ -0,0 +1,120 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)DbBtreeStat.java 10.2 (Sleepycat) 4/10/98 + */ + +package com.sleepycat.db; + +/* + * Models the DB DB_BTREE_STAT struct. + */ +public class DbBtreeStat +{ + // methods + // + + protected native void finalize() + throws Throwable; + + // Open flags. + public native /*unsigned*/ long get_bt_flags(); + + // Maxkey value. + public native /*unsigned*/ long get_bt_maxkey(); + + // Minkey value. + public native /*unsigned*/ long get_bt_minkey(); + + // Fixed-length record length. + public native /*unsigned*/ long get_bt_re_len(); + + // Fixed-length record pad. + public native /*unsigned*/ long get_bt_re_pad(); + + // Page size. + public native /*unsigned*/ long get_bt_pagesize(); + + // Tree levels. + public native /*unsigned*/ long get_bt_levels(); + + // Number of records. + public native /*unsigned*/ long get_bt_nrecs(); + + // Internal pages. + public native /*unsigned*/ long get_bt_int_pg(); + + // Leaf pages. + public native /*unsigned*/ long get_bt_leaf_pg(); + + // Duplicate pages. + public native /*unsigned*/ long get_bt_dup_pg(); + + // Overflow pages. + public native /*unsigned*/ long get_bt_over_pg(); + + // Pages on the free list. + public native /*unsigned*/ long get_bt_free(); + + // Pages freed for reuse. + public native /*unsigned*/ long get_bt_freed(); + + // Bytes free in internal pages. + public native /*unsigned*/ long get_bt_int_pgfree(); + + // Bytes free in leaf pages. + public native /*unsigned*/ long get_bt_leaf_pgfree(); + + // Bytes free in duplicate pages. + public native /*unsigned*/ long get_bt_dup_pgfree(); + + // Bytes free in overflow pages. + public native /*unsigned*/ long get_bt_over_pgfree(); + + // Bytes saved by prefix compression. + public native /*unsigned*/ long get_bt_pfxsaved(); + + // Total number of splits. + public native /*unsigned*/ long get_bt_split(); + + // Root page splits. + public native /*unsigned*/ long get_bt_rootsplit(); + + // Fast splits. + public native /*unsigned*/ long get_bt_fastsplit(); + + // Items added. + public native /*unsigned*/ long get_bt_added(); + + // Items deleted. + public native /*unsigned*/ long get_bt_deleted(); + + // Items retrieved. + public native /*unsigned*/ long get_bt_get(); + + // Hits in fast-insert code. + public native /*unsigned*/ long get_bt_cache_hit(); + + // Misses in fast-insert code. + public native /*unsigned*/ long get_bt_cache_miss(); + + // Magic number. + public native /*unsigned*/ long get_bt_magic(); + + // Version number. + public native /*unsigned*/ long get_bt_version(); + + + // private data + // + private long private_info_ = 0; + + static { + Db.load_db(); + } +} + +// end of DbBtreeStat.java diff --git a/mozilla/db/java/src/com/sleepycat/db/DbConstants.java b/mozilla/db/java/src/com/sleepycat/db/DbConstants.java new file mode 100644 index 00000000000..2262a1dd5b3 --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/db/DbConstants.java @@ -0,0 +1,165 @@ +// DO NOT EDIT: automatically built by dist/distrib. + +package com.sleepycat.db; + +public class DbConstants +{ + public static final int DB_VERSION_MAJOR = 2; + public static final int DB_VERSION_MINOR = 4; + public static final int DB_VERSION_PATCH = 14; + public static final int DB_MAX_PAGES = 0xffffffff; + public static final int DB_MAX_RECORDS = 0xffffffff; + public static final int DB_FILE_ID_LEN = 20; + public static final int DB_DBT_INTERNAL = 0x01; + public static final int DB_DBT_MALLOC = 0x02; + public static final int DB_DBT_PARTIAL = 0x04; + public static final int DB_DBT_USERMEM = 0x08; + public static final int DB_FUNC_CALLOC = 1; + public static final int DB_FUNC_CLOSE = 2; + public static final int DB_FUNC_DIRFREE = 3; + public static final int DB_FUNC_DIRLIST = 4; + public static final int DB_FUNC_EXISTS = 5; + public static final int DB_FUNC_FREE = 6; + public static final int DB_FUNC_FSYNC = 7; + public static final int DB_FUNC_IOINFO = 8; + public static final int DB_FUNC_MALLOC = 9; + public static final int DB_FUNC_MAP = 10; + public static final int DB_FUNC_OPEN = 11; + public static final int DB_FUNC_READ = 12; + public static final int DB_FUNC_REALLOC = 13; + public static final int DB_FUNC_SEEK = 14; + public static final int DB_FUNC_SLEEP = 15; + public static final int DB_FUNC_STRDUP = 16; + public static final int DB_FUNC_UNLINK = 17; + public static final int DB_FUNC_UNMAP = 18; + public static final int DB_FUNC_WRITE = 19; + public static final int DB_FUNC_YIELD = 20; + public static final int DB_TSL_SPINS = 21; + public static final int DB_FUNC_RUNLINK = 22; + public static final int DB_REGION_ANON = 23; + public static final int DB_REGION_INIT = 24; + public static final int DB_REGION_NAME = 25; + public static final int DB_MUTEXLOCKS = 26; + public static final int DB_PAGEYIELD = 27; + public static final int DB_CREATE = 0x000001; + public static final int DB_NOMMAP = 0x000002; + public static final int DB_THREAD = 0x000004; + public static final int DB_INIT_LOCK = 0x000008; + public static final int DB_INIT_LOG = 0x000010; + public static final int DB_INIT_MPOOL = 0x000020; + public static final int DB_INIT_TXN = 0x000040; + public static final int DB_MPOOL_PRIVATE = 0x000080; + public static final int DB_RECOVER = 0x000200; + public static final int DB_RECOVER_FATAL = 0x000400; + public static final int DB_TXN_NOSYNC = 0x000800; + public static final int DB_USE_ENVIRON = 0x001000; + public static final int DB_USE_ENVIRON_ROOT = 0x002000; + public static final int DB_TXN_LOCK_2PL = 0x000000; + public static final int DB_TXN_LOCK_OPTIMIST = 0x000000; + public static final int DB_TXN_LOCK_MASK = 0x000000; + public static final int DB_TXN_LOG_REDO = 0x000000; + public static final int DB_TXN_LOG_UNDO = 0x000000; + public static final int DB_TXN_LOG_UNDOREDO = 0x000000; + public static final int DB_TXN_LOG_MASK = 0x000000; + public static final int DB_EXCL = 0x008000; + public static final int DB_RDONLY = 0x010000; + public static final int DB_SEQUENTIAL = 0x020000; + public static final int DB_TEMPORARY = 0x040000; + public static final int DB_TRUNCATE = 0x080000; + public static final int DB_LOCK_NORUN = 0x0; + public static final int DB_LOCK_DEFAULT = 0x1; + public static final int DB_LOCK_OLDEST = 0x2; + public static final int DB_LOCK_RANDOM = 0x3; + public static final int DB_LOCK_YOUNGEST = 0x4; + public static final int DB_ENV_APPINIT = 0x01; + public static final int DB_ENV_STANDALONE = 0x02; + public static final int DB_ENV_THREAD = 0x04; + public static final int DB_BTREEVERSION = 6; + public static final int DB_BTREEOLDVER = 6; + public static final int DB_BTREEMAGIC = 0x053162; + public static final int DB_HASHVERSION = 5; + public static final int DB_HASHOLDVER = 4; + public static final int DB_HASHMAGIC = 0x061561; + public static final int DB_LOGVERSION = 2; + public static final int DB_LOGOLDVER = 2; + public static final int DB_LOGMAGIC = 0x040988; + public static final int DB_DELIMITER = 0x0001; + public static final int DB_DUP = 0x0002; + public static final int DB_FIXEDLEN = 0x0004; + public static final int DB_PAD = 0x0008; + public static final int DB_RECNUM = 0x0010; + public static final int DB_RENUMBER = 0x0020; + public static final int DB_SNAPSHOT = 0x0040; + public static final int DB_AFTER = 0x000001; + public static final int DB_APPEND = 0x000002; + public static final int DB_BEFORE = 0x000004; + public static final int DB_CHECKPOINT = 0x000008; + public static final int DB_CURRENT = 0x000010; + public static final int DB_FIRST = 0x000020; + public static final int DB_FLUSH = 0x000040; + public static final int DB_GET_RECNO = 0x000080; + public static final int DB_KEYFIRST = 0x000100; + public static final int DB_KEYLAST = 0x000200; + public static final int DB_LAST = 0x000400; + public static final int DB_NEXT = 0x000800; + public static final int DB_NOOVERWRITE = 0x001000; + public static final int DB_NOSYNC = 0x002000; + public static final int DB_PREV = 0x004000; + public static final int DB_RECORDCOUNT = 0x008000; + public static final int DB_SET = 0x010000; + public static final int DB_SET_RANGE = 0x020000; + public static final int DB_SET_RECNO = 0x040000; + public static final int DB_CURLSN = 0x080000; + public static final int DB_INCOMPLETE = -1; + public static final int DB_KEYEMPTY = -2; + public static final int DB_KEYEXIST = -3; + public static final int DB_LOCK_DEADLOCK = -4; + public static final int DB_LOCK_NOTGRANTED = -5; + public static final int DB_LOCK_NOTHELD = -6; + public static final int DB_NOTFOUND = -7; + public static final int DB_DELETED = -8; + public static final int DB_NEEDSPLIT = -9; + public static final int DB_REGISTERED = -10; + public static final int DB_SWAPBYTES = -11; + public static final int DB_TXN_CKP = -12; + public static final int DB_AM_DUP = 0x000001; + public static final int DB_AM_INMEM = 0x000002; + public static final int DB_AM_LOCKING = 0x000004; + public static final int DB_AM_LOGGING = 0x000008; + public static final int DB_AM_MLOCAL = 0x000010; + public static final int DB_AM_PGDEF = 0x000020; + public static final int DB_AM_RDONLY = 0x000040; + public static final int DB_AM_RECOVER = 0x000080; + public static final int DB_AM_SWAP = 0x000100; + public static final int DB_AM_THREAD = 0x000200; + public static final int DB_BT_RECNUM = 0x000400; + public static final int DB_HS_DIRTYMETA = 0x000800; + public static final int DB_RE_DELIMITER = 0x001000; + public static final int DB_RE_FIXEDLEN = 0x002000; + public static final int DB_RE_PAD = 0x004000; + public static final int DB_RE_RENUMBER = 0x008000; + public static final int DB_RE_SNAPSHOT = 0x010000; + public static final int DB_LOCKVERSION = 1; + public static final int DB_LOCKMAGIC = 0x090193; + public static final int DB_LOCK_NOWAIT = 0x01; + public static final int DB_LOCK_CONFLICT = 0x01; + public static final int DB_LOCK_RW_N = 3; + public static final int DB_LOCK_RIW_N = 6; + public static final int DB_ARCH_ABS = 0x001; + public static final int DB_ARCH_DATA = 0x002; + public static final int DB_ARCH_LOG = 0x004; + public static final int DB_MPOOL_CREATE = 0x001; + public static final int DB_MPOOL_LAST = 0x002; + public static final int DB_MPOOL_NEW = 0x004; + public static final int DB_MPOOL_CLEAN = 0x001; + public static final int DB_MPOOL_DIRTY = 0x002; + public static final int DB_MPOOL_DISCARD = 0x004; + public static final int DB_TXNVERSION = 1; + public static final int DB_TXNMAGIC = 0x041593; + public static final int DB_TXN_BACKWARD_ROLL = 1; + public static final int DB_TXN_FORWARD_ROLL = 2; + public static final int DB_TXN_OPENFILES = 3; + public static final int DB_TXN_REDO = 4; + public static final int DB_TXN_UNDO = 5; + public static final int DB_DBM_HSEARCH = 0; +} diff --git a/mozilla/db/java/src/com/sleepycat/db/DbEnv.java b/mozilla/db/java/src/com/sleepycat/db/DbEnv.java new file mode 100644 index 00000000000..9cf3e082ff2 --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/db/DbEnv.java @@ -0,0 +1,240 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)DbEnv.java 10.3 (Sleepycat) 4/10/98 + */ + +package com.sleepycat.db; + +import java.io.OutputStream; + +/** + * + * @author Donald D. Anderson + */ +public class DbEnv +{ + // methods + // + + // This constructor can be used to immediately initialize the + // application with these arguments. Do not use it if you + // need to set other parameters via the access methods. + // + public DbEnv(String homeDir, String[] db_config, int flags) + throws DbException + { + init(); + appinit(homeDir, db_config, flags); + } + + // Use this constructor if you wish to *delay* the initialization + // of the db library. This is useful if you need to set + // any particular parameters via the access methods below. + // Then call appinit() to complete the initialization. + // + public DbEnv() + { + init(); + } + + // Used in conjunction with the default constructor to + // complete the initialization of the db library. + // + public native void appinit(String homeDir, String[] db_config, int flags) + throws DbException; + + // Can be called at any time to shut down Db. + // Called automatically when DbEnv is GC-ed, + // but don't rely on GC unless you turn on + // System.runFinalizersOnExit()! + // + public native void appexit() + throws DbException; + + protected native void finalize() + throws Throwable; + + //////////////////////////////////////////////////////////////// + // simple get/set access methods + // + // If you are calling set_ methods, you need to + // use the default constructor along with appinit(). + + // Byte order. + public native int get_lorder(); + public native void set_lorder(int lorder); + + // Error message callback. + public native DbErrcall get_errcall(); + public native void set_errcall(DbErrcall errcall); + + // Error message file stream. + // Note: there is no access to the underlying "errfile" field, since + // it is a C FILE* that makes little sense in the Java world. + // Consider using set_errcall() instead. + + // Error message prefix. + public native String get_errpfx(); + public native void set_errpfx(String errpfx); + + // Generate debugging messages. + public native int get_verbose(); + public native void set_verbose(int verbose); + + //////////////////////////////////////////////////////////////// + // User paths. + + // Database home. + public native String get_home(); + public native void set_home(String home); + + // Database log file directory. + public native String get_log_dir(); + public native void set_log_dir(String log_dir); + + // Database tmp file directory. + public native String get_tmp_dir(); + public native void set_tmp_dir(String tmp_dir); + + // Database data file slots. + public native int get_data_cnt(); + public native void set_data_cnt(int data_cnt); + + // Next Database data file slot. + public native int get_data_next(); + public native void set_data_next(int data_next); + + + //////////////////////////////////////////////////////////////// + // Locking. + + // Return from lock_open(). + public DbLockTab get_lk_info() + { + return lk_info_; + } + + // Two dimensional conflict matrix. + // Note: get_lk_conflicts() gets a copy of the the underlying array + // and set_lk_conflicts() sets the underlying array to a copy. + // You should call set_lk_modes() when calling set_lk_conflicts(). + // + public native byte[][] get_lk_conflicts(); + public native void set_lk_conflicts(byte[][] lk_conflicts); + + // Number of lock modes in table. + public native int get_lk_modes(); + public native void set_lk_modes(int lk_modes); + + // Maximum number of locks. + public native /*unsigned*/ int get_lk_max(); + public native void set_lk_max(/*unsigned*/ int lk_max); + + // Deadlock detect on every conflict. + public native /*u_int32_t*/ int get_lk_detect(); + public native void set_lk_detect(/*u_int32_t*/ int lk_detect); + + // Note: this callback is not implemented + // Yield function for threads. + // public native DbYield get_yield(); + // public native void set_yield(DbYield db_yield); + + //////////////////////////////////////////////////////////////// + // Logging. + + // Return from log_open(). + public DbLog get_lg_info() + { + return lg_info_; + } + + // Maximum file size. + public native /*u_int32_t*/ int get_lg_max(); + public native void set_lg_max(/*u_int32_t*/ int lg_max); + + + //////////////////////////////////////////////////////////////// + // Memory pool. + + // Return from memp_open(). + public DbMpool get_mp_info() + { + return mp_info_; + } + + // Maximum file size for mmap. + public native /*size_t*/ long get_mp_mmapsize(); + public native void set_mp_mmapsize(/*size_t*/ long mmapsize); + + // Bytes in the mpool cache. + public native /*size_t*/ long get_mp_size(); + public native void set_mp_size(/*size_t*/ long mp_size); + + + //////////////////////////////////////////////////////////////// + // Transactions. + + // Return from txn_open(). + public DbTxnMgr get_tx_info() + { + return tx_info_; + } + + // Maximum number of transactions. + public native /*unsigned*/ int get_tx_max(); + public native void set_tx_max(/*unsigned*/ int tx_max); + + // Note: this callback is not implemented + // Dispatch function for recovery. + // public native DbRecover get_tx_recover(); + // public native void set_tx_recover(DbRecover tx_recover); + + // Flags. + public native /*u_int32_t*/ int get_flags(); + public native void set_flags(/*u_int32_t*/ int flags); + + public native static int get_version_major(); + public native static int get_version_minor(); + public native static int get_version_patch(); + public native static String get_version_string(); + + public static String get_java_version_string() + { + return java_version_string_; + } + + public void set_error_stream(OutputStream s) + { + DbOutputStreamErrcall errcall = new DbOutputStreamErrcall(s); + set_errcall(errcall); + } + + // get/set methods + // + + // private methods + // + + // private data + // + private long private_info_ = 0; + private DbLockTab lk_info_ = null; + private DbLog lg_info_ = null; + private DbMpool mp_info_ = null; + private DbTxnMgr tx_info_ = null; + + private final static String java_version_string_ = + "Sleepycat Software: Db.Java 1.1.0: (9/24/97)"; + + private native void init(); + + static { + Db.load_db(); + } +} + +// end of DbEnv.java diff --git a/mozilla/db/java/src/com/sleepycat/db/DbErrcall.java b/mozilla/db/java/src/com/sleepycat/db/DbErrcall.java new file mode 100644 index 00000000000..bdad0acd508 --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/db/DbErrcall.java @@ -0,0 +1,23 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)DbErrcall.java 10.2 (Sleepycat) 4/10/98 + */ + +package com.sleepycat.db; + +/** + * + * @author Donald D. Anderson + */ +public interface DbErrcall +{ + // methods + // + public abstract void errcall(String prefix, String buffer); +} + +// end of DbErrcall.java diff --git a/mozilla/db/java/src/com/sleepycat/db/DbException.java b/mozilla/db/java/src/com/sleepycat/db/DbException.java new file mode 100644 index 00000000000..7704562fd26 --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/db/DbException.java @@ -0,0 +1,46 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)DbException.java 10.2 (Sleepycat) 4/10/98 + */ + +package com.sleepycat.db; + +/** + * + * @author Donald D. Anderson + */ +public class DbException extends Exception +{ + // methods + // + + public DbException(String s) + { + super(s); + } + + public DbException(String s, int errno) + { + super(s); + this.errno_ = errno; + } + + // get/set methods + // + + public int get_errno() + { + return errno_; + } + + // private data + // + + private int errno_; +} + +// end of DbException.java diff --git a/mozilla/db/java/src/com/sleepycat/db/DbInfo.java b/mozilla/db/java/src/com/sleepycat/db/DbInfo.java new file mode 100644 index 00000000000..af862167b16 --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/db/DbInfo.java @@ -0,0 +1,123 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)DbInfo.java 10.3 (Sleepycat) 4/10/98 + */ + +package com.sleepycat.db; + +/** + * + * @author Donald D. Anderson + */ +public class DbInfo +{ + // methods + // + public DbInfo() + { + init_from(null); + } + + public DbInfo(DbInfo that) + { + init_from(that); + } + + private native void init_from(DbInfo that); + + protected native void finalize() + throws Throwable; + + // get/set methods + // + + // Byte order. + public native int get_lorder(); + public native void set_lorder(int lorder); + + // Underlying cache size. + public native /*size_t*/ long get_cachesize(); + public native void set_cachesize(/*size_t*/ long cachesize); + + // Underlying page size. + public native /*size_t*/ long get_pagesize(); + public native void set_pagesize(/*size_t*/ long pagesize); + + // Local heap allocation. + // Note: there is no access to the underlying "malloc" field, since + // it is a C function that makes little sense in the Java world. + + //////////////////////////////////////////////////////////////// + // Btree access method. + + // Maximum keys per page. + public native int get_bt_maxkey(); + public native void set_bt_maxkey(int bt_maxkey); + + // Minimum keys per page. + public native int get_bt_minkey(); + public native void set_bt_minkey(int bt_minkey); + + // Note: this callback is not implemented + // Comparison function. + // public native DbCompare get_bt_compare(); + // public native void set_bt_compare(DbCompare bt_compare); + + // Note: this callback is not implemented + // Prefix function. + // public native DbPrefix get_bt_prefix(); + // public native void set_bt_prefix(DbPrefix bt_prefix); + + //////////////////////////////////////////////////////////////// + // Hash access method. + + // Fill factor. + public native /*unsigned*/ int get_h_ffactor(); + public native void set_h_ffactor(/*unsigned*/ int h_ffactor); + + // Number of elements. + public native /*unsigned*/ int get_h_nelem(); + public native void set_h_nelem(/*unsigned*/ int h_nelem); + + // Note: this callback is not implemented + // Hash function. + // public native DbHash get_h_hash(); + // public native void set_h_hash(DbHash h_hash); + + //////////////////////////////////////////////////////////////// + // Recno access method. + + // Fixed-length padding byte. + public native int get_re_pad(); + public native void set_re_pad(int re_pad); + + // Variable-length delimiting byte. + public native int get_re_delim(); + public native void set_re_delim(int re_delim); + + // Length for fixed-length records. + public native /*u_int32_t*/ int get_re_len(); + public native void set_re_len(/*u_int32_t*/ int re_len); + + // Source file name. + public native String get_re_source(); + public native void set_re_source(String re_source); + + // Flags. + public native /*u_int32_t*/ int get_flags(); + public native void set_flags(/*u_int32_t*/ int flags); + + // private data + // + private long private_info_ = 0; + + static { + Db.load_db(); + } +} + +// end of DbInfo.java diff --git a/mozilla/db/java/src/com/sleepycat/db/DbLock.java b/mozilla/db/java/src/com/sleepycat/db/DbLock.java new file mode 100644 index 00000000000..3aa0dff931b --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/db/DbLock.java @@ -0,0 +1,57 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)DbLock.java 10.2 (Sleepycat) 4/10/98 + */ + +package com.sleepycat.db; + +/** + * + * @author Donald D. Anderson + */ +public class DbLock +{ + // NOTE: the type used here is int, the type in DB is unsigned int. + + protected native void finalize() + throws Throwable; + + // methods + // + public DbLock(int lockid) + throws DbException + { + set_lock_id(lockid); + } + + public DbLock() + throws DbException + { + set_lock_id(0); + } + + public native void put(DbLockTab locktab) + throws DbException; + + // get/set methods + // + public native int get_lock_id() + throws DbException; + + public native void set_lock_id(int lockid) + throws DbException; + + // private data + // + private long private_info_ = 0; + + static { + Db.load_db(); + } +} + +// end of DbLock.java diff --git a/mozilla/db/java/src/com/sleepycat/db/DbLockTab.java b/mozilla/db/java/src/com/sleepycat/db/DbLockTab.java new file mode 100644 index 00000000000..5f9e0a8f89d --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/db/DbLockTab.java @@ -0,0 +1,80 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)DbLockTab.java 10.4 (Sleepycat) 4/10/98 + */ + +package com.sleepycat.db; + +/** + * + * @author Donald D. Anderson + */ +public class DbLockTab +{ + // Note: See Db.java for flag values for any of these + // methods. + // + + // methods + // + public native void close() + throws DbException; + + public native void detect(int flags, int atype) + throws DbException; + + public native DbLock get(/*u_int32_t*/ int locker, + int flags, + Dbt obj, + /*db_lockmode_t*/ int lock_mode) + throws DbException; + + public native /*u_int32_t*/ int id() + throws DbException; + + // Note: this method is not yet implemented. + // We expect that users will not use DbLockTab directly, + // but only use indirectly it as a consequence + // of other Db activity. + +/* + public native void vec(u_int32_t locker, + int flags, + DB_LOCKREQ list[], + int nlist, + DB_LOCKREQ **elistp) + throws DbException; + */ + + + // Create or remove new locktab files + // + + public native static DbLockTab open(String dir, int flags, int mode, + DbEnv dbenv) + throws DbException; + + public native static void unlink(String dir, int force, DbEnv dbenv) + throws DbException; + + + protected native void finalize() + throws Throwable; + + // get/set methods + // + + // private data + // + private long private_info_ = 0; + + static { + Db.load_db(); + } +} + +// end of DbLockTab.java diff --git a/mozilla/db/java/src/com/sleepycat/db/DbLog.java b/mozilla/db/java/src/com/sleepycat/db/DbLog.java new file mode 100644 index 00000000000..a0e4d64ad4a --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/db/DbLog.java @@ -0,0 +1,76 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)DbLog.java 10.4 (Sleepycat) 5/2/98 + */ + +package com.sleepycat.db; + +/** + * + * @author Donald D. Anderson + */ +public class DbLog +{ + // methods + // + + public native String[] archive(int flags) + throws DbException; + + public native void close() + throws DbException; + + public native static int compare(DbLsn lsn0, DbLsn lsn1); + + public native String file(DbLsn lsn) + throws DbException; + + public native void flush(DbLsn lsn) + throws DbException; + + public native void get(DbLsn lsn, Dbt data, int flags) + throws DbException; + + public native void put(DbLsn lsn, Dbt data, int flags) + throws DbException; + + public native DbLogStat stat() + throws DbException; + + public native /*u_int32_t fidp*/ int db_register(Db dbp, String name, + int dbtype) + throws DbException; + + public native void db_unregister(/*u_int32_t*/ int fid) + throws DbException; + + // Create or remove new log files + // + + public native static DbLog open(String dir, int flags, int mode, + DbEnv dbenv) + throws DbException; + + public native static void unlink(String dir, int force, DbEnv dbenv) + throws DbException; + + protected native void finalize() + throws Throwable; + + // get/set methods + // + + // private data + // + private long private_info_ = 0; + + static { + Db.load_db(); + } +} + +// end of DbLog.java diff --git a/mozilla/db/java/src/com/sleepycat/db/DbLogStat.java b/mozilla/db/java/src/com/sleepycat/db/DbLogStat.java new file mode 100644 index 00000000000..fce19b6b7b9 --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/db/DbLogStat.java @@ -0,0 +1,79 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)DbLogStat.java 10.1 (Sleepycat) 5/2/98 + */ + +package com.sleepycat.db; + +/** + * + * Models the DB DB_LOG_STAT struct. + * @author Donald D. Anderson + */ +public class DbLogStat +{ + // methods + // + + protected native void finalize() + throws Throwable; + + // get/set methods + // + + // Log file magic number. + public native /*unsigned*/ int get_st_magic(); + + // Log file version number. + public native /*unsigned*/ int get_st_version(); + + // Log file mode. + public native int get_st_mode(); + + // Maximum log file size. + public native /*unsigned*/ int get_st_lg_max(); + + // Bytes to log. + public native /*unsigned*/ int get_st_w_bytes(); + + // Megabytes to log. + public native /*unsigned*/ int get_st_w_mbytes(); + + // Bytes to log since checkpoint. + public native /*unsigned*/ int get_st_wc_bytes(); + + // Megabytes to log since checkpoint. + public native /*unsigned*/ int get_st_wc_mbytes(); + + // Total syncs to the log. + public native /*unsigned*/ int get_st_wcount(); + + // Total writes to the log. + public native /*unsigned*/ int get_st_scount(); + + // Region lock granted after wait. + public native /*unsigned*/ int get_st_region_wait(); + + // Region lock granted without wait. + public native /*unsigned*/ int get_st_region_nowait(); + + // Current log file number. + public native /*unsigned*/ int get_st_cur_file(); + + // Current log file offset. + public native /*unsigned*/ int get_st_cur_offset(); + + // private data + // + private long private_info_ = 0; + + static { + Db.load_db(); + } +} + +// end of DbLogStat.java diff --git a/mozilla/db/java/src/com/sleepycat/db/DbLsn.java b/mozilla/db/java/src/com/sleepycat/db/DbLsn.java new file mode 100644 index 00000000000..6d565d775b5 --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/db/DbLsn.java @@ -0,0 +1,42 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)DbLsn.java 10.2 (Sleepycat) 4/10/98 + */ + +package com.sleepycat.db; + +/** + * + * @author Donald D. Anderson + */ +public class DbLsn +{ + // methods + // + DbLsn() + { + init_lsn(); + } + + protected native void finalize() + throws Throwable; + + private native void init_lsn(); + + // get/set methods + // + + // private data + // + private long private_info_ = 0; + + static { + Db.load_db(); + } +} + +// end of DbLsn.java diff --git a/mozilla/db/java/src/com/sleepycat/db/DbMpool.java b/mozilla/db/java/src/com/sleepycat/db/DbMpool.java new file mode 100644 index 00000000000..8a37046e341 --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/db/DbMpool.java @@ -0,0 +1,42 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)DbMpool.java 10.5 (Sleepycat) 5/5/98 + */ + +package com.sleepycat.db; + +/** + * + * @author Donald D. Anderson + */ +public class DbMpool +{ + public native DbMpoolStat stat() + throws DbException; + + public native DbMpoolFStat[] fstat() + throws DbException; + + public native int trickle(int pct) + throws DbException; + + protected native void finalize() + throws Throwable; + + // get/set methods + // + + // private data + // + private long private_info_ = 0; + + static { + Db.load_db(); + } +} + +// end of DbMpool.java diff --git a/mozilla/db/java/src/com/sleepycat/db/DbMpoolFStat.java b/mozilla/db/java/src/com/sleepycat/db/DbMpoolFStat.java new file mode 100644 index 00000000000..09b2351ce27 --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/db/DbMpoolFStat.java @@ -0,0 +1,60 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)DbMpoolFStat.java 10.2 (Sleepycat) 4/10/98 + */ + +package com.sleepycat.db; + +/** + * + * Models the DB DB_MPOOL_FSTAT struct. + * @author Donald D. Anderson + */ +public class DbMpoolFStat +{ + // methods + // + protected native void finalize() + throws Throwable; + + // get/set methods + // + + // File name. + public native String get_file_name(); + + // Page size. + public native /*size_t*/ long get_st_pagesize(); + + // Pages found in the cache. + public native /*unsigned*/ long get_st_cache_hit(); + + // Pages not found in the cache. + public native /*unsigned*/ long get_st_cache_miss(); + + // Pages from mapped files. + public native /*unsigned*/ long get_st_map(); + + // Pages created in the cache. + public native /*unsigned*/ long get_st_page_create(); + + // Pages read in. + public native /*unsigned*/ long get_st_page_in(); + + // Pages written out. + public native /*unsigned*/ long get_st_page_out(); + + // private data + // + private long private_info_ = 0; + + static { + Db.load_db(); + } +} + +// end of DbMpoolFStat.java diff --git a/mozilla/db/java/src/com/sleepycat/db/DbMpoolStat.java b/mozilla/db/java/src/com/sleepycat/db/DbMpoolStat.java new file mode 100644 index 00000000000..82d3d127158 --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/db/DbMpoolStat.java @@ -0,0 +1,76 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)DbMpoolStat.java 10.2 (Sleepycat) 4/10/98 + */ + +package com.sleepycat.db; + +/** + * + * Models the DB DB_MPOOL_STAT struct. + * @author Donald D. Anderson + */ +public class DbMpoolStat +{ + // methods + // + + protected native void finalize() + throws Throwable; + + // get/set methods + // + + // Cache size. + public native /*size_t*/ long get_st_cachesize(); + + // Pages found in the cache. + public native /*unsigned*/ long get_st_cache_hit(); + + // Pages not found in the cache. + public native /*unsigned*/ long get_st_cache_miss(); + + // Pages from mapped files. + public native /*unsigned*/ long get_st_map(); + + // Pages created in the cache. + public native /*unsigned*/ long get_st_page_create(); + + // Pages read in. + public native /*unsigned*/ long get_st_page_in(); + + // Pages written out. + public native /*unsigned*/ long get_st_page_out(); + + // Read-only pages evicted. + public native /*unsigned*/ long get_st_ro_evict(); + + // Read-write pages evicted. + public native /*unsigned*/ long get_st_rw_evict(); + + // Number of hash buckets. + public native /*unsigned*/ long get_st_hash_buckets(); + + // Total hash chain searches. + public native /*unsigned*/ long get_st_hash_searches(); + + // Longest hash chain searched. + public native /*unsigned*/ long get_st_hash_longest(); + + // Total hash entries searched. + public native /*unsigned*/ long get_st_hash_examined(); + + // private data + // + private long private_info_ = 0; + + static { + Db.load_db(); + } +} + +// end of DbMpoolStat.java diff --git a/mozilla/db/java/src/com/sleepycat/db/DbOutputStreamErrcall.java b/mozilla/db/java/src/com/sleepycat/db/DbOutputStreamErrcall.java new file mode 100644 index 00000000000..f0525b3addd --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/db/DbOutputStreamErrcall.java @@ -0,0 +1,45 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)DbOutputStreamErrcall.java 10.2 (Sleepycat) 4/10/98 + */ + +package com.sleepycat.db; +import java.io.OutputStream; +import java.io.IOException; + +/** + * + * @author Donald D. Anderson + */ +public class DbOutputStreamErrcall implements DbErrcall +{ + DbOutputStreamErrcall(OutputStream stream) + { + this.stream_ = stream; + } + + // methods + // + public void errcall(String prefix, String buffer) + { + try { + stream_.write(prefix.getBytes()); + stream_.write((new String(": ")).getBytes()); + stream_.write(buffer.getBytes()); + stream_.write((new String("\n")).getBytes()); + } + catch (IOException e) { + // nothing much we can do. + } + } + + // private data + // + private OutputStream stream_; +} + +// end of DbOutputStreamErrcall.java diff --git a/mozilla/db/java/src/com/sleepycat/db/DbTxn.java b/mozilla/db/java/src/com/sleepycat/db/DbTxn.java new file mode 100644 index 00000000000..847f9b084fb --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/db/DbTxn.java @@ -0,0 +1,47 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)DbTxn.java 10.2 (Sleepycat) 4/10/98 + */ + +package com.sleepycat.db; + +/** + * + * @author Donald D. Anderson + */ +public class DbTxn +{ + // methods + // + public native void abort() + throws DbException; + + public native void commit() + throws DbException; + + public native /*u_int32_t*/ int id() + throws DbException; + + public native void prepare() + throws DbException; + + protected native void finalize() + throws Throwable; + + // get/set methods + // + + // private data + // + private long private_info_ = 0; + + static { + Db.load_db(); + } +} + +// end of DbTxn.java diff --git a/mozilla/db/java/src/com/sleepycat/db/DbTxnMgr.java b/mozilla/db/java/src/com/sleepycat/db/DbTxnMgr.java new file mode 100644 index 00000000000..c472bb3e924 --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/db/DbTxnMgr.java @@ -0,0 +1,56 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)DbTxnMgr.java 10.2 (Sleepycat) 4/10/98 + */ + +package com.sleepycat.db; + +/** + * + * @author Donald D. Anderson + */ +public class DbTxnMgr +{ + // methods + // + public native DbTxn begin(DbTxn pid) + throws DbException; + + public native void checkpoint(int kbyte, int min) + throws DbException; + + public native void close() + throws DbException; + + public native DbTxnStat stat() + throws DbException; + + // Create or remove new txnmgr files + // + public native static DbTxnMgr open(String dir, int flags, int mode, + DbEnv dbenv) + throws DbException; + + public native static void unlink(String dir, int force, DbEnv dbenv) + throws DbException; + + protected native void finalize() + throws Throwable; + + // get/set methods + // + + // private data + // + private long private_info_ = 0; + + static { + Db.load_db(); + } +} + +// end of DbTxnMgr.java diff --git a/mozilla/db/java/src/com/sleepycat/db/DbTxnStat.java b/mozilla/db/java/src/com/sleepycat/db/DbTxnStat.java new file mode 100644 index 00000000000..08cd75200f1 --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/db/DbTxnStat.java @@ -0,0 +1,60 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)DbTxnStat.java 10.2 (Sleepycat) 4/10/98 + */ + +package com.sleepycat.db; + +/** + * + * @author Donald D. Anderson + */ +public class DbTxnStat +{ + // methods + // + + protected native void finalize() + throws Throwable; + + // get/set methods + // + + // lsn of the last checkpoint + public native DbLsn get_last_ckp(); + + // last checkpoint did not finish + public native DbLsn get_pending_ckp(); + + // time of last checkpoint + public native /*time_t*/ int get_time_ckp(); + + // last transaction id given out + public native /*u_int32_t*/ int get_last_txnid(); + + // maximum number of active txns + public native /*u_int32_t*/ int get_maxtxns(); + + // number of aborted transactions + public native /*u_int32_t*/ int get_naborts(); + + // number of begun transactions + public native /*u_int32_t*/ int get_nbegins(); + + // number of committed transactions + public native /*u_int32_t*/ int get_ncommits(); + + // private data + // + private long private_info_ = 0; + + static { + Db.load_db(); + } +} + +// end of DbTxnStat.java diff --git a/mozilla/db/java/src/com/sleepycat/db/Dbc.java b/mozilla/db/java/src/com/sleepycat/db/Dbc.java new file mode 100644 index 00000000000..9e7689f9b90 --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/db/Dbc.java @@ -0,0 +1,48 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)Dbc.java 10.3 (Sleepycat) 4/10/98 + */ + +package com.sleepycat.db; + +/** + * + * @author Donald D. Anderson + */ +public class Dbc +{ + // methods + // + public native void close() + throws DbException; + + public native void del(int flags) + throws DbException; + + // returns: 0, DB_NOTFOUND, or throws error + public native int get(Dbt key, Dbt data, int flags) + throws DbException; + + public native void put(Dbt key, Dbt data, int flags) + throws DbException; + + protected native void finalize() + throws Throwable; + + // get/set methods + // + + // private data + // + private long private_info_ = 0; + + static { + Db.load_db(); + } +} + +// end of Dbc.java diff --git a/mozilla/db/java/src/com/sleepycat/db/Dbt.java b/mozilla/db/java/src/com/sleepycat/db/Dbt.java new file mode 100644 index 00000000000..f62c8210352 --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/db/Dbt.java @@ -0,0 +1,108 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)Dbt.java 10.3 (Sleepycat) 4/10/98 + */ + +package com.sleepycat.db; + +/** + * + * @author Donald D. Anderson + */ +public class Dbt +{ + // methods + // + + protected native void finalize() + throws Throwable; + + // get/set methods + // + + // key/data + + public void set_data(byte[] data) + { + // internal_set_data is separated from set_data in case + // we want to have set_data automatically set some other + // fields (size, etc.) someday. + // + internal_set_data(data); + } + + public native byte[] get_data(); + private native void internal_set_data(byte[] data); + + // These are not in the original DB interface, + // but they can be used to get/set the offset + // into the attached byte array. + // + public native void set_offset(int off); + public native int get_offset(); + + // key/data length + public native /*u_int32_t*/ int get_size(); + public native void set_size(/*u_int32_t*/ int size); + + // RO: length of user buffer. + public native /*u_int32_t*/ int get_ulen(); + public native void set_ulen(/*u_int32_t*/ int ulen); + + // RO: get/put record length. + public native /*u_int32_t*/ int get_dlen(); + public native void set_dlen(/*u_int32_t*/ int dlen); + + // RO: get/put record offset. + public native /*u_int32_t*/ int get_doff(); + public native void set_doff(/*u_int32_t*/ int doff); + + // flags + public native /*u_int32_t*/ int get_flags(); + public native void set_flags(/*u_int32_t*/ int flags); + + // These are not in the original DB interface. + // They can be used to set the recno key for a Dbt. + // Note: you must set the data field to an array of + // at least four bytes before calling either of these. + // + public native void set_recno_key_data(int recno); + public native int get_recno_key_data(); + + public Dbt(byte[] data) + { + init(); + set_data(data); + } + + public Dbt(byte[] data, int off, int len) + { + init(); + internal_set_data(data); + set_ulen(len); + set_offset(off); + } + + public Dbt() + { + init(); + } + + // private methods + // + private native void init(); + + // private data + // + private long private_info_ = 0; + + static { + Db.load_db(); + } +} + +// end of Dbt.java diff --git a/mozilla/db/java/src/com/sleepycat/examples/AccessExample.java b/mozilla/db/java/src/com/sleepycat/examples/AccessExample.java new file mode 100644 index 00000000000..847d31c6726 --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/examples/AccessExample.java @@ -0,0 +1,170 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)AccessExample.java 10.5 (Sleepycat) 4/10/98 + */ + +package com.sleepycat.examples; + +import com.sleepycat.db.*; +import java.io.InputStreamReader; +import java.io.PrintStream; +import java.io.IOException; + +class AccessExample extends DbEnv +{ + private static final String FileName = "access.db"; + + public AccessExample(String home) + throws DbException + { + super(home, null, 0); + + try { + set_error_stream(System.err); + set_errpfx("AccessExample"); + } + catch (Exception e) { + System.err.println(e.toString()); + System.exit(1); + } + } + + private static void usage() + { + System.err.println("usage: AccessExample [-h home]\n"); + System.exit(1); + } + + public static void main(String argv[]) + { + String home = null; + for (int i = 0; i < argv.length; ++i) + { + if (argv[i].equals("-h")) + { + home = argv[++i]; + } + else + { + usage(); + } + } + + try + { + AccessExample app = new AccessExample(home); + app.run(); + } + catch (DbException dbe) + { + System.err.println("AccessExample: " + dbe.toString()); + System.exit(1); + } + System.exit(0); + } + + // Prompts for a line, and keeps prompting until a non blank + // line is returned. Returns null on error. + // + static public String askForLine(InputStreamReader reader, + PrintStream out, String prompt) + { + String result = ""; + while (result != null && result.length() == 0) { + out.print(prompt); + out.flush(); + result = getLine(reader); + } + return result; + } + + // Not terribly efficient, but does the job. + // Works for reading a line from stdin or a file. + // Returns null on EOF. If EOF appears in the middle + // of a line, returns that line, then null on next call. + // + static public String getLine(InputStreamReader reader) + { + StringBuffer b = new StringBuffer(); + int c; + try { + while ((c = reader.read()) != -1 && c != '\n') { + if (c != '\r') + b.append((char)c); + } + } + catch (IOException ioe) { + c = -1; + } + + if (c == -1 && b.length() == 0) + return null; + else + return b.toString(); + } + + public void run() + throws DbException + { + Db table = Db.open(FileName, Db.DB_BTREE, Db.DB_CREATE, 0644, this, null); + + // + // Insert records into the database, where the key is the user + // input and the data is the user input in reverse order. + // + InputStreamReader reader = new InputStreamReader(System.in); + + for (;;) { + String line = askForLine(reader, System.out, "input> "); + if (line == null) + break; + + byte buf[] = line.getBytes(); + byte rbuf[] = (new StringBuffer(line)).reverse(). + toString().getBytes(); + + Dbt key = new Dbt(buf); + key.set_size(buf.length); + Dbt data = new Dbt(rbuf); + data.set_size(rbuf.length); + + try + { + int err; + if ((err = table.put(null, key, data, 0)) == Db.DB_KEYEXIST) { + System.out.println("Key " + buf + " already exists."); + } + } + catch (DbException dbe) + { + System.out.println(dbe.toString()); + } + System.out.println(""); + } + + // Acquire an iterator for the table. + Dbc iterator; + iterator = table.cursor(null); + + // Walk through the table, printing the key/data pairs. + // We use the DB_DBT_MALLOC flag to ask DB to allocate + // byte arrays for the results. + Dbt key = new Dbt(); + key.set_flags(Db.DB_DBT_MALLOC); + Dbt data = new Dbt(); + data.set_flags(Db.DB_DBT_MALLOC); + while (iterator.get(key, data, Db.DB_NEXT) == 0) + { + String key_string = new String(key.get_data(), 0, key.get_size()); + String data_string = + new String(data.get_data(), 0, data.get_size()); + System.out.println(key_string + " : " + data_string); + } + iterator.close(); + table.close(0); + } +} diff --git a/mozilla/db/java/src/com/sleepycat/examples/AppinitExample.java b/mozilla/db/java/src/com/sleepycat/examples/AppinitExample.java new file mode 100644 index 00000000000..68b92f6b466 --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/examples/AppinitExample.java @@ -0,0 +1,80 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)AppinitExample.java 10.3 (Sleepycat) 4/10/98 + */ + +package com.sleepycat.examples; + +import com.sleepycat.db.*; + +/* + * An example of a program using DbEnv to configure its DB + * environment. + * + * For comparison purposes, this example uses a similar structure + * as examples/ex_appinit.c and examples_cxx/AppinitExample.cpp. + */ +class AppinitExample +{ + private static final String progname = "AppinitExample"; + private static final String DATABASE_HOME = "/home/database"; + + private static DbEnv init() + throws DbException + { + DbEnv dbenv = new DbEnv(); + String config[] = new String[1]; + + // Output errors to the application's log. + // + dbenv.set_error_stream(System.err); + dbenv.set_errpfx(progname); + + // + // All of the shared database files live in /home/database, + // but data files live in /database. + // + // In C/C++ we need to allocate two elements in the array + // and set config[1] to NULL. This is not necessary in Java. + // + config[0] = "DB_DATA_DIR /database/files"; + + // + // We want to specify the shared memory buffer pool cachesize, + // but everything else is the default. + // + dbenv.set_mp_size(64 * 1024); + + // + // We have multiple processes reading/writing these files, so + // we need concurrency control and a shared buffer pool, but + // not logging or transactions. + // + // appinit() will throw on error. + // + dbenv.appinit(DATABASE_HOME, config, + Db.DB_CREATE | Db.DB_INIT_LOCK | Db.DB_INIT_MPOOL); + return dbenv; + } + + static public void main(String[] args) + { + System.out.println("beginning appinit"); + try { + DbEnv dbenv = init(); + + // ... your application here ... + + dbenv.appexit(); + } + catch (DbException dbe) { + System.err.println(progname + ": db_appinit: " + dbe.toString()); + System.exit (1); + } + System.out.println("completed appinit"); + } +} diff --git a/mozilla/db/java/src/com/sleepycat/examples/LockExample.java b/mozilla/db/java/src/com/sleepycat/examples/LockExample.java new file mode 100644 index 00000000000..dd3834ad528 --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/examples/LockExample.java @@ -0,0 +1,216 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)LockExample.java 10.3 (Sleepycat) 4/10/98 + */ + +package com.sleepycat.examples; + +import com.sleepycat.db.*; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.IOException; +import java.io.PrintStream; + +// +// An example of a program using DbLock and related classes. +// +class LockExample extends DbEnv +{ + private static final String progname = "LockExample"; + private static final String LOCK_HOME = "/var/tmp/lock"; + + public LockExample(String home) + throws DbException + { + super(home, null, Db.DB_CREATE|Db.DB_INIT_LOCK); + set_error_stream(System.err); + set_errpfx("LockExample"); + } + + // Prompts for a line, and keeps prompting until a non blank + // line is returned. Returns null on error. + // + static public String askForLine(InputStreamReader reader, + PrintStream out, String prompt) + { + String result = ""; + while (result != null && result.length() == 0) { + out.print(prompt); + out.flush(); + result = getLine(reader); + } + return result; + } + + // Not terribly efficient, but does the job. + // Works for reading a line from stdin or a file. + // Returns null on EOF. If EOF appears in the middle + // of a line, returns that line, then null on next call. + // + static public String getLine(InputStreamReader reader) + { + StringBuffer b = new StringBuffer(); + int c; + try { + while ((c = reader.read()) != -1 && c != '\n') { + if (c != '\r') + b.append((char)c); + } + } + catch (IOException ioe) { + c = -1; + } + + if (c == -1 && b.length() == 0) + return null; + else + return b.toString(); + } + + public void run() + throws DbException + { + long held; + int len = 0, locker; + int ret; + boolean did_get = false; + int lockid = 0; + InputStreamReader in = new InputStreamReader(System.in); + + DbLockTab lockTable = get_lk_info(); + if (lockTable == null) { + System.err.println("LockExample: lock table not initialized"); + return; + } + + // + // Accept lock requests. + // + locker = lockTable.id(); + for (held = 0;;) { + String opbuf = askForLine(in, System.out, + "Operation get/release [get]> "); + if (opbuf == null) + break; + + try { + if (opbuf.equals("get")) { + // Acquire a lock. + String objbuf = askForLine(in, System.out, + "input object (text string) to lock> "); + if (objbuf == null) + break; + + String lockbuf; + do { + lockbuf = askForLine(in, System.out, + "lock type read/write [read]> "); + if (lockbuf == null) + break; + len = lockbuf.length(); + } while (len >= 1 && + !lockbuf.equals("read") && + !lockbuf.equals("write")); + + int lock_type; + if (len <= 1 || lockbuf.equals("read")) + lock_type = Db.DB_LOCK_READ; + else + lock_type = Db.DB_LOCK_WRITE; + + Dbt dbt = new Dbt(objbuf.getBytes()); + + DbLock lock; + lock = lockTable.get(locker, Db.DB_LOCK_NOWAIT, + dbt, lock_type); + lockid = lock.get_lock_id(); + did_get = true; + } else { + // Release a lock. + String objbuf; + objbuf = askForLine(in, System.out, + "input lock to release> "); + if (objbuf == null) + break; + + lockid = Integer.parseInt(objbuf, 16); + DbLock lock = new DbLock(lockid); + lock.put(lockTable); + did_get = false; + } + // No errors. + System.out.println("Lock 0x" + + Long.toHexString(lockid) + " " + + (did_get ? "granted" : "released")); + held += did_get ? 1 : -1; + } + catch (DbException dbe) { + switch (dbe.get_errno()) { + case Db.DB_LOCK_NOTHELD: + System.out.println("You do not hold the lock " + + String.valueOf(lockid)); + break; + case Db.DB_LOCK_NOTGRANTED: + System.out.println("Lock not granted"); + break; + case Db.DB_LOCK_DEADLOCK: + System.err.println("LockExample: lock_" + + (did_get ? "get" : "put") + + ": returned DEADLOCK"); + break; + default: + System.err.println("LockExample: lock_get: " + dbe.toString()); + } + } + } + System.out.println(); + System.out.println("Closing lock region " + String.valueOf(held) + + " locks held"); + } + + private static void usage() + { + System.err.println("usage: LockExample [-u] [-h home]"); + System.exit(1); + } + + public static void main(String argv[]) + { + String home = LOCK_HOME; + boolean do_unlink = false; + + for (int i = 0; i < argv.length; ++i) { + if (argv[i].equals("-h")) { + home = argv[++i]; + } + else if (argv[i].equals("-u")) { + do_unlink = true; + } + else { + usage(); + } + } + + try { + if (do_unlink) { + LockExample temp = new LockExample(home); + DbLockTab.unlink(home, 1, temp); + } + + LockExample app = new LockExample(home); + app.run(); + app.appexit(); + } + catch (DbException dbe) { + System.err.println("AccessExample: " + dbe.toString()); + } + catch (Throwable t) { + System.err.println("AccessExample: " + t.toString()); + } + System.out.println("LockExample completed"); + } +} diff --git a/mozilla/db/java/src/com/sleepycat/examples/TpcbExample.java b/mozilla/db/java/src/com/sleepycat/examples/TpcbExample.java new file mode 100644 index 00000000000..59c4b21f698 --- /dev/null +++ b/mozilla/db/java/src/com/sleepycat/examples/TpcbExample.java @@ -0,0 +1,795 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)TpcbExample.java 10.4 (Sleepycat) 4/20/98 + */ + +package com.sleepycat.examples; + +import com.sleepycat.db.*; +import java.util.Calendar; +import java.util.Date; +import java.util.Random; +import java.util.GregorianCalendar; +import java.math.BigDecimal; + +// +// This program implements a basic TPC/B driver program. To create the +// TPC/B database, run with the -i (init) flag. The number of records +// with which to populate the account, history, branch, and teller tables +// is specified by the a, s, b, and t flags respectively. To run a TPC/B +// test, use the n flag to indicate a number of transactions to run (note +// that you can run many of these processes in parallel to simulate a +// multiuser test run). +// +class TpcbExample extends DbEnv +{ + // XXX Margo, check these ratios and record sizes. + // + public static final int TELLERS_PER_BRANCH = 100; + public static final int ACCOUNTS_PER_TELLER = 1000; + public static final int ACCOUNTS = 1000000; + public static final int BRANCHES = 10; + public static final int TELLERS = 1000; + public static final int HISTORY = 1000000; + public static final int HISTORY_LEN = 100; + public static final int RECLEN = 100; + public static final int BEGID = 1000000; + + // used by random_id() + public static final int ACCOUNT = 0; + public static final int BRANCH = 1; + public static final int TELLER = 2; + + private static boolean verbose = false; + private static final String progname = "TpcbExample"; // Program name. + + // Note: the constructor uses the default DbEnv() constructor, + // which means that appinit() can be called after all options + // have been set in the DbEnv. + // + public TpcbExample() + { + super(); + } + + // + // Initialize the database to the specified number of accounts, branches, + // history records, and tellers. + // + // Note: num_h was unused in the original ex_tpcb.c example. + // + public void + populate(int num_a, int num_b, int num_h, int num_t) + { + Db dbp = null; + + int err; + int balance, idnum; + int end_anum, end_bnum, end_tnum; + int start_anum, start_bnum, start_tnum; + + idnum = BEGID; + balance = 500000; + + DbInfo dbi = new DbInfo(); + + dbi.set_h_nelem((int)num_a); + + try { + dbp = Db.open("account", + Db.DB_HASH, Db.DB_CREATE | Db.DB_TRUNCATE, 0644, this, dbi); + } + catch (DbException dbe) { + errExit(dbe, "Open of account file failed"); + } + + start_anum = idnum; + populateTable(dbp, idnum, balance, dbi.get_h_nelem(), "account"); + idnum += dbi.get_h_nelem(); + end_anum = idnum - 1; + try { + dbp.close(0); + } + catch (DbException dbe2) { + errExit(dbe2, "Account file close failed"); + } + + if (verbose) + System.out.println("Populated accounts: " + + String.valueOf(start_anum) + " - " + String.valueOf(end_anum)); + + // + // Since the number of branches is very small, we want to use very + // small pages and only 1 key per page. This is the poor-man's way + // of getting key locking instead of page locking. + // + dbi.set_h_nelem((int)num_b); + dbi.set_h_ffactor(1); + dbi.set_pagesize(512); + + try { + dbp = Db.open("branch", + Db.DB_HASH, Db.DB_CREATE | Db.DB_TRUNCATE, 0644, + this, dbi); + } + catch (DbException dbe3) { + errExit(dbe3, "Branch file create failed"); + } + start_bnum = idnum; + populateTable(dbp, idnum, balance, dbi.get_h_nelem(), "branch"); + idnum += dbi.get_h_nelem(); + end_bnum = idnum - 1; + + try { + dbp.close(0); + } + catch (DbException dbe4) { + errExit(dbe4, "Close of branch file failed"); + } + + if (verbose) + System.out.println("Populated branches: " + + String.valueOf(start_bnum) + " - " + String.valueOf(end_bnum)); + + // + // In the case of tellers, we also want small pages, but we'll let + // the fill factor dynamically adjust itself. + // + dbi.set_h_nelem((int)num_t); + dbi.set_h_ffactor(0); + dbi.set_pagesize(512); + + try { + dbp = Db.open("teller", + Db.DB_HASH, Db.DB_CREATE | Db.DB_TRUNCATE, 0644, this, dbi); + } + catch (DbException dbe5) { + errExit(dbe5, "Teller file create failed"); + } + + start_tnum = idnum; + populateTable(dbp, idnum, balance, dbi.get_h_nelem(), "teller"); + idnum += dbi.get_h_nelem(); + end_tnum = idnum - 1; + + try { + dbp.close(0); + } + catch (DbException dbe6) { + errExit(dbe6, "Close of teller file failed"); + } + + if (verbose) + System.out.println("Populated tellers: " + + String.valueOf(start_tnum) + " - " + String.valueOf(end_tnum)); + + // start with a fresh DbInfo + // + DbInfo histDbi = new DbInfo(); + + histDbi.set_re_len(HISTORY_LEN); + histDbi.set_flags(Db.DB_FIXEDLEN | Db.DB_RENUMBER); + try { + dbp = Db.open("history", + Db.DB_RECNO, Db.DB_CREATE | Db.DB_TRUNCATE, 0644, + this, histDbi); + } + catch (DbException dbe7) { + errExit(dbe7, "Create of history file failed"); + } + + populateHistory(dbp, num_h, num_a, num_b, num_t); + + try { + dbp.close(0); + } + catch (DbException dbe8) { + errExit(dbe8, "Close of history file failed"); + } + } + + public void + populateTable(Db dbp, + int start_id, int balance, + int nrecs, String msg) + { + Defrec drec = new Defrec(); + + Dbt kdbt = new Dbt(drec.data); + kdbt.set_size(4); // sizeof(int) + Dbt ddbt = new Dbt(drec.data); + ddbt.set_size(drec.data.length); // uses whole array + + try { + for (int i = 0; i < nrecs; i++) { + kdbt.set_recno_key_data(start_id + (int)i); + drec.set_balance(balance); + dbp.put(null, kdbt, ddbt, Db.DB_NOOVERWRITE); + } + } + catch (DbException dbe) { + System.err.println("Failure initializing " + msg + " file: " + + dbe.toString()); + System.exit(1); + } + } + + public void + populateHistory(Db dbp, int nrecs, + int anum, int bnum, int tnum) + { + Histrec hrec = new Histrec(); + hrec.set_amount(10); + + byte arr[] = new byte[4]; // sizeof(int) + int i; + Dbt kdbt = new Dbt(arr); + kdbt.set_size(arr.length); + Dbt ddbt = new Dbt(hrec.data); + ddbt.set_size(hrec.data.length); + + try { + for (i = 1; i <= nrecs; i++) { + kdbt.set_recno_key_data(i); + + hrec.set_aid(random_id(ACCOUNT, anum, bnum, tnum)); + hrec.set_bid(random_id(BRANCH, anum, bnum, tnum)); + hrec.set_tid(random_id(TELLER, anum, bnum, tnum)); + + dbp.put(null, kdbt, ddbt, Db.DB_NOOVERWRITE); + } + } + catch (DbException dbe) { + errExit(dbe, "Failure initializing history file"); + } + } + + static Random rand = new Random(); + + public static int + random_int(int lo, int hi) + { + int ret; + int t; + + t = rand.nextInt(); + if (t < 0) + t = -t; + ret = (int)(((double)t / ((double)(Integer.MAX_VALUE) + 1)) * + (hi - lo + 1)); + ret += lo; + return (ret); + } + + public static int + random_id(int type, int accounts, int branches, int tellers) + { + int min, max, num; + + max = min = BEGID; + num = accounts; + switch(type) { + case TELLER: + min += branches; + num = tellers; + // Fallthrough + case BRANCH: + if (type == BRANCH) + num = branches; + min += accounts; + // Fallthrough + case ACCOUNT: + max = min + num - 1; + } + return (random_int(min, max)); + } + + public void + run(int n, int accounts, int branches, int tellers) + { + Db adb = null; + Db bdb = null; + Db hdb = null; + Db tdb = null; + double gtps, itps; + int failed, ifailed, ret, txns; + long gus, ius; + long starttime, curtime, lasttime; + + // + // Open the database files. + // + int err; + try { + adb = Db.open("account", Db.DB_UNKNOWN, 0, 0, this, null); + bdb = Db.open("branch", Db.DB_UNKNOWN, 0, 0, this, null); + tdb = Db.open("teller", Db.DB_UNKNOWN, 0, 0, this, null); + hdb = Db.open("history", Db.DB_UNKNOWN, 0, 0, this, null); + } + catch (DbException dbe) { + errExit(dbe, "Open of db files failed"); + } + + txns = failed = ifailed = 0; + starttime = (new Date()).getTime(); + lasttime = starttime; + while (n-- >= 0) { + txns++; + DbTxnMgr txnmgr = get_tx_info(); + ret = txn(txnmgr, adb, bdb, tdb, hdb, accounts, branches, tellers); + if (ret != 0) { + failed++; + ifailed++; + } + if (n % 1000 == 0) { + curtime = (new Date()).getTime(); + gus = (curtime - starttime) * 1000; + ius = (curtime - lasttime) * 1000; + gtps = (double)(txns - failed) / + ((double)gus / 1000000); + itps = (double)(1000 - ifailed) / + ((double)ius / 1000000); + System.out.print(String.valueOf(txns) + " txns " + + String.valueOf(failed) + " failed "); + System.out.println(showRounded(gtps, 2) + " TPS (gross) " + + showRounded(itps, 2) + " TPS (interval)"); + lasttime = curtime; + ifailed = 0; + } + } + + try { + adb.close(0); + bdb.close(0); + tdb.close(0); + hdb.close(0); + } + catch (DbException dbe2) { + errExit(dbe2, "Close of db files failed"); + } + + System.out.println((long)txns + " transactions begun " + + String.valueOf(failed) + " failed"); + + } + + // + // XXX Figure out the appropriate way to pick out IDs. + // + public int + txn(DbTxnMgr txmgr, + Db adb, Db bdb, Db tdb, Db hdb, + int anum, int bnum, int tnum) + { + Dbc acurs = null; + Dbc bcurs = null; + Dbc hcurs = null; + Dbc tcurs = null; + DbTxn t = null; + + Defrec rec = new Defrec(); + Histrec hrec = new Histrec(); + int account, branch, teller; + + Dbt d_dbt = new Dbt(); + Dbt d_histdbt = new Dbt(); + Dbt k_dbt = new Dbt(); + Dbt k_histdbt = new Dbt(); + + account = random_id(ACCOUNT, anum, bnum, tnum); + branch = random_id(BRANCH, anum, bnum, tnum); + teller = random_id(TELLER, anum, bnum, tnum); + + // The history key will not actually be retrieved, + // but it does need to be set to something. + byte hist_key[] = new byte[4]; + k_histdbt.set_data(hist_key); + k_histdbt.set_size(4 /* == sizeof(int)*/); + + byte key_bytes[] = new byte[4]; + k_dbt.set_data(key_bytes); + k_dbt.set_size(4 /* == sizeof(int)*/); + + d_dbt.set_flags(Db.DB_DBT_USERMEM); + d_dbt.set_data(rec.data); + d_dbt.set_ulen(rec.length()); + + hrec.set_aid(account); + hrec.set_bid(branch); + hrec.set_tid(teller); + hrec.set_amount(10); + // Request 0 bytes since we're just positioning. + d_histdbt.set_flags(Db.DB_DBT_PARTIAL); + + // START TIMING + + try { + t = txmgr.begin(null); + + acurs = adb.cursor(t); + bcurs = bdb.cursor(t); + tcurs = tdb.cursor(t); + hcurs = hdb.cursor(t); + + // Account record + k_dbt.set_recno_key_data(account); + if (acurs.get(k_dbt, d_dbt, Db.DB_SET) != 0) + throw new TpcbException("acurs get failed"); + rec.set_balance(rec.get_balance() + 10); + acurs.put(k_dbt, d_dbt, Db.DB_CURRENT); + + // Branch record + k_dbt.set_recno_key_data(branch); + if (bcurs.get(k_dbt, d_dbt, Db.DB_SET) != 0) + throw new TpcbException("bcurs get failed"); + rec.set_balance(rec.get_balance() + 10); + bcurs.put(k_dbt, d_dbt, Db.DB_CURRENT); + + // Teller record + k_dbt.set_recno_key_data(teller); + if (tcurs.get(k_dbt, d_dbt, Db.DB_SET) != 0) + throw new TpcbException("ccurs get failed"); + rec.set_balance(rec.get_balance() + 10); + tcurs.put(k_dbt, d_dbt, Db.DB_CURRENT); + + // History record + d_histdbt.set_flags(0); + d_histdbt.set_data(hrec.data); + d_histdbt.set_ulen(hrec.length()); + if (hdb.put(t, k_histdbt, d_histdbt, Db.DB_APPEND) != 0) + throw(new DbException("put failed")); + + acurs.close(); + bcurs.close(); + tcurs.close(); + hcurs.close(); + + t.commit(); + + // END TIMING + return (0); + + } + catch (Exception e) { + try { + if (acurs != null) + acurs.close(); + if (bcurs != null) + bcurs.close(); + if (tcurs != null) + tcurs.close(); + if (hcurs != null) + hcurs.close(); + if (t != null) + t.abort(); + } + catch (DbException dbe) { + // not much we can do here. + } + + if (verbose) { + System.out.println("Transaction A=" + String.valueOf(account) + + " B=" + String.valueOf(branch) + + " T=" + String.valueOf(teller) + " failed"); + System.out.println("Reason: " + e.toString()); + } + return (-1); + } + } + + static void errExit(DbException err, String s) + { + System.err.print(progname + ": "); + if (s != null) { + System.err.print(s + ": "); + } + System.err.println(err.toString()); + System.exit(1); + } + + + public static void main(String argv[]) + { + long seed; + int accounts, branches, tellers, history; + boolean iflag; + int mpool, ntxns; + String home, endarg; + + home = null; + accounts = branches = history = tellers = 0; + mpool = ntxns = 0; + verbose = false; + iflag = false; + seed = (new GregorianCalendar()).get(Calendar.SECOND); + + for (int i = 0; i < argv.length; ++i) + { + if (argv[i].equals("-a")) { + // Number of account records + if ((accounts = Integer.parseInt(argv[++i])) <= 0) + invarg(argv[i]); + } + else if (argv[i].equals("-b")) { + // Number of branch records + if ((branches = Integer.parseInt(argv[++i])) <= 0) + invarg(argv[i]); + } + else if (argv[i].equals("-h")) { + // DB home. + home = argv[++i]; + } + else if (argv[i].equals("-i")) { + // Initialize the test. + iflag = true; + } + else if (argv[i].equals("-m")) { + // Bytes in buffer pool + if ((mpool = Integer.parseInt(argv[++i])) <= 0) + invarg(argv[i]); + } + else if (argv[i].equals("-n")) { + // Number of transactions + if ((ntxns = Integer.parseInt(argv[++i])) <= 0) + invarg(argv[i]); + } + else if (argv[i].equals("-S")) { + // Random number seed. + seed = Long.parseLong(argv[++i]); + if (seed <= 0) + invarg(argv[i]); + } + else if (argv[i].equals("-s")) { + // Number of history records + if ((history = Integer.parseInt(argv[++i])) <= 0) + invarg(argv[i]); + } + else if (argv[i].equals("-t")) { + // Number of teller records + if ((tellers = Integer.parseInt(argv[++i])) <= 0) + invarg(argv[i]); + } + else if (argv[i].equals("-v")) { + // Verbose option. + verbose = true; + } + else + { + usage(); + } + } + + rand.setSeed((int)seed); + + accounts = accounts == 0 ? ACCOUNTS : accounts; + branches = branches == 0 ? BRANCHES : branches; + tellers = tellers == 0 ? TELLERS : tellers; + history = history == 0 ? HISTORY : history; + + if (verbose) + System.out.println((long)accounts + " Accounts " + + String.valueOf(branches) + " Branches " + + String.valueOf(tellers) + " Tellers " + + String.valueOf(history) + " History"); + + // Declaring and setting options does not need + // to be done in a try block, as it will never + // raise an exception. + // + TpcbExample app = new TpcbExample(); + int flags = Db.DB_CREATE | Db.DB_INIT_MPOOL; + + app.set_error_stream(System.err); + app.set_errpfx("TpcbExample"); + + if (mpool == 0) { + mpool = 4 * 1024 * 1024; + } + app.set_mp_size(mpool); + + if (!iflag) { + flags |= Db.DB_INIT_TXN | Db.DB_INIT_LOCK | Db.DB_INIT_LOG; + } + + // Initialize the database environment. + // Must be done in within a try block, unless you + // change the error model in the options. + // + try { + app.appinit(home, null, flags); + } + catch (DbException dbe1) { + errExit(dbe1, "appinit failed"); + } + + if (iflag && ntxns != 0) { + System.err.println("specify only one of -i and -n"); + System.exit(1); + } + if (iflag) + app.populate(accounts, branches, history, tellers); + if (ntxns != 0) + app.run(ntxns, accounts, branches, tellers); + + // Shut down the application. + + try { + app.appexit(); + } + catch (DbException dbe2) { + errExit(dbe2, "appexit failed"); + } + + System.exit(0); + } + + private static void invarg(String str) + { + System.err.println("TpcbExample: invalid argument: " + str); + System.exit(1); + } + + private static void usage() + { + System.err.println("usage: TpcbExample " + + "[-iv] [-a accounts] [-b branches] [-h home] [-m mpool_size] " + + "[-n transactions ] [-S seed] [-s history] [-t tellers] "); + System.exit(1); + } + + // round 'd' to 'scale' digits, and return result as string + private String showRounded(double d, int scale) + { + return new BigDecimal(d). + setScale(scale, BigDecimal.ROUND_HALF_DOWN).toString(); + } + + // The byte order is our choice. + // + static long get_int_in_array(byte[] array, int offset) + { + return + ((0xff & array[offset+0]) << 0) | + ((0xff & array[offset+1]) << 8) | + ((0xff & array[offset+2]) << 16) | + ((0xff & array[offset+3]) << 24); + } + + // Note: Value needs to be long to avoid sign extension + static void set_int_in_array(byte[] array, int offset, long value) + { + array[offset+0] = (byte)((value >> 0) & 0x0ff); + array[offset+1] = (byte)((value >> 8) & 0x0ff); + array[offset+2] = (byte)((value >> 16) & 0x0ff); + array[offset+3] = (byte)((value >> 24) & 0x0ff); + } + +}; + +// Simulate the following C struct: +// struct Defrec { +// u_int32_t id; +// u_int32_t balance; +// u_int8_t pad[RECLEN - sizeof(int) - sizeof(int)]; +// }; + +class Defrec +{ + public Defrec() + { + data = new byte[TpcbExample.RECLEN]; + } + + public int length() + { + return TpcbExample.RECLEN; + } + + public long get_id() + { + return TpcbExample.get_int_in_array(data, 0); + } + + public void set_id(long value) + { + TpcbExample.set_int_in_array(data, 0, value); + } + + public long get_balance() + { + return TpcbExample.get_int_in_array(data, 4); + } + + public void set_balance(long value) + { + TpcbExample.set_int_in_array(data, 4, value); + } + + static { + Defrec d = new Defrec(); + d.set_balance(500000); + } + + public byte[] data; +} + +// Simulate the following C struct: +// struct Histrec { +// u_int32_t aid; +// u_int32_t bid; +// u_int32_t tid; +// u_int32_t amount; +// u_int8_t pad[RECLEN - 4 * sizeof(u_int32_t)]; +// }; + +class Histrec +{ + public Histrec() + { + data = new byte[TpcbExample.RECLEN]; + } + + public int length() + { + return TpcbExample.RECLEN; + } + + public long get_aid() + { + return TpcbExample.get_int_in_array(data, 0); + } + + public void set_aid(long value) + { + TpcbExample.set_int_in_array(data, 0, value); + } + + public long get_bid() + { + return TpcbExample.get_int_in_array(data, 4); + } + + public void set_bid(long value) + { + TpcbExample.set_int_in_array(data, 4, value); + } + + public long get_tid() + { + return TpcbExample.get_int_in_array(data, 8); + } + + public void set_tid(long value) + { + TpcbExample.set_int_in_array(data, 8, value); + } + + public long get_amount() + { + return TpcbExample.get_int_in_array(data, 12); + } + + public void set_amount(long value) + { + TpcbExample.set_int_in_array(data, 12, value); + } + + public byte[] data; +} + +class TpcbException extends Exception +{ + TpcbException() + { + super(); + } + + TpcbException(String s) + { + super(s); + } +} diff --git a/mozilla/db/libdb_java/Makefile.unix b/mozilla/db/libdb_java/Makefile.unix new file mode 100644 index 00000000000..cc6ea6348c2 --- /dev/null +++ b/mozilla/db/libdb_java/Makefile.unix @@ -0,0 +1,96 @@ +# @(#)Makefile.unix 10.5 (Sleepycat) 5/2/98 + +# This path should be changed to point to the top level directory of your +# java JDK tree (just above bin, include, ...). +# +JAVAINSDIR= /usr/java1.1 + +DBINSDIR= .. +DBBUILDDIR= $(DBINSDIR)/build.unix +NCLASSPATH= ../java/classes:$(CLASSPATH) + +LINK= gcc +LINKFLAGS= -shared -g -o libdb_java.so +CXX= gcc +INCFILES= -I$(JAVAINSDIR)/include -I$(JAVAINSDIR)/include/solaris \ + -I$(DBINSDIR)/include -I$(DBBUILDDIR) +CXXFLAGS= -c -g $(INCFILES) -fpic -D_REENTRANT +PERL= perl +LIBS= $(DBBUILDDIR)/libdb.so + +JPACKAGE= com.sleepycat.db. + +JCLASSES= $(JPACKAGE)Db $(JPACKAGE)DbBtreeStat $(JPACKAGE)DbEnv \ + $(JPACKAGE)DbInfo $(JPACKAGE)DbLock $(JPACKAGE)DbLockTab \ + $(JPACKAGE)DbLog $(JPACKAGE)DbLogStat $(JPACKAGE)DbLsn \ + $(JPACKAGE)DbMpool $(JPACKAGE)DbMpoolFStat \ + $(JPACKAGE)DbMpoolStat $(JPACKAGE)DbTxn $(JPACKAGE)DbTxnMgr \ + $(JPACKAGE)DbTxnStat $(JPACKAGE)Dbc $(JPACKAGE)Dbt + +CPPFILES= java_Db.cpp java_DbBtreeStat.cpp java_DbEnv.cpp \ + java_DbInfo.cpp java_DbLock.cpp java_DbLockTab.cpp \ + java_DbLog.cpp java_DbLogStat.cpp java_DbLsn.cpp \ + java_DbMpool.cpp java_DbMpoolFStat.cpp \ + java_DbMpoolStat.cpp java_DbTxn.cpp java_DbTxnMgr.cpp \ + java_DbTxnStat.cpp java_Dbc.cpp java_Dbt.cpp + +HFILES= java_util.h com_sleepycat_db_Db.h \ + com_sleepycat_db_DbBtreeStat.h com_sleepycat_db_DbEnv.h \ + com_sleepycat_db_DbInfo.h com_sleepycat_db_DbLock.h \ + com_sleepycat_db_DbLockTab.h com_sleepycat_db_DbLog.h \ + com_sleepycat_db_DbLogStat.h com_sleepycat_db_DbLsn.h \ + com_sleepycat_db_DbMpool.h com_sleepycat_db_DbMpoolFStat.h \ + com_sleepycat_db_DbMpoolStat.h com_sleepycat_db_DbTxn.h \ + com_sleepycat_db_DbTxnMgr.h com_sleepycat_db_DbTxnStat.h \ + com_sleepycat_db_Dbc.h com_sleepycat_db_Dbt.h + +OBJECTS= java_Db.o java_DbBtreeStat.o java_DbEnv.o java_DbInfo.o \ + java_DbLock.o java_DbLockTab.o java_DbLog.o java_DbLogStat.o \ + java_DbLsn.o java_DbMpool.o java_DbMpoolFStat.o \ + java_DbMpoolStat.o java_DbTxn.o java_DbTxnMgr.o \ + java_DbTxnStat.o java_Dbc.o java_Dbt.o java_util.o + +all: java_db.so + +rebuild: run_javah check_api java_db.so + +java_db.so: $(OBJECTS) + $(LINK) $(LINKFLAGS) $(OBJECTS) $(LIBS) + +run_javah: + javah -classpath "$(NCLASSPATH)" -jni $(JCLASSES) + +.SUFFIXES: .o .cpp + +.cpp.o: + $(CXX) $(CXXFLAGS) $*.cpp + +# This is really an optional step and is not run in the standard +# distribution because not everyone has perl. If you have perl, +# and you are making changes to the .h and .cpp files in this +# directory (as the maintainers do), you may want to run this +# after the run_javah step. +# +check_api: + $(PERL) checkapi.prl com_sleepycat_*.h java_*.cpp + +# These dependencies are overkill, but they work. +# +java_Db.o: $(HFILES) +java_DbBtreeStat.o: $(HFILES) +java_DbEnv.o: $(HFILES) +java_DbInfo.o: $(HFILES) +java_DbLock.o: $(HFILES) +java_DbLockTab.o: $(HFILES) +java_DbLog.o: $(HFILES) +java_DbLogStat.o: $(HFILES) +java_DbLsn.o: $(HFILES) +java_DbMpool.o: $(HFILES) +java_DbMpoolFStat.o: $(HFILES) +java_DbMpoolStat.o: $(HFILES) +java_DbTxn.o: $(HFILES) +java_DbTxnMgr.o: $(HFILES) +java_DbTxnStat.o: $(HFILES) +java_Dbc.o: $(HFILES) +java_Dbt.o: $(HFILES) +java_util.o: $(HFILES) diff --git a/mozilla/db/libdb_java/Makefile.win32 b/mozilla/db/libdb_java/Makefile.win32 new file mode 100644 index 00000000000..5bf270dab28 --- /dev/null +++ b/mozilla/db/libdb_java/Makefile.win32 @@ -0,0 +1,150 @@ +# @(#)Makefile.win32 10.4 (Sleepycat) 5/2/98 + +JAVAINSDIR=d:/java +DBINSDIR=.. +CLASSPATH=$(DBINSDIR)/java/classes;$(JAVAINSDIR)/lib/classes.zip +LINK = link +PERL = perl +LIBS = $(DBINSDIR)/build.win32/Debug/libdb.lib + +DEBUG_CLFLAGS = /GX /Z7 /MTd /D_DEBUG $(INCDIRS) +RELEASE_CLFLAGS = /GX /MT /DNDEBUG $(INCDIRS) +CLFLAGS=$(DEBUG_CLFLAGS) + +INCDIRS = \ + -I$(JAVAINSDIR)/include \ + -I$(JAVAINSDIR)/include/win32 \ + -I$(DBINSDIR)/build.win32 \ + -I$(DBINSDIR)/include + +JPACKAGE=com.sleepycat.db. + +JCLASSES=\ + $(JPACKAGE)Db\ + $(JPACKAGE)DbBtreeStat\ + $(JPACKAGE)DbEnv\ + $(JPACKAGE)DbInfo\ + $(JPACKAGE)DbLock\ + $(JPACKAGE)DbLockTab\ + $(JPACKAGE)DbLog\ + $(JPACKAGE)DbLogStat\ + $(JPACKAGE)DbLsn\ + $(JPACKAGE)DbMpool\ + $(JPACKAGE)DbMpoolFStat\ + $(JPACKAGE)DbMpoolStat\ + $(JPACKAGE)DbTxn\ + $(JPACKAGE)DbTxnMgr\ + $(JPACKAGE)DbTxnStat\ + $(JPACKAGE)Dbc\ + $(JPACKAGE)Dbt\ + +CPPFILES=\ + java_Db.cpp\ + java_DbBtreeStat.cpp\ + java_DbEnv.cpp\ + java_DbInfo.cpp\ + java_DbLock.cpp\ + java_DbLockTab.cpp\ + java_DbLog.cpp\ + java_DbLogStat.cpp\ + java_DbLsn.cpp\ + java_DbMpool.cpp\ + java_DbMpoolFStat.cpp\ + java_DbMpoolStat.cpp\ + java_DbTxn.cpp\ + java_DbTxnMgr.cpp\ + java_DbTxnStat.cpp\ + java_Dbc.cpp\ + java_Dbt.cpp\ + +HFILES=\ + java_util.h\ + com_sleepycat_db_Db.h\ + com_sleepycat_db_DbBtreeStat.h\ + com_sleepycat_db_DbEnv.h\ + com_sleepycat_db_DbInfo.h\ + com_sleepycat_db_DbLock.h\ + com_sleepycat_db_DbLockTab.h\ + com_sleepycat_db_DbLog.h\ + com_sleepycat_db_DbLogStat.h\ + com_sleepycat_db_DbLsn.h\ + com_sleepycat_db_DbMpool.h\ + com_sleepycat_db_DbMpoolFStat.h\ + com_sleepycat_db_DbMpoolStat.h\ + com_sleepycat_db_DbTxn.h\ + com_sleepycat_db_DbTxnMgr.h\ + com_sleepycat_db_DbTxnStat.h\ + com_sleepycat_db_Dbc.h\ + com_sleepycat_db_Dbt.h\ + +OBJFILES=\ + java_Db.obj\ + java_DbBtreeStat.obj\ + java_DbEnv.obj\ + java_DbInfo.obj\ + java_DbLock.obj\ + java_DbLockTab.obj\ + java_DbLog.obj\ + java_DbLogStat.obj\ + java_DbLsn.obj\ + java_DbMpool.obj\ + java_DbMpoolFStat.obj\ + java_DbMpoolStat.obj\ + java_DbTxn.obj\ + java_DbTxnMgr.obj\ + java_DbTxnStat.obj\ + java_Dbc.obj\ + java_Dbt.obj\ + java_util.obj\ + +all: libdb_java.dll + +rebuild: run_javah check_api libdb_java.dll + +libdb_java.dll: $(OBJFILES) + $(LINK) /debug /dll /out:libdb_java.dll $(OBJFILES) $(LIBS) + +.cpp.obj: + cl /c $(CLFLAGS) $*.cpp + +clean: + del /q *.obj *.lib *.exp *.dll *.ilk *.pdb + +# This needs to be run whenever the interface of the java classes +# changes. It recreates the com_sleepycat...*.h files, so they +# must be made writeable. +# +run_javah: + attrib -r com_sleepycat*.h + javah -classpath "$(CLASSPATH)" -jni $(JCLASSES) + attrib +r com_sleepycat*.h + +# This is really an optional step and is not run in the standard +# distribution because not everyone has perl. If you have perl, +# and you are making changes to the .h and .cpp files in this +# directory (as the maintainers do), you may want to run this +# after the run_javah step. +# +check_api: + $(PERL) checkapi.prl com_sleepycat_*.h java_*.cpp + +# These dependencies are overkill, but they work. +# +java_Db.obj: $(HFILES) +java_DbBtreeStat.obj: $(HFILES) +java_DbEnv.obj: $(HFILES) +java_DbInfo.obj: $(HFILES) +java_DbLock.obj: $(HFILES) +java_DbLockTab.obj: $(HFILES) +java_DbLog.obj: $(HFILES) +java_DbLogStat.obj: $(HFILES) +java_DbLsn.obj: $(HFILES) +java_DbMpool.obj: $(HFILES) +java_DbMpoolFStat.obj: $(HFILES) +java_DbMpoolStat.obj: $(HFILES) +java_DbTxn.obj: $(HFILES) +java_DbTxnMgr.obj: $(HFILES) +java_DbTxnStat.obj: $(HFILES) +java_Dbc.obj: $(HFILES) +java_Dbt.obj: $(HFILES) +java_util.obj: $(HFILES) diff --git a/mozilla/db/libdb_java/README b/mozilla/db/libdb_java/README new file mode 100644 index 00000000000..76b5bc503f4 --- /dev/null +++ b/mozilla/db/libdb_java/README @@ -0,0 +1,4 @@ +# @(#)README 10.1 (Sleepycat) 11/10/97 + +This is the directory containing sources to build the libdb_java +shared library. Please see ../java/README for complete information. diff --git a/mozilla/db/libdb_java/checkapi.prl b/mozilla/db/libdb_java/checkapi.prl new file mode 100644 index 00000000000..230ac8b3528 --- /dev/null +++ b/mozilla/db/libdb_java/checkapi.prl @@ -0,0 +1,129 @@ +# +# Released to public domain by Donald Anderson dda@world.std.com +# No warranties. +# +# Perl script to check for matching of JNI interfaces to implementation. +# We check all .cpp arguments and .h arguments and make sure that for +# each .h declaration (marked by JNIEXPORT keyword), there is a .cpp +# definition for the same function (also marked by JNIEXPORT keyword), +# and vice versa. Definitions and declarations are determined solely +# by whether they are in a .h or .cpp file - we don't do any further +# analysis. +# +# Some additions made to help with DB: +# +# DB uses JAVADB_*_ACCESS #defines to quickly define routine access +# functions. + +foreach $file (@ARGV) { + open (FILE, $file) || die "$file: cannot open\n"; + $dot_h = 0; + if ($file =~ /.*[hH]$/) { + $dot_h = 1; + } + $in_def = 0; +nextline: + while () { + chop; + if (/JNIEXPORT/ || /^JAVADB_.*_ACCESS/) { + $in_def = 1; + $def = ""; + } + if ($in_def == 1) { + $def .= $_; + } + if (/\)/) { + $line = ""; + $in_def = 0; + if ($def eq "") { + next nextline; + } + $_ = $def; + # remove comments + s@/\*[^*]*\*/@@g; + s@[ ][ ]*@ @g; + s@JNIEnv *\* *@JNIEnv @g; + s@([,*()]) @\1@g; + s@ ([,*()])@\1@g; + + if (/^JAVADB_.*_ACCESS/) { + s@ *@ @g; + s@_ACCESS_STRING\(([^,]*),@_ACCESS(\1,jstring,@; + s@_ACCESS\(@,normal,@; + s@JAVADB_@@; + s@\)@,@; + @vars = split(/,/); + $get = 0; + $set = 0; + if (@vars[0] eq "RW") { + $get = 1; + $set = 1; + } + if (@vars[0] eq "RO") { + $get = 1; + } + if (@vars[0] eq "WO") { + $set = 1; + } + if ($get == 0 && $set == 0) { + print "Invalid use of JAVADB_ macro\n"; + } + if ($set == 1) { + $line = "JNIEXPORT void JNICALL Java_com_sleepycat_db_@vars[2]_set_1@vars[4](JNIEnv,jobject,@vars[3])"; + } + if ($get == 1) { + $line2 = "JNIEXPORT @vars[3] JNICALL Java_com_sleepycat_db_@vars[2]_get_1@vars[4](JNIEnv,jobject)"; + } + } + else { + s@([,(][a-zA-Z0-9_]*) [a-zA-Z0-9_]*@\1@g; + s@;$@@g; + $line = $_; + } + + $def = ""; + + if ($line ne "") { + if ($lines{$line} eq "") { + $lines{$line} = 0; + } + if ($dot_h == 1) { + $lines{$line} += 1; + } + else { + $lines{$line} -= 1; + } + $line = ""; + } + if ($line2 ne "") { + if ($lines{$line2} eq "") { + $lines{$line2} = 0; + } + if ($dot_h == 1) { + $lines{$line2} += 1; + } + else { + $lines{$line2} -= 1; + } + $line2 = ""; + } + } + } + close (); +} + +$status = 0; +foreach $key (sort keys %lines) { + if ($lines{$key} != 0) { + if ($lines{$key} > 0) { + print "Missing .cpp implementation: $lines${key}\n"; + $status = 1; + } + else { + print "Missing .h declaration: $lines${key}\n"; + $status = 1; + } + } +} + +exit ($status); diff --git a/mozilla/db/libdb_java/com_sleepycat_db_Db.h b/mozilla/db/libdb_java/com_sleepycat_db_Db.h new file mode 100644 index 00000000000..46cd8229509 --- /dev/null +++ b/mozilla/db/libdb_java/com_sleepycat_db_Db.h @@ -0,0 +1,205 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_sleepycat_db_Db */ + +#ifndef _Included_com_sleepycat_db_Db +#define _Included_com_sleepycat_db_Db +#ifdef __cplusplus +extern "C" { +#endif +#undef com_sleepycat_db_Db_DB_BTREE +#define com_sleepycat_db_Db_DB_BTREE 1L +#undef com_sleepycat_db_Db_DB_HASH +#define com_sleepycat_db_Db_DB_HASH 2L +#undef com_sleepycat_db_Db_DB_RECNO +#define com_sleepycat_db_Db_DB_RECNO 3L +#undef com_sleepycat_db_Db_DB_UNKNOWN +#define com_sleepycat_db_Db_DB_UNKNOWN 4L +/* Inaccessible static: DB_CREATE */ +/* Inaccessible static: DB_NOMMAP */ +/* Inaccessible static: DB_THREAD */ +/* Inaccessible static: DB_EXCL */ +/* Inaccessible static: DB_RDONLY */ +/* Inaccessible static: DB_SEQUENTIAL */ +/* Inaccessible static: DB_TEMPORARY */ +/* Inaccessible static: DB_TRUNCATE */ +#undef com_sleepycat_db_Db_DB_INCOMPLETE +#define com_sleepycat_db_Db_DB_INCOMPLETE -1L +#undef com_sleepycat_db_Db_DB_KEYEMPTY +#define com_sleepycat_db_Db_DB_KEYEMPTY -2L +#undef com_sleepycat_db_Db_DB_KEYEXIST +#define com_sleepycat_db_Db_DB_KEYEXIST -3L +#undef com_sleepycat_db_Db_DB_LOCK_DEADLOCK +#define com_sleepycat_db_Db_DB_LOCK_DEADLOCK -4L +#undef com_sleepycat_db_Db_DB_LOCK_NOTGRANTED +#define com_sleepycat_db_Db_DB_LOCK_NOTGRANTED -5L +#undef com_sleepycat_db_Db_DB_LOCK_NOTHELD +#define com_sleepycat_db_Db_DB_LOCK_NOTHELD -6L +#undef com_sleepycat_db_Db_DB_NOTFOUND +#define com_sleepycat_db_Db_DB_NOTFOUND -7L +/* Inaccessible static: DB_INIT_LOCK */ +/* Inaccessible static: DB_INIT_LOG */ +/* Inaccessible static: DB_INIT_MPOOL */ +/* Inaccessible static: DB_INIT_TXN */ +/* Inaccessible static: DB_MPOOL_PRIVATE */ +/* Inaccessible static: DB_MUTEXDEBUG */ +/* Inaccessible static: DB_RECOVER */ +/* Inaccessible static: DB_RECOVER_FATAL */ +/* Inaccessible static: DB_TXN_NOSYNC */ +/* Inaccessible static: DB_USE_ENVIRON */ +/* Inaccessible static: DB_USE_ENVIRON_ROOT */ +/* Inaccessible static: DB_LOCK_NORUN */ +/* Inaccessible static: DB_LOCK_DEFAULT */ +/* Inaccessible static: DB_LOCK_OLDEST */ +/* Inaccessible static: DB_LOCK_RANDOM */ +/* Inaccessible static: DB_LOCK_YOUNGEST */ +/* Inaccessible static: DB_DELIMITER */ +/* Inaccessible static: DB_DUP */ +/* Inaccessible static: DB_FIXEDLEN */ +/* Inaccessible static: DB_PAD */ +/* Inaccessible static: DB_RECNUM */ +/* Inaccessible static: DB_RENUMBER */ +/* Inaccessible static: DB_SNAPSHOT */ +#undef com_sleepycat_db_Db_DB_LOCK_NG +#define com_sleepycat_db_Db_DB_LOCK_NG 0L +#undef com_sleepycat_db_Db_DB_LOCK_READ +#define com_sleepycat_db_Db_DB_LOCK_READ 1L +#undef com_sleepycat_db_Db_DB_LOCK_WRITE +#define com_sleepycat_db_Db_DB_LOCK_WRITE 2L +#undef com_sleepycat_db_Db_DB_LOCK_IREAD +#define com_sleepycat_db_Db_DB_LOCK_IREAD 3L +#undef com_sleepycat_db_Db_DB_LOCK_IWRITE +#define com_sleepycat_db_Db_DB_LOCK_IWRITE 4L +#undef com_sleepycat_db_Db_DB_LOCK_IWR +#define com_sleepycat_db_Db_DB_LOCK_IWR 5L +#undef com_sleepycat_db_Db_DB_LOCK_DUMP +#define com_sleepycat_db_Db_DB_LOCK_DUMP 0L +#undef com_sleepycat_db_Db_DB_LOCK_GET +#define com_sleepycat_db_Db_DB_LOCK_GET 1L +#undef com_sleepycat_db_Db_DB_LOCK_PUT +#define com_sleepycat_db_Db_DB_LOCK_PUT 2L +#undef com_sleepycat_db_Db_DB_LOCK_PUT_ALL +#define com_sleepycat_db_Db_DB_LOCK_PUT_ALL 3L +#undef com_sleepycat_db_Db_DB_LOCK_PUT_OBJ +#define com_sleepycat_db_Db_DB_LOCK_PUT_OBJ 4L +/* Inaccessible static: DB_LOCK_NOWAIT */ +/* Inaccessible static: DB_LOCK_CONFLICT */ +/* Inaccessible static: DB_ARCH_ABS */ +/* Inaccessible static: DB_ARCH_DATA */ +/* Inaccessible static: DB_ARCH_LOG */ +/* Inaccessible static: DB_AFTER */ +/* Inaccessible static: DB_APPEND */ +/* Inaccessible static: DB_BEFORE */ +/* Inaccessible static: DB_CHECKPOINT */ +/* Inaccessible static: DB_CURRENT */ +/* Inaccessible static: DB_FIRST */ +/* Inaccessible static: DB_FLUSH */ +/* Inaccessible static: DB_GET_RECNO */ +/* Inaccessible static: DB_KEYFIRST */ +/* Inaccessible static: DB_KEYLAST */ +/* Inaccessible static: DB_LAST */ +/* Inaccessible static: DB_NEXT */ +/* Inaccessible static: DB_NOOVERWRITE */ +/* Inaccessible static: DB_NOSYNC */ +/* Inaccessible static: DB_PREV */ +/* Inaccessible static: DB_RECORDCOUNT */ +/* Inaccessible static: DB_SET */ +/* Inaccessible static: DB_SET_RANGE */ +/* Inaccessible static: DB_SET_RECNO */ +/* Inaccessible static: DB_DBT_INTERNAL */ +/* Inaccessible static: DB_DBT_MALLOC */ +/* Inaccessible static: DB_DBT_PARTIAL */ +/* Inaccessible static: DB_DBT_USERMEM */ +/* Inaccessible static: already_loaded_ */ +/* + * Class: com_sleepycat_db_Db + * Method: close + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_Db_close + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_Db + * Method: cursor + * Signature: (Lcom/sleepycat/db/DbTxn;)Lcom/sleepycat/db/Dbc; + */ +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_Db_cursor + (JNIEnv *, jobject, jobject); + +/* + * Class: com_sleepycat_db_Db + * Method: del + * Signature: (Lcom/sleepycat/db/DbTxn;Lcom/sleepycat/db/Dbt;I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_Db_del + (JNIEnv *, jobject, jobject, jobject, jint); + +/* + * Class: com_sleepycat_db_Db + * Method: fd + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_Db_fd + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_Db + * Method: finalize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_Db_finalize + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_Db + * Method: get + * Signature: (Lcom/sleepycat/db/DbTxn;Lcom/sleepycat/db/Dbt;Lcom/sleepycat/db/Dbt;I)I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_Db_get + (JNIEnv *, jobject, jobject, jobject, jobject, jint); + +/* + * Class: com_sleepycat_db_Db + * Method: get_type + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_Db_get_1type + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_Db + * Method: open + * Signature: (Ljava/lang/String;IIILcom/sleepycat/db/DbEnv;Lcom/sleepycat/db/DbInfo;)Lcom/sleepycat/db/Db; + */ +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_Db_open + (JNIEnv *, jclass, jstring, jint, jint, jint, jobject, jobject); + +/* + * Class: com_sleepycat_db_Db + * Method: put + * Signature: (Lcom/sleepycat/db/DbTxn;Lcom/sleepycat/db/Dbt;Lcom/sleepycat/db/Dbt;I)I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_Db_put + (JNIEnv *, jobject, jobject, jobject, jobject, jint); + +/* + * Class: com_sleepycat_db_Db + * Method: stat + * Signature: (I)Lcom/sleepycat/db/DbBtreeStat; + */ +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_Db_stat + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_Db + * Method: sync + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_Db_sync + (JNIEnv *, jobject, jint); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/mozilla/db/libdb_java/com_sleepycat_db_DbBtreeStat.h b/mozilla/db/libdb_java/com_sleepycat_db_DbBtreeStat.h new file mode 100644 index 00000000000..2013d8d36da --- /dev/null +++ b/mozilla/db/libdb_java/com_sleepycat_db_DbBtreeStat.h @@ -0,0 +1,253 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_sleepycat_db_DbBtreeStat */ + +#ifndef _Included_com_sleepycat_db_DbBtreeStat +#define _Included_com_sleepycat_db_DbBtreeStat +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: finalize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbBtreeStat_finalize + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_added + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1added + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_cache_hit + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1cache_1hit + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_cache_miss + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1cache_1miss + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_deleted + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1deleted + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_dup_pg + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1dup_1pg + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_dup_pgfree + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1dup_1pgfree + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_fastsplit + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1fastsplit + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_flags + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1flags + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_free + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1free + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_freed + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1freed + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_get + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1get + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_int_pg + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1int_1pg + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_int_pgfree + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1int_1pgfree + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_leaf_pg + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1leaf_1pg + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_leaf_pgfree + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1leaf_1pgfree + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_levels + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1levels + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_magic + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1magic + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_maxkey + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1maxkey + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_minkey + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1minkey + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_nrecs + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1nrecs + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_over_pg + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1over_1pg + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_over_pgfree + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1over_1pgfree + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_pagesize + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1pagesize + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_pfxsaved + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1pfxsaved + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_re_len + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1re_1len + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_re_pad + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1re_1pad + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_rootsplit + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1rootsplit + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_split + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1split + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbBtreeStat + * Method: get_bt_version + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbBtreeStat_get_1bt_1version + (JNIEnv *, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/mozilla/db/libdb_java/com_sleepycat_db_DbEnv.h b/mozilla/db/libdb_java/com_sleepycat_db_DbEnv.h new file mode 100644 index 00000000000..3a2f5d3e89a --- /dev/null +++ b/mozilla/db/libdb_java/com_sleepycat_db_DbEnv.h @@ -0,0 +1,367 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_sleepycat_db_DbEnv */ + +#ifndef _Included_com_sleepycat_db_DbEnv +#define _Included_com_sleepycat_db_DbEnv +#ifdef __cplusplus +extern "C" { +#endif +#undef com_sleepycat_db_DbEnv_java_version_string_ +#define com_sleepycat_db_DbEnv_java_version_string_ 61L +/* + * Class: com_sleepycat_db_DbEnv + * Method: appexit + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_appexit + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: appinit + * Signature: (Ljava/lang/String;[Ljava/lang/String;I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_appinit + (JNIEnv *, jobject, jstring, jobjectArray, jint); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: finalize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_finalize + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: get_data_cnt + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_get_1data_1cnt + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: get_data_next + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_get_1data_1next + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: get_errcall + * Signature: ()Lcom/sleepycat/db/DbErrcall; + */ +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbEnv_get_1errcall + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: get_errpfx + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sleepycat_db_DbEnv_get_1errpfx + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: get_flags + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_get_1flags + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: get_home + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sleepycat_db_DbEnv_get_1home + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: get_lg_max + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_get_1lg_1max + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: get_lk_conflicts + * Signature: ()[[B + */ +JNIEXPORT jobjectArray JNICALL Java_com_sleepycat_db_DbEnv_get_1lk_1conflicts + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: get_lk_detect + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_get_1lk_1detect + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: get_lk_max + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_get_1lk_1max + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: get_lk_modes + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_get_1lk_1modes + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: get_log_dir + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sleepycat_db_DbEnv_get_1log_1dir + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: get_lorder + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_get_1lorder + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: get_mp_mmapsize + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbEnv_get_1mp_1mmapsize + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: get_mp_size + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbEnv_get_1mp_1size + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: get_tmp_dir + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sleepycat_db_DbEnv_get_1tmp_1dir + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: get_tx_max + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_get_1tx_1max + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: get_verbose + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_get_1verbose + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: get_version_major + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_get_1version_1major + (JNIEnv *, jclass); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: get_version_minor + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_get_1version_1minor + (JNIEnv *, jclass); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: get_version_patch + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_get_1version_1patch + (JNIEnv *, jclass); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: get_version_string + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sleepycat_db_DbEnv_get_1version_1string + (JNIEnv *, jclass); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_init + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: set_data_cnt + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1data_1cnt + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: set_data_next + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1data_1next + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: set_errcall + * Signature: (Lcom/sleepycat/db/DbErrcall;)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1errcall + (JNIEnv *, jobject, jobject); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: set_errpfx + * Signature: (Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1errpfx + (JNIEnv *, jobject, jstring); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: set_flags + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1flags + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: set_home + * Signature: (Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1home + (JNIEnv *, jobject, jstring); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: set_lg_max + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1lg_1max + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: set_lk_conflicts + * Signature: ([[B)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1lk_1conflicts + (JNIEnv *, jobject, jobjectArray); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: set_lk_detect + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1lk_1detect + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: set_lk_max + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1lk_1max + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: set_lk_modes + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1lk_1modes + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: set_log_dir + * Signature: (Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1log_1dir + (JNIEnv *, jobject, jstring); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: set_lorder + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1lorder + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: set_mp_mmapsize + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1mp_1mmapsize + (JNIEnv *, jobject, jlong); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: set_mp_size + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1mp_1size + (JNIEnv *, jobject, jlong); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: set_tmp_dir + * Signature: (Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1tmp_1dir + (JNIEnv *, jobject, jstring); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: set_tx_max + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1tx_1max + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_DbEnv + * Method: set_verbose + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1verbose + (JNIEnv *, jobject, jint); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/mozilla/db/libdb_java/com_sleepycat_db_DbInfo.h b/mozilla/db/libdb_java/com_sleepycat_db_DbInfo.h new file mode 100644 index 00000000000..dab182d3478 --- /dev/null +++ b/mozilla/db/libdb_java/com_sleepycat_db_DbInfo.h @@ -0,0 +1,221 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_sleepycat_db_DbInfo */ + +#ifndef _Included_com_sleepycat_db_DbInfo +#define _Included_com_sleepycat_db_DbInfo +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sleepycat_db_DbInfo + * Method: finalize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbInfo_finalize + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: get_bt_maxkey + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbInfo_get_1bt_1maxkey + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: get_bt_minkey + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbInfo_get_1bt_1minkey + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: get_cachesize + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbInfo_get_1cachesize + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: get_flags + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbInfo_get_1flags + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: get_h_ffactor + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbInfo_get_1h_1ffactor + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: get_h_nelem + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbInfo_get_1h_1nelem + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: get_lorder + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbInfo_get_1lorder + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: get_pagesize + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbInfo_get_1pagesize + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: get_re_delim + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbInfo_get_1re_1delim + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: get_re_len + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbInfo_get_1re_1len + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: get_re_pad + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbInfo_get_1re_1pad + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: get_re_source + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sleepycat_db_DbInfo_get_1re_1source + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: init_from + * Signature: (Lcom/sleepycat/db/DbInfo;)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbInfo_init_1from + (JNIEnv *, jobject, jobject); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: set_bt_maxkey + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbInfo_set_1bt_1maxkey + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: set_bt_minkey + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbInfo_set_1bt_1minkey + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: set_cachesize + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbInfo_set_1cachesize + (JNIEnv *, jobject, jlong); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: set_flags + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbInfo_set_1flags + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: set_h_ffactor + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbInfo_set_1h_1ffactor + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: set_h_nelem + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbInfo_set_1h_1nelem + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: set_lorder + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbInfo_set_1lorder + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: set_pagesize + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbInfo_set_1pagesize + (JNIEnv *, jobject, jlong); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: set_re_delim + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbInfo_set_1re_1delim + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: set_re_len + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbInfo_set_1re_1len + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: set_re_pad + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbInfo_set_1re_1pad + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_DbInfo + * Method: set_re_source + * Signature: (Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbInfo_set_1re_1source + (JNIEnv *, jobject, jstring); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/mozilla/db/libdb_java/com_sleepycat_db_DbLock.h b/mozilla/db/libdb_java/com_sleepycat_db_DbLock.h new file mode 100644 index 00000000000..ef9d3794b92 --- /dev/null +++ b/mozilla/db/libdb_java/com_sleepycat_db_DbLock.h @@ -0,0 +1,45 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_sleepycat_db_DbLock */ + +#ifndef _Included_com_sleepycat_db_DbLock +#define _Included_com_sleepycat_db_DbLock +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sleepycat_db_DbLock + * Method: finalize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLock_finalize + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLock + * Method: get_lock_id + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLock_get_1lock_1id + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLock + * Method: put + * Signature: (Lcom/sleepycat/db/DbLockTab;)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLock_put + (JNIEnv *, jobject, jobject); + +/* + * Class: com_sleepycat_db_DbLock + * Method: set_lock_id + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLock_set_1lock_1id + (JNIEnv *, jobject, jint); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/mozilla/db/libdb_java/com_sleepycat_db_DbLockTab.h b/mozilla/db/libdb_java/com_sleepycat_db_DbLockTab.h new file mode 100644 index 00000000000..c77d2597a81 --- /dev/null +++ b/mozilla/db/libdb_java/com_sleepycat_db_DbLockTab.h @@ -0,0 +1,69 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_sleepycat_db_DbLockTab */ + +#ifndef _Included_com_sleepycat_db_DbLockTab +#define _Included_com_sleepycat_db_DbLockTab +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sleepycat_db_DbLockTab + * Method: close + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLockTab_close + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLockTab + * Method: detect + * Signature: (II)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLockTab_detect + (JNIEnv *, jobject, jint, jint); + +/* + * Class: com_sleepycat_db_DbLockTab + * Method: finalize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLockTab_finalize + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLockTab + * Method: get + * Signature: (IILcom/sleepycat/db/Dbt;I)Lcom/sleepycat/db/DbLock; + */ +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbLockTab_get + (JNIEnv *, jobject, jint, jint, jobject, jint); + +/* + * Class: com_sleepycat_db_DbLockTab + * Method: id + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLockTab_id + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLockTab + * Method: open + * Signature: (Ljava/lang/String;IILcom/sleepycat/db/DbEnv;)Lcom/sleepycat/db/DbLockTab; + */ +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbLockTab_open + (JNIEnv *, jclass, jstring, jint, jint, jobject); + +/* + * Class: com_sleepycat_db_DbLockTab + * Method: unlink + * Signature: (Ljava/lang/String;ILcom/sleepycat/db/DbEnv;)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLockTab_unlink + (JNIEnv *, jclass, jstring, jint, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/mozilla/db/libdb_java/com_sleepycat_db_DbLog.h b/mozilla/db/libdb_java/com_sleepycat_db_DbLog.h new file mode 100644 index 00000000000..7c90942156f --- /dev/null +++ b/mozilla/db/libdb_java/com_sleepycat_db_DbLog.h @@ -0,0 +1,117 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_sleepycat_db_DbLog */ + +#ifndef _Included_com_sleepycat_db_DbLog +#define _Included_com_sleepycat_db_DbLog +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sleepycat_db_DbLog + * Method: archive + * Signature: (I)[Ljava/lang/String; + */ +JNIEXPORT jobjectArray JNICALL Java_com_sleepycat_db_DbLog_archive + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_DbLog + * Method: close + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLog_close + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLog + * Method: compare + * Signature: (Lcom/sleepycat/db/DbLsn;Lcom/sleepycat/db/DbLsn;)I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLog_compare + (JNIEnv *, jclass, jobject, jobject); + +/* + * Class: com_sleepycat_db_DbLog + * Method: db_register + * Signature: (Lcom/sleepycat/db/Db;Ljava/lang/String;I)I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLog_db_1register + (JNIEnv *, jobject, jobject, jstring, jint); + +/* + * Class: com_sleepycat_db_DbLog + * Method: db_unregister + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLog_db_1unregister + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_DbLog + * Method: file + * Signature: (Lcom/sleepycat/db/DbLsn;)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sleepycat_db_DbLog_file + (JNIEnv *, jobject, jobject); + +/* + * Class: com_sleepycat_db_DbLog + * Method: finalize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLog_finalize + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLog + * Method: flush + * Signature: (Lcom/sleepycat/db/DbLsn;)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLog_flush + (JNIEnv *, jobject, jobject); + +/* + * Class: com_sleepycat_db_DbLog + * Method: get + * Signature: (Lcom/sleepycat/db/DbLsn;Lcom/sleepycat/db/Dbt;I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLog_get + (JNIEnv *, jobject, jobject, jobject, jint); + +/* + * Class: com_sleepycat_db_DbLog + * Method: open + * Signature: (Ljava/lang/String;IILcom/sleepycat/db/DbEnv;)Lcom/sleepycat/db/DbLog; + */ +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbLog_open + (JNIEnv *, jclass, jstring, jint, jint, jobject); + +/* + * Class: com_sleepycat_db_DbLog + * Method: put + * Signature: (Lcom/sleepycat/db/DbLsn;Lcom/sleepycat/db/Dbt;I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLog_put + (JNIEnv *, jobject, jobject, jobject, jint); + +/* + * Class: com_sleepycat_db_DbLog + * Method: stat + * Signature: ()Lcom/sleepycat/db/DbLogStat; + */ +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbLog_stat + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLog + * Method: unlink + * Signature: (Ljava/lang/String;ILcom/sleepycat/db/DbEnv;)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLog_unlink + (JNIEnv *, jclass, jstring, jint, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/mozilla/db/libdb_java/com_sleepycat_db_DbLogStat.h b/mozilla/db/libdb_java/com_sleepycat_db_DbLogStat.h new file mode 100644 index 00000000000..5df74011c60 --- /dev/null +++ b/mozilla/db/libdb_java/com_sleepycat_db_DbLogStat.h @@ -0,0 +1,133 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_sleepycat_db_DbLogStat */ + +#ifndef _Included_com_sleepycat_db_DbLogStat +#define _Included_com_sleepycat_db_DbLogStat +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sleepycat_db_DbLogStat + * Method: finalize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLogStat_finalize + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLogStat + * Method: get_st_cur_file + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLogStat_get_1st_1cur_1file + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLogStat + * Method: get_st_cur_offset + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLogStat_get_1st_1cur_1offset + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLogStat + * Method: get_st_lg_max + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLogStat_get_1st_1lg_1max + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLogStat + * Method: get_st_magic + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLogStat_get_1st_1magic + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLogStat + * Method: get_st_mode + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLogStat_get_1st_1mode + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLogStat + * Method: get_st_region_nowait + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLogStat_get_1st_1region_1nowait + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLogStat + * Method: get_st_region_wait + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLogStat_get_1st_1region_1wait + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLogStat + * Method: get_st_scount + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLogStat_get_1st_1scount + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLogStat + * Method: get_st_version + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLogStat_get_1st_1version + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLogStat + * Method: get_st_w_bytes + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLogStat_get_1st_1w_1bytes + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLogStat + * Method: get_st_w_mbytes + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLogStat_get_1st_1w_1mbytes + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLogStat + * Method: get_st_wc_bytes + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLogStat_get_1st_1wc_1bytes + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLogStat + * Method: get_st_wc_mbytes + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLogStat_get_1st_1wc_1mbytes + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLogStat + * Method: get_st_wcount + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLogStat_get_1st_1wcount + (JNIEnv *, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/mozilla/db/libdb_java/com_sleepycat_db_DbLsn.h b/mozilla/db/libdb_java/com_sleepycat_db_DbLsn.h new file mode 100644 index 00000000000..080fa0a8758 --- /dev/null +++ b/mozilla/db/libdb_java/com_sleepycat_db_DbLsn.h @@ -0,0 +1,29 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_sleepycat_db_DbLsn */ + +#ifndef _Included_com_sleepycat_db_DbLsn +#define _Included_com_sleepycat_db_DbLsn +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sleepycat_db_DbLsn + * Method: finalize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLsn_finalize + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbLsn + * Method: init_lsn + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLsn_init_1lsn + (JNIEnv *, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/mozilla/db/libdb_java/com_sleepycat_db_DbMpool.h b/mozilla/db/libdb_java/com_sleepycat_db_DbMpool.h new file mode 100644 index 00000000000..246bfa373b9 --- /dev/null +++ b/mozilla/db/libdb_java/com_sleepycat_db_DbMpool.h @@ -0,0 +1,45 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_sleepycat_db_DbMpool */ + +#ifndef _Included_com_sleepycat_db_DbMpool +#define _Included_com_sleepycat_db_DbMpool +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sleepycat_db_DbMpool + * Method: finalize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbMpool_finalize + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpool + * Method: fstat + * Signature: ()[Lcom/sleepycat/db/DbMpoolFStat; + */ +JNIEXPORT jobjectArray JNICALL Java_com_sleepycat_db_DbMpool_fstat + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpool + * Method: stat + * Signature: ()Lcom/sleepycat/db/DbMpoolStat; + */ +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbMpool_stat + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpool + * Method: trickle + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbMpool_trickle + (JNIEnv *, jobject, jint); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/mozilla/db/libdb_java/com_sleepycat_db_DbMpoolFStat.h b/mozilla/db/libdb_java/com_sleepycat_db_DbMpoolFStat.h new file mode 100644 index 00000000000..ed1d29054d9 --- /dev/null +++ b/mozilla/db/libdb_java/com_sleepycat_db_DbMpoolFStat.h @@ -0,0 +1,85 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_sleepycat_db_DbMpoolFStat */ + +#ifndef _Included_com_sleepycat_db_DbMpoolFStat +#define _Included_com_sleepycat_db_DbMpoolFStat +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sleepycat_db_DbMpoolFStat + * Method: finalize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbMpoolFStat_finalize + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpoolFStat + * Method: get_file_name + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sleepycat_db_DbMpoolFStat_get_1file_1name + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpoolFStat + * Method: get_st_cache_hit + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbMpoolFStat_get_1st_1cache_1hit + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpoolFStat + * Method: get_st_cache_miss + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbMpoolFStat_get_1st_1cache_1miss + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpoolFStat + * Method: get_st_map + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbMpoolFStat_get_1st_1map + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpoolFStat + * Method: get_st_page_create + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbMpoolFStat_get_1st_1page_1create + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpoolFStat + * Method: get_st_page_in + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbMpoolFStat_get_1st_1page_1in + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpoolFStat + * Method: get_st_page_out + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbMpoolFStat_get_1st_1page_1out + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpoolFStat + * Method: get_st_pagesize + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbMpoolFStat_get_1st_1pagesize + (JNIEnv *, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/mozilla/db/libdb_java/com_sleepycat_db_DbMpoolStat.h b/mozilla/db/libdb_java/com_sleepycat_db_DbMpoolStat.h new file mode 100644 index 00000000000..c4689863a56 --- /dev/null +++ b/mozilla/db/libdb_java/com_sleepycat_db_DbMpoolStat.h @@ -0,0 +1,125 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_sleepycat_db_DbMpoolStat */ + +#ifndef _Included_com_sleepycat_db_DbMpoolStat +#define _Included_com_sleepycat_db_DbMpoolStat +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sleepycat_db_DbMpoolStat + * Method: finalize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbMpoolStat_finalize + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpoolStat + * Method: get_st_cache_hit + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbMpoolStat_get_1st_1cache_1hit + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpoolStat + * Method: get_st_cache_miss + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbMpoolStat_get_1st_1cache_1miss + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpoolStat + * Method: get_st_cachesize + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbMpoolStat_get_1st_1cachesize + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpoolStat + * Method: get_st_hash_buckets + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbMpoolStat_get_1st_1hash_1buckets + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpoolStat + * Method: get_st_hash_examined + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbMpoolStat_get_1st_1hash_1examined + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpoolStat + * Method: get_st_hash_longest + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbMpoolStat_get_1st_1hash_1longest + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpoolStat + * Method: get_st_hash_searches + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbMpoolStat_get_1st_1hash_1searches + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpoolStat + * Method: get_st_map + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbMpoolStat_get_1st_1map + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpoolStat + * Method: get_st_page_create + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbMpoolStat_get_1st_1page_1create + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpoolStat + * Method: get_st_page_in + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbMpoolStat_get_1st_1page_1in + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpoolStat + * Method: get_st_page_out + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbMpoolStat_get_1st_1page_1out + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpoolStat + * Method: get_st_ro_evict + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbMpoolStat_get_1st_1ro_1evict + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbMpoolStat + * Method: get_st_rw_evict + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_DbMpoolStat_get_1st_1rw_1evict + (JNIEnv *, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/mozilla/db/libdb_java/com_sleepycat_db_DbTxn.h b/mozilla/db/libdb_java/com_sleepycat_db_DbTxn.h new file mode 100644 index 00000000000..0c1046983d5 --- /dev/null +++ b/mozilla/db/libdb_java/com_sleepycat_db_DbTxn.h @@ -0,0 +1,53 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_sleepycat_db_DbTxn */ + +#ifndef _Included_com_sleepycat_db_DbTxn +#define _Included_com_sleepycat_db_DbTxn +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sleepycat_db_DbTxn + * Method: abort + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxn_abort + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbTxn + * Method: commit + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxn_commit + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbTxn + * Method: finalize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxn_finalize + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbTxn + * Method: id + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbTxn_id + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbTxn + * Method: prepare + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxn_prepare + (JNIEnv *, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/mozilla/db/libdb_java/com_sleepycat_db_DbTxnMgr.h b/mozilla/db/libdb_java/com_sleepycat_db_DbTxnMgr.h new file mode 100644 index 00000000000..03386a13779 --- /dev/null +++ b/mozilla/db/libdb_java/com_sleepycat_db_DbTxnMgr.h @@ -0,0 +1,69 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_sleepycat_db_DbTxnMgr */ + +#ifndef _Included_com_sleepycat_db_DbTxnMgr +#define _Included_com_sleepycat_db_DbTxnMgr +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sleepycat_db_DbTxnMgr + * Method: begin + * Signature: (Lcom/sleepycat/db/DbTxn;)Lcom/sleepycat/db/DbTxn; + */ +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbTxnMgr_begin + (JNIEnv *, jobject, jobject); + +/* + * Class: com_sleepycat_db_DbTxnMgr + * Method: checkpoint + * Signature: (II)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxnMgr_checkpoint + (JNIEnv *, jobject, jint, jint); + +/* + * Class: com_sleepycat_db_DbTxnMgr + * Method: close + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxnMgr_close + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbTxnMgr + * Method: finalize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxnMgr_finalize + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbTxnMgr + * Method: open + * Signature: (Ljava/lang/String;IILcom/sleepycat/db/DbEnv;)Lcom/sleepycat/db/DbTxnMgr; + */ +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbTxnMgr_open + (JNIEnv *, jclass, jstring, jint, jint, jobject); + +/* + * Class: com_sleepycat_db_DbTxnMgr + * Method: stat + * Signature: ()Lcom/sleepycat/db/DbTxnStat; + */ +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbTxnMgr_stat + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbTxnMgr + * Method: unlink + * Signature: (Ljava/lang/String;ILcom/sleepycat/db/DbEnv;)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxnMgr_unlink + (JNIEnv *, jclass, jstring, jint, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/mozilla/db/libdb_java/com_sleepycat_db_DbTxnStat.h b/mozilla/db/libdb_java/com_sleepycat_db_DbTxnStat.h new file mode 100644 index 00000000000..34602d15a16 --- /dev/null +++ b/mozilla/db/libdb_java/com_sleepycat_db_DbTxnStat.h @@ -0,0 +1,85 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_sleepycat_db_DbTxnStat */ + +#ifndef _Included_com_sleepycat_db_DbTxnStat +#define _Included_com_sleepycat_db_DbTxnStat +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sleepycat_db_DbTxnStat + * Method: finalize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxnStat_finalize + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbTxnStat + * Method: get_last_ckp + * Signature: ()Lcom/sleepycat/db/DbLsn; + */ +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbTxnStat_get_1last_1ckp + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbTxnStat + * Method: get_last_txnid + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbTxnStat_get_1last_1txnid + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbTxnStat + * Method: get_maxtxns + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbTxnStat_get_1maxtxns + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbTxnStat + * Method: get_naborts + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbTxnStat_get_1naborts + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbTxnStat + * Method: get_nbegins + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbTxnStat_get_1nbegins + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbTxnStat + * Method: get_ncommits + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbTxnStat_get_1ncommits + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbTxnStat + * Method: get_pending_ckp + * Signature: ()Lcom/sleepycat/db/DbLsn; + */ +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbTxnStat_get_1pending_1ckp + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_DbTxnStat + * Method: get_time_ckp + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbTxnStat_get_1time_1ckp + (JNIEnv *, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/mozilla/db/libdb_java/com_sleepycat_db_Dbc.h b/mozilla/db/libdb_java/com_sleepycat_db_Dbc.h new file mode 100644 index 00000000000..48d77ffc0bd --- /dev/null +++ b/mozilla/db/libdb_java/com_sleepycat_db_Dbc.h @@ -0,0 +1,53 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_sleepycat_db_Dbc */ + +#ifndef _Included_com_sleepycat_db_Dbc +#define _Included_com_sleepycat_db_Dbc +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sleepycat_db_Dbc + * Method: close + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbc_close + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_Dbc + * Method: del + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbc_del + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_Dbc + * Method: finalize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbc_finalize + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_Dbc + * Method: get + * Signature: (Lcom/sleepycat/db/Dbt;Lcom/sleepycat/db/Dbt;I)I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbc_get + (JNIEnv *, jobject, jobject, jobject, jint); + +/* + * Class: com_sleepycat_db_Dbc + * Method: put + * Signature: (Lcom/sleepycat/db/Dbt;Lcom/sleepycat/db/Dbt;I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbc_put + (JNIEnv *, jobject, jobject, jobject, jint); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/mozilla/db/libdb_java/com_sleepycat_db_Dbt.h b/mozilla/db/libdb_java/com_sleepycat_db_Dbt.h new file mode 100644 index 00000000000..daeda9897ff --- /dev/null +++ b/mozilla/db/libdb_java/com_sleepycat_db_Dbt.h @@ -0,0 +1,157 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_sleepycat_db_Dbt */ + +#ifndef _Included_com_sleepycat_db_Dbt +#define _Included_com_sleepycat_db_Dbt +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sleepycat_db_Dbt + * Method: finalize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_finalize + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_Dbt + * Method: get_data + * Signature: ()[B + */ +JNIEXPORT jbyteArray JNICALL Java_com_sleepycat_db_Dbt_get_1data + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_Dbt + * Method: get_dlen + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbt_get_1dlen + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_Dbt + * Method: get_doff + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbt_get_1doff + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_Dbt + * Method: get_flags + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbt_get_1flags + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_Dbt + * Method: get_offset + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbt_get_1offset + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_Dbt + * Method: get_recno_key_data + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbt_get_1recno_1key_1data + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_Dbt + * Method: get_size + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbt_get_1size + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_Dbt + * Method: get_ulen + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbt_get_1ulen + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_Dbt + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_init + (JNIEnv *, jobject); + +/* + * Class: com_sleepycat_db_Dbt + * Method: internal_set_data + * Signature: ([B)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_internal_1set_1data + (JNIEnv *, jobject, jbyteArray); + +/* + * Class: com_sleepycat_db_Dbt + * Method: set_dlen + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_set_1dlen + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_Dbt + * Method: set_doff + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_set_1doff + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_Dbt + * Method: set_flags + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_set_1flags + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_Dbt + * Method: set_offset + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_set_1offset + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_Dbt + * Method: set_recno_key_data + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_set_1recno_1key_1data + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_Dbt + * Method: set_size + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_set_1size + (JNIEnv *, jobject, jint); + +/* + * Class: com_sleepycat_db_Dbt + * Method: set_ulen + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_set_1ulen + (JNIEnv *, jobject, jint); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/mozilla/db/libdb_java/java_Db.cpp b/mozilla/db/libdb_java/java_Db.cpp new file mode 100644 index 00000000000..67189041c3a --- /dev/null +++ b/mozilla/db/libdb_java/java_Db.cpp @@ -0,0 +1,200 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)java_Db.cpp 10.4 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include +#include +#include +#include + +#include "db.h" +#include "java_util.h" +#include "com_sleepycat_db_Db.h" + +JNIEXPORT void JNICALL Java_com_sleepycat_db_Db_close + (JNIEnv *jnienv, /*Db*/ jobject jthis, jint flags) +{ + int err; + DB *db = get_DB(jnienv, jthis); + + if (!verify_non_null(jnienv, db)) + return; + err = db->close(db, flags); + if (verify_return(jnienv, err)) + { + set_private_info(jnienv, name_DB, jthis, 0); + } +} + +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_Db_cursor + (JNIEnv *jnienv, /*Db*/ jobject jthis, /*DbTxn*/ jobject txnid) +{ + int err; + DB *db = get_DB(jnienv, jthis); + DB_TXN *dbtxnid = get_DB_TXN(jnienv, txnid); + + if (!verify_non_null(jnienv, db)) + return NULL; + DBC *dbc; + err = db->cursor(db, dbtxnid, &dbc); + verify_return(jnienv, err); + return get_Dbc(jnienv, dbc); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_Db_del + (JNIEnv *jnienv, /*Db*/ jobject jthis, /*DbTxn*/ jobject txnid, + /*Dbt*/ jobject key, jint dbflags) +{ + int err; + DB *db = get_DB(jnienv, jthis); + if (!verify_non_null(jnienv, db)) + return; + DB_TXN *dbtxnid = get_DB_TXN(jnienv, txnid); + LockedDBT dbkey(jnienv, key, 0); + if (dbkey.has_error()) + return; + + err = db->del(db, dbtxnid, dbkey.dbt, dbflags); + verify_return(jnienv, err); +} + +JNIEXPORT jint JNICALL Java_com_sleepycat_db_Db_fd + (JNIEnv *jnienv, /*Db*/ jobject jthis) +{ + int err; + int return_value = 0; + DB *db = get_DB(jnienv, jthis); + + if (!verify_non_null(jnienv, db)) + return 0; + err = db->fd(db, &return_value); + verify_return(jnienv, err); + return return_value; +} + +JNIEXPORT jint JNICALL Java_com_sleepycat_db_Db_get + (JNIEnv *jnienv, /*Db*/ jobject jthis, /*DbTxn*/ jobject txnid, + /*Dbt*/ jobject key, /*Dbt*/ jobject data, jint flags) +{ + int err; + DB *db = get_DB(jnienv, jthis); + DB_TXN *dbtxnid = get_DB_TXN(jnienv, txnid); + LockedDBT dbkey(jnienv, key, 0); + if (dbkey.has_error()) + return 0; + LockedDBT dbdata(jnienv, data, 1); + if (dbdata.has_error()) + return 0; + + if (!verify_non_null(jnienv, db)) + return 0; + err = db->get(db, dbtxnid, dbkey.dbt, dbdata.dbt, flags); + if (err != 0 && err != DB_NOTFOUND) { + verify_return(jnienv, err); + } + return err; +} + +JNIEXPORT jint JNICALL Java_com_sleepycat_db_Db_put + (JNIEnv *jnienv, /*Db*/ jobject jthis, /*DbTxn*/ jobject txnid, + /*Dbt*/ jobject key, /*Dbt*/ jobject data, jint flags) +{ + int err; + DB *db = get_DB(jnienv, jthis); + DB_TXN *dbtxnid = get_DB_TXN(jnienv, txnid); + LockedDBT dbkey(jnienv, key, 0); + if (dbkey.has_error()) + return 0; + LockedDBT dbdata(jnienv, data, 0); + if (dbdata.has_error()) + return 0; + + if (!verify_non_null(jnienv, db)) + return 0; + err = db->put(db, dbtxnid, dbkey.dbt, dbdata.dbt, flags); + if (err != 0 && err != DB_KEYEXIST) { + verify_return(jnienv, err); + } + return err; +} + +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_Db_stat + (JNIEnv *jnienv, jobject jthis, jint flags) +{ + int err; + DB *db = get_DB(jnienv, jthis); + DB_BTREE_STAT *statp = 0; + + if (!verify_non_null(jnienv, db)) + return 0; + + err = db->stat(db, &statp, 0, flags); + verify_return(jnienv, err); + return get_DbBtreeStat(jnienv, statp); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_Db_sync + (JNIEnv *jnienv, /*Db*/ jobject jthis, jint flags) +{ + int err; + DB *db = get_DB(jnienv, jthis); + + if (!verify_non_null(jnienv, db)) + return; + err = db->sync(db, flags); + verify_return(jnienv, err); +} + +JNIEXPORT jint JNICALL Java_com_sleepycat_db_Db_get_1type + (JNIEnv *jnienv, /*Db*/ jobject jthis) +{ + DB *db = get_DB(jnienv, jthis); + if (!verify_non_null(jnienv, db)) + return 0; + + return (jint)db->type; +} + +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_Db_open + (JNIEnv *jnienv, /*static Db*/ jclass /*jthis_class*/, + jstring fname, jint type, jint flags, jint mode, + /*DbEnv*/ jobject dbenv, /*DbInfo*/ jobject info) +{ + int err; + jobject retval = NULL; + DB *db; + DB_ENV *db_dbenv = get_DB_ENV(jnienv, dbenv); + DB_INFO *dbinfo = get_DB_INFO(jnienv, info); + LockedString dbfname(jnienv, fname); + + if (verify_non_null(jnienv, db_dbenv)) { + flags |= DB_THREAD; + err = db_open(dbfname.string, (DBTYPE)type, flags, mode, + db_dbenv, dbinfo, &db); + if (verify_return(jnienv, err)) { + db->db_malloc = java_db_malloc; + retval = create_default_object(jnienv, name_DB); + set_private_info(jnienv, name_DB, retval, db); + } + } + return retval; +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_Db_finalize + (JNIEnv *jnienv, jobject jthis) +{ + DB *db = get_DB(jnienv, jthis); + if (db) { + // Free any info related to DB here. + // Unfortunately, we cannot really autoclose because + // finalize is not called in any particular order + } +} diff --git a/mozilla/db/libdb_java/java_DbBtreeStat.cpp b/mozilla/db/libdb_java/java_DbBtreeStat.cpp new file mode 100644 index 00000000000..7b0670b22bb --- /dev/null +++ b/mozilla/db/libdb_java/java_DbBtreeStat.cpp @@ -0,0 +1,60 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)java_DbBtreeStat.cpp 10.2 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include +#include +#include +#include + +#include "db.h" +#include "java_util.h" +#include "com_sleepycat_db_DbBtreeStat.h" + +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1flags, DB_BTREE_STAT, bt_flags) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1maxkey, DB_BTREE_STAT, bt_maxkey) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1minkey, DB_BTREE_STAT, bt_minkey) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1re_1len, DB_BTREE_STAT, bt_re_len) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1re_1pad, DB_BTREE_STAT, bt_re_pad) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1pagesize, DB_BTREE_STAT, bt_pagesize) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1levels, DB_BTREE_STAT, bt_levels) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1nrecs, DB_BTREE_STAT, bt_nrecs) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1int_1pg, DB_BTREE_STAT, bt_int_pg) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1leaf_1pg, DB_BTREE_STAT, bt_leaf_pg) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1dup_1pg, DB_BTREE_STAT, bt_dup_pg) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1over_1pg, DB_BTREE_STAT, bt_over_pg) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1free, DB_BTREE_STAT, bt_free) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1freed, DB_BTREE_STAT, bt_freed) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1int_1pgfree, DB_BTREE_STAT, bt_int_pgfree) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1leaf_1pgfree, DB_BTREE_STAT, bt_leaf_pgfree) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1dup_1pgfree, DB_BTREE_STAT, bt_dup_pgfree) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1over_1pgfree, DB_BTREE_STAT, bt_over_pgfree) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1pfxsaved, DB_BTREE_STAT, bt_pfxsaved) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1split, DB_BTREE_STAT, bt_split) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1rootsplit, DB_BTREE_STAT, bt_rootsplit) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1fastsplit, DB_BTREE_STAT, bt_fastsplit) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1added, DB_BTREE_STAT, bt_added) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1deleted, DB_BTREE_STAT, bt_deleted) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1get, DB_BTREE_STAT, bt_get) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1cache_1hit, DB_BTREE_STAT, bt_cache_hit) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1cache_1miss, DB_BTREE_STAT, bt_cache_miss) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1magic, DB_BTREE_STAT, bt_magic) +JAVADB_RO_ACCESS(DbBtreeStat, jlong, bt_1version, DB_BTREE_STAT, bt_version) + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbBtreeStat_finalize + (JNIEnv *jnienv, jobject jthis) +{ + DB_BTREE_STAT *db_btree_stat = get_DB_BTREE_STAT(jnienv, jthis); + if (db_btree_stat) { + // Free any data related to DB_BTREE_STAT here + free(db_btree_stat); + } +} diff --git a/mozilla/db/libdb_java/java_DbEnv.cpp b/mozilla/db/libdb_java/java_DbEnv.cpp new file mode 100644 index 00000000000..89d0053a906 --- /dev/null +++ b/mozilla/db/libdb_java/java_DbEnv.cpp @@ -0,0 +1,316 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)java_DbEnv.cpp 10.4 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include +#include +#include +#include + +#include "db.h" +#include "java_util.h" +#include "com_sleepycat_db_DbEnv.h" + +// XXX TODO: +// A prefix_info is allocated and stuffed into the db_errpfx for +// every DB_ENV created. It holds a little extra info that is +// needed to resurrect the environment to make a callback. +// Strictly speaking, we only need this stuffed in if db_errfcn +// is set, but it's easier to always allocate it in the constructor +// and know it's always there. +// +// Note: We assume the following: +// We are the only one fiddling with the contents of db_errpfx and +// db_errcall. In particular, db_errpfx and db_errcall are not +// initialized by appinit to some default value. +// +struct prefix_info +{ + JNIEnv *jnienv; + char *orig_prefix; + jobject dberrcall; +}; + +static void java_errcall_callback(const char *prefix, char *message) +{ + prefix_info *pi = (prefix_info *)prefix; + + // Note: these error cases are "impossible", and would + // normally warrant an exception. However, without + // a jnienv, we cannot throw an exception... + // We don't want to trap or exit, since the point of + // this facility is for the user to completely control + // error situations. + // + // TODO: find another way to indicate this error. + // + if (!pi) + return; // These are really fatal asserts + + if (!pi->dberrcall) + return; // These are really fatal asserts + + if (!pi->jnienv) + return; // These are really fatal asserts + + jstring pre = get_java_string(pi->jnienv, pi->orig_prefix); + jstring msg = get_java_string(pi->jnienv, message); + jclass errcall_class = get_class(pi->jnienv, name_DbErrcall); + jmethodID id = pi->jnienv->GetMethodID(errcall_class, + "errcall", + "(Ljava/lang/String;Ljava/lang/String;)V"); + if (!id) + return; + + pi->jnienv->CallVoidMethod(pi->dberrcall, id, pre, msg); +} + +JAVADB_RW_ACCESS(DbEnv, jint, lorder, DB_ENV, db_lorder) +JAVADB_RW_ACCESS(DbEnv, jint, verbose, DB_ENV, db_verbose) +JAVADB_RW_ACCESS_STRING(DbEnv, home, DB_ENV, db_home, 0) +JAVADB_RW_ACCESS_STRING(DbEnv, log_1dir, DB_ENV, db_log_dir, 0) +JAVADB_RW_ACCESS_STRING(DbEnv, tmp_1dir, DB_ENV, db_tmp_dir, 0) +JAVADB_RW_ACCESS(DbEnv, jint, lk_1modes, DB_ENV, lk_modes) +JAVADB_RW_ACCESS(DbEnv, jint, lk_1max, DB_ENV, lk_max) +JAVADB_RW_ACCESS(DbEnv, jint, lk_1detect, DB_ENV, lk_detect) +JAVADB_RW_ACCESS(DbEnv, jint, data_1cnt, DB_ENV, data_cnt) +JAVADB_RW_ACCESS(DbEnv, jint, data_1next, DB_ENV, data_next) +JAVADB_RW_ACCESS(DbEnv, jint, lg_1max, DB_ENV, lg_max) +JAVADB_RW_ACCESS(DbEnv, jlong, mp_1mmapsize, DB_ENV, mp_mmapsize) +JAVADB_RW_ACCESS(DbEnv, jlong, mp_1size, DB_ENV, mp_size) +JAVADB_RW_ACCESS(DbEnv, jint, tx_1max, DB_ENV, tx_max) +JAVADB_RW_ACCESS(DbEnv, jint, flags, DB_ENV, flags) + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_init + (JNIEnv *jnienv, jobject jthis) +{ + DB_ENV *dbenv = NEW(DB_ENV); + memset(dbenv, 0, sizeof(DB_ENV)); + prefix_info *pi = NEW(prefix_info); + pi->jnienv = 0; + pi->orig_prefix = 0; + pi->dberrcall = 0; + dbenv->db_errpfx = (const char*)pi; + set_private_info(jnienv, name_DB_ENV, jthis, dbenv); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_appinit + (JNIEnv *jnienv, /*DbEnv*/ jobject jthis, jstring homeDir, + jobjectArray /*String[]*/ db_config, jint flags) +{ + int err; + DB_ENV *dbenv = get_DB_ENV(jnienv, jthis); + LockedString dbhomeDir(jnienv, homeDir); + LockedStringArray db_db_config(jnienv, db_config); + + // Always turn on the thread flag for use with java. + flags |= DB_THREAD; + + err = db_appinit(dbhomeDir.string, + (char *const *)db_db_config.string_array, + dbenv, flags); + if (verify_return(jnienv, err)) { + jclass dbenvClass = get_class(jnienv, name_DB_ENV); + jobject obj; + if (dbenv->lk_info) { + obj = get_DbLockTab(jnienv, dbenv->lk_info); + set_object_field(jnienv, dbenvClass, jthis, name_DB_LOCKTAB, + "lk_info_", obj); + } + if (dbenv->lg_info) { + obj = get_DbLog(jnienv, dbenv->lg_info); + set_object_field(jnienv, dbenvClass, jthis, name_DB_LOG, + "lg_info_", obj); + } + if (dbenv->mp_info) { + obj = get_DbMpool(jnienv, dbenv->mp_info); + set_object_field(jnienv, dbenvClass, jthis, name_DB_MPOOL, + "mp_info_", obj); + } + if (dbenv->tx_info) { + obj = get_DbTxnMgr(jnienv, dbenv->tx_info); + set_object_field(jnienv, dbenvClass, jthis, name_DB_TXNMGR, + "tx_info_", obj); + } + } +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_appexit + (JNIEnv *jnienv, /*DbEnv*/ jobject jthis) +{ + int err; + DB_ENV *dbenv = get_DB_ENV(jnienv, jthis); + + if (dbenv) { + err = db_appexit(dbenv); + set_private_info(jnienv, name_DB_ENV, jthis, 0); + verify_return(jnienv, err); + } +} + + +// Make a copy of the lk_conflict array to pass back to the user +// (different semantics from C/C++, where the user gets a real memory +// array that they can manipulate. +// +JNIEXPORT jobjectArray JNICALL Java_com_sleepycat_db_DbEnv_get_1lk_1conflicts + (JNIEnv *jnienv, jobject jthis) +{ + DB_ENV *dbenv = get_DB_ENV(jnienv, jthis); + + if (!verify_non_null(jnienv, dbenv)) + return 0; + + // create array of array of bytes + jclass bytearray_class = jnienv->FindClass("[B"); + int len = dbenv->lk_modes; + jobjectArray array = jnienv->NewObjectArray(len, bytearray_class, 0); + for (int i=0; iNewByteArray(len); + jnienv->SetByteArrayRegion(subArray, 0, len, + (jbyte *)&dbenv->lk_conflicts[i*len]); + } + return array; +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1lk_1conflicts + (JNIEnv *jnienv, jobject jthis, jobjectArray array) +{ + DB_ENV *dbenv = get_DB_ENV(jnienv, jthis); + static const char * const array_length_msg = + "array length does not match lk_modes"; + + if (!verify_non_null(jnienv, dbenv)) + return; + + int len = dbenv->lk_modes; + jsize jlen = jnienv->GetArrayLength(array); + if (jlen != len) { + report_exception(jnienv, array_length_msg, 0); + return; + } + + // TODO: possibly delete old contents, and delete this array + // in destructor. How to distinguish from "default" value? + // + dbenv->lk_conflicts = NEW_ARRAY(unsigned char, len * len); + + for (int i=0; iGetObjectArrayElement(array, i); + jnienv->GetByteArrayRegion((jbyteArray)subArray, 0, len, + (jbyte *)&dbenv->lk_conflicts[i*len]); + } +} + +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_get_1version_1major + (JNIEnv *jnienv, jclass /*this_class*/) +{ + return DB_VERSION_MAJOR; +} + +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_get_1version_1minor + (JNIEnv *jnienv, jclass /*this_class*/) +{ + return DB_VERSION_MINOR; +} + +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_get_1version_1patch + (JNIEnv *jnienv, jclass /*this_class*/) +{ + return DB_VERSION_PATCH; +} + +JNIEXPORT jstring JNICALL Java_com_sleepycat_db_DbEnv_get_1version_1string + (JNIEnv *jnienv, jclass /*this_class*/) +{ + return jnienv->NewStringUTF(DB_VERSION_STRING); +} + +// See discussion on errpfx above +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1errcall + (JNIEnv *jnienv, jobject jthis, jobject errcall) +{ + DB_ENV *dbenv = get_DB_ENV(jnienv, jthis); + + if (verify_non_null(jnienv, dbenv)) { + prefix_info *pi = (prefix_info*)(dbenv->db_errpfx); + if (pi->dberrcall) { + jnienv->DeleteGlobalRef(pi->dberrcall); + } + if (errcall) { + pi->dberrcall = jnienv->NewGlobalRef(errcall); + dbenv->db_errcall = java_errcall_callback; + pi->jnienv = jnienv; + } + else { + pi->dberrcall = 0; + dbenv->db_errcall = 0; + pi->jnienv = 0; + } + } +} + +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbEnv_get_1errcall + (JNIEnv *jnienv, jobject jthis) +{ + DB_ENV *dbenv = get_DB_ENV(jnienv, jthis); + + if (verify_non_null(jnienv, dbenv)) { + prefix_info *pi = (prefix_info*)(dbenv->db_errpfx); + return pi->dberrcall; + } + return 0; +} + +JNIEXPORT jstring JNICALL Java_com_sleepycat_db_DbEnv_get_1errpfx + (JNIEnv *jnienv, jobject jthis) +{ + DB_ENV *dbenv = get_DB_ENV(jnienv, jthis); + + if (verify_non_null(jnienv, dbenv)) { + prefix_info *pi = (prefix_info*)(dbenv->db_errpfx); + return get_java_string(jnienv, pi->orig_prefix); + } + return 0; +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1errpfx + (JNIEnv *jnienv, jobject jthis, jstring str) +{ + DB_ENV *dbenv = get_DB_ENV(jnienv, jthis); + + if (verify_non_null(jnienv, dbenv)) { + prefix_info *pi = (prefix_info*)(dbenv->db_errpfx); + if (pi->orig_prefix) + DELETE(pi->orig_prefix); + if (str) + pi->orig_prefix = + dup_string(jnienv->GetStringUTFChars(str, NULL)); + else + pi->orig_prefix = 0; + } +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_finalize + (JNIEnv *jnienv, jobject jthis) +{ + DB_ENV *dbenv = get_DB_ENV(jnienv, jthis); + if (dbenv) { + // Free any data related to DB_ENV here + prefix_info *pi = (prefix_info*)dbenv->db_errpfx; + if (pi) + DELETE(pi); + DELETE(dbenv); + } + + // Shouldn't see this object again, but just in case + set_private_info(jnienv, name_DB_ENV, jthis, 0); +} diff --git a/mozilla/db/libdb_java/java_DbInfo.cpp b/mozilla/db/libdb_java/java_DbInfo.cpp new file mode 100644 index 00000000000..66751b1300d --- /dev/null +++ b/mozilla/db/libdb_java/java_DbInfo.cpp @@ -0,0 +1,89 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)java_DbInfo.cpp 10.3 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include +#include +#include +#include + +#include "db.h" +#include "java_util.h" +#include "com_sleepycat_db_DbInfo.h" + +JAVADB_RW_ACCESS(DbInfo, jint, lorder, DB_INFO, db_lorder) +JAVADB_RW_ACCESS(DbInfo, jlong, cachesize, DB_INFO, db_cachesize) +JAVADB_RW_ACCESS(DbInfo, jlong, pagesize, DB_INFO, db_pagesize) +JAVADB_RW_ACCESS(DbInfo, jint, bt_1maxkey, DB_INFO, bt_maxkey) +JAVADB_RW_ACCESS(DbInfo, jint, bt_1minkey, DB_INFO, bt_minkey) +JAVADB_RW_ACCESS(DbInfo, jint, h_1ffactor, DB_INFO, h_ffactor) +JAVADB_RW_ACCESS(DbInfo, jint, h_1nelem, DB_INFO, h_nelem) +JAVADB_RW_ACCESS(DbInfo, jint, re_1pad, DB_INFO, re_pad) +JAVADB_RW_ACCESS(DbInfo, jint, re_1delim, DB_INFO, re_delim) +JAVADB_RW_ACCESS(DbInfo, jint, re_1len, DB_INFO, re_len) +// TODO: JAVADB_RW_ACCESS_STRING(DbInfo, re_1source, DB_INFO, re_source) +JAVADB_RW_ACCESS(DbInfo, jint, flags, DB_INFO, flags) + + +/* Initialize one DbInfo object from another. + * If jthat is null, make this a default initialization. + */ +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbInfo_init_1from + (JNIEnv *jnienv, jobject jthis, /*DbInfo*/ jobject jthat) +{ + DB_INFO *dbthis = NEW(DB_INFO); + DB_INFO *dbthat = get_DB_INFO(jnienv, jthat); + if (dbthat != 0) { + *dbthis = *dbthat; + } + else { + memset(dbthis, 0, sizeof(DB_INFO)); + dbthis->db_malloc = java_db_malloc; + } + set_private_info(jnienv, name_DB_INFO, jthis, dbthis); +} + +JNIEXPORT jstring JNICALL Java_com_sleepycat_db_DbInfo_get_1re_1source + (JNIEnv *jnienv, jobject jthis) +{ + DB_INFO *dbinfo = get_DB_INFO(jnienv, jthis); + if (!verify_non_null(jnienv, dbinfo)) + return 0; + + if (!dbinfo->re_source) + return 0; + + return jnienv->NewStringUTF(dbinfo->re_source); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbInfo_set_1re_1source + (JNIEnv *jnienv, jobject jthis, jstring value) +{ + DB_INFO *dbinfo = get_DB_INFO(jnienv, jthis); + if (!verify_non_null(jnienv, dbinfo)) + return; + + LockedString re_source(jnienv, value); + dbinfo->re_source = dup_string(re_source.string); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbInfo_finalize + (JNIEnv *jnienv, jobject jthis) +{ + DB_INFO *dbinfo = get_DB_INFO(jnienv, jthis); + if (dbinfo) { + if (dbinfo->re_source) + DELETE(dbinfo->re_source); + + // Free any data related to DB_INFO here + DELETE(dbinfo); + } +} diff --git a/mozilla/db/libdb_java/java_DbLock.cpp b/mozilla/db/libdb_java/java_DbLock.cpp new file mode 100644 index 00000000000..4d4f2560ba2 --- /dev/null +++ b/mozilla/db/libdb_java/java_DbLock.cpp @@ -0,0 +1,56 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)java_DbLock.cpp 10.2 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include +#include +#include +#include + +#include "db.h" +#include "java_util.h" +#include "com_sleepycat_db_DbLock.h" + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLock_put + (JNIEnv *jnienv, jobject jthis, /*DbLockTab*/ jobject locktab) +{ + int err; + DB_LOCK dblock = get_DB_LOCK(jnienv, jthis); + DB_LOCKTAB *dblocktab = get_DB_LOCKTAB(jnienv, locktab); + + if (!verify_non_null(jnienv, dblocktab)) + return; + + err = lock_put(dblocktab, dblock); + if (verify_return(jnienv, err)) + { + set_private_info(jnienv, name_DB_LOCK, jthis, 0); + } +} + +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLock_get_1lock_1id + (JNIEnv *jnienv, jobject jthis) +{ + return get_DB_LOCK(jnienv, jthis); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLock_set_1lock_1id + (JNIEnv *jnienv, jobject jthis, jint lockid) +{ + set_private_long_info(jnienv, name_DB_LOCK, jthis, lockid); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLock_finalize + (JNIEnv *jnienv, jobject jthis) +{ + // no data related to DB_LOCK needs to be freed. + set_private_info(jnienv, name_DB_LOCK, jthis, 0); +} diff --git a/mozilla/db/libdb_java/java_DbLockTab.cpp b/mozilla/db/libdb_java/java_DbLockTab.cpp new file mode 100644 index 00000000000..5bbf2b2f3d4 --- /dev/null +++ b/mozilla/db/libdb_java/java_DbLockTab.cpp @@ -0,0 +1,130 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)java_DbLockTab.cpp 10.3 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include +#include +#include +#include + +#include "db.h" +#include "java_util.h" +#include "com_sleepycat_db_DbLockTab.h" + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLockTab_close + (JNIEnv *jnienv, /*DbLocktab*/ jobject jthis) +{ + int err; + DB_LOCKTAB *dblocktab = get_DB_LOCKTAB(jnienv, jthis); + + if (!verify_non_null(jnienv, dblocktab)) + return; + err = lock_close(dblocktab); + if (verify_return(jnienv, err)) + { + set_private_info(jnienv, name_DB_LOCKTAB, jthis, 0); + } +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLockTab_detect + (JNIEnv *jnienv, jobject jthis, jint atype, jint flags) +{ + int err; + DB_LOCKTAB *dblocktab = get_DB_LOCKTAB(jnienv, jthis); + + if (!verify_non_null(jnienv, dblocktab)) + return; + err = lock_detect(dblocktab, atype, flags); + verify_return(jnienv, err); +} + +JNIEXPORT /*DbLock*/ jobject JNICALL Java_com_sleepycat_db_DbLockTab_get + (JNIEnv *jnienv, jobject jthis, /*u_int32_t*/ jint locker, + jint flags, /*const Dbt*/ jobject obj, /*db_lockmode_t*/ jint lock_mode) +{ + int err; + DB_LOCKTAB *dblocktab = get_DB_LOCKTAB(jnienv, jthis); + DB_LOCK dblock; + LockedDBT dbobj(jnienv, obj, 0); + if (dbobj.has_error()) + return 0; + /*DbLock*/ jobject retval = NULL; + + if (!verify_non_null(jnienv, dblocktab)) + return retval; + err = lock_get(dblocktab, locker, flags, dbobj.dbt, + (db_lockmode_t)lock_mode, &dblock); + if (verify_return(jnienv, err)) { + retval = create_default_object(jnienv, name_DB_LOCK); + set_private_long_info(jnienv, name_DB_LOCK, retval, dblock); + } + return retval; +} + +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLockTab_id + (JNIEnv *jnienv, jobject jthis) +{ + int err; + DB_LOCKTAB *dblocktab = get_DB_LOCKTAB(jnienv, jthis); + + if (!verify_non_null(jnienv, dblocktab)) + return -1; + u_int32_t id; + err = lock_id(dblocktab, &id); + verify_return(jnienv, err); + return id; +} + +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbLockTab_open + (JNIEnv *jnienv, jclass jthis_class, jstring dir, jint flags, + jint mode, /*DbEnv*/ jobject dbenv) +{ + int err; + jobject retval = NULL; + DB_LOCKTAB *dblocktab; + DB_ENV *db_dbenv = get_DB_ENV(jnienv, dbenv); + LockedString dbdir(jnienv, dir); + + if (verify_non_null(jnienv, db_dbenv)) { + err = lock_open(dbdir.string, flags, mode, + db_dbenv, &dblocktab); + if (verify_return(jnienv, err)) { + retval = create_default_object(jnienv, name_DB_LOCKTAB); + set_private_info(jnienv, name_DB_LOCKTAB, retval, dblocktab); + } + } + return retval; +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLockTab_unlink + (JNIEnv *jnienv, jclass jthis_class, jstring dir, jint force, + /*DbEnv*/ jobject dbenv) +{ + int err; + DB_ENV *db_dbenv = get_DB_ENV(jnienv, dbenv); + LockedString dbdir(jnienv, dir); + + if (verify_non_null(jnienv, db_dbenv)) { + err = lock_unlink(dbdir.string, force, db_dbenv); + verify_return(jnienv, err); + } +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLockTab_finalize + (JNIEnv *jnienv, jobject jthis) +{ + DB_LOCKTAB *dblocktab = get_DB_LOCKTAB(jnienv, jthis); + if (dblocktab) { + // Free any data related to DB_LOCKTAB here. + // Unfortunately, we cannot really autoclose because + // finalize is not called in any particular order + } +} diff --git a/mozilla/db/libdb_java/java_DbLog.cpp b/mozilla/db/libdb_java/java_DbLog.cpp new file mode 100644 index 00000000000..4975e2d651f --- /dev/null +++ b/mozilla/db/libdb_java/java_DbLog.cpp @@ -0,0 +1,210 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)java_DbLog.cpp 10.5 (Sleepycat) 5/2/98"; +#endif /* not lint */ + +#include +#include +#include +#include +#include // needed for FILENAME_MAX + +#include "db.h" +#include "java_util.h" +#include "com_sleepycat_db_DbLog.h" + +JNIEXPORT jobjectArray JNICALL Java_com_sleepycat_db_DbLog_archive + (JNIEnv *jnienv, /*DbLog*/ jobject jthis, jint flags) +{ + int err; + char** ret; + DB_LOG *dblog = get_DB_LOG(jnienv, jthis); + + if (!verify_non_null(jnienv, dblog)) + return 0; + err = log_archive(dblog, &ret, flags, 0); + if (!verify_return(jnienv, err)) + return 0; + + int len = 0; + while (ret[len] != NULL) + len++; + jclass stringClass = jnienv->FindClass("java/lang/String"); + jobjectArray strarray = jnienv->NewObjectArray(len, stringClass, 0); + for (int i=0; iNewStringUTF(ret[i]); + jnienv->SetObjectArrayElement(strarray, i, str); + } + return strarray; +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLog_close + (JNIEnv *jnienv, /*DbLog*/ jobject jthis) +{ + int err; + DB_LOG *dblog = get_DB_LOG(jnienv, jthis); + + if (!verify_non_null(jnienv, dblog)) + return; + err = log_close(dblog); + if (verify_return(jnienv, err)) + { + set_private_info(jnienv, name_DB_LOG, jthis, 0); + } +} + +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLog_compare + (JNIEnv *jnienv, jclass jthis_class, + /*DbLsn*/ jobject lsn0, /*DbLsn*/ jobject lsn1) +{ + DB_LSN *dblsn0 = get_DB_LSN(jnienv, lsn0); + DB_LSN *dblsn1 = get_DB_LSN(jnienv, lsn1); + + return log_compare(dblsn0, dblsn1); +} + +JNIEXPORT jstring JNICALL Java_com_sleepycat_db_DbLog_file + (JNIEnv *jnienv, jobject jthis, /*DbLsn*/ jobject lsn) +{ + int err; + DB_LOG *dblog = get_DB_LOG(jnienv, jthis); + DB_LSN *dblsn = get_DB_LSN(jnienv, lsn); + char filename[FILENAME_MAX+1] = ""; + + err = log_file(dblog, dblsn, filename, FILENAME_MAX); + verify_return(jnienv, err); + filename[FILENAME_MAX] = '\0'; // just to be sure + return get_java_string(jnienv, filename); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLog_flush + (JNIEnv *jnienv, jobject jthis, /*DbLsn*/ jobject lsn) +{ + int err; + DB_LOG *dblog = get_DB_LOG(jnienv, jthis); + DB_LSN *dblsn = get_DB_LSN(jnienv, lsn); + + err = log_flush(dblog, dblsn); + verify_return(jnienv, err); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLog_get + (JNIEnv *jnienv, jobject jthis, /*DbLsn*/ jobject lsn, + /*DbDbt*/ jobject data, jint flags) +{ + int err; + DB_LOG *dblog = get_DB_LOG(jnienv, jthis); + DB_LSN *dblsn = get_DB_LSN(jnienv, lsn); + LockedDBT dbdata(jnienv, data, 1); + if (dbdata.has_error()) + return; + + err = log_get(dblog, dblsn, dbdata.dbt, flags); + verify_return(jnienv, err); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLog_put + (JNIEnv *jnienv, jobject jthis, /*DbLsn*/ jobject lsn, + /*DbDbt*/ jobject data, jint flags) +{ + int err; + DB_LOG *dblog = get_DB_LOG(jnienv, jthis); + DB_LSN *dblsn = get_DB_LSN(jnienv, lsn); + LockedDBT dbdata(jnienv, data, 0); + if (dbdata.has_error()) + return; + + err = log_put(dblog, dblsn, dbdata.dbt, flags); + verify_return(jnienv, err); +} + +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLog_db_1register + (JNIEnv *jnienv, jobject jthis, /*Db*/ jobject dbp, + jstring name, jint dbtype) +{ + int err; + DB_LOG *dblog = get_DB_LOG(jnienv, jthis); + DB *dbdb = get_DB(jnienv, dbp); + LockedString dbname(jnienv, name); + u_int32_t result; + + err = log_register(dblog, dbdb, dbname.string, (DBTYPE)dbtype, &result); + verify_return(jnienv, err); + return result; +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLog_db_1unregister + (JNIEnv *jnienv, jobject jthis, jint fid) +{ + int err; + DB_LOG *dblog = get_DB_LOG(jnienv, jthis); + + err = log_unregister(dblog, fid); + verify_return(jnienv, err); +} + +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbLog_stat + (JNIEnv *jnienv, jobject jthis) +{ + int err; + DB_LOG *dblog = get_DB_LOG(jnienv, jthis); + DB_LOG_STAT *statp = 0; + + if (!verify_non_null(jnienv, dblog)) + return 0; + + err = log_stat(dblog, &statp, 0); + verify_return(jnienv, err); + return get_DbLogStat(jnienv, statp); +} + +JNIEXPORT /*DbLog*/ jobject JNICALL Java_com_sleepycat_db_DbLog_open + (JNIEnv *jnienv, jclass jthis_class, jstring dir, jint flags, + jint mode, /*DbEnv*/ jobject dbenv) +{ + int err; + jobject retval = NULL; + DB_LOG *dblog; + DB_ENV *db_dbenv = get_DB_ENV(jnienv, dbenv); + LockedString dbdir(jnienv, dir); + + if (verify_non_null(jnienv, db_dbenv)) { + err = log_open(dbdir.string, flags, mode, + db_dbenv, &dblog); + if (verify_return(jnienv, err)) { + retval = create_default_object(jnienv, name_DB_LOG); + set_private_info(jnienv, name_DB_LOG, retval, dblog); + } + } + return retval; +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLog_unlink + (JNIEnv *jnienv, jclass jthis_class, jstring dir, jint force, + /*DbEnv*/ jobject dbenv) +{ + int err; + DB_ENV *db_dbenv = get_DB_ENV(jnienv, dbenv); + LockedString dbdir(jnienv, dir); + + if (verify_non_null(jnienv, db_dbenv)) { + err = log_unlink(dbdir.string, force, db_dbenv); + verify_return(jnienv, err); + } +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLog_finalize + (JNIEnv *jnienv, jobject jthis) +{ + DB_LOG *dblog = get_DB_LOG(jnienv, jthis); + if (dblog) { + // Free any data related to DB_LOG here + } +} diff --git a/mozilla/db/libdb_java/java_DbLogStat.cpp b/mozilla/db/libdb_java/java_DbLogStat.cpp new file mode 100644 index 00000000000..dcde7cc0aa7 --- /dev/null +++ b/mozilla/db/libdb_java/java_DbLogStat.cpp @@ -0,0 +1,45 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)java_DbLogStat.cpp 10.1 (Sleepycat) 5/2/98"; +#endif /* not lint */ + +#include +#include +#include +#include + +#include "db.h" +#include "java_util.h" +#include "com_sleepycat_db_DbLogStat.h" + +JAVADB_RO_ACCESS(DbLogStat, jint, st_1magic, DB_LOG_STAT, st_magic) +JAVADB_RO_ACCESS(DbLogStat, jint, st_1version, DB_LOG_STAT, st_version) +JAVADB_RO_ACCESS(DbLogStat, jint, st_1mode, DB_LOG_STAT, st_mode) +JAVADB_RO_ACCESS(DbLogStat, jint, st_1lg_1max, DB_LOG_STAT, st_lg_max) +JAVADB_RO_ACCESS(DbLogStat, jint, st_1w_1bytes, DB_LOG_STAT, st_w_bytes) +JAVADB_RO_ACCESS(DbLogStat, jint, st_1w_1mbytes, DB_LOG_STAT, st_w_mbytes) +JAVADB_RO_ACCESS(DbLogStat, jint, st_1wc_1bytes, DB_LOG_STAT, st_wc_bytes) +JAVADB_RO_ACCESS(DbLogStat, jint, st_1wc_1mbytes, DB_LOG_STAT, st_wc_mbytes) +JAVADB_RO_ACCESS(DbLogStat, jint, st_1wcount, DB_LOG_STAT, st_wcount) +JAVADB_RO_ACCESS(DbLogStat, jint, st_1scount, DB_LOG_STAT, st_scount) +JAVADB_RO_ACCESS(DbLogStat, jint, st_1region_1wait, DB_LOG_STAT, st_region_wait) +JAVADB_RO_ACCESS(DbLogStat, jint, st_1region_1nowait, DB_LOG_STAT, st_region_nowait) +JAVADB_RO_ACCESS(DbLogStat, jint, st_1cur_1file, DB_LOG_STAT, st_cur_file) +JAVADB_RO_ACCESS(DbLogStat, jint, st_1cur_1offset, DB_LOG_STAT, st_cur_offset) + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLogStat_finalize + (JNIEnv *jnienv, jobject jthis) +{ + DB_LOG_STAT *db_log_stat = get_DB_LOG_STAT(jnienv, jthis); + if (db_log_stat) { + // Free any data related to DB_LOG_STAT here + free(db_log_stat); + } +} diff --git a/mozilla/db/libdb_java/java_DbLsn.cpp b/mozilla/db/libdb_java/java_DbLsn.cpp new file mode 100644 index 00000000000..8f30840abd7 --- /dev/null +++ b/mozilla/db/libdb_java/java_DbLsn.cpp @@ -0,0 +1,38 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)java_DbLsn.cpp 10.3 (Sleepycat) 5/2/98"; +#endif /* not lint */ + +#include +#include +#include +#include +#include // needed for FILENAME_MAX + +#include "db.h" +#include "java_util.h" +#include "com_sleepycat_db_DbLsn.h" + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLsn_init_1lsn + (JNIEnv *jnienv, /*DbLsn*/ jobject jthis) +{ + DB_LSN *lsn = NEW(DB_LSN); + memset(lsn, 0, sizeof(DB_LSN)); + set_private_info(jnienv, name_DB_LSN, jthis, lsn); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLsn_finalize + (JNIEnv *jnienv, jobject jthis) +{ + DB_LSN *dblsn = get_DB_LSN(jnienv, jthis); + if (dblsn) { + DELETE(dblsn); + } +} diff --git a/mozilla/db/libdb_java/java_DbMpool.cpp b/mozilla/db/libdb_java/java_DbMpool.cpp new file mode 100644 index 00000000000..6da54888bcc --- /dev/null +++ b/mozilla/db/libdb_java/java_DbMpool.cpp @@ -0,0 +1,90 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)java_DbMpool.cpp 10.4 (Sleepycat) 5/2/98"; +#endif /* not lint */ + +#include +#include +#include +#include + +#include "db.h" +#include "java_util.h" +#include "com_sleepycat_db_DbMpool.h" + +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbMpool_stat + (JNIEnv *jnienv, jobject jthis) +{ + int err; + DB_MPOOL *dbmpool = get_DB_MPOOL(jnienv, jthis); + DB_MPOOL_STAT *statp = 0; + + if (!verify_non_null(jnienv, dbmpool)) + return 0; + + err = memp_stat(dbmpool, &statp, 0, 0); + verify_return(jnienv, err); + return get_DbMpoolStat(jnienv, statp); +} + +JNIEXPORT jobjectArray JNICALL Java_com_sleepycat_db_DbMpool_fstat + (JNIEnv *jnienv, jobject jthis) +{ + int err; + DB_MPOOL *dbmpool = get_DB_MPOOL(jnienv, jthis); + DB_MPOOL_FSTAT **fstatp = 0; + + if (!verify_non_null(jnienv, dbmpool)) + return 0; + + err = memp_stat(dbmpool, 0, &fstatp, 0); + if (!verify_return(jnienv, err)) + return 0; + + int len = 0; + while (fstatp[len]) + len++; + jclass fstat_class = get_class(jnienv, name_DB_MPOOL_FSTAT); + jobjectArray array = jnienv->NewObjectArray(len, fstat_class, 0); + for (int i=0; iSetObjectArrayElement(array, i, obj); + } + + // Free the array of pointers now. The individual + // DB_MPOOL_FSTAT pointers will be be freed when + // each DbMpoolFStat object is GC'd. + // + free (fstatp); + return array; +} + +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbMpool_trickle + (JNIEnv *jnienv, jobject jthis, jint pct) +{ + int err; + DB_MPOOL *dbmpool = get_DB_MPOOL(jnienv, jthis); + int result = 0; + + if (verify_non_null(jnienv, dbmpool)) { + err = memp_trickle(dbmpool, pct, &result); + verify_return(jnienv, err); + } + return result; +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbMpool_finalize + (JNIEnv *jnienv, jobject jthis) +{ + DB_MPOOL *dbmpool = get_DB_MPOOL(jnienv, jthis); + if (dbmpool) { + // Free any data related to DB_MPOOL here + } +} diff --git a/mozilla/db/libdb_java/java_DbMpoolFStat.cpp b/mozilla/db/libdb_java/java_DbMpoolFStat.cpp new file mode 100644 index 00000000000..b075f3433b2 --- /dev/null +++ b/mozilla/db/libdb_java/java_DbMpoolFStat.cpp @@ -0,0 +1,39 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)java_DbMpoolFStat.cpp 10.2 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include +#include +#include +#include + +#include "db.h" +#include "java_util.h" +#include "com_sleepycat_db_DbMpoolFStat.h" + +JAVADB_RO_ACCESS_STRING(DbMpoolFStat, file_1name, DB_MPOOL_FSTAT, file_name, 0) +JAVADB_RO_ACCESS(DbMpoolFStat, jlong, st_1pagesize, DB_MPOOL_FSTAT, st_pagesize) +JAVADB_RO_ACCESS(DbMpoolFStat, jlong, st_1cache_1hit, DB_MPOOL_FSTAT, st_cache_hit) +JAVADB_RO_ACCESS(DbMpoolFStat, jlong, st_1cache_1miss, DB_MPOOL_FSTAT, st_cache_miss) +JAVADB_RO_ACCESS(DbMpoolFStat, jlong, st_1map, DB_MPOOL_FSTAT, st_map) +JAVADB_RO_ACCESS(DbMpoolFStat, jlong, st_1page_1create, DB_MPOOL_FSTAT, st_page_create) +JAVADB_RO_ACCESS(DbMpoolFStat, jlong, st_1page_1in, DB_MPOOL_FSTAT, st_page_in) +JAVADB_RO_ACCESS(DbMpoolFStat, jlong, st_1page_1out, DB_MPOOL_FSTAT, st_page_out) + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbMpoolFStat_finalize + (JNIEnv *jnienv, jobject jthis) +{ + DB_MPOOL_FSTAT *db_mpool_fstat = get_DB_MPOOL_FSTAT(jnienv, jthis); + if (db_mpool_fstat) { + // Free any data related to DB_MPOOL_FSTAT here + free(db_mpool_fstat); + } +} diff --git a/mozilla/db/libdb_java/java_DbMpoolStat.cpp b/mozilla/db/libdb_java/java_DbMpoolStat.cpp new file mode 100644 index 00000000000..4af3ca1d592 --- /dev/null +++ b/mozilla/db/libdb_java/java_DbMpoolStat.cpp @@ -0,0 +1,44 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)java_DbMpoolStat.cpp 10.2 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include +#include +#include +#include + +#include "db.h" +#include "java_util.h" +#include "com_sleepycat_db_DbMpoolStat.h" + +JAVADB_RO_ACCESS(DbMpoolStat, jlong, st_1cachesize, DB_MPOOL_STAT, st_cachesize) +JAVADB_RO_ACCESS(DbMpoolStat, jlong, st_1cache_1hit, DB_MPOOL_STAT, st_cache_hit) +JAVADB_RO_ACCESS(DbMpoolStat, jlong, st_1cache_1miss, DB_MPOOL_STAT, st_cache_miss) +JAVADB_RO_ACCESS(DbMpoolStat, jlong, st_1map, DB_MPOOL_STAT, st_map) +JAVADB_RO_ACCESS(DbMpoolStat, jlong, st_1page_1create, DB_MPOOL_STAT, st_page_create) +JAVADB_RO_ACCESS(DbMpoolStat, jlong, st_1page_1in, DB_MPOOL_STAT, st_page_in) +JAVADB_RO_ACCESS(DbMpoolStat, jlong, st_1page_1out, DB_MPOOL_STAT, st_page_out) +JAVADB_RO_ACCESS(DbMpoolStat, jlong, st_1ro_1evict, DB_MPOOL_STAT, st_ro_evict) +JAVADB_RO_ACCESS(DbMpoolStat, jlong, st_1rw_1evict, DB_MPOOL_STAT, st_rw_evict) +JAVADB_RO_ACCESS(DbMpoolStat, jlong, st_1hash_1buckets, DB_MPOOL_STAT, st_hash_buckets) +JAVADB_RO_ACCESS(DbMpoolStat, jlong, st_1hash_1searches, DB_MPOOL_STAT, st_hash_searches) +JAVADB_RO_ACCESS(DbMpoolStat, jlong, st_1hash_1longest, DB_MPOOL_STAT, st_hash_longest) +JAVADB_RO_ACCESS(DbMpoolStat, jlong, st_1hash_1examined, DB_MPOOL_STAT, st_hash_examined) + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbMpoolStat_finalize + (JNIEnv *jnienv, jobject jthis) +{ + DB_MPOOL_STAT *db_mpool_stat = get_DB_MPOOL_STAT(jnienv, jthis); + if (db_mpool_stat) { + // Free any data related to DB_MPOOL_STAT here + free(db_mpool_stat); + } +} diff --git a/mozilla/db/libdb_java/java_DbTxn.cpp b/mozilla/db/libdb_java/java_DbTxn.cpp new file mode 100644 index 00000000000..ead3ecbec78 --- /dev/null +++ b/mozilla/db/libdb_java/java_DbTxn.cpp @@ -0,0 +1,81 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)java_DbTxn.cpp 10.2 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include +#include +#include +#include + +#include "db.h" +#include "java_util.h" +#include "com_sleepycat_db_DbTxn.h" + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxn_abort + (JNIEnv *jnienv, jobject jthis) +{ + int err; + DB_TXN *dbtxn = get_DB_TXN(jnienv, jthis); + if (!verify_non_null(jnienv, dbtxn)) + return; + + err = txn_abort(dbtxn); + verify_return(jnienv, err); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxn_commit + (JNIEnv *jnienv, jobject jthis) +{ + int err; + DB_TXN *dbtxn = get_DB_TXN(jnienv, jthis); + if (!verify_non_null(jnienv, dbtxn)) + return; + + err = txn_commit(dbtxn); + verify_return(jnienv, err); +} + +JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbTxn_id + (JNIEnv *jnienv, jobject jthis) +{ + int retval = 0; + DB_TXN *dbtxn = get_DB_TXN(jnienv, jthis); + if (!verify_non_null(jnienv, dbtxn)) + return -1; + + // No error to check for from txn_id + retval = txn_id(dbtxn); + return retval; +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxn_prepare + (JNIEnv *jnienv, jobject jthis) +{ + int err; + DB_TXN *dbtxn = get_DB_TXN(jnienv, jthis); + if (!verify_non_null(jnienv, dbtxn)) + return; + + err = txn_prepare(dbtxn); + verify_return(jnienv, err); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxn_finalize + (JNIEnv *jnienv, jobject jthis) +{ + DB_TXN *dbtxn = get_DB_TXN(jnienv, jthis); + if (dbtxn) { + // Free any data related to DB_TXN here + // Note: we don't make a policy of doing + // a commit or abort here. The txnmgr + // should be closed, and DB will clean up. + } +} diff --git a/mozilla/db/libdb_java/java_DbTxnMgr.cpp b/mozilla/db/libdb_java/java_DbTxnMgr.cpp new file mode 100644 index 00000000000..583c764fef2 --- /dev/null +++ b/mozilla/db/libdb_java/java_DbTxnMgr.cpp @@ -0,0 +1,119 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)java_DbTxnMgr.cpp 10.2 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include +#include +#include +#include + +#include "db.h" +#include "java_util.h" +#include "com_sleepycat_db_DbTxnMgr.h" + +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbTxnMgr_begin + (JNIEnv *jnienv, jobject jthis, /*DbTxn*/ jobject pid) +{ + int err; + DB_TXNMGR *dbtxnmgr = get_DB_TXNMGR(jnienv, jthis); + if (!verify_non_null(jnienv, dbtxnmgr)) + return 0; + DB_TXN *dbpid = get_DB_TXN(jnienv, pid); + DB_TXN *result = 0; + + err = txn_begin(dbtxnmgr, dbpid, &result); + if (!verify_return(jnienv, err)) + return 0; + return get_DbTxn(jnienv, result); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxnMgr_checkpoint + (JNIEnv *jnienv, jobject jthis, jint kbyte, jint min) +{ + int err; + DB_TXNMGR *dbtxnmgr = get_DB_TXNMGR(jnienv, jthis); + + if (!verify_non_null(jnienv, dbtxnmgr)) + return; + err = txn_checkpoint(dbtxnmgr, kbyte, min); + verify_return(jnienv, err); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxnMgr_close + (JNIEnv *jnienv, jobject jthis) +{ + int err; + DB_TXNMGR *dbtxnmgr = get_DB_TXNMGR(jnienv, jthis); + + if (!verify_non_null(jnienv, dbtxnmgr)) + return; + err = txn_close(dbtxnmgr); + if (verify_return(jnienv, err)) + { + set_private_info(jnienv, name_DB_TXNMGR, jthis, 0); + } +} + +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbTxnMgr_stat + (JNIEnv *jnienv, jobject jthis) +{ + int err; + DB_TXNMGR *dbtxnmgr = get_DB_TXNMGR(jnienv, jthis); + DB_TXN_STAT *statp = 0; + + err = txn_stat(dbtxnmgr, &statp, 0); + if (!verify_return(jnienv, err)) + return 0; + return get_DbTxnStat(jnienv, statp); +} + +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbTxnMgr_open + (JNIEnv *jnienv, jclass jthis_class, jstring dir, + jint flags, jint mode, jobject dbenv) +{ + int err; + jobject retval = NULL; + DB_TXNMGR *dbtxnmgr; + DB_ENV *db_dbenv = get_DB_ENV(jnienv, dbenv); + LockedString dbdir(jnienv, dir); + + if (verify_non_null(jnienv, db_dbenv)) { + err = txn_open(dbdir.string, flags, mode, db_dbenv, &dbtxnmgr); + if (verify_return(jnienv, err)) { + retval = create_default_object(jnienv, name_DB_TXNMGR); + set_private_info(jnienv, name_DB_TXNMGR, retval, dbtxnmgr); + } + } + return retval; +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxnMgr_unlink + (JNIEnv *jnienv, jclass jthis_class, jstring dir, jint force, + /*DbEnv*/ jobject dbenv) +{ + int err; + DB_ENV *db_dbenv = get_DB_ENV(jnienv, dbenv); + LockedString dbdir(jnienv, dir); + + if (verify_non_null(jnienv, db_dbenv)) { + err = txn_unlink(dbdir.string, force, db_dbenv); + verify_return(jnienv, err); + } +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxnMgr_finalize + (JNIEnv *jnienv, jobject jthis) +{ + DB_TXNMGR *dbtxnmgr = get_DB_TXNMGR(jnienv, jthis); + if (dbtxnmgr) { + // Free any data related to DB_TXNMGR here + } +} diff --git a/mozilla/db/libdb_java/java_DbTxnStat.cpp b/mozilla/db/libdb_java/java_DbTxnStat.cpp new file mode 100644 index 00000000000..e656fd0ddb5 --- /dev/null +++ b/mozilla/db/libdb_java/java_DbTxnStat.cpp @@ -0,0 +1,57 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)java_DbTxnStat.cpp 10.2 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include +#include +#include +#include + +#include "db.h" +#include "java_util.h" +#include "com_sleepycat_db_DbTxnStat.h" + +JAVADB_RO_ACCESS(DbTxnStat, jint, time_1ckp, DB_TXN_STAT, st_time_ckp) +JAVADB_RO_ACCESS(DbTxnStat, jint, last_1txnid, DB_TXN_STAT, st_last_txnid) +JAVADB_RO_ACCESS(DbTxnStat, jint, maxtxns, DB_TXN_STAT, st_maxtxns) +JAVADB_RO_ACCESS(DbTxnStat, jint, naborts, DB_TXN_STAT, st_naborts) +JAVADB_RO_ACCESS(DbTxnStat, jint, nbegins, DB_TXN_STAT, st_nbegins) +JAVADB_RO_ACCESS(DbTxnStat, jint, ncommits, DB_TXN_STAT, st_ncommits) + +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbTxnStat_get_1last_1ckp + (JNIEnv *jnienv, jobject jthis) +{ + DB_TXN_STAT *dbtxnstat = get_DB_TXN_STAT(jnienv, jthis); + if (!verify_non_null(jnienv, dbtxnstat)) + return 0; + + return get_DbLsn(jnienv, dbtxnstat->st_last_ckp); +} + +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbTxnStat_get_1pending_1ckp + (JNIEnv *jnienv, jobject jthis) +{ + DB_TXN_STAT *dbtxnstat = get_DB_TXN_STAT(jnienv, jthis); + if (!verify_non_null(jnienv, dbtxnstat)) + return 0; + + return get_DbLsn(jnienv, dbtxnstat->st_pending_ckp); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxnStat_finalize + (JNIEnv *jnienv, jobject jthis) +{ + DB_TXN_STAT *dbtxnstat = get_DB_TXN_STAT(jnienv, jthis); + if (dbtxnstat) { + // Free any data related to DB_TXN_STAT here + free(dbtxnstat); + } +} diff --git a/mozilla/db/libdb_java/java_Dbc.cpp b/mozilla/db/libdb_java/java_Dbc.cpp new file mode 100644 index 00000000000..bf8ce32ebe5 --- /dev/null +++ b/mozilla/db/libdb_java/java_Dbc.cpp @@ -0,0 +1,101 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)java_Dbc.cpp 10.4 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include +#include +#include +#include + +#include "db.h" +#include "java_util.h" +#include "com_sleepycat_db_Dbc.h" + +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbc_close + (JNIEnv *jnienv, jobject jthis) +{ + int err; + DBC *dbc = get_DBC(jnienv, jthis); + + if (!verify_non_null(jnienv, dbc)) + return; + err = dbc->c_close(dbc); + if (verify_return(jnienv, err)) + { + set_private_info(jnienv, name_DBC, jthis, 0); + } +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbc_del + (JNIEnv *jnienv, jobject jthis, jint flags) +{ + int err; + DBC *dbc = get_DBC(jnienv, jthis); + + if (!verify_non_null(jnienv, dbc)) + return; + err = dbc->c_del(dbc, flags); + verify_return(jnienv, err); +} + +JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbc_get + (JNIEnv *jnienv, jobject jthis, + /*Dbt*/ jobject key, /*Dbt*/ jobject data, jint flags) +{ + // Depending on flags, the user may be supplying the key, + // or else we may have to retrieve it. + int retrieve_key = ((flags & (DB_SET|DB_SET_RANGE|DB_SET_RECNO)) == 0); + int err; + DBC *dbc = get_DBC(jnienv, jthis); + LockedDBT dbkey(jnienv, key, retrieve_key); + + if (dbkey.has_error()) + return 0; + LockedDBT dbdata(jnienv, data, 1); + if (dbdata.has_error()) + return 0; + + if (!verify_non_null(jnienv, dbc)) + return -1; + err = dbc->c_get(dbc, dbkey.dbt, dbdata.dbt, flags); + if (err != DB_NOTFOUND) { + verify_return(jnienv, err); + } + return err; +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbc_put + (JNIEnv *jnienv, jobject jthis, + /*Dbt*/ jobject key, /*Dbt*/ jobject data, jint flags) +{ + int err; + DBC *dbc = get_DBC(jnienv, jthis); + LockedDBT dbkey(jnienv, key, 0); + if (dbkey.has_error()) + return; + LockedDBT dbdata(jnienv, data, 0); + if (dbdata.has_error()) + return; + + if (!verify_non_null(jnienv, dbc)) + return; + err = dbc->c_put(dbc, dbkey.dbt, dbdata.dbt, flags); + verify_return(jnienv, err); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbc_finalize + (JNIEnv *jnienv, jobject jthis) +{ + DBC *dbc = get_DBC(jnienv, jthis); + if (dbc) { + // Free any data related to DBC here + } +} diff --git a/mozilla/db/libdb_java/java_Dbt.cpp b/mozilla/db/libdb_java/java_Dbt.cpp new file mode 100644 index 00000000000..888ed43e66a --- /dev/null +++ b/mozilla/db/libdb_java/java_Dbt.cpp @@ -0,0 +1,139 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)java_Dbt.cpp 10.4 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include +#include +#include +#include + +#include "db.h" +#include "java_util.h" +#include "com_sleepycat_db_Dbt.h" + + +JAVADB_RW_ACCESS(Dbt, jint, size, DBT, size) +JAVADB_RW_ACCESS(Dbt, jint, ulen, DBT, ulen) +JAVADB_RW_ACCESS(Dbt, jint, dlen, DBT, dlen) +JAVADB_RW_ACCESS(Dbt, jint, doff, DBT, doff) +JAVADB_RW_ACCESS(Dbt, jint, flags, DBT, flags) + +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_init + (JNIEnv *jnienv, jobject jthis) +{ + DBT_info *dbt = NEW(DBT_info); + set_private_info(jnienv, name_DBT, jthis, dbt); +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_internal_1set_1data + (JNIEnv *jnienv, jobject jthis, jbyteArray array) +{ + DBT_info *db_this = get_DBT(jnienv, jthis); + + if (verify_non_null(jnienv, db_this)) { + + // If we previously allocated an array for java, + // must release reference. + db_this->release(jnienv); + + // Make the array a global ref, it won't be GC'd till we release it. + if (array) + array = (jbyteArray)jnienv->NewGlobalRef(array); + db_this->array_ = array; + } +} + +JNIEXPORT jbyteArray JNICALL Java_com_sleepycat_db_Dbt_get_1data + (JNIEnv *jnienv, jobject jthis) +{ + DBT_info *db_this = get_DBT(jnienv, jthis); + + if (verify_non_null(jnienv, db_this)) { + return db_this->array_; + } + return 0; +} + + +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_set_1offset + (JNIEnv *jnienv, jobject jthis, jint offset) +{ + DBT_info *db_this = get_DBT(jnienv, jthis); + + if (verify_non_null(jnienv, db_this)) { + db_this->offset_ = offset; + } +} + +JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbt_get_1offset + (JNIEnv *jnienv, jobject jthis) +{ + DBT_info *db_this = get_DBT(jnienv, jthis); + + if (verify_non_null(jnienv, db_this)) { + return db_this->offset_; + } + return 0; +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_set_1recno_1key_1data(JNIEnv *jnienv, jobject jthis, jint value) +{ + LockedDBT dbt_this(jnienv, jthis, 0); + if (dbt_this.has_error()) + return; + + if (!dbt_this.dbt->data || + dbt_this.java_array_len_ < sizeof(db_recno_t)) { + char buf[200]; + sprintf(buf, "set_recno_key_data error: %p %p %d %d", + dbt_this.dbt, dbt_this.dbt->data, + dbt_this.dbt->ulen, sizeof(db_recno_t)); + report_exception(jnienv, buf, 0); + } + else { + *(db_recno_t*)(dbt_this.dbt->data) = value; + } +} + +JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbt_get_1recno_1key_1data(JNIEnv *jnienv, jobject jthis) +{ + // Although this is kind of like "retrieve", we don't support + // DB_DBT_MALLOC for this operation, so we tell LockedDBT constructor + // that is not a retrieve. + // + LockedDBT dbt_this(jnienv, jthis, 0); + if (dbt_this.has_error()) + return 0; + + if (!dbt_this.dbt->data || + dbt_this.java_array_len_ < sizeof(db_recno_t)) { + char buf[200]; + sprintf(buf, "get_recno_key_data error: %p %p %d %d", + dbt_this.dbt, dbt_this.dbt->data, + dbt_this.dbt->ulen, sizeof(db_recno_t)); + report_exception(jnienv, buf, 0); + return 0; + } + else { + return *(db_recno_t*)(dbt_this.dbt->data); + } +} + +JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_finalize + (JNIEnv *jnienv, jobject jthis) +{ + DBT_info *dbt = get_DBT(jnienv, jthis); + if (dbt) { + // Free any data related to DBT here + dbt->release(jnienv); + DELETE(dbt); + } +} diff --git a/mozilla/db/libdb_java/java_util.cpp b/mozilla/db/libdb_java/java_util.cpp new file mode 100644 index 00000000000..aeefebe505e --- /dev/null +++ b/mozilla/db/libdb_java/java_util.cpp @@ -0,0 +1,559 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)java_util.cpp 10.7 (Sleepycat) 5/2/98"; +#endif /* not lint */ + +#include "java_util.h" +#include +#include +#include + +#ifdef WIN32 +#define sys_errlist _sys_errlist +#define sys_nerr _sys_nerr +#endif + +/**************************************************************** + * + * Utility functions used by "glue" functions. + * + */ + +/* Use our own malloc for any objects allocated via DB_DBT_MALLOC, + * since we must free them in the same library address space. + */ +extern "C" +void * java_db_malloc(size_t size) +{ + return malloc(size); +} + +/* Get the private data from a Db* object as a (64 bit) java long. + */ +jlong get_private_long_info(JNIEnv *jnienv, const char *classname, + jobject obj) +{ + if (!obj) + return 0; + + jclass dbClass = get_class(jnienv, classname); + jfieldID id = jnienv->GetFieldID(dbClass, "private_info_", "J"); + return jnienv->GetLongField(obj, id); +} + +/* Get the private data from a Db* object. + * The private data is stored in the object as a Java long (64 bits), + * which is long enough to store a pointer on current architectures. + */ +void *get_private_info(JNIEnv *jnienv, const char *classname, + jobject obj) +{ + long_to_ptr lp; + if (!obj) + return 0; + lp.java_long = get_private_long_info(jnienv, classname, obj); + return lp.ptr; +} + +/* Set the private data in a Db* object as a (64 bit) java long. + */ +void set_private_long_info(JNIEnv *jnienv, const char *classname, + jobject obj, jlong value) +{ + jclass dbClass = get_class(jnienv, classname); + jfieldID id = jnienv->GetFieldID(dbClass, "private_info_", "J"); + jnienv->SetLongField(obj, id, value); +} + +/* Set the private data in a Db* object. + * The private data is stored in the object as a Java long (64 bits), + * which is long enough to store a pointer on current architectures. + */ +void set_private_info(JNIEnv *jnienv, const char *classname, + jobject obj, void *value) +{ + long_to_ptr lp; + lp.java_long = 0; + lp.ptr = value; + set_private_long_info(jnienv, classname, obj, lp.java_long); +} + +/* + * Given a non-qualified name (e.g. "foo"), get the class handl + * for the fully qualified name (e.g. "com.sleepycat.db.foo") + */ +jclass get_class(JNIEnv *jnienv, const char *classname) +{ + // TODO: cache these (remember to use NewGlobalRef) + char fullname[128] = DB_PACKAGE_NAME; + strcat(fullname, classname); + return jnienv->FindClass(fullname); +} + +/* Set an individual field in a Db* object. + * The field must be an object type. + */ +void set_object_field(JNIEnv *jnienv, jclass class_of_this, + jobject jthis, const char *object_classname, + const char *name_of_field, jobject obj) +{ + char signature[512]; + + strcpy(signature, "L"); + strcat(signature, DB_PACKAGE_NAME); + strcat(signature, object_classname); + strcat(signature, ";"); + + jfieldID id = jnienv->GetFieldID(class_of_this, name_of_field, signature); + jnienv->SetObjectField(jthis, id, obj); +} + + +/* Report an exception back to the java side. + */ +void report_exception(JNIEnv *jnienv, const char *text, int err) +{ + jstring textString = get_java_string(jnienv, text); + jclass dbexcept = get_class(jnienv, name_DB_EXCEPTION); + jmethodID constructId = jnienv->GetMethodID(dbexcept, "", + "(Ljava/lang/String;I)V"); + jthrowable obj = (jthrowable)jnienv->AllocObject(dbexcept); + jnienv->CallVoidMethod(obj, constructId, textString, err); + jnienv->Throw(obj); +} + +/* If the object is null, report an exception and return false (0), + * otherwise return true (1). + */ +int verify_non_null(JNIEnv *jnienv, void *obj) +{ + if (obj == NULL) { + report_exception(jnienv, "null object", 0); + return 0; + } + return 1; +} + +/* If the error code is non-zero, report an exception and return false (0), + * otherwise return true (1). + */ +int verify_return(JNIEnv *jnienv, int err) +{ + char *errstring; + + if (err != 0) { + if (err > 0 && (errstring = strerror(err)) != NULL) { + report_exception(jnienv, errstring, err); + } + else { + char buffer[64]; + sprintf(buffer, "error %d", err); + report_exception(jnienv, buffer, err); + } + return 0; + } + return 1; +} + +/* Create an object of the given class, calling its default constructor. + */ +jobject create_default_object(JNIEnv *jnienv, const char *class_name) +{ + jclass dbclass = get_class(jnienv, class_name); + jmethodID id = jnienv->GetMethodID(dbclass, "", "()V"); + jobject object = jnienv->NewObject(dbclass, id); + return object; +} + +/* Convert an DB object to a Java encapsulation of that object. + * Note: This implementation creates a new Java object on each call, + * so it is generally useful when a new DB object has just been created. + */ +jobject convert_object(JNIEnv *jnienv, const char *class_name, void *dbobj) +{ + if (!dbobj) + return 0; + + jobject jo = create_default_object(jnienv, class_name); + set_private_info(jnienv, class_name, jo, dbobj); + return jo; +} + +/* Create a copy of the string + */ +char *dup_string(const char *str) +{ + char *retval = NEW_ARRAY(char, strlen(str)+1); + strcpy(retval, str); + return retval; +} + +/* Create a java string from the given string + */ +jstring get_java_string(JNIEnv *jnienv, const char* string) +{ + if (string == 0) + return 0; + return jnienv->NewStringUTF(string); +} + +/* Convert a java object to the various C pointers they represent. + */ +DB *get_DB(JNIEnv *jnienv, jobject obj) +{ + return (DB *)get_private_info(jnienv, name_DB, obj); +} + +DB_BTREE_STAT *get_DB_BTREE_STAT(JNIEnv *jnienv, jobject obj) +{ + return (DB_BTREE_STAT *)get_private_info(jnienv, name_DB_BTREE_STAT, obj); +} + +DBC *get_DBC(JNIEnv *jnienv, jobject obj) +{ + return (DBC *)get_private_info(jnienv, name_DBC, obj); +} + +DB_ENV *get_DB_ENV(JNIEnv *jnienv, jobject obj) +{ + return (DB_ENV *)get_private_info(jnienv, name_DB_ENV, obj); +} + +DB_INFO *get_DB_INFO(JNIEnv *jnienv, jobject obj) +{ + return (DB_INFO *)get_private_info(jnienv, name_DB_INFO, obj); +} + +// A DB_LOCK is just a size_t, so no need for indirection. +DB_LOCK get_DB_LOCK(JNIEnv *jnienv, jobject obj) +{ + return (DB_LOCK)get_private_long_info(jnienv, name_DB_LOCK, obj); +} + +DB_LOCKTAB *get_DB_LOCKTAB(JNIEnv *jnienv, jobject obj) +{ + return (DB_LOCKTAB *)get_private_info(jnienv, name_DB_LOCKTAB, obj); +} + +DB_LOG *get_DB_LOG(JNIEnv *jnienv, jobject obj) +{ + return (DB_LOG *)get_private_info(jnienv, name_DB_LOG, obj); +} + +DB_LOG_STAT *get_DB_LOG_STAT(JNIEnv *jnienv, jobject obj) +{ + return (DB_LOG_STAT *)get_private_info(jnienv, name_DB_LOG_STAT, obj); +} + +DB_LSN *get_DB_LSN(JNIEnv *jnienv, jobject obj) +{ + return (DB_LSN *)get_private_info(jnienv, name_DB_LSN, obj); +} + +DB_MPOOL *get_DB_MPOOL(JNIEnv *jnienv, jobject obj) +{ + return (DB_MPOOL *)get_private_info(jnienv, name_DB_MPOOL, obj); +} + +DB_MPOOL_FSTAT *get_DB_MPOOL_FSTAT(JNIEnv *jnienv, jobject obj) +{ + return (DB_MPOOL_FSTAT *)get_private_info(jnienv, name_DB_MPOOL_FSTAT, obj); +} + +DB_MPOOL_STAT *get_DB_MPOOL_STAT(JNIEnv *jnienv, jobject obj) +{ + return (DB_MPOOL_STAT *)get_private_info(jnienv, name_DB_MPOOL_STAT, obj); +} + +DB_TXN *get_DB_TXN(JNIEnv *jnienv, jobject obj) +{ + return (DB_TXN *)get_private_info(jnienv, name_DB_TXN, obj); +} + +DB_TXNMGR *get_DB_TXNMGR(JNIEnv *jnienv, jobject obj) +{ + return (DB_TXNMGR *)get_private_info(jnienv, name_DB_TXNMGR, obj); +} + +DB_TXN_STAT *get_DB_TXN_STAT(JNIEnv *jnienv, jobject obj) +{ + return (DB_TXN_STAT *)get_private_info(jnienv, name_DB_TXN_STAT, obj); +} + +DBT_info *get_DBT(JNIEnv *jnienv, jobject obj) +{ + return (DBT_info *)get_private_info(jnienv, name_DBT, obj); +} + + +/* Convert a C pointer to the various Java objects they represent. + */ +jobject get_DbBtreeStat(JNIEnv *jnienv, DB_BTREE_STAT *dbobj) +{ + return convert_object(jnienv, name_DB_BTREE_STAT, dbobj); +} + +jobject get_Dbc(JNIEnv *jnienv, DBC *dbobj) +{ + return convert_object(jnienv, name_DBC, dbobj); +} + +jobject get_DbLockTab(JNIEnv *jnienv, DB_LOCKTAB *dbobj) +{ + return convert_object(jnienv, name_DB_LOCKTAB, dbobj); +} + +jobject get_DbLog(JNIEnv *jnienv, DB_LOG *dbobj) +{ + return convert_object(jnienv, name_DB_LOG, dbobj); +} + +jobject get_DbLogStat(JNIEnv *jnienv, DB_LOG_STAT *dbobj) +{ + return convert_object(jnienv, name_DB_LOG_STAT, dbobj); +} + +// LSNs are different since they are really normally +// treated as by-value objects. We actually create +// a pointer to the LSN as store that, deleting it +// when the LSN is GC'd. +// +jobject get_DbLsn(JNIEnv *jnienv, DB_LSN dbobj) +{ + DB_LSN *lsnp = NEW(DB_LSN); + *lsnp = dbobj; + return convert_object(jnienv, name_DB_LSN, lsnp); +} + +jobject get_DbMpool(JNIEnv *jnienv, DB_MPOOL *dbobj) +{ + return convert_object(jnienv, name_DB_MPOOL, dbobj); +} + +jobject get_DbMpoolFStat(JNIEnv *jnienv, DB_MPOOL_FSTAT *dbobj) +{ + return convert_object(jnienv, name_DB_MPOOL_FSTAT, dbobj); +} + +jobject get_DbMpoolStat(JNIEnv *jnienv, DB_MPOOL_STAT *dbobj) +{ + return convert_object(jnienv, name_DB_MPOOL_STAT, dbobj); +} + +jobject get_DbTxn(JNIEnv *jnienv, DB_TXN *dbobj) +{ + return convert_object(jnienv, name_DB_TXN, dbobj); +} + +jobject get_DbTxnMgr(JNIEnv *jnienv, DB_TXNMGR *dbobj) +{ + return convert_object(jnienv, name_DB_TXNMGR, dbobj); +} + +jobject get_DbTxnStat(JNIEnv *jnienv, DB_TXN_STAT *dbobj) +{ + return convert_object(jnienv, name_DB_TXN_STAT, dbobj); +} + +/**************************************************************** + * + * Implementation of class DBT_info + * + */ +DBT_info::DBT_info() +: array_(0) +, offset_(0) +{ + memset((DBT*)this, 0, sizeof(DBT)); +} + +void DBT_info::release(JNIEnv *jnienv) +{ + if (array_ != 0) { + jnienv->DeleteGlobalRef(array_); + } +} + +DBT_info::~DBT_info() +{ +} + +/**************************************************************** + * + * Implementation of class LockedDBT + * + */ +LockedDBT::LockedDBT(JNIEnv *jnienv, jobject obj, int is_retrieve_op) + : env_(jnienv) + , obj_(obj) + , has_error_(0) + , is_retrieve_op_(is_retrieve_op) + , java_array_len_(0) + , java_data_(0) + /* dbt initialized below */ +{ + dbt = (DBT_info *)get_private_info(jnienv, name_DBT, obj); + if (!verify_non_null(jnienv, dbt)) { + has_error_ = 1; + return; + } + + if ((dbt->flags & DB_DBT_USERMEM) || !is_retrieve_op_) { + + // If writing with DB_DBT_USERMEM or reading, then the data + // should point the java array. + // + if (!dbt->array_) { + report_exception(jnienv, "Dbt.data is null", 0); + has_error_ = 1; + return; + } + + // Verify other parameters + // + java_array_len_ = jnienv->GetArrayLength(dbt->array_); + if (dbt->offset_ < 0 ) { + report_exception(jnienv, "Dbt.offset illegal", 0); + has_error_ = 1; + return; + } + if (dbt->ulen + dbt->offset_ > java_array_len_) { + report_exception(jnienv, + "Dbt.ulen + Dbt.offset greater than array length", 0); + has_error_ = 1; + return; + } + + java_data_ = jnienv->GetByteArrayElements(dbt->array_, NULL); + dbt->data = java_data_ + dbt->offset_; + } + else { + + // If writing with DB_DBT_MALLOC, then the data is + // allocated by DB. + // + dbt->data = 0; + } +} + +LockedDBT::~LockedDBT() +{ + // If there was an error in the constructor, + // everything is already cleaned up. + // + if (has_error_) + return; + + if ((dbt->flags & DB_DBT_USERMEM) || !is_retrieve_op_) { + + // If writing with DB_DBT_USERMEM or reading, then the data + // may be already in the java array, in which case, + // we just need to release it. + // If DB didn't put it in the array (indicated by the + // dbt->data changing), we need to do that + // + jbyte *data = (jbyte *)dbt->data; + data -= dbt->offset_; + if (data != java_data_) { + env_->SetByteArrayRegion(dbt->array_, dbt->offset_, dbt->ulen, data); + } + env_->ReleaseByteArrayElements(dbt->array_, java_data_, 0); + dbt->data = 0; + } + else { + + // If writing with DB_DBT_MALLOC, then the data was allocated + // by DB. If dbt->data is zero, it means an error occurred + // (and should have been already reported). + // + if (dbt->data) { + + // Release any old references. + // + dbt->release(env_); + + dbt->array_ = (jbyteArray) + env_->NewGlobalRef(env_->NewByteArray(dbt->size)); + dbt->offset_ = 0; + env_->SetByteArrayRegion(dbt->array_, 0, dbt->size, (jbyte *)dbt->data); + free(dbt->data); + dbt->data = 0; + } + } +} + +/**************************************************************** + * + * Implementation of class LockedString + * + */ +LockedString::LockedString(JNIEnv *jnienv, jstring jstr) + : env_(jnienv) + , jstr_(jstr) +{ + if (jstr == 0) + string = 0; + else + string = jnienv->GetStringUTFChars(jstr, NULL); +} + +LockedString::~LockedString() +{ + if (jstr_) + env_->ReleaseStringUTFChars(jstr_, string); +} + + +/**************************************************************** + * + * Implementation of class LockedStringArray + * + */ +LockedStringArray::LockedStringArray(JNIEnv *jnienv, jobjectArray arr) + : env_(jnienv) + , arr_(arr) + , string_array(0) +{ + typedef const char *conststr; + + if (arr != 0) { + int count = jnienv->GetArrayLength(arr); + string_array = NEW_ARRAY(conststr, count+1); + for (int i=0; iGetObjectArrayElement(arr, i); + if (jstr == 0) { + // + // An embedded null in the string array is treated + // as an endpoint. + // + string_array[i] = 0; + break; + } + else { + string_array[i] = jnienv->GetStringUTFChars(jstr, NULL); + } + } + string_array[count] = 0; + } +} + +LockedStringArray::~LockedStringArray() +{ + if (arr_) { + int count = env_->GetArrayLength(arr_); + for (int i=0; iGetObjectArrayElement(arr_, i); + env_->ReleaseStringUTFChars(jstr, string_array[i]); + } + DELETE(string_array); + } +} diff --git a/mozilla/db/libdb_java/java_util.h b/mozilla/db/libdb_java/java_util.h new file mode 100644 index 00000000000..a32e29d9103 --- /dev/null +++ b/mozilla/db/libdb_java/java_util.h @@ -0,0 +1,395 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)java_util.h 10.6 (Sleepycat) 5/2/98 + */ + +#ifndef _JAVA_UTIL_H_ +#define _JAVA_UTIL_H_ + +#include "db.h" +#include +#include // needed for memset + +#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 +// +// 4244: '=' : convert from '__int64' to 'unsigned int', possible loss of data +// results from making size_t data members correspond to jlongs +// +// 4514: unreferenced inline function has been removed +// jni.h defines methods that are not called +// +// 4127: conditional expression is constant +// occurs because of arg in JAVADB_RW_ACCESS_STRING macro +// +// 4100: unreferenced formal parameters: TODO: remove after everythings done +// +#pragma warning(disable: 4100 4244 4201 4514 4127) + +#endif + +#define DB_PACKAGE_NAME "com/sleepycat/db/" + +/* Union to convert longs to pointers (see {get,set}_private_info). + */ +typedef union { + jlong java_long; + void *ptr; +} long_to_ptr; + +/**************************************************************** + * + * DBT_info and LockedDBT classes + * + * A DBT_info is created whenever a Dbt (java) object is created, + * and a pointer to it is stored in its private info storage. + * It is subclassed from DBT, because we must retain some extra + * information in it while it is in use. In particular, when + * a java array is associated with it, we need to keep a Globally + * Locked reference to it so it is not GC'd. This reference is + * released when the Dbt is GC'd. + * + * In contrast, a LockedDBT class is only in existence during a + * single native call to the DB API. Its constructor's job is + * to temporarily convert any java array found in the DBT_info + * to actual bytes in memory that remain locked in place. These + * bytes are used during the call to the underlying DB C layer, + * and are released and/or copied back by the destructor. + * Thus, a LockedDBT must be declared as a stack object to + * function properly. + */ + +/* + * + * Declaration of class DBT_info + * + * See description above. + */ +class DBT_info : public DBT +{ +public: + DBT_info(); + ~DBT_info(); + void release(JNIEnv *jnienv); + + jbyteArray array_; + int offset_; +}; + +/* + * + * Declaration of class LockedDBT + * + * See description above. + */ +class LockedDBT +{ +public: + // After the constructor returns, if has_error() is false, + // then dbt must be initialized. + // + LockedDBT(JNIEnv *jnienv, jobject obj, int is_retrieve_op); + ~LockedDBT(); + int has_error() { return has_error_; } + +public: + DBT_info *dbt; + int java_array_len_; + +private: + JNIEnv *env_; + jobject obj_; + jbyte *java_data_; + int has_error_; + int is_retrieve_op_; +}; + +/**************************************************************** + * + * Declaration of class LockedString + * + * Given a java jstring object, this gets an encapsulated + * const char *. When the LockedString object is destroyed, the + * char * array is released. + */ +class LockedString +{ +public: + LockedString(JNIEnv *jnienv, jstring jstr); + ~LockedString(); + +public: + const char *string; +private: + JNIEnv *env_; + jstring jstr_; +}; + +/**************************************************************** + * + * Declaration of class LockedStringArray + * + * Given a java jobjectArray object (that must be a String[]), + * we extract the individual strings and build a const char ** + * When the LockedStringArray object is destroyed, the individual + * strings are released. + */ +class LockedStringArray +{ +public: + LockedStringArray(JNIEnv *jnienv, jobjectArray arr); + ~LockedStringArray(); + +public: + const char **string_array; +private: + JNIEnv *env_; + jobjectArray arr_; +}; + +/**************************************************************** + * + * Utility functions and definitions used by "glue" functions. + * + */ + +#define NOT_IMPLEMENTED(str) \ + report_exception(jnienv, str /*concatenate*/ ": not implemented", 0) + +/* Use our own malloc for any objects allocated via DB_DBT_MALLOC, + * since we must free them in the same library address space. + */ +extern "C" +void * java_db_malloc(size_t size); + +/* Get the private data from a Db* object as a (64 bit) java long. + */ +jlong get_private_long_info(JNIEnv *jnienv, const char *classname, + jobject obj); + +/* Get the private data from a Db* object. + * The private data is stored in the object as a Java long (64 bits), + * which is long enough to store a pointer on current architectures. + */ +void *get_private_info(JNIEnv *jnienv, const char *classname, + jobject obj); + +/* Set the private data in a Db* object as a (64 bit) java long. + */ +void set_private_long_info(JNIEnv *jnienv, const char *classname, + jobject obj, jlong value); + +/* Set the private data in a Db* object. + * The private data is stored in the object as a Java long (64 bits), + * which is long enough to store a pointer on current architectures. + */ +void set_private_info(JNIEnv *jnienv, const char *classname, + jobject obj, void *value); + +/* + * Given a non-qualified name (e.g. "foo"), get the class handl + * for the fully qualified name (e.g. "com.sleepycat.db.foo") + */ +jclass get_class(JNIEnv *jnienv, const char *classname); + +/* Set an individual field in a Db* object. + * The field must be an object type. + */ +void set_object_field(JNIEnv *jnienv, jclass class_of_this, + jobject jthis, const char *object_classname, + const char *name_of_field, jobject obj); + +/* Report an exception back to the java side. + */ +void report_exception(JNIEnv *jnienv, const char *text, int err); + +/* If the object is null, report an exception and return false (0), + * otherwise return true (1). + */ +int verify_non_null(JNIEnv *jnienv, void *obj); + +/* If the error code is non-zero, report an exception and return false (0), + * otherwise return true (1). + */ +int verify_return(JNIEnv *jnienv, int err); + +/* Create an object of the given class, calling its default constructor. + */ +jobject create_default_object(JNIEnv *jnienv, const char *class_name); + +/* Convert an DB object to a Java encapsulation of that object. + * Note: This implementation creates a new Java object on each call, + * so it is generally useful when a new DB object has just been created. + */ +jobject convert_object(JNIEnv *jnienv, const char *class_name, void *dbobj); + +/* Create a copy of the string + */ +char *dup_string(const char *str); + +/* Create a java string from the given string + */ +jstring get_java_string(JNIEnv *jnienv, const char* string); + + +/* Convert a java object to the various C pointers they represent. + */ +DB *get_DB (JNIEnv *jnienv, jobject obj); +DB_BTREE_STAT *get_DB_BTREE_STAT (JNIEnv *jnienv, jobject obj); +DBC *get_DBC (JNIEnv *jnienv, jobject obj); +DB_ENV *get_DB_ENV (JNIEnv *jnienv, jobject obj); +DB_INFO *get_DB_INFO (JNIEnv *jnienv, jobject obj); +DB_LOCK get_DB_LOCK (JNIEnv *jnienv, jobject obj); // not a ptr +DB_LOCKTAB *get_DB_LOCKTAB (JNIEnv *jnienv, jobject obj); +DB_LOG *get_DB_LOG (JNIEnv *jnienv, jobject obj); +DB_LOG_STAT *get_DB_LOG_STAT (JNIEnv *jnienv, jobject obj); +DB_LSN *get_DB_LSN (JNIEnv *jnienv, jobject obj); +DB_MPOOL *get_DB_MPOOL (JNIEnv *jnienv, jobject obj); +DB_MPOOL_FSTAT *get_DB_MPOOL_FSTAT(JNIEnv *jnienv, jobject obj); +DB_MPOOL_STAT *get_DB_MPOOL_STAT (JNIEnv *jnienv, jobject obj); +DB_TXN *get_DB_TXN (JNIEnv *jnienv, jobject obj); +DB_TXNMGR *get_DB_TXNMGR (JNIEnv *jnienv, jobject obj); +DB_TXN_STAT *get_DB_TXN_STAT (JNIEnv *jnienv, jobject obj); +DBT_info *get_DBT (JNIEnv *jnienv, jobject obj); + +/* Convert a C object to the various java pointers they represent. + */ +jobject get_DbBtreeStat (JNIEnv *jnienv, DB_BTREE_STAT *dbobj); +jobject get_Dbc (JNIEnv *jnienv, DBC *dbobj); +jobject get_DbLockTab (JNIEnv *jnienv, DB_LOCKTAB *dbobj); +jobject get_DbLog (JNIEnv *jnienv, DB_LOG *dbobj); +jobject get_DbLogStat (JNIEnv *jnienv, DB_LOG_STAT *dbobj); +jobject get_DbLsn (JNIEnv *jnienv, DB_LSN dbobj); +jobject get_DbMpool (JNIEnv *jnienv, DB_MPOOL *dbobj); +jobject get_DbMpoolStat (JNIEnv *jnienv, DB_MPOOL_STAT *dbobj); +jobject get_DbMpoolFStat (JNIEnv *jnienv, DB_MPOOL_FSTAT *dbobj); +jobject get_DbTxn (JNIEnv *jnienv, DB_TXN *dbobj); +jobject get_DbTxnMgr (JNIEnv *jnienv, DB_TXNMGR *dbobj); +jobject get_DbTxnStat (JNIEnv *jnienv, DB_TXN_STAT *dbobj); + +// The java names of DB classes +const char * const name_DB = "Db"; +const char * const name_DB_BTREE_STAT = "DbBtreeStat"; +const char * const name_DBC = "Dbc"; +const char * const name_DB_ENV = "DbEnv"; +const char * const name_DB_EXCEPTION = "DbException"; +const char * const name_DB_INFO = "DbInfo"; +const char * const name_DB_LOCK = "DbLock"; +const char * const name_DB_LOCKTAB = "DbLockTab"; +const char * const name_DB_LOG = "DbLog"; +const char * const name_DB_LOG_STAT = "DbLogStat"; +const char * const name_DB_LSN = "DbLsn"; +const char * const name_DB_MPOOL = "DbMpool"; +const char * const name_DB_MPOOL_FSTAT = "DbMpoolFStat"; +const char * const name_DB_MPOOL_STAT = "DbMpoolStat"; +const char * const name_DBT = "Dbt"; +const char * const name_DB_TXN = "DbTxn"; +const char * const name_DB_TXNMGR = "DbTxnMgr"; +const char * const name_DB_TXN_STAT = "DbTxnStat"; +const char * const name_DbErrcall = "DbErrcall"; + +#define JAVADB_RO_ACCESS(j_class, j_fieldtype, j_field, c_type, c_field) \ +extern "C" JNIEXPORT j_fieldtype JNICALL \ + Java_com_sleepycat_db_##j_class##_get_1##j_field \ + (JNIEnv *jnienv, jobject jthis) \ +{ \ + c_type *db_this = get_##c_type(jnienv, jthis); \ + \ + if (verify_non_null(jnienv, db_this)) { \ + return db_this->c_field; \ + } \ + return 0; \ +} + +#define JAVADB_WO_ACCESS(j_class, j_fieldtype, j_field, c_type, c_field) \ +extern "C" JNIEXPORT void JNICALL \ + Java_com_sleepycat_db_##j_class##_set_1##j_field \ + (JNIEnv *jnienv, jobject jthis, j_fieldtype value) \ +{ \ + c_type *db_this = get_##c_type(jnienv, jthis); \ + \ + if (verify_non_null(jnienv, db_this)) { \ + db_this->c_field = value; \ + } \ +} + +#define JAVADB_RW_ACCESS(j_class, j_fieldtype, j_field, c_type, c_field) \ + JAVADB_RO_ACCESS(j_class, j_fieldtype, j_field, c_type, c_field) \ + JAVADB_WO_ACCESS(j_class, j_fieldtype, j_field, c_type, c_field) + +#define JAVADB_RO_ACCESS_STRING(j_class, j_field, c_type, c_field, dealloc) \ +extern "C" JNIEXPORT jstring JNICALL \ + Java_com_sleepycat_db_##j_class##_get_1##j_field \ + (JNIEnv *jnienv, jobject jthis) \ +{ \ + c_type *db_this = get_##c_type(jnienv, jthis); \ + \ + if (verify_non_null(jnienv, db_this)) { \ + return get_java_string(jnienv, db_this->c_field); \ + } \ + return 0; \ +} + +#define JAVADB_WO_ACCESS_STRING(j_class, j_field, c_type, c_field, dealloc) \ +extern "C" JNIEXPORT void JNICALL \ + Java_com_sleepycat_db_##j_class##_set_1##j_field \ + (JNIEnv *jnienv, jobject jthis, jstring value) \ +{ \ + c_type *db_this = get_##c_type(jnienv, jthis); \ + \ + if (verify_non_null(jnienv, db_this)) { \ + if (dealloc && db_this->c_field) \ + delete (char*)db_this->c_field; \ + if (value) \ + db_this->c_field = \ + dup_string(jnienv->GetStringUTFChars(value, NULL)); \ + else \ + db_this->c_field = 0; \ + } \ +} + +#define JAVADB_RW_ACCESS_STRING(j_class, j_field, c_type, c_field, dealloc) \ + JAVADB_RO_ACCESS_STRING(j_class, j_field, c_type, c_field, dealloc) \ + JAVADB_WO_ACCESS_STRING(j_class, j_field, c_type, c_field, dealloc) + + +// Replacements for C++ new and delete. +// Our experience with Sparc/gcc shared libraries is that new/delete +// does not work correctly, so we use malloc. +// Obviously, these macros are quite limited and do not accept +// constructor args. But our use of new/delete is also quite +// limited in this library. +// +#undef NEW +#undef NEW_ARRAY +#undef DELETE +#undef DELETE_ARRAY + +#ifdef unix +// +// currently NEW zeros (to prevent common bugs), NEW_ARRAY does not, +// since it is almost always used for string creation. +// +#define NEW(type) ((type*)memset(malloc(sizeof(type)), 0, sizeof(type))) +#define NEW_ARRAY(type,n) ((type*)malloc(sizeof(type)*n)) +#define DELETE(p) (free(p)) +#define DELETE_ARRAY(p) (free(p)) +#else +#define NEW(type) new type +#define NEW_ARRAY(type,n) new type[n] +#define DELETE(p) delete p +#define DELETE_ARRAY(p) delete [] p +#endif + +#endif /* !_JAVA_UTIL_H_ */ diff --git a/mozilla/db/lock/lock.c b/mozilla/db/lock/lock.c new file mode 100644 index 00000000000..3d20e0d65b4 --- /dev/null +++ b/mozilla/db/lock/lock.c @@ -0,0 +1,790 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)lock.c 10.52 (Sleepycat) 5/10/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_page.h" +#include "db_shash.h" +#include "lock.h" +#include "common_ext.h" +#include "db_am.h" + +static void __lock_checklocker __P((DB_LOCKTAB *, struct __db_lock *, int)); +static void __lock_freeobj __P((DB_LOCKTAB *, DB_LOCKOBJ *)); +static int __lock_get_internal __P((DB_LOCKTAB *, u_int32_t, u_int32_t, + const DBT *, db_lockmode_t, struct __db_lock **)); +static int __lock_put_internal __P((DB_LOCKTAB *, struct __db_lock *, int)); +static void __lock_remove_waiter + __P((DB_LOCKTAB *, DB_LOCKOBJ *, struct __db_lock *, db_status_t)); + +int +lock_id(lt, idp) + DB_LOCKTAB *lt; + u_int32_t *idp; +{ + u_int32_t id; + + LOCK_LOCKREGION(lt); + if (lt->region->id >= DB_LOCK_MAXID) + lt->region->id = 0; + id = ++lt->region->id; + UNLOCK_LOCKREGION(lt); + + *idp = id; + return (0); +} + +int +lock_vec(lt, locker, flags, list, nlist, elistp) + DB_LOCKTAB *lt; + u_int32_t locker, flags; + int nlist; + DB_LOCKREQ *list, **elistp; +{ + struct __db_lock *lp; + DB_LOCKOBJ *sh_obj, *sh_locker; + int i, ret, run_dd; + + /* Validate arguments. */ + if ((ret = + __db_fchk(lt->dbenv, "lock_vec", flags, DB_LOCK_NOWAIT)) != 0) + return (ret); + + LOCK_LOCKREGION(lt); + + if ((ret = __lock_validate_region(lt)) != 0) { + UNLOCK_LOCKREGION(lt); + return (ret); + } + + ret = 0; + for (i = 0; i < nlist && ret == 0; i++) { + switch (list[i].op) { + case DB_LOCK_GET: + ret = __lock_get_internal(lt, locker, flags, + list[i].obj, list[i].mode, &lp); + if (ret == 0) { + list[i].lock = LOCK_TO_OFFSET(lt, lp); + lt->region->nrequests++; + } + break; + case DB_LOCK_PUT: + lp = OFFSET_TO_LOCK(lt, list[i].lock); + if (lp->holder != locker) { + ret = DB_LOCK_NOTHELD; + break; + } + list[i].mode = lp->mode; + + /* XXX Need to copy the object. ??? */ + ret = __lock_put_internal(lt, lp, 0); + break; + case DB_LOCK_PUT_ALL: + /* Find the locker. */ + if ((ret = __lock_getobj(lt, locker, + NULL, DB_LOCK_LOCKER, &sh_locker)) != 0) + break; + + for (lp = SH_LIST_FIRST(&sh_locker->heldby, __db_lock); + lp != NULL; + lp = SH_LIST_FIRST(&sh_locker->heldby, __db_lock)) { + if ((ret = __lock_put_internal(lt, lp, 1)) != 0) + break; + } + __lock_freeobj(lt, sh_locker); + lt->region->nlockers--; + break; + case DB_LOCK_PUT_OBJ: + + /* Look up the object in the hash table. */ + HASHLOOKUP(lt->hashtab, __db_lockobj, links, + list[i].obj, sh_obj, lt->region->table_size, + __lock_ohash, __lock_cmp); + if (sh_obj == NULL) { + ret = EINVAL; + break; + } + /* + * Release waiters first, because they won't cause + * anyone else to be awakened. If we release the + * lockers first, all the waiters get awakened + * needlessly. + */ + for (lp = SH_TAILQ_FIRST(&sh_obj->waiters, __db_lock); + lp != NULL; + lp = SH_TAILQ_FIRST(&sh_obj->waiters, __db_lock)) { + lt->region->nreleases += lp->refcount; + __lock_remove_waiter(lt, sh_obj, lp, + DB_LSTAT_NOGRANT); + __lock_checklocker(lt, lp, 1); + } + + for (lp = SH_TAILQ_FIRST(&sh_obj->holders, __db_lock); + lp != NULL; + lp = SH_TAILQ_FIRST(&sh_obj->holders, __db_lock)) { + + lt->region->nreleases += lp->refcount; + SH_LIST_REMOVE(lp, locker_links, __db_lock); + SH_TAILQ_REMOVE(&sh_obj->holders, lp, links, + __db_lock); + lp->status = DB_LSTAT_FREE; + SH_TAILQ_INSERT_HEAD(<->region->free_locks, + lp, links, __db_lock); + } + + /* Now free the object. */ + __lock_freeobj(lt, sh_obj); + break; +#ifdef DEBUG + case DB_LOCK_DUMP: + /* Find the locker. */ + if ((ret = __lock_getobj(lt, locker, + NULL, DB_LOCK_LOCKER, &sh_locker)) != 0) + break; + + for (lp = SH_LIST_FIRST(&sh_locker->heldby, __db_lock); + lp != NULL; + lp = SH_LIST_NEXT(lp, locker_links, __db_lock)) { + __lock_printlock(lt, lp, 1); + ret = EINVAL; + } + if (ret == 0) { + __lock_freeobj(lt, sh_locker); + lt->region->nlockers--; + } + break; +#endif + default: + ret = EINVAL; + break; + } + } + + if (lt->region->need_dd && lt->region->detect != DB_LOCK_NORUN) { + run_dd = 1; + lt->region->need_dd = 0; + } else + run_dd = 0; + + UNLOCK_LOCKREGION(lt); + + if (ret == 0 && run_dd) + lock_detect(lt, 0, lt->region->detect); + + if (elistp && ret != 0) + *elistp = &list[i - 1]; + return (ret); +} + +int +lock_get(lt, locker, flags, obj, lock_mode, lock) + DB_LOCKTAB *lt; + u_int32_t locker, flags; + const DBT *obj; + db_lockmode_t lock_mode; + DB_LOCK *lock; +{ + struct __db_lock *lockp; + int ret; + + /* Validate arguments. */ + if ((ret = + __db_fchk(lt->dbenv, "lock_get", flags, DB_LOCK_NOWAIT)) != 0) + return (ret); + + LOCK_LOCKREGION(lt); + + ret = __lock_validate_region(lt); + if (ret == 0 && (ret = __lock_get_internal(lt, + locker, flags, obj, lock_mode, &lockp)) == 0) { + *lock = LOCK_TO_OFFSET(lt, lockp); + lt->region->nrequests++; + } + + UNLOCK_LOCKREGION(lt); + return (ret); +} + +int +lock_put(lt, lock) + DB_LOCKTAB *lt; + DB_LOCK lock; +{ + struct __db_lock *lockp; + int ret, run_dd; + + LOCK_LOCKREGION(lt); + + if ((ret = __lock_validate_region(lt)) != 0) + return (ret); + else { + lockp = OFFSET_TO_LOCK(lt, lock); + ret = __lock_put_internal(lt, lockp, 0); + } + + __lock_checklocker(lt, lockp, 0); + + if (lt->region->need_dd && lt->region->detect != DB_LOCK_NORUN) { + run_dd = 1; + lt->region->need_dd = 0; + } else + run_dd = 0; + + UNLOCK_LOCKREGION(lt); + + if (ret == 0 && run_dd) + lock_detect(lt, 0, lt->region->detect); + + return (ret); +} + +static int +__lock_put_internal(lt, lockp, do_all) + DB_LOCKTAB *lt; + struct __db_lock *lockp; + int do_all; +{ + struct __db_lock *lp_w, *lp_h, *next_waiter; + DB_LOCKOBJ *sh_obj; + int state_changed; + + if (lockp->refcount == 0 || (lockp->status != DB_LSTAT_HELD && + lockp->status != DB_LSTAT_WAITING) || lockp->obj == 0) { + __db_err(lt->dbenv, "lock_put: invalid lock %lu", + (u_long)((u_int8_t *)lockp - (u_int8_t *)lt->region)); + return (EINVAL); + } + + if (do_all) + lt->region->nreleases += lockp->refcount; + else + lt->region->nreleases++; + if (do_all == 0 && lockp->refcount > 1) { + lockp->refcount--; + return (0); + } + + /* Get the object associated with this lock. */ + sh_obj = (DB_LOCKOBJ *)((u_int8_t *)lockp + lockp->obj); + + /* Remove lock from locker list. */ + SH_LIST_REMOVE(lockp, locker_links, __db_lock); + + /* Remove this lock from its holders/waitlist. */ + if (lockp->status != DB_LSTAT_HELD) + __lock_remove_waiter(lt, sh_obj, lockp, DB_LSTAT_FREE); + else + SH_TAILQ_REMOVE(&sh_obj->holders, lockp, links, __db_lock); + + /* + * We need to do lock promotion. We also need to determine if + * we're going to need to run the deadlock detector again. If + * we release locks, and there are waiters, but no one gets promoted, + * then we haven't fundamentally changed the lockmgr state, so + * we may still have a deadlock and we have to run again. However, + * if there were no waiters, or we actually promoted someone, then + * we are OK and we don't have to run it immediately. + */ + for (lp_w = SH_TAILQ_FIRST(&sh_obj->waiters, __db_lock), + state_changed = lp_w == NULL; + lp_w != NULL; + lp_w = next_waiter) { + next_waiter = SH_TAILQ_NEXT(lp_w, links, __db_lock); + for (lp_h = SH_TAILQ_FIRST(&sh_obj->holders, __db_lock); + lp_h != NULL; + lp_h = SH_TAILQ_NEXT(lp_h, links, __db_lock)) { + if (CONFLICTS(lt, lp_h->mode, lp_w->mode) && + lp_h->holder != lp_w->holder) + break; + } + if (lp_h != NULL) /* Found a conflict. */ + break; + + /* No conflict, promote the waiting lock. */ + SH_TAILQ_REMOVE(&sh_obj->waiters, lp_w, links, __db_lock); + lp_w->status = DB_LSTAT_PENDING; + SH_TAILQ_INSERT_TAIL(&sh_obj->holders, lp_w, links); + + /* Wake up waiter. */ + (void)__db_mutex_unlock(&lp_w->mutex, lt->reginfo.fd); + state_changed = 1; + } + + /* Check if object should be reclaimed. */ + if (SH_TAILQ_FIRST(&sh_obj->holders, __db_lock) == NULL) { + HASHREMOVE_EL(lt->hashtab, __db_lockobj, + links, sh_obj, lt->region->table_size, __lock_lhash); + if (sh_obj->lockobj.size > sizeof(sh_obj->objdata)) + __db_shalloc_free(lt->mem, + SH_DBT_PTR(&sh_obj->lockobj)); + SH_TAILQ_INSERT_HEAD(<->region->free_objs, sh_obj, links, + __db_lockobj); + state_changed = 1; + } + + /* Free lock. */ + lockp->status = DB_LSTAT_FREE; + SH_TAILQ_INSERT_HEAD(<->region->free_locks, lockp, links, __db_lock); + + /* + * If we did not promote anyone; we need to run the deadlock + * detector again. + */ + if (state_changed == 0) + lt->region->need_dd = 1; + + return (0); +} + +static int +__lock_get_internal(lt, locker, flags, obj, lock_mode, lockp) + DB_LOCKTAB *lt; + u_int32_t locker, flags; + const DBT *obj; + db_lockmode_t lock_mode; + struct __db_lock **lockp; +{ + struct __db_lock *newl, *lp; + DB_LOCKOBJ *sh_obj, *sh_locker; + DB_LOCKREGION *lrp; + size_t newl_off; + int ihold, ret; + + ret = 0; + /* + * Check that lock mode is valid. + */ + + lrp = lt->region; + if ((u_int32_t)lock_mode >= lrp->nmodes) { + __db_err(lt->dbenv, + "lock_get: invalid lock mode %lu\n", (u_long)lock_mode); + return (EINVAL); + } + + /* Allocate a new lock. Optimize for the common case of a grant. */ + if ((newl = SH_TAILQ_FIRST(&lrp->free_locks, __db_lock)) == NULL) { + if ((ret = __lock_grow_region(lt, DB_LOCK_LOCK, 0)) != 0) + return (ret); + lrp = lt->region; + newl = SH_TAILQ_FIRST(&lrp->free_locks, __db_lock); + } + newl_off = LOCK_TO_OFFSET(lt, newl); + + /* Optimize for common case of granting a lock. */ + SH_TAILQ_REMOVE(&lrp->free_locks, newl, links, __db_lock); + + newl->mode = lock_mode; + newl->status = DB_LSTAT_HELD; + newl->holder = locker; + newl->refcount = 1; + + if ((ret = __lock_getobj(lt, 0, obj, DB_LOCK_OBJTYPE, &sh_obj)) != 0) + return (ret); + + lrp = lt->region; /* getobj might have grown */ + newl = OFFSET_TO_LOCK(lt, newl_off); + + /* Now make new lock point to object */ + newl->obj = SH_PTR_TO_OFF(newl, sh_obj); + + /* + * Now we have a lock and an object and we need to see if we should + * grant the lock. We use a FIFO ordering so we can only grant a + * new lock if it does not conflict with anyone on the holders list + * OR anyone on the waiters list. The reason that we don't grant if + * there's a conflict is that this can lead to starvation (a writer + * waiting on a popularly read item will never be granted). The + * downside of this is that a waiting reader can prevent an upgrade + * from reader to writer, which is not uncommon. + * + * There is one exception to the no-conflict rule. If a lock is held + * by the requesting locker AND the new lock does not conflict with + * any other holders, then we grant the lock. The most common place + * this happens is when the holder has a WRITE lock and a READ lock + * request comes in for the same locker. If we do not grant the read + * lock, then we guarantee deadlock. + * + * In case of conflict, we put the new lock on the end of the waiters + * list. + */ + ihold = 0; + for (lp = SH_TAILQ_FIRST(&sh_obj->holders, __db_lock); + lp != NULL; + lp = SH_TAILQ_NEXT(lp, links, __db_lock)) { + if (locker == lp->holder) { + if (lp->mode == lock_mode && + lp->status == DB_LSTAT_HELD) { + /* Lock is held, just inc the ref count. */ + lp->refcount++; + SH_TAILQ_INSERT_HEAD(&lrp->free_locks, + newl, links, __db_lock); + *lockp = lp; + return (0); + } else + ihold = 1; + } else if (CONFLICTS(lt, lp->mode, lock_mode)) + break; + } + + if (lp == NULL && !ihold) + for (lp = SH_TAILQ_FIRST(&sh_obj->waiters, __db_lock); + lp != NULL; + lp = SH_TAILQ_NEXT(lp, links, __db_lock)) { + if (CONFLICTS(lt, lp->mode, lock_mode) && + locker != lp->holder) + break; + } + if (lp == NULL) + SH_TAILQ_INSERT_TAIL(&sh_obj->holders, newl, links); + else if (!(flags & DB_LOCK_NOWAIT)) + SH_TAILQ_INSERT_TAIL(&sh_obj->waiters, newl, links); + else { + /* Free the lock and return an error. */ + newl->status = DB_LSTAT_FREE; + SH_TAILQ_INSERT_HEAD(&lrp->free_locks, newl, links, __db_lock); + return (DB_LOCK_NOTGRANTED); + } + + /* + * This is really a blocker for the process, so initialize it + * set. That way the current process will block when it tries + * to get it and the waking process will release it. + */ + (void)__db_mutex_init(&newl->mutex, + MUTEX_LOCK_OFFSET(lt->region, &newl->mutex)); + (void)__db_mutex_lock(&newl->mutex, lt->reginfo.fd); + + /* + * Now, insert the lock onto its locker's list. + */ + if ((ret = + __lock_getobj(lt, locker, NULL, DB_LOCK_LOCKER, &sh_locker)) != 0) + return (ret); + + lrp = lt->region; + SH_LIST_INSERT_HEAD(&sh_locker->heldby, newl, locker_links, __db_lock); + + if (lp != NULL) { + newl->status = DB_LSTAT_WAITING; + lrp->nconflicts++; + /* + * We are about to wait; must release the region mutex. + * Then, when we wakeup, we need to reacquire the region + * mutex before continuing. + */ + if (lrp->detect == DB_LOCK_NORUN) + lt->region->need_dd = 1; + UNLOCK_LOCKREGION(lt); + + /* + * We are about to wait; before waiting, see if the deadlock + * detector should be run. + */ + if (lrp->detect != DB_LOCK_NORUN) + ret = lock_detect(lt, 0, lrp->detect); + + (void)__db_mutex_lock(&newl->mutex, lt->reginfo.fd); + + LOCK_LOCKREGION(lt); + if (newl->status != DB_LSTAT_PENDING) { + /* Return to free list. */ + __lock_checklocker(lt, newl, 0); + SH_TAILQ_INSERT_HEAD(&lrp->free_locks, newl, links, + __db_lock); + switch (newl->status) { + case DB_LSTAT_ABORTED: + ret = DB_LOCK_DEADLOCK; + break; + case DB_LSTAT_NOGRANT: + ret = DB_LOCK_NOTGRANTED; + break; + default: + ret = EINVAL; + break; + } + newl->status = DB_LSTAT_FREE; + newl = NULL; + } else + newl->status = DB_LSTAT_HELD; + } + + *lockp = newl; + return (ret); +} + +/* + * __lock_is_locked -- + * + * PUBLIC: int __lock_is_locked + * PUBLIC: __P((DB_LOCKTAB *, u_int32_t, DBT *, db_lockmode_t)); + */ +int +__lock_is_locked(lt, locker, dbt, mode) + DB_LOCKTAB *lt; + u_int32_t locker; + DBT *dbt; + db_lockmode_t mode; +{ + struct __db_lock *lp; + DB_LOCKOBJ *sh_obj; + DB_LOCKREGION *lrp; + + lrp = lt->region; + + /* Look up the object in the hash table. */ + HASHLOOKUP(lt->hashtab, __db_lockobj, links, + dbt, sh_obj, lrp->table_size, __lock_ohash, __lock_cmp); + if (sh_obj == NULL) + return (0); + + for (lp = SH_TAILQ_FIRST(&sh_obj->holders, __db_lock); + lp != NULL; + lp = SH_TAILQ_FIRST(&sh_obj->holders, __db_lock)) { + if (lp->holder == locker && lp->mode == mode) + return (1); + } + + return (0); +} + +/* + * __lock_printlock -- + * + * PUBLIC: void __lock_printlock __P((DB_LOCKTAB *, struct __db_lock *, int)); + */ +void +__lock_printlock(lt, lp, ispgno) + DB_LOCKTAB *lt; + struct __db_lock *lp; + int ispgno; +{ + DB_LOCKOBJ *lockobj; + db_pgno_t pgno; + size_t obj; + u_int8_t *ptr; + const char *mode, *status; + + switch (lp->mode) { + case DB_LOCK_IREAD: + mode = "IREAD"; + break; + case DB_LOCK_IWR: + mode = "IWR"; + break; + case DB_LOCK_IWRITE: + mode = "IWRITE"; + break; + case DB_LOCK_NG: + mode = "NG"; + break; + case DB_LOCK_READ: + mode = "READ"; + break; + case DB_LOCK_WRITE: + mode = "WRITE"; + break; + default: + mode = "UNKNOWN"; + break; + } + switch (lp->status) { + case DB_LSTAT_ABORTED: + status = "ABORT"; + break; + case DB_LSTAT_ERR: + status = "ERROR"; + break; + case DB_LSTAT_FREE: + status = "FREE"; + break; + case DB_LSTAT_HELD: + status = "HELD"; + break; + case DB_LSTAT_NOGRANT: + status = "NONE"; + break; + case DB_LSTAT_WAITING: + status = "WAIT"; + break; + case DB_LSTAT_PENDING: + status = "PENDING"; + break; + default: + status = "UNKNOWN"; + break; + } + printf("\t%lx\t%s\t%lu\t%s\t", + (u_long)lp->holder, mode, (u_long)lp->refcount, status); + + lockobj = (DB_LOCKOBJ *)((u_int8_t *)lp + lp->obj); + ptr = SH_DBT_PTR(&lockobj->lockobj); + if (ispgno) { + /* Assume this is a DBT lock. */ + memcpy(&pgno, ptr, sizeof(db_pgno_t)); + printf("page %lu\n", (u_long)pgno); + } else { + obj = (u_int8_t *)lp + lp->obj - (u_int8_t *)lt->region; + printf("0x%lx ", (u_long)obj); + __db_pr(ptr, lockobj->lockobj.size); + printf("\n"); + } +} + +/* + * PUBLIC: int __lock_getobj __P((DB_LOCKTAB *, + * PUBLIC: u_int32_t, const DBT *, u_int32_t type, DB_LOCKOBJ **)); + */ +int +__lock_getobj(lt, locker, dbt, type, objp) + DB_LOCKTAB *lt; + u_int32_t locker, type; + const DBT *dbt; + DB_LOCKOBJ **objp; +{ + DB_LOCKREGION *lrp; + DB_LOCKOBJ *sh_obj; + u_int32_t obj_size; + int ret; + void *p, *src; + + lrp = lt->region; + + /* Look up the object in the hash table. */ + if (type == DB_LOCK_OBJTYPE) { + HASHLOOKUP(lt->hashtab, __db_lockobj, links, dbt, sh_obj, + lrp->table_size, __lock_ohash, __lock_cmp); + obj_size = dbt->size; + } else { + HASHLOOKUP(lt->hashtab, __db_lockobj, links, locker, + sh_obj, lrp->table_size, __lock_locker_hash, + __lock_locker_cmp); + obj_size = sizeof(locker); + } + + /* + * If we found the object, then we can just return it. If + * we didn't find the object, then we need to create it. + */ + if (sh_obj == NULL) { + /* Create new object and then insert it into hash table. */ + if ((sh_obj = + SH_TAILQ_FIRST(&lrp->free_objs, __db_lockobj)) == NULL) { + if ((ret = __lock_grow_region(lt, DB_LOCK_OBJ, 0)) != 0) + return (ret); + lrp = lt->region; + sh_obj = SH_TAILQ_FIRST(&lrp->free_objs, __db_lockobj); + } + + /* + * If we can fit this object in the structure, do so instead + * of shalloc-ing space for it. + */ + if (obj_size <= sizeof(sh_obj->objdata)) + p = sh_obj->objdata; + else + if ((ret = + __db_shalloc(lt->mem, obj_size, 0, &p)) != 0) { + if ((ret = __lock_grow_region(lt, + DB_LOCK_MEM, obj_size)) != 0) + return (ret); + lrp = lt->region; + /* Reacquire the head of the list. */ + sh_obj = SH_TAILQ_FIRST(&lrp->free_objs, + __db_lockobj); + (void)__db_shalloc(lt->mem, obj_size, 0, &p); + } + + src = type == DB_LOCK_OBJTYPE ? dbt->data : (void *)&locker; + memcpy(p, src, obj_size); + + sh_obj->type = type; + SH_TAILQ_REMOVE(&lrp->free_objs, sh_obj, links, __db_lockobj); + + SH_TAILQ_INIT(&sh_obj->waiters); + if (type == DB_LOCK_LOCKER) + SH_LIST_INIT(&sh_obj->heldby); + else + SH_TAILQ_INIT(&sh_obj->holders); + sh_obj->lockobj.size = obj_size; + sh_obj->lockobj.off = SH_PTR_TO_OFF(&sh_obj->lockobj, p); + + HASHINSERT(lt->hashtab, + __db_lockobj, links, sh_obj, lrp->table_size, __lock_lhash); + + if (type == DB_LOCK_LOCKER) + lrp->nlockers++; + } + + *objp = sh_obj; + return (0); +} + +/* + * Any lock on the waitlist has a process waiting for it. Therefore, we + * can't return the lock to the freelist immediately. Instead, we can + * remove the lock from the list of waiters, set the status field of the + * lock, and then let the process waking up return the lock to the + * free list. + */ +static void +__lock_remove_waiter(lt, sh_obj, lockp, status) + DB_LOCKTAB *lt; + DB_LOCKOBJ *sh_obj; + struct __db_lock *lockp; + db_status_t status; +{ + SH_TAILQ_REMOVE(&sh_obj->waiters, lockp, links, __db_lock); + lockp->status = status; + + /* Wake whoever is waiting on this lock. */ + (void)__db_mutex_unlock(&lockp->mutex, lt->reginfo.fd); +} + +static void +__lock_checklocker(lt, lockp, do_remove) + DB_LOCKTAB *lt; + struct __db_lock *lockp; + int do_remove; +{ + DB_LOCKOBJ *sh_locker; + + if (do_remove) + SH_LIST_REMOVE(lockp, locker_links, __db_lock); + + /* if the locker list is NULL, free up the object. */ + if (__lock_getobj(lt, lockp->holder, NULL, DB_LOCK_LOCKER, &sh_locker) + == 0 && SH_LIST_FIRST(&sh_locker->heldby, __db_lock) == NULL) { + __lock_freeobj(lt, sh_locker); + lt->region->nlockers--; + } +} + +static void +__lock_freeobj(lt, obj) + DB_LOCKTAB *lt; + DB_LOCKOBJ *obj; +{ + HASHREMOVE_EL(lt->hashtab, + __db_lockobj, links, obj, lt->region->table_size, __lock_lhash); + if (obj->lockobj.size > sizeof(obj->objdata)) + __db_shalloc_free(lt->mem, SH_DBT_PTR(&obj->lockobj)); + SH_TAILQ_INSERT_HEAD(<->region->free_objs, obj, links, __db_lockobj); +} diff --git a/mozilla/db/lock/lock_conflict.c b/mozilla/db/lock/lock_conflict.c new file mode 100644 index 00000000000..870aa0dc17a --- /dev/null +++ b/mozilla/db/lock/lock_conflict.c @@ -0,0 +1,39 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)lock_conflict.c 10.3 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#endif + +#include "db_int.h" + +/* + * The conflict arrays are set up such that the row is the lock you + * are holding and the column is the lock that is desired. + */ +const u_int8_t db_rw_conflicts[] = { + /* N R W */ + /* N */ 0, 0, 0, + /* R */ 0, 0, 1, + /* W */ 0, 1, 1 +}; + +const u_int8_t db_riw_conflicts[] = { + /* N S X IS IX SIX */ + /* N */ 0, 0, 0, 0, 0, 0, + /* S */ 0, 0, 1, 0, 1, 1, + /* X */ 1, 1, 1, 1, 1, 1, + /* IS */ 0, 0, 1, 0, 0, 0, + /* IX */ 0, 1, 1, 0, 0, 0, + /* SIX */ 0, 1, 1, 0, 0, 0 +}; diff --git a/mozilla/db/lock/lock_deadlock.c b/mozilla/db/lock/lock_deadlock.c new file mode 100644 index 00000000000..4de492944e9 --- /dev/null +++ b/mozilla/db/lock/lock_deadlock.c @@ -0,0 +1,492 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)lock_deadlock.c 10.32 (Sleepycat) 4/26/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_shash.h" +#include "lock.h" +#include "common_ext.h" + +#define ISSET_MAP(M, N) (M[(N) / 32] & (1 << (N) % 32)) + +#define CLEAR_MAP(M, N) { \ + u_int32_t __i; \ + for (__i = 0; __i < (N); __i++) \ + M[__i] = 0; \ +} + +#define SET_MAP(M, B) (M[(B) / 32] |= (1 << ((B) % 32))) +#define CLR_MAP(M, B) (M[(B) / 32] &= ~(1 << ((B) % 32))) + +#define OR_MAP(D, S, N) { \ + u_int32_t __i; \ + for (__i = 0; __i < (N); __i++) \ + D[__i] |= S[__i]; \ +} +#define BAD_KILLID 0xffffffff + +typedef struct { + int valid; + u_int32_t id; + DB_LOCK last_lock; + db_pgno_t pgno; +} locker_info; + +static int __dd_abort __P((DB_ENV *, locker_info *)); +static int __dd_build + __P((DB_ENV *, u_int32_t **, u_int32_t *, locker_info **)); +static u_int32_t + *__dd_find __P((u_int32_t *, locker_info *, u_int32_t)); + +#ifdef DIAGNOSTIC +static void __dd_debug __P((DB_ENV *, locker_info *, u_int32_t *, u_int32_t)); +#endif + +int +lock_detect(lt, flags, atype) + DB_LOCKTAB *lt; + u_int32_t flags, atype; +{ + DB_ENV *dbenv; + locker_info *idmap; + u_int32_t *bitmap, *deadlock, i, killid, nentries, nlockers; + int do_pass, ret; + + /* Validate arguments. */ + if ((ret = + __db_fchk(lt->dbenv, "lock_detect", flags, DB_LOCK_CONFLICT)) != 0) + return (ret); + + /* Check if a detector run is necessary. */ + dbenv = lt->dbenv; + if (LF_ISSET(DB_LOCK_CONFLICT)) { + /* Make a pass every time a lock waits. */ + LOCK_LOCKREGION(lt); + do_pass = dbenv->lk_info->region->need_dd != 0; + UNLOCK_LOCKREGION(lt); + + if (!do_pass) + return (0); + } + + /* Build the waits-for bitmap. */ + if ((ret = __dd_build(dbenv, &bitmap, &nlockers, &idmap)) != 0) + return (ret); + + if (nlockers == 0) + return (0); +#ifdef DIAGNOSTIC + if (dbenv->db_verbose != 0) + __dd_debug(dbenv, idmap, bitmap, nlockers); +#endif + /* Find a deadlock. */ + deadlock = __dd_find(bitmap, idmap, nlockers); + nentries = ALIGN(nlockers, 32) / 32; + killid = BAD_KILLID; + if (deadlock != NULL) { + /* Kill someone. */ + switch (atype) { + case DB_LOCK_OLDEST: + /* + * Find the first bit set in the current + * array and then look for a lower tid in + * the array. + */ + for (i = 0; i < nlockers; i++) + if (ISSET_MAP(deadlock, i)) + killid = i; + + if (killid == BAD_KILLID) { + __db_err(dbenv, + "warning: could not find locker to abort"); + break; + } + + /* + * The oldest transaction has the lowest + * transaction id. + */ + for (i = killid + 1; i < nlockers; i++) + if (ISSET_MAP(deadlock, i) && + idmap[i].id < idmap[killid].id) + killid = i; + break; + case DB_LOCK_DEFAULT: + case DB_LOCK_RANDOM: + /* + * We are trying to calculate the id of the + * locker whose entry is indicated by deadlock. + */ + killid = (deadlock - bitmap) / nentries; + break; + case DB_LOCK_YOUNGEST: + /* + * Find the first bit set in the current + * array and then look for a lower tid in + * the array. + */ + for (i = 0; i < nlockers; i++) + if (ISSET_MAP(deadlock, i)) + killid = i; + + if (killid == BAD_KILLID) { + __db_err(dbenv, + "warning: could not find locker to abort"); + break; + } + /* + * The youngest transaction has the highest + * transaction id. + */ + for (i = killid + 1; i < nlockers; i++) + if (ISSET_MAP(deadlock, i) && + idmap[i].id > idmap[killid].id) + killid = i; + break; + default: + killid = BAD_KILLID; + ret = EINVAL; + } + + /* Kill the locker with lockid idmap[killid]. */ + if (dbenv->db_verbose != 0 && killid != BAD_KILLID) + __db_err(dbenv, "Aborting locker %lx", + (u_long)idmap[killid].id); + + if (killid != BAD_KILLID && + (ret = __dd_abort(dbenv, &idmap[killid])) != 0) + __db_err(dbenv, + "warning: unable to abort locker %lx", + (u_long)idmap[killid].id); + } + __db_free(bitmap); + __db_free(idmap); + + return (ret); +} + +/* + * ======================================================================== + * Utilities + */ +static int +__dd_build(dbenv, bmp, nlockers, idmap) + DB_ENV *dbenv; + u_int32_t **bmp, *nlockers; + locker_info **idmap; +{ + struct __db_lock *lp; + DB_LOCKTAB *lt; + DB_LOCKOBJ *op, *lo, *lockerp; + u_int8_t *pptr; + locker_info *id_array; + u_int32_t *bitmap, count, *entryp, i, id, nentries, *tmpmap; + int is_first; + + lt = dbenv->lk_info; + + /* + * We'll check how many lockers there are, add a few more in for + * good measure and then allocate all the structures. Then we'll + * verify that we have enough room when we go back in and get the + * mutex the second time. + */ + LOCK_LOCKREGION(lt); +retry: count = lt->region->nlockers; + lt->region->need_dd = 0; + UNLOCK_LOCKREGION(lt); + + if (count == 0) { + *nlockers = 0; + return (0); + } + + if (dbenv->db_verbose) + __db_err(dbenv, "%lu lockers", (u_long)count); + + count += 10; + nentries = ALIGN(count, 32) / 32; + /* + * Allocate enough space for a count by count bitmap matrix. + * + * XXX + * We can probably save the malloc's between iterations just + * reallocing if necessary because count grew by too much. + */ + if ((bitmap = (u_int32_t *)__db_calloc((size_t)count, + sizeof(u_int32_t) * nentries)) == NULL) { + __db_err(dbenv, "%s", strerror(ENOMEM)); + return (ENOMEM); + } + + if ((tmpmap = + (u_int32_t *)__db_calloc(sizeof(u_int32_t), nentries)) == NULL) { + __db_err(dbenv, "%s", strerror(ENOMEM)); + __db_free(bitmap); + return (ENOMEM); + } + + if ((id_array = (locker_info *)__db_calloc((size_t)count, + sizeof(locker_info))) == NULL) { + __db_err(dbenv, "%s", strerror(ENOMEM)); + __db_free(bitmap); + __db_free(tmpmap); + return (ENOMEM); + } + + /* + * Now go back in and actually fill in the matrix. + */ + LOCK_LOCKREGION(lt); + if (lt->region->nlockers > count) { + __db_free(bitmap); + __db_free(tmpmap); + __db_free(id_array); + goto retry; + } + + /* + * First we go through and assign each locker a deadlock detector id. + * Note that we fill in the idmap in the next loop since that's the + * only place where we conveniently have both the deadlock id and the + * actual locker. + */ + for (id = 0, i = 0; i < lt->region->table_size; i++) + for (op = SH_TAILQ_FIRST(<->hashtab[i], __db_lockobj); + op != NULL; op = SH_TAILQ_NEXT(op, links, __db_lockobj)) + if (op->type == DB_LOCK_LOCKER) + op->dd_id = id++; + /* + * We go through the hash table and find each object. For each object, + * we traverse the waiters list and add an entry in the waitsfor matrix + * for each waiter/holder combination. + */ + for (i = 0; i < lt->region->table_size; i++) { + for (op = SH_TAILQ_FIRST(<->hashtab[i], __db_lockobj); + op != NULL; op = SH_TAILQ_NEXT(op, links, __db_lockobj)) { + if (op->type != DB_LOCK_OBJTYPE) + continue; + CLEAR_MAP(tmpmap, nentries); + + /* + * First we go through and create a bit map that + * represents all the holders of this object. + */ + for (lp = SH_TAILQ_FIRST(&op->holders, __db_lock); + lp != NULL; + lp = SH_TAILQ_NEXT(lp, links, __db_lock)) { + if (__lock_getobj(lt, lp->holder, + NULL, DB_LOCK_LOCKER, &lockerp) != 0) { + __db_err(dbenv, + "warning unable to find object"); + continue; + } + id_array[lockerp->dd_id].id = lp->holder; + id_array[lockerp->dd_id].valid = 1; + + /* + * If the holder has already been aborted, then + * we should ignore it for now. + */ + if (lp->status == DB_LSTAT_HELD) + SET_MAP(tmpmap, lockerp->dd_id); + } + + /* + * Next, for each waiter, we set its row in the matrix + * equal to the map of holders we set up above. + */ + for (is_first = 1, + lp = SH_TAILQ_FIRST(&op->waiters, __db_lock); + lp != NULL; + is_first = 0, + lp = SH_TAILQ_NEXT(lp, links, __db_lock)) { + if (__lock_getobj(lt, lp->holder, + NULL, DB_LOCK_LOCKER, &lockerp) != 0) { + __db_err(dbenv, + "warning unable to find object"); + continue; + } + id_array[lockerp->dd_id].id = lp->holder; + id_array[lockerp->dd_id].valid = 1; + + /* + * If the transaction is pending abortion, then + * ignore it on this iteration. + */ + if (lp->status != DB_LSTAT_WAITING) + continue; + + entryp = bitmap + (nentries * lockerp->dd_id); + OR_MAP(entryp, tmpmap, nentries); + /* + * If this is the first waiter on the queue, + * then we remove the waitsfor relationship + * with oneself. However, if it's anywhere + * else on the queue, then we have to keep + * it and we have an automatic deadlock. + */ + if (is_first) + CLR_MAP(entryp, lockerp->dd_id); + } + } + } + + /* Now for each locker; record its last lock. */ + for (id = 0; id < count; id++) { + if (!id_array[id].valid) + continue; + if (__lock_getobj(lt, + id_array[id].id, NULL, DB_LOCK_LOCKER, &lockerp) != 0) { + __db_err(dbenv, + "No locks for locker %lu", (u_long)id_array[id].id); + continue; + } + lp = SH_LIST_FIRST(&lockerp->heldby, __db_lock); + if (lp != NULL) { + id_array[id].last_lock = LOCK_TO_OFFSET(lt, lp); + lo = (DB_LOCKOBJ *)((u_int8_t *)lp + lp->obj); + pptr = SH_DBT_PTR(&lo->lockobj); + if (lo->lockobj.size >= sizeof(db_pgno_t)) + memcpy(&id_array[id].pgno, pptr, + sizeof(db_pgno_t)); + else + id_array[id].pgno = 0; + } + } + + /* Pass complete, reset the deadlock detector bit. */ + lt->region->need_dd = 0; + UNLOCK_LOCKREGION(lt); + + /* + * Now we can release everything except the bitmap matrix that we + * created. + */ + *nlockers = id; + *idmap = id_array; + *bmp = bitmap; + __db_free(tmpmap); + return (0); +} + +static u_int32_t * +__dd_find(bmp, idmap, nlockers) + u_int32_t *bmp, nlockers; + locker_info *idmap; +{ + u_int32_t i, j, nentries, *mymap, *tmpmap; + + /* + * For each locker, OR in the bits from the lockers on which that + * locker is waiting. + */ + nentries = ALIGN(nlockers, 32) / 32; + for (mymap = bmp, i = 0; i < nlockers; i++, mymap += nentries) { + if (!idmap[i].valid) + continue; + for (j = 0; j < nlockers; j++) { + if (ISSET_MAP(mymap, j)) { + /* Find the map for this bit. */ + tmpmap = bmp + (nentries * j); + OR_MAP(mymap, tmpmap, nentries); + if (ISSET_MAP(mymap, i)) + return (mymap); + } + } + } + return (NULL); +} + +static int +__dd_abort(dbenv, info) + DB_ENV *dbenv; + locker_info *info; +{ + struct __db_lock *lockp; + DB_LOCKTAB *lt; + DB_LOCKOBJ *lockerp, *sh_obj; + int ret; + + lt = dbenv->lk_info; + LOCK_LOCKREGION(lt); + + /* Find the locker's last lock. */ + if ((ret = + __lock_getobj(lt, info->id, NULL, DB_LOCK_LOCKER, &lockerp)) != 0) + goto out; + + lockp = SH_LIST_FIRST(&lockerp->heldby, __db_lock); + if (LOCK_TO_OFFSET(lt, lockp) != info->last_lock || + lockp == NULL || lockp->status != DB_LSTAT_WAITING) + goto out; + + /* Abort lock, take it off list, and wake up this lock. */ + lockp->status = DB_LSTAT_ABORTED; + lt->region->ndeadlocks++; + SH_LIST_REMOVE(lockp, locker_links, __db_lock); + sh_obj = (DB_LOCKOBJ *)((u_int8_t *)lockp + lockp->obj); + SH_TAILQ_REMOVE(&sh_obj->waiters, lockp, links, __db_lock); + (void)__db_mutex_unlock(&lockp->mutex, lt->reginfo.fd); + + ret = 0; + +out: UNLOCK_LOCKREGION(lt); + return (ret); +} + +#ifdef DIAGNOSTIC +static void +__dd_debug(dbenv, idmap, bitmap, nlockers) + DB_ENV *dbenv; + locker_info *idmap; + u_int32_t *bitmap, nlockers; +{ + u_int32_t i, j, *mymap, nentries; + char *msgbuf; + + __db_err(dbenv, "Waitsfor array"); + __db_err(dbenv, "waiter\twaiting on"); + /* + * Allocate space to print 10 bytes per item waited on. + */ + if ((msgbuf = (char *)__db_malloc((nlockers + 1) * 10 + 64)) == NULL) { + __db_err(dbenv, "%s", strerror(ENOMEM)); + return; + } + + nentries = ALIGN(nlockers, 32) / 32; + for (mymap = bitmap, i = 0; i < nlockers; i++, mymap += nentries) { + if (!idmap[i].valid) + continue; + sprintf(msgbuf, /* Waiter. */ + "%lx/%lu:\t", (u_long)idmap[i].id, (u_long)idmap[i].pgno); + for (j = 0; j < nlockers; j++) + if (ISSET_MAP(mymap, j)) + sprintf(msgbuf, "%s %lx", msgbuf, + (u_long)idmap[j].id); + (void)sprintf(msgbuf, + "%s %lu", msgbuf, (u_long)idmap[i].last_lock); + __db_err(dbenv, msgbuf); + } + + __db_free(msgbuf); +} +#endif diff --git a/mozilla/db/lock/lock_region.c b/mozilla/db/lock/lock_region.c new file mode 100644 index 00000000000..8ac24657a27 --- /dev/null +++ b/mozilla/db/lock/lock_region.c @@ -0,0 +1,726 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)lock_region.c 10.15 (Sleepycat) 6/2/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_shash.h" +#include "lock.h" +#include "common_ext.h" + +static u_int32_t __lock_count_locks __P((DB_LOCKREGION *)); +static u_int32_t __lock_count_objs __P((DB_LOCKREGION *)); +static void __lock_dump_locker __P((DB_LOCKTAB *, DB_LOCKOBJ *, FILE *)); +static void __lock_dump_object __P((DB_LOCKTAB *, DB_LOCKOBJ *, FILE *)); +static char *__lock_dump_status __P((db_status_t)); +static void __lock_reset_region __P((DB_LOCKTAB *)); +static int __lock_tabinit __P((DB_ENV *, DB_LOCKREGION *)); + +int +lock_open(path, flags, mode, dbenv, ltp) + const char *path; + u_int32_t flags; + int mode; + DB_ENV *dbenv; + DB_LOCKTAB **ltp; +{ + DB_LOCKTAB *lt; + u_int32_t lock_modes, maxlocks, regflags; + int ret; + + /* Validate arguments. */ +#ifdef HAVE_SPINLOCKS +#define OKFLAGS (DB_CREATE | DB_THREAD) +#else +#define OKFLAGS (DB_CREATE) +#endif + if ((ret = __db_fchk(dbenv, "lock_open", flags, OKFLAGS)) != 0) + return (ret); + + /* Create the lock table structure. */ + if ((lt = (DB_LOCKTAB *)__db_calloc(1, sizeof(DB_LOCKTAB))) == NULL) { + __db_err(dbenv, "%s", strerror(ENOMEM)); + return (ENOMEM); + } + lt->dbenv = dbenv; + + /* Grab the values that we need to compute the region size. */ + lock_modes = DB_LOCK_RW_N; + maxlocks = DB_LOCK_DEFAULT_N; + regflags = REGION_SIZEDEF; + if (dbenv != NULL) { + if (dbenv->lk_modes != 0) { + lock_modes = dbenv->lk_modes; + regflags = 0; + } + if (dbenv->lk_max != 0) { + maxlocks = dbenv->lk_max; + regflags = 0; + } + } + + /* Join/create the lock region. */ + lt->reginfo.dbenv = dbenv; + lt->reginfo.appname = DB_APP_NONE; + if (path == NULL) + lt->reginfo.path = NULL; + else + if ((lt->reginfo.path = (char *)__db_strdup(path)) == NULL) + goto err; + lt->reginfo.file = DB_DEFAULT_LOCK_FILE; + lt->reginfo.mode = mode; + lt->reginfo.size = + LOCK_REGION_SIZE(lock_modes, maxlocks, __db_tablesize(maxlocks)); + lt->reginfo.dbflags = flags; + lt->reginfo.addr = NULL; + lt->reginfo.fd = -1; + lt->reginfo.flags = regflags; + + if ((ret = __db_rattach(<->reginfo)) != 0) + goto err; + + /* Now set up the pointer to the region. */ + lt->region = lt->reginfo.addr; + + /* Initialize the region if we created it. */ + if (F_ISSET(<->reginfo, REGION_CREATED)) { + lt->region->maxlocks = maxlocks; + lt->region->nmodes = lock_modes; + if ((ret = __lock_tabinit(dbenv, lt->region)) != 0) + goto err; + } else { + /* Check for an unexpected region. */ + if (lt->region->magic != DB_LOCKMAGIC) { + __db_err(dbenv, + "lock_open: %s: bad magic number", path); + ret = EINVAL; + goto err; + } + } + + /* Check for automatic deadlock detection. */ + if (dbenv != NULL && dbenv->lk_detect != DB_LOCK_NORUN) { + if (lt->region->detect != DB_LOCK_NORUN && + dbenv->lk_detect != DB_LOCK_DEFAULT && + lt->region->detect != dbenv->lk_detect) { + __db_err(dbenv, + "lock_open: incompatible deadlock detector mode"); + ret = EINVAL; + goto err; + } + if (lt->region->detect == DB_LOCK_NORUN) + lt->region->detect = dbenv->lk_detect; + } + + /* Set up remaining pointers into region. */ + lt->conflicts = (u_int8_t *)lt->region + sizeof(DB_LOCKREGION); + lt->hashtab = + (DB_HASHTAB *)((u_int8_t *)lt->region + lt->region->hash_off); + lt->mem = (void *)((u_int8_t *)lt->region + lt->region->mem_off); + + UNLOCK_LOCKREGION(lt); + *ltp = lt; + return (0); + +err: if (lt->reginfo.addr != NULL) { + UNLOCK_LOCKREGION(lt); + (void)__db_rdetach(<->reginfo); + if (F_ISSET(<->reginfo, REGION_CREATED)) + (void)lock_unlink(path, 1, dbenv); + } + + if (lt->reginfo.path != NULL) + FREES(lt->reginfo.path); + FREE(lt, sizeof(*lt)); + return (ret); +} + +/* + * __lock_tabinit -- + * Initialize the lock region. + */ +static int +__lock_tabinit(dbenv, lrp) + DB_ENV *dbenv; + DB_LOCKREGION *lrp; +{ + struct __db_lock *lp; + struct lock_header *tq_head; + struct obj_header *obj_head; + DB_LOCKOBJ *op; + u_int32_t i, nelements; + const u_int8_t *conflicts; + u_int8_t *curaddr; + + conflicts = dbenv == NULL || dbenv->lk_conflicts == NULL ? + db_rw_conflicts : dbenv->lk_conflicts; + + lrp->table_size = __db_tablesize(lrp->maxlocks); + lrp->magic = DB_LOCKMAGIC; + lrp->version = DB_LOCKVERSION; + lrp->id = 0; + /* + * These fields (lrp->maxlocks, lrp->nmodes) are initialized + * in the caller, since we had to grab those values to size + * the region. + */ + lrp->need_dd = 0; + lrp->detect = DB_LOCK_NORUN; + lrp->numobjs = lrp->maxlocks; + lrp->nlockers = 0; + lrp->mem_bytes = ALIGN(STRING_SIZE(lrp->maxlocks), sizeof(size_t)); + lrp->increment = lrp->hdr.size / 2; + lrp->nconflicts = 0; + lrp->nrequests = 0; + lrp->nreleases = 0; + lrp->ndeadlocks = 0; + + /* + * As we write the region, we've got to maintain the alignment + * for the structures that follow each chunk. This information + * ends up being encapsulated both in here as well as in the + * lock.h file for the XXX_SIZE macros. + */ + /* Initialize conflict matrix. */ + curaddr = (u_int8_t *)lrp + sizeof(DB_LOCKREGION); + memcpy(curaddr, conflicts, lrp->nmodes * lrp->nmodes); + curaddr += lrp->nmodes * lrp->nmodes; + + /* + * Initialize hash table. + */ + curaddr = (u_int8_t *)ALIGNP(curaddr, LOCK_HASH_ALIGN); + lrp->hash_off = curaddr - (u_int8_t *)lrp; + nelements = lrp->table_size; + __db_hashinit(curaddr, nelements); + curaddr += nelements * sizeof(DB_HASHTAB); + + /* + * Initialize locks onto a free list. Since locks contains mutexes, + * we need to make sure that each lock is aligned on a MUTEX_ALIGNMENT + * boundary. + */ + curaddr = (u_int8_t *)ALIGNP(curaddr, MUTEX_ALIGNMENT); + tq_head = &lrp->free_locks; + SH_TAILQ_INIT(tq_head); + + for (i = 0; i++ < lrp->maxlocks; + curaddr += ALIGN(sizeof(struct __db_lock), MUTEX_ALIGNMENT)) { + lp = (struct __db_lock *)curaddr; + lp->status = DB_LSTAT_FREE; + SH_TAILQ_INSERT_HEAD(tq_head, lp, links, __db_lock); + } + + /* Initialize objects onto a free list. */ + obj_head = &lrp->free_objs; + SH_TAILQ_INIT(obj_head); + + for (i = 0; i++ < lrp->maxlocks; curaddr += sizeof(DB_LOCKOBJ)) { + op = (DB_LOCKOBJ *)curaddr; + SH_TAILQ_INSERT_HEAD(obj_head, op, links, __db_lockobj); + } + + /* + * Initialize the string space; as for all shared memory allocation + * regions, this requires size_t alignment, since we store the + * lengths of malloc'd areas in the area. + */ + curaddr = (u_int8_t *)ALIGNP(curaddr, sizeof(size_t)); + lrp->mem_off = curaddr - (u_int8_t *)lrp; + __db_shalloc_init(curaddr, lrp->mem_bytes); + return (0); +} + +int +lock_close(lt) + DB_LOCKTAB *lt; +{ + int ret; + + if ((ret = __db_rdetach(<->reginfo)) != 0) + return (ret); + + if (lt->reginfo.path != NULL) + FREES(lt->reginfo.path); + FREE(lt, sizeof(*lt)); + + return (0); +} + +int +lock_unlink(path, force, dbenv) + const char *path; + int force; + DB_ENV *dbenv; +{ + REGINFO reginfo; + int ret; + + memset(®info, 0, sizeof(reginfo)); + reginfo.dbenv = dbenv; + reginfo.appname = DB_APP_NONE; + if (path != NULL && (reginfo.path = (char *)__db_strdup(path)) == NULL) + return (ENOMEM); + reginfo.file = DB_DEFAULT_LOCK_FILE; + ret = __db_runlink(®info, force); + if (reginfo.path != NULL) + FREES(reginfo.path); + return (ret); +} + +/* + * __lock_validate_region -- + * Called at every interface to verify if the region has changed size, + * and if so, to remap the region in and reset the process' pointers. + * + * PUBLIC: int __lock_validate_region __P((DB_LOCKTAB *)); + */ +int +__lock_validate_region(lt) + DB_LOCKTAB *lt; +{ + int ret; + + if (lt->reginfo.size == lt->region->hdr.size) + return (0); + + /* Detach/reattach the region. */ + if ((ret = __db_rreattach(<->reginfo, lt->region->hdr.size)) != 0) + return (ret); + + /* Reset region information. */ + lt->region = lt->reginfo.addr; + __lock_reset_region(lt); + + return (0); +} + +/* + * __lock_grow_region -- + * We have run out of space; time to grow the region. + * + * PUBLIC: int __lock_grow_region __P((DB_LOCKTAB *, int, size_t)); + */ +int +__lock_grow_region(lt, which, howmuch) + DB_LOCKTAB *lt; + int which; + size_t howmuch; +{ + struct __db_lock *newl; + struct lock_header *lock_head; + struct obj_header *obj_head; + DB_LOCKOBJ *op; + DB_LOCKREGION *lrp; + float lock_ratio, obj_ratio; + size_t incr, oldsize, used, usedmem; + u_int32_t i, newlocks, newmem, newobjs, usedlocks, usedobjs; + u_int8_t *curaddr; + int ret; + + lrp = lt->region; + oldsize = lrp->hdr.size; + incr = lrp->increment; + + /* Figure out how much of each sort of space we have. */ + usedmem = lrp->mem_bytes - __db_shalloc_count(lt->mem); + usedobjs = lrp->numobjs - __lock_count_objs(lrp); + usedlocks = lrp->maxlocks - __lock_count_locks(lrp); + + /* + * Figure out what fraction of the used space belongs to each + * different type of "thing" in the region. Then partition the + * new space up according to this ratio. + */ + used = usedmem + + usedlocks * ALIGN(sizeof(struct __db_lock), MUTEX_ALIGNMENT) + + usedobjs * sizeof(DB_LOCKOBJ); + + lock_ratio = usedlocks * + ALIGN(sizeof(struct __db_lock), MUTEX_ALIGNMENT) / (float)used; + obj_ratio = usedobjs * sizeof(DB_LOCKOBJ) / (float)used; + + newlocks = (u_int32_t)(lock_ratio * + incr / ALIGN(sizeof(struct __db_lock), MUTEX_ALIGNMENT)); + newobjs = (u_int32_t)(obj_ratio * incr / sizeof(DB_LOCKOBJ)); + newmem = incr - + (newobjs * sizeof(DB_LOCKOBJ) + + newlocks * ALIGN(sizeof(struct __db_lock), MUTEX_ALIGNMENT)); + + /* + * Make sure we allocate enough memory for the object being + * requested. + */ + switch (which) { + case DB_LOCK_LOCK: + if (newlocks == 0) { + newlocks = 10; + incr += newlocks * sizeof(struct __db_lock); + } + break; + case DB_LOCK_OBJ: + if (newobjs == 0) { + newobjs = 10; + incr += newobjs * sizeof(DB_LOCKOBJ); + } + break; + case DB_LOCK_MEM: + if (newmem < howmuch * 2) { + incr += howmuch * 2 - newmem; + newmem = howmuch * 2; + } + break; + } + + newmem += ALIGN(incr, sizeof(size_t)) - incr; + incr = ALIGN(incr, sizeof(size_t)); + + /* + * Since we are going to be allocating locks at the beginning of the + * new chunk, we need to make sure that the chunk is MUTEX_ALIGNMENT + * aligned. We did not guarantee this when we created the region, so + * we may need to pad the old region by extra bytes to ensure this + * alignment. + */ + incr += ALIGN(oldsize, MUTEX_ALIGNMENT) - oldsize; + + __db_err(lt->dbenv, + "Growing lock region: %lu locks %lu objs %lu bytes", + (u_long)newlocks, (u_long)newobjs, (u_long)newmem); + + if ((ret = __db_rgrow(<->reginfo, oldsize + incr)) != 0) + return (ret); + lt->region = lt->reginfo.addr; + __lock_reset_region(lt); + + /* Update region parameters. */ + lrp = lt->region; + lrp->increment = incr << 1; + lrp->maxlocks += newlocks; + lrp->numobjs += newobjs; + lrp->mem_bytes += newmem; + + curaddr = (u_int8_t *)lrp + oldsize; + curaddr = (u_int8_t *)ALIGNP(curaddr, MUTEX_ALIGNMENT); + + /* Put new locks onto the free list. */ + lock_head = &lrp->free_locks; + for (i = 0; i++ < newlocks; + curaddr += ALIGN(sizeof(struct __db_lock), MUTEX_ALIGNMENT)) { + newl = (struct __db_lock *)curaddr; + SH_TAILQ_INSERT_HEAD(lock_head, newl, links, __db_lock); + } + + /* Put new objects onto the free list. */ + obj_head = &lrp->free_objs; + for (i = 0; i++ < newobjs; curaddr += sizeof(DB_LOCKOBJ)) { + op = (DB_LOCKOBJ *)curaddr; + SH_TAILQ_INSERT_HEAD(obj_head, op, links, __db_lockobj); + } + + *((size_t *)curaddr) = newmem - sizeof(size_t); + curaddr += sizeof(size_t); + __db_shalloc_free(lt->mem, curaddr); + + return (0); +} + +static void +__lock_reset_region(lt) + DB_LOCKTAB *lt; +{ + lt->conflicts = (u_int8_t *)lt->region + sizeof(DB_LOCKREGION); + lt->hashtab = + (DB_HASHTAB *)((u_int8_t *)lt->region + lt->region->hash_off); + lt->mem = (void *)((u_int8_t *)lt->region + lt->region->mem_off); +} + +/* + * lock_stat -- + * Return LOCK statistics. + */ +int +lock_stat(lt, gspp, db_malloc) + DB_LOCKTAB *lt; + DB_LOCK_STAT **gspp; + void *(*db_malloc) __P((size_t)); +{ + DB_LOCKREGION *rp; + + *gspp = NULL; + + if ((*gspp = db_malloc == NULL ? + (DB_LOCK_STAT *)__db_malloc(sizeof(**gspp)) : + (DB_LOCK_STAT *)db_malloc(sizeof(**gspp))) == NULL) + return (ENOMEM); + + /* Copy out the global statistics. */ + LOCK_LOCKREGION(lt); + + rp = lt->region; + (*gspp)->st_magic = rp->magic; + (*gspp)->st_version = rp->version; + (*gspp)->st_maxlocks = rp->maxlocks; + (*gspp)->st_nmodes = rp->nmodes; + (*gspp)->st_numobjs = rp->numobjs; + (*gspp)->st_nlockers = rp->nlockers; + (*gspp)->st_nconflicts = rp->nconflicts; + (*gspp)->st_nrequests = rp->nrequests; + (*gspp)->st_nreleases = rp->nreleases; + (*gspp)->st_ndeadlocks = rp->ndeadlocks; + (*gspp)->st_region_nowait = rp->hdr.lock.mutex_set_nowait; + (*gspp)->st_region_wait = rp->hdr.lock.mutex_set_wait; + (*gspp)->st_refcnt = rp->hdr.refcnt; + (*gspp)->st_regsize = rp->hdr.size; + + UNLOCK_LOCKREGION(lt); + + return (0); +} + +static u_int32_t +__lock_count_locks(lrp) + DB_LOCKREGION *lrp; +{ + struct __db_lock *newl; + u_int32_t count; + + count = 0; + for (newl = SH_TAILQ_FIRST(&lrp->free_locks, __db_lock); + newl != NULL; + newl = SH_TAILQ_NEXT(newl, links, __db_lock)) + count++; + + return (count); +} + +static u_int32_t +__lock_count_objs(lrp) + DB_LOCKREGION *lrp; +{ + DB_LOCKOBJ *obj; + u_int32_t count; + + count = 0; + for (obj = SH_TAILQ_FIRST(&lrp->free_objs, __db_lockobj); + obj != NULL; + obj = SH_TAILQ_NEXT(obj, links, __db_lockobj)) + count++; + + return (count); +} + +#define LOCK_DUMP_CONF 0x001 /* Conflict matrix. */ +#define LOCK_DUMP_FREE 0x002 /* Display lock free list. */ +#define LOCK_DUMP_LOCKERS 0x004 /* Display lockers. */ +#define LOCK_DUMP_MEM 0x008 /* Display region memory. */ +#define LOCK_DUMP_OBJECTS 0x010 /* Display objects. */ +#define LOCK_DUMP_ALL 0x01f /* Display all. */ + +/* + * __lock_dump_region -- + * + * PUBLIC: void __lock_dump_region __P((DB_LOCKTAB *, char *, FILE *)); + */ +void +__lock_dump_region(lt, area, fp) + DB_LOCKTAB *lt; + char *area; + FILE *fp; +{ + struct __db_lock *lp; + DB_LOCKOBJ *op; + DB_LOCKREGION *lrp; + u_int32_t flags, i, j; + int label; + + /* Make it easy to call from the debugger. */ + if (fp == NULL) + fp = stderr; + + for (flags = 0; *area != '\0'; ++area) + switch (*area) { + case 'A': + LF_SET(LOCK_DUMP_ALL); + break; + case 'c': + LF_SET(LOCK_DUMP_CONF); + break; + case 'f': + LF_SET(LOCK_DUMP_FREE); + break; + case 'l': + LF_SET(LOCK_DUMP_LOCKERS); + break; + case 'm': + LF_SET(LOCK_DUMP_MEM); + break; + case 'o': + LF_SET(LOCK_DUMP_OBJECTS); + break; + } + + lrp = lt->region; + + fprintf(fp, "%s\nLock region parameters\n", DB_LINE); + fprintf(fp, "%s: %lu, %s: %lu, %s: %lu, %s: %lu\n%s: %lu, %s: %lu\n", + "table size", (u_long)lrp->table_size, + "hash_off", (u_long)lrp->hash_off, + "increment", (u_long)lrp->increment, + "mem_off", (u_long)lrp->mem_off, + "mem_bytes", (u_long)lrp->mem_bytes, + "need_dd", (u_long)lrp->need_dd); + + if (LF_ISSET(LOCK_DUMP_CONF)) { + fprintf(fp, "\n%s\nConflict matrix\n", DB_LINE); + for (i = 0; i < lrp->nmodes; i++) { + for (j = 0; j < lrp->nmodes; j++) + fprintf(fp, "%lu\t", + (u_long)lt->conflicts[i * lrp->nmodes + j]); + fprintf(fp, "\n"); + } + } + + if (LF_ISSET(LOCK_DUMP_LOCKERS | LOCK_DUMP_OBJECTS)) { + fprintf(fp, "%s\nLock hash buckets\n", DB_LINE); + for (i = 0; i < lrp->table_size; i++) { + label = 1; + for (op = SH_TAILQ_FIRST(<->hashtab[i], __db_lockobj); + op != NULL; + op = SH_TAILQ_NEXT(op, links, __db_lockobj)) { + if (LF_ISSET(LOCK_DUMP_LOCKERS) && + op->type == DB_LOCK_LOCKER) { + if (label) { + fprintf(fp, + "Bucket %lu:\n", (u_long)i); + label = 0; + } + __lock_dump_locker(lt, op, fp); + } + if (LF_ISSET(LOCK_DUMP_OBJECTS) && + op->type == DB_LOCK_OBJTYPE) { + if (label) { + fprintf(fp, + "Bucket %lu:\n", (u_long)i); + label = 0; + } + __lock_dump_object(lt, op, fp); + } + } + } + } + + if (LF_ISSET(LOCK_DUMP_FREE)) { + fprintf(fp, "%s\nLock free list\n", DB_LINE); + for (lp = SH_TAILQ_FIRST(&lrp->free_locks, __db_lock); + lp != NULL; + lp = SH_TAILQ_NEXT(lp, links, __db_lock)) + fprintf(fp, "0x%x: %lu\t%lu\t%s\t0x%x\n", (u_int)lp, + (u_long)lp->holder, (u_long)lp->mode, + __lock_dump_status(lp->status), (u_int)lp->obj); + + fprintf(fp, "%s\nObject free list\n", DB_LINE); + for (op = SH_TAILQ_FIRST(&lrp->free_objs, __db_lockobj); + op != NULL; + op = SH_TAILQ_NEXT(op, links, __db_lockobj)) + fprintf(fp, "0x%x\n", (u_int)op); + } + + if (LF_ISSET(LOCK_DUMP_MEM)) + __db_shalloc_dump(lt->mem, fp); +} + +static void +__lock_dump_locker(lt, op, fp) + DB_LOCKTAB *lt; + DB_LOCKOBJ *op; + FILE *fp; +{ + struct __db_lock *lp; + u_int32_t locker; + void *ptr; + + ptr = SH_DBT_PTR(&op->lockobj); + memcpy(&locker, ptr, sizeof(u_int32_t)); + fprintf(fp, "L %lx", (u_long)locker); + + lp = SH_LIST_FIRST(&op->heldby, __db_lock); + if (lp == NULL) { + fprintf(fp, "\n"); + return; + } + for (; lp != NULL; lp = SH_LIST_NEXT(lp, locker_links, __db_lock)) + __lock_printlock(lt, lp, 0); +} + +static void +__lock_dump_object(lt, op, fp) + DB_LOCKTAB *lt; + DB_LOCKOBJ *op; + FILE *fp; +{ + struct __db_lock *lp; + u_int32_t j; + u_int8_t *ptr; + u_int ch; + + ptr = SH_DBT_PTR(&op->lockobj); + for (j = 0; j < op->lockobj.size; ptr++, j++) { + ch = *ptr; + fprintf(fp, isprint(ch) ? "%c" : "\\%o", ch); + } + fprintf(fp, "\n"); + + fprintf(fp, "H:"); + for (lp = + SH_TAILQ_FIRST(&op->holders, __db_lock); + lp != NULL; + lp = SH_TAILQ_NEXT(lp, links, __db_lock)) + __lock_printlock(lt, lp, 0); + lp = SH_TAILQ_FIRST(&op->waiters, __db_lock); + if (lp != NULL) { + fprintf(fp, "\nW:"); + for (; lp != NULL; lp = SH_TAILQ_NEXT(lp, links, __db_lock)) + __lock_printlock(lt, lp, 0); + } +} + +static char * +__lock_dump_status(status) + db_status_t status; +{ + switch (status) { + case DB_LSTAT_ABORTED: + return ("aborted"); + case DB_LSTAT_ERR: + return ("err"); + case DB_LSTAT_FREE: + return ("free"); + case DB_LSTAT_HELD: + return ("held"); + case DB_LSTAT_NOGRANT: + return ("nogrant"); + case DB_LSTAT_PENDING: + return ("pending"); + case DB_LSTAT_WAITING: + return ("waiting"); + } + return ("unknown status"); +} diff --git a/mozilla/db/lock/lock_util.c b/mozilla/db/lock/lock_util.c new file mode 100644 index 00000000000..7274a504228 --- /dev/null +++ b/mozilla/db/lock/lock_util.c @@ -0,0 +1,152 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)lock_util.c 10.9 (Sleepycat) 4/26/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_page.h" +#include "db_shash.h" +#include "hash.h" +#include "lock.h" + +/* + * __lock_cmp -- + * This function is used to compare a DBT that is about to be entered + * into a hash table with an object already in the hash table. Note + * that it just returns true on equal and 0 on not-equal. Therefore + * this function cannot be used as a sort function; its purpose is to + * be used as a hash comparison function. + * + * PUBLIC: int __lock_cmp __P((const DBT *, DB_LOCKOBJ *)); + */ +int +__lock_cmp(dbt, lock_obj) + const DBT *dbt; + DB_LOCKOBJ *lock_obj; +{ + void *obj_data; + + if (lock_obj->type != DB_LOCK_OBJTYPE) + return (0); + + obj_data = SH_DBT_PTR(&lock_obj->lockobj); + return (dbt->size == lock_obj->lockobj.size && + memcmp(dbt->data, obj_data, dbt->size) == 0); +} + +/* + * PUBLIC: int __lock_locker_cmp __P((u_int32_t, DB_LOCKOBJ *)); + */ +int +__lock_locker_cmp(locker, lock_obj) + u_int32_t locker; + DB_LOCKOBJ *lock_obj; +{ + void *obj_data; + + if (lock_obj->type != DB_LOCK_LOCKER) + return (0); + + obj_data = SH_DBT_PTR(&lock_obj->lockobj); + return (memcmp(&locker, obj_data, sizeof(u_int32_t)) == 0); +} + +/* + * The next two functions are the hash functions used to store objects in the + * lock hash table. They are hashing the same items, but one (__lock_ohash) + * takes a DBT (used for hashing a parameter passed from the user) and the + * other (__lock_lhash) takes a DB_LOCKOBJ (used for hashing something that is + * already in the lock manager). In both cases, we have a special check to + * fast path the case where we think we are doing a hash on a DB page/fileid + * pair. If the size is right, then we do the fast hash. + * + * We know that DB uses struct __db_ilocks for its lock objects. The first + * four bytes are the 4-byte page number and the next DB_FILE_ID_LEN bytes + * are a unique file id, where the first 4 bytes on UNIX systems are the file + * inode number, and the first 4 bytes on Windows systems are the FileIndexLow + * bytes. So, we use the XOR of the page number and the first four bytes of + * the file id to produce a 32-bit hash value. + * + * We have no particular reason to believe that this algorithm will produce + * a good hash, but we want a fast hash more than we want a good one, when + * we're coming through this code path. + */ +#define FAST_HASH(P) { \ + u_int32_t __h; \ + u_int8_t *__cp, *__hp; \ + __hp = (u_int8_t *)&__h; \ + __cp = (u_int8_t *)(P); \ + __hp[0] = __cp[0] ^ __cp[4]; \ + __hp[1] = __cp[1] ^ __cp[5]; \ + __hp[2] = __cp[2] ^ __cp[6]; \ + __hp[3] = __cp[3] ^ __cp[7]; \ + return (__h); \ +} + +/* + * __lock_ohash -- + * + * PUBLIC: u_int32_t __lock_ohash __P((const DBT *)); + */ +u_int32_t +__lock_ohash(dbt) + const DBT *dbt; +{ + if (dbt->size == sizeof(struct __db_ilock)) + FAST_HASH(dbt->data); + + return (__ham_func5(dbt->data, dbt->size)); +} + +/* + * __lock_lhash -- + * + * PUBLIC: u_int32_t __lock_lhash __P((DB_LOCKOBJ *)); + */ +u_int32_t +__lock_lhash(lock_obj) + DB_LOCKOBJ *lock_obj; +{ + u_int32_t tmp; + void *obj_data; + + obj_data = SH_DBT_PTR(&lock_obj->lockobj); + if (lock_obj->type == DB_LOCK_LOCKER) { + memcpy(&tmp, obj_data, sizeof(u_int32_t)); + return (tmp); + } + + if (lock_obj->lockobj.size == sizeof(struct __db_ilock)) + FAST_HASH(obj_data); + + return (__ham_func5(obj_data, lock_obj->lockobj.size)); +} + +/* + * __lock_locker_hash -- + * Hash function for entering lockers into the hash table. Since these + * are simply 32-bit unsigned integers, just return the locker value. + * + * PUBLIC: u_int32_t __lock_locker_hash __P((u_int32_t)); + */ +u_int32_t +__lock_locker_hash(locker) + u_int32_t locker; +{ + return (locker); +} diff --git a/mozilla/db/log/log.c b/mozilla/db/log/log.c new file mode 100644 index 00000000000..d642c9f9ef5 --- /dev/null +++ b/mozilla/db/log/log.c @@ -0,0 +1,500 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)log.c 10.54 (Sleepycat) 5/31/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "log.h" +#include "db_dispatch.h" +#include "txn_auto.h" +#include "common_ext.h" + +static int __log_recover __P((DB_LOG *)); + +/* + * log_open -- + * Initialize and/or join a log. + */ +int +log_open(path, flags, mode, dbenv, lpp) + const char *path; + u_int32_t flags; + int mode; + DB_ENV *dbenv; + DB_LOG **lpp; +{ + DB_LOG *dblp; + LOG *lp; + int ret; + + /* Validate arguments. */ +#ifdef HAVE_SPINLOCKS +#define OKFLAGS (DB_CREATE | DB_THREAD) +#else +#define OKFLAGS (DB_CREATE) +#endif + if ((ret = __db_fchk(dbenv, "log_open", flags, OKFLAGS)) != 0) + return (ret); + + /* Create and initialize the DB_LOG structure. */ + if ((dblp = (DB_LOG *)__db_calloc(1, sizeof(DB_LOG))) == NULL) + return (ENOMEM); + + if (path != NULL && (dblp->dir = __db_strdup(path)) == NULL) { + ret = ENOMEM; + goto err; + } + + dblp->dbenv = dbenv; + dblp->lfd = -1; + ZERO_LSN(dblp->c_lsn); + dblp->c_fd = -1; + + /* + * The log region isn't fixed size because we store the registered + * file names there. Make it fairly large so that we don't have to + * grow it. + */ +#define DEF_LOG_SIZE (30 * 1024) + + /* Map in the region. */ + dblp->reginfo.dbenv = dbenv; + dblp->reginfo.appname = DB_APP_LOG; + if (path == NULL) + dblp->reginfo.path = NULL; + else + if ((dblp->reginfo.path = __db_strdup(path)) == NULL) + goto err; + dblp->reginfo.file = DB_DEFAULT_LOG_FILE; + dblp->reginfo.mode = mode; + dblp->reginfo.size = DEF_LOG_SIZE; + dblp->reginfo.dbflags = flags; + dblp->reginfo.flags = REGION_SIZEDEF; + if ((ret = __db_rattach(&dblp->reginfo)) != 0) + goto err; + + /* + * The LOG structure is first in the region, the rest of the region + * is free space. + */ + dblp->lp = dblp->reginfo.addr; + dblp->addr = (u_int8_t *)dblp->lp + sizeof(LOG); + + /* Initialize a created region. */ + if (F_ISSET(&dblp->reginfo, REGION_CREATED)) { + __db_shalloc_init(dblp->addr, DEF_LOG_SIZE - sizeof(LOG)); + + /* Initialize the LOG structure. */ + lp = dblp->lp; + lp->persist.lg_max = dbenv == NULL ? 0 : dbenv->lg_max; + if (lp->persist.lg_max == 0) + lp->persist.lg_max = DEFAULT_MAX; + lp->persist.magic = DB_LOGMAGIC; + lp->persist.version = DB_LOGVERSION; + lp->persist.mode = mode; + SH_TAILQ_INIT(&lp->fq); + + /* Initialize LOG LSNs. */ + lp->lsn.file = 1; + lp->lsn.offset = 0; + } + + /* Initialize thread information, mutex. */ + if (LF_ISSET(DB_THREAD)) { + F_SET(dblp, DB_AM_THREAD); + if ((ret = __db_shalloc(dblp->addr, + sizeof(db_mutex_t), MUTEX_ALIGNMENT, &dblp->mutexp)) != 0) + goto err; + (void)__db_mutex_init(dblp->mutexp, -1); + } + + /* + * If doing recovery, try and recover any previous log files before + * releasing the lock. + */ + if (F_ISSET(&dblp->reginfo, REGION_CREATED) && + (ret = __log_recover(dblp)) != 0) + goto err; + + UNLOCK_LOGREGION(dblp); + *lpp = dblp; + return (0); + +err: if (dblp->reginfo.addr != NULL) { + if (dblp->mutexp != NULL) + __db_shalloc_free(dblp->addr, dblp->mutexp); + + UNLOCK_LOGREGION(dblp); + (void)__db_rdetach(&dblp->reginfo); + if (F_ISSET(&dblp->reginfo, REGION_CREATED)) + (void)log_unlink(path, 1, dbenv); + } + + if (dblp->reginfo.path != NULL) + FREES(dblp->reginfo.path); + if (dblp->dir != NULL) + FREES(dblp->dir); + FREE(dblp, sizeof(*dblp)); + return (ret); +} + +/* + * __log_recover -- + * Recover a log. + */ +static int +__log_recover(dblp) + DB_LOG *dblp; +{ + DBT dbt; + DB_LSN lsn; + LOG *lp; + u_int32_t chk; + int cnt, found_checkpoint, ret; + + lp = dblp->lp; + + /* + * Find a log file. If none exist, we simply return, leaving + * everything initialized to a new log. + */ + if ((ret = __log_find(dblp, 0, &cnt)) != 0) + return (ret); + if (cnt == 0) + return (0); + + /* + * We have the last useful log file and we've loaded any persistent + * information. Pretend that the log is larger than it can possibly + * be, and read the last file, looking for the last checkpoint and + * the log's end. + */ + lp->lsn.file = cnt + 1; + lp->lsn.offset = 0; + lsn.file = cnt; + lsn.offset = 0; + + /* Set the cursor. Shouldn't fail, leave error messages on. */ + memset(&dbt, 0, sizeof(dbt)); + if ((ret = __log_get(dblp, &lsn, &dbt, DB_SET, 0)) != 0) + return (ret); + + /* + * Read to the end of the file, saving checkpoints. This will fail + * at some point, so turn off error messages. + */ + found_checkpoint = 0; + while (__log_get(dblp, &lsn, &dbt, DB_NEXT, 1) == 0) { + if (dbt.size < sizeof(u_int32_t)) + continue; + memcpy(&chk, dbt.data, sizeof(u_int32_t)); + if (chk == DB_txn_ckp) { + lp->chkpt_lsn = lsn; + found_checkpoint = 1; + } + } + + /* + * We know where the end of the log is. Since that record is on disk, + * it's also the last-synced LSN. + */ + lp->lsn = lsn; + lp->lsn.offset += dblp->c_len; + lp->s_lsn = lp->lsn; + + /* Set up the current buffer information, too. */ + lp->len = dblp->c_len; + lp->b_off = 0; + lp->w_off = lp->lsn.offset; + + /* + * It's possible that we didn't find a checkpoint because there wasn't + * one in the last log file. Start searching. + */ + while (!found_checkpoint && cnt > 1) { + lsn.file = --cnt; + lsn.offset = 0; + + /* Set the cursor. Shouldn't fail, leave error messages on. */ + if ((ret = __log_get(dblp, &lsn, &dbt, DB_SET, 0)) != 0) + return (ret); + + /* + * Read to the end of the file, saving checkpoints. Shouldn't + * fail, leave error messages on. + */ + while (__log_get(dblp, &lsn, &dbt, DB_NEXT, 0) == 0) { + if (dbt.size < sizeof(u_int32_t)) + continue; + memcpy(&chk, dbt.data, sizeof(u_int32_t)); + if (chk == DB_txn_ckp) { + lp->chkpt_lsn = lsn; + found_checkpoint = 1; + } + } + } + + /* If we never find a checkpoint, that's okay, just 0 it out. */ + if (!found_checkpoint) + ZERO_LSN(lp->chkpt_lsn); + + __db_err(dblp->dbenv, + "Recovering the log: last valid LSN: file: %lu offset %lu", + (u_long)lp->lsn.file, (u_long)lp->lsn.offset); + + return (0); +} + +/* + * __log_find -- + * Try to find a log file. If find_first is set, valp will contain + * the number of the first log file, else it will contain the number of + * the last log file. + * + * PUBLIC: int __log_find __P((DB_LOG *, int, int *)); + */ +int +__log_find(dblp, find_first, valp) + DB_LOG *dblp; + int find_first, *valp; +{ + int cnt, fcnt, logval, ret; + const char *dir; + char **names, *p, *q; + + *valp = 0; + + /* Find the directory name. */ + if ((ret = __log_name(dblp, 1, &p)) != 0) + return (ret); + if ((q = __db_rpath(p)) == NULL) + dir = PATH_DOT; + else { + *q = '\0'; + dir = p; + } + + /* Get the list of file names. */ + ret = __db_dirlist(dir, &names, &fcnt); + FREES(p); + if (ret != 0) { + __db_err(dblp->dbenv, "%s: %s", dir, strerror(ret)); + return (ret); + } + + /* + * Search for a valid log file name, return a value of 0 on + * failure. + */ + for (cnt = fcnt, logval = 0; --cnt >= 0;) + if (strncmp(names[cnt], "log.", sizeof("log.") - 1) == 0) { + logval = atoi(names[cnt] + 4); + if (logval != 0 && + __log_valid(dblp, dblp->lp, logval) == 0) + break; + } + + /* Discard the list. */ + __db_dirfree(names, fcnt); + + /* We have a valid log file, find either the first or last one. */ + if (find_first) { + for (; logval > 0; --logval) + if (__log_valid(dblp, dblp->lp, logval - 1) != 0) + break; + } else + for (; logval < MAXLFNAME; ++logval) + if (__log_valid(dblp, dblp->lp, logval + 1) != 0) + break; + *valp = logval; + + return (0); +} + +/* + * log_valid -- + * Validate a log file. + * + * PUBLIC: int __log_valid __P((DB_LOG *, LOG *, int)); + */ +int +__log_valid(dblp, lp, cnt) + DB_LOG *dblp; + LOG *lp; + int cnt; +{ + LOGP persist; + ssize_t nw; + int fd, ret; + char *p; + + if ((ret = __log_name(dblp, cnt, &p)) != 0) + return (ret); + + fd = -1; + if ((ret = __db_open(p, + DB_RDONLY | DB_SEQUENTIAL, + DB_RDONLY | DB_SEQUENTIAL, 0, &fd)) != 0 || + (ret = __db_seek(fd, 0, 0, sizeof(HDR), 0, SEEK_SET)) != 0 || + (ret = __db_read(fd, &persist, sizeof(LOGP), &nw)) != 0 || + nw != sizeof(LOGP)) { + if (ret == 0) + ret = EIO; + if (fd != -1) { + (void)__db_close(fd); + __db_err(dblp->dbenv, + "Ignoring log file: %s: %s", p, strerror(ret)); + } + goto err; + } + (void)__db_close(fd); + + if (persist.magic != DB_LOGMAGIC) { + __db_err(dblp->dbenv, + "Ignoring log file: %s: magic number %lx, not %lx", + p, (u_long)persist.magic, (u_long)DB_LOGMAGIC); + ret = EINVAL; + goto err; + } + if (persist.version < DB_LOGOLDVER || persist.version > DB_LOGVERSION) { + __db_err(dblp->dbenv, + "Ignoring log file: %s: unsupported log version %lu", + p, (u_long)persist.version); + ret = EINVAL; + goto err; + } + + if (lp != NULL) { + lp->persist.lg_max = persist.lg_max; + lp->persist.mode = persist.mode; + } + ret = 0; + +err: FREES(p); + return (ret); +} + +/* + * log_close -- + * Close a log. + */ +int +log_close(dblp) + DB_LOG *dblp; +{ + int ret, t_ret; + + /* Discard the per-thread pointer. */ + if (dblp->mutexp != NULL) { + LOCK_LOGREGION(dblp); + __db_shalloc_free(dblp->addr, dblp->mutexp); + UNLOCK_LOGREGION(dblp); + } + + /* Close the region. */ + ret = __db_rdetach(&dblp->reginfo); + + /* Close open files, release allocated memory. */ + if (dblp->lfd != -1 && (t_ret = __db_close(dblp->lfd)) != 0 && ret == 0) + ret = t_ret; + if (dblp->c_dbt.data != NULL) + FREE(dblp->c_dbt.data, dblp->c_dbt.ulen); + if (dblp->c_fd != -1 && + (t_ret = __db_close(dblp->c_fd)) != 0 && ret == 0) + ret = t_ret; + if (dblp->dbentry != NULL) + FREE(dblp->dbentry, (dblp->dbentry_cnt * sizeof(DB_ENTRY))); + if (dblp->dir != NULL) + FREES(dblp->dir); + + if (dblp->reginfo.path != NULL) + FREES(dblp->reginfo.path); + FREE(dblp, sizeof(*dblp)); + + return (ret); +} + +/* + * log_unlink -- + * Exit a log. + */ +int +log_unlink(path, force, dbenv) + const char *path; + int force; + DB_ENV *dbenv; +{ + REGINFO reginfo; + int ret; + + memset(®info, 0, sizeof(reginfo)); + reginfo.dbenv = dbenv; + reginfo.appname = DB_APP_LOG; + if (path != NULL && (reginfo.path = __db_strdup(path)) == NULL) + return (ENOMEM); + reginfo.file = DB_DEFAULT_LOG_FILE; + ret = __db_runlink(®info, force); + if (reginfo.path != NULL) + FREES(reginfo.path); + return (ret); +} + +/* + * log_stat -- + * Return LOG statistics. + */ +int +log_stat(dblp, gspp, db_malloc) + DB_LOG *dblp; + DB_LOG_STAT **gspp; + void *(*db_malloc) __P((size_t)); +{ + LOG *lp; + + *gspp = NULL; + lp = dblp->lp; + + if ((*gspp = db_malloc == NULL ? + (DB_LOG_STAT *)__db_malloc(sizeof(**gspp)) : + (DB_LOG_STAT *)db_malloc(sizeof(**gspp))) == NULL) + return (ENOMEM); + + /* Copy out the global statistics. */ + LOCK_LOGREGION(dblp); + **gspp = lp->stat; + + (*gspp)->st_magic = lp->persist.magic; + (*gspp)->st_version = lp->persist.version; + (*gspp)->st_mode = lp->persist.mode; + (*gspp)->st_lg_max = lp->persist.lg_max; + + (*gspp)->st_region_nowait = lp->rlayout.lock.mutex_set_nowait; + (*gspp)->st_region_wait = lp->rlayout.lock.mutex_set_wait; + + (*gspp)->st_cur_file = lp->lsn.file; + (*gspp)->st_cur_offset = lp->lsn.offset; + + (*gspp)->st_refcnt = lp->rlayout.refcnt; + (*gspp)->st_regsize = lp->rlayout.size; + + UNLOCK_LOGREGION(dblp); + + return (0); +} diff --git a/mozilla/db/log/log.src b/mozilla/db/log/log.src new file mode 100644 index 00000000000..12883bd1e3f --- /dev/null +++ b/mozilla/db/log/log.src @@ -0,0 +1,19 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)log.src 10.5 (Sleepycat) 4/10/98 + */ + +PREFIX log + +/* Used for registering name/id translations at open or close. */ +BEGIN register +ARG opcode u_int32_t lu +DBT name DBT s +DBT uid DBT s +ARG id u_int32_t lu +ARG ftype DBTYPE lx +END diff --git a/mozilla/db/log/log_archive.c b/mozilla/db/log/log_archive.c new file mode 100644 index 00000000000..7db0cc3e36d --- /dev/null +++ b/mozilla/db/log/log_archive.c @@ -0,0 +1,422 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)log_archive.c 10.37 (Sleepycat) 5/3/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#endif + +#include "db_int.h" +#include "db_dispatch.h" +#include "shqueue.h" +#include "log.h" +#include "common_ext.h" +#include "clib_ext.h" /* XXX: needed for getcwd. */ + +static int __absname __P((char *, char *, char **)); +static int __build_data __P((DB_LOG *, char *, char ***, void *(*)(size_t))); +static int __cmpfunc __P((const void *, const void *)); +static int __usermem __P((char ***, void *(*)(size_t))); + +/* + * log_archive -- + * Supporting function for db_archive(1). + */ +int +log_archive(dblp, listp, flags, db_malloc) + DB_LOG *dblp; + char ***listp; + u_int32_t flags; + void *(*db_malloc) __P((size_t)); +{ + DBT rec; + DB_LSN stable_lsn; + u_int32_t fnum; + int array_size, n, ret; + char **array, **arrayp, *name, *p, *pref, buf[MAXPATHLEN]; + + COMPQUIET(fnum, 0); + +#define OKFLAGS (DB_ARCH_ABS | DB_ARCH_DATA | DB_ARCH_LOG) + if (flags != 0) { + if ((ret = + __db_fchk(dblp->dbenv, "log_archive", flags, OKFLAGS)) != 0) + return (ret); + if ((ret = + __db_fcchk(dblp->dbenv, + "log_archive", flags, DB_ARCH_DATA, DB_ARCH_LOG)) != 0) + return (ret); + } + + /* + * Get the absolute pathname of the current directory. It would + * be nice to get the shortest pathname of the database directory, + * but that's just not possible. + */ + if (LF_ISSET(DB_ARCH_ABS)) { + errno = 0; + if ((pref = getcwd(buf, sizeof(buf))) == NULL) + return (errno == 0 ? ENOMEM : errno); + } else + pref = NULL; + + switch (LF_ISSET(~DB_ARCH_ABS)) { + case DB_ARCH_DATA: + return (__build_data(dblp, pref, listp, db_malloc)); + case DB_ARCH_LOG: + memset(&rec, 0, sizeof(rec)); + if (F_ISSET(dblp, DB_AM_THREAD)) + F_SET(&rec, DB_DBT_MALLOC); + if ((ret = log_get(dblp, &stable_lsn, &rec, DB_LAST)) != 0) + return (ret); + if (F_ISSET(dblp, DB_AM_THREAD)) + __db_free(rec.data); + fnum = stable_lsn.file; + break; + case 0: + if ((ret = __log_findckp(dblp, &stable_lsn)) != 0) { + /* + * A return of DB_NOTFOUND means that we didn't find + * any records in the log (so we are not going to be + * deleting any log files). + */ + if (ret != DB_NOTFOUND) + return (ret); + *listp = NULL; + return (0); + } + /* Remove any log files before the last stable LSN. */ + fnum = stable_lsn.file - 1; + break; + } + +#define LIST_INCREMENT 64 + /* Get some initial space. */ + if ((array = + (char **)__db_malloc(sizeof(char *) * (array_size = 10))) == NULL) + return (ENOMEM); + array[0] = NULL; + + /* Build an array of the file names. */ + for (n = 0; fnum > 0; --fnum) { + if ((ret = __log_name(dblp, fnum, &name)) != 0) + goto err; + if (__db_exists(name, NULL) != 0) + break; + + if (n >= array_size - 1) { + array_size += LIST_INCREMENT; + if ((array = (char **)__db_realloc(array, + sizeof(char *) * array_size)) == NULL) { + ret = ENOMEM; + goto err; + } + } + + if (LF_ISSET(DB_ARCH_ABS)) { + if ((ret = __absname(pref, name, &array[n])) != 0) + goto err; + FREES(name); + } else if ((p = __db_rpath(name)) != NULL) { + if ((array[n] = (char *)__db_strdup(p + 1)) == NULL) { + ret = ENOMEM; + goto err; + } + FREES(name); + } else + array[n] = name; + + array[++n] = NULL; + } + + /* If there's nothing to return, we're done. */ + if (n == 0) { + *listp = NULL; + ret = 0; + goto err; + } + + /* Sort the list. */ + qsort(array, (size_t)n, sizeof(char *), __cmpfunc); + + /* Rework the memory. */ + if ((ret = __usermem(&array, db_malloc)) != 0) + goto err; + + *listp = array; + return (0); + +err: if (array != NULL) { + for (arrayp = array; *arrayp != NULL; ++arrayp) + FREES(*arrayp); + __db_free(array); + } + return (ret); +} + +/* + * __build_data -- + * Build a list of datafiles for return. + */ +static int +__build_data(dblp, pref, listp, db_malloc) + DB_LOG *dblp; + char *pref, ***listp; + void *(*db_malloc) __P((size_t)); +{ + DBT rec; + DB_LSN lsn; + __log_register_args *argp; + u_int32_t rectype; + int array_size, last, n, nxt, ret; + char **array, **arrayp, *p, *real_name; + + /* Get some initial space. */ + if ((array = + (char **)__db_malloc(sizeof(char *) * (array_size = 10))) == NULL) + return (ENOMEM); + array[0] = NULL; + + memset(&rec, 0, sizeof(rec)); + if (F_ISSET(dblp, DB_AM_THREAD)) + F_SET(&rec, DB_DBT_MALLOC); + for (n = 0, ret = log_get(dblp, &lsn, &rec, DB_FIRST); + ret == 0; ret = log_get(dblp, &lsn, &rec, DB_NEXT)) { + if (rec.size < sizeof(rectype)) { + ret = EINVAL; + __db_err(dblp->dbenv, "log_archive: bad log record"); + goto lg_free; + } + + memcpy(&rectype, rec.data, sizeof(rectype)); + if (rectype != DB_log_register) { + if (F_ISSET(dblp, DB_AM_THREAD)) { + __db_free(rec.data); + rec.data = NULL; + } + continue; + } + if ((ret = __log_register_read(rec.data, &argp)) != 0) { + ret = EINVAL; + __db_err(dblp->dbenv, + "log_archive: unable to read log record"); + goto lg_free; + } + + if (n >= array_size - 1) { + array_size += LIST_INCREMENT; + if ((array = (char **)__db_realloc(array, + sizeof(char *) * array_size)) == NULL) { + ret = ENOMEM; + goto lg_free; + } + } + + if ((array[n] = (char *)__db_strdup(argp->name.data)) == NULL) { + ret = ENOMEM; +lg_free: if (F_ISSET(&rec, DB_DBT_MALLOC) && rec.data != NULL) + __db_free(rec.data); + goto err1; + } + + array[++n] = NULL; + __db_free(argp); + + if (F_ISSET(dblp, DB_AM_THREAD)) { + __db_free(rec.data); + rec.data = NULL; + } + } + + /* If there's nothing to return, we're done. */ + if (n == 0) { + ret = 0; + *listp = NULL; + goto err1; + } + + /* Sort the list. */ + qsort(array, (size_t)n, sizeof(char *), __cmpfunc); + + /* + * Build the real pathnames, discarding nonexistent files and + * duplicates. + */ + for (last = nxt = 0; nxt < n;) { + /* + * Discard duplicates. Last is the next slot we're going + * to return to the user, nxt is the next slot that we're + * going to consider. + */ + if (last != nxt) { + array[last] = array[nxt]; + array[nxt] = NULL; + } + for (++nxt; nxt < n && + strcmp(array[last], array[nxt]) == 0; ++nxt) { + FREES(array[nxt]); + array[nxt] = NULL; + } + + /* Get the real name. */ + if ((ret = __db_appname(dblp->dbenv, + DB_APP_DATA, NULL, array[last], 0, NULL, &real_name)) != 0) + goto err2; + + /* If the file doesn't exist, ignore it. */ + if (__db_exists(real_name, NULL) != 0) { + FREES(real_name); + FREES(array[last]); + array[last] = NULL; + continue; + } + + /* Rework the name as requested by the user. */ + FREES(array[last]); + array[last] = NULL; + if (pref != NULL) { + ret = __absname(pref, real_name, &array[last]); + FREES(real_name); + if (ret != 0) + goto err2; + } else if ((p = __db_rpath(real_name)) != NULL) { + array[last] = (char *)__db_strdup(p + 1); + FREES(real_name); + if (array[last] == NULL) + goto err2; + } else + array[last] = real_name; + ++last; + } + + /* NULL-terminate the list. */ + array[last] = NULL; + + /* Rework the memory. */ + if ((ret = __usermem(&array, db_malloc)) != 0) + goto err1; + + *listp = array; + return (0); + +err2: /* + * XXX + * We've possibly inserted NULLs into the array list, so clean up a + * bit so that the other error processing works. + */ + if (array != NULL) + for (; nxt < n; ++nxt) + FREES(array[nxt]); + /* FALLTHROUGH */ + +err1: if (array != NULL) { + for (arrayp = array; *arrayp != NULL; ++arrayp) + FREES(*arrayp); + __db_free(array); + } + return (ret); +} + +/* + * __absname -- + * Return an absolute path name for the file. + */ +static int +__absname(pref, name, newnamep) + char *pref, *name, **newnamep; +{ + size_t l_pref, l_name; + int isabspath; + char *newname; + + l_name = strlen(name); + isabspath = __db_abspath(name); + l_pref = isabspath ? 0 : strlen(pref); + + /* Malloc space for concatenating the two. */ + if ((*newnamep = + newname = (char *)__db_malloc(l_pref + l_name + 2)) == NULL) + return (ENOMEM); + + /* Build the name. If `name' is an absolute path, ignore any prefix. */ + if (!isabspath) { + memcpy(newname, pref, l_pref); + if (strchr(PATH_SEPARATOR, newname[l_pref - 1]) == NULL) + newname[l_pref++] = PATH_SEPARATOR[0]; + } + memcpy(newname + l_pref, name, l_name + 1); + + return (0); +} + +/* + * __usermem -- + * Create a single chunk of memory that holds the returned information. + * If the user has their own malloc routine, use it. + */ +static int +__usermem(listp, cmpfunc) + char ***listp; + void *(*cmpfunc) __P((size_t)); +{ + size_t len; + char **array, **arrayp, **orig, *strp; + + /* Find out how much space we need. */ + for (len = 0, orig = *listp; *orig != NULL; ++orig) + len += sizeof(char *) + strlen(*orig) + 1; + len += sizeof(char *); + + /* + * Allocate it and set up the pointers. + * + * XXX + * Don't simplify this expression, SunOS compilers don't like it. + */ + if (cmpfunc == NULL) + array = (char **)__db_malloc(len); + else + array = (char **)cmpfunc(len); + if (array == NULL) + return (ENOMEM); + strp = (char *)(array + (orig - *listp) + 1); + + /* Copy the original information into the new memory. */ + for (orig = *listp, arrayp = array; *orig != NULL; ++orig, ++arrayp) { + len = strlen(*orig); + memcpy(strp, *orig, len + 1); + *arrayp = strp; + strp += len + 1; + + FREES(*orig); + } + + /* NULL-terminate the list. */ + *arrayp = NULL; + + __db_free(*listp); + *listp = array; + + return (0); +} + +static int +__cmpfunc(p1, p2) + const void *p1, *p2; +{ + return (strcmp(*((char * const *)p1), *((char * const *)p2))); +} diff --git a/mozilla/db/log/log_auto.c b/mozilla/db/log/log_auto.c new file mode 100644 index 00000000000..b17b1ffb2f4 --- /dev/null +++ b/mozilla/db/log/log_auto.c @@ -0,0 +1,232 @@ +/* Do not edit: automatically built by dist/db_gen.sh. */ +#include "config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include +#include +#include +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_page.h" +#include "db_dispatch.h" +#include "log.h" +#include "db_am.h" +/* + * PUBLIC: int __log_register_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t, const DBT *, const DBT *, u_int32_t, + * PUBLIC: DBTYPE)); + */ +int __log_register_log(logp, txnid, ret_lsnp, flags, + opcode, name, uid, id, ftype) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t opcode; + const DBT *name; + const DBT *uid; + u_int32_t id; + DBTYPE ftype; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t zero; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_log_register; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(opcode) + + sizeof(u_int32_t) + (name == NULL ? 0 : name->size) + + sizeof(u_int32_t) + (uid == NULL ? 0 : uid->size) + + sizeof(id) + + sizeof(ftype); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &opcode, sizeof(opcode)); + bp += sizeof(opcode); + 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; + } + memcpy(bp, &id, sizeof(id)); + bp += sizeof(id); + memcpy(bp, &ftype, sizeof(ftype)); + bp += sizeof(ftype); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = __log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __log_register_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__log_register_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __log_register_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __log_register_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]log_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); + printf("\topcode: %lu\n", (u_long)argp->opcode); + printf("\tname: "); + for (i = 0; i < argp->name.size; i++) { + ch = ((u_int8_t *)argp->name.data)[i]; + if (isprint(ch) || ch == 0xa) + putchar(ch); + else + printf("%#x ", ch); + } + printf("\n"); + printf("\tuid: "); + for (i = 0; i < argp->uid.size; i++) { + ch = ((u_int8_t *)argp->uid.data)[i]; + if (isprint(ch) || ch == 0xa) + putchar(ch); + else + printf("%#x ", ch); + } + printf("\n"); + printf("\tid: %lu\n", (u_long)argp->id); + printf("\tftype: 0x%lx\n", (u_long)argp->ftype); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __log_register_read __P((void *, __log_register_args **)); + */ +int +__log_register_read(recbuf, argpp) + void *recbuf; + __log_register_args **argpp; +{ + __log_register_args *argp; + u_int8_t *bp; + + argp = (__log_register_args *)__db_malloc(sizeof(__log_register_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->opcode, bp, sizeof(argp->opcode)); + bp += sizeof(argp->opcode); + memcpy(&argp->name.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->name.data = bp; + bp += argp->name.size; + memcpy(&argp->uid.size, bp, sizeof(u_int32_t)); + bp += sizeof(u_int32_t); + argp->uid.data = bp; + bp += argp->uid.size; + memcpy(&argp->id, bp, sizeof(argp->id)); + bp += sizeof(argp->id); + memcpy(&argp->ftype, bp, sizeof(argp->ftype)); + bp += sizeof(argp->ftype); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __log_init_print __P((DB_ENV *)); + */ +int +__log_init_print(dbenv) + DB_ENV *dbenv; +{ + int ret; + + if ((ret = __db_add_recovery(dbenv, + __log_register_print, DB_log_register)) != 0) + return (ret); + return (0); +} + +/* + * PUBLIC: int __log_init_recover __P((DB_ENV *)); + */ +int +__log_init_recover(dbenv) + DB_ENV *dbenv; +{ + int ret; + + if ((ret = __db_add_recovery(dbenv, + __log_register_recover, DB_log_register)) != 0) + return (ret); + return (0); +} + diff --git a/mozilla/db/log/log_compare.c b/mozilla/db/log/log_compare.c new file mode 100644 index 00000000000..320b34af4d7 --- /dev/null +++ b/mozilla/db/log/log_compare.c @@ -0,0 +1,34 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)log_compare.c 10.3 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#endif + +#include "db_int.h" + +/* + * log_compare -- + * Compare two LSN's. + */ +int +log_compare(lsn0, lsn1) + const DB_LSN *lsn0, *lsn1; +{ + if (lsn0->file != lsn1->file) + return (lsn0->file < lsn1->file ? -1 : 1); + + if (lsn0->offset != lsn1->offset) + return (lsn0->offset < lsn1->offset ? -1 : 1); + + return (0); +} diff --git a/mozilla/db/log/log_findckp.c b/mozilla/db/log/log_findckp.c new file mode 100644 index 00000000000..82bd5890e64 --- /dev/null +++ b/mozilla/db/log/log_findckp.c @@ -0,0 +1,128 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)log_findckp.c 10.15 (Sleepycat) 4/26/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "log.h" +#include "txn.h" +#include "common_ext.h" + +/* + * __log_findckp -- + * + * Looks for the most recent checkpoint that occurs before the most recent + * checkpoint LSN. This is the point from which recovery can start and the + * point up to which archival/truncation can take place. Checkpoints in + * the log look like: + * + * ------------------------------------------------------------------- + * | ckp A, ckplsn 100 | .... record .... | ckp B, ckplsn 600 | ... + * ------------------------------------------------------------------- + * LSN 500 LSN 1000 + * + * If we read what log returns from using the DB_CKP parameter to logput, + * we'll get the record at LSN 1000. The checkpoint LSN there is 600. + * Now we have to scan backwards looking for a checkpoint before LSN 600. + * We find one at 500. This means that we can truncate the log before + * 500 or run recovery beginning at 500. + * + * Returns 0 if we find a suitable checkpoint or we retrieved the + * first record in the log from which to start. + * Returns DB_NOTFOUND if there are no log records. + * Returns errno on error. + * + * PUBLIC: int __log_findckp __P((DB_LOG *, DB_LSN *)); + */ +int +__log_findckp(lp, lsnp) + DB_LOG *lp; + DB_LSN *lsnp; +{ + DBT data; + DB_LSN ckp_lsn, last_ckp, next_lsn; + __txn_ckp_args *ckp_args; + int ret, verbose; + + verbose = lp->dbenv != NULL && lp->dbenv->db_verbose != 0; + + /* + * Need to find the appropriate point from which to begin + * recovery. + */ + memset(&data, 0, sizeof(data)); + if (F_ISSET(lp, DB_AM_THREAD)) + F_SET(&data, DB_DBT_MALLOC); + ZERO_LSN(ckp_lsn); + if ((ret = log_get(lp, &last_ckp, &data, DB_CHECKPOINT)) != 0) + if (ret == ENOENT) + goto get_first; + else + return (ret); + + next_lsn = last_ckp; + do { + if (F_ISSET(lp, DB_AM_THREAD)) + __db_free(data.data); + + if ((ret = log_get(lp, &next_lsn, &data, DB_SET)) != 0) + return (ret); + if ((ret = __txn_ckp_read(data.data, &ckp_args)) != 0) { + if (F_ISSET(lp, DB_AM_THREAD)) + __db_free(data.data); + return (ret); + } + if (IS_ZERO_LSN(ckp_lsn)) + ckp_lsn = ckp_args->ckp_lsn; + if (verbose) { + __db_err(lp->dbenv, "Checkpoint at: [%lu][%lu]", + (u_long)last_ckp.file, (u_long)last_ckp.offset); + __db_err(lp->dbenv, "Checkpoint LSN: [%lu][%lu]", + (u_long)ckp_args->ckp_lsn.file, + (u_long)ckp_args->ckp_lsn.offset); + __db_err(lp->dbenv, "Previous checkpoint: [%lu][%lu]", + (u_long)ckp_args->last_ckp.file, + (u_long)ckp_args->last_ckp.offset); + } + last_ckp = next_lsn; + next_lsn = ckp_args->last_ckp; + __db_free(ckp_args); + } while (!IS_ZERO_LSN(next_lsn) && + log_compare(&last_ckp, &ckp_lsn) > 0); + + if (F_ISSET(lp, DB_AM_THREAD)) + __db_free(data.data); + + /* + * At this point, either, next_lsn is ZERO or ckp_lsn is the + * checkpoint lsn and last_ckp is the LSN of the last checkpoint + * before ckp_lsn. If the compare in the loop is still true, then + * next_lsn must be 0 and we need to roll forward from the + * beginning of the log. + */ + if (log_compare(&last_ckp, &ckp_lsn) > 0) { +get_first: if ((ret = log_get(lp, &last_ckp, &data, DB_FIRST)) != 0) + return (ret); + if (F_ISSET(lp, DB_AM_THREAD)) + __db_free(data.data); + } + *lsnp = last_ckp; + + return (IS_ZERO_LSN(last_ckp) ? DB_NOTFOUND : 0); +} diff --git a/mozilla/db/log/log_get.c b/mozilla/db/log/log_get.c new file mode 100644 index 00000000000..9a055de0a61 --- /dev/null +++ b/mozilla/db/log/log_get.c @@ -0,0 +1,343 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)log_get.c 10.32 (Sleepycat) 5/6/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_page.h" +#include "log.h" +#include "hash.h" +#include "common_ext.h" + +/* + * log_get -- + * Get a log record. + */ +int +log_get(dblp, alsn, dbt, flags) + DB_LOG *dblp; + DB_LSN *alsn; + DBT *dbt; + u_int32_t flags; +{ + int ret; + + /* Validate arguments. */ +#define OKFLAGS (DB_CHECKPOINT | \ + DB_CURRENT | DB_FIRST | DB_LAST | DB_NEXT | DB_PREV | DB_SET) + if ((ret = __db_fchk(dblp->dbenv, "log_get", flags, OKFLAGS)) != 0) + return (ret); + switch (flags) { + case DB_CHECKPOINT: + case DB_CURRENT: + case DB_FIRST: + case DB_LAST: + case DB_NEXT: + case DB_PREV: + case DB_SET: + break; + default: + return (__db_ferr(dblp->dbenv, "log_get", 1)); + } + + if (F_ISSET(dblp, DB_AM_THREAD)) { + if (LF_ISSET(DB_NEXT | DB_PREV | DB_CURRENT)) + return (__db_ferr(dblp->dbenv, "log_get", 1)); + if (!F_ISSET(dbt, DB_DBT_USERMEM | DB_DBT_MALLOC)) + return (__db_ferr(dblp->dbenv, "threaded data", 1)); + } + + LOCK_LOGREGION(dblp); + + /* + * If we get one of the log's header records, repeat the operation. + * This assumes that applications don't ever request the log header + * records by LSN, but that seems reasonable to me. + */ + ret = __log_get(dblp, alsn, dbt, flags, 0); + if (ret == 0 && alsn->offset == 0) { + switch (flags) { + case DB_FIRST: + flags = DB_NEXT; + break; + case DB_LAST: + flags = DB_PREV; + break; + } + ret = __log_get(dblp, alsn, dbt, flags, 0); + } + + UNLOCK_LOGREGION(dblp); + + return (ret); +} + +/* + * __log_get -- + * Get a log record; internal version. + * + * PUBLIC: int __log_get __P((DB_LOG *, DB_LSN *, DBT *, u_int32_t, int)); + */ +int +__log_get(dblp, alsn, dbt, flags, silent) + DB_LOG *dblp; + DB_LSN *alsn; + DBT *dbt; + u_int32_t flags; + int silent; +{ + DB_LSN nlsn; + HDR hdr; + LOG *lp; + size_t len; + ssize_t nr; + int cnt, ret; + char *np, *tbuf; + const char *fail; + void *p, *shortp; + + lp = dblp->lp; + fail = np = tbuf = NULL; + + nlsn = dblp->c_lsn; + switch (flags) { + case DB_CHECKPOINT: + nlsn = lp->chkpt_lsn; + if (IS_ZERO_LSN(nlsn)) { + __db_err(dblp->dbenv, + "log_get: unable to find checkpoint record: no checkpoint set."); + ret = ENOENT; + goto err2; + } + break; + case DB_NEXT: /* Next log record. */ + if (!IS_ZERO_LSN(nlsn)) { + /* Increment the cursor by the cursor record size. */ + nlsn.offset += dblp->c_len; + break; + } + /* FALLTHROUGH */ + case DB_FIRST: /* Find the first log record. */ + /* Find the first log file. */ + if ((ret = __log_find(dblp, 1, &cnt)) != 0) + goto err2; + + /* + * We may have only entered records in the buffer, and not + * yet written a log file. If no log files were found and + * there's anything in the buffer, it belongs to file 1. + */ + if (cnt == 0) + cnt = 1; + + nlsn.file = cnt; + nlsn.offset = 0; + break; + case DB_CURRENT: /* Current log record. */ + break; + case DB_PREV: /* Previous log record. */ + if (!IS_ZERO_LSN(nlsn)) { + /* If at start-of-file, move to the previous file. */ + if (nlsn.offset == 0) { + if (nlsn.file == 1 || + __log_valid(dblp, NULL, nlsn.file - 1) != 0) + return (DB_NOTFOUND); + + --nlsn.file; + nlsn.offset = dblp->c_off; + } else + nlsn.offset = dblp->c_off; + break; + } + /* FALLTHROUGH */ + case DB_LAST: /* Last log record. */ + nlsn.file = lp->lsn.file; + nlsn.offset = lp->lsn.offset - lp->len; + break; + case DB_SET: /* Set log record. */ + nlsn = *alsn; + break; + } + +retry: + /* Return 1 if the request is past end-of-file. */ + if (nlsn.file > lp->lsn.file || + (nlsn.file == lp->lsn.file && nlsn.offset >= lp->lsn.offset)) + return (DB_NOTFOUND); + + /* If we've switched files, discard the current fd. */ + if (dblp->c_lsn.file != nlsn.file && dblp->c_fd != -1) { + (void)__db_close(dblp->c_fd); + dblp->c_fd = -1; + } + + /* If the entire record is in the in-memory buffer, copy it out. */ + if (nlsn.file == lp->lsn.file && nlsn.offset >= lp->w_off) { + /* Copy the header. */ + p = lp->buf + (nlsn.offset - lp->w_off); + memcpy(&hdr, p, sizeof(HDR)); + + /* Copy the record. */ + len = hdr.len - sizeof(HDR); + if ((ret = __db_retcopy(dbt, (u_int8_t *)p + sizeof(HDR), + len, &dblp->c_dbt.data, &dblp->c_dbt.ulen, NULL)) != 0) + goto err1; + goto cksum; + } + + /* Acquire a file descriptor. */ + if (dblp->c_fd == -1) { + if ((ret = __log_name(dblp, nlsn.file, &np)) != 0) + goto err1; + if ((ret = __db_open(np, DB_RDONLY | DB_SEQUENTIAL, + DB_RDONLY | DB_SEQUENTIAL, 0, &dblp->c_fd)) != 0) { + fail = np; + goto err1; + } + __db_free(np); + np = NULL; + } + + /* Seek to the header offset and read the header. */ + if ((ret = + __db_seek(dblp->c_fd, 0, 0, nlsn.offset, 0, SEEK_SET)) != 0) { + fail = "seek"; + goto err1; + } + if ((ret = __db_read(dblp->c_fd, &hdr, sizeof(HDR), &nr)) != 0) { + fail = "read"; + goto err1; + } + if (nr == sizeof(HDR)) + shortp = NULL; + else { + /* If read returns EOF, try the next file. */ + if (nr == 0) { + if (flags != DB_NEXT || nlsn.file == lp->lsn.file) + goto corrupt; + + /* Move to the next file. */ + ++nlsn.file; + nlsn.offset = 0; + goto retry; + } + + /* + * If read returns a short count the rest of the record has + * to be in the in-memory buffer. + */ + if (lp->b_off < sizeof(HDR) - nr) + goto corrupt; + + /* Get the rest of the header from the in-memory buffer. */ + memcpy((u_int8_t *)&hdr + nr, lp->buf, sizeof(HDR) - nr); + shortp = lp->buf + (sizeof(HDR) - nr); + } + + /* + * Check for buffers of 0's, that's what we usually see during + * recovery, although it's certainly not something on which we + * can depend. + */ + if (hdr.len <= sizeof(HDR)) + goto corrupt; + len = hdr.len - sizeof(HDR); + + /* If we've already moved to the in-memory buffer, fill from there. */ + if (shortp != NULL) { + if (lp->b_off < ((u_int8_t *)shortp - lp->buf) + len) + goto corrupt; + if ((ret = __db_retcopy(dbt, shortp, len, + &dblp->c_dbt.data, &dblp->c_dbt.ulen, NULL)) != 0) + goto err1; + goto cksum; + } + + /* + * Allocate temporary memory to hold the record. + * + * XXX + * We're calling malloc(3) with a region locked. This isn't + * a good idea. + */ + if ((tbuf = (char *)__db_malloc(len)) == NULL) { + ret = ENOMEM; + goto err1; + } + + /* + * Read the record into the buffer. If read returns a short count, + * there was an error or the rest of the record is in the in-memory + * buffer. Note, the information may be garbage if we're in recovery, + * so don't read past the end of the buffer's memory. + */ + if ((ret = __db_read(dblp->c_fd, tbuf, len, &nr)) != 0) { + fail = "read"; + goto err1; + } + if (len - nr > sizeof(lp->buf)) + goto corrupt; + if (nr != (ssize_t)len) { + if (lp->b_off < len - nr) + goto corrupt; + + /* Get the rest of the record from the in-memory buffer. */ + memcpy((u_int8_t *)tbuf + nr, lp->buf, len - nr); + } + + /* Copy the record into the user's DBT. */ + if ((ret = __db_retcopy(dbt, tbuf, len, + &dblp->c_dbt.data, &dblp->c_dbt.ulen, NULL)) != 0) + goto err1; + __db_free(tbuf); + tbuf = NULL; + +cksum: if (hdr.cksum != __ham_func4(dbt->data, dbt->size)) { + if (!silent) + __db_err(dblp->dbenv, "log_get: checksum mismatch"); + goto corrupt; + } + + /* Update the cursor and the return lsn. */ + dblp->c_off = hdr.prev; + dblp->c_len = hdr.len; + dblp->c_lsn = *alsn = nlsn; + + return (0); + +corrupt:/* + * This is the catchall -- for some reason we didn't find enough + * information or it wasn't reasonable information, and it wasn't + * because a system call failed. + */ + ret = EIO; + fail = "read"; + +err1: if (!silent) + if (fail == NULL) + __db_err(dblp->dbenv, "log_get: %s", strerror(ret)); + else + __db_err(dblp->dbenv, + "log_get: %s: %s", fail, strerror(ret)); +err2: if (np != NULL) + __db_free(np); + if (tbuf != NULL) + __db_free(tbuf); + return (ret); +} diff --git a/mozilla/db/log/log_put.c b/mozilla/db/log/log_put.c new file mode 100644 index 00000000000..d00e7dde210 --- /dev/null +++ b/mozilla/db/log/log_put.c @@ -0,0 +1,536 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)log_put.c 10.35 (Sleepycat) 5/6/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_page.h" +#include "log.h" +#include "hash.h" +#include "common_ext.h" + +static int __log_fill __P((DB_LOG *, DB_LSN *, void *, u_int32_t)); +static int __log_flush __P((DB_LOG *, const DB_LSN *)); +static int __log_newfd __P((DB_LOG *)); +static int __log_putr __P((DB_LOG *, DB_LSN *, const DBT *, u_int32_t)); +static int __log_write __P((DB_LOG *, void *, u_int32_t)); + +/* + * log_put -- + * Write a log record. + */ +int +log_put(dblp, lsn, dbt, flags) + DB_LOG *dblp; + DB_LSN *lsn; + const DBT *dbt; + u_int32_t flags; +{ + int ret; + + /* Validate arguments. */ +#define OKFLAGS (DB_CHECKPOINT | DB_FLUSH | DB_CURLSN) + if (flags != 0) { + if ((ret = + __db_fchk(dblp->dbenv, "log_put", flags, OKFLAGS)) != 0) + return (ret); + switch (flags) { + case DB_CHECKPOINT: + case DB_CURLSN: + case DB_FLUSH: + case 0: + break; + default: + return (__db_ferr(dblp->dbenv, "log_put", 1)); + } + } + + LOCK_LOGREGION(dblp); + ret = __log_put(dblp, lsn, dbt, flags); + UNLOCK_LOGREGION(dblp); + return (ret); +} + +/* + * __log_put -- + * Write a log record; internal version. + * + * PUBLIC: int __log_put __P((DB_LOG *, DB_LSN *, const DBT *, u_int32_t)); + */ +int +__log_put(dblp, lsn, dbt, flags) + DB_LOG *dblp; + DB_LSN *lsn; + const DBT *dbt; + u_int32_t flags; +{ + DBT fid_dbt, t; + DB_LSN r_unused; + FNAME *fnp; + LOG *lp; + u_int32_t lastoff; + int ret; + + lp = dblp->lp; + + /* + * If the application just wants to know where we are, fill in + * the information. Currently used by the transaction manager + * to avoid writing TXN_begin records. + */ + if (LF_ISSET(DB_CURLSN)) { + lsn->file = lp->lsn.file; + lsn->offset = lp->lsn.offset; + return (0); + } + + /* If this information won't fit in the file, swap files. */ + if (lp->lsn.offset + sizeof(HDR) + dbt->size > lp->persist.lg_max) { + if (sizeof(HDR) + + sizeof(LOGP) + dbt->size > lp->persist.lg_max) { + __db_err(dblp->dbenv, + "log_put: record larger than maximum file size"); + return (EINVAL); + } + + /* Flush the log. */ + if ((ret = __log_flush(dblp, NULL)) != 0) + return (ret); + + /* + * Save the last known offset from the previous file, we'll + * need it to initialize the persistent header information. + */ + lastoff = lp->lsn.offset; + + /* Point the current LSN to the new file. */ + ++lp->lsn.file; + lp->lsn.offset = 0; + + /* Reset the file write offset. */ + lp->w_off = 0; + } else + lastoff = 0; + + /* Initialize the LSN information returned to the user. */ + lsn->file = lp->lsn.file; + lsn->offset = lp->lsn.offset; + + /* + * Insert persistent information as the first record in every file. + * Note that the previous length is wrong for the very first record + * of the log, but that's okay, we check for it during retrieval. + */ + if (lp->lsn.offset == 0) { + t.data = &lp->persist; + t.size = sizeof(LOGP); + if ((ret = __log_putr(dblp, lsn, + &t, lastoff == 0 ? 0 : lastoff - lp->len)) != 0) + return (ret); + + /* Update the LSN information returned to the user. */ + lsn->file = lp->lsn.file; + lsn->offset = lp->lsn.offset; + } + + /* Write the application's log record. */ + if ((ret = __log_putr(dblp, lsn, dbt, lp->lsn.offset - lp->len)) != 0) + return (ret); + + /* + * On a checkpoint, we: + * Put out the checkpoint record (above). + * Save the LSN of the checkpoint in the shared region. + * Append the set of file name information into the log. + */ + if (flags == DB_CHECKPOINT) { + lp->chkpt_lsn = *lsn; + + for (fnp = SH_TAILQ_FIRST(&dblp->lp->fq, __fname); + fnp != NULL; fnp = SH_TAILQ_NEXT(fnp, q, __fname)) { + memset(&t, 0, sizeof(t)); + t.data = R_ADDR(dblp, fnp->name_off); + t.size = strlen(t.data) + 1; + memset(&fid_dbt, 0, sizeof(fid_dbt)); + fid_dbt.data = fnp->ufid; + fid_dbt.size = DB_FILE_ID_LEN; + if ((ret = __log_register_log(dblp, NULL, &r_unused, 0, + LOG_CHECKPOINT, &t, &fid_dbt, fnp->id, fnp->s_type)) + != 0) + return (ret); + } + } + + /* + * On a checkpoint or when flush is requested, we: + * Flush the current buffer contents to disk. + * Sync the log to disk. + */ + if (flags == DB_FLUSH || flags == DB_CHECKPOINT) + if ((ret = __log_flush(dblp, NULL)) != 0) + return (ret); + + /* + * On a checkpoint, we: + * Save the time the checkpoint was written. + * Reset the bytes written since the last checkpoint. + */ + if (flags == DB_CHECKPOINT) { + (void)time(&lp->chkpt); + lp->stat.st_wc_bytes = lp->stat.st_wc_mbytes = 0; + } + return (0); +} + +/* + * __log_putr -- + * Actually put a record into the log. + */ +static int +__log_putr(dblp, lsn, dbt, prev) + DB_LOG *dblp; + DB_LSN *lsn; + const DBT *dbt; + u_int32_t prev; +{ + HDR hdr; + LOG *lp; + int ret; + + lp = dblp->lp; + + /* + * Initialize the header. If we just switched files, lsn.offset will + * be 0, and what we really want is the offset of the previous record + * in the previous file. Fortunately, prev holds the value we want. + */ + hdr.prev = prev; + hdr.len = sizeof(HDR) + dbt->size; + hdr.cksum = __ham_func4(dbt->data, dbt->size); + + if ((ret = __log_fill(dblp, lsn, &hdr, sizeof(HDR))) != 0) + return (ret); + lp->len = sizeof(HDR); + lp->lsn.offset += sizeof(HDR); + + if ((ret = __log_fill(dblp, lsn, dbt->data, dbt->size)) != 0) + return (ret); + lp->len += dbt->size; + lp->lsn.offset += dbt->size; + return (0); +} + +/* + * log_flush -- + * Write all records less than or equal to the specified LSN. + */ +int +log_flush(dblp, lsn) + DB_LOG *dblp; + const DB_LSN *lsn; +{ + int ret; + + LOCK_LOGREGION(dblp); + ret = __log_flush(dblp, lsn); + UNLOCK_LOGREGION(dblp); + return (ret); +} + +/* + * __log_flush -- + * Write all records less than or equal to the specified LSN; internal + * version. + */ +static int +__log_flush(dblp, lsn) + DB_LOG *dblp; + const DB_LSN *lsn; +{ + DB_LSN t_lsn; + LOG *lp; + int current, ret; + + ret = 0; + lp = dblp->lp; + + /* + * If no LSN specified, flush the entire log by setting the flush LSN + * to the last LSN written in the log. Otherwise, check that the LSN + * isn't a non-existent record for the log. + */ + if (lsn == NULL) { + t_lsn.file = lp->lsn.file; + t_lsn.offset = lp->lsn.offset - lp->len; + lsn = &t_lsn; + } else + if (lsn->file > lp->lsn.file || + (lsn->file == lp->lsn.file && + lsn->offset > lp->lsn.offset - lp->len)) { + __db_err(dblp->dbenv, + "log_flush: LSN past current end-of-log"); + return (EINVAL); + } + + /* + * If the LSN is less than the last-sync'd LSN, we're done. Note, + * the last-sync LSN saved in s_lsn is the LSN of the first byte + * we absolutely know has been written to disk, so the test is <=. + */ + if (lsn->file < lp->s_lsn.file || + (lsn->file == lp->s_lsn.file && lsn->offset <= lp->s_lsn.offset)) + return (0); + + /* + * We may need to write the current buffer. We have to write the + * current buffer if the flush LSN is greater than or equal to the + * buffer's starting LSN. + */ + current = 0; + if (lp->b_off != 0 && + lsn->file >= lp->f_lsn.file && lsn->offset >= lp->f_lsn.offset) { + if ((ret = __log_write(dblp, lp->buf, lp->b_off)) != 0) + return (ret); + + lp->b_off = 0; + current = 1; + } + + /* + * It's possible that this thread may never have written to this log + * file. Acquire a file descriptor if we don't already have one. + */ + if (dblp->lfname != dblp->lp->lsn.file) + if ((ret = __log_newfd(dblp)) != 0) + return (ret); + + /* Sync all writes to disk. */ + if ((ret = __db_fsync(dblp->lfd)) != 0) + return (ret); + ++lp->stat.st_scount; + + /* + * Set the last-synced LSN, using the LSN of the current buffer. If + * the current buffer was flushed, we know the LSN of the first byte + * of the buffer is on disk, otherwise, we only know that the LSN of + * the record before the one beginning the current buffer is on disk. + */ + lp->s_lsn = lp->f_lsn; + if (!current) + if (lp->s_lsn.offset == 0) { + --lp->s_lsn.file; + lp->s_lsn.offset = lp->persist.lg_max; + } else + --lp->s_lsn.offset; + + return (0); +} + +/* + * __log_fill -- + * Write information into the log. + */ +static int +__log_fill(dblp, lsn, addr, len) + DB_LOG *dblp; + DB_LSN *lsn; + void *addr; + u_int32_t len; +{ + LOG *lp; + u_int32_t nrec; + size_t nw, remain; + int ret; + + /* Copy out the data. */ + for (lp = dblp->lp; len > 0;) { + /* + * If we're beginning a new buffer, note the user LSN to which + * the first byte of the buffer belongs. We have to know this + * when flushing the buffer so that we know if the in-memory + * buffer needs to be flushed. + */ + if (lp->b_off == 0) + lp->f_lsn = *lsn; + + /* + * If we're on a buffer boundary and the data is big enough, + * copy as many records as we can directly from the data. + */ + if (lp->b_off == 0 && len >= sizeof(lp->buf)) { + nrec = len / sizeof(lp->buf); + if ((ret = __log_write(dblp, + addr, nrec * sizeof(lp->buf))) != 0) + return (ret); + addr = (u_int8_t *)addr + nrec * sizeof(lp->buf); + len -= nrec * sizeof(lp->buf); + continue; + } + + /* Figure out how many bytes we can copy this time. */ + remain = sizeof(lp->buf) - lp->b_off; + nw = remain > len ? len : remain; + memcpy(lp->buf + lp->b_off, addr, nw); + addr = (u_int8_t *)addr + nw; + len -= nw; + lp->b_off += nw; + + /* If we fill the buffer, flush it. */ + if (lp->b_off == sizeof(lp->buf)) { + if ((ret = + __log_write(dblp, lp->buf, sizeof(lp->buf))) != 0) + return (ret); + lp->b_off = 0; + } + } + return (0); +} + +/* + * __log_write -- + * Write the log buffer to disk. + */ +static int +__log_write(dblp, addr, len) + DB_LOG *dblp; + void *addr; + u_int32_t len; +{ + LOG *lp; + ssize_t nw; + int ret; + + /* + * If we haven't opened the log file yet or the current one + * has changed, acquire a new log file. + */ + lp = dblp->lp; + if (dblp->lfd == -1 || dblp->lfname != lp->lsn.file) + if ((ret = __log_newfd(dblp)) != 0) + return (ret); + + /* + * Seek to the offset in the file (someone may have written it + * since we last did). + */ + if ((ret = __db_seek(dblp->lfd, 0, 0, lp->w_off, 0, SEEK_SET)) != 0) + return (ret); + if ((ret = __db_write(dblp->lfd, addr, len, &nw)) != 0) + return (ret); + if (nw != (int32_t)len) + return (EIO); + + /* Reset the buffer offset and update the seek offset. */ + lp->w_off += len; + + /* Update written statistics. */ + if ((lp->stat.st_w_bytes += len) >= MEGABYTE) { + lp->stat.st_w_bytes -= MEGABYTE; + ++lp->stat.st_w_mbytes; + } + if ((lp->stat.st_wc_bytes += len) >= MEGABYTE) { + lp->stat.st_wc_bytes -= MEGABYTE; + ++lp->stat.st_wc_mbytes; + } + ++lp->stat.st_wcount; + + return (0); +} + +/* + * log_file -- + * Map a DB_LSN to a file name. + */ +int +log_file(dblp, lsn, namep, len) + DB_LOG *dblp; + const DB_LSN *lsn; + char *namep; + size_t len; +{ + int ret; + char *p; + + LOCK_LOGREGION(dblp); + ret = __log_name(dblp, lsn->file, &p); + UNLOCK_LOGREGION(dblp); + if (ret != 0) + return (ret); + + /* Check to make sure there's enough room and copy the name. */ + if (len < strlen(p) + 1) { + *namep = '\0'; + return (ENOMEM); + } + (void)strcpy(namep, p); + __db_free(p); + + return (0); +} + +/* + * __log_newfd -- + * Acquire a file descriptor for the current log file. + */ +static int +__log_newfd(dblp) + DB_LOG *dblp; +{ + int ret; + char *p; + + /* Close any previous file descriptor. */ + if (dblp->lfd != -1) { + (void)__db_close(dblp->lfd); + dblp->lfd = -1; + } + + /* Get the path of the new file and open it. */ + dblp->lfname = dblp->lp->lsn.file; + if ((ret = __log_name(dblp, dblp->lfname, &p)) != 0) + return (ret); + if ((ret = __db_open(p, + DB_CREATE | DB_SEQUENTIAL, + DB_CREATE | DB_SEQUENTIAL, + dblp->lp->persist.mode, &dblp->lfd)) != 0) + __db_err(dblp->dbenv, + "log_put: %s: %s", p, strerror(ret)); + FREES(p); + return (ret); +} + +/* + * __log_name -- + * Return the log name for a particular file. + * + * PUBLIC: int __log_name __P((DB_LOG *, int, char **)); + */ +int +__log_name(dblp, filenumber, namep) + DB_LOG *dblp; + char **namep; + int filenumber; +{ + char name[sizeof(LFNAME) + 10]; + + (void)snprintf(name, sizeof(name), LFNAME, filenumber); + return (__db_appname(dblp->dbenv, + DB_APP_LOG, dblp->dir, name, 0, NULL, namep)); +} diff --git a/mozilla/db/log/log_rec.c b/mozilla/db/log/log_rec.c new file mode 100644 index 00000000000..5deac46298f --- /dev/null +++ b/mozilla/db/log/log_rec.c @@ -0,0 +1,316 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * 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. 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)log_rec.c 10.20 (Sleepycat) 4/28/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "log.h" +#include "db_dispatch.h" +#include "common_ext.h" + +static int __log_open_file __P((DB_LOG *, + u_int8_t *, char *, DBTYPE, u_int32_t)); + +/* + * PUBLIC: int __log_register_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__log_register_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __log_register_args *argp; + int ret; + +#ifdef DEBUG_RECOVER + __log_register_print(logp, dbtp, lsnp, redo, info); +#endif + COMPQUIET(info, NULL); + COMPQUIET(lsnp, NULL); + + F_SET(logp, DB_AM_RECOVER); + + if ((ret = __log_register_read(dbtp->data, &argp)) != 0) + goto out; + + if ((argp->opcode == LOG_CHECKPOINT && redo == TXN_OPENFILES) || + (argp->opcode == LOG_OPEN && + (redo == TXN_REDO || redo == TXN_OPENFILES || + redo == TXN_FORWARD_ROLL)) || + (argp->opcode == LOG_CLOSE && + (redo == TXN_UNDO || redo == TXN_BACKWARD_ROLL))) { + /* + * If we are redoing an open or undoing a close, then we need + * to open a file. + */ + ret = __log_open_file(logp, + argp->uid.data, argp->name.data, argp->ftype, argp->id); + if (ret == ENOENT) { + if (redo == TXN_OPENFILES) + __db_err(logp->dbenv, + "warning: file %s not found", + argp->name.data); + ret = 0; + } + } else if (argp->opcode != LOG_CHECKPOINT) { + /* + * If we are redoing a close or undoing an open, then we need + * to close the file. + * + * If the file is deleted, then we can just ignore this close. + * Otherwise, we'd better have a valid dbp that we should either + * close or whose reference count should be decremented. + */ + LOCK_LOGTHREAD(logp); + if (logp->dbentry[argp->id].dbp == NULL) { + if (!logp->dbentry[argp->id].deleted) + ret = EINVAL; + } else if (--logp->dbentry[argp->id].refcount == 0) { + F_SET(logp->dbentry[argp->id].dbp, DB_AM_RECOVER); + ret = logp->dbentry[argp->id].dbp->close( + logp->dbentry[argp->id].dbp, 0); + logp->dbentry[argp->id].dbp = NULL; + } + UNLOCK_LOGTHREAD(logp); + } + +out: F_CLR(logp, DB_AM_RECOVER); + if (argp != NULL) + __db_free(argp); + return (ret); +} + +/* Hand coded routines. */ + +/* + * 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 +__log_open_file(lp, uid, name, ftype, ndx) + DB_LOG *lp; + u_int8_t *uid; + char *name; + DBTYPE ftype; + u_int32_t ndx; +{ + DB *dbp; + int ret; + + LOCK_LOGTHREAD(lp); + if (ndx < lp->dbentry_cnt && + (lp->dbentry[ndx].deleted == 1 || lp->dbentry[ndx].dbp != NULL)) { + lp->dbentry[ndx].refcount++; + + UNLOCK_LOGTHREAD(lp); + return (0); + } + UNLOCK_LOGTHREAD(lp); + + /* Need to open file. */ + dbp = NULL; + if ((ret = db_open(name, ftype, 0, 0, lp->dbenv, NULL, &dbp)) == 0) { + /* + * Verify that we are opening the same file that we were + * referring to when we wrote this log record. + */ + if (memcmp(uid, dbp->lock.fileid, DB_FILE_ID_LEN) != 0) { + (void)dbp->close(dbp, 0); + dbp = NULL; + ret = ENOENT; + } + } + + if (ret == 0 || ret == ENOENT) + (void)__log_add_logid(lp, dbp, ndx); + + return (ret); +} + +/* + * This function returns: + * 0 SUCCESS (the entry was not previously set and is now set or the + * entry was previously set and we just inced the ref count. + * >0 on system error (returns errno value). + * PUBLIC: int __log_add_logid __P((DB_LOG *, DB *, u_int32_t)); + */ +int +__log_add_logid(logp, dbp, ndx) + DB_LOG *logp; + DB *dbp; + u_int32_t ndx; +{ + DB_ENTRY *temp_entryp; + u_int32_t i; + int ret; + + ret = 0; + + LOCK_LOGTHREAD(logp); + /* + * Check if we need to grow the table. + */ + if (logp->dbentry_cnt <= ndx) { + if (logp->dbentry_cnt == 0) { + logp->dbentry = (DB_ENTRY *) + __db_malloc(DB_GROW_SIZE * sizeof(DB_ENTRY)); + if (logp->dbentry == NULL) { + ret = ENOMEM; + goto err; + } + } else { + temp_entryp = (DB_ENTRY *)__db_realloc(logp->dbentry, + (DB_GROW_SIZE + logp->dbentry_cnt) * + sizeof(DB_ENTRY)); + if (temp_entryp == NULL) { + ret = ENOMEM; + goto err; + } + logp->dbentry = temp_entryp; + + } + /* Initialize the new entries. */ + for (i = logp->dbentry_cnt; + i < logp->dbentry_cnt + DB_GROW_SIZE; i++) { + logp->dbentry[i].dbp = NULL; + logp->dbentry[i].deleted = 0; + } + + logp->dbentry_cnt += DB_GROW_SIZE; + } + + if (logp->dbentry[ndx].deleted == 0 && logp->dbentry[ndx].dbp == NULL) { + logp->dbentry[ndx].dbp = dbp; + logp->dbentry[ndx].refcount = 1; + logp->dbentry[ndx].deleted = dbp == NULL; + } else + logp->dbentry[ndx].refcount++; + +err: UNLOCK_LOGTHREAD(logp); + return (ret); +} + + +/* + * __db_fileid_to_db -- + * Return the DB corresponding to the specified fileid. + * + * PUBLIC: int __db_fileid_to_db __P((DB_LOG *, DB **, u_int32_t)); + */ +int +__db_fileid_to_db(logp, dbpp, ndx) + DB_LOG *logp; + DB **dbpp; + u_int32_t ndx; +{ + int ret; + + ret = 0; + LOCK_LOGTHREAD(logp); + + /* + * Return DB_DELETED if the file has been deleted + * (it's not an error). + */ + if (logp->dbentry[ndx].deleted) { + ret = DB_DELETED; + goto err; + } + + /* + * Otherwise return 0, but if we don't have a corresponding DB, + * it's an error. + */ + if ((*dbpp = logp->dbentry[ndx].dbp) == NULL) + ret = ENOENT; + +err: UNLOCK_LOGTHREAD(logp); + return (ret); +} + +/* + * Close files that were opened by the recovery daemon. + * + * PUBLIC: void __log_close_files __P((DB_LOG *)); + */ +void +__log_close_files(logp) + DB_LOG *logp; +{ + u_int32_t i; + + LOCK_LOGTHREAD(logp); + for (i = 0; i < logp->dbentry_cnt; i++) + if (logp->dbentry[i].dbp) + logp->dbentry[i].dbp->close(logp->dbentry[i].dbp, 0); + UNLOCK_LOGTHREAD(logp); +} + +/* + * PUBLIC: void __log_rem_logid __P((DB_LOG *, u_int32_t)); + */ +void +__log_rem_logid(logp, ndx) + DB_LOG *logp; + u_int32_t ndx; +{ + LOCK_LOGTHREAD(logp); + if (--logp->dbentry[ndx].refcount == 0) { + logp->dbentry[ndx].dbp = NULL; + logp->dbentry[ndx].deleted = 0; + } + UNLOCK_LOGTHREAD(logp); +} diff --git a/mozilla/db/log/log_register.c b/mozilla/db/log/log_register.c new file mode 100644 index 00000000000..a6fc4c1b3b5 --- /dev/null +++ b/mozilla/db/log/log_register.c @@ -0,0 +1,196 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)log_register.c 10.18 (Sleepycat) 5/3/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "log.h" +#include "common_ext.h" + +/* + * log_register -- + * Register a file name. + */ +int +log_register(dblp, dbp, name, type, idp) + DB_LOG *dblp; + DB *dbp; + const char *name; + DBTYPE type; + u_int32_t *idp; +{ + DBT fid_dbt, r_name; + DB_LSN r_unused; + FNAME *fnp; + size_t len; + u_int32_t fid; + int inserted, ret; + char *fullname; + void *namep; + + fid = 0; + inserted = 0; + fullname = NULL; + fnp = namep = NULL; + + /* Check the arguments. */ + if (type != DB_BTREE && type != DB_HASH && type != DB_RECNO) { + __db_err(dblp->dbenv, "log_register: unknown DB file type"); + return (EINVAL); + } + + /* Get the log file id. */ + if ((ret = __db_appname(dblp->dbenv, + DB_APP_DATA, NULL, name, 0, NULL, &fullname)) != 0) + return (ret); + + LOCK_LOGREGION(dblp); + + /* + * See if we've already got this file in the log, finding the + * next-to-lowest file id currently in use as we do it. + */ + for (fid = 1, fnp = SH_TAILQ_FIRST(&dblp->lp->fq, __fname); + fnp != NULL; fnp = SH_TAILQ_NEXT(fnp, q, __fname)) { + if (fid <= fnp->id) + fid = fnp->id + 1; + if (!memcmp(dbp->lock.fileid, fnp->ufid, DB_FILE_ID_LEN)) { + ++fnp->ref; + fid = fnp->id; + goto found; + } + } + + /* Allocate a new file name structure. */ + if ((ret = __db_shalloc(dblp->addr, sizeof(FNAME), 0, &fnp)) != 0) + goto err; + fnp->ref = 1; + fnp->id = fid; + fnp->s_type = type; + memcpy(fnp->ufid, dbp->lock.fileid, DB_FILE_ID_LEN); + + len = strlen(name) + 1; + if ((ret = __db_shalloc(dblp->addr, len, 0, &namep)) != 0) + goto err; + fnp->name_off = R_OFFSET(dblp, namep); + memcpy(namep, name, len); + + SH_TAILQ_INSERT_HEAD(&dblp->lp->fq, fnp, q, __fname); + inserted = 1; + +found: /* Log the registry. */ + if (!F_ISSET(dblp, DB_AM_RECOVER)) { + r_name.data = (void *)name; /* XXX: Yuck! */ + r_name.size = strlen(name) + 1; + memset(&fid_dbt, 0, sizeof(fid_dbt)); + fid_dbt.data = dbp->lock.fileid; + fid_dbt.size = DB_FILE_ID_LEN; + if ((ret = __log_register_log(dblp, NULL, &r_unused, + 0, LOG_OPEN, &r_name, &fid_dbt, fid, type)) != 0) + goto err; + if ((ret = __log_add_logid(dblp, dbp, fid)) != 0) + goto err; + } + + if (0) { +err: /* + * XXX + * We should grow the region. + */ + if (inserted) + SH_TAILQ_REMOVE(&dblp->lp->fq, fnp, q, __fname); + if (namep != NULL) + __db_shalloc_free(dblp->addr, namep); + if (fnp != NULL) + __db_shalloc_free(dblp->addr, fnp); + } + + UNLOCK_LOGREGION(dblp); + + if (fullname != NULL) + FREES(fullname); + + if (idp != NULL) + *idp = fid; + return (ret); +} + +/* + * log_unregister -- + * Discard a registered file name. + */ +int +log_unregister(dblp, fid) + DB_LOG *dblp; + u_int32_t fid; +{ + DBT fid_dbt, r_name; + DB_LSN r_unused; + FNAME *fnp; + int ret; + + ret = 0; + LOCK_LOGREGION(dblp); + + /* Find the entry in the log. */ + for (fnp = SH_TAILQ_FIRST(&dblp->lp->fq, __fname); + fnp != NULL; fnp = SH_TAILQ_NEXT(fnp, q, __fname)) + if (fid == fnp->id) + break; + if (fnp == NULL) { + __db_err(dblp->dbenv, "log_unregister: non-existent file id"); + ret = EINVAL; + goto ret1; + } + + /* Unlog the registry. */ + if (!F_ISSET(dblp, DB_AM_RECOVER)) { + memset(&r_name, 0, sizeof(r_name)); + r_name.data = R_ADDR(dblp, fnp->name_off); + r_name.size = strlen(r_name.data) + 1; + memset(&fid_dbt, 0, sizeof(fid_dbt)); + fid_dbt.data = fnp->ufid; + fid_dbt.size = DB_FILE_ID_LEN; + if ((ret = __log_register_log(dblp, NULL, &r_unused, + 0, LOG_CLOSE, &r_name, &fid_dbt, fid, fnp->s_type)) != 0) + goto ret1; + } + + /* + * If more than 1 reference, just decrement the reference and return. + * Otherwise, free the unique file information, name and structure. + */ + if (fnp->ref > 1) + --fnp->ref; + else { + __db_shalloc_free(dblp->addr, R_ADDR(dblp, fnp->name_off)); + SH_TAILQ_REMOVE(&dblp->lp->fq, fnp, q, __fname); + __db_shalloc_free(dblp->addr, fnp); + } + + /* + * Remove from the process local table. If this operation is taking + * place during recovery, then the logid was never added to the table, + * so do not remove it. + */ + if (!F_ISSET(dblp, DB_AM_RECOVER)) + __log_rem_logid(dblp, fid); + +ret1: UNLOCK_LOGREGION(dblp); + return (ret); +} diff --git a/mozilla/db/man/man.html/Db.html b/mozilla/db/man/man.html/Db.html new file mode 100644 index 00000000000..f7a5e2cba17 --- /dev/null +++ b/mozilla/db/man/man.html/Db.html @@ -0,0 +1,763 @@ + + +Db + + +

Db

+
+
+
+       #include <db_cxx.h>
+
+       static int
+       Db::open(const char *fname, DBTYPE type,
+            u_int32_t flags, int mode, DbEnv *dbenv, DbInfo *dbinfo, Db **dbpp);
+
+       DBTYPE
+       Db::get_type(void) const;
+
+       int
+       Db::close(u_int32_t flags);
+
+       int
+       Db::cursor(DbTxn *txnid, Dbc **cursorp);
+
+       int
+       Db::del(Dbt *key, DbTxn *txnid);
+
+       int
+       Db::fd(int *fdp);
+
+       int
+       Db::get(DbTxn *txnid, Dbt *key, Dbt *data, u_int32_t flags);
+
+       int
+       Db::put(DbTxn *txnid, Dbt *key, Dbt *data, u_int32_t flags);
+
+       int
+       Db::stat(void *sp, void *(*db_malloc)(size_t), u_int32_t flags);
+
+       int
+       Db::sync(u_int32_t flags);
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the  Db  class,  which  is  the
+       center of access activity.
+
+       The currently supported file formats are btree, hashed and
+       recno.  The btree format is a representation of a  sorted,
+       balanced   tree   structure.   The  hashed  format  is  an
+       extensible, dynamic  hashing  scheme.   The  recno  format
+       supports  fixed  or  variable  length  records (optionally
+       retrieved from a flat text file).
+       Storage and retrieval for the Db access methods are  based
+       on  key/data  pairs,  using the Dbt class.  See Dbt(3) for
+       specific information on the structure and capabilities  of
+       a Dbt.
+
+       The Db::open method opens the database represented by file
+       for both reading and writing.  Files never intended to  be
+       shared  or preserved on disk may be created by setting the
+       file parameter to NULL.
+
+       The Db::open method copies a pointer to a Db  object  into
+       the  memory  location  referenced by dbpp.  The methods of
+       this object allow you to perform various database actions,
+       as   described   below.   The  Db::open  method  throws  a
+       DbException(3) or returns the value of  errno  on  failure
+       and 0 on success.
+
+       Note,  while  most  of  the access methods use file as the
+       name  of  an  underlying  file  on  disk,  this   is   not
+       guaranteed.    Also,  calling  Db::open  is  a  reasonably
+       expensive operation.  (This is based on a model where  the
+       DBMS keeps a set of files open for a long time rather than
+       opening and closing them on each query.)
+
+       The type argument is of type DBTYPE  (as  defined  in  the
+       <db_cxx.h>  include  file)  and  must  be  set  to  one of
+       DB_BTREE, DB_HASH, DB_RECNO or  DB_UNKNOWN.   If  type  is
+       DB_UNKNOWN,  the  database must already exist and Db::open
+       will then determine if it is of type DB_BTREE, DB_HASH  or
+       DB_RECNO.
+
+       The  flags  and  mode  arguments specify how files will be
+       opened and/or created when they don't already exist.   The
+       flags value is specified by or'ing together one or more of
+       the following values:
+
+       DB_CREATE
+            Create any underlying files, as  necessary.   If  the
+            files  do not already exist and the DB_CREATE flag is
+            not specified, the call will fail.
+
+       DB_NOMMAP
+            Do not map this  file  (see  DbMpool(3)  for  further
+            information).
+
+       DB_RDONLY
+            Open  the  database for reading only.  Any attempt to
+            write the database using the access methods will fail
+            regardless   of   the   actual   permissions  of  any
+            underlying files.
+
+       DB_THREAD
+            Cause the Db handle returned by the  Db::open  method
+            to  be  useable  by  multiple threads within a single
+            address space, i.e., to be ``free-threaded''.
+
+       DB_TRUNCATE
+            ``Truncate'' the database if it exists, i.e.,  behave
+            as  if the database were just created, discarding any
+            previous contents.
+
+       All files created by the access methods are  created  with
+       mode  mode  (as described in chmod(2)) and modified by the
+       process'  umask  value  at  the  time  of  creation   (see
+       umask(2)).   The group ownership of created files is based
+       on the system and directory defaults, and is  not  further
+       specified by DB.
+
+       See  DbEnv(3) for a description of the dbenv argument, and
+       DbInfo(3) for a description of the dbinfo argument.
+
+
+
+

Db OPERATIONS

+       The Db object returned by Db::open  describes  a  database
+       type,  and  includes a set of functions to perform various
+       actions, as described below.  The methods for  Db  are  as
+       follows:
+
+       DBTYPE Db::get_type(void);
+            The  type  of  the underlying access method (and file
+            format).   Returns  one  of  DB_BTREE,   DB_HASH   or
+            DB_RECNO.   This  value  may be used to determine the
+            type of the database after  a  return  from  Db::open
+            with the type argument set to DB_UNKNOWN.
+
+       int Db::close(u_int32_t flags);
+            A  method  to  flush  any cached information to disk,
+            close  any  open  cursors  (see  Dbc(3)),  free   any
+            allocated  resources, and close any underlying files.
+            Since key/data pairs are cached in memory, failing to
+            sync  the  file  with  the  close  or sync method may
+            result in inconsistent or lost information.
+
+            The flags parameter must be set to 0 or the following
+            value:
+
+            DB_NOSYNC
+                 Do not flush cached information to disk.
+
+            The  DB_NOSYNC flag is a dangerous option.  It should
+            only be set 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.
+
+            It is important to understand  that  flushing  cached
+            information  to  disk  only  minimizes  the window of
+            opportunity for corrupted data.  While  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  close,
+            replace  the original database with the updated copy.
+
+            When  multiple  threads  are  using  the  Db   handle
+            concurrently,  only  a  single thread may call the Db
+            handle close method.
+
+            The close method throws a DbException(3)  or  returns
+            the value of errno on failure and 0 on success.
+
+       int Db::cursor(DbTxn *txnid, Dbc **cursorp);
+            A  method to create a cursor and copy a pointer to it
+            into the memory referenced by cursorp.
+
+            A cursor is an  object  used  to  provide  sequential
+            access through a database.
+
+            If  the  file  is  being  accessed  under transaction
+            protection, the txnid parameter is a  transaction  ID
+            returned   from   txn_begin,   otherwise,  NULL.   If
+            transaction protection is enabled,  cursors  must  be
+            opened   and   closed   within   the   context  of  a
+            transaction, and the txnid  parameter  specifies  the
+            transaction  context in which the cursor may be used.
+            See Dbc(3) for more information.
+
+            The cursor method throws a DbException(3) or  returns
+            the value of errno on failure and 0 on success.
+
+       int Db::del(DbTxn *txnid, Dbt *key, u_int32_t flags);
+            A  method to remove key/data pairs from the database.
+            The key/data pair associated with the  specified  key
+            is  discarded  from the database.  In the presence of
+            duplicate key values, all records associated with the
+            designated key will be discarded.
+
+            If  the  file  is  being  accessed  under transaction
+            protection, the txnid parameter is a  transaction  ID
+            returned from txn_begin, otherwise, NULL.
+
+            The  flags parameter is currently unused, and must be
+            set to 0.
+
+            The del method throws a DbException(3) or returns the
+            value   of  errno  on  failure,  0  on  success,  and
+            DB_NOTFOUND if the specified key did not exist in the
+            file.
+
+       int Db::fd(int *fdp);
+            A method that copies a file descriptor representative
+            of the underlying database into the memory referenced
+            by  fdp.  A file descriptor referencing the same file
+            will be returned to all processes that call  Db::open
+            with  the  same  file argument.  This file descriptor
+            may be safely used as an argument to the fcntl(2) and
+            flock(2)  locking  functions.  The file descriptor is
+            not necessarily associated with any of the underlying
+            files used by the access method.
+
+            The  fd method only supports a coarse-grained form of
+            locking.  Applications should use  the  lock  manager
+            where possible.
+
+            The  fd method throws a DbException(3) or returns the
+            value of errno on failure and 0 on success.
+
+       int Db::get(DbTxn *txnid, Dbt *key, Dbt *data, u_int32_t
+            flags);
+            A  method  that  is  an interface for keyed retrieval
+            from the database.  The address  and  length  of  the
+            data  associated  with the specified key are returned
+            in the object referenced by data.
+
+            In the presence of duplicate  key  values,  get  will
+            return  the  first  data item for the designated key.
+            Duplicates are sorted by insert  order  except  where
+            this  order has been overridden by cursor operations.
+            Retrieval of duplicates requires the  use  of  cursor
+            operations.  See Dbc(3) for details.
+
+            If  the  file  is  being  accessed  under transaction
+            protection, the txnid parameter is a  transaction  ID
+            returned from txn_begin, otherwise, NULL.
+
+            The flags parameter must be set to 0 or the following
+            value:
+
+            DB_GET_RECNO
+                 Retrieve  a  specific  numbered  record  from  a
+                 database.   Upon  return,  both the key and data
+                 items will have been filled  in,  not  just  the
+                 data  item  as is done for all other uses of the
+                 get method.
+
+                 For DB_GET_RECNO to be specified, the underlying
+                 database must be of type btree, and it must have
+                 been  created  with  the  DB_RECNUM  flag   (see
+                 Db::open(3)).   In  this case, the data field of
+                 the key must be a pointer to a  memory  location
+                 of type db_recno_t, as described in Dbt(3).
+
+            If the database is a recno database and the requested
+            key exists, but was never explicitly created  by  the
+            application  or  was  later  deleted,  the get method
+            returns DB_KEYEMPTY.  Otherwise, if the requested key
+            isn't   in  the  database,  the  get  method  returns
+            DB_NOTFOUND.  Otherwise,  the  get  method  throws  a
+            DbException(3)  or  returns  the  value  of  errno on
+            failure and 0 on success.
+
+       int Db::put(DbTxn *txnid, Dbt *key, Dbt *data, u_int32_t
+            flags);
+            A method to store key/data pairs in the database.  If
+            the database supports duplicates, the put method adds
+            the new data value at the end of the duplicate set.
+
+            If  the  file  is  being  accessed  under transaction
+            protection, the txnid parameter is a  transaction  ID
+            returned from txn_begin, otherwise, NULL.
+
+            The  flags  value is specified by or'ing together one
+            or more of the following values:
+
+            DB_APPEND
+                 Append the key/data  pair  to  the  end  of  the
+                 database.   For  DB_APPEND  to be specified, the
+                 underlying database must be of type recno.   The
+                 record   number   allocated  to  the  record  is
+                 returned in the specified key.
+
+            DB_NOOVERWRITE
+                 Enter the new key/data pair only if the key does
+                 not already appear in the database.
+
+            The  default  behavior  of the put method is to enter
+            the  new  key/data  pair,  replacing  any  previously
+            existing  key if duplicates are disallowed, or to add
+            a duplicate entry if duplicates are allowed.  Even if
+            the  designated database allows duplicates, a call to
+            put with the DB_NOOVERWRITE flag set will fail if the
+            key already exists in the database.
+
+            The put method throws a DbException(3) or returns the
+            value  of  errno  on  failure,  0  on  success,   and
+            DB_KEYEXIST  if  the  DB_NOOVERWRITE flag was set and
+            the key already exists in the file.
+
+       int Db::sync(u_int32_t flags);
+            A method to flush any cached information to disk.  If
+            the  database  is in memory only, the sync method has
+            no effect and will always succeed.
+
+            The flags parameter is currently unused, and must  be
+            set to 0.
+
+            See   the   close  method  description  above  for  a
+            discussion of Db and cached data.
+
+            The sync method throws a  DbException(3)  or  returns
+            the value of errno on failure and 0 on success.
+
+       int Db::stat(void *sp,
+                 void *(*db_malloc)(size_t), u_int32_t flags);
+            A method to create a statistical structure and copy a
+            pointer to it into user-specified  memory  locations.
+            Specifically,  if  sp  is  non-NULL, a pointer to the
+            statistics for  the  database  are  copied  into  the
+            memory location it references.
+
+            Statistical   structures  are  created  in  allocated
+            memory.  If db_malloc is non-NULL, it  is  called  to
+            allocate  the memory, otherwise, the library function
+            malloc(3) is used.  The function db_malloc must match
+            the  calling  conventions  of  the  malloc(3) library
+            routine.  Regardless, the caller is  responsible  for
+            deallocating  the returned memory.  To deallocate the
+            returned memory, free each returned  memory  pointer;
+            pointers   inside  the  memory  do  not  need  to  be
+            individually freed.
+
+            In the presence  of  multiple  threads  or  processes
+            accessing    an   active   database,   the   returned
+            information may be out-of-date.
+
+            This method may  access  all  of  the  pages  in  the
+            database,   and   therefore   may   incur   a  severe
+            performance penalty and have obvious negative effects
+            on the underlying buffer pool.
+
+            The flags parameter must be set to 0 or the following
+            value:
+
+            DB_RECORDCOUNT
+                 In the case of a btree or recno  database,  fill
+                 in  the  bt_nrecs  field, but do not collect any
+                 other   information.    This   flag   makes   it
+                 reasonable  for applications to request a record
+                 count  from  a  database  without  incurring   a
+                 performance penalty.
+
+            The  stat  method  throws a DbException(3) or returns
+            the value of errno on failure and 0 on success.
+
+            In the  case  of  a  btree  or  recno  database,  the
+            statistics   are   stored  in  a  structure  of  type
+            DB_BTREE_STAT   (typedef'd   in   <db_cxx.h>).    The
+            following fields will be filled in:
+
+            u_int32_t bt_magic;
+                 Magic number that identifies the file as a btree
+                 file.
+            u_int32_t bt_version;
+                 The version of the btree file type.
+            u_int32_t bt_flags;
+                 Permanent  database  flags,  including   DB_DUP,
+                 DB_FIXEDLEN, DB_RECNUM and DB_RENUMBER.
+            u_int32_t bt_minkey;
+                 The bt_minkey value specified to Db::open(3), if
+                 any.
+            u_int32_t bt_re_len;
+                 The re_len value specified  to  Db::open(3),  if
+                 any.
+            u_int32_t bt_re_pad;
+                 The  re_pad  value  specified to Db::open(3), if
+                 any.
+            u_int32_t bt_pagesize;
+                 Underlying tree page size.
+            u_int32_t bt_levels;
+                 Number of levels in the tree.
+            u_int32_t bt_nrecs;
+                 Number of data items in the  tree  (since  there
+                 may  be multiple data items per key, this number
+                 may not be the same as the number of keys).
+            u_int32_t bt_int_pg;
+                 Number of tree internal pages.
+            u_int32_t bt_leaf_pg;
+                 Number of tree leaf pages.
+            u_int32_t bt_dup_pg;
+                 Number of tree duplicate pages.
+            u_int32_t bt_over_pg;
+                 Number of tree overflow pages.
+
+            u_int32_t bt_free;
+                 Number of pages on the free list.
+            u_int32_t bt_freed;
+                 Number of pages made available for reuse because
+                 they were emptied.
+            u_int32_t bt_int_pgfree;
+                 Number of bytes free in tree internal pages.
+            u_int32_t bt_leaf_pgfree;
+                 Number of bytes free in tree leaf pages.
+            u_int32_t bt_dup_pgfree;
+                 Number of bytes free in tree duplicate pages.
+            u_int32_t bt_over_pgfree;
+                 Number of bytes free in tree overflow pages.
+            u_int32_t bt_pfxsaved;
+                 Number of bytes saved by prefix compression.
+            u_int32_t bt_split;
+                 Total  number of tree page splits (includes fast
+                 and root splits).
+            u_int32_t bt_rootsplit;
+                 Number of root page splits.
+            u_int32_t bt_fastsplit;
+                 Number of fast splits.   When  sorted  keys  are
+                 added    to   the   database,   the   Db   btree
+                 implementation  will  split  left  or  right  to
+                 increase the page-fill factor.  This number is a
+                 measure of how often it  was  possible  to  make
+                 such a split.
+            u_int32_t bt_added;
+                 Number of keys added.
+            u_int32_t bt_deleted;
+                 Number of keys deleted.
+            u_int32_t bt_get;
+                 Number  of  keys  retrieved.   (Note, this value
+                 will not reflect any  keys  retrieved  when  the
+                 database was open for read-only access, as there
+                 is  no   permanent   location   to   store   the
+                 information in this case.)
+            u_int32_t bt_cache_hit;
+                 Number  of  hits in tree fast-insert code.  When
+                 sorted keys are added to the  database,  the  Db
+                 btree  implementation  will  check the last page
+                 where an insert occurred  before  doing  a  full
+                 lookup.   This  number is a measure of how often
+                 the lookup was successful.
+            u_int32_t bt_cache_miss;
+                 Number of misses in tree fast-insert code.   See
+                 the  description of bt_cache_hit; this number is
+                 a measure of how often the lookup failed.
+
+
+
+

ENVIRONMENT VARIABLES

+       The following environment variables affect  the  execution
+       of Db::open:
+
+       DB_HOME
+            If  the  dbenv  argument  to Db::open was initialized
+            using db_appinit, the  environment  variable  DB_HOME
+            may  be used as the path of the database home for the
+            interpretation of the dir argument  to  Db::open,  as
+            described  in  db_appinit(3).  Specifically, Db::open
+            is affected by  the  configuration  string  value  of
+            DB_DATA_DIR.
+
+
+
+

EXAMPLES

+       Applications  that  create  short-lived databases that are
+       discarded or recreated  when  the  system  fails  and  are
+       unconcerned with concurrent access and loss of data due to
+       catastrophic  failure,  may  wish  to  use  the   Db::open
+       functionality without other parts of the Db library.  Such
+       applications will only be concerned  with  the  Db  access
+       methods.   The  Db access methods will use the memory pool
+       subsystem, but the application is unlikely to be aware  of
+       this.   See the file examples_cxx/AccessExample.cpp in the
+       Db source distribution for a C++ language code example  of
+       how such an application might use the Db library.
+
+
+
+

ERRORS

+       Methods  marked as returning errno will, by default, throw
+       an exception that encapsulates the error information.  The
+       default error behavior can be changed, see DbException(3).
+
+       The Db::open method may fail and throw a DbException(3)
+
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: Db::sync(3),
+       DbLock::get(3), DbLock::put(3), DbLockTab::id(3),
+       DbLockTab::vec(3), DbLog::db_register(3), DbLog::put(3),
+       DbMpool::close(3), DbMpool::db_register(3),
+       DbMpool::open(3), DbMpoolFile::close(3),
+       DbMpoolFile::get(3), DbMpoolFile::open(3),
+       DbMpoolFile::put(3), DbMpoolFile::set(3),
+       DbMpoolFile::sync(3), calloc(3), close(2), fcntl(2),
+       fflush(3), malloc(3), memcpy(3), memmove(3), memset(3),
+       mmap(2), munmap(2), open(2), read(2), realloc(3),
+       sigfillset(3), sigprocmask(2), stat(2), strcpy(3),
+       strdup(3), strerror(3), strlen(3), time(3), and unlink(2).
+
+       In  addition,  the  Db::open  method  may fail and throw a
+       DbException(3)  or  return   errno   for   the   following
+       conditions:
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EINVAL]
+            An  invalid  flag  value  or  parameter was specified
+            (e.g., unknown database type, page size, hash method,
+            recno  pad  byte,  byte  order)  or  a  flag value or
+            parameter that is incompatible with the current  file
+            specification.
+
+            The  DB_THREAD  flag  was specified and spinlocks are
+            not implemented for this architecture.
+
+            There is a mismatch between  the  version  number  of
+            file and the software.
+
+            A  re_source  file  was  specified  with  either  the
+            DB_THREAD flag or a non-NULL  tx_info  field  in  the
+            DbEnv argument to Db::open.
+
+       [ENOENT]
+            A non-existent re_source file was specified.
+
+       [EPERM]
+            Database  corruption  was  detected.   All subsequent
+            database calls (other  than  Db::close)  will  return
+            EPERM.
+
+       The Db::close method may fail and throw a DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: Db::sync(3),
+       DbLock::get(3), DbLock::put(3), DbLockTab::vec(3),
+       DbLog::db_register(3), DbLog::put(3), DbMpool::close(3),
+       DbMpoolFile::close(3), DbMpoolFile::get(3),
+       DbMpoolFile::put(3), DbMpoolFile::set(3),
+       DbMpoolFile::sync(3), calloc(3), close(2), fflush(3),
+       malloc(3), memcpy(3), memmove(3), memset(3), munmap(2),
+       realloc(3), and strerror(3).
+
+       The Db::cursor method may fail and throw a DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: calloc(3).
+
+       In addition, the Db::cursor method may fail  and  throw  a
+       DbException(3)   or   return   errno   for  the  following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       [EPERM]
+            Database corruption  was  detected.   All  subsequent
+            database  calls  (other  than  Db::close) will return
+            EPERM.
+
+       The Db::del method may fail and throw a DbException(3)
+
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: DbLock::get(3),
+       DbLock::put(3), DbLockTab::id(3), DbLockTab::vec(3),
+       DbLog::put(3), DbMpoolFile::get(3), DbMpoolFile::put(3),
+       DbMpoolFile::set(3), calloc(3), fcntl(2), fflush(3),
+       malloc(3), memcmp(3), memcpy(3), memmove(3), memset(3),
+       realloc(3), and strerror(3).
+
+       In addition, the Db::del  method  may  fail  and  throw  a
+       DbException(3)   or   return   errno   for  the  following
+       conditions:
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       [EPERM]
+            Database corruption  was  detected.   All  subsequent
+            database  calls  (other  than  Db::close) will return
+            EPERM.
+
+       In addition, the  Db::fd  method  may  fail  and  throw  a
+       DbException(3)   or   return   errno   for  the  following
+       conditions:
+
+       [ENOENT]
+            The  Db::fd  method  was  called  for  an   in-memory
+            database, or no underlying file has yet been created.
+
+       [EPERM]
+            Database corruption  was  detected.   All  subsequent
+            database  calls  (other  than  Db::close) will return
+            EPERM.
+
+       The Db::get method may fail and throw a DbException(3)
+
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: DbLock::get(3),
+       DbLock::put(3), DbLockTab::id(3), DbLockTab::vec(3),
+       DbLog::put(3), DbMpoolFile::get(3), DbMpoolFile::put(3),
+       DbMpoolFile::set(3), Dbc::get(3), calloc(3), fcntl(2),
+       fflush(3), malloc(3), memcmp(3), memcpy(3), memmove(3),
+       memset(3), realloc(3), and strerror(3).
+
+       In addition, the Db::get  method  may  fail  and  throw  a
+       DbException(3)   or   return   errno   for  the  following
+       conditions:
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The DB_THREAD flag was specified to  the  Db::open(3)
+            method    and    neither    the    DB_DBT_MALLOC   or
+            DB_DBT_USERMEM flags were set in the Dbt.
+
+            A record number of 0 was specified.
+
+       [EPERM]
+            Database corruption  was  detected.   All  subsequent
+            database  calls  (other  than  Db::close) will return
+            EPERM.
+
+       The Db::put method may fail and throw a DbException(3)
+
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: DbLock::get(3),
+       DbLock::put(3), DbLockTab::id(3), DbLockTab::vec(3),
+       DbLog::put(3), DbMpoolFile::get(3), DbMpoolFile::put(3),
+       DbMpoolFile::set(3), calloc(3), fcntl(2), fflush(3),
+       malloc(3), memcmp(3), memcpy(3), memmove(3), memset(3),
+       realloc(3), and strerror(3).
+
+       In addition, the Db::put  method  may  fail  and  throw  a
+       DbException(3)   or   return   errno   for  the  following
+       conditions:
+
+       [EACCES]
+            An attempt was made to modify a read-only database.
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            A record number of 0 was specified.
+
+            An attempt was made to add a record to a fixed-length
+            database that was too large to fit.
+
+            An attempt was made to do a partial put.
+
+       [EPERM]
+            Database  corruption  was  detected.   All subsequent
+            database calls (other  than  Db::close)  will  return
+            EPERM.
+
+       [ENOSPC]
+            A btree exceeded the maximum btree depth (255).
+
+       The Db::stat method may fail and throw a DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: DbLock::get(3),
+       DbLock::put(3), DbLockTab::id(3), DbLockTab::vec(3),
+       DbMpoolFile::get(3), DbMpoolFile::put(3), calloc(3),
+       fcntl(2),  fflush(3), malloc(3), memcpy(3), and memset(3).
+
+       The Db::sync method may fail and throw a DbException(3)
+
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: Db::get(3),
+       Db::sync(3), DbLock::get(3), DbLock::put(3),
+       DbLockTab::id(3), DbLockTab::vec(3), DbLog::put(3),
+       DbMpoolFile::get(3), DbMpoolFile::put(3),
+       DbMpoolFile::set(3), DbMpoolFile::sync(3), calloc(3),
+       close(2), fcntl(2), fflush(3), malloc(3), memcpy(3),
+       memmove(3), memset(3), munmap(2), open(2), realloc(3),
+       strerror(3), unlink(2), and write(2).
+
+       In addition, the Db::sync method  may  fail  and  throw  a
+       DbException(3)   or   return   errno   for  the  following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       [EPERM]
+            Database corruption  was  detected.   All  subsequent
+            database  calls  (other  than  Db::close) will return
+            EPERM.
+
+
+
+

SEE ALSO

+       The Ubiquitous B-tree, Douglas Comer,  ACM  Comput.  Surv.
+       11, 2 (June 1979), 121-138.
+
+       Prefix  B-trees,  Bayer and Unterauer, ACM Transactions on
+       Database Systems, Vol. 2, 1 (March 1977), 11-26.
+
+       The Art  of  Computer  Programming  Vol.  3:  Sorting  and
+       Searching, D.E. Knuth, 1968, pp 471-480.
+
+       Dynamic Hash Tables, Per-Ake Larson, Communications of the
+       ACM, April 1988.
+
+       A  New  Hash  Package  for  UNIX,  Margo  Seltzer,  USENIX
+       Proceedings, Winter 1991.
+
+       Document  Processing  in  a  Relational  Database  System,
+       Michael  Stonebraker,  Heidi  Stettner,   Joseph   Kalash,
+       Antonin  Guttman,  Nadene  Lynn,  Memorandum  No.  UCB/ERL
+       M82/32, May 1982.
+
+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), DbMpoolFile(3), Dbt(3), DbTxn(3),
+       DbTxnMgr(3)
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/Db.j.html b/mozilla/db/man/man.html/Db.j.html new file mode 100644 index 00000000000..2bdf7df3314 --- /dev/null +++ b/mozilla/db/man/man.html/Db.j.html @@ -0,0 +1,723 @@ + + +Db + + +

Db

+
+
+
+       import com.sleepycat.db.*;
+
+       public static Db open(
+            String fname, int type,
+            int flags, int mode, DbEnv dbenv, DbInfo dbinfo)
+       throws DbException;
+
+       public int get_type();
+
+       public void close(int flags)
+            throws DbException;
+
+       public Dbc cursor(DbTxn txnid)
+            throws DbException;
+
+       public void del(Dbt key, DbTxn txnid)
+            throws DbException;
+
+       public int fd()
+            throws DbException;
+
+       public int get(DbTxn txnid, Dbt key, Dbt data, int flags)
+            throws DbException;
+
+       public void put(DbTxn txnid, Dbt key, Dbt data, int flags)
+            throws DbException;
+
+       public void sync(int flags)
+            throws DbException;
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the  Db  class,  which  is  the
+       center of access activity.
+
+       The currently supported file formats are btree, hashed and
+       recno.  The btree format is a representation of a  sorted,
+       balanced   tree   structure.   The  hashed  format  is  an
+       extensible, dynamic  hashing  scheme.   The  recno  format
+       supports  fixed  or  variable  length  records (optionally
+       retrieved from a flat text file).
+
+       Storage and retrieval for the Db access methods are  based
+       on  key/data  pairs,  using the Dbt class.  See Dbt(3) for
+       specific information on the structure and capabilities  of
+       a Dbt.
+
+       The  Db.open method opens the database represented by file
+       for both reading and writing.  Files never intended to  be
+       shared  or preserved on disk may be created by setting the
+       file parameter to null.
+
+       The Db.open method returns a Db object.   The  methods  of
+       this object allow you to perform various database actions,
+       as  described  below.   The  Db.open   method   throws   a
+       DbException(3) that encapsulates an errno on failure.
+
+       Note,  while  most  of  the access methods use file as the
+       name  of  an  underlying  file  on  disk,  this   is   not
+       guaranteed.    Also,   calling  Db.open  is  a  reasonably
+       expensive operation.  (This is based on a model where  the
+       DBMS keeps a set of files open for a long time rather than
+       opening and closing them on each query.)
+
+       The type argument is of type int and must be set to one of
+       Db.DB_BTREE, Db.DB_HASH, Db.DB_RECNO or Db.DB_UNKNOWN.  If
+       type is DB_UNKNOWN, the database must  already  exist  and
+       Db.open  will  then  determine  if it is of type DB_BTREE,
+       DB_HASH or DB_RECNO.
+
+       The flags and mode arguments specify  how  files  will  be
+       opened  and/or created when they don't already exist.  The
+       flags value is specified by or'ing together one or more of
+       the following values:
+
+       Db.DB_CREATE
+            Create  any  underlying  files, as necessary.  If the
+            files do not already exist and the DB_CREATE flag  is
+            not specified, the call will fail.
+
+       Db.DB_NOMMAP
+            Do  not  map  this  file  (see DbMpool(3) for further
+            information).
+
+       Db.DB_RDONLY
+            Open the database for reading only.  Any  attempt  to
+            write the database using the access methods will fail
+            regardless  of  the   actual   permissions   of   any
+            underlying files.
+
+       Db.DB_THREAD
+            Cause the Db handle returned by the Db.open method to
+            be  useable  by  multiple  threads  within  a  single
+            address   space,   i.e.,   to  be  ``free-threaded''.
+            Threading is assumed in the Java API, so  no  special
+            flags  are  required,  and  DB  functions will always
+            behave as if the DB_THREAD flag was specified.
+
+       Db.DB_TRUNCATE
+            ``Truncate'' the database if it exists, i.e.,  behave
+            as  if the database were just created, discarding any
+            previous contents.
+
+       All files created by the access methods are  created  with
+       mode  mode  (as described in chmod(2)) and modified by the
+       process'  umask  value  at  the  time  of  creation   (see
+       umask(2)).   The group ownership of created files is based
+       on the system and directory defaults, and is  not  further
+       specified by DB.
+
+       See  DbEnv(3) for a description of the dbenv argument, and
+       DbInfo(3) for a description of the dbinfo argument.
+
+
+
+

Db OPERATIONS

+       The Db object returned by  Db.open  describes  a  database
+       type,  and  includes a set of functions to perform various
+       actions, as described below.  The methods for  Db  are  as
+       follows:
+
+       int Db.get_type();
+            The  type  of  the underlying access method (and file
+            format).   Returns  one  of  DB_BTREE,   DB_HASH   or
+            DB_RECNO.   This  value  may be used to determine the
+            type of the database after a return from Db.open with
+            the type argument set to DB_UNKNOWN.
+
+       public void Db.close(int flags);
+            A  method  to  flush  any cached information to disk,
+            close  any  open  cursors  (see  Dbc(3)),  free   any
+            allocated  resources, and close any underlying files.
+            Since key/data pairs are cached in memory, failing to
+            sync  the  file  with  the  close  or sync method may
+            result in inconsistent or lost information.
+
+            The flags parameter must be set to 0 or the following
+            value:
+
+            Db.DB_NOSYNC
+                 Do not flush cached information to disk.
+
+            The  DB_NOSYNC flag is a dangerous option.  It should
+            only be set 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.
+
+            It is important to understand  that  flushing  cached
+            information  to  disk  only  minimizes  the window of
+            opportunity for corrupted data.  While  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  close,
+            replace  the original database with the updated copy.
+
+            When  multiple  threads  are  using  the  Db   handle
+            concurrently,  only  a  single thread may call the Db
+            handle close method.
+
+            The  close  method  throws  a   DbException(3)   that
+            encapsulates an errno on failure.
+
+       public Dbc Db.cursor(DbTxn txnid);
+            A method to create a cursor.
+
+            A  cursor  is  an  object  used to provide sequential
+            access through a database.
+
+            If the  file  is  being  accessed  under  transaction
+            protection,  the  txnid parameter is a transaction ID
+            returned  from  txn_begin,   otherwise,   null.    If
+            transaction  protection  is  enabled, cursors must be
+            opened  and  closed   within   the   context   of   a
+            transaction,  and  the  txnid parameter specifies the
+            transaction context in which the cursor may be  used.
+            See Dbc(3) for more information.
+
+            The   cursor  method  throws  a  DbException(3)  that
+            encapsulates an errno on failure.
+
+       public void Db.del(DbTxn txnid, Dbt key, int flags);
+            A method to remove key/data pairs from the  database.
+            The  key/data  pair associated with the specified key
+            is discarded from the database.  In the  presence  of
+            duplicate key values, all records associated with the
+            designated key will be discarded.
+
+            If the  file  is  being  accessed  under  transaction
+            protection,  the  txnid parameter is a transaction ID
+            returned from txn_begin, otherwise, null.
+
+            The flags parameter is currently unused, and must  be
+            set to 0.
+
+            The   del   method   throws   a  DbException(3)  that
+            encapsulates an errno on failure, and DB_NOTFOUND  if
+            the specified key did not exist in the file.
+
+       public int Db.fd();
+            A    method    that   returns   a   file   descriptor
+            representative  of  the  underlying  database.   This
+            method  does not fit well into the Java framework and
+            may not appear in subsequent releases.   Applications
+            should use the lock manager where possible.
+
+            The   fd   method   throws   a   DbException(3)  that
+            encapsulates an errno on failure.
+
+       public int Db.get(DbTxn txnid, Dbt key, Dbt data, int
+            flags);
+            A  method  that  is  an interface for keyed retrieval
+            from the database.  The byte array and length of  the
+            data  associated  with the specified key are returned
+            in the object referenced by data.
+
+            In the presence of duplicate  key  values,  get  will
+            return  the  first  data item for the designated key.
+            Duplicates are sorted by insert  order  except  where
+            this  order has been overridden by cursor operations.
+            Retrieval of duplicates requires the  use  of  cursor
+            operations.  See Dbc(3) for details.
+
+            If  the  file  is  being  accessed  under transaction
+            protection, the txnid parameter is a  transaction  ID
+            returned from txn_begin, otherwise, null.
+
+            The flags parameter must be set to 0 or the following
+            value:
+
+            Db.DB_GET_RECNO
+                 Retrieve  a  specific  numbered  record  from  a
+                 database.   Upon  return,  both the key and data
+                 items will have been filled  in,  not  just  the
+                 data  item  as is done for all other uses of the
+                 get method.
+
+                 For DB_GET_RECNO to be specified, the underlying
+                 database must be of type btree, and it must have
+                 been  created  with  the  DB_RECNUM  flag   (see
+                 Db.open(3)).   In  this  case, the data field of
+                 the key must be byte array to a memory  location
+                 large  enough  to  hold  an int, as described in
+                 Dbt(3).
+
+            If the database is a recno database and the requested
+            key  exists,  but was never explicitly created by the
+            application or was  later  deleted,  the  get  method
+            returns DB_KEYEMPTY.  Otherwise, if the requested key
+            isn't  in  the  database,  the  get  method   returns
+            DB_NOTFOUND.   Otherwise,  the  get  method  throws a
+            DbException(3) that encapsulates an errno on failure,
+
+       public int Db.put(DbTxn txnid, Dbt key, Dbt data, int
+            flags);
+            A method to store key/data pairs in the database.  If
+            the database supports duplicates, the put method adds
+            the new data value at the end of the duplicate set.
+
+            If the  file  is  being  accessed  under  transaction
+            protection,  the  txnid parameter is a transaction ID
+            returned from txn_begin, otherwise, null.
+
+            The flags value is specified by or'ing  together  one
+            or more of the following values:
+
+            Db.DB_APPEND
+                 Append  the  key/data  pair  to  the  end of the
+                 database.  For DB_APPEND to  be  specified,  the
+                 underlying  database must be of type recno.  The
+                 record  number  allocated  to  the   record   is
+                 returned in the specified key.
+
+            Db.DB_NOOVERWRITE
+                 Enter the new key/data pair only if the key does
+                 not already appear in the database.
+
+            The default behavior of the put method  is  to  enter
+            the  new  key/data  pair,  replacing  any  previously
+            existing key if duplicates are disallowed, or to  add
+            a duplicate entry if duplicates are allowed.  Even if
+            the designated database allows duplicates, a call  to
+            put with the DB_NOOVERWRITE flag set will fail if the
+            key already exists in the database.
+
+            The  put  method   throws   a   DbException(3)   that
+            encapsulates  an errno on failure, and DB_KEYEXIST if
+            the DB_NOOVERWRITE flag was set and the  key  already
+            exists in the file.
+
+       public void Db.sync(int flags);
+            A method to flush any cached information to disk.  If
+            the database is in memory only, the sync  method  has
+            no effect and will always succeed.
+
+            The  flags parameter is currently unused, and must be
+            set to 0.
+
+            See  the  close  method  description  above   for   a
+            discussion of Db and cached data.
+
+            The   sync   method   throws  a  DbException(3)  that
+            encapsulates an errno on failure.
+
+       public int DbBtreeStat Db.stat(int flags);
+            A method to create a statistical structure  and  fill
+            it with statistics for the database.
+
+            In  the  presence  of  multiple  threads or processes
+            accessing   an   active   database,   the    returned
+            information may be out-of-date.
+
+            This  method  may  access  all  of  the  pages in the
+            database,  and   therefore   may   incur   a   severe
+            performance penalty and have obvious negative effects
+            on the underlying buffer pool.
+
+            The flags parameter must be set to 0 or the following
+            value:
+
+            Db.DB_RECORDCOUNT
+                 In  the  case of a btree or recno database, fill
+                 in the bt_nrecs field, but do  not  collect  any
+                 other   information.    This   flag   makes   it
+                 reasonable for applications to request a  record
+                 count   from  a  database  without  incurring  a
+                 performance penalty.
+
+            The  stat  method  throws   a   DbException(3)   that
+            encapsulates an errno on failure.
+
+            In  the  case  of  a  btree  or  recno  database, the
+            statistics   are   returned   in   an   instance   of
+            DbBtreeStat.   The following methods are available on
+            DbBtreeStat:
+
+            int get_bt_magic();
+                 Magic number that identifies the file as a btree
+                 file.
+            int get_bt_version();
+                 The version of the btree file type.
+
+            int get_bt_flags();
+                 Permanent   database  flags,  including  DB_DUP,
+                 DB_FIXEDLEN, DB_RECNUM and DB_RENUMBER.
+            int get_bt_minkey();
+                 The bt_minkey value specified to Db.open(3),  if
+                 any.
+            int get_bt_re_len();
+                 The  re_len  value  specified  to Db.open(3), if
+                 any.
+            int get_bt_re_pad();
+                 The re_pad value  specified  to  Db.open(3),  if
+                 any.
+            int get_bt_pagesize();
+                 Underlying tree page size.
+            int get_bt_levels();
+                 Number of levels in the tree.
+            int get_bt_nrecs();
+                 Number  of  data  items in the tree (since there
+                 may be multiple data items per key, this  number
+                 may not be the same as the number of keys).
+            int get_bt_int_pg();
+                 Number of tree internal pages.
+            int get_bt_leaf_pg();
+                 Number of tree leaf pages.
+            int get_bt_dup_pg();
+                 Number of tree duplicate pages.
+            int get_bt_over_pg();
+                 Number of tree overflow pages.
+            int get_bt_free();
+                 Number of pages on the free list.
+            int get_bt_freed();
+                 Number of pages made available for reuse because
+                 they were emptied.
+            int get_bt_int_pgfree();
+                 Number of bytes free in tree internal pages.
+            int get_bt_leaf_pgfree();
+                 Number of bytes free in tree leaf pages.
+            int get_bt_dup_pgfree();
+                 Number of bytes free in tree duplicate pages.
+            int get_bt_over_pgfree();
+                 Number of bytes free in tree overflow pages.
+            int get_bt_pfxsaved();
+                 Number of bytes saved by prefix compression.
+            int get_bt_split();
+                 Total number of tree page splits (includes  fast
+                 and root splits).
+            int get_bt_rootsplit();
+                 Number of root page splits.
+            int get_bt_fastsplit();
+                 Number  of  fast  splits.   When sorted keys are
+                 added   to   the   database,   the   Db    btree
+                 implementation  will  split  left  or  right  to
+                 increase the page-fill factor.  This number is a
+                 measure  of  how  often  it was possible to make
+                 such a split.
+            int get_bt_added();
+                 Number of keys added.
+            int get_bt_deleted();
+                 Number of keys deleted.
+            int get_bt_get();
+                 Number of keys  retrieved.   (Note,  this  value
+                 will  not  reflect  any  keys retrieved when the
+                 database was open for read-only access, as there
+                 is   no   permanent   location   to   store  the
+                 information in this case.)
+            int get_bt_cache_hit();
+                 Number of hits in tree fast-insert  code.   When
+                 sorted  keys  are  added to the database, the Db
+                 btree implementation will check  the  last  page
+                 where  an  insert  occurred  before doing a full
+                 lookup.  This number is a measure of  how  often
+                 the lookup was successful.
+            int get_bt_cache_miss();
+                 Number  of misses in tree fast-insert code.  See
+                 the description of bt_cache_hit; this number  is
+                 a measure of how often the lookup failed.
+
+
+
+

ENVIRONMENT VARIABLES

+       The  following  environment variables affect the execution
+       of Db.open:
+
+       DB_HOME
+            If the dbenv  argument  to  Db.open  was  initialized
+            using  db_appinit,  the  environment variable DB_HOME
+            may be used as the path of the database home for  the
+            interpretation  of  the  dir  argument to Db.open, as
+            described in db_appinit(3).  Specifically, Db.open is
+            affected   by   the  configuration  string  value  of
+            DB_DATA_DIR.
+
+
+
+

EXAMPLES

+       Applications that create short-lived  databases  that  are
+       discarded  or  recreated  when  the  system  fails and are
+       unconcerned with concurrent access and loss of data due to
+       catastrophic   failure,   may  wish  to  use  the  Db.open
+       functionality without other parts of the Db library.  Such
+       applications  will  only  be  concerned with the Db access
+       methods.  The Db access methods will use the  memory  pool
+       subsystem,  but the application is unlikely to be aware of
+       this.               See              the              file
+       java/src/com/sleepycat/examples/AccessExample.java  in the
+       Db source distribution for a Java language code example of
+       how such an application might use the Db library.
+
+
+
+

ERRORS

+       The Db.open method may fail and throw a DbException(3) for
+       any of the errors  specified  for  the  following  DB  and
+       library functions: Db.sync(3), DbLock.get(3),
+       DbLock.put(3), DbLockTab.id(3), DbLockTab.vec(3),
+       DbLog.db_register(3), DbLog.put(3), DbMpool.close(3),
+       DbMpool.db_register(3), DbMpool.open(3),
+       DbMpoolFile.close(3), DbMpoolFile.get(3),
+       DbMpoolFile.open(3), DbMpoolFile.put(3),
+       DbMpoolFile.set(3), DbMpoolFile.sync(3), calloc(3),
+       close(2), fcntl(2), fflush(3), malloc(3), memcpy(3),
+       memmove(3), memset(3), mmap(2), munmap(2), open(2),
+       read(2), realloc(3), sigfillset(3), sigprocmask(2),
+       stat(2), strcpy(3), strdup(3), strerror(3), strlen(3),
+       time(3), and unlink(2).
+
+       In addition, the Db.open  method  may  fail  and  throw  a
+       DbException(3)  encapsulating  an  errno for the following
+       conditions:
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EINVAL]
+            An invalid flag  value  or  parameter  was  specified
+            (e.g., unknown database type, page size, hash method,
+            recno pad byte,  byte  order)  or  a  flag  value  or
+            parameter  that is incompatible with the current file
+            specification.
+
+            The DB_THREAD flag was specified  and  spinlocks  are
+            not implemented for this architecture.
+
+            There  is  a  mismatch  between the version number of
+            file and the software.
+
+            A  re_source  file  was  specified  with  either  the
+            DB_THREAD  flag  or  a  non-null tx_info field in the
+            DbEnv argument to Db.open.
+
+       [ENOENT]
+            A non-existent re_source file was specified.
+
+       [EPERM]
+            Database corruption  was  detected.   All  subsequent
+            database  calls  (other  than  Db.close)  will return
+            EPERM.
+
+       The Db.close method may fail and  throw  a  DbException(3)
+       for  any  of the errors specified for the following DB and
+       library functions: Db.sync(3), DbLock.get(3),
+       DbLock.put(3), DbLockTab.vec(3), DbLog.db_register(3),
+       DbLog.put(3), DbMpool.close(3), DbMpoolFile.close(3),
+       DbMpoolFile.get(3), DbMpoolFile.put(3),
+       DbMpoolFile.set(3), DbMpoolFile.sync(3), calloc(3),
+       close(2), fflush(3), malloc(3), memcpy(3), memmove(3),
+       memset(3), munmap(2), realloc(3), and strerror(3).
+
+       The Db.cursor method may fail and throw  a  DbException(3)
+       for  any  of the errors specified for the following DB and
+       library functions: calloc(3).
+
+       In addition, the Db.cursor method may  fail  and  throw  a
+       DbException(3)  encapsulating  an  errno for the following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       [EPERM]
+            Database corruption  was  detected.   All  subsequent
+            database  calls  (other  than  Db.close)  will return
+            EPERM.
+
+       The Db.del method may fail and throw a DbException(3)  for
+       any  of  the  errors  specified  for  the following DB and
+       library functions: DbLock.get(3), DbLock.put(3),
+       DbLockTab.id(3), DbLockTab.vec(3), DbLog.put(3),
+       DbMpoolFile.get(3), DbMpoolFile.put(3),
+       DbMpoolFile.set(3), calloc(3), fcntl(2), fflush(3),
+       malloc(3), memcmp(3), memcpy(3), memmove(3), memset(3),
+       realloc(3), and strerror(3).
+
+       In  addition,  the  Db.del  method  may  fail  and throw a
+       DbException(3) encapsulating an errno  for  the  following
+       conditions:
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       [EPERM]
+            Database  corruption  was  detected.   All subsequent
+            database calls  (other  than  Db.close)  will  return
+            EPERM.
+
+       In  addition,  the  Db.fd  method  may  fail  and  throw a
+       DbException(3) encapsulating an errno  for  the  following
+       conditions:
+
+       [ENOENT]
+            The   Db.fd   method  was  called  for  an  in-memory
+            database, or no underlying file has yet been created.
+
+       [EPERM]
+            Database  corruption  was  detected.   All subsequent
+            database calls  (other  than  Db.close)  will  return
+            EPERM.
+
+       The  Db.get method may fail and throw a DbException(3) for
+       any of the errors  specified  for  the  following  DB  and
+       library functions: DbLock.get(3), DbLock.put(3),
+       DbLockTab.id(3), DbLockTab.vec(3), DbLog.put(3),
+       DbMpoolFile.get(3), DbMpoolFile.put(3),
+       DbMpoolFile.set(3), Dbc.get(3), calloc(3), fcntl(2),
+       fflush(3), malloc(3), memcmp(3), memcpy(3), memmove(3),
+       memset(3), realloc(3), and strerror(3).
+
+       In addition, the  Db.get  method  may  fail  and  throw  a
+       DbException(3)  encapsulating  an  errno for the following
+       conditions:
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The DB_THREAD flag was specified  to  the  Db.open(3)
+            method    and    neither    the    DB_DBT_MALLOC   or
+            DB_DBT_USERMEM flags were set in the Dbt.
+
+            A record number of 0 was specified.
+
+       [EPERM]
+            Database corruption  was  detected.   All  subsequent
+            database  calls  (other  than  Db.close)  will return
+            EPERM.
+
+       The Db.put method may fail and throw a DbException(3)  for
+       any  of  the  errors  specified  for  the following DB and
+       library functions: DbLock.get(3), DbLock.put(3),
+       DbLockTab.id(3), DbLockTab.vec(3), DbLog.put(3),
+       DbMpoolFile.get(3), DbMpoolFile.put(3),
+       DbMpoolFile.set(3), calloc(3), fcntl(2), fflush(3),
+       malloc(3), memcmp(3), memcpy(3), memmove(3), memset(3),
+       realloc(3), and strerror(3).
+
+       In  addition,  the  Db.put  method  may  fail  and throw a
+       DbException(3) encapsulating an errno  for  the  following
+       conditions:
+
+       [EACCES]
+            An attempt was made to modify a read-only database.
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            A record number of 0 was specified.
+
+            An attempt was made to add a record to a fixed-length
+            database that was too large to fit.
+
+            An attempt was made to do a partial put.
+
+       [EPERM]
+            Database corruption  was  detected.   All  subsequent
+            database  calls  (other  than  Db.close)  will return
+            EPERM.
+
+       [ENOSPC]
+            A btree exceeded the maximum btree depth (255).
+
+       The Db.stat method may fail and throw a DbException(3) for
+       any  of  the  errors  specified  for  the following DB and
+       library functions: DbLock.get(3), DbLock.put(3),
+       DbLockTab.id(3), DbLockTab.vec(3), DbMpoolFile.get(3),
+       DbMpoolFile.put(3), calloc(3), fcntl(2), fflush(3),
+       malloc(3), memcpy(3), and memset(3).
+
+       The Db.sync method may fail and throw a DbException(3) for
+       any of the errors  specified  for  the  following  DB  and
+       library functions: Db.get(3), Db.sync(3), DbLock.get(3),
+       DbLock.put(3), DbLockTab.id(3), DbLockTab.vec(3),
+       DbLog.put(3), DbMpoolFile.get(3), DbMpoolFile.put(3),
+       DbMpoolFile.set(3), DbMpoolFile.sync(3), calloc(3),
+       close(2), fcntl(2), fflush(3), malloc(3), memcpy(3),
+       memmove(3), memset(3), munmap(2), open(2), realloc(3),
+       strerror(3), unlink(2), and write(2).
+
+       In  addition,  the  Db.sync  method  may  fail and throw a
+       DbException(3) encapsulating an errno  for  the  following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       [EPERM]
+            Database  corruption  was  detected.   All subsequent
+            database calls  (other  than  Db.close)  will  return
+            EPERM.
+
+
+
+

SEE ALSO

+       The  Ubiquitous  B-tree,  Douglas Comer, ACM Comput. Surv.
+       11, 2 (June 1979), 121-138.
+
+       Prefix B-trees, Bayer and Unterauer, ACM  Transactions  on
+       Database Systems, Vol. 2, 1 (March 1977), 11-26.
+
+       The  Art  of  Computer  Programming  Vol.  3:  Sorting and
+       Searching, D.E. Knuth, 1968, pp 471-480.
+
+       Dynamic Hash Tables, Per-Ake Larson, Communications of the
+       ACM, April 1988.
+
+       A  New  Hash  Package  for  UNIX,  Margo  Seltzer,  USENIX
+       Proceedings, Winter 1991.
+
+       Document  Processing  in  a  Relational  Database  System,
+       Michael   Stonebraker,   Heidi  Stettner,  Joseph  Kalash,
+       Antonin  Guttman,  Nadene  Lynn,  Memorandum  No.  UCB/ERL
+       M82/32, May 1982.
+
+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), Dbt(3), DbTxn(3), DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/DbEnv.html b/mozilla/db/man/man.html/DbEnv.html new file mode 100644 index 00000000000..509a74a5cde --- /dev/null +++ b/mozilla/db/man/man.html/DbEnv.html @@ -0,0 +1,701 @@ + + +DbEnv + + +

DbEnv

+
+
+
+       #include <db_cxx.h>
+
+       DbEnv::DbEnv(const char *db_home, char *const *db_config, u_int32_t flags);
+       DbEnv::DbEnv();
+       DbEnv::~DbEnv();
+
+       int DbEnv::appinit(const char *db_home,
+            char *const *db_config, u_int32_t flags);
+
+       int DbEnv::get_lorder() const;
+       void DbEnv::set_lorder(int);
+
+       typedef void (*db_errcall_fcn)(const char *, char *);
+       db_errcall_fcn DbEnv::get_errcall() const;
+       void DbEnv::set_errcall(db_errcall_fcn);
+
+       FILE DbEnv::*get_errfile() const;
+       void DbEnv::set_errfile(FILE *);
+
+       const char DbEnv::*get_errpfx() const;
+       void DbEnv::set_errpfx(const char *);
+
+       int DbEnv::get_verbose() const;
+       void DbEnv::set_verbose(int);
+
+       char DbEnv::*get_home() const;
+       void DbEnv::set_home(char *);
+
+       char DbEnv::*get_log_dir() const;
+       void DbEnv::set_log_dir(char *);
+
+       char DbEnv::*get_tmp_dir() const;
+       void DbEnv::set_tmp_dir(char *);
+
+       char DbEnv::**get_data_dir() const;
+       void DbEnv::set_data_dir(char **);
+
+       DbLockTab DbEnv::*get_lk_info() const;
+
+       u_int8_t DbEnv::*get_lk_conflicts() const;
+       void DbEnv::set_lk_conflicts(u_int8_t *);
+
+       u_int32_t DbEnv::get_lk_modes() const;
+       void DbEnv::set_lk_modes(u_int32_t);
+
+       u_int32_t DbEnv::get_lk_max() const;
+       void DbEnv::set_lk_max(u_int32_t);
+
+       u_int32_t DbEnv::get_lk_detect() const;
+       void DbEnv::set_lk_detect(u_int32_t);
+
+       DbLog DbEnv::*get_lg_info() const;
+
+       u_int32_t DbEnv::get_lg_max() const;
+       void DbEnv::set_lg_max(u_int32_t);
+
+       DbMpool DbEnv::*get_mp_info() const;
+
+       size_t DbEnv::get_mp_mmapsize() const;
+       void DbEnv::set_mp_mmapsize(size_t);
+
+       size_t DbEnv::get_mp_size() const;
+       void DbEnv::set_mp_size(size_t);
+
+       DbTxnMgr DbEnv::*get_tx_info() const;
+
+       u_int32_t DbEnv::get_tx_max() const;
+       void DbEnv::set_tx_max(u_int32_t);
+
+       typedef int (*tx_recover_fcn)(DB_LOG *, DBT *, DB_LSN *, int, void *);
+       tx_recover_fcn DbEnv::get_tx_recover() const;
+       void DbEnv::set_tx_recover(tx_recover_fcn);
+
+       u_int32_t DbEnv::get_flags() const;
+       void DbEnv::set_flags(u_int32_t);
+
+       enum ErrorModel { Exception, ErrorReturn };
+       void DbEnv::set_error_model(ErrorModel);
+       ErrorModel DbEnv::get_error_model() const;
+
+       class ostream* DbEnv::get_error_stream() const;
+       void DbEnv::set_error_stream(class ostream*);
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       The DbEnv class provides simple access  to  an  underlying
+       data  structure, whose elements can be examined or changed
+       using the set_ or get_  methods.   The  remainder  of  the
+       manual  page  sometimes refers to these accesses using the
+       underlying name, e.g., simply lorder instead of get_lorder
+       and  set_lorder.  The constructors set all elements of the
+       underlying structure to zero.  The constructor with  three
+       arguments   has   the  effect  of  calling  DbEnv::appinit
+       immediately to initialize  the  application  with  default
+       parameters.   To delay the initialization, use the default
+       constructor.  The various set_ methods can then be used to
+       initialize   the   DbEnv,   and   finally,   a   call   to
+       DbEnv::appinit should be made to initialize DB.
+       Once the DB environment has been initialized by a call  to
+       DbEnv::appinit,  no  set  methods  other  than  set_errpfx
+       should be called.
+
+  appinit
+       The appinit method provides a simple way to initialize and
+       configure the Db environment.  It is not necessary that it
+       be  called,  but  it  provides  a  method  of  creating  a
+       consistent  environment for processes using one or more of
+       the features of Db.
+
+       The  db_home  and  db_config  arguments  to  appinit   are
+       described in the section below entitled ``FILE NAMING''.
+
+       The  flags  argument  specifies  the  subsystems  that are
+       initialized  and  how  the  environment  affects  Db  file
+       naming,  among other things.  The flags value is specified
+       by or'ing together one or more of the following values:
+
+       DB_CREATE
+            Cause subsystems to create any underlying  files,  as
+            necessary.    (See   Db(3),  DbLockTab(3),  DbLog(3),
+            DbMpool(3) and DbTxnMgr(3) for more information.)
+
+       DB_INIT_LOCK
+            Initialize  the  lock  subsystem;  see  DbLockTab(3).
+            This subsystem should be used when multiple processes
+            or threads are going to be reading and writing  a  Db
+            database,  so  that  they  do not interfere with each
+            other.  If all threads are accessing the  database(s)
+            read-only,  then  locking  is  unnecessary.  When the
+            DB_INIT_LOCK  flag  is  specified,  it   is   usually
+            necessary    to    run    the    deadlock   detector,
+            db_deadlock(1), as well.
+
+       DB_INIT_LOG
+            Initialize the log  subsystem;  see  DbLog(3).   This
+            subsystem  is  used when recovery from application or
+            system failure is important.
+
+       DB_INIT_MPOOL
+            Initialize the mpool subsystem; see DbMpool(3).  This
+            subsystem  is  used whenever the application is using
+            the Db access methods for any purpose.
+
+       DB_INIT_TXN
+            Initialize the transaction subsystem;  see  DbTxn(3).
+            This  subsystem  is  used  when atomicity of multiple
+            operations   and   recovery   are   important.    The
+            DB_INIT_TXN flag implies the DB_INIT_LOG flag.
+
+       DB_MPOOL_PRIVATE
+            Create  a  private  memory  pool  (see DbMpool(3) for
+            further information).  Ignored  unless  DB_INIT_MPOOL
+            is also specified.
+
+       DB_NOMMAP
+            Do  not  map  any  files within this environment (see
+            DbMpool(3) for further information).  Ignored  unless
+            DB_INIT_MPOOL is also specified.
+
+       DB_RECOVER
+            Run   normal  recovery  on  this  environment  before
+            opening it for normal use.  If this flag is set,  the
+            DB_CREATE  flag  must  also  be set since the regions
+            will be removed and recreated.
+
+            The DbEnv::appinit function returns  successfully  if
+            DB_RECOVER is specified and no log files exist, so it
+            is necessary to ensure all necessary  log  files  are
+            present   before   running   recovery.   For  further
+            information, consult the man page  for  db_archive(1)
+            and db_recover(1).
+
+       DB_RECOVER_FATAL
+            Run  catastrophic recovery on this environment before
+            opening it for normal use.  If this flag is set,  the
+            DB_CREATE  flag  must  also  be set since the regions
+            will be removed and recreated.
+
+            The DbEnv::appinit function returns  successfully  if
+            DB_RECOVER is specified and no log files exist, so it
+            is necessary to ensure all necessary  log  files  are
+            present   before   running   recovery.   For  further
+            information, consult the man page  for  db_archive(1)
+            and db_recover(1).
+
+       DB_THREAD
+            Ensure that handles returned by the Db subsystems are
+            useable by multiple threads within a single  process,
+            i.e.,  that  the  system  is ``free-threaded''.  (See
+            DbLockTab(3), DbLog(3), DbMpool(3),  Db::open(3)  and
+            DbTxn(3) for more information.)
+
+       DB_TXN_NOSYNC
+            On transaction commit, do not synchronously flush the
+            log (see DbTxn(3) for further information).   Ignored
+            unless DB_INIT_TXN is also specified.
+
+       DB_USE_ENVIRON
+            The  Db  process'  environment  may  be  permitted to
+            specify information to be used when naming files (see
+            the  section  entitled  ``FILE  NAMING''  below).  As
+            permitting users to specify which files are used  can
+            create  security  problems,  environment  information
+            will be used in file naming for all users only if the
+            DB_USE_ENVIRON flag is set.
+
+       DB_USE_ENVIRON_ROOT
+            The  Db  process'  environment  may  be  permitted to
+            specify information to be used when naming files (see
+            the  section  entitled  ``FILE  NAMING''  below).  As
+            permitting users to specify which files are used  can
+            create  security problems, if the DB_USE_ENVIRON_ROOT
+            flag is set, environment information will be used for
+            file  naming  only  for users with a user-ID matching
+            that of the superuser (specifically, users  for  whom
+            the getuid system call returns the user-ID 0).
+
+       The  Db  environment  is  configured  based  on  which set
+       methods have been used.  It is expected that  applications
+       will  use  a single DbEnv object as the argument to all of
+       the subsystems in the DB package.  The fields of the DbEnv
+       object used by appinit are described below.  As references
+       to the DbEnv object may be maintained by  appinit,  it  is
+       necessary  that  the DbEnv object and memory it references
+       be  valid  until  the  object  is  destroyed.   The  dbenv
+       argument  may  not  be  NULL.  If any of the fields of the
+       dbenv are set to 0, defaults appropriate  for  the  system
+       are used where possible.
+
+       The   following   fields   in  the  DbEnv  object  may  be
+       initialized, using  the  appropriate  set  method,  before
+       calling appinit:
+
+       void (*db_errcall)(char *db_errpfx, char *buffer);
+            When  an  error  occurs  in  the DB package, an errno
+            value is returned by  the  method.   In  some  cases,
+            however,  the  errno  value  may  be  insufficient to
+            completely describe the cause of the error.
+
+            If db_errcall is non-NULL,  it  may  be  called  with
+            additional error information.  The db_errpfx argument
+            is the current environment's  db_errpfx  field.   The
+            buffer argument contains a nul-terminated string with
+            the additional information.
+
+            This error logging facility should  not  be  required
+            for  normal operation, but may be useful in debugging
+            applications.
+
+       FILE *db_errfile;
+            The  db_errfile  field  behaves  similarly   to   the
+            db_errcall  field,  except  that the error message is
+            written to the file stream represented by db_errfile.
+
+            If   db_errpfx  is  non-NULL,  the  message  will  be
+            preceded by the string  referenced  by  db_errpfx,  a
+            colon  (``:'')  and  a  space.   The  message will be
+            followed by a newline character.
+
+       const char *db_errpfx;
+            A prefix to prepend to error  messages.   Because  Db
+            does  not copy the memory referenced by the db_errpfx
+            field, the application may modify the  error  message
+            prefix at any time.
+
+       ostream* error_stream;
+            The  error_stream  functions  like  the  error  file,
+            allowing errors to  be  redirected  to  a  C++  error
+            stream.   It  is unwise to use both error_stream with
+            nonzero values of either errcall or errfile.
+
+       int db_verbose;
+            Include informational and debugging messages as  well
+            as  error  messages  in the db_errcall and db_errfile
+            output.
+
+       Each  of  the  open  functions  that  appinit   may   call
+       (DbLockTab::open,     DbLog::open,    DbMpool::open    and
+       DbTxnMgr::open) is called as follows, where the  DB_CREATE
+       flag is optional:
+
+            XXX::open(NULL, DB_CREATE,
+               S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, dbenv)
+
+       This call will cause each subsystem to construct pathnames
+       as described in  the  section  on  ``FILE  NAMING''.   The
+       subsystem  has  permission  to  read  and write underlying
+       files as necessary, and optionally to create files.   (All
+       created  files  will  be created readable and writeable by
+       the owner and the group.  The group ownership  of  created
+       files  is  based on the system and directory defaults, and
+       is not further specified by Db.)
+
+       In addition, the dbenv argument  is  passed  to  the  open
+       functions  of  any subsystems initialized by appinit.  For
+       this reason the fields of the DbEnv object relevant to the
+       subsystems    being   initialized   must   themselves   be
+       initialized before appinit is called.  See the manual page
+       for  each  subsystem  for a list of these fields and their
+       uses.
+
+       The return value from each of these calls is placed in the
+       appropriate field of the DbEnv object:
+
+       DbLockTab *lk_info;
+             The return value of the DbLockTab::open(3) call.
+
+       DbLog *lg_info;
+             The return value of the DbLog::open(3) call.
+
+       DbMpool *mp_info;
+             The return value of the DbMpool::open(3) call.
+
+       DbTxnMgr *tx_info;
+             The return value of the DbTxnMgr::open(3) call.
+
+       In   general,  these  fields  are  not  directly  used  by
+       applications; subsystems of Db that use these fields  will
+       simply  reference  them using the DbEnv argument passed to
+       the subsystem.
+
+       For example, an  application  using  the  Db  hash  access
+       method  functions  to  access  a  database will first call
+       Db::open passing it the DbEnv argument filled  in  by  the
+       initial  call  to  appinit.  Then, all future calls to the
+       hash  access  method  functions  for  that  database  will
+       automatically use the underlying shared memory buffer pool
+       that was specified by the  mp_info  field  of  that  DbEnv
+       argument.
+
+       The  single  exception  to this rule is the tx_info field,
+       which  applications  must  explicitly   specify   to   the
+       DbTxnMgr::begin,  DbTxnMgr::checkpoint and DbTxnMgr::close
+       functions.
+
+       The  error_model  field  of  DbEnv  allows  the  user   to
+       configure  the  way  errors  are treated in DB.  It can be
+       changed  at  any   time   (e.g.,   after   the   call   to
+       DbEnv::appinit).    The   error   model  is  described  in
+       DbException(3).
+
+
+
+

FILE NAMING

+       The most important task of appinit is  to  structure  file
+       naming within Db.
+
+       Each  of the locking, logging, memory pool and transaction
+       subsystems of Db require shared memory regions, backed  by
+       the  filesystem.   Further,  cooperating  applications (or
+       multiple invocations of the same application)  must  agree
+       on  the  location  of  the shared memory regions and other
+       files used by the Db subsystems, the log files used by the
+       logging subsystem, and, of course, the data files.
+
+       Although  it  is possible to specify full pathnames to all
+       Db  functions,  this  is  cumbersome  and  requires   that
+       applications  be recompiled when database files are moved.
+       The appinit method makes it  possible  to  place  database
+       files  in  a single directory, or in multiple directories,
+       grouped by their method within the database.
+
+       Applications are normally expected  to  specify  a  single
+       directory  home  for  their  database.   This  can be done
+       easily in the call to appinit by specifying  a  value  for
+       the    db_home   argument.    There   are   more   complex
+       configurations where  it  may  be  desirable  to  override
+       db_home or provide supplementary path information.
+
+       The  following  describes  the possible ways in which file
+       naming information may be specified  to  the  Db  library.
+       The  specific  circumstances and order in which these ways
+       are applied are described in a subsequent paragraph.
+
+       db_home
+            If the db_home argument to appinit is  non-NULL,  its
+            value  may  be  used  as the database home, and files
+            named relative to its path.
+
+       DB_HOME
+            If the  DB_HOME  environment  variable  is  set  when
+            appinit  is  called,  its  value  may  be used as the
+            database home, and files named relative to its  path.
+
+       db_config
+            The  db_config  argument  to  appinit  may be used to
+            specify an array of character strings of  the  format
+            ``NAME  VALUE'',  that  specify file name information
+            for the  process'  Db  environment.   The  whitespace
+            delimiting  the  two parts of the entry may be one or
+            more  <space>  or  <tab>  characters.   (Leading   or
+            trailing <space> and <tab> characters are discarded.)
+            Each entry must specify both the NAME and  the  VALUE
+            of  the  pair.   All  entries  with unrecognized NAME
+            values will be ignored.  The db_config array must  be
+            NULL terminated.
+
+       DB_CONFIG
+            The  same  information  specified  to  the  db_config
+            argument  to  appinit  may  be  specified   using   a
+            configuration file.  If a database home directory has
+            been specified (either by the application  specifying
+            a  non-NULL  db_home  argument  to appinit, or by the
+            application    setting    the    DB_USE_ENVIRON    or
+            DB_USE_ENVIRON_ROOT flags and the DB_HOME environment
+            variable being set), any file named ``DB_CONFIG''  in
+            the database home directory will be read for lines of
+            the format ``NAME VALUE''.  The whitespace delimiting
+            the  two parts of the line may be one or more <space>
+            or <tab> characters.  (Leading  or  trailing  <space>
+            and <tab> characters are discarded.)  All empty lines
+            or lines whose first non-whitespace  character  is  a
+            hash  character  (``#'')  will be ignored.  Each line
+            must specify both the NAME and the VALUE of the pair.
+            All  lines  with  unrecognized  NAME  values  will be
+            ignored.
+
+       The  following  ``NAME  VALUE''  pairs  in  the  db_config
+       argument and the DB_CONFIG file are currently supported by
+       Db.
+
+       DB_DATA_DIR
+            The path of a directory to be used as the location of
+            the  access  method data files, e.g., paths specified
+            to the Db::open(3) method will be  relative  to  this
+            path.
+
+            The  DB_DATA_DIR  paths  are additive, and specifying
+            more than one will result in each specified directory
+            being  searched for database data files.  If multiple
+            paths are specified, created data files  will  always
+            be created in the first directory specified.
+
+       DB_LOG_DIR
+            The path of a directory to be used as the location of
+            logging files, e.g., files created  by  the  DbLog(3)
+            subsystem  will  be  relative  to this directory.  If
+            specified, this is the directory name  that  will  be
+            passed to DbLog::open(3).
+
+       DB_TMP_DIR
+            The path of a directory to be used as the location of
+            temporary files, e.g.,  files  created  to  back  in-
+            memory   access  method  databases  will  be  created
+            relative to this path.  Note, these  temporary  files
+            can potentially be quite large, depending on the size
+            of the database.
+
+            If  DB_TMP_DIR  is  not  specified,   the   following
+            environment   variables   are   checked   in   order:
+            ``TMPDIR'', ``TEMP'', ``TMP'' and ``TempFolder''.  If
+            one  of  them  is  set,  temporary  files are created
+            relative to the directory it specifies.
+
+            If DB_TMP_DIR is not specified and none of the  above
+            environment variables are set, the first possible one
+            of  the  following  directories  is  used:  /var/tmp,
+            /usr/tmp, /temp, /tmp, C:/temp and C:/tmp.
+
+       The  following  describes  the  specific circumstances and
+       order in which  the  different  ways  of  specifying  file
+       naming  information  are  applied.   Specifically, Db file
+       name  processing   proceeds   sequentially   through   the
+       following steps:
+
+       ``/''
+            If  any  file  name specified to any Db method begins
+            with a leading slash, that file name is used  without
+            modification by Db.
+
+       DB_CONFIG
+            If    a    relevant   configuration   string   (e.g.,
+            DB_DATA_DIR),   is   specified   in   the   DB_CONFIG
+            configuration file, the VALUE from the ``NAME VALUE''
+            pair is prepended to the current file name.   If  the
+            resulting  file name begins with a leading slash, the
+            file name is used without further modification by Db.
+
+            The  DB_CONFIG  configuration  file  is  intended  to
+            permit systems  to  customize  file  location  for  a
+            database   independent  of  applications  using  that
+            database.  For example, a database administrator  can
+            move  the  database log and data files to a different
+            location without application recompilation.
+
+       db_config
+            If   a   relevant   configuration    string    (e.g.,
+            DB_DATA_DIR),  is specified in the db_config argument
+            and is not specified in the DB_CONFIG file, the VALUE
+            from  the  ``NAME  VALUE''  pair  is prepended to the
+            current file name.  If the resulting file name begins
+            with  a  leading slash, the file name is used without
+            further modification by Db.
+
+            The  db_config  argument  is   intended   to   permit
+            applications   to   customize  file  location  for  a
+            database.  For example,  an  application  writer  can
+            place   data   files   and  log  files  in  different
+            directories, or instantiate a new log directory  each
+            time the application runs.
+
+       DB_HOME
+            If the DB_HOME environment variable was set, (and the
+            application has set the appropriate DB_USE_ENVIRON or
+            DB_USE_ENVIRON_ROOT  environment variable), its value
+            is prepended  to  the  current  file  name.   If  the
+            resulting  file name begins with a leading slash, the
+            file name is used without further modification by Db.
+
+            The  DB_HOME  environment  variable  is  intended  to
+            permit users and system  administrators  to  override
+            application and installation defaults, e.g.,
+
+                 env DB_HOME=/database/my_home application
+
+            Alternatively,  application writers are encouraged to
+            support the -h option  found  in  the  supporting  Db
+            utilities to let users specify a database home.
+
+       db_home
+            If  the  application  specified  a  non-NULL  db_home
+            argument to appinit (and the database  home  was  not
+            already   specified  using  the  DB_HOME  environment
+            variable) its value is prepended to the current  file
+            name.   If  the  resulting  file  name  begins with a
+            leading slash, the file name is used without  further
+            modification by Db.
+
+       (nothing)
+            Finally,  all  file names are interpreted relative to
+            the current working directory of the process.
+
+       The common model for a Db environment is  one  where  only
+       the DB_HOME environment variable, or the db_home argument,
+       is specified.  In  this  case,  all  data  files  will  be
+       presumed  to  be relative to that directory, and all files
+       created by the Db  subsystems  will  be  created  in  that
+       directory.
+
+       The more complex model for a transaction environment might
+       be one where a database home is  specified,  using  either
+       the  DB_HOME  environment variable or the db_home argument
+       to appinit, and then DB_DATA_DIR and DB_LOG_DIR are set to
+       the relative path names of directories underneath the home
+       directory using the db_config argument to appinit  or  the
+       DB_CONFIG file.
+
+
+
+

EXAMPLES

+       Store all files in the directory /a/database:
+
+              DbEnv::appinit("/a/database", NULL, ...);
+
+       Create  temporary  backing  files in /b/temporary, and all
+       other files in /a/database:
+
+              char *config[] = {
+                  "DB_TMP_DIR /b/temporary",
+                  NULL
+              };
+
+              DbEnv::appinit("/a/database", config, ...);
+
+       Store data files  in  /a/database/datadir,  log  files  in
+       /a/database/logdir,  and  all other files in the directory
+       /a/database:
+
+              char *config[] = {
+                  "DB_DATA_DIR datadir",
+                  "DB_LOG_DIR logdir",
+                  NULL
+              };
+
+              DbEnv::appinit("/a/database", config, ...);
+
+       Store data files in /a/database/data1  and  /b/data2,  and
+       all  other  files  in the directory /a/database.  Any data
+       files that are created will be created in /b/data2:
+
+              char *config[] = {
+                  "DB_DATA_DIR /b/data2",
+                  "DB_DATA_DIR data1",
+                  NULL
+              };
+
+              DbEnv::appinit("/a/database", config, ...);
+
+       See the file  examples_cxx/AppinitExample.cpp  in  the  Db
+       source distribution for a C++ language code example of how
+       an application might  use  appinit  to  configure  its  Db
+       environment.
+
+
+
+

ERRORS

+       Methods  marked as returning errno will, by default, throw
+       an exception that encapsulates the error information.  The
+       default error behavior can be changed, see DbException(3).
+
+       The appinit method may fail and throw a DbException(3)
+
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: Db::close(3),
+       DbEnv::appexit(3), DbLock::unlink(3), DbLockTab::open(3),
+       DbLog::compare(3), DbLog::get(3), DbLog::open(3),
+       DbLog::unlink(3), DbMpool::open(3), DbMpool::unlink(3),
+       DbTxnMgr::checkpoint(3), DbTxnMgr::open(3),
+       DbTxnMgr::unlink(3), calloc(3), fclose(3), fcntl(2),
+       fflush(3), fgets(3), fopen(3), malloc(3), memcpy(3),
+       memset(3), realloc(3), stat(2), strchr(3), strcmp(3),
+       strcpy(3), strdup(3), strerror(3), strlen(3), strsep(3),
+       and time(3).
+
+       In addition, the appinit  method  may  fail  and  throw  a
+       DbException(3)   or   return   errno   for  the  following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The DB_THREAD flag was specified  and  spinlocks  are
+            not implemented for this architecture.
+
+            The   DB_RECOVER   or   DB_RECOVER_FATAL   flag   was
+            specified, and no log files were found.
+
+            The DB_HOME or TMPDIR environment variables were  set
+            but empty.
+
+            An incorrectly formatted ``NAME VALUE'' entry or line
+            was found.
+
+       [ENOSPC]
+            HP-UX only: a previously created Db  environment  for
+            this process still exists.
+
+       The   DbEnv::appexit   method   may   fail   and  throw  a
+       DbException(3)
+
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: DbLockTab::close(3),
+       DbLog::close(3), DbMpool::close(3), and
+       DbTxnMgr::close(3).
+
+
+
+

BUGS

+       Due to the constraints of the PA-RISC memory architecture,
+       HP-UX does not allow a process to  map  a  file  into  its
+       address  space  multiple  times.  For this reason, each DB
+       environment may be opened only once by a process on HP-UX,
+       i.e.,  calls  to  appinit  will  fail  if the specified Db
+       environment has been opened and not subsequently   closed.
+
+       On Windows/95, files that are opened by multiple processes
+       do not share data correctly.  To tell Berkeley DB  to  use
+       the  paging  file to share memory among processes, use the
+       DB_REGION_NAME  flag   of   the   db_value_set   function.
+       Obviously,  you  do  not  need to do this if only a single
+       process will be accessing database files.
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), DbMpoolFile(3), Dbt(3), DbTxn(3),
+       DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/DbEnv.j.html b/mozilla/db/man/man.html/DbEnv.j.html new file mode 100644 index 00000000000..b55be4c1f81 --- /dev/null +++ b/mozilla/db/man/man.html/DbEnv.j.html @@ -0,0 +1,679 @@ + + +DbEnv + + +

DbEnv

+
+
+
+       import com.sleepycat.db.*;
+
+       public DbEnv(String homeDir, String[] db_config, int flags)
+            throws DbException;
+
+       public DbEnv();
+
+       public void appinit(String homeDir, String[] db_config, int flags)
+            throws DbException;
+
+       public void appexit()
+            throws DbException;
+
+       public int get_lorder();
+       public void set_lorder(int lorder);
+
+       public DbErrcall get_errcall();
+       public void set_errcall(DbErrcall errcall);
+
+       public String get_errpfx();
+       public void set_errpfx(String errpfx);
+
+       public int get_verbose();
+       public void set_verbose(int verbose);
+
+       public String get_home();
+       public void set_home(String home);
+
+       public String get_log_dir();
+       public void set_log_dir(String log_dir);
+
+       public String get_tmp_dir();
+       public void set_tmp_dir(String tmp_dir);
+
+       public DbLockTab get_lk_info();
+
+       public byte[][] get_lk_conflicts();
+       public void set_lk_conflicts(byte[][] lk_conflicts);
+
+       public int get_lk_modes();
+       public void set_lk_modes(int lk_modes);
+
+       public int get_lk_max();
+       public void set_lk_max(int lk_max);
+
+       public int get_lk_detect();
+       public void set_lk_detect(int lk_detect);
+
+       public DbLog get_lg_info();
+
+       public int get_lg_max();
+       public void set_lg_max(int lg_max);
+
+       public DbMpool get_mp_info();
+       public long get_mp_mmapsize();
+       public void set_mp_mmapsize(long mmapsize);
+
+       public long get_mp_size();
+       public void set_mp_size(long mp_size);
+
+       public DbTxnMgr get_tx_info();
+
+       public int get_tx_max();
+       public void set_tx_max(int tx_max);
+
+       public int get_flags();
+       public void set_flags(int flags);
+
+       public static int get_version_major();
+       public static int get_version_minor();
+       public static int get_version_patch();
+       public static String get_version_string();
+       public static String get_java_version_string();
+
+       public void set_error_stream(OutputStream s);
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       The DbEnv class provides simple access  to  an  underlying
+       data  structure, whose elements can be examined or changed
+       using the set_ or get_  methods.   The  remainder  of  the
+       manual  page  sometimes refers to these accesses using the
+       underlying name, e.g., simply lorder instead of get_lorder
+       and  set_lorder.  The constructors set all elements of the
+       underlying structure to zero.  The constructor with  three
+       arguments   has   the   effect  of  calling  DbEnv.appinit
+       immediately to initialize  the  application  with  default
+       parameters.   To delay the initialization, use the default
+       constructor.  The various set_ methods can then be used to
+       initialize the DbEnv, and finally, a call to DbEnv.appinit
+       should be made to initialize DB.
+
+       Once the DB environment has been initialized by a call  to
+       DbEnv.appinit, no set methods other than set_errpfx should
+       be called.
+
+  appinit
+       The appinit method provides a simple way to initialize and
+       configure the Db environment.  It is not necessary that it
+       be  called,  but  it  provides  a  method  of  creating  a
+       consistent  environment for processes using one or more of
+       the features of Db.
+
+       The  db_home  and  db_config  arguments  to  appinit   are
+       described in the section below entitled ``FILE NAMING''.
+
+       The  flags  argument  specifies  the  subsystems  that are
+       initialized  and  how  the  environment  affects  Db  file
+       naming,  among other things.  The flags value is specified
+       by or'ing together one or more of the following values:
+
+       Db.DB_CREATE
+            Cause subsystems to create any underlying  files,  as
+            necessary.    (See   Db(3),  DbLockTab(3),  DbLog(3),
+            DbMpool(3) and DbTxnMgr(3) for more information.)
+
+       Db.DB_INIT_LOCK
+            Initialize  the  lock  subsystem;  see  DbLockTab(3).
+            This subsystem should be used when multiple processes
+            or threads are going to be reading and writing  a  Db
+            database,  so  that  they  do not interfere with each
+            other.  If all threads are accessing the  database(s)
+            read-only,  then  locking  is  unnecessary.  When the
+            DB_INIT_LOCK  flag  is  specified,  it   is   usually
+            necessary    to    run    the    deadlock   detector,
+            db_deadlock(1), as well.
+
+       Db.DB_INIT_LOG
+            Initialize the log  subsystem;  see  DbLog(3).   This
+            subsystem  is  used when recovery from application or
+            system failure is important.
+
+       Db.DB_INIT_MPOOL
+            Initialize the mpool subsystem; see DbMpool(3).  This
+            subsystem  is  used whenever the application is using
+            the Db access methods for any purpose.
+
+       Db.DB_INIT_TXN
+            Initialize the transaction subsystem;  see  DbTxn(3).
+            This  subsystem  is  used  when atomicity of multiple
+            operations   and   recovery   are   important.    The
+            DB_INIT_TXN flag implies the DB_INIT_LOG flag.
+
+       Db.DB_MPOOL_PRIVATE
+            Create  a  private  memory  pool  (see DbMpool(3) for
+            further information).  Ignored  unless  DB_INIT_MPOOL
+            is also specified.
+
+       Db.DB_NOMMAP
+            Do  not  map  any  files within this environment (see
+            DbMpool(3) for further information).  Ignored  unless
+            DB_INIT_MPOOL is also specified.
+
+       Db.DB_RECOVER
+            Run   normal  recovery  on  this  environment  before
+            opening it for normal use.  If this flag is set,  the
+            DB_CREATE  flag  must  also  be set since the regions
+            will be removed and recreated.
+
+            The DbEnv.appinit function  returns  successfully  if
+            DB_RECOVER is specified and no log files exist, so it
+            is necessary to ensure all necessary  log  files  are
+            present   before   running   recovery.   For  further
+            information, consult the man page  for  db_archive(1)
+            and db_recover(1).
+
+       Db.DB_RECOVER_FATAL
+            Run  catastrophic recovery on this environment before
+            opening it for normal use.  If this flag is set,  the
+            DB_CREATE  flag  must  also  be set since the regions
+            will be removed and recreated.
+
+            The DbEnv.appinit function  returns  successfully  if
+            DB_RECOVER is specified and no log files exist, so it
+            is necessary to ensure all necessary  log  files  are
+            present   before   running   recovery.   For  further
+            information, consult the man page  for  db_archive(1)
+            and db_recover(1).
+
+       Db.DB_THREAD
+            Ensure that handles returned by the Db subsystems are
+            useable by multiple threads within a single  process,
+            i.e.,  that  the  system  is ``free-threaded''.  (See
+            DbLockTab(3), DbLog(3),  DbMpool(3),  Db.open(3)  and
+            DbTxn(3) for more information.)
+
+            Threading  is  assumed in the Java API, so no special
+            flags are required,  and  DB  functions  will  always
+            behave as if the DB_THREAD flag was specified.
+
+       Db.DB_TXN_NOSYNC
+            On transaction commit, do not synchronously flush the
+            log (see DbTxn(3) for further information).   Ignored
+            unless DB_INIT_TXN is also specified.
+
+       Db.DB_USE_ENVIRON
+            The  Db  process'  environment  may  be  permitted to
+            specify information to be used when naming files (see
+            the  section  entitled  ``FILE  NAMING''  below).  As
+            permitting users to specify which files are used  can
+            create  security  problems,  environment  information
+            will be used in file naming for all users only if the
+            DB_USE_ENVIRON flag is set.
+
+       Db.DB_USE_ENVIRON_ROOT
+            The  Db  process'  environment  may  be  permitted to
+            specify information to be used when naming files (see
+            the  section  entitled  ``FILE  NAMING''  below).  As
+            permitting users to specify which files are used  can
+            create  security problems, if the DB_USE_ENVIRON_ROOT
+            flag is set, environment information will be used for
+            file  naming  only  for users with a user-ID matching
+            that of the superuser (specifically, users  for  whom
+            the getuid system call returns the user-ID 0).
+
+       The  Db  environment  is  configured  based  on  which set
+       methods have been used.  It is expected that  applications
+       will  use  a single DbEnv object as the argument to all of
+       the subsystems in the DB package.  The fields of the DbEnv
+       object used by appinit are described below.  As references
+       to the DbEnv object may be maintained by  appinit,  it  is
+       necessary  that  the DbEnv object and memory it references
+       be  valid  until  the  object  is  destroyed.   The  dbenv
+       argument  may  not  be  null.  If any of the fields of the
+       dbenv are set to 0, defaults appropriate  for  the  system
+       are used where possible.
+
+       The   following   fields   in  the  DbEnv  object  may  be
+       initialized, using  the  appropriate  set  method,  before
+       calling appinit:
+
+       DbErrcall db_errcall;
+            When  an  error  occurs  in  the DB package, an errno
+            value is returned by  the  method.   In  some  cases,
+            however,  the  errno  value  may  be  insufficient to
+            completely describe the cause of the error.
+
+            If db_errcall is not null,  db_errcall.errcall()  may
+            be  called  with  additional error information.  This
+            method takes two arguments.  The prefix  argument  is
+            the   current  environment's  db_errpfx  field.   The
+            buffer argument  is  a  string  with  the  additional
+            information.
+
+            This  error  logging  facility should not be required
+            for normal operation, but may be useful in  debugging
+            applications.
+
+       String db_errpfx;
+            A  prefix  to  prepend to error messages.  Because Db
+            does not copy the memory referenced by the  db_errpfx
+            field,  the  application may modify the error message
+            prefix at any time.
+
+       java.io.OutputStream error_stream;
+            The  error_stream  field  behaves  similarly  to  the
+            db_errcall  field,  except  that the error message is
+            written   to   the   OutputStream   represented    by
+            error_stream.
+
+            If  db_errpfx  is  not  null,  the  message  will  be
+            preceded by the string  referenced  by  db_errpfx,  a
+            colon  (``:'')  and  a  space.   The  message will be
+            followed by a newline character.
+
+       int db_verbose;
+            Include informational and debugging messages as  well
+            as  error  messages  in the db_errcall and db_errfile
+            output.
+
+       Each  of  the  open  functions  that  appinit   may   call
+       (DbLockTab.open,      DbLog.open,     DbMpool.open     and
+       DbTxnMgr.open) is called as follows, where  the  DB_CREATE
+       flag is optional:
+
+            XXX.open(null, Db.DB_CREATE, 0660, dbenv)
+
+       This call will cause each subsystem to construct pathnames
+       as described in  the  section  on  ``FILE  NAMING''.   The
+       subsystem  has  permission  to  read  and write underlying
+       files as necessary, and optionally to create files.   (All
+       created  files  will  be created readable and writeable by
+       the owner and the group.  The group ownership  of  created
+       files  is  based on the system and directory defaults, and
+       is not further specified by Db.)
+
+       In addition, the dbenv argument  is  passed  to  the  open
+       functions  of  any subsystems initialized by appinit.  For
+       this reason the fields of the DbEnv object relevant to the
+       subsystems    being   initialized   must   themselves   be
+       initialized before appinit is called.  See the manual page
+       for  each  subsystem  for a list of these fields and their
+       uses.
+
+       The return value from each of these calls is placed in the
+       appropriate field of the DbEnv object:
+
+       DbLockTab lk_info;
+             The return value of the DbLockTab.open(3) call.
+
+       DbLog lg_info;
+             The return value of the DbLog.open(3) call.
+
+       DbMpool mp_info;
+             The return value of the DbMpool.open(3) call.
+
+       DbTxnMgr tx_info;
+             The return value of the DbTxnMgr.open(3) call.
+
+       In   general,  these  fields  are  not  directly  used  by
+       applications; subsystems of Db that use these fields  will
+       simply  reference  them using the DbEnv argument passed to
+       the subsystem.
+
+       For example, an  application  using  the  Db  hash  access
+       method  functions  to  access  a  database will first call
+       Db.open passing it the DbEnv argument  filled  in  by  the
+       initial  call  to  appinit.  Then, all future calls to the
+       hash  access  method  functions  for  that  database  will
+       automatically use the underlying shared memory buffer pool
+       that was specified by the  mp_info  field  of  that  DbEnv
+       argument.
+
+       The  single  exception  to this rule is the tx_info field,
+       which  applications  must  explicitly   specify   to   the
+       DbTxnMgr.begin,   DbTxnMgr.checkpoint  and  DbTxnMgr.close
+       functions.
+
+       The  error_model  field  of  DbEnv  allows  the  user   to
+       configure  the  way  errors  are treated in DB.  It can be
+       changed  at  any   time   (e.g.,   after   the   call   to
+       DbEnv.appinit).    The   error   model   is  described  in
+       DbException(3).
+
+
+
+

FILE NAMING

+       The most important task of appinit is  to  structure  file
+       naming within Db.
+
+       Each  of the locking, logging, memory pool and transaction
+       subsystems of Db require shared memory regions, backed  by
+       the  filesystem.   Further,  cooperating  applications (or
+       multiple invocations of the same application)  must  agree
+       on  the  location  of  the shared memory regions and other
+       files used by the Db subsystems, the log files used by the
+       logging subsystem, and, of course, the data files.
+
+       Although  it  is possible to specify full pathnames to all
+       Db  functions,  this  is  cumbersome  and  requires   that
+       applications  be recompiled when database files are moved.
+       The appinit method makes it  possible  to  place  database
+       files  in  a single directory, or in multiple directories,
+       grouped by their method within the database.
+
+       Applications are normally expected  to  specify  a  single
+       directory  home  for  their  database.   This  can be done
+       easily in the call to appinit by specifying  a  value  for
+       the    db_home   argument.    There   are   more   complex
+       configurations where  it  may  be  desirable  to  override
+       db_home or provide supplementary path information.
+
+       The  following  describes  the possible ways in which file
+       naming information may be specified  to  the  Db  library.
+       The  specific  circumstances and order in which these ways
+       are applied are described in a subsequent paragraph.
+
+       db_home
+            If the db_home argument to appinit is  non-null,  its
+            value  may  be  used  as the database home, and files
+            named relative to its path.
+
+       DB_HOME
+            If the  DB_HOME  environment  variable  is  set  when
+            appinit  is  called,  its  value  may  be used as the
+            database home, and files named relative to its  path.
+
+       db_config
+            The  db_config  argument  to  appinit  may be used to
+            specify an array of character strings of  the  format
+            ``NAME  VALUE'',  that  specify file name information
+            for the  process'  Db  environment.   The  whitespace
+            delimiting  the  two parts of the entry may be one or
+            more  <space>  or  <tab>  characters.   (Leading   or
+            trailing <space> and <tab> characters are discarded.)
+            Each entry must specify both the NAME and  the  VALUE
+            of  the  pair.   All  entries  with unrecognized NAME
+            values will be ignored.  The db_config array must  be
+            null terminated.
+
+       DB_CONFIG
+            The  same  information  specified  to  the  db_config
+            argument  to  appinit  may  be  specified   using   a
+            configuration file.  If a database home directory has
+            been specified (either by the application  specifying
+            a  non-null  db_home  argument  to appinit, or by the
+            application    setting    the    DB_USE_ENVIRON    or
+            DB_USE_ENVIRON_ROOT flags and the DB_HOME environment
+            variable being set), any file named ``DB_CONFIG''  in
+            the database home directory will be read for lines of
+            the format ``NAME VALUE''.  The whitespace delimiting
+            the  two parts of the line may be one or more <space>
+            or <tab> characters.  (Leading  or  trailing  <space>
+            and <tab> characters are discarded.)  All empty lines
+            or lines whose first non-whitespace  character  is  a
+            hash  character  (``#'')  will be ignored.  Each line
+            must specify both the NAME and the VALUE of the pair.
+            All  lines  with  unrecognized  NAME  values  will be
+            ignored.
+
+       The  following  ``NAME  VALUE''  pairs  in  the  db_config
+       argument and the DB_CONFIG file are currently supported by
+       Db.
+       DB_DATA_DIR
+            The path of a directory to be used as the location of
+            the  access  method data files, e.g., paths specified
+            to the Db.open(3) method will  be  relative  to  this
+            path.
+
+            The  DB_DATA_DIR  paths  are additive, and specifying
+            more than one will result in each specified directory
+            being  searched for database data files.  If multiple
+            paths are specified, created data files  will  always
+            be created in the first directory specified.
+
+       DB_LOG_DIR
+            The path of a directory to be used as the location of
+            logging files, e.g., files created  by  the  DbLog(3)
+            subsystem  will  be  relative  to this directory.  If
+            specified, this is the directory name  that  will  be
+            passed to DbLog.open(3).
+
+       DB_TMP_DIR
+            The path of a directory to be used as the location of
+            temporary files, e.g.,  files  created  to  back  in-
+            memory   access  method  databases  will  be  created
+            relative to this path.  Note, these  temporary  files
+            can potentially be quite large, depending on the size
+            of the database.
+
+            If  DB_TMP_DIR  is  not  specified,   the   following
+            environment   variables   are   checked   in   order:
+            ``TMPDIR'', ``TEMP'', ``TMP'' and ``TempFolder''.  If
+            one  of  them  is  set,  temporary  files are created
+            relative to the directory it specifies.
+
+            If DB_TMP_DIR is not specified and none of the  above
+            environment variables are set, the first possible one
+            of  the  following  directories  is  used:  /var/tmp,
+            /usr/tmp, /temp, /tmp, C:/temp and C:/tmp.
+
+       The  following  describes  the  specific circumstances and
+       order in which  the  different  ways  of  specifying  file
+       naming  information  are  applied.   Specifically, Db file
+       name  processing   proceeds   sequentially   through   the
+       following steps:
+
+       ``/''
+            If  any  file  name specified to any Db method begins
+            with a leading slash, that file name is used  without
+            modification by Db.
+
+       DB_CONFIG
+            If    a    relevant   configuration   string   (e.g.,
+            DB_DATA_DIR),   is   specified   in   the   DB_CONFIG
+            configuration file, the VALUE from the ``NAME VALUE''
+            pair is prepended to the current file name.   If  the
+            resulting  file name begins with a leading slash, the
+            file name is used without further modification by Db.
+
+            The  DB_CONFIG  configuration  file  is  intended  to
+            permit systems  to  customize  file  location  for  a
+            database   independent  of  applications  using  that
+            database.  For example, a database administrator  can
+            move  the  database log and data files to a different
+            location without application recompilation.
+
+       db_config
+            If   a   relevant   configuration    string    (e.g.,
+            DB_DATA_DIR),  is specified in the db_config argument
+            and is not specified in the DB_CONFIG file, the VALUE
+            from  the  ``NAME  VALUE''  pair  is prepended to the
+            current file name.  If the resulting file name begins
+            with  a  leading slash, the file name is used without
+            further modification by Db.
+
+            The  db_config  argument  is   intended   to   permit
+            applications   to   customize  file  location  for  a
+            database.  For example,  an  application  writer  can
+            place   data   files   and  log  files  in  different
+            directories, or instantiate a new log directory  each
+            time the application runs.
+
+       DB_HOME
+            If the DB_HOME environment variable was set, (and the
+            application has set the appropriate DB_USE_ENVIRON or
+            DB_USE_ENVIRON_ROOT  environment variable), its value
+            is prepended  to  the  current  file  name.   If  the
+            resulting  file name begins with a leading slash, the
+            file name is used without further modification by Db.
+
+            The  DB_HOME  environment  variable  is  intended  to
+            permit users and system  administrators  to  override
+            application and installation defaults, e.g.,
+
+                 env DB_HOME=/database/my_home application
+
+            Alternatively,  application writers are encouraged to
+            support the -h option  found  in  the  supporting  Db
+            utilities to let users specify a database home.
+
+       db_home
+            If  the  application  specified  a  non-null  db_home
+            argument to appinit (and the database  home  was  not
+            already   specified  using  the  DB_HOME  environment
+            variable) its value is prepended to the current  file
+            name.   If  the  resulting  file  name  begins with a
+            leading slash, the file name is used without  further
+            modification by Db.
+
+       (nothing)
+            Finally,  all  file names are interpreted relative to
+            the current working directory of the process.
+
+       The common model for a Db environment is  one  where  only
+       the DB_HOME environment variable, or the db_home argument,
+       is specified.  In  this  case,  all  data  files  will  be
+       presumed  to  be relative to that directory, and all files
+       created by the Db  subsystems  will  be  created  in  that
+       directory.
+
+       The more complex model for a transaction environment might
+       be one where a database home is  specified,  using  either
+       the  DB_HOME  environment variable or the db_home argument
+       to appinit, and then DB_DATA_DIR and DB_LOG_DIR are set to
+       the relative path names of directories underneath the home
+       directory using the db_config argument to appinit  or  the
+       DB_CONFIG file.
+
+
+
+

EXAMPLES

+       Store all files in the directory /a/database:
+
+              DbEnv.appinit("/a/database", null, ...);
+
+       Create  temporary  backing  files in /b/temporary, and all
+       other files in /a/database:
+
+              String[] config = new String[1];
+              config[0] = "DB_TMP_DIR /b/temporary";
+
+              DbEnv.appinit("/a/database", config, ...);
+
+       Store data files  in  /a/database/datadir,  log  files  in
+       /a/database/logdir,  and  all other files in the directory
+       /a/database:
+
+              String[] config = new String[2];
+              config[0] = "DB_DATA_DIR datadir";
+              config[1] = "DB_LOG_DIR logdir",
+
+              DbEnv.appinit("/a/database", config, ...);
+
+       Store data files in /a/database/data1  and  /b/data2,  and
+       all  other  files  in the directory /a/database.  Any data
+       files that are created will be created in /b/data2:
+
+              String[] config = new String[2];
+              config[0] = "DB_DATA_DIR /b/data2";
+              config[1] = "DB_DATA_DIR data1";
+
+              DbEnv.appinit("/a/database", config, ...);
+
+       See                        the                        file
+       java/src/com/sleepycat/examples/AppinitExample.java in the
+       Db source distribution for a Java language code example of
+       how  an  application might use appinit to configure its Db
+       environment.
+
+
+
+

ERRORS

+       The appinit method may fail and throw a DbException(3) for
+       any  of  the  errors  specified  for  the following DB and
+       library functions: Db.close(3), DbEnv.appexit(3),
+       DbLock.unlink(3), DbLockTab.open(3), DbLog.compare(3),
+       DbLog.get(3), DbLog.open(3), DbLog.unlink(3),
+       DbMpool.open(3), DbMpool.unlink(3),
+       DbTxnMgr.checkpoint(3), DbTxnMgr.open(3),
+       DbTxnMgr.unlink(3), calloc(3), fclose(3), fcntl(2),
+       fflush(3), fgets(3), fopen(3), malloc(3), memcpy(3),
+       memset(3), realloc(3), stat(2), strchr(3), strcmp(3),
+       strcpy(3), strdup(3), strerror(3), strlen(3), strsep(3),
+       and time(3).
+
+       In  addition,  the  appinit  method  may  fail and throw a
+       DbException(3) encapsulating an errno  for  the  following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The  DB_THREAD  flag  was specified and spinlocks are
+            not implemented for this architecture.
+
+            The   DB_RECOVER   or   DB_RECOVER_FATAL   flag   was
+            specified, and no log files were found.
+
+            The  DB_HOME or TMPDIR environment variables were set
+            but empty.
+
+            An incorrectly formatted ``NAME VALUE'' entry or line
+            was found.
+
+       [ENOSPC]
+            HP-UX  only:  a previously created Db environment for
+            this process still exists.
+
+       The  DbEnv.appexit   method   may   fail   and   throw   a
+       DbException(3)  for  any  of  the errors specified for the
+       following DB and library functions: DbLockTab.close(3),
+       DbLog.close(3), DbMpool.close(3), and DbTxnMgr.close(3).
+
+
+
+

BUGS

+       Due to the constraints of the PA-RISC memory architecture,
+       HP-UX does not allow a process to  map  a  file  into  its
+       address  space  multiple  times.  For this reason, each DB
+       environment may be opened only once by a process on HP-UX,
+       i.e.,  calls  to  appinit  will  fail  if the specified Db
+       environment has been opened and not subsequently   closed.
+
+       On Windows/95, files that are opened by multiple processes
+       do not share data correctly.  To tell Berkeley DB  to  use
+       the  paging  file to share memory among processes, use the
+       DB_REGION_NAME  flag   of   the   db_value_set   function.
+       Obviously,  you  do  not  need to do this if only a single
+       process will be accessing database files.
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), Dbt(3), DbTxn(3), DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/DbException.html b/mozilla/db/man/man.html/DbException.html new file mode 100644 index 00000000000..fdb376cff48 --- /dev/null +++ b/mozilla/db/man/man.html/DbException.html @@ -0,0 +1,87 @@ + + +DbException + + +

DbException

+
+
+
+       #include <db_cxx.h>
+
+       DbException::DbException(int err);
+       DbException::DbException(const char *description);
+       DbException::DbException(const char *prefix, int err);
+       DbException::DbException(const char *prefix1,
+            const char *prefix2, int err);
+
+       const int
+       DbException::get_errno();
+
+       virtual const char *
+       DbException::what() const;
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the DbException class  and  how
+       it is used by the various Db* classes.
+
+       Most  methods  in  the  Db  classes return an int but also
+       throw an exception.  This allows for two  different  error
+       behaviors,  that  are  known as error models.  By default,
+       the error  model  is  configured  to  throw  an  exception
+       whenever  a  serious  error occurs.  This generally allows
+       for cleaner logic for transaction  processing,  as  a  try
+       block  can  surround a single transaction.  Alternatively,
+       the error model can be set to not  throw  exceptions,  and
+       instead request the individual function to return an error
+       code.   The  error  model  can  be   changed   using   the
+       DbEnv::set_error_model method, see DbEnv(3).
+
+       A  DbException object contains an informational string and
+       an   errno.    The   errno   can   be    obtained    using
+       DbException::get_errno().  The informational string can be
+       obtained using DbException::what().
+
+       We expect in the future that this class will inherit  from
+       the   standard   class  exception,  but  certain  language
+       implementation  bugs  currently  prevent  this   on   some
+       platforms.
+
+       Some methods may return non-zero values without issuing an
+       exception.   This  occurs  in  situations  that  are   not
+       normally  considered an error, but when some informational
+       status  is  returned.   For   example,   Db::get   returns
+       DB_KEYNOTFOUND when a requested key does not appear in the
+       database.
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), DbMpoolFile(3), Dbt(3), DbTxn(3),
+       DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/DbException.j.html b/mozilla/db/man/man.html/DbException.j.html new file mode 100644 index 00000000000..55682d4107d --- /dev/null +++ b/mozilla/db/man/man.html/DbException.j.html @@ -0,0 +1,66 @@ + + +DbException + + +

DbException

+
+
+
+       import com.sleepycat.db.*;
+
+       public class DbException extends Exception;
+
+       public DbException(String s);
+       public DbException(String s, int errno);
+
+       public int get_errno();
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the DbException class  and  how
+       it is used by the various Db* classes.
+
+       Most  methods in the Db classes throw an exception when an
+       error  occurs.    A   DbException   object   contains   an
+       informational  string  and  an  errno.   The  errno can be
+       obtained using DbException.get_errno().  Since DbException
+       inherits  from  the  java.Exception, the string portion is
+       available using toString().
+
+       Some methods may return non-zero values without issuing an
+       exception.    This  occurs  in  situations  that  are  not
+       normally considered an error, but when some  informational
+       status   is   returned.    For   example,  Db.get  returns
+       DB_KEYNOTFOUND when a requested key does not appear in the
+       database.
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), Dbt(3), DbTxn(3), DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/DbInfo.html b/mozilla/db/man/man.html/DbInfo.html new file mode 100644 index 00000000000..7f032ba4d5a --- /dev/null +++ b/mozilla/db/man/man.html/DbInfo.html @@ -0,0 +1,525 @@ + + +DbInfo + + +

DbInfo

+
+
+
+       #include <db_cxx.h>
+
+       DbInfo::DbInfo();
+       DbInfo::~DbInfo();
+       DbInfo::DbInfo(const DbInfo &);
+       DbInfo::DbInfo &operator = (const DbInfo &);
+
+       int DbInfo::get_lorder() const;
+       void DbInfo::set_lorder(int);
+
+       size_t DbInfo::get_cachesize() const;
+       void DbInfo::set_cachesize(size_t);
+
+       size_t DbInfo::get_pagesize() const;
+       void DbInfo::set_pagesize(size_t);
+
+       typedef void *(*db_malloc_fcn)(size_t);
+       DbInfo::db_malloc_fcn DbInfo::get_malloc() const;
+       void DbInfo::set_malloc(db_malloc_fcn);
+
+       u_int32_t DbInfo::get_bt_minkey() const;
+       void DbInfo::set_bt_minkey(u_int32_t);
+
+       typedef int (*bt_compare_fcn)(const DBT *, const DBT *);
+       bt_compare_fcn DbInfo::get_bt_compare() const;
+       void DbInfo::set_bt_compare(bt_compare_fcn);
+
+       typedef size_t (*bt_prefix_fcn)(const DBT *, const DBT *);
+       bt_prefix_fcn DbInfo::get_bt_prefix() const;
+       void DbInfo::set_bt_prefix(bt_prefix_fcn);
+
+       u_int32_t DbInfo::get_h_ffactor() const;
+       void DbInfo::set_h_ffactor(u_int32_t);
+
+       u_int32_t DbInfo::get_h_nelem() const;
+       void DbInfo::set_h_nelem(u_int32_t);
+
+       typedef u_int32_t (*h_hash_fcn)(const void *, u_int32_t);
+       h_hash_fcn DbInfo::get_h_hash() const;
+       void DbInfo::set_h_hash(h_hash_fcn);
+
+       int DbInfo::get_re_pad() const;
+       void DbInfo::set_re_pad(int);
+
+       int DbInfo::get_re_delim() const;
+       void DbInfo::set_re_delim(int);
+
+       u_int32_t DbInfo::get_re_len() const;
+       void DbInfo::set_re_len(u_int32_t);
+
+       char DbInfo::*get_re_source() const;
+       void DbInfo::set_re_source(char *);
+
+       u_int32_t DbInfo::get_flags() const;
+       void DbInfo::set_flags(u_int32_t);
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the  DbInfo  class.   A  DbInfo
+       object  is  used  in  conjunction with the Db::open method
+       (see Db(3)) to specify  particular  configuration  options
+       for  the open.  The DbInfo class provides simple access to
+       an  underlying  data  structure,  whose  elements  can  be
+       examined  or  changed using the set_ or get_ methods.  The
+       remainder of the manual  page  refers  to  these  accesses
+       using  the  underlying  name,  e.g.,  cachesize instead of
+       get_cachesize and set_cachesize.  The default  constructor
+       sets  all  elements  of  the underlying structure to zero.
+       Some of the fields are specific to a type of  file  format
+       (one  of  btree, hashed and recno) and are thus named with
+       an underscore separated string, ``bt'', ``h'' and  ``re'',
+       respectively.   For example, the method set_bt_minkey sets
+       the underlying bt_minkey field, and  this  field  is  only
+       used when opening a btree file.
+
+       The  fields  that  are  common  to  all access methods are
+       listed here; those specific to an individual access method
+       are described below.  No reference to the DbInfo object is
+       maintained by Db, so it is possible to discard it as  soon
+       as the Db::open call returns.
+
+       If  possible, defaults appropriate for the system are used
+       for the DbInfo fields if dbinfo is NULL or any  fields  of
+       the  DbInfo  object are not explicitly set.  The following
+       DbInfo fields may be initialized before calling Db::open:
+
+       size_t cachesize;
+            A suggested maximum size of the memory pool cache, in
+            bytes.   If  cachesize  is  not  explicitly  set,  an
+            appropriate default is  used.   It  is  an  error  to
+            specify   both  the  mp_info  field  and  a  non-zero
+            db_cachesize.
+
+            Note, the minimum number of pages in the cache should
+            be  no less than 10, and the access methods will fail
+            if an insufficiently large cache  is  specified.   In
+            addition,   for   applications  that  exhibit  strong
+            locality in their data  access  patterns,  increasing
+            the  size  of  the  cache  can  significantly improve
+            application performance.
+
+       int lorder;
+            The byte order for integers in  the  stored  database
+            metadata.   The  number should represent the order as
+            an integer, for example,  big  endian  order  is  the
+            number  4,321,  and little endian order is the number
+            1,234.  If lorder is not  explicitly  set,  the  host
+            order  of  the  machine  where  the  Db  library  was
+            compiled is used.
+
+            The value of lorder is ignored except when  databases
+            are being created.  If a database already exists, the
+            byte order it uses is determined  when  the  file  is
+            read.
+
+            The  access  methods  provide no guarantees about the
+            byte ordering of the application data stored  in  the
+            database,   and   applications  are  responsible  for
+            maintaining any necessary ordering.
+
+       size_t pagesize;
+            The size of the pages  used  to  hold  items  in  the
+            database,  in  bytes.   The  minimum page size is 512
+            bytes and the maximum page size  is  64K  bytes.   If
+            pagesize  is  not  explicitly  set,  a  page  size is
+            selected based on the underlying filesystem I/O block
+            size.   The  selected  size  has a lower limit of 512
+            bytes and an upper limit of 16K bytes.
+
+       void *(*malloc)(size_t);
+            The flag DB_DBT_MALLOC, when  specified  in  the  Dbt
+            object,  will cause the Db library to allocate memory
+            which then becomes the responsibility of the  calling
+            application.  See Dbt(3) for more information.
+
+            On  systems  where  there  may  be  multiple  library
+            versions of malloc (notably Windows  NT),  specifying
+            the  DB_DBT_MALLOC  flag  will  fail  because  the Db
+            library will allocate memory from  a  different  heap
+            than  the  application will use to free it.  To avoid
+            this problem, the malloc function should  be  set  to
+            point  to  the  application's allocation routine.  If
+            malloc is not explicitly set,  it  will  be  used  to
+            allocate  the  memory returned when the DB_DBT_MALLOC
+            flag is  set.   The  malloc  method  must  match  the
+            calling conventions of the malloc(3) library routine.
+
+
+
+

BTREE

+       The btree  data  structure  is  a  sorted,  balanced  tree
+       structure  storing  associated  key/data pairs.  Searches,
+       insertions, and deletions in the btree will  all  complete
+       in  O (lg base N) where base is the average number of keys
+       per page.   Often,  inserting  ordered  data  into  btrees
+       results  in pages that are half-full.  This implementation
+       has been modified to make  ordered  (or  inverse  ordered)
+       insertion  the best case, resulting in nearly perfect page
+       space utilization.
+
+       Space freed by deleting key/data pairs from  the  database
+       is  never  reclaimed  from  the filesystem, although it is
+       reused where possible.  This means that the btree  storage
+       structure  is  grow-only.   If  sufficiently many keys are
+       deleted from a tree that shrinking the underlying database
+       file  is desirable, this can be accomplished by creating a
+       new tree from a scan of the existing one.
+
+       The  following  additional  fields  and   flags   may   be
+       initialized  in the DbInfo object before calling Db::open,
+       when using the btree access method:
+
+       int (*bt_compare)(const Dbt *, const Dbt *);
+            The bt_compare function is the key comparison method.
+            It  must  return  an  integer less than, equal to, or
+            greater than  zero  if  the  first  key  argument  is
+            considered to be respectively less than, equal to, or
+            greater than  the  second  key  argument.   The  same
+            comparison  method must be used on a given tree every
+            time it is opened.
+
+            The data and size fields of  the  DBT  are  the  only
+            fields  that  may  be  used  for the purposes of this
+            comparison.
+
+            If  bt_compare  is  NULL,  the  keys   are   compared
+            lexically,  with shorter keys collating before longer
+            keys.
+
+       u_int32_t bt_minkey;
+            The minimum number of keys that will be stored on any
+            single  page.   This value is used to determine which
+            keys will be stored on overflow pages, i.e. if a  key
+            or  data  item is larger than the pagesize divided by
+            the bt_minkey value, it will be  stored  on  overflow
+            pages  instead  of in the page itself.  The bt_minkey
+            value specified must be at least 2; if  bt_minkey  is
+            not explicitly set, a value of 2 is used.
+
+       size_t (*bt_prefix)(const Dbt *, const Dbt *);
+            The  bt_prefix  function  is  the  prefix  comparison
+            method.  If specified, this method  must  return  the
+            number  of  bytes of the second key argument that are
+            necessary to determine that it is  greater  than  the
+            first  key  argument.  If the keys are equal, the key
+            length should be returned.
+
+            The data and size fields of  the  DBT  are  the  only
+            fields  that  may  be  used  for the purposes of this
+            comparison.
+
+            This is used to compress the keys stored on the btree
+            internal  pages.   The  usefulness  of  this  is data
+            dependent,  but  in  some  data  sets   can   produce
+            significantly  reduced  tree  sizes and search times.
+            If bt_prefix is not explicitly set, and no comparison
+            method  is  specified,  a  default lexical comparison
+            method  is  used.   If  bt_prefix  is  NULL   and   a
+            comparison  method is specified, no prefix comparison
+            is done.
+
+       unsigned long flags;
+            The following additional flags may be specified:
+
+            DB_DUP
+                 Permit  duplicate  keys  in   the   tree,   i.e.
+                 insertion  when  the  key  of  the key/data pair
+                 being inserted already exists in the  tree  will
+                 be  successful.   The  ordering of duplicates in
+                 the  tree  is  determined  by   the   order   of
+                 insertion,  unless  the  ordering  is  otherwise
+                 specified by use of a  cursor  (see  Dbc(3)  for
+                 more  information.)   It  is an error to specify
+                 both DB_DUP and DB_RECNUM.
+
+            DB_RECNUM
+                 Support  retrieval  from  btrees  using   record
+                 numbers.    For   more   information,   see  the
+                 DB_GET_RECNO flag to the db->get method (below),
+                 and the cursor Dbc::get method (in Dbc(3)).
+
+                 Logical  record numbers in btrees are mutable in
+                 the face of record insertion or  deletion.   See
+                 the  DB_RENUMBER flag in the RECNO section below
+                 for further discussion.
+
+                 Maintaining  record  counts   within   a   btree
+                 introduces a serious point of contention, namely
+                 the page locations where the record  counts  are
+                 stored.   In  addition,  the entire tree must be
+                 locked during  both  insertions  and  deletions,
+                 effectively  single-threading the tree for those
+                 operations.  Specifying DB_RECNUM can result  in
+                 serious   performance   degradation   for   some
+                 applications and data sets.
+
+                 It is  an  error  to  specify  both  DB_DUP  and
+                 DB_RECNUM.
+
+
+
+

HASH

+       The  hash data structure is an extensible, dynamic hashing
+       scheme.  Backward compatible interfaces to  the  functions
+       described  in dbm(3), ndbm(3) and hsearch(3) are provided,
+       however these interfaces are not compatible with  previous
+       file formats.
+
+       The   following   additional   fields  and  flags  may  be
+       initialized in the DbInfo object before calling  Db::open,
+       when using the hash access method:
+
+       u_int32_t h_ffactor;
+            The  desired density within the hash table.  It is an
+            approximation  of  the  number  of  keys  allowed  to
+            accumulate  in  any  one bucket, determining when the
+            hash table grows or shrinks.  The default value is 0,
+            indicating  that  the  fill  factor  will be selected
+            dynamically as pages are filled.
+
+       u_int32_t (*h_hash)(const void *, u_int32_t);
+            The h_hash field is a user defined  hash  method;  if
+            h_hash is NULL, a default hash method is used.  Since
+            no hash method performs equally well on all  possible
+            data, the user may find that the built-in hash method
+            performs poorly with a  particular  data  set.   User
+            specified  hash  functions  must  take a pointer to a
+            byte string and a length as arguments  and  return  a
+            u_int32_t value.
+
+            If a hash method is specified, hash_open will attempt
+            to determine if the hash method specified is the same
+            as  the  one with which the database was created, and
+            will fail if it detects that it is not.
+
+       u_int32_t h_nelem;
+            An estimate of the final size of the hash table.   If
+            not  set  or  set  too  low,  hash tables will expand
+            gracefully as keys are  entered,  although  a  slight
+            performance  degradation may be noticed.  The default
+            value is 1.
+
+       unsigned long flags;
+            The following additional flags may  be  specified  by
+            or'ing together one or more of the following values:
+
+            DB_DUP
+                 Permit   duplicate   keys   in  the  tree,  i.e.
+                 insertion when the  key  of  the  key/data  pair
+                 being  inserted  already exists in the tree will
+                 be successful.  The ordering  of  duplicates  in
+                 the   tree   is   determined  by  the  order  of
+                 insertion,  unless  the  ordering  is  otherwise
+                 specified  by  use  of  a cursor (see Dbc(3) for
+                 more information.)
+
+
+
+

RECNO

+       The recno access method provides  support  for  fixed  and
+       variable  length records, optionally backed by a flat text
+       (byte  stream)  file.   Both  fixed  and  variable  length
+       records are accessed by their logical record number.
+
+       It is valid to create a record whose record number is more
+       than one greater than the last  record  currently  in  the
+       database.   For  example, the creation of record number 8,
+       when records 6 and 7 do not yet exist, is  not  an  error.
+       However,  any  attempt  to  retrieve  such  records (e.g.,
+       records 6 and 7) will return DB_KEYEMPTY.
+
+       Deleting a record will not, by default,  renumber  records
+       following  the  deleted  record (see DB_RENUMBER below for
+       more  information).   Any  attempt  to  retrieve   deleted
+       records will return DB_KEYEMPTY.
+
+       The   following   additional   fields  and  flags  may  be
+       initialized in the DbInfo object before calling  Db::open,
+       when using the recno access method:
+
+       int re_delim;
+            For variable length records, if the re_source file is
+            specified and  the  DB_DELIMITER  flag  is  set,  the
+            delimiting  byte  used to mark the end of a record in
+            the source file.  If the re_source file is  specified
+            and  the  DB_DELIMITER  flag  is  not  set, <newline>
+            characters (i.e. ``\n'',  0x0a)  are  interpreted  as
+            end-of-record markers.
+
+       u_int32_t re_len;
+            The length of a fixed-length record.
+
+       int re_pad;
+            For  fixed length records, if the DB_PAD flag is set,
+            the pad character for short records.  If  the  DB_PAD
+            flag is not explicitly set, <space> characters (i.e.,
+            0x20) are used for padding.
+
+       char *re_source;
+            The purpose of the re_source field is to provide fast
+            access   and   modification  to  databases  that  are
+            normally stored as flat text files.
+
+            If  the  re_source  field  is  explicitly   set,   it
+            specifies  an underlying flat text database file that
+            is read  to  initialize  a  transient  record  number
+            index.   In  the case of variable length records, the
+            records are separated by  the  byte  value  re_delim.
+            For  example,  standard UNIX byte stream files can be
+            interpreted as a sequence of variable length  records
+            separated by <newline> characters.
+
+            In  addition,  when  cached  data  would  normally be
+            written back to the underlying database  file  (e.g.,
+            the  close  or  sync  functions  are called), the in-
+            memory copy of the database will be written  back  to
+            the re_source file.
+
+            By  default,  the backing source file is read lazily,
+            i.e., records are not read from the file  until  they
+            are   requested  by  the  application.   If  multiple
+            processes  (not  threads)  are  accessing   a   recno
+            database   concurrently   and   either  inserting  or
+            deleting records, the backing  source  file  must  be
+            read  in  its  entirety  before  more  than  a single
+            process accesses the database, and only that  process
+            should specify the backing source file as part of the
+            Db::open call.  See the DB_SNAPSHOT  flag  below  for
+            more information.
+
+            Reading and writing the backing source file specified
+            by  re_source  cannot  be  transactionally  protected
+            because  it  involves  filesystem operations that are
+            not part of the Db transaction methodology.  For this
+            reason,  if  a temporary database is used to hold the
+            records, i.e., a  NULL  was  specified  as  the  file
+            argument  to  Db::open,  it  is  possible to lose the
+            contents of the re_source file, e.g., if  the  system
+            crashes  at  the right instant.  If a file is used to
+            hold the database, i.e., a file name was specified as
+            the   file  argument  to  Db::open,  normal  database
+            recovery  on  that  file  can  be  used  to   prevent
+            information  loss, although it is still possible that
+            the contents of re_source will be lost if the  system
+            crashes.
+
+            The  re_source  file  must  already exist (but may be
+            zero-length) when Db::open is called.
+
+            For all of the above reasons, the re_source field  is
+            generally  used  to  specify databases that are read-
+            only  for  Db  applications,  and  that  are   either
+            generated  on  the fly by software tools, or modified
+            using a different mechanism, e.g., a text editor.
+
+       unsigned long flags;
+            The following additional flags may  be  specified  by
+            or'ing together one or more of the following values:
+
+            DB_DELIMITER
+                 The re_delim field is set.
+
+            DB_FIXEDLEN
+                 The   records   are   fixed-length,   not   byte
+                 delimited.   The  re_len  value  specifies   the
+                 length  of  the  record, and the re_pad value is
+                 used as the pad character.
+
+                 Any records added to the database that are  less
+                 than re_len bytes long are automatically padded.
+                 Any attempt to insert records into the  database
+                 that  are  greater  than  re_len bytes long will
+                 cause the call to fail immediately and return an
+                 error.
+
+            DB_PAD
+                 The re_pad field is set.
+
+            DB_RENUMBER
+                 Specifying   the  DB_RENUMBER  flag  causes  the
+                 logical record numbers to be mutable, and change
+                 as  records  are  added  to and deleted from the
+                 database.  For example, the deletion  of  record
+                 number  4  causes records numbered 5 and greater
+                 to be renumbered downward by 1.  If a cursor was
+                 positioned   to   record  number  4  before  the
+                 deletion,  it  will  reference  the  new  record
+                 number  4,  if any such record exists, after the
+                 deletion.  If  a  cursor  was  positioned  after
+                 record  number 4 before the deletion, it will be
+                 shifted downward 1 logical record, continuing to
+                 reference the same record as it did before.
+
+                 Using  the  Dbc::put or put interfaces to create
+                 new records will cause the creation of  multiple
+                 records  if  the  record number is more than one
+                 greater than the largest record currently in the
+                 database.  For example, creating record 28, when
+                 record 25 was previously the last record in  the
+                 database,  will create records 26 and 27 as well
+                 as 28.  Attempts to retrieve records  that  were
+                 created  in  this manner will result in an error
+                 return of DB_KEYEMPTY.
+
+                 If a created record is not at  the  end  of  the
+                 database,  all  records following the new record
+                 will be automatically renumbered  upward  by  1.
+                 For  example,  the  creation  of  a  new  record
+                 numbered 8 causes records numbered 8 and greater
+                 to  be  renumbered upward by 1.  If a cursor was
+                 positioned to record number 8 or greater  before
+                 the  insertion,  it  will  be  shifted  upward 1
+                 logical record, continuing to reference the same
+                 record as it did before.
+
+                 For  these reasons, concurrent access to a recno
+                 database with the DB_RENUMBER flag specified may
+                 be   largely   meaningless,   although   it   is
+                 supported.
+
+            DB_SNAPSHOT
+                 This flag specifies that any specified re_source
+                 file  be  read  in its entirety when Db::open is
+                 called.  If this  flag  is  not  specified,  the
+                 re_source file may be read lazily.
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), DbMpoolFile(3), Dbt(3), DbTxn(3),
+       DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/DbInfo.j.html b/mozilla/db/man/man.html/DbInfo.j.html new file mode 100644 index 00000000000..5019cf52c39 --- /dev/null +++ b/mozilla/db/man/man.html/DbInfo.j.html @@ -0,0 +1,432 @@ + + +DbInfo + + +

DbInfo

+
+
+
+       import com.sleepycat.db.*;
+
+       public DbInfo();
+       public DbInfo(DbInfo that);
+
+       public int get_lorder();
+       public void set_lorder(int lorder);
+
+       public long get_cachesize();
+       public void set_cachesize(long cachesize);
+
+       public long get_pagesize();
+       public void set_pagesize(long pagesize);
+
+       public int get_bt_minkey();
+       public void set_bt_minkey(int bt_minkey);
+
+       public int get_h_ffactor();
+       public void set_h_ffactor(int h_ffactor);
+
+       public int get_h_nelem();
+       public void set_h_nelem(int h_nelem);
+
+       public int get_re_pad();
+       public void set_re_pad(int re_pad);
+
+       public int get_re_delim();
+       public void set_re_delim(int re_delim);
+
+       public int get_re_len();
+       public void set_re_len(int re_len);
+
+       public String get_re_source();
+       public void set_re_source(String re_source);
+
+       public int get_flags();
+       public void set_flags(int flags);
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the  DbInfo  class.   A  DbInfo
+       object is used in conjunction with the Db.open method (see
+       Db(3)) to specify particular configuration options for the
+       open.   The  DbInfo  class  provides  simple  access to an
+       underlying data structure, whose elements can be  examined
+       or  changed using the set_ or get_ methods.  The remainder
+       of the manual page refers  to  these  accesses  using  the
+       underlying  name, e.g., cachesize instead of get_cachesize
+       and  set_cachesize.   The  default  constructor  sets  all
+       elements of the underlying structure to zero.  Some of the
+       fields are specific to a  type  of  file  format  (one  of
+       btree,  hashed  and  recno)  and  are  thus  named with an
+       underscore separated string,  ``bt'',  ``h''  and  ``re'',
+       respectively.   For example, the method set_bt_minkey sets
+       the underlying bt_minkey field, and  this  field  is  only
+       used when opening a btree file.
+
+       The  fields  that  are  common  to  all access methods are
+       listed here; those specific to an individual access method
+       are described below.
+
+       If  possible, defaults appropriate for the system are used
+       for the DbInfo fields if dbinfo is null or any  fields  of
+       the  DbInfo  object are not explicitly set.  The following
+       DbInfo fields may be initialized before calling Db.open:
+
+       long cachesize;
+            A suggested maximum size of the memory pool cache, in
+            bytes.   If  cachesize  is  not  explicitly  set,  an
+            appropriate default is  used.   It  is  an  error  to
+            specify   both  the  mp_info  field  and  a  non-zero
+            db_cachesize.
+
+            Note, the minimum number of pages in the cache should
+            be  no less than 10, and the access methods will fail
+            if an insufficiently large cache  is  specified.   In
+            addition,   for   applications  that  exhibit  strong
+            locality in their data  access  patterns,  increasing
+            the  size  of  the  cache  can  significantly improve
+            application performance.
+
+       int lorder;
+            The byte order for integers in  the  stored  database
+            metadata.   The  number should represent the order as
+            an integer, for example,  big  endian  order  is  the
+            number  4,321,  and little endian order is the number
+            1,234.  If lorder is not  explicitly  set,  the  host
+            order  of  the  machine  where  the  Db  library  was
+            compiled is used.
+
+            The value of lorder is ignored except when  databases
+            are being created.  If a database already exists, the
+            byte order it uses is determined  when  the  file  is
+            read.
+
+            The  access  methods  provide no guarantees about the
+            byte ordering of the application data stored  in  the
+            database,   and   applications  are  responsible  for
+            maintaining any necessary ordering.
+
+       long pagesize;
+            The size of the pages  used  to  hold  items  in  the
+            database,  in  bytes.   The  minimum page size is 512
+            bytes and the maximum page size  is  64K  bytes.   If
+            pagesize  is  not  explicitly  set,  a  page  size is
+            selected based on the underlying filesystem I/O block
+            size.   The  selected  size  has a lower limit of 512
+            bytes and an upper limit of 16K bytes.
+
+
+
+

BTREE

+       The btree  data  structure  is  a  sorted,  balanced  tree
+       structure  storing  associated  key/data pairs.  Searches,
+       insertions, and deletions in the btree will  all  complete
+       in  O (lg base N) where base is the average number of keys
+       per page.   Often,  inserting  ordered  data  into  btrees
+       results  in pages that are half-full.  This implementation
+       has been modified to make  ordered  (or  inverse  ordered)
+       insertion  the best case, resulting in nearly perfect page
+       space utilization.
+
+       Space freed by deleting key/data pairs from  the  database
+       is  never  reclaimed  from  the filesystem, although it is
+       reused where possible.  This means that the btree  storage
+       structure  is  grow-only.   If  sufficiently many keys are
+       deleted from a tree that shrinking the underlying database
+       file  is desirable, this can be accomplished by creating a
+       new tree from a scan of the existing one.
+
+       The  following  additional  fields  and   flags   may   be
+       initialized  in  the DbInfo object before calling Db.open,
+       when using the btree access method:
+
+       int bt_minkey;
+            The minimum number of keys that will be stored on any
+            single  page.   This value is used to determine which
+            keys will be stored on overflow pages, i.e. if a  key
+            or  data  item is larger than the pagesize divided by
+            the bt_minkey value, it will be  stored  on  overflow
+            pages  instead  of in the page itself.  The bt_minkey
+            value specified must be at least 2; if  bt_minkey  is
+            not explicitly set, a value of 2 is used.
+
+       unsigned long flags;
+            The following additional flags may be specified:
+
+            DB_DUP
+                 Permit   duplicate   keys   in  the  tree,  i.e.
+                 insertion when the  key  of  the  key/data  pair
+                 being  inserted  already exists in the tree will
+                 be successful.  The ordering  of  duplicates  in
+                 the   tree   is   determined  by  the  order  of
+                 insertion,  unless  the  ordering  is  otherwise
+                 specified  by  use  of  a cursor (see Dbc(3) for
+                 more information.)  It is an  error  to  specify
+                 both DB_DUP and DB_RECNUM.
+
+            Db.DB_RECNUM
+                 Support   retrieval  from  btrees  using  record
+                 numbers.   For   more   information,   see   the
+                 DB_GET_RECNO  flag to the db.get method (below),
+                 and the cursor Dbc.get method (in Dbc(3)).
+
+                 Logical record numbers in btrees are mutable  in
+                 the  face  of record insertion or deletion.  See
+                 the DB_RENUMBER flag in the RECNO section  below
+                 for further discussion.
+
+                 Maintaining   record   counts   within  a  btree
+                 introduces a serious point of contention, namely
+                 the  page  locations where the record counts are
+                 stored.  In addition, the entire  tree  must  be
+                 locked  during  both  insertions  and deletions,
+                 effectively single-threading the tree for  those
+                 operations.   Specifying DB_RECNUM can result in
+                 serious   performance   degradation   for   some
+                 applications and data sets.
+
+                 It  is  an  error  to  specify  both  DB_DUP and
+                 DB_RECNUM.
+
+
+
+

HASH

+       The hash data structure is an extensible, dynamic  hashing
+       scheme.   Backward  compatible interfaces to the functions
+       described in dbm(3), ndbm(3) and hsearch(3) are  provided,
+       however  these interfaces are not compatible with previous
+       file formats.
+
+       The  following  additional  fields  and   flags   may   be
+       initialized  in  the DbInfo object before calling Db.open,
+       when using the hash access method:
+
+       int h_ffactor;
+            The desired density within the hash table.  It is  an
+            approximation  of  the  number  of  keys  allowed  to
+            accumulate in any one bucket,  determining  when  the
+            hash table grows or shrinks.  The default value is 0,
+            indicating that the  fill  factor  will  be  selected
+            dynamically as pages are filled.
+
+       int h_nelem;
+            An  estimate of the final size of the hash table.  If
+            not set or set  too  low,  hash  tables  will  expand
+            gracefully  as  keys  are  entered, although a slight
+            performance degradation may be noticed.  The  default
+            value is 1.
+
+       unsigned long flags;
+            The  following  additional  flags may be specified by
+            or'ing together one or more of the following values:
+
+            DB_DUP
+                 Permit  duplicate  keys  in   the   tree,   i.e.
+                 insertion  when  the  key  of  the key/data pair
+                 being inserted already exists in the  tree  will
+                 be  successful.   The  ordering of duplicates in
+                 the  tree  is  determined  by   the   order   of
+                 insertion,  unless  the  ordering  is  otherwise
+                 specified by use of a  cursor  (see  Dbc(3)  for
+                 more information.)
+
+
+
+

RECNO

+       The  recno  access  method  provides support for fixed and
+       variable length records, optionally backed by a flat  text
+       (byte  stream)  file.   Both  fixed  and  variable  length
+       records are accessed by their logical record number.
+
+       It is valid to create a record whose record number is more
+       than  one  greater  than  the last record currently in the
+       database.  For example, the creation of record  number  8,
+       when  records  6  and 7 do not yet exist, is not an error.
+       However, any  attempt  to  retrieve  such  records  (e.g.,
+       records 6 and 7) will return DB_KEYEMPTY.
+
+       Deleting  a  record will not, by default, renumber records
+       following the deleted record (see  DB_RENUMBER  below  for
+       more   information).   Any  attempt  to  retrieve  deleted
+       records will return DB_KEYEMPTY.
+
+       The  following  additional  fields  and   flags   may   be
+       initialized  in  the DbInfo object before calling Db.open,
+       when using the recno access method:
+
+       int re_delim;
+            For variable length records, if the re_source file is
+            specified  and  the  DB_DELIMITER  flag  is  set, the
+            delimiting byte used to mark the end of a  record  in
+            the  source file.  If the re_source file is specified
+            and the  DB_DELIMITER  flag  is  not  set,  <newline>
+            characters  (i.e.  ``\n'',  0x0a)  are interpreted as
+            end-of-record markers.
+
+       int re_len;
+            The length of a fixed-length record.
+
+       int re_pad;
+            For fixed length records, if the DB_PAD flag is  set,
+            the  pad  character for short records.  If the DB_PAD
+            flag is not explicitly set, <space> characters (i.e.,
+            0x20) are used for padding.
+
+       String re_source;
+            The purpose of the re_source field is to provide fast
+            access  and  modification  to  databases   that   are
+            normally stored as flat text files.
+
+            If   the   re_source  field  is  explicitly  set,  it
+            specifies an underlying flat text database file  that
+            is  read  to  initialize  a  transient  record number
+            index.  In the case of variable length  records,  the
+            records  are  separated  by  the byte value re_delim.
+            For example, standard UNIX byte stream files  can  be
+            interpreted  as a sequence of variable length records
+            separated by <newline> characters.
+
+            In addition,  when  cached  data  would  normally  be
+            written  back  to the underlying database file (e.g.,
+            the close or sync methods are called), the  in-memory
+            copy  of  the  database  will  be written back to the
+            re_source file.
+
+            By default, the backing source file is  read  lazily,
+            i.e.,  records  are not read from the file until they
+            are  requested  by  the  application.   If   multiple
+            processes   (not   threads)  are  accessing  a  recno
+            database  concurrently  and   either   inserting   or
+            deleting  records,  the  backing  source file must be
+            read in  its  entirety  before  more  than  a  single
+            process  accesses the database, and only that process
+            should specify the backing source file as part of the
+            Db.open  call.   See  the  DB_SNAPSHOT flag below for
+            more information.
+
+            Reading and writing the backing source file specified
+            by  re_source  cannot  be  transactionally  protected
+            because it involves filesystem  operations  that  are
+            not part of the Db transaction methodology.  For this
+            reason, if a temporary database is used to  hold  the
+            records,  i.e.,  a  null  was  specified  as the file
+            argument to Db.open,  it  is  possible  to  lose  the
+            contents  of  the re_source file, e.g., if the system
+            crashes at the right instant.  If a file is  used  to
+            hold the database, i.e., a file name was specified as
+            the  file  argument  to  Db.open,   normal   database
+            recovery   on  that  file  can  be  used  to  prevent
+            information loss, although it is still possible  that
+            the  contents of re_source will be lost if the system
+            crashes.
+
+            The re_source file must already  exist  (but  may  be
+            zero-length) when Db.open is called.
+
+            For  all of the above reasons, the re_source field is
+            generally used to specify databases  that  are  read-
+            only   for  Db  applications,  and  that  are  either
+            generated on the fly by software tools,  or  modified
+            using a different mechanism, e.g., a text editor.
+
+       unsigned long flags;
+            The  following  additional  flags may be specified by
+            or'ing together one or more of the following values:
+
+            Db.DB_DELIMITER
+                 The re_delim field is set.
+
+            Db.DB_FIXEDLEN
+                 The   records   are   fixed-length,   not   byte
+                 delimited.    The  re_len  value  specifies  the
+                 length of the record, and the  re_pad  value  is
+                 used as the pad character.
+
+                 Any  records added to the database that are less
+                 than re_len bytes long are automatically padded.
+                 Any  attempt to insert records into the database
+                 that are greater than  re_len  bytes  long  will
+                 cause the call to fail immediately and return an
+                 error.
+
+            Db.DB_PAD
+                 The re_pad field is set.
+
+            Db.DB_RENUMBER
+                 Specifying  the  DB_RENUMBER  flag  causes   the
+                 logical record numbers to be mutable, and change
+                 as records are added to  and  deleted  from  the
+                 database.   For  example, the deletion of record
+                 number 4 causes records numbered 5  and  greater
+                 to be renumbered downward by 1.  If a cursor was
+                 positioned  to  record  number  4   before   the
+                 deletion,  it  will  reference  the  new  record
+                 number 4, if any such record exists,  after  the
+                 deletion.   If  a  cursor  was  positioned after
+                 record number 4 before the deletion, it will  be
+                 shifted downward 1 logical record, continuing to
+                 reference the same record as it did before.
+
+                 Using the Dbc.put or put  interfaces  to  create
+                 new  records will cause the creation of multiple
+                 records if the record number is  more  than  one
+                 greater than the largest record currently in the
+                 database.  For example, creating record 28, when
+                 record  25 was previously the last record in the
+                 database, will create records 26 and 27 as  well
+                 as  28.   Attempts to retrieve records that were
+                 created in this manner will result in  an  error
+                 return of DB_KEYEMPTY.
+
+                 If  a  created  record  is not at the end of the
+                 database, all records following the  new  record
+                 will  be  automatically  renumbered upward by 1.
+                 For  example,  the  creation  of  a  new  record
+                 numbered 8 causes records numbered 8 and greater
+                 to be renumbered upward by 1.  If a  cursor  was
+                 positioned  to record number 8 or greater before
+                 the insertion,  it  will  be  shifted  upward  1
+                 logical record, continuing to reference the same
+                 record as it did before.
+
+                 For these reasons, concurrent access to a  recno
+                 database with the DB_RENUMBER flag specified may
+                 be   largely   meaningless,   although   it   is
+                 supported.
+
+            Db.DB_SNAPSHOT
+                 This flag specifies that any specified re_source
+                 file be read in its  entirety  when  Db.open  is
+                 called.   If  this  flag  is  not specified, the
+                 re_source file may be read lazily.
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), Dbt(3), DbTxn(3), DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/DbLock.html b/mozilla/db/man/man.html/DbLock.html new file mode 100644 index 00000000000..239078614d9 --- /dev/null +++ b/mozilla/db/man/man.html/DbLock.html @@ -0,0 +1,122 @@ + + +DbLock + + +

DbLock

+
+
+
+       #include <db_cxx.h>
+
+       int
+       DbLock::put(DbLockTab *lt);
+
+       unsigned int
+       DbLock::get_lock_id();
+
+       void
+       DbLock::set_lock_id(unsigned int);
+
+       DBLock::DbLock(unsigned int);
+       DBLock::DbLock();
+       DBLock::DbLock(const DbLock &);
+       DbLock &DBLock::operator = (const DbLock &);
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the  specific  details  of  the
+       locking   interface.    The   DbLock   class  is  used  in
+       conjunction with DbLockTab(3) to  provide  general-purpose
+       locking.   While  designed  to  work  with  the  other  Db
+       classes, these classes are also useful  for  more  general
+       locking  purposes.  Locks can be shared between processes.
+       In most cases, when  multiple  threads  or  processes  are
+       using  locking,  the  deadlock  detector,  db_deadlock(1),
+       should be run.
+
+  DbLock::put
+       The DbLock::put  method  is  a  simple  interface  to  the
+       DbLockTab::vec functionality, and is equivalent to calling
+       the DbLockTab::vec  method  with  a  single  element  list
+       array,  for which the op field is DB_LOCK_PUT and the lock
+       field  is  represented  by   the   DbLock   object.    The
+       DbLock::put   method   returns   success  and  failure  as
+       described for the DbLockTab::vec method.
+
+  DbLock::get_lock_id
+       The  DbLock::get_lock_id  method   gets   the   underlying
+       representation of the lock id.  Direct manipulation of the
+       underlying representation is not recommended.
+
+  DbLock::set_lock_id
+       The  DbLock::set_lock_id  method   sets   the   underlying
+       representation of the lock id.  Direct manipulation of the
+       underlying representation  is  not  recommended.   Rather,
+       DbLockTab::get  should  be  used  to initialize locks (see
+       DbLockTab(3)), and the  copy  constructor  and  assignment
+       operators can be used to assign to other DbLock objects.
+
+
+
+

ERRORS

+       Methods  marked as returning errno will, by default, throw
+       an exception that encapsulates the error information.  The
+       default error behavior can be changed, see DbException(3).
+
+       The DbLock::put method may fail and throw a DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: DbLock::detect(3),
+       fcntl(2), fflush(3), lseek(2), memcpy(3), memset(3),
+       mmap(2), munmap(2), strerror(3), and write(2).
+
+       In addition, the DbLock::put method may fail and  throw  a
+       DbException(3)   or   return   errno   for  the  following
+       conditions:
+
+       [EACCES]
+            An attempt was made to release lock held  by  another
+            locker.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+
+
+

BUGS

+       If  a process dies while holding locks, those locks remain
+       held and are never released.  In this case, all  processes
+       should exit as quickly as possible, so that db_recover can
+       be run.
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), DbMpoolFile(3), Dbt(3), DbTxn(3),
+       DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/DbLock.j.html b/mozilla/db/man/man.html/DbLock.j.html new file mode 100644 index 00000000000..6026d328d37 --- /dev/null +++ b/mozilla/db/man/man.html/DbLock.j.html @@ -0,0 +1,115 @@ + + +DbLock + + +

DbLock

+
+
+
+       import com.sleepycat.db.*;
+
+       public DbLock()
+            throws DbException;
+
+       public DbLock(DbLock that)
+            throws DbException;
+
+       public DbLock(int lockid);
+            throws DbException;
+
+       public native void put(DbLockTab locktab)
+            throws DbException;
+
+       public native int get_lock_id()
+            throws DbException;
+
+       public native void set_lock_id(int lockid)
+            throws DbException;
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the  specific  details  of  the
+       locking   interface.    The   DbLock   class  is  used  in
+       conjunction with DbLockTab(3) to  provide  general-purpose
+       locking.   While  designed  to  work  with  the  other  Db
+       classes, these classes are also useful  for  more  general
+       locking  purposes.  Locks can be shared between processes.
+       In most cases, when  multiple  threads  or  processes  are
+       using  locking,  the  deadlock  detector,  db_deadlock(1),
+       should be run.
+
+  DbLock.put
+       The DbLock.put method releases a lock, previously obtained
+       from the specified DbLockTab using DbLockTab.get.
+
+  DbLock.get_lock_id
+       The   DbLock.get_lock_id   method   gets   the  underlying
+       representation of the lock id.  Direct manipulation of the
+       underlying representation is not recommended.
+
+  DbLock.set_lock_id
+       The   DbLock.set_lock_id   method   sets   the  underlying
+       representation of the lock id.  Direct manipulation of the
+       underlying  representation  is  not  recommended.  Rather,
+       DbLockTab.get should be  used  to  initialize  locks  (see
+       DbLockTab(3)),  and  the  copy  constructor can be used to
+       create new DbLock objects from existing ones.
+
+
+
+

ERRORS

+       The DbLock.put method may fail and throw a  DbException(3)
+       for  any  of the errors specified for the following DB and
+       library functions: DbLock.detect(3), fcntl(2), fflush(3),
+       lseek(2), memcpy(3), memset(3), mmap(2), munmap(2),
+       strerror(3), and write(2).
+
+       In addition, the DbLock.put method may fail  and  throw  a
+       DbException(3)  encapsulating  an  errno for the following
+       conditions:
+
+       [EACCES]
+            An attempt was made to release lock held  by  another
+            locker.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+
+
+

BUGS

+       If  a process dies while holding locks, those locks remain
+       held and are never released.  In this case, all  processes
+       should exit as quickly as possible, so that db_recover can
+       be run.
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), Dbt(3), DbTxn(3), DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/DbLockTab.html b/mozilla/db/man/man.html/DbLockTab.html new file mode 100644 index 00000000000..84715972912 --- /dev/null +++ b/mozilla/db/man/man.html/DbLockTab.html @@ -0,0 +1,582 @@ + + +DbLockTab + + +

DbLockTab

+
+
+
+       #include <db_cxx.h>
+
+       static int
+       DbLockTab::open(const char *dir,
+            u_int32_t flags, int mode, DbEnv *dbenv, DbLockTab **regionp);
+
+       int
+       DbLockTab::id(u_int32_t *idp);
+
+       int
+       DbLockTab::vec(u_int32_t locker, u_int32_t flags,
+            DB_LOCKREQ list[], int nlist, DB_LOCKREQ **elistp);
+
+       int
+       DbLockTab::get(u_int32_t locker, u_int32_t flags,
+            const Dbt *obj, const db_lockmode_t lock_mode, DB_LOCK *lock);
+
+       int
+       DbLockTab::close();
+
+       static int
+       DbLockTab::unlink(const char *dir, int force, DbEnv *dbenv);
+
+       int
+       DbLockTab::detect(u_int32_t flags, u_int32_t atype);
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the  specific  details  of  the
+       locking interface.
+
+       The DbLockTab class is intended to provide general-purpose
+       locking.   While  designed  to  work  with  the  other  Db
+       classes,  this  class  is  also  useful  for  more general
+       locking purposes.  Locks can be shared between  processes.
+       In most cases, when multiple treads or processes are using
+       locking, the deadlock detector, db_deadlock(1), should  be
+       run.
+
+  DbLockTab::open
+       The  DbLockTab::open  method copies a pointer, to the lock
+       table identified by the directory  dir,  into  the  memory
+       location referenced by regionp.
+
+       If  the  dbenv argument to DbLockTab::open was initialized
+       using DbEnv::appinit, dir is interpreted as  described  by
+       DbEnv(3).
+
+       Otherwise,  if dir is not NULL, it is interpreted relative
+       to the current working directory of the process.   If  dir
+       is  NULL,  the following environment variables are checked
+       in order: ``TMPDIR'', ``TEMP'', and ``TMP''.   If  one  of
+       them  is set, lock table files are created relative to the
+       directory it specifies.  If none  of  them  are  set,  the
+       first  possible  one of the following directories is used:
+       /var/tmp, /usr/tmp, /temp, /tmp, C:/temp and C:/tmp.
+
+       All files associated with the lock table  are  created  in
+       this  directory.   This  directory must already exist when
+       DbLockTab::open is called.   If  the  lock  table  already
+       exists, the process must have permission to read and write
+       the existing files.  If the lock table  does  not  already
+       exist, it is optionally created and initialized.
+
+       The  flags  and  mode  arguments specify how files will be
+       opened and/or created when they don't already exist.   The
+       flags value is specified by or'ing together one or more of
+       the following values:
+
+       DB_CREATE
+            Create any underlying files, as  necessary.   If  the
+            files  do not already exist and the DB_CREATE flag is
+            not specified, the call will fail.
+
+       DB_THREAD
+            Cause  the   DbLockTab   handle   returned   by   the
+            DbLockTab::open  method  to  be  useable  by multiple
+            threads within a single address space,  i.e.,  to  be
+            ``free-threaded''.
+
+       All  files  created by the lock subsystem are created with
+       mode mode (as described in chmod(2)) and modified  by  the
+       process'   umask  value  at  the  time  of  creation  (see
+       umask(2)).  The group ownership of created files is  based
+       on  the  system and directory defaults, and is not further
+       specified by DB.
+
+       The locking subsystem is configured  based  on  which  set
+       methods  have been used.  It is expected that applications
+       will use a single DbEnv object as the argument to  all  of
+       the subsystems in the DB package.  The fields of the DbEnv
+       object used by DbLockTab::open are  described  below.   As
+       references  to  the  DbEnv  object  may  be  maintained by
+       DbLockTab::open, it is necessary that the DbEnv object and
+       memory   it  references  be  valid  until  the  object  is
+       destroyed.   Any  of  the  DbEnv  fields  that   are   not
+       explicitly set will default to appropriate values.
+       The   following   fields   in  the  DbEnv  object  may  be
+       initialized, using  the  appropriate  set  method,  before
+       calling DbLockTab::open:
+
+       void *(*db_errcall)(char *db_errpfx, char *buffer);
+       FILE *db_errfile;
+       const char *db_errpfx;
+       class ostream *db_error_stream;
+       int db_verbose;
+            The error fields of the DbEnv behave as described for
+            DbEnv(3).
+
+       const u_int8_t lk_conflicts[][];
+            A lk_modes by lk_modes array.  A non-0 value for  the
+            array element:
+
+                 lk_conflicts[requested_mode][held_mode]
+
+            indicates that requested_mode and held_mode conflict.
+            The ``not-granted'' mode must be  represented  by  0.
+            If   lk_conflicts   is   NULL,  the  conflicts  array
+            db_rw_conflicts  is  used;  see  the  section   below
+            entitled ``STANDARD LOCK MODES'' for a description of
+            that array.
+
+       u_int32_t lk_detect;
+            If non-0, specifies that the deadlock detector be run
+            whenever  a lock conflict occurs, and specifies which
+            transaction should  be  aborted  in  the  case  of  a
+            deadlock.   The lk_detect field must be set to one of
+            the following values.
+
+            DB_LOCK_DEFAULT
+                 Use the  default  policy  as  specified  in  the
+                 db_deadlock(1) man page.
+
+            DB_LOCK_OLDEST
+                 Abort the oldest transaction.
+
+            DB_LOCK_RANDOM
+                 Abort  a  random  transaction  involved  in  the
+                 deadlock.
+
+            DB_LOCK_YOUNGEST
+                 Abort the youngest transaction.
+
+       u_int32_t lk_max;
+            The maximum number of locks to be held  or  requested
+            in  the table.  This value is used by DbLockTab::open
+            to estimate how much space to  allocate  for  various
+            lock-table   data   structures.   If  lk_max  is  not
+            explicitly set, a default value is used.
+
+       u_int32_t lk_modes;
+
+       The number of lock modes to  be  recognized  by  the  lock
+            table (including
+            the ``not-granted'' mode).  If  lk_modes  is  0,  the
+            value   DB_LOCK_RW_N   is   used;  see  below  for  a
+            description of that value.
+
+       The DbLockTab::open  method  throws  a  DbException(3)  or
+       returns the value of errno on failure and 0 on success.
+
+  DbLockTab::id
+       The  DbLockTab::id  method  copies  a  locker ID, which is
+       guaranteed to be unique in the specified lock table,  into
+       the memory location referenced by idp.
+
+       The  access  methods  (see  Db::open in Db(3)), generate a
+       unique locker  ID  for  each  file  that  is  opened  with
+       locking.   During  Db access method operation, this locker
+       ID will be used for all lock calls  unless  a  transaction
+       identifier  was  specified for the call, in which case the
+       transaction ID specified is used for locking.
+
+       The  DbLockTab::id  method  throws  a  DbException(3)   or
+       returns the value of errno on failure and 0 on success.
+
+  DbLockTab::vec
+       The  DbLockTab::vec method atomically obtains and releases
+       one  or  more  locks  from  the  specified   table.    The
+       DbLockTab::vec  method  is intended to support acquisition
+       or  trading  of  multiple  locks  under  one  lock   table
+       semaphore,   as   is   needed  for  lock  coupling  or  in
+       multigranularity locking for lock escalation.
+
+       The locker argument  specified  to  DbLockTab::vec  is  an
+       unsigned  32-bit  integer  quantity.   It  represents  the
+       entity requesting or releasing the lock.
+
+       The flags value must be set to 0 or the following value:
+
+       DB_LOCK_NOWAIT
+            If a lock cannot be  granted  because  the  requested
+            lock   conflicts   with   an  existing  lock,  return
+            immediately instead of waiting for the lock to become
+            available.
+
+       The  list array provided to DbLockTab::vec is typedef'd in
+       <db_cxx.h> as DB_LOCKREQ.  A DB_LOCKREQ structure  has  at
+       least  the  following  fields,  which  must be initialized
+       before calling DbLockTab::vec:
+
+       lockop_t op;
+            The operation to be performed, which must be  set  to
+            one of the following values:
+
+            DB_LOCK_GET
+                 Get  a lock, as defined by the values of locker,
+                 obj and mode.  Upon return from  DbLockTab::vec,
+                 if  the  lock  field is non-NULL, a reference to
+                 the  acquired  lock  is  stored  there.    (This
+                 reference   is   invalidated   by  any  call  to
+                 DbLockTab::vec or DbLock::put that releases  the
+                 lock.)  See DbLock(3).
+
+            DB_LOCK_PUT
+                 The  lock referenced by the contents of the lock
+                 field is released.
+
+            DB_LOCK_PUT_ALL
+                 All locks held by the locker are released.  (Any
+                 locks  acquired as a part of the current call to
+                 DbLockTab::vec    that    appear    after    the
+                 DB_LOCK_PUT_ALL  entry  are  not  considered for
+                 this operation).
+
+            DB_LOCK_PUT_OBJ
+                 All locks held by the locker, on the object obj,
+                 with   the  mode  specified  by  lock_mode,  are
+                 released.  A lock_mode of  DB_LOCK_NG  indicates
+                 that all locks on the object should be released.
+                 Note that any locks acquired as a  part  of  the
+                 current call to DbLockTab::vec that occur before
+                 the DB_LOCK_PUT_OBJ will also be released; those
+                 acquired afterwards will not be released.
+
+       const Dbt obj;
+            An  untyped  byte string that specifies the object to
+            be locked or released.
+
+       const lockmode_t mode;
+            The  lock  mode,  used  as  an  index  into  object's
+            conflict array.
+
+       DB_LOCK lock;
+            A lock reference.
+
+       The nlist argument specifies the number of elements in the
+       list array.
+       If any of the requested locks cannot be acquired,  or  any
+       of  the  locks  to  be  released  cannot  be released, the
+       operations before the failing operation are guaranteed  to
+       have  completed successfully, and DbLockTab::vec returns a
+       non-zero value.  In addition, if elistp is not NULL, it is
+       set  to  point  to  the  DB_LOCKREQ  entry  that was being
+       processed when the error occurred.
+
+       In the case of an error, DbLockTab::vec may return one  of
+       the following values:
+
+       DB_LOCK_DEADLOCK
+            The  specified  locker  was  selected  as a victim in
+            order to resolve a deadlock.
+
+       DB_LOCK_NOTHELD
+            The lock cannot be released, as it was  not  held  by
+            the locker.
+
+       DB_LOCK_NOTGRANTED
+            A  lock  was  requested that could not be granted and
+            the flag parameter was  set  to  DB_LOCK_NOWAIT.   In
+            this case, if non-NULL, elistp identifies the request
+            that was granted.
+
+       Otherwise,   the   DbLockTab::vec    method    throws    a
+       DbException(3)  or  returns  the value of errno on failure
+       and 0 on success.
+
+  DbLockTab::get
+       The DbLockTab::get method is a simple interface to the
+
+       DbLockTab::vec functionality, and is equivalent to calling
+       the
+
+       DbLockTab::vec method with the locker argument, elistp and
+       conflict arguments, and a single element list  array,  for
+       which  the op field is DB_LOCK_GET, and the obj, lock_mode
+       and lock fields are represented by the  arguments  of  the
+       same  name.   Note  that  the  type of the obj argument to
+       DbLockTab::get is different from the obj element found  in
+       the   DB_LOCKREQ  structure.   The  DbLockTab::get  method
+       returns success and failure as described for the
+
+       DbLockTab::vec method.
+
+  DbLockTab::close
+       The  DbLockTab::close  method  disassociates  the  calling
+       process  from  the  lock  table.  The object should not be
+       used after a call to close.   Note  that  DbLockTab::close
+       does  not  release  any  locks  still  held by the closing
+       process.   (This  provides  functionality  for  long-lived
+       locks.)
+
+       Processes  that  wish to have all their locks released can
+       do so by issuing the appropriate DbLockTab::vec call.
+
+       In addition, if the dir argument  to  DbLockTab::open  was
+       NULL  and  dbenv was not initialized using DbEnv::appinit,
+       all files created for this shared region will be  removed,
+       as if DbLockTab::unlink were called.
+
+       When  multiple  threads  are  using  the  DbLockTab object
+       concurrently,  only  a  single   thread   may   call   the
+       DbLockTab::close method.
+
+       The  DbLockTab::close  method  throws  a DbException(3) or
+       returns the value of errno on failure and 0 on success.
+
+  DbLockTab::unlink
+       The  DbLockTab::unlink  method  destroys  the  lock  table
+       identified  by  the directory dir, removing all files used
+       to implement the lock table.  (The directory  dir  is  not
+       removed.)    If  there  are  processes  that  have  called
+       DbLockTab::open without  calling  DbLockTab::close  (i.e.,
+       there  are  processes  currently  using  the  lock table),
+       DbLockTab::unlink will fail without further action, unless
+       the  force  flag  is  set, in which case DbLockTab::unlink
+       will attempt to remove the lock table files regardless  of
+       any processes still using the lock table.
+
+       The  result  of  attempting to forcibly destroy the region
+       when  a  process  has  the  region  open  is  unspecified.
+       Processes  using  a  shared memory region maintain an open
+       file descriptor for  it.   On  UNIX  systems,  the  region
+       removal  should  succeed  and  processes that have already
+       joined the region should continue to  run  in  the  region
+       without  change,  however processes attempting to join the
+       lock table will either fail or attempt  to  create  a  new
+       region.   On other systems, e.g., WNT, where the unlink(2)
+       system call will fail if any  process  has  an  open  file
+       descriptor for the file, the region removal will fail.
+
+       In  the  case  of catastrophic or system failure, database
+       recovery must  be  performed  (see  db_recover(1)  or  the
+       DB_RECOVER      and      DB_RECOVER_FATAL     flags     to
+       DbEnv::appinit(3)).  Alternatively,  if  recovery  is  not
+       required  because  no  database state is maintained across
+       failures, it is possible to  clean  up  a  lock  table  by
+       removing  all  of  the files in the directory specified to
+       the DbLockTab::open method, as lock table files are  never
+       created  in  any directory other than the one specified to
+       DbLockTab::open.   Note,  however,  that  this   has   the
+       potential   to  remove  files  created  by  the  other  DB
+       subsystems in this database environment.
+
+       The DbLockTab::unlink method throws  a  DbException(3)  or
+       returns the value of errno on failure and 0 on success.
+
+  DbLockTab::detect
+       The  DbLockTab::detect  method  runs  one iteration of the
+       deadlock detector on the current lock table.  The deadlock
+       detector  traverses the lock table, detects deadlocks, and
+       if  it  finds  one,  marks  one   of   the   participating
+       transactions for abort and then returns.
+
+       The  flags  value  is  specified by or'ing together one or
+       more of the following values:
+
+       DB_LOCK_CONFLICT
+            Only run the deadlock detector if a lock conflict has
+            occurred  since  the  last  time  that  the  deadlock
+            detector was run.
+
+       The atype parameter specifies which transaction  to  abort
+       in  the case of deadlock.  It must be set to one of values
+       described above for  the  lk_detect  field  of  the  DbEnv
+       object.
+
+       The  DbLockTab::detect  method  throws a DbException(3) or
+       returns the value of errno on failure and 0 on success.
+
+       The DbLockTab::detect method is based on the C lock_detect
+       function,  which  is  the  underlying function used by the
+       db_deadlock(1) utility.   See  the  source  code  for  the
+       db_deadlock utility for an example of using lock_detect in
+       a UNIX environment.
+
+
+
+

ENVIRONMENT VARIABLES

+       The following environment variables affect  the  execution
+       of db_lock:
+
+       DB_HOME
+            If   the   dbenv   argument  to  DbLockTab::open  was
+            initialized   using   db_appinit,   the   environment
+            variable  DB_HOME  may  be  used  as  the path of the
+            database home  for  the  interpretation  of  the  dir
+            argument   to   DbLockTab::open,   as   described  in
+            db_appinit(3).
+
+       TMPDIR
+            If the dbenv argument to DbLockTab::open was NULL  or
+            not  initialized  using  db_appinit,  the environment
+            variable TMPDIR may be used as the directory in which
+            to  create  the  lock  table,  as  described  in  the
+            DbLockTab::open section above.
+
+
+
+

STANDARD LOCK MODES

+       The include file <db_cxx.h>  declares  two  commonly  used
+       conflict arrays:
+
+       const u_int8_t db_lock_rw_conflicts[];
+            This  is  a  conflict array for a simple scheme using
+            shared and exclusive lock modes.
+
+       const u_int8_t db_lock_riw_conflicts[];
+            This is a conflict array that involves various intent
+            lock  modes  (e.g.,  intent shared) that are used for
+            multigranularity locking.
+
+       Their associated sizes are DB_LOCK_RW_N and DB_LOCK_RIW_N.
+
+       In  addition, the include file <db_cxx.h> defines the type
+       db_lockmode_t, which is the type of the  lock  modes  used
+       with the standard tables above:
+
+              DB_LOCK_NG
+                   not granted (always 0)
+
+              DB_LOCK_READ
+                   read (shared)
+
+              DB_LOCK_WRITE
+                   write (exclusive)
+
+
+
+

ERRORS

+       Methods  marked as returning errno will, by default, throw
+       an exception that encapsulates the error information.  The
+       default error behavior can be changed, see DbException(3).
+
+       The  DbLockTab::open  method  may   fail   and   throw   a
+       DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: DbLock::unlink(3),
+       close(2), db_version(3), fcntl(2), fflush(3), lseek(2),
+       malloc(3), memcpy(3), memset(3), mmap(2), munmap(2),
+       open(2), sigfillset(3), sigprocmask(2), stat(2),
+       strcpy(3), strdup(3), strerror(3), strlen(3), unlink(2),
+       and write(2).
+
+       In addition, the DbLockTab::open method may fail and throw
+       a  DbException(3)  or  return  errno  for  the   following
+       conditions:
+
+       [EAGAIN]
+            The  shared memory region was locked and (repeatedly)
+            unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The DB_THREAD flag was specified  and  spinlocks  are
+            not implemented for this architecture.
+
+       The   DbLockTab::vec   method   may   fail   and  throw  a
+       DbException(3)
+
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: DbLock::detect(3),
+       fcntl(2), fflush(3), lseek(2), memcpy(3), memset(3),
+       mmap(2), munmap(2), strerror(3), and write(2).
+
+       In  addition, the DbLockTab::vec method may fail and throw
+       a  DbException(3)  or  return  errno  for  the   following
+       conditions:
+
+       [EACCES]
+            An  attempt  was made to release lock held by another
+            locker.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       The  DbLockTab::get  method   may   fail   and   throw   a
+       DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: DbLock::detect(3),
+       fcntl(2), fflush(3), lseek(2), memcpy(3), memset(3),
+       mmap(2), munmap(2), strerror(3), and write(2).
+
+       In addition, the DbLockTab::get method may fail and  throw
+       a   DbException(3)  or  return  errno  for  the  following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       The  DbLockTab::close  method  may  fail   and   throw   a
+       DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: close(2), fcntl(2),
+       fflush(3), munmap(2), and strerror(3).
+
+       The   DbLockTab::unlink   method  may  fail  and  throw  a
+       DbException(3)
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: close(2), fcntl(2),
+       fflush(3), malloc(3), memcpy(3), memset(3), mmap(2),
+       munmap(2), open(2), sigfillset(3), sigprocmask(2),
+       stat(2), strcpy(3), strdup(3), strerror(3), strlen(3), and
+       unlink(2).
+
+       In  addition,  the  DbLockTab::unlink  method may fail and
+       throw a DbException(3) or return errno for  the  following
+       conditions:
+
+       [EBUSY]
+            The  shared  memory  region  was in use and the force
+            flag was not set.
+
+       The  DbLockTab::detect  method  may  fail  and   throw   a
+       DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: calloc(3), fcntl(2),
+       fflush(3), lseek(2), malloc(3), memcpy(3), memset(3),
+       mmap(2), munmap(2), strerror(3), and write(2).
+
+
+
+

BUGS

+       If a process dies while holding locks, those locks  remain
+       held  and are never released.  In this case, all processes
+       should exit as quickly as possible, so that db_recover can
+       be run.
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), DbMpoolFile(3), Dbt(3), DbTxn(3),
+       DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/DbLockTab.j.html b/mozilla/db/man/man.html/DbLockTab.j.html new file mode 100644 index 00000000000..e383c9d22eb --- /dev/null +++ b/mozilla/db/man/man.html/DbLockTab.j.html @@ -0,0 +1,439 @@ + + +DbLockTab + + +

DbLockTab

+
+
+
+       import com.sleepycat.db.*;
+
+       public void close()
+            throws DbException;
+
+       public void detect(int flags, int atype)
+            throws DbException;
+
+       public DbLock get(int locker, int flags, Dbt obj, int lock_mode)
+            throws DbException;
+
+       public int id()
+            throws DbException;
+
+       public static DbLockTab open(String dir, int flags, int mode, DbEnv dbenv)
+            throws DbException;
+
+       public static void unlink(String dir, int force, DbEnv dbenv)
+            throws DbException;
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the  specific  details  of  the
+       locking interface.
+
+       The DbLockTab class is intended to provide general-purpose
+       locking.   While  designed  to  work  with  the  other  Db
+       classes,  this  class  is  also  useful  for  more general
+       locking purposes.  Locks can be shared between  processes.
+       In most cases, when multiple treads or processes are using
+       locking, the deadlock detector, db_deadlock(1), should  be
+       run.
+
+       The  vec  method  (as it appears in the C and C++ APIs) is
+       not yet implemented for Java  and  so  it  not  described.
+       However,  understanding  this function in the C or C++ API
+       is helpful in understanding  the  get  method,  so  please
+       refer to lock_vec in db_lock(3).
+
+  DbLockTab.open
+       The  DbLockTab.open method returns a lock table identified
+       by the directory dir.
+
+       If the dbenv argument to  DbLockTab.open  was  initialized
+       using  DbEnv.appinit,  dir  is interpreted as described by
+       DbEnv(3).
+
+       Otherwise, if dir is not null, it is interpreted  relative
+       to  the  current working directory of the process.  If dir
+       is null, the following environment variables  are  checked
+       in  order:  ``TMPDIR'',  ``TEMP'', and ``TMP''.  If one of
+       them is set, lock table files are created relative to  the
+       directory  it  specifies.   If  none  of them are set, the
+       first possible one of the following directories  is  used:
+       /var/tmp, /usr/tmp, /temp, /tmp, C:/temp and C:/tmp.
+
+       All  files  associated  with the lock table are created in
+       this directory.  This directory must  already  exist  when
+       DbLockTab.open  is  called.   If  the  lock  table already
+       exists, the process must have permission to read and write
+       the  existing  files.   If the lock table does not already
+       exist, it is optionally created and initialized.
+
+       The flags and mode arguments specify  how  files  will  be
+       opened  and/or created when they don't already exist.  The
+       flags value is specified by or'ing together one or more of
+       the following values:
+
+       Db.DB_CREATE
+            Create  any  underlying  files, as necessary.  If the
+            files do not already exist and the DB_CREATE flag  is
+            not specified, the call will fail.
+
+       Db.DB_THREAD
+            Cause   the   DbLockTab   handle   returned   by  the
+            DbLockTab.open  method  to  be  useable  by  multiple
+            threads  within  a  single address space, i.e., to be
+            ``free-threaded''.  Threading is assumed in the  Java
+            API,  so  no  special  flags  are  required,  and  DB
+            functions will always behave as if the DB_THREAD flag
+            was specified.
+
+       All  files  created by the lock subsystem are created with
+       mode mode (as described in chmod(2)) and modified  by  the
+       process'   umask  value  at  the  time  of  creation  (see
+       umask(2)).  The group ownership of created files is  based
+       on  the  system and directory defaults, and is not further
+       specified by DB.
+
+       The locking subsystem is configured  based  on  which  set
+       methods  have been used.  It is expected that applications
+       will use a single DbEnv object as the argument to  all  of
+       the subsystems in the DB package.  The fields of the DbEnv
+       object used by DbLockTab.open  are  described  below.   As
+       references  to  the  DbEnv  object  may  be  maintained by
+       DbLockTab.open, it is necessary that the DbEnv object  and
+       memory   it  references  be  valid  until  the  object  is
+       destroyed.   Any  of  the  DbEnv  fields  that   are   not
+       explicitly set will default to appropriate values.
+
+       The   following   fields   in  the  DbEnv  object  may  be
+       initialized, using  the  appropriate  set  method,  before
+       calling DbLockTab.open:
+
+       DbErrcall db_errcall;
+       String db_errpfx;
+       int db_verbose;
+            The error fields of the DbEnv behave as described for
+            DbEnv(3).  void *(*db_errcall)(char *db_errpfx,  char
+            *buffer);
+
+       FILE *db_errfile;
+       const char *db_errpfx;
+       int db_verbose;
+            The  error  fields  of the DB_ENV behave as described
+            for db_appinit(3).
+
+       byte[][] lk_conflicts;
+            A lk_modes by lk_modes array.  A non-0 value for  the
+            array element:
+
+                 lk_conflicts[requested_mode][held_mode]
+
+            indicates that requested_mode and held_mode conflict.
+            The ``not-granted'' mode must be  represented  by  0.
+            If   lk_conflicts   is   null,  the  conflicts  array
+            db_rw_conflicts  is  used;  see  the  section   below
+            entitled ``STANDARD LOCK MODES'' for a description of
+            that array.
+
+       int lk_detect;
+            If non-0, specifies that the deadlock detector be run
+            whenever  a lock conflict occurs, and specifies which
+            transaction should  be  aborted  in  the  case  of  a
+            deadlock.   The lk_detect field must be set to one of
+            the following values.
+
+            Db.DB_LOCK_DEFAULT
+                 Use the  default  policy  as  specified  in  the
+                 db_deadlock(1) man page.
+
+            Db.DB_LOCK_OLDEST
+                 Abort the oldest transaction.
+
+            Db.DB_LOCK_RANDOM
+                 Abort  a  random  transaction  involved  in  the
+                 deadlock.
+
+            Db.DB_LOCK_YOUNGEST
+                 Abort the youngest transaction.
+
+       int lk_max;
+            The maximum number of locks to be held  or  requested
+            in  the  table.  This value is used by DbLockTab.open
+            to estimate how much space to  allocate  for  various
+            lock-table   data   structures.   If  lk_max  is  not
+            explicitly set, a default value is used.
+
+       int lk_modes;
+
+       The number of lock modes to  be  recognized  by  the  lock
+            table (including
+            the ``not-granted'' mode).  If  lk_modes  is  0,  the
+            value   DB_LOCK_RW_N   is   used;  see  below  for  a
+            description of that value.
+
+       The DbLockTab.open method  throws  a  DbException(3)  that
+       encapsulates an errno on failure.
+
+  DbLockTab.id
+       The  DbLockTab.id  method  returns  a  locker ID, which is
+       guaranteed to be unique in the specified lock table.
+
+       The access methods (see  Db.open  in  Db(3)),  generate  a
+       unique  locker  ID  for  each  file  that  is  opened with
+       locking.  During Db access method operation,  this  locker
+       ID  will  be  used for all lock calls unless a transaction
+       identifier was specified for the call, in which  case  the
+       transaction ID specified is used for locking.
+
+       The  DbLockTab.id  method  throws  a  DbException(3)  that
+       encapsulates an errno on failure.
+
+  DbLockTab.get
+       The DbLockTab.get method gets a lock, as  defined  by  the
+       values of locker, obj and mode.  The locker argument is an
+       unsigned  32-bit  integer  quantity.   It  represents  the
+       entity requesting or releasing the lock.
+
+       The flags value must be set to 0 or the following value:
+
+       Db.DB_LOCK_NOWAIT
+            If  a  lock  cannot  be granted because the requested
+            lock  conflicts  with  an   existing   lock,   return
+            immediately instead of waiting for the lock to become
+            available.
+
+       A reference to  the  acquired  lock  is  returned.   (This
+       reference  is  invalidated  by any call to DbLock.put that
+       releases the lock.)  See DbLock(3).
+
+  DbLockTab.close
+       The  DbLockTab.close  method  disassociates  the   calling
+       process  from  the  lock  table.  The object should not be
+       used after a call to  close.   Note  that  DbLockTab.close
+       does  not  release  any  locks  still  held by the closing
+       process.   (This  provides  functionality  for  long-lived
+       locks.)
+
+       In  addition,  if  the  dir argument to DbLockTab.open was
+       null and dbenv was not  initialized  using  DbEnv.appinit,
+       all  files created for this shared region will be removed,
+       as if DbLockTab.unlink were called.
+
+       When multiple  threads  are  using  the  DbLockTab  object
+       concurrently,   only   a   single   thread  may  call  the
+       DbLockTab.close method.
+
+       The DbLockTab.close method throws  a  DbException(3)  that
+       encapsulates an errno on failure.
+
+  DbLockTab.unlink
+       The   DbLockTab.unlink  method  destroys  the  lock  table
+       identified by the directory dir, removing all  files  used
+       to  implement  the  lock table.  (The directory dir is not
+       removed.)   If  there  are  processes  that  have   called
+       DbLockTab.open   without  calling  DbLockTab.close  (i.e.,
+       there are  processes  currently  using  the  lock  table),
+       DbLockTab.unlink  will fail without further action, unless
+       the force flag is set, in which case DbLockTab.unlink will
+       attempt  to  remove the lock table files regardless of any
+       processes still using the lock table.
+
+       The result of attempting to forcibly  destroy  the  region
+       when  a  process  has  the  region  open  is  unspecified.
+       Processes using a shared memory region  maintain  an  open
+       file  descriptor  for  it.   On  UNIX  systems, the region
+       removal should succeed and  processes  that  have  already
+       joined  the  region  should  continue to run in the region
+       without change, however processes attempting to  join  the
+       lock  table  will  either  fail or attempt to create a new
+       region.  On other systems, e.g., WNT, where the  unlink(2)
+       system  call  will  fail  if  any process has an open file
+       descriptor for the file, the region removal will fail.
+
+       In the case of catastrophic or  system  failure,  database
+       recovery  must  be  performed  (see  db_recover(1)  or the
+       DB_RECOVER     and     DB_RECOVER_FATAL      flags      to
+       DbEnv.appinit(3)).   Alternatively,  if  recovery  is  not
+       required because no database state  is  maintained  across
+       failures,  it  is  possible  to  clean  up a lock table by
+       removing all of the files in the  directory  specified  to
+       the  DbLockTab.open  method, as lock table files are never
+       created in any directory other than the one  specified  to
+       DbLockTab.open.    Note,   however,   that  this  has  the
+       potential  to  remove  files  created  by  the  other   DB
+       subsystems in this database environment.
+
+       The  DbLockTab.unlink  method throws a DbException(3) that
+       encapsulates an errno on failure.
+
+  DbLockTab.detect
+       The DbLockTab.detect method  runs  one  iteration  of  the
+       deadlock detector on the current lock table.  The deadlock
+       detector traverses the lock table, detects deadlocks,  and
+       if   it   finds   one,  marks  one  of  the  participating
+       transactions for abort and then returns.
+
+       The flags value is specified by  or'ing  together  one  or
+       more of the following values:
+
+       Db.DB_LOCK_CONFLICT
+            Only run the deadlock detector if a lock conflict has
+            occurred  since  the  last  time  that  the  deadlock
+            detector was run.
+
+       The  atype  parameter specifies which transaction to abort
+       in the case of deadlock.  It must be set to one of  values
+       described  above  for  the  lk_detect  field  of the DbEnv
+       object.
+
+       The DbLockTab.detect method throws a  DbException(3)  that
+       encapsulates an errno on failure.
+
+       The  DbLockTab.detect method is based on the C lock_detect
+       function, which is the underlying  function  used  by  the
+       db_deadlock(1)  utility.   See  the  source  code  for the
+       db_deadlock utility for an example of using lock_detect in
+       a UNIX environment.
+
+
+
+

ENVIRONMENT VARIABLES

+       The  following  environment variables affect the execution
+       of db_lock:
+
+       DB_HOME
+            If  the  dbenv   argument   to   DbLockTab.open   was
+            initialized   using   db_appinit,   the   environment
+            variable DB_HOME may be  used  as  the  path  of  the
+            database  home  for  the  interpretation  of  the dir
+            argument   to   DbLockTab.open,   as   described   in
+            db_appinit(3).
+
+       TMPDIR
+            If  the  dbenv argument to DbLockTab.open was null or
+            not initialized  using  db_appinit,  the  environment
+            variable TMPDIR may be used as the directory in which
+            to  create  the  lock  table,  as  described  in  the
+            DbLockTab.open section above.
+
+
+
+

STANDARD LOCK MODES

+       The   DbLockTab   class   defines  the  following  integer
+       constants, known elsewhere as db_lockmode_t,  which  which
+       specify  the  type of the lock mode used with the standard
+       tables above:
+
+              Db.DB_LOCK_NG
+                   not granted (always 0)
+
+              Db.DB_LOCK_READ
+                   read (shared)
+
+              Db.DB_LOCK_WRITE
+                   write (exclusive)
+
+
+
+

ERRORS

+       The  DbLockTab.open  method   may   fail   and   throw   a
+       DbException(3)  for  any  of  the errors specified for the
+       following DB and library functions: DbLock.unlink(3),
+       close(2), db_version(3), fcntl(2), fflush(3), lseek(2),
+       malloc(3), memcpy(3), memset(3), mmap(2), munmap(2),
+       open(2), sigfillset(3), sigprocmask(2), stat(2),
+       strcpy(3), strdup(3), strerror(3), strlen(3), unlink(2),
+       and write(2).
+
+       In  addition, the DbLockTab.open method may fail and throw
+       a DbException(3) encapsulating an errno for the  following
+       conditions:
+
+       [EAGAIN]
+            The  shared memory region was locked and (repeatedly)
+            unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The DB_THREAD flag was specified  and  spinlocks  are
+            not implemented for this architecture.
+
+       The   DbLockTab.get   method   may   fail   and   throw  a
+       DbException(3) for any of the  errors  specified  for  the
+       following DB and library functions: DbLock.detect(3),
+       fcntl(2), fflush(3), lseek(2), memcpy(3), memset(3),
+       mmap(2), munmap(2), strerror(3), and write(2).
+       In addition, the DbLockTab.get method may fail and throw a
+       DbException(3) encapsulating an errno  for  the  following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       The   DbLockTab.close   method   may   fail  and  throw  a
+       DbException(3) for any of the  errors  specified  for  the
+       following DB and library functions: close(2), fcntl(2),
+       fflush(3), munmap(2), and strerror(3).
+
+       The  DbLockTab.unlink  method  may  fail   and   throw   a
+       DbException(3)  for  any  of  the errors specified for the
+       following DB and library functions: close(2), fcntl(2),
+       fflush(3), malloc(3), memcpy(3), memset(3), mmap(2),
+       munmap(2), open(2), sigfillset(3), sigprocmask(2),
+       stat(2), strcpy(3), strdup(3), strerror(3), strlen(3), and
+       unlink(2).
+
+       In addition, the  DbLockTab.unlink  method  may  fail  and
+       throw  a  DbException(3)  encapsulating  an  errno for the
+       following conditions:
+
+       [EBUSY]
+            The shared memory region was in  use  and  the  force
+            flag was not set.
+
+       The   DbLockTab.detect   method   may  fail  and  throw  a
+       DbException(3) for any of the  errors  specified  for  the
+       following DB and library functions: calloc(3), fcntl(2),
+       fflush(3), lseek(2), malloc(3), memcpy(3), memset(3),
+       mmap(2), munmap(2), strerror(3), and write(2).
+
+
+
+

BUGS

+       If  a process dies while holding locks, those locks remain
+       held and are never released.  In this case, all  processes
+       should exit as quickly as possible, so that db_recover can
+       be run.
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), Dbt(3), DbTxn(3), DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/DbLog.html b/mozilla/db/man/man.html/DbLog.html new file mode 100644 index 00000000000..4592113a115 --- /dev/null +++ b/mozilla/db/man/man.html/DbLog.html @@ -0,0 +1,797 @@ + + +DbLog + + +

DbLog

+
+
+
+       #include <db_cxx.h>
+
+       static int
+       DbLog::open(const char *dir,
+            u_int32_t flags, int mode, DbEnv *dbenv, DbLog **regionp);
+
+       int
+       DbLog::close();
+
+       int
+       DbLog::flush(const DbLsn *lsn);
+
+       int
+       DbLog::get(DbLsn *lsn, Dbt *data, u_int32_t flags);
+
+       static int
+       DbLog::compare(const DbLsn *lsn0, const DbLsn *lsn1);
+
+       int
+       DbLog::file(const DbLsn *lsn, char *namep, size_t len);
+
+       int
+       DbLog::put(DbLsn *lsn, const Dbt *data, u_int32_t flags);
+
+       static int
+       DbLog::unlink(const char *dir, int force, DbEnv *);
+
+       int
+       DbLog::archive(char **list[],
+            u_int32_t flags, void *(*db_malloc)(size_t));
+
+       int
+       DbLog::db_register(const Db *dbp,
+            const char *name, DBTYPE type, u_int32_t *fidp);
+
+       int
+       DbLog::db_unregister(u_int32_t fid);
+
+       int
+       DbLog::stat(DB_LOG_STAT **spp, void *(*db_malloc)(size_t));
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the specific details of the log
+       class.
+
+       This  class  provide  a  general-purpose  logging facility
+       sufficient for transaction management.  Logs can be shared
+       by multiple processes.
+
+       The  DB  transaction  log  is  represented  by a directory
+       containing a set of files.  The log is a  record-oriented,
+       append-only file, with records identified and accessed via
+       DbLsn's (database log sequence numbers).
+
+       DbLsn's are returned on  each  DbLog::put  operation,  and
+       only  those  DbLsn's  returned  by DbLog::put can later be
+       used to retrieve records from the log.
+
+  DbLog::open
+       The DbLog::open  method  copies  a  pointer,  to  the  log
+       identified  by the directory dir, into the memory location
+       referenced by regionp.
+
+       If the dbenv argument to DbLog::open was initialized using
+       DbEnv::appinit,   dir   is  interpreted  as  described  by
+       DbEnv(3).
+
+       Otherwise, if dir is not NULL, it is interpreted  relative
+       to  the  current working directory of the process.  If dir
+       is NULL, the following environment variables  are  checked
+       in  order:  ``TMPDIR'',  ``TEMP'', and ``TMP''.  If one of
+       them is  set,  log  files  are  created  relative  to  the
+       directory  it  specifies.   If  none  of them are set, the
+       first possible one of the following directories  is  used:
+       /var/tmp, /usr/tmp, /temp, /tmp, C:/temp and C:/tmp.
+
+       All  files  associated  with  the  log are created in this
+       directory.   This  directory  must  already   exist   when
+       DbLog::open  is  called.   If  the log already exists, the
+       process  must  have  permission  to  read  and  write  the
+       existing  files.  If the log does not already exist, it is
+       optionally created and initialized.
+
+       If the log region is  being  created  and  log  files  are
+       already  present,  the  log  files  are  ``recovered'' and
+       subsequent log writes are appended to the end of the  log.
+
+       The  log  is  stored in one or more files in the specified
+       directory.  Each file is named using the format
+
+            log.NNNNN
+
+       where ``NNNNN'' is the sequence number of the file  within
+       the log.
+
+       The  flags  and  mode  arguments specify how files will be
+       opened and/or created when they don't already exist.   The
+       flags value is specified by or'ing together one or more of
+       the following values:
+
+       DB_CREATE
+            Create any underlying files, as  necessary.   If  the
+            files  do not already exist and the DB_CREATE flag is
+            not specified, the call will fail.
+
+       DB_THREAD
+            Cause the DbLog handle returned  by  the  DbLog::open
+            method  to  be  useable  by multiple threads within a
+            single address space, i.e., to be  ``free-threaded''.
+
+       All  files  created  by the log subsystem are created with
+       mode mode (as described in chmod(2)) and modified  by  the
+       process'   umask  value  at  the  time  of  creation  (see
+       umask(2)).  The group ownership of created files is  based
+       on  the  system and directory defaults, and is not further
+       specified by DB.
+
+       The logging subsystem is configured  based  on  which  set
+       methods  have been used.  It is expected that applications
+       will use a single DbEnv object as the argument to  all  of
+       the subsystems in the DB package.  The fields of the DbEnv
+       object  used  by  DbLog::open  are  described  below.   As
+       references  to  the  DbEnv  object  may  be  maintained by
+       DbLog::open, it is necessary that  the  DbEnv  object  and
+       memory   it  references  be  valid  until  the  object  is
+       destroyed.   Any  of  the  DbEnv  fields  that   are   not
+       explicitly set will default to appropriate values.
+
+       The   following   fields   in  the  DbEnv  object  may  be
+       initialized, using  the  appropriate  set  method,  before
+       calling DbLog::open:
+
+       void *(*db_errcall)(char *db_errpfx, char *buffer);
+       FILE *db_errfile;
+       const char *db_errpfx;
+       class ostream *db_error_stream;
+       int db_verbose;
+            The error fields of the DbEnv behave as described for
+            DbEnv(3).
+
+       u_int32_t lg_max;
+            The maximum  size  of  a  single  file  in  the  log.
+            Because   DbLsn  file  offsets  are  unsigned  4-byte
+            values, lg_max may not be  larger  than  the  maximum
+            unsigned 4-byte value.
+
+            If lg_max is 0, a default value is used.
+
+            See  the section "LOG FILE LIMITS" below, for further
+            information.
+
+       The DbLog::open method throws a DbException(3) or  returns
+       the value of errno on failure and 0 on success.
+
+  DbLog::close
+       The DbLog::close method closes the log associated with the
+       DbLog object.
+
+       In addition, if the dir argument to DbLog::open  was  NULL
+       and  dbenv  was  not initialized using DbEnv::appinit, all
+       files created for this shared region will be  removed,  as
+       if DbLog::unlink were called.
+
+       When   multiple   threads   are  using  the  DbLog  handle
+       concurrently,  only  a  single   thread   may   call   the
+       DbLog::close method.
+
+       The DbLog::close method throws a DbException(3) or returns
+       the value of errno on failure and 0 on success.
+
+  DbLog::flush
+       The DbLog::flush method guarantees that  all  log  records
+       whose  DbLsns  are less than or equal to the lsn parameter
+       have been written to disk.  If lsn is NULL, all records in
+       the log are flushed.
+
+       The DbLog::flush method throws a DbException(3) or returns
+       the value of errno on failure and 0 on success.
+
+  DbLog::get
+       The DbLog::get method implements a cursor  inside  of  the
+       log,  retrieving records from the log according to the lsn
+       and flags parameters.
+
+       The data field of the data object is  set  to  the  record
+       retrieved and the size field indicates the number of bytes
+       in the record.  See Dbt(3)  for  a  description  of  other
+       fields  in  the  data  object.   When multiple threads are
+       using the returned DbLog handle concurrently,  either  the
+       DB_DBT_MALLOC  or  DB_DBT_USERMEM  flags must be specified
+       for any Dbt used for data retrieval.
+
+       The flags parameter must be set  to  exactly  one  of  the
+       following values:
+
+       DB_CHECKPOINT
+            The  last  record written with the DB_CHECKPOINT flag
+            specified to the DbLog::put method is returned in the
+            data  argument.  The lsn argument is overwritten with
+            the DbLsn of the record returned.  If no  record  has
+            been  previously  written with the DB_CHECKPOINT flag
+            specified, the first record in the log is returned.
+            If the log is empty the DbLog::get method will return
+            DB_NOTFOUND.
+
+       DB_FIRST
+            The  first  record from any of the log files found in
+            the log directory is returned in the  data  argument.
+            The lsn argument is overwritten with the DbLsn of the
+            record returned.
+
+            If the log is empty the DbLog::get method will return
+            DB_NOTFOUND.
+
+       DB_LAST
+            The  last  record  in the log is returned in the data
+            argument.  The lsn argument is overwritten  with  the
+            DbLsn of the record returned.
+
+            If  the  log  is  empty,  the  DbLog::get method will
+            return DB_NOTFOUND.
+
+       DB_NEXT
+            The current log position  is  advanced  to  the  next
+            record  in the log and that record is returned in the
+            data argument.  The lsn argument is overwritten  with
+            the DbLsn of the record returned.
+
+            If the pointer has not been initialized via DB_FIRST,
+            DB_LAST, DB_SET, DB_NEXT, or DB_PREV, DbLog::get will
+            return  the first record in the log.  If the last log
+            record has already been returned or the log is empty,
+            the DbLog::get method will return DB_NOTFOUND.
+
+            If  the  log  was opened with the DB_THREAD flag set,
+            calls to DbLog::get with the DB_NEXT  flag  set  will
+            return EINVAL.
+
+       DB_PREV
+            The  current  log  position  is moved to the previous
+            record in the log and that record is returned in  the
+            data  argument.  The lsn argument is overwritten with
+            the DbLsn of the record returned.
+
+            If the pointer has not been initialized via DB_FIRST,
+            DB_LAST, DB_SET, DB_NEXT, or DB_PREV, DbLog::get will
+            return the last record in the log.  If the first  log
+            record has already been returned or the log is empty,
+            the DbLog::get method will return DB_NOTFOUND.
+
+            If the log was opened with the  DB_THREAD  flag  set,
+            calls  to  DbLog::get  with the DB_PREV flag set will
+            return EINVAL.
+
+       DB_CURRENT
+            Return the log record  currently  referenced  by  the
+            log.
+
+            If  the  log  pointer  has  not  been initialized via
+            DB_FIRST, DB_LAST, DB_SET, DB_NEXT, or DB_PREV, or if
+            the  log  was  opened  with  the  DB_THREAD flag set,
+            DbLog::get will return EINVAL.
+
+       DB_SET
+            Retrieve the record specified by  the  lsn  argument.
+            If  the  specified  DbLsn  is invalid (e.g., does not
+            appear in the log) DbLog::get will return EINVAL.
+
+       Otherwise, the DbLog::get method throws  a  DbException(3)
+       or returns the value of errno on failure and 0 on success.
+
+  DbLog::compare
+       The DbLog::compare method allows the caller to compare two
+       DbLsn's.   DbLog::compare returns 0 if the two DbLsn's are
+       equal, 1 if lsn0 is greater than lsn1, and -1 if  lsn0  is
+       less than lsn1.
+
+  DbLog::file
+       The  DbLog::file  method  maps DbLsn's to file names.  The
+       DbLog::file method copies the name of the file  containing
+       the   record   named  by  lsn  into  the  memory  location
+       referenced by namep.  (This mapping of DbLsn  to  file  is
+       needed   for  database  administration.   For  example,  a
+       transaction manager typically records the  earliest  DbLsn
+       needed  for  restart,  and  the database administrator may
+       want to archive log files to tape when they  contain  only
+       DbLsn's before the earliest one needed for restart.)
+
+       The  len  argument  is  the  length of the namep buffer in
+       bytes.  If namep is too  short  to  hold  the  file  name,
+       DbLog::file will return ENOMEM.  Note, as described above,
+       log file names  are  quite  short,  on  the  order  of  10
+       characters.
+
+       The  DbLog::file method throws a DbException(3) or returns
+       the value of errno on failure and 0 on success.
+
+  DbLog::put
+       The DbLog::put method appends records  to  the  log.   The
+       DbLsn  of the put record is returned in the lsn parameter.
+       The flags parameter may be set to  one  of  the  following
+       values:
+
+       DB_CHECKPOINT
+            The  log  should write a checkpoint record, recording
+            any information necessary to make the log  structures
+            recoverable after a crash.
+
+       DB_CURLSN
+            The  DB_LSN  of the next record to be put is returned
+            in the lsn parameter.
+
+       DB_FLUSH
+            The log is  forced  to  disk  after  this  record  is
+            written,  guaranteeing  that  all records with DbLsns
+            less than or equal to the one being put are  on  disk
+            before  this  method  returns  (this function is most
+            often used for a transaction commit, see  Db::Txn  in
+            Db (3)).
+
+       The  caller  is  responsible  for  providing any necessary
+       structure to data.  (For example, in a write-ahead logging
+       protocol,  the  application  must  understand what part of
+       data is an operation code, what part is redo  information,
+       and  what  part  is  undo  information.  In addition, most
+       transaction managers will store in data the DbLsn  of  the
+       previous  log  record for the same transaction, to support
+       chaining back through the transaction's log records during
+       undo.)
+
+       The  DbLog::put  method throws a DbException(3) or returns
+       the value of errno on failure and 0 on success.
+
+  DbLog::unlink
+       The  DbLog::unlink  method   destroys   the   log   region
+       identified  by  the directory dir, removing all files used
+       to implement the log region.  (The directory  dir  is  not
+       removed.)    If  there  are  processes  that  have  called
+       DbLog::open without calling DbLog::close (i.e., there  are
+       processes  currently  using the log region), DbLog::unlink
+       will fail without further action, unless the force flag is
+       set,  in  which  case DbLog::unlink will attempt to remove
+       the log region files regardless  of  any  processes  still
+       using the log region.
+
+       The  result  of  attempting to forcibly destroy the region
+       when  a  process  has  the  region  open  is  unspecified.
+       Processes  using  a  shared memory region maintain an open
+       file descriptor for  it.   On  UNIX  systems,  the  region
+       removal  should  succeed  and  processes that have already
+       joined the region should continue to  run  in  the  region
+       without  change,  however processes attempting to join the
+       log region will either fail or attempt  to  create  a  new
+       region.   On other systems, e.g., WNT, where the unlink(2)
+       system call will fail if any  process  has  an  open  file
+       descriptor for the file, the region removal will fail.
+
+       In  the  case  of catastrophic or system failure, database
+       recovery must  be  performed  (see  db_recover(1)  or  the
+       DB_RECOVER      and      DB_RECOVER_FATAL     flags     to
+       DbEnv::appinit(3)).  Alternatively,  if  recovery  is  not
+       required  because  no  database state is maintained across
+       failures, it is possible to  clean  up  a  log  region  by
+       removing  all  of  the files in the directory specified to
+       the DbLog::open method, as  log  region  files  are  never
+       created  in  any directory other than the one specified to
+       DbLog::open.  Note, however, that this has  the  potential
+       to remove files created by the other DB subsystems in this
+       database environment.
+
+       The  DbLog::unlink  method  throws  a  DbException(3)   or
+       returns the value of errno on failure and 0 on success.
+
+  DbLog::archive
+       The  DbLog::archive method creates a NULL-terminated array
+       of log or database file names and copies a pointer to them
+       into the user-specified memory location list.
+
+       By default, DbLog::archive returns the names of all of the
+       log files that are no  longer  in  use  (e.g.,  no  longer
+       involved in active transactions), and that may be archived
+       for  catastrophic  recovery  and  then  removed  from  the
+       system.   If there were no file names to return, list will
+       be set to NULL.
+
+       Arrays of log file names are created in allocated  memory.
+       If  db_malloc  is  non-NULL,  it is called to allocate the
+       memory, otherwise, the library function malloc(3) is used.
+       The  function db_malloc must match the calling conventions
+       of the malloc(3) library routine.  Regardless, the  caller
+       is  responsible  for deallocating the returned memory.  To
+       deallocate the returned memory, free each returned  memory
+       pointer;  pointers  inside  the  memory  do not need to be
+       individually freed.
+
+       The flags argument is specified by or'ing together one  or
+       more of the following values:
+
+       DB_ARCH_ABS
+            All  pathnames  are  returned  as absolute pathnames,
+            instead of relative to the database home directory.
+
+       DB_ARCH_DATA
+            Return the database files that need to be archived in
+            order  to  recover  the  database  from  catastrophic
+            failure.  If any of the database files have not  been
+            accessed  during  the  lifetime  of  the  current log
+            files, DbLog::archive will not include them  in  this
+            list.   It  is  also  possible that some of the files
+            referenced in the log have since  been  deleted  from
+            the system.
+
+       DB_ARCH_LOG
+            Return  all  the log file names regardless of whether
+            or not they are in use.
+
+       The  DB_ARCH_DATA  and  DB_ARCH_LOG  flags  are   mutually
+       exclusive.
+
+       The  DbLog::archive  method  throws  a  DbException(3)  or
+       returns the value of errno on failure and 0 on success.
+
+       The DbLog::archive method is based on  the  C  log_archive
+       function,  which  is  the  underlying function used by the
+       db_archive(1)  utility.   See  the  source  code  for  the
+       db_archive  utility for an example of using log_archive in
+       a UNIX environment.  See the db_archive(1) manual page for
+       more information on database archival procedures.
+
+  DbLog::db_register
+       The  DbLog::db_register  method registers a file name with
+       the log manager and copies a  file  identification  number
+       into  the  memory  location referenced by fidp.  This file
+       identification number should be used in all subsequent log
+       messages  that  refer to operations on this file.  The log
+       manager records  all  file  name  to  file  identification
+       number  mappings  at  each  checkpoint  so that a recovery
+       process can identify the file to which a record in the log
+       refers.
+
+       The  DbLog::db_register  method  is  called when an access
+       method registers the open of a file.   The  dbp  parameter
+       should  be  a  pointer  to  the  Db  object which is being
+       returned by the access method.
+
+       The type parameter should be one of the Db types specified
+       in Db::open (seeDb(3)), e.g., DB_HASH.
+
+       The  DbLog::db_register  method throws a DbException(3) or
+       returns the value of errno on failure and 0 on success.
+
+  DbLog::db_unregister
+       The DbLog::db_unregister  method  disassociates  the  file
+       name  to  file  identification number mapping for the file
+       identification number specified by the fid parameter.  The
+       file identification number may then be reused.
+
+       The DbLog::db_unregister method throws a DbException(3) or
+       returns the value of errno on failure and 0 on success.
+
+  DbLog::stat
+       The DbLog::stat function creates a  statistical  structure
+       and  copies a pointer to it into the user-specified memory
+       location.
+
+       Statistical structures are created  in  allocated  memory.
+       If  db_malloc  is  non-NULL,  it is called to allocate the
+       memory, otherwise, the library function malloc(3) is used.
+       The  function db_malloc must match the calling conventions
+       of the malloc(3) library routine.  Regardless, the  caller
+       is  responsible  for deallocating the returned memory.  To
+       deallocate the returned memory, free each returned  memory
+       pointer;  pointers  inside  the  memory  do not need to be
+       individually freed.  The log statistics are  stored  in  a
+       structure  of type DB_LOG_STAT (typedef'd in <db.h>).  The
+       following DB_LOG_STAT fields will be filled in:
+
+       u_int32_t st_magic;
+            The magic number that identifies  a  file  as  a  log
+            file.
+       u_int32_t st_version;
+            The version of the log file type.
+       u_int32_t st_refcnt;
+            The number of references to the region.
+       u_int32_t st_regsize;
+            The size of the region.
+       u_int32_t st_mode;
+            The mode of any created log files.
+       u_int32_t st_lg_max;
+            The  maximum  size  of any individual file comprising
+            the log.
+       u_int32_t st_written;
+            The total number of bytes written to this log.
+       u_int32_t st_written_chkpt;
+            The  number  of  bytes   written   since   the   last
+            checkpoint.
+       u_int32_t st_region_wait;
+            The number of times that a process was able to obtain
+            the region lock without waiting.
+       u_int32_t st_region_nowait;
+            The number of times that a process was forced to wait
+            before obtaining the region lock.
+
+
+
+

LOG FILE LIMITS

+       Log file sizes impose a time limit on the length of time a
+       database may be  accessed  under  transaction  protection,
+       before  it needs to be dumped and reloaded (see db_dump(3)
+       and   db_load(3)).    Unfortunately,   the   limits    are
+       potentially difficult to calculate.
+
+       The log file name consists of "log." followed by 5 digits,
+       resulting in a maximum of 99,999 log files.   Consider  an
+       application performing 600 transactions per second, for 15
+       hours a day,  logged  into  10Mb  log  files,  where  each
+       transaction  is  logging  approximately 100 bytes of data.
+       The calculation:
+
+              (10 * 2^20 * 99999) /
+                   (600 * 60 * 60 * 15 * 100) = 323.63
+
+       indicates that the system will run out of log  file  space
+       in  roughly  324 days.  If we increase the maximum size of
+       the  files  from  10Mb  to  100Mb,  the  same  calculation
+       indicates  that  the  application will run out of log file
+       space in roughly 9 years.
+
+       There is no way to  reset  the  log  file  name  space  in
+       Berkeley  DB.   If your application is reaching the end of
+       its log file name space, you should:
+
+       1.   Archive  your  databases  as  if   to   prepare   for
+            catastrophic  failure  (see  db_archive(1)  for  more
+            information).
+
+       2.   Dump and re-load all your databases  (see  db_dump(1)
+            and db_load(1) for more information).
+
+       3.   Remove  all  of  the  log  files  from  the  database
+            environment (see db_archive(1) for more information).
+
+       4.   Restart your applications.
+
+
+
+

ENVIRONMENT VARIABLES

+       The  following  environment variables affect the execution
+       of db_log:
+
+       DB_HOME
+            If the dbenv argument to DbLog::open was  initialized
+            using  db_appinit,  the  environment variable DB_HOME
+            may be used as the path of the database home for  the
+            interpretation of the dir argument to DbLog::open, as
+            described    in     db_appinit(3).      Specifically,
+            DbLog::open  is  affected by the configuration string
+            value of DB_LOG_DIR.
+
+       TMPDIR
+            If the dbenv argument to DbLog::open was NULL or  not
+            initialized   using   db_appinit,   the   environment
+            variable TMPDIR may be used as the directory in which
+            to  create  the  log, as described in the DbLog::open
+            section above.
+
+
+
+

ERRORS

+       Methods marked as returning errno will, by default,  throw
+       an exception that encapsulates the error information.  The
+       default error behavior can be changed, see DbException(3).
+
+       The DbLog::open method may fail and throw a DbException(3)
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: DbLog::close(3),
+       DbLog::unlink(3), atoi(3), close(2), db_version(3),
+       fcntl(2), fflush(3), lseek(2), malloc(3), memcpy(3),
+       memset(3), mmap(2), munmap(2), open(2), opendir(3),
+       read(2), readdir(3), realloc(3), sigfillset(3),
+       sigprocmask(2), stat(2), strchr(3), strcpy(3), strdup(3),
+       strerror(3), strlen(3), strncmp(3), unlink(2), and
+       write(2).
+
+       In addition, the DbLog::open method may fail and  throw  a
+       DbException(3)   or   return   errno   for  the  following
+       conditions:
+
+       [EAGAIN]
+            The shared memory region was locked and  (repeatedly)
+            unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The  DB_THREAD  flag  was specified and spinlocks are
+            not implemented for this architecture.
+
+            The specified file size was too large.
+
+       The   DbLog::close   method   may   fail   and   throw   a
+       DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: close(2), fcntl(2),
+       fflush(3), munmap(2), and strerror(3).
+
+       The   DbLog::flush   method   may   fail   and   throw   a
+       DbException(3)
+
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: close(2), fcntl(2),
+       fflush(3), fsync(2), lseek(2), malloc(3), memcpy(3),
+       memset(3), open(2), sigfillset(3), sigprocmask(2),
+       stat(2), strcpy(3), strdup(3), strerror(3), strlen(3),
+       unlink(2), and write(2).
+
+       In  addition, the DbLog::flush method may fail and throw a
+       DbException(3)  or  return   errno   for   the   following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       The DbLog::get method may fail and throw a DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: atoi(3), close(2),
+       fcntl(2), fflush(3), lseek(2), malloc(3), memcpy(3),
+       memset(3), open(2), opendir(3), read(2), readdir(3),
+       realloc(3), sigfillset(3), sigprocmask(2), stat(2),
+       strchr(3), strcpy(3), strdup(3), strerror(3), strlen(3),
+       strncmp(3), and unlink(2).
+
+       In  addition,  the  DbLog::get method may fail and throw a
+       DbException(3)  or  return   errno   for   the   following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The DB_FIRST flag was specified and no log files were
+            found.
+
+       The DbLog::file method may fail and throw a DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: close(2), fcntl(2),
+       fflush(3), malloc(3), memcpy(3), memset(3), open(2),
+       sigfillset(3), sigprocmask(2), stat(2), strcpy(3),
+       strdup(3), strerror(3), strlen(3), and unlink(2).
+
+       In  addition,  the DbLog::file method may fail and throw a
+       DbException(3)  or  return   errno   for   the   following
+       conditions:
+
+       [ENOMEM]
+            The  supplied  buffer  was  too small to hold the log
+            file name.
+
+       The DbLog::put method may fail and throw a DbException(3)
+
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: close(2), fcntl(2),
+       fflush(3), fsync(2), lseek(2), malloc(3), memcpy(3),
+       memset(3), open(2), sigfillset(3), sigprocmask(2),
+       stat(2), strcpy(3), strdup(3), strerror(3), strlen(3),
+       time(3), unlink(2), and write(2).
+
+       In  addition,  the  DbLog::put method may fail and throw a
+       DbException(3)  or  return   errno   for   the   following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The  record  to  be logged is larger than the maximum
+            log record.
+
+       The  DbLog::unlink   method   may   fail   and   throw   a
+       DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: close(2), fcntl(2),
+       fflush(3), malloc(3), memcpy(3), memset(3), mmap(2),
+       munmap(2), open(2), sigfillset(3), sigprocmask(2),
+       stat(2), strcpy(3), strdup(3), strerror(3), strlen(3), and
+       unlink(2).
+
+       In addition, the DbLog::unlink method may fail and throw a
+       DbException(3)   or   return   errno   for  the  following
+       conditions:
+
+       [EBUSY]
+            The shared memory region was in  use  and  the  force
+            flag was not set.
+
+       The   DbLog::archive   method   may   fail   and  throw  a
+       DbException(3)
+
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: DbLog::compare(3),
+       DbLog::get(3), close(2), fcntl(2), fflush(3), getcwd(3),
+       malloc(3), memcpy(3), memset(3), open(2), qsort(3),
+       realloc(3), sigfillset(3), sigprocmask(2), stat(2),
+       strchr(3), strcmp(3), strcpy(3), strdup(3), strerror(3),
+       strlen(3), and unlink(2).
+
+       In addition, the DbLog::archive method may fail and  throw
+       a   DbException(3)  or  return  errno  for  the  following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The log was corrupted.
+
+       The  DbLog::db_register  method  may  fail  and  throw   a
+       DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: close(2), fcntl(2),
+       fflush(3), fsync(2), lseek(2), malloc(3), memcmp(3),
+       memcpy(3), memset(3), open(2), realloc(3), sigfillset(3),
+       sigprocmask(2), stat(2), strcpy(3), strdup(3),
+       strerror(3), strlen(3), time(3), unlink(2), and  write(2).
+
+       In  addition,  the  DbLog::db_register method may fail and
+       throw a DbException(3) or return errno for  the  following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       The  DbLog::db_unregister  method  may  fail  and  throw a
+       DbException(3)
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: close(2), fcntl(2),
+       fflush(3), fsync(2), lseek(2), malloc(3), memcpy(3),
+       memset(3), open(2), sigfillset(3), sigprocmask(2),
+       stat(2), strcpy(3), strdup(3), strerror(3), strlen(3),
+       time(3), unlink(2), and write(2).
+
+       In  addition, the DbLog::db_unregister method may fail and
+       throw a DbException(3) or return errno for  the  following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+
+
+

BUGS

+       The  log  files  are not machine architecture independent.
+       Specifically, their metadata are not  stored  in  a  fixed
+       byte order.
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), DbMpoolFile(3), Dbt(3), DbTxn(3),
+       DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/DbLog.j.html b/mozilla/db/man/man.html/DbLog.j.html new file mode 100644 index 00000000000..568beab7e3d --- /dev/null +++ b/mozilla/db/man/man.html/DbLog.j.html @@ -0,0 +1,748 @@ + + +DbLog + + +

DbLog

+
+
+
+       import com.sleepycat.db.*;
+
+       public static DbLog open(String dir, int flags, int mode, DbEnv dbenv)
+            throws DbException;
+
+       public void close()
+            throws DbException;
+
+       public static int compare(DbLsn lsn0, DbLsn lsn1);
+
+       public String file(DbLsn lsn)
+            throws DbException;
+
+       public void flush(DbLsn lsn)
+            throws DbException;
+
+       public void get(DbLsn lsn, Dbt data, int flags)
+            throws DbException;
+
+       public void put(DbLsn lsn, Dbt data, int flags)
+            throws DbException;
+
+       public DbLogStat stat()
+            throws DbException;
+
+       public int db_register(Db dbp, String name, int dbtype)
+            throws DbException;
+
+       public void db_unregister(int fid)
+            throws DbException;
+
+       public static void unlink(String dir, int force, DbEnv dbenv)
+            throws DbException;
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the specific details of the log
+       class.
+
+       This  class  provide  a  general-purpose  logging facility
+       sufficient for transaction management.  Logs can be shared
+       by multiple processes.
+
+       The  DB  transaction  log  is  represented  by a directory
+       containing a set of files.  The log is a  record-oriented,
+       append-only file, with records identified and accessed via
+       DbLsn's (database log sequence numbers).
+
+       DbLsn's are returned on each DbLog.put operation, and only
+       those  DbLsn's  returned by DbLog.put can later be used to
+       retrieve records from the log.
+
+  DbLog.open
+       The DbLog.open method returns  a  log  identified  by  the
+       directory dir.
+
+       If  the dbenv argument to DbLog.open was initialized using
+       DbEnv.appinit,  dir  is  interpreted   as   described   by
+       DbEnv(3).
+
+       Otherwise,  if dir is not null, it is interpreted relative
+       to the current working directory of the process.   If  dir
+       is  null,  the following environment variables are checked
+       in order: ``TMPDIR'', ``TEMP'', and ``TMP''.   If  one  of
+       them  is  set,  log  files  are  created  relative  to the
+       directory it specifies.  If none  of  them  are  set,  the
+       first  possible  one of the following directories is used:
+       /var/tmp, /usr/tmp, /temp, /tmp, C:/temp and C:/tmp.
+
+       All files associated with the  log  are  created  in  this
+       directory.    This   directory  must  already  exist  when
+       DbLog.open is called.  If  the  log  already  exists,  the
+       process  must  have  permission  to  read  and  write  the
+       existing files.  If the log does not already exist, it  is
+       optionally created and initialized.
+
+       If  the  log  region  is  being  created and log files are
+       already present,  the  log  files  are  ``recovered''  and
+       subsequent  log writes are appended to the end of the log.
+
+       The log is stored in one or more files  in  the  specified
+       directory.  Each file is named using the format
+
+            log.NNNNN
+
+       where  ``NNNNN'' is the sequence number of the file within
+       the log.
+
+       The flags and mode arguments specify  how  files  will  be
+       opened  and/or created when they don't already exist.  The
+       flags value is specified by or'ing together one or more of
+       the following values:
+
+       Db.DB_CREATE
+            Create  any  underlying  files, as necessary.  If the
+            files do not already exist and the DB_CREATE flag  is
+            not specified, the call will fail.
+
+       Db.DB_THREAD
+            Cause  the  DbLog  handle  returned by the DbLog.open
+            method to be useable by  multiple  threads  within  a
+            single  address space, i.e., to be ``free-threaded''.
+            Threading is assumed in the Java API, so  no  special
+            flags  are  required,  and  DB  functions will always
+            behave as if the DB_THREAD flag was specified.
+
+       All files created by the log subsystem  are  created  with
+       mode  mode  (as described in chmod(2)) and modified by the
+       process'  umask  value  at  the  time  of  creation   (see
+       umask(2)).   The group ownership of created files is based
+       on the system and directory defaults, and is  not  further
+       specified by DB.
+
+       The  logging  subsystem  is  configured based on which set
+       methods have been used.  It is expected that  applications
+       will  use  a single DbEnv object as the argument to all of
+       the subsystems in the DB package.  The fields of the DbEnv
+       object   used  by  DbLog.open  are  described  below.   As
+       references to  the  DbEnv  object  may  be  maintained  by
+       DbLog.open,  it  is  necessary  that  the DbEnv object and
+       memory  it  references  be  valid  until  the  object   is
+       destroyed.    Any   of  the  DbEnv  fields  that  are  not
+       explicitly set will default to appropriate values.
+
+       The  following  fields  in  the  DbEnv   object   may   be
+       initialized,  using  the  appropriate  set  method, before
+       calling DbLog.open:
+
+       DbErrcall db_errcall;
+       String db_errpfx;
+       int db_verbose;
+            The error fields of the DbEnv behave as described for
+            DbEnv(3).   void *(*db_errcall)(char *db_errpfx, char
+            *buffer);
+
+       FILE *db_errfile;
+       const char *db_errpfx;
+       int db_verbose;
+            The error fields of the DB_ENV  behave  as  described
+            for db_appinit(3).
+
+       int lg_max;
+            The  maximum  size  of  a  single  file  in  the log.
+            Because  DbLsn  file  offsets  are  unsigned   4-byte
+            values,  lg_max  may  not  be larger than the maximum
+            unsigned 4-byte value.
+
+            If lg_max is 0, a default value is used.
+
+            See the section "LOG FILE LIMITS" below, for  further
+            information.
+
+       The   DbLog.open   method  throws  a  DbException(3)  that
+       encapsulates an errno on failure.
+
+  DbLog.close
+       The DbLog.close method closes the log associated with  the
+       DbLog object.
+
+       In  addition,  if  the dir argument to DbLog.open was null
+       and dbenv was not  initialized  using  DbEnv.appinit,  all
+       files  created  for this shared region will be removed, as
+       if DbLog.unlink were called.
+
+       When  multiple  threads  are  using   the   DbLog   handle
+       concurrently,   only   a   single   thread  may  call  the
+       DbLog.close method.
+
+       The  DbLog.close  method  throws  a  DbException(3)   that
+       encapsulates an errno on failure.
+
+  DbLog.flush
+       The  DbLog.flush  method  guarantees  that all log records
+       whose DbLsns are less than or equal to the  lsn  parameter
+       have been written to disk.  If lsn is null, all records in
+       the log are flushed.
+
+       The  DbLog.flush  method  throws  a  DbException(3)   that
+       encapsulates an errno on failure.
+
+  DbLog.get
+       The  DbLog.get  method  implements  a cursor inside of the
+       log, retrieving records from the log according to the  lsn
+       and flags parameters.
+
+       The  data  field  of  the data object is set to the record
+       retrieved and the size field indicates the number of bytes
+       in  the  record.   See  Dbt(3)  for a description of other
+       fields in the data  object.   When  multiple  threads  are
+       using  the  returned DbLog handle concurrently, either the
+       DB_DBT_MALLOC or DB_DBT_USERMEM flags  must  be  specified
+       for any Dbt used for data retrieval.
+
+       The  flags  parameter  must  be  set to exactly one of the
+       following values:
+
+       Db.DB_CHECKPOINT
+            The last record written with the  DB_CHECKPOINT  flag
+            specified  to the DbLog.put method is returned in the
+            data argument.  The lsn argument is overwritten  with
+            the  DbLsn  of the record returned.  If no record has
+            been previously written with the  DB_CHECKPOINT  flag
+            specified, the first record in the log is returned.
+
+            If  the log is empty the DbLog.get method will return
+            DB_NOTFOUND.
+
+       Db.DB_FIRST
+            The first record from any of the log files  found  in
+            the  log  directory is returned in the data argument.
+            The lsn argument is overwritten with the DbLsn of the
+            record returned.
+
+            If  the log is empty the DbLog.get method will return
+            DB_NOTFOUND.
+
+       Db.DB_LAST
+            The last record in the log is returned  in  the  data
+            argument.   The  lsn argument is overwritten with the
+            DbLsn of the record returned.
+
+            If the log is empty, the DbLog.get method will return
+            DB_NOTFOUND.
+
+       Db.DB_NEXT
+            The  current  log  position  is  advanced to the next
+            record in the log and that record is returned in  the
+            data  argument.  The lsn argument is overwritten with
+            the DbLsn of the record returned.
+
+            If the pointer has not been initialized via DB_FIRST,
+            DB_LAST,  DB_SET, DB_NEXT, or DB_PREV, DbLog.get will
+            return the first record in the log.  If the last  log
+            record has already been returned or the log is empty,
+            the DbLog.get method will return DB_NOTFOUND.
+
+            If the log was opened with the  DB_THREAD  flag  set,
+            calls  to  DbLog.get  with  the DB_NEXT flag set will
+            return EINVAL.
+
+       Db.DB_PREV
+            The current log position is  moved  to  the  previous
+            record  in the log and that record is returned in the
+            data argument.  The lsn argument is overwritten  with
+            the DbLsn of the record returned.
+
+            If the pointer has not been initialized via DB_FIRST,
+            DB_LAST, DB_SET, DB_NEXT, or DB_PREV, DbLog.get  will
+            return  the last record in the log.  If the first log
+            record has already been returned or the log is empty,
+            the DbLog.get method will return DB_NOTFOUND.
+
+            If  the  log  was opened with the DB_THREAD flag set,
+            calls to DbLog.get with the  DB_PREV  flag  set  will
+            return EINVAL.
+
+       Db.DB_CURRENT
+            Return  the  log  record  currently referenced by the
+            log.
+
+            If the log  pointer  has  not  been  initialized  via
+            DB_FIRST, DB_LAST, DB_SET, DB_NEXT, or DB_PREV, or if
+            the log was  opened  with  the  DB_THREAD  flag  set,
+            DbLog.get will return EINVAL.
+
+       Db.DB_SET
+            Retrieve  the  record  specified by the lsn argument.
+            If the specified DbLsn is  invalid  (e.g.,  does  not
+            appear in the log) DbLog.get will return EINVAL.
+
+       Otherwise,  the  DbLog.get  method throws a DbException(3)
+       that encapsulates an errno on failure,
+
+  DbLog.compare
+       The DbLog.compare method allows the caller to compare  two
+       DbLsn's.   DbLog.compare  returns 0 if the two DbLsn's are
+       equal, 1 if lsn0 is greater than lsn1, and -1 if  lsn0  is
+       less than lsn1.
+
+  DbLog.file
+       The  DbLog.file  method  maps  DbLsn's to file names.  The
+       DbLog.file method returns the name of the file  containing
+       the  record  named by lsn.  (This mapping of DbLsn to file
+       is needed for database  administration.   For  example,  a
+       transaction  manager  typically records the earliest DbLsn
+       needed for restart, and  the  database  administrator  may
+       want  to  archive log files to tape when they contain only
+       DbLsn's before the earliest one needed for restart.)
+
+       The  DbLog.file  method  throws  a   DbException(3)   that
+       encapsulates an errno on failure.
+
+  DbLog.put
+       The  DbLog.put  method  appends  records  to the log.  The
+       DbLsn of the put record is returned in the lsn  parameter.
+       The  flags  parameter  may  be set to one of the following
+       values:
+
+       Db.DB_CHECKPOINT
+            The log should write a checkpoint  record,  recording
+            any  information necessary to make the log structures
+            recoverable after a crash.
+
+       Db.DB_CURLSN
+            The DB_LSN of the next record to be put  is  returned
+            in the lsn parameter.
+
+       Db.DB_FLUSH
+            The  log  is  forced  to  disk  after  this record is
+            written, guaranteeing that all  records  with  DbLsns
+            less  than  or equal to the one being put are on disk
+            before this method returns  (this  function  is  most
+            often used for a transaction commit, see Db.Txn in Db
+            (3)).
+
+       The caller is  responsible  for  providing  any  necessary
+       structure to data.  (For example, in a write-ahead logging
+       protocol, the application must  understand  what  part  of
+       data  is an operation code, what part is redo information,
+       and what part is  undo  information.   In  addition,  most
+       transaction  managers  will store in data the DbLsn of the
+       previous log record for the same transaction,  to  support
+       chaining back through the transaction's log records during
+       undo.)
+
+       The  DbLog.put  method  throws   a   DbException(3)   that
+       encapsulates an errno on failure.
+
+  DbLog.unlink
+       The DbLog.unlink method destroys the log region identified
+       by the directory dir, removing all files used to implement
+       the  log  region.  (The directory dir is not removed.)  If
+       there are processes that have  called  DbLog.open  without
+       calling  DbLog.close  (i.e., there are processes currently
+       using the log  region),  DbLog.unlink  will  fail  without
+       further  action,  unless  the  force flag is set, in which
+       case DbLog.unlink will attempt to remove  the  log  region
+       files  regardless  of  any  processes  still using the log
+       region.
+
+       The result of attempting to forcibly  destroy  the  region
+       when  a  process  has  the  region  open  is  unspecified.
+       Processes using a shared memory region  maintain  an  open
+       file  descriptor  for  it.   On  UNIX  systems, the region
+       removal should succeed and  processes  that  have  already
+       joined  the  region  should  continue to run in the region
+       without change, however processes attempting to  join  the
+       log  region  will  either  fail or attempt to create a new
+       region.  On other systems, e.g., WNT, where the  unlink(2)
+       system  call  will  fail  if  any process has an open file
+       descriptor for the file, the region removal will fail.
+
+       In the case of catastrophic or  system  failure,  database
+       recovery  must  be  performed  (see  db_recover(1)  or the
+       DB_RECOVER     and     DB_RECOVER_FATAL      flags      to
+       DbEnv.appinit(3)).   Alternatively,  if  recovery  is  not
+       required because no database state  is  maintained  across
+       failures,  it  is  possible  to  clean  up a log region by
+       removing all of the files in the  directory  specified  to
+       the  DbLog.open  method,  as  log  region  files are never
+       created in any directory other than the one  specified  to
+       DbLog.open.  Note, however, that this has the potential to
+       remove files created by the other DB  subsystems  in  this
+       database environment.
+
+       The  DbLog.unlink  method  throws  a  DbException(3)  that
+       encapsulates an errno on failure.
+
+  DbLog.archive
+       The DbLog.archive method creates and returns an  array  of
+       log or database file names.
+
+       By  default, DbLog.archive returns the names of all of the
+       log files that are no  longer  in  use  (e.g.,  no  longer
+       involved in active transactions), and that may be archived
+       for  catastrophic  recovery  and  then  removed  from  the
+       system.   If there were no file names to return, list will
+       be set to null.
+
+       The flags argument is specified by or'ing together one  or
+       more of the following values:
+
+       Db.DB_ARCH_ABS
+            All  pathnames  are  returned  as absolute pathnames,
+            instead of relative to the database home directory.
+
+       Db.DB_ARCH_DATA
+            Return the database files that need to be archived in
+            order  to  recover  the  database  from  catastrophic
+            failure.  If any of the database files have not  been
+            accessed  during  the  lifetime  of  the  current log
+            files, DbLog.archive will not include  them  in  this
+            list.   It  is  also  possible that some of the files
+            referenced in the log have since  been  deleted  from
+            the system.
+
+       Db.DB_ARCH_LOG
+            Return  all  the log file names regardless of whether
+            or not they are in use.
+
+       The  DB_ARCH_DATA  and  DB_ARCH_LOG  flags  are   mutually
+       exclusive.
+
+       The  DbLog.archive  method  throws  a  DbException(3) that
+       encapsulates an errno on failure.
+       The DbLog.archive method is based  on  the  C  log_archive
+       function,  which  is  the  underlying function used by the
+       db_archive(1)  utility.   See  the  source  code  for  the
+       db_archive  utility for an example of using log_archive in
+       a UNIX environment.  See the db_archive(1) manual page for
+       more information on database archival procedures.
+
+  DbLog.db_register
+       The  DbLog.db_register  method  registers a file name with
+       the log manager and returns a file identification  number.
+       This  file  identification  number  should  be used in all
+       subsequent log messages that refer to operations  on  this
+       file.   The  log  manager  records  all  file name to file
+       identification number mappings at each checkpoint so  that
+       a recovery process can identify the file to which a record
+       in the log refers.
+
+       The DbLog.db_register method  is  called  when  an  access
+       method  registers  the  open of a file.  The dbp parameter
+       should be a Db object  which  is  being  returned  by  the
+       access method.
+
+       The type parameter should be one of the Db types specified
+       in Db.open (seeDb(3)), e.g., DB_HASH.
+
+       The DbLog.db_register method throws a DbException(3)  that
+       encapsulates an errno on failure.
+
+  DbLog.db_unregister
+       The DbLog.db_unregister method disassociates the file name
+       to  file  identification  number  mapping  for  the   file
+       identification number specified by the fid parameter.  The
+       file identification number may then be reused.
+
+       The DbLog.db_unregister  method  throws  a  DbException(3)
+       that encapsulates an errno on failure.
+
+  DbLog.stat
+       The  DbLog.stat  function  creates a statistical structure
+       and returns it to the caller.
+
+       The log statistics are stored in a DbLogStat object.  Data
+       fields in DbLogStat can be accessed via get methods.
+
+       int get_st_magic();
+            The  magic  number  that  identifies  a file as a log
+            file.
+       int get_st_version();
+            The version of the log file type.
+       int get_st_refcnt();
+            The number of references to the region.
+       int get_st_regsize();
+            The size of the region.
+
+       int get_st_mode();
+            The mode of any created log files.
+       int get_st_lg_max();
+            The maximum size of any  individual  file  comprising
+            the log.
+       int get_st_written();
+            The total number of bytes written to this log.
+       int get_st_written_chkpt();
+            The   number   of   bytes   written  since  the  last
+            checkpoint.
+       int get_st_region_wait();
+            The number of times that a process was able to obtain
+            the region lock without waiting.
+       int get_st_region_nowait();
+            The number of times that a process was forced to wait
+            before obtaining the region lock.
+
+
+
+

LOG FILE LIMITS

+       Log file sizes impose a time limit on the length of time a
+       database  may  be  accessed  under transaction protection,
+       before it needs to be dumped and reloaded (see  db_dump(3)
+       and    db_load(3)).    Unfortunately,   the   limits   are
+       potentially difficult to calculate.
+
+       The log file name consists of "log." followed by 5 digits,
+       resulting  in  a maximum of 99,999 log files.  Consider an
+       application performing 600 transactions per second, for 15
+       hours  a  day,  logged  into  10Mb  log  files, where each
+       transaction is logging approximately 100  bytes  of  data.
+       The calculation:
+
+              (10 * 2^20 * 99999) /
+                   (600 * 60 * 60 * 15 * 100) = 323.63
+
+       indicates  that  the system will run out of log file space
+       in roughly 324 days.  If we increase the maximum  size  of
+       the  files  from  10Mb  to  100Mb,  the  same  calculation
+       indicates that the application will run out  of  log  file
+       space in roughly 9 years.
+
+       There  is  no  way  to  reset  the  log file name space in
+       Berkeley DB.  If your application is reaching the  end  of
+       its log file name space, you should:
+
+       1.   Archive   your   databases   as  if  to  prepare  for
+            catastrophic  failure  (see  db_archive(1)  for  more
+            information).
+
+       2.   Dump  and  re-load all your databases (see db_dump(1)
+            and db_load(1) for more information).
+
+       3.   Remove  all  of  the  log  files  from  the  database
+            environment (see db_archive(1) for more information).
+
+       4.   Restart your applications.
+
+
+
+

ENVIRONMENT VARIABLES

+       The following environment variables affect  the  execution
+       of db_log:
+
+       DB_HOME
+            If  the  dbenv argument to DbLog.open was initialized
+            using db_appinit, the  environment  variable  DB_HOME
+            may  be used as the path of the database home for the
+            interpretation of the dir argument to DbLog.open,  as
+            described in db_appinit(3).  Specifically, DbLog.open
+            is affected by  the  configuration  string  value  of
+            DB_LOG_DIR.
+
+       TMPDIR
+            If  the  dbenv argument to DbLog.open was null or not
+            initialized   using   db_appinit,   the   environment
+            variable TMPDIR may be used as the directory in which
+            to create the log, as  described  in  the  DbLog.open
+            section above.
+
+
+
+

ERRORS

+       The  DbLog.open method may fail and throw a DbException(3)
+       for any of the errors specified for the following  DB  and
+       library functions: DbLog.close(3), DbLog.unlink(3),
+       atoi(3), close(2), db_version(3), fcntl(2), fflush(3),
+       lseek(2), malloc(3), memcpy(3), memset(3), mmap(2),
+       munmap(2), open(2), opendir(3), read(2), readdir(3),
+       realloc(3), sigfillset(3), sigprocmask(2), stat(2),
+       strchr(3), strcpy(3), strdup(3), strerror(3), strlen(3),
+       strncmp(3), unlink(2), and write(2).
+
+       In  addition,  the  DbLog.open method may fail and throw a
+       DbException(3) encapsulating an errno  for  the  following
+       conditions:
+
+       [EAGAIN]
+            The  shared memory region was locked and (repeatedly)
+            unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The DB_THREAD flag was specified  and  spinlocks  are
+            not implemented for this architecture.
+
+            The specified file size was too large.
+
+       The DbLog.close method may fail and throw a DbException(3)
+       for any of the errors specified for the following  DB  and
+       library functions: close(2), fcntl(2), fflush(3),
+       munmap(2), and strerror(3).
+
+       The DbLog.flush method may fail and throw a DbException(3)
+       for  any  of the errors specified for the following DB and
+       library functions: close(2), fcntl(2), fflush(3),
+       fsync(2), lseek(2), malloc(3), memcpy(3), memset(3),
+       open(2), sigfillset(3), sigprocmask(2), stat(2),
+       strcpy(3), strdup(3), strerror(3), strlen(3), unlink(2),
+       and write(2).
+
+       In addition, the DbLog.flush method may fail and  throw  a
+       DbException(3)  encapsulating  an  errno for the following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       The DbLog.get method may fail and throw  a  DbException(3)
+       for  any  of the errors specified for the following DB and
+       library functions: atoi(3), close(2), fcntl(2), fflush(3),
+       lseek(2), malloc(3), memcpy(3), memset(3), open(2),
+       opendir(3), read(2), readdir(3), realloc(3),
+       sigfillset(3), sigprocmask(2), stat(2), strchr(3),
+       strcpy(3), strdup(3), strerror(3), strlen(3), strncmp(3),
+       and unlink(2).
+
+       In  addition,  the  DbLog.get  method may fail and throw a
+       DbException(3) encapsulating an errno  for  the  following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The DB_FIRST flag was specified and no log files were
+            found.
+
+       The DbLog.file method may fail and throw a  DbException(3)
+       for  any  of the errors specified for the following DB and
+       library functions: close(2), fcntl(2), fflush(3),
+       malloc(3), memcpy(3), memset(3), open(2), sigfillset(3),
+       sigprocmask(2), stat(2), strcpy(3), strdup(3),
+       strerror(3), strlen(3), and unlink(2).
+
+       In  addition,  the  DbLog.file method may fail and throw a
+       DbException(3) encapsulating an errno  for  the  following
+       conditions:
+
+       [ENOMEM]
+            The  supplied  buffer  was  too small to hold the log
+            file name.
+
+       The DbLog.put method may fail and throw  a  DbException(3)
+       for  any  of the errors specified for the following DB and
+       library functions: close(2), fcntl(2), fflush(3),
+       fsync(2), lseek(2), malloc(3), memcpy(3), memset(3),
+       open(2), sigfillset(3), sigprocmask(2), stat(2),
+       strcpy(3), strdup(3), strerror(3), strlen(3), time(3),
+       unlink(2), and write(2).
+
+       In addition, the DbLog.put method may  fail  and  throw  a
+       DbException(3)  encapsulating  an  errno for the following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The record to be logged is larger  than  the  maximum
+            log record.
+
+       The   DbLog.unlink   method   may   fail   and   throw   a
+       DbException(3) for any of the  errors  specified  for  the
+       following DB and library functions: close(2), fcntl(2),
+       fflush(3), malloc(3), memcpy(3), memset(3), mmap(2),
+       munmap(2), open(2), sigfillset(3), sigprocmask(2),
+       stat(2), strcpy(3), strdup(3), strerror(3), strlen(3), and
+       unlink(2).
+
+       In  addition, the DbLog.unlink method may fail and throw a
+       DbException(3) encapsulating an errno  for  the  following
+       conditions:
+
+       [EBUSY]
+            The  shared  memory  region  was in use and the force
+            flag was not set.
+
+       The  DbLog.archive   method   may   fail   and   throw   a
+       DbException(3)  for  any  of  the errors specified for the
+       following DB and library functions: DbLog.compare(3),
+       DbLog.get(3), close(2), fcntl(2), fflush(3), getcwd(3),
+       malloc(3), memcpy(3), memset(3), open(2), qsort(3),
+       realloc(3), sigfillset(3), sigprocmask(2), stat(2),
+       strchr(3), strcmp(3), strcpy(3), strdup(3), strerror(3),
+       strlen(3), and unlink(2).
+
+       In addition, the DbLog.archive method may fail and throw a
+       DbException(3) encapsulating an errno  for  the  following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The log was corrupted.
+
+       The   DbLog.db_register   method  may  fail  and  throw  a
+       DbException(3) for any of the  errors  specified  for  the
+       following DB and library functions: close(2), fcntl(2),
+       fflush(3), fsync(2), lseek(2), malloc(3), memcmp(3),
+       memcpy(3), memset(3), open(2), realloc(3), sigfillset(3),
+       sigprocmask(2), stat(2), strcpy(3), strdup(3),
+       strerror(3),  strlen(3), time(3), unlink(2), and write(2).
+       In addition, the DbLog.db_register  method  may  fail  and
+       throw  a  DbException(3)  encapsulating  an  errno for the
+       following conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       The  DbLog.db_unregister  method  may  fail  and  throw  a
+       DbException(3)  for  any  of  the errors specified for the
+       following DB and library functions: close(2), fcntl(2),
+       fflush(3), fsync(2), lseek(2), malloc(3), memcpy(3),
+       memset(3), open(2), sigfillset(3), sigprocmask(2),
+       stat(2), strcpy(3), strdup(3), strerror(3), strlen(3),
+       time(3), unlink(2), and write(2).
+
+       In addition, the DbLog.db_unregister method may  fail  and
+       throw  a  DbException(3)  encapsulating  an  errno for the
+       following conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+
+
+

BUGS

+       The log files are not  machine  architecture  independent.
+       Specifically,  their  metadata  are  not stored in a fixed
+       byte order.
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), Dbt(3), DbTxn(3), DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/DbLsn.html b/mozilla/db/man/man.html/DbLsn.html new file mode 100644 index 00000000000..b7927262c1c --- /dev/null +++ b/mozilla/db/man/man.html/DbLsn.html @@ -0,0 +1,52 @@ + + +DbLsn + + +

DbLsn

+
+
+
+       #include <db_cxx.h>
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the DbLsn class.
+
+       A  DbLsn  is  a  "log  sequence  number"  that  is   fully
+       encapsulated.  The class itself has no methods, other than
+       a default constructor, so there is no way for the user  to
+       manipulate  its data directly.  It is initialized and used
+       by methods in  DbLog(3)  and  DbMpool(3).   These  methods
+       always accept a pointer to a DbLsn.
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), DbMpoolFile(3), Dbt(3), DbTxn(3),
+       DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/DbLsn.j.html b/mozilla/db/man/man.html/DbLsn.j.html new file mode 100644 index 00000000000..6e06496967d --- /dev/null +++ b/mozilla/db/man/man.html/DbLsn.j.html @@ -0,0 +1,50 @@ + + +DbLsn + + +

DbLsn

+
+
+
+       import com.sleepycat.db.*;
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the DbLsn class.
+
+       A  DbLsn  is  a  "log  sequence  number"  that  is   fully
+       encapsulated.  The class itself has no methods, other than
+       a default constructor, so there is no way for the user  to
+       manipulate  its data directly.  It is initialized and used
+       by methods in DbLog(3) and DbMpool(3).
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), Dbt(3), DbTxn(3), DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/DbMpool.html b/mozilla/db/man/man.html/DbMpool.html new file mode 100644 index 00000000000..6aef2454a4b --- /dev/null +++ b/mozilla/db/man/man.html/DbMpool.html @@ -0,0 +1,600 @@ + + +DbMpool + + +

DbMpool

+
+
+
+       #include <db_cxx.h>
+
+       static int
+       DbMpool::open(char *dir,
+            u_int32_t flags, int mode, DbEnv *dbenv, DbMpool **regionp);
+
+       int
+       DbMpool::close();
+
+       static int
+       DbMpool::unlink(const char *dir, int force, DbEnv *);
+
+       int
+       DbMpool::db_register(int ftype,
+            int (*pgin)(db_pgno_t pgno, void *pgaddr, Dbt *pgcookie),
+            int (*pgout)(db_pgno_t pgno, void *pgaddr, Dbt *pgcookie));
+
+       int
+       DbMpool::trickle(int pct, int *nwrotep);
+
+       int
+       DbMpool::sync(LSN *lsn);
+
+       int
+       DbMpool::stat(DB_MPOOL_STAT **gsp,
+            DB_MPOOL_FSTAT *(*fsp)[], void *(*db_malloc)(size_t));
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the  specific  details  of  the
+       memory pool interface.
+
+       The  DbMpool(3) and DbMpoolFile(3) classes are the library
+       interface  intended  to  provide  general-purpose,   page-
+       oriented  buffer  management  of one or more files.  While
+       designed to work with the other Db classes, this class  is
+       also  useful  for more general purposes.  The memory pools
+       (DbMpool's) are referred to in  this  document  as  simply
+       ``pools''.   Pools may be shared between processes.  Pools
+       are usually  filled  by  pages  from  one  or  more  files
+       (DbMpoolFile's).   Pages  in  the pool are replaced in LRU
+       (least-recently-used) order, with each new page  replacing
+       the   page  that  has  been  unused  the  longest.   Pages
+       retrieved  from  the  pool  using   DbMpoolFile::get   are
+       ``pinned''  in  the  pool,  by  default,  until  they  are
+       returned to the pool's control using the  DbMpoolFile::put
+       method.
+
+  DbMpool::open
+       The  DbMpool::open  method copies a pointer, to the memory
+       pool identified by the  directory  dir,  into  the  memory
+       location referenced by regionp.
+
+       If  the  dbenv  argument  to DbMpool::open was initialized
+       using DbEnv::appinit, dir is interpreted as  described  by
+       DbEnv(3).
+
+       Otherwise,  if dir is not NULL, it is interpreted relative
+       to the current working directory of the process.   If  dir
+       is  NULL,  the following environment variables are checked
+       in order: ``TMPDIR'', ``TEMP'', and ``TMP''.   If  one  of
+       them is set, memory pool files are created relative to the
+       directory it specifies.  If none  of  them  are  set,  the
+       first  possible  one of the following directories is used:
+       /var/tmp, /usr/tmp, /temp, /tmp, C:/temp and C:/tmp.
+
+       All files associated with the memory pool are  created  in
+       this  directory.   This  directory must already exist when
+       DbMpool::open is  called.   If  the  memory  pool  already
+       exists, the process must have permission to read and write
+       the existing files.  If the memory pool does  not  already
+       exist, it is optionally created and initialized.
+
+       The  flags  and  mode  arguments specify how files will be
+       opened and/or created when they don't already exist.   The
+       flags value is specified by or'ing together one or more of
+       the following values:
+
+       DB_CREATE
+            Create any underlying files, as  necessary.   If  the
+            files  do not already exist and the DB_CREATE flag is
+            not specified, the call will fail.
+
+       DB_MPOOL_PRIVATE
+            Create a private MPOOL that is not  shared  with  any
+            other  process  (although it may be shared with other
+            threads).
+
+       DB_NOMMAP
+            Always copy files in this memory pool into the  local
+            cache  instead  of  mapping  them into process memory
+            (see the description of the mp_mmapsize field of  the
+            DbEnv object for further information).
+
+       DB_THREAD
+            Cause    the   DbMpool   handle   returned   by   the
+            DbMpool::open  method  to  be  useable  by   multiple
+            threads  within  a  single address space, i.e., to be
+            ``free-threaded''.
+
+       All files created by the memory pool subsystem (other than
+       files   created   by  the  memp_fopen  method,  which  are
+       separately specified)  are  created  with  mode  mode  (as
+       described  in chmod(2)) and modified by the process' umask
+       value at the time of creation (see umask(2)).   The  group
+       ownership  of  created  files  is  based on the system and
+       directory defaults, and is not further specified by DB.
+
+       The memory pool subsystem is configured based on which set
+       methods  have been used.  It is expected that applications
+       will use a single DbEnv object as the argument to  all  of
+       the subsystems in the DB package.  The fields of the DbEnv
+       object used by  DbMpool::open  are  described  below.   As
+       references  to  the  DbEnv  object  may  be  maintained by
+       DbMpool::open, it is necessary that the DbEnv  object  and
+       memory   it  references  be  valid  until  the  object  is
+       destroyed.   Any  of  the  DbEnv  fields  that   are   not
+       explicitly set will default to appropriate values.
+
+       The   following   fields   in  the  DbEnv  object  may  be
+       initialized, using  the  appropriate  set  method,  before
+       calling DbMpool::open:
+
+       void *(*db_errcall)(char *db_errpfx, char *buffer);
+       FILE *db_errfile;
+       const char *db_errpfx;
+       class ostream *db_error_stream;
+       int db_verbose;
+            The error fields of the DbEnv behave as described for
+            DbEnv(3).
+
+       size_t mp_mmapsize;
+            Files that are opened read-only in the pool (and that
+            satisfy a few other criteria) are, by default, mapped
+            into the  process  address  space  instead  of  being
+            copied  into  the  local  cache.   This can result in
+            better-than-usual performance, as  available  virtual
+            memory  is normally much larger than the local cache,
+            and page faults are faster than page copying on  many
+            systems.  However, in the presence of limited virtual
+            memory it can cause resource starvation, and  in  the
+            presence of large databases, it can result in immense
+            process  sizes.   If  mp_mmapsize  is  non-zero,   it
+            specifies the maximum file size, in bytes, for a file
+            to be mapped into  the  process  address  space.   By
+            default, it is set to 10Mb.
+
+       size_t mp_size;
+            The  suggested  size  of  the  pool,  in bytes.  This
+            should be the size of the normal working data set  of
+            the application, with some small amount of additional
+            memory for unusual situations.   (Note,  the  working
+            set  is  not the same as the number of simultaneously
+            referenced pages, and should be quite a bit  larger!)
+            The  default  cache  size  is  128K bytes (16 8K byte
+            pages), and may not be less than 20K bytes.
+
+       The  DbMpool::open  method  throws  a  DbException(3)   or
+       returns the value of errno on failure and 0 on success.
+
+  DbMpool::close
+       The DbMpool::close method closes the pool indicated by the
+       DbMpool object, as returned by DbMpool::open.  This method
+       does not imply a call to DbMpoolFile::sync, but does imply
+       a  call  to  DbMpoolFile::close  for  any  remaining  open
+       DbMpoolFile  objects  returned to this process by calls to
+       DbMpoolFile::open.
+
+       In addition, if the dir argument to DbMpool::open was NULL
+       and  dbenv  was  not initialized using DbEnv::appinit, all
+       files created for this shared region will be  removed,  as
+       if DbMpool::unlink were called.
+
+       When   multiple  threads  are  using  the  DbMpool  handle
+       concurrently,  only  a  single   thread   may   call   the
+       DbMpool::close method.
+
+       The  DbMpool::close  method  throws  a  DbException(3)  or
+       returns the value of errno on failure and 0 on success.
+
+  DbMpool::unlink
+       The  DbMpool::unlink  method  destroys  the  memory   pool
+       identified  by  the directory dir, removing all files used
+       to implement the memory pool.  (The directory dir  is  not
+       removed.)    If  there  are  processes  that  have  called
+       DbMpool::open without calling DbMpool::close (i.e.,  there
+       are   processes   currently   using   the   memory  pool),
+       DbMpool::unlink will fail without further  action,  unless
+       the  force flag is set, in which case DbMpool::unlink will
+       attempt to remove the memory pool files regardless of  any
+       processes still using the memory pool.
+
+       The  result  of  attempting to forcibly destroy the region
+       when  a  process  has  the  region  open  is  unspecified.
+       Processes  using  a  shared memory region maintain an open
+       file descriptor for  it.   On  UNIX  systems,  the  region
+       removal  should  succeed  and  processes that have already
+       joined the region should continue to  run  in  the  region
+       without  change,  however processes attempting to join the
+       memory pool will either fail or attempt to  create  a  new
+       region.   On other systems, e.g., WNT, where the unlink(2)
+       system call will fail if any  process  has  an  open  file
+       descriptor for the file, the region removal will fail.
+       In  the  case  of catastrophic or system failure, database
+       recovery must  be  performed  (see  db_recover(1)  or  the
+       DB_RECOVER      and      DB_RECOVER_FATAL     flags     to
+       DbEnv::appinit(3)).  Alternatively,  if  recovery  is  not
+       required  because  no  database state is maintained across
+       failures, it is possible to clean  up  a  memory  pool  by
+       removing  all  of  the files in the directory specified to
+       the DbMpool::open method, as memory pool files  are  never
+       created  in  any directory other than the one specified to
+       DbMpool::open.  Note, however, that this has the potential
+       to remove files created by the other DB subsystems in this
+       database environment.
+
+       The DbMpool::unlink  method  throws  a  DbException(3)  or
+       returns the value of errno on failure and 0 on success.
+
+  DbMpool::db_register
+       The  DbMpool::db_register  method  registers  page-in  and
+       page-out  functions  for  files  of  type  ftype  in   the
+       specified pool.
+
+       If the pgin function is non-NULL, it is called each time a
+       page is read into the memory pool  from  a  file  of  type
+       ftype,  or a page is created for a file of type ftype (see
+       the DB_MPOOL_CREATE flag for the DbMpoolFile::get method).
+       If  the pgout function is non-NULL, it is called each time
+       a page is written to a file of type ftype.
+
+       Both the pgin and pgout functions are called with the page
+       number,  a  pointer to the page being read or written, and
+       any  argument  pgcookie  that   was   specified   to   the
+       DbMpoolFile::open  method  when  the file was opened.  The
+       pgin and pgout functions should return 0 on  success,  and
+       an  applicable  non-zero  errno value on failure, in which
+       case  the  DbMpool  method  calling  it  will  also  fail,
+       returning that errno value.
+
+       The  purpose  of  the  DbMpool::db_register  method  is to
+       support processing when pages are entered into, or flushed
+       from,  the pool.  A file type must be specified to make it
+       possible for unrelated  threads  or  processes,  that  are
+       sharing a pool, to evict each other's pages from the pool.
+       Applications  should  call  DbMpool::db_register,   during
+       initialization,  for  each type of file requiring input or
+       output processing that  will  be  sharing  the  underlying
+       pool.   (No  registry is necessary for the standard access
+       method  types,  btree,  hash  and  recno,  as  Db::open(3)
+       registers them separately.)
+
+       If  a thread or process does not call DbMpool::db_register
+       for a file type, it is impossible for it  to  evict  pages
+       for any file requiring input or output processing from the
+       pool.  For this reason, DbMpool::db_register should always
+       be called by each application sharing a pool for each type
+       of file included in the pool, regardless of whether or not
+       the application itself uses files of that type.
+
+       There  are  no  standard values for ftype, pgin, pgout and
+       pgcookie, except that the ftype value for a file must be a
+       non-zero positive number, as negative numbers are reserved
+       for internal use by the  DB  library.   For  this  reason,
+       applications  sharing  a pool must coordinate their values
+       amongst themselves.
+
+       The DbMpool::db_register method throws a DbException(3) or
+       returns the value of errno on failure and 0 on success.
+
+  DbMpool::trickle
+       The  DbMpool::trickle  method  ensures  that  at least pct
+       percent of the pages in the shared memory pool  are  clean
+       by  writing  dirty  pages  to their backing files.  If the
+       nwrotep argument is non-NULL, the  number  of  pages  that
+       were  written  to reach the correct percentage is returned
+       in the memory location it references.
+
+       The purpose of the DbMpool::trickle method is to enable  a
+       memory  pool  manager  to  ensure  that  a  page is always
+       available for reading in new information without having to
+       wait for a write.
+
+       The  DbMpool::trickle  method  throws  a DbException(3) or
+       returns the value of errno on failure and 0 on success.
+
+  DbMpool::sync
+       The DbMpool::sync method ensures  that  all  the  modified
+       pages  in  the  pool with log sequence numbers (LSNs) less
+       than the lsn argument are written to disk.
+
+       The  DbMpool::sync  method  throws  a  DbException(3)   or
+       returns  the  value of errno on failure, 0 on success, and
+       DB_INCOMPLETE if there were pages which need to be written
+       but  which  DbMpool::sync was unable to write immediately.
+       In addition, if DbMpool::sync returns success,  the  value
+       of  lsn  will be overwritten with the largest LSN from any
+       page which was written by DbMpool::sync  to  satisfy  this
+       request.
+
+       The  purpose  of  the  DbMpool::sync method is to enable a
+       transaction manager to ensure, as part  of  a  checkpoint,
+       that  all  pages  modified  by  a  certain  time have been
+       written to disk.   Pages  in  the  pool  which  cannot  be
+       written  back  to  disk  immediately  (e.g., are currently
+       pinned) are written to disk as soon as it is  possible  to
+       do  so.   The expected behavior of the transaction manager
+       is to call the  DbMpool::sync  method  and  then,  if  the
+       return  indicates  that  some  pages  could not be written
+       immediately, to wait briefly and retry again with the same
+       LSN  until the DbMpool::sync method returns that all pages
+       have been written.
+
+       To  support  the  DbMpool::sync   functionality,   it   is
+       necessary  that  the pool methods know the location of the
+       LSN on the page for each file type.  This location  should
+       be   specified   when   the   file  is  opened  using  the
+       DbMpoolFile::open method.  (Note, it is not required  that
+       the LSN be aligned on the page in any way.)
+
+  DbMpool::stat
+
+       The  DbMpool::stat  method  creates statistical structures
+       and copies pointers to  them  into  user-specified  memory
+       locations.   The  statistics  include  the number of files
+       participating in the pool, the active pages in  the  pool,
+       and information as to how effective the cache has been.
+
+       Statistical  structures  are  created in allocated memory.
+       If db_malloc is non-NULL, it is  called  to  allocate  the
+       memory, otherwise, the library function malloc(3) is used.
+       The function db_malloc must match the calling  conventions
+       of  the malloc(3) library routine.  Regardless, the caller
+       is responsible for deallocating the returned  memory.   To
+       deallocate  the returned memory, free each returned memory
+       pointer; pointers inside the memory  do  not  need  to  be
+       individually freed.
+
+       If  gsp  is non-NULL, the global statistics for the memory
+       pool  object  are  copied  into  the  memory  location  it
+       references.    The  global  statistics  are  stored  in  a
+       structure of type DB_MPOOL_STAT (typedef'd in <db_cxx.h>).
+
+       The following DB_MPOOL_STAT fields will be filled in:
+
+       u_int32_t st_refcnt;
+            The number of references to the region.
+       u_int32_t st_regsize;
+            The size of the region.
+       size_t st_cachesize;
+             Cache size in bytes.
+       u_int32_t st_cache_hit;
+            Requested pages found in the cache.
+       u_int32_t st_cache_miss;
+            Requested pages not found in the cache.
+       u_int32_t st_map;
+            Requested  pages  mapped  into  the  process' address
+            space  (there  is  no  available  information  as  to
+            whether or not this request caused disk I/O, although
+            examining the application  page  fault  rate  may  be
+            helpful).
+       u_int32_t st_page_create;
+            Pages created in the cache.
+       u_int32_t st_page_in;
+            Pages read into the cache.
+
+       u_int32_t st_page_out;
+            Pages written from the cache to the backing file.
+       u_int32_t st_ro_evict;
+            Clean pages forced from the cache.
+       u_int32_t st_rw_evict;
+            Dirty pages forced from the cache.
+       u_int32_t st_hash_buckets;
+            Number of hash buckets in buffer hash table.
+       u_int32_t st_hash_searches;
+            Total number of buffer hash table lookups.
+       u_int32_t st_hash_longest;
+            The  longest  chain  ever  encountered in buffer hash
+            table lookups.
+       u_int32_t st_hash_examined;
+            Total number of hash elements traversed  during  hash
+            table lookups.
+       u_int32_t st_page_clean;
+            Clean pages currently in the cache.
+       u_int32_t st_page_dirty;
+            Dirty pages currently in the cache.
+       u_int32_t st_page_trickle;
+            Dirty pages written using the memp_trickle interface.
+
+       If  fsp  is  non-NULL,  a  pointer  to  a  NULL-terminated
+       variable  length  array of statistics for individual files
+       in the memory pool is copied into the memory  location  it
+       references.  If no individual files currently exist in the
+       memory pool, fsp will be set to NULL.
+
+       The per-file statistics are stored in structures  of  type
+       DB_MPOOL_FSTAT  (typedef'd  in <db_cxx.h>).  The following
+       DB_MPOOL_FSTAT fields will be filled in for each  file  in
+       the pool, i.e., each element of the array:
+
+       char *file_name;
+            The name of the file.
+       size_t st_pagesize;
+             Page size in bytes.
+       u_int32_t st_cache_hit;
+            Requested pages found in the cache.
+       u_int32_t st_cache_miss;
+            Requested pages not found in the cache.
+       u_int32_t st_map;
+            Requested  pages  mapped  into  the  process' address
+            space.
+       u_int32_t st_page_create;
+            Pages created in the cache.
+       u_int32_t st_page_in;
+            Pages read into the cache.
+       u_int32_t st_page_out;
+            Pages written from the cache to the backing file.
+
+       The  DbMpool::stat  method  throws  a  DbException(3)   or
+       returns the value of errno on failure and 0 on success.
+
+
+
+

ENVIRONMENT VARIABLES

+       The following environment variables affect the behavior of
+       DbMpoolFile:
+
+       DB_HOME
+            If  the   dbenv   argument   to   DbMpool::open   was
+            initialized   using   db_appinit,   the   environment
+            variable DB_HOME may be  used  as  the  path  of  the
+            database  home  for  the  interpretation  of  the dir
+            argument   to   DbMpool::open,   as   described    in
+            db_appinit(3).
+
+       TMPDIR
+            If  the  dbenv  argument to DbMpool::open was NULL or
+            not initialized  using  db_appinit,  the  environment
+            variable TMPDIR may be used as the directory in which
+            to create  the  memory  pool,  as  described  in  the
+            DbMpool::open section above.
+
+
+
+

ERRORS

+       Methods  marked as returning errno will, by default, throw
+       an exception that encapsulates the error information.  The
+       default error behavior can be changed, see DbException(3).
+
+       The  DbMpool::open   method   may   fail   and   throw   a
+       DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: DBmemp->pgin(3),
+       DBmemp->pgout(3), DbLog::compare(3), DbLog::flush(3),
+       DbMpool::close(3), DbMpool::unlink(3), close(2),
+       db_version(3), fcntl(2), fflush(3), fsync(2), lseek(2),
+       malloc(3), memcmp(3), memcpy(3), memset(3), mmap(2),
+       munmap(2), open(2), sigfillset(3), sigprocmask(2),
+       stat(2), strcpy(3), strdup(3), strerror(3), strlen(3),
+       time(3), unlink(2), and write(2).
+
+       In addition, the DbMpool::open method may fail and throw a
+       DbException(3)  or  return   errno   for   the   following
+       conditions:
+
+       [EAGAIN]
+            The  shared memory region was locked and (repeatedly)
+            unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The DB_THREAD flag was specified  and  spinlocks  are
+            not implemented for this architecture.
+
+            A   NULL   pathname   was   specified   without   the
+            DB_MPOOL_PRIVATE flag.
+
+            The specified cache size was impossibly small.
+
+       The  DbMpool::close  method   may   fail   and   throw   a
+       DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: DbMpoolFile::close(3),
+       close(2), fcntl(2), fflush(3), munmap(2), and strerror(3).
+
+       The  DbMpool::unlink  method  may   fail   and   throw   a
+       DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: close(2), fcntl(2),
+       fflush(3), malloc(3), memcpy(3), memset(3), mmap(2),
+       munmap(2), open(2), sigfillset(3), sigprocmask(2),
+       stat(2), strcpy(3), strdup(3), strerror(3), strlen(3), and
+       unlink(2).
+
+       In addition, the DbMpool::unlink method may fail and throw
+       a   DbException(3)  or  return  errno  for  the  following
+       conditions:
+
+       [EBUSY]
+            The shared memory region was in  use  and  the  force
+            flag was not set.
+
+       The  DbMpool::db_register  method  may  fail  and  throw a
+       DbException(3)
+
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: fcntl(2), and
+       malloc(3).
+
+       The  DbMpool::trickle  method  may  fail   and   throw   a
+       DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: DBmemp->pgin(3),
+       DBmemp->pgout(3), DbLog::compare(3), DbLog::flush(3),
+       close(2), fcntl(2), fflush(3), fsync(2), lseek(2),
+       malloc(3), memcmp(3), memcpy(3), memset(3), mmap(2),
+       open(2), sigfillset(3), sigprocmask(2), stat(2),
+       strcpy(3), strdup(3), strerror(3), strlen(3), time(3),
+       unlink(2), and write(2).
+
+       In addition, the  DbMpool::trickle  method  may  fail  and
+       throw  a  DbException(3) or return errno for the following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       The  DbMpool::sync   method   may   fail   and   throw   a
+       DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: DBmemp->pgin(3),
+       DBmemp->pgout(3), DbLog::compare(3), DbLog::flush(3),
+       close(2), fcntl(2), fflush(3), fsync(2), lseek(2),
+       malloc(3), memcmp(3), memcpy(3), memset(3), mmap(2),
+       open(2), qsort(3), realloc(3), sigfillset(3),
+       sigprocmask(2), stat(2), strcpy(3), strdup(3),
+       strerror(3), strlen(3), time(3), unlink(2), and  write(2).
+
+       In addition, the DbMpool::sync method may fail and throw a
+       DbException(3)  or  return   errno   for   the   following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The  DbMpool::sync  method was called without logging
+            having been initialized in the environment.
+
+       The  DbMpool::stat   method   may   fail   and   throw   a
+       DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: fcntl(2), malloc(3),
+       memcpy(3), and strlen(3).
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), DbMpoolFile(3), Dbt(3), DbTxn(3),
+       DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/DbMpool.j.html b/mozilla/db/man/man.html/DbMpool.j.html new file mode 100644 index 00000000000..5a0d40f00e6 --- /dev/null +++ b/mozilla/db/man/man.html/DbMpool.j.html @@ -0,0 +1,205 @@ + + +DbMpool + + +

DbMpool

+
+
+
+       import com.sleepycat.db.*;
+
+       public DbMpoolStat stat()
+            throws DbException;
+
+       public DbMpoolFStat[] fstat()
+            throws DbException;
+
+       public int trickle(int pct)
+            throws DbException;
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the  specific  details  of  the
+       memory pool interface.
+
+       The  DbMpool(3) class is the library interface intended to
+       provide general-purpose, page-oriented  buffer  management
+       of  one  or  more  files.  While designed to work with the
+       other Db classes, this  class  is  also  useful  for  more
+       general   purposes.   The  memory  pools  (DbMpool's)  are
+       referred to in this document  as  simply  ``pools''.   The
+       DbMpool  class  has  a  small  subset of the corresponding
+       DB/C++ functionality.  This class  has  been  provided  to
+       allow certain administrative actions on underlying Mpool's
+       opened as a consequence of DbEnv.appinit().  Direct access
+       to  other  Mpool  functionality is not appropriate for the
+       Java environment.
+
+  DbMpool.trickle
+       The DbMpool.trickle  method  ensures  that  at  least  pct
+       percent  of  the pages in the shared memory pool are clean
+       by writing dirty pages to their backing files.  The number
+       of pages that were written to reach the correct percentage
+       is returned.
+
+       The purpose of the DbMpool.trickle method is to  enable  a
+       memory  pool  manager  to  ensure  that  a  page is always
+       available for reading in new information without having to
+       wait for a write.
+
+       The  DbMpool.trickle  method  throws a DbException(3) that
+       encapsulates an errno on failure.
+
+  DbMpool.stat
+  DbMpool.fstat
+       The  DbMpool.stat   and   DbMpool.fstat   methods   create
+       statistical  structures  and  return  to  the caller.  The
+       statistics include the number of  files  participating  in
+       the pool, the active pages in the pool, and information as
+       to how effective the cache has been.
+
+       The stat method creates a  DbMpoolStat  object  containing
+       global   statistics.   The  fields  can  be  accessed  via
+       methods:
+
+       long get_st_cachesize();
+             Cache size in bytes.
+       int get_st_cache_hit();
+            Requested pages found in the cache.
+       int get_st_cache_miss();
+            Requested pages not found in the cache.
+       int get_st_map();
+            Requested pages  mapped  into  the  process'  address
+            space  (there  is  no  available  information  as  to
+            whether or not this request caused disk I/O, although
+            examining  the  application  page  fault  rate may be
+            helpful).
+       int get_st_page_create();
+            Pages created in the cache.
+       int get_st_page_in();
+            Pages read into the cache.
+       int get_st_page_out();
+            Pages written from the cache to the backing file.
+       int get_st_ro_evict();
+            Clean pages forced from the cache.
+       int get_st_rw_evict();
+            Dirty pages forced from the cache.
+       int get_st_hash_buckets();
+            Number of hash buckets in buffer hash table.
+       int get_st_hash_searches();
+            Total number of buffer hash table lookups.
+       int get_st_hash_longest();
+            The longest chain ever  encountered  in  buffer  hash
+            table lookups.
+       int get_st_hash_examined();
+            Total  number  of hash elements traversed during hash
+            table lookups.
+       int get_st_page_clean();
+            Clean pages currently in the cache.
+       int get_st_page_dirty();
+            Dirty pages currently in the cache.
+       int get_st_page_trickle();
+            Dirty pages written using the memp_trickle interface.
+
+       The  fstat method creates an array of DbMpoolFStat objects
+       containing statistics for individual files  in  the  pool.
+       Each   DbMpoolFStat  object  contains  statistics  for  an
+       individual DbMpoolFile, and the statistics can be accessed
+       via methods:
+
+       String get_file_name();
+            The name of the file.
+       long get_st_pagesize();
+             Page size in bytes.
+       int get_st_cache_hit();
+            Requested pages found in the cache.
+       int get_st_cache_miss();
+            Requested pages not found in the cache.
+       int get_st_map();
+            Requested  pages  mapped  into  the  process' address
+            space.
+       int get_st_page_create();
+            Pages created in the cache.
+       int get_st_page_in();
+            Pages read into the cache.
+       int get_st_page_out();
+            Pages written from the cache to the backing file.
+
+       The  DbMpool.stat  method  throws  a  DbException(3)  that
+       encapsulates an errno on failure.
+
+
+
+

ENVIRONMENT VARIABLES

+       The following environment variables affect the behavior of
+       DbMpoolFile:
+
+       DB_HOME
+            If the dbenv argument to DbMpool.open was initialized
+            using  db_appinit,  the  environment variable DB_HOME
+            may be used as the path of the database home for  the
+            interpretation  of  the dir argument to DbMpool.open,
+            as described in db_appinit(3).
+
+       TMPDIR
+            If the dbenv argument to DbMpool.open was null or not
+            initialized   using   db_appinit,   the   environment
+            variable TMPDIR may be used as the directory in which
+            to  create  the  memory  pool,  as  described  in the
+            DbMpool.open section above.
+
+
+
+

ERRORS

+       The  DbMpool.trickle  method  may   fail   and   throw   a
+       DbException(3)  for  any  of  the errors specified for the
+       following DB and library functions: DBmemp->pgin(3),
+       DBmemp->pgout(3), DbLog.compare(3), DbLog.flush(3),
+       close(2), fcntl(2), fflush(3), fsync(2), lseek(2),
+       malloc(3), memcmp(3), memcpy(3), memset(3), mmap(2),
+       open(2), sigfillset(3), sigprocmask(2), stat(2),
+       strcpy(3), strdup(3), strerror(3), strlen(3), time(3),
+       unlink(2), and write(2).
+
+       In addition, the DbMpool.trickle method may fail and throw
+       a  DbException(3) encapsulating an errno for the following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       The   DbMpool.stat   method   may   fail   and   throw   a
+       DbException(3)  for  any  of  the errors specified for the
+       following DB and library functions: fcntl(2), malloc(3),
+       memcpy(3), and strlen(3).
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), Dbt(3), DbTxn(3), DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/DbMpoolFile.html b/mozilla/db/man/man.html/DbMpoolFile.html new file mode 100644 index 00000000000..41544012891 --- /dev/null +++ b/mozilla/db/man/man.html/DbMpoolFile.html @@ -0,0 +1,450 @@ + + +DbMpoolFile + + +

DbMpoolFile

+
+
+
+       #include <db_cxx.h>
+
+       static int
+       DbMpoolFile::open(DbMpool *mp, char *file, u_int32_t flags, int mode,
+            size_t pagesize, DbMpoolFinfo *finfop, DbMpoolFile **mpf);
+
+       int
+       DbMpoolFile::close();
+
+       int
+       DbMpoolFile::get(db_pgno_t *pgnoaddr, u_int32_t flags, void **pagep);
+
+       int
+       DbMpoolFile::put(void *pgaddr, u_int32_t flags);
+
+       int
+       DbMpoolFile::set(void *pgaddr, u_int32_t flags);
+
+       int
+       DbMpoolFile::sync();
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the  specific  details  of  the
+       per-file memory pool interface.
+
+       The  DbMpool(3) and DbMpoolFile(3) classes are the library
+       interface  intended  to  provide  general-purpose,   page-
+       oriented  buffer  management  of one or more files.  While
+       designed to  work  with  the  other  Db  functions,  these
+       functions  are also useful for more general purposes.  The
+       memory  pools  (DbMpool::'s)  are  referred  to  in   this
+       document as simply ``pools''.  Pools may be shared between
+       processes.  Pools are usually filled by pages from one  or
+       more   files  (DbMpoolFile's).   Pages  in  the  pool  are
+       replaced in LRU (least-recently-used) order, with each new
+       page  replacing the page that has been unused the longest.
+       Pages retrieved from the pool using  DbMpoolFile::get  are
+       ``pinned''  in  the  pool,  by  default,  until  they  are
+       returned to the pool's control using the  DbMpoolFile::put
+       method.
+
+  DbMpoolFile::open
+       The  DbMpoolFile::open  method  opens  a  file in the pool
+       specified by the DbMpool argument, copying the DbMpoolFile
+       pointer   representing   it   into   the  memory  location
+       referenced by mpf.
+
+       The file argument is the name of the file  to  be  opened.
+       If  file is NULL, a private file is created that cannot be
+       shared with any other process (although it may  be  shared
+       with other threads).
+
+       The  flags  and  mode  arguments specify how files will be
+       opened and/or created when they don't already exist.   The
+       flags value is specified by or'ing together one or more of
+       the following values:
+
+       DB_CREATE
+            Create any underlying files, as  necessary.   If  the
+            files  do not already exist and the DB_CREATE flag is
+            not specified, the call will fail.
+
+       DB_NOMMAP
+            Always copy this file into the local cache instead of
+            mapping  it  into process memory (see the description
+            of the mp_mmapsize field  of  the  DbEnv  object  for
+            further information).
+
+       DB_RDONLY
+            Open  any  underlying  files  for  reading only.  Any
+            attempt to write the file using  the  pool  functions
+            will  fail,  regardless  of the actual permissions of
+            the file.
+
+       All files created  by  the  method  DbMpoolFile::open  are
+       created  with  mode  mode  (as  described in chmod(2)) and
+       modified by the  process'  umask  value  at  the  time  of
+       creation  (see  umask(2)).  The group ownership of created
+       files is based on the system and directory  defaults,  and
+       is not further specified by DB.
+
+       The  pagesize  argument is the size, in bytes, of the unit
+       of transfer between the application and the pool, although
+       it  is  not  necessarily  the unit of transfer between the
+       pool and the source file.
+
+       Files opened in the pool may be further  configured  based
+       on  the  finfop argument to memp_fopen, which is a pointer
+       to  a  structure  of  type  DB_MPOOL_FINFO  (typedef'd  in
+       <db.h>).   No  references  to  the  finfop  structure  are
+       maintained  by  DB,  so  it  may  be  discarded  when  the
+       memp_fopen   function   returns.    In   order  to  ensure
+       compatibility with future releases of DB,  all  fields  of
+       the  DB_MPOOL_FINFO  structure that are not explicitly set
+       should be initialized to  0  before  the  first  time  the
+       structure  is  used.   Do  this by declaring the structure
+       external or static, or by calling the  C  library  routine
+       bzero(3) or memset(3).
+
+       The   fields  of  the  DB_MPOOL_FINFO  structure  used  by
+       DbMpoolFile::open are described  below.  If finfop is NULL
+       or  any  of  its  fields  are  set to their default value,
+       defaults appropriate for the system are used.
+
+       int ftype;
+            The ftype  field  should  be  the  same  as  a  ftype
+            argument      previously     specified     to     the
+            DbMpool::db_register  method,  unless  no  input   or
+            output  processing of the file's pages are necessary,
+            in which case it should be 0.  (See  the  description
+            of   the   DbMpool::db_register   method   for   more
+            information.)
+
+       DBT *pgcookie;
+            The pgcookie argument contains the byte  string  that
+            is  passed  to  the pgin and pgout functions for this
+            file, if any.  If no  pgin  or  pgout  functions  are
+            specified,  the  pgcookie field should be NULL.  (See
+            the description of  the  DbMpool::db_register  method
+            for more information.)
+
+       u_int8_t *fileid;
+            The fileid field is a unique identifier for the file.
+            The mpool functions must be able to uniquely identify
+            files in order that multiple processes sharing a file
+            will correctly share its underlying pages.  Normally,
+            the  fileid  field  should  be  NULL  and  the  mpool
+            functions  will  use  the  file's  device  and  inode
+            numbers  (see  stat(2))  for  this  purpose.  On some
+            filesystems, (e.g., FAT or NFS) file device and inode
+            numbers  are  not  necessarily  unique  across system
+            reboots.  Applications wanting to maintain  a  shared
+            memory  buffer  pool across system reboots, where the
+            pool  contains  pages  from  files  stored  on   such
+            filesystems, must specify a unique file identifier to
+            the DbMpoolFile::open call and each  process  opening
+            or  registering the file must provide the same unique
+            identifier.  If the fileid field is non-NULL, it must
+            reference a DB_FILE_ID_LEN (as defined in <db_cxx.h>)
+            length array of bytes that will be used  to  uniquely
+            identify  the file.  This should not be necessary for
+            most applications.  Specifically, it is not necessary
+            if  the  memory  pool  is  re-instantiated after each
+            system reboot, the application is using the Db access
+            methods   instead   of  calling  the  pool  functions
+            explicitly, or the  files  in  the  memory  pool  are
+            stored on filesystems where the file device and inode
+            numbers do not change across system reboots.
+
+       int32_t lsn_offset;
+            The lsn_offset argument is the zero-based byte offset
+            in  the page of the page's log sequence number (LSN),
+            or -1 if  no  LSN  offset  is  specified.   (See  the
+            description  of  the  DbMpool::sync  method  for more
+            information.)
+
+       u_int32_t clear_len;
+            The clear_len field is the number of initial bytes in
+            a  page  that  should be set to zero when the page is
+            created  as  a  result  of  the  DB_MPOOL_CREATE   or
+            DB_MPOOL_NEW     flags     being     specified     to
+            DbMpoolFile::get.  If finfop is NULL or clear_len  is
+            0, the entire page is cleared.
+
+       The  DbMpoolFile::open  method  throws a DbException(3) or
+       returns the value of errno on failure and 0 on success.
+
+  DbMpoolFile::close
+       The  DbMpoolFile::close  method  closes  the  source  file
+       indicated by the DbMpoolFile object.  This method does not
+       imply a call  to  DbMpoolFile::sync,  i.e.  no  pages  are
+       written  to  the  source  file  as  as a result of calling
+       DbMpoolFile::close.
+
+       In addition, if the file argument to DbMpoolFile::open was
+       NULL,  any  underlying  files created for this DbMpoolFile
+       will be removed.
+
+       The DbMpoolFile::close method throws a  DbException(3)  or
+       returns the value of errno on failure and 0 on success.
+
+  DbMpoolFile::get
+       The  DbMpoolFile::get  method copies a pointer to the page
+       with the page  number  specified  by  pgnoaddr,  from  the
+       source  file  specified by the DbMpoolFile object into the
+       memory location referenced by pagep.  If the page does not
+       exist  or cannot be retrieved, DbMpoolFile::get will fail.
+
+       The returned page is size_t type aligned.
+
+       Page numbers begin at 0, e.g., the first page in the  file
+       is page number 0, not page number 1.
+
+       The  flags argument is specified by or'ing together one or
+       more of the following values:
+
+       DB_MPOOL_CREATE
+            If the specified page does not exist, create it.   In
+            this  case, the pgin method, if specified, is called.
+
+       DB_MPOOL_LAST
+            Return the last page of the source file and copy  its
+            page number to the location referenced by pgnoaddr.
+
+       DB_MPOOL_NEW
+            Create  a  new  page  in  the  file and copy its page
+            number to the location referenced  by  pgnoaddr.   In
+            this  case,  the  pgin  method,  if specified, is not
+            called.
+
+       The DB_MPOOL_CREATE, DB_MPOOL_LAST and DB_MPOOL_NEW  flags
+       are mutually exclusive.
+
+       Created  pages  have  all  their  bytes  set  to 0, unless
+       otherwise specified when the file was opened.
+
+       All pages returned by DbMpoolFile::get  will  be  retained
+       (i.e.  ``pinned'')  in the pool until a subsequent call to
+       DbMpoolFile::put.
+
+       The DbMpoolFile::get method  throws  a  DbException(3)  or
+       returns the value of errno on failure and 0 on success.
+
+  DbMpoolFile::put
+       The   DbMpoolFile::put  method  indicates  that  the  page
+       referenced by pgaddr can be evicted from the pool.  Pgaddr
+       must    be    an    address    previously    returned   by
+       DbMpoolFile::get.
+
+       The flags argument is specified by or'ing together one  or
+       more of the following values:
+
+       DB_MPOOL_CLEAN
+            Clear  any  previously  set  modification information
+            (i.e., don't bother writing  the  page  back  to  the
+            source file).
+
+       DB_MPOOL_DIRTY
+            The page has been modified and must be written to the
+            source file before being evicted from the pool.
+
+       DB_MPOOL_DISCARD
+            The page is unlikely to be useful in the near future,
+            and  should  be  discarded  before other pages in the
+            pool.
+
+       The DB_MPOOL_CLEAN and DB_MPOOL_DIRTY flags  are  mutually
+       exclusive.
+
+       The  DbMpoolFile::put  method  throws  a DbException(3) or
+       returns the value of errno on failure and 0 on success.
+
+  DbMpoolFile::set
+       The DbMpoolFile::set method sets the flags associated with
+       the  page  referenced  by pgaddr without unpinning it from
+       the pool.  Pgaddr must be an address  previously  returned
+       by    DbMpoolFile::get.     The    flags    argument    to
+       DbMpoolFile::set is specified by or'ing  together  one  or
+       more   of   the   values   specified   as  flags  for  the
+       DbMpoolFile::put call.
+
+       The DbMpoolFile::set method  throws  a  DbException(3)  or
+       returns the value of errno on failure and 0 on success.
+
+  DbMpoolFile::sync
+       The  DbMpoolFile::sync  method writes all pages associated
+       with the DbMpoolFile object that were marked  as  modified
+       using  DbMpoolFile::put  or  DbMpoolFile::set, back to the
+       source file.  If any of the modified pages are also pinned
+       (i.e.,  currently  referenced  by this or another process)
+       DbMpoolFile::sync will ignore them.
+
+       The DbMpoolFile::sync method throws  a  DbException(3)  or
+       returns  the  value of errno on failure, 0 on success, and
+       DB_INCOMPLETE if there were pages which were modified  but
+       which DbMpoolFile::sync was unable to write.
+
+
+
+

ERRORS

+       Methods  marked as returning errno will, by default, throw
+       an exception that encapsulates the error information.  The
+       default error behavior can be changed, see DbException(3).
+
+       The  DbMpoolFile::open  method  may  fail  and   throw   a
+       DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: DBmemp->pgin(3),
+       DBmemp->pgout(3), DbLog::compare(3), DbLog::flush(3),
+       close(2), fcntl(2), fflush(3), fsync(2), lseek(2),
+       malloc(3), memcmp(3), memcpy(3), memset(3), mmap(2),
+       open(2), sigfillset(3), sigprocmask(2), stat(2),
+       strcpy(3), strdup(3), strerror(3), strlen(3), time(3),
+       unlink(2), and write(2).
+
+       In addition, the DbMpoolFile::open  method  may  fail  and
+       throw  a  DbException(3) or return errno for the following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The file has already been entered into the pool,  and
+            the  pagesize  value is not the same as when the file
+            was entered into the pool, or the length of the  file
+            is not zero or a multiple of the pagesize.
+
+            The  DB_RDONLY  flag  was  specified for an in-memory
+            pool.
+
+       The  DbMpoolFile::close  method  may  fail  and  throw   a
+       DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: close(2), fcntl(2),
+       fflush(3), munmap(2), and strerror(3).
+
+       The   DbMpoolFile::get   method   may  fail  and  throw  a
+       DbException(3)
+
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: DBmemp->pgin(3),
+       DBmemp->pgout(3), DbLog::compare(3), DbLog::flush(3),
+       close(2), fcntl(2), fflush(3), fsync(2), lseek(2),
+       malloc(3), memcmp(3), memcpy(3), memset(3), mmap(2),
+       open(2), read(2), sigfillset(3), sigprocmask(2), stat(2),
+       strcpy(3), strdup(3), strerror(3), strlen(3), time(3),
+       unlink(2), and write(2).
+
+       In  addition,  the  DbMpoolFile::get  method  may fail and
+       throw a DbException(3) or return errno for  the  following
+       conditions:
+
+       [EAGAIN]
+            The  page  reference  count  has  overflowed.   (This
+            should never happen  unless  there's  a  bug  in  the
+            application.)
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The DB_MPOOL_NEW flag was set and the source file was
+            not opened for writing.
+
+            The requested page does not exist and DB_MPOOL_CREATE
+            was not set.
+
+            More  than  one of DB_MPOOL_CREATE, DB_MPOOL_LAST and
+            DB_MPOOL_NEW was set.
+
+       [ENOMEM]
+            The cache is full and no more pages will fit  in  the
+            pool.
+
+       The   DbMpoolFile::put   method   may  fail  and  throw  a
+       DbException(3)
+
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: DBmemp->pgin(3),
+       DBmemp->pgout(3), DbLog::compare(3), DbLog::flush(3),
+       close(2), fcntl(2), fflush(3), fsync(2), lseek(2),
+       malloc(3), memcmp(3), memcpy(3), memset(3), mmap(2),
+       open(2), sigfillset(3), sigprocmask(2), stat(2),
+       strcpy(3), strdup(3), strerror(3), strlen(3), time(3),
+       unlink(2), and write(2).
+
+       In  addition,  the  DbMpoolFile::put  method  may fail and
+       throw a DbException(3) or return errno for  the  following
+       conditions:
+
+       [EACCES]
+            The  DB_MPOOL_DIRTY  flag was set and the source file
+            was not opened for writing.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The  pgaddr  parameter  does  not  reference  a  page
+            returned by DbMpoolFile::get.
+
+            More  than  one  of DB_MPOOL_CLEAN and DB_MPOOL_DIRTY
+            was set.
+
+       The  DbMpoolFile::set  method  may  fail   and   throw   a
+       DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: fcntl(2), and
+       fflush(3).
+
+       In  addition,  the  DbMpoolFile::set  method  may fail and
+       throw a DbException(3) or return errno for  the  following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       The   DbMpoolFile::sync   method  may  fail  and  throw  a
+       DbException(3)
+
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: DBmemp->pgin(3),
+       DBmemp->pgout(3), DbLog::compare(3), DbLog::flush(3),
+       close(2), fcntl(2), fflush(3), fsync(2), lseek(2),
+       malloc(3), memcpy(3), memset(3), open(2), qsort(3),
+       realloc(3), sigfillset(3), sigprocmask(2), stat(2),
+       strcpy(3), strdup(3), strerror(3), strlen(3), unlink(2),
+       and write(2).
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), DbMpoolFile(3), Dbt(3), DbTxn(3),
+       DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/DbTxn.html b/mozilla/db/man/man.html/DbTxn.html new file mode 100644 index 00000000000..f571c281365 --- /dev/null +++ b/mozilla/db/man/man.html/DbTxn.html @@ -0,0 +1,297 @@ + + +DbTxn + + +

DbTxn

+
+
+
+       #include <db_cxx.h>
+
+       int
+       DbTxn::prepare();
+
+       int
+       DbTxn::commit();
+
+       int
+       DbTxn::abort();
+
+       u_int32_t
+       DbTxn::id();
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the specific details of the  Db
+       transaction   support.    The   DbTxn  class  is  used  in
+       conjunction  with  DbTxnMgr(3)  to   provide   transaction
+       semantics.   Full  transaction  support  is  provided by a
+       collection of  modules  that  provide  interfaces  to  the
+       services   required  for  transaction  processing.   These
+       services are recovery (see DbLog(3)), concurrency  control
+       (see  DbLock(3)  and  DbLockTab(3)), and the management of
+       shared   data   (see   DbMpool(3)   and   DbMpoolFile(3)).
+       Transaction semantics can be applied to the access methods
+       described in Db(3) through method call parameters.
+
+       The model intended for transactional use (and the one that
+       is  used  by  the  access  methods) is write-ahead logging
+       provided by DbLog(3) to record  both  before-  and  after-
+       images.   Locking  follows  a two-phase protocol, with all
+       locks being released at transaction commit.
+
+  DbTxn::prepare
+       The DbTxn::prepare method initiates the beginning of a two
+       phase  commit.   In a distributed transaction environment,
+       db can be used as a local transaction  manager.   In  this
+       case,   the  distributed  transaction  manager  must  send
+       prepare messages to each local manager.  The local manager
+       must  then issue a DbTxn::prepare and await its successful
+       return before responding to  the  distributed  transaction
+       manager.   Only  after the distributed transaction manager
+       receives successful responses  from  all  of  its  prepare
+       messages should it issue any commit messages.
+
+       The  DbTxn::prepare  method  throws  a  DbException(3)  or
+       returns the value of errno on failure and 0 on success.
+
+  DbTxn::commit
+       The DbTxn::commit method ends the  transaction  associated
+       with  the  DbTxn.   If  DB_TXN_NOSYNC was not specified, a
+       commit log record is written and flushed to disk,  as  are
+       all previously written log records.  If the transaction is
+       nested, its locks are acquired by the parent  transaction,
+       otherwise  its  locks are released.  Any applications that
+       require strict two-phase  locking  must  not  release  any
+       locks  explicitly,  leaving  them  all  to  be released by
+       DbTxn::commit.
+
+       The  DbTxn::commit  method  throws  a  DbException(3)   or
+       returns the value of errno on failure and 0 on success.
+
+  DbTxn::abort
+       The  DbTxn::abort method causes an abnormal termination of
+       the transaction.  The log  is  played  backwards  and  any
+       necessary  recovery  operations  are initiated through the
+       recover  method  specified   to   DbTxnMgr::open.    After
+       recovery  is  completed, all locks held by the transaction
+       are acquired by the parent transaction in the  case  of  a
+       nested transaction or released in the case of a non-nested
+       transaction.   As   is   the   case   for   DbTxn::commit,
+       applications  that require strict two phase locking should
+       not explicitly release any locks.
+
+       The DbTxn::abort method throws a DbException(3) or returns
+       the value of errno on failure and 0 on success.
+
+  DbTxn::id
+       The  DbTxn::id  method  returns  the unique transaction id
+       associated with the specified transaction.  Locking  calls
+       made  on  behalf  of this transaction should use the value
+       returned from DbTxn::id as the  locker  parameter  to  the
+       DbLockTab::get or DbLockTab::vec calls.
+
+
+
+

TRANSACTIONS

+       Creating  transaction  protected applications using the Db
+       access methods requires little system  customization.   In
+       most   cases,  the  default  parameters  to  the  locking,
+       logging, memory  pool,  and  transaction  subsystems  will
+       suffice.    Applications   can   use  DbEnv::appinit  (see
+       DbEnv(3)) to perform this initialization, or they  may  do
+       it explicitly.
+
+       Each  database  operation  (i.e.,  any  call  to  a method
+       underlying the handles returned by Db::open and Db::cursor
+       described  in  Db(3)) is normally performed on behalf of a
+       unique locker.  If multiple calls on behalf  of  the  same
+       locker are desired, then transactions must be used.
+
+       Once  the  application  has  initialized the Db subsystems
+       that it is  using,  it  may  open  the  Db  access  method
+       databases.   For applications performing transactions, the
+       databases must be opened after  subsystem  initialization,
+       and  cannot  be opened as part of a transaction.  Once the
+       databases are opened, the application can  group  sets  of
+       operations   into   transactions,   by   surrounding   the
+       operations   with   the    appropriate    DbTxnMgr::begin,
+       DbTxn::commit  and DbTxn::abort calls.  Databases accessed
+       by  a  transaction  must  not   be   closed   during   the
+       transaction.   Note,  it  is  not necessary to transaction
+       protect read-only transactions, unless those  transactions
+       require repeatable reads.
+
+       The Db access methods will make the appropriate calls into
+       the lock, log and  memory  pool  subsystems  in  order  to
+       guarantee  that  transaction  semantics are applied.  When
+       the  application  is  ready  to  exit,   all   outstanding
+       transactions  should  have  been committed or aborted.  At
+       this point, all open Db files should be closed.  Once  the
+       Db  database files are closed, the Db subsystems should be
+       closed, either explicitly or by  destroying  the  DbEnv(3)
+       object.
+
+       It  is  also  possible  to  use  the  locking, logging and
+       transaction  subsystems  of  Db  to  provide   transaction
+       semantics  to objects other than those described by the Db
+       access methods.  In these cases, the application will need
+       more  explicit  customization of the subsystems as well as
+       the  development  of  appropriate  data-structure-specific
+       recovery functions.
+
+       For   example,   consider  an  application  that  provides
+       transaction semantics to data stored in plain  UNIX  files
+       accessed using the read(2) and write(2) system calls.  The
+       operations for which transaction protection is desired are
+       bracketed by calls to DbTxnMgr::begin and DbTxn::commit.
+
+       Before  data  are  referenced, the application must make a
+       call to the lock manager, DbLock(3), for  a  lock  of  the
+       appropriate  type (e.g., 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,  DbLock(3).   Then, the application should make a
+       call  to  the  log  manager,  DbLog,  to   record   enough
+       information to redo the operation in case of failure after
+       commit and to undo the operation in  case  of  abort.   As
+       discussed  in the DbLog(3) manual page, 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.
+
+       After the log message  is  written,  the  application  may
+       issue  the  write  system  call.   After  all requests are
+       issued, the  application  may  call  DbTxn::commit.   When
+       DbTxn::commit  returns,  the caller is guaranteed that all
+       necessary log writes have been written to disk.
+
+       At any time, the application may call DbTxn::abort,  which
+       will result in the appropriate calls to the recover method
+       to  restore  the  ``database''  to   a   consistent   pre-
+       transaction  state.   (The  recover method must be able to
+       either re-apply  or  undo  the  update  depending  on  the
+       context, for each different type of log record.)
+
+       If the application should crash, the recovery process uses
+       the DbLog interface to read the log and call  the  recover
+       method to restore the database to a consistent state.
+
+       The  DbTxn::prepare method provides the core functionality
+       to implement distributed transactions,  but  it  does  not
+       manage   the   notification   of  distributed  transaction
+       managers.   The  caller   is   responsible   for   issuing
+       DbTxn::prepare  calls  to  all  sites participating in the
+       transaction.  If all responses are  positive,  the  caller
+       can  issue  a  DbTxn::commit.  If any of the responses are
+       negative, the caller  should  issue  a  DbTxn::abort.   In
+       general,   the   DbTxn::prepare  call  requires  that  the
+       transaction log be flushed to disk.
+
+
+
+

TRANSACTION ID LIMITS

+       The transaction ID space in Berkeley  DB  is  2^31,  or  2
+       billion  entries.   It  is possible that some environments
+       may need to be aware  of  this  limitation.   Consider  an
+       application  performing  600  transactions a second for 15
+       hours a day.  The transaction ID space  will  run  out  in
+       roughly 66 days:
+
+              2^31 / (600 * 15 * 60 * 60) = 66
+
+       Doing   only   100  transactions  a  second  exhausts  the
+       transaction ID space in roughly one year.
+
+       The transaction ID space is reset each  time  recovery  is
+       run.   If  you reach the end of your transaction ID space,
+       shut down your applications and restart them after running
+       recovery  (see  db_recover(1)  for more information).  The
+       most   recently   allocated   transaction   ID   is    the
+       st_last_txnid   value   in   the   transaction  statistics
+       information, and is displayed by the db_stat(1) utility.
+
+
+
+

ERRORS

+       Methods marked as returning errno will, by default,  throw
+       an exception that encapsulates the error information.  The
+       default error behavior can be changed, see DbException(3).
+
+       The   DbTxn::prepare   method   may   fail   and  throw  a
+       DbException(3)
+
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: DbLog::flush(3),
+       fcntl(2), fflush(3), and strerror(3).
+
+       The  DbTxn::commit   method   may   fail   and   throw   a
+       DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: DbLockTab::vec(3),
+       DbLog::put(3), fcntl(2), fflush(3), malloc(3), memcpy(3),
+       and strerror(3).
+
+       In addition, the DbTxn::commit method may fail and throw a
+       DbException(3)   or   return   errno   for  the  following
+       conditions:
+
+       [EINVAL]
+            The transaction was aborted.
+
+       The   DbTxn::abort   method   may   fail   and   throw   a
+       DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: DBenv->tx_recover(3),
+       DbLockTab::vec(3), DbLog::get(3), fcntl(2), fflush(3),
+       memset(3), and strerror(3).
+
+       [EINVAL]
+            The transaction was already aborted.
+
+
+
+

SEE ALSO

+       LIBTP: Portable,  Modular  Transactions  for  UNIX,  Margo
+       Seltzer, Michael Olson, USENIX proceedings, Winter 1992.
+
+
+
+

BUGS

+       Nested transactions are not yet implemented.
+
+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), DbMpoolFile(3), Dbt(3), DbTxn(3),
+       DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/DbTxn.j.html b/mozilla/db/man/man.html/DbTxn.j.html new file mode 100644 index 00000000000..d3532df1e49 --- /dev/null +++ b/mozilla/db/man/man.html/DbTxn.j.html @@ -0,0 +1,286 @@ + + +DbTxn + + +

DbTxn

+
+
+
+       import com.sleepycat.db.*;
+
+       public void abort()
+            throws DbException;
+
+       public void commit()
+            throws DbException;
+
+       public int id()
+            throws DbException;
+
+       public void prepare()
+            throws DbException;
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the specific details of the  Db
+       transaction   support.    The   DbTxn  class  is  used  in
+       conjunction  with  DbTxnMgr(3)  to   provide   transaction
+       semantics.   Full  transaction  support  is  provided by a
+       collection of  modules  that  provide  interfaces  to  the
+       services   required  for  transaction  processing.   These
+       services are recovery (see DbLog(3)), concurrency  control
+       (see  DbLock(3)  and  DbLockTab(3)), and the management of
+       shared   data   (see   DbMpool(3)   and   DbMpoolFile(3)).
+       Transaction semantics can be applied to the access methods
+       described in Db(3) through method call parameters.
+
+       The model intended for transactional use (and the one that
+       is  used  by  the  access  methods) is write-ahead logging
+       provided by DbLog(3) to record  both  before-  and  after-
+       images.   Locking  follows  a two-phase protocol, with all
+       locks being released at transaction commit.
+
+  DbTxn.prepare
+       The DbTxn.prepare method initiates the beginning of a  two
+       phase  commit.   In a distributed transaction environment,
+       db can be used as a local transaction  manager.   In  this
+       case,   the  distributed  transaction  manager  must  send
+       prepare messages to each local manager.  The local manager
+       must  then  issue a DbTxn.prepare and await its successful
+       return before responding to  the  distributed  transaction
+       manager.   Only  after the distributed transaction manager
+       receives successful responses  from  all  of  its  prepare
+       messages should it issue any commit messages.
+
+       The  DbTxn.prepare  method  throws  a  DbException(3) that
+       encapsulates an errno on failure.
+
+  DbTxn.commit
+       The DbTxn.commit method ends  the  transaction  associated
+       with  the  DbTxn.   If  DB_TXN_NOSYNC was not specified, a
+       commit log record is written and flushed to disk,  as  are
+       all previously written log records.  If the transaction is
+       nested, its locks are acquired by the parent  transaction,
+       otherwise  its  locks are released.  Any applications that
+       require strict two-phase  locking  must  not  release  any
+       locks  explicitly,  leaving  them  all  to  be released by
+       DbTxn.commit.
+
+       The  DbTxn.commit  method  throws  a  DbException(3)  that
+       encapsulates an errno on failure.
+
+  DbTxn.abort
+       The  DbTxn.abort  method causes an abnormal termination of
+       the transaction.  The log  is  played  backwards  and  any
+       necessary  recovery  operations  are initiated through the
+       recover method specified to DbTxnMgr.open.  After recovery
+       is  completed,  all  locks  held  by  the  transaction are
+       acquired by the parent transaction in the case of a nested
+       transaction  or  released  in  the  case  of  a non-nested
+       transaction.    As   is   the   case   for   DbTxn.commit,
+       applications  that require strict two phase locking should
+       not explicitly release any locks.
+
+       The  DbTxn.abort  method  throws  a  DbException(3)   that
+       encapsulates an errno on failure.
+
+  DbTxn.id
+       The  DbTxn.id  method  returns  the  unique transaction id
+       associated with the specified transaction.  Locking  calls
+       made  on  behalf  of this transaction should use the value
+       returned from DbTxn.id as  the  locker  parameter  to  the
+       DbLockTab.get or DbLockTab.vec calls.
+
+
+
+

TRANSACTIONS

+       Creating  transaction  protected applications using the Db
+       access methods requires little system  customization.   In
+       most   cases,  the  default  parameters  to  the  locking,
+       logging, memory  pool,  and  transaction  subsystems  will
+       suffice.    Applications   can   use   DbEnv.appinit  (see
+       DbEnv(3)) to perform this initialization, or they  may  do
+       it explicitly.
+
+       Each  database  operation  (i.e.,  any  call  to  a method
+       underlying the handles returned by Db.open  and  Db.cursor
+       described  in  Db(3)) is normally performed on behalf of a
+       unique locker.  If multiple calls on behalf  of  the  same
+       locker are desired, then transactions must be used.
+
+       Once  the  application  has  initialized the Db subsystems
+       that it is  using,  it  may  open  the  Db  access  method
+       databases.   For applications performing transactions, the
+       databases must be opened after  subsystem  initialization,
+       and  cannot  be opened as part of a transaction.  Once the
+       databases are opened, the application can  group  sets  of
+       operations   into   transactions,   by   surrounding   the
+       operations   with    the    appropriate    DbTxnMgr.begin,
+       DbTxn.commit and DbTxn.abort calls.  Databases accessed by
+       a transaction must not be closed during  the  transaction.
+       Note, it is not necessary to transaction protect read-only
+       transactions, unless those transactions require repeatable
+       reads.
+
+       The Db access methods will make the appropriate calls into
+       the lock, log and  memory  pool  subsystems  in  order  to
+       guarantee  that  transaction  semantics are applied.  When
+       the  application  is  ready  to  exit,   all   outstanding
+       transactions  should  have  been committed or aborted.  At
+       this point, all open Db files should be closed.  Once  the
+       Db  database files are closed, the Db subsystems should be
+       closed, either explicitly or by  destroying  the  DbEnv(3)
+       object.
+
+       It  is  also  possible  to  use  the  locking, logging and
+       transaction  subsystems  of  Db  to  provide   transaction
+       semantics  to objects other than those described by the Db
+       access methods.  In these cases, the application will need
+       more  explicit  customization of the subsystems as well as
+       the  development  of  appropriate  data-structure-specific
+       recovery functions.
+
+       For   example,   consider  an  application  that  provides
+       transaction semantics to data stored in plain  UNIX  files
+       accessed using the read(2) and write(2) system calls.  The
+       operations for which transaction protection is desired are
+       bracketed by calls to DbTxnMgr.begin and DbTxn.commit.
+
+       Before  data  are  referenced, the application must make a
+       call to the lock manager, DbLock(3), for  a  lock  of  the
+       appropriate  type (e.g., 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,  DbLock(3).   Then, the application should make a
+       call  to  the  log  manager,  DbLog,  to   record   enough
+       information to redo the operation in case of failure after
+       commit and to undo the operation in  case  of  abort.   As
+       discussed  in the DbLog(3) manual page, 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.
+
+       After the log message  is  written,  the  application  may
+       issue  the  write  system  call.   After  all requests are
+       issued,  the  application  may  call  DbTxn.commit.   When
+       DbTxn.commit  returns,  the  caller is guaranteed that all
+       necessary log writes have been written to disk.
+
+       At any time, the application may call  DbTxn.abort,  which
+       will result in the appropriate calls to the recover method
+       to  restore  the  ``database''  to   a   consistent   pre-
+       transaction  state.   (The  recover method must be able to
+       either re-apply  or  undo  the  update  depending  on  the
+       context, for each different type of log record.)
+
+       If the application should crash, the recovery process uses
+       the DbLog interface to read the log and call  the  recover
+       method to restore the database to a consistent state.
+
+       The  DbTxn.prepare  method provides the core functionality
+       to implement distributed transactions,  but  it  does  not
+       manage   the   notification   of  distributed  transaction
+       managers.   The  caller   is   responsible   for   issuing
+       DbTxn.prepare  calls  to  all  sites  participating in the
+       transaction.  If all responses are  positive,  the  caller
+       can  issue  a  DbTxn.commit.   If any of the responses are
+       negative, the  caller  should  issue  a  DbTxn.abort.   In
+       general,   the   DbTxn.prepare   call  requires  that  the
+       transaction log be flushed to disk.
+
+
+
+

TRANSACTION ID LIMITS

+       The transaction ID space in Berkeley  DB  is  2^31,  or  2
+       billion  entries.   It  is possible that some environments
+       may need to be aware  of  this  limitation.   Consider  an
+       application  performing  600  transactions a second for 15
+       hours a day.  The transaction ID space  will  run  out  in
+       roughly 66 days:
+
+              2^31 / (600 * 15 * 60 * 60) = 66
+
+       Doing   only   100  transactions  a  second  exhausts  the
+       transaction ID space in roughly one year.
+
+       The transaction ID space is reset each  time  recovery  is
+       run.   If  you reach the end of your transaction ID space,
+       shut down your applications and restart them after running
+       recovery  (see  db_recover(1)  for more information).  The
+       most   recently   allocated   transaction   ID   is    the
+       st_last_txnid   value   in   the   transaction  statistics
+       information, and is displayed by the db_stat(1) utility.
+
+
+
+

ERRORS

+       The  DbTxn.prepare   method   may   fail   and   throw   a
+       DbException(3)  for  any  of  the errors specified for the
+       following DB and library functions: DbLog.flush(3),
+       fcntl(2), fflush(3), and strerror(3).
+
+       The   DbTxn.commit   method   may   fail   and   throw   a
+       DbException(3) for any of the  errors  specified  for  the
+       following DB and library functions: DbLockTab.vec(3),
+       DbLog.put(3), fcntl(2), fflush(3), malloc(3), memcpy(3),
+       and strerror(3).
+
+       In  addition, the DbTxn.commit method may fail and throw a
+       DbException(3) encapsulating an errno  for  the  following
+       conditions:
+
+       [EINVAL]
+            The transaction was aborted.
+
+       The DbTxn.abort method may fail and throw a DbException(3)
+       for any of the errors specified for the following  DB  and
+       library functions: DBenv->tx_recover(3), DbLockTab.vec(3),
+       DbLog.get(3), fcntl(2), fflush(3), memset(3), and
+       strerror(3).
+
+       [EINVAL]
+            The transaction was already aborted.
+
+
+
+

SEE ALSO

+       LIBTP:  Portable,  Modular  Transactions  for  UNIX, Margo
+       Seltzer, Michael Olson, USENIX proceedings, Winter 1992.
+
+
+
+

BUGS

+       Nested transactions are not yet implemented.
+
+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), Dbt(3), DbTxn(3), DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/DbTxnMgr.html b/mozilla/db/man/man.html/DbTxnMgr.html new file mode 100644 index 00000000000..53510a83663 --- /dev/null +++ b/mozilla/db/man/man.html/DbTxnMgr.html @@ -0,0 +1,523 @@ + + +DbTxnMgr + + +

DbTxnMgr

+
+
+
+       #include <db_cxx.h>
+
+       static int
+       DbTxnMgr::open(const char *dir,
+            u_int32_t flags, int mode, DbEnv *dbenv, DbTxnMgr **regionp);
+
+       int
+       DbTxnMgr::begin(DbTxn *pid, DbTxn **tid);
+
+       int
+       DbTxnMgr::checkpoint(u_int32_t kbyte, u_int32_t min) const;
+
+       int
+       DbTxnMgr::close();
+
+       static int
+       DbTxnMgr::unlink(const char *dir, int force, DbEnv *dbenv);
+
+       int
+       DbTxnMgr::stat(DB_TXN_STAT **statp, void *(*db_malloc)(size_t));
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the specific details of the  Db
+       transaction  support.   The  DbTxnMgr  class  is  used  in
+       conjunction   with   DbTxn(3)   to   provide   transaction
+       semantics.   Full  transaction  support  is  provided by a
+       collection of  modules  that  provide  interfaces  to  the
+       services   required  for  transaction  processing.   These
+       services are recovery (see DbLog(3)), concurrency  control
+       (see  DbLock(3)  and  DbLockTab(3)), and the management of
+       shared   data   (see   DbMpool(3)   and   DbMpoolFile(3)).
+       Transaction semantics can be applied to the access methods
+       described in Db(3) through method call parameters.
+
+       The model intended for transactional use (and that is used
+       by  the  access  methods)  is  that write-ahead logging is
+       provided by DbLog(3) to record  both  before-  and  after-
+       image  logging.   Locking  follows  a  two-phase  protocol
+       (i.e., all locks are released at transaction commit).
+
+  DbTxnMgr::open
+       The  DbTxnMgr::open  method  copies  a  pointer,  to   the
+       transaction  region  identified by the directory dir, into
+       the memory location referenced by regionp.
+
+       If the dbenv argument to  DbTxnMgr::open  was  initialized
+       using  DbEnv::appinit,  dir is interpreted as described by
+       DbEnv(3).
+
+       Otherwise, if dir is not NULL, it is interpreted  relative
+       to  the  current working directory of the process.  If dir
+       is NULL, the following environment variables  are  checked
+       in  order:  ``TMPDIR'',  ``TEMP'', and ``TMP''.  If one of
+       them is set, transaction region files are created relative
+       to  the  directory it specifies.  If none of them are set,
+       the first possible one of  the  following  directories  is
+       used: /var/tmp, /usr/tmp, /temp, /tmp, C:/temp and C:/tmp.
+
+       All files  associated  with  the  transaction  region  are
+       created  in  this  directory.  This directory must already
+       exist when DbTxnMgr::open is called.  If  the  transaction
+       region already exists, the process must have permission to
+       read and write the existing  files.   If  the  transaction
+       region  does  not  already exist, it is optionally created
+       and initialized.
+
+       The flags and mode arguments specify  how  files  will  be
+       opened  and/or created when they don't already exist.  The
+       flags value is specified by or'ing together one or more of
+       the following values:
+
+       DB_CREATE
+            Create  any  underlying  files, as necessary.  If the
+            files do not already exist and the DB_CREATE flag  is
+            not specified, the call will fail.
+
+       DB_THREAD
+            Cause   the   DbTxnMgr   handle   returned   by   the
+            DbTxnMgr::open  method  to  be  useable  by  multiple
+            threads  within  a  single address space, i.e., to be
+            ``free-threaded''.
+
+       DB_TXN_NOSYNC
+            On transaction commit, do not synchronously flush the
+            log.   This  means  that transactions exhibit the ACI
+            (atomicity, consistency  and  isolation)  properties,
+            but not D (durability), i.e., database integrity will
+            be maintained but it is possible that some number  of
+            the  most  recently  committed  transactions  may  be
+            undone during recovery instead of being redone.
+
+            The number of transactions that  are  potentially  at
+            risk is governed by how often the log is checkpointed
+            (see db_checkpoint(1)) and how many log  updates  can
+            fit on a single log page.
+
+       All files created by the transaction subsystem are created
+       with mode mode (as described in chmod(2)) and modified  by
+       the  process'  umask  value  at  the time of creation (see
+       umask(2)).  The group ownership of created files is  based
+       on  the  system and directory defaults, and is not further
+       specified by DB.
+
+       The transaction subsystem is configured based on which set
+       methods  have been used.  It is expected that applications
+       will use a single DbEnv object as the argument to  all  of
+       the subsystems in the DB package.  The fields of the DbEnv
+       object used by DbTxnMgr::open  are  described  below.   As
+       references  to  the  DbEnv  object  may  be  maintained by
+       DbTxnMgr::open, it is necessary that the DbEnv object  and
+       memory   it  references  be  valid  until  the  object  is
+       destroyed.   Any  of  the  DbEnv  fields  that   are   not
+       explicitly set will default to appropriate values.
+
+       The   following   fields   in  the  DbEnv  object  may  be
+       initialized, using  the  appropriate  set  method,  before
+       calling DbTxnMgr::open:
+
+       void *(*db_errcall)(char *db_errpfx, char *buffer);
+       FILE *db_errfile;
+       const char *db_errpfx;
+       class ostream *db_error_stream;
+       int db_verbose;
+            The error fields of the DbEnv behave as described for
+            DbEnv(3).
+
+       DbLog *lg_info;
+             The logging region  that  is  being  used  for  this
+            transaction  environment.  The lg_info field contains
+            a return value from the method DbLog::open.   Logging
+            is  required  for transaction environments, and it is
+            an error to not specify a logging region.
+
+       DbLockTab *lk_info;
+             The locking region  that  is  being  used  for  this
+            transaction  environment.  The lk_info field contains
+            a return value from the method  DbLockTab::open.   If
+            lk_info   is   NULL,  no  locking  is  done  in  this
+            transaction environment.
+
+       u_int32_t tx_max;
+            The maximum number of simultaneous transactions  that
+            are supported.  This bounds the size of backing files
+            and is used to derive limits for the size of the lock
+            region and logfiles.  When there are more than tx_max
+            concurrent transactions, calls to DbTxnMgr::begin may
+            cause  backing  files  to  grow.   If  tx_max is 0, a
+            default value is used.
+
+       int DbTxnMgr::recover(DbLog *logp, Dbt *DbLog::rec,
+                 DbLsn *lsnp, int redo, void *info);
+            A  method  that  is  called  by  DbTxn::abort  during
+            transaction abort.  This method takes five arguments:
+
+            logp A pointer to the transaction log (DbLog *).
+
+            DbLog::rec
+                 A log record.
+
+            lsnp A pointer to a log sequence number (DbLsn *).
+
+            redo An integer value that  is  set  to  one  of  the
+                 following values:
+
+                 DB_TXN_BACKWARD_ROLL
+                      The log is being read backward to determine
+                      which transactions have been committed  and
+                      which  transactions  were  not  (and should
+                      therefore be aborted during recovery).
+
+                 DB_TXN_FORWARD_ROLL
+                      The  log  is  being  played  forward,   any
+                      transaction  ids  encountered that have not
+                      been entered into the  list  referenced  by
+                      info should be ignored.
+
+                 DB_TXN_OPENFILES
+                      The log is being read to open all the files
+                      required to perform recovery.
+
+                 DB_TXN_REDO
+                      Redo the operation  described  by  the  log
+                      record.
+
+                 DB_TXN_UNDO
+                      Undo  the  operation  described  by the log
+                      record.
+
+            info An opaque pointer used to reference the list  of
+                 transaction IDs encountered during recovery.
+
+            If  recover  is  NULL,  the  default  is that only Db
+            access method operations are  transaction  protected,
+            and the default recover method will be used.
+
+       The  DbTxnMgr::open  method  throws  a  DbException(3)  or
+       returns the value of errno on failure and 0 on success.
+
+  DbTxnMgr::begin
+       The DbTxnMgr::begin method creates a  new  transaction  in
+       the transaction manager, copying a pointer to a DbTxn that
+       uniquely identifies it into the memory referenced by  tid.
+       If  the pid argument is non-NULL, the new transaction is a
+       nested transaction with the transaction indicated  by  pid
+       as its parent.
+
+       Transactions  may not span threads, i.e., each transaction
+       must  begin  and  end  in  the  same  thread,   and   each
+       transaction may only be used by a single thread.
+
+       The  DbTxnMgr::begin  method  throws  a  DbException(3) or
+       returns the value of errno on failure and 0 on success.
+
+  DbTxnMgr::close
+       The DbTxnMgr::close method detaches  a  process  from  the
+       transaction  environment specified by the DbTxnMgr object.
+       All  mapped  regions  are  unmapped  and   any   allocated
+       resources  are  freed.   Any  uncommitted transactions are
+       aborted.
+
+       In addition, if the dir  argument  to  DbTxnMgr::open  was
+       NULL  and  dbenv was not initialized using DbEnv::appinit,
+       all files created for this shared region will be  removed,
+       as if DbTxnMgr::unlink were called.
+
+       When  multiple  threads  are  using  the  DbTxnMgr  handle
+       concurrently,  only  a  single   thread   may   call   the
+       DbTxnMgr::close method.
+
+       The  DbTxnMgr::close  method  throws  a  DbException(3) or
+       returns the value of errno on failure and 0 on success.
+
+  DbTxnMgr::unlink
+       The  DbTxnMgr::unlink  method  destroys  the   transaction
+       region identified by the directory dir, removing all files
+       used to implement the transaction region.  (The  directory
+       dir  is  not  removed.)   If there are processes that have
+       called  DbTxnMgr::open  without  calling   DbTxnMgr::close
+       (i.e., there are processes currently using the transaction
+       region),  DbTxnMgr::unlink  will  fail   without   further
+       action,  unless  the  force  flag  is  set,  in which case
+       DbTxnMgr::unlink will attempt to  remove  the  transaction
+       region  files  regardless of any processes still using the
+       transaction region.
+
+       The result of attempting to forcibly  destroy  the  region
+       when  a  process  has  the  region  open  is  unspecified.
+       Processes using a shared memory region  maintain  an  open
+       file  descriptor  for  it.   On  UNIX  systems, the region
+       removal should succeed and  processes  that  have  already
+       joined  the  region  should  continue to run in the region
+       without change, however processes attempting to  join  the
+       transaction region will either fail or attempt to create a
+       new region.   On  other  systems,  e.g.,  WNT,  where  the
+       unlink(2) system call will fail if any process has an open
+       file descriptor for the  file,  the  region  removal  will
+       fail.
+
+       In  the  case  of catastrophic or system failure, database
+       recovery must  be  performed  (see  db_recover(1)  or  the
+       DB_RECOVER      and      DB_RECOVER_FATAL     flags     to
+       DbEnv::appinit(3)).  Alternatively,  if  recovery  is  not
+       required  because  no  database state is maintained across
+       failures, it is possible to clean up a transaction  region
+       by removing all of the files in the directory specified to
+       the DbTxnMgr::open method, as transaction region files are
+       never   created  in  any  directory  other  than  the  one
+       specified to DbTxnMgr::open.  Note, however, that this has
+       the  potential  to  remove  files  created by the other DB
+       subsystems in this database environment.
+
+       The DbTxnMgr::unlink method  throws  a  DbException(3)  or
+       returns the value of errno on failure and 0 on success.
+
+  DbTxnMgr::checkpoint
+       The   DbTxnMgr::checkpoint  method  syncs  the  underlying
+       memory pool, writes a checkpoint record  to  the  log  and
+       then flushes the log.
+
+       If either kbyte or min is non-zero, the checkpoint is only
+       done if more than min minutes have passed since  the  last
+       checkpoint,  or  if  more than kbyte kilobytes of log data
+       have been written since the last checkpoint.
+
+       The DbTxnMgr::checkpoint method throws a DbException(3) or
+       returns  the  value of errno on failure, 0 on success, and
+       DB_INCOMPLETE if  there  were  pages  that  needed  to  be
+       written  but  that DbMpool::sync (3) (see DbMpool (3)) was
+       unable  to  write  immediately.    In   this   case,   the
+       DbTxnMgr::checkpoint call should be retried.
+
+       The   DbTxnMgr::checkpoint   method  is  based  on  the  C
+       txn_checkpoint function, which is the underlying  function
+       used by the db_checkpoint(1) utility.  See the source code
+       for the db_checkpoint utility  for  an  example  of  using
+       txn_checkpoint in a UNIX environment.
+
+  DbTxnMgr::stat
+       The DbTxnMgr::stat
+
+       method creates a statistical structure and copies pointers
+       to it into user-specified memory locations.
+
+       Statistical structures are created  in  allocated  memory.
+       If  db_malloc  is  non-NULL,  it is called to allocate the
+       memory, otherwise, the library function malloc(3) is used.
+       The  function db_malloc must match the calling conventions
+       of the malloc(3) library routine.  Regardless, the  caller
+       is  responsible  for deallocating the returned memory.  To
+       deallocate the returned memory, free each returned  memory
+       pointer;  pointers  inside  the  memory  do not need to be
+       individually freed.
+
+       The  transaction  region  statistics  are  stored   in   a
+       structure  of  type DB_TXN_STAT (typedef'd in <db_cxx.h>).
+       The following DB_TXN_STAT fields will be filled in:
+
+       DbLsn st_last_ckp;
+            The LSN of the last checkpoint.
+       DbLsn st_pending_ckp;
+            The LSN  of  any  checkpoint  that  is  currently  in
+            progress.    If   st_pending_ckp   is   the  same  as
+            st_last_ckp there is no checkpoint in progress.
+       time_t st_time_ckp;
+            The time the last completed checkpoint  finished  (as
+            returned by time(2)).
+       u_int32_t st_last_txnid;
+            The last transaction ID allocated.
+       u_int32_t st_maxtxns;
+            The  maximum  number of active transactions supported
+            by the region.
+       u_int32_t st_naborts;
+            The number of transactions that have aborted.
+       u_int32_t st_nactive;
+            The number of transactions that are currently active.
+       u_int32_t st_nbegins;
+            The number of transactions that have begun.
+       u_int32_t st_ncommits;
+            The number of transactions that have committed.
+       u_int32_t ;
+            The  number  of  times  that  a thread of control was
+            forced to wait before obtaining the region lock.
+       u_int32_t ;
+            The number of times that a thread of control was able
+            to obtain the region lock without waiting.
+
+       DB_TXN_ACTIVE *st_txnarray;
+            A  pointer  to  an  array of st_nactive DB_TXN_ACTIVE
+            structures,   describing   the    currently    active
+            transactions.     The   following   fields   of   the
+            DB_TXN_ACTIVE  structure  (typedef'd  in  <db_cxx.h>)
+            will be filled in:
+
+            u_int32_t txnid;
+                 The    transaction    ID    as    returned    by
+                 DbTxnMgr::begin(3).
+
+            DbLsn lsn;
+                 The LSN of the transaction-begin record.
+
+
+
+

ENVIRONMENT VARIABLES

+       The following environment variables affect  the  execution
+       of db_txn:
+
+       DB_HOME
+            If   the   dbenv   argument   to  DbTxnMgr::open  was
+            initialized   using   db_appinit,   the   environment
+            variable  DB_HOME  may  be  used  as  the path of the
+            database home  for  the  interpretation  of  the  dir
+            argument   to   DbTxnMgr::open,   as   described   in
+            db_appinit(3).
+
+       TMPDIR
+            If the dbenv argument to DbTxnMgr::open was  NULL  or
+            not  initialized  using  db_appinit,  the environment
+            variable TMPDIR may be used as the directory in which
+            to create the transaction region, as described in the
+            DbTxnMgr::open section above.
+
+
+
+

ERRORS

+       Methods marked as returning errno will, by default,  throw
+       an exception that encapsulates the error information.  The
+       default error behavior can be changed, see DbException(3).
+
+       The   DbTxnMgr::open   method   may   fail   and  throw  a
+       DbException(3)
+
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: DbTxnMgr::unlink(3),
+       close(2), db_version(3), fcntl(2), fflush(3), lseek(2),
+       malloc(3), memcpy(3), memset(3), mmap(2), munmap(2),
+       open(2), sigfillset(3), sigprocmask(2), stat(2),
+       strcpy(3), strdup(3), strerror(3), strlen(3), time(3),
+       unlink(2), and write(2).
+
+       In addition, the DbTxnMgr::open method may fail and  throw
+       a   DbException(3)  or  return  errno  for  the  following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The DB_THREAD flag was specified  and  spinlocks  are
+            not implemented for this architecture.
+
+            The dbenv parameter was NULL.
+
+       [EAGAIN]
+            The  shared memory region was locked and (repeatedly)
+            unavailable.
+
+       The  DbTxnMgr::begin  method  may   fail   and   throw   a
+       DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: DbLog::put(3),
+       fcntl(2), fflush(3), lseek(2), malloc(3), memcpy(3),
+       memset(3), mmap(2), munmap(2), strerror(3), and  write(2).
+
+       In addition, the DbTxnMgr::begin method may fail and throw
+       a  DbException(3)  or  return  errno  for  the   following
+       conditions:
+
+       [ENOSPC]
+            The  maximum  number  of  concurrent transactions has
+            been reached.
+
+       The DbTxnMgr::checkpoint  method  may  fail  and  throw  a
+       DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: DbLog::compare(3),
+       DbLog::put(3), DbMpool::sync(3), fcntl(2), fflush(3),
+       malloc(3), memcpy(3), memset(3), strerror(3), and time(3).
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       The   DbTxnMgr::close   method   may   fail  and  throw  a
+       DbException(3)
+
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: DbLog::flush(3),
+       DbTxn::abort(3), close(2), fcntl(2), fflush(3), munmap(2),
+       and strerror(3).
+
+       The   DbTxnMgr::unlink   method   may  fail  and  throw  a
+       DbException(3)
+
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: close(2), fcntl(2),
+       fflush(3), malloc(3), memcpy(3), memset(3), mmap(2),
+       munmap(2), open(2), sigfillset(3), sigprocmask(2),
+       stat(2), strcpy(3), strdup(3), strerror(3), strlen(3), and
+       unlink(2).
+
+       In  addition,  the  DbTxnMgr::unlink  method  may fail and
+       throw a DbException(3) or return errno for  the  following
+       conditions:
+
+       [EBUSY]
+            The  shared  memory  region  was in use and the force
+            flag was not set.
+
+       The  DbTxnMgr::stat  method   may   fail   and   throw   a
+       DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: fcntl(2), and
+       malloc(3).
+
+
+
+

SEE ALSO

+       LIBTP:  Portable,  Modular  Transactions  for  UNIX, Margo
+       Seltzer, Michael Olson, USENIX proceedings, Winter 1992.
+
+
+
+

BUGS

+       Nested transactions are not yet implemented.
+
+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), DbMpoolFile(3), Dbt(3), DbTxn(3),
+       DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/DbTxnMgr.j.html b/mozilla/db/man/man.html/DbTxnMgr.j.html new file mode 100644 index 00000000000..6fc5ec3f204 --- /dev/null +++ b/mozilla/db/man/man.html/DbTxnMgr.j.html @@ -0,0 +1,440 @@ + + +DbTxnMgr + + +

DbTxnMgr

+
+
+
+       import com.sleepycat.db.*;
+
+       public static DbTxnMgr open(String dir, int flags, int mode, DbEnv dbenv)
+            throws DbException;
+
+       public DbTxn begin(DbTxn pid)
+            throws DbException;
+
+       public void checkpoint(int kbyte, int min)
+            throws DbException;
+
+       public void close()
+            throws DbException;
+
+       public static void unlink(String dir, int force, DbEnv dbenv)
+            throws DbException;
+
+       public DbTxnStat stat()
+            throws DbException;
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the specific details of the  Db
+       transaction  support.   The  DbTxnMgr  class  is  used  in
+       conjunction   with   DbTxn(3)   to   provide   transaction
+       semantics.   Full  transaction  support  is  provided by a
+       collection of  modules  that  provide  interfaces  to  the
+       services   required  for  transaction  processing.   These
+       services are recovery (see DbLog(3)), concurrency  control
+       (see  DbLock(3)  and  DbLockTab(3)), and the management of
+       shared   data   (see   DbMpool(3)   and   DbMpoolFile(3)).
+       Transaction semantics can be applied to the access methods
+       described in Db(3) through method call parameters.
+
+       The model intended for transactional use (and that is used
+       by  the  access  methods)  is  that write-ahead logging is
+       provided by DbLog(3) to record  both  before-  and  after-
+       image  logging.   Locking  follows  a  two-phase  protocol
+       (i.e., all locks are released at transaction commit).
+
+  DbTxnMgr.open
+       The DbTxnMgr.open  method  returns  a  transaction  region
+       identified by the directory dir.
+
+       If  the  dbenv  argument  to DbTxnMgr.open was initialized
+       using DbEnv.appinit, dir is interpreted  as  described  by
+       DbEnv(3).
+
+       Otherwise,  if dir is not null, it is interpreted relative
+       to the current working directory of the process.   If  dir
+       is  null,  the following environment variables are checked
+       in order: ``TMPDIR'', ``TEMP'', and ``TMP''.   If  one  of
+       them is set, transaction region files are created relative
+       to the directory it specifies.  If none of them  are  set,
+       the  first  possible  one  of the following directories is
+       used: /var/tmp, /usr/tmp, /temp, /tmp, C:/temp and C:/tmp.
+
+       All  files  associated  with  the  transaction  region are
+       created in this directory.  This  directory  must  already
+       exist  when  DbTxnMgr.open  is called.  If the transaction
+       region already exists, the process must have permission to
+       read  and  write  the  existing files.  If the transaction
+       region does not already exist, it  is  optionally  created
+       and initialized.
+
+       The  flags  and  mode  arguments specify how files will be
+       opened and/or created when they don't already exist.   The
+       flags value is specified by or'ing together one or more of
+       the following values:
+
+       Db.DB_CREATE
+            Create any underlying files, as  necessary.   If  the
+            files  do not already exist and the DB_CREATE flag is
+            not specified, the call will fail.
+
+       Db.DB_THREAD
+            Cause   the   DbTxnMgr   handle   returned   by   the
+            DbTxnMgr.open   method  to  be  useable  by  multiple
+            threads within a single address space,  i.e.,  to  be
+            ``free-threaded''.   Threading is assumed in the Java
+            API,  so  no  special  flags  are  required,  and  DB
+            functions will always behave as if the DB_THREAD flag
+            was specified.
+
+       Db.DB_TXN_NOSYNC
+            On transaction commit, do not synchronously flush the
+            log.   This  means  that transactions exhibit the ACI
+            (atomicity, consistency  and  isolation)  properties,
+            but not D (durability), i.e., database integrity will
+            be maintained but it is possible that some number  of
+            the  most  recently  committed  transactions  may  be
+            undone during recovery instead of being redone.
+
+            The number of transactions that  are  potentially  at
+            risk is governed by how often the log is checkpointed
+            (see db_checkpoint(1)) and how many log  updates  can
+            fit on a single log page.
+
+       All files created by the transaction subsystem are created
+       with mode mode (as described in chmod(2)) and modified  by
+       the  process'  umask  value  at  the time of creation (see
+       umask(2)).  The group ownership of created files is  based
+       on  the  system and directory defaults, and is not further
+       specified by DB.
+
+       The transaction subsystem is configured based on which set
+       methods  have been used.  It is expected that applications
+       will use a single DbEnv object as the argument to  all  of
+       the subsystems in the DB package.  The fields of the DbEnv
+       object used by  DbTxnMgr.open  are  described  below.   As
+       references  to  the  DbEnv  object  may  be  maintained by
+       DbTxnMgr.open, it is necessary that the DbEnv  object  and
+       memory   it  references  be  valid  until  the  object  is
+       destroyed.   Any  of  the  DbEnv  fields  that   are   not
+       explicitly set will default to appropriate values.
+
+       The   following   fields   in  the  DbEnv  object  may  be
+       initialized, using  the  appropriate  set  method,  before
+       calling DbTxnMgr.open:
+
+       DbErrcall db_errcall;
+       String db_errpfx;
+       int db_verbose;
+            The error fields of the DbEnv behave as described for
+            DbEnv(3).  void *(*db_errcall)(char *db_errpfx,  char
+            *buffer);
+
+       FILE *db_errfile;
+       const char *db_errpfx;
+       int db_verbose;
+            The  error  fields  of the DB_ENV behave as described
+            for db_appinit(3).
+
+       DbLog lg_info;
+             The logging region  that  is  being  used  for  this
+            transaction  environment.  The lg_info field contains
+            a return value from the method  DbLog.open.   Logging
+            is  required  for transaction environments, and it is
+            an error to not specify a logging region.
+
+       DbLockTab lk_info;
+             The locking region  that  is  being  used  for  this
+            transaction  environment.  The lk_info field contains
+            a return value from the  method  DbLockTab.open.   If
+            lk_info   is   null,  no  locking  is  done  in  this
+            transaction environment.
+
+       int tx_max;
+            The maximum number of simultaneous transactions  that
+            are supported.  This bounds the size of backing files
+            and is used to derive limits for the size of the lock
+            region and logfiles.  When there are more than tx_max
+            concurrent transactions, calls to DbTxnMgr.begin  may
+            cause  backing  files  to  grow.   If  tx_max is 0, a
+            default value is used.
+
+       The DbTxnMgr.open  method  throws  a  DbException(3)  that
+       encapsulates an errno on failure.
+
+  DbTxnMgr.begin
+       The DbTxnMgr.begin method creates a new transaction in the
+       transaction manager, and returns  a  DbTxn  that  uniquely
+       identifies  it.   If the pid argument is non-null, the new
+       transaction is a nested transaction with  the  transaction
+       indicated by pid as its parent.
+
+       Transactions  may not span threads, i.e., each transaction
+       must  begin  and  end  in  the  same  thread,   and   each
+       transaction may only be used by a single thread.
+
+       The  DbTxnMgr.begin  method  throws  a DbException(3) that
+       encapsulates an errno on failure.
+
+  DbTxnMgr.close
+       The DbTxnMgr.close method  detaches  a  process  from  the
+       transaction  environment specified by the DbTxnMgr object.
+       All  mapped  regions  are  unmapped  and   any   allocated
+       resources  are  freed.   Any  uncommitted transactions are
+       aborted.
+
+       In addition, if the dir argument to DbTxnMgr.open was null
+       and  dbenv  was  not  initialized using DbEnv.appinit, all
+       files created for this shared region will be  removed,  as
+       if DbTxnMgr.unlink were called.
+
+       When  multiple  threads  are  using  the  DbTxnMgr  handle
+       concurrently,  only  a  single   thread   may   call   the
+       DbTxnMgr.close method.
+
+       The  DbTxnMgr.close  method  throws  a DbException(3) that
+       encapsulates an errno on failure.
+
+  DbTxnMgr.unlink
+       The DbTxnMgr.unlink method destroys the transaction region
+       identified  by  the directory dir, removing all files used
+       to implement the transaction region.  (The  directory  dir
+       is  not removed.)  If there are processes that have called
+       DbTxnMgr.open without calling DbTxnMgr.close (i.e.,  there
+       are  processes  currently  using  the transaction region),
+       DbTxnMgr.unlink will fail without further  action,  unless
+       the  force flag is set, in which case DbTxnMgr.unlink will
+       attempt to remove the transaction region files  regardless
+       of any processes still using the transaction region.
+
+       The  result  of  attempting to forcibly destroy the region
+       when  a  process  has  the  region  open  is  unspecified.
+       Processes  using  a  shared memory region maintain an open
+       file descriptor for  it.   On  UNIX  systems,  the  region
+       removal  should  succeed  and  processes that have already
+       joined the region should continue to  run  in  the  region
+       without  change,  however processes attempting to join the
+       transaction region will either fail or attempt to create a
+       new  region.   On  other  systems,  e.g.,  WNT,  where the
+       unlink(2) system call will fail if any process has an open
+       file  descriptor  for  the  file,  the region removal will
+       fail.
+
+       In the case of catastrophic or  system  failure,  database
+       recovery  must  be  performed  (see  db_recover(1)  or the
+       DB_RECOVER     and     DB_RECOVER_FATAL      flags      to
+       DbEnv.appinit(3)).   Alternatively,  if  recovery  is  not
+       required because no database state  is  maintained  across
+       failures,  it is possible to clean up a transaction region
+       by removing all of the files in the directory specified to
+       the  DbTxnMgr.open method, as transaction region files are
+       never  created  in  any  directory  other  than  the   one
+       specified  to DbTxnMgr.open.  Note, however, that this has
+       the potential to remove files  created  by  the  other  DB
+       subsystems in this database environment.
+
+       The  DbTxnMgr.unlink  method  throws a DbException(3) that
+       encapsulates an errno on failure.
+
+  DbTxnMgr.checkpoint
+       The DbTxnMgr.checkpoint method syncs the underlying memory
+       pool,  writes  a  checkpoint  record  to  the log and then
+       flushes the log.
+
+       If either kbyte or min is non-zero, the checkpoint is only
+       done  if  more than min minutes have passed since the last
+       checkpoint, or if more than kbyte kilobytes  of  log  data
+       have been written since the last checkpoint.
+
+       The  DbTxnMgr.checkpoint  method  throws  a DbException(3)
+       that encapsulates an errno on failure,  and  DB_INCOMPLETE
+       if  there  were  pages  that needed to be written but that
+       DbMpool.sync (3) (see DbMpool (3))  was  unable  to  write
+       immediately.   In  this case, the DbTxnMgr.checkpoint call
+       should be retried.
+
+       The  DbTxnMgr.checkpoint  method  is  based   on   the   C
+       txn_checkpoint  function, which is the underlying function
+       used by the db_checkpoint(1) utility.  See the source code
+       for  the  db_checkpoint  utility  for  an example of using
+       txn_checkpoint in a UNIX environment.
+
+  DbTxnMgr.stat
+       The DbTxnMgr.stat
+
+       method  creates  a  DbTxnStat   object   encapsulating   a
+       statistical structure.
+
+       The   transaction   region  statistics  are  stored  in  a
+       DbTxnStat object.  The following methods are available  on
+       DbTxnStat:
+
+       DbLsn get_st_last_ckp();
+            The LSN of the last checkpoint.
+       DbLsn get_st_pending_ckp();
+            The  LSN  of  any  checkpoint  that  is  currently in
+            progress.   If  st_pending_ckp   is   the   same   as
+            st_last_ckp there is no checkpoint in progress.
+       int get_st_time_ckp();
+            The  time  the last completed checkpoint finished (as
+            returned by time(2)).
+       int get_st_last_txnid();
+            The last transaction ID allocated.
+       int get_st_maxtxns();
+            The maximum number of active  transactions  supported
+            by the region.
+       int get_st_naborts();
+            The number of transactions that have aborted.
+       int get_st_nactive();
+            The number of transactions that are currently active.
+       int get_st_nbegins();
+            The number of transactions that have begun.
+       int get_st_ncommits();
+            The number of transactions that have committed.
+       st_region_wait get_();
+            The number of times that  a  thread  of  control  was
+            forced to wait before obtaining the region lock.
+       st_region_nowait get_();
+            The number of times that a thread of control was able
+            to obtain the region lock without waiting.
+
+
+
+

ENVIRONMENT VARIABLES

+       The following environment variables affect  the  execution
+       of db_txn:
+
+       DB_HOME
+            If   the   dbenv   argument   to   DbTxnMgr.open  was
+            initialized   using   db_appinit,   the   environment
+            variable  DB_HOME  may  be  used  as  the path of the
+            database home  for  the  interpretation  of  the  dir
+            argument    to   DbTxnMgr.open,   as   described   in
+            db_appinit(3).
+
+       TMPDIR
+            If the dbenv argument to DbTxnMgr.open  was  null  or
+            not  initialized  using  db_appinit,  the environment
+            variable TMPDIR may be used as the directory in which
+            to create the transaction region, as described in the
+            DbTxnMgr.open section above.
+
+
+
+

ERRORS

+       The  DbTxnMgr.open   method   may   fail   and   throw   a
+       DbException(3)  for  any  of  the errors specified for the
+       following DB and library functions: DbTxnMgr.unlink(3),
+       close(2), db_version(3), fcntl(2), fflush(3), lseek(2),
+       malloc(3), memcpy(3), memset(3), mmap(2), munmap(2),
+       open(2), sigfillset(3), sigprocmask(2), stat(2),
+       strcpy(3), strdup(3), strerror(3), strlen(3), time(3),
+       unlink(2), and write(2).
+
+       In addition, the DbTxnMgr.open method may fail and throw a
+       DbException(3) encapsulating an errno  for  the  following
+       conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The  DB_THREAD  flag  was specified and spinlocks are
+            not implemented for this architecture.
+
+            The dbenv parameter was null.
+
+       [EAGAIN]
+            The shared memory region was locked and  (repeatedly)
+            unavailable.
+
+       The   DbTxnMgr.begin   method   may   fail   and  throw  a
+       DbException(3) for any of the  errors  specified  for  the
+       following DB and library functions: DbLog.put(3),
+       fcntl(2), fflush(3), lseek(2), malloc(3), memcpy(3),
+       memset(3),  mmap(2), munmap(2), strerror(3), and write(2).
+
+       In addition, the DbTxnMgr.begin method may fail and  throw
+       a  DbException(3) encapsulating an errno for the following
+       conditions:
+
+       [ENOSPC]
+            The maximum number  of  concurrent  transactions  has
+            been reached.
+
+       The  DbTxnMgr.checkpoint  method  may  fail  and  throw  a
+       DbException(3) for any of the  errors  specified  for  the
+       following DB and library functions: DbLog.compare(3),
+       DbLog.put(3), DbMpool.sync(3), fcntl(2), fflush(3),
+       malloc(3), memcpy(3), memset(3), strerror(3), and time(3).
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       The  DbTxnMgr.close  method   may   fail   and   throw   a
+       DbException(3)  for  any  of  the errors specified for the
+       following DB and library functions: DbLog.flush(3),
+       DbTxn.abort(3), close(2), fcntl(2), fflush(3), munmap(2),
+       and strerror(3).
+
+       The  DbTxnMgr.unlink  method  may   fail   and   throw   a
+       DbException(3)  for  any  of  the errors specified for the
+       following DB and library functions: close(2), fcntl(2),
+       fflush(3), malloc(3), memcpy(3), memset(3), mmap(2),
+       munmap(2), open(2), sigfillset(3), sigprocmask(2),
+       stat(2), strcpy(3), strdup(3), strerror(3), strlen(3), and
+       unlink(2).
+
+       In addition, the DbTxnMgr.unlink method may fail and throw
+       a  DbException(3) encapsulating an errno for the following
+       conditions:
+
+       [EBUSY]
+            The shared memory region was in  use  and  the  force
+            flag was not set.
+
+       The   DbTxnMgr.stat   method   may   fail   and   throw  a
+       DbException(3) for any of the  errors  specified  for  the
+       following DB and library functions: fcntl(2), and
+       malloc(3).
+
+
+
+

SEE ALSO

+       LIBTP: Portable,  Modular  Transactions  for  UNIX,  Margo
+       Seltzer, Michael Olson, USENIX proceedings, Winter 1992.
+
+
+
+

BUGS

+       Nested transactions are not yet implemented.
+
+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), Dbt(3), DbTxn(3), DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/Dbc.html b/mozilla/db/man/man.html/Dbc.html new file mode 100644 index 00000000000..670a7ef4346 --- /dev/null +++ b/mozilla/db/man/man.html/Dbc.html @@ -0,0 +1,494 @@ + + +Dbc + + +

Dbc

+
+
+
+       #include <db_cxx.h>
+
+       int
+       Dbc::close(void);
+
+       int
+       Dbc::del(u_int32_t flags);
+
+       int
+       Dbc::get(Dbt *key, Dbt *data, u_int32_t flags);
+
+       int
+       Dbc::put(Dbt *key, Dbt *data, u_int32_t flags);
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the  specific  details  of  the
+       cursor support for the access methods in Db(3).
+
+       The  Dbc  functions  are  the library interface supporting
+       sequential access to the  records  stored  by  the  access
+       methods of the Db library.  Cursors are created by calling
+       Db::cursor method described  in  Db(3),  which  returns  a
+       pointer to a Dbc object.
+
+       Each cursor maintains positioning information within a set
+       of key/data  pairs.   In  the  presence  of  transactions,
+       cursors  are  only  valid  within  the context of a single
+       transaction, the one specified during the Db::cursor  call
+       described   in  Db(3).   All  cursor  operations  will  be
+       executed in  the  context  of  that  transaction.   Before
+       aborting  or  committing  a  transaction, all cursors used
+       within that transaction must be closed.  In  the  presence
+       of transactions, the application must call DbTxn::abort if
+       any of the  cursor  operations  returns  that  a  deadlock
+       (EAGAIN) or system failure occurred.
+
+       When  locking  is enabled, page locks are retained between
+       consecutive  cursor  calls.   For  this  reason,  in   the
+       presence  of  locking, applications should discard cursors
+       as soon as they are done with them.  Calling the Db::close
+       method  (see  Db(3))  discards  any  cursors opened in the
+       context of a particular Db object returned by the Db::open
+       call.
+       The methods of the Dbc are defined as follows:
+
+       int Dbc::close();
+            A  method  that  discards  the  cursor.   No  further
+            references to the Dbc object should be made.
+
+            The Dbc::close  method  throws  a  DbException(3)  or
+            returns  the  value  of  errno  on  failure  and 0 on
+            success.
+
+       int Dbc::del(u_int32_t flags);
+            A method that deletes  the  key/data  pair  currently
+            referenced by the cursor.
+
+            The  flags parameter is currently unused, and must be
+            set to 0.
+
+            The cursor position is unchanged after a  delete  and
+            subsequent  calls  to  cursor functions expecting the
+            cursor to reference an existing key will fail.
+
+            The  Dbc::del  method  throws  a  DbException(3)   or
+            returns  the value of errno on failure, 0 on success,
+            and DB_KEYEMPTY  if  the  element  has  already  been
+            deleted.
+
+       int Dbc::get(Dbt *key, Dbt *data, u_int32_t flags);
+            A  method  that  retrieves  key/data  pairs  from the
+            database.  The address and  length  of  the  key  are
+            returned  in the object referenced by key (except for
+            the case of the DB_SET flag where the key  object  is
+            unchanged),  and  the  address and length of the data
+            are returned in the object referenced by data.
+
+            Modifications to the  database  during  a  sequential
+            scan  will  be  reflected  in  the scan, i.e. records
+            inserted behind a cursor will not be  returned  while
+            records  inserted  in  front  of  a  cursor  will  be
+            returned.
+
+            In recno databases, missing  entries  (i.e.,  entries
+            that  were  never  explicitly  created  or  that were
+            created and then deleted), will be skipped  during  a
+            sequential scan.
+
+            If  multiple  threads  or processes insert items into
+            the same database file  without  using  locking,  the
+            results  are  undefined.   For  more  detail, see the
+            section below on cursor stability.
+
+            The parameter flags must be set to exactly one of the
+            following values:
+
+            DB_FIRST
+                 The   cursor  is  set  to  reference  the  first
+                 key/data pair of the database, and that pair  is
+                 returned.   In  the  presence  of  duplicate key
+                 values, the  first  data  item  in  the  set  of
+                 duplicates is returned.
+
+                 If  the  database  is empty, the Dbc::get method
+                 will return DB_NOTFOUND.
+
+            DB_LAST
+                 The cursor is set to reference the last key/data
+                 pair of the database, and that pair is returned.
+                 In the presence of  duplicate  key  values,  the
+                 last  data  item  in  the  set  of duplicates is
+                 returned.
+
+                 If the database is empty,  the  Dbc::get  method
+                 will return DB_NOTFOUND.
+
+            DB_NEXT
+                 If the cursor is not yet initialized, DB_NEXT is
+                 identical to DB_FIRST.
+
+                 Otherwise, move the cursor to the next  key/data
+                 pair of the database, and that pair is returned.
+                 In the presence of  duplicate  key  values,  the
+                 value of the key may not change.
+
+                 If  the  cursor is already on the last record in
+                 the database, the Dbc::get  method  will  return
+                 DB_NOTFOUND.
+
+            DB_PREV
+                 If the cursor is not yet initialized, DB_PREV is
+                 identical to DB_LAST.
+
+                 Otherwise,  move  the  cursor  to  the  previous
+                 key/data  pair of the database, and that pair is
+                 returned.  In  the  presence  of  duplicate  key
+                 values, the value of the key may not change.
+
+                 If  the cursor is already on the first record in
+                 the database, the Dbc::get  method  will  return
+                 DB_NOTFOUND.
+
+            DB_CURRENT
+                 Return the key/data pair currently referenced by
+                 the cursor.
+
+                 If the cursor key/data pair  has  been  deleted,
+                 the Dbc::get method will return DB_KEYEMPTY.
+
+                 If  the  cursor  is  not  yet  initialized,  the
+                 Dbc::get method will return EINVAL.
+
+            DB_SET
+                 Move the cursor to the specified  key/data  pair
+                 of the database, and return the datum associated
+                 with the given key.
+
+                 In  the  presence  of  duplicate   key   values,
+                 Dbc::get will return the first data item for the
+                 given key.
+
+                 If the database is  a  recno  database  and  the
+                 requested  key  exists, but was never explicitly
+                 created by the application or was later deleted,
+                 the Dbc::get method returns DB_KEYEMPTY.
+
+                 If  no  matching  keys  are  found, the Dbc::get
+                 method will return DB_NOTFOUND.
+
+            DB_SET_RANGE
+                 The DB_SET_RANGE flag is identical to the DB_SET
+                 flag, except that the key is returned as well as
+                 the data item, and, in the  case  of  the  btree
+                 access method, the returned key/data pair is the
+                 smallest  key  greater  than  or  equal  to  the
+                 specified  key  (as determined by the comparison
+                 function), permitting partial  key  matches  and
+                 range searches.
+
+            DB_SET_RECNO
+                 Move  the cursor to the specific numbered record
+                 of  the  database,  and  return  the  associated
+                 key/data  pair.  The data field of the specified
+                 key must be a pointer to a memory location  from
+                 which  a db_recno_t may be read, as described in
+                 Dbt(3).  This memory location will  be  read  to
+                 determine the record to be retrieved.
+
+                 For DB_SET_RECNO to be specified, the underlying
+                 database must be of type btree and it must  have
+                 been   created  with  the  DB_RECNUM  flag  (see
+                 Db::open in Db(3)).
+
+            DB_GET_RECNO
+                 Return the record  number  associated  with  the
+                 cursor.   The  record number will be returned in
+                 the data Dbt as described in  Dbt(3).   The  key
+                 parameter is ignored.
+
+                 For DB_GET_RECNO to be specified, the underlying
+                 database must be of type btree and it must  have
+                 been   created  with  the  DB_RECNUM  flag  (see
+                 Db::open in Db(3)).
+
+            Otherwise,   the    Dbc::get    method    throws    a
+            DbException(3)  or  returns  the  value  of  errno on
+            failure and 0 on success.
+
+            If Dbc::get fails for any reason, the  state  of  the
+            cursor will be unchanged.
+
+       int Dbc::put(Dbt *key, Dbt *data, u_int32_t flags);
+              A  method  that  stores  key/data  pairs  into  the
+            database.
+
+            The flags parameter must be set to exactly one of the
+            following values:
+
+            DB_AFTER
+                 In  the  case  of  the  btree  and  hash  access
+                 methods, insert the data element as a  duplicate
+                 element  of  the  key  referenced by the cursor.
+                 The new element appears  immediately  after  the
+                 current  cursor  position.   It  is  an error to
+                 specify DB_AFTER if the underlying btree or hash
+                 database  was  not created with the DB_DUP flag.
+                 The key parameter is ignored.
+
+                 In the case of the recno access method, it is an
+                 error  to  specify  DB_AFTER  if  the underlying
+                 recno  database  was  not   created   with   the
+                 DB_RENUMBER  flag.   If the DB_RENUMBER flag was
+                 specified, a new key  is  created,  all  records
+                 after   the   inserted  item  are  automatically
+                 renumbered, and the key of  the  new  record  is
+                 returned   in   the  object  referenced  by  the
+                 parameter key.  The initial  value  of  the  key
+                 parameter is ignored.  See Db::open in Db(3) for
+                 more information.
+
+                 If  the  cursor  is  not  yet  initialized,  the
+                 Dbc::put method will return EINVAL.
+
+            DB_BEFORE
+                 In  the  case  of  the  btree  and  hash  access
+                 methods, insert the data element as a  duplicate
+                 element  of  the  key  referenced by the cursor.
+                 The new element appears immediately  before  the
+                 current  cursor  position.   It  is  an error to
+                 specify DB_BEFORE if  the  underlying  btree  or
+                 hash  database  was  not created with the DB_DUP
+                 flag.  The key parameter is ignored.
+
+                 In the case of the recno access method, it is an
+                 error  to  specify  DB_BEFORE  if the underlying
+                 recno  database  was  not   created   with   the
+                 DB_RENUMBER  flag.   If the DB_RENUMBER flag was
+                 specified, a new key  is  created,  the  current
+                 record    and   all   records   after   it   are
+                 automatically renumbered, and the key of the new
+                 record  is  returned in the object referenced by
+                 the parameter key.  The initial value of the key
+                 parameter is ignored.  See Db::open in Db(3) for
+                 more information.
+
+                 If  the  cursor  is  not  yet  initialized,  the
+                 Dbc::put method will return EINVAL.
+
+            DB_CURRENT
+                 Overwrite   the   data   of  the  key/data  pair
+                 referenced by the cursor with the specified data
+                 item.
+
+                 The key parameter is ignored.
+
+                 If  the  cursor  is  not  yet  initialized,  the
+                 Dbc::put method will return EINVAL.
+
+            DB_KEYFIRST
+                 In  the  case  of  the  btree  and  hash  access
+                 methods, insert the specified key/data pair into
+                 the database.  If the key already exists in  the
+                 database, the inserted data item is added as the
+                 first of the data items for that key.
+
+                 The DB_KEYFIRST flag may not be specified to the
+                 recno access method.
+
+            DB_KEYLAST
+                 Insert  the  specified  key/data  pair  into the
+                 database.  If the  key  already  exists  in  the
+                 database, the inserted data item is added as the
+                 last of the data items for that key.
+
+                 The DB_KEYLAST flag may not be specified to  the
+                 recno access method.
+
+            If  the  cursor record has been deleted, the Dbc::put
+            method will return DB_KEYEMPTY.
+            Otherwise,   the    Dbc::put    method    throws    a
+            DbException(3)  or  returns  the  value  of  errno on
+            failure and 0 on success.
+
+            If Dbc::put fails for any reason, the  state  of  the
+            cursor  will  be unchanged.  If Dbc::put succeeds and
+            an item is inserted into the database, the cursor  is
+            always  positioned  to  reference  the newly inserted
+            item.
+
+
+
+

CURSOR STABILITY

+       In the absence of locking, no guarantees  are  made  about
+       the   stability  of  cursors  in  different  processes  or
+       threads.  However, the  btree  and  recno  access  methods
+       guarantee  that cursor operations, interspersed with other
+       cursor or non-cursor operations  in  the  same  thread  of
+       control  (i.e.,  thread  or single-threaded process), will
+       always return keys in order  and  will  return  each  non-
+       deleted  key/data  pair  exactly  once.   Because the hash
+       access method uses a dynamic hashing algorithm, it  cannot
+       guarantee any form of stability in the presence of inserts
+       and deletes unless locking is performed.
+
+       If locking was specified when the Db file was opened,  but
+       transactions are not in effect, the access methods provide
+       repeatable reads with respect to the cursor.  That  is,  a
+       DB_CURRENT  call on the cursor is guaranteed to return the
+       same record as was  returned  on  the  last  call  to  the
+       cursor.
+
+       In  the  presence of transactions, the access method calls
+       between DbTxnMgr::begin and DbTxn::abort or  DbTxn::commit
+       provide  degree  3 consistency.  For all access methods, a
+       cursor scan of the database performed within  the  context
+       of  a  transaction  is  guaranteed to return each key/data
+       pair once and only once, except  in  the  following  case.
+       If,  while  performing a cursor scan using the hash access
+       method, the transaction performing the scan inserts a  new
+       pair  into  the  database,  it  is possible that duplicate
+       key/data pairs will be returned.
+
+
+
+

ERRORS

+       Methods marked as returning errno will, by default,  throw
+       an exception that encapsulates the error information.  The
+       default error behavior can be changed, see DbException(3).
+
+       The Dbc::close method may fail and throw a DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: DbLock::get(3),
+       DbLock::put(3), DbLockTab::id(3), DbLockTab::vec(3),
+       DbLog::put(3), DbMpoolFile::get(3), DbMpoolFile::put(3),
+       DbMpoolFile::set(3), calloc(3), fcntl(2), fflush(3),
+       malloc(3), memcpy(3), memmove(3), memset(3), realloc(3),
+       and strerror(3).
+
+       In  addition,  the  Dbc::close method may fail and throw a
+       DbException(3)  or  return   errno   for   the   following
+       conditions:
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EPERM]
+            Database  corruption  was  detected.   All subsequent
+            database calls (other  than  Db::close)  will  return
+            EPERM.
+
+       The Dbc::del method may fail and throw a DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: Db::del(3),
+       DbLock::get(3), DbLock::put(3), DbLockTab::id(3),
+       DbLockTab::vec(3), DbLog::put(3), DbMpoolFile::get(3),
+       DbMpoolFile::put(3), DbMpoolFile::set(3), calloc(3),
+       fcntl(2), fflush(3), malloc(3), memcpy(3), memmove(3),
+       memset(3), realloc(3), and strerror(3).
+
+       In  addition,  the  Dbc::del  method  may fail and throw a
+       DbException(3)  or  return   errno   for   the   following
+       conditions:
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       [EPERM]
+            Database  corruption  was  detected.   All subsequent
+            database calls (other  than  Db::close)  will  return
+            EPERM.
+
+       The Dbc::get method may fail and throw a DbException(3)
+
+       or  return  errno  for any of the errors specified for the
+       following DB and library functions: Db::get(3),
+       DbLock::get(3), DbLock::put(3), DbLockTab::id(3),
+       DbLockTab::vec(3), DbLog::put(3), DbMpoolFile::get(3),
+       DbMpoolFile::put(3), DbMpoolFile::set(3), calloc(3),
+       fcntl(2), fflush(3), malloc(3), memcmp(3), memcpy(3),
+       memmove(3), memset(3), realloc(3), and strerror(3).
+
+       In  addition,  the  Dbc::get  method  may fail and throw a
+       DbException(3)  or  return   errno   for   the   following
+       conditions:
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The  DB_THREAD  flag  was  specified  to the Db::open
+            method   described   in   Db(3)   and   neither   the
+            DB_DBT_MALLOC or DB_DBT_USERMEM flags were set in the
+            Dbt.
+
+       [EPERM]
+            Database corruption  was  detected.   All  subsequent
+            database  calls  (other  than  Db::close) will return
+            EPERM.
+
+       The Dbc::put method may fail and throw a DbException(3)
+
+       or return errno for any of the errors  specified  for  the
+       following DB and library functions: DbLock::get(3),
+       DbLock::put(3), DbLockTab::id(3), DbLockTab::vec(3),
+       DbLog::put(3), DbMpoolFile::get(3), DbMpoolFile::put(3),
+       DbMpoolFile::set(3), calloc(3), fcntl(2), fflush(3),
+       malloc(3), memcmp(3), memcpy(3), memmove(3), memset(3),
+       realloc(3), and strerror(3).
+
+       In addition, the Dbc::put method  may  fail  and  throw  a
+       DbException(3)   or   return   errno   for  the  following
+       conditions:
+
+       [EACCES]
+            An attempt was made to modify a read-only database.
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       [EPERM]
+            Database corruption  was  detected.   All  subsequent
+            database  calls  (other  than  Db::close) will return
+            EPERM.
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), DbMpoolFile(3), Dbt(3), DbTxn(3),
+       DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/Dbc.j.html b/mozilla/db/man/man.html/Dbc.j.html new file mode 100644 index 00000000000..47e468adc22 --- /dev/null +++ b/mozilla/db/man/man.html/Dbc.j.html @@ -0,0 +1,480 @@ + + +Dbc + + +

Dbc

+
+
+
+       import com.sleepycat.db.*;
+
+       public void close()
+            throws DbException;
+
+       public void del(int flags)
+            throws DbException;
+
+       public int get(Dbt key, Dbt data, int flags)
+            throws DbException;
+
+       public void put(Dbt key, Dbt data, int flags)
+            throws DbException;
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).
+
+       This manual page describes the  specific  details  of  the
+       cursor support for the access methods in Db(3).
+
+       The  Dbc  functions  are  the library interface supporting
+       sequential access to the  records  stored  by  the  access
+       methods of the Db library.  Cursors are created by calling
+       Db.cursor method described in Db(3), which returns  a  Dbc
+       object.
+
+       Each cursor maintains positioning information within a set
+       of key/data  pairs.   In  the  presence  of  transactions,
+       cursors  are  only  valid  within  the context of a single
+       transaction, the one specified during the  Db.cursor  call
+       described   in  Db(3).   All  cursor  operations  will  be
+       executed in  the  context  of  that  transaction.   Before
+       aborting  or  committing  a  transaction, all cursors used
+       within that transaction must be closed.  In  the  presence
+       of  transactions, the application must call DbTxn.abort if
+       any of the  cursor  operations  returns  that  a  deadlock
+       (EAGAIN) or system failure occurred.
+
+       When  locking  is enabled, page locks are retained between
+       consecutive  cursor  calls.   For  this  reason,  in   the
+       presence  of  locking, applications should discard cursors
+       as soon as they are done with them.  Calling the  Db.close
+       method  (see  Db(3))  discards  any  cursors opened in the
+       context of a particular Db object returned by the  Db.open
+       call.
+       The methods of the Dbc are defined as follows:
+
+       int Dbc.close();
+            A  method  that  discards  the  cursor.   No  further
+            references to the Dbc object should be made.
+
+            The Dbc.close method  throws  a  DbException(3)  that
+            encapsulates an errno on failure.
+
+       int Dbc.del(u_int32_t flags);
+            A  method  that  deletes  the key/data pair currently
+            referenced by the cursor.
+
+            The flags parameter is currently unused, and must  be
+            set to 0.
+
+            The  cursor  position is unchanged after a delete and
+            subsequent calls to cursor  functions  expecting  the
+            cursor to reference an existing key will fail.
+
+            The  Dbc.del  method  throws  a  DbException(3)  that
+            encapsulates an errno on failure, and DB_KEYEMPTY  if
+            the element has already been deleted.
+
+       int Dbc.get(Dbt key, Dbt data, int flags);
+            A  method  that  retrieves  key/data  pairs  from the
+            database.  The byte array and length of the  key  are
+            returned  in the object referenced by key (except for
+            the case of the DB_SET flag where the key  object  is
+            unchanged), and the byte array and length of the data
+            are returned in the object referenced by data.
+
+            Modifications to the  database  during  a  sequential
+            scan  will  be  reflected  in  the scan, i.e. records
+            inserted behind a cursor will not be  returned  while
+            records  inserted  in  front  of  a  cursor  will  be
+            returned.
+
+            In recno databases, missing  entries  (i.e.,  entries
+            that  were  never  explicitly  created  or  that were
+            created and then deleted), will be skipped  during  a
+            sequential scan.
+
+            If  multiple  threads  or processes insert items into
+            the same database file  without  using  locking,  the
+            results  are  undefined.   For  more  detail, see the
+            section below on cursor stability.
+
+            The parameter flags must be set to exactly one of the
+            following values:
+
+            Db.DB_FIRST
+                 The   cursor  is  set  to  reference  the  first
+                 key/data pair of the database, and that pair  is
+                 returned.   In  the  presence  of  duplicate key
+                 values, the  first  data  item  in  the  set  of
+                 duplicates is returned.
+
+                 If  the  database  is  empty, the Dbc.get method
+                 will return DB_NOTFOUND.
+
+            Db.DB_LAST
+                 The cursor is set to reference the last key/data
+                 pair of the database, and that pair is returned.
+                 In the presence of  duplicate  key  values,  the
+                 last  data  item  in  the  set  of duplicates is
+                 returned.
+
+                 If the database is  empty,  the  Dbc.get  method
+                 will return DB_NOTFOUND.
+
+            Db.DB_NEXT
+                 If the cursor is not yet initialized, DB_NEXT is
+                 identical to DB_FIRST.
+
+                 Otherwise, move the cursor to the next  key/data
+                 pair of the database, and that pair is returned.
+                 In the presence of  duplicate  key  values,  the
+                 value of the key may not change.
+
+                 If  the  cursor is already on the last record in
+                 the database, the  Dbc.get  method  will  return
+                 DB_NOTFOUND.
+
+            Db.DB_PREV
+                 If the cursor is not yet initialized, DB_PREV is
+                 identical to DB_LAST.
+
+                 Otherwise,  move  the  cursor  to  the  previous
+                 key/data  pair of the database, and that pair is
+                 returned.  In  the  presence  of  duplicate  key
+                 values, the value of the key may not change.
+
+                 If  the cursor is already on the first record in
+                 the database, the  Dbc.get  method  will  return
+                 DB_NOTFOUND.
+
+            Db.DB_CURRENT
+                 Return the key/data pair currently referenced by
+                 the cursor.
+
+                 If the cursor key/data pair  has  been  deleted,
+                 the Dbc.get method will return DB_KEYEMPTY.
+                 If  the  cursor  is  not  yet  initialized,  the
+                 Dbc.get method will return EINVAL.
+
+            Db.DB_SET
+                 Move the cursor to the specified  key/data  pair
+                 of the database, and return the datum associated
+                 with the given key.
+
+                 In the presence of duplicate key values, Dbc.get
+                 will  return  the  first data item for the given
+                 key.
+
+                 If the database is  a  recno  database  and  the
+                 requested  key  exists, but was never explicitly
+                 created by the application or was later deleted,
+                 the Dbc.get method returns DB_KEYEMPTY.
+
+                 If  no  matching  keys  are  found,  the Dbc.get
+                 method will return DB_NOTFOUND.
+
+            Db.DB_SET_RANGE
+                 The DB_SET_RANGE flag is identical to the DB_SET
+                 flag, except that the key is returned as well as
+                 the data item, and, in the  case  of  the  btree
+                 access method, the returned key/data pair is the
+                 smallest  key  greater  than  or  equal  to  the
+                 specified  key  (as determined by the comparison
+                 function), permitting partial  key  matches  and
+                 range searches.
+
+            Db.DB_SET_RECNO
+                 Move  the cursor to the specific numbered record
+                 of  the  database,  and  return  the  associated
+                 key/data  pair.  The data field of the specified
+                 key must be a byte  array  containing  a  record
+                 number, as described in Dbt(3).  This determines
+                 the record to be retrieved.
+
+                 For DB_SET_RECNO to be specified, the underlying
+                 database  must be of type btree and it must have
+                 been  created  with  the  DB_RECNUM  flag   (see
+                 Db.open in Db(3)).
+
+            Db.DB_GET_RECNO
+                 Return  the  record  number  associated with the
+                 cursor.  The record number will be  returned  in
+                 the  data  Dbt  as described in Dbt(3).  The key
+                 parameter is ignored.
+
+                 For DB_GET_RECNO to be specified, the underlying
+                 database  must be of type btree and it must have
+                 been  created  with  the  DB_RECNUM  flag   (see
+                 Db.open in Db(3)).
+
+            Otherwise, the Dbc.get method throws a DbException(3)
+            that encapsulates an errno on failure,
+
+            If Dbc.get fails for any reason,  the  state  of  the
+            cursor will be unchanged.
+
+       int Dbc.put(Dbt key, Dbt data, int flags);
+              A  method  that  stores  key/data  pairs  into  the
+            database.
+
+            The flags parameter must be set to exactly one of the
+            following values:
+
+            Db.DB_AFTER
+                 In  the  case  of  the  btree  and  hash  access
+                 methods, insert the data element as a  duplicate
+                 element  of  the  key  referenced by the cursor.
+                 The new element appears  immediately  after  the
+                 current  cursor  position.   It  is  an error to
+                 specify DB_AFTER if the underlying btree or hash
+                 database  was  not created with the DB_DUP flag.
+                 The key parameter is ignored.
+
+                 In the case of the recno access method, it is an
+                 error  to  specify  DB_AFTER  if  the underlying
+                 recno  database  was  not   created   with   the
+                 DB_RENUMBER  flag.   If the DB_RENUMBER flag was
+                 specified, a new key  is  created,  all  records
+                 after   the   inserted  item  are  automatically
+                 renumbered, and the key of  the  new  record  is
+                 returned   in   the  object  referenced  by  the
+                 parameter key.  The initial  value  of  the  key
+                 parameter  is ignored.  See Db.open in Db(3) for
+                 more information.
+
+                 If  the  cursor  is  not  yet  initialized,  the
+                 Dbc.put method will return EINVAL.
+
+            Db.DB_BEFORE
+                 In  the  case  of  the  btree  and  hash  access
+                 methods, insert the data element as a  duplicate
+                 element  of  the  key  referenced by the cursor.
+                 The new element appears immediately  before  the
+                 current  cursor  position.   It  is  an error to
+                 specify DB_BEFORE if  the  underlying  btree  or
+                 hash  database  was  not created with the DB_DUP
+                 flag.  The key parameter is ignored.
+
+                 In the case of the recno access method, it is an
+                 error  to  specify  DB_BEFORE  if the underlying
+                 recno  database  was  not   created   with   the
+                 DB_RENUMBER  flag.   If the DB_RENUMBER flag was
+                 specified, a new key  is  created,  the  current
+                 record    and   all   records   after   it   are
+                 automatically renumbered, and the key of the new
+                 record  is  returned in the object referenced by
+                 the parameter key.  The initial value of the key
+                 parameter  is ignored.  See Db.open in Db(3) for
+                 more information.
+
+                 If  the  cursor  is  not  yet  initialized,  the
+                 Dbc.put method will return EINVAL.
+
+            Db.DB_CURRENT
+                 Overwrite   the   data   of  the  key/data  pair
+                 referenced by the cursor with the specified data
+                 item.
+
+                 The key parameter is ignored.
+
+                 If  the  cursor  is  not  yet  initialized,  the
+                 Dbc.put method will return EINVAL.
+
+            Db.DB_KEYFIRST
+                 In  the  case  of  the  btree  and  hash  access
+                 methods, insert the specified key/data pair into
+                 the database.  If the key already exists in  the
+                 database, the inserted data item is added as the
+                 first of the data items for that key.
+
+                 The DB_KEYFIRST flag may not be specified to the
+                 recno access method.
+
+            Db.DB_KEYLAST
+                 Insert  the  specified  key/data  pair  into the
+                 database.  If the  key  already  exists  in  the
+                 database, the inserted data item is added as the
+                 last of the data items for that key.
+
+                 The DB_KEYLAST flag may not be specified to  the
+                 recno access method.
+
+            If  the  cursor  record has been deleted, the Dbc.put
+            method will return DB_KEYEMPTY.
+
+            Otherwise, the Dbc.put method throws a DbException(3)
+            that encapsulates an errno on failure,
+
+            If  Dbc.put  fails  for  any reason, the state of the
+            cursor will be unchanged.  If Dbc.put succeeds and an
+            item  is  inserted  into  the database, the cursor is
+            always positioned to  reference  the  newly  inserted
+            item.
+
+
+
+

CURSOR STABILITY

+       In  the  absence  of locking, no guarantees are made about
+       the  stability  of  cursors  in  different  processes   or
+       threads.   However,  the  btree  and  recno access methods
+       guarantee that cursor operations, interspersed with  other
+       cursor  or  non-cursor  operations  in  the same thread of
+       control (i.e., thread or  single-threaded  process),  will
+       always  return  keys  in  order  and will return each non-
+       deleted key/data pair  exactly  once.   Because  the  hash
+       access  method uses a dynamic hashing algorithm, it cannot
+       guarantee any form of stability in the presence of inserts
+       and deletes unless locking is performed.
+
+       If  locking was specified when the Db file was opened, but
+       transactions are not in effect, the access methods provide
+       repeatable  reads  with respect to the cursor.  That is, a
+       DB_CURRENT call on the cursor is guaranteed to return  the
+       same  record  as  was  returned  on  the  last call to the
+       cursor.
+
+       In the presence of transactions, the access  method  calls
+       between  DbTxnMgr.begin  and  DbTxn.abort  or DbTxn.commit
+       provide degree 3 consistency.  For all access  methods,  a
+       cursor  scan  of the database performed within the context
+       of a transaction is guaranteed  to  return  each  key/data
+       pair  once  and  only  once, except in the following case.
+       If, while performing a cursor scan using the  hash  access
+       method,  the transaction performing the scan inserts a new
+       pair into the database,  it  is  possible  that  duplicate
+       key/data pairs will be returned.
+
+
+
+

ERRORS

+       The  Dbc.close  method may fail and throw a DbException(3)
+       for any of the errors specified for the following  DB  and
+       library functions: DbLock.get(3), DbLock.put(3),
+       DbLockTab.id(3), DbLockTab.vec(3), DbLog.put(3),
+       DbMpoolFile.get(3), DbMpoolFile.put(3),
+       DbMpoolFile.set(3), calloc(3), fcntl(2), fflush(3),
+       malloc(3), memcpy(3), memmove(3), memset(3), realloc(3),
+       and strerror(3).
+
+       In addition, the Dbc.close method may  fail  and  throw  a
+       DbException(3)  encapsulating  an  errno for the following
+       conditions:
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EPERM]
+            Database corruption  was  detected.   All  subsequent
+            database  calls  (other  than  Db.close)  will return
+            EPERM.
+
+       The Dbc.del method may fail and throw a DbException(3) for
+       any  of  the  errors  specified  for  the following DB and
+       library functions: Db.del(3), DbLock.get(3),
+       DbLock.put(3), DbLockTab.id(3), DbLockTab.vec(3),
+       DbLog.put(3), DbMpoolFile.get(3), DbMpoolFile.put(3),
+       DbMpoolFile.set(3), calloc(3), fcntl(2), fflush(3),
+       malloc(3), memcpy(3), memmove(3), memset(3), realloc(3),
+       and strerror(3).
+
+       In  addition,  the  Dbc.del  method  may  fail and throw a
+       DbException(3) encapsulating an errno  for  the  following
+       conditions:
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       [EPERM]
+            Database  corruption  was  detected.   All subsequent
+            database calls  (other  than  Db.close)  will  return
+            EPERM.
+
+       The Dbc.get method may fail and throw a DbException(3) for
+       any of the errors  specified  for  the  following  DB  and
+       library functions: Db.get(3), DbLock.get(3),
+       DbLock.put(3), DbLockTab.id(3), DbLockTab.vec(3),
+       DbLog.put(3), DbMpoolFile.get(3), DbMpoolFile.put(3),
+       DbMpoolFile.set(3), calloc(3), fcntl(2), fflush(3),
+       malloc(3), memcmp(3), memcpy(3), memmove(3), memset(3),
+       realloc(3), and strerror(3).
+
+       In addition, the Dbc.get  method  may  fail  and  throw  a
+       DbException(3)  encapsulating  an  errno for the following
+       conditions:
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The DB_THREAD  flag  was  specified  to  the  Db.open
+            method   described   in   Db(3)   and   neither   the
+            DB_DBT_MALLOC or DB_DBT_USERMEM flags were set in the
+            Dbt.
+
+       [EPERM]
+            Database  corruption  was  detected.   All subsequent
+            database calls  (other  than  Db.close)  will  return
+            EPERM.
+
+       The Dbc.put method may fail and throw a DbException(3) for
+       any of the errors  specified  for  the  following  DB  and
+       library functions: DbLock.get(3), DbLock.put(3),
+       DbLockTab.id(3), DbLockTab.vec(3), DbLog.put(3),
+       DbMpoolFile.get(3), DbMpoolFile.put(3),
+       DbMpoolFile.set(3), calloc(3), fcntl(2), fflush(3),
+       malloc(3), memcmp(3), memcpy(3), memmove(3), memset(3),
+       realloc(3), and strerror(3).
+
+       In addition, the Dbc.put  method  may  fail  and  throw  a
+       DbException(3)  encapsulating  an  errno for the following
+       conditions:
+
+       [EACCES]
+            An attempt was made to modify a read-only database.
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       [EPERM]
+            Database corruption  was  detected.   All  subsequent
+            database  calls  (other  than  Db.close)  will return
+            EPERM.
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), Dbt(3), DbTxn(3), DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/Dbt.html b/mozilla/db/man/man.html/Dbt.html new file mode 100644 index 00000000000..221cac7a88d --- /dev/null +++ b/mozilla/db/man/man.html/Dbt.html @@ -0,0 +1,268 @@ + + +Dbt + + +

Dbt

+
+
+
+       void *Dbt::get_data() const;
+       void Dbt::set_data(void *);
+
+       u_int32_t Dbt::get_size() const;
+       void Dbt::set_size(u_int32_t);
+
+       u_int32_t Dbt::get_ulen() const;
+       void Dbt::set_ulen(u_int32_t);
+
+       u_int32_t Dbt::get_dlen() const;
+       void Dbt::set_dlen(u_int32_t);
+
+       u_int32_t Dbt::get_doff() const;
+       void Dbt::set_doff(u_int32_t);
+
+       u_int32_t Dbt::get_flags() const;
+       void Dbt::set_flags(u_int32_t);
+
+       Dbt::Dbt(void *data, size_t size);
+       Dbt::Dbt();
+       Dbt::~Dbt();
+       Dbt::Dbt(const Dbt &);
+       Dbt::Dbt &operator = (const Dbt &);
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).  This manual page describes  the
+       specific details of the Dbt class, used to encode keys and
+       data items in a database.
+
+
+
+

KEY/DATA PAIRS

+       Storage and retrieval for the Db access methods are  based
+       on   key/data   pairs.    Both  key  and  data  items  are
+       represented by Dbt objects.
+
+       Key  and  data  byte  strings  may  reference  strings  of
+       essentially  unlimited  length, although any two keys must
+       fit into available memory at the same time  so  that  they
+       may  be  compared,  and  any  one  data item must fit into
+       available memory so that it may be returned.
+
+       The Dbt class provides simple access to an underlying data
+       structure, whose elements can be examined or changed using
+       the set_ or get_ methods.  The  remainder  of  the  manual
+       page   sometimes   refers  to  these  accesses  using  the
+       underlying name, e.g., simply ulen instead of get_ulen and
+       set_ulen.   The  constructors  set  all  elements  of  the
+       underlying structure to zero.  The  constructor  with  two
+       arguments  has  the effect of setting all elements to zero
+       except for the specified data and size elements.   In  the
+       case  where  the  flags structure element is 0, when being
+       provided a key or data item by  the  application,  the  DB
+       package  expects the data object to point to a byte string
+       of size bytes.  When returning  a  key/data  item  to  the
+       application,  the  DB  package  will  store  into the data
+       object a pointer to a  byte  string  of  size  bytes.   By
+       default,  the  memory referenced by this stored pointer is
+       only valid until the next call to the DB package using the
+       Db handle returned by Db::open.
+
+       The access methods provide no guarantees about byte string
+       alignment,   and   applications   are   responsible    for
+       maintaining    any    necessary    alignment.    Use   the
+       DB_DBT_USERMEM flag to cause returned items to  be  placed
+       in  memory of arbitrary alignment.  Although Java normally
+       maintains proper alignment of byte arrays, the  set_offset
+       method   can  be  used  to  specify  unaligned  addresses.
+       Unaligned address accesses that are not supported  by  the
+       underlying  hardware  may  be reported as an exception, or
+       may stop the running Java program.
+
+       The elements of the structure underlying the Dbt class are
+       defined as follows:
+
+       void *data;
+            A pointer to a byte string.  This element is accessed
+            using get_data and set_data, and may  be  initialized
+            using one of the constructors.
+
+       int offset;
+            The  number  of  bytes  offset into the data array to
+            determine the portion of  the  array  actually  used.
+            This   element   is  accessed  using  get_offset  and
+            set_offset.
+
+       u_int32_t size;
+            The length  of  data,  in  bytes.   This  element  is
+            accessed  using  get_size  and  set_size,  and may be
+            initialized using the constructor with two arguments.
+
+       u_int32_t ulen;
+            The  size  of the user's buffer (referenced by data),
+            in bytes.  This location is not  written  by  the  Db
+            functions.   See  the  DB_DBT_USERMEM  flag  for more
+            information.  This element is accessed using get_ulen
+            and set_ulen.
+
+       u_int32_t dlen;
+            The  length  of  the  partial  record  being  read or
+            written  by  the  application,  in  bytes.   See  the
+            DB_DBT_PARTIAL   flag  for  more  information.   This
+            element is accessed using get_dlen and set_dlen.
+
+       u_int32_t doff;
+            The offset  of  the  partial  record  being  read  or
+            written  by  the  application,  in  bytes.   See  the
+            DB_DBT_PARTIAL  flag  for  more  information.    This
+            element is accessed using get_doff and set_doff.
+
+       u_int32_t flags;
+            This   element   is   accessed  using  get_flags  and
+            set_flags.  The flags value is  specified  by  or'ing
+            together one or more of the following values:
+
+            DB_DBT_MALLOC
+                 Ignored  except when retrieving information from
+                 a database, e.g., a Db::get  or  Dbc::get  call.
+                 This  flag  causes Db to allocate memory for the
+                 returned key or data item (using  malloc(3),  or
+                 the  user-specified  malloc method) and return a
+                 pointer to it in the data field of  the  key  or
+                 data  Dbt  object.  The allocated memory becomes
+                 the responsibility of the  calling  application.
+                 It is an error to specify both DB_DBT_MALLOC and
+                 DB_DBT_USERMEM.
+
+            DB_DBT_USERMEM
+                 Ignored except when retrieving information  from
+                 a  database,  e.g.,  a Db::get or Dbc::get call.
+                 The data field of the key or  data  object  must
+                 reference  memory that is at least ulen bytes in
+                 length.  If the length of the requested item  is
+                 less  than or equal to that number of bytes, the
+                 item is copied into the memory referenced by the
+                 data  field.   Otherwise,  an error is returned,
+                 the size field is set to the length  needed  for
+                 the  requested  item,  and the errno variable is
+                 set to ENOMEM.  It is an error to  specify  both
+                 DB_DBT_MALLOC and DB_DBT_USERMEM.
+
+            DB_DBT_PARTIAL
+                 Ignored   except   when  specified  for  a  data
+                 parameter, where this flag  causes  the  partial
+                 retrieval or storage of an item.  If the calling
+                 application is  doing  a  get,  the  dlen  bytes
+                 starting  doff  bytes  from the beginning of the
+                 retrieved data record are returned  as  if  they
+                 comprised  the  entire record.  If any or all of
+                 the specified bytes do not exist in the  record,
+                 the  get is successful and the existing bytes or
+                 0 bytes are returned.
+
+                 For example, if the data portion of a  retrieved
+                 record  was  100  bytes, and a partial retrieval
+                 was done using a Dbt having a dlen field  of  20
+                 and  a  doff  field  of  85,  the get call would
+                 succeed, the data field would reference the last
+                 15 bytes of the record, and the size field would
+                 be set to 15.
+
+                 If the calling application is doing a  put,  the
+                 dlen   bytes   starting   doff  bytes  from  the
+                 beginning of the specified key's data record are
+                 replaced  by  the data specified by the data and
+                 size objects.  If dlen is smaller than size, the
+                 record  will  grow,  and  if dlen is larger than
+                 size, the record will shrink.  If the  specified
+                 bytes  do not exist, the record will be extended
+                 using nul bytes as necessary, and the  put  call
+                 will succeed.
+
+                 It  is  an  error to attempt a partial put using
+                 the Db::put method in a database  that  supports
+                 duplicate  records.   Partial  puts in databases
+                 supporting duplicate records must be done  using
+                 a  Db::cursor method.  It is an error to attempt
+                 a partial  put  with  differing  dlen  and  size
+                 values  in  a  recno  database with fixed-length
+                 records.
+
+                 For example, if the data portion of a  retrieved
+                 record was 100 bytes, and a partial put was done
+                 using a Dbt having a dlen field of  20,  a  doff
+                 field  of  85,  and  a  size  field  of  30, the
+                 resulting record would be 115 bytes  in  length,
+                 where the last 30 bytes would be those specified
+                 by the put call.
+
+       The default algorithm of associating returned key or  data
+       items  with  the  Db  handle  returned by Db::open(3) will
+       obviously  not  work  when  Db  handles  are  being   used
+       concurrently  by  multiple  threads within a process, i.e,
+       when  DB_THREAD  was  specified  to   Db::open(3).    When
+       multiple   threads   are  using  the  returned  Db  handle
+       concurrently, either the DB_DBT_MALLOC  or  DB_DBT_USERMEM
+       flags  must  be specified for any Dbt used for key or data
+       retrieval.
+
+
+
+

LOGICAL RECORD NUMBERS

+       In all cases for the recno access method, and when calling
+       the  Db::get  and Dbc::get functions with the DB_GET_RECNO
+       flag specified, the data
+
+       field of the key must be a pointer to a memory location of
+       type  db_recno_t,  as  typedef'd in the <db_cxx.h> include
+       file.  This type is a 32-bit unsigned type, (which  limits
+       the number of logical records in a recno database, and the
+       maximum logical record which  may  be  directly  retrieved
+       from  a btree database, to 4,294,967,296).  The size field
+       of the key should be the size of that type, e.g.,
+
+       in the C programming language, ``sizeof(db_recno_t)''.
+
+       Logical record numbers are 1-based, not 0-based, i.e., the
+       first record in the database is record number 1.
+
+
+
+

BUGS

+       The  Db  access  methods  provide no guarantees about byte
+       string alignment, and  applications  are  responsible  for
+       maintaining any necessary alignment.
+
+       The  name  Dbt  is a mnemonic for ``data base thang'', and
+       was used because noone could think of  a  reasonable  name
+       that wasn't already in use somewhere else.
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), DbMpoolFile(3), Dbt(3), DbTxn(3),
+       DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/Dbt.j.html b/mozilla/db/man/man.html/Dbt.j.html new file mode 100644 index 00000000000..d7b8385dbad --- /dev/null +++ b/mozilla/db/man/man.html/Dbt.j.html @@ -0,0 +1,279 @@ + + +Dbt + + +

Dbt

+
+
+
+       import com.sleepycat.db.*;
+
+       public Dbt();
+       public Dbt(byte[] data);
+       public Dbt(byte[] data, int off, int len);
+
+       public void set_data(byte[] data);
+       public byte[] get_data();
+
+       public void set_offset(int off);
+       public int get_offset();
+
+       public int get_size();
+       public void set_size(int size);
+
+       public int get_ulen();
+       public void set_ulen(int ulen);
+
+       public int get_dlen();
+       public void set_dlen(int dlen);
+
+       public int get_doff();
+       public void set_doff(int doff);
+
+       public int get_flags();
+       public void set_flags(int flags);
+
+       public void set_recno_key_data(int recno);
+       public int get_recno_key_data();
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a  family of classes that provides a
+       modular programming interface to transactions and  record-
+       oriented  file  access.   The library includes support for
+       transactions, locking, logging and file page  caching,  as
+       well  as  various  indexed  access  methods.   Many of the
+       classes (e.g., the file page  caching  class)  are  useful
+       independent of the other DB classes, although some classes
+       are explicitly based on other classes (e.g.,  transactions
+       and  logging).   For  a  general  description  of  the  DB
+       package, see db_intro(3).  This manual page describes  the
+       specific details of the Dbt class, used to encode keys and
+       data items in a database.
+
+
+
+

KEY/DATA PAIRS

+       Storage and retrieval for the Db access methods are  based
+       on   key/data   pairs.    Both  key  and  data  items  are
+       represented by Dbt objects.
+
+       Key  and  data  byte  strings  may  reference  strings  of
+       essentially  unlimited  length, although any two keys must
+       fit into available memory at the same time  so  that  they
+       may  be  compared,  and  any  one  data item must fit into
+       available memory so that it may be returned.
+
+       The Dbt class provides simple access to an underlying data
+       structure, whose elements can be examined or changed using
+       the set_ or get_ methods.  The  remainder  of  the  manual
+       page   sometimes   refers  to  these  accesses  using  the
+       underlying name, e.g., simply ulen instead of get_ulen and
+       set_ulen.   The  constructors  set  all  elements  of  the
+       underlying structure to zero.  The  constructor  with  two
+       arguments  has  the effect of setting all elements to zero
+       except for the specified data and size elements.   In  the
+       case  where  the  flags structure element is 0, when being
+       provided a key or data item by  the  application,  the  DB
+       package  expects the data object to be set to a byte array
+       of size bytes.  When returning  a  key/data  item  to  the
+       application,  the  DB  package  will  store  into the data
+       object a a byte array of size bytes.
+
+       The access methods provide no guarantees about byte string
+       alignment,    and   applications   are   responsible   for
+       maintaining   any   necessary    alignment.     Use    the
+       DB_DBT_USERMEM  flag  to cause returned items to be placed
+       in memory of arbitrary alignment.
+
+       The elements of the structure underlying the Dbt class are
+       defined as follows:
+
+       byte[] data;
+            A  byte  array  containing the data.  This element is
+            accessed using get_data  and  set_data,  and  may  be
+            initialized using one of the constructors.  Note that
+            the array data is not copied  immediately,  but  only
+            when the Dbt is used.
+
+       int offset;
+            The  number  of  bytes  offset into the data array to
+            determine the portion of  the  array  actually  used.
+            This   element   is  accessed  using  get_offset  and
+            set_offset.
+
+       int size;
+            The length  of  data,  in  bytes.   This  element  is
+            accessed  using  get_size  and  set_size,  and may be
+            initialized implicitly to  the  length  of  the  data
+            array with the constructor having one argument.
+
+       int ulen;
+            The  size  of the user's buffer (referenced by data),
+            in bytes.  This location is not  written  by  the  Db
+            functions.   See  the  DB_DBT_USERMEM  flag  for more
+            information.  This element is accessed using get_ulen
+            and set_ulen.
+
+       int dlen;
+            The  length  of  the  partial  record  being  read or
+            written  by  the  application,  in  bytes.   See  the
+            DB_DBT_PARTIAL   flag  for  more  information.   This
+            element is accessed using get_dlen and set_dlen.
+
+       int doff;
+            The offset  of  the  partial  record  being  read  or
+            written  by  the  application,  in  bytes.   See  the
+            DB_DBT_PARTIAL  flag  for  more  information.    This
+            element is accessed using get_doff and set_doff.
+
+       int flags;
+            This   element   is   accessed  using  get_flags  and
+            set_flags.  The flags value is  specified  by  or'ing
+            together one or more of the following values:
+
+            Db.DB_DBT_MALLOC
+                 Ignored  except when retrieving information from
+                 a database, e.g.,  a  Db.get  or  Dbc.get  call.
+                 This  flag  causes Db to allocate memory for the
+                 returned key or data  item  and  return  a  byte
+                 array  containing  the data in the data field of
+                 the key or data Dbt object.  It is an  error  to
+                 specify both DB_DBT_MALLOC and DB_DBT_USERMEM.
+
+            Db.DB_DBT_USERMEM
+                 Ignored  except when retrieving information from
+                 a database, e.g., a Db.get or Dbc.get call.  The
+                 data  field  of  the  key  or  data  object must
+                 reference memory that is at least ulen bytes  in
+                 length.   If the length of the requested item is
+                 less than or equal to that number of bytes,  the
+                 item is copied into the memory referenced by the
+                 data field.  Otherwise, an  error  is  returned,
+                 the  size  field is set to the length needed for
+                 the requested item, and the  errno  variable  is
+                 set  to  ENOMEM.  It is an error to specify both
+                 DB_DBT_MALLOC and DB_DBT_USERMEM.
+
+            Db.DB_DBT_PARTIAL
+                 Ignored  except  when  specified  for   a   data
+                 parameter,  where  this  flag causes the partial
+                 retrieval or storage of an item.  If the calling
+                 application  is  doing  a  get,  the  dlen bytes
+                 starting doff bytes from the  beginning  of  the
+                 retrieved  data  record  are returned as if they
+                 comprised the entire record.  If any or  all  of
+                 the  specified bytes do not exist in the record,
+                 the get is successful and the existing bytes  or
+                 0 bytes are returned.
+                 For  example, if the data portion of a retrieved
+                 record was 100 bytes, and  a  partial  retrieval
+                 was  done  using a Dbt having a dlen field of 20
+                 and a doff field  of  85,  the  get  call  would
+                 succeed, the data field would reference the last
+                 15 bytes of the record, and the size field would
+                 be set to 15.
+
+                 If  the  calling application is doing a put, the
+                 dlen  bytes  starting  doff   bytes   from   the
+                 beginning of the specified key's data record are
+                 replaced by the data specified by the  data  and
+                 size objects.  If dlen is smaller than size, the
+                 record will grow, and if  dlen  is  larger  than
+                 size,  the record will shrink.  If the specified
+                 bytes do not exist, the record will be  extended
+                 using  nul  bytes as necessary, and the put call
+                 will succeed.
+
+                 It is an error to attempt a  partial  put  using
+                 the  Db.put  method  in a database that supports
+                 duplicate records.  Partial  puts  in  databases
+                 supporting  duplicate records must be done using
+                 a Db.cursor method.  It is an error to attempt a
+                 partial  put with differing dlen and size values
+                 in a recno database with fixed-length records.
+
+                 For example, if the data portion of a  retrieved
+                 record was 100 bytes, and a partial put was done
+                 using a Dbt having a dlen field of  20,  a  doff
+                 field  of  85,  and  a  size  field  of  30, the
+                 resulting record would be 115 bytes  in  length,
+                 where the last 30 bytes would be those specified
+                 by the put call.
+
+       The default algorithm of associating returned key or  data
+       items  with  the  Db  handle  returned  by Db.open(3) will
+       obviously  not  work  when  Db  handles  are  being   used
+       concurrently  by  multiple  threads within a process, i.e,
+       when DB_THREAD was specified to Db.open(3).  When multiple
+       threads  are  using  the  returned Db handle concurrently,
+       either the DB_DBT_MALLOC or DB_DBT_USERMEM flags  must  be
+       specified for any Dbt used for key or data retrieval.
+
+       For  this  reason,  when using the JAVA DB API, either the
+       DB_DBT_MALLOC or DB_DBT_USERMEM flags  must  be  specified
+       for   any   Dbt  used  for  key  or  data  retrieval.   If
+       DB_DBT_USERMEM is specified, the data  field  of  the  Dbt
+       must be set to an appropriately sized byte array.
+
+       If  DB_DBT_MALLOC  is  specified,  DB allocates a properly
+       sized byte  array  to  contain  the  data.   This  can  be
+       convenient  if  you  know  little  about the nature of the
+       data, specifically the  size  of  data  in  the  database.
+       However,  if  your  application  makes  repeated  calls to
+       retrieve keys or data, you may  notice  increased  garbage
+       collection  due  to  this  allocation.   If  you  know the
+       maximum  size  of  data  you  are  retrieving,  you  might
+       decrease  the  memory burden and speed your application by
+       allocating your own byte array and  using  DB_DBT_USERMEM.
+       Even  if you don't know the maximum size, you can use this
+       option and reallocate your array whenever  your  retrieval
+       API call returns an ENOMEM error.
+
+
+
+

LOGICAL RECORD NUMBERS

+       In all cases for the recno access method, and when calling
+       the Db.get and Dbc.get  functions  with  the  DB_GET_RECNO
+       flag  specified,  the data field of the key must be a four
+       byte  array,  large  enough  to   store   an   int.    The
+       set_recno_key_data  method can be used to set the value of
+       the array.  An int is a 32-bit  type,  (which  limits  the
+       number  of  logical  records  in a recno database, and the
+       maximum logical record which  may  be  directly  retrieved
+       from  a btree database, to 4,294,967,296).  The size field
+       of the key should be the size of that type, e.g., 4.
+
+       Logical record numbers are 1-based, not 0-based, i.e., the
+       first record in the database is record number 1.
+
+
+
+

BUGS

+       The  Db  access  methods  provide no guarantees about byte
+       string alignment, and  applications  are  responsible  for
+       maintaining any necessary alignment.
+
+       The  name  Dbt  is a mnemonic for ``data base thang'', and
+       was used because noone could think of  a  reasonable  name
+       that wasn't already in use somewhere else.
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
+       DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
+       DbLsn(3), DbMpool(3), Dbt(3), DbTxn(3), DbTxnMgr(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/db_appinit.html b/mozilla/db/man/man.html/db_appinit.html new file mode 100644 index 00000000000..5b04c3a7989 --- /dev/null +++ b/mozilla/db/man/man.html/db_appinit.html @@ -0,0 +1,627 @@ + + +db_appinit + + +

db_appinit

+
+
+
+       #include <db.h>
+
+       char *
+       db_version(int *major, int *minor, int *patch);
+
+       int
+       db_appinit(char *db_home,
+            char *db_config[], DB_ENV *dbenv, u_int32_t flags);
+
+       int
+       db_appexit(DB_ENV *dbenv);
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a family of groups of functions that
+       provides a modular programming interface  to  transactions
+       and  record-oriented  file  access.   The library includes
+       support for transactions, locking, logging and  file  page
+       caching,  as well as various indexed access methods.  Many
+       of the functional groups  (e.g.,  the  file  page  caching
+       functions)   are   useful  independent  of  the  other  DB
+       functions, although some functional groups are  explicitly
+       based  on  other functional groups (e.g., transactions and
+       logging).  For a general description of  the  DB  package,
+       see db_intro(3).
+
+  db_version
+       The  db_version  function  returns  a  pointer to a string
+       containing DB version information.  If major is  non-NULL,
+       the  major  version  of  the  DB  release is stored in the
+       memory it references.  If minor  is  non-NULL,  the  minor
+       version  of  the  DB  release  is  stored in the memory it
+       references.  If patch is non-NULL, the  patch  version  of
+       the DB release is stored in the memory it references.
+
+  db_appinit
+       The   db_appinit   function   provides  a  simple  way  to
+       initialize and configure the DB environment.   It  is  not
+       necessary  that  it be called, but it provides a method of
+       creating a consistent environment for processes using  one
+       or more of the features of DB.
+
+       The  db_home  and  db_config  arguments  to db_appinit are
+       described in the section below entitled ``FILE NAMING''.
+
+       The flags  argument  specifies  the  subsystems  that  are
+       initialized  and  how  the  environment  affects  DB  file
+       naming, among other things.  The flags value is  specified
+       by or'ing together one or more of the following values:
+
+       DB_CREATE
+            Cause  subsystems  to create any underlying files, as
+            necessary.  (See db_lock(3), db_log(3),  db_mpool(3),
+            db_open(3) and db_txn(3) for more information.)
+
+       DB_INIT_LOCK
+            Initialize  the lock subsystem; see db_lock(3).  This
+            subsystem should be used when multiple  processes  or
+            threads  are  going  to  be  reading and writing a DB
+            database, so that they do  not  interfere  with  each
+            other.   If all threads are accessing the database(s)
+            read-only, then locking  is  unnecessary.   When  the
+            DB_INIT_LOCK   flag   is  specified,  it  is  usually
+            necessary   to    run    the    deadlock    detector,
+            db_deadlock(1), as well.
+
+       DB_INIT_LOG
+            Initialize  the  log  subsystem; see db_log(3).  This
+            subsystem is used when recovery from  application  or
+            system failure is important.
+
+       DB_INIT_MPOOL
+            Initialize  the  mpool  subsystem;  see  db_mpool(3).
+            This subsystem is used whenever  the  application  is
+            using the DB access methods for any purpose.
+
+       DB_INIT_TXN
+            Initialize  the transaction subsystem; see db_txn(3).
+            This subsystem is used  when  atomicity  of  multiple
+            operations   and   recovery   are   important.    The
+            DB_INIT_TXN flag implies the DB_INIT_LOG flag.
+
+       DB_MPOOL_PRIVATE
+            Create a private memory  pool  (see  db_mpool(3)  for
+            further  information).   Ignored unless DB_INIT_MPOOL
+            is also specified.
+
+       DB_NOMMAP
+            Do not map any files  within  this  environment  (see
+            db_mpool(3) for further information).  Ignored unless
+            DB_INIT_MPOOL is also specified.
+
+       DB_RECOVER
+            Run  normal  recovery  on  this  environment   before
+            opening  it for normal use.  If this flag is set, the
+            DB_CREATE flag must also be  set  since  the  regions
+            will be removed and recreated.
+
+            The   db_appinit  function  returns  successfully  if
+            DB_RECOVER is specified and no log files exist, so it
+            is  necessary  to  ensure all necessary log files are
+            present  before  running   recovery.    For   further
+            information,  consult  the man page for db_archive(1)
+            and db_recover(1).
+
+       DB_RECOVER_FATAL
+            Run catastrophic recovery on this environment  before
+            opening  it for normal use.  If this flag is set, the
+            DB_CREATE flag must also be  set  since  the  regions
+            will be removed and recreated.
+
+            The   db_appinit  function  returns  successfully  if
+            DB_RECOVER is specified and no log files exist, so it
+            is  necessary  to  ensure all necessary log files are
+            present  before  running   recovery.    For   further
+            information,  consult  the man page for db_archive(1)
+            and db_recover(1).
+
+       DB_THREAD
+            Ensure that handles returned by the DB subsystems are
+            useable  by multiple threads within a single process,
+            i.e., that the  system  is  ``free-threaded''.   (See
+            db_lock(3),  db_log(3),  db_mpool(3),  db_open(3) and
+            db_txn(3) for more information.)
+
+       DB_TXN_NOSYNC
+            On transaction commit, do not synchronously flush the
+            log (see db_txn(3) for further information).  Ignored
+            unless DB_INIT_TXN is also specified.
+
+       DB_USE_ENVIRON
+            The DB  process'  environment  may  be  permitted  to
+            specify information to be used when naming files (see
+            the section  entitled  ``FILE  NAMING''  below).   As
+            permitting  users to specify which files are used can
+            create  security  problems,  environment  information
+            will be used in file naming for all users only if the
+            DB_USE_ENVIRON flag is set.
+
+       DB_USE_ENVIRON_ROOT
+            The DB  process'  environment  may  be  permitted  to
+            specify information to be used when naming files (see
+            the section  entitled  ``FILE  NAMING''  below).   As
+            permitting  users to specify which files are used can
+            create security problems, if the  DB_USE_ENVIRON_ROOT
+            flag is set, environment information will be used for
+            file naming only for users with  a  user-ID  matching
+            that  of  the superuser (specifically, users for whom
+            the getuid system call returns the user-ID 0).
+
+       The DB  environment  is  configured  based  on  the  dbenv
+       argument  to db_appinit, which is a pointer to a structure
+       of type DB_ENV (typedef'd in <db.h>).   Applications  will
+       normally  use  the  same  DB_ENV structure (initialized by
+       db_appinit(3)), as an argument to all of the subsystems in
+       the DB package.
+
+       References  to  the DB_ENV structure are maintained by DB,
+       so it may not be discarded until the last close  function,
+       corresponding  to  an  open  function  for which it was an
+       argument, has returned.  In order to ensure  compatibility
+       with  future  releases  of  DB,  all  fields of the DB_ENV
+       structure  that  are  not   explicitly   set   should   be
+       initialized  to  0  before the first time the structure is
+       used.  Do this by  declaring  the  structure  external  or
+       static,  or  by  calling the C library routine bzero(3) or
+       memset(3).
+
+       The fields of the DB_ENV structure used by db_appinit  are
+       described  below.  The dbenv argument may not be NULL.  If
+       any of the fields of the dbenv  are  set  to  0,  defaults
+       appropriate for the system are used where possible.
+
+       The  following  fields  in  the  DB_ENV  structure  may be
+       initialized before calling db_appinit:
+
+       void (*db_errcall)(char *db_errpfx, char *buffer);
+            When an error occurs in  the  DB  package,  an  errno
+            value  is  returned  by the function.  In some cases,
+            however, the  errno  value  may  be  insufficient  to
+            completely describe the cause of the error.
+
+            If  db_errcall  is  non-NULL,  it  may be called with
+            additional error information.  The db_errpfx argument
+            is  the  current  environment's db_errpfx field.  The
+            buffer argument contains a nul-terminated string with
+            the additional information.
+
+            This  error  logging  facility should not be required
+            for normal operation, but may be useful in  debugging
+            applications.
+
+       FILE *db_errfile;
+            The   db_errfile   field  behaves  similarly  to  the
+            db_errcall field, except that the  error  message  is
+            written to the file stream represented by db_errfile.
+
+            If  db_errpfx  is  non-NULL,  the  message  will   be
+            preceded  by  the  string  referenced by db_errpfx, a
+            colon (``:'') and  a  space.   The  message  will  be
+            followed by a newline character.
+
+       const char *db_errpfx;
+            A  prefix  to  prepend to error messages.  Because DB
+            does not copy the memory referenced by the  db_errpfx
+            field,  the  application may modify the error message
+            prefix at any time.
+
+       int db_verbose;
+            Include informational and debugging messages as  well
+            as  error  messages  in the db_errcall and db_errfile
+            output.
+
+       Each of  the  open  functions  that  db_appinit  may  call
+       (lock_open, log_open, memp_open and txn_open) is called as
+       follows, where the DB_CREATE flag is optional:
+
+            XXX_open(NULL, DB_CREATE,
+               S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, dbenv)
+
+       This call will cause each subsystem to construct pathnames
+       as  described  in  the  section  on  ``FILE NAMING''.  The
+       subsystem has permission  to  read  and  write  underlying
+       files  as necessary, and optionally to create files.  (All
+       created files will be created readable  and  writeable  by
+       the  owner  and the group.  The group ownership of created
+       files is based on the system and directory  defaults,  and
+       is not further specified by DB.)
+
+       In  addition,  the  dbenv  argument  is passed to the open
+       functions of any  subsystems  initialized  by  db_appinit.
+       For  this  reason  the  fields  of  the  DB_ENV  structure
+       relevant  to  the  subsystems   being   initialized   must
+       themselves  be  initialized  before  db_appinit is called.
+       See the manual page for each subsystem for a list of these
+       fields and their uses.
+
+       The return value from each of these calls is placed in the
+       appropriate field of the DB_ENV structure:
+
+       DB_LOCKTAB *lk_info;
+            The return value of the lock_open(3) call.
+
+       DB_LOG *lg_info;
+            The return value of the log_open(3) call.
+
+       DB_MPOOL *mp_info;
+            The return value of the memp_open(3) call.
+
+       DB_TXNMGR *tx_info;
+            The return value of the txn_open(3) call.
+
+       In  general,  these  fields  are  not  directly  used   by
+       applications;  subsystems of DB that use these fields will
+       simply reference them using the DB_ENV argument passed  to
+       the subsystem.
+
+       For  example,  an  application  using  the  DB hash access
+       method functions to access  a  database  will  first  call
+       db_open  passing  it  the DB_ENV argument filled in by the
+       initial call to db_appinit.  Then, all future calls to the
+       hash  access  method  functions  for  that  database  will
+       automatically use the underlying shared memory buffer pool
+       that  was  specified  by  the mp_info field of that DB_ENV
+       argument.
+
+       The single exception to this rule is  the  tx_info  field,
+       which   applications   must   explicitly  specify  to  the
+       txn_begin, txn_checkpoint and txn_close functions.
+
+       Once the DB environment has been initialized by a call  to
+       db_appinit,  no  fields  other  than  db_errpfx  should be
+       modified.
+
+       The db_appinit function returns  the  value  of  errno  on
+       failure and 0 on success.
+
+  db_appexit
+       The   db_appexit   function   closes  the  initialized  DB
+       subsystems, freeing any allocated  resources  and  closing
+       any underlying subsystems.
+
+       When   multiple   threads  are  using  the  DB_ENV  handle
+       concurrently, only a single thread may call the db_appexit
+       function.
+
+       The  db_appexit  function  returns  the  value of errno on
+       failure and 0 on success.
+
+
+
+

FILE NAMING

+       The most important task of db_appinit is to structure file
+       naming within DB.
+
+       Each  of the locking, logging, memory pool and transaction
+       subsystems of DB require shared memory regions, backed  by
+       the  filesystem.   Further,  cooperating  applications (or
+       multiple invocations of the same application)  must  agree
+       on  the  location  of  the shared memory regions and other
+       files used by the DB subsystems, the log files used by the
+       logging subsystem, and, of course, the data files.
+
+       Although  it  is possible to specify full pathnames to all
+       DB  functions,  this  is  cumbersome  and  requires   that
+       applications  be recompiled when database files are moved.
+       The  db_appinit  function  makes  it  possible  to   place
+       database  files  in  a  single  directory,  or in multiple
+       directories,  grouped  by  their   function   within   the
+       database.
+
+       Applications  are  normally  expected  to specify a single
+       directory home for  their  database.   This  can  be  done
+       easily in the call to db_appinit by specifying a value for
+       the   db_home   argument.    There   are   more    complex
+       configurations  where  it  may  be  desirable  to override
+       db_home or provide supplementary path information.
+
+       The following describes the possible ways  in  which  file
+       naming  information  may  be  specified to the DB library.
+       The specific circumstances and order in which  these  ways
+       are applied are described in a subsequent paragraph.
+
+       db_home
+            If  the  db_home  argument to db_appinit is non-NULL,
+            its value may be used as the database home, and files
+            named relative to its path.
+
+       DB_HOME
+            If  the  DB_HOME  environment  variable  is  set when
+            db_appinit is called, its value may be  used  as  the
+            database  home, and files named relative to its path.
+
+       db_config
+            The db_config argument to db_appinit may be  used  to
+            specify  an  array of character strings of the format
+            ``NAME VALUE'', that specify  file  name  information
+            for  the  process'  DB  environment.   The whitespace
+            delimiting the two parts of the entry may be  one  or
+            more   <space>  or  <tab>  characters.   (Leading  or
+            trailing <space> and <tab> characters are discarded.)
+            Each  entry  must specify both the NAME and the VALUE
+            of the pair.   All  entries  with  unrecognized  NAME
+            values  will be ignored.  The db_config array must be
+            NULL terminated.
+
+       DB_CONFIG
+            The  same  information  specified  to  the  db_config
+            argument  to  db_appinit  may  be  specified  using a
+            configuration file.  If a database home directory has
+            been  specified (either by the application specifying
+            a non-NULL db_home argument to db_appinit, or by  the
+            application    setting    the    DB_USE_ENVIRON    or
+            DB_USE_ENVIRON_ROOT flags and the DB_HOME environment
+            variable  being set), any file named ``DB_CONFIG'' in
+            the database home directory will be read for lines of
+            the format ``NAME VALUE''.  The whitespace delimiting
+            the two parts of the line may be one or more  <space>
+            or  <tab>  characters.   (Leading or trailing <space>
+            and <tab> characters are discarded.)  All empty lines
+            or  lines  whose  first non-whitespace character is a
+            hash character (``#'') will be  ignored.   Each  line
+            must specify both the NAME and the VALUE of the pair.
+            All lines  with  unrecognized  NAME  values  will  be
+            ignored.
+
+       The  following  ``NAME  VALUE''  pairs  in  the  db_config
+       argument and the DB_CONFIG file are currently supported by
+       DB.
+
+       DB_DATA_DIR
+            The path of a directory to be used as the location of
+            the access method data files, e.g.,  paths  specified
+            to  the  db_open(3) function will be relative to this
+            path.
+
+            The DB_DATA_DIR paths are  additive,  and  specifying
+            more than one will result in each specified directory
+            being searched for database data files.  If  multiple
+            paths  are  specified, created data files will always
+            be created in the first directory specified.
+
+       DB_LOG_DIR
+            The path of a directory to be used as the location of
+            logging  files,  e.g., files created by the db_log(3)
+            subsystem will be relative  to  this  directory.   If
+            specified,  this  is  the directory name that will be
+            passed to log_open(3).
+
+       DB_TMP_DIR
+            The path of a directory to be used as the location of
+            temporary  files,  e.g.,  files  created  to back in-
+            memory  access  method  databases  will  be   created
+            relative  to  this path.  Note, these temporary files
+            can potentially be quite large, depending on the size
+            of the database.
+
+            If   DB_TMP_DIR   is  not  specified,  the  following
+            environment   variables   are   checked   in   order:
+            ``TMPDIR'', ``TEMP'', ``TMP'' and ``TempFolder''.  If
+            one of them  is  set,  temporary  files  are  created
+            relative to the directory it specifies.
+
+            If  DB_TMP_DIR is not specified and none of the above
+            environment variables are set, the first possible one
+            of  the  following  directories  is  used:  /var/tmp,
+            /usr/tmp, /temp, /tmp, C:/temp and C:/tmp.
+
+       The following describes  the  specific  circumstances  and
+       order  in  which  the  different  ways  of specifying file
+       naming information are  applied.   Specifically,  DB  file
+       name   processing   proceeds   sequentially   through  the
+       following steps:
+
+       ``/''
+            If any file name specified to any DB function  begins
+            with  a leading slash, that file name is used without
+            modification by DB.
+
+       DB_CONFIG
+            If   a   relevant   configuration    string    (e.g.,
+            DB_DATA_DIR),   is   specified   in   the   DB_CONFIG
+            configuration file, the VALUE from the ``NAME VALUE''
+            pair  is  prepended to the current file name.  If the
+            resulting file name begins with a leading slash,  the
+            file name is used without further modification by DB.
+
+            The  DB_CONFIG  configuration  file  is  intended  to
+            permit  systems  to  customize  file  location  for a
+            database  independent  of  applications  using   that
+            database.   For example, a database administrator can
+            move the database log and data files to  a  different
+            location without application recompilation.
+
+       db_config
+            If    a    relevant   configuration   string   (e.g.,
+            DB_DATA_DIR), is specified in the db_config  argument
+            and is not specified in the DB_CONFIG file, the VALUE
+            from the ``NAME VALUE''  pair  is  prepended  to  the
+            current file name.  If the resulting file name begins
+            with a leading slash, the file name is  used  without
+            further modification by DB.
+
+            The   db_config   argument   is  intended  to  permit
+            applications  to  customize  file  location   for   a
+            database.   For  example,  an  application writer can
+            place  data  files  and  log   files   in   different
+            directories,  or instantiate a new log directory each
+            time the application runs.
+
+       DB_HOME
+            If the DB_HOME environment variable was set, (and the
+            application has set the appropriate DB_USE_ENVIRON or
+            DB_USE_ENVIRON_ROOT environment variable), its  value
+            is  prepended  to  the  current  file  name.   If the
+            resulting file name begins with a leading slash,  the
+            file name is used without further modification by DB.
+
+            The  DB_HOME  environment  variable  is  intended  to
+            permit  users  and  system administrators to override
+            application and installation defaults, e.g.,
+
+                 env DB_HOME=/database/my_home application
+
+            Alternatively, application writers are encouraged  to
+            support  the  -h  option  found  in the supporting DB
+            utilities to let users specify a database home.
+
+       db_home
+            If  the  application  specified  a  non-NULL  db_home
+            argument to db_appinit (and the database home was not
+            already  specified  using  the  DB_HOME   environment
+            variable)  its value is prepended to the current file
+            name.  If the  resulting  file  name  begins  with  a
+            leading  slash, the file name is used without further
+            modification by DB.
+
+       (nothing)
+            Finally, all file names are interpreted  relative  to
+            the current working directory of the process.
+
+       The  common  model  for a DB environment is one where only
+       the DB_HOME environment variable, or the db_home argument,
+       is  specified.   In  this  case,  all  data  files will be
+       presumed to be relative to that directory, and  all  files
+       created  by  the  DB  subsystems  will  be created in that
+       directory.
+
+       The more complex model for a transaction environment might
+       be  one  where  a database home is specified, using either
+       the DB_HOME environment variable or the  db_home  argument
+       to db_appinit, and then DB_DATA_DIR and DB_LOG_DIR are set
+       to the relative path names of directories  underneath  the
+       home  directory using the db_config argument to db_appinit
+       or the DB_CONFIG file.
+
+
+
+

EXAMPLES

+       Store all files in the directory /a/database:
+
+              db_appinit("/a/database", NULL, ...);
+
+       Create temporary backing files in  /b/temporary,  and  all
+       other files in /a/database:
+
+              char *config[] = {
+                  "DB_TMP_DIR /b/temporary",
+                  NULL
+              };
+
+              db_appinit("/a/database", config, ...);
+
+       Store  data  files  in  /a/database/datadir,  log files in
+       /a/database/logdir, and all other files in  the  directory
+       /a/database:
+
+              char *config[] = {
+                  "DB_DATA_DIR datadir",
+                  "DB_LOG_DIR logdir",
+                  NULL
+              };
+
+              db_appinit("/a/database", config, ...);
+
+       Store  data  files  in /a/database/data1 and /b/data2, and
+       all other files in the directory  /a/database.   Any  data
+       files that are created will be created in /b/data2:
+
+              char *config[] = {
+                  "DB_DATA_DIR /b/data2",
+                  "DB_DATA_DIR data1",
+                  NULL
+              };
+
+              db_appinit("/a/database", config, ...);
+
+       See  the  file  examples/ex_appinit.c  in  the  DB  source
+       distribution for a C  language  code  example  of  how  an
+       application  might  use  db_appinit  to  configure  its DB
+       environment.
+
+
+
+

ERRORS

+       The db_appinit function may fail and return errno for  any
+       of  the  errors specified for the following DB and library
+       functions: DB->close(3), calloc(3), db_appexit(3),
+       fclose(3), fcntl(2), fflush(3), fgets(3), fopen(3),
+       lock_open(3), lock_unlink(3), log_compare(3), log_get(3),
+       log_open(3), log_unlink(3), malloc(3), memcpy(3),
+       memp_open(3), memp_unlink(3), memset(3), realloc(3),
+       stat(2), strchr(3), strcmp(3), strcpy(3), strdup(3),
+       strerror(3), strlen(3), strsep(3), time(3),
+       txn_checkpoint(3), txn_open(3), and txn_unlink(3).
+
+       In  addition,  the db_appinit function may fail and return
+       errno for the following conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The DB_THREAD flag was specified  and  spinlocks  are
+            not implemented for this architecture.
+
+            The   DB_RECOVER   or   DB_RECOVER_FATAL   flag   was
+            specified, and no log files were found.
+
+            The DB_HOME or TMPDIR environment variables were  set
+            but empty.
+
+            An incorrectly formatted ``NAME VALUE'' entry or line
+            was found.
+
+       [ENOSPC]
+            HP-UX only: a previously created DB  environment  for
+            this process still exists.
+
+       The  db_appexit function may fail and return errno for any
+       of the errors specified for the following DB  and  library
+       functions: lock_close(3), log_close(3), memp_close(3), and
+       txn_close(3).
+
+
+
+

BUGS

+       Due to the constraints of the PA-RISC memory architecture,
+       HP-UX  does  not  allow  a  process to map a file into its
+       address space multiple times.  For this  reason,  each  DB
+       environment may be opened only once by a process on HP-UX,
+       i.e., calls to appinit  will  fail  if  the  specified  DB
+       environment has been opened and not subsequently closed.
+
+       On Windows/95, files that are opened by multiple processes
+       do not share data correctly.  To tell Berkeley DB  to  use
+       the  paging  file to share memory among processes, use the
+       DB_REGION_NAME  flag   of   the   db_value_set   function.
+       Obviously,  you  do  not  need to do this if only a single
+       process will be accessing database files.
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_appinit(3), db_cursor(3), db_dbm(3), db_internal(3),
+       db_lock(3), db_log(3), db_mpool(3), db_open(3), db_thread(3),
+       db_txn(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/db_archive.html b/mozilla/db/man/man.html/db_archive.html new file mode 100644 index 00000000000..933139e97e2 --- /dev/null +++ b/mozilla/db/man/man.html/db_archive.html @@ -0,0 +1,211 @@ + + +db_archive + + +

db_archive

+
+
+
+       db_archive [-alsv] [-h home]
+
+
+
+

DESCRIPTION

+       The  db_archive  utility writes the pathnames of log files
+       that are no longer in use (e.g.,  no  longer  involved  in
+       active transactions), to the standard output, one pathname
+       per line.  These log files should  be  written  to  backup
+       media  to provide for recovery in the case of catastrophic
+       failure (which also requires a snapshot  of  the  database
+       files),  but  they  may then be deleted from the system to
+       reclaim disk space.
+
+       The options are as follows:
+
+       -a   Write all pathnames as absolute pathnames, instead of
+            relative to the database home directories.
+
+       -h   Specify a home directory for the database.
+
+       -l   Write  out  the  pathnames of all of the database log
+            files, whether or not they  are  involved  in  active
+            transactions.
+
+       -s   Write the pathnames of all of the database files that
+            need to be archived in order to recover the  database
+            from  catastrophic  failure.   If any of the database
+            files have not been accessed during the  lifetime  of
+            the  current  log  files, db_archive will not include
+            them in this output.
+
+            It is possible that some of the files  referenced  in
+            the  log have since been deleted from the system.  In
+            this  case,  db_archive  will  ignore   them.    When
+            db_recover(1) is run, any files referenced in the log
+            that are not present during recovery are  assumed  to
+            have been deleted and will not be recovered.
+
+       -v   Run  in  verbose mode, listing the checkpoints in the
+            log files as they are reviewed.
+
+       The  db_archive  utility  attaches  to  DB  shared  memory
+       regions.   In  order to avoid region corruption, it should
+       always be given the chance to detach and exit  gracefully.
+       To  cause  db_archive  to  clean up after itself and exit,
+       send it an interrupt signal (SIGINT).
+
+       The db_archive utility exits 0 on success, and  >0  if  an
+       error occurs.
+
+
+
+

DB ARCHIVAL PROCEDURES

+       There  are  two aspects to managing the recoverability and
+       disk consumption of your DB  databases.   First,  you  may
+       want to periodically create snapshots of your databases to
+       make  it  possible  to  recover  them  from   catastrophic
+       failure.   Second,  you'll want to periodically remove log
+       files in  order  to  conserve  on  disk  space.   The  two
+       procedures  are  distinct  from each other, and you cannot
+       remove the current  log  files  simply  because  you  have
+       created a database snapshot.
+
+       To  create a snapshot of your database that can be used to
+       recover from catastrophic  failure,  the  following  steps
+       should be taken:
+
+       1.   Run  db_archive  -s  to  identify all of the database
+            data files that must be saved, and  copy  them  to  a
+            backup  device,  (e.g., tape).  If the database files
+            are stored in a separate  directory  from  the  other
+            database  files,  it  may  be  simpler to archive the
+            directory itself instead of the individual files.
+
+            More importantly, if any of the database  files  have
+            not  been accessed during the lifetime of the current
+            log files, db_archive  will  not  list  them  in  its
+            output!   For this reason, it may be important to use
+            a separate  database  file  directory,  archiving  it
+            instead of the files listed by db_archive.
+
+       2.   If  your  database is currently active, i.e., you are
+            reading and writing to the database files  while  the
+            snapshot   is  being  taken,  run  db_archive  -l  to
+            identify the database log files, and copy them  to  a
+            backup  device,  (e.g.,  tape).   If the database log
+            files are stored in a  separate  directory  from  the
+            other  database  files,  it may be simpler to archive
+            the directory itself instead of the individual files.
+
+       Note  that the order of these operations is important, and
+       that the database files must be archived  before  the  log
+       files.
+
+       The  DB  library  supports  on-line backups, and it is not
+       necessary to stop reading or writing your databases during
+       the  time  when  you  create this snapshot.  Note however,
+       that the snapshot of an active database will be consistent
+       as  of  some  unspecified  time  between  the start of the
+       archival and when archival  is  completed.   To  create  a
+       snapshot  as of a specific time, you must stop reading and
+       writing  your  databases  for  the  entire  time  of   the
+       archival,  force  a checkpoint (see db_checkpoint(1)), and
+       then archive the files listed by the db_archive  command's
+       -s and -l options.
+
+       Once  these  steps  are  completed,  your  database can be
+       recovered from catastrophic failure to its state as of the
+       time  the  archival  was done.  To update your snapshot so
+       that recovery from catastrophic failure is possible up  to
+       a  new point in time, repeat step #2, copying all existing
+       log files to a backup device.
+
+       Each time that a  complete  snapshot  is  made,  i.e.  all
+       database and log files are copied to backup media, you may
+       discard all previous snapshots and saved log files.
+
+       The  time  to  restore  from  catastrophic  failure  is  a
+       function  of  the  number  of  log  records that have been
+       written  since  the  snapshot  was   originally   created.
+       Perhaps  more  importantly,  the  more  separate pieces of
+       backup media you use, the more likely that you will have a
+       problem  reading  from one of them.  For these reasons, it
+       is often best to make snapshots on a regular basis.
+
+       For archival safety  remember  to  ensure  that  you  have
+       multiple  copies of your database backups, that you verify
+       that your archival media is error-free, and that copies of
+       your backups are stored off-site!
+
+       To  restore  your database after catastrophic failure, the
+       following steps should be taken:
+
+       1.   Restore the copies of the  database  files  from  the
+            backup media.
+
+       2.   Restore  the  copies of the log files from the backup
+            media, in the  order  in  which  they  were  written.
+            (It's  possible  that  the  same  log file appears on
+            multiple backups, and you only want the  most  recent
+            version of that log file!)
+
+       3.   Run db_recover -c to recover the database.
+
+       It  is  possible  to  recreate  the database in a location
+       different than the  original,  by  specifying  appropriate
+       pathnames to the -h option of the db_recover utility.
+
+       To remove log files, the following steps should be taken:
+
+       1.   If you are concerned with catastrophic failure, first
+            copy them to backup media (e.g., tape), as  described
+            above.   This  is because log files are necessary for
+            recovery from catastrophic failure.
+
+       2.   Run db_archive, without options, to identify  all  of
+            the  log  files  that  are  no  longer  in use (e.g.,
+            involved in an active transaction).
+
+       3.   Remove those log files from the system.
+
+
+
+

ENVIRONMENT VARIABLES

+       The following environment variables affect  the  execution
+       of db_archive:
+
+       DB_HOME
+            If the -h option is not specified and the environment
+            variable DB_HOME is set, it is used as  the  path  of
+            the database home, as described in db_appinit(3).
+
+
+
+

SEE ALSO

+       The  DB  library  is  a family of groups of functions that
+       provides a modular programming interface  to  transactions
+       and  record-oriented  file  access.   The library includes
+       support for transactions, locking, logging and  file  page
+       caching,  as well as various indexed access methods.  Many
+       of the functional groups  (e.g.,  the  file  page  caching
+       functions)   are   useful  independent  of  the  other  DB
+       functions, although some functional groups are  explicitly
+       based  on  other functional groups (e.g., transactions and
+       logging).  For a general description of  the  DB  package,
+       see db_intro(3).
+
+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_appinit(3), db_cursor(3), db_dbm(3), db_internal(3),
+       db_lock(3), db_log(3), db_mpool(3), db_open(3), db_thread(3),
+       db_txn(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/db_checkpoint.html b/mozilla/db/man/man.html/db_checkpoint.html new file mode 100644 index 00000000000..d09d4584766 --- /dev/null +++ b/mozilla/db/man/man.html/db_checkpoint.html @@ -0,0 +1,94 @@ + + +db_checkpoint + + +

db_checkpoint

+
+
+
+       db_checkpoint [-1v] [-h home] [-k kbytes] [-L file] [-p min]
+
+
+
+

DESCRIPTION

+       The   db_checkpoint  utility  is  a  daemon  process  that
+       monitors  the  database   log   and   periodically   calls
+       txn_checkpoint(3) to checkpoint it.
+
+       The options are as follows:
+
+       -1   Checkpoint the log once, and then exit.
+
+       -h   Specify a home directory for the database.
+
+       -k   Checkpoint  the  database  at least as often as every
+            kbytes of log file are written.
+
+       -L   Log the execution of the db_checkpoint utility to the
+            specified file in the following format, where ``###''
+            is the process ID, and  the  date  is  the  time  the
+            utility starting running.
+
+            db_checkpoint: ### Wed Jun 15 01:23:45 EDT 1995
+
+            This  file  will  be  removed  if  the  db_checkpoint
+            utility exits gracefully.
+
+       -p   Checkpoint the database at least every min minutes.
+
+       -v   Write the time of each  checkpoint  to  the  standard
+            output.
+
+       At  least  one  of  the  -1,  -k  and  -p  options must be
+       specified.
+
+       The db_checkpoint utility attaches  to  DB  shared  memory
+       regions.   In  order to avoid region corruption, it should
+       always be given the chance to detach and exit  gracefully.
+       To  cause db_checkpoint to clean up after itself and exit,
+       send it an interrupt signal (SIGINT).
+
+       The db_checkpoint utility exits 0 on success, and >0 if an
+       error occurs.
+
+
+
+

ENVIRONMENT VARIABLES

+       The  following  environment variables affect the execution
+       of db_checkpoint:
+
+       DB_HOME
+            If the -h option is not specified and the environment
+            variable  DB_HOME  is  set, it is used as the path of
+            the database home, as described in db_appinit(3).
+
+
+
+

SEE ALSO

+       The DB library is a family of  groups  of  functions  that
+       provides  a  modular programming interface to transactions
+       and record-oriented file  access.   The  library  includes
+       support  for  transactions, locking, logging and file page
+       caching, as well as various indexed access methods.   Many
+       of  the  functional  groups  (e.g.,  the file page caching
+       functions)  are  useful  independent  of  the   other   DB
+       functions,  although some functional groups are explicitly
+       based on other functional groups (e.g.,  transactions  and
+       logging).   For  a  general description of the DB package,
+       see db_intro(3).
+
+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_appinit(3), db_cursor(3), db_dbm(3), db_internal(3),
+       db_lock(3), db_log(3), db_mpool(3), db_open(3), db_thread(3),
+       db_txn(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/db_cursor.html b/mozilla/db/man/man.html/db_cursor.html new file mode 100644 index 00000000000..6352c118a62 --- /dev/null +++ b/mozilla/db/man/man.html/db_cursor.html @@ -0,0 +1,479 @@ + + +db_cursor + + +

db_cursor

+
+
+
+       #include <db.h>
+
+       int
+       DBcursor->c_close(DBC *cursor);
+
+       int
+       DBcursor->c_del(DBC *cursor, u_int32_t flags);
+
+       int
+       DBcursor->c_get(DBC *cursor, DBT *key, DBT *data, u_int32_t flags);
+
+       int
+       DBcursor->c_put(DBC *, DBT *key, DBT *data, u_int32_t flags);
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a family of groups of functions that
+       provides a modular programming interface  to  transactions
+       and  record-oriented  file  access.   The library includes
+       support for transactions, locking, logging and  file  page
+       caching,  as well as various indexed access methods.  Many
+       of the functional groups  (e.g.,  the  file  page  caching
+       functions)   are   useful  independent  of  the  other  DB
+       functions, although some functional groups are  explicitly
+       based  on  other functional groups (e.g., transactions and
+       logging).  For a general description of  the  DB  package,
+       see db_intro(3).
+
+       This  manual  page  describes  the specific details of the
+       cursor support for the DB access methods.
+
+       The  db_cursor  functions  are   the   library   interface
+       supporting  sequential access to the records stored by the
+       access methods of the DB library.  Cursors are created  by
+       calling  the cursor function of a DB structure returned by
+       db_open(3), which returns a pointer to a DBC structure.
+
+       Each cursor maintains positioning information within a set
+       of  key/data  pairs.   In  the  presence  of transactions,
+       cursors are only valid within  the  context  of  a  single
+       transaction,  the  one  specified  during  the cursor call
+       described in db_open(3).  All cursor  operations  will  be
+       executed  in  the  context  of  that  transaction.  Before
+       aborting or committing a  transaction,  all  cursors  used
+       within  that  transaction must be closed.  In the presence
+       of transactions, the application must  call  txn_abort  if
+       any  of  the  cursor  operations  returns  that a deadlock
+       (EAGAIN) or system failure occurred.
+
+       When locking is enabled, page locks are  retained  between
+       consecutive   cursor  calls.   For  this  reason,  in  the
+       presence of locking, applications should  discard  cursors
+       as  soon as they are done with them.  Calling the db close
+       function (see db_open(3)) discards any cursors  opened  in
+       the  context  of a particular DB structure returned by the
+       db_open call.
+
+       The cursor has an associated set of  functions  to  access
+       elements   in  the  database,  accessed  through  the  DBC
+       structure.  The elements of the DBC structure are  defined
+       as follows:
+
+       int (*c_close)(DBC *cursor);
+            A pointer to a function that discards the cursor.  No
+            further references to the cursor should be made.
+
+            The c_close function returns the value  of  errno  on
+            failure and 0 on success.
+
+       int (*c_del)(DBC *cursor, u_int32_t flags);
+            A  pointer  to  a  function that deletes the key/data
+            pair currently referenced by the cursor.
+
+            The flags parameter is currently unused, and must  be
+            set to 0.
+
+            The  cursor  position is unchanged after a delete and
+            subsequent calls to cursor  functions  expecting  the
+            cursor to reference an existing key will fail.
+
+            The  c_del  function  returns  the  value of errno on
+            failure, 0 on success, and DB_KEYEMPTY if the element
+            has already been deleted.
+
+       int (*c_get)(DBC *cursor, DBT *key, DBT *data, u_int32_t
+            flags);
+            A pointer to a function that retrieves key/data pairs
+            from the database.  The address and length of the key
+            are returned  in  the  structure  referenced  by  key
+            (except for the case of the DB_SET flag where the key
+            structure is unchanged), and the address  and  length
+            of  the data are returned in the structure referenced
+            by data.
+
+            Modifications to the  database  during  a  sequential
+            scan  will  be  reflected  in  the scan, i.e. records
+            inserted behind a cursor will not be  returned  while
+            records  inserted  in  front  of  a  cursor  will  be
+            returned.
+
+            In recno databases, missing  entries  (i.e.,  entries
+            that  were  never  explicitly  created  or  that were
+            created and then deleted), will be skipped  during  a
+            sequential scan.
+
+            If  multiple  threads  or processes insert items into
+            the same database file  without  using  locking,  the
+            results  are  undefined.   For  more  detail, see the
+            section below on cursor stability.
+            The parameter flags must be set to exactly one of the
+            following values:
+
+            DB_FIRST
+                 The   cursor  is  set  to  reference  the  first
+                 key/data pair of the database, and that pair  is
+                 returned.   In  the  presence  of  duplicate key
+                 values, the  first  data  item  in  the  set  of
+                 duplicates is returned.
+
+                 If  the  database  is  empty, the c_get function
+                 will return DB_NOTFOUND.
+
+            DB_LAST
+                 The cursor is set to reference the last key/data
+                 pair of the database, and that pair is returned.
+                 In the presence of  duplicate  key  values,  the
+                 last  data  item  in  the  set  of duplicates is
+                 returned.
+
+                 If the database is  empty,  the  c_get  function
+                 will return DB_NOTFOUND.
+
+            DB_NEXT
+                 If the cursor is not yet initialized, DB_NEXT is
+                 identical to DB_FIRST.
+
+                 Otherwise, move the cursor to the next  key/data
+                 pair of the database, and that pair is returned.
+                 In the presence of  duplicate  key  values,  the
+                 value of the key may not change.
+
+                 If  the  cursor is already on the last record in
+                 the database, the  c_get  function  will  return
+                 DB_NOTFOUND.
+
+            DB_PREV
+                 If the cursor is not yet initialized, DB_PREV is
+                 identical to DB_LAST.
+
+                 Otherwise,  move  the  cursor  to  the  previous
+                 key/data  pair of the database, and that pair is
+                 returned.  In  the  presence  of  duplicate  key
+                 values, the value of the key may not change.
+
+                 If  the cursor is already on the first record in
+                 the database, the  c_get  function  will  return
+                 DB_NOTFOUND.
+
+            DB_CURRENT
+                 Return the key/data pair currently referenced by
+                 the cursor.
+
+                 If the cursor key/data pair  has  been  deleted,
+                 the c_get function will return DB_KEYEMPTY.
+
+                 If  the cursor is not yet initialized, the c_get
+                 function will return EINVAL.
+
+            DB_SET
+                 Move the cursor to the specified  key/data  pair
+                 of the database, and return the datum associated
+                 with the given key.
+
+                 In the presence of duplicate key  values,  c_get
+                 will  return  the  first data item for the given
+                 key.
+
+                 If the database is  a  recno  database  and  the
+                 requested  key  exists, but was never explicitly
+                 created by the application or was later deleted,
+                 the c_get function returns DB_KEYEMPTY.
+
+                 If   no  matching  keys  are  found,  the  c_get
+                 function will return DB_NOTFOUND.
+
+            DB_SET_RANGE
+                 The DB_SET_RANGE flag is identical to the DB_SET
+                 flag, except that the key is returned as well as
+                 the data item, and, in the  case  of  the  btree
+                 access method, the returned key/data pair is the
+                 smallest  key  greater  than  or  equal  to  the
+                 specified  key  (as determined by the comparison
+                 function), permitting partial  key  matches  and
+                 range searches.
+
+            DB_SET_RECNO
+                 Move  the cursor to the specific numbered record
+                 of  the  database,  and  return  the  associated
+                 key/data  pair.  The data field of the specified
+                 key must be a pointer to a memory location  from
+                 which  a db_recno_t may be read, as described in
+                 db_dbt(3).  This memory location will be read to
+                 determine the record to be retrieved.
+
+                 For DB_SET_RECNO to be specified, the underlying
+                 database must be of type btree and it must  have
+                 been   created  with  the  DB_RECNUM  flag  (see
+                 db_open(3)).
+
+            DB_GET_RECNO
+                 Return the record  number  associated  with  the
+                 cursor.   The  record number will be returned in
+                 the data DBT as described in db_dbt(3).  The key
+                 parameter is ignored.
+
+                 For DB_GET_RECNO to be specified, the underlying
+                 database must be of type btree and it must  have
+                 been   created  with  the  DB_RECNUM  flag  (see
+                 db_open(3)).
+
+            Otherwise, the c_get function returns  the  value  of
+            errno on failure and 0 on success.
+
+            If  c_get  fails  for  any  reason,  the state of the
+            cursor will be unchanged.
+
+       int (*c_put)(DBC *, DBT *key, DBT *data, u_int32_t flags);
+            A  pointer  to  a function that stores key/data pairs
+            into the database.
+
+            The flags parameter must be set to exactly one of the
+            following values:
+
+            DB_AFTER
+                 In  the  case  of  the  btree  and  hash  access
+                 methods, insert the data element as a  duplicate
+                 element  of  the  key  referenced by the cursor.
+                 The new element appears  immediately  after  the
+                 current  cursor  position.   It  is  an error to
+                 specify DB_AFTER if the underlying btree or hash
+                 database  was  not created with the DB_DUP flag.
+                 The key parameter is ignored.
+
+                 In the case of the recno access method, it is an
+                 error  to  specify  DB_AFTER  if  the underlying
+                 recno  database  was  not   created   with   the
+                 DB_RENUMBER  flag.   If the DB_RENUMBER flag was
+                 specified, a new key  is  created,  all  records
+                 after   the   inserted  item  are  automatically
+                 renumbered, and the key of  the  new  record  is
+                 returned  in  the  structure  referenced  by the
+                 parameter key.  The initial  value  of  the  key
+                 parameter  is  ignored.  See db_open(3) for more
+                 information.
+
+                 If the cursor is not yet initialized, the  c_put
+                 function will return EINVAL.
+
+            DB_BEFORE
+                 In  the  case  of  the  btree  and  hash  access
+                 methods, insert the data element as a  duplicate
+                 element  of  the  key  referenced by the cursor.
+                 The new element appears immediately  before  the
+                 current  cursor  position.   It  is  an error to
+                 specify DB_BEFORE if  the  underlying  btree  or
+                 hash  database  was  not created with the DB_DUP
+                 flag.  The key parameter is ignored.
+
+                 In the case of the recno access method, it is an
+                 error  to  specify  DB_BEFORE  if the underlying
+                 recno  database  was  not   created   with   the
+                 DB_RENUMBER  flag.   If the DB_RENUMBER flag was
+                 specified, a new key  is  created,  the  current
+                 record    and   all   records   after   it   are
+                 automatically renumbered, and the key of the new
+                 record  is  returned in the structure referenced
+                 by the parameter key.  The initial value of  the
+                 key  parameter  is  ignored.  See db_open(3) for
+                 more information.
+
+                 If the cursor is not yet initialized, the  c_put
+                 function will return EINVAL.
+
+            DB_CURRENT
+                 Overwrite   the   data   of  the  key/data  pair
+                 referenced by the cursor with the specified data
+                 item.
+
+                 The key parameter is ignored.
+
+                 If  the cursor is not yet initialized, the c_put
+                 function will return EINVAL.
+
+            DB_KEYFIRST
+                 In  the  case  of  the  btree  and  hash  access
+                 methods, insert the specified key/data pair into
+                 the database.  If the key already exists in  the
+                 database, the inserted data item is added as the
+                 first of the data items for that key.
+
+                 The DB_KEYFIRST flag may not be specified to the
+                 recno access method.
+
+            DB_KEYLAST
+                 Insert  the  specified  key/data  pair  into the
+                 database.  If the  key  already  exists  in  the
+                 database, the inserted data item is added as the
+                 last of the data items for that key.
+
+                 The DB_KEYLAST flag may not be specified to  the
+                 recno access method.
+
+            If  the  cursor  record  has  been deleted, the c_put
+            function will return DB_KEYEMPTY.
+
+            Otherwise, the c_put function returns  the  value  of
+            errno on failure and 0 on success.
+
+            If  c_put  fails  for  any  reason,  the state of the
+            cursor will be unchanged.  If c_put succeeds  and  an
+            item  is  inserted  into  the database, the cursor is
+            always positioned to  reference  the  newly  inserted
+            item.
+
+
+
+

CURSOR STABILITY

+       In  the  absence  of locking, no guarantees are made about
+       the  stability  of  cursors  in  different  processes   or
+       threads.   However,  the  btree  and  recno access methods
+       guarantee that cursor operations, interspersed with  other
+       cursor  or  non-cursor  operations  in  the same thread of
+       control (i.e., thread or  single-threaded  process),  will
+       always  return  keys  in  order  and will return each non-
+       deleted key/data pair  exactly  once.   Because  the  hash
+       access  method uses a dynamic hashing algorithm, it cannot
+       guarantee any form of stability in the presence of inserts
+       and deletes unless locking is performed.
+
+       If  locking was specified when the DB file was opened, but
+       transactions are not in effect, the access methods provide
+       repeatable  reads  with respect to the cursor.  That is, a
+       DB_CURRENT call on the cursor is guaranteed to return  the
+       same  record  as  was  returned  on  the  last call to the
+       cursor.
+
+       In the presence of transactions, the access  method  calls
+       between  txn_begin  and  txn_abort  or  txn_commit provide
+       degree 3 consistency.  For all access  methods,  a  cursor
+       scan  of  the  database  performed within the context of a
+       transaction is guaranteed to  return  each  key/data  pair
+       once  and  only  once,  except in the following case.  If,
+       while performing a  cursor  scan  using  the  hash  access
+       method,  the transaction performing the scan inserts a new
+       pair into the database,  it  is  possible  that  duplicate
+       key/data pairs will be returned.
+
+
+
+

ERRORS

+       The  DBcursor->c_close  function may fail and return errno
+       for any of the errors specified for the following  DB  and
+       library functions: calloc(3), fcntl(2), fflush(3),
+       lock_get(3), lock_id(3), lock_put(3), lock_vec(3),
+       log_put(3), malloc(3), memcpy(3), memmove(3),
+       memp_fget(3), memp_fput(3), memp_fset(3), memset(3),
+       realloc(3), and strerror(3).
+
+       In  addition,  the DBcursor->c_close function may fail and
+       return errno for the following conditions:
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EPERM]
+            Database corruption  was  detected.   All  subsequent
+            database  calls  (other  than  DB->close) will return
+            EPERM.
+
+       The DBcursor->c_del function may fail and return errno for
+       any  of  the  errors  specified  for  the following DB and
+       library functions: DB->del(3), calloc(3), fcntl(2),
+       fflush(3), lock_get(3), lock_id(3), lock_put(3),
+       lock_vec(3), log_put(3), malloc(3), memcpy(3), memmove(3),
+       memp_fget(3), memp_fput(3), memp_fset(3), memset(3),
+       realloc(3), and strerror(3).
+
+       In addition, the DBcursor->c_del  function  may  fail  and
+       return errno for the following conditions:
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       [EPERM]
+            Database  corruption  was  detected.   All subsequent
+            database calls (other  than  DB->close)  will  return
+            EPERM.
+
+       The DBcursor->c_get function may fail and return errno for
+       any of the errors  specified  for  the  following  DB  and
+       library functions: DB->get(3), calloc(3), fcntl(2),
+       fflush(3), lock_get(3), lock_id(3), lock_put(3),
+       lock_vec(3), log_put(3), malloc(3), memcmp(3), memcpy(3),
+       memmove(3), memp_fget(3), memp_fput(3), memp_fset(3),
+       memset(3), realloc(3), and strerror(3).
+
+       In  addition,  the  DBcursor->c_get  function may fail and
+       return errno for the following conditions:
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The DB_THREAD flag was specified  to  the  db_open(3)
+            function    and    neither   the   DB_DBT_MALLOC   or
+            DB_DBT_USERMEM flags were set in the DBT.
+
+       [EPERM]
+            Database corruption  was  detected.   All  subsequent
+            database  calls  (other  than  DB->close) will return
+            EPERM.
+
+       The DBcursor->c_put function may fail and return errno for
+       any  of  the  errors  specified  for  the following DB and
+       library functions: calloc(3), fcntl(2), fflush(3),
+       lock_get(3), lock_id(3), lock_put(3), lock_vec(3),
+       log_put(3), malloc(3), memcmp(3), memcpy(3), memmove(3),
+       memp_fget(3), memp_fput(3), memp_fset(3), memset(3),
+       realloc(3), and strerror(3).
+
+       In addition, the DBcursor->c_put  function  may  fail  and
+       return errno for the following conditions:
+
+       [EACCES]
+            An attempt was made to modify a read-only database.
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       [EPERM]
+            Database  corruption  was  detected.   All subsequent
+            database calls (other  than  DB->close)  will  return
+            EPERM.
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_appinit(3), db_cursor(3), db_dbm(3), db_internal(3),
+       db_lock(3), db_log(3), db_mpool(3), db_open(3), db_thread(3),
+       db_txn(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/db_dbm.html b/mozilla/db/man/man.html/db_dbm.html new file mode 100644 index 00000000000..d83ef5b9222 --- /dev/null +++ b/mozilla/db/man/man.html/db_dbm.html @@ -0,0 +1,326 @@ + + +db_dbm + + +

db_dbm

+
+
+
+       dbm_firstkey, dbm_nextkey, dbm_error, dbm_clearerr
+
+
+
+

SYNOPSIS

+       #define DB_DBM_HSEARCH    1
+       #include <db.h>
+
+       typedef struct {
+            char *dptr;
+            int dsize;
+       } datum;
+
+
+
+

DBM FUNCTIONS

+       int
+       dbminit(char *file);
+
+       datum
+       fetch(datum key);
+
+       int
+       store(datum key, datum content);
+
+       int
+       delete(datum key);
+
+       datum
+       firstkey(void);
+
+       datum
+       nextkey(datum key);
+
+
+
+

NDBM FUNCTIONS

+       DBM *
+       dbm_open(char *file, int flags, int mode);
+
+       void
+       dbm_close(DBM *db);
+
+       datum
+       dbm_fetch(DBM *db, datum key);
+
+       int
+       dbm_store(DBM *db, datum key, datum content, int flags);
+
+       int
+       dbm_delete(DBM *db, datum key);
+
+       datum
+       dbm_firstkey(DBM *db);
+
+       datum
+       dbm_nextkey(DBM *db);
+
+       int
+       dbm_error(DBM *db);
+       int
+       dbm_clearerr(DBM *db);
+
+
+
+

DESCRIPTION

+       The dbm and ndbm interfaces to the DB library are intended
+       to  provide  source  code   compatibility   for   historic
+       applications.   They  are  not  recommended  for any other
+       purpose.  The historic dbm and ndbm database format is not
+       supported,  and  databases previously built using the real
+       dbm or ndbm libraries cannot be read by the DB  functions.
+
+       To   compile   dbm   or  ndbm  applications,  replace  the
+       application's #include of the dbm  or  ndbm  include  file
+       (e.g., ``#include <dbm.h>'' or ``#include <ndbm.h>'') with
+       the following two lines:
+
+              #define DB_DBM_HSEARCH    1
+              #include <db.h>
+
+       and  recompile.   If  the  application  attempts  to  load
+       against  a  dbm  library  (e.g.,  ``-ldbm''),  remove  the
+       library from the load line.
+
+       Keys and contents are described by the datum  typedef.   A
+       datum  specifies  a  string  of  dsize bytes pointed to by
+       dptr.  Arbitrary binary  data,  as  well  as  normal  text
+       strings, are allowed.
+
+
+
+

DBM FUNCTIONS

+       Before  a  database  can be accessed, it must be opened by
+       dbminit.   This  will  open  and/or  create  the  database
+       file.db.    If  created,  the  database  file  is  created
+       read/write by owner only (as described  in  chmod(2))  and
+       modified  by  the  process'  umask  value  at  the time of
+       creation (see umask(2)).  The group ownership  of  created
+       files  is  based on the system and directory defaults, and
+       is not further specified by DB.
+
+       Once open, the data stored under  a  key  is  accessed  by
+       fetch and data is placed under a key by store.  A key (and
+       its associated contents) is deleted by delete.   A  linear
+       pass  through  all  keys  in a database may be made, in an
+       (apparently) random order, by use of firstkey and nextkey.
+       Firstkey  will return the first key in the database.  With
+       any key nextkey will return the next key in the  database.
+       This code will traverse the data base:
+
+              for (key = firstkey();
+                   key.dptr != NULL; key = nextkey(key))
+
+
+
+

NDBM FUNCTIONS

+       Before  a  database  can be accessed, it must be opened by
+       dbm_open.  This will open and/or create the database  file
+       file.db  depending  on  the flags parameter (see open(2)).
+       If created, the database file is created  with  mode  mode
+       (as  described  in  chmod(2)) and modified by the process'
+       umask value at the time of creation (see  umask(2)).   The
+       group  ownership  of  created files is based on the system
+       and directory defaults, and is not  further  specified  by
+       DB.
+
+       Once  open,  the  data  stored  under a key is accessed by
+       dbm_fetch and data is placed under  a  key  by  dbm_store.
+       The  flags  field can be either DBM_INSERT or DBM_REPLACE.
+       DBM_INSERT will only insert new entries into the  database
+       and  will  not change an existing entry with the same key.
+       DBM_REPLACE will replace an existing entry if it  has  the
+       same  key.  A key (and its associated contents) is deleted
+       by dbm_delete.  A  linear  pass  through  all  keys  in  a
+       database  may be made, in an (apparently) random order, by
+       use of dbm_firstkey and  dbm_nextkey.   Dbm_firstkey  will
+       return  the  first  key in the database.  Dbm_nextkey will
+       return the next key  in  the  database.   This  code  will
+       traverse the data base:
+
+              for (key = dbm_firstkey(db);
+                   key.dptr != NULL; key = dbm_nextkey(db))
+
+       Dbm_error  returns  non-zero  when  an  error has occurred
+       reading or writing the database.  Dbm_clearerr resets  the
+       error condition on the named database.
+
+
+
+

COMPATIBILITY NOTES

+       The historic dbm and ndbm libraries created two underlying
+       database files, traditionally named file.dir and file.pag.
+       The  DB  library  creates  a  single  database  file named
+       file.db.  Applications that are aware  of  the  underlying
+       database  file  names  may  require additional source code
+       modifications.
+
+       The  historic  dbminit   interface   required   that   the
+       underlying  ``.dir''  and  ``.pag''  files  already  exist
+       (empty databases  were  created  by  creating  zero-length
+       ``.dir'' and ``.pag'' files).  Applications that expect to
+       create databases using this method may require  additional
+       source code modifications.
+
+       The   historic   dbm_dirfno   and  dbm_pagfno  macros  are
+       supported, but will return identical file  descriptors  as
+       there  is  only  a  single  underlying file used by the DB
+       hashing  access  method.   Applications  using  both  file
+       descriptors for locking may require additional source code
+       modifications.
+
+       If an application using the ndbm interface  exits  without
+       closing  the  database, it may lose updates because the DB
+       library  buffers  all  writes.   Such  applications   will
+       require  additional  source  code  modifications  to  work
+       correctly with the DB library.
+
+
+
+

DBM DIAGNOSTICS

+       The dbminit function returns -1 on failure, setting errno,
+       and 0 on success.
+
+       The fetch function sets the returned datum's dptr field to
+       NULL on failure, setting errno,  and  returns  a  non-NULL
+       dptr on success.
+
+       The  store  function returns -1 on failure, setting errno,
+       and 0 on success.
+
+       The delete function returns -1 on failure, setting  errno,
+       and 0 on success.
+
+       The firstkey function sets the returned datum's dptr field
+       to NULL on failure, setting errno, and returns a  non-NULL
+       dptr on success.
+
+       The  nextkey function sets the returned datum's dptr field
+       to NULL on failure, setting errno, and returns a  non-NULL
+       dptr on success.
+
+
+
+

NDBM DIAGNOSTICS

+       The  dbm_open  function  returns  NULL on failure, setting
+       errno, and 0 on success.
+
+       The dbm_fetch function  sets  the  returned  datum's  dptr
+       field  to  NULL  on  failure, setting errno, and returns a
+       non-NULL dptr on success.
+
+       The dbm_store function  returns  -1  on  failure,  setting
+       errno,  0  on success, and 1 if DBM_INSERT was set and the
+       specified key already existed in the database.
+
+       The dbm_delete function returns  -1  on  failure,  setting
+       errno, and 0 on success.
+
+       The  dbm_firstkey  function sets the returned datum's dptr
+       field to NULL on failure, setting  errno,  and  returns  a
+       non-NULL dptr on success.
+
+       The  dbm_nextkey  function  sets the returned datum's dptr
+       field to NULL on failure, setting  errno,  and  returns  a
+       non-NULL dptr on success.
+
+       The  dbm_error  function  returns  -1  on failure, setting
+       errno, and 0 on success.
+
+       The dbm_clearerr function returns -1 on  failure,  setting
+       errno, and 0 on success.
+
+
+
+

ERRORS

+       The  dbminit function may fail and return errno for any of
+       the errors specified for  the  following  DB  and  library
+       functions: dbm_close(3), and dbm_open(3).
+
+       The  fetch  function  may fail and return errno for any of
+       the errors specified for  the  following  DB  and  library
+       functions: dbm_fetch(3).
+
+       The  store  function  may fail and return errno for any of
+       the errors specified for  the  following  DB  and  library
+       functions: dbm_store(3).
+
+       The  delete  function may fail and return errno for any of
+       the errors specified for  the  following  DB  and  library
+       functions: dbm_delete(3).
+
+       The firstkey function may fail and return errno for any of
+       the errors specified for  the  following  DB  and  library
+       functions: dbm_firstkey(3).
+
+       The  nextkey function may fail and return errno for any of
+       the errors specified for  the  following  DB  and  library
+       functions: dbm_nextkey(3).
+
+       The dbm_open function may fail and return errno for any of
+       the errors specified for  the  following  DB  and  library
+       functions: db_open(3), and memset(3).
+
+       The  dbm_close  function may fail and return errno for any
+       of the errors specified for the following DB  and  library
+       functions: DB->close(3).
+
+       The  dbm_fetch  function may fail and return errno for any
+       of the errors specified for the following DB  and  library
+       functions: DB->get(3), and memset(3).
+
+       The  dbm_store  function may fail and return errno for any
+       of the errors specified for the following DB  and  library
+       functions: DB->put(3), and memset(3).
+
+       The  dbm_delete function may fail and return errno for any
+       of the errors specified for the following DB  and  library
+       functions: memset(3).
+
+       The  dbm_firstkey  function  may fail and return errno for
+       any of the errors  specified  for  the  following  DB  and
+       library functions: DB->cursor(3), and memset(3).
+
+       The dbm_nextkey function may fail and return errno for any
+       of the errors specified for the following DB  and  library
+       functions: DB->cursor(3), and memset(3).
+
+
+
+

SEE ALSO

+       The  DB  library  is  a family of groups of functions that
+       provides a modular programming interface  to  transactions
+       and  record-oriented  file  access.   The library includes
+       support for transactions, locking, logging and  file  page
+       caching,  as well as various indexed access methods.  Many
+       of the functional groups  (e.g.,  the  file  page  caching
+       functions)   are   useful  independent  of  the  other  DB
+       functions, although some functional groups are  explicitly
+       based  on  other functional groups (e.g., transactions and
+       logging).  For a general description of  the  DB  package,
+       see db_intro(3).
+
+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_appinit(3), db_cursor(3), db_dbm(3), db_internal(3),
+       db_lock(3), db_log(3), db_mpool(3), db_open(3), db_thread(3),
+       db_txn(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/db_dbt.html b/mozilla/db/man/man.html/db_dbt.html new file mode 100644 index 00000000000..a8f19187eef --- /dev/null +++ b/mozilla/db/man/man.html/db_dbt.html @@ -0,0 +1,225 @@ + + +db_dbt + + +

db_dbt

+
+
+
+       typedef struct {
+              void *data;
+              u_int32_t size;
+              u_int32_t ulen;
+              u_int32_t dlen;
+              u_int32_t doff;
+              u_int32_t flags;
+       } DBT;
+
+
+
+

KEY/DATA PAIRS

+       Storage  and retrieval for the DB access methods are based
+       on  key/data  pairs.   Both  key  and   data   items   are
+       represented by the DBT data structure.
+
+       Key  and  data  byte  strings  may  reference  strings  of
+       essentially unlimited length, although any two  keys  must
+       fit  into  available  memory at the same time so that they
+       may be compared, and any  one  data  item  must  fit  into
+       available memory so that it may be returned.
+
+       In  order  to ensure compatibility with future releases of
+       DB,  all  fields  of  the  DBT  structure  that  are   not
+       explicitly set should be initialized to 0 before the first
+       time the structure is used.   Do  this  by  declaring  the
+       structure  external or static, or by calling the C library
+       routine bzero(3) or memset(3).
+
+       By default, the flags structure element is expected to  be
+       0.   In  this  default  case, when being provided a key or
+       data item by the application, the DB package  expects  the
+       data  structure  element to point to a byte string of size
+       bytes.  When returning a key/data item to the application,
+       the  DB package will store into the data structure element
+       a pointer to a byte string of size bytes.  By default, the
+       memory  referenced  by  this  stored pointer is only valid
+       until the next call to the DB package using the DB  handle
+       returned by db_open.
+
+       The access methods provide no guarantees about byte string
+       alignment,   and   applications   are   responsible    for
+       maintaining    any    necessary    alignment.    Use   the
+       DB_DBT_USERMEM flag to cause returned items to  be  placed
+       in memory of arbitrary alignment.
+
+       The elements of the DBT structure are defined as follows:
+
+       void *data;
+            A pointer to a byte string.
+
+       u_int32_t size;
+            The length of data, in bytes.
+
+       u_int32_t ulen;
+            The  size  of the user's buffer (referenced by data),
+            in bytes.  This location is not  written  by  the  DB
+            functions.   See  the  DB_DBT_USERMEM  flag  for more
+            information.
+
+       u_int32_t dlen;
+            The length  of  the  partial  record  being  read  or
+            written  by  the  application,  in  bytes.   See  the
+            DB_DBT_PARTIAL flag for more information.
+
+       u_int32_t doff;
+            The offset  of  the  partial  record  being  read  or
+            written  by  the  application,  in  bytes.   See  the
+            DB_DBT_PARTIAL flag for more information.
+
+       u_int32_t flags;
+            The flags value is specified by or'ing  together  one
+            or more of the following values:
+
+            DB_DBT_MALLOC
+                 Ignored  except when retrieving information from
+                 a database, e.g., a DB->get  or  DBcursor->c_get
+                 call.   This  flag  causes DB to allocate memory
+                 for  the  returned  key  or  data  item   (using
+                 malloc(3),    or   the   user-specified   malloc
+                 function) and return a pointer to it in the data
+                 field  of  the  key  or data DBT structure.  The
+                 allocated memory becomes the  responsibility  of
+                 the  calling  application.   It  is  an error to
+                 specify both DB_DBT_MALLOC and DB_DBT_USERMEM.
+
+            DB_DBT_USERMEM
+                 Ignored except when retrieving information  from
+                 a  database,  e.g., a DB->get or DBcursor->c_get
+                 call.   The  data  field  of  the  key  or  data
+                 structure must reference memory that is at least
+                 ulen bytes in length.   If  the  length  of  the
+                 requested  item  is  less  than or equal to that
+                 number of bytes, the item  is  copied  into  the
+                 memory referenced by the data field.  Otherwise,
+                 an error is returned, the size field is  set  to
+                 the  length  needed  for the requested item, and
+                 the errno variable is set to ENOMEM.  It  is  an
+                 error   to   specify   both   DB_DBT_MALLOC  and
+                 DB_DBT_USERMEM.
+
+            DB_DBT_PARTIAL
+                 Ignored  except  when  specified  for   a   data
+                 parameter,  where  this  flag causes the partial
+                 retrieval or storage of an item.  If the calling
+                 application  is  doing  a  get,  the  dlen bytes
+                 starting doff bytes from the  beginning  of  the
+                 retrieved  data  record  are returned as if they
+                 comprised the entire record.  If any or  all  of
+                 the  specified bytes do not exist in the record,
+                 the get is successful and the existing bytes  or
+                 0 bytes are returned.
+
+                 For  example, if the data portion of a retrieved
+                 record was 100 bytes, and  a  partial  retrieval
+                 was  done  using a DBT having a dlen field of 20
+                 and a doff field  of  85,  the  get  call  would
+                 succeed, the data field would reference the last
+                 15 bytes of the record, and the size field would
+                 be set to 15.
+
+                 If  the  calling application is doing a put, the
+                 dlen  bytes  starting  doff   bytes   from   the
+                 beginning of the specified key's data record are
+                 replaced by the data specified by the  data  and
+                 size  structure  elements.   If  dlen is smaller
+                 than size, the record will grow, and if dlen  is
+                 larger  than  size,  the record will shrink.  If
+                 the specified bytes do  not  exist,  the  record
+                 will  be  extended using nul bytes as necessary,
+                 and the put call will succeed.
+
+                 It is an error to attempt a  partial  put  using
+                 the DB->put function in a database that supports
+                 duplicate records.  Partial  puts  in  databases
+                 supporting  duplicate records must be done using
+                 a db_cursor(3) function.   It  is  an  error  to
+                 attempt  a  partial  put with differing dlen and
+                 size values in  a  recno  database  with  fixed-
+                 length records.
+
+                 For  example, if the data portion of a retrieved
+                 record was 100 bytes, and a partial put was done
+                 using  a  DBT  having a dlen field of 20, a doff
+                 field of  85,  and  a  size  field  of  30,  the
+                 resulting  record  would be 115 bytes in length,
+                 where the last 30 bytes would be those specified
+                 by the put call.
+
+       The  default algorithm of associating returned key or data
+       items with the  DB  handle  returned  by  db_open(3)  will
+       obviously   not  work  when  DB  handles  are  being  used
+       concurrently by multiple threads within  a  process,  i.e,
+       when DB_THREAD was specified to db_open(3).  When multiple
+       threads are using the  returned  DB  handle  concurrently,
+       either  the  DB_DBT_MALLOC or DB_DBT_USERMEM flags must be
+       specified for any DBT used for key or data retrieval.
+
+
+
+

LOGICAL RECORD NUMBERS

+       In all cases for the recno access method, and when calling
+       the   db->get   and   cursor->c_get   functions  with  the
+       DB_SET_RECNO flag specified, the data  field  of  the  key
+       must be a pointer to a memory location of type db_recno_t,
+       as typedef'd in the <db.h> include file.  This type  is  a
+       32-bit  unsigned type, (which limits the number of logical
+       records in a  recno  database,  and  the  maximum  logical
+       record  which  may  be  directly  retrieved  from  a btree
+       database, to 4,294,967,296).  The size field  of  the  key
+       should   be  the  size  of  that  type,  e.g.,  in  the  C
+       programming language, ``sizeof(db_recno_t)''.
+
+       Logical record numbers are 1-based, not 0-based, i.e., the
+       first record in the database is record number 1.
+
+
+
+

BUGS

+       The  DB  access  methods  provide no guarantees about byte
+       string alignment, and  applications  are  responsible  for
+       maintaining any necessary alignment.
+
+       The  name  DBT  is a mnemonic for ``data base thang'', and
+       was used because noone could think of  a  reasonable  name
+       that wasn't already in use somewhere else.
+
+
+
+

SEE ALSO

+       The  DB  library  is  a family of groups of functions that
+       provides a modular programming interface  to  transactions
+       and  record-oriented  file  access.   The library includes
+       support for transactions, locking, logging and  file  page
+       caching,  as well as various indexed access methods.  Many
+       of the functional groups  (e.g.,  the  file  page  caching
+       functions)   are   useful  independent  of  the  other  DB
+       functions, although some functional groups are  explicitly
+       based  on  other functional groups (e.g., transactions and
+       logging).  For a general description of  the  DB  package,
+       see db_intro(3).
+
+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_appinit(3), db_cursor(3), db_dbm(3), db_internal(3),
+       db_lock(3), db_log(3), db_mpool(3), db_open(3), db_thread(3),
+       db_txn(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/db_deadlock.html b/mozilla/db/man/man.html/db_deadlock.html new file mode 100644 index 00000000000..be623f2b62b --- /dev/null +++ b/mozilla/db/man/man.html/db_deadlock.html @@ -0,0 +1,99 @@ + + +db_deadlock + + +

db_deadlock

+
+
+
+       db_deadlock [-vw] [-a m | o | y] [-h home] [-L file ] [-t sec ]
+
+
+
+

DESCRIPTION

+       The   db_deadlock  utility  traverses  the  database  lock
+       structures and aborts a transaction each time it detects a
+       deadlock.   This  utility  should  be  run as a background
+       daemon whenever multiple threads or  processes  are  using
+       locking.  By default, a random transaction involved in the
+       deadlock is aborted.
+
+       The options are as follows:
+
+       -a   When a deadlock is detected, abort the oldest (``o'')
+            transaction, the youngest (``y'') transaction, or the
+            transaction with the minimum number of locks (``m'').
+
+       -h   Specify a home directory for the database.
+
+       -L   Log  the  execution of the db_deadlock utility to the
+            specified file in the following format, where ``###''
+            is  the  process  ID,  and  the  date is the time the
+            utility starting running.
+
+            db_deadlock: ### Wed Jun 15 01:23:45 EDT 1995
+
+            This file will be removed if the db_deadlock  utility
+            exits gracefully.
+
+       -t   Initiate  a  pass  over  the  database locks at least
+            every sec seconds.
+
+       -v   Run in verbose mode, generating  messages  each  time
+            the detector runs.
+
+       -w   Make a single pass over the database locks every time
+            a process is forced to wait for a lock.
+
+       At least one of the -t and -w options must be specified.
+
+       The db_deadlock  utility  attaches  to  DB  shared  memory
+       regions.   In  order to avoid region corruption, it should
+       always be given the chance to detach and exit  gracefully.
+       To  cause  db_deadlock  to clean up after itself and exit,
+       send it an interrupt signal (SIGINT).
+
+       The db_deadlock utility exits 0 on success, and >0  if  an
+       error occurs.
+
+
+
+

ENVIRONMENT VARIABLES

+       The  following  environment variables affect the execution
+       of db_deadlock:
+
+       DB_HOME
+            If the -h option is not specified and the environment
+            variable  DB_HOME  is  set, it is used as the path of
+            the database home, as described in db_appinit(3).
+
+
+
+

SEE ALSO

+       The DB library is a family of  groups  of  functions  that
+       provides  a  modular programming interface to transactions
+       and record-oriented file  access.   The  library  includes
+       support  for  transactions, locking, logging and file page
+       caching, as well as various indexed access methods.   Many
+       of  the  functional  groups  (e.g.,  the file page caching
+       functions)  are  useful  independent  of  the   other   DB
+       functions,  although some functional groups are explicitly
+       based on other functional groups (e.g.,  transactions  and
+       logging).   For  a  general description of the DB package,
+       see db_intro(3).
+
+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_appinit(3), db_cursor(3), db_dbm(3), db_internal(3),
+       db_lock(3), db_log(3), db_mpool(3), db_open(3), db_thread(3),
+       db_txn(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/db_dump.html b/mozilla/db/man/man.html/db_dump.html new file mode 100644 index 00000000000..4d8880c8bf6 --- /dev/null +++ b/mozilla/db/man/man.html/db_dump.html @@ -0,0 +1,168 @@ + + +db_dump + + +

db_dump

+
+
+
+       db_dump [-d] [-f output] db_file
+       db_dump [-p] [-f output] [-h home] db_file
+       db_dump185 [-p] [-f output] db_file
+
+
+
+

DESCRIPTION

+       The  db_dump  utility  reads the database file db_file and
+       writes it to the standard output using  a  portable  flat-
+       text  format  understood  by  the db_load(1) utility.  The
+       argument db_file must be a  file  produced  using  the  DB
+       library functions.
+
+       The  db_dump185  utility is similar to the db_dump utility
+       except that it reads databases in the format  used  by  DB
+       versions 1.85 and 1.86.
+
+       The options are as follows:
+
+       -d   Dump  the  specified database in a format helpful for
+            debugging the DB library routines.  The output format
+            of  the  -d  option  is  not standard and may change,
+            without notice, between releases of the DB library.
+
+       -f   Write  to  the  specified  file  instead  of  to  the
+            standard output.
+
+       -h   Specify  a  home  directory  for the database.  As DB
+            versions before 2.0 did not support the concept of  a
+            database  ``home'',  db_dump185 does not support this
+            option.
+
+       -p   If characters in either the key  or  data  items  are
+            printing  characters  (as defined by isprint(3)), use
+            printing characters in file to represent them.   This
+            option  permits users to use standard text editors to
+            modify the contents of databases.
+
+            Note, different systems may have different notions as
+            to  what  characters  are ``printing'', and databases
+            dumped  in  this  manner  may  be  less  portable  to
+            external systems.
+
+       Dumping and reloading hash databases that use user-defined
+       hash functions will result in new databases that  use  the
+       default  hash  function.   While  using  the  default hash
+       function may not be optimal for the new database, it  will
+       continue to work correctly.
+
+       Dumping  and  reloading  btree  databases  that  use user-
+       defined prefix or comparison functions will result in  new
+       databases  that  use  the  default  prefix  and comparison
+       functions.  In this case, it  is  quite  likely  that  the
+       database  will be damaged beyond repair permitting neither
+       record storage or retrieval.
+
+       The only available workaround for either case is to modify
+       the  sources  for  the  db_load(1)  utility  to  load  the
+       database using the correct  hash,  prefix  and  comparison
+       functions.
+
+       The db_dump185 utility may not be available on your system
+       as it is not always installed when the  DB  libraries  and
+       utilities  are  installed.   If you are unable to find it,
+       see your system administrator for further information.
+
+       The db_dump utility exits 0 on success, and >0 if an error
+       occurs.  The db_dump185 utility exits 0 on success, and >0
+       if an error occurs.
+
+
+
+

OUTPUT FORMATS

+       There  are  two  output  formats  used  by   db_dump   and
+       db_dump185.
+
+       In  both output formats, the first few lines of the output
+       contain  header  information  describing  the   underlying
+       access  method, filesystem page size and other bookkeeping
+       information.  This information is output in ``name=value''
+       pairs, where ``name'' may be any of the keywords listed in
+       the db_load(1) manual page,  and  ``value''  will  be  its
+       value.  While this header information can be edited before
+       the database is reloaded, there is rarely any reason to do
+       so,  as  all  of  this  information  can  be overridden by
+       command-line arguments to db_load.
+
+       Following the header information are  the  key/data  pairs
+       from  the  database.   If  the database being dumped is of
+       type btree or hash, the output will  be  paired  lines  of
+       text,  where  the  first line of the pair is the key item,
+       and the second line of the pair is its corresponding  data
+       item.   If the database being dumped is of type recno, the
+       output will be lines of text, where each  line  is  a  new
+       data item for the database.
+
+       If  the  -p  option  was  specified, each output line will
+       consist of single characters representing  any  characters
+       from  the  database  that were ``printing'', and backslash
+       (``\'')  escaped  characters  for  any  that   were   not.
+       Backslash  characters  appearing in the output mean one of
+       two things: if the backslash  character  precedes  another
+       backslash  character,  it  means  that a literal backslash
+       character occurred in  the  key  or  data  item.   If  the
+       backslash character precedes any other character, the next
+       two  characters  should  be  interpreted  as   hexadecimal
+       specification  of  a  single character, e.g., ``\0a'' is a
+       newline character in the ASCII character set.
+
+       If the -p option was not specified, each output line  will
+       consist  of  paired  hexadecimal  values,  e.g.,  the line
+       ``726f6f74'' is the string ``root'' in the ASCII character
+       set.
+
+       In  both  output  formats, a single newline character ends
+       both the key and data items.
+
+
+
+

ENVIRONMENT VARIABLES

+       The following environment variables affect  the  execution
+       of db_dump:
+
+       DB_HOME
+            If the -h option is not specified and the environment
+            variable DB_HOME is set, it is used as  the  path  of
+            the database home, as described in db_appinit(3).
+
+
+
+

SEE ALSO

+       isprint(3)
+
+       The  DB  library  is  a family of groups of functions that
+       provides a modular programming interface  to  transactions
+       and  record-oriented  file  access.   The library includes
+       support for transactions, locking, logging and  file  page
+       caching,  as well as various indexed access methods.  Many
+       of the functional groups  (e.g.,  the  file  page  caching
+       functions)   are   useful  independent  of  the  other  DB
+       functions, although some functional groups are  explicitly
+       based  on  other functional groups (e.g., transactions and
+       logging).  For a general description of  the  DB  package,
+       see db_intro(3).
+
+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_appinit(3), db_cursor(3), db_dbm(3), db_internal(3),
+       db_lock(3), db_log(3), db_mpool(3), db_open(3), db_thread(3),
+       db_txn(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/db_hsearch.html b/mozilla/db/man/man.html/db_hsearch.html new file mode 100644 index 00000000000..7c4a415eed7 --- /dev/null +++ b/mozilla/db/man/man.html/db_hsearch.html @@ -0,0 +1,141 @@ + + +db_hsearch + + +

db_hsearch

+
+
+
+       #define DB_DBM_HSEARCH    1
+       #include <db.h>
+
+       typedef enum {
+               FIND, ENTER
+       } ACTION;
+
+       typedef struct entry {
+               char *key;
+               void *data;
+       } ENTRY;
+
+       ENTRY *
+       hsearch(ENTRY item, ACTION action);
+
+       int
+       hcreate(size_t nelem);
+
+       void
+       hdestroy(void);
+
+
+
+

DESCRIPTION

+       The  hsearch  interface  to  the DB library is intended to
+       provide   source   code   compatibility    for    historic
+       applications.    It  is  not  recommended  for  any  other
+       purpose.
+
+       To compile hsearch applications, replace the application's
+       #include  of  the  hsearch  include file (e.g., ``#include
+       <search.h>'') with the following two lines:
+
+              #define DB_DBM_HSEARCH    1
+              #include <db.h>
+
+       and recompile.
+
+       The hcreate function creates an in-memory  database.   The
+       nelem  argument  is an estimation of the maximum number of
+       key/data pairs that will be stored in the database.
+
+       The hdestroy function discards the database.
+
+       Database elements are  structures  of  type  ENTRY,  which
+       contain  at least two fields: key and data.  The field key
+       is declared to be of type ``char *'' and is the  key  used
+       for  storage and retrieval.  The field data is declared to
+       be of type ``void *'' and is its associated data.
+
+       The hsearch function retrieves key/data  pairs  from,  and
+       stores key/data pairs into, the database.
+
+       The action argument must be set to one of two values:
+
+       ENTER
+            If  the  key does not already appear in the database,
+            insert the key/data pair into the database.   If  the
+            key   already  appears  in  the  database,  return  a
+            reference  to  an  ENTRY  structure  referencing  the
+            existing key and its associated data element.
+
+       FIND Retrieve   the   specified  key/data  pair  from  the
+            database.
+
+
+
+

COMPATIBILITY NOTES

+       Historically, hsearch required  applications  to  maintain
+       the  keys and data in the application's memory for as long
+       as the hsearch database existed.  As DB  handles  key  and
+       data  management  internally, there is no requirement that
+       applications maintain local copies of key and data  items,
+       although  the  only  effect  of  doing  so  should  be the
+       allocation of additional memory.
+
+
+
+

DIAGNOSTICS

+       The hcreate function returns 0 on failure, setting  errno,
+       and non-zero on success.
+
+       The  hsearch  function  returns  a  pointer  to  an  ENTRY
+       structure on success, and  NULL,  setting  errno,  if  the
+       action  specified  was FIND and the item did not appear in
+       the database.
+
+
+
+

ERRORS

+       The hcreate function may fail and return errno for any  of
+       the  errors  specified  for  the  following DB and library
+       functions: db_open(3), and memset(3).
+
+       The hsearch function may fail and return errno for any  of
+       the  errors  specified  for  the  following DB and library
+       functions: DB->get(3), DB->put(3), memset(3), and
+       strlen(3).
+
+       In addition, the hsearch function will fail, setting errno
+       to 0, if the action specified was FIND and  the  item  did
+       not appear in the database.
+
+
+
+

SEE ALSO

+       The  DB  library  is  a family of groups of functions that
+       provides a modular programming interface  to  transactions
+       and  record-oriented  file  access.   The library includes
+       support for transactions, locking, logging and  file  page
+       caching,  as well as various indexed access methods.  Many
+       of the functional groups  (e.g.,  the  file  page  caching
+       functions)   are   useful  independent  of  the  other  DB
+       functions, although some functional groups are  explicitly
+       based  on  other functional groups (e.g., transactions and
+       logging).  For a general description of  the  DB  package,
+       see db_intro(3).
+
+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_appinit(3), db_cursor(3), db_dbm(3), db_internal(3),
+       db_lock(3), db_log(3), db_mpool(3), db_open(3), db_thread(3),
+       db_txn(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/db_internal.html b/mozilla/db/man/man.html/db_internal.html new file mode 100644 index 00000000000..37a1806abb1 --- /dev/null +++ b/mozilla/db/man/man.html/db_internal.html @@ -0,0 +1,460 @@ + + +db_internal + + +

db_internal

+
+
+
+
+
+

SYNOPSIS

+       #include <db.h>
+
+       int
+       db_jump_set(void *func, int which);
+
+       int
+       db_value_set(int value, int which);
+
+
+
+

DESCRIPTION

+       The DB library is a family of  groups  of  functions  that
+       provides  a  modular programming interface to transactions
+       and record-oriented file  access.   The  library  includes
+       support  for  transactions, locking, logging and file page
+       caching, as well as various indexed access methods.   Many
+       of  the  functional  groups  (e.g.,  the file page caching
+       functions)  are  useful  independent  of  the   other   DB
+       functions,  although some functional groups are explicitly
+       based on other functional groups (e.g.,  transactions  and
+       logging).   For  a  general description of the DB package,
+       see db_intro(3).
+
+       This manual page describes interfaces to tune  or  replace
+       underlying  system  functionality  used by the DB library.
+       Few  applications  should  have   any   need   for   these
+       interfaces.
+
+  db_jump_set
+       The  db_jump_set  function enables applications to replace
+       underlying DB library functionality by  replacing  entries
+       in  a  function  call  jump  table.   The  which  argument
+       specifies the entry to be replaced by the argument func.
+
+       The following values of which are supported:
+
+       DB_FUNC_CLOSE
+            Replace all DB calls to  the  IEEE  Std  1003.1b-1993
+            (``POSIX'')  close  function  with  func,  which must
+            conform to the standard interface.
+
+       DB_FUNC_DIRFREE
+            The DB library requires the  ability  to  return  any
+            memory  allocated  as part of the routine which reads
+            through a directory and creates a list of files  that
+            that  the  directory  contains (see DB_FUNC_DIRLIST).
+            The func  argument  must  conform  to  the  following
+            interface:
+
+                 int dirfree(char **namesp, int cnt);
+
+            The  namesp  and cnt arguments are the same values as
+            were returned by the DB_FUNC_DIRLIST function.
+
+            The dirfree function returns the value  of  errno  on
+            failure and 0 on success.
+
+       DB_FUNC_DIRLIST
+            The DB library requires the ability to read through a
+            directory and create a list of files  that  that  the
+            directory  contains.   The func argument must conform
+            to the following interface:
+
+                 int dirlist(const char *dir,
+                    char ***namesp, int *cntp);
+
+            The dir argument is the name of the directory  to  be
+            searched.   The  function must return a pointer to an
+            array of nul-terminated  file  names  in  the  memory
+            location  referenced  by  the  argument namesp, and a
+            count of the number of elements in the array  in  the
+            memory location referenced by cntp.
+
+            The  dirlist  function  returns the value of errno on
+            failure and 0 on success.
+
+       DB_FUNC_EXISTS
+            The DB library requires the ability to determine if a
+            file  exists, and optionally, if it is a file of type
+            directory.  The func argument  must  conform  to  the
+            following interface:
+
+                 int exists(const char *path, int *isdirp);
+
+            The  path  argument is the pathname of the file to be
+            checked.
+
+            If the isdirp argument is non-NULL, it must be set to
+            non-0  if path is a directory, and 0 if path is not a
+            directory.
+
+            The exists function returns the  value  of  errno  on
+            failure and 0 on success.
+
+       DB_FUNC_FREE
+            Replace  all  DB  calls  to  the  ANSI  C X3.159-1989
+            (``ANSI C'') standard free function with func,  which
+            must conform to the standard interface.
+
+       DB_FUNC_FSYNC
+            Replace  all  DB  calls  to the IEEE Std 1003.1b-1993
+            (``POSIX'') fsync  function  with  func,  which  must
+            conform to the standard interface.
+
+       DB_FUNC_IOINFO
+            The  DB library requires the ability to determine the
+            size and I/O characteristics of  a  file.   The  func
+            argument must conform to the following interface:
+
+                 int ioinfo(const char *path, int fd,
+                    u_int32_t *mbytesp, u_int32_t *bytesp,
+                    u_int32_t *iosizep);
+
+            The  path  argument is the pathname of the file to be
+            checked,  and  the  fd  argument  is  an  open   file
+            descriptor on the file.
+
+            If the mbytesp and bytesp arguments are non-NULL, the
+            ioinfo function must return in them the size  of  the
+            file:  the  number  of megabytes in the file into the
+            memory location referenced by the  mbytesp  argument,
+            and the number of bytes over and above that number of
+            megabytes into the memory location referenced by  the
+            bytesp argument.
+
+            In addition, if the iosizep argument is non-NULL, the
+            ioinfo function must return the  optimum  granularity
+            for I/O operations to the file in the memory location
+            referenced by it.
+
+            The ioinfo function returns the  value  of  errno  on
+            failure and 0 on success.
+
+       DB_FUNC_MALLOC
+            Replace  all  DB  calls  to  the  ANSI  C X3.159-1989
+            (``ANSI C'')  standard  malloc  function  with  func,
+            which must conform to the standard interface.
+
+       DB_FUNC_MAP
+            The  DB  library  requires  the ability to map a file
+            into memory  and  to  create  shared  memory  regions
+            (which  may or may not be backed by files).  The func
+            argument must conform to the following interface:
+
+                 int map(char *path, int fd, size_t len,
+                    int is_region, int is_anonymous, int is_rdonly,
+                    void **addr);
+
+            The path argument is the name  of  a  file.   The  fd
+            argument is an open file descriptor on that file.
+
+            The  is_region argument will be zero if the intention
+            is to map a file into shared memory.  In  this  case,
+            the  map function must map the first len bytes of the
+            file into memory and return a pointer to  the  mapped
+            location  in  the  memory  location referenced by the
+            argument  addr.   In  this  case,  the   is_anonymous
+            argument will always be zero.  The is_rdonly argument
+            will be non-zero if the file is considered  read-only
+            by the caller.
+
+            The is_region argument will be non-zero if the memory
+            is intended to be used as a shared memory region  for
+            synchronization  between  DB  threads/processes.   In
+            this case, the returned memory may  be  of  any  kind
+            (e.g.,  anonymous),  but  must  be  able  to  support
+            semaphores.   If  the  application   has   previously
+            specified  that  regions  are  to  be instantiated in
+            anonymous memory (see DB_REGION_ANON below),  or  the
+            region  is  being joined and is believed to have been
+            allocated   in   anonymous   shared    memory,    the
+            is_anonymous     argument     will    be    non-zero.
+            Additionally,  the  path  and  fd  arguments  may  be
+            ignored  (although  future  map  calls using the same
+            path must return the same memory), and the  is_rdonly
+            argument will always be zero.
+
+            By  default, on UNIX systems, the DB library will use
+            the  IEEE  Std   1003.1b-1993   (``POSIX'')   mmap(2)
+            interface  to  both  map  regular  files  into shared
+            memory and create  shared  memory  regions.   If  the
+            application  specifies  that shared memory regions be
+            instantiated in anonymous memory (see  DB_REGION_ANON
+            below), the shmget(2) shared memory segment interface
+            will be used, where available, and  the  MAP_ANON  or
+            MAP_ANONYMOUS  options  to  mmap(2) when shmget(2) is
+            not available.
+
+            When  using  shmget(2),  shared  memory  regions  are
+            named,  and  so  multiple  processes  may share them.
+            When  using  the  mmap  MAP_ANON   or   MAP_ANONYMOUS
+            options,  shared memory regions are not named, and so
+            may only be accessed by  a  single  process  and  its
+            threads.
+
+            HP/UX note:
+                 The  shmget(2) interfaces are not used on HP/UX,
+                 even though  they  exist,  as  anonymous  memory
+                 allocated  using  shmget(2)  cannot  be  used to
+                 store semaphores.
+
+       The map function returns the value of errno on failure and
+       0 on success.
+
+       DB_FUNC_OPEN
+            Replace  all  DB  calls  to the IEEE Std 1003.1b-1993
+            (``POSIX'')  open  function  with  func,  which  must
+            conform to the standard interface.
+
+       DB_FUNC_READ
+            Replace  all  DB  calls  to the IEEE Std 1003.1b-1993
+            (``POSIX'')  read  function  with  func,  which  must
+            conform to the standard interface.
+
+       DB_FUNC_REALLOC
+            Replace  all  DB  calls  to  the  ANSI  C X3.159-1989
+            (``ANSI C'') standard  realloc  function  with  func,
+            which must conform to the standard interface.
+
+       DB_FUNC_RUNLINK
+            The  DB library requires the ability to remove shared
+            memory regions from the system, whether or  not  they
+            are  backed by regular files.  The func argument must
+            conform to the following interface:
+
+                 int runlink(char *path);
+
+            The path argument is the path argument  specified  to
+            the  DB_FUNC_MAP  function when the region was mapped
+            into memory.
+
+            The runlink function returns the value  of  errno  on
+            failure and 0 on success.
+
+       DB_FUNC_SEEK
+            The DB library requires the ability to specify that a
+            subsequent read from or write to a file will occur at
+            a  specific location in that file.  The func argument
+            must conform to the following interface:
+
+                 int seek(int fd, size_t pgsize, db_pgno_t pageno,
+                    u_int32_t relative, int rewind, int whence);
+
+            The fd argument is an open  file  descriptor  on  the
+            file.  The seek function must cause a subsequent read
+            from or write to the file to occur at a  byte  offset
+            specified by the calculation:
+
+                 (pgsize * pageno) + relative
+
+            If  rewind is non-zero, the byte offset is treated as
+            a backwards seek, not a forwards one.
+
+            The whence argument specifies where in the  file  the
+            byte  offset is relative to, as described by the IEEE
+            Std 1003.1b-1993 (``POSIX'') lseek system call.
+
+            The seek function  returns  the  value  of  errno  on
+            failure and 0 on success.
+
+       DB_FUNC_SLEEP
+            The  DB  library  requires  the  ability  to  cause a
+            process to suspend  itself  for  a  period  of  time,
+            relinquishing  control  of the processor to any other
+            waiting thread of control.  The  func  argument  must
+            conform to the following interface:
+
+                 int sleep(u_long seconds, u_long microseconds);
+
+            The  seconds  and  microseconds arguments specify the
+            amount of time to wait until the suspending thread of
+            control should run again.
+
+            The  seconds  and  microseconds  arguments may not be
+            normalized when the sleep function is  called,  i.e.,
+            the   microseconds   argument  may  be  greater  than
+            1000000.
+
+            The sleep function returns  the  value  of  errno  on
+            failure and 0 on success.
+
+       DB_FUNC_UNLINK
+            Replace  all  DB  calls  to the IEEE Std 1003.1b-1993
+            (``POSIX'') unlink function  with  func,  which  must
+            conform to the standard interface.
+
+       DB_FUNC_UNMAP
+            The  DB  library requires the ability to unmap a file
+            or  shared  memory  region  from  memory.   The  func
+            argument must conform to the following interface:
+
+                 int unmap(void *addr, size_t len);
+
+            The  addr  argument  is  the argument returned by the
+            DB_FUNC_MAP function when  the  file  or  region  was
+            mapped  into memory, and the len argument is the same
+            as the len  argument  specified  to  the  DB_FUNC_MAP
+            function  when  the  file  or  region was mapped into
+            memory.
+
+            The unmap function returns  the  value  of  errno  on
+            failure and 0 on success.
+
+       DB_FUNC_WRITE
+            Replace  all  DB  calls  to the IEEE Std 1003.1b-1993
+            (``POSIX'') write  function  with  func,  which  must
+            conform to the standard interface.
+
+       DB_FUNC_YIELD
+            The  DB  library  requires  the  ability to yield the
+            processor from the current thread of control  to  any
+            other  waiting threads of control.  The func argument
+            must conform to the following interface:
+
+                 int yield(void);
+
+            The  yield  function  must  be  able  to  cause   the
+            rescheduling  all  participants  in  the  current  DB
+            environment, whether threaded  or  not.   It  may  be
+            incorrect  to  supply a thread yield function if more
+            than  a  single  process  is  operating  in  the   DB
+            environment.    This  is  because  many  thread-yield
+            functions will not allow other processes to run,  and
+            the  contested  lock  may be held by another process,
+            not by another thread.
+
+            If no yield function is specified, or  if  the  yield
+            function  returns an error, the function specified by
+            the DB_FUNC_SLEEP  entry  will  be  used  instead  or
+            subsequently,   i.e.,   if   no   yield  function  is
+            specified, or it is possible for the  yield  function
+            to  fail, the sleep function must cause the processor
+            to reschedule any  waiting  threads  of  control  for
+            execution.
+
+            The  yield  function  returns  the  value of errno on
+            failure and 0 on success.
+
+       The db_jump_set function returns the  value  of  errno  on
+       failure and 0 on success.
+
+  db_value_set
+       The  db_value_set function enables applications to specify
+       underlying DB library functionality.  The  which  argument
+       specifies the information being set by the argument value.
+
+       The following values of which are supported:
+
+       DB_MUTEXLOCKS
+            Grant all requested mutual exclusion mutexes  without
+            testing  for  their  availability.   This flag should
+            never be used for any other purpose than debugging.
+
+       DB_REGION_ANON
+            Setting value to  a  non-zero  value  specifies  that
+            shared  memory regions are to be created in anonymous
+            memory,  and  not   backed   by   a   regular   file.
+            DB_REGION_NAME  differs  from  DB_REGION_ANON in that
+            the former will fail if  the  shared  memory  regions
+            cannot  be  named,  that  is,  if  multiple processes
+            cannot  use   them.    See   DB_FUNC_MAP   for   more
+            information.
+
+       DB_REGION_INIT
+            In  some  applications,  the expense of page-faulting
+            the shared memory  regions  can  affect  performance,
+            e.g.,  when  the  page-fault  occurs  while holding a
+            lock, other lock  requests  can  convoy  and  overall
+            throughput may decrease.  Setting value to a non-zero
+            value specifies that one byte be read  from  each  4K
+            page  of  the shared memory region when the region is
+            initialized.
+
+       DB_REGION_NAME
+            Setting value to  a  non-zero  value  specifies  that
+            shared  memory regions are to be created in anonymous
+            memory,  and  not   backed   by   a   regular   file.
+            DB_REGION_NAME  differs  from  DB_REGION_ANON in that
+            the former will fail if  the  shared  memory  regions
+            cannot  be  named,  that  is,  if  multiple processes
+            cannot  use   them.    See   DB_FUNC_MAP   for   more
+            information.
+
+       DB_TSL_SPINS
+            Specify  the  number  of  times  mutexes  should spin
+            without blocking.
+
+            This value defaults to 1 on uniprocessor systems  and
+            to   50   times   the   number   of   processors   on
+            multiprocessor systems.
+
+       The db_value_set function returns the value  of  errno  on
+       failure and 0 on success.
+
+
+
+

ERRORS

+       The db_jump_set function may fail and return errno for the
+       following conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+
+
+

BUGS

+       No type  checking  is  done  of  the  func  argument,  and
+       specifying  an  invalid  replacement  routine  will  cause
+       unpredictable results.
+
+       Applications  should  be  careful   to   replace   related
+       functions  as  a  group  and  at the same time.  Replacing
+       DB_FUNC_MALLOC without replacing DB_FUNC_REALLOC is likely
+       to result in unpredictable results.
+
+       On Windows/95, files that are opened by multiple processes
+       do not share data correctly.  To tell Berkeley DB to use a
+       named  region  of the paging file to share memory instead,
+       use:
+
+              db_value_set(1, DB_REGION_NAME);
+
+       You do not  need  to  do  this  if  your  application  can
+       guarantee  that  only  one  process  will  be accessing DB
+       files.
+
+       On Windows/NT, sharing of data between  processes  through
+       the paging file does not work correctly, so you should not
+       call db_value_set.  That will allow DB  to  use  the  file
+       itself for sharing, which works correctly.
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_appinit(3), db_cursor(3), db_dbm(3), db_internal(3),
+       db_lock(3), db_log(3), db_mpool(3), db_open(3), db_thread(3),
+       db_txn(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/db_intro.html b/mozilla/db/man/man.html/db_intro.html new file mode 100644 index 00000000000..67022a1cc29 --- /dev/null +++ b/mozilla/db/man/man.html/db_intro.html @@ -0,0 +1,546 @@ + + +db_intro + + +

db_intro

+
+
+
+       The  DB  library  is  a family of groups of functions that
+       provides a modular programming interface  to  transactions
+       and  record-oriented  file  access.   The library includes
+       support for transactions, locking, logging and  file  page
+       caching,  as well as various indexed access methods.  Many
+       of the functional groups  (e.g.,  the  file  page  caching
+       functions)   are   useful  independent  of  the  other  DB
+       functions, although some functional groups are  explicitly
+       based  on  other functional groups (e.g., transactions and
+       logging).  For a general description of  the  DB  package,
+       see db_intro(3).
+
+       The  DB  library  does  not  provide user interfaces, data
+       entry GUI's, SQL support or  any  of  the  other  standard
+       user-level  database interfaces.  What it does provide are
+       the programmatic building blocks that allow you to  easily
+       embed  database-style functionality and support into other
+       objects or interfaces.
+
+
+
+

ARCHITECTURE

+       The  DB  library  supports   two   different   models   of
+       applications: client-server and embedded.
+
+       In  the  client-server model, a database server is created
+       by writing an application that accepts requests  via  some
+       form  of IPC and issues calls to the DB functions based on
+       those queries.  In this  model,  applications  are  client
+       programs that attach to the server and issue queries.  The
+       client-server model trades performance for protection,  as
+       it   does  not  require  that  the  applications  share  a
+       protection  domain  with  the  server,  but   IPC/RPC   is
+       generally  slower than a function call.  In addition, this
+       model simplifies the  creation  of  network  client-server
+       applications.
+
+       In the embedded model, an application links the DB library
+       directly into its address space.  This provides for faster
+       access  to  database  functionality,  but  means  that the
+       applications sharing log files, lock manager,  transaction
+       manager  or  memory pool manager have the ability to read,
+       write, and corrupt each other's data.
+
+       It is the application designer's responsibility to  select
+       the appropriate model for their application.
+
+       Applications  require a single include file, <db.h>, which
+       must be  installed  in  an  appropriate  location  on  the
+       system.
+
+
+
+

C++

+       The  C++  classes provide a thin wrapper around the C API,
+       with the major advantages being improved encapsulation and
+       an optional exception mechanism for errors.
+
+       The  classes  and  methods  are  named  in  a fashion that
+       directly corresponds to structures and functions in the  C
+       interface.   Likewise,  arguments to methods appear in the
+       same order as  the  C  interface,  except  to  remove  the
+       explicit  ``this''  pointer.   The #defines used for flags
+       are identical between the C and C++ interfaces.
+
+       As a rule, each C++ object has exactly one structure  from
+       the  underlying C API associated with it.  The C structure
+       is allocated with each constructor  call  and  deallocated
+       with each destructor call.  Thus, the rules the user needs
+       to follow in allocating and  deallocating  structures  are
+       the same between the C and C++ interfaces.
+
+       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,   by   using  DbEnv::set_error_model()  (see
+       DbEnv(3)).  For a discussion of the  exception  mechanism,
+       see DbException(3).
+
+       For  the rest of this manual page, C interfaces are listed
+       as the primary reference,  and  C++  interfaces  following
+       parenthetically, e.g., db_open (Db::open).
+
+
+
+

JAVA

+       The  Java classes provide a layer around the C API that is
+       almost identical  to  the  C++  layer.   The  classes  and
+       methods are, for the most part identical to the C++ layer.
+       Db constants and #defines are represented as "static final
+       int" values.  Errors conditions appear as Java exceptions.
+
+       As in C++, each Java object has exactly one structure from
+       the  underlying  C  API  associated  with  it.   The  Java
+       structure is allocated with each constructor or open call,
+       but is deallocated only when the Java GC does so.  Because
+       the timing or ordering of GC is not predictable, the  user
+       should  take  care  to do a close() when finished with any
+       object that has such a method.
+
+
+
+

SUBSYSTEMS

+       The DB library is made up of  five  major  subsystems,  as
+       follows:
+
+       Access methods
+            The  access  methods subsystem is made up of general-
+            purpose support  for  creating  and  accessing  files
+            formatted  as  B+tree's,  hashed files, and fixed and
+            variable length records.  These modules are useful in
+            the  absence  of transactions for processes that need
+            fast, formatted file  support.   See  db_open(3)  and
+            db_cursor(3) (Db(3) and Dbc(3)) for more information.
+
+       Locking
+            The  locking  subsystem  is  a  general-purpose  lock
+            manager  used  by  DB.   This module is useful in the
+            absence of the rest of the DB package  for  processes
+            that  require a fast, configurable lock manager.  See
+            db_lock(3)  (DbLockTab(3)  and  DbLock(3))  for  more
+            information.
+
+       Logging
+            The  logging subsystem is the logging support used to
+            support the DB  transaction  model.   It  is  largely
+            specific  to  the DB package, and unlikely to be used
+            elsewhere.   See  db_log(3)   (DbLog(3))   for   more
+            information.
+
+       Memory Pool
+            The  memory  pool  subsystem  is  the general-purpose
+            shared memory buffer pool used by DB.  This module is
+            useful  outside  of the DB package for processes that
+            require page-oriented, cached,  shared  file  access.
+            See  db_mpool(3)  (DbMpool(3) and DbMpoolFile(3)) for
+            more information.
+
+       Transactions
+            The   transaction   subsystem   implements   the   DB
+            transaction  model.  It is largely specific to the DB
+            package.  See db_txn(3)  (DbTxnMgr(3)  and  DbTxn(3))
+            for more information.
+
+       There  are  several stand-alone utilities that support the
+       DB environment.  They are as follows:
+
+       db_archive
+            The  db_archive  utility  supports  database  backup,
+            archival    and   log   file   administration.    See
+            db_archive(1) for more information.
+
+       db_recover
+            The db_recover utility runs after an unexpected DB or
+            system   failure   to   restore  the  database  to  a
+            consistent  state.   See   db_recover(1)   for   more
+            information.
+
+       db_checkpoint
+            The  db_checkpoint  utility runs as a daemon process,
+            monitoring the database log and periodically  issuing
+            checkpoints.     See    db_checkpoint(1)   for   more
+            information.
+
+       db_deadlock
+            The db_deadlock utility runs  as  a  daemon  process,
+            periodically  traversing the database lock structures
+            and aborting transactions when it detects a deadlock.
+            See db_deadlock(1) for more information.
+
+       db_dump
+            The  db_dump utility writes a copy of the database to
+            a  flat-text  file  in  a   portable   format.    See
+            db_dump(1) for more information.
+
+       db_load
+            The db_load utility reads the flat-text file produced
+            by db_dump, and loads it into a database  file.   See
+            db_load(1) for more information.
+
+       db_stat
+            The db_stat utility displays statistics for databases
+            and database environments.  See db_stat(1)  for  more
+            information.
+
+
+
+

NAMING AND THE DB ENVIRONMENT

+       The   DB  application  environment  is  described  by  the
+       db_appinit(3)  (DbEnv(3))  manual  page.   The  db_appinit
+       (DbEnv::appinit)  function  is used to create a consistent
+       naming scheme for all  of  the  subsystems  sharing  a  DB
+       environment.  If db_appinit (DbEnv::appinit) is not called
+       by a DB application, naming is performed as  specified  by
+       the manual page for the specific subsystem.
+
+       DB  applications that run with additional privilege should
+       always call the db_appinit  (DbEnv::appinit)  function  to
+       initialize  DB naming for their application.  This ensures
+       that the environment variables  DB_HOME  and  TMPDIR  will
+       only  be used if the application explicitly specifies that
+       they are safe.
+
+
+
+

ADMINISTERING THE DB ENVIRONMENT

+       A DB environment consists of a database home directory and
+       all the long-running daemons necessary to ensure continued
+       functioning of DB and its applications.  In  the  presence
+       of  transactions,  the  checkpoint  daemon, db_checkpoint,
+       must be run as long as there are applications present (see
+       db_checkpoint(1)  for  details).   When  locking  is being
+       used, the deadlock detection daemon, db_deadlock, must  be
+       run  as  long  as  there  are  applications  present  (see
+       db_deadlock(1)  for  details).   The  db_archive   utility
+       provides  information  to  facilitate  log reclamation and
+       creation of  database  snapshots  (see  db_archive(1)  for
+       details).    After  application  or  system  failure,  the
+       db_recover utility must be run before any applications are
+       restarted  to  return  the  database to a consistent state
+       (see db_recover(1) for details).
+
+       The  simplest  way  to   administer   a   DB   application
+       environment  is to create a single ``home'' directory that
+       houses all the files for the applications that are sharing
+       the  DB  environment.   In  this  model, the shared memory
+       regions (i.e., the  locking,  logging,  memory  pool,  and
+       transaction  regions)  and log files will be stored in the
+       specified directory  hierarchy.   In  addition,  all  data
+       files  specified  using  relative  pathnames will be named
+       relative to this home directory.  When recovery  needs  to
+       be  run  (e.g., after system or application failure), this
+       directory  is  specified  as   the   home   directory   to
+       db_recover(1),  and the system is restored to a consistent
+       state, ready for the applications to be restarted.
+
+       In situations where further customization is desired, such
+       as  placing  the  log  files  on  a separate device, it is
+       recommended  that  the  application  installation  process
+       create  a  configuration  file  named ``DB_CONFIG'' in the
+       database home  directory,  specifying  the  customization.
+       See   db_appinit(3)   (DbEnv(3))   for   details  on  this
+       procedure.
+
+       The DB architecture does not support  placing  the  shared
+       memory  regions  on  remote filesystems, e.g., the Network
+       File System (NFS) and the Andrew File System  (AFS).   For
+       this  reason, the database home directory must reside on a
+       local filesystem.   Databases,  log  files  and  temporary
+       files  may  be  placed on remote filesystems, although the
+       application may incur a performance penalty for doing  so.
+
+       It is important to realize that all applications sharing a
+       single home directory implicitly trust each  other.   They
+       have  access  to  each  other's  data as it resides in the
+       shared memory buffer pool and will share resources such as
+       buffer   space   and   locks.    At  the  same  time,  any
+       applications that access the  same  files  must  share  an
+       environment  if consistency is to be maintained across the
+       different applications.
+
+
+
+

ERROR RETURNS

+       Except for the historic dbm and  hsearch  interfaces  (see
+       db_dbm(3)  and  db_hsearch(3)), DB does not use the global
+       variable errno to return error values.  The return  values
+       for all DB functions can be grouped into three categories:
+
+        0   A return value of 0 indicates that the operation  was
+            successful.
+
+       >0   A  return value that is greater than 0 indicates that
+            there was a system error.  The errno  value  returned
+            by the system is returned by the function, e.g., when
+            a DB function  is  unable  to  allocate  memory,  the
+            return value from the function will be ENOMEM.
+
+       <0   A  return  value  that  is  less  than  0 indicates a
+            condition that was not a system failure, but was  not
+            an  unqualified  success,  either.   For  example,  a
+            routine to retrieve a key/data pair from the database
+            may  return  DB_NOTFOUND  when the key/data pair does
+            not appear in the database, as opposed to  the  value
+            of  0,  which  would be returned if the key/data pair
+            were found in the database.  All such special  values
+            returned  by DB functions are less than 0 in order to
+            avoid conflict with possible values of errno.
+
+       There are two special  return  values  that  are  somewhat
+       similar  in  meaning,  are returned in similar situations,
+       and  therefore  might   be   confused:   DB_NOTFOUND   and
+       DB_KEYEMPTY.   The DB_NOTFOUND error return indicates that
+       the requested key/data pair did not exist in the  database
+       or  that  start-  or  end-of-file  has  been reached.  The
+       DB_KEYEMPTY error  return  indicates  that  the  requested
+       key/data  pair  logically  exists but was never explicitly
+       created by the application (the recno access  method  will
+       automatically    create    key/data   pairs   under   some
+       circumstances,   see   db_open(3)   (Db(3))    for    more
+       information),  or  that  the  requested  key/data pair was
+       deleted and is currently in a deleted state.
+
+
+
+

SIGNALS

+       When  applications  using  DB  receive  signals,   it   is
+       important  that  they  exit  gracefully, discarding any DB
+       locks that they  may  hold.   This  is  normally  done  by
+       setting  a  flag  when a signal arrives, and then checking
+       for  that  flag  periodically  within   the   application.
+       Specifically,  the  signal  handler  should not attempt to
+       release locks and/or close the  database  handles  itself.
+       This  is  not guaranteed to work correctly and the results
+       are undefined.
+
+       If an application exits holding a lock, the  situation  is
+       no  different  than  if  the  application crashed, and all
+       applications participating  in  the  database  environment
+       must be shutdown, and then recovery must be performed.  If
+       this is not done, the locks that the application held  can
+       cause  unresolvable  deadlocks  inside  the  database, and
+       applications may then hang.
+
+
+
+

MULTI-THREADING

+       See db_thread(3) for information on using DB  in  threaded
+       applications.
+
+
+
+

DATABASE AND PAGE SIZES

+       DB  stores  database  file page numbers as unsigned 32-bit
+       numbers and database file page sizes  as  unsigned  16-bit
+       numbers.  This results in a maximum database size of 2^48.
+       The minimum database page size is 512 bytes, resulting  in
+       a minimum maximum database size of 2^41.
+
+       DB  is potentially further limited if the host system does
+       not have filesystem support for files  larger  than  2^32,
+       including seeking to absolute offsets within such files.
+
+       The maximum btree depth is 255.
+
+
+
+

BYTE ORDERING

+       The  database files created by DB can be created in either
+       little or big-endian  formats.   By  default,  the  native
+       format  of  the  machine  on which the database is created
+       will be used.  Any  format  database  can  be  used  on  a
+       machine  with  a  different  native format, although it is
+       possible that the application  will  incur  a  performance
+       penalty for the run-time conversion.
+
+
+
+

EXTENDING DB

+       DB   includes   tools   to  simplify  the  development  of
+       application-specific logging and recovery.   Specifically,
+       given a description of the information to be logged, these
+       tools  will   automatically   create   logging   functions
+       (functions   that   take  the  values  as  parameters  and
+       construct a single record that is  written  to  the  log),
+       read  functions  (functions  that  read  a  log record and
+       unmarshall the values into a structure that maps onto  the
+       values   you   chose   to  log),  a  print  function  (for
+       debugging), templates  for  the  recovery  functions,  and
+       automatic dispatching to your recovery functions.
+
+
+
+

EXAMPLES

+       There  are  a  number  of  examples  included  with the DB
+       library distribution, intended to demonstrate various ways
+       of using the DB library.
+
+       Some  applications  require  the use of formatted files to
+       store data, but do not require concurrent access  and  can
+       cope  with  the  loss of data due to catastrophic failure.
+       Generally, these applications create short-lived databases
+       that  are  discarded  or  recreated when the system fails.
+       Such applications need only use  the  DB  access  methods.
+       The  DB access methods will use the memory pool subsystem,
+       but the application is unlikely to do so explicitly.   See
+       the   files   examples/ex_access.c,   examples/ex_btrec.c,
+       examples_cxx/AccessExample.cpp                         and
+       java/src/com/sleepycat/examples/AccessExample.java  in the
+       DB source distribution for C, C++, and Java language  code
+       examples  of  how  such  applications  might  use  the  DB
+       library.
+
+       Some applications require the use formatted files to store
+       data,    but    also    need    to    use    db_appinit(3)
+       (DbEnv::appinit(3)) for environment  initialization.   See
+       the              files              examples/ex_appinit.c,
+       examples_cxx/AppinitExample.cpp                         or
+       java/src/com/sleepycat/examples/AppinitExample.java in the
+       DB source distribution for C, C++ and Java  language  code
+       examples  of  how  such  an  application  might use the DB
+       library.
+
+       Some applications use the DB access methods, but are  also
+       concerned  about  catastrophic failure, and therefore need
+       to transaction protect the underlying DB files.   See  the
+       files  examples/ex_tpcb.c, examples_cxx/TpcbExample.cpp or
+       java/src/com/sleepycat/examples/TpcbExample.java in the DB
+       source  distribution  for  C,  C++  and Java language code
+       examples of how such  an  application  might  use  the  DB
+       library.
+
+       Some  applications will benefit from the ability to buffer
+       input files other than the  underlying  DB  access  method
+       files.     See    the    files    examples/ex_mpool.c   or
+       examples_cxx/MpoolExample.cpp    in    the    DB    source
+       distribution  for  C and C++ language code examples of how
+       such an application might use the DB library.
+
+       Some applications  need  a  general-purpose  lock  manager
+       separate  from  locking support for the DB access methods.
+       See         the         files          examples/ex_lock.c,
+       examples_cxx/LockExample.cpp                            or
+       java/src/com/sleepycat/examples/LockExample.java in the DB
+       source  distribution  for  C,  C++  and Java language code
+       examples of how such  an  application  might  use  the  DB
+       library.
+
+       Some  applications  will  use  the  DB access methods in a
+       threaded  fashion,  including  trickle  flushing  of   the
+       underlying  buffer  pool  and deadlock detection.  See the
+       file examples/ex_thread.c in the  DB  source  distribution
+       for  a  C language code example of how such an application
+       might use the DB library.  Note that the Java API  assumes
+       a  threaded  environment  and performs all thread-specific
+       initialization automatically.
+
+
+
+

COMPATIBILITY

+       The DB 2.0 library provides backward compatible interfaces
+       for  the  historic  UNIX  dbm(3),  ndbm(3)  and hsearch(3)
+       interfaces.  See db_dbm(3) and db_hsearch(3)  for  further
+       information  on  these  interfaces.   It  also  provides a
+       backward compatible interface for  the  historic  DB  1.85
+       release.   DB  2.0 does not provide database compatibility
+       for any of the above interfaces,  and  existing  databases
+       must be converted manually.  To convert existing databases
+       from the DB 1.85 format to the DB 2.0 format,  review  the
+       db_dump185(1) and db_load(1) manual pages.
+
+       The  name  space  in  DB 2.0 has been changed from that of
+       previous  DB   versions,   notably   version   1.85,   for
+       portability   and  consistency  reasons.   The  only  name
+       collisions in the two libraries are the names used by  the
+       dbm(3),  ndbm(3), hsearch(3) and the DB 1.85 compatibility
+       interfaces.  To include both DB  1.85  and  DB  2.0  in  a
+       single  library, remove the dbm(3), ndbm(3) and hsearch(3)
+       interfaces from either of the two libraries,  and  the  DB
+       1.85  compatibility  interface  from  the  DB 2.0 library.
+       This can be done by  editing  the  library  Makefiles  and
+       reconfiguring   and   rebuilding   the   DB  2.0  library.
+       Obviously, if you use the historic  interfaces,  you  will
+       get  the  version  in  the  library from which you did not
+       remove it.  Similarly, you will not be able to  access  DB
+       2.0 files using the DB 1.85 compatibility interface, since
+       you have removed that from the library as well.
+
+       It is possible to simply relink  applications  written  to
+       the   DB  1.85  interface  against  the  DB  2.0  library.
+       Recompilation  of  such  applications  is  slightly   more
+       complex.   When  the  DB  2.0  library  is  installed,  it
+       installs two include files, db.h and db_185.h.  The former
+       file  is  likely  to replace the DB 1.85 version's include
+       file which had the same name.  If  this  did  not  happen,
+       recompiling DB 1.85 applications to use the DB 2.0 library
+       is  simple:  recompile  as  done  historically,  and  load
+       against the DB 2.0 library instead of the DB 1.85 library.
+       If, however, the DB 2.0 installation process has  replaced
+       the  system's db.h include file, replace the application's
+       include of db.h with inclusion of db_185.h,  recompile  as
+       done  historically,  and  then  load  against  the  DB 2.0
+       library.
+
+       Applications written using the historic interfaces of  the
+       DB  library  should not require significant effort to port
+       to the DB 2.0 interfaces.   While  the  functionality  has
+       been  greatly  enhanced  in DB 2.0, the historic interface
+       and functionality and is largely unchanged.  Reviewing the
+       application's calls into the DB library and updating those
+       calls to the new names, flags and return values should  be
+       sufficient.
+
+       While loading applications that use the DB 1.85 interfaces
+       against the DB 2.0 library, or converting DB 1.85 function
+       calls  to  DB  2.0 function calls will work, reconsidering
+       your application's interface to the DB database library in
+       light  of  the  additional  functionality  in  DB  2.0  is
+       recommended,  as  it  is  likely  to  result  in  enhanced
+       application performance.
+
+
+
+

SEE ALSO: ADMINISTRATIVE AND OTHER UTILITIES

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1)
+
+
+
+

SEE ALSO: C API

+       db_appinit(3), db_cursor(3), db_dbm(3), db_lock(3), db_log(3),
+       db_mpool(3), db_open(3), db_txn(3)
+
+
+
+

SEE ALSO: C++ and Java API

+       Db(3), Dbc(3), DbEnv(3), DbException(3), DbInfo(3), DbLock(3),
+       DbLockTab(3), DbLog(3), DbLsn(3), DbMpool(3), DbMpoolFile(3),
+       Dbt(3), DbTxn(3), DbTxnMgr(3)
+
+
+
+

SEE ALSO: ADDITIONAL REFERENCES

+       LIBTP: Portable, Modular Transactions for UNIX, Margo Seltzer,
+       Michael Olson, USENIX proceedings, Winter 1992.
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/db_load.html b/mozilla/db/man/man.html/db_load.html new file mode 100644 index 00000000000..aa1738931dd --- /dev/null +++ b/mozilla/db/man/man.html/db_load.html @@ -0,0 +1,201 @@ + + +db_load + + +

db_load

+
+
+
+       db_load [-nT] [-c name=value]
+            [-f file] [-h home] [-t btree | hash | recno] db_file
+
+
+
+

DESCRIPTION

+       The db_load utility reads  from  the  standard  input  and
+       loads  it into the database db_file.  The database db_file
+       is created if it does not already exist.
+
+       The  input  to  db_load  must  be  in  the  output  format
+       specified  by  the  db_dump  or  db_dump185 utilities (see
+       db_dump(1) for more information), or as specified for  the
+       -T option below.
+
+       The options are as follows:
+
+       -c   Specify   configuration   options   for  the  DB_INFO
+            structure provided to db_open(3), ignoring any  value
+            they  may  have based on the input.  The command-line
+            format is  ``name=value''.   Supported  keywords  are
+            listed below.
+
+       -f   Read  from  the  specified input file instead of from
+            the standard input.
+
+       -h   Specify a home directory for the database.
+
+            If  a  home  directory  is  specified,  the  database
+            environment   is   opened   using  the  DB_INIT_LOCK,
+            DB_INIT_LOG,    DB_INIT_MPOOL,    DB_INIT_TXN     and
+            DB_USE_ENVIRON  flags  to db_appinit(3).  (This means
+            that db_load can be used to load data into  databases
+            while  they  are  in use by other processes.)  If the
+            db_appinit call fails, or if  no  home  directory  is
+            specified,  the  database  is  still updated, but the
+            environment is ignored, e.g., no locking is done.
+
+       -n   Do not overwrite existing keys in the  database  when
+            loading  into  an  already  existing  database.  If a
+            key/data pair cannot be loaded into the database  for
+            this  reason,  a  warning message is displayed on the
+            standard error  output  and  the  key/data  pair  are
+            skipped.
+
+       -T   The  -T  option  allows non-DB applications to easily
+            load text files into databases.
+
+            If the database to be created is  of  type  btree  or
+            hash,  the  input must be paired lines of text, where
+            the first line of the pair is the key item,  and  the
+            second  line  of  the  pair is its corresponding data
+            item.  If the database  to  be  created  is  of  type
+            recno,  the  input  must be lines of text, where each
+            line is a new data item for the database.
+
+            A  simple  escape  mechanism,   where   newline   and
+            backslash  (``\'') characters are special, is applied
+            to  the   text   input.    Newline   characters   are
+            interpreted    as   record   separators.    Backslash
+            characters in the text will be interpreted in one  of
+            two ways: if the backslash character precedes another
+            backslash character, the pair will be interpreted  as
+            a  literal  backslash.   If  the  backslash character
+            precedes any  other  character,  the  two  characters
+            following   the  backslash  will  be  interpreted  as
+            hexadecimal  specification  of  a  single  character,
+            e.g.,  ``\0a''  is  a  newline character in the ASCII
+            character set.
+
+            For this reason, any backslash or newline  characters
+            that  naturally  occur  in  the  text  input  must be
+            escaped to avoid misinterpretation by db_load.
+
+            If the -T option is specified, the underlying  access
+            method type must be specified using the -t option.
+
+       -t   Specify  the  underlying  access  method.   If  no -t
+            option is specified, the database will be loaded into
+            a  database  of  the same type as was dumped, e.g., a
+            hash database will be created if a hash database  was
+            dumped.
+
+            Btree and hash databases may be converted from one to
+            the other.  Recno databases may not be  converted  to
+            any  other  database  type or from any other database
+            type.
+
+       The db_load utility exits 0 on success, 1 if one  or  more
+       key/data  pairs  were not loaded into the database because
+       the key already existed, and >1 if an error occurs.
+
+
+
+

KEYWORDS

+       The following keywords are supported for the  -c  command-
+       line  option.   See  db_open(3)  for further discussion of
+       these keywords and what values should be specified.
+
+       The parenthetical listing specifies how the value part  of
+       the  ``name=value''  pair is interpreted.  Items listed as
+       (boolean) expect value to be ``1'' (set) or ``0'' (unset).
+       Items listed as (number) convert value to a number.  Items
+       listed as (string) use the characters of value directly.
+
+       bt_minkey (number)
+            The minimum number of keys per page.
+
+       db_lorder (number)
+            The byte order for integers in  the  stored  database
+            metadata.
+
+       db_pagesize (number)
+            The  size  of  pages  used  for nodes in the tree, in
+            bytes.
+
+       duplicates (boolean)
+            The value of the DB_DUP flag.
+
+       h_ffactor (number)
+            The density within the hash table.
+
+       h_nelem (number)
+            The size of the hash table.
+
+       re_len (number)
+            Specify fixed-length records of the specified length.
+
+       re_pad (string)
+            Specify the fixed-length record pad character.
+
+       recnum (boolean)
+            The value of the DB_RECNUM flag.
+
+       renumber (boolean)
+            The value of the DB_RENUMBER flag.
+
+
+
+

EXAMPLES

+       The  db_load  utility  can be used to load text files into
+       databases.  For example, the following command  loads  the
+       standard  UNIX  /etc/passwd file into a database, with the
+       login name as the key item and the entire  password  entry
+       as the data item:
+              awk -F: '{print $1; print $0}' < /etc/passwd |
+                  sed 's/\\/\\\\/g' | db_load -T -t hash passwd.db
+
+       Note  that backslash characters naturally occurring in the
+       text  are  escaped  to  avoid  interpretation  as   escape
+       characters by db_load.
+
+
+
+

ENVIRONMENT VARIABLES

+       The  following  environment variables affect the execution
+       of db_load:
+
+       DB_HOME
+            If the -h option is not specified and the environment
+            variable  DB_HOME  is  set, it is used as the path of
+            the database home, as described in db_appinit(3).
+
+
+
+

SEE ALSO

+       The DB library is a family of  groups  of  functions  that
+       provides  a  modular programming interface to transactions
+       and record-oriented file  access.   The  library  includes
+       support  for  transactions, locking, logging and file page
+       caching, as well as various indexed access methods.   Many
+       of  the  functional  groups  (e.g.,  the file page caching
+       functions)  are  useful  independent  of  the   other   DB
+       functions,  although some functional groups are explicitly
+       based on other functional groups (e.g.,  transactions  and
+       logging).   For  a  general description of the DB package,
+       see db_intro(3).
+
+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_appinit(3), db_cursor(3), db_dbm(3), db_internal(3),
+       db_lock(3), db_log(3), db_mpool(3), db_open(3), db_thread(3),
+       db_txn(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/db_lock.html b/mozilla/db/man/man.html/db_lock.html new file mode 100644 index 00000000000..0cf5fe42ab3 --- /dev/null +++ b/mozilla/db/man/man.html/db_lock.html @@ -0,0 +1,642 @@ + + +db_lock + + +

db_lock

+
+
+
+       #include <db.h>
+
+       int
+       lock_open(const char *dir,
+            u_int32_t flags, int mode, DB_ENV *dbenv, DB_LOCKTAB **regionp);
+
+       int
+       lock_id(DB_LOCKTAB *lt, u_int32_t *idp);
+
+       int
+       lock_vec(DB_LOCKTAB *lt, u_int32_t locker, u_int32_t flags,
+            DB_LOCKREQ list[], int nlist, DB_LOCKREQ **elistp);
+
+       int
+       lock_get(DB_LOCKTAB *lt, u_int32_t locker, u_int32_t flags,
+            const DBT *obj, const db_lockmode_t lock_mode, DB_LOCK *lock);
+
+       int
+       lock_put(DB_LOCKTAB *lt, DB_LOCK lock);
+
+       int
+       lock_close(DB_LOCKTAB *lt);
+
+       int
+       lock_unlink(const char *dir, int force, DB_ENV *dbenv);
+
+       int
+       lock_detect(DB_LOCKTAB *lt, u_int32_t flags, u_int32_t atype);
+
+       int
+       lock_stat(DB_LOCKTAB *lt,
+            DB_LOCK_STAT **spp, void *(*db_malloc)(size_t));
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a family of groups of functions that
+       provides a modular programming interface  to  transactions
+       and  record-oriented  file  access.   The library includes
+       support for transactions, locking, logging and  file  page
+       caching,  as well as various indexed access methods.  Many
+       of the functional groups  (e.g.,  the  file  page  caching
+       functions)   are   useful  independent  of  the  other  DB
+       functions, although some functional groups are  explicitly
+       based  on  other functional groups (e.g., transactions and
+       logging).  For a general description of  the  DB  package,
+       see db_intro(3).
+
+       This  manual  page  describes  the specific details of the
+       locking interface.
+
+       The db_lock functions are the library  interface  intended
+       to  provide  general-purpose  locking.   While designed to
+       work with the other DB functions, these functions are also
+       useful  for  more  general locking purposes.  Locks can be
+       shared between processes.  In most  cases,  when  multiple
+       threads  or  processes  are  using  locking,  the deadlock
+       detector, db_deadlock(1), should be run.
+
+  lock_open
+       The lock_open function copies a pointer, to the lock table
+       identified  by the directory dir, into the memory location
+       referenced by regionp.
+
+       If the dbenv argument to lock_open was  initialized  using
+       db_appinit,   dir   is   interpreted   as   described   by
+       db_appinit(3).
+
+       Otherwise, if dir is not NULL, it is interpreted  relative
+       to  the  current working directory of the process.  If dir
+       is NULL, the following environment variables  are  checked
+       in  order:  ``TMPDIR'',  ``TEMP'', and ``TMP''.  If one of
+       them is set, lock table files are created relative to  the
+       directory  it  specifies.   If  none  of them are set, the
+       first possible one of the following directories  is  used:
+       /var/tmp, /usr/tmp, /temp, /tmp, C:/temp and C:/tmp.
+
+       All  files  associated  with the lock table are created in
+       this directory.  This directory must already exist when
+
+       lock table_open is called.   If  the  lock  table  already
+       exists, the process must have permission to read and write
+       the existing files.  If the lock table  does  not  already
+       exist, it is optionally created and initialized.
+
+       The  flags  and  mode  arguments specify how files will be
+       opened and/or created when they don't already exist.   The
+       flags value is specified by or'ing together one or more of
+       the following values:
+
+       DB_CREATE
+            Create any underlying files, as  necessary.   If  the
+            files  do not already exist and the DB_CREATE flag is
+            not specified, the call will fail.
+
+       DB_THREAD
+            Cause the DB_LOCKTAB handle returned by the lock_open
+            function  to  be useable by multiple threads within a
+            single address space, i.e., to be  ``free-threaded''.
+
+       All  files  created by the lock subsystem are created with
+       mode mode (as described in chmod(2)) and modified  by  the
+       process'   umask  value  at  the  time  of  creation  (see
+       umask(2)).  The group ownership of created files is  based
+       on  the  system and directory defaults, and is not further
+       specified by DB.
+
+       The locking subsystem is configured  based  on  the  dbenv
+       argument  to  lock_open, which is a pointer to a structure
+       of type DB_ENV (typedef'd in <db.h>).   Applications  will
+       normally  use  the  same  DB_ENV structure (initialized by
+       db_appinit(3)), as an argument to all of the subsystems in
+       the DB package.
+
+       References  to  the DB_ENV structure are maintained by DB,
+       so it may not be discarded until the last close  function,
+       corresponding  to  an  open  function  for which it was an
+       argument, has returned.  In order to ensure  compatibility
+       with  future  releases  of  DB,  all  fields of the DB_ENV
+       structure  that  are  not   explicitly   set   should   be
+       initialized  to  0  before the first time the structure is
+       used.  Do this by  declaring  the  structure  external  or
+       static,  or  by  calling the C library routine bzero(3) or
+       memset(3).
+
+       The fields of the DB_ENV structure used by  lock_open  are
+       described  below.   If  dbenv is NULL or any of its fields
+       are set to 0, defaults appropriate for the system are used
+       where possible.
+
+       The  following  fields  in  the  DB_ENV  structure  may be
+       initialized before calling lock_open:
+
+       void *(*db_errcall)(char *db_errpfx, char *buffer);
+       FILE *db_errfile;
+       const char *db_errpfx;
+       int db_verbose;
+            The error fields of the DB_ENV  behave  as  described
+            for db_appinit(3).
+
+       const u_int8_t lk_conflicts[][];
+            A  lk_modes by lk_modes array.  A non-0 value for the
+            array element:
+
+                 lk_conflicts[requested_mode][held_mode]
+
+            indicates that requested_mode and held_mode conflict.
+            The  ``not-granted''  mode  must be represented by 0.
+            If  lk_conflicts  is  NULL,   the   conflicts   array
+            db_rw_conflicts   is  used;  see  the  section  below
+            entitled ``STANDARD LOCK MODES'' for a description of
+            that array.
+
+       db_detect_t lk_detect;
+            If non-0, specifies that the deadlock detector be run
+            whenever a lock conflict occurs, and specifies  which
+            transaction  should  be  aborted  in  the  case  of a
+            deadlock.  The lk_detect field must be set to one  of
+            the following values.
+
+            DB_LOCK_DEFAULT
+                 Use  the  default  policy  as  specified  in the
+                 db_deadlock(1) man page.
+
+            DB_LOCK_OLDEST
+                 Abort the oldest transaction.
+
+            DB_LOCK_RANDOM
+                 Abort  a  random  transaction  involved  in  the
+                 deadlock.
+
+            DB_LOCK_YOUNGEST
+                 Abort the youngest transaction.
+
+       u_int32_t lk_max;
+            The  maximum  number of locks to be held or requested
+            in the table.  This value is  used  by  lock_open  to
+            estimate how much space to allocate for various lock-
+            table data structures.  If lk_max  is  0,  a  default
+            value is used.
+
+       u_int32_t lk_modes;
+            The number of lock modes to be recognized by the lock
+            table  (including  the  ``not-granted''  mode).    If
+            lk_modes  is  0,  the value DB_LOCK_RW_N is used; see
+            below for a description of that value.
+
+       The lock_open function  returns  the  value  of  errno  on
+       failure and 0 on success.
+
+  lock_id
+       The   lock_id  function  copies  a  locker  ID,  which  is
+       guaranteed to be unique in the specified lock table,  into
+       the memory location referenced by idp.
+
+       The  access  methods  (see  db_open(3)), generate a unique
+       locker ID for each  file  that  is  opened  with  locking.
+       During  DB access method operation, this locker ID will be
+       used for all lock calls unless  a  transaction  identifier
+       was  specified for the call, in which case the transaction
+       ID specified is used for locking.
+
+       The lock_id function returns the value of errno on failure
+       and 0 on success.
+
+  lock_vec
+       The  lock_vec function atomically obtains and releases one
+       or more locks from the specified table, lt.  The  lock_vec
+       function  is intended to support acquisition or trading of
+       multiple locks under  one  lock  table  semaphore,  as  is
+       needed  for  lock  coupling or in multigranularity locking
+       for lock escalation.
+
+       The locker argument specified to lock_vec is  an  unsigned
+       32-bit   integer   quantity.   It  represents  the  entity
+       requesting or releasing the lock.
+
+       The flags value must be set to 0 or the following value:
+
+       DB_LOCK_NOWAIT
+            If a lock cannot be  granted  because  the  requested
+            lock   conflicts   with   an  existing  lock,  return
+            immediately instead of waiting for the lock to become
+            available.
+
+       The list array provided to lock_vec is typedef'd in <db.h>
+       as DB_LOCKREQ.  A DB_LOCKREQ structure has  at  least  the
+       following fields, which must be initialized before calling
+       lock_vec:
+
+       lockop_t op;
+            The operation to be performed, which must be  set  to
+            one of the following values:
+
+            DB_LOCK_GET
+                 Get  a lock, as defined by the values of locker,
+                 obj and mode.  Upon return from lock_vec, if the
+                 lock  field  is  non-NULL,  a  reference  to the
+                 acquired lock is stored there.  (This  reference
+                 is  invalidated  by  any  call  to  lock_vec  or
+                 lock_put that releases the lock.)
+
+            DB_LOCK_PUT
+                 The lock referenced by the contents of the  lock
+                 field is released.
+
+            DB_LOCK_PUT_ALL
+                 All locks held by the locker are released.  (Any
+                 locks acquired as a part of the current call  to
+                 lock_vec  that  appear after the DB_LOCK_PUT_ALL
+                 entry are not considered for this operation).
+
+            DB_LOCK_PUT_OBJ
+                 All locks held by the locker, on the object obj,
+                 with   the  mode  specified  by  lock_mode,  are
+                 released.  A lock_mode of  DB_LOCK_NG  indicates
+                 that all locks on the object should be released.
+                 Note that any locks acquired as a  part  of  the
+                 current  call  to lock_vec that occur before the
+                 DB_LOCK_PUT_OBJ will  also  be  released;  those
+                 acquired afterwards will not be released.
+
+       const DBT obj;
+            An  untyped  byte string that specifies the object to
+            be locked or released.
+
+       const lockmode_t mode;
+            The lock mode, used as an index  into  lt's  conflict
+            array.
+
+       DB_LOCK lock;
+            A lock reference.
+
+       The nlist argument specifies the number of elements in the
+       list array.
+
+       If any of the requested locks cannot be acquired,  or  any
+       of  the  locks  to  be  released  cannot  be released, the
+       operations before the failing operation are guaranteed  to
+       have  completed  successfully, and lock_vec returns a non-
+       zero value.  In addition, if elistp is not NULL, it is set
+       to  point to the DB_LOCKREQ entry that was being processed
+       when the error occurred.
+
+       In the case of an error, lock_vec may return  one  of  the
+       following values:
+
+       DB_LOCK_DEADLOCK
+            The  specified  locker  was  selected  as a victim in
+            order to resolve a deadlock.
+
+       DB_LOCK_NOTHELD
+            The lock cannot be released, as it was  not  held  by
+            the locker.
+
+       DB_LOCK_NOTGRANTED
+            A  lock  was  requested that could not be granted and
+            the flag parameter was  set  to  DB_LOCK_NOWAIT.   In
+            this case, if non-NULL, elistp identifies the request
+            that was granted.
+
+       Otherwise, the lock_vec  function  returns  the  value  of
+       errno on failure and 0 on success.
+
+  lock_get
+       The  lock_get  function  is  a  simple  interface  to  the
+       lock_vec functionality, and is equivalent to  calling  the
+       lock_vec function with the lt and locker arguments, elistp
+       and conflict arguments, and a single element  list  array,
+       for  which  the  op  field  is  DB_LOCK_GET,  and the obj,
+       lock_mode and lock fields are represented by the arguments
+       of  the same name.  Note that the type of the obj argument
+       to lock_get is different from the obj element found in the
+       DB_LOCKREQ   structure.   The  lock_get  function  returns
+       success  and  failure  as  described  for   the   lock_vec
+       function.
+
+  lock_put
+       The  lock_put  function  is  a  simple  interface  to  the
+       lock_vec functionality, and is equivalent to  calling  the
+       lock_vec  function  with  a single element list array, for
+       which the op field is DB_LOCK_PUT and the  lock  field  is
+       represented  by  the  argument  of  the  same  name.   The
+       lock_put function returns success and failure as described
+       for the lock_vec function.
+
+  lock_close
+       The  lock_close function disassociates the calling process
+       from the lock table lt.  Note  that  lock_close  does  not
+       release  any  locks  still  held  by  the closing process.
+       (This  provides  functionality  for   long-lived   locks.)
+       Processes  that  wish to have all their locks released can
+       do so by issuing the appropriate lock_vec call.
+
+       In addition, if the dir argument to lock_open was NULL and
+       dbenv  was  not  initialized  using  db_appinit, all files
+       created for this shared region  will  be  removed,  as  if
+       lock_unlink were called.
+
+       When  multiple  threads  are  using  the DB_LOCKTAB handle
+       concurrently, only a single thread may call the lock_close
+       function.
+
+       The  lock_close  function  returns  the  value of errno on
+       failure and 0 on success.
+
+  lock_unlink
+       The  lock_unlink  function   destroys   the   lock   table
+       identified  by  the directory dir, removing all files used
+       to implement the lock table.  (The directory  dir  is  not
+       removed.)    If  there  are  processes  that  have  called
+       lock_open without  calling  lock_close  (i.e.,  there  are
+       processes  currently  using  the  lock table), lock_unlink
+       will fail without further action, unless the force flag is
+       set,  in which case lock_unlink will attempt to remove the
+       lock table files regardless of any processes  still  using
+       the lock table.
+
+       The  result  of  attempting to forcibly destroy the region
+       when  a  process  has  the  region  open  is  unspecified.
+       Processes  using  a  shared memory region maintain an open
+       file descriptor for  it.   On  UNIX  systems,  the  region
+       removal  should  succeed  and  processes that have already
+       joined the region should continue to  run  in  the  region
+       without  change,  however processes attempting to join the
+       lock table will either fail or attempt  to  create  a  new
+       region.   On other systems, e.g., WNT, where the unlink(2)
+       system call will fail if any  process  has  an  open  file
+       descriptor for the file, the region removal will fail.
+
+       In  the  case  of catastrophic or system failure, database
+       recovery must  be  performed  (see  db_recover(1)  or  the
+       DB_RECOVER  and  DB_RECOVER_FATAL flags to db_appinit(3)).
+       Alternatively, if recovery  is  not  required  because  no
+       database  state  is  maintained  across  failures,  it  is
+       possible to clean up a lock table by removing all  of  the
+       files   in   the  directory  specified  to  the  lock_open
+       function, as lock table files are  never  created  in  any
+       directory  other  than  the  one  specified  to lock_open.
+       Note, however, that this has the potential to remove files
+       created  by  the  other  DB  subsystems  in  this database
+       environment.
+
+       The lock_unlink function returns the  value  of  errno  on
+       failure and 0 on success.
+
+  lock_detect
+       The   lock_detect  function  runs  one  iteration  of  the
+       deadlock  detector  on  the  specified  table,  lt.    The
+       deadlock   detector  traverses  the  lock  table,  detects
+       deadlocks,  and  if  it  finds  one,  marks  one  of   the
+       participating transactions for abort and then returns.
+
+       The  flags  value  is  specified by or'ing together one or
+       more of the following values:
+
+       DB_LOCK_CONFLICT
+            Only run the deadlock detector if a lock conflict has
+            occurred  since  the  last  time  that  the  deadlock
+            detector was run.
+
+       The atype parameter specifies which transaction  to  abort
+       in  the case of deadlock.  It must be set to one of values
+       described above for the  lk_detect  field  of  the  DB_ENV
+       structure.
+
+       The  lock_detect  function  returns  the value of errno on
+       failure and 0 on success.
+
+       The lock_detect function is the underlying  function  used
+       by  the  db_deadlock(1)  utility.  See the source code for
+       the  db_deadlock  utility  for   an   example   of   using
+       lock_detect in a UNIX environment.
+
+  lock_stat
+       The lock_stat function creates a statistical structure and
+       copies a pointer to  it  into  the  user-specified  memory
+       location.
+
+       Statistical structure are created in allocated memory.  If
+       db_malloc is  non-NULL,  it  is  called  to  allocate  the
+       memory, otherwise, the library function malloc(3) is used.
+       The function db_malloc must match the calling  conventions
+       of  the malloc(3) library routine.  Regardless, the caller
+       is responsible for deallocating the returned  memory.   To
+       deallocate  the returned memory, free each returned memory
+       pointer; pointers inside the memory  do  not  need  to  be
+       individually freed.
+       The  lock  region  statistics are stored in a structure of
+       type DB_LOCK_STAT (typedef'd in  <db.h>).   The  following
+       DB_LOCK_STAT fields will be filled in:
+
+       u_int32_t st_magic;
+            The  magic  number  that  identifies a file as a lock
+            file.
+       u_int32_t st_version;
+            The version of the lock file type.
+       u_int32_t st_refcnt;
+            The number of references to the region.
+       u_int32_t st_regsize;
+            The size of the region.
+       u_int32_t st_maxlocks;
+            The maximum number of locks possible.
+       u_int32_t st_nmodes;
+            The number of lock modes.
+       u_int32_t st_numobjs;
+            The number of unique objects locked.
+       u_int32_t st_nlockers;
+            The number of unique lockers.
+       u_int32_t st_nconflicts;
+            The total number of locks not  immediately  available
+            due to conflicts.
+       u_int32_t st_nrequests;
+            The total number of locks requested.
+       u_int32_t st_nreleases;
+            The total number of locks released.
+       u_int32_t st_ndeadlocks
+            The number of deadlocks detected.
+       u_int32_t st_region_wait;
+            The  number  of  times  that  a thread of control was
+            forced to wait before obtaining the region lock.
+       u_int32_t st_region_nowait;
+            The number of times that a thread of control was able
+            to obtain the region lock without waiting.
+
+
+
+

ENVIRONMENT VARIABLES

+       The  following  environment variables affect the execution
+       of db_lock:
+
+       DB_HOME
+            If the dbenv argument to  lock_open  was  initialized
+            using  db_appinit,  the  environment variable DB_HOME
+            may be used as the path of the database home for  the
+            interpretation  of  the dir argument to lock_open, as
+            described in db_appinit(3).
+
+       TMPDIR
+            If the dbenv argument to lock_open was  NULL  or  not
+            initialized   using   db_appinit,   the   environment
+            variable TMPDIR may be used as the directory in which
+            to  create  the  lock  table,  as  described  in  the
+            lock_open section above.
+
+
+
+

STANDARD LOCK MODES

+       The  include  file  <db.h>  declares  two  commonly   used
+       conflict arrays:
+
+       const u_int8_t db_lock_rw_conflicts[];
+            This  is  a  conflict array for a simple scheme using
+            shared and exclusive lock modes.
+
+       const u_int8_t db_lock_riw_conflicts[];
+            This is a conflict array that involves various intent
+            lock  modes  (e.g.,  intent shared) that are used for
+            multigranularity locking.
+
+       Their associated sizes are DB_LOCK_RW_N and DB_LOCK_RIW_N.
+
+       In  addition,  the  include  file  <db.h> defines the type
+       db_lockmode_t, which is the type of the  lock  modes  used
+       with the standard tables above:
+
+              DB_LOCK_NG
+                   not granted (always 0)
+
+              DB_LOCK_READ
+                   read (shared)
+
+              DB_LOCK_WRITE
+                   write (exclusive)
+
+
+
+

ERRORS

+       The  lock_open  function may fail and return errno for any
+       of the errors specified for the following DB  and  library
+       functions: close(2), db_version(3), fcntl(2), fflush(3),
+       lock_unlink(3), lseek(2), malloc(3), memcpy(3), memset(3),
+       mmap(2), munmap(2), open(2), sigfillset(3),
+       sigprocmask(2), stat(2), strcpy(3), strdup(3),
+       strerror(3), strlen(3), unlink(2), and write(2).
+
+       In  addition,  the  lock_open function may fail and return
+       errno for the following conditions:
+
+       [EAGAIN]
+            The shared memory region was locked and  (repeatedly)
+            unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The  DB_THREAD  flag  was specified and spinlocks are
+            not implemented for this architecture.
+
+       The lock_vec function may fail and return errno for any of
+       the  errors  specified  for  the  following DB and library
+       functions: fcntl(2), fflush(3), lock_detect(3), lseek(2),
+       memcpy(3), memset(3), mmap(2), munmap(2), strerror(3), and
+       write(2).
+
+       In addition, the lock_vec function  may  fail  and  return
+       errno for the following conditions:
+
+       [EACCES]
+            An  attempt  was made to release lock held by another
+            locker.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       The lock_get function may fail and return errno for any of
+       the  errors  specified  for  the  following DB and library
+       functions: fcntl(2), fflush(3), lock_detect(3), lseek(2),
+       memcpy(3), memset(3), mmap(2), munmap(2), strerror(3), and
+       write(2).
+
+       In addition, the lock_get function  may  fail  and  return
+       errno for the following conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       The lock_put function may fail and return errno for any of
+       the errors specified for  the  following  DB  and  library
+       functions: fcntl(2), fflush(3), lock_detect(3), lseek(2),
+       memcpy(3), memset(3), mmap(2), munmap(2), strerror(3), and
+       write(2).
+
+       In  addition,  the  lock_put  function may fail and return
+       errno for the following conditions:
+
+       [EACCES]
+            An attempt was made to release lock held  by  another
+            locker.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       The  lock_close function may fail and return errno for any
+       of the errors specified for the following DB  and  library
+       functions: close(2), fcntl(2), fflush(3), munmap(2), and
+       strerror(3).
+
+       The lock_unlink function may fail and return errno for any
+       of  the  errors specified for the following DB and library
+       functions: close(2), fcntl(2), fflush(3), malloc(3),
+       memcpy(3), memset(3), mmap(2), munmap(2), open(2),
+       sigfillset(3), sigprocmask(2), stat(2), strcpy(3),
+       strdup(3), strerror(3), strlen(3), and unlink(2).
+
+       In  addition, the lock_unlink function may fail and return
+       errno for the following conditions:
+
+       [EBUSY]
+            The shared memory region was in  use  and  the  force
+            flag was not set.
+
+       The lock_detect function may fail and return errno for any
+       of the errors specified for the following DB  and  library
+       functions: calloc(3), fcntl(2), fflush(3), lseek(2),
+       malloc(3), memcpy(3), memset(3), mmap(2), munmap(2),
+       strerror(3), and write(2).
+
+
+
+

BUGS

+       If  a process dies while holding locks, those locks remain
+       held and are never released.  In this case, all  processes
+       should exit as quickly as possible, so that db_recover can
+       be run.
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_appinit(3), db_cursor(3), db_dbm(3), db_internal(3),
+       db_lock(3), db_log(3), db_mpool(3), db_open(3), db_thread(3),
+       db_txn(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/db_log.html b/mozilla/db/man/man.html/db_log.html new file mode 100644 index 00000000000..8192d051b9f --- /dev/null +++ b/mozilla/db/man/man.html/db_log.html @@ -0,0 +1,790 @@ + + +db_log + + +

db_log

+
+
+
+       #include <db.h>
+
+       int
+       log_open(const char *dir,
+            u_int32_t flags, int mode, DB_ENV *dbenv, DB_LOG **regionp);
+
+       int
+       log_close(DB_LOG *logp);
+
+       int
+       log_flush(DB_LOG *logp, const DB_LSN *lsn);
+
+       int
+       log_get(DB_LOG *logp, DB_LSN *lsn, DBT *data, u_int32_t flags);
+
+       int
+       log_compare(const DB_LSN *lsn0, const DB_LSN *lsn1);
+
+       int
+       log_file(DB_LOG *logp, const DB_LSN *lsn, char *namep, size_t len);
+
+       int
+       log_put(DB_LOG *logp, DB_LSN *lsn, const DBT *data, u_int32_t flags);
+
+       int
+       log_unlink(const char *dir, int force, DB_ENV *);
+
+       int
+       log_archive(DB_LOG *logp,
+            char **list[], u_int32_t flags, void *(*db_malloc)(size_t));
+
+       int
+       log_register(DB_LOG *logp,
+            const DB *dbp, const char *name, DBTYPE type, u_int32_t *fidp);
+
+       int
+       log_unregister(DB_LOG *logp, u_int32_t fid);
+
+       int
+       log_stat(DB_LOG *logp, DB_LOG_STAT **spp, void *(*db_malloc)(size_t));
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a family of groups of functions that
+       provides a modular programming interface  to  transactions
+       and  record-oriented  file  access.   The library includes
+       support for transactions, locking, logging and  file  page
+       caching,  as well as various indexed access methods.  Many
+       of the functional groups  (e.g.,  the  file  page  caching
+       functions)   are   useful  independent  of  the  other  DB
+       functions, although some functional groups are  explicitly
+       based  on  other functional groups (e.g., transactions and
+       logging).  For a general description of  the  DB  package,
+       see db_intro(3).
+
+       This manual page describes the specific details of the log
+       manager.
+
+       These functions provide a general-purpose logging facility
+       sufficient for transaction management.  Logs can be shared
+       by multiple processes.
+
+       The DB transaction  log  is  represented  by  a  directory
+       containing  a set of files.  The log is a record-oriented,
+       append-only file, with records identified and accessed via
+       DB_LSN's (database log sequence numbers).
+
+       DB_LSN's  are returned on each log_put operation, and only
+       those DB_LSN's returned by log_put can later  be  used  to
+       retrieve records from the log.
+
+  log_open
+       The  log_open  function  copies  a  pointer,  to  the  log
+       identified by the directory dir, into the memory  location
+       referenced by regionp.
+
+       If  the  dbenv  argument to log_open was initialized using
+       db_appinit,   dir   is   interpreted   as   described   by
+       db_appinit(3).
+
+       Otherwise,  if dir is not NULL, it is interpreted relative
+       to the current working directory of the process.   If  dir
+       is  NULL,  the following environment variables are checked
+       in order: ``TMPDIR'', ``TEMP'', and ``TMP''.   If  one  of
+       them  is  set,  log  files  are  created  relative  to the
+       directory it specifies.  If none  of  them  are  set,  the
+       first  possible  one of the following directories is used:
+       /var/tmp, /usr/tmp, /temp, /tmp, C:/temp and C:/tmp.
+
+       All files associated with the  log  are  created  in  this
+       directory.  This directory must already exist when
+
+       log_open  is  called.   If  the  log  already  exists, the
+       process  must  have  permission  to  read  and  write  the
+       existing  files.  If the log does not already exist, it is
+       optionally created and initialized.
+
+       If the log region is  being  created  and  log  files  are
+       already  present,  the  log  files  are  ``recovered'' and
+       subsequent log writes are appended to the end of the  log.
+
+       The  log  is  stored in one or more files in the specified
+       directory.  Each file is named using the format
+
+            log.NNNNN
+
+       where ``NNNNN'' is the sequence number of the file  within
+       the log.
+
+       The  flags  and  mode  arguments specify how files will be
+       opened and/or created when they don't already exist.   The
+       flags value is specified by or'ing together one or more of
+       the following values:
+
+       DB_CREATE
+            Create any underlying files, as  necessary.   If  the
+            files  do not already exist and the DB_CREATE flag is
+            not specified, the call will fail.
+
+       DB_THREAD
+            Cause the DB_LOG  handle  returned  by  the  log_open
+            function  to  be useable by multiple threads within a
+            single address space, i.e., to be  ``free-threaded''.
+
+       All  files  created  by the log subsystem are created with
+       mode mode (as described in chmod(2)) and modified  by  the
+       process'   umask  value  at  the  time  of  creation  (see
+       umask(2)).  The group ownership of created files is  based
+       on  the  system and directory defaults, and is not further
+       specified by DB.
+
+       The logging subsystem is configured  based  on  the  dbenv
+       argument to log_open, which is a pointer to a structure of
+       type DB_ENV  (typedef'd  in  <db.h>).   Applications  will
+       normally  use  the  same  DB_ENV structure (initialized by
+       db_appinit(3)), as an argument to all of the subsystems in
+       the DB package.
+
+       References  to  the DB_ENV structure are maintained by DB,
+       so it may not be discarded until the last close  function,
+       corresponding  to  an  open  function  for which it was an
+       argument, has returned.  In order to ensure  compatibility
+       with  future  releases  of  DB,  all  fields of the DB_ENV
+       structure  that  are  not   explicitly   set   should   be
+       initialized  to  0  before the first time the structure is
+       used.  Do this by  declaring  the  structure  external  or
+       static,  or  by  calling the C library routine bzero(3) or
+       memset(3).
+
+       The fields of the DB_ENV structure used  by  log_open  are
+       described  below.   If  dbenv is NULL or any of its fields
+       are set to 0, defaults appropriate for the system are used
+       where possible.
+
+       The  following  fields  in  the  DB_ENV  structure  may be
+       initialized before calling log_open:
+
+       void *(*db_errcall)(char *db_errpfx, char *buffer);
+       FILE *db_errfile;
+       const char *db_errpfx;
+       int db_verbose;
+            The error fields of the DB_ENV  behave  as  described
+            for db_appinit(3).
+
+       u_int32_t lg_max;
+            The  maximum  size  of  a  single  file  in  the log.
+            Because  DB_LSN  file  offsets  are  unsigned  4-byte
+            values,  lg_max  may  not  be larger than the maximum
+            unsigned 4-byte value.
+
+            If lg_max is 0, a default value is used.
+
+            See the section "LOG FILE LIMITS" below, for  further
+            information.
+
+       The  log_open  function  returns  the  value  of  errno on
+       failure and 0 on success.
+
+  log_close
+       The log_close function closes the  log  specified  by  the
+       logp argument.
+
+       In  addition, if the dir argument to log_open was NULL and
+       dbenv was not  initialized  using  db_appinit,  all  files
+       created  for  this  shared  region  will be removed, as if
+       log_unlink were called.
+
+       When  multiple  threads  are  using  the   DB_LOG   handle
+       concurrently,  only a single thread may call the log_close
+       function.
+
+       The log_close function  returns  the  value  of  errno  on
+       failure and 0 on success.
+
+  log_flush
+       The  log_flush  function  guarantees  that all log records
+       whose LSNs are less than or equal  to  the  lsn  parameter
+       have been written to disk.  If lsn is NULL, all records in
+       the log are flushed.
+
+       The log_flush function  returns  the  value  of  errno  on
+       failure and 0 on success.
+
+  log_get
+       The  log_get  function  implements  a cursor inside of the
+       log, retrieving records from the log according to the  lsn
+       and flags parameters.
+
+       The  data field of the data structure is set to the record
+       retrieved and the size field indicates the number of bytes
+       in  the  record.  See db_dbt(3) for a description of other
+       fields in the data structure.  When multiple  threads  are
+       using  the returned DB_LOG handle concurrently, either the
+       DB_DBT_MALLOC or DB_DBT_USERMEM flags  must  be  specified
+       for any DBT used for data retrieval.
+
+       The  flags  parameter  must  be  set to exactly one of the
+       following values:
+
+       DB_CHECKPOINT
+            The last record written with the  DB_CHECKPOINT  flag
+            specified  to the log_put function is returned in the
+            data argument.  The lsn argument is overwritten  with
+            the  DB_LSN of the record returned.  If no record has
+            been previously written with the  DB_CHECKPOINT  flag
+            specified, the first record in the log is returned.
+
+            If  the log is empty the log_get function will return
+            DB_NOTFOUND.
+
+       DB_FIRST
+            The first record from any of the log files  found  in
+            the  log  directory is returned in the data argument.
+            The lsn argument is overwritten with  the  DB_LSN  of
+            the record returned.
+
+            If  the log is empty the log_get function will return
+            DB_NOTFOUND.
+
+       DB_LAST
+            The last record in the log is returned  in  the  data
+            argument.   The  lsn argument is overwritten with the
+            DB_LSN of the record returned.
+
+            If the log is empty, the log_get function will return
+            DB_NOTFOUND.
+
+       DB_NEXT
+            The  current  log  position  is  advanced to the next
+            record in the log and that record is returned in  the
+            data  argument.  The lsn argument is overwritten with
+            the DB_LSN of the record returned.
+
+            If the pointer has not been initialized via DB_FIRST,
+            DB_LAST,  DB_SET,  DB_NEXT,  or DB_PREV, log_get will
+            return the first record in the log.  If the last  log
+            record has already been returned or the log is empty,
+            the log_get function will return DB_NOTFOUND.
+
+            If the log was opened with the  DB_THREAD  flag  set,
+            calls  to  log_get  with  the  DB_NEXT  flag set will
+            return EINVAL.
+
+       DB_PREV
+            The current log position is  moved  to  the  previous
+            record  in the log and that record is returned in the
+            data argument.  The lsn argument is overwritten  with
+            the DB_LSN of the record returned.
+            If the pointer has not been initialized via DB_FIRST,
+            DB_LAST, DB_SET, DB_NEXT, or  DB_PREV,  log_get  will
+            return  the last record in the log.  If the first log
+            record has already been returned or the log is empty,
+            the log_get function will return DB_NOTFOUND.
+
+            If  the  log  was opened with the DB_THREAD flag set,
+            calls to log_get  with  the  DB_PREV  flag  set  will
+            return EINVAL.
+
+       DB_CURRENT
+            Return  the  log  record  currently referenced by the
+            log.
+
+            If the log  pointer  has  not  been  initialized  via
+            DB_FIRST, DB_LAST, DB_SET, DB_NEXT, or DB_PREV, or if
+            the log was  opened  with  the  DB_THREAD  flag  set,
+            log_get will return EINVAL.
+
+       DB_SET
+            Retrieve  the  record  specified by the lsn argument.
+            If the specified DB_LSN is invalid  (e.g.,  does  not
+            appear in the log) log_get will return EINVAL.
+
+       Otherwise, the log_get function returns the value of errno
+       on failure and 0 on success.
+
+  log_compare
+       The log_compare function allows the caller to compare  two
+       DB_LSN's.   Log_compare  returns 0 if the two DB_LSN's are
+       equal, 1 if lsn0 is greater than lsn1, and -1 if  lsn0  is
+       less than lsn1.
+
+  log_file
+       The  log_file  function  maps DB_LSN's to file names.  The
+       log_file function copies the name of the  file  containing
+       the   record   named  by  lsn  into  the  memory  location
+       referenced by namep.  (This mapping of DB_LSN to  file  is
+       needed   for  database  administration.   For  example,  a
+       transaction manager typically records the earliest  DB_LSN
+       needed  for  restart,  and  the database administrator may
+       want to archive log files to tape when they  contain  only
+       DB_LSN's before the earliest one needed for restart.)
+
+       The  len  argument  is  the  length of the namep buffer in
+       bytes.  If namep is too  short  to  hold  the  file  name,
+       log_file  will  return  ENOMEM.  Note, as described above,
+       log file names  are  quite  short,  on  the  order  of  10
+       characters.
+
+       The  log_file  function  returns  the  value  of  errno on
+       failure and 0 on success.
+
+  log_put
+       The log_put function appends  records  to  the  log.   The
+       DB_LSN of the put record is returned in the lsn parameter.
+       The flags parameter may be set to  one  of  the  following
+       values:
+
+       DB_CHECKPOINT
+            The  log  should write a checkpoint record, recording
+            any information necessary to make the log  structures
+            recoverable after a crash.
+
+       DB_CURLSN
+            The  DB_LSN  of the next record to be put is returned
+            in the lsn parameter.
+
+       DB_FLUSH
+            The log is  forced  to  disk  after  this  record  is
+            written,  guaranteeing  that all records with DB_LSNs
+            less than or equal to the one being put are  on  disk
+            before  this  function returns (this function is most
+            often used for a transaction commit, see  db_txn(3)).
+
+       The  caller  is  responsible  for  providing any necessary
+       structure to data.  (For example, in a write-ahead logging
+       protocol,  the  application  must  understand what part of
+       data is an operation code, what part is redo  information,
+       and  what  part  is  undo  information.  In addition, most
+       transaction managers will store in data the DB_LSN of  the
+       previous  log  record for the same transaction, to support
+       chaining back through the transaction's log records during
+       undo.)
+
+       The log_put function returns the value of errno on failure
+       and 0 on success.
+
+  log_unlink
+       The log_unlink function destroys the log region identified
+       by the directory dir, removing all files used to implement
+       the  log  region.   (The  log  files  themselves  and  the
+       directory  dir  are  not removed.)  If there are processes
+       that have called log_open without calling log_close (i.e.,
+       there  are  processes  currently  using  the  log region),
+       log_unlink will fail without further  action,  unless  the
+       force  flag  is set, in which case log_unlink will attempt
+       to remove the log region files regardless of any processes
+       still using the log region.
+
+       The  result  of  attempting to forcibly destroy the region
+       when  a  process  has  the  region  open  is  unspecified.
+       Processes  using  a  shared memory region maintain an open
+       file descriptor for  it.   On  UNIX  systems,  the  region
+       removal  should  succeed  and  processes that have already
+       joined the region should continue to  run  in  the  region
+       without  change,  however processes attempting to join the
+       log region will either fail or attempt  to  create  a  new
+       region.   On other systems, e.g., WNT, where the unlink(2)
+       system call will fail if any  process  has  an  open  file
+       descriptor for the file, the region removal will fail.
+
+       In  the  case  of catastrophic or system failure, database
+       recovery must  be  performed  (see  db_recover(1)  or  the
+       DB_RECOVER  and  DB_RECOVER_FATAL flags to db_appinit(3)).
+       Alternatively, if recovery  is  not  required  because  no
+       database  state  is  maintained  across  failures,  it  is
+       possible to clean up a log region by removing all  of  the
+       files in the directory specified to the log_open function,
+       as log region files are never  created  in  any  directory
+       other  than the one specified to log_open.  Note, however,
+       that this has the potential to remove files created by the
+       other DB subsystems in this database environment.
+
+       The  log_unlink  function  returns  the  value of errno on
+       failure and 0 on success.
+
+  log_archive
+       The log_archive function creates a  NULL-terminated  array
+       of log or database file names and copies a pointer to them
+       into the user-specified memory location list.
+
+       By default, log_archive returns the names of  all  of  the
+       log  files  that  are  no  longer  in use (e.g., no longer
+       involved in active transactions), and that may be archived
+       for  catastrophic  recovery  and  then  removed  from  the
+       system.  If there were no file names to return, list  will
+       be set to NULL.
+
+       Arrays  of log file names are created in allocated memory.
+       If db_malloc is non-NULL, it is  called  to  allocate  the
+       memory, otherwise, the library function malloc(3) is used.
+       The function db_malloc must match the calling  conventions
+       of  the malloc(3) library routine.  Regardless, the caller
+       is responsible for deallocating the returned  memory.   To
+       deallocate  the returned memory, free each returned memory
+       pointer; pointers inside the memory  do  not  need  to  be
+       individually freed.
+
+       The  flags argument is specified by or'ing together one or
+       more of the following values:
+
+       DB_ARCH_ABS
+            All pathnames are  returned  as  absolute  pathnames,
+            instead of relative to the database home directory.
+
+       DB_ARCH_DATA
+            Return the database files that need to be archived in
+            order  to  recover  the  database  from  catastrophic
+            failure.   If any of the database files have not been
+            accessed during  the  lifetime  of  the  current  log
+            files,  log_archive  will  not  include  them in this
+            list.  It is also possible that  some  of  the  files
+            referenced  in  the  log have since been deleted from
+            the system.
+
+       DB_ARCH_LOG
+            Return all the log file names regardless  of  whether
+            or not they are in use.
+
+       The   DB_ARCH_DATA  and  DB_ARCH_LOG  flags  are  mutually
+       exclusive.
+
+       The log_archive function returns the  value  of  errno  on
+       failure and 0 on success.
+
+       The  log_archive  function is the underlying function used
+       by the db_archive(1) utility.  See the source code for the
+       db_archive  utility for an example of using log_archive in
+       a UNIX environment.  See the db_archive(1) manual page for
+       more information on database archival procedures.
+
+  log_register
+       The  log_register  function registers a file name with the
+       log manager and copies a file identification  number  into
+       the   memory  location  referenced  by  fidp.   This  file
+       identification number should be used in all subsequent log
+       messages  that  refer to operations on this file.  The log
+       manager records  all  file  name  to  file  identification
+       number  mappings  at  each  checkpoint  so that a recovery
+       process can identify the file to which a record in the log
+       refers.
+
+       The  log_register function is called when an access method
+       registers the open of a file.  The dbp parameter should be
+       a  pointer  to the DB structure which is being returned by
+       the access method.
+
+       The type parameter should be one of the DB types specified
+       in db_open(3), e.g., DB_HASH.
+
+       The  log_register  function  returns the value of errno on
+       failure and 0 on success.
+
+  log_unregister
+       The log_unregister function disassociates the file name to
+       file   identification   number   mapping   for   the  file
+       identification number specified by the fid parameter.  The
+       file identification number may then be reused.
+
+       The  log_unregister function returns the value of errno on
+       failure and 0 on success.
+
+  log_stat
+       The log_stat function creates a statistical structure  and
+       copies  a  pointer  to  it  into the user-specified memory
+       location.
+
+       Statistical structure are created in allocated memory.  If
+       db_malloc  is  non-NULL,  it  is  called  to  allocate the
+       memory, otherwise, the library function malloc(3) is used.
+       The  function db_malloc must match the calling conventions
+       of the malloc(3) library routine.  Regardless, the  caller
+       is  responsible  for deallocating the returned memory.  To
+       deallocate the returned memory, free each returned  memory
+       pointer;  pointers  inside  the  memory  do not need to be
+       individually freed.
+
+       The log region statistics are stored  in  a  structure  of
+       type  DB_LOG_STAT  (typedef'd  in  <db.h>).  The following
+       DB_LOG_STAT fields will be filled in:
+
+       u_int32_t st_magic;
+            The magic number that identifies  a  file  as  a  log
+            file.
+       u_int32_t st_version;
+            The version of the log file type.
+       u_int32_t st_refcnt;
+            The number of references to the region.
+       u_int32_t st_regsize;
+            The size of the region.
+       int st_mode;
+            The mode of any created log files.
+       u_int32_t st_lg_max;
+            The  maximum  size  of any individual file comprising
+            the log.
+       u_int32_t st_w_mbytes;
+            The number of megabytes written to this log.
+       u_int32_t st_w_bytes;
+            The  number  of  bytes  over  and  above  st_w_mbytes
+            written to this log.
+       u_int32_t st_wc_mbytes;
+            The number of megabytes written to this log since the
+            last checkpoint.
+       u_int32_t st_wc_bytes;
+            The number  of  bytes  over  and  above  st_wc_mbytes
+            written to this log since the last checkpoint.
+       u_int32_t st_cur_file;
+            The current log file number.
+       u_int32_t st_cur_offset;
+            The byte offset in the current log file.
+       u_int32_t st_region_wait;
+            The  number  of  times  that  a thread of control was
+            forced to wait before obtaining the region lock.
+       u_int32_t st_region_nowait;
+            The number of times that a thread of control was able
+            to obtain the region lock without waiting.
+
+
+
+

LOG FILE LIMITS

+       Log file sizes impose a time limit on the length of time a
+       database may be  accessed  under  transaction  protection,
+       before  it needs to be dumped and reloaded (see db_dump(3)
+       and   db_load(3)).    Unfortunately,   the   limits    are
+       potentially difficult to calculate.
+
+       The log file name consists of "log." followed by 5 digits,
+       resulting in a maximum of 99,999 log files.   Consider  an
+       application performing 600 transactions per second, for 15
+       hours a day,  logged  into  10Mb  log  files,  where  each
+       transaction  is  logging  approximately 100 bytes of data.
+       The calculation:
+
+              (10 * 2^20 * 99999) /
+                   (600 * 60 * 60 * 15 * 100) = 323.63
+
+       indicates that the system will run out of log  file  space
+       in  roughly  324 days.  If we increase the maximum size of
+       the  files  from  10Mb  to  100Mb,  the  same  calculation
+       indicates  that  the  application will run out of log file
+       space in roughly 9 years.
+
+       There is no way to  reset  the  log  file  name  space  in
+       Berkeley  DB.   If your application is reaching the end of
+       its log file name space, you should:
+
+       1.   Archive  your  databases  as  if   to   prepare   for
+            catastrophic  failure  (see  db_archive(1)  for  more
+            information).
+
+       2.   Dump and re-load all your databases  (see  db_dump(1)
+            and db_load(1) for more information).
+
+       3.   Remove  all  of  the  log  files  from  the  database
+            environment (see db_archive(1) for more information).
+
+       4.   Restart your applications.
+
+
+
+

ENVIRONMENT VARIABLES

+       The  following  environment variables affect the execution
+       of db_log:
+
+       DB_HOME
+            If the dbenv argument  to  log_open  was  initialized
+            using  db_appinit,  the  environment variable DB_HOME
+            may be used as the path of the database home for  the
+            interpretation  of  the  dir argument to log_open, as
+            described in db_appinit(3).   Specifically,  log_open
+            is  affected  by  the  configuration  string value of
+            DB_LOG_DIR.
+
+       TMPDIR
+            If the dbenv argument to log_open  was  NULL  or  not
+            initialized   using   db_appinit,   the   environment
+            variable TMPDIR may be used as the directory in which
+            to  create  the  log,  as  described  in the log_open
+            section above.
+
+
+
+

ERRORS

+       The log_open function may fail and return errno for any of
+       the  errors  specified  for  the  following DB and library
+       functions: atoi(3), close(2), db_version(3), fcntl(2),
+       fflush(3), log_close(3), log_unlink(3), lseek(2),
+       malloc(3), memcpy(3), memset(3), mmap(2), munmap(2),
+       open(2), opendir(3), read(2), readdir(3), realloc(3),
+       sigfillset(3), sigprocmask(2), stat(2), strchr(3),
+       strcpy(3), strdup(3), strerror(3), strlen(3), strncmp(3),
+       unlink(2), and write(2).
+
+       In addition, the log_open function  may  fail  and  return
+       errno for the following conditions:
+
+       [EAGAIN]
+            The  shared memory region was locked and (repeatedly)
+            unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The DB_THREAD flag was specified  and  spinlocks  are
+            not implemented for this architecture.
+
+            The specified file size was too large.
+
+       The  log_close  function may fail and return errno for any
+       of the errors specified for the following DB  and  library
+       functions: close(2), fcntl(2), fflush(3), munmap(2), and
+       strerror(3).
+
+       The log_flush function may fail and return errno  for  any
+       of  the  errors specified for the following DB and library
+       functions: close(2), fcntl(2), fflush(3), fsync(2),
+       lseek(2), malloc(3), memcpy(3), memset(3), open(2),
+       sigfillset(3), sigprocmask(2), stat(2), strcpy(3),
+       strdup(3), strerror(3), strlen(3), unlink(2), and
+       write(2).
+
+       In addition, the log_flush function may  fail  and  return
+       errno for the following conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       The  log_get function may fail and return errno for any of
+       the errors specified for  the  following  DB  and  library
+       functions: atoi(3), close(2), fcntl(2), fflush(3),
+       lseek(2), malloc(3), memcpy(3), memset(3), open(2),
+       opendir(3), read(2), readdir(3), realloc(3),
+       sigfillset(3), sigprocmask(2), stat(2), strchr(3),
+       strcpy(3), strdup(3), strerror(3), strlen(3), strncmp(3),
+       and unlink(2).
+
+       In addition, the log_get  function  may  fail  and  return
+       errno for the following conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The DB_FIRST flag was specified and no log files were
+            found.
+
+       The log_file function may fail and return errno for any of
+       the  errors  specified  for  the  following DB and library
+       functions: close(2), fcntl(2), fflush(3), malloc(3),
+       memcpy(3), memset(3), open(2), sigfillset(3),
+       sigprocmask(2), stat(2), strcpy(3), strdup(3),
+       strerror(3), strlen(3), and unlink(2).
+
+       In  addition,  the  log_file  function may fail and return
+       errno for the following conditions:
+
+       [ENOMEM]
+            The supplied buffer was too small  to  hold  the  log
+            file name.
+
+       The  log_put function may fail and return errno for any of
+       the errors specified for  the  following  DB  and  library
+       functions: close(2), fcntl(2), fflush(3), fsync(2),
+       lseek(2), malloc(3), memcpy(3), memset(3), open(2),
+       sigfillset(3), sigprocmask(2), stat(2), strcpy(3),
+       strdup(3), strerror(3), strlen(3), time(3), unlink(2), and
+       write(2).
+
+       In  addition,  the  log_put  function  may fail and return
+       errno for the following conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The record to be logged is larger  than  the  maximum
+            log record.
+
+       The  log_unlink function may fail and return errno for any
+       of the errors specified for the following DB  and  library
+       functions: close(2), fcntl(2), fflush(3), malloc(3),
+       memcpy(3), memset(3), mmap(2), munmap(2), open(2),
+       sigfillset(3), sigprocmask(2), stat(2), strcpy(3),
+       strdup(3), strerror(3), strlen(3), and unlink(2).
+
+       In addition, the log_unlink function may fail  and  return
+       errno for the following conditions:
+       [EBUSY]
+            The  shared  memory  region  was in use and the force
+            flag was not set.
+
+       The log_archive function may fail and return errno for any
+       of  the  errors specified for the following DB and library
+       functions: close(2), fcntl(2), fflush(3), getcwd(3),
+       log_compare(3), log_get(3), malloc(3), memcpy(3),
+       memset(3), open(2), qsort(3), realloc(3), sigfillset(3),
+       sigprocmask(2), stat(2), strchr(3), strcmp(3), strcpy(3),
+       strdup(3), strerror(3), strlen(3), and unlink(2).
+
+       In addition, the log_archive function may fail and  return
+       errno for the following conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The log was corrupted.
+
+       The  log_register  function  may fail and return errno for
+       any of the errors  specified  for  the  following  DB  and
+       library functions: close(2), fcntl(2), fflush(3),
+       fsync(2), lseek(2), malloc(3), memcmp(3), memcpy(3),
+       memset(3), open(2), realloc(3), sigfillset(3),
+       sigprocmask(2), stat(2), strcpy(3), strdup(3),
+       strerror(3),  strlen(3), time(3), unlink(2), and write(2).
+
+       In addition, the log_register function may fail and return
+       errno for the following conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       The  log_unregister function may fail and return errno for
+       any of the errors  specified  for  the  following  DB  and
+       library functions: close(2), fcntl(2), fflush(3),
+       fsync(2), lseek(2), malloc(3), memcpy(3), memset(3),
+       open(2), sigfillset(3), sigprocmask(2), stat(2),
+       strcpy(3), strdup(3), strerror(3), strlen(3), time(3),
+       unlink(2), and write(2).
+
+       In  addition,  the  log_unregister  function  may fail and
+       return errno for the following conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       The log_stat function may fail and return errno for any of
+       the  errors  specified  for  the  following DB and library
+       functions: fcntl(2), and malloc(3).
+
+
+
+

BUGS

+       The log files are not  machine  architecture  independent.
+       Specifically,  log  file metadata is not stored in a fixed
+       byte order.
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_appinit(3), db_cursor(3), db_dbm(3), db_internal(3),
+       db_lock(3), db_log(3), db_mpool(3), db_open(3), db_thread(3),
+       db_txn(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/db_mpool.html b/mozilla/db/man/man.html/db_mpool.html new file mode 100644 index 00000000000..3d2505e0d9f --- /dev/null +++ b/mozilla/db/man/man.html/db_mpool.html @@ -0,0 +1,942 @@ + + +db_mpool + + +

db_mpool

+
+
+
+       #include <db.h>
+
+       int
+       memp_open(char *dir,
+            u_int32_t flags, int mode, DB_ENV *dbenv, DB_MPOOL **regionp);
+
+       int
+       memp_close(DB_MPOOL *mp);
+
+       int
+       memp_fopen(DB_MPOOL *mp, char *file, u_int32_t flags, int mode,
+            size_t pagesize, DB_MPOOL_FINFO *finfop, DB_MPOOLFILE **mpf);
+
+       int
+       memp_fclose(DB_MPOOLFILE *mpf);
+
+       int
+       memp_fget(DB_MPOOLFILE *mpf,
+            db_pgno_t *pgnoaddr, u_int32_t flags, void **pagep);
+
+       int
+       memp_fput(DB_MPOOLFILE *mpf, void *pgaddr, u_int32_t flags);
+
+       int
+       memp_fset(DB_MPOOLFILE *mpf, void *pgaddr, u_int32_t flags);
+
+       int
+       memp_fsync(DB_MPOOLFILE *mpf);
+
+       int
+       memp_unlink(const char *dir, int force, DB_ENV *);
+
+       int
+       memp_register(DB_MPOOL *mp, int ftype,
+            int (*pgin)(db_pgno_t pgno, void *pgaddr, DBT *pgcookie),
+            int (*pgout)(db_pgno_t pgno, void *pgaddr, DBT *pgcookie));
+
+       int
+       memp_trickle(DB_MPOOL *mp, int pct, int *nwrotep);
+
+       int
+       memp_sync(DB_MPOOL *mp, LSN *lsn);
+
+       int
+       memp_stat(DB_MPOOL *mp, DB_MPOOL_STAT **gsp,
+            DB_MPOOL_FSTAT *(*fsp)[], void *(*db_malloc)(size_t));
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a family of groups of functions that
+       provides a modular programming interface  to  transactions
+       and  record-oriented  file  access.   The library includes
+       support for transactions, locking, logging and  file  page
+       caching,  as well as various indexed access methods.  Many
+       of the functional groups  (e.g.,  the  file  page  caching
+       functions)   are   useful  independent  of  the  other  DB
+       functions, although some functional groups are  explicitly
+       based  on  other functional groups (e.g., transactions and
+       logging).  For a general description of  the  DB  package,
+       see db_intro(3).
+
+       This  manual  page  describes  the specific details of the
+       memory pool interface.
+
+       The db_mpool functions are the library interface  intended
+       to    provide    general-purpose,   page-oriented   buffer
+       management of one or more files.  While designed  to  work
+       with  the  other  DB  functions,  these functions are also
+       useful  for  more  general  purposes.   The  memory  pools
+       (DB_MPOOL's)  are  referred  to in this document as simply
+       ``pools''.  Pools may be shared between processes.   Pools
+       are  usually  filled  by  pages  from  one  or  more files
+       (DB_MPOOLFILE's).  Pages in the pool are replaced  in  LRU
+       (least-recently-used)  order, with each new page replacing
+       the  page  that  has  been  unused  the  longest.    Pages
+       retrieved  from the pool using memp_fget are ``pinned'' in
+       the pool, by default,  until  they  are  returned  to  the
+       pool's control using the memp_fput function.
+
+  memp_open
+       The  memp_open  function  copies  a pointer, to the memory
+       pool identified by the  directory  dir,  into  the  memory
+       location referenced by regionp.
+
+       If  the  dbenv argument to memp_open was initialized using
+       db_appinit,   dir   is   interpreted   as   described   by
+       db_appinit(3).
+
+       Otherwise,  if dir is not NULL, it is interpreted relative
+       to the current working directory of the process.   If  dir
+       is  NULL,  the following environment variables are checked
+       in order: ``TMPDIR'', ``TEMP'', and ``TMP''.   If  one  of
+       them is set, memory pool files are created relative to the
+       directory it specifies.  If none  of  them  are  set,  the
+       first  possible  one of the following directories is used:
+       /var/tmp, /usr/tmp, /temp, /tmp, C:/temp and C:/tmp.
+
+       All files associated with the memory pool are  created  in
+       this directory.  This directory must already exist when
+
+       memory  pool_open  is  called.  If the memory pool already
+       exists, the process must have permission to read and write
+       the  existing  files.  If the memory pool does not already
+       exist, it is optionally created and initialized.
+
+       The flags and mode arguments specify  how  files  will  be
+       opened  and/or created when they don't already exist.  The
+       flags value is specified by or'ing together one or more of
+       the following values:
+       DB_CREATE
+            Create  any  underlying  files, as necessary.  If the
+            files do not already exist and the DB_CREATE flag  is
+            not specified, the call will fail.
+
+       DB_MPOOL_PRIVATE
+            Create  a  private  MPOOL that is not shared with any
+            other process (although it may be shared  with  other
+            threads).
+
+       DB_NOMMAP
+            Always  copy files in this memory pool into the local
+            cache instead of mapping  them  into  process  memory
+            (see  the description of the mp_mmapsize field of the
+            DB_ENV structure for further information).
+
+       DB_THREAD
+            Cause the DB_MPOOL handle returned by  the  memp_open
+            function  to  be useable by multiple threads within a
+            single address space, i.e., to be  ``free-threaded''.
+
+       All files created by the memory pool subsystem (other than
+       files  created  by  the  memp_fopen  function,  which  are
+       separately  specified)  are  created  with  mode  mode (as
+       described in chmod(2)) and modified by the process'  umask
+       value  at  the time of creation (see umask(2)).  The group
+       ownership of created files is  based  on  the  system  and
+       directory defaults, and is not further specified by DB.
+
+       The memory pool subsystem is configured based on the dbenv
+       argument to memp_open, which is a pointer to  a  structure
+       of  type  DB_ENV (typedef'd in <db.h>).  Applications will
+       normally use the same  DB_ENV  structure  (initialized  by
+       db_appinit(3)), as an argument to all of the subsystems in
+       the DB package.
+
+       References to the DB_ENV structure are maintained  by  DB,
+       so  it may not be discarded until the last close function,
+       corresponding to an open function  for  which  it  was  an
+       argument,  has returned.  In order to ensure compatibility
+       with future releases of  DB,  all  fields  of  the  DB_ENV
+       structure   that   are   not   explicitly  set  should  be
+       initialized to 0 before the first time  the  structure  is
+       used.   Do  this  by  declaring  the structure external or
+       static, or by calling the C library  routine  bzero(3)  or
+       memset(3).
+
+       The  fields  of the DB_ENV structure used by memp_open are
+       described below.  If dbenv is NULL or any  of  its  fields
+       are set to 0, defaults appropriate for the system are used
+       where possible.
+
+       The following  fields  in  the  DB_ENV  structure  may  be
+       initialized before calling memp_open:
+
+       void *(*db_errcall)(char *db_errpfx, char *buffer);
+       FILE *db_errfile;
+       const char *db_errpfx;
+       int db_verbose;
+            The  error  fields  of the DB_ENV behave as described
+            for db_appinit(3).
+
+       size_t mp_mmapsize;
+            Files that are opened read-only in the pool (and that
+            satisfy a few other criteria) are, by default, mapped
+            into the  process  address  space  instead  of  being
+            copied  into  the  local  cache.   This can result in
+            better-than-usual performance, as  available  virtual
+            memory  is normally much larger than the local cache,
+            and page faults are faster than page copying on  many
+            systems.  However, in the presence of limited virtual
+            memory it can cause resource starvation, and  in  the
+            presence of large databases, it can result in immense
+            process  sizes.   If  mp_mmapsize  is  non-zero,   it
+            specifies the maximum file size, in bytes, for a file
+            to be mapped into  the  process  address  space.   By
+            default, it is set to 10Mb.
+
+       size_t mp_size;
+            The  suggested  size  of  the  pool,  in bytes.  This
+            should be the size of the normal working data set  of
+            the application, with some small amount of additional
+            memory for unusual situations.   (Note,  the  working
+            set  is  not the same as the number of simultaneously
+            referenced pages, and should be quite a bit  larger!)
+            The  default  cache  size  is  128K bytes (16 8K byte
+            pages), and may not be less than 20K bytes.
+
+       The memp_open function  returns  the  value  of  errno  on
+       failure and 0 on success.
+
+  memp_close
+       The  memp_close  function closes the pool indicated by the
+       DB_MPOOL pointer  mp,  as  returned  by  memp_open.   This
+       function  does  not  imply  a call to memp_fsync, but does
+       imply  a  call  to  memp_fclose  for  any  remaining  open
+       DB_MPOOLFILE pointers returned to this process by calls to
+       memp_fopen.
+
+       In addition, if the dir argument to memp_open was NULL and
+       dbenv   was  not  initialized  using  db_appinit,  or  the
+       DB_MPOOL_PRIVATE flag was set, all files created for  this
+       shared  region  will  be  removed,  as if memp_unlink were
+       called.
+
+       When  multiple  threads  are  using  the  DB_MPOOL  handle
+       concurrently, only a single thread may call the memp_close
+       function.
+
+       The memp_close function returns  the  value  of  errno  on
+       failure and 0 on success.
+
+  memp_fopen
+       The memp_fopen function opens a file in the pool specified
+       by the DB_MPOOL argument, copying the DB_MPOOLFILE pointer
+       representing  it  into  the  memory location referenced by
+       mpf.
+
+       The file argument is the name of the file  to  be  opened.
+       If  file is NULL, a private file is created that cannot be
+       shared with any other process (although it may  be  shared
+       with other threads).
+
+       The  flags  and  mode  arguments specify how files will be
+       opened and/or created when they don't already exist.   The
+       flags value is specified by or'ing together one or more of
+       the following values:
+
+       DB_CREATE
+            Create any underlying files, as  necessary.   If  the
+            files  do not already exist and the DB_CREATE flag is
+            not specified, the call will fail.
+
+       DB_NOMMAP
+            Always copy this file into the local cache instead of
+            mapping  it  into process memory (see the description
+            of the mp_mmapsize field of the DB_ENV structure  for
+            further information).
+
+       DB_RDONLY
+            Open  any  underlying  files  for  reading only.  Any
+            attempt to write the file using  the  pool  functions
+            will  fail,  regardless  of the actual permissions of
+            the file.
+
+       All files created by the function memp_fopen  are  created
+       with  mode mode (as described in chmod(2)) and modified by
+       the process' umask value at  the  time  of  creation  (see
+       umask(2)).   The group ownership of created files is based
+       on the system and directory defaults, and is  not  further
+       specified by DB.
+
+       The  pagesize  argument is the size, in bytes, of the unit
+       of transfer between the application and the pool, although
+       it  is  not  necessarily  the unit of transfer between the
+       pool and the source file.
+
+       Files opened in the pool may be further  configured  based
+       on  the  finfop argument to memp_fopen, which is a pointer
+       to  a  structure  of  type  DB_MPOOL_FINFO  (typedef'd  in
+       <db.h>).   No  references  to  the  finfop  structure  are
+       maintained  by  DB,  so  it  may  be  discarded  when  the
+       memp_fopen   function   returns.    In   order  to  ensure
+       compatibility with future releases of DB,  all  fields  of
+       the  DB_MPOOL_FINFO  structure that are not explicitly set
+       should be initialized to  0  before  the  first  time  the
+       structure  is  used.   Do  this by declaring the structure
+       external or static, or by calling the  C  library  routine
+       bzero(3) or memset(3).
+
+       The   fields  of  the  DB_MPOOL_FINFO  structure  used  by
+       memp_fopen are described  below.  If finfop is NULL or any
+       of  its  fields  are  set to their default value, defaults
+       appropriate for the system are used.
+
+       int ftype;
+            The ftype  field  should  be  the  same  as  a  ftype
+            argument  previously  specified  to the memp_register
+            function, unless no input or output processing of the
+            file's  pages  are necessary, in which case it should
+            be 0.  (See  the  description  of  the  memp_register
+            function for more information.)
+
+       DBT *pgcookie;
+            The  pgcookie  field contains the byte string that is
+            passed to the pgin and pgout functions for this file,
+            if any.  If no pgin or pgout functions are specified,
+            the  pgcookie  field  should  be  NULL.    (See   the
+            description  of  the  memp_register function for more
+            information.)
+
+       u_int8_t *fileid;
+            The fileid field is a unique identifier for the file.
+            The mpool functions must be able to uniquely identify
+            files in order that multiple processes sharing a file
+            will correctly share its underlying pages.  Normally,
+            the  fileid  field  should  be  NULL  and  the  mpool
+            functions  will  use  the  file's  device  and  inode
+            numbers (see stat(2))  for  this  purpose.   On  some
+            filesystems, (e.g., FAT or NFS) file device and inode
+            numbers are  not  necessarily  unique  across  system
+            reboots.   Applications  wanting to maintain a shared
+            memory buffer pool across system reboots,  where  the
+            pool   contains  pages  from  files  stored  on  such
+            filesystems, must specify a unique file identifier to
+            the  memp_fopen  call  and  each  process  opening or
+            registering the file must  provide  the  same  unique
+            identifier.  If the fileid field is non-NULL, it must
+            reference a DB_FILE_ID_LEN  (as  defined  in  <db.h>)
+            length  array  of bytes that will be used to uniquely
+            identify the file.  This should not be necessary  for
+            most applications.  Specifically, it is not necessary
+            if the memory  pool  is  re-instantiated  after  each
+            system reboot, the application is using the DB access
+            methods  instead  of  calling  the   pool   functions
+            explicitly,  or  the  files  in  the  memory pool are
+            stored on filesystems where the file device and inode
+            numbers do not change across system reboots.
+
+       int32_t lsn_offset;
+            The lsn_offset field is the zero-based byte offset in
+            the page of the page's log sequence number (LSN),  or
+            -1   if   no  LSN  offset  is  specified.   (See  the
+            description  of  the  memp_sync  function  for   more
+            information.)
+
+       u_int32_t clear_len;
+            The clear_len field is the number of initial bytes in
+            a page that should be set to zero when  the  page  is
+            created   as  a  result  of  the  DB_MPOOL_CREATE  or
+            DB_MPOOL_NEW flags being specified to memp_fget.   If
+            finfop  is NULL or clear_len is 0, the entire page is
+            cleared.
+
+       The memp_fopen function returns  the  value  of  errno  on
+       failure and 0 on success.
+
+  memp_fclose
+       The  memp_fclose function closes the source file indicated
+       by the DB_MPOOLFILE pointer mpf.  This function  does  not
+       imply  a  call to memp_fsync, i.e. no pages are written to
+       the source file as as a result of calling memp_fclose.
+
+       In addition, if the file argument to memp_fopen was  NULL,
+       any underlying files created for this DB_MPOOLFILE will be
+       removed.
+
+       The memp_fclose function returns the  value  of  errno  on
+       failure and 0 on success.
+
+  memp_fget
+       The  memp_fget  function copies a pointer to the page with
+       the page number specified by  pgnoaddr,  from  the  source
+       file  specified  by the DB_MPOOLFILE pointer mpf, into the
+       memory location referenced by pagep.  If the page does not
+       exist or cannot be retrieved, memp_fget will fail.
+
+       The returned page is size_t type aligned.
+
+       Page  numbers begin at 0, e.g., the first page in the file
+       is page number 0, not page number 1.
+
+       The flags argument is specified by or'ing together one  or
+       more of the following values:
+
+       DB_MPOOL_CREATE
+            If  the specified page does not exist, create it.  In
+            this  case,  the  pgin  function,  if  specified,  is
+            called.
+
+       DB_MPOOL_LAST
+            Return  the last page of the source file and copy its
+            page number to the location referenced by pgnoaddr.
+
+       DB_MPOOL_NEW
+            Create a new page in  the  file  and  copy  its  page
+            number  to  the  location referenced by pgnoaddr.  In
+            this case, the pgin function, if  specified,  is  not
+            called.
+
+       The  DB_MPOOL_CREATE, DB_MPOOL_LAST and DB_MPOOL_NEW flags
+       are mutually exclusive.
+
+       Created pages have  all  their  bytes  set  to  0,  unless
+       otherwise specified when the file was opened.
+
+       All  pages  returned  by  memp_fget will be retained (i.e.
+       ``pinned'')  in  the  pool  until  a  subsequent  call  to
+       memp_fput.
+
+       The  memp_fget  function  returns  the  value  of errno on
+       failure and 0 on success.
+
+  memp_fput
+       The memp_fput function indicates that the page  referenced
+       by pgaddr can be evicted from the pool.  Pgaddr must be an
+       address previously returned by memp_fget.
+
+       The flags argument is specified by or'ing together one  or
+       more of the following values:
+
+       DB_MPOOL_CLEAN
+            Clear  any  previously  set  modification information
+            (i.e., don't bother writing  the  page  back  to  the
+            source file).
+
+       DB_MPOOL_DIRTY
+            The page has been modified and must be written to the
+            source file before being evicted from the pool.
+
+       DB_MPOOL_DISCARD
+            The page is unlikely to be useful in the near future,
+            and  should  be  discarded  before other pages in the
+            pool.
+
+       The DB_MPOOL_CLEAN and DB_MPOOL_DIRTY flags  are  mutually
+       exclusive.
+
+       The  memp_fput  function  returns  the  value  of errno on
+       failure and 0 on success.
+
+  memp_fset
+       The memp_fset function sets the flags associated with  the
+       page  referenced  by  pgaddr without unpinning it from the
+       pool.  Pgaddr must be an address  previously  returned  by
+       memp_fget.   The  flags argument to memp_fset is specified
+       by or'ing together one or more of the values specified  as
+       flags for the memp_fput call.
+
+       The  memp_fset  function  returns  the  value  of errno on
+       failure and 0 on success.
+
+  memp_fsync
+       The memp_fsync function writes all pages  associated  with
+       the DB_MPOOLFILE pointer mpf, that were marked as modified
+       using memp_fput or memp_fset, back to the source file.  If
+       any of the modified pages are also pinned (i.e., currently
+       referenced by this or  another  process)  memp_fsync  will
+       ignore them.
+
+       The  memp_fsync  function  returns  the  value of errno on
+       failure, 0 on success, and  DB_INCOMPLETE  if  there  were
+       pages  which were modified but which memp_fsync was unable
+       to write.
+
+  memp_unlink
+       The  memp_unlink  function  destroys   the   memory   pool
+       identified  by  the directory dir, removing all files used
+       to implement the memory pool.  (The directory dir  is  not
+       removed.)    If  there  are  processes  that  have  called
+       memp_open without  calling  memp_close  (i.e.,  there  are
+       processes  currently  using  the memory pool), memp_unlink
+       will fail without further action, unless the force flag is
+       set,  in which case memp_unlink will attempt to remove the
+       memory pool files regardless of any processes still  using
+       the memory pool.
+
+       The  result  of  attempting to forcibly destroy the region
+       when  a  process  has  the  region  open  is  unspecified.
+       Processes  using  a  shared memory region maintain an open
+       file descriptor for  it.   On  UNIX  systems,  the  region
+       removal  should  succeed  and  processes that have already
+       joined the region should continue to  run  in  the  region
+       without  change,  however processes attempting to join the
+       memory pool will either fail or attempt to  create  a  new
+       region.   On other systems, e.g., WNT, where the unlink(2)
+       system call will fail if any  process  has  an  open  file
+       descriptor for the file, the region removal will fail.
+
+       In  the  case  of catastrophic or system failure, database
+       recovery must  be  performed  (see  db_recover(1)  or  the
+       DB_RECOVER  and  DB_RECOVER_FATAL flags to db_appinit(3)).
+       Alternatively, if recovery  is  not  required  because  no
+       database  state  is  maintained  across  failures,  it  is
+       possible to clean up a memory pool by removing all of  the
+       files   in   the  directory  specified  to  the  memp_open
+       function, as memory pool files are never  created  in  any
+       directory  other  than  the  one  specified  to memp_open.
+       Note, however, that this has the potential to remove files
+       created  by  the  other  DB  subsystems  in  this database
+       environment.
+
+       The memp_unlink function returns the  value  of  errno  on
+       failure and 0 on success.
+
+  memp_register
+       The  memp_register function registers page-in and page-out
+       functions for files of type ftype in the specified pool.
+
+       If the pgin function is non-NULL, it is called each time a
+       page  is  read  into  the  memory pool from a file of type
+       ftype, or a page is created for a file of type ftype  (see
+       the  DB_MPOOL_CREATE flag for the memp_fget function).  If
+       the pgout function is non-NULL, it is called each  time  a
+       page is written to a file of type ftype.
+
+       Both the pgin and pgout functions are called with the page
+       number, a pointer to the page being read or  written,  and
+       any argument pgcookie that was specified to the memp_fopen
+       function when the file was opened.   The  pgin  and  pgout
+       functions  should  return  0 on success, and an applicable
+       non-zero  errno  value  on  failure,  in  which  case  the
+       db_mpool  function  calling  it  will also fail, returning
+       that errno value.
+
+       The purpose of the memp_register function  is  to  support
+       processing  when  pages are entered into, or flushed from,
+       the pool.  A file  type  must  be  specified  to  make  it
+       possible  for  unrelated  threads  or  processes, that are
+       sharing a pool, to evict each other's pages from the pool.
+       Applications    should    call    memp_register,    during
+       initialization, for each type of file requiring  input  or
+       output  processing  that  will  be  sharing the underlying
+       pool.  (No registry is necessary for the  standard  access
+       method   types,  btree,  hash  and  recno,  as  db_open(3)
+       registers them separately.)
+
+       If a thread or process does not call memp_register  for  a
+       file  type, it is impossible for it to evict pages for any
+       file requiring input or output processing from  the  pool.
+       For  this reason, memp_register should always be called by
+       each application sharing a pool  for  each  type  of  file
+       included  in  the  pool,  regardless of whether or not the
+       application itself uses files of that type.
+
+       There are no standard values for ftype,  pgin,  pgout  and
+       pgcookie, except that the ftype value for a file must be a
+       non-zero positive number, as negative numbers are reserved
+       for  internal  use  by  the  DB library.  For this reason,
+       applications sharing a pool must coordinate  their  values
+       amongst themselves.
+
+       The  memp_register  function returns the value of errno on
+       failure and 0 on success.
+
+  memp_trickle
+       The  memp_trickle  function  ensures  that  at  least  pct
+       percent  of  the pages in the shared memory pool are clean
+       by writing dirty pages to their  backing  files.   If  the
+       nwrotep  argument  is  non-NULL,  the number of pages that
+       were written to reach the correct percentage  is  returned
+       in the memory location it references.
+
+       The  purpose  of  the memp_trickle function is to enable a
+       memory pool manager  to  ensure  that  a  page  is  always
+       available for reading in new information without having to
+       wait for a write.
+
+       The memp_trickle function returns the value  of  errno  on
+       failure and 0 on success.
+
+  memp_sync
+       The memp_sync function ensures that all the modified pages
+       in the pool with log sequence numbers (LSNs) less than the
+       lsn argument are written to disk.
+
+       The  memp_sync  function  returns  the  value  of errno on
+       failure, 0 on success, and  DB_INCOMPLETE  if  there  were
+       pages  which  need  to  be written but which memp_sync was
+       unable to write immediately.  In  addition,  if  memp_sync
+       returns success, the value of lsn will be overwritten with
+       the largest  LSN  from  any  page  which  was  written  by
+       memp_sync to satisfy this request.
+
+       The  purpose  of  the  memp_sync  function  is to enable a
+       transaction manager to ensure, as part  of  a  checkpoint,
+       that  all  pages  modified  by  a  certain  time have been
+       written to disk.   Pages  in  the  pool  which  cannot  be
+       written  back  to  disk  immediately  (e.g., are currently
+       pinned) are written to disk as soon as it is  possible  to
+       do  so.   The expected behavior of the transaction manager
+       is to call the memp_sync function and then, if the  return
+       indicates   that   some   pages   could   not  be  written
+       immediately, to wait briefly and retry again with the same
+       LSN  until  the  memp_sync function returns that all pages
+       have been written.
+
+       To support the memp_sync functionality,  it  is  necessary
+       that  the  pool  functions know the location of the LSN on
+       the page for each file  type.   This  location  should  be
+       specified  when  the  file  is opened using the memp_fopen
+       function.  (Note, it is  not  required  that  the  LSN  be
+       aligned on the page in any way.)
+
+  memp_stat
+       The  memp_stat function creates statistical structures and
+       copies  pointers  to  them  into   user-specified   memory
+       locations.   The  statistics  include  the number of files
+       participating in the pool, the active pages in  the  pool,
+       and information as to how effective the cache has been.
+
+       Statistical  structures  are  created in allocated memory.
+       If db_malloc is non-NULL, it is  called  to  allocate  the
+       memory, otherwise, the library function malloc(3) is used.
+       The function db_malloc must match the calling  conventions
+       of  the malloc(3) library routine.  Regardless, the caller
+       is responsible for deallocating the returned  memory.   To
+       deallocate  the returned memory, free each returned memory
+       pointer; pointers inside the memory  do  not  need  to  be
+       individually freed.
+
+       If  gsp  is non-NULL, the global statistics for the memory
+       pool mp are copied into the memory location it references.
+       The  global  statistics  are stored in a structure of type
+       DB_MPOOL_STAT (typedef'd in <db.h>).
+
+       The following DB_MPOOL_STAT fields will be filled in:
+
+       u_int32_t st_refcnt;
+            The number of references to the region.
+       u_int32_t st_regsize;
+            The size of the region.
+       size_t st_cachesize;
+            Cache size in bytes.
+       u_int32_t st_cache_hit;
+            Requested pages found in the cache.
+       u_int32_t st_cache_miss;
+            Requested pages not found in the cache.
+       u_int32_t st_map;
+            Requested pages  mapped  into  the  process'  address
+            space  (there  is  no  available  information  as  to
+            whether or not this request caused disk I/O, although
+            examining  the  application  page  fault  rate may be
+            helpful).
+       u_int32_t st_page_create;
+            Pages created in the cache.
+       u_int32_t st_page_in;
+            Pages read into the cache.
+       u_int32_t st_page_out;
+            Pages written from the cache to the backing file.
+       u_int32_t st_ro_evict;
+            Clean pages forced from the cache.
+       u_int32_t st_rw_evict;
+            Dirty pages forced from the cache.
+       u_int32_t st_hash_buckets;
+            Number of hash buckets in buffer hash table.
+
+       u_int32_t st_hash_searches;
+            Total number of buffer hash table lookups.
+       u_int32_t st_hash_longest;
+            The longest chain ever  encountered  in  buffer  hash
+            table lookups.
+       u_int32_t st_hash_examined;
+            Total  number  of hash elements traversed during hash
+            table lookups.
+       u_int32_t st_page_clean;
+            Clean pages currently in the cache.
+       u_int32_t st_page_dirty;
+            Dirty pages currently in the cache.
+       u_int32_t st_page_trickle;
+            Dirty pages written using the memp_trickle interface.
+       u_int32_t st_region_wait;
+            The  number  of  times  that  a thread of control was
+            forced to wait before obtaining the region lock.
+       u_int32_t st_region_nowait;
+            The number of times that a thread of control was able
+            to obtain the region lock without waiting.
+
+       If  fsp  is  non-NULL,  a  pointer  to  a  NULL-terminated
+       variable length array of statistics for individual  files,
+       in  the memory pool mp, is copied into the memory location
+       it references.  If no individual files currently exist  in
+       the memory pool, fsp will be set to NULL.
+
+       The  per-file  statistics are stored in structures of type
+       DB_MPOOL_FSTAT  (typedef'd  in  <db.h>).   The   following
+       DB_MPOOL_FSTAT  fields  will be filled in for each file in
+       the pool, i.e., each element of the array:
+
+       char *file_name;
+            The name of the file.
+       size_t st_pagesize;
+            Page size in bytes.
+       u_int32_t st_cache_hit;
+            Requested pages found in the cache.
+       u_int32_t st_cache_miss;
+            Requested pages not found in the cache.
+       u_int32_t st_map;
+            Requested pages  mapped  into  the  process'  address
+            space.
+       u_int32_t st_page_create;
+            Pages created in the cache.
+       u_int32_t st_page_in;
+            Pages read into the cache.
+       u_int32_t st_page_out;
+            Pages written from the cache to the backing file.
+
+       The  memp_stat  function  returns  the  value  of errno on
+       failure and 0 on success.
+
+
+
+

ENVIRONMENT VARIABLES

+       The following environment variables affect  the  execution
+       of db_mpool:
+
+       DB_HOME
+            If  the  dbenv  argument to memp_open was initialized
+            using db_appinit, the  environment  variable  DB_HOME
+            may  be used as the path of the database home for the
+            interpretation of the dir argument to  memp_open,  as
+            described in db_appinit(3).
+
+       TMPDIR
+            If  the  dbenv  argument to memp_open was NULL or not
+            initialized   using   db_appinit,   the   environment
+            variable TMPDIR may be used as the directory in which
+            to create  the  memory  pool,  as  described  in  the
+            memp_open section above.
+
+
+
+

ERRORS

+       The  memp_open  function may fail and return errno for any
+       of the errors specified for the following DB  and  library
+       functions: DBmemp->pgin(3), DBmemp->pgout(3), close(2),
+       db_version(3), fcntl(2), fflush(3), fsync(2),
+       log_compare(3), log_flush(3), lseek(2), malloc(3),
+       memcmp(3), memcpy(3), memp_close(3), memp_unlink(3),
+       memset(3), mmap(2), munmap(2), open(2), sigfillset(3),
+       sigprocmask(2), stat(2), strcpy(3), strdup(3),
+       strerror(3),  strlen(3), time(3), unlink(2), and write(2).
+
+       In addition, the memp_open function may  fail  and  return
+       errno for the following conditions:
+
+       [EAGAIN]
+            The  shared memory region was locked and (repeatedly)
+            unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The DB_THREAD flag was specified  and  spinlocks  are
+            not implemented for this architecture.
+
+            A   NULL   pathname   was   specified   without   the
+            DB_MPOOL_PRIVATE flag.
+
+            The specified cache size was impossibly small.
+
+       The memp_close function may fail and return errno for  any
+       of  the  errors specified for the following DB and library
+       functions: close(2), fcntl(2), fflush(3), memp_fclose(3),
+       munmap(2), and strerror(3).
+
+       The  memp_fopen function may fail and return errno for any
+       of the errors specified for the following DB  and  library
+       functions: DBmemp->pgin(3), DBmemp->pgout(3), close(2),
+       fcntl(2), fflush(3), fsync(2), log_compare(3),
+       log_flush(3), lseek(2), malloc(3), memcmp(3), memcpy(3),
+       memset(3), mmap(2), open(2), sigfillset(3),
+       sigprocmask(2), stat(2), strcpy(3), strdup(3),
+       strerror(3), strlen(3), time(3), unlink(2), and  write(2).
+
+       In  addition,  the memp_fopen function may fail and return
+       errno for the following conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The file has already been entered into the pool,  and
+            the  pagesize  value is not the same as when the file
+            was entered into the pool, or the length of the  file
+            is not zero or a multiple of the pagesize.
+
+            The  DB_RDONLY  flag  was  specified for an in-memory
+            pool.
+
+       The memp_fclose function may fail and return errno for any
+       of  the  errors specified for the following DB and library
+       functions: close(2), fcntl(2), fflush(3), munmap(2), and
+       strerror(3).
+
+       The  memp_fget  function may fail and return errno for any
+       of the errors specified for the following DB  and  library
+       functions: DBmemp->pgin(3), DBmemp->pgout(3), close(2),
+       fcntl(2), fflush(3), fsync(2), log_compare(3),
+       log_flush(3), lseek(2), malloc(3), memcmp(3), memcpy(3),
+       memset(3), mmap(2), open(2), read(2), sigfillset(3),
+       sigprocmask(2), stat(2), strcpy(3), strdup(3),
+       strerror(3), strlen(3), time(3), unlink(2), and  write(2).
+
+       In  addition,  the  memp_fget function may fail and return
+       errno for the following conditions:
+
+       [EAGAIN]
+            The  page  reference  count  has  overflowed.   (This
+            should  never  happen  unless  there's  a  bug in the
+            application.)
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The DB_MPOOL_NEW flag was set and the source file was
+            not opened for writing.
+
+            The requested page does not exist and DB_MPOOL_CREATE
+            was not set.
+
+            More than one of DB_MPOOL_CREATE,  DB_MPOOL_LAST  and
+            DB_MPOOL_NEW was set.
+
+       [ENOMEM]
+            The  cache  is full and no more pages will fit in the
+            pool.
+
+       The memp_fput function may fail and return errno  for  any
+       of  the  errors specified for the following DB and library
+       functions: DBmemp->pgin(3), DBmemp->pgout(3), close(2),
+       fcntl(2), fflush(3), fsync(2), log_compare(3),
+       log_flush(3), lseek(2), malloc(3), memcmp(3), memcpy(3),
+       memset(3), mmap(2), open(2), sigfillset(3),
+       sigprocmask(2), stat(2), strcpy(3), strdup(3),
+       strerror(3),  strlen(3), time(3), unlink(2), and write(2).
+
+       In addition, the memp_fput function may  fail  and  return
+       errno for the following conditions:
+
+       [EACCES]
+            The  DB_MPOOL_DIRTY  flag was set and the source file
+            was not opened for writing.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The  pgaddr  parameter  does  not  reference  a  page
+            returned by memp_fget.
+
+            More  than  one  of DB_MPOOL_CLEAN and DB_MPOOL_DIRTY
+            was set.
+
+       The memp_fset function may fail and return errno  for  any
+       of  the  errors specified for the following DB and library
+       functions: fcntl(2), and fflush(3).
+
+       In addition, the memp_fset function may  fail  and  return
+       errno for the following conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       The  memp_fsync function may fail and return errno for any
+       of the errors specified for the following DB  and  library
+       functions: DBmemp->pgin(3), DBmemp->pgout(3), close(2),
+       fcntl(2), fflush(3), fsync(2), log_compare(3),
+       log_flush(3), lseek(2), malloc(3), memcpy(3), memset(3),
+       open(2), qsort(3), realloc(3), sigfillset(3),
+       sigprocmask(2), stat(2), strcpy(3), strdup(3),
+       strerror(3), strlen(3), unlink(2), and write(2).
+
+       The memp_unlink function may fail and return errno for any
+       of  the  errors specified for the following DB and library
+       functions: close(2), fcntl(2), fflush(3), malloc(3),
+       memcpy(3), memset(3), mmap(2), munmap(2), open(2),
+       sigfillset(3), sigprocmask(2), stat(2), strcpy(3),
+       strdup(3), strerror(3), strlen(3), and unlink(2).
+       In  addition, the memp_unlink function may fail and return
+       errno for the following conditions:
+
+       [EBUSY]
+            The shared memory region was in  use  and  the  force
+            flag was not set.
+
+       The  memp_register  function may fail and return errno for
+       any of the errors  specified  for  the  following  DB  and
+       library functions: fcntl(2), and malloc(3).
+
+       The  memp_trickle  function  may fail and return errno for
+       any of the errors  specified  for  the  following  DB  and
+       library functions: DBmemp->pgin(3), DBmemp->pgout(3),
+       close(2), fcntl(2), fflush(3), fsync(2), log_compare(3),
+       log_flush(3), lseek(2), malloc(3), memcmp(3), memcpy(3),
+       memset(3), mmap(2), open(2), sigfillset(3),
+       sigprocmask(2), stat(2), strcpy(3), strdup(3),
+       strerror(3), strlen(3), time(3), unlink(2), and  write(2).
+
+       In addition, the memp_trickle function may fail and return
+       errno for the following conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       The memp_sync function may fail and return errno  for  any
+       of  the  errors specified for the following DB and library
+       functions: DBmemp->pgin(3), DBmemp->pgout(3), close(2),
+       fcntl(2), fflush(3), fsync(2), log_compare(3),
+       log_flush(3), lseek(2), malloc(3), memcmp(3), memcpy(3),
+       memset(3), mmap(2), open(2), qsort(3), realloc(3),
+       sigfillset(3), sigprocmask(2), stat(2), strcpy(3),
+       strdup(3), strerror(3), strlen(3), time(3), unlink(2), and
+       write(2).
+
+       In addition, the memp_sync function may  fail  and  return
+       errno for the following conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The  memp_sync  function  was  called without logging
+            having been initialized in the environment.
+
+       The memp_stat function may fail and return errno  for  any
+       of  the  errors specified for the following DB and library
+       functions: fcntl(2), malloc(3), memcpy(3), and  strlen(3).
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_appinit(3), db_cursor(3), db_dbm(3), db_internal(3),
+       db_lock(3), db_log(3), db_mpool(3), db_open(3), db_thread(3),
+       db_txn(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/db_open.html b/mozilla/db/man/man.html/db_open.html new file mode 100644 index 00000000000..e7534e898f3 --- /dev/null +++ b/mozilla/db/man/man.html/db_open.html @@ -0,0 +1,1248 @@ + + +db_open + + +

db_open

+
+
+
+       #include <db.h>
+
+       int
+       db_open(const char *file, DBTYPE type, u_int32_t flags,
+            int mode, DB_ENV *dbenv, DB_INFO *dbinfo, DB **dbpp);
+
+       int
+       DB->close(DB *db, u_int32_t flags);
+
+       int
+       DB->cursor(DB *db, DB_TXN *txnid, DBC **cursorp);
+
+       int
+       DB->del(DB *db, DB_TXN *txnid, DBT *key, u_int32_t flags);
+
+       int
+       DB->fd(DB *db, int *fdp);
+
+       int
+       DB->get(DB *db, DB_TXN *txnid, DBT *key, DBT *data, u_int32_t flags);
+
+       int
+       DB->put(DB *db, DB_TXN *txnid, DBT *key, DBT *data, u_int32_t flags);
+
+       int
+       DB->sync(DB *db, u_int32_t flags);
+
+       int
+       DB->stat(DB *db, void *sp, void *(*db_malloc)(size_t), u_int32_t flags);
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a family of groups of functions that
+       provides a modular programming interface  to  transactions
+       and  record-oriented  file  access.   The library includes
+       support for transactions, locking, logging and  file  page
+       caching,  as well as various indexed access methods.  Many
+       of the functional groups  (e.g.,  the  file  page  caching
+       functions)   are   useful  independent  of  the  other  DB
+       functions, although some functional groups are  explicitly
+       based  on  other functional groups (e.g., transactions and
+       logging).  For a general description of  the  DB  package,
+       see db_intro(3).
+
+       This manual page describes the overall structure of the DB
+       library access methods.
+
+       The currently supported file formats are btree, hashed and
+       recno.   The btree format is a representation of a sorted,
+       balanced  tree  structure.   The  hashed  format   is   an
+       extensible,  dynamic  hashing  scheme.   The  recno format
+       supports fixed  or  variable  length  records  (optionally
+       retrieved from a flat text file).
+
+       Storage  and retrieval for the DB access methods are based
+       on key/data pairs, or DBT structures as they are typedef'd
+       in  the  <db.h>  include file.  See db_dbt(3) for specific
+       information on the structure and capabilities of a DBT.
+
+       The db_open function opens  the  database  represented  by
+       file  for  both reading and writing.  Files never intended
+       to be shared or  preserved  on  disk  may  be  created  by
+       setting the file parameter to NULL.
+
+       The  db_open  function  copies a pointer to a DB structure
+       (as typedef'd in the <db.h> include file), into the memory
+       location  referenced  by  dbpp.  This structure includes a
+       set of functions to perform various database  actions,  as
+       described  below.   The db_open function returns the value
+       of errno on failure and 0 on success.
+
+       Note, while most of the access methods  use  file  as  the
+       name   of   an  underlying  file  on  disk,  this  is  not
+       guaranteed.   Also,  calling  db_open  is   a   reasonably
+       expensive  operation.  (This is based on a model where the
+       DBMS keeps a set of files open for a long time rather than
+       opening and closing them on each query.)
+
+       The  type  argument  is  of type DBTYPE (as defined in the
+       <db.h> include file) and must be set to one  of  DB_BTREE,
+       DB_HASH,  DB_RECNO  or DB_UNKNOWN.  If type is DB_UNKNOWN,
+       the database must already  exist  and  db_open  will  then
+       determine  if it is of type DB_BTREE, DB_HASH or DB_RECNO.
+
+       The flags and mode arguments specify  how  files  will  be
+       opened  and/or created when they don't already exist.  The
+       flags value is specified by or'ing together one or more of
+       the following values:
+
+       DB_CREATE
+            Create  any  underlying  files, as necessary.  If the
+            files do not already exist and the DB_CREATE flag  is
+            not specified, the call will fail.
+
+       DB_NOMMAP
+            Do  not  map  this  file (see db_mpool(3) for further
+            information).
+
+       DB_RDONLY
+            Open the database for reading only.  Any  attempt  to
+            write the database using the access methods will fail
+            regardless  of  the   actual   permissions   of   any
+            underlying files.
+
+       DB_THREAD
+            Cause  the DB handle returned by the db_open function
+            to be useable by multiple  threads  within  a  single
+            address space, i.e., to be ``free-threaded''.
+
+       DB_TRUNCATE
+            ``Truncate''  the database if it exists, i.e., behave
+            as if the database were just created, discarding  any
+            previous contents.
+
+       All  files  created by the access methods are created with
+       mode mode (as described in chmod(2)) and modified  by  the
+       process'   umask  value  at  the  time  of  creation  (see
+       umask(2)).  The group ownership of created files is  based
+       on  the  system and directory defaults, and is not further
+       specified by DB.
+
+
+
+

DB_ENV

+       The access methods make calls to the other  subsystems  in
+       the  DB  library  based  on the dbenv argument to db_open,
+       which  is  a  pointer  to  a  structure  of  type   DB_ENV
+       (typedef'd in <db.h>).  Applications will normally use the
+       same DB_ENV structure (initialized by  db_appinit(3)),  as
+       an argument to all of the subsystems in the DB package.
+
+       References  to  the DB_ENV structure are maintained by DB,
+       so it may not be discarded until the last close  function,
+       corresponding  to  an  open  function  for which it was an
+       argument, has returned.  In order to ensure  compatibility
+       with  future  releases  of  DB,  all  fields of the DB_ENV
+       structure  that  are  not   explicitly   set   should   be
+       initialized  to  0  before the first time the structure is
+       used.  Do this by  declaring  the  structure  external  or
+       static,  or  by  calling the C library routine bzero(3) or
+       memset(3).
+
+       The fields of the DB_ENV structure  used  by  db_open  are
+       described  below.   If  dbenv is NULL or any of its fields
+       are set to 0, defaults appropriate for the system are used
+       where possible.
+
+       The  following  fields  in  the  DB_ENV  structure  may be
+       initialized before calling db_open:
+
+       DB_LOG *lg_info;
+            If modifications to the file being opened  should  be
+            logged,  the  lg_info  field  contains a return value
+            from the function log_open.  If lg_info is  NULL,  no
+            logging is done by the DB access methods.
+
+       DB_LOCKTAB *lk_info;
+            If  locking is required for the file being opened (as
+            is the case when multiple processes  or  threads  are
+            accessing  the same file), the lk_info field contains
+            a return  value  from  the  function  lock_open.   If
+            lk_info  is NULL, no locking is done by the DB access
+            methods.
+
+            If both locking and transactions are being  performed
+            (i.e.,  both  lk_info  and tx_info are non-NULL), the
+            transaction ID will be used as  the  locker  ID.   If
+            only locking is being performed, db_open will acquire
+            a locker ID from lock_id(3), and will use it for  all
+            locks required for this instance of db_open.
+
+       DB_MPOOL *mp_info;
+            If  the  cache  for  the  file being opened should be
+            maintained in a shared buffer pool, the mp_info field
+            contains  a return value from the function memp_open.
+            If mp_info is  NULL,  a  memory  pool  may  still  be
+            created  by  DB,  but  it  will  be  private  to  the
+            application and managed by DB.
+
+       DB_TXNMGR *tx_info;
+            If the accesses to the file being opened should  take
+            place  in  the  context  of  transactions  (providing
+            atomicity and  error  recovery),  the  tx_info  field
+            contains  a  return  value from the function txn_open
+            (see db_txn(3)).  If transactions are specified,  the
+            application  is responsible for making suitable calls
+            to txn_begin, txn_abort, and txn_commit.  If  tx_info
+            is  NULL,  no  transaction  support is done by the DB
+            access methods.
+
+            When the access methods are used in conjunction  with
+            transactions,   the   application   must   abort  the
+            transaction  (using  txn_abort)   if   any   of   the
+            transaction  protected access method calls (i.e., any
+            calls other than open,  close  and  sync)  returns  a
+            system  error (e.g., deadlock, which returns EAGAIN).
+            As described by db_intro(3), a system  error  is  any
+            value greater than 0.
+
+
+
+

DB_INFO

+       The  access  methods are configured using the DB_INFO data
+       structure argument to db_open.  The DB_INFO  structure  is
+       typedef'd in <db.h> and has a large number of fields, most
+       specific to a single access method,  although  a  few  are
+       shared.   The fields that are common to all access methods
+       are listed here; those specific to  an  individual  access
+       method  are  described below.  No reference to the DB_INFO
+       structure is maintained  by  DB,  so  it  is  possible  to
+       discard it as soon as the db_open call returns.
+
+       In  order  to ensure compatibility with future releases of
+       DB,  all  fields  of  the  DB_INFO  structure  should   be
+       initialized to 0 before the structure is used.  Do this by
+       declaring the structure external or static, or by  calling
+       the C library function bzero(3) or memset(3).
+
+       If  possible, defaults appropriate for the system are used
+       for the DB_INFO fields if dbinfo is NULL or any fields  of
+       the DB_INFO structure are set to 0.  The following DB_INFO
+       fields may be initialized before calling db_open:
+
+       size_t db_cachesize;
+            A suggested maximum size of the memory pool cache, in
+            bytes.   If db_cachesize is 0, an appropriate default
+            is used.  It is an error to specify both the  mp_info
+            field and a non-zero db_cachesize.
+
+            Note, the minimum number of pages in the cache should
+            be no less than 10, and the access methods will  fail
+            if  an  insufficiently  large cache is specified.  In
+            addition,  for  applications  that   exhibit   strong
+            locality  in  their  data access patterns, increasing
+            the size  of  the  cache  can  significantly  improve
+            application performance.
+
+       int db_lorder;
+            The  byte  order  for integers in the stored database
+            metadata.  The number should represent the  order  as
+            an  integer,  for  example,  big  endian order is the
+            number 4,321, and little endian order is  the  number
+            1,234.   If  db_lorder  is  0,  the host order of the
+            machine where the DB library was compiled is used.
+
+            The  value  of  db_lorder  is  ignored  except   when
+            databases  are  being created.  If a database already
+            exists, the byte order it uses is determined when the
+            file is read.
+
+            The  access  methods  provide no guarantees about the
+            byte ordering of the application data stored  in  the
+            database,   and   applications  are  responsible  for
+            maintaining any necessary ordering.
+
+       size_t db_pagesize;
+            The size of the pages  used  to  hold  items  in  the
+            database,  in  bytes.   The  minimum page size is 512
+            bytes and the maximum page size  is  64K  bytes.   If
+            db_pagesize  is  0,  a page size is selected based on
+            the  underlying  filesystem  I/O  block  size.    The
+            selected  size  has a lower limit of 512 bytes and an
+            upper limit of 16K bytes.
+
+       void *(*db_malloc)(size_t);
+            The flag DB_DBT_MALLOC, when  specified  in  the  DBT
+            structure,  will  cause  the  DB  library to allocate
+            memory which then becomes the responsibility  of  the
+            calling   application.    See   db_dbt(3)   for  more
+            information.
+
+            On  systems  where  there  may  be  multiple  library
+            versions  of  malloc (notably Windows NT), specifying
+            the DB_DBT_MALLOC  flag  will  fail  because  the  DB
+            library  will  allocate  memory from a different heap
+            than the application will use to free it.   To  avoid
+            this  problem,  the  db_malloc field should be set to
+            point to the application's  allocation  routine.   If
+            db_malloc  is  non-NULL,  it will be used to allocate
+            the memory returned when the  DB_DBT_MALLOC  flag  is
+            set.   The  db_malloc function must match the calling
+            conventions of the malloc(3) library routine.
+
+
+
+

BTREE

+       The btree  data  structure  is  a  sorted,  balanced  tree
+       structure  storing  associated  key/data pairs.  Searches,
+       insertions, and deletions in the btree will  all  complete
+       in  O (lg base N) where base is the average number of keys
+       per page.   Often,  inserting  ordered  data  into  btrees
+       results  in pages that are half-full.  This implementation
+       has been modified to make  ordered  (or  inverse  ordered)
+       insertion  the best case, resulting in nearly perfect page
+       space utilization.
+
+       Space freed by deleting key/data pairs from  the  database
+       is  never  reclaimed  from  the filesystem, although it is
+       reused where possible.  This means that the btree  storage
+       structure  is  grow-only.   If  sufficiently many keys are
+       deleted from a tree that shrinking the underlying database
+       file  is desirable, this can be accomplished by creating a
+       new tree from a scan of the existing one.
+
+       The  following  additional  fields  and   flags   may   be
+       initialized   in  the  DB_INFO  structure  before  calling
+       db_open, when using the btree access method:
+
+       int (*bt_compare)(const DBT *, const DBT *);
+            The  bt_compare  function  is  the   key   comparison
+            function.  It must return an integer less than, equal
+            to, or greater than zero if the first key argument is
+            considered to be respectively less than, equal to, or
+            greater than  the  second  key  argument.   The  same
+            comparison  function  must  be  used  on a given tree
+            every time it is opened.
+
+            The data and size fields of  the  DBT  are  the  only
+            fields  that  may  be  used  for the purposes of this
+            comparison.
+
+            If  bt_compare  is  NULL,  the  keys   are   compared
+            lexically,  with shorter keys collating before longer
+            keys.
+
+       u_int32_t bt_minkey;
+            The minimum number of keys that will be stored on any
+            single  page.   This value is used to determine which
+            keys will be stored on overflow pages, i.e. if a  key
+            or  data  item is larger than the pagesize divided by
+            the bt_minkey value, it will be  stored  on  overflow
+            pages  instead  of in the page itself.  The bt_minkey
+            value specified must be at least 2; if  bt_minkey  is
+            0, a value of 2 is used.
+
+       size_t (*bt_prefix)(const DBT *, const DBT *);
+            The  bt_prefix  function  is  the  prefix  comparison
+            function.  If specified, this  function  must  return
+            the  number  of bytes of the second key argument that
+            are necessary to determine that it  is  greater  than
+            the  first  key argument.  If the keys are equal, the
+            key length should be returned.
+
+            The data and size fields of  the  DBT  are  the  only
+            fields  that  may  be  used  for the purposes of this
+            comparison.
+
+            This is used to compress the keys stored on the btree
+            internal  pages.   The  usefulness  of  this  is data
+            dependent,  but  in  some  data  sets   can   produce
+            significantly  reduced  tree  sizes and search times.
+            If bt_prefix is NULL, and no comparison  function  is
+            specified,  a  default lexical comparison function is
+            used.  If bt_prefix is NULL and a comparison function
+            is specified, no prefix comparison is done.
+
+       u_int32_t flags;
+            The  following  additional  flags may be specified by
+            or'ing together one or more of the following values:
+
+            DB_DUP
+                 Permit  duplicate  keys  in   the   tree,   i.e.
+                 insertion  when  the  key  of  the key/data pair
+                 being inserted already exists in the  tree  will
+                 be  successful.   The  ordering of duplicates in
+                 the  tree  is  determined  by   the   order   of
+                 insertion,  unless  the  ordering  is  otherwise
+                 specified by use of a cursor  (see  db_cursor(3)
+                 for  more  information.)   It  is  an  error  to
+                 specify both DB_DUP and DB_RECNUM.
+
+            DB_RECNUM
+                 Support  retrieval  from  btrees  using   record
+                 numbers.    For   more   information,   see  the
+                 DB_SET_RECNO  flag  to  the   DB->get   function
+                 (below),  and  the  cursor  c_get  function  (in
+                 db_cursor(3)).
+
+                 Logical record numbers in btrees are mutable  in
+                 the  face  of record insertion or deletion.  See
+                 the DB_RENUMBER flag in the RECNO section  below
+                 for further discussion.
+
+                 Maintaining   record   counts   within  a  btree
+                 introduces a serious point of contention, namely
+                 the  page  locations where the record counts are
+                 stored.  In addition, the entire  tree  must  be
+                 locked  during  both  insertions  and deletions,
+                 effectively single-threading the tree for  those
+                 operations.   Specifying DB_RECNUM can result in
+                 serious   performance   degradation   for   some
+                 applications and data sets.
+
+                 It  is  an  error  to  specify  both  DB_DUP and
+                 DB_RECNUM.
+
+
+
+

HASH

+       The hash data structure is an extensible, dynamic  hashing
+       scheme.   Backward  compatible interfaces to the functions
+       described in dbm(3), ndbm(3) and hsearch(3) are  provided,
+       however  these interfaces are not compatible with previous
+       file formats.
+
+       The  following  additional  fields  and   flags   may   be
+       initialized   in  the  DB_INFO  structure  before  calling
+       db_open, when using the hash access method:
+
+       u_int32_t h_ffactor;
+            The desired density within the hash table.  It is  an
+            approximation  of  the  number  of  keys  allowed  to
+            accumulate in any one bucket,  determining  when  the
+            hash table grows or shrinks.  The default value is 0,
+            indicating that the  fill  factor  will  be  selected
+            dynamically as pages are filled.
+
+       u_int32_t (*h_hash)(const void *, u_int32_t);
+            The  h_hash field is a user defined hash function; if
+            h_hash is NULL, a  default  hash  function  is  used.
+            Since  no  hash function performs equally well on all
+            possible data, the user may find  that  the  built-in
+            hash  function performs poorly with a particular data
+            set.  User  specified  hash  functions  must  take  a
+            pointer  to  a  byte string and a length as arguments
+            and return a u_int32_t value.
+
+            If a  hash  function  is  specified,  hash_open  will
+            attempt  to  determine if the hash function specified
+            is the same as the one with which  the  database  was
+            created,  and will fail if it detects that it is not.
+
+       u_int32_t h_nelem;
+            An estimate of the final size of the hash table.   If
+            not  set  or  set  too  low,  hash tables will expand
+            gracefully as keys are  entered,  although  a  slight
+            performance  degradation may be noticed.  The default
+            value is 1.
+
+       u_int32_t flags;
+            The following additional flags may  be  specified  by
+            or'ing together one or more of the following values:
+
+            DB_DUP
+                 Permit   duplicate   keys   in  the  tree,  i.e.
+                 insertion when the  key  of  the  key/data  pair
+                 being  inserted  already exists in the tree will
+                 be successful.  The ordering  of  duplicates  in
+                 the   tree   is   determined  by  the  order  of
+                 insertion,  unless  the  ordering  is  otherwise
+                 specified  by  use of a cursor (see db_cursor(3)
+                 for more information.)
+
+
+
+

RECNO

+       The recno access method provides  support  for  fixed  and
+       variable  length records, optionally backed by a flat text
+       (byte  stream)  file.   Both  fixed  and  variable  length
+       records are accessed by their logical record number.
+
+       It is valid to create a record whose record number is more
+       than one greater than the last  record  currently  in  the
+       database.   For  example, the creation of record number 8,
+       when records 6 and 7 do not yet exist, is  not  an  error.
+       However,  any  attempt  to  retrieve  such  records (e.g.,
+       records 6 and 7) will return DB_KEYEMPTY.
+
+       Deleting a record will not, by default,  renumber  records
+       following  the  deleted  record (see DB_RENUMBER below for
+       more  information).   Any  attempt  to  retrieve   deleted
+       records will return DB_KEYEMPTY.
+
+       The   following   additional   fields  and  flags  may  be
+       initialized  in  the  DB_INFO  structure  before   calling
+       db_open, when using the recno access method:
+
+       int re_delim;
+            For variable length records, if the re_source file is
+            specified and  the  DB_DELIMITER  flag  is  set,  the
+            delimiting  byte  used to mark the end of a record in
+            the source file.  If the re_source file is  specified
+            and  the  DB_DELIMITER  flag  is  not  set, <newline>
+            characters (i.e. ``\n'',  0x0a)  are  interpreted  as
+            end-of-record markers.
+
+       u_int32_t re_len;
+            The length of a fixed-length record.
+
+       int re_pad;
+            For  fixed length records, if the DB_PAD flag is set,
+            the pad character for short records.  If  the  DB_PAD
+            flag  is not set, <space> characters (i.e., 0x20) are
+            used for padding.
+
+       char *re_source;
+            The purpose of the re_source field is to provide fast
+            access   and   modification  to  databases  that  are
+            normally stored as flat text files.
+
+            If the re_source field is non-NULL, it  specifies  an
+            underlying  flat  text  database file that is read to
+            initialize a transient record number index.   In  the
+            case  of  variable  length  records,  the records are
+            separated by the byte value re_delim.   For  example,
+            standard UNIX byte stream files can be interpreted as
+            a sequence of variable length  records  separated  by
+            <newline> characters.
+
+            In  addition,  when  cached  data  would  normally be
+            written back to the underlying database  file  (e.g.,
+            the  close  or  sync  functions  are called), the in-
+            memory copy of the database will be written  back  to
+            the re_source file.
+
+            By  default,  the backing source file is read lazily,
+            i.e., records are not read from the file  until  they
+            are   requested  by  the  application.   If  multiple
+            processes  (not  threads)  are  accessing   a   recno
+            database   concurrently   and   either  inserting  or
+            deleting records, the backing  source  file  must  be
+            read  in  its  entirety  before  more  than  a single
+            process accesses the database, and only that  process
+            should specify the backing source file as part of the
+            db_open call.  See the  DB_SNAPSHOT  flag  below  for
+            more information.
+
+            Reading and writing the backing source file specified
+            by  re_source  cannot  be  transactionally  protected
+            because  it  involves  filesystem operations that are
+            not part of the DB transaction methodology.  For this
+            reason,  if  a temporary database is used to hold the
+            records, i.e., a  NULL  was  specified  as  the  file
+            argument  to  db_open,  it  is  possible  to lose the
+            contents of the re_source file, e.g., if  the  system
+            crashes  at  the right instant.  If a file is used to
+            hold the database, i.e., a file name was specified as
+            the   file   argument  to  db_open,  normal  database
+            recovery  on  that  file  can  be  used  to   prevent
+            information  loss, although it is still possible that
+            the contents of re_source will be lost if the  system
+            crashes.
+
+            The  re_source  file  must  already exist (but may be
+            zero-length) when db_open is called.
+
+            For all of the above reasons, the re_source field  is
+            generally  used  to  specify databases that are read-
+            only  for  DB  applications,  and  that  are   either
+            generated  on  the fly by software tools, or modified
+            using a different mechanism, e.g., a text editor.
+
+       u_int32_t flags;
+            The following additional flags may  be  specified  by
+            or'ing together one or more of the following values:
+
+            DB_DELIMITER
+                 The re_delim field is set.
+
+            DB_FIXEDLEN
+                 The   records   are   fixed-length,   not   byte
+                 delimited.    The   structure   element   re_len
+                 specifies  the  length  of  the  record, and the
+                 structure element re_pad  is  used  as  the  pad
+                 character.
+
+                 Any  records added to the database that are less
+                 than re_len bytes long are automatically padded.
+                 Any  attempt to insert records into the database
+                 that are greater than  re_len  bytes  long  will
+                 cause the call to fail immediately and return an
+                 error.
+
+            DB_PAD
+                 The re_pad field is set.
+
+            DB_RENUMBER
+                 Specifying  the  DB_RENUMBER  flag  causes   the
+                 logical record numbers to be mutable, and change
+                 as records are added to  and  deleted  from  the
+                 database.   For  example, the deletion of record
+                 number 4 causes records numbered 5  and  greater
+                 to be renumbered downward by 1.  If a cursor was
+                 positioned  to  record  number  4   before   the
+                 deletion,  it  will  reference  the  new  record
+                 number 4, if any such record exists,  after  the
+                 deletion.   If  a  cursor  was  positioned after
+                 record number 4 before the deletion, it will  be
+                 shifted downward 1 logical record, continuing to
+                 reference the same record as it did before.
+
+                 Using the c_put or put interfaces to create  new
+                 records  will  cause  the  creation  of multiple
+                 records if the record number is  more  than  one
+                 greater than the largest record currently in the
+                 database.  For example, creating record 28, when
+                 record  25 was previously the last record in the
+                 database, will create records 26 and 27 as  well
+                 as  28.   Attempts to retrieve records that were
+                 created in this manner will result in  an  error
+                 return of DB_KEYEMPTY.
+
+                 If  a  created  record  is not at the end of the
+                 database, all records following the  new  record
+                 will  be  automatically  renumbered upward by 1.
+                 For  example,  the  creation  of  a  new  record
+                 numbered 8 causes records numbered 8 and greater
+                 to be renumbered upward by 1.  If a  cursor  was
+                 positioned  to record number 8 or greater before
+                 the insertion,  it  will  be  shifted  upward  1
+                 logical record, continuing to reference the same
+                 record as it did before.
+
+                 For these reasons, concurrent access to a  recno
+                 database with the DB_RENUMBER flag specified may
+                 be   largely   meaningless,   although   it   is
+                 supported.
+
+            DB_SNAPSHOT
+                 This flag specifies that any specified re_source
+                 file be read in its  entirety  when  db_open  is
+                 called.   If  this  flag  is  not specified, the
+                 re_source file may be read lazily.
+
+
+
+

DB OPERATIONS

+       The DB structure returned by db_open describes a  database
+       type,  and  includes a set of functions to perform various
+       actions, as described  below.   Each  of  these  functions
+       takes  a  pointer  to  a DB structure, and may take one or
+       more DBT *'s and a flag value as well.  The fields of  the
+       DB structure are as follows:
+
+       DBTYPE type;
+            The  type  of  the underlying access method (and file
+            format).   Set  to  one  of  DB_BTREE,   DB_HASH   or
+            DB_RECNO.   This  field  may be used to determine the
+            type of the database after a return from db_open with
+            the type argument set to DB_UNKNOWN.
+
+       int (*close)(DB *db, u_int32_t flags);
+            A   pointer   to  a  function  to  flush  any  cached
+            information to disk,  close  any  open  cursors  (see
+            db_cursor(3)),  free  any  allocated  resources,  and
+            close any underlying files.  Since key/data pairs are
+            cached  in  memory, failing to sync the file with the
+            close or sync function may result in inconsistent  or
+            lost information.
+
+            The flags parameter must be set to 0 or the following
+            value:
+
+            DB_NOSYNC
+                 Do not flush cached information to disk.
+
+            The DB_NOSYNC flag is a dangerous option.  It  should
+            only be set 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.
+
+            It  is  important  to understand that flushing cached
+            information to disk  only  minimizes  the  window  of
+            opportunity  for  corrupted data.  While 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 close,
+            replace the original database with the updated  copy.
+
+            When   multiple  threads  are  using  the  DB  handle
+            concurrently, only a single thread may  call  the  DB
+            handle close function.
+
+            The  close  function  returns  the  value of errno on
+            failure and 0 on success.
+
+       int (*cursor)(DB *db, DB_TXN *txnid, DBC **cursorp);
+            A pointer to a function to create a cursor and copy a
+            pointer  to it into the memory referenced by cursorp.
+
+            A cursor is a structure used  to  provide  sequential
+            access  through  a  database.  This interface and its
+            associated  functions  replaces   the   functionality
+            provided  by the seq function in previous releases of
+            the DB library.
+
+            If the  file  is  being  accessed  under  transaction
+            protection,  the  txnid parameter is a transaction ID
+            returned  from  txn_begin,   otherwise,   NULL.    If
+            transaction  protection  is  enabled, cursors must be
+            opened  and  closed   within   the   context   of   a
+            transaction,  and  the  txnid parameter specifies the
+            transaction context in which the cursor may be  used.
+            See db_cursor(3) for more information.
+
+            The  cursor  function  returns  the value of errno on
+            failure and 0 on success.
+
+       int (*del)(DB *db, DB_TXN *txnid, DBT *key, u_int32_t
+            flags);
+            A pointer to a function to remove key/data pairs from
+            the database.  The key/data pair associated with  the
+            specified key is discarded from the database.  In the
+            presence  of  duplicate  key  values,   all   records
+            associated with the designated key will be discarded.
+
+            If the  file  is  being  accessed  under  transaction
+            protection,  the  txnid parameter is a transaction ID
+            returned from txn_begin, otherwise, NULL.
+
+            The flags parameter is currently unused, and must  be
+            set to 0.
+
+            The  del  function  returns  the  value  of  errno on
+            failure,  0  on  success,  and  DB_NOTFOUND  if   the
+            specified key did not exist in the file.
+
+       int (*fd)(DB *db, int *fdp);
+            A pointer to a function that copies a file descriptor
+            representative of the underlying  database  into  the
+            memory   referenced   by   fdp.   A  file  descriptor
+            referencing the same file will  be  returned  to  all
+            processes  that  call  db_open  with  the  same  file
+            argument.  This file descriptor may be safely used as
+            an  argument  to  the  fcntl(2)  and flock(2) locking
+            functions.  The file descriptor  is  not  necessarily
+            associated  with  any of the underlying files used by
+            the access method.
+
+            The fd function only supports a  coarse-grained  form
+            of locking.  Applications should use the lock manager
+            where possible.
+
+            The fd function returns the value of errno on failure
+            and 0 on success.
+
+       int (*get)(DB *db, DB_TXN *txnid,
+                 DBT *key, DBT *data, u_int32_t flags);
+            A  pointer  to  a  function  that is an interface for
+            keyed retrieval from the database.  The  address  and
+            length  of the data associated with the specified key
+            are returned in the structure referenced by data.
+
+            In the presence of duplicate  key  values,  get  will
+            return  the  first  data item for the designated key.
+            Duplicates are sorted by insert  order  except  where
+            this  order has been overridden by cursor operations.
+            Retrieval of duplicates requires the  use  of  cursor
+            operations.  See db_cursor(3) for details.
+
+            If  the  file  is  being  accessed  under transaction
+            protection, the txnid parameter is a  transaction  ID
+            returned from txn_begin, otherwise, NULL.
+
+            The flags parameter must be set to 0 or the following
+            value:
+
+            DB_SET_RECNO
+                 Retrieve the specified  numbered  key/data  pair
+                 from  a database.  Upon return, both the key and
+                 data items will have been filled  in,  not  just
+                 the  data  item as is done for all other uses of
+                 the get function.
+
+                 The data field of the specified key  must  be  a
+                 pointer  to  a  memory  location  from  which  a
+                 db_recno_t  may  be  read,   as   described   in
+                 db_dbt(3).  This memory location will be read to
+                 determine the record to be retrieved.
+
+                 For DB_SET_RECNO to be specified, the underlying
+                 database  must be of type btree and it must have
+                 been  created  with  the  DB_RECNUM  flag   (see
+                 db_open(3)).
+
+            If the database is a recno database and the requested
+            key exists, but was never explicitly created  by  the
+            application  or  was  later deleted, the get function
+            returns DB_KEYEMPTY.  Otherwise, if the requested key
+            isn't  in  the  database,  the  get  function returns
+            DB_NOTFOUND.  Otherwise, the get function returns the
+            value of errno on failure and 0 on success.
+
+       int (*put)(DB *db, DB_TXN *txnid,
+                 DBT *key, DBT *data, u_int32_t flags);
+            A  pointer  to  a function to store key/data pairs in
+            the database.  If the database  supports  duplicates,
+            the  put  function adds the new data value at the end
+            of the duplicate set.
+
+            If the  file  is  being  accessed  under  transaction
+            protection,  the  txnid parameter is a transaction ID
+            returned from txn_begin, otherwise, NULL.
+
+            The flags value is specified by or'ing  together  one
+            or more of the following values:
+
+            DB_APPEND
+                 Append  the  key/data  pair  to  the  end of the
+                 database.  For DB_APPEND to  be  specified,  the
+                 underlying  database must be of type recno.  The
+                 record  number  allocated  to  the   record   is
+                 returned in the specified key.
+
+            DB_NOOVERWRITE
+                 Enter the new key/data pair only if the key does
+                 not already appear in the database.
+
+            The default behavior of the put function is to  enter
+            the  new  key/data  pair,  replacing  any  previously
+            existing key if duplicates are disallowed, or to  add
+            a duplicate entry if duplicates are allowed.  Even if
+            the designated database allows duplicates, a call  to
+            put with the DB_NOOVERWRITE flag set will fail if the
+            key already exists in the database.
+            The put  function  returns  the  value  of  errno  on
+            failure,   0  on  success,  and  DB_KEYEXIST  if  the
+            DB_NOOVERWRITE flag  was  set  and  the  key  already
+            exists in the file.
+
+       int (*sync)(DB *db, u_int32_t flags);
+            A   pointer   to  a  function  to  flush  any  cached
+            information to disk.  If the database  is  in  memory
+            only, the sync function has no effect and will always
+            succeed.
+
+            The flags parameter is currently unused, and must  be
+            set to 0.
+
+            See  the  close  function  description  above  for  a
+            discussion of DB and cached data.
+
+            The sync function  returns  the  value  of  errno  on
+            failure and 0 on success.
+
+       int (*stat)(DB *db, void *sp,
+                 void *(*db_malloc)(size_t), u_int32_t flags);
+            A  pointer  to  a  function  to  create a statistical
+            structure  and  copy  a  pointer  to  it  into  user-
+            specified  memory  locations.  Specifically, if sp is
+            non-NULL,  a  pointer  to  the  statistics  for   the
+            database  are  copied  into  the  memory  location it
+            references.
+
+            Statistical  structures  are  created  in   allocated
+            memory.   If  db_malloc  is non-NULL, it is called to
+            allocate the memory, otherwise, the library  function
+            malloc(3) is used.  The function db_malloc must match
+            the calling  conventions  of  the  malloc(3)  library
+            routine.   Regardless,  the caller is responsible for
+            deallocating the returned memory.  To deallocate  the
+            returned  memory,  free each returned memory pointer;
+            pointers  inside  the  memory  do  not  need  to   be
+            individually freed.
+
+            In  the  presence  of  multiple  threads or processes
+            accessing   an   active   database,   the    returned
+            information may be out-of-date.
+
+            This  function  may  access  all  of the pages in the
+            database,  and   therefore   may   incur   a   severe
+            performance penalty and have obvious negative effects
+            on the underlying buffer pool.
+
+            The flags parameter must be set to 0 or the following
+            value:
+
+            DB_RECORDCOUNT
+                 Fill  in  the  bt_nrecs  field of the statistics
+                 structure,  but  do  not   collect   any   other
+                 information.   This flag makes it reasonable for
+                 applications to request a record  count  from  a
+                 database   without   incurring   a   performance
+                 penalty.   It  is  only  available   for   recno
+                 databases,   or   btree   databases   where  the
+                 underlying  database  was   created   with   the
+                 DB_RECNUM flag.
+
+            The  stat  function  returns  the  value  of errno on
+            failure and 0 on success.
+
+            In the  case  of  a  btree  or  recno  database,  the
+            statistics   are   stored  in  a  structure  of  type
+            DB_BTREE_STAT (typedef'd in <db.h>).   The  following
+            fields will be filled in:
+
+            u_int32_t bt_magic;
+                 Magic number that identifies the file as a btree
+                 file.
+            u_int32_t bt_version;
+                 The version of the btree file type.
+            u_int32_t bt_flags;
+                 Permanent  database  flags,  including   DB_DUP,
+                 DB_FIXEDLEN, DB_RECNUM and DB_RENUMBER.
+            u_int32_t bt_minkey;
+                 The  bt_minkey value specified to db_open(3), if
+                 any.
+            u_int32_t bt_re_len;
+                 The re_len value  specified  to  db_open(3),  if
+                 any.
+            u_int32_t bt_re_pad;
+                 The  re_pad  value  specified  to db_open(3), if
+                 any.
+            u_int32_t bt_pagesize;
+                 Underlying tree page size.
+            u_int32_t bt_levels;
+                 Number of levels in the tree.
+            u_int32_t bt_nrecs;
+                 Number of data items in the  tree  (since  there
+                 may  be multiple data items per key, this number
+                 may not be the same as the number of keys).
+            u_int32_t bt_int_pg;
+                 Number of tree internal pages.
+            u_int32_t bt_leaf_pg;
+                 Number of tree leaf pages.
+            u_int32_t bt_dup_pg;
+                 Number of tree duplicate pages.
+            u_int32_t bt_over_pg;
+                 Number of tree overflow pages.
+            u_int32_t bt_free;
+                 Number of pages on the free list.
+
+            u_int32_t bt_freed;
+                 Number of pages made available for reuse because
+                 they were emptied.
+            u_int32_t bt_int_pgfree;
+                 Number of bytes free in tree internal pages.
+            u_int32_t bt_leaf_pgfree;
+                 Number of bytes free in tree leaf pages.
+            u_int32_t bt_dup_pgfree;
+                 Number of bytes free in tree duplicate pages.
+            u_int32_t bt_over_pgfree;
+                 Number of bytes free in tree overflow pages.
+            u_int32_t bt_pfxsaved;
+                 Number of bytes saved by prefix compression.
+            u_int32_t bt_split;
+                 Total  number of tree page splits (includes fast
+                 and root splits).
+            u_int32_t bt_rootsplit;
+                 Number of root page splits.
+            u_int32_t bt_fastsplit;
+                 Number of fast splits.   When  sorted  keys  are
+                 added    to   the   database,   the   DB   btree
+                 implementation  will  split  left  or  right  to
+                 increase the page-fill factor.  This number is a
+                 measure of how often it  was  possible  to  make
+                 such a split.
+            u_int32_t bt_added;
+                 Number of keys added.
+            u_int32_t bt_deleted;
+                 Number of keys deleted.
+            u_int32_t bt_get;
+                 Number  of  keys  retrieved.   (Note, this value
+                 will not reflect any  keys  retrieved  when  the
+                 database was open for read-only access, as there
+                 is  no   permanent   location   to   store   the
+                 information in this case.)
+            u_int32_t bt_cache_hit;
+                 Number  of  hits in tree fast-insert code.  When
+                 sorted keys are added to the  database,  the  DB
+                 btree  implementation  will  check the last page
+                 where an insert occurred  before  doing  a  full
+                 lookup.   This  number is a measure of how often
+                 the lookup was successful.
+            u_int32_t bt_cache_miss;
+                 Number of misses in tree fast-insert code.   See
+                 the  description of bt_cache_hit; this number is
+                 a measure of how often the lookup failed.
+
+
+
+

ENVIRONMENT VARIABLES

+       The following environment variables affect  the  execution
+       of db_open:
+
+       DB_HOME
+            If  the  dbenv  argument  to  db_open was initialized
+            using db_appinit, the  environment  variable  DB_HOME
+            may  be used as the path of the database home for the
+            interpretation of the dir  argument  to  db_open,  as
+            described in db_appinit(3).  Specifically, db_open is
+            affected  by  the  configuration  string   value   of
+            DB_DATA_DIR.
+
+
+
+

EXAMPLES

+       Applications  that  create  short-lived databases that are
+       discarded or recreated  when  the  system  fails  and  are
+       unconcerned with concurrent access and loss of data due to
+       catastrophic  failure,  may  wish  to  use   the   db_open
+       functionality without other parts of the DB library.  Such
+       applications will only be concerned  with  the  DB  access
+       methods.   The  DB access methods will use the memory pool
+       subsystem, but the application is unlikely to be aware  of
+       this.     See    the    files    example/ex_access.c   and
+       example/ex_btrec.c in the DB  source  distribution  for  C
+       language  code examples of how such applications might use
+       the DB library.
+
+
+
+

ERRORS

+       The db_open function may fail and return errno for any  of
+       the  errors  specified  for  the  following DB and library
+       functions: DB->sync(3), calloc(3), close(2), fcntl(2),
+       fflush(3), lock_get(3), lock_id(3), lock_put(3),
+       lock_vec(3), log_put(3), log_register(3),
+       log_unregister(3), malloc(3), memcpy(3), memmove(3),
+       memp_close(3), memp_fclose(3), memp_fget(3),
+       memp_fopen(3), memp_fput(3), memp_fset(3), memp_fsync(3),
+       memp_open(3), memp_register(3), memset(3), mmap(2),
+       munmap(2), open(2), read(2), realloc(3), sigfillset(3),
+       sigprocmask(2), stat(2), strcpy(3), strdup(3),
+       strerror(3), strlen(3), time(3), and unlink(2).
+
+       In  addition,  the  db_open  function  may fail and return
+       errno for the following conditions:
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EINVAL]
+            An invalid flag  value  or  parameter  was  specified
+            (e.g.,   unknown   database  type,  page  size,  hash
+            function, recno pad byte, byte order) or a flag value
+            or  parameter  that  is incompatible with the current
+            file specification.
+
+            The DB_THREAD flag was specified  and  spinlocks  are
+            not implemented for this architecture.
+
+            There  is  a  mismatch  between the version number of
+            file and the software.
+
+            A  re_source  file  was  specified  with  either  the
+            DB_THREAD  flag  or  a  non-NULL tx_info field in the
+            DB_ENV argument to db_open.
+
+       [ENOENT]
+            A non-existent re_source file was specified.
+
+       [EPERM]
+            Database corruption  was  detected.   All  subsequent
+            database  calls  (other  than  DB->close) will return
+            EPERM.
+
+       The DB->close function may fail and return errno  for  any
+       of  the  errors specified for the following DB and library
+       functions: DB->sync(3), calloc(3), close(2), fflush(3),
+       lock_get(3), lock_put(3), lock_vec(3), log_put(3),
+       log_unregister(3), malloc(3), memcpy(3), memmove(3),
+       memp_close(3), memp_fclose(3), memp_fget(3), memp_fput(3),
+       memp_fset(3), memp_fsync(3), memset(3), munmap(2),
+       realloc(3), and strerror(3).
+
+       The  DB->cursor function may fail and return errno for any
+       of the errors specified for the following DB  and  library
+       functions: calloc(3).
+
+       In  addition,  the DB->cursor function may fail and return
+       errno for the following conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       [EPERM]
+            Database corruption  was  detected.   All  subsequent
+            database  calls  (other  than  DB->close) will return
+            EPERM.
+
+       The DB->del function may fail and return errno for any  of
+       the  errors  specified  for  the  following DB and library
+       functions: calloc(3), fcntl(2), fflush(3), lock_get(3),
+       lock_id(3), lock_put(3), lock_vec(3), log_put(3),
+       malloc(3), memcmp(3), memcpy(3), memmove(3), memp_fget(3),
+       memp_fput(3), memp_fset(3), memset(3), realloc(3), and
+       strerror(3).
+
+       In addition, the DB->del  function  may  fail  and  return
+       errno for the following conditions:
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       [EPERM]
+            Database  corruption  was  detected.   All subsequent
+            database calls (other  than  DB->close)  will  return
+            EPERM.
+
+       In addition, the DB->fd function may fail and return errno
+       for the following conditions:
+
+       [ENOENT]
+            The DB->fd  function  was  called  for  an  in-memory
+            database, or no underlying file has yet been created.
+
+       [EPERM]
+            Database corruption  was  detected.   All  subsequent
+            database  calls  (other  than  DB->close) will return
+            EPERM.
+
+       The DB->get function may fail and return errno for any  of
+       the  errors  specified  for  the  following DB and library
+       functions: DBcursor->c_get(3), calloc(3), fcntl(2),
+       fflush(3), lock_get(3), lock_id(3), lock_put(3),
+       lock_vec(3), log_put(3), malloc(3), memcmp(3), memcpy(3),
+       memmove(3), memp_fget(3), memp_fput(3), memp_fset(3),
+       memset(3), realloc(3), and strerror(3).
+
+       In addition, the DB->get  function  may  fail  and  return
+       errno for the following conditions:
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The  DB_THREAD  flag  was specified to the db_open(3)
+            function   and   neither   the    DB_DBT_MALLOC    or
+            DB_DBT_USERMEM flags were set in the DBT.
+
+            A record number of 0 was specified.
+
+       [EPERM]
+            Database  corruption  was  detected.   All subsequent
+            database calls (other  than  DB->close)  will  return
+            EPERM.
+
+       The  DB->put function may fail and return errno for any of
+       the errors specified for  the  following  DB  and  library
+       functions: calloc(3), fcntl(2), fflush(3), lock_get(3),
+       lock_id(3), lock_put(3), lock_vec(3), log_put(3),
+       malloc(3), memcmp(3), memcpy(3), memmove(3), memp_fget(3),
+       memp_fput(3), memp_fset(3), memset(3), realloc(3), and
+       strerror(3).
+
+       In  addition,  the  DB->put  function  may fail and return
+       errno for the following conditions:
+
+       [EACCES]
+            An attempt was made to modify a read-only database.
+
+       [EAGAIN]
+            A lock was unavailable.
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            A record number of 0 was specified.
+
+            An attempt was made to add a record to a fixed-length
+            database that was too large to fit.
+
+            An attempt was made to do a partial put.
+
+       [EPERM]
+            Database  corruption  was  detected.   All subsequent
+            database calls (other  than  DB->close)  will  return
+            EPERM.
+
+       [ENOSPC]
+            A btree exceeded the maximum btree depth (255).
+
+       The DB->stat function may fail and return errno for any of
+       the errors specified for  the  following  DB  and  library
+       functions: calloc(3), fcntl(2), fflush(3), lock_get(3),
+       lock_id(3), lock_put(3), lock_vec(3), malloc(3),
+       memcpy(3), memp_fget(3), memp_fput(3), and memset(3).
+
+       The DB->sync function may fail and return errno for any of
+       the errors specified for  the  following  DB  and  library
+       functions: DB->get(3), DB->sync(3), calloc(3), close(2),
+       fcntl(2), fflush(3), lock_get(3), lock_id(3), lock_put(3),
+       lock_vec(3), log_put(3), malloc(3), memcpy(3), memmove(3),
+       memp_fget(3), memp_fput(3), memp_fset(3), memp_fsync(3),
+       memset(3), munmap(2), open(2), realloc(3), strerror(3),
+       unlink(2), and write(2).
+
+       In addition, the DB->sync function  may  fail  and  return
+       errno for the following conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       [EPERM]
+            Database  corruption  was  detected.   All subsequent
+            database calls (other  than  DB->close)  will  return
+            EPERM.
+
+
+
+

SEE ALSO

+       The  Ubiquitous  B-tree,  Douglas Comer, ACM Comput. Surv.
+       11, 2 (June 1979), 121-138.
+
+       Prefix B-trees, Bayer and Unterauer, ACM  Transactions  on
+       Database Systems, Vol. 2, 1 (March 1977), 11-26.
+
+       The  Art  of  Computer  Programming  Vol.  3:  Sorting and
+       Searching, D.E. Knuth, 1968, pp 471-480.
+
+       Dynamic Hash Tables, Per-Ake Larson, Communications of the
+       ACM, April 1988.
+
+       A  New  Hash  Package  for  UNIX,  Margo  Seltzer,  USENIX
+       Proceedings, Winter 1991.
+
+       Document  Processing  in  a  Relational  Database  System,
+       Michael   Stonebraker,   Heidi  Stettner,  Joseph  Kalash,
+       Antonin  Guttman,  Nadene  Lynn,  Memorandum  No.  UCB/ERL
+       M82/32, May 1982.
+
+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_appinit(3), db_cursor(3), db_dbm(3), db_internal(3),
+       db_lock(3), db_log(3), db_mpool(3), db_open(3), db_thread(3),
+       db_txn(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/db_recover.html b/mozilla/db/man/man.html/db_recover.html new file mode 100644 index 00000000000..a54d386d3d0 --- /dev/null +++ b/mozilla/db/man/man.html/db_recover.html @@ -0,0 +1,190 @@ + + +db_recover + + +

db_recover

+
+
+
+       db_recover [-cv] [-h home]
+
+
+
+

DESCRIPTION

+       The  db_recover  utility  must  be run after an unexpected
+       application, DB, or system failure to restore the database
+       to  a  consistent  state.   All committed transactions are
+       guaranteed to appear after db_recover  has  run,  and  all
+       uncommitted transactions will be completely undone.
+
+       The options are as follows:
+
+       -c   Failure was catastrophic.
+
+       -h   Specify a home directory for the database.
+
+       -v   Run in verbose mode.
+
+       In  the case of catastrophic failure, an archival copy, or
+       ``snapshot'' of all database files must be restored  along
+       with  all of the log files written since the database file
+       snapshot was made.  (If disk space is a problem, log files
+       may   be  referenced  by  symbolic  links).   For  further
+       information on creating  a  database  snapshot,  see  ``DB
+       ARCHIVAL PROCEDURES'' in db_archive(1).
+
+       If  the failure was not catastrophic, the files present on
+       the system at  the  time  of  failure  are  sufficient  to
+       perform recovery.
+
+       If  log  files  are  missing, db_recover will identify the
+       missing log file(s) and fail, in which  case  the  missing
+       log  files  need  to  be  restored  and recovery performed
+       again.
+
+       The  db_recover  utility  attaches  to  DB  shared  memory
+       regions.   In  order to avoid region corruption, it should
+       always be given the chance to detach and exit  gracefully.
+       To  cause  db_recover  to  clean up after itself and exit,
+       send it an interrupt signal (SIGINT).
+
+       The db_recover utility exits 0 on success, and  >0  if  an
+       error occurs.
+
+
+
+

FILESYSTEM OPERATIONS

+       Filesystem   operations,   e.g.,   moving   the   database
+       environment to  a  different  machine  or  file  creation,
+       deletion  or  renaming,  cannot  be transaction protected.
+       For this reason, db_recover cannot  re-create,  delete  or
+       rename files as part of recovery.
+
+       If  db_recover  cannot  find a database file referenced in
+       the log, it will output a  warning  message  that  it  was
+       unable to locate a file it expected to find.  This message
+       is only a warning, as the file may have subsequently  been
+       deleted  as  part of normal database operations before the
+       failure occurred.  Note that committed  transactions  that
+       involved  these  missing  files  are  rolled forward, even
+       though the files were not found.  If the  files  were  not
+       intentionally  deleted  (e.g., they were created after the
+       last database snapshot, but were lost during  a  failure),
+       they  must  be  manually  created  (using db_open(3)), and
+       db_recover must be rerun.
+
+       Generally, it is simplest to perform filesystem operations
+       at the same time as making a snapshot of the database.  To
+       perform filesystem operations:
+
+              1.   Cleanly shutdown database operations.
+              2.   Rename, create or delete files.
+              3.   Make a snapshot of the database.
+              4.   Restart database applications.
+
+       To cleanly shutdown database operations, all  applications
+       accessing  the  database environment must be shutdown.  If
+       the applications are not implemented such that they can be
+       shutdown  gracefully  (i.e., closing all references to the
+       database environment), db_recover must be  run  after  all
+       applications   have   been   killed  to  ensure  that  the
+       underlying database is consistent and flushed to disk.
+
+
+
+

RECOVERY

+       After an application or  system  failure,  there  are  two
+       possible  approaches to database recovery.  If there is no
+       need to retain state across the failure, and all databases
+       can  be  started  anew,  the  database  home directory can
+       simply be removed and recreated.  If it  is  necessary  to
+       retain   persistent   state   across  failures,  then  the
+       db_recover(1)  utility  should  be   run   for   each   DB
+       application   environment,   i.e.,   each   database  home
+       directory.
+
+       The db_recover utility will remove all the shared  regions
+       (which  may have been corrupted by the failure), establish
+       the end of the log by identifying the last record  written
+       to   the  log,  and  then  perform  transaction  recovery.
+       Database applications must not be restarted until recovery
+       completes.   During transaction recovery, all changes made
+       by aborted transactions are undone and all changes made by
+       committed  transactions  are  redone, as necessary.  After
+       recovery runs, the environment is properly initialized  so
+       that   applications   may   be  restarted.   Any  time  an
+       application crashes or the system fails, db_recover should
+       be run on any exiting database environments.
+
+       Additionally,  there  are  two  forms  of recovery: normal
+       recovery  and  catastrophic  recovery.   The  DB   package
+       defines  catastrophic  failure  to be failure where either
+       the database or log files have been destroyed or corrupted
+       from  the  point  of view of the filesystem.  For example,
+       catastrophic failure includes  the  case  where  the  disk
+       drive  on which either the database or logs are stored has
+       crashed, or when filesystem recovery is  unable  to  bring
+       the  database  and  log  files  to a consistent state with
+       respect  to  the  filesystem.   If  the  failure  is  non-
+       catastrophic,   i.e.,  the  database  files  and  log  are
+       accessible on a filesystem  that  has  recovered  cleanly,
+       db_recover  will  review  the  logs  and database files to
+       ensure that all committed transactions appear and that all
+       uncommitted  transactions  are  undone.  If the failure is
+       catastrophic, a snapshot of the  database  files  and  the
+       archived log files must be restored onto the system.  Then
+       db_recover will review the  logs  and  database  files  to
+       bring the database to a consistent state as of the date of
+       the last archived log file.  Only  transactions  committed
+       before  that  date  will  appear  in  the  database.   See
+       db_archive (1) for specific  information  about  archiving
+       and recovering databases after catastrophic failure.
+
+
+
+

ENVIRONMENT VARIABLES

+       The  following  environment variables affect the execution
+       of db_recover:
+
+       DB_HOME
+            If the -h option is not specified and the environment
+            variable  DB_HOME  is  set, it is used as the path of
+            the database home, as described in db_appinit(3).
+
+
+
+

BUGS

+       Future  versions  of  DB  are  expected  to   remove   the
+       restriction  that  database files must be manually created
+       before recovery is performed.
+
+
+
+

SEE ALSO

+       The DB library is a family of  groups  of  functions  that
+       provides  a  modular programming interface to transactions
+       and record-oriented file  access.   The  library  includes
+       support  for  transactions, locking, logging and file page
+       caching, as well as various indexed access methods.   Many
+       of  the  functional  groups  (e.g.,  the file page caching
+       functions)  are  useful  independent  of  the   other   DB
+       functions,  although some functional groups are explicitly
+       based on other functional groups (e.g.,  transactions  and
+       logging).   For  a  general description of the DB package,
+       see db_intro(3).
+
+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_appinit(3), db_cursor(3), db_dbm(3), db_internal(3),
+       db_lock(3), db_log(3), db_mpool(3), db_open(3), db_thread(3),
+       db_txn(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/db_stat.html b/mozilla/db/man/man.html/db_stat.html new file mode 100644 index 00000000000..c3d1eb9047a --- /dev/null +++ b/mozilla/db/man/man.html/db_stat.html @@ -0,0 +1,116 @@ + + +db_stat + + +

db_stat

+
+
+
+       db_stat [-clmNt]
+            [-C Acfhlmo] [-d file] [-h home] [-M Ahlm]
+
+
+
+

DESCRIPTION

+       The   db_stat   utility   displays   statistics   for   DB
+       environments.
+
+       The options are as follows:
+
+       -C   Display internal information about the  lock  region.
+            (The output from this option is often both voluminous
+            and meaningless, and is intended only for debugging.)
+
+            -A   Display all information.
+            -c   Display lock conflict matrix.
+            -f   Display lock and object free lists.
+            -l   Display lockers within hash chains.
+            -m   Display region memory information.
+            -o   Display objects within hash chains.
+
+       -c   Display   lock  region  statistics  as  described  in
+            db_lock(3).
+
+       -d   Display  database  statistics   for   the   specified
+            database, as described in db_open(3).
+
+       -h   Specify a home directory for the database.
+
+       -l   Display   log   region  statistics  as  described  in
+            db_log(3).
+
+       -M   Display internal information about the shared  memory
+            buffer  pool.   (The output from this option is often
+            both voluminous and meaningless, and is intended only
+            for debugging.)
+
+            -A   Display all information.
+            -h   Display buffers within hash chains.
+            -l   Display buffers within LRU chains.
+            -m   Display region memory information.
+
+       -m   Display  shared  memory  buffer  pool  statistics  as
+            described in db_mpool(3).
+
+       -N   Don't acquire locks while displaying the  statistics.
+            This  option  is  intended only for debugging corrupt
+            regions and  should  not  be  used  under  any  other
+            circumstances.
+
+       -t   Display transaction region statistics as described in
+            db_txn(3).
+
+       The db_stat utility attaches to DB shared memory  regions.
+       In  order  to avoid region corruption, it should always be
+       given the chance to detach and exit gracefully.  To  cause
+       db_stat  to  clean  up  after  itself and exit, send it an
+       interrupt signal (SIGINT).
+
+       Values smaller than 10  million  are  generally  displayed
+       without  any  special  notation.   Values  larger  than 10
+       million are normally displayed as ``<number>M''.
+
+       The db_stat utility exits 0 on success, and >0 if an error
+       occurs.
+
+
+
+

ENVIRONMENT VARIABLES

+       The  following  environment variables affect the execution
+       of db_stat:
+
+       DB_HOME
+            If the -h option is not specified and the environment
+            variable  DB_HOME  is  set, it is used as the path of
+            the database home, as described in db_appinit(3).
+
+
+
+

SEE ALSO

+       The DB library is a family of  groups  of  functions  that
+       provides  a  modular programming interface to transactions
+       and record-oriented file  access.   The  library  includes
+       support  for  transactions, locking, logging and file page
+       caching, as well as various indexed access methods.   Many
+       of  the  functional  groups  (e.g.,  the file page caching
+       functions)  are  useful  independent  of  the   other   DB
+       functions,  although some functional groups are explicitly
+       based on other functional groups (e.g.,  transactions  and
+       logging).   For  a  general description of the DB package,
+       see db_intro(3).
+
+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_appinit(3), db_cursor(3), db_dbm(3), db_internal(3),
+       db_lock(3), db_log(3), db_mpool(3), db_open(3), db_thread(3),
+       db_txn(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/db_thread.html b/mozilla/db/man/man.html/db_thread.html new file mode 100644 index 00000000000..06a45928d82 --- /dev/null +++ b/mozilla/db/man/man.html/db_thread.html @@ -0,0 +1,151 @@ + + +db_thread + + +

db_thread

+
+
+
+       The  DB  library  is  a family of groups of functions that
+       provides a modular programming interface  to  transactions
+       and  record-oriented  file  access.   The library includes
+       support for transactions, locking, logging and  file  page
+       caching,  as well as various indexed access methods.  Many
+       of the functional groups  (e.g.,  the  file  page  caching
+       functions)   are   useful  independent  of  the  other  DB
+       functions, although some functional groups are  explicitly
+       based  on  other functional groups (e.g., transactions and
+       logging).  For a general description of  the  DB  package,
+       see db_intro(3).
+
+       This  manual pages describes the specific details of using
+       DB from within threaded programs.
+
+       The DB library is not itself multi-threaded.  The  library
+       was deliberately architected to not use threads internally
+       because of the portability  problems  that  using  threads
+       within   the  library  would  introduce.   Object  handles
+       returned from  DB  library  functions  are  free-threaded,
+       i.e.,  threads may use handles concurrently, by specifying
+       the DB_THREAD flag to db_appinit(3) (or, in the  C++  API,
+       DbEnv::appinit(3)) and the other subsystem open functions.
+       Threading is assumed in the Java API, so no special  flags
+       are  required,  and  DB functions will always behave as if
+       the DB_THREAD flag was specified.
+
+       DB supports multi-threaded applications  with  the  caveat
+       that  it  loads  and  calls  functions  that  are commonly
+       available in C language environments  and  which  may  not
+       themselves  be thread-safe.  Other than this usage, DB has
+       no static data and  maintains  no  local  context  between
+       calls  to  DB  functions.  To ensure that applications can
+       safely use threads in the context of DB,  porters  to  new
+       operating systems and/or C libraries must confirm that the
+       system and C library functions used by the DB library  are
+       thread-safe.
+
+       There  are  some additional caveats about using threads to
+       access the DB library:
+
+       o The DB_THREAD flag must be specified for all  subsystems
+         either explicitly or via the db_appinit (DbEnv::appinit)
+         function in the C and C++ APIs.  Threading is assumed in
+         the  Java  API, so no special flags are required, and DB
+         functions will always behave as if  the  DB_THREAD  flag
+         was specified.
+
+         Setting  the DB_THREAD flag inconsistently may result in
+         database corruption.
+
+       o Only a single thread may call the close function  for  a
+         returned  database  or subsystem handle.  See db_open(3)
+         (Db::open(3)) and the appropriate subsystem manual pages
+         for more information.
+
+       o Either the DB_DBT_MALLOC or DB_DBT_USERMEM flags must be
+         set in a DBT  used  for  key  or  data  retrieval.   See
+         db_dbt(3) (Dbt(3)) for more information.
+
+       o The DB_CURRENT, DB_NEXT and DB_PREV flags to the log_get
+         (DbLog::get) function may not be used by a free-threaded
+         handle.   If  such  calls are necessary, a thread should
+         explicitly create a  unique  DB_LOG  handle  by  calling
+         log_open(3) (DbLog::open).  See db_log(3) (DbLog(3)) for
+         more information.
+
+       o Each database operation (i.e., any call  to  a  function
+         underlying   the  handles  returned  by  db_open(3)  and
+         db_cursor(3)) (Db(3) and Dbc(3)) is  normally  performed
+         on  behalf  of  a  unique  locker.   If, within a single
+         thread of control, multiple calls on behalf of the  same
+         locker are desired, then transactions must be used.  For
+         example, consider the case where a cursor scan locates a
+         record,  and  then  based  on that record, accesses some
+         other item in the database.  If these are done using the
+         default  lockers  for  the handle, there is no guarantee
+         that these two operations will  not  conflict.   If  the
+         application  wishes  to guarantee that the operations do
+         not conflict, locks must be  obtained  on  behalf  of  a
+         transaction,  instead  of  the  default locker id, and a
+         transaction must be specified to the cursor creation and
+         the subsequent db call.
+
+       o Transactions   may   not   span   threads,   i.e.,  each
+         transaction must begin and end in the same  thread,  and
+         each transaction may only be used by a single thread.
+
+       o Spinlocks   must   have   been   implemented   for   the
+         compiler/architecture   combination.    Attempting    to
+         specify  the  DB_THREAD  flag will fail if spinlocks are
+         not available.
+
+       o The DB library makes a system call  to  pause  for  some
+         number of microseconds when it is necessary to wait on a
+         lock.  This may not be optimal, especially in a  thread-
+         only  environment  where  it  will  be more efficient to
+         explicitly yield the processor to another thread.  It is
+         possible   to  specify  a  yield  function  on  an  per-
+         application   basis,   see   db_jump_set(3)   for   more
+         information.
+
+
+
+

COMPILING THREADED APPLICATIONS

+       Special  compile-time  flags  are  required when compiling
+       threaded applications with the UNIX include files on  some
+       architectures.
+
+       On  IRIX, if you are compiling a threaded application, you
+       must compile with the -D_SGI_MP_SOURCE flag:
+
+            cc -D_SGI_MP_SOURCE ...
+
+       On OSF/1, if you are compiling a threaded application, you
+       must compile with the -D_REENTRANT flag:
+
+            cc -D_REENTRANT ...
+
+       On  Solaris,  if you are compiling a threaded application,
+       you must compile with the -D_REENTRANT flag and link  with
+       the -lthread library:
+
+            cc -D_REENTRANT ... -lthread
+
+
+
+

SEE ALSO

+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_appinit(3), db_cursor(3), db_dbm(3), db_internal(3),
+       db_lock(3), db_log(3), db_mpool(3), db_open(3), db_thread(3),
+       db_txn(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/db_txn.html b/mozilla/db/man/man.html/db_txn.html new file mode 100644 index 00000000000..13e80844d83 --- /dev/null +++ b/mozilla/db/man/man.html/db_txn.html @@ -0,0 +1,720 @@ + + +db_txn + + +

db_txn

+
+
+
+       #include <db.h>
+
+       int
+       txn_open(const char *dir,
+            u_int32_t flags, int mode, DB_ENV *dbenv, DB_TXNMGR **regionp);
+
+       int
+       txn_begin(DB_TXNMGR *txnp, DB_TXN *pid, DB_TXN **tid);
+
+       int
+       txn_prepare(DB_TXN *tid);
+
+       int
+       txn_commit(DB_TXN *tid);
+
+       int
+       txn_abort(DB_TXN *tid);
+
+       u_int32_t
+       txn_id(DB_TXN *tid);
+
+       int
+       txn_checkpoint(const DB_TXNMGR *txnp, u_int32_t kbyte, u_int32_t min);
+
+       int
+       txn_close(DB_TXNMGR *txnp);
+
+       int
+       txn_unlink(const char *dir, int force, DB_ENV *dbenv);
+
+       int
+       txn_stat(DB_TXNMGR *txnp,
+            DB_TXN_STAT **statp, void *(*db_malloc)(size_t));
+
+
+
+

DESCRIPTION

+       The  DB  library  is  a family of groups of functions that
+       provides a modular programming interface  to  transactions
+       and  record-oriented  file  access.   The library includes
+       support for transactions, locking, logging and  file  page
+       caching,  as well as various indexed access methods.  Many
+       of the functional groups  (e.g.,  the  file  page  caching
+       functions)   are   useful  independent  of  the  other  DB
+       functions, although some functional groups are  explicitly
+       based  on  other functional groups (e.g., transactions and
+       logging).  For a general description of  the  DB  package,
+       see db_intro(3).
+
+       This  manual page describes the specific details of the DB
+       transaction support.
+
+       The  db_txn  functions  are  the  library  interface  that
+       provides  transaction semantics.  Full transaction support
+       is provided  by  a  collection  of  modules  that  provide
+       interfaces   to  the  services  required  for  transaction
+       processing.  These services are recovery (see  db_log(3)),
+       concurrency  control  (see db_lock(3)), and the management
+       of shared data (see db_mpool(3)).   Transaction  semantics
+       can   be  applied  to  the  access  methods  described  in
+       db_open(3) through function call parameters.
+
+       The model intended for transactional use (and the one that
+       is  used  by  the  access  methods) is write-ahead logging
+       provided by db_log(3) to record both  before-  and  after-
+       images.   Locking  follows  a two-phase protocol, with all
+       locks being released at transaction commit.
+
+  txn_open
+       The txn_open function copies a pointer, to the transaction
+       region  identified  by  the directory dir, into the memory
+       location referenced by regionp.
+
+       If the dbenv argument to txn_open  was  initialized  using
+       db_appinit,   dir   is   interpreted   as   described   by
+       db_appinit(3).
+
+       Otherwise, if dir is not NULL, it is interpreted  relative
+       to  the  current working directory of the process.  If dir
+       is NULL, the following environment variables  are  checked
+       in  order:  ``TMPDIR'',  ``TEMP'', and ``TMP''.  If one of
+       them is set, transaction region files are created relative
+       to  the  directory it specifies.  If none of them are set,
+       the first possible one of  the  following  directories  is
+       used: /var/tmp, /usr/tmp, /temp, /tmp, C:/temp and C:/tmp.
+
+       All files  associated  with  the  transaction  region  are
+       created  in  this  directory.  This directory must already
+       exist when
+
+       transaction region_open is  called.   If  the  transaction
+       region already exists, the process must have permission to
+       read and write the existing  files.   If  the  transaction
+       region  does  not  already exist, it is optionally created
+       and initialized.
+
+       The flags and mode arguments specify  how  files  will  be
+       opened  and/or created when they don't already exist.  The
+       flags value is specified by or'ing together one or more of
+       the following values:
+
+       DB_CREATE
+            Create  any  underlying  files, as necessary.  If the
+            files do not already exist and the DB_CREATE flag  is
+            not specified, the call will fail.
+
+       DB_THREAD
+            Cause  the  DB_TXNMGR handle returned by the txn_open
+            function to be useable by multiple threads  within  a
+            single  address space, i.e., to be ``free-threaded''.
+
+       DB_TXN_NOSYNC
+            On transaction commit, do not synchronously flush the
+            log.   This  means  that transactions exhibit the ACI
+            (atomicity, consistency  and  isolation)  properties,
+            but not D (durability), i.e., database integrity will
+            be maintained but it is possible that some number  of
+            the  most  recently  committed  transactions  may  be
+            undone during recovery instead of being redone.
+
+            The number of transactions that  are  potentially  at
+            risk is governed by how often the log is checkpointed
+            (see db_checkpoint(1)) and how many log  updates  can
+            fit on a single log page.
+
+       All files created by the transaction subsystem are created
+       with mode mode (as described in chmod(2)) and modified  by
+       the  process'  umask  value  at  the time of creation (see
+       umask(2)).  The group ownership of created files is  based
+       on  the  system and directory defaults, and is not further
+       specified by DB.
+
+       The transaction subsystem is configured based on the dbenv
+       argument to txn_open, which is a pointer to a structure of
+       type DB_ENV  (typedef'd  in  <db.h>).   Applications  will
+       normally  use  the  same  DB_ENV structure (initialized by
+       db_appinit(3)), as an argument to all of the subsystems in
+       the DB package.
+
+       References  to  the DB_ENV structure are maintained by DB,
+       so it may not be discarded until the last close  function,
+       corresponding  to  an  open  function  for which it was an
+       argument, has returned.  In order to ensure  compatibility
+       with  future  releases  of  DB,  all  fields of the DB_ENV
+       structure  that  are  not   explicitly   set   should   be
+       initialized  to  0  before the first time the structure is
+       used.  Do this by  declaring  the  structure  external  or
+       static,  or  by  calling the C library routine bzero(3) or
+       memset(3).
+
+       The fields of the DB_ENV structure used  by  txn_open  are
+       described  below.   If  dbenv is NULL or any of its fields
+       are set to 0, defaults appropriate for the system are used
+       where possible.
+
+       The  following  fields  in  the  DB_ENV  structure  may be
+       initialized before calling txn_open:
+
+       void *(*db_errcall)(char *db_errpfx, char *buffer);
+       FILE *db_errfile;
+       const char *db_errpfx;
+       int db_verbose;
+            The error fields of the DB_ENV  behave  as  described
+            for db_appinit(3).
+
+       DB_LOG *lg_info;
+            The  logging  region  that  is  being  used  for this
+            transaction environment.  The lg_info field  contains
+            a  return  value from the function log_open.  Logging
+            is required for transaction environments, and  it  is
+            an error to not specify a logging region.
+
+       DB_LOCKTAB *lk_info;
+            The  locking  region  that  is  being  used  for this
+            transaction environment.  The lk_info field  contains
+            a  return  value  from  the  function  lock_open.  If
+            lk_info  is  NULL,  no  locking  is  done   in   this
+            transaction environment.
+
+       u_int32_t tx_max;
+            The  maximum number of simultaneous transactions that
+            are supported.  This bounds the size of backing files
+            and is used to derive limits for the size of the lock
+            region and logfiles.  When there are more than tx_max
+            concurrent transactions, calls to txn_begin may cause
+            backing files to grow.  If tx_max  is  0,  a  default
+            value is used.
+
+       int (*tx_recover)(DB_LOG *logp, DBT *log_rec,
+                 DB_LSN *lsnp, int redo, void *info);
+            A   function  that  is  called  by  txn_abort  during
+            transaction  abort.    This   function   takes   five
+            arguments:
+
+            logp A pointer to the transaction log (DB_LOG *).
+
+            log_rec
+                 A log record.
+
+            lsnp A pointer to a log sequence number (DB_LSN *).
+
+            redo An  integer  value  that  is  set  to one of the
+                 following values:
+
+                 DB_TXN_BACKWARD_ROLL
+                      The log is being read backward to determine
+                      which  transactions have been committed and
+                      which transactions  were  not  (and  should
+                      therefore be aborted during recovery).
+
+                 DB_TXN_FORWARD_ROLL
+                      The   log  is  being  played  forward,  any
+                      transaction ids encountered that  have  not
+                      been  entered  into  the list referenced by
+                      info should be ignored.
+
+                 DB_TXN_OPENFILES
+                      The log is being read to open all the files
+                      required to perform recovery.
+
+                 DB_TXN_REDO
+                      Redo  the  operation  described  by the log
+                      record.
+
+                 DB_TXN_UNDO
+                      Undo the operation  described  by  the  log
+                      record.
+
+            info An  opaque pointer used to reference the list of
+                 transaction IDs encountered during recovery.
+
+            If recover is NULL,  the  default  is  that  only  DB
+            access  method  operations are transaction protected,
+            and the default recover function will be used.
+
+       The txn_open  function  returns  the  value  of  errno  on
+       failure and 0 on success.
+
+  txn_begin
+       The  txn_begin  function  creates a new transaction in the
+       designated transaction manager, copying  a  pointer  to  a
+       DB_TXN   that  uniquely  identifies  it  into  the  memory
+       referenced by tid.  If the pid argument is  non-NULL,  the
+       new   transaction   is   a  nested  transaction  with  the
+       transaction indicated by pid as its parent.
+
+       Transactions may not span threads, i.e., each  transaction
+       must   begin   and  end  in  the  same  thread,  and  each
+       transaction may only be used by a single thread.
+
+       The txn_begin function  returns  the  value  of  errno  on
+       failure and 0 on success.
+
+  txn_prepare
+       The  txn_prepare function initiates the beginning of a two
+       phase commit.  In a distributed  transaction  environment,
+       db  can  be  used as a local transaction manager.  In this
+       case,  the  distributed  transaction  manager  must   send
+       prepare messages to each local manager.  The local manager
+       must then issue a txn_prepare  and  await  its  successful
+       return  before  responding  to the distributed transaction
+       manager.  Only after the distributed  transaction  manager
+       receives  successful  responses  from  all  of its prepare
+       messages should it issue any commit messages.
+
+       The txn_prepare function returns the  value  of  errno  on
+       failure and 0 on success.
+
+  txn_commit
+       The  txn_commit function ends the transaction specified by
+       the tid argument.  If DB_TXN_NOSYNC was not  specified,  a
+       commit  log  record is written and flushed to disk, as are
+       all previously written log records.  If the transaction is
+       nested,  its locks are acquired by the parent transaction,
+       otherwise its locks are released.  Any  applications  that
+       require  strict  two-phase  locking  must  not release any
+       locks explicitly, leaving  them  all  to  be  released  by
+       txn_commit.
+
+       The  txn_commit  function  returns  the  value of errno on
+       failure and 0 on success.
+
+  txn_abort
+       The txn_abort function causes an abnormal  termination  of
+       the  transaction.   The  log  is  played backwards and any
+       necessary recovery operations are  initiated  through  the
+       recover function specified to txn_open.  After recovery is
+       completed, all locks held by the transaction are  acquired
+       by  the  parent  transaction  in  the  case  of  a  nested
+       transaction or  released  in  the  case  of  a  non-nested
+       transaction.   As is the case for txn_commit, applications
+       that  require  strict  two  phase   locking   should   not
+       explicitly release any locks.
+
+       The  txn_abort  function  returns  the  value  of errno on
+       failure and 0 on success.
+
+  txn_id
+       The txn_id function  returns  the  unique  transaction  id
+       associated  with the specified transaction.  Locking calls
+       made on behalf of this transaction should  use  the  value
+       returned  from  txn_id  as  the  locker  parameter  to the
+       lock_get or lock_vec calls.
+
+  txn_close
+       The  txn_close  function  detaches  a  process  from   the
+       transaction   environment   specified   by  the  DB_TXNMGR
+       pointer.   All  mapped  regions  are  unmapped   and   any
+       allocated    resources   are   freed.    Any   uncommitted
+       transactions are aborted.
+
+       In addition, if the dir argument to txn_open was NULL  and
+       dbenv  was  not  initialized  using  db_appinit, all files
+       created for this shared region  will  be  removed,  as  if
+       txn_unlink were called.
+
+       When  multiple  threads  are  using  the  DB_TXNMGR handle
+       concurrently, only a single thread may call the  txn_close
+       function.
+
+       The  txn_close  function  returns  the  value  of errno on
+       failure and 0 on success.
+
+  txn_unlink
+       The txn_unlink function destroys  the  transaction  region
+       identified  by  the directory dir, removing all files used
+       to implement the transaction region.  (The  directory  dir
+       is  not removed.)  If there are processes that have called
+       txn_open  without  calling  txn_close  (i.e.,  there   are
+       processes   currently   using   the  transaction  region),
+       txn_unlink will fail without further  action,  unless  the
+       force  flag  is set, in which case txn_unlink will attempt
+       to remove the transaction region files regardless  of  any
+       processes still using the transaction region.
+
+       The  result  of  attempting to forcibly destroy the region
+       when  a  process  has  the  region  open  is  unspecified.
+       Processes  using  a  shared memory region maintain an open
+       file descriptor for  it.   On  UNIX  systems,  the  region
+       removal  should  succeed  and  processes that have already
+       joined the region should continue to  run  in  the  region
+       without  change,  however processes attempting to join the
+       transaction region will either fail or attempt to create a
+       new  region.   On  other  systems,  e.g.,  WNT,  where the
+       unlink(2) system call will fail if any process has an open
+       file  descriptor  for  the  file,  the region removal will
+       fail.
+
+       In the case of catastrophic or  system  failure,  database
+       recovery  must  be  performed  (see  db_recover(1)  or the
+       DB_RECOVER and DB_RECOVER_FATAL flags  to  db_appinit(3)).
+       Alternatively,  if  recovery  is  not  required because no
+       database  state  is  maintained  across  failures,  it  is
+       possible  to clean up a transaction region by removing all
+       of the files in the directory specified  to  the  txn_open
+       function, as transaction region files are never created in
+       any directory other than the one  specified  to  txn_open.
+       Note, however, that this has the potential to remove files
+       created by  the  other  DB  subsystems  in  this  database
+       environment.
+
+       The  txn_unlink  function  returns  the  value of errno on
+       failure and 0 on success.
+
+  txn_checkpoint
+       The txn_checkpoint function syncs  the  underlying  memory
+       pool,  writes  a  checkpoint  record  to  the log and then
+       flushes the log.
+
+       If either kbyte or min is non-zero, the checkpoint is only
+       done  if  more than min minutes have passed since the last
+       checkpoint, or if more than kbyte kilobytes  of  log  data
+       have been written since the last checkpoint.
+
+       The  txn_checkpoint function returns the value of errno on
+       failure, 0 on success, and  DB_INCOMPLETE  if  there  were
+       pages  that needed to be written but that memp_sync(3) was
+       unable  to  write  immediately.    In   this   case,   the
+       txn_checkpoint call should be retried.
+
+       The  txn_checkpoint  function  is  the underlying function
+       used by the db_checkpoint(1) utility.  See the source code
+       for  the  db_checkpoint  utility  for  an example of using
+       txn_checkpoint in a UNIX environment.
+
+  txn_stat
+       The txn_stat function creates a statistical structure  and
+       copies  a  pointer  to  it  into the user-specified memory
+       location.
+
+       Statistical structure are created in allocated memory.  If
+       db_malloc  is  non-NULL,  it  is  called  to  allocate the
+       memory, otherwise, the library function malloc(3) is used.
+       The  function db_malloc must match the calling conventions
+       of the malloc(3) library routine.  Regardless, the  caller
+       is  responsible  for deallocating the returned memory.  To
+       deallocate the returned memory, free each returned  memory
+       pointer;  pointers  inside  the  memory  do not need to be
+       individually freed.
+
+       The  transaction  region  statistics  are  stored   in   a
+       structure  of type DB_TXN_STAT (typedef'd in <db.h>).  The
+       following DB_TXN_STAT fields will be filled in:
+
+       u_int32_t st_refcnt;
+            The number of references to the region.
+       u_int32_t st_regsize;
+            The size of the region.
+       DB_LSN st_last_ckp;
+            The LSN of the last checkpoint.
+       DB_LSN st_pending_ckp;
+            The LSN  of  any  checkpoint  that  is  currently  in
+            progress.    If   st_pending_ckp   is   the  same  as
+            st_last_ckp there is no checkpoint in progress.
+       time_t st_time_ckp;
+            The time the last completed checkpoint  finished  (as
+            returned by time(2)).
+       u_int32_t st_last_txnid;
+            The last transaction ID allocated.
+       u_int32_t st_maxtxns;
+            The  maximum  number of active transactions supported
+            by the region.
+       u_int32_t st_naborts;
+            The number of transactions that have aborted.
+       u_int32_t st_nactive;
+            The number of transactions that are currently active.
+       u_int32_t st_nbegins;
+            The number of transactions that have begun.
+       u_int32_t st_ncommits;
+            The number of transactions that have committed.
+
+       u_int32_t st_region_wait;
+            The  number  of  times  that  a thread of control was
+            forced to wait before obtaining the region lock.
+       u_int32_t st_region_nowait;
+            The number of times that a thread of control was able
+            to obtain the region lock without waiting.
+       DB_TXN_ACTIVE *st_txnarray;
+            A  pointer  to  an  array of st_nactive DB_TXN_ACTIVE
+            structures,   describing   the    currently    active
+            transactions.     The   following   fields   of   the
+            DB_TXN_ACTIVE structure (typedef'd in <db.h>) will be
+            filled in:
+
+            u_int32_t txnid;
+                 The  transaction ID as returned by txn_begin(3).
+            DB_LSN lsn;
+                 The LSN of the transaction-begin record.
+
+
+
+

TRANSACTIONS

+       Creating transaction protected applications using  the  DB
+       access  methods  requires little system customization.  In
+       most  cases,  the  default  parameters  to  the   locking,
+       logging,  memory  pool,  and  transaction  subsystems will
+       suffice.  Applications can use  db_appinit(3)  to  perform
+       this initialization, or they may do it explicitly.
+
+       Each  database  operation  (i.e.,  any  call to a function
+       underlying  the  handles  returned   by   db_open(3)   and
+       db_cursor(3))  is normally performed on behalf of a unique
+       locker.  If multiple calls on behalf of  the  same  locker
+       are desired, then transactions must be used.
+
+       Once  the  application  has  initialized the DB subsystems
+       that it is  using,  it  may  open  the  DB  access  method
+       databases.   For applications performing transactions, the
+       databases must be opened after  subsystem  initialization,
+       and  cannot  be opened as part of a transaction.  Once the
+       databases are opened, the application can  group  sets  of
+       operations   into   transactions,   by   surrounding   the
+       operations with the appropriate txn_begin, txn_commit  and
+       txn_abort calls.  Databases accessed by a transaction must
+       not be closed during the transaction.   Note,  it  is  not
+       necessary  to  transaction protect read-only transactions,
+       unless those transactions require repeatable reads.
+
+       The DB access methods will make the appropriate calls into
+       the  lock,  log  and  memory  pool  subsystems in order to
+       guarantee that transaction semantics  are  applied.   When
+       the   application   is  ready  to  exit,  all  outstanding
+       transactions should have been committed  or  aborted.   At
+       this  point, all open DB files should be closed.  Once the
+       DB database files are closed, the DB subsystems should  be
+       closed, either explicitly or by calling db_appexit(3).
+
+       It  is  also  possible  to  use  the  locking, logging and
+       transaction  subsystems  of  DB  to  provide   transaction
+       semantics  to objects other than those described by the DB
+       access methods.  In these cases, the application will need
+       more  explicit  customization of the subsystems as well as
+       the  development  of  appropriate  data-structure-specific
+       recovery functions.
+
+       For   example,   consider  an  application  that  provides
+       transaction semantics to data stored in plain  UNIX  files
+       accessed using the read(2) and write(2) system calls.  The
+       operations for which transaction protection is desired are
+       bracketed by calls to txn_begin and txn_commit.
+
+       Before  data  are  referenced, the application must make a
+       call to the lock manager,  db_lock,  for  a  lock  of  the
+       appropriate  type (e.g., 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,  db_lock.   Then,  the  application should make a
+       call  to  the  log  manager,  db_log,  to  record   enough
+       information to redo the operation in case of failure after
+       commit and to undo the operation in  case  of  abort.   As
+       discussed in the db_log(3) manual page, 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.
+
+       After the log message  is  written,  the  application  may
+       issue  the  write  system  call.   After  all requests are
+       issued,  the  application  may  call   txn_commit.    When
+       txn_commit  returns,  the  caller  is  guaranteed that all
+       necessary log writes have been written to disk.
+
+       At any time, the application  may  call  txn_abort,  which
+       will  result  in  the  appropriate  calls  to  the recover
+       function to restore the ``database'' to a consistent  pre-
+       transaction  state.  (The recover function must be able to
+       either re-apply  or  undo  the  update  depending  on  the
+       context, for each different type of log record.)
+
+       If the application should crash, the recovery process uses
+       the db_log interface to read the log and call the  recover
+       function to restore the database to a consistent state.
+
+       The  txn_prepare  function provides the core functionality
+       to implement distributed transactions,  but  it  does  not
+       manage   the   notification   of  distributed  transaction
+       managers.   The  caller   is   responsible   for   issuing
+       txn_prepare  calls  to  all  sites  participating  in  the
+       transaction.  If all responses are  positive,  the  caller
+       can  issue  a  txn_commit.   If  any  of the responses are
+       negative,  the  caller  should  issue  a  txn_abort.    In
+       general,   the   txn_prepare   call   requires   that  the
+       transaction log be flushed to disk.
+
+
+
+

TRANSACTION ID LIMITS

+       The transaction ID space in Berkeley  DB  is  2^31,  or  2
+       billion  entries.   It  is possible that some environments
+       may need to be aware  of  this  limitation.   Consider  an
+       application  performing  600  transactions a second for 15
+       hours a day.  The transaction ID space  will  run  out  in
+       roughly 66 days:
+
+              2^31 / (600 * 15 * 60 * 60) = 66
+
+       Doing   only   100  transactions  a  second  exhausts  the
+       transaction ID space in roughly one year.
+
+       The transaction ID space is reset each  time  recovery  is
+       run.   If  you reach the end of your transaction ID space,
+       shut down your applications and restart them after running
+       recovery  (see  db_recover(1)  for more information).  The
+       most   recently   allocated   transaction   ID   is    the
+       st_last_txnid   value   in   the   transaction  statistics
+       information, and is displayed by the db_stat(1) utility.
+
+
+
+

ENVIRONMENT VARIABLES

+       The following environment variables affect  the  execution
+       of db_txn:
+
+       DB_HOME
+            If  the  dbenv  argument  to txn_open was initialized
+            using db_appinit, the  environment  variable  DB_HOME
+            may  be used as the path of the database home for the
+            interpretation of the dir argument  to  txn_open,  as
+            described in db_appinit(3).
+
+       TMPDIR
+            If  the  dbenv  argument  to txn_open was NULL or not
+            initialized   using   db_appinit,   the   environment
+            variable TMPDIR may be used as the directory in which
+            to create the transaction region, as described in the
+            txn_open section above.
+
+
+
+

ERRORS

+       The txn_open function may fail and return errno for any of
+       the errors specified for  the  following  DB  and  library
+       functions: close(2), db_version(3), fcntl(2), fflush(3),
+       lseek(2), malloc(3), memcpy(3), memset(3), mmap(2),
+       munmap(2), open(2), sigfillset(3), sigprocmask(2),
+       stat(2), strcpy(3), strdup(3), strerror(3), strlen(3),
+       time(3), txn_unlink(3), unlink(2), and write(2).
+
+       In  addition,  the  txn_open  function may fail and return
+       errno for the following conditions:
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+            The DB_THREAD flag was specified  and  spinlocks  are
+            not implemented for this architecture.
+
+            The dbenv parameter was NULL.
+
+       [EAGAIN]
+            The  shared memory region was locked and (repeatedly)
+            unavailable.
+
+       The txn_begin function may fail and return errno  for  any
+       of  the  errors specified for the following DB and library
+       functions: fcntl(2), fflush(3), log_put(3), lseek(2),
+       malloc(3), memcpy(3), memset(3), mmap(2), munmap(2),
+       strerror(3), and write(2).
+
+       In addition, the txn_begin function may  fail  and  return
+       errno for the following conditions:
+
+       [ENOSPC]
+            The  maximum  number  of  concurrent transactions has
+            been reached.
+
+       The txn_prepare function may fail and return errno for any
+       of  the  errors specified for the following DB and library
+       functions: fcntl(2), fflush(3), log_flush(3), and
+       strerror(3).
+
+       The  txn_commit function may fail and return errno for any
+       of the errors specified for the following DB  and  library
+       functions: fcntl(2), fflush(3), lock_vec(3), log_put(3),
+       malloc(3), memcpy(3), and strerror(3).
+
+       In addition, the txn_commit function may fail  and  return
+       errno for the following conditions:
+
+       [EINVAL]
+            The transaction was aborted.
+
+       The  txn_abort  function may fail and return errno for any
+       of the errors specified for the following DB  and  library
+       functions: DBenv->tx_recover(3), fcntl(2), fflush(3),
+       lock_vec(3), log_get(3), memset(3), and strerror(3).
+
+       [EINVAL]
+            The transaction was already aborted.
+
+       The txn_checkpoint function may fail and return errno  for
+       any  of  the  errors  specified  for  the following DB and
+       library functions: fcntl(2), fflush(3), log_compare(3),
+       log_put(3), malloc(3), memcpy(3), memp_sync(3), memset(3),
+       strerror(3), and time(3).
+
+       [EINVAL]
+            An invalid flag value or parameter was specified.
+
+       The txn_close function may fail and return errno  for  any
+       of  the  errors specified for the following DB and library
+       functions: close(2), fcntl(2), fflush(3), log_flush(3),
+       munmap(2), strerror(3), and txn_abort(3).
+
+       The  txn_unlink function may fail and return errno for any
+       of the errors specified for the following DB  and  library
+       functions: close(2), fcntl(2), fflush(3), malloc(3),
+       memcpy(3), memset(3), mmap(2), munmap(2), open(2),
+       sigfillset(3), sigprocmask(2), stat(2), strcpy(3),
+       strdup(3), strerror(3), strlen(3), and unlink(2).
+
+       In addition, the txn_unlink function may fail  and  return
+       errno for the following conditions:
+
+       [EBUSY]
+            The  shared  memory  region  was in use and the force
+            flag was not set.
+
+       The txn_stat function may fail and return errno for any of
+       the  errors  specified  for  the  following DB and library
+       functions: fcntl(2), and malloc(3).
+
+
+
+

SEE ALSO

+       LIBTP: Portable,  Modular  Transactions  for  UNIX,  Margo
+       Seltzer, Michael Olson, USENIX proceedings, Winter 1992.
+
+
+
+

BUGS

+       Nested transactions are not yet implemented.
+
+       db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
+       db_load(1), db_recover(1), db_stat(1), db_intro(3),
+       db_appinit(3), db_cursor(3), db_dbm(3), db_internal(3),
+       db_lock(3), db_log(3), db_mpool(3), db_open(3), db_thread(3),
+       db_txn(3)
+
+
+
+
+Man(1) output converted with +man2html +
+ + diff --git a/mozilla/db/man/man.html/index_c.html b/mozilla/db/man/man.html/index_c.html new file mode 100644 index 00000000000..c78b30f5c0e --- /dev/null +++ b/mozilla/db/man/man.html/index_c.html @@ -0,0 +1,112 @@ + + + +The Berkeley DB Package: DB Manual Pages (C Interface) + + + +

The Berkeley DB Package: DB Manual Pages (C Interface)

+ +

+C++ Interface +
+Java Interface +

+ +We suggest reading the following three pages first: +

+

db_intro(3) +
db_appinit(3) +
db_open(3) +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Manual pageSubject
db_intro(3)General DB introduction and overview
db_thread(3)Using DB from within threaded programs
db_appinit(3)Configuring the DB environment
db_open(3)Access methods
db_cursor(3)Access method cursors
db_dbt(3)Access method key/data pairs
db_lock(3)The lock subsystem; a general-purpose lock manager
db_log(3)The log subsystem; a general-purpose log manager
db_mpool(3)The buffer subsystem; a general-purpose shared memory buffer pool
db_txn(3)The transaction subsystem; a general-purpose transaction manager
db_archive(1)Archival support
db_checkpoint(1)Transaction checkpoint support
db_deadlock(1)Deadlock detection support
db_recover(1)Database recovery support
db_stat(1)Statistics
db_dump(1)Database to portable flat-text
db_load(1)Database from portable flat-text
db_internal(3)Re-configuring underlying DB functionality at run-time.
+ + + diff --git a/mozilla/db/man/man.html/index_cxx.html b/mozilla/db/man/man.html/index_cxx.html new file mode 100644 index 00000000000..6b928ee6688 --- /dev/null +++ b/mozilla/db/man/man.html/index_cxx.html @@ -0,0 +1,135 @@ + + + +The Berkeley DB Package: DB Manual Pages (C++ Interface) + + + +

The Berkeley DB Package: DB Manual Pages (C++ Interface)

+ +

+C Interface +
+Java Interface +

+ +We suggest reading the following three pages first: +

+

db_intro(3) +
DbEnv(3) +
Db(3) +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Manual pageSubject
db_intro(3)General DB introduction and overview
db_thread(3)Using DB from within threaded programs
DbEnv(3)Class for configuring the DB environment
DbException(3)Exception class for Db activity
Db(3)Access method class
DbInfo(3)Class for access method parameters for database open
Dbc(3)Class for access method cursors
Dbt(3)Access method key/data class
DbLockTab(3)General-purpose lock manager class
DbLock(3)Class for lock objects in the lock manager
DbLog(3)General-purpose log manager class
DbLsn(3)Class representing log sequence numbers
DbMpool(3)General-purpose shared memory buffer pool class
DbMpoolFile(3)File class in the shared memory buffer pool
DbTxnMgr(3)General-purpose transaction manager class
DbTxn(3)Class representing transactions in the transaction manager
db_archive(1)Archival support
db_checkpoint(1)Transaction checkpoint support
db_deadlock(1)Deadlock detection support
db_recover(1)Database recovery support
db_stat(1)Statistics
db_dump(1)Database to portable flat-text
db_load(1)Database from portable flat-text
+ + + diff --git a/mozilla/db/man/man.html/index_java.html b/mozilla/db/man/man.html/index_java.html new file mode 100644 index 00000000000..d779902f15a --- /dev/null +++ b/mozilla/db/man/man.html/index_java.html @@ -0,0 +1,131 @@ + + + +The Berkeley DB Package: DB Manual Pages (Java Interface) + + + +

The Berkeley DB Package: DB Manual Pages (Java Interface)

+ +

+C Interface +
+C++ Interface +

+ +We suggest reading the following three pages first: +

+

db_intro(3) +
DbEnv(3) +
Db(3) +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Manual pageSubject
db_intro(3)General DB introduction and overview
db_thread(3)Using DB from within threaded programs
DbEnv(3)Class for configuring the DB environment
DbException(3)Exception class for Db activity
Db(3)Access method class
DbInfo(3)Class for access method parameters for database open
Dbc(3)Class for access method cursors
Dbt(3)Access method key/data class
DbLockTab(3)General-purpose lock manager class
DbLock(3)Class for lock objects in the lock manager
DbLog(3)General-purpose log manager class
DbLsn(3)Class representing log sequence numbers
DbMpool(3)General-purpose shared memory buffer pool class
DbTxnMgr(3)General-purpose transaction manager class
DbTxn(3)Class representing transactions in the transaction manager
db_archive(1)Archival support
db_checkpoint(1)Transaction checkpoint support
db_deadlock(1)Deadlock detection support
db_recover(1)Database recovery support
db_stat(1)Statistics
db_dump(1)Database to portable flat-text
db_load(1)Database from portable flat-text
+ + + diff --git a/mozilla/db/man/man.ps/db_appinit.ps b/mozilla/db/man/man.ps/db_appinit.ps new file mode 100644 index 00000000000..21e5ea56035 --- /dev/null +++ b/mozilla/db/man/man.ps/db_appinit.ps @@ -0,0 +1,810 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:19 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 7 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_appinit \255 initializing the DB en)108 40.8 Q(vironment)-.4 E F0 +(SYNOPSIS)72 57.6 Q/F2 10/Times-Bold@0 SF(#include ) +-.4 E(char *)108 93.6 Q(db_v)108 105.6 Q(ersion\(int *major)-.1 E 2.5 +(,i)-.92 G(nt *minor)-2.5 E 2.5(,i)-.92 G(nt *patch\);)-2.5 E(int)108 +129.6 Q(db_appinit\(char *db_home,)108 141.6 Q +(char *db_con\214g[], DB_ENV *dben)158 153.6 Q 1.1 -.55(v, u)-.4 H +(_int32_t \215ags\);).55 E(int)108 177.6 Q(db_appexit\(DB_ENV *dben)108 +189.6 Q(v\);)-.4 E F0(DESCRIPTION)72 206.4 Q F1 .486 +(The DB library is a f)108 218.4 R .485 +(amily of groups of functions that pro)-.1 F .485 +(vides a modular programming interf)-.15 F .485(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 230.4 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .507(\214le page caching, as well as v)108 242.4 R .507 +(arious inde)-.25 F -.15(xe)-.15 G 3.007(da).15 G .506(ccess methods.) +-3.007 F(Man)5.506 E 3.006(yo)-.15 G 3.006(ft)-3.006 G .506 +(he functional groups \(e.g., the \214le)-3.006 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 254.4 R .122(are e)108 266.4 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.121 G 2.621(rag).15 G .121(eneral description of)-2.621 +F(the DB package, see)108 278.4 Q/F3 10/Times-Italic@0 SF(db_intr)2.5 E +(o)-.45 E F1(\(3\).).18 E F3(db_ver)92 295.2 Q(sion)-.1 E F1(The)108 +307.2 Q F3(db_ver)3.129 E(sion)-.1 E F1 .629 +(function returns a pointer to a string containing DB v)3.129 F .63 +(ersion information.)-.15 F(If)5.63 E F3(major)3.13 E F1 .63(is non-) +3.13 F .557(NULL, the major v)108 319.2 R .556 +(ersion of the DB release is stored in the memory it references.)-.15 F +(If)5.556 E F3(minor)3.056 E F1 .556(is non-NULL,)3.056 F .213 +(the minor v)108 331.2 R .213 +(ersion of the DB release is stored in the memory it references.)-.15 F +(If)5.213 E F3(patc)2.713 E(h)-.15 E F1 .214(is non-NULL, the patch) +2.713 F -.15(ve)108 343.2 S +(rsion of the DB release is stored in the memory it references.).15 E F3 +(db_appinit)92 360 Q F1(The)108 372 Q F3(db_appinit)3.501 E F1 1.001 +(function pro)3.501 F 1.001(vides a simple w)-.15 F 1.001 +(ay to initialize and con\214gure the DB en)-.1 F 3.5(vironment. It)-.4 +F 1(is not)3.5 F .035(necessary that it be called, b)108 384 R .035 +(ut it pro)-.2 F .035(vides a method of creating a consistent en)-.15 F +.036(vironment for processes using)-.4 F +(one or more of the features of DB.)108 396 Q(The)108 412.8 Q F3 +(db_home)3.803 E F1(and)3.803 E F3(db_con\214g)3.802 E F1(ar)3.802 E +1.302(guments to)-.18 F F3(db_appinit)3.802 E F1 1.302 +(are described in the section belo)3.802 F 3.802(we)-.25 G 1.302 +(ntitled `)-3.802 F(`FILE)-.74 E -.35(NA)108 424.8 S(MING').35 E('.)-.74 +E(The)108 441.6 Q F3<8d61>3.586 E(gs)-.1 E F1(ar)3.586 E 1.086 +(gument speci\214es the subsystems that are initialized and ho)-.18 F +3.586(wt)-.25 G 1.086(he en)-3.586 F 1.086(vironment af)-.4 F 1.086 +(fects DB \214le)-.25 F .646(naming, among other things.)108 453.6 R +(The)5.646 E F3<8d61>3.146 E(gs)-.1 E F1 -.25(va)3.146 G .646 +(lue is speci\214ed by).25 F F2(or)3.146 E F1 .646 +('ing together one or more of the follo)B(wing)-.25 E -.25(va)108 465.6 +S(lues:).25 E(DB_CREA)108 482.4 Q(TE)-1.11 E 3.944 +(Cause subsystems to create an)133 494.4 R 6.444(yu)-.15 G 3.945 +(nderlying \214les, as necessary)-6.444 F 8.945(.\()-.65 G(See)-8.945 E +F3(db_loc)6.445 E(k)-.2 E F1(\(3\),).67 E F3(db_lo)6.445 E(g)-.1 E F1 +(\(3\),).22 E F3(db_mpool)133 506.4 Q F1(\(3\),).51 E F3(db_open)2.5 E +F1(\(3\) and).24 E F3(db_txn)2.5 E F1(\(3\) for more information.\)).24 +E(DB_INIT_LOCK)108 523.2 Q 1.381(Initialize the lock subsystem; see)133 +535.2 R F3(db_loc)3.881 E(k)-.2 E F1 3.881(\(3\). This).67 F 1.381 +(subsystem should be used when multiple pro-)3.881 F .059(cesses or threads are going to be reading and writing a DB database, so that the) +133 547.2 R 2.559(yd)-.15 G 2.559(on)-2.559 G .059(ot interfere with) +-2.559 F .304(each other)133 559.2 R 5.304(.I)-.55 G 2.804(fa)-5.304 G +.304(ll threads are accessing the database\(s\) read-only)-2.804 F 2.803 +(,t)-.65 G .303(hen locking is unnecessary)-2.803 F 5.303(.W)-.65 G(hen) +-5.303 E .533(the DB_INIT_LOCK \215ag is speci\214ed, it is usually necessary to run the deadlock detector) +133 571.2 R(,)-.4 E F3(db_dead-)3.033 E(loc)133 583.2 Q(k)-.2 E F1 +(\(1\), as well.).67 E(DB_INIT_LOG)108 600 Q .577 +(Initialize the log subsystem; see)133 612 R F3(db_lo)3.077 E(g)-.1 E F1 +3.077(\(3\). This).22 F .577(subsystem is used when reco)3.077 F -.15 +(ve)-.15 G .577(ry from application).15 F(or system f)133 624 Q +(ailure is important.)-.1 E(DB_INIT_MPOOL)108 640.8 Q .04 +(Initialize the mpool subsystem; see)133 652.8 R F3(db_mpool)2.541 E F1 +2.541(\(3\). This).51 F .041(subsystem is used whene)2.541 F -.15(ve) +-.25 G 2.541(rt).15 G .041(he application is)-2.541 F +(using the DB access methods for an)133 664.8 Q 2.5(yp)-.15 G(urpose.) +-2.5 E(DB_INIT_TXN)108 681.6 Q .373 +(Initialize the transaction subsystem; see)133 693.6 R F3(db_txn)2.872 E +F1 2.872(\(3\). This).24 F .372 +(subsystem is used when atomicity of multi-)2.872 F 1.756 +(ple operations and reco)133 705.6 R -.15(ve)-.15 G 1.756 +(ry are important.).15 F 1.757 +(The DB_INIT_TXN \215ag implies the DB_INIT_LOG)6.756 F(\215ag.)133 +717.6 Q(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 327.74(DB_APPINIT\(3\) DB_APPINIT\(3\))72 48 R +(DB_MPOOL_PRIV)108 84 Q -1.11(AT)-1.35 G(E)1.11 E 4.709(Create a pri)133 +96 R -.25(va)-.25 G 4.708(te memory pool \(see).25 F/F1 10 +/Times-Italic@0 SF(db_mpool)7.208 E F0 4.708 +(\(3\) for further information\).).51 F 4.708(Ignored unless)9.708 F +(DB_INIT_MPOOL is also speci\214ed.)133 108 Q(DB_NOMMAP)108 124.8 Q +1.336(Do not map an)133 136.8 R 3.836<798c>-.15 G 1.336 +(les within this en)-3.836 F 1.336(vironment \(see)-.4 F F1(db_mpool) +3.836 E F0 1.336(\(3\) for further information\).).51 F(Ignored)6.337 E +(unless DB_INIT_MPOOL is also speci\214ed.)133 148.8 Q(DB_RECO)108 165.6 +Q(VER)-.5 E 1.175(Run normal reco)133 177.6 R -.15(ve)-.15 G 1.175 +(ry on this en).15 F 1.175(vironment before opening it for normal use.) +-.4 F 1.174(If this \215ag is set, the)6.175 F(DB_CREA)133 189.6 Q +(TE \215ag must also be set since the re)-1.11 E(gions will be remo)-.15 +E -.15(ve)-.15 G 2.5(da).15 G(nd recreated.)-2.5 E(The)133 213.6 Q F1 +(db_appinit)2.908 E F0 .408(function returns successfully if DB_RECO) +2.908 F .409(VER is speci\214ed and no log \214les e)-.5 F .409 +(xist, so)-.15 F .213(it is necessary to ensure all necessary log \214les are present before running reco) +133 225.6 R -.15(ve)-.15 G(ry).15 E 5.213(.F)-.65 G .213 +(or further infor)-5.363 F(-)-.2 E(mation, consult the man page for)133 +237.6 Q F1(db_ar)2.5 E -.15(ch)-.37 G(ive).15 E F0(\(1\) and).18 E F1 +(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\).).73 E(DB_RECO)108 254.4 Q +(VER_F)-.5 E -1.21 -1.11(AT A)-.74 H(L)1.11 E .918 +(Run catastrophic reco)133 266.4 R -.15(ve)-.15 G .918(ry on this en).15 +F .919(vironment before opening it for normal use.)-.4 F .919 +(If this \215ag is set,)5.919 F(the DB_CREA)133 278.4 Q +(TE \215ag must also be set since the re)-1.11 E(gions will be remo)-.15 +E -.15(ve)-.15 G 2.5(da).15 G(nd recreated.)-2.5 E(The)133 302.4 Q F1 +(db_appinit)2.909 E F0 .409(function returns successfully if DB_RECO) +2.909 F .408(VER is speci\214ed and no log \214les e)-.5 F .408 +(xist, so)-.15 F .213(it is necessary to ensure all necessary log \214les are present before running reco) +133 314.4 R -.15(ve)-.15 G(ry).15 E 5.213(.F)-.65 G .214 +(or further infor)-5.363 F(-)-.2 E(mation, consult the man page for)133 +326.4 Q F1(db_ar)2.5 E -.15(ch)-.37 G(ive).15 E F0(\(1\) and).18 E F1 +(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\).).73 E(DB_THREAD)108 343.2 Q +.859(Ensure that handles returned by the DB subsystems are useable by multiple threads within a single) +133 355.2 R 4.219(process, i.e., that the system is `)133 367.2 R +(`free-threaded')-.74 E 6.719('. \(See)-.74 F F1(db_loc)6.719 E(k)-.2 E +F0(\(3\),).67 E F1(db_lo)6.719 E(g)-.1 E F0(\(3\),).22 E F1(db_mpool) +6.719 E F0(\(3\),).51 E F1(db_open)133 379.2 Q F0(\(3\) and).24 E F1 +(db_txn)2.5 E F0(\(3\) for more information.\)).24 E(DB_TXN_NOSYNC)108 +396 Q .972 +(On transaction commit, do not synchronously \215ush the log \(see)133 +408 R F1(db_txn)3.472 E F0 .972(\(3\) for further information\).).24 F +(Ignored unless DB_INIT_TXN is also speci\214ed.)133 420 Q(DB_USE_ENVIR) +108 436.8 Q(ON)-.4 E .256(The DB process' en)133 448.8 R .256(vironment may be permitted to specify information to be used when naming \214les) +-.4 F 1.13(\(see the section entitled `)133 460.8 R 1.13(`FILE N)-.74 F +(AMING')-.35 E 3.63('b)-.74 G(elo)-3.63 E 3.63(w\). As)-.25 F 1.13 +(permitting users to specify which \214les are)3.63 F .571 +(used can create security problems, en)133 472.8 R .571 +(vironment information will be used in \214le naming for all users)-.4 F +(only if the DB_USE_ENVIR)133 484.8 Q(ON \215ag is set.)-.4 E +(DB_USE_ENVIR)108 501.6 Q(ON_R)-.4 E(OO)-.4 E(T)-.4 E .256 +(The DB process' en)133 513.6 R .256(vironment may be permitted to specify information to be used when naming \214les) +-.4 F 1.13(\(see the section entitled `)133 525.6 R 1.13(`FILE N)-.74 F +(AMING')-.35 E 3.63('b)-.74 G(elo)-3.63 E 3.63(w\). As)-.25 F 1.13 +(permitting users to specify which \214les are)3.63 F .369 +(used can create security problems, if the DB_USE_ENVIR)133 537.6 R +(ON_R)-.4 E(OO)-.4 E 2.868<548d>-.4 G .368(ag is set, en)-2.868 F .368 +(vironment infor)-.4 F(-)-.2 E 1.489 +(mation will be used for \214le naming only for users with a user)133 +549.6 R 1.489(-ID matching that of the superuser)-.2 F(\(speci\214cally) +133 561.6 Q 2.5(,u)-.65 G(sers for whom the)-2.5 E F1 -.1(ge)2.5 G(tuid) +.1 E F0(system call returns the user)2.5 E(-ID 0\).)-.2 E 1.413 +(The DB en)108 578.4 R 1.413(vironment is con\214gured based on the)-.4 +F F1(dben)3.912 E(v)-.4 E F0(ar)3.912 E 1.412(gument to)-.18 F F1 +(db_appinit)3.912 E F0 3.912(,w).68 G 1.412(hich is a pointer to a) +-3.912 F 1.923(structure of type DB_ENV \(typedef)108 590.4 R 2.924 -.5 +('d i).55 H 4.424(n<).5 G(db)-4.424 E 4.424(.h>\). Applications)-.4 F +1.924(will normally use the same DB_ENV)4.424 F +(structure \(initialized by)108 602.4 Q F1(db_appinit)2.5 E F0 +(\(3\)\), as an ar).68 E +(gument to all of the subsystems in the DB package.)-.18 E .439(References to the DB_ENV structure are maintained by DB, so it may not be discarded until the last close) +108 619.2 R .286 +(function, corresponding to an open function for which it w)108 631.2 R +.287(as an ar)-.1 F .287(gument, has returned.)-.18 F .287 +(In order to ensure)5.287 F 1.578(compatibility with future releases of DB, all \214elds of the DB_ENV structure that are not e) +108 643.2 R 1.578(xplicitly set)-.15 F .17(should be initialized to 0 before the \214rst time the structure is used.) +108 655.2 R .171(Do this by declaring the structure e)5.171 F(xter)-.15 +E(-)-.2 E(nal or static, or by calling the C library routine)108 667.2 Q +F1(bzer)2.5 E(o)-.45 E F0(\(3\) or).18 E F1(memset)2.5 E F0(\(3\).).68 E +.153(The \214elds of the DB_ENV structure used by)108 684 R F1 +(db_appinit)2.653 E F0 .152(are described belo)2.652 F 3.952 -.65(w. T) +-.25 H(he).65 E F1(dben)2.652 E(v)-.4 E F0(ar)2.652 E .152 +(gument may not)-.18 F .422(be NULL.)108 696 R .422(If an)5.422 F 2.922 +(yo)-.15 G 2.922(ft)-2.922 G .422(he \214elds of the)-2.922 F F1(dben) +2.922 E(v)-.4 E F0 .422(are set to 0, def)2.922 F .423 +(aults appropriate for the system are used where)-.1 F(possible.)108 708 +Q(The follo)108 724.8 Q(wing \214elds in the DB_ENV structure may be initialized before calling) +-.25 E F1(db_appinit)2.5 E F0(:).68 E(May 1, 1998)280.585 768 Q(2) +203.585 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 327.74(DB_APPINIT\(3\) DB_APPINIT\(3\))72 48 R +-.2(vo)108 84 S(id \(*db_errcall\)\(char *db_errpfx, char *b).2 E(uf)-.2 +E(fer\);)-.25 E .409(When an error occurs in the DB package, an)133 96 R +/F1 10/Times-Italic@0 SF(errno)2.908 E F0 -.25(va)2.908 G .408 +(lue is returned by the function.).25 F .408(In some cases,)5.408 F(ho) +133 108 Q(we)-.25 E -.15(ve)-.25 G .8 -.4(r, t).15 H(he).4 E F1(errno) +2.5 E F0 -.25(va)2.5 G(lue may be insuf).25 E +(\214cient to completely describe the cause of the error)-.25 E(.)-.55 E +(If)133 124.8 Q F1(db_err)3.063 E(call)-.37 E F0 .564 +(is non-NULL, it may be called with additional error information.)3.063 +F(The)5.564 E F1(db_errpfx)3.064 E F0(ar)3.064 E(gu-)-.18 E 1.455 +(ment is the current en)133 136.8 R(vironment')-.4 E(s)-.55 E F1 +(db_errpfx)3.954 E F0 3.954(\214eld. The)3.954 F F1 -.2(bu)3.954 G -.18 +(ff).2 G(er).18 E F0(ar)3.954 E 1.454(gument contains a nul-terminated) +-.18 F(string with the additional information.)133 148.8 Q .593 +(This error logging f)133 172.8 R .594 +(acility should not be required for normal operation, b)-.1 F .594 +(ut may be useful in deb)-.2 F(ug-)-.2 E(ging applications.)133 184.8 Q +(FILE *db_err\214le;)108 201.6 Q(The)133 213.6 Q F1(db_err\214le)2.88 E +F0 .38(\214eld beha)2.88 F -.15(ve)-.2 G 2.88(ss).15 G .38 +(imilarly to the)-2.88 F F1(db_err)2.88 E(call)-.37 E F0 .38(\214eld, e) +2.88 F .38(xcept that the error message is written)-.15 F +(to the \214le stream represented by)133 225.6 Q F1(db_err\214le)2.5 E +F0(.).18 E(If)133 249.6 Q F1(db_errpfx)3.696 E F0 1.197 +(is non-NULL, the message will be preceded by the string referenced by) +3.696 F F1(db_errpfx)3.697 E F0 3.697(,a).53 G(colon \(`)133 261.6 Q +(`:')-.74 E('\) and a space.)-.74 E(The message will be follo)5 E +(wed by a ne)-.25 E(wline character)-.25 E(.)-.55 E +(const char *db_errpfx;)108 278.4 Q 3.679(Ap)133 290.4 S 1.179 +(re\214x to prepend to error messages.)-3.679 F 1.179 +(Because DB does not cop)6.179 F 3.679(yt)-.1 G 1.178 +(he memory referenced by the)-3.679 F F1(db_errpfx)133 302.4 Q F0 +(\214eld, the application may modify the error message pre\214x at an) +2.5 E 2.5(yt)-.15 G(ime.)-2.5 E(int db_v)108 319.2 Q(erbose;)-.15 E 2.19 +(Include informational and deb)133 331.2 R 2.19 +(ugging messages as well as error messages in the)-.2 F F1(db_err)4.69 E +(call)-.37 E F0(and)4.69 E F1(db_err\214le)133 343.2 Q F0(output.)2.5 E +1.002(Each of the open functions that)108 360 R F1(db_appinit)3.502 E F0 +1.002(may call \()3.502 F F1(loc)A(k_open)-.2 E F0(,)A F1(lo)3.502 E +(g_open)-.1 E F0(,)A F1(memp_open)3.502 E F0(and)3.502 E F1(txn_open) +3.502 E F0 3.502(\)i)C(s)-3.502 E(called as follo)108 372 Q +(ws, where the DB_CREA)-.25 E(TE \215ag is optional:)-1.11 E +(XXX_open\(NULL, DB_CREA)158 396 Q(TE,)-1.11 E(S_IR)188 408 Q +(USR | S_IWUSR | S_IRGRP | S_IWGRP)-.4 E 2.5(,d)-1.11 G(ben)-2.5 E(v\)) +-.4 E 1.031(This call will cause each subsystem to construct pathnames as described in the section on `) +108 424.8 R 1.031(`FILE N)-.74 F(AM-)-.35 E(ING')108 436.8 Q 2.595 +('. The)-.74 F .095(subsystem has permission to read and write underlying \214les as necessary) +2.595 F 2.595(,a)-.65 G .095(nd optionally to cre-)-2.595 F .655 +(ate \214les.)108 448.8 R .655 +(\(All created \214les will be created readable and writeable by the o) +5.655 F .656(wner and the group.)-.25 F .656(The group)5.656 F -.25(ow) +108 460.8 S .073 +(nership of created \214les is based on the system and directory def).25 +F .072(aults, and is not further speci\214ed by DB.\))-.1 F .025 +(In addition, the)108 477.6 R F1(dben)2.525 E(v)-.4 E F0(ar)2.525 E .026 +(gument is passed to the open functions of an)-.18 F 2.526(ys)-.15 G +.026(ubsystems initialized by)-2.526 F F1(db_appinit)2.526 E F0(.).68 E +-.15(Fo)108 489.6 S 2.911(rt).15 G .411 +(his reason the \214elds of the DB_ENV structure rele)-2.911 F -.25(va) +-.25 G .41(nt to the subsystems being initialized must them-).25 F(selv) +108 501.6 Q .277(es be initialized before)-.15 F F1(db_appinit)2.777 E +F0 .278(is called.)2.778 F .278 +(See the manual page for each subsystem for a list of these)5.278 F +(\214elds and their uses.)108 513.6 Q(The return v)108 530.4 Q(alue from each of these calls is placed in the appropriate \214eld of the DB_ENV structure:) +-.25 E(DB_LOCKT)108 547.2 Q(AB *lk_info;)-.93 E(The return v)133 559.2 Q +(alue of the)-.25 E F1(loc)2.5 E(k_open)-.2 E F0(\(3\) call.).24 E +(DB_LOG *lg_info;)108 576 Q(The return v)133 588 Q(alue of the)-.25 E F1 +(lo)2.5 E(g_open)-.1 E F0(\(3\) call.).24 E(DB_MPOOL *mp_info;)108 604.8 +Q(The return v)133 616.8 Q(alue of the)-.25 E F1(memp_open)2.5 E F0 +(\(3\) call.).24 E(DB_TXNMGR *tx_info;)108 633.6 Q(The return v)133 +645.6 Q(alue of the)-.25 E F1(txn_open)2.5 E F0(\(3\) call.).24 E 1.068 +(In general, these \214elds are not directly used by applications; subsystems of DB that use these \214elds will) +108 662.4 R(simply reference them using the DB_ENV ar)108 674.4 Q +(gument passed to the subsystem.)-.18 E -.15(Fo)108 691.2 S 3.031(re).15 +G .531(xample, an application using the DB hash access method functions to access a database will \214rst call) +-3.181 F F1(db_open)108 703.2 Q F0 .58(passing it the DB_ENV ar)3.08 F +.579(gument \214lled in by the initial call to)-.18 F F1(db_appinit) +3.079 E F0 5.579(.T).68 G .579(hen, all future calls)-5.579 F .267(to the hash access method functions for that database will automatically use the underlying shared memory) +108 715.2 R -.2(bu)108 727.2 S -.25(ff).2 G(er pool that w).25 E +(as speci\214ed by the)-.1 E F1(mp_info)2.5 E F0 +(\214eld of that DB_ENV ar)2.5 E(gument.)-.18 E(May 1, 1998)280.585 768 +Q(3)203.585 E EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 327.74(DB_APPINIT\(3\) DB_APPINIT\(3\))72 48 R +1.899(The single e)108 84 R 1.898(xception to this rule is the)-.15 F/F1 +10/Times-Italic@0 SF(tx_info)4.398 E F0 1.898 +(\214eld, which applications must e)4.398 F 1.898 +(xplicitly specify to the)-.15 F F1(txn_be)108 96 Q(gin)-.4 E F0(,).24 E +F1(txn_c)2.5 E(hec)-.15 E(kpoint)-.2 E F0(and)2.5 E F1(txn_close)2.5 E +F0(functions.)2.5 E .07(Once the DB en)108 112.8 R .07 +(vironment has been initialized by a call to)-.4 F F1(db_appinit)2.571 E +F0 2.571(,n).68 G 2.571<6f8c>-2.571 G .071(elds other than)-2.571 F F1 +(db_errpfx)2.571 E F0(should)2.571 E(be modi\214ed.)108 124.8 Q(The)108 +141.6 Q F1(db_appinit)2.5 E F0(function returns the v)2.5 E(alue of)-.25 +E F1(errno)2.5 E F0(on f)2.5 E(ailure and 0 on success.)-.1 E F1 +(db_appe)92 158.4 Q(xit)-.2 E F0(The)108 170.4 Q F1(db_appe)3.114 E(xit) +-.2 E F0 .613(function closes the initialized DB subsystems, freeing an) +3.113 F 3.113(ya)-.15 G .613(llocated resources and closing)-3.113 F(an) +108 182.4 Q 2.5(yu)-.15 G(nderlying subsystems.)-2.5 E 1.922 +(When multiple threads are using the DB_ENV handle concurrently)108 +199.2 R 4.422(,o)-.65 G 1.922(nly a single thread may call the)-4.422 F +F1(db_appe)108 211.2 Q(xit)-.2 E F0(function.)2.5 E(The)108 228 Q F1 +(db_appe)2.5 E(xit)-.2 E F0(function returns the v)2.5 E(alue of)-.25 E +F1(errno)2.5 E F0(on f)2.5 E(ailure and 0 on success.)-.1 E/F2 9 +/Times-Bold@0 SF(FILE N)72 244.8 Q(AMING)-.18 E F0 +(The most important task of)108 256.8 Q F1(db_appinit)2.5 E F0 +(is to structure \214le naming within DB.)2.5 E 1.853(Each of the locking, logging, memory pool and transaction subsystems of DB require shared memory) +108 273.6 R(re)108 285.6 Q 1.001(gions, back)-.15 F 1.001 +(ed by the \214lesystem.)-.1 F(Further)6.001 E 3.501(,c)-.4 G 1.002 +(ooperating applications \(or multiple in)-3.501 F -.2(vo)-.4 G 1.002 +(cations of the same).2 F .617 +(application\) must agree on the location of the shared memory re)108 +297.6 R .616(gions and other \214les used by the DB sub-)-.15 F(systems, the log \214les used by the logging subsystem, and, of course, the data \214les.) +108 309.6 Q .478(Although it is possible to specify full pathnames to all DB functions, this is cumbersome and requires that) +108 326.4 R .969 +(applications be recompiled when database \214les are mo)108 338.4 R +-.15(ve)-.15 G 3.469(d. The).15 F F1(db_appinit)3.468 E F0 .968 +(function mak)3.468 F .968(es it possible to)-.1 F 1.21 +(place database \214les in a single directory)108 350.4 R 3.711(,o)-.65 +G 3.711(ri)-3.711 G 3.711(nm)-3.711 G 1.211 +(ultiple directories, grouped by their function within the)-3.711 F +(database.)108 362.4 Q .245(Applications are normally e)108 379.2 R .244 +(xpected to specify a single directory home for their database.)-.15 F +.244(This can be done)5.244 F .564(easily in the call to)108 391.2 R F1 +(db_appinit)3.064 E F0 .565(by specifying a v)3.065 F .565(alue for the) +-.25 F F1(db_home)3.065 E F0(ar)3.065 E 3.065(gument. There)-.18 F .565 +(are more comple)3.065 F(x)-.15 E +(con\214gurations where it may be desirable to o)108 403.2 Q -.15(ve) +-.15 G(rride).15 E F1(db_home)2.5 E F0(or pro)2.5 E +(vide supplementary path information.)-.15 E 1.052(The follo)108 420 R +1.052(wing describes the possible w)-.25 F 1.052 +(ays in which \214le naming information may be speci\214ed to the DB)-.1 +F(library)108 432 Q 5.04(.T)-.65 G .04 +(he speci\214c circumstances and order in which these w)-5.04 F .04 +(ays are applied are described in a subsequent)-.1 F(paragraph.)108 444 +Q F1(db_home)108 460.8 Q F0 .815(If the)133 472.8 R F1(db_home)3.315 E +F0(ar)3.315 E .815(gument to)-.18 F F1(db_appinit)3.315 E F0 .815 +(is non-NULL, its v)3.315 F .815(alue may be used as the database home,) +-.25 F(and \214les named relati)133 484.8 Q .3 -.15(ve t)-.25 H 2.5(oi) +.15 G(ts path.)-2.5 E(DB_HOME)108 501.6 Q .173(If the DB_HOME en)133 +513.6 R .173(vironment v)-.4 F .173(ariable is set when)-.25 F F1 +(db_appinit)2.673 E F0 .174(is called, its v)2.674 F .174 +(alue may be used as the)-.25 F(database home, and \214les named relati) +133 525.6 Q .3 -.15(ve t)-.25 H 2.5(oi).15 G(ts path.)-2.5 E F1 +(db_con\214g)108 542.4 Q F0(The)133 554.4 Q F1(db_con\214g)2.629 E F0 +(ar)2.629 E .129(gument to)-.18 F F1(db_appinit)2.629 E F0 .129 +(may be used to specify an array of character strings of the for)2.629 F +(-)-.2 E 1.246(mat `)133 566.4 R(`N)-.74 E 1.247(AME V)-.35 F(ALUE') +-1.35 E 1.247 +(', that specify \214le name information for the process' DB en)-.74 F +3.747(vironment. The)-.4 F .967(whitespace delimiting the tw)133 578.4 R +3.467(op)-.1 G .966 +(arts of the entry may be one or more or characters.) +-3.467 F .642 +(\(Leading or trailing and characters are discarded.\))133 +590.4 R .642(Each entry must specify both the)5.642 F -.35(NA)133 602.4 +S 1.143(ME and the V).35 F 1.143(ALUE of the pair)-1.35 F 6.143(.A)-.55 +G 1.143(ll entries with unrecognized N)-6.143 F 1.142(AME v)-.35 F 1.142 +(alues will be ignored.)-.25 F(The)133 614.4 Q F1(db_con\214g)2.5 E F0 +(array must be NULL terminated.)2.5 E(DB_CONFIG)108 631.2 Q 1.19 +(The same information speci\214ed to the)133 643.2 R F1(db_con\214g)3.69 +E F0(ar)3.69 E 1.19(gument to)-.18 F F1(db_appinit)3.69 E F0 1.19 +(may be speci\214ed using a)3.69 F .308(con\214guration \214le.)133 +655.2 R .308(If a database home directory has been speci\214ed \(either by the application specify-) +5.308 F .323(ing a non-NULL)133 667.2 R F1(db_home)2.823 E F0(ar)2.823 E +.323(gument to)-.18 F F1(db_appinit)2.823 E F0 2.823(,o).68 G 2.823(rb) +-2.823 G 2.823(yt)-2.823 G .323(he application setting the DB_USE_ENV) +-2.823 F(-)-1 E(IR)133 679.2 Q 1.569(ON or DB_USE_ENVIR)-.4 F(ON_R)-.4 E +(OO)-.4 E 4.069<548d>-.4 G 1.569(ags and the DB_HOME en)-4.069 F 1.569 +(vironment v)-.4 F 1.569(ariable being set\),)-.25 F(an)133 691.2 Q +3.287<798c>-.15 G .787(le named `)-3.287 F(`DB_CONFIG')-.74 E 3.287('i) +-.74 G 3.287(nt)-3.287 G .788 +(he database home directory will be read for lines of the format)-3.287 +F -.74(``)133 703.2 S -.35(NA).74 G .117(ME V).35 F(ALUE')-1.35 E 2.617 +('. The)-.74 F .116(whitespace delimiting the tw)2.617 F 2.616(op)-.1 G +.116(arts of the line may be one or more )-2.616 F 1.17 +(or characters.)133 715.2 R 1.171 +(\(Leading or trailing and characters are discarded.\)) +6.17 F 1.171(All empty)6.171 F .851(lines or lines whose \214rst non-whitespace character is a hash character \(`) +133 727.2 R(`#')-.74 E .85('\) will be ignored.)-.74 F(Each)5.85 E +(May 1, 1998)280.585 768 Q(4)203.585 E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 327.74(DB_APPINIT\(3\) DB_APPINIT\(3\))72 48 R +.777(line must specify both the N)133 84 R .777(AME and the V)-.35 F +.777(ALUE of the pair)-1.35 F 5.777(.A)-.55 G .777 +(ll lines with unrecognized N)-5.777 F(AME)-.35 E -.25(va)133 96 S +(lues will be ignored.).25 E .645(The follo)108 112.8 R .645(wing `)-.25 +F(`N)-.74 E .645(AME V)-.35 F(ALUE')-1.35 E 3.145('p)-.74 G .644 +(airs in the)-3.145 F/F1 10/Times-Italic@0 SF(db_con\214g)3.144 E F0(ar) +3.144 E .644(gument and the DB_CONFIG \214le are currently)-.18 F +(supported by DB.)108 124.8 Q(DB_D)108 141.6 Q -1.21 -1.11(AT A)-.4 H +(_DIR)1.11 E .212(The path of a directory to be used as the location of the access method data \214les, e.g., paths speci\214ed) +133 153.6 R(to the)133 165.6 Q F1(db_open)2.5 E F0 +(\(3\) function will be relati).24 E .3 -.15(ve t)-.25 H 2.5(ot).15 G +(his path.)-2.5 E 1.045(The DB_D)133 182.4 R -1.21 -1.11(AT A)-.4 H +1.045(_DIR paths are additi)1.11 F -.15(ve)-.25 G 3.545(,a).15 G 1.045 +(nd specifying more than one will result in each speci\214ed)-3.545 F +.176(directory being searched for database data \214les.)133 194.4 R +.177(If multiple paths are speci\214ed, created data \214les will)5.177 +F(al)133 206.4 Q -.1(wa)-.1 G(ys be created in the).1 E/F2 10 +/Times-Bold@0 SF(\214rst)2.5 E F0(directory speci\214ed.)2.5 E +(DB_LOG_DIR)108 223.2 Q .38(The path of a directory to be used as the location of logging \214les, e.g., \214les created by the) +133 235.2 R F1(db_lo)2.88 E(g)-.1 E F0(\(3\)).22 E .181 +(subsystem will be relati)133 247.2 R .481 -.15(ve t)-.25 H 2.682(ot).15 +G .182(his directory)-2.682 F 5.182(.I)-.65 G 2.682(fs)-5.182 G .182 +(peci\214ed, this is the directory name that will be passed)-2.682 F(to) +133 259.2 Q F1(lo)2.5 E(g_open)-.1 E F0(\(3\).).24 E(DB_TMP_DIR)108 276 +Q 1.089(The path of a directory to be used as the location of temporary \214les, e.g., \214les created to back in-) +133 288 R .017(memory access method databases will be created relati)133 +300 R .317 -.15(ve t)-.25 H 2.517(ot).15 G .017(his path.)-2.517 F .018 +(Note, these temporary \214les can)5.018 F(potentially be quite lar)133 +312 Q(ge, depending on the size of the database.)-.18 E 3.149 +(If DB_TMP_DIR is not speci\214ed, the follo)133 336 R 3.148(wing en) +-.25 F 3.148(vironment v)-.4 F 3.148(ariables are check)-.25 F 3.148 +(ed in order:)-.1 F -.74(``)133 348 S(TMPDIR').74 E .812(', `)-.74 F +(`TEMP')-.74 E .812(', `)-.74 F(`TMP')-.74 E 3.312('a)-.74 G .812(nd `) +-3.312 F(`T)-.74 E(empF)-.7 E(older')-.15 E 3.312('. If)-.74 F .812 +(one of them is set, temporary \214les are cre-)3.312 F(ated relati)133 +360 Q .3 -.15(ve t)-.25 H 2.5(ot).15 G(he directory it speci\214es.)-2.5 +E .136(If DB_TMP_DIR is not speci\214ed and none of the abo)133 384 R +.436 -.15(ve e)-.15 H -.4(nv).15 G .135(ironment v).4 F .135 +(ariables are set, the \214rst possi-)-.25 F(ble one of the follo)133 +396 Q(wing directories is used:)-.25 E F1(/var/tmp)2.5 E F0(,).19 E F1 +(/usr/tmp)2.5 E F0(,).19 E F1(/temp)2.5 E F0(,).19 E F1(/tmp)2.5 E F0(,) +.19 E F1(C:/temp)2.5 E F0(and)2.5 E F1(C:/tmp)2.5 E F0(.).19 E .42 +(The follo)108 412.8 R .42 +(wing describes the speci\214c circumstances and order in which the dif) +-.25 F .42(ferent w)-.25 F .42(ays of specifying \214le)-.1 F .897 +(naming information are applied.)108 424.8 R(Speci\214cally)5.897 E +3.397(,D)-.65 G 3.397<428c>-3.397 G .896 +(le name processing proceeds sequentially through the)-3.397 F(follo)108 +436.8 Q(wing steps:)-.25 E -.74(``)108 453.6 S(/').74 E 10.38('I)-.74 G +2.689(fa)-10.38 G .489 -.15(ny \214)-2.689 H .189 +(le name speci\214ed to an).15 F 2.689(yD)-.15 G 2.689(Bf)-2.689 G .189 +(unction be)-2.689 F .19 +(gins with a leading slash, that \214le name is used with-)-.15 F +(out modi\214cation by DB.)133 465.6 Q(DB_CONFIG)108 482.4 Q .51 +(If a rele)133 494.4 R -.25(va)-.25 G .509 +(nt con\214guration string \(e.g., DB_D).25 F -1.21 -1.11(AT A)-.4 H +.509(_DIR\), is speci\214ed in the DB_CONFIG con\214gura-)1.11 F .781 +(tion \214le, the V)133 506.4 R .781(ALUE from the `)-1.35 F(`N)-.74 E +.781(AME V)-.35 F(ALUE')-1.35 E 3.281('p)-.74 G .781 +(air is prepended to the current \214le name.)-3.281 F .782(If the)5.782 +F .466(resulting \214le name be)133 518.4 R .466(gins with a leading slash, the \214le name is used without further modi\214cation by) +-.15 F(DB.)133 530.4 Q 1.295(The DB_CONFIG con\214guration \214le is intended to permit systems to customize \214le location for a) +133 554.4 R .407 +(database independent of applications using that database.)133 566.4 R +-.15(Fo)5.407 G 2.907(re).15 G .406 +(xample, a database administrator can)-3.057 F(mo)133 578.4 Q .3 -.15 +(ve t)-.15 H(he database log and data \214les to a dif).15 E +(ferent location without application recompilation.)-.25 E F1 +(db_con\214g)108 595.2 Q F0 .012(If a rele)133 607.2 R -.25(va)-.25 G +.013(nt con\214guration string \(e.g., DB_D).25 F -1.21 -1.11(AT A)-.4 H +.013(_DIR\), is speci\214ed in the)1.11 F F1(db_con\214g)2.513 E F0(ar) +2.513 E .013(gument and is)-.18 F .551 +(not speci\214ed in the DB_CONFIG \214le, the V)133 619.2 R .551 +(ALUE from the `)-1.35 F(`N)-.74 E .55(AME V)-.35 F(ALUE')-1.35 E 3.05 +('p)-.74 G .55(air is prepended to)-3.05 F 1.217 +(the current \214le name.)133 631.2 R 1.218 +(If the resulting \214le name be)6.217 F 1.218 +(gins with a leading slash, the \214le name is used)-.15 F +(without further modi\214cation by DB.)133 643.2 Q(The)133 667.2 Q F1 +(db_con\214g)3.195 E F0(ar)3.195 E .695(gument is intended to permit applications to customize \214le location for a database.) +-.18 F -.15(Fo)133 679.2 S 2.803(re).15 G .303(xample, an application writer can place data \214les and log \214les in dif) +-2.953 F .304(ferent directories, or instan-)-.25 F(tiate a ne)133 691.2 +Q 2.5(wl)-.25 G(og directory each time the application runs.)-2.5 E +(May 1, 1998)280.585 768 Q(5)203.585 E EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 327.74(DB_APPINIT\(3\) DB_APPINIT\(3\))72 48 R +(DB_HOME)108 84 Q 3.038(If the DB_HOME en)133 96 R 3.038(vironment v)-.4 +F 3.038(ariable w)-.25 F 3.038 +(as set, \(and the application has set the appropriate)-.1 F +(DB_USE_ENVIR)133 108 Q .673(ON or DB_USE_ENVIR)-.4 F(ON_R)-.4 E(OO)-.4 +E 3.174(Te)-.4 G -.4(nv)-3.174 G .674(ironment v).4 F .674 +(ariable\), its v)-.25 F .674(alue is prepended)-.25 F .613 +(to the current \214le name.)133 120 R .613 +(If the resulting \214le name be)5.613 F .612 +(gins with a leading slash, the \214le name is used)-.15 F +(without further modi\214cation by DB.)133 132 Q .395(The DB_HOME en)133 +156 R .395(vironment v)-.4 F .395 +(ariable is intended to permit users and system administrators to o)-.25 +F -.15(ve)-.15 G -.2(r-).15 G(ride application and installation def)133 +168 Q(aults, e.g.,)-.1 E(en)183 192 Q 2.5(vD)-.4 G +(B_HOME=/database/my_home application)-2.5 E(Alternati)133 216 Q -.15 +(ve)-.25 G(ly).15 E 2.533(,a)-.65 G .032 +(pplication writers are encouraged to support the)-2.533 F/F1 10 +/Times-Bold@0 SF2.532 E F0 .032(option found in the supporting DB) +2.532 F(utilities to let users specify a database home.)133 228 Q/F2 10 +/Times-Italic@0 SF(db_home)108 244.8 Q F0 1.091 +(If the application speci\214ed a non-NULL)133 256.8 R F2(db_home)3.591 +E F0(ar)3.592 E 1.092(gument to)-.18 F F2(db_appinit)3.592 E F0 1.092 +(\(and the database home)3.592 F -.1(wa)133 268.8 S 3.354(sn).1 G .854 +(ot already speci\214ed using the DB_HOME en)-3.354 F .854(vironment v) +-.4 F .853(ariable\) its v)-.25 F .853(alue is prepended to the)-.25 F +.198(current \214le name.)133 280.8 R .199 +(If the resulting \214le name be)5.199 F .199 +(gins with a leading slash, the \214le name is used without)-.15 F +(further modi\214cation by DB.)133 292.8 Q(\(nothing\))108 309.6 Q +(Finally)133 321.6 Q 2.5(,a)-.65 G +(ll \214le names are interpreted relati)-2.5 E .3 -.15(ve t)-.25 H 2.5 +(ot).15 G(he current w)-2.5 E(orking directory of the process.)-.1 E +.455(The common model for a DB en)108 338.4 R .455 +(vironment is one where only the DB_HOME en)-.4 F .455(vironment v)-.4 F +.455(ariable, or the)-.25 F F2(db_home)108 350.4 Q F0(ar)2.821 E .321 +(gument, is speci\214ed.)-.18 F .322 +(In this case, all data \214les will be presumed to be relati)5.321 F +.622 -.15(ve t)-.25 H 2.822(ot).15 G .322(hat directory)-2.822 F(,)-.65 +E(and all \214les created by the DB subsystems will be created in that directory) +108 362.4 Q(.)-.65 E .564(The more comple)108 379.2 R 3.064(xm)-.15 G +.564(odel for a transaction en)-3.064 F .564 +(vironment might be one where a database home is speci\214ed,)-.4 F +2.433(using either the DB_HOME en)108 391.2 R 2.434(vironment v)-.4 F +2.434(ariable or the)-.25 F F2(db_home)4.934 E F0(ar)4.934 E 2.434 +(gument to)-.18 F F2(db_appinit)4.934 E F0 4.934(,a).68 G 2.434(nd then) +-4.934 F(DB_D)108 403.2 Q -1.21 -1.11(AT A)-.4 H .67 +(_DIR and DB_LOG_DIR are set to the relati)1.11 F .969 -.15(ve p)-.25 H +.669(ath names of directories underneath the home).15 F +(directory using the)108 415.2 Q F2(db_con\214g)2.5 E F0(ar)2.5 E +(gument to)-.18 E F2(db_appinit)2.5 E F0(or the DB_CONFIG \214le.)2.5 E +/F3 9/Times-Bold@0 SF(EXAMPLES)72 432 Q F0 +(Store all \214les in the directory)108 444 Q F2(/a/database)2.5 E F0(:) +.18 E(db_appinit\("/a/database", NULL, ...\);)144 460.8 Q +(Create temporary backing \214les in)108 477.6 Q F2(/b/tempor)2.5 E(ary) +-.15 E F0 2.5(,a).32 G(nd all other \214les in)-2.5 E F2(/a/database)2.5 +E F0(:).18 E(char *con\214g[] = {)144 494.4 Q +("DB_TMP_DIR /b/temporary",)154 506.4 Q(NULL)154 518.4 Q(};)144 530.4 Q +(db_appinit\("/a/database", con\214g, ...\);)144 554.4 Q 1.208 +(Store data \214les in)108 571.2 R F2(/a/database/datadir)3.708 E F0 +3.708(,l).73 G 1.209(og \214les in)-3.708 F F2(/a/database/lo)3.709 E +(gdir)-.1 E F0 3.709(,a).73 G 1.209 +(nd all other \214les in the directory)-3.709 F F2(/a/database)108 583.2 +Q F0(:).18 E(char *con\214g[] = {)144 600 Q("DB_D)154 612 Q -1.21 -1.11 +(AT A)-.4 H(_DIR datadir",)1.11 E("DB_LOG_DIR logdir",)154 624 Q(NULL) +154 636 Q(};)144 648 Q(db_appinit\("/a/database", con\214g, ...\);)144 +672 Q .245(Store data \214les in)108 688.8 R F2(/a/database/data1)2.745 +E F0(and)2.745 E F2(/b/data2)2.745 E F0 2.744(,a).02 G .244 +(nd all other \214les in the directory)-2.744 F F2(/a/database)2.744 E +F0 5.244(.A).18 G .544 -.15(ny d)-5.244 H(ata).15 E +(\214les that are created will be created in)108 700.8 Q F2(/b/data2)2.5 +E F0(:).02 E(char *con\214g[] = {)144 717.6 Q("DB_D)154 729.6 Q -1.21 +-1.11(AT A)-.4 H(_DIR /b/data2",)1.11 E(May 1, 1998)280.585 768 Q(6) +203.585 E EP +%%Page: 7 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 327.74(DB_APPINIT\(3\) DB_APPINIT\(3\))72 48 R +("DB_D)154 84 Q -1.21 -1.11(AT A)-.4 H(_DIR data1",)1.11 E(NULL)154 96 Q +(};)144 108 Q(db_appinit\("/a/database", con\214g, ...\);)144 132 Q .54 +(See the \214le)108 148.8 R/F1 10/Times-Italic@0 SF -.2(ex)3.04 G +(amples/e).2 E(x_appinit.c)-.2 E F0 .54(in the DB source distrib)3.04 F +.54(ution for a C language code e)-.2 F .54(xample of ho)-.15 F 3.04(wa) +-.25 G(n)-3.04 E(application might use)108 160.8 Q F1(db_appinit)2.5 E +F0(to con\214gure its DB en)2.5 E(vironment.)-.4 E/F2 9/Times-Bold@0 SF +(ERR)72 177.6 Q(ORS)-.27 E F0(The)108 189.6 Q F1(db_appinit)2.921 E F0 +.421(function may f)2.921 F .421(ail and return)-.1 F F1(errno)2.921 E +F0 .421(for an)2.921 F 2.921(yo)-.15 G 2.92(ft)-2.921 G .42 +(he errors speci\214ed for the follo)-2.92 F .42(wing DB and)-.25 F +(library functions: DB->close\(3\), calloc\(3\), db_appe)108 201.6 Q +(xit\(3\), fclose\(3\), fcntl\(2\), f)-.15 E +(\215ush\(3\), fgets\(3\), fopen\(3\),)-.25 E(lock_open\(3\), lock_unlink\(3\), log_compare\(3\), log_get\(3\), log_open\(3\), log_unlink\(3\), malloc\(3\), mem-) +108 213.6 Q(cp)108 225.6 Q(y\(3\), memp_open\(3\), memp_unlink\(3\), memset\(3\), realloc\(3\), stat\(2\), strchr\(3\), strcmp\(3\), strcp) +-.1 E(y\(3\),)-.1 E(strdup\(3\), strerror\(3\), strlen\(3\), strsep\(3\), time\(3\), txn_checkpoint\(3\), txn_open\(3\), and txn_unlink\(3\).) +108 237.6 Q(In addition, the)108 254.4 Q F1(db_appinit)2.5 E F0 +(function may f)2.5 E(ail and return)-.1 E F1(errno)2.5 E F0 +(for the follo)2.5 E(wing conditions:)-.25 E([EINV)108 271.2 Q(AL])-1.35 +E(An in)133 283.2 Q -.25(va)-.4 G(lid \215ag v).25 E +(alue or parameter w)-.25 E(as speci\214ed.)-.1 E +(The DB_THREAD \215ag w)133 307.2 Q(as speci\214ed and spinlocks are not implemented for this architecture.) +-.1 E(The DB_RECO)133 331.2 Q(VER or DB_RECO)-.5 E(VER_F)-.5 E -1.21 +-1.11(AT A)-.74 H 2.5<4c8d>1.11 G(ag w)-2.5 E +(as speci\214ed, and no log \214les were found.)-.1 E +(The DB_HOME or TMPDIR en)133 355.2 Q(vironment v)-.4 E +(ariables were set b)-.25 E(ut empty)-.2 E(.)-.65 E +(An incorrectly formatted `)133 379.2 Q(`N)-.74 E(AME V)-.35 E(ALUE') +-1.35 E 2.5('e)-.74 G(ntry or line w)-2.5 E(as found.)-.1 E([ENOSPC])108 +396 Q(HP-UX only: a pre)133 408 Q(viously created DB en)-.25 E +(vironment for this process still e)-.4 E(xists.)-.15 E(The)108 424.8 Q +F1(db_appe)2.871 E(xit)-.2 E F0 .371(function may f)2.871 F .371 +(ail and return)-.1 F F1(errno)2.871 E F0 .371(for an)2.871 F 2.871(yo) +-.15 G 2.87(ft)-2.871 G .37(he errors speci\214ed for the follo)-2.87 F +.37(wing DB and)-.25 F(library functions: lock_close\(3\), log_close\(3\), memp_close\(3\), and txn_close\(3\).) +108 436.8 Q F2 -.09(BU)72 453.6 S(GS).09 E F0 .318 +(Due to the constraints of the P)108 465.6 R .318 +(A-RISC memory architecture, HP-UX does not allo)-.92 F 2.819(wap)-.25 G +.319(rocess to map a \214le)-2.819 F .222 +(into its address space multiple times.)108 477.6 R -.15(Fo)5.222 G +2.722(rt).15 G .222(his reason, each DB en)-2.722 F .221 +(vironment may be opened only once by a)-.4 F .542 +(process on HP-UX, i.e., calls to)108 489.6 R F1(appinit)3.043 E F0 .543 +(will f)3.043 F .543(ail if the speci\214ed DB en)-.1 F .543 +(vironment has been opened and not)-.4 F(subsequently closed.)108 501.6 +Q .815(On W)108 518.4 R(indo)-.4 E .814(ws/95, \214les that are opened by multiple processes do not share data correctly) +-.25 F 5.814(.T)-.65 G 3.314(ot)-6.614 G .814(ell Berk)-3.314 F(ele)-.1 +E(y)-.15 E 1.417(DB to use the paging \214le to share memory among processes, use the DB_REGION_N) +108 530.4 R 1.418(AME \215ag of the)-.35 F F1(db_value_set)108 542.4 Q +F0 3.713(function. Ob)3.713 F(viously)-.15 E 3.713(,y)-.65 G 1.212 +(ou do not need to do this if only a single process will be accessing) +-3.713 F(database \214les.)108 554.4 Q F2(SEE ALSO)72 571.2 Q F1(db_ar) +108 583.2 Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E F1(db_c)2.5 E(hec) +-.15 E(kpoint)-.2 E F0(\(1\),).68 E F1(db_deadloc)2.5 E(k)-.2 E F0 +(\(1\),).67 E F1(db_dump)2.5 E F0(\(1\),).19 E F1(db_load)2.5 E F0 +(\(1\),).77 E F1(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F1 +(db_stat)2.5 E F0(\(1\),).68 E F1(db_intr)108 595.2 Q(o)-.45 E F0 +(\(3\),).18 E F1(db_appinit)2.5 E F0(\(3\),).68 E F1(db_cur)2.5 E(sor) +-.1 E F0(\(3\),).73 E F1(db_dbm)2.5 E F0(\(3\),).32 E F1(db_internal)2.5 +E F0(\(3\),).51 E F1(db_loc)2.5 E(k)-.2 E F0(\(3\),).67 E F1(db_lo)2.5 E +(g)-.1 E F0(\(3\),).22 E F1(db_mpool)2.5 E F0(\(3\),).51 E F1(db_open) +108 607.2 Q F0(\(3\),).24 E F1(db_thr)2.5 E(ead)-.37 E F0(\(3\),).77 E +F1(db_txn)2.5 E F0(\(3\)).24 E(May 1, 1998)280.585 768 Q(7)203.585 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/man.ps/db_archive.ps b/mozilla/db/man/man.ps/db_archive.ps new file mode 100644 index 00000000000..7e47fc244d5 --- /dev/null +++ b/mozilla/db/man/man.ps/db_archive.ps @@ -0,0 +1,415 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:18 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 2 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_archi)108 40.8 Q .3 -.15(ve \255 t)-.25 H(he DB database archi).15 E +-.15(ve)-.25 G(r).15 E F0(SYNOPSIS)72 57.6 Q/F2 10/Times-Bold@0 SF +(db_ar)108 69.6 Q(chi)-.18 E -.1(ve)-.1 G F1([)2.6 E F2(-alsv)A F1 2.5 +(][)C F2(-h home)-2.5 E F1(])A F0(DESCRIPTION)72 86.4 Q F1(The)108 98.4 +Q/F3 10/Times-Italic@0 SF(db_ar)2.587 E -.15(ch)-.37 G(ive).15 E F1 .087 +(utility writes the pathnames of log \214les that are no longer in use \(e.g., no longer in) +2.587 F -.2(vo)-.4 G(lv).2 E .086(ed in)-.15 F(acti)108 110.4 Q 1.633 +-.15(ve t)-.25 H 1.334 +(ransactions\), to the standard output, one pathname per line.).15 F +1.334(These log \214les should be written to)6.334 F .467 +(backup media to pro)108 122.4 R .467(vide for reco)-.15 F -.15(ve)-.15 +G .467(ry in the case of catastrophic f).15 F .467 +(ailure \(which also requires a snapshot of)-.1 F +(the database \214les\), b)108 134.4 Q(ut the)-.2 E 2.5(ym)-.15 G +(ay then be deleted from the system to reclaim disk space.)-2.5 E +(The options are as follo)108 151.2 Q(ws:)-.25 E F2108 168 Q F1 +(Write all pathnames as absolute pathnames, instead of relati)14.3 E .3 +-.15(ve t)-.25 H 2.5(ot).15 G(he database home directories.)-2.5 E F2 +108 184.8 Q F1(Specify a home directory for the database.)13.74 E +F2108 201.6 Q F1 1.005(Write out the pathnames of all of the database log \214les, whether or not the) +16.52 F 3.505(ya)-.15 G 1.005(re in)-3.505 F -.2(vo)-.4 G(lv).2 E 1.005 +(ed in acti)-.15 F -.15(ve)-.25 G(transactions.)133 213.6 Q F2108 +230.4 Q F1 1.698(Write the pathnames of all of the database \214les that need to be archi) +15.41 F -.15(ve)-.25 G 4.198(di).15 G 4.198(no)-4.198 G 1.698 +(rder to reco)-4.198 F -.15(ve)-.15 G 4.198(rt).15 G(he)-4.198 E .065 +(database from catastrophic f)133 242.4 R 2.565(ailure. If)-.1 F(an) +2.565 E 2.565(yo)-.15 G 2.566(ft)-2.565 G .066(he database \214les ha) +-2.566 F .366 -.15(ve n)-.2 H .066(ot been accessed during the life-).15 +F(time of the current log \214les,)133 254.4 Q F3(db_ar)2.5 E -.15(ch) +-.37 G(ive).15 E F1(will not include them in this output.)2.5 E .318 +(It is possible that some of the \214les referenced in the log ha)133 +278.4 R .617 -.15(ve s)-.2 H .317(ince been deleted from the system.).15 +F(In)5.317 E .999(this case,)133 290.4 R F3(db_ar)3.499 E -.15(ch)-.37 G +(ive).15 E F1 .999(will ignore them.)3.499 F(When)5.999 E F3(db_r)3.499 +E(eco)-.37 E(ver)-.1 E F1 .999(\(1\) is run, an).73 F 3.5<798c>-.15 G 1 +(les referenced in the log)-3.5 F(that are not present during reco)133 +302.4 Q -.15(ve)-.15 G(ry are assumed to ha).15 E .3 -.15(ve b)-.2 H +(een deleted and will not be reco).15 E -.15(ve)-.15 G(red.).15 E F2 +108 319.2 Q F1(Run in v)14.3 E +(erbose mode, listing the checkpoints in the log \214les as the)-.15 E +2.5(ya)-.15 G(re re)-2.5 E(vie)-.25 E(wed.)-.25 E(The)108 336 Q F3 +(db_ar)4.422 E -.15(ch)-.37 G(ive).15 E F1 1.922 +(utility attaches to DB shared memory re)4.422 F 4.422(gions. In)-.15 F +1.922(order to a)4.422 F -.2(vo)-.2 G 1.922(id re).2 F 1.922 +(gion corruption, it)-.15 F 1.28(should al)108 348 R -.1(wa)-.1 G 1.28 +(ys be gi).1 F -.15(ve)-.25 G 3.78(nt).15 G 1.28 +(he chance to detach and e)-3.78 F 1.281(xit gracefully)-.15 F 6.281(.T) +-.65 G 3.781(oc)-7.081 G(ause)-3.781 E F3(db_ar)3.781 E -.15(ch)-.37 G +(ive).15 E F1 1.281(to clean up after)3.781 F(itself and e)108 360 Q +(xit, send it an interrupt signal \(SIGINT\).)-.15 E(The)108 376.8 Q F3 +(db_ar)2.5 E -.15(ch)-.37 G(ive).15 E F1(utility e)2.5 E +(xits 0 on success, and >0 if an error occurs.)-.15 E F0(DB ARCHIV)72 +393.6 Q(AL PR)-1.215 E(OCEDURES)-.27 E F1 .868(There are tw)108 405.6 R +3.368(oa)-.1 G .868(spects to managing the reco)-3.368 F -.15(ve)-.15 G +.868(rability and disk consumption of your DB databases.).15 F(First,) +5.868 E .592(you may w)108 417.6 R .592 +(ant to periodically create snapshots of your databases to mak)-.1 F +3.093(ei)-.1 G 3.093(tp)-3.093 G .593(ossible to reco)-3.093 F -.15(ve) +-.15 G 3.093(rt).15 G .593(hem from)-3.093 F 1.78(catastrophic f)108 +429.6 R 4.28(ailure. Second,)-.1 F(you')4.28 E 1.78(ll w)-.1 F 1.78 +(ant to periodically remo)-.1 F 2.08 -.15(ve l)-.15 H 1.78 +(og \214les in order to conserv).15 F 4.28(eo)-.15 G 4.28(nd)-4.28 G +(isk)-4.28 E 2.67(space. The)108 441.6 R(tw)2.67 E 2.67(op)-.1 G .17 +(rocedures are distinct from each other)-2.67 F 2.67(,a)-.4 G .17 +(nd you cannot remo)-2.67 F .47 -.15(ve t)-.15 H .17 +(he current log \214les simply).15 F(because you ha)108 453.6 Q .3 -.15 +(ve c)-.2 H(reated a database snapshot.).15 E 2.398 -.8(To c)108 470.4 T +.798(reate a snapshot of your database that can be used to reco).8 F +-.15(ve)-.15 G 3.297(rf).15 G .797(rom catastrophic f)-3.297 F .797 +(ailure, the follo)-.1 F(wing)-.25 E(steps should be tak)108 482.4 Q +(en:)-.1 E 15(1. Run)108 499.2 R F3(db_ar)3.385 E -.15(ch)-.37 G(ive).15 +E F1 .885 +(\255s to identify all of the database data \214les that must be sa) +3.385 F -.15(ve)-.2 G .886(d, and cop).15 F 3.386(yt)-.1 G .886 +(hem to a)-3.386 F 1.537(backup de)133 511.2 R 1.537 +(vice, \(e.g., tape\).)-.25 F 1.537(If the database \214les are stored in a separate directory from the other) +6.537 F(database \214les, it may be simpler to archi)133 523.2 Q .3 -.15 +(ve t)-.25 H(he directory itself instead of the indi).15 E +(vidual \214les.)-.25 E F2(Mor)133 547.2 Q 2.955(ei)-.18 G(mportantly) +-2.955 E 2.955(,i)-.55 G 2.955(fa)-2.955 G .455 +(ny of the database \214les ha)-2.955 F .655 -.1(ve n)-.25 H .455 +(ot been accessed during the lifetime of the).1 F(curr)133 559.2 Q .519 +(ent log \214les, db_ar)-.18 F(chi)-.18 E .719 -.1(ve w)-.1 H .519 +(ill not list them in its output!).1 F F1 -.15(Fo)5.519 G 3.019(rt).15 G +.518(his reason, it may be important)-3.019 F +(to use a separate database \214le directory)133 571.2 Q 2.5(,a)-.65 G +(rchi)-2.5 E(ving it instead of the \214les listed by)-.25 E F3(db_ar) +2.5 E -.15(ch)-.37 G(ive).15 E F1(.).18 E 15(2. If)108 588 R .914 +(your database is currently acti)3.414 F -.15(ve)-.25 G 3.414(,i).15 G +.914(.e., you are reading and writing to the database \214les while the) +-3.414 F 1.579(snapshot is being tak)133 600 R 1.579(en, run)-.1 F F3 +(db_ar)4.079 E -.15(ch)-.37 G(ive).15 E F1 1.579 +(\255l to identify the database log \214les, and cop)4.079 F 4.078(yt) +-.1 G 1.578(hem to a)-4.078 F .547(backup de)133 612 R .547 +(vice, \(e.g., tape\).)-.25 F .548(If the database log \214les are stored in a separate directory from the other) +5.547 F(database \214les, it may be simpler to archi)133 624 Q .3 -.15 +(ve t)-.25 H(he directory itself instead of the indi).15 E +(vidual \214les.)-.25 E .308(Note that the order of these operations is important, and that the database \214les) +108 640.8 R F2(must)2.808 E F1 .307(be archi)2.807 F -.15(ve)-.25 G +2.807(db).15 G .307(efore the)-2.807 F(log \214les.)108 652.8 Q .546(The DB library supports on-line backups, and it is not necessary to stop reading or writing your databases) +108 669.6 R .567(during the time when you create this snapshot.)108 +681.6 R .566(Note ho)5.567 F(we)-.25 E -.15(ve)-.25 G 1.366 -.4(r, t).15 +H .566(hat the snapshot of an acti).4 F .866 -.15(ve d)-.25 H .566 +(atabase will).15 F .312(be consistent as of some unspeci\214ed time between the start of the archi) +108 693.6 R -.25(va)-.25 G 2.812(la).25 G .312(nd when archi)-2.812 F +-.25(va)-.25 G 2.812(li).25 G 2.812(sc)-2.812 G(ompleted.)-2.812 E 2.19 +-.8(To c)108 705.6 T .59(reate a snapshot as of a speci\214c time, you must stop reading and writing your databases for the entire) +.8 F 1.555(time of the archi)108 717.6 R -.25(va)-.25 G 1.555 +(l, force a checkpoint \(see).25 F F3(db_c)4.056 E(hec)-.15 E(kpoint)-.2 +E F1 1.556(\(1\)\), and then archi).68 F 1.856 -.15(ve t)-.25 H 1.556 +(he \214les listed by the).15 F F3(db_ar)108 729.6 Q -.15(ch)-.37 G(ive) +.15 E F1(command')2.5 E(s)-.55 E F22.5 E F1(and)2.5 E F22.5 +E F1(options.)2.5 E(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 315.52(DB_ARCHIVE\(1\) DB_ARCHIVE\(1\))72 48 R +.606(Once these steps are completed, your database can be reco)108 84 R +-.15(ve)-.15 G .606(red from catastrophic f).15 F .606 +(ailure to its state as of)-.1 F .146(the time the archi)108 96 R -.25 +(va)-.25 G 2.646(lw).25 G .146(as done.)-2.746 F 1.746 -.8(To u)5.146 H +.147(pdate your snapshot so that reco).8 F -.15(ve)-.15 G .147 +(ry from catastrophic f).15 F .147(ailure is possi-)-.1 F +(ble up to a ne)108 108 Q 2.5(wp)-.25 G +(oint in time, repeat step #2, cop)-2.5 E(ying all e)-.1 E +(xisting log \214les to a backup de)-.15 E(vice.)-.25 E .357(Each time that a complete snapshot is made, i.e. all database and log \214les are copied to backup media, you) +108 124.8 R(may discard all pre)108 136.8 Q(vious snapshots and sa)-.25 +E -.15(ve)-.2 G 2.5(dl).15 G(og \214les.)-2.5 E .236 +(The time to restore from catastrophic f)108 153.6 R .236 +(ailure is a function of the number of log records that ha)-.1 F .537 +-.15(ve b)-.2 H .237(een writ-).15 F 2.088(ten since the snapshot w)108 +165.6 R 2.087(as originally created.)-.1 F 2.087 +(Perhaps more importantly)7.087 F 4.587(,t)-.65 G 2.087 +(he more separate pieces of)-4.587 F .608 +(backup media you use, the more lik)108 177.6 R .608 +(ely that you will ha)-.1 F .908 -.15(ve a p)-.2 H .608 +(roblem reading from one of them.).15 F -.15(Fo)5.608 G 3.108(rt).15 G +(hese)-3.108 E(reasons, it is often best to mak)108 189.6 Q 2.5(es)-.1 G +(napshots on a re)-2.5 E(gular basis.)-.15 E/F1 10/Times-Bold@0 SF -.25 +(Fo)108 206.4 S 2.758(ra).25 G -.18(rc)-2.758 G(hi).18 E -.1(va)-.1 G +2.758(ls).1 G .258(afety r)-2.758 F .258(emember to ensur)-.18 F 2.758 +(et)-.18 G .258(hat y)-2.758 F .258(ou ha)-.25 F .458 -.1(ve m)-.25 H +.258(ultiple copies of y).1 F .258(our database backups, that)-.25 F +-.25(yo)108 218.4 S 2.5(uv).25 G(erify that y)-2.6 E(our ar)-.25 E(chi) +-.18 E -.1(va)-.1 G 2.5(lm).1 G(edia is err)-2.5 E(or)-.18 E(-fr)-.37 E +(ee, and that copies of y)-.18 E(our backups ar)-.25 E 2.5(es)-.18 G +(tor)-2.5 E(ed off-site!)-.18 E F0 1.6 -.8(To r)108 235.2 T +(estore your database after catastrophic f).8 E(ailure, the follo)-.1 E +(wing steps should be tak)-.25 E(en:)-.1 E 15(1. Restore)108 252 R +(the copies of the database \214les from the backup media.)2.5 E 15 +(2. Restore)108 268.8 R .248 +(the copies of the log \214les from the backup media,)2.747 F F1 .248 +(in the order in which they wer)2.748 F 2.748(ew)-.18 G(ritten)-2.748 E +F0(.)A(\(It')133 280.8 Q 3.116(sp)-.55 G .616(ossible that the same log \214le appears on multiple backups, and you only w) +-3.116 F .615(ant the most recent)-.1 F -.15(ve)133 292.8 S +(rsion of that log \214le!\)).15 E 15(3. Run)108 309.6 R/F2 10 +/Times-Italic@0 SF(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\255c to reco)2.5 +E -.15(ve)-.15 G 2.5(rt).15 G(he database.)-2.5 E 1.344 +(It is possible to recreate the database in a location dif)108 326.4 R +1.344(ferent than the original, by specifying appropriate)-.25 F +(pathnames to the \255h option of the)108 338.4 Q F2(db_r)2.5 E(eco)-.37 +E(ver)-.1 E F0(utility)2.5 E(.)-.65 E 1.6 -.8(To r)108 355.2 T(emo).8 E +.3 -.15(ve l)-.15 H(og \214les, the follo).15 E +(wing steps should be tak)-.25 E(en:)-.1 E 15(1. If)108 372 R 2.19 +(you are concerned with catastrophic f)4.69 F 2.19(ailure, \214rst cop) +-.1 F 4.69(yt)-.1 G 2.19(hem to backup media \(e.g., tape\), as)-4.69 F +(described abo)133 384 Q -.15(ve)-.15 G 5(.T).15 G +(his is because log \214les are necessary for reco)-5 E -.15(ve)-.15 G +(ry from catastrophic f).15 E(ailure.)-.1 E 15(2. Run)108 400.8 R F2 +(db_ar)4.567 E -.15(ch)-.37 G(ive).15 E F0 4.567(,w).18 G 2.067(ithout options, to identify all of the log \214les that are no longer in use \(e.g.,) +-4.567 F(in)133 412.8 Q -.2(vo)-.4 G(lv).2 E(ed in an acti)-.15 E .3 +-.15(ve t)-.25 H(ransaction\).).15 E 15(3. Remo)108 429.6 R .3 -.15 +(ve t)-.15 H(hose log \214les from the system.).15 E/F3 9/Times-Bold@0 +SF(ENVIR)72 446.4 Q(ONMENT V)-.27 E(ARIABLES)-1.215 E F0(The follo)108 +458.4 Q(wing en)-.25 E(vironment v)-.4 E(ariables af)-.25 E(fect the e) +-.25 E -.15(xe)-.15 G(cution of).15 E F2(db_ar)2.5 E -.15(ch)-.37 G(ive) +.15 E F0(:).18 E(DB_HOME)108 475.2 Q .222(If the)133 487.2 R F1 +2.722 E F0 .222(option is not speci\214ed and the en)2.722 F .222 +(vironment v)-.4 F(ariable)-.25 E F2(DB_HOME)2.722 E F0 .221 +(is set, it is used as the path)2.721 F +(of the database home, as described in)133 499.2 Q F2(db_appinit)2.5 E +F0(\(3\).).68 E F3(SEE ALSO)72 516 Q F0 .485(The DB library is a f)108 +528 R .485(amily of groups of functions that pro)-.1 F .486 +(vides a modular programming interf)-.15 F .486(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 540 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .506(\214le page caching, as well as v)108 552 R .506 +(arious inde)-.25 F -.15(xe)-.15 G 3.006(da).15 G .506(ccess methods.) +-3.006 F(Man)5.507 E 3.007(yo)-.15 G 3.007(ft)-3.007 G .507 +(he functional groups \(e.g., the \214le)-3.007 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 564 R .121(are e)108 576 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.122 G 2.622(rag).15 G .122(eneral description of)-2.622 +F(the DB package, see)108 588 Q F2(db_intr)2.5 E(o)-.45 E F0(\(3\).).18 +E F2(db_ar)108 604.8 Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E F2(db_c) +2.5 E(hec)-.15 E(kpoint)-.2 E F0(\(1\),).68 E F2(db_deadloc)2.5 E(k)-.2 +E F0(\(1\),).67 E F2(db_dump)2.5 E F0(\(1\),).19 E F2(db_load)2.5 E F0 +(\(1\),).77 E F2(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F2 +(db_stat)2.5 E F0(\(1\),).68 E F2(db_intr)108 616.8 Q(o)-.45 E F0 +(\(3\),).18 E F2(db_appinit)2.5 E F0(\(3\),).68 E F2(db_cur)2.5 E(sor) +-.1 E F0(\(3\),).73 E F2(db_dbm)2.5 E F0(\(3\),).32 E F2(db_internal)2.5 +E F0(\(3\),).51 E F2(db_loc)2.5 E(k)-.2 E F0(\(3\),).67 E F2(db_lo)2.5 E +(g)-.1 E F0(\(3\),).22 E F2(db_mpool)2.5 E F0(\(3\),).51 E F2(db_open) +108 628.8 Q F0(\(3\),).24 E F2(db_thr)2.5 E(ead)-.37 E F0(\(3\),).77 E +F2(db_txn)2.5 E F0(\(3\)).24 E(May 3, 1998)280.585 768 Q(2)203.585 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/man.ps/db_checkpoint.ps b/mozilla/db/man/man.ps/db_checkpoint.ps new file mode 100644 index 00000000000..592d152b002 --- /dev/null +++ b/mozilla/db/man/man.ps/db_checkpoint.ps @@ -0,0 +1,277 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:18 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 1 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_checkpoint \255 the DB database checkpoint utility)108 40.8 Q F0 +(SYNOPSIS)72 57.6 Q/F2 10/Times-Bold@0 SF(db_checkpoint)108 69.6 Q F1([) +2.5 E F2(-1v)A F1 2.5(][)C F2(-h home)-2.5 E F1 2.5(][)C F2(-k kbytes) +-2.5 E F1 2.5(][)C F2(-L \214le)-2.5 E F1 2.5(][)C F2(-p min)-2.5 E F1 +(])A F0(DESCRIPTION)72 86.4 Q F1(The)108 98.4 Q/F3 10/Times-Italic@0 SF +(db_c)5.093 E(hec)-.15 E(kpoint)-.2 E F1 2.592(utility is a daemon process that monitors the database log and periodically calls) +5.093 F F3(txn_c)108 110.4 Q(hec)-.15 E(kpoint)-.2 E F1 +(\(3\) to checkpoint it.).68 E(The options are as follo)108 127.2 Q(ws:) +-.25 E F2108 144 Q F1(Checkpoint the log once, and then e)14.3 E +(xit.)-.15 E F2108 160.8 Q F1 +(Specify a home directory for the database.)13.74 E F2108 177.6 Q +F1(Checkpoint the database at least as often as e)13.74 E -.15(ve)-.25 G +(ry).15 E F3(kbytes)2.5 E F1(of log \214le are written.)2.5 E F2 +108 194.4 Q F1 1.246(Log the e)12.63 F -.15(xe)-.15 G 1.247(cution of the db_checkpoint utility to the speci\214ed \214le in the follo) +.15 F 1.247(wing format, where)-.25 F -.74(``)133 206.4 S(###').74 E 2.5 +('i)-.74 G 2.5(st)-2.5 G +(he process ID, and the date is the time the utility starting running.) +-2.5 E(db_checkpoint: ### W)133 230.4 Q(ed Jun 15 01:23:45 EDT 1995)-.8 +E(This \214le will be remo)133 254.4 Q -.15(ve)-.15 G 2.5(di).15 G 2.5 +(ft)-2.5 G(he db_checkpoint utility e)-2.5 E(xits gracefully)-.15 E(.) +-.65 E F2108 271.2 Q F1(Checkpoint the database at least e)13.74 E +-.15(ve)-.25 G(ry).15 E F3(min)2.5 E F1(minutes.)2.5 E F2108 288 Q +F1(Write the time of each checkpoint to the standard output.)14.3 E +(At least one of the)108 304.8 Q F22.5 E F1(,)A F22.5 E F1 +(and)2.5 E F22.5 E F1(options must be speci\214ed.)2.5 E(The)108 +321.6 Q F3(db_c)3.522 E(hec)-.15 E(kpoint)-.2 E F1 1.022 +(utility attaches to DB shared memory re)3.522 F 3.522(gions. In)-.15 F +1.022(order to a)3.522 F -.2(vo)-.2 G 1.022(id re).2 F 1.022 +(gion corruption, it)-.15 F .486(should al)108 333.6 R -.1(wa)-.1 G .486 +(ys be gi).1 F -.15(ve)-.25 G 2.986(nt).15 G .486 +(he chance to detach and e)-2.986 F .487(xit gracefully)-.15 F 5.487(.T) +-.65 G 2.987(oc)-6.287 G(ause)-2.987 E F3(db_c)2.987 E(hec)-.15 E +(kpoint)-.2 E F1 .487(to clean up after)2.987 F(itself and e)108 345.6 Q +(xit, send it an interrupt signal \(SIGINT\).)-.15 E(The)108 362.4 Q F3 +(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F1(utility e)2.5 E +(xits 0 on success, and >0 if an error occurs.)-.15 E F0(ENVIR)72 379.2 +Q(ONMENT V)-.27 E(ARIABLES)-1.215 E F1(The follo)108 391.2 Q(wing en) +-.25 E(vironment v)-.4 E(ariables af)-.25 E(fect the e)-.25 E -.15(xe) +-.15 G(cution of).15 E F3(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F1(:).68 E +(DB_HOME)108 408 Q .222(If the)133 420 R F22.722 E F1 .222 +(option is not speci\214ed and the en)2.722 F .222(vironment v)-.4 F +(ariable)-.25 E F3(DB_HOME)2.722 E F1 .221 +(is set, it is used as the path)2.721 F +(of the database home, as described in)133 432 Q F3(db_appinit)2.5 E F1 +(\(3\).).68 E F0(SEE ALSO)72 448.8 Q F1 .485(The DB library is a f)108 +460.8 R .485(amily of groups of functions that pro)-.1 F .486 +(vides a modular programming interf)-.15 F .486(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 472.8 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .506(\214le page caching, as well as v)108 484.8 R .506 +(arious inde)-.25 F -.15(xe)-.15 G 3.006(da).15 G .506(ccess methods.) +-3.006 F(Man)5.507 E 3.007(yo)-.15 G 3.007(ft)-3.007 G .507 +(he functional groups \(e.g., the \214le)-3.007 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 496.8 R .121(are e)108 508.8 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.122 G 2.622(rag).15 G .122(eneral description of)-2.622 +F(the DB package, see)108 520.8 Q F3(db_intr)2.5 E(o)-.45 E F1(\(3\).) +.18 E F3(db_ar)108 537.6 Q -.15(ch)-.37 G(ive).15 E F1(\(1\),).18 E F3 +(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F1(\(1\),).68 E F3(db_deadloc)2.5 E +(k)-.2 E F1(\(1\),).67 E F3(db_dump)2.5 E F1(\(1\),).19 E F3(db_load)2.5 +E F1(\(1\),).77 E F3(db_r)2.5 E(eco)-.37 E(ver)-.1 E F1(\(1\),).73 E F3 +(db_stat)2.5 E F1(\(1\),).68 E F3(db_intr)108 549.6 Q(o)-.45 E F1 +(\(3\),).18 E F3(db_appinit)2.5 E F1(\(3\),).68 E F3(db_cur)2.5 E(sor) +-.1 E F1(\(3\),).73 E F3(db_dbm)2.5 E F1(\(3\),).32 E F3(db_internal)2.5 +E F1(\(3\),).51 E F3(db_loc)2.5 E(k)-.2 E F1(\(3\),).67 E F3(db_lo)2.5 E +(g)-.1 E F1(\(3\),).22 E F3(db_mpool)2.5 E F1(\(3\),).51 E F3(db_open) +108 561.6 Q F1(\(3\),).24 E F3(db_thr)2.5 E(ead)-.37 E F1(\(3\),).77 E +F3(db_txn)2.5 E F1(\(3\)).24 E(1)535 768 Q EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/man.ps/db_cursor.ps b/mozilla/db/man/man.ps/db_cursor.ps new file mode 100644 index 00000000000..4416589de46 --- /dev/null +++ b/mozilla/db/man/man.ps/db_cursor.ps @@ -0,0 +1,613 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:20 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 5 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_cursor \255 database sequential access functions)108 40.8 Q F0 +(SYNOPSIS)72 57.6 Q/F2 10/Times-Bold@0 SF(#include ) +-.4 E(int)108 93.6 Q(DBcursor)108 105.6 Q(->c_close\(DBC *cursor\);)-.37 +E(int)108 129.6 Q(DBcursor)108 141.6 Q(->c_del\(DBC *cursor)-.37 E 2.5 +(,u)-.92 G(_int32_t \215ags\);)-2.5 E(int)108 165.6 Q(DBcursor)108 177.6 +Q(->c_get\(DBC *cursor)-.37 E 2.5(,D)-.92 G(BT *k)-2.5 E(ey)-.1 E 2.5 +(,D)-.55 G(BT *data, u_int32_t \215ags\);)-2.5 E(int)108 201.6 Q +(DBcursor)108 213.6 Q(->c_put\(DBC *, DBT *k)-.37 E(ey)-.1 E 2.5(,D)-.55 +G(BT *data, u_int32_t \215ags\);)-2.5 E F0(DESCRIPTION)72 230.4 Q F1 +.486(The DB library is a f)108 242.4 R .485 +(amily of groups of functions that pro)-.1 F .485 +(vides a modular programming interf)-.15 F .485(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 254.4 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .507(\214le page caching, as well as v)108 266.4 R .507 +(arious inde)-.25 F -.15(xe)-.15 G 3.007(da).15 G .506(ccess methods.) +-3.007 F(Man)5.506 E 3.006(yo)-.15 G 3.006(ft)-3.006 G .506 +(he functional groups \(e.g., the \214le)-3.006 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 278.4 R .122(are e)108 290.4 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.121 G 2.621(rag).15 G .121(eneral description of)-2.621 +F(the DB package, see)108 302.4 Q/F3 10/Times-Italic@0 SF(db_intr)2.5 E +(o)-.45 E F1(\(3\).).18 E(This manual page describes the speci\214c details of the cursor support for the DB access methods.) +108 319.2 Q(The)108 336 Q F3(db_cur)3.152 E(sor)-.1 E F1 .652 +(functions are the library interf)3.152 F .653 +(ace supporting sequential access to the records stored by the)-.1 F +1.294(access methods of the DB library)108 348 R 6.294(.C)-.65 G 1.294 +(ursors are created by calling the)-6.294 F F3(cur)3.794 E(sor)-.1 E F1 +1.294(function of a DB structure)3.794 F(returned by)108 360 Q F3 +(db_open)2.5 E F1(\(3\), which returns a pointer to a DBC structure.).24 +E 1.025(Each cursor maintains positioning information within a set of k) +108 376.8 R -.15(ey)-.1 G 1.025(/data pairs.).15 F 1.026 +(In the presence of transac-)6.026 F .722(tions, cursors are only v)108 +388.8 R .722(alid within the conte)-.25 F .722 +(xt of a single transaction, the one speci\214ed during the)-.15 F F3 +(cur)3.221 E(sor)-.1 E F1 1.596(call described in)108 400.8 R F3 +(db_open)4.096 E F1 4.096(\(3\). All).24 F 1.597 +(cursor operations will be e)4.096 F -.15(xe)-.15 G 1.597 +(cuted in the conte).15 F 1.597(xt of that transaction.)-.15 F .284(Before aborting or committing a transaction, all cursors used within that transaction must be closed.) +108 412.8 R .284(In the)5.284 F .885 +(presence of transactions, the application must call)108 424.8 R F3 +(txn_abort)3.386 E F1 .886(if an)3.386 F 3.386(yo)-.15 G 3.386(ft)-3.386 +G .886(he cursor operations returns that a)-3.386 F(deadlock \(EA)108 +436.8 Q(GAIN\) or system f)-.4 E(ailure occurred.)-.1 E .513 +(When locking is enabled, page locks are retained between consecuti)108 +453.6 R .812 -.15(ve c)-.25 H .512(ursor calls.).15 F -.15(Fo)5.512 G +3.012(rt).15 G .512(his reason, in the)-3.012 F .13(presence of locking, applications should discard cursors as soon as the) +108 465.6 R 2.63(ya)-.15 G .13(re done with them.)-2.63 F .13 +(Calling the db)5.13 F F3(close)108 477.6 Q F1 1.385(function \(see) +3.885 F F3(db_open)3.885 E F1 1.385(\(3\)\) discards an).24 F 3.885(yc) +-.15 G 1.385(ursors opened in the conte)-3.885 F 1.384 +(xt of a particular DB structure)-.15 F(returned by the)108 489.6 Q F3 +(db_open)2.5 E F1(call.)2.5 E .221(The cursor has an associated set of functions to access elements in the database, accessed through the DBC) +108 506.4 R 2.5(structure. The)108 518.4 R +(elements of the DBC structure are de\214ned as follo)2.5 E(ws:)-.25 E +(int \(*c_close\)\(DBC *cursor\);)108 535.2 Q 2.5(Ap)133 547.2 S +(ointer to a function that discards the cursor)-2.5 E 5(.N)-.55 G 2.5 +(of)-5 G(urther references to the cursor should be made.)-2.5 E(The)133 +564 Q F3(c_close)2.5 E F1(function returns the v)2.5 E(alue of)-.25 E F3 +(errno)2.5 E F1(on f)2.5 E(ailure and 0 on success.)-.1 E +(int \(*c_del\)\(DBC *cursor)108 580.8 Q 2.5(,u)-.4 G +(_int32_t \215ags\);)-2.5 E 2.5(Ap)133 592.8 S +(ointer to a function that deletes the k)-2.5 E -.15(ey)-.1 G +(/data pair currently referenced by the cursor).15 E(.)-.55 E(The)133 +609.6 Q F3<8d61>2.5 E(gs)-.1 E F1 +(parameter is currently unused, and must be set to 0.)2.5 E .13(The cursor position is unchanged after a delete and subsequent calls to cursor functions e) +133 626.4 R .13(xpecting the)-.15 F(cursor to reference an e)133 638.4 Q +(xisting k)-.15 E .3 -.15(ey w)-.1 H(ill f).15 E(ail.)-.1 E(The)133 +655.2 Q F3(c_del)3.276 E F1 .776(function returns the v)3.276 F .776 +(alue of)-.25 F F3(errno)3.276 E F1 .776(on f)3.276 F .777 +(ailure, 0 on success, and DB_KEYEMPTY if the)-.1 F +(element has already been deleted.)133 667.2 Q +(int \(*c_get\)\(DBC *cursor)108 684 Q 2.5(,D)-.4 G(BT *k)-2.5 E -.15 +(ey)-.1 G 2.5(,D)-.5 G(BT *data, u_int32_t \215ags\);)-2.5 E 2.776(Ap) +133 696 S .276(ointer to a function that retrie)-2.776 F -.15(ve)-.25 G +2.775(sk).15 G -.15(ey)-2.875 G .275(/data pairs from the database.).15 +F .275(The address and length of the)5.275 F -.1(ke)133 708 S 2.663(ya) +-.05 G .163(re returned in the structure referenced by)-2.663 F F3 -.1 +(ke)2.663 G(y)-.2 E F1(\(e)2.663 E .164 +(xcept for the case of the DB_SET \215ag where the)-.15 F F3 -.1(ke)133 +720 S(y)-.2 E F1 1.841(structure is unchanged\), and the address and length of the data are returned in the structure) +4.341 F(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 324.38(DB_CURSOR\(3\) DB_CURSOR\(3\))72 48 R +(referenced by)133 84 Q/F1 10/Times-Italic@0 SF(data)2.5 E F0(.).26 E +1.953(Modi\214cations to the database during a sequential scan will be re\215ected in the scan, i.e. records) +133 108 R 1.871(inserted behind a cursor will not be returned while records inserted in front of a cursor will be) +133 120 R(returned.)133 132 Q .085 +(In recno databases, missing entries \(i.e., entries that were ne)133 +156 R -.15(ve)-.25 G 2.585(re).15 G .086 +(xplicitly created or that were created)-2.735 F +(and then deleted\), will be skipped during a sequential scan.)133 168 Q +1.173(If multiple threads or processes insert items into the same database \214le without using locking, the) +133 192 R(results are unde\214ned.)133 204 Q -.15(Fo)5 G 2.5(rm).15 G +(ore detail, see the section belo)-2.5 E 2.5(wo)-.25 G 2.5(nc)-2.5 G +(ursor stability)-2.5 E(.)-.65 E(The parameter)133 220.8 Q F1<8d61>2.5 E +(gs)-.1 E F0(must be set to e)2.5 E(xactly one of the follo)-.15 E +(wing v)-.25 E(alues:)-.25 E(DB_FIRST)133 237.6 Q .053 +(The cursor is set to reference the \214rst k)158 249.6 R -.15(ey)-.1 G +.054(/data pair of the database, and that pair is returned.).15 F(In) +5.054 E(the presence of duplicate k)158 261.6 Q .3 -.15(ey v)-.1 H +(alues, the \214rst data item in the set of duplicates is returned.)-.1 +E(If the database is empty)158 278.4 Q 2.5(,t)-.65 G(he)-2.5 E F1(c_g) +2.5 E(et)-.1 E F0(function will return DB_NO)2.5 E(TFOUND.)-.4 E +(DB_LAST)133 295.2 Q .146(The cursor is set to reference the last k)158 +307.2 R -.15(ey)-.1 G .146 +(/data pair of the database, and that pair is returned.).15 F(In)5.146 E +(the presence of duplicate k)158 319.2 Q .3 -.15(ey v)-.1 H +(alues, the last data item in the set of duplicates is returned.)-.1 E +(If the database is empty)158 336 Q 2.5(,t)-.65 G(he)-2.5 E F1(c_g)2.5 E +(et)-.1 E F0(function will return DB_NO)2.5 E(TFOUND.)-.4 E(DB_NEXT)133 +352.8 Q +(If the cursor is not yet initialized, DB_NEXT is identical to DB_FIRST) +158 364.8 Q(.)-.74 E .503(Otherwise, mo)158 381.6 R .803 -.15(ve t)-.15 +H .503(he cursor to the ne).15 F .504(xt k)-.15 F -.15(ey)-.1 G .504 +(/data pair of the database, and that pair is returned.).15 F +(In the presence of duplicate k)158 393.6 Q .3 -.15(ey v)-.1 H +(alues, the v)-.1 E(alue of the k)-.25 E .3 -.15(ey m)-.1 H +(ay not change.).15 E 2.306 +(If the cursor is already on the last record in the database, the)158 +410.4 R F1(c_g)4.806 E(et)-.1 E F0 2.306(function will return)4.806 F +(DB_NO)158 422.4 Q(TFOUND.)-.4 E(DB_PREV)133 439.2 Q +(If the cursor is not yet initialized, DB_PREV is identical to DB_LAST) +158 451.2 Q(.)-.74 E 1.95(Otherwise, mo)158 468 R 2.25 -.15(ve t)-.15 H +1.95(he cursor to the pre).15 F 1.951(vious k)-.25 F -.15(ey)-.1 G 1.951 +(/data pair of the database, and that pair is).15 F 2.5(returned. In)158 +480 R(the presence of duplicate k)2.5 E .3 -.15(ey v)-.1 H(alues, the v) +-.1 E(alue of the k)-.25 E .3 -.15(ey m)-.1 H(ay not change.).15 E 2.202 +(If the cursor is already on the \214rst record in the database, the)158 +496.8 R F1(c_g)4.702 E(et)-.1 E F0 2.201(function will return)4.702 F +(DB_NO)158 508.8 Q(TFOUND.)-.4 E(DB_CURRENT)133 525.6 Q(Return the k)158 +537.6 Q -.15(ey)-.1 G(/data pair currently referenced by the cursor).15 +E(.)-.55 E(If the cursor k)158 554.4 Q -.15(ey)-.1 G +(/data pair has been deleted, the).15 E F1(c_g)2.5 E(et)-.1 E F0 +(function will return DB_KEYEMPTY)2.5 E(.)-1.29 E +(If the cursor is not yet initialized, the)158 571.2 Q F1(c_g)2.5 E(et) +-.1 E F0(function will return EINV)2.5 E(AL.)-1.35 E(DB_SET)133 588 Q +(Mo)158 600 Q .66 -.15(ve t)-.15 H .36(he cursor to the speci\214ed k) +.15 F -.15(ey)-.1 G .361 +(/data pair of the database, and return the datum associated).15 F +(with the gi)158 612 Q -.15(ve)-.25 G 2.5(nk).15 G -.15(ey)-2.6 G(.)-.5 +E(In the presence of duplicate k)158 628.8 Q .3 -.15(ey v)-.1 H(alues,) +-.1 E F1(c_g)2.5 E(et)-.1 E F0 +(will return the \214rst data item for the gi)2.5 E -.15(ve)-.25 G 2.5 +(nk).15 G -.15(ey)-2.6 G(.)-.5 E .019 +(If the database is a recno database and the requested k)158 645.6 R +.319 -.15(ey ex)-.1 H .019(ists, b).15 F .018(ut w)-.2 F .018(as ne)-.1 +F -.15(ve)-.25 G 2.518(re).15 G .018(xplicitly created)-2.668 F +(by the application or w)158 657.6 Q(as later deleted, the)-.1 E F1(c_g) +2.5 E(et)-.1 E F0(function returns DB_KEYEMPTY)2.5 E(.)-1.29 E +(If no matching k)158 674.4 Q -.15(ey)-.1 G 2.5(sa).15 G(re found, the) +-2.5 E F1(c_g)2.5 E(et)-.1 E F0(function will return DB_NO)2.5 E +(TFOUND.)-.4 E(DB_SET_RANGE)133 691.2 Q .458 +(The DB_SET_RANGE \215ag is identical to the DB_SET \215ag, e)158 703.2 +R .459(xcept that the k)-.15 F .759 -.15(ey i)-.1 H 2.959(sr).15 G .459 +(eturned as)-2.959 F .454(well as the data item, and, in the case of the btree access method, the returned k) +158 715.2 R -.15(ey)-.1 G .453(/data pair is).15 F 1.004(the smallest k) +158 727.2 R 1.304 -.15(ey g)-.1 H 1.005 +(reater than or equal to the speci\214ed k).15 F 1.305 -.15(ey \()-.1 H +1.005(as determined by the comparison).15 F(April 10, 1998)276.695 768 Q +(2)199.695 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 324.38(DB_CURSOR\(3\) DB_CURSOR\(3\))72 48 R +(function\), permitting partial k)158 84 Q .3 -.15(ey m)-.1 H +(atches and range searches.).15 E(DB_SET_RECNO)133 100.8 Q(Mo)158 112.8 +Q 1.84 -.15(ve t)-.15 H 1.54(he cursor to the speci\214c numbered record of the database, and return the associated) +.15 F -.1(ke)158 124.8 S .404(y/data pair)-.05 F 5.404(.T)-.55 G(he) +-5.404 E/F1 10/Times-Italic@0 SF(data)2.904 E F0 .404 +(\214eld of the speci\214ed)2.904 F F1 -.1(ke)2.904 G(y)-.2 E F0 .404 +(must be a pointer to a memory location from)2.904 F 1.335(which a)158 +136.8 R F1(db_r)3.835 E(ecno_t)-.37 E F0 1.335 +(may be read, as described in)3.835 F F1(db_dbt)3.835 E F0 3.835 +(\(3\). This).68 F 1.335(memory location will be)3.835 F +(read to determine the record to be retrie)158 148.8 Q -.15(ve)-.25 G +(d.).15 E -.15(Fo)158 172.8 S 3.787(rD).15 G 1.287(B_SET_RECNO to be speci\214ed, the underlying database must be of type btree and it) +-3.787 F(must ha)158 184.8 Q .3 -.15(ve b)-.2 H +(een created with the DB_RECNUM \215ag \(see).15 E F1(db_open)2.5 E F0 +(\(3\)\).).24 E(DB_GET_RECNO)133 201.6 Q .942 +(Return the record number associated with the cursor)158 213.6 R 5.942 +(.T)-.55 G .942(he record number will be returned in)-5.942 F +(the data DBT as described in)158 225.6 Q F1(db_dbt)2.5 E F0 2.5 +(\(3\). The).68 F F1 -.1(ke)2.5 G(y)-.2 E F0(parameter is ignored.)2.5 E +-.15(Fo)158 249.6 S 3.668(rD).15 G 1.169(B_GET_RECNO to be speci\214ed, the underlying database must be of type btree and it) +-3.668 F(must ha)158 261.6 Q .3 -.15(ve b)-.2 H +(een created with the DB_RECNUM \215ag \(see).15 E F1(db_open)2.5 E F0 +(\(3\)\).).24 E(Otherwise, the)133 278.4 Q F1(c_g)2.5 E(et)-.1 E F0 +(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E(If)133 295.2 Q F1(c_g)2.5 E(et)-.1 E F0 +-.1(fa)2.5 G(ils for an).1 E 2.5(yr)-.15 G +(eason, the state of the cursor will be unchanged.)-2.5 E +(int \(*c_put\)\(DBC *, DBT *k)108 312 Q -.15(ey)-.1 G 2.5(,D)-.5 G +(BT *data, u_int32_t \215ags\);)-2.5 E 2.5(Ap)133 324 S +(ointer to a function that stores k)-2.5 E -.15(ey)-.1 G +(/data pairs into the database.).15 E(The)133 340.8 Q F1<8d61>2.5 E(gs) +-.1 E F0(parameter must be set to e)2.5 E(xactly one of the follo)-.15 E +(wing v)-.25 E(alues:)-.25 E(DB_AFTER)133 357.6 Q .156(In the case of the btree and hash access methods, insert the data element as a duplicate element) +158 369.6 R 1.099(of the k)158 381.6 R 1.399 -.15(ey r)-.1 H 1.099 +(eferenced by the cursor).15 F 6.099(.T)-.55 G 1.099(he ne)-6.099 F +3.599(we)-.25 G 1.1(lement appears immediately after the current)-3.599 +F .712(cursor position.)158 393.6 R .711(It is an error to specify DB_AFTER if the underlying btree or hash database) +5.712 F -.1(wa)158 405.6 S 2.5(sn).1 G +(ot created with the DB_DUP \215ag.)-2.5 E(The)5 E F1 -.1(ke)2.5 G(y)-.2 +E F0(parameter is ignored.)2.5 E .645(In the case of the recno access method, it is an error to specify DB_AFTER if the underlying) +158 422.4 R .457(recno database w)158 434.4 R .457 +(as not created with the DB_RENUMBER \215ag.)-.1 F .456 +(If the DB_RENUMBER \215ag)5.456 F -.1(wa)158 446.4 S 2.698(ss).1 G .198 +(peci\214ed, a ne)-2.698 F 2.698(wk)-.25 G .498 -.15(ey i)-2.798 H 2.699 +(sc).15 G .199 +(reated, all records after the inserted item are automatically renum-) +-2.699 F .911(bered, and the k)158 458.4 R 1.211 -.15(ey o)-.1 H 3.411 +(ft).15 G .911(he ne)-3.411 F 3.411(wr)-.25 G .91 +(ecord is returned in the structure referenced by the parameter)-3.411 F +F1 -.1(ke)158 470.4 S(y)-.2 E F0 5(.T).32 G(he initial v)-5 E +(alue of the)-.25 E F1 -.1(ke)2.5 G(y)-.2 E F0(parameter is ignored.)2.5 +E(See)5 E F1(db_open)2.5 E F0(\(3\) for more information.).24 E +(If the cursor is not yet initialized, the)158 487.2 Q F1(c_put)2.5 E F0 +(function will return EINV)2.5 E(AL.)-1.35 E(DB_BEFORE)133 504 Q .156(In the case of the btree and hash access methods, insert the data element as a duplicate element) +158 516 R .584(of the k)158 528 R .884 -.15(ey r)-.1 H .584 +(eferenced by the cursor).15 F 5.584(.T)-.55 G .584(he ne)-5.584 F 3.083 +(we)-.25 G .583(lement appears immediately before the current)-3.083 F +.266(cursor position.)158 540 R .267(It is an error to specify DB_BEFORE if the underlying btree or hash database) +5.266 F -.1(wa)158 552 S 2.5(sn).1 G(ot created with the DB_DUP \215ag.) +-2.5 E(The)5 E F1 -.1(ke)2.5 G(y)-.2 E F0(parameter is ignored.)2.5 E +.252(In the case of the recno access method, it is an error to specify DB_BEFORE if the underlying) +158 568.8 R .456(recno database w)158 580.8 R .457 +(as not created with the DB_RENUMBER \215ag.)-.1 F .457 +(If the DB_RENUMBER \215ag)5.457 F -.1(wa)158 592.8 S 2.809(ss).1 G .309 +(peci\214ed, a ne)-2.809 F 2.809(wk)-.25 G .609 -.15(ey i)-2.909 H 2.809 +(sc).15 G .309 +(reated, the current record and all records after it are automatically) +-2.809 F .042(renumbered, and the k)158 604.8 R .342 -.15(ey o)-.1 H +2.542(ft).15 G .042(he ne)-2.542 F 2.542(wr)-.25 G .043 +(ecord is returned in the structure referenced by the param-)-2.542 F +(eter)158 616.8 Q F1 -.1(ke)2.988 G(y)-.2 E F0 5.488(.T).32 G .488 +(he initial v)-5.488 F .488(alue of the)-.25 F F1 -.1(ke)2.988 G(y)-.2 E +F0 .488(parameter is ignored.)2.988 F(See)5.488 E F1(db_open)2.988 E F0 +.488(\(3\) for more informa-).24 F(tion.)158 628.8 Q +(If the cursor is not yet initialized, the)158 645.6 Q F1(c_put)2.5 E F0 +(function will return EINV)2.5 E(AL.)-1.35 E(DB_CURRENT)133 662.4 Q(Ov) +158 674.4 Q(erwrite the data of the k)-.15 E -.15(ey)-.1 G +(/data pair referenced by the cursor with the speci\214ed data item.).15 +E(The)158 691.2 Q F1 -.1(ke)2.5 G(y)-.2 E F0(parameter is ignored.)2.5 E +(If the cursor is not yet initialized, the)158 708 Q F1(c_put)2.5 E F0 +(function will return EINV)2.5 E(AL.)-1.35 E(April 10, 1998)276.695 768 +Q(3)199.695 E EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 324.38(DB_CURSOR\(3\) DB_CURSOR\(3\))72 48 R +(DB_KEYFIRST)133 84 Q 1.378(In the case of the btree and hash access methods, insert the speci\214ed k) +158 96 R -.15(ey)-.1 G 1.379(/data pair into the).15 F 2.623 +(database. If)158 108 R .123(the k)2.623 F .423 -.15(ey a)-.1 H .122 +(lready e).15 F .122(xists in the database, the inserted data item is added as the \214rst of) +-.15 F(the data items for that k)158 120 Q -.15(ey)-.1 G(.)-.5 E(The DB_KEYFIRST \215ag may not be speci\214ed to the recno access method.) +158 136.8 Q(DB_KEYLAST)133 153.6 Q .049(Insert the speci\214ed k)158 +165.6 R -.15(ey)-.1 G .049(/data pair into the database.).15 F .049 +(If the k)5.049 F .35 -.15(ey a)-.1 H .05(lready e).15 F .05 +(xists in the database, the)-.15 F +(inserted data item is added as the last of the data items for that k) +158 177.6 Q -.15(ey)-.1 G(.)-.5 E(The DB_KEYLAST \215ag may not be speci\214ed to the recno access method.) +158 194.4 Q(If the cursor record has been deleted, the)133 211.2 Q/F1 10 +/Times-Italic@0 SF(c_put)2.5 E F0(function will return DB_KEYEMPTY)2.5 E +(.)-1.29 E(Otherwise, the)133 228 Q F1(c_put)2.5 E F0 +(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E(If)133 244.8 Q F1(c_put)2.683 E F0 -.1 +(fa)2.683 G .182(ils for an).1 F 2.682(yr)-.15 G .182 +(eason, the state of the cursor will be unchanged.)-2.682 F(If)5.182 E +F1(c_put)2.682 E F0 .182(succeeds and an item)2.682 F +(is inserted into the database, the cursor is al)133 256.8 Q -.1(wa)-.1 +G(ys positioned to reference the ne).1 E(wly inserted item.)-.25 E/F2 9 +/Times-Bold@0 SF(CURSOR ST)72 273.6 Q(ABILITY)-.81 E F0 1.021(In the absence of locking, no guarantees are made about the stability of cursors in dif) +108 285.6 R 1.021(ferent processes or)-.25 F 3.278(threads. Ho)108 297.6 +R(we)-.25 E -.15(ve)-.25 G 1.578 -.4(r, t).15 H .778(he btree and recno access methods guarantee that cursor operations, interspersed with) +.4 F .307(other cursor or non-cursor operations in the same thread of control \(i.e., thread or single-threaded process\),) +108 309.6 R .706(will al)108 321.6 R -.1(wa)-.1 G .706(ys return k).1 F +-.15(ey)-.1 G 3.206(si).15 G 3.206(no)-3.206 G .706 +(rder and will return each non-deleted k)-3.206 F -.15(ey)-.1 G .705 +(/data pair e).15 F .705(xactly once.)-.15 F .705(Because the)5.705 F +.097(hash access method uses a dynamic hashing algorithm, it cannot guarantee an) +108 333.6 R 2.598(yf)-.15 G .098(orm of stability in the pres-)-2.598 F +(ence of inserts and deletes unless locking is performed.)108 345.6 Q +.122(If locking w)108 362.4 R .121(as speci\214ed when the DB \214le w) +-.1 F .121(as opened, b)-.1 F .121(ut transactions are not in ef)-.2 F +.121(fect, the access methods)-.25 F(pro)108 374.4 Q .294 +(vide repeatable reads with respect to the cursor)-.15 F 5.295(.T)-.55 G +.295(hat is, a DB_CURRENT call on the cursor is guaran-)-5.295 F +(teed to return the same record as w)108 386.4 Q +(as returned on the last call to the cursor)-.1 E(.)-.55 E 1.15 +(In the presence of transactions, the access method calls between)108 +403.2 R F1(txn_be)3.65 E(gin)-.4 E F0(and)3.65 E F1(txn_abort)3.65 E F0 +(or)3.65 E F1(txn_commit)3.65 E F0(pro)108 415.2 Q .747(vide de)-.15 F +.747(gree 3 consistenc)-.15 F 4.547 -.65(y. F)-.15 H .748(or all access methods, a cursor scan of the database performed within the) +.5 F(conte)108 427.2 Q .208 +(xt of a transaction is guaranteed to return each k)-.15 F -.15(ey)-.1 G +.208(/data pair once and only once, e).15 F .207(xcept in the follo)-.15 +F(w-)-.25 E .616(ing case.)108 439.2 R .617(If, while performing a cursor scan using the hash access method, the transaction performing the) +5.616 F(scan inserts a ne)108 451.2 Q 2.5(wp)-.25 G +(air into the database, it is possible that duplicate k)-2.5 E -.15(ey) +-.1 G(/data pairs will be returned.).15 E F2(ERR)72 468 Q(ORS)-.27 E F0 +(The)108 480 Q F1(DBcur)2.815 E(sor)-.1 E(->c_close)-.2 E F0 .315 +(function may f)2.815 F .315(ail and return)-.1 F F1(errno)2.814 E F0 +.314(for an)2.814 F 2.814(yo)-.15 G 2.814(ft)-2.814 G .314 +(he errors speci\214ed for the follo)-2.814 F(wing)-.25 E +(DB and library functions: calloc\(3\), fcntl\(2\), f)108 492 Q +(\215ush\(3\), lock_get\(3\), lock_id\(3\), lock_put\(3\), lock_v)-.25 E +(ec\(3\),)-.15 E(log_put\(3\), malloc\(3\), memcp)108 504 Q +(y\(3\), memmo)-.1 E -.15(ve)-.15 G +(\(3\), memp_fget\(3\), memp_fput\(3\), memp_fset\(3\), mem-).15 E +(set\(3\), realloc\(3\), and strerror\(3\).)108 516 Q(In addition, the) +108 532.8 Q F1(DBcur)2.5 E(sor)-.1 E(->c_close)-.2 E F0(function may f) +2.5 E(ail and return)-.1 E F1(errno)2.5 E F0(for the follo)2.5 E +(wing conditions:)-.25 E([EA)108 549.6 Q(GAIN])-.4 E 2.5(Al)133 561.6 S +(ock w)-2.5 E(as una)-.1 E -.25(va)-.2 G(ilable.).25 E([EPERM])108 578.4 +Q .577(Database corruption w)133 590.4 R .577(as detected.)-.1 F .578 +(All subsequent database calls \(other than)5.577 F F1(DB->close)3.078 E +F0 3.078(\)w).18 G .578(ill return)-3.078 F(EPERM.)133 602.4 Q(The)108 +619.2 Q F1(DBcur)3.335 E(sor)-.1 E(->c_del)-.2 E F0 .835(function may f) +3.335 F .835(ail and return)-.1 F F1(errno)3.335 E F0 .835(for an)3.335 +F 3.335(yo)-.15 G 3.335(ft)-3.335 G .835 +(he errors speci\214ed for the follo)-3.335 F(wing)-.25 E +(DB and library functions: DB->del\(3\), calloc\(3\), fcntl\(2\), f)108 +631.2 Q(\215ush\(3\), lock_get\(3\), lock_id\(3\), lock_put\(3\),)-.25 E +(lock_v)108 643.2 Q(ec\(3\), log_put\(3\), malloc\(3\), memcp)-.15 E +(y\(3\), memmo)-.1 E -.15(ve)-.15 G +(\(3\), memp_fget\(3\), memp_fput\(3\),).15 E +(memp_fset\(3\), memset\(3\), realloc\(3\), and strerror\(3\).)108 655.2 +Q(In addition, the)108 672 Q F1(DBcur)2.5 E(sor)-.1 E(->c_del)-.2 E F0 +(function may f)2.5 E(ail and return)-.1 E F1(errno)2.5 E F0 +(for the follo)2.5 E(wing conditions:)-.25 E([EA)108 688.8 Q(GAIN])-.4 E +2.5(Al)133 700.8 S(ock w)-2.5 E(as una)-.1 E -.25(va)-.2 G(ilable.).25 E +(April 10, 1998)276.695 768 Q(4)199.695 E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 324.38(DB_CURSOR\(3\) DB_CURSOR\(3\))72 48 R +([EINV)108 84 Q(AL])-1.35 E(An in)133 96 Q -.25(va)-.4 G(lid \215ag v) +.25 E(alue or parameter w)-.25 E(as speci\214ed.)-.1 E([EPERM])108 112.8 +Q .577(Database corruption w)133 124.8 R .577(as detected.)-.1 F .578 +(All subsequent database calls \(other than)5.577 F/F1 10/Times-Italic@0 +SF(DB->close)3.078 E F0 3.078(\)w).18 G .578(ill return)-3.078 F(EPERM.) +133 136.8 Q(The)108 153.6 Q F1(DBcur)3.342 E(sor)-.1 E(->c_g)-.2 E(et) +-.1 E F0 .842(function may f)3.342 F .841(ail and return)-.1 F F1(errno) +3.341 E F0 .841(for an)3.341 F 3.341(yo)-.15 G 3.341(ft)-3.341 G .841 +(he errors speci\214ed for the follo)-3.341 F(wing)-.25 E +(DB and library functions: DB->get\(3\), calloc\(3\), fcntl\(2\), f)108 +165.6 Q(\215ush\(3\), lock_get\(3\), lock_id\(3\), lock_put\(3\),)-.25 E +(lock_v)108 177.6 Q +(ec\(3\), log_put\(3\), malloc\(3\), memcmp\(3\), memcp)-.15 E +(y\(3\), memmo)-.1 E -.15(ve)-.15 G +(\(3\), memp_fget\(3\), memp_fput\(3\),).15 E +(memp_fset\(3\), memset\(3\), realloc\(3\), and strerror\(3\).)108 189.6 +Q(In addition, the)108 206.4 Q F1(DBcur)2.5 E(sor)-.1 E(->c_g)-.2 E(et) +-.1 E F0(function may f)2.5 E(ail and return)-.1 E F1(errno)2.5 E F0 +(for the follo)2.5 E(wing conditions:)-.25 E([EA)108 223.2 Q(GAIN])-.4 E +2.5(Al)133 235.2 S(ock w)-2.5 E(as una)-.1 E -.25(va)-.2 G(ilable.).25 E +([EINV)108 252 Q(AL])-1.35 E(An in)133 264 Q -.25(va)-.4 G(lid \215ag v) +.25 E(alue or parameter w)-.25 E(as speci\214ed.)-.1 E 1.039 +(The DB_THREAD \215ag w)133 288 R 1.039(as speci\214ed to the)-.1 F F1 +(db_open)3.539 E F0 1.039(\(3\) function and neither the DB_DBT_MAL-).24 +F(LOC or DB_DBT_USERMEM \215ags were set in the DBT)133 300 Q(.)-.74 E +([EPERM])108 316.8 Q .578(Database corruption w)133 328.8 R .578 +(as detected.)-.1 F .577(All subsequent database calls \(other than) +5.578 F F1(DB->close)3.077 E F0 3.077(\)w).18 G .577(ill return)-3.077 F +(EPERM.)133 340.8 Q(The)108 357.6 Q F1(DBcur)3.3 E(sor)-.1 E(->c_put)-.2 +E F0 .8(function may f)3.3 F .8(ail and return)-.1 F F1(errno)3.3 E F0 +.8(for an)3.3 F 3.3(yo)-.15 G 3.3(ft)-3.3 G .8 +(he errors speci\214ed for the follo)-3.3 F(wing)-.25 E +(DB and library functions: calloc\(3\), fcntl\(2\), f)108 369.6 Q +(\215ush\(3\), lock_get\(3\), lock_id\(3\), lock_put\(3\), lock_v)-.25 E +(ec\(3\),)-.15 E(log_put\(3\), malloc\(3\), memcmp\(3\), memcp)108 381.6 +Q(y\(3\), memmo)-.1 E -.15(ve)-.15 G +(\(3\), memp_fget\(3\), memp_fput\(3\),).15 E +(memp_fset\(3\), memset\(3\), realloc\(3\), and strerror\(3\).)108 393.6 +Q(In addition, the)108 410.4 Q F1(DBcur)2.5 E(sor)-.1 E(->c_put)-.2 E F0 +(function may f)2.5 E(ail and return)-.1 E F1(errno)2.5 E F0 +(for the follo)2.5 E(wing conditions:)-.25 E([EA)108 427.2 Q(CCES])-.4 E +(An attempt w)133 439.2 Q(as made to modify a read-only database.)-.1 E +([EA)108 456 Q(GAIN])-.4 E 2.5(Al)133 468 S(ock w)-2.5 E(as una)-.1 E +-.25(va)-.2 G(ilable.).25 E([EINV)108 484.8 Q(AL])-1.35 E(An in)133 +496.8 Q -.25(va)-.4 G(lid \215ag v).25 E(alue or parameter w)-.25 E +(as speci\214ed.)-.1 E([EPERM])108 513.6 Q .578(Database corruption w) +133 525.6 R .578(as detected.)-.1 F .577 +(All subsequent database calls \(other than)5.578 F F1(DB->close)3.077 E +F0 3.077(\)w).18 G .577(ill return)-3.077 F(EPERM.)133 537.6 Q/F2 9 +/Times-Bold@0 SF(SEE ALSO)72 554.4 Q F1(db_ar)108 566.4 Q -.15(ch)-.37 G +(ive).15 E F0(\(1\),).18 E F1(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F0 +(\(1\),).68 E F1(db_deadloc)2.5 E(k)-.2 E F0(\(1\),).67 E F1(db_dump)2.5 +E F0(\(1\),).19 E F1(db_load)2.5 E F0(\(1\),).77 E F1(db_r)2.5 E(eco) +-.37 E(ver)-.1 E F0(\(1\),).73 E F1(db_stat)2.5 E F0(\(1\),).68 E F1 +(db_intr)108 578.4 Q(o)-.45 E F0(\(3\),).18 E F1(db_appinit)2.5 E F0 +(\(3\),).68 E F1(db_cur)2.5 E(sor)-.1 E F0(\(3\),).73 E F1(db_dbm)2.5 E +F0(\(3\),).32 E F1(db_internal)2.5 E F0(\(3\),).51 E F1(db_loc)2.5 E(k) +-.2 E F0(\(3\),).67 E F1(db_lo)2.5 E(g)-.1 E F0(\(3\),).22 E F1 +(db_mpool)2.5 E F0(\(3\),).51 E F1(db_open)108 590.4 Q F0(\(3\),).24 E +F1(db_thr)2.5 E(ead)-.37 E F0(\(3\),).77 E F1(db_txn)2.5 E F0(\(3\)).24 +E(April 10, 1998)276.695 768 Q(5)199.695 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/man.ps/db_dbm.ps b/mozilla/db/man/man.ps/db_dbm.ps new file mode 100644 index 00000000000..f6009e6a2cd --- /dev/null +++ b/mozilla/db/man/man.ps/db_dbm.ps @@ -0,0 +1,519 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:20 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 4 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(dbm \255 dbminit, fetch, store, delete, \214rstk)108 40.8 Q -.15(ey)-.1 +G 2.5(,n)-.5 G -.15(ex)-2.5 G(tk).15 E -.15(ey)-.1 G +(ndbm \255 dbm_open, dbm_close, dbm_fetch, dbm_store, dbm_delete,)108 +64.8 Q(dbm_\214rstk)108 76.8 Q -.15(ey)-.1 G 2.5(,d)-.5 G(bm_ne)-2.5 E +(xtk)-.15 E -.15(ey)-.1 G 2.5(,d)-.5 G(bm_error)-2.5 E 2.5(,d)-.4 G +(bm_clearerr)-2.5 E F0(SYNOPSIS)72 93.6 Q/F2 10/Times-Bold@0 SF +(#de\214ne DB_DBM_HSEARCH)108 105.6 Q(1)10 E(#include )-.4 E(typedef struct {)108 141.6 Q(char *dptr;)144 153.6 Q +(int dsize;)144 165.6 Q 2.5(}d)108 177.6 S(atum;)-2.5 E F0 +(DBM FUNCTIONS)72 194.4 Q F2(int)108 206.4 Q(dbminit\(char *\214le\);) +108 218.4 Q(datum)108 242.4 Q(fetch\(datum k)108 254.4 Q(ey\);)-.1 E +(int)108 278.4 Q(stor)108 290.4 Q(e\(datum k)-.18 E(ey)-.1 E 2.5(,d)-.55 +G(atum content\);)-2.5 E(int)108 314.4 Q(delete\(datum k)108 326.4 Q +(ey\);)-.1 E(datum)108 350.4 Q(\214rstk)108 362.4 Q(ey\(v)-.1 E(oid\);) +-.1 E(datum)108 386.4 Q(nextk)108 398.4 Q(ey\(datum k)-.1 E(ey\);)-.1 E +F0(NDBM FUNCTIONS)72 415.2 Q F2(DBM *)108 427.2 Q +(dbm_open\(char *\214le, int \215ags, int mode\);)108 439.2 Q -.1(vo)108 +463.2 S(id).1 E(dbm_close\(DBM *db\);)108 475.2 Q(datum)108 499.2 Q +(dbm_fetch\(DBM *db, datum k)108 511.2 Q(ey\);)-.1 E(int)108 535.2 Q +(dbm_stor)108 547.2 Q(e\(DBM *db, datum k)-.18 E(ey)-.1 E 2.5(,d)-.55 G +(atum content, int \215ags\);)-2.5 E(int)108 571.2 Q +(dbm_delete\(DBM *db, datum k)108 583.2 Q(ey\);)-.1 E(datum)108 607.2 Q +(dbm_\214rstk)108 619.2 Q(ey\(DBM *db\);)-.1 E(datum)108 643.2 Q +(dbm_nextk)108 655.2 Q(ey\(DBM *db\);)-.1 E(int)108 679.2 Q(dbm_err)108 +691.2 Q(or\(DBM *db\);)-.18 E(int)108 715.2 Q(dbm_clear)108 727.2 Q +(err\(DBM *db\);)-.18 E F1(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 358.84(DB_DBM\(3\) DB_DBM\(3\))72 48 R/F1 9 +/Times-Bold@0 SF(DESCRIPTION)72 84 Q F0(The)108 96 Q/F2 10 +/Times-Italic@0 SF(dbm)3.144 E F0(and)3.144 E F2(ndbm)3.144 E F0(interf) +3.144 E .644(aces to the DB library are intended to pro)-.1 F .643 +(vide source code compatibility for his-)-.15 F .252 +(toric applications.)108 108 R(The)5.252 E 2.752(ya)-.15 G .252 +(re not recommended for an)-2.752 F 2.752(yo)-.15 G .252(ther purpose.) +-2.752 F .252(The historic)5.252 F F2(dbm)2.752 E F0(and)2.752 E F2 +(ndbm)2.752 E F0(database)2.752 E .279(format is)108 120 R/F3 10 +/Times-Bold@0 SF(not)2.779 E F0 .279(supported, and databases pre)2.779 +F .279(viously b)-.25 F .279(uilt using the real)-.2 F F2(dbm)2.779 E F0 +(or)2.779 E F2(ndbm)2.779 E F0 .278(libraries cannot be read)2.779 F +(by the DB functions.)108 132 Q 2.385 -.8(To c)108 148.8 T(ompile).8 E +F2(dbm)3.285 E F0(or)3.285 E F2(ndbm)3.285 E F0 .786 +(applications, replace the application')3.285 F(s)-.55 E F2(#include) +3.286 E F0 .786(of the dbm or ndbm include \214le)3.286 F(\(e.g., `)108 +160.8 Q(`#include ')-.74 E 2.5('o)-.74 G 2.5(r`)-2.5 G +(`#include ')-3.24 E('\) with the follo)-.74 E(wing tw)-.25 E +2.5(ol)-.1 G(ines:)-2.5 E(#de\214ne DB_DBM_HSEARCH)144 177.6 Q(1)10 E +(#include )-.4 E .175(and recompile.)108 206.4 R .175 +(If the application attempts to load ag)5.175 F .175 +(ainst a dbm library \(e.g., `)-.05 F(`-ldbm')-.74 E .175('\), remo)-.74 +F .475 -.15(ve t)-.15 H .175(he library).15 F(from the load line.)108 +218.4 Q F2 -2.1 -.35(Ke y)108 235.2 T F0 2.811(sa).67 G(nd)-2.811 E F2 +(content)2.811 E F0 2.811(sa).68 G .311(re described by the)-2.811 F F2 +(datum)2.811 E F0 2.811(typedef. A)2.811 F F2(datum)2.811 E F0 .311 +(speci\214es a string of)2.811 F F2(dsize)2.811 E F0 .312 +(bytes pointed to)2.811 F(by)108 247.2 Q F2(dptr)2.5 E F0 5(.A).73 G +(rbitrary binary data, as well as normal te)-5 E(xt strings, are allo) +-.15 E(wed.)-.25 E F1(DBM FUNCTIONS)72 264 Q F0 .095 +(Before a database can be accessed, it must be opened by)108 276 R F2 +(dbminit)2.594 E F0 5.094(.T).68 G .094 +(his will open and/or create the database)-5.094 F F2(\214le)108 288 Q +F0(.db).18 E 6.373(.I)-.4 G 3.873(fc)-6.373 G 1.373 +(reated, the database \214le is created read/write by o)-3.873 F 1.373 +(wner only \(as described in)-.25 F F2 -.15(ch)3.874 G(mod).15 E F0 +1.374(\(2\)\) and).77 F .392(modi\214ed by the process' umask v)108 300 +R .391(alue at the time of creation \(see)-.25 F F2(umask)2.891 E F0 +2.891(\(2\)\). The).67 F .391(group o)2.891 F .391(wnership of cre-)-.25 +F(ated \214les is based on the system and directory def)108 312 Q +(aults, and is not further speci\214ed by DB.)-.1 E .309 +(Once open, the data stored under a k)108 328.8 R .609 -.15(ey i)-.1 H +2.809(sa).15 G .309(ccessed by)-2.809 F F2(fetc)2.81 E(h)-.15 E F0 .31 +(and data is placed under a k)2.81 F .61 -.15(ey b)-.1 H(y).15 E F2 +(stor)2.81 E(e)-.37 E F0 5.31(.A).18 G -.1(ke)-2.5 G(y)-.05 E .055 +(\(and its associated contents\) is deleted by)108 340.8 R F2(delete) +2.555 E F0 5.055(.A).18 G .055(linear pass through all k)-2.5 F -.15(ey) +-.1 G 2.555(si).15 G 2.554(nad)-2.555 G .054(atabase may be made,)-2.554 +F 1.375(in an \(apparently\) random order)108 352.8 R 3.875(,b)-.4 G +3.875(yu)-3.875 G 1.375(se of)-3.875 F F2<8c72>3.875 E(stk)-.1 E -.3(ey) +-.1 G F0(and)4.175 E F2(ne)3.875 E(xtk)-.2 E -.3(ey)-.1 G F0(.).62 E F2 +-.45(Fi)6.375 G -.1(rs).45 G(tk).1 E -.3(ey)-.1 G F0 1.375 +(will return the \214rst k)4.175 F 1.675 -.15(ey i)-.1 H 3.875(nt).15 G +(he)-3.875 E 3.354(database. W)108 364.8 R .854(ith an)-.4 F 3.354(yk) +-.15 G -.15(ey)-3.454 G F2(ne)3.504 E(xtk)-.2 E -.3(ey)-.1 G F0 .853 +(will return the ne)3.654 F .853(xt k)-.15 F 1.153 -.15(ey i)-.1 H 3.353 +(nt).15 G .853(he database.)-3.353 F .853(This code will tra)5.853 F +-.15(ve)-.2 G .853(rse the data).15 F(base:)108 376.8 Q(for \(k)144 +393.6 Q .3 -.15(ey = \214)-.1 H(rstk).15 E -.15(ey)-.1 G(\(\);).15 E -.1 +(ke)194 405.6 S -.65(y.)-.05 G(dptr != NULL; k).65 E .3 -.15(ey = n)-.1 +H -.15(ex).15 G(tk).15 E -.15(ey)-.1 G(\(k).15 E -.15(ey)-.1 G(\)\)).15 +E F1(NDBM FUNCTIONS)72 422.4 Q F0 1.645 +(Before a database can be accessed, it must be opened by)108 434.4 R F2 +(dbm_open)4.145 E F0 6.645(.T).24 G 1.646 +(his will open and/or create the)-6.645 F .524(database \214le)108 446.4 +R F2(\214le)3.024 E F0 .523 +(.db depending on the \215ags parameter \(see).18 F F2(open)3.023 E F0 +3.023(\(2\)\). If).24 F .523(created, the database \214le is created) +3.023 F .62(with mode)108 458.4 R F2(mode)3.12 E F0 .62 +(\(as described in)3.12 F F2 -.15(ch)3.12 G(mod).15 E F0 .62 +(\(2\)\) and modi\214ed by the process' umask v).77 F .62 +(alue at the time of cre-)-.25 F .719(ation \(see)108 470.4 R F2(umask) +3.219 E F0 3.218(\(2\)\). The).67 F .718(group o)3.218 F .718 +(wnership of created \214les is based on the system and directory def) +-.25 F(aults,)-.1 E(and is not further speci\214ed by DB.)108 482.4 Q +2.016(Once open, the data stored under a k)108 499.2 R 2.316 -.15(ey i) +-.1 H 4.516(sa).15 G 2.016(ccessed by)-4.516 F F2(dbm_fetc)4.516 E(h) +-.15 E F0 2.017(and data is placed under a k)4.516 F 2.317 -.15(ey b)-.1 +H(y).15 E F2(dbm_stor)108 511.2 Q(e)-.37 E F0 5.351(.T).18 G(he)-5.351 E +F2<8d61>2.851 E(gs)-.1 E F0 .351(\214eld can be either)2.851 F F3 +(DBM_INSER)2.851 E(T)-.4 E F0(or)2.851 E F3(DBM_REPLA)2.851 E 2.851 +(CE. DBM_INSER)-.55 F(T)-.4 E F0 .35(will only)2.85 F 4.081(insert ne) +108 523.2 R 6.581(we)-.25 G 4.081 +(ntries into the database and will not change an e)-6.581 F 4.082 +(xisting entry with the same k)-.15 F -.15(ey)-.1 G(.)-.5 E F3 +(DBM_REPLA)108 535.2 Q(CE)-.55 E F0 .312(will replace an e)2.812 F .312 +(xisting entry if it has the same k)-.15 F -.15(ey)-.1 G 5.312(.A)-.5 G +-.1(ke)-2.5 G 2.811(y\()-.05 G .311(and its associated contents\))-2.811 +F .084(is deleted by)108 547.2 R F2(dbm_delete)2.584 E F0 5.084(.A).18 G +.085(linear pass through all k)-2.5 F -.15(ey)-.1 G 2.585(si).15 G 2.585 +(nad)-2.585 G .085(atabase may be made, in an \(apparently\) ran-)-2.585 +F .39(dom order)108 559.2 R 2.89(,b)-.4 G 2.89(yu)-2.89 G .39(se of) +-2.89 F F2(dbm_\214r)2.89 E(stk)-.1 E -.3(ey)-.1 G F0(and)3.19 E F2 +(dbm_ne)2.89 E(xtk)-.2 E -.3(ey)-.1 G F0(.).62 E F2(Dbm_\214r)5.39 E +(stk)-.1 E -.3(ey)-.1 G F0 .39(will return the \214rst k)3.19 F .69 -.15 +(ey i)-.1 H 2.89(nt).15 G .39(he database.)-2.89 F F2(Dbm_ne)108 571.2 Q +(xtk)-.2 E -.3(ey)-.1 G F0(will return the ne)2.8 E(xt k)-.15 E .3 -.15 +(ey i)-.1 H 2.5(nt).15 G(he database.)-2.5 E(This code will tra)5 E -.15 +(ve)-.2 G(rse the data base:).15 E(for \(k)144 588 Q .3 -.15(ey = d)-.1 +H(bm_\214rstk).15 E -.15(ey)-.1 G(\(db\);).15 E -.1(ke)194 600 S -.65 +(y.)-.05 G(dptr != NULL; k).65 E .3 -.15(ey = d)-.1 H(bm_ne).15 E(xtk) +-.15 E -.15(ey)-.1 G(\(db\)\)).15 E F2(Dbm_err)108 616.8 Q(or)-.45 E F0 +1.273(returns non-zero when an error has occurred reading or writing the database.) +3.773 F F2(Dbm_clear)6.274 E(err)-.37 E F0 +(resets the error condition on the named database.)108 628.8 Q F1(COMP) +72 645.6 Q -.855(AT)-.666 G(IBILITY NO).855 E(TES)-.36 E F0 .579 +(The historic)108 657.6 R F2(dbm)3.079 E F0(and)3.079 E F2(ndbm)3.079 E +F0 .579(libraries created tw)3.079 F 3.079(ou)-.1 G .578 +(nderlying database \214les, traditionally named)-3.079 F F2(\214le) +3.078 E F0 .578(.dir and).18 F F2(\214le)108 669.6 Q F0 3.725(.pag. The) +.18 F 1.225(DB library creates a single database \214le named)3.725 F F2 +(\214le)3.726 E F0(.db).18 E 6.226(.A)-.4 G 1.226 +(pplications that are a)-6.226 F -.1(wa)-.15 G 1.226(re of the).1 F(underlying database \214le names may require additional source code modi\214cations.) +108 681.6 Q 1.45(The historic)108 698.4 R F2(dbminit)3.95 E F0(interf) +3.95 E 1.45(ace required that the underlying `)-.1 F(`.dir')-.74 E 3.95 +('a)-.74 G 1.45(nd `)-3.95 F(`.pag')-.74 E 3.95<278c>-.74 G 1.45 +(les already e)-3.95 F 1.45(xist \(empty)-.15 F .375 +(databases were created by creating zero-length `)108 710.4 R(`.dir') +-.74 E 2.875('a)-.74 G .375(nd `)-2.875 F(`.pag')-.74 E 2.875<278c>-.74 +G 2.875(les\). Applications)-2.875 F .375(that e)2.875 F .375 +(xpect to create)-.15 F(databases using this method may require additional source code modi\214cations.) +108 722.4 Q(April 10, 1998)276.695 768 Q(2)199.695 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 358.84(DB_DBM\(3\) DB_DBM\(3\))72 48 R .426 +(The historic)108 84 R/F1 10/Times-Italic@0 SF(dbm_dirfno)2.926 E F0 +(and)2.926 E F1(dbm_pa)2.926 E(gfno)-.1 E F0 .426 +(macros are supported, b)2.926 F .425 +(ut will return identical \214le descriptors as)-.2 F .658(there is only a single underlying \214le used by the DB hashing access method.) +108 96 R .659(Applications using both \214le)5.659 F(descriptors for locking may require additional source code modi\214cations.) +108 108 Q .753(If an application using the)108 124.8 R F1(ndbm)3.253 E +F0(interf)3.253 E .753(ace e)-.1 F .752 +(xits without closing the database, it may lose updates because)-.15 F +1.25(the DB library b)108 136.8 R(uf)-.2 E 1.25(fers all writes.)-.25 F +1.25(Such applications will require additional source code modi\214cations to) +6.25 F -.1(wo)108 148.8 S(rk correctly with the DB library).1 E(.)-.65 E +/F2 9/Times-Bold@0 SF(DBM DIA)72 165.6 Q(GNOSTICS)-.495 E F0(The)108 +177.6 Q F1(dbminit)2.5 E F0(function returns -1 on f)2.5 E +(ailure, setting)-.1 E F1(errno)2.5 E F0 2.5(,a).18 G(nd 0 on success.) +-2.5 E(The)108 194.4 Q F1(fetc)2.632 E(h)-.15 E F0 .131 +(function sets the returned)2.632 F F1(datum)2.631 E F0 -.55('s).32 G F1 +(dptr)3.181 E F0 .131(\214eld to NULL on f)2.631 F .131(ailure, setting) +-.1 F F1(errno)2.631 E F0 2.631(,a).18 G .131(nd returns a non-)-2.631 F +(NULL)108 206.4 Q F1(dptr)2.5 E F0(on success.)2.5 E(The)108 223.2 Q F1 +(stor)2.5 E(e)-.37 E F0(function returns -1 on f)2.5 E(ailure, setting) +-.1 E F1(errno)2.5 E F0 2.5(,a).18 G(nd 0 on success.)-2.5 E(The)108 240 +Q F1(delete)2.5 E F0(function returns -1 on f)2.5 E(ailure, setting)-.1 +E F1(errno)2.5 E F0 2.5(,a).18 G(nd 0 on success.)-2.5 E(The)108 256.8 Q +F1<8c72>3.329 E(stk)-.1 E -.3(ey)-.1 G F0 .829 +(function sets the returned)3.629 F F1(datum)3.329 E F0 -.55('s).32 G F1 +(dptr)3.879 E F0 .829(\214eld to NULL on f)3.329 F .83(ailure, setting) +-.1 F F1(errno)3.33 E F0 3.33(,a).18 G .83(nd returns a)-3.33 F +(non-NULL)108 268.8 Q F1(dptr)2.5 E F0(on success.)2.5 E(The)108 285.6 Q +F1(ne)3.271 E(xtk)-.2 E -.3(ey)-.1 G F0 .771(function sets the returned) +3.571 F F1(datum)3.271 E F0 -.55('s).32 G F1(dptr)3.821 E F0 .771 +(\214eld to NULL on f)3.271 F .77(ailure, setting)-.1 F F1(errno)3.27 E +F0 3.27(,a).18 G .77(nd returns a)-3.27 F(non-NULL)108 297.6 Q F1(dptr) +2.5 E F0(on success.)2.5 E F2(NDBM DIA)72 314.4 Q(GNOSTICS)-.495 E F0 +(The)108 326.4 Q F1(dbm_open)2.5 E F0(function returns NULL on f)2.5 E +(ailure, setting)-.1 E F1(errno)2.5 E F0 2.5(,a).18 G(nd 0 on success.) +-2.5 E(The)108 343.2 Q F1(dbm_fetc)2.557 E(h)-.15 E F0 .057 +(function sets the returned)2.557 F F1(datum)2.557 E F0 -.55('s).32 G F1 +(dptr)3.107 E F0 .057(\214eld to NULL on f)2.557 F .057(ailure, setting) +-.1 F F1(errno)2.557 E F0 2.557(,a).18 G .057(nd returns a)-2.557 F +(non-NULL)108 355.2 Q F1(dptr)2.5 E F0(on success.)2.5 E(The)108 372 Q +F1(dbm_stor)3.137 E(e)-.37 E F0 .637(function returns -1 on f)3.137 F +.637(ailure, setting)-.1 F F1(errno)3.137 E F0 3.136(,0o).18 G 3.136(ns) +-3.136 G .636(uccess, and 1 if DBM_INSER)-3.136 F 3.136(Tw)-.6 G .636 +(as set)-3.236 F(and the speci\214ed k)108 384 Q .3 -.15(ey a)-.1 H +(lready e).15 E(xisted in the database.)-.15 E(The)108 400.8 Q F1 +(dbm_delete)2.5 E F0(function returns -1 on f)2.5 E(ailure, setting)-.1 +E F1(errno)2.5 E F0 2.5(,a).18 G(nd 0 on success.)-2.5 E(The)108 417.6 Q +F1(dbm_\214r)4.439 E(stk)-.1 E -.3(ey)-.1 G F0 1.939 +(function sets the returned)4.739 F F1(datum)4.439 E F0 -.55('s).32 G F1 +(dptr)4.989 E F0 1.939(\214eld to NULL on f)4.439 F 1.94 +(ailure, setting)-.1 F F1(errno)4.44 E F0 4.44(,a).18 G(nd)-4.44 E +(returns a non-NULL)108 429.6 Q F1(dptr)2.5 E F0(on success.)2.5 E(The) +108 446.4 Q F1(dbm_ne)4.373 E(xtk)-.2 E -.3(ey)-.1 G F0 1.873 +(function sets the returned)4.673 F F1(datum)4.373 E F0 -.55('s).32 G F1 +(dptr)4.923 E F0 1.873(\214eld to NULL on f)4.373 F 1.872 +(ailure, setting)-.1 F F1(errno)4.372 E F0 4.372(,a).18 G(nd)-4.372 E +(returns a non-NULL)108 458.4 Q F1(dptr)2.5 E F0(on success.)2.5 E(The) +108 475.2 Q F1(dbm_err)2.5 E(or)-.45 E F0(function returns -1 on f)2.5 E +(ailure, setting)-.1 E F1(errno)2.5 E F0 2.5(,a).18 G(nd 0 on success.) +-2.5 E(The)108 492 Q F1(dbm_clear)2.5 E(err)-.37 E F0 +(function returns -1 on f)2.5 E(ailure, setting)-.1 E F1(errno)2.5 E F0 +2.5(,a).18 G(nd 0 on success.)-2.5 E F2(ERR)72 508.8 Q(ORS)-.27 E F0 +(The)108 520.8 Q F1(dbminit)3.63 E F0 1.13(function may f)3.63 F 1.13 +(ail and return)-.1 F F1(errno)3.63 E F0 1.131(for an)3.63 F 3.631(yo) +-.15 G 3.631(ft)-3.631 G 1.131(he errors speci\214ed for the follo) +-3.631 F 1.131(wing DB and)-.25 F +(library functions: dbm_close\(3\), and dbm_open\(3\).)108 532.8 Q(The) +108 549.6 Q F1(fetc)2.63 E(h)-.15 E F0 .13(function may f)2.63 F .13 +(ail and return)-.1 F F1(errno)2.63 E F0 .13(for an)2.63 F 2.629(yo)-.15 +G 2.629(ft)-2.629 G .129(he errors speci\214ed for the follo)-2.629 F +.129(wing DB and library)-.25 F(functions: dbm_fetch\(3\).)108 561.6 Q +(The)108 578.4 Q F1(stor)2.611 E(e)-.37 E F0 .111(function may f)2.611 F +.111(ail and return)-.1 F F1(errno)2.611 E F0 .112(for an)2.611 F 2.612 +(yo)-.15 G 2.612(ft)-2.612 G .112(he errors speci\214ed for the follo) +-2.612 F .112(wing DB and library)-.25 F(functions: dbm_store\(3\).)108 +590.4 Q(The)108 607.2 Q F1(delete)4.002 E F0 1.502(function may f)4.002 +F 1.502(ail and return)-.1 F F1(errno)4.002 E F0 1.502(for an)4.002 F +4.002(yo)-.15 G 4.002(ft)-4.002 G 1.501 +(he errors speci\214ed for the follo)-4.002 F 1.501(wing DB and)-.25 F +(library functions: dbm_delete\(3\).)108 619.2 Q(The)108 636 Q F1<8c72> +3.751 E(stk)-.1 E -.3(ey)-.1 G F0 1.251(function may f)4.051 F 1.251 +(ail and return)-.1 F F1(errno)3.752 E F0 1.252(for an)3.752 F 3.752(yo) +-.15 G 3.752(ft)-3.752 G 1.252(he errors speci\214ed for the follo) +-3.752 F 1.252(wing DB and)-.25 F(library functions: dbm_\214rstk)108 +648 Q -.15(ey)-.1 G(\(3\).).15 E(The)108 664.8 Q F1(ne)3.697 E(xtk)-.2 E +-.3(ey)-.1 G F0 1.196(function may f)3.997 F 1.196(ail and return)-.1 F +F1(errno)3.696 E F0 1.196(for an)3.696 F 3.696(yo)-.15 G 3.696(ft)-3.696 +G 1.196(he errors speci\214ed for the follo)-3.696 F 1.196(wing DB and) +-.25 F(library functions: dbm_ne)108 676.8 Q(xtk)-.15 E -.15(ey)-.1 G +(\(3\).).15 E(The)108 693.6 Q F1(dbm_open)3.013 E F0 .514 +(function may f)3.013 F .514(ail and return)-.1 F F1(errno)3.014 E F0 +.514(for an)3.014 F 3.014(yo)-.15 G 3.014(ft)-3.014 G .514 +(he errors speci\214ed for the follo)-3.014 F .514(wing DB and)-.25 F +(library functions: db_open\(3\), and memset\(3\).)108 705.6 Q(The)108 +722.4 Q F1(dbm_close)2.953 E F0 .453(function may f)2.953 F .452 +(ail and return)-.1 F F1(errno)2.952 E F0 .452(for an)2.952 F 2.952(yo) +-.15 G 2.952(ft)-2.952 G .452(he errors speci\214ed for the follo)-2.952 +F .452(wing DB and)-.25 F(April 10, 1998)276.695 768 Q(3)199.695 E EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 358.84(DB_DBM\(3\) DB_DBM\(3\))72 48 R +(library functions: DB->close\(3\).)108 84 Q(The)108 100.8 Q/F1 10 +/Times-Italic@0 SF(dbm_fetc)3.022 E(h)-.15 E F0 .522(function may f) +3.022 F .522(ail and return)-.1 F F1(errno)3.022 E F0 .522(for an)3.022 +F 3.022(yo)-.15 G 3.022(ft)-3.022 G .522 +(he errors speci\214ed for the follo)-3.022 F .523(wing DB and)-.25 F +(library functions: DB->get\(3\), and memset\(3\).)108 112.8 Q(The)108 +129.6 Q F1(dbm_stor)3.004 E(e)-.37 E F0 .504(function may f)3.004 F .504 +(ail and return)-.1 F F1(errno)3.003 E F0 .503(for an)3.003 F 3.003(yo) +-.15 G 3.003(ft)-3.003 G .503(he errors speci\214ed for the follo)-3.003 +F .503(wing DB and)-.25 F +(library functions: DB->put\(3\), and memset\(3\).)108 141.6 Q(The)108 +158.4 Q F1(dbm_delete)2.767 E F0 .267(function may f)2.767 F .267 +(ail and return)-.1 F F1(errno)2.767 E F0 .267(for an)2.767 F 2.767(yo) +-.15 G 2.767(ft)-2.767 G .267(he errors speci\214ed for the follo)-2.767 +F .268(wing DB and)-.25 F(library functions: memset\(3\).)108 170.4 Q +(The)108 187.2 Q F1(dbm_\214r)2.518 E(stk)-.1 E -.3(ey)-.1 G F0 .018 +(function may f)2.818 F .017(ail and return)-.1 F F1(errno)2.517 E F0 +.017(for an)2.517 F 2.517(yo)-.15 G 2.517(ft)-2.517 G .017 +(he errors speci\214ed for the follo)-2.517 F .017(wing DB and)-.25 F +(library functions: DB->cursor\(3\), and memset\(3\).)108 199.2 Q(The) +108 216 Q F1(dbm_ne)3.455 E(xtk)-.2 E -.3(ey)-.1 G F0 .956 +(function may f)3.755 F .956(ail and return)-.1 F F1(errno)3.456 E F0 +.956(for an)3.456 F 3.456(yo)-.15 G 3.456(ft)-3.456 G .956 +(he errors speci\214ed for the follo)-3.456 F .956(wing DB)-.25 F +(and library functions: DB->cursor\(3\), and memset\(3\).)108 228 Q/F2 9 +/Times-Bold@0 SF(SEE ALSO)72 244.8 Q F0 .486(The DB library is a f)108 +256.8 R .485(amily of groups of functions that pro)-.1 F .485 +(vides a modular programming interf)-.15 F .485(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 268.8 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .507(\214le page caching, as well as v)108 280.8 R .507 +(arious inde)-.25 F -.15(xe)-.15 G 3.007(da).15 G .506(ccess methods.) +-3.007 F(Man)5.506 E 3.006(yo)-.15 G 3.006(ft)-3.006 G .506 +(he functional groups \(e.g., the \214le)-3.006 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 292.8 R .122(are e)108 304.8 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.121 G 2.621(rag).15 G .121(eneral description of)-2.621 +F(the DB package, see)108 316.8 Q F1(db_intr)2.5 E(o)-.45 E F0(\(3\).) +.18 E F1(db_ar)108 333.6 Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E F1 +(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F0(\(1\),).68 E F1(db_deadloc)2.5 E +(k)-.2 E F0(\(1\),).67 E F1(db_dump)2.5 E F0(\(1\),).19 E F1(db_load)2.5 +E F0(\(1\),).77 E F1(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F1 +(db_stat)2.5 E F0(\(1\),).68 E F1(db_intr)108 345.6 Q(o)-.45 E F0 +(\(3\),).18 E F1(db_appinit)2.5 E F0(\(3\),).68 E F1(db_cur)2.5 E(sor) +-.1 E F0(\(3\),).73 E F1(db_dbm)2.5 E F0(\(3\),).32 E F1(db_internal)2.5 +E F0(\(3\),).51 E F1(db_loc)2.5 E(k)-.2 E F0(\(3\),).67 E F1(db_lo)2.5 E +(g)-.1 E F0(\(3\),).22 E F1(db_mpool)2.5 E F0(\(3\),).51 E F1(db_open) +108 357.6 Q F0(\(3\),).24 E F1(db_thr)2.5 E(ead)-.37 E F0(\(3\),).77 E +F1(db_txn)2.5 E F0(\(3\)).24 E(April 10, 1998)276.695 768 Q(4)199.695 E +EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/man.ps/db_dbt.ps b/mozilla/db/man/man.ps/db_dbt.ps new file mode 100644 index 00000000000..363f2544c20 --- /dev/null +++ b/mozilla/db/man/man.ps/db_dbt.ps @@ -0,0 +1,430 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:20 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 3 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_dbt \255 DB k)108 40.8 Q -.15(ey)-.1 G(/data pairs).15 E F0 +(SYNOPSIS)72 57.6 Q/F2 10/Times-Bold@0 SF(typedef struct {)108 69.6 Q +-.1(vo)144 81.6 S(id *data;).1 E(u_int32_t size;)144 93.6 Q +(u_int32_t ulen;)144 105.6 Q(u_int32_t dlen;)144 117.6 Q +(u_int32_t doff;)144 129.6 Q(u_int32_t \215ags;)144 141.6 Q 2.5(}D)108 +153.6 S(BT)-2.5 E(;)-.74 E F0(KEY/D)72 170.4 Q -1.35 -.855(AT A)-.315 H +-.666(PA)3.105 G(IRS).666 E F1 .574(Storage and retrie)108 182.4 R -.25 +(va)-.25 G 3.074(lf).25 G .573(or the DB access methods are based on k) +-3.074 F -.15(ey)-.1 G .573(/data pairs.).15 F .573(Both k)5.573 F .873 +-.15(ey a)-.1 H .573(nd data items are).15 F +(represented by the DBT data structure.)108 194.4 Q -2.15 -.25(Ke y)108 +211.2 T .097(and data byte strings may reference strings of essentially unlimited length, although an) +2.847 F 2.598(yt)-.15 G .298 -.1(wo ke)-2.598 H .098(ys must)-.05 F .82 +(\214t into a)108 223.2 R -.25(va)-.2 G .82 +(ilable memory at the same time so that the).25 F 3.32(ym)-.15 G .82 +(ay be compared, and an)-3.32 F 3.32(yo)-.15 G .82 +(ne data item must \214t)-3.32 F(into a)108 235.2 Q -.25(va)-.2 G +(ilable memory so that it may be returned.).25 E 1.396(In order to ensure compatibility with future releases of DB, all \214elds of the DBT structure that are not) +108 252 R -.15(ex)108 264 S .656(plicitly set should be initialized to 0 before the \214rst time the structure is used.) +.15 F .655(Do this by declaring the)5.656 F(structure e)108 276 Q +(xternal or static, or by calling the C library routine)-.15 E/F3 10 +/Times-Italic@0 SF(bzer)2.5 E(o)-.45 E F1(\(3\) or).18 E F3(memset)2.5 E +F1(\(3\).).68 E .402(By def)108 292.8 R .402(ault, the)-.1 F F3<8d61> +2.902 E(gs)-.1 E F1 .402(structure element is e)2.902 F .403 +(xpected to be 0.)-.15 F .403(In this def)5.403 F .403 +(ault case, when being pro)-.1 F .403(vided a k)-.15 F -.15(ey)-.1 G .35 +(or data item by the application, the DB package e)108 304.8 R .35 +(xpects the)-.15 F F3(data)2.85 E F1 .35 +(structure element to point to a byte string)2.85 F(of)108 316.8 Q F3 +(size)3.322 E F1 3.322(bytes. When)3.322 F .822(returning a k)3.322 F +-.15(ey)-.1 G .822 +(/data item to the application, the DB package will store into the).15 F +F3(data)3.323 E F1 1.417 +(structure element a pointer to a byte string of)108 328.8 R F3(size) +3.917 E F1(bytes.)3.917 E F2 1.417(By default, the memory r)6.417 F +(efer)-.18 E 1.417(enced by this)-.18 F(stor)108 340.8 Q 1.069 +(ed pointer is only v)-.18 F 1.07 +(alid until the next call to the DB package using the DB handle r)-.1 F +(etur)-.18 E 1.07(ned by)-.15 F F3(db_open)108 352.8 Q F1(.).24 E F2 +.331(The access methods pr)108 369.6 R -.1(ov)-.18 G .331 +(ide no guarantees about byte string alignment, and applications ar).1 F +2.83(er)-.18 G(espon-)-3.01 E 1.207(sible f)108 381.6 R 1.207 +(or maintaining any necessary alignment.)-.25 F F1 1.208 +(Use the DB_DBT_USERMEM \215ag to cause returned)6.207 F +(items to be placed in memory of arbitrary alignment.)108 393.6 Q +(The elements of the DBT structure are de\214ned as follo)108 410.4 Q +(ws:)-.25 E -.2(vo)108 427.2 S(id *data;).2 E 2.5(Ap)133 439.2 S +(ointer to a byte string.)-2.5 E(u_int32_t size;)108 456 Q +(The length of)133 468 Q F3(data)2.5 E F1 2.5(,i).26 G 2.5(nb)-2.5 G +(ytes.)-2.5 E(u_int32_t ulen;)108 484.8 Q .882(The size of the user')133 +496.8 R 3.382(sb)-.55 G(uf)-3.582 E .882(fer \(referenced by)-.25 F F3 +(data)3.382 E F1 .882(\), in bytes.).26 F .881 +(This location is not written by the DB)5.882 F 2.5(functions. See)133 +508.8 R(the DB_DBT_USERMEM \215ag for more information.)2.5 E +(u_int32_t dlen;)108 525.6 Q 3.063(The length of the partial record being read or written by the application, in bytes.) +133 537.6 R 3.064(See the)8.064 F(DB_DBT_P)133 549.6 Q(AR)-.92 E +(TIAL \215ag for more information.)-.6 E(u_int32_t dof)108 566.4 Q(f;) +-.25 E 3.219(The of)133 578.4 R 3.218(fset of the partial record being read or written by the application, in bytes.) +-.25 F 3.218(See the)8.218 F(DB_DBT_P)133 590.4 Q(AR)-.92 E +(TIAL \215ag for more information.)-.6 E(u_int32_t \215ags;)108 607.2 Q +(The \215ags v)133 619.2 Q(alue is speci\214ed by)-.25 E F2(or)2.5 E F1 +('ing together one or more of the follo)A(wing v)-.25 E(alues:)-.25 E +(DB_DBT_MALLOC)133 636 Q 5.808(Ignored e)158 648 R 5.808 +(xcept when retrie)-.15 F 5.808 +(ving information from a database, e.g., a)-.25 F F3(DB->g)8.309 E(et) +-.1 E F1(or)8.309 E F3(DBcur)158 660 Q(sor)-.1 E(->c_g)-.2 E(et)-.1 E F1 +3.602(call. This)3.602 F 1.101 +(\215ag causes DB to allocate memory for the returned k)3.602 F 1.401 +-.15(ey o)-.1 H 3.601(rd).15 G(ata)-3.601 E 1.055(item \(using)158 672 R +F3(malloc)3.555 E F1 1.055(\(3\), or the user).31 F 1.055 +(-speci\214ed malloc function\) and return a pointer to it in the)-.2 F +F3(data)158 684 Q F1 .363(\214eld of the k)2.863 F .663 -.15(ey o)-.1 H +2.863(rd).15 G .363(ata DBT structure.)-2.863 F .363 +(The allocated memory becomes the responsibility)5.363 F 4.845 +(of the calling application.)158 696 R 4.846 +(It is an error to specify both DB_DBT_MALLOC and)9.846 F +(DB_DBT_USERMEM.)158 708 Q(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 364.4(DB_DBT\(3\) DB_DBT\(3\))72 48 R +(DB_DBT_USERMEM)133 84 Q 5.809(Ignored e)158 96 R 5.809 +(xcept when retrie)-.15 F 5.808 +(ving information from a database, e.g., a)-.25 F/F1 10/Times-Italic@0 +SF(DB->g)8.308 E(et)-.1 E F0(or)8.308 E F1(DBcur)158 108 Q(sor)-.1 E +(->c_g)-.2 E(et)-.1 E F0 2.927(call. The)2.927 F F1(data)2.927 E F0 .427 +(\214eld of the k)2.927 F .727 -.15(ey o)-.1 H 2.927(rd).15 G .427 +(ata structure must reference memory that)-2.927 F .574(is at least)158 +120 R F1(ulen)3.074 E F0 .574(bytes in length.)3.074 F .574 +(If the length of the requested item is less than or equal to that)5.574 +F .6 +(number of bytes, the item is copied into the memory referenced by the) +158 132 R F1(data)3.1 E F0 3.1(\214eld. Otherwise,)3.1 F 1.134 +(an error is returned, the)158 144 R F1(size)3.634 E F0 1.133 +(\214eld is set to the length needed for the requested item, and the) +3.634 F F1(errno)158 156 Q F0 -.25(va)4.012 G 1.513 +(riable is set to ENOMEM.).25 F 1.513 +(It is an error to specify both DB_DBT_MALLOC and)6.513 F +(DB_DBT_USERMEM.)158 168 Q(DB_DBT_P)133 184.8 Q(AR)-.92 E(TIAL)-.6 E +.524(Ignored e)158 196.8 R .524 +(xcept when speci\214ed for a data parameter)-.15 F 3.024(,w)-.4 G .523 +(here this \215ag causes the partial retrie)-3.024 F -.25(va)-.25 G(l) +.25 E .169(or storage of an item.)158 208.8 R .169 +(If the calling application is doing a get, the)5.169 F F1(dlen)2.67 E +F0 .17(bytes starting)2.67 F F1(dof)2.67 E(f)-.18 E F0(bytes)2.67 E +1.428(from the be)158 220.8 R 1.428(ginning of the retrie)-.15 F -.15 +(ve)-.25 G 3.927(dd).15 G 1.427(ata record are returned as if the)-3.927 +F 3.927(yc)-.15 G 1.427(omprised the entire)-3.927 F 3.092(record. If) +158 232.8 R(an)3.092 E 3.092(yo)-.15 G 3.092(ra)-3.092 G .593 +(ll of the speci\214ed bytes do not e)-3.092 F .593 +(xist in the record, the get is successful and)-.15 F(the e)158 244.8 Q +(xisting bytes or 0 bytes are returned.)-.15 E -.15(Fo)158 268.8 S 2.82 +(re).15 G .32(xample, if the data portion of a retrie)-2.97 F -.15(ve) +-.25 G 2.82(dr).15 G .32(ecord w)-2.82 F .32 +(as 100 bytes, and a partial retrie)-.1 F -.25(va)-.25 G 2.82(lw).25 G +(as)-2.92 E .543(done using a DBT ha)158 280.8 R .543(ving a)-.2 F F1 +(dlen)3.043 E F0 .543(\214eld of 20 and a)3.043 F F1(dof)3.043 E(f)-.18 +E F0 .543(\214eld of 85, the get call w)3.043 F .543(ould succeed,)-.1 F +(the)158 292.8 Q F1(data)2.824 E F0 .324(\214eld w)2.824 F .324 +(ould reference the last 15 bytes of the record, and the)-.1 F F1(size) +2.823 E F0 .323(\214eld w)2.823 F .323(ould be set to)-.1 F(15.)158 +304.8 Q .171(If the calling application is doing a put, the)158 328.8 R +F1(dlen)2.671 E F0 .171(bytes starting)2.671 F F1(dof)2.671 E(f)-.18 E +F0 .172(bytes from the be)2.671 F .172(ginning of)-.15 F .39 +(the speci\214ed k)158 340.8 R -.15(ey)-.1 G 1.49 -.55('s d).15 H .389 +(ata record are replaced by the data speci\214ed by the).55 F F1(data) +2.889 E F0(and)2.889 E F1(size)2.889 E F0(structure)2.889 E 3.132 +(elements. If)158 352.8 R F1(dlen)3.132 E F0 .632(is smaller than)3.132 +F F1(size)3.133 E F0 3.133(,t).18 G .633(he record will gro)-3.133 F +1.933 -.65(w, a)-.25 H .633(nd if).65 F F1(dlen)3.133 E F0 .633(is lar) +3.133 F .633(ger than)-.18 F F1(size)3.133 E F0 3.133(,t).18 G(he)-3.133 +E 1.137(record will shrink.)158 364.8 R 1.136 +(If the speci\214ed bytes do not e)6.137 F 1.136 +(xist, the record will be e)-.15 F 1.136(xtended using nul)-.15 F +(bytes as necessary)158 376.8 Q 2.5(,a)-.65 G +(nd the put call will succeed.)-2.5 E 1.079 +(It is an error to attempt a partial put using the)158 400.8 R F1 +(DB->put)3.58 E F0 1.08(function in a database that supports)3.58 F .49 +(duplicate records.)158 412.8 R -.15(Pa)5.49 G .49(rtial puts in databases supporting duplicate records must be done using a) +.15 F F1(db_cur)158 424.8 Q(sor)-.1 E F0 .224(\(3\) function.).73 F .224 +(It is an error to attempt a partial put with dif)5.224 F(fering)-.25 E +F1(dlen)2.725 E F0(and)2.725 E F1(size)2.725 E F0 -.25(va)2.725 G(lues) +.25 E(in a recno database with \214x)158 436.8 Q(ed-length records.)-.15 +E -.15(Fo)158 460.8 S 2.697(re).15 G .197 +(xample, if the data portion of a retrie)-2.847 F -.15(ve)-.25 G 2.697 +(dr).15 G .197(ecord w)-2.697 F .196(as 100 bytes, and a partial put w) +-.1 F .196(as done)-.1 F .855(using a DBT ha)158 472.8 R .855(ving a)-.2 +F F1(dlen)3.355 E F0 .855(\214eld of 20, a)3.355 F F1(dof)3.355 E(f)-.18 +E F0 .855(\214eld of 85, and a)3.355 F F1(size)3.355 E F0 .856 +(\214eld of 30, the resulting)3.356 F .786(record w)158 484.8 R .786 +(ould be 115 bytes in length, where the last 30 bytes w)-.1 F .786 +(ould be those speci\214ed by the)-.1 F(put call.)158 496.8 Q .171 +(The def)108 513.6 R .171(ault algorithm of associating returned k)-.1 F +.471 -.15(ey o)-.1 H 2.671(rd).15 G .171 +(ata items with the DB handle returned by)-2.671 F F1(db_open)2.672 E F0 +(\(3\)).24 E .977(will ob)108 525.6 R .977(viously not w)-.15 F .977(ork when DB handles are being used concurrently by multiple threads within a pro-) +-.1 F 2.609(cess, i.e, when DB_THREAD w)108 537.6 R 2.609 +(as speci\214ed to)-.1 F F1(db_open)5.109 E F0(\(3\).).24 E/F2 10 +/Times-Bold@0 SF 2.609(When multiple thr)7.609 F 2.61(eads ar)-.18 F +5.11(eu)-.18 G 2.61(sing the)-5.11 F -.18(re)108 549.6 S(tur).18 E 2.131 +(ned DB handle concurr)-.15 F(ently)-.18 E 4.631(,e)-.55 G 2.131 +(ither the DB_DBT_MALLOC or DB_DBT_USERMEM \215ags)-4.631 F +(must be speci\214ed f)108 561.6 Q(or any DBT used f)-.25 E(or k)-.25 E +(ey or data r)-.1 E(etrie)-.18 E -.1(va)-.15 G(l.).1 E/F3 9/Times-Bold@0 +SF(LOGICAL RECORD NUMBERS)72 578.4 Q F0 .863 +(In all cases for the recno access method, and when calling the)108 +590.4 R F1(db->g)3.363 E(et)-.1 E F0(and)3.363 E F1(cur)3.363 E(sor)-.1 +E(->c_g)-.2 E(et)-.1 E F0 .864(functions with)3.364 F .883 +(the DB_SET_RECNO \215ag speci\214ed, the)108 602.4 R F1(data)3.383 E F0 +.883(\214eld of the k)3.383 F 1.183 -.15(ey m)-.1 H .883 +(ust be a pointer to a memory location of).15 F(type)108 614.4 Q F1 +(db_r)2.807 E(ecno_t)-.37 E F0 2.807(,a).68 G 2.807(st)-2.807 G -1.95 +(ypedef ')-2.807 F 2.807(di)-.5 G 2.807(nt)-2.807 G .307(he include \214le.)-.4 F .308 +(This type is a 32-bit unsigned type, \(which limits)5.308 F .515(the number of logical records in a recno database, and the maximum logical record which may be directly) +108 626.4 R(retrie)108 638.4 Q -.15(ve)-.25 G 2.76(df).15 G .26 +(rom a btree database, to 4,294,967,296\).)-2.76 F(The)5.26 E F1(size) +2.76 E F0 .261(\214eld of the k)2.76 F .561 -.15(ey s)-.1 H .261 +(hould be the size of that type,).15 F +(e.g., in the C programming language, `)108 650.4 Q +(`sizeof\(db_recno_t\)')-.74 E('.)-.74 E(Logical record numbers are 1-based, not 0-based, i.e., the \214rst record in the database is record number 1.) +108 674.4 Q F3 -.09(BU)72 691.2 S(GS).09 E F0 .615 +(The DB access methods pro)108 703.2 R .615(vide no guarantees about byte string alignment, and applications are responsi-) +-.15 F(ble for maintaining an)108 715.2 Q 2.5(yn)-.15 G +(ecessary alignment.)-2.5 E(April 10, 1998)276.695 768 Q(2)199.695 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 364.4(DB_DBT\(3\) DB_DBT\(3\))72 48 R .106 +(The name DBT is a mnemonic for `)108 84 R .106(`data base thang')-.74 F +.106(', and w)-.74 F .107 +(as used because noone could think of a reason-)-.1 F(able name that w) +108 96 Q(asn')-.1 E 2.5(ta)-.18 G(lready in use some)-2.5 E(where else.) +-.25 E/F1 9/Times-Bold@0 SF(SEE ALSO)72 112.8 Q F0 .486 +(The DB library is a f)108 124.8 R .485 +(amily of groups of functions that pro)-.1 F .485 +(vides a modular programming interf)-.15 F .485(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 136.8 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .507(\214le page caching, as well as v)108 148.8 R .507 +(arious inde)-.25 F -.15(xe)-.15 G 3.007(da).15 G .506(ccess methods.) +-3.007 F(Man)5.506 E 3.006(yo)-.15 G 3.006(ft)-3.006 G .506 +(he functional groups \(e.g., the \214le)-3.006 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 160.8 R .122(are e)108 172.8 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.121 G 2.621(rag).15 G .121(eneral description of)-2.621 +F(the DB package, see)108 184.8 Q/F2 10/Times-Italic@0 SF(db_intr)2.5 E +(o)-.45 E F0(\(3\).).18 E F2(db_ar)108 201.6 Q -.15(ch)-.37 G(ive).15 E +F0(\(1\),).18 E F2(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F0(\(1\),).68 E F2 +(db_deadloc)2.5 E(k)-.2 E F0(\(1\),).67 E F2(db_dump)2.5 E F0(\(1\),).19 +E F2(db_load)2.5 E F0(\(1\),).77 E F2(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0 +(\(1\),).73 E F2(db_stat)2.5 E F0(\(1\),).68 E F2(db_intr)108 213.6 Q(o) +-.45 E F0(\(3\),).18 E F2(db_appinit)2.5 E F0(\(3\),).68 E F2(db_cur)2.5 +E(sor)-.1 E F0(\(3\),).73 E F2(db_dbm)2.5 E F0(\(3\),).32 E F2 +(db_internal)2.5 E F0(\(3\),).51 E F2(db_loc)2.5 E(k)-.2 E F0(\(3\),).67 +E F2(db_lo)2.5 E(g)-.1 E F0(\(3\),).22 E F2(db_mpool)2.5 E F0(\(3\),).51 +E F2(db_open)108 225.6 Q F0(\(3\),).24 E F2(db_thr)2.5 E(ead)-.37 E F0 +(\(3\),).77 E F2(db_txn)2.5 E F0(\(3\)).24 E(April 10, 1998)276.695 768 +Q(3)199.695 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/man.ps/db_deadlock.ps b/mozilla/db/man/man.ps/db_deadlock.ps new file mode 100644 index 00000000000..9bf2cebfc11 --- /dev/null +++ b/mozilla/db/man/man.ps/db_deadlock.ps @@ -0,0 +1,286 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:18 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 1 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_deadlock \255 the DB database deadlock detector)108 40.8 Q F0 +(SYNOPSIS)72 57.6 Q/F2 10/Times-Bold@0 SF(db_deadlock)108 69.6 Q F1([) +2.5 E F2(-vw)A F1 2.5(][)C F2(-a m | o | y)-2.5 E F1 2.5(][)C F2 +(-h home)-2.5 E F1 2.5(][)C F2(-L \214le)-2.5 E F1 2.5(][)2.5 G F2 +(-t sec)-2.5 E F1(])2.5 E F0(DESCRIPTION)72 86.4 Q F1(The)108 98.4 Q/F3 +10/Times-Italic@0 SF(db_deadloc)2.665 E(k)-.2 E F1 .165(utility tra) +2.665 F -.15(ve)-.2 G .165(rses the database lock structures and aborts a transaction each time it detects a) +.15 F 3.239(deadlock. This)108 110.4 R .739 +(utility should be run as a background daemon whene)3.239 F -.15(ve)-.25 +G 3.24(rm).15 G .74(ultiple threads or processes are)-3.24 F +(using locking.)108 122.4 Q(By def)5 E(ault, a random transaction in)-.1 +E -.2(vo)-.4 G(lv).2 E(ed in the deadlock is aborted.)-.15 E +(The options are as follo)108 139.2 Q(ws:)-.25 E F2108 156 Q F1 +.858(When a deadlock is detected, abort the oldest \(`)14.3 F(`o')-.74 E +.858('\) transaction, the youngest \(`)-.74 F(`y')-.74 E .857 +('\) transaction, or)-.74 F +(the transaction with the minimum number of locks \(`)133 168 Q(`m')-.74 +E('\).)-.74 E F2108 184.8 Q F1 +(Specify a home directory for the database.)13.74 E F2108 201.6 Q +F1 1.765(Log the e)12.63 F -.15(xe)-.15 G 1.765(cution of the db_deadlock utility to the speci\214ed \214le in the follo) +.15 F 1.766(wing format, where)-.25 F -.74(``)133 213.6 S(###').74 E 2.5 +('i)-.74 G 2.5(st)-2.5 G +(he process ID, and the date is the time the utility starting running.) +-2.5 E(db_deadlock: ### W)133 237.6 Q(ed Jun 15 01:23:45 EDT 1995)-.8 E +(This \214le will be remo)133 261.6 Q -.15(ve)-.15 G 2.5(di).15 G 2.5 +(ft)-2.5 G(he db_deadlock utility e)-2.5 E(xits gracefully)-.15 E(.)-.65 +E F2108 278.4 Q F1(Initiate a pass o)15.97 E -.15(ve)-.15 G 2.5 +(rt).15 G(he database locks at least e)-2.5 E -.15(ve)-.25 G(ry).15 E F3 +(sec)2.5 E F1(seconds.)2.5 E F2108 295.2 Q F1(Run in v)14.3 E +(erbose mode, generating messages each time the detector runs.)-.15 E F2 +108 312 Q F1(Mak)12.08 E 2.5(eas)-.1 G(ingle pass o)-2.5 E -.15 +(ve)-.15 G 2.5(rt).15 G(he database locks e)-2.5 E -.15(ve)-.25 G +(ry time a process is forced to w).15 E(ait for a lock.)-.1 E +(At least one of the)108 328.8 Q F2(-t)2.5 E F1(and)2.5 E F2(-w)2.5 E F1 +(options must be speci\214ed.)2.5 E(The)108 345.6 Q F3(db_deadloc)3.994 +E(k)-.2 E F1 1.494(utility attaches to DB shared memory re)3.994 F 3.993 +(gions. In)-.15 F 1.493(order to a)3.993 F -.2(vo)-.2 G 1.493(id re).2 F +1.493(gion corruption, it)-.15 F .902(should al)108 357.6 R -.1(wa)-.1 G +.902(ys be gi).1 F -.15(ve)-.25 G 3.402(nt).15 G .902 +(he chance to detach and e)-3.402 F .902(xit gracefully)-.15 F 5.902(.T) +-.65 G 3.403(oc)-6.702 G(ause)-3.403 E F3(db_deadloc)3.403 E(k)-.2 E F1 +.903(to clean up after)3.403 F(itself and e)108 369.6 Q +(xit, send it an interrupt signal \(SIGINT\).)-.15 E(The)108 386.4 Q F3 +(db_deadloc)2.5 E(k)-.2 E F1(utility e)2.5 E +(xits 0 on success, and >0 if an error occurs.)-.15 E F0(ENVIR)72 403.2 +Q(ONMENT V)-.27 E(ARIABLES)-1.215 E F1(The follo)108 415.2 Q(wing en) +-.25 E(vironment v)-.4 E(ariables af)-.25 E(fect the e)-.25 E -.15(xe) +-.15 G(cution of).15 E F3(db_deadloc)2.5 E(k)-.2 E F1(:).67 E(DB_HOME) +108 432 Q .222(If the)133 444 R F22.722 E F1 .222 +(option is not speci\214ed and the en)2.722 F .222(vironment v)-.4 F +(ariable)-.25 E F3(DB_HOME)2.722 E F1 .221 +(is set, it is used as the path)2.721 F +(of the database home, as described in)133 456 Q F3(db_appinit)2.5 E F1 +(\(3\).).68 E F0(SEE ALSO)72 472.8 Q F1 .485(The DB library is a f)108 +484.8 R .485(amily of groups of functions that pro)-.1 F .486 +(vides a modular programming interf)-.15 F .486(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 496.8 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .506(\214le page caching, as well as v)108 508.8 R .506 +(arious inde)-.25 F -.15(xe)-.15 G 3.006(da).15 G .506(ccess methods.) +-3.006 F(Man)5.507 E 3.007(yo)-.15 G 3.007(ft)-3.007 G .507 +(he functional groups \(e.g., the \214le)-3.007 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 520.8 R .121(are e)108 532.8 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.122 G 2.622(rag).15 G .122(eneral description of)-2.622 +F(the DB package, see)108 544.8 Q F3(db_intr)2.5 E(o)-.45 E F1(\(3\).) +.18 E F3(db_ar)108 561.6 Q -.15(ch)-.37 G(ive).15 E F1(\(1\),).18 E F3 +(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F1(\(1\),).68 E F3(db_deadloc)2.5 E +(k)-.2 E F1(\(1\),).67 E F3(db_dump)2.5 E F1(\(1\),).19 E F3(db_load)2.5 +E F1(\(1\),).77 E F3(db_r)2.5 E(eco)-.37 E(ver)-.1 E F1(\(1\),).73 E F3 +(db_stat)2.5 E F1(\(1\),).68 E F3(db_intr)108 573.6 Q(o)-.45 E F1 +(\(3\),).18 E F3(db_appinit)2.5 E F1(\(3\),).68 E F3(db_cur)2.5 E(sor) +-.1 E F1(\(3\),).73 E F3(db_dbm)2.5 E F1(\(3\),).32 E F3(db_internal)2.5 +E F1(\(3\),).51 E F3(db_loc)2.5 E(k)-.2 E F1(\(3\),).67 E F3(db_lo)2.5 E +(g)-.1 E F1(\(3\),).22 E F3(db_mpool)2.5 E F1(\(3\),).51 E F3(db_open) +108 585.6 Q F1(\(3\),).24 E F3(db_thr)2.5 E(ead)-.37 E F1(\(3\),).77 E +F3(db_txn)2.5 E F1(\(3\)).24 E(1)535 768 Q EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/man.ps/db_dump.ps b/mozilla/db/man/man.ps/db_dump.ps new file mode 100644 index 00000000000..b598f39b691 --- /dev/null +++ b/mozilla/db/man/man.ps/db_dump.ps @@ -0,0 +1,374 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:18 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 2 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_dump \255 the DB database dump utility)108 40.8 Q F0(SYNOPSIS)72 +57.6 Q/F2 10/Times-Bold@0 SF(db_dump)108 69.6 Q F1([)2.5 E F2(-d)A F1 +2.5(][)C F2(-f output)-2.5 E F1 2.5(]d)C(b_\214le)-2.5 E F2(db_dump)108 +81.6 Q F1([)2.5 E F2(-p)A F1 2.5(][)C F2(-f output)-2.5 E F1 2.5(][)C F2 +(-h home)-2.5 E F1 2.5(]d)C(b_\214le)-2.5 E F2(db_dump185)108 93.6 Q F1 +([)2.5 E F2(-p)A F1 2.5(][)C F2(-f output)-2.5 E F1 2.5(]d)C(b_\214le) +-2.5 E F0(DESCRIPTION)72 110.4 Q F1(The)108 122.4 Q/F3 10/Times-Italic@0 +SF(db_dump)2.707 E F1 .206(utility reads the database \214le)2.707 F F3 +(db_\214le)2.706 E F1 .206 +(and writes it to the standard output using a portable \215at-)2.706 F +(te)108 134.4 Q .8(xt format understood by the)-.15 F F3(db_load)3.3 E +F1 .8(\(1\) utility).77 F 5.8(.T)-.65 G .8(he ar)-5.8 F(gument)-.18 E F3 +(db_\214le)3.3 E F1 .8(must be a \214le produced using the)3.3 F F3(DB) +108 146.4 Q F1(library functions.)2.5 E(The)108 163.2 Q F3(db_dump185) +3.168 E F1 .667(utility is similar to the)3.167 F F3(db_dump)3.167 E F1 +.667(utility e)3.167 F .667 +(xcept that it reads databases in the format used)-.15 F(by DB v)108 +175.2 Q(ersions 1.85 and 1.86.)-.15 E(The options are as follo)108 192 Q +(ws:)-.25 E F2108 208.8 Q F1 .427 +(Dump the speci\214ed database in a format helpful for deb)13.74 F .428 +(ugging the DB library routines.)-.2 F F2 .428(The output)5.428 F -.25 +(fo)133 220.8 S .075(rmat of the \255d option is not standard and may change, without notice, between r) +.25 F .075(eleases of the)-.18 F(DB library)133 232.8 Q(.)-.7 E108 +249.6 Q F1(Write to the speci\214ed)15.97 E F3(\214le)2.5 E F1 +(instead of to the standard output.)2.5 E F2108 266.4 Q F1 .261 +(Specify a home directory for the database.)13.74 F .262(As DB v)5.262 F +.262(ersions before 2.0 did not support the concept of)-.15 F 2.5(ad)133 +278.4 S(atabase `)-2.5 E(`home')-.74 E(',)-.74 E F3(db_dump185)2.5 E F1 +(does not support this option.)2.5 E F2108 295.2 Q F1 1.442 +(If characters in either the k)13.74 F 1.741 -.15(ey o)-.1 H 3.941(rd) +.15 G 1.441(ata items are printing characters \(as de\214ned by)-3.941 F +F3(isprint)3.941 E F1 1.441(\(3\)\), use).68 F .415 +(printing characters in)133 307.2 R F3(\214le)2.915 E F1 .415 +(to represent them.)2.915 F .415 +(This option permits users to use standard te)5.415 F .415 +(xt editors to)-.15 F(modify the contents of databases.)133 319.2 Q +2.969(Note, dif)133 336 R 2.969(ferent systems may ha)-.25 F 3.269 -.15 +(ve d)-.2 H(if).15 E 2.968(ferent notions as to what characters are `) +-.25 F(`printing')-.74 E 2.968(', and)-.74 F +(databases dumped in this manner may be less portable to e)133 348 Q +(xternal systems.)-.15 E 1.211 +(Dumping and reloading hash databases that use user)108 364.8 R 1.212 +(-de\214ned hash functions will result in ne)-.2 F 3.712(wd)-.25 G +(atabases)-3.712 E .788(that use the def)108 376.8 R .788 +(ault hash function.)-.1 F .787(While using the def)5.787 F .787 +(ault hash function may not be optimal for the ne)-.1 F(w)-.25 E +(database, it will continue to w)108 388.8 Q(ork correctly)-.1 E(.)-.65 +E .717(Dumping and reloading btree databases that use user)108 405.6 R +.717(-de\214ned pre\214x or comparison functions will result in)-.2 F +(ne)108 417.6 Q 2.716(wd)-.25 G .216(atabases that use the def)-2.716 F +.216(ault pre\214x and comparison functions.)-.1 F F2 .215 +(In this case, it is quite lik)5.216 F .215(ely that the)-.1 F +(database will be damaged bey)108 429.6 Q(ond r)-.25 E +(epair permitting neither r)-.18 E(ecord storage or r)-.18 E(etrie)-.18 +E -.1(va)-.15 G(l.).1 E F1 .133(The only a)108 446.4 R -.25(va)-.2 G +.133(ilable w).25 F .133 +(orkaround for either case is to modify the sources for the)-.1 F F3 +(db_load)2.634 E F1 .134(\(1\) utility to load the).77 F +(database using the correct hash, pre\214x and comparison functions.)108 +458.4 Q(The)108 475.2 Q F3(db_dump185)3.698 E F1 1.198 +(utility may not be a)3.698 F -.25(va)-.2 G 1.198 +(ilable on your system as it is not al).25 F -.1(wa)-.1 G 1.197 +(ys installed when the DB).1 F 1.068 +(libraries and utilities are installed.)108 487.2 R 1.069(If you are unable to \214nd it, see your system administrator for further) +6.069 F(information.)108 499.2 Q(The)108 516 Q F3(db_dump)2.941 E F1 +.441(utility e)2.941 F .441 +(xits 0 on success, and >0 if an error occurs.)-.15 F(The)5.44 E F3 +(db_dump185)2.94 E F1 .44(utility e)2.94 F .44(xits 0 on suc-)-.15 F +(cess, and >0 if an error occurs.)108 528 Q F0(OUTPUT FORMA)72 544.8 Q +(TS)-.855 E F1(There are tw)108 556.8 Q 2.5(oo)-.1 G +(utput formats used by)-2.5 E F3(db_dump)2.5 E F1(and)2.5 E F3 +(db_dump185)2.5 E F1(.).41 E .543 +(In both output formats, the \214rst fe)108 573.6 R 3.043(wl)-.25 G .543 +(ines of the output contain header information describing the underly-) +-3.043 F .53(ing access method, \214lesystem page size and other bookk) +108 585.6 R .529(eeping information.)-.1 F .529 +(This information is output in)5.529 F -.74(``)108 597.6 S(name=v).74 E +(alue')-.25 E 3.59('p)-.74 G 1.09(airs, where `)-3.59 F(`name')-.74 E +3.59('m)-.74 G 1.09(ay be an)-3.59 F 3.59(yo)-.15 G 3.59(ft)-3.59 G 1.09 +(he k)-3.59 F -.15(ey)-.1 G -.1(wo).15 G 1.09(rds listed in the).1 F F3 +(db_load)3.59 E F1 1.09(\(1\) manual page,).77 F .273(and `)108 609.6 R +(`v)-.74 E(alue')-.25 E 2.773('w)-.74 G .273(ill be its v)-2.773 F 2.773 +(alue. While)-.25 F .273 +(this header information can be edited before the database is reloaded,) +2.773 F .196(there is rarely an)108 621.6 R 2.696(yr)-.15 G .197 +(eason to do so, as all of this information can be o)-2.696 F -.15(ve) +-.15 G .197(rridden by command-line ar).15 F(guments)-.18 E(to)108 633.6 +Q F3(db_load)2.5 E F1(.).77 E -.15(Fo)108 650.4 S(llo).15 E .137 +(wing the header information are the k)-.25 F -.15(ey)-.1 G .136 +(/data pairs from the database.).15 F .136 +(If the database being dumped is)5.136 F .307(of type)108 662.4 R F2 +(btr)2.807 E(ee)-.18 E F1(or)2.807 E F2(hash)2.807 E F1 2.807(,t)C .307 +(he output will be paired lines of te)-2.807 F .308 +(xt, where the \214rst line of the pair is the k)-.15 F .608 -.15(ey i) +-.1 H(tem,).15 E 1.381 +(and the second line of the pair is its corresponding data item.)108 +674.4 R 1.38(If the database being dumped is of type)6.38 F F2 -.18(re) +108 686.4 S(cno).18 E F1 2.5(,t)C(he output will be lines of te)-2.5 E +(xt, where each line is a ne)-.15 E 2.5(wd)-.25 G +(ata item for the database.)-2.5 E .223(If the)108 703.2 R F22.723 +E F1 .223(option w)2.723 F .224(as speci\214ed, each output line will consist of single characters representing an) +-.1 F 2.724(yc)-.15 G(haracters)-2.724 E 1.702 +(from the database that were `)108 715.2 R(`printing')-.74 E 1.702 +(', and backslash \(`)-.74 F(`\\')-.74 E 1.702 +('\) escaped characters for an)-.74 F 4.202(yt)-.15 G 1.702 +(hat were not.)-4.202 F .869 +(Backslash characters appearing in the output mean one of tw)108 727.2 R +3.369(ot)-.1 G .87(hings: if the backslash character precedes)-3.369 F +(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 346.62(DB_DUMP\(1\) DB_DUMP\(1\))72 48 R .523 +(another backslash character)108 84 R 3.023(,i)-.4 G 3.023(tm)-3.023 G +.523(eans that a literal backslash character occurred in the k)-3.023 F +.823 -.15(ey o)-.1 H 3.023(rd).15 G .523(ata item.)-3.023 F(If)5.522 E +.54(the backslash character precedes an)108 96 R 3.04(yo)-.15 G .54 +(ther character)-3.04 F 3.04(,t)-.4 G .54(he ne)-3.04 F .54(xt tw)-.15 F +3.04(oc)-.1 G .54(haracters should be interpreted as he)-3.04 F(x-)-.15 +E(adecimal speci\214cation of a single character)108 108 Q 2.5(,e)-.4 G +(.g., `)-2.5 E(`\\0a')-.74 E 2.5('i)-.74 G 2.5(san)-2.5 G -.25(ew)-2.5 G +(line character in the ASCII character set.).25 E .397(If the)108 124.8 +R/F1 10/Times-Bold@0 SF2.897 E F0 .396(option w)2.896 F .396 +(as not speci\214ed, each output line will consist of paired he)-.1 F +.396(xadecimal v)-.15 F .396(alues, e.g., the line)-.25 F -.74(``)108 +136.8 S(726f6f74').74 E 2.5('i)-.74 G 2.5(st)-2.5 G(he string `)-2.5 E +(`root')-.74 E 2.5('i)-.74 G 2.5(nt)-2.5 G(he ASCII character set.)-2.5 +E(In both output formats, a single ne)108 153.6 Q +(wline character ends both the k)-.25 E .3 -.15(ey a)-.1 H +(nd data items.).15 E/F2 9/Times-Bold@0 SF(ENVIR)72 170.4 Q(ONMENT V) +-.27 E(ARIABLES)-1.215 E F0(The follo)108 182.4 Q(wing en)-.25 E +(vironment v)-.4 E(ariables af)-.25 E(fect the e)-.25 E -.15(xe)-.15 G +(cution of).15 E/F3 10/Times-Italic@0 SF(db_dump)2.5 E F0(:).19 E +(DB_HOME)108 199.2 Q .221(If the)133 211.2 R F12.721 E F0 .221 +(option is not speci\214ed and the en)2.721 F .222(vironment v)-.4 F +(ariable)-.25 E F3(DB_HOME)2.722 E F0 .222 +(is set, it is used as the path)2.722 F +(of the database home, as described in)133 223.2 Q F3(db_appinit)2.5 E +F0(\(3\).).68 E F2(SEE ALSO)72 240 Q F3(isprint)108 252 Q F0(\(3\)).68 E +.486(The DB library is a f)108 268.8 R .485 +(amily of groups of functions that pro)-.1 F .485 +(vides a modular programming interf)-.15 F .485(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 280.8 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .507(\214le page caching, as well as v)108 292.8 R .507 +(arious inde)-.25 F -.15(xe)-.15 G 3.007(da).15 G .506(ccess methods.) +-3.007 F(Man)5.506 E 3.006(yo)-.15 G 3.006(ft)-3.006 G .506 +(he functional groups \(e.g., the \214le)-3.006 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 304.8 R .122(are e)108 316.8 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.121 G 2.621(rag).15 G .121(eneral description of)-2.621 +F(the DB package, see)108 328.8 Q F3(db_intr)2.5 E(o)-.45 E F0(\(3\).) +.18 E F3(db_ar)108 345.6 Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E F3 +(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F0(\(1\),).68 E F3(db_deadloc)2.5 E +(k)-.2 E F0(\(1\),).67 E F3(db_dump)2.5 E F0(\(1\),).19 E F3(db_load)2.5 +E F0(\(1\),).77 E F3(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F3 +(db_stat)2.5 E F0(\(1\),).68 E F3(db_intr)108 357.6 Q(o)-.45 E F0 +(\(3\),).18 E F3(db_appinit)2.5 E F0(\(3\),).68 E F3(db_cur)2.5 E(sor) +-.1 E F0(\(3\),).73 E F3(db_dbm)2.5 E F0(\(3\),).32 E F3(db_internal)2.5 +E F0(\(3\),).51 E F3(db_loc)2.5 E(k)-.2 E F0(\(3\),).67 E F3(db_lo)2.5 E +(g)-.1 E F0(\(3\),).22 E F3(db_mpool)2.5 E F0(\(3\),).51 E F3(db_open) +108 369.6 Q F0(\(3\),).24 E F3(db_thr)2.5 E(ead)-.37 E F0(\(3\),).77 E +F3(db_txn)2.5 E F0(\(3\)).24 E(April 10, 1998)276.695 768 Q(2)199.695 E +EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/man.ps/db_hsearch.ps b/mozilla/db/man/man.ps/db_hsearch.ps new file mode 100644 index 00000000000..0903477aea9 --- /dev/null +++ b/mozilla/db/man/man.ps/db_hsearch.ps @@ -0,0 +1,325 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:20 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 2 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(hsearch \255 hsearch, hcreate, hdestro)108 40.8 Q(y)-.1 E F0(SYNOPSIS) +72 57.6 Q/F2 10/Times-Bold@0 SF(#de\214ne DB_DBM_HSEARCH)108 69.6 Q(1)10 +E(#include )-.4 E(typedef enum {)108 105.6 Q +(FIND, ENTER)128 117.6 Q 2.5(}A)108 129.6 S(CTION;)-3.05 E +(typedef struct entry {)108 153.6 Q(char *k)128 165.6 Q(ey;)-.1 E -.1 +(vo)128 177.6 S(id *data;).1 E 2.5(}E)108 189.6 S(NTR)-2.5 E -.92(Y;) +-.35 G(ENTR)108 213.6 Q 2.5(Y*)-.35 G(hsear)108 225.6 Q(ch\(ENTR)-.18 E +2.5(Yi)-.35 G(tem, A)-2.5 E(CTION action\);)-.55 E(int)108 249.6 Q(hcr) +108 261.6 Q(eate\(size_t nelem\);)-.18 E -.1(vo)108 285.6 S(id).1 E +(hdestr)108 297.6 Q(oy\(v)-.18 E(oid\);)-.1 E F0(DESCRIPTION)72 314.4 Q +F1(The)108 326.4 Q/F3 10/Times-Italic@0 SF(hsear)2.955 E -.15(ch)-.37 G +F1(interf)3.105 E .455(ace to the DB library is intended to pro)-.1 F +.455(vide source code compatibility for historic appli-)-.15 F 2.5 +(cations. It)108 338.4 R(is not recommended for an)2.5 E 2.5(yo)-.15 G +(ther purpose.)-2.5 E 4.275 -.8(To c)108 355.2 T(ompile).8 E F3(hsear) +5.175 E -.15(ch)-.37 G F1 2.675(applications, replace the application') +5.325 F(s)-.55 E F3(#include)5.175 E F1 2.676 +(of the hsearch include \214le \(e.g.,)5.175 F -.74(``)108 367.2 S +(#include ').74 E('\) with the follo)-.74 E(wing tw)-.25 E 2.5 +(ol)-.1 G(ines:)-2.5 E(#de\214ne DB_DBM_HSEARCH)144 384 Q(1)10 E +(#include )-.4 E(and recompile.)108 412.8 Q(The)108 +429.6 Q F3(hcr)3.584 E(eate)-.37 E F1 1.084 +(function creates an in-memory database.)3.584 F(The)6.083 E F3(nelem) +3.583 E F1(ar)3.583 E 1.083(gument is an estimation of the maxi-)-.18 F +(mum number of k)108 441.6 Q -.15(ey)-.1 G +(/data pairs that will be stored in the database.).15 E(The)108 458.4 Q +F3(hdestr)2.5 E(oy)-.45 E F1(function discards the database.)2.5 E .267 +(Database elements are structures of type)108 475.2 R F3(ENTR)2.767 E(Y) +-.18 E F1 2.768(,w)1.27 G .268(hich contain at least tw)-2.768 F 2.768 +<6f8c>-.1 G(elds:)-2.768 E F3 -.1(ke)2.768 G(y)-.2 E F1(and)2.768 E F3 +(data)2.768 E F1 5.268(.T).26 G .268(he \214eld)-5.268 F F3 -.1(ke)108 +487.2 S(y)-.2 E F1 1.562(is declared to be of type `)4.062 F 1.562 +(`char *')-.74 F 4.062('a)-.74 G 1.561(nd is the k)-4.062 F 1.861 -.15 +(ey u)-.1 H 1.561(sed for storage and retrie).15 F -.25(va)-.25 G 4.061 +(l. The).25 F(\214eld)4.061 E F3(data)4.061 E F1(is)4.061 E +(declared to be of type `)108 499.2 Q(`v)-.74 E(oid *')-.2 E 2.5('a)-.74 +G(nd is its associated data.)-2.5 E(The)108 516 Q F3(hsear)2.5 E -.15 +(ch)-.37 G F1(function retrie)2.65 E -.15(ve)-.25 G 2.5(sk).15 G -.15 +(ey)-2.6 G(/data pairs from, and stores k).15 E -.15(ey)-.1 G +(/data pairs into, the database.).15 E(The)108 532.8 Q F3(action)2.5 E +F1(ar)2.5 E(gument must be set to one of tw)-.18 E 2.5(ov)-.1 G(alues:) +-2.75 E(ENTER)108 549.6 Q .838(If the k)133 561.6 R 1.139 -.15(ey d)-.1 +H .839(oes not already appear in the database, insert the k).15 F -.15 +(ey)-.1 G .839(/data pair into the database.).15 F .839(If the)5.839 F +-.1(ke)133 573.6 S 2.606(ya)-.05 G .106 +(lready appears in the database, return a reference to an)-2.606 F F3 +(ENTR)2.606 E(Y)-.18 E F1 .106(structure referencing the e)2.606 F +(xisting)-.15 E -.1(ke)133 585.6 S 2.5(ya)-.05 G +(nd its associated data element.)-2.5 E(FIND)108 602.4 Q(Retrie)133 +614.4 Q .3 -.15(ve t)-.25 H(he speci\214ed k).15 E -.15(ey)-.1 G +(/data pair from the database.).15 E F0(COMP)72 636 Q -.855(AT)-.666 G +(IBILITY NO).855 E(TES)-.36 E F1(Historically)108 648 Q(,)-.65 E F3 +(hsear)2.768 E -.15(ch)-.37 G F1 .268 +(required applications to maintain the k)2.918 F -.15(ey)-.1 G 2.769(sa) +.15 G .269(nd data in the application')-2.769 F 2.769(sm)-.55 G .269 +(emory for as)-2.769 F 1.634(long as the)108 660 R F3(hsear)4.134 E -.15 +(ch)-.37 G F1 1.634(database e)4.284 F 4.134(xisted. As)-.15 F 1.634 +(DB handles k)4.134 F 1.934 -.15(ey a)-.1 H 1.634 +(nd data management internally).15 F 4.133(,t)-.65 G 1.633(here is no) +-4.133 F .247(requirement that applications maintain local copies of k) +108 672 R .547 -.15(ey a)-.1 H .247(nd data items, although the only ef) +.15 F .247(fect of doing)-.25 F +(so should be the allocation of additional memory)108 684 Q(.)-.65 E F0 +(DIA)72 700.8 Q(GNOSTICS)-.495 E F1(The)108 712.8 Q F3(hcr)2.5 E(eate) +-.37 E F1(function returns 0 on f)2.5 E(ailure, setting)-.1 E F3(errno) +2.5 E F1 2.5(,a).18 G(nd non-zero on success.)-2.5 E(The)108 729.6 Q F3 +(hsear)2.975 E -.15(ch)-.37 G F1 .474 +(function returns a pointer to an ENTR)3.125 F 2.974(Ys)-.65 G .474 +(tructure on success, and NULL, setting)-2.974 F F3(errno)2.974 E F1 +2.974(,i).18 G 2.974(ft)-2.974 G(he)-2.974 E(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 311.06(DB_HSEARCH\(3\) DB_HSEARCH\(3\))72 48 R +/F1 10/Times-Italic@0 SF(action)108 84 Q F0(speci\214ed w)2.5 E +(as FIND and the item did not appear in the database.)-.1 E/F2 9 +/Times-Bold@0 SF(ERR)72 100.8 Q(ORS)-.27 E F0(The)108 112.8 Q F1(hcr) +3.682 E(eate)-.37 E F0 1.182(function may f)3.682 F 1.183 +(ail and return)-.1 F F1(errno)3.683 E F0 1.183(for an)3.683 F 3.683(yo) +-.15 G 3.683(ft)-3.683 G 1.183(he errors speci\214ed for the follo) +-3.683 F 1.183(wing DB and)-.25 F +(library functions: db_open\(3\), and memset\(3\).)108 124.8 Q(The)108 +141.6 Q F1(hsear)3.599 E -.15(ch)-.37 G F0 1.099(function may f)3.749 F +1.099(ail and return)-.1 F F1(errno)3.598 E F0 1.098(for an)3.598 F +3.598(yo)-.15 G 3.598(ft)-3.598 G 1.098 +(he errors speci\214ed for the follo)-3.598 F 1.098(wing DB and)-.25 F(library functions: DB->get\(3\), DB->put\(3\), memset\(3\), and strlen\(3\).) +108 153.6 Q .349(In addition, the)108 170.4 R F1(hsear)2.849 E -.15(ch) +-.37 G F0 .349(function will f)2.999 F .349(ail, setting)-.1 F F1(errno) +2.849 E F0 .35(to 0, if the)2.849 F F1(action)2.85 E F0 .35 +(speci\214ed w)2.85 F .35(as FIND and the item)-.1 F +(did not appear in the database.)108 182.4 Q F2(SEE ALSO)72 199.2 Q F0 +.486(The DB library is a f)108 211.2 R .485 +(amily of groups of functions that pro)-.1 F .485 +(vides a modular programming interf)-.15 F .485(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 223.2 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .507(\214le page caching, as well as v)108 235.2 R .507 +(arious inde)-.25 F -.15(xe)-.15 G 3.007(da).15 G .506(ccess methods.) +-3.007 F(Man)5.506 E 3.006(yo)-.15 G 3.006(ft)-3.006 G .506 +(he functional groups \(e.g., the \214le)-3.006 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 247.2 R .122(are e)108 259.2 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.121 G 2.621(rag).15 G .121(eneral description of)-2.621 +F(the DB package, see)108 271.2 Q F1(db_intr)2.5 E(o)-.45 E F0(\(3\).) +.18 E F1(db_ar)108 288 Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E F1 +(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F0(\(1\),).68 E F1(db_deadloc)2.5 E +(k)-.2 E F0(\(1\),).67 E F1(db_dump)2.5 E F0(\(1\),).19 E F1(db_load)2.5 +E F0(\(1\),).77 E F1(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F1 +(db_stat)2.5 E F0(\(1\),).68 E F1(db_intr)108 300 Q(o)-.45 E F0(\(3\),) +.18 E F1(db_appinit)2.5 E F0(\(3\),).68 E F1(db_cur)2.5 E(sor)-.1 E F0 +(\(3\),).73 E F1(db_dbm)2.5 E F0(\(3\),).32 E F1(db_internal)2.5 E F0 +(\(3\),).51 E F1(db_loc)2.5 E(k)-.2 E F0(\(3\),).67 E F1(db_lo)2.5 E(g) +-.1 E F0(\(3\),).22 E F1(db_mpool)2.5 E F0(\(3\),).51 E F1(db_open)108 +312 Q F0(\(3\),).24 E F1(db_thr)2.5 E(ead)-.37 E F0(\(3\),).77 E F1 +(db_txn)2.5 E F0(\(3\)).24 E(April 10, 1998)276.695 768 Q(2)199.695 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/man.ps/db_internal.ps b/mozilla/db/man/man.ps/db_internal.ps new file mode 100644 index 00000000000..7305ed4815f --- /dev/null +++ b/mozilla/db/man/man.ps/db_internal.ps @@ -0,0 +1,618 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:21 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 6 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_jump_set, db_v)108 40.8 Q +(alue_set \255 replace underlying DB functionality)-.25 E F0(SYNOPSIS)72 +57.6 Q/F2 10/Times-Bold@0 SF(#include )-.4 E(int)108 +93.6 Q(db_jump_set\(v)108 105.6 Q(oid *func, int which\);)-.1 E(int)108 +129.6 Q(db_v)108 141.6 Q(alue_set\(int v)-.1 E(alue, int which\);)-.1 E +F0(DESCRIPTION)72 158.4 Q F1 .486(The DB library is a f)108 170.4 R .485 +(amily of groups of functions that pro)-.1 F .485 +(vides a modular programming interf)-.15 F .485(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 182.4 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .507(\214le page caching, as well as v)108 194.4 R .507 +(arious inde)-.25 F -.15(xe)-.15 G 3.007(da).15 G .506(ccess methods.) +-3.007 F(Man)5.506 E 3.006(yo)-.15 G 3.006(ft)-3.006 G .506 +(he functional groups \(e.g., the \214le)-3.006 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 206.4 R .122(are e)108 218.4 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.121 G 2.621(rag).15 G .121(eneral description of)-2.621 +F(the DB package, see)108 230.4 Q/F3 10/Times-Italic@0 SF(db_intr)2.5 E +(o)-.45 E F1(\(3\).).18 E .904(This manual page describes interf)108 +247.2 R .904 +(aces to tune or replace underlying system functionality used by the DB) +-.1 F(library)108 259.2 Q 5(.F)-.65 G .5 -.25(ew a)-5 H +(pplications should ha).25 E .3 -.15(ve a)-.2 H .3 -.15(ny n).15 H +(eed for these interf).15 E(aces.)-.1 E F3(db_jump_set)92 276 Q F1(The) +108 288 Q F3(db_jump_set)2.904 E F1 .403(function enables applications to replace underlying DB library functionality by replacing) +2.904 F .02(entries in a function call jump table.)108 300 R(The)5.02 E +F3(whic)2.52 E(h)-.15 E F1(ar)2.52 E .02 +(gument speci\214es the entry to be replaced by the ar)-.18 F(gument) +-.18 E F3(func)108 312 Q F1(.).31 E(The follo)108 328.8 Q(wing v)-.25 E +(alues of)-.25 E F3(whic)2.5 E(h)-.15 E F1(are supported:)2.5 E +(DB_FUNC_CLOSE)108 345.6 Q .085 +(Replace all DB calls to the IEEE Std 1003.1b-1993 \(`)133 357.6 R +(`POSIX')-.74 E('\))-.74 E F3(close)2.585 E F1 .084(function with)2.584 +F F3(func)2.584 E F1 2.584(,w).31 G .084(hich must)-2.584 F +(conform to the standard interf)133 369.6 Q(ace.)-.1 E(DB_FUNC_DIRFREE) +108 386.4 Q .278(The DB library requires the ability to return an)133 +398.4 R 2.778(ym)-.15 G .278 +(emory allocated as part of the routine which reads)-2.778 F 6.338(through a directory and creates a list of \214les that that the directory contains \(see) +133 410.4 R 2.5(DB_FUNC_DIRLIST\). The)133 422.4 R F3(func)2.5 E F1(ar) +2.5 E(gument must conform to the follo)-.18 E(wing interf)-.25 E(ace:) +-.1 E(int dirfree\(char **namesp, int cnt\);)183 446.4 Q(The)133 470.4 Q +F3(namesp)3.592 E F1(and)3.592 E F3(cnt)3.592 E F1(ar)3.592 E 1.092 +(guments are the same v)-.18 F 1.092 +(alues as were returned by the DB_FUNC_DIRLIST)-.25 F(function.)133 +482.4 Q(The)133 506.4 Q F3(dirfr)2.5 E(ee)-.37 E F1 +(function returns the v)2.5 E(alue of)-.25 E F3(errno)2.5 E F1(on f)2.5 +E(ailure and 0 on success.)-.1 E(DB_FUNC_DIRLIST)108 523.2 Q .767(The DB library requires the ability to read through a directory and create a list of \214les that that the) +133 535.2 R(directory contains.)133 547.2 Q(The)5 E F3(func)2.5 E F1(ar) +2.5 E(gument must conform to the follo)-.18 E(wing interf)-.25 E(ace:) +-.1 E(int dirlist\(const char *dir)183 571.2 Q(,)-.4 E +(char ***namesp, int *cntp\);)213 583.2 Q(The)133 607.2 Q F3(dir)3.057 E +F1(ar)3.057 E .557(gument is the name of the directory to be searched.) +-.18 F .558(The function must return a pointer to)5.557 F 1.121(an array of nul-terminated \214le names in the memory location referenced by the ar) +133 619.2 R(gument)-.18 E F3(namesp)3.62 E F1(,).19 E(and a count of the number of elements in the array in the memory location referenced by) +133 631.2 Q F3(cntp)2.5 E F1(.).19 E(The)133 655.2 Q F3(dirlist)2.5 E F1 +(function returns the v)2.5 E(alue of)-.25 E F3(errno)2.5 E F1(on f)2.5 +E(ailure and 0 on success.)-.1 E(DB_FUNC_EXISTS)108 672 Q .836 +(The DB library requires the ability to determine if a \214le e)133 684 +R .836(xists, and optionally)-.15 F 3.336(,i)-.65 G 3.336(fi)-3.336 G +3.336(ti)-3.336 G 3.336(sa\214)-3.336 G .836(le of type)-3.336 F +(directory)133 696 Q 5(.T)-.65 G(he)-5 E F3(func)2.5 E F1(ar)2.5 E +(gument must conform to the follo)-.18 E(wing interf)-.25 E(ace:)-.1 E +(int e)183 720 Q(xists\(const char *path, int *isdirp\);)-.15 E(1)535 +768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 353.28(DB_JUMP\(3\) DB_JUMP\(3\))72 48 R(The)133 +84 Q/F1 10/Times-Italic@0 SF(path)2.5 E F0(ar)2.5 E +(gument is the pathname of the \214le to be check)-.18 E(ed.)-.1 E .256 +(If the)133 108 R F1(isdirp)2.756 E F0(ar)2.756 E .256 +(gument is non-NULL, it must be set to non-0 if)-.18 F F1(path)2.756 E +F0 .256(is a directory)2.756 F 2.756(,a)-.65 G .256(nd 0 if)-2.756 F F1 +(path)2.756 E F0 .255(is not)2.755 F 2.5(ad)133 120 S(irectory)-2.5 E(.) +-.65 E(The)133 144 Q F1 -.2(ex)2.5 G(ists).2 E F0 +(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E(DB_FUNC_FREE)108 160.8 Q 1.608 +(Replace all DB calls to the ANSI C X3.159-1989 \(`)133 172.8 R -.8(`A) +-.74 G 1.608(NSI C').8 F 1.608('\) standard)-.74 F F1(fr)4.108 E(ee)-.37 +E F0 1.608(function with)4.108 F F1(func)4.108 E F0(,).31 E +(which must conform to the standard interf)133 184.8 Q(ace.)-.1 E +(DB_FUNC_FSYNC)108 201.6 Q .085 +(Replace all DB calls to the IEEE Std 1003.1b-1993 \(`)133 213.6 R +(`POSIX')-.74 E('\))-.74 E F1(fsync)2.585 E F0 .084(function with)2.584 +F F1(func)2.584 E F0 2.584(,w).31 G .084(hich must)-2.584 F +(conform to the standard interf)133 225.6 Q(ace.)-.1 E(DB_FUNC_IOINFO) +108 242.4 Q .858(The DB library requires the ability to determine the size and I/O characteristics of a \214le.) +133 254.4 R(The)5.858 E F1(func)3.358 E F0(ar)133 266.4 Q +(gument must conform to the follo)-.18 E(wing interf)-.25 E(ace:)-.1 E +(int ioinfo\(const char *path, int fd,)183 290.4 Q +(u_int32_t *mbytesp, u_int32_t *bytesp,)213 302.4 Q +(u_int32_t *iosizep\);)213 314.4 Q(The)133 338.4 Q F1(path)3.803 E F0 +(ar)3.803 E 1.302(gument is the pathname of the \214le to be check)-.18 +F 1.302(ed, and the)-.1 F F1(fd)3.802 E F0(ar)3.802 E 1.302 +(gument is an open \214le)-.18 F(descriptor on the \214le.)133 350.4 Q +.4(If the)133 374.4 R F1(mbytesp)2.9 E F0(and)2.9 E F1(bytesp)2.9 E F0 +(ar)2.9 E .401(guments are non-NULL, the)-.18 F F1(ioinfo)2.901 E F0 +.401(function must return in them the size)2.901 F .673 +(of the \214le: the number of me)133 386.4 R -.05(ga)-.15 G .672 +(bytes in the \214le into the memory location referenced by the).05 F F1 +(mbytesp)3.172 E F0(ar)133 398.4 Q .451 +(gument, and the number of bytes o)-.18 F -.15(ve)-.15 G 2.951(ra).15 G +.451(nd abo)-2.951 F .751 -.15(ve t)-.15 H .451(hat number of me).15 F +-.05(ga)-.15 G .452(bytes into the memory loca-).05 F +(tion referenced by the)133 410.4 Q F1(bytesp)2.5 E F0(ar)2.5 E(gument.) +-.18 E .092(In addition, if the)133 434.4 R F1(iosizep)2.592 E F0(ar) +2.592 E .091(gument is non-NULL, the)-.18 F F1(ioinfo)2.591 E F0 .091 +(function must return the optimum granu-)2.591 F(larity for I/O operations to the \214le in the memory location referenced by it.) +133 446.4 Q(The)133 470.4 Q F1(ioinfo)2.5 E F0(function returns the v) +2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 E +(ailure and 0 on success.)-.1 E(DB_FUNC_MALLOC)108 487.2 Q .805 +(Replace all DB calls to the ANSI C X3.159-1989 \(`)133 499.2 R -.8(`A) +-.74 G .805(NSI C').8 F .806('\) standard)-.74 F F1(malloc)3.306 E F0 +.806(function with)3.306 F F1(func)3.306 E F0(,).31 E +(which must conform to the standard interf)133 511.2 Q(ace.)-.1 E +(DB_FUNC_MAP)108 528 Q .735(The DB library requires the ability to map a \214le into memory and to create shared memory re) +133 540 R(gions)-.15 E .278(\(which may or may not be back)133 552 R +.278(ed by \214les\).)-.1 F(The)5.278 E F1(func)2.778 E F0(ar)2.778 E +.279(gument must conform to the follo)-.18 F .279(wing inter)-.25 F(-) +-.2 E -.1(fa)133 564 S(ce:).1 E +(int map\(char *path, int fd, size_t len,)183 588 Q(int is_re)213 600 Q +(gion, int is_anon)-.15 E(ymous, int is_rdonly)-.15 E(,)-.65 E -.2(vo) +213 612 S(id **addr\);).2 E(The)133 636 Q F1(path)2.5 E F0(ar)2.5 E +(gument is the name of a \214le.)-.18 E(The)5 E F1(fd)2.5 E F0(ar)2.5 E +(gument is an open \214le descriptor on that \214le.)-.18 E(The)133 660 +Q F1(is_r)2.634 E -.4(eg)-.37 G(ion).4 E F0(ar)2.634 E .133(gument will be zero if the intention is to map a \214le into shared memory) +-.18 F 5.133(.I)-.65 G 2.633(nt)-5.133 G .133(his case,)-2.633 F(the)133 +672 Q F1(map)3.849 E F0 1.349(function must map the \214rst)3.849 F F1 +(len)3.849 E F0 1.35 +(bytes of the \214le into memory and return a pointer to the)3.849 F +2.946(mapped location in the memory location referenced by the ar)133 +684 R(gument)-.18 E F1(addr)5.446 E F0 7.945(.I).73 G 5.445(nt)-7.945 G +2.945(his case, the)-5.445 F F1(is_anonymous)133 696 Q F0(ar)3.236 E +.736(gument will al)-.18 F -.1(wa)-.1 G .736(ys be zero.).1 F(The)5.736 +E F1(is_r)3.236 E(donly)-.37 E F0(ar)3.236 E .736 +(gument will be non-zero if the \214le is)-.18 F +(considered read-only by the caller)133 708 Q(.)-.55 E(March 22, 1998) +274.2 768 Q(2)197.2 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 353.28(DB_JUMP\(3\) DB_JUMP\(3\))72 48 R(The)133 +84 Q/F1 10/Times-Italic@0 SF(is_r)3.282 E -.4(eg)-.37 G(ion).4 E F0(ar) +3.282 E .782(gument will be non-zero if the memory is intended to be used as a shared memory) +-.18 F(re)133 96 Q .257 +(gion for synchronization between DB threads/processes.)-.15 F .258 +(In this case, the returned memory may be)5.258 F .384(of an)133 108 R +2.884(yk)-.15 G .384(ind \(e.g., anon)-2.884 F .384(ymous\), b)-.15 F +.384(ut must be able to support semaphores.)-.2 F .383 +(If the application has pre)5.384 F(vi-)-.25 E .52 +(ously speci\214ed that re)133 120 R .52 +(gions are to be instantiated in anon)-.15 F .52 +(ymous memory \(see DB_REGION_ANON)-.15 F(belo)133 132 Q 1.339 +(w\), or the re)-.25 F 1.339(gion is being joined and is belie)-.15 F +-.15(ve)-.25 G 3.839(dt).15 G 3.839(oh)-3.839 G -2.25 -.2(av e)-3.839 H +1.338(been allocated in anon)4.039 F 1.338(ymous shared)-.15 F(memory) +133 144 Q 2.763(,t)-.65 G(he)-2.763 E F1(is_anonymous)2.763 E F0(ar) +2.763 E .263(gument will be non-zero.)-.18 F(Additionally)5.263 E 2.763 +(,t)-.65 G(he)-2.763 E F1(path)2.763 E F0(and)2.763 E F1(fd)2.763 E F0 +(ar)2.763 E .264(guments may)-.18 F .945(be ignored \(although future) +133 156 R F1(map)3.445 E F0 .944(calls using the same)3.445 F F1(path) +3.444 E F0 .944(must return the same memory\), and the)3.444 F F1(is_r) +133 168 Q(donly)-.37 E F0(ar)2.5 E(gument will al)-.18 E -.1(wa)-.1 G +(ys be zero.).1 E 2.064(By def)133 192 R 2.064(ault, on UNIX systems, the DB library will use the IEEE Std 1003.1b-1993 \(`) +-.1 F(`POSIX')-.74 E('\))-.74 E F1(mmap)133 204 Q F0 .621(\(2\) interf) +.19 F .621(ace to both map re)-.1 F .621 +(gular \214les into shared memory and create shared memory re)-.15 F +(gions.)-.15 E 1.1(If the application speci\214es that shared memory re) +133 216 R 1.1(gions be instantiated in anon)-.15 F 1.1 +(ymous memory \(see)-.15 F .764(DB_REGION_ANON belo)133 228 R .764 +(w\), the)-.25 F F1(shmg)3.264 E(et)-.1 E F0 .764 +(\(2\) shared memory se).68 F .764(gment interf)-.15 F .763 +(ace will be used, where)-.1 F -.2(av)133 240 S .121 +(ailable, and the MAP_ANON or MAP_ANONYMOUS options to)-.05 F F1(mmap) +2.621 E F0 .121(\(2\) when).19 F F1(shmg)2.621 E(et)-.1 E F0 .121 +(\(2\) is not).68 F -.2(av)133 252 S(ailable.)-.05 E 1.73(When using)133 +276 R F1(shmg)4.23 E(et)-.1 E F0 1.729(\(2\), shared memory re).68 F +1.729(gions are named, and so multiple processes may share)-.15 F 5.287 +(them. When)133 288 R 2.787(using the)5.287 F F1(mmap)5.287 E F0 2.787 +(MAP_ANON or MAP_ANONYMOUS options, shared memory)5.287 F(re)133 300 Q +(gions are)-.15 E/F2 10/Times-Bold@0 SF(not)2.5 E F0(named, and so may only be accessed by a single process and its threads.) +2.5 E(HP/UX note:)133 328.8 Q(The)158 340.8 Q F1(shmg)2.793 E(et)-.1 E +F0 .293(\(2\) interf).68 F .293(aces are not used on HP/UX, e)-.1 F -.15 +(ve)-.25 G 2.793(nt).15 G .293(hough the)-2.793 F 2.793(ye)-.15 G .293 +(xist, as anon)-2.943 F .292(ymous mem-)-.15 F(ory allocated using)158 +352.8 Q F1(shmg)2.5 E(et)-.1 E F0 +(\(2\) cannot be used to store semaphores.).68 E(The)108 376.8 Q F1(map) +2.5 E F0(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0 +(on f)2.5 E(ailure and 0 on success.)-.1 E(DB_FUNC_OPEN)108 393.6 Q .158 +(Replace all DB calls to the IEEE Std 1003.1b-1993 \(`)133 405.6 R +(`POSIX')-.74 E('\))-.74 E F1(open)2.659 E F0 .159(function with)2.659 F +F1(func)2.659 E F0 2.659(,w).31 G .159(hich must)-2.659 F +(conform to the standard interf)133 417.6 Q(ace.)-.1 E(DB_FUNC_READ)108 +434.4 Q .258(Replace all DB calls to the IEEE Std 1003.1b-1993 \(`)133 +446.4 R(`POSIX')-.74 E('\))-.74 E F1 -.37(re)2.757 G(ad).37 E F0 .257 +(function with)2.757 F F1(func)2.757 E F0 2.757(,w).31 G .257(hich must) +-2.757 F(conform to the standard interf)133 458.4 Q(ace.)-.1 E +(DB_FUNC_REALLOC)108 475.2 Q .756 +(Replace all DB calls to the ANSI C X3.159-1989 \(`)133 487.2 R -.8(`A) +-.74 G .756(NSI C').8 F .756('\) standard)-.74 F F1 -.37(re)3.256 G +(alloc).37 E F0 .756(function with)3.256 F F1(func)3.256 E F0(,).31 E +(which must conform to the standard interf)133 499.2 Q(ace.)-.1 E +(DB_FUNC_R)108 516 Q(UNLINK)-.4 E .983 +(The DB library requires the ability to remo)133 528 R 1.283 -.15(ve s) +-.15 H .983(hared memory re).15 F .982 +(gions from the system, whether or)-.15 F(not the)133 540 Q 2.5(ya)-.15 +G(re back)-2.5 E(ed by re)-.1 E(gular \214les.)-.15 E(The)5 E F1(func) +2.5 E F0(ar)2.5 E(gument must conform to the follo)-.18 E(wing interf) +-.25 E(ace:)-.1 E(int runlink\(char *path\);)183 564 Q(The)133 588 Q F1 +(path)2.999 E F0(ar)2.999 E .499(gument is the path ar)-.18 F .499 +(gument speci\214ed to the DB_FUNC_MAP function when the re)-.18 F(gion) +-.15 E -.1(wa)133 600 S 2.5(sm).1 G(apped into memory)-2.5 E(.)-.65 E +(The)133 624 Q F1(runlink)2.5 E F0(function returns the v)2.5 E(alue of) +-.25 E F1(errno)2.5 E F0(on f)2.5 E(ailure and 0 on success.)-.1 E +(DB_FUNC_SEEK)108 640.8 Q .241(The DB library requires the ability to specify that a subsequent read from or write to a \214le will occur) +133 652.8 R(at a speci\214c location in that \214le.)133 664.8 Q(The)5 E +F1(func)2.5 E F0(ar)2.5 E(gument must conform to the follo)-.18 E +(wing interf)-.25 E(ace:)-.1 E +(int seek\(int fd, size_t pgsize, db_pgno_t pageno,)183 688.8 Q +(u_int32_t relati)213 700.8 Q -.15(ve)-.25 G 2.5(,i).15 G(nt re)-2.5 E +(wind, int whence\);)-.25 E(The)133 724.8 Q F1(fd)3.595 E F0(ar)3.595 E +1.096(gument is an open \214le descriptor on the \214le.)-.18 F(The) +6.096 E F1(seek)3.596 E F0 1.096(function must cause a subsequent)3.596 +F(March 22, 1998)274.2 768 Q(3)197.2 E EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 353.28(DB_JUMP\(3\) DB_JUMP\(3\))72 48 R +(read from or write to the \214le to occur at a byte of)133 84 Q +(fset speci\214ed by the calculation:)-.25 E +(\(pgsize * pageno\) + relati)183 108 Q -.15(ve)-.25 G(If)133 132 Q/F1 +10/Times-Italic@0 SF -1.91 -.37(re w)2.5 H(ind).37 E F0 +(is non-zero, the byte of)2.5 E(fset is treated as a backw)-.25 E +(ards seek, not a forw)-.1 E(ards one.)-.1 E(The)133 156 Q F1(whence) +3.815 E F0(ar)3.815 E 1.315 +(gument speci\214es where in the \214le the byte of)-.18 F 1.315 +(fset is relati)-.25 F 1.614 -.15(ve t)-.25 H 1.314 +(o, as described by the).15 F(IEEE Std 1003.1b-1993 \(`)133 168 Q +(`POSIX')-.74 E('\))-.74 E F1(lseek)2.5 E F0(system call.)2.5 E(The)133 +192 Q F1(seek)2.5 E F0(function returns the v)2.5 E(alue of)-.25 E F1 +(errno)2.5 E F0(on f)2.5 E(ailure and 0 on success.)-.1 E(DB_FUNC_SLEEP) +108 208.8 Q 1.087(The DB library requires the ability to cause a process to suspend itself for a period of time, relin-) +133 220.8 R 1.258(quishing control of the processor to an)133 232.8 R +3.758(yo)-.15 G 1.258(ther w)-3.758 F 1.258(aiting thread of control.) +-.1 F(The)6.258 E F1(func)3.758 E F0(ar)3.758 E 1.258(gument must)-.18 F +(conform to the follo)133 244.8 Q(wing interf)-.25 E(ace:)-.1 E +(int sleep\(u_long seconds, u_long microseconds\);)183 268.8 Q(The)133 +292.8 Q F1(seconds)3.69 E F0(and)3.69 E F1(micr)3.69 E(oseconds)-.45 E +F0(ar)3.69 E 1.19(guments specify the amount of time to w)-.18 F 1.19 +(ait until the suspending)-.1 F(thread of control should run ag)133 +304.8 Q(ain.)-.05 E(The)133 328.8 Q F1(seconds)3.15 E F0(and)3.15 E F1 +(micr)3.15 E(oseconds)-.45 E F0(ar)3.15 E .649 +(guments may not be normalized when the)-.18 F F1(sleep)3.149 E F0 .649 +(function is called,)3.149 F(i.e., the)133 340.8 Q F1(micr)2.5 E +(oseconds)-.45 E F0(ar)2.5 E(gument may be greater than 1000000.)-.18 E +(The)133 364.8 Q F1(sleep)2.5 E F0(function returns the v)2.5 E(alue of) +-.25 E F1(errno)2.5 E F0(on f)2.5 E(ailure and 0 on success.)-.1 E +(DB_FUNC_UNLINK)108 381.6 Q 1.341 +(Replace all DB calls to the IEEE Std 1003.1b-1993 \(`)133 393.6 R +(`POSIX')-.74 E('\))-.74 E F1(unlink)3.841 E F0 1.341(function with) +3.841 F F1(func)3.841 E F0 3.841(,w).31 G(hich)-3.841 E +(must conform to the standard interf)133 405.6 Q(ace.)-.1 E +(DB_FUNC_UNMAP)108 422.4 Q .185(The DB library requires the ability to unmap a \214le or shared memory re) +133 434.4 R .184(gion from memory)-.15 F 5.184(.T)-.65 G(he)-5.184 E F1 +(func)2.684 E F0(ar)133 446.4 Q(gument must conform to the follo)-.18 E +(wing interf)-.25 E(ace:)-.1 E(int unmap\(v)183 470.4 Q(oid *addr)-.2 E +2.5(,s)-.4 G(ize_t len\);)-2.5 E(The)133 494.4 Q F1(addr)4.457 E F0(ar) +4.457 E 1.957(gument is the ar)-.18 F 1.957 +(gument returned by the DB_FUNC_MAP function when the \214le or)-.18 F +(re)133 506.4 Q .686(gion w)-.15 F .686(as mapped into memory)-.1 F +3.186(,a)-.65 G .685(nd the)-3.186 F F1(len)3.185 E F0(ar)3.185 E .685 +(gument is the same as the)-.18 F F1(len)3.185 E F0(ar)3.185 E .685 +(gument speci\214ed to)-.18 F +(the DB_FUNC_MAP function when the \214le or re)133 518.4 Q(gion w)-.15 +E(as mapped into memory)-.1 E(.)-.65 E(The)133 542.4 Q F1(unmap)2.5 E F0 +(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E(DB_FUNC_WRITE)108 559.2 Q .084 +(Replace all DB calls to the IEEE Std 1003.1b-1993 \(`)133 571.2 R +(`POSIX')-.74 E('\))-.74 E F1(write)2.584 E F0 .084(function with)2.584 +F F1(func)2.584 E F0 2.584(,w).31 G .084(hich must)-2.584 F +(conform to the standard interf)133 583.2 Q(ace.)-.1 E(DB_FUNC_YIELD)108 +600 Q .964(The DB library requires the ability to yield the processor from the current thread of control to an) +133 612 R(y)-.15 E(other w)133 624 Q(aiting threads of control.)-.1 E +(The)5 E F1(func)2.5 E F0(ar)2.5 E(gument must conform to the follo)-.18 +E(wing interf)-.25 E(ace:)-.1 E(int yield\(v)183 648 Q(oid\);)-.2 E(The) +133 684 Q F1(yield)2.966 E F0 .467(function must be able to cause the rescheduling all participants in the current DB en) +2.966 F(viron-)-.4 E .749(ment, whether threaded or not.)133 696 R .748 +(It may be incorrect to supply a thread)5.749 F F1(yield)3.248 E F0 .748 +(function if more than a)3.248 F .383 +(single process is operating in the DB en)133 708 R 2.884 +(vironment. This)-.4 F .384(is because man)2.884 F 2.884(yt)-.15 G .384 +(hread-yield functions will)-2.884 F 1.558(not allo)133 720 R 4.058(wo) +-.25 G 1.558(ther processes to run, and the contested lock may be held by another process, not by) +-4.058 F(March 22, 1998)274.2 768 Q(4)197.2 E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 353.28(DB_JUMP\(3\) DB_JUMP\(3\))72 48 R +(another thread.)133 84 Q .353(If no)133 108 R/F1 10/Times-Italic@0 SF +(yield)2.853 E F0 .353(function is speci\214ed, or if the)2.853 F F1 +(yield)2.853 E F0 .353(function returns an error)2.853 F 2.854(,t)-.4 G +.354(he function speci\214ed by the)-2.854 F .647 +(DB_FUNC_SLEEP entry will be used instead or subsequently)133 120 R +3.147(,i)-.65 G .647(.e., if no)-3.147 F F1(yield)3.147 E F0 .647 +(function is speci\214ed,)3.147 F .382(or it is possible for the)133 132 +R F1(yield)2.883 E F0 .383(function to f)2.883 F .383(ail, the)-.1 F F1 +(sleep)2.883 E F0(function)2.883 E/F2 10/Times-Bold@0 SF(must)2.883 E F0 +.383(cause the processor to resched-)2.883 F(ule an)133 144 Q 2.5(yw) +-.15 G(aiting threads of control for e)-2.6 E -.15(xe)-.15 G(cution.).15 +E(The)133 168 Q F1(yield)2.5 E F0(function returns the v)2.5 E(alue of) +-.25 E F1(errno)2.5 E F0(on f)2.5 E(ailure and 0 on success.)-.1 E(The) +108 184.8 Q F1(db_jump_set)2.5 E F0(function returns the v)2.5 E +(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 E(ailure and 0 on success.) +-.1 E F1(db_value_set)92 201.6 Q F0(The)108 213.6 Q F1(db_value_set) +3.062 E F0 .562(function enables applications to specify underlying DB library functionality) +3.062 F 5.561(.T)-.65 G(he)-5.561 E F1(whic)3.061 E(h)-.15 E F0(ar)108 +225.6 Q(gument speci\214es the information being set by the ar)-.18 E +(gument)-.18 E F1(value)2.5 E F0(.).18 E(The follo)108 242.4 Q(wing v) +-.25 E(alues of)-.25 E F1(whic)2.5 E(h)-.15 E F0(are supported:)2.5 E +(DB_MUTEXLOCKS)108 259.2 Q .68(Grant all requested mutual e)133 271.2 R +.681(xclusion mute)-.15 F -.15(xe)-.15 G 3.181(sw).15 G .681 +(ithout testing for their a)-3.181 F -.25(va)-.2 G(ilability).25 E 5.681 +(.T)-.65 G .681(his \215ag should)-5.681 F(ne)133 283.2 Q -.15(ve)-.25 G +2.5(rb).15 G 2.5(eu)-2.5 G(sed for an)-2.5 E 2.5(yo)-.15 G +(ther purpose than deb)-2.5 E(ugging.)-.2 E(DB_REGION_ANON)108 300 Q +(Setting)133 312 Q F1(value)3.499 E F0 .998(to a non-zero v)3.499 F .998 +(alue speci\214es that shared memory re)-.25 F .998 +(gions are to be created in anon)-.15 F(y-)-.15 E 6.434(mous memory)133 +324 R 8.934(,a)-.65 G 6.434(nd not back)-8.934 F 6.435(ed by a re)-.1 F +6.435(gular \214le.)-.15 F(DB_REGION_N)11.435 E 6.435(AME dif)-.35 F +6.435(fers from)-.25 F .044(DB_REGION_ANON in that the former will f)133 +336 R .043(ail if the shared memory re)-.1 F .043 +(gions cannot be named, that)-.15 F +(is, if multiple processes cannot use them.)133 348 Q +(See DB_FUNC_MAP for more information.)5 E(DB_REGION_INIT)108 364.8 Q +1.808(In some applications, the e)133 376.8 R 1.808(xpense of page-f) +-.15 F 1.809(aulting the shared memory re)-.1 F 1.809(gions can af)-.15 +F 1.809(fect perfor)-.25 F(-)-.2 E 1.267(mance, e.g., when the page-f) +133 388.8 R 1.267 +(ault occurs while holding a lock, other lock requests can con)-.1 F +-2.2 -.2(vo y)-.4 H(and)3.966 E -.15(ove)133 400.8 S .972 +(rall throughput may decrease.).15 F(Setting)5.972 E F1(value)3.472 E F0 +.972(to a non-zero v)3.472 F .972 +(alue speci\214es that one byte be read)-.25 F +(from each 4K page of the shared memory re)133 412.8 Q(gion when the re) +-.15 E(gion is initialized.)-.15 E(DB_REGION_N)108 429.6 Q(AME)-.35 E +(Setting)133 441.6 Q F1(value)3.499 E F0 .998(to a non-zero v)3.499 F +.998(alue speci\214es that shared memory re)-.25 F .998 +(gions are to be created in anon)-.15 F(y-)-.15 E 6.434(mous memory)133 +453.6 R 8.934(,a)-.65 G 6.434(nd not back)-8.934 F 6.435(ed by a re)-.1 +F 6.435(gular \214le.)-.15 F(DB_REGION_N)11.435 E 6.435(AME dif)-.35 F +6.435(fers from)-.25 F .044(DB_REGION_ANON in that the former will f)133 +465.6 R .043(ail if the shared memory re)-.1 F .043 +(gions cannot be named, that)-.15 F +(is, if multiple processes cannot use them.)133 477.6 Q +(See DB_FUNC_MAP for more information.)5 E(DB_TSL_SPINS)108 494.4 Q +(Specify the number of times mute)133 506.4 Q -.15(xe)-.15 G 2.5(ss).15 +G(hould spin without blocking.)-2.5 E .385(This v)133 530.4 R .385 +(alue def)-.25 F .385(aults to 1 on uniprocessor systems and to 50 times the number of processors on multi-) +-.1 F(processor systems.)133 542.4 Q(The)108 559.2 Q F1(db_value_set)2.5 +E F0(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f) +2.5 E(ailure and 0 on success.)-.1 E/F3 9/Times-Bold@0 SF(ERR)72 576 Q +(ORS)-.27 E F0(The)108 588 Q F1(db_jump_set)2.5 E F0(function may f)2.5 +E(ail and return)-.1 E F1(errno)2.5 E F0(for the follo)2.5 E +(wing conditions:)-.25 E([EINV)108 604.8 Q(AL])-1.35 E(An in)133 616.8 Q +-.25(va)-.4 G(lid \215ag v).25 E(alue or parameter w)-.25 E +(as speci\214ed.)-.1 E F3 -.09(BU)72 633.6 S(GS).09 E F0 .928 +(No type checking is done of the)108 645.6 R F1(func)3.428 E F0(ar)3.428 +E .928(gument, and specifying an in)-.18 F -.25(va)-.4 G .928 +(lid replacement routine will cause).25 F(unpredictable results.)108 +657.6 Q 1.38(Applications should be careful to replace related functions as a group and at the same time.) +108 674.4 R(Replacing)6.38 E 3.414 +(DB_FUNC_MALLOC without replacing DB_FUNC_REALLOC is lik)108 686.4 R +3.413(ely to result in unpredictable)-.1 F(results.)108 698.4 Q .814 +(On W)108 715.2 R(indo)-.4 E .814(ws/95, \214les that are opened by multiple processes do not share data correctly) +-.25 F 5.815(.T)-.65 G 3.315(ot)-6.615 G .815(ell Berk)-3.315 F(ele)-.1 +E(y)-.15 E(DB to use a named re)108 727.2 Q +(gion of the paging \214le to share memory instead, use:)-.15 E +(March 22, 1998)274.2 768 Q(5)197.2 E EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 353.28(DB_JUMP\(3\) DB_JUMP\(3\))72 48 R(db_v) +144 84 Q(alue_set\(1, DB_REGION_N)-.25 E(AME\);)-.35 E -1.1(Yo)108 100.8 +S 3.471(ud)1.1 G 3.471(on)-3.471 G .97(ot need to do this if your application can guarantee that only one process will be accessing DB) +-3.471 F(\214les.)108 112.8 Q .124(On W)108 129.6 R(indo)-.4 E(ws/NT) +-.25 E 2.624(,s)-.74 G .124 +(haring of data between processes through the paging \214le does not w) +-2.624 F .125(ork correctly)-.1 F 2.625(,s)-.65 G 2.625(oy)-2.625 G(ou) +-2.625 E(should not call)108 141.6 Q/F1 10/Times-Italic@0 SF +(db_value_set)2.5 E F0 5(.T).68 G(hat will allo)-5 E 2.5(wD)-.25 G 2.5 +(Bt)-2.5 G 2.5(ou)-2.5 G(se the \214le itself for sharing, which w)-2.5 +E(orks correctly)-.1 E(.)-.65 E/F2 9/Times-Bold@0 SF(SEE ALSO)72 158.4 Q +F1(db_ar)108 170.4 Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E F1(db_c) +2.5 E(hec)-.15 E(kpoint)-.2 E F0(\(1\),).68 E F1(db_deadloc)2.5 E(k)-.2 +E F0(\(1\),).67 E F1(db_dump)2.5 E F0(\(1\),).19 E F1(db_load)2.5 E F0 +(\(1\),).77 E F1(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F1 +(db_stat)2.5 E F0(\(1\),).68 E F1(db_intr)108 182.4 Q(o)-.45 E F0 +(\(3\),).18 E F1(db_appinit)2.5 E F0(\(3\),).68 E F1(db_cur)2.5 E(sor) +-.1 E F0(\(3\),).73 E F1(db_dbm)2.5 E F0(\(3\),).32 E F1(db_internal)2.5 +E F0(\(3\),).51 E F1(db_loc)2.5 E(k)-.2 E F0(\(3\),).67 E F1(db_lo)2.5 E +(g)-.1 E F0(\(3\),).22 E F1(db_mpool)2.5 E F0(\(3\),).51 E F1(db_open) +108 194.4 Q F0(\(3\),).24 E F1(db_thr)2.5 E(ead)-.37 E F0(\(3\),).77 E +F1(db_txn)2.5 E F0(\(3\)).24 E(March 22, 1998)274.2 768 Q(6)197.2 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/man.ps/db_intro.ps b/mozilla/db/man/man.ps/db_intro.ps new file mode 100644 index 00000000000..e6f3e66daaa --- /dev/null +++ b/mozilla/db/man/man.ps/db_intro.ps @@ -0,0 +1,788 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:21 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 6 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db \255 the DB library o)108 40.8 Q -.15(ve)-.15 G(rvie).15 E 2.5(wa) +-.25 G(nd introduction)-2.5 E F0(DESCRIPTION)72 57.6 Q F1 .486 +(The DB library is a f)108 69.6 R .485 +(amily of groups of functions that pro)-.1 F .485 +(vides a modular programming interf)-.15 F .485(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 81.6 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .507(\214le page caching, as well as v)108 93.6 R .507 +(arious inde)-.25 F -.15(xe)-.15 G 3.007(da).15 G .506(ccess methods.) +-3.007 F(Man)5.506 E 3.006(yo)-.15 G 3.006(ft)-3.006 G .506 +(he functional groups \(e.g., the \214le)-3.006 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 105.6 R .122(are e)108 117.6 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.121 G 2.621(rag).15 G .121(eneral description of)-2.621 +F(the DB package, see)108 129.6 Q/F2 10/Times-Italic@0 SF(db_intr)2.5 E +(o)-.45 E F1(\(3\).).18 E .045(The DB library does not pro)108 146.4 R +.045(vide user interf)-.15 F .046(aces, data entry GUI')-.1 F .046 +(s, SQL support or an)-.55 F 2.546(yo)-.15 G 2.546(ft)-2.546 G .046 +(he other standard)-2.546 F(user)108 158.4 Q(-le)-.2 E -.15(ve)-.25 G +2.633(ld).15 G .133(atabase interf)-2.633 F 2.633(aces. What)-.1 F .133 +(it does pro)2.633 F .133(vide are the programmatic b)-.15 F .132 +(uilding blocks that allo)-.2 F 2.632(wy)-.25 G .132(ou to)-2.632 F(easily embed database-style functionality and support into other objects or interf) +108 170.4 Q(aces.)-.1 E F0(ARCHITECTURE)72 187.2 Q F1 +(The DB library supports tw)108 199.2 Q 2.5(od)-.1 G(if)-2.5 E +(ferent models of applications: client-serv)-.25 E(er and embedded.)-.15 +E .827(In the client-serv)108 216 R .827(er model, a database serv)-.15 +F .828 +(er is created by writing an application that accepts requests via)-.15 +F .468(some form of IPC and issues calls to the DB functions based on those queries.) +108 228 R .467(In this model, applications)5.467 F .402 +(are client programs that attach to the serv)108 240 R .402 +(er and issue queries.)-.15 F .402(The client-serv)5.402 F .402 +(er model trades performance)-.15 F 1.228(for protection, as it does not require that the applications share a protection domain with the serv) +108 252 R(er)-.15 E 3.727(,b)-.4 G(ut)-3.927 E .165 +(IPC/RPC is generally slo)108 264 R .165(wer than a function call.)-.25 +F .166(In addition, this model simpli\214es the creation of netw)5.166 F +(ork)-.1 E(client-serv)108 276 Q(er applications.)-.15 E .745(In the embedded model, an application links the DB library directly into its address space.) +108 292.8 R .745(This pro)5.745 F(vides)-.15 E .746(for f)108 304.8 R +.746(aster access to database functionality)-.1 F 3.247(,b)-.65 G .747 +(ut means that the applications sharing log \214les, lock manager)-3.447 +F(,)-.4 E .31(transaction manager or memory pool manager ha)108 316.8 R +.609 -.15(ve t)-.2 H .309 +(he ability to read, write, and corrupt each other').15 F 2.809(sd)-.55 +G(ata.)-2.809 E(It is the application designer')108 333.6 Q 2.5(sr)-.55 +G(esponsibility to select the appropriate model for their application.) +-2.5 E .125(Applications require a single include \214le,)108 350.4 R F2 +()-.4 E F1 2.625(,w)C .125 +(hich must be installed in an appropriate location on the)-2.625 F +(system.)108 362.4 Q F0(C++)72 379.2 Q F1 1.534(The C++ classes pro)108 +391.2 R 1.534(vide a thin wrapper around the C API, with the major adv) +-.15 F 1.533(antages being impro)-.25 F -.15(ve)-.15 G(d).15 E +(encapsulation and an optional e)108 403.2 Q +(xception mechanism for errors.)-.15 E .307 +(The classes and methods are named in a f)108 420 R .308 +(ashion that directly corresponds to structures and functions in the)-.1 +F 2.775(Ci)108 432 S(nterf)-2.775 E 2.775(ace. Lik)-.1 F -.25(ew)-.1 G +.275(ise, ar).25 F .275 +(guments to methods appear in the same order as the C interf)-.18 F .274 +(ace, e)-.1 F .274(xcept to remo)-.15 F -.15(ve)-.15 G(the e)108 444 Q +(xplicit `)-.15 E(`this')-.74 E 2.5('p)-.74 G(ointer)-2.5 E 5(.T)-.55 G +(he #de\214nes used for \215ags are identical between the C and C++ interf) +-5 E(aces.)-.1 E .488(As a rule, each C++ object has e)108 460.8 R .488 +(xactly one structure from the underlying C API associated with it.)-.15 +F .488(The C)5.488 F .769(structure is allocated with each constructor call and deallocated with each destructor call.) +108 472.8 R .769(Thus, the rules)5.769 F .069(the user needs to follo) +108 484.8 R 2.569(wi)-.25 G 2.569(na)-2.569 G .07(llocating and deallocating structures are the same between the C and C++ inter) +-2.569 F(-)-.2 E -.1(fa)108 496.8 S(ces.).1 E 1.982 -.8(To e)108 513.6 T +.382(nsure portability to man).8 F 2.881(yp)-.15 G .381 +(latforms, both ne)-2.881 F 2.881(wa)-.25 G .381(nd old, we mak)-2.881 F +2.881(ef)-.1 G .881 -.25(ew a)-2.881 H .381 +(ssumptions about the C++ com-).25 F 1.858(piler and library)108 525.6 R +6.858(.F)-.65 G 1.858(or e)-7.008 F 1.859(xample, we do not e)-.15 F +1.859(xpect STL, templates or namespaces to be a)-.15 F -.25(va)-.2 G +4.359(ilable. The).25 F(ne)108 537.6 Q .137(west C++ feature used is e) +-.25 F .136 +(xceptions, which are used liberally to transmit error information.)-.15 +F(Ev)5.136 E .136(en the use)-.15 F .895(of e)108 549.6 R .895 +(xceptions can be disabled at runtime, by using)-.15 F F2(DbEn)3.395 E +(v::set_err)-.4 E(or_model)-.45 E F1 .895(\(\) \(see).51 F F2(DbEn)3.395 +E(v)-.4 E F1 3.395(\(3\)\). F).32 F .895(or a dis-)-.15 F +(cussion of the e)108 561.6 Q(xception mechanism, see)-.15 E F2 +(DbException)2.5 E F1(\(3\).).24 E -.15(Fo)108 578.4 S 2.58(rt).15 G .08 +(he rest of this manual page, C interf)-2.58 F .079 +(aces are listed as the primary reference, and C++ interf)-.1 F .079 +(aces follo)-.1 F(w-)-.25 E(ing parenthetically)108 590.4 Q 2.5(,e)-.65 +G(.g.,)-2.5 E F2(db_open)2.5 E F1(\()2.5 E F2(Db::open)A F1(\).).24 E F0 +-.27(JA)72 607.2 S -1.215(VA)-1.035 G F1 .041(The Ja)108 619.2 R .541 +-.25(va c)-.2 H .041(lasses pro).25 F .041(vide a layer around the C API that is almost identical to the C++ layer) +-.15 F 5.042(.T)-.55 G .042(he classes and)-5.042 F 1.256 +(methods are, for the most part identical to the C++ layer)108 631.2 R +6.256(.D)-.55 G 3.756(bc)-6.256 G 1.256 +(onstants and #de\214nes are represented as)-3.756 F +("static \214nal int" v)108 643.2 Q 2.5(alues. Errors)-.25 F +(conditions appear as Ja)2.5 E .5 -.25(va e)-.2 H(xceptions.).1 E .74 +(As in C++, each Ja)108 660 R 1.24 -.25(va o)-.2 H .74(bject has e).25 F +.741(xactly one structure from the underlying C API associated with it.) +-.15 F(The)5.741 E(Ja)108 672 Q .508 -.25(va s)-.2 H .007 +(tructure is allocated with each constructor or open call, b).25 F .007 +(ut is deallocated only when the Ja)-.2 F .507 -.25(va G)-.2 H 2.507(Cd) +.25 G(oes)-2.507 E 2.789(so. Because)108 684 R .289 +(the timing or ordering of GC is not predictable, the user should tak) +2.789 F 2.79(ec)-.1 G .29(are to do a close\(\) when)-2.79 F +(\214nished with an)108 696 Q 2.5(yo)-.15 G +(bject that has such a method.)-2.5 E(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DB_INTR)72 48 Q 344.1(O\(3\) DB_INTR)-.4 F +(O\(3\))-.4 E/F1 9/Times-Bold@0 SF(SUBSYSTEMS)72 84 Q F0 +(The DB library is made up of \214v)108 96 Q 2.5(em)-.15 G +(ajor subsystems, as follo)-2.5 E(ws:)-.25 E(Access methods)108 112.8 Q +.069(The access methods subsystem is made up of general-purpose support for creating and accessing \214les) +133 124.8 R .488(formatted as B+tree')133 136.8 R .488 +(s, hashed \214les, and \214x)-.55 F .489(ed and v)-.15 F .489 +(ariable length records.)-.25 F .489(These modules are useful)5.489 F +1.151(in the absence of transactions for processes that need f)133 148.8 +R 1.15(ast, formatted \214le support.)-.1 F(See)6.15 E/F2 10 +/Times-Italic@0 SF(db_open)3.65 E F0(\(3\)).24 E(and)133 160.8 Q F2 +(db_cur)2.5 E(sor)-.1 E F0(\(3\) \().73 E F2(Db)A F0(\(3\) and).23 E F2 +(Dbc)2.5 E F0(\(3\)\) for more information.).31 E(Locking)108 177.6 Q +.405 +(The locking subsystem is a general-purpose lock manager used by DB.)133 +189.6 R .406(This module is useful in the)5.406 F .937 +(absence of the rest of the DB package for processes that require a f) +133 201.6 R .936(ast, con\214gurable lock manager)-.1 F(.)-.55 E(See)133 +213.6 Q F2(db_loc)2.5 E(k)-.2 E F0(\(3\) \().67 E F2(DbLoc)A(kT)-.2 E +(ab)-.92 E F0(\(3\) and).23 E F2(DbLoc)2.5 E(k)-.2 E F0 +(\(3\)\) for more information.).67 E(Logging)108 230.4 Q .206(The logging subsystem is the logging support used to support the DB transaction model.) +133 242.4 R .207(It is lar)5.207 F(gely)-.18 E .665 +(speci\214c to the DB package, and unlik)133 254.4 R .665 +(ely to be used else)-.1 F 3.164(where. See)-.25 F F2(db_lo)3.164 E(g) +-.1 E F0 .664(\(3\) \().22 F F2(DbLo)A(g)-.1 E F0 .664(\(3\)\) for more) +.22 F(information.)133 266.4 Q(Memory Pool)108 283.2 Q 1.012 +(The memory pool subsystem is the general-purpose shared memory b)133 +295.2 R(uf)-.2 E 1.012(fer pool used by DB.)-.25 F(This)6.013 E .547(module is useful outside of the DB package for processes that require page-oriented, cached, shared) +133 307.2 R(\214le access.)133 319.2 Q(See)5 E F2(db_mpool)2.5 E F0 +(\(3\) \().51 E F2(DbMpool)A F0(\(3\) and).51 E F2(DbMpoolF)2.5 E(ile) +-.45 E F0(\(3\)\) for more information.).18 E -.35(Tr)108 336 S +(ansactions).35 E 1.388 +(The transaction subsystem implements the DB transaction model.)133 348 +R 1.388(It is lar)6.388 F 1.388(gely speci\214c to the DB)-.18 F 2.5 +(package. See)133 360 R F2(db_txn)2.5 E F0(\(3\) \().24 E F2(DbTxnMgr)A +F0(\(3\) and).73 E F2(DbTxn)2.5 E F0(\(3\)\) for more information.).24 E +(There are se)108 376.8 Q -.15(ve)-.25 G +(ral stand-alone utilities that support the DB en).15 E 2.5 +(vironment. The)-.4 F 2.5(ya)-.15 G(re as follo)-2.5 E(ws:)-.25 E +(db_archi)108 393.6 Q -.15(ve)-.25 G(The)133 405.6 Q F2(db_ar)6.769 E +-.15(ch)-.37 G(ive).15 E F0 4.268 +(utility supports database backup, archi)6.769 F -.25(va)-.25 G 6.768 +(la).25 G 4.268(nd log \214le administration.)-6.768 F(See)9.268 E F2 +(db_ar)133 417.6 Q -.15(ch)-.37 G(ive).15 E F0 +(\(1\) for more information.).18 E(db_reco)108 434.4 Q -.15(ve)-.15 G(r) +.15 E(The)133 446.4 Q F2(db_r)2.616 E(eco)-.37 E(ver)-.1 E F0 .116 +(utility runs after an une)2.616 F .116(xpected DB or system f)-.15 F +.117(ailure to restore the database to a con-)-.1 F(sistent state.)133 +458.4 Q(See)5 E F2(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0 +(\(1\) for more information.).73 E(db_checkpoint)108 475.2 Q(The)133 +487.2 Q F2(db_c)3.797 E(hec)-.15 E(kpoint)-.2 E F0 1.296(utility runs as a daemon process, monitoring the database log and periodically) +3.797 F(issuing checkpoints.)133 499.2 Q(See)5 E F2(db_c)2.5 E(hec)-.15 +E(kpoint)-.2 E F0(\(1\) for more information.).68 E(db_deadlock)108 516 +Q(The)133 528 Q F2(db_deadloc)3.727 E(k)-.2 E F0 1.228 +(utility runs as a daemon process, periodically tra)3.727 F -.15(ve)-.2 +G 1.228(rsing the database lock struc-).15 F 1.086 +(tures and aborting transactions when it detects a deadlock.)133 540 R +(See)6.086 E F2(db_deadloc)3.586 E(k)-.2 E F0 1.086 +(\(1\) for more informa-).67 F(tion.)133 552 Q(db_dump)108 568.8 Q(The) +133 580.8 Q F2(db_dump)4.71 E F0 2.21(utility writes a cop)4.71 F 4.71 +(yo)-.1 G 4.71(ft)-4.71 G 2.211(he database to a \215at-te)-4.71 F 2.211 +(xt \214le in a portable format.)-.15 F(See)7.211 E F2(db_dump)133 592.8 +Q F0(\(1\) for more information.).19 E(db_load)108 609.6 Q(The)133 621.6 +Q F2(db_load)2.52 E F0 .02(utility reads the \215at-te)2.52 F .02 +(xt \214le produced by)-.15 F F2(db_dump)2.519 E F0 2.519(,a).19 G .019 +(nd loads it into a database \214le.)-2.519 F(See)5.019 E F2(db_load)133 +633.6 Q F0(\(1\) for more information.).77 E(db_stat)108 650.4 Q(The)133 +662.4 Q F2(db_stat)3.757 E F0 1.257 +(utility displays statistics for databases and database en)3.757 F 3.758 +(vironments. See)-.4 F F2(db_stat)3.758 E F0 1.258(\(1\) for).68 F +(more information.)133 674.4 Q F1 -.18(NA)72 691.2 S +(MING AND THE DB ENVIR).18 E(ONMENT)-.27 E F0 3.35 +(The DB application en)108 703.2 R 3.35(vironment is described by the) +-.4 F F2(db_appinit)5.85 E F0 3.35(\(3\) \().68 F F2(DbEn)A(v)-.4 E F0 +3.35(\(3\)\) manual page.).32 F(The)8.35 E F2(db_appinit)108 715.2 Q F0 +(\()3.488 E F2(DbEn)A(v::appinit)-.4 E F0 3.488(\)f).68 G .989(unction is used to create a consistent naming scheme for all of the subsys-) +-3.488 F .292(tems sharing a DB en)108 727.2 R 2.792(vironment. If)-.4 F +F2(db_appinit)2.792 E F0(\()2.792 E F2(DbEn)A(v::appinit)-.4 E F0 2.792 +(\)i).68 G 2.792(sn)-2.792 G .292(ot called by a DB application, naming) +-2.792 F(April 10, 1998)276.695 768 Q(2)199.695 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DB_INTR)72 48 Q 344.1(O\(3\) DB_INTR)-.4 F +(O\(3\))-.4 E(is performed as speci\214ed by the manual page for the speci\214c subsystem.) +108 84 Q .074(DB applications that run with additional pri)108 100.8 R +(vile)-.25 E .075(ge should al)-.15 F -.1(wa)-.1 G .075(ys call the).1 F +/F1 10/Times-Italic@0 SF(db_appinit)2.575 E F0(\()2.575 E F1(DbEn)A +(v::appinit)-.4 E F0 2.575(\)f).68 G(unc-)-2.575 E .43 +(tion to initialize DB naming for their application.)108 112.8 R .43 +(This ensures that the en)5.43 F .43(vironment v)-.4 F .43 +(ariables DB_HOME)-.25 F +(and TMPDIR will only be used if the application e)108 124.8 Q +(xplicitly speci\214es that the)-.15 E 2.5(ya)-.15 G(re safe.)-2.5 E/F2 +9/Times-Bold@0 SF(ADMINISTERING THE DB ENVIR)72 141.6 Q(ONMENT)-.27 E F0 +3.498(AD)108 153.6 S 3.498(Be)-3.498 G -.4(nv)-3.498 G .998(ironment consists of a database home directory and all the long-running daemons necessary to) +.4 F 1.12(ensure continued functioning of DB and its applications.)108 +165.6 R 1.12(In the presence of transactions, the checkpoint)6.12 F +(daemon,)108 177.6 Q F1(db_c)3.753 E(hec)-.15 E(kpoint)-.2 E F0 3.753 +(,m).68 G 1.254 +(ust be run as long as there are applications present \(see)-3.753 F F1 +(db_c)3.754 E(hec)-.15 E(kpoint)-.2 E F0 1.254(\(1\) for).68 F 2.756 +(details\). When)108 189.6 R .256 +(locking is being used, the deadlock detection daemon,)2.756 F F1 +(db_deadloc)2.756 E(k)-.2 E F0 2.755(,m).67 G .255 +(ust be run as long as)-2.755 F .144 +(there are applications present \(see)108 201.6 R F1(db_deadloc)2.644 E +(k)-.2 E F0 .144(\(1\) for details\).).67 F(The)5.144 E F1(db_ar)2.644 E +-.15(ch)-.37 G(ive).15 E F0 .145(utility pro)2.644 F .145 +(vides information)-.15 F .222(to f)108 213.6 R .222 +(acilitate log reclamation and creation of database snapshots \(see)-.1 +F F1(db_ar)2.721 E -.15(ch)-.37 G(ive).15 E F0 .221 +(\(1\) for details\).).18 F .221(After appli-)5.221 F .817 +(cation or system f)108 225.6 R .817(ailure, the)-.1 F F1(db_r)3.317 E +(eco)-.37 E(ver)-.1 E F0 .818(utility must be run before an)3.317 F +3.318(ya)-.15 G .818(pplications are restarted to return)-3.318 F +(the database to a consistent state \(see)108 237.6 Q F1(db_r)2.5 E(eco) +-.37 E(ver)-.1 E F0(\(1\) for details\).).73 E .739(The simplest w)108 +254.4 R .739(ay to administer a DB application en)-.1 F .739 +(vironment is to create a single `)-.4 F(`home')-.74 E 3.238('d)-.74 G +.738(irectory that)-3.238 F 1.451 +(houses all the \214les for the applications that are sharing the DB en) +108 266.4 R 3.951(vironment. In)-.4 F 1.452(this model, the shared)3.951 +F 1.508(memory re)108 278.4 R 1.507 +(gions \(i.e., the locking, logging, memory pool, and transaction re) +-.15 F 1.507(gions\) and log \214les will be)-.15 F .284 +(stored in the speci\214ed directory hierarch)108 290.4 R 4.085 -.65 +(y. I)-.05 H 2.785(na).65 G .285 +(ddition, all data \214les speci\214ed using relati)-2.785 F .585 -.15 +(ve p)-.25 H .285(athnames will).15 F .465(be named relati)108 302.4 R +.764 -.15(ve t)-.25 H 2.964(ot).15 G .464(his home directory)-2.964 F +5.464(.W)-.65 G .464(hen reco)-5.464 F -.15(ve)-.15 G .464 +(ry needs to be run \(e.g., after system or application).15 F -.1(fa)108 +314.4 S .75 +(ilure\), this directory is speci\214ed as the home directory to).1 F F1 +(db_r)3.25 E(eco)-.37 E(ver)-.1 E F0 .75 +(\(1\), and the system is restored to a).73 F +(consistent state, ready for the applications to be restarted.)108 326.4 +Q .499(In situations where further customization is desired, such as placing the log \214les on a separate de) +108 343.2 R .498(vice, it is)-.25 F .203(recommended that the application installation process create a con\214guration \214le named `) +108 355.2 R(`DB_CONFIG')-.74 E 2.704('i)-.74 G(n)-2.704 E 1.358 +(the database home directory)108 367.2 R 3.858(,s)-.65 G 1.358 +(pecifying the customization.)-3.858 F(See)6.357 E F1(db_appinit)3.857 E +F0 1.357(\(3\) \().68 F F1(DbEn)A(v)-.4 E F0 1.357 +(\(3\)\) for details on).32 F(this procedure.)108 379.2 Q .832 +(The DB architecture does not support placing the shared memory re)108 +396 R .833(gions on remote \214lesystems, e.g., the)-.15 F(Netw)108 408 +Q .281(ork File System \(NFS\) and the Andre)-.1 F 2.781(wF)-.25 G .281 +(ile System \(AFS\).)-2.781 F -.15(Fo)5.281 G 2.78(rt).15 G .28 +(his reason, the database home direc-)-2.78 F .905 +(tory must reside on a local \214lesystem.)108 420 R .905 +(Databases, log \214les and temporary \214les may be placed on remote) +5.905 F(\214lesystems, although the application may incur a performance penalty for doing so.) +108 432 Q 1.186(It is important to realize that all applications sharing a single home directory implicitly trust each other) +108 448.8 R(.)-.55 E(The)108 460.8 Q 4.644(yh)-.15 G -2.25 -.2(av e) +-4.644 H 2.144(access to each other')4.844 F 4.644(sd)-.55 G 2.144 +(ata as it resides in the shared memory b)-4.644 F(uf)-.2 E 2.145 +(fer pool and will share)-.25 F 1.335(resources such as b)108 472.8 R +(uf)-.2 E 1.335(fer space and locks.)-.25 F 1.335(At the same time, an) +6.335 F 3.835(ya)-.15 G 1.334(pplications that access the same \214les) +-3.835 F/F3 10/Times-Bold@0 SF(must)108 484.8 Q F0(share an en)2.5 E +(vironment if consistenc)-.4 E 2.5(yi)-.15 G 2.5(st)-2.5 G 2.5(ob)-2.5 G +2.5(em)-2.5 G(aintained across the dif)-2.5 E(ferent applications.)-.25 +E F2(ERR)72 501.6 Q(OR RETURNS)-.27 E F0 .953(Except for the historic) +108 513.6 R F1(dbm)3.453 E F0(and)3.453 E F1(hsear)3.453 E -.15(ch)-.37 +G F0(interf)3.603 E .953(aces \(see)-.1 F F1(db_dbm)3.453 E F0 .953 +(\(3\) and).32 F F1(db_hsear)3.454 E -.15(ch)-.37 G F0 .954 +(\(3\)\), DB does not use).43 F .282(the global v)108 525.6 R(ariable) +-.25 E F1(errno)2.781 E F0 .281(to return error v)2.781 F 2.781 +(alues. The)-.25 F .281(return v)2.781 F .281 +(alues for all DB functions can be grouped into)-.25 F(three cate)108 +537.6 Q(gories:)-.15 E 17.5(0A)110.5 554.4 S(return v)-15 E +(alue of 0 indicates that the operation w)-.25 E(as successful.)-.1 E +11.86(>0 A)108 571.2 R .18(return v)2.68 F .18 +(alue that is greater than 0 indicates that there w)-.25 F .181 +(as a system error)-.1 F 5.181(.T)-.55 G(he)-5.181 E F1(errno)2.681 E F0 +-.25(va)2.681 G .181(lue returned).25 F .227(by the system is returned by the function, e.g., when a DB function is unable to allocate memory) +133 583.2 R 2.727(,t)-.65 G(he)-2.727 E(return v)133 595.2 Q +(alue from the function will be ENOMEM.)-.25 E 11.86(<0 A)108 612 R .681 +(return v)3.181 F .681 +(alue that is less than 0 indicates a condition that w)-.25 F .682 +(as not a system f)-.1 F .682(ailure, b)-.1 F .682(ut w)-.2 F .682 +(as not an)-.1 F .48(unquali\214ed success, either)133 624 R 5.48(.F) +-.55 G .48(or e)-5.63 F .48(xample, a routine to retrie)-.15 F .78 -.15 +(ve a k)-.25 H -.15(ey).05 G .48(/data pair from the database may).15 F +.848(return DB_NO)133 636 R .848(TFOUND when the k)-.4 F -.15(ey)-.1 G +.849(/data pair does not appear in the database, as opposed to the).15 F +-.25(va)133 648 S .227(lue of 0, which w).25 F .227 +(ould be returned if the k)-.1 F -.15(ey)-.1 G .227 +(/data pair were found in the database.).15 F .226(All such special) +5.226 F -.25(va)133 660 S 1.333 +(lues returned by DB functions are less than 0 in order to a).25 F -.2 +(vo)-.2 G 1.334(id con\215ict with possible v).2 F 1.334(alues of)-.25 F +F1(errno)133 672 Q F0(.).18 E .168(There are tw)108 688.8 R 2.668(os)-.1 +G .168(pecial return v)-2.668 F .168(alues that are some)-.25 F .167 +(what similar in meaning, are returned in similar situations,)-.25 F +1.139(and therefore might be confused: DB_NO)108 700.8 R 1.139 +(TFOUND and DB_KEYEMPTY)-.4 F 6.139(.T)-1.29 G 1.139(he DB_NO)-6.139 F +1.139(TFOUND error)-.4 F .354(return indicates that the requested k)108 +712.8 R -.15(ey)-.1 G .354(/data pair did not e).15 F .354 +(xist in the database or that start- or end-of-\214le has)-.15 F .341 +(been reached.)108 724.8 R .341 +(The DB_KEYEMPTY error return indicates that the requested k)5.341 F +-.15(ey)-.1 G .342(/data pair logically e).15 F(xists)-.15 E +(April 10, 1998)276.695 768 Q(3)199.695 E EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DB_INTR)72 48 Q 344.1(O\(3\) DB_INTR)-.4 F +(O\(3\))-.4 E -.2(bu)108 84 S 4.417(tw).2 G 1.917(as ne)-4.517 F -.15 +(ve)-.25 G 4.417(re).15 G 1.916(xplicitly created by the application \(the recno access method will automatically create) +-4.567 F -.1(ke)108 96 S 2.516 +(y/data pairs under some circumstances, see)-.05 F/F1 10/Times-Italic@0 +SF(db_open)5.016 E F0 2.516(\(3\) \().24 F F1(Db)A F0 2.516 +(\(3\)\) for more information\), or that the).23 F(requested k)108 108 Q +-.15(ey)-.1 G(/data pair w).15 E +(as deleted and is currently in a deleted state.)-.1 E/F2 9/Times-Bold@0 +SF(SIGN)72 124.8 Q(ALS)-.18 E F0 1.181(When applications using DB recei) +108 136.8 R 1.481 -.15(ve s)-.25 H 1.181 +(ignals, it is important that the).15 F 3.68(ye)-.15 G 1.18 +(xit gracefully)-3.83 F 3.68(,d)-.65 G 1.18(iscarding an)-3.68 F 3.68 +(yD)-.15 G(B)-3.68 E .428(locks that the)108 148.8 R 2.929(ym)-.15 G +.429(ay hold.)-2.929 F .429 +(This is normally done by setting a \215ag when a signal arri)5.429 F +-.15(ve)-.25 G .429(s, and then checking).15 F 1.997 +(for that \215ag periodically within the application.)108 160.8 R +(Speci\214cally)6.996 E 4.496(,t)-.65 G 1.996 +(he signal handler should not attempt to)-4.496 F 1.456 +(release locks and/or close the database handles itself.)108 172.8 R +1.456(This is not guaranteed to w)6.456 F 1.457(ork correctly and the) +-.1 F(results are unde\214ned.)108 184.8 Q 1.001(If an application e)108 +201.6 R 1.001(xits holding a lock, the situation is no dif)-.15 F 1 +(ferent than if the application crashed, and all)-.25 F .884 +(applications participating in the database en)108 213.6 R .884 +(vironment must be shutdo)-.4 F .884(wn, and then reco)-.25 F -.15(ve) +-.15 G .885(ry must be per).15 F(-)-.2 E 2.963(formed. If)108 225.6 R +.463(this is not done, the locks that the application held can cause unresolv) +2.963 F .463(able deadlocks inside the)-.25 F +(database, and applications may then hang.)108 237.6 Q F2(MUL)72 254.4 Q +(TI-THREADING)-.828 E F0(See)108 266.4 Q F1(db_thr)2.5 E(ead)-.37 E F0 +(\(3\) for information on using DB in threaded applications.).77 E F2 +-.315(DA)72 283.2 S -.81(TA)-.54 G -.27(BA).81 G(SE AND P).27 E -.495 +(AG)-.666 G 2.25(ES).495 G(IZES)-2.25 E F0 .442(DB stores database \214le page numbers as unsigned 32-bit numbers and database \214le page sizes as unsigned) +108 295.2 R .17(16-bit numbers.)108 307.2 R .17 +(This results in a maximum database size of 2^48.)5.17 F .169 +(The minimum database page size is 512)5.169 F +(bytes, resulting in a minimum maximum database size of 2^41.)108 319.2 +Q 1.114 +(DB is potentially further limited if the host system does not ha)108 +336 R 1.414 -.15(ve \214)-.2 H 1.114(lesystem support for \214les lar) +.15 F 1.115(ger than)-.18 F(2^32, including seeking to absolute of)108 +348 Q(fsets within such \214les.)-.25 E(The maximum btree depth is 255.) +108 364.8 Q F2(BYTE ORDERING)72 381.6 Q F0 .098(The database \214les created by DB can be created in either little or big-endian formats.) +108 393.6 R .097(By def)5.097 F .097(ault, the nati)-.1 F -.15(ve)-.25 G +.085 +(format of the machine on which the database is created will be used.) +108 405.6 R(An)5.085 E 2.585(yf)-.15 G .085 +(ormat database can be used on a)-2.585 F .361(machine with a dif)108 +417.6 R .361(ferent nati)-.25 F .661 -.15(ve f)-.25 H .36(ormat, although it is possible that the application will incur a performance) +.15 F(penalty for the run-time con)108 429.6 Q -.15(ve)-.4 G(rsion.).15 +E F2(EXTENDING DB)72 446.4 Q F0 .915 +(DB includes tools to simplify the de)108 458.4 R -.15(ve)-.25 G .915 +(lopment of application-speci\214c logging and reco).15 F -.15(ve)-.15 G +(ry).15 E 5.915(.S)-.65 G(peci\214cally)-5.915 E(,)-.65 E(gi)108 470.4 Q +-.15(ve)-.25 G 2.996(nad).15 G .496(escription of the information to be logged, these tools will automatically create logging functions) +-2.996 F .798(\(functions that tak)108 482.4 R 3.299(et)-.1 G .799(he v) +-3.299 F .799(alues as parameters and construct a single record that is written to the log\), read) +-.25 F .081 +(functions \(functions that read a log record and unmarshall the v)108 +494.4 R .081(alues into a structure that maps onto the v)-.25 F(al-)-.25 +E .282(ues you chose to log\), a print function \(for deb)108 506.4 R +.283(ugging\), templates for the reco)-.2 F -.15(ve)-.15 G .283 +(ry functions, and automatic).15 F(dispatching to your reco)108 518.4 Q +-.15(ve)-.15 G(ry functions.).15 E F2(EXAMPLES)72 535.2 Q F0 .289 +(There are a number of e)108 547.2 R .289 +(xamples included with the DB library distrib)-.15 F .288 +(ution, intended to demonstrate v)-.2 F(arious)-.25 E -.1(wa)108 559.2 S +(ys of using the DB library).1 E(.)-.65 E .461(Some applications require the use of formatted \214les to store data, b) +108 576 R .461(ut do not require concurrent access and)-.2 F .846 +(can cope with the loss of data due to catastrophic f)108 588 R 3.346 +(ailure. Generally)-.1 F 3.346(,t)-.65 G .846 +(hese applications create short-li)-3.346 F -.15(ve)-.25 G(d).15 E .935 +(databases that are discarded or recreated when the system f)108 600 R +3.436(ails. Such)-.1 F .936(applications need only use the DB)3.436 F +1.927(access methods.)108 612 R 1.927 +(The DB access methods will use the memory pool subsystem, b)6.927 F +1.926(ut the application is)-.2 F(unlik)108 624 Q .486(ely to do so e) +-.1 F(xplicitly)-.15 E 5.486(.S)-.65 G .486(ee the \214les)-5.486 F F1 +-.2(ex)2.986 G(amples/e).2 E(x_access.c)-.2 E F0(,).31 E F1 -.2(ex)2.986 +G(amples/e).2 E(x_btr)-.2 E(ec.c)-.37 E F0(,).31 E F1 -.2(ex)2.986 G +(amples_cxx/Acces-).2 E(sExample)108 636 Q(.cpp)-.15 E F0(and)3.588 E F1 +(java/sr)3.588 E(c/com/sleepycat/e)-.37 E(xamples/AccessExample)-.2 E +(.java)-.15 E F0 1.087(in the DB source distrib)3.588 F 1.087(ution for) +-.2 F(C, C++, and Ja)108 648 Q .5 -.25(va l)-.2 H(anguage code e).25 E +(xamples of ho)-.15 E 2.5(ws)-.25 G +(uch applications might use the DB library)-2.5 E(.)-.65 E 2.882 +(Some applications require the use formatted \214les to store data, b) +108 664.8 R 2.882(ut also need to use)-.2 F F1(db_appinit)5.382 E F0 +(\(3\)).68 E(\()108 676.8 Q F1(DbEn)A(v::appinit)-.4 E F0 6.768 +(\(3\)\) for en).68 F 6.768(vironment initialization.)-.4 F 6.767 +(See the \214les)11.768 F F1 -.2(ex)9.267 G(amples/e).2 E(x_appinit.c) +-.2 E F0(,).31 E F1 -.2(ex)9.267 G(am-).2 E(ples_cxx/AppinitExample)108 +688.8 Q(.cpp)-.15 E F0(or)4.563 E F1(java/sr)4.563 E(c/com/sleepycat/e) +-.37 E(xamples/AppinitExample)-.2 E(.java)-.15 E F0 2.064 +(in the DB source)4.563 F(distrib)108 700.8 Q 1.186 +(ution for C, C++ and Ja)-.2 F 1.685 -.25(va l)-.2 H 1.185 +(anguage code e).25 F 1.185(xamples of ho)-.15 F 3.685(ws)-.25 G 1.185 +(uch an application might use the DB)-3.685 F(library)108 712.8 Q(.)-.65 +E 2.075(Some applications use the DB access methods, b)108 729.6 R 2.075 +(ut are also concerned about catastrophic f)-.2 F 2.075(ailure, and)-.1 +F(April 10, 1998)276.695 768 Q(4)199.695 E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DB_INTR)72 48 Q 344.1(O\(3\) DB_INTR)-.4 F +(O\(3\))-.4 E 2.03 +(therefore need to transaction protect the underlying DB \214les.)108 84 +R 2.03(See the \214les)7.03 F/F1 10/Times-Italic@0 SF -.2(ex)4.53 G +(amples/e).2 E(x_tpcb)-.2 E(.c)-.4 E F0(,).31 E F1 -.2(ex)4.53 G(am-).2 +E(ples_cxx/TpcbExample)108 96 Q(.cpp)-.15 E F0(or)3.198 E F1(java/sr) +3.198 E(c/com/sleepycat/e)-.37 E(xamples/TpcbExample)-.2 E(.java)-.15 E +F0 .699(in the DB source distri-)3.198 F -.2(bu)108 108 S +(tion for C, C++ and Ja).2 E .5 -.25(va l)-.2 H(anguage code e).25 E +(xamples of ho)-.15 E 2.5(ws)-.25 G +(uch an application might use the DB library)-2.5 E(.)-.65 E 1.197 +(Some applications will bene\214t from the ability to b)108 124.8 R(uf) +-.2 E 1.197(fer input \214les other than the underlying DB access)-.25 F +.189(method \214les.)108 136.8 R .189(See the \214les)5.189 F F1 -.2(ex) +2.689 G(amples/e).2 E(x_mpool.c)-.2 E F0(or)2.689 E F1 -.2(ex)2.689 G +(amples_cxx/MpoolExample).2 E(.cpp)-.15 E F0 .189(in the DB source dis-) +2.689 F(trib)108 148.8 Q(ution for C and C++ language code e)-.2 E +(xamples of ho)-.15 E 2.5(ws)-.25 G +(uch an application might use the DB library)-2.5 E(.)-.65 E .785(Some applications need a general-purpose lock manager separate from locking support for the DB access) +108 165.6 R 7.178(methods. See)108 177.6 R 4.678(the \214les)7.178 F F1 +-.2(ex)7.179 G(amples/e).2 E(x_loc)-.2 E(k.c)-.2 E F0(,).31 E F1 -.2(ex) +7.179 G(amples_cxx/Loc).2 E(kExample)-.2 E(.cpp)-.15 E F0(or)7.179 E F1 +(java/sr)7.179 E(c/com/sleepy-)-.37 E(cat/e)108 189.6 Q(xamples/Loc)-.2 +E(kExample)-.2 E(.java)-.15 E F0 .143(in the DB source distrib)2.644 F +.143(ution for C, C++ and Ja)-.2 F .643 -.25(va l)-.2 H .143 +(anguage code e).25 F(xamples)-.15 E(of ho)108 201.6 Q 2.5(ws)-.25 G +(uch an application might use the DB library)-2.5 E(.)-.65 E .741 +(Some applications will use the DB access methods in a threaded f)108 +218.4 R .742(ashion, including trickle \215ushing of the)-.1 F .032 +(underlying b)108 230.4 R(uf)-.2 E .032 +(fer pool and deadlock detection.)-.25 F .031(See the \214le)5.032 F F1 +-.2(ex)2.531 G(amples/e).2 E(x_thr)-.2 E(ead.c)-.37 E F0 .031 +(in the DB source distrib)2.531 F(u-)-.2 E 1.026 +(tion for a C language code e)108 242.4 R 1.026(xample of ho)-.15 F +3.526(ws)-.25 G 1.026(uch an application might use the DB library)-3.526 +F 6.027(.N)-.65 G 1.027(ote that the)-6.027 F(Ja)108 254.4 Q .5 -.25 +(va A)-.2 H(PI assumes a threaded en).25 E(vironment and performs all thread-speci\214c initialization automatically) +-.4 E(.)-.65 E/F2 9/Times-Bold@0 SF(COMP)72 271.2 Q -.855(AT)-.666 G +(IBILITY).855 E F0 .923(The DB 2.0 library pro)108 283.2 R .923 +(vides backw)-.15 F .923(ard compatible interf)-.1 F .923 +(aces for the historic UNIX)-.1 F F1(dbm)3.423 E F0(\(3\),).32 E F1 +(ndbm)3.422 E F0 .922(\(3\) and).32 F F1(hsear)108 295.2 Q -.15(ch)-.37 +G F0 1.455(\(3\) interf).43 F 3.955(aces. See)-.1 F F1(db_dbm)3.956 E F0 +1.456(\(3\) and).32 F F1(db_hsear)3.956 E -.15(ch)-.37 G F0 1.456 +(\(3\) for further information on these interf).43 F 3.956(aces. It)-.1 +F .586(also pro)108 307.2 R .586(vides a backw)-.15 F .586 +(ard compatible interf)-.1 F .586(ace for the historic DB 1.85 release.) +-.1 F/F3 10/Times-Bold@0 SF .585(DB 2.0 does not pr)5.585 F -.1(ov)-.18 +G(ide).1 E 1.766(database compatibility f)108 319.2 R 1.767 +(or any of the abo)-.25 F 1.967 -.1(ve i)-.1 H 1.767 +(nterfaces, and existing databases must be con).1 F -.1(ve)-.4 G(rted).1 +E(manually)108 331.2 Q(.)-.7 E F0 3.72 -.8(To c)7.12 H(on).8 E -.15(ve) +-.4 G 2.12(rt e).15 F 2.119 +(xisting databases from the DB 1.85 format to the DB 2.0 format, re)-.15 +F(vie)-.25 E 4.619(wt)-.25 G(he)-4.619 E F1(db_dump185)108 343.2 Q F0 +(\(1\) and).41 E F1(db_load)2.5 E F0(\(1\) manual pages.).77 E .578 +(The name space in DB 2.0 has been changed from that of pre)108 360 R +.578(vious DB v)-.25 F .578(ersions, notably v)-.15 F .578 +(ersion 1.85, for)-.15 F .022(portability and consistenc)108 372 R 2.522 +(yr)-.15 G 2.521(easons. The)-2.522 F .021 +(only name collisions in the tw)2.521 F 2.521(ol)-.1 G .021 +(ibraries are the names used by the)-2.521 F F1(dbm)108 384 Q F0(\(3\),) +.32 E F1(ndbm)3.207 E F0(\(3\),).32 E F1(hsear)3.207 E -.15(ch)-.37 G F0 +.707(\(3\) and the DB 1.85 compatibility interf).43 F 3.207(aces. T)-.1 +F 3.207(oi)-.8 G .708(nclude both DB 1.85 and DB)-3.207 F 2.07 +(2.0 in a single library)108 396 R 4.57(,r)-.65 G(emo)-4.57 E 2.37 -.15 +(ve t)-.15 H(he).15 E F1(dbm)4.57 E F0(\(3\),).32 E F1(ndbm)4.57 E F0 +2.07(\(3\) and).32 F F1(hsear)4.57 E -.15(ch)-.37 G F0 2.07 +(\(3\) interf).43 F 2.07(aces from either of the tw)-.1 F(o)-.1 E .325 +(libraries, and the DB 1.85 compatibility interf)108 408 R .326 +(ace from the DB 2.0 library)-.1 F 5.326(.T)-.65 G .326 +(his can be done by editing the)-5.326 F 1.012(library Mak)108 420 R +1.012(e\214les and recon\214guring and reb)-.1 F 1.012 +(uilding the DB 2.0 library)-.2 F 6.012(.O)-.65 G -.15(bv)-6.012 G +(iously).15 E 3.512(,i)-.65 G 3.512(fy)-3.512 G 1.012 +(ou use the historic)-3.512 F(interf)108 432 Q .272 +(aces, you will get the v)-.1 F .272 +(ersion in the library from which you did not remo)-.15 F .572 -.15 +(ve i)-.15 H 2.772(t. Similarly).15 F 2.772(,y)-.65 G .273(ou will not) +-2.772 F .295(be able to access DB 2.0 \214les using the DB 1.85 compatibility interf) +108 444 R .295(ace, since you ha)-.1 F .595 -.15(ve r)-.2 H(emo).15 E +-.15(ve)-.15 G 2.795(dt).15 G .295(hat from)-2.795 F +(the library as well.)108 456 Q 1.604(It is possible to simply relink applications written to the DB 1.85 interf) +108 472.8 R 1.604(ace ag)-.1 F 1.604(ainst the DB 2.0 library)-.05 F(.) +-.65 E 1.756(Recompilation of such applications is slightly more comple) +108 484.8 R 4.255(x. When)-.15 F 1.755 +(the DB 2.0 library is installed, it)4.255 F 1.307(installs tw)108 496.8 +R 3.807(oi)-.1 G 1.307(nclude \214les,)-3.807 F F1(db)3.807 E(.h)-.4 E +F0(and)3.807 E F1(db_185.h)3.807 E F0 6.307(.T).28 G 1.307 +(he former \214le is lik)-6.307 F 1.307(ely to replace the DB 1.85 v)-.1 +F(ersion')-.15 E(s)-.55 E .391(include \214le which had the same name.) +108 508.8 R .391 +(If this did not happen, recompiling DB 1.85 applications to use the) +5.391 F .507(DB 2.0 library is simple: recompile as done historically) +108 520.8 R 3.007(,a)-.65 G .507(nd load ag)-3.007 F .508 +(ainst the DB 2.0 library instead of the)-.05 F .989(DB 1.85 library)108 +532.8 R 5.989(.I)-.65 G .989(f, ho)-5.989 F(we)-.25 E -.15(ve)-.25 G +1.789 -.4(r, t).15 H .989 +(he DB 2.0 installation process has replaced the system').4 F(s)-.55 E +F1(db)3.488 E(.h)-.4 E F0 .988(include \214le,)3.488 F 1.272 +(replace the application')108 544.8 R 3.773(si)-.55 G 1.273(nclude of) +-3.773 F F1(db)3.773 E(.h)-.4 E F0 1.273(with inclusion of)3.773 F F1 +(db_185.h)3.773 E F0 3.773(,r).28 G 1.273(ecompile as done historically) +-3.773 F 3.773(,a)-.65 G(nd)-3.773 E(then load ag)108 556.8 Q +(ainst the DB 2.0 library)-.05 E(.)-.65 E .808 +(Applications written using the historic interf)108 573.6 R .808 +(aces of the DB library should not require signi\214cant ef)-.1 F .808 +(fort to)-.25 F 1.107(port to the DB 2.0 interf)108 585.6 R 3.607 +(aces. While)-.1 F 1.108 +(the functionality has been greatly enhanced in DB 2.0, the historic) +3.608 F(interf)108 597.6 Q .481(ace and functionality and is lar)-.1 F +.481(gely unchanged.)-.18 F(Re)5.481 E(vie)-.25 E .481 +(wing the application')-.25 F 2.981(sc)-.55 G .48 +(alls into the DB library)-2.981 F(and updating those calls to the ne) +108 609.6 Q 2.5(wn)-.25 G(ames, \215ags and return v)-2.5 E +(alues should be suf)-.25 E(\214cient.)-.25 E 1.167 +(While loading applications that use the DB 1.85 interf)108 626.4 R +1.168(aces ag)-.1 F 1.168(ainst the DB 2.0 library)-.05 F 3.668(,o)-.65 +G 3.668(rc)-3.668 G(on)-3.668 E -.15(ve)-.4 G 1.168(rting DB).15 F .366 +(1.85 function calls to DB 2.0 function calls will w)108 638.4 R .366 +(ork, reconsidering your application')-.1 F 2.866(si)-.55 G(nterf)-2.866 +E .366(ace to the DB)-.1 F .243(database library in light of the additional functionality in DB 2.0 is recommended, as it is lik) +108 650.4 R .244(ely to result in)-.1 F +(enhanced application performance.)108 662.4 Q F2(SEE ALSO: ADMINISTRA) +72 679.2 Q(TIVE AND O)-.855 E(THER UTILITIES)-.36 E F1(db_ar)108 691.2 Q +-.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E F1(db_c)2.5 E(hec)-.15 E +(kpoint)-.2 E F0(\(1\),).68 E F1(db_deadloc)2.5 E(k)-.2 E F0(\(1\),).67 +E F1(db_dump)2.5 E F0(\(1\),).19 E F1(db_load)2.5 E F0(\(1\),).77 E F1 +(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F1(db_stat)2.5 E F0 +(\(1\)).68 E(April 10, 1998)276.695 768 Q(5)199.695 E EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DB_INTR)72 48 Q 344.1(O\(3\) DB_INTR)-.4 F +(O\(3\))-.4 E/F1 9/Times-Bold@0 SF(SEE ALSO: C API)72 84 Q/F2 10 +/Times-Italic@0 SF(db_appinit)108 96 Q F0(\(3\),).68 E F2(db_cur)2.5 E +(sor)-.1 E F0(\(3\),).73 E F2(db_dbm)2.5 E F0(\(3\),).32 E F2(db_loc)2.5 +E(k)-.2 E F0(\(3\),).67 E F2(db_lo)2.5 E(g)-.1 E F0(\(3\),).22 E F2 +(db_mpool)2.5 E F0(\(3\),).51 E F2(db_open)2.5 E F0(\(3\),).24 E F2 +(db_txn)2.5 E F0(\(3\)).24 E F1(SEE ALSO: C++ and J)72 112.8 Q -1.89 +-.225(av a)-.135 H(API)2.475 E F2(Db)108 124.8 Q F0(\(3\),).23 E F2(Dbc) +2.5 E F0(\(3\),).31 E F2(DbEn)2.5 E(v)-.4 E F0(\(3\),).32 E F2 +(DbException)2.5 E F0(\(3\),).24 E F2(DbInfo)2.5 E F0(\(3\),).18 E F2 +(DbLoc)2.5 E(k)-.2 E F0(\(3\),).67 E F2(DbLoc)2.5 E(kT)-.2 E(ab)-.92 E +F0(\(3\),).23 E F2(DbLo)2.5 E(g)-.1 E F0(\(3\),).22 E F2(DbLsn)2.5 E F0 +(\(3\),).24 E F2(DbMpool)108 136.8 Q F0(\(3\),).51 E F2(DbMpoolF)2.5 E +(ile)-.45 E F0(\(3\),).18 E F2(Dbt)2.5 E F0(\(3\),).68 E F2(DbTxn)2.5 E +F0(\(3\),).24 E F2(DbTxnMgr)2.5 E F0(\(3\)).73 E F1(SEE ALSO: ADDITION) +72 153.6 Q(AL REFERENCES)-.18 E F2(LIBTP: P)108 165.6 Q(ortable)-.8 E +2.5(,M)-.1 G(odular T)-2.5 E -.15(ra)-.55 G(nsactions for UNIX).15 E F0 +2.5(,M).94 G(ar)-2.5 E(go Seltzer)-.18 E 2.5(,M)-.4 G +(ichael Olson, USENIX proceedings,)-2.5 E -.4(Wi)108 177.6 S(nter 1992.) +.4 E(April 10, 1998)276.695 768 Q(6)199.695 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/man.ps/db_load.ps b/mozilla/db/man/man.ps/db_load.ps new file mode 100644 index 00000000000..89196f1a2e4 --- /dev/null +++ b/mozilla/db/man/man.ps/db_load.ps @@ -0,0 +1,393 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Tue Jun 2 21:30:10 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 3 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_load \255 the DB database loader)108 40.8 Q F0(SYNOPSIS)72 57.6 Q/F2 +10/Times-Bold@0 SF(db_load)108 69.6 Q F1([)2.5 E F2(-nT)A F1 2.5(][)C F2 +(-c name=v)-2.5 E(alue)-.1 E F1(])A([)158 81.6 Q F2(-f \214le)A F1 2.5 +(][)C F2(-h home)-2.5 E F1 2.5(][)C F2(-t btr)-2.5 E(ee | hash | r)-.18 +E(ecno)-.18 E F1 2.5(]d)C(b_\214le)-2.5 E F0(DESCRIPTION)72 98.4 Q F1 +(The)108 110.4 Q/F3 10/Times-Italic@0 SF(db_load)4.18 E F1 1.679 +(utility reads from the standard input and loads it into the database) +4.18 F F3(db_\214le)4.179 E F1 6.679(.T).18 G 1.679(he database)-6.679 F +F3(db_\214le)108 122.4 Q F1(is created if it does not already e)2.5 E +(xist.)-.15 E .592(The input to)108 139.2 R F3(db_load)3.092 E F1 .592 +(must be in the output format speci\214ed by the)3.092 F F3(db_dump) +3.093 E F1(or)3.093 E F3(db_dump185)3.093 E F1 .593(utilities \(see) +3.093 F F3(db_dump)108 151.2 Q F1 +(\(1\) for more information\), or as speci\214ed for the).19 E F2 +2.5 E F1(option belo)2.5 E -.65(w.)-.25 G(The options are as follo)108 +168 Q(ws:)-.25 E F2108 184.8 Q F1 .081 +(Specify con\214guration options for the DB_INFO structure pro)14.86 F +.081(vided to)-.15 F F3(db_open)2.581 E F1 .081(\(3\), ignoring an).24 F +2.58(yv)-.15 G(alue)-2.83 E(the)133 196.8 Q 5.86(ym)-.15 G 3.36(ay ha) +-5.86 F 3.66 -.15(ve b)-.2 H 3.36(ased on the input.).15 F 3.36 +(The command-line format is `)8.36 F(`name=v)-.74 E(alue')-.25 E 5.86 +('. Supported)-.74 F -.1(ke)133 208.8 S(yw)-.05 E(ords are listed belo) +-.1 E -.65(w.)-.25 G F2108 225.6 Q F1(Read from the speci\214ed) +15.97 E F3(input)2.5 E F1(\214le instead of from the standard input.)2.5 +E F2108 242.4 Q F1(Specify a home directory for the database.) +13.74 E 1.579(If a home directory is speci\214ed, the database en)133 +266.4 R 1.578(vironment is opened using the DB_INIT_LOCK,)-.4 F 8.463 +(DB_INIT_LOG, DB_INIT_MPOOL, DB_INIT_TXN and DB_USE_ENVIR)133 278.4 R +8.464(ON \215ags to)-.4 F F3(db_appinit)133 290.4 Q F1 3.464 +(\(3\). \(This).68 F .963(means that)3.464 F F3(db_load)3.463 E F1 .963 +(can be used to load data into databases while the)3.463 F 3.463(ya)-.15 +G .963(re in)-3.463 F .209(use by other processes.\))133 302.4 R .209 +(If the)5.209 F F3(db_appinit)2.709 E F1 .209(call f)2.709 F .21 +(ails, or if no home directory is speci\214ed, the database)-.1 F +(is still updated, b)133 314.4 Q(ut the en)-.2 E +(vironment is ignored, e.g., no locking is done.)-.4 E F2108 331.2 +Q F1 .739(Do not o)13.74 F -.15(ve)-.15 G .738(rwrite e).15 F .738 +(xisting k)-.15 F -.15(ey)-.1 G 3.238(si).15 G 3.238(nt)-3.238 G .738 +(he database when loading into an already e)-3.238 F .738 +(xisting database.)-.15 F .738(If a)5.738 F -.1(ke)133 343.2 S .759 +(y/data pair cannot be loaded into the database for this reason, a w) +-.05 F .76(arning message is displayed on)-.1 F +(the standard error output and the k)133 355.2 Q -.15(ey)-.1 G +(/data pair are skipped.).15 E F2108 372 Q F1(The)12.63 E F2 +2.5 E F1(option allo)2.5 E(ws non-DB applications to easily load te)-.25 +E(xt \214les into databases.)-.15 E .102 +(If the database to be created is of type)133 396 R F2(btr)2.602 E(ee) +-.18 E F1(or)2.601 E F2(hash)2.601 E F1 2.601(,t)C .101 +(he input must be paired lines of te)-2.601 F .101(xt, where the)-.15 F +.453(\214rst line of the pair is the k)133 408 R .753 -.15(ey i)-.1 H +.453 +(tem, and the second line of the pair is its corresponding data item.) +.15 F(If)5.454 E .564(the database to be created is of type)133 420 R F2 +-.18(re)3.063 G(cno).18 E F1 3.063(,t)C .563 +(he input must be lines of te)-3.063 F .563(xt, where each line is a ne) +-.15 F(w)-.25 E(data item for the database.)133 432 Q 2.933(As)133 456 S +.433(imple escape mechanism, where ne)-2.933 F .434 +(wline and backslash \(`)-.25 F(`\\')-.74 E .434 +('\) characters are special, is applied to)-.74 F .9(the te)133 468 R .9 +(xt input.)-.15 F(Ne)5.9 E .899 +(wline characters are interpreted as record separators.)-.25 F .899 +(Backslash characters in the)5.899 F(te)133 480 Q 1.33 +(xt will be interpreted in one of tw)-.15 F 3.83(ow)-.1 G 1.33 +(ays: if the backslash character precedes another backslash)-3.93 F +(character)133 492 Q 3.235(,t)-.4 G .735 +(he pair will be interpreted as a literal backslash.)-3.235 F .734 +(If the backslash character precedes an)5.735 F(y)-.15 E .103 +(other character)133 504 R 2.603(,t)-.4 G .103(he tw)-2.603 F 2.603(oc) +-.1 G .103(haracters follo)-2.603 F .103 +(wing the backslash will be interpreted as he)-.25 F .104 +(xadecimal speci\214-)-.15 F(cation of a single character)133 516 Q 2.5 +(,e)-.4 G(.g., `)-2.5 E(`\\0a')-.74 E 2.5('i)-.74 G 2.5(san)-2.5 G -.25 +(ew)-2.5 G(line character in the ASCII character set.).25 E -.15(Fo)133 +540 S 3.732(rt).15 G 1.232(his reason, an)-3.732 F 3.732(yb)-.15 G 1.232 +(ackslash or ne)-3.732 F 1.232 +(wline characters that naturally occur in the te)-.25 F 1.231 +(xt input must be)-.15 F(escaped to a)133 552 Q -.2(vo)-.2 G +(id misinterpretation by).2 E F3(db_load)2.5 E F1(.).77 E 1.862(If the) +133 576 R F24.362 E F1 1.863(option is speci\214ed, the underlying access method type must be speci\214ed using the) +4.362 F F24.363 E F1(option.)133 588 Q F2108 604.8 Q F1 .211 +(Specify the underlying access method.)15.97 F .211(If no)5.211 F F2 +2.711 E F1 .21 +(option is speci\214ed, the database will be loaded into a)2.711 F .078 +(database of the same type as w)133 616.8 R .078 +(as dumped, e.g., a hash database will be created if a hash database w) +-.1 F(as)-.1 E(dumped.)133 628.8 Q .368 +(Btree and hash databases may be con)133 652.8 R -.15(ve)-.4 G .368 +(rted from one to the other).15 F 5.367(.R)-.55 G .367 +(ecno databases may not be con-)-5.367 F -.15(ve)133 664.8 S(rted to an) +.15 E 2.5(yo)-.15 G(ther database type or from an)-2.5 E 2.5(yo)-.15 G +(ther database type.)-2.5 E(The)108 681.6 Q F3(db_load)3.418 E F1 .919 +(utility e)3.419 F .919(xits 0 on success, 1 if one or more k)-.15 F +-.15(ey)-.1 G .919(/data pairs were not loaded into the database).15 F +(because the k)108 693.6 Q .3 -.15(ey a)-.1 H(lready e).15 E +(xisted, and >1 if an error occurs.)-.15 E(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DB_LO)72 48 Q 349.56(AD\(1\) DB_LO)-.35 F +(AD\(1\))-.35 E/F1 9/Times-Bold@0 SF(KEYW)72 84 Q(ORDS)-.09 E F0 .165 +(The follo)108 96 R .165(wing k)-.25 F -.15(ey)-.1 G -.1(wo).15 G .165 +(rds are supported for the).1 F/F2 10/Times-Bold@0 SF2.664 E F0 +.164(command-line option.)2.664 F(See)5.164 E/F3 10/Times-Italic@0 SF +(db_open)2.664 E F0 .164(\(3\) for further discus-).24 F +(sion of these k)108 108 Q -.15(ey)-.1 G -.1(wo).15 G(rds and what v).1 +E(alues should be speci\214ed.)-.25 E .411 +(The parenthetical listing speci\214es ho)108 124.8 R 2.911(wt)-.25 G +.411(he v)-2.911 F .411(alue part of the `)-.25 F(`name=v)-.74 E(alue') +-.25 E 2.912('p)-.74 G .412(air is interpreted.)-2.912 F .412 +(Items listed)5.412 F .375(as \(boolean\) e)108 136.8 R .375(xpect v) +-.15 F .374(alue to be `)-.25 F(`1')-.74 E 2.874('\()-.74 G .374 +(set\) or `)-2.874 F(`0')-.74 E 2.874('\()-.74 G 2.874(unset\). Items) +-2.874 F .374(listed as \(number\) con)2.874 F -.15(ve)-.4 G .374(rt v) +.15 F .374(alue to a num-)-.25 F(ber)108 148.8 Q 5(.I)-.55 G +(tems listed as \(string\) use the characters of v)-5 E(alue directly) +-.25 E(.)-.65 E(bt_mink)108 165.6 Q .3 -.15(ey \()-.1 H(number\)).15 E +(The minimum number of k)133 177.6 Q -.15(ey)-.1 G 2.5(sp).15 G +(er page.)-2.5 E(db_lorder \(number\))108 194.4 Q +(The byte order for inte)133 206.4 Q +(gers in the stored database metadata.)-.15 E(db_pagesize \(number\))108 +223.2 Q(The size of pages used for nodes in the tree, in bytes.)133 +235.2 Q(duplicates \(boolean\))108 252 Q(The v)133 264 Q +(alue of the DB_DUP \215ag.)-.25 E(h_f)108 280.8 Q -.1(fa)-.25 G +(ctor \(number\)).1 E(The density within the hash table.)133 292.8 Q +(h_nelem \(number\))108 309.6 Q(The size of the hash table.)133 321.6 Q +(re_len \(number\))108 338.4 Q(Specify \214x)133 350.4 Q +(ed-length records of the speci\214ed length.)-.15 E(re_pad \(string\)) +108 367.2 Q(Specify the \214x)133 379.2 Q +(ed-length record pad character)-.15 E(.)-.55 E(recnum \(boolean\))108 +396 Q(The v)133 408 Q(alue of the DB_RECNUM \215ag.)-.25 E +(renumber \(boolean\))108 424.8 Q(The v)133 436.8 Q +(alue of the DB_RENUMBER \215ag.)-.25 E F1(EXAMPLES)72 453.6 Q F0(The) +108 465.6 Q F3(db_load)3.903 E F0 1.403(utility can be used to load te) +3.903 F 1.403(xt \214les into databases.)-.15 F -.15(Fo)6.403 G 3.903 +(re).15 G 1.403(xample, the follo)-4.053 F 1.404(wing command)-.25 F +.093(loads the standard UNIX)108 477.6 R F3(/etc/passwd)2.592 E F0 .092 +(\214le into a database, with the login name as the k)2.592 F .392 -.15 +(ey i)-.1 H .092(tem and the entire).15 F(passw)108 489.6 Q +(ord entry as the data item:)-.1 E -.15(aw)144 501.6 S 2.5(k-).15 G +(F: '{print $1; print $0}' < /etc/passwd |)-2.5 E(sed ')154 513.6 Q +(s/\\\\/\\\\\\\\/g' | db_load -T -t hash passwd.db)-.55 E .64 +(Note that backslash characters naturally occurring in the te)108 530.4 +R .641(xt are escaped to a)-.15 F -.2(vo)-.2 G .641 +(id interpretation as escape).2 F(characters by)108 542.4 Q F3(db_load) +2.5 E F0(.).77 E F1(ENVIR)72 559.2 Q(ONMENT V)-.27 E(ARIABLES)-1.215 E +F0(The follo)108 571.2 Q(wing en)-.25 E(vironment v)-.4 E(ariables af) +-.25 E(fect the e)-.25 E -.15(xe)-.15 G(cution of).15 E F3(db_load)2.5 E +F0(:).77 E(DB_HOME)108 588 Q .222(If the)133 600 R F22.722 E F0 +.222(option is not speci\214ed and the en)2.722 F .222(vironment v)-.4 F +(ariable)-.25 E F3(DB_HOME)2.722 E F0 .221 +(is set, it is used as the path)2.721 F +(of the database home, as described in)133 612 Q F3(db_appinit)2.5 E F0 +(\(3\).).68 E F1(SEE ALSO)72 628.8 Q F0 .485(The DB library is a f)108 +640.8 R .485(amily of groups of functions that pro)-.1 F .486 +(vides a modular programming interf)-.15 F .486(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 652.8 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .506(\214le page caching, as well as v)108 664.8 R .506 +(arious inde)-.25 F -.15(xe)-.15 G 3.006(da).15 G .506(ccess methods.) +-3.006 F(Man)5.507 E 3.007(yo)-.15 G 3.007(ft)-3.007 G .507 +(he functional groups \(e.g., the \214le)-3.007 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 676.8 R .121(are e)108 688.8 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.122 G 2.622(rag).15 G .122(eneral description of)-2.622 +F(the DB package, see)108 700.8 Q F3(db_intr)2.5 E(o)-.45 E F0(\(3\).) +.18 E F3(db_ar)108 717.6 Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E F3 +(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F0(\(1\),).68 E F3(db_deadloc)2.5 E +(k)-.2 E F0(\(1\),).67 E F3(db_dump)2.5 E F0(\(1\),).19 E F3(db_load)2.5 +E F0(\(1\),).77 E F3(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F3 +(db_stat)2.5 E F0(\(1\),).68 E F3(db_intr)108 729.6 Q(o)-.45 E F0 +(\(3\),).18 E F3(db_appinit)2.5 E F0(\(3\),).68 E F3(db_cur)2.5 E(sor) +-.1 E F0(\(3\),).73 E F3(db_dbm)2.5 E F0(\(3\),).32 E F3(db_internal)2.5 +E F0(\(3\),).51 E F3(db_loc)2.5 E(k)-.2 E F0(\(3\),).67 E F3(db_lo)2.5 E +(g)-.1 E F0(\(3\),).22 E F3(db_mpool)2.5 E F0(\(3\),).51 E(June 2, 1998) +280.585 768 Q(2)203.585 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DB_LO)72 48 Q 349.56(AD\(1\) DB_LO)-.35 F +(AD\(1\))-.35 E/F1 10/Times-Italic@0 SF(db_open)108 84 Q F0(\(3\),).24 E +F1(db_thr)2.5 E(ead)-.37 E F0(\(3\),).77 E F1(db_txn)2.5 E F0(\(3\)).24 +E(June 2, 1998)280.585 768 Q(3)203.585 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/man.ps/db_lock.ps b/mozilla/db/man/man.ps/db_lock.ps new file mode 100644 index 00000000000..1712b270ae8 --- /dev/null +++ b/mozilla/db/man/man.ps/db_lock.ps @@ -0,0 +1,830 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:22 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 8 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_lock \255 lock manager)108 40.8 Q F0(SYNOPSIS)72 57.6 Q/F2 10 +/Times-Bold@0 SF(#include )-.4 E(int)108 93.6 Q +(lock_open\(const char *dir)108 105.6 Q(,)-.92 E +(u_int32_t \215ags, int mode, DB_ENV *dben)158 117.6 Q 1.1 -.55(v, D)-.4 +H(B_LOCKT).55 E(AB **r)-.9 E(egionp\);)-.18 E(int)108 141.6 Q +(lock_id\(DB_LOCKT)108 153.6 Q(AB *lt, u_int32_t *idp\);)-.9 E(int)108 +177.6 Q(lock_v)108 189.6 Q(ec\(DB_LOCKT)-.1 E(AB *lt, u_int32_t lock)-.9 +E(er)-.1 E 2.5(,u)-.92 G(_int32_t \215ags,)-2.5 E +(DB_LOCKREQ list[], int nlist, DB_LOCKREQ **elistp\);)158 201.6 Q(int) +108 225.6 Q(lock_get\(DB_LOCKT)108 237.6 Q(AB *lt, u_int32_t lock)-.9 E +(er)-.1 E 2.5(,u)-.92 G(_int32_t \215ags,)-2.5 E +(const DBT *obj, const db_lockmode_t lock_mode, DB_LOCK *lock\);)158 +249.6 Q(int)108 273.6 Q(lock_put\(DB_LOCKT)108 285.6 Q +(AB *lt, DB_LOCK lock\);)-.9 E(int)108 309.6 Q(lock_close\(DB_LOCKT)108 +321.6 Q(AB *lt\);)-.9 E(int)108 345.6 Q(lock_unlink\(const char *dir)108 +357.6 Q 2.5(,i)-.92 G(nt f)-2.5 E(or)-.25 E(ce, DB_ENV *dben)-.18 E +(v\);)-.4 E(int)108 381.6 Q(lock_detect\(DB_LOCKT)108 393.6 Q +(AB *lt, u_int32_t \215ags, u_int32_t atype\);)-.9 E(int)108 417.6 Q +(lock_stat\(DB_LOCKT)108 429.6 Q(AB *lt,)-.9 E(DB_LOCK_ST)158 441.6 Q +1.9 -.95(AT *)-.9 H(*spp, v).95 E(oid *\(*db_malloc\)\(size_t\)\);)-.1 E +F0(DESCRIPTION)72 458.4 Q F1 .486(The DB library is a f)108 470.4 R .485 +(amily of groups of functions that pro)-.1 F .485 +(vides a modular programming interf)-.15 F .485(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 482.4 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .507(\214le page caching, as well as v)108 494.4 R .507 +(arious inde)-.25 F -.15(xe)-.15 G 3.007(da).15 G .506(ccess methods.) +-3.007 F(Man)5.506 E 3.006(yo)-.15 G 3.006(ft)-3.006 G .506 +(he functional groups \(e.g., the \214le)-3.006 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 506.4 R .122(are e)108 518.4 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.121 G 2.621(rag).15 G .121(eneral description of)-2.621 +F(the DB package, see)108 530.4 Q/F3 10/Times-Italic@0 SF(db_intr)2.5 E +(o)-.45 E F1(\(3\).).18 E(This manual page describes the speci\214c details of the locking interf) +108 547.2 Q(ace.)-.1 E(The)108 564 Q F3(db_loc)5.443 E(k)-.2 E F1 2.943 +(functions are the library interf)5.443 F 2.943(ace intended to pro)-.1 +F 2.944(vide general-purpose locking.)-.15 F(While)7.944 E .173 +(designed to w)108 576 R .172(ork with the other DB functions, these functions are also useful for more general locking pur) +-.1 F(-)-.2 E 4.01(poses. Locks)108 588 R 1.51 +(can be shared between processes.)4.01 F 1.511 +(In most cases, when multiple threads or processes are)6.511 F +(using locking, the deadlock detector)108 600 Q(,)-.4 E F3(db_deadloc) +2.5 E(k)-.2 E F1(\(1\), should be run.).67 E F3(loc)92 616.8 Q(k_open) +-.2 E F1(The)108 628.8 Q F3(loc)2.935 E(k_open)-.2 E F1 .434 +(function copies a pointer)2.935 F 2.934(,t)-.4 G 2.934(ot)-2.934 G .434 +(he lock table identi\214ed by the)-2.934 F F2(dir)2.934 E(ectory)-.18 E +F3(dir)2.934 E F1 2.934(,i).73 G .434(nto the memory)-2.934 F +(location referenced by)108 640.8 Q F3 -.37(re)2.5 G(gionp)-.03 E F1(.) +.19 E 1.594(If the)108 657.6 R F3(dben)4.094 E(v)-.4 E F1(ar)4.094 E +1.594(gument to)-.18 F F3(loc)4.094 E(k_open)-.2 E F1 -.1(wa)4.095 G +4.095(si).1 G 1.595(nitialized using)-4.095 F F3(db_appinit)4.095 E F1 +(,).68 E F3(dir)4.095 E F1 1.595(is interpreted as described by)4.095 F +F3(db_appinit)108 669.6 Q F1(\(3\).).68 E .668(Otherwise, if)108 686.4 R +F3(dir)3.168 E F1 .668(is not NULL, it is interpreted relati)3.168 F +.968 -.15(ve t)-.25 H 3.168(ot).15 G .668(he current w)-3.168 F .667 +(orking directory of the process.)-.1 F(If)5.667 E F3(dir)108 698.4 Q F1 +2.387(is NULL, the follo)4.887 F 2.388(wing en)-.25 F 2.388(vironment v) +-.4 F 2.388(ariables are check)-.25 F 2.388(ed in order: `)-.1 F +(`TMPDIR')-.74 E 2.388(', `)-.74 F(`TEMP')-.74 E 2.388(', and)-.74 F +-.74(``)108 710.4 S(TMP').74 E 3.268('. If)-.74 F .768 +(one of them is set, lock table \214les are created relati)3.268 F 1.068 +-.15(ve t)-.25 H 3.268(ot).15 G .768(he directory it speci\214es.)-3.268 +F .768(If none of)5.768 F 1.5 +(them are set, the \214rst possible one of the follo)108 722.4 R 1.501 +(wing directories is used:)-.25 F F3(/var/tmp)4.001 E F1(,).19 E F3 +(/usr/tmp)4.001 E F1(,).19 E F3(/temp)4.001 E F1(,).19 E F3(/tmp)4.001 E +F1(,).19 E(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 349.96(DB_LOCK\(3\) DB_LOCK\(3\))72 48 R/F1 10 +/Times-Italic@0 SF(C:/temp)108 84 Q F0(and)2.5 E F1(C:/tmp)2.5 E F0(.) +.19 E(All \214les associated with the lock table are created in this directory) +108 100.8 Q 5(.T)-.65 G(his directory must already e)-5 E(xist when)-.15 +E 1.132(lock table_open is called.)108 124.8 R 1.132 +(If the lock table already e)6.132 F 1.132(xists, the process must ha) +-.15 F 1.431 -.15(ve p)-.2 H 1.131(ermission to read and).15 F +(write the e)108 136.8 Q(xisting \214les.)-.15 E +(If the lock table does not already e)5 E +(xist, it is optionally created and initialized.)-.15 E(The)108 153.6 Q +F1<8d61>3.76 E(gs)-.1 E F0(and)3.76 E F1(mode)3.76 E F0(ar)3.76 E 1.26 +(guments specify ho)-.18 F 3.761<778c>-.25 G 1.261 +(les will be opened and/or created when the)-3.761 F 3.761(yd)-.15 G +(on')-3.761 E 3.761(ta)-.18 G(lready)-3.761 E -.15(ex)108 165.6 S 2.5 +(ist. The).15 F(\215ags v)2.5 E(alue is speci\214ed by)-.25 E/F2 10 +/Times-Bold@0 SF(or)2.5 E F0('ing together one or more of the follo)A +(wing v)-.25 E(alues:)-.25 E(DB_CREA)108 182.4 Q(TE)-1.11 E .484 +(Create an)133 194.4 R 2.984(yu)-.15 G .483 +(nderlying \214les, as necessary)-2.984 F 5.483(.I)-.65 G 2.983(ft) +-5.483 G .483(he \214les do not already e)-2.983 F .483 +(xist and the DB_CREA)-.15 F .483(TE \215ag)-1.11 F +(is not speci\214ed, the call will f)133 206.4 Q(ail.)-.1 E(DB_THREAD) +108 235.2 Q 1.975(Cause the DB_LOCKT)133 247.2 R 1.975 +(AB handle returned by the)-.93 F F1(loc)4.475 E(k_open)-.2 E F0 1.976 +(function to be useable by multiple)4.475 F +(threads within a single address space, i.e., to be `)133 259.2 Q +(`free-threaded')-.74 E('.)-.74 E .528 +(All \214les created by the lock subsystem are created with mode)108 276 +R F1(mode)3.028 E F0 .527(\(as described in)3.027 F F1 -.15(ch)3.027 G +(mod).15 E F0 .527(\(2\)\) and modi-).77 F .816 +(\214ed by the process' umask v)108 288 R .816 +(alue at the time of creation \(see)-.25 F F1(umask)3.317 E F0 3.317 +(\(2\)\). The).67 F .817(group o)3.317 F .817(wnership of created)-.25 F +(\214les is based on the system and directory def)108 300 Q +(aults, and is not further speci\214ed by DB.)-.1 E 1.133 +(The locking subsystem is con\214gured based on the)108 316.8 R F1(dben) +3.633 E(v)-.4 E F0(ar)3.633 E 1.133(gument to)-.18 F F1(loc)3.633 E +(k_open)-.2 E F0 3.633(,w).24 G 1.133(hich is a pointer to a)-3.633 F +1.923(structure of type DB_ENV \(typedef)108 328.8 R 2.924 -.5('d i).55 +H 4.424(n<).5 G(db)-4.424 E 4.424(.h>\). Applications)-.4 F 1.924 +(will normally use the same DB_ENV)4.424 F(structure \(initialized by) +108 340.8 Q F1(db_appinit)2.5 E F0(\(3\)\), as an ar).68 E +(gument to all of the subsystems in the DB package.)-.18 E .439(References to the DB_ENV structure are maintained by DB, so it may not be discarded until the last close) +108 357.6 R .286 +(function, corresponding to an open function for which it w)108 369.6 R +.287(as an ar)-.1 F .287(gument, has returned.)-.18 F .287 +(In order to ensure)5.287 F 1.578(compatibility with future releases of DB, all \214elds of the DB_ENV structure that are not e) +108 381.6 R 1.578(xplicitly set)-.15 F .17(should be initialized to 0 before the \214rst time the structure is used.) +108 393.6 R .171(Do this by declaring the structure e)5.171 F(xter)-.15 +E(-)-.2 E(nal or static, or by calling the C library routine)108 405.6 Q +F1(bzer)2.5 E(o)-.45 E F0(\(3\) or).18 E F1(memset)2.5 E F0(\(3\).).68 E +.007(The \214elds of the DB_ENV structure used by)108 422.4 R F1(loc) +2.507 E(k_open)-.2 E F0 .007(are described belo)2.507 F 3.807 -.65(w. I) +-.25 H(f).65 E F1(dben)2.507 E(v)-.4 E F0 .007(is NULL or an)2.507 F +2.506(yo)-.15 G 2.506(fi)-2.506 G(ts)-2.506 E +(\214elds are set to 0, def)108 434.4 Q +(aults appropriate for the system are used where possible.)-.1 E +(The follo)108 451.2 Q(wing \214elds in the DB_ENV structure may be initialized before calling) +-.25 E F1(loc)2.5 E(k_open)-.2 E F0(:).24 E -.2(vo)108 468 S +(id *\(*db_errcall\)\(char *db_errpfx, char *b).2 E(uf)-.2 E(fer\);)-.25 +E(FILE *db_err\214le;)108 480 Q(const char *db_errpfx;)108 492 Q +(int db_v)108 504 Q(erbose;)-.15 E +(The error \214elds of the DB_ENV beha)133 516 Q .3 -.15(ve a)-.2 H 2.5 +(sd).15 G(escribed for)-2.5 E F1(db_appinit)2.5 E F0(\(3\).).68 E +(const u_int8_t lk_con\215icts[][];)108 556.8 Q(A)133 568.8 Q F1 +(lk_modes)2.5 E F0(by)2.5 E F1(lk_modes)2.5 E F0(array)2.5 E 5(.A)-.65 G +(non-0 v)-2.5 E(alue for the array element:)-.25 E +(lk_con\215icts[requested_mode][held_mode])183 592.8 Q 1.914 +(indicates that requested_mode and held_mode con\215ict.)133 616.8 R +1.915(The `)6.915 F(`not-granted')-.74 E 4.415('m)-.74 G 1.915 +(ode must be repre-)-4.415 F 1.618(sented by 0.)133 628.8 R(If)6.618 E +F1(lk_con\215icts)4.118 E F0 1.618(is NULL, the con\215icts array)4.118 +F F1(db_rw_con\215icts)4.118 E F0 1.618(is used; see the section)4.118 F +(belo)133 640.8 Q 2.5(we)-.25 G(ntitled `)-2.5 E(`ST)-.74 E(AND)-.93 E +(ARD LOCK MODES')-.4 E 2.5('f)-.74 G(or a description of that array)-2.5 +E(.)-.65 E(db_detect_t lk_detect;)108 657.6 Q 1.11 +(If non-0, speci\214es that the deadlock detector be run whene)133 669.6 +R -.15(ve)-.25 G 3.611(ral).15 G 1.111 +(ock con\215ict occurs, and speci\214es)-3.611 F .27 +(which transaction should be aborted in the case of a deadlock.)133 +681.6 R(The)5.269 E F1(lk_detect)2.769 E F0 .269 +(\214eld must be set to one)2.769 F(of the follo)133 693.6 Q(wing v)-.25 +E(alues.)-.25 E(May 10, 1998)278.085 768 Q(2)201.085 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 349.96(DB_LOCK\(3\) DB_LOCK\(3\))72 48 R +(DB_LOCK_DEF)133 84 Q -.55(AU)-.74 G -.92(LT).55 G(Use the def)158 96 Q +(ault polic)-.1 E 2.5(ya)-.15 G 2.5(ss)-2.5 G(peci\214ed in the)-2.5 E +/F1 10/Times-Italic@0 SF(db_deadloc)2.5 E(k)-.2 E F0(\(1\) man page.).67 +E(DB_LOCK_OLDEST)133 112.8 Q(Abort the oldest transaction.)158 124.8 Q +(DB_LOCK_RANDOM)133 141.6 Q(Abort a random transaction in)158 153.6 Q +-.2(vo)-.4 G(lv).2 E(ed in the deadlock.)-.15 E(DB_LOCK_Y)133 170.4 Q +(OUNGEST)-.3 E(Abort the youngest transaction.)158 182.4 Q +(u_int32_t lk_max;)108 199.2 Q .293 +(The maximum number of locks to be held or requested in the table.)133 +211.2 R .294(This v)5.294 F .294(alue is used by)-.25 F F1(loc)2.794 E +(k_open)-.2 E F0 1.88(to estimate ho)133 223.2 R 4.38(wm)-.25 G 1.88 +(uch space to allocate for v)-4.38 F 1.88 +(arious lock-table data structures.)-.25 F(If)6.88 E F1(lk_max)4.38 E F0 +1.88(is 0, a)4.38 F(def)133 235.2 Q(ault v)-.1 E(alue is used.)-.25 E +(u_int32_t lk_modes;)108 252 Q .049(The number of lock modes to be recognized by the lock table \(including the `) +133 264 R(`not-granted')-.74 E 2.55('m)-.74 G 2.55(ode\). If)-2.55 F F1 +(lk_modes)133 276 Q F0(is 0, the v)2.5 E(alue DB_LOCK_R)-.25 E +(W_N is used; see belo)-.55 E 2.5(wf)-.25 G(or a description of that v) +-2.5 E(alue.)-.25 E(The)108 292.8 Q F1(loc)2.5 E(k_open)-.2 E F0 +(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E F1(loc)92 309.6 Q(k_id)-.2 E F0(The)108 +321.6 Q F1(loc)3.126 E(k_id)-.2 E F0 .626(function copies a lock)3.126 F +.625(er ID, which is guaranteed to be unique in the speci\214ed lock table, into) +-.1 F(the memory location referenced by)108 333.6 Q F1(idp)2.5 E F0(.) +.19 E .099(The access methods \(see)108 350.4 R F1(db_open)2.599 E F0 +.099(\(3\)\), generate a unique lock).24 F .1 +(er ID for each \214le that is opened with locking.)-.1 F .26 +(During DB access method operation, this lock)108 362.4 R .259 +(er ID will be used for all lock calls unless a transaction iden-)-.1 F +(ti\214er w)108 374.4 Q(as speci\214ed for the call, in which case the transaction ID speci\214ed is used for locking.) +-.1 E(The)108 391.2 Q F1(loc)2.5 E(k_id)-.2 E F0(function returns the v) +2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 E +(ailure and 0 on success.)-.1 E F1(loc)92 408 Q(k_vec)-.2 E F0(The)108 +420 Q F1(loc)3.173 E(k_vec)-.2 E F0 .673(function atomically obtains and releases one or more locks from the speci\214ed table,) +3.173 F F1(lt)3.174 E F0 5.674(.T).68 G(he)-5.674 E F1(loc)108 432 Q +(k_vec)-.2 E F0 2.02(function is intended to support acquisition or trading of multiple locks under one lock table) +4.52 F(semaphore, as is needed for lock coupling or in multigranularity locking for lock escalation.) +108 444 Q(The)108 460.8 Q F1(loc)3.57 E -.1(ke)-.2 G(r).1 E F0(ar)3.57 E +1.07(gument speci\214ed to)-.18 F F1(loc)3.57 E(k_vec)-.2 E F0 1.07 +(is an unsigned 32-bit inte)3.57 F 1.07(ger quantity)-.15 F 6.07(.I)-.65 +G 3.57(tr)-6.07 G 1.07(epresents the entity)-3.57 F +(requesting or releasing the lock.)108 472.8 Q(The)108 489.6 Q F1<8d61> +2.5 E(gs)-.1 E F0 -.25(va)2.5 G(lue must be set to 0 or the follo).25 E +(wing v)-.25 E(alue:)-.25 E(DB_LOCK_NO)108 506.4 Q -1.2(WA)-.35 G(IT)1.2 +E .191(If a lock cannot be granted because the requested lock con\215icts with an e) +133 518.4 R .191(xisting lock, return immedi-)-.15 F(ately instead of w) +133 530.4 Q(aiting for the lock to become a)-.1 E -.25(va)-.2 G(ilable.) +.25 E(The)108 547.2 Q F1(list)2.625 E F0 .125(array pro)2.625 F .125 +(vided to)-.15 F F1(loc)2.626 E(k_vec)-.2 E F0 .126(is typedef)2.626 F +1.126 -.5('d i).55 H 2.626(n<).5 G(db)-2.626 E .126(.h> as DB_LOCKREQ.) +-.4 F 2.626(AD)5.126 G .126(B_LOCKREQ structure)-2.626 F +(has at least the follo)108 559.2 Q +(wing \214elds, which must be initialized before calling)-.25 E F1(loc) +2.5 E(k_vec)-.2 E F0(:).31 E(lock)108 576 Q(op_t op;)-.1 E +(The operation to be performed, which must be set to one of the follo) +133 588 Q(wing v)-.25 E(alues:)-.25 E(DB_LOCK_GET)133 604.8 Q .075 +(Get a lock, as de\214ned by the v)158 616.8 R .075(alues of)-.25 F F1 +(loc)2.574 E -.1(ke)-.2 G(r).1 E F0(,).73 E F1(obj)2.574 E F0(and)2.574 +E F1(mode)2.574 E F0 5.074(.U).18 G .074(pon return from)-5.074 F F1 +(loc)2.574 E(k_vec)-.2 E F0 2.574(,i).31 G 2.574(ft)-2.574 G(he)-2.574 E +F1(loc)158 628.8 Q(k)-.2 E F0 1.45 +(\214eld is non-NULL, a reference to the acquired lock is stored there.) +3.95 F 1.45(\(This reference is)6.45 F(in)158 640.8 Q -.25(va)-.4 G +(lidated by an).25 E 2.5(yc)-.15 G(all to)-2.5 E F1(loc)2.5 E(k_vec)-.2 +E F0(or)2.5 E F1(loc)2.5 E(k_put)-.2 E F0(that releases the lock.\))2.5 +E(DB_LOCK_PUT)133 657.6 Q(The lock referenced by the contents of the)158 +669.6 Q F1(loc)2.5 E(k)-.2 E F0(\214eld is released.)2.5 E +(DB_LOCK_PUT_ALL)133 686.4 Q .759(All locks held by the)158 698.4 R F1 +(loc)3.259 E -.1(ke)-.2 G(r).1 E F0 .759(are released.)3.259 F(\(An) +5.759 E 3.259(yl)-.15 G .759 +(ocks acquired as a part of the current call to)-3.259 F F1(loc)158 +710.4 Q(k_vec)-.2 E F0 .84(that appear after the DB_LOCK_PUT_ALL entry are not considered for this opera-) +3.34 F(tion\).)158 722.4 Q(May 10, 1998)278.085 768 Q(3)201.085 E EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 349.96(DB_LOCK\(3\) DB_LOCK\(3\))72 48 R +(DB_LOCK_PUT_OBJ)133 84 Q 1.41(All locks held by the)158 96 R/F1 10 +/Times-Italic@0 SF(loc)3.91 E -.1(ke)-.2 G(r).1 E F0 3.91(,o).73 G 3.909 +(nt)-3.91 G 1.409(he object)-3.909 F F1(obj)3.909 E F0 3.909(,w).48 G +1.409(ith the mode speci\214ed by)-3.909 F F1(loc)3.909 E(k_mode)-.2 E +F0 3.909(,a).18 G(re)-3.909 E 4.276(released. A)158 108 R F1(loc)4.276 E +(k_mode)-.2 E F0 1.776 +(of DB_LOCK_NG indicates that all locks on the object should be)4.276 F +2.532(released. Note)158 120 R .032(that an)2.532 F 2.531(yl)-.15 G .031 +(ocks acquired as a part of the current call to)-2.531 F F1(loc)2.531 E +(k_vec)-.2 E F0 .031(that occur before)2.531 F 3.403 +(the DB_LOCK_PUT_OBJ will also be released; those acquired afterw)158 +132 R 3.403(ards will not be)-.1 F(released.)158 144 Q(const DBT obj;) +108 160.8 Q +(An untyped byte string that speci\214es the object to be lock)133 172.8 +Q(ed or released.)-.1 E(const lockmode_t mode;)108 189.6 Q +(The lock mode, used as an inde)133 201.6 Q 2.5(xi)-.15 G(nto)-2.5 E F1 +(lt)2.5 E F0 1.1 -.55('s c).68 H(on\215ict array).55 E(.)-.65 E +(DB_LOCK lock;)108 218.4 Q 2.5(Al)133 230.4 S(ock reference.)-2.5 E(The) +108 247.2 Q F1(nlist)2.5 E F0(ar)2.5 E +(gument speci\214es the number of elements in the)-.18 E F1(list)2.5 E +F0(array)2.5 E(.)-.65 E .51(If an)108 264 R 3.01(yo)-.15 G 3.01(ft)-3.01 +G .51(he requested locks cannot be acquired, or an)-3.01 F 3.01(yo)-.15 +G 3.01(ft)-3.01 G .51(he locks to be released cannot be released, the) +-3.01 F .348(operations before the f)108 276 R .348 +(ailing operation are guaranteed to ha)-.1 F .649 -.15(ve c)-.2 H .349 +(ompleted successfully).15 F 2.849(,a)-.65 G(nd)-2.849 E F1(loc)2.849 E +(k_vec)-.2 E F0(returns)2.849 E 2.841(an)108 288 S .341(on-zero v)-2.841 +F 2.841(alue. In)-.25 F .341(addition, if)2.841 F F1(elistp)2.841 E F0 +.341(is not NULL, it is set to point to the DB_LOCKREQ entry that w) +2.841 F(as)-.1 E(being processed when the error occurred.)108 300 Q +(In the case of an error)108 316.8 Q(,)-.4 E F1(loc)2.5 E(k_vec)-.2 E F0 +(may return one of the follo)2.5 E(wing v)-.25 E(alues:)-.25 E +(DB_LOCK_DEADLOCK)108 333.6 Q(The speci\214ed)133 345.6 Q F1(loc)2.5 E +-.1(ke)-.2 G(r).1 E F0 -.1(wa)2.5 G 2.5(ss).1 G +(elected as a victim in order to resolv)-2.5 E 2.5(ead)-.15 G(eadlock.) +-2.5 E(DB_LOCK_NO)108 362.4 Q(THELD)-.4 E +(The lock cannot be released, as it w)133 374.4 Q(as not held by the)-.1 +E F1(loc)2.5 E -.1(ke)-.2 G(r).1 E F0(.).73 E(DB_LOCK_NO)108 391.2 Q +(TGRANTED)-.4 E 8.232(Al)133 403.2 S 5.732(ock w)-8.232 F 5.732 +(as requested that could not be granted and the)-.1 F F1<8d61>8.232 E(g) +-.1 E F0 5.732(parameter w)8.232 F 5.732(as set to)-.1 F(DB_LOCK_NO)133 +415.2 Q -1.2(WA)-.35 G(IT)1.2 E 5(.I)-.74 G 2.5(nt)-5 G +(his case, if non-NULL,)-2.5 E F1(elistp)2.5 E F0 +(identi\214es the request that w)2.5 E(as granted.)-.1 E(Otherwise, the) +108 432 Q F1(loc)2.5 E(k_vec)-.2 E F0(function returns the v)2.5 E +(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 E(ailure and 0 on success.) +-.1 E F1(loc)92 448.8 Q(k_g)-.2 E(et)-.1 E F0(The)108 460.8 Q F1(loc) +3.729 E(k_g)-.2 E(et)-.1 E F0 1.228(function is a simple interf)3.729 F +1.228(ace to the)-.1 F F1(loc)3.728 E(k_vec)-.2 E F0(functionality)3.728 +E 3.728(,a)-.65 G 1.228(nd is equi)-3.728 F -.25(va)-.25 G 1.228 +(lent to calling the).25 F F1(loc)108 472.8 Q(k_vec)-.2 E F0 .564 +(function with the)3.064 F F1(lt)3.064 E F0(and)3.064 E F1(loc)3.064 E +-.1(ke)-.2 G(r).1 E F0(ar)3.064 E(guments,)-.18 E F1(elistp)3.064 E F0 +(and)3.064 E F1(con\215ict)3.064 E F0(ar)3.065 E .565 +(guments, and a single element)-.18 F F1(list)3.065 E F0(array)108 484.8 +Q 2.831(,f)-.65 G .331(or which the)-2.831 F F1(op)2.831 E F0 .331 +(\214eld is DB_LOCK_GET)2.831 F 2.831(,a)-.74 G .331(nd the)-2.831 F F1 +(obj)2.831 E F0(,).48 E F1(loc)2.83 E(k_mode)-.2 E F0(and)2.83 E F1(loc) +2.83 E(k)-.2 E F0 .33(\214elds are represented by)2.83 F .756(the ar)108 +496.8 R .756(guments of the same name.)-.18 F .756 +(Note that the type of the)5.756 F F1(obj)3.256 E F0(ar)3.256 E .757 +(gument to)-.18 F F1(loc)3.257 E(k_g)-.2 E(et)-.1 E F0 .757(is dif)3.257 +F .757(ferent from the)-.25 F F1(obj)108 508.8 Q F0 1.01 +(element found in the DB_LOCKREQ structure.)3.51 F(The)6.01 E F1(loc) +3.51 E(k_g)-.2 E(et)-.1 E F0 1.01(function returns success and f)3.51 F +1.01(ailure as)-.1 F(described for the)108 520.8 Q F1(loc)2.5 E(k_vec) +-.2 E F0(function.)2.5 E F1(loc)92 537.6 Q(k_put)-.2 E F0(The)108 549.6 +Q F1(loc)3.686 E(k_put)-.2 E F0 1.187(function is a simple interf)3.686 +F 1.187(ace to the)-.1 F F1(loc)3.687 E(k_vec)-.2 E F0(functionality) +3.687 E 3.687(,a)-.65 G 1.187(nd is equi)-3.687 F -.25(va)-.25 G 1.187 +(lent to calling the).25 F F1(loc)108 561.6 Q(k_vec)-.2 E F0 .772 +(function with a single element)3.272 F F1(list)3.271 E F0(array)3.271 E +3.271(,f)-.65 G .771(or which the)-3.271 F F1(op)3.271 E F0 .771 +(\214eld is DB_LOCK_PUT and the)3.271 F F1(loc)3.271 E(k)-.2 E F0 .102 +(\214eld is represented by the ar)108 573.6 R .102 +(gument of the same name.)-.18 F(The)5.102 E F1(loc)2.602 E(k_put)-.2 E +F0 .103(function returns success and f)2.603 F .103(ailure as)-.1 F +(described for the)108 585.6 Q F1(loc)2.5 E(k_vec)-.2 E F0(function.)2.5 +E F1(loc)92 602.4 Q(k_close)-.2 E F0(The)108 614.4 Q F1(loc)3.046 E +(k_close)-.2 E F0 .545 +(function disassociates the calling process from the lock table)3.046 F +F1(lt)3.045 E F0 5.545(.N).68 G .545(ote that)-5.545 F F1(loc)3.045 E +(k_close)-.2 E F0(does)3.045 E .96(not release an)108 626.4 R 3.46(yl) +-.15 G .961(ocks still held by the closing process.)-3.46 F .961 +(\(This pro)5.961 F .961(vides functionality for long-li)-.15 F -.15(ve) +-.25 G 3.461(dl).15 G(ocks.\))-3.461 E(Processes that wish to ha)108 +638.4 Q .3 -.15(ve a)-.2 H +(ll their locks released can do so by issuing the appropriate).15 E F1 +(loc)2.5 E(k_vec)-.2 E F0(call.)2.5 E .187(In addition, if the)108 655.2 +R F1(dir)2.687 E F0(ar)2.687 E .187(gument to)-.18 F F1(loc)2.687 E +(k_open)-.2 E F0 -.1(wa)2.687 G 2.686(sN).1 G .186(ULL and)-2.686 F F1 +(dben)2.686 E(v)-.4 E F0 -.1(wa)2.686 G 2.686(sn).1 G .186 +(ot initialized using)-2.686 F F1(db_appinit)2.686 E F0 2.686(,a).68 G +(ll)-2.686 E(\214les created for this shared re)108 667.2 Q +(gion will be remo)-.15 E -.15(ve)-.15 G(d, as if).15 E F1(loc)2.5 E +(k_unlink)-.2 E F0(were called.)2.5 E .206 +(When multiple threads are using the DB_LOCKT)108 684 R .206 +(AB handle concurrently)-.93 F 2.706(,o)-.65 G .206 +(nly a single thread may call the)-2.706 F F1(loc)108 696 Q(k_close)-.2 +E F0(function.)2.5 E(The)108 712.8 Q F1(loc)2.5 E(k_close)-.2 E F0 +(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E(May 10, 1998)278.085 768 Q(4)201.085 E +EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 349.96(DB_LOCK\(3\) DB_LOCK\(3\))72 48 R/F1 10 +/Times-Italic@0 SF(loc)92 84 Q(k_unlink)-.2 E F0(The)108 96 Q F1(loc) +3.287 E(k_unlink)-.2 E F0 .787(function destro)3.287 F .787 +(ys the lock table identi\214ed by the directory)-.1 F F1(dir)3.287 E F0 +3.287(,r).73 G(emo)-3.287 E .787(ving all \214les used to)-.15 F 1.976 +(implement the lock table.)108 108 R 1.977(\(The directory)6.977 F F1 +(dir)4.477 E F0 1.977(is not remo)4.477 F -.15(ve)-.15 G 4.477(d.\) If) +.15 F 1.977(there are processes that ha)4.477 F 2.277 -.15(ve c)-.2 H +(alled).15 E F1(loc)108 120 Q(k_open)-.2 E F0 .87(without calling)3.37 F +F1(loc)3.37 E(k_close)-.2 E F0 .869 +(\(i.e., there are processes currently using the lock table\),)3.369 F +F1(loc)3.369 E(k_unlink)-.2 E F0 .085(will f)108 132 R .085(ail without further action, unless the force \215ag is set, in which case) +-.1 F F1(loc)2.586 E(k_unlink)-.2 E F0 .086(will attempt to remo)2.586 F +-.15(ve)-.15 G(the lock table \214les re)108 144 Q -.05(ga)-.15 G +(rdless of an).05 E 2.5(yp)-.15 G(rocesses still using the lock table.) +-2.5 E .766(The result of attempting to forcibly destro)108 160.8 R +3.266(yt)-.1 G .766(he re)-3.266 F .766(gion when a process has the re) +-.15 F .765(gion open is unspeci\214ed.)-.15 F 1.232 +(Processes using a shared memory re)108 172.8 R 1.232 +(gion maintain an open \214le descriptor for it.)-.15 F 1.232 +(On UNIX systems, the)6.232 F(re)108 184.8 Q .474(gion remo)-.15 F -.25 +(va)-.15 G 2.974(ls).25 G .473(hould succeed and processes that ha) +-2.974 F .773 -.15(ve a)-.2 H .473(lready joined the re).15 F .473 +(gion should continue to run in)-.15 F .337(the re)108 196.8 R .337 +(gion without change, ho)-.15 F(we)-.25 E -.15(ve)-.25 G 2.837(rp).15 G +.337(rocesses attempting to join the lock table will either f)-2.837 F +.337(ail or attempt to)-.1 F .45(create a ne)108 208.8 R 2.95(wr)-.25 G +-.15(eg)-2.95 G 2.95(ion. On).15 F .45(other systems, e.g., WNT)2.95 F +2.949(,w)-.74 G .449(here the)-2.949 F F1(unlink)2.949 E F0 .449 +(\(2\) system call will f).67 F .449(ail if an)-.1 F 2.949(yp)-.15 G +(rocess)-2.949 E(has an open \214le descriptor for the \214le, the re) +108 220.8 Q(gion remo)-.15 E -.25(va)-.15 G 2.5(lw).25 G(ill f)-2.5 E +(ail.)-.1 E .929(In the case of catastrophic or system f)108 237.6 R +.929(ailure, database reco)-.1 F -.15(ve)-.15 G .93 +(ry must be performed \(see).15 F F1(db_r)3.43 E(eco)-.37 E(ver)-.1 E F0 +.93(\(1\) or).73 F .74(the DB_RECO)108 249.6 R .74(VER and DB_RECO)-.5 F +(VER_F)-.5 E -1.21 -1.11(AT A)-.74 H 3.24<4c8d>1.11 G .74(ags to)-3.24 F +F1(db_appinit)3.24 E F0 3.24(\(3\)\). Alternati).68 F -.15(ve)-.25 G(ly) +.15 E 3.24(,i)-.65 G 3.24(fr)-3.24 G(eco)-3.24 E -.15(ve)-.15 G .74 +(ry is not).15 F .877 +(required because no database state is maintained across f)108 261.6 R +.877(ailures, it is possible to clean up a lock table by)-.1 F(remo)108 +273.6 Q .975 +(ving all of the \214les in the directory speci\214ed to the)-.15 F F1 +(loc)3.474 E(k_open)-.2 E F0 .974 +(function, as lock table \214les are ne)3.474 F -.15(ve)-.25 G(r).15 E +.043(created in an)108 285.6 R 2.543(yd)-.15 G .043 +(irectory other than the one speci\214ed to)-2.543 F F1(loc)2.544 E +(k_open)-.2 E F0 5.044(.N).24 G .044(ote, ho)-5.044 F(we)-.25 E -.15(ve) +-.25 G .844 -.4(r, t).15 H .044(hat this has the potential).4 F(to remo) +108 297.6 Q .3 -.15(ve \214)-.15 H +(les created by the other DB subsystems in this database en).15 E +(vironment.)-.4 E(The)108 314.4 Q F1(loc)2.5 E(k_unlink)-.2 E F0 +(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E F1(loc)92 331.2 Q(k_detect)-.2 E F0 +(The)108 343.2 Q F1(loc)2.584 E(k_detect)-.2 E F0 .083(function runs one iteration of the deadlock detector on the speci\214ed table,) +2.584 F F1(lt)2.583 E F0 5.083(.T).68 G .083(he deadlock)-5.083 F .306 +(detector tra)108 355.2 R -.15(ve)-.2 G .306(rses the lock table, detects deadlocks, and if it \214nds one, marks one of the participating trans-) +.15 F(actions for abort and then returns.)108 367.2 Q(The \215ags v)108 +384 Q(alue is speci\214ed by)-.25 E/F2 10/Times-Bold@0 SF(or)2.5 E F0 +('ing together one or more of the follo)A(wing v)-.25 E(alues:)-.25 E +(DB_LOCK_CONFLICT)108 405.6 Q .988(Only run the deadlock detector if a lock con\215ict has occurred since the last time that the deadlock) +133 417.6 R(detector w)133 429.6 Q(as run.)-.1 E(The)108 446.4 Q F1 +(atype)3.18 E F0 .68(parameter speci\214es which transaction to abort in the case of deadlock.) +3.18 F .68(It must be set to one of)5.68 F -.25(va)108 458.4 S +(lues described abo).25 E .3 -.15(ve f)-.15 H(or the).15 E F1(lk_detect) +2.5 E F0(\214eld of the)2.5 E F1(DB_ENV)2.5 E F0(structure.)2.5 E(The) +108 475.2 Q F1(loc)2.5 E(k_detect)-.2 E F0(function returns the v)2.5 E +(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 E(ailure and 0 on success.) +-.1 E(The)108 492 Q F1(loc)2.571 E(k_detect)-.2 E F0 .071 +(function is the underlying function used by the)2.571 F F1(db_deadloc) +2.571 E(k)-.2 E F0 .07(\(1\) utility).67 F 5.07(.S)-.65 G .07 +(ee the source code)-5.07 F(for the)108 504 Q F1(db_deadloc)2.5 E(k)-.2 +E F0(utility for an e)2.5 E(xample of using)-.15 E F1(loc)2.5 E +(k_detect)-.2 E F0(in a UNIX en)2.5 E(vironment.)-.4 E F1(loc)92 520.8 Q +(k_stat)-.2 E F0(The)108 532.8 Q F1(loc)3.105 E(k_stat)-.2 E F0 .606(function creates a statistical structure and copies a pointer to it into the user) +3.105 F .606(-speci\214ed mem-)-.2 F(ory location.)108 544.8 Q .292 +(Statistical structure are created in allocated memory)108 561.6 R 5.292 +(.I)-.65 G(f)-5.292 E F1(db_malloc)2.792 E F0 .292 +(is non-NULL, it is called to allocate the)2.792 F(memory)108 573.6 Q +2.829(,o)-.65 G .329(therwise, the library function)-2.829 F F1(malloc) +2.829 E F0 .329(\(3\) is used.).31 F .329(The function)5.329 F F1 +(db_malloc)2.829 E F0 .33(must match the calling)2.83 F(con)108 585.6 Q +-.15(ve)-.4 G 2.031(ntions of the).15 F F1(malloc)4.531 E F0 2.031 +(\(3\) library routine.).31 F(Re)7.031 E -.05(ga)-.15 G 2.031 +(rdless, the caller is responsible for deallocating the).05 F .707 +(returned memory)108 597.6 R 5.707(.T)-.65 G 3.207(od)-6.507 G .708 +(eallocate the returned memory)-3.207 F 3.208(,f)-.65 G .708 +(ree each returned memory pointer; pointers inside)-3.208 F +(the memory do not need to be indi)108 609.6 Q(vidually freed.)-.25 E +1.111(The lock re)108 626.4 R 1.111 +(gion statistics are stored in a structure of type DB_LOCK_ST)-.15 F +3.33 -1.11(AT \()-.93 H -1.95(typedef ')1.11 F 3.61(di)-.5 G 3.61(n<) +-3.61 G(db)-3.61 E 3.61(.h>\). The)-.4 F(follo)108 638.4 Q +(wing DB_LOCK_ST)-.25 E 2.22 -1.11(AT \214)-.93 H +(elds will be \214lled in:)1.11 E(u_int32_t st_magic;)108 667.2 Q +(The magic number that identi\214es a \214le as a lock \214le.)133 679.2 +Q(u_int32_t st_v)108 691.2 Q(ersion;)-.15 E(The v)133 703.2 Q +(ersion of the lock \214le type.)-.15 E(May 10, 1998)278.085 768 Q(5) +201.085 E EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 349.96(DB_LOCK\(3\) DB_LOCK\(3\))72 48 R +(u_int32_t st_refcnt;)108 84 Q(The number of references to the re)133 96 +Q(gion.)-.15 E(u_int32_t st_re)108 108 Q(gsize;)-.15 E +(The size of the re)133 120 Q(gion.)-.15 E(u_int32_t st_maxlocks;)108 +132 Q(The maximum number of locks possible.)133 144 Q +(u_int32_t st_nmodes;)108 156 Q(The number of lock modes.)133 168 Q +(u_int32_t st_numobjs;)108 180 Q(The number of unique objects lock)133 +192 Q(ed.)-.1 E(u_int32_t st_nlock)108 204 Q(ers;)-.1 E +(The number of unique lock)133 216 Q(ers.)-.1 E +(u_int32_t st_ncon\215icts;)108 228 Q +(The total number of locks not immediately a)133 240 Q -.25(va)-.2 G +(ilable due to con\215icts.).25 E(u_int32_t st_nrequests;)108 252 Q +(The total number of locks requested.)133 264 Q(u_int32_t st_nreleases;) +108 276 Q(The total number of locks released.)133 288 Q +(u_int32_t st_ndeadlocks)108 300 Q(The number of deadlocks detected.)133 +312 Q(u_int32_t st_re)108 324 Q(gion_w)-.15 E(ait;)-.1 E +(The number of times that a thread of control w)133 336 Q +(as forced to w)-.1 E(ait before obtaining the re)-.1 E(gion lock.)-.15 +E(u_int32_t st_re)108 348 Q(gion_no)-.15 E -.1(wa)-.25 G(it;).1 E +(The number of times that a thread of control w)133 360 Q +(as able to obtain the re)-.1 E(gion lock without w)-.15 E(aiting.)-.1 E +/F1 9/Times-Bold@0 SF(ENVIR)72 376.8 Q(ONMENT V)-.27 E(ARIABLES)-1.215 E +F0(The follo)108 388.8 Q(wing en)-.25 E(vironment v)-.4 E(ariables af) +-.25 E(fect the e)-.25 E -.15(xe)-.15 G(cution of).15 E/F2 10 +/Times-Italic@0 SF(db_loc)2.5 E(k)-.2 E F0(:).67 E(DB_HOME)108 405.6 Q +2.533(If the)133 417.6 R F2(dben)5.033 E(v)-.4 E F0(ar)5.033 E 2.533 +(gument to)-.18 F F2(loc)5.033 E(k_open)-.2 E F0 -.1(wa)5.033 G 5.033 +(si).1 G 2.533(nitialized using)-5.033 F F2(db_appinit)5.034 E F0 5.034 +(,t).68 G 2.534(he en)-5.034 F 2.534(vironment v)-.4 F(ariable)-.25 E +.508(DB_HOME may be used as the path of the database home for the interpretation of the) +133 429.6 R F2(dir)3.008 E F0(ar)3.008 E(gument)-.18 E(to)133 441.6 Q F2 +(loc)2.5 E(k_open)-.2 E F0 2.5(,a).24 G 2.5(sd)-2.5 G(escribed in)-2.5 E +F2(db_appinit)2.5 E F0(\(3\).).68 E(TMPDIR)108 458.4 Q .685(If the)133 +470.4 R F2(dben)3.185 E(v)-.4 E F0(ar)3.185 E .685(gument to)-.18 F F2 +(loc)3.185 E(k_open)-.2 E F0 -.1(wa)3.185 G 3.185(sN).1 G .685 +(ULL or not initialized using)-3.185 F F2(db_appinit)3.185 E F0 3.185 +(,t).68 G .685(he en)-3.185 F(vironment)-.4 E -.25(va)133 482.4 S .484(riable TMPDIR may be used as the directory in which to create the lock table, as described in the) +.25 F F2(loc)133 494.4 Q(k_open)-.2 E F0(section abo)2.5 E -.15(ve)-.15 +G(.).15 E F1(ST)72 511.2 Q(AND)-.81 E(ARD LOCK MODES)-.315 E F0 +(The include \214le declares tw)-.4 E 2.5(oc)-.1 G +(ommonly used con\215ict arrays:)-2.5 E +(const u_int8_t db_lock_rw_con\215icts[];)108 540 Q +(This is a con\215ict array for a simple scheme using shared and e)133 +552 Q(xclusi)-.15 E .3 -.15(ve l)-.25 H(ock modes.).15 E +(const u_int8_t db_lock_riw_con\215icts[];)108 568.8 Q .703 +(This is a con\215ict array that in)133 580.8 R -.2(vo)-.4 G(lv).2 E +.703(es v)-.15 F .703 +(arious intent lock modes \(e.g., intent shared\) that are used for)-.25 +F(multigranularity locking.)133 592.8 Q +(Their associated sizes are DB_LOCK_R)108 609.6 Q +(W_N and DB_LOCK_RIW_N.)-.55 E .988(In addition, the include \214le de\214nes the type)-.4 F F2(db_loc)3.488 E(kmode_t) +-.2 E F0 3.488(,w).68 G .987(hich is the type of the lock modes)-3.488 F +(used with the standard tables abo)108 638.4 Q -.15(ve)-.15 G(:).15 E +(DB_LOCK_NG)144 655.2 Q(not granted \(al)169 667.2 Q -.1(wa)-.1 G +(ys 0\)).1 E(DB_LOCK_READ)144 684 Q(read \(shared\))169 696 Q +(May 10, 1998)278.085 768 Q(6)201.085 E EP +%%Page: 7 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 349.96(DB_LOCK\(3\) DB_LOCK\(3\))72 48 R +(DB_LOCK_WRITE)144 84 Q(write \(e)169 96 Q(xclusi)-.15 E -.15(ve)-.25 G +(\)).15 E/F1 9/Times-Bold@0 SF(ERR)72 112.8 Q(ORS)-.27 E F0(The)108 +124.8 Q/F2 10/Times-Italic@0 SF(loc)3.056 E(k_open)-.2 E F0 .556 +(function may f)3.056 F .556(ail and return)-.1 F F2(errno)3.056 E F0 +.556(for an)3.056 F 3.056(yo)-.15 G 3.056(ft)-3.056 G .556 +(he errors speci\214ed for the follo)-3.056 F .557(wing DB and)-.25 F +(library functions: close\(2\), db_v)108 136.8 Q +(ersion\(3\), fcntl\(2\), f)-.15 E +(\215ush\(3\), lock_unlink\(3\), lseek\(2\), malloc\(3\), mem-)-.25 E +(cp)108 148.8 Q(y\(3\), memset\(3\), mmap\(2\), munmap\(2\), open\(2\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp) +-.1 E(y\(3\),)-.1 E +(strdup\(3\), strerror\(3\), strlen\(3\), unlink\(2\), and write\(2\).) +108 160.8 Q(In addition, the)108 177.6 Q F2(loc)2.5 E(k_open)-.2 E F0 +(function may f)2.5 E(ail and return)-.1 E F2(errno)2.5 E F0 +(for the follo)2.5 E(wing conditions:)-.25 E([EA)108 194.4 Q(GAIN])-.4 E +(The shared memory re)133 206.4 Q(gion w)-.15 E(as lock)-.1 E +(ed and \(repeatedly\) una)-.1 E -.25(va)-.2 G(ilable.).25 E([EINV)108 +223.2 Q(AL])-1.35 E(An in)133 235.2 Q -.25(va)-.4 G(lid \215ag v).25 E +(alue or parameter w)-.25 E(as speci\214ed.)-.1 E +(The DB_THREAD \215ag w)133 259.2 Q(as speci\214ed and spinlocks are not implemented for this architecture.) +-.1 E(The)108 276 Q F2(loc)3.397 E(k_vec)-.2 E F0 .896(function may f) +3.397 F .896(ail and return)-.1 F F2(errno)3.396 E F0 .896(for an)3.396 +F 3.396(yo)-.15 G 3.396(ft)-3.396 G .896 +(he errors speci\214ed for the follo)-3.396 F .896(wing DB and)-.25 F +(library functions: fcntl\(2\), f)108 288 Q +(\215ush\(3\), lock_detect\(3\), lseek\(2\), memcp)-.25 E +(y\(3\), memset\(3\), mmap\(2\), mun-)-.1 E +(map\(2\), strerror\(3\), and write\(2\).)108 300 Q(In addition, the)108 +316.8 Q F2(loc)2.5 E(k_vec)-.2 E F0(function may f)2.5 E(ail and return) +-.1 E F2(errno)2.5 E F0(for the follo)2.5 E(wing conditions:)-.25 E([EA) +108 333.6 Q(CCES])-.4 E(An attempt w)133 345.6 Q +(as made to release lock held by another lock)-.1 E(er)-.1 E(.)-.55 E +([EINV)108 362.4 Q(AL])-1.35 E(An in)133 374.4 Q -.25(va)-.4 G +(lid \215ag v).25 E(alue or parameter w)-.25 E(as speci\214ed.)-.1 E +(The)108 391.2 Q F2(loc)3.463 E(k_g)-.2 E(et)-.1 E F0 .963 +(function may f)3.463 F .963(ail and return)-.1 F F2(errno)3.463 E F0 +.963(for an)3.463 F 3.463(yo)-.15 G 3.463(ft)-3.463 G .963 +(he errors speci\214ed for the follo)-3.463 F .962(wing DB and)-.25 F +(library functions: fcntl\(2\), f)108 403.2 Q +(\215ush\(3\), lock_detect\(3\), lseek\(2\), memcp)-.25 E +(y\(3\), memset\(3\), mmap\(2\), mun-)-.1 E +(map\(2\), strerror\(3\), and write\(2\).)108 415.2 Q(In addition, the) +108 432 Q F2(loc)2.5 E(k_g)-.2 E(et)-.1 E F0(function may f)2.5 E +(ail and return)-.1 E F2(errno)2.5 E F0(for the follo)2.5 E +(wing conditions:)-.25 E([EINV)108 448.8 Q(AL])-1.35 E(An in)133 460.8 Q +-.25(va)-.4 G(lid \215ag v).25 E(alue or parameter w)-.25 E +(as speci\214ed.)-.1 E(The)108 477.6 Q F2(loc)3.427 E(k_put)-.2 E F0 +.926(function may f)3.427 F .926(ail and return)-.1 F F2(errno)3.426 E +F0 .926(for an)3.426 F 3.426(yo)-.15 G 3.426(ft)-3.426 G .926 +(he errors speci\214ed for the follo)-3.426 F .926(wing DB and)-.25 F +(library functions: fcntl\(2\), f)108 489.6 Q +(\215ush\(3\), lock_detect\(3\), lseek\(2\), memcp)-.25 E +(y\(3\), memset\(3\), mmap\(2\), mun-)-.1 E +(map\(2\), strerror\(3\), and write\(2\).)108 501.6 Q(In addition, the) +108 518.4 Q F2(loc)2.5 E(k_put)-.2 E F0(function may f)2.5 E +(ail and return)-.1 E F2(errno)2.5 E F0(for the follo)2.5 E +(wing conditions:)-.25 E([EA)108 535.2 Q(CCES])-.4 E(An attempt w)133 +547.2 Q(as made to release lock held by another lock)-.1 E(er)-.1 E(.) +-.55 E([EINV)108 564 Q(AL])-1.35 E(An in)133 576 Q -.25(va)-.4 G +(lid \215ag v).25 E(alue or parameter w)-.25 E(as speci\214ed.)-.1 E +(The)108 592.8 Q F2(loc)2.995 E(k_close)-.2 E F0 .495(function may f) +2.995 F .495(ail and return)-.1 F F2(errno)2.995 E F0 .494(for an)2.995 +F 2.994(yo)-.15 G 2.994(ft)-2.994 G .494 +(he errors speci\214ed for the follo)-2.994 F .494(wing DB and)-.25 F +(library functions: close\(2\), fcntl\(2\), f)108 604.8 Q +(\215ush\(3\), munmap\(2\), and strerror\(3\).)-.25 E(The)108 621.6 Q F2 +(loc)2.747 E(k_unlink)-.2 E F0 .247(function may f)2.747 F .247 +(ail and return)-.1 F F2(errno)2.747 E F0 .247(for an)2.747 F 2.747(yo) +-.15 G 2.747(ft)-2.747 G .247(he errors speci\214ed for the follo)-2.747 +F .248(wing DB and)-.25 F(library functions: close\(2\), fcntl\(2\), f) +108 633.6 Q(\215ush\(3\), malloc\(3\), memcp)-.25 E +(y\(3\), memset\(3\), mmap\(2\), munmap\(2\),)-.1 E +(open\(2\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp)108 +645.6 Q +(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), and unlink\(2\).)-.1 E +(In addition, the)108 662.4 Q F2(loc)2.5 E(k_unlink)-.2 E F0 +(function may f)2.5 E(ail and return)-.1 E F2(errno)2.5 E F0 +(for the follo)2.5 E(wing conditions:)-.25 E([EB)108 679.2 Q(USY])-.1 E +(The shared memory re)133 691.2 Q(gion w)-.15 E +(as in use and the force \215ag w)-.1 E(as not set.)-.1 E(The)108 708 Q +F2(loc)2.809 E(k_detect)-.2 E F0 .309(function may f)2.809 F .309 +(ail and return)-.1 F F2(errno)2.809 E F0 .309(for an)2.809 F 2.809(yo) +-.15 G 2.81(ft)-2.809 G .31(he errors speci\214ed for the follo)-2.81 F +.31(wing DB and)-.25 F(library functions: calloc\(3\), fcntl\(2\), f)108 +720 Q(\215ush\(3\), lseek\(2\), malloc\(3\), memcp)-.25 E +(y\(3\), memset\(3\), mmap\(2\),)-.1 E(May 10, 1998)278.085 768 Q(7) +201.085 E EP +%%Page: 8 8 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 349.96(DB_LOCK\(3\) DB_LOCK\(3\))72 48 R +(munmap\(2\), strerror\(3\), and write\(2\).)108 84 Q/F1 9/Times-Bold@0 +SF -.09(BU)72 100.8 S(GS).09 E F0 .342 +(If a process dies while holding locks, those locks remain held and are) +108 112.8 R/F2 10/Times-Bold@0 SF(ne)2.843 E -.1(ve)-.15 G(r).1 E F0 +2.843(released. In)2.843 F .343(this case, all pro-)2.843 F +(cesses should e)108 124.8 Q(xit as quickly as possible, so that)-.15 E +/F3 10/Times-Italic@0 SF(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(can be run.) +2.5 E F1(SEE ALSO)72 141.6 Q F3(db_ar)108 153.6 Q -.15(ch)-.37 G(ive).15 +E F0(\(1\),).18 E F3(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F0(\(1\),).68 E +F3(db_deadloc)2.5 E(k)-.2 E F0(\(1\),).67 E F3(db_dump)2.5 E F0(\(1\),) +.19 E F3(db_load)2.5 E F0(\(1\),).77 E F3(db_r)2.5 E(eco)-.37 E(ver)-.1 +E F0(\(1\),).73 E F3(db_stat)2.5 E F0(\(1\),).68 E F3(db_intr)108 165.6 +Q(o)-.45 E F0(\(3\),).18 E F3(db_appinit)2.5 E F0(\(3\),).68 E F3 +(db_cur)2.5 E(sor)-.1 E F0(\(3\),).73 E F3(db_dbm)2.5 E F0(\(3\),).32 E +F3(db_internal)2.5 E F0(\(3\),).51 E F3(db_loc)2.5 E(k)-.2 E F0(\(3\),) +.67 E F3(db_lo)2.5 E(g)-.1 E F0(\(3\),).22 E F3(db_mpool)2.5 E F0 +(\(3\),).51 E F3(db_open)108 177.6 Q F0(\(3\),).24 E F3(db_thr)2.5 E +(ead)-.37 E F0(\(3\),).77 E F3(db_txn)2.5 E F0(\(3\)).24 E(May 10, 1998) +278.085 768 Q(8)201.085 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/man.ps/db_log.ps b/mozilla/db/man/man.ps/db_log.ps new file mode 100644 index 00000000000..f5631df397b --- /dev/null +++ b/mozilla/db/man/man.ps/db_log.ps @@ -0,0 +1,983 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:22 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 9 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_log \255 log management functions)108 40.8 Q F0(SYNOPSIS)72 57.6 Q +/F2 10/Times-Bold@0 SF(#include )-.4 E(int)108 93.6 Q +(log_open\(const char *dir)108 105.6 Q(,)-.92 E +(u_int32_t \215ags, int mode, DB_ENV *dben)158 117.6 Q 1.1 -.55(v, D)-.4 +H(B_LOG **r).55 E(egionp\);)-.18 E(int)108 141.6 Q +(log_close\(DB_LOG *logp\);)108 153.6 Q(int)108 177.6 Q +(log_\215ush\(DB_LOG *logp, const DB_LSN *lsn\);)108 189.6 Q(int)108 +213.6 Q +(log_get\(DB_LOG *logp, DB_LSN *lsn, DBT *data, u_int32_t \215ags\);)108 +225.6 Q(int)108 249.6 Q(log_compar)108 261.6 Q +(e\(const DB_LSN *lsn0, const DB_LSN *lsn1\);)-.18 E(int)108 285.6 Q(log_\214le\(DB_LOG *logp, const DB_LSN *lsn, char *namep, size_t len\);) +108 297.6 Q(int)108 321.6 Q(log_put\(DB_LOG *logp, DB_LSN *lsn, const DBT *data, u_int32_t \215ags\);) +108 333.6 Q(int)108 357.6 Q(log_unlink\(const char *dir)108 369.6 Q 2.5 +(,i)-.92 G(nt f)-2.5 E(or)-.25 E(ce, DB_ENV *\);)-.18 E(int)108 393.6 Q +(log_ar)108 405.6 Q(chi)-.18 E -.1(ve)-.1 G(\(DB_LOG *logp,).1 E +(char **list[], u_int32_t \215ags, v)158 417.6 Q +(oid *\(*db_malloc\)\(size_t\)\);)-.1 E(int)108 441.6 Q(log_r)108 453.6 +Q(egister\(DB_LOG *logp,)-.18 E +(const DB *dbp, const char *name, DBTYPE type, u_int32_t *\214dp\);)158 +465.6 Q(int)108 489.6 Q(log_unr)108 501.6 Q +(egister\(DB_LOG *logp, u_int32_t \214d\);)-.18 E(int)108 525.6 Q +(log_stat\(DB_LOG *logp, DB_LOG_ST)108 537.6 Q 1.9 -.95(AT *)-.9 H +(*spp, v).95 E(oid *\(*db_malloc\)\(size_t\)\);)-.1 E F0(DESCRIPTION)72 +554.4 Q F1 .486(The DB library is a f)108 566.4 R .485 +(amily of groups of functions that pro)-.1 F .485 +(vides a modular programming interf)-.15 F .485(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 578.4 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .507(\214le page caching, as well as v)108 590.4 R .507 +(arious inde)-.25 F -.15(xe)-.15 G 3.007(da).15 G .506(ccess methods.) +-3.007 F(Man)5.506 E 3.006(yo)-.15 G 3.006(ft)-3.006 G .506 +(he functional groups \(e.g., the \214le)-3.006 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 602.4 R .122(are e)108 614.4 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.121 G 2.621(rag).15 G .121(eneral description of)-2.621 +F(the DB package, see)108 626.4 Q/F3 10/Times-Italic@0 SF(db_intr)2.5 E +(o)-.45 E F1(\(3\).).18 E +(This manual page describes the speci\214c details of the log manager) +108 643.2 Q(.)-.55 E .03(These functions pro)108 660 R .03 +(vide a general-purpose logging f)-.15 F .03(acility suf)-.1 F .03 +(\214cient for transaction management.)-.25 F .03(Logs can)5.03 F +(be shared by multiple processes.)108 672 Q .347(The DB transaction log is represented by a directory containing a set of \214les.) +108 688.8 R .347(The log is a record-oriented,)5.347 F +(append-only \214le, with records identi\214ed and accessed via)108 +700.8 Q F3(DB_LSN)2.5 E F1 1.1 -.55('s \()1.1 H +(database log sequence numbers\).).55 E(DB_LSN')108 717.6 Q 2.65(sa)-.55 +G .15(re returned on each)-2.65 F F3(lo)2.65 E(g_put)-.1 E F1 .151 +(operation, and only those DB_LSN')2.651 F 2.651(sr)-.55 G .151 +(eturned by)-2.651 F F3(lo)2.651 E(g_put)-.1 E F1 .151(can later)2.651 F +(be used to retrie)108 729.6 Q .3 -.15(ve r)-.25 H(ecords from the log.) +.15 E(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 363.3(DB_LOG\(3\) DB_LOG\(3\))72 48 R/F1 10 +/Times-Italic@0 SF(lo)92 84 Q(g_open)-.1 E F0(The)108 96 Q F1(lo)2.666 E +(g_open)-.1 E F0 .166(function copies a pointer)2.666 F 2.666(,t)-.4 G +2.666(ot)-2.666 G .166(he log identi\214ed by the)-2.666 F/F2 10 +/Times-Bold@0 SF(dir)2.666 E(ectory)-.18 E F1(dir)2.666 E F0 2.666(,i) +.73 G .165(nto the memory location)-2.666 F(referenced by)108 108 Q F1 +-.37(re)2.5 G(gionp)-.03 E F0(.).19 E 1.846(If the)108 124.8 R F1(dben) +4.346 E(v)-.4 E F0(ar)4.346 E 1.846(gument to)-.18 F F1(lo)4.346 E +(g_open)-.1 E F0 -.1(wa)4.347 G 4.347(si).1 G 1.847(nitialized using) +-4.347 F F1(db_appinit)4.347 E F0(,).68 E F1(dir)4.347 E F0 1.847 +(is interpreted as described by)4.347 F F1(db_appinit)108 136.8 Q F0 +(\(3\).).68 E .668(Otherwise, if)108 153.6 R F1(dir)3.168 E F0 .668 +(is not NULL, it is interpreted relati)3.168 F .968 -.15(ve t)-.25 H +3.168(ot).15 G .668(he current w)-3.168 F .667 +(orking directory of the process.)-.1 F(If)5.667 E F1(dir)108 165.6 Q F0 +2.387(is NULL, the follo)4.887 F 2.388(wing en)-.25 F 2.388(vironment v) +-.4 F 2.388(ariables are check)-.25 F 2.388(ed in order: `)-.1 F +(`TMPDIR')-.74 E 2.388(', `)-.74 F(`TEMP')-.74 E 2.388(', and)-.74 F +-.74(``)108 177.6 S(TMP').74 E 2.716('. If)-.74 F .216 +(one of them is set, log \214les are created relati)2.716 F .516 -.15 +(ve t)-.25 H 2.716(ot).15 G .216(he directory it speci\214es.)-2.716 F +.215(If none of them are)5.215 F .597 +(set, the \214rst possible one of the follo)108 189.6 R .598 +(wing directories is used:)-.25 F F1(/var/tmp)3.098 E F0(,).19 E F1 +(/usr/tmp)3.098 E F0(,).19 E F1(/temp)3.098 E F0(,).19 E F1(/tmp)3.098 E +F0(,).19 E F1(C:/temp)3.098 E F0(and)3.098 E F1(C:/tmp)108 201.6 Q F0(.) +.19 E(All \214les associated with the log are created in this directory) +108 218.4 Q 5(.T)-.65 G(his directory must already e)-5 E(xist when)-.15 +E .012(log_open is called.)108 242.4 R .012(If the log already e)5.012 F +.012(xists, the process must ha)-.15 F .312 -.15(ve p)-.2 H .011 +(ermission to read and write the e).15 F(xisting)-.15 E 2.5(\214les. If) +108 254.4 R(the log does not already e)2.5 E +(xist, it is optionally created and initialized.)-.15 E .417 +(If the log re)108 271.2 R .418(gion is being created and log \214les are already present, the log \214les are `) +-.15 F(`reco)-.74 E -.15(ve)-.15 G(red').15 E 2.918('a)-.74 G .418 +(nd subse-)-2.918 F +(quent log writes are appended to the end of the log.)108 283.2 Q +(The log is stored in one or more \214les in the speci\214ed directory) +108 300 Q 5(.E)-.65 G(ach \214le is named using the format)-5 E +(log.NNNNN)158 324 Q(where `)108 348 Q(`NNNNN')-.74 E 2.5('i)-.74 G 2.5 +(st)-2.5 G(he sequence number of the \214le within the log.)-2.5 E(The) +108 364.8 Q F1<8d61>3.761 E(gs)-.1 E F0(and)3.761 E F1(mode)3.761 E F0 +(ar)3.761 E 1.261(guments specify ho)-.18 F 3.761<778c>-.25 G 1.26 +(les will be opened and/or created when the)-3.761 F 3.76(yd)-.15 G(on') +-3.76 E 3.76(ta)-.18 G(lready)-3.76 E -.15(ex)108 376.8 S 2.5(ist. The) +.15 F(\215ags v)2.5 E(alue is speci\214ed by)-.25 E F2(or)2.5 E F0 +('ing together one or more of the follo)A(wing v)-.25 E(alues:)-.25 E +(DB_CREA)108 393.6 Q(TE)-1.11 E .483(Create an)133 405.6 R 2.983(yu)-.15 +G .483(nderlying \214les, as necessary)-2.983 F 5.483(.I)-.65 G 2.983 +(ft)-5.483 G .483(he \214les do not already e)-2.983 F .483 +(xist and the DB_CREA)-.15 F .484(TE \215ag)-1.11 F +(is not speci\214ed, the call will f)133 417.6 Q(ail.)-.1 E(DB_THREAD) +108 446.4 Q 1.702(Cause the DB_LOG handle returned by the)133 458.4 R F1 +(lo)4.201 E(g_open)-.1 E F0 1.701 +(function to be useable by multiple threads)4.201 F +(within a single address space, i.e., to be `)133 470.4 Q +(`free-threaded')-.74 E('.)-.74 E .102 +(All \214les created by the log subsystem are created with mode)108 +487.2 R F1(mode)2.602 E F0 .103(\(as described in)2.603 F F1 -.15(ch) +2.603 G(mod).15 E F0 .103(\(2\)\) and modi\214ed).77 F .169 +(by the process' umask v)108 499.2 R .169 +(alue at the time of creation \(see)-.25 F F1(umask)2.669 E F0 2.669 +(\(2\)\). The).67 F .169(group o)2.669 F .169 +(wnership of created \214les is)-.25 F +(based on the system and directory def)108 511.2 Q +(aults, and is not further speci\214ed by DB.)-.1 E 1.322 +(The logging subsystem is con\214gured based on the)108 528 R F1(dben) +3.822 E(v)-.4 E F0(ar)3.822 E 1.322(gument to)-.18 F F1(lo)3.822 E +(g_open)-.1 E F0 3.823(,w).24 G 1.323(hich is a pointer to a)-3.823 F +1.924(structure of type DB_ENV \(typedef)108 540 R 2.924 -.5('d i).55 H +4.424(n<).5 G(db)-4.424 E 4.424(.h>\). Applications)-.4 F 1.924 +(will normally use the same DB_ENV)4.424 F(structure \(initialized by) +108 552 Q F1(db_appinit)2.5 E F0(\(3\)\), as an ar).68 E +(gument to all of the subsystems in the DB package.)-.18 E .439(References to the DB_ENV structure are maintained by DB, so it may not be discarded until the last close) +108 568.8 R .287 +(function, corresponding to an open function for which it w)108 580.8 R +.286(as an ar)-.1 F .286(gument, has returned.)-.18 F .286 +(In order to ensure)5.286 F 1.578(compatibility with future releases of DB, all \214elds of the DB_ENV structure that are not e) +108 592.8 R 1.579(xplicitly set)-.15 F .171(should be initialized to 0 before the \214rst time the structure is used.) +108 604.8 R .17(Do this by declaring the structure e)5.17 F(xter)-.15 E +(-)-.2 E(nal or static, or by calling the C library routine)108 616.8 Q +F1(bzer)2.5 E(o)-.45 E F0(\(3\) or).18 E F1(memset)2.5 E F0(\(3\).).68 E +.205(The \214elds of the DB_ENV structure used by)108 633.6 R F1(lo) +2.706 E(g_open)-.1 E F0 .206(are described belo)2.706 F 4.006 -.65(w. I) +-.25 H(f).65 E F1(dben)2.706 E(v)-.4 E F0 .206(is NULL or an)2.706 F +2.706(yo)-.15 G 2.706(fi)-2.706 G(ts)-2.706 E +(\214elds are set to 0, def)108 645.6 Q +(aults appropriate for the system are used where possible.)-.1 E +(The follo)108 662.4 Q(wing \214elds in the DB_ENV structure may be initialized before calling) +-.25 E F1(lo)2.5 E(g_open)-.1 E F0(:).24 E -.2(vo)108 679.2 S +(id *\(*db_errcall\)\(char *db_errpfx, char *b).2 E(uf)-.2 E(fer\);)-.25 +E(FILE *db_err\214le;)108 691.2 Q(const char *db_errpfx;)108 703.2 Q +(May 10, 1998)278.085 768 Q(2)201.085 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 363.3(DB_LOG\(3\) DB_LOG\(3\))72 48 R(int db_v) +108 84 Q(erbose;)-.15 E(The error \214elds of the DB_ENV beha)133 96 Q +.3 -.15(ve a)-.2 H 2.5(sd).15 G(escribed for)-2.5 E/F1 10/Times-Italic@0 +SF(db_appinit)2.5 E F0(\(3\).).68 E(u_int32_t lg_max;)108 136.8 Q .363 +(The maximum size of a single \214le in the log.)133 148.8 R .362 +(Because DB_LSN \214le of)5.362 F .362(fsets are unsigned 4-byte v)-.25 +F(al-)-.25 E(ues,)133 160.8 Q F1(lg_max)2.5 E F0(may not be lar)2.5 E +(ger than the maximum unsigned 4-byte v)-.18 E(alue.)-.25 E(If)133 184.8 +Q F1(lg_max)2.5 E F0(is 0, a def)2.5 E(ault v)-.1 E(alue is used.)-.25 E +(See the section "LOG FILE LIMITS" belo)133 208.8 Q 1.3 -.65(w, f)-.25 H +(or further information.).65 E(The)108 225.6 Q F1(lo)2.5 E(g_open)-.1 E +F0(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f) +2.5 E(ailure and 0 on success.)-.1 E F1(lo)92 242.4 Q(g_close)-.1 E F0 +(The)108 254.4 Q F1(lo)2.5 E(g_close)-.1 E F0 +(function closes the log speci\214ed by the)2.5 E F1(lo)2.5 E(gp)-.1 E +F0(ar)2.5 E(gument.)-.18 E .408(In addition, if the)108 271.2 R F1(dir) +2.909 E F0(ar)2.909 E .409(gument to)-.18 F F1(lo)2.909 E(g_open)-.1 E +F0 -.1(wa)2.909 G 2.909(sN).1 G .409(ULL and)-2.909 F F1(dben)2.909 E(v) +-.4 E F0 -.1(wa)2.909 G 2.909(sn).1 G .409(ot initialized using)-2.909 F +F1(db_appinit)2.909 E F0 2.909(,a).68 G(ll)-2.909 E +(\214les created for this shared re)108 283.2 Q(gion will be remo)-.15 E +-.15(ve)-.15 G(d, as if).15 E F1(lo)2.5 E(g_unlink)-.1 E F0 +(were called.)2.5 E 1.922 +(When multiple threads are using the DB_LOG handle concurrently)108 300 +R 4.422(,o)-.65 G 1.922(nly a single thread may call the)-4.422 F F1(lo) +108 312 Q(g_close)-.1 E F0(function.)2.5 E(The)108 328.8 Q F1(lo)2.5 E +(g_close)-.1 E F0(function returns the v)2.5 E(alue of)-.25 E F1(errno) +2.5 E F0(on f)2.5 E(ailure and 0 on success.)-.1 E F1(lo)92 345.6 Q +(g_\215ush)-.1 E F0(The)108 357.6 Q F1(lo)2.744 E(g_\215ush)-.1 E F0 +.244(function guarantees that all log records whose LSNs are less than or equal to the) +2.744 F F1(lsn)2.745 E F0(parame-)2.745 E(ter ha)108 369.6 Q .3 -.15 +(ve b)-.2 H(een written to disk.).15 E(If)5 E F1(lsn)2.5 E F0 +(is NULL, all records in the log are \215ushed.)2.5 E(The)108 386.4 Q F1 +(lo)2.5 E(g_\215ush)-.1 E F0(function returns the v)2.5 E(alue of)-.25 E +F1(errno)2.5 E F0(on f)2.5 E(ailure and 0 on success.)-.1 E F1(lo)92 +403.2 Q(g_g)-.1 E(et)-.1 E F0(The)108 415.2 Q F1(lo)2.681 E(g_g)-.1 E +(et)-.1 E F0 .181 +(function implements a cursor inside of the log, retrie)2.681 F .18 +(ving records from the log according to the)-.25 F F1(lsn)108 427.2 Q F0 +(and)2.5 E F1<8d61>2.5 E(gs)-.1 E F0(parameters.)2.5 E .679 +(The data \214eld of the)108 444 R F1(data)3.179 E F0 .679 +(structure is set to the record retrie)3.179 F -.15(ve)-.25 G 3.18(da) +.15 G .68(nd the size \214eld indicates the number of)-3.18 F .783 +(bytes in the record.)108 456 R(See)5.783 E F1(db_dbt)3.283 E F0 .783 +(\(3\) for a description of other \214elds in the).68 F F1(data)3.283 E +F0(structure.)3.283 E/F2 10/Times-Bold@0 SF .782(When multiple)5.783 F +(thr)108 468 Q 1.928(eads ar)-.18 F 4.428(eu)-.18 G 1.928(sing the r) +-4.428 F(etur)-.18 E 1.928(ned DB_LOG handle concurr)-.15 F(ently)-.18 E +4.428(,e)-.55 G 1.929(ither the DB_DBT_MALLOC or)-4.428 F +(DB_DBT_USERMEM \215ags must be speci\214ed f)108 480 Q +(or any DBT used f)-.25 E(or data r)-.25 E(etrie)-.18 E -.1(va)-.15 G +(l.).1 E F0(The)108 496.8 Q F1<8d61>2.5 E(gs)-.1 E F0 +(parameter must be set to e)2.5 E(xactly one of the follo)-.15 E(wing v) +-.25 E(alues:)-.25 E(DB_CHECKPOINT)108 513.6 Q .153(The last record written with the DB_CHECKPOINT \215ag speci\214ed to the) +133 525.6 R F1(lo)2.653 E(g_put)-.1 E F0 .152(function is returned)2.653 +F .656(in the)133 537.6 R F1(data)3.156 E F0(ar)3.156 E 3.156 +(gument. The)-.18 F F1(lsn)3.156 E F0(ar)3.156 E .656(gument is o)-.18 F +-.15(ve)-.15 G .656(rwritten with the DB_LSN of the record returned.).15 +F(If)5.657 E .542(no record has been pre)133 549.6 R .541(viously written with the DB_CHECKPOINT \215ag speci\214ed, the \214rst record in) +-.25 F(the log is returned.)133 561.6 Q(If the log is empty the)133 +578.4 Q F1(lo)2.5 E(g_g)-.1 E(et)-.1 E F0(function will return DB_NO)2.5 +E(TFOUND.)-.4 E(DB_FIRST)108 595.2 Q .476(The \214rst record from an)133 +607.2 R 2.976(yo)-.15 G 2.976(ft)-2.976 G .476 +(he log \214les found in the log directory is returned in the)-2.976 F +F1(data)2.977 E F0(ar)2.977 E(gument.)-.18 E(The)133 619.2 Q F1(lsn)2.5 +E F0(ar)2.5 E(gument is o)-.18 E -.15(ve)-.15 G +(rwritten with the DB_LSN of the record returned.).15 E +(If the log is empty the)133 636 Q F1(lo)2.5 E(g_g)-.1 E(et)-.1 E F0 +(function will return DB_NO)2.5 E(TFOUND.)-.4 E(DB_LAST)108 652.8 Q .367 +(The last record in the log is returned in the)133 664.8 R F1(data)2.867 +E F0(ar)2.867 E 2.867(gument. The)-.18 F F1(lsn)2.866 E F0(ar)2.866 E +.366(gument is o)-.18 F -.15(ve)-.15 G .366(rwritten with the).15 F +(DB_LSN of the record returned.)133 676.8 Q(If the log is empty)133 +693.6 Q 2.5(,t)-.65 G(he)-2.5 E F1(lo)2.5 E(g_g)-.1 E(et)-.1 E F0 +(function will return DB_NO)2.5 E(TFOUND.)-.4 E(May 10, 1998)278.085 768 +Q(3)201.085 E EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 363.3(DB_LOG\(3\) DB_LOG\(3\))72 48 R(DB_NEXT) +108 84 Q .846(The current log position is adv)133 96 R .846 +(anced to the ne)-.25 F .847 +(xt record in the log and that record is returned in the)-.15 F/F1 10 +/Times-Italic@0 SF(data)133 108 Q F0(ar)2.5 E 2.5(gument. The)-.18 F F1 +(lsn)2.5 E F0(ar)2.5 E(gument is o)-.18 E -.15(ve)-.15 G +(rwritten with the DB_LSN of the record returned.).15 E 3.749 +(If the pointer has not been initialized via DB_FIRST)133 124.8 R 6.248 +(,D)-.74 G(B_LAST)-6.248 E 6.248(,D)-.74 G(B_SET)-6.248 E 6.248(,D)-.74 +G(B_NEXT)-6.248 E 6.248(,o)-.74 G(r)-6.248 E(DB_PREV)133 136.8 Q(,)-1.29 +E F1(lo)4.015 E(g_g)-.1 E(et)-.1 E F0 1.516 +(will return the \214rst record in the log.)4.015 F 1.516 +(If the last log record has already been)6.516 F +(returned or the log is empty)133 148.8 Q 2.5(,t)-.65 G(he)-2.5 E F1(lo) +2.5 E(g_g)-.1 E(et)-.1 E F0(function will return DB_NO)2.5 E(TFOUND.)-.4 +E .759(If the log w)133 165.6 R .758 +(as opened with the DB_THREAD \215ag set, calls to)-.1 F F1(lo)3.258 E +(g_g)-.1 E(et)-.1 E F0 .758(with the DB_NEXT \215ag set)3.258 F +(will return EINV)133 177.6 Q(AL.)-1.35 E(DB_PREV)108 194.4 Q .502 +(The current log position is mo)133 206.4 R -.15(ve)-.15 G 3.002(dt).15 +G 3.002(ot)-3.002 G .503(he pre)-3.002 F .503 +(vious record in the log and that record is returned in the)-.25 F F1 +(data)133 218.4 Q F0(ar)2.5 E 2.5(gument. The)-.18 F F1(lsn)2.5 E F0(ar) +2.5 E(gument is o)-.18 E -.15(ve)-.15 G +(rwritten with the DB_LSN of the record returned.).15 E 3.749 +(If the pointer has not been initialized via DB_FIRST)133 235.2 R 6.248 +(,D)-.74 G(B_LAST)-6.248 E 6.248(,D)-.74 G(B_SET)-6.248 E 6.248(,D)-.74 +G(B_NEXT)-6.248 E 6.248(,o)-.74 G(r)-6.248 E(DB_PREV)133 247.2 Q(,)-1.29 +E F1(lo)4.015 E(g_g)-.1 E(et)-.1 E F0 1.516 +(will return the last record in the log.)4.015 F 1.516 +(If the \214rst log record has already been)6.516 F +(returned or the log is empty)133 259.2 Q 2.5(,t)-.65 G(he)-2.5 E F1(lo) +2.5 E(g_g)-.1 E(et)-.1 E F0(function will return DB_NO)2.5 E(TFOUND.)-.4 +E .823(If the log w)133 276 R .823 +(as opened with the DB_THREAD \215ag set, calls to)-.1 F F1(lo)3.323 E +(g_g)-.1 E(et)-.1 E F0 .823(with the DB_PREV \215ag set)3.323 F +(will return EINV)133 288 Q(AL.)-1.35 E(DB_CURRENT)108 304.8 Q +(Return the log record currently referenced by the log.)133 316.8 Q +2.284(If the log pointer has not been initialized via DB_FIRST)133 333.6 +R 4.785(,D)-.74 G(B_LAST)-4.785 E 4.785(,D)-.74 G(B_SET)-4.785 E 4.785 +(,D)-.74 G(B_NEXT)-4.785 E 4.785(,o)-.74 G(r)-4.785 E(DB_PREV)133 345.6 +Q 2.5(,o)-1.29 G 2.5(ri)-2.5 G 2.5(ft)-2.5 G(he log w)-2.5 E +(as opened with the DB_THREAD \215ag set,)-.1 E F1(lo)2.5 E(g_g)-.1 E +(et)-.1 E F0(will return EINV)2.5 E(AL.)-1.35 E(DB_SET)108 362.4 Q +(Retrie)133 374.4 Q .697 -.15(ve t)-.25 H .397 +(he record speci\214ed by the).15 F F1(lsn)2.896 E F0(ar)2.896 E 2.896 +(gument. If)-.18 F .396(the speci\214ed DB_LSN is in)2.896 F -.25(va)-.4 +G .396(lid \(e.g., does not).25 F(appear in the log\))133 386.4 Q F1(lo) +2.5 E(g_g)-.1 E(et)-.1 E F0(will return EINV)2.5 E(AL.)-1.35 E +(Otherwise, the)108 403.2 Q F1(lo)2.5 E(g_g)-.1 E(et)-.1 E F0 +(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E F1(lo)92 420 Q(g_compar)-.1 E(e)-.37 E +F0(The)108 432 Q F1(lo)2.859 E(g_compar)-.1 E(e)-.37 E F0 .359 +(function allo)2.859 F .359(ws the caller to compare tw)-.25 F 2.859(oD) +-.1 G(B_LSN')-2.859 E(s.)-.55 E F1(Lo)5.359 E(g_compar)-.1 E(e)-.37 E F0 +.36(returns 0 if the tw)2.86 F(o)-.1 E(DB_LSN')108 444 Q 2.5(sa)-.55 G +(re equal, 1 if)-2.5 E F1(lsn0)2.5 E F0(is greater than)2.5 E F1(lsn1) +2.5 E F0 2.5(,a)C(nd -1 if)-2.5 E F1(lsn0)2.5 E F0(is less than)2.5 E F1 +(lsn1)2.5 E F0(.)A F1(lo)92 460.8 Q(g_\214le)-.1 E F0(The)108 472.8 Q F1 +(lo)2.779 E(g_\214le)-.1 E F0 .279(function maps DB_LSN')2.779 F 2.779 +(st)-.55 G 2.779<6f8c>-2.779 G .279(le names.)-2.779 F(The)5.279 E F1 +(lo)2.779 E(g_\214le)-.1 E F0 .279 +(function copies the name of the \214le con-)2.779 F 2.588 +(taining the record named by)108 484.8 R F1(lsn)5.088 E F0 2.588 +(into the memory location referenced by)5.088 F F1(namep)5.088 E F0 +7.588(.\().19 G 2.588(This mapping of)-7.588 F 2.276 +(DB_LSN to \214le is needed for database administration.)108 496.8 R +-.15(Fo)7.275 G 4.775(re).15 G 2.275 +(xample, a transaction manager typically)-4.925 F 1.21(records the earliest DB_LSN needed for restart, and the database administrator may w) +108 508.8 R 1.21(ant to archi)-.1 F 1.51 -.15(ve l)-.25 H(og).15 E +(\214les to tape when the)108 520.8 Q 2.5(yc)-.15 G(ontain only DB_LSN') +-2.5 E 2.5(sb)-.55 G(efore the earliest one needed for restart.\))-2.5 E +(The)108 537.6 Q F1(len)3.342 E F0(ar)3.342 E .842 +(gument is the length of the)-.18 F F1(namep)3.342 E F0 -.2(bu)3.342 G +-.25(ff).2 G .842(er in bytes.).25 F(If)5.842 E F1(namep)3.342 E F0 .842 +(is too short to hold the \214le name,)3.342 F F1(lo)108 549.6 Q +(g_\214le)-.1 E F0 .337(will return ENOMEM.)2.837 F .338 +(Note, as described abo)5.337 F -.15(ve)-.15 G 2.838(,l).15 G .338 +(og \214le names are quite short, on the order of 10)-2.838 F +(characters.)108 561.6 Q(The)108 578.4 Q F1(lo)2.5 E(g_\214le)-.1 E F0 +(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E F1(lo)92 595.2 Q(g_put)-.1 E F0(The)108 +607.2 Q F1(lo)3.824 E(g_put)-.1 E F0 1.324 +(function appends records to the log.)3.824 F 1.323 +(The DB_LSN of the put record is returned in the)6.323 F F1(lsn)3.823 E +F0(parameter)108 619.2 Q 5(.T)-.55 G(he)-5 E F1<8d61>2.5 E(gs)-.1 E F0 +(parameter may be set to one of the follo)2.5 E(wing v)-.25 E(alues:) +-.25 E(DB_CHECKPOINT)108 636 Q .118 +(The log should write a checkpoint record, recording an)133 648 R 2.619 +(yi)-.15 G .119(nformation necessary to mak)-2.619 F 2.619(et)-.1 G .119 +(he log struc-)-2.619 F(tures reco)133 660 Q -.15(ve)-.15 G +(rable after a crash.).15 E(DB_CURLSN)108 676.8 Q(The DB_LSN of the ne) +133 688.8 Q(xt record to be put is returned in the)-.15 E F1(lsn)2.5 E +F0(parameter)2.5 E(.)-.55 E(DB_FLUSH)108 705.6 Q .186(The log is forced to disk after this record is written, guaranteeing that all records with DB_LSNs less) +133 717.6 R .268(than or equal to the one being put are on disk before this function returns \(this function is most often) +133 729.6 R(May 10, 1998)278.085 768 Q(4)201.085 E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 363.3(DB_LOG\(3\) DB_LOG\(3\))72 48 R +(used for a transaction commit, see)133 84 Q/F1 10/Times-Italic@0 SF +(db_txn)2.5 E F0(\(3\)\).).24 E .239(The caller is responsible for pro) +108 100.8 R .239(viding an)-.15 F 2.739(yn)-.15 G .239 +(ecessary structure to)-2.739 F F1(data)2.739 E F0 5.239(.\().26 G -.15 +(Fo)-5.239 G 2.739(re).15 G .238(xample, in a write-ahead log-)-2.889 F +1.183(ging protocol, the application must understand what part of)108 +112.8 R F1(data)3.683 E F0 1.183 +(is an operation code, what part is redo)3.683 F .71 +(information, and what part is undo information.)108 124.8 R .709 +(In addition, most transaction managers will store in)5.709 F F1(data) +3.209 E F0 1.481(the DB_LSN of the pre)108 136.8 R 1.481(vious log record for the same transaction, to support chaining back through the) +-.25 F(transaction')108 148.8 Q 2.5(sl)-.55 G(og records during undo.\)) +-2.5 E(The)108 165.6 Q F1(lo)2.5 E(g_put)-.1 E F0 +(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E F1(lo)92 194.4 Q(g_unlink)-.1 E F0(The) +108 206.4 Q F1(lo)3.429 E(g_unlink)-.1 E F0 .928(function destro)3.429 F +.928(ys the log re)-.1 F .928(gion identi\214ed by the directory)-.15 F +F1(dir)3.428 E F0 3.428(,r).73 G(emo)-3.428 E .928 +(ving all \214les used to)-.15 F 1.023(implement the log re)108 218.4 R +3.523(gion. \(The)-.15 F 1.023(log \214les themselv)3.523 F 1.024 +(es and the directory)-.15 F F1(dir)3.524 E F0 1.024(are not remo)3.524 +F -.15(ve)-.15 G 3.524(d.\) If).15 F 1.024(there are)3.524 F .685 +(processes that ha)108 230.4 R .985 -.15(ve c)-.2 H(alled).15 E F1(lo) +3.185 E(g_open)-.1 E F0 .684(without calling)3.184 F F1(lo)3.184 E +(g_close)-.1 E F0 .684(\(i.e., there are processes currently using the) +3.184 F .244(log re)108 242.4 R(gion\),)-.15 E F1(lo)2.744 E(g_unlink) +-.1 E F0 .244(will f)2.744 F .245(ail without further action, unless the force \215ag is set, in which case) +-.1 F F1(lo)2.745 E(g_unlink)-.1 E F0(will attempt to remo)108 254.4 Q +.3 -.15(ve t)-.15 H(he log re).15 E(gion \214les re)-.15 E -.05(ga)-.15 +G(rdless of an).05 E 2.5(yp)-.15 G(rocesses still using the log re)-2.5 +E(gion.)-.15 E .766(The result of attempting to forcibly destro)108 +271.2 R 3.266(yt)-.1 G .766(he re)-3.266 F .766 +(gion when a process has the re)-.15 F .765(gion open is unspeci\214ed.) +-.15 F 1.232(Processes using a shared memory re)108 283.2 R 1.232 +(gion maintain an open \214le descriptor for it.)-.15 F 1.232 +(On UNIX systems, the)6.232 F(re)108 295.2 Q .474(gion remo)-.15 F -.25 +(va)-.15 G 2.974(ls).25 G .473(hould succeed and processes that ha) +-2.974 F .773 -.15(ve a)-.2 H .473(lready joined the re).15 F .473 +(gion should continue to run in)-.15 F .247(the re)108 307.2 R .247 +(gion without change, ho)-.15 F(we)-.25 E -.15(ve)-.25 G 2.747(rp).15 G +.248(rocesses attempting to join the log re)-2.747 F .248 +(gion will either f)-.15 F .248(ail or attempt to)-.1 F .45(create a ne) +108 319.2 R 2.95(wr)-.25 G -.15(eg)-2.95 G 2.95(ion. On).15 F .45 +(other systems, e.g., WNT)2.95 F 2.949(,w)-.74 G .449(here the)-2.949 F +F1(unlink)2.949 E F0 .449(\(2\) system call will f).67 F .449(ail if an) +-.1 F 2.949(yp)-.15 G(rocess)-2.949 E +(has an open \214le descriptor for the \214le, the re)108 331.2 Q +(gion remo)-.15 E -.25(va)-.15 G 2.5(lw).25 G(ill f)-2.5 E(ail.)-.1 E +.929(In the case of catastrophic or system f)108 348 R .929 +(ailure, database reco)-.1 F -.15(ve)-.15 G .93 +(ry must be performed \(see).15 F F1(db_r)3.43 E(eco)-.37 E(ver)-.1 E F0 +.93(\(1\) or).73 F .74(the DB_RECO)108 360 R .74(VER and DB_RECO)-.5 F +(VER_F)-.5 E -1.21 -1.11(AT A)-.74 H 3.24<4c8d>1.11 G .74(ags to)-3.24 F +F1(db_appinit)3.24 E F0 3.24(\(3\)\). Alternati).68 F -.15(ve)-.25 G(ly) +.15 E 3.24(,i)-.65 G 3.24(fr)-3.24 G(eco)-3.24 E -.15(ve)-.15 G .74 +(ry is not).15 F .792 +(required because no database state is maintained across f)108 372 R +.793(ailures, it is possible to clean up a log re)-.1 F .793(gion by) +-.15 F(remo)108 384 Q .093 +(ving all of the \214les in the directory speci\214ed to the)-.15 F F1 +(lo)2.593 E(g_open)-.1 E F0 .092(function, as log re)2.593 F .092 +(gion \214les are ne)-.15 F -.15(ve)-.25 G 2.592(rc).15 G(re-)-2.592 E +.358(ated in an)108 396 R 2.858(yd)-.15 G .358 +(irectory other than the one speci\214ed to)-2.858 F F1(lo)2.858 E +(g_open)-.1 E F0 5.358(.N).24 G .358(ote, ho)-5.358 F(we)-.25 E -.15(ve) +-.25 G 1.159 -.4(r, t).15 H .359(hat this has the potential to).4 F +(remo)108 408 Q .3 -.15(ve \214)-.15 H +(les created by the other DB subsystems in this database en).15 E +(vironment.)-.4 E(The)108 424.8 Q F1(lo)2.5 E(g_unlink)-.1 E F0 +(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E F1(lo)92 441.6 Q(g_ar)-.1 E -.15(ch) +-.37 G(ive).15 E F0(The)108 453.6 Q F1(lo)4.256 E(g_ar)-.1 E -.15(ch) +-.37 G(ive).15 E F0 1.756(function creates a NULL-terminated array of log or database \214le names and copies a) +4.256 F(pointer to them into the user)108 465.6 Q +(-speci\214ed memory location)-.2 E F1(list)2.5 E F0(.).68 E .972 +(By def)108 482.4 R(ault,)-.1 E F1(lo)3.472 E(g_ar)-.1 E -.15(ch)-.37 G +(ive).15 E F0 .973(returns the names of all of the log \214les that are no longer in use \(e.g., no longer) +3.472 F(in)108 494.4 Q -.2(vo)-.4 G(lv).2 E .321(ed in acti)-.15 F .621 +-.15(ve t)-.25 H .321(ransactions\), and that may be archi).15 F -.15 +(ve)-.25 G 2.821(df).15 G .321(or catastrophic reco)-2.821 F -.15(ve) +-.15 G .32(ry and then remo).15 F -.15(ve)-.15 G 2.82(df).15 G(rom)-2.82 +E(the system.)108 506.4 Q(If there were no \214le names to return,)5 E +F1(list)2.5 E F0(will be set to NULL.)2.5 E .691 +(Arrays of log \214le names are created in allocated memory)108 523.2 R +5.692(.I)-.65 G(f)-5.692 E F1(db_malloc)3.192 E F0 .692 +(is non-NULL, it is called to allo-)3.192 F .068(cate the memory)108 +535.2 R 2.568(,o)-.65 G .068(therwise, the library function)-2.568 F F1 +(malloc)2.567 E F0 .067(\(3\) is used.).31 F .067(The function)5.067 F +F1(db_malloc)2.567 E F0 .067(must match the)2.567 F .876(calling con)108 +547.2 R -.15(ve)-.4 G .877(ntions of the).15 F F1(malloc)3.377 E F0 .877 +(\(3\) library routine.).31 F(Re)5.877 E -.05(ga)-.15 G .877 +(rdless, the caller is responsible for deallocating).05 F 1.606 +(the returned memory)108 559.2 R 6.606(.T)-.65 G 4.106(od)-7.406 G 1.605 +(eallocate the returned memory)-4.106 F 4.105(,f)-.65 G 1.605 +(ree each returned memory pointer; pointers)-4.105 F +(inside the memory do not need to be indi)108 571.2 Q(vidually freed.) +-.25 E(The)108 588 Q F1<8d61>2.5 E(gs)-.1 E F0(ar)2.5 E +(gument is speci\214ed by)-.18 E/F2 10/Times-Bold@0 SF(or)2.5 E F0 +('ing together one or more of the follo)A(wing v)-.25 E(alues:)-.25 E +(DB_ARCH_ABS)108 604.8 Q .224 +(All pathnames are returned as absolute pathnames, instead of relati)133 +616.8 R .524 -.15(ve t)-.25 H 2.725(ot).15 G .225 +(he database home directory)-2.725 F(.)-.65 E(DB_ARCH_D)108 633.6 Q +-1.21 -1.11(AT A)-.4 H .662 +(Return the database \214les that need to be archi)133 645.6 R -.15(ve) +-.25 G 3.161(di).15 G 3.161(no)-3.161 G .661(rder to reco)-3.161 F -.15 +(ve)-.15 G 3.161(rt).15 G .661(he database from catastrophic)-3.161 F +-.1(fa)133 657.6 S 2.665(ilure. If).1 F(an)2.665 E 2.665(yo)-.15 G 2.665 +(ft)-2.665 G .165(he database \214les ha)-2.665 F .465 -.15(ve n)-.2 H +.165(ot been accessed during the lifetime of the current log \214les,) +.15 F F1(lo)133 669.6 Q(g_ar)-.1 E -.15(ch)-.37 G(ive).15 E F0 .703 +(will not include them in this list.)3.203 F .702 +(It is also possible that some of the \214les referenced in)5.702 F +(the log ha)133 681.6 Q .3 -.15(ve s)-.2 H +(ince been deleted from the system.).15 E(DB_ARCH_LOG)108 698.4 Q +(Return all the log \214le names re)133 710.4 Q -.05(ga)-.15 G +(rdless of whether or not the).05 E 2.5(ya)-.15 G(re in use.)-2.5 E +(The DB_ARCH_D)108 727.2 Q -1.21 -1.11(AT A)-.4 H +(and DB_ARCH_LOG \215ags are mutually e)3.61 E(xclusi)-.15 E -.15(ve) +-.25 G(.).15 E(May 10, 1998)278.085 768 Q(5)201.085 E EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 363.3(DB_LOG\(3\) DB_LOG\(3\))72 48 R(The)108 84 +Q/F1 10/Times-Italic@0 SF(lo)2.5 E(g_ar)-.1 E -.15(ch)-.37 G(ive).15 E +F0(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f) +2.5 E(ailure and 0 on success.)-.1 E(The)108 100.8 Q F1(lo)2.911 E(g_ar) +-.1 E -.15(ch)-.37 G(ive).15 E F0 .411 +(function is the underlying function used by the)2.911 F F1(db_ar)2.911 +E -.15(ch)-.37 G(ive).15 E F0 .412(\(1\) utility).18 F 5.412(.S)-.65 G +.412(ee the source code)-5.412 F 3.417(for the)108 112.8 R F1(db_ar) +5.917 E -.15(ch)-.37 G(ive).15 E F0 3.417(utility for an e)5.917 F 3.417 +(xample of using)-.15 F F1(lo)5.917 E(g_ar)-.1 E -.15(ch)-.37 G(ive).15 +E F0 3.416(in a UNIX en)5.917 F 5.916(vironment. See)-.4 F(the)5.916 E +F1(db_ar)108 124.8 Q -.15(ch)-.37 G(ive).15 E F0 +(\(1\) manual page for more information on database archi).18 E -.25(va) +-.25 G 2.5(lp).25 G(rocedures.)-2.5 E F1(lo)92 141.6 Q(g_r)-.1 E -.4(eg) +-.37 G(ister).4 E F0(The)108 153.6 Q F1(lo)2.796 E(g_r)-.1 E -.4(eg)-.37 +G(ister).4 E F0 .296(function re)2.796 F .296(gisters a \214le name with the log manager and copies a \214le identi\214cation number) +-.15 F .915(into the memory location referenced by)108 165.6 R F1 +(\214dp)3.415 E F0 5.914(.T).19 G .914 +(his \214le identi\214cation number should be used in all subse-)-5.914 +F .152(quent log messages that refer to operations on this \214le.)108 +177.6 R .152(The log manager records all \214le name to \214le identi-) +5.152 F 1.235 +(\214cation number mappings at each checkpoint so that a reco)108 189.6 +R -.15(ve)-.15 G 1.234(ry process can identify the \214le to which a).15 +F(record in the log refers.)108 201.6 Q(The)108 218.4 Q F1(lo)3.025 E +(g_r)-.1 E -.4(eg)-.37 G(ister).4 E F0 .526 +(function is called when an access method re)3.025 F .526 +(gisters the open of a \214le.)-.15 F(The)5.526 E F1(dbp)3.026 E F0 +(parameter)3.026 E(should be a pointer to the DB structure which is being returned by the access method.) +108 230.4 Q(The)108 247.2 Q F1(type)2.5 E F0 +(parameter should be one of the DB types speci\214ed in)2.5 E F1 +(db_open)2.5 E F0(\(3\), e.g., DB_HASH.).24 E(The)108 264 Q F1(lo)2.5 E +(g_r)-.1 E -.4(eg)-.37 G(ister).4 E F0(function returns the v)2.5 E +(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 E(ailure and 0 on success.) +-.1 E F1(lo)92 280.8 Q(g_unr)-.1 E -.4(eg)-.37 G(ister).4 E F0(The)108 +292.8 Q F1(lo)3.66 E(g_unr)-.1 E -.4(eg)-.37 G(ister).4 E F0 1.159(function disassociates the \214le name to \214le identi\214cation number mapping for the \214le) +3.66 F(identi\214cation number speci\214ed by the)108 304.8 Q F1<8c64> +2.5 E F0(parameter)2.5 E 5(.T)-.55 G +(he \214le identi\214cation number may then be reused.)-5 E(The)108 +321.6 Q F1(lo)2.5 E(g_unr)-.1 E -.4(eg)-.37 G(ister).4 E F0 +(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E F1(lo)92 338.4 Q(g_stat)-.1 E F0(The) +108 350.4 Q F1(lo)2.716 E(g_stat)-.1 E F0 .217(function creates a statistical structure and copies a pointer to it into the user) +2.716 F .217(-speci\214ed memory)-.2 F(location.)108 362.4 Q .292 +(Statistical structure are created in allocated memory)108 379.2 R 5.292 +(.I)-.65 G(f)-5.292 E F1(db_malloc)2.792 E F0 .292 +(is non-NULL, it is called to allocate the)2.792 F(memory)108 391.2 Q +2.829(,o)-.65 G .329(therwise, the library function)-2.829 F F1(malloc) +2.829 E F0 .329(\(3\) is used.).31 F .329(The function)5.329 F F1 +(db_malloc)2.829 E F0 .33(must match the calling)2.83 F(con)108 403.2 Q +-.15(ve)-.4 G 2.031(ntions of the).15 F F1(malloc)4.531 E F0 2.031 +(\(3\) library routine.).31 F(Re)7.031 E -.05(ga)-.15 G 2.031 +(rdless, the caller is responsible for deallocating the).05 F .707 +(returned memory)108 415.2 R 5.707(.T)-.65 G 3.207(od)-6.507 G .708 +(eallocate the returned memory)-3.207 F 3.208(,f)-.65 G .708 +(ree each returned memory pointer; pointers inside)-3.208 F +(the memory do not need to be indi)108 427.2 Q(vidually freed.)-.25 E +.677(The log re)108 444 R .677 +(gion statistics are stored in a structure of type DB_LOG_ST)-.15 F +2.897 -1.11(AT \()-.93 H -1.95(typedef ')1.11 F 3.177(di)-.5 G 3.177(n<) +-3.177 G(db)-3.177 E 3.176(.h>\). The)-.4 F(fol-)3.176 E(lo)108 456 Q +(wing DB_LOG_ST)-.25 E 2.22 -1.11(AT \214)-.93 H +(elds will be \214lled in:)1.11 E(u_int32_t st_magic;)108 472.8 Q +(The magic number that identi\214es a \214le as a log \214le.)133 484.8 +Q(u_int32_t st_v)108 496.8 Q(ersion;)-.15 E(The v)133 508.8 Q +(ersion of the log \214le type.)-.15 E(u_int32_t st_refcnt;)108 520.8 Q +(The number of references to the re)133 532.8 Q(gion.)-.15 E +(u_int32_t st_re)108 544.8 Q(gsize;)-.15 E(The size of the re)133 556.8 +Q(gion.)-.15 E(int st_mode;)108 568.8 Q(The mode of an)133 580.8 Q 2.5 +(yc)-.15 G(reated log \214les.)-2.5 E(u_int32_t st_lg_max;)108 592.8 Q +(The maximum size of an)133 604.8 Q 2.5(yi)-.15 G(ndi)-2.5 E +(vidual \214le comprising the log.)-.25 E(u_int32_t st_w_mbytes;)108 +616.8 Q(The number of me)133 628.8 Q -.05(ga)-.15 G +(bytes written to this log.).05 E(u_int32_t st_w_bytes;)108 640.8 Q +(The number of bytes o)133 652.8 Q -.15(ve)-.15 G 2.5(ra).15 G(nd abo) +-2.5 E -.15(ve)-.15 G F1(st_w_mbytes)2.65 E F0(written to this log.)2.5 +E(u_int32_t st_wc_mbytes;)108 664.8 Q(The number of me)133 676.8 Q -.05 +(ga)-.15 G(bytes written to this log since the last checkpoint.).05 E +(u_int32_t st_wc_bytes;)108 688.8 Q(The number of bytes o)133 700.8 Q +-.15(ve)-.15 G 2.5(ra).15 G(nd abo)-2.5 E -.15(ve)-.15 G F1 +(st_wc_mbytes)2.65 E F0(written to this log since the last checkpoint.) +2.5 E(May 10, 1998)278.085 768 Q(6)201.085 E EP +%%Page: 7 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 363.3(DB_LOG\(3\) DB_LOG\(3\))72 48 R +(u_int32_t st_cur_\214le;)108 84 Q(The current log \214le number)133 96 +Q(.)-.55 E(u_int32_t st_cur_of)108 108 Q(fset;)-.25 E(The byte of)133 +120 Q(fset in the current log \214le.)-.25 E(u_int32_t st_re)108 132 Q +(gion_w)-.15 E(ait;)-.1 E +(The number of times that a thread of control w)133 144 Q +(as forced to w)-.1 E(ait before obtaining the re)-.1 E(gion lock.)-.15 +E(u_int32_t st_re)108 156 Q(gion_no)-.15 E -.1(wa)-.25 G(it;).1 E +(The number of times that a thread of control w)133 168 Q +(as able to obtain the re)-.1 E(gion lock without w)-.15 E(aiting.)-.1 E +/F1 9/Times-Bold@0 SF(LOG FILE LIMITS)72 184.8 Q F0 .474(Log \214le sizes impose a time limit on the length of time a database may be accessed under transaction pro-) +108 196.8 R .91 +(tection, before it needs to be dumped and reloaded \(see)108 208.8 R/F2 +10/Times-Italic@0 SF(db_dump\(3\))3.41 E F0(and)3.41 E F2 +(db_load\(3\)\).)3.41 E F0(Unfortunately)5.91 E 3.41(,t)-.65 G(he)-3.41 +E(limits are potentially dif)108 220.8 Q(\214cult to calculate.)-.25 E +.273(The log \214le name consists of "log." follo)108 237.6 R .274 +(wed by 5 digits, resulting in a maximum of 99,999 log \214les.)-.25 F +(Con-)5.274 E .127(sider an application performing 600 transactions per second, for 15 hours a day) +108 249.6 R 2.626(,l)-.65 G .126(ogged into 10Mb log \214les,)-2.626 F +(where each transaction is logging approximately 100 bytes of data.)108 +261.6 Q(The calculation:)5 E(\(10 * 2^20 * 99999\) /)144 278.4 Q +(\(600 * 60 * 60 * 15 * 100\) = 323.63)194 290.4 Q .795(indicates that the system will run out of log \214le space in roughly 324 days.) +108 307.2 R .795(If we increase the maximum)5.795 F .136(size of the \214les from 10Mb to 100Mb, the same calculation indicates that the application will run out of log) +108 319.2 R(\214le space in roughly 9 years.)108 331.2 Q .314 +(There is no w)108 348 R .314 +(ay to reset the log \214le name space in Berk)-.1 F(ele)-.1 E 2.814(yD) +-.15 G 2.814(B. If)-2.814 F .315 +(your application is reaching the end of)2.814 F +(its log \214le name space, you should:)108 360 Q 15(1. Archi)108 376.8 +R .711 -.15(ve y)-.25 H .411 +(our databases as if to prepare for catastrophic f).15 F .411 +(ailure \(see)-.1 F F2(db_ar)2.91 E -.15(ch)-.37 G(ive).15 E F0 .41 +(\(1\) for more informa-).18 F(tion\).)133 388.8 Q 15(2. Dump)108 405.6 +R(and re-load)2.5 E/F3 10/Times-Bold@0 SF(all)2.5 E F0 +(your databases \(see)2.5 E F2(db_dump)2.5 E F0(\(1\) and).19 E F2 +(db_load)2.5 E F0(\(1\) for more information\).).77 E 15(3. Remo)108 +422.4 R .3 -.15(ve a)-.15 H(ll of the log \214les from the database en) +.15 E(vironment \(see)-.4 E F2(db_ar)2.5 E -.15(ch)-.37 G(ive).15 E F0 +(\(1\) for more information\).).18 E 15(4. Restart)108 439.2 R +(your applications.)2.5 E F1(ENVIR)72 456 Q(ONMENT V)-.27 E(ARIABLES) +-1.215 E F0(The follo)108 468 Q(wing en)-.25 E(vironment v)-.4 E +(ariables af)-.25 E(fect the e)-.25 E -.15(xe)-.15 G(cution of).15 E F2 +(db_lo)2.5 E(g)-.1 E F0(:).22 E(DB_HOME)108 484.8 Q 2.848(If the)133 +496.8 R F2(dben)5.348 E(v)-.4 E F0(ar)5.348 E 2.848(gument to)-.18 F F2 +(lo)5.348 E(g_open)-.1 E F0 -.1(wa)5.348 G 5.348(si).1 G 2.848 +(nitialized using)-5.348 F F2(db_appinit)5.349 E F0 5.349(,t).68 G 2.849 +(he en)-5.349 F 2.849(vironment v)-.4 F(ariable)-.25 E .508(DB_HOME may be used as the path of the database home for the interpretation of the) +133 508.8 R F2(dir)3.008 E F0(ar)3.008 E(gument)-.18 E(to)133 520.8 Q F2 +(lo)3.657 E(g_open)-.1 E F0 3.657(,a).24 G 3.657(sd)-3.657 G 1.157 +(escribed in)-3.657 F F2(db_appinit)3.657 E F0 3.657 +(\(3\). Speci\214cally).68 F(,)-.65 E F2(lo)3.658 E(g_open)-.1 E F0 +1.158(is af)3.658 F 1.158(fected by the con\214guration)-.25 F(string v) +133 532.8 Q(alue of DB_LOG_DIR.)-.25 E(TMPDIR)108 549.6 Q .955(If the) +133 561.6 R F2(dben)3.455 E(v)-.4 E F0(ar)3.455 E .955(gument to)-.18 F +F2(lo)3.455 E(g_open)-.1 E F0 -.1(wa)3.455 G 3.455(sN).1 G .955 +(ULL or not initialized using)-3.455 F F2(db_appinit)3.455 E F0 3.455 +(,t).68 G .955(he en)-3.455 F(vironment)-.4 E -.25(va)133 573.6 S 2.065 +(riable TMPDIR may be used as the directory in which to create the log, as described in the) +.25 F F2(lo)133 585.6 Q(g_open)-.1 E F0(section abo)2.5 E -.15(ve)-.15 G +(.).15 E F1(ERR)72 602.4 Q(ORS)-.27 E F0(The)108 614.4 Q F2(lo)3.267 E +(g_open)-.1 E F0 .766(function may f)3.267 F .766(ail and return)-.1 F +F2(errno)3.266 E F0 .766(for an)3.266 F 3.266(yo)-.15 G 3.266(ft)-3.266 +G .766(he errors speci\214ed for the follo)-3.266 F .766(wing DB and) +-.25 F(library functions: atoi\(3\), close\(2\), db_v)108 626.4 Q +(ersion\(3\), fcntl\(2\), f)-.15 E +(\215ush\(3\), log_close\(3\), log_unlink\(3\), lseek\(2\),)-.25 E +(malloc\(3\), memcp)108 638.4 Q(y\(3\), memset\(3\), mmap\(2\), munmap\(2\), open\(2\), opendir\(3\), read\(2\), readdir\(3\), real-) +-.1 E(loc\(3\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strchr\(3\), strcp) +108 650.4 Q +(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), strncmp\(3\),)-.1 E +(unlink\(2\), and write\(2\).)108 662.4 Q(In addition, the)108 679.2 Q +F2(lo)2.5 E(g_open)-.1 E F0(function may f)2.5 E(ail and return)-.1 E F2 +(errno)2.5 E F0(for the follo)2.5 E(wing conditions:)-.25 E([EA)108 696 +Q(GAIN])-.4 E(The shared memory re)133 708 Q(gion w)-.15 E(as lock)-.1 E +(ed and \(repeatedly\) una)-.1 E -.25(va)-.2 G(ilable.).25 E +(May 10, 1998)278.085 768 Q(7)201.085 E EP +%%Page: 8 8 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 363.3(DB_LOG\(3\) DB_LOG\(3\))72 48 R([EINV)108 +84 Q(AL])-1.35 E(An in)133 96 Q -.25(va)-.4 G(lid \215ag v).25 E +(alue or parameter w)-.25 E(as speci\214ed.)-.1 E +(The DB_THREAD \215ag w)133 120 Q(as speci\214ed and spinlocks are not implemented for this architecture.) +-.1 E(The speci\214ed \214le size w)133 144 Q(as too lar)-.1 E(ge.)-.18 +E(The)108 160.8 Q/F1 10/Times-Italic@0 SF(lo)3.205 E(g_close)-.1 E F0 +.705(function may f)3.205 F .705(ail and return)-.1 F F1(errno)3.205 E +F0 .704(for an)3.205 F 3.204(yo)-.15 G 3.204(ft)-3.204 G .704 +(he errors speci\214ed for the follo)-3.204 F .704(wing DB and)-.25 F +(library functions: close\(2\), fcntl\(2\), f)108 172.8 Q +(\215ush\(3\), munmap\(2\), and strerror\(3\).)-.25 E(The)108 189.6 Q F1 +(lo)3.296 E(g_\215ush)-.1 E F0 .796(function may f)3.296 F .796 +(ail and return)-.1 F F1(errno)3.297 E F0 .797(for an)3.297 F 3.297(yo) +-.15 G 3.297(ft)-3.297 G .797(he errors speci\214ed for the follo)-3.297 +F .797(wing DB and)-.25 F(library functions: close\(2\), fcntl\(2\), f) +108 201.6 Q(\215ush\(3\), fsync\(2\), lseek\(2\), malloc\(3\), memcp) +-.25 E(y\(3\), memset\(3\),)-.1 E +(open\(2\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp)108 +213.6 Q +(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), unlink\(2\), and)-.1 E +(write\(2\).)108 225.6 Q(In addition, the)108 242.4 Q F1(lo)2.5 E +(g_\215ush)-.1 E F0(function may f)2.5 E(ail and return)-.1 E F1(errno) +2.5 E F0(for the follo)2.5 E(wing conditions:)-.25 E([EINV)108 259.2 Q +(AL])-1.35 E(An in)133 271.2 Q -.25(va)-.4 G(lid \215ag v).25 E +(alue or parameter w)-.25 E(as speci\214ed.)-.1 E(The)108 288 Q F1(lo) +3.673 E(g_g)-.1 E(et)-.1 E F0 1.173(function may f)3.673 F 1.173 +(ail and return)-.1 F F1(errno)3.673 E F0 1.173(for an)3.673 F 3.673(yo) +-.15 G 3.673(ft)-3.673 G 1.173(he errors speci\214ed for the follo) +-3.673 F 1.172(wing DB and)-.25 F +(library functions: atoi\(3\), close\(2\), fcntl\(2\), f)108 300 Q +(\215ush\(3\), lseek\(2\), malloc\(3\), memcp)-.25 E +(y\(3\), memset\(3\), open\(2\),)-.1 E(opendir\(3\), read\(2\), readdir\(3\), realloc\(3\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strchr\(3\), strcp) +108 312 Q(y\(3\),)-.1 E(strdup\(3\), strerror\(3\), strlen\(3\), strncmp\(3\), and unlink\(2\).) +108 324 Q(In addition, the)108 340.8 Q F1(lo)2.5 E(g_g)-.1 E(et)-.1 E F0 +(function may f)2.5 E(ail and return)-.1 E F1(errno)2.5 E F0 +(for the follo)2.5 E(wing conditions:)-.25 E([EINV)108 357.6 Q(AL])-1.35 +E(An in)133 369.6 Q -.25(va)-.4 G(lid \215ag v).25 E +(alue or parameter w)-.25 E(as speci\214ed.)-.1 E(The DB_FIRST \215ag w) +133 393.6 Q(as speci\214ed and no log \214les were found.)-.1 E(The)108 +410.4 Q F1(lo)3.667 E(g_\214le)-.1 E F0 1.167(function may f)3.667 F +1.167(ail and return)-.1 F F1(errno)3.667 E F0 1.167(for an)3.667 F +3.667(yo)-.15 G 3.667(ft)-3.667 G 1.167 +(he errors speci\214ed for the follo)-3.667 F 1.168(wing DB and)-.25 F +(library functions: close\(2\), fcntl\(2\), f)108 422.4 Q +(\215ush\(3\), malloc\(3\), memcp)-.25 E +(y\(3\), memset\(3\), open\(2\), sig\214llset\(3\), sig-)-.1 E +(procmask\(2\), stat\(2\), strcp)108 434.4 Q +(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), and unlink\(2\).)-.1 E +(In addition, the)108 451.2 Q F1(lo)2.5 E(g_\214le)-.1 E F0 +(function may f)2.5 E(ail and return)-.1 E F1(errno)2.5 E F0 +(for the follo)2.5 E(wing conditions:)-.25 E([ENOMEM])108 468 Q +(The supplied b)133 480 Q(uf)-.2 E(fer w)-.25 E +(as too small to hold the log \214le name.)-.1 E(The)108 496.8 Q F1(lo) +3.636 E(g_put)-.1 E F0 1.136(function may f)3.636 F 1.136 +(ail and return)-.1 F F1(errno)3.636 E F0 1.136(for an)3.636 F 3.636(yo) +-.15 G 3.636(ft)-3.636 G 1.136(he errors speci\214ed for the follo) +-3.636 F 1.137(wing DB and)-.25 F +(library functions: close\(2\), fcntl\(2\), f)108 508.8 Q +(\215ush\(3\), fsync\(2\), lseek\(2\), malloc\(3\), memcp)-.25 E +(y\(3\), memset\(3\),)-.1 E +(open\(2\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp)108 +520.8 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), time\(3\), unlink\(2\),) +-.1 E(and write\(2\).)108 532.8 Q(In addition, the)108 549.6 Q F1(lo)2.5 +E(g_put)-.1 E F0(function may f)2.5 E(ail and return)-.1 E F1(errno)2.5 +E F0(for the follo)2.5 E(wing conditions:)-.25 E([EINV)108 566.4 Q(AL]) +-1.35 E(An in)133 578.4 Q -.25(va)-.4 G(lid \215ag v).25 E +(alue or parameter w)-.25 E(as speci\214ed.)-.1 E +(The record to be logged is lar)133 602.4 Q +(ger than the maximum log record.)-.18 E(The)108 619.2 Q F1(lo)2.958 E +(g_unlink)-.1 E F0 .458(function may f)2.958 F .457(ail and return)-.1 F +F1(errno)2.957 E F0 .457(for an)2.957 F 2.957(yo)-.15 G 2.957(ft)-2.957 +G .457(he errors speci\214ed for the follo)-2.957 F .457(wing DB and) +-.25 F(library functions: close\(2\), fcntl\(2\), f)108 631.2 Q +(\215ush\(3\), malloc\(3\), memcp)-.25 E +(y\(3\), memset\(3\), mmap\(2\), munmap\(2\),)-.1 E +(open\(2\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp)108 +643.2 Q +(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), and unlink\(2\).)-.1 E +(In addition, the)108 660 Q F1(lo)2.5 E(g_unlink)-.1 E F0 +(function may f)2.5 E(ail and return)-.1 E F1(errno)2.5 E F0 +(for the follo)2.5 E(wing conditions:)-.25 E([EB)108 676.8 Q(USY])-.1 E +(The shared memory re)133 688.8 Q(gion w)-.15 E +(as in use and the force \215ag w)-.1 E(as not set.)-.1 E(The)108 705.6 +Q F1(lo)2.709 E(g_ar)-.1 E -.15(ch)-.37 G(ive).15 E F0 .209 +(function may f)2.709 F .209(ail and return)-.1 F F1(errno)2.709 E F0 +.209(for an)2.709 F 2.709(yo)-.15 G 2.709(ft)-2.709 G .209 +(he errors speci\214ed for the follo)-2.709 F .208(wing DB and)-.25 F +(library functions: close\(2\), fcntl\(2\), f)108 717.6 Q(\215ush\(3\), getcwd\(3\), log_compare\(3\), log_get\(3\), malloc\(3\), mem-) +-.25 E(cp)108 729.6 Q(y\(3\), memset\(3\), open\(2\), qsort\(3\), realloc\(3\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strchr\(3\), strcmp\(3\),) +-.1 E(May 10, 1998)278.085 768 Q(8)201.085 E EP +%%Page: 9 9 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 363.3(DB_LOG\(3\) DB_LOG\(3\))72 48 R(strcp)108 +84 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), and unlink\(2\).) +-.1 E(In addition, the)108 100.8 Q/F1 10/Times-Italic@0 SF(lo)2.5 E +(g_ar)-.1 E -.15(ch)-.37 G(ive).15 E F0(function may f)2.5 E +(ail and return)-.1 E F1(errno)2.5 E F0(for the follo)2.5 E +(wing conditions:)-.25 E([EINV)108 117.6 Q(AL])-1.35 E(An in)133 129.6 Q +-.25(va)-.4 G(lid \215ag v).25 E(alue or parameter w)-.25 E +(as speci\214ed.)-.1 E(The log w)133 153.6 Q(as corrupted.)-.1 E(The)108 +170.4 Q F1(lo)2.66 E(g_r)-.1 E -.4(eg)-.37 G(ister).4 E F0 .16 +(function may f)2.66 F .16(ail and return)-.1 F F1(errno)2.66 E F0 .161 +(for an)2.66 F 2.661(yo)-.15 G 2.661(ft)-2.661 G .161 +(he errors speci\214ed for the follo)-2.661 F .161(wing DB and)-.25 F +(library functions: close\(2\), fcntl\(2\), f)108 182.4 Q +(\215ush\(3\), fsync\(2\), lseek\(2\), malloc\(3\), memcmp\(3\), memcp) +-.25 E(y\(3\), mem-)-.1 E(set\(3\), open\(2\), realloc\(3\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp) +108 194.4 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\),)-.1 E +(time\(3\), unlink\(2\), and write\(2\).)108 206.4 Q(In addition, the) +108 223.2 Q F1(lo)2.5 E(g_r)-.1 E -.4(eg)-.37 G(ister).4 E F0 +(function may f)2.5 E(ail and return)-.1 E F1(errno)2.5 E F0 +(for the follo)2.5 E(wing conditions:)-.25 E([EINV)108 240 Q(AL])-1.35 E +(An in)133 252 Q -.25(va)-.4 G(lid \215ag v).25 E(alue or parameter w) +-.25 E(as speci\214ed.)-.1 E(The)108 268.8 Q F1(lo)3.079 E(g_unr)-.1 E +-.4(eg)-.37 G(ister).4 E F0 .579(function may f)3.079 F .578 +(ail and return)-.1 F F1(errno)3.078 E F0 .578(for an)3.078 F 3.078(yo) +-.15 G 3.078(ft)-3.078 G .578(he errors speci\214ed for the follo)-3.078 +F .578(wing DB)-.25 F(and library functions: close\(2\), fcntl\(2\), f) +108 280.8 Q(\215ush\(3\), fsync\(2\), lseek\(2\), malloc\(3\), memcp) +-.25 E(y\(3\), memset\(3\),)-.1 E +(open\(2\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp)108 +292.8 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), time\(3\), unlink\(2\),) +-.1 E(and write\(2\).)108 304.8 Q(In addition, the)108 321.6 Q F1(lo)2.5 +E(g_unr)-.1 E -.4(eg)-.37 G(ister).4 E F0(function may f)2.5 E +(ail and return)-.1 E F1(errno)2.5 E F0(for the follo)2.5 E +(wing conditions:)-.25 E([EINV)108 338.4 Q(AL])-1.35 E(An in)133 350.4 Q +-.25(va)-.4 G(lid \215ag v).25 E(alue or parameter w)-.25 E +(as speci\214ed.)-.1 E(The)108 367.2 Q F1(lo)3.543 E(g_stat)-.1 E F0 +1.043(function may f)3.543 F 1.043(ail and return)-.1 F F1(errno)3.543 E +F0 1.043(for an)3.543 F 3.543(yo)-.15 G 3.543(ft)-3.543 G 1.044 +(he errors speci\214ed for the follo)-3.543 F 1.044(wing DB and)-.25 F +(library functions: fcntl\(2\), and malloc\(3\).)108 379.2 Q/F2 9 +/Times-Bold@0 SF -.09(BU)72 396 S(GS).09 E F0 1.263 +(The log \214les are not machine architecture independent.)108 408 R +(Speci\214cally)6.263 E 3.763(,l)-.65 G 1.263 +(og \214le metadata is not stored in a)-3.763 F<8c78>108 420 Q +(ed byte order)-.15 E(.)-.55 E F2(SEE ALSO)72 436.8 Q F1(db_ar)108 448.8 +Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E F1(db_c)2.5 E(hec)-.15 E +(kpoint)-.2 E F0(\(1\),).68 E F1(db_deadloc)2.5 E(k)-.2 E F0(\(1\),).67 +E F1(db_dump)2.5 E F0(\(1\),).19 E F1(db_load)2.5 E F0(\(1\),).77 E F1 +(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F1(db_stat)2.5 E F0 +(\(1\),).68 E F1(db_intr)108 460.8 Q(o)-.45 E F0(\(3\),).18 E F1 +(db_appinit)2.5 E F0(\(3\),).68 E F1(db_cur)2.5 E(sor)-.1 E F0(\(3\),) +.73 E F1(db_dbm)2.5 E F0(\(3\),).32 E F1(db_internal)2.5 E F0(\(3\),).51 +E F1(db_loc)2.5 E(k)-.2 E F0(\(3\),).67 E F1(db_lo)2.5 E(g)-.1 E F0 +(\(3\),).22 E F1(db_mpool)2.5 E F0(\(3\),).51 E F1(db_open)108 472.8 Q +F0(\(3\),).24 E F1(db_thr)2.5 E(ead)-.37 E F0(\(3\),).77 E F1(db_txn)2.5 +E F0(\(3\)).24 E(May 10, 1998)278.085 768 Q(9)201.085 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/man.ps/db_mpool.ps b/mozilla/db/man/man.ps/db_mpool.ps new file mode 100644 index 00000000000..29fef08a20b --- /dev/null +++ b/mozilla/db/man/man.ps/db_mpool.ps @@ -0,0 +1,1128 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:23 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 11 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_mpool \255 shared memory b)108 40.8 Q(uf)-.2 E(fer pool)-.25 E F0 +(SYNOPSIS)72 57.6 Q/F2 10/Times-Bold@0 SF(#include ) +-.4 E(int)108 93.6 Q(memp_open\(char *dir)108 105.6 Q(,)-.92 E +(u_int32_t \215ags, int mode, DB_ENV *dben)158 117.6 Q 1.1 -.55(v, D)-.4 +H(B_MPOOL **r).55 E(egionp\);)-.18 E(int)108 141.6 Q +(memp_close\(DB_MPOOL *mp\);)108 153.6 Q(int)108 177.6 Q(memp_f)108 +189.6 Q(open\(DB_MPOOL *mp, char *\214le, u_int32_t \215ags, int mode,) +-.25 E(size_t pagesize, DB_MPOOL_FINFO *\214nf)158 201.6 Q +(op, DB_MPOOLFILE **mpf\);)-.25 E(int)108 225.6 Q +(memp_fclose\(DB_MPOOLFILE *mpf\);)108 237.6 Q(int)108 261.6 Q +(memp_fget\(DB_MPOOLFILE *mpf)108 273.6 Q(,)-.15 E(db_pgno_t *pgnoaddr) +158 285.6 Q 2.5(,u)-.92 G(_int32_t \215ags, v)-2.5 E(oid **pagep\);)-.1 +E(int)108 309.6 Q(memp_fput\(DB_MPOOLFILE *mpf)108 321.6 Q 2.5(,v)-.15 G +(oid *pgaddr)-2.6 E 2.5(,u)-.92 G(_int32_t \215ags\);)-2.5 E(int)108 +345.6 Q(memp_fset\(DB_MPOOLFILE *mpf)108 357.6 Q 2.5(,v)-.15 G +(oid *pgaddr)-2.6 E 2.5(,u)-.92 G(_int32_t \215ags\);)-2.5 E(int)108 +381.6 Q(memp_fsync\(DB_MPOOLFILE *mpf\);)108 393.6 Q(int)108 417.6 Q +(memp_unlink\(const char *dir)108 429.6 Q 2.5(,i)-.92 G(nt f)-2.5 E(or) +-.25 E(ce, DB_ENV *\);)-.18 E(int)108 453.6 Q(memp_r)108 465.6 Q +(egister\(DB_MPOOL *mp, int ftype,)-.18 E +(int \(*pgin\)\(db_pgno_t pgno, v)158 477.6 Q(oid *pgaddr)-.1 E 2.5(,D) +-.92 G(BT *pgcookie\),)-2.5 E(int \(*pgout\)\(db_pgno_t pgno, v)158 +489.6 Q(oid *pgaddr)-.1 E 2.5(,D)-.92 G(BT *pgcookie\)\);)-2.5 E(int)108 +513.6 Q(memp_trickle\(DB_MPOOL *mp, int pct, int *nwr)108 525.6 Q +(otep\);)-.18 E(int)108 549.6 Q(memp_sync\(DB_MPOOL *mp, LSN *lsn\);)108 +561.6 Q(int)108 585.6 Q(memp_stat\(DB_MPOOL *mp, DB_MPOOL_ST)108 597.6 Q +1.9 -.95(AT *)-.9 H(*gsp,).95 E(DB_MPOOL_FST)158 609.6 Q 1.9 -.95(AT *) +-.9 H(\(*fsp\)[], v).95 E(oid *\(*db_malloc\)\(size_t\)\);)-.1 E F0 +(DESCRIPTION)72 626.4 Q F1 .486(The DB library is a f)108 638.4 R .485 +(amily of groups of functions that pro)-.1 F .485 +(vides a modular programming interf)-.15 F .485(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 650.4 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .507(\214le page caching, as well as v)108 662.4 R .507 +(arious inde)-.25 F -.15(xe)-.15 G 3.007(da).15 G .506(ccess methods.) +-3.007 F(Man)5.506 E 3.006(yo)-.15 G 3.006(ft)-3.006 G .506 +(he functional groups \(e.g., the \214le)-3.006 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 674.4 R .122(are e)108 686.4 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.121 G 2.621(rag).15 G .121(eneral description of)-2.621 +F(the DB package, see)108 698.4 Q/F3 10/Times-Italic@0 SF(db_intr)2.5 E +(o)-.45 E F1(\(3\).).18 E(This manual page describes the speci\214c details of the memory pool interf) +108 715.2 Q(ace.)-.1 E(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 334.4(DB_MPOOL\(3\) DB_MPOOL\(3\))72 48 R(The) +108 84 Q/F1 10/Times-Italic@0 SF(db_mpool)2.896 E F0 .396 +(functions are the library interf)2.896 F .397(ace intended to pro)-.1 F +.397(vide general-purpose, page-oriented b)-.15 F(uf)-.2 E(fer)-.25 E +.16(management of one or more \214les.)108 96 R .16(While designed to w) +5.16 F .16(ork with the other DB functions, these functions are)-.1 F +.107(also useful for more general purposes.)108 108 R .107 +(The memory pools \(DB_MPOOL)5.107 F -.55('s)-.92 G 2.607(\)a).55 G .108 +(re referred to in this document)-2.607 F .29(as simply `)108 120 R +(`pools')-.74 E 2.79('. Pools)-.74 F .29 +(may be shared between processes.)2.79 F .29 +(Pools are usually \214lled by pages from one or)5.29 F .873 +(more \214les \(DB_MPOOLFILE')108 132 R 3.374(s\). P)-.55 F .874 +(ages in the pool are replaced in LR)-.15 F 3.374(U\()-.4 G .874 +(least-recently-used\) order)-3.374 F 3.374(,w)-.4 G(ith)-3.374 E .971 +(each ne)108 144 R 3.471(wp)-.25 G .971 +(age replacing the page that has been unused the longest.)-3.471 F -.15 +(Pa)5.97 G .97(ges retrie).15 F -.15(ve)-.25 G 3.47(df).15 G .97 +(rom the pool using)-3.47 F F1(memp_fg)108 156 Q(et)-.1 E F0 1.552 +(are `)4.052 F(`pinned')-.74 E 4.052('i)-.74 G 4.052(nt)-4.052 G 1.552 +(he pool, by def)-4.052 F 1.552(ault, until the)-.1 F 4.052(ya)-.15 G +1.553(re returned to the pool')-4.052 F 4.053(sc)-.55 G 1.553 +(ontrol using the)-4.053 F F1(memp_fput)108 168 Q F0(function.)2.5 E F1 +(memp_open)92 184.8 Q F0(The)108 196.8 Q F1(memp_open)3.834 E F0 1.334 +(function copies a pointer)3.834 F 3.834(,t)-.4 G 3.834(ot)-3.834 G +1.334(he memory pool identi\214ed by the)-3.834 F/F2 10/Times-Bold@0 SF +(dir)3.833 E(ectory)-.18 E F1(dir)3.833 E F0 3.833(,i).73 G 1.333 +(nto the)-3.833 F(memory location referenced by)108 208.8 Q F1 -.37(re) +2.5 G(gionp)-.03 E F0(.).19 E 1.1(If the)108 225.6 R F1(dben)3.6 E(v)-.4 +E F0(ar)3.6 E 1.1(gument to)-.18 F F1(memp_open)3.6 E F0 -.1(wa)3.6 G +3.6(si).1 G 1.1(nitialized using)-3.6 F F1(db_appinit)3.6 E F0(,).68 E +F1(dir)3.6 E F0 1.1(is interpreted as described by)3.6 F F1(db_appinit) +108 237.6 Q F0(\(3\).).68 E .668(Otherwise, if)108 254.4 R F1(dir)3.168 +E F0 .668(is not NULL, it is interpreted relati)3.168 F .968 -.15(ve t) +-.25 H 3.168(ot).15 G .668(he current w)-3.168 F .667 +(orking directory of the process.)-.1 F(If)5.667 E F1(dir)108 266.4 Q F0 +2.387(is NULL, the follo)4.887 F 2.388(wing en)-.25 F 2.388(vironment v) +-.4 F 2.388(ariables are check)-.25 F 2.388(ed in order: `)-.1 F +(`TMPDIR')-.74 E 2.388(', `)-.74 F(`TEMP')-.74 E 2.388(', and)-.74 F +-.74(``)108 278.4 S(TMP').74 E 2.546('. If)-.74 F .046 +(one of them is set, memory pool \214les are created relati)2.546 F .345 +-.15(ve t)-.25 H 2.545(ot).15 G .045(he directory it speci\214es.)-2.545 +F .045(If none of)5.045 F 1.5 +(them are set, the \214rst possible one of the follo)108 290.4 R 1.501 +(wing directories is used:)-.25 F F1(/var/tmp)4.001 E F0(,).19 E F1 +(/usr/tmp)4.001 E F0(,).19 E F1(/temp)4.001 E F0(,).19 E F1(/tmp)4.001 E +F0(,).19 E F1(C:/temp)108 302.4 Q F0(and)2.5 E F1(C:/tmp)2.5 E F0(.).19 +E .943(All \214les associated with the memory pool are created in this directory) +108 319.2 R 5.942(.T)-.65 G .942(his directory must already e)-5.942 F +(xist)-.15 E(when)108 331.2 Q .455(memory pool_open is called.)108 355.2 +R .455(If the memory pool already e)5.455 F .455 +(xists, the process must ha)-.15 F .755 -.15(ve p)-.2 H .455 +(ermission to read).15 F .67(and write the e)108 367.2 R .67 +(xisting \214les.)-.15 F .67(If the memory pool does not already e)5.67 +F .67(xist, it is optionally created and initial-)-.15 F(ized.)108 379.2 +Q(The)108 396 Q F1<8d61>3.76 E(gs)-.1 E F0(and)3.76 E F1(mode)3.76 E F0 +(ar)3.76 E 1.26(guments specify ho)-.18 F 3.761<778c>-.25 G 1.261 +(les will be opened and/or created when the)-3.761 F 3.761(yd)-.15 G +(on')-3.761 E 3.761(ta)-.18 G(lready)-3.761 E -.15(ex)108 408 S 2.5 +(ist. The).15 F(\215ags v)2.5 E(alue is speci\214ed by)-.25 E F2(or)2.5 +E F0('ing together one or more of the follo)A(wing v)-.25 E(alues:)-.25 +E(DB_CREA)108 424.8 Q(TE)-1.11 E .484(Create an)133 436.8 R 2.984(yu) +-.15 G .483(nderlying \214les, as necessary)-2.984 F 5.483(.I)-.65 G +2.983(ft)-5.483 G .483(he \214les do not already e)-2.983 F .483 +(xist and the DB_CREA)-.15 F .483(TE \215ag)-1.11 F +(is not speci\214ed, the call will f)133 448.8 Q(ail.)-.1 E +(DB_MPOOL_PRIV)108 465.6 Q -1.11(AT)-1.35 G(E)1.11 E .829(Create a pri) +133 477.6 R -.25(va)-.25 G .829(te MPOOL that is not shared with an).25 +F 3.329(yo)-.15 G .83(ther process \(although it may be shared with) +-3.329 F(other threads\).)133 489.6 Q(DB_NOMMAP)108 506.4 Q(Al)133 518.4 +Q -.1(wa)-.1 G 1.257(ys cop).1 F 3.757<798c>-.1 G 1.257(les in this memory pool into the local cache instead of mapping them into process) +-3.757 F .148(memory \(see the description of the)133 530.4 R F1 +(mp_mmapsize)2.648 E F0 .149 +(\214eld of the DB_ENV structure for further informa-)2.649 F(tion\).) +133 542.4 Q(DB_THREAD)108 571.2 Q 2.273 +(Cause the DB_MPOOL handle returned by the)133 583.2 R F1(memp_open) +4.773 E F0 2.273(function to be useable by multiple)4.773 F +(threads within a single address space, i.e., to be `)133 595.2 Q +(`free-threaded')-.74 E('.)-.74 E 1.693(All \214les created by the memory pool subsystem \(other than \214les created by the) +108 612 R F1(memp_fopen)4.193 E F0(function,)4.193 E .059 +(which are separately speci\214ed\) are created with mode)108 624 R F1 +(mode)2.559 E F0 .059(\(as described in)2.559 F F1 -.15(ch)2.559 G(mod) +.15 E F0 .058(\(2\)\) and modi\214ed by the).77 F .293(process' umask v) +108 636 R .293(alue at the time of creation \(see)-.25 F F1(umask)2.794 +E F0 2.794(\(2\)\). The).67 F .294(group o)2.794 F .294 +(wnership of created \214les is based)-.25 F +(on the system and directory def)108 648 Q +(aults, and is not further speci\214ed by DB.)-.1 E .341 +(The memory pool subsystem is con\214gured based on the)108 664.8 R F1 +(dben)2.841 E(v)-.4 E F0(ar)2.841 E .34(gument to)-.18 F F1(memp_open) +2.84 E F0 2.84(,w).24 G .34(hich is a pointer)-2.84 F .519 +(to a structure of type DB_ENV \(typedef)108 676.8 R 1.519 -.5('d i).55 +H 3.019(n<).5 G(db)-3.019 E 3.019(.h>\). Applications)-.4 F .52 +(will normally use the same DB_ENV)3.019 F(structure \(initialized by) +108 688.8 Q F1(db_appinit)2.5 E F0(\(3\)\), as an ar).68 E +(gument to all of the subsystems in the DB package.)-.18 E .439(References to the DB_ENV structure are maintained by DB, so it may not be discarded until the last close) +108 705.6 R .286 +(function, corresponding to an open function for which it w)108 717.6 R +.287(as an ar)-.1 F .287(gument, has returned.)-.18 F .287 +(In order to ensure)5.287 F 1.578(compatibility with future releases of DB, all \214elds of the DB_ENV structure that are not e) +108 729.6 R 1.578(xplicitly set)-.15 F(May 10, 1998)278.085 768 Q(2) +201.085 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 334.4(DB_MPOOL\(3\) DB_MPOOL\(3\))72 48 R .17(should be initialized to 0 before the \214rst time the structure is used.) +108 84 R .171(Do this by declaring the structure e)5.171 F(xter)-.15 E +(-)-.2 E(nal or static, or by calling the C library routine)108 96 Q/F1 +10/Times-Italic@0 SF(bzer)2.5 E(o)-.45 E F0(\(3\) or).18 E F1(memset)2.5 +E F0(\(3\).).68 E .259(The \214elds of the DB_ENV structure used by)108 +112.8 R F1(memp_open)2.759 E F0 .259(are described belo)2.759 F 4.059 +-.65(w. I)-.25 H(f).65 E F1(dben)2.759 E(v)-.4 E F0 .259(is NULL or an) +2.759 F 2.758(yo)-.15 G(f)-2.758 E(its \214elds are set to 0, def)108 +124.8 Q(aults appropriate for the system are used where possible.)-.1 E +(The follo)108 141.6 Q(wing \214elds in the DB_ENV structure may be initialized before calling) +-.25 E F1(memp_open)2.5 E F0(:).24 E -.2(vo)108 158.4 S +(id *\(*db_errcall\)\(char *db_errpfx, char *b).2 E(uf)-.2 E(fer\);)-.25 +E(FILE *db_err\214le;)108 170.4 Q(const char *db_errpfx;)108 182.4 Q +(int db_v)108 194.4 Q(erbose;)-.15 E +(The error \214elds of the DB_ENV beha)133 206.4 Q .3 -.15(ve a)-.2 H +2.5(sd).15 G(escribed for)-2.5 E F1(db_appinit)2.5 E F0(\(3\).).68 E +(size_t mp_mmapsize;)108 247.2 Q 1.63 +(Files that are opened read-only in the pool \(and that satisfy a fe)133 +259.2 R 4.131(wo)-.25 G 1.631(ther criteria\) are, by def)-4.131 F +(ault,)-.1 E .041(mapped into the process address space instead of being copied into the local cache.) +133 271.2 R .04(This can result in)5.04 F(better)133 283.2 Q 1.33 +(-than-usual performance, as a)-.2 F -.25(va)-.2 G 1.331 +(ilable virtual memory is normally much lar).25 F 1.331 +(ger than the local)-.18 F .851(cache, and page f)133 295.2 R .851 +(aults are f)-.1 F .851(aster than page cop)-.1 F .851(ying on man)-.1 F +3.35(ys)-.15 G 3.35(ystems. Ho)-3.35 F(we)-.25 E -.15(ve)-.25 G 1.65 -.4 +(r, i).15 H 3.35(nt).4 G .85(he presence of)-3.35 F .262 +(limited virtual memory it can cause resource starv)133 307.2 R .262 +(ation, and in the presence of lar)-.25 F .262(ge databases, it can)-.18 +F .636(result in immense process sizes.)133 319.2 R(If)5.636 E F1 +(mp_mmapsize)3.136 E F0 .636 +(is non-zero, it speci\214es the maximum \214le size, in)3.136 F +(bytes, for a \214le to be mapped into the process address space.)133 +331.2 Q(By def)5 E(ault, it is set to 10Mb)-.1 E(.)-.4 E +(size_t mp_size;)108 348 Q .756 +(The suggested size of the pool, in bytes.)133 360 R .756 +(This should be the size of the normal w)5.756 F .757 +(orking data set of)-.1 F 1.502(the application, with some small amount of additional memory for unusual situations.) +133 372 R 1.501(\(Note, the)6.501 F -.1(wo)133 384 S .324(rking set is not the same as the number of simultaneously referenced pages, and should be quite a) +.1 F .549(bit lar)133 396 R 3.049(ger!\) The)-.18 F(def)3.049 E .548(ault cache size is 128K bytes \(16 8K byte pages\), and may not be less than 20K) +-.1 F(bytes.)133 408 Q(The)108 424.8 Q F1(memp_open)2.5 E F0 +(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E F1(memp_close)92 441.6 Q F0(The)108 +453.6 Q F1(memp_close)5.113 E F0 2.613 +(function closes the pool indicated by the DB_MPOOL pointer)5.113 F F1 +(mp)5.114 E F0 5.114(,a).19 G 5.114(sr)-5.114 G 2.614(eturned by)-5.114 +F F1(memp_open)108 465.6 Q F0 5.395(.T).24 G .394 +(his function does not imply a call to)-5.395 F F1(memp_fsync)2.894 E F0 +2.894(,b).31 G .394(ut does imply a call to)-3.094 F F1(memp_fclose) +2.894 E F0(for)2.894 E(an)108 477.6 Q 2.5(yr)-.15 G(emaining open DB_MPOOLFILE pointers returned to this process by calls to) +-2.5 E F1(memp_fopen)2.5 E F0(.).24 E .515(In addition, if the)108 494.4 +R F1(dir)3.015 E F0(ar)3.015 E .515(gument to)-.18 F F1(memp_open)3.016 +E F0 -.1(wa)3.016 G 3.016(sN).1 G .516(ULL and)-3.016 F F1(dben)3.016 E +(v)-.4 E F0 -.1(wa)3.016 G 3.016(sn).1 G .516(ot initialized using) +-3.016 F F1(db_appinit)3.016 E F0(,).68 E .969(or the DB_MPOOL_PRIV)108 +506.4 R -1.11(AT)-1.35 G 3.469<458d>1.11 G .969(ag w)-3.469 F .968 +(as set, all \214les created for this shared re)-.1 F .968 +(gion will be remo)-.15 F -.15(ve)-.15 G .968(d, as if).15 F F1 +(memp_unlink)108 518.4 Q F0(were called.)2.5 E .958 +(When multiple threads are using the DB_MPOOL handle concurrently)108 +535.2 R 3.459(,o)-.65 G .959(nly a single thread may call the)-3.459 F +F1(memp_close)108 547.2 Q F0(function.)2.5 E(The)108 564 Q F1 +(memp_close)2.5 E F0(function returns the v)2.5 E(alue of)-.25 E F1 +(errno)2.5 E F0(on f)2.5 E(ailure and 0 on success.)-.1 E F1(memp_fopen) +92 580.8 Q F0(The)108 592.8 Q F1(memp_fopen)3.84 E F0 1.34 +(function opens a \214le in the pool speci\214ed by the DB_MPOOL ar)3.84 +F 1.34(gument, cop)-.18 F 1.34(ying the)-.1 F(DB_MPOOLFILE pointer representing it into the memory location referenced by) +108 604.8 Q F1(mpf)2.5 E F0(.)1.96 E(The)108 621.6 Q F1(\214le)2.966 E +F0(ar)2.966 E .466(gument is the name of the \214le to be opened.)-.18 F +(If)5.466 E F1(\214le)2.966 E F0 .467(is NULL, a pri)2.966 F -.25(va) +-.25 G .467(te \214le is created that cannot).25 F(be shared with an)108 +633.6 Q 2.5(yo)-.15 G +(ther process \(although it may be shared with other threads\).)-2.5 E +(The)108 650.4 Q F1<8d61>3.761 E(gs)-.1 E F0(and)3.761 E F1(mode)3.761 E +F0(ar)3.761 E 1.261(guments specify ho)-.18 F 3.761<778c>-.25 G 1.26 +(les will be opened and/or created when the)-3.761 F 3.76(yd)-.15 G(on') +-3.76 E 3.76(ta)-.18 G(lready)-3.76 E -.15(ex)108 662.4 S 2.5(ist. The) +.15 F(\215ags v)2.5 E(alue is speci\214ed by)-.25 E/F2 10/Times-Bold@0 +SF(or)2.5 E F0('ing together one or more of the follo)A(wing v)-.25 E +(alues:)-.25 E(DB_CREA)108 679.2 Q(TE)-1.11 E .483(Create an)133 691.2 R +2.983(yu)-.15 G .483(nderlying \214les, as necessary)-2.983 F 5.483(.I) +-.65 G 2.983(ft)-5.483 G .483(he \214les do not already e)-2.983 F .483 +(xist and the DB_CREA)-.15 F .484(TE \215ag)-1.11 F +(is not speci\214ed, the call will f)133 703.2 Q(ail.)-.1 E +(May 10, 1998)278.085 768 Q(3)201.085 E EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 334.4(DB_MPOOL\(3\) DB_MPOOL\(3\))72 48 R +(DB_NOMMAP)108 84 Q(Al)133 96 Q -.1(wa)-.1 G .058(ys cop).1 F 2.557(yt) +-.1 G .057(his \214le into the local cache instead of mapping it into process memory \(see the descrip-) +-2.557 F(tion of the)133 108 Q/F1 10/Times-Italic@0 SF(mp_mmapsize)2.5 E +F0(\214eld of the DB_ENV structure for further information\).)2.5 E +(DB_RDONL)108 124.8 Q(Y)-1 E 1.123(Open an)133 136.8 R 3.623(yu)-.15 G +1.123(nderlying \214les for reading only)-3.623 F 6.124(.A)-.65 G 1.424 +-.15(ny a)-6.124 H 1.124 +(ttempt to write the \214le using the pool functions).15 F(will f)133 +148.8 Q(ail, re)-.1 E -.05(ga)-.15 G +(rdless of the actual permissions of the \214le.).05 E .614 +(All \214les created by the function)108 165.6 R F1(memp_fopen)3.114 E +F0 .614(are created with mode)3.114 F F1(mode)3.114 E F0 .613 +(\(as described in)3.114 F F1 -.15(ch)3.113 G(mod).15 E F0 .613 +(\(2\)\) and).77 F .391(modi\214ed by the process' umask v)108 177.6 R +.391(alue at the time of creation \(see)-.25 F F1(umask)2.891 E F0 2.891 +(\(2\)\). The).67 F .392(group o)2.891 F .392(wnership of cre-)-.25 F +(ated \214les is based on the system and directory def)108 189.6 Q +(aults, and is not further speci\214ed by DB.)-.1 E(The)108 206.4 Q F1 +(pa)3.578 E -.1(ge)-.1 G(size).1 E F0(ar)3.578 E 1.077(gument is the size, in bytes, of the unit of transfer between the application and the pool,) +-.18 F(although it is not necessarily the unit of transfer between the pool and the source \214le.) +108 218.4 Q .095 +(Files opened in the pool may be further con\214gured based on the)108 +235.2 R F1(\214nfop)2.596 E F0(ar)2.596 E .096(gument to)-.18 F F1 +(memp_fopen)2.596 E F0 2.596(,w).24 G .096(hich is a)-2.596 F .04 +(pointer to a structure of type DB_MPOOL_FINFO \(typedef)108 247.2 R +1.039 -.5('d i).55 H 2.539(n<).5 G(db)-2.539 E 2.539(.h>\). No)-.4 F +.039(references to the)2.539 F F1(\214nfop)2.539 E F0(struc-)2.539 E +1.364(ture are maintained by DB, so it may be discarded when the)108 +259.2 R F1(memp_fopen)3.864 E F0 1.364(function returns.)3.864 F 1.365 +(In order to)6.364 F .137(ensure compatibility with future releases of DB, all \214elds of the DB_MPOOL_FINFO structure that are not) +108 271.2 R -.15(ex)108 283.2 S .656(plicitly set should be initialized to 0 before the \214rst time the structure is used.) +.15 F .656(Do this by declaring the)5.656 F(structure e)108 295.2 Q +(xternal or static, or by calling the C library routine)-.15 E F1(bzer) +2.5 E(o)-.45 E F0(\(3\) or).18 E F1(memset)2.5 E F0(\(3\).).68 E 1.382 +(The \214elds of the DB_MPOOL_FINFO structure used by)108 312 R F1 +(memp_fopen)3.882 E F0 1.382(are described)3.882 F(belo)6.382 E 5.182 +-.65(w. I)-.25 H(f).65 E F1(\214nfop)3.882 E F0(is)3.882 E(NULL or an) +108 324 Q 2.5(yo)-.15 G 2.5(fi)-2.5 G(ts \214elds are set to their def) +-2.5 E(ault v)-.1 E(alue, def)-.25 E +(aults appropriate for the system are used.)-.1 E(int ftype;)108 340.8 Q +(The)133 352.8 Q F1(ftype)3.92 E F0 1.42 +(\214eld should be the same as a)3.92 F F1(ftype)3.921 E F0(ar)3.921 E +1.421(gument pre)-.18 F 1.421(viously speci\214ed to the)-.25 F F1 +(memp_r)3.921 E -.4(eg)-.37 G(ister).4 E F0 1.766 +(function, unless no input or output processing of the \214le')133 364.8 +R 4.266(sp)-.55 G 1.766(ages are necessary)-4.266 F 4.266(,i)-.65 G +4.266(nw)-4.266 G 1.766(hich case it)-4.266 F(should be 0.)133 376.8 Q +(\(See the description of the)5 E F1(memp_r)2.5 E -.4(eg)-.37 G(ister).4 +E F0(function for more information.\))2.5 E(DBT *pgcookie;)108 393.6 Q +(The)133 405.6 Q F1(pgcookie)2.782 E F0 .282 +(\214eld contains the byte string that is passed to the)2.782 F F1(pgin) +2.782 E F0(and)2.782 E F1(pgout)2.782 E F0 .283 +(functions for this \214le,)2.783 F 1.345(if an)133 417.6 R 5.145 -.65 +(y. I)-.15 H 3.845(fn).65 G(o)-3.845 E F1(pgin)3.845 E F0(or)3.845 E F1 +(pgout)3.845 E F0 1.345(functions are speci\214ed, the)3.845 F F1 +(pgcookie)3.845 E F0 1.344(\214eld should be NULL.)3.845 F 1.344 +(\(See the)6.344 F(description of the)133 429.6 Q F1(memp_r)2.5 E -.4 +(eg)-.37 G(ister).4 E F0(function for more information.\))2.5 E +(u_int8_t *\214leid;)108 446.4 Q(The)133 458.4 Q F1(\214leid)2.797 E F0 +.298(\214eld is a unique identi\214er for the \214le.)2.797 F .298 +(The mpool functions must be able to uniquely iden-)5.298 F .176(tify \214les in order that multiple processes sharing a \214le will correctly share its underlying pages.) +133 470.4 R(Nor)5.175 E(-)-.2 E(mally)133 482.4 Q 3.358(,t)-.65 G(he) +-3.358 E F1(\214leid)3.358 E F0 .858 +(\214eld should be NULL and the mpool functions will use the \214le') +3.358 F 3.359(sd)-.55 G -.25(ev)-3.359 G .859(ice and inode).25 F .044 +(numbers \(see)133 494.4 R F1(stat)2.544 E F0 .043 +(\(2\)\) for this purpose.).68 F .043(On some \214lesystems, \(e.g., F) +5.043 F 2.263 -1.11(AT o)-.74 H 2.543(rN)1.11 G .043(FS\) \214le de) +-2.543 F .043(vice and inode)-.25 F 1.578 +(numbers are not necessarily unique across system reboots.)133 506.4 R +/F2 10/Times-Bold@0 SF -.25(Ap)6.578 G 1.579 +(plications wanting to maintain a).25 F(shar)133 518.4 Q 1.653 +(ed memory b)-.18 F 1.653(uffer pool acr)-.2 F 1.652(oss system r)-.18 F +1.652(eboots, wher)-.18 F 4.152(et)-.18 G 1.652 +(he pool contains pages fr)-4.152 F 1.652(om \214les)-.18 F(stor)133 +530.4 Q .555(ed on such \214lesystems, must specify a unique \214le identi\214er to the) +-.18 F F1(memp_fopen)3.055 E F0 .555(call and each)3.055 F .945 +(process opening or re)133 542.4 R .945(gistering the \214le must pro) +-.15 F .944(vide the same unique identi\214er)-.15 F 5.944(.I)-.55 G +3.444(ft)-5.944 G(he)-3.444 E F1(\214leid)3.444 E F0 .944(\214eld is) +3.444 F .522 +(non-NULL, it must reference a DB_FILE_ID_LEN \(as de\214ned in \) length array of bytes that)-.4 F .058 +(will be used to uniquely identify the \214le.)133 566.4 R .057 +(This should not be necessary for most applications.)5.058 F(Specif-) +5.057 E(ically)133 578.4 Q 3.051(,i)-.65 G 3.051(ti)-3.051 G 3.052(sn) +-3.051 G .552(ot necessary if the memory pool is re-instantiated after each system reboot, the applica-) +-3.052 F .265(tion is using the DB access methods instead of calling the pool functions e) +133 590.4 R(xplicitly)-.15 E 2.764(,o)-.65 G 2.764(rt)-2.764 G .264 +(he \214les in the)-2.764 F .145 +(memory pool are stored on \214lesystems where the \214le de)133 602.4 R +.145(vice and inode numbers do not change across)-.25 F(system reboots.) +133 614.4 Q(int32_t lsn_of)108 631.2 Q(fset;)-.25 E(The)133 643.2 Q F1 +(lsn_of)4.289 E(fset)-.18 E F0 1.788(\214eld is the zero-based byte of) +4.289 F 1.788(fset in the page of the page')-.25 F 4.288(sl)-.55 G 1.788 +(og sequence number)-4.288 F .327(\(LSN\), or \2551 if no LSN of)133 +655.2 R .328(fset is speci\214ed.)-.25 F .328 +(\(See the description of the)5.328 F F1(memp_sync)2.828 E F0 .328 +(function for more)2.828 F(information.\))133 667.2 Q +(u_int32_t clear_len;)108 684 Q(The)133 696 Q F1(clear_len)2.664 E F0 +.164(\214eld is the number of initial bytes in a page that should be set to zero when the page is) +2.664 F 1.791(created as a result of the DB_MPOOL_CREA)133 708 R 1.791 +(TE or DB_MPOOL_NEW \215ags being speci\214ed to)-1.11 F F1(memp_fg)133 +720 Q(et)-.1 E F0 5(.I).68 G(f)-5 E F1(\214nfop)2.5 E F0(is NULL or)2.5 +E F1(clear_len)2.5 E F0(is 0, the entire page is cleared.)2.5 E +(May 10, 1998)278.085 768 Q(4)201.085 E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 334.4(DB_MPOOL\(3\) DB_MPOOL\(3\))72 48 R(The) +108 84 Q/F1 10/Times-Italic@0 SF(memp_fopen)2.5 E F0 +(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E F1(memp_fclose)92 100.8 Q F0(The)108 +112.8 Q F1(memp_fclose)4.11 E F0 1.609(function closes the source \214le indicated by the DB_MPOOLFILE pointer) +4.11 F F1(mpf)4.109 E F0 6.609(.T)1.96 G(his)-6.609 E .798 +(function does not imply a call to)108 124.8 R F1(memp_fsync)3.298 E F0 +3.298(,i).31 G .798 +(.e. no pages are written to the source \214le as as a result of)-3.298 +F(calling)108 136.8 Q F1(memp_fclose)2.5 E F0(.).18 E 3.333 +(In addition, if the)108 153.6 R F1(\214le)5.833 E F0(ar)5.833 E 3.333 +(gument to)-.18 F F1(memp_fopen)5.833 E F0 -.1(wa)5.833 G 5.833(sN).1 G +3.333(ULL, an)-5.833 F 5.832(yu)-.15 G 3.332 +(nderlying \214les created for this)-5.832 F(DB_MPOOLFILE will be remo) +108 165.6 Q -.15(ve)-.15 G(d.).15 E(The)108 182.4 Q F1(memp_fclose)2.5 E +F0(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f) +2.5 E(ailure and 0 on success.)-.1 E F1(memp_fg)92 199.2 Q(et)-.1 E F0 +(The)108 211.2 Q F1(memp_fg)2.551 E(et)-.1 E F0 .052(function copies a pointer to the page with the page number speci\214ed by) +2.551 F F1(pgnoaddr)2.552 E F0 2.552(,f).73 G .052(rom the)-2.552 F .365 +(source \214le speci\214ed by the DB_MPOOLFILE pointer)108 223.2 R F1 +(mpf)2.865 E F0 2.865(,i)1.96 G .365 +(nto the memory location referenced by)-2.865 F F1(pa)2.865 E -.1(ge)-.1 +G(p).1 E F0(.).19 E(If the page does not e)108 235.2 Q +(xist or cannot be retrie)-.15 E -.15(ve)-.25 G(d,).15 E F1(memp_fg)2.5 +E(et)-.1 E F0(will f)2.5 E(ail.)-.1 E +(The returned page is size_t type aligned.)108 252 Q/F2 10/Times-Bold@0 +SF -.1(Pa)108 268.8 S(ge numbers begin at 0, e.g).1 E +(., the \214rst page in the \214le is page number 0, not page number 1.) +-.15 E F0(The)108 285.6 Q F1<8d61>2.5 E(gs)-.1 E F0(ar)2.5 E +(gument is speci\214ed by)-.18 E F2(or)2.5 E F0 +('ing together one or more of the follo)A(wing v)-.25 E(alues:)-.25 E +(DB_MPOOL_CREA)108 302.4 Q(TE)-1.11 E +(If the speci\214ed page does not e)133 314.4 Q(xist, create it.)-.15 E +(In this case, the)5 E F1(pgin)2.5 E F0 +(function, if speci\214ed, is called.)2.5 E(DB_MPOOL_LAST)108 331.2 Q +2.105(Return the last page of the source \214le and cop)133 343.2 R +4.605(yi)-.1 G 2.106(ts page number to the location referenced by)-4.605 +F F1(pgnoaddr)133 355.2 Q F0(.).73 E(DB_MPOOL_NEW)108 372 Q .743 +(Create a ne)133 384 R 3.243(wp)-.25 G .743(age in the \214le and cop) +-3.243 F 3.243(yi)-.1 G .743 +(ts page number to the location referenced by)-3.243 F F1(pgnoaddr)3.242 +E F0 5.742(.I).73 G(n)-5.742 E(this case, the)133 396 Q F1(pgin)2.5 E F0 +(function, if speci\214ed, is not called.)2.5 E(The DB_MPOOL_CREA)108 +412.8 Q(TE, DB_MPOOL_LAST and DB_MPOOL_NEW \215ags are mutually e)-1.11 +E(xclusi)-.15 E -.15(ve)-.25 G(.).15 E(Created pages ha)108 429.6 Q .3 +-.15(ve a)-.2 H(ll their bytes set to 0, unless otherwise speci\214ed when the \214le w) +.15 E(as opened.)-.1 E 1.44(All pages returned by)108 446.4 R F1 +(memp_fg)3.94 E(et)-.1 E F0 1.44(will be retained \(i.e. `)3.94 F +(`pinned')-.74 E 1.44('\) in the pool until a subsequent call to)-.74 F +F1(memp_fput)108 458.4 Q F0(.).68 E(The)108 475.2 Q F1(memp_fg)2.5 E(et) +-.1 E F0(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0 +(on f)2.5 E(ailure and 0 on success.)-.1 E F1(memp_fput)92 492 Q F0(The) +108 504 Q F1(memp_fput)4.804 E F0 2.304 +(function indicates that the page referenced by)4.804 F F1(pgaddr)4.804 +E F0 2.304(can be e)4.804 F 2.304(victed from the pool.)-.25 F F1 +(Pgaddr)108 516 Q F0(must be an address pre)2.5 E(viously returned by) +-.25 E F1(memp_fg)2.5 E(et)-.1 E F0(.).68 E(The)108 532.8 Q F1<8d61>2.5 +E(gs)-.1 E F0(ar)2.5 E(gument is speci\214ed by)-.18 E F2(or)2.5 E F0 +('ing together one or more of the follo)A(wing v)-.25 E(alues:)-.25 E +(DB_MPOOL_CLEAN)108 549.6 Q 1.556(Clear an)133 561.6 R 4.056(yp)-.15 G +(re)-4.056 E 1.556(viously set modi\214cation information \(i.e., don') +-.25 F 4.056(tb)-.18 G 1.557(other writing the page back to the)-4.056 F +(source \214le\).)133 573.6 Q(DB_MPOOL_DIR)108 590.4 Q(TY)-.6 E .052(The page has been modi\214ed and must be written to the source \214le before being e) +133 602.4 R .051(victed from the pool.)-.25 F(DB_MPOOL_DISCARD)108 619.2 +Q .144(The page is unlik)133 631.2 R .144(ely to be useful in the near future, and should be discarded before other pages in the) +-.1 F(pool.)133 643.2 Q(The DB_MPOOL_CLEAN and DB_MPOOL_DIR)108 660 Q +(TY \215ags are mutually e)-.6 E(xclusi)-.15 E -.15(ve)-.25 G(.).15 E +(The)108 676.8 Q F1(memp_fput)2.5 E F0(function returns the v)2.5 E +(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 E(ailure and 0 on success.) +-.1 E F1(memp_fset)92 693.6 Q F0(The)108 705.6 Q F1(memp_fset)3.1 E F0 +.6(function sets the \215ags associated with the page referenced by)3.1 +F F1(pgaddr)3.1 E F0 .6(without unpinning it)3.1 F 1.818(from the pool.) +108 717.6 R F1(Pgaddr)6.818 E F0 1.819(must be an address pre)4.318 F +1.819(viously returned by)-.25 F F1(memp_fg)4.319 E(et)-.1 E F0 6.819 +(.T).68 G(he)-6.819 E F1<8d61>4.319 E(gs)-.1 E F0(ar)4.319 E 1.819 +(gument to)-.18 F F1(memp_fset)108 729.6 Q F0 .937(is speci\214ed by) +3.438 F F2(or)3.437 E F0 .937('ing together one or more of the v)B .937 +(alues speci\214ed as \215ags for the)-.25 F F1(memp_fput)3.437 E F0 +(May 10, 1998)278.085 768 Q(5)201.085 E EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 334.4(DB_MPOOL\(3\) DB_MPOOL\(3\))72 48 R(call.) +108 84 Q(The)108 100.8 Q/F1 10/Times-Italic@0 SF(memp_fset)2.5 E F0 +(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E F1(memp_fsync)92 117.6 Q F0(The)108 +129.6 Q F1(memp_fsync)3.704 E F0 1.205 +(function writes all pages associated with the DB_MPOOLFILE pointer) +3.704 F F1(mpf)3.705 E F0 3.705(,t)1.96 G 1.205(hat were)-3.705 F(mark) +108 141.6 Q .75(ed as modi\214ed using)-.1 F F1(memp_fput)3.25 E F0(or) +3.25 E F1(memp_fset)3.25 E F0 3.25(,b).68 G .749 +(ack to the source \214le.)-3.25 F .749(If an)5.749 F 3.249(yo)-.15 G +3.249(ft)-3.249 G .749(he modi\214ed pages)-3.249 F(are also pinned \(i.e., currently referenced by this or another process\)) +108 153.6 Q F1(memp_fsync)2.5 E F0(will ignore them.)2.5 E(The)108 170.4 +Q F1(memp_fsync)3.532 E F0 1.032(function returns the v)3.532 F 1.032 +(alue of)-.25 F F1(errno)3.532 E F0 1.032(on f)3.532 F 1.032 +(ailure, 0 on success, and DB_INCOMPLETE if)-.1 F +(there were pages which were modi\214ed b)108 182.4 Q(ut which)-.2 E F1 +(memp_fsync)2.5 E F0 -.1(wa)2.5 G 2.5(su).1 G(nable to write.)-2.5 E F1 +(memp_unlink)92 211.2 Q F0(The)108 223.2 Q F1(memp_unlink)2.567 E F0 +.067(function destro)2.567 F .067 +(ys the memory pool identi\214ed by the directory)-.1 F F1(dir)2.566 E +F0 2.566(,r).73 G(emo)-2.566 E .066(ving all \214les used)-.15 F .405 +(to implement the memory pool.)108 235.2 R .406(\(The directory)5.406 F +F1(dir)2.906 E F0 .406(is not remo)2.906 F -.15(ve)-.15 G 2.906(d.\) If) +.15 F .406(there are processes that ha)2.906 F .706 -.15(ve c)-.2 H +(alled).15 E F1(memp_open)108 247.2 Q F0 2.581(without calling)5.081 F +F1(memp_close)5.081 E F0 2.581 +(\(i.e., there are processes currently using the memory pool\),)5.081 F +F1(memp_unlink)108 259.2 Q F0 .794(will f)3.294 F .794(ail without further action, unless the force \215ag is set, in which case) +-.1 F F1(memp_unlink)3.295 E F0(will)3.295 E(attempt to remo)108 271.2 Q +.3 -.15(ve t)-.15 H(he memory pool \214les re).15 E -.05(ga)-.15 G +(rdless of an).05 E 2.5(yp)-.15 G(rocesses still using the memory pool.) +-2.5 E .766(The result of attempting to forcibly destro)108 288 R 3.266 +(yt)-.1 G .766(he re)-3.266 F .766(gion when a process has the re)-.15 F +.765(gion open is unspeci\214ed.)-.15 F 1.232 +(Processes using a shared memory re)108 300 R 1.232 +(gion maintain an open \214le descriptor for it.)-.15 F 1.232 +(On UNIX systems, the)6.232 F(re)108 312 Q .474(gion remo)-.15 F -.25 +(va)-.15 G 2.974(ls).25 G .473(hould succeed and processes that ha) +-2.974 F .773 -.15(ve a)-.2 H .473(lready joined the re).15 F .473 +(gion should continue to run in)-.15 F .097(the re)108 324 R .097 +(gion without change, ho)-.15 F(we)-.25 E -.15(ve)-.25 G 2.597(rp).15 G +.098(rocesses attempting to join the memory pool will either f)-2.597 F +.098(ail or attempt)-.1 F .587(to create a ne)108 336 R 3.087(wr)-.25 G +-.15(eg)-3.087 G 3.087(ion. On).15 F .586(other systems, e.g., WNT)3.087 +F 3.086(,w)-.74 G .586(here the)-3.086 F F1(unlink)3.086 E F0 .586 +(\(2\) system call will f).67 F .586(ail if an)-.1 F 3.086(yp)-.15 G +(ro-)-3.086 E(cess has an open \214le descriptor for the \214le, the re) +108 348 Q(gion remo)-.15 E -.25(va)-.15 G 2.5(lw).25 G(ill f)-2.5 E +(ail.)-.1 E .929(In the case of catastrophic or system f)108 364.8 R +.929(ailure, database reco)-.1 F -.15(ve)-.15 G .93 +(ry must be performed \(see).15 F F1(db_r)3.43 E(eco)-.37 E(ver)-.1 E F0 +.93(\(1\) or).73 F .74(the DB_RECO)108 376.8 R .74(VER and DB_RECO)-.5 F +(VER_F)-.5 E -1.21 -1.11(AT A)-.74 H 3.24<4c8d>1.11 G .74(ags to)-3.24 F +F1(db_appinit)3.24 E F0 3.24(\(3\)\). Alternati).68 F -.15(ve)-.25 G(ly) +.15 E 3.24(,i)-.65 G 3.24(fr)-3.24 G(eco)-3.24 E -.15(ve)-.15 G .74 +(ry is not).15 F .074 +(required because no database state is maintained across f)108 388.8 R +.075(ailures, it is possible to clean up a memory pool by)-.1 F(remo)108 +400.8 Q 1.176 +(ving all of the \214les in the directory speci\214ed to the)-.15 F F1 +(memp_open)3.675 E F0 1.175(function, as memory pool \214les are)3.675 F +(ne)108 412.8 Q -.15(ve)-.25 G 2.882(rc).15 G .383(reated in an)-2.882 F +2.883(yd)-.15 G .383(irectory other than the one speci\214ed to)-2.883 F +F1(memp_open)2.883 E F0 5.383(.N).24 G .383(ote, ho)-5.383 F(we)-.25 E +-.15(ve)-.25 G 1.183 -.4(r, t).15 H .383(hat this has the).4 F +(potential to remo)108 424.8 Q .3 -.15(ve \214)-.15 H +(les created by the other DB subsystems in this database en).15 E +(vironment.)-.4 E(The)108 441.6 Q F1(memp_unlink)2.5 E F0 +(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E F1(memp_r)92 458.4 Q -.4(eg)-.37 G +(ister).4 E F0(The)108 470.4 Q F1(memp_r)2.978 E -.4(eg)-.37 G(ister).4 +E F0 .478(function re)2.978 F .477 +(gisters page-in and page-out functions for \214les of type)-.15 F F1 +(ftype)2.977 E F0 .477(in the speci\214ed)2.977 F(pool.)108 482.4 Q .434 +(If the)108 499.2 R F1(pgin)2.934 E F0 .435(function is non-NULL, it is called each time a page is read into the memory pool from a \214le of) +2.934 F(type)108 511.2 Q F1(ftype)4.874 E F0 4.874(,o).18 G 4.874(rap) +-4.874 G 2.374(age is created for a \214le of type)-4.874 F F1(ftype) +4.874 E F0 2.374(\(see the DB_MPOOL_CREA)4.874 F 2.373 +(TE \215ag for the)-1.11 F F1(memp_fg)108 523.2 Q(et)-.1 E F0 2.677 +(function\). If)2.677 F(the)2.677 E F1(pgout)2.677 E F0 .178(function is non-NULL, it is called each time a page is written to a \214le of) +2.677 F(type)108 535.2 Q F1(ftype)2.5 E F0(.).18 E .082(Both the)108 552 +R F1(pgin)2.582 E F0(and)2.582 E F1(pgout)2.582 E F0 .082 +(functions are called with the page number)2.582 F 2.582(,ap)-.4 G .082 +(ointer to the page being read or writ-)-2.582 F .683(ten, and an)108 +564 R 3.183(ya)-.15 G -.18(rg)-3.183 G(ument).18 E F1(pgcookie)3.183 E +F0 .684(that w)3.184 F .684(as speci\214ed to the)-.1 F F1(memp_fopen) +3.184 E F0 .684(function when the \214le w)3.184 F .684(as opened.)-.1 F +(The)108 576 Q F1(pgin)2.562 E F0(and)2.562 E F1(pgout)2.562 E F0 .061 +(functions should return 0 on success, and an applicable non-zero)2.561 +F F1(errno)2.561 E F0 -.25(va)2.561 G .061(lue on f).25 F(ailure,)-.1 E +(in which case the)108 588 Q F1(db_mpool)2.5 E F0 +(function calling it will also f)2.5 E(ail, returning that)-.1 E F1 +(errno)2.5 E F0 -.25(va)2.5 G(lue.).25 E .195(The purpose of the)108 +604.8 R F1(memp_r)2.695 E -.4(eg)-.37 G(ister).4 E F0 .195(function is to support processing when pages are entered into, or \215ushed) +2.695 F .217(from, the pool.)108 616.8 R 2.717<418c>5.217 G .216 +(le type must be speci\214ed to mak)-2.717 F 2.716(ei)-.1 G 2.716(tp) +-2.716 G .216(ossible for unrelated threads or processes, that are) +-2.716 F .656(sharing a pool, to e)108 628.8 R .656(vict each other') +-.25 F 3.156(sp)-.55 G .656(ages from the pool.)-3.156 F .656 +(Applications should call)5.656 F F1(memp_r)3.156 E -.4(eg)-.37 G(ister) +.4 E F0 3.156(,d).73 G(uring)-3.156 E .735(initialization, for each type of \214le requiring input or output processing that will be sharing the underlying) +108 640.8 R 2.886(pool. \(No)108 652.8 R(re)2.886 E .386(gistry is necessary for the standard access method types, btree, hash and recno, as) +-.15 F F1(db_open)2.887 E F0(\(3\)).24 E(re)108 664.8 Q +(gisters them separately)-.15 E(.\))-.65 E .034 +(If a thread or process does not call)108 681.6 R F1(memp_r)2.534 E -.4 +(eg)-.37 G(ister).4 E F0 .034 +(for a \214le type, it is impossible for it to e)2.534 F .033 +(vict pages for an)-.25 F(y)-.15 E .914 +(\214le requiring input or output processing from the pool.)108 693.6 R +-.15(Fo)5.914 G 3.414(rt).15 G .914(his reason,)-3.414 F F1(memp_r)3.414 +E -.4(eg)-.37 G(ister).4 E F0 .914(should al)3.414 F -.1(wa)-.1 G .914 +(ys be).1 F .209(called by each application sharing a pool for each type of \214le included in the pool, re) +108 705.6 R -.05(ga)-.15 G .208(rdless of whether or).05 F +(not the application itself uses \214les of that type.)108 717.6 Q +(May 10, 1998)278.085 768 Q(6)201.085 E EP +%%Page: 7 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 334.4(DB_MPOOL\(3\) DB_MPOOL\(3\))72 48 R .375 +(There are no standard v)108 84 R .376(alues for)-.25 F/F1 10 +/Times-Italic@0 SF(ftype)2.876 E F0(,).18 E F1(pgin)2.876 E F0(,).24 E +F1(pgout)2.876 E F0(and)2.876 E F1(pgcookie)2.876 E F0 2.876(,e).18 G +.376(xcept that the)-3.026 F F1(ftype)2.876 E F0 -.25(va)2.876 G .376 +(lue for a \214le must).25 F .047(be a non-zero positi)108 96 R .346 +-.15(ve n)-.25 H(umber).15 E 2.546(,a)-.4 G 2.546(sn)-2.546 G -2.25 -.15 +(eg a)-2.546 H(ti).15 E .346 -.15(ve n)-.25 H .046(umbers are reserv).15 +F .046(ed for internal use by the DB library)-.15 F 5.046(.F)-.65 G .046 +(or this)-5.196 F +(reason, applications sharing a pool must coordinate their v)108 108 Q +(alues amongst themselv)-.25 E(es.)-.15 E(The)108 124.8 Q F1(memp_r)2.5 +E -.4(eg)-.37 G(ister).4 E F0(function returns the v)2.5 E(alue of)-.25 +E F1(errno)2.5 E F0(on f)2.5 E(ailure and 0 on success.)-.1 E F1 +(memp_tric)92 141.6 Q(kle)-.2 E F0(The)108 153.6 Q F1(memp_tric)3.762 E +(kle)-.2 E F0 1.262(function ensures that at least)3.762 F F1(pct)3.762 +E F0 1.263(percent of the pages in the shared memory pool are)3.762 F +.844(clean by writing dirty pages to their backing \214les.)108 165.6 R +.844(If the)5.844 F F1(nwr)3.344 E(otep)-.45 E F0(ar)3.344 E .844 +(gument is non-NULL, the number of)-.18 F(pages that were written to reach the correct percentage is returned in the memory location it references.) +108 177.6 Q 1.237(The purpose of the)108 194.4 R F1(memp_tric)3.737 E +(kle)-.2 E F0 1.238 +(function is to enable a memory pool manager to ensure that a page is) +3.738 F(al)108 206.4 Q -.1(wa)-.1 G(ys a).1 E -.25(va)-.2 G +(ilable for reading in ne).25 E 2.5(wi)-.25 G(nformation without ha)-2.5 +E(ving to w)-.2 E(ait for a write.)-.1 E(The)108 223.2 Q F1(memp_tric) +2.5 E(kle)-.2 E F0(function returns the v)2.5 E(alue of)-.25 E F1(errno) +2.5 E F0(on f)2.5 E(ailure and 0 on success.)-.1 E F1(memp_sync)92 240 Q +F0(The)108 252 Q F1(memp_sync)2.629 E F0 .129(function ensures that all the modi\214ed pages in the pool with log sequence numbers \(LSNs\)) +2.629 F(less than the)108 264 Q F1(lsn)2.5 E F0(ar)2.5 E +(gument are written to disk.)-.18 E(The)108 280.8 Q F1(memp_sync)3.717 E +F0 1.217(function returns the v)3.717 F 1.217(alue of)-.25 F F1(errno) +3.717 E F0 1.217(on f)3.717 F 1.218 +(ailure, 0 on success, and DB_INCOMPLETE if)-.1 F .065 +(there were pages which need to be written b)108 292.8 R .065(ut which) +-.2 F F1(memp_sync)2.565 E F0 -.1(wa)2.565 G 2.565(su).1 G .064 +(nable to write immediately)-2.565 F 5.064(.I)-.65 G 2.564(na)-5.064 G +(ddi-)-2.564 E .195(tion, if)108 304.8 R F1(memp_sync)2.695 E F0 .195 +(returns success, the v)2.695 F .195(alue of)-.25 F F1(lsn)2.695 E F0 +.195(will be o)2.695 F -.15(ve)-.15 G .195(rwritten with the lar).15 F +.195(gest LSN from an)-.18 F 2.695(yp)-.15 G(age)-2.695 E(which w)108 +316.8 Q(as written by)-.1 E F1(memp_sync)2.5 E F0 +(to satisfy this request.)2.5 E .905(The purpose of the)108 333.6 R F1 +(memp_sync)3.405 E F0 .904(function is to enable a transaction manager to ensure, as part of a check-) +3.405 F .601(point, that all pages modi\214ed by a certain time ha)108 +345.6 R .902 -.15(ve b)-.2 H .602(een written to disk.).15 F -.15(Pa) +5.602 G .602(ges in the pool which cannot).15 F .459(be written back to disk immediately \(e.g., are currently pinned\) are written to disk as soon as it is possible) +108 357.6 R .521(to do so.)108 369.6 R .521(The e)5.521 F .521 +(xpected beha)-.15 F .521 +(vior of the transaction manager is to call the)-.2 F F1(memp_sync)3.021 +E F0 .522(function and then, if)3.021 F .626 +(the return indicates that some pages could not be written immediately) +108 381.6 R 3.125(,t)-.65 G 3.125(ow)-3.125 G .625 +(ait brie\215y and retry ag)-3.225 F .625(ain with)-.05 F +(the same LSN until the)108 393.6 Q F1(memp_sync)2.5 E F0 +(function returns that all pages ha)2.5 E .3 -.15(ve b)-.2 H +(een written.).15 E 2.823 -.8(To s)108 410.4 T 1.223(upport the).8 F F1 +(memp_sync)3.723 E F0(functionality)3.723 E 3.724(,i)-.65 G 3.724(ti) +-3.724 G 3.724(sn)-3.724 G 1.224(ecessary that the pool functions kno) +-3.724 F 3.724(wt)-.25 G 1.224(he location of the)-3.724 F 1.146 +(LSN on the page for each \214le type.)108 422.4 R 1.146(This location should be speci\214ed when the \214le is opened using the) +6.146 F F1(memp_fopen)108 434.4 Q F0 2.5(function. \(Note,)2.5 F +(it is not required that the LSN be aligned on the page in an)2.5 E 2.5 +(yw)-.15 G(ay)-2.6 E(.\))-.65 E F1(memp_stat)92 451.2 Q F0(The)108 463.2 +Q F1(memp_stat)3.165 E F0 .665(function creates statistical structures and copies pointers to them into user) +3.165 F .666(-speci\214ed mem-)-.2 F 1.092(ory locations.)108 475.2 R +1.091(The statistics include the number of \214les participating in the pool, the acti) +6.092 F 1.391 -.15(ve p)-.25 H 1.091(ages in the).15 F +(pool, and information as to ho)108 487.2 Q 2.5(we)-.25 G -.25(ff)-2.5 G +(ecti).25 E .3 -.15(ve t)-.25 H(he cache has been.).15 E .048 +(Statistical structures are created in allocated memory)108 504 R 5.049 +(.I)-.65 G(f)-5.049 E F1(db_malloc)2.549 E F0 .049 +(is non-NULL, it is called to allocate the)2.549 F(memory)108 516 Q 2.83 +(,o)-.65 G .33(therwise, the library function)-2.83 F F1(malloc)2.829 E +F0 .329(\(3\) is used.).31 F .329(The function)5.329 F F1(db_malloc) +2.829 E F0 .329(must match the calling)2.829 F(con)108 528 Q -.15(ve)-.4 +G 2.03(ntions of the).15 F F1(malloc)4.53 E F0 2.031 +(\(3\) library routine.).31 F(Re)7.031 E -.05(ga)-.15 G 2.031 +(rdless, the caller is responsible for deallocating the).05 F .708 +(returned memory)108 540 R 5.708(.T)-.65 G 3.208(od)-6.508 G .708 +(eallocate the returned memory)-3.208 F 3.208(,f)-.65 G .707 +(ree each returned memory pointer; pointers inside)-3.208 F +(the memory do not need to be indi)108 552 Q(vidually freed.)-.25 E(If) +108 568.8 Q F1(gsp)3.369 E F0 .869 +(is non-NULL, the global statistics for the memory pool)3.369 F F1(mp) +3.37 E F0 .87(are copied into the memory location it)3.37 F 2.57 +(references. The)108 580.8 R .069 +(global statistics are stored in a structure of type DB_MPOOL_ST)2.57 F +2.289 -1.11(AT \()-.93 H -1.95(typedef ')1.11 F 2.569(di)-.5 G 2.569(n<) +-2.569 G(db)-2.569 E(.h>\).)-.4 E(The follo)108 597.6 Q +(wing DB_MPOOL_ST)-.25 E 2.22 -1.11(AT \214)-.93 H +(elds will be \214lled in:)1.11 E(u_int32_t st_refcnt;)108 614.4 Q +(The number of references to the re)133 626.4 Q(gion.)-.15 E +(u_int32_t st_re)108 638.4 Q(gsize;)-.15 E(The size of the re)133 650.4 +Q(gion.)-.15 E(size_t st_cachesize;)108 662.4 Q(Cache size in bytes.)133 +674.4 Q(u_int32_t st_cache_hit;)108 686.4 Q +(Requested pages found in the cache.)133 698.4 Q(May 10, 1998)278.085 +768 Q(7)201.085 E EP +%%Page: 8 8 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 334.4(DB_MPOOL\(3\) DB_MPOOL\(3\))72 48 R +(u_int32_t st_cache_miss;)108 84 Q +(Requested pages not found in the cache.)133 96 Q(u_int32_t st_map;)108 +108 Q 1.688 +(Requested pages mapped into the process' address space \(there is no a) +133 120 R -.25(va)-.2 G 1.689(ilable information as to).25 F .673 +(whether or not this request caused disk I/O, although e)133 132 R .672 +(xamining the application page f)-.15 F .672(ault rate may)-.1 F +(be helpful\).)133 144 Q(u_int32_t st_page_create;)108 156 Q -.15(Pa)133 +168 S(ges created in the cache.).15 E(u_int32_t st_page_in;)108 180 Q +-.15(Pa)133 192 S(ges read into the cache.).15 E(u_int32_t st_page_out;) +108 204 Q -.15(Pa)133 216 S +(ges written from the cache to the backing \214le.).15 E +(u_int32_t st_ro_e)108 228 Q(vict;)-.25 E +(Clean pages forced from the cache.)133 240 Q(u_int32_t st_rw_e)108 252 +Q(vict;)-.25 E(Dirty pages forced from the cache.)133 264 Q +(u_int32_t st_hash_b)108 276 Q(uck)-.2 E(ets;)-.1 E(Number of hash b)133 +288 Q(uck)-.2 E(ets in b)-.1 E(uf)-.2 E(fer hash table.)-.25 E +(u_int32_t st_hash_searches;)108 300 Q -.8(To)133 312 S(tal number of b) +.8 E(uf)-.2 E(fer hash table lookups.)-.25 E(u_int32_t st_hash_longest;) +108 324 Q(The longest chain e)133 336 Q -.15(ve)-.25 G 2.5(re).15 G +(ncountered in b)-2.5 E(uf)-.2 E(fer hash table lookups.)-.25 E +(u_int32_t st_hash_e)108 348 Q(xamined;)-.15 E -.8(To)133 360 S +(tal number of hash elements tra).8 E -.15(ve)-.2 G +(rsed during hash table lookups.).15 E(u_int32_t st_page_clean;)108 372 +Q(Clean pages currently in the cache.)133 384 Q +(u_int32_t st_page_dirty;)108 396 Q(Dirty pages currently in the cache.) +133 408 Q(u_int32_t st_page_trickle;)108 420 Q +(Dirty pages written using the)133 432 Q/F1 10/Times-Italic@0 SF +(memp_tric)2.5 E(kle)-.2 E F0(interf)2.5 E(ace.)-.1 E(u_int32_t st_re) +108 444 Q(gion_w)-.15 E(ait;)-.1 E +(The number of times that a thread of control w)133 456 Q +(as forced to w)-.1 E(ait before obtaining the re)-.1 E(gion lock.)-.15 +E(u_int32_t st_re)108 468 Q(gion_no)-.15 E -.1(wa)-.25 G(it;).1 E +(The number of times that a thread of control w)133 480 Q +(as able to obtain the re)-.1 E(gion lock without w)-.15 E(aiting.)-.1 E +(If)108 496.8 Q F1(fsp)2.503 E F0 .003 +(is non-NULL, a pointer to a NULL-terminated v)2.503 F .004 +(ariable length array of statistics for indi)-.25 F .004 +(vidual \214les, in)-.25 F .264(the memory pool)108 508.8 R F1(mp)2.764 +E F0 2.764(,i).19 G 2.764(sc)-2.764 G .264 +(opied into the memory location it references.)-2.764 F .263(If no indi) +5.263 F .263(vidual \214les currently e)-.25 F(xist)-.15 E +(in the memory pool,)108 520.8 Q F1(fsp)2.5 E F0(will be set to NULL.) +2.5 E .419(The per)108 537.6 R .419 +(-\214le statistics are stored in structures of type DB_MPOOL_FST)-.2 F +2.639 -1.11(AT \()-.93 H -1.95(typedef ')1.11 F 2.92(di)-.5 G 2.92(n<) +-2.92 G(db)-2.92 E 2.92(.h>\). The)-.4 F(fol-)2.92 E(lo)108 549.6 Q +(wing DB_MPOOL_FST)-.25 E 2.22 -1.11(AT \214)-.93 H(elds will be \214lled in for each \214le in the pool, i.e., each element of the array:) +1.11 E(char *\214le_name;)108 566.4 Q(The name of the \214le.)133 578.4 +Q(size_t st_pagesize;)108 590.4 Q -.15(Pa)133 602.4 S(ge size in bytes.) +.15 E(u_int32_t st_cache_hit;)108 614.4 Q +(Requested pages found in the cache.)133 626.4 Q +(u_int32_t st_cache_miss;)108 638.4 Q +(Requested pages not found in the cache.)133 650.4 Q(u_int32_t st_map;) +108 662.4 Q(Requested pages mapped into the process' address space.)133 +674.4 Q(u_int32_t st_page_create;)108 686.4 Q -.15(Pa)133 698.4 S +(ges created in the cache.).15 E(May 10, 1998)278.085 768 Q(8)201.085 E +EP +%%Page: 9 9 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 334.4(DB_MPOOL\(3\) DB_MPOOL\(3\))72 48 R +(u_int32_t st_page_in;)108 84 Q -.15(Pa)133 96 S +(ges read into the cache.).15 E(u_int32_t st_page_out;)108 108 Q -.15 +(Pa)133 120 S(ges written from the cache to the backing \214le.).15 E +(The)108 136.8 Q/F1 10/Times-Italic@0 SF(memp_stat)2.5 E F0 +(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E/F2 9/Times-Bold@0 SF(ENVIR)72 153.6 Q +(ONMENT V)-.27 E(ARIABLES)-1.215 E F0(The follo)108 165.6 Q(wing en)-.25 +E(vironment v)-.4 E(ariables af)-.25 E(fect the e)-.25 E -.15(xe)-.15 G +(cution of).15 E F1(db_mpool)2.5 E F0(:).51 E(DB_HOME)108 182.4 Q 1.915 +(If the)133 194.4 R F1(dben)4.415 E(v)-.4 E F0(ar)4.415 E 1.915 +(gument to)-.18 F F1(memp_open)4.415 E F0 -.1(wa)4.415 G 4.415(si).1 G +1.915(nitialized using)-4.415 F F1(db_appinit)4.415 E F0 4.415(,t).68 G +1.915(he en)-4.415 F 1.915(vironment v)-.4 F(ariable)-.25 E .508(DB_HOME may be used as the path of the database home for the interpretation of the) +133 206.4 R F1(dir)3.009 E F0(ar)3.009 E(gument)-.18 E(to)133 218.4 Q F1 +(memp_open)2.5 E F0 2.5(,a).24 G 2.5(sd)-2.5 G(escribed in)-2.5 E F1 +(db_appinit)2.5 E F0(\(3\).).68 E(TMPDIR)108 235.2 Q .155(If the)133 +247.2 R F1(dben)2.655 E(v)-.4 E F0(ar)2.655 E .155(gument to)-.18 F F1 +(memp_open)2.655 E F0 -.1(wa)2.655 G 2.655(sN).1 G .155 +(ULL or not initialized using)-2.655 F F1(db_appinit)2.655 E F0 2.655 +(,t).68 G .155(he en)-2.655 F(vironment)-.4 E -.25(va)133 259.2 S .529(riable TMPDIR may be used as the directory in which to create the memory pool, as described in) +.25 F(the)133 271.2 Q F1(memp_open)2.5 E F0(section abo)2.5 E -.15(ve) +-.15 G(.).15 E F2(ERR)72 288 Q(ORS)-.27 E F0(The)108 300 Q F1(memp_open) +2.644 E F0 .144(function may f)2.644 F .144(ail and return)-.1 F F1 +(errno)2.644 E F0 .144(for an)2.644 F 2.644(yo)-.15 G 2.644(ft)-2.644 G +.144(he errors speci\214ed for the follo)-2.644 F .143(wing DB and)-.25 +F(library functions: DBmemp->pgin\(3\), DBmemp->pgout\(3\), close\(2\), db_v) +108 312 Q(ersion\(3\), fcntl\(2\), f)-.15 E(\215ush\(3\),)-.25 E(fsync\(2\), log_compare\(3\), log_\215ush\(3\), lseek\(2\), malloc\(3\), memcmp\(3\), memcp) +108 324 Q(y\(3\), memp_close\(3\),)-.1 E(memp_unlink\(3\), memset\(3\), mmap\(2\), munmap\(2\), open\(2\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), str) +108 336 Q(-)-.2 E(cp)108 348 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), time\(3\), unlink\(2\), and write\(2\).) +-.1 E(In addition, the)108 364.8 Q F1(memp_open)2.5 E F0(function may f) +2.5 E(ail and return)-.1 E F1(errno)2.5 E F0(for the follo)2.5 E +(wing conditions:)-.25 E([EA)108 381.6 Q(GAIN])-.4 E +(The shared memory re)133 393.6 Q(gion w)-.15 E(as lock)-.1 E +(ed and \(repeatedly\) una)-.1 E -.25(va)-.2 G(ilable.).25 E([EINV)108 +410.4 Q(AL])-1.35 E(An in)133 422.4 Q -.25(va)-.4 G(lid \215ag v).25 E +(alue or parameter w)-.25 E(as speci\214ed.)-.1 E +(The DB_THREAD \215ag w)133 446.4 Q(as speci\214ed and spinlocks are not implemented for this architecture.) +-.1 E 2.5(AN)133 470.4 S(ULL pathname w)-2.5 E +(as speci\214ed without the DB_MPOOL_PRIV)-.1 E -1.11(AT)-1.35 G 2.5 +<458d>1.11 G(ag.)-2.5 E(The speci\214ed cache size w)133 494.4 Q +(as impossibly small.)-.1 E(The)108 511.2 Q F1(memp_close)2.583 E F0 +.083(function may f)2.583 F .082(ail and return)-.1 F F1(errno)2.582 E +F0 .082(for an)2.582 F 2.582(yo)-.15 G 2.582(ft)-2.582 G .082 +(he errors speci\214ed for the follo)-2.582 F .082(wing DB and)-.25 F +(library functions: close\(2\), fcntl\(2\), f)108 523.2 Q +(\215ush\(3\), memp_fclose\(3\), munmap\(2\), and strerror\(3\).)-.25 E +(The)108 540 Q F1(memp_fopen)3.485 E F0 .985(function may f)3.485 F .985 +(ail and return)-.1 F F1(errno)3.485 E F0 .985(for an)3.485 F 3.485(yo) +-.15 G 3.485(ft)-3.485 G .986(he errors speci\214ed for the follo)-3.485 +F .986(wing DB)-.25 F(and library functions: DBmemp->pgin\(3\), DBmemp->pgout\(3\), close\(2\), fcntl\(2\), f) +108 552 Q(\215ush\(3\), fsync\(2\),)-.25 E(log_compare\(3\), log_\215ush\(3\), lseek\(2\), malloc\(3\), memcmp\(3\), memcp) +108 564 Q(y\(3\), memset\(3\), mmap\(2\), open\(2\),)-.1 E +(sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp)108 576 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), time\(3\), unlink\(2\), and) +-.1 E(write\(2\).)108 588 Q(In addition, the)108 604.8 Q F1(memp_fopen) +2.5 E F0(function may f)2.5 E(ail and return)-.1 E F1(errno)2.5 E F0 +(for the follo)2.5 E(wing conditions:)-.25 E([EINV)108 621.6 Q(AL])-1.35 +E(An in)133 633.6 Q -.25(va)-.4 G(lid \215ag v).25 E +(alue or parameter w)-.25 E(as speci\214ed.)-.1 E .001 +(The \214le has already been entered into the pool, and the)133 657.6 R +F1(pa)2.501 E -.1(ge)-.1 G(size).1 E F0 -.25(va)2.501 G .001 +(lue is not the same as when the \214le).25 F -.1(wa)133 669.6 S 2.5(se) +.1 G(ntered into the pool, or the length of the \214le is not zero or a multiple of the) +-2.5 E F1(pa)2.5 E -.1(ge)-.1 G(size).1 E F0(.).18 E(The DB_RDONL)133 +693.6 Q 2.5<598d>-1 G(ag w)-2.5 E(as speci\214ed for an in-memory pool.) +-.1 E(The)108 710.4 Q F1(memp_fclose)3.42 E F0 .92(function may f)3.42 F +.92(ail and return)-.1 F F1(errno)3.42 E F0 .92(for an)3.42 F 3.42(yo) +-.15 G 3.42(ft)-3.42 G .92(he errors speci\214ed for the follo)-3.42 F +.92(wing DB)-.25 F(and library functions: close\(2\), fcntl\(2\), f)108 +722.4 Q(\215ush\(3\), munmap\(2\), and strerror\(3\).)-.25 E +(May 10, 1998)278.085 768 Q(9)201.085 E EP +%%Page: 10 10 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 334.4(DB_MPOOL\(3\) DB_MPOOL\(3\))72 48 R(The) +108 84 Q/F1 10/Times-Italic@0 SF(memp_fg)2.896 E(et)-.1 E F0 .396 +(function may f)2.896 F .396(ail and return)-.1 F F1(errno)2.896 E F0 +.396(for an)2.896 F 2.896(yo)-.15 G 2.896(ft)-2.896 G .396 +(he errors speci\214ed for the follo)-2.896 F .397(wing DB and)-.25 F(library functions: DBmemp->pgin\(3\), DBmemp->pgout\(3\), close\(2\), fcntl\(2\), f) +108 96 Q(\215ush\(3\), fsync\(2\), log_com-)-.25 E(pare\(3\), log_\215ush\(3\), lseek\(2\), malloc\(3\), memcmp\(3\), memcp) +108 108 Q(y\(3\), memset\(3\), mmap\(2\), open\(2\), read\(2\),)-.1 E +(sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp)108 120 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), time\(3\), unlink\(2\), and) +-.1 E(write\(2\).)108 132 Q(In addition, the)108 148.8 Q F1(memp_fg)2.5 +E(et)-.1 E F0(function may f)2.5 E(ail and return)-.1 E F1(errno)2.5 E +F0(for the follo)2.5 E(wing conditions:)-.25 E([EA)108 165.6 Q(GAIN])-.4 +E 1.568(The page reference count has o)133 177.6 R -.15(ve)-.15 G +(r\215o).15 E 4.068(wed. \(This)-.25 F 1.568(should ne)4.068 F -.15(ve) +-.25 G 4.068(rh).15 G 1.568(appen unless there')-4.068 F 4.068(sab)-.55 +G 1.568(ug in the)-4.268 F(application.\))133 189.6 Q([EINV)108 206.4 Q +(AL])-1.35 E(An in)133 218.4 Q -.25(va)-.4 G(lid \215ag v).25 E +(alue or parameter w)-.25 E(as speci\214ed.)-.1 E +(The DB_MPOOL_NEW \215ag w)133 242.4 Q(as set and the source \214le w) +-.1 E(as not opened for writing.)-.1 E(The requested page does not e)133 +266.4 Q(xist and DB_MPOOL_CREA)-.15 E(TE w)-1.11 E(as not set.)-.1 E +(More than one of DB_MPOOL_CREA)133 290.4 Q +(TE, DB_MPOOL_LAST and DB_MPOOL_NEW w)-1.11 E(as set.)-.1 E([ENOMEM])108 +307.2 Q(The cache is full and no more pages will \214t in the pool.)133 +319.2 Q(The)108 336 Q F1(memp_fput)2.86 E F0 .36(function may f)2.86 F +.36(ail and return)-.1 F F1(errno)2.86 E F0 .359(for an)2.86 F 2.859(yo) +-.15 G 2.859(ft)-2.859 G .359(he errors speci\214ed for the follo)-2.859 +F .359(wing DB and)-.25 F(library functions: DBmemp->pgin\(3\), DBmemp->pgout\(3\), close\(2\), fcntl\(2\), f) +108 348 Q(\215ush\(3\), fsync\(2\), log_com-)-.25 E(pare\(3\), log_\215ush\(3\), lseek\(2\), malloc\(3\), memcmp\(3\), memcp) +108 360 Q(y\(3\), memset\(3\), mmap\(2\), open\(2\), sig-)-.1 E +(\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp)108 372 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), time\(3\), unlink\(2\), and) +-.1 E(write\(2\).)108 384 Q(In addition, the)108 400.8 Q F1(memp_fput) +2.5 E F0(function may f)2.5 E(ail and return)-.1 E F1(errno)2.5 E F0 +(for the follo)2.5 E(wing conditions:)-.25 E([EA)108 417.6 Q(CCES])-.4 E +(The DB_MPOOL_DIR)133 429.6 Q(TY \215ag w)-.6 E +(as set and the source \214le w)-.1 E(as not opened for writing.)-.1 E +([EINV)108 446.4 Q(AL])-1.35 E(An in)133 458.4 Q -.25(va)-.4 G +(lid \215ag v).25 E(alue or parameter w)-.25 E(as speci\214ed.)-.1 E +(The)133 482.4 Q F1(pgaddr)2.5 E F0 +(parameter does not reference a page returned by)2.5 E F1(memp_fg)2.5 E +(et)-.1 E F0(.).68 E(More than one of DB_MPOOL_CLEAN and DB_MPOOL_DIR) +133 506.4 Q(TY w)-.6 E(as set.)-.1 E(The)108 523.2 Q F1(memp_fset)2.953 +E F0 .453(function may f)2.953 F .452(ail and return)-.1 F F1(errno) +2.952 E F0 .452(for an)2.952 F 2.952(yo)-.15 G 2.952(ft)-2.952 G .452 +(he errors speci\214ed for the follo)-2.952 F .452(wing DB and)-.25 F +(library functions: fcntl\(2\), and f)108 535.2 Q(\215ush\(3\).)-.25 E +(In addition, the)108 552 Q F1(memp_fset)2.5 E F0(function may f)2.5 E +(ail and return)-.1 E F1(errno)2.5 E F0(for the follo)2.5 E +(wing conditions:)-.25 E([EINV)108 568.8 Q(AL])-1.35 E(An in)133 580.8 Q +-.25(va)-.4 G(lid \215ag v).25 E(alue or parameter w)-.25 E +(as speci\214ed.)-.1 E(The)108 597.6 Q F1(memp_fsync)2.582 E F0 .082 +(function may f)2.582 F .082(ail and return)-.1 F F1(errno)2.582 E F0 +.082(for an)2.582 F 2.582(yo)-.15 G 2.582(ft)-2.582 G .082 +(he errors speci\214ed for the follo)-2.582 F .083(wing DB and)-.25 F(library functions: DBmemp->pgin\(3\), DBmemp->pgout\(3\), close\(2\), fcntl\(2\), f) +108 609.6 Q(\215ush\(3\), fsync\(2\), log_com-)-.25 E +(pare\(3\), log_\215ush\(3\), lseek\(2\), malloc\(3\), memcp)108 621.6 Q +(y\(3\), memset\(3\), open\(2\), qsort\(3\), realloc\(3\), sig-)-.1 E +(\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp)108 633.6 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), unlink\(2\), and write\(2\).) +-.1 E(The)108 650.4 Q F1(memp_unlink)3.322 E F0 .822(function may f) +3.322 F .822(ail and return)-.1 F F1(errno)3.322 E F0 .822(for an)3.322 +F 3.322(yo)-.15 G 3.322(ft)-3.322 G .821 +(he errors speci\214ed for the follo)-3.322 F .821(wing DB)-.25 F +(and library functions: close\(2\), fcntl\(2\), f)108 662.4 Q +(\215ush\(3\), malloc\(3\), memcp)-.25 E +(y\(3\), memset\(3\), mmap\(2\), mun-)-.1 E(map\(2\), open\(2\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp) +108 674.4 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), and)-.1 E +(unlink\(2\).)108 686.4 Q(In addition, the)108 703.2 Q F1(memp_unlink) +2.5 E F0(function may f)2.5 E(ail and return)-.1 E F1(errno)2.5 E F0 +(for the follo)2.5 E(wing conditions:)-.25 E(May 10, 1998)278.085 768 Q +(10)196.085 E EP +%%Page: 11 11 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 334.4(DB_MPOOL\(3\) DB_MPOOL\(3\))72 48 R([EB) +108 84 Q(USY])-.1 E(The shared memory re)133 96 Q(gion w)-.15 E +(as in use and the force \215ag w)-.1 E(as not set.)-.1 E(The)108 112.8 +Q/F1 10/Times-Italic@0 SF(memp_r)3.007 E -.4(eg)-.37 G(ister).4 E F0 +.507(function may f)3.007 F .507(ail and return)-.1 F F1(errno)3.008 E +F0 .508(for an)3.008 F 3.008(yo)-.15 G 3.008(ft)-3.008 G .508 +(he errors speci\214ed for the follo)-3.008 F .508(wing DB)-.25 F +(and library functions: fcntl\(2\), and malloc\(3\).)108 124.8 Q(The)108 +141.6 Q F1(memp_tric)3.302 E(kle)-.2 E F0 .802(function may f)3.302 F +.801(ail and return)-.1 F F1(errno)3.301 E F0 .801(for an)3.301 F 3.301 +(yo)-.15 G 3.301(ft)-3.301 G .801(he errors speci\214ed for the follo) +-3.301 F .801(wing DB)-.25 F(and library functions: DBmemp->pgin\(3\), DBmemp->pgout\(3\), close\(2\), fcntl\(2\), f) +108 153.6 Q(\215ush\(3\), fsync\(2\),)-.25 E(log_compare\(3\), log_\215ush\(3\), lseek\(2\), malloc\(3\), memcmp\(3\), memcp) +108 165.6 Q(y\(3\), memset\(3\), mmap\(2\), open\(2\),)-.1 E +(sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp)108 177.6 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), time\(3\), unlink\(2\), and) +-.1 E(write\(2\).)108 189.6 Q(In addition, the)108 206.4 Q F1(memp_tric) +2.5 E(kle)-.2 E F0(function may f)2.5 E(ail and return)-.1 E F1(errno) +2.5 E F0(for the follo)2.5 E(wing conditions:)-.25 E([EINV)108 223.2 Q +(AL])-1.35 E(An in)133 235.2 Q -.25(va)-.4 G(lid \215ag v).25 E +(alue or parameter w)-.25 E(as speci\214ed.)-.1 E(The)108 252 Q F1 +(memp_sync)2.737 E F0 .237(function may f)2.737 F .237(ail and return) +-.1 F F1(errno)2.737 E F0 .237(for an)2.737 F 2.737(yo)-.15 G 2.737(ft) +-2.737 G .236(he errors speci\214ed for the follo)-2.737 F .236 +(wing DB and)-.25 F(library functions: DBmemp->pgin\(3\), DBmemp->pgout\(3\), close\(2\), fcntl\(2\), f) +108 264 Q(\215ush\(3\), fsync\(2\), log_com-)-.25 E(pare\(3\), log_\215ush\(3\), lseek\(2\), malloc\(3\), memcmp\(3\), memcp) +108 276 Q(y\(3\), memset\(3\), mmap\(2\), open\(2\),)-.1 E(qsort\(3\), realloc\(3\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp) +108 288 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), time\(3\),) +-.1 E(unlink\(2\), and write\(2\).)108 300 Q(In addition, the)108 316.8 +Q F1(memp_sync)2.5 E F0(function may f)2.5 E(ail and return)-.1 E F1 +(errno)2.5 E F0(for the follo)2.5 E(wing conditions:)-.25 E([EINV)108 +333.6 Q(AL])-1.35 E(An in)133 345.6 Q -.25(va)-.4 G(lid \215ag v).25 E +(alue or parameter w)-.25 E(as speci\214ed.)-.1 E(The)133 369.6 Q F1 +(memp_sync)2.5 E F0(function w)2.5 E(as called without logging ha)-.1 E +(ving been initialized in the en)-.2 E(vironment.)-.4 E(The)108 386.4 Q +F1(memp_stat)2.922 E F0 .421(function may f)2.922 F .421(ail and return) +-.1 F F1(errno)2.921 E F0 .421(for an)2.921 F 2.921(yo)-.15 G 2.921(ft) +-2.921 G .421(he errors speci\214ed for the follo)-2.921 F .421 +(wing DB and)-.25 F(library functions: fcntl\(2\), malloc\(3\), memcp) +108 398.4 Q(y\(3\), and strlen\(3\).)-.1 E/F2 9/Times-Bold@0 SF +(SEE ALSO)72 415.2 Q F1(db_ar)108 427.2 Q -.15(ch)-.37 G(ive).15 E F0 +(\(1\),).18 E F1(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F0(\(1\),).68 E F1 +(db_deadloc)2.5 E(k)-.2 E F0(\(1\),).67 E F1(db_dump)2.5 E F0(\(1\),).19 +E F1(db_load)2.5 E F0(\(1\),).77 E F1(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0 +(\(1\),).73 E F1(db_stat)2.5 E F0(\(1\),).68 E F1(db_intr)108 439.2 Q(o) +-.45 E F0(\(3\),).18 E F1(db_appinit)2.5 E F0(\(3\),).68 E F1(db_cur)2.5 +E(sor)-.1 E F0(\(3\),).73 E F1(db_dbm)2.5 E F0(\(3\),).32 E F1 +(db_internal)2.5 E F0(\(3\),).51 E F1(db_loc)2.5 E(k)-.2 E F0(\(3\),).67 +E F1(db_lo)2.5 E(g)-.1 E F0(\(3\),).22 E F1(db_mpool)2.5 E F0(\(3\),).51 +E F1(db_open)108 451.2 Q F0(\(3\),).24 E F1(db_thr)2.5 E(ead)-.37 E F0 +(\(3\),).77 E F1(db_txn)2.5 E F0(\(3\)).24 E(May 10, 1998)278.085 768 Q +(11)196.085 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/man.ps/db_open.ps b/mozilla/db/man/man.ps/db_open.ps new file mode 100644 index 00000000000..f9d6deb9e6e --- /dev/null +++ b/mozilla/db/man/man.ps/db_open.ps @@ -0,0 +1,1423 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:23 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 14 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_open \255 database access methods)108 40.8 Q F0(SYNOPSIS)72 57.6 Q +/F2 10/Times-Bold@0 SF(#include )-.4 E(int)108 93.6 Q +(db_open\(const char *\214le, DBTYPE type, u_int32_t \215ags,)108 105.6 +Q(int mode, DB_ENV *dben)158 117.6 Q 1.1 -.55(v, D)-.4 H(B_INFO *dbinf) +.55 E(o, DB **dbpp\);)-.25 E(int)108 141.6 Q +(DB->close\(DB *db, u_int32_t \215ags\);)108 153.6 Q(int)108 177.6 Q +(DB->cursor\(DB *db, DB_TXN *txnid, DBC **cursor)108 189.6 Q(p\);)-.1 E +(int)108 213.6 Q(DB->del\(DB *db, DB_TXN *txnid, DBT *k)108 225.6 Q(ey) +-.1 E 2.5(,u)-.55 G(_int32_t \215ags\);)-2.5 E(int)108 249.6 Q +(DB->fd\(DB *db, int *fdp\);)108 261.6 Q(int)108 285.6 Q +(DB->get\(DB *db, DB_TXN *txnid, DBT *k)108 297.6 Q(ey)-.1 E 2.5(,D)-.55 +G(BT *data, u_int32_t \215ags\);)-2.5 E(int)108 321.6 Q +(DB->put\(DB *db, DB_TXN *txnid, DBT *k)108 333.6 Q(ey)-.1 E 2.5(,D)-.55 +G(BT *data, u_int32_t \215ags\);)-2.5 E(int)108 357.6 Q +(DB->sync\(DB *db, u_int32_t \215ags\);)108 369.6 Q(int)108 393.6 Q +(DB->stat\(DB *db, v)108 405.6 Q(oid *sp, v)-.1 E +(oid *\(*db_malloc\)\(size_t\), u_int32_t \215ags\);)-.1 E F0 +(DESCRIPTION)72 422.4 Q F1 .486(The DB library is a f)108 434.4 R .485 +(amily of groups of functions that pro)-.1 F .485 +(vides a modular programming interf)-.15 F .485(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 446.4 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .507(\214le page caching, as well as v)108 458.4 R .507 +(arious inde)-.25 F -.15(xe)-.15 G 3.007(da).15 G .506(ccess methods.) +-3.007 F(Man)5.506 E 3.006(yo)-.15 G 3.006(ft)-3.006 G .506 +(he functional groups \(e.g., the \214le)-3.006 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 470.4 R .122(are e)108 482.4 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.121 G 2.621(rag).15 G .121(eneral description of)-2.621 +F(the DB package, see)108 494.4 Q/F3 10/Times-Italic@0 SF(db_intr)2.5 E +(o)-.45 E F1(\(3\).).18 E(This manual page describes the o)108 511.2 Q +-.15(ve)-.15 G(rall structure of the DB library access methods.).15 E +.484 +(The currently supported \214le formats are btree, hashed and recno.)108 +528 R .484(The btree format is a representation of a)5.484 F .875 +(sorted, balanced tree structure.)108 540 R .875 +(The hashed format is an e)5.875 F .875 +(xtensible, dynamic hashing scheme.)-.15 F .875(The recno)5.875 F +(format supports \214x)108 552 Q(ed or v)-.15 E +(ariable length records \(optionally retrie)-.25 E -.15(ve)-.25 G 2.5 +(df).15 G(rom a \215at te)-2.5 E(xt \214le\).)-.15 E .367 +(Storage and retrie)108 568.8 R -.25(va)-.25 G 2.867(lf).25 G .368 +(or the DB access methods are based on k)-2.867 F -.15(ey)-.1 G .368 +(/data pairs, or DBT structures as the).15 F 2.868(ya)-.15 G(re)-2.868 E +-1.95(typedef ')108 580.8 R 3.16(di)-.5 G 3.16(nt)-3.16 G .66(he include \214le.)-.4 F(See)5.66 E F3(db_dbt)3.16 E F1 .66 +(\(3\) for speci\214c information on the structure and capabili-).68 F +(ties of a DBT)108 592.8 Q(.)-.74 E(The)108 609.6 Q F3(db_open)4.091 E +F1 1.591(function opens the database represented by)4.091 F F3(\214le) +4.091 E F1 1.592(for both reading and writing.)4.091 F 1.592(Files ne) +6.592 F -.15(ve)-.25 G(r).15 E(intended to be shared or preserv)108 +621.6 Q +(ed on disk may be created by setting the \214le parameter to NULL.)-.15 +E(The)108 638.4 Q F3(db_open)3.057 E F1 .557 +(function copies a pointer to a DB structure \(as typedef)3.057 F 1.557 +-.5('d i).55 H 3.056(nt).5 G .556(he include \214le\), into the)-.4 F .05(memory location referenced by) +108 650.4 R F3(dbpp)2.55 E F1 5.05(.T).19 G .051 +(his structure includes a set of functions to perform v)-5.05 F .051 +(arious database)-.25 F(actions, as described belo)108 662.4 Q 3.8 -.65 +(w. T)-.25 H(he).65 E F3(db_open)2.5 E F1(function returns the v)2.5 E +(alue of)-.25 E F3(errno)2.5 E F1(on f)2.5 E(ailure and 0 on success.) +-.1 E .032(Note, while most of the access methods use)108 679.2 R F3 +(\214le)2.532 E F1 .031 +(as the name of an underlying \214le on disk, this is not guaran-)2.532 +F 4(teed. Also,)108 691.2 R(calling)4 E F3(db_open)4 E F1 1.5 +(is a reasonably e)4 F(xpensi)-.15 E 1.801 -.15(ve o)-.25 H 4.001 +(peration. \(This).15 F 1.501(is based on a model where the)4.001 F +(DBMS k)108 703.2 Q(eeps a set of \214les open for a long time rather than opening and closing them on each query) +-.1 E(.\))-.65 E(The)108 720 Q F3(type)3.554 E F1(ar)3.554 E 1.054 +(gument is of type DBTYPE \(as de\214ned in the include \214le\) and must be set to one of)-.4 F(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 352.18(DB_OPEN\(3\) DB_OPEN\(3\))72 48 R 1.748 +(DB_BTREE, DB_HASH, DB_RECNO or DB_UNKNO)108 84 R 4.248(WN. If)-.35 F/F1 +10/Times-Italic@0 SF(type)4.248 E F0 1.748(is DB_UNKNO)4.248 F 1.748 +(WN, the database)-.35 F 3.59(must already e)108 96 R 3.59(xist and)-.15 +F F1(db_open)6.09 E F0 3.589 +(will then determine if it is of type DB_BTREE, DB_HASH or)6.09 F +(DB_RECNO.)108 108 Q(The)108 124.8 Q F1<8d61>3.76 E(gs)-.1 E F0(and)3.76 +E F1(mode)3.76 E F0(ar)3.76 E 1.26(guments specify ho)-.18 F 3.761<778c> +-.25 G 1.261(les will be opened and/or created when the)-3.761 F 3.761 +(yd)-.15 G(on')-3.761 E 3.761(ta)-.18 G(lready)-3.761 E -.15(ex)108 +136.8 S 2.5(ist. The).15 F(\215ags v)2.5 E(alue is speci\214ed by)-.25 E +/F2 10/Times-Bold@0 SF(or)2.5 E F0 +('ing together one or more of the follo)A(wing v)-.25 E(alues:)-.25 E +(DB_CREA)108 153.6 Q(TE)-1.11 E .484(Create an)133 165.6 R 2.984(yu)-.15 +G .483(nderlying \214les, as necessary)-2.984 F 5.483(.I)-.65 G 2.983 +(ft)-5.483 G .483(he \214les do not already e)-2.983 F .483 +(xist and the DB_CREA)-.15 F .483(TE \215ag)-1.11 F +(is not speci\214ed, the call will f)133 177.6 Q(ail.)-.1 E(DB_NOMMAP) +108 194.4 Q(Do not map this \214le \(see)133 206.4 Q F1(db_mpool)2.5 E +F0(\(3\) for further information\).).51 E(DB_RDONL)108 223.2 Q(Y)-1 E +.248(Open the database for reading only)133 235.2 R 5.249(.A)-.65 G .549 +-.15(ny a)-5.249 H .249 +(ttempt to write the database using the access methods will).15 F -.1 +(fa)133 247.2 S(il re).1 E -.05(ga)-.15 G +(rdless of the actual permissions of an).05 E 2.5(yu)-.15 G +(nderlying \214les.)-2.5 E(DB_THREAD)108 276 Q 1.066 +(Cause the DB handle returned by the)133 288 R F1(db_open)3.566 E F0 +1.065(function to be useable by multiple threads within a)3.566 F +(single address space, i.e., to be `)133 300 Q(`free-threaded')-.74 E +('.)-.74 E(DB_TR)108 316.8 Q(UNCA)-.4 E(TE)-1.11 E -.74(``)133 328.8 S +-.35(Tr).74 G(uncate').35 E 3.221('t)-.74 G .721(he database if it e) +-3.221 F .721(xists, i.e., beha)-.15 F 1.021 -.15(ve a)-.2 H 3.221(si) +.15 G 3.221(ft)-3.221 G .722 +(he database were just created, discarding an)-3.221 F(y)-.15 E(pre)133 +340.8 Q(vious contents.)-.25 E .496 +(All \214les created by the access methods are created with mode)108 +357.6 R F1(mode)2.996 E F0 .496(\(as described in)2.996 F F1 -.15(ch) +2.996 G(mod).15 E F0 .495(\(2\)\) and modi-).77 F .816 +(\214ed by the process' umask v)108 369.6 R .816 +(alue at the time of creation \(see)-.25 F F1(umask)3.317 E F0 3.317 +(\(2\)\). The).67 F .817(group o)3.317 F .817(wnership of created)-.25 F +(\214les is based on the system and directory def)108 381.6 Q +(aults, and is not further speci\214ed by DB.)-.1 E/F3 9/Times-Bold@0 SF +(DB_ENV)72 398.4 Q F0 .647(The access methods mak)108 410.4 R 3.146(ec) +-.1 G .646(alls to the other subsystems in the DB library based on the) +-3.146 F F1(dben)3.146 E(v)-.4 E F0(ar)3.146 E .646(gument to)-.18 F F1 +(db_open)108 422.4 Q F0 3.088(,w).24 G .589 +(hich is a pointer to a structure of type DB_ENV \(typedef)-3.088 F +1.589 -.5('d i).55 H 3.089(n<).5 G(db)-3.089 E 3.089 +(.h>\). Applications)-.4 F .589(will nor)3.089 F(-)-.2 E .635 +(mally use the same DB_ENV structure \(initialized by)108 434.4 R F1 +(db_appinit)3.135 E F0 .635(\(3\)\), as an ar).68 F .635 +(gument to all of the subsys-)-.18 F(tems in the DB package.)108 446.4 Q +.439(References to the DB_ENV structure are maintained by DB, so it may not be discarded until the last close) +108 463.2 R .287 +(function, corresponding to an open function for which it w)108 475.2 R +.286(as an ar)-.1 F .286(gument, has returned.)-.18 F .286 +(In order to ensure)5.286 F 1.578(compatibility with future releases of DB, all \214elds of the DB_ENV structure that are not e) +108 487.2 R 1.579(xplicitly set)-.15 F .171(should be initialized to 0 before the \214rst time the structure is used.) +108 499.2 R .17(Do this by declaring the structure e)5.17 F(xter)-.15 E +(-)-.2 E(nal or static, or by calling the C library routine)108 511.2 Q +F1(bzer)2.5 E(o)-.45 E F0(\(3\) or).18 E F1(memset)2.5 E F0(\(3\).).68 E +.347(The \214elds of the DB_ENV structure used by)108 528 R F1(db_open) +2.847 E F0 .347(are described belo)2.847 F 4.147 -.65(w. I)-.25 H(f).65 +E F1(dben)2.847 E(v)-.4 E F0 .347(is NULL or an)2.847 F 2.847(yo)-.15 G +2.847(fi)-2.847 G(ts)-2.847 E(\214elds are set to 0, def)108 540 Q +(aults appropriate for the system are used where possible.)-.1 E +(The follo)108 556.8 Q(wing \214elds in the DB_ENV structure may be initialized before calling) +-.25 E F1(db_open)2.5 E F0(:).24 E(DB_LOG *lg_info;)108 573.6 Q .924 +(If modi\214cations to the \214le being opened should be logged, the)133 +585.6 R F1(lg_info)3.424 E F0 .923(\214eld contains a return v)3.424 F +(alue)-.25 E(from the function)133 597.6 Q F1(lo)2.5 E(g_open)-.1 E F0 5 +(.I).24 G(f)-5 E F1(lg_info)2.5 E F0 +(is NULL, no logging is done by the DB access methods.)2.5 E(DB_LOCKT) +108 614.4 Q(AB *lk_info;)-.93 E .394(If locking is required for the \214le being opened \(as is the case when multiple processes or threads are) +133 626.4 R 1.412(accessing the same \214le\), the)133 638.4 R F1 +(lk_info)3.912 E F0 1.411(\214eld contains a return v)3.911 F 1.411 +(alue from the function)-.25 F F1(loc)3.911 E(k_open)-.2 E F0 6.411(.I) +.24 G(f)-6.411 E F1(lk_info)133 650.4 Q F0 +(is NULL, no locking is done by the DB access methods.)2.5 E .743 +(If both locking and transactions are being performed \(i.e., both)133 +674.4 R F1(lk_info)3.244 E F0(and)3.244 E F1(tx_info)3.244 E F0 .744 +(are non-NULL\),)3.244 F .944 +(the transaction ID will be used as the lock)133 686.4 R .944(er ID.)-.1 +F .944(If only locking is being performed,)5.944 F F1(db_open)3.444 E F0 +(will)3.444 E 2.317(acquire a lock)133 698.4 R 2.317(er ID from)-.1 F F1 +(loc)4.817 E(k_id)-.2 E F0 2.317 +(\(3\), and will use it for all locks required for this instance of).77 +F F1(db_open)133 710.4 Q F0(.).24 E(May 3, 1998)280.585 768 Q(2)203.585 +E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 352.18(DB_OPEN\(3\) DB_OPEN\(3\))72 48 R +(DB_MPOOL *mp_info;)108 84 Q .372(If the cache for the \214le being opened should be maintained in a shared b) +133 96 R(uf)-.2 E .371(fer pool, the)-.25 F/F1 10/Times-Italic@0 SF +(mp_info)2.871 E F0(\214eld)2.871 E .146(contains a return v)133 108 R +.146(alue from the function)-.25 F F1(memp_open)2.646 E F0 5.146(.I).24 +G(f)-5.146 E F1(mp_info)2.646 E F0 .147 +(is NULL, a memory pool may still)2.646 F(be created by DB, b)133 120 Q +(ut it will be pri)-.2 E -.25(va)-.25 G +(te to the application and managed by DB.).25 E(DB_TXNMGR *tx_info;)108 +136.8 Q 1.161(If the accesses to the \214le being opened should tak)133 +148.8 R 3.661(ep)-.1 G 1.161(lace in the conte)-3.661 F 1.161 +(xt of transactions \(pro)-.15 F(viding)-.15 E 1.239 +(atomicity and error reco)133 160.8 R -.15(ve)-.15 G 1.239(ry\), the).15 +F F1(tx_info)3.739 E F0 1.239(\214eld contains a return v)3.739 F 1.24 +(alue from the function)-.25 F F1(txn_open)3.74 E F0(\(see)133 172.8 Q +F1(db_txn)2.984 E F0 2.983(\(3\)\). If).24 F .483(transactions are speci\214ed, the application is responsible for making suitable calls) +2.983 F(to)133 184.8 Q F1(txn_be)3.074 E(gin)-.4 E F0(,).24 E F1 +(txn_abort)3.074 E F0 3.074(,a).68 G(nd)-3.074 E F1(txn_commit)3.074 E +F0 5.574(.I).68 G(f)-5.574 E F1(tx_info)3.074 E F0 .574 +(is NULL, no transaction support is done by the)3.074 F +(DB access methods.)133 196.8 Q 1(When the access methods are used in conjunction with transactions, the application must abort the) +133 220.8 R .974(transaction \(using)133 232.8 R F1(txn_abort)3.474 E F0 +3.474(\)i).68 G 3.474(fa)-3.474 G 1.274 -.15(ny o)-3.474 H 3.474(ft).15 +G .974(he transaction protected access method calls \(i.e., an)-3.474 F +3.475(yc)-.15 G(alls)-3.475 E .352(other than open, close and sync\) returns a system error \(e.g., deadlock, which returns EA) +133 244.8 R 2.852(GAIN\). As)-.4 F(described by)133 256.8 Q F1(db_intr) +2.5 E(o)-.45 E F0(\(3\), a system error is an).18 E 2.5(yv)-.15 G +(alue greater than 0.)-2.75 E/F2 9/Times-Bold@0 SF(DB_INFO)72 273.6 Q F0 +3.168(The access methods are con\214gured using the DB_INFO data structure ar) +108 285.6 R 3.168(gument to)-.18 F F1(db_open)5.668 E F0 8.168(.T).24 G +(he)-8.168 E .104(DB_INFO structure is typedef)108 297.6 R 1.104 -.5 +('d i).55 H 2.604(n<).5 G(db)-2.604 E .104(.h> and has a lar)-.4 F .104 +(ge number of \214elds, most speci\214c to a single access)-.18 F .299 +(method, although a fe)108 309.6 R 2.799(wa)-.25 G .299(re shared.) +-2.799 F .3(The \214elds that are common to all access methods are listed here; those) +5.299 F 1.235(speci\214c to an indi)108 321.6 R 1.235 +(vidual access method are described belo)-.25 F 5.035 -.65(w. N)-.25 H +3.735(or).65 G 1.234(eference to the DB_INFO structure is)-3.735 F +(maintained by DB, so it is possible to discard it as soon as the)108 +333.6 Q F1(db_open)2.5 E F0(call returns.)2.5 E .546(In order to ensure compatibility with future releases of DB, all \214elds of the DB_INFO structure should be) +108 350.4 R .41(initialized to 0 before the structure is used.)108 362.4 +R .409(Do this by declaring the structure e)5.41 F .409 +(xternal or static, or by call-)-.15 F(ing the C library function)108 +374.4 Q F1(bzer)2.5 E(o)-.45 E F0(\(3\) or).18 E F1(memset)2.5 E F0 +(\(3\).).68 E .576(If possible, def)108 391.2 R .576 +(aults appropriate for the system are used for the DB_INFO \214elds if) +-.1 F F1(dbinfo)3.076 E F0 .577(is NULL or an)3.076 F(y)-.15 E .054 +(\214elds of the DB_INFO structure are set to 0.)108 403.2 R .054 +(The follo)5.054 F .054 +(wing DB_INFO \214elds may be initialized before call-)-.25 F(ing)108 +415.2 Q F1(db_open)2.5 E F0(:).24 E(size_t db_cachesize;)108 432 Q 2.777 +(As)133 444 S .277 +(uggested maximum size of the memory pool cache, in bytes.)-2.777 F(If) +5.278 E F1(db_cac)2.778 E(hesize)-.15 E F0 .278(is 0, an appropriate) +2.778 F(def)133 456 Q(ault is used.)-.1 E +(It is an error to specify both the)5 E F1(mp_info)2.5 E F0 +(\214eld and a non-zero)2.5 E F1(db_cac)2.5 E(hesize)-.15 E F0(.).18 E +/F3 10/Times-Bold@0 SF 1.408(Note, the minimum number of pages in the cache should be no less than 10, and the access) +133 480 R 1.598(methods will fail if an insuf\214ciently lar)133 492 R +1.599(ge cache is speci\214ed.)-.1 F F0 1.599 +(In addition, for applications that)6.599 F -.15(ex)133 504 S .593(hibit strong locality in their data access patterns, increasing the size of the cache can signi\214cantly) +.15 F(impro)133 516 Q .3 -.15(ve a)-.15 H(pplication performance.).15 E +(int db_lorder;)108 532.8 Q .65(The byte order for inte)133 544.8 R .65 +(gers in the stored database metadata.)-.15 F .65 +(The number should represent the order)5.65 F .093(as an inte)133 556.8 +R(ger)-.15 E 2.593(,f)-.4 G .093(or e)-2.593 F .092(xample, big endian order is the number 4,321, and little endian order is the number) +-.15 F 2.5(1,234. If)133 568.8 R F1(db_lor)2.5 E(der)-.37 E F0 +(is 0, the host order of the machine where the DB library w)2.5 E +(as compiled is used.)-.1 E 1.211(The v)133 592.8 R 1.211(alue of)-.25 F +F1(db_lor)3.711 E(der)-.37 E F0 1.211(is ignored e)3.711 F 1.211 +(xcept when databases are being created.)-.15 F 1.212 +(If a database already)6.212 F -.15(ex)133 604.8 S +(ists, the byte order it uses is determined when the \214le is read.).15 +E F3 1.864(The access methods pr)133 628.8 R -.1(ov)-.18 G 1.864 +(ide no guarantees about the byte ordering of the application data).1 F +(stor)133 640.8 Q .934(ed in the database, and applications ar)-.18 F +3.434(er)-.18 G .934(esponsible f)-3.614 F .934 +(or maintaining any necessary order)-.25 F(-)-.37 E(ing)133 652.8 Q(.) +-.15 E F0(size_t db_pagesize;)108 669.6 Q .955 +(The size of the pages used to hold items in the database, in bytes.)133 +681.6 R .955(The minimum page size is 512)5.955 F .323 +(bytes and the maximum page size is 64K bytes.)133 693.6 R(If)5.324 E F1 +(db_pa)2.824 E -.1(ge)-.1 G(size).1 E F0 .324 +(is 0, a page size is selected based on)2.824 F 1.263 +(the underlying \214lesystem I/O block size.)133 705.6 R 1.263 +(The selected size has a lo)6.263 F 1.263(wer limit of 512 bytes and an) +-.25 F(upper limit of 16K bytes.)133 717.6 Q(May 3, 1998)280.585 768 Q +(3)203.585 E EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 352.18(DB_OPEN\(3\) DB_OPEN\(3\))72 48 R -.2(vo) +108 84 S(id *\(*db_malloc\)\(size_t\);).2 E 1.416(The \215ag DB_DBT_MALLOC, when speci\214ed in the DBT structure, will cause the DB library to) +133 96 R .256(allocate memory which then becomes the responsibility of the calling application.) +133 108 R(See)5.255 E/F1 10/Times-Italic@0 SF(db_dbt)2.755 E F0 .255 +(\(3\) for).68 F(more information.)133 120 Q .423 +(On systems where there may be multiple library v)133 144 R .423 +(ersions of malloc \(notably W)-.15 F(indo)-.4 E .423(ws NT\), specify-) +-.25 F .082(ing the DB_DBT_MALLOC \215ag will f)133 156 R .081 +(ail because the DB library will allocate memory from a dif)-.1 F(fer) +-.25 E(-)-.2 E .195(ent heap than the application will use to free it.) +133 168 R 1.795 -.8(To a)5.195 H -.2(vo).6 G .195(id this problem, the) +.2 F F1(db_malloc)2.695 E F0 .195(\214eld should be)2.695 F .184 +(set to point to the application')133 180 R 2.684(sa)-.55 G .184 +(llocation routine.)-2.684 F(If)5.184 E F1(db_malloc)2.684 E F0 .184 +(is non-NULL, it will be used to allo-)2.684 F .862 +(cate the memory returned when the DB_DBT_MALLOC \215ag is set.)133 192 +R(The)5.863 E F1(db_malloc)3.363 E F0 .863(function must)3.363 F +(match the calling con)133 204 Q -.15(ve)-.4 G(ntions of the).15 E F1 +(malloc)2.5 E F0(\(3\) library routine.).31 E/F2 9/Times-Bold@0 SF +(BTREE)72 220.8 Q F0 1.518(The btree data structure is a sorted, balanced tree structure storing associated k) +108 232.8 R -.15(ey)-.1 G 1.517(/data pairs.).15 F(Searches,)6.517 E +.135(insertions, and deletions in the btree will all complete in O \(lg base N\) where base is the a) +108 244.8 R -.15(ve)-.2 G .136(rage number of).15 F -.1(ke)108 256.8 S +.025(ys per page.)-.05 F .024(Often, inserting ordered data into btrees results in pages that are half-full.) +5.025 F .024(This implementa-)5.024 F .336 +(tion has been modi\214ed to mak)108 268.8 R 2.836(eo)-.1 G .336 +(rdered \(or in)-2.836 F -.15(ve)-.4 G .337 +(rse ordered\) insertion the best case, resulting in nearly per).15 F(-) +-.2 E(fect page space utilization.)108 280.8 Q .189 +(Space freed by deleting k)108 297.6 R -.15(ey)-.1 G .188 +(/data pairs from the database is ne).15 F -.15(ve)-.25 G 2.688(rr).15 G +.188(eclaimed from the \214lesystem, although it)-2.688 F 1.28 +(is reused where possible.)108 309.6 R 1.28 +(This means that the btree storage structure is gro)6.28 F(w-only)-.25 E +6.28(.I)-.65 G 3.78(fs)-6.28 G(uf)-3.78 E 1.28(\214ciently man)-.25 F(y) +-.15 E -.1(ke)108 321.6 S 1.379(ys are deleted from a tree that shrinking the underlying database \214le is desirable, this can be accom-) +-.05 F(plished by creating a ne)108 333.6 Q 2.5(wt)-.25 G +(ree from a scan of the e)-2.5 E(xisting one.)-.15 E 2.227(The follo)108 +350.4 R 2.227(wing additional \214elds and \215ags may be initialized in the DB_INFO structure before calling) +-.25 F F1(db_open)108 362.4 Q F0 2.5(,w).24 G +(hen using the btree access method:)-2.5 E +(int \(*bt_compare\)\(const DBT *, const DBT *\);)108 379.2 Q(The)133 +391.2 Q F1(bt_compar)3.318 E(e)-.37 E F0 .818(function is the k)3.318 F +1.118 -.15(ey c)-.1 H .818(omparison function.).15 F .818 +(It must return an inte)5.818 F .818(ger less than, equal)-.15 F .153 +(to, or greater than zero if the \214rst k)133 403.2 R .453 -.15(ey a) +-.1 H -.18(rg).15 G .153(ument is considered to be respecti).18 F -.15 +(ve)-.25 G .154(ly less than, equal to, or).15 F .669 +(greater than the second k)133 415.2 R .968 -.15(ey a)-.1 H -.18(rg).15 +G 3.168(ument. The).18 F .668 +(same comparison function must be used on a gi)3.168 F -.15(ve)-.25 G +3.168(nt).15 G(ree)-3.168 E -2.15 -.25(ev e)133 427.2 T +(ry time it is opened.).25 E(The)133 451.2 Q F1(data)2.637 E F0(and) +2.637 E F1(size)2.637 E F0 .137(\214elds of the DBT are the only \214elds that may be used for the purposes of this com-) +2.637 F(parison.)133 463.2 Q(If)133 487.2 Q F1(bt_compar)3.523 E(e)-.37 +E F0 1.022(is NULL, the k)3.523 F -.15(ey)-.1 G 3.522(sa).15 G 1.022 +(re compared le)-3.522 F(xically)-.15 E 3.522(,w)-.65 G 1.022 +(ith shorter k)-3.522 F -.15(ey)-.1 G 3.522(sc).15 G 1.022 +(ollating before longer)-3.522 F -.1(ke)133 499.2 S(ys.)-.05 E +(u_int32_t bt_mink)108 516 Q -.15(ey)-.1 G(;).15 E .118 +(The minimum number of k)133 528 R -.15(ey)-.1 G 2.618(st).15 G .118 +(hat will be stored on an)-2.618 F 2.618(ys)-.15 G .118(ingle page.) +-2.618 F .119(This v)5.119 F .119(alue is used to determine)-.25 F 1.256 +(which k)133 540 R -.15(ey)-.1 G 3.756(sw).15 G 1.256 +(ill be stored on o)-3.756 F -.15(ve)-.15 G(r\215o).15 E 3.756(wp)-.25 G +1.256(ages, i.e. if a k)-3.756 F 1.556 -.15(ey o)-.1 H 3.756(rd).15 G +1.256(ata item is lar)-3.756 F 1.255(ger than the pagesize)-.18 F(di)133 +552 Q .364(vided by the)-.25 F F1(bt_mink)2.864 E -.3(ey)-.1 G F0 -.25 +(va)3.164 G .364(lue, it will be stored on o).25 F -.15(ve)-.15 G +(r\215o).15 E 2.865(wp)-.25 G .365(ages instead of in the page itself.) +-2.865 F(The)5.365 E F1(bt_mink)133 564 Q -.3(ey)-.1 G F0 -.25(va)2.8 G +(lue speci\214ed must be at least 2; if).25 E F1(bt_mink)2.5 E -.3(ey) +-.1 G F0(is 0, a v)2.8 E(alue of 2 is used.)-.25 E +(size_t \(*bt_pre\214x\)\(const DBT *, const DBT *\);)108 580.8 Q(The) +133 592.8 Q F1(bt_pr)3.407 E(e\214x)-.37 E F0 .907 +(function is the pre\214x comparison function.)3.407 F .906 +(If speci\214ed, this function must return the)5.906 F .201 +(number of bytes of the second k)133 604.8 R .502 -.15(ey a)-.1 H -.18 +(rg).15 G .202 +(ument that are necessary to determine that it is greater than the).18 F +(\214rst k)133 616.8 Q .3 -.15(ey a)-.1 H -.18(rg).15 G 2.5(ument. If) +.18 F(the k)2.5 E -.15(ey)-.1 G 2.5(sa).15 G(re equal, the k)-2.5 E .3 +-.15(ey l)-.1 H(ength should be returned.).15 E(The)133 640.8 Q F1(data) +2.638 E F0(and)2.638 E F1(size)2.638 E F0 .137(\214elds of the DBT are the only \214elds that may be used for the purposes of this com-) +2.637 F(parison.)133 652.8 Q .837(This is used to compress the k)133 +676.8 R -.15(ey)-.1 G 3.338(ss).15 G .838 +(tored on the btree internal pages.)-3.338 F .838 +(The usefulness of this is data)5.838 F 1.19(dependent, b)133 688.8 R +1.189(ut in some data sets can produce signi\214cantly reduced tree sizes and search times.) +-.2 F(If)6.189 E F1(bt_pr)133 700.8 Q(e\214x)-.37 E F0 .468 +(is NULL, and no comparison function is speci\214ed, a def)2.968 F .469 +(ault le)-.1 F .469(xical comparison function is)-.15 F 2.5(used. If)133 +712.8 R F1(bt_pr)2.5 E(e\214x)-.37 E F0(is NULL and a comparison function is speci\214ed, no pre\214x comparison is done.) +2.5 E(May 3, 1998)280.585 768 Q(4)203.585 E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 352.18(DB_OPEN\(3\) DB_OPEN\(3\))72 48 R +(u_int32_t \215ags;)108 84 Q .349(The follo)133 96 R .349 +(wing additional \215ags may be speci\214ed by)-.25 F/F1 10/Times-Bold@0 +SF(or)2.849 E F0 .349('ing together one or more of the follo)B .348 +(wing v)-.25 F(al-)-.25 E(ues:)133 108 Q(DB_DUP)133 124.8 Q .262 +(Permit duplicate k)158 136.8 R -.15(ey)-.1 G 2.762(si).15 G 2.762(nt) +-2.762 G .262(he tree, i.e. insertion when the k)-2.762 F .563 -.15 +(ey o)-.1 H 2.763(ft).15 G .263(he k)-2.763 F -.15(ey)-.1 G .263 +(/data pair being inserted).15 F 1.298(already e)158 148.8 R 1.298 +(xists in the tree will be successful.)-.15 F 1.297 +(The ordering of duplicates in the tree is deter)6.298 F(-)-.2 E .91(mined by the order of insertion, unless the ordering is otherwise speci\214ed by use of a cursor) +158 160.8 R(\(see)158 172.8 Q/F2 10/Times-Italic@0 SF(db_cur)5.794 E +(sor)-.1 E F0 3.294(\(3\) for more information.\)).73 F 3.294 +(It is an error to specify both DB_DUP and)8.294 F(DB_RECNUM.)158 184.8 +Q(DB_RECNUM)133 201.6 Q 4.64(Support retrie)158 213.6 R -.25(va)-.25 G +7.14(lf).25 G 4.64(rom btrees using record numbers.)-7.14 F -.15(Fo)9.64 +G 7.14(rm).15 G 4.64(ore information, see the)-7.14 F 1.799 +(DB_SET_RECNO \215ag to the)158 225.6 R F2(DB->g)4.299 E(et)-.1 E F0 +1.798(function \(belo)4.298 F 1.798(w\), and the cursor)-.25 F F2(c_g) +4.298 E(et)-.1 E F0 1.798(function \(in)4.298 F F2(db_cur)158 237.6 Q +(sor)-.1 E F0(\(3\)\).).73 E .831 +(Logical record numbers in btrees are mutable in the f)158 261.6 R .832 +(ace of record insertion or deletion.)-.1 F(See)5.832 E +(the DB_RENUMBER \215ag in the RECNO section belo)158 273.6 Q 2.5(wf) +-.25 G(or further discussion.)-2.5 E .713(Maintaining record counts within a btree introduces a serious point of contention, namely the) +158 297.6 R .701(page locations where the record counts are stored.)158 +309.6 R .702(In addition, the entire tree must be lock)5.701 F(ed)-.1 E +.676(during both insertions and deletions, ef)158 321.6 R(fecti)-.25 E +-.15(ve)-.25 G .675(ly single-threading the tree for those operations.) +.15 F .11(Specifying DB_RECNUM can result in serious performance de)158 +333.6 R .11(gradation for some applications)-.15 F(and data sets.)158 +345.6 Q(It is an error to specify both DB_DUP and DB_RECNUM.)158 369.6 Q +/F3 9/Times-Bold@0 SF(HASH)72 386.4 Q F0 .591 +(The hash data structure is an e)108 398.4 R .591 +(xtensible, dynamic hashing scheme.)-.15 F(Backw)5.591 E .59 +(ard compatible interf)-.1 F .59(aces to the)-.1 F .107 +(functions described in)108 410.4 R F2(dbm)2.608 E F0(\(3\),).32 E F2 +(ndbm)2.608 E F0 .108(\(3\) and).32 F F2(hsear)2.608 E -.15(ch)-.37 G F0 +.108(\(3\) are pro).43 F .108(vided, ho)-.15 F(we)-.25 E -.15(ve)-.25 G +2.608(rt).15 G .108(hese interf)-2.608 F .108(aces are not com-)-.1 F +(patible with pre)108 422.4 Q(vious \214le formats.)-.25 E 2.228 +(The follo)108 439.2 R 2.227(wing additional \214elds and \215ags may be initialized in the DB_INFO structure before calling) +-.25 F F2(db_open)108 451.2 Q F0 2.5(,w).24 G +(hen using the hash access method:)-2.5 E(u_int32_t h_f)108 468 Q -.1 +(fa)-.25 G(ctor;).1 E .787(The desired density within the hash table.) +133 480 R .787(It is an approximation of the number of k)5.787 F -.15 +(ey)-.1 G 3.287(sa).15 G(llo)-3.287 E .788(wed to)-.25 F .505 +(accumulate in an)133 492 R 3.005(yo)-.15 G .505(ne b)-3.005 F(uck)-.2 E +.505(et, determining when the hash table gro)-.1 F .504(ws or shrinks.) +-.25 F .504(The def)5.504 F .504(ault v)-.1 F(alue)-.25 E +(is 0, indicating that the \214ll f)133 504 Q +(actor will be selected dynamically as pages are \214lled.)-.1 E +(u_int32_t \(*h_hash\)\(const v)108 520.8 Q(oid *, u_int32_t\);)-.2 E +(The)133 532.8 Q F2(h_hash)2.835 E F0 .335 +(\214eld is a user de\214ned hash function; if)2.835 F F2(h_hash)2.835 E +F0 .335(is NULL, a def)2.835 F .335(ault hash function is used.)-.1 F +.458(Since no hash function performs equally well on all possible data, the user may \214nd that the b) +133 544.8 R(uilt-in)-.2 E .792 +(hash function performs poorly with a particular data set.)133 556.8 R +.793(User speci\214ed hash functions must tak)5.793 F 3.293(ea)-.1 G +(pointer to a byte string and a length as ar)133 568.8 Q +(guments and return a u_int32_t v)-.18 E(alue.)-.25 E .666 +(If a hash function is speci\214ed,)133 585.6 R F2(hash_open)3.166 E F0 +.665(will attempt to determine if the hash function speci\214ed is)3.166 +F(the same as the one with which the database w)133 597.6 Q +(as created, and will f)-.1 E(ail if it detects that it is not.)-.1 E +(u_int32_t h_nelem;)108 614.4 Q .069 +(An estimate of the \214nal size of the hash table.)133 626.4 R .069 +(If not set or set too lo)5.069 F 1.369 -.65(w, h)-.25 H .069 +(ash tables will e).65 F .07(xpand grace-)-.15 F 1.356(fully as k)133 +638.4 R -.15(ey)-.1 G 3.856(sa).15 G 1.356 +(re entered, although a slight performance de)-3.856 F 1.355 +(gradation may be noticed.)-.15 F 1.355(The def)6.355 F(ault)-.1 E -.25 +(va)133 650.4 S(lue is 1.).25 E(u_int32_t \215ags;)108 667.2 Q .348 +(The follo)133 679.2 R .348 +(wing additional \215ags may be speci\214ed by)-.25 F F1(or)2.849 E F0 +.349('ing together one or more of the follo)B .349(wing v)-.25 F(al-) +-.25 E(ues:)133 691.2 Q(May 3, 1998)280.585 768 Q(5)203.585 E EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 352.18(DB_OPEN\(3\) DB_OPEN\(3\))72 48 R(DB_DUP) +133 84 Q .263(Permit duplicate k)158 96 R -.15(ey)-.1 G 2.763(si).15 G +2.763(nt)-2.763 G .263(he tree, i.e. insertion when the k)-2.763 F .562 +-.15(ey o)-.1 H 2.762(ft).15 G .262(he k)-2.762 F -.15(ey)-.1 G .262 +(/data pair being inserted).15 F 1.297(already e)158 108 R 1.297 +(xists in the tree will be successful.)-.15 F 1.298 +(The ordering of duplicates in the tree is deter)6.297 F(-)-.2 E .91(mined by the order of insertion, unless the ordering is otherwise speci\214ed by use of a cursor) +158 120 R(\(see)158 132 Q/F1 10/Times-Italic@0 SF(db_cur)2.5 E(sor)-.1 E +F0(\(3\) for more information.\)).73 E/F2 9/Times-Bold@0 SF(RECNO)72 +148.8 Q F0 .223(The recno access method pro)108 160.8 R .223 +(vides support for \214x)-.15 F .223(ed and v)-.15 F .223 +(ariable length records, optionally back)-.25 F .224(ed by a \215at)-.1 +F(te)108 172.8 Q(xt \(byte stream\) \214le.)-.15 E(Both \214x)5 E +(ed and v)-.15 E +(ariable length records are accessed by their logical record number)-.25 +E(.)-.55 E .341(It is v)108 189.6 R .34(alid to create a record whose record number is more than one greater than the last record currently in) +-.25 F .041(the database.)108 201.6 R -.15(Fo)5.041 G 2.541(re).15 G +.041(xample, the creation of record number 8, when records 6 and 7 do not yet e) +-2.691 F .042(xist, is not an)-.15 F(error)108 213.6 Q 5(.H)-.55 G -.25 +(ow)-5 G -2.15 -.25(ev e).25 H .8 -.4(r, a).25 H .3 -.15(ny a).4 H +(ttempt to retrie).15 E .3 -.15(ve s)-.25 H +(uch records \(e.g., records 6 and 7\) will return DB_KEYEMPTY).15 E(.) +-1.29 E 1.008(Deleting a record will not, by def)108 230.4 R 1.008 +(ault, renumber records follo)-.1 F 1.008 +(wing the deleted record \(see DB_RENUM-)-.25 F(BER belo)108 242.4 Q 2.5 +(wf)-.25 G(or more information\).)-2.5 E(An)5 E 2.5(ya)-.15 G +(ttempt to retrie)-2.5 E .3 -.15(ve d)-.25 H +(eleted records will return DB_KEYEMPTY).15 E(.)-1.29 E 2.227(The follo) +108 259.2 R 2.227(wing additional \214elds and \215ags may be initialized in the DB_INFO structure before calling) +-.25 F F1(db_open)108 271.2 Q F0 2.5(,w).24 G +(hen using the recno access method:)-2.5 E(int re_delim;)108 288 Q -.15 +(Fo)133 300 S 2.804(rv).15 G .304(ariable length records, if the)-3.054 +F F1 -.37(re)2.804 G(_sour).37 E(ce)-.37 E F0 .304 +(\214le is speci\214ed and the DB_DELIMITER \215ag is set, the)2.804 F +.659 +(delimiting byte used to mark the end of a record in the source \214le.) +133 312 R .659(If the)5.659 F F1 -.37(re)3.159 G(_sour).37 E(ce)-.37 E +F0 .659(\214le is speci\214ed)3.159 F 1.214 +(and the DB_DELIMITER \215ag is not set, characters \(i.e. `)-.25 F(`\\n')-.74 E 1.213 +(', 0x0a\) are interpreted as)-.74 F(end-of-record mark)133 336 Q(ers.) +-.1 E(u_int32_t re_len;)108 352.8 Q(The length of a \214x)133 364.8 Q +(ed-length record.)-.15 E(int re_pad;)108 381.6 Q -.15(Fo)133 393.6 S +4.507<728c>.15 G -.15(xe)-4.507 G 4.507(dl).15 G 2.007 +(ength records, if the DB_P)-4.507 F 2.008 +(AD \215ag is set, the pad character for short records.)-.92 F 2.008 +(If the)7.008 F(DB_P)133 405.6 Q(AD \215ag is not set, characters \(i.e., 0x20\) are used for padding.) +-.92 E(char *re_source;)108 422.4 Q .013(The purpose of the)133 434.4 R +F1 -.37(re)2.513 G(_sour).37 E(ce)-.37 E F0 .012(\214eld is to pro)2.513 +F .012(vide f)-.15 F .012 +(ast access and modi\214cation to databases that are nor)-.1 F(-)-.2 E +(mally stored as \215at te)133 446.4 Q(xt \214les.)-.15 E .209(If the) +133 470.4 R F1 -.37(re)2.709 G(_sour).37 E(ce)-.37 E F0 .209 +(\214eld is non-NULL, it speci\214es an underlying \215at te)2.709 F .21 +(xt database \214le that is read to ini-)-.15 F .662 +(tialize a transient record number inde)133 482.4 R 3.161(x. In)-.15 F +.661(the case of v)3.161 F .661 +(ariable length records, the records are sepa-)-.25 F .081 +(rated by the byte v)133 494.4 R(alue)-.25 E F1 -.37(re)2.581 G(_delim) +.37 E F0 5.081(.F).32 G .081(or e)-5.231 F .081 +(xample, standard UNIX byte stream \214les can be interpreted as)-.15 F +2.5(as)133 506.4 S(equence of v)-2.5 E +(ariable length records separated by characters.)-.25 +E .756(In addition, when cached data w)133 530.4 R .756(ould normally be written back to the underlying database \214le \(e.g.,) +-.1 F(the)133 542.4 Q F1(close)2.544 E F0(or)2.544 E F1(sync)2.544 E F0 +.044(functions are called\), the in-memory cop)2.544 F 2.544(yo)-.1 G +2.545(ft)-2.544 G .045(he database will be written back to the)-2.545 F +F1 -.37(re)133 554.4 S(_sour).37 E(ce)-.37 E F0(\214le.)2.5 E .45 +(By def)133 578.4 R .45(ault, the backing source \214le is read lazily) +-.1 F 2.95(,i)-.65 G .449 +(.e., records are not read from the \214le until the)-2.95 F 2.949(ya) +-.15 G(re)-2.949 E .747(requested by the application.)133 590.4 R/F3 10 +/Times-Bold@0 SF .748(If multiple pr)5.747 F .748(ocesses \(not thr)-.18 +F .748(eads\) ar)-.18 F 3.248(ea)-.18 G .748(ccessing a r)-3.248 F .748 +(ecno database)-.18 F(concurr)133 602.4 Q .109 +(ently and either inserting or deleting r)-.18 F .109 +(ecords, the backing sour)-.18 F .108(ce \214le must be r)-.18 F .108 +(ead in its)-.18 F(entir)133 614.4 Q .722(ety bef)-.18 F(or)-.25 E 3.222 +(em)-.18 G(or)-3.222 E 3.223(et)-.18 G .723(han a single pr)-3.223 F +.723(ocess accesses the database, and only that pr)-.18 F .723 +(ocess should)-.18 F .75(specify the backing sour)133 626.4 R .749 +(ce \214le as part of the db_open call.)-.18 F F0 .749(See the DB_SN) +5.749 F(APSHO)-.35 E 3.249<548d>-.4 G .749(ag belo)-3.249 F(w)-.25 E +(for more information.)133 638.4 Q F3 1.276 +(Reading and writing the backing sour)133 662.4 R 1.276 +(ce \214le speci\214ed by r)-.18 F(e_sour)-.18 E 1.276 +(ce cannot be transactionally)-.18 F(pr)133 674.4 Q 2.09 +(otected because it in)-.18 F -.1(vo)-.4 G(lv).1 E 2.09 +(es \214lesystem operations that ar)-.1 F 4.59(en)-.18 G 2.09 +(ot part of the DB transaction)-4.59 F(methodology)133 686.4 Q(.)-.7 E +F0 -.15(Fo)5.373 G 2.873(rt).15 G .374(his reason, if a temporary database is used to hold the records, i.e., a NULL w) +-2.873 F(as)-.1 E .259(speci\214ed as the)133 698.4 R F1(\214le)2.759 E +F0(ar)2.759 E .259(gument to)-.18 F F1(db_open)2.759 E F0 2.759(,i).24 G +2.759(ti)-2.759 G 2.759(sp)-2.759 G .259 +(ossible to lose the contents of the)-2.759 F F1 -.37(re)2.759 G(_sour) +.37 E(ce)-.37 E F0 .258(\214le, e.g.,)2.758 F .777 +(if the system crashes at the right instant.)133 710.4 R .777 +(If a \214le is used to hold the database, i.e., a \214le name w)5.777 F +(as)-.1 E 1.968(speci\214ed as the)133 722.4 R F1(\214le)4.468 E F0(ar) +4.468 E 1.968(gument to)-.18 F F1(db_open)4.468 E F0 4.468(,n).24 G +1.968(ormal database reco)-4.468 F -.15(ve)-.15 G 1.967 +(ry on that \214le can be used to).15 F(May 3, 1998)280.585 768 Q(6) +203.585 E EP +%%Page: 7 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 352.18(DB_OPEN\(3\) DB_OPEN\(3\))72 48 R(pre)133 +84 Q -.15(ve)-.25 G .512(nt information loss, although it is still possible that the contents of) +.15 F/F1 10/Times-Italic@0 SF -.37(re)3.012 G(_sour).37 E(ce)-.37 E F0 +.512(will be lost if the)3.012 F(system crashes.)133 96 Q(The)133 120 Q +F1 -.37(re)2.5 G(_sour).37 E(ce)-.37 E F0(\214le must already e)2.5 E +(xist \(b)-.15 E(ut may be zero-length\) when)-.2 E F1(db_open)2.5 E F0 +(is called.)2.5 E -.15(Fo)133 144 S 3.086(ra).15 G .586(ll of the abo) +-3.086 F .886 -.15(ve r)-.15 H .585(easons, the).15 F F1 -.37(re)3.085 G +(_sour).37 E(ce)-.37 E F0 .585 +(\214eld is generally used to specify databases that are read-)3.085 F +.143(only for DB applications, and that are either generated on the \215y by softw) +133 156 R .143(are tools, or modi\214ed using)-.1 F 2.5(ad)133 168 S(if) +-2.5 E(ferent mechanism, e.g., a te)-.25 E(xt editor)-.15 E(.)-.55 E +(u_int32_t \215ags;)108 184.8 Q .349(The follo)133 196.8 R .349 +(wing additional \215ags may be speci\214ed by)-.25 F/F2 10/Times-Bold@0 +SF(or)2.849 E F0 .349('ing together one or more of the follo)B .348 +(wing v)-.25 F(al-)-.25 E(ues:)133 208.8 Q(DB_DELIMITER)133 225.6 Q(The) +158 237.6 Q F1 -.37(re)2.5 G(_delim).37 E F0(\214eld is set.)2.5 E +(DB_FIXEDLEN)133 254.4 Q 1.442(The records are \214x)158 266.4 R 1.442 +(ed-length, not byte delimited.)-.15 F 1.443(The structure element)6.443 +F F1 -.37(re)3.943 G(_len).37 E F0 1.443(speci\214es the)3.943 F +(length of the record, and the structure element)158 278.4 Q F1 -.37(re) +2.5 G(_pad).37 E F0(is used as the pad character)2.5 E(.)-.55 E(An)158 +302.4 Q 4.789(yr)-.15 G 2.289 +(ecords added to the database that are less than)-4.789 F F1 -.37(re) +4.788 G(_len).37 E F0 2.288(bytes long are automatically)4.788 F 2.876 +(padded. An)158 314.4 R 2.876(ya)-.15 G .377 +(ttempt to insert records into the database that are greater than)-2.876 +F F1 -.37(re)2.877 G(_len).37 E F0 .377(bytes long)2.877 F +(will cause the call to f)158 326.4 Q +(ail immediately and return an error)-.1 E(.)-.55 E(DB_P)133 343.2 Q(AD) +-.92 E(The)158 355.2 Q F1 -.37(re)2.5 G(_pad).37 E F0(\214eld is set.) +2.5 E(DB_RENUMBER)133 372 Q 1.258(Specifying the DB_RENUMBER \215ag causes the logical record numbers to be mutable, and) +158 384 R 1.16 +(change as records are added to and deleted from the database.)158 396 R +-.15(Fo)6.16 G 3.66(re).15 G 1.16(xample, the deletion of)-3.81 F .016(record number 4 causes records numbered 5 and greater to be renumbered do) +158 408 R(wnw)-.25 E .015(ard by 1.)-.1 F .015(If a)5.015 F .57 +(cursor w)158 420 R .571(as positioned to record number 4 before the deletion, it will reference the ne) +-.1 F 3.071(wr)-.25 G(ecord)-3.071 E .608(number 4, if an)158 432 R +3.108(ys)-.15 G .608(uch record e)-3.108 F .608 +(xists, after the deletion.)-.15 F .607(If a cursor w)5.607 F .607 +(as positioned after record)-.1 F .267 +(number 4 before the deletion, it will be shifted do)158 444 R(wnw)-.25 +E .268(ard 1 logical record, continuing to refer)-.1 F(-)-.2 E +(ence the same record as it did before.)158 456 Q 1.662(Using the)158 +480 R F1(c_put)4.162 E F0(or)4.162 E F1(put)4.162 E F0(interf)4.162 E +1.662(aces to create ne)-.1 F 4.162(wr)-.25 G 1.662 +(ecords will cause the creation of multiple)-4.162 F .872 +(records if the record number is more than one greater than the lar)158 +492 R .872(gest record currently in the)-.18 F 3.45(database. F)158 504 +R .95(or e)-.15 F .95(xample, creating record 28, when record 25 w)-.15 +F .95(as pre)-.1 F .95(viously the last record in)-.25 F 1.353 +(the database, will create records 26 and 27 as well as 28.)158 516 R +1.353(Attempts to retrie)6.353 F 1.654 -.15(ve r)-.25 H 1.354 +(ecords that).15 F(were created in this manner will result in an error return of DB_KEYEMPTY) +158 528 Q(.)-1.29 E .05(If a created record is not at the end of the database, all records follo) +158 552 R .049(wing the ne)-.25 F 2.549(wr)-.25 G .049(ecord will be) +-2.549 F .057(automatically renumbered upw)158 564 R .057(ard by 1.)-.1 +F -.15(Fo)5.057 G 2.557(re).15 G .057(xample, the creation of a ne) +-2.707 F 2.557(wr)-.25 G .058(ecord numbered 8)-2.557 F .805 +(causes records numbered 8 and greater to be renumbered upw)158 576 R +.804(ard by 1.)-.1 F .804(If a cursor w)5.804 F .804(as posi-)-.1 F +1.056(tioned to record number 8 or greater before the insertion, it will be shifted upw) +158 588 R 1.056(ard 1 logical)-.1 F +(record, continuing to reference the same record as it did before.)158 +600 Q -.15(Fo)158 624 S 2.672(rt).15 G .172(hese reasons, concurrent access to a recno database with the DB_RENUMBER \215ag speci-) +-2.672 F(\214ed may be lar)158 636 Q +(gely meaningless, although it is supported.)-.18 E(DB_SN)133 652.8 Q +(APSHO)-.35 E(T)-.4 E 1.547(This \215ag speci\214es that an)158 664.8 R +4.047(ys)-.15 G(peci\214ed)-4.047 E F1 -.37(re)4.047 G(_sour).37 E(ce) +-.37 E F0 1.547(\214le be read in its entirety when)4.047 F F1(db_open) +4.048 E F0(is)4.048 E 2.5(called. If)158 676.8 R +(this \215ag is not speci\214ed, the)2.5 E F1 -.37(re)2.5 G(_sour).37 E +(ce)-.37 E F0(\214le may be read lazily)2.5 E(.)-.65 E/F3 9/Times-Bold@0 +SF(DB OPERA)72 698.4 Q(TIONS)-.855 E F0 .156 +(The DB structure returned by)108 710.4 R F1(db_open)2.656 E F0 .156 +(describes a database type, and includes a set of functions to perform) +2.656 F -.25(va)108 722.4 S .036(rious actions, as described belo).25 F +3.836 -.65(w. E)-.25 H .037(ach of these functions tak).65 F .037 +(es a pointer to a DB structure, and may tak)-.1 F(e)-.1 E(May 3, 1998) +280.585 768 Q(7)203.585 E EP +%%Page: 8 8 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 352.18(DB_OPEN\(3\) DB_OPEN\(3\))72 48 R +(one or more DBT *')108 84 Q 2.5(sa)-.55 G(nd a \215ag v)-2.5 E +(alue as well.)-.25 E(The \214elds of the DB structure are as follo)5 E +(ws:)-.25 E(DBTYPE type;)108 100.8 Q .618 +(The type of the underlying access method \(and \214le format\).)133 +112.8 R .618(Set to one of DB_BTREE, DB_HASH)5.618 F 1.151(or DB_RECNO.) +133 124.8 R 1.151(This \214eld may be used to determine the type of the database after a return from) +6.151 F/F1 10/Times-Italic@0 SF(db_open)133 136.8 Q F0(with the)2.5 E F1 +(type)2.5 E F0(ar)2.5 E(gument set to DB_UNKNO)-.18 E(WN.)-.35 E +(int \(*close\)\(DB *db, u_int32_t \215ags\);)108 153.6 Q 3.043(Ap)133 +165.6 S .543(ointer to a function to \215ush an)-3.043 F 3.043(yc)-.15 G +.543(ached information to disk, close an)-3.043 F 3.043(yo)-.15 G .543 +(pen cursors \(see)-3.043 F F1(db_cur)3.042 E(-)-.2 E(sor)133 177.6 Q F0 +.376(\(3\)\), free an).73 F 2.876(ya)-.15 G .376 +(llocated resources, and close an)-2.876 F 2.876(yu)-.15 G .377 +(nderlying \214les.)-2.876 F .377(Since k)5.377 F -.15(ey)-.1 G .377 +(/data pairs are cached).15 F .787(in memory)133 189.6 R 3.287(,f)-.65 G +.787(ailing to sync the \214le with the)-3.387 F F1(close)3.287 E F0(or) +3.287 E F1(sync)3.287 E F0 .786 +(function may result in inconsistent or lost)3.287 F(information.)133 +201.6 Q(The)133 218.4 Q F1<8d61>2.5 E(gs)-.1 E F0 +(parameter must be set to 0 or the follo)2.5 E(wing v)-.25 E(alue:)-.25 +E(DB_NOSYNC)133 235.2 Q(Do not \215ush cached information to disk.)158 +247.2 Q .69(The DB_NOSYNC \215ag is a dangerous option.)133 264 R .691 +(It should only be set if the application is doing log-)5.69 F .757 +(ging \(with transactions\) so that the database is reco)133 276 R -.15 +(ve)-.15 G .757(rable after a system or application crash, or if).15 F +(the database is al)133 288 Q -.1(wa)-.1 G +(ys generated from scratch after an).1 E 2.5(ys)-.15 G +(ystem or application crash.)-2.5 E/F2 10/Times-Bold@0 SF .436 +(It is important to understand that \215ushing cached inf)133 304.8 R +.437(ormation to disk only minimizes the win-)-.25 F(do)133 316.8 Q +3.656(wo)-.1 G 3.656(fo)-3.656 G 1.156(pportunity f)-3.656 F 1.156 +(or corrupted data.)-.25 F F0 1.156(While unlik)6.156 F(ely)-.1 E 3.656 +(,i)-.65 G 3.656(ti)-3.656 G 3.656(sp)-3.656 G 1.155 +(ossible for database corruption to)-3.656 F 1.326(happen if a system or application crash occurs while writing data to the database.) +133 328.8 R 2.926 -.8(To e)6.326 H 1.326(nsure that).8 F 1.062 +(database corruption ne)133 340.8 R -.15(ve)-.25 G 3.562(ro).15 G 1.062 +(ccurs, applications must either: use transactions and logging with auto-) +-3.562 F 1.324(matic reco)133 352.8 R -.15(ve)-.15 G(ry).15 E 3.824(,u) +-.65 G 1.324(se logging and application-speci\214c reco)-3.824 F -.15 +(ve)-.15 G(ry).15 E 3.824(,o)-.65 G 3.824(re)-3.824 G 1.324(dit a cop) +-3.824 F 3.825(yo)-.1 G 3.825(ft)-3.825 G 1.325(he database, and,)-3.825 +F .602(once all applications using the database ha)133 364.8 R .902 -.15 +(ve s)-.2 H .601(uccessfully called).15 F F1(close)3.101 E F0 3.101(,r) +.18 G .601(eplace the original database)-3.101 F(with the updated cop) +133 376.8 Q -.65(y.)-.1 G .812 +(When multiple threads are using the DB handle concurrently)133 393.6 R +3.312(,o)-.65 G .812(nly a single thread may call the DB)-3.312 F +(handle close function.)133 405.6 Q(The)133 422.4 Q F1(close)2.5 E F0 +(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E +(int \(*cursor\)\(DB *db, DB_TXN *txnid, DBC **cursorp\);)108 439.2 Q +2.759(Ap)133 451.2 S .259 +(ointer to a function to create a cursor and cop)-2.759 F 2.758(yap)-.1 +G .258(ointer to it into the memory referenced by)-2.758 F F1(cur)2.758 +E(-)-.2 E(sorp)133 463.2 Q F0(.).19 E 3.41(Ac)133 480 S .91 +(ursor is a structure used to pro)-3.41 F .91 +(vide sequential access through a database.)-.15 F .91(This interf)5.91 +F .91(ace and its)-.1 F 1.066 +(associated functions replaces the functionality pro)133 492 R 1.066 +(vided by the)-.15 F F1(seq)3.566 E F0 1.066(function in pre)3.566 F +1.066(vious releases of)-.25 F(the DB library)133 504 Q(.)-.65 E 1.768 +(If the \214le is being accessed under transaction protection, the)133 +525.6 R F1(txnid)4.269 E F0 1.769(parameter is a transaction ID)4.269 F +1.691(returned from)133 537.6 R F1(txn_be)4.191 E(gin)-.4 E F0 4.191(,o) +.24 G 1.691(therwise, NULL.)-4.191 F 1.691 +(If transaction protection is enabled, cursors must be)6.691 F .63 +(opened and closed within the conte)133 549.6 R .631 +(xt of a transaction, and the)-.15 F F1(txnid)3.131 E F0 .631 +(parameter speci\214es the transac-)3.131 F(tion conte)133 561.6 Q +(xt in which the cursor may be used.)-.15 E(See)5 E F1(db_cur)2.5 E(sor) +-.1 E F0(\(3\) for more information.).73 E(The)133 578.4 Q F1(cur)2.5 E +(sor)-.1 E F0(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E +F0(on f)2.5 E(ailure and 0 on success.)-.1 E +(int \(*del\)\(DB *db, DB_TXN *txnid, DBT *k)108 595.2 Q -.15(ey)-.1 G +2.5(,u)-.5 G(_int32_t \215ags\);)-2.5 E 2.542(Ap)133 607.2 S .042 +(ointer to a function to remo)-2.542 F .341 -.15(ve k)-.15 H -.15(ey).05 +G .041(/data pairs from the database.).15 F .041(The k)5.041 F -.15(ey) +-.1 G .041(/data pair associated with).15 F .518(the speci\214ed)133 +619.2 R F1 -.1(ke)3.018 G(y)-.2 E F0 .518 +(is discarded from the database.)3.018 F .518 +(In the presence of duplicate k)5.518 F .818 -.15(ey v)-.1 H .519 +(alues, all records)-.1 F(associated with the designated k)133 631.2 Q +.3 -.15(ey w)-.1 H(ill be discarded.).15 E 1.769 +(If the \214le is being accessed under transaction protection, the)133 +648 R F1(txnid)4.269 E F0 1.768(parameter is a transaction ID)4.268 F +(returned from)133 660 Q F1(txn_be)2.5 E(gin)-.4 E F0 2.5(,o).24 G +(therwise, NULL.)-2.5 E(The)133 676.8 Q F1<8d61>2.5 E(gs)-.1 E F0 +(parameter is currently unused, and must be set to 0.)2.5 E(The)133 +693.6 Q F1(del)3.856 E F0 1.357(function returns the v)3.856 F 1.357 +(alue of)-.25 F F1(errno)3.857 E F0 1.357(on f)3.857 F 1.357 +(ailure, 0 on success, and DB_NO)-.1 F 1.357(TFOUND if the)-.4 F +(speci\214ed)133 705.6 Q F1 -.1(ke)2.5 G(y)-.2 E F0(did not e)2.5 E +(xist in the \214le.)-.15 E(May 3, 1998)280.585 768 Q(8)203.585 E EP +%%Page: 9 9 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 352.18(DB_OPEN\(3\) DB_OPEN\(3\))72 48 R +(int \(*fd\)\(DB *db, int *fdp\);)108 84 Q 2.898(Ap)133 96 S .398 +(ointer to a function that copies a \214le descriptor representati) +-2.898 F .697 -.15(ve o)-.25 H 2.897(ft).15 G .397 +(he underlying database into the)-2.897 F 1.23(memory referenced by)133 +108 R/F1 10/Times-Italic@0 SF(fdp)3.73 E F0 6.23(.A).19 G 1.23(\214le descriptor referencing the same \214le will be returned to all pro-) +-2.5 F .77(cesses that call)133 120 R F1(db_open)3.27 E F0 .77 +(with the same)3.27 F F1(\214le)3.27 E F0(ar)3.269 E 3.269(gument. This) +-.18 F .769(\214le descriptor may be safely used as an)3.269 F(ar)133 +132 Q .487(gument to the)-.18 F F1(fcntl)2.987 E F0 .487(\(2\) and).51 F +F1(\215oc)2.987 E(k)-.2 E F0 .487(\(2\) locking functions.).67 F .487 +(The \214le descriptor is not necessarily associ-)5.487 F(ated with an) +133 144 Q 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he underlying \214les used by the access method.)-2.5 E(The)133 160.8 Q +F1(fd)3.718 E F0 1.218 +(function only supports a coarse-grained form of locking.)3.718 F 1.218 +(Applications should use the lock)6.218 F(manager where possible.)133 +172.8 Q(The)133 189.6 Q F1(fd)2.5 E F0(function returns the v)2.5 E +(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 E(ailure and 0 on success.) +-.1 E(int \(*get\)\(DB *db, DB_TXN *txnid,)108 206.4 Q(DBT *k)183 218.4 +Q -.15(ey)-.1 G 2.5(,D)-.5 G(BT *data, u_int32_t \215ags\);)-2.5 E 3.572 +(Ap)133 230.4 S 1.072(ointer to a function that is an interf)-3.572 F +1.072(ace for k)-.1 F -.15(ey)-.1 G 1.072(ed retrie).15 F -.25(va)-.25 G +3.573(lf).25 G 1.073(rom the database.)-3.573 F 1.073(The address and) +6.073 F(length of the data associated with the speci\214ed)133 242.4 Q +F1 -.1(ke)2.5 G(y)-.2 E F0(are returned in the structure referenced by) +2.5 E F1(data)2.5 E F0(.).26 E 1.502(In the presence of duplicate k)133 +266.4 R 1.801 -.15(ey v)-.1 H(alues,)-.1 E F1 -.1(ge)4.001 G(t).1 E F0 +1.501(will return the \214rst data item for the designated k)4.001 F +-.15(ey)-.1 G(.)-.5 E 1.004(Duplicates are sorted by insert order e)133 +278.4 R 1.005(xcept where this order has been o)-.15 F -.15(ve)-.15 G +1.005(rridden by cursor opera-).15 F(tions.)133 290.4 Q/F2 10 +/Times-Bold@0 SF(Retrie)5.199 E -.1(va)-.15 G 2.699(lo).1 G 2.699(fd) +-2.699 G .199(uplicates r)-2.699 F(equir)-.18 E .198 +(es the use of cursor operations.)-.18 F F0(See)5.198 E F1(db_cur)2.698 +E(sor)-.1 E F0 .198(\(3\) for details.).73 F 1.768 +(If the \214le is being accessed under transaction protection, the)133 +307.2 R F1(txnid)4.269 E F0 1.769(parameter is a transaction ID)4.269 F +(returned from)133 319.2 Q F1(txn_be)2.5 E(gin)-.4 E F0 2.5(,o).24 G +(therwise, NULL.)-2.5 E(The)133 336 Q F1<8d61>2.5 E(gs)-.1 E F0 +(parameter must be set to 0 or the follo)2.5 E(wing v)-.25 E(alue:)-.25 +E(DB_SET_RECNO)133 352.8 Q(Retrie)158 364.8 Q .823 -.15(ve t)-.25 H .522 +(he speci\214ed numbered k).15 F -.15(ey)-.1 G .522 +(/data pair from a database.).15 F .522(Upon return, both the)5.522 F F1 +-.1(ke)3.022 G(y)-.2 E F0(and)3.022 E F1(data)158 376.8 Q F0 .276 +(items will ha)2.776 F .576 -.15(ve b)-.2 H .277(een \214lled in, not just the data item as is done for all other uses of the) +.15 F F1 -.1(ge)2.777 G(t).1 E F0(function.)158 388.8 Q(The)158 412.8 Q +F1(data)4.36 E F0 1.86(\214eld of the speci\214ed)4.36 F F1 -.1(ke)4.36 +G(y)-.2 E F0 1.86(must be a pointer to a memory location from which a) +4.36 F F1(db_r)158 424.8 Q(ecno_t)-.37 E F0 1.613 +(may be read, as described in)4.112 F F1(db_dbt)4.113 E F0 4.113 +(\(3\). This).68 F 1.613(memory location will be read to)4.113 F +(determine the record to be retrie)158 436.8 Q -.15(ve)-.25 G(d.).15 E +-.15(Fo)158 460.8 S 3.788(rD).15 G 1.287(B_SET_RECNO to be speci\214ed, the underlying database must be of type btree and it) +-3.788 F(must ha)158 472.8 Q .3 -.15(ve b)-.2 H +(een created with the DB_RECNUM \215ag \(see).15 E F1(db_open)2.5 E F0 +(\(3\)\).).24 E .753 +(If the database is a recno database and the requested k)133 489.6 R +1.053 -.15(ey ex)-.1 H .753(ists, b).15 F .753(ut w)-.2 F .753(as ne)-.1 +F -.15(ve)-.25 G 3.253(re).15 G .753(xplicitly created by)-3.403 F 1.577 +(the application or w)133 501.6 R 1.577(as later deleted, the)-.1 F F1 +-.1(ge)4.077 G(t).1 E F0 1.577(function returns DB_KEYEMPTY)4.077 F +6.577(.O)-1.29 G 1.577(therwise, if the)-6.577 F 1.2(requested k)133 +513.6 R 1.5 -.15(ey i)-.1 H(sn').15 E 3.7(ti)-.18 G 3.7(nt)-3.7 G 1.2 +(he database, the)-3.7 F F1 -.1(ge)3.7 G(t).1 E F0 1.2 +(function returns DB_NO)3.7 F 3.7(TFOUND. Otherwise,)-.4 F(the)3.7 E F1 +-.1(ge)3.7 G(t).1 E F0(function returns the v)133 525.6 Q(alue of)-.25 E +F1(errno)2.5 E F0(on f)2.5 E(ailure and 0 on success.)-.1 E +(int \(*put\)\(DB *db, DB_TXN *txnid,)108 542.4 Q(DBT *k)183 554.4 Q +-.15(ey)-.1 G 2.5(,D)-.5 G(BT *data, u_int32_t \215ags\);)-2.5 E 2.572 +(Ap)133 566.4 S .071(ointer to a function to store k)-2.572 F -.15(ey) +-.1 G .071(/data pairs in the database.).15 F .071 +(If the database supports duplicates, the)5.071 F F1(put)133 578.4 Q F0 +(function adds the ne)2.5 E 2.5(wd)-.25 G(ata v)-2.5 E +(alue at the end of the duplicate set.)-.25 E 1.768 +(If the \214le is being accessed under transaction protection, the)133 +595.2 R F1(txnid)4.269 E F0 1.769(parameter is a transaction ID)4.269 F +(returned from)133 607.2 Q F1(txn_be)2.5 E(gin)-.4 E F0 2.5(,o).24 G +(therwise, NULL.)-2.5 E(The \215ags v)133 624 Q(alue is speci\214ed by) +-.25 E F2(or)2.5 E F0('ing together one or more of the follo)A(wing v) +-.25 E(alues:)-.25 E(DB_APPEND)133 640.8 Q 1.201(Append the k)158 652.8 +R -.15(ey)-.1 G 1.201(/data pair to the end of the database.).15 F -.15 +(Fo)6.201 G 3.7(rD).15 G 1.2(B_APPEND to be speci\214ed, the)-3.7 F +1.974(underlying database must be of type recno.)158 664.8 R 1.975 +(The record number allocated to the record is)6.974 F +(returned in the speci\214ed)158 676.8 Q F1 -.1(ke)2.5 G(y)-.2 E F0(.) +.32 E(DB_NOO)133 693.6 Q(VER)-.5 E(WRITE)-.55 E(Enter the ne)158 705.6 Q +2.5(wk)-.25 G -.15(ey)-2.6 G(/data pair only if the k).15 E .3 -.15 +(ey d)-.1 H(oes not already appear in the database.).15 E(May 3, 1998) +280.585 768 Q(9)203.585 E EP +%%Page: 10 10 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 352.18(DB_OPEN\(3\) DB_OPEN\(3\))72 48 R .907 +(The def)133 84 R .907(ault beha)-.1 F .907(vior of the)-.2 F/F1 10 +/Times-Italic@0 SF(put)3.407 E F0 .907(function is to enter the ne)3.407 +F 3.407(wk)-.25 G -.15(ey)-3.507 G .907(/data pair).15 F 3.407(,r)-.4 G +.906(eplacing an)-3.407 F 3.406(yp)-.15 G(re)-3.406 E(viously)-.25 E +-.15(ex)133 96 S .02(isting k).15 F .32 -.15(ey i)-.1 H 2.52(fd).15 G +.02(uplicates are disallo)-2.52 F .021 +(wed, or to add a duplicate entry if duplicates are allo)-.25 F 2.521 +(wed. Ev)-.25 F .021(en if)-.15 F .815(the designated database allo)133 +108 R .814(ws duplicates, a call to)-.25 F F1(put)3.314 E F0 .814 +(with the DB_NOO)3.314 F(VER)-.5 E .814(WRITE \215ag set will)-.55 F -.1 +(fa)133 120 S(il if the k).1 E .3 -.15(ey a)-.1 H(lready e).15 E +(xists in the database.)-.15 E(The)133 136.8 Q F1(put)4.178 E F0 1.678 +(function returns the v)4.178 F 1.679(alue of)-.25 F F1(errno)4.179 E F0 +1.679(on f)4.179 F 1.679(ailure, 0 on success, and DB_KEYEXIST if the) +-.1 F(DB_NOO)133 148.8 Q(VER)-.5 E(WRITE)-.55 E F1<8d61>2.5 E(g)-.1 E F0 +-.1(wa)2.5 G 2.5(ss).1 G(et and the k)-2.5 E .3 -.15(ey a)-.1 H +(lready e).15 E(xists in the \214le.)-.15 E +(int \(*sync\)\(DB *db, u_int32_t \215ags\);)108 165.6 Q 3.291(Ap)133 +177.6 S .791(ointer to a function to \215ush an)-3.291 F 3.291(yc)-.15 G +.791(ached information to disk.)-3.291 F .79 +(If the database is in memory only)5.79 F(,)-.65 E(the)133 189.6 Q F1 +(sync)2.5 E F0(function has no ef)2.5 E(fect and will al)-.25 E -.1(wa) +-.1 G(ys succeed.).1 E(The)133 206.4 Q F1<8d61>2.5 E(gs)-.1 E F0 +(parameter is currently unused, and must be set to 0.)2.5 E(See the)133 +223.2 Q F1(close)2.5 E F0(function description abo)2.5 E .3 -.15(ve f) +-.15 H(or a discussion of DB and cached data.).15 E(The)133 240 Q F1 +(sync)2.5 E F0(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 +E F0(on f)2.5 E(ailure and 0 on success.)-.1 E(int \(*stat\)\(DB *db, v) +108 256.8 Q(oid *sp,)-.2 E -.2(vo)183 268.8 S +(id *\(*db_malloc\)\(size_t\), u_int32_t \215ags\);).2 E 3.897(Ap)133 +280.8 S 1.397 +(ointer to a function to create a statistical structure and cop)-3.897 F +3.897(yap)-.1 G 1.397(ointer to it into user)-3.897 F(-speci\214ed)-.2 E +1.273(memory locations.)133 292.8 R(Speci\214cally)6.273 E 3.773(,i)-.65 +G(f)-3.773 E F1(sp)3.773 E F0 1.273 +(is non-NULL, a pointer to the statistics for the database are)3.773 F +(copied into the memory location it references.)133 304.8 Q .218 +(Statistical structures are created in allocated memory)133 328.8 R +5.218(.I)-.65 G(f)-5.218 E F1(db_malloc)2.718 E F0 .218 +(is non-NULL, it is called to allo-)2.718 F 1.36(cate the memory)133 +340.8 R 3.86(,o)-.65 G 1.359(therwise, the library function)-3.86 F F1 +(malloc)3.859 E F0 1.359(\(3\) is used.).31 F 1.359(The function)6.359 F +F1(db_malloc)3.859 E F0(must)3.859 E .79(match the calling con)133 352.8 +R -.15(ve)-.4 G .791(ntions of the).15 F F1(malloc)3.291 E F0 .791 +(\(3\) library routine.).31 F(Re)5.791 E -.05(ga)-.15 G .791 +(rdless, the caller is responsible).05 F .667 +(for deallocating the returned memory)133 364.8 R 5.666(.T)-.65 G 3.166 +(od)-6.466 G .666(eallocate the returned memory)-3.166 F 3.166(,f)-.65 G +.666(ree each returned mem-)-3.166 F +(ory pointer; pointers inside the memory do not need to be indi)133 +376.8 Q(vidually freed.)-.25 E/F2 10/Times-Bold@0 SF 1.82(In the pr)133 +400.8 R 1.821(esence of multiple thr)-.18 F 1.821(eads or pr)-.18 F +1.821(ocesses accessing an acti)-.18 F 2.021 -.1(ve d)-.1 H 1.821 +(atabase, the r).1 F(etur)-.18 E(ned)-.15 E(inf)133 412.8 Q +(ormation may be out-of-date.)-.25 E .17 +(This function may access all of the pages in the database, and ther)133 +436.8 R(ef)-.18 E(or)-.25 E 2.67(em)-.18 G .17(ay incur a se)-2.67 F -.1 +(ve)-.15 G .53 -.18(re p).1 H(er).18 E(-)-.37 E -.25(fo)133 448.8 S +(rmance penalty and ha).25 E .2 -.1(ve o)-.25 H -.15(bv).1 G +(ious negati).15 E .2 -.1(ve e)-.1 H(ffects on the underlying b).1 E +(uffer pool.)-.2 E F0(The)133 477.6 Q F1<8d61>2.5 E(gs)-.1 E F0 +(parameter must be set to 0 or the follo)2.5 E(wing v)-.25 E(alue:)-.25 +E(DB_RECORDCOUNT)133 499.2 Q 1.312(Fill in the)158 511.2 R F1(bt_nr) +3.812 E(ecs)-.37 E F0 1.312(\214eld of the statistics structure, b)3.812 +F 1.312(ut do not collect an)-.2 F 3.812(yo)-.15 G 1.312 +(ther information.)-3.812 F .016(This \215ag mak)158 523.2 R .015(es it reasonable for applications to request a record count from a database without) +-.1 F 1.272(incurring a performance penalty)158 535.2 R 6.272(.I)-.65 G +3.772(ti)-6.272 G 3.772(so)-3.772 G 1.272(nly a)-3.772 F -.25(va)-.2 G +1.273(ilable for recno databases, or btree databases).25 F +(where the underlying database w)158 547.2 Q +(as created with the DB_RECNUM \215ag.)-.1 E(The)133 564 Q F1(stat)2.5 E +F0(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f) +2.5 E(ailure and 0 on success.)-.1 E 4.143(In the case of a btree or recno database, the statistics are stored in a structure of type) +133 580.8 R(DB_BTREE_ST)133 592.8 Q 2.22 -1.11(AT \()-.93 H -1.95 +(typedef ')1.11 F 2.5(di)-.5 G 2.5(n<)-2.5 G(db)-2.5 E 2.5(.h>\). The) +-.4 F(follo)2.5 E(wing \214elds will be \214lled in:)-.25 E +(u_int32_t bt_magic;)133 609.6 Q +(Magic number that identi\214es the \214le as a btree \214le.)158 621.6 +Q(u_int32_t bt_v)133 633.6 Q(ersion;)-.15 E(The v)158 645.6 Q +(ersion of the btree \214le type.)-.15 E(u_int32_t bt_\215ags;)133 657.6 +Q 5.924(Permanent database \215ags, including DB_DUP)158 669.6 R 8.424 +(,D)-1.11 G 5.925(B_FIXEDLEN, DB_RECNUM and)-8.424 F(DB_RENUMBER.)158 +681.6 Q(u_int32_t bt_mink)133 693.6 Q -.15(ey)-.1 G(;).15 E(The)158 +705.6 Q F1(bt_mink)2.5 E -.3(ey)-.1 G F0 -.25(va)2.8 G +(lue speci\214ed to).25 E F1(db_open)2.5 E F0(\(3\), if an).24 E -.65 +(y.)-.15 G(May 3, 1998)280.585 768 Q(10)198.585 E EP +%%Page: 11 11 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 352.18(DB_OPEN\(3\) DB_OPEN\(3\))72 48 R +(u_int32_t bt_re_len;)133 84 Q(The)158 96 Q/F1 10/Times-Italic@0 SF -.37 +(re)2.5 G(_len).37 E F0 -.25(va)2.5 G(lue speci\214ed to).25 E F1 +(db_open)2.5 E F0(\(3\), if an).24 E -.65(y.)-.15 G +(u_int32_t bt_re_pad;)133 108 Q(The)158 120 Q F1 -.37(re)2.5 G(_pad).37 +E F0 -.25(va)2.5 G(lue speci\214ed to).25 E F1(db_open)2.5 E F0 +(\(3\), if an).24 E -.65(y.)-.15 G(u_int32_t bt_pagesize;)133 132 Q +(Underlying tree page size.)158 144 Q(u_int32_t bt_le)133 156 Q -.15(ve) +-.25 G(ls;).15 E(Number of le)158 168 Q -.15(ve)-.25 G(ls in the tree.) +.15 E(u_int32_t bt_nrecs;)133 180 Q .534(Number of data items in the tree \(since there may be multiple data items per k) +158 192 R -.15(ey)-.1 G 3.033(,t)-.5 G .533(his number)-3.033 F +(may not be the same as the number of k)158 204 Q -.15(ey)-.1 G(s\).).15 +E(u_int32_t bt_int_pg;)133 216 Q(Number of tree internal pages.)158 228 +Q(u_int32_t bt_leaf_pg;)133 240 Q(Number of tree leaf pages.)158 252 Q +(u_int32_t bt_dup_pg;)133 264 Q(Number of tree duplicate pages.)158 276 +Q(u_int32_t bt_o)133 288 Q -.15(ve)-.15 G(r_pg;).15 E(Number of tree o) +158 300 Q -.15(ve)-.15 G(r\215o).15 E 2.5(wp)-.25 G(ages.)-2.5 E +(u_int32_t bt_free;)133 312 Q(Number of pages on the free list.)158 324 +Q(u_int32_t bt_freed;)133 336 Q(Number of pages made a)158 348 Q -.25 +(va)-.2 G(ilable for reuse because the).25 E 2.5(yw)-.15 G(ere emptied.) +-2.5 E(u_int32_t bt_int_pgfree;)133 360 Q +(Number of bytes free in tree internal pages.)158 372 Q +(u_int32_t bt_leaf_pgfree;)133 384 Q +(Number of bytes free in tree leaf pages.)158 396 Q +(u_int32_t bt_dup_pgfree;)133 408 Q +(Number of bytes free in tree duplicate pages.)158 420 Q(u_int32_t bt_o) +133 432 Q -.15(ve)-.15 G(r_pgfree;).15 E(Number of bytes free in tree o) +158 444 Q -.15(ve)-.15 G(r\215o).15 E 2.5(wp)-.25 G(ages.)-2.5 E +(u_int32_t bt_pfxsa)133 456 Q -.15(ve)-.2 G(d;).15 E(Number of bytes sa) +158 468 Q -.15(ve)-.2 G 2.5(db).15 G 2.5(yp)-2.5 G(re\214x compression.) +-2.5 E(u_int32_t bt_split;)133 480 Q -.8(To)158 492 S +(tal number of tree page splits \(includes f).8 E +(ast and root splits\).)-.1 E(u_int32_t bt_rootsplit;)133 504 Q +(Number of root page splits.)158 516 Q(u_int32_t bt_f)133 528 Q +(astsplit;)-.1 E .458(Number of f)158 540 R .458(ast splits.)-.1 F .458 +(When sorted k)5.458 F -.15(ey)-.1 G 2.958(sa).15 G .458 +(re added to the database, the DB btree implementa-)-2.958 F 1.105 +(tion will split left or right to increase the page-\214ll f)158 552 R +(actor)-.1 E 6.105(.T)-.55 G 1.104(his number is a measure of ho)-6.105 +F(w)-.25 E(often it w)158 564 Q(as possible to mak)-.1 E 2.5(es)-.1 G +(uch a split.)-2.5 E(u_int32_t bt_added;)133 576 Q(Number of k)158 588 Q +-.15(ey)-.1 G 2.5(sa).15 G(dded.)-2.5 E(u_int32_t bt_deleted;)133 600 Q +(Number of k)158 612 Q -.15(ey)-.1 G 2.5(sd).15 G(eleted.)-2.5 E +(u_int32_t bt_get;)133 624 Q 2.273(Number of k)158 636 R -.15(ey)-.1 G +4.773(sr).15 G(etrie)-4.773 E -.15(ve)-.25 G 4.773(d. \(Note,).15 F +2.273(this v)4.773 F 2.274(alue will not re\215ect an)-.25 F 4.774(yk) +-.15 G -.15(ey)-4.874 G 4.774(sr).15 G(etrie)-4.774 E -.15(ve)-.25 G +4.774(dw).15 G 2.274(hen the)-4.774 F .221(database w)158 648 R .221(as open for read-only access, as there is no permanent location to store the informa-) +-.1 F(tion in this case.\))158 660 Q(u_int32_t bt_cache_hit;)133 672 Q +.898(Number of hits in tree f)158 684 R .899(ast-insert code.)-.1 F .899 +(When sorted k)5.899 F -.15(ey)-.1 G 3.399(sa).15 G .899 +(re added to the database, the DB)-3.399 F 1.617(btree implementation will check the last page where an insert occurred before doing a full) +158 696 R 2.5(lookup. This)158 708 R(number is a measure of ho)2.5 E 2.5 +(wo)-.25 G(ften the lookup w)-2.5 E(as successful.)-.1 E(May 3, 1998) +280.585 768 Q(11)198.585 E EP +%%Page: 12 12 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 352.18(DB_OPEN\(3\) DB_OPEN\(3\))72 48 R +(u_int32_t bt_cache_miss;)133 84 Q .051(Number of misses in tree f)158 +96 R .051(ast-insert code.)-.1 F .052 +(See the description of bt_cache_hit; this number is a)5.051 F +(measure of ho)158 108 Q 2.5(wo)-.25 G(ften the lookup f)-2.5 E(ailed.) +-.1 E/F1 9/Times-Bold@0 SF(ENVIR)72 124.8 Q(ONMENT V)-.27 E(ARIABLES) +-1.215 E F0(The follo)108 136.8 Q(wing en)-.25 E(vironment v)-.4 E +(ariables af)-.25 E(fect the e)-.25 E -.15(xe)-.15 G(cution of).15 E/F2 +10/Times-Italic@0 SF(db_open)2.5 E F0(:).24 E(DB_HOME)108 153.6 Q 3.072 +(If the)133 165.6 R F2(dben)5.572 E(v)-.4 E F0(ar)5.572 E 3.072 +(gument to)-.18 F F2(db_open)5.572 E F0 -.1(wa)5.572 G 5.572(si).1 G +3.072(nitialized using)-5.572 F F2(db_appinit)5.571 E F0 5.571(,t).68 G +3.071(he en)-5.571 F 3.071(vironment v)-.4 F(ariable)-.25 E .508(DB_HOME may be used as the path of the database home for the interpretation of the) +133 177.6 R F2(dir)3.009 E F0(ar)3.009 E(gument)-.18 E(to)133 189.6 Q F2 +(db_open)4.105 E F0 4.105(,a).24 G 4.104(sd)-4.105 G 1.604(escribed in) +-4.104 F F2(db_appinit)4.104 E F0 4.104(\(3\). Speci\214cally).68 F(,) +-.65 E F2(db_open)4.104 E F0 1.604(is af)4.104 F 1.604 +(fected by the con\214guration)-.25 F(string v)133 201.6 Q(alue of DB_D) +-.25 E -1.21 -1.11(AT A)-.4 H(_DIR.)1.11 E F1(EXAMPLES)72 218.4 Q F0 +.489(Applications that create short-li)108 230.4 R -.15(ve)-.25 G 2.989 +(dd).15 G .489 +(atabases that are discarded or recreated when the system f)-2.989 F .49 +(ails and are)-.1 F 1.96(unconcerned with concurrent access and loss of data due to catastrophic f) +108 242.4 R 1.96(ailure, may wish to use the)-.1 F F2(db_open)108 254.4 +Q F0 .198(functionality without other parts of the DB library)2.698 F +5.198(.S)-.65 G .198(uch applications will only be concerned with)-5.198 +F .435(the DB access methods.)108 266.4 R .435 +(The DB access methods will use the memory pool subsystem, b)5.435 F +.435(ut the application)-.2 F .434(is unlik)108 278.4 R .434 +(ely to be a)-.1 F -.1(wa)-.15 G .434(re of this.).1 F .434 +(See the \214les)5.434 F F2 -.2(ex)2.934 G(ample/e).2 E(x_access.c)-.2 E +F0(and)2.935 E F2 -.2(ex)2.935 G(ample/e).2 E(x_btr)-.2 E(ec.c)-.37 E F0 +.435(in the DB source)2.935 F(distrib)108 290.4 Q +(ution for C language code e)-.2 E(xamples of ho)-.15 E 2.5(ws)-.25 G +(uch applications might use the DB library)-2.5 E(.)-.65 E F1(ERR)72 +307.2 Q(ORS)-.27 E F0(The)108 319.2 Q F2(db_open)3.415 E F0 .915 +(function may f)3.415 F .915(ail and return)-.1 F F2(errno)3.415 E F0 +.915(for an)3.415 F 3.415(yo)-.15 G 3.415(ft)-3.415 G .915 +(he errors speci\214ed for the follo)-3.415 F .915(wing DB and)-.25 F(library functions: DB->sync\(3\), calloc\(3\), close\(2\), fcntl\(2\), f) +108 331.2 Q(\215ush\(3\), lock_get\(3\), lock_id\(3\), lock_put\(3\),) +-.25 E(lock_v)108 343.2 Q(ec\(3\), log_put\(3\), log_re)-.15 E +(gister\(3\), log_unre)-.15 E(gister\(3\), malloc\(3\), memcp)-.15 E +(y\(3\), memmo)-.1 E -.15(ve)-.15 G(\(3\),).15 E(memp_close\(3\), memp_fclose\(3\), memp_fget\(3\), memp_fopen\(3\), memp_fput\(3\), memp_fset\(3\),) +108 355.2 Q(memp_fsync\(3\), memp_open\(3\), memp_re)108 367.2 Q(gister\(3\), memset\(3\), mmap\(2\), munmap\(2\), open\(2\), read\(2\),) +-.15 E +(realloc\(3\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp)108 +379.2 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), time\(3\), and) +-.1 E(unlink\(2\).)108 391.2 Q(In addition, the)108 408 Q F2(db_open)2.5 +E F0(function may f)2.5 E(ail and return)-.1 E F2(errno)2.5 E F0 +(for the follo)2.5 E(wing conditions:)-.25 E([EA)108 424.8 Q(GAIN])-.4 E +2.5(Al)133 436.8 S(ock w)-2.5 E(as una)-.1 E -.25(va)-.2 G(ilable.).25 E +([EINV)108 453.6 Q(AL])-1.35 E .446(An in)133 465.6 R -.25(va)-.4 G .446 +(lid \215ag v).25 F .446(alue or parameter w)-.25 F .445 +(as speci\214ed \(e.g., unkno)-.1 F .445 +(wn database type, page size, hash func-)-.25 F .222 +(tion, recno pad byte, byte order\) or a \215ag v)133 477.6 R .222 +(alue or parameter that is incompatible with the current)-.25 F F2 +(\214le)2.723 E F0(speci\214cation.)133 489.6 Q(The DB_THREAD \215ag w) +133 513.6 Q(as speci\214ed and spinlocks are not implemented for this architecture.) +-.1 E(There is a mismatch between the v)133 537.6 Q(ersion number of) +-.15 E F2(\214le)2.5 E F0(and the softw)2.5 E(are.)-.1 E(A)133 561.6 Q +F2 -.37(re)2.889 G(_sour).37 E(ce)-.37 E F0 .389(\214le w)2.889 F .389 +(as speci\214ed with either the DB_THREAD \215ag or a non-NULL)-.1 F F2 +(tx_info)2.888 E F0 .388(\214eld in the)2.888 F(DB_ENV ar)133 573.6 Q +(gument to db_open.)-.18 E([ENOENT])108 590.4 Q 2.5(An)133 602.4 S(on-e) +-2.5 E(xistent)-.15 E F2 -.37(re)2.5 G(_sour).37 E(ce)-.37 E F0 +(\214le w)2.5 E(as speci\214ed.)-.1 E([EPERM])108 619.2 Q .577 +(Database corruption w)133 631.2 R .577(as detected.)-.1 F .578 +(All subsequent database calls \(other than)5.577 F F2(DB->close)3.078 E +F0 3.078(\)w).18 G .578(ill return)-3.078 F(EPERM.)133 643.2 Q(The)108 +660 Q F2(DB->close)2.887 E F0 .386(function may f)2.887 F .386 +(ail and return)-.1 F F2(errno)2.886 E F0 .386(for an)2.886 F 2.886(yo) +-.15 G 2.886(ft)-2.886 G .386(he errors speci\214ed for the follo)-2.886 +F .386(wing DB and)-.25 F +(library functions: DB->sync\(3\), calloc\(3\), close\(2\), f)108 672 Q +(\215ush\(3\), lock_get\(3\), lock_put\(3\), lock_v)-.25 E(ec\(3\),)-.15 +E(log_put\(3\), log_unre)108 684 Q(gister\(3\), malloc\(3\), memcp)-.15 +E(y\(3\), memmo)-.1 E -.15(ve)-.15 G +(\(3\), memp_close\(3\), memp_fclose\(3\),).15 E(memp_fget\(3\), memp_fput\(3\), memp_fset\(3\), memp_fsync\(3\), memset\(3\), munmap\(2\), realloc\(3\), and str) +108 696 Q(-)-.2 E(error\(3\).)108 708 Q(The)108 724.8 Q F2(DB->cur)2.583 +E(sor)-.1 E F0 .083(function may f)2.583 F .083(ail and return)-.1 F F2 +(errno)2.583 E F0 .083(for an)2.583 F 2.583(yo)-.15 G 2.583(ft)-2.583 G +.083(he errors speci\214ed for the follo)-2.583 F .082(wing DB and)-.25 +F(May 3, 1998)280.585 768 Q(12)198.585 E EP +%%Page: 13 13 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 352.18(DB_OPEN\(3\) DB_OPEN\(3\))72 48 R +(library functions: calloc\(3\).)108 84 Q(In addition, the)108 100.8 Q +/F1 10/Times-Italic@0 SF(DB->cur)2.5 E(sor)-.1 E F0(function may f)2.5 E +(ail and return)-.1 E F1(errno)2.5 E F0(for the follo)2.5 E +(wing conditions:)-.25 E([EINV)108 117.6 Q(AL])-1.35 E(An in)133 129.6 Q +-.25(va)-.4 G(lid \215ag v).25 E(alue or parameter w)-.25 E +(as speci\214ed.)-.1 E([EPERM])108 146.4 Q .577(Database corruption w) +133 158.4 R .577(as detected.)-.1 F .578 +(All subsequent database calls \(other than)5.577 F F1(DB->close)3.078 E +F0 3.078(\)w).18 G .578(ill return)-3.078 F(EPERM.)133 170.4 Q(The)108 +187.2 Q F1(DB->del)3.349 E F0 .849(function may f)3.349 F .849 +(ail and return)-.1 F F1(errno)3.349 E F0 .849(for an)3.349 F 3.349(yo) +-.15 G 3.349(ft)-3.349 G .849(he errors speci\214ed for the follo)-3.349 +F .848(wing DB and)-.25 F(library functions: calloc\(3\), fcntl\(2\), f) +108 199.2 Q +(\215ush\(3\), lock_get\(3\), lock_id\(3\), lock_put\(3\), lock_v)-.25 E +(ec\(3\),)-.15 E(log_put\(3\), malloc\(3\), memcmp\(3\), memcp)108 211.2 +Q(y\(3\), memmo)-.1 E -.15(ve)-.15 G +(\(3\), memp_fget\(3\), memp_fput\(3\),).15 E +(memp_fset\(3\), memset\(3\), realloc\(3\), and strerror\(3\).)108 223.2 +Q(In addition, the)108 240 Q F1(DB->del)2.5 E F0(function may f)2.5 E +(ail and return)-.1 E F1(errno)2.5 E F0(for the follo)2.5 E +(wing conditions:)-.25 E([EA)108 256.8 Q(GAIN])-.4 E 2.5(Al)133 268.8 S +(ock w)-2.5 E(as una)-.1 E -.25(va)-.2 G(ilable.).25 E([EINV)108 285.6 Q +(AL])-1.35 E(An in)133 297.6 Q -.25(va)-.4 G(lid \215ag v).25 E +(alue or parameter w)-.25 E(as speci\214ed.)-.1 E([EPERM])108 314.4 Q +.577(Database corruption w)133 326.4 R .577(as detected.)-.1 F .578 +(All subsequent database calls \(other than)5.577 F F1(DB->close)3.078 E +F0 3.078(\)w).18 G .578(ill return)-3.078 F(EPERM.)133 338.4 Q +(In addition, the)108 355.2 Q F1(DB->fd)2.5 E F0(function may f)2.5 E +(ail and return)-.1 E F1(errno)2.5 E F0(for the follo)2.5 E +(wing conditions:)-.25 E([ENOENT])108 372 Q(The)133 384 Q F1(DB->fd)3.17 +E F0 .67(function w)3.17 F .67(as called for an in-memory database, or no underlying \214le has yet been cre-) +-.1 F(ated.)133 396 Q([EPERM])108 412.8 Q .577(Database corruption w)133 +424.8 R .577(as detected.)-.1 F .578 +(All subsequent database calls \(other than)5.577 F F1(DB->close)3.078 E +F0 3.078(\)w).18 G .578(ill return)-3.078 F(EPERM.)133 436.8 Q(The)108 +453.6 Q F1(DB->g)3.355 E(et)-.1 E F0 .855(function may f)3.355 F .855 +(ail and return)-.1 F F1(errno)3.355 E F0 .854(for an)3.355 F 3.354(yo) +-.15 G 3.354(ft)-3.354 G .854(he errors speci\214ed for the follo)-3.354 +F .854(wing DB and)-.25 F(library functions: DBcursor)108 465.6 Q +(->c_get\(3\), calloc\(3\), fcntl\(2\), f)-.2 E +(\215ush\(3\), lock_get\(3\), lock_id\(3\), lock_put\(3\),)-.25 E +(lock_v)108 477.6 Q +(ec\(3\), log_put\(3\), malloc\(3\), memcmp\(3\), memcp)-.15 E +(y\(3\), memmo)-.1 E -.15(ve)-.15 G +(\(3\), memp_fget\(3\), memp_fput\(3\),).15 E +(memp_fset\(3\), memset\(3\), realloc\(3\), and strerror\(3\).)108 489.6 +Q(In addition, the)108 506.4 Q F1(DB->g)2.5 E(et)-.1 E F0 +(function may f)2.5 E(ail and return)-.1 E F1(errno)2.5 E F0 +(for the follo)2.5 E(wing conditions:)-.25 E([EA)108 523.2 Q(GAIN])-.4 E +2.5(Al)133 535.2 S(ock w)-2.5 E(as una)-.1 E -.25(va)-.2 G(ilable.).25 E +([EINV)108 552 Q(AL])-1.35 E(An in)133 564 Q -.25(va)-.4 G(lid \215ag v) +.25 E(alue or parameter w)-.25 E(as speci\214ed.)-.1 E 1.039 +(The DB_THREAD \215ag w)133 588 R 1.039(as speci\214ed to the)-.1 F F1 +(db_open)3.539 E F0 1.039(\(3\) function and neither the DB_DBT_MAL-).24 +F(LOC or DB_DBT_USERMEM \215ags were set in the DBT)133 600 Q(.)-.74 E +2.5(Ar)133 624 S(ecord number of 0 w)-2.5 E(as speci\214ed.)-.1 E +([EPERM])108 640.8 Q .578(Database corruption w)133 652.8 R .578 +(as detected.)-.1 F .577(All subsequent database calls \(other than) +5.578 F F1(DB->close)3.077 E F0 3.077(\)w).18 G .577(ill return)-3.077 F +(EPERM.)133 664.8 Q(The)108 681.6 Q F1(DB->put)3.317 E F0 .817 +(function may f)3.317 F .818(ail and return)-.1 F F1(errno)3.318 E F0 +.818(for an)3.318 F 3.318(yo)-.15 G 3.318(ft)-3.318 G .818 +(he errors speci\214ed for the follo)-3.318 F .818(wing DB and)-.25 F +(library functions: calloc\(3\), fcntl\(2\), f)108 693.6 Q +(\215ush\(3\), lock_get\(3\), lock_id\(3\), lock_put\(3\), lock_v)-.25 E +(ec\(3\),)-.15 E(log_put\(3\), malloc\(3\), memcmp\(3\), memcp)108 705.6 +Q(y\(3\), memmo)-.1 E -.15(ve)-.15 G +(\(3\), memp_fget\(3\), memp_fput\(3\),).15 E +(memp_fset\(3\), memset\(3\), realloc\(3\), and strerror\(3\).)108 717.6 +Q(May 3, 1998)280.585 768 Q(13)198.585 E EP +%%Page: 14 14 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 352.18(DB_OPEN\(3\) DB_OPEN\(3\))72 48 R +(In addition, the)108 84 Q/F1 10/Times-Italic@0 SF(DB->put)2.5 E F0 +(function may f)2.5 E(ail and return)-.1 E F1(errno)2.5 E F0 +(for the follo)2.5 E(wing conditions:)-.25 E([EA)108 100.8 Q(CCES])-.4 E +(An attempt w)133 112.8 Q(as made to modify a read-only database.)-.1 E +([EA)108 129.6 Q(GAIN])-.4 E 2.5(Al)133 141.6 S(ock w)-2.5 E(as una)-.1 +E -.25(va)-.2 G(ilable.).25 E([EINV)108 158.4 Q(AL])-1.35 E(An in)133 +170.4 Q -.25(va)-.4 G(lid \215ag v).25 E(alue or parameter w)-.25 E +(as speci\214ed.)-.1 E 2.5(Ar)133 194.4 S(ecord number of 0 w)-2.5 E +(as speci\214ed.)-.1 E(An attempt w)133 218.4 Q +(as made to add a record to a \214x)-.1 E(ed-length database that w)-.15 +E(as too lar)-.1 E(ge to \214t.)-.18 E(An attempt w)133 242.4 Q +(as made to do a partial put.)-.1 E([EPERM])108 259.2 Q .578 +(Database corruption w)133 271.2 R .578(as detected.)-.1 F .577 +(All subsequent database calls \(other than)5.578 F F1(DB->close)3.077 E +F0 3.077(\)w).18 G .577(ill return)-3.077 F(EPERM.)133 283.2 Q([ENOSPC]) +108 300 Q 2.5(Ab)133 312 S(tree e)-2.5 E +(xceeded the maximum btree depth \(255\).)-.15 E(The)108 328.8 Q F1 +(DB->stat)3.225 E F0 .725(function may f)3.225 F .725(ail and return)-.1 +F F1(errno)3.225 E F0 .725(for an)3.225 F 3.225(yo)-.15 G 3.225(ft) +-3.225 G .725(he errors speci\214ed for the follo)-3.225 F .725 +(wing DB and)-.25 F(library functions: calloc\(3\), fcntl\(2\), f)108 +340.8 Q +(\215ush\(3\), lock_get\(3\), lock_id\(3\), lock_put\(3\), lock_v)-.25 E +(ec\(3\), malloc\(3\),)-.15 E(memcp)108 352.8 Q +(y\(3\), memp_fget\(3\), memp_fput\(3\), and memset\(3\).)-.1 E(The)108 +369.6 Q F1(DB->sync)3.04 E F0 .54(function may f)3.04 F .54 +(ail and return)-.1 F F1(errno)3.04 E F0 .541(for an)3.04 F 3.041(yo) +-.15 G 3.041(ft)-3.041 G .541(he errors speci\214ed for the follo)-3.041 +F .541(wing DB and)-.25 F(library functions: DB->get\(3\), DB->sync\(3\), calloc\(3\), close\(2\), fcntl\(2\), f) +108 381.6 Q(\215ush\(3\), lock_get\(3\), lock_id\(3\),)-.25 E +(lock_put\(3\), lock_v)108 393.6 Q +(ec\(3\), log_put\(3\), malloc\(3\), memcp)-.15 E(y\(3\), memmo)-.1 E +-.15(ve)-.15 G(\(3\), memp_fget\(3\), memp_fput\(3\),).15 E(memp_fset\(3\), memp_fsync\(3\), memset\(3\), munmap\(2\), open\(2\), realloc\(3\), strerror\(3\), unlink\(2\), and) +108 405.6 Q(write\(2\).)108 417.6 Q(In addition, the)108 434.4 Q F1 +(DB->sync)2.5 E F0(function may f)2.5 E(ail and return)-.1 E F1(errno) +2.5 E F0(for the follo)2.5 E(wing conditions:)-.25 E([EINV)108 451.2 Q +(AL])-1.35 E(An in)133 463.2 Q -.25(va)-.4 G(lid \215ag v).25 E +(alue or parameter w)-.25 E(as speci\214ed.)-.1 E([EPERM])108 480 Q .577 +(Database corruption w)133 492 R .577(as detected.)-.1 F .578 +(All subsequent database calls \(other than)5.577 F F1(DB->close)3.078 E +F0 3.078(\)w).18 G .578(ill return)-3.078 F(EPERM.)133 504 Q/F2 9 +/Times-Bold@0 SF(SEE ALSO)72 520.8 Q F1(The Ubiquitous B-tr)108 532.8 Q +(ee)-.37 E F0 2.5(,D).18 G(ouglas Comer)-2.5 E 2.5(,A)-.4 G +(CM Comput. Surv)-2.9 E 2.5(.1)-.65 G(1, 2 \(June 1979\), 121-138.)-2.5 +E F1(Pr)108 556.8 Q 1.588(e\214x B-tr)-.37 F(ees)-.37 E F0 4.088(,B).27 +G 1.587(ayer and Unterauer)-4.088 F 4.087(,A)-.4 G 1.587(CM T)-4.487 F +1.587(ransactions on Database Systems, V)-.35 F 1.587 +(ol. 2, 1 \(March 1977\),)-1.29 F(11-26.)108 568.8 Q F1 +(The Art of Computer Pr)108 592.8 Q -.1(og)-.45 G -.15(ra).1 G(mming V) +.15 E(ol. 3: Sorting and Sear)-1.11 E -.15(ch)-.37 G(ing).15 E F0 2.5 +(,D).22 G(.E. Knuth, 1968, pp 471-480.)-2.5 E F1(Dynamic Hash T)108 +616.8 Q(ables)-.92 E F0 2.5(,P).27 G(er)-2.5 E(-Ak)-.2 E 2.5(eL)-.1 G +(arson, Communications of the A)-2.5 E(CM, April 1988.)-.4 E F1 2.5(AN) +108 640.8 S .3 -.15(ew H)-2.5 H(ash P).15 E(ac)-.8 E(ka)-.2 E .2 -.1 +(ge f)-.1 H(or UNIX).1 E F0 2.5(,M).94 G(ar)-2.5 E(go Seltzer)-.18 E 2.5 +(,U)-.4 G(SENIX Proceedings, W)-2.5 E(inter 1991.)-.4 E F1 2.754 +(Document Pr)108 664.8 R 2.754(ocessing in a Relational Database System) +-.45 F F0 5.255(,M).32 G 2.755(ichael Stonebrak)-5.255 F(er)-.1 E 5.255 +(,H)-.4 G 2.755(eidi Stettner)-5.255 F 5.255(,J)-.4 G(oseph)-5.255 E +(Kalash, Antonin Guttman, Nadene L)108 676.8 Q +(ynn, Memorandum No. UCB/ERL M82/32, May 1982.)-.55 E F1(db_ar)108 700.8 +Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E F1(db_c)2.5 E(hec)-.15 E +(kpoint)-.2 E F0(\(1\),).68 E F1(db_deadloc)2.5 E(k)-.2 E F0(\(1\),).67 +E F1(db_dump)2.5 E F0(\(1\),).19 E F1(db_load)2.5 E F0(\(1\),).77 E F1 +(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F1(db_stat)2.5 E F0 +(\(1\),).68 E F1(db_intr)108 712.8 Q(o)-.45 E F0(\(3\),).18 E F1 +(db_appinit)2.5 E F0(\(3\),).68 E F1(db_cur)2.5 E(sor)-.1 E F0(\(3\),) +.73 E F1(db_dbm)2.5 E F0(\(3\),).32 E F1(db_internal)2.5 E F0(\(3\),).51 +E F1(db_loc)2.5 E(k)-.2 E F0(\(3\),).67 E F1(db_lo)2.5 E(g)-.1 E F0 +(\(3\),).22 E F1(db_mpool)2.5 E F0(\(3\),).51 E F1(db_open)108 724.8 Q +F0(\(3\),).24 E F1(db_thr)2.5 E(ead)-.37 E F0(\(3\),).77 E F1(db_txn)2.5 +E F0(\(3\)).24 E(May 3, 1998)280.585 768 Q(14)198.585 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/man.ps/db_recover.ps b/mozilla/db/man/man.ps/db_recover.ps new file mode 100644 index 00000000000..e8a4e20551a --- /dev/null +++ b/mozilla/db/man/man.ps/db_recover.ps @@ -0,0 +1,401 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:19 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 2 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_reco)108 40.8 Q -.15(ve)-.15 G 2.5(r\255t).15 G(he DB database reco) +-2.5 E -.15(ve)-.15 G(ry utility).15 E F0(SYNOPSIS)72 57.6 Q/F2 10 +/Times-Bold@0 SF(db_r)108 69.6 Q(eco)-.18 E -.1(ve)-.1 G(r).1 E F1([)2.5 +E F2(-cv)A F1 2.5(][)C F2(-h home)-2.5 E F1(])A F0(DESCRIPTION)72 86.4 Q +F1(The)108 98.4 Q/F3 10/Times-Italic@0 SF(db_r)3.717 E(eco)-.37 E(ver) +-.1 E F1 1.216(utility must be run after an une)3.717 F 1.216 +(xpected application, DB, or system f)-.15 F 1.216 +(ailure to restore the)-.1 F 1.175(database to a consistent state.)108 +110.4 R 1.176(All committed transactions are guaranteed to appear after) +6.176 F F3(db_r)3.676 E(eco)-.37 E(ver)-.1 E F1(has)3.676 E +(run, and all uncommitted transactions will be completely undone.)108 +122.4 Q(The options are as follo)108 139.2 Q(ws:)-.25 E F2108 156 +Q F1 -.15(Fa)14.86 G(ilure w).15 E(as catastrophic.)-.1 E F2108 +172.8 Q F1(Specify a home directory for the database.)13.74 E F2 +108 189.6 Q F1(Run in v)14.3 E(erbose mode.)-.15 E 1.092 +(In the case of catastrophic f)108 206.4 R 1.091(ailure, an archi)-.1 F +-.25(va)-.25 G 3.591(lc).25 G(op)-3.591 E 2.391 -.65(y, o)-.1 H 3.591 +(r`).65 G(`snapshot')-4.331 E 3.591('o)-.74 G 3.591(fa)-3.591 G 1.091 +(ll database \214les must be restored)-3.591 F .038(along with all of the log \214les written since the database \214le snapshot w) +108 218.4 R .039(as made.)-.1 F .039(\(If disk space is a problem,)5.039 +F 1(log \214les may be referenced by symbolic links\).)108 230.4 R -.15 +(Fo)6 G 3.5(rf).15 G 1 +(urther information on creating a database snapshot,)-3.5 F(see `)108 +242.4 Q(`DB ARCHIV)-.74 E(AL PR)-1.35 E(OCEDURES')-.4 E 2.5('i)-.74 G(n) +-2.5 E F3(db_ar)2.5 E -.15(ch)-.37 G(ive).15 E F1(\(1\).).18 E .294 +(If the f)108 259.2 R .294(ailure w)-.1 F .294(as not catastrophic, the \214les present on the system at the time of f) +-.1 F .295(ailure are suf)-.1 F .295(\214cient to per)-.25 F(-)-.2 E +(form reco)108 271.2 Q -.15(ve)-.15 G(ry).15 E(.)-.65 E .608 +(If log \214les are missing,)108 288 R F3(db_r)3.107 E(eco)-.37 E(ver) +-.1 E F1 .607(will identify the missing log \214le\(s\) and f)3.107 F +.607(ail, in which case the missing)-.1 F +(log \214les need to be restored and reco)108 300 Q -.15(ve)-.15 G +(ry performed ag).15 E(ain.)-.05 E(The)108 316.8 Q F3(db_r)4.382 E(eco) +-.37 E(ver)-.1 E F1 1.882(utility attaches to DB shared memory re)4.382 +F 4.382(gions. In)-.15 F 1.882(order to a)4.382 F -.2(vo)-.2 G 1.882 +(id re).2 F 1.882(gion corruption, it)-.15 F 1.246(should al)108 328.8 R +-.1(wa)-.1 G 1.246(ys be gi).1 F -.15(ve)-.25 G 3.746(nt).15 G 1.245 +(he chance to detach and e)-3.746 F 1.245(xit gracefully)-.15 F 6.245 +(.T)-.65 G 3.745(oc)-7.045 G(ause)-3.745 E F3(db_r)3.745 E(eco)-.37 E +(ver)-.1 E F1 1.245(to clean up after)3.745 F(itself and e)108 340.8 Q +(xit, send it an interrupt signal \(SIGINT\).)-.15 E(The)108 357.6 Q F3 +(db_r)2.5 E(eco)-.37 E(ver)-.1 E F1(utility e)2.5 E +(xits 0 on success, and >0 if an error occurs.)-.15 E F0 +(FILESYSTEM OPERA)72 374.4 Q(TIONS)-.855 E F2 .59 +(Filesystem operations, e.g)108 386.4 R .59(., mo)-.15 F .591 +(ving the database en)-.1 F(vir)-.4 E .591(onment to a differ)-.18 F +.591(ent machine or \214le cr)-.18 F(eation,)-.18 E 1.39(deletion or r) +108 398.4 R 1.389(enaming, cannot be transaction pr)-.18 F(otected.)-.18 +E F1 -.15(Fo)6.389 G 3.889(rt).15 G 1.389(his reason,)-3.889 F F3(db_r) +3.889 E(eco)-.37 E(ver)-.1 E F1 1.389(cannot re-create,)3.889 F +(delete or rename \214les as part of reco)108 410.4 Q -.15(ve)-.15 G(ry) +.15 E(.)-.65 E(If)108 427.2 Q F3(db_r)2.907 E(eco)-.37 E(ver)-.1 E F1 +.408(cannot \214nd a database \214le referenced in the log, it will output a w) +2.907 F .408(arning message that it w)-.1 F(as)-.1 E .008 +(unable to locate a \214le it e)108 439.2 R .008(xpected to \214nd.)-.15 +F .007(This message is only a w)5.008 F .007 +(arning, as the \214le may ha)-.1 F .307 -.15(ve s)-.2 H(ubsequently).15 +E 1.866(been deleted as part of normal database operations before the f) +108 451.2 R 1.866(ailure occurred.)-.1 F F2 1.866(Note that committed) +6.866 F .168(transactions that in)108 463.2 R -.1(vo)-.4 G(lv).1 E .168 +(ed these missing \214les ar)-.1 F 2.667(er)-.18 G .167(olled f)-2.847 F +.167(orward, e)-.25 F -.1(ve)-.15 G 2.667(nt).1 G .167 +(hough the \214les wer)-2.667 F 2.667(en)-.18 G .167(ot f)-2.667 F +(ound.)-.25 E .288(If the \214les wer)108 475.2 R 2.788(en)-.18 G .288 +(ot intentionally deleted \(e.g)-2.788 F .288(., they wer)-.15 F 2.788 +(ec)-.18 G -.18(re)-2.788 G .288 +(ated after the last database snapshot, b).18 F(ut)-.2 E(wer)108 487.2 Q +2.744(el)-.18 G .244(ost during a failur)-2.744 F .243 +(e\), they must be manually cr)-.18 F .243(eated \(using)-.18 F F3 +(db_open)2.743 E F1 .243(\(3\)\), and).24 F F3(db_r)2.743 E(eco)-.37 E +(ver)-.1 E F1 .243(must be)2.743 F(rerun.)108 499.2 Q(Generally)108 516 +Q 3.932(,i)-.65 G 3.932(ti)-3.932 G 3.932(ss)-3.932 G 1.432(implest to perform \214lesystem operations at the same time as making a snapshot of the) +-3.932 F 2.5(database. T)108 528 R 2.5(op)-.8 G +(erform \214lesystem operations:)-2.5 E 15(1. Cleanly)144 544.8 R +(shutdo)2.5 E(wn database operations.)-.25 E 15(2. Rename,)144 556.8 R +(create or delete \214les.)2.5 E 15(3. Mak)144 568.8 R 2.5(eas)-.1 G +(napshot of the database.)-2.5 E 15(4. Restart)144 580.8 R +(database applications.)2.5 E 1.657 -.8(To c)108 597.6 T .057 +(leanly shutdo).8 F .057 +(wn database operations, all applications accessing the database en)-.25 +F .057(vironment must be shut-)-.4 F(do)108 609.6 Q 3.173(wn. If)-.25 F +.673(the applications are not implemented such that the)3.173 F 3.173 +(yc)-.15 G .673(an be shutdo)-3.173 F .673 +(wn gracefully \(i.e., closing all)-.25 F .74 +(references to the database en)108 621.6 R(vironment\),)-.4 E F3(db_r) +3.24 E(eco)-.37 E(ver)-.1 E F1 .74 +(must be run after all applications ha)3.24 F 1.04 -.15(ve b)-.2 H .74 +(een killed to).15 F(ensure that the underlying database is consistent and \215ushed to disk.) +108 633.6 Q F0(RECO)72 650.4 Q(VER)-.45 E(Y)-.315 E F1 .028 +(After an application or system f)108 662.4 R .029(ailure, there are tw) +-.1 F 2.529(op)-.1 G .029(ossible approaches to database reco)-2.529 F +-.15(ve)-.15 G(ry).15 E 5.029(.I)-.65 G 2.529(ft)-5.029 G .029 +(here is no)-2.529 F .919(need to retain state across the f)108 674.4 R +.919(ailure, and all databases can be started ane)-.1 F 2.219 -.65(w, t) +-.25 H .918(he database home directory).65 F .964(can simply be remo)108 +686.4 R -.15(ve)-.15 G 3.464(da).15 G .964(nd recreated.)-3.464 F .964 +(If it is necessary to retain persistent state across f)5.964 F .965 +(ailures, then the)-.1 F F3(db_r)108 698.4 Q(eco)-.37 E(ver)-.1 E F1 +.874(\(1\) utility should be run for each DB application en).73 F .873 +(vironment, i.e., each database home direc-)-.4 F(tory)108 710.4 Q(.) +-.65 E(The)108 727.2 Q F3(db_r)3.115 E(eco)-.37 E(ver)-.1 E F1 .615 +(utility will remo)3.115 F .915 -.15(ve a)-.15 H .616(ll the shared re) +.15 F .616(gions \(which may ha)-.15 F .916 -.15(ve b)-.2 H .616 +(een corrupted by the f).15 F(ailure\),)-.1 E(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DB_RECO)72 48 Q 312.06(VER\(1\) DB_RECO)-.5 F +(VER\(1\))-.5 E .839(establish the end of the log by identifying the last record written to the log, and then perform transaction) +108 84 R(reco)108 96 Q -.15(ve)-.15 G(ry).15 E 5.476(.D)-.65 G .477 +(atabase applications must not be restarted until reco)-5.476 F -.15(ve) +-.15 G .477(ry completes.).15 F .477(During transaction reco)5.477 F(v-) +-.15 E(ery)108 108 Q 3.016(,a)-.65 G .516(ll changes made by aborted transactions are undone and all changes made by committed transactions) +-3.016 F .92(are redone, as necessary)108 120 R 5.92(.A)-.65 G .921 +(fter reco)-5.92 F -.15(ve)-.15 G .921(ry runs, the en).15 F .921 +(vironment is properly initialized so that applications)-.4 F 1.089 +(may be restarted.)108 132 R(An)6.089 E 3.589(yt)-.15 G 1.088 +(ime an application crashes or the system f)-3.589 F(ails,)-.1 E/F1 10 +/Times-Italic@0 SF(db_r)3.588 E(eco)-.37 E(ver)-.1 E F0 1.088 +(should be run on an)3.588 F(y)-.15 E -.15(ex)108 144 S +(iting database en).15 E(vironments.)-.4 E(Additionally)108 160.8 Q +2.597(,t)-.65 G .097(here are tw)-2.597 F 2.598(of)-.1 G .098 +(orms of reco)-2.598 F -.15(ve)-.15 G .098(ry: normal reco).15 F -.15 +(ve)-.15 G .098(ry and catastrophic reco).15 F -.15(ve)-.15 G(ry).15 E +5.098(.T)-.65 G .098(he DB package)-5.098 F .682 +(de\214nes catastrophic f)108 172.8 R .681(ailure to be f)-.1 F .681 +(ailure where either the database or log \214les ha)-.1 F .981 -.15 +(ve b)-.2 H .681(een destro).15 F .681(yed or cor)-.1 F(-)-.2 E .57 +(rupted from the point of vie)108 184.8 R 3.07(wo)-.25 G 3.07(ft)-3.07 G +.57(he \214lesystem.)-3.07 F -.15(Fo)5.57 G 3.07(re).15 G .57 +(xample, catastrophic f)-3.22 F .57(ailure includes the case where)-.1 F +.788(the disk dri)108 196.8 R 1.088 -.15(ve o)-.25 H 3.288(nw).15 G .788 +(hich either the database or logs are stored has crashed, or when \214lesystem reco) +-3.288 F -.15(ve)-.15 G .787(ry is).15 F .107(unable to bring the database and log \214les to a consistent state with respect to the \214lesystem.) +108 208.8 R .108(If the f)5.108 F .108(ailure is)-.1 F .944(non-catastrophic, i.e., the database \214les and log are accessible on a \214lesystem that has reco) +108 220.8 R -.15(ve)-.15 G .944(red cleanly).15 F(,)-.65 E F1(db_r)108 +232.8 Q(eco)-.37 E(ver)-.1 E F0 .294(will re)2.794 F(vie)-.25 E 2.794 +(wt)-.25 G .294(he logs and database \214les to ensure that all committed transactions appear and that) +-2.794 F .432(all uncommitted transactions are undone.)108 244.8 R .431 +(If the f)5.431 F .431 +(ailure is catastrophic, a snapshot of the database \214les and)-.1 F +.251(the archi)108 256.8 R -.15(ve)-.25 G 2.751(dl).15 G .251 +(og \214les must be restored onto the system.)-2.751 F(Then)5.251 E F1 +(db_r)2.751 E(eco)-.37 E(ver)-.1 E F0 .251(will re)2.751 F(vie)-.25 E +2.751(wt)-.25 G .252(he logs and database)-2.751 F .345(\214les to bring the database to a consistent state as of the date of the last archi) +108 268.8 R -.15(ve)-.25 G 2.845(dl).15 G .345(og \214le.)-2.845 F .345 +(Only transactions)5.345 F .71 +(committed before that date will appear in the database.)108 280.8 R +(See)5.711 E F1(db_ar)3.211 E -.15(ch)-.37 G .711(ive \(1\)).15 F F0 +.711(for speci\214c information about)3.211 F(archi)108 292.8 Q +(ving and reco)-.25 E -.15(ve)-.15 G +(ring databases after catastrophic f).15 E(ailure.)-.1 E/F2 9 +/Times-Bold@0 SF(ENVIR)72 314.4 Q(ONMENT V)-.27 E(ARIABLES)-1.215 E F0 +(The follo)108 326.4 Q(wing en)-.25 E(vironment v)-.4 E(ariables af)-.25 +E(fect the e)-.25 E -.15(xe)-.15 G(cution of).15 E F1(db_r)2.5 E(eco) +-.37 E(ver)-.1 E F0(:).73 E(DB_HOME)108 343.2 Q .222(If the)133 355.2 R +/F3 10/Times-Bold@0 SF2.722 E F0 .222 +(option is not speci\214ed and the en)2.722 F .222(vironment v)-.4 F +(ariable)-.25 E F1(DB_HOME)2.722 E F0 .221 +(is set, it is used as the path)2.721 F +(of the database home, as described in)133 367.2 Q F1(db_appinit)2.5 E +F0(\(3\).).68 E F2 -.09(BU)72 384 S(GS).09 E F0 .723(Future v)108 396 R +.723(ersions of DB are e)-.15 F .723(xpected to remo)-.15 F 1.023 -.15 +(ve t)-.15 H .723 +(he restriction that database \214les must be manually created).15 F +(before reco)108 408 Q -.15(ve)-.15 G(ry is performed.).15 E F2 +(SEE ALSO)72 424.8 Q F0 .486(The DB library is a f)108 436.8 R .485 +(amily of groups of functions that pro)-.1 F .485 +(vides a modular programming interf)-.15 F .485(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 448.8 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .507(\214le page caching, as well as v)108 460.8 R .507 +(arious inde)-.25 F -.15(xe)-.15 G 3.007(da).15 G .506(ccess methods.) +-3.007 F(Man)5.506 E 3.006(yo)-.15 G 3.006(ft)-3.006 G .506 +(he functional groups \(e.g., the \214le)-3.006 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 472.8 R .122(are e)108 484.8 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.121 G 2.621(rag).15 G .121(eneral description of)-2.621 +F(the DB package, see)108 496.8 Q F1(db_intr)2.5 E(o)-.45 E F0(\(3\).) +.18 E F1(db_ar)108 513.6 Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E F1 +(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F0(\(1\),).68 E F1(db_deadloc)2.5 E +(k)-.2 E F0(\(1\),).67 E F1(db_dump)2.5 E F0(\(1\),).19 E F1(db_load)2.5 +E F0(\(1\),).77 E F1(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F1 +(db_stat)2.5 E F0(\(1\),).68 E F1(db_intr)108 525.6 Q(o)-.45 E F0 +(\(3\),).18 E F1(db_appinit)2.5 E F0(\(3\),).68 E F1(db_cur)2.5 E(sor) +-.1 E F0(\(3\),).73 E F1(db_dbm)2.5 E F0(\(3\),).32 E F1(db_internal)2.5 +E F0(\(3\),).51 E F1(db_loc)2.5 E(k)-.2 E F0(\(3\),).67 E F1(db_lo)2.5 E +(g)-.1 E F0(\(3\),).22 E F1(db_mpool)2.5 E F0(\(3\),).51 E F1(db_open) +108 537.6 Q F0(\(3\),).24 E F1(db_thr)2.5 E(ead)-.37 E F0(\(3\),).77 E +F1(db_txn)2.5 E F0(\(3\)).24 E(April 10, 1998)276.695 768 Q(2)199.695 E +EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/man.ps/db_stat.ps b/mozilla/db/man/man.ps/db_stat.ps new file mode 100644 index 00000000000..c20451df38e --- /dev/null +++ b/mozilla/db/man/man.ps/db_stat.ps @@ -0,0 +1,296 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:19 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 1 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_stat \255 display DB statistics)108 40.8 Q F0(SYNOPSIS)72 57.6 Q/F2 +10/Times-Bold@0 SF(db_stat)108 69.6 Q F1([)2.5 E F2(-clmNt)A F1(])A([) +158 81.6 Q F2(-C Acfhlmo)A F1 2.5(][)C F2(-d \214le)-2.5 E F1 2.5(][)C +F2(-h home)-2.5 E F1 2.5(][)C F2(-M Ahlm)-2.5 E F1(])A F0(DESCRIPTION)72 +98.4 Q F1(The)108 110.4 Q/F3 10/Times-Italic@0 SF(db_stat)2.5 E F1 +(utility displays statistics for DB en)2.5 E(vironments.)-.4 E +(The options are as follo)108 127.2 Q(ws:)-.25 E F2108 144 Q F1 +.584(Display internal information about the lock re)12.08 F 3.084 +(gion. \(The)-.15 F .584(output from this option is often both v)3.084 F +(olu-)-.2 E(minous and meaningless, and is intended only for deb)133 156 +Q(ugging.\))-.2 E F2133 172.8 Q F1(Display all information.)12.08 +E F2133 184.8 Q F1(Display lock con\215ict matrix.)14.86 E F2 +133 196.8 Q F1(Display lock and object free lists.)15.97 E F2 +133 208.8 Q F1(Display lock)16.52 E(ers within hash chains.)-.1 E +F2133 220.8 Q F1(Display re)10.97 E(gion memory information.)-.15 +E F2133 232.8 Q F1(Display objects within hash chains.)14.3 E F2 +108 249.6 Q F1(Display lock re)14.86 E +(gion statistics as described in)-.15 E F3(db_loc)2.5 E(k)-.2 E F1 +(\(3\).).67 E F2108 266.4 Q F1(Display database statistics for the speci\214ed database, as described in) +13.74 E F3(db_open)2.5 E F1(\(3\).).24 E F2108 283.2 Q F1 +(Specify a home directory for the database.)13.74 E F2108 300 Q F1 +(Display log re)16.52 E(gion statistics as described in)-.15 E F3(db_lo) +2.5 E(g)-.1 E F1(\(3\).).22 E F2108 316.8 Q F1 .852 +(Display internal information about the shared memory b)9.86 F(uf)-.2 E +.852(fer pool.)-.25 F .852(\(The output from this option is)5.852 F +(often both v)133 328.8 Q +(oluminous and meaningless, and is intended only for deb)-.2 E +(ugging.\))-.2 E F2133 345.6 Q F1(Display all information.)12.08 E +F2133 357.6 Q F1(Display b)13.74 E(uf)-.2 E +(fers within hash chains.)-.25 E F2133 369.6 Q F1(Display b)16.52 +E(uf)-.2 E(fers within LR)-.25 E 2.5(Uc)-.4 G(hains.)-2.5 E F2133 +381.6 Q F1(Display re)10.97 E(gion memory information.)-.15 E F2 +108 398.4 Q F1(Display shared memory b)10.97 E(uf)-.2 E +(fer pool statistics as described in)-.25 E F3(db_mpool)2.5 E F1(\(3\).) +.51 E F2108 415.2 Q F1(Don')12.08 E 3.282(ta)-.18 G .782 +(cquire locks while displaying the statistics.)-3.282 F .781 +(This option is intended only for deb)5.781 F .781(ugging cor)-.2 F(-) +-.2 E(rupt re)133 427.2 Q(gions and should not be used under an)-.15 E +2.5(yo)-.15 G(ther circumstances.)-2.5 E F2108 444 Q F1 +(Display transaction re)15.97 E(gion statistics as described in)-.15 E +F3(db_txn)2.5 E F1(\(3\).).24 E(The)108 460.8 Q F3(db_stat)3.417 E F1 +.917(utility attaches to DB shared memory re)3.417 F 3.418(gions. In) +-.15 F .918(order to a)3.418 F -.2(vo)-.2 G .918(id re).2 F .918 +(gion corruption, it should)-.15 F(al)108 472.8 Q -.1(wa)-.1 G .352 +(ys be gi).1 F -.15(ve)-.25 G 2.851(nt).15 G .351 +(he chance to detach and e)-2.851 F .351(xit gracefully)-.15 F 5.351(.T) +-.65 G 2.851(oc)-6.151 G(ause)-2.851 E F3(db_stat)2.851 E F1 .351 +(to clean up after itself and e)2.851 F(xit,)-.15 E +(send it an interrupt signal \(SIGINT\).)108 484.8 Q -1.11(Va)108 501.6 +S .474(lues smaller than 10 million are generally displayed without an) +1.11 F 2.974(ys)-.15 G .474(pecial notation.)-2.974 F -1.11(Va)5.474 G +.474(lues lar)1.11 F .474(ger than 10)-.18 F +(million are normally displayed as `)108 513.6 Q(`M')-.74 E('.) +-.74 E(The)108 530.4 Q F3(db_stat)2.5 E F1(utility e)2.5 E +(xits 0 on success, and >0 if an error occurs.)-.15 E F0(ENVIR)72 547.2 +Q(ONMENT V)-.27 E(ARIABLES)-1.215 E F1(The follo)108 559.2 Q(wing en) +-.25 E(vironment v)-.4 E(ariables af)-.25 E(fect the e)-.25 E -.15(xe) +-.15 G(cution of).15 E F3(db_stat)2.5 E F1(:).68 E(DB_HOME)108 576 Q +.222(If the)133 588 R F22.722 E F1 .222 +(option is not speci\214ed and the en)2.722 F .222(vironment v)-.4 F +(ariable)-.25 E F3(DB_HOME)2.722 E F1 .221 +(is set, it is used as the path)2.721 F +(of the database home, as described in)133 600 Q F3(db_appinit)2.5 E F1 +(\(3\).).68 E F0(SEE ALSO)72 616.8 Q F1 .485(The DB library is a f)108 +628.8 R .485(amily of groups of functions that pro)-.1 F .486 +(vides a modular programming interf)-.15 F .486(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 640.8 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .506(\214le page caching, as well as v)108 652.8 R .506 +(arious inde)-.25 F -.15(xe)-.15 G 3.006(da).15 G .506(ccess methods.) +-3.006 F(Man)5.507 E 3.007(yo)-.15 G 3.007(ft)-3.007 G .507 +(he functional groups \(e.g., the \214le)-3.007 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 664.8 R .121(are e)108 676.8 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.122 G 2.622(rag).15 G .122(eneral description of)-2.622 +F(the DB package, see)108 688.8 Q F3(db_intr)2.5 E(o)-.45 E F1(\(3\).) +.18 E F3(db_ar)108 705.6 Q -.15(ch)-.37 G(ive).15 E F1(\(1\),).18 E F3 +(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F1(\(1\),).68 E F3(db_deadloc)2.5 E +(k)-.2 E F1(\(1\),).67 E F3(db_dump)2.5 E F1(\(1\),).19 E F3(db_load)2.5 +E F1(\(1\),).77 E F3(db_r)2.5 E(eco)-.37 E(ver)-.1 E F1(\(1\),).73 E F3 +(db_stat)2.5 E F1(\(1\),).68 E F3(db_intr)108 717.6 Q(o)-.45 E F1 +(\(3\),).18 E F3(db_appinit)2.5 E F1(\(3\),).68 E F3(db_cur)2.5 E(sor) +-.1 E F1(\(3\),).73 E F3(db_dbm)2.5 E F1(\(3\),).32 E F3(db_internal)2.5 +E F1(\(3\),).51 E F3(db_loc)2.5 E(k)-.2 E F1(\(3\),).67 E F3(db_lo)2.5 E +(g)-.1 E F1(\(3\),).22 E F3(db_mpool)2.5 E F1(\(3\),).51 E F3(db_open) +108 729.6 Q F1(\(3\),).24 E F3(db_thr)2.5 E(ead)-.37 E F1(\(3\),).77 E +F3(db_txn)2.5 E F1(\(3\)).24 E(1)535 768 Q EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/man.ps/db_thread.ps b/mozilla/db/man/man.ps/db_thread.ps new file mode 100644 index 00000000000..6b8e64a352a --- /dev/null +++ b/mozilla/db/man/man.ps/db_thread.ps @@ -0,0 +1,332 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:24 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 2 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_thread \255 using threads in the DB library)108 40.8 Q(.)-.65 E F0 +(DESCRIPTION)72 57.6 Q F1 .486(The DB library is a f)108 69.6 R .485 +(amily of groups of functions that pro)-.1 F .485 +(vides a modular programming interf)-.15 F .485(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 81.6 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .507(\214le page caching, as well as v)108 93.6 R .507 +(arious inde)-.25 F -.15(xe)-.15 G 3.007(da).15 G .506(ccess methods.) +-3.007 F(Man)5.506 E 3.006(yo)-.15 G 3.006(ft)-3.006 G .506 +(he functional groups \(e.g., the \214le)-3.006 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 105.6 R .122(are e)108 117.6 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.121 G 2.621(rag).15 G .121(eneral description of)-2.621 +F(the DB package, see)108 129.6 Q/F2 10/Times-Italic@0 SF(db_intr)2.5 E +(o)-.45 E F1(\(3\).).18 E(This manual pages describes the speci\214c details of using DB from within threaded programs.) +108 146.4 Q 1.57(The DB library is not itself multi-threaded.)108 163.2 +R 1.571(The library w)6.571 F 1.571 +(as deliberately architected to not use threads)-.1 F .233(internally because of the portability problems that using threads within the library w) +108 175.2 R .232(ould introduce.)-.1 F(Object)5.232 E .059(handles returned from DB library functions are free-threaded, i.e., threads may use handles concurrently) +108 187.2 R 2.559(,b)-.65 G(y)-2.559 E .69 +(specifying the DB_THREAD \215ag to)108 199.2 R F2(db_appinit)3.189 E F1 +.689(\(3\) \(or).68 F 3.189(,i)-.4 G 3.189(nt)-3.189 G .689(he C++ API,) +-3.189 F F2(DbEn)3.189 E(v::appinit)-.4 E F1 .689(\(3\)\) and the other) +.68 F .36(subsystem open functions.)108 211.2 R .36 +(Threading is assumed in the Ja)5.36 F .86 -.25(va A)-.2 H .36 +(PI, so no special \215ags are required, and DB).25 F(functions will al) +108 223.2 Q -.1(wa)-.1 G(ys beha).1 E .3 -.15(ve a)-.2 H 2.5(si).15 G +2.5(ft)-2.5 G(he DB_THREAD \215ag w)-2.5 E(as speci\214ed.)-.1 E .178 +(DB supports multi-threaded applications with the ca)108 240 R -.15(ve) +-.2 G .178(at that it loads and calls functions that are commonly).15 F +-.2(av)108 252 S .168(ailable in C language en)-.05 F .168 +(vironments and which may not themselv)-.4 F .168(es be thread-safe.) +-.15 F .168(Other than this usage,)5.168 F .044 +(DB has no static data and maintains no local conte)108 264 R .044 +(xt between calls to DB functions.)-.15 F 1.644 -.8(To e)5.044 H .043 +(nsure that applica-).8 F .429 +(tions can safely use threads in the conte)108 276 R .429 +(xt of DB, porters to ne)-.15 F 2.93(wo)-.25 G .43 +(perating systems and/or C libraries must)-2.93 F(con\214rm that the system and C library functions used by the DB library are thread-safe.) +108 288 Q(There are some additional ca)108 304.8 Q -.15(ve)-.2 G +(ats about using threads to access the DB library:).15 E 6.5<8354>108 +321.6 S 2.06 +(he DB_THREAD \215ag must be speci\214ed for all subsystems either e) +-6.5 F 2.06(xplicitly or via the)-.15 F F2(db_appinit)4.56 E F1(\()118 +333.6 Q F2(DbEn)A(v::appinit)-.4 E F1 2.947(\)f).68 G .447 +(unction in the C and C++ APIs.)-2.947 F .447 +(Threading is assumed in the Ja)5.447 F .947 -.25(va A)-.2 H .447 +(PI, so no special).25 F(\215ags are required, and DB functions will al) +118 345.6 Q -.1(wa)-.1 G(ys beha).1 E .3 -.15(ve a)-.2 H 2.5(si).15 G +2.5(ft)-2.5 G(he DB_THREAD \215ag w)-2.5 E(as speci\214ed.)-.1 E(Setting the DB_THREAD \215ag inconsistently may result in database corruption.) +118 369.6 Q 6.5<834f>108 386.4 S 1.936(nly a single thread may call the close function for a returned database or subsystem handle.) +-6.5 F(See)6.935 E F2(db_open)118 398.4 Q F1(\(3\) \().24 E F2(Db::open) +A F1(\(3\)\) and the appropriate subsystem manual pages for more information.) +.24 E 6.5<8345>108 415.2 S 1.096(ither the DB_DBT_MALLOC or DB_DBT_USERMEM \215ags must be set in a DBT used for k) +-6.5 F 1.396 -.15(ey o)-.1 H(r).15 E(data retrie)118 427.2 Q -.25(va) +-.25 G 2.5(l. See).25 F F2(db_dbt)2.5 E F1(\(3\) \().68 E F2(Dbt)A F1 +(\(3\)\) for more information.).68 E 6.5<8354>108 444 S .534 +(he DB_CURRENT)-6.5 F 3.033(,D)-.74 G .533 +(B_NEXT and DB_PREV \215ags to the)-3.033 F F2(lo)3.033 E(g_g)-.1 E(et) +-.1 E F1(\()3.033 E F2(DbLo)A(g::g)-.1 E(et)-.1 E F1 3.033(\)f).68 G +.533(unction may not be)-3.033 F 1.172(used by a free-threaded handle.) +118 456 R 1.172(If such calls are necessary)6.172 F 3.673(,at)-.65 G +1.173(hread should e)-3.673 F 1.173(xplicitly create a unique)-.15 F +.824(DB_LOG handle by calling)118 468 R F2(lo)3.324 E(g_open)-.1 E F1 +.824(\(3\) \().24 F F2(DbLo)A(g::open)-.1 E F1 3.324(\). See).24 F F2 +(db_lo)3.324 E(g)-.1 E F1 .823(\(3\) \().22 F F2(DbLo)A(g)-.1 E F1 .823 +(\(3\)\) for more informa-).22 F(tion.)118 480 Q 6.5<8345>108 496.8 S +.652(ach database operation \(i.e., an)-6.5 F 3.152(yc)-.15 G .652 +(all to a function underlying the handles returned by)-3.152 F F2 +(db_open)3.152 E F1 .652(\(3\) and).24 F F2(db_cur)118 508.8 Q(sor)-.1 E +F1 .533(\(3\)\) \().73 F F2(Db)A F1 .533(\(3\) and).23 F F2(Dbc)3.033 E +F1 .533(\(3\)\) is normally performed on behalf of a unique lock).31 F +(er)-.1 E 5.532(.I)-.55 G .532(f, within a sin-)-5.532 F .765 +(gle thread of control, multiple calls on behalf of the same lock)118 +520.8 R .766(er are desired, then transactions must be)-.1 F 2.558 +(used. F)118 532.8 R .058(or e)-.15 F .058(xample, consider the case where a cursor scan locates a record, and then based on that record,) +-.15 F .112(accesses some other item in the database.)118 544.8 R .113 +(If these are done using the def)5.113 F .113(ault lock)-.1 F .113 +(ers for the handle, there)-.1 F .242(is no guarantee that these tw)118 +556.8 R 2.741(oo)-.1 G .241(perations will not con\215ict.)-2.741 F .241 +(If the application wishes to guarantee that the)5.241 F .149(operations do not con\215ict, locks must be obtained on behalf of a transaction, instead of the def) +118 568.8 R .15(ault lock)-.1 F(er)-.1 E(id, and a transaction must be speci\214ed to the cursor creation and the subsequent db call.) +118 580.8 Q 6.5<8354>108 597.6 S .054 +(ransactions may not span threads, i.e., each transaction must be)-6.85 +F .054(gin and end in the same thread, and each)-.15 F +(transaction may only be used by a single thread.)118 609.6 Q 6.5<8353> +108 626.4 S .647(pinlocks must ha)-6.5 F .947 -.15(ve b)-.2 H .647 +(een implemented for the compiler/architecture combination.).15 F .648 +(Attempting to spec-)5.648 F(ify the DB_THREAD \215ag will f)118 638.4 Q +(ail if spinlocks are not a)-.1 E -.25(va)-.2 G(ilable.).25 E 6.5<8354> +108 655.2 S .615(he DB library mak)-6.5 F .614(es a system call to pause for some number of microseconds when it is necessary to) +-.1 F -.1(wa)118 667.2 S .496(it on a lock.).1 F .497 +(This may not be optimal, especially in a thread-only en)5.496 F .497 +(vironment where it will be more)-.4 F(ef)118 679.2 Q .075 +(\214cient to e)-.25 F .075 +(xplicitly yield the processor to another thread.)-.15 F .074 +(It is possible to specify a yield function on an)5.074 F(per)118 691.2 +Q(-application basis, see)-.2 E F2(db_jump_set)2.5 E F1 +(\(3\) for more information.).68 E(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 323.3(DB_THREAD\(3\) DB_THREAD\(3\))72 48 R/F1 9 +/Times-Bold@0 SF(COMPILING THREADED APPLICA)72 84 Q(TIONS)-.855 E F0 +.479(Special compile-time \215ags are required when compiling threaded applications with the UNIX include \214les) +108 96 R(on some architectures.)108 108 Q .701(On IRIX, if you are compiling a threaded application, you must compile with the -D_SGI_MP_SOURCE) +108 124.8 R(\215ag:)108 136.8 Q(cc -D_SGI_MP_SOURCE ...)158 153.6 Q(On OSF/1, if you are compiling a threaded application, you must compile with the -D_REENTRANT \215ag:) +108 170.4 Q(cc -D_REENTRANT ...)158 187.2 Q .377(On Solaris, if you are compiling a threaded application, you must compile with the -D_REENTRANT \215ag) +108 204 R(and link with the -lthread library:)108 216 Q +(cc -D_REENTRANT ... -lthread)158 232.8 Q F1(SEE ALSO)72 249.6 Q/F2 10 +/Times-Italic@0 SF(db_ar)108 261.6 Q -.15(ch)-.37 G(ive).15 E F0(\(1\),) +.18 E F2(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F0(\(1\),).68 E F2 +(db_deadloc)2.5 E(k)-.2 E F0(\(1\),).67 E F2(db_dump)2.5 E F0(\(1\),).19 +E F2(db_load)2.5 E F0(\(1\),).77 E F2(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0 +(\(1\),).73 E F2(db_stat)2.5 E F0(\(1\),).68 E F2(db_intr)108 273.6 Q(o) +-.45 E F0(\(3\),).18 E F2(db_appinit)2.5 E F0(\(3\),).68 E F2(db_cur)2.5 +E(sor)-.1 E F0(\(3\),).73 E F2(db_dbm)2.5 E F0(\(3\),).32 E F2 +(db_internal)2.5 E F0(\(3\),).51 E F2(db_loc)2.5 E(k)-.2 E F0(\(3\),).67 +E F2(db_lo)2.5 E(g)-.1 E F0(\(3\),).22 E F2(db_mpool)2.5 E F0(\(3\),).51 +E F2(db_open)108 285.6 Q F0(\(3\),).24 E F2(db_thr)2.5 E(ead)-.37 E F0 +(\(3\),).77 E F2(db_txn)2.5 E F0(\(3\)).24 E(April 10, 1998)276.695 768 +Q(2)199.695 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/man.ps/db_txn.ps b/mozilla/db/man/man.ps/db_txn.ps new file mode 100644 index 00000000000..ed2944700f0 --- /dev/null +++ b/mozilla/db/man/man.ps/db_txn.ps @@ -0,0 +1,929 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:24 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 8 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_txn \255 DB transaction management)108 40.8 Q F0(SYNOPSIS)72 57.6 Q +/F2 10/Times-Bold@0 SF(#include )-.4 E(int)108 93.6 Q +(txn_open\(const char *dir)108 105.6 Q(,)-.92 E +(u_int32_t \215ags, int mode, DB_ENV *dben)158 117.6 Q 1.1 -.55(v, D)-.4 +H(B_TXNMGR **r).55 E(egionp\);)-.18 E(int)108 141.6 Q +(txn_begin\(DB_TXNMGR *txnp, DB_TXN *pid, DB_TXN **tid\);)108 153.6 Q +(int)108 177.6 Q(txn_pr)108 189.6 Q(epar)-.18 E(e\(DB_TXN *tid\);)-.18 E +(int)108 213.6 Q(txn_commit\(DB_TXN *tid\);)108 225.6 Q(int)108 249.6 Q +(txn_abort\(DB_TXN *tid\);)108 261.6 Q(u_int32_t)108 285.6 Q +(txn_id\(DB_TXN *tid\);)108 297.6 Q(int)108 321.6 Q(txn_checkpoint\(const DB_TXNMGR *txnp, u_int32_t kbyte, u_int32_t min\);) +108 333.6 Q(int)108 357.6 Q(txn_close\(DB_TXNMGR *txnp\);)108 369.6 Q +(int)108 393.6 Q(txn_unlink\(const char *dir)108 405.6 Q 2.5(,i)-.92 G +(nt f)-2.5 E(or)-.25 E(ce, DB_ENV *dben)-.18 E(v\);)-.4 E(int)108 429.6 +Q(txn_stat\(DB_TXNMGR *txnp,)108 441.6 Q(DB_TXN_ST)158 453.6 Q 1.9 -.95 +(AT *)-.9 H(*statp, v).95 E(oid *\(*db_malloc\)\(size_t\)\);)-.1 E F0 +(DESCRIPTION)72 470.4 Q F1 .486(The DB library is a f)108 482.4 R .485 +(amily of groups of functions that pro)-.1 F .485 +(vides a modular programming interf)-.15 F .485(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 494.4 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .507(\214le page caching, as well as v)108 506.4 R .507 +(arious inde)-.25 F -.15(xe)-.15 G 3.007(da).15 G .506(ccess methods.) +-3.007 F(Man)5.506 E 3.006(yo)-.15 G 3.006(ft)-3.006 G .506 +(he functional groups \(e.g., the \214le)-3.006 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 518.4 R .122(are e)108 530.4 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.121 G 2.621(rag).15 G .121(eneral description of)-2.621 +F(the DB package, see)108 542.4 Q/F3 10/Times-Italic@0 SF(db_intr)2.5 E +(o)-.45 E F1(\(3\).).18 E(This manual page describes the speci\214c details of the DB transaction support.) +108 559.2 Q(The)108 576 Q F3(db_txn)2.956 E F1 .456 +(functions are the library interf)2.956 F .456(ace that pro)-.1 F .456 +(vides transaction semantics.)-.15 F .457(Full transaction support)5.456 +F .746(is pro)108 588 R .746(vided by a collection of modules that pro) +-.15 F .746(vide interf)-.15 F .745 +(aces to the services required for transaction pro-)-.1 F 3.273 +(cessing. These)108 600 R .774(services are reco)3.273 F -.15(ve)-.15 G +.774(ry \(see).15 F F3(db_lo)3.274 E(g)-.1 E F1 .774 +(\(3\)\), concurrenc).22 F 3.274(yc)-.15 G .774(ontrol \(see)-3.274 F F3 +(db_loc)3.274 E(k)-.2 E F1 .774(\(3\)\), and the man-).67 F 1.21 +(agement of shared data \(see)108 612 R F3(db_mpool)3.71 E F1 3.71 +(\(3\)\). T).51 F 1.21 +(ransaction semantics can be applied to the access methods)-.35 F +(described in)108 624 Q F3(db_open)2.5 E F1 +(\(3\) through function call parameters.).24 E .891(The model intended for transactional use \(and the one that is used by the access methods\) is write-ahead) +108 640.8 R .508(logging pro)108 652.8 R .508(vided by)-.15 F F3(db_lo) +3.008 E(g)-.1 E F1 .508(\(3\) to record both before- and after).22 F +3.008(-images. Locking)-.2 F(follo)3.008 E .508(ws a tw)-.25 F .507 +(o-phase pro-)-.1 F +(tocol, with all locks being released at transaction commit.)108 664.8 Q +F3(txn_open)92 681.6 Q F1(The)108 693.6 Q F3(txn_open)3.426 E F1 .927 +(function copies a pointer)3.426 F 3.427(,t)-.4 G 3.427(ot)-3.427 G .927 +(he transaction re)-3.427 F .927(gion identi\214ed by the)-.15 F F2(dir) +3.427 E(ectory)-.18 E F3(dir)3.427 E F1 3.427(,i).73 G .927(nto the) +-3.427 F(memory location referenced by)108 705.6 Q F3 -.37(re)2.5 G +(gionp)-.03 E F1(.).19 E 1.878(If the)108 722.4 R F3(dben)4.378 E(v)-.4 +E F1(ar)4.378 E 1.878(gument to)-.18 F F3(txn_open)4.378 E F1 -.1(wa) +4.377 G 4.377(si).1 G 1.877(nitialized using)-4.377 F F3(db_appinit) +4.377 E F1(,).68 E F3(dir)4.377 E F1 1.877 +(is interpreted as described by)4.377 F(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 363.3(DB_TXN\(3\) DB_TXN\(3\))72 48 R/F1 10 +/Times-Italic@0 SF(db_appinit)108 84 Q F0(\(3\).).68 E .667 +(Otherwise, if)108 100.8 R F1(dir)3.167 E F0 .668 +(is not NULL, it is interpreted relati)3.167 F .968 -.15(ve t)-.25 H +3.168(ot).15 G .668(he current w)-3.168 F .668 +(orking directory of the process.)-.1 F(If)5.668 E F1(dir)108 112.8 Q F0 +2.388(is NULL, the follo)4.888 F 2.388(wing en)-.25 F 2.388(vironment v) +-.4 F 2.388(ariables are check)-.25 F 2.387(ed in order: `)-.1 F +(`TMPDIR')-.74 E 2.387(', `)-.74 F(`TEMP')-.74 E 2.387(', and)-.74 F +-.74(``)108 124.8 S(TMP').74 E 3.361('. If)-.74 F .861 +(one of them is set, transaction re)3.361 F .862 +(gion \214les are created relati)-.15 F 1.162 -.15(ve t)-.25 H 3.362(ot) +.15 G .862(he directory it speci\214es.)-3.362 F(If)5.862 E .836 +(none of them are set, the \214rst possible one of the follo)108 136.8 R +.836(wing directories is used:)-.25 F F1(/var/tmp)3.336 E F0(,).19 E F1 +(/usr/tmp)3.335 E F0(,).19 E F1(/temp)3.335 E F0(,).19 E F1(/tmp)108 +148.8 Q F0(,).19 E F1(C:/temp)2.5 E F0(and)2.5 E F1(C:/tmp)2.5 E F0(.) +.19 E 1.21(All \214les associated with the transaction re)108 165.6 R +1.21(gion are created in this directory)-.15 F 6.21(.T)-.65 G 1.21 +(his directory must already)-6.21 F -.15(ex)108 177.6 S(ist when).15 E +.067(transaction re)108 201.6 R .067(gion_open is called.)-.15 F .067 +(If the transaction re)5.067 F .066(gion already e)-.15 F .066 +(xists, the process must ha)-.15 F .366 -.15(ve p)-.2 H(ermission).15 E +.556(to read and write the e)108 213.6 R .556(xisting \214les.)-.15 F +.556(If the transaction re)5.556 F .556(gion does not already e)-.15 F +.556(xist, it is optionally created)-.15 F(and initialized.)108 225.6 Q +(The)108 242.4 Q F1<8d61>3.761 E(gs)-.1 E F0(and)3.761 E F1(mode)3.761 E +F0(ar)3.761 E 1.261(guments specify ho)-.18 F 3.761<778c>-.25 G 1.26 +(les will be opened and/or created when the)-3.761 F 3.76(yd)-.15 G(on') +-3.76 E 3.76(ta)-.18 G(lready)-3.76 E -.15(ex)108 254.4 S 2.5(ist. The) +.15 F(\215ags v)2.5 E(alue is speci\214ed by)-.25 E/F2 10/Times-Bold@0 +SF(or)2.5 E F0('ing together one or more of the follo)A(wing v)-.25 E +(alues:)-.25 E(DB_CREA)108 271.2 Q(TE)-1.11 E .483(Create an)133 283.2 R +2.983(yu)-.15 G .483(nderlying \214les, as necessary)-2.983 F 5.483(.I) +-.65 G 2.983(ft)-5.483 G .483(he \214les do not already e)-2.983 F .483 +(xist and the DB_CREA)-.15 F .484(TE \215ag)-1.11 F +(is not speci\214ed, the call will f)133 295.2 Q(ail.)-.1 E(DB_THREAD) +108 324 Q .107(Cause the DB_TXNMGR handle returned by the)133 336 R F1 +(txn_open)2.607 E F0 .107(function to be useable by multiple threads) +2.607 F(within a single address space, i.e., to be `)133 348 Q +(`free-threaded')-.74 E('.)-.74 E(DB_TXN_NOSYNC)108 364.8 Q .452 +(On transaction commit, do not synchronously \215ush the log.)133 376.8 +R .452(This means that transactions e)5.452 F .453(xhibit the)-.15 F -.4 +(AC)133 388.8 S 3.54(I\().4 G(atomicity)-3.54 E 3.54(,c)-.65 G +(onsistenc)-3.54 E 3.54(ya)-.15 G 1.04(nd isolation\) properties, b) +-3.54 F 1.04(ut not D \(durability\), i.e., database inte)-.2 F(grity) +-.15 E .87(will be maintained b)133 400.8 R .87(ut it is possible that some number of the most recently committed transactions) +-.2 F(may be undone during reco)133 412.8 Q -.15(ve)-.15 G +(ry instead of being redone.).15 E 1.216 +(The number of transactions that are potentially at risk is go)133 436.8 +R -.15(ve)-.15 G 1.216(rned by ho).15 F 3.716(wo)-.25 G 1.216 +(ften the log is check-)-3.716 F(pointed \(see)133 448.8 Q F1(db_c)2.5 E +(hec)-.15 E(kpoint)-.2 E F0(\(1\)\) and ho).68 E 2.5(wm)-.25 G(an)-2.5 E +2.5(yl)-.15 G(og updates can \214t on a single log page.)-2.5 E .544 +(All \214les created by the transaction subsystem are created with mode) +108 465.6 R F1(mode)3.044 E F0 .544(\(as described in)3.044 F F1 -.15 +(ch)3.044 G(mod).15 E F0 .544(\(2\)\) and).77 F .392 +(modi\214ed by the process' umask v)108 477.6 R .391 +(alue at the time of creation \(see)-.25 F F1(umask)2.891 E F0 2.891 +(\(2\)\). The).67 F .391(group o)2.891 F .391(wnership of cre-)-.25 F +(ated \214les is based on the system and directory def)108 489.6 Q +(aults, and is not further speci\214ed by DB.)-.1 E .566 +(The transaction subsystem is con\214gured based on the)108 506.4 R F1 +(dben)3.066 E(v)-.4 E F0(ar)3.066 E .566(gument to)-.18 F F1(txn_open) +3.066 E F0 3.066(,w).24 G .566(hich is a pointer to a)-3.066 F 1.924 +(structure of type DB_ENV \(typedef)108 518.4 R 2.924 -.5('d i).55 H +4.424(n<).5 G(db)-4.424 E 4.424(.h>\). Applications)-.4 F 1.924 +(will normally use the same DB_ENV)4.424 F(structure \(initialized by) +108 530.4 Q F1(db_appinit)2.5 E F0(\(3\)\), as an ar).68 E +(gument to all of the subsystems in the DB package.)-.18 E .439(References to the DB_ENV structure are maintained by DB, so it may not be discarded until the last close) +108 547.2 R .287 +(function, corresponding to an open function for which it w)108 559.2 R +.286(as an ar)-.1 F .286(gument, has returned.)-.18 F .286 +(In order to ensure)5.286 F 1.578(compatibility with future releases of DB, all \214elds of the DB_ENV structure that are not e) +108 571.2 R 1.579(xplicitly set)-.15 F .171(should be initialized to 0 before the \214rst time the structure is used.) +108 583.2 R .17(Do this by declaring the structure e)5.17 F(xter)-.15 E +(-)-.2 E(nal or static, or by calling the C library routine)108 595.2 Q +F1(bzer)2.5 E(o)-.45 E F0(\(3\) or).18 E F1(memset)2.5 E F0(\(3\).).68 E +.23(The \214elds of the DB_ENV structure used by)108 612 R F1(txn_open) +2.73 E F0 .23(are described belo)2.73 F 4.03 -.65(w. I)-.25 H(f).65 E F1 +(dben)2.73 E(v)-.4 E F0 .23(is NULL or an)2.73 F 2.73(yo)-.15 G 2.73(fi) +-2.73 G(ts)-2.73 E(\214elds are set to 0, def)108 624 Q +(aults appropriate for the system are used where possible.)-.1 E +(The follo)108 640.8 Q(wing \214elds in the DB_ENV structure may be initialized before calling) +-.25 E F1(txn_open)2.5 E F0(:).24 E -.2(vo)108 657.6 S +(id *\(*db_errcall\)\(char *db_errpfx, char *b).2 E(uf)-.2 E(fer\);)-.25 +E(FILE *db_err\214le;)108 669.6 Q(const char *db_errpfx;)108 681.6 Q +(int db_v)108 693.6 Q(erbose;)-.15 E +(The error \214elds of the DB_ENV beha)133 705.6 Q .3 -.15(ve a)-.2 H +2.5(sd).15 G(escribed for)-2.5 E F1(db_appinit)2.5 E F0(\(3\).).68 E +(May 10, 1998)278.085 768 Q(2)201.085 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 363.3(DB_TXN\(3\) DB_TXN\(3\))72 48 R +(DB_LOG *lg_info;)108 84 Q .746(The logging re)133 96 R .746 +(gion that is being used for this transaction en)-.15 F 3.246 +(vironment. The)-.4 F/F1 10/Times-Italic@0 SF(lg_info)3.246 E F0 .746 +(\214eld contains a)3.246 F .716(return v)133 108 R .716 +(alue from the function)-.25 F F1(lo)3.217 E(g_open)-.1 E F0(.).24 E/F2 +10/Times-Bold@0 SF .717(Logging is r)5.717 F(equir)-.18 E .717(ed f)-.18 +F .717(or transaction en)-.25 F(vir)-.4 E .717(onments, and)-.18 F +(it is an err)133 120 Q(or to not specify a logging r)-.18 E(egion.)-.18 +E F0(DB_LOCKT)108 136.8 Q(AB *lk_info;)-.93 E .821(The locking re)133 +148.8 R .821(gion that is being used for this transaction en)-.15 F 3.32 +(vironment. The)-.4 F F1(lk_info)3.32 E F0 .82(\214eld contains a)3.32 F +.505(return v)133 160.8 R .505(alue from the function)-.25 F F1(loc) +3.005 E(k_open)-.2 E F0 5.505(.I).24 G(f)-5.505 E F1(lk_info)3.006 E F0 +.506(is NULL, no locking is done in this transaction)3.006 F(en)133 +172.8 Q(vironment.)-.4 E(u_int32_t tx_max;)108 189.6 Q 1.888 +(The maximum number of simultaneous transactions that are supported.)133 +201.6 R 1.887(This bounds the size of)6.888 F .473 +(backing \214les and is used to deri)133 213.6 R .774 -.15(ve l)-.25 H +.474(imits for the size of the lock re).15 F .474(gion and log\214les.) +-.15 F .474(When there are)5.474 F 1.452(more than)133 225.6 R F1 +(tx_max)3.952 E F0 1.452(concurrent transactions, calls to)3.952 F F1 +(txn_be)3.951 E(gin)-.4 E F0 1.451(may cause backing \214les to gro) +3.951 F 5.251 -.65(w. I)-.25 H(f).65 E F1(tx_max)133 237.6 Q F0 +(is 0, a def)2.5 E(ault v)-.1 E(alue is used.)-.25 E(int \(*tx_reco)108 +254.4 Q -.15(ve)-.15 G(r\)\(DB_LOG *logp, DBT *log_rec,).15 E +(DB_LSN *lsnp, int redo, v)183 266.4 Q(oid *info\);)-.2 E 2.5(Af)133 +278.4 S(unction that is called by)-2.5 E F1(txn_abort)2.5 E F0 +(during transaction abort.)2.5 E(This function tak)5 E(es \214v)-.1 E +2.5(ea)-.15 G -.18(rg)-2.5 G(uments:).18 E 4.72(logp A)133 295.2 R +(pointer to the transaction log \(DB_LOG *\).)2.5 E(log_rec)133 312 Q +2.5(Al)158 324 S(og record.)-2.5 E 5.83(lsnp A)133 340.8 R +(pointer to a log sequence number \(DB_LSN *\).)2.5 E 4.73(redo An)133 +357.6 R(inte)2.5 E(ger v)-.15 E(alue that is set to one of the follo) +-.25 E(wing v)-.25 E(alues:)-.25 E(DB_TXN_B)158 374.4 Q -.4(AC)-.35 G +(KW).4 E(ARD_R)-1.2 E(OLL)-.4 E 1.136(The log is being read backw)183 +386.4 R 1.136(ard to determine which transactions ha)-.1 F 1.436 -.15 +(ve b)-.2 H 1.136(een committed).15 F(and which transactions were not \(and should therefore be aborted during reco) +183 398.4 Q -.15(ve)-.15 G(ry\).).15 E(DB_TXN_FOR)158 415.2 Q -1.2(WA) +-.55 G(RD_R)1.2 E(OLL)-.4 E 1.744(The log is being played forw)183 427.2 +R 1.744(ard, an)-.1 F 4.244(yt)-.15 G 1.744 +(ransaction ids encountered that ha)-4.244 F 2.043 -.15(ve n)-.2 H 1.743 +(ot been).15 F(entered into the list referenced by)183 439.2 Q F1(info) +2.5 E F0(should be ignored.)2.5 E(DB_TXN_OPENFILES)158 456 Q +(The log is being read to open all the \214les required to perform reco) +183 468 Q -.15(ve)-.15 G(ry).15 E(.)-.65 E(DB_TXN_REDO)158 484.8 Q +(Redo the operation described by the log record.)183 496.8 Q +(DB_TXN_UNDO)158 513.6 Q +(Undo the operation described by the log record.)183 525.6 Q 6.39 +(info An)133 542.4 R(opaque pointer used to reference the list of transaction IDs encountered during reco) +2.5 E -.15(ve)-.15 G(ry).15 E(.)-.65 E(If)133 559.2 Q F1 -.37(re)3.214 G +(co).37 E(ver)-.1 E F0 .714(is NULL, the def)3.214 F .714(ault is that only DB access method operations are transaction protected,) +-.1 F(and the def)133 571.2 Q(ault reco)-.1 E -.15(ve)-.15 G 2.5(rf).15 +G(unction will be used.)-2.5 E(The)108 588 Q F1(txn_open)2.5 E F0 +(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E F1(txn_be)92 604.8 Q(gin)-.4 E F0(The) +108 616.8 Q F1(txn_be)3.109 E(gin)-.4 E F0 .609(function creates a ne) +3.109 F 3.109(wt)-.25 G .608 +(ransaction in the designated transaction manager)-3.109 F 3.108(,c)-.4 +G(op)-3.108 E .608(ying a pointer)-.1 F 1.068(to a DB_TXN that uniquely identi\214es it into the memory referenced by) +108 628.8 R F1(tid)3.568 E F0 6.069(.I).77 G 3.569(ft)-6.069 G(he)-3.569 +E F1(pid)3.569 E F0(ar)3.569 E 1.069(gument is non-)-.18 F(NULL, the ne) +108 640.8 Q 2.5(wt)-.25 G +(ransaction is a nested transaction with the transaction indicated by) +-2.5 E F1(pid)2.5 E F0(as its parent.)2.5 E -.35(Tr)108 657.6 S .643 +(ansactions may not span threads, i.e., each transaction must be).35 F +.642(gin and end in the same thread, and each)-.15 F +(transaction may only be used by a single thread.)108 669.6 Q(The)108 +686.4 Q F1(txn_be)2.5 E(gin)-.4 E F0(function returns the v)2.5 E +(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 E(ailure and 0 on success.) +-.1 E F1(txn_pr)92 703.2 Q(epar)-.37 E(e)-.37 E F0(The)108 715.2 Q F1 +(txn_pr)3.057 E(epar)-.37 E(e)-.37 E F0 .557(function initiates the be) +3.057 F .557(ginning of a tw)-.15 F 3.057(op)-.1 G .557(hase commit.) +-3.057 F .558(In a distrib)5.558 F .558(uted transaction en)-.2 F(vi-) +-.4 E(ronment,)108 727.2 Q F1(db)3.372 E F0 .872 +(can be used as a local transaction manager)3.372 F 5.872(.I)-.55 G +3.372(nt)-5.872 G .872(his case, the distrib)-3.372 F .871 +(uted transaction manager)-.2 F(May 10, 1998)278.085 768 Q(3)201.085 E +EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 363.3(DB_TXN\(3\) DB_TXN\(3\))72 48 R .5 +(must send)108 84 R/F1 10/Times-Italic@0 SF(pr)3 E(epar)-.37 E(e)-.37 E +F0 .5(messages to each local manager)3 F 5.5(.T)-.55 G .5 +(he local manager must then issue a)-5.5 F F1(txn_pr)3 E(epar)-.37 E(e) +-.37 E F0(and)3 E -2.3 -.15(aw a)108 96 T 1.45 +(it its successful return before responding to the distrib).15 F 1.45 +(uted transaction manager)-.2 F 6.45(.O)-.55 G 1.45(nly after the dis-) +-6.45 F(trib)108 108 Q .521(uted transaction manager recei)-.2 F -.15 +(ve)-.25 G 3.021(ss).15 G .521(uccessful responses from all of its) +-3.021 F F1(pr)3.022 E(epar)-.37 E(e)-.37 E F0 .522 +(messages should it issue)3.022 F(an)108 120 Q(y)-.15 E F1(commit)2.5 E +F0(messages.)2.5 E(The)108 136.8 Q F1(txn_pr)2.5 E(epar)-.37 E(e)-.37 E +F0(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f) +2.5 E(ailure and 0 on success.)-.1 E F1(txn_commit)92 153.6 Q F0(The)108 +165.6 Q F1(txn_commit)3.343 E F0 .842 +(function ends the transaction speci\214ed by the)3.343 F F1(tid)3.342 E +F0(ar)3.342 E 3.342(gument. If)-.18 F .842(DB_TXN_NOSYNC w)3.342 F(as) +-.1 E .019(not speci\214ed, a commit log record is written and \215ushed to disk, as are all pre) +108 177.6 R .019(viously written log records.)-.25 F(If)5.019 E .843(the transaction is nested, its locks are acquired by the parent transaction, otherwise its locks are released.) +108 189.6 R(An)108 201.6 Q 2.544(ya)-.15 G .044 +(pplications that require strict tw)-2.544 F .045 +(o-phase locking must not release an)-.1 F 2.545(yl)-.15 G .045(ocks e) +-2.545 F(xplicitly)-.15 E 2.545(,l)-.65 G(ea)-2.545 E .045 +(ving them all)-.2 F(to be released by)108 213.6 Q F1(txn_commit)2.5 E +F0(.).68 E(The)108 230.4 Q F1(txn_commit)2.5 E F0 +(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E F1(txn_abort)92 247.2 Q F0(The)108 +259.2 Q F1(txn_abort)3.648 E F0 1.147 +(function causes an abnormal termination of the transaction.)3.648 F +1.147(The log is played backw)6.147 F(ards)-.1 E 1.623(and an)108 271.2 +R 4.123(yn)-.15 G 1.624(ecessary reco)-4.123 F -.15(ve)-.15 G 1.624 +(ry operations are initiated through the).15 F F1 -.37(re)4.124 G(co).37 +E(ver)-.1 E F0 1.624(function speci\214ed to)4.124 F F1(txn_open)4.124 E +F0(.).24 E .632(After reco)108 283.2 R -.15(ve)-.15 G .631(ry is completed, all locks held by the transaction are acquired by the parent transaction in the) +.15 F .272(case of a nested transaction or released in the case of a non-nested transaction.) +108 295.2 R .273(As is the case for)5.273 F F1(txn_com-)2.773 E(mit)108 +307.2 Q F0 2.5(,a).68 G(pplications that require strict tw)-2.5 E 2.5 +(op)-.1 G(hase locking should not e)-2.5 E(xplicitly release an)-.15 E +2.5(yl)-.15 G(ocks.)-2.5 E(The)108 324 Q F1(txn_abort)2.5 E F0 +(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E F1(txn_id)92 340.8 Q F0(The)108 352.8 Q +F1(txn_id)3.877 E F0 1.376(function returns the unique transaction id associated with the speci\214ed transaction.) +3.877 F(Locking)6.376 E .043 +(calls made on behalf of this transaction should use the v)108 364.8 R +.043(alue returned from)-.25 F F1(txn_id)2.543 E F0 .043(as the lock) +2.543 F .043(er parameter to)-.1 F(the)108 376.8 Q F1(loc)2.5 E(k_g)-.2 +E(et)-.1 E F0(or)2.5 E F1(loc)2.5 E(k_vec)-.2 E F0(calls.)2.5 E F1 +(txn_close)92 393.6 Q F0(The)108 405.6 Q F1(txn_close)3.867 E F0 1.366 +(function detaches a process from the transaction en)3.867 F 1.366 +(vironment speci\214ed by the DB_TXN-)-.4 F .26(MGR pointer)108 417.6 R +5.26(.A)-.55 G .26(ll mapped re)-5.26 F .261(gions are unmapped and an) +-.15 F 2.761(ya)-.15 G .261(llocated resources are freed.)-2.761 F(An) +5.261 E 2.761(yu)-.15 G(ncommitted)-2.761 E(transactions are aborted.) +108 429.6 Q .436(In addition, if the)108 446.4 R F1(dir)2.936 E F0(ar) +2.936 E .436(gument to)-.18 F F1(txn_open)2.936 E F0 -.1(wa)2.936 G +2.936(sN).1 G .436(ULL and)-2.936 F F1(dben)2.936 E(v)-.4 E F0 -.1(wa) +2.936 G 2.936(sn).1 G .436(ot initialized using)-2.936 F F1(db_appinit) +2.935 E F0 2.935(,a).68 G(ll)-2.935 E +(\214les created for this shared re)108 458.4 Q(gion will be remo)-.15 E +-.15(ve)-.15 G(d, as if).15 E F1(txn_unlink)2.5 E F0(were called.)2.5 E +.403(When multiple threads are using the DB_TXNMGR handle concurrently) +108 475.2 R 2.903(,o)-.65 G .404(nly a single thread may call the)-2.903 +F F1(txn_close)108 487.2 Q F0(function.)2.5 E(The)108 504 Q F1 +(txn_close)2.5 E F0(function returns the v)2.5 E(alue of)-.25 E F1 +(errno)2.5 E F0(on f)2.5 E(ailure and 0 on success.)-.1 E F1(txn_unlink) +92 532.8 Q F0(The)108 544.8 Q F1(txn_unlink)3.595 E F0 1.095 +(function destro)3.595 F 1.094(ys the transaction re)-.1 F 1.094 +(gion identi\214ed by the directory)-.15 F F1(dir)3.594 E F0 3.594(,r) +.73 G(emo)-3.594 E 1.094(ving all \214les)-.15 F .957 +(used to implement the transaction re)108 556.8 R 3.457(gion. \(The)-.15 +F(directory)3.457 E F1(dir)3.457 E F0 .957(is not remo)3.457 F -.15(ve) +-.15 G 3.457(d.\) If).15 F .957(there are processes that)3.457 F(ha)108 +568.8 Q 2.027 -.15(ve c)-.2 H(alled).15 E F1(txn_open)4.227 E F0 1.726 +(without calling)4.226 F F1(txn_close)4.226 E F0 1.726 +(\(i.e., there are processes currently using the transaction)4.226 F(re) +108 580.8 Q(gion\),)-.15 E F1(txn_unlink)2.635 E F0 .135(will f)2.635 F +.135(ail without further action, unless the force \215ag is set, in which case) +-.1 F F1(txn_unlink)2.636 E F0(will)2.636 E(attempt to remo)108 592.8 Q +.3 -.15(ve t)-.15 H(he transaction re).15 E(gion \214les re)-.15 E -.05 +(ga)-.15 G(rdless of an).05 E 2.5(yp)-.15 G +(rocesses still using the transaction re)-2.5 E(gion.)-.15 E .766 +(The result of attempting to forcibly destro)108 609.6 R 3.266(yt)-.1 G +.766(he re)-3.266 F .766(gion when a process has the re)-.15 F .765 +(gion open is unspeci\214ed.)-.15 F 1.232 +(Processes using a shared memory re)108 621.6 R 1.232 +(gion maintain an open \214le descriptor for it.)-.15 F 1.232 +(On UNIX systems, the)6.232 F(re)108 633.6 Q .474(gion remo)-.15 F -.25 +(va)-.15 G 2.974(ls).25 G .473(hould succeed and processes that ha) +-2.974 F .773 -.15(ve a)-.2 H .473(lready joined the re).15 F .473 +(gion should continue to run in)-.15 F 1.059(the re)108 645.6 R 1.059 +(gion without change, ho)-.15 F(we)-.25 E -.15(ve)-.25 G 3.559(rp).15 G +1.059(rocesses attempting to join the transaction re)-3.559 F 1.06 +(gion will either f)-.15 F 1.06(ail or)-.1 F .811 +(attempt to create a ne)108 657.6 R 3.311(wr)-.25 G -.15(eg)-3.311 G +3.311(ion. On).15 F .811(other systems, e.g., WNT)3.311 F 3.31(,w)-.74 G +.81(here the)-3.31 F F1(unlink)3.31 E F0 .81(\(2\) system call will f) +.67 F .81(ail if)-.1 F(an)108 669.6 Q 2.5(yp)-.15 G +(rocess has an open \214le descriptor for the \214le, the re)-2.5 E +(gion remo)-.15 E -.25(va)-.15 G 2.5(lw).25 G(ill f)-2.5 E(ail.)-.1 E +.929(In the case of catastrophic or system f)108 686.4 R .929 +(ailure, database reco)-.1 F -.15(ve)-.15 G .93 +(ry must be performed \(see).15 F F1(db_r)3.43 E(eco)-.37 E(ver)-.1 E F0 +.93(\(1\) or).73 F .74(the DB_RECO)108 698.4 R .74(VER and DB_RECO)-.5 F +(VER_F)-.5 E -1.21 -1.11(AT A)-.74 H 3.24<4c8d>1.11 G .74(ags to)-3.24 F +F1(db_appinit)3.24 E F0 3.24(\(3\)\). Alternati).68 F -.15(ve)-.25 G(ly) +.15 E 3.24(,i)-.65 G 3.24(fr)-3.24 G(eco)-3.24 E -.15(ve)-.15 G .74 +(ry is not).15 F 1.473 +(required because no database state is maintained across f)108 710.4 R +1.473(ailures, it is possible to clean up a transaction)-.1 F(re)108 +722.4 Q .409(gion by remo)-.15 F .409 +(ving all of the \214les in the directory speci\214ed to the)-.15 F F1 +(txn_open)2.909 E F0 .408(function, as transaction re)2.909 F(gion)-.15 +E(May 10, 1998)278.085 768 Q(4)201.085 E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 363.3(DB_TXN\(3\) DB_TXN\(3\))72 48 R .872 +(\214les are ne)108 84 R -.15(ve)-.25 G 3.373(rc).15 G .873 +(reated in an)-3.373 F 3.373(yd)-.15 G .873 +(irectory other than the one speci\214ed to)-3.373 F/F1 10 +/Times-Italic@0 SF(txn_open)3.373 E F0 5.873(.N).24 G .873(ote, ho) +-5.873 F(we)-.25 E -.15(ve)-.25 G 1.673 -.4(r, t).15 H .873(hat this).4 +F(has the potential to remo)108 96 Q .3 -.15(ve \214)-.15 H +(les created by the other DB subsystems in this database en).15 E +(vironment.)-.4 E(The)108 112.8 Q F1(txn_unlink)2.5 E F0 +(function returns the v)2.5 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E F1(txn_c)92 129.6 Q(hec)-.15 E(kpoint) +-.2 E F0(The)108 141.6 Q F1(txn_c)3.069 E(hec)-.15 E(kpoint)-.2 E F0 +.569(function syncs the underlying memory pool, writes a checkpoint record to the log and) +3.069 F(then \215ushes the log.)108 153.6 Q .507(If either)108 170.4 R +F1(kbyte)3.007 E F0(or)3.008 E F1(min)3.008 E F0 .508 +(is non-zero, the checkpoint is only done if more than)3.008 F F1(min) +3.008 E F0 .508(minutes ha)3.008 F .808 -.15(ve p)-.2 H .508 +(assed since).15 F(the last checkpoint, or if more than)108 182.4 Q F1 +(kbyte)2.5 E F0(kilobytes of log data ha)2.5 E .3 -.15(ve b)-.2 H +(een written since the last checkpoint.).15 E(The)108 199.2 Q F1(txn_c) +2.815 E(hec)-.15 E(kpoint)-.2 E F0 .315(function returns the v)2.815 F +.315(alue of)-.25 F F1(errno)2.815 E F0 .315(on f)2.815 F .314 +(ailure, 0 on success, and DB_INCOMPLETE if)-.1 F .274 +(there were pages that needed to be written b)108 211.2 R .275(ut that) +-.2 F F1(memp_sync)2.775 E F0 .275(\(3\) w).31 F .275 +(as unable to write immediately)-.1 F 5.275(.I)-.65 G 2.775(nt)-5.275 G +(his)-2.775 E(case, the)108 223.2 Q F1(txn_c)2.5 E(hec)-.15 E(kpoint)-.2 +E F0(call should be retried.)2.5 E(The)108 240 Q F1(txn_c)2.537 E(hec) +-.15 E(kpoint)-.2 E F0 .037 +(function is the underlying function used by the)2.537 F F1(db_c)2.536 E +(hec)-.15 E(kpoint)-.2 E F0 .036(\(1\) utility).68 F 5.036(.S)-.65 G +.036(ee the source)-5.036 F(code for the)108 252 Q F1(db_c)2.5 E(hec) +-.15 E(kpoint)-.2 E F0(utility for an e)2.5 E(xample of using)-.15 E F1 +(txn_c)2.5 E(hec)-.15 E(kpoint)-.2 E F0(in a UNIX en)2.5 E(vironment.) +-.4 E F1(txn_stat)92 268.8 Q F0(The)108 280.8 Q F1(txn_stat)2.745 E F0 +.246(function creates a statistical structure and copies a pointer to it into the user) +2.745 F .246(-speci\214ed memory)-.2 F(location.)108 292.8 Q .292 +(Statistical structure are created in allocated memory)108 309.6 R 5.292 +(.I)-.65 G(f)-5.292 E F1(db_malloc)2.792 E F0 .292 +(is non-NULL, it is called to allocate the)2.792 F(memory)108 321.6 Q +2.829(,o)-.65 G .329(therwise, the library function)-2.829 F F1(malloc) +2.829 E F0 .329(\(3\) is used.).31 F .329(The function)5.329 F F1 +(db_malloc)2.829 E F0 .33(must match the calling)2.83 F(con)108 333.6 Q +-.15(ve)-.4 G 2.031(ntions of the).15 F F1(malloc)4.531 E F0 2.031 +(\(3\) library routine.).31 F(Re)7.031 E -.05(ga)-.15 G 2.031 +(rdless, the caller is responsible for deallocating the).05 F .707 +(returned memory)108 345.6 R 5.707(.T)-.65 G 3.207(od)-6.507 G .708 +(eallocate the returned memory)-3.207 F 3.208(,f)-.65 G .708 +(ree each returned memory pointer; pointers inside)-3.208 F +(the memory do not need to be indi)108 357.6 Q(vidually freed.)-.25 E +1.23(The transaction re)108 374.4 R 1.23 +(gion statistics are stored in a structure of type DB_TXN_ST)-.15 F 3.45 +-1.11(AT \()-.93 H -1.95(typedef ')1.11 F 3.73(di)-.5 G 3.73(n<)-3.73 G +(db)-3.73 E(.h>\).)-.4 E(The follo)108 386.4 Q(wing DB_TXN_ST)-.25 E +2.22 -1.11(AT \214)-.93 H(elds will be \214lled in:)1.11 E +(u_int32_t st_refcnt;)108 403.2 Q(The number of references to the re)133 +415.2 Q(gion.)-.15 E(u_int32_t st_re)108 427.2 Q(gsize;)-.15 E +(The size of the re)133 439.2 Q(gion.)-.15 E(DB_LSN st_last_ckp;)108 +451.2 Q(The LSN of the last checkpoint.)133 463.2 Q +(DB_LSN st_pending_ckp;)108 475.2 Q 3.142(The LSN of an)133 487.2 R +5.642(yc)-.15 G 3.142(heckpoint that is currently in progress.)-5.642 F +(If)8.142 E F1(st_pending_c)5.642 E(kp)-.2 E F0 3.142(is the same as) +5.642 F F1(st_last_c)133 499.2 Q(kp)-.2 E F0 +(there is no checkpoint in progress.)2.5 E(time_t st_time_ckp;)108 511.2 +Q(The time the last completed checkpoint \214nished \(as returned by)133 +523.2 Q F1(time)2.5 E F0(\(2\)\).).18 E(u_int32_t st_last_txnid;)108 +535.2 Q(The last transaction ID allocated.)133 547.2 Q +(u_int32_t st_maxtxns;)108 559.2 Q(The maximum number of acti)133 571.2 +Q .3 -.15(ve t)-.25 H(ransactions supported by the re).15 E(gion.)-.15 E +(u_int32_t st_naborts;)108 583.2 Q(The number of transactions that ha) +133 595.2 Q .3 -.15(ve a)-.2 H(borted.).15 E(u_int32_t st_nacti)108 +607.2 Q -.15(ve)-.25 G(;).15 E +(The number of transactions that are currently acti)133 619.2 Q -.15(ve) +-.25 G(.).15 E(u_int32_t st_nbe)108 631.2 Q(gins;)-.15 E +(The number of transactions that ha)133 643.2 Q .3 -.15(ve b)-.2 H -.15 +(eg).15 G(un.).15 E(u_int32_t st_ncommits;)108 655.2 Q +(The number of transactions that ha)133 667.2 Q .3 -.15(ve c)-.2 H +(ommitted.).15 E(u_int32_t st_re)108 679.2 Q(gion_w)-.15 E(ait;)-.1 E +(The number of times that a thread of control w)133 691.2 Q +(as forced to w)-.1 E(ait before obtaining the re)-.1 E(gion lock.)-.15 +E(u_int32_t st_re)108 703.2 Q(gion_no)-.15 E -.1(wa)-.25 G(it;).1 E +(The number of times that a thread of control w)133 715.2 Q +(as able to obtain the re)-.1 E(gion lock without w)-.15 E(aiting.)-.1 E +(May 10, 1998)278.085 768 Q(5)201.085 E EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 363.3(DB_TXN\(3\) DB_TXN\(3\))72 48 R(DB_TXN_A) +108 84 Q(CTIVE *st_txnarray;)-.4 E 4.106(Ap)133 96 S 1.606 +(ointer to an array of)-4.106 F/F1 10/Times-Italic@0 SF(st_nactive)4.106 +E F0(DB_TXN_A)4.106 E 1.606 +(CTIVE structures, describing the currently acti)-.4 F -.15(ve)-.25 G +2.995(transactions. The)133 108 R(follo)2.995 E .495 +(wing \214elds of the DB_TXN_A)-.25 F .495(CTIVE structure \(typedef)-.4 +F 1.495 -.5('d i).55 H 2.995(n<).5 G(db)-2.995 E .495(.h>\) will be)-.4 +F(\214lled in:)133 120 Q(u_int32_t txnid;)133 148.8 Q +(The transaction ID as returned by)158 160.8 Q F1(txn_be)2.5 E(gin)-.4 E +F0(\(3\).).24 E(DB_LSN lsn;)133 172.8 Q(The LSN of the transaction-be) +158 184.8 Q(gin record.)-.15 E/F2 9/Times-Bold@0 SF(TRANSA)72 206.4 Q +(CTIONS)-.495 E F0 .727(Creating transaction protected applications using the DB access methods requires little system customiza-) +108 218.4 R 3.254(tion. In)108 230.4 R .754(most cases, the def)3.254 F +.754(ault parameters to the locking, logging, memory pool, and transaction subsys-) +-.1 F 1.931(tems will suf)108 242.4 R 4.431(\214ce. Applications)-.25 F +1.931(can use)4.431 F F1(db_appinit)4.431 E F0 1.931 +(\(3\) to perform this initialization, or the).68 F 4.43(ym)-.15 G 1.93 +(ay do it)-4.43 F -.15(ex)108 254.4 S(plicitly).15 E(.)-.65 E 1.318 +(Each database operation \(i.e., an)108 271.2 R 3.818(yc)-.15 G 1.319 +(all to a function underlying the handles returned by)-3.818 F F1 +(db_open)3.819 E F0 1.319(\(3\) and).24 F F1(db_cur)108 283.2 Q(sor)-.1 +E F0 .565(\(3\)\) is normally performed on behalf of a unique lock).73 F +(er)-.1 E 5.565(.I)-.55 G 3.065(fm)-5.565 G .564 +(ultiple calls on behalf of the same)-3.065 F(lock)108 295.2 Q +(er are desired, then transactions must be used.)-.1 E .498(Once the application has initialized the DB subsystems that it is using, it may open the DB access method) +108 312 R 3.032(databases. F)108 324 R .532(or applications performing transactions, the databases must be opened after subsystem initial-) +-.15 F .533(ization, and cannot be opened as part of a transaction.)108 +336 R .533(Once the databases are opened, the application can)5.533 F +1.217(group sets of operations into transactions, by surrounding the operations with the appropriate) +108 348 R F1(txn_be)3.716 E(gin)-.4 E F0(,).24 E F1(txn_commit)108 360 Q +F0(and)2.509 E F1(txn_abort)2.509 E F0 2.509(calls. Databases)2.509 F +.009(accessed by a transaction must not be closed during the transac-) +2.509 F 2.529(tion. Note,)108 372 R .029(it is not necessary to transaction protect read-only transactions, unless those transactions require) +2.529 F(repeatable reads.)108 384 Q .485(The DB access methods will mak) +108 400.8 R 2.985(et)-.1 G .485 +(he appropriate calls into the lock, log and memory pool subsystems in) +-2.985 F 1.164 +(order to guarantee that transaction semantics are applied.)108 412.8 R +1.164(When the application is ready to e)6.164 F 1.163(xit, all out-) +-.15 F 1.033(standing transactions should ha)108 424.8 R 1.333 -.15 +(ve b)-.2 H 1.034(een committed or aborted.).15 F 1.034 +(At this point, all open DB \214les should be)6.034 F 2.843 +(closed. Once)108 436.8 R .342(the DB database \214les are closed, the DB subsystems should be closed, either e) +2.843 F .342(xplicitly or by)-.15 F(calling)108 448.8 Q F1(db_appe)2.5 E +(xit)-.2 E F0(\(3\).).68 E 1.611(It is also possible to use the locking, logging and transaction subsystems of DB to pro) +108 465.6 R 1.612(vide transaction)-.15 F .598(semantics to objects other than those described by the DB access methods.) +108 477.6 R .598(In these cases, the application)5.598 F 1.081 +(will need more e)108 489.6 R 1.081 +(xplicit customization of the subsystems as well as the de)-.15 F -.15 +(ve)-.25 G 1.082(lopment of appropriate data-).15 F +(structure-speci\214c reco)108 501.6 Q -.15(ve)-.15 G(ry functions.).15 +E -.15(Fo)108 518.4 S 2.89(re).15 G .39 +(xample, consider an application that pro)-3.04 F .389 +(vides transaction semantics to data stored in plain UNIX \214les)-.15 F +1.098(accessed using the)108 530.4 R F1 -.37(re)3.598 G(ad).37 E F0 +1.098(\(2\) and).77 F F1(write)3.598 E F0 1.098(\(2\) system calls.).18 +F 1.099(The operations for which transaction protection is)6.099 F +(desired are brack)108 542.4 Q(eted by calls to)-.1 E F1(txn_be)2.5 E +(gin)-.4 E F0(and)2.5 E F1(txn_commit)2.5 E F0(.).68 E .26 +(Before data are referenced, the application must mak)108 559.2 R 2.76 +(eac)-.1 G .259(all to the lock manager)-2.76 F(,)-.4 E F1(db_loc)2.759 +E(k)-.2 E F0 2.759(,f).67 G .259(or a lock of the)-2.759 F .901 +(appropriate type \(e.g., read\) on the object being lock)108 571.2 R +3.401(ed. The)-.1 F .901 +(object might be a page in the \214le, a byte, a)3.401 F .041 +(range of bytes, or some k)108 583.2 R -.15(ey)-.1 G 5.041(.I)-.5 G +2.541(ti)-5.041 G 2.541(su)-2.541 G 2.541(pt)-2.541 G 2.541(ot)-2.541 G +.04(he application to ensure that appropriate locks are acquired.)-2.541 +F(Before)5.04 E 3.357(aw)108 595.2 S .858(rite is performed, the application should acquire a write lock on the object, by making an appropriate) +-3.357 F .41(call to the lock manager)108 607.2 R(,)-.4 E F1(db_loc)2.91 +E(k)-.2 E F0 5.41(.T).67 G .41(hen, the application should mak)-5.41 F +2.909(eac)-.1 G .409(all to the log manager)-2.909 F(,)-.4 E F1(db_lo) +2.909 E(g)-.1 E F0 2.909(,t).22 G(o)-2.909 E .059 +(record enough information to redo the operation in case of f)108 619.2 +R .06(ailure after commit and to undo the operation in)-.1 F .47 +(case of abort.)108 631.2 R .47(As discussed in the)5.47 F F1(db_lo)2.97 +E(g)-.1 E F0 .47 +(\(3\) manual page, the application is responsible for pro).22 F .47 +(viding an)-.15 F(y)-.15 E 1.033(necessary structure to the log record.) +108 643.2 R -.15(Fo)6.034 G 3.534(re).15 G 1.034 +(xample, the application must understand what part of the log)-3.684 F +.481(record is an operation code, what part identi\214es the \214le being modi\214ed, what part is redo information, and) +108 655.2 R(what part is undo information.)108 667.2 Q 1.298(After the log message is written, the application may issue the write system call.) +108 684 R 1.299(After all requests are)6.299 F 1.29 +(issued, the application may call)108 696 R F1(txn_commit)3.79 E F0 6.29 +(.W).68 G(hen)-6.29 E F1(txn_commit)3.79 E F0 1.29 +(returns, the caller is guaranteed that all)3.79 F +(necessary log writes ha)108 708 Q .3 -.15(ve b)-.2 H +(een written to disk.).15 E 1.081(At an)108 724.8 R 3.581(yt)-.15 G +1.081(ime, the application may call)-3.581 F F1(txn_abort)3.581 E F0 +3.581(,w).68 G 1.081(hich will result in the appropriate calls to the) +-3.581 F F1 -.37(re)3.582 G(co).37 E(ver)-.1 E F0(May 10, 1998)278.085 +768 Q(6)201.085 E EP +%%Page: 7 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 363.3(DB_TXN\(3\) DB_TXN\(3\))72 48 R .315 +(function to restore the `)108 84 R(`database')-.74 E 2.815('t)-.74 G +2.815(oac)-2.815 G .315(onsistent pre-transaction state.)-2.815 F .314 +(\(The reco)5.315 F -.15(ve)-.15 G 2.814(rf).15 G .314 +(unction must be able)-2.814 F +(to either re-apply or undo the update depending on the conte)108 96 Q +(xt, for each dif)-.15 E(ferent type of log record.\))-.25 E .746 +(If the application should crash, the reco)108 112.8 R -.15(ve)-.15 G +.746(ry process uses the).15 F/F1 10/Times-Italic@0 SF(db_lo)3.246 E(g) +-.1 E F0(interf)3.246 E .746(ace to read the log and call the)-.1 F F1 +-.37(re)108 124.8 S(co).37 E(ver)-.1 E F0 +(function to restore the database to a consistent state.)2.5 E(The)108 +141.6 Q F1(txn_pr)3.098 E(epar)-.37 E(e)-.37 E F0 .598(function pro) +3.098 F .598(vides the core functionality to implement distrib)-.15 F +.597(uted transactions, b)-.2 F .597(ut it does)-.2 F 2.288 +(not manage the noti\214cation of distrib)108 153.6 R 2.288 +(uted transaction managers.)-.2 F 2.289 +(The caller is responsible for issuing)7.289 F F1(txn_pr)108 165.6 Q +(epar)-.37 E(e)-.37 E F0 1.295 +(calls to all sites participating in the transaction.)3.795 F 1.294 +(If all responses are positi)6.294 F -.15(ve)-.25 G 3.794(,t).15 G 1.294 +(he caller can)-3.794 F .822(issue a)108 177.6 R F1(txn_commit)3.322 E +F0 5.822(.I).68 G 3.322(fa)-5.822 G 1.122 -.15(ny o)-3.322 H 3.322(ft) +.15 G .822(he responses are ne)-3.322 F -.05(ga)-.15 G(ti).05 E -.15(ve) +-.25 G 3.322(,t).15 G .823(he caller should issue a)-3.322 F F1 +(txn_abort)3.323 E F0 5.823(.I).68 G 3.323(ng)-5.823 G(eneral,)-3.323 E +(the)108 189.6 Q F1(txn_pr)2.5 E(epar)-.37 E(e)-.37 E F0 +(call requires that the transaction log be \215ushed to disk.)2.5 E/F2 9 +/Times-Bold@0 SF(TRANSA)72 206.4 Q(CTION ID LIMITS)-.495 E F0 .165 +(The transaction ID space in Berk)108 218.4 R(ele)-.1 E 2.665(yD)-.15 G +2.665(Bi)-2.665 G 2.665(s2)-2.665 G .165(^31, or 2 billion entries.) +-2.665 F .165(It is possible that some en)5.165 F(vironments)-.4 E .422 +(may need to be a)108 230.4 R -.1(wa)-.15 G .422(re of this limitation.) +.1 F .423 +(Consider an application performing 600 transactions a second for)5.422 +F(15 hours a day)108 242.4 Q 5(.T)-.65 G +(he transaction ID space will run out in roughly 66 days:)-5 E +(2^31 / \(600 * 15 * 60 * 60\) = 66)144 259.2 Q +(Doing only 100 transactions a second e)108 276 Q +(xhausts the transaction ID space in roughly one year)-.15 E(.)-.55 E +1.049(The transaction ID space is reset each time reco)108 292.8 R -.15 +(ve)-.15 G 1.048(ry is run.).15 F 1.048 +(If you reach the end of your transaction ID)6.048 F 1.262 +(space, shut do)108 304.8 R 1.263 +(wn your applications and restart them after running reco)-.25 F -.15 +(ve)-.15 G 1.263(ry \(see).15 F F1(db_r)3.763 E(eco)-.37 E(ver)-.1 E F0 +1.263(\(1\) for more).73 F 2.823(information\). The)108 316.8 R .323 +(most recently allocated transaction ID is the)2.823 F F1(st_last_txnid) +2.823 E F0 -.25(va)2.823 G .323(lue in the transaction statis-).25 F +(tics information, and is displayed by the)108 328.8 Q F1(db_stat)2.5 E +F0(\(1\) utility).68 E(.)-.65 E F2(ENVIR)72 345.6 Q(ONMENT V)-.27 E +(ARIABLES)-1.215 E F0(The follo)108 357.6 Q(wing en)-.25 E(vironment v) +-.4 E(ariables af)-.25 E(fect the e)-.25 E -.15(xe)-.15 G(cution of).15 +E F1(db_txn)2.5 E F0(:).24 E(DB_HOME)108 374.4 Q 2.886(If the)133 386.4 +R F1(dben)5.386 E(v)-.4 E F0(ar)5.386 E 2.886(gument to)-.18 F F1 +(txn_open)5.387 E F0 -.1(wa)5.387 G 5.387(si).1 G 2.887 +(nitialized using)-5.387 F F1(db_appinit)5.387 E F0 5.387(,t).68 G 2.887 +(he en)-5.387 F 2.887(vironment v)-.4 F(ariable)-.25 E .508(DB_HOME may be used as the path of the database home for the interpretation of the) +133 398.4 R F1(dir)3.008 E F0(ar)3.008 E(gument)-.18 E(to)133 410.4 Q F1 +(txn_open)2.5 E F0 2.5(,a).24 G 2.5(sd)-2.5 G(escribed in)-2.5 E F1 +(db_appinit)2.5 E F0(\(3\).).68 E(TMPDIR)108 427.2 Q .987(If the)133 +439.2 R F1(dben)3.487 E(v)-.4 E F0(ar)3.488 E .988(gument to)-.18 F F1 +(txn_open)3.488 E F0 -.1(wa)3.488 G 3.488(sN).1 G .988 +(ULL or not initialized using)-3.488 F F1(db_appinit)3.488 E F0 3.488 +(,t).68 G .988(he en)-3.488 F(vironment)-.4 E -.25(va)133 451.2 S .069(riable TMPDIR may be used as the directory in which to create the transaction re) +.25 F .068(gion, as described)-.15 F(in the)133 463.2 Q F1(txn_open)2.5 +E F0(section abo)2.5 E -.15(ve)-.15 G(.).15 E F2(ERR)72 480 Q(ORS)-.27 E +F0(The)108 492 Q F1(txn_open)3.291 E F0 .791(function may f)3.291 F .791 +(ail and return)-.1 F F1(errno)3.292 E F0 .792(for an)3.292 F 3.292(yo) +-.15 G 3.292(ft)-3.292 G .792(he errors speci\214ed for the follo)-3.292 +F .792(wing DB and)-.25 F(library functions: close\(2\), db_v)108 504 Q +(ersion\(3\), fcntl\(2\), f)-.15 E +(\215ush\(3\), lseek\(2\), malloc\(3\), memcp)-.25 E +(y\(3\), memset\(3\),)-.1 E(mmap\(2\), munmap\(2\), open\(2\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp) +108 516 Q(y\(3\), strdup\(3\), strerror\(3\),)-.1 E +(strlen\(3\), time\(3\), txn_unlink\(3\), unlink\(2\), and write\(2\).) +108 528 Q(In addition, the)108 544.8 Q F1(txn_open)2.5 E F0 +(function may f)2.5 E(ail and return)-.1 E F1(errno)2.5 E F0 +(for the follo)2.5 E(wing conditions:)-.25 E([EINV)108 561.6 Q(AL])-1.35 +E(An in)133 573.6 Q -.25(va)-.4 G(lid \215ag v).25 E +(alue or parameter w)-.25 E(as speci\214ed.)-.1 E +(The DB_THREAD \215ag w)133 597.6 Q(as speci\214ed and spinlocks are not implemented for this architecture.) +-.1 E(The)133 621.6 Q F1(dben)2.5 E(v)-.4 E F0(parameter w)2.5 E +(as NULL.)-.1 E([EA)108 638.4 Q(GAIN])-.4 E(The shared memory re)133 +650.4 Q(gion w)-.15 E(as lock)-.1 E(ed and \(repeatedly\) una)-.1 E -.25 +(va)-.2 G(ilable.).25 E(The)108 667.2 Q F1(txn_be)3.16 E(gin)-.4 E F0 +.66(function may f)3.16 F .66(ail and return)-.1 F F1(errno)3.16 E F0 +.659(for an)3.16 F 3.159(yo)-.15 G 3.159(ft)-3.159 G .659 +(he errors speci\214ed for the follo)-3.159 F .659(wing DB and)-.25 F +(library functions: fcntl\(2\), f)108 679.2 Q +(\215ush\(3\), log_put\(3\), lseek\(2\), malloc\(3\), memcp)-.25 E +(y\(3\), memset\(3\), mmap\(2\),)-.1 E +(munmap\(2\), strerror\(3\), and write\(2\).)108 691.2 Q +(In addition, the)108 708 Q F1(txn_be)2.5 E(gin)-.4 E F0(function may f) +2.5 E(ail and return)-.1 E F1(errno)2.5 E F0(for the follo)2.5 E +(wing conditions:)-.25 E(May 10, 1998)278.085 768 Q(7)201.085 E EP +%%Page: 8 8 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 363.3(DB_TXN\(3\) DB_TXN\(3\))72 48 R([ENOSPC]) +108 84 Q +(The maximum number of concurrent transactions has been reached.)133 96 +Q(The)108 112.8 Q/F1 10/Times-Italic@0 SF(txn_pr)2.654 E(epar)-.37 E(e) +-.37 E F0 .154(function may f)2.654 F .154(ail and return)-.1 F F1 +(errno)2.654 E F0 .154(for an)2.654 F 2.654(yo)-.15 G 2.654(ft)-2.654 G +.154(he errors speci\214ed for the follo)-2.654 F .153(wing DB and)-.25 +F(library functions: fcntl\(2\), f)108 124.8 Q +(\215ush\(3\), log_\215ush\(3\), and strerror\(3\).)-.25 E(The)108 141.6 +Q F1(txn_commit)2.736 E F0 .236(function may f)2.736 F .236 +(ail and return)-.1 F F1(errno)2.736 E F0 .236(for an)2.736 F 2.736(yo) +-.15 G 2.736(ft)-2.736 G .236(he errors speci\214ed for the follo)-2.736 +F .237(wing DB and)-.25 F(library functions: fcntl\(2\), f)108 153.6 Q +(\215ush\(3\), lock_v)-.25 E(ec\(3\), log_put\(3\), malloc\(3\), memcp) +-.15 E(y\(3\), and strerror\(3\).)-.1 E(In addition, the)108 170.4 Q F1 +(txn_commit)2.5 E F0(function may f)2.5 E(ail and return)-.1 E F1(errno) +2.5 E F0(for the follo)2.5 E(wing conditions:)-.25 E([EINV)108 187.2 Q +(AL])-1.35 E(The transaction w)133 199.2 Q(as aborted.)-.1 E(The)108 216 +Q F1(txn_abort)3.168 E F0 .668(function may f)3.168 F .668 +(ail and return)-.1 F F1(errno)3.168 E F0 .668(for an)3.168 F 3.168(yo) +-.15 G 3.168(ft)-3.168 G .668(he errors speci\214ed for the follo)-3.168 +F .667(wing DB and)-.25 F(library functions: DBen)108 228 Q(v->tx_reco) +-.4 E -.15(ve)-.15 G(r\(3\), fcntl\(2\), f).15 E(\215ush\(3\), lock_v) +-.25 E(ec\(3\), log_get\(3\), memset\(3\), and str)-.15 E(-)-.2 E +(error\(3\).)108 240 Q([EINV)108 256.8 Q(AL])-1.35 E(The transaction w) +133 268.8 Q(as already aborted.)-.1 E(The)108 285.6 Q F1(txn_c)2.951 E +(hec)-.15 E(kpoint)-.2 E F0 .451(function may f)2.951 F .451 +(ail and return)-.1 F F1(errno)2.951 E F0 .451(for an)2.951 F 2.951(yo) +-.15 G 2.95(ft)-2.951 G .45(he errors speci\214ed for the follo)-2.95 F +.45(wing DB)-.25 F(and library functions: fcntl\(2\), f)108 297.6 Q +(\215ush\(3\), log_compare\(3\), log_put\(3\), malloc\(3\), memcp)-.25 E +(y\(3\),)-.1 E +(memp_sync\(3\), memset\(3\), strerror\(3\), and time\(3\).)108 309.6 Q +([EINV)108 326.4 Q(AL])-1.35 E(An in)133 338.4 Q -.25(va)-.4 G +(lid \215ag v).25 E(alue or parameter w)-.25 E(as speci\214ed.)-.1 E +(The)108 355.2 Q F1(txn_close)3.23 E F0 .73(function may f)3.23 F .73 +(ail and return)-.1 F F1(errno)3.23 E F0 .73(for an)3.23 F 3.23(yo)-.15 +G 3.23(ft)-3.23 G .73(he errors speci\214ed for the follo)-3.23 F .73 +(wing DB and)-.25 F(library functions: close\(2\), fcntl\(2\), f)108 +367.2 Q(\215ush\(3\), log_\215ush\(3\), munmap\(2\), strerror\(3\), and txn_abort\(3\).) +-.25 E(The)108 384 Q F1(txn_unlink)2.982 E F0 .482(function may f)2.982 +F .483(ail and return)-.1 F F1(errno)2.983 E F0 .483(for an)2.983 F +2.983(yo)-.15 G 2.983(ft)-2.983 G .483 +(he errors speci\214ed for the follo)-2.983 F .483(wing DB and)-.25 F +(library functions: close\(2\), fcntl\(2\), f)108 396 Q +(\215ush\(3\), malloc\(3\), memcp)-.25 E +(y\(3\), memset\(3\), mmap\(2\), munmap\(2\),)-.1 E +(open\(2\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp)108 +408 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), and unlink\(2\).) +-.1 E(In addition, the)108 424.8 Q F1(txn_unlink)2.5 E F0 +(function may f)2.5 E(ail and return)-.1 E F1(errno)2.5 E F0 +(for the follo)2.5 E(wing conditions:)-.25 E([EB)108 441.6 Q(USY])-.1 E +(The shared memory re)133 453.6 Q(gion w)-.15 E +(as in use and the force \215ag w)-.1 E(as not set.)-.1 E(The)108 470.4 +Q F1(txn_stat)3.568 E F0 1.069(function may f)3.568 F 1.069 +(ail and return)-.1 F F1(errno)3.569 E F0 1.069(for an)3.569 F 3.569(yo) +-.15 G 3.569(ft)-3.569 G 1.069(he errors speci\214ed for the follo) +-3.569 F 1.069(wing DB and)-.25 F +(library functions: fcntl\(2\), and malloc\(3\).)108 482.4 Q/F2 9 +/Times-Bold@0 SF(SEE ALSO)72 499.2 Q F1 .904(LIBTP: P)108 511.2 R +(ortable)-.8 E 3.404(,M)-.1 G .904(odular T)-3.404 F -.15(ra)-.55 G .904 +(nsactions for UNIX).15 F F0 3.404(,M).94 G(ar)-3.404 E .904(go Seltzer) +-.18 F 3.403(,M)-.4 G .903(ichael Olson, USENIX proceedings,)-3.403 F +-.4(Wi)108 523.2 S(nter 1992.).4 E F2 -.09(BU)72 540 S(GS).09 E F0 +(Nested transactions are not yet implemented.)108 552 Q F1(db_ar)108 576 +Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E F1(db_c)2.5 E(hec)-.15 E +(kpoint)-.2 E F0(\(1\),).68 E F1(db_deadloc)2.5 E(k)-.2 E F0(\(1\),).67 +E F1(db_dump)2.5 E F0(\(1\),).19 E F1(db_load)2.5 E F0(\(1\),).77 E F1 +(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F1(db_stat)2.5 E F0 +(\(1\),).68 E F1(db_intr)108 588 Q(o)-.45 E F0(\(3\),).18 E F1 +(db_appinit)2.5 E F0(\(3\),).68 E F1(db_cur)2.5 E(sor)-.1 E F0(\(3\),) +.73 E F1(db_dbm)2.5 E F0(\(3\),).32 E F1(db_internal)2.5 E F0(\(3\),).51 +E F1(db_loc)2.5 E(k)-.2 E F0(\(3\),).67 E F1(db_lo)2.5 E(g)-.1 E F0 +(\(3\),).22 E F1(db_mpool)2.5 E F0(\(3\),).51 E F1(db_open)108 600 Q F0 +(\(3\),).24 E F1(db_thr)2.5 E(ead)-.37 E F0(\(3\),).77 E F1(db_txn)2.5 E +F0(\(3\)).24 E(May 10, 1998)278.085 768 Q(8)201.085 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/man.roff/db_appinit.3 b/mozilla/db/man/man.roff/db_appinit.3 new file mode 100644 index 00000000000..4f8f9d61fb4 --- /dev/null +++ b/mozilla/db/man/man.roff/db_appinit.3 @@ -0,0 +1,1622 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_appinit.so 10.45 (Sleepycat) 5/1/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_APPINIT 3 "May 1, 1998" +.UC 7 +.SH NAME +db_appinit \- initializing the DB environment +.SH SYNOPSIS +.nf +.ft B +#include + +char * +db_version(int *major, int *minor, int *patch); + +int +db_appinit(char *db_home, +.ti +5 +char *db_config[], DB_ENV *dbenv, u_int32_t flags); + +int +db_appexit(DB_ENV *dbenv); +.ft R +.fi +.SH DESCRIPTION +.Gn +.PP +.Fn db_version +The +.I db_version +function returns a pointer to a string containing DB version information. +If +.I major +is non-NULL, +the major version of the DB release is stored in the memory it references. +If +.I minor +is non-NULL, +the minor version of the DB release is stored in the memory it references. +If +.I patch +is non-NULL, +the patch version of the DB release is stored in the memory it references. +.PP +.Fn db_appinit +The +.I db_appinit +function provides a simple way to initialize and configure the DB +environment. +It is not necessary that it be called, +but it provides a method of creating a consistent environment for +processes using one or more of the features of DB. +.PP +The +.I db_home +and +.I db_config +arguments to +.I db_appinit +are described in the section below entitled ``FILE NAMING''. +.PP +The +.I flags +argument specifies the subsystems that are initialized +and how the environment affects DB file naming, +among other things. +The +.I flags +value is specified by +.BR or 'ing +together one or more of the following values: +.TP 5 +DB_CREATE +Cause subsystems to create any underlying files, as necessary. +(See +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3) +and +.IR db_txn (3) +for more information.) +.TP 5 +DB_INIT_LOCK +Initialize the lock subsystem; see +.IR db_lock (3). +This subsystem should be used when multiple processes or threads are +going to be reading and writing a DB database, +so that they do not interfere with each other. +If all threads are accessing the database(s) read-only, then locking +is unnecessary. +When the DB_INIT_LOCK flag is specified, it is usually necessary +to run the deadlock detector, +.IR db_deadlock (1), +as well. +.TP 5 +DB_INIT_LOG +Initialize the log subsystem; see +.IR db_log (3). +This subsystem is used when recovery from application or system +failure is important. +.TP 5 +DB_INIT_MPOOL +Initialize the mpool subsystem; see +.IR db_mpool (3). +This subsystem is used whenever the application is using the DB access +methods for any purpose. +.TP 5 +DB_INIT_TXN +Initialize the transaction subsystem; see +.IR db_txn (3). +This subsystem is used when atomicity of multiple operations +and recovery are important. +The DB_INIT_TXN flag implies the DB_INIT_LOG flag. +.TP 5 +DB_MPOOL_PRIVATE +Create a private memory pool (see +.IR db_mpool (3) +for further information). +Ignored unless DB_INIT_MPOOL is also specified. +.TP 5 +DB_NOMMAP +Do not map any files within this environment (see +.IR db_mpool (3) +for further information). +Ignored unless DB_INIT_MPOOL is also specified. +.TP 5 +DB_RECOVER +Run normal recovery on this environment before opening it for normal use. +If this flag is set, the DB_CREATE flag must also be set since the regions +will be removed and recreated. +.sp +The +.I db_appinit +function returns successfully if DB_RECOVER is specified and no log files +exist, so it is necessary to ensure all necessary log files are present +before running recovery. +For further information, consult the man page for +.IR db_archive (1) +and +.IR db_recover (1). +.TP 5 +DB_RECOVER_FATAL +Run catastrophic recovery on this environment before opening it for normal use. +If this flag is set, the DB_CREATE flag must also be set since the regions +will be removed and recreated. +.sp +The +.I db_appinit +function returns successfully if DB_RECOVER is specified and no log files +exist, so it is necessary to ensure all necessary log files are present +before running recovery. +For further information, consult the man page for +.IR db_archive (1) +and +.IR db_recover (1). +.TP 5 +DB_THREAD +Ensure that handles returned by the DB subsystems are useable by multiple +threads within a single process, i.e., that the system is ``free-threaded''. +(See +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3) +and +.IR db_txn (3) +for more information.) +.TP 5 +DB_TXN_NOSYNC +On transaction commit, do not synchronously flush the log (see +.IR db_txn (3) +for further information). +Ignored unless DB_INIT_TXN is also specified. +.TP 5 +DB_USE_ENVIRON +The DB process' environment may be permitted to specify information to +be used when naming files (see the section entitled ``FILE NAMING'' below). +As permitting users to specify which files are used can create security +problems, +environment information will be used in file naming for all users only +if the DB_USE_ENVIRON flag is set. +.TP 5 +DB_USE_ENVIRON_ROOT +The DB process' environment may be permitted to specify information to +be used when naming files (see the section entitled ``FILE NAMING'' below). +As permitting users to specify which files are used can create security +problems, +if the DB_USE_ENVIRON_ROOT flag is set, +environment information will be used for file naming only +for users with a user-ID matching that of the superuser (specifically, +users for whom the +.I getuid +system call returns the user-ID 0). +.PP +The DB environment is configured +.En "db_appinit" "db_appexit" +.TP 5 +void (*db_errcall)(char *db_errpfx, char *buffer); +When an error occurs in the DB package, an +.I errno +value is returned by the function. +In some cases, however, the +.I errno +value may be insufficient to completely describe the cause of the error. +.IP +If +.I db_errcall +is non-NULL, +it may be called with additional error information. +The +.I db_errpfx +argument is the current environment's +.I db_errpfx +field. +The +.I buffer +argument contains a nul-terminated string with the additional information. +.sp +This error logging facility should not be required for normal operation, +but may be useful in debugging applications. +.TP 5 +FILE *db_errfile; +The +.I db_errfile +field behaves similarly to the +.I db_errcall +field, +except that the error message is written to the file stream represented by +.IR db_errfile . +.sp +If +.I db_errpfx +is non-NULL, +the message will be preceded by the string referenced by +.IR db_errpfx , +a colon (``:'') and a space. +The message will be followed by a newline character. +.TP 5 +const char *db_errpfx; +A prefix to prepend to error messages. +Because DB does not copy the memory referenced by the +.I db_errpfx +field, +the application may modify the error message prefix at +any time. +.TP 5 +int db_verbose; +Include informational and debugging messages as well as error messages in the +.I db_errcall +and +.I db_errfile +output. +.PP +Each of the open functions that +.I db_appinit +may call (\fIlock_open\fP, \fIlog_open\fP, \fImemp_open\fP and \fItxn_open\fP) +is called as follows, +where the DB_CREATE flag is optional: +.sp +.ti +5 +XXX_open(NULL, DB_CREATE, +.ti +8 +S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, dbenv) +.PP +This call will cause each subsystem to construct pathnames as described in +the section on ``FILE NAMING''. +The subsystem has permission to read and write underlying files as necessary, +and optionally to create files. +(All created files will be created readable and writeable by the owner and +the group. +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB.) +.PP +In addition, the +.I dbenv +argument is passed to the open functions of any subsystems initialized by +.IR db_appinit . +For this reason the fields of the DB_ENV structure relevant to the +subsystems being initialized must themselves be initialized before +.I db_appinit +is called. +See the manual page for each subsystem for a list of these fields and +their uses. +.PP +The return value from each of these calls is placed in the appropriate +field of the DB_ENV structure: +.TP 5 +DB_LOCKTAB *lk_info; +The return value of the +.IR lock_open (3) +call. +.TP 5 +DB_LOG *lg_info; +The return value of the +.IR log_open (3) +call. +.TP 5 +DB_MPOOL *mp_info; +The return value of the +.IR memp_open (3) +call. +.TP 5 +DB_TXNMGR *tx_info; +The return value of the +.IR txn_open (3) +call. +.PP +In general, +these fields are not directly used by applications; subsystems of DB that +use these fields will simply reference them using the DB_ENV argument passed +to the subsystem. +.PP +For example, +an application using the DB hash access method functions to access a +database will first call +.I db_open +passing it the DB_ENV argument filled in by the initial call to +.IR db_appinit . +Then, +all future calls to the hash access method functions for that database will +automatically use the underlying shared memory buffer pool that was specified +by the +.I mp_info +field of that DB_ENV argument. +.PP +The single exception to this rule is the +.I tx_info +field, +which applications must explicitly specify to the +.IR txn_begin , +.I txn_checkpoint +and +.I txn_close +functions. +.PP +Once the DB environment has been initialized by a call to +.IR db_appinit , +no fields other than +.I db_errpfx +should be modified. +.PP +.Rt db_appinit +.PP +.Fn db_appexit +The +.I db_appexit +function closes the initialized DB subsystems, +freeing any allocated resources and closing any underlying subsystems. +.PP +When multiple threads are using the DB_ENV handle concurrently, +only a single thread may call the +.I db_appexit +function. +.PP +.Rt db_appexit +.SH "FILE NAMING" +The most important task of +.I db_appinit +is to structure file naming within DB. +.PP +Each of the locking, logging, +memory pool and transaction subsystems of DB require shared memory regions, +backed by the filesystem. +Further, +cooperating applications (or multiple invocations of the same application) +must agree on the location of the shared memory regions and other files used +by the DB subsystems, +the log files used by the logging subsystem, +and, of course, the data files. +.PP +Although it is possible to specify full pathnames to all DB functions, +this is cumbersome and requires that applications be recompiled when +database files are moved. +The +.I db_appinit +function makes it possible to place database files in a single directory, +or in multiple directories, +grouped by their function within the database. +.PP +Applications are normally expected to specify a single directory home for +their database. +This can be done easily in the call to +.I db_appinit +by specifying a value for the +.I db_home +argument. +There are more complex configurations where it may be desirable to override +.I db_home +or provide supplementary path information. +.PP +The following describes the possible ways in which file naming information +may be specified to the DB library. +The specific circumstances and order in which these ways are applied are +described in a subsequent paragraph. +.TP 5 +.I db_home +If the +.I db_home +argument to +.I db_appinit +is non-NULL, +its value may be used as the database home, +and files named relative to its path. +.TP 5 +DB_HOME +If the DB_HOME environment variable is set when +.I db_appinit +is called, +its value may be used as the database home, +and files named relative to its path. +.TP 5 +.I db_config +The +.I db_config +argument to +.I db_appinit +may be used to specify an array of character strings of the +format ``NAME VALUE'', +that specify file name information for the process' DB environment. +The whitespace delimiting the two parts of the entry may be one or +more or characters. +(Leading or trailing and characters are discarded.) +Each entry must specify both the NAME and the VALUE of the pair. +All entries with unrecognized NAME values will be ignored. +The +.I db_config +array must be NULL terminated. +.TP 5 +DB_CONFIG +The same information specified to the +.I db_config +argument to +.I db_appinit +may be specified using a configuration file. +If a database home directory has been specified (either by the +application specifying a non-NULL +.I db_home +argument to +.IR db_appinit , +or by the application setting the DB_USE_ENVIRON or DB_USE_ENVIRON_ROOT +flags and the DB_HOME environment variable being set), +any file named ``DB_CONFIG'' in the database home directory will be read +for lines of the format ``NAME VALUE''. +The whitespace delimiting the two parts of the line may be one or more + or characters. +(Leading or trailing and characters are discarded.) +All empty lines or lines whose first non-whitespace character is a +hash character (``#'') will be ignored. +Each line must specify both the NAME and the VALUE of the pair. +All lines with unrecognized NAME values will be ignored. +.PP +The following ``NAME VALUE'' pairs in the +.I db_config +argument and the DB_CONFIG file are currently supported by DB. +.TP 5 +DB_DATA_DIR +The path of a directory to be used as the location of the access method +data files, e.g., +paths specified to the +.IR db_open (3) +function will be relative to this path. +.IP +The DB_DATA_DIR paths are additive, +and specifying more than one will result in each specified directory being +searched for database data files. +If multiple paths are specified, +created data files will always be created in the +.B first +directory specified. +.TP 5 +DB_LOG_DIR +The path of a directory to be used as the location of logging files, e.g., +files created by the +.IR db_log (3) +subsystem will be relative to this directory. +If specified, +this is the directory name that will be passed to +.IR log_open (3). +.\".TP 5 +.\"DB_SUPPORT_DIR +.\"The path of a directory to be used as the location for shared memory +.\"segments, e.g., the supporting shared memory region for the shared +.\"memory buffer pool will be created in this directory. +.TP 5 +DB_TMP_DIR +The path of a directory to be used as the location of temporary files, e.g., +files created to back in-memory access method databases will be created +relative to this path. +Note, these temporary files can potentially be quite large, depending on the +size of the database. +.sp +If DB_TMP_DIR is not specified, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', ``TMP'' and ``TempFolder''. +If one of them is set, +temporary files are created relative to the directory it specifies. +.sp +If DB_TMP_DIR is not specified and none of the above environment variables +are set, +the first possible one of the following directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +The following describes the specific circumstances and order in which the +different ways of specifying file naming information are applied. +Specifically, +DB file name processing proceeds sequentially through the following steps: +.TP 5 +``/'' +If any file name specified to any DB function begins with a leading slash, +that file name is used without modification by DB. +.TP 5 +DB_CONFIG +If a relevant configuration string (e.g., DB_DATA_DIR), +is specified in the DB_CONFIG configuration file, +the VALUE from the ``NAME VALUE'' pair is prepended to the current file name. +If the resulting file name begins with a leading slash, +the file name is used without further modification by DB. +.sp +The DB_CONFIG configuration file is intended to permit systems to customize +file location for a database independent of applications using that database. +For example, +a database administrator can move the database log and data files to a +different location without application recompilation. +.TP 5 +.I db_config +If a relevant configuration string (e.g., DB_DATA_DIR), +is specified in the +.I db_config +argument and is not specified in the DB_CONFIG file, +the VALUE from the ``NAME VALUE'' pair is prepended to the current file name. +If the resulting file name begins with a leading slash, +the file name is used without further modification by DB. +.sp +The +.I db_config +argument is intended to permit applications to customize file location +for a database. +For example, +an application writer can place data files and log files in different +directories, +or instantiate a new log directory each time the application runs. +.TP 5 +DB_HOME +If the DB_HOME environment variable was set, +(and the application has set the appropriate DB_USE_ENVIRON or +DB_USE_ENVIRON_ROOT environment variable), +its value is prepended to the current file name. +If the resulting file name begins with a leading slash, +the file name is used without further modification by DB. +.sp +The DB_HOME environment variable is intended to permit users and system +administrators to override application and installation defaults, e.g., +.sp +.ti +5 +env DB_HOME=/database/my_home application +.sp +Alternatively, +application writers are encouraged to support the +.B \-h +option found in the supporting DB utilities to let users specify a database +home. +.TP 5 +.I db_home +If the application specified a non-NULL +.I db_home +argument to +.I db_appinit +(and the database home was not already specified using the DB_HOME +environment variable) its value is prepended to the current file name. +If the resulting file name begins with a leading slash, +the file name is used without further modification by DB. +.TP 5 +(nothing) +Finally, all file names are interpreted relative to the current working +directory of the process. +.PP +The common model for a DB environment is one where only the DB_HOME +environment variable, +or the +.I db_home +argument, is specified. +In this case, +all data files will be presumed to be relative to that directory, +and all files created by the DB subsystems will be created in that +directory. +.PP +The more complex model for a transaction environment might be one where +a database home is specified, +using either the DB_HOME environment variable or the +.I db_home +argument to +.IR db_appinit , +and then DB_DATA_DIR and DB_LOG_DIR are set to the relative path names +of directories underneath the home directory using the +.I db_config +argument to +.I db_appinit +or the DB_CONFIG file. +.SH EXAMPLES +Store all files in the directory +.IR /a/database : +.PP +.RS +.nf +db_appinit("/a/database", NULL, ...); +.fi +.RE +.PP +Create temporary backing files in +.IR /b/temporary , +and all other files in +.IR /a/database : +.PP +.RS +.nf +char *config[] = { + "DB_TMP_DIR /b/temporary", + NULL +}; + +db_appinit("/a/database", config, ...); +.fi +.RE +.PP +Store data files in +.IR /a/database/datadir , +log files in +.IR /a/database/logdir , +and all other files in the directory +.IR /a/database : +.PP +.RS +.nf +char *config[] = { + "DB_DATA_DIR datadir", + "DB_LOG_DIR logdir", + NULL +}; + +db_appinit("/a/database", config, ...); +.fi +.RE +.PP +Store data files in +.I /a/database/data1 +and +.IR /b/data2 , +and all other files in the directory +.IR /a/database . +Any data files that are created will be created in +.IR /b/data2 : +.PP +.RS +.nf +char *config[] = { + "DB_DATA_DIR /b/data2", + "DB_DATA_DIR data1", + NULL +}; + +db_appinit("/a/database", config, ...); +.fi +.RE +.PP +See the file +.I examples/ex_appinit.c +in the DB source distribution for a C language code example of how an +application might use +.I db_appinit +to configure its DB environment. +.SH ERRORS +.Ee db_appinit +.na +.Nh +DB->close(3), +calloc(3), +db_appexit(3), +fclose(3), +fcntl(2), +fflush(3), +fgets(3), +fopen(3), +lock_open(3), +lock_unlink(3), +log_compare(3), +log_get(3), +log_open(3), +log_unlink(3), +malloc(3), +memcpy(3), +memp_open(3), +memp_unlink(3), +memset(3), +realloc(3), +stat(2), +strchr(3), +strcmp(3), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +strsep(3), +time(3), +txn_checkpoint(3), +txn_open(3), +and +txn_unlink(3). +.Hy +.ad +.PP +.Ec db_appinit +.TP 5 +.Ei +.sp +.Et +.sp +The DB_RECOVER or DB_RECOVER_FATAL flag was specified, and no +log files were found. +.sp +The DB_HOME or TMPDIR environment variables were set but empty. +.sp +An incorrectly formatted ``NAME VALUE'' entry or line was found. +.TP 5 +[ENOSPC] +HP-UX only: a previously created DB environment for this process still +exists. +.PP +.Ee db_appexit +.na +.Nh +lock_close(3), +log_close(3), +memp_close(3), +and +txn_close(3). +.Hy +.ad +.SH "BUGS" +Due to the constraints of the PA-RISC memory architecture, +HP-UX does not allow a process to map a file into its address space +multiple times. +For this reason, +each DB environment may be opened only once by a process on HP-UX, +i.e., calls to +.I appinit +will fail if the specified DB environment has been opened and not +subsequently closed. +.PP +On Windows/95, files that are opened by multiple processes do not share +data correctly. To tell Berkeley DB to use the paging file to share +memory among processes, use the DB_REGION_NAME flag of the +.I db_value_set +function. +Obviously, you do not need to do this if only a single process will be +accessing database files. +.SH "SEE ALSO" +.Sa diff --git a/mozilla/db/man/man.roff/db_archive.1 b/mozilla/db/man/man.roff/db_archive.1 new file mode 100644 index 00000000000..03db0798f04 --- /dev/null +++ b/mozilla/db/man/man.roff/db_archive.1 @@ -0,0 +1,1062 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_archive.so 10.11 (Sleepycat) 5/3/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_ARCHIVE 1 "May 3, 1998" +.UC 7 +.SH NAME +db_archive \- the DB database archiver +.SH SYNOPSIS +\fBdb_archive\fP [\fB-alsv\fP] [\fB-h home\fP] +.SH DESCRIPTION +The +.I db_archive +utility writes the pathnames of log files that are no longer in use (e.g., +no longer involved in active transactions), +to the standard output, one pathname per line. +These log files should be written to backup media to provide for recovery +in the case of catastrophic failure (which also requires a snapshot of the +database files), +but they may then be deleted from the system to reclaim disk space. +.PP +The options are as follows: +.TP 5 +.B \-a +Write all pathnames as absolute pathnames, +instead of relative to the database home directories. +.TP 5 +.B \-h +Specify a home directory for the database. +.TP 5 +.B \-l +Write out the pathnames of all of the database log files, +whether or not they are involved in active transactions. +.TP 5 +.B \-s +Write the pathnames of all of the database files that need to be archived +in order to recover the database from catastrophic failure. +If any of the database files have not been accessed during the lifetime of +the current log files, +.I db_archive +will not include them in this output. +.sp +It is possible that some of the files referenced in the log have since +been deleted from the system. +In this case, +.I db_archive +will ignore them. +When +.IR db_recover (1) +is run, +any files referenced in the log that are not present during recovery are +assumed to have been deleted and will not be recovered. +.TP 5 +.B \-v +Run in verbose mode, listing the checkpoints in the log files as they +are reviewed. +.PP +.Si db_archive +.PP +.Ex db_archive +.SH "DB ARCHIVAL PROCEDURES +There are two aspects to managing the recoverability and disk consumption +of your DB databases. +First, you may want to periodically create snapshots of your databases +to make it possible to recover them from catastrophic failure. +Second, you'll want to periodically remove log files in order to conserve +on disk space. +The two procedures are distinct from each other, and you cannot remove the +current log files simply because you have created a database snapshot. +.PP +To create a snapshot of your database that can be used to recover +from catastrophic failure, the following steps should be taken: +.TP 5 +1. +Run +.I db_archive +\-s to identify all of the database data files that must be saved, +and copy them to a backup device, (e.g., tape). +If the database files are stored in a separate directory from the +other database files, it may be simpler to archive the directory +itself instead of the individual files. +.sp +.ft B +More importantly, if any of the database files have not been accessed during +the lifetime of the current log files, db_archive will not list them in its +output! +.ft R +For this reason, +it may be important to use a separate database file directory, +archiving it instead of the files listed by +.IR db_archive . +.TP 5 +2. +If your database is currently active, +i.e., you are reading and writing to the database files while the snapshot +is being taken, +run +.I db_archive +\-l to identify the database log files, +and copy them to a backup device, (e.g., tape). +If the database log files are stored in a separate directory from the +other database files, it may be simpler to archive the directory itself +instead of the individual files. +.PP +Note that the order of these operations is important, +and that the database files +.B must +be archived before the log files. +.PP +The DB library supports on-line backups, +and it is not necessary to stop reading or writing your databases during +the time when you create this snapshot. +Note however, +that the snapshot of an active database will be consistent as of some +unspecified time between the start of the archival and when archival is +completed. +To create a snapshot as of a specific time, +you must stop reading and writing your databases for the entire time of +the archival, force a checkpoint (see +.IR db_checkpoint (1)), +and then archive the files listed by the +.I db_archive +command's +.B \-s +and +.B \-l +options. +.PP +Once these steps are completed, +your database can be recovered from catastrophic failure to its state +as of the time the archival was done. +To update your snapshot so that recovery from catastrophic failure is +possible up to a new point in time, +repeat step #2, copying all existing log files to a backup device. +.PP +Each time that a complete snapshot is made, +i.e. all database and log files are copied to backup media, +you may discard all previous snapshots and saved log files. +.PP +The time to restore from catastrophic failure is a function of the number +of log records that have been written since the snapshot was originally +created. +Perhaps more importantly, +the more separate pieces of backup media you use, +the more likely that you will have a problem reading from one of them. +For these reasons, +it is often best to make snapshots on a regular basis. +.PP +.ft B +For archival safety remember to ensure that you have multiple copies of +your database backups, +that you verify that your archival media is error-free, +and that copies of your backups are stored off-site! +.ft R +.PP +To restore your database after catastrophic failure, +the following steps should be taken: +.TP 5 +1. +Restore the copies of the database files from the backup media. +.TP 5 +2. +Restore the copies of the log files from the backup media, +.BR "in the order in which they were written" . +(It's possible that the same log file appears on multiple backups, +and you only want the most recent version of that log file!) +.TP 5 +3. +Run +.I db_recover +\-c +to recover the database. +.PP +It is possible to recreate the database in a location different than the +original, +by specifying appropriate pathnames to the \-h option of the +.I db_recover +utility. +.PP +To remove log files, the following steps should be taken: +.TP 5 +1. +If you are concerned with catastrophic failure, +first copy them to backup media (e.g., tape), as described above. +This is because log files are necessary for recovery from catastrophic +failure. +.TP 5 +2. +Run +.IR db_archive , +without options, +to identify all of the log files that are no longer in use (e.g., involved +in an active transaction). +.TP 5 +3. +Remove those log files from the system. +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR db_archive : +.TP 5 +.Dh db_archive +.SH "SEE ALSO" +.Gn +.PP +.Sa diff --git a/mozilla/db/man/man.roff/db_checkpoint.1 b/mozilla/db/man/man.roff/db_checkpoint.1 new file mode 100644 index 00000000000..e6a6c18e876 --- /dev/null +++ b/mozilla/db/man/man.roff/db_checkpoint.1 @@ -0,0 +1,919 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_checkpoint.so 10.11 (Sleepycat) 5/3/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_CHECKPOINT 1 "May 3, 1998" +.UC 7 +.SH NAME +db_checkpoint \- the DB database checkpoint utility +.SH SYNOPSIS +.nf +\fBdb_checkpoint\fP [\fB-1v\fP] [\fB-h home\fP] [\fB-k kbytes\fP] [\fB-L file\fP] [\fB-p min\fP] +.fi +.SH DESCRIPTION +The +.I db_checkpoint +utility is a daemon process that monitors the database log and periodically +calls +.IR txn_checkpoint (3) +to checkpoint it. +.PP +The options are as follows: +.TP 5 +.B \-1 +Checkpoint the log once, and then exit. +.TP 5 +.B \-h +Specify a home directory for the database. +.TP 5 +.B \-k +Checkpoint the database at least as often as every +.I kbytes +of log file are written. +.TP 5 +.Pi db_checkpoint +.TP 5 +.B \-p +Checkpoint the database at least every +.I min +minutes. +.TP 5 +.B \-v +Write the time of each checkpoint to the standard output. +.PP +At least one of the +.BR \-1 , +.B \-k +and +.B \-p +options must be specified. +.PP +.Si db_checkpoint +.PP +.Ex db_checkpoint +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR db_checkpoint : +.TP 5 +.Dh db_checkpoint +.SH "SEE ALSO" +.Gn +.PP +.Sa diff --git a/mozilla/db/man/man.roff/db_cursor.3 b/mozilla/db/man/man.roff/db_cursor.3 new file mode 100644 index 00000000000..e24a7a39514 --- /dev/null +++ b/mozilla/db/man/man.roff/db_cursor.3 @@ -0,0 +1,1395 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_cursor.so 10.23 (Sleepycat) 4/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_CURSOR 3 "April 10, 1998" +.UC 7 +.SH NAME +db_cursor \- database sequential access functions +.SH SYNOPSIS +.nf +.ft B +#include + +int +DBcursor->c_close(DBC *cursor); + +int +DBcursor->c_del(DBC *cursor, u_int32_t flags); + +int +DBcursor->c_get(DBC *cursor, DBT *key, DBT *data, u_int32_t flags); + +int +DBcursor->c_put(DBC *, DBT *key, DBT *data, u_int32_t flags); +.ft R +.fi +.SH DESCRIPTION +.Gn +.PP +This manual page describes the specific details of the cursor support +for the DB access methods. +.PP +The +.I db_cursor +functions are the library interface supporting sequential access to the +records stored by the access methods of the DB library. +Cursors are created by calling the +.I cursor +function of a DB structure returned by +.IR db_open (3), +which returns a pointer to a DBC structure. +.PP +Each cursor maintains positioning information within a set of key/data pairs. +In the presence of transactions, cursors are only valid within the +context of a single transaction, the one specified during the +.I cursor +call described in +.IR db_open (3). +All cursor operations will be executed in the context of that transaction. +Before aborting or committing a transaction, all cursors used within that +transaction must be closed. +In the presence of transactions, the application must call +.I txn_abort +if any of the cursor operations returns that a deadlock (EAGAIN) or +system failure occurred. +.PP +When locking is enabled, +page locks are retained between consecutive cursor calls. +For this reason, in the presence of locking, +applications should discard cursors as soon as they are done with them. +Calling the db +.I close +function (see +.IR db_open (3)) +discards any cursors opened in the context of a particular DB structure +returned by the +.I db_open +call. +.PP +The cursor has an associated set of functions to access elements in the +database, accessed through the DBC structure. +The elements of the DBC structure are defined as follows: +.TP 5 +int (*c_close)(DBC *cursor); +A pointer to a function that discards the cursor. +No further references to the cursor should be made. +.IP +.Rt c_close +.TP 5 +int (*c_del)(DBC *cursor, u_int32_t flags); +A pointer to a function that deletes the key/data pair currently +referenced by the cursor. +.IP +.Fl +.IP +The cursor position is unchanged after a delete and subsequent calls +to cursor functions expecting the cursor to reference an existing +key will fail. +.IP +.Rc c_del +and DB_KEYEMPTY if the element has already been deleted. +.TP 5 +int (*c_get)(DBC *cursor, DBT *key, DBT *data, u_int32_t flags); +.br +A pointer to a function that retrieves key/data pairs from the database. +The address and length of the key are returned in the structure referenced +by +.I key +(except for the case of the DB_SET flag where the +.I key +structure is unchanged), +and the address and length of the data are returned in the structure +referenced by +.IR data . +.sp +Modifications to the database during a sequential scan will be reflected +in the scan, +i.e. records inserted behind a cursor will not be returned while records +inserted in front of a cursor will be returned. +.sp +In recno databases, missing entries +(i.e., entries that were never explicitly created or that were created +and then deleted), +will be skipped during a sequential scan. +.sp +If multiple threads or processes insert items into the same database file +without using locking, the results are undefined. +For more detail, see the section below on cursor stability. +.IP +The parameter +.I flags +must be set to exactly one of the following values: +.RS +.TP 5 +DB_FIRST +The cursor is set to reference the first key/data pair of the database, +and that pair is returned. +In the presence of duplicate key values, +the first data item in the set of duplicates is returned. +.IP +If the database is empty, +the +.I c_get +function will return DB_NOTFOUND. +.TP 5 +DB_LAST +The cursor is set to reference the last key/data pair of the database, +and that pair is returned. +In the presence of duplicate key values, +the last data item in the set of duplicates is returned. +.IP +If the database is empty, +the +.I c_get +function will return DB_NOTFOUND. +.TP 5 +DB_NEXT +If the cursor is not yet initialized, DB_NEXT is identical to DB_FIRST. +.IP +Otherwise, +move the cursor to the next key/data pair of the database, +and that pair is returned. +In the presence of duplicate key values, +the value of the key may not change. +.IP +If the cursor is already on the last record in the database, +the +.I c_get +function will return DB_NOTFOUND. +.TP 5 +DB_PREV +If the cursor is not yet initialized, DB_PREV is identical to DB_LAST. +.IP +Otherwise, +move the cursor to the previous key/data pair of the database, +and that pair is returned. +In the presence of duplicate key values, +the value of the key may not change. +.IP +If the cursor is already on the first record in the database, +the +.I c_get +function will return DB_NOTFOUND. +.TP 5 +DB_CURRENT +Return the key/data pair currently referenced by the cursor. +.IP +If the cursor key/data pair has been deleted, +the +.I c_get +function will return DB_KEYEMPTY. +.IP +If the cursor is not yet initialized, +the +.I c_get +function will return EINVAL. +.TP 5 +DB_SET +Move the cursor to the specified key/data pair of the database, +and return the datum associated with the given key. +.IP +In the presence of duplicate key values, +.I c_get +will return the first data item for the given key. +.IP +If the database is a recno database and the requested key exists, +but was never explicitly created by the application or was later +deleted, the +.I c_get +function returns DB_KEYEMPTY. +.IP +If no matching keys are found, +the +.I c_get +function will return DB_NOTFOUND. +.TP 5 +DB_SET_RANGE +The DB_SET_RANGE flag is identical to the DB_SET flag, +except that the key is returned as well as the data item, +and, in the case of the btree access method, +the returned key/data pair is the smallest key greater than or +equal to the specified key (as determined by the comparison function), +permitting partial key matches and range searches. +.TP 5 +DB_SET_RECNO +Move the cursor to the specific numbered record of the database, +and return the associated key/data pair. +The +.I data +field of the specified +.I key +must be a pointer to a memory location from which a +.I db_recno_t +may be read, as described in +.IR db_dbt (3). +This memory location will be read to determine the record to be retrieved. +.sp +For DB_SET_RECNO to be specified, the underlying database must be of type +btree and it must have been created with the DB_RECNUM flag (see +.IR db_open (3)). +.TP 5 +DB_GET_RECNO +Return the record number associated with the cursor. +The record number +will be returned in the data DBT as described in +.IR db_dbt (3). +The +.I key +parameter is ignored. +.sp +For DB_GET_RECNO to be specified, the underlying database must be of type +btree and it must have been created with the DB_RECNUM flag (see +.IR db_open (3)). +.RE +.IP +.Ro c_get +.IP +If +.I c_get +fails for any reason, the state of the cursor will be unchanged. +.TP 5 +int (*c_put)(DBC *, DBT *key, DBT *data, u_int32_t flags); +.br +A pointer to a function that stores key/data pairs into the database. +.IP +The +.I flags +parameter must be set to exactly one of the following values: +.RS +.TP 5 +DB_AFTER +In the case of the btree and hash access methods, +insert the data element as a duplicate element of the key referenced +by the cursor. +The new element appears immediately after the current cursor position. +It is an error to specify DB_AFTER if the underlying btree or hash database +was not created with the DB_DUP flag. +The +.I key +parameter is ignored. +.IP +In the case of the recno access method, +it is an error to specify DB_AFTER if the underlying recno database was +not created with the DB_RENUMBER flag. +If the DB_RENUMBER flag was specified, a new key is created, +all records after the inserted item are automatically renumbered, +and the key of the new record is returned in the structure referenced +by the parameter +.IR key . +The initial value of the +.I key +parameter is ignored. +See +.IR db_open (3) +for more information. +.IP +If the cursor is not yet initialized, +the +.I c_put +function will return EINVAL. +.TP 5 +DB_BEFORE +In the case of the btree and hash access methods, +insert the data element as a duplicate element of the key referenced +by the cursor. +The new element appears immediately before the current cursor position. +It is an error to specify DB_BEFORE if the underlying btree or hash database +was not created with the DB_DUP flag. +The +.I key +parameter is ignored. +.IP +In the case of the recno access method, +it is an error to specify DB_BEFORE if the underlying recno database was +not created with the DB_RENUMBER flag. +If the DB_RENUMBER flag was specified, a new key is created, +the current record and all records after it are automatically renumbered, +and the key of the new record is returned in the structure referenced by +the parameter +.IR key . +The initial value of the +.I key +parameter is ignored. +See +.IR db_open (3) +for more information. +.IP +If the cursor is not yet initialized, +the +.I c_put +function will return EINVAL. +.TP 5 +DB_CURRENT +Overwrite the data of the key/data pair referenced by the cursor with the +specified data item. +.IP +The +.I key +parameter is ignored. +.IP +If the cursor is not yet initialized, +the +.I c_put +function will return EINVAL. +.TP 5 +DB_KEYFIRST +In the case of the btree and hash access methods, +insert the specified key/data pair into the database. +If the key already exists in the database, +the inserted data item is added as the first of the data items for that key. +.IP +The DB_KEYFIRST flag may not be specified to the recno access method. +.TP 5 +DB_KEYLAST +Insert the specified key/data pair into the database. +If the key already exists in the database, +the inserted data item is added as the last of the data items for that key. +.IP +The DB_KEYLAST flag may not be specified to the recno access method. +.RE +.IP +If the cursor record has been deleted, +the +.I c_put +function will return DB_KEYEMPTY. +.IP +.Ro c_put +.IP +If +.I c_put +fails for any reason, the state of the cursor will be unchanged. +If +.I c_put +succeeds and an item is inserted into the database, +the cursor is always positioned to reference the newly inserted item. +.SH "CURSOR STABILITY" +.PP +In the absence of locking, no guarantees are made about the stability +of cursors in different processes or threads. +However, +the btree and recno access methods guarantee that cursor operations, +interspersed with other cursor or non-cursor operations in the same +thread of control (i.e., thread or single-threaded process), +will always return keys in order and will return each non-deleted +key/data pair exactly once. +Because the hash access method uses a dynamic hashing algorithm, +it cannot guarantee any form of stability in the presence of inserts and +deletes unless locking is performed. +.PP +If locking was specified when the DB file was opened, +but transactions are not in effect, +the access methods provide repeatable reads with respect to the cursor. +That is, a DB_CURRENT call on the cursor is guaranteed to return the same +record as was returned on the last call to the cursor. +.PP +In the presence of transactions, the access method calls between +.I txn_begin +and +.I txn_abort +or +.I txn_commit +provide degree 3 consistency. +For all access methods, +a cursor scan of the database performed within the context of a transaction +is guaranteed to return each key/data pair once and only once, +except in the following case. +If, while performing a cursor scan using the hash access method, +the transaction performing the scan inserts a new pair into the database, +it is possible that duplicate key/data pairs will be returned. +.SH ERRORS +.Ee DBcursor->c_close +.na +.Nh +calloc(3), +fcntl(2), +fflush(3), +lock_get(3), +lock_id(3), +lock_put(3), +lock_vec(3), +log_put(3), +malloc(3), +memcpy(3), +memmove(3), +memp_fget(3), +memp_fput(3), +memp_fset(3), +memset(3), +realloc(3), +and +strerror(3). +.Hy +.ad +.PP +.Ec DBcursor->c_close +.TP 5 +.Ea +.TP 5 +.Ep +.PP +.Ee DBcursor->c_del +.na +.Nh +DB->del(3), +calloc(3), +fcntl(2), +fflush(3), +lock_get(3), +lock_id(3), +lock_put(3), +lock_vec(3), +log_put(3), +malloc(3), +memcpy(3), +memmove(3), +memp_fget(3), +memp_fput(3), +memp_fset(3), +memset(3), +realloc(3), +and +strerror(3). +.Hy +.ad +.PP +.Ec DBcursor->c_del +.TP 5 +.Ea +.TP 5 +.Ei +.TP 5 +.Ep +.PP +.Ee DBcursor->c_get +.na +.Nh +DB->get(3), +calloc(3), +fcntl(2), +fflush(3), +lock_get(3), +lock_id(3), +lock_put(3), +lock_vec(3), +log_put(3), +malloc(3), +memcmp(3), +memcpy(3), +memmove(3), +memp_fget(3), +memp_fput(3), +memp_fset(3), +memset(3), +realloc(3), +and +strerror(3). +.Hy +.ad +.PP +.Ec DBcursor->c_get +.TP 5 +.Ea +.TP 5 +.Ei +.sp +The DB_THREAD flag was specified to the +.IR db_open (3) +function and neither the DB_DBT_MALLOC or DB_DBT_USERMEM flags were set +in the DBT. +.TP 5 +.Ep +.PP +.Ee DBcursor->c_put +.na +.Nh +calloc(3), +fcntl(2), +fflush(3), +lock_get(3), +lock_id(3), +lock_put(3), +lock_vec(3), +log_put(3), +malloc(3), +memcmp(3), +memcpy(3), +memmove(3), +memp_fget(3), +memp_fput(3), +memp_fset(3), +memset(3), +realloc(3), +and +strerror(3). +.Hy +.ad +.PP +.Ec DBcursor->c_put +.TP 5 +.Es +.TP 5 +.Ea +.TP 5 +.Ei +.TP 5 +.Ep +.SH "SEE ALSO" +.Sa diff --git a/mozilla/db/man/man.roff/db_dbm.3 b/mozilla/db/man/man.roff/db_dbm.3 new file mode 100644 index 00000000000..99749c6983a --- /dev/null +++ b/mozilla/db/man/man.roff/db_dbm.3 @@ -0,0 +1,1285 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_dbm.so 10.9 (Sleepycat) 4/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_DBM 3 "April 10, 1998" +.UC 7 +.SH NAME +dbm \- dbminit, fetch, store, delete, firstkey, nextkey +.sp +.nf +ndbm \- dbm_open, dbm_close, dbm_fetch, dbm_store, dbm_delete, +dbm_firstkey, dbm_nextkey, dbm_error, dbm_clearerr +.fi +.SH SYNOPSIS +.nf +.ft B +#define DB_DBM_HSEARCH 1 +#include + +typedef struct { + char *dptr; + int dsize; +} datum; +.ft R +.fi +.SH "DBM FUNCTIONS +.nf +.ft B +int +dbminit(char *file); + +datum +fetch(datum key); + +int +store(datum key, datum content); + +int +delete(datum key); + +datum +firstkey(void); + +datum +nextkey(datum key); +.ft R +.fi +.SH "NDBM FUNCTIONS +.nf +.ft B +DBM * +dbm_open(char *file, int flags, int mode); + +void +dbm_close(DBM *db); + +datum +dbm_fetch(DBM *db, datum key); + +int +dbm_store(DBM *db, datum key, datum content, int flags); + +int +dbm_delete(DBM *db, datum key); + +datum +dbm_firstkey(DBM *db); + +datum +dbm_nextkey(DBM *db); + +int +dbm_error(DBM *db); + +int +dbm_clearerr(DBM *db); +.ft R +.fi +.SH DESCRIPTION +The +.I dbm +and +.I ndbm +interfaces to the DB library are intended to provide source code +compatibility for historic applications. +They are not recommended for any other purpose. +The historic +.I dbm +and +.I ndbm +database format is +.B not +supported, +and databases previously built using the real +.I dbm +or +.I ndbm +libraries cannot be read by the DB functions. +.PP +To compile +.I dbm +or +.I ndbm +applications, +replace the application's +.I #include +of the dbm or ndbm include file (e.g., ``#include '' +or ``#include '') with the following two lines: +.PP +.RS +#define DB_DBM_HSEARCH 1 +.br +#include +.RE +.PP +and recompile. +If the application attempts to load against a dbm library (e.g., ``-ldbm''), +remove the library from the load line. +.PP +.IR Key s +and +.IR content s +are described by the +.I datum +typedef. A +.I datum +specifies a string of +.I dsize +bytes pointed to by +.IR dptr . +Arbitrary binary data, as well as normal text strings, are allowed. +.SH "DBM FUNCTIONS +.PP +Before a database can be accessed, it must be opened by +.IR dbminit . +This will open and/or create the database +.IR file .db. +If created, +the database file is created read/write by owner only (as described +in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.PP +Once open, the data stored under a key is accessed by +.I fetch +and data is placed under a key by +.IR store . +A key (and its associated contents) is deleted by +.IR delete . +A linear pass through all keys in a database may be made, +in an (apparently) random order, by use of +.I firstkey +and +.IR nextkey . +.I Firstkey +will return the first key in the database. With any key +.I nextkey +will return the next key in the database. +This code will traverse the data base: +.IP +for (key = firstkey(); +.ti +5 +key.dptr != NULL; key = nextkey(key)) +.SH "NDBM FUNCTIONS +Before a database can be accessed, it must be opened by +.IR dbm_open . +This will open and/or create the database file +.IR file .db +depending on the flags parameter (see +.IR open (2)). +If created, +the database file is created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.PP +Once open, the data stored under a key is accessed by +.I dbm_fetch +and data is placed under a key by +.IR dbm_store . +The +.I flags +field can be either +.B DBM_INSERT +or +.B DBM_REPLACE. +.B DBM_INSERT +will only insert new entries into the database and will not +change an existing entry with the same key. +.B DBM_REPLACE +will replace an existing entry if it has the same key. +A key (and its associated contents) is deleted by +.IR dbm_delete . +A linear pass through all keys in a database may be made, +in an (apparently) random order, by use of +.I dbm_firstkey +and +.IR dbm_nextkey . +.I Dbm_firstkey +will return the first key in the database. +.I Dbm_nextkey +will return the next key in the database. +This code will traverse the data base: +.IP +for (key = dbm_firstkey(db); +.ti +5 +key.dptr != NULL; key = dbm_nextkey(db)) +.PP +.I Dbm_error +returns non-zero when an error has occurred reading or writing the database. +.I Dbm_clearerr +resets the error condition on the named database. +.SH "COMPATIBILITY NOTES +The historic +.I dbm +and +.I ndbm +libraries created two underlying database files, +traditionally named +.IR file .dir +and +.IR file .pag. +The DB library creates a single database file named +.IR file .db. +Applications that are aware of the underlying database file names +may require additional source code modifications. +.PP +The historic +.I dbminit +interface required that the underlying ``.dir'' and ``.pag'' files +already exist (empty databases were created by creating zero-length +``.dir'' and ``.pag'' files). +Applications that expect to create databases using this method +may require additional source code modifications. +.PP +The historic +.I dbm_dirfno +and +.I dbm_pagfno +macros are supported, +but will return identical file descriptors as there is only a single +underlying file used by the DB hashing access method. +Applications using both file descriptors for locking may require +additional source code modifications. +.PP +If an application using the +.I ndbm +interface exits without closing the database, +it may lose updates because the DB library buffers all writes. +Such applications will require additional source code modifications +to work correctly with the DB library. +.SH "DBM DIAGNOSTICS +.de RD +The +.I \\$1 +function sets the returned +.IR datum 's +.I dptr +field to NULL on failure, setting +.IR errno , +and returns a non-NULL +.I dptr +on success. +.. +.de RE +The +.I \\$1 +function returns -1 on failure, setting +.IR errno , +and 0 on success. +.. +.de RF +The +.I \\$1 +function returns -1 on failure, setting +.IR errno , +0 on success, +and 1 if DBM_INSERT was set and the specified key already existed in the +database. +.. +.de RN +The +.I \\$1 +function returns NULL on failure, setting +.IR errno , +and 0 on success. +.. +.RE dbminit +.PP +.RD fetch +.PP +.RE store +.PP +.RE delete +.PP +.RD firstkey +.PP +.RD nextkey +.SH "NDBM DIAGNOSTICS +.RN dbm_open +.PP +.RD dbm_fetch +.PP +.RF dbm_store +.PP +.RE dbm_delete +.PP +.RD dbm_firstkey +.PP +.RD dbm_nextkey +.PP +.RE dbm_error +.PP +.RE dbm_clearerr +.SH ERRORS +.Ee dbminit +.na +.Nh +dbm_close(3), +and +dbm_open(3). +.Hy +.ad +.PP +.Ee fetch +.na +.Nh +dbm_fetch(3). +.Hy +.ad +.PP +.Ee store +.na +.Nh +dbm_store(3). +.Hy +.ad +.PP +.Ee delete +.na +.Nh +dbm_delete(3). +.Hy +.ad +.PP +.Ee firstkey +.na +.Nh +dbm_firstkey(3). +.Hy +.ad +.PP +.Ee nextkey +.na +.Nh +dbm_nextkey(3). +.Hy +.ad +.PP +.Ee dbm_open +.na +.Nh +db_open(3), +and +memset(3). +.Hy +.ad +.PP +.Ee dbm_close +.na +.Nh +DB->close(3). +.Hy +.ad +.PP +.Ee dbm_fetch +.na +.Nh +DB->get(3), +and +memset(3). +.Hy +.ad +.PP +.Ee dbm_store +.na +.Nh +DB->put(3), +and +memset(3). +.Hy +.ad +.PP +.Ee dbm_delete +.na +.Nh +memset(3). +.Hy +.ad +.PP +.Ee dbm_firstkey +.na +.Nh +DB->cursor(3), +and +memset(3). +.Hy +.ad +.PP +.Ee dbm_nextkey +.na +.Nh +DB->cursor(3), +and +memset(3). +.Hy +.ad +.SH "SEE ALSO" +.Gn +.PP +.Sa diff --git a/mozilla/db/man/man.roff/db_dbt.3 b/mozilla/db/man/man.roff/db_dbt.3 new file mode 100644 index 00000000000..c9c3582172d --- /dev/null +++ b/mozilla/db/man/man.roff/db_dbt.3 @@ -0,0 +1,1131 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_dbt.so 10.11 (Sleepycat) 4/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_DBT 3 "April 10, 1998" +.UC 7 +.SH NAME +db_dbt \- DB key/data pairs +.SH SYNOPSIS +.ft B +typedef struct { +.RS +void *data; +.br +u_int32_t size; +.br +u_int32_t ulen; +.br +u_int32_t dlen; +.br +u_int32_t doff; +.br +u_int32_t flags; +.br +.RE +} DBT; +.ft R +.SH "KEY/DATA PAIRS +Storage and retrieval for the DB access methods are based on key/data pairs. +Both key and data items are represented by the DBT data structure. +.PP +Key and data byte strings may reference strings of essentially unlimited +length, +although any two keys must fit into available memory at the same time so +that they may be compared, +and any one data item must fit into available memory so that it may be +returned. +.PP +In order to ensure compatibility with future releases of DB, +all fields of the DBT structure that are not explicitly set should be +initialized to 0 before the first time the structure is used. +Do this by declaring the structure external or static, +or by calling the C library routine +.IR bzero (3) +or +.IR memset (3). +.PP +By default, the +.I flags +structure element is expected to be 0. +In this default case, +when being provided a key or data item by the application, +the DB package expects the +.I data +structure element to point to a byte string of +.I size +bytes. +When returning a key/data item to the application, +the DB package will store into the +.I data +structure element a pointer to a byte string of +.I size +bytes. +.ft B +By default, +the memory referenced by this stored pointer is only valid until the next +call to the DB package using the DB handle returned by +.IR db_open . +.ft R +.PP +.ft B +The access methods provide no guarantees about byte string alignment, +and applications are responsible for maintaining any necessary alignment. +.ft R +Use the DB_DBT_USERMEM flag to cause returned items to be placed in memory +of arbitrary alignment. +.PP +The elements of the DBT structure are defined as follows: +.TP 5 +void *data; +A pointer to a byte string. +.ns +.br +.TP 5 +u_int32_t size; +The length of +.IR data , +in bytes. +.TP 5 +u_int32_t ulen; +The size of the user's buffer (referenced by +.IR data ), +in bytes. +This location is not written by the DB functions. +See the DB_DBT_USERMEM flag for more information. +.TP 5 +u_int32_t dlen; +The length of the partial record being read or written by the application, +in bytes. +See the DB_DBT_PARTIAL flag for more information. +.TP 5 +u_int32_t doff; +The offset of the partial record being read or written by the application, +in bytes. +See the DB_DBT_PARTIAL flag for more information. +.TP 5 +u_int32_t flags; +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.RS +.TP 5 +DB_DBT_MALLOC +Ignored except when retrieving information from a database, e.g., a +.I DB->get +or +.I DBcursor->c_get +call. +This flag causes DB to allocate memory for the returned key or data +item (using +.IR malloc (3), +or the user-specified malloc function) +and return a pointer to it in the +.I data +field of the key or data DBT structure. +The allocated memory becomes the responsibility of the calling application. +It is an error to specify both DB_DBT_MALLOC and DB_DBT_USERMEM. +.TP 5 +DB_DBT_USERMEM +Ignored except when retrieving information from a database, e.g., a +.I DB->get +or +.I DBcursor->c_get +call. +The +.I data +field of the key or data structure must reference memory that is at +least +.I ulen +bytes in length. +If the length of the requested item is less than or equal to that number +of bytes, +the item is copied into the memory referenced by the +.I data +field. +Otherwise, an error is returned, the +.I size +field is set to the length needed for the requested item, +and the +.I errno +variable is set to ENOMEM. +It is an error to specify both DB_DBT_MALLOC and DB_DBT_USERMEM. +.TP 5 +DB_DBT_PARTIAL +Ignored except when specified for a data parameter, +where this flag causes the partial retrieval or storage of an item. +If the calling application is doing a get, the +.I dlen +bytes starting +.I doff +bytes from the beginning of the retrieved data record are returned +as if they comprised the entire record. +If any or all of the specified bytes do not exist in the record, +the get is successful and the existing bytes or 0 bytes are returned. +.sp +For example, if the data portion of a retrieved record was 100 bytes, +and a partial retrieval was done using a DBT having a +.I dlen +field of 20 and a +.I doff +field of 85, +the get call would succeed, +the +.I data +field would reference the last 15 bytes of the record, +and the +.I size +field would be set to 15. +.sp +If the calling application is doing a put, +the +.I dlen +bytes starting +.I doff +bytes from the beginning of the specified key's data record are replaced +by the data specified by the +.I data +and +.I size +structure elements. +If +.I dlen +is smaller than +.IR size , +the record will grow, and if +.I dlen +is larger than +.IR size , +the record will shrink. +If the specified bytes do not exist, +the record will be extended using nul bytes as necessary, +and the put call will succeed. +.sp +It is an error to attempt a partial put using the +.I DB->put +function in a database that supports duplicate records. +Partial puts in databases supporting duplicate records must be done +using a +.IR db_cursor (3) +function. +It is an error to attempt a partial put with differing +.I dlen +and +.I size +values in a recno database with fixed-length records. +.sp +For example, if the data portion of a retrieved record was 100 bytes, +and a partial put was done using a DBT having a +.I dlen +field of 20, +a +.I doff +field of 85, +and a +.I size +field of 30, +the resulting record would be 115 bytes in length, where the last 30 +bytes would be those specified by the put call. +.RE +.PP +The default algorithm of associating returned key or data items with the +DB handle returned by +.IR db_open (3) +will obviously not work when DB handles are being used concurrently by +multiple threads within a process, i.e, when DB_THREAD was specified to +.IR db_open (3). +.ft B +When multiple threads are using the returned DB handle concurrently, +either the DB_DBT_MALLOC or DB_DBT_USERMEM flags must be specified +for any DBT used for key or data retrieval. +.ft R +.SH "LOGICAL RECORD NUMBERS +In all cases for the recno access method, +and when calling the +.I db->get +and +.I cursor->c_get +functions with the DB_SET_RECNO flag specified, the +.I data +field of the key must be a pointer to a memory location of type +.IR db_recno_t , +as typedef'd in the include file. +This type is a 32-bit unsigned type, +(which limits the number of logical records in a recno database, +and the maximum logical record which may be directly retrieved +from a btree database, to 4,294,967,296). +The +.I size +field of the key should be the size of that type, e.g., +in the C programming language, ``sizeof(db_recno_t)''. +.sp +Logical record numbers are 1-based, not 0-based, i.e., the first record +in the database is record number 1. +.SH BUGS +The DB access methods provide no guarantees about byte string alignment, +and applications are responsible for maintaining any necessary alignment. +.PP +The name DBT is a mnemonic for ``data base thang'', and was used because +noone could think of a reasonable name that wasn't already in use somewhere +else. +.SH "SEE ALSO" +.Gn +.PP +.Sa diff --git a/mozilla/db/man/man.roff/db_deadlock.1 b/mozilla/db/man/man.roff/db_deadlock.1 new file mode 100644 index 00000000000..81da69072b8 --- /dev/null +++ b/mozilla/db/man/man.roff/db_deadlock.1 @@ -0,0 +1,922 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_deadlock.so 10.9 (Sleepycat) 4/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_DEADLOCK 1 "April 10, 1998" +.UC 7 +.SH NAME +db_deadlock \- the DB database deadlock detector +.SH SYNOPSIS +.nf +\fBdb_deadlock\fP [\fB-vw\fP] [\fB-a m | o | y\fP] [\fB-h home\fP]\c + [\fB-L file \fP] [\fB-t sec \fP] +.fi +.SH DESCRIPTION +The +.I db_deadlock +utility traverses the database lock structures and aborts a transaction +each time it detects a deadlock. +This utility should be run as a background daemon whenever multiple threads +or processes are using locking. +By default, +a random transaction involved in the deadlock is aborted. +.PP +The options are as follows: +.TP 5 +.B \-a +When a deadlock is detected, +abort the oldest (``o'') transaction, the youngest (``y'') transaction, +or the transaction with the minimum number of locks (``m''). +.TP 5 +.B \-h +Specify a home directory for the database. +.TP 5 +.Pi db_deadlock +.TP 5 +.B \-t +Initiate a pass over the database locks at least every +.I sec +seconds. +.TP 5 +.B \-v +Run in verbose mode, generating messages each time the detector runs. +.TP 5 +.B \-w +Make a single pass over the database locks every time a process is forced +to wait for a lock. +.PP +At least one of the +.B -t +and +.B -w +options must be specified. +.PP +.Si db_deadlock +.PP +.Ex db_deadlock +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR db_deadlock : +.TP 5 +.Dh db_deadlock +.SH "SEE ALSO" +.Gn +.PP +.Sa diff --git a/mozilla/db/man/man.roff/db_dump.1 b/mozilla/db/man/man.roff/db_dump.1 new file mode 100644 index 00000000000..f1bcb20e627 --- /dev/null +++ b/mozilla/db/man/man.roff/db_dump.1 @@ -0,0 +1,1022 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_dump.so 10.10 (Sleepycat) 4/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_DUMP 1 "April 10, 1998" +.UC 7 +.SH NAME +db_dump \- the DB database dump utility +.SH SYNOPSIS +\fBdb_dump\fP [\fB-d\fP] [\fB-f output\fP] db_file +.br +\fBdb_dump\fP [\fB-p\fP] [\fB-f output\fP] [\fB-h home\fP] db_file +.br +\fBdb_dump185\fP [\fB-p\fP] [\fB-f output\fP] db_file +.SH DESCRIPTION +The +.I db_dump +utility reads the database file +.I db_file +and writes it to the standard output using a portable flat-text format +understood by the +.IR db_load (1) +utility. +The argument +.I db_file +must be a file produced using the +.I DB +library functions. +.PP +The +.I db_dump185 +utility is similar to the +.I db_dump +utility except that it reads databases in the format used by DB versions +1.85 and 1.86. +.PP +The options are as follows: +.TP 5 +.B \-d +Dump the specified database in a format helpful for debugging the DB +library routines. +.ft B +The output format of the \-d option is not standard and may change, +without notice, +between releases of the DB library. +.ft R +.TP 5 +.B \-f +Write to the specified +.I file +instead of to the standard output. +.TP 5 +.B \-h +Specify a home directory for the database. +As DB versions before 2.0 did not support the concept of a database ``home'', +.I db_dump185 +does not support this option. +.TP 5 +.B \-p +If characters in either the key or data items are printing characters +(as defined by +.IR isprint (3)), +use printing characters in +.I file +to represent them. +This option permits users to use standard text editors to modify +the contents of databases. +.IP +Note, different systems may have different notions as to what characters +are ``printing'', and databases dumped in this manner may be less portable +to external systems. +.PP +Dumping and reloading hash databases that use user-defined hash functions +will result in new databases that use the default hash function. +While using the default hash function may not be optimal for the new database, +it will continue to work correctly. +.PP +Dumping and reloading btree databases that use user-defined prefix or +comparison functions will result in new databases that use the default +prefix and comparison functions. +.ft B +In this case, it is quite likely that the database will be damaged +beyond repair permitting neither record storage or retrieval. +.ft R +.PP +The only available workaround for either case is to modify the sources +for the +.IR db_load (1) +utility to load the database using the correct hash, prefix and comparison +functions. +.PP +The +.I db_dump185 +utility may not be available on your system as it is not always installed +when the DB libraries and utilities are installed. +If you are unable to find it, +see your system administrator for further information. +.PP +.Ex db_dump +.Ex db_dump185 +.SH "OUTPUT FORMATS +There are two output formats used by +.I db_dump +and +.IR db_dump185 . +.PP +In both output formats, the first few lines of the output contain +header information describing the underlying access method, filesystem page +size and other bookkeeping information. +This information is output in ``name=value'' pairs, where ``name'' may +be any of the keywords listed in the +.IR db_load (1) +manual page, and ``value'' will be its value. +While this header information can be edited before the database is +reloaded, +there is rarely any reason to do so, as all of this information can be +overridden by command-line arguments to +.IR db_load . +.PP +Following the header information are the key/data pairs from the database. +If the database being dumped is of type +.B btree +or +.BR hash , +the output will be paired lines of text, +where the first line of the pair is the key item, +and the second line of the pair is its corresponding data item. +If the database being dumped is of type +.BR recno , +the output will be lines of text, +where each line is a new data item for the database. +.PP +If the +.B \-p +option was specified, each output line will consist of single characters +representing any characters from the database that were ``printing'', +and backslash (``\e'') escaped characters for any that were not. +Backslash characters appearing in the output mean one of two things: +if the backslash character precedes another backslash character, +it means that a literal backslash character occurred in the key or data +item. +If the backslash character precedes any other character, +the next two characters should be interpreted as hexadecimal specification +of a single character, e.g., ``\e0a'' is a newline character in the ASCII +character set. +.PP +If the +.B \-p +option was not specified, each output line will consist of paired hexadecimal +values, e.g., the line ``726f6f74'' is the string ``root'' in the ASCII +character set. +.PP +In both output formats, +a single newline character ends both the key and data items. +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR db_dump : +.TP 5 +.Dh db_dump +.SH "SEE ALSO" +.IR isprint (3) +.PP +.Gn +.PP +.Sa diff --git a/mozilla/db/man/man.roff/db_hsearch.3 b/mozilla/db/man/man.roff/db_hsearch.3 new file mode 100644 index 00000000000..53b0b200c2f --- /dev/null +++ b/mozilla/db/man/man.roff/db_hsearch.3 @@ -0,0 +1,1021 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_hsearch.so 10.8 (Sleepycat) 4/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_HSEARCH 3 "April 10, 1998" +.UC 7 +.SH NAME +hsearch \- hsearch, hcreate, hdestroy +.SH SYNOPSIS +.nf +.ft B +#define DB_DBM_HSEARCH 1 +#include + +typedef enum { + FIND, ENTER +} ACTION; + +typedef struct entry { + char *key; + void *data; +} ENTRY; + +ENTRY * +hsearch(ENTRY item, ACTION action); + +int +hcreate(size_t nelem); + +void +hdestroy(void); +.ft R +.fi +.SH DESCRIPTION +The +.I hsearch +interface to the DB library is intended to provide source code compatibility +for historic applications. +It is not recommended for any other purpose. +.PP +To compile +.I hsearch +applications, +replace the application's +.I #include +of the hsearch include file (e.g., ``#include '') with the +following two lines: +.PP +.RS +#define DB_DBM_HSEARCH 1 +.br +#include +.RE +.PP +and recompile. +.PP +The +.I hcreate +function creates an in-memory database. +The +.I nelem +argument is an estimation of the maximum number of key/data pairs that +will be stored in the database. +.PP +The +.I hdestroy +function discards the database. +.PP +Database elements are structures of type +.IR ENTRY , +which contain at least two fields: +.I key +and +.IR data . +The field +.I key +is declared to be of type ``char *'' and is the key used for storage +and retrieval. +The field +.I data +is declared to be of type ``void *'' and is its associated data. +.PP +The +.I hsearch +function retrieves key/data pairs from, +and stores key/data pairs into, +the database. +.PP +The +.I action +argument must be set to one of two values: +.TP 5 +ENTER +If the key does not already appear in the database, +insert the key/data pair into the database. +If the key already appears in the database, +return a reference to an +.I ENTRY +structure referencing the existing key and its associated data element. +.TP 5 +FIND +Retrieve the specified key/data pair from the database. +.PP +.SH "COMPATIBILITY NOTES +Historically, +.I hsearch +required applications to maintain the keys and data in the application's +memory for as long as the +.I hsearch +database existed. +As DB handles key and data management internally, +there is no requirement that applications maintain local copies of key +and data items, +although the only effect of doing so should be the allocation of additional +memory. +.SH DIAGNOSTICS +The +.I hcreate +function returns 0 on failure, setting +.IR errno , +and non-zero on success. +.PP +The +.I hsearch +function returns a pointer to an ENTRY structure on success, +and NULL, setting +.IR errno , +if the +.I action +specified was FIND and the item did not appear in the database. +.SH ERRORS +.Ee hcreate +.na +.Nh +db_open(3), +and +memset(3). +.Hy +.ad +.PP +.Ee hsearch +.na +.Nh +DB->get(3), +DB->put(3), +memset(3), +and +strlen(3). +.Hy +.ad +.PP +In addition, the +.I hsearch +function will fail, +setting +.I errno +to 0, +if the +.I action +specified was FIND and the item did not appear in the database. +.SH "SEE ALSO" +.Gn +.PP +.Sa diff --git a/mozilla/db/man/man.roff/db_internal.3 b/mozilla/db/man/man.roff/db_internal.3 new file mode 100644 index 00000000000..fb1476a6a1f --- /dev/null +++ b/mozilla/db/man/man.roff/db_internal.3 @@ -0,0 +1,1418 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_internal.so 10.19 (Sleepycat) 5/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.\" ANSI C function replacement. +.de An +Replace all DB calls to the ANSI C X3.159-1989 (``ANSI C'') standard +.I \\$1 +function with +.IR func , +which must conform to the standard interface. +.. +.ds aa "IEEE Std 1003.1b-1993 (``POSIX'') +.\" POSIX 1003.1 function replacement. +.de Po +Replace all DB calls to the \*(aa +.I \\$1 +function with +.IR func , +which must conform to the standard interface. +.. +.TH DB_JUMP 3 "March 22, 1998" +.UC 7 +.SH NAME +db_jump_set, db_value_set \- replace underlying DB functionality +.SH SYNOPSIS +.nf +.ft B +#include + +int +db_jump_set(void *func, int which); + +int +db_value_set(int value, int which); +.ft R +.fi +.SH DESCRIPTION +.Gn +.PP +This manual page describes interfaces to tune or replace underlying system +functionality used by the DB library. +Few applications should have any need for these interfaces. +.PP +.Fn db_jump_set +The +.I db_jump_set +function enables applications to replace underlying DB library functionality +by replacing entries in a function call jump table. +The +.I which +argument specifies the entry to be replaced by the argument +.IR func . +.PP +The following values of +.I which +are supported: +.TP 5 +DB_FUNC_CLOSE +.Po close +.TP 5 +DB_FUNC_DIRFREE +The DB library requires the ability to return any memory allocated as part +of the routine which reads through a directory and creates a list of files +that that the directory contains (see DB_FUNC_DIRLIST). +The +.I func +argument must conform to the following interface: +.sp +.ti +5 +int dirfree(char **namesp, int cnt); +.sp +The +.I namesp +and +.I cnt +arguments are the same values as were returned by the +DB_FUNC_DIRLIST function. +.sp +.Rt dirfree +.TP 5 +DB_FUNC_DIRLIST +The DB library requires the ability to read through a directory and create +a list of files that that the directory contains. +The +.I func +argument must conform to the following interface: +.sp +.nf +.ti +5 +int dirlist(const char *dir, +.ti +8 +char ***namesp, int *cntp); +.fi +.sp +The +.I dir +argument is the name of the directory to be searched. +The function must return a pointer to an array of nul-terminated file +names in the memory location referenced by the argument +.IR namesp , +and a count of the number of elements in the array in the memory location +referenced by +.IR cntp . +.sp +.Rt dirlist +.TP 5 +DB_FUNC_EXISTS +The DB library requires the ability to determine if a file exists, +and optionally, if it is a file of type directory. +The +.I func +argument must conform to the following interface: +.sp +.ti +5 +int exists(const char *path, int *isdirp); +.sp +The +.I path +argument is the pathname of the file to be checked. +.sp +If the +.I isdirp +argument is non-NULL, +it must be set to non-0 if +.I path +is a directory, and 0 if +.I path +is not a directory. +.sp +.Rt exists +.TP 5 +DB_FUNC_FREE +.An free +.TP 5 +DB_FUNC_FSYNC +.Po fsync +.TP 5 +DB_FUNC_IOINFO +The DB library requires the ability to determine the size and I/O +characteristics of a file. +The +.I func +argument must conform to the following interface: +.sp +.nf +.ti +5 +int ioinfo(const char *path, int fd, +.ti +8 +u_int32_t *mbytesp, u_int32_t *bytesp, +.ti +8 +u_int32_t *iosizep); +.fi +.sp +The +.I path +argument is the pathname of the file to be checked, and the +.I fd +argument is an open file descriptor on the file. +.sp +If the +.I mbytesp +and +.I bytesp +arguments are non-NULL, the +.I ioinfo +function must return in them the size of the file: the number of megabytes +in the file into the memory location referenced by the +.I mbytesp +argument, +and the number of bytes over and above that number of megabytes into the +memory location referenced by the +.I bytesp +argument. +.sp +In addition, if the +.I iosizep +argument is non-NULL, the +.I ioinfo +function must return the optimum granularity for I/O operations to the +file in the memory location referenced by it. +.sp +.Rt ioinfo +.TP 5 +DB_FUNC_MALLOC +.An malloc +.TP 5 +DB_FUNC_MAP +The DB library requires the ability to map a file into memory and to +create shared memory regions (which may or may not be backed by files). +The +.I func +argument must conform to the following interface: +.sp +.nf +.ti +5 +int map(char *path, int fd, size_t len, +.ti +8 +int is_region, int is_anonymous, int is_rdonly, +.ti +8 +void **addr); +.fi +.sp +The +.I path +argument is the name of a file. +The +.I fd +argument is an open file descriptor on that file. +.sp +The +.I is_region +argument will be zero if the intention is to map a file into shared +memory. +In this case, the +.I map +function must map the first +.I len +bytes of the file into memory and return a pointer to the mapped +location in the memory location referenced by the argument +.IR addr . +In this case, the +.I is_anonymous +argument will always be zero. +The +.I is_rdonly +argument will be non-zero if the file is considered read-only by the caller. +.sp +The +.I is_region +argument will be non-zero if the memory is intended to be used as a +shared memory region for synchronization between DB threads/processes. +In this case, the returned memory may be of any kind (e.g., anonymous), +but must be able to support semaphores. +If the application has previously specified that regions are to be +instantiated in anonymous memory (see DB_REGION_ANON below), +or the region is being joined and is believed to have been allocated +in anonymous shared memory, the +.I is_anonymous +argument will be non-zero. +Additionally, the +.I path +and +.I fd +arguments may be ignored (although future +.I map +calls using the same +.I path +must return the same memory), +and the +.I is_rdonly +argument will always be zero. +.sp +By default, on UNIX systems, the DB library will use the \*(aa +.IR mmap (2) +interface to both map regular files into shared memory and create +shared memory regions. +If the application specifies that shared memory regions be instantiated +in anonymous memory (see DB_REGION_ANON below), the +.IR shmget (2) +shared memory segment interface will be used, where available, and +the MAP_ANON or MAP_ANONYMOUS options to +.IR mmap (2) +when +.IR shmget (2) +is not available. +.sp +When using +.IR shmget (2), +shared memory regions are named, and so multiple processes may share them. +When using the +.I mmap +MAP_ANON or MAP_ANONYMOUS options, shared memory regions are +.B not +named, and so may only be accessed by a single process and its threads. +.sp +.RS +.TP 5 +HP/UX note: +The +.IR shmget (2) +interfaces are not used on HP/UX, even though they exist, as anonymous +memory allocated using +.IR shmget (2) +cannot be used to store semaphores. +.RE +.sp +.Rt map +.TP 5 +DB_FUNC_OPEN +.Po open +.TP 5 +DB_FUNC_READ +.Po read +.TP 5 +DB_FUNC_REALLOC +.An realloc +.TP 5 +DB_FUNC_RUNLINK +The DB library requires the ability to remove shared memory regions from +the system, whether or not they are backed by regular files. +The +.I func +argument must conform to the following interface: +.sp +.nf +.ti +5 +int runlink(char *path); +.fi +.sp +The +.I path +argument is the path argument specified to the DB_FUNC_MAP function when +the region was mapped into memory. +.sp +.Rt runlink +.TP 5 +DB_FUNC_SEEK +The DB library requires the ability to specify that a subsequent read from +or write to a file will occur at a specific location in that file. +The +.I func +argument must conform to the following interface: +.sp +.nf +.ti +5 +int seek(int fd, size_t pgsize, db_pgno_t pageno, +.ti +8 +u_int32_t relative, int rewind, int whence); +.fi +.sp +The +.I fd +argument is an open file descriptor on the file. +The +.I seek +function must cause a subsequent read from or write to the file to occur +at a byte offset specified by the calculation: +.sp +.ti +5 +(pgsize * pageno) + relative +.sp +If +.I rewind +is non-zero, the byte offset is treated as a backwards seek, not a forwards one. +.sp +The +.I whence +argument specifies where in the file the byte offset is relative to, +as described by the \*(aa +.I lseek +system call. +.sp +.Rt seek +.TP 5 +DB_FUNC_SLEEP +The DB library requires the ability to cause a process to suspend itself +for a period of time, relinquishing control of the processor to any other +waiting thread of control. +The +.I func +argument must conform to the following interface: +.sp +.ti +5 +int sleep(u_long seconds, u_long microseconds); +.sp +The +.I seconds +and +.I microseconds +arguments specify the amount of time to wait until the suspending thread +of control should run again. +.sp +The +.I seconds +and +.I microseconds +arguments may not be normalized when the +.I sleep +function is called, i.e., the +.I microseconds +argument may be greater than 1000000. +.sp +.Rt sleep +.TP 5 +DB_FUNC_UNLINK +.Po unlink +.TP 5 +DB_FUNC_UNMAP +The DB library requires the ability to unmap a file or shared memory region +from memory. +The +.I func +argument must conform to the following interface: +.sp +.ti +5 +int unmap(void *addr, size_t len); +.sp +The +.I addr +argument is the argument returned by the DB_FUNC_MAP function when the +file or region was mapped into memory, and the +.I len +argument is the same as the +.I len +argument specified to the DB_FUNC_MAP function when the file or region +was mapped into memory. +.sp +.Rt unmap +.TP 5 +DB_FUNC_WRITE +.Po write +.TP 5 +DB_FUNC_YIELD +The DB library requires the ability to yield the processor from the current +thread of control to any other waiting threads of control. +The +.I func +argument must conform to the following interface: +.sp +.ti +5 +int yield(void); +.sp +.sp +The +.I yield +function must be able to cause the rescheduling all participants in the +current DB environment, whether threaded or not. +It may be incorrect to supply a thread +.I yield +function if more than a single process is operating in the DB environment. +This is because many thread-yield functions will not allow other processes +to run, +and the contested lock may be held by another process, not by another thread. +.sp +If no +.I yield +function is specified, or if the +.I yield +function returns an error, +the function specified by the DB_FUNC_SLEEP entry will be used instead or +subsequently, i.e., if no +.I yield +function is specified, +or it is possible for the +.I yield +function to fail, the +.I sleep +function +.B must +cause the processor to reschedule any waiting threads of control for execution. +.\".sp +.\".ft B +.\"Solaris architecture note: +.\".ft R +.\"Because of bugs in versions of Solaris before version 5.6, +.\"the DB library uses the +.\".IR sema_wait (3T) +.\"call instead of the +.\".IR sema_trywait (3T) +.\"call. +.\"For this reason, replacing the +.\".I yield +.\"function will have no effect on Solaris. +.sp +.Rt yield +.PP +.Rt db_jump_set +.PP +.Fn db_value_set +The +.I db_value_set +function enables applications to specify underlying DB library functionality. +The +.I which +argument specifies the information being set by the argument +.IR value . +.PP +The following values of +.I which +are supported: +.TP 5 +DB_MUTEXLOCKS +Grant all requested mutual exclusion mutexes without testing for their +availability. +This flag should never be used for any other purpose than debugging. +.TP 5 +DB_REGION_ANON +Setting +.I value +to a non-zero value specifies that shared memory regions are to be created +in anonymous memory, and not backed by a regular file. +DB_REGION_NAME differs from DB_REGION_ANON in that the former will fail if +the shared memory regions cannot be named, that is, if multiple processes +cannot use them. +See DB_FUNC_MAP for more information. +.TP 5 +DB_REGION_INIT +In some applications, the expense of page-faulting the shared memory regions +can affect performance, e.g., when the page-fault occurs while holding a lock, +other lock requests can convoy and overall throughput may decrease. +Setting +.I value +to a non-zero value specifies that one byte be read from each 4K page of the +shared memory region when the region is initialized. +.TP 5 +DB_REGION_NAME +Setting +.I value +to a non-zero value specifies that shared memory regions are to be created +in anonymous memory, and not backed by a regular file. +DB_REGION_NAME differs from DB_REGION_ANON in that the former will fail if +the shared memory regions cannot be named, that is, if multiple processes +cannot use them. +See DB_FUNC_MAP for more information. +.TP 5 +DB_TSL_SPINS +Specify the number of times mutexes should spin without blocking. +.sp +This value defaults to 1 on uniprocessor systems and to 50 times the number +of processors on multiprocessor systems. +.PP +.Rt db_value_set +.SH ERRORS +The +.I db_jump_set +function may fail and return +.I errno +for the following conditions: +.TP 5 +.Ei +.SH BUGS +No type checking is done of the +.I func +argument, +and specifying an invalid replacement routine will cause unpredictable +results. +.PP +Applications should be careful to replace related functions as a group +and at the same time. +Replacing DB_FUNC_MALLOC without replacing DB_FUNC_REALLOC is likely +to result in unpredictable results. +.PP +On Windows/95, files that are opened by multiple processes do not share +data correctly. To tell Berkeley DB to use a named region of the paging +file to share memory instead, use: +.PP +.RS +db_value_set(1, DB_REGION_NAME); +.RE +.PP +You do not need to do this if your application can guarantee that +only one process will be accessing DB files. +.PP +On Windows/NT, sharing of data between processes through the paging file +does not work correctly, so you should not call +.IR db_value_set . +That will allow DB to use the file itself for sharing, which works +correctly. +.SH "SEE ALSO" +.Sa diff --git a/mozilla/db/man/man.roff/db_intro.3 b/mozilla/db/man/man.roff/db_intro.3 new file mode 100644 index 00000000000..9df0940c99d --- /dev/null +++ b/mozilla/db/man/man.roff/db_intro.3 @@ -0,0 +1,1502 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_intro.so 10.35 (Sleepycat) 4/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_INTRO 3 "April 10, 1998" +.UC 7 +.SH "NAME +db \- the DB library overview and introduction +.SH "DESCRIPTION +.Gn +.PP +The DB library does not provide user interfaces, +data entry GUI's, +SQL support or any of the other standard user-level database interfaces. +What it does provide are the programmatic building blocks that allow you +to easily embed database-style functionality and support into other objects +or interfaces. +.SH "ARCHITECTURE +The DB library supports two different models of applications: client-server +and embedded. +.PP +In the client-server model, +a database server is created by writing an application that accepts requests +via some form of IPC and issues calls to the DB functions based on those +queries. +In this model, +applications are client programs that attach to the server and issue queries. +The client-server model trades performance for protection, +as it does not require that the applications share a protection domain with +the server, +but IPC/RPC is generally slower than a function call. +In addition, +this model simplifies the creation of network client-server applications. +.PP +In the embedded model, +an application links the DB library directly into its address space. +This provides for faster access to database functionality, +but means that the applications sharing log files, lock manager, +transaction manager or memory pool manager have the ability to read, +write, and corrupt each other's data. +.PP +It is the application designer's responsibility to select the appropriate +model for their application. +.PP +Applications require a single include file, +.IR , +which must be installed in an appropriate location on the system. +.SH "C++ +The C++ classes provide a thin wrapper around the C API, +with the major advantages being improved encapsulation and an optional +exception mechanism for errors. +.PP +The classes and methods are named in a fashion that directly corresponds +to structures and functions in the C interface. +Likewise, arguments to methods appear in the same order as the C interface, +except to remove the explicit ``this'' pointer. +The #defines used for flags are identical between the C and C++ interfaces. +.PP +As a rule, each C++ object has exactly one structure from the underlying C +API associated with it. +The C structure is allocated with each constructor call and deallocated +with each destructor call. +Thus, the rules the user needs to follow in allocating and deallocating +structures are the same between the C and C++ interfaces. +.PP +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, by using +.IR DbEnv::set_error_model () +(see +.IR DbEnv (3)). +For a discussion of the exception mechanism, see +.IR DbException (3). +.PP +For the rest of this manual page, C interfaces are listed as the primary +reference, and C++ interfaces following parenthetically, e.g., +.I db_open +(\c +.IR Db::open ). +.SH "JAVA +The Java classes provide a layer around the C API that is almost +identical to the C++ layer. +The classes and methods are, for the most part identical to the C++ +layer. Db constants and #defines are represented as "static final int" +values. Errors conditions appear as Java exceptions. +.PP +As in C++, each Java object has exactly one structure from the underlying C +API associated with it. The Java structure is allocated with each constructor +or open call, but is deallocated only when the Java GC does so. Because +the timing or ordering of GC is not predictable, the user should take +care to do a close() when finished with any object that has such a method. +.PP +.SH SUBSYSTEMS +The DB library is made up of five major subsystems, as follows: +.TP 5 +Access methods +The access methods subsystem is made up of general-purpose support for +creating and accessing files formatted as B+tree's, hashed files, and +fixed and variable length records. +These modules are useful in the absence of transactions for processes +that need fast, formatted file support. +See +.IR db_open (3) +and +.IR db_cursor (3) +(\c +.IR Db (3) +and +.IR Dbc (3)) +for more information. +.TP 5 +Locking +The locking subsystem is a general-purpose lock manager used by DB. +This module is useful in the absence of the rest of the DB package for +processes that require +a fast, configurable lock manager. +See +.IR db_lock (3) +(\c +.IR DbLockTab (3) +and +.IR DbLock (3)) +for more information. +.TP 5 +Logging +The logging subsystem is the logging support used to support the DB +transaction model. +It is largely specific to the DB package, +and unlikely to be used elsewhere. +See +.IR db_log (3) +(\c +.IR DbLog (3)) +for more information. +.TP 5 +Memory Pool +The memory pool subsystem is the general-purpose shared memory buffer pool +used by DB. +This module is useful outside of the DB package for processes that require +page-oriented, cached, shared file access. +See +.IR db_mpool (3) +(\c +.IR DbMpool (3) +and +.IR DbMpoolFile (3)) +for more information. +.TP 5 +Transactions +The transaction subsystem implements the DB transaction model. +It is largely specific to the DB package. +See +.IR db_txn (3) +(\c +.IR DbTxnMgr (3) +and +.IR DbTxn (3)) +for more information. +.PP +There are several stand-alone utilities that support the DB environment. +They are as follows: +.TP 5 +db_archive +The +.I db_archive +utility supports database backup, archival and log file administration. +See +.IR db_archive (1) +for more information. +.TP 5 +db_recover +The +.I db_recover +utility runs after an unexpected DB or system failure to restore the +database to a consistent state. +See +.IR db_recover (1) +for more information. +.TP 5 +db_checkpoint +The +.I db_checkpoint +utility runs as a daemon process, +monitoring the database log and periodically issuing checkpoints. +See +.IR db_checkpoint (1) +for more information. +.TP 5 +db_deadlock +The +.I db_deadlock +utility runs as a daemon process, +periodically traversing the database lock structures and aborting transactions +when it detects a deadlock. +See +.IR db_deadlock (1) +for more information. +.TP 5 +db_dump +The +.I db_dump +utility writes a copy of the database to a flat-text file in a portable +format. +See +.IR db_dump (1) +for more information. +.TP 5 +db_load +The +.I db_load +utility reads the flat-text file produced by +.IR db_dump , +and loads it into a database file. +See +.IR db_load (1) +for more information. +.TP 5 +db_stat +The +.I db_stat +utility displays statistics for databases and database environments. +See +.IR db_stat (1) +for more information. +.SH "NAMING AND THE DB ENVIRONMENT +The DB application environment is described by the +.IR db_appinit (3) +(\c +.IR DbEnv (3)) +manual page. +The +.I db_appinit +(\c +.IR DbEnv::appinit ) +function is used to create a consistent naming scheme for all of the +subsystems sharing a DB environment. +If +.I db_appinit +(\c +.IR DbEnv::appinit ) +is not called by a DB application, +naming is performed as specified by the manual page for the specific +subsystem. +.PP +DB applications that run with additional privilege should always call the +.I db_appinit +(\c +.IR DbEnv::appinit ) +function to initialize DB naming for their application. +This ensures that the environment variables DB_HOME and TMPDIR will only +be used if the application explicitly specifies that they are safe. +.SH "ADMINISTERING THE DB ENVIRONMENT +A DB environment consists of a database home directory and all the +long-running daemons necessary to ensure continued functioning of +DB and its applications. +In the presence of transactions, the checkpoint daemon, +.IR db_checkpoint , +must be run as long as there are applications present (see +.IR db_checkpoint (1) +for details). +When locking is being used, the deadlock detection daemon, +.IR db_deadlock , +must be run as long as there are applications present (see +.IR db_deadlock (1) +for details). +The +.I db_archive +utility provides information to facilitate log reclamation and +creation of database snapshots (see +.IR db_archive (1) +for details). +After application or system failure, the +.I db_recover +utility must be run before any applications are restarted +to return the database to a consistent state (see +.IR db_recover (1) +for details). +.PP +The simplest way to administer a DB application environment is to create a +single ``home'' directory that houses all the files for the applications +that are sharing the DB environment. +In this model, +the shared memory regions (i.e., the locking, logging, memory pool, and +transaction regions) and log files will be stored in the specified directory +hierarchy. +In addition, +all data files specified using relative pathnames will be named relative +to this home directory. +When recovery needs to be run (e.g., after system or application failure), +this directory is specified as the home directory to +.IR db_recover (1), +and the system is restored to a consistent state, +ready for the applications to be restarted. +.PP +In situations where further customization is desired, +such as placing the log files on a separate device, +it is recommended that the application installation process create a +configuration file named ``DB_CONFIG'' in the database home directory, +specifying the customization. +See +.IR db_appinit (3) +(\c +.IR DbEnv (3)) +for details on this procedure. +.PP +The DB architecture does not support placing the shared memory regions on +remote filesystems, e.g., +the Network File System (NFS) and the Andrew File System (AFS). +For this reason, the database home directory must reside on a local +filesystem. +Databases, +log files and temporary files may be placed on remote filesystems, +although the application may incur a performance penalty for doing so. +.PP +It is important to realize that all applications sharing a single home +directory implicitly trust each other. +They have access to each other's data as it resides in the shared memory +buffer pool and will share resources such as buffer space and locks. +At the same time, +any applications that access the same files +.B must +share an environment if consistency is to be maintained across the +different applications. +.SH "ERROR RETURNS +Except for the historic +.I dbm +and +.I hsearch +interfaces (see +.IR db_dbm (3) +and +.IR db_hsearch (3)), +DB does not use the global variable +.I errno +to return error values. +The return values for all DB functions can be grouped into three categories: +.TP 5 + 0 +A return value of 0 indicates that the operation was successful. +.TP 5 +>0 +A return value that is greater than 0 indicates that there was a system +error. +The +.I errno +value returned by the system is returned by the function, e.g., +when a DB function is unable to allocate memory, +the return value from the function will be ENOMEM. +.TP 5 +<0 +A return value that is less than 0 indicates a condition that was not +a system failure, +but was not an unqualified success, either. +For example, +a routine to retrieve a key/data pair from the database may return +DB_NOTFOUND when the key/data pair does not appear in the database, +as opposed to the value of 0, which would be returned if the key/data +pair were found in the database. +All such special values returned by DB functions are less than 0 in +order to avoid conflict with possible values of +.IR errno . +.PP +There are two special return values that are somewhat similar in meaning, +are returned in similar situations, +and therefore might be confused: DB_NOTFOUND and DB_KEYEMPTY. +The DB_NOTFOUND error return indicates that the requested key/data pair did +not exist in the database or that start- or end-of-file has been reached. +The DB_KEYEMPTY error return indicates that the requested key/data pair +logically exists but was never explicitly created by the application (the +recno access method will automatically create key/data pairs under some +circumstances, see +.IR db_open (3) +(\c +.IR Db (3)) +for more information), +or that the requested key/data pair was deleted and is currently in a deleted +state. +.SH "SIGNALS +When applications using DB receive signals, +it is important that they exit gracefully, +discarding any DB locks that they may hold. +This is normally done by setting a flag when a signal arrives, +and then checking for that flag periodically within the application. +Specifically, the signal handler should not attempt to release locks +and/or close the database handles itself. +This is not guaranteed to work correctly and the results are undefined. +.PP +If an application exits holding a lock, +the situation is no different than if the application crashed, +and all applications participating in the database environment +must be shutdown, and then recovery must be performed. +If this is not done, the locks that the application held can cause +unresolvable deadlocks inside the database, +and applications may then hang. +.SH "MULTI-THREADING +See +.IR db_thread (3) +for information on using DB in threaded applications. +.SH "DATABASE AND PAGE SIZES +DB stores database file page numbers as unsigned 32-bit numbers +and database file page sizes as unsigned 16-bit numbers. +This results in a maximum database size of 2^48. +The minimum database page size is 512 bytes, +resulting in a minimum maximum database size of 2^41. +.PP +DB is potentially further limited if the host system does not have +filesystem support for files larger than 2^32, +including seeking to absolute offsets within such files. +.PP +The maximum btree depth is 255. +.SH "BYTE ORDERING +The database files created by DB can be created in either little or +big-endian formats. +By default, the native format of the machine on which the database +is created will be used. +Any format database can be used on a machine with a different native +format, +although it is possible that the application will incur a performance +penalty for the run-time conversion. +.SH "EXTENDING DB +DB includes tools to simplify the development of application-specific +logging and recovery. +Specifically, +given a description of the information to be logged, +these tools will automatically create logging functions (functions that take +the values as parameters and construct a single record that is written to +the log), read functions (functions that read a log record and unmarshall the +values into a structure that maps onto the values you chose to log), +a print function (for debugging), +templates for the recovery functions, +and automatic dispatching to your recovery functions. +.SH "EXAMPLES +There are a number of examples included with the DB library distribution, +intended to demonstrate various ways of using the DB library. +.PP +Some applications require the use of formatted files to store data, +but do not require concurrent access and can cope with the loss of +data due to catastrophic failure. +Generally, +these applications create short-lived databases that are discarded or +recreated when the system fails. +Such applications need only use the DB access methods. +The DB access methods will use the memory pool subsystem, +but the application is unlikely to do so explicitly. +See the files +.IR examples/ex_access.c , +.IR examples/ex_btrec.c , +.I examples_cxx/AccessExample.cpp +and +.I java/src/com/sleepycat/examples/AccessExample.java +in the DB source distribution for C, C++, and Java language code examples of +how such applications might use the DB library. +.PP +Some applications require the use formatted files to store data, +but also need to use +.IR db_appinit (3) +(\c +.IR DbEnv::appinit (3)) +for environment initialization. +See the files +.IR examples/ex_appinit.c , +.I examples_cxx/AppinitExample.cpp +or +.I java/src/com/sleepycat/examples/AppinitExample.java +in the DB source distribution for C, C++ and Java language code examples of how +such an application might use the DB library. +.\".PP +.\"Applications that wish to transaction protect structures other than +.\"the DB access methods. +.\"See the file +.\".I examples/ex_trans.c +.\"in the DB source distribution for a C language code example of how such +.\"an application might use the DB library. +.PP +Some applications use the DB access methods, +but are also concerned about catastrophic failure, +and therefore need to transaction protect the underlying DB files. +See the files +.IR examples/ex_tpcb.c , +.I examples_cxx/TpcbExample.cpp +or +.I java/src/com/sleepycat/examples/TpcbExample.java +in the DB source distribution for C, C++ and Java language code examples of how +such an application might use the DB library. +.PP +Some applications will benefit from the ability to buffer input files +other than the underlying +DB access method files. +See the files +.I examples/ex_mpool.c +or +.I examples_cxx/MpoolExample.cpp +in the DB source distribution for C and C++ language code examples of how +such an application might use the DB library. +.PP +Some applications need a general-purpose lock manager separate from +locking support for the DB access methods. +See the files +.IR examples/ex_lock.c , +.I examples_cxx/LockExample.cpp +or +.I java/src/com/sleepycat/examples/LockExample.java +in the DB source distribution for C, C++ and Java language code examples of how +such an application might use the DB library. +.PP +Some applications will use the DB access methods in a threaded fashion, +including trickle flushing of the underlying buffer pool and deadlock +detection. +See the file +.I examples/ex_thread.c +in the DB source distribution for a C language code example of how +such an application might use the DB library. +Note that the Java API assumes a threaded environment and performs +all thread-specific initialization automatically. +.SH "COMPATIBILITY +The DB 2.0 library provides backward compatible interfaces for the +historic UNIX +.IR dbm (3), +.IR ndbm (3) +and +.IR hsearch (3) +interfaces. +See +.IR db_dbm (3) +and +.IR db_hsearch (3) +for further information on these interfaces. +It also provides a backward compatible interface for the historic DB 1.85 +release. +.ft B +DB 2.0 does not provide database compatibility for any of the above +interfaces, +and existing databases must be converted manually. +.ft R +To convert existing databases from the DB 1.85 format to the DB 2.0 format, +review the +.IR db_dump185 (1) +and +.IR db_load (1) +manual pages. +.PP +The name space in DB 2.0 has been changed from that of previous DB versions, +notably version 1.85, for portability and consistency reasons. +The only name collisions in the two libraries are the names used by the +.IR dbm (3), +.IR ndbm (3), +.IR hsearch (3) +and the DB 1.85 compatibility interfaces. +To include both DB 1.85 and DB 2.0 in a single library, +remove the +.IR dbm (3), +.IR ndbm (3) +and +.IR hsearch (3) +interfaces from either of the two libraries, +and the DB 1.85 compatibility interface from the DB 2.0 library. +This can be done by editing the library Makefiles and reconfiguring +and rebuilding the DB 2.0 library. +Obviously, if you use the historic interfaces, you will get the version +in the library from which you did not remove it. +Similarly, you will not be able to access DB 2.0 files using the DB 1.85 +compatibility interface, since you have removed that from the library +as well. +.PP +It is possible to simply relink applications written to the DB 1.85 interface +against the DB 2.0 library. +Recompilation of such applications is slightly more complex. +When the DB 2.0 library is installed, +it installs two include files, +.I db.h +and +.IR db_185.h . +The former file is likely to replace the DB 1.85 version's include file +which had the same name. +If this did not happen, +recompiling DB 1.85 applications to use the DB 2.0 library is simple: +recompile as done historically, and load against the DB 2.0 library +instead of the DB 1.85 library. +If, +however, +the DB 2.0 installation process has replaced the system's +.I db.h +include file, replace the application's include of +.I db.h +with inclusion of +.IR db_185.h , +recompile as done historically, +and then load against the DB 2.0 library. +.PP +Applications written using the historic interfaces of the DB library should +not require significant effort to port to the DB 2.0 interfaces. +While the functionality has been greatly enhanced in DB 2.0, +the historic interface and functionality and is largely unchanged. +Reviewing the application's calls into the DB library and updating those +calls to the new names, +flags and return values should be sufficient. +.PP +While +loading applications that use the DB 1.85 interfaces against the DB 2.0 +library, +or converting DB 1.85 function calls to DB 2.0 function calls will work, +reconsidering your application's interface to the DB database library in +light of the additional functionality in DB 2.0 is recommended, +as it is likely to result in enhanced application performance. +.SH "SEE ALSO: ADMINISTRATIVE AND OTHER UTILITIES +.\" make the line long for nroff. +.if n .ll 72 +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1) +.SH "SEE ALSO: C API +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_txn (3) +.SH "SEE ALSO: C++ and Java API +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.IR DbMpoolFile (3), +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +.SH "SEE ALSO: ADDITIONAL REFERENCES +.IR "LIBTP: Portable, Modular Transactions for UNIX" , +Margo Seltzer, Michael Olson, USENIX proceedings, Winter 1992. diff --git a/mozilla/db/man/man.roff/db_load.1 b/mozilla/db/man/man.roff/db_load.1 new file mode 100644 index 00000000000..0c9e38f2a10 --- /dev/null +++ b/mozilla/db/man/man.roff/db_load.1 @@ -0,0 +1,1056 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_load.so 10.11 (Sleepycat) 6/2/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_LOAD 1 "June 2, 1998" +.UC 7 +.SH NAME +db_load \- the DB database loader +.SH SYNOPSIS +\fBdb_load\fP [\fB-nT\fP] [\fB-c name=value\fP] +.br +.ti +5 +[\fB-f file\fP] [\fB-h home\fP] [\fB-t btree | hash | recno\fP] db_file +.SH DESCRIPTION +The +.I db_load +utility reads from the standard input +and loads it into the database +.IR db_file . +The database +.I db_file +is created if it does not already exist. +.PP +The input to +.I db_load +must be in the output format specified by the +.I db_dump +or +.I db_dump185 +utilities (see +.IR db_dump (1) +for more information), or as specified for the +.B \-T +option below. +.PP +The options are as follows: +.TP 5 +.B \-c +Specify configuration options for the DB_INFO structure provided to +.IR db_open (3), +ignoring any value they may have based on the input. +The command-line format is ``name=value''. +Supported keywords are listed below. +.TP 5 +.B \-f +Read from the specified +.I input +file instead of from the standard input. +.TP 5 +.B \-h +Specify a home directory for the database. +.sp +If a home directory is specified, the database environment is opened +using the DB_INIT_LOCK, DB_INIT_LOG, DB_INIT_MPOOL, DB_INIT_TXN and +DB_USE_ENVIRON flags to +.IR db_appinit (3). +(This means that +.I db_load +can be used to load data into databases while they are in use by other +processes.) +If the +.I db_appinit +call fails, or if no home directory is specified, the database is still +updated, but the environment is ignored, e.g., no locking is done. +.TP 5 +.B \-n +Do not overwrite existing keys in the database when loading into an +already existing database. +If a key/data pair cannot be loaded into the database for this reason, +a warning message is displayed on the standard error output and the +key/data pair are skipped. +.TP 5 +.B \-T +The +.B \-T +option allows non-DB applications to easily load text files into databases. +.sp +If the database to be created is of type +.B btree +or +.BR hash , +the input must be paired lines of text, +where the first line of the pair is the key item, +and the second line of the pair is its corresponding data item. +If the database to be created is of type +.BR recno , +the input must be lines of text, +where each line is a new data item for the database. +.sp +A simple escape mechanism, where newline and backslash (``\e'') characters +are special, is applied to the text input. +Newline characters are interpreted as record separators. +Backslash characters in the text will be interpreted in one of two ways: +if the backslash character precedes another backslash character, the pair +will be interpreted as a literal backslash. +If the backslash character precedes any other character, the two characters +following the backslash will be interpreted as hexadecimal specification of +a single character, e.g., ``\e0a'' is a newline character in the ASCII +character set. +.sp +For this reason, any backslash or newline characters that naturally occur +in the text input must be escaped to avoid misinterpretation by +.IR db_load . +.sp +If the +.B \-T +option is specified, the underlying access method type must be specified +using the +.B \-t +option. +.TP 5 +.B \-t +Specify the underlying access method. +If no +.B \-t +option is specified, the database will be loaded into a database of the +same type as was dumped, +e.g., a hash database will be created if a hash database was dumped. +.sp +Btree and hash databases may be converted from one to the other. +Recno databases may not be converted to any other database type +or from any other database type. +.PP +The +.I db_load +utility exits 0 on success, 1 if one or more key/data pairs were not +loaded into the database because the key already existed, and >1 if +an error occurs. +.SH KEYWORDS +The following keywords are supported for the +.B \-c +command-line option. +See +.IR db_open (3) +for further discussion of these keywords and what values should be specified. +.PP +The parenthetical listing specifies how the value part of the ``name=value'' +pair is interpreted. +Items listed as (boolean) expect value to be ``1'' (set) or ``0'' (unset). +Items listed as (number) convert value to a number. +Items listed as (string) use the characters of value directly. +.TP 5 +bt_minkey (number) +The minimum number of keys per page. +.TP 5 +db_lorder (number) +The byte order for integers in the stored database metadata. +.TP 5 +db_pagesize (number) +The size of pages used for nodes in the tree, in bytes. +.TP 5 +duplicates (boolean) +The value of the DB_DUP flag. +.TP 5 +h_ffactor (number) +The density within the hash table. +.TP 5 +h_nelem (number) +The size of the hash table. +.TP 5 +re_len (number) +Specify fixed-length records of the specified length. +.TP 5 +re_pad (string) +Specify the fixed-length record pad character. +.TP 5 +recnum (boolean) +The value of the DB_RECNUM flag. +.TP 5 +renumber (boolean) +The value of the DB_RENUMBER flag. +.SH "EXAMPLES +The +.I db_load +utility can be used to load text files into databases. +For example, the following command loads the standard UNIX +.I /etc/passwd +file into a database, +with the login name as the key item and the entire password entry as the +data item: +.nf +.RS +awk -F: '{print $1; print $0}' < /etc/passwd | + sed 's/\e\e/\e\e\e\e/g' | db_load -T -t hash passwd.db +.RE +.fi +.PP +Note that backslash characters naturally occurring in the text are escaped +to avoid interpretation as escape characters by +.IR db_load . +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR db_load : +.TP 5 +.Dh db_load +.SH "SEE ALSO" +.Gn +.PP +.Sa diff --git a/mozilla/db/man/man.roff/db_lock.3 b/mozilla/db/man/man.roff/db_lock.3 new file mode 100644 index 00000000000..e49f13e5897 --- /dev/null +++ b/mozilla/db/man/man.roff/db_lock.3 @@ -0,0 +1,1540 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_lock.so 10.29 (Sleepycat) 5/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_LOCK 3 "May 10, 1998" +.UC 7 +.SH NAME +db_lock \- lock manager +.SH SYNOPSIS +.nf +.ft B +#include + +int +lock_open(const char *dir, +.ti +5 +u_int32_t flags, int mode, DB_ENV *dbenv, DB_LOCKTAB **regionp); + +int +lock_id(DB_LOCKTAB *lt, u_int32_t *idp); + +int +lock_vec(DB_LOCKTAB *lt, u_int32_t locker, u_int32_t flags, +.ti +5 +DB_LOCKREQ list[], int nlist, DB_LOCKREQ **elistp); + +int +lock_get(DB_LOCKTAB *lt, u_int32_t locker, u_int32_t flags, +.ti +5 +const DBT *obj, const db_lockmode_t lock_mode, DB_LOCK *lock); + +int +lock_put(DB_LOCKTAB *lt, DB_LOCK lock); + +int +lock_close(DB_LOCKTAB *lt); + +int +lock_unlink(const char *dir, int force, DB_ENV *dbenv); + +int +lock_detect(DB_LOCKTAB *lt, u_int32_t flags, u_int32_t atype); + +int +lock_stat(DB_LOCKTAB *lt, +.ti +5 +DB_LOCK_STAT **spp, void *(*db_malloc)(size_t)); +.ft R +.fi +.SH DESCRIPTION +.Gn +.PP +This manual page describes the specific details of the locking interface. +.PP +The +.I db_lock +functions are the library interface intended to provide general-purpose +locking. +While designed to work with the other DB functions, these functions are +also useful for more general locking purposes. +Locks can be shared between processes. +In most cases, when multiple threads or processes are using locking, the +deadlock detector, +.IR db_deadlock (1), +should be run. +.PP +.Co "lock table" lock +.PP +.Fm +.Ft lock_open DB_LOCKTAB +.PP +.Mo "lock subsystem" +.PP +The locking subsystem is configured +.En "lock_open" "lock_closed" +.TP 5 +.Se +.TP 5 +const u_int8_t lk_conflicts[][]; +A +.I lk_modes +by +.I lk_modes +array. +A non-0 value for the array element: +.sp +.ti +5 +lk_conflicts[requested_mode][held_mode] +.sp +indicates that requested_mode and held_mode conflict. +The ``not-granted'' mode must be represented by 0. +If +.I lk_conflicts +is NULL, the conflicts array +.I db_rw_conflicts +is used; +see the section below entitled ``STANDARD LOCK MODES'' for a description +of that array. +.TP 5 +db_detect_t lk_detect; +If non-0, +specifies that the deadlock detector be run whenever a lock conflict occurs, +and specifies which transaction should be aborted in the case of a deadlock. +The +.I lk_detect +field must be set to one of the following values. +.RS +.TP 5 +DB_LOCK_DEFAULT +Use the default policy as specified in the +.IR db_deadlock (1) +man page. +.TP 5 +DB_LOCK_OLDEST +Abort the oldest transaction. +.TP 5 +DB_LOCK_RANDOM +Abort a random transaction involved in the deadlock. +.TP 5 +DB_LOCK_YOUNGEST +Abort the youngest transaction. +.RE +.TP 5 +u_int32_t lk_max; +The maximum number of locks to be held or requested in the table. +This value is used by +.I lock_open +to estimate how much space to allocate for various lock-table data +structures. +If +.I lk_max +is 0, a default value is used. +.TP 5 +u_int32_t lk_modes; +The number of lock modes to be recognized by the lock table (including +the ``not-granted'' mode). +If +.I lk_modes +is 0, the value DB_LOCK_RW_N is used; +see below for a description of that value. +.PP +.Rt lock_open +.PP +.Fn lock_id +The +.I lock_id +function copies a locker ID, +which is guaranteed to be unique in the specified lock table, +into the memory location referenced by +.IR idp . +.PP +The access methods +(see +.IR db_open (3)), +generate a unique locker ID for each file that is opened with locking. +During DB access method operation, +this locker ID will be used for all lock calls unless a transaction +identifier was specified for the call, +in which case the transaction ID specified is used for locking. +.PP +.Rt lock_id +.PP +.Fn lock_vec +The +.I lock_vec +function atomically obtains and releases one or more locks from the +specified table, +.IR lt . +The +.I lock_vec +function is intended to support acquisition or trading of multiple locks +under one lock table semaphore, +as is needed for lock coupling or in multigranularity locking for lock +escalation. +.PP +The +.I locker +argument specified to +.I lock_vec +is an unsigned 32-bit integer quantity. +It represents the entity requesting or releasing the lock. +.PP +The +.I flags +value must be set to 0 or the following value: +.TP 5 +DB_LOCK_NOWAIT +If a lock cannot be granted because the requested lock conflicts with an +existing lock, return immediately instead of waiting for the lock to +become available. +.PP +The +.I list +array provided to +.I lock_vec +is typedef'd in as DB_LOCKREQ. +A DB_LOCKREQ structure has at least the following fields, +which must be initialized before calling +.IR lock_vec : +.TP 5 +lockop_t op; +The operation to be performed, which must be set to one of the +following values: +.RS +.TP 5 +DB_LOCK_GET +Get a lock, as defined by the values of +.IR locker , +.I obj +and +.IR mode . +Upon return from +.IR lock_vec , +if the +.I lock +field is non-NULL, a reference to the acquired lock is stored there. +(This reference is invalidated by any call to +.I lock_vec +or +.I lock_put +that releases the lock.) +.TP 5 +DB_LOCK_PUT +The lock referenced by the contents of the +.I lock +field is released. +.TP 5 +DB_LOCK_PUT_ALL +All locks held by the +.I locker +are released. +(Any locks acquired as a part of the current call to +.I lock_vec +that appear after the DB_LOCK_PUT_ALL entry are not considered for this +operation). +.TP 5 +DB_LOCK_PUT_OBJ +All locks held by the +.IR locker , +on the object +.IR obj , +with the mode specified by +.IR lock_mode , +are released. +A +.I lock_mode +of DB_LOCK_NG indicates that all locks on the object should be released. +Note that any locks acquired as a part of the current call to +.I lock_vec +that occur before the DB_LOCK_PUT_OBJ will also be released; those acquired +afterwards will not be released. +.RE +.TP 5 +const DBT obj; +An untyped byte string that specifies the object to be locked or +released. +.TP 5 +const lockmode_t mode; +The lock mode, used as an index into +.IR lt 's +conflict array. +.TP 5 +DB_LOCK lock; +A lock reference. +.PP +The +.I nlist +argument specifies the number of elements in the +.I list +array. +.PP +If any of the requested locks cannot be acquired, +or any of the locks to be released cannot be released, +the operations before the failing operation are guaranteed to have completed +successfully, and +.I lock_vec +returns a non-zero value. +In addition, if +.I elistp +is not NULL, it is set to point to the DB_LOCKREQ entry that +was being processed when the error occurred. +.PP +In the case of an error, +.I lock_vec +may return one of the following values: +.TP 5 +DB_LOCK_DEADLOCK +The specified +.I locker +was selected as a victim in order to resolve a deadlock. +.TP 5 +DB_LOCK_NOTHELD +The lock cannot be released, as it was not held by the +.IR locker . +.TP 5 +DB_LOCK_NOTGRANTED +A lock was requested that could not be granted and the +.I flag +parameter was set to DB_LOCK_NOWAIT. +In this case, if non-NULL, +.I elistp +identifies the request that was granted. +.PP +.Ro lock_vec +.PP +.Fn lock_get +The +.I lock_get +function is a simple interface to the +.I lock_vec +functionality, and is equivalent to calling the +.I lock_vec +function with the +.I lt +and +.I locker +arguments, +.I elistp +and +.I conflict +arguments, and a single element +.I list +array, for which the +.I op +field is DB_LOCK_GET, and the +.IR obj , +.I lock_mode +and +.I lock +fields are represented by the arguments of the same name. +Note that the type of the +.I obj +argument to +.I lock_get +is different from the +.I obj +element found in the DB_LOCKREQ structure. +The +.I lock_get +function returns success and failure as described for the +.I lock_vec +function. +.PP +.Fn lock_put +The +.I lock_put +function is a simple interface to the +.I lock_vec +functionality, and is equivalent to calling the +.I lock_vec +function with a single element +.I list +array, for which the +.I op +field is DB_LOCK_PUT and the +.I lock +field is represented by the argument of the same name. +The +.I lock_put +function returns success and failure as described for the +.I lock_vec +function. +.PP +.Fn lock_close +The +.I lock_close +function disassociates the calling process from the lock table +.IR lt . +Note that +.I lock_close +does not release any locks still held by the closing process. +(This provides functionality for long-lived locks.) +Processes that wish to have all their locks released can do so by +issuing the appropriate +.I lock_vec +call. +.PP +.Cc lock +.PP +When multiple threads are using the DB_LOCKTAB handle concurrently, +only a single thread may call the +.I lock_close +function. +.PP +.Rt lock_close +.PP +.Un "lock table" lock +.PP +.Fn lock_detect +The +.I lock_detect +function runs one iteration of the deadlock detector on the specified table, +.IR lt . +The deadlock detector traverses the lock table, detects deadlocks, +and if it finds one, +marks one of the participating transactions for abort and then +returns. +.PP +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.PP +.TP 5 +DB_LOCK_CONFLICT +Only run the deadlock detector if a lock conflict has occurred since +the last time that the deadlock detector was run. +.PP +The +.I atype +parameter specifies which transaction to abort in the case of deadlock. +It must be set to one of values described above for the +.I lk_detect +field of the +.I DB_ENV +structure. +.PP +.Rt lock_detect +.PP +.Uf lock_detect db_deadlock +.PP +.Fn lock_stat +The +.I lock_stat +function creates a statistical structure and copies a pointer to it into +the user-specified memory location. +.PP +.Ma "Statistical structure" +.PP +The lock region statistics are stored in a structure of type +DB_LOCK_STAT (typedef'd in ). +The following DB_LOCK_STAT fields will be filled in: +.TP 5 +.TP 5 +u_int32_t st_magic; +The magic number that identifies a file as a lock file. +.Nt +u_int32_t st_version; +The version of the lock file type. +.Nt +u_int32_t st_refcnt; +The number of references to the region. +.Nt +u_int32_t st_regsize; +The size of the region. +.Nt +u_int32_t st_maxlocks; +The maximum number of locks possible. +.Nt +u_int32_t st_nmodes; +The number of lock modes. +.Nt +u_int32_t st_numobjs; +The number of unique objects locked. +.Nt +u_int32_t st_nlockers; +The number of unique lockers. +.Nt +u_int32_t st_nconflicts; +The total number of locks not immediately available due to conflicts. +.Nt +u_int32_t st_nrequests; +The total number of locks requested. +.Nt +u_int32_t st_nreleases; +The total number of locks released. +.Nt +u_int32_t st_ndeadlocks +The number of deadlocks detected. +.Nt +u_int32_t st_region_wait; +The number of times that a thread of control was forced to wait before +obtaining the region lock. +.Nt +u_int32_t st_region_nowait; +The number of times that a thread of control was able to obtain +the region lock without waiting. +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR db_lock : +.TP 5 +.Eh lock_open +.TP 5 +.Ev "lock table" lock +.SH "STANDARD LOCK MODES" +The include file declares two commonly used conflict arrays: +.TP 5 +const u_int8_t db_lock_rw_conflicts[]; +This is a conflict array for a simple scheme using shared and exclusive +lock modes. +.TP 5 +const u_int8_t db_lock_riw_conflicts[]; +This is a conflict array that involves various intent lock modes (e.g., +intent shared) that are used for multigranularity locking. +.PP +Their associated sizes are DB_LOCK_RW_N and DB_LOCK_RIW_N. +.PP +In addition, the include file defines the type +.IR db_lockmode_t , +which is the type of the lock modes used with the standard tables above: +.RS +.TP 5 +DB_LOCK_NG +not granted (always 0) +.TP 5 +DB_LOCK_READ +read (shared) +.TP 5 +DB_LOCK_WRITE +write (exclusive) +.RE +.SH "ERRORS" +.Ee lock_open +.na +.Nh +close(2), +db_version(3), +fcntl(2), +fflush(3), +lock_unlink(3), +lseek(2), +malloc(3), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec lock_open +.TP 5 +.Em +.TP 5 +.Ei +.sp +.Et +.PP +.Ee lock_vec +.na +.Nh +fcntl(2), +fflush(3), +lock_detect(3), +lseek(2), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +strerror(3), +and +write(2). +.Hy +.ad +.PP +.Ec lock_vec +.TP 5 +[EACCES] +An attempt was made to release lock held by another locker. +.TP 5 +.Ei +.PP +.Ee lock_get +.na +.Nh +fcntl(2), +fflush(3), +lock_detect(3), +lseek(2), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +strerror(3), +and +write(2). +.Hy +.ad +.PP +.Ec lock_get +.TP 5 +.Ei +.PP +.Ee lock_put +.na +.Nh +fcntl(2), +fflush(3), +lock_detect(3), +lseek(2), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +strerror(3), +and +write(2). +.Hy +.ad +.PP +.Ec lock_put +.TP 5 +[EACCES] +An attempt was made to release lock held by another locker. +.TP 5 +.Ei +.PP +.Ee lock_close +.na +.Nh +close(2), +fcntl(2), +fflush(3), +munmap(2), +and +strerror(3). +.Hy +.ad +.PP +.Ee lock_unlink +.na +.Nh +close(2), +fcntl(2), +fflush(3), +malloc(3), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +and +unlink(2). +.Hy +.ad +.PP +.Ec lock_unlink +.TP 5 +.Eb +.PP +.Ee lock_detect +.na +.Nh +calloc(3), +fcntl(2), +fflush(3), +lseek(2), +malloc(3), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +strerror(3), +and +write(2). +.Hy +.ad +.SH "BUGS" +If a process dies while holding locks, those locks remain held and are +.B never +released. +In this case, all processes should exit as quickly as possible, so +that +.I db_recover +can be run. +.SH "SEE ALSO" +.Sa diff --git a/mozilla/db/man/man.roff/db_log.3 b/mozilla/db/man/man.roff/db_log.3 new file mode 100644 index 00000000000..288e27fcb6d --- /dev/null +++ b/mozilla/db/man/man.roff/db_log.3 @@ -0,0 +1,1802 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_log.so 10.31 (Sleepycat) 5/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_LOG 3 "May 10, 1998" +.UC 7 +.SH NAME +db_log \- log management functions +.SH SYNOPSIS +.nf +.ft B +#include + +int +log_open(const char *dir, +.ti +5 +u_int32_t flags, int mode, DB_ENV *dbenv, DB_LOG **regionp); + +int +log_close(DB_LOG *logp); + +int +log_flush(DB_LOG *logp, const DB_LSN *lsn); + +int +log_get(DB_LOG *logp, DB_LSN *lsn, DBT *data, u_int32_t flags); + +int +log_compare(const DB_LSN *lsn0, const DB_LSN *lsn1); + +int +log_file(DB_LOG *logp, const DB_LSN *lsn, char *namep, size_t len); + +int +log_put(DB_LOG *logp, DB_LSN *lsn, const DBT *data, u_int32_t flags); + +int +log_unlink(const char *dir, int force, DB_ENV *); + +int +log_archive(DB_LOG *logp, +.ti +5 +char **list[], u_int32_t flags, void *(*db_malloc)(size_t)); + +int +log_register(DB_LOG *logp, +.ti +5 +const DB *dbp, const char *name, DBTYPE type, u_int32_t *fidp); + +int +log_unregister(DB_LOG *logp, u_int32_t fid); + +int +log_stat(DB_LOG *logp, DB_LOG_STAT **spp, void *(*db_malloc)(size_t)); +.ft R +.fi +.SH DESCRIPTION +.Gn +.PP +This manual page describes the specific details of the log manager. +.PP +These functions provide a general-purpose logging facility sufficient +for transaction management. +Logs can be shared by multiple processes. +.PP +The DB transaction log is represented by a directory containing a set of +files. +The log is a record-oriented, append-only file, with records identified +and accessed via +.IR DB_LSN 's +(database log sequence numbers). +.PP +DB_LSN's are returned on each +.I log_put +operation, and only those DB_LSN's returned by +.I log_put +can later be used to retrieve records from the log. +.PP +.Co log log +.PP +If the log region is being created and log files are already present, +the log files are ``recovered'' and subsequent log writes are appended +to the end of the log. +.PP +The log is stored in one or more files in the specified directory. +Each file is named using the format +.sp +.ti +5 +log.NNNNN +.sp +where ``NNNNN'' is the sequence number of the file within the log. +.PP +.Fm +.Ft log_open DB_LOG +.PP +.Mo "log subsystem" +.PP +The logging subsystem is configured +.En "log_open" "log_close" +.TP 5 +.Se +.TP 5 +u_int32_t lg_max; +The maximum size of a single file in the log. +Because DB_LSN file offsets are unsigned 4-byte values, +.I lg_max +may not be larger than the maximum unsigned 4-byte value. +.sp +If +.I lg_max +is 0, a default value is used. +.sp +See the section "LOG FILE LIMITS" below, for further information. +.PP +.Rt log_open +.PP +.Fn log_close +The +.I log_close +function closes the log specified by the +.I logp +argument. +.PP +.Cc log +.PP +When multiple threads are using the DB_LOG handle concurrently, +only a single thread may call the +.I log_close +function. +.PP +.Rt log_close +.PP +.Fn log_flush +The +.I log_flush +function guarantees that all log records whose LSNs are less than or +equal to the +.I lsn +parameter have been written to disk. +If +.I lsn +is NULL, +all records in the log are flushed. +.PP +.Rt log_flush +.PP +.Fn log_get +The +.I log_get +function implements a cursor inside of the log, +retrieving records from the log according to the +.I lsn +and +.I flags +parameters. +.PP +The data field of the +.I data +structure is set to the record retrieved and the size field indicates the +number of bytes in the record. +See +.IR db_dbt (3) +for a description of other fields in the +.I data +structure. +.ft B +When multiple threads are using the returned DB_LOG handle concurrently, +either the DB_DBT_MALLOC or DB_DBT_USERMEM flags must be specified for +any DBT used for data retrieval. +.ft R +.PP +The +.I flags +parameter must be set to exactly one of the following values: +.TP 5 +DB_CHECKPOINT +The last record written with the DB_CHECKPOINT flag specified to the +.I log_put +function is returned in the +.I data +argument. +The +.I lsn +argument is overwritten with the DB_LSN of the record returned. +If no record has been previously written with the DB_CHECKPOINT flag +specified, +the first record in the log is returned. +.IP +If the log is empty the +.I log_get +function will return DB_NOTFOUND. +.TP 5 +DB_FIRST +The first record from any of the log files found in the log directory +is returned in the +.I data +argument. +The +.I lsn +argument is overwritten with the DB_LSN of the record returned. +.IP +If the log is empty the +.I log_get +function will return DB_NOTFOUND. +.TP 5 +DB_LAST +The last record in the log is returned in the +.I data +argument. +The +.I lsn +argument is overwritten with the DB_LSN of the record returned. +.IP +If the log is empty, +the +.I log_get +function will return DB_NOTFOUND. +.TP 5 +DB_NEXT +The current log position is advanced to the next record in the log and that +record is returned in the +.I data +argument. +The +.I lsn +argument is overwritten with the DB_LSN of the record returned. +.IP +If the pointer has not been initialized via DB_FIRST, DB_LAST, +DB_SET, DB_NEXT, or DB_PREV, +.I log_get +will return the first record in the log. +If the last log record has already been returned or the log is empty, +the +.I log_get +function will return DB_NOTFOUND. +.IP +If the log was opened with the DB_THREAD flag set, +calls to +.I log_get +with the DB_NEXT flag set will return EINVAL. +.TP 5 +DB_PREV +The current log position is moved to the previous record in the log and that +record is returned in the +.I data +argument. +The +.I lsn +argument is overwritten with the DB_LSN of the record returned. +.IP +If the pointer has not been initialized via DB_FIRST, DB_LAST, +DB_SET, DB_NEXT, or DB_PREV, +.I log_get +will return the last record in the log. +If the first log record has already been returned or the log is empty, +the +.I log_get +function will return DB_NOTFOUND. +.IP +If the log was opened with the DB_THREAD flag set, +calls to +.I log_get +with the DB_PREV flag set will return EINVAL. +.TP 5 +DB_CURRENT +Return the log record currently referenced by the log. +.IP +If the log pointer has not been initialized via DB_FIRST, DB_LAST, DB_SET, +DB_NEXT, or DB_PREV, or if the log was opened with the DB_THREAD flag set, +.I log_get +will return EINVAL. +.TP 5 +DB_SET +Retrieve the record specified by the +.I lsn +argument. +If the specified DB_LSN is invalid (e.g., does not appear in the log) +.I log_get +will return EINVAL. +.PP +.Ro log_get +.PP +.Fn log_compare +The +.I log_compare +function allows the caller to compare two DB_LSN's. +.I Log_compare +returns 0 if the two DB_LSN's are equal, 1 if +.I lsn0 +is greater than +.IR lsn1 , +and -1 if +.I lsn0 +is less than +.IR lsn1 . +.PP +.Fn log_file +The +.I log_file +function maps DB_LSN's to file names. +The +.I log_file +function copies the name of the file containing the record named by +.I lsn +into the memory location referenced by +.IR namep . +(This mapping of DB_LSN to file is needed for database administration. +For example, a transaction manager typically records the earliest DB_LSN +needed for restart, and the database administrator may want to archive +log files to tape when they contain only DB_LSN's before the earliest one +needed for restart.) +.PP +The +.I len +argument is the length of the +.I namep +buffer in bytes. +If +.I namep +is too short to hold the file name, +.I log_file +will return ENOMEM. +Note, as described above, +log file names are quite short, +on the order of 10 characters. +.PP +.Rt log_file +.PP +.Fn log_put +The +.I log_put +function appends records to the log. +The DB_LSN of the put record is returned in the +.I lsn +parameter. +The +.I flags +parameter may be set to one of the following values: +.TP 5 +DB_CHECKPOINT +The log should write a checkpoint record, recording any information +necessary to make the log structures recoverable after a crash. +.TP 5 +DB_CURLSN +The DB_LSN of the next record to be put is returned in the +.I lsn +parameter. +.TP 5 +DB_FLUSH +The log is forced to disk after this record is written, guaranteeing +that all records with DB_LSNs less than or equal to the one being put +are on disk +before this function returns (this function is most often used for +a transaction commit, see +.IR db_txn (3)). +.PP +The caller is responsible for providing any necessary structure to +.IR data . +(For example, in a write-ahead logging protocol, the application must +understand what part of +.I data +is an operation code, what part is redo information, and what part is +undo information. +In addition, most transaction managers will store in +.I data +the DB_LSN of the previous log record for the same transaction, +to support chaining back through the transaction's log records +during undo.) +.PP +.Rt log_put +.PP +.Un "log region" log +.PP +.Fn log_archive +The +.I log_archive +function creates a NULL-terminated array of log or database file names +and copies a pointer to them into the user-specified memory location +.IR list . +.PP +By default, +.I log_archive +returns the names of all of the log files that are no longer in use (e.g., +no longer involved in active transactions), +and that may be archived for catastrophic recovery and then removed +from the system. +If there were no file names to return, +.I list +will be set to NULL. +.PP +.Ma "Arrays of log file names" +.PP +The +.I flags +argument is specified by +.BR or 'ing +together one or more of the following values: +.TP 5 +DB_ARCH_ABS +All pathnames are returned as absolute pathnames, +instead of relative to the database home directory. +.TP 5 +DB_ARCH_DATA +Return the database files that need to be archived in order to recover +the database from catastrophic failure. +If any of the database files have not been accessed during the lifetime of +the current log files, +.I log_archive +will not include them in this list. +It is also possible that some of the files referenced in the log have +since been deleted from the system. +.TP 5 +DB_ARCH_LOG +Return all the log file names regardless of whether or not they are in +use. +.PP +The DB_ARCH_DATA and DB_ARCH_LOG flags are mutually exclusive. +.PP +.Rt log_archive +.PP +.Uf log_archive db_archive +See the +.IR db_archive (1) +manual page for more information on database archival procedures. +.PP +.Fn log_register +The +.I log_register +function registers a file name with the log manager and copies a file +identification number into the memory location referenced by +.IR fidp . +This file identification number should be used in all subsequent log +messages that refer to operations on this file. +The log manager records all file name to file identification number mappings +at each checkpoint so that a recovery process can identify the file to which +a record in the log refers. +.PP +The +.I log_register +function is called when an access method registers the open of a file. +The +.I dbp +parameter should be a pointer to the DB structure which is being returned +by the access method. +.PP +The +.I type +parameter should be one of the DB types specified in +.IR db_open (3), +e.g., DB_HASH. +.PP +.Rt log_register +.PP +.Fn log_unregister +The +.I log_unregister +function disassociates the file name to file identification number +mapping for the file identification number specified by the +.I fid +parameter. +The file identification number may then be reused. +.PP +.Rt log_unregister +.PP +.Fn log_stat +The +.I log_stat +function creates a statistical structure and copies a pointer to it into +the user-specified memory location. +.PP +.Ma "Statistical structure" +.PP +The log region statistics are stored in a structure of type +DB_LOG_STAT (typedef'd in ). +The following DB_LOG_STAT fields will be filled in: +.TP 5 +u_int32_t st_magic; +The magic number that identifies a file as a log file. +.Nt +u_int32_t st_version; +The version of the log file type. +.Nt +u_int32_t st_refcnt; +The number of references to the region. +.Nt +u_int32_t st_regsize; +The size of the region. +.Nt +int st_mode; +The mode of any created log files. +.Nt +u_int32_t st_lg_max; +The maximum size of any individual file comprising the log. +.Nt +u_int32_t st_w_mbytes; +The number of megabytes written to this log. +.Nt +u_int32_t st_w_bytes; +The number of bytes over and above +.I st_w_mbytes +written to this log. +.Nt +u_int32_t st_wc_mbytes; +The number of megabytes written to this log since the last checkpoint. +.Nt +u_int32_t st_wc_bytes; +The number of bytes over and above +.I st_wc_mbytes +written to this log since the last checkpoint. +.Nt +u_int32_t st_cur_file; +The current log file number. +.Nt +u_int32_t st_cur_offset; +The byte offset in the current log file. +.Nt +u_int32_t st_region_wait; +The number of times that a thread of control was forced to wait before +obtaining the region lock. +.Nt +u_int32_t st_region_nowait; +The number of times that a thread of control was able to obtain +the region lock without waiting. +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)limits.so 8.1 (Sleepycat) 5/3/98 +.\" +.de Ll +.SH "LOG FILE LIMITS +Log file sizes impose a time limit on the length of time a database +may be accessed under transaction protection, before it needs to be +dumped and reloaded (see +.IR db_dump(3) +and +.IR db_load(3)). +Unfortunately, the limits are potentially difficult to calculate. +.PP +The log file name consists of "log." followed by 5 digits, resulting +in a maximum of 99,999 log files. +Consider an application performing 600 transactions per second, for +15 hours a day, logged into 10Mb log files, where each transaction +is logging approximately 100 bytes of data. The calculation: +.PP +.nf +.RS +(10 * 2^20 * 99999) / +.ti +5 +(600 * 60 * 60 * 15 * 100) = 323.63 +.RE +.fi +.PP +indicates that the system will run out of log file space in +roughly 324 days. +If we increase the maximum size of the files from 10Mb to 100Mb, +the same calculation indicates that the application will run out +of log file space in roughly 9 years. +.PP +There is no way to reset the log file name space in Berkeley DB. +If your application is reaching the end of its log file name space, +you should: +.TP 5 +1. +Archive your databases as if to prepare for catastrophic failure (see +.IR db_archive (1) +for more information). +.TP 5 +2. +Dump and re-load +.B all +your databases (see +.IR db_dump (1) +and +.IR db_load (1) +for more information). +.TP 5 +3. +Remove all of the log files from the database environment (see +.IR db_archive (1) +for more information). +.TP 5 +4. +Restart your applications. +.. +.de Tl +.SH "TRANSACTION ID LIMITS +The transaction ID space in Berkeley DB is 2^31, or 2 billion entries. +It is possible that some environments may need to be aware of this +limitation. +Consider an application performing 600 transactions a second for 15 +hours a day. +The transaction ID space will run out in roughly 66 days: +.PP +.nf +.RS +2^31 / (600 * 15 * 60 * 60) = 66 +.RE +.fi +.PP +Doing only 100 transactions a second exhausts the transaction ID space +in roughly one year. +.PP +The transaction ID space is reset each time recovery is run. +If you reach the end of your transaction ID space, +shut down your applications and restart them after running recovery (see +.IR db_recover (1) +for more information). +The most recently allocated transaction ID is the +.I st_last_txnid +value in the transaction statistics information, and is displayed by the +.IR db_stat (1) +utility. +.. +.Ll +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR db_log : +.TP 5 +.Eh log_open DB_LOG_DIR +.TP 5 +.Ev log log +.SH ERRORS +.Ee log_open +.na +.Nh +atoi(3), +close(2), +db_version(3), +fcntl(2), +fflush(3), +log_close(3), +log_unlink(3), +lseek(2), +malloc(3), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +open(2), +opendir(3), +read(2), +readdir(3), +realloc(3), +sigfillset(3), +sigprocmask(2), +stat(2), +strchr(3), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +strncmp(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec log_open +.TP 5 +.Em +.TP 5 +.Ei +.sp +.Et +.sp +The specified file size was too large. +.PP +.Ee log_close +.na +.Nh +close(2), +fcntl(2), +fflush(3), +munmap(2), +and +strerror(3). +.Hy +.ad +.PP +.Ee log_flush +.na +.Nh +close(2), +fcntl(2), +fflush(3), +fsync(2), +lseek(2), +malloc(3), +memcpy(3), +memset(3), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec log_flush +.TP 5 +.Ei +.PP +.Ee log_get +.na +.Nh +atoi(3), +close(2), +fcntl(2), +fflush(3), +lseek(2), +malloc(3), +memcpy(3), +memset(3), +open(2), +opendir(3), +read(2), +readdir(3), +realloc(3), +sigfillset(3), +sigprocmask(2), +stat(2), +strchr(3), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +strncmp(3), +and +unlink(2). +.Hy +.ad +.PP +.Ec log_get +.TP 5 +.Ei +.sp +The DB_FIRST flag was specified and no log files were found. +.PP +.Ee log_file +.na +.Nh +close(2), +fcntl(2), +fflush(3), +malloc(3), +memcpy(3), +memset(3), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +and +unlink(2). +.Hy +.ad +.PP +.Ec log_file +.TP 5 +[ENOMEM] +The supplied buffer was too small to hold the log file name. +.PP +.Ee log_put +.na +.Nh +close(2), +fcntl(2), +fflush(3), +fsync(2), +lseek(2), +malloc(3), +memcpy(3), +memset(3), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +time(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec log_put +.TP 5 +.Ei +.sp +The record to be logged is larger than the maximum log record. +.PP +.Ee log_unlink +.na +.Nh +close(2), +fcntl(2), +fflush(3), +malloc(3), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +and +unlink(2). +.Hy +.ad +.PP +.Ec log_unlink +.TP 5 +.Eb +.PP +.Ee log_archive +.na +.Nh +close(2), +fcntl(2), +fflush(3), +getcwd(3), +log_compare(3), +log_get(3), +malloc(3), +memcpy(3), +memset(3), +open(2), +qsort(3), +realloc(3), +sigfillset(3), +sigprocmask(2), +stat(2), +strchr(3), +strcmp(3), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +and +unlink(2). +.Hy +.ad +.PP +.Ec log_archive +.TP 5 +.Ei +.sp +The log was corrupted. +.PP +.Ee log_register +.na +.Nh +close(2), +fcntl(2), +fflush(3), +fsync(2), +lseek(2), +malloc(3), +memcmp(3), +memcpy(3), +memset(3), +open(2), +realloc(3), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +time(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec log_register +.TP 5 +.Ei +.PP +.Ee log_unregister +.na +.Nh +close(2), +fcntl(2), +fflush(3), +fsync(2), +lseek(2), +malloc(3), +memcpy(3), +memset(3), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +time(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec log_unregister +.TP 5 +.Ei +.PP +.Ee log_stat +.na +.Nh +fcntl(2), +and +malloc(3). +.Hy +.ad +.SH BUGS +The log files are not machine architecture independent. +Specifically, log file metadata is not stored in a fixed byte order. +.SH "SEE ALSO" +.Sa diff --git a/mozilla/db/man/man.roff/db_mpool.3 b/mozilla/db/man/man.roff/db_mpool.3 new file mode 100644 index 00000000000..e82793d3b8e --- /dev/null +++ b/mozilla/db/man/man.roff/db_mpool.3 @@ -0,0 +1,2025 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_mpool.so 10.42 (Sleepycat) 5/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_MPOOL 3 "May 10, 1998" +.UC 7 +.SH NAME +db_mpool \- shared memory buffer pool +.SH SYNOPSIS +.nf +.ft B +#include + +int +memp_open(char *dir, +.ti +5 +u_int32_t flags, int mode, DB_ENV *dbenv, DB_MPOOL **regionp); + +int +memp_close(DB_MPOOL *mp); + +int +memp_fopen(DB_MPOOL *mp, char *file, u_int32_t flags, int mode, +.ti +5 +size_t pagesize, DB_MPOOL_FINFO *finfop, DB_MPOOLFILE **mpf); + +int +memp_fclose(DB_MPOOLFILE *mpf); + +int +memp_fget(DB_MPOOLFILE *mpf, +.ti +5 +db_pgno_t *pgnoaddr, u_int32_t flags, void **pagep); + +int +memp_fput(DB_MPOOLFILE *mpf, void *pgaddr, u_int32_t flags); + +int +memp_fset(DB_MPOOLFILE *mpf, void *pgaddr, u_int32_t flags); + +int +memp_fsync(DB_MPOOLFILE *mpf); + +int +memp_unlink(const char *dir, int force, DB_ENV *); + +int +memp_register(DB_MPOOL *mp, int ftype, +.ti +5 +int (*pgin)(db_pgno_t pgno, void *pgaddr, DBT *pgcookie), +.ti +5 +int (*pgout)(db_pgno_t pgno, void *pgaddr, DBT *pgcookie)); + +int +memp_trickle(DB_MPOOL *mp, int pct, int *nwrotep); + +int +memp_sync(DB_MPOOL *mp, LSN *lsn); + +int +memp_stat(DB_MPOOL *mp, DB_MPOOL_STAT **gsp, +.ti +5 +DB_MPOOL_FSTAT *(*fsp)[], void *(*db_malloc)(size_t)); +.ft R +.fi +.SH DESCRIPTION +.Gn +.PP +This manual page describes the specific details of the memory pool interface. +.PP +The +.I db_mpool +functions are the library interface intended to provide general-purpose, +page-oriented buffer management of one or more files. +While designed to work with the other DB functions, these functions are +also useful for more general purposes. +The memory pools (DB_MPOOL's) are referred to in this document as +simply ``pools''. +Pools may be shared between processes. +Pools are usually filled by pages from one or more files (DB_MPOOLFILE's). +Pages in the pool are replaced in LRU (least-recently-used) order, +with each new page replacing the page that has been unused the longest. +Pages retrieved from the pool using +.I memp_fget +are ``pinned'' in the pool, by default, +until they are returned to the pool's control using the +.I memp_fput +function. +.PP +.Co "memory pool" memp +.PP +.Fm +.TP 5 +DB_MPOOL_PRIVATE +Create a private MPOOL that is not shared with any other process (although +it may be shared with other threads). +.TP 5 +DB_NOMMAP +Always copy files in this memory pool into the local cache instead of mapping +them into process memory (see the description of the +.I mp_mmapsize +field of the DB_ENV structure for further information). +.Ft memp_open DB_MPOOL +.PP +.Mo "memory pool subsystem (other than files created by the \fImemp_fopen\fP function, which are separately specified)" +.PP +The memory pool subsystem is configured +.En "memp_open" "memp_closed" +.TP 5 +.Se +.TP 5 +size_t mp_mmapsize; +Files that are opened read-only in the pool (and that satisfy a few other +criteria) are, by default, +mapped into the process address space instead of being copied into the local +cache. +This can result in better-than-usual performance, +as available virtual memory is normally much larger than the local cache, +and page faults are faster than page copying on many systems. +However, +in the presence of limited virtual memory it can cause resource starvation, +and in the presence of large databases, +it can result in immense process sizes. +If +.I mp_mmapsize +is non-zero, +it specifies the maximum file size, in bytes, +for a file to be mapped into the process address space. +By default, +it is set to 10Mb. +.TP 5 +size_t mp_size; +The suggested size of the pool, in bytes. +This should be the size of the normal working data set of the application, +with some small amount of additional memory for unusual situations. +(Note, +the working set is not the same as the number of simultaneously referenced +pages, +and should be quite a bit larger!) +The default cache size is 128K bytes (16 8K byte pages), +and may not be less than 20K bytes. +.PP +.Rt memp_open +.PP +.Fn memp_close +The +.I memp_close +function closes the pool indicated by the DB_MPOOL pointer +.IR mp , +as returned by +.IR memp_open . +This function does not imply a call to +.IR memp_fsync , +but does imply a call to +.I memp_fclose +for any remaining open DB_MPOOLFILE pointers returned to this process by +calls to +.IR memp_fopen . +.PP +.Cc memp +.PP +When multiple threads are using the DB_MPOOL handle concurrently, +only a single thread may call the +.I memp_close +function. +.PP +.Rt memp_close +.PP +.Fn memp_fopen +The +.I memp_fopen +function opens a file in the pool specified by the DB_MPOOL argument, +copying the DB_MPOOLFILE pointer representing it into the memory +location referenced by +.IR mpf . +.PP +The +.I file +argument is the name of the file to be opened. +If +.I file +is NULL, +a private file is created that cannot be shared with any other process +(although it may be shared with other threads). +.PP +.Fm +.TP 5 +DB_NOMMAP +Always copy this file into the local cache instead of mapping it into +process memory (see the description of the +.I mp_mmapsize +field of the DB_ENV structure for further information). +.TP 5 +DB_RDONLY +Open any underlying files for reading only. +Any attempt to write the file using the pool functions will fail, +regardless of the actual permissions of the file. +.PP +.Mo "function \fImemp_fopen\fP" +.PP +The +.I pagesize +argument is the size, in bytes, +of the unit of transfer between the application and the pool, +although it is not necessarily the unit of transfer between the pool and +the source file. +.PP +Files opened in the pool may be further configured based on the +.I finfop +argument to +.IR memp_fopen , +which is a pointer to a structure of type DB_MPOOL_FINFO (typedef'd +in ). +No references to the +.I finfop +structure are maintained by DB, so it may be discarded when the +.I memp_fopen +function returns. +In order to ensure compatibility with future releases of DB, all fields +of the DB_MPOOL_FINFO structure that are not explicitly set should be +initialized to 0 before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the +C library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_MPOOL_FINFO structure used by +.I memp_fopen +are described below. +If +.I finfop +is NULL or any of its fields are set to their default value, +defaults appropriate for the system are used. +.TP 5 +int ftype; +The +.I ftype +field should be the same as a +.I ftype +argument previously specified to the +.I memp_register +function, +unless no input or output processing of the file's pages are necessary, +in which case it should be 0. +(See the description of the +.I memp_register +function for more information.) +.TP 5 +DBT *pgcookie; +The +.I pgcookie +field contains the byte string that is passed to the +.I pgin +and +.I pgout +functions for this file, if any. +If no +.I pgin +or +.I pgout +functions are specified, the +.I pgcookie +field should be NULL. +(See the description of the +.I memp_register +function for more information.) +.TP 5 +u_int8_t *fileid; +The +.I fileid +field is a unique identifier for the file. +The mpool +functions must be able to uniquely identify files in order that multiple +processes sharing a file will correctly share its underlying pages. +Normally, the +.I fileid +field should be NULL and the mpool functions will use the file's +device and inode numbers (see +.IR stat (2)) +for this purpose. +On some filesystems, (e.g., FAT or NFS) file device and inode numbers are +not necessarily unique across system reboots. +.ft B +Applications wanting to maintain a shared memory buffer pool across system +reboots, where the pool contains pages from files stored on such filesystems, +must specify a unique file identifier to the +.I memp_fopen +call and each process opening or registering the file must provide the same +unique identifier. +.ft R +If the +.I fileid +field is non-NULL, +it must reference a DB_FILE_ID_LEN (as defined in ) length array of +bytes that will be used to uniquely identify the file. +This should not be necessary for most applications. +Specifically, it is not necessary if the memory pool is re-instantiated after +each system reboot, the application is using the DB access methods instead of +calling the pool functions explicitly, or the files in the memory pool are +stored on filesystems where the file device and inode numbers do not change +across system reboots. +.TP 5 +int32_t lsn_offset; +The +.I lsn_offset +field is the zero-based byte offset in the page of the page's log sequence +number (LSN), +or \-1 if no LSN offset is specified. +(See the description of the +.I memp_sync +function for more information.) +.TP 5 +u_int32_t clear_len; +The +.I clear_len +field is the number of initial bytes in a page that should be set to zero +when the page is created as a result of the DB_MPOOL_CREATE or DB_MPOOL_NEW +flags being specified to +.IR memp_fget . +If +.I finfop +is NULL or +.I clear_len +is 0, the entire page is cleared. +.PP +.Rt memp_fopen +.PP +.Fn memp_fclose +The +.I memp_fclose +function closes the source file indicated by the DB_MPOOLFILE pointer +.IR mpf . +This function does not imply a call to +.IR memp_fsync , +i.e. no pages are written to the source file as as a result of calling +.IR memp_fclose . +.PP +In addition, +if the +.I file +argument to +.I memp_fopen +was NULL, +any underlying files created for this DB_MPOOLFILE will be removed. +.PP +.Rt memp_fclose +.PP +.Fn memp_fget +The +.I memp_fget +function copies a pointer to the page with the page number specified by +.IR pgnoaddr , +from the source file specified by the DB_MPOOLFILE pointer +.IR mpf , +into the memory location referenced by +.IR pagep . +If the page does not exist or cannot be retrieved, +.I memp_fget +will fail. +.PP +The returned page is size_t type aligned. +.PP +.ft B +Page numbers begin at 0, e.g., the first page in the file is page number 0, +not page number 1. +.ft R +.PP +The +.I flags +argument is specified by +.BR or 'ing +together one or more of the following values: +.TP 5 +DB_MPOOL_CREATE +If the specified page does not exist, create it. +In this case, the +.I pgin +function, if specified, is called. +.TP 5 +DB_MPOOL_LAST +Return the last page of the source file and copy its page number +to the location referenced by +.IR pgnoaddr . +.TP 5 +DB_MPOOL_NEW +Create a new page in the file and copy its page number to the location +referenced by +.IR pgnoaddr . +In this case, the +.I pgin +function, if specified, is not called. +.PP +The DB_MPOOL_CREATE, DB_MPOOL_LAST and DB_MPOOL_NEW flags are mutually +exclusive. +.PP +Created pages have all their bytes set to 0, unless otherwise specified +when the file was opened. +.PP +All pages returned by +.I memp_fget +will be retained (i.e. ``pinned'') in the pool until a subsequent call to +.IR memp_fput . +.PP +.Rt memp_fget +.PP +.Fn memp_fput +The +.I memp_fput +function indicates that the page referenced by +.I pgaddr +can be evicted from the pool. +.I Pgaddr +must be an address previously returned by +.IR memp_fget . +.PP +The +.I flags +argument is specified by +.BR or 'ing +together one or more of the following values: +.TP 5 +DB_MPOOL_CLEAN +Clear any previously set modification information (i.e., +don't bother writing the page back to the source file). +.TP 5 +DB_MPOOL_DIRTY +The page has been modified and must be written to the source file +before being evicted from the pool. +.TP 5 +DB_MPOOL_DISCARD +The page is unlikely to be useful in the near future, +and should be discarded before other pages in the pool. +.PP +The DB_MPOOL_CLEAN and DB_MPOOL_DIRTY flags are mutually exclusive. +.PP +.Rt memp_fput +.PP +.Fn memp_fset +The +.I memp_fset +function sets the flags associated with the page referenced by +.I pgaddr +without unpinning it from the pool. +.I Pgaddr +must be an address previously returned by +.IR memp_fget . +The +.I flags +argument to +.I memp_fset +is specified by +.BR or 'ing +together one or more of the values specified as flags for the +.I memp_fput +call. +.PP +.Rt memp_fset +.PP +.Fn memp_fsync +The +.I memp_fsync +function writes all pages associated with the DB_MPOOLFILE pointer +.IR mpf , +that were marked as modified using +.I memp_fput +or +.IR memp_fset , +back to the source file. +If any of the modified pages are also pinned (i.e., +currently referenced by this or another process) +.I memp_fsync +will ignore them. +.PP +.Rc memp_fsync +and DB_INCOMPLETE if there were pages which were modified but which +.I memp_fsync +was unable to write. +.PP +.Un "memory pool" memp +.PP +.Fn memp_register +The +.I memp_register +function registers page-in and page-out functions for files of type +.I ftype +in the specified pool. +.PP +If the +.I pgin +function is non-NULL, +it is called each time a page is read into the memory pool from a file +of type +.IR ftype , +or a page is created for a file of type +.I ftype +(see the DB_MPOOL_CREATE flag for the +.I memp_fget +function). +If the +.I pgout +function is non-NULL, +it is called each time a page is written to a file of type +.IR ftype . +.PP +Both the +.I pgin +and +.I pgout +functions are called with the page number, +a pointer to the page being read or written, +and any argument +.I pgcookie +that was specified to the +.I memp_fopen +function when the file was opened. +The +.I pgin +and +.I pgout +functions should return 0 on success, +and an applicable non-zero +.I errno +value on failure, +in which case the +.I db_mpool +function calling it will also fail, +returning that +.I errno +value. +.PP +The purpose of the +.I memp_register +function is to support processing when pages are entered into, +or flushed from, +the pool. +A file type must be specified to make it possible for unrelated +threads or processes, +that are sharing a pool, +to evict each other's pages from the pool. +Applications should call +.IR memp_register , +during initialization, +for each type of file requiring input or output processing that will be +sharing the underlying pool. +(No registry is necessary for the standard access method types, +btree, hash and recno, as +.IR db_open (3) +registers them separately.) +.PP +If a thread or process does not call +.I memp_register +for a file type, +it is impossible for it to evict pages for any file requiring input or +output processing from the pool. +For this reason, +.I memp_register +should always be called by each application sharing a pool for each type of +file included in the pool, +regardless of whether or not the application itself uses files of that type. +.PP +There are no standard values for +.IR ftype , +.IR pgin , +.I pgout +and +.IR pgcookie , +except that the +.I ftype +value for a file must be a non-zero positive number, +as negative numbers are reserved for internal use by the DB library. +For this reason, +applications sharing a pool must coordinate their values amongst themselves. +.PP +.Rt memp_register +.PP +.Fn memp_trickle +The +.I memp_trickle +function ensures that at least +.I pct +percent of the pages in the shared memory pool are clean by writing dirty +pages to their backing files. +If the +.I nwrotep +argument is non-NULL, +the number of pages that were written to reach the correct percentage is +returned in the memory location it references. +.PP +The purpose of the +.I memp_trickle +function is to enable a memory pool manager to ensure that a page is +always available for reading in new information without having to wait +for a write. +.PP +.Rt memp_trickle +.PP +.Fn memp_sync +The +.I memp_sync +function ensures that all the modified pages in the pool with log sequence +numbers (LSNs) less than the +.I lsn +argument are written to disk. +.PP +.Rc memp_sync +and DB_INCOMPLETE if there were pages which need to be written but which +.I memp_sync +was unable to write immediately. +In addition, +if +.I memp_sync +returns success, +the value of +.I lsn +will be overwritten with the largest LSN from any page which was written by +.I memp_sync +to satisfy this request. +.PP +The purpose of the +.I memp_sync +function is to enable a transaction manager to ensure, +as part of a checkpoint, +that all pages modified by a certain time have been written to disk. +Pages in the pool which cannot be written back to disk immediately (e.g., +are currently pinned) are written to disk as soon as it is possible to do +so. +The expected behavior of the transaction manager is to call the +.I memp_sync +function and then, +if the return indicates that some pages could not be written immediately, +to wait briefly and retry again with the same LSN until the +.I memp_sync +function returns that all pages have been written. +.PP +To support the +.I memp_sync +functionality, +it is necessary that the pool functions know the location of the LSN on +the page for each file type. +This location should be specified when the file is opened using the +.I memp_fopen +function. +(Note, it is not required that the LSN be aligned on the page in any way.) +.PP +.Fn memp_stat +The +.I memp_stat +function creates statistical structures and copies pointers to them into +user-specified memory locations. +The statistics include the number of files participating in the pool, +the active pages in the pool, +and information as to how effective the cache has been. +.PP +.Ma "Statistical structures" +.PP +If +.I gsp +is non-NULL, the global statistics for the memory pool +.I mp +are copied into the memory location it references. +The global statistics are stored in a structure of type +DB_MPOOL_STAT (typedef'd in ). +.PP +The following DB_MPOOL_STAT fields will be filled in: +.TP 5 +u_int32_t st_refcnt; +The number of references to the region. +.Nt +u_int32_t st_regsize; +The size of the region. +.Nt +size_t st_cachesize; +Cache size in bytes. +.Nt +u_int32_t st_cache_hit; +Requested pages found in the cache. +.Nt +u_int32_t st_cache_miss; +Requested pages not found in the cache. +.Nt +u_int32_t st_map; +Requested pages mapped into the process' address space (there is no +available information as to whether or not this request caused disk I/O, +although examining the application page fault rate may be helpful). +.Nt +u_int32_t st_page_create; +Pages created in the cache. +.Nt +u_int32_t st_page_in; +Pages read into the cache. +.Nt +u_int32_t st_page_out; +Pages written from the cache to the backing file. +.Nt +u_int32_t st_ro_evict; +Clean pages forced from the cache. +.Nt +u_int32_t st_rw_evict; +Dirty pages forced from the cache. +.Nt +u_int32_t st_hash_buckets; +Number of hash buckets in buffer hash table. +.Nt +u_int32_t st_hash_searches; +Total number of buffer hash table lookups. +.Nt +u_int32_t st_hash_longest; +The longest chain ever encountered in buffer hash table lookups. +.Nt +u_int32_t st_hash_examined; +Total number of hash elements traversed during hash table lookups. +.Nt +u_int32_t st_page_clean; +Clean pages currently in the cache. +.Nt +u_int32_t st_page_dirty; +Dirty pages currently in the cache. +.Nt +u_int32_t st_page_trickle; +Dirty pages written using the +.I memp_trickle +interface. +.Nt +u_int32_t st_region_wait; +The number of times that a thread of control was forced to wait before +obtaining the region lock. +.Nt +u_int32_t st_region_nowait; +The number of times that a thread of control was able to obtain +the region lock without waiting. +.PP +If +.I fsp +is non-NULL, +a pointer to a NULL-terminated variable length array of statistics for +individual files, +in the memory pool +.IR mp , +is copied into the memory location it references. +If no individual files currently exist in the memory pool, +.I fsp +will be set to NULL. +.PP +The per-file statistics are stored in structures of type +DB_MPOOL_FSTAT (typedef'd in ). +The following DB_MPOOL_FSTAT fields will be filled in for each file in the +pool, i.e., each element of the array: +.TP 5 +char *file_name; +The name of the file. +.Nt +size_t st_pagesize; +Page size in bytes. +.Nt +u_int32_t st_cache_hit; +Requested pages found in the cache. +.Nt +u_int32_t st_cache_miss; +Requested pages not found in the cache. +.Nt +u_int32_t st_map; +Requested pages mapped into the process' address space. +.Nt +u_int32_t st_page_create; +Pages created in the cache. +.Nt +u_int32_t st_page_in; +Pages read into the cache. +.Nt +u_int32_t st_page_out; +Pages written from the cache to the backing file. +.PP +.Rt memp_stat +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR db_mpool : +.TP 5 +.Eh memp_open +.TP 5 +.Ev "memory pool" memp +.SH ERRORS +.Ee memp_open +.na +.Nh +DBmemp->pgin(3), +DBmemp->pgout(3), +close(2), +db_version(3), +fcntl(2), +fflush(3), +fsync(2), +log_compare(3), +log_flush(3), +lseek(2), +malloc(3), +memcmp(3), +memcpy(3), +memp_close(3), +memp_unlink(3), +memset(3), +mmap(2), +munmap(2), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +time(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec memp_open +.TP 5 +.Em +.TP 5 +.Ei +.sp +.Et +.sp +A NULL pathname was specified without the DB_MPOOL_PRIVATE flag. +.sp +The specified cache size was impossibly small. +.PP +.Ee memp_close +.na +.Nh +close(2), +fcntl(2), +fflush(3), +memp_fclose(3), +munmap(2), +and +strerror(3). +.Hy +.ad +.PP +.Ee memp_fopen +.na +.Nh +DBmemp->pgin(3), +DBmemp->pgout(3), +close(2), +fcntl(2), +fflush(3), +fsync(2), +log_compare(3), +log_flush(3), +lseek(2), +malloc(3), +memcmp(3), +memcpy(3), +memset(3), +mmap(2), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +time(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec memp_fopen +.TP 5 +.Ei +.sp +The file has already been entered into the pool, +and the +.I pagesize +value is not the same as when the file was entered into the pool, +or the length of the file is not zero or a multiple of the +.IR pagesize . +.sp +The DB_RDONLY flag was specified for an in-memory pool. +.PP +.Ee memp_fclose +.na +.Nh +close(2), +fcntl(2), +fflush(3), +munmap(2), +and +strerror(3). +.Hy +.ad +.PP +.Ee memp_fget +.na +.Nh +DBmemp->pgin(3), +DBmemp->pgout(3), +close(2), +fcntl(2), +fflush(3), +fsync(2), +log_compare(3), +log_flush(3), +lseek(2), +malloc(3), +memcmp(3), +memcpy(3), +memset(3), +mmap(2), +open(2), +read(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +time(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec memp_fget +.TP 5 +[EAGAIN] +The page reference count has overflowed. +(This should never happen unless there's a bug in the application.) +.TP 5 +.Ei +.sp +The DB_MPOOL_NEW flag was set and the source file was not opened for writing. +.sp +The requested page does not exist and DB_MPOOL_CREATE was not set. +.sp +More than one of DB_MPOOL_CREATE, DB_MPOOL_LAST and DB_MPOOL_NEW was set. +.TP 5 +[ENOMEM] +The cache is full and no more pages will fit in the pool. +.PP +.Ee memp_fput +.na +.Nh +DBmemp->pgin(3), +DBmemp->pgout(3), +close(2), +fcntl(2), +fflush(3), +fsync(2), +log_compare(3), +log_flush(3), +lseek(2), +malloc(3), +memcmp(3), +memcpy(3), +memset(3), +mmap(2), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +time(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec memp_fput +.TP 5 +[EACCES] +The DB_MPOOL_DIRTY flag was set and the source file was not opened for +writing. +.TP 5 +.Ei +.sp +The +.I pgaddr +parameter does not reference a page returned by +.IR memp_fget . +.sp +More than one of DB_MPOOL_CLEAN and DB_MPOOL_DIRTY was set. +.PP +.Ee memp_fset +.na +.Nh +fcntl(2), +and +fflush(3). +.Hy +.ad +.PP +.Ec memp_fset +.TP 5 +.Ei +.PP +.Ee memp_fsync +.na +.Nh +DBmemp->pgin(3), +DBmemp->pgout(3), +close(2), +fcntl(2), +fflush(3), +fsync(2), +log_compare(3), +log_flush(3), +lseek(2), +malloc(3), +memcpy(3), +memset(3), +open(2), +qsort(3), +realloc(3), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ee memp_unlink +.na +.Nh +close(2), +fcntl(2), +fflush(3), +malloc(3), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +and +unlink(2). +.Hy +.ad +.PP +.Ec memp_unlink +.TP 5 +.Eb +.PP +.Ee memp_register +.na +.Nh +fcntl(2), +and +malloc(3). +.Hy +.ad +.PP +.Ee memp_trickle +.na +.Nh +DBmemp->pgin(3), +DBmemp->pgout(3), +close(2), +fcntl(2), +fflush(3), +fsync(2), +log_compare(3), +log_flush(3), +lseek(2), +malloc(3), +memcmp(3), +memcpy(3), +memset(3), +mmap(2), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +time(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec memp_trickle +.TP 5 +.Ei +.PP +.Ee memp_sync +.na +.Nh +DBmemp->pgin(3), +DBmemp->pgout(3), +close(2), +fcntl(2), +fflush(3), +fsync(2), +log_compare(3), +log_flush(3), +lseek(2), +malloc(3), +memcmp(3), +memcpy(3), +memset(3), +mmap(2), +open(2), +qsort(3), +realloc(3), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +time(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec memp_sync +.TP 5 +.Ei +.sp +The +.I memp_sync +function was called without logging having been initialized in the environment. +.PP +.Ee memp_stat +.na +.Nh +fcntl(2), +malloc(3), +memcpy(3), +and +strlen(3). +.Hy +.ad +.SH "SEE ALSO" +.Sa diff --git a/mozilla/db/man/man.roff/db_open.3 b/mozilla/db/man/man.roff/db_open.3 new file mode 100644 index 00000000000..162dc5d36cd --- /dev/null +++ b/mozilla/db/man/man.roff/db_open.3 @@ -0,0 +1,2375 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" 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. 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. +.\" +.\" @(#)db_open.so 10.55 (Sleepycat) 5/3/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_OPEN 3 "May 3, 1998" +.UC 7 +.SH NAME +db_open \- database access methods +.SH SYNOPSIS +.nf +.ft B +#include + +int +db_open(const char *file, DBTYPE type, u_int32_t flags, +.ti +5 +int mode, DB_ENV *dbenv, DB_INFO *dbinfo, DB **dbpp); + +int +DB->close(DB *db, u_int32_t flags); + +int +DB->cursor(DB *db, DB_TXN *txnid, DBC **cursorp); + +int +DB->del(DB *db, DB_TXN *txnid, DBT *key, u_int32_t flags); + +int +DB->fd(DB *db, int *fdp); + +int +DB->get(DB *db, DB_TXN *txnid, DBT *key, DBT *data, u_int32_t flags); + +int +DB->put(DB *db, DB_TXN *txnid, DBT *key, DBT *data, u_int32_t flags); + +int +DB->sync(DB *db, u_int32_t flags); + +int +DB->stat(DB *db, void *sp, void *(*db_malloc)(size_t), u_int32_t flags); +.ft R +.fi +.SH DESCRIPTION +.Gn +.PP +This manual page describes the overall structure of the DB library access +methods. +.PP +The currently supported file formats are btree, hashed and recno. +The btree format is a representation of a sorted, balanced tree structure. +The hashed format is an extensible, dynamic hashing scheme. +The recno format supports fixed or variable length records (optionally +retrieved from a flat text file). +.PP +Storage and retrieval for the DB access methods are based on key/data pairs, +or DBT structures as they are typedef'd in the include file. +See +.IR db_dbt (3) +for specific information on the structure and capabilities of a DBT. +.PP +The +.I db_open +function opens the database represented by +.I file +for both reading and writing. +Files never intended to be shared or preserved on disk may be created by +setting the file parameter to NULL. +.PP +The +.I db_open +function copies a pointer to a DB structure (as typedef'd in the +include file), into the memory location referenced by +.IR dbpp . +This structure includes a set of functions to perform various database +actions, +as described below. +.Rt db_open +.PP +Note, while most of the access methods use +.I file +as the name of an underlying file on disk, +this is not guaranteed. +Also, +calling +.I db_open +is a reasonably expensive operation. +(This is based on a model where the DBMS keeps a set of files open for a +long time rather than opening and closing them on each query.) +.PP +The +.I type +argument is of type DBTYPE (as defined in the include file) +and must be set to one of DB_BTREE, DB_HASH, DB_RECNO or DB_UNKNOWN. +If +.I type +is DB_UNKNOWN, +the database must already exist and +.I db_open +will then determine if it is of type DB_BTREE, DB_HASH or DB_RECNO. +.PP +.Fm +.TP 5 +DB_NOMMAP +Do not map this file (see +.IR db_mpool (3) +for further information). +.TP 5 +DB_RDONLY +Open the database for reading only. +Any attempt to write the database using the access methods will fail +regardless of the actual permissions of any underlying files. +.Ft db_open DB +.TP 5 +DB_TRUNCATE +``Truncate'' the database if it exists, i.e., +behave as if the database were just created, +discarding any previous contents. +.PP +.Mo "access methods" +.SH DB_ENV +The access methods make calls to the other subsystems in the DB library +.En "db_open" "close" +.TP 5 +DB_LOG *lg_info; +If modifications to the file being opened should be logged, the +.I lg_info +field contains a return value from the function +.IR log_open . +If +.I lg_info +is NULL, no logging is done by the DB access methods. +.TP 5 +DB_LOCKTAB *lk_info; +If locking is required for the file being opened (as is the case +when multiple processes or threads are accessing the same file), +the +.I lk_info +field contains a return value from the function +.IR lock_open . +If +.I lk_info +is NULL, no locking is done by the DB access methods. +.sp +If both locking and transactions are being performed (i.e., both +.I lk_info +and +.I tx_info +are non-NULL), +the transaction ID will be used as the locker ID. +If only locking is being performed, +.I db_open +will acquire a locker ID from +.IR lock_id (3), +and will use it for all locks required for this instance of +.IR db_open . +.TP 5 +DB_MPOOL *mp_info; +If the cache for the file being opened should be maintained in a shared +buffer pool, the +.I mp_info +field contains a return value from the function +.IR memp_open . +If +.I mp_info +is NULL, a memory pool may still be created by DB, +but it will be private to the application and managed by DB. +.TP 5 +DB_TXNMGR *tx_info; +If the accesses to the file being opened should take place in the context +of transactions (providing atomicity and error recovery), the +.I tx_info +field contains a return value from the function +.I txn_open +(see +.IR db_txn (3)). +If transactions are specified, +the application is responsible for making suitable calls to +.IR txn_begin , +.IR txn_abort , +and +.IR txn_commit . +If +.I tx_info +is NULL, +no transaction support is done by the DB access methods. +.sp +When the access methods are used in conjunction with transactions, +the application must abort the transaction (using +.IR txn_abort ) +if any of the transaction protected access method calls (i.e., +any calls other than open, close and sync) returns a system error +(e.g., deadlock, which returns EAGAIN). +As described by +.IR db_intro (3), +a system error is any value greater than 0. +.SH DB_INFO +The access methods are configured using the DB_INFO data structure +argument to +.IR db_open . +The DB_INFO structure is typedef'd in and has a large number +of fields, +most specific to a single access method, +although a few are shared. +The fields that are common to all access methods are listed here; +those specific to an individual access method are described below. +No reference to the DB_INFO structure is maintained by DB, +so it is possible to discard it as soon as the +.I db_open +call returns. +.PP +In order to ensure compatibility with future releases of DB, +all fields of the DB_INFO structure should be initialized to 0 before +the structure is used. +Do this by declaring the structure external or static, +or by calling the C library function +.IR bzero (3) +or +.IR memset (3). +.PP +If possible, +defaults appropriate for the system are used for the DB_INFO fields if +.I dbinfo +is NULL or any fields of the DB_INFO structure are set to 0. +The following DB_INFO fields may be initialized before calling +.IR db_open : +.TP 5 +size_t db_cachesize; +A suggested maximum size of the memory pool cache, in bytes. +If +.I db_cachesize +is 0, an appropriate default is used. +It is an error to specify both the +.I mp_info +field and a non-zero +.IR db_cachesize . +.sp +.ft B +Note, +the minimum number of pages in the cache should be no less than 10, +and the access methods will fail if an insufficiently large cache is specified. +.ft R +In addition, +for applications that exhibit strong locality in their data access +patterns, +increasing the size of the cache can significantly improve application +performance. +.TP 5 +int db_lorder; +The byte order for integers in the stored database metadata. +The number should represent the order as an integer, for example, +big endian order is the number 4,321, and little endian order is +the number 1,234. +If +.I db_lorder +is 0, the host order of the machine where the DB library was compiled +is used. +.sp +The value of +.I db_lorder +is ignored except when databases are being created. +If a database already exists, +the byte order it uses is determined when the file is read. +.sp +.ft B +The access methods provide no guarantees about the byte ordering of the +application data stored in the database, +and applications are responsible for maintaining any necessary ordering. +.ft R +.TP 5 +size_t db_pagesize; +The size of the pages used to hold items in the database, in bytes. +The minimum page size is 512 bytes and the maximum page size is 64K bytes. +If +.I db_pagesize +is 0, +a page size is selected based on the underlying filesystem I/O block +size. +The selected size has a lower limit of 512 bytes and an upper limit +of 16K bytes. +.TP 5 +void *(*db_malloc)(size_t); +The flag DB_DBT_MALLOC, when specified in the DBT structure, will cause +the DB library to allocate memory which then becomes the responsibility +of the calling application. +See +.IR db_dbt (3) +for more information. +.sp +On systems where there may be multiple library versions of malloc +(notably Windows NT), specifying the DB_DBT_MALLOC flag will fail +because the DB library will allocate memory from a different heap +than the application will use to free it. +To avoid this problem, the +.I db_malloc +field should be set to point to the application's allocation routine. +If +.I db_malloc +is non-NULL, +it will be used to allocate the memory returned when the DB_DBT_MALLOC flag +is set. +The +.I db_malloc +function must match the calling conventions of the +.IR malloc (3) +library routine. +.SH BTREE +The btree data structure is a sorted, balanced tree structure storing +associated key/data pairs. +Searches, insertions, +and deletions in the btree will all complete in O (lg base N) where base +is the average number of keys per page. +Often, +inserting ordered data into btrees results in pages that are half-full. +This implementation has been modified to make ordered (or inverse ordered) +insertion the best case, +resulting in nearly perfect page space utilization. +.PP +Space freed by deleting key/data pairs from the database is never reclaimed +from the filesystem, +although it is reused where possible. +This means that the btree storage structure is grow-only. +If sufficiently many keys are deleted from a tree that shrinking the +underlying database file is desirable, +this can be accomplished by creating a new tree from a scan of the existing +one. +.PP +The following additional fields and flags may be initialized in the DB_INFO +structure before calling +.IR db_open , +when using the btree access method: +.TP 5 +int (*bt_compare)(const DBT *, const DBT *); +The +.I bt_compare +function is the key comparison function. +It must return an integer less than, equal to, or greater than zero if the +first key argument is considered to be respectively less than, equal to, +or greater than the second key argument. +The same comparison function must be used on a given tree every time it +is opened. +.sp +The +.I data +and +.I size +fields of the DBT are the only fields that may be used for the purposes +of this comparison. +.sp +If +.I bt_compare +is NULL, +the keys are compared lexically, +with shorter keys collating before longer keys. +.TP 5 +u_int32_t bt_minkey; +The minimum number of keys that will be stored on any single page. +This value is used to determine which keys will be stored on overflow +pages, i.e. if a key or data item is larger than the pagesize divided +by the +.I bt_minkey +value, +it will be stored on overflow pages instead of in the page itself. +The +.I bt_minkey +value specified must be at least 2; if +.I bt_minkey +is 0, a value of 2 is used. +.TP 5 +size_t (*bt_prefix)(const DBT *, const DBT *); +The +.I bt_prefix +function is the prefix comparison function. +If specified, this function must return the number of bytes of the second key +argument that are necessary to determine that it is greater than the first +key argument. +If the keys are equal, the key length should be returned. +.sp +The +.I data +and +.I size +fields of the DBT are the only fields that may be used for the purposes +of this comparison. +.sp +This is used to compress the keys stored on the btree internal pages. +The usefulness of this is data dependent, +but in some data sets can produce significantly reduced tree sizes and +search times. +If +.I bt_prefix +is NULL, and no comparison function is specified, +a default lexical comparison function is used. +If +.I bt_prefix +is NULL and a comparison function is specified, no prefix comparison is +done. +.TP 5 +u_int32_t flags; +The following additional flags may be specified by +.BR or 'ing +together one or more of the following values: +.RS +.TP 5 +.de DU +DB_DUP +Permit duplicate keys in the tree, +i.e. insertion when the key of the key/data pair being inserted already +exists in the tree will be successful. +The ordering of duplicates in the tree is determined by the order of +insertion, +unless the ordering is otherwise specified by use of a cursor (see +.IR db_cursor (3) +for more information.) +.. +.DU +It is an error to specify both DB_DUP and DB_RECNUM. +.TP 5 +DB_RECNUM +Support retrieval from btrees using record numbers. +For more information, see the DB_SET_RECNO flag to the +.I DB->get +function (below), +and the cursor +.I c_get +function (in +.IR db_cursor (3)). +.sp +Logical record numbers in btrees are mutable in the face of record +insertion or deletion. +See the DB_RENUMBER flag in the RECNO section below for further discussion. +.sp +Maintaining record counts within a btree introduces a serious point of +contention, +namely the page locations where the record counts are stored. +In addition, +the entire tree must be locked during both insertions and deletions, +effectively single-threading the tree for those operations. +Specifying DB_RECNUM can result in serious performance degradation for +some applications and data sets. +.sp +It is an error to specify both DB_DUP and DB_RECNUM. +.RE +.SH HASH +The hash data structure is an extensible, dynamic hashing scheme. +Backward compatible interfaces to the functions described in +.IR dbm (3), +.IR ndbm (3) +and +.IR hsearch (3) +are provided, however these interfaces are not compatible with +previous file formats. +.PP +The following additional fields and flags may be initialized in the DB_INFO +structure before calling +.IR db_open , +when using the hash access method: +.TP 5 +u_int32_t h_ffactor; +The desired density within the hash table. +It is an approximation of the number of keys allowed to accumulate in any +one bucket, determining when the hash table grows or shrinks. +The default value is 0, indicating that the fill factor will be selected +dynamically as pages are filled. +.TP 5 +u_int32_t (*h_hash)(const void *, u_int32_t); +The +.I h_hash +field is a user defined hash function; +if +.I h_hash +is NULL, +a default hash function is used. +Since no hash function performs equally well on all possible data, +the user may find that the built-in hash function performs poorly with +a particular data set. +User specified hash functions must take a pointer to a byte string and +a length as arguments and return a u_int32_t value. +.IP +If a hash function is specified, +.I hash_open +will attempt to determine if the hash function specified is the same as +the one with which the database was created, and will fail if it detects +that it is not. +.TP 5 +u_int32_t h_nelem; +An estimate of the final size of the hash table. +If not set or set too low, +hash tables will expand gracefully as keys are entered, +although a slight performance degradation may be noticed. +The default value is 1. +.TP 5 +u_int32_t flags; +The following additional flags may be specified by +.BR or 'ing +together one or more of the following values: +.RS +.TP 5 +.DU +.SH RECNO +The recno access method provides support for fixed and variable length +records, +optionally backed by a flat text (byte stream) file. +Both fixed and variable length records are accessed by their logical +record number. +.PP +It is valid to create a record whose record number is more than one +greater than the last record currently in the database. +For example, the creation of record number 8, when records 6 and 7 +do not yet exist, is not an error. +However, any attempt to retrieve such records (e.g., records 6 and 7) +will return DB_KEYEMPTY. +.PP +Deleting a record will not, by default, renumber records following +the deleted record (see DB_RENUMBER below for more information). +Any attempt to retrieve deleted records will return DB_KEYEMPTY. +.PP +The following additional fields and flags may be initialized in the DB_INFO +structure before calling +.IR db_open , +when using the recno access method: +.TP 5 +int re_delim; +For variable length records, +if the +.I re_source +file is specified and the DB_DELIMITER flag is set, +the delimiting byte used to mark the end of a record in the source file. +If the +.I re_source +file is specified and the DB_DELIMITER flag is not set, + characters (i.e. ``\en'', 0x0a) are interpreted as +end-of-record markers. +.TP 5 +u_int32_t re_len; +The length of a fixed-length record. +.TP 5 +int re_pad; +For fixed length records, +if the DB_PAD flag is set, +the pad character for short records. +If the DB_PAD flag is not set, + characters (i.e., 0x20) are used for padding. +.TP 5 +char *re_source; +The purpose of the +.I re_source +field is to provide fast access and modification to databases that are +normally stored as flat text files. +.sp +If the +.I re_source +field is non-NULL, +it specifies an underlying flat text database file that is read to initialize +a transient record number index. +In the case of variable length records, +the records are separated by the byte value +.IR re_delim . +For example, +standard UNIX byte stream files can be interpreted as a sequence of variable +length records separated by characters. +.sp +In addition, +when cached data would normally be written back to the underlying database +file (e.g., the +.I close +or +.I sync +functions are called), +the in-memory copy of the database will be written back to the +.I re_source +file. +.sp +By default, the backing source file is read lazily, +i.e., records are not read from the file until they are requested by the +application. +.ft B +If multiple processes (not threads) are accessing a recno database +concurrently and either inserting or deleting records, +the backing source file must be read in its entirety before more than +a single process accesses the database, +and only that process should specify the backing source file as part +of the db_open call. +.ft R +See the DB_SNAPSHOT flag below for more information. +.sp +.ft B +Reading and writing the backing source file specified by re_source +cannot be transactionally protected because it involves filesystem +operations that are not part of the DB transaction methodology. +.ft R +For this reason, +if a temporary database is used to hold the records, i.e., a NULL was +specified as the +.I file +argument to +.IR db_open , +it is possible to lose the contents of the +.I re_source +file, e.g., if the system crashes at the right instant. +If a file is used to hold the database, i.e., a file name was specified +as the +.I file +argument to +.IR db_open , +normal database recovery on that file can be used to prevent information +loss, +although it is still possible that the contents of +.I re_source +will be lost if the system crashes. +.sp +The +.I re_source +file must already exist (but may be zero-length) when +.I db_open +is called. +.sp +For all of the above reasons, the +.I re_source +field is generally used to specify databases that are read-only for DB +applications, +and that are either generated on the fly by software tools, +or modified using a different mechanism, e.g., a text editor. +.TP 5 +u_int32_t flags; +The following additional flags may be specified by +.BR or 'ing +together one or more of the following values: +.RS +.TP 5 +DB_DELIMITER +The +.I re_delim +field is set. +.TP 5 +DB_FIXEDLEN +The records are fixed-length, not byte delimited. +The structure element +.I re_len +specifies the length of the record, +and the structure element +.I re_pad +is used as the pad character. +.sp +Any records added to the database that are less than +.I re_len +bytes long are automatically padded. +Any attempt to insert records into the database that are greater than +.I re_len +bytes long will cause the call to fail immediately and return an error. +.TP 5 +DB_PAD +The +.I re_pad +field is set. +.TP 5 +DB_RENUMBER +Specifying the DB_RENUMBER flag causes the logical record numbers to be +mutable, +and change as records are added to and deleted from the database. +For example, +the deletion of record number 4 causes records numbered 5 and greater +to be renumbered downward by 1. +If a cursor was positioned to record number 4 before the deletion, +it will reference the new record number 4, if any such record exists, +after the deletion. +If a cursor was positioned after record number 4 before the deletion, +it will be shifted downward 1 logical record, +continuing to reference the same record as it did before. +.sp +Using the +.I c_put +or +.I put +interfaces to create new records will cause the creation of multiple +records if the record number is more than one greater than the largest +record currently in the database. +For example, creating record 28, +when record 25 was previously the last record in the database, +will create records 26 and 27 as well as 28. +Attempts to retrieve records that were created in this manner +will result in an error return of DB_KEYEMPTY. +.sp +If a created record is not at the end of the database, +all records following the new record will be automatically renumbered +upward by 1. +For example, +the creation of a new record numbered 8 causes records numbered 8 and +greater to be renumbered upward by 1. +If a cursor was positioned to record number 8 or greater before the insertion, +it will be shifted upward 1 logical record, +continuing to reference the same record as it did before. +.sp +For these reasons, +concurrent access to a recno database with the DB_RENUMBER flag specified +may be largely meaningless, although it is supported. +.TP 5 +DB_SNAPSHOT +This flag specifies that any specified +.I re_source +file be read in its entirety when +.I db_open +is called. +If this flag is not specified, +the +.I re_source +file may be read lazily. +.RE +.PP +.SH "DB OPERATIONS" +The DB structure returned by +.I db_open +describes a database type, +and includes a set of functions to perform various actions, +as described below. +Each of these functions takes a pointer to a DB structure, and may take +one or more DBT *'s and a flag value as well. +The fields of the DB structure are as follows: +.TP 5 +DBTYPE type; +The type of the underlying access method (and file format). +Set to one of DB_BTREE, DB_HASH or DB_RECNO. +This field may be used to determine the type of the database after a +return from +.I db_open +with the +.I type +argument set to DB_UNKNOWN. +.TP 5 +int (*close)(DB *db, u_int32_t flags); +A pointer to a function to flush any cached information to disk, +close any open cursors (see +.IR db_cursor (3)), +free any allocated resources, and close any underlying files. +Since key/data pairs are cached in memory, failing to sync the +file with the +.I close +or +.I sync +function may result in inconsistent or lost information. +.IP +The +.I flags +parameter must be set to 0 or the following value: +.RS +.TP 5 +DB_NOSYNC +Do not flush cached information to disk. +.RE +.IP +The DB_NOSYNC flag is a dangerous option. +It should only be set 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. +.IP +.ft B +It is important to understand that flushing cached information to disk +only minimizes the window of opportunity for corrupted data. +.ft R +While 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 +.IR close , +replace the original database with the updated copy. +.IP +When multiple threads are using the DB handle concurrently, +only a single thread may call the DB handle close function. +.IP +.Rt close +.TP 5 +int (*cursor)(DB *db, DB_TXN *txnid, DBC **cursorp); +A pointer to a function to create a cursor and copy a pointer to it into +the memory referenced by +.IR cursorp . +.IP +A cursor is a structure used to provide sequential access through a database. +This interface and its associated functions replaces the functionality +provided by the +.I seq +function in previous releases of the DB library. +.IP +.Tx +If transaction protection is enabled, +cursors must be opened and closed within the context of a transaction, +and the +.I txnid +parameter specifies the transaction context in which the cursor may be used. +See +.IR db_cursor (3) +for more information. +.IP +.Rt cursor +.TP 5 +int (*del)(DB *db, DB_TXN *txnid, DBT *key, u_int32_t flags); +.br +A pointer to a function to remove key/data pairs from the database. +The key/data pair associated with the specified +.I key +is discarded from the database. +In the presence of duplicate key values, +all records associated with the designated key will be discarded. +.Tx +.IP +.Fl +.IP +.Rc del +and DB_NOTFOUND if the specified +.I key +did not exist in the file. +.TP 5 +int (*fd)(DB *db, int *fdp); +A pointer to a function that copies a file descriptor representative +of the underlying database into the memory referenced by +.IR fdp . +A file descriptor referencing the same file will be returned to all +processes that call +.I db_open +with the same +.I file +argument. +This file descriptor may be safely used as an argument to the +.IR fcntl (2) +and +.IR flock (2) +locking functions. +The file descriptor is not necessarily associated with any of the +underlying files used by the access method. +.IP +The +.I fd +function only supports a coarse-grained form of locking. +Applications should use the lock manager where possible. +.IP +.Rt fd +.TP 5 +int (*get)(DB *db, DB_TXN *txnid, +.ti +5 +DBT *key, DBT *data, u_int32_t flags); +.br +A pointer to a function that is an interface for keyed retrieval from +the database. +The address and length of the data associated with the specified +.I key +are returned in the structure referenced by +.IR data . +.sp +In the presence of duplicate key values, +.I get +will return the first data item for the designated key. +Duplicates are sorted by insert order except where this order has been +overridden by cursor operations. +.ft B +Retrieval of duplicates requires the use of cursor operations. +.ft R +See +.IR db_cursor (3) +for details. +.Tx +.IP +The +.I flags +parameter must be set to 0 or the following value: +.RS +.TP 5 +DB_SET_RECNO +Retrieve the specified numbered key/data pair from a database. +Upon return, +both the +.I key +and +.I data +items will have been filled in, +not just the data item as is done for all other uses of the +.I get +function. +.sp +The +.I data +field of the specified +.I key +must be a pointer to a memory location from which a +.I db_recno_t +may be read, as described in +.IR db_dbt (3). +This memory location will be read to determine the record to be retrieved. +.sp +For DB_SET_RECNO to be specified, +the underlying database must be of type btree +and it must have been created with the DB_RECNUM flag (see +.IR db_open (3)). +.RE +.IP +If the database is a recno database and the requested key exists, +but was never explicitly created by the application or was later +deleted, the +.I get +function returns DB_KEYEMPTY. +Otherwise, if the requested key isn't in the database, the +.I get +function returns DB_NOTFOUND. +.Ro get +.TP 5 +int (*put)(DB *db, DB_TXN *txnid, +.ti +5 +DBT *key, DBT *data, u_int32_t flags); +.br +A pointer to a function to store key/data pairs in the database. +If the database supports duplicates, +the +.I put +function adds the new data value at the end of the duplicate set. +.Tx +.IP +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.RS +.TP 5 +DB_APPEND +Append the key/data pair to the end of the database. +For DB_APPEND to be specified, +the underlying database must be of type recno. +The record number allocated to the record is returned in the specified +.IR key . +.TP 5 +DB_NOOVERWRITE +Enter the new key/data pair only if the key does not already appear +in the database. +.RE +.IP +The default behavior of the +.I put +function is to enter the new key/data pair, +replacing any previously existing key if duplicates are +disallowed, or to add a duplicate entry if duplicates are +allowed. +Even if the designated database allows duplicates, +a call to +.I put +with the DB_NOOVERWRITE flag set will fail if the key already exists in +the database. +.IP +.Rc put +and DB_KEYEXIST if the DB_NOOVERWRITE +.I flag +was set and the key already exists in the file. +.TP 5 +int (*sync)(DB *db, u_int32_t flags); +A pointer to a function to flush any cached information to disk. +If the database is in memory only, the +.I sync +function has no effect and will always succeed. +.IP +.Fl +.IP +See the +.I close +function description above for a discussion of DB and cached data. +.IP +.Rt sync +.TP 5 +int (*stat)(DB *db, void *sp, +.ti +5 +void *(*db_malloc)(size_t), u_int32_t flags); +.br +A pointer to a function to create a statistical structure and copy a pointer +to it into user-specified memory locations. +Specifically, if +.I sp +is non-NULL, +a pointer to the statistics for the database are copied into the memory +location it references. +.sp +.Ma "Statistical structures" +.sp +.ft B +In the presence of multiple threads or processes accessing an active +database, +the returned information may be out-of-date. +.ft R +.sp +.ft B +This function may access all of the pages in the database, +and therefore may incur a severe performance penalty and have obvious +negative effects on the underlying buffer pool. +.ft R +.sp +.IP +The +.I flags +parameter must be set to 0 or the following value: +.IP +.RS +.TP 5 +DB_RECORDCOUNT +Fill in the +.I bt_nrecs +field of the statistics structure, +but do not collect any other information. +This flag makes it reasonable for applications to request a record count from +a database without incurring a performance penalty. +It is only available for recno databases, +or btree databases where the underlying database was created with the +DB_RECNUM flag. +.RE +.IP +.Rt stat +.IP +In the case of a btree or recno database, +the statistics are stored in a structure of type DB_BTREE_STAT +(typedef'd in ). +The following fields will be filled in: +.RS +.TP 5 +u_int32_t bt_magic; +Magic number that identifies the file as a btree file. +.Nt +u_int32_t bt_version; +The version of the btree file type. +.Nt +u_int32_t bt_flags; +Permanent database flags, +including DB_DUP, DB_FIXEDLEN, DB_RECNUM and DB_RENUMBER. +.\".Nt +.\"u_int32_t bt_maxkey; +.\"The +.\".I bt_maxkey +.\"value specified to +.\".IR db_open (3), +.\"if any. +.Nt +u_int32_t bt_minkey; +The +.I bt_minkey +value specified to +.IR db_open (3), +if any. +.Nt +u_int32_t bt_re_len; +The +.I re_len +value specified to +.IR db_open (3), +if any. +.Nt +u_int32_t bt_re_pad; +The +.I re_pad +value specified to +.IR db_open (3), +if any. +.Nt +u_int32_t bt_pagesize; +Underlying tree page size. +.Nt +u_int32_t bt_levels; +Number of levels in the tree. +.Nt +u_int32_t bt_nrecs; +Number of data items in the tree (since there may be multiple data items +per key, this number may not be the same as the number of keys). +.Nt +u_int32_t bt_int_pg; +Number of tree internal pages. +.Nt +u_int32_t bt_leaf_pg; +Number of tree leaf pages. +.Nt +u_int32_t bt_dup_pg; +Number of tree duplicate pages. +.Nt +u_int32_t bt_over_pg; +Number of tree overflow pages. +.Nt +u_int32_t bt_free; +Number of pages on the free list. +.Nt +u_int32_t bt_freed; +Number of pages made available for reuse because they were emptied. +.Nt +u_int32_t bt_int_pgfree; +Number of bytes free in tree internal pages. +.Nt +u_int32_t bt_leaf_pgfree; +Number of bytes free in tree leaf pages. +.Nt +u_int32_t bt_dup_pgfree; +Number of bytes free in tree duplicate pages. +.Nt +u_int32_t bt_over_pgfree; +Number of bytes free in tree overflow pages. +.Nt +u_int32_t bt_pfxsaved; +Number of bytes saved by prefix compression. +.Nt +u_int32_t bt_split; +Total number of tree page splits (includes fast and root splits). +.Nt +u_int32_t bt_rootsplit; +Number of root page splits. +.Nt +u_int32_t bt_fastsplit; +Number of fast splits. +When sorted keys are added to the database, +the DB btree implementation will split left or right to increase the +page-fill factor. +This number is a measure of how often it was possible to make such a +split. +.Nt +u_int32_t bt_added; +Number of keys added. +.Nt +u_int32_t bt_deleted; +Number of keys deleted. +.Nt +u_int32_t bt_get; +Number of keys retrieved. +(Note, this value will not reflect any keys retrieved when the database was +open for read-only access, as there is no permanent location to store the +information in this case.) +.Nt +u_int32_t bt_cache_hit; +Number of hits in tree fast-insert code. +When sorted keys are added to the database, +the DB btree implementation will check the last page where an insert +occurred before doing a full lookup. +This number is a measure of how often the lookup was successful. +.Nt +u_int32_t bt_cache_miss; +Number of misses in tree fast-insert code. +See the description of bt_cache_hit; +this number is a measure of how often the lookup failed. +.RE +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR db_open : +.TP 5 +.Eh db_open DB_DATA_DIR +.SH EXAMPLES +Applications that create short-lived databases that are discarded or +recreated when the system fails and are unconcerned with concurrent +access and loss of data due to catastrophic failure, +may wish to use the +.I db_open +functionality without other parts of the DB library. +Such applications will only be concerned with the DB access methods. +The DB access methods will use the memory pool subsystem, +but the application is unlikely to be aware of this. +See the files +.I example/ex_access.c +and +.I example/ex_btrec.c +in the DB source distribution for C language code examples of how such +applications might use the DB library. +.SH ERRORS +.Ee db_open +.na +.Nh +DB->sync(3), +calloc(3), +close(2), +fcntl(2), +fflush(3), +lock_get(3), +lock_id(3), +lock_put(3), +lock_vec(3), +log_put(3), +log_register(3), +log_unregister(3), +malloc(3), +memcpy(3), +memmove(3), +memp_close(3), +memp_fclose(3), +memp_fget(3), +memp_fopen(3), +memp_fput(3), +memp_fset(3), +memp_fsync(3), +memp_open(3), +memp_register(3), +memset(3), +mmap(2), +munmap(2), +open(2), +read(2), +realloc(3), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +time(3), +and +unlink(2). +.Hy +.ad +.PP +.Ec db_open +.TP 5 +.Ea +.TP 5 +[EINVAL] +An invalid flag value or parameter was specified (e.g., unknown database +type, page size, hash function, recno pad byte, byte order) or a flag +value or parameter that is incompatible with the current +.I file +specification. +.sp +.Et +.sp +There is a mismatch between the version number of +.I file +and the software. +.sp +A +.I re_source +file was specified with either the DB_THREAD flag or a non-NULL +.I tx_info +field in the DB_ENV argument to db_open. +.TP 5 +[ENOENT] +A non-existent +.I re_source +file was specified. +.TP 5 +.Ep +.PP +.Ee DB->close +.na +.Nh +DB->sync(3), +calloc(3), +close(2), +fflush(3), +lock_get(3), +lock_put(3), +lock_vec(3), +log_put(3), +log_unregister(3), +malloc(3), +memcpy(3), +memmove(3), +memp_close(3), +memp_fclose(3), +memp_fget(3), +memp_fput(3), +memp_fset(3), +memp_fsync(3), +memset(3), +munmap(2), +realloc(3), +and +strerror(3). +.Hy +.ad +.PP +.Ee DB->cursor +.na +.Nh +calloc(3). +.Hy +.ad +.PP +.Ec DB->cursor +.TP 5 +.Ei +.TP 5 +.Ep +.PP +.Ee DB->del +.na +.Nh +calloc(3), +fcntl(2), +fflush(3), +lock_get(3), +lock_id(3), +lock_put(3), +lock_vec(3), +log_put(3), +malloc(3), +memcmp(3), +memcpy(3), +memmove(3), +memp_fget(3), +memp_fput(3), +memp_fset(3), +memset(3), +realloc(3), +and +strerror(3). +.Hy +.ad +.PP +.Ec DB->del +.TP 5 +.Ea +.TP 5 +.Ei +.TP 5 +.Ep +.PP +.Ec DB->fd +.TP 5 +[ENOENT] +The +.I DB->fd +function was called for an in-memory database, +or no underlying file has yet been created. +.TP 5 +.Ep +.PP +.Ee DB->get +.na +.Nh +DBcursor->c_get(3), +calloc(3), +fcntl(2), +fflush(3), +lock_get(3), +lock_id(3), +lock_put(3), +lock_vec(3), +log_put(3), +malloc(3), +memcmp(3), +memcpy(3), +memmove(3), +memp_fget(3), +memp_fput(3), +memp_fset(3), +memset(3), +realloc(3), +and +strerror(3). +.Hy +.ad +.PP +.Ec DB->get +.TP 5 +.Ea +.TP 5 +.Ei +.sp +The DB_THREAD flag was specified to the +.IR db_open (3) +function and neither the DB_DBT_MALLOC or DB_DBT_USERMEM flags were set +in the DBT. +.sp +A record number of 0 was specified. +.TP 5 +.Ep +.PP +.Ee DB->put +.na +.Nh +calloc(3), +fcntl(2), +fflush(3), +lock_get(3), +lock_id(3), +lock_put(3), +lock_vec(3), +log_put(3), +malloc(3), +memcmp(3), +memcpy(3), +memmove(3), +memp_fget(3), +memp_fput(3), +memp_fset(3), +memset(3), +realloc(3), +and +strerror(3). +.Hy +.ad +.PP +.Ec DB->put +.TP 5 +.Es +.TP 5 +.Ea +.TP 5 +.Ei +.sp +A record number of 0 was specified. +.sp +An attempt was made to add a record to a fixed-length database that +was too large to fit. +.sp +An attempt was made to do a partial put. +.TP 5 +.Ep +.TP 5 +[ENOSPC] +A btree exceeded the maximum btree depth (255). +.PP +.Ee DB->stat +.na +.Nh +calloc(3), +fcntl(2), +fflush(3), +lock_get(3), +lock_id(3), +lock_put(3), +lock_vec(3), +malloc(3), +memcpy(3), +memp_fget(3), +memp_fput(3), +and +memset(3). +.Hy +.ad +.PP +.Ee DB->sync +.na +.Nh +DB->get(3), +DB->sync(3), +calloc(3), +close(2), +fcntl(2), +fflush(3), +lock_get(3), +lock_id(3), +lock_put(3), +lock_vec(3), +log_put(3), +malloc(3), +memcpy(3), +memmove(3), +memp_fget(3), +memp_fput(3), +memp_fset(3), +memp_fsync(3), +memset(3), +munmap(2), +open(2), +realloc(3), +strerror(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec DB->sync +.TP 5 +.Ei +.TP 5 +.Ep +.SH "SEE ALSO" +.IR "The Ubiquitous B-tree" , +Douglas Comer, ACM Comput. Surv. 11, 2 (June 1979), 121-138. +.sp +.IR "Prefix B-trees" , +Bayer and Unterauer, ACM Transactions on Database Systems, Vol. 2, 1 +(March 1977), 11-26. +.sp +.IR "The Art of Computer Programming Vol. 3: Sorting and Searching" , +D.E. Knuth, 1968, pp 471-480. +.sp +.IR "Dynamic Hash Tables" , +Per-Ake Larson, Communications of the ACM, April 1988. +.sp +.IR "A New Hash Package for UNIX" , +Margo Seltzer, USENIX Proceedings, Winter 1991. +.sp +.IR "Document Processing in a Relational Database System" , +Michael Stonebraker, Heidi Stettner, Joseph Kalash, Antonin Guttman, +Nadene Lynn, Memorandum No. UCB/ERL M82/32, May 1982. +.sp +.Sa diff --git a/mozilla/db/man/man.roff/db_recover.1 b/mozilla/db/man/man.roff/db_recover.1 new file mode 100644 index 00000000000..10460cfc832 --- /dev/null +++ b/mozilla/db/man/man.roff/db_recover.1 @@ -0,0 +1,1030 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_recover.so 10.11 (Sleepycat) 4/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_RECOVER 1 "April 10, 1998" +.UC 7 +.SH NAME +db_recover \- the DB database recovery utility +.SH SYNOPSIS +\fBdb_recover\fP [\fB-cv\fP] [\fB-h home\fP] +.SH DESCRIPTION +The +.I db_recover +utility must be run after an unexpected application, DB, or system failure to +restore the database to a consistent state. +All committed transactions are guaranteed to appear after +.I db_recover +has run, and all uncommitted transactions will be completely undone. +.PP +The options are as follows: +.TP 5 +.B \-c +Failure was catastrophic. +.TP 5 +.B \-h +Specify a home directory for the database. +.TP 5 +.B \-v +Run in verbose mode. +.PP +In the case of catastrophic failure, an archival copy, +or ``snapshot'' of all database files must be restored along with all of the +log files written since the database file snapshot was made. +(If disk space is a problem, log files may be referenced by symbolic links). +For further information on creating a database snapshot, see ``DB ARCHIVAL +PROCEDURES'' in +.IR db_archive (1). +.PP +If the failure was not catastrophic, +the files present on the system at the time of failure are sufficient +to perform recovery. +.PP +If log files are missing, +.I db_recover +will identify the missing log file(s) and fail, +in which case the missing log files need to be restored and recovery +performed again. +.PP +.Si db_recover +.PP +.Ex db_recover +.SH "FILESYSTEM OPERATIONS +.ft B +Filesystem operations, +e.g., moving the database environment to a different machine or file creation, +deletion or renaming, cannot be transaction protected. +.ft R +For this reason, +.I db_recover +cannot re-create, delete or rename files as part of recovery. +.PP +If +.I db_recover +cannot find a database file referenced in the log, it will output a warning +message that it was unable to locate a file it expected to find. +This message is only a warning, as the file may have subsequently been +deleted as part of normal database operations before the failure occurred. +.ft B +Note that committed transactions that involved these missing files are rolled +forward, even though the files were not found. +If the files were not intentionally deleted (e.g., they were created after +the last database snapshot, but were lost during a failure), they +must be manually created (using +.IR db_open (3)), +and +.I db_recover +must be rerun. +.ft R +.PP +Generally, it is simplest to perform filesystem operations at the same time as +making a snapshot of the database. +To perform filesystem operations: +.RS +.TP 5 +1. +Cleanly shutdown database operations. +.Nt +2. +Rename, create or delete files. +.Nt +3. +Make a snapshot of the database. +.Nt +4. +Restart database applications. +.RE +.PP +To cleanly shutdown database operations, +all applications accessing the database environment must be shutdown. +If the applications are not implemented such that they can be shutdown +gracefully (i.e., closing all references to the database environment), +.I db_recover +must be run after all applications have been killed to ensure that the +underlying database is consistent and flushed to disk. +.SH "RECOVERY +After an application or system failure, +there are two possible approaches to database recovery. +If there is no need to retain state across the failure, +and all databases can be started anew, +the database home directory can simply be removed and recreated. +If it is necessary to retain persistent state across failures, +then the +.IR db_recover (1) +utility should be run for each DB application environment, i.e., +each database home directory. +.PP +The +.I db_recover +utility will remove all the shared regions (which may have been corrupted +by the failure), +establish the end of the log by identifying the last record written to the +log, +and then perform transaction recovery. +Database applications must not be restarted until recovery completes. +During transaction recovery, +all changes made by aborted transactions are undone and all changes made by +committed transactions are redone, as necessary. +After recovery runs, +the environment is properly initialized so that applications may be restarted. +Any time an application crashes or the system fails, +.I db_recover +should be run on any exiting database environments. +.PP +Additionally, +there are two forms of recovery: normal recovery and catastrophic recovery. +The DB package defines catastrophic failure to be failure where either the +database or log files have been destroyed or corrupted from the point of +view of the filesystem. +For example, +catastrophic failure includes the case where the disk drive on which either +the database or logs are stored has crashed, +or when filesystem recovery is unable to bring the database and log files +to a consistent state with respect to the filesystem. +If the failure is non-catastrophic, i.e., the database files and log +are accessible on a filesystem that has recovered cleanly, +.I db_recover +will review the logs and database files to ensure that all committed +transactions appear and that all uncommitted transactions are undone. +If the failure is catastrophic, +a snapshot of the database files and the archived log files must be restored +onto the system. +Then +.I db_recover +will review the logs and database files to bring the database to a +consistent state as of the date of the last archived log file. +Only transactions committed before that date will appear in the database. +See +.I db_archive (1) +for specific information about archiving and recovering databases +after catastrophic failure. +.PP +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR db_recover : +.TP 5 +.Dh db_recover +.SH BUGS +Future versions of DB are expected to remove the restriction that database +files must be manually created before recovery is performed. +.SH "SEE ALSO" +.Gn +.PP +.Sa diff --git a/mozilla/db/man/man.roff/db_stat.1 b/mozilla/db/man/man.roff/db_stat.1 new file mode 100644 index 00000000000..4026b79094f --- /dev/null +++ b/mozilla/db/man/man.roff/db_stat.1 @@ -0,0 +1,965 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_stat.so 8.13 (Sleepycat) 5/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_STAT 1 "May 10, 1998" +.UC 7 +.SH NAME +db_stat \- display DB statistics +.SH SYNOPSIS +\fBdb_stat\fP [\fB-clmNt\fP] +.ti +5 +[\fB-C Acfhlmo\fP] [\fB-d file\fP] [\fB-h home\fP] [\fB-M Ahlm\fP] +.SH DESCRIPTION +The +.I db_stat +utility displays statistics for DB environments. +.PP +The options are as follows: +.TP 5 +.B \-C +Display internal information about the lock region. +(The output from this option is often both voluminous and meaningless, +and is intended only for debugging.) +.RS +.TP 5 +.B \-A +Display all information. +.Nt +.B \-c +Display lock conflict matrix. +.Nt +.B \-f +Display lock and object free lists. +.Nt +.B \-l +Display lockers within hash chains. +.Nt +.B \-m +Display region memory information. +.Nt +.B \-o +Display objects within hash chains. +.RE +.TP 5 +.B \-c +Display lock region statistics as described in +.IR db_lock (3). +.TP 5 +.B \-d +Display database statistics for the specified database, +as described in +.IR db_open (3). +.TP 5 +.B \-h +Specify a home directory for the database. +.TP 5 +.B \-l +Display log region statistics as described in +.IR db_log (3). +.TP 5 +.B \-M +Display internal information about the shared memory buffer pool. +(The output from this option is often both voluminous and meaningless, +and is intended only for debugging.) +.RS +.TP 5 +.B \-A +Display all information. +.Nt +.B \-h +Display buffers within hash chains. +.Nt +.B \-l +Display buffers within LRU chains. +.Nt +.B \-m +Display region memory information. +.RE +.TP 5 +.B \-m +Display shared memory buffer pool statistics as described in +.IR db_mpool (3). +.TP 5 +.B \-N +Don't acquire locks while displaying the statistics. +This option is intended only for debugging corrupt regions and should not +be used under any other circumstances. +.TP 5 +.B \-t +Display transaction region statistics as described in +.IR db_txn (3). +.PP +.Si db_stat +.PP +Values smaller than 10 million are generally displayed without +any special notation. +Values larger than 10 million are normally displayed as ``M''. +.PP +.Ex db_stat +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR db_stat : +.TP 5 +.Dh db_load +.SH "SEE ALSO" +.Gn +.PP +.Sa diff --git a/mozilla/db/man/man.roff/db_thread.3 b/mozilla/db/man/man.roff/db_thread.3 new file mode 100644 index 00000000000..f3514b4db85 --- /dev/null +++ b/mozilla/db/man/man.roff/db_thread.3 @@ -0,0 +1,1015 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_thread.so 10.5 (Sleepycat) 4/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_THREAD 3 "April 10, 1998" +.UC 7 +.SH "NAME +db_thread \- using threads in the DB library. +.SH "DESCRIPTION +.Gn +.PP +This manual pages describes the specific details of using DB from +within threaded programs. +.PP +The DB library is not itself multi-threaded. +The library was deliberately architected to not use threads internally +because of the portability problems that using threads within the library +would introduce. +Object handles returned from DB library functions are free-threaded, +i.e., threads may use handles concurrently, +by specifying the DB_THREAD flag to +.IR db_appinit (3) +(\c +or, in the C++ API, +.IR DbEnv::appinit (3)) +and the other subsystem open functions. +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +.PP +DB supports multi-threaded applications with the caveat that it loads +and calls functions that are commonly available in C language environments +and which may not themselves be thread-safe. +Other than this usage, +DB has no static data and maintains no local context between calls to +DB functions. +To ensure that applications can safely use threads in the context of DB, +porters to new operating systems and/or C libraries must confirm that the +system and C library functions used by the DB library are thread-safe. +.PP +There are some additional caveats about using threads to access +the DB library: +.TP 2 +\(bu +The DB_THREAD flag must be specified for all subsystems either explicitly +or via the +.I db_appinit +(\c +.IR DbEnv::appinit ) +function in the C and C++ APIs. +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +.sp +Setting the DB_THREAD flag inconsistently may result in database corruption. +.TP 2 +\(bu +Only a single thread may call the close function for a returned database +or subsystem handle. +See +.IR db_open (3) +(\c +.IR Db::open (3)) +and the appropriate subsystem manual pages for more information. +.TP 2 +\(bu +Either the DB_DBT_MALLOC or DB_DBT_USERMEM flags must be set in a DBT used +for key or data retrieval. +See +.IR db_dbt (3) +(\c +.IR Dbt (3)) +for more information. +.TP 2 +\(bu +The DB_CURRENT, DB_NEXT and DB_PREV flags to the +.I log_get +(\c +.IR DbLog::get ) +function may not be used by a free-threaded handle. If such calls are +necessary, a thread should explicitly create a unique DB_LOG handle by +calling +.IR log_open (3) +(\c +.IR DbLog::open ). +See +.IR db_log (3) +(\c +.IR DbLog (3)) +for more information. +.TP 2 +\(bu +Each database operation (i.e., any call to a function underlying the +handles returned by +.IR db_open (3) +and +.IR db_cursor (3)) +(\c +.IR Db (3) +and +.IR Dbc (3)) +is normally performed on behalf of a unique locker. +If, within a single thread of control, +multiple calls on behalf of the same locker are desired, +then transactions must be used. For example, consider the case where +a cursor scan locates a record, and then based on that record, accesses +some other item in the database. If these are done using the default +lockers for the handle, there is no guarantee that these two operations +will not conflict. If the application wishes to guarantee that the +operations do not conflict, locks must be obtained on behalf of a transaction, +instead of the default locker id, and a transaction must be specified to +the cursor creation and the subsequent db call. +.TP 2 +\(bu +Transactions may not span threads, i.e., +each transaction must begin and end in the same thread, +and each transaction may only be used by a single thread. +.TP 2 +\(bu +Spinlocks must have been implemented for the compiler/architecture +combination. +Attempting to specify the DB_THREAD flag will fail if spinlocks are not +available. +.TP 2 +\(bu +The DB library makes a system call to pause for some number of microseconds +when it is necessary to wait on a lock. +This may not be optimal, +especially in a thread-only environment where it will be more efficient to +explicitly yield the processor to another thread. +It is possible to specify a yield function on an per-application basis, +see +.IR db_jump_set (3) +for more information. +.SH "COMPILING THREADED APPLICATIONS +Special compile-time flags are required when compiling threaded applications +with the UNIX include files on some architectures. +.PP +On IRIX, if you are compiling a threaded application, +you must compile with the -D_SGI_MP_SOURCE flag: +.PP +.ti +5 +cc -D_SGI_MP_SOURCE ... +.PP +On OSF/1, if you are compiling a threaded application, +you must compile with the -D_REENTRANT flag: +.PP +.ti +5 +cc -D_REENTRANT ... +.PP +On Solaris, if you are compiling a threaded application, +you must compile with the -D_REENTRANT flag and link with the -lthread +library: +.PP +.ti +5 +cc -D_REENTRANT ... -lthread +.SH "SEE ALSO" +.Sa diff --git a/mozilla/db/man/man.roff/db_txn.3 b/mozilla/db/man/man.roff/db_txn.3 new file mode 100644 index 00000000000..8472a6133d3 --- /dev/null +++ b/mozilla/db/man/man.roff/db_txn.3 @@ -0,0 +1,1719 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" Copyright (c) 1994, 1995 +.\" 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. 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. +.\" +.\" @(#)db_txn.so 10.34 (Sleepycat) 5/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_TXN 3 "May 10, 1998" +.UC 7 +.SH NAME +db_txn \- DB transaction management +.SH SYNOPSIS +.nf +.ft B +#include + +int +txn_open(const char *dir, +.ti +5 +u_int32_t flags, int mode, DB_ENV *dbenv, DB_TXNMGR **regionp); + +int +txn_begin(DB_TXNMGR *txnp, DB_TXN *pid, DB_TXN **tid); + +int +txn_prepare(DB_TXN *tid); + +int +txn_commit(DB_TXN *tid); + +int +txn_abort(DB_TXN *tid); + +u_int32_t +txn_id(DB_TXN *tid); + +int +txn_checkpoint(const DB_TXNMGR *txnp, u_int32_t kbyte, u_int32_t min); + +int +txn_close(DB_TXNMGR *txnp); + +int +txn_unlink(const char *dir, int force, DB_ENV *dbenv); + +int +txn_stat(DB_TXNMGR *txnp, +.ti +5 +DB_TXN_STAT **statp, void *(*db_malloc)(size_t)); +.ft R +.fi +.SH DESCRIPTION +.Gn +.PP +This manual page describes the specific details of the DB transaction +support. +.PP +The +.I db_txn +functions are the library interface that provides transaction semantics. +Full transaction support is provided by a collection of modules that +provide interfaces to the services required for transaction processing. +These services are recovery (see +.IR db_log (3)), +concurrency control (see +.IR db_lock (3)), +and the management of shared data (see +.IR db_mpool (3)). +Transaction semantics can be applied to the access methods described in +.IR db_open (3) +through function call parameters. +.PP +The model intended for transactional use (and the one that is used by +the access methods) is write-ahead logging provided by +.IR db_log (3) +to record both before- and after-images. +Locking follows a two-phase protocol, with all locks being released +at transaction commit. +.PP +.Co "transaction region" txn +.PP +.Fm +.Ft txn_open DB_TXNMGR +.TP 5 +DB_TXN_NOSYNC +On transaction commit, do not synchronously flush the log. +This means that transactions exhibit the ACI (atomicity, +consistency and isolation) properties, but not D (durability), i.e., +database integrity will be maintained but it is possible that some number +of the most recently committed transactions may be undone during recovery +instead of being redone. +.sp +The number of transactions that are potentially at risk is governed by +how often the log is checkpointed (see +.IR db_checkpoint (1)) +and how many log updates can fit on a single log page. +.PP +.Mo "transaction subsystem" +.PP +The transaction subsystem is configured +.En "txn_open" "txn_close" +.TP 5 +.Se +.TP 5 +DB_LOG *lg_info; +The logging region that is being used for this transaction environment. +The +.I lg_info +field contains a return value from the function +.IR log_open . +.ft B +Logging is required for transaction environments, +and it is an error to not specify a logging region. +.ft R +.TP 5 +DB_LOCKTAB *lk_info; +The locking region that is being used for this transaction environment. +The +.I lk_info +field contains a return value from the function +.IR lock_open . +If +.I lk_info +is NULL, no locking is done in this transaction environment. +.TP 5 +u_int32_t tx_max; +The maximum number of simultaneous transactions that are supported. +This bounds the size of backing files and is used to derive limits for +the size of the lock region and logfiles. +When there are more than +.I tx_max +concurrent transactions, calls to +.I txn_begin +may cause backing files to grow. +If +.I tx_max +is 0, a default value is used. +.TP 5 +int (*tx_recover)(DB_LOG *logp, DBT *log_rec, +.ti +5 +DB_LSN *lsnp, int redo, void *info); +.br +A function that is called by +.I txn_abort +during transaction abort. +This function takes five arguments: +.RS +.TP 5 +logp +A pointer to the transaction log (DB_LOG *). +.TP 5 +log_rec +A log record. +.TP 5 +lsnp +A pointer to a log sequence number (DB_LSN *). +.TP 5 +redo +An integer value that is set to one of the following values: +.RS +.TP 5 +DB_TXN_BACKWARD_ROLL +The log is being read backward to determine which transactions have been +committed and which transactions were not (and should therefore be aborted +during recovery). +.TP 5 +DB_TXN_FORWARD_ROLL +The log is being played forward, any transaction ids encountered that +have not been entered into the list referenced by +.I info +should be ignored. +.TP 5 +DB_TXN_OPENFILES +The log is being read to open all the files required to perform recovery. +.TP 5 +DB_TXN_REDO +Redo the operation described by the log record. +.TP 5 +DB_TXN_UNDO +Undo the operation described by the log record. +.RE +.TP 5 +info +An opaque pointer used to reference the list of transaction IDs encountered +during recovery. +.RE +.IP +If +.I recover +is NULL, +the default is that only DB access method operations are transaction +protected, +and the default recover function will be used. +.PP +.Rt txn_open +.PP +.Fn txn_begin +The +.I txn_begin +function creates a new transaction in the designated transaction manager, +copying a pointer to a DB_TXN that uniquely identifies it into the memory +referenced by +.IR tid . +If the +.I pid +argument is non-NULL, +the new transaction is a nested transaction with the transaction indicated by +.I pid +as its parent. +.PP +Transactions may not span threads, i.e., +each transaction must begin and end in the same thread, +and each transaction may only be used by a single thread. +.PP +.Rt txn_begin +.PP +.Fn txn_prepare +The +.I txn_prepare +function initiates the beginning of a two phase commit. +In a distributed transaction environment, +.I db +can be used as a local transaction manager. +In this case, +the distributed transaction manager must send +.I prepare +messages to each local manager. +The local manager must then issue a +.I txn_prepare +and await its successful return before responding to the distributed +transaction manager. +Only after the distributed transaction manager receives successful +responses from all of its +.I prepare +messages should it issue any +.I commit +messages. +.PP +.Rt txn_prepare +.PP +.Fn txn_commit +The +.I txn_commit +function ends the transaction specified by the +.I tid +argument. +If DB_TXN_NOSYNC was not specified, a commit log record is written and +flushed to disk, as are all previously written log records. +If the transaction is nested, its locks are acquired by the parent +transaction, otherwise its locks are released. +Any applications that require strict two-phase locking must not +release any locks explicitly, leaving them all to be released by +.IR txn_commit . +.PP +.Rt txn_commit +.PP +.Fn txn_abort +The +.I txn_abort +function causes an abnormal termination of the transaction. +The log is played backwards and any necessary recovery operations are +initiated through the +.I recover +function specified to +.IR txn_open . +After recovery is completed, all locks held by the transaction are acquired +by the parent transaction in the case of a nested transaction or released +in the case of a non-nested transaction. +As is the case for +.IR txn_commit , +applications that require strict two phase locking should not explicitly +release any locks. +.PP +.Rt txn_abort +.PP +.Fn txn_id +The +.I txn_id +function returns the unique transaction id associated with the specified +transaction. +Locking calls made on behalf of this transaction should use the value +returned from +.I txn_id +as the locker parameter to the +.I lock_get +or +.I lock_vec +calls. +.PP +.Fn txn_close +The +.I txn_close +function detaches a process from the transaction environment specified +by the DB_TXNMGR pointer. +All mapped regions are unmapped and any allocated resources are freed. +Any uncommitted transactions are aborted. +.PP +.Cc txn +.PP +When multiple threads are using the DB_TXNMGR handle concurrently, +only a single thread may call the +.I txn_close +function. +.PP +.Rt txn_close +.PP +.Un "transaction region" txn +.PP +.Fn txn_checkpoint +The +.I txn_checkpoint +function syncs the underlying memory pool, +writes a checkpoint record to the log and then flushes the log. +.PP +If either +.I kbyte +or +.I min +is non-zero, +the checkpoint is only done if more than +.I min +minutes have passed since the last checkpoint, +or if more than +.I kbyte +kilobytes of log data have been written since the last checkpoint. +.PP +.Rc txn_checkpoint +and DB_INCOMPLETE if there were pages that needed to be written but that +.IR memp_sync (3) +was unable to write immediately. +In this case, the +.I txn_checkpoint +call should be retried. +.PP +.Uf txn_checkpoint db_checkpoint +.PP +.Fn txn_stat +The +.I txn_stat +function creates a statistical structure and copies a pointer to it into +the user-specified memory location. +.PP +.Ma "Statistical structure" +.PP +The transaction region statistics are stored in a structure of type +DB_TXN_STAT (typedef'd in ). +The following DB_TXN_STAT fields will be filled in: +.TP 5 +u_int32_t st_refcnt; +The number of references to the region. +.Nt +u_int32_t st_regsize; +The size of the region. +.Nt +DB_LSN st_last_ckp; +The LSN of the last checkpoint. +.Nt +DB_LSN st_pending_ckp; +The LSN of any checkpoint that is currently in progress. +If +.I st_pending_ckp +is the same as +.I st_last_ckp +there is no checkpoint in progress. +.Nt +time_t st_time_ckp; +The time the last completed checkpoint finished (as returned by +.IR time (2)). +.Nt +u_int32_t st_last_txnid; +The last transaction ID allocated. +.Nt +u_int32_t st_maxtxns; +The maximum number of active transactions supported by the region. +.Nt +u_int32_t st_naborts; +The number of transactions that have aborted. +.Nt +u_int32_t st_nactive; +The number of transactions that are currently active. +.Nt +u_int32_t st_nbegins; +The number of transactions that have begun. +.Nt +u_int32_t st_ncommits; +The number of transactions that have committed. +.Nt +u_int32_t st_region_wait; +The number of times that a thread of control was forced to wait before +obtaining the region lock. +.Nt +u_int32_t st_region_nowait; +The number of times that a thread of control was able to obtain +the region lock without waiting. +.Nt +DB_TXN_ACTIVE *st_txnarray; +A pointer to an array of +.I st_nactive +DB_TXN_ACTIVE structures, describing the currently active transactions. +The following fields of the DB_TXN_ACTIVE structure (typedef'd in ) +will be filled in: +.sp +.RS +.TP 5 +u_int32_t txnid; +The transaction ID as returned by +.IR txn_begin (3). +.Nt +DB_LSN lsn; +The LSN of the transaction-begin record. +.RE +.PP +.SH "TRANSACTIONS +Creating transaction protected applications using the DB access methods +requires little system customization. +In most cases, +the default parameters to the locking, logging, memory pool, +and transaction subsystems will suffice. +Applications can use +.IR db_appinit (3) +to perform this initialization, or they may do it explicitly. +.PP +Each database operation (i.e., any call to a function underlying the +handles returned by +.IR db_open (3) +and +.IR db_cursor (3)) +is normally performed on behalf of a unique locker. +If multiple calls on behalf of the same locker are desired, +then transactions must be used. +.PP +Once the application has initialized the DB subsystems that it is using, +it may open the DB access method databases. +For applications performing transactions, +the databases must be opened after subsystem initialization, +and cannot be opened as part of a transaction. +Once the databases are opened, the application can group sets of +operations into transactions, by surrounding the operations +with the appropriate +.IR txn_begin , +.I txn_commit +and +.I txn_abort +calls. +Databases accessed by a transaction must not be closed +during the transaction. +Note, +it is not necessary to transaction protect read-only transactions, +unless those transactions require repeatable reads. +.PP +The DB access methods will make the appropriate calls into the +lock, log and memory pool subsystems in order to guarantee that +transaction semantics are applied. +When the application is ready to exit, all outstanding transactions +should have been committed or aborted. +At this point, all open DB files should be closed. +Once the DB database files are closed, +the DB subsystems should be closed, +either explicitly or by calling +.IR db_appexit (3). +.PP +It is also possible to use the locking, logging and transaction subsystems +of DB to provide transaction semantics to objects other than those described +by the DB access methods. +In these cases, the application will need more explicit customization of +the subsystems as well as the development of appropriate +data-structure-specific recovery functions. +.PP +For example, consider an application that provides transaction semantics +to data stored in plain UNIX files accessed using the +.IR read (2) +and +.IR write (2) +system calls. +The operations for which transaction protection is desired are bracketed +by calls to +.I txn_begin +and +.IR txn_commit . +.PP +Before data are referenced, +the application must make a call to the lock manager, +.IR db_lock , +for a lock of the appropriate type (e.g., 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, +.IR db_lock . +Then, the application should make a call to the +log manager, +.IR db_log , +to record enough information to redo the operation in case of +failure after commit and to undo the operation in case of abort. +As discussed in the +.IR db_log (3) +manual page, +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. +.PP +After the log message is written, the application may issue the write system call. +After all requests are issued, the application may call +.IR txn_commit . +When +.I txn_commit +returns, the caller is guaranteed that all necessary log writes have +been written to disk. +.PP +At any time, the application may call +.IR txn_abort , +which will result in the appropriate calls to the +.I recover +function to restore the ``database'' to a consistent pre-transaction +state. +(The recover function must be able to either re-apply or undo the update +depending on the context, for each different type of log record.) +.PP +If the application should crash, the recovery process uses the +.I db_log +interface to read the log and call the +.I recover +function to restore the database to a consistent state. +.PP +The +.I txn_prepare +function provides the core functionality to implement distributed +transactions, +but it does not manage the notification of distributed transaction managers. +The caller is responsible for issuing +.I txn_prepare +calls to all sites participating in the transaction. +If all responses are positive, the caller can issue a +.IR txn_commit . +If any of the responses are negative, the caller should issue a +.IR txn_abort . +In general, the +.I txn_prepare +call requires that the transaction log be flushed to disk. +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)limits.so 8.1 (Sleepycat) 5/3/98 +.\" +.de Ll +.SH "LOG FILE LIMITS +Log file sizes impose a time limit on the length of time a database +may be accessed under transaction protection, before it needs to be +dumped and reloaded (see +.IR db_dump(3) +and +.IR db_load(3)). +Unfortunately, the limits are potentially difficult to calculate. +.PP +The log file name consists of "log." followed by 5 digits, resulting +in a maximum of 99,999 log files. +Consider an application performing 600 transactions per second, for +15 hours a day, logged into 10Mb log files, where each transaction +is logging approximately 100 bytes of data. The calculation: +.PP +.nf +.RS +(10 * 2^20 * 99999) / +.ti +5 +(600 * 60 * 60 * 15 * 100) = 323.63 +.RE +.fi +.PP +indicates that the system will run out of log file space in +roughly 324 days. +If we increase the maximum size of the files from 10Mb to 100Mb, +the same calculation indicates that the application will run out +of log file space in roughly 9 years. +.PP +There is no way to reset the log file name space in Berkeley DB. +If your application is reaching the end of its log file name space, +you should: +.TP 5 +1. +Archive your databases as if to prepare for catastrophic failure (see +.IR db_archive (1) +for more information). +.TP 5 +2. +Dump and re-load +.B all +your databases (see +.IR db_dump (1) +and +.IR db_load (1) +for more information). +.TP 5 +3. +Remove all of the log files from the database environment (see +.IR db_archive (1) +for more information). +.TP 5 +4. +Restart your applications. +.. +.de Tl +.SH "TRANSACTION ID LIMITS +The transaction ID space in Berkeley DB is 2^31, or 2 billion entries. +It is possible that some environments may need to be aware of this +limitation. +Consider an application performing 600 transactions a second for 15 +hours a day. +The transaction ID space will run out in roughly 66 days: +.PP +.nf +.RS +2^31 / (600 * 15 * 60 * 60) = 66 +.RE +.fi +.PP +Doing only 100 transactions a second exhausts the transaction ID space +in roughly one year. +.PP +The transaction ID space is reset each time recovery is run. +If you reach the end of your transaction ID space, +shut down your applications and restart them after running recovery (see +.IR db_recover (1) +for more information). +The most recently allocated transaction ID is the +.I st_last_txnid +value in the transaction statistics information, and is displayed by the +.IR db_stat (1) +utility. +.. +.Tl +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR db_txn : +.TP 5 +.Eh txn_open +.TP 5 +.Ev "transaction region" txn +.SH ERRORS +.Ee txn_open +.na +.Nh +close(2), +db_version(3), +fcntl(2), +fflush(3), +lseek(2), +malloc(3), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +time(3), +txn_unlink(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec txn_open +.TP 5 +.Ei +.sp +.Et +.sp +The +.I dbenv +parameter was NULL. +.TP 5 +.Em +.PP +.Ee txn_begin +.na +.Nh +fcntl(2), +fflush(3), +log_put(3), +lseek(2), +malloc(3), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +strerror(3), +and +write(2). +.Hy +.ad +.PP +.Ec txn_begin +.TP 5 +[ENOSPC] +The maximum number of concurrent transactions has been reached. +.PP +.Ee txn_prepare +.na +.Nh +fcntl(2), +fflush(3), +log_flush(3), +and +strerror(3). +.Hy +.ad +.PP +.Ee txn_commit +.na +.Nh +fcntl(2), +fflush(3), +lock_vec(3), +log_put(3), +malloc(3), +memcpy(3), +and +strerror(3). +.Hy +.ad +.PP +.Ec txn_commit +.TP 5 +[EINVAL] +The transaction was aborted. +.PP +.Ee txn_abort +.na +.Nh +DBenv->tx_recover(3), +fcntl(2), +fflush(3), +lock_vec(3), +log_get(3), +memset(3), +and +strerror(3). +.Hy +.ad +.TP 5 +[EINVAL] +The transaction was already aborted. +.PP +.Ee txn_checkpoint +.na +.Nh +fcntl(2), +fflush(3), +log_compare(3), +log_put(3), +malloc(3), +memcpy(3), +memp_sync(3), +memset(3), +strerror(3), +and +time(3). +.Hy +.ad +.TP 5 +.Ei +.PP +.Ee txn_close +.na +.Nh +close(2), +fcntl(2), +fflush(3), +log_flush(3), +munmap(2), +strerror(3), +and +txn_abort(3). +.Hy +.ad +.PP +.Ee txn_unlink +.na +.Nh +close(2), +fcntl(2), +fflush(3), +malloc(3), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +and +unlink(2). +.Hy +.ad +.PP +.Ec txn_unlink +.TP 5 +.Eb +.PP +.Ee txn_stat +.na +.Nh +fcntl(2), +and +malloc(3). +.Hy +.ad +.SH "SEE ALSO" +.IR "LIBTP: Portable, Modular Transactions for UNIX" , +Margo Seltzer, Michael Olson, USENIX proceedings, Winter 1992. +.SH BUGS +Nested transactions are not yet implemented. +.sp +.Sa diff --git a/mozilla/db/man/man.text/db_appinit.0 b/mozilla/db/man/man.text/db_appinit.0 new file mode 100644 index 00000000000..5fdfcf46a3a --- /dev/null +++ b/mozilla/db/man/man.text/db_appinit.0 @@ -0,0 +1,599 @@ + + +NNAAMMEE + db_appinit - initializing the DB environment + +SSYYNNOOPPSSIISS + ##iinncclluuddee <> + + cchhaarr ** + ddbb__vveerrssiioonn((iinntt **mmaajjoorr,, iinntt **mmiinnoorr,, iinntt **ppaattcchh));; + + iinntt + ddbb__aappppiinniitt((cchhaarr **ddbb__hhoommee,, + cchhaarr **ddbb__ccoonnffiigg[[]],, DDBB__EENNVV **ddbbeennvv,, uu__iinntt3322__tt ffllaaggss));; + + iinntt + ddbb__aappppeexxiitt((DDBB__EENNVV **ddbbeennvv));; + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + _d_b___v_e_r_s_i_o_n + The _d_b___v_e_r_s_i_o_n function returns a pointer to a string con- + taining DB version information. If _m_a_j_o_r is non-NULL, the + major version of the DB release is stored in the memory it + references. If _m_i_n_o_r is non-NULL, the minor version of + the DB release is stored in the memory it references. If + _p_a_t_c_h is non-NULL, the patch version of the DB release is + stored in the memory it references. + + _d_b___a_p_p_i_n_i_t + The _d_b___a_p_p_i_n_i_t function provides a simple way to initial- + ize and configure the DB environment. It is not necessary + that it be called, but it provides a method of creating a + consistent environment for processes using one or more of + the features of DB. + + The _d_b___h_o_m_e and _d_b___c_o_n_f_i_g arguments to _d_b___a_p_p_i_n_i_t are + described in the section below entitled ``FILE NAMING''. + + The _f_l_a_g_s argument specifies the subsystems that are ini- + tialized and how the environment affects DB file naming, + among other things. The _f_l_a_g_s value is specified by + oorr'ing together one or more of the following values: + + DB_CREATE + Cause subsystems to create any underlying files, as + necessary. (See _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), + _d_b___o_p_e_n(3) and _d_b___t_x_n(3) for more information.) + + DB_INIT_LOCK + Initialize the lock subsystem; see _d_b___l_o_c_k(3). This + subsystem should be used when multiple processes or + threads are going to be reading and writing a DB + database, so that they do not interfere with each + other. If all threads are accessing the database(s) + read-only, then locking is unnecessary. When the + DB_INIT_LOCK flag is specified, it is usually neces- + sary to run the deadlock detector, _d_b___d_e_a_d_l_o_c_k(1), as + well. + + DB_INIT_LOG + Initialize the log subsystem; see _d_b___l_o_g(3). This + subsystem is used when recovery from application or + system failure is important. + + DB_INIT_MPOOL + Initialize the mpool subsystem; see _d_b___m_p_o_o_l(3). + This subsystem is used whenever the application is + using the DB access methods for any purpose. + + DB_INIT_TXN + Initialize the transaction subsystem; see _d_b___t_x_n(3). + This subsystem is used when atomicity of multiple + operations and recovery are important. The + DB_INIT_TXN flag implies the DB_INIT_LOG flag. + + DB_MPOOL_PRIVATE + Create a private memory pool (see _d_b___m_p_o_o_l(3) for + further information). Ignored unless DB_INIT_MPOOL + is also specified. + + DB_NOMMAP + Do not map any files within this environment (see + _d_b___m_p_o_o_l(3) for further information). Ignored unless + DB_INIT_MPOOL is also specified. + + DB_RECOVER + Run normal recovery on this environment before open- + ing it for normal use. If this flag is set, the + DB_CREATE flag must also be set since the regions + will be removed and recreated. + + The _d_b___a_p_p_i_n_i_t function returns successfully if + DB_RECOVER is specified and no log files exist, so it + is necessary to ensure all necessary log files are + present before running recovery. For further infor- + mation, consult the man page for _d_b___a_r_c_h_i_v_e(1) and + _d_b___r_e_c_o_v_e_r(1). + + DB_RECOVER_FATAL + Run catastrophic recovery on this environment before + opening it for normal use. If this flag is set, the + DB_CREATE flag must also be set since the regions + will be removed and recreated. + + The _d_b___a_p_p_i_n_i_t function returns successfully if + DB_RECOVER is specified and no log files exist, so it + is necessary to ensure all necessary log files are + present before running recovery. For further infor- + mation, consult the man page for _d_b___a_r_c_h_i_v_e(1) and + _d_b___r_e_c_o_v_e_r(1). + + DB_THREAD + Ensure that handles returned by the DB subsystems are + useable by multiple threads within a single process, + i.e., that the system is ``free-threaded''. (See + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3) and + _d_b___t_x_n(3) for more information.) + + DB_TXN_NOSYNC + On transaction commit, do not synchronously flush the + log (see _d_b___t_x_n(3) for further information). Ignored + unless DB_INIT_TXN is also specified. + + DB_USE_ENVIRON + The DB process' environment may be permitted to spec- + ify information to be used when naming files (see the + section entitled ``FILE NAMING'' below). As permit- + ting users to specify which files are used can create + security problems, environment information will be + used in file naming for all users only if the + DB_USE_ENVIRON flag is set. + + DB_USE_ENVIRON_ROOT + The DB process' environment may be permitted to spec- + ify information to be used when naming files (see the + section entitled ``FILE NAMING'' below). As permit- + ting users to specify which files are used can create + security problems, if the DB_USE_ENVIRON_ROOT flag is + set, environment information will be used for file + naming only for users with a user-ID matching that of + the superuser (specifically, users for whom the + _g_e_t_u_i_d system call returns the user-ID 0). + + The DB environment is configured based on the _d_b_e_n_v argu- + ment to _d_b___a_p_p_i_n_i_t, which is a pointer to a structure of + type DB_ENV (typedef'd in ). Applications will nor- + mally use the same DB_ENV structure (initialized by + _d_b___a_p_p_i_n_i_t(3)), as an argument to all of the subsystems in + the DB package. + + References to the DB_ENV structure are maintained by DB, + so it may not be discarded until the last close function, + corresponding to an open function for which it was an + argument, has returned. In order to ensure compatibility + with future releases of DB, all fields of the DB_ENV + structure that are not explicitly set should be + initialized to 0 before the first time the structure is + used. Do this by declaring the structure external or + static, or by calling the C library routine _b_z_e_r_o(3) or + _m_e_m_s_e_t(3). + + The fields of the DB_ENV structure used by _d_b___a_p_p_i_n_i_t are + described below. The _d_b_e_n_v argument may not be NULL. If + any of the fields of the _d_b_e_n_v are set to 0, defaults + appropriate for the system are used where possible. + + The following fields in the DB_ENV structure may be ini- + tialized before calling _d_b___a_p_p_i_n_i_t: + + void (*db_errcall)(char *db_errpfx, char *buffer); + When an error occurs in the DB package, an _e_r_r_n_o + value is returned by the function. In some cases, + however, the _e_r_r_n_o value may be insufficient to com- + pletely describe the cause of the error. + + If _d_b___e_r_r_c_a_l_l is non-NULL, it may be called with + additional error information. The _d_b___e_r_r_p_f_x argument + is the current environment's _d_b___e_r_r_p_f_x field. The + _b_u_f_f_e_r argument contains a nul-terminated string with + the additional information. + + This error logging facility should not be required + for normal operation, but may be useful in debugging + applications. + + FILE *db_errfile; + The _d_b___e_r_r_f_i_l_e field behaves similarly to the + _d_b___e_r_r_c_a_l_l field, except that the error message is + written to the file stream represented by _d_b___e_r_r_f_i_l_e. + + If _d_b___e_r_r_p_f_x is non-NULL, the message will be pre- + ceded by the string referenced by _d_b___e_r_r_p_f_x, a colon + (``:'') and a space. The message will be followed by + a newline character. + + const char *db_errpfx; + A prefix to prepend to error messages. Because DB + does not copy the memory referenced by the _d_b___e_r_r_p_f_x + field, the application may modify the error message + prefix at any time. + + int db_verbose; + Include informational and debugging messages as well + as error messages in the _d_b___e_r_r_c_a_l_l and _d_b___e_r_r_f_i_l_e + output. + + Each of the open functions that _d_b___a_p_p_i_n_i_t may call + (_l_o_c_k___o_p_e_n, _l_o_g___o_p_e_n, _m_e_m_p___o_p_e_n and _t_x_n___o_p_e_n) is called as + follows, where the DB_CREATE flag is optional: + + XXX_open(NULL, DB_CREATE, + S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, dbenv) + + This call will cause each subsystem to construct pathnames + as described in the section on ``FILE NAMING''. The sub- + system has permission to read and write underlying files + as necessary, and optionally to create files. (All cre- + ated files will be created readable and writeable by the + owner and the group. The group ownership of created files + is based on the system and directory defaults, and is not + further specified by DB.) + + In addition, the _d_b_e_n_v argument is passed to the open + functions of any subsystems initialized by _d_b___a_p_p_i_n_i_t. + For this reason the fields of the DB_ENV structure rele- + vant to the subsystems being initialized must themselves + be initialized before _d_b___a_p_p_i_n_i_t is called. See the man- + ual page for each subsystem for a list of these fields and + their uses. + + The return value from each of these calls is placed in the + appropriate field of the DB_ENV structure: + + DB_LOCKTAB *lk_info; + The return value of the _l_o_c_k___o_p_e_n(3) call. + + DB_LOG *lg_info; + The return value of the _l_o_g___o_p_e_n(3) call. + + DB_MPOOL *mp_info; + The return value of the _m_e_m_p___o_p_e_n(3) call. + + DB_TXNMGR *tx_info; + The return value of the _t_x_n___o_p_e_n(3) call. + + In general, these fields are not directly used by applica- + tions; subsystems of DB that use these fields will simply + reference them using the DB_ENV argument passed to the + subsystem. + + For example, an application using the DB hash access + method functions to access a database will first call + _d_b___o_p_e_n passing it the DB_ENV argument filled in by the + initial call to _d_b___a_p_p_i_n_i_t. Then, all future calls to the + hash access method functions for that database will auto- + matically use the underlying shared memory buffer pool + that was specified by the _m_p___i_n_f_o field of that DB_ENV + argument. + + The single exception to this rule is the _t_x___i_n_f_o field, + which applications must explicitly specify to the + _t_x_n___b_e_g_i_n, _t_x_n___c_h_e_c_k_p_o_i_n_t and _t_x_n___c_l_o_s_e functions. + + Once the DB environment has been initialized by a call to + _d_b___a_p_p_i_n_i_t, no fields other than _d_b___e_r_r_p_f_x should be modi- + fied. + + The _d_b___a_p_p_i_n_i_t function returns the value of _e_r_r_n_o on + failure and 0 on success. + + _d_b___a_p_p_e_x_i_t + The _d_b___a_p_p_e_x_i_t function closes the initialized DB subsys- + tems, freeing any allocated resources and closing any + underlying subsystems. + + When multiple threads are using the DB_ENV handle concur- + rently, only a single thread may call the _d_b___a_p_p_e_x_i_t func- + tion. + + The _d_b___a_p_p_e_x_i_t function returns the value of _e_r_r_n_o on + failure and 0 on success. + +FFIILLEE NNAAMMIINNGG + The most important task of _d_b___a_p_p_i_n_i_t is to structure file + naming within DB. + + Each of the locking, logging, memory pool and transaction + subsystems of DB require shared memory regions, backed by + the filesystem. Further, cooperating applications (or + multiple invocations of the same application) must agree + on the location of the shared memory regions and other + files used by the DB subsystems, the log files used by the + logging subsystem, and, of course, the data files. + + Although it is possible to specify full pathnames to all + DB functions, this is cumbersome and requires that appli- + cations be recompiled when database files are moved. The + _d_b___a_p_p_i_n_i_t function makes it possible to place database + files in a single directory, or in multiple directories, + grouped by their function within the database. + + Applications are normally expected to specify a single + directory home for their database. This can be done eas- + ily in the call to _d_b___a_p_p_i_n_i_t by specifying a value for + the _d_b___h_o_m_e argument. There are more complex configura- + tions where it may be desirable to override _d_b___h_o_m_e or + provide supplementary path information. + + The following describes the possible ways in which file + naming information may be specified to the DB library. + The specific circumstances and order in which these ways + are applied are described in a subsequent paragraph. + + _d_b___h_o_m_e + If the _d_b___h_o_m_e argument to _d_b___a_p_p_i_n_i_t is non-NULL, + its value may be used as the database home, and files + named relative to its path. + + DB_HOME + If the DB_HOME environment variable is set when + _d_b___a_p_p_i_n_i_t is called, its value may be used as the + database home, and files named relative to its path. + + _d_b___c_o_n_f_i_g + The _d_b___c_o_n_f_i_g argument to _d_b___a_p_p_i_n_i_t may be used to + specify an array of character strings of the format + ``NAME VALUE'', that specify file name information + for the process' DB environment. The whitespace + delimiting the two parts of the entry may be one or + more or characters. (Leading or trail- + ing and characters are discarded.) + Each entry must specify both the NAME and the VALUE + of the pair. All entries with unrecognized NAME val- + ues will be ignored. The _d_b___c_o_n_f_i_g array must be + NULL terminated. + + DB_CONFIG + The same information specified to the _d_b___c_o_n_f_i_g argu- + ment to _d_b___a_p_p_i_n_i_t may be specified using a configu- + ration file. If a database home directory has been + specified (either by the application specifying a + non-NULL _d_b___h_o_m_e argument to _d_b___a_p_p_i_n_i_t, or by the + application setting the DB_USE_ENVIRON or DB_USE_ENV- + IRON_ROOT flags and the DB_HOME environment variable + being set), any file named ``DB_CONFIG'' in the + database home directory will be read for lines of the + format ``NAME VALUE''. The whitespace delimiting the + two parts of the line may be one or more or + characters. (Leading or trailing and + characters are discarded.) All empty lines or + lines whose first non-whitespace character is a hash + character (``#'') will be ignored. Each line must + specify both the NAME and the VALUE of the pair. All + lines with unrecognized NAME values will be ignored. + + The following ``NAME VALUE'' pairs in the _d_b___c_o_n_f_i_g argu- + ment and the DB_CONFIG file are currently supported by DB. + + DB_DATA_DIR + The path of a directory to be used as the location of + the access method data files, e.g., paths specified + to the _d_b___o_p_e_n(3) function will be relative to this + path. + + The DB_DATA_DIR paths are additive, and specifying + more than one will result in each specified directory + being searched for database data files. If multiple + paths are specified, created data files will always + be created in the ffiirrsstt directory specified. + + DB_LOG_DIR + The path of a directory to be used as the location of + logging files, e.g., files created by the _d_b___l_o_g(3) + subsystem will be relative to this directory. If + specified, this is the directory name that will be + passed to _l_o_g___o_p_e_n(3). + + DB_TMP_DIR + The path of a directory to be used as the location of + temporary files, e.g., files created to back in-mem- + ory access method databases will be created relative + to this path. Note, these temporary files can poten- + tially be quite large, depending on the size of the + database. + + If DB_TMP_DIR is not specified, the following envi- + ronment variables are checked in order: ``TMPDIR'', + ``TEMP'', ``TMP'' and ``TempFolder''. If one of them + is set, temporary files are created relative to the + directory it specifies. + + If DB_TMP_DIR is not specified and none of the above + environment variables are set, the first possible one + of the following directories is used: _/_v_a_r_/_t_m_p, + _/_u_s_r_/_t_m_p, _/_t_e_m_p, _/_t_m_p, _C_:_/_t_e_m_p and _C_:_/_t_m_p. + + The following describes the specific circumstances and + order in which the different ways of specifying file nam- + ing information are applied. Specifically, DB file name + processing proceeds sequentially through the following + steps: + + ``/'' + If any file name specified to any DB function begins + with a leading slash, that file name is used without + modification by DB. + + DB_CONFIG + If a relevant configuration string (e.g., + DB_DATA_DIR), is specified in the DB_CONFIG configu- + ration file, the VALUE from the ``NAME VALUE'' pair + is prepended to the current file name. If the + resulting file name begins with a leading slash, the + file name is used without further modification by DB. + + The DB_CONFIG configuration file is intended to per- + mit systems to customize file location for a database + independent of applications using that database. For + example, a database administrator can move the + database log and data files to a different location + without application recompilation. + + _d_b___c_o_n_f_i_g + If a relevant configuration string (e.g., + DB_DATA_DIR), is specified in the _d_b___c_o_n_f_i_g argument + and is not specified in the DB_CONFIG file, the VALUE + from the ``NAME VALUE'' pair is prepended to the cur- + rent file name. If the resulting file name begins + with a leading slash, the file name is used without + further modification by DB. + + The _d_b___c_o_n_f_i_g argument is intended to permit applica- + tions to customize file location for a database. For + example, an application writer can place data files + and log files in different directories, or instanti- + ate a new log directory each time the application + runs. + + DB_HOME + If the DB_HOME environment variable was set, (and the + application has set the appropriate DB_USE_ENVIRON or + DB_USE_ENVIRON_ROOT environment variable), its value + is prepended to the current file name. If the + resulting file name begins with a leading slash, the + file name is used without further modification by DB. + + The DB_HOME environment variable is intended to per- + mit users and system administrators to override + application and installation defaults, e.g., + + env DB_HOME=/database/my_home application + + Alternatively, application writers are encouraged to + support the --hh option found in the supporting DB + utilities to let users specify a database home. + + _d_b___h_o_m_e + If the application specified a non-NULL _d_b___h_o_m_e argu- + ment to _d_b___a_p_p_i_n_i_t (and the database home was not + already specified using the DB_HOME environment vari- + able) its value is prepended to the current file + name. If the resulting file name begins with a lead- + ing slash, the file name is used without further mod- + ification by DB. + + (nothing) + Finally, all file names are interpreted relative to + the current working directory of the process. + + The common model for a DB environment is one where only + the DB_HOME environment variable, or the _d_b___h_o_m_e argument, + is specified. In this case, all data files will be pre- + sumed to be relative to that directory, and all files cre- + ated by the DB subsystems will be created in that direc- + tory. + + The more complex model for a transaction environment might + be one where a database home is specified, using either + the DB_HOME environment variable or the _d_b___h_o_m_e argument + to _d_b___a_p_p_i_n_i_t, and then DB_DATA_DIR and DB_LOG_DIR are set + to the relative path names of directories underneath the + home directory using the _d_b___c_o_n_f_i_g argument to _d_b___a_p_p_i_n_i_t + or the DB_CONFIG file. + +EEXXAAMMPPLLEESS + Store all files in the directory _/_a_/_d_a_t_a_b_a_s_e: + + db_appinit("/a/database", NULL, ...); + + Create temporary backing files in _/_b_/_t_e_m_p_o_r_a_r_y, and all + other files in _/_a_/_d_a_t_a_b_a_s_e: + + char *config[] = { + "DB_TMP_DIR /b/temporary", + NULL + }; + + db_appinit("/a/database", config, ...); + + Store data files in _/_a_/_d_a_t_a_b_a_s_e_/_d_a_t_a_d_i_r, log files in + _/_a_/_d_a_t_a_b_a_s_e_/_l_o_g_d_i_r, and all other files in the directory + _/_a_/_d_a_t_a_b_a_s_e: + + char *config[] = { + "DB_DATA_DIR datadir", + "DB_LOG_DIR logdir", + NULL + }; + + db_appinit("/a/database", config, ...); + + Store data files in _/_a_/_d_a_t_a_b_a_s_e_/_d_a_t_a_1 and _/_b_/_d_a_t_a_2, and + all other files in the directory _/_a_/_d_a_t_a_b_a_s_e. Any data + files that are created will be created in _/_b_/_d_a_t_a_2: + + char *config[] = { + "DB_DATA_DIR /b/data2", + "DB_DATA_DIR data1", + NULL + }; + + db_appinit("/a/database", config, ...); + + See the file _e_x_a_m_p_l_e_s_/_e_x___a_p_p_i_n_i_t_._c in the DB source dis- + tribution for a C language code example of how an applica- + tion might use _d_b___a_p_p_i_n_i_t to configure its DB environment. + +EERRRROORRSS + The _d_b___a_p_p_i_n_i_t function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: DB->close(3), calloc(3), db_appexit(3), + fclose(3), fcntl(2), fflush(3), fgets(3), fopen(3), + lock_open(3), lock_unlink(3), log_compare(3), log_get(3), + log_open(3), log_unlink(3), malloc(3), memcpy(3), + memp_open(3), memp_unlink(3), memset(3), realloc(3), + stat(2), strchr(3), strcmp(3), strcpy(3), strdup(3), str- + error(3), strlen(3), strsep(3), time(3), txn_check- + point(3), txn_open(3), and txn_unlink(3). + + In addition, the _d_b___a_p_p_i_n_i_t function may fail and return + _e_r_r_n_o for the following conditions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The DB_THREAD flag was specified and spinlocks are + not implemented for this architecture. + + The DB_RECOVER or DB_RECOVER_FATAL flag was speci- + fied, and no log files were found. + + The DB_HOME or TMPDIR environment variables were set + but empty. + + An incorrectly formatted ``NAME VALUE'' entry or line + was found. + + [ENOSPC] + HP-UX only: a previously created DB environment for + this process still exists. + + The _d_b___a_p_p_e_x_i_t function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: lock_close(3), log_close(3), memp_close(3), and + txn_close(3). + +BBUUGGSS + Due to the constraints of the PA-RISC memory architecture, + HP-UX does not allow a process to map a file into its + address space multiple times. For this reason, each DB + environment may be opened only once by a process on HP-UX, + i.e., calls to _a_p_p_i_n_i_t will fail if the specified DB envi- + ronment has been opened and not subsequently closed. + + On Windows/95, files that are opened by multiple processes + do not share data correctly. To tell Berkeley DB to use + the paging file to share memory among processes, use the + DB_REGION_NAME flag of the _d_b___v_a_l_u_e___s_e_t function. Obvi- + ously, you do not need to do this if only a single process + will be accessing database files. + +SSEEEE AALLSSOO + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/man.text/db_archive.0 b/mozilla/db/man/man.text/db_archive.0 new file mode 100644 index 00000000000..3ec175b4d8d --- /dev/null +++ b/mozilla/db/man/man.text/db_archive.0 @@ -0,0 +1,191 @@ + + +NNAAMMEE + db_archive - the DB database archiver + +SSYYNNOOPPSSIISS + ddbb__aarrcchhiivvee [--aallssvv] [--hh hhoommee] + +DDEESSCCRRIIPPTTIIOONN + The _d_b___a_r_c_h_i_v_e utility writes the pathnames of log files + that are no longer in use (e.g., no longer involved in + active transactions), to the standard output, one pathname + per line. These log files should be written to backup + media to provide for recovery in the case of catastrophic + failure (which also requires a snapshot of the database + files), but they may then be deleted from the system to + reclaim disk space. + + The options are as follows: + + --aa Write all pathnames as absolute pathnames, instead of + relative to the database home directories. + + --hh Specify a home directory for the database. + + --ll Write out the pathnames of all of the database log + files, whether or not they are involved in active + transactions. + + --ss Write the pathnames of all of the database files that + need to be archived in order to recover the database + from catastrophic failure. If any of the database + files have not been accessed during the lifetime of + the current log files, _d_b___a_r_c_h_i_v_e will not include + them in this output. + + It is possible that some of the files referenced in + the log have since been deleted from the system. In + this case, _d_b___a_r_c_h_i_v_e will ignore them. When + _d_b___r_e_c_o_v_e_r(1) is run, any files referenced in the log + that are not present during recovery are assumed to + have been deleted and will not be recovered. + + --vv Run in verbose mode, listing the checkpoints in the + log files as they are reviewed. + + The _d_b___a_r_c_h_i_v_e utility attaches to DB shared memory + regions. In order to avoid region corruption, it should + always be given the chance to detach and exit gracefully. + To cause _d_b___a_r_c_h_i_v_e to clean up after itself and exit, + send it an interrupt signal (SIGINT). + + The _d_b___a_r_c_h_i_v_e utility exits 0 on success, and >0 if an + error occurs. + +DDBB AARRCCHHIIVVAALL PPRROOCCEEDDUURREESS + There are two aspects to managing the recoverability and + disk consumption of your DB databases. First, you may + want to periodically create snapshots of your databases to + make it possible to recover them from catastrophic + failure. Second, you'll want to periodically remove log + files in order to conserve on disk space. The two proce- + dures are distinct from each other, and you cannot remove + the current log files simply because you have created a + database snapshot. + + To create a snapshot of your database that can be used to + recover from catastrophic failure, the following steps + should be taken: + + 1. Run _d_b___a_r_c_h_i_v_e -s to identify all of the database + data files that must be saved, and copy them to a + backup device, (e.g., tape). If the database files + are stored in a separate directory from the other + database files, it may be simpler to archive the + directory itself instead of the individual files. + + MMoorree iimmppoorrttaannttllyy,, iiff aannyy ooff tthhee ddaattaabbaassee ffiilleess hhaavvee + nnoott bbeeeenn aacccceesssseedd dduurriinngg tthhee lliiffeettiimmee ooff tthhee ccuurrrreenntt + lloogg ffiilleess,, ddbb__aarrcchhiivvee wwiillll nnoott lliisstt tthheemm iinn iittss oouutt-- + ppuutt!! For this reason, it may be important to use a + separate database file directory, archiving it + instead of the files listed by _d_b___a_r_c_h_i_v_e. + + 2. If your database is currently active, i.e., you are + reading and writing to the database files while the + snapshot is being taken, run _d_b___a_r_c_h_i_v_e -l to iden- + tify the database log files, and copy them to a + backup device, (e.g., tape). If the database log + files are stored in a separate directory from the + other database files, it may be simpler to archive + the directory itself instead of the individual files. + + Note that the order of these operations is important, and + that the database files mmuusstt be archived before the log + files. + + The DB library supports on-line backups, and it is not + necessary to stop reading or writing your databases during + the time when you create this snapshot. Note however, + that the snapshot of an active database will be consistent + as of some unspecified time between the start of the + archival and when archival is completed. To create a + snapshot as of a specific time, you must stop reading and + writing your databases for the entire time of the + archival, force a checkpoint (see _d_b___c_h_e_c_k_p_o_i_n_t(1)), and + then archive the files listed by the _d_b___a_r_c_h_i_v_e command's + --ss and --ll options. + + Once these steps are completed, your database can be + recovered from catastrophic failure to its state as of the + time the archival was done. To update your snapshot so + that recovery from catastrophic failure is possible up to + a new point in time, repeat step #2, copying all existing + log files to a backup device. + + Each time that a complete snapshot is made, i.e. all + database and log files are copied to backup media, you may + discard all previous snapshots and saved log files. + + The time to restore from catastrophic failure is a func- + tion of the number of log records that have been written + since the snapshot was originally created. Perhaps more + importantly, the more separate pieces of backup media you + use, the more likely that you will have a problem reading + from one of them. For these reasons, it is often best to + make snapshots on a regular basis. + + FFoorr aarrcchhiivvaall ssaaffeettyy rreemmeemmbbeerr ttoo eennssuurree tthhaatt yyoouu hhaavvee mmuull-- + ttiippllee ccooppiieess ooff yyoouurr ddaattaabbaassee bbaacckkuuppss,, tthhaatt yyoouu vveerriiffyy + tthhaatt yyoouurr aarrcchhiivvaall mmeeddiiaa iiss eerrrroorr--ffrreeee,, aanndd tthhaatt ccooppiieess ooff + yyoouurr bbaacckkuuppss aarree ssttoorreedd ooffff--ssiittee!! + + To restore your database after catastrophic failure, the + following steps should be taken: + + 1. Restore the copies of the database files from the + backup media. + + 2. Restore the copies of the log files from the backup + media, iinn tthhee oorrddeerr iinn wwhhiicchh tthheeyy wweerree wwrriitttteenn. + (It's possible that the same log file appears on mul- + tiple backups, and you only want the most recent ver- + sion of that log file!) + + 3. Run _d_b___r_e_c_o_v_e_r -c to recover the database. + + It is possible to recreate the database in a location dif- + ferent than the original, by specifying appropriate path- + names to the -h option of the _d_b___r_e_c_o_v_e_r utility. + + To remove log files, the following steps should be taken: + + 1. If you are concerned with catastrophic failure, first + copy them to backup media (e.g., tape), as described + above. This is because log files are necessary for + recovery from catastrophic failure. + + 2. Run _d_b___a_r_c_h_i_v_e, without options, to identify all of + the log files that are no longer in use (e.g., + involved in an active transaction). + + 3. Remove those log files from the system. + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _d_b___a_r_c_h_i_v_e: + + DB_HOME + If the --hh option is not specified and the environment + variable _D_B___H_O_M_E is set, it is used as the path of + the database home, as described in _d_b___a_p_p_i_n_i_t(3). + +SSEEEE AALLSSOO + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/man.text/db_checkpoint.0 b/mozilla/db/man/man.text/db_checkpoint.0 new file mode 100644 index 00000000000..c036f4be868 --- /dev/null +++ b/mozilla/db/man/man.text/db_checkpoint.0 @@ -0,0 +1,76 @@ + + +NNAAMMEE + db_checkpoint - the DB database checkpoint utility + +SSYYNNOOPPSSIISS + ddbb__cchheecckkppooiinntt [--11vv] [--hh hhoommee] [--kk kkbbyytteess] [--LL ffiillee] [--pp mmiinn] + +DDEESSCCRRIIPPTTIIOONN + The _d_b___c_h_e_c_k_p_o_i_n_t utility is a daemon process that moni- + tors the database log and periodically calls _t_x_n___c_h_e_c_k_- + _p_o_i_n_t(3) to checkpoint it. + + The options are as follows: + + --11 Checkpoint the log once, and then exit. + + --hh Specify a home directory for the database. + + --kk Checkpoint the database at least as often as every + _k_b_y_t_e_s of log file are written. + + --LL Log the execution of the db_checkpoint utility to the + specified file in the following format, where ``###'' + is the process ID, and the date is the time the util- + ity starting running. + + db_checkpoint: ### Wed Jun 15 01:23:45 EDT 1995 + + This file will be removed if the db_checkpoint util- + ity exits gracefully. + + --pp Checkpoint the database at least every _m_i_n minutes. + + --vv Write the time of each checkpoint to the standard + output. + + At least one of the --11, --kk and --pp options must be speci- + fied. + + The _d_b___c_h_e_c_k_p_o_i_n_t utility attaches to DB shared memory + regions. In order to avoid region corruption, it should + always be given the chance to detach and exit gracefully. + To cause _d_b___c_h_e_c_k_p_o_i_n_t to clean up after itself and exit, + send it an interrupt signal (SIGINT). + + The _d_b___c_h_e_c_k_p_o_i_n_t utility exits 0 on success, and >0 if an + error occurs. + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _d_b___c_h_e_c_k_p_o_i_n_t: + + DB_HOME + If the --hh option is not specified and the environment + variable _D_B___H_O_M_E is set, it is used as the path of + the database home, as described in _d_b___a_p_p_i_n_i_t(3). + +SSEEEE AALLSSOO + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/man.text/db_cursor.0 b/mozilla/db/man/man.text/db_cursor.0 new file mode 100644 index 00000000000..397f1f08cc5 --- /dev/null +++ b/mozilla/db/man/man.text/db_cursor.0 @@ -0,0 +1,459 @@ + + +NNAAMMEE + db_cursor - database sequential access functions + +SSYYNNOOPPSSIISS + ##iinncclluuddee <> + + iinntt + DDBBccuurrssoorr-->>cc__cclloossee((DDBBCC **ccuurrssoorr));; + + iinntt + DDBBccuurrssoorr-->>cc__ddeell((DDBBCC **ccuurrssoorr,, uu__iinntt3322__tt ffllaaggss));; + + iinntt + DDBBccuurrssoorr-->>cc__ggeett((DDBBCC **ccuurrssoorr,, DDBBTT **kkeeyy,, DDBBTT **ddaattaa,, uu__iinntt3322__tt ffllaaggss));; + + iinntt + DDBBccuurrssoorr-->>cc__ppuutt((DDBBCC **,, DDBBTT **kkeeyy,, DDBBTT **ddaattaa,, uu__iinntt3322__tt ffllaaggss));; + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + This manual page describes the specific details of the + cursor support for the DB access methods. + + The _d_b___c_u_r_s_o_r functions are the library interface support- + ing sequential access to the records stored by the access + methods of the DB library. Cursors are created by calling + the _c_u_r_s_o_r function of a DB structure returned by + _d_b___o_p_e_n(3), which returns a pointer to a DBC structure. + + Each cursor maintains positioning information within a set + of key/data pairs. In the presence of transactions, cur- + sors are only valid within the context of a single trans- + action, the one specified during the _c_u_r_s_o_r call described + in _d_b___o_p_e_n(3). All cursor operations will be executed in + the context of that transaction. Before aborting or com- + mitting a transaction, all cursors used within that trans- + action must be closed. In the presence of transactions, + the application must call _t_x_n___a_b_o_r_t if any of the cursor + operations returns that a deadlock (EAGAIN) or system + failure occurred. + + When locking is enabled, page locks are retained between + consecutive cursor calls. For this reason, in the pres- + ence of locking, applications should discard cursors as + soon as they are done with them. Calling the db _c_l_o_s_e + function (see _d_b___o_p_e_n(3)) discards any cursors opened in + the context of a particular DB structure returned by the + _d_b___o_p_e_n call. + + The cursor has an associated set of functions to access + elements in the database, accessed through the DBC struc- + ture. The elements of the DBC structure are defined as + follows: + + int (*c_close)(DBC *cursor); + A pointer to a function that discards the cursor. No + further references to the cursor should be made. + + The _c___c_l_o_s_e function returns the value of _e_r_r_n_o on + failure and 0 on success. + + int (*c_del)(DBC *cursor, u_int32_t flags); + A pointer to a function that deletes the key/data + pair currently referenced by the cursor. + + The _f_l_a_g_s parameter is currently unused, and must be + set to 0. + + The cursor position is unchanged after a delete and + subsequent calls to cursor functions expecting the + cursor to reference an existing key will fail. + + The _c___d_e_l function returns the value of _e_r_r_n_o on + failure, 0 on success, and DB_KEYEMPTY if the element + has already been deleted. + + int (*c_get)(DBC *cursor, DBT *key, DBT *data, u_int32_t + flags); + A pointer to a function that retrieves key/data pairs + from the database. The address and length of the key + are returned in the structure referenced by _k_e_y + (except for the case of the DB_SET flag where the _k_e_y + structure is unchanged), and the address and length + of the data are returned in the structure referenced + by _d_a_t_a. + + Modifications to the database during a sequential + scan will be reflected in the scan, i.e. records + inserted behind a cursor will not be returned while + records inserted in front of a cursor will be + returned. + + In recno databases, missing entries (i.e., entries + that were never explicitly created or that were cre- + ated and then deleted), will be skipped during a + sequential scan. + + If multiple threads or processes insert items into + the same database file without using locking, the + results are undefined. For more detail, see the sec- + tion below on cursor stability. + + The parameter _f_l_a_g_s must be set to exactly one of the + following values: + + DB_FIRST + The cursor is set to reference the first + key/data pair of the database, and that pair is + returned. In the presence of duplicate key val- + ues, the first data item in the set of dupli- + cates is returned. + + If the database is empty, the _c___g_e_t function + will return DB_NOTFOUND. + + DB_LAST + The cursor is set to reference the last key/data + pair of the database, and that pair is returned. + In the presence of duplicate key values, the + last data item in the set of duplicates is + returned. + + If the database is empty, the _c___g_e_t function + will return DB_NOTFOUND. + + DB_NEXT + If the cursor is not yet initialized, DB_NEXT is + identical to DB_FIRST. + + Otherwise, move the cursor to the next key/data + pair of the database, and that pair is returned. + In the presence of duplicate key values, the + value of the key may not change. + + If the cursor is already on the last record in + the database, the _c___g_e_t function will return + DB_NOTFOUND. + + DB_PREV + If the cursor is not yet initialized, DB_PREV is + identical to DB_LAST. + + Otherwise, move the cursor to the previous + key/data pair of the database, and that pair is + returned. In the presence of duplicate key val- + ues, the value of the key may not change. + + If the cursor is already on the first record in + the database, the _c___g_e_t function will return + DB_NOTFOUND. + + DB_CURRENT + Return the key/data pair currently referenced by + the cursor. + + If the cursor key/data pair has been deleted, + the _c___g_e_t function will return DB_KEYEMPTY. + + If the cursor is not yet initialized, the _c___g_e_t + function will return EINVAL. + + DB_SET + Move the cursor to the specified key/data pair + of the database, and return the datum associated + with the given key. + + In the presence of duplicate key values, _c___g_e_t + will return the first data item for the given + key. + + If the database is a recno database and the + requested key exists, but was never explicitly + created by the application or was later deleted, + the _c___g_e_t function returns DB_KEYEMPTY. + + If no matching keys are found, the _c___g_e_t func- + tion will return DB_NOTFOUND. + + DB_SET_RANGE + The DB_SET_RANGE flag is identical to the DB_SET + flag, except that the key is returned as well as + the data item, and, in the case of the btree + access method, the returned key/data pair is the + smallest key greater than or equal to the speci- + fied key (as determined by the comparison func- + tion), permitting partial key matches and range + searches. + + DB_SET_RECNO + Move the cursor to the specific numbered record + of the database, and return the associated + key/data pair. The _d_a_t_a field of the specified + _k_e_y must be a pointer to a memory location from + which a _d_b___r_e_c_n_o___t may be read, as described in + _d_b___d_b_t(3). This memory location will be read to + determine the record to be retrieved. + + For DB_SET_RECNO to be specified, the underlying + database must be of type btree and it must have + been created with the DB_RECNUM flag (see + _d_b___o_p_e_n(3)). + + DB_GET_RECNO + Return the record number associated with the + cursor. The record number will be returned in + the data DBT as described in _d_b___d_b_t(3). The _k_e_y + parameter is ignored. + + For DB_GET_RECNO to be specified, the underlying + database must be of type btree and it must have + been created with the DB_RECNUM flag (see + _d_b___o_p_e_n(3)). + + Otherwise, the _c___g_e_t function returns the value of + _e_r_r_n_o on failure and 0 on success. + + If _c___g_e_t fails for any reason, the state of the cur- + sor will be unchanged. + + int (*c_put)(DBC *, DBT *key, DBT *data, u_int32_t flags); + A pointer to a function that stores key/data pairs + into the database. + + The _f_l_a_g_s parameter must be set to exactly one of the + following values: + + DB_AFTER + In the case of the btree and hash access meth- + ods, insert the data element as a duplicate ele- + ment of the key referenced by the cursor. The + new element appears immediately after the cur- + rent cursor position. It is an error to specify + DB_AFTER if the underlying btree or hash + database was not created with the DB_DUP flag. + The _k_e_y parameter is ignored. + + In the case of the recno access method, it is an + error to specify DB_AFTER if the underlying + recno database was not created with the + DB_RENUMBER flag. If the DB_RENUMBER flag was + specified, a new key is created, all records + after the inserted item are automatically renum- + bered, and the key of the new record is returned + in the structure referenced by the parameter + _k_e_y. The initial value of the _k_e_y parameter is + ignored. See _d_b___o_p_e_n(3) for more information. + + If the cursor is not yet initialized, the _c___p_u_t + function will return EINVAL. + + DB_BEFORE + In the case of the btree and hash access meth- + ods, insert the data element as a duplicate ele- + ment of the key referenced by the cursor. The + new element appears immediately before the cur- + rent cursor position. It is an error to specify + DB_BEFORE if the underlying btree or hash + database was not created with the DB_DUP flag. + The _k_e_y parameter is ignored. + + In the case of the recno access method, it is an + error to specify DB_BEFORE if the underlying + recno database was not created with the + DB_RENUMBER flag. If the DB_RENUMBER flag was + specified, a new key is created, the current + record and all records after it are automati- + cally renumbered, and the key of the new record + is returned in the structure referenced by the + parameter _k_e_y. The initial value of the _k_e_y + parameter is ignored. See _d_b___o_p_e_n(3) for more + information. + + If the cursor is not yet initialized, the _c___p_u_t + function will return EINVAL. + + DB_CURRENT + Overwrite the data of the key/data pair refer- + enced by the cursor with the specified data + item. + + The _k_e_y parameter is ignored. + + If the cursor is not yet initialized, the _c___p_u_t + function will return EINVAL. + + DB_KEYFIRST + In the case of the btree and hash access meth- + ods, insert the specified key/data pair into the + database. If the key already exists in the + database, the inserted data item is added as the + first of the data items for that key. + + The DB_KEYFIRST flag may not be specified to the + recno access method. + + DB_KEYLAST + Insert the specified key/data pair into the + database. If the key already exists in the + database, the inserted data item is added as the + last of the data items for that key. + + The DB_KEYLAST flag may not be specified to the + recno access method. + + If the cursor record has been deleted, the _c___p_u_t + function will return DB_KEYEMPTY. + + Otherwise, the _c___p_u_t function returns the value of + _e_r_r_n_o on failure and 0 on success. + + If _c___p_u_t fails for any reason, the state of the cur- + sor will be unchanged. If _c___p_u_t succeeds and an item + is inserted into the database, the cursor is always + positioned to reference the newly inserted item. + +CCUURRSSOORR SSTTAABBIILLIITTYY + In the absence of locking, no guarantees are made about + the stability of cursors in different processes or + threads. However, the btree and recno access methods + guarantee that cursor operations, interspersed with other + cursor or non-cursor operations in the same thread of con- + trol (i.e., thread or single-threaded process), will + always return keys in order and will return each non- + deleted key/data pair exactly once. Because the hash + access method uses a dynamic hashing algorithm, it cannot + guarantee any form of stability in the presence of inserts + and deletes unless locking is performed. + + If locking was specified when the DB file was opened, but + transactions are not in effect, the access methods provide + repeatable reads with respect to the cursor. That is, a + DB_CURRENT call on the cursor is guaranteed to return the + same record as was returned on the last call to the cur- + sor. + + In the presence of transactions, the access method calls + between _t_x_n___b_e_g_i_n and _t_x_n___a_b_o_r_t or _t_x_n___c_o_m_m_i_t provide + degree 3 consistency. For all access methods, a cursor + scan of the database performed within the context of a + transaction is guaranteed to return each key/data pair + once and only once, except in the following case. If, + while performing a cursor scan using the hash access + method, the transaction performing the scan inserts a new + pair into the database, it is possible that duplicate + key/data pairs will be returned. + +EERRRROORRSS + The _D_B_c_u_r_s_o_r_-_>_c___c_l_o_s_e function may fail and return _e_r_r_n_o + for any of the errors specified for the following DB and + library functions: calloc(3), fcntl(2), fflush(3), + lock_get(3), lock_id(3), lock_put(3), lock_vec(3), + log_put(3), malloc(3), memcpy(3), memmove(3), + memp_fget(3), memp_fput(3), memp_fset(3), memset(3), real- + loc(3), and strerror(3). + + In addition, the _D_B_c_u_r_s_o_r_-_>_c___c_l_o_s_e function may fail and + return _e_r_r_n_o for the following conditions: + + [EAGAIN] + A lock was unavailable. + + [EPERM] + Database corruption was detected. All subsequent + database calls (other than _D_B_-_>_c_l_o_s_e) will return + EPERM. + + The _D_B_c_u_r_s_o_r_-_>_c___d_e_l function may fail and return _e_r_r_n_o for + any of the errors specified for the following DB and + library functions: DB->del(3), calloc(3), fcntl(2), + fflush(3), lock_get(3), lock_id(3), lock_put(3), + lock_vec(3), log_put(3), malloc(3), memcpy(3), memmove(3), + memp_fget(3), memp_fput(3), memp_fset(3), memset(3), + realloc(3), and strerror(3). + + In addition, the _D_B_c_u_r_s_o_r_-_>_c___d_e_l function may fail and + return _e_r_r_n_o for the following conditions: + + [EAGAIN] + A lock was unavailable. + + [EINVAL] + An invalid flag value or parameter was specified. + + [EPERM] + Database corruption was detected. All subsequent + database calls (other than _D_B_-_>_c_l_o_s_e) will return + EPERM. + + The _D_B_c_u_r_s_o_r_-_>_c___g_e_t function may fail and return _e_r_r_n_o for + any of the errors specified for the following DB and + library functions: DB->get(3), calloc(3), fcntl(2), + fflush(3), lock_get(3), lock_id(3), lock_put(3), + lock_vec(3), log_put(3), malloc(3), memcmp(3), memcpy(3), + memmove(3), memp_fget(3), memp_fput(3), memp_fset(3), mem- + set(3), realloc(3), and strerror(3). + + In addition, the _D_B_c_u_r_s_o_r_-_>_c___g_e_t function may fail and + return _e_r_r_n_o for the following conditions: + + [EAGAIN] + A lock was unavailable. + + [EINVAL] + An invalid flag value or parameter was specified. + + The DB_THREAD flag was specified to the _d_b___o_p_e_n(3) + function and neither the DB_DBT_MALLOC or + DB_DBT_USERMEM flags were set in the DBT. + + [EPERM] + Database corruption was detected. All subsequent + database calls (other than _D_B_-_>_c_l_o_s_e) will return + EPERM. + + The _D_B_c_u_r_s_o_r_-_>_c___p_u_t function may fail and return _e_r_r_n_o for + any of the errors specified for the following DB and + library functions: calloc(3), fcntl(2), fflush(3), + lock_get(3), lock_id(3), lock_put(3), lock_vec(3), + log_put(3), malloc(3), memcmp(3), memcpy(3), memmove(3), + memp_fget(3), memp_fput(3), memp_fset(3), memset(3), real- + loc(3), and strerror(3). + + In addition, the _D_B_c_u_r_s_o_r_-_>_c___p_u_t function may fail and + return _e_r_r_n_o for the following conditions: + + + [EACCES] + An attempt was made to modify a read-only database. + + [EAGAIN] + A lock was unavailable. + + [EINVAL] + An invalid flag value or parameter was specified. + + [EPERM] + Database corruption was detected. All subsequent + database calls (other than _D_B_-_>_c_l_o_s_e) will return + EPERM. + +SSEEEE AALLSSOO + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/man.text/db_dbm.0 b/mozilla/db/man/man.text/db_dbm.0 new file mode 100644 index 00000000000..a0926439742 --- /dev/null +++ b/mozilla/db/man/man.text/db_dbm.0 @@ -0,0 +1,295 @@ + + +NNAAMMEE + dbm - dbminit, fetch, store, delete, firstkey, nextkey + + ndbm - dbm_open, dbm_close, dbm_fetch, dbm_store, dbm_delete, + dbm_firstkey, dbm_nextkey, dbm_error, dbm_clearerr + +SSYYNNOOPPSSIISS + ##ddeeffiinnee DDBB__DDBBMM__HHSSEEAARRCCHH 11 + ##iinncclluuddee <> + + ttyyppeeddeeff ssttrruucctt {{ + cchhaarr **ddppttrr;; + iinntt ddssiizzee;; + }} ddaattuumm;; + +DDBBMM FFUUNNCCTTIIOONNSS + iinntt + ddbbmmiinniitt((cchhaarr **ffiillee));; + + ddaattuumm + ffeettcchh((ddaattuumm kkeeyy));; + + iinntt + ssttoorree((ddaattuumm kkeeyy,, ddaattuumm ccoonntteenntt));; + + iinntt + ddeelleettee((ddaattuumm kkeeyy));; + + ddaattuumm + ffiirrssttkkeeyy((vvooiidd));; + + ddaattuumm + nneexxttkkeeyy((ddaattuumm kkeeyy));; + +NNDDBBMM FFUUNNCCTTIIOONNSS + DDBBMM ** + ddbbmm__ooppeenn((cchhaarr **ffiillee,, iinntt ffllaaggss,, iinntt mmooddee));; + + vvooiidd + ddbbmm__cclloossee((DDBBMM **ddbb));; + + ddaattuumm + ddbbmm__ffeettcchh((DDBBMM **ddbb,, ddaattuumm kkeeyy));; + + iinntt + ddbbmm__ssttoorree((DDBBMM **ddbb,, ddaattuumm kkeeyy,, ddaattuumm ccoonntteenntt,, iinntt ffllaaggss));; + + iinntt + ddbbmm__ddeelleettee((DDBBMM **ddbb,, ddaattuumm kkeeyy));; + + ddaattuumm + ddbbmm__ffiirrssttkkeeyy((DDBBMM **ddbb));; + + ddaattuumm + ddbbmm__nneexxttkkeeyy((DDBBMM **ddbb));; + + iinntt + ddbbmm__eerrrroorr((DDBBMM **ddbb));; + iinntt + ddbbmm__cclleeaarreerrrr((DDBBMM **ddbb));; + +DDEESSCCRRIIPPTTIIOONN + The _d_b_m and _n_d_b_m interfaces to the DB library are intended + to provide source code compatibility for historic applica- + tions. They are not recommended for any other purpose. + The historic _d_b_m and _n_d_b_m database format is nnoott sup- + ported, and databases previously built using the real _d_b_m + or _n_d_b_m libraries cannot be read by the DB functions. + + To compile _d_b_m or _n_d_b_m applications, replace the applica- + tion's _#_i_n_c_l_u_d_e of the dbm or ndbm include file (e.g., + ``#include '' or ``#include '') with the + following two lines: + + #define DB_DBM_HSEARCH 1 + #include + + and recompile. If the application attempts to load + against a dbm library (e.g., ``-ldbm''), remove the + library from the load line. + + _K_e_ys and _c_o_n_t_e_n_ts are described by the _d_a_t_u_m typedef. A + _d_a_t_u_m specifies a string of _d_s_i_z_e bytes pointed to by + _d_p_t_r. Arbitrary binary data, as well as normal text + strings, are allowed. + +DDBBMM FFUUNNCCTTIIOONNSS + Before a database can be accessed, it must be opened by + _d_b_m_i_n_i_t. This will open and/or create the database + _f_i_l_e.db. If created, the database file is created + read/write by owner only (as described in _c_h_m_o_d(2)) and + modified by the process' umask value at the time of cre- + ation (see _u_m_a_s_k(2)). The group ownership of created + files is based on the system and directory defaults, and + is not further specified by DB. + + Once open, the data stored under a key is accessed by + _f_e_t_c_h and data is placed under a key by _s_t_o_r_e. A key (and + its associated contents) is deleted by _d_e_l_e_t_e. A linear + pass through all keys in a database may be made, in an + (apparently) random order, by use of _f_i_r_s_t_k_e_y and _n_e_x_t_k_e_y. + _F_i_r_s_t_k_e_y will return the first key in the database. With + any key _n_e_x_t_k_e_y will return the next key in the database. + This code will traverse the data base: + + for (key = firstkey(); + key.dptr != NULL; key = nextkey(key)) + +NNDDBBMM FFUUNNCCTTIIOONNSS + Before a database can be accessed, it must be opened by + _d_b_m___o_p_e_n. This will open and/or create the database file + _f_i_l_e.db depending on the flags parameter (see _o_p_e_n(2)). + + If created, the database file is created with mode _m_o_d_e + (as described in _c_h_m_o_d(2)) and modified by the process' + umask value at the time of creation (see _u_m_a_s_k(2)). The + group ownership of created files is based on the system + and directory defaults, and is not further specified by + DB. + + Once open, the data stored under a key is accessed by + _d_b_m___f_e_t_c_h and data is placed under a key by _d_b_m___s_t_o_r_e. + The _f_l_a_g_s field can be either DDBBMM__IINNSSEERRTT or DDBBMM__RREEPPLLAACCEE.. + DDBBMM__IINNSSEERRTT will only insert new entries into the database + and will not change an existing entry with the same key. + DDBBMM__RREEPPLLAACCEE will replace an existing entry if it has the + same key. A key (and its associated contents) is deleted + by _d_b_m___d_e_l_e_t_e. A linear pass through all keys in a + database may be made, in an (apparently) random order, by + use of _d_b_m___f_i_r_s_t_k_e_y and _d_b_m___n_e_x_t_k_e_y. _D_b_m___f_i_r_s_t_k_e_y will + return the first key in the database. _D_b_m___n_e_x_t_k_e_y will + return the next key in the database. This code will tra- + verse the data base: + + for (key = dbm_firstkey(db); + key.dptr != NULL; key = dbm_nextkey(db)) + + _D_b_m___e_r_r_o_r returns non-zero when an error has occurred + reading or writing the database. _D_b_m___c_l_e_a_r_e_r_r resets the + error condition on the named database. + +CCOOMMPPAATTIIBBIILLIITTYY NNOOTTEESS + The historic _d_b_m and _n_d_b_m libraries created two underlying + database files, traditionally named _f_i_l_e.dir and _f_i_l_e.pag. + The DB library creates a single database file named + _f_i_l_e.db. Applications that are aware of the underlying + database file names may require additional source code + modifications. + + The historic _d_b_m_i_n_i_t interface required that the underly- + ing ``.dir'' and ``.pag'' files already exist (empty + databases were created by creating zero-length ``.dir'' + and ``.pag'' files). Applications that expect to create + databases using this method may require additional source + code modifications. + + The historic _d_b_m___d_i_r_f_n_o and _d_b_m___p_a_g_f_n_o macros are sup- + ported, but will return identical file descriptors as + there is only a single underlying file used by the DB + hashing access method. Applications using both file + descriptors for locking may require additional source code + modifications. + + If an application using the _n_d_b_m interface exits without + closing the database, it may lose updates because the DB + library buffers all writes. Such applications will + require additional source code modifications to work + correctly with the DB library. + +DDBBMM DDIIAAGGNNOOSSTTIICCSS + The _d_b_m_i_n_i_t function returns -1 on failure, setting _e_r_r_n_o, + and 0 on success. + + The _f_e_t_c_h function sets the returned _d_a_t_u_m's _d_p_t_r field to + NULL on failure, setting _e_r_r_n_o, and returns a non-NULL + _d_p_t_r on success. + + The _s_t_o_r_e function returns -1 on failure, setting _e_r_r_n_o, + and 0 on success. + + The _d_e_l_e_t_e function returns -1 on failure, setting _e_r_r_n_o, + and 0 on success. + + The _f_i_r_s_t_k_e_y function sets the returned _d_a_t_u_m's _d_p_t_r field + to NULL on failure, setting _e_r_r_n_o, and returns a non-NULL + _d_p_t_r on success. + + The _n_e_x_t_k_e_y function sets the returned _d_a_t_u_m's _d_p_t_r field + to NULL on failure, setting _e_r_r_n_o, and returns a non-NULL + _d_p_t_r on success. + +NNDDBBMM DDIIAAGGNNOOSSTTIICCSS + The _d_b_m___o_p_e_n function returns NULL on failure, setting + _e_r_r_n_o, and 0 on success. + + The _d_b_m___f_e_t_c_h function sets the returned _d_a_t_u_m's _d_p_t_r + field to NULL on failure, setting _e_r_r_n_o, and returns a + non-NULL _d_p_t_r on success. + + The _d_b_m___s_t_o_r_e function returns -1 on failure, setting + _e_r_r_n_o, 0 on success, and 1 if DBM_INSERT was set and the + specified key already existed in the database. + + The _d_b_m___d_e_l_e_t_e function returns -1 on failure, setting + _e_r_r_n_o, and 0 on success. + + The _d_b_m___f_i_r_s_t_k_e_y function sets the returned _d_a_t_u_m's _d_p_t_r + field to NULL on failure, setting _e_r_r_n_o, and returns a + non-NULL _d_p_t_r on success. + + The _d_b_m___n_e_x_t_k_e_y function sets the returned _d_a_t_u_m's _d_p_t_r + field to NULL on failure, setting _e_r_r_n_o, and returns a + non-NULL _d_p_t_r on success. + + The _d_b_m___e_r_r_o_r function returns -1 on failure, setting + _e_r_r_n_o, and 0 on success. + + The _d_b_m___c_l_e_a_r_e_r_r function returns -1 on failure, setting + _e_r_r_n_o, and 0 on success. + + +EERRRROORRSS + The _d_b_m_i_n_i_t function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: dbm_close(3), and dbm_open(3). + + The _f_e_t_c_h function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: dbm_fetch(3). + + The _s_t_o_r_e function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: dbm_store(3). + + The _d_e_l_e_t_e function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: dbm_delete(3). + + The _f_i_r_s_t_k_e_y function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: dbm_firstkey(3). + + The _n_e_x_t_k_e_y function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: dbm_nextkey(3). + + The _d_b_m___o_p_e_n function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: db_open(3), and memset(3). + + The _d_b_m___c_l_o_s_e function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: DB->close(3). + + The _d_b_m___f_e_t_c_h function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: DB->get(3), and memset(3). + + The _d_b_m___s_t_o_r_e function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: DB->put(3), and memset(3). + + The _d_b_m___d_e_l_e_t_e function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: memset(3). + + The _d_b_m___f_i_r_s_t_k_e_y function may fail and return _e_r_r_n_o for + any of the errors specified for the following DB and + library functions: DB->cursor(3), and memset(3). + + The _d_b_m___n_e_x_t_k_e_y function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: DB->cursor(3), and memset(3). + + +SSEEEE AALLSSOO + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/man.text/db_dbt.0 b/mozilla/db/man/man.text/db_dbt.0 new file mode 100644 index 00000000000..ae784b6ccf6 --- /dev/null +++ b/mozilla/db/man/man.text/db_dbt.0 @@ -0,0 +1,204 @@ + + +NNAAMMEE + db_dbt - DB key/data pairs + +SSYYNNOOPPSSIISS + ttyyppeeddeeff ssttrruucctt {{ + vvooiidd **ddaattaa;; + uu__iinntt3322__tt ssiizzee;; + uu__iinntt3322__tt uulleenn;; + uu__iinntt3322__tt ddlleenn;; + uu__iinntt3322__tt ddooffff;; + uu__iinntt3322__tt ffllaaggss;; + }} DDBBTT;; + +KKEEYY//DDAATTAA PPAAIIRRSS + Storage and retrieval for the DB access methods are based + on key/data pairs. Both key and data items are repre- + sented by the DBT data structure. + + Key and data byte strings may reference strings of essen- + tially unlimited length, although any two keys must fit + into available memory at the same time so that they may be + compared, and any one data item must fit into available + memory so that it may be returned. + + In order to ensure compatibility with future releases of + DB, all fields of the DBT structure that are not explic- + itly set should be initialized to 0 before the first time + the structure is used. Do this by declaring the structure + external or static, or by calling the C library routine + _b_z_e_r_o(3) or _m_e_m_s_e_t(3). + + By default, the _f_l_a_g_s structure element is expected to be + 0. In this default case, when being provided a key or + data item by the application, the DB package expects the + _d_a_t_a structure element to point to a byte string of _s_i_z_e + bytes. When returning a key/data item to the application, + the DB package will store into the _d_a_t_a structure element + a pointer to a byte string of _s_i_z_e bytes. BByy ddeeffaauulltt,, tthhee + mmeemmoorryy rreeffeerreenncceedd bbyy tthhiiss ssttoorreedd ppooiinntteerr iiss oonnllyy vvaalliidd + uunnttiill tthhee nneexxtt ccaallll ttoo tthhee DDBB ppaacckkaaggee uussiinngg tthhee DDBB hhaannddllee + rreettuurrnneedd bbyy _d_b___o_p_e_n. + + TThhee aacccceessss mmeetthhooddss pprroovviiddee nnoo gguuaarraanntteeeess aabboouutt bbyyttee ssttrriinngg + aalliiggnnmmeenntt,, aanndd aapppplliiccaattiioonnss aarree rreessppoonnssiibbllee ffoorr mmaaiinnttaaiinn-- + iinngg aannyy nneecceessssaarryy aalliiggnnmmeenntt.. Use the DB_DBT_USERMEM flag + to cause returned items to be placed in memory of arbi- + trary alignment. + + The elements of the DBT structure are defined as follows: + + void *data; + A pointer to a byte string. + + u_int32_t size; + The length of _d_a_t_a, in bytes. + + u_int32_t ulen; + The size of the user's buffer (referenced by _d_a_t_a), + in bytes. This location is not written by the DB + functions. See the DB_DBT_USERMEM flag for more + information. + + u_int32_t dlen; + The length of the partial record being read or writ- + ten by the application, in bytes. See the + DB_DBT_PARTIAL flag for more information. + + u_int32_t doff; + The offset of the partial record being read or writ- + ten by the application, in bytes. See the + DB_DBT_PARTIAL flag for more information. + + u_int32_t flags; + The flags value is specified by oorr'ing together one + or more of the following values: + + DB_DBT_MALLOC + Ignored except when retrieving information from + a database, e.g., a _D_B_-_>_g_e_t or _D_B_c_u_r_s_o_r_-_>_c___g_e_t + call. This flag causes DB to allocate memory + for the returned key or data item (using _m_a_l_- + _l_o_c(3), or the user-specified malloc function) + and return a pointer to it in the _d_a_t_a field of + the key or data DBT structure. The allocated + memory becomes the responsibility of the calling + application. It is an error to specify both + DB_DBT_MALLOC and DB_DBT_USERMEM. + + DB_DBT_USERMEM + Ignored except when retrieving information from + a database, e.g., a _D_B_-_>_g_e_t or _D_B_c_u_r_s_o_r_-_>_c___g_e_t + call. The _d_a_t_a field of the key or data struc- + ture must reference memory that is at least _u_l_e_n + bytes in length. If the length of the requested + item is less than or equal to that number of + bytes, the item is copied into the memory refer- + enced by the _d_a_t_a field. Otherwise, an error is + returned, the _s_i_z_e field is set to the length + needed for the requested item, and the _e_r_r_n_o + variable is set to ENOMEM. It is an error to + specify both DB_DBT_MALLOC and DB_DBT_USERMEM. + + DB_DBT_PARTIAL + Ignored except when specified for a data parame- + ter, where this flag causes the partial + retrieval or storage of an item. If the calling + application is doing a get, the _d_l_e_n bytes + starting _d_o_f_f bytes from the beginning of the + retrieved data record are returned as if they + comprised the entire record. If any or all of + the specified bytes do not exist in the record, + the get is successful and the existing bytes or + 0 bytes are returned. + + For example, if the data portion of a retrieved + record was 100 bytes, and a partial retrieval + was done using a DBT having a _d_l_e_n field of 20 + and a _d_o_f_f field of 85, the get call would suc- + ceed, the _d_a_t_a field would reference the last 15 + bytes of the record, and the _s_i_z_e field would be + set to 15. + + If the calling application is doing a put, the + _d_l_e_n bytes starting _d_o_f_f bytes from the begin- + ning of the specified key's data record are + replaced by the data specified by the _d_a_t_a and + _s_i_z_e structure elements. If _d_l_e_n is smaller + than _s_i_z_e, the record will grow, and if _d_l_e_n is + larger than _s_i_z_e, the record will shrink. If + the specified bytes do not exist, the record + will be extended using nul bytes as necessary, + and the put call will succeed. + + It is an error to attempt a partial put using + the _D_B_-_>_p_u_t function in a database that supports + duplicate records. Partial puts in databases + supporting duplicate records must be done using + a _d_b___c_u_r_s_o_r(3) function. It is an error to + attempt a partial put with differing _d_l_e_n and + _s_i_z_e values in a recno database with fixed- + length records. + + For example, if the data portion of a retrieved + record was 100 bytes, and a partial put was done + using a DBT having a _d_l_e_n field of 20, a _d_o_f_f + field of 85, and a _s_i_z_e field of 30, the result- + ing record would be 115 bytes in length, where + the last 30 bytes would be those specified by + the put call. + + The default algorithm of associating returned key or data + items with the DB handle returned by _d_b___o_p_e_n(3) will obvi- + ously not work when DB handles are being used concurrently + by multiple threads within a process, i.e, when DB_THREAD + was specified to _d_b___o_p_e_n(3). WWhheenn mmuullttiippllee tthhrreeaaddss aarree + uussiinngg tthhee rreettuurrnneedd DDBB hhaannddllee ccoonnccuurrrreennttllyy,, eeiitthheerr tthhee + DDBB__DDBBTT__MMAALLLLOOCC oorr DDBB__DDBBTT__UUSSEERRMMEEMM ffllaaggss mmuusstt bbee ssppeecciiffiieedd + ffoorr aannyy DDBBTT uusseedd ffoorr kkeeyy oorr ddaattaa rreettrriieevvaall.. + +LLOOGGIICCAALL RREECCOORRDD NNUUMMBBEERRSS + In all cases for the recno access method, and when calling + the _d_b_-_>_g_e_t and _c_u_r_s_o_r_-_>_c___g_e_t functions with the + DB_SET_RECNO flag specified, the _d_a_t_a field of the key + must be a pointer to a memory location of type _d_b___r_e_c_n_o___t, + as typedef'd in the include file. This type is a + 32-bit unsigned type, (which limits the number of logical + records in a recno database, and the maximum logical + record which may be directly retrieved from a btree + database, to 4,294,967,296). The _s_i_z_e field of the key + should be the size of that type, e.g., in the C program- + ming language, ``sizeof(db_recno_t)''. + + Logical record numbers are 1-based, not 0-based, i.e., the + first record in the database is record number 1. + +BBUUGGSS + The DB access methods provide no guarantees about byte + string alignment, and applications are responsible for + maintaining any necessary alignment. + + The name DBT is a mnemonic for ``data base thang'', and + was used because noone could think of a reasonable name + that wasn't already in use somewhere else. + +SSEEEE AALLSSOO + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/man.text/db_deadlock.0 b/mozilla/db/man/man.text/db_deadlock.0 new file mode 100644 index 00000000000..212cef941b1 --- /dev/null +++ b/mozilla/db/man/man.text/db_deadlock.0 @@ -0,0 +1,81 @@ + + +NNAAMMEE + db_deadlock - the DB database deadlock detector + +SSYYNNOOPPSSIISS + ddbb__ddeeaaddlloocckk [--vvww] [--aa mm || oo || yy] [--hh hhoommee] [--LL ffiillee ] [--tt sseecc ] + +DDEESSCCRRIIPPTTIIOONN + The _d_b___d_e_a_d_l_o_c_k utility traverses the database lock struc- + tures and aborts a transaction each time it detects a + deadlock. This utility should be run as a background dae- + mon whenever multiple threads or processes are using lock- + ing. By default, a random transaction involved in the + deadlock is aborted. + + The options are as follows: + + --aa When a deadlock is detected, abort the oldest (``o'') + transaction, the youngest (``y'') transaction, or the + transaction with the minimum number of locks (``m''). + + --hh Specify a home directory for the database. + + --LL Log the execution of the db_deadlock utility to the + specified file in the following format, where ``###'' + is the process ID, and the date is the time the util- + ity starting running. + + db_deadlock: ### Wed Jun 15 01:23:45 EDT 1995 + + This file will be removed if the db_deadlock utility + exits gracefully. + + --tt Initiate a pass over the database locks at least + every _s_e_c seconds. + + --vv Run in verbose mode, generating messages each time + the detector runs. + + --ww Make a single pass over the database locks every time + a process is forced to wait for a lock. + + At least one of the --tt and --ww options must be specified. + + The _d_b___d_e_a_d_l_o_c_k utility attaches to DB shared memory + regions. In order to avoid region corruption, it should + always be given the chance to detach and exit gracefully. + To cause _d_b___d_e_a_d_l_o_c_k to clean up after itself and exit, + send it an interrupt signal (SIGINT). + + The _d_b___d_e_a_d_l_o_c_k utility exits 0 on success, and >0 if an + error occurs. + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _d_b___d_e_a_d_l_o_c_k: + + DB_HOME + If the --hh option is not specified and the environment + variable _D_B___H_O_M_E is set, it is used as the path of + the database home, as described in _d_b___a_p_p_i_n_i_t(3). + +SSEEEE AALLSSOO + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/man.text/db_dump.0 b/mozilla/db/man/man.text/db_dump.0 new file mode 100644 index 00000000000..56e1061ccd3 --- /dev/null +++ b/mozilla/db/man/man.text/db_dump.0 @@ -0,0 +1,149 @@ + + +NNAAMMEE + db_dump - the DB database dump utility + +SSYYNNOOPPSSIISS + ddbb__dduummpp [--dd] [--ff oouuttppuutt] db_file + ddbb__dduummpp [--pp] [--ff oouuttppuutt] [--hh hhoommee] db_file + ddbb__dduummpp118855 [--pp] [--ff oouuttppuutt] db_file + +DDEESSCCRRIIPPTTIIOONN + The _d_b___d_u_m_p utility reads the database file _d_b___f_i_l_e and + writes it to the standard output using a portable flat- + text format understood by the _d_b___l_o_a_d(1) utility. The + argument _d_b___f_i_l_e must be a file produced using the _D_B + library functions. + + The _d_b___d_u_m_p_1_8_5 utility is similar to the _d_b___d_u_m_p utility + except that it reads databases in the format used by DB + versions 1.85 and 1.86. + + The options are as follows: + + --dd Dump the specified database in a format helpful for + debugging the DB library routines. TThhee oouuttppuutt ffoorrmmaatt + ooff tthhee --dd ooppttiioonn iiss nnoott ssttaannddaarrdd aanndd mmaayy cchhaannggee,, + wwiitthhoouutt nnoottiiccee,, bbeettwweeeenn rreelleeaasseess ooff tthhee DDBB lliibbrraarryy.. + + --ff Write to the specified _f_i_l_e instead of to the stan- + dard output. + + --hh Specify a home directory for the database. As DB + versions before 2.0 did not support the concept of a + database ``home'', _d_b___d_u_m_p_1_8_5 does not support this + option. + + --pp If characters in either the key or data items are + printing characters (as defined by _i_s_p_r_i_n_t(3)), use + printing characters in _f_i_l_e to represent them. This + option permits users to use standard text editors to + modify the contents of databases. + + Note, different systems may have different notions as + to what characters are ``printing'', and databases + dumped in this manner may be less portable to exter- + nal systems. + + Dumping and reloading hash databases that use user-defined + hash functions will result in new databases that use the + default hash function. While using the default hash func- + tion may not be optimal for the new database, it will con- + tinue to work correctly. + + Dumping and reloading btree databases that use user- + defined prefix or comparison functions will result in new + databases that use the default prefix and comparison func- + tions. IInn tthhiiss ccaassee,, iitt iiss qquuiittee lliikkeellyy tthhaatt tthhee ddaattaabbaassee + wwiillll bbee ddaammaaggeedd bbeeyyoonndd rreeppaaiirr ppeerrmmiittttiinngg nneeiitthheerr rreeccoorrdd + ssttoorraaggee oorr rreettrriieevvaall.. + + + The only available workaround for either case is to modify + the sources for the _d_b___l_o_a_d(1) utility to load the + database using the correct hash, prefix and comparison + functions. + + The _d_b___d_u_m_p_1_8_5 utility may not be available on your system + as it is not always installed when the DB libraries and + utilities are installed. If you are unable to find it, + see your system administrator for further information. + + The _d_b___d_u_m_p utility exits 0 on success, and >0 if an error + occurs. The _d_b___d_u_m_p_1_8_5 utility exits 0 on success, and >0 + if an error occurs. + +OOUUTTPPUUTT FFOORRMMAATTSS + There are two output formats used by _d_b___d_u_m_p and + _d_b___d_u_m_p_1_8_5. + + In both output formats, the first few lines of the output + contain header information describing the underlying + access method, filesystem page size and other bookkeeping + information. This information is output in ``name=value'' + pairs, where ``name'' may be any of the keywords listed in + the _d_b___l_o_a_d(1) manual page, and ``value'' will be its + value. While this header information can be edited before + the database is reloaded, there is rarely any reason to do + so, as all of this information can be overridden by com- + mand-line arguments to _d_b___l_o_a_d. + + Following the header information are the key/data pairs + from the database. If the database being dumped is of + type bbttrreeee or hhaasshh, the output will be paired lines of + text, where the first line of the pair is the key item, + and the second line of the pair is its corresponding data + item. If the database being dumped is of type rreeccnnoo, the + output will be lines of text, where each line is a new + data item for the database. + + If the --pp option was specified, each output line will con- + sist of single characters representing any characters from + the database that were ``printing'', and backslash (``\'') + escaped characters for any that were not. Backslash char- + acters appearing in the output mean one of two things: if + the backslash character precedes another backslash charac- + ter, it means that a literal backslash character occurred + in the key or data item. If the backslash character pre- + cedes any other character, the next two characters should + be interpreted as hexadecimal specification of a single + character, e.g., ``\0a'' is a newline character in the + ASCII character set. + + If the --pp option was not specified, each output line will + consist of paired hexadecimal values, e.g., the line + ``726f6f74'' is the string ``root'' in the ASCII character + set. + + In both output formats, a single newline character ends + both the key and data items. + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _d_b___d_u_m_p: + + DB_HOME + If the --hh option is not specified and the environment + variable _D_B___H_O_M_E is set, it is used as the path of + the database home, as described in _d_b___a_p_p_i_n_i_t(3). + +SSEEEE AALLSSOO + _i_s_p_r_i_n_t(3) + + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/man.text/db_hsearch.0 b/mozilla/db/man/man.text/db_hsearch.0 new file mode 100644 index 00000000000..fb65a9a1757 --- /dev/null +++ b/mozilla/db/man/man.text/db_hsearch.0 @@ -0,0 +1,119 @@ + + +NNAAMMEE + hsearch - hsearch, hcreate, hdestroy + +SSYYNNOOPPSSIISS + ##ddeeffiinnee DDBB__DDBBMM__HHSSEEAARRCCHH 11 + ##iinncclluuddee <> + + ttyyppeeddeeff eennuumm {{ + FFIINNDD,, EENNTTEERR + }} AACCTTIIOONN;; + + ttyyppeeddeeff ssttrruucctt eennttrryy {{ + cchhaarr **kkeeyy;; + vvooiidd **ddaattaa;; + }} EENNTTRRYY;; + + EENNTTRRYY ** + hhsseeaarrcchh((EENNTTRRYY iitteemm,, AACCTTIIOONN aaccttiioonn));; + + iinntt + hhccrreeaattee((ssiizzee__tt nneelleemm));; + + vvooiidd + hhddeessttrrooyy((vvooiidd));; + +DDEESSCCRRIIPPTTIIOONN + The _h_s_e_a_r_c_h interface to the DB library is intended to + provide source code compatibility for historic applica- + tions. It is not recommended for any other purpose. + + To compile _h_s_e_a_r_c_h applications, replace the application's + _#_i_n_c_l_u_d_e of the hsearch include file (e.g., ``#include + '') with the following two lines: + + #define DB_DBM_HSEARCH 1 + #include + + and recompile. + + The _h_c_r_e_a_t_e function creates an in-memory database. The + _n_e_l_e_m argument is an estimation of the maximum number of + key/data pairs that will be stored in the database. + + The _h_d_e_s_t_r_o_y function discards the database. + + Database elements are structures of type _E_N_T_R_Y, which con- + tain at least two fields: _k_e_y and _d_a_t_a. The field _k_e_y is + declared to be of type ``char *'' and is the key used for + storage and retrieval. The field _d_a_t_a is declared to be + of type ``void *'' and is its associated data. + + The _h_s_e_a_r_c_h function retrieves key/data pairs from, and + stores key/data pairs into, the database. + + The _a_c_t_i_o_n argument must be set to one of two values: + + ENTER + If the key does not already appear in the database, + insert the key/data pair into the database. If the + key already appears in the database, return a refer- + ence to an _E_N_T_R_Y structure referencing the existing + key and its associated data element. + + FIND Retrieve the specified key/data pair from the + database. + + +CCOOMMPPAATTIIBBIILLIITTYY NNOOTTEESS + Historically, _h_s_e_a_r_c_h required applications to maintain + the keys and data in the application's memory for as long + as the _h_s_e_a_r_c_h database existed. As DB handles key and + data management internally, there is no requirement that + applications maintain local copies of key and data items, + although the only effect of doing so should be the alloca- + tion of additional memory. + +DDIIAAGGNNOOSSTTIICCSS + The _h_c_r_e_a_t_e function returns 0 on failure, setting _e_r_r_n_o, + and non-zero on success. + + The _h_s_e_a_r_c_h function returns a pointer to an ENTRY struc- + ture on success, and NULL, setting _e_r_r_n_o, if the _a_c_t_i_o_n + specified was FIND and the item did not appear in the + database. + +EERRRROORRSS + The _h_c_r_e_a_t_e function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: db_open(3), and memset(3). + + The _h_s_e_a_r_c_h function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: DB->get(3), DB->put(3), memset(3), and + strlen(3). + + In addition, the _h_s_e_a_r_c_h function will fail, setting _e_r_r_n_o + to 0, if the _a_c_t_i_o_n specified was FIND and the item did + not appear in the database. + +SSEEEE AALLSSOO + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/man.text/db_internal.0 b/mozilla/db/man/man.text/db_internal.0 new file mode 100644 index 00000000000..1baa6e90647 --- /dev/null +++ b/mozilla/db/man/man.text/db_internal.0 @@ -0,0 +1,436 @@ + + +NNAAMMEE + db_jump_set, db_value_set - replace underlying DB func- + tionality + +SSYYNNOOPPSSIISS + ##iinncclluuddee <> + + iinntt + ddbb__jjuummpp__sseett((vvooiidd **ffuunncc,, iinntt wwhhiicchh));; + + iinntt + ddbb__vvaalluuee__sseett((iinntt vvaalluuee,, iinntt wwhhiicchh));; + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + This manual page describes interfaces to tune or replace + underlying system functionality used by the DB library. + Few applications should have any need for these inter- + faces. + + _d_b___j_u_m_p___s_e_t + The _d_b___j_u_m_p___s_e_t function enables applications to replace + underlying DB library functionality by replacing entries + in a function call jump table. The _w_h_i_c_h argument speci- + fies the entry to be replaced by the argument _f_u_n_c. + + The following values of _w_h_i_c_h are supported: + + DB_FUNC_CLOSE + Replace all DB calls to the IEEE Std 1003.1b-1993 + (``POSIX'') _c_l_o_s_e function with _f_u_n_c, which must con- + form to the standard interface. + + DB_FUNC_DIRFREE + The DB library requires the ability to return any + memory allocated as part of the routine which reads + through a directory and creates a list of files that + that the directory contains (see DB_FUNC_DIRLIST). + The _f_u_n_c argument must conform to the following + interface: + + int dirfree(char **namesp, int cnt); + + The _n_a_m_e_s_p and _c_n_t arguments are the same values as + were returned by the DB_FUNC_DIRLIST function. + + The _d_i_r_f_r_e_e function returns the value of _e_r_r_n_o on + failure and 0 on success. + + DB_FUNC_DIRLIST + The DB library requires the ability to read through a + directory and create a list of files that that the + directory contains. The _f_u_n_c argument must conform + to the following interface: + + int dirlist(const char *dir, + char ***namesp, int *cntp); + + The _d_i_r argument is the name of the directory to be + searched. The function must return a pointer to an + array of nul-terminated file names in the memory + location referenced by the argument _n_a_m_e_s_p, and a + count of the number of elements in the array in the + memory location referenced by _c_n_t_p. + + The _d_i_r_l_i_s_t function returns the value of _e_r_r_n_o on + failure and 0 on success. + + DB_FUNC_EXISTS + The DB library requires the ability to determine if a + file exists, and optionally, if it is a file of type + directory. The _f_u_n_c argument must conform to the + following interface: + + int exists(const char *path, int *isdirp); + + The _p_a_t_h argument is the pathname of the file to be + checked. + + If the _i_s_d_i_r_p argument is non-NULL, it must be set to + non-0 if _p_a_t_h is a directory, and 0 if _p_a_t_h is not a + directory. + + The _e_x_i_s_t_s function returns the value of _e_r_r_n_o on + failure and 0 on success. + + DB_FUNC_FREE + Replace all DB calls to the ANSI C X3.159-1989 + (``ANSI C'') standard _f_r_e_e function with _f_u_n_c, which + must conform to the standard interface. + + DB_FUNC_FSYNC + Replace all DB calls to the IEEE Std 1003.1b-1993 + (``POSIX'') _f_s_y_n_c function with _f_u_n_c, which must con- + form to the standard interface. + + DB_FUNC_IOINFO + The DB library requires the ability to determine the + size and I/O characteristics of a file. The _f_u_n_c + argument must conform to the following interface: + + int ioinfo(const char *path, int fd, + u_int32_t *mbytesp, u_int32_t *bytesp, + u_int32_t *iosizep); + + The _p_a_t_h argument is the pathname of the file to be + checked, and the _f_d argument is an open file descrip- + tor on the file. + + If the _m_b_y_t_e_s_p and _b_y_t_e_s_p arguments are non-NULL, the + _i_o_i_n_f_o function must return in them the size of the + file: the number of megabytes in the file into the + memory location referenced by the _m_b_y_t_e_s_p argument, + and the number of bytes over and above that number of + megabytes into the memory location referenced by the + _b_y_t_e_s_p argument. + + In addition, if the _i_o_s_i_z_e_p argument is non-NULL, the + _i_o_i_n_f_o function must return the optimum granularity + for I/O operations to the file in the memory location + referenced by it. + + The _i_o_i_n_f_o function returns the value of _e_r_r_n_o on + failure and 0 on success. + + DB_FUNC_MALLOC + Replace all DB calls to the ANSI C X3.159-1989 + (``ANSI C'') standard _m_a_l_l_o_c function with _f_u_n_c, + which must conform to the standard interface. + + DB_FUNC_MAP + The DB library requires the ability to map a file + into memory and to create shared memory regions + (which may or may not be backed by files). The _f_u_n_c + argument must conform to the following interface: + + int map(char *path, int fd, size_t len, + int is_region, int is_anonymous, int is_rdonly, + void **addr); + + The _p_a_t_h argument is the name of a file. The _f_d + argument is an open file descriptor on that file. + + The _i_s___r_e_g_i_o_n argument will be zero if the intention + is to map a file into shared memory. In this case, + the _m_a_p function must map the first _l_e_n bytes of the + file into memory and return a pointer to the mapped + location in the memory location referenced by the + argument _a_d_d_r. In this case, the _i_s___a_n_o_n_y_m_o_u_s argu- + ment will always be zero. The _i_s___r_d_o_n_l_y argument + will be non-zero if the file is considered read-only + by the caller. + + The _i_s___r_e_g_i_o_n argument will be non-zero if the memory + is intended to be used as a shared memory region for + synchronization between DB threads/processes. In + this case, the returned memory may be of any kind + (e.g., anonymous), but must be able to support + semaphores. If the application has previously speci- + fied that regions are to be instantiated in anonymous + memory (see DB_REGION_ANON below), or the region is + being joined and is believed to have been allocated + in anonymous shared memory, the _i_s___a_n_o_n_y_m_o_u_s argument + will be non-zero. Additionally, the _p_a_t_h and _f_d + arguments may be ignored (although future _m_a_p calls + using the same _p_a_t_h must return the same memory), and + the _i_s___r_d_o_n_l_y argument will always be zero. + + By default, on UNIX systems, the DB library will use + the IEEE Std 1003.1b-1993 (``POSIX'') _m_m_a_p(2) inter- + face to both map regular files into shared memory and + create shared memory regions. If the application + specifies that shared memory regions be instantiated + in anonymous memory (see DB_REGION_ANON below), the + _s_h_m_g_e_t(2) shared memory segment interface will be + used, where available, and the MAP_ANON or MAP_ANONY- + MOUS options to _m_m_a_p(2) when _s_h_m_g_e_t(2) is not avail- + able. + + When using _s_h_m_g_e_t(2), shared memory regions are + named, and so multiple processes may share them. + When using the _m_m_a_p MAP_ANON or MAP_ANONYMOUS + options, shared memory regions are nnoott named, and so + may only be accessed by a single process and its + threads. + + + HP/UX note: + The _s_h_m_g_e_t(2) interfaces are not used on HP/UX, + even though they exist, as anonymous memory + allocated using _s_h_m_g_e_t(2) cannot be used to + store semaphores. + + The _m_a_p function returns the value of _e_r_r_n_o on failure and + 0 on success. + + DB_FUNC_OPEN + Replace all DB calls to the IEEE Std 1003.1b-1993 + (``POSIX'') _o_p_e_n function with _f_u_n_c, which must con- + form to the standard interface. + + DB_FUNC_READ + Replace all DB calls to the IEEE Std 1003.1b-1993 + (``POSIX'') _r_e_a_d function with _f_u_n_c, which must con- + form to the standard interface. + + DB_FUNC_REALLOC + Replace all DB calls to the ANSI C X3.159-1989 + (``ANSI C'') standard _r_e_a_l_l_o_c function with _f_u_n_c, + which must conform to the standard interface. + + DB_FUNC_RUNLINK + The DB library requires the ability to remove shared + memory regions from the system, whether or not they + are backed by regular files. The _f_u_n_c argument must + conform to the following interface: + + int runlink(char *path); + + The _p_a_t_h argument is the path argument specified to + the DB_FUNC_MAP function when the region was mapped + into memory. + + The _r_u_n_l_i_n_k function returns the value of _e_r_r_n_o on + failure and 0 on success. + + DB_FUNC_SEEK + The DB library requires the ability to specify that a + subsequent read from or write to a file will occur at + a specific location in that file. The _f_u_n_c argument + must conform to the following interface: + + int seek(int fd, size_t pgsize, db_pgno_t pageno, + u_int32_t relative, int rewind, int whence); + + The _f_d argument is an open file descriptor on the + file. The _s_e_e_k function must cause a subsequent read + from or write to the file to occur at a byte offset + specified by the calculation: + + (pgsize * pageno) + relative + + If _r_e_w_i_n_d is non-zero, the byte offset is treated as + a backwards seek, not a forwards one. + + The _w_h_e_n_c_e argument specifies where in the file the + byte offset is relative to, as described by the IEEE + Std 1003.1b-1993 (``POSIX'') _l_s_e_e_k system call. + + The _s_e_e_k function returns the value of _e_r_r_n_o on fail- + ure and 0 on success. + + DB_FUNC_SLEEP + The DB library requires the ability to cause a pro- + cess to suspend itself for a period of time, relin- + quishing control of the processor to any other wait- + ing thread of control. The _f_u_n_c argument must con- + form to the following interface: + + int sleep(u_long seconds, u_long microseconds); + + The _s_e_c_o_n_d_s and _m_i_c_r_o_s_e_c_o_n_d_s arguments specify the + amount of time to wait until the suspending thread of + control should run again. + + The _s_e_c_o_n_d_s and _m_i_c_r_o_s_e_c_o_n_d_s arguments may not be + normalized when the _s_l_e_e_p function is called, i.e., + the _m_i_c_r_o_s_e_c_o_n_d_s argument may be greater than + 1000000. + + The _s_l_e_e_p function returns the value of _e_r_r_n_o on + failure and 0 on success. + + DB_FUNC_UNLINK + Replace all DB calls to the IEEE Std 1003.1b-1993 + (``POSIX'') _u_n_l_i_n_k function with _f_u_n_c, which must + conform to the standard interface. + + DB_FUNC_UNMAP + The DB library requires the ability to unmap a file + or shared memory region from memory. The _f_u_n_c argu- + ment must conform to the following interface: + + int unmap(void *addr, size_t len); + + The _a_d_d_r argument is the argument returned by the + DB_FUNC_MAP function when the file or region was + mapped into memory, and the _l_e_n argument is the same + as the _l_e_n argument specified to the DB_FUNC_MAP + function when the file or region was mapped into mem- + ory. + + The _u_n_m_a_p function returns the value of _e_r_r_n_o on + failure and 0 on success. + + DB_FUNC_WRITE + Replace all DB calls to the IEEE Std 1003.1b-1993 + (``POSIX'') _w_r_i_t_e function with _f_u_n_c, which must con- + form to the standard interface. + + DB_FUNC_YIELD + The DB library requires the ability to yield the pro- + cessor from the current thread of control to any + other waiting threads of control. The _f_u_n_c argument + must conform to the following interface: + + int yield(void); + + + The _y_i_e_l_d function must be able to cause the + rescheduling all participants in the current DB envi- + ronment, whether threaded or not. It may be incor- + rect to supply a thread _y_i_e_l_d function if more than a + single process is operating in the DB environment. + This is because many thread-yield functions will not + allow other processes to run, and the contested lock + may be held by another process, not by another + thread. + + If no _y_i_e_l_d function is specified, or if the _y_i_e_l_d + function returns an error, the function specified by + the DB_FUNC_SLEEP entry will be used instead or sub- + sequently, i.e., if no _y_i_e_l_d function is specified, + or it is possible for the _y_i_e_l_d function to fail, the + _s_l_e_e_p function mmuusstt cause the processor to reschedule + any waiting threads of control for execution. + + The _y_i_e_l_d function returns the value of _e_r_r_n_o on + failure and 0 on success. + + The _d_b___j_u_m_p___s_e_t function returns the value of _e_r_r_n_o on + failure and 0 on success. + + _d_b___v_a_l_u_e___s_e_t + The _d_b___v_a_l_u_e___s_e_t function enables applications to specify + underlying DB library functionality. The _w_h_i_c_h argument + specifies the information being set by the argument _v_a_l_u_e. + + The following values of _w_h_i_c_h are supported: + + DB_MUTEXLOCKS + Grant all requested mutual exclusion mutexes without + testing for their availability. This flag should + never be used for any other purpose than debugging. + + DB_REGION_ANON + Setting _v_a_l_u_e to a non-zero value specifies that + shared memory regions are to be created in anonymous + memory, and not backed by a regular file. + DB_REGION_NAME differs from DB_REGION_ANON in that + the former will fail if the shared memory regions + cannot be named, that is, if multiple processes can- + not use them. See DB_FUNC_MAP for more information. + + DB_REGION_INIT + In some applications, the expense of page-faulting + the shared memory regions can affect performance, + e.g., when the page-fault occurs while holding a + lock, other lock requests can convoy and overall + throughput may decrease. Setting _v_a_l_u_e to a non-zero + value specifies that one byte be read from each 4K + page of the shared memory region when the region is + initialized. + + DB_REGION_NAME + Setting _v_a_l_u_e to a non-zero value specifies that + shared memory regions are to be created in anonymous + memory, and not backed by a regular file. + DB_REGION_NAME differs from DB_REGION_ANON in that + the former will fail if the shared memory regions + cannot be named, that is, if multiple processes + cannot use them. See DB_FUNC_MAP for more informa- + tion. + + DB_TSL_SPINS + Specify the number of times mutexes should spin with- + out blocking. + + This value defaults to 1 on uniprocessor systems and + to 50 times the number of processors on multiproces- + sor systems. + + The _d_b___v_a_l_u_e___s_e_t function returns the value of _e_r_r_n_o on + failure and 0 on success. + +EERRRROORRSS + The _d_b___j_u_m_p___s_e_t function may fail and return _e_r_r_n_o for the + following conditions: + + [EINVAL] + An invalid flag value or parameter was specified. + +BBUUGGSS + No type checking is done of the _f_u_n_c argument, and speci- + fying an invalid replacement routine will cause unpre- + dictable results. + + Applications should be careful to replace related func- + tions as a group and at the same time. Replacing + DB_FUNC_MALLOC without replacing DB_FUNC_REALLOC is likely + to result in unpredictable results. + + On Windows/95, files that are opened by multiple processes + do not share data correctly. To tell Berkeley DB to use a + named region of the paging file to share memory instead, + use: + + db_value_set(1, DB_REGION_NAME); + + You do not need to do this if your application can guaran- + tee that only one process will be accessing DB files. + + On Windows/NT, sharing of data between processes through + the paging file does not work correctly, so you should not + call _d_b___v_a_l_u_e___s_e_t. That will allow DB to use the file + itself for sharing, which works correctly. + +SSEEEE AALLSSOO + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/man.text/db_intro.0 b/mozilla/db/man/man.text/db_intro.0 new file mode 100644 index 00000000000..c7423610387 --- /dev/null +++ b/mozilla/db/man/man.text/db_intro.0 @@ -0,0 +1,494 @@ + + +NNAAMMEE + db - the DB library overview and introduction + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + The DB library does not provide user interfaces, data + entry GUI's, SQL support or any of the other standard + user-level database interfaces. What it does provide are + the programmatic building blocks that allow you to easily + embed database-style functionality and support into other + objects or interfaces. + +AARRCCHHIITTEECCTTUURREE + The DB library supports two different models of applica- + tions: client-server and embedded. + + In the client-server model, a database server is created + by writing an application that accepts requests via some + form of IPC and issues calls to the DB functions based on + those queries. In this model, applications are client + programs that attach to the server and issue queries. The + client-server model trades performance for protection, as + it does not require that the applications share a protec- + tion domain with the server, but IPC/RPC is generally + slower than a function call. In addition, this model sim- + plifies the creation of network client-server applica- + tions. + + In the embedded model, an application links the DB library + directly into its address space. This provides for faster + access to database functionality, but means that the + applications sharing log files, lock manager, transaction + manager or memory pool manager have the ability to read, + write, and corrupt each other's data. + + It is the application designer's responsibility to select + the appropriate model for their application. + + Applications require a single include file, _<_d_b_._h_>, which + must be installed in an appropriate location on the sys- + tem. + +CC++++ + The C++ classes provide a thin wrapper around the C API, + with the major advantages being improved encapsulation and + an optional exception mechanism for errors. + + + The classes and methods are named in a fashion that + directly corresponds to structures and functions in the C + interface. Likewise, arguments to methods appear in the + same order as the C interface, except to remove the + explicit ``this'' pointer. The #defines used for flags + are identical between the C and C++ interfaces. + + As a rule, each C++ object has exactly one structure from + the underlying C API associated with it. The C structure + is allocated with each constructor call and deallocated + with each destructor call. Thus, the rules the user needs + to follow in allocating and deallocating structures are + the same between the C and C++ interfaces. + + 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, by using _D_b_E_n_v_:_:_s_e_t___e_r_r_o_r___m_o_d_e_l() (see + _D_b_E_n_v(3)). For a discussion of the exception mechanism, + see _D_b_E_x_c_e_p_t_i_o_n(3). + + For the rest of this manual page, C interfaces are listed + as the primary reference, and C++ interfaces following + parenthetically, e.g., _d_b___o_p_e_n (_D_b_:_:_o_p_e_n). + +JJAAVVAA + The Java classes provide a layer around the C API that is + almost identical to the C++ layer. The classes and meth- + ods are, for the most part identical to the C++ layer. Db + constants and #defines are represented as "static final + int" values. Errors conditions appear as Java exceptions. + + As in C++, each Java object has exactly one structure from + the underlying C API associated with it. The Java struc- + ture is allocated with each constructor or open call, but + is deallocated only when the Java GC does so. Because the + timing or ordering of GC is not predictable, the user + should take care to do a close() when finished with any + object that has such a method. + + +SSUUBBSSYYSSTTEEMMSS + The DB library is made up of five major subsystems, as + follows: + + Access methods + The access methods subsystem is made up of general- + purpose support for creating and accessing files for- + matted as B+tree's, hashed files, and fixed and vari- + able length records. These modules are useful in the + absence of transactions for processes that need fast, + formatted file support. See _d_b___o_p_e_n(3) and _d_b___c_u_r_- + _s_o_r(3) (_D_b(3) and _D_b_c(3)) for more information. + + Locking + The locking subsystem is a general-purpose lock man- + ager used by DB. This module is useful in the + absence of the rest of the DB package for processes + that require a fast, configurable lock manager. See + _d_b___l_o_c_k(3) (_D_b_L_o_c_k_T_a_b(3) and _D_b_L_o_c_k(3)) for more + information. + + Logging + The logging subsystem is the logging support used to + support the DB transaction model. It is largely spe- + cific to the DB package, and unlikely to be used + elsewhere. See _d_b___l_o_g(3) (_D_b_L_o_g(3)) for more infor- + mation. + + Memory Pool + The memory pool subsystem is the general-purpose + shared memory buffer pool used by DB. This module is + useful outside of the DB package for processes that + require page-oriented, cached, shared file access. + See _d_b___m_p_o_o_l(3) (_D_b_M_p_o_o_l(3) and _D_b_M_p_o_o_l_F_i_l_e(3)) for + more information. + + Transactions + The transaction subsystem implements the DB transac- + tion model. It is largely specific to the DB pack- + age. See _d_b___t_x_n(3) (_D_b_T_x_n_M_g_r(3) and _D_b_T_x_n(3)) for + more information. + + There are several stand-alone utilities that support the + DB environment. They are as follows: + + db_archive + The _d_b___a_r_c_h_i_v_e utility supports database backup, + archival and log file administration. See + _d_b___a_r_c_h_i_v_e(1) for more information. + + db_recover + The _d_b___r_e_c_o_v_e_r utility runs after an unexpected DB or + system failure to restore the database to a consis- + tent state. See _d_b___r_e_c_o_v_e_r(1) for more information. + + db_checkpoint + The _d_b___c_h_e_c_k_p_o_i_n_t utility runs as a daemon process, + monitoring the database log and periodically issuing + checkpoints. See _d_b___c_h_e_c_k_p_o_i_n_t(1) for more informa- + tion. + + db_deadlock + The _d_b___d_e_a_d_l_o_c_k utility runs as a daemon process, + periodically traversing the database lock structures + and aborting transactions when it detects a deadlock. + See _d_b___d_e_a_d_l_o_c_k(1) for more information. + + db_dump + The _d_b___d_u_m_p utility writes a copy of the database to + a flat-text file in a portable format. See + _d_b___d_u_m_p(1) for more information. + + db_load + The _d_b___l_o_a_d utility reads the flat-text file produced + by _d_b___d_u_m_p, and loads it into a database file. See + _d_b___l_o_a_d(1) for more information. + + db_stat + The _d_b___s_t_a_t utility displays statistics for databases + and database environments. See _d_b___s_t_a_t(1) for more + information. + +NNAAMMIINNGG AANNDD TTHHEE DDBB EENNVVIIRROONNMMEENNTT + The DB application environment is described by the + _d_b___a_p_p_i_n_i_t(3) (_D_b_E_n_v(3)) manual page. The _d_b___a_p_p_i_n_i_t + (_D_b_E_n_v_:_:_a_p_p_i_n_i_t) function is used to create a consistent + naming scheme for all of the subsystems sharing a DB envi- + ronment. If _d_b___a_p_p_i_n_i_t (_D_b_E_n_v_:_:_a_p_p_i_n_i_t) is not called by + a DB application, naming is performed as specified by the + manual page for the specific subsystem. + + DB applications that run with additional privilege should + always call the _d_b___a_p_p_i_n_i_t (_D_b_E_n_v_:_:_a_p_p_i_n_i_t) function to + initialize DB naming for their application. This ensures + that the environment variables DB_HOME and TMPDIR will + only be used if the application explicitly specifies that + they are safe. + +AADDMMIINNIISSTTEERRIINNGG TTHHEE DDBB EENNVVIIRROONNMMEENNTT + A DB environment consists of a database home directory and + all the long-running daemons necessary to ensure continued + functioning of DB and its applications. In the presence + of transactions, the checkpoint daemon, _d_b___c_h_e_c_k_p_o_i_n_t, + must be run as long as there are applications present (see + _d_b___c_h_e_c_k_p_o_i_n_t(1) for details). When locking is being + used, the deadlock detection daemon, _d_b___d_e_a_d_l_o_c_k, must be + run as long as there are applications present (see + _d_b___d_e_a_d_l_o_c_k(1) for details). The _d_b___a_r_c_h_i_v_e utility pro- + vides information to facilitate log reclamation and cre- + ation of database snapshots (see _d_b___a_r_c_h_i_v_e(1) for + details). After application or system failure, the + _d_b___r_e_c_o_v_e_r utility must be run before any applications are + restarted to return the database to a consistent state + (see _d_b___r_e_c_o_v_e_r(1) for details). + + The simplest way to administer a DB application environ- + ment is to create a single ``home'' directory that houses + all the files for the applications that are sharing the DB + environment. In this model, the shared memory regions + (i.e., the locking, logging, memory pool, and transaction + regions) and log files will be stored in the specified + directory hierarchy. In addition, all data files speci- + fied using relative pathnames will be named relative to + this home directory. When recovery needs to be run (e.g., + after system or application failure), this directory is + specified as the home directory to _d_b___r_e_c_o_v_e_r(1), and the + system is restored to a consistent state, ready for the + applications to be restarted. + + In situations where further customization is desired, such + as placing the log files on a separate device, it is rec- + ommended that the application installation process create + a configuration file named ``DB_CONFIG'' in the database + home directory, specifying the customization. See + _d_b___a_p_p_i_n_i_t(3) (_D_b_E_n_v(3)) for details on this procedure. + + The DB architecture does not support placing the shared + memory regions on remote filesystems, e.g., the Network + File System (NFS) and the Andrew File System (AFS). For + this reason, the database home directory must reside on a + local filesystem. Databases, log files and temporary + files may be placed on remote filesystems, although the + application may incur a performance penalty for doing so. + + It is important to realize that all applications sharing a + single home directory implicitly trust each other. They + have access to each other's data as it resides in the + shared memory buffer pool and will share resources such as + buffer space and locks. At the same time, any applica- + tions that access the same files mmuusstt share an environment + if consistency is to be maintained across the different + applications. + +EERRRROORR RREETTUURRNNSS + Except for the historic _d_b_m and _h_s_e_a_r_c_h interfaces (see + _d_b___d_b_m(3) and _d_b___h_s_e_a_r_c_h(3)), DB does not use the global + variable _e_r_r_n_o to return error values. The return values + for all DB functions can be grouped into three categories: + + 0 A return value of 0 indicates that the operation was + successful. + + >0 A return value that is greater than 0 indicates that + there was a system error. The _e_r_r_n_o value returned + by the system is returned by the function, e.g., when + a DB function is unable to allocate memory, the + return value from the function will be ENOMEM. + + <0 A return value that is less than 0 indicates a condi- + tion that was not a system failure, but was not an + unqualified success, either. For example, a routine + to retrieve a key/data pair from the database may + return DB_NOTFOUND when the key/data pair does not + appear in the database, as opposed to the value of 0, + which would be returned if the key/data pair were + found in the database. All such special values + returned by DB functions are less than 0 in order to + avoid conflict with possible values of _e_r_r_n_o. + + There are two special return values that are somewhat sim- + ilar in meaning, are returned in similar situations, and + therefore might be confused: DB_NOTFOUND and DB_KEYEMPTY. + The DB_NOTFOUND error return indicates that the requested + key/data pair did not exist in the database or that start- + or end-of-file has been reached. The DB_KEYEMPTY error + return indicates that the requested key/data pair logi- + cally exists but was never explicitly created by the + application (the recno access method will automatically + create key/data pairs under some circumstances, see + _d_b___o_p_e_n(3) (_D_b(3)) for more information), or that the + requested key/data pair was deleted and is currently in a + deleted state. + +SSIIGGNNAALLSS + When applications using DB receive signals, it is impor- + tant that they exit gracefully, discarding any DB locks + that they may hold. This is normally done by setting a + flag when a signal arrives, and then checking for that + flag periodically within the application. Specifically, + the signal handler should not attempt to release locks + and/or close the database handles itself. This is not + guaranteed to work correctly and the results are unde- + fined. + + If an application exits holding a lock, the situation is + no different than if the application crashed, and all + applications participating in the database environment + must be shutdown, and then recovery must be performed. If + this is not done, the locks that the application held can + cause unresolvable deadlocks inside the database, and + applications may then hang. + +MMUULLTTII--TTHHRREEAADDIINNGG + See _d_b___t_h_r_e_a_d(3) for information on using DB in threaded + applications. + +DDAATTAABBAASSEE AANNDD PPAAGGEE SSIIZZEESS + DB stores database file page numbers as unsigned 32-bit + numbers and database file page sizes as unsigned 16-bit + numbers. This results in a maximum database size of 2^48. + The minimum database page size is 512 bytes, resulting in + a minimum maximum database size of 2^41. + + DB is potentially further limited if the host system does + not have filesystem support for files larger than 2^32, + including seeking to absolute offsets within such files. + + The maximum btree depth is 255. + +BBYYTTEE OORRDDEERRIINNGG + The database files created by DB can be created in either + little or big-endian formats. By default, the native for- + mat of the machine on which the database is created will + be used. Any format database can be used on a machine + with a different native format, although it is possible + that the application will incur a performance penalty for + the run-time conversion. + +EEXXTTEENNDDIINNGG DDBB + DB includes tools to simplify the development of applica- + tion-specific logging and recovery. Specifically, given a + description of the information to be logged, these tools + will automatically create logging functions (functions + that take the values as parameters and construct a single + record that is written to the log), read functions (func- + tions that read a log record and unmarshall the values + into a structure that maps onto the values you chose to + log), a print function (for debugging), templates for the + recovery functions, and automatic dispatching to your + recovery functions. + +EEXXAAMMPPLLEESS + There are a number of examples included with the DB + library distribution, intended to demonstrate various ways + of using the DB library. + + Some applications require the use of formatted files to + store data, but do not require concurrent access and can + cope with the loss of data due to catastrophic failure. + Generally, these applications create short-lived databases + that are discarded or recreated when the system fails. + Such applications need only use the DB access methods. + The DB access methods will use the memory pool subsystem, + but the application is unlikely to do so explicitly. See + the files _e_x_a_m_p_l_e_s_/_e_x___a_c_c_e_s_s_._c, _e_x_a_m_p_l_e_s_/_e_x___b_t_r_e_c_._c, _e_x_a_m_- + _p_l_e_s___c_x_x_/_A_c_c_e_s_s_E_x_a_m_p_l_e_._c_p_p and _j_a_v_a_/_s_r_c_/_c_o_m_/_s_l_e_e_p_y_- + _c_a_t_/_e_x_a_m_p_l_e_s_/_A_c_c_e_s_s_E_x_a_m_p_l_e_._j_a_v_a in the DB source distribu- + tion for C, C++, and Java language code examples of how + such applications might use the DB library. + + Some applications require the use formatted files to store + data, but also need to use _d_b___a_p_p_i_n_i_t(3) + (_D_b_E_n_v_:_:_a_p_p_i_n_i_t(3)) for environment initialization. See + the files _e_x_a_m_p_l_e_s_/_e_x___a_p_p_i_n_i_t_._c, _e_x_a_m_p_l_e_s___c_x_x_/_A_p_p_i_n_i_t_E_x_a_m_- + _p_l_e_._c_p_p or _j_a_v_a_/_s_r_c_/_c_o_m_/_s_l_e_e_p_y_c_a_t_/_e_x_a_m_p_l_e_s_/_A_p_p_i_n_i_t_E_x_a_m_- + _p_l_e_._j_a_v_a in the DB source distribution for C, C++ and Java + language code examples of how such an application might + use the DB library. + + Some applications use the DB access methods, but are also + concerned about catastrophic failure, and therefore need + to transaction protect the underlying DB files. See the + files _e_x_a_m_p_l_e_s_/_e_x___t_p_c_b_._c, _e_x_a_m_p_l_e_s___c_x_x_/_T_p_c_b_E_x_a_m_p_l_e_._c_p_p or + _j_a_v_a_/_s_r_c_/_c_o_m_/_s_l_e_e_p_y_c_a_t_/_e_x_a_m_p_l_e_s_/_T_p_c_b_E_x_a_m_p_l_e_._j_a_v_a in the DB + source distribution for C, C++ and Java language code + examples of how such an application might use the DB + library. + + Some applications will benefit from the ability to buffer + input files other than the underlying DB access method + files. See the files _e_x_a_m_p_l_e_s_/_e_x___m_p_o_o_l_._c or _e_x_a_m_- + _p_l_e_s___c_x_x_/_M_p_o_o_l_E_x_a_m_p_l_e_._c_p_p in the DB source distribution + for C and C++ language code examples of how such an appli- + cation might use the DB library. + + Some applications need a general-purpose lock manager sep- + arate from locking support for the DB access methods. See + the files _e_x_a_m_p_l_e_s_/_e_x___l_o_c_k_._c, _e_x_a_m_p_l_e_s___c_x_x_/_L_o_c_k_E_x_a_m_p_l_e_._c_p_p + or _j_a_v_a_/_s_r_c_/_c_o_m_/_s_l_e_e_p_y_c_a_t_/_e_x_a_m_p_l_e_s_/_L_o_c_k_E_x_a_m_p_l_e_._j_a_v_a in the + DB source distribution for C, C++ and Java language code + examples of how such an application might use the DB + library. + + Some applications will use the DB access methods in a + threaded fashion, including trickle flushing of the under- + lying buffer pool and deadlock detection. See the file + _e_x_a_m_p_l_e_s_/_e_x___t_h_r_e_a_d_._c in the DB source distribution for a C + language code example of how such an application might use + the DB library. Note that the Java API assumes a threaded + environment and performs all thread-specific initializa- + tion automatically. + +CCOOMMPPAATTIIBBIILLIITTYY + The DB 2.0 library provides backward compatible interfaces + for the historic UNIX _d_b_m(3), _n_d_b_m(3) and _h_s_e_a_r_c_h(3) + interfaces. See _d_b___d_b_m(3) and _d_b___h_s_e_a_r_c_h(3) for further + information on these interfaces. It also provides a back- + ward compatible interface for the historic DB 1.85 + release. DDBB 22..00 ddooeess nnoott pprroovviiddee ddaattaabbaassee ccoommppaattiibbiilliittyy + ffoorr aannyy ooff tthhee aabboovvee iinntteerrffaacceess,, aanndd eexxiissttiinngg ddaattaabbaasseess + mmuusstt bbee ccoonnvveerrtteedd mmaannuuaallllyy.. To convert existing databases + from the DB 1.85 format to the DB 2.0 format, review the + _d_b___d_u_m_p_1_8_5(1) and _d_b___l_o_a_d(1) manual pages. + + The name space in DB 2.0 has been changed from that of + previous DB versions, notably version 1.85, for portabil- + ity and consistency reasons. The only name collisions in + the two libraries are the names used by the _d_b_m(3), + _n_d_b_m(3), _h_s_e_a_r_c_h(3) and the DB 1.85 compatibility inter- + faces. To include both DB 1.85 and DB 2.0 in a single + library, remove the _d_b_m(3), _n_d_b_m(3) and _h_s_e_a_r_c_h(3) inter- + faces from either of the two libraries, and the DB 1.85 + compatibility interface from the DB 2.0 library. This can + be done by editing the library Makefiles and reconfiguring + and rebuilding the DB 2.0 library. Obviously, if you use + the historic interfaces, you will get the version in the + library from which you did not remove it. Similarly, you + will not be able to access DB 2.0 files using the DB 1.85 + compatibility interface, since you have removed that from + the library as well. + + It is possible to simply relink applications written to + the DB 1.85 interface against the DB 2.0 library. Recom- + pilation of such applications is slightly more complex. + When the DB 2.0 library is installed, it installs two + include files, _d_b_._h and _d_b___1_8_5_._h. The former file is + likely to replace the DB 1.85 version's include file which + had the same name. If this did not happen, recompiling DB + 1.85 applications to use the DB 2.0 library is simple: + recompile as done historically, and load against the DB + 2.0 library instead of the DB 1.85 library. If, however, + the DB 2.0 installation process has replaced the system's + _d_b_._h include file, replace the application's include of + _d_b_._h with inclusion of _d_b___1_8_5_._h, recompile as done histor- + ically, and then load against the DB 2.0 library. + + Applications written using the historic interfaces of the + DB library should not require significant effort to port + to the DB 2.0 interfaces. While the functionality has + been greatly enhanced in DB 2.0, the historic interface + and functionality and is largely unchanged. Reviewing the + application's calls into the DB library and updating those + calls to the new names, flags and return values should be + sufficient. + + While loading applications that use the DB 1.85 interfaces + against the DB 2.0 library, or converting DB 1.85 function + calls to DB 2.0 function calls will work, reconsidering + your application's interface to the DB database library in + light of the additional functionality in DB 2.0 is recom- + mended, as it is likely to result in enhanced application + performance. + +SSEEEE AALLSSOO:: AADDMMIINNIISSTTRRAATTIIVVEE AANNDD OOTTHHEERR UUTTIILLIITTIIEESS + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1) + +SSEEEE AALLSSOO:: CC AAPPII + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___l_o_c_k(3), _d_b___l_o_g(3), + _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_x_n(3) + +SSEEEE AALLSSOO:: CC++++ aanndd JJaavvaa AAPPII + _D_b(3), _D_b_c(3), _D_b_E_n_v(3), _D_b_E_x_c_e_p_t_i_o_n(3), _D_b_I_n_f_o(3), _D_b_L_o_c_k(3), + _D_b_L_o_c_k_T_a_b(3), _D_b_L_o_g(3), _D_b_L_s_n(3), _D_b_M_p_o_o_l(3), _D_b_M_p_o_o_l_F_i_l_e(3), + _D_b_t(3), _D_b_T_x_n(3), _D_b_T_x_n_M_g_r(3) + +SSEEEE AALLSSOO:: AADDDDIITTIIOONNAALL RREEFFEERREENNCCEESS + _L_I_B_T_P_: _P_o_r_t_a_b_l_e_, _M_o_d_u_l_a_r _T_r_a_n_s_a_c_t_i_o_n_s _f_o_r _U_N_I_X, Margo Seltzer, + Michael Olson, USENIX proceedings, Winter 1992. diff --git a/mozilla/db/man/man.text/db_load.0 b/mozilla/db/man/man.text/db_load.0 new file mode 100644 index 00000000000..864a43b7a1f --- /dev/null +++ b/mozilla/db/man/man.text/db_load.0 @@ -0,0 +1,180 @@ + + +NNAAMMEE + db_load - the DB database loader + +SSYYNNOOPPSSIISS + ddbb__llooaadd [--nnTT] [--cc nnaammee==vvaalluuee] + [--ff ffiillee] [--hh hhoommee] [--tt bbttrreeee || hhaasshh || rreeccnnoo] db_file + +DDEESSCCRRIIPPTTIIOONN + The _d_b___l_o_a_d utility reads from the standard input and + loads it into the database _d_b___f_i_l_e. The database _d_b___f_i_l_e + is created if it does not already exist. + + The input to _d_b___l_o_a_d must be in the output format speci- + fied by the _d_b___d_u_m_p or _d_b___d_u_m_p_1_8_5 utilities (see + _d_b___d_u_m_p(1) for more information), or as specified for the + --TT option below. + + The options are as follows: + + --cc Specify configuration options for the DB_INFO struc- + ture provided to _d_b___o_p_e_n(3), ignoring any value they + may have based on the input. The command-line format + is ``name=value''. Supported keywords are listed + below. + + --ff Read from the specified _i_n_p_u_t file instead of from + the standard input. + + --hh Specify a home directory for the database. + + If a home directory is specified, the database envi- + ronment is opened using the DB_INIT_LOCK, + DB_INIT_LOG, DB_INIT_MPOOL, DB_INIT_TXN and + DB_USE_ENVIRON flags to _d_b___a_p_p_i_n_i_t(3). (This means + that _d_b___l_o_a_d can be used to load data into databases + while they are in use by other processes.) If the + _d_b___a_p_p_i_n_i_t call fails, or if no home directory is + specified, the database is still updated, but the + environment is ignored, e.g., no locking is done. + + --nn Do not overwrite existing keys in the database when + loading into an already existing database. If a + key/data pair cannot be loaded into the database for + this reason, a warning message is displayed on the + standard error output and the key/data pair are + skipped. + + --TT The --TT option allows non-DB applications to easily + load text files into databases. + + If the database to be created is of type bbttrreeee or + hhaasshh, the input must be paired lines of text, where + the first line of the pair is the key item, and the + second line of the pair is its corresponding data + item. If the database to be created is of type + rreeccnnoo, the input must be lines of text, where each + line is a new data item for the database. + + + A simple escape mechanism, where newline and back- + slash (``\'') characters are special, is applied to + the text input. Newline characters are interpreted + as record separators. Backslash characters in the + text will be interpreted in one of two ways: if the + backslash character precedes another backslash char- + acter, the pair will be interpreted as a literal + backslash. If the backslash character precedes any + other character, the two characters following the + backslash will be interpreted as hexadecimal specifi- + cation of a single character, e.g., ``\0a'' is a new- + line character in the ASCII character set. + + For this reason, any backslash or newline characters + that naturally occur in the text input must be + escaped to avoid misinterpretation by _d_b___l_o_a_d. + + If the --TT option is specified, the underlying access + method type must be specified using the --tt option. + + --tt Specify the underlying access method. If no --tt + option is specified, the database will be loaded into + a database of the same type as was dumped, e.g., a + hash database will be created if a hash database was + dumped. + + Btree and hash databases may be converted from one to + the other. Recno databases may not be converted to + any other database type or from any other database + type. + + The _d_b___l_o_a_d utility exits 0 on success, 1 if one or more + key/data pairs were not loaded into the database because + the key already existed, and >1 if an error occurs. + +KKEEYYWWOORRDDSS + The following keywords are supported for the --cc command- + line option. See _d_b___o_p_e_n(3) for further discussion of + these keywords and what values should be specified. + + The parenthetical listing specifies how the value part of + the ``name=value'' pair is interpreted. Items listed as + (boolean) expect value to be ``1'' (set) or ``0'' (unset). + Items listed as (number) convert value to a number. Items + listed as (string) use the characters of value directly. + + bt_minkey (number) + The minimum number of keys per page. + + db_lorder (number) + The byte order for integers in the stored database + metadata. + + + db_pagesize (number) + The size of pages used for nodes in the tree, in + bytes. + + duplicates (boolean) + The value of the DB_DUP flag. + + h_ffactor (number) + The density within the hash table. + + h_nelem (number) + The size of the hash table. + + re_len (number) + Specify fixed-length records of the specified length. + + re_pad (string) + Specify the fixed-length record pad character. + + recnum (boolean) + The value of the DB_RECNUM flag. + + renumber (boolean) + The value of the DB_RENUMBER flag. + +EEXXAAMMPPLLEESS + The _d_b___l_o_a_d utility can be used to load text files into + databases. For example, the following command loads the + standard UNIX _/_e_t_c_/_p_a_s_s_w_d file into a database, with the + login name as the key item and the entire password entry + as the data item: + awk -F: '{print $1; print $0}' < /etc/passwd | + sed 's/\\/\\\\/g' | db_load -T -t hash passwd.db + + Note that backslash characters naturally occurring in the + text are escaped to avoid interpretation as escape charac- + ters by _d_b___l_o_a_d. + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _d_b___l_o_a_d: + + DB_HOME + If the --hh option is not specified and the environment + variable _D_B___H_O_M_E is set, it is used as the path of + the database home, as described in _d_b___a_p_p_i_n_i_t(3). + +SSEEEE AALLSSOO + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/man.text/db_lock.0 b/mozilla/db/man/man.text/db_lock.0 new file mode 100644 index 00000000000..f7351ba0ffb --- /dev/null +++ b/mozilla/db/man/man.text/db_lock.0 @@ -0,0 +1,620 @@ + + +NNAAMMEE + db_lock - lock manager + +SSYYNNOOPPSSIISS + ##iinncclluuddee <> + + iinntt + lloocckk__ooppeenn((ccoonnsstt cchhaarr **ddiirr,, + uu__iinntt3322__tt ffllaaggss,, iinntt mmooddee,, DDBB__EENNVV **ddbbeennvv,, DDBB__LLOOCCKKTTAABB ****rreeggiioonnpp));; + + iinntt + lloocckk__iidd((DDBB__LLOOCCKKTTAABB **lltt,, uu__iinntt3322__tt **iiddpp));; + + iinntt + lloocckk__vveecc((DDBB__LLOOCCKKTTAABB **lltt,, uu__iinntt3322__tt lloocckkeerr,, uu__iinntt3322__tt ffllaaggss,, + DDBB__LLOOCCKKRREEQQ lliisstt[[]],, iinntt nnlliisstt,, DDBB__LLOOCCKKRREEQQ ****eelliissttpp));; + + iinntt + lloocckk__ggeett((DDBB__LLOOCCKKTTAABB **lltt,, uu__iinntt3322__tt lloocckkeerr,, uu__iinntt3322__tt ffllaaggss,, + ccoonnsstt DDBBTT **oobbjj,, ccoonnsstt ddbb__lloocckkmmooddee__tt lloocckk__mmooddee,, DDBB__LLOOCCKK **lloocckk));; + + iinntt + lloocckk__ppuutt((DDBB__LLOOCCKKTTAABB **lltt,, DDBB__LLOOCCKK lloocckk));; + + iinntt + lloocckk__cclloossee((DDBB__LLOOCCKKTTAABB **lltt));; + + iinntt + lloocckk__uunnlliinnkk((ccoonnsstt cchhaarr **ddiirr,, iinntt ffoorrccee,, DDBB__EENNVV **ddbbeennvv));; + + iinntt + lloocckk__ddeetteecctt((DDBB__LLOOCCKKTTAABB **lltt,, uu__iinntt3322__tt ffllaaggss,, uu__iinntt3322__tt aattyyppee));; + + iinntt + lloocckk__ssttaatt((DDBB__LLOOCCKKTTAABB **lltt,, + DDBB__LLOOCCKK__SSTTAATT ****sspppp,, vvooiidd **((**ddbb__mmaalllloocc))((ssiizzee__tt))));; + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + This manual page describes the specific details of the + locking interface. + + The _d_b___l_o_c_k functions are the library interface intended + to provide general-purpose locking. While designed to + work with the other DB functions, these functions are also + useful for more general locking purposes. Locks can be + shared between processes. In most cases, when multiple + threads or processes are using locking, the deadlock + detector, _d_b___d_e_a_d_l_o_c_k(1), should be run. + + _l_o_c_k___o_p_e_n + The _l_o_c_k___o_p_e_n function copies a pointer, to the lock table + identified by the ddiirreeccttoorryy _d_i_r, into the memory location + referenced by _r_e_g_i_o_n_p. + + If the _d_b_e_n_v argument to _l_o_c_k___o_p_e_n was initialized using + _d_b___a_p_p_i_n_i_t, _d_i_r is interpreted as described by + _d_b___a_p_p_i_n_i_t(3). + + Otherwise, if _d_i_r is not NULL, it is interpreted relative + to the current working directory of the process. If _d_i_r + is NULL, the following environment variables are checked + in order: ``TMPDIR'', ``TEMP'', and ``TMP''. If one of + them is set, lock table files are created relative to the + directory it specifies. If none of them are set, the + first possible one of the following directories is used: + _/_v_a_r_/_t_m_p, _/_u_s_r_/_t_m_p, _/_t_e_m_p, _/_t_m_p, _C_:_/_t_e_m_p and _C_:_/_t_m_p. + + All files associated with the lock table are created in + this directory. This directory must already exist when + + lock table_open is called. If the lock table already + exists, the process must have permission to read and write + the existing files. If the lock table does not already + exist, it is optionally created and initialized. + + The _f_l_a_g_s and _m_o_d_e arguments specify how files will be + opened and/or created when they don't already exist. The + flags value is specified by oorr'ing together one or more of + the following values: + + DB_CREATE + Create any underlying files, as necessary. If the + files do not already exist and the DB_CREATE flag is + not specified, the call will fail. + + + DB_THREAD + Cause the DB_LOCKTAB handle returned by the _l_o_c_k___o_p_e_n + function to be useable by multiple threads within a + single address space, i.e., to be ``free-threaded''. + + All files created by the lock subsystem are created with + mode _m_o_d_e (as described in _c_h_m_o_d(2)) and modified by the + process' umask value at the time of creation (see + _u_m_a_s_k(2)). The group ownership of created files is based + on the system and directory defaults, and is not further + specified by DB. + + The locking subsystem is configured based on the _d_b_e_n_v + argument to _l_o_c_k___o_p_e_n, which is a pointer to a structure + of type DB_ENV (typedef'd in ). Applications will + normally use the same DB_ENV structure (initialized by + _d_b___a_p_p_i_n_i_t(3)), as an argument to all of the subsystems in + the DB package. + + References to the DB_ENV structure are maintained by DB, + so it may not be discarded until the last close function, + corresponding to an open function for which it was an + argument, has returned. In order to ensure compatibility + with future releases of DB, all fields of the DB_ENV + structure that are not explicitly set should be initial- + ized to 0 before the first time the structure is used. Do + this by declaring the structure external or static, or by + calling the C library routine _b_z_e_r_o(3) or _m_e_m_s_e_t(3). + + The fields of the DB_ENV structure used by _l_o_c_k___o_p_e_n are + described below. If _d_b_e_n_v is NULL or any of its fields + are set to 0, defaults appropriate for the system are used + where possible. + + The following fields in the DB_ENV structure may be ini- + tialized before calling _l_o_c_k___o_p_e_n: + + void *(*db_errcall)(char *db_errpfx, char *buffer); + FILE *db_errfile; + const char *db_errpfx; + int db_verbose; + The error fields of the DB_ENV behave as described + for _d_b___a_p_p_i_n_i_t(3). + + + + const u_int8_t lk_conflicts[][]; + A _l_k___m_o_d_e_s by _l_k___m_o_d_e_s array. A non-0 value for the + array element: + + lk_conflicts[requested_mode][held_mode] + + indicates that requested_mode and held_mode conflict. + The ``not-granted'' mode must be represented by 0. + If _l_k___c_o_n_f_l_i_c_t_s is NULL, the conflicts array + _d_b___r_w___c_o_n_f_l_i_c_t_s is used; see the section below enti- + tled ``STANDARD LOCK MODES'' for a description of + that array. + + db_detect_t lk_detect; + If non-0, specifies that the deadlock detector be run + whenever a lock conflict occurs, and specifies which + transaction should be aborted in the case of a dead- + lock. The _l_k___d_e_t_e_c_t field must be set to one of the + following values. + + DB_LOCK_DEFAULT + Use the default policy as specified in the + _d_b___d_e_a_d_l_o_c_k(1) man page. + + DB_LOCK_OLDEST + Abort the oldest transaction. + + DB_LOCK_RANDOM + Abort a random transaction involved in the dead- + lock. + + DB_LOCK_YOUNGEST + Abort the youngest transaction. + + u_int32_t lk_max; + The maximum number of locks to be held or requested + in the table. This value is used by _l_o_c_k___o_p_e_n to + estimate how much space to allocate for various lock- + table data structures. If _l_k___m_a_x is 0, a default + value is used. + + u_int32_t lk_modes; + The number of lock modes to be recognized by the lock + table (including the ``not-granted'' mode). If + _l_k___m_o_d_e_s is 0, the value DB_LOCK_RW_N is used; see + below for a description of that value. + + The _l_o_c_k___o_p_e_n function returns the value of _e_r_r_n_o on fail- + ure and 0 on success. + + _l_o_c_k___i_d + The _l_o_c_k___i_d function copies a locker ID, which is guaran- + teed to be unique in the specified lock table, into the + memory location referenced by _i_d_p. + + The access methods (see _d_b___o_p_e_n(3)), generate a unique + locker ID for each file that is opened with locking. Dur- + ing DB access method operation, this locker ID will be + used for all lock calls unless a transaction identifier + was specified for the call, in which case the transaction + ID specified is used for locking. + + The _l_o_c_k___i_d function returns the value of _e_r_r_n_o on failure + and 0 on success. + + _l_o_c_k___v_e_c + The _l_o_c_k___v_e_c function atomically obtains and releases one + or more locks from the specified table, _l_t. The _l_o_c_k___v_e_c + function is intended to support acquisition or trading of + multiple locks under one lock table semaphore, as is + needed for lock coupling or in multigranularity locking + for lock escalation. + + The _l_o_c_k_e_r argument specified to _l_o_c_k___v_e_c is an unsigned + 32-bit integer quantity. It represents the entity + requesting or releasing the lock. + + The _f_l_a_g_s value must be set to 0 or the following value: + + DB_LOCK_NOWAIT + If a lock cannot be granted because the requested + lock conflicts with an existing lock, return immedi- + ately instead of waiting for the lock to become + available. + + The _l_i_s_t array provided to _l_o_c_k___v_e_c is typedef'd in + as DB_LOCKREQ. A DB_LOCKREQ structure has at least the + following fields, which must be initialized before calling + _l_o_c_k___v_e_c: + + lockop_t op; + The operation to be performed, which must be set to + one of the following values: + + DB_LOCK_GET + Get a lock, as defined by the values of _l_o_c_k_e_r, + _o_b_j and _m_o_d_e. Upon return from _l_o_c_k___v_e_c, if the + _l_o_c_k field is non-NULL, a reference to the + acquired lock is stored there. (This reference + is invalidated by any call to _l_o_c_k___v_e_c or + _l_o_c_k___p_u_t that releases the lock.) + + DB_LOCK_PUT + The lock referenced by the contents of the _l_o_c_k + field is released. + + DB_LOCK_PUT_ALL + All locks held by the _l_o_c_k_e_r are released. (Any + locks acquired as a part of the current call to + _l_o_c_k___v_e_c that appear after the DB_LOCK_PUT_ALL + entry are not considered for this operation). + + DB_LOCK_PUT_OBJ + All locks held by the _l_o_c_k_e_r, on the object _o_b_j, + with the mode specified by _l_o_c_k___m_o_d_e, are + released. A _l_o_c_k___m_o_d_e of DB_LOCK_NG indicates + that all locks on the object should be released. + Note that any locks acquired as a part of the + current call to _l_o_c_k___v_e_c that occur before the + DB_LOCK_PUT_OBJ will also be released; those + acquired afterwards will not be released. + + const DBT obj; + An untyped byte string that specifies the object to + be locked or released. + + const lockmode_t mode; + The lock mode, used as an index into _l_t's conflict + array. + + + DB_LOCK lock; + A lock reference. + + The _n_l_i_s_t argument specifies the number of elements in the + _l_i_s_t array. + + If any of the requested locks cannot be acquired, or any + of the locks to be released cannot be released, the opera- + tions before the failing operation are guaranteed to have + completed successfully, and _l_o_c_k___v_e_c returns a non-zero + value. In addition, if _e_l_i_s_t_p is not NULL, it is set to + point to the DB_LOCKREQ entry that was being processed + when the error occurred. + + In the case of an error, _l_o_c_k___v_e_c may return one of the + following values: + + DB_LOCK_DEADLOCK + The specified _l_o_c_k_e_r was selected as a victim in + order to resolve a deadlock. + + DB_LOCK_NOTHELD + The lock cannot be released, as it was not held by + the _l_o_c_k_e_r. + + DB_LOCK_NOTGRANTED + A lock was requested that could not be granted and + the _f_l_a_g parameter was set to DB_LOCK_NOWAIT. In + this case, if non-NULL, _e_l_i_s_t_p identifies the request + that was granted. + + Otherwise, the _l_o_c_k___v_e_c function returns the value of + _e_r_r_n_o on failure and 0 on success. + + _l_o_c_k___g_e_t + The _l_o_c_k___g_e_t function is a simple interface to the + _l_o_c_k___v_e_c functionality, and is equivalent to calling the + _l_o_c_k___v_e_c function with the _l_t and _l_o_c_k_e_r arguments, _e_l_i_s_t_p + and _c_o_n_f_l_i_c_t arguments, and a single element _l_i_s_t array, + for which the _o_p field is DB_LOCK_GET, and the _o_b_j, + _l_o_c_k___m_o_d_e and _l_o_c_k fields are represented by the arguments + of the same name. Note that the type of the _o_b_j argument + to _l_o_c_k___g_e_t is different from the _o_b_j element found in the + DB_LOCKREQ structure. The _l_o_c_k___g_e_t function returns suc- + cess and failure as described for the _l_o_c_k___v_e_c function. + + _l_o_c_k___p_u_t + The _l_o_c_k___p_u_t function is a simple interface to the + _l_o_c_k___v_e_c functionality, and is equivalent to calling the + _l_o_c_k___v_e_c function with a single element _l_i_s_t array, for + which the _o_p field is DB_LOCK_PUT and the _l_o_c_k field is + represented by the argument of the same name. The + _l_o_c_k___p_u_t function returns success and failure as described + for the _l_o_c_k___v_e_c function. + _l_o_c_k___c_l_o_s_e + The _l_o_c_k___c_l_o_s_e function disassociates the calling process + from the lock table _l_t. Note that _l_o_c_k___c_l_o_s_e does not + release any locks still held by the closing process. + (This provides functionality for long-lived locks.) Pro- + cesses that wish to have all their locks released can do + so by issuing the appropriate _l_o_c_k___v_e_c call. + + In addition, if the _d_i_r argument to _l_o_c_k___o_p_e_n was NULL and + _d_b_e_n_v was not initialized using _d_b___a_p_p_i_n_i_t, all files cre- + ated for this shared region will be removed, as if + _l_o_c_k___u_n_l_i_n_k were called. + + When multiple threads are using the DB_LOCKTAB handle con- + currently, only a single thread may call the _l_o_c_k___c_l_o_s_e + function. + + The _l_o_c_k___c_l_o_s_e function returns the value of _e_r_r_n_o on + failure and 0 on success. + + + _l_o_c_k___u_n_l_i_n_k + The _l_o_c_k___u_n_l_i_n_k function destroys the lock table identi- + fied by the directory _d_i_r, removing all files used to + implement the lock table. (The directory _d_i_r is not + removed.) If there are processes that have called + _l_o_c_k___o_p_e_n without calling _l_o_c_k___c_l_o_s_e (i.e., there are pro- + cesses currently using the lock table), _l_o_c_k___u_n_l_i_n_k will + fail without further action, unless the force flag is set, + in which case _l_o_c_k___u_n_l_i_n_k will attempt to remove the lock + table files regardless of any processes still using the + lock table. + + The result of attempting to forcibly destroy the region + when a process has the region open is unspecified. Pro- + cesses using a shared memory region maintain an open file + descriptor for it. On UNIX systems, the region removal + should succeed and processes that have already joined the + region should continue to run in the region without + change, however processes attempting to join the lock + table will either fail or attempt to create a new region. + On other systems, e.g., WNT, where the _u_n_l_i_n_k(2) system + call will fail if any process has an open file descriptor + for the file, the region removal will fail. + + In the case of catastrophic or system failure, database + recovery must be performed (see _d_b___r_e_c_o_v_e_r(1) or the + DB_RECOVER and DB_RECOVER_FATAL flags to _d_b___a_p_p_i_n_i_t(3)). + Alternatively, if recovery is not required because no + database state is maintained across failures, it is possi- + ble to clean up a lock table by removing all of the files + in the directory specified to the _l_o_c_k___o_p_e_n function, as + lock table files are never created in any directory other + than the one specified to _l_o_c_k___o_p_e_n. Note, however, that + this has the potential to remove files created by the + other DB subsystems in this database environment. + + The _l_o_c_k___u_n_l_i_n_k function returns the value of _e_r_r_n_o on + failure and 0 on success. + + _l_o_c_k___d_e_t_e_c_t + The _l_o_c_k___d_e_t_e_c_t function runs one iteration of the dead- + lock detector on the specified table, _l_t. The deadlock + detector traverses the lock table, detects deadlocks, and + if it finds one, marks one of the participating transac- + tions for abort and then returns. + + The flags value is specified by oorr'ing together one or + more of the following values: + + + DB_LOCK_CONFLICT + Only run the deadlock detector if a lock conflict has + occurred since the last time that the deadlock detec- + tor was run. + + The _a_t_y_p_e parameter specifies which transaction to abort + in the case of deadlock. It must be set to one of values + described above for the _l_k___d_e_t_e_c_t field of the _D_B___E_N_V + structure. + + The _l_o_c_k___d_e_t_e_c_t function returns the value of _e_r_r_n_o on + failure and 0 on success. + + The _l_o_c_k___d_e_t_e_c_t function is the underlying function used + by the _d_b___d_e_a_d_l_o_c_k(1) utility. See the source code for + the _d_b___d_e_a_d_l_o_c_k utility for an example of using + _l_o_c_k___d_e_t_e_c_t in a UNIX environment. + + _l_o_c_k___s_t_a_t + The _l_o_c_k___s_t_a_t function creates a statistical structure and + copies a pointer to it into the user-specified memory + location. + + Statistical structure are created in allocated memory. If + _d_b___m_a_l_l_o_c is non-NULL, it is called to allocate the mem- + ory, otherwise, the library function _m_a_l_l_o_c(3) is used. + The function _d_b___m_a_l_l_o_c must match the calling conventions + of the _m_a_l_l_o_c(3) library routine. Regardless, the caller + is responsible for deallocating the returned memory. To + deallocate the returned memory, free each returned memory + pointer; pointers inside the memory do not need to be + individually freed. + + The lock region statistics are stored in a structure of + type DB_LOCK_STAT (typedef'd in ). The following + DB_LOCK_STAT fields will be filled in: + + u_int32_t st_magic; + The magic number that identifies a file as a lock + file. + u_int32_t st_version; + The version of the lock file type. + u_int32_t st_refcnt; + The number of references to the region. + u_int32_t st_regsize; + The size of the region. + u_int32_t st_maxlocks; + The maximum number of locks possible. + u_int32_t st_nmodes; + The number of lock modes. + u_int32_t st_numobjs; + The number of unique objects locked. + u_int32_t st_nlockers; + The number of unique lockers. + u_int32_t st_nconflicts; + The total number of locks not immediately available + due to conflicts. + u_int32_t st_nrequests; + The total number of locks requested. + u_int32_t st_nreleases; + The total number of locks released. + u_int32_t st_ndeadlocks + The number of deadlocks detected. + u_int32_t st_region_wait; + The number of times that a thread of control was + forced to wait before obtaining the region lock. + u_int32_t st_region_nowait; + The number of times that a thread of control was able + to obtain the region lock without waiting. + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _d_b___l_o_c_k: + + DB_HOME + If the _d_b_e_n_v argument to _l_o_c_k___o_p_e_n was initialized + using _d_b___a_p_p_i_n_i_t, the environment variable DB_HOME + may be used as the path of the database home for the + interpretation of the _d_i_r argument to _l_o_c_k___o_p_e_n, as + described in _d_b___a_p_p_i_n_i_t(3). + + TMPDIR + If the _d_b_e_n_v argument to _l_o_c_k___o_p_e_n was NULL or not + initialized using _d_b___a_p_p_i_n_i_t, the environment vari- + able TMPDIR may be used as the directory in which to + create the lock table, as described in the _l_o_c_k___o_p_e_n + section above. + +SSTTAANNDDAARRDD LLOOCCKK MMOODDEESS + The include file declares two commonly used con- + flict arrays: + const u_int8_t db_lock_rw_conflicts[]; + This is a conflict array for a simple scheme using + shared and exclusive lock modes. + + const u_int8_t db_lock_riw_conflicts[]; + This is a conflict array that involves various intent + lock modes (e.g., intent shared) that are used for + multigranularity locking. + + Their associated sizes are DB_LOCK_RW_N and DB_LOCK_RIW_N. + + In addition, the include file defines the type + _d_b___l_o_c_k_m_o_d_e___t, which is the type of the lock modes used + with the standard tables above: + + DB_LOCK_NG + not granted (always 0) + + DB_LOCK_READ + read (shared) + + DB_LOCK_WRITE + write (exclusive) + +EERRRROORRSS + The _l_o_c_k___o_p_e_n function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: close(2), db_version(3), fcntl(2), fflush(3), + lock_unlink(3), lseek(2), malloc(3), memcpy(3), memset(3), + mmap(2), munmap(2), open(2), sigfillset(3), sigproc- + mask(2), stat(2), strcpy(3), strdup(3), strerror(3), + strlen(3), unlink(2), and write(2). + + In addition, the _l_o_c_k___o_p_e_n function may fail and return + _e_r_r_n_o for the following conditions: + + [EAGAIN] + The shared memory region was locked and (repeatedly) + unavailable. + + [EINVAL] + An invalid flag value or parameter was specified. + + The DB_THREAD flag was specified and spinlocks are + not implemented for this architecture. + + The _l_o_c_k___v_e_c function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: fcntl(2), fflush(3), lock_detect(3), lseek(2), + memcpy(3), memset(3), mmap(2), munmap(2), strerror(3), and + write(2). + + In addition, the _l_o_c_k___v_e_c function may fail and return + _e_r_r_n_o for the following conditions: + [EACCES] + An attempt was made to release lock held by another + locker. + + [EINVAL] + An invalid flag value or parameter was specified. + + The _l_o_c_k___g_e_t function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: fcntl(2), fflush(3), lock_detect(3), lseek(2), + memcpy(3), memset(3), mmap(2), munmap(2), strerror(3), and + write(2). + + In addition, the _l_o_c_k___g_e_t function may fail and return + _e_r_r_n_o for the following conditions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The _l_o_c_k___p_u_t function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: fcntl(2), fflush(3), lock_detect(3), lseek(2), + memcpy(3), memset(3), mmap(2), munmap(2), strerror(3), and + write(2). + + In addition, the _l_o_c_k___p_u_t function may fail and return + _e_r_r_n_o for the following conditions: + + [EACCES] + An attempt was made to release lock held by another + locker. + + [EINVAL] + An invalid flag value or parameter was specified. + + The _l_o_c_k___c_l_o_s_e function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: close(2), fcntl(2), fflush(3), munmap(2), and + strerror(3). + + The _l_o_c_k___u_n_l_i_n_k function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: close(2), fcntl(2), fflush(3), malloc(3), mem- + cpy(3), memset(3), mmap(2), munmap(2), open(2), sig- + fillset(3), sigprocmask(2), stat(2), strcpy(3), strdup(3), + strerror(3), strlen(3), and unlink(2). + + In addition, the _l_o_c_k___u_n_l_i_n_k function may fail and return + _e_r_r_n_o for the following conditions: + + [EBUSY] + The shared memory region was in use and the force + flag was not set. + + + The _l_o_c_k___d_e_t_e_c_t function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: calloc(3), fcntl(2), fflush(3), lseek(2), mal- + loc(3), memcpy(3), memset(3), mmap(2), munmap(2), str- + error(3), and write(2). + +BBUUGGSS + If a process dies while holding locks, those locks remain + held and are nneevveerr released. In this case, all processes + should exit as quickly as possible, so that _d_b___r_e_c_o_v_e_r can + be run. + +SSEEEE AALLSSOO + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/man.text/db_log.0 b/mozilla/db/man/man.text/db_log.0 new file mode 100644 index 00000000000..465dde1099a --- /dev/null +++ b/mozilla/db/man/man.text/db_log.0 @@ -0,0 +1,770 @@ + + +NNAAMMEE + db_log - log management functions + +SSYYNNOOPPSSIISS + ##iinncclluuddee <> + + iinntt + lloogg__ooppeenn((ccoonnsstt cchhaarr **ddiirr,, + uu__iinntt3322__tt ffllaaggss,, iinntt mmooddee,, DDBB__EENNVV **ddbbeennvv,, DDBB__LLOOGG ****rreeggiioonnpp));; + + iinntt + lloogg__cclloossee((DDBB__LLOOGG **llooggpp));; + + iinntt + lloogg__fflluusshh((DDBB__LLOOGG **llooggpp,, ccoonnsstt DDBB__LLSSNN **llssnn));; + + iinntt + lloogg__ggeett((DDBB__LLOOGG **llooggpp,, DDBB__LLSSNN **llssnn,, DDBBTT **ddaattaa,, uu__iinntt3322__tt ffllaaggss));; + + iinntt + lloogg__ccoommppaarree((ccoonnsstt DDBB__LLSSNN **llssnn00,, ccoonnsstt DDBB__LLSSNN **llssnn11));; + + iinntt + lloogg__ffiillee((DDBB__LLOOGG **llooggpp,, ccoonnsstt DDBB__LLSSNN **llssnn,, cchhaarr **nnaammeepp,, ssiizzee__tt lleenn));; + + iinntt + lloogg__ppuutt((DDBB__LLOOGG **llooggpp,, DDBB__LLSSNN **llssnn,, ccoonnsstt DDBBTT **ddaattaa,, uu__iinntt3322__tt ffllaaggss));; + + iinntt + lloogg__uunnlliinnkk((ccoonnsstt cchhaarr **ddiirr,, iinntt ffoorrccee,, DDBB__EENNVV **));; + + iinntt + lloogg__aarrcchhiivvee((DDBB__LLOOGG **llooggpp,, + cchhaarr ****lliisstt[[]],, uu__iinntt3322__tt ffllaaggss,, vvooiidd **((**ddbb__mmaalllloocc))((ssiizzee__tt))));; + + iinntt + lloogg__rreeggiisstteerr((DDBB__LLOOGG **llooggpp,, + ccoonnsstt DDBB **ddbbpp,, ccoonnsstt cchhaarr **nnaammee,, DDBBTTYYPPEE ttyyppee,, uu__iinntt3322__tt **ffiiddpp));; + + iinntt + lloogg__uunnrreeggiisstteerr((DDBB__LLOOGG **llooggpp,, uu__iinntt3322__tt ffiidd));; + + iinntt + lloogg__ssttaatt((DDBB__LLOOGG **llooggpp,, DDBB__LLOOGG__SSTTAATT ****sspppp,, vvooiidd **((**ddbb__mmaalllloocc))((ssiizzee__tt))));; + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + + This manual page describes the specific details of the log + manager. + + These functions provide a general-purpose logging facility + sufficient for transaction management. Logs can be shared + by multiple processes. + + The DB transaction log is represented by a directory con- + taining a set of files. The log is a record-oriented, + append-only file, with records identified and accessed via + _D_B___L_S_N's (database log sequence numbers). + + DB_LSN's are returned on each _l_o_g___p_u_t operation, and only + those DB_LSN's returned by _l_o_g___p_u_t can later be used to + retrieve records from the log. + + _l_o_g___o_p_e_n + The _l_o_g___o_p_e_n function copies a pointer, to the log identi- + fied by the ddiirreeccttoorryy _d_i_r, into the memory location refer- + enced by _r_e_g_i_o_n_p. + + If the _d_b_e_n_v argument to _l_o_g___o_p_e_n was initialized using + _d_b___a_p_p_i_n_i_t, _d_i_r is interpreted as described by + _d_b___a_p_p_i_n_i_t(3). + + Otherwise, if _d_i_r is not NULL, it is interpreted relative + to the current working directory of the process. If _d_i_r + is NULL, the following environment variables are checked + in order: ``TMPDIR'', ``TEMP'', and ``TMP''. If one of + them is set, log files are created relative to the direc- + tory it specifies. If none of them are set, the first + possible one of the following directories is used: + _/_v_a_r_/_t_m_p, _/_u_s_r_/_t_m_p, _/_t_e_m_p, _/_t_m_p, _C_:_/_t_e_m_p and _C_:_/_t_m_p. + + All files associated with the log are created in this + directory. This directory must already exist when + + log_open is called. If the log already exists, the pro- + cess must have permission to read and write the existing + files. If the log does not already exist, it is option- + ally created and initialized. + + If the log region is being created and log files are + already present, the log files are ``recovered'' and sub- + sequent log writes are appended to the end of the log. + + The log is stored in one or more files in the specified + directory. Each file is named using the format + + log.NNNNN + + where ``NNNNN'' is the sequence number of the file within + the log. + + + The _f_l_a_g_s and _m_o_d_e arguments specify how files will be + opened and/or created when they don't already exist. The + flags value is specified by oorr'ing together one or more of + the following values: + + DB_CREATE + Create any underlying files, as necessary. If the + files do not already exist and the DB_CREATE flag is + not specified, the call will fail. + + + DB_THREAD + Cause the DB_LOG handle returned by the _l_o_g___o_p_e_n + function to be useable by multiple threads within a + single address space, i.e., to be ``free-threaded''. + + All files created by the log subsystem are created with + mode _m_o_d_e (as described in _c_h_m_o_d(2)) and modified by the + process' umask value at the time of creation (see + _u_m_a_s_k(2)). The group ownership of created files is based + on the system and directory defaults, and is not further + specified by DB. + + The logging subsystem is configured based on the _d_b_e_n_v + argument to _l_o_g___o_p_e_n, which is a pointer to a structure of + type DB_ENV (typedef'd in ). Applications will nor- + mally use the same DB_ENV structure (initialized by + _d_b___a_p_p_i_n_i_t(3)), as an argument to all of the subsystems in + the DB package. + + References to the DB_ENV structure are maintained by DB, + so it may not be discarded until the last close function, + corresponding to an open function for which it was an + argument, has returned. In order to ensure compatibility + with future releases of DB, all fields of the DB_ENV + structure that are not explicitly set should be initial- + ized to 0 before the first time the structure is used. Do + this by declaring the structure external or static, or by + calling the C library routine _b_z_e_r_o(3) or _m_e_m_s_e_t(3). + + The fields of the DB_ENV structure used by _l_o_g___o_p_e_n are + described below. If _d_b_e_n_v is NULL or any of its fields + are set to 0, defaults appropriate for the system are used + where possible. + + The following fields in the DB_ENV structure may be ini- + tialized before calling _l_o_g___o_p_e_n: + + void *(*db_errcall)(char *db_errpfx, char *buffer); + FILE *db_errfile; + const char *db_errpfx; + int db_verbose; + The error fields of the DB_ENV behave as described + for _d_b___a_p_p_i_n_i_t(3). + + + u_int32_t lg_max; + The maximum size of a single file in the log. + Because DB_LSN file offsets are unsigned 4-byte val- + ues, _l_g___m_a_x may not be larger than the maximum + unsigned 4-byte value. + + If _l_g___m_a_x is 0, a default value is used. + + See the section "LOG FILE LIMITS" below, for further + information. + + The _l_o_g___o_p_e_n function returns the value of _e_r_r_n_o on fail- + ure and 0 on success. + + _l_o_g___c_l_o_s_e + The _l_o_g___c_l_o_s_e function closes the log specified by the + _l_o_g_p argument. + + In addition, if the _d_i_r argument to _l_o_g___o_p_e_n was NULL and + _d_b_e_n_v was not initialized using _d_b___a_p_p_i_n_i_t, all files cre- + ated for this shared region will be removed, as if + _l_o_g___u_n_l_i_n_k were called. + + When multiple threads are using the DB_LOG handle concur- + rently, only a single thread may call the _l_o_g___c_l_o_s_e func- + tion. + + The _l_o_g___c_l_o_s_e function returns the value of _e_r_r_n_o on fail- + ure and 0 on success. + + _l_o_g___f_l_u_s_h + The _l_o_g___f_l_u_s_h function guarantees that all log records + whose LSNs are less than or equal to the _l_s_n parameter + have been written to disk. If _l_s_n is NULL, all records in + the log are flushed. + + The _l_o_g___f_l_u_s_h function returns the value of _e_r_r_n_o on fail- + ure and 0 on success. + + _l_o_g___g_e_t + The _l_o_g___g_e_t function implements a cursor inside of the + log, retrieving records from the log according to the _l_s_n + and _f_l_a_g_s parameters. + + The data field of the _d_a_t_a structure is set to the record + retrieved and the size field indicates the number of bytes + in the record. See _d_b___d_b_t(3) for a description of other + fields in the _d_a_t_a structure. WWhheenn mmuullttiippllee tthhrreeaaddss aarree + uussiinngg tthhee rreettuurrnneedd DDBB__LLOOGG hhaannddllee ccoonnccuurrrreennttllyy,, eeiitthheerr tthhee + DDBB__DDBBTT__MMAALLLLOOCC oorr DDBB__DDBBTT__UUSSEERRMMEEMM ffllaaggss mmuusstt bbee ssppeecciiffiieedd + ffoorr aannyy DDBBTT uusseedd ffoorr ddaattaa rreettrriieevvaall.. + + + The _f_l_a_g_s parameter must be set to exactly one of the fol- + lowing values: + + DB_CHECKPOINT + The last record written with the DB_CHECKPOINT flag + specified to the _l_o_g___p_u_t function is returned in the + _d_a_t_a argument. The _l_s_n argument is overwritten with + the DB_LSN of the record returned. If no record has + been previously written with the DB_CHECKPOINT flag + specified, the first record in the log is returned. + + If the log is empty the _l_o_g___g_e_t function will return + DB_NOTFOUND. + + DB_FIRST + The first record from any of the log files found in + the log directory is returned in the _d_a_t_a argument. + The _l_s_n argument is overwritten with the DB_LSN of + the record returned. + + If the log is empty the _l_o_g___g_e_t function will return + DB_NOTFOUND. + + DB_LAST + The last record in the log is returned in the _d_a_t_a + argument. The _l_s_n argument is overwritten with the + DB_LSN of the record returned. + + If the log is empty, the _l_o_g___g_e_t function will return + DB_NOTFOUND. + + DB_NEXT + The current log position is advanced to the next + record in the log and that record is returned in the + _d_a_t_a argument. The _l_s_n argument is overwritten with + the DB_LSN of the record returned. + + If the pointer has not been initialized via DB_FIRST, + DB_LAST, DB_SET, DB_NEXT, or DB_PREV, _l_o_g___g_e_t will + return the first record in the log. If the last log + record has already been returned or the log is empty, + the _l_o_g___g_e_t function will return DB_NOTFOUND. + + If the log was opened with the DB_THREAD flag set, + calls to _l_o_g___g_e_t with the DB_NEXT flag set will + return EINVAL. + + DB_PREV + The current log position is moved to the previous + record in the log and that record is returned in the + _d_a_t_a argument. The _l_s_n argument is overwritten with + the DB_LSN of the record returned. + + If the pointer has not been initialized via DB_FIRST, + DB_LAST, DB_SET, DB_NEXT, or DB_PREV, _l_o_g___g_e_t will + return the last record in the log. If the first log + record has already been returned or the log is empty, + the _l_o_g___g_e_t function will return DB_NOTFOUND. + + If the log was opened with the DB_THREAD flag set, + calls to _l_o_g___g_e_t with the DB_PREV flag set will + return EINVAL. + + DB_CURRENT + Return the log record currently referenced by the + log. + + If the log pointer has not been initialized via + DB_FIRST, DB_LAST, DB_SET, DB_NEXT, or DB_PREV, or if + the log was opened with the DB_THREAD flag set, + _l_o_g___g_e_t will return EINVAL. + + DB_SET + Retrieve the record specified by the _l_s_n argument. + If the specified DB_LSN is invalid (e.g., does not + appear in the log) _l_o_g___g_e_t will return EINVAL. + + Otherwise, the _l_o_g___g_e_t function returns the value of _e_r_r_n_o + on failure and 0 on success. + + _l_o_g___c_o_m_p_a_r_e + The _l_o_g___c_o_m_p_a_r_e function allows the caller to compare two + DB_LSN's. _L_o_g___c_o_m_p_a_r_e returns 0 if the two DB_LSN's are + equal, 1 if _l_s_n_0 is greater than _l_s_n_1, and -1 if _l_s_n_0 is + less than _l_s_n_1. + + _l_o_g___f_i_l_e + The _l_o_g___f_i_l_e function maps DB_LSN's to file names. The + _l_o_g___f_i_l_e function copies the name of the file containing + the record named by _l_s_n into the memory location refer- + enced by _n_a_m_e_p. (This mapping of DB_LSN to file is needed + for database administration. For example, a transaction + manager typically records the earliest DB_LSN needed for + restart, and the database administrator may want to + archive log files to tape when they contain only DB_LSN's + before the earliest one needed for restart.) + + The _l_e_n argument is the length of the _n_a_m_e_p buffer in + bytes. If _n_a_m_e_p is too short to hold the file name, + _l_o_g___f_i_l_e will return ENOMEM. Note, as described above, + log file names are quite short, on the order of 10 charac- + ters. + + The _l_o_g___f_i_l_e function returns the value of _e_r_r_n_o on fail- + ure and 0 on success. + + _l_o_g___p_u_t + The _l_o_g___p_u_t function appends records to the log. The + DB_LSN of the put record is returned in the _l_s_n parameter. + The _f_l_a_g_s parameter may be set to one of the following + values: + + DB_CHECKPOINT + The log should write a checkpoint record, recording + any information necessary to make the log structures + recoverable after a crash. + + DB_CURLSN + The DB_LSN of the next record to be put is returned + in the _l_s_n parameter. + + DB_FLUSH + The log is forced to disk after this record is writ- + ten, guaranteeing that all records with DB_LSNs less + than or equal to the one being put are on disk before + this function returns (this function is most often + used for a transaction commit, see _d_b___t_x_n(3)). + + The caller is responsible for providing any necessary + structure to _d_a_t_a. (For example, in a write-ahead logging + protocol, the application must understand what part of + _d_a_t_a is an operation code, what part is redo information, + and what part is undo information. In addition, most + transaction managers will store in _d_a_t_a the DB_LSN of the + previous log record for the same transaction, to support + chaining back through the transaction's log records during + undo.) + + The _l_o_g___p_u_t function returns the value of _e_r_r_n_o on failure + and 0 on success. + + + _l_o_g___u_n_l_i_n_k + The _l_o_g___u_n_l_i_n_k function destroys the log region identified + by the directory _d_i_r, removing all files used to implement + the log region. (The log files themselves and the direc- + tory _d_i_r are not removed.) If there are processes that + have called _l_o_g___o_p_e_n without calling _l_o_g___c_l_o_s_e (i.e., + there are processes currently using the log region), + _l_o_g___u_n_l_i_n_k will fail without further action, unless the + force flag is set, in which case _l_o_g___u_n_l_i_n_k will attempt + to remove the log region files regardless of any processes + still using the log region. + + The result of attempting to forcibly destroy the region + when a process has the region open is unspecified. Pro- + cesses using a shared memory region maintain an open file + descriptor for it. On UNIX systems, the region removal + should succeed and processes that have already joined the + region should continue to run in the region without + change, however processes attempting to join the log + region will either fail or attempt to create a new region. + + On other systems, e.g., WNT, where the _u_n_l_i_n_k(2) system + call will fail if any process has an open file descriptor + for the file, the region removal will fail. + + In the case of catastrophic or system failure, database + recovery must be performed (see _d_b___r_e_c_o_v_e_r(1) or the + DB_RECOVER and DB_RECOVER_FATAL flags to _d_b___a_p_p_i_n_i_t(3)). + Alternatively, if recovery is not required because no + database state is maintained across failures, it is possi- + ble to clean up a log region by removing all of the files + in the directory specified to the _l_o_g___o_p_e_n function, as + log region files are never created in any directory other + than the one specified to _l_o_g___o_p_e_n. Note, however, that + this has the potential to remove files created by the + other DB subsystems in this database environment. + + The _l_o_g___u_n_l_i_n_k function returns the value of _e_r_r_n_o on + failure and 0 on success. + + _l_o_g___a_r_c_h_i_v_e + The _l_o_g___a_r_c_h_i_v_e function creates a NULL-terminated array + of log or database file names and copies a pointer to them + into the user-specified memory location _l_i_s_t. + + By default, _l_o_g___a_r_c_h_i_v_e returns the names of all of the + log files that are no longer in use (e.g., no longer + involved in active transactions), and that may be archived + for catastrophic recovery and then removed from the sys- + tem. If there were no file names to return, _l_i_s_t will be + set to NULL. + + Arrays of log file names are created in allocated memory. + If _d_b___m_a_l_l_o_c is non-NULL, it is called to allocate the + memory, otherwise, the library function _m_a_l_l_o_c(3) is used. + The function _d_b___m_a_l_l_o_c must match the calling conventions + of the _m_a_l_l_o_c(3) library routine. Regardless, the caller + is responsible for deallocating the returned memory. To + deallocate the returned memory, free each returned memory + pointer; pointers inside the memory do not need to be + individually freed. + + The _f_l_a_g_s argument is specified by oorr'ing together one or + more of the following values: + + DB_ARCH_ABS + All pathnames are returned as absolute pathnames, + instead of relative to the database home directory. + + DB_ARCH_DATA + Return the database files that need to be archived in + order to recover the database from catastrophic fail- + ure. If any of the database files have not been + accessed during the lifetime of the current log + files, _l_o_g___a_r_c_h_i_v_e will not include them in this + list. It is also possible that some of the files + referenced in the log have since been deleted from + the system. + + DB_ARCH_LOG + Return all the log file names regardless of whether + or not they are in use. + + The DB_ARCH_DATA and DB_ARCH_LOG flags are mutually exclu- + sive. + + The _l_o_g___a_r_c_h_i_v_e function returns the value of _e_r_r_n_o on + failure and 0 on success. + + The _l_o_g___a_r_c_h_i_v_e function is the underlying function used + by the _d_b___a_r_c_h_i_v_e(1) utility. See the source code for the + _d_b___a_r_c_h_i_v_e utility for an example of using _l_o_g___a_r_c_h_i_v_e in + a UNIX environment. See the _d_b___a_r_c_h_i_v_e(1) manual page for + more information on database archival procedures. + + _l_o_g___r_e_g_i_s_t_e_r + The _l_o_g___r_e_g_i_s_t_e_r function registers a file name with the + log manager and copies a file identification number into + the memory location referenced by _f_i_d_p. This file identi- + fication number should be used in all subsequent log mes- + sages that refer to operations on this file. The log man- + ager records all file name to file identification number + mappings at each checkpoint so that a recovery process can + identify the file to which a record in the log refers. + + The _l_o_g___r_e_g_i_s_t_e_r function is called when an access method + registers the open of a file. The _d_b_p parameter should be + a pointer to the DB structure which is being returned by + the access method. + + The _t_y_p_e parameter should be one of the DB types specified + in _d_b___o_p_e_n(3), e.g., DB_HASH. + + The _l_o_g___r_e_g_i_s_t_e_r function returns the value of _e_r_r_n_o on + failure and 0 on success. + + _l_o_g___u_n_r_e_g_i_s_t_e_r + The _l_o_g___u_n_r_e_g_i_s_t_e_r function disassociates the file name to + file identification number mapping for the file identifi- + cation number specified by the _f_i_d parameter. The file + identification number may then be reused. + + The _l_o_g___u_n_r_e_g_i_s_t_e_r function returns the value of _e_r_r_n_o on + failure and 0 on success. + + _l_o_g___s_t_a_t + The _l_o_g___s_t_a_t function creates a statistical structure and + copies a pointer to it into the user-specified memory + location. + + Statistical structure are created in allocated memory. If + _d_b___m_a_l_l_o_c is non-NULL, it is called to allocate the mem- + ory, otherwise, the library function _m_a_l_l_o_c(3) is used. + The function _d_b___m_a_l_l_o_c must match the calling conventions + of the _m_a_l_l_o_c(3) library routine. Regardless, the caller + is responsible for deallocating the returned memory. To + deallocate the returned memory, free each returned memory + pointer; pointers inside the memory do not need to be + individually freed. + + The log region statistics are stored in a structure of + type DB_LOG_STAT (typedef'd in ). The following + DB_LOG_STAT fields will be filled in: + + u_int32_t st_magic; + The magic number that identifies a file as a log + file. + u_int32_t st_version; + The version of the log file type. + u_int32_t st_refcnt; + The number of references to the region. + u_int32_t st_regsize; + The size of the region. + int st_mode; + The mode of any created log files. + u_int32_t st_lg_max; + The maximum size of any individual file comprising + the log. + u_int32_t st_w_mbytes; + The number of megabytes written to this log. + u_int32_t st_w_bytes; + The number of bytes over and above _s_t___w___m_b_y_t_e_s writ- + ten to this log. + u_int32_t st_wc_mbytes; + The number of megabytes written to this log since the + last checkpoint. + u_int32_t st_wc_bytes; + The number of bytes over and above _s_t___w_c___m_b_y_t_e_s writ- + ten to this log since the last checkpoint. + u_int32_t st_cur_file; + The current log file number. + u_int32_t st_cur_offset; + The byte offset in the current log file. + u_int32_t st_region_wait; + The number of times that a thread of control was + forced to wait before obtaining the region lock. + u_int32_t st_region_nowait; + The number of times that a thread of control was able + to obtain the region lock without waiting. + +LLOOGG FFIILLEE LLIIMMIITTSS + Log file sizes impose a time limit on the length of time a + database may be accessed under transaction protection, + before it needs to be dumped and reloaded (see _d_b___d_u_m_p_(_3_) + and _d_b___l_o_a_d_(_3_)_)_. Unfortunately, the limits are poten- + tially difficult to calculate. + + The log file name consists of "log." followed by 5 digits, + resulting in a maximum of 99,999 log files. Consider an + application performing 600 transactions per second, for 15 + hours a day, logged into 10Mb log files, where each trans- + action is logging approximately 100 bytes of data. The + calculation: + + (10 * 2^20 * 99999) / + (600 * 60 * 60 * 15 * 100) = 323.63 + + indicates that the system will run out of log file space + in roughly 324 days. If we increase the maximum size of + the files from 10Mb to 100Mb, the same calculation indi- + cates that the application will run out of log file space + in roughly 9 years. + + There is no way to reset the log file name space in Berke- + ley DB. If your application is reaching the end of its + log file name space, you should: + + 1. Archive your databases as if to prepare for catas- + trophic failure (see _d_b___a_r_c_h_i_v_e(1) for more informa- + tion). + + 2. Dump and re-load aallll your databases (see _d_b___d_u_m_p(1) + and _d_b___l_o_a_d(1) for more information). + + 3. Remove all of the log files from the database envi- + ronment (see _d_b___a_r_c_h_i_v_e(1) for more information). + + 4. Restart your applications. + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _d_b___l_o_g: + + DB_HOME + If the _d_b_e_n_v argument to _l_o_g___o_p_e_n was initialized + using _d_b___a_p_p_i_n_i_t, the environment variable DB_HOME + may be used as the path of the database home for the + interpretation of the _d_i_r argument to _l_o_g___o_p_e_n, as + described in _d_b___a_p_p_i_n_i_t(3). Specifically, _l_o_g___o_p_e_n + is affected by the configuration string value of + DB_LOG_DIR. + + TMPDIR + If the _d_b_e_n_v argument to _l_o_g___o_p_e_n was NULL or not + initialized using _d_b___a_p_p_i_n_i_t, the environment vari- + able TMPDIR may be used as the directory in which to + create the log, as described in the _l_o_g___o_p_e_n section + above. +EERRRROORRSS + The _l_o_g___o_p_e_n function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: atoi(3), close(2), db_version(3), fcntl(2), + fflush(3), log_close(3), log_unlink(3), lseek(2), mal- + loc(3), memcpy(3), memset(3), mmap(2), munmap(2), open(2), + opendir(3), read(2), readdir(3), realloc(3), sig- + fillset(3), sigprocmask(2), stat(2), strchr(3), strcpy(3), + strdup(3), strerror(3), strlen(3), strncmp(3), unlink(2), + and write(2). + + In addition, the _l_o_g___o_p_e_n function may fail and return + _e_r_r_n_o for the following conditions: + + [EAGAIN] + The shared memory region was locked and (repeatedly) + unavailable. + + [EINVAL] + An invalid flag value or parameter was specified. + + The DB_THREAD flag was specified and spinlocks are + not implemented for this architecture. + + The specified file size was too large. + + The _l_o_g___c_l_o_s_e function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: close(2), fcntl(2), fflush(3), munmap(2), and + strerror(3). + + The _l_o_g___f_l_u_s_h function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: close(2), fcntl(2), fflush(3), fsync(2), + lseek(2), malloc(3), memcpy(3), memset(3), open(2), sig- + fillset(3), sigprocmask(2), stat(2), strcpy(3), strdup(3), + strerror(3), strlen(3), unlink(2), and write(2). + + In addition, the _l_o_g___f_l_u_s_h function may fail and return + _e_r_r_n_o for the following conditions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The _l_o_g___g_e_t function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: atoi(3), close(2), fcntl(2), fflush(3), + lseek(2), malloc(3), memcpy(3), memset(3), open(2), + opendir(3), read(2), readdir(3), realloc(3), sig- + fillset(3), sigprocmask(2), stat(2), strchr(3), strcpy(3), + strdup(3), strerror(3), strlen(3), strncmp(3), and + unlink(2). + + In addition, the _l_o_g___g_e_t function may fail and return + _e_r_r_n_o for the following conditions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The DB_FIRST flag was specified and no log files were + found. + + The _l_o_g___f_i_l_e function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: close(2), fcntl(2), fflush(3), malloc(3), mem- + cpy(3), memset(3), open(2), sigfillset(3), sigprocmask(2), + stat(2), strcpy(3), strdup(3), strerror(3), strlen(3), and + unlink(2). + + In addition, the _l_o_g___f_i_l_e function may fail and return + _e_r_r_n_o for the following conditions: + + [ENOMEM] + The supplied buffer was too small to hold the log + file name. + + The _l_o_g___p_u_t function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: close(2), fcntl(2), fflush(3), fsync(2), + lseek(2), malloc(3), memcpy(3), memset(3), open(2), sig- + fillset(3), sigprocmask(2), stat(2), strcpy(3), strdup(3), + strerror(3), strlen(3), time(3), unlink(2), and write(2). + + In addition, the _l_o_g___p_u_t function may fail and return + _e_r_r_n_o for the following conditions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The record to be logged is larger than the maximum + log record. + + The _l_o_g___u_n_l_i_n_k function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: close(2), fcntl(2), fflush(3), malloc(3), mem- + cpy(3), memset(3), mmap(2), munmap(2), open(2), sig- + fillset(3), sigprocmask(2), stat(2), strcpy(3), strdup(3), + strerror(3), strlen(3), and unlink(2). + + In addition, the _l_o_g___u_n_l_i_n_k function may fail and return + _e_r_r_n_o for the following conditions: + + [EBUSY] + The shared memory region was in use and the force + flag was not set. + + The _l_o_g___a_r_c_h_i_v_e function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: close(2), fcntl(2), fflush(3), getcwd(3), + log_compare(3), log_get(3), malloc(3), memcpy(3), mem- + set(3), open(2), qsort(3), realloc(3), sigfillset(3), sig- + procmask(2), stat(2), strchr(3), strcmp(3), strcpy(3), + strdup(3), strerror(3), strlen(3), and unlink(2). + + In addition, the _l_o_g___a_r_c_h_i_v_e function may fail and return + _e_r_r_n_o for the following conditions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The log was corrupted. + + The _l_o_g___r_e_g_i_s_t_e_r function may fail and return _e_r_r_n_o for + any of the errors specified for the following DB and + library functions: close(2), fcntl(2), fflush(3), + fsync(2), lseek(2), malloc(3), memcmp(3), memcpy(3), mem- + set(3), open(2), realloc(3), sigfillset(3), sigproc- + mask(2), stat(2), strcpy(3), strdup(3), strerror(3), + strlen(3), time(3), unlink(2), and write(2). + + In addition, the _l_o_g___r_e_g_i_s_t_e_r function may fail and return + _e_r_r_n_o for the following conditions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The _l_o_g___u_n_r_e_g_i_s_t_e_r function may fail and return _e_r_r_n_o for + any of the errors specified for the following DB and + library functions: close(2), fcntl(2), fflush(3), + fsync(2), lseek(2), malloc(3), memcpy(3), memset(3), + open(2), sigfillset(3), sigprocmask(2), stat(2), str- + cpy(3), strdup(3), strerror(3), strlen(3), time(3), + unlink(2), and write(2). + + In addition, the _l_o_g___u_n_r_e_g_i_s_t_e_r function may fail and + return _e_r_r_n_o for the following conditions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The _l_o_g___s_t_a_t function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: fcntl(2), and malloc(3). + +BBUUGGSS + The log files are not machine architecture independent. + Specifically, log file metadata is not stored in a fixed + byte order. + +SSEEEE AALLSSOO + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/man.text/db_mpool.0 b/mozilla/db/man/man.text/db_mpool.0 new file mode 100644 index 00000000000..828531278c8 --- /dev/null +++ b/mozilla/db/man/man.text/db_mpool.0 @@ -0,0 +1,919 @@ + + +NNAAMMEE + db_mpool - shared memory buffer pool + +SSYYNNOOPPSSIISS + ##iinncclluuddee <> + + iinntt + mmeemmpp__ooppeenn((cchhaarr **ddiirr,, + uu__iinntt3322__tt ffllaaggss,, iinntt mmooddee,, DDBB__EENNVV **ddbbeennvv,, DDBB__MMPPOOOOLL ****rreeggiioonnpp));; + + iinntt + mmeemmpp__cclloossee((DDBB__MMPPOOOOLL **mmpp));; + + iinntt + mmeemmpp__ffooppeenn((DDBB__MMPPOOOOLL **mmpp,, cchhaarr **ffiillee,, uu__iinntt3322__tt ffllaaggss,, iinntt mmooddee,, + ssiizzee__tt ppaaggeessiizzee,, DDBB__MMPPOOOOLL__FFIINNFFOO **ffiinnffoopp,, DDBB__MMPPOOOOLLFFIILLEE ****mmppff));; + + iinntt + mmeemmpp__ffcclloossee((DDBB__MMPPOOOOLLFFIILLEE **mmppff));; + + iinntt + mmeemmpp__ffggeett((DDBB__MMPPOOOOLLFFIILLEE **mmppff,, + ddbb__ppggnnoo__tt **ppggnnooaaddddrr,, uu__iinntt3322__tt ffllaaggss,, vvooiidd ****ppaaggeepp));; + + iinntt + mmeemmpp__ffppuutt((DDBB__MMPPOOOOLLFFIILLEE **mmppff,, vvooiidd **ppggaaddddrr,, uu__iinntt3322__tt ffllaaggss));; + + iinntt + mmeemmpp__ffsseett((DDBB__MMPPOOOOLLFFIILLEE **mmppff,, vvooiidd **ppggaaddddrr,, uu__iinntt3322__tt ffllaaggss));; + + iinntt + mmeemmpp__ffssyynncc((DDBB__MMPPOOOOLLFFIILLEE **mmppff));; + + iinntt + mmeemmpp__uunnlliinnkk((ccoonnsstt cchhaarr **ddiirr,, iinntt ffoorrccee,, DDBB__EENNVV **));; + + iinntt + mmeemmpp__rreeggiisstteerr((DDBB__MMPPOOOOLL **mmpp,, iinntt ffttyyppee,, + iinntt ((**ppggiinn))((ddbb__ppggnnoo__tt ppggnnoo,, vvooiidd **ppggaaddddrr,, DDBBTT **ppggccooookkiiee)),, + iinntt ((**ppggoouutt))((ddbb__ppggnnoo__tt ppggnnoo,, vvooiidd **ppggaaddddrr,, DDBBTT **ppggccooookkiiee))));; + + iinntt + mmeemmpp__ttrriicckkllee((DDBB__MMPPOOOOLL **mmpp,, iinntt ppcctt,, iinntt **nnwwrrootteepp));; + + iinntt + mmeemmpp__ssyynncc((DDBB__MMPPOOOOLL **mmpp,, LLSSNN **llssnn));; + + iinntt + mmeemmpp__ssttaatt((DDBB__MMPPOOOOLL **mmpp,, DDBB__MMPPOOOOLL__SSTTAATT ****ggsspp,, + DDBB__MMPPOOOOLL__FFSSTTAATT **((**ffsspp))[[]],, vvooiidd **((**ddbb__mmaalllloocc))((ssiizzee__tt))));; + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + This manual page describes the specific details of the + memory pool interface. + + The _d_b___m_p_o_o_l functions are the library interface intended + to provide general-purpose, page-oriented buffer manage- + ment of one or more files. While designed to work with + the other DB functions, these functions are also useful + for more general purposes. The memory pools (DB_MPOOL's) + are referred to in this document as simply ``pools''. + Pools may be shared between processes. Pools are usually + filled by pages from one or more files (DB_MPOOLFILE's). + Pages in the pool are replaced in LRU (least-recently- + used) order, with each new page replacing the page that + has been unused the longest. Pages retrieved from the + pool using _m_e_m_p___f_g_e_t are ``pinned'' in the pool, by + default, until they are returned to the pool's control + using the _m_e_m_p___f_p_u_t function. + + _m_e_m_p___o_p_e_n + The _m_e_m_p___o_p_e_n function copies a pointer, to the memory + pool identified by the ddiirreeccttoorryy _d_i_r, into the memory + location referenced by _r_e_g_i_o_n_p. + + If the _d_b_e_n_v argument to _m_e_m_p___o_p_e_n was initialized using + _d_b___a_p_p_i_n_i_t, _d_i_r is interpreted as described by + _d_b___a_p_p_i_n_i_t(3). + + Otherwise, if _d_i_r is not NULL, it is interpreted relative + to the current working directory of the process. If _d_i_r + is NULL, the following environment variables are checked + in order: ``TMPDIR'', ``TEMP'', and ``TMP''. If one of + them is set, memory pool files are created relative to the + directory it specifies. If none of them are set, the + first possible one of the following directories is used: + _/_v_a_r_/_t_m_p, _/_u_s_r_/_t_m_p, _/_t_e_m_p, _/_t_m_p, _C_:_/_t_e_m_p and _C_:_/_t_m_p. + + All files associated with the memory pool are created in + this directory. This directory must already exist when + + memory pool_open is called. If the memory pool already + exists, the process must have permission to read and write + the existing files. If the memory pool does not already + exist, it is optionally created and initialized. + + The _f_l_a_g_s and _m_o_d_e arguments specify how files will be + opened and/or created when they don't already exist. The + flags value is specified by oorr'ing together one or more of + the following values: + DB_CREATE + Create any underlying files, as necessary. If the + files do not already exist and the DB_CREATE flag is + not specified, the call will fail. + + DB_MPOOL_PRIVATE + Create a private MPOOL that is not shared with any + other process (although it may be shared with other + threads). + + DB_NOMMAP + Always copy files in this memory pool into the local + cache instead of mapping them into process memory + (see the description of the _m_p___m_m_a_p_s_i_z_e field of the + DB_ENV structure for further information). + + + DB_THREAD + Cause the DB_MPOOL handle returned by the _m_e_m_p___o_p_e_n + function to be useable by multiple threads within a + single address space, i.e., to be ``free-threaded''. + + All files created by the memory pool subsystem (other than + files created by the _m_e_m_p___f_o_p_e_n function, which are sepa- + rately specified) are created with mode _m_o_d_e (as described + in _c_h_m_o_d(2)) and modified by the process' umask value at + the time of creation (see _u_m_a_s_k(2)). The group ownership + of created files is based on the system and directory + defaults, and is not further specified by DB. + + The memory pool subsystem is configured based on the _d_b_e_n_v + argument to _m_e_m_p___o_p_e_n, which is a pointer to a structure + of type DB_ENV (typedef'd in ). Applications will + normally use the same DB_ENV structure (initialized by + _d_b___a_p_p_i_n_i_t(3)), as an argument to all of the subsystems in + the DB package. + + References to the DB_ENV structure are maintained by DB, + so it may not be discarded until the last close function, + corresponding to an open function for which it was an + argument, has returned. In order to ensure compatibility + with future releases of DB, all fields of the DB_ENV + structure that are not explicitly set should be initial- + ized to 0 before the first time the structure is used. Do + this by declaring the structure external or static, or by + calling the C library routine _b_z_e_r_o(3) or _m_e_m_s_e_t(3). + + The fields of the DB_ENV structure used by _m_e_m_p___o_p_e_n are + described below. If _d_b_e_n_v is NULL or any of its fields + are set to 0, defaults appropriate for the system are used + where possible. + + The following fields in the DB_ENV structure may be ini- + tialized before calling _m_e_m_p___o_p_e_n: + void *(*db_errcall)(char *db_errpfx, char *buffer); + FILE *db_errfile; + const char *db_errpfx; + int db_verbose; + The error fields of the DB_ENV behave as described + for _d_b___a_p_p_i_n_i_t(3). + + + + size_t mp_mmapsize; + Files that are opened read-only in the pool (and that + satisfy a few other criteria) are, by default, mapped + into the process address space instead of being + copied into the local cache. This can result in bet- + ter-than-usual performance, as available virtual mem- + ory is normally much larger than the local cache, and + page faults are faster than page copying on many sys- + tems. However, in the presence of limited virtual + memory it can cause resource starvation, and in the + presence of large databases, it can result in immense + process sizes. If _m_p___m_m_a_p_s_i_z_e is non-zero, it speci- + fies the maximum file size, in bytes, for a file to + be mapped into the process address space. By + default, it is set to 10Mb. + + size_t mp_size; + The suggested size of the pool, in bytes. This + should be the size of the normal working data set of + the application, with some small amount of additional + memory for unusual situations. (Note, the working + set is not the same as the number of simultaneously + referenced pages, and should be quite a bit larger!) + The default cache size is 128K bytes (16 8K byte + pages), and may not be less than 20K bytes. + + The _m_e_m_p___o_p_e_n function returns the value of _e_r_r_n_o on fail- + ure and 0 on success. + + _m_e_m_p___c_l_o_s_e + The _m_e_m_p___c_l_o_s_e function closes the pool indicated by the + DB_MPOOL pointer _m_p, as returned by _m_e_m_p___o_p_e_n. This func- + tion does not imply a call to _m_e_m_p___f_s_y_n_c, but does imply a + call to _m_e_m_p___f_c_l_o_s_e for any remaining open DB_MPOOLFILE + pointers returned to this process by calls to _m_e_m_p___f_o_p_e_n. + + In addition, if the _d_i_r argument to _m_e_m_p___o_p_e_n was NULL and + _d_b_e_n_v was not initialized using _d_b___a_p_p_i_n_i_t, or the + DB_MPOOL_PRIVATE flag was set, all files created for this + shared region will be removed, as if _m_e_m_p___u_n_l_i_n_k were + called. + + When multiple threads are using the DB_MPOOL handle con- + currently, only a single thread may call the _m_e_m_p___c_l_o_s_e + function. + + The _m_e_m_p___c_l_o_s_e function returns the value of _e_r_r_n_o on + failure and 0 on success. + + _m_e_m_p___f_o_p_e_n + The _m_e_m_p___f_o_p_e_n function opens a file in the pool specified + by the DB_MPOOL argument, copying the DB_MPOOLFILE pointer + representing it into the memory location referenced by + _m_p_f. + + The _f_i_l_e argument is the name of the file to be opened. + If _f_i_l_e is NULL, a private file is created that cannot be + shared with any other process (although it may be shared + with other threads). + + The _f_l_a_g_s and _m_o_d_e arguments specify how files will be + opened and/or created when they don't already exist. The + flags value is specified by oorr'ing together one or more of + the following values: + + DB_CREATE + Create any underlying files, as necessary. If the + files do not already exist and the DB_CREATE flag is + not specified, the call will fail. + + DB_NOMMAP + Always copy this file into the local cache instead of + mapping it into process memory (see the description + of the _m_p___m_m_a_p_s_i_z_e field of the DB_ENV structure for + further information). + + DB_RDONLY + Open any underlying files for reading only. Any + attempt to write the file using the pool functions + will fail, regardless of the actual permissions of + the file. + + All files created by the function _m_e_m_p___f_o_p_e_n are created + with mode _m_o_d_e (as described in _c_h_m_o_d(2)) and modified by + the process' umask value at the time of creation (see + _u_m_a_s_k(2)). The group ownership of created files is based + on the system and directory defaults, and is not further + specified by DB. + + The _p_a_g_e_s_i_z_e argument is the size, in bytes, of the unit + of transfer between the application and the pool, although + it is not necessarily the unit of transfer between the + pool and the source file. + + Files opened in the pool may be further configured based + on the _f_i_n_f_o_p argument to _m_e_m_p___f_o_p_e_n, which is a pointer + to a structure of type DB_MPOOL_FINFO (typedef'd in + ). No references to the _f_i_n_f_o_p structure are main- + tained by DB, so it may be discarded when the _m_e_m_p___f_o_p_e_n + function returns. In order to ensure compatibility with + future releases of DB, all fields of the DB_MPOOL_FINFO + structure that are not explicitly set should be initial- + ized to 0 before the first time the structure is used. Do + this by declaring the structure external or static, or by + calling the C library routine _b_z_e_r_o(3) or _m_e_m_s_e_t(3). + + The fields of the DB_MPOOL_FINFO structure used by + _m_e_m_p___f_o_p_e_n are described below. If _f_i_n_f_o_p is NULL or any + of its fields are set to their default value, defaults + appropriate for the system are used. + + int ftype; + The _f_t_y_p_e field should be the same as a _f_t_y_p_e argu- + ment previously specified to the _m_e_m_p___r_e_g_i_s_t_e_r func- + tion, unless no input or output processing of the + file's pages are necessary, in which case it should + be 0. (See the description of the _m_e_m_p___r_e_g_i_s_t_e_r + function for more information.) + + DBT *pgcookie; + The _p_g_c_o_o_k_i_e field contains the byte string that is + passed to the _p_g_i_n and _p_g_o_u_t functions for this file, + if any. If no _p_g_i_n or _p_g_o_u_t functions are specified, + the _p_g_c_o_o_k_i_e field should be NULL. (See the descrip- + tion of the _m_e_m_p___r_e_g_i_s_t_e_r function for more informa- + tion.) + + u_int8_t *fileid; + The _f_i_l_e_i_d field is a unique identifier for the file. + The mpool functions must be able to uniquely identify + files in order that multiple processes sharing a file + will correctly share its underlying pages. Normally, + the _f_i_l_e_i_d field should be NULL and the mpool func- + tions will use the file's device and inode numbers + (see _s_t_a_t(2)) for this purpose. On some filesystems, + (e.g., FAT or NFS) file device and inode numbers are + not necessarily unique across system reboots. AAppppllii-- + ccaattiioonnss wwaannttiinngg ttoo mmaaiinnttaaiinn aa sshhaarreedd mmeemmoorryy bbuuffffeerr + ppooooll aaccrroossss ssyysstteemm rreebboooottss,, wwhheerree tthhee ppooooll ccoonnttaaiinnss + ppaaggeess ffrroomm ffiilleess ssttoorreedd oonn ssuucchh ffiilleessyysstteemmss,, mmuusstt + ssppeecciiffyy aa uunniiqquuee ffiillee iiddeennttiiffiieerr ttoo tthhee _m_e_m_p___f_o_p_e_n + call and each process opening or registering the file + must provide the same unique identifier. If the + _f_i_l_e_i_d field is non-NULL, it must reference a + DB_FILE_ID_LEN (as defined in ) length array of + bytes that will be used to uniquely identify the + file. This should not be necessary for most applica- + tions. Specifically, it is not necessary if the mem- + ory pool is re-instantiated after each system reboot, + the application is using the DB access methods + instead of calling the pool functions explicitly, or + the files in the memory pool are stored on filesys- + tems where the file device and inode numbers do not + change across system reboots. + int32_t lsn_offset; + The _l_s_n___o_f_f_s_e_t field is the zero-based byte offset in + the page of the page's log sequence number (LSN), or + -1 if no LSN offset is specified. (See the descrip- + tion of the _m_e_m_p___s_y_n_c function for more information.) + + u_int32_t clear_len; + The _c_l_e_a_r___l_e_n field is the number of initial bytes in + a page that should be set to zero when the page is + created as a result of the DB_MPOOL_CREATE or + DB_MPOOL_NEW flags being specified to _m_e_m_p___f_g_e_t. If + _f_i_n_f_o_p is NULL or _c_l_e_a_r___l_e_n is 0, the entire page is + cleared. + + The _m_e_m_p___f_o_p_e_n function returns the value of _e_r_r_n_o on + failure and 0 on success. + + _m_e_m_p___f_c_l_o_s_e + The _m_e_m_p___f_c_l_o_s_e function closes the source file indicated + by the DB_MPOOLFILE pointer _m_p_f. This function does not + imply a call to _m_e_m_p___f_s_y_n_c, i.e. no pages are written to + the source file as as a result of calling _m_e_m_p___f_c_l_o_s_e. + + In addition, if the _f_i_l_e argument to _m_e_m_p___f_o_p_e_n was NULL, + any underlying files created for this DB_MPOOLFILE will be + removed. + + The _m_e_m_p___f_c_l_o_s_e function returns the value of _e_r_r_n_o on + failure and 0 on success. + + _m_e_m_p___f_g_e_t + The _m_e_m_p___f_g_e_t function copies a pointer to the page with + the page number specified by _p_g_n_o_a_d_d_r, from the source + file specified by the DB_MPOOLFILE pointer _m_p_f, into the + memory location referenced by _p_a_g_e_p. If the page does not + exist or cannot be retrieved, _m_e_m_p___f_g_e_t will fail. + + The returned page is size_t type aligned. + + PPaaggee nnuummbbeerrss bbeeggiinn aatt 00,, ee..gg..,, tthhee ffiirrsstt ppaaggee iinn tthhee ffiillee + iiss ppaaggee nnuummbbeerr 00,, nnoott ppaaggee nnuummbbeerr 11.. + + The _f_l_a_g_s argument is specified by oorr'ing together one or + more of the following values: + + DB_MPOOL_CREATE + If the specified page does not exist, create it. In + this case, the _p_g_i_n function, if specified, is + called. + + DB_MPOOL_LAST + Return the last page of the source file and copy its + page number to the location referenced by _p_g_n_o_a_d_d_r. + + DB_MPOOL_NEW + Create a new page in the file and copy its page num- + ber to the location referenced by _p_g_n_o_a_d_d_r. In this + case, the _p_g_i_n function, if specified, is not called. + + The DB_MPOOL_CREATE, DB_MPOOL_LAST and DB_MPOOL_NEW flags + are mutually exclusive. + + Created pages have all their bytes set to 0, unless other- + wise specified when the file was opened. + + All pages returned by _m_e_m_p___f_g_e_t will be retained (i.e. + ``pinned'') in the pool until a subsequent call to + _m_e_m_p___f_p_u_t. + + The _m_e_m_p___f_g_e_t function returns the value of _e_r_r_n_o on fail- + ure and 0 on success. + + _m_e_m_p___f_p_u_t + The _m_e_m_p___f_p_u_t function indicates that the page referenced + by _p_g_a_d_d_r can be evicted from the pool. _P_g_a_d_d_r must be an + address previously returned by _m_e_m_p___f_g_e_t. + + The _f_l_a_g_s argument is specified by oorr'ing together one or + more of the following values: + + DB_MPOOL_CLEAN + Clear any previously set modification information + (i.e., don't bother writing the page back to the + source file). + + DB_MPOOL_DIRTY + The page has been modified and must be written to the + source file before being evicted from the pool. + + DB_MPOOL_DISCARD + The page is unlikely to be useful in the near future, + and should be discarded before other pages in the + pool. + + The DB_MPOOL_CLEAN and DB_MPOOL_DIRTY flags are mutually + exclusive. + + The _m_e_m_p___f_p_u_t function returns the value of _e_r_r_n_o on fail- + ure and 0 on success. + + _m_e_m_p___f_s_e_t + The _m_e_m_p___f_s_e_t function sets the flags associated with the + page referenced by _p_g_a_d_d_r without unpinning it from the + pool. _P_g_a_d_d_r must be an address previously returned by + _m_e_m_p___f_g_e_t. The _f_l_a_g_s argument to _m_e_m_p___f_s_e_t is specified + by oorr'ing together one or more of the values specified as + flags for the _m_e_m_p___f_p_u_t call. + + + The _m_e_m_p___f_s_e_t function returns the value of _e_r_r_n_o on fail- + ure and 0 on success. + + _m_e_m_p___f_s_y_n_c + The _m_e_m_p___f_s_y_n_c function writes all pages associated with + the DB_MPOOLFILE pointer _m_p_f, that were marked as modified + using _m_e_m_p___f_p_u_t or _m_e_m_p___f_s_e_t, back to the source file. If + any of the modified pages are also pinned (i.e., currently + referenced by this or another process) _m_e_m_p___f_s_y_n_c will + ignore them. + + The _m_e_m_p___f_s_y_n_c function returns the value of _e_r_r_n_o on + failure, 0 on success, and DB_INCOMPLETE if there were + pages which were modified but which _m_e_m_p___f_s_y_n_c was unable + to write. + + + _m_e_m_p___u_n_l_i_n_k + The _m_e_m_p___u_n_l_i_n_k function destroys the memory pool identi- + fied by the directory _d_i_r, removing all files used to + implement the memory pool. (The directory _d_i_r is not + removed.) If there are processes that have called + _m_e_m_p___o_p_e_n without calling _m_e_m_p___c_l_o_s_e (i.e., there are pro- + cesses currently using the memory pool), _m_e_m_p___u_n_l_i_n_k will + fail without further action, unless the force flag is set, + in which case _m_e_m_p___u_n_l_i_n_k will attempt to remove the mem- + ory pool files regardless of any processes still using the + memory pool. + + The result of attempting to forcibly destroy the region + when a process has the region open is unspecified. Pro- + cesses using a shared memory region maintain an open file + descriptor for it. On UNIX systems, the region removal + should succeed and processes that have already joined the + region should continue to run in the region without + change, however processes attempting to join the memory + pool will either fail or attempt to create a new region. + On other systems, e.g., WNT, where the _u_n_l_i_n_k(2) system + call will fail if any process has an open file descriptor + for the file, the region removal will fail. + + In the case of catastrophic or system failure, database + recovery must be performed (see _d_b___r_e_c_o_v_e_r(1) or the + DB_RECOVER and DB_RECOVER_FATAL flags to _d_b___a_p_p_i_n_i_t(3)). + Alternatively, if recovery is not required because no + database state is maintained across failures, it is possi- + ble to clean up a memory pool by removing all of the files + in the directory specified to the _m_e_m_p___o_p_e_n function, as + memory pool files are never created in any directory other + than the one specified to _m_e_m_p___o_p_e_n. Note, however, that + this has the potential to remove files created by the + other DB subsystems in this database environment. + + The _m_e_m_p___u_n_l_i_n_k function returns the value of _e_r_r_n_o on + failure and 0 on success. + + _m_e_m_p___r_e_g_i_s_t_e_r + The _m_e_m_p___r_e_g_i_s_t_e_r function registers page-in and page-out + functions for files of type _f_t_y_p_e in the specified pool. + + If the _p_g_i_n function is non-NULL, it is called each time a + page is read into the memory pool from a file of type + _f_t_y_p_e, or a page is created for a file of type _f_t_y_p_e (see + the DB_MPOOL_CREATE flag for the _m_e_m_p___f_g_e_t function). If + the _p_g_o_u_t function is non-NULL, it is called each time a + page is written to a file of type _f_t_y_p_e. + + Both the _p_g_i_n and _p_g_o_u_t functions are called with the page + number, a pointer to the page being read or written, and + any argument _p_g_c_o_o_k_i_e that was specified to the _m_e_m_p___f_o_p_e_n + function when the file was opened. The _p_g_i_n and _p_g_o_u_t + functions should return 0 on success, and an applicable + non-zero _e_r_r_n_o value on failure, in which case the + _d_b___m_p_o_o_l function calling it will also fail, returning + that _e_r_r_n_o value. + + The purpose of the _m_e_m_p___r_e_g_i_s_t_e_r function is to support + processing when pages are entered into, or flushed from, + the pool. A file type must be specified to make it possi- + ble for unrelated threads or processes, that are sharing a + pool, to evict each other's pages from the pool. Applica- + tions should call _m_e_m_p___r_e_g_i_s_t_e_r, during initialization, + for each type of file requiring input or output processing + that will be sharing the underlying pool. (No registry is + necessary for the standard access method types, btree, + hash and recno, as _d_b___o_p_e_n(3) registers them separately.) + + If a thread or process does not call _m_e_m_p___r_e_g_i_s_t_e_r for a + file type, it is impossible for it to evict pages for any + file requiring input or output processing from the pool. + For this reason, _m_e_m_p___r_e_g_i_s_t_e_r should always be called by + each application sharing a pool for each type of file + included in the pool, regardless of whether or not the + application itself uses files of that type. + + There are no standard values for _f_t_y_p_e, _p_g_i_n, _p_g_o_u_t and + _p_g_c_o_o_k_i_e, except that the _f_t_y_p_e value for a file must be a + non-zero positive number, as negative numbers are reserved + for internal use by the DB library. For this reason, + applications sharing a pool must coordinate their values + amongst themselves. + + The _m_e_m_p___r_e_g_i_s_t_e_r function returns the value of _e_r_r_n_o on + failure and 0 on success. + + _m_e_m_p___t_r_i_c_k_l_e + The _m_e_m_p___t_r_i_c_k_l_e function ensures that at least _p_c_t per- + cent of the pages in the shared memory pool are clean by + writing dirty pages to their backing files. If the + _n_w_r_o_t_e_p argument is non-NULL, the number of pages that + were written to reach the correct percentage is returned + in the memory location it references. + + The purpose of the _m_e_m_p___t_r_i_c_k_l_e function is to enable a + memory pool manager to ensure that a page is always avail- + able for reading in new information without having to wait + for a write. + + The _m_e_m_p___t_r_i_c_k_l_e function returns the value of _e_r_r_n_o on + failure and 0 on success. + + _m_e_m_p___s_y_n_c + The _m_e_m_p___s_y_n_c function ensures that all the modified pages + in the pool with log sequence numbers (LSNs) less than the + _l_s_n argument are written to disk. + + The _m_e_m_p___s_y_n_c function returns the value of _e_r_r_n_o on fail- + ure, 0 on success, and DB_INCOMPLETE if there were pages + which need to be written but which _m_e_m_p___s_y_n_c was unable to + write immediately. In addition, if _m_e_m_p___s_y_n_c returns suc- + cess, the value of _l_s_n will be overwritten with the + largest LSN from any page which was written by _m_e_m_p___s_y_n_c + to satisfy this request. + + The purpose of the _m_e_m_p___s_y_n_c function is to enable a + transaction manager to ensure, as part of a checkpoint, + that all pages modified by a certain time have been writ- + ten to disk. Pages in the pool which cannot be written + back to disk immediately (e.g., are currently pinned) are + written to disk as soon as it is possible to do so. The + expected behavior of the transaction manager is to call + the _m_e_m_p___s_y_n_c function and then, if the return indicates + that some pages could not be written immediately, to wait + briefly and retry again with the same LSN until the + _m_e_m_p___s_y_n_c function returns that all pages have been writ- + ten. + + To support the _m_e_m_p___s_y_n_c functionality, it is necessary + that the pool functions know the location of the LSN on + the page for each file type. This location should be + specified when the file is opened using the _m_e_m_p___f_o_p_e_n + function. (Note, it is not required that the LSN be + aligned on the page in any way.) + + _m_e_m_p___s_t_a_t + The _m_e_m_p___s_t_a_t function creates statistical structures and + copies pointers to them into user-specified memory loca- + tions. The statistics include the number of files partic- + ipating in the pool, the active pages in the pool, and + information as to how effective the cache has been. + + Statistical structures are created in allocated memory. + + If _d_b___m_a_l_l_o_c is non-NULL, it is called to allocate the + memory, otherwise, the library function _m_a_l_l_o_c(3) is used. + The function _d_b___m_a_l_l_o_c must match the calling conventions + of the _m_a_l_l_o_c(3) library routine. Regardless, the caller + is responsible for deallocating the returned memory. To + deallocate the returned memory, free each returned memory + pointer; pointers inside the memory do not need to be + individually freed. + + If _g_s_p is non-NULL, the global statistics for the memory + pool _m_p are copied into the memory location it references. + The global statistics are stored in a structure of type + DB_MPOOL_STAT (typedef'd in ). + + The following DB_MPOOL_STAT fields will be filled in: + + u_int32_t st_refcnt; + The number of references to the region. + u_int32_t st_regsize; + The size of the region. + size_t st_cachesize; + Cache size in bytes. + u_int32_t st_cache_hit; + Requested pages found in the cache. + u_int32_t st_cache_miss; + Requested pages not found in the cache. + u_int32_t st_map; + Requested pages mapped into the process' address + space (there is no available information as to + whether or not this request caused disk I/O, although + examining the application page fault rate may be + helpful). + u_int32_t st_page_create; + Pages created in the cache. + u_int32_t st_page_in; + Pages read into the cache. + u_int32_t st_page_out; + Pages written from the cache to the backing file. + u_int32_t st_ro_evict; + Clean pages forced from the cache. + u_int32_t st_rw_evict; + Dirty pages forced from the cache. + u_int32_t st_hash_buckets; + Number of hash buckets in buffer hash table. + u_int32_t st_hash_searches; + Total number of buffer hash table lookups. + u_int32_t st_hash_longest; + The longest chain ever encountered in buffer hash + table lookups. + u_int32_t st_hash_examined; + Total number of hash elements traversed during hash + table lookups. + u_int32_t st_page_clean; + Clean pages currently in the cache. + u_int32_t st_page_dirty; + Dirty pages currently in the cache. + u_int32_t st_page_trickle; + Dirty pages written using the _m_e_m_p___t_r_i_c_k_l_e interface. + u_int32_t st_region_wait; + The number of times that a thread of control was + forced to wait before obtaining the region lock. + u_int32_t st_region_nowait; + The number of times that a thread of control was able + to obtain the region lock without waiting. + + If _f_s_p is non-NULL, a pointer to a NULL-terminated vari- + able length array of statistics for individual files, in + the memory pool _m_p, is copied into the memory location it + references. If no individual files currently exist in the + memory pool, _f_s_p will be set to NULL. + + The per-file statistics are stored in structures of type + DB_MPOOL_FSTAT (typedef'd in ). The following + DB_MPOOL_FSTAT fields will be filled in for each file in + the pool, i.e., each element of the array: + + char *file_name; + The name of the file. + size_t st_pagesize; + Page size in bytes. + u_int32_t st_cache_hit; + Requested pages found in the cache. + u_int32_t st_cache_miss; + Requested pages not found in the cache. + u_int32_t st_map; + Requested pages mapped into the process' address + space. + u_int32_t st_page_create; + Pages created in the cache. + u_int32_t st_page_in; + Pages read into the cache. + u_int32_t st_page_out; + Pages written from the cache to the backing file. + + The _m_e_m_p___s_t_a_t function returns the value of _e_r_r_n_o on fail- + ure and 0 on success. + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _d_b___m_p_o_o_l: + + DB_HOME + If the _d_b_e_n_v argument to _m_e_m_p___o_p_e_n was initialized + using _d_b___a_p_p_i_n_i_t, the environment variable DB_HOME + may be used as the path of the database home for the + interpretation of the _d_i_r argument to _m_e_m_p___o_p_e_n, as + described in _d_b___a_p_p_i_n_i_t(3). + + TMPDIR + If the _d_b_e_n_v argument to _m_e_m_p___o_p_e_n was NULL or not + initialized using _d_b___a_p_p_i_n_i_t, the environment vari- + able TMPDIR may be used as the directory in which to + create the memory pool, as described in the _m_e_m_p___o_p_e_n + section above. + +EERRRROORRSS + The _m_e_m_p___o_p_e_n function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: DBmemp->pgin(3), DBmemp->pgout(3), close(2), + db_version(3), fcntl(2), fflush(3), fsync(2), log_com- + pare(3), log_flush(3), lseek(2), malloc(3), memcmp(3), + memcpy(3), memp_close(3), memp_unlink(3), memset(3), + mmap(2), munmap(2), open(2), sigfillset(3), sigproc- + mask(2), stat(2), strcpy(3), strdup(3), strerror(3), + strlen(3), time(3), unlink(2), and write(2). + + In addition, the _m_e_m_p___o_p_e_n function may fail and return + _e_r_r_n_o for the following conditions: + + [EAGAIN] + The shared memory region was locked and (repeatedly) + unavailable. + + [EINVAL] + An invalid flag value or parameter was specified. + + The DB_THREAD flag was specified and spinlocks are + not implemented for this architecture. + + A NULL pathname was specified without the + DB_MPOOL_PRIVATE flag. + + The specified cache size was impossibly small. + + The _m_e_m_p___c_l_o_s_e function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: close(2), fcntl(2), fflush(3), memp_fclose(3), + munmap(2), and strerror(3). + + The _m_e_m_p___f_o_p_e_n function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: DBmemp->pgin(3), DBmemp->pgout(3), close(2), + fcntl(2), fflush(3), fsync(2), log_compare(3), + log_flush(3), lseek(2), malloc(3), memcmp(3), memcpy(3), + memset(3), mmap(2), open(2), sigfillset(3), sigproc- + mask(2), stat(2), strcpy(3), strdup(3), strerror(3), + strlen(3), time(3), unlink(2), and write(2). + + In addition, the _m_e_m_p___f_o_p_e_n function may fail and return + _e_r_r_n_o for the following conditions: + + + [EINVAL] + An invalid flag value or parameter was specified. + + The file has already been entered into the pool, and + the _p_a_g_e_s_i_z_e value is not the same as when the file + was entered into the pool, or the length of the file + is not zero or a multiple of the _p_a_g_e_s_i_z_e. + + The DB_RDONLY flag was specified for an in-memory + pool. + + The _m_e_m_p___f_c_l_o_s_e function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: close(2), fcntl(2), fflush(3), munmap(2), and + strerror(3). + + The _m_e_m_p___f_g_e_t function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: DBmemp->pgin(3), DBmemp->pgout(3), close(2), + fcntl(2), fflush(3), fsync(2), log_compare(3), + log_flush(3), lseek(2), malloc(3), memcmp(3), memcpy(3), + memset(3), mmap(2), open(2), read(2), sigfillset(3), sig- + procmask(2), stat(2), strcpy(3), strdup(3), strerror(3), + strlen(3), time(3), unlink(2), and write(2). + + In addition, the _m_e_m_p___f_g_e_t function may fail and return + _e_r_r_n_o for the following conditions: + + [EAGAIN] + The page reference count has overflowed. (This + should never happen unless there's a bug in the + application.) + + [EINVAL] + An invalid flag value or parameter was specified. + + The DB_MPOOL_NEW flag was set and the source file was + not opened for writing. + + The requested page does not exist and DB_MPOOL_CREATE + was not set. + + More than one of DB_MPOOL_CREATE, DB_MPOOL_LAST and + DB_MPOOL_NEW was set. + + [ENOMEM] + The cache is full and no more pages will fit in the + pool. + + The _m_e_m_p___f_p_u_t function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: DBmemp->pgin(3), DBmemp->pgout(3), close(2), + fcntl(2), fflush(3), fsync(2), log_compare(3), + log_flush(3), lseek(2), malloc(3), memcmp(3), memcpy(3), + memset(3), mmap(2), open(2), sigfillset(3), sigproc- + mask(2), stat(2), strcpy(3), strdup(3), strerror(3), + strlen(3), time(3), unlink(2), and write(2). + + In addition, the _m_e_m_p___f_p_u_t function may fail and return + _e_r_r_n_o for the following conditions: + + [EACCES] + The DB_MPOOL_DIRTY flag was set and the source file + was not opened for writing. + + [EINVAL] + An invalid flag value or parameter was specified. + + The _p_g_a_d_d_r parameter does not reference a page + returned by _m_e_m_p___f_g_e_t. + + More than one of DB_MPOOL_CLEAN and DB_MPOOL_DIRTY + was set. + + The _m_e_m_p___f_s_e_t function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: fcntl(2), and fflush(3). + + In addition, the _m_e_m_p___f_s_e_t function may fail and return + _e_r_r_n_o for the following conditions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The _m_e_m_p___f_s_y_n_c function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: DBmemp->pgin(3), DBmemp->pgout(3), close(2), + fcntl(2), fflush(3), fsync(2), log_compare(3), + log_flush(3), lseek(2), malloc(3), memcpy(3), memset(3), + open(2), qsort(3), realloc(3), sigfillset(3), sigproc- + mask(2), stat(2), strcpy(3), strdup(3), strerror(3), + strlen(3), unlink(2), and write(2). + + The _m_e_m_p___u_n_l_i_n_k function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: close(2), fcntl(2), fflush(3), malloc(3), mem- + cpy(3), memset(3), mmap(2), munmap(2), open(2), sig- + fillset(3), sigprocmask(2), stat(2), strcpy(3), strdup(3), + strerror(3), strlen(3), and unlink(2). + + In addition, the _m_e_m_p___u_n_l_i_n_k function may fail and return + _e_r_r_n_o for the following conditions: + + [EBUSY] + The shared memory region was in use and the force + flag was not set. + + The _m_e_m_p___r_e_g_i_s_t_e_r function may fail and return _e_r_r_n_o for + any of the errors specified for the following DB and + library functions: fcntl(2), and malloc(3). + + The _m_e_m_p___t_r_i_c_k_l_e function may fail and return _e_r_r_n_o for + any of the errors specified for the following DB and + library functions: DBmemp->pgin(3), DBmemp->pgout(3), + close(2), fcntl(2), fflush(3), fsync(2), log_compare(3), + log_flush(3), lseek(2), malloc(3), memcmp(3), memcpy(3), + memset(3), mmap(2), open(2), sigfillset(3), sigproc- + mask(2), stat(2), strcpy(3), strdup(3), strerror(3), + strlen(3), time(3), unlink(2), and write(2). + + In addition, the _m_e_m_p___t_r_i_c_k_l_e function may fail and return + _e_r_r_n_o for the following conditions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The _m_e_m_p___s_y_n_c function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: DBmemp->pgin(3), DBmemp->pgout(3), close(2), + fcntl(2), fflush(3), fsync(2), log_compare(3), + log_flush(3), lseek(2), malloc(3), memcmp(3), memcpy(3), + memset(3), mmap(2), open(2), qsort(3), realloc(3), sig- + fillset(3), sigprocmask(2), stat(2), strcpy(3), strdup(3), + strerror(3), strlen(3), time(3), unlink(2), and write(2). + + In addition, the _m_e_m_p___s_y_n_c function may fail and return + _e_r_r_n_o for the following conditions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The _m_e_m_p___s_y_n_c function was called without logging + having been initialized in the environment. + + The _m_e_m_p___s_t_a_t function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: fcntl(2), malloc(3), memcpy(3), and strlen(3). + +SSEEEE AALLSSOO + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/man.text/db_open.0 b/mozilla/db/man/man.text/db_open.0 new file mode 100644 index 00000000000..8decbce46c7 --- /dev/null +++ b/mozilla/db/man/man.text/db_open.0 @@ -0,0 +1,1210 @@ + + +NNAAMMEE + db_open - database access methods + +SSYYNNOOPPSSIISS + ##iinncclluuddee <> + + iinntt + ddbb__ooppeenn((ccoonnsstt cchhaarr **ffiillee,, DDBBTTYYPPEE ttyyppee,, uu__iinntt3322__tt ffllaaggss,, + iinntt mmooddee,, DDBB__EENNVV **ddbbeennvv,, DDBB__IINNFFOO **ddbbiinnffoo,, DDBB ****ddbbpppp));; + + iinntt + DDBB-->>cclloossee((DDBB **ddbb,, uu__iinntt3322__tt ffllaaggss));; + + iinntt + DDBB-->>ccuurrssoorr((DDBB **ddbb,, DDBB__TTXXNN **ttxxnniidd,, DDBBCC ****ccuurrssoorrpp));; + + iinntt + DDBB-->>ddeell((DDBB **ddbb,, DDBB__TTXXNN **ttxxnniidd,, DDBBTT **kkeeyy,, uu__iinntt3322__tt ffllaaggss));; + + iinntt + DDBB-->>ffdd((DDBB **ddbb,, iinntt **ffddpp));; + + iinntt + DDBB-->>ggeett((DDBB **ddbb,, DDBB__TTXXNN **ttxxnniidd,, DDBBTT **kkeeyy,, DDBBTT **ddaattaa,, uu__iinntt3322__tt ffllaaggss));; + + iinntt + DDBB-->>ppuutt((DDBB **ddbb,, DDBB__TTXXNN **ttxxnniidd,, DDBBTT **kkeeyy,, DDBBTT **ddaattaa,, uu__iinntt3322__tt ffllaaggss));; + + iinntt + DDBB-->>ssyynncc((DDBB **ddbb,, uu__iinntt3322__tt ffllaaggss));; + + iinntt + DDBB-->>ssttaatt((DDBB **ddbb,, vvooiidd **sspp,, vvooiidd **((**ddbb__mmaalllloocc))((ssiizzee__tt)),, uu__iinntt3322__tt ffllaaggss));; + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + This manual page describes the overall structure of the DB + library access methods. + + The currently supported file formats are btree, hashed and + recno. The btree format is a representation of a sorted, + balanced tree structure. The hashed format is an extensi- + ble, dynamic hashing scheme. The recno format supports + fixed or variable length records (optionally retrieved + from a flat text file). + + Storage and retrieval for the DB access methods are based + on key/data pairs, or DBT structures as they are typedef'd + in the include file. See _d_b___d_b_t(3) for specific + information on the structure and capabilities of a DBT. + + The _d_b___o_p_e_n function opens the database represented by + _f_i_l_e for both reading and writing. Files never intended + to be shared or preserved on disk may be created by set- + ting the file parameter to NULL. + + The _d_b___o_p_e_n function copies a pointer to a DB structure + (as typedef'd in the include file), into the memory + location referenced by _d_b_p_p. This structure includes a + set of functions to perform various database actions, as + described below. The _d_b___o_p_e_n function returns the value + of _e_r_r_n_o on failure and 0 on success. + + Note, while most of the access methods use _f_i_l_e as the + name of an underlying file on disk, this is not guaran- + teed. Also, calling _d_b___o_p_e_n is a reasonably expensive + operation. (This is based on a model where the DBMS keeps + a set of files open for a long time rather than opening + and closing them on each query.) + + The _t_y_p_e argument is of type DBTYPE (as defined in the + include file) and must be set to one of DB_BTREE, + DB_HASH, DB_RECNO or DB_UNKNOWN. If _t_y_p_e is DB_UNKNOWN, + the database must already exist and _d_b___o_p_e_n will then + determine if it is of type DB_BTREE, DB_HASH or DB_RECNO. + + The _f_l_a_g_s and _m_o_d_e arguments specify how files will be + opened and/or created when they don't already exist. The + flags value is specified by oorr'ing together one or more of + the following values: + + DB_CREATE + Create any underlying files, as necessary. If the + files do not already exist and the DB_CREATE flag is + not specified, the call will fail. + + DB_NOMMAP + Do not map this file (see _d_b___m_p_o_o_l(3) for further + information). + + DB_RDONLY + Open the database for reading only. Any attempt to + write the database using the access methods will fail + regardless of the actual permissions of any underly- + ing files. + + + DB_THREAD + Cause the DB handle returned by the _d_b___o_p_e_n function + to be useable by multiple threads within a single + address space, i.e., to be ``free-threaded''. + DB_TRUNCATE + ``Truncate'' the database if it exists, i.e., behave + as if the database were just created, discarding any + previous contents. + + All files created by the access methods are created with + mode _m_o_d_e (as described in _c_h_m_o_d(2)) and modified by the + process' umask value at the time of creation (see + _u_m_a_s_k(2)). The group ownership of created files is based + on the system and directory defaults, and is not further + specified by DB. + +DDBB__EENNVV + The access methods make calls to the other subsystems in + the DB library based on the _d_b_e_n_v argument to _d_b___o_p_e_n, + which is a pointer to a structure of type DB_ENV (type- + def'd in ). Applications will normally use the same + DB_ENV structure (initialized by _d_b___a_p_p_i_n_i_t(3)), as an + argument to all of the subsystems in the DB package. + + References to the DB_ENV structure are maintained by DB, + so it may not be discarded until the last close function, + corresponding to an open function for which it was an + argument, has returned. In order to ensure compatibility + with future releases of DB, all fields of the DB_ENV + structure that are not explicitly set should be initial- + ized to 0 before the first time the structure is used. Do + this by declaring the structure external or static, or by + calling the C library routine _b_z_e_r_o(3) or _m_e_m_s_e_t(3). + + The fields of the DB_ENV structure used by _d_b___o_p_e_n are + described below. If _d_b_e_n_v is NULL or any of its fields + are set to 0, defaults appropriate for the system are used + where possible. + + The following fields in the DB_ENV structure may be ini- + tialized before calling _d_b___o_p_e_n: + + DB_LOG *lg_info; + If modifications to the file being opened should be + logged, the _l_g___i_n_f_o field contains a return value + from the function _l_o_g___o_p_e_n. If _l_g___i_n_f_o is NULL, no + logging is done by the DB access methods. + + DB_LOCKTAB *lk_info; + If locking is required for the file being opened (as + is the case when multiple processes or threads are + accessing the same file), the _l_k___i_n_f_o field contains + a return value from the function _l_o_c_k___o_p_e_n. If + _l_k___i_n_f_o is NULL, no locking is done by the DB access + methods. + + If both locking and transactions are being performed + (i.e., both _l_k___i_n_f_o and _t_x___i_n_f_o are non-NULL), the + transaction ID will be used as the locker ID. If + only locking is being performed, _d_b___o_p_e_n will acquire + a locker ID from _l_o_c_k___i_d(3), and will use it for all + locks required for this instance of _d_b___o_p_e_n. + + DB_MPOOL *mp_info; + If the cache for the file being opened should be + maintained in a shared buffer pool, the _m_p___i_n_f_o field + contains a return value from the function _m_e_m_p___o_p_e_n. + If _m_p___i_n_f_o is NULL, a memory pool may still be cre- + ated by DB, but it will be private to the application + and managed by DB. + + DB_TXNMGR *tx_info; + If the accesses to the file being opened should take + place in the context of transactions (providing atom- + icity and error recovery), the _t_x___i_n_f_o field contains + a return value from the function _t_x_n___o_p_e_n (see + _d_b___t_x_n(3)). If transactions are specified, the + application is responsible for making suitable calls + to _t_x_n___b_e_g_i_n, _t_x_n___a_b_o_r_t, and _t_x_n___c_o_m_m_i_t. If _t_x___i_n_f_o + is NULL, no transaction support is done by the DB + access methods. + + When the access methods are used in conjunction with + transactions, the application must abort the transac- + tion (using _t_x_n___a_b_o_r_t) if any of the transaction pro- + tected access method calls (i.e., any calls other + than open, close and sync) returns a system error + (e.g., deadlock, which returns EAGAIN). As described + by _d_b___i_n_t_r_o(3), a system error is any value greater + than 0. + +DDBB__IINNFFOO + The access methods are configured using the DB_INFO data + structure argument to _d_b___o_p_e_n. The DB_INFO structure is + typedef'd in and has a large number of fields, most + specific to a single access method, although a few are + shared. The fields that are common to all access methods + are listed here; those specific to an individual access + method are described below. No reference to the DB_INFO + structure is maintained by DB, so it is possible to dis- + card it as soon as the _d_b___o_p_e_n call returns. + + In order to ensure compatibility with future releases of + DB, all fields of the DB_INFO structure should be initial- + ized to 0 before the structure is used. Do this by + declaring the structure external or static, or by calling + the C library function _b_z_e_r_o(3) or _m_e_m_s_e_t(3). + + If possible, defaults appropriate for the system are used + for the DB_INFO fields if _d_b_i_n_f_o is NULL or any fields of + the DB_INFO structure are set to 0. The following DB_INFO + fields may be initialized before calling _d_b___o_p_e_n: + size_t db_cachesize; + A suggested maximum size of the memory pool cache, in + bytes. If _d_b___c_a_c_h_e_s_i_z_e is 0, an appropriate default + is used. It is an error to specify both the _m_p___i_n_f_o + field and a non-zero _d_b___c_a_c_h_e_s_i_z_e. + + NNoottee,, tthhee mmiinniimmuumm nnuummbbeerr ooff ppaaggeess iinn tthhee ccaacchhee sshhoouulldd + bbee nnoo lleessss tthhaann 1100,, aanndd tthhee aacccceessss mmeetthhooddss wwiillll ffaaiill + iiff aann iinnssuuffffiicciieennttllyy llaarrggee ccaacchhee iiss ssppeecciiffiieedd.. In + addition, for applications that exhibit strong local- + ity in their data access patterns, increasing the + size of the cache can significantly improve applica- + tion performance. + + int db_lorder; + The byte order for integers in the stored database + metadata. The number should represent the order as + an integer, for example, big endian order is the num- + ber 4,321, and little endian order is the number + 1,234. If _d_b___l_o_r_d_e_r is 0, the host order of the + machine where the DB library was compiled is used. + + The value of _d_b___l_o_r_d_e_r is ignored except when + databases are being created. If a database already + exists, the byte order it uses is determined when the + file is read. + + TThhee aacccceessss mmeetthhooddss pprroovviiddee nnoo gguuaarraanntteeeess aabboouutt tthhee + bbyyttee oorrddeerriinngg ooff tthhee aapppplliiccaattiioonn ddaattaa ssttoorreedd iinn tthhee + ddaattaabbaassee,, aanndd aapppplliiccaattiioonnss aarree rreessppoonnssiibbllee ffoorr mmaaiinn-- + ttaaiinniinngg aannyy nneecceessssaarryy oorrddeerriinngg.. + + size_t db_pagesize; + The size of the pages used to hold items in the + database, in bytes. The minimum page size is 512 + bytes and the maximum page size is 64K bytes. If + _d_b___p_a_g_e_s_i_z_e is 0, a page size is selected based on + the underlying filesystem I/O block size. The + selected size has a lower limit of 512 bytes and an + upper limit of 16K bytes. + + void *(*db_malloc)(size_t); + The flag DB_DBT_MALLOC, when specified in the DBT + structure, will cause the DB library to allocate mem- + ory which then becomes the responsibility of the + calling application. See _d_b___d_b_t(3) for more informa- + tion. + + On systems where there may be multiple library ver- + sions of malloc (notably Windows NT), specifying the + DB_DBT_MALLOC flag will fail because the DB library + will allocate memory from a different heap than the + application will use to free it. To avoid this prob- + lem, the _d_b___m_a_l_l_o_c field should be set to point to + the application's allocation routine. If _d_b___m_a_l_l_o_c + is non-NULL, it will be used to allocate the memory + returned when the DB_DBT_MALLOC flag is set. The + _d_b___m_a_l_l_o_c function must match the calling conventions + of the _m_a_l_l_o_c(3) library routine. + +BBTTRREEEE + The btree data structure is a sorted, balanced tree struc- + ture storing associated key/data pairs. Searches, inser- + tions, and deletions in the btree will all complete in O + (lg base N) where base is the average number of keys per + page. Often, inserting ordered data into btrees results + in pages that are half-full. This implementation has been + modified to make ordered (or inverse ordered) insertion + the best case, resulting in nearly perfect page space uti- + lization. + + Space freed by deleting key/data pairs from the database + is never reclaimed from the filesystem, although it is + reused where possible. This means that the btree storage + structure is grow-only. If sufficiently many keys are + deleted from a tree that shrinking the underlying database + file is desirable, this can be accomplished by creating a + new tree from a scan of the existing one. + + The following additional fields and flags may be initial- + ized in the DB_INFO structure before calling _d_b___o_p_e_n, when + using the btree access method: + + int (*bt_compare)(const DBT *, const DBT *); + The _b_t___c_o_m_p_a_r_e function is the key comparison func- + tion. It must return an integer less than, equal to, + or greater than zero if the first key argument is + considered to be respectively less than, equal to, or + greater than the second key argument. The same com- + parison function must be used on a given tree every + time it is opened. + + The _d_a_t_a and _s_i_z_e fields of the DBT are the only + fields that may be used for the purposes of this com- + parison. + + If _b_t___c_o_m_p_a_r_e is NULL, the keys are compared lexi- + cally, with shorter keys collating before longer + keys. + + u_int32_t bt_minkey; + The minimum number of keys that will be stored on any + single page. This value is used to determine which + keys will be stored on overflow pages, i.e. if a key + or data item is larger than the pagesize divided by + the _b_t___m_i_n_k_e_y value, it will be stored on overflow + pages instead of in the page itself. The _b_t___m_i_n_k_e_y + value specified must be at least 2; if _b_t___m_i_n_k_e_y is + 0, a value of 2 is used. + + size_t (*bt_prefix)(const DBT *, const DBT *); + The _b_t___p_r_e_f_i_x function is the prefix comparison func- + tion. If specified, this function must return the + number of bytes of the second key argument that are + necessary to determine that it is greater than the + first key argument. If the keys are equal, the key + length should be returned. + + The _d_a_t_a and _s_i_z_e fields of the DBT are the only + fields that may be used for the purposes of this com- + parison. + + This is used to compress the keys stored on the btree + internal pages. The usefulness of this is data + dependent, but in some data sets can produce signifi- + cantly reduced tree sizes and search times. If + _b_t___p_r_e_f_i_x is NULL, and no comparison function is + specified, a default lexical comparison function is + used. If _b_t___p_r_e_f_i_x is NULL and a comparison function + is specified, no prefix comparison is done. + + u_int32_t flags; + The following additional flags may be specified by + oorr'ing together one or more of the following values: + + DB_DUP + Permit duplicate keys in the tree, i.e. inser- + tion when the key of the key/data pair being + inserted already exists in the tree will be suc- + cessful. The ordering of duplicates in the tree + is determined by the order of insertion, unless + the ordering is otherwise specified by use of a + cursor (see _d_b___c_u_r_s_o_r(3) for more information.) + It is an error to specify both DB_DUP and + DB_RECNUM. + + DB_RECNUM + Support retrieval from btrees using record num- + bers. For more information, see the + DB_SET_RECNO flag to the _D_B_-_>_g_e_t function + (below), and the cursor _c___g_e_t function (in + _d_b___c_u_r_s_o_r(3)). + + Logical record numbers in btrees are mutable in + the face of record insertion or deletion. See + the DB_RENUMBER flag in the RECNO section below + for further discussion. + + Maintaining record counts within a btree intro- + duces a serious point of contention, namely the + page locations where the record counts are + stored. In addition, the entire tree must be + locked during both insertions and deletions, + effectively single-threading the tree for those + operations. Specifying DB_RECNUM can result in + serious performance degradation for some appli- + cations and data sets. + + It is an error to specify both DB_DUP and + DB_RECNUM. + +HHAASSHH + The hash data structure is an extensible, dynamic hashing + scheme. Backward compatible interfaces to the functions + described in _d_b_m(3), _n_d_b_m(3) and _h_s_e_a_r_c_h(3) are provided, + however these interfaces are not compatible with previous + file formats. + + The following additional fields and flags may be initial- + ized in the DB_INFO structure before calling _d_b___o_p_e_n, when + using the hash access method: + + u_int32_t h_ffactor; + The desired density within the hash table. It is an + approximation of the number of keys allowed to accu- + mulate in any one bucket, determining when the hash + table grows or shrinks. The default value is 0, + indicating that the fill factor will be selected + dynamically as pages are filled. + + u_int32_t (*h_hash)(const void *, u_int32_t); + The _h___h_a_s_h field is a user defined hash function; if + _h___h_a_s_h is NULL, a default hash function is used. + Since no hash function performs equally well on all + possible data, the user may find that the built-in + hash function performs poorly with a particular data + set. User specified hash functions must take a + pointer to a byte string and a length as arguments + and return a u_int32_t value. + + If a hash function is specified, _h_a_s_h___o_p_e_n will + attempt to determine if the hash function specified + is the same as the one with which the database was + created, and will fail if it detects that it is not. + + u_int32_t h_nelem; + An estimate of the final size of the hash table. If + not set or set too low, hash tables will expand + gracefully as keys are entered, although a slight + performance degradation may be noticed. The default + value is 1. + + u_int32_t flags; + The following additional flags may be specified by + oorr'ing together one or more of the following values: + + DB_DUP + Permit duplicate keys in the tree, i.e. inser- + tion when the key of the key/data pair being + inserted already exists in the tree will be suc- + cessful. The ordering of duplicates in the tree + is determined by the order of insertion, unless + the ordering is otherwise specified by use of a + cursor (see _d_b___c_u_r_s_o_r(3) for more information.) + +RREECCNNOO + The recno access method provides support for fixed and + variable length records, optionally backed by a flat text + (byte stream) file. Both fixed and variable length + records are accessed by their logical record number. + + It is valid to create a record whose record number is more + than one greater than the last record currently in the + database. For example, the creation of record number 8, + when records 6 and 7 do not yet exist, is not an error. + However, any attempt to retrieve such records (e.g., + records 6 and 7) will return DB_KEYEMPTY. + + Deleting a record will not, by default, renumber records + following the deleted record (see DB_RENUMBER below for + more information). Any attempt to retrieve deleted + records will return DB_KEYEMPTY. + + The following additional fields and flags may be initial- + ized in the DB_INFO structure before calling _d_b___o_p_e_n, when + using the recno access method: + + int re_delim; + For variable length records, if the _r_e___s_o_u_r_c_e file is + specified and the DB_DELIMITER flag is set, the + delimiting byte used to mark the end of a record in + the source file. If the _r_e___s_o_u_r_c_e file is specified + and the DB_DELIMITER flag is not set, char- + acters (i.e. ``\n'', 0x0a) are interpreted as end-of- + record markers. + + u_int32_t re_len; + The length of a fixed-length record. + + int re_pad; + For fixed length records, if the DB_PAD flag is set, + the pad character for short records. If the DB_PAD + flag is not set, characters (i.e., 0x20) are + used for padding. + + char *re_source; + The purpose of the _r_e___s_o_u_r_c_e field is to provide fast + access and modification to databases that are nor- + mally stored as flat text files. + + + If the _r_e___s_o_u_r_c_e field is non-NULL, it specifies an + underlying flat text database file that is read to + initialize a transient record number index. In the + case of variable length records, the records are sep- + arated by the byte value _r_e___d_e_l_i_m. For example, + standard UNIX byte stream files can be interpreted as + a sequence of variable length records separated by + characters. + + In addition, when cached data would normally be writ- + ten back to the underlying database file (e.g., the + _c_l_o_s_e or _s_y_n_c functions are called), the in-memory + copy of the database will be written back to the + _r_e___s_o_u_r_c_e file. + + By default, the backing source file is read lazily, + i.e., records are not read from the file until they + are requested by the application. IIff mmuullttiippllee pprroo-- + cceesssseess ((nnoott tthhrreeaaddss)) aarree aacccceessssiinngg aa rreeccnnoo ddaattaabbaassee + ccoonnccuurrrreennttllyy aanndd eeiitthheerr iinnsseerrttiinngg oorr ddeelleettiinngg + rreeccoorrddss,, tthhee bbaacckkiinngg ssoouurrccee ffiillee mmuusstt bbee rreeaadd iinn iittss + eennttiirreettyy bbeeffoorree mmoorree tthhaann aa ssiinnggllee pprroocceessss aacccceesssseess + tthhee ddaattaabbaassee,, aanndd oonnllyy tthhaatt pprroocceessss sshhoouulldd ssppeecciiffyy + tthhee bbaacckkiinngg ssoouurrccee ffiillee aass ppaarrtt ooff tthhee ddbb__ooppeenn ccaallll.. + See the DB_SNAPSHOT flag below for more information. + + RReeaaddiinngg aanndd wwrriittiinngg tthhee bbaacckkiinngg ssoouurrccee ffiillee ssppeecciiffiieedd + bbyy rree__ssoouurrccee ccaannnnoott bbee ttrraannssaaccttiioonnaallllyy pprrootteecctteedd + bbeeccaauussee iitt iinnvvoollvveess ffiilleessyysstteemm ooppeerraattiioonnss tthhaatt aarree + nnoott ppaarrtt ooff tthhee DDBB ttrraannssaaccttiioonn mmeetthhooddoollooggyy.. For this + reason, if a temporary database is used to hold the + records, i.e., a NULL was specified as the _f_i_l_e argu- + ment to _d_b___o_p_e_n, it is possible to lose the contents + of the _r_e___s_o_u_r_c_e file, e.g., if the system crashes at + the right instant. If a file is used to hold the + database, i.e., a file name was specified as the _f_i_l_e + argument to _d_b___o_p_e_n, normal database recovery on that + file can be used to prevent information loss, + although it is still possible that the contents of + _r_e___s_o_u_r_c_e will be lost if the system crashes. + + The _r_e___s_o_u_r_c_e file must already exist (but may be + zero-length) when _d_b___o_p_e_n is called. + + For all of the above reasons, the _r_e___s_o_u_r_c_e field is + generally used to specify databases that are read- + only for DB applications, and that are either gener- + ated on the fly by software tools, or modified using + a different mechanism, e.g., a text editor. + + u_int32_t flags; + The following additional flags may be specified by + oorr'ing together one or more of the following values: + + DB_DELIMITER + The _r_e___d_e_l_i_m field is set. + + DB_FIXEDLEN + The records are fixed-length, not byte delim- + ited. The structure element _r_e___l_e_n specifies + the length of the record, and the structure ele- + ment _r_e___p_a_d is used as the pad character. + + Any records added to the database that are less + than _r_e___l_e_n bytes long are automatically padded. + Any attempt to insert records into the database + that are greater than _r_e___l_e_n bytes long will + cause the call to fail immediately and return an + error. + + DB_PAD + The _r_e___p_a_d field is set. + + DB_RENUMBER + Specifying the DB_RENUMBER flag causes the logi- + cal record numbers to be mutable, and change as + records are added to and deleted from the + database. For example, the deletion of record + number 4 causes records numbered 5 and greater + to be renumbered downward by 1. If a cursor was + positioned to record number 4 before the dele- + tion, it will reference the new record number 4, + if any such record exists, after the deletion. + If a cursor was positioned after record number 4 + before the deletion, it will be shifted downward + 1 logical record, continuing to reference the + same record as it did before. + + Using the _c___p_u_t or _p_u_t interfaces to create new + records will cause the creation of multiple + records if the record number is more than one + greater than the largest record currently in the + database. For example, creating record 28, when + record 25 was previously the last record in the + database, will create records 26 and 27 as well + as 28. Attempts to retrieve records that were + created in this manner will result in an error + return of DB_KEYEMPTY. + + If a created record is not at the end of the + database, all records following the new record + will be automatically renumbered upward by 1. + For example, the creation of a new record num- + bered 8 causes records numbered 8 and greater to + be renumbered upward by 1. If a cursor was + positioned to record number 8 or greater before + the insertion, it will be shifted upward 1 logi- + cal record, continuing to reference the same + record as it did before. + + For these reasons, concurrent access to a recno + database with the DB_RENUMBER flag specified may + be largely meaningless, although it is sup- + ported. + + DB_SNAPSHOT + This flag specifies that any specified _r_e___s_o_u_r_c_e + file be read in its entirety when _d_b___o_p_e_n is + called. If this flag is not specified, the + _r_e___s_o_u_r_c_e file may be read lazily. + + +DDBB OOPPEERRAATTIIOONNSS + The DB structure returned by _d_b___o_p_e_n describes a database + type, and includes a set of functions to perform various + actions, as described below. Each of these functions + takes a pointer to a DB structure, and may take one or + more DBT *'s and a flag value as well. The fields of the + DB structure are as follows: + + DBTYPE type; + The type of the underlying access method (and file + format). Set to one of DB_BTREE, DB_HASH or + DB_RECNO. This field may be used to determine the + type of the database after a return from _d_b___o_p_e_n with + the _t_y_p_e argument set to DB_UNKNOWN. + + int (*close)(DB *db, u_int32_t flags); + A pointer to a function to flush any cached informa- + tion to disk, close any open cursors (see _d_b___c_u_r_- + _s_o_r(3)), free any allocated resources, and close any + underlying files. Since key/data pairs are cached in + memory, failing to sync the file with the _c_l_o_s_e or + _s_y_n_c function may result in inconsistent or lost + information. + + The _f_l_a_g_s parameter must be set to 0 or the following + value: + + DB_NOSYNC + Do not flush cached information to disk. + + The DB_NOSYNC flag is a dangerous option. It should + only be set 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. + + IItt iiss iimmppoorrttaanntt ttoo uunnddeerrssttaanndd tthhaatt fflluusshhiinngg ccaacchheedd + iinnffoorrmmaattiioonn ttoo ddiisskk oonnllyy mmiinniimmiizzeess tthhee wwiinnddooww ooff + ooppppoorrttuunniittyy ffoorr ccoorrrruupptteedd ddaattaa.. While 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 transac- + tions and logging with automatic recovery, use log- + ging and application-specific recovery, or edit a + copy of the database, and, once all applications + using the database have successfully called _c_l_o_s_e, + replace the original database with the updated copy. + + When multiple threads are using the DB handle concur- + rently, only a single thread may call the DB handle + close function. + + The _c_l_o_s_e function returns the value of _e_r_r_n_o on + failure and 0 on success. + + int (*cursor)(DB *db, DB_TXN *txnid, DBC **cursorp); + A pointer to a function to create a cursor and copy a + pointer to it into the memory referenced by _c_u_r_s_o_r_p. + + A cursor is a structure used to provide sequential + access through a database. This interface and its + associated functions replaces the functionality pro- + vided by the _s_e_q function in previous releases of the + DB library. + + + If the file is being accessed under transaction pro- + tection, the _t_x_n_i_d parameter is a transaction ID + returned from _t_x_n___b_e_g_i_n, otherwise, NULL. If trans- + action protection is enabled, cursors must be opened + and closed within the context of a transaction, and + the _t_x_n_i_d parameter specifies the transaction context + in which the cursor may be used. See _d_b___c_u_r_s_o_r(3) + for more information. + + The _c_u_r_s_o_r function returns the value of _e_r_r_n_o on + failure and 0 on success. + + int (*del)(DB *db, DB_TXN *txnid, DBT *key, u_int32_t + flags); + A pointer to a function to remove key/data pairs from + the database. The key/data pair associated with the + specified _k_e_y is discarded from the database. In the + presence of duplicate key values, all records associ- + ated with the designated key will be discarded. + + If the file is being accessed under transaction pro- + tection, the _t_x_n_i_d parameter is a transaction ID + returned from _t_x_n___b_e_g_i_n, otherwise, NULL. + + The _f_l_a_g_s parameter is currently unused, and must be + set to 0. + + The _d_e_l function returns the value of _e_r_r_n_o on fail- + ure, 0 on success, and DB_NOTFOUND if the specified + _k_e_y did not exist in the file. + + int (*fd)(DB *db, int *fdp); + A pointer to a function that copies a file descriptor + representative of the underlying database into the + memory referenced by _f_d_p. A file descriptor refer- + encing the same file will be returned to all pro- + cesses that call _d_b___o_p_e_n with the same _f_i_l_e argument. + This file descriptor may be safely used as an argu- + ment to the _f_c_n_t_l(2) and _f_l_o_c_k(2) locking functions. + The file descriptor is not necessarily associated + with any of the underlying files used by the access + method. + + The _f_d function only supports a coarse-grained form + of locking. Applications should use the lock manager + where possible. + + The _f_d function returns the value of _e_r_r_n_o on failure + and 0 on success. + + int (*get)(DB *db, DB_TXN *txnid, + DBT *key, DBT *data, u_int32_t flags); + A pointer to a function that is an interface for + keyed retrieval from the database. The address and + length of the data associated with the specified _k_e_y + are returned in the structure referenced by _d_a_t_a. + + In the presence of duplicate key values, _g_e_t will + return the first data item for the designated key. + Duplicates are sorted by insert order except where + this order has been overridden by cursor operations. + RReettrriieevvaall ooff dduupplliiccaatteess rreeqquuiirreess tthhee uussee ooff ccuurrssoorr + ooppeerraattiioonnss.. See _d_b___c_u_r_s_o_r(3) for details. + + If the file is being accessed under transaction pro- + tection, the _t_x_n_i_d parameter is a transaction ID + returned from _t_x_n___b_e_g_i_n, otherwise, NULL. + + The _f_l_a_g_s parameter must be set to 0 or the following + value: + + DB_SET_RECNO + Retrieve the specified numbered key/data pair + from a database. Upon return, both the _k_e_y and + _d_a_t_a items will have been filled in, not just + the data item as is done for all other uses of + the _g_e_t function. + + The _d_a_t_a field of the specified _k_e_y must be a + pointer to a memory location from which a + _d_b___r_e_c_n_o___t may be read, as described in + _d_b___d_b_t(3). This memory location will be read to + determine the record to be retrieved. + + For DB_SET_RECNO to be specified, the underlying + database must be of type btree and it must have + been created with the DB_RECNUM flag (see + _d_b___o_p_e_n(3)). + + If the database is a recno database and the requested + key exists, but was never explicitly created by the + application or was later deleted, the _g_e_t function + returns DB_KEYEMPTY. Otherwise, if the requested key + isn't in the database, the _g_e_t function returns + DB_NOTFOUND. Otherwise, the _g_e_t function returns the + value of _e_r_r_n_o on failure and 0 on success. + + int (*put)(DB *db, DB_TXN *txnid, + DBT *key, DBT *data, u_int32_t flags); + A pointer to a function to store key/data pairs in + the database. If the database supports duplicates, + the _p_u_t function adds the new data value at the end + of the duplicate set. + + If the file is being accessed under transaction pro- + tection, the _t_x_n_i_d parameter is a transaction ID + returned from _t_x_n___b_e_g_i_n, otherwise, NULL. + + The flags value is specified by oorr'ing together one + or more of the following values: + + DB_APPEND + Append the key/data pair to the end of the + database. For DB_APPEND to be specified, the + underlying database must be of type recno. The + record number allocated to the record is + returned in the specified _k_e_y. + + DB_NOOVERWRITE + Enter the new key/data pair only if the key does + not already appear in the database. + + The default behavior of the _p_u_t function is to enter + the new key/data pair, replacing any previously + existing key if duplicates are disallowed, or to add + a duplicate entry if duplicates are allowed. Even if + the designated database allows duplicates, a call to + _p_u_t with the DB_NOOVERWRITE flag set will fail if the + key already exists in the database. + + The _p_u_t function returns the value of _e_r_r_n_o on fail- + ure, 0 on success, and DB_KEYEXIST if the DB_NOOVER- + WRITE _f_l_a_g was set and the key already exists in the + file. + + int (*sync)(DB *db, u_int32_t flags); + A pointer to a function to flush any cached informa- + tion to disk. If the database is in memory only, the + _s_y_n_c function has no effect and will always succeed. + + The _f_l_a_g_s parameter is currently unused, and must be + set to 0. + + See the _c_l_o_s_e function description above for a dis- + cussion of DB and cached data. + + The _s_y_n_c function returns the value of _e_r_r_n_o on fail- + ure and 0 on success. + + int (*stat)(DB *db, void *sp, + void *(*db_malloc)(size_t), u_int32_t flags); + A pointer to a function to create a statistical + structure and copy a pointer to it into user-speci- + fied memory locations. Specifically, if _s_p is non- + NULL, a pointer to the statistics for the database + are copied into the memory location it references. + + Statistical structures are created in allocated mem- + ory. If _d_b___m_a_l_l_o_c is non-NULL, it is called to allo- + cate the memory, otherwise, the library function _m_a_l_- + _l_o_c(3) is used. The function _d_b___m_a_l_l_o_c must match + the calling conventions of the _m_a_l_l_o_c(3) library rou- + tine. Regardless, the caller is responsible for + deallocating the returned memory. To deallocate the + returned memory, free each returned memory pointer; + pointers inside the memory do not need to be individ- + ually freed. + + IInn tthhee pprreesseennccee ooff mmuullttiippllee tthhrreeaaddss oorr pprroocceesssseess + aacccceessssiinngg aann aaccttiivvee ddaattaabbaassee,, tthhee rreettuurrnneedd iinnffoorrmmaa-- + ttiioonn mmaayy bbee oouutt--ooff--ddaattee.. + + TThhiiss ffuunnccttiioonn mmaayy aacccceessss aallll ooff tthhee ppaaggeess iinn tthhee + ddaattaabbaassee,, aanndd tthheerreeffoorree mmaayy iinnccuurr aa sseevveerree ppeerrffoorr-- + mmaannccee ppeennaallttyy aanndd hhaavvee oobbvviioouuss nneeggaattiivvee eeffffeeccttss oonn + tthhee uunnddeerrllyyiinngg bbuuffffeerr ppooooll.. + + + The _f_l_a_g_s parameter must be set to 0 or the following + value: + + + DB_RECORDCOUNT + Fill in the _b_t___n_r_e_c_s field of the statistics + structure, but do not collect any other informa- + tion. This flag makes it reasonable for appli- + cations to request a record count from a + database without incurring a performance + penalty. It is only available for recno + databases, or btree databases where the underly- + ing database was created with the DB_RECNUM + flag. + + The _s_t_a_t function returns the value of _e_r_r_n_o on fail- + ure and 0 on success. + + In the case of a btree or recno database, the statis- + tics are stored in a structure of type DB_BTREE_STAT + (typedef'd in ). The following fields will be + filled in: + + u_int32_t bt_magic; + Magic number that identifies the file as a btree + file. + u_int32_t bt_version; + The version of the btree file type. + u_int32_t bt_flags; + Permanent database flags, including DB_DUP, + DB_FIXEDLEN, DB_RECNUM and DB_RENUMBER. + u_int32_t bt_minkey; + The _b_t___m_i_n_k_e_y value specified to _d_b___o_p_e_n(3), if + any. + u_int32_t bt_re_len; + The _r_e___l_e_n value specified to _d_b___o_p_e_n(3), if + any. + u_int32_t bt_re_pad; + The _r_e___p_a_d value specified to _d_b___o_p_e_n(3), if + any. + u_int32_t bt_pagesize; + Underlying tree page size. + u_int32_t bt_levels; + Number of levels in the tree. + u_int32_t bt_nrecs; + Number of data items in the tree (since there + may be multiple data items per key, this number + may not be the same as the number of keys). + u_int32_t bt_int_pg; + Number of tree internal pages. + u_int32_t bt_leaf_pg; + Number of tree leaf pages. + u_int32_t bt_dup_pg; + Number of tree duplicate pages. + u_int32_t bt_over_pg; + Number of tree overflow pages. + u_int32_t bt_free; + Number of pages on the free list. + u_int32_t bt_freed; + Number of pages made available for reuse because + they were emptied. + u_int32_t bt_int_pgfree; + Number of bytes free in tree internal pages. + u_int32_t bt_leaf_pgfree; + Number of bytes free in tree leaf pages. + u_int32_t bt_dup_pgfree; + Number of bytes free in tree duplicate pages. + u_int32_t bt_over_pgfree; + Number of bytes free in tree overflow pages. + u_int32_t bt_pfxsaved; + Number of bytes saved by prefix compression. + u_int32_t bt_split; + Total number of tree page splits (includes fast + and root splits). + u_int32_t bt_rootsplit; + Number of root page splits. + u_int32_t bt_fastsplit; + Number of fast splits. When sorted keys are + added to the database, the DB btree implementa- + tion will split left or right to increase the + page-fill factor. This number is a measure of + how often it was possible to make such a split. + u_int32_t bt_added; + Number of keys added. + u_int32_t bt_deleted; + Number of keys deleted. + u_int32_t bt_get; + Number of keys retrieved. (Note, this value + will not reflect any keys retrieved when the + database was open for read-only access, as there + is no permanent location to store the informa- + tion in this case.) + u_int32_t bt_cache_hit; + Number of hits in tree fast-insert code. When + sorted keys are added to the database, the DB + btree implementation will check the last page + where an insert occurred before doing a full + lookup. This number is a measure of how often + the lookup was successful. + u_int32_t bt_cache_miss; + Number of misses in tree fast-insert code. See + the description of bt_cache_hit; this number is + a measure of how often the lookup failed. + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _d_b___o_p_e_n: + + DB_HOME + If the _d_b_e_n_v argument to _d_b___o_p_e_n was initialized + using _d_b___a_p_p_i_n_i_t, the environment variable DB_HOME + may be used as the path of the database home for the + interpretation of the _d_i_r argument to _d_b___o_p_e_n, as + described in _d_b___a_p_p_i_n_i_t(3). Specifically, _d_b___o_p_e_n is + affected by the configuration string value of + DB_DATA_DIR. + +EEXXAAMMPPLLEESS + Applications that create short-lived databases that are + discarded or recreated when the system fails and are + unconcerned with concurrent access and loss of data due to + catastrophic failure, may wish to use the _d_b___o_p_e_n func- + tionality without other parts of the DB library. Such + applications will only be concerned with the DB access + methods. The DB access methods will use the memory pool + subsystem, but the application is unlikely to be aware of + this. See the files _e_x_a_m_p_l_e_/_e_x___a_c_c_e_s_s_._c and _e_x_a_m_- + _p_l_e_/_e_x___b_t_r_e_c_._c in the DB source distribution for C lan- + guage code examples of how such applications might use the + DB library. + +EERRRROORRSS + The _d_b___o_p_e_n function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: DB->sync(3), calloc(3), close(2), fcntl(2), + fflush(3), lock_get(3), lock_id(3), lock_put(3), + lock_vec(3), log_put(3), log_register(3), log_unregis- + ter(3), malloc(3), memcpy(3), memmove(3), memp_close(3), + memp_fclose(3), memp_fget(3), memp_fopen(3), memp_fput(3), + memp_fset(3), memp_fsync(3), memp_open(3), memp_regis- + ter(3), memset(3), mmap(2), munmap(2), open(2), read(2), + realloc(3), sigfillset(3), sigprocmask(2), stat(2), str- + cpy(3), strdup(3), strerror(3), strlen(3), time(3), and + unlink(2). + + In addition, the _d_b___o_p_e_n function may fail and return + _e_r_r_n_o for the following conditions: + + [EAGAIN] + A lock was unavailable. + + [EINVAL] + An invalid flag value or parameter was specified + (e.g., unknown database type, page size, hash func- + tion, recno pad byte, byte order) or a flag value or + parameter that is incompatible with the current _f_i_l_e + specification. + + The DB_THREAD flag was specified and spinlocks are + not implemented for this architecture. + + There is a mismatch between the version number of + _f_i_l_e and the software. + + A _r_e___s_o_u_r_c_e file was specified with either the + DB_THREAD flag or a non-NULL _t_x___i_n_f_o field in the + DB_ENV argument to db_open. + + [ENOENT] + A non-existent _r_e___s_o_u_r_c_e file was specified. + + [EPERM] + Database corruption was detected. All subsequent + database calls (other than _D_B_-_>_c_l_o_s_e) will return + EPERM. + + The _D_B_-_>_c_l_o_s_e function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: DB->sync(3), calloc(3), close(2), fflush(3), + lock_get(3), lock_put(3), lock_vec(3), log_put(3), + log_unregister(3), malloc(3), memcpy(3), memmove(3), + memp_close(3), memp_fclose(3), memp_fget(3), memp_fput(3), + memp_fset(3), memp_fsync(3), memset(3), munmap(2), real- + loc(3), and strerror(3). + + The _D_B_-_>_c_u_r_s_o_r function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: calloc(3). + + In addition, the _D_B_-_>_c_u_r_s_o_r function may fail and return + _e_r_r_n_o for the following conditions: + + [EINVAL] + An invalid flag value or parameter was specified. + + [EPERM] + Database corruption was detected. All subsequent + database calls (other than _D_B_-_>_c_l_o_s_e) will return + EPERM. + + The _D_B_-_>_d_e_l function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: calloc(3), fcntl(2), fflush(3), lock_get(3), + lock_id(3), lock_put(3), lock_vec(3), log_put(3), mal- + loc(3), memcmp(3), memcpy(3), memmove(3), memp_fget(3), + memp_fput(3), memp_fset(3), memset(3), realloc(3), and + strerror(3). + + In addition, the _D_B_-_>_d_e_l function may fail and return + _e_r_r_n_o for the following conditions: + + [EAGAIN] + A lock was unavailable. + + [EINVAL] + An invalid flag value or parameter was specified. + + [EPERM] + Database corruption was detected. All subsequent + database calls (other than _D_B_-_>_c_l_o_s_e) will return + EPERM. + + In addition, the _D_B_-_>_f_d function may fail and return _e_r_r_n_o + for the following conditions: + + [ENOENT] + The _D_B_-_>_f_d function was called for an in-memory + database, or no underlying file has yet been created. + + [EPERM] + Database corruption was detected. All subsequent + database calls (other than _D_B_-_>_c_l_o_s_e) will return + EPERM. + + The _D_B_-_>_g_e_t function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: DBcursor->c_get(3), calloc(3), fcntl(2), + fflush(3), lock_get(3), lock_id(3), lock_put(3), + lock_vec(3), log_put(3), malloc(3), memcmp(3), memcpy(3), + memmove(3), memp_fget(3), memp_fput(3), memp_fset(3), mem- + set(3), realloc(3), and strerror(3). + + In addition, the _D_B_-_>_g_e_t function may fail and return + _e_r_r_n_o for the following conditions: + + [EAGAIN] + A lock was unavailable. + + [EINVAL] + An invalid flag value or parameter was specified. + + The DB_THREAD flag was specified to the _d_b___o_p_e_n(3) + function and neither the DB_DBT_MALLOC or + DB_DBT_USERMEM flags were set in the DBT. + + A record number of 0 was specified. + + [EPERM] + Database corruption was detected. All subsequent + database calls (other than _D_B_-_>_c_l_o_s_e) will return + EPERM. + + The _D_B_-_>_p_u_t function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: calloc(3), fcntl(2), fflush(3), lock_get(3), + lock_id(3), lock_put(3), lock_vec(3), log_put(3), mal- + loc(3), memcmp(3), memcpy(3), memmove(3), memp_fget(3), + memp_fput(3), memp_fset(3), memset(3), realloc(3), and + strerror(3). + + In addition, the _D_B_-_>_p_u_t function may fail and return + _e_r_r_n_o for the following conditions: + + [EACCES] + An attempt was made to modify a read-only database. + + [EAGAIN] + A lock was unavailable. + + [EINVAL] + An invalid flag value or parameter was specified. + + A record number of 0 was specified. + + An attempt was made to add a record to a fixed-length + database that was too large to fit. + + An attempt was made to do a partial put. + + [EPERM] + Database corruption was detected. All subsequent + database calls (other than _D_B_-_>_c_l_o_s_e) will return + EPERM. + + [ENOSPC] + A btree exceeded the maximum btree depth (255). + + The _D_B_-_>_s_t_a_t function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: calloc(3), fcntl(2), fflush(3), lock_get(3), + lock_id(3), lock_put(3), lock_vec(3), malloc(3), mem- + cpy(3), memp_fget(3), memp_fput(3), and memset(3). + + The _D_B_-_>_s_y_n_c function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: DB->get(3), DB->sync(3), calloc(3), close(2), + fcntl(2), fflush(3), lock_get(3), lock_id(3), lock_put(3), + lock_vec(3), log_put(3), malloc(3), memcpy(3), memmove(3), + memp_fget(3), memp_fput(3), memp_fset(3), memp_fsync(3), + memset(3), munmap(2), open(2), realloc(3), strerror(3), + unlink(2), and write(2). + + In addition, the _D_B_-_>_s_y_n_c function may fail and return + _e_r_r_n_o for the following conditions: + + [EINVAL] + An invalid flag value or parameter was specified. + + [EPERM] + Database corruption was detected. All subsequent + database calls (other than _D_B_-_>_c_l_o_s_e) will return + EPERM. + +SSEEEE AALLSSOO + _T_h_e _U_b_i_q_u_i_t_o_u_s _B_-_t_r_e_e, Douglas Comer, ACM Comput. Surv. + 11, 2 (June 1979), 121-138. + + _P_r_e_f_i_x _B_-_t_r_e_e_s, Bayer and Unterauer, ACM Transactions on + Database Systems, Vol. 2, 1 (March 1977), 11-26. + + _T_h_e _A_r_t _o_f _C_o_m_p_u_t_e_r _P_r_o_g_r_a_m_m_i_n_g _V_o_l_. _3_: _S_o_r_t_i_n_g _a_n_d + _S_e_a_r_c_h_i_n_g, D.E. Knuth, 1968, pp 471-480. + + _D_y_n_a_m_i_c _H_a_s_h _T_a_b_l_e_s, Per-Ake Larson, Communications of the + ACM, April 1988. + + _A _N_e_w _H_a_s_h _P_a_c_k_a_g_e _f_o_r _U_N_I_X, Margo Seltzer, USENIX Pro- + ceedings, Winter 1991. + + _D_o_c_u_m_e_n_t _P_r_o_c_e_s_s_i_n_g _i_n _a _R_e_l_a_t_i_o_n_a_l _D_a_t_a_b_a_s_e _S_y_s_t_e_m, + Michael Stonebraker, Heidi Stettner, Joseph Kalash, + Antonin Guttman, Nadene Lynn, Memorandum No. UCB/ERL + M82/32, May 1982. + + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/man.text/db_recover.0 b/mozilla/db/man/man.text/db_recover.0 new file mode 100644 index 00000000000..351ed244f77 --- /dev/null +++ b/mozilla/db/man/man.text/db_recover.0 @@ -0,0 +1,166 @@ + + +NNAAMMEE + db_recover - the DB database recovery utility + +SSYYNNOOPPSSIISS + ddbb__rreeccoovveerr [--ccvv] [--hh hhoommee] + +DDEESSCCRRIIPPTTIIOONN + The _d_b___r_e_c_o_v_e_r utility must be run after an unexpected + application, DB, or system failure to restore the database + to a consistent state. All committed transactions are + guaranteed to appear after _d_b___r_e_c_o_v_e_r has run, and all + uncommitted transactions will be completely undone. + + The options are as follows: + + --cc Failure was catastrophic. + + --hh Specify a home directory for the database. + + --vv Run in verbose mode. + + In the case of catastrophic failure, an archival copy, or + ``snapshot'' of all database files must be restored along + with all of the log files written since the database file + snapshot was made. (If disk space is a problem, log files + may be referenced by symbolic links). For further infor- + mation on creating a database snapshot, see ``DB ARCHIVAL + PROCEDURES'' in _d_b___a_r_c_h_i_v_e(1). + + If the failure was not catastrophic, the files present on + the system at the time of failure are sufficient to per- + form recovery. + + If log files are missing, _d_b___r_e_c_o_v_e_r will identify the + missing log file(s) and fail, in which case the missing + log files need to be restored and recovery performed + again. + + The _d_b___r_e_c_o_v_e_r utility attaches to DB shared memory + regions. In order to avoid region corruption, it should + always be given the chance to detach and exit gracefully. + To cause _d_b___r_e_c_o_v_e_r to clean up after itself and exit, + send it an interrupt signal (SIGINT). + + The _d_b___r_e_c_o_v_e_r utility exits 0 on success, and >0 if an + error occurs. + +FFIILLEESSYYSSTTEEMM OOPPEERRAATTIIOONNSS + FFiilleessyysstteemm ooppeerraattiioonnss,, ee..gg..,, mmoovviinngg tthhee ddaattaabbaassee eennvviirroonn-- + mmeenntt ttoo aa ddiiffffeerreenntt mmaacchhiinnee oorr ffiillee ccrreeaattiioonn,, ddeelleettiioonn oorr + rreennaammiinngg,, ccaannnnoott bbee ttrraannssaaccttiioonn pprrootteecctteedd.. For this rea- + son, _d_b___r_e_c_o_v_e_r cannot re-create, delete or rename files + as part of recovery. + + If _d_b___r_e_c_o_v_e_r cannot find a database file referenced in + the log, it will output a warning message that it was + unable to locate a file it expected to find. This message + is only a warning, as the file may have subsequently been + deleted as part of normal database operations before the + failure occurred. NNoottee tthhaatt ccoommmmiitttteedd ttrraannssaaccttiioonnss tthhaatt + iinnvvoollvveedd tthheessee mmiissssiinngg ffiilleess aarree rroolllleedd ffoorrwwaarrdd,, eevveenn + tthhoouugghh tthhee ffiilleess wweerree nnoott ffoouunndd.. IIff tthhee ffiilleess wweerree nnoott + iinntteennttiioonnaallllyy ddeelleetteedd ((ee..gg..,, tthheeyy wweerree ccrreeaatteedd aafftteerr tthhee + llaasstt ddaattaabbaassee ssnnaappsshhoott,, bbuutt wweerree lloosstt dduurriinngg aa ffaaiilluurree)),, + tthheeyy mmuusstt bbee mmaannuuaallllyy ccrreeaatteedd ((uussiinngg _d_b___o_p_e_n(3)), and + _d_b___r_e_c_o_v_e_r must be rerun. + + Generally, it is simplest to perform filesystem operations + at the same time as making a snapshot of the database. To + perform filesystem operations: + + 1. Cleanly shutdown database operations. + 2. Rename, create or delete files. + 3. Make a snapshot of the database. + 4. Restart database applications. + + To cleanly shutdown database operations, all applications + accessing the database environment must be shutdown. If + the applications are not implemented such that they can be + shutdown gracefully (i.e., closing all references to the + database environment), _d_b___r_e_c_o_v_e_r must be run after all + applications have been killed to ensure that the underly- + ing database is consistent and flushed to disk. + +RREECCOOVVEERRYY + After an application or system failure, there are two pos- + sible approaches to database recovery. If there is no + need to retain state across the failure, and all databases + can be started anew, the database home directory can sim- + ply be removed and recreated. If it is necessary to + retain persistent state across failures, then the + _d_b___r_e_c_o_v_e_r(1) utility should be run for each DB applica- + tion environment, i.e., each database home directory. + + The _d_b___r_e_c_o_v_e_r utility will remove all the shared regions + (which may have been corrupted by the failure), establish + the end of the log by identifying the last record written + to the log, and then perform transaction recovery. + Database applications must not be restarted until recovery + completes. During transaction recovery, all changes made + by aborted transactions are undone and all changes made by + committed transactions are redone, as necessary. After + recovery runs, the environment is properly initialized so + that applications may be restarted. Any time an applica- + tion crashes or the system fails, _d_b___r_e_c_o_v_e_r should be run + on any exiting database environments. + + Additionally, there are two forms of recovery: normal + recovery and catastrophic recovery. The DB package + defines catastrophic failure to be failure where either + the database or log files have been destroyed or corrupted + from the point of view of the filesystem. For example, + catastrophic failure includes the case where the disk + drive on which either the database or logs are stored has + crashed, or when filesystem recovery is unable to bring + the database and log files to a consistent state with + respect to the filesystem. If the failure is non-catas- + trophic, i.e., the database files and log are accessible + on a filesystem that has recovered cleanly, _d_b___r_e_c_o_v_e_r + will review the logs and database files to ensure that all + committed transactions appear and that all uncommitted + transactions are undone. If the failure is catastrophic, + a snapshot of the database files and the archived log + files must be restored onto the system. Then _d_b___r_e_c_o_v_e_r + will review the logs and database files to bring the + database to a consistent state as of the date of the last + archived log file. Only transactions committed before + that date will appear in the database. See _d_b___a_r_c_h_i_v_e _(_1_) + for specific information about archiving and recovering + databases after catastrophic failure. + + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _d_b___r_e_c_o_v_e_r: + + DB_HOME + If the --hh option is not specified and the environment + variable _D_B___H_O_M_E is set, it is used as the path of + the database home, as described in _d_b___a_p_p_i_n_i_t(3). + +BBUUGGSS + Future versions of DB are expected to remove the restric- + tion that database files must be manually created before + recovery is performed. + +SSEEEE AALLSSOO + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/man.text/db_stat.0 b/mozilla/db/man/man.text/db_stat.0 new file mode 100644 index 00000000000..83adc0026be --- /dev/null +++ b/mozilla/db/man/man.text/db_stat.0 @@ -0,0 +1,98 @@ + + +NNAAMMEE + db_stat - display DB statistics + +SSYYNNOOPPSSIISS + ddbb__ssttaatt [--ccllmmNNtt] + [--CC AAccffhhllmmoo] [--dd ffiillee] [--hh hhoommee] [--MM AAhhllmm] + +DDEESSCCRRIIPPTTIIOONN + The _d_b___s_t_a_t utility displays statistics for DB environ- + ments. + + The options are as follows: + + --CC Display internal information about the lock region. + (The output from this option is often both voluminous + and meaningless, and is intended only for debugging.) + + --AA Display all information. + --cc Display lock conflict matrix. + --ff Display lock and object free lists. + --ll Display lockers within hash chains. + --mm Display region memory information. + --oo Display objects within hash chains. + + --cc Display lock region statistics as described in + _d_b___l_o_c_k(3). + + --dd Display database statistics for the specified + database, as described in _d_b___o_p_e_n(3). + + --hh Specify a home directory for the database. + + --ll Display log region statistics as described in + _d_b___l_o_g(3). + + --MM Display internal information about the shared memory + buffer pool. (The output from this option is often + both voluminous and meaningless, and is intended only + for debugging.) + + --AA Display all information. + --hh Display buffers within hash chains. + --ll Display buffers within LRU chains. + --mm Display region memory information. + + --mm Display shared memory buffer pool statistics as + described in _d_b___m_p_o_o_l(3). + + --NN Don't acquire locks while displaying the statistics. + This option is intended only for debugging corrupt + regions and should not be used under any other cir- + cumstances. + + --tt Display transaction region statistics as described in + _d_b___t_x_n(3). + + The _d_b___s_t_a_t utility attaches to DB shared memory regions. + In order to avoid region corruption, it should always be + given the chance to detach and exit gracefully. To cause + _d_b___s_t_a_t to clean up after itself and exit, send it an + interrupt signal (SIGINT). + + Values smaller than 10 million are generally displayed + without any special notation. Values larger than 10 mil- + lion are normally displayed as ``M''. + + The _d_b___s_t_a_t utility exits 0 on success, and >0 if an error + occurs. + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _d_b___s_t_a_t: + + DB_HOME + If the --hh option is not specified and the environment + variable _D_B___H_O_M_E is set, it is used as the path of + the database home, as described in _d_b___a_p_p_i_n_i_t(3). + +SSEEEE AALLSSOO + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/man.text/db_thread.0 b/mozilla/db/man/man.text/db_thread.0 new file mode 100644 index 00000000000..88d22aeda0c --- /dev/null +++ b/mozilla/db/man/man.text/db_thread.0 @@ -0,0 +1,133 @@ + + +NNAAMMEE + db_thread - using threads in the DB library. + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + This manual pages describes the specific details of using + DB from within threaded programs. + + The DB library is not itself multi-threaded. The library + was deliberately architected to not use threads internally + because of the portability problems that using threads + within the library would introduce. Object handles + returned from DB library functions are free-threaded, + i.e., threads may use handles concurrently, by specifying + the DB_THREAD flag to _d_b___a_p_p_i_n_i_t(3) (or, in the C++ API, + _D_b_E_n_v_:_:_a_p_p_i_n_i_t(3)) and the other subsystem open functions. + Threading is assumed in the Java API, so no special flags + are required, and DB functions will always behave as if + the DB_THREAD flag was specified. + + DB supports multi-threaded applications with the caveat + that it loads and calls functions that are commonly avail- + able in C language environments and which may not them- + selves be thread-safe. Other than this usage, DB has no + static data and maintains no local context between calls + to DB functions. To ensure that applications can safely + use threads in the context of DB, porters to new operating + systems and/or C libraries must confirm that the system + and C library functions used by the DB library are thread- + safe. + + There are some additional caveats about using threads to + access the DB library: + + +o The DB_THREAD flag must be specified for all subsystems + either explicitly or via the _d_b___a_p_p_i_n_i_t (_D_b_E_n_v_:_:_a_p_p_i_n_i_t) + function in the C and C++ APIs. Threading is assumed in + the Java API, so no special flags are required, and DB + functions will always behave as if the DB_THREAD flag + was specified. + + Setting the DB_THREAD flag inconsistently may result in + database corruption. + + +o Only a single thread may call the close function for a + returned database or subsystem handle. See _d_b___o_p_e_n(3) + (_D_b_:_:_o_p_e_n(3)) and the appropriate subsystem manual pages + for more information. + + +o Either the DB_DBT_MALLOC or DB_DBT_USERMEM flags must be + set in a DBT used for key or data retrieval. See + _d_b___d_b_t(3) (_D_b_t(3)) for more information. + + +o The DB_CURRENT, DB_NEXT and DB_PREV flags to the _l_o_g___g_e_t + (_D_b_L_o_g_:_:_g_e_t) function may not be used by a free-threaded + handle. If such calls are necessary, a thread should + explicitly create a unique DB_LOG handle by calling + _l_o_g___o_p_e_n(3) (_D_b_L_o_g_:_:_o_p_e_n). See _d_b___l_o_g(3) (_D_b_L_o_g(3)) for + more information. + + +o Each database operation (i.e., any call to a function + underlying the handles returned by _d_b___o_p_e_n(3) and + _d_b___c_u_r_s_o_r(3)) (_D_b(3) and _D_b_c(3)) is normally performed + on behalf of a unique locker. If, within a single + thread of control, multiple calls on behalf of the same + locker are desired, then transactions must be used. For + example, consider the case where a cursor scan locates a + record, and then based on that record, accesses some + other item in the database. If these are done using the + default lockers for the handle, there is no guarantee + that these two operations will not conflict. If the + application wishes to guarantee that the operations do + not conflict, locks must be obtained on behalf of a + transaction, instead of the default locker id, and a + transaction must be specified to the cursor creation and + the subsequent db call. + + +o Transactions may not span threads, i.e., each transac- + tion must begin and end in the same thread, and each + transaction may only be used by a single thread. + + +o Spinlocks must have been implemented for the com- + piler/architecture combination. Attempting to specify + the DB_THREAD flag will fail if spinlocks are not avail- + able. + + +o The DB library makes a system call to pause for some + number of microseconds when it is necessary to wait on a + lock. This may not be optimal, especially in a thread- + only environment where it will be more efficient to + explicitly yield the processor to another thread. It is + possible to specify a yield function on an per-applica- + tion basis, see _d_b___j_u_m_p___s_e_t(3) for more information. + +CCOOMMPPIILLIINNGG TTHHRREEAADDEEDD AAPPPPLLIICCAATTIIOONNSS + Special compile-time flags are required when compiling + threaded applications with the UNIX include files on some + architectures. + + On IRIX, if you are compiling a threaded application, you + must compile with the -D_SGI_MP_SOURCE flag: + cc -D_SGI_MP_SOURCE ... + + On OSF/1, if you are compiling a threaded application, you + must compile with the -D_REENTRANT flag: + + cc -D_REENTRANT ... + + On Solaris, if you are compiling a threaded application, + you must compile with the -D_REENTRANT flag and link with + the -lthread library: + + cc -D_REENTRANT ... -lthread + +SSEEEE AALLSSOO + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/man.text/db_txn.0 b/mozilla/db/man/man.text/db_txn.0 new file mode 100644 index 00000000000..0ebcbf770b5 --- /dev/null +++ b/mozilla/db/man/man.text/db_txn.0 @@ -0,0 +1,697 @@ + + +NNAAMMEE + db_txn - DB transaction management + +SSYYNNOOPPSSIISS + ##iinncclluuddee <> + + iinntt + ttxxnn__ooppeenn((ccoonnsstt cchhaarr **ddiirr,, + uu__iinntt3322__tt ffllaaggss,, iinntt mmooddee,, DDBB__EENNVV **ddbbeennvv,, DDBB__TTXXNNMMGGRR ****rreeggiioonnpp));; + + iinntt + ttxxnn__bbeeggiinn((DDBB__TTXXNNMMGGRR **ttxxnnpp,, DDBB__TTXXNN **ppiidd,, DDBB__TTXXNN ****ttiidd));; + + iinntt + ttxxnn__pprreeppaarree((DDBB__TTXXNN **ttiidd));; + + iinntt + ttxxnn__ccoommmmiitt((DDBB__TTXXNN **ttiidd));; + + iinntt + ttxxnn__aabboorrtt((DDBB__TTXXNN **ttiidd));; + + uu__iinntt3322__tt + ttxxnn__iidd((DDBB__TTXXNN **ttiidd));; + + iinntt + ttxxnn__cchheecckkppooiinntt((ccoonnsstt DDBB__TTXXNNMMGGRR **ttxxnnpp,, uu__iinntt3322__tt kkbbyyttee,, uu__iinntt3322__tt mmiinn));; + + iinntt + ttxxnn__cclloossee((DDBB__TTXXNNMMGGRR **ttxxnnpp));; + + iinntt + ttxxnn__uunnlliinnkk((ccoonnsstt cchhaarr **ddiirr,, iinntt ffoorrccee,, DDBB__EENNVV **ddbbeennvv));; + + iinntt + ttxxnn__ssttaatt((DDBB__TTXXNNMMGGRR **ttxxnnpp,, + DDBB__TTXXNN__SSTTAATT ****ssttaattpp,, vvooiidd **((**ddbb__mmaalllloocc))((ssiizzee__tt))));; + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + This manual page describes the specific details of the DB + transaction support. + + The _d_b___t_x_n functions are the library interface that pro- + vides transaction semantics. Full transaction support is + provided by a collection of modules that provide inter- + faces to the services required for transaction processing. + + These services are recovery (see _d_b___l_o_g(3)), concurrency + control (see _d_b___l_o_c_k(3)), and the management of shared + data (see _d_b___m_p_o_o_l(3)). Transaction semantics can be + applied to the access methods described in _d_b___o_p_e_n(3) + through function call parameters. + + The model intended for transactional use (and the one that + is used by the access methods) is write-ahead logging pro- + vided by _d_b___l_o_g(3) to record both before- and after- + images. Locking follows a two-phase protocol, with all + locks being released at transaction commit. + + _t_x_n___o_p_e_n + The _t_x_n___o_p_e_n function copies a pointer, to the transaction + region identified by the ddiirreeccttoorryy _d_i_r, into the memory + location referenced by _r_e_g_i_o_n_p. + + If the _d_b_e_n_v argument to _t_x_n___o_p_e_n was initialized using + _d_b___a_p_p_i_n_i_t, _d_i_r is interpreted as described by + _d_b___a_p_p_i_n_i_t(3). + + Otherwise, if _d_i_r is not NULL, it is interpreted relative + to the current working directory of the process. If _d_i_r + is NULL, the following environment variables are checked + in order: ``TMPDIR'', ``TEMP'', and ``TMP''. If one of + them is set, transaction region files are created relative + to the directory it specifies. If none of them are set, + the first possible one of the following directories is + used: _/_v_a_r_/_t_m_p, _/_u_s_r_/_t_m_p, _/_t_e_m_p, _/_t_m_p, _C_:_/_t_e_m_p and _C_:_/_t_m_p. + + All files associated with the transaction region are cre- + ated in this directory. This directory must already exist + when + + transaction region_open is called. If the transaction + region already exists, the process must have permission to + read and write the existing files. If the transaction + region does not already exist, it is optionally created + and initialized. + + The _f_l_a_g_s and _m_o_d_e arguments specify how files will be + opened and/or created when they don't already exist. The + flags value is specified by oorr'ing together one or more of + the following values: + + DB_CREATE + Create any underlying files, as necessary. If the + files do not already exist and the DB_CREATE flag is + not specified, the call will fail. + + + DB_THREAD + Cause the DB_TXNMGR handle returned by the _t_x_n___o_p_e_n + function to be useable by multiple threads within a + single address space, i.e., to be ``free-threaded''. + + DB_TXN_NOSYNC + On transaction commit, do not synchronously flush the + log. This means that transactions exhibit the ACI + (atomicity, consistency and isolation) properties, + but not D (durability), i.e., database integrity will + be maintained but it is possible that some number of + the most recently committed transactions may be + undone during recovery instead of being redone. + + The number of transactions that are potentially at + risk is governed by how often the log is checkpointed + (see _d_b___c_h_e_c_k_p_o_i_n_t(1)) and how many log updates can + fit on a single log page. + + All files created by the transaction subsystem are created + with mode _m_o_d_e (as described in _c_h_m_o_d(2)) and modified by + the process' umask value at the time of creation (see + _u_m_a_s_k(2)). The group ownership of created files is based + on the system and directory defaults, and is not further + specified by DB. + + The transaction subsystem is configured based on the _d_b_e_n_v + argument to _t_x_n___o_p_e_n, which is a pointer to a structure of + type DB_ENV (typedef'd in ). Applications will nor- + mally use the same DB_ENV structure (initialized by + _d_b___a_p_p_i_n_i_t(3)), as an argument to all of the subsystems in + the DB package. + + References to the DB_ENV structure are maintained by DB, + so it may not be discarded until the last close function, + corresponding to an open function for which it was an + argument, has returned. In order to ensure compatibility + with future releases of DB, all fields of the DB_ENV + structure that are not explicitly set should be initial- + ized to 0 before the first time the structure is used. Do + this by declaring the structure external or static, or by + calling the C library routine _b_z_e_r_o(3) or _m_e_m_s_e_t(3). + + The fields of the DB_ENV structure used by _t_x_n___o_p_e_n are + described below. If _d_b_e_n_v is NULL or any of its fields + are set to 0, defaults appropriate for the system are used + where possible. + + The following fields in the DB_ENV structure may be ini- + tialized before calling _t_x_n___o_p_e_n: + + void *(*db_errcall)(char *db_errpfx, char *buffer); + FILE *db_errfile; + const char *db_errpfx; + int db_verbose; + The error fields of the DB_ENV behave as described + for _d_b___a_p_p_i_n_i_t(3). + + + DB_LOG *lg_info; + The logging region that is being used for this trans- + action environment. The _l_g___i_n_f_o field contains a + return value from the function _l_o_g___o_p_e_n. LLooggggiinngg iiss + rreeqquuiirreedd ffoorr ttrraannssaaccttiioonn eennvviirroonnmmeennttss,, aanndd iitt iiss aann + eerrrroorr ttoo nnoott ssppeecciiffyy aa llooggggiinngg rreeggiioonn.. + + DB_LOCKTAB *lk_info; + The locking region that is being used for this trans- + action environment. The _l_k___i_n_f_o field contains a + return value from the function _l_o_c_k___o_p_e_n. If _l_k___i_n_f_o + is NULL, no locking is done in this transaction envi- + ronment. + + u_int32_t tx_max; + The maximum number of simultaneous transactions that + are supported. This bounds the size of backing files + and is used to derive limits for the size of the lock + region and logfiles. When there are more than _t_x___m_a_x + concurrent transactions, calls to _t_x_n___b_e_g_i_n may cause + backing files to grow. If _t_x___m_a_x is 0, a default + value is used. + + int (*tx_recover)(DB_LOG *logp, DBT *log_rec, + DB_LSN *lsnp, int redo, void *info); + A function that is called by _t_x_n___a_b_o_r_t during trans- + action abort. This function takes five arguments: + + logp A pointer to the transaction log (DB_LOG *). + + log_rec + A log record. + + lsnp A pointer to a log sequence number (DB_LSN *). + + redo An integer value that is set to one of the fol- + lowing values: + + DB_TXN_BACKWARD_ROLL + The log is being read backward to determine + which transactions have been committed and + which transactions were not (and should + therefore be aborted during recovery). + + DB_TXN_FORWARD_ROLL + The log is being played forward, any trans- + action ids encountered that have not been + entered into the list referenced by _i_n_f_o + should be ignored. + + DB_TXN_OPENFILES + The log is being read to open all the files + required to perform recovery. + + DB_TXN_REDO + Redo the operation described by the log + record. + + DB_TXN_UNDO + Undo the operation described by the log + record. + + info An opaque pointer used to reference the list of + transaction IDs encountered during recovery. + + If _r_e_c_o_v_e_r is NULL, the default is that only DB + access method operations are transaction protected, + and the default recover function will be used. + + The _t_x_n___o_p_e_n function returns the value of _e_r_r_n_o on fail- + ure and 0 on success. + + _t_x_n___b_e_g_i_n + The _t_x_n___b_e_g_i_n function creates a new transaction in the + designated transaction manager, copying a pointer to a + DB_TXN that uniquely identifies it into the memory refer- + enced by _t_i_d. If the _p_i_d argument is non-NULL, the new + transaction is a nested transaction with the transaction + indicated by _p_i_d as its parent. + + Transactions may not span threads, i.e., each transaction + must begin and end in the same thread, and each transac- + tion may only be used by a single thread. + + The _t_x_n___b_e_g_i_n function returns the value of _e_r_r_n_o on fail- + ure and 0 on success. + + _t_x_n___p_r_e_p_a_r_e + The _t_x_n___p_r_e_p_a_r_e function initiates the beginning of a two + phase commit. In a distributed transaction environment, + _d_b can be used as a local transaction manager. In this + case, the distributed transaction manager must send _p_r_e_- + _p_a_r_e messages to each local manager. The local manager + must then issue a _t_x_n___p_r_e_p_a_r_e and await its successful + return before responding to the distributed transaction + manager. Only after the distributed transaction manager + receives successful responses from all of its _p_r_e_p_a_r_e mes- + sages should it issue any _c_o_m_m_i_t messages. + + The _t_x_n___p_r_e_p_a_r_e function returns the value of _e_r_r_n_o on + failure and 0 on success. + + _t_x_n___c_o_m_m_i_t + The _t_x_n___c_o_m_m_i_t function ends the transaction specified by + the _t_i_d argument. If DB_TXN_NOSYNC was not specified, a + commit log record is written and flushed to disk, as are + all previously written log records. If the transaction is + nested, its locks are acquired by the parent transaction, + otherwise its locks are released. Any applications that + require strict two-phase locking must not release any + locks explicitly, leaving them all to be released by + _t_x_n___c_o_m_m_i_t. + + The _t_x_n___c_o_m_m_i_t function returns the value of _e_r_r_n_o on + failure and 0 on success. + + _t_x_n___a_b_o_r_t + The _t_x_n___a_b_o_r_t function causes an abnormal termination of + the transaction. The log is played backwards and any nec- + essary recovery operations are initiated through the + _r_e_c_o_v_e_r function specified to _t_x_n___o_p_e_n. After recovery is + completed, all locks held by the transaction are acquired + by the parent transaction in the case of a nested transac- + tion or released in the case of a non-nested transaction. + As is the case for _t_x_n___c_o_m_m_i_t, applications that require + strict two phase locking should not explicitly release any + locks. + + The _t_x_n___a_b_o_r_t function returns the value of _e_r_r_n_o on fail- + ure and 0 on success. + + _t_x_n___i_d + The _t_x_n___i_d function returns the unique transaction id + associated with the specified transaction. Locking calls + made on behalf of this transaction should use the value + returned from _t_x_n___i_d as the locker parameter to the + _l_o_c_k___g_e_t or _l_o_c_k___v_e_c calls. + + _t_x_n___c_l_o_s_e + The _t_x_n___c_l_o_s_e function detaches a process from the trans- + action environment specified by the DB_TXNMGR pointer. + All mapped regions are unmapped and any allocated + resources are freed. Any uncommitted transactions are + aborted. + + In addition, if the _d_i_r argument to _t_x_n___o_p_e_n was NULL and + _d_b_e_n_v was not initialized using _d_b___a_p_p_i_n_i_t, all files cre- + ated for this shared region will be removed, as if + _t_x_n___u_n_l_i_n_k were called. + + When multiple threads are using the DB_TXNMGR handle con- + currently, only a single thread may call the _t_x_n___c_l_o_s_e + function. + + The _t_x_n___c_l_o_s_e function returns the value of _e_r_r_n_o on fail- + ure and 0 on success. + + + _t_x_n___u_n_l_i_n_k + The _t_x_n___u_n_l_i_n_k function destroys the transaction region + identified by the directory _d_i_r, removing all files used + to implement the transaction region. (The directory _d_i_r + is not removed.) If there are processes that have called + _t_x_n___o_p_e_n without calling _t_x_n___c_l_o_s_e (i.e., there are pro- + cesses currently using the transaction region), _t_x_n___u_n_l_i_n_k + will fail without further action, unless the force flag is + set, in which case _t_x_n___u_n_l_i_n_k will attempt to remove the + transaction region files regardless of any processes still + using the transaction region. + + The result of attempting to forcibly destroy the region + when a process has the region open is unspecified. Pro- + cesses using a shared memory region maintain an open file + descriptor for it. On UNIX systems, the region removal + should succeed and processes that have already joined the + region should continue to run in the region without + change, however processes attempting to join the transac- + tion region will either fail or attempt to create a new + region. On other systems, e.g., WNT, where the _u_n_l_i_n_k(2) + system call will fail if any process has an open file + descriptor for the file, the region removal will fail. + + In the case of catastrophic or system failure, database + recovery must be performed (see _d_b___r_e_c_o_v_e_r(1) or the + DB_RECOVER and DB_RECOVER_FATAL flags to _d_b___a_p_p_i_n_i_t(3)). + Alternatively, if recovery is not required because no + database state is maintained across failures, it is possi- + ble to clean up a transaction region by removing all of + the files in the directory specified to the _t_x_n___o_p_e_n func- + tion, as transaction region files are never created in any + directory other than the one specified to _t_x_n___o_p_e_n. Note, + however, that this has the potential to remove files cre- + ated by the other DB subsystems in this database environ- + ment. + + The _t_x_n___u_n_l_i_n_k function returns the value of _e_r_r_n_o on + failure and 0 on success. + + _t_x_n___c_h_e_c_k_p_o_i_n_t + The _t_x_n___c_h_e_c_k_p_o_i_n_t function syncs the underlying memory + pool, writes a checkpoint record to the log and then + flushes the log. + + If either _k_b_y_t_e or _m_i_n is non-zero, the checkpoint is only + done if more than _m_i_n minutes have passed since the last + checkpoint, or if more than _k_b_y_t_e kilobytes of log data + have been written since the last checkpoint. + + The _t_x_n___c_h_e_c_k_p_o_i_n_t function returns the value of _e_r_r_n_o on + failure, 0 on success, and DB_INCOMPLETE if there were + pages that needed to be written but that _m_e_m_p___s_y_n_c(3) was + unable to write immediately. In this case, the _t_x_n___c_h_e_c_k_- + _p_o_i_n_t call should be retried. + + + The _t_x_n___c_h_e_c_k_p_o_i_n_t function is the underlying function + used by the _d_b___c_h_e_c_k_p_o_i_n_t(1) utility. See the source code + for the _d_b___c_h_e_c_k_p_o_i_n_t utility for an example of using + _t_x_n___c_h_e_c_k_p_o_i_n_t in a UNIX environment. + + _t_x_n___s_t_a_t + The _t_x_n___s_t_a_t function creates a statistical structure and + copies a pointer to it into the user-specified memory + location. + + Statistical structure are created in allocated memory. If + _d_b___m_a_l_l_o_c is non-NULL, it is called to allocate the mem- + ory, otherwise, the library function _m_a_l_l_o_c(3) is used. + The function _d_b___m_a_l_l_o_c must match the calling conventions + of the _m_a_l_l_o_c(3) library routine. Regardless, the caller + is responsible for deallocating the returned memory. To + deallocate the returned memory, free each returned memory + pointer; pointers inside the memory do not need to be + individually freed. + + The transaction region statistics are stored in a struc- + ture of type DB_TXN_STAT (typedef'd in ). The fol- + lowing DB_TXN_STAT fields will be filled in: + + u_int32_t st_refcnt; + The number of references to the region. + u_int32_t st_regsize; + The size of the region. + DB_LSN st_last_ckp; + The LSN of the last checkpoint. + DB_LSN st_pending_ckp; + The LSN of any checkpoint that is currently in + progress. If _s_t___p_e_n_d_i_n_g___c_k_p is the same as + _s_t___l_a_s_t___c_k_p there is no checkpoint in progress. + time_t st_time_ckp; + The time the last completed checkpoint finished (as + returned by _t_i_m_e(2)). + u_int32_t st_last_txnid; + The last transaction ID allocated. + u_int32_t st_maxtxns; + The maximum number of active transactions supported + by the region. + u_int32_t st_naborts; + The number of transactions that have aborted. + u_int32_t st_nactive; + The number of transactions that are currently active. + u_int32_t st_nbegins; + The number of transactions that have begun. + u_int32_t st_ncommits; + The number of transactions that have committed. + u_int32_t st_region_wait; + The number of times that a thread of control was + forced to wait before obtaining the region lock. + + u_int32_t st_region_nowait; + The number of times that a thread of control was able + to obtain the region lock without waiting. + DB_TXN_ACTIVE *st_txnarray; + A pointer to an array of _s_t___n_a_c_t_i_v_e DB_TXN_ACTIVE + structures, describing the currently active transac- + tions. The following fields of the DB_TXN_ACTIVE + structure (typedef'd in ) will be filled in: + + + u_int32_t txnid; + The transaction ID as returned by _t_x_n___b_e_g_i_n(3). + DB_LSN lsn; + The LSN of the transaction-begin record. + + +TTRRAANNSSAACCTTIIOONNSS + Creating transaction protected applications using the DB + access methods requires little system customization. In + most cases, the default parameters to the locking, log- + ging, memory pool, and transaction subsystems will suf- + fice. Applications can use _d_b___a_p_p_i_n_i_t(3) to perform this + initialization, or they may do it explicitly. + + Each database operation (i.e., any call to a function + underlying the handles returned by _d_b___o_p_e_n(3) and _d_b___c_u_r_- + _s_o_r(3)) is normally performed on behalf of a unique + locker. If multiple calls on behalf of the same locker + are desired, then transactions must be used. + + Once the application has initialized the DB subsystems + that it is using, it may open the DB access method + databases. For applications performing transactions, the + databases must be opened after subsystem initialization, + and cannot be opened as part of a transaction. Once the + databases are opened, the application can group sets of + operations into transactions, by surrounding the opera- + tions with the appropriate _t_x_n___b_e_g_i_n, _t_x_n___c_o_m_m_i_t and + _t_x_n___a_b_o_r_t calls. Databases accessed by a transaction must + not be closed during the transaction. Note, it is not + necessary to transaction protect read-only transactions, + unless those transactions require repeatable reads. + + The DB access methods will make the appropriate calls into + the lock, log and memory pool subsystems in order to guar- + antee that transaction semantics are applied. When the + application is ready to exit, all outstanding transactions + should have been committed or aborted. At this point, all + open DB files should be closed. Once the DB database + files are closed, the DB subsystems should be closed, + either explicitly or by calling _d_b___a_p_p_e_x_i_t(3). + + It is also possible to use the locking, logging and trans- + action subsystems of DB to provide transaction semantics + to objects other than those described by the DB access + methods. In these cases, the application will need more + explicit customization of the subsystems as well as the + development of appropriate data-structure-specific recov- + ery functions. + + For example, consider an application that provides trans- + action semantics to data stored in plain UNIX files + accessed using the _r_e_a_d(2) and _w_r_i_t_e(2) system calls. The + operations for which transaction protection is desired are + bracketed by calls to _t_x_n___b_e_g_i_n and _t_x_n___c_o_m_m_i_t. + + Before data are referenced, the application must make a + call to the lock manager, _d_b___l_o_c_k, for a lock of the + appropriate type (e.g., 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 man- + ager, _d_b___l_o_c_k. Then, the application should make a call + to the log manager, _d_b___l_o_g, to record enough information + to redo the operation in case of failure after commit and + to undo the operation in case of abort. As discussed in + the _d_b___l_o_g(3) manual page, 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. + + After the log message is written, the application may + issue the write system call. After all requests are + issued, the application may call _t_x_n___c_o_m_m_i_t. When + _t_x_n___c_o_m_m_i_t returns, the caller is guaranteed that all nec- + essary log writes have been written to disk. + + At any time, the application may call _t_x_n___a_b_o_r_t, which + will result in the appropriate calls to the _r_e_c_o_v_e_r func- + tion to restore the ``database'' to a consistent pre- + transaction state. (The recover function must be able to + either re-apply or undo the update depending on the con- + text, for each different type of log record.) + + If the application should crash, the recovery process uses + the _d_b___l_o_g interface to read the log and call the _r_e_c_o_v_e_r + function to restore the database to a consistent state. + + The _t_x_n___p_r_e_p_a_r_e function provides the core functionality + to implement distributed transactions, but it does not + manage the notification of distributed transaction man- + agers. The caller is responsible for issuing _t_x_n___p_r_e_p_a_r_e + calls to all sites participating in the transaction. If + all responses are positive, the caller can issue a + _t_x_n___c_o_m_m_i_t. If any of the responses are negative, the + caller should issue a _t_x_n___a_b_o_r_t. In general, the _t_x_n___p_r_e_- + _p_a_r_e call requires that the transaction log be flushed to + disk. + +TTRRAANNSSAACCTTIIOONN IIDD LLIIMMIITTSS + The transaction ID space in Berkeley DB is 2^31, or 2 bil- + lion entries. It is possible that some environments may + need to be aware of this limitation. Consider an applica- + tion performing 600 transactions a second for 15 hours a + day. The transaction ID space will run out in roughly 66 + days: + + 2^31 / (600 * 15 * 60 * 60) = 66 + + Doing only 100 transactions a second exhausts the transac- + tion ID space in roughly one year. + + The transaction ID space is reset each time recovery is + run. If you reach the end of your transaction ID space, + shut down your applications and restart them after running + recovery (see _d_b___r_e_c_o_v_e_r(1) for more information). The + most recently allocated transaction ID is the + _s_t___l_a_s_t___t_x_n_i_d value in the transaction statistics informa- + tion, and is displayed by the _d_b___s_t_a_t(1) utility. + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _d_b___t_x_n: + + DB_HOME + If the _d_b_e_n_v argument to _t_x_n___o_p_e_n was initialized + using _d_b___a_p_p_i_n_i_t, the environment variable DB_HOME + may be used as the path of the database home for the + interpretation of the _d_i_r argument to _t_x_n___o_p_e_n, as + described in _d_b___a_p_p_i_n_i_t(3). + + TMPDIR + If the _d_b_e_n_v argument to _t_x_n___o_p_e_n was NULL or not + initialized using _d_b___a_p_p_i_n_i_t, the environment vari- + able TMPDIR may be used as the directory in which to + create the transaction region, as described in the + _t_x_n___o_p_e_n section above. + +EERRRROORRSS + The _t_x_n___o_p_e_n function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: close(2), db_version(3), fcntl(2), fflush(3), + lseek(2), malloc(3), memcpy(3), memset(3), mmap(2), mun- + map(2), open(2), sigfillset(3), sigprocmask(2), stat(2), + strcpy(3), strdup(3), strerror(3), strlen(3), time(3), + txn_unlink(3), unlink(2), and write(2). + + In addition, the _t_x_n___o_p_e_n function may fail and return + _e_r_r_n_o for the following conditions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The DB_THREAD flag was specified and spinlocks are + not implemented for this architecture. + + The _d_b_e_n_v parameter was NULL. + + [EAGAIN] + The shared memory region was locked and (repeatedly) + unavailable. + + The _t_x_n___b_e_g_i_n function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: fcntl(2), fflush(3), log_put(3), lseek(2), mal- + loc(3), memcpy(3), memset(3), mmap(2), munmap(2), str- + error(3), and write(2). + + In addition, the _t_x_n___b_e_g_i_n function may fail and return + _e_r_r_n_o for the following conditions: + + [ENOSPC] + The maximum number of concurrent transactions has + been reached. + + The _t_x_n___p_r_e_p_a_r_e function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: fcntl(2), fflush(3), log_flush(3), and str- + error(3). + + The _t_x_n___c_o_m_m_i_t function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: fcntl(2), fflush(3), lock_vec(3), log_put(3), + malloc(3), memcpy(3), and strerror(3). + + In addition, the _t_x_n___c_o_m_m_i_t function may fail and return + _e_r_r_n_o for the following conditions: + + [EINVAL] + The transaction was aborted. + + The _t_x_n___a_b_o_r_t function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: DBenv->tx_recover(3), fcntl(2), fflush(3), + lock_vec(3), log_get(3), memset(3), and strerror(3). + + [EINVAL] + The transaction was already aborted. + + The _t_x_n___c_h_e_c_k_p_o_i_n_t function may fail and return _e_r_r_n_o for + any of the errors specified for the following DB and + library functions: fcntl(2), fflush(3), log_compare(3), + log_put(3), malloc(3), memcpy(3), memp_sync(3), memset(3), + strerror(3), and time(3). + + [EINVAL] + An invalid flag value or parameter was specified. + + The _t_x_n___c_l_o_s_e function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: close(2), fcntl(2), fflush(3), log_flush(3), + munmap(2), strerror(3), and txn_abort(3). + + The _t_x_n___u_n_l_i_n_k function may fail and return _e_r_r_n_o for any + of the errors specified for the following DB and library + functions: close(2), fcntl(2), fflush(3), malloc(3), mem- + cpy(3), memset(3), mmap(2), munmap(2), open(2), sig- + fillset(3), sigprocmask(2), stat(2), strcpy(3), strdup(3), + strerror(3), strlen(3), and unlink(2). + + In addition, the _t_x_n___u_n_l_i_n_k function may fail and return + _e_r_r_n_o for the following conditions: + + [EBUSY] + The shared memory region was in use and the force + flag was not set. + + The _t_x_n___s_t_a_t function may fail and return _e_r_r_n_o for any of + the errors specified for the following DB and library + functions: fcntl(2), and malloc(3). + +SSEEEE AALLSSOO + _L_I_B_T_P_: _P_o_r_t_a_b_l_e_, _M_o_d_u_l_a_r _T_r_a_n_s_a_c_t_i_o_n_s _f_o_r _U_N_I_X, Margo + Seltzer, Michael Olson, USENIX proceedings, Winter 1992. + +BBUUGGSS + Nested transactions are not yet implemented. + + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/mancxx.ps/Db.ps b/mozilla/db/man/mancxx.ps/Db.ps new file mode 100644 index 00000000000..e372f576638 --- /dev/null +++ b/mozilla/db/man/mancxx.ps/Db.ps @@ -0,0 +1,940 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:33 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 10 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(Db \255 database access class)108 40.8 Q F0(SYNOPSIS)72 57.6 Q/F2 10 +/Times-Bold@0 SF(#include )108 69.6 Q(static int)108 93.6 Q +(Db::open\(const char *fname, DBTYPE type,)108 105.6 Q +(u_int32_t \215ags, int mode, DbEn)158 117.6 Q 2.5(v*)-.4 G(dben)-2.5 E +1.1 -.55(v, D)-.4 H(bInf).55 E 2.5(o*)-.25 G(dbinf)-2.5 E +(o, Db **dbpp\);)-.25 E(DBTYPE)108 141.6 Q(Db::get_type\(v)108 153.6 Q +(oid\) const;)-.1 E(int)108 177.6 Q(Db::close\(u_int32_t \215ags\);)108 +189.6 Q(int)108 213.6 Q(Db::cursor\(DbTxn *txnid, Dbc **cursor)108 225.6 +Q(p\);)-.1 E(int)108 249.6 Q(Db::del\(Dbt *k)108 261.6 Q(ey)-.1 E 2.5 +(,D)-.55 G(bTxn *txnid\);)-2.5 E(int)108 285.6 Q(Db::fd\(int *fdp\);)108 +297.6 Q(int)108 321.6 Q(Db::get\(DbTxn *txnid, Dbt *k)108 333.6 Q(ey)-.1 +E 2.5(,D)-.55 G(bt *data, u_int32_t \215ags\);)-2.5 E(int)108 357.6 Q +(Db::put\(DbTxn *txnid, Dbt *k)108 369.6 Q(ey)-.1 E 2.5(,D)-.55 G +(bt *data, u_int32_t \215ags\);)-2.5 E(int)108 393.6 Q(Db::stat\(v)108 +405.6 Q(oid *sp, v)-.1 E +(oid *\(*db_malloc\)\(size_t\), u_int32_t \215ags\);)-.1 E(int)108 429.6 +Q(Db::sync\(u_int32_t \215ags\);)108 441.6 Q F0(DESCRIPTION)72 458.4 Q +F1 1.02(The DB library is a f)108 470.4 R 1.019 +(amily of classes that pro)-.1 F 1.019 +(vides a modular programming interf)-.15 F 1.019 +(ace to transactions and)-.1 F 1.377(record-oriented \214le access.)108 +482.4 R 1.378(The library includes support for transactions, locking, logging and \214le page) +6.377 F .443(caching, as well as v)108 494.4 R .443(arious inde)-.25 F +-.15(xe)-.15 G 2.943(da).15 G .442(ccess methods.)-2.943 F(Man)5.442 E +2.942(yo)-.15 G 2.942(ft)-2.942 G .442 +(he classes \(e.g., the \214le page caching class\))-2.942 F .4(are useful independent of the other DB classes, although some classes are e) +108 506.4 R .4(xplicitly based on other classes)-.15 F +(\(e.g., transactions and logging\).)108 518.4 Q -.15(Fo)5 G 2.5(rag).15 +G(eneral description of the DB package, see)-2.5 E/F3 10/Times-Italic@0 +SF(db_intr)2.5 E(o)-.45 E F1(\(3\).).18 E(This manual page describes the Db class, which is the center of access acti) +108 535.2 Q(vity)-.25 E(.)-.65 E .484 +(The currently supported \214le formats are btree, hashed and recno.)108 +552 R .484(The btree format is a representation of a)5.484 F .875 +(sorted, balanced tree structure.)108 564 R .875 +(The hashed format is an e)5.875 F .875 +(xtensible, dynamic hashing scheme.)-.15 F .875(The recno)5.875 F +(format supports \214x)108 576 Q(ed or v)-.15 E +(ariable length records \(optionally retrie)-.25 E -.15(ve)-.25 G 2.5 +(df).15 G(rom a \215at te)-2.5 E(xt \214le\).)-.15 E 1.638 +(Storage and retrie)108 592.8 R -.25(va)-.25 G 4.138(lf).25 G 1.638 +(or the Db access methods are based on k)-4.138 F -.15(ey)-.1 G 1.637 +(/data pairs, using the Dbt class.).15 F(See)6.637 E F3(Dbt)108 604.8 Q +F1(\(3\) for speci\214c information on the structure and capabilities of a Dbt.) +.68 E(The)108 621.6 Q F3(Db::open)4.054 E F1 1.554 +(method opens the database represented by)4.054 F F3(\214le)4.055 E F1 +1.555(for both reading and writing.)4.055 F 1.555(Files ne)6.555 F -.15 +(ve)-.25 G(r).15 E(intended to be shared or preserv)108 633.6 Q +(ed on disk may be created by setting the \214le parameter to NULL.)-.15 +E(The)108 650.4 Q F3(Db::open)3.216 E F1 .716(method copies a pointer to a Db object into the memory location referenced by) +3.216 F F3(dbpp)3.215 E F1 5.715(.T).19 G(he)-5.715 E .861 +(methods of this object allo)108 662.4 R 3.361(wy)-.25 G .861 +(ou to perform v)-3.361 F .862 +(arious database actions, as described belo)-.25 F 4.662 -.65(w. T)-.25 +H(he).65 E F3(Db::open)3.362 E F1(method thro)108 674.4 Q(ws a)-.25 E F3 +(DbException)2.5 E F1(\(3\) or returns the v).24 E(alue of)-.25 E F3 +(errno)2.5 E F1(on f)2.5 E(ailure and 0 on success.)-.1 E .032 +(Note, while most of the access methods use)108 691.2 R F3(\214le)2.532 +E F1 .031 +(as the name of an underlying \214le on disk, this is not guaran-)2.532 +F 3.758(teed. Also,)108 703.2 R(calling)3.758 E F3(Db::open)3.758 E F1 +1.258(is a reasonably e)3.758 F(xpensi)-.15 E 1.558 -.15(ve o)-.25 H +3.758(peration. \(This).15 F 1.258(is based on a model where the)3.758 F +(DBMS k)108 715.2 Q(eeps a set of \214les open for a long time rather than opening and closing them on each query) +-.1 E(.\))-.65 E(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 417.74(Db\(3\) Db\(3\))72 48 R(The)108 84 Q/F1 +10/Times-Italic@0 SF(type)2.562 E F0(ar)2.562 E .061(gument is of type DBTYPE \(as de\214ned in the include \214le\) and must be set to one of) +-.18 F 1.748(DB_BTREE, DB_HASH, DB_RECNO or DB_UNKNO)108 96 R 4.248 +(WN. If)-.35 F F1(type)4.248 E F0 1.748(is DB_UNKNO)4.248 F 1.748 +(WN, the database)-.35 F 3.331(must already e)108 108 R 3.331(xist and) +-.15 F F1(Db::open)5.831 E F0 3.331 +(will then determine if it is of type DB_BTREE, DB_HASH or)5.831 F +(DB_RECNO.)108 120 Q(The)108 136.8 Q F1<8d61>3.76 E(gs)-.1 E F0(and)3.76 +E F1(mode)3.76 E F0(ar)3.76 E 1.26(guments specify ho)-.18 F 3.761<778c> +-.25 G 1.261(les will be opened and/or created when the)-3.761 F 3.761 +(yd)-.15 G(on')-3.761 E 3.761(ta)-.18 G(lready)-3.761 E -.15(ex)108 +148.8 S 2.5(ist. The).15 F(\215ags v)2.5 E(alue is speci\214ed by)-.25 E +/F2 10/Times-Bold@0 SF(or)2.5 E F0 +('ing together one or more of the follo)A(wing v)-.25 E(alues:)-.25 E +(DB_CREA)108 165.6 Q(TE)-1.11 E .484(Create an)133 177.6 R 2.984(yu)-.15 +G .483(nderlying \214les, as necessary)-2.984 F 5.483(.I)-.65 G 2.983 +(ft)-5.483 G .483(he \214les do not already e)-2.983 F .483 +(xist and the DB_CREA)-.15 F .483(TE \215ag)-1.11 F +(is not speci\214ed, the call will f)133 189.6 Q(ail.)-.1 E(DB_NOMMAP) +108 218.4 Q(Do not map this \214le \(see)133 230.4 Q F1(DbMpool)2.5 E F0 +(\(3\) for further information\).).51 E(DB_RDONL)108 259.2 Q(Y)-1 E .248 +(Open the database for reading only)133 271.2 R 5.249(.A)-.65 G .549 +-.15(ny a)-5.249 H .249 +(ttempt to write the database using the access methods will).15 F -.1 +(fa)133 283.2 S(il re).1 E -.05(ga)-.15 G +(rdless of the actual permissions of an).05 E 2.5(yu)-.15 G +(nderlying \214les.)-2.5 E(DB_THREAD)108 312 Q .04 +(Cause the Db handle returned by the)133 324 R F1(Db::open)2.54 E F0 +.039(method to be useable by multiple threads within a sin-)2.539 F +(gle address space, i.e., to be `)133 336 Q(`free-threaded')-.74 E('.) +-.74 E(DB_TR)108 364.8 Q(UNCA)-.4 E(TE)-1.11 E -.74(``)133 376.8 S -.35 +(Tr).74 G(uncate').35 E 3.221('t)-.74 G .721(he database if it e)-3.221 +F .721(xists, i.e., beha)-.15 F 1.021 -.15(ve a)-.2 H 3.221(si).15 G +3.221(ft)-3.221 G .722(he database were just created, discarding an) +-3.221 F(y)-.15 E(pre)133 388.8 Q(vious contents.)-.25 E .496 +(All \214les created by the access methods are created with mode)108 +405.6 R F1(mode)2.996 E F0 .496(\(as described in)2.996 F F1 -.15(ch) +2.996 G(mod).15 E F0 .495(\(2\)\) and modi-).77 F .816 +(\214ed by the process' umask v)108 417.6 R .816 +(alue at the time of creation \(see)-.25 F F1(umask)3.317 E F0 3.317 +(\(2\)\). The).67 F .817(group o)3.317 F .817(wnership of created)-.25 F +(\214les is based on the system and directory def)108 429.6 Q +(aults, and is not further speci\214ed by DB.)-.1 E(See)108 446.4 Q F1 +(DbEn)3.022 E(v)-.4 E F0 .522(\(3\) for a description of the).32 F F1 +(dben)3.022 E(v)-.4 E F0(ar)3.022 E .522(gument, and)-.18 F F1(DbInfo) +3.022 E F0 .522(\(3\) for a description of the).18 F F1(dbinfo)3.021 E +F0(ar)3.021 E(gu-)-.18 E(ment.)108 458.4 Q/F3 9/Times-Bold@0 SF +(Db OPERA)72 475.2 Q(TIONS)-.855 E F0 .646(The Db object returned by)108 +487.2 R F1(Db::open)3.146 E F0 .647 +(describes a database type, and includes a set of functions to perform) +3.146 F -.25(va)108 499.2 S(rious actions, as described belo).25 E 3.8 +-.65(w. T)-.25 H(he methods for Db are as follo).65 E(ws:)-.25 E +(DBTYPE Db::get_type\(v)108 528 Q(oid\);)-.2 E .087 +(The type of the underlying access method \(and \214le format\).)133 540 +R .087(Returns one of DB_BTREE, DB_HASH)5.087 F .937(or DB_RECNO.)133 +552 R .937(This v)5.937 F .938(alue may be used to determine the type of the database after a return from) +-.25 F F1(Db::open)133 564 Q F0(with the)2.5 E F1(type)2.5 E F0(ar)2.5 E +(gument set to DB_UNKNO)-.18 E(WN.)-.35 E +(int Db::close\(u_int32_t \215ags\);)108 592.8 Q 2.615(Am)133 604.8 S +.115(ethod to \215ush an)-2.615 F 2.615(yc)-.15 G .115 +(ached information to disk, close an)-2.615 F 2.615(yo)-.15 G .115 +(pen cursors \(see)-2.615 F F1(Dbc)2.614 E F0 .114(\(3\)\), free an).31 +F 2.614(ya)-.15 G(llo-)-2.614 E .123(cated resources, and close an)133 +616.8 R 2.623(yu)-.15 G .123(nderlying \214les.)-2.623 F .123(Since k) +5.123 F -.15(ey)-.1 G .124(/data pairs are cached in memory).15 F 2.624 +(,f)-.65 G .124(ailing to)-2.724 F(sync the \214le with the)133 628.8 Q +F1(close)2.5 E F0(or)2.5 E F1(sync)2.5 E F0 +(method may result in inconsistent or lost information.)2.5 E(The)133 +645.6 Q F1<8d61>2.5 E(gs)-.1 E F0 +(parameter must be set to 0 or the follo)2.5 E(wing v)-.25 E(alue:)-.25 +E(DB_NOSYNC)133 674.4 Q(Do not \215ush cached information to disk.)158 +686.4 Q .691(The DB_NOSYNC \215ag is a dangerous option.)133 703.2 R .69 +(It should only be set if the application is doing log-)5.691 F .757 +(ging \(with transactions\) so that the database is reco)133 715.2 R +-.15(ve)-.15 G .757(rable after a system or application crash, or if).15 +F(the database is al)133 727.2 Q -.1(wa)-.1 G +(ys generated from scratch after an).1 E 2.5(ys)-.15 G +(ystem or application crash.)-2.5 E(May 4, 1998)280.585 768 Q(2)203.585 +E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 417.74(Db\(3\) Db\(3\))72 48 R/F1 10 +/Times-Bold@0 SF .437 +(It is important to understand that \215ushing cached inf)133 84 R .436 +(ormation to disk only minimizes the win-)-.25 F(do)133 96 Q 3.655(wo) +-.1 G 3.655(fo)-3.655 G 1.155(pportunity f)-3.655 F 1.155 +(or corrupted data.)-.25 F F0 1.156(While unlik)6.156 F(ely)-.1 E 3.656 +(,i)-.65 G 3.656(ti)-3.656 G 3.656(sp)-3.656 G 1.156 +(ossible for database corruption to)-3.656 F 1.326(happen if a system or application crash occurs while writing data to the database.) +133 108 R 2.925 -.8(To e)6.325 H 1.325(nsure that).8 F 1.061 +(database corruption ne)133 120 R -.15(ve)-.25 G 3.561(ro).15 G 1.062(ccurs, applications must either: use transactions and logging with auto-) +-3.561 F 1.325(matic reco)133 132 R -.15(ve)-.15 G(ry).15 E 3.825(,u) +-.65 G 1.325(se logging and application-speci\214c reco)-3.825 F -.15 +(ve)-.15 G(ry).15 E 3.824(,o)-.65 G 3.824(re)-3.824 G 1.324(dit a cop) +-3.824 F 3.824(yo)-.1 G 3.824(ft)-3.824 G 1.324(he database, and,)-3.824 +F .601(once all applications using the database ha)133 144 R .902 -.15 +(ve s)-.2 H .602(uccessfully called).15 F/F2 10/Times-Italic@0 SF(close) +3.102 E F0 3.102(,r).18 G .602(eplace the original database)-3.102 F +(with the updated cop)133 156 Q -.65(y.)-.1 G 1.021 +(When multiple threads are using the Db handle concurrently)133 172.8 R +3.521(,o)-.65 G 1.02(nly a single thread may call the Db)-3.521 F +(handle close method.)133 184.8 Q(The)133 201.6 Q F2(close)2.774 E F0 +.274(method thro)2.774 F .274(ws a)-.25 F F2(DbException)2.774 E F0 .275 +(\(3\) or returns the v).24 F .275(alue of)-.25 F F2(errno)2.775 E F0 +.275(on f)2.775 F .275(ailure and 0 on success.)-.1 F +(int Db::cursor\(DbTxn *txnid, Dbc **cursorp\);)108 230.4 Q 2.5(Am)133 +242.4 S(ethod to create a cursor and cop)-2.5 E 2.5(yap)-.1 G +(ointer to it into the memory referenced by)-2.5 E F2(cur)2.5 E(sorp)-.1 +E F0(.).19 E 2.5(Ac)133 259.2 S(ursor is an object used to pro)-2.5 E +(vide sequential access through a database.)-.15 E 1.769 +(If the \214le is being accessed under transaction protection, the)133 +280.8 R F2(txnid)4.269 E F0 1.768(parameter is a transaction ID)4.268 F +1.69(returned from)133 292.8 R F2(txn_be)4.19 E(gin)-.4 E F0 4.191(,o) +.24 G 1.691(therwise, NULL.)-4.191 F 1.691 +(If transaction protection is enabled, cursors must be)6.691 F .631 +(opened and closed within the conte)133 304.8 R .631 +(xt of a transaction, and the)-.15 F F2(txnid)3.13 E F0 .63 +(parameter speci\214es the transac-)3.13 F(tion conte)133 316.8 Q +(xt in which the cursor may be used.)-.15 E(See)5 E F2(Dbc)2.5 E F0 +(\(3\) for more information.).31 E(The)133 333.6 Q F2(cur)3.384 E(sor) +-.1 E F0 .884(method thro)3.384 F .884(ws a)-.25 F F2(DbException)3.384 +E F0 .885(\(3\) or returns the v).24 F .885(alue of)-.25 F F2(errno) +3.385 E F0 .885(on f)3.385 F .885(ailure and 0 on suc-)-.1 F(cess.)133 +345.6 Q(int Db::del\(DbTxn *txnid, Dbt *k)108 374.4 Q -.15(ey)-.1 G 2.5 +(,u)-.5 G(_int32_t \215ags\);)-2.5 E 3.23(Am)133 386.4 S .73 +(ethod to remo)-3.23 F 1.03 -.15(ve k)-.15 H -.15(ey).05 G .729 +(/data pairs from the database.).15 F .729(The k)5.729 F -.15(ey)-.1 G +.729(/data pair associated with the speci-).15 F(\214ed)133 398.4 Q F2 +-.1(ke)3.33 G(y)-.2 E F0 .83(is discarded from the database.)3.33 F .831 +(In the presence of duplicate k)5.831 F 1.131 -.15(ey v)-.1 H .831 +(alues, all records associ-)-.1 F(ated with the designated k)133 410.4 Q +.3 -.15(ey w)-.1 H(ill be discarded.).15 E 1.769 +(If the \214le is being accessed under transaction protection, the)133 +427.2 R F2(txnid)4.269 E F0 1.768(parameter is a transaction ID)4.268 F +(returned from)133 439.2 Q F2(txn_be)2.5 E(gin)-.4 E F0 2.5(,o).24 G +(therwise, NULL.)-2.5 E(The)133 456 Q F2<8d61>2.5 E(gs)-.1 E F0 +(parameter is currently unused, and must be set to 0.)2.5 E(The)133 +472.8 Q F2(del)3.117 E F0 .617(method thro)3.117 F .617(ws a)-.25 F F2 +(DbException)3.117 E F0 .618(\(3\) or returns the v).24 F .618(alue of) +-.25 F F2(errno)3.118 E F0 .618(on f)3.118 F .618 +(ailure, 0 on success, and)-.1 F(DB_NO)133 484.8 Q +(TFOUND if the speci\214ed)-.4 E F2 -.1(ke)2.5 G(y)-.2 E F0(did not e) +2.5 E(xist in the \214le.)-.15 E(int Db::fd\(int *fdp\);)108 513.6 Q +2.832(Am)133 525.6 S .332 +(ethod that copies a \214le descriptor representati)-2.832 F .632 -.15 +(ve o)-.25 H 2.832(ft).15 G .332 +(he underlying database into the memory ref-)-2.832 F .618(erenced by) +133 537.6 R F2(fdp)3.118 E F0 5.618(.A).19 G .618(\214le descriptor referencing the same \214le will be returned to all processes that call) +-2.5 F F2(Db::open)133 549.6 Q F0 .356(with the same)2.856 F F2(\214le) +2.856 E F0(ar)2.856 E 2.855(gument. This)-.18 F .355 +(\214le descriptor may be safely used as an ar)2.855 F .355 +(gument to the)-.18 F F2(fcntl)133 561.6 Q F0 .762(\(2\) and).51 F F2 +(\215oc)3.262 E(k)-.2 E F0 .763(\(2\) locking functions.).67 F .763 +(The \214le descriptor is not necessarily associated with an)5.763 F +3.263(yo)-.15 G(f)-3.263 E +(the underlying \214les used by the access method.)133 573.6 Q(The)133 +590.4 Q F2(fd)3.956 E F0 1.456 +(method only supports a coarse-grained form of locking.)3.956 F 1.455 +(Applications should use the lock)6.456 F(manager where possible.)133 +602.4 Q(The)133 619.2 Q F2(fd)2.5 E F0(method thro)2.5 E(ws a)-.25 E F2 +(DbException)2.5 E F0(\(3\) or returns the v).24 E(alue of)-.25 E F2 +(errno)2.5 E F0(on f)2.5 E(ailure and 0 on success.)-.1 E +(int Db::get\(DbTxn *txnid, Dbt *k)108 648 Q -.15(ey)-.1 G 2.5(,D)-.5 G +(bt *data, u_int32_t \215ags\);)-2.5 E 3.474(Am)133 660 S .974 +(ethod that is an interf)-3.474 F .974(ace for k)-.1 F -.15(ey)-.1 G +.974(ed retrie).15 F -.25(va)-.25 G 3.474(lf).25 G .974 +(rom the database.)-3.474 F .974(The address and length of the)5.974 F +(data associated with the speci\214ed)133 672 Q F2 -.1(ke)2.5 G(y)-.2 E +F0(are returned in the object referenced by)2.5 E F2(data)2.5 E F0(.).26 +E 1.502(In the presence of duplicate k)133 696 R 1.801 -.15(ey v)-.1 H +(alues,)-.1 E F2 -.1(ge)4.001 G(t).1 E F0 1.501 +(will return the \214rst data item for the designated k)4.001 F -.15(ey) +-.1 G(.)-.5 E 1.004(Duplicates are sorted by insert order e)133 708 R +1.005(xcept where this order has been o)-.15 F -.15(ve)-.15 G 1.005 +(rridden by cursor opera-).15 F(tions.)133 720 Q F1(Retrie)5 E -.1(va) +-.15 G 2.5(lo).1 G 2.5(fd)-2.5 G(uplicates r)-2.5 E(equir)-.18 E +(es the use of cursor operations.)-.18 E F0(See)5 E F2(Dbc)2.5 E F0 +(\(3\) for details.).31 E(May 4, 1998)280.585 768 Q(3)203.585 E EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 417.74(Db\(3\) Db\(3\))72 48 R 1.769 +(If the \214le is being accessed under transaction protection, the)133 +84 R/F1 10/Times-Italic@0 SF(txnid)4.269 E F0 1.768 +(parameter is a transaction ID)4.268 F(returned from)133 96 Q F1(txn_be) +2.5 E(gin)-.4 E F0 2.5(,o).24 G(therwise, NULL.)-2.5 E(The)133 112.8 Q +F1<8d61>2.5 E(gs)-.1 E F0(parameter must be set to 0 or the follo)2.5 E +(wing v)-.25 E(alue:)-.25 E(DB_GET_RECNO)133 141.6 Q(Retrie)158 153.6 Q +.418 -.15(ve a s)-.25 H .118(peci\214c numbered record from a database.) +.15 F .119(Upon return, both the)5.119 F F1 -.1(ke)2.619 G(y)-.2 E F0 +(and)2.619 E F1(data)2.619 E F0(items)2.619 E(will ha)158 165.6 Q .3 +-.15(ve b)-.2 H(een \214lled in, not just the data item as is done for all other uses of the) +.15 E F1 -.1(ge)2.5 G(t).1 E F0(method.)2.5 E -.15(Fo)158 189.6 S 3.49 +(rD).15 G .99(B_GET_RECNO to be speci\214ed, the underlying database must be of type btree, and it) +-3.49 F .532(must ha)158 201.6 R .832 -.15(ve b)-.2 H .533 +(een created with the DB_RECNUM \215ag \(see).15 F F1(Db::open)3.033 E +F0 3.033(\(3\)\). In).24 F .533(this case, the)3.033 F F1(data)3.033 E +F0 1.205(\214eld of the)158 213.6 R F1 -.1(ke)3.705 G(y)-.2 E F0 1.205 +(must be a pointer to a memory location of type)3.705 F F1(db_r)3.704 E +(ecno_t)-.37 E F0 3.704(,a).68 G 3.704(sd)-3.704 G 1.204(escribed in) +-3.704 F F1(Dbt)158 225.6 Q F0(\(3\).).68 E .753 +(If the database is a recno database and the requested k)133 242.4 R +1.053 -.15(ey ex)-.1 H .753(ists, b).15 F .753(ut w)-.2 F .753(as ne)-.1 +F -.15(ve)-.25 G 3.253(re).15 G .753(xplicitly created by)-3.403 F 1.833 +(the application or w)133 254.4 R 1.833(as later deleted, the)-.1 F F1 +-.1(ge)4.333 G(t).1 E F0 1.833(method returns DB_KEYEMPTY)4.333 F 6.833 +(.O)-1.29 G 1.833(therwise, if the)-6.833 F 1.456(requested k)133 266.4 +R 1.756 -.15(ey i)-.1 H(sn').15 E 3.956(ti)-.18 G 3.956(nt)-3.956 G +1.456(he database, the)-3.956 F F1 -.1(ge)3.956 G(t).1 E F0 1.456 +(method returns DB_NO)3.956 F 3.956(TFOUND. Otherwise,)-.4 F(the)3.957 E +F1 -.1(ge)3.957 G(t).1 E F0(method thro)133 278.4 Q(ws a)-.25 E F1 +(DbException)2.5 E F0(\(3\) or returns the v).24 E(alue of)-.25 E F1 +(errno)2.5 E F0(on f)2.5 E(ailure and 0 on success.)-.1 E +(int Db::put\(DbTxn *txnid, Dbt *k)108 307.2 Q -.15(ey)-.1 G 2.5(,D)-.5 +G(bt *data, u_int32_t \215ags\);)-2.5 E 2.801(Am)133 319.2 S .301 +(ethod to store k)-2.801 F -.15(ey)-.1 G .301 +(/data pairs in the database.).15 F .3 +(If the database supports duplicates, the)5.301 F F1(put)2.8 E F0 +(method)2.8 E(adds the ne)133 331.2 Q 2.5(wd)-.25 G(ata v)-2.5 E +(alue at the end of the duplicate set.)-.25 E 1.768 +(If the \214le is being accessed under transaction protection, the)133 +348 R F1(txnid)4.269 E F0 1.769(parameter is a transaction ID)4.269 F +(returned from)133 360 Q F1(txn_be)2.5 E(gin)-.4 E F0 2.5(,o).24 G +(therwise, NULL.)-2.5 E(The \215ags v)133 376.8 Q +(alue is speci\214ed by)-.25 E/F2 10/Times-Bold@0 SF(or)2.5 E F0 +('ing together one or more of the follo)A(wing v)-.25 E(alues:)-.25 E +(DB_APPEND)133 405.6 Q 1.201(Append the k)158 417.6 R -.15(ey)-.1 G +1.201(/data pair to the end of the database.).15 F -.15(Fo)6.201 G 3.7 +(rD).15 G 1.2(B_APPEND to be speci\214ed, the)-3.7 F 1.974 +(underlying database must be of type recno.)158 429.6 R 1.975 +(The record number allocated to the record is)6.974 F +(returned in the speci\214ed)158 441.6 Q F1 -.1(ke)2.5 G(y)-.2 E F0(.) +.32 E(DB_NOO)133 470.4 Q(VER)-.5 E(WRITE)-.55 E(Enter the ne)158 482.4 Q +2.5(wk)-.25 G -.15(ey)-2.6 G(/data pair only if the k).15 E .3 -.15 +(ey d)-.1 H(oes not already appear in the database.).15 E 1.115(The def) +133 499.2 R 1.115(ault beha)-.1 F 1.115(vior of the)-.2 F F1(put)3.615 E +F0 1.115(method is to enter the ne)3.615 F 3.615(wk)-.25 G -.15(ey) +-3.715 G 1.115(/data pair).15 F 3.615(,r)-.4 G 1.115(eplacing an)-3.615 +F 3.615(yp)-.15 G(re)-3.615 E(viously)-.25 E -.15(ex)133 511.2 S .02 +(isting k).15 F .32 -.15(ey i)-.1 H 2.52(fd).15 G .02 +(uplicates are disallo)-2.52 F .021 +(wed, or to add a duplicate entry if duplicates are allo)-.25 F 2.521 +(wed. Ev)-.25 F .021(en if)-.15 F .815(the designated database allo)133 +523.2 R .814(ws duplicates, a call to)-.25 F F1(put)3.314 E F0 .814 +(with the DB_NOO)3.314 F(VER)-.5 E .814(WRITE \215ag set will)-.55 F -.1 +(fa)133 535.2 S(il if the k).1 E .3 -.15(ey a)-.1 H(lready e).15 E +(xists in the database.)-.15 E(The)133 552 Q F1(put)3.084 E F0 .584 +(method thro)3.084 F .584(ws a)-.25 F F1(DbException)3.084 E F0 .585 +(\(3\) or returns the v).24 F .585(alue of)-.25 F F1(errno)3.085 E F0 +.585(on f)3.085 F .585(ailure, 0 on success, and)-.1 F +(DB_KEYEXIST if the DB_NOO)133 564 Q(VER)-.5 E(WRITE)-.55 E F1<8d61>2.5 +E(g)-.1 E F0 -.1(wa)2.5 G 2.5(ss).1 G(et and the k)-2.5 E .3 -.15(ey a) +-.1 H(lready e).15 E(xists in the \214le.)-.15 E +(int Db::sync\(u_int32_t \215ags\);)108 592.8 Q 4.302(Am)133 604.8 S +1.802(ethod to \215ush an)-4.302 F 4.301(yc)-.15 G 1.801 +(ached information to disk.)-4.301 F 1.801 +(If the database is in memory only)6.801 F 4.301(,t)-.65 G(he)-4.301 E +F1(sync)4.301 E F0(method has no ef)133 616.8 Q(fect and will al)-.25 E +-.1(wa)-.1 G(ys succeed.).1 E(The)133 633.6 Q F1<8d61>2.5 E(gs)-.1 E F0 +(parameter is currently unused, and must be set to 0.)2.5 E(See the)133 +650.4 Q F1(close)2.5 E F0(method description abo)2.5 E .3 -.15(ve f)-.15 +H(or a discussion of Db and cached data.).15 E(The)133 667.2 Q F1(sync) +2.5 E F0(method thro)2.5 E(ws a)-.25 E F1(DbException)2.5 E F0 +(\(3\) or returns the v).24 E(alue of)-.25 E F1(errno)2.5 E F0(on f)2.5 +E(ailure and 0 on success.)-.1 E(int Db::stat\(v)108 696 Q(oid *sp,)-.2 +E -.2(vo)183 708 S(id *\(*db_malloc\)\(size_t\), u_int32_t \215ags\);).2 +E 5.12(Am)133 720 S 2.62 +(ethod to create a statistical structure and cop)-5.12 F 5.12(yap)-.1 G +2.62(ointer to it into user)-5.12 F 2.62(-speci\214ed memory)-.2 F +(May 4, 1998)280.585 768 Q(4)203.585 E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 417.74(Db\(3\) Db\(3\))72 48 R 2.982 +(locations. Speci\214cally)133 84 R 2.982(,i)-.65 G(f)-2.982 E/F1 10 +/Times-Italic@0 SF(sp)2.982 E F0 .481(is non-NULL, a pointer to the statistics for the database are copied into) +2.982 F(the memory location it references.)133 96 Q .218 +(Statistical structures are created in allocated memory)133 120 R 5.218 +(.I)-.65 G(f)-5.218 E F1(db_malloc)2.718 E F0 .218 +(is non-NULL, it is called to allo-)2.718 F 1.36(cate the memory)133 132 +R 3.86(,o)-.65 G 1.359(therwise, the library function)-3.86 F F1(malloc) +3.859 E F0 1.359(\(3\) is used.).31 F 1.359(The function)6.359 F F1 +(db_malloc)3.859 E F0(must)3.859 E .79(match the calling con)133 144 R +-.15(ve)-.4 G .791(ntions of the).15 F F1(malloc)3.291 E F0 .791 +(\(3\) library routine.).31 F(Re)5.791 E -.05(ga)-.15 G .791 +(rdless, the caller is responsible).05 F .667 +(for deallocating the returned memory)133 156 R 5.666(.T)-.65 G 3.166 +(od)-6.466 G .666(eallocate the returned memory)-3.166 F 3.166(,f)-.65 G +.666(ree each returned mem-)-3.166 F +(ory pointer; pointers inside the memory do not need to be indi)133 168 +Q(vidually freed.)-.25 E/F2 10/Times-Bold@0 SF 1.82(In the pr)133 192 R +1.821(esence of multiple thr)-.18 F 1.821(eads or pr)-.18 F 1.821 +(ocesses accessing an acti)-.18 F 2.021 -.1(ve d)-.1 H 1.821 +(atabase, the r).1 F(etur)-.18 E(ned)-.15 E(inf)133 204 Q +(ormation may be out-of-date.)-.25 E .367 +(This method may access all of the pages in the database, and ther)133 +228 R(ef)-.18 E(or)-.25 E 2.866(em)-.18 G .366(ay incur a se)-2.866 F +-.1(ve)-.15 G .726 -.18(re p).1 H(er).18 E(-)-.37 E -.25(fo)133 240 S +(rmance penalty and ha).25 E .2 -.1(ve o)-.25 H -.15(bv).1 G +(ious negati).15 E .2 -.1(ve e)-.1 H(ffects on the underlying b).1 E +(uffer pool.)-.2 E F0(The)133 268.8 Q F1<8d61>2.5 E(gs)-.1 E F0 +(parameter must be set to 0 or the follo)2.5 E(wing v)-.25 E(alue:)-.25 +E(DB_RECORDCOUNT)133 302.4 Q .746 +(In the case of a btree or recno database, \214ll in the)158 314.4 R F1 +(bt_nr)3.246 E(ecs)-.37 E F0 .747(\214eld, b)3.246 F .747 +(ut do not collect an)-.2 F 3.247(yo)-.15 G(ther)-3.247 E 3.608 +(information. This)158 326.4 R 1.107(\215ag mak)3.608 F 1.107 +(es it reasonable for applications to request a record count from a)-.1 +F(database without incurring a performance penalty)158 338.4 Q(.)-.65 E +(The)133 355.2 Q F1(stat)2.5 E F0(method thro)2.5 E(ws a)-.25 E F1 +(DbException)2.5 E F0(\(3\) or returns the v).24 E(alue of)-.25 E F1 +(errno)2.5 E F0(on f)2.5 E(ailure and 0 on success.)-.1 E 4.143(In the case of a btree or recno database, the statistics are stored in a structure of type) +133 384 R(DB_BTREE_ST)133 396 Q 2.22 -1.11(AT \()-.93 H -1.95(typedef ') +1.11 F 2.5(di)-.5 G 2.5(n<)-2.5 G 2.5(db_cxx.h>\). The)-2.5 F(follo)2.5 +E(wing \214elds will be \214lled in:)-.25 E(u_int32_t bt_magic;)133 +412.8 Q(Magic number that identi\214es the \214le as a btree \214le.)158 +424.8 Q(u_int32_t bt_v)133 436.8 Q(ersion;)-.15 E(The v)158 448.8 Q +(ersion of the btree \214le type.)-.15 E(u_int32_t bt_\215ags;)133 460.8 +Q 5.925(Permanent database \215ags, including DB_DUP)158 472.8 R 8.424 +(,D)-1.11 G 5.924(B_FIXEDLEN, DB_RECNUM and)-8.424 F(DB_RENUMBER.)158 +484.8 Q(u_int32_t bt_mink)133 496.8 Q -.15(ey)-.1 G(;).15 E(The)158 +508.8 Q F1(bt_mink)2.5 E -.3(ey)-.1 G F0 -.25(va)2.8 G +(lue speci\214ed to).25 E F1(Db::open)2.5 E F0(\(3\), if an).24 E -.65 +(y.)-.15 G(u_int32_t bt_re_len;)133 520.8 Q(The)158 532.8 Q F1 -.37(re) +2.5 G(_len).37 E F0 -.25(va)2.5 G(lue speci\214ed to).25 E F1(Db::open) +2.5 E F0(\(3\), if an).24 E -.65(y.)-.15 G(u_int32_t bt_re_pad;)133 +544.8 Q(The)158 556.8 Q F1 -.37(re)2.5 G(_pad).37 E F0 -.25(va)2.5 G +(lue speci\214ed to).25 E F1(Db::open)2.5 E F0(\(3\), if an).24 E -.65 +(y.)-.15 G(u_int32_t bt_pagesize;)133 568.8 Q +(Underlying tree page size.)158 580.8 Q(u_int32_t bt_le)133 592.8 Q -.15 +(ve)-.25 G(ls;).15 E(Number of le)158 604.8 Q -.15(ve)-.25 G +(ls in the tree.).15 E(u_int32_t bt_nrecs;)133 616.8 Q .533(Number of data items in the tree \(since there may be multiple data items per k) +158 628.8 R -.15(ey)-.1 G 3.034(,t)-.5 G .534(his number)-3.034 F +(may not be the same as the number of k)158 640.8 Q -.15(ey)-.1 G(s\).) +.15 E(u_int32_t bt_int_pg;)133 652.8 Q(Number of tree internal pages.) +158 664.8 Q(u_int32_t bt_leaf_pg;)133 676.8 Q +(Number of tree leaf pages.)158 688.8 Q(u_int32_t bt_dup_pg;)133 700.8 Q +(Number of tree duplicate pages.)158 712.8 Q(May 4, 1998)280.585 768 Q +(5)203.585 E EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 417.74(Db\(3\) Db\(3\))72 48 R(u_int32_t bt_o) +133 84 Q -.15(ve)-.15 G(r_pg;).15 E(Number of tree o)158 96 Q -.15(ve) +-.15 G(r\215o).15 E 2.5(wp)-.25 G(ages.)-2.5 E(u_int32_t bt_free;)133 +108 Q(Number of pages on the free list.)158 120 Q(u_int32_t bt_freed;) +133 132 Q(Number of pages made a)158 144 Q -.25(va)-.2 G +(ilable for reuse because the).25 E 2.5(yw)-.15 G(ere emptied.)-2.5 E +(u_int32_t bt_int_pgfree;)133 156 Q +(Number of bytes free in tree internal pages.)158 168 Q +(u_int32_t bt_leaf_pgfree;)133 180 Q +(Number of bytes free in tree leaf pages.)158 192 Q +(u_int32_t bt_dup_pgfree;)133 204 Q +(Number of bytes free in tree duplicate pages.)158 216 Q(u_int32_t bt_o) +133 228 Q -.15(ve)-.15 G(r_pgfree;).15 E(Number of bytes free in tree o) +158 240 Q -.15(ve)-.15 G(r\215o).15 E 2.5(wp)-.25 G(ages.)-2.5 E +(u_int32_t bt_pfxsa)133 252 Q -.15(ve)-.2 G(d;).15 E(Number of bytes sa) +158 264 Q -.15(ve)-.2 G 2.5(db).15 G 2.5(yp)-2.5 G(re\214x compression.) +-2.5 E(u_int32_t bt_split;)133 276 Q -.8(To)158 288 S +(tal number of tree page splits \(includes f).8 E +(ast and root splits\).)-.1 E(u_int32_t bt_rootsplit;)133 300 Q +(Number of root page splits.)158 312 Q(u_int32_t bt_f)133 324 Q +(astsplit;)-.1 E .57(Number of f)158 336 R .57(ast splits.)-.1 F .57 +(When sorted k)5.57 F -.15(ey)-.1 G 3.069(sa).15 G .569 +(re added to the database, the Db btree implementa-)-3.069 F 1.104 +(tion will split left or right to increase the page-\214ll f)158 348 R +(actor)-.1 E 6.105(.T)-.55 G 1.105(his number is a measure of ho)-6.105 +F(w)-.25 E(often it w)158 360 Q(as possible to mak)-.1 E 2.5(es)-.1 G +(uch a split.)-2.5 E(u_int32_t bt_added;)133 372 Q(Number of k)158 384 Q +-.15(ey)-.1 G 2.5(sa).15 G(dded.)-2.5 E(u_int32_t bt_deleted;)133 396 Q +(Number of k)158 408 Q -.15(ey)-.1 G 2.5(sd).15 G(eleted.)-2.5 E +(u_int32_t bt_get;)133 420 Q 2.274(Number of k)158 432 R -.15(ey)-.1 G +4.774(sr).15 G(etrie)-4.774 E -.15(ve)-.25 G 4.774(d. \(Note,).15 F +2.274(this v)4.774 F 2.274(alue will not re\215ect an)-.25 F 4.773(yk) +-.15 G -.15(ey)-4.873 G 4.773(sr).15 G(etrie)-4.773 E -.15(ve)-.25 G +4.773(dw).15 G 2.273(hen the)-4.773 F .22(database w)158 444 R .221(as open for read-only access, as there is no permanent location to store the informa-) +-.1 F(tion in this case.\))158 456 Q(u_int32_t bt_cache_hit;)133 468 Q +1.003(Number of hits in tree f)158 480 R 1.003(ast-insert code.)-.1 F +1.003(When sorted k)6.003 F -.15(ey)-.1 G 3.503(sa).15 G 1.003 +(re added to the database, the Db)-3.503 F 1.617(btree implementation will check the last page where an insert occurred before doing a full) +158 492 R 2.5(lookup. This)158 504 R(number is a measure of ho)2.5 E 2.5 +(wo)-.25 G(ften the lookup w)-2.5 E(as successful.)-.1 E +(u_int32_t bt_cache_miss;)133 516 Q .052(Number of misses in tree f)158 +528 R .051(ast-insert code.)-.1 F .051 +(See the description of bt_cache_hit; this number is a)5.051 F +(measure of ho)158 540 Q 2.5(wo)-.25 G(ften the lookup f)-2.5 E(ailed.) +-.1 E/F1 9/Times-Bold@0 SF(ENVIR)72 556.8 Q(ONMENT V)-.27 E(ARIABLES) +-1.215 E F0(The follo)108 568.8 Q(wing en)-.25 E(vironment v)-.4 E +(ariables af)-.25 E(fect the e)-.25 E -.15(xe)-.15 G(cution of).15 E/F2 +10/Times-Italic@0 SF(Db::open)2.5 E F0(:).24 E(DB_HOME)108 585.6 Q 2.748 +(If the)133 597.6 R F2(dben)5.248 E(v)-.4 E F0(ar)5.248 E 2.748 +(gument to)-.18 F F2(Db::open)5.248 E F0 -.1(wa)5.248 G 5.248(si).1 G +2.748(nitialized using)-5.248 F F2(db_appinit)5.249 E F0 5.249(,t).68 G +2.749(he en)-5.249 F 2.749(vironment v)-.4 F(ariable)-.25 E .508(DB_HOME may be used as the path of the database home for the interpretation of the) +133 609.6 R F2(dir)3.008 E F0(ar)3.008 E(gument)-.18 E(to)133 621.6 Q F2 +(Db::open)3.457 E F0 3.457(,a).24 G 3.457(sd)-3.457 G .957(escribed in) +-3.457 F F2(db_appinit)3.457 E F0 3.457(\(3\). Speci\214cally).68 F(,) +-.65 E F2(Db::open)3.458 E F0 .958(is af)3.458 F .958 +(fected by the con\214guration)-.25 F(string v)133 633.6 Q(alue of DB_D) +-.25 E -1.21 -1.11(AT A)-.4 H(_DIR.)1.11 E F1(EXAMPLES)72 650.4 Q F0 .49 +(Applications that create short-li)108 662.4 R -.15(ve)-.25 G 2.99(dd) +.15 G .489(atabases that are discarded or recreated when the system f) +-2.99 F .489(ails and are)-.1 F 1.96(unconcerned with concurrent access and loss of data due to catastrophic f) +108 674.4 R 1.96(ailure, may wish to use the)-.1 F F2(Db::open)108 686.4 +Q F0 .051(functionality without other parts of the Db library)2.551 F +5.051(.S)-.65 G .05(uch applications will only be concerned with)-5.051 +F .066(the Db access methods.)108 698.4 R .066 +(The Db access methods will use the memory pool subsystem, b)5.066 F +.067(ut the application is)-.2 F(unlik)108 710.4 Q .051(ely to be a)-.1 +F -.1(wa)-.15 G .051(re of this.).1 F .051(See the \214le)5.051 F F2 -.2 +(ex)2.551 G(amples_cxx/AccessExample).2 E(.cpp)-.15 E F0 .05 +(in the Db source distrib)2.551 F .05(ution for)-.2 F 2.5(aC)108 722.4 S +(++ language code e)-2.5 E(xample of ho)-.15 E 2.5(ws)-.25 G +(uch an application might use the Db library)-2.5 E(.)-.65 E +(May 4, 1998)280.585 768 Q(6)203.585 E EP +%%Page: 7 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 417.74(Db\(3\) Db\(3\))72 48 R/F1 9/Times-Bold@0 +SF(ERR)72 84 Q(ORS)-.27 E F0 .049(Methods mark)108 96 R .049 +(ed as returning)-.1 F/F2 10/Times-Italic@0 SF(errno)2.549 E F0 .049 +(will, by def)2.549 F .049(ault, thro)-.1 F 2.549(wa)-.25 G 2.549(ne) +-2.549 G .05(xception that encapsulates the error informa-)-2.699 F 2.5 +(tion. The)108 108 R(def)2.5 E(ault error beha)-.1 E +(vior can be changed, see)-.2 E F2(DbException)2.5 E F0(\(3\).).24 E +(The)108 124.8 Q F2(Db::open)2.5 E F0(method may f)2.5 E(ail and thro) +-.1 E 2.5(wa)-.25 G F2(DbException)A F0(\(3\)).24 E(or return)108 148.8 +Q F2(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: Db::sync\(3\),)-.25 E +(DbLock::get\(3\), DbLock::put\(3\), DbLockT)108 160.8 Q +(ab::id\(3\), DbLockT)-.8 E(ab::v)-.8 E(ec\(3\), DbLog::db_re)-.15 E +(gister\(3\),)-.15 E +(DbLog::put\(3\), DbMpool::close\(3\), DbMpool::db_re)108 172.8 Q +(gister\(3\), DbMpool::open\(3\), DbMpoolFile::close\(3\),)-.15 E(DbMpoolFile::get\(3\), DbMpoolFile::open\(3\), DbMpoolFile::put\(3\), DbMpoolFile::set\(3\), DbM-) +108 184.8 Q(poolFile::sync\(3\), calloc\(3\), close\(2\), fcntl\(2\), f) +108 196.8 Q(\215ush\(3\), malloc\(3\), memcp)-.25 E(y\(3\), memmo)-.1 E +-.15(ve)-.15 G(\(3\), memset\(3\),).15 E(mmap\(2\), munmap\(2\), open\(2\), read\(2\), realloc\(3\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp) +108 208.8 Q(y\(3\),)-.1 E +(strdup\(3\), strerror\(3\), strlen\(3\), time\(3\), and unlink\(2\).) +108 220.8 Q .899(In addition, the)108 237.6 R F2(Db::open)3.399 E F0 +.899(method may f)3.399 F .899(ail and thro)-.1 F 3.399(wa)-.25 G F2 +(DbException)A F0 .899(\(3\) or return).24 F F2(errno)3.398 E F0 .898 +(for the follo)3.398 F(wing)-.25 E(conditions:)108 249.6 Q([EA)108 266.4 +Q(GAIN])-.4 E 2.5(Al)133 278.4 S(ock w)-2.5 E(as una)-.1 E -.25(va)-.2 G +(ilable.).25 E([EINV)108 295.2 Q(AL])-1.35 E 2.162(An in)133 307.2 R +-.25(va)-.4 G 2.162(lid \215ag v).25 F 2.163(alue or parameter w)-.25 F +2.163(as speci\214ed \(e.g., unkno)-.1 F 2.163 +(wn database type, page size, hash)-.25 F .252 +(method, recno pad byte, byte order\) or a \215ag v)133 319.2 R .252 +(alue or parameter that is incompatible with the current)-.25 F F2 +(\214le)133 331.2 Q F0(speci\214cation.)2.5 E(The DB_THREAD \215ag w)133 +355.2 Q(as speci\214ed and spinlocks are not implemented for this architecture.) +-.1 E(There is a mismatch between the v)133 379.2 Q(ersion number of) +-.15 E F2(\214le)2.5 E F0(and the softw)2.5 E(are.)-.1 E(A)133 403.2 Q +F2 -.37(re)2.888 G(_sour).37 E(ce)-.37 E F0 .388(\214le w)2.888 F .389 +(as speci\214ed with either the DB_THREAD \215ag or a non-NULL)-.1 F F2 +(tx_info)2.889 E F0 .389(\214eld in the)2.889 F(DbEn)133 415.2 Q 2.5(va) +-.4 G -.18(rg)-2.5 G(ument to).18 E F2(Db::open)2.5 E F0(.).24 E +([ENOENT])108 432 Q 2.5(An)133 444 S(on-e)-2.5 E(xistent)-.15 E F2 -.37 +(re)2.5 G(_sour).37 E(ce)-.37 E F0(\214le w)2.5 E(as speci\214ed.)-.1 E +([EPERM])108 460.8 Q .955(Database corruption w)133 472.8 R .955 +(as detected.)-.1 F .955(All subsequent database calls \(other than) +5.955 F F2(Db::close)3.455 E F0 3.455(\)w).18 G .955(ill return)-3.455 F +(EPERM.)133 484.8 Q(The)108 501.6 Q F2(Db::close)2.5 E F0(method may f) +2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G F2(DbException)A F0(\(3\)).24 E +(or return)108 525.6 Q F2(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5 +(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: Db::sync\(3\),)-.25 E +(DbLock::get\(3\), DbLock::put\(3\), DbLockT)108 537.6 Q(ab::v)-.8 E +(ec\(3\), DbLog::db_re)-.15 E(gister\(3\), DbLog::put\(3\), DbM-)-.15 E +(pool::close\(3\), DbMpoolFile::close\(3\), DbMpoolFile::get\(3\), DbMpoolFile::put\(3\), DbMpoolFile::set\(3\),) +108 549.6 Q(DbMpoolFile::sync\(3\), calloc\(3\), close\(2\), f)108 561.6 +Q(\215ush\(3\), malloc\(3\), memcp)-.25 E(y\(3\), memmo)-.1 E -.15(ve) +-.15 G(\(3\), memset\(3\),).15 E +(munmap\(2\), realloc\(3\), and strerror\(3\).)108 573.6 Q(The)108 590.4 +Q F2(Db::cur)2.5 E(sor)-.1 E F0(method may f)2.5 E(ail and thro)-.1 E +2.5(wa)-.25 G F2(DbException)A F0(\(3\)).24 E(or return)108 614.4 Q F2 +(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: calloc\(3\).)-.25 E .488 +(In addition, the)108 631.2 R F2(Db::cur)2.988 E(sor)-.1 E F0 .488 +(method may f)2.988 F .488(ail and thro)-.1 F 2.988(wa)-.25 G F2 +(DbException)A F0 .488(\(3\) or return).24 F F2(errno)2.988 E F0 .489 +(for the follo)2.988 F(wing)-.25 E(conditions:)108 643.2 Q([EINV)108 660 +Q(AL])-1.35 E(An in)133 672 Q -.25(va)-.4 G(lid \215ag v).25 E +(alue or parameter w)-.25 E(as speci\214ed.)-.1 E([EPERM])108 688.8 Q +.955(Database corruption w)133 700.8 R .955(as detected.)-.1 F .955 +(All subsequent database calls \(other than)5.955 F F2(Db::close)3.455 E +F0 3.455(\)w).18 G .955(ill return)-3.455 F(EPERM.)133 712.8 Q(The)108 +729.6 Q F2(Db::del)2.5 E F0(method may f)2.5 E(ail and thro)-.1 E 2.5 +(wa)-.25 G F2(DbException)A F0(\(3\)).24 E(May 4, 1998)280.585 768 Q(7) +203.585 E EP +%%Page: 8 8 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 417.74(Db\(3\) Db\(3\))72 48 R(or return)108 84 +Q/F1 10/Times-Italic@0 SF(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5 +(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: DbLock::get\(3\),)-.25 E +(DbLock::put\(3\), DbLockT)108 96 Q(ab::id\(3\), DbLockT)-.8 E(ab::v)-.8 +E(ec\(3\), DbLog::put\(3\), DbMpoolFile::get\(3\), DbM-)-.15 E +(poolFile::put\(3\), DbMpoolFile::set\(3\), calloc\(3\), fcntl\(2\), f) +108 108 Q(\215ush\(3\), malloc\(3\), memcmp\(3\), memcp)-.25 E(y\(3\),) +-.1 E(memmo)108 120 Q -.15(ve)-.15 G +(\(3\), memset\(3\), realloc\(3\), and strerror\(3\).).15 E .079 +(In addition, the)108 136.8 R F1(Db::del)2.579 E F0 .078(method may f) +2.579 F .078(ail and thro)-.1 F 2.578(wa)-.25 G F1(DbException)A F0 .078 +(\(3\) or return).24 F F1(errno)2.578 E F0 .078(for the follo)2.578 F +.078(wing con-)-.25 F(ditions:)108 148.8 Q([EA)108 165.6 Q(GAIN])-.4 E +2.5(Al)133 177.6 S(ock w)-2.5 E(as una)-.1 E -.25(va)-.2 G(ilable.).25 E +([EINV)108 194.4 Q(AL])-1.35 E(An in)133 206.4 Q -.25(va)-.4 G +(lid \215ag v).25 E(alue or parameter w)-.25 E(as speci\214ed.)-.1 E +([EPERM])108 223.2 Q .955(Database corruption w)133 235.2 R .955 +(as detected.)-.1 F .955(All subsequent database calls \(other than) +5.955 F F1(Db::close)3.455 E F0 3.455(\)w).18 G .955(ill return)-3.455 F +(EPERM.)133 247.2 Q .34(In addition, the)108 264 R F1(Db::fd)2.84 E F0 +.34(method may f)2.84 F .34(ail and thro)-.1 F 2.839(wa)-.25 G F1 +(DbException)A F0 .339(\(3\) or return).24 F F1(errno)2.839 E F0 .339 +(for the follo)2.839 F .339(wing con-)-.25 F(ditions:)108 276 Q +([ENOENT])108 292.8 Q(The)133 304.8 Q F1(Db::fd)2.671 E F0 .172 +(method w)2.671 F .172(as called for an in-memory database, or no underlying \214le has yet been created.) +-.1 F([EPERM])108 321.6 Q .955(Database corruption w)133 333.6 R .955 +(as detected.)-.1 F .955(All subsequent database calls \(other than) +5.955 F F1(Db::close)3.455 E F0 3.455(\)w).18 G .955(ill return)-3.455 F +(EPERM.)133 345.6 Q(The)108 362.4 Q F1(Db::g)2.5 E(et)-.1 E F0 +(method may f)2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0 +(\(3\)).24 E(or return)108 386.4 Q F1(errno)2.5 E F0(for an)2.5 E 2.5 +(yo)-.15 G 2.5(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: DbLock::get\(3\),)-.25 E +(DbLock::put\(3\), DbLockT)108 398.4 Q(ab::id\(3\), DbLockT)-.8 E(ab::v) +-.8 E(ec\(3\), DbLog::put\(3\), DbMpoolFile::get\(3\), DbM-)-.15 E(poolFile::put\(3\), DbMpoolFile::set\(3\), Dbc::get\(3\), calloc\(3\), fcntl\(2\), f) +108 410.4 Q(\215ush\(3\), malloc\(3\), memcmp\(3\),)-.25 E(memcp)108 +422.4 Q(y\(3\), memmo)-.1 E -.15(ve)-.15 G +(\(3\), memset\(3\), realloc\(3\), and strerror\(3\).).15 E .085 +(In addition, the)108 439.2 R F1(Db::g)2.584 E(et)-.1 E F0 .084 +(method may f)2.584 F .084(ail and thro)-.1 F 2.584(wa)-.25 G F1 +(DbException)A F0 .084(\(3\) or return).24 F F1(errno)2.584 E F0 .084 +(for the follo)2.584 F .084(wing con-)-.25 F(ditions:)108 451.2 Q([EA) +108 468 Q(GAIN])-.4 E 2.5(Al)133 480 S(ock w)-2.5 E(as una)-.1 E -.25 +(va)-.2 G(ilable.).25 E([EINV)108 496.8 Q(AL])-1.35 E(An in)133 508.8 Q +-.25(va)-.4 G(lid \215ag v).25 E(alue or parameter w)-.25 E +(as speci\214ed.)-.1 E .993(The DB_THREAD \215ag w)133 532.8 R .993 +(as speci\214ed to the)-.1 F F1(Db::open)3.493 E F0 .994 +(\(3\) method and neither the DB_DBT_MAL-).24 F +(LOC or DB_DBT_USERMEM \215ags were set in the Dbt.)133 544.8 Q 2.5(Ar) +133 568.8 S(ecord number of 0 w)-2.5 E(as speci\214ed.)-.1 E([EPERM])108 +585.6 Q .955(Database corruption w)133 597.6 R .955(as detected.)-.1 F +.955(All subsequent database calls \(other than)5.955 F F1(Db::close) +3.455 E F0 3.455(\)w).18 G .955(ill return)-3.455 F(EPERM.)133 609.6 Q +(The)108 626.4 Q F1(Db::put)2.5 E F0(method may f)2.5 E(ail and thro)-.1 +E 2.5(wa)-.25 G F1(DbException)A F0(\(3\)).24 E(or return)108 650.4 Q F1 +(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: DbLock::get\(3\),)-.25 E +(DbLock::put\(3\), DbLockT)108 662.4 Q(ab::id\(3\), DbLockT)-.8 E(ab::v) +-.8 E(ec\(3\), DbLog::put\(3\), DbMpoolFile::get\(3\), DbM-)-.15 E +(poolFile::put\(3\), DbMpoolFile::set\(3\), calloc\(3\), fcntl\(2\), f) +108 674.4 Q(\215ush\(3\), malloc\(3\), memcmp\(3\), memcp)-.25 E +(y\(3\),)-.1 E(memmo)108 686.4 Q -.15(ve)-.15 G +(\(3\), memset\(3\), realloc\(3\), and strerror\(3\).).15 E .046 +(In addition, the)108 703.2 R F1(Db::put)2.546 E F0 .046(method may f) +2.546 F .045(ail and thro)-.1 F 2.545(wa)-.25 G F1(DbException)A F0 .045 +(\(3\) or return).24 F F1(errno)2.545 E F0 .045(for the follo)2.545 F +.045(wing con-)-.25 F(ditions:)108 715.2 Q(May 4, 1998)280.585 768 Q(8) +203.585 E EP +%%Page: 9 9 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 417.74(Db\(3\) Db\(3\))72 48 R([EA)108 84 Q +(CCES])-.4 E(An attempt w)133 96 Q +(as made to modify a read-only database.)-.1 E([EA)108 112.8 Q(GAIN])-.4 +E 2.5(Al)133 124.8 S(ock w)-2.5 E(as una)-.1 E -.25(va)-.2 G(ilable.).25 +E([EINV)108 141.6 Q(AL])-1.35 E(An in)133 153.6 Q -.25(va)-.4 G +(lid \215ag v).25 E(alue or parameter w)-.25 E(as speci\214ed.)-.1 E 2.5 +(Ar)133 177.6 S(ecord number of 0 w)-2.5 E(as speci\214ed.)-.1 E +(An attempt w)133 201.6 Q(as made to add a record to a \214x)-.1 E +(ed-length database that w)-.15 E(as too lar)-.1 E(ge to \214t.)-.18 E +(An attempt w)133 225.6 Q(as made to do a partial put.)-.1 E([EPERM])108 +242.4 Q .955(Database corruption w)133 254.4 R .955(as detected.)-.1 F +.955(All subsequent database calls \(other than)5.955 F/F1 10 +/Times-Italic@0 SF(Db::close)3.455 E F0 3.455(\)w).18 G .955(ill return) +-3.455 F(EPERM.)133 266.4 Q([ENOSPC])108 283.2 Q 2.5(Ab)133 295.2 S +(tree e)-2.5 E(xceeded the maximum btree depth \(255\).)-.15 E(The)108 +312 Q F1(Db::stat)2.5 E F0(method may f)2.5 E(ail and thro)-.1 E 2.5(wa) +-.25 G F1(DbException)A F0(\(3\)).24 E(or return)108 336 Q F1(errno)2.5 +E F0(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: DbLock::get\(3\),)-.25 E +(DbLock::put\(3\), DbLockT)108 348 Q(ab::id\(3\), DbLockT)-.8 E(ab::v) +-.8 E(ec\(3\), DbMpoolFile::get\(3\), DbMpoolFile::put\(3\), cal-)-.15 E +(loc\(3\), fcntl\(2\), f)108 360 Q(\215ush\(3\), malloc\(3\), memcp)-.25 +E(y\(3\), and memset\(3\).)-.1 E(The)108 376.8 Q F1(Db::sync)2.5 E F0 +(method may f)2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0 +(\(3\)).24 E(or return)108 400.8 Q F1(errno)2.5 E F0(for an)2.5 E 2.5 +(yo)-.15 G 2.5(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: Db::get\(3\),)-.25 E +(Db::sync\(3\), DbLock::get\(3\), DbLock::put\(3\), DbLockT)108 412.8 Q +(ab::id\(3\), DbLockT)-.8 E(ab::v)-.8 E(ec\(3\), DbLog::put\(3\),)-.15 E +(DbMpoolFile::get\(3\), DbMpoolFile::put\(3\), DbMpoolFile::set\(3\), DbMpoolFile::sync\(3\), calloc\(3\),) +108 424.8 Q(close\(2\), fcntl\(2\), f)108 436.8 Q +(\215ush\(3\), malloc\(3\), memcp)-.25 E(y\(3\), memmo)-.1 E -.15(ve) +-.15 G(\(3\), memset\(3\), munmap\(2\), open\(2\), real-).15 E +(loc\(3\), strerror\(3\), unlink\(2\), and write\(2\).)108 448.8 Q 1.004 +(In addition, the)108 465.6 R F1(Db::sync)3.503 E F0 1.003(method may f) +3.503 F 1.003(ail and thro)-.1 F 3.503(wa)-.25 G F1(DbException)A F0 +1.003(\(3\) or return).24 F F1(errno)3.503 E F0 1.003(for the follo) +3.503 F(wing)-.25 E(conditions:)108 477.6 Q([EINV)108 494.4 Q(AL])-1.35 +E(An in)133 506.4 Q -.25(va)-.4 G(lid \215ag v).25 E +(alue or parameter w)-.25 E(as speci\214ed.)-.1 E([EPERM])108 523.2 Q +.955(Database corruption w)133 535.2 R .955(as detected.)-.1 F .955 +(All subsequent database calls \(other than)5.955 F F1(Db::close)3.455 E +F0 3.455(\)w).18 G .955(ill return)-3.455 F(EPERM.)133 547.2 Q/F2 9 +/Times-Bold@0 SF(SEE ALSO)72 564 Q F1(The Ubiquitous B-tr)108 576 Q(ee) +-.37 E F0 2.5(,D).18 G(ouglas Comer)-2.5 E 2.5(,A)-.4 G(CM Comput. Surv) +-2.9 E 2.5(.1)-.65 G(1, 2 \(June 1979\), 121-138.)-2.5 E F1(Pr)108 600 Q +1.588(e\214x B-tr)-.37 F(ees)-.37 E F0 4.088(,B).27 G 1.587 +(ayer and Unterauer)-4.088 F 4.087(,A)-.4 G 1.587(CM T)-4.487 F 1.587 +(ransactions on Database Systems, V)-.35 F 1.587 +(ol. 2, 1 \(March 1977\),)-1.29 F(11-26.)108 612 Q F1 +(The Art of Computer Pr)108 636 Q -.1(og)-.45 G -.15(ra).1 G(mming V).15 +E(ol. 3: Sorting and Sear)-1.11 E -.15(ch)-.37 G(ing).15 E F0 2.5(,D).22 +G(.E. Knuth, 1968, pp 471-480.)-2.5 E F1(Dynamic Hash T)108 660 Q(ables) +-.92 E F0 2.5(,P).27 G(er)-2.5 E(-Ak)-.2 E 2.5(eL)-.1 G +(arson, Communications of the A)-2.5 E(CM, April 1988.)-.4 E F1 2.5(AN) +108 684 S .3 -.15(ew H)-2.5 H(ash P).15 E(ac)-.8 E(ka)-.2 E .2 -.1(ge f) +-.1 H(or UNIX).1 E F0 2.5(,M).94 G(ar)-2.5 E(go Seltzer)-.18 E 2.5(,U) +-.4 G(SENIX Proceedings, W)-2.5 E(inter 1991.)-.4 E F1 2.754 +(Document Pr)108 708 R 2.754(ocessing in a Relational Database System) +-.45 F F0 5.255(,M).32 G 2.755(ichael Stonebrak)-5.255 F(er)-.1 E 5.255 +(,H)-.4 G 2.755(eidi Stettner)-5.255 F 5.255(,J)-.4 G(oseph)-5.255 E +(Kalash, Antonin Guttman, Nadene L)108 720 Q +(ynn, Memorandum No. UCB/ERL M82/32, May 1982.)-.55 E(May 4, 1998) +280.585 768 Q(9)203.585 E EP +%%Page: 10 10 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 417.74(Db\(3\) Db\(3\))72 48 R/F1 10 +/Times-Italic@0 SF(db_ar)108 84 Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 +E F1(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F0(\(1\),).68 E F1(db_deadloc) +2.5 E(k)-.2 E F0(\(1\),).67 E F1(db_dump)2.5 E F0(\(1\),).19 E F1 +(db_load)2.5 E F0(\(1\),).77 E F1(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0 +(\(1\),).73 E F1(db_stat)2.5 E F0(\(1\),).68 E F1(db_intr)108 96 Q(o) +-.45 E F0(\(3\),).18 E F1(db_internal)2.5 E F0(\(3\),).51 E F1(db_thr) +2.5 E(ead)-.37 E F0(\(3\),).77 E F1(Db)2.5 E F0(\(3\),).23 E F1(Dbc)2.5 +E F0(\(3\),).31 E F1(DbEn)2.5 E(v)-.4 E F0(\(3\),).32 E F1(DbException) +2.5 E F0(\(3\),).24 E F1(DbInfo)2.5 E F0(\(3\),).18 E F1(DbLoc)108 108 Q +(k)-.2 E F0(\(3\),).67 E F1(DbLoc)2.5 E(kT)-.2 E(ab)-.92 E F0(\(3\),).23 +E F1(DbLo)2.5 E(g)-.1 E F0(\(3\),).22 E F1(DbLsn)2.5 E F0(\(3\),).24 E +F1(DbMpool)2.5 E F0(\(3\),).51 E F1(DbMpoolF)2.5 E(ile)-.45 E F0(\(3\),) +.18 E F1(Dbt)2.5 E F0(\(3\),).68 E F1(DbTxn)2.5 E F0(\(3\),).24 E F1 +(DbTxnMgr)108 120 Q F0(\(3\)).73 E(May 4, 1998)280.585 768 Q(10)198.585 +E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/mancxx.ps/DbEnv.ps b/mozilla/db/man/mancxx.ps/DbEnv.ps new file mode 100644 index 00000000000..c02169739b6 --- /dev/null +++ b/mozilla/db/man/mancxx.ps/DbEnv.ps @@ -0,0 +1,891 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:34 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 9 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(DbEn)108 40.8 Q 2.5(v\255D)-.4 G 2.5(bi)-2.5 G(nitialization and en) +-2.5 E(vironment options)-.4 E F0(SYNOPSIS)72 57.6 Q/F2 10/Times-Bold@0 +SF(#include )108 69.6 Q(DbEn)108 93.6 Q(v::DbEn)-.4 E +(v\(const char *db_home, char *const *db_con\214g, u_int32_t \215ags\);) +-.4 E(DbEn)108 105.6 Q(v::DbEn)-.4 E(v\(\);)-.4 E(DbEn)108 117.6 Q +(v::~DbEn)-.4 E(v\(\);)-.4 E(int DbEn)108 141.6 Q +(v::appinit\(const char *db_home,)-.4 E +(char *const *db_con\214g, u_int32_t \215ags\);)158 153.6 Q(int DbEn)108 +177.6 Q(v::get_lorder\(\) const;)-.4 E -.1(vo)108 189.6 S(id DbEn).1 E +(v::set_lorder\(int\);)-.4 E(typedef v)108 213.6 Q(oid \(*db_err)-.1 E +(call_fcn\)\(const char *, char *\);)-.18 E(db_err)108 225.6 Q +(call_fcn DbEn)-.18 E(v::get_err)-.4 E(call\(\) const;)-.18 E -.1(vo)108 +237.6 S(id DbEn).1 E(v::set_err)-.4 E(call\(db_err)-.18 E(call_fcn\);) +-.18 E(FILE DbEn)108 261.6 Q(v::*get_err\214le\(\) const;)-.4 E -.1(vo) +108 273.6 S(id DbEn).1 E(v::set_err\214le\(FILE *\);)-.4 E +(const char DbEn)108 297.6 Q(v::*get_err)-.4 E(pfx\(\) const;)-.1 E -.1 +(vo)108 309.6 S(id DbEn).1 E(v::set_err)-.4 E(pfx\(const char *\);)-.1 E +(int DbEn)108 333.6 Q(v::get_v)-.4 E(erbose\(\) const;)-.1 E -.1(vo)108 +345.6 S(id DbEn).1 E(v::set_v)-.4 E(erbose\(int\);)-.1 E(char DbEn)108 +369.6 Q(v::*get_home\(\) const;)-.4 E -.1(vo)108 381.6 S(id DbEn).1 E +(v::set_home\(char *\);)-.4 E(char DbEn)108 405.6 Q +(v::*get_log_dir\(\) const;)-.4 E -.1(vo)108 417.6 S(id DbEn).1 E +(v::set_log_dir\(char *\);)-.4 E(char DbEn)108 441.6 Q +(v::*get_tmp_dir\(\) const;)-.4 E -.1(vo)108 453.6 S(id DbEn).1 E +(v::set_tmp_dir\(char *\);)-.4 E(char DbEn)108 477.6 Q +(v::**get_data_dir\(\) const;)-.4 E -.1(vo)108 489.6 S(id DbEn).1 E +(v::set_data_dir\(char **\);)-.4 E(DbLockT)108 513.6 Q(ab DbEn)-.92 E +(v::*get_lk_inf)-.4 E(o\(\) const;)-.25 E(u_int8_t DbEn)108 537.6 Q +(v::*get_lk_con\215icts\(\) const;)-.4 E -.1(vo)108 549.6 S(id DbEn).1 E +(v::set_lk_con\215icts\(u_int8_t *\);)-.4 E(u_int32_t DbEn)108 573.6 Q +(v::get_lk_modes\(\) const;)-.4 E -.1(vo)108 585.6 S(id DbEn).1 E +(v::set_lk_modes\(u_int32_t\);)-.4 E(u_int32_t DbEn)108 609.6 Q +(v::get_lk_max\(\) const;)-.4 E -.1(vo)108 621.6 S(id DbEn).1 E +(v::set_lk_max\(u_int32_t\);)-.4 E(u_int32_t DbEn)108 645.6 Q +(v::get_lk_detect\(\) const;)-.4 E -.1(vo)108 657.6 S(id DbEn).1 E +(v::set_lk_detect\(u_int32_t\);)-.4 E(DbLog DbEn)108 681.6 Q +(v::*get_lg_inf)-.4 E(o\(\) const;)-.25 E(u_int32_t DbEn)108 705.6 Q +(v::get_lg_max\(\) const;)-.4 E -.1(vo)108 717.6 S(id DbEn).1 E +(v::set_lg_max\(u_int32_t\);)-.4 E F1(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DbEn)72 48 Q 386.32(v\(3\) DbEn)-.4 F(v\(3\))-.4 +E/F1 10/Times-Bold@0 SF(DbMpool DbEn)108 84 Q(v::*get_mp_inf)-.4 E +(o\(\) const;)-.25 E(size_t DbEn)108 108 Q +(v::get_mp_mmapsize\(\) const;)-.4 E -.1(vo)108 120 S(id DbEn).1 E +(v::set_mp_mmapsize\(size_t\);)-.4 E(size_t DbEn)108 144 Q +(v::get_mp_size\(\) const;)-.4 E -.1(vo)108 156 S(id DbEn).1 E +(v::set_mp_size\(size_t\);)-.4 E(DbTxnMgr DbEn)108 180 Q(v::*get_tx_inf) +-.4 E(o\(\) const;)-.25 E(u_int32_t DbEn)108 204 Q +(v::get_tx_max\(\) const;)-.4 E -.1(vo)108 216 S(id DbEn).1 E +(v::set_tx_max\(u_int32_t\);)-.4 E(typedef int \(*tx_r)108 240 Q(eco) +-.18 E -.1(ve)-.1 G(r_fcn\)\(DB_LOG *, DBT *, DB_LSN *, int, v).1 E +(oid *\);)-.1 E(tx_r)108 252 Q(eco)-.18 E -.1(ve)-.1 G(r_fcn DbEn).1 E +(v::get_tx_r)-.4 E(eco)-.18 E -.1(ve)-.1 G(r\(\) const;).1 E -.1(vo)108 +264 S(id DbEn).1 E(v::set_tx_r)-.4 E(eco)-.18 E -.1(ve)-.1 G(r\(tx_r).1 +E(eco)-.18 E -.1(ve)-.1 G(r_fcn\);).1 E(u_int32_t DbEn)108 288 Q +(v::get_\215ags\(\) const;)-.4 E -.1(vo)108 300 S(id DbEn).1 E +(v::set_\215ags\(u_int32_t\);)-.4 E(enum Err)108 324 Q +(orModel { Exception, Err)-.18 E(orRetur)-.18 E 2.5(n})-.15 G(;)-2.5 E +-.1(vo)108 336 S(id DbEn).1 E(v::set_err)-.4 E(or_model\(Err)-.18 E +(orModel\);)-.18 E(Err)108 348 Q(orModel DbEn)-.18 E(v::get_err)-.4 E +(or_model\(\) const;)-.18 E(class ostr)108 372 Q(eam* DbEn)-.18 E +(v::get_err)-.4 E(or_str)-.18 E(eam\(\) const;)-.18 E -.1(vo)108 384 S +(id DbEn).1 E(v::set_err)-.4 E(or_str)-.18 E(eam\(class ostr)-.18 E +(eam*\);)-.18 E/F2 9/Times-Bold@0 SF(DESCRIPTION)72 400.8 Q F0 1.02 +(The DB library is a f)108 412.8 R 1.019(amily of classes that pro)-.1 F +1.019(vides a modular programming interf)-.15 F 1.019 +(ace to transactions and)-.1 F 1.377(record-oriented \214le access.)108 +424.8 R 1.378(The library includes support for transactions, locking, logging and \214le page) +6.377 F .443(caching, as well as v)108 436.8 R .443(arious inde)-.25 F +-.15(xe)-.15 G 2.943(da).15 G .442(ccess methods.)-2.943 F(Man)5.442 E +2.942(yo)-.15 G 2.942(ft)-2.942 G .442 +(he classes \(e.g., the \214le page caching class\))-2.942 F .4(are useful independent of the other DB classes, although some classes are e) +108 448.8 R .4(xplicitly based on other classes)-.15 F +(\(e.g., transactions and logging\).)108 460.8 Q -.15(Fo)5 G 2.5(rag).15 +G(eneral description of the DB package, see)-2.5 E/F3 10/Times-Italic@0 +SF(db_intr)2.5 E(o)-.45 E F0(\(3\).).18 E .482(The DbEn)108 477.6 R +2.982(vc)-.4 G .482(lass pro)-2.982 F .482(vides simple access to an underlying data structure, whose elements can be e) +-.15 F(xamined)-.15 E .863(or changed using the)108 489.6 R F3(set_) +3.363 E F0(or)3.363 E F3 -.1(ge)3.363 G(t_).1 E F0 3.363(methods. The) +3.363 F .864(remainder of the manual page sometimes refers to these) +3.364 F .062(accesses using the underlying name, e.g., simply)108 501.6 +R F3(lor)2.562 E(der)-.37 E F0 .062(instead of)2.562 F F3 -.1(ge)2.562 G +(t_lor).1 E(der)-.37 E F0(and)2.562 E F3(set_lor)2.562 E(der)-.37 E F0 +5.062(.T).73 G .062(he construc-)-5.062 F .066 +(tors set all elements of the underlying structure to zero.)108 513.6 R +.067(The constructor with three ar)5.067 F .067(guments has the ef)-.18 +F(fect)-.25 E 1.049(of calling)108 525.6 R F3(DbEn)3.549 E(v::appinit) +-.4 E F0 1.049(immediately to initialize the application with def)3.549 +F 1.048(ault parameters.)-.1 F 2.648 -.8(To d)6.048 H 1.048(elay the).8 +F 2.011(initialization, use the def)108 537.6 R 2.011(ault constructor) +-.1 F 7.011(.T)-.55 G 2.011(he v)-7.011 F 2.012 +(arious set_ methods can then be used to initialize the)-.25 F(DbEn)108 +549.6 Q 1.3 -.65(v, a)-.4 H(nd \214nally).65 E 2.5(,ac)-.65 G(all to) +-2.5 E F3(DbEn)2.5 E(v::appinit)-.4 E F0 +(should be made to initialize DB.)2.5 E 1.716(Once the DB en)108 566.4 R +1.716(vironment has been initialized by a call to)-.4 F F3(DbEn)4.215 E +(v::appinit)-.4 E F0 4.215(,n).68 G 4.215(os)-4.215 G 1.715 +(et methods other than)-4.215 F F3(set_errpfx)108 578.4 Q F0 +(should be called.)2.5 E F3(appinit)92 595.2 Q F0(The)108 607.2 Q F3 +(appinit)2.968 E F0 .468(method pro)2.968 F .469(vides a simple w)-.15 F +.469(ay to initialize and con\214gure the Db en)-.1 F 2.969 +(vironment. It)-.4 F .469(is not neces-)2.969 F .326 +(sary that it be called, b)108 619.2 R .326(ut it pro)-.2 F .326 +(vides a method of creating a consistent en)-.15 F .326 +(vironment for processes using one)-.4 F(or more of the features of Db) +108 631.2 Q(.)-.4 E(The)108 648 Q F3(db_home)2.794 E F0(and)2.794 E F3 +(db_con\214g)2.794 E F0(ar)2.794 E .294(guments to)-.18 F F3(appinit) +2.795 E F0 .295(are described in the section belo)2.795 F 2.795(we)-.25 +G .295(ntitled `)-2.795 F .295(`FILE N)-.74 F(AM-)-.35 E(ING')108 660 Q +('.)-.74 E(The)108 676.8 Q F3<8d61>3.698 E(gs)-.1 E F0(ar)3.698 E 1.197 +(gument speci\214es the subsystems that are initialized and ho)-.18 F +3.697(wt)-.25 G 1.197(he en)-3.697 F 1.197(vironment af)-.4 F 1.197 +(fects Db \214le)-.25 F .645(naming, among other things.)108 688.8 R +(The)5.646 E F3<8d61>3.146 E(gs)-.1 E F0 -.25(va)3.146 G .646 +(lue is speci\214ed by).25 F F1(or)3.146 E F0 .646 +('ing together one or more of the follo)B(wing)-.25 E -.25(va)108 700.8 +S(lues:).25 E(May 1, 1998)280.585 768 Q(2)203.585 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DbEn)72 48 Q 386.32(v\(3\) DbEn)-.4 F(v\(3\))-.4 +E(DB_CREA)108 84 Q(TE)-1.11 E .007(Cause subsystems to create an)133 96 +R 2.507(yu)-.15 G .007(nderlying \214les, as necessary)-2.507 F 5.006 +(.\()-.65 G(See)-5.006 E/F1 10/Times-Italic@0 SF(Db)2.506 E F0(\(3\),) +.23 E F1(DbLoc)2.506 E(kT)-.2 E(ab)-.92 E F0(\(3\),).23 E F1(DbLo)2.506 +E(g)-.1 E F0(\(3\),).22 E F1(DbMpool)133 108 Q F0(\(3\) and).51 E F1 +(DbTxnMgr)2.5 E F0(\(3\) for more information.\)).73 E(DB_INIT_LOCK)108 +136.8 Q .288(Initialize the lock subsystem; see)133 148.8 R F1(DbLoc) +2.788 E(kT)-.2 E(ab)-.92 E F0 2.788(\(3\). This).23 F .289 +(subsystem should be used when multiple pro-)2.788 F .147(cesses or threads are going to be reading and writing a Db database, so that the) +133 160.8 R 2.647(yd)-.15 G 2.646(on)-2.647 G .146(ot interfere with) +-2.646 F .303(each other)133 172.8 R 5.303(.I)-.55 G 2.803(fa)-5.303 G +.303(ll threads are accessing the database\(s\) read-only)-2.803 F 2.804 +(,t)-.65 G .304(hen locking is unnecessary)-2.804 F 5.304(.W)-.65 G(hen) +-5.304 E .533(the DB_INIT_LOCK \215ag is speci\214ed, it is usually necessary to run the deadlock detector) +133 184.8 R(,)-.4 E F1(db_dead-)3.032 E(loc)133 196.8 Q(k)-.2 E F0 +(\(1\), as well.).67 E(DB_INIT_LOG)108 225.6 Q .577 +(Initialize the log subsystem; see)133 237.6 R F1(DbLo)3.077 E(g)-.1 E +F0 3.077(\(3\). This).22 F .577(subsystem is used when reco)3.077 F -.15 +(ve)-.15 G .577(ry from application).15 F(or system f)133 249.6 Q +(ailure is important.)-.1 E(DB_INIT_MPOOL)108 278.4 Q .17 +(Initialize the mpool subsystem; see)133 290.4 R F1(DbMpool)2.669 E F0 +2.669(\(3\). This).51 F .169(subsystem is used whene)2.669 F -.15(ve) +-.25 G 2.669(rt).15 G .169(he application is)-2.669 F +(using the Db access methods for an)133 302.4 Q 2.5(yp)-.15 G(urpose.) +-2.5 E(DB_INIT_TXN)108 331.2 Q .372 +(Initialize the transaction subsystem; see)133 343.2 R F1(DbTxn)2.872 E +F0 2.872(\(3\). This).24 F .373 +(subsystem is used when atomicity of multi-)2.872 F 1.757 +(ple operations and reco)133 355.2 R -.15(ve)-.15 G 1.757 +(ry are important.).15 F 1.756 +(The DB_INIT_TXN \215ag implies the DB_INIT_LOG)6.756 F(\215ag.)133 +367.2 Q(DB_MPOOL_PRIV)108 396 Q -1.11(AT)-1.35 G(E)1.11 E 4.86 +(Create a pri)133 408 R -.25(va)-.25 G 4.86(te memory pool \(see).25 F +F1(DbMpool)7.36 E F0 4.86(\(3\) for further information\).).51 F 4.86 +(Ignored unless)9.86 F(DB_INIT_MPOOL is also speci\214ed.)133 420 Q +(DB_NOMMAP)108 448.8 Q 1.465(Do not map an)133 460.8 R 3.965<798c>-.15 G +1.465(les within this en)-3.965 F 1.465(vironment \(see)-.4 F F1 +(DbMpool)3.964 E F0 1.464(\(3\) for further information\).).51 F +(Ignored)6.464 E(unless DB_INIT_MPOOL is also speci\214ed.)133 472.8 Q +(DB_RECO)108 501.6 Q(VER)-.5 E 1.174(Run normal reco)133 513.6 R -.15 +(ve)-.15 G 1.174(ry on this en).15 F 1.175 +(vironment before opening it for normal use.)-.4 F 1.175 +(If this \215ag is set, the)6.175 F(DB_CREA)133 525.6 Q +(TE \215ag must also be set since the re)-1.11 E(gions will be remo)-.15 +E -.15(ve)-.15 G 2.5(da).15 G(nd recreated.)-2.5 E(The)133 549.6 Q F1 +(DbEn)4.319 E(v::appinit)-.4 E F0 1.819 +(function returns successfully if DB_RECO)4.319 F 1.818 +(VER is speci\214ed and no log \214les)-.5 F -.15(ex)133 561.6 S .339(ist, so it is necessary to ensure all necessary log \214les are present before running reco) +.15 F -.15(ve)-.15 G(ry).15 E 5.34(.F)-.65 G .34(or fur)-5.49 F(-)-.2 E +(ther information, consult the man page for)133 573.6 Q F1(db_ar)2.5 E +-.15(ch)-.37 G(ive).15 E F0(\(1\) and).18 E F1(db_r)2.5 E(eco)-.37 E +(ver)-.1 E F0(\(1\).).73 E(DB_RECO)108 602.4 Q(VER_F)-.5 E -1.21 -1.11 +(AT A)-.74 H(L)1.11 E .919(Run catastrophic reco)133 614.4 R -.15(ve) +-.15 G .919(ry on this en).15 F .919 +(vironment before opening it for normal use.)-.4 F .918 +(If this \215ag is set,)5.919 F(the DB_CREA)133 626.4 Q +(TE \215ag must also be set since the re)-1.11 E(gions will be remo)-.15 +E -.15(ve)-.15 G 2.5(da).15 G(nd recreated.)-2.5 E(The)133 650.4 Q F1 +(DbEn)4.318 E(v::appinit)-.4 E F0 1.818 +(function returns successfully if DB_RECO)4.318 F 1.819 +(VER is speci\214ed and no log \214les)-.5 F -.15(ex)133 662.4 S .339(ist, so it is necessary to ensure all necessary log \214les are present before running reco) +.15 F -.15(ve)-.15 G(ry).15 E 5.339(.F)-.65 G .339(or fur)-5.489 F(-)-.2 +E(ther information, consult the man page for)133 674.4 Q F1(db_ar)2.5 E +-.15(ch)-.37 G(ive).15 E F0(\(1\) and).18 E F1(db_r)2.5 E(eco)-.37 E +(ver)-.1 E F0(\(1\).).73 E(DB_THREAD)108 703.2 Q .97(Ensure that handles returned by the Db subsystems are useable by multiple threads within a single) +133 715.2 R 2.966(process, i.e., that the system is `)133 727.2 R +(`free-threaded')-.74 E 5.466('. \(See)-.74 F F1(DbLoc)5.466 E(kT)-.2 E +(ab)-.92 E F0(\(3\),).23 E F1(DbLo)5.466 E(g)-.1 E F0(\(3\),).22 E F1 +(DbMpool)5.466 E F0(\(3\),).51 E(May 1, 1998)280.585 768 Q(3)203.585 E +EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DbEn)72 48 Q 386.32(v\(3\) DbEn)-.4 F(v\(3\))-.4 +E/F1 10/Times-Italic@0 SF(Db::open)133 84 Q F0(\(3\) and).24 E F1(DbTxn) +2.5 E F0(\(3\) for more information.\)).24 E(DB_TXN_NOSYNC)108 112.8 Q +.972(On transaction commit, do not synchronously \215ush the log \(see) +133 124.8 R F1(DbTxn)3.473 E F0 .973(\(3\) for further information\).) +.24 F(Ignored unless DB_INIT_TXN is also speci\214ed.)133 136.8 Q +(DB_USE_ENVIR)108 165.6 Q(ON)-.4 E .368(The Db process' en)133 177.6 R +.367(vironment may be permitted to specify information to be used when naming \214les) +-.4 F 1.13(\(see the section entitled `)133 189.6 R 1.13(`FILE N)-.74 F +(AMING')-.35 E 3.63('b)-.74 G(elo)-3.63 E 3.63(w\). As)-.25 F 1.13 +(permitting users to specify which \214les are)3.63 F .572 +(used can create security problems, en)133 201.6 R .571 +(vironment information will be used in \214le naming for all users)-.4 F +(only if the DB_USE_ENVIR)133 213.6 Q(ON \215ag is set.)-.4 E +(DB_USE_ENVIR)108 242.4 Q(ON_R)-.4 E(OO)-.4 E(T)-.4 E .367 +(The Db process' en)133 254.4 R .367(vironment may be permitted to specify information to be used when naming \214les) +-.4 F 1.13(\(see the section entitled `)133 266.4 R 1.13(`FILE N)-.74 F +(AMING')-.35 E 3.63('b)-.74 G(elo)-3.63 E 3.63(w\). As)-.25 F 1.13 +(permitting users to specify which \214les are)3.63 F .368 +(used can create security problems, if the DB_USE_ENVIR)133 278.4 R +(ON_R)-.4 E(OO)-.4 E 2.868<548d>-.4 G .369(ag is set, en)-2.868 F .369 +(vironment infor)-.4 F(-)-.2 E 1.489 +(mation will be used for \214le naming only for users with a user)133 +290.4 R 1.488(-ID matching that of the superuser)-.2 F(\(speci\214cally) +133 302.4 Q 2.5(,u)-.65 G(sers for whom the)-2.5 E F1 -.1(ge)2.5 G(tuid) +.1 E F0(system call returns the user)2.5 E(-ID 0\).)-.2 E .224 +(The Db en)108 319.2 R .224 +(vironment is con\214gured based on which set methods ha)-.4 F .524 -.15 +(ve b)-.2 H .224(een used.).15 F .224(It is e)5.224 F .225 +(xpected that applica-)-.15 F .103(tions will use a single DbEn)108 +331.2 R 2.603(vo)-.4 G .103(bject as the ar)-2.603 F .103 +(gument to all of the subsystems in the DB package.)-.18 F .103 +(The \214elds)5.103 F .21(of the DbEn)108 343.2 R 2.71(vo)-.4 G .21 +(bject used by)-2.71 F F1(appinit)2.71 E F0 .21(are described belo)2.71 +F 4.011 -.65(w. A)-.25 H 2.711(sr).65 G .211(eferences to the DbEn) +-2.711 F 2.711(vo)-.4 G .211(bject may be main-)-2.711 F .136(tained by) +108 355.2 R F1(appinit)2.636 E F0 2.636(,i).68 G 2.636(ti)-2.636 G 2.636 +(sn)-2.636 G .136(ecessary that the DbEn)-2.636 F 2.636(vo)-.4 G .136 +(bject and memory it references be v)-2.636 F .135 +(alid until the object is)-.25 F(destro)108 367.2 Q 3.157(yed. The)-.1 F +F1(dben)3.157 E(v)-.4 E F0(ar)3.157 E .657(gument may not be NULL.)-.18 +F .657(If an)5.657 F 3.157(yo)-.15 G 3.157(ft)-3.157 G .657 +(he \214elds of the)-3.157 F F1(dben)3.157 E(v)-.4 E F0 .657 +(are set to 0, def)3.157 F(aults)-.1 E +(appropriate for the system are used where possible.)108 379.2 Q .517 +(The follo)108 396 R .517(wing \214elds in the DbEn)-.25 F 3.016(vo)-.4 +G .516(bject may be initialized, using the appropriate set method, before call-) +-3.016 F(ing)108 408 Q F1(appinit)2.5 E F0(:).68 E -.2(vo)108 424.8 S +(id \(*db_errcall\)\(char *db_errpfx, char *b).2 E(uf)-.2 E(fer\);)-.25 +E .593(When an error occurs in the DB package, an)133 436.8 R F1(errno) +3.093 E F0 -.25(va)3.093 G .594(lue is returned by the method.).25 F +.594(In some cases,)5.594 F(ho)133 448.8 Q(we)-.25 E -.15(ve)-.25 G .8 +-.4(r, t).15 H(he).4 E F1(errno)2.5 E F0 -.25(va)2.5 G(lue may be insuf) +.25 E(\214cient to completely describe the cause of the error)-.25 E(.) +-.55 E(If)133 465.6 Q F1(db_err)3.064 E(call)-.37 E F0 .564 +(is non-NULL, it may be called with additional error information.)3.064 +F(The)5.563 E F1(db_errpfx)3.063 E F0(ar)3.063 E(gu-)-.18 E 1.454 +(ment is the current en)133 477.6 R(vironment')-.4 E(s)-.55 E F1 +(db_errpfx)3.954 E F0 3.954(\214eld. The)3.954 F F1 -.2(bu)3.954 G -.18 +(ff).2 G(er).18 E F0(ar)3.954 E 1.455(gument contains a nul-terminated) +-.18 F(string with the additional information.)133 489.6 Q .594 +(This error logging f)133 513.6 R .594 +(acility should not be required for normal operation, b)-.1 F .593 +(ut may be useful in deb)-.2 F(ug-)-.2 E(ging applications.)133 525.6 Q +(FILE *db_err\214le;)108 542.4 Q(The)133 554.4 Q F1(db_err\214le)2.88 E +F0 .38(\214eld beha)2.88 F -.15(ve)-.2 G 2.88(ss).15 G .38 +(imilarly to the)-2.88 F F1(db_err)2.88 E(call)-.37 E F0 .38(\214eld, e) +2.88 F .38(xcept that the error message is written)-.15 F +(to the \214le stream represented by)133 566.4 Q F1(db_err\214le)2.5 E +F0(.).18 E(If)133 590.4 Q F1(db_errpfx)3.697 E F0 1.197 +(is non-NULL, the message will be preceded by the string referenced by) +3.697 F F1(db_errpfx)3.696 E F0 3.696(,a).53 G(colon \(`)133 602.4 Q +(`:')-.74 E('\) and a space.)-.74 E(The message will be follo)5 E +(wed by a ne)-.25 E(wline character)-.25 E(.)-.55 E +(const char *db_errpfx;)108 619.2 Q 3.783(Ap)133 631.2 S 1.283 +(re\214x to prepend to error messages.)-3.783 F 1.283 +(Because Db does not cop)6.283 F 3.783(yt)-.1 G 1.283 +(he memory referenced by the)-3.783 F F1(db_errpfx)133 643.2 Q F0 +(\214eld, the application may modify the error message pre\214x at an) +2.5 E 2.5(yt)-.15 G(ime.)-2.5 E(ostream* error_stream;)108 660 Q .455 +(The error_stream functions lik)133 672 R 2.955(et)-.1 G .455 +(he error \214le, allo)-2.955 F .455 +(wing errors to be redirected to a C++ error stream.)-.25 F +(It is unwise to use both error_stream with nonzero v)133 684 Q +(alues of either errcall or err\214le.)-.25 E(int db_v)108 700.8 Q +(erbose;)-.15 E 2.19(Include informational and deb)133 712.8 R 2.19 +(ugging messages as well as error messages in the)-.2 F F1(db_err)4.69 E +(call)-.37 E F0(and)4.69 E F1(db_err\214le)133 724.8 Q F0(output.)2.5 E +(May 1, 1998)280.585 768 Q(4)203.585 E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DbEn)72 48 Q 386.32(v\(3\) DbEn)-.4 F(v\(3\))-.4 +E 1.345(Each of the open functions that)108 84 R/F1 10/Times-Italic@0 SF +(appinit)3.845 E F0 1.345(may call \()3.845 F F1(DbLoc)A(kT)-.2 E +(ab::open)-.92 E F0(,).24 E F1(DbLo)3.845 E(g::open)-.1 E F0(,).24 E F1 +(DbMpool::open)3.845 E F0(and)3.845 E F1(DbTxnMgr::open)108 96 Q F0 2.5 +(\)i).24 G 2.5(sc)-2.5 G(alled as follo)-2.5 E(ws, where the DB_CREA) +-.25 E(TE \215ag is optional:)-1.11 E(XXX::open\(NULL, DB_CREA)158 120 Q +(TE,)-1.11 E(S_IR)188 132 Q(USR | S_IWUSR | S_IRGRP | S_IWGRP)-.4 E 2.5 +(,d)-1.11 G(ben)-2.5 E(v\))-.4 E 1.031(This call will cause each subsystem to construct pathnames as described in the section on `) +108 148.8 R 1.031(`FILE N)-.74 F(AM-)-.35 E(ING')108 160.8 Q 2.595 +('. The)-.74 F .095(subsystem has permission to read and write underlying \214les as necessary) +2.595 F 2.595(,a)-.65 G .095(nd optionally to cre-)-2.595 F .655 +(ate \214les.)108 172.8 R .655 +(\(All created \214les will be created readable and writeable by the o) +5.655 F .656(wner and the group.)-.25 F .656(The group)5.656 F -.25(ow) +108 184.8 S .188 +(nership of created \214les is based on the system and directory def).25 +F .187(aults, and is not further speci\214ed by Db)-.1 F(.\))-.4 E .963 +(In addition, the)108 201.6 R F1(dben)3.463 E(v)-.4 E F0(ar)3.463 E .963 +(gument is passed to the open functions of an)-.18 F 3.463(ys)-.15 G +.963(ubsystems initialized by)-3.463 F F1(appinit)3.464 E F0(.).68 E +-.15(Fo)108 213.6 S 2.98(rt).15 G .48 +(his reason the \214elds of the DbEn)-2.98 F 2.979(vo)-.4 G .479 +(bject rele)-2.979 F -.25(va)-.25 G .479 +(nt to the subsystems being initialized must themselv).25 F(es)-.15 E +.298(be initialized before)108 225.6 R F1(appinit)2.799 E F0 .299 +(is called.)2.799 F .299(See the manual page for each subsystem for a list of these \214elds and) +5.299 F(their uses.)108 237.6 Q(The return v)108 254.4 Q(alue from each of these calls is placed in the appropriate \214eld of the DbEn) +-.25 E 2.5(vo)-.4 G(bject:)-2.5 E(DbLockT)108 271.2 Q(ab *lk_info;)-.8 E +(The return v)135.5 283.2 Q(alue of the)-.25 E F1(DbLoc)2.5 E(kT)-.2 E +(ab::open)-.92 E F0(\(3\) call.).24 E(DbLog *lg_info;)108 300 Q +(The return v)135.5 312 Q(alue of the)-.25 E F1(DbLo)2.5 E(g::open)-.1 E +F0(\(3\) call.).24 E(DbMpool *mp_info;)108 328.8 Q(The return v)135.5 +340.8 Q(alue of the)-.25 E F1(DbMpool::open)2.5 E F0(\(3\) call.).24 E +(DbTxnMgr *tx_info;)108 357.6 Q(The return v)135.5 369.6 Q(alue of the) +-.25 E F1(DbTxnMgr::open)2.5 E F0(\(3\) call.).24 E 1.166(In general, these \214elds are not directly used by applications; subsystems of Db that use these \214elds will) +108 386.4 R(simply reference them using the DbEn)108 398.4 Q 2.5(va)-.4 +G -.18(rg)-2.5 G(ument passed to the subsystem.).18 E -.15(Fo)108 415.2 +S 3.129(re).15 G .629(xample, an application using the Db hash access method functions to access a database will \214rst call) +-3.279 F F1(Db::open)108 427.2 Q F0 .394(passing it the DbEn)2.894 F +2.894(va)-.4 G -.18(rg)-2.894 G .394 +(ument \214lled in by the initial call to).18 F F1(appinit)2.894 E F0 +5.393(.T).68 G .393(hen, all future calls to the)-5.393 F .181(hash access method functions for that database will automatically use the underlying shared memory b) +108 439.2 R(uf)-.2 E(fer)-.25 E(pool that w)108 451.2 Q +(as speci\214ed by the)-.1 E F1(mp_info)2.5 E F0(\214eld of that DbEn) +2.5 E 2.5(va)-.4 G -.18(rg)-2.5 G(ument.).18 E 1.899(The single e)108 +468 R 1.898(xception to this rule is the)-.15 F F1(tx_info)4.398 E F0 +1.898(\214eld, which applications must e)4.398 F 1.898 +(xplicitly specify to the)-.15 F F1(DbTxnMgr::be)108 480 Q(gin)-.4 E F0 +(,).24 E F1(DbTxnMgr::c)2.5 E(hec)-.15 E(kpoint)-.2 E F0(and)2.5 E F1 +(DbTxnMgr::close)2.5 E F0(functions.)2.5 E(The)108 496.8 Q F1(err)3.389 +E(or_model)-.45 E F0 .889(\214eld of DbEn)3.389 F 3.389(va)-.4 G(llo) +-3.389 E .889(ws the user to con\214gure the w)-.25 F .89 +(ay errors are treated in DB.)-.1 F .89(It can be)5.89 F 1.391 +(changed at an)108 508.8 R 3.891(yt)-.15 G 1.391 +(ime \(e.g., after the call to)-3.891 F F1(DbEn)3.891 E(v::appinit)-.4 E +F0 3.891(\). The).68 F 1.39(error model is described in)3.89 F F1 +(DbExcep-)3.89 E(tion)108 520.8 Q F0(\(3\).).24 E/F2 9/Times-Bold@0 SF +(FILE N)72 537.6 Q(AMING)-.18 E F0(The most important task of)108 549.6 +Q F1(appinit)2.5 E F0(is to structure \214le naming within Db)2.5 E(.) +-.4 E 1.972(Each of the locking, logging, memory pool and transaction subsystems of Db require shared memory) +108 566.4 R(re)108 578.4 Q 1.002(gions, back)-.15 F 1.002 +(ed by the \214lesystem.)-.1 F(Further)6.002 E 3.502(,c)-.4 G 1.001 +(ooperating applications \(or multiple in)-3.502 F -.2(vo)-.4 G 1.001 +(cations of the same).2 F .709 +(application\) must agree on the location of the shared memory re)108 +590.4 R .71(gions and other \214les used by the Db sub-)-.15 F(systems, the log \214les used by the logging subsystem, and, of course, the data \214les.) +108 602.4 Q .576(Although it is possible to specify full pathnames to all Db functions, this is cumbersome and requires that) +108 619.2 R .552 +(applications be recompiled when database \214les are mo)108 631.2 R +-.15(ve)-.15 G 3.053(d. The).15 F F1(appinit)3.053 E F0 .553(method mak) +3.053 F .553(es it possible to place)-.1 F +(database \214les in a single directory)108 643.2 Q 2.5(,o)-.65 G 2.5 +(ri)-2.5 G 2.5(nm)-2.5 G +(ultiple directories, grouped by their method within the database.)-2.5 +E .245(Applications are normally e)108 660 R .244 +(xpected to specify a single directory home for their database.)-.15 F +.244(This can be done)5.244 F .24(easily in the call to)108 672 R F1 +(appinit)2.74 E F0 .24(by specifying a v)2.74 F .241(alue for the)-.25 F +F1(db_home)2.741 E F0(ar)2.741 E 2.741(gument. There)-.18 F .241 +(are more comple)2.741 F 2.741(xc)-.15 G(on-)-2.741 E +(\214gurations where it may be desirable to o)108 684 Q -.15(ve)-.15 G +(rride).15 E F1(db_home)2.5 E F0(or pro)2.5 E +(vide supplementary path information.)-.15 E 1.157(The follo)108 700.8 R +1.157(wing describes the possible w)-.25 F 1.156 +(ays in which \214le naming information may be speci\214ed to the Db)-.1 +F(library)108 712.8 Q 5.04(.T)-.65 G .04 +(he speci\214c circumstances and order in which these w)-5.04 F .04 +(ays are applied are described in a subsequent)-.1 F(paragraph.)108 +724.8 Q(May 1, 1998)280.585 768 Q(5)203.585 E EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DbEn)72 48 Q 386.32(v\(3\) DbEn)-.4 F(v\(3\))-.4 +E/F1 10/Times-Italic@0 SF(db_home)108 84 Q F0 .653(If the)133 96 R F1 +(db_home)3.153 E F0(ar)3.153 E .653(gument to)-.18 F F1(appinit)3.153 E +F0 .653(is non-NULL, its v)3.153 F .653 +(alue may be used as the database home, and)-.25 F(\214les named relati) +133 108 Q .3 -.15(ve t)-.25 H 2.5(oi).15 G(ts path.)-2.5 E(DB_HOME)108 +124.8 Q 1.055(If the DB_HOME en)133 136.8 R 1.056(vironment v)-.4 F +1.056(ariable is set when)-.25 F F1(appinit)3.556 E F0 1.056 +(is called, its v)3.556 F 1.056(alue may be used as the)-.25 F +(database home, and \214les named relati)133 148.8 Q .3 -.15(ve t)-.25 H +2.5(oi).15 G(ts path.)-2.5 E F1(db_con\214g)108 165.6 Q F0(The)133 177.6 +Q F1(db_con\214g)2.813 E F0(ar)2.813 E .313(gument to)-.18 F F1(appinit) +2.813 E F0 .313 +(may be used to specify an array of character strings of the format) +2.813 F -.74(``)133 189.6 S -.35(NA).74 G .264(ME V).35 F(ALUE')-1.35 E +.265(', that specify \214le name information for the process' Db en)-.74 +F 2.765(vironment. The)-.4 F(whites-)2.765 E .028 +(pace delimiting the tw)133 201.6 R 2.528(op)-.1 G .028 +(arts of the entry may be one or more or characters.) +-2.528 F(\(Leading)5.027 E 1.143 +(or trailing and characters are discarded.\))133 213.6 R +1.143(Each entry must specify both the N)6.143 F(AME)-.35 E 1.879 +(and the V)133 225.6 R 1.879(ALUE of the pair)-1.35 F 6.879(.A)-.55 G +1.879(ll entries with unrecognized N)-6.879 F 1.878(AME v)-.35 F 1.878 +(alues will be ignored.)-.25 F(The)6.878 E F1(db_con\214g)133 237.6 Q F0 +(array must be NULL terminated.)2.5 E(DB_CONFIG)108 254.4 Q .055 +(The same information speci\214ed to the)133 266.4 R F1(db_con\214g) +2.555 E F0(ar)2.555 E .055(gument to)-.18 F F1(appinit)2.555 E F0 .056 +(may be speci\214ed using a con\214g-)2.555 F .862(uration \214le.)133 +278.4 R .861(If a database home directory has been speci\214ed \(either by the application specifying a) +5.862 F(non-NULL)133 290.4 Q F1(db_home)3.24 E F0(ar)3.24 E .74 +(gument to)-.18 F F1(appinit)3.24 E F0 3.24(,o).68 G 3.24(rb)-3.24 G +3.24(yt)-3.24 G .74(he application setting the DB_USE_ENVIR)-3.24 F .74 +(ON or)-.4 F(DB_USE_ENVIR)133 302.4 Q(ON_R)-.4 E(OO)-.4 E 4.599<548d>-.4 +G 2.099(ags and the DB_HOME en)-4.599 F 2.099(vironment v)-.4 F 2.099 +(ariable being set\), an)-.25 F 4.599<798c>-.15 G(le)-4.599 E .477 +(named `)133 314.4 R(`DB_CONFIG')-.74 E 2.977('i)-.74 G 2.977(nt)-2.977 +G .477 +(he database home directory will be read for lines of the format `) +-2.977 F(`N)-.74 E(AME)-.35 E -1.35(VA)133 326.4 S(LUE')1.35 E 2.65 +('. The)-.74 F .15(whitespace delimiting the tw)2.65 F 2.65(op)-.1 G +.149(arts of the line may be one or more or )-2.65 F 4.025 +(characters. \(Leading)133 338.4 R 1.525 +(or trailing and characters are discarded.\))4.025 F 1.526 +(All empty lines or)6.526 F .369 +(lines whose \214rst non-whitespace character is a hash character \(`) +133 350.4 R(`#')-.74 E .368('\) will be ignored.)-.74 F .368 +(Each line must)5.368 F .376(specify both the N)133 362.4 R .376 +(AME and the V)-.35 F .376(ALUE of the pair)-1.35 F 5.376(.A)-.55 G .376 +(ll lines with unrecognized N)-5.376 F .377(AME v)-.35 F .377 +(alues will)-.25 F(be ignored.)133 374.4 Q .645(The follo)108 391.2 R +.645(wing `)-.25 F(`N)-.74 E .645(AME V)-.35 F(ALUE')-1.35 E 3.145('p) +-.74 G .644(airs in the)-3.145 F F1(db_con\214g)3.144 E F0(ar)3.144 E +.644(gument and the DB_CONFIG \214le are currently)-.18 F +(supported by Db)108 403.2 Q(.)-.4 E(DB_D)108 420 Q -1.21 -1.11(AT A)-.4 +H(_DIR)1.11 E .212(The path of a directory to be used as the location of the access method data \214les, e.g., paths speci\214ed) +133 432 R(to the)133 444 Q F1(Db::open)2.5 E F0 +(\(3\) method will be relati).24 E .3 -.15(ve t)-.25 H 2.5(ot).15 G +(his path.)-2.5 E 1.045(The DB_D)133 460.8 R -1.21 -1.11(AT A)-.4 H +1.045(_DIR paths are additi)1.11 F -.15(ve)-.25 G 3.545(,a).15 G 1.045 +(nd specifying more than one will result in each speci\214ed)-3.545 F +.176(directory being searched for database data \214les.)133 472.8 R +.177(If multiple paths are speci\214ed, created data \214les will)5.177 +F(al)133 484.8 Q -.1(wa)-.1 G(ys be created in the).1 E/F2 10 +/Times-Bold@0 SF(\214rst)2.5 E F0(directory speci\214ed.)2.5 E +(DB_LOG_DIR)108 501.6 Q .38(The path of a directory to be used as the location of logging \214les, e.g., \214les created by the) +133 513.6 R F1(DbLo)2.88 E(g)-.1 E F0(\(3\)).22 E .181 +(subsystem will be relati)133 525.6 R .481 -.15(ve t)-.25 H 2.682(ot).15 +G .182(his directory)-2.682 F 5.182(.I)-.65 G 2.682(fs)-5.182 G .182 +(peci\214ed, this is the directory name that will be passed)-2.682 F(to) +133 537.6 Q F1(DbLo)2.5 E(g::open)-.1 E F0(\(3\).).24 E(DB_TMP_DIR)108 +554.4 Q 1.089(The path of a directory to be used as the location of temporary \214les, e.g., \214les created to back in-) +133 566.4 R .017(memory access method databases will be created relati) +133 578.4 R .317 -.15(ve t)-.25 H 2.517(ot).15 G .017(his path.)-2.517 F +.018(Note, these temporary \214les can)5.018 F(potentially be quite lar) +133 590.4 Q(ge, depending on the size of the database.)-.18 E 3.149 +(If DB_TMP_DIR is not speci\214ed, the follo)133 614.4 R 3.148(wing en) +-.25 F 3.148(vironment v)-.4 F 3.148(ariables are check)-.25 F 3.148 +(ed in order:)-.1 F -.74(``)133 626.4 S(TMPDIR').74 E .812(', `)-.74 F +(`TEMP')-.74 E .812(', `)-.74 F(`TMP')-.74 E 3.312('a)-.74 G .812(nd `) +-3.312 F(`T)-.74 E(empF)-.7 E(older')-.15 E 3.312('. If)-.74 F .812 +(one of them is set, temporary \214les are cre-)3.312 F(ated relati)133 +638.4 Q .3 -.15(ve t)-.25 H 2.5(ot).15 G(he directory it speci\214es.) +-2.5 E .136(If DB_TMP_DIR is not speci\214ed and none of the abo)133 +662.4 R .436 -.15(ve e)-.15 H -.4(nv).15 G .135(ironment v).4 F .135 +(ariables are set, the \214rst possi-)-.25 F(ble one of the follo)133 +674.4 Q(wing directories is used:)-.25 E F1(/var/tmp)2.5 E F0(,).19 E F1 +(/usr/tmp)2.5 E F0(,).19 E F1(/temp)2.5 E F0(,).19 E F1(/tmp)2.5 E F0(,) +.19 E F1(C:/temp)2.5 E F0(and)2.5 E F1(C:/tmp)2.5 E F0(.).19 E .42 +(The follo)108 691.2 R .42 +(wing describes the speci\214c circumstances and order in which the dif) +-.25 F .42(ferent w)-.25 F .42(ays of specifying \214le)-.1 F 1.036 +(naming information are applied.)108 703.2 R(Speci\214cally)6.036 E +3.536(,D)-.65 G 3.536<628c>-3.536 G 1.036 +(le name processing proceeds sequentially through the)-3.536 F(follo)108 +715.2 Q(wing steps:)-.25 E(May 1, 1998)280.585 768 Q(6)203.585 E EP +%%Page: 7 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DbEn)72 48 Q 386.32(v\(3\) DbEn)-.4 F(v\(3\))-.4 +E -.74(``)108 84 S(/').74 E 10.38('I)-.74 G 2.952(fa)-10.38 G .752 -.15 +(ny \214)-2.952 H .452(le name speci\214ed to an).15 F 2.952(yD)-.15 G +2.953(bm)-2.952 G .453(ethod be)-2.953 F .453 +(gins with a leading slash, that \214le name is used with-)-.15 F +(out modi\214cation by Db)133 96 Q(.)-.4 E(DB_CONFIG)108 112.8 Q .51 +(If a rele)133 124.8 R -.25(va)-.25 G .509 +(nt con\214guration string \(e.g., DB_D).25 F -1.21 -1.11(AT A)-.4 H +.509(_DIR\), is speci\214ed in the DB_CONFIG con\214gura-)1.11 F .781 +(tion \214le, the V)133 136.8 R .781(ALUE from the `)-1.35 F(`N)-.74 E +.781(AME V)-.35 F(ALUE')-1.35 E 3.281('p)-.74 G .781 +(air is prepended to the current \214le name.)-3.281 F .782(If the)5.782 +F .466(resulting \214le name be)133 148.8 R .466(gins with a leading slash, the \214le name is used without further modi\214cation by) +-.15 F(Db)133 160.8 Q(.)-.4 E 1.295(The DB_CONFIG con\214guration \214le is intended to permit systems to customize \214le location for a) +133 184.8 R .407 +(database independent of applications using that database.)133 196.8 R +-.15(Fo)5.407 G 2.907(re).15 G .406 +(xample, a database administrator can)-3.057 F(mo)133 208.8 Q .3 -.15 +(ve t)-.15 H(he database log and data \214les to a dif).15 E +(ferent location without application recompilation.)-.25 E/F1 10 +/Times-Italic@0 SF(db_con\214g)108 225.6 Q F0 .012(If a rele)133 237.6 R +-.25(va)-.25 G .013(nt con\214guration string \(e.g., DB_D).25 F -1.21 +-1.11(AT A)-.4 H .013(_DIR\), is speci\214ed in the)1.11 F F1 +(db_con\214g)2.513 E F0(ar)2.513 E .013(gument and is)-.18 F .551 +(not speci\214ed in the DB_CONFIG \214le, the V)133 249.6 R .551 +(ALUE from the `)-1.35 F(`N)-.74 E .55(AME V)-.35 F(ALUE')-1.35 E 3.05 +('p)-.74 G .55(air is prepended to)-3.05 F 1.217 +(the current \214le name.)133 261.6 R 1.218 +(If the resulting \214le name be)6.217 F 1.218 +(gins with a leading slash, the \214le name is used)-.15 F +(without further modi\214cation by Db)133 273.6 Q(.)-.4 E(The)133 297.6 +Q F1(db_con\214g)3.195 E F0(ar)3.195 E .695(gument is intended to permit applications to customize \214le location for a database.) +-.18 F -.15(Fo)133 309.6 S 2.803(re).15 G .303(xample, an application writer can place data \214les and log \214les in dif) +-2.953 F .304(ferent directories, or instan-)-.25 F(tiate a ne)133 321.6 +Q 2.5(wl)-.25 G(og directory each time the application runs.)-2.5 E +(DB_HOME)108 338.4 Q 3.038(If the DB_HOME en)133 350.4 R 3.038 +(vironment v)-.4 F 3.038(ariable w)-.25 F 3.038 +(as set, \(and the application has set the appropriate)-.1 F +(DB_USE_ENVIR)133 362.4 Q .673(ON or DB_USE_ENVIR)-.4 F(ON_R)-.4 E(OO) +-.4 E 3.174(Te)-.4 G -.4(nv)-3.174 G .674(ironment v).4 F .674 +(ariable\), its v)-.25 F .674(alue is prepended)-.25 F .613 +(to the current \214le name.)133 374.4 R .613 +(If the resulting \214le name be)5.613 F .612 +(gins with a leading slash, the \214le name is used)-.15 F +(without further modi\214cation by Db)133 386.4 Q(.)-.4 E .395 +(The DB_HOME en)133 410.4 R .395(vironment v)-.4 F .395 +(ariable is intended to permit users and system administrators to o)-.25 +F -.15(ve)-.15 G -.2(r-).15 G(ride application and installation def)133 +422.4 Q(aults, e.g.,)-.1 E(en)183 446.4 Q 2.5(vD)-.4 G +(B_HOME=/database/my_home application)-2.5 E(Alternati)133 470.4 Q -.15 +(ve)-.25 G(ly).15 E 2.652(,a)-.65 G .152 +(pplication writers are encouraged to support the)-2.652 F/F2 10 +/Times-Bold@0 SF2.651 E F0 .151(option found in the supporting Db) +2.651 F(utilities to let users specify a database home.)133 482.4 Q F1 +(db_home)108 499.2 Q F0 .803(If the application speci\214ed a non-NULL) +133 511.2 R F1(db_home)3.303 E F0(ar)3.303 E .803(gument to)-.18 F F1 +(appinit)3.303 E F0 .803(\(and the database home w)3.303 F(as)-.1 E .822 +(not already speci\214ed using the DB_HOME en)133 523.2 R .821 +(vironment v)-.4 F .821(ariable\) its v)-.25 F .821 +(alue is prepended to the cur)-.25 F(-)-.2 E .908(rent \214le name.)133 +535.2 R .908(If the resulting \214le name be)5.908 F .909 +(gins with a leading slash, the \214le name is used without)-.15 F +(further modi\214cation by Db)133 547.2 Q(.)-.4 E(\(nothing\))108 564 Q +(Finally)133 576 Q 2.5(,a)-.65 G(ll \214le names are interpreted relati) +-2.5 E .3 -.15(ve t)-.25 H 2.5(ot).15 G(he current w)-2.5 E +(orking directory of the process.)-.1 E .56 +(The common model for a Db en)108 592.8 R .559 +(vironment is one where only the DB_HOME en)-.4 F .559(vironment v)-.4 F +.559(ariable, or the)-.25 F F1(db_home)108 604.8 Q F0(ar)2.821 E .321 +(gument, is speci\214ed.)-.18 F .322 +(In this case, all data \214les will be presumed to be relati)5.321 F +.622 -.15(ve t)-.25 H 2.822(ot).15 G .322(hat directory)-2.822 F(,)-.65 +E(and all \214les created by the Db subsystems will be created in that directory) +108 616.8 Q(.)-.65 E .564(The more comple)108 633.6 R 3.064(xm)-.15 G +.564(odel for a transaction en)-3.064 F .564 +(vironment might be one where a database home is speci\214ed,)-.4 F +3.587(using either the DB_HOME en)108 645.6 R 3.588(vironment v)-.4 F +3.588(ariable or the)-.25 F F1(db_home)6.088 E F0(ar)6.088 E 3.588 +(gument to)-.18 F F1(appinit)6.088 E F0 6.088(,a).68 G 3.588(nd then) +-6.088 F(DB_D)108 657.6 Q -1.21 -1.11(AT A)-.4 H .67 +(_DIR and DB_LOG_DIR are set to the relati)1.11 F .969 -.15(ve p)-.25 H +.669(ath names of directories underneath the home).15 F +(directory using the)108 669.6 Q F1(db_con\214g)2.5 E F0(ar)2.5 E +(gument to)-.18 E F1(appinit)2.5 E F0(or the DB_CONFIG \214le.)2.5 E/F3 +9/Times-Bold@0 SF(EXAMPLES)72 686.4 Q F0 +(Store all \214les in the directory)108 698.4 Q F1(/a/database)2.5 E F0 +(:).18 E(DbEn)144 715.2 Q(v::appinit\("/a/database", NULL, ...\);)-.4 E +(May 1, 1998)280.585 768 Q(7)203.585 E EP +%%Page: 8 8 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DbEn)72 48 Q 386.32(v\(3\) DbEn)-.4 F(v\(3\))-.4 +E(Create temporary backing \214les in)108 84 Q/F1 10/Times-Italic@0 SF +(/b/tempor)2.5 E(ary)-.15 E F0 2.5(,a).32 G(nd all other \214les in)-2.5 +E F1(/a/database)2.5 E F0(:).18 E(char *con\214g[] = {)144 100.8 Q +("DB_TMP_DIR /b/temporary",)154 112.8 Q(NULL)154 124.8 Q(};)144 136.8 Q +(DbEn)144 160.8 Q(v::appinit\("/a/database", con\214g, ...\);)-.4 E +1.208(Store data \214les in)108 177.6 R F1(/a/database/datadir)3.708 E +F0 3.708(,l).73 G 1.209(og \214les in)-3.708 F F1(/a/database/lo)3.709 E +(gdir)-.1 E F0 3.709(,a).73 G 1.209 +(nd all other \214les in the directory)-3.709 F F1(/a/database)108 189.6 +Q F0(:).18 E(char *con\214g[] = {)144 206.4 Q("DB_D)154 218.4 Q -1.21 +-1.11(AT A)-.4 H(_DIR datadir",)1.11 E("DB_LOG_DIR logdir",)154 230.4 Q +(NULL)154 242.4 Q(};)144 254.4 Q(DbEn)144 278.4 Q +(v::appinit\("/a/database", con\214g, ...\);)-.4 E .245 +(Store data \214les in)108 295.2 R F1(/a/database/data1)2.745 E F0(and) +2.745 E F1(/b/data2)2.745 E F0 2.744(,a).02 G .244 +(nd all other \214les in the directory)-2.744 F F1(/a/database)2.744 E +F0 5.244(.A).18 G .544 -.15(ny d)-5.244 H(ata).15 E +(\214les that are created will be created in)108 307.2 Q F1(/b/data2)2.5 +E F0(:).02 E(char *con\214g[] = {)144 324 Q("DB_D)154 336 Q -1.21 -1.11 +(AT A)-.4 H(_DIR /b/data2",)1.11 E("DB_D)154 348 Q -1.21 -1.11(AT A)-.4 +H(_DIR data1",)1.11 E(NULL)154 360 Q(};)144 372 Q(DbEn)144 396 Q +(v::appinit\("/a/database", con\214g, ...\);)-.4 E .007(See the \214le) +108 412.8 R F1 -.2(ex)2.508 G(amples_cxx/AppinitExample).2 E(.cpp)-.15 E +F0 .008(in the Db source distrib)2.508 F .008 +(ution for a C++ language code e)-.2 F(xam-)-.15 E(ple of ho)108 424.8 Q +2.5(wa)-.25 G 2.5(na)-2.5 G(pplication might use)-2.5 E F1(appinit)2.5 E +F0(to con\214gure its Db en)2.5 E(vironment.)-.4 E/F2 9/Times-Bold@0 SF +(ERR)72 441.6 Q(ORS)-.27 E F0 .05(Methods mark)108 453.6 R .05 +(ed as returning)-.1 F F1(errno)2.55 E F0 .049(will, by def)2.55 F .049 +(ault, thro)-.1 F 2.549(wa)-.25 G 2.549(ne)-2.549 G .049 +(xception that encapsulates the error informa-)-2.699 F 2.5(tion. The) +108 465.6 R(def)2.5 E(ault error beha)-.1 E(vior can be changed, see)-.2 +E F1(DbException)2.5 E F0(\(3\).).24 E(The)108 482.4 Q F1(appinit)2.5 E +F0(method may f)2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A +F0(\(3\)).24 E(or return)108 506.4 Q F1(errno)2.5 E F0(for an)2.5 E 2.5 +(yo)-.15 G 2.5(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: Db::close\(3\),)-.25 E(DbEn)108 518.4 Q +(v::appe)-.4 E(xit\(3\), DbLock::unlink\(3\), DbLockT)-.15 E +(ab::open\(3\), DbLog::compare\(3\), DbLog::get\(3\),)-.8 E(DbLog::open\(3\), DbLog::unlink\(3\), DbMpool::open\(3\), DbMpool::unlink\(3\), DbTxnMgr::checkpoint\(3\),) +108 530.4 Q(DbTxnMgr::open\(3\), DbTxnMgr::unlink\(3\), calloc\(3\), fclose\(3\), fcntl\(2\), f) +108 542.4 Q(\215ush\(3\), fgets\(3\), fopen\(3\), mal-)-.25 E +(loc\(3\), memcp)108 554.4 Q(y\(3\), memset\(3\), realloc\(3\), stat\(2\), strchr\(3\), strcmp\(3\), strcp) +-.1 E(y\(3\), strdup\(3\), strerror\(3\),)-.1 E +(strlen\(3\), strsep\(3\), and time\(3\).)108 566.4 Q .241 +(In addition, the)108 583.2 R F1(appinit)2.741 E F0 .241(method may f) +2.741 F .241(ail and thro)-.1 F 2.741(wa)-.25 G F1(DbException)A F0 .24 +(\(3\) or return).24 F F1(errno)2.74 E F0 .24(for the follo)2.74 F .24 +(wing con-)-.25 F(ditions:)108 595.2 Q([EINV)108 612 Q(AL])-1.35 E +(An in)133 624 Q -.25(va)-.4 G(lid \215ag v).25 E(alue or parameter w) +-.25 E(as speci\214ed.)-.1 E(The DB_THREAD \215ag w)133 648 Q(as speci\214ed and spinlocks are not implemented for this architecture.) +-.1 E(The DB_RECO)133 672 Q(VER or DB_RECO)-.5 E(VER_F)-.5 E -1.21 -1.11 +(AT A)-.74 H 2.5<4c8d>1.11 G(ag w)-2.5 E +(as speci\214ed, and no log \214les were found.)-.1 E +(The DB_HOME or TMPDIR en)133 696 Q(vironment v)-.4 E +(ariables were set b)-.25 E(ut empty)-.2 E(.)-.65 E +(An incorrectly formatted `)133 720 Q(`N)-.74 E(AME V)-.35 E(ALUE')-1.35 +E 2.5('e)-.74 G(ntry or line w)-2.5 E(as found.)-.1 E(May 1, 1998) +280.585 768 Q(8)203.585 E EP +%%Page: 9 9 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DbEn)72 48 Q 386.32(v\(3\) DbEn)-.4 F(v\(3\))-.4 +E([ENOSPC])108 84 Q(HP-UX only: a pre)133 96 Q(viously created Db en) +-.25 E(vironment for this process still e)-.4 E(xists.)-.15 E(The)108 +112.8 Q/F1 10/Times-Italic@0 SF(DbEn)2.5 E(v::appe)-.4 E(xit)-.2 E F0 +(method may f)2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0 +(\(3\)).24 E(or return)108 136.8 Q F1(errno)2.5 E F0(for an)2.5 E 2.5 +(yo)-.15 G 2.5(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: DbLock-)-.25 E -.8(Ta)108 148.8 S(b::close\(3\), DbLog::close\(3\), DbMpool::close\(3\), and DbTxnMgr::close\(3\).) +.8 E/F2 9/Times-Bold@0 SF -.09(BU)72 165.6 S(GS).09 E F0 .319 +(Due to the constraints of the P)108 177.6 R .318 +(A-RISC memory architecture, HP-UX does not allo)-.92 F 2.818(wap)-.25 G +.318(rocess to map a \214le)-2.818 F .221 +(into its address space multiple times.)108 189.6 R -.15(Fo)5.221 G +2.722(rt).15 G .222(his reason, each DB en)-2.722 F .222 +(vironment may be opened only once by a)-.4 F .636 +(process on HP-UX, i.e., calls to)108 201.6 R F1(appinit)3.136 E F0 .636 +(will f)3.136 F .635(ail if the speci\214ed Db en)-.1 F .635 +(vironment has been opened and not)-.4 F 2.5(subsequently closed.)108 +213.6 R .814(On W)108 230.4 R(indo)-.4 E .814(ws/95, \214les that are opened by multiple processes do not share data correctly) +-.25 F 5.815(.T)-.65 G 3.315(ot)-6.615 G .815(ell Berk)-3.315 F(ele)-.1 +E(y)-.15 E 1.418(DB to use the paging \214le to share memory among processes, use the DB_REGION_N) +108 242.4 R 1.417(AME \215ag of the)-.35 F F1(db_value_set)108 254.4 Q +F0 3.712(function. Ob)3.712 F(viously)-.15 E 3.712(,y)-.65 G 1.212 +(ou do not need to do this if only a single process will be accessing) +-3.712 F(database \214les.)108 266.4 Q F2(SEE ALSO)72 283.2 Q F1(db_ar) +108 295.2 Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E F1(db_c)2.5 E(hec) +-.15 E(kpoint)-.2 E F0(\(1\),).68 E F1(db_deadloc)2.5 E(k)-.2 E F0 +(\(1\),).67 E F1(db_dump)2.5 E F0(\(1\),).19 E F1(db_load)2.5 E F0 +(\(1\),).77 E F1(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F1 +(db_stat)2.5 E F0(\(1\),).68 E F1(db_intr)108 307.2 Q(o)-.45 E F0 +(\(3\),).18 E F1(db_internal)2.5 E F0(\(3\),).51 E F1(db_thr)2.5 E(ead) +-.37 E F0(\(3\),).77 E F1(Db)2.5 E F0(\(3\),).23 E F1(Dbc)2.5 E F0 +(\(3\),).31 E F1(DbEn)2.5 E(v)-.4 E F0(\(3\),).32 E F1(DbException)2.5 E +F0(\(3\),).24 E F1(DbInfo)2.5 E F0(\(3\),).18 E F1(DbLoc)108 319.2 Q(k) +-.2 E F0(\(3\),).67 E F1(DbLoc)2.5 E(kT)-.2 E(ab)-.92 E F0(\(3\),).23 E +F1(DbLo)2.5 E(g)-.1 E F0(\(3\),).22 E F1(DbLsn)2.5 E F0(\(3\),).24 E F1 +(DbMpool)2.5 E F0(\(3\),).51 E F1(DbMpoolF)2.5 E(ile)-.45 E F0(\(3\),) +.18 E F1(Dbt)2.5 E F0(\(3\),).68 E F1(DbTxn)2.5 E F0(\(3\),).24 E F1 +(DbTxnMgr)108 331.2 Q F0(\(3\)).73 E(May 1, 1998)280.585 768 Q(9)203.585 +E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/mancxx.ps/DbException.ps b/mozilla/db/man/mancxx.ps/DbException.ps new file mode 100644 index 00000000000..d8cd5b92637 --- /dev/null +++ b/mozilla/db/man/mancxx.ps/DbException.ps @@ -0,0 +1,283 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:34 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 1 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(DbException \255 Exception class for Db acti)108 40.8 Q(vity)-.25 E F0 +(SYNOPSIS)72 57.6 Q/F2 10/Times-Bold@0 SF(#include )108 69.6 Q +(DbException::DbException\(int err\);)108 93.6 Q +(DbException::DbException\(const char *description\);)108 105.6 Q +(DbException::DbException\(const char *pr)108 117.6 Q +(e\214x, int err\);)-.18 E(DbException::DbException\(const char *pr)108 +129.6 Q(e\214x1,)-.18 E(const char *pr)158 141.6 Q(e\214x2, int err\);) +-.18 E(const int)108 165.6 Q(DbException::get_err)108 177.6 Q(no\(\);) +-.15 E(virtual const char *)108 201.6 Q(DbException::what\(\) const;)108 +213.6 Q F0(DESCRIPTION)72 230.4 Q F1 1.02(The DB library is a f)108 +242.4 R 1.019(amily of classes that pro)-.1 F 1.019 +(vides a modular programming interf)-.15 F 1.019 +(ace to transactions and)-.1 F 1.377(record-oriented \214le access.)108 +254.4 R 1.378(The library includes support for transactions, locking, logging and \214le page) +6.377 F .443(caching, as well as v)108 266.4 R .443(arious inde)-.25 F +-.15(xe)-.15 G 2.943(da).15 G .442(ccess methods.)-2.943 F(Man)5.442 E +2.942(yo)-.15 G 2.942(ft)-2.942 G .442 +(he classes \(e.g., the \214le page caching class\))-2.942 F .4(are useful independent of the other DB classes, although some classes are e) +108 278.4 R .4(xplicitly based on other classes)-.15 F +(\(e.g., transactions and logging\).)108 290.4 Q -.15(Fo)5 G 2.5(rag).15 +G(eneral description of the DB package, see)-2.5 E/F3 10/Times-Italic@0 +SF(db_intr)2.5 E(o)-.45 E F1(\(3\).).18 E +(This manual page describes the DbException class and ho)108 307.2 Q 2.5 +(wi)-.25 G 2.5(ti)-2.5 G 2.5(su)-2.5 G(sed by the v)-2.5 E +(arious Db* classes.)-.25 E 1.076 +(Most methods in the Db classes return an int b)108 336 R 1.076 +(ut also thro)-.2 F 3.575(wa)-.25 G 3.575(ne)-3.575 G 3.575 +(xception. This)-3.725 F(allo)3.575 E 1.075(ws for tw)-.25 F 3.575(od) +-.1 G(if)-3.575 E(ferent)-.25 E 1.405(error beha)108 348 R 1.405 +(viors, that are kno)-.2 F 1.405(wn as)-.25 F F3(err)3.905 E 1.405 +(or models)-.45 F F1 6.405(.B).27 G 3.905(yd)-6.405 G(ef)-3.905 E 1.406 +(ault, the error model is con\214gured to thro)-.1 F 3.906(wa)-.25 G(n) +-3.906 E -.15(ex)108 360 S .448(ception whene).15 F -.15(ve)-.25 G 2.948 +(ra).15 G .447(serious error occurs.)-.001 F .447(This generally allo) +5.447 F .447(ws for cleaner logic for transaction process-)-.25 F .397 +(ing, as a try block can surround a single transaction.)108 372 R +(Alternati)5.397 E -.15(ve)-.25 G(ly).15 E 2.897(,t)-.65 G .397 +(he error model can be set to not thro)-2.897 F(w)-.25 E -.15(ex)108 384 +S 1.354(ceptions, and instead request the indi).15 F 1.354 +(vidual function to return an error code.)-.25 F 1.353 +(The error model can be)6.354 F(changed using the)108 396 Q F3(DbEn)2.5 +E(v::set_err)-.4 E(or_model)-.45 E F1(method, see)2.5 E F3(DbEn)2.5 E(v) +-.4 E F1(\(3\).).32 E 4.101(AD)108 412.8 S 1.601 +(bException object contains an informational string and an errno.)-4.101 +F 1.602(The errno can be obtained using)6.601 F F3(DbException::g)108 +424.8 Q(et_errno)-.1 E F1 2.5(\(\). The).18 F +(informational string can be obtained using)2.5 E F3(DbException::what) +2.5 E F1(\(\).).68 E 2.42 -.8(We e)108 441.6 T .819(xpect in the future that this class will inherit from the standard class e) +.65 F .819(xception, b)-.15 F .819(ut certain language)-.2 F +(implementation b)108 453.6 Q(ugs currently pre)-.2 E -.15(ve)-.25 G +(nt this on some platforms.).15 E .44 +(Some methods may return non-zero v)108 470.4 R .441 +(alues without issuing an e)-.25 F 2.941(xception. This)-.15 F .441 +(occurs in situations that are)2.941 F 1.093 +(not normally considered an error)108 482.4 R 3.592(,b)-.4 G 1.092 +(ut when some informational status is returned.)-3.792 F -.15(Fo)6.092 G +3.592(re).15 G(xample,)-3.742 E F3(Db::g)3.592 E(et)-.1 E F1 +(returns DB_KEYNO)108 494.4 Q(TFOUND when a requested k)-.4 E .3 -.15 +(ey d)-.1 H(oes not appear in the database.).15 E F0(SEE ALSO)72 511.2 Q +F3(db_ar)108 523.2 Q -.15(ch)-.37 G(ive).15 E F1(\(1\),).18 E F3(db_c) +2.5 E(hec)-.15 E(kpoint)-.2 E F1(\(1\),).68 E F3(db_deadloc)2.5 E(k)-.2 +E F1(\(1\),).67 E F3(db_dump)2.5 E F1(\(1\),).19 E F3(db_load)2.5 E F1 +(\(1\),).77 E F3(db_r)2.5 E(eco)-.37 E(ver)-.1 E F1(\(1\),).73 E F3 +(db_stat)2.5 E F1(\(1\),).68 E F3(db_intr)108 535.2 Q(o)-.45 E F1 +(\(3\),).18 E F3(db_internal)2.5 E F1(\(3\),).51 E F3(db_thr)2.5 E(ead) +-.37 E F1(\(3\),).77 E F3(Db)2.5 E F1(\(3\),).23 E F3(Dbc)2.5 E F1 +(\(3\),).31 E F3(DbEn)2.5 E(v)-.4 E F1(\(3\),).32 E F3(DbException)2.5 E +F1(\(3\),).24 E F3(DbInfo)2.5 E F1(\(3\),).18 E F3(DbLoc)108 547.2 Q(k) +-.2 E F1(\(3\),).67 E F3(DbLoc)2.5 E(kT)-.2 E(ab)-.92 E F1(\(3\),).23 E +F3(DbLo)2.5 E(g)-.1 E F1(\(3\),).22 E F3(DbLsn)2.5 E F1(\(3\),).24 E F3 +(DbMpool)2.5 E F1(\(3\),).51 E F3(DbMpoolF)2.5 E(ile)-.45 E F1(\(3\),) +.18 E F3(Dbt)2.5 E F1(\(3\),).68 E F3(DbTxn)2.5 E F1(\(3\),).24 E F3 +(DbTxnMgr)108 559.2 Q F1(\(3\)).73 E(1)535 768 Q EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/mancxx.ps/DbInfo.ps b/mozilla/db/man/mancxx.ps/DbInfo.ps new file mode 100644 index 00000000000..ca8e24fb096 --- /dev/null +++ b/mozilla/db/man/mancxx.ps/DbInfo.ps @@ -0,0 +1,730 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:34 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 7 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(DbInfo \255 informational parameters for database open)108 40.8 Q F0 +(SYNOPSIS)72 57.6 Q/F2 10/Times-Bold@0 SF(#include )108 69.6 Q +(DbInf)108 93.6 Q(o::DbInf)-.25 E(o\(\);)-.25 E(DbInf)108 105.6 Q +(o::~DbInf)-.25 E(o\(\);)-.25 E(DbInf)108 117.6 Q(o::DbInf)-.25 E +(o\(const DbInf)-.25 E 2.5(o&)-.25 G(\);)-2.5 E(DbInf)108 129.6 Q +(o::DbInf)-.25 E 2.5(o&)-.25 G(operator = \(const DbInf)-2.5 E 2.5(o&) +-.25 G(\);)-2.5 E(int DbInf)108 153.6 Q(o::get_lorder\(\) const;)-.25 E +-.1(vo)108 165.6 S(id DbInf).1 E(o::set_lorder\(int\);)-.25 E +(size_t DbInf)108 189.6 Q(o::get_cachesize\(\) const;)-.25 E -.1(vo)108 +201.6 S(id DbInf).1 E(o::set_cachesize\(size_t\);)-.25 E(size_t DbInf) +108 225.6 Q(o::get_pagesize\(\) const;)-.25 E -.1(vo)108 237.6 S +(id DbInf).1 E(o::set_pagesize\(size_t\);)-.25 E(typedef v)108 261.6 Q +(oid *\(*db_malloc_fcn\)\(size_t\);)-.1 E(DbInf)108 273.6 Q +(o::db_malloc_fcn DbInf)-.25 E(o::get_malloc\(\) const;)-.25 E -.1(vo) +108 285.6 S(id DbInf).1 E(o::set_malloc\(db_malloc_fcn\);)-.25 E +(u_int32_t DbInf)108 309.6 Q(o::get_bt_mink)-.25 E(ey\(\) const;)-.1 E +-.1(vo)108 321.6 S(id DbInf).1 E(o::set_bt_mink)-.25 E(ey\(u_int32_t\);) +-.1 E(typedef int \(*bt_compar)108 345.6 Q +(e_fcn\)\(const DBT *, const DBT *\);)-.18 E(bt_compar)108 357.6 Q +(e_fcn DbInf)-.18 E(o::get_bt_compar)-.25 E(e\(\) const;)-.18 E -.1(vo) +108 369.6 S(id DbInf).1 E(o::set_bt_compar)-.25 E(e\(bt_compar)-.18 E +(e_fcn\);)-.18 E(typedef size_t \(*bt_pr)108 393.6 Q +(e\214x_fcn\)\(const DBT *, const DBT *\);)-.18 E(bt_pr)108 405.6 Q +(e\214x_fcn DbInf)-.18 E(o::get_bt_pr)-.25 E(e\214x\(\) const;)-.18 E +-.1(vo)108 417.6 S(id DbInf).1 E(o::set_bt_pr)-.25 E(e\214x\(bt_pr)-.18 +E(e\214x_fcn\);)-.18 E(u_int32_t DbInf)108 441.6 Q +(o::get_h_ffactor\(\) const;)-.25 E -.1(vo)108 453.6 S(id DbInf).1 E +(o::set_h_ffactor\(u_int32_t\);)-.25 E(u_int32_t DbInf)108 477.6 Q +(o::get_h_nelem\(\) const;)-.25 E -.1(vo)108 489.6 S(id DbInf).1 E +(o::set_h_nelem\(u_int32_t\);)-.25 E +(typedef u_int32_t \(*h_hash_fcn\)\(const v)108 513.6 Q +(oid *, u_int32_t\);)-.1 E(h_hash_fcn DbInf)108 525.6 Q +(o::get_h_hash\(\) const;)-.25 E -.1(vo)108 537.6 S(id DbInf).1 E +(o::set_h_hash\(h_hash_fcn\);)-.25 E(int DbInf)108 561.6 Q(o::get_r)-.25 +E(e_pad\(\) const;)-.18 E -.1(vo)108 573.6 S(id DbInf).1 E(o::set_r)-.25 +E(e_pad\(int\);)-.18 E(int DbInf)108 597.6 Q(o::get_r)-.25 E +(e_delim\(\) const;)-.18 E -.1(vo)108 609.6 S(id DbInf).1 E(o::set_r) +-.25 E(e_delim\(int\);)-.18 E(u_int32_t DbInf)108 633.6 Q(o::get_r)-.25 +E(e_len\(\) const;)-.18 E -.1(vo)108 645.6 S(id DbInf).1 E(o::set_r)-.25 +E(e_len\(u_int32_t\);)-.18 E(char DbInf)108 669.6 Q(o::*get_r)-.25 E +(e_sour)-.18 E(ce\(\) const;)-.18 E -.1(vo)108 681.6 S(id DbInf).1 E +(o::set_r)-.25 E(e_sour)-.18 E(ce\(char *\);)-.18 E(u_int32_t DbInf)108 +705.6 Q(o::get_\215ags\(\) const;)-.25 E -.1(vo)108 717.6 S(id DbInf).1 +E(o::set_\215ags\(u_int32_t\);)-.25 E F1(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 384.42(DbInfo\(3\) DbInfo\(3\))72 48 R/F1 9 +/Times-Bold@0 SF(DESCRIPTION)72 84 Q F0 1.02(The DB library is a f)108 +96 R 1.019(amily of classes that pro)-.1 F 1.019 +(vides a modular programming interf)-.15 F 1.019 +(ace to transactions and)-.1 F 1.377(record-oriented \214le access.)108 +108 R 1.378(The library includes support for transactions, locking, logging and \214le page) +6.377 F .443(caching, as well as v)108 120 R .443(arious inde)-.25 F +-.15(xe)-.15 G 2.943(da).15 G .442(ccess methods.)-2.943 F(Man)5.442 E +2.942(yo)-.15 G 2.942(ft)-2.942 G .442 +(he classes \(e.g., the \214le page caching class\))-2.942 F .4(are useful independent of the other DB classes, although some classes are e) +108 132 R .4(xplicitly based on other classes)-.15 F +(\(e.g., transactions and logging\).)108 144 Q -.15(Fo)5 G 2.5(rag).15 G +(eneral description of the DB package, see)-2.5 E/F2 10/Times-Italic@0 +SF(db_intr)2.5 E(o)-.45 E F0(\(3\).).18 E .893 +(This manual page describes the DbInfo class.)108 160.8 R 3.393(AD)5.893 +G .893(bInfo object is used in conjunction with the)-3.393 F F2 +(Db::open)3.393 E F0 1.372(method \(see)108 172.8 R F2(Db)3.872 E F0 +1.373 +(\(3\)\) to specify particular con\214guration options for the open.).23 +F 1.373(The DbInfo class pro)6.373 F(vides)-.15 E .643 +(simple access to an underlying data structure, whose elements can be e) +108 184.8 R .643(xamined or changed using the)-.15 F F2(set_)3.143 E F0 +(or)108 196.8 Q F2 -.1(ge)3.522 G(t_).1 E F0 3.522(methods. The)3.522 F +1.023(remainder of the manual page refers to these accesses using the underlying name,) +3.522 F(e.g.,)108 208.8 Q F2(cac)2.981 E(hesize)-.15 E F0 .481 +(instead of)2.981 F F2 -.1(ge)2.981 G(t_cac).1 E(hesize)-.15 E F0(and) +2.981 E F2(set_cac)2.981 E(hesize)-.15 E F0 5.481(.T).18 G .481(he def) +-5.481 F .48(ault constructor sets all elements of the)-.1 F .782 +(underlying structure to zero.)108 220.8 R .782(Some of the \214elds are speci\214c to a type of \214le format \(one of btree, hashed) +5.782 F .4 +(and recno\) and are thus named with an underscore separated string, `) +108 232.8 R(`bt')-.74 E .399(', `)-.74 F(`h')-.74 E 2.899('a)-.74 G .399 +(nd `)-2.899 F(`re')-.74 E .399(', respecti)-.74 F -.15(ve)-.25 G(ly).15 +E 5.399(.F)-.65 G(or)-5.549 E -.15(ex)108 244.8 S 1.106 +(ample, the method).15 F F2(set_bt_mink)3.606 E -.3(ey)-.1 G F0 1.106 +(sets the underlying)3.906 F F2(bt_mink)3.607 E -.3(ey)-.1 G F0 1.107 +(\214eld, and this \214eld is only used when)3.907 F +(opening a btree \214le.)108 256.8 Q 1.427(The \214elds that are common to all access methods are listed here; those speci\214c to an indi) +108 273.6 R 1.427(vidual access)-.25 F .01(method are described belo)108 +285.6 R 3.81 -.65(w. N)-.25 H 2.51(or).65 G .01(eference to the DbInfo object is maintained by Db, so it is possible to dis-) +-2.51 F(card it as soon as the)108 297.6 Q F2(Db::open)2.5 E F0 +(call returns.)2.5 E 1.318(If possible, def)108 314.4 R 1.317 +(aults appropriate for the system are used for the DbInfo \214elds if) +-.1 F F2(dbinfo)3.817 E F0 1.317(is NULL or an)3.817 F(y)-.15 E .03 +(\214elds of the DbInfo object are not e)108 326.4 R .031 +(xplicitly set.)-.15 F .031(The follo)5.031 F .031 +(wing DbInfo \214elds may be initialized before call-)-.25 F(ing)108 +338.4 Q F2(Db::open)2.5 E F0(:).24 E(size_t cachesize;)108 355.2 Q 2.851 +(As)133 367.2 S .351 +(uggested maximum size of the memory pool cache, in bytes.)-2.851 F(If) +5.35 E F2(cac)2.85 E(hesize)-.15 E F0 .35(is not e)2.85 F .35 +(xplicitly set, an)-.15 F .382(appropriate def)133 379.2 R .382 +(ault is used.)-.1 F .382(It is an error to specify both the)5.382 F F2 +(mp_info)2.883 E F0 .383(\214eld and a non-zero)2.883 F F2(db_cac)2.883 +E(he-)-.15 E(size)133 391.2 Q F0(.).18 E/F3 10/Times-Bold@0 SF 1.408(Note, the minimum number of pages in the cache should be no less than 10, and the access) +133 415.2 R 1.598(methods will fail if an insuf\214ciently lar)133 427.2 +R 1.599(ge cache is speci\214ed.)-.1 F F0 1.599 +(In addition, for applications that)6.599 F -.15(ex)133 439.2 S .593(hibit strong locality in their data access patterns, increasing the size of the cache can signi\214cantly) +.15 F(impro)133 451.2 Q .3 -.15(ve a)-.15 H(pplication performance.).15 +E(int lorder;)108 468 Q .65(The byte order for inte)133 480 R .65 +(gers in the stored database metadata.)-.15 F .65 +(The number should represent the order)5.65 F .093(as an inte)133 492 R +(ger)-.15 E 2.593(,f)-.4 G .093(or e)-2.593 F .092(xample, big endian order is the number 4,321, and little endian order is the number) +-.15 F 3.42(1,234. If)133 504 R F2(lor)3.42 E(der)-.37 E F0 .92 +(is not e)3.42 F .921 +(xplicitly set, the host order of the machine where the Db library w) +-.15 F .921(as com-)-.1 F(piled is used.)133 516 Q .347(The v)133 540 R +.347(alue of)-.25 F F2(lor)2.847 E(der)-.37 E F0 .346(is ignored e)2.847 +F .346(xcept when databases are being created.)-.15 F .346 +(If a database already e)5.346 F(xists,)-.15 E +(the byte order it uses is determined when the \214le is read.)133 552 Q +F3 1.863(The access methods pr)133 576 R -.1(ov)-.18 G 1.864 +(ide no guarantees about the byte ordering of the application data).1 F +(stor)133 588 Q .934(ed in the database, and applications ar)-.18 F +3.434(er)-.18 G .934(esponsible f)-3.614 F .934 +(or maintaining any necessary order)-.25 F(-)-.37 E(ing)133 600 Q(.)-.15 +E F0(size_t pagesize;)108 616.8 Q .955 +(The size of the pages used to hold items in the database, in bytes.)133 +628.8 R .956(The minimum page size is 512)5.955 F 1.784 +(bytes and the maximum page size is 64K bytes.)133 640.8 R(If)6.784 E F2 +(pa)4.284 E -.1(ge)-.1 G(size).1 E F0 1.784(is not e)4.284 F 1.784 +(xplicitly set, a page size is)-.15 F .087 +(selected based on the underlying \214lesystem I/O block size.)133 652.8 +R .087(The selected size has a lo)5.087 F .087(wer limit of 512)-.25 F +(bytes and an upper limit of 16K bytes.)133 664.8 Q -.2(vo)108 681.6 S +(id *\(*malloc\)\(size_t\);).2 E .229(The \215ag DB_DBT_MALLOC, when speci\214ed in the Dbt object, will cause the Db library to allocate) +133 693.6 R .113(memory which then becomes the responsibility of the calling application.) +133 705.6 R(See)5.113 E F2(Dbt)2.613 E F0 .113(\(3\) for more infor).68 +F(-)-.2 E(mation.)133 717.6 Q(May 3, 1998)280.585 768 Q(2)203.585 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 384.42(DbInfo\(3\) DbInfo\(3\))72 48 R .423 +(On systems where there may be multiple library v)133 84 R .423 +(ersions of malloc \(notably W)-.15 F(indo)-.4 E .422(ws NT\), specify-) +-.25 F .192(ing the DB_DBT_MALLOC \215ag will f)133 96 R .193 +(ail because the Db library will allocate memory from a dif)-.1 F(fer) +-.25 E(-)-.2 E .165(ent heap than the application will use to free it.) +133 108 R 1.764 -.8(To a)5.164 H -.2(vo).6 G .164(id this problem, the) +.2 F/F1 10/Times-Italic@0 SF(malloc)2.664 E F0 .164(function should be) +2.664 F .968(set to point to the application')133 120 R 3.468(sa)-.55 G +.968(llocation routine.)-3.468 F(If)5.968 E F1(malloc)3.468 E F0 .968 +(is not e)3.468 F .969(xplicitly set, it will be used to)-.15 F 1.119 +(allocate the memory returned when the DB_DBT_MALLOC \215ag is set.)133 +132 R(The)6.118 E F1(malloc)3.618 E F0 1.118(method must)3.618 F +(match the calling con)133 144 Q -.15(ve)-.4 G(ntions of the).15 E F1 +(malloc)2.5 E F0(\(3\) library routine.).31 E/F2 9/Times-Bold@0 SF +(BTREE)72 160.8 Q F0 1.518(The btree data structure is a sorted, balanced tree structure storing associated k) +108 172.8 R -.15(ey)-.1 G 1.518(/data pairs.).15 F(Searches,)6.518 E +.136(insertions, and deletions in the btree will all complete in O \(lg base N\) where base is the a) +108 184.8 R -.15(ve)-.2 G .135(rage number of).15 F -.1(ke)108 196.8 S +.024(ys per page.)-.05 F .024(Often, inserting ordered data into btrees results in pages that are half-full.) +5.024 F .025(This implementa-)5.025 F .337 +(tion has been modi\214ed to mak)108 208.8 R 2.837(eo)-.1 G .337 +(rdered \(or in)-2.837 F -.15(ve)-.4 G .336 +(rse ordered\) insertion the best case, resulting in nearly per).15 F(-) +-.2 E(fect page space utilization.)108 220.8 Q .188 +(Space freed by deleting k)108 237.6 R -.15(ey)-.1 G .188 +(/data pairs from the database is ne).15 F -.15(ve)-.25 G 2.688(rr).15 G +.188(eclaimed from the \214lesystem, although it)-2.688 F 1.28 +(is reused where possible.)108 249.6 R 1.28 +(This means that the btree storage structure is gro)6.28 F(w-only)-.25 E +6.28(.I)-.65 G 3.78(fs)-6.28 G(uf)-3.78 E 1.28(\214ciently man)-.25 F(y) +-.15 E -.1(ke)108 261.6 S 1.379(ys are deleted from a tree that shrinking the underlying database \214le is desirable, this can be accom-) +-.05 F(plished by creating a ne)108 273.6 Q 2.5(wt)-.25 G +(ree from a scan of the e)-2.5 E(xisting one.)-.15 E .768(The follo)108 +290.4 R .767(wing additional \214elds and \215ags may be initialized in the DbInfo object before calling) +-.25 F F1(Db::open)3.267 E F0(,).24 E +(when using the btree access method:)108 302.4 Q +(int \(*bt_compare\)\(const Dbt *, const Dbt *\);)108 319.2 Q(The)133 +331.2 Q F1(bt_compar)2.676 E(e)-.37 E F0 .176(function is the k)2.676 F +.476 -.15(ey c)-.1 H .176(omparison method.).15 F .176 +(It must return an inte)5.176 F .177(ger less than, equal to,)-.15 F +.872(or greater than zero if the \214rst k)133 343.2 R 1.172 -.15(ey a) +-.1 H -.18(rg).15 G .872(ument is considered to be respecti).18 F -.15 +(ve)-.25 G .871(ly less than, equal to, or).15 F .876 +(greater than the second k)133 355.2 R 1.176 -.15(ey a)-.1 H -.18(rg).15 +G 3.376(ument. The).18 F .876 +(same comparison method must be used on a gi)3.376 F -.15(ve)-.25 G +3.377(nt).15 G(ree)-3.377 E -2.15 -.25(ev e)133 367.2 T +(ry time it is opened.).25 E(The)133 391.2 Q F1(data)2.638 E F0(and) +2.638 E F1(size)2.638 E F0 .137(\214elds of the DBT are the only \214elds that may be used for the purposes of this com-) +2.637 F(parison.)133 403.2 Q(If)133 427.2 Q F1(bt_compar)3.522 E(e)-.37 +E F0 1.022(is NULL, the k)3.522 F -.15(ey)-.1 G 3.522(sa).15 G 1.022 +(re compared le)-3.522 F(xically)-.15 E 3.522(,w)-.65 G 1.022 +(ith shorter k)-3.522 F -.15(ey)-.1 G 3.522(sc).15 G 1.023 +(ollating before longer)-3.522 F -.1(ke)133 439.2 S(ys.)-.05 E +(u_int32_t bt_mink)108 456 Q -.15(ey)-.1 G(;).15 E .119 +(The minimum number of k)133 468 R -.15(ey)-.1 G 2.619(st).15 G .118 +(hat will be stored on an)-2.619 F 2.618(ys)-.15 G .118(ingle page.) +-2.618 F .118(This v)5.118 F .118(alue is used to determine)-.25 F 1.255 +(which k)133 480 R -.15(ey)-.1 G 3.755(sw).15 G 1.255 +(ill be stored on o)-3.755 F -.15(ve)-.15 G(r\215o).15 E 3.756(wp)-.25 G +1.256(ages, i.e. if a k)-3.756 F 1.556 -.15(ey o)-.1 H 3.756(rd).15 G +1.256(ata item is lar)-3.756 F 1.256(ger than the pagesize)-.18 F(di)133 +492 Q .365(vided by the)-.25 F F1(bt_mink)2.865 E -.3(ey)-.1 G F0 -.25 +(va)3.165 G .365(lue, it will be stored on o).25 F -.15(ve)-.15 G +(r\215o).15 E 2.864(wp)-.25 G .364(ages instead of in the page itself.) +-2.864 F(The)5.364 E F1(bt_mink)133 504 Q -.3(ey)-.1 G F0 -.25(va)2.8 G +(lue speci\214ed must be at least 2; if).25 E F1(bt_mink)2.5 E -.3(ey) +-.1 G F0(is not e)2.8 E(xplicitly set, a v)-.15 E(alue of 2 is used.) +-.25 E(size_t \(*bt_pre\214x\)\(const Dbt *, const Dbt *\);)108 520.8 Q +(The)133 532.8 Q F1(bt_pr)3.882 E(e\214x)-.37 E F0 1.382 +(function is the pre\214x comparison method.)3.882 F 1.382 +(If speci\214ed, this method must return the)6.382 F .202 +(number of bytes of the second k)133 544.8 R .502 -.15(ey a)-.1 H -.18 +(rg).15 G .201 +(ument that are necessary to determine that it is greater than the).18 F +(\214rst k)133 556.8 Q .3 -.15(ey a)-.1 H -.18(rg).15 G 2.5(ument. If) +.18 F(the k)2.5 E -.15(ey)-.1 G 2.5(sa).15 G(re equal, the k)-2.5 E .3 +-.15(ey l)-.1 H(ength should be returned.).15 E(The)133 580.8 Q F1(data) +2.637 E F0(and)2.637 E F1(size)2.637 E F0 .137(\214elds of the DBT are the only \214elds that may be used for the purposes of this com-) +2.637 F(parison.)133 592.8 Q .838(This is used to compress the k)133 +616.8 R -.15(ey)-.1 G 3.338(ss).15 G .838 +(tored on the btree internal pages.)-3.338 F .837 +(The usefulness of this is data)5.838 F 1.189(dependent, b)133 628.8 R +1.189(ut in some data sets can produce signi\214cantly reduced tree sizes and search times.) +-.2 F(If)6.19 E F1(bt_pr)133 640.8 Q(e\214x)-.37 E F0 1.074(is not e) +3.574 F 1.074 +(xplicitly set, and no comparison method is speci\214ed, a def)-.15 F +1.073(ault le)-.1 F 1.073(xical comparison)-.15 F .306(method is used.) +133 652.8 R(If)5.307 E F1(bt_pr)2.807 E(e\214x)-.37 E F0 .307(is NULL and a comparison method is speci\214ed, no pre\214x comparison is) +2.807 F(done.)133 664.8 Q(unsigned long \215ags;)108 681.6 Q(The follo) +133 693.6 Q(wing additional \215ags may be speci\214ed:)-.25 E +(May 3, 1998)280.585 768 Q(3)203.585 E EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 384.42(DbInfo\(3\) DbInfo\(3\))72 48 R(DB_DUP) +133 84 Q .263(Permit duplicate k)158 96 R -.15(ey)-.1 G 2.763(si).15 G +2.763(nt)-2.763 G .263(he tree, i.e. insertion when the k)-2.763 F .562 +-.15(ey o)-.1 H 2.762(ft).15 G .262(he k)-2.762 F -.15(ey)-.1 G .262 +(/data pair being inserted).15 F 1.297(already e)158 108 R 1.297 +(xists in the tree will be successful.)-.15 F 1.298 +(The ordering of duplicates in the tree is deter)6.297 F(-)-.2 E .91(mined by the order of insertion, unless the ordering is otherwise speci\214ed by use of a cursor) +158 120 R(\(see)158 132 Q/F1 10/Times-Italic@0 SF(Dbc)2.565 E F0 .065 +(\(3\) for more information.\)).31 F .066 +(It is an error to specify both DB_DUP and DB_RECNUM.)5.066 F(DB_RECNUM) +133 160.8 Q 4.64(Support retrie)158 172.8 R -.25(va)-.25 G 7.14(lf).25 G +4.64(rom btrees using record numbers.)-7.14 F -.15(Fo)9.64 G 7.14(rm).15 +G 4.64(ore information, see the)-7.14 F 1.335 +(DB_GET_RECNO \215ag to the)158 184.8 R F1(db->g)3.836 E(et)-.1 E F0 +1.336(method \(belo)3.836 F 1.336(w\), and the cursor)-.25 F F1(Dbc::g) +3.836 E(et)-.1 E F0 1.336(method \(in)3.836 F F1(Dbc)158 196.8 Q F0 +(\(3\)\).).31 E .832 +(Logical record numbers in btrees are mutable in the f)158 220.8 R .831 +(ace of record insertion or deletion.)-.1 F(See)5.831 E +(the DB_RENUMBER \215ag in the RECNO section belo)158 232.8 Q 2.5(wf) +-.25 G(or further discussion.)-2.5 E .713(Maintaining record counts within a btree introduces a serious point of contention, namely the) +158 256.8 R .702(page locations where the record counts are stored.)158 +268.8 R .701(In addition, the entire tree must be lock)5.701 F(ed)-.1 E +.675(during both insertions and deletions, ef)158 280.8 R(fecti)-.25 E +-.15(ve)-.25 G .676(ly single-threading the tree for those operations.) +.15 F .11(Specifying DB_RECNUM can result in serious performance de)158 +292.8 R .11(gradation for some applications)-.15 F(and data sets.)158 +304.8 Q(It is an error to specify both DB_DUP and DB_RECNUM.)158 328.8 Q +/F2 9/Times-Bold@0 SF(HASH)72 345.6 Q F0 .59 +(The hash data structure is an e)108 357.6 R .591 +(xtensible, dynamic hashing scheme.)-.15 F(Backw)5.591 E .591 +(ard compatible interf)-.1 F .591(aces to the)-.1 F .108 +(functions described in)108 369.6 R F1(dbm)2.608 E F0(\(3\),).32 E F1 +(ndbm)2.608 E F0 .108(\(3\) and).32 F F1(hsear)2.608 E -.15(ch)-.37 G F0 +.108(\(3\) are pro).43 F .108(vided, ho)-.15 F(we)-.25 E -.15(ve)-.25 G +2.608(rt).15 G .108(hese interf)-2.608 F .107(aces are not com-)-.1 F +(patible with pre)108 381.6 Q(vious \214le formats.)-.25 E .767 +(The follo)108 398.4 R .767(wing additional \214elds and \215ags may be initialized in the DbInfo object before calling) +-.25 F F1(Db::open)3.268 E F0(,).24 E +(when using the hash access method:)108 410.4 Q(u_int32_t h_f)108 439.2 +Q -.1(fa)-.25 G(ctor;).1 E .787 +(The desired density within the hash table.)133 451.2 R .787 +(It is an approximation of the number of k)5.787 F -.15(ey)-.1 G 3.287 +(sa).15 G(llo)-3.287 E .787(wed to)-.25 F .504(accumulate in an)133 +463.2 R 3.004(yo)-.15 G .504(ne b)-3.004 F(uck)-.2 E .505 +(et, determining when the hash table gro)-.1 F .505(ws or shrinks.)-.25 +F .505(The def)5.505 F .505(ault v)-.1 F(alue)-.25 E +(is 0, indicating that the \214ll f)133 475.2 Q +(actor will be selected dynamically as pages are \214lled.)-.1 E +(u_int32_t \(*h_hash\)\(const v)108 492 Q(oid *, u_int32_t\);)-.2 E(The) +133 504 Q F1(h_hash)3.205 E F0 .705 +(\214eld is a user de\214ned hash method; if)3.205 F F1(h_hash)3.205 E +F0 .705(is NULL, a def)3.205 F .705(ault hash method is used.)-.1 F .654 +(Since no hash method performs equally well on all possible data, the user may \214nd that the b) +133 516 R(uilt-in)-.2 E 1.015 +(hash method performs poorly with a particular data set.)133 528 R 1.014 +(User speci\214ed hash functions must tak)6.015 F 3.514(ea)-.1 G +(pointer to a byte string and a length as ar)133 540 Q +(guments and return a u_int32_t v)-.18 E(alue.)-.25 E .152 +(If a hash method is speci\214ed,)133 556.8 R F1(hash_open)2.652 E F0 +.153(will attempt to determine if the hash method speci\214ed is the) +2.652 F(same as the one with which the database w)133 568.8 Q +(as created, and will f)-.1 E(ail if it detects that it is not.)-.1 E +(u_int32_t h_nelem;)108 585.6 Q .069 +(An estimate of the \214nal size of the hash table.)133 597.6 R .069 +(If not set or set too lo)5.069 F 1.369 -.65(w, h)-.25 H .069 +(ash tables will e).65 F .069(xpand grace-)-.15 F 1.355(fully as k)133 +609.6 R -.15(ey)-.1 G 3.855(sa).15 G 1.356 +(re entered, although a slight performance de)-3.855 F 1.356 +(gradation may be noticed.)-.15 F 1.356(The def)6.356 F(ault)-.1 E -.25 +(va)133 621.6 S(lue is 1.).25 E(unsigned long \215ags;)108 638.4 Q .349 +(The follo)133 650.4 R .349 +(wing additional \215ags may be speci\214ed by)-.25 F/F3 10/Times-Bold@0 +SF(or)2.849 E F0 .349('ing together one or more of the follo)B .348 +(wing v)-.25 F(al-)-.25 E(ues:)133 662.4 Q(DB_DUP)133 679.2 Q .262 +(Permit duplicate k)158 691.2 R -.15(ey)-.1 G 2.762(si).15 G 2.762(nt) +-2.762 G .262(he tree, i.e. insertion when the k)-2.762 F .563 -.15 +(ey o)-.1 H 2.763(ft).15 G .263(he k)-2.763 F -.15(ey)-.1 G .263 +(/data pair being inserted).15 F 1.298(already e)158 703.2 R 1.298 +(xists in the tree will be successful.)-.15 F 1.297 +(The ordering of duplicates in the tree is deter)6.298 F(-)-.2 E .91(mined by the order of insertion, unless the ordering is otherwise speci\214ed by use of a cursor) +158 715.2 R(\(see)158 727.2 Q F1(Dbc)2.5 E F0 +(\(3\) for more information.\)).31 E(May 3, 1998)280.585 768 Q(4)203.585 +E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 384.42(DbInfo\(3\) DbInfo\(3\))72 48 R/F1 9 +/Times-Bold@0 SF(RECNO)72 84 Q F0 .224(The recno access method pro)108 +96 R .223(vides support for \214x)-.15 F .223(ed and v)-.15 F .223 +(ariable length records, optionally back)-.25 F .223(ed by a \215at)-.1 +F(te)108 108 Q(xt \(byte stream\) \214le.)-.15 E(Both \214x)5 E +(ed and v)-.15 E +(ariable length records are accessed by their logical record number)-.25 +E(.)-.55 E .34(It is v)108 124.8 R .341(alid to create a record whose record number is more than one greater than the last record currently in) +-.25 F .042(the database.)108 136.8 R -.15(Fo)5.042 G 2.542(re).15 G +.041(xample, the creation of record number 8, when records 6 and 7 do not yet e) +-2.692 F .041(xist, is not an)-.15 F(error)108 148.8 Q 5(.H)-.55 G -.25 +(ow)-5 G -2.15 -.25(ev e).25 H .8 -.4(r, a).25 H .3 -.15(ny a).4 H +(ttempt to retrie).15 E .3 -.15(ve s)-.25 H +(uch records \(e.g., records 6 and 7\) will return DB_KEYEMPTY).15 E(.) +-1.29 E 1.008(Deleting a record will not, by def)108 165.6 R 1.008 +(ault, renumber records follo)-.1 F 1.008 +(wing the deleted record \(see DB_RENUM-)-.25 F(BER belo)108 177.6 Q 2.5 +(wf)-.25 G(or more information\).)-2.5 E(An)5 E 2.5(ya)-.15 G +(ttempt to retrie)-2.5 E .3 -.15(ve d)-.25 H +(eleted records will return DB_KEYEMPTY).15 E(.)-1.29 E .768(The follo) +108 194.4 R .767(wing additional \214elds and \215ags may be initialized in the DbInfo object before calling) +-.25 F/F2 10/Times-Italic@0 SF(Db::open)3.267 E F0(,).24 E +(when using the recno access method:)108 206.4 Q(int re_delim;)108 223.2 +Q -.15(Fo)133 235.2 S 2.803(rv).15 G .303 +(ariable length records, if the)-3.053 F F2 -.37(re)2.804 G(_sour).37 E +(ce)-.37 E F0 .304 +(\214le is speci\214ed and the DB_DELIMITER \215ag is set, the)2.804 F +.659 +(delimiting byte used to mark the end of a record in the source \214le.) +133 247.2 R .659(If the)5.659 F F2 -.37(re)3.159 G(_sour).37 E(ce)-.37 E +F0 .659(\214le is speci\214ed)3.159 F 1.213 +(and the DB_DELIMITER \215ag is not set, characters \(i.e. `)-.25 F(`\\n')-.74 E 1.214 +(', 0x0a\) are interpreted as)-.74 F(end-of-record mark)133 271.2 Q +(ers.)-.1 E(u_int32_t re_len;)108 288 Q(The length of a \214x)133 300 Q +(ed-length record.)-.15 E(int re_pad;)108 316.8 Q -.15(Fo)133 328.8 S +4.508<728c>.15 G -.15(xe)-4.508 G 4.508(dl).15 G 2.008 +(ength records, if the DB_P)-4.508 F 2.008 +(AD \215ag is set, the pad character for short records.)-.92 F 2.007 +(If the)7.007 F(DB_P)133 340.8 Q(AD \215ag is not e)-.92 E +(xplicitly set, characters \(i.e., 0x20\) are used for padding.) +-.15 E(char *re_source;)108 357.6 Q .012(The purpose of the)133 369.6 R +F2 -.37(re)2.512 G(_sour).37 E(ce)-.37 E F0 .012(\214eld is to pro)2.512 +F .012(vide f)-.15 F .013 +(ast access and modi\214cation to databases that are nor)-.1 F(-)-.2 E +(mally stored as \215at te)133 381.6 Q(xt \214les.)-.15 E .773(If the) +133 405.6 R F2 -.37(re)3.273 G(_sour).37 E(ce)-.37 E F0 .773 +(\214eld is e)3.273 F .773 +(xplicitly set, it speci\214es an underlying \215at te)-.15 F .772 +(xt database \214le that is read to)-.15 F .001 +(initialize a transient record number inde)133 417.6 R 2.501(x. In)-.15 +F .001(the case of v)2.501 F .002 +(ariable length records, the records are sepa-)-.25 F .082 +(rated by the byte v)133 429.6 R(alue)-.25 E F2 -.37(re)2.581 G(_delim) +.37 E F0 5.081(.F).32 G .081(or e)-5.231 F .081 +(xample, standard UNIX byte stream \214les can be interpreted as)-.15 F +2.5(as)133 441.6 S(equence of v)-2.5 E +(ariable length records separated by characters.)-.25 +E .756(In addition, when cached data w)133 465.6 R .756(ould normally be written back to the underlying database \214le \(e.g.,) +-.1 F(the)133 477.6 Q F2(close)2.545 E F0(or)2.545 E F2(sync)2.545 E F0 +.045(functions are called\), the in-memory cop)2.545 F 2.544(yo)-.1 G +2.544(ft)-2.544 G .044(he database will be written back to the)-2.544 F +F2 -.37(re)133 489.6 S(_sour).37 E(ce)-.37 E F0(\214le.)2.5 E .449 +(By def)133 513.6 R .449(ault, the backing source \214le is read lazily) +-.1 F 2.949(,i)-.65 G .45 +(.e., records are not read from the \214le until the)-2.949 F 2.95(ya) +-.15 G(re)-2.95 E .748(requested by the application.)133 525.6 R/F3 10 +/Times-Bold@0 SF .748(If multiple pr)5.748 F .748(ocesses \(not thr)-.18 +F .748(eads\) ar)-.18 F 3.247(ea)-.18 G .747(ccessing a r)-3.247 F .747 +(ecno database)-.18 F(concurr)133 537.6 Q .108 +(ently and either inserting or deleting r)-.18 F .109 +(ecords, the backing sour)-.18 F .109(ce \214le must be r)-.18 F .109 +(ead in its)-.18 F(entir)133 549.6 Q .723(ety bef)-.18 F(or)-.25 E 3.223 +(em)-.18 G(or)-3.223 E 3.223(et)-.18 G .723(han a single pr)-3.223 F +.723(ocess accesses the database, and only that pr)-.18 F .722 +(ocess should)-.18 F .677(specify the backing sour)133 561.6 R .677 +(ce \214le as part of the)-.18 F F2(Db::open)3.177 E F0 3.178(call. See) +3.177 F .678(the DB_SN)3.178 F(APSHO)-.35 E 3.178<548d>-.4 G .678 +(ag belo)-3.178 F(w)-.25 E(for more information.)133 573.6 Q F3 1.276 +(Reading and writing the backing sour)133 597.6 R 1.276 +(ce \214le speci\214ed by r)-.18 F(e_sour)-.18 E 1.275 +(ce cannot be transactionally)-.18 F(pr)133 609.6 Q 2.175 +(otected because it in)-.18 F -.1(vo)-.4 G(lv).1 E 2.175 +(es \214lesystem operations that ar)-.1 F 4.675(en)-.18 G 2.176 +(ot part of the Db transaction)-4.675 F(methodology)133 621.6 Q(.)-.7 E +F0 -.15(Fo)5.374 G 2.874(rt).15 G .373(his reason, if a temporary database is used to hold the records, i.e., a NULL w) +-2.874 F(as)-.1 E .043(speci\214ed as the)133 633.6 R F2(\214le)2.543 E +F0(ar)2.543 E .043(gument to)-.18 F F2(Db::open)2.543 E F0 2.543(,i).24 +G 2.543(ti)-2.543 G 2.543(sp)-2.543 G .043 +(ossible to lose the contents of the)-2.543 F F2 -.37(re)2.544 G(_sour) +.37 E(ce)-.37 E F0 .044(\214le, e.g.,)2.544 F .777 +(if the system crashes at the right instant.)133 645.6 R .777 +(If a \214le is used to hold the database, i.e., a \214le name w)5.777 F +(as)-.1 E .529(speci\214ed as the)133 657.6 R F2(\214le)3.029 E F0(ar) +3.029 E .529(gument to)-.18 F F2(Db::open)3.029 E F0 3.029(,n).24 G .529 +(ormal database reco)-3.029 F -.15(ve)-.15 G .53 +(ry on that \214le can be used to pre-).15 F -.15(ve)133 669.6 S .145(nt information loss, although it is still possible that the contents of) +.15 F F2 -.37(re)2.645 G(_sour).37 E(ce)-.37 E F0 .145 +(will be lost if the sys-)2.645 F(tem crashes.)133 681.6 Q(The)133 705.6 +Q F2 -.37(re)2.5 G(_sour).37 E(ce)-.37 E F0(\214le must already e)2.5 E +(xist \(b)-.15 E(ut may be zero-length\) when)-.2 E F2(Db::open)2.5 E F0 +(is called.)2.5 E -.15(Fo)133 729.6 S 3.085(ra).15 G .585(ll of the abo) +-3.085 F .885 -.15(ve r)-.15 H .585(easons, the).15 F F2 -.37(re)3.085 G +(_sour).37 E(ce)-.37 E F0 .586 +(\214eld is generally used to specify databases that are read-)3.085 F +(May 3, 1998)280.585 768 Q(5)203.585 E EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 384.42(DbInfo\(3\) DbInfo\(3\))72 48 R .241(only for Db applications, and that are either generated on the \215y by softw) +133 84 R .241(are tools, or modi\214ed using)-.1 F 2.5(ad)133 96 S(if) +-2.5 E(ferent mechanism, e.g., a te)-.25 E(xt editor)-.15 E(.)-.55 E +(unsigned long \215ags;)108 112.8 Q .348(The follo)133 124.8 R .348 +(wing additional \215ags may be speci\214ed by)-.25 F/F1 10/Times-Bold@0 +SF(or)2.849 E F0 .349('ing together one or more of the follo)B .349 +(wing v)-.25 F(al-)-.25 E(ues:)133 136.8 Q(DB_DELIMITER)133 165.6 Q(The) +158 177.6 Q/F2 10/Times-Italic@0 SF -.37(re)2.5 G(_delim).37 E F0 +(\214eld is set.)2.5 E(DB_FIXEDLEN)133 206.4 Q .858 +(The records are \214x)158 218.4 R .857(ed-length, not byte delimited.) +-.15 F(The)5.857 E F2 -.37(re)3.357 G(_len).37 E F0 -.25(va)3.357 G .857 +(lue speci\214es the length of the).25 F(record, and the)158 230.4 Q F2 +-.37(re)2.5 G(_pad).37 E F0 -.25(va)2.5 G +(lue is used as the pad character).25 E(.)-.55 E(An)158 254.4 Q 4.788 +(yr)-.15 G 2.288(ecords added to the database that are less than)-4.788 +F F2 -.37(re)4.789 G(_len).37 E F0 2.289(bytes long are automatically) +4.789 F 2.877(padded. An)158 266.4 R 2.877(ya)-.15 G .377 +(ttempt to insert records into the database that are greater than)-2.877 +F F2 -.37(re)2.876 G(_len).37 E F0 .376(bytes long)2.876 F +(will cause the call to f)158 278.4 Q +(ail immediately and return an error)-.1 E(.)-.55 E(DB_P)133 307.2 Q(AD) +-.92 E(The)158 319.2 Q F2 -.37(re)2.5 G(_pad).37 E F0(\214eld is set.) +2.5 E(DB_RENUMBER)133 348 Q 1.258(Specifying the DB_RENUMBER \215ag causes the logical record numbers to be mutable, and) +158 360 R 1.16 +(change as records are added to and deleted from the database.)158 372 R +-.15(Fo)6.16 G 3.66(re).15 G 1.16(xample, the deletion of)-3.81 F .015(record number 4 causes records numbered 5 and greater to be renumbered do) +158 384 R(wnw)-.25 E .016(ard by 1.)-.1 F .016(If a)5.016 F .571 +(cursor w)158 396 R .571(as positioned to record number 4 before the deletion, it will reference the ne) +-.1 F 3.07(wr)-.25 G(ecord)-3.07 E .607(number 4, if an)158 408 R 3.107 +(ys)-.15 G .607(uch record e)-3.107 F .607(xists, after the deletion.) +-.15 F .608(If a cursor w)5.608 F .608(as positioned after record)-.1 F +.268(number 4 before the deletion, it will be shifted do)158 420 R(wnw) +-.25 E .267(ard 1 logical record, continuing to refer)-.1 F(-)-.2 E +(ence the same record as it did before.)158 432 Q .736(Using the)158 456 +R F2(Dbc::put)3.236 E F0(or)3.236 E F2(put)3.236 E F0(interf)3.236 E +.737(aces to create ne)-.1 F 3.237(wr)-.25 G .737 +(ecords will cause the creation of multiple)-3.237 F .872 +(records if the record number is more than one greater than the lar)158 +468 R .872(gest record currently in the)-.18 F 3.45(database. F)158 480 +R .95(or e)-.15 F .95(xample, creating record 28, when record 25 w)-.15 +F .95(as pre)-.1 F .95(viously the last record in)-.25 F 1.353 +(the database, will create records 26 and 27 as well as 28.)158 492 R +1.353(Attempts to retrie)6.353 F 1.653 -.15(ve r)-.25 H 1.353 +(ecords that).15 F(were created in this manner will result in an error return of DB_KEYEMPTY) +158 504 Q(.)-1.29 E .049(If a created record is not at the end of the database, all records follo) +158 528 R .05(wing the ne)-.25 F 2.55(wr)-.25 G .05(ecord will be)-2.55 +F .058(automatically renumbered upw)158 540 R .057(ard by 1.)-.1 F -.15 +(Fo)5.057 G 2.557(re).15 G .057(xample, the creation of a ne)-2.707 F +2.557(wr)-.25 G .057(ecord numbered 8)-2.557 F .804 +(causes records numbered 8 and greater to be renumbered upw)158 552 R +.804(ard by 1.)-.1 F .805(If a cursor w)5.805 F .805(as posi-)-.1 F +1.056(tioned to record number 8 or greater before the insertion, it will be shifted upw) +158 564 R 1.055(ard 1 logical)-.1 F +(record, continuing to reference the same record as it did before.)158 +576 Q -.15(Fo)158 600 S 2.671(rt).15 G .172(hese reasons, concurrent access to a recno database with the DB_RENUMBER \215ag speci-) +-2.671 F(\214ed may be lar)158 612 Q +(gely meaningless, although it is supported.)-.18 E(DB_SN)133 640.8 Q +(APSHO)-.35 E(T)-.4 E 1.289(This \215ag speci\214es that an)158 652.8 R +3.789(ys)-.15 G(peci\214ed)-3.789 E F2 -.37(re)3.789 G(_sour).37 E(ce) +-.37 E F0 1.289(\214le be read in its entirety when)3.789 F F2(Db::open) +3.788 E F0(is)3.788 E 2.5(called. If)158 664.8 R +(this \215ag is not speci\214ed, the)2.5 E F2 -.37(re)2.5 G(_sour).37 E +(ce)-.37 E F0(\214le may be read lazily)2.5 E(.)-.65 E/F3 9/Times-Bold@0 +SF(SEE ALSO)72 686.4 Q F2(db_ar)108 698.4 Q -.15(ch)-.37 G(ive).15 E F0 +(\(1\),).18 E F2(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F0(\(1\),).68 E F2 +(db_deadloc)2.5 E(k)-.2 E F0(\(1\),).67 E F2(db_dump)2.5 E F0(\(1\),).19 +E F2(db_load)2.5 E F0(\(1\),).77 E F2(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0 +(\(1\),).73 E F2(db_stat)2.5 E F0(\(1\),).68 E F2(db_intr)108 710.4 Q(o) +-.45 E F0(\(3\),).18 E F2(db_internal)2.5 E F0(\(3\),).51 E F2(db_thr) +2.5 E(ead)-.37 E F0(\(3\),).77 E F2(Db)2.5 E F0(\(3\),).23 E F2(Dbc)2.5 +E F0(\(3\),).31 E F2(DbEn)2.5 E(v)-.4 E F0(\(3\),).32 E F2(DbException) +2.5 E F0(\(3\),).24 E F2(DbInfo)2.5 E F0(\(3\),).18 E F2(DbLoc)108 722.4 +Q(k)-.2 E F0(\(3\),).67 E F2(DbLoc)2.5 E(kT)-.2 E(ab)-.92 E F0(\(3\),) +.23 E F2(DbLo)2.5 E(g)-.1 E F0(\(3\),).22 E F2(DbLsn)2.5 E F0(\(3\),).24 +E F2(DbMpool)2.5 E F0(\(3\),).51 E F2(DbMpoolF)2.5 E(ile)-.45 E F0 +(\(3\),).18 E F2(Dbt)2.5 E F0(\(3\),).68 E F2(DbTxn)2.5 E F0(\(3\),).24 +E(May 3, 1998)280.585 768 Q(6)203.585 E EP +%%Page: 7 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 384.42(DbInfo\(3\) DbInfo\(3\))72 48 R/F1 10 +/Times-Italic@0 SF(DbTxnMgr)108 84 Q F0(\(3\)).73 E(May 3, 1998)280.585 +768 Q(7)203.585 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/mancxx.ps/DbLock.ps b/mozilla/db/man/mancxx.ps/DbLock.ps new file mode 100644 index 00000000000..b50486ee007 --- /dev/null +++ b/mozilla/db/man/mancxx.ps/DbLock.ps @@ -0,0 +1,315 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:34 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 2 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(DbLock \255 lock class)108 40.8 Q F0(SYNOPSIS)72 57.6 Q/F2 10 +/Times-Bold@0 SF(#include )108 69.6 Q(int)108 93.6 Q +(DbLock::put\(DbLockT)108 105.6 Q(ab *lt\);)-.92 E(unsigned int)108 +129.6 Q(DbLock::get_lock_id\(\);)108 141.6 Q -.1(vo)108 165.6 S(id).1 E +(DbLock::set_lock_id\(unsigned int\);)108 177.6 Q +(DBLock::DbLock\(unsigned int\);)108 201.6 Q(DBLock::DbLock\(\);)108 +213.6 Q(DBLock::DbLock\(const DbLock &\);)108 225.6 Q +(DbLock &DBLock::operator = \(const DbLock &\);)108 237.6 Q F0 +(DESCRIPTION)72 254.4 Q F1 1.02(The DB library is a f)108 266.4 R 1.019 +(amily of classes that pro)-.1 F 1.019 +(vides a modular programming interf)-.15 F 1.019 +(ace to transactions and)-.1 F 1.377(record-oriented \214le access.)108 +278.4 R 1.378(The library includes support for transactions, locking, logging and \214le page) +6.377 F .443(caching, as well as v)108 290.4 R .443(arious inde)-.25 F +-.15(xe)-.15 G 2.943(da).15 G .442(ccess methods.)-2.943 F(Man)5.442 E +2.942(yo)-.15 G 2.942(ft)-2.942 G .442 +(he classes \(e.g., the \214le page caching class\))-2.942 F .4(are useful independent of the other DB classes, although some classes are e) +108 302.4 R .4(xplicitly based on other classes)-.15 F +(\(e.g., transactions and logging\).)108 314.4 Q -.15(Fo)5 G 2.5(rag).15 +G(eneral description of the DB package, see)-2.5 E/F3 10/Times-Italic@0 +SF(db_intr)2.5 E(o)-.45 E F1(\(3\).).18 E .504(This manual page describes the speci\214c details of the locking interf) +108 331.2 R 3.004(ace. The)-.1 F .504(DbLock class is used in con-)3.004 +F 1.121(junction with)108 343.2 R F3(DbLoc)3.621 E(kT)-.2 E(ab)-.92 E F1 +1.121(\(3\) to pro).23 F 1.121(vide general-purpose locking.)-.15 F +1.122(While designed to w)6.122 F 1.122(ork with the other)-.1 F .566(Db classes, these classes are also useful for more general locking purposes.) +108 355.2 R .566(Locks can be shared between)5.566 F 4.125 +(processes. In)108 367.2 R 1.626(most cases, when multiple threads or processes are using locking, the deadlock detector) +4.125 F(,)-.4 E F3(db_deadloc)108 379.2 Q(k)-.2 E F1 +(\(1\), should be run.).67 E F3(DbLoc)92 396 Q(k::put)-.2 E F1(The)108 +408 Q F3(DbLoc)3.843 E(k::put)-.2 E F1 1.343(method is a simple interf) +3.843 F 1.343(ace to the)-.1 F F3(DbLoc)3.843 E(kT)-.2 E(ab::vec)-.92 E +F1(functionality)3.843 E 3.843(,a)-.65 G 1.343(nd is equi)-3.843 F -.25 +(va)-.25 G 1.342(lent to).25 F 4.254(calling the)108 420 R F3(DbLoc) +6.754 E(kT)-.2 E(ab::vec)-.92 E F1 4.254(method with a single element) +6.754 F F3(list)6.755 E F1(array)6.755 E 6.755(,f)-.65 G 4.255 +(or which the)-6.755 F F3(op)6.755 E F1 4.255(\214eld is)6.755 F .335 +(DB_LOCK_PUT and the)108 432 R F3(loc)2.835 E(k)-.2 E F1 .335 +(\214eld is represented by the DbLock object.)2.835 F(The)5.335 E F3 +(DbLoc)2.835 E(k::put)-.2 E F1 .335(method returns)2.835 F +(success and f)108 444 Q(ailure as described for the)-.1 E F3(DbLoc)2.5 +E(kT)-.2 E(ab::vec)-.92 E F1(method.)2.5 E F3(DbLoc)92 460.8 Q(k::g)-.2 +E(et_loc)-.1 E(k_id)-.2 E F1(The)108 472.8 Q F3(DbLoc)2.846 E(k::g)-.2 E +(et_loc)-.1 E(k_id)-.2 E F1 .347 +(method gets the underlying representation of the lock id.)2.847 F .347 +(Direct manipulation of)5.347 F +(the underlying representation is not recommended.)108 484.8 Q F3(DbLoc) +92 501.6 Q(k::set_loc)-.2 E(k_id)-.2 E F1(The)108 513.6 Q F3(DbLoc)3.01 +E(k::set_loc)-.2 E(k_id)-.2 E F1 .51 +(method sets the underlying representation of the lock id.)3.01 F .51 +(Direct manipulation of)5.51 F 1.486 +(the underlying representation is not recommended.)108 525.6 R(Rather) +6.487 E(,)-.4 E F3(DbLoc)3.987 E(kT)-.2 E(ab::g)-.92 E(et)-.1 E F1 1.487 +(should be used to initialize)3.987 F .036(locks \(see)108 537.6 R F3 +(DbLoc)2.536 E(kT)-.2 E(ab)-.92 E F1 .036(\(3\)\), and the cop).23 F +2.536(yc)-.1 G .035 +(onstructor and assignment operators can be used to assign to other) +-2.536 F(DbLock objects.)108 549.6 Q F0(ERR)72 566.4 Q(ORS)-.27 E F1 +.049(Methods mark)108 578.4 R .049(ed as returning)-.1 F F3(errno)2.549 +E F1 .049(will, by def)2.549 F .049(ault, thro)-.1 F 2.549(wa)-.25 G +2.549(ne)-2.549 G .05(xception that encapsulates the error informa-) +-2.699 F 2.5(tion. The)108 590.4 R(def)2.5 E(ault error beha)-.1 E +(vior can be changed, see)-.2 E F3(DbException)2.5 E F1(\(3\).).24 E +(The)108 607.2 Q F3(DbLoc)2.5 E(k::put)-.2 E F1(method may f)2.5 E +(ail and thro)-.1 E 2.5(wa)-.25 G F3(DbException)A F1(\(3\)).24 E +(or return)108 631.2 Q F3(errno)2.5 E F1(for an)2.5 E 2.5(yo)-.15 G 2.5 +(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions:)-.25 E +(DbLock::detect\(3\), fcntl\(2\), f)108 643.2 Q +(\215ush\(3\), lseek\(2\), memcp)-.25 E +(y\(3\), memset\(3\), mmap\(2\), munmap\(2\), strerror\(3\),)-.1 E +(and write\(2\).)108 655.2 Q .113(In addition, the)108 672 R F3(DbLoc) +2.613 E(k::put)-.2 E F1 .113(method may f)2.613 F .113(ail and thro)-.1 +F 2.612(wa)-.25 G F3(DbException)A F1 .112(\(3\) or return).24 F F3 +(errno)2.612 E F1 .112(for the follo)2.612 F(wing)-.25 E(conditions:)108 +684 Q([EA)108 700.8 Q(CCES])-.4 E(An attempt w)133 712.8 Q +(as made to release lock held by another lock)-.1 E(er)-.1 E(.)-.55 E(1) +535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 376.64(DbLock\(3\) DbLock\(3\))72 48 R([EINV)108 +84 Q(AL])-1.35 E(An in)133 96 Q -.25(va)-.4 G(lid \215ag v).25 E +(alue or parameter w)-.25 E(as speci\214ed.)-.1 E/F1 9/Times-Bold@0 SF +-.09(BU)72 112.8 S(GS).09 E F0 .342 +(If a process dies while holding locks, those locks remain held and are) +108 124.8 R/F2 10/Times-Bold@0 SF(ne)2.843 E -.1(ve)-.15 G(r).1 E F0 +2.843(released. In)2.843 F .343(this case, all pro-)2.843 F +(cesses should e)108 136.8 Q(xit as quickly as possible, so that)-.15 E +/F3 10/Times-Italic@0 SF(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(can be run.) +2.5 E F1(SEE ALSO)72 153.6 Q F3(db_ar)108 165.6 Q -.15(ch)-.37 G(ive).15 +E F0(\(1\),).18 E F3(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F0(\(1\),).68 E +F3(db_deadloc)2.5 E(k)-.2 E F0(\(1\),).67 E F3(db_dump)2.5 E F0(\(1\),) +.19 E F3(db_load)2.5 E F0(\(1\),).77 E F3(db_r)2.5 E(eco)-.37 E(ver)-.1 +E F0(\(1\),).73 E F3(db_stat)2.5 E F0(\(1\),).68 E F3(db_intr)108 177.6 +Q(o)-.45 E F0(\(3\),).18 E F3(db_internal)2.5 E F0(\(3\),).51 E F3 +(db_thr)2.5 E(ead)-.37 E F0(\(3\),).77 E F3(Db)2.5 E F0(\(3\),).23 E F3 +(Dbc)2.5 E F0(\(3\),).31 E F3(DbEn)2.5 E(v)-.4 E F0(\(3\),).32 E F3 +(DbException)2.5 E F0(\(3\),).24 E F3(DbInfo)2.5 E F0(\(3\),).18 E F3 +(DbLoc)108 189.6 Q(k)-.2 E F0(\(3\),).67 E F3(DbLoc)2.5 E(kT)-.2 E(ab) +-.92 E F0(\(3\),).23 E F3(DbLo)2.5 E(g)-.1 E F0(\(3\),).22 E F3(DbLsn) +2.5 E F0(\(3\),).24 E F3(DbMpool)2.5 E F0(\(3\),).51 E F3(DbMpoolF)2.5 E +(ile)-.45 E F0(\(3\),).18 E F3(Dbt)2.5 E F0(\(3\),).68 E F3(DbTxn)2.5 E +F0(\(3\),).24 E F3(DbTxnMgr)108 201.6 Q F0(\(3\)).73 E(April 10, 1998) +276.695 768 Q(2)199.695 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/mancxx.ps/DbLockTab.ps b/mozilla/db/man/mancxx.ps/DbLockTab.ps new file mode 100644 index 00000000000..c301238703e --- /dev/null +++ b/mozilla/db/man/mancxx.ps/DbLockTab.ps @@ -0,0 +1,786 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:35 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 7 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(DbLockT)108 40.8 Q(ab \255 lock manager)-.8 E F0(SYNOPSIS)72 57.6 Q/F2 +10/Times-Bold@0 SF(#include )108 69.6 Q(static int)108 93.6 Q +(DbLockT)108 105.6 Q(ab::open\(const char *dir)-.92 E(,)-.92 E +(u_int32_t \215ags, int mode, DbEn)158 117.6 Q 2.5(v*)-.4 G(dben)-2.5 E +1.1 -.55(v, D)-.4 H(bLockT).55 E(ab **r)-.92 E(egionp\);)-.18 E(int)108 +141.6 Q(DbLockT)108 153.6 Q(ab::id\(u_int32_t *idp\);)-.92 E(int)108 +177.6 Q(DbLockT)108 189.6 Q(ab::v)-.92 E(ec\(u_int32_t lock)-.1 E(er)-.1 +E 2.5(,u)-.92 G(_int32_t \215ags,)-2.5 E +(DB_LOCKREQ list[], int nlist, DB_LOCKREQ **elistp\);)158 201.6 Q(int) +108 225.6 Q(DbLockT)108 237.6 Q(ab::get\(u_int32_t lock)-.92 E(er)-.1 E +2.5(,u)-.92 G(_int32_t \215ags,)-2.5 E +(const Dbt *obj, const db_lockmode_t lock_mode, DB_LOCK *lock\);)158 +249.6 Q(int)108 273.6 Q(DbLockT)108 285.6 Q(ab::close\(\);)-.92 E +(static int)108 309.6 Q(DbLockT)108 321.6 Q(ab::unlink\(const char *dir) +-.92 E 2.5(,i)-.92 G(nt f)-2.5 E(or)-.25 E(ce, DbEn)-.18 E 2.5(v*)-.4 G +(dben)-2.5 E(v\);)-.4 E(int)108 345.6 Q(DbLockT)108 357.6 Q +(ab::detect\(u_int32_t \215ags, u_int32_t atype\);)-.92 E F0 +(DESCRIPTION)72 374.4 Q F1 1.02(The DB library is a f)108 386.4 R 1.019 +(amily of classes that pro)-.1 F 1.019 +(vides a modular programming interf)-.15 F 1.019 +(ace to transactions and)-.1 F 1.377(record-oriented \214le access.)108 +398.4 R 1.378(The library includes support for transactions, locking, logging and \214le page) +6.377 F .443(caching, as well as v)108 410.4 R .443(arious inde)-.25 F +-.15(xe)-.15 G 2.943(da).15 G .442(ccess methods.)-2.943 F(Man)5.442 E +2.942(yo)-.15 G 2.942(ft)-2.942 G .442 +(he classes \(e.g., the \214le page caching class\))-2.942 F .4(are useful independent of the other DB classes, although some classes are e) +108 422.4 R .4(xplicitly based on other classes)-.15 F +(\(e.g., transactions and logging\).)108 434.4 Q -.15(Fo)5 G 2.5(rag).15 +G(eneral description of the DB package, see)-2.5 E/F3 10/Times-Italic@0 +SF(db_intr)2.5 E(o)-.45 E F1(\(3\).).18 E(This manual page describes the speci\214c details of the locking interf) +108 451.2 Q(ace.)-.1 E(The)108 468 Q F3(DbLoc)3.856 E(kT)-.2 E(ab)-.92 E +F1 1.356(class is intended to pro)3.856 F 1.356 +(vide general-purpose locking.)-.15 F 1.355(While designed to w)6.356 F +1.355(ork with the)-.1 F .352(other Db classes, this class is also useful for more general locking purposes.) +108 480 R .352(Locks can be shared between)5.352 F 4.483(processes. In) +108 492 R 1.983(most cases, when multiple treads or processes are using locking, the deadlock detector) +4.483 F(,)-.4 E F3(db_deadloc)108 504 Q(k)-.2 E F1 +(\(1\), should be run.).67 E F3(DbLoc)92 520.8 Q(kT)-.2 E(ab::open)-.92 +E F1(The)108 532.8 Q F3(DbLoc)3.452 E(kT)-.2 E(ab::open)-.92 E F1 .952 +(method copies a pointer)3.452 F 3.452(,t)-.4 G 3.452(ot)-3.452 G .953 +(he lock table identi\214ed by the)-3.452 F F2(dir)3.453 E(ectory)-.18 E +F3(dir)3.453 E F1 3.453(,i).73 G .953(nto the)-3.453 F +(memory location referenced by)108 544.8 Q F3 -.37(re)2.5 G(gionp)-.03 E +F1(.).19 E 2.07(If the)108 561.6 R F3(dben)4.57 E(v)-.4 E F1(ar)4.57 E +2.07(gument to)-.18 F F3(DbLoc)4.57 E(kT)-.2 E(ab::open)-.92 E F1 -.1 +(wa)4.57 G 4.57(si).1 G 2.07(nitialized using)-4.57 F F3(DbEn)4.57 E +(v::appinit)-.4 E F1(,).68 E F3(dir)4.57 E F1 2.07(is interpreted as) +4.57 F(described by)108 573.6 Q F3(DbEn)2.5 E(v)-.4 E F1(\(3\).).32 E +.667(Otherwise, if)108 590.4 R F3(dir)3.167 E F1 .668 +(is not NULL, it is interpreted relati)3.167 F .968 -.15(ve t)-.25 H +3.168(ot).15 G .668(he current w)-3.168 F .668 +(orking directory of the process.)-.1 F(If)5.668 E F3(dir)108 602.4 Q F1 +2.388(is NULL, the follo)4.888 F 2.388(wing en)-.25 F 2.388(vironment v) +-.4 F 2.388(ariables are check)-.25 F 2.387(ed in order: `)-.1 F +(`TMPDIR')-.74 E 2.387(', `)-.74 F(`TEMP')-.74 E 2.387(', and)-.74 F +-.74(``)108 614.4 S(TMP').74 E 3.268('. If)-.74 F .768 +(one of them is set, lock table \214les are created relati)3.268 F 1.068 +-.15(ve t)-.25 H 3.268(ot).15 G .768(he directory it speci\214es.)-3.268 +F .768(If none of)5.768 F 1.501 +(them are set, the \214rst possible one of the follo)108 626.4 R 1.5 +(wing directories is used:)-.25 F F3(/var/tmp)4 E F1(,).19 E F3 +(/usr/tmp)4 E F1(,).19 E F3(/temp)4 E F1(,).19 E F3(/tmp)4 E F1(,).19 E +F3(C:/temp)108 638.4 Q F1(and)2.5 E F3(C:/tmp)2.5 E F1(.).19 E .316(All \214les associated with the lock table are created in this directory) +108 655.2 R 5.316(.T)-.65 G .316(his directory must already e)-5.316 F +.316(xist when)-.15 F(DbLockT)108 667.2 Q .645(ab::open is called.)-.8 F +.645(If the lock table already e)5.645 F .645 +(xists, the process must ha)-.15 F .945 -.15(ve p)-.2 H .645 +(ermission to read and).15 F(write the e)108 679.2 Q(xisting \214les.) +-.15 E(If the lock table does not already e)5 E +(xist, it is optionally created and initialized.)-.15 E(The)108 696 Q F3 +<8d61>3.76 E(gs)-.1 E F1(and)3.76 E F3(mode)3.76 E F1(ar)3.76 E 1.26 +(guments specify ho)-.18 F 3.761<778c>-.25 G 1.261 +(les will be opened and/or created when the)-3.761 F 3.761(yd)-.15 G +(on')-3.761 E 3.761(ta)-.18 G(lready)-3.761 E -.15(ex)108 708 S 2.5 +(ist. The).15 F(\215ags v)2.5 E(alue is speci\214ed by)-.25 E F2(or)2.5 +E F1('ing together one or more of the follo)A(wing v)-.25 E(alues:)-.25 +E(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DbLockT)72 48 Q 347.14(ab\(3\) DbLockT)-.8 F +(ab\(3\))-.8 E(DB_CREA)108 84 Q(TE)-1.11 E .484(Create an)133 96 R 2.984 +(yu)-.15 G .483(nderlying \214les, as necessary)-2.984 F 5.483(.I)-.65 G +2.983(ft)-5.483 G .483(he \214les do not already e)-2.983 F .483 +(xist and the DB_CREA)-.15 F .483(TE \215ag)-1.11 F +(is not speci\214ed, the call will f)133 108 Q(ail.)-.1 E(DB_THREAD)108 +136.8 Q 1.182(Cause the DbLockT)133 148.8 R 1.182 +(ab handle returned by the)-.8 F/F1 10/Times-Italic@0 SF(DbLoc)3.682 E +(kT)-.2 E(ab::open)-.92 E F0 1.183(method to be useable by multiple) +3.682 F(threads within a single address space, i.e., to be `)133 160.8 Q +(`free-threaded')-.74 E('.)-.74 E .528 +(All \214les created by the lock subsystem are created with mode)108 +177.6 R F1(mode)3.028 E F0 .527(\(as described in)3.027 F F1 -.15(ch) +3.027 G(mod).15 E F0 .527(\(2\)\) and modi-).77 F .816 +(\214ed by the process' umask v)108 189.6 R .816 +(alue at the time of creation \(see)-.25 F F1(umask)3.317 E F0 3.317 +(\(2\)\). The).67 F .817(group o)3.317 F .817(wnership of created)-.25 F +(\214les is based on the system and directory def)108 201.6 Q +(aults, and is not further speci\214ed by DB.)-.1 E .2 +(The locking subsystem is con\214gured based on which set methods ha)108 +218.4 R .499 -.15(ve b)-.2 H .199(een used.).15 F .199(It is e)5.199 F +.199(xpected that appli-)-.15 F .913(cations will use a single DbEn)108 +230.4 R 3.413(vo)-.4 G .913(bject as the ar)-3.413 F .913 +(gument to all of the subsystems in the DB package.)-.18 F(The)5.914 E +1.346(\214elds of the DbEn)108 242.4 R 3.846(vo)-.4 G 1.346 +(bject used by)-3.846 F F1(DbLoc)3.846 E(kT)-.2 E(ab::open)-.92 E F0 +1.346(are described belo)3.846 F 5.146 -.65(w. A)-.25 H 3.846(sr).65 G +1.346(eferences to the DbEn)-3.846 F(v)-.4 E .343 +(object may be maintained by)108 254.4 R F1(DbLoc)2.844 E(kT)-.2 E +(ab::open)-.92 E F0 2.844(,i).24 G 2.844(ti)-2.844 G 2.844(sn)-2.844 G +.344(ecessary that the DbEn)-2.844 F 2.844(vo)-.4 G .344 +(bject and memory it refer)-2.844 F(-)-.2 E .446(ences be v)108 266.4 R +.446(alid until the object is destro)-.25 F 2.946(yed. An)-.1 F 2.946 +(yo)-.15 G 2.946(ft)-2.946 G .446(he DbEn)-2.946 F 2.946<768c>-.4 G .446 +(elds that are not e)-2.946 F .445(xplicitly set will def)-.15 F(ault) +-.1 E(to appropriate v)108 278.4 Q(alues.)-.25 E .516(The follo)108 +295.2 R .516(wing \214elds in the DbEn)-.25 F 3.016(vo)-.4 G .516(bject may be initialized, using the appropriate set method, before call-) +-3.016 F(ing)108 307.2 Q F1(DbLoc)2.5 E(kT)-.2 E(ab::open)-.92 E F0(:) +.24 E -.2(vo)108 336 S(id *\(*db_errcall\)\(char *db_errpfx, char *b).2 +E(uf)-.2 E(fer\);)-.25 E(FILE *db_err\214le;)108 348 Q +(const char *db_errpfx;)108 360 Q(class ostream *db_error_stream;)108 +372 Q(int db_v)108 384 Q(erbose;)-.15 E(The error \214elds of the DbEn) +133 396 Q 2.5(vb)-.4 G(eha)-2.5 E .3 -.15(ve a)-.2 H 2.5(sd).15 G +(escribed for)-2.5 E F1(DbEn)2.5 E(v)-.4 E F0(\(3\).).32 E +(const u_int8_t lk_con\215icts[][];)108 412.8 Q(A)133 424.8 Q F1 +(lk_modes)2.5 E F0(by)2.5 E F1(lk_modes)2.5 E F0(array)2.5 E 5(.A)-.65 G +(non-0 v)-2.5 E(alue for the array element:)-.25 E +(lk_con\215icts[requested_mode][held_mode])183 448.8 Q 1.915 +(indicates that requested_mode and held_mode con\215ict.)133 472.8 R +1.914(The `)6.915 F(`not-granted')-.74 E 4.414('m)-.74 G 1.914 +(ode must be repre-)-4.414 F 1.618(sented by 0.)133 484.8 R(If)6.618 E +F1(lk_con\215icts)4.118 E F0 1.618(is NULL, the con\215icts array)4.118 +F F1(db_rw_con\215icts)4.118 E F0 1.618(is used; see the section)4.118 F +(belo)133 496.8 Q 2.5(we)-.25 G(ntitled `)-2.5 E(`ST)-.74 E(AND)-.93 E +(ARD LOCK MODES')-.4 E 2.5('f)-.74 G(or a description of that array)-2.5 +E(.)-.65 E(u_int32_t lk_detect;)108 513.6 Q 1.111 +(If non-0, speci\214es that the deadlock detector be run whene)133 525.6 +R -.15(ve)-.25 G 3.611(ra).15 G 1.11 +(lock con\215ict occurs, and speci\214es)-.001 F .269 +(which transaction should be aborted in the case of a deadlock.)133 +537.6 R(The)5.27 E F1(lk_detect)2.77 E F0 .27 +(\214eld must be set to one)2.77 F(of the follo)133 549.6 Q(wing v)-.25 +E(alues.)-.25 E(DB_LOCK_DEF)133 578.4 Q -.55(AU)-.74 G -.92(LT).55 G +(Use the def)158 590.4 Q(ault polic)-.1 E 2.5(ya)-.15 G 2.5(ss)-2.5 G +(peci\214ed in the)-2.5 E F1(db_deadloc)2.5 E(k)-.2 E F0 +(\(1\) man page.).67 E(DB_LOCK_OLDEST)133 619.2 Q +(Abort the oldest transaction.)158 631.2 Q(DB_LOCK_RANDOM)133 660 Q +(Abort a random transaction in)158 672 Q -.2(vo)-.4 G(lv).2 E +(ed in the deadlock.)-.15 E(DB_LOCK_Y)133 700.8 Q(OUNGEST)-.3 E +(Abort the youngest transaction.)158 712.8 Q(April 10, 1998)276.695 768 +Q(2)199.695 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DbLockT)72 48 Q 347.14(ab\(3\) DbLockT)-.8 F +(ab\(3\))-.8 E(u_int32_t lk_max;)108 84 Q .633 +(The maximum number of locks to be held or requested in the table.)133 +96 R .633(This v)5.633 F .632(alue is used by)-.25 F/F1 10 +/Times-Italic@0 SF(DbLoc)3.132 E(k-)-.2 E -.92(Ta)133 108 S(b::open).92 +E F0 .252(to estimate ho)2.752 F 2.752(wm)-.25 G .252 +(uch space to allocate for v)-2.752 F .252 +(arious lock-table data structures.)-.25 F(If)5.252 E F1(lk_max)2.752 E +F0(is)2.752 E(not e)133 120 Q(xplicitly set, a def)-.15 E(ault v)-.1 E +(alue is used.)-.25 E(u_int32_t lk_modes;)108 136.8 Q(The number of lock modes to be recognized by the lock table \(including) +108 153.6 Q 1.122(the `)133 165.6 R(`not-granted')-.74 E 3.622('m)-.74 G +3.622(ode\). If)-3.622 F F1(lk_modes)3.622 E F0 1.122(is 0, the v)3.622 +F 1.122(alue DB_LOCK_R)-.25 F 1.122(W_N is used; see belo)-.55 F 3.622 +(wf)-.25 G 1.122(or a)-3.622 F(description of that v)133 177.6 Q(alue.) +-.25 E(The)108 194.4 Q F1(DbLoc)3.313 E(kT)-.2 E(ab::open)-.92 E F0 .813 +(method thro)3.313 F .813(ws a)-.25 F F1(DbException)3.313 E F0 .813 +(\(3\) or returns the v).24 F .813(alue of)-.25 F F1(errno)3.313 E F0 +.813(on f)3.313 F .814(ailure and 0 on)-.1 F(success.)108 206.4 Q F1 +(DbLoc)92 223.2 Q(kT)-.2 E(ab::id)-.92 E F0(The)108 235.2 Q F1(DbLoc) +2.58 E(kT)-.2 E(ab::id)-.92 E F0 .08(method copies a lock)2.58 F .079 +(er ID, which is guaranteed to be unique in the speci\214ed lock table,) +-.1 F(into the memory location referenced by)108 247.2 Q F1(idp)2.5 E F0 +(.).19 E .434(The access methods \(see)108 264 R F1(Db::open)2.934 E F0 +(in)2.934 E F1(Db)2.934 E F0 .434(\(3\)\), generate a unique lock).23 F +.435(er ID for each \214le that is opened with)-.1 F 2.729 +(locking. During)108 276 R .229(Db access method operation, this lock) +2.729 F .229(er ID will be used for all lock calls unless a transac-)-.1 +F(tion identi\214er w)108 288 Q(as speci\214ed for the call, in which case the transaction ID speci\214ed is used for locking.) +-.1 E(The)108 304.8 Q F1(DbLoc)2.824 E(kT)-.2 E(ab::id)-.92 E F0 .324 +(method thro)2.824 F .324(ws a)-.25 F F1(DbException)2.824 E F0 .324 +(\(3\) or returns the v).24 F .324(alue of)-.25 F F1(errno)2.824 E F0 +.324(on f)2.824 F .324(ailure and 0 on suc-)-.1 F(cess.)108 316.8 Q F1 +(DbLoc)92 345.6 Q(kT)-.2 E(ab::vec)-.92 E F0(The)108 357.6 Q F1(DbLoc) +3.543 E(kT)-.2 E(ab::vec)-.92 E F0 1.042(method atomically obtains and releases one or more locks from the speci\214ed table.) +3.543 F(The)108 369.6 Q F1(DbLoc)2.914 E(kT)-.2 E(ab::vec)-.92 E F0 .415 +(method is intended to support acquisition or trading of multiple locks under one lock) +2.914 F(table semaphore, as is needed for lock coupling or in multigranularity locking for lock escalation.) +108 381.6 Q(The)108 398.4 Q F1(loc)3.217 E -.1(ke)-.2 G(r).1 E F0(ar) +3.217 E .717(gument speci\214ed to)-.18 F F1(DbLoc)3.217 E(kT)-.2 E +(ab::vec)-.92 E F0 .716(is an unsigned 32-bit inte)3.217 F .716 +(ger quantity)-.15 F 5.716(.I)-.65 G 3.216(tr)-5.716 G .716 +(epresents the)-3.216 F(entity requesting or releasing the lock.)108 +410.4 Q(The)108 427.2 Q F1<8d61>2.5 E(gs)-.1 E F0 -.25(va)2.5 G +(lue must be set to 0 or the follo).25 E(wing v)-.25 E(alue:)-.25 E +(DB_LOCK_NO)108 456 Q -1.2(WA)-.35 G(IT)1.2 E .191(If a lock cannot be granted because the requested lock con\215icts with an e) +133 468 R .192(xisting lock, return immedi-)-.15 F(ately instead of w) +133 480 Q(aiting for the lock to become a)-.1 E -.25(va)-.2 G(ilable.) +.25 E(The)108 496.8 Q F1(list)2.868 E F0 .368(array pro)2.868 F .368 +(vided to)-.15 F F1(DbLoc)2.868 E(kT)-.2 E(ab::vec)-.92 E F0 .368 +(is typedef)2.868 F 1.368 -.5('d i).55 H 2.868(n<).5 G .367 +(db_cxx.h> as DB_LOCKREQ.)-2.868 F 2.867(AD)5.367 G(B_LOCK-)-2.867 E +(REQ structure has at least the follo)108 508.8 Q +(wing \214elds, which must be initialized before calling)-.25 E F1 +(DbLoc)2.5 E(kT)-.2 E(ab::vec)-.92 E F0(:).31 E(lock)108 525.6 Q +(op_t op;)-.1 E +(The operation to be performed, which must be set to one of the follo) +133 537.6 Q(wing v)-.25 E(alues:)-.25 E(DB_LOCK_GET)133 566.4 Q 1.717 +(Get a lock, as de\214ned by the v)158 578.4 R 1.717(alues of)-.25 F F1 +(loc)4.217 E -.1(ke)-.2 G(r).1 E F0(,).73 E F1(obj)4.217 E F0(and)4.217 +E F1(mode)4.217 E F0 6.717(.U).18 G 1.717(pon return from)-6.717 F F1 +(DbLoc)4.217 E(k-)-.2 E -.92(Ta)158 590.4 S(b::vec).92 E F0 2.96(,i).31 +G 2.96(ft)-2.96 G(he)-2.96 E F1(loc)2.96 E(k)-.2 E F0 .459 +(\214eld is non-NULL, a reference to the acquired lock is stored there.) +2.96 F(\(This)5.459 E .623(reference is in)158 602.4 R -.25(va)-.4 G +.624(lidated by an).25 F 3.124(yc)-.15 G .624(all to)-3.124 F F1(DbLoc) +3.124 E(kT)-.2 E(ab::vec)-.92 E F0(or)3.124 E F1(DbLoc)3.124 E(k::put) +-.2 E F0 .624(that releases the lock.\))3.124 F(See)158 614.4 Q F1 +(DbLoc)2.5 E(k)-.2 E F0(\(3\).).67 E(DB_LOCK_PUT)133 643.2 Q +(The lock referenced by the contents of the)158 655.2 Q F1(loc)2.5 E(k) +-.2 E F0(\214eld is released.)2.5 E(DB_LOCK_PUT_ALL)133 684 Q .759 +(All locks held by the)158 696 R F1(loc)3.259 E -.1(ke)-.2 G(r).1 E F0 +.759(are released.)3.259 F(\(An)5.759 E 3.259(yl)-.15 G .759 +(ocks acquired as a part of the current call to)-3.259 F F1(DbLoc)158 +708 Q(kT)-.2 E(ab::vec)-.92 E F0 .62(that appear after the DB_LOCK_PUT_ALL entry are not considered for this) +3.12 F(operation\).)158 720 Q(April 10, 1998)276.695 768 Q(3)199.695 E +EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DbLockT)72 48 Q 347.14(ab\(3\) DbLockT)-.8 F +(ab\(3\))-.8 E(DB_LOCK_PUT_OBJ)133 84 Q 1.41(All locks held by the)158 +96 R/F1 10/Times-Italic@0 SF(loc)3.91 E -.1(ke)-.2 G(r).1 E F0 3.91(,o) +.73 G 3.909(nt)-3.91 G 1.409(he object)-3.909 F F1(obj)3.909 E F0 3.909 +(,w).48 G 1.409(ith the mode speci\214ed by)-3.909 F F1(loc)3.909 E +(k_mode)-.2 E F0 3.909(,a).18 G(re)-3.909 E 4.276(released. A)158 108 R +F1(loc)4.276 E(k_mode)-.2 E F0 1.776 +(of DB_LOCK_NG indicates that all locks on the object should be)4.276 F +3.966(released. Note)158 120 R 1.466(that an)3.966 F 3.966(yl)-.15 G +1.465(ocks acquired as a part of the current call to)-3.966 F F1(DbLoc) +3.965 E(kT)-.2 E(ab::vec)-.92 E F0(that)3.965 E 1.082(occur before the DB_LOCK_PUT_OBJ will also be released; those acquired afterw) +158 132 R 1.082(ards will)-.1 F(not be released.)158 144 Q +(const Dbt obj;)108 160.8 Q +(An untyped byte string that speci\214es the object to be lock)133 172.8 +Q(ed or released.)-.1 E(const lockmode_t mode;)108 189.6 Q +(The lock mode, used as an inde)133 201.6 Q 2.5(xi)-.15 G(nto object') +-2.5 E 2.5(sc)-.55 G(on\215ict array)-2.5 E(.)-.65 E(DB_LOCK lock;)108 +218.4 Q 2.5(Al)133 230.4 S(ock reference.)-2.5 E(The)108 247.2 Q F1 +(nlist)2.5 E F0(ar)2.5 E +(gument speci\214es the number of elements in the)-.18 E F1(list)2.5 E +F0(array)2.5 E(.)-.65 E .51(If an)108 264 R 3.01(yo)-.15 G 3.01(ft)-3.01 +G .51(he requested locks cannot be acquired, or an)-3.01 F 3.01(yo)-.15 +G 3.01(ft)-3.01 G .51(he locks to be released cannot be released, the) +-3.01 F .291(operations before the f)108 276 R .292 +(ailing operation are guaranteed to ha)-.1 F .592 -.15(ve c)-.2 H .292 +(ompleted successfully).15 F 2.792(,a)-.65 G(nd)-2.792 E F1(DbLoc)2.792 +E(kT)-.2 E(ab::vec)-.92 E F0 .632(returns a non-zero v)108 288 R 3.132 +(alue. In)-.25 F .632(addition, if)3.132 F F1(elistp)3.132 E F0 .631 +(is not NULL, it is set to point to the DB_LOCKREQ entry)3.132 F(that w) +108 300 Q(as being processed when the error occurred.)-.1 E +(In the case of an error)108 316.8 Q(,)-.4 E F1(DbLoc)2.5 E(kT)-.2 E +(ab::vec)-.92 E F0(may return one of the follo)2.5 E(wing v)-.25 E +(alues:)-.25 E(DB_LOCK_DEADLOCK)108 345.6 Q(The speci\214ed)133 357.6 Q +F1(loc)2.5 E -.1(ke)-.2 G(r).1 E F0 -.1(wa)2.5 G 2.5(ss).1 G +(elected as a victim in order to resolv)-2.5 E 2.5(ead)-.15 G(eadlock.) +-2.5 E(DB_LOCK_NO)108 386.4 Q(THELD)-.4 E +(The lock cannot be released, as it w)133 398.4 Q(as not held by the)-.1 +E F1(loc)2.5 E -.1(ke)-.2 G(r).1 E F0(.).73 E(DB_LOCK_NO)108 427.2 Q +(TGRANTED)-.4 E 8.232(Al)133 439.2 S 5.732(ock w)-8.232 F 5.732 +(as requested that could not be granted and the)-.1 F F1<8d61>8.232 E(g) +-.1 E F0 5.732(parameter w)8.232 F 5.732(as set to)-.1 F(DB_LOCK_NO)133 +451.2 Q -1.2(WA)-.35 G(IT)1.2 E 5(.I)-.74 G 2.5(nt)-5 G +(his case, if non-NULL,)-2.5 E F1(elistp)2.5 E F0 +(identi\214es the request that w)2.5 E(as granted.)-.1 E .95 +(Otherwise, the)108 468 R F1(DbLoc)3.45 E(kT)-.2 E(ab::vec)-.92 E F0 .95 +(method thro)3.45 F .95(ws a)-.25 F F1(DbException)3.45 E F0 .95 +(\(3\) or returns the v).24 F .95(alue of)-.25 F F1(errno)3.45 E F0 .95 +(on f)3.45 F(ailure)-.1 E(and 0 on success.)108 480 Q F1(DbLoc)92 508.8 +Q(kT)-.2 E(ab::g)-.92 E(et)-.1 E F0(The)108 520.8 Q F1(DbLoc)2.5 E(kT) +-.2 E(ab::g)-.92 E(et)-.1 E F0(method is a simple interf)2.5 E +(ace to the)-.1 E F1(DbLoc)108 544.8 Q(kT)-.2 E(ab::vec)-.92 E F0 +(functionality)2.5 E 2.5(,a)-.65 G(nd is equi)-2.5 E -.25(va)-.25 G +(lent to calling the).25 E F1(DbLoc)108 568.8 Q(kT)-.2 E(ab::vec)-.92 E +F0 .71(method with the)3.21 F F1(loc)3.21 E -.1(ke)-.2 G(r).1 E F0(ar) +3.211 E(gument,)-.18 E F1(elistp)3.211 E F0(and)3.211 E F1(con\215ict) +3.211 E F0(ar)3.211 E .711(guments, and a single element)-.18 F F1(list) +3.211 E F0(array)108 580.8 Q 2.831(,f)-.65 G .331(or which the)-2.831 F +F1(op)2.831 E F0 .331(\214eld is DB_LOCK_GET)2.831 F 2.831(,a)-.74 G +.331(nd the)-2.831 F F1(obj)2.831 E F0(,).48 E F1(loc)2.83 E(k_mode)-.2 +E F0(and)2.83 E F1(loc)2.83 E(k)-.2 E F0 .33 +(\214elds are represented by)2.83 F 1.16(the ar)108 592.8 R 1.16 +(guments of the same name.)-.18 F 1.161(Note that the type of the)6.16 F +F1(obj)3.661 E F0(ar)3.661 E 1.161(gument to)-.18 F F1(DbLoc)3.661 E(kT) +-.2 E(ab::g)-.92 E(et)-.1 E F0 1.161(is dif)3.661 F(ferent)-.25 E .445 +(from the)108 604.8 R F1(obj)2.945 E F0 .445 +(element found in the DB_LOCKREQ structure.)2.945 F(The)5.444 E F1 +(DbLoc)2.944 E(kT)-.2 E(ab::g)-.92 E(et)-.1 E F0 .444 +(method returns success)2.944 F(and f)108 616.8 Q +(ailure as described for the)-.1 E F1(DbLoc)108 640.8 Q(kT)-.2 E +(ab::vec)-.92 E F0(method.)2.5 E F1(DbLoc)92 657.6 Q(kT)-.2 E(ab::close) +-.92 E F0(The)108 669.6 Q F1(DbLoc)2.806 E(kT)-.2 E(ab::close)-.92 E F0 +.306(method disassociates the calling process from the lock table.)2.806 +F .307(The object should not)5.307 F .045 +(be used after a call to close.)108 681.6 R .044(Note that)5.044 F F1 +(DbLoc)2.544 E(kT)-.2 E(ab::close)-.92 E F0 .044(does not release an) +2.544 F 2.544(yl)-.15 G .044(ocks still held by the closing)-2.544 F 2.5 +(process. \(This)108 693.6 R(pro)2.5 E(vides functionality for long-li) +-.15 E -.15(ve)-.25 G 2.5(dl).15 G(ocks.\))-2.5 E .985 +(Processes that wish to ha)108 717.6 R 1.285 -.15(ve a)-.2 H .986 +(ll their locks released can do so by issuing the appropriate).15 F F1 +(DbLoc)3.486 E(kT)-.2 E(ab::vec)-.92 E F0(call.)108 729.6 Q +(April 10, 1998)276.695 768 Q(4)199.695 E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DbLockT)72 48 Q 347.14(ab\(3\) DbLockT)-.8 F +(ab\(3\))-.8 E 2.226(In addition, if the)108 84 R/F1 10/Times-Italic@0 +SF(dir)4.726 E F0(ar)4.726 E 2.226(gument to)-.18 F F1(DbLoc)4.726 E(kT) +-.2 E(ab::open)-.92 E F0 -.1(wa)4.726 G 4.726(sN).1 G 2.226(ULL and) +-4.726 F F1(dben)4.726 E(v)-.4 E F0 -.1(wa)4.726 G 4.726(sn).1 G 2.226 +(ot initialized using)-4.726 F F1(DbEn)108 96 Q(v::appinit)-.4 E F0 +4.248(,a).68 G 1.748(ll \214les created for this shared re)-4.248 F +1.749(gion will be remo)-.15 F -.15(ve)-.15 G 1.749(d, as if).15 F F1 +(DbLoc)4.249 E(kT)-.2 E(ab::unlink)-.92 E F0(were)4.249 E(called.)108 +108 Q 1.532(When multiple threads are using the DbLockT)108 124.8 R +1.531(ab object concurrently)-.8 F 4.031(,o)-.65 G 1.531 +(nly a single thread may call the)-4.031 F F1(DbLoc)108 136.8 Q(kT)-.2 E +(ab::close)-.92 E F0(method.)2.5 E(The)108 153.6 Q F1(DbLoc)3.243 E(kT) +-.2 E(ab::close)-.92 E F0 .743(method thro)3.243 F .743(ws a)-.25 F F1 +(DbException)3.244 E F0 .744(\(3\) or returns the v).24 F .744(alue of) +-.25 F F1(errno)3.244 E F0 .744(on f)3.244 F .744(ailure and 0 on)-.1 F +(success.)108 165.6 Q F1(DbLoc)92 194.4 Q(kT)-.2 E(ab::unlink)-.92 E F0 +(The)108 206.4 Q F1(DbLoc)3.624 E(kT)-.2 E(ab::unlink)-.92 E F0 1.124 +(method destro)3.624 F 1.124 +(ys the lock table identi\214ed by the directory)-.1 F F1(dir)3.623 E F0 +3.623(,r).73 G(emo)-3.623 E 1.123(ving all \214les)-.15 F .029 +(used to implement the lock table.)108 218.4 R .029(\(The directory) +5.029 F F1(dir)2.529 E F0 .029(is not remo)2.529 F -.15(ve)-.15 G 2.529 +(d.\) If).15 F .029(there are processes that ha)2.529 F .329 -.15(ve c) +-.2 H(alled).15 E F1(DbLoc)108 230.4 Q(kT)-.2 E(ab::open)-.92 E F0 2.312 +(without calling)4.812 F F1(DbLoc)4.812 E(kT)-.2 E(ab::close)-.92 E F0 +2.312(\(i.e., there are processes currently using the lock)4.812 F +(table\),)108 242.4 Q F1(DbLoc)4.866 E(kT)-.2 E(ab::unlink)-.92 E F0 +2.366(will f)4.866 F 2.367(ail without further action, unless the force \215ag is set, in which case) +-.1 F F1(DbLoc)108 254.4 Q(kT)-.2 E(ab::unlink)-.92 E F0 1.199 +(will attempt to remo)3.699 F 1.499 -.15(ve t)-.15 H 1.199 +(he lock table \214les re).15 F -.05(ga)-.15 G 1.199(rdless of an).05 F +3.698(yp)-.15 G 1.198(rocesses still using the)-3.698 F(lock table.)108 +266.4 Q .766(The result of attempting to forcibly destro)108 283.2 R +3.266(yt)-.1 G .766(he re)-3.266 F .766(gion when a process has the re) +-.15 F .766(gion open is unspeci\214ed.)-.15 F 1.232 +(Processes using a shared memory re)108 295.2 R 1.232 +(gion maintain an open \214le descriptor for it.)-.15 F 1.231 +(On UNIX systems, the)6.232 F(re)108 307.2 Q .473(gion remo)-.15 F -.25 +(va)-.15 G 2.973(ls).25 G .473(hould succeed and processes that ha) +-2.973 F .773 -.15(ve a)-.2 H .473(lready joined the re).15 F .473 +(gion should continue to run in)-.15 F .338(the re)108 319.2 R .337 +(gion without change, ho)-.15 F(we)-.25 E -.15(ve)-.25 G 2.837(rp).15 G +.337(rocesses attempting to join the lock table will either f)-2.837 F +.337(ail or attempt to)-.1 F .449(create a ne)108 331.2 R 2.949(wr)-.25 +G -.15(eg)-2.949 G 2.949(ion. On).15 F .449(other systems, e.g., WNT) +2.949 F 2.949(,w)-.74 G .449(here the)-2.949 F F1(unlink)2.95 E F0 .45 +(\(2\) system call will f).67 F .45(ail if an)-.1 F 2.95(yp)-.15 G +(rocess)-2.95 E(has an open \214le descriptor for the \214le, the re)108 +343.2 Q(gion remo)-.15 E -.25(va)-.15 G 2.5(lw).25 G(ill f)-2.5 E(ail.) +-.1 E .93(In the case of catastrophic or system f)108 360 R .929 +(ailure, database reco)-.1 F -.15(ve)-.15 G .929 +(ry must be performed \(see).15 F F1(db_r)3.429 E(eco)-.37 E(ver)-.1 E +F0 .929(\(1\) or).73 F .439(the DB_RECO)108 372 R .439(VER and DB_RECO) +-.5 F(VER_F)-.5 E -1.21 -1.11(AT A)-.74 H 2.939<4c8d>1.11 G .439(ags to) +-2.939 F F1(DbEn)2.939 E(v::appinit)-.4 E F0 2.939(\(3\)\). Alternati) +.68 F -.15(ve)-.25 G(ly).15 E 2.939(,i)-.65 G 2.939(fr)-2.939 G(eco) +-2.939 E -.15(ve)-.15 G .439(ry is).15 F .027 +(not required because no database state is maintained across f)108 384 R +.027(ailures, it is possible to clean up a lock table by)-.1 F(remo)108 +396 Q .816(ving all of the \214les in the directory speci\214ed to the) +-.15 F F1(DbLoc)3.317 E(kT)-.2 E(ab::open)-.92 E F0 .817 +(method, as lock table \214les are)3.317 F(ne)108 408 Q -.15(ve)-.25 G +3.379(rc).15 G .879(reated in an)-3.379 F 3.379(yd)-.15 G .879 +(irectory other than the one speci\214ed to)-3.379 F F1(DbLoc)3.378 E +(kT)-.2 E(ab::open)-.92 E F0 5.878(.N).24 G .878(ote, ho)-5.878 F(we) +-.25 E -.15(ve)-.25 G 1.678 -.4(r, t).15 H .878(hat this).4 F +(has the potential to remo)108 420 Q .3 -.15(ve \214)-.15 H +(les created by the other DB subsystems in this database en).15 E +(vironment.)-.4 E(The)108 436.8 Q F1(DbLoc)2.965 E(kT)-.2 E(ab::unlink) +-.92 E F0 .465(method thro)2.965 F .465(ws a)-.25 F F1(DbException)2.965 +E F0 .466(\(3\) or returns the v).24 F .466(alue of)-.25 F F1(errno) +2.966 E F0 .466(on f)2.966 F .466(ailure and 0 on)-.1 F(success.)108 +448.8 Q F1(DbLoc)92 465.6 Q(kT)-.2 E(ab::detect)-.92 E F0(The)108 477.6 +Q F1(DbLoc)3.214 E(kT)-.2 E(ab::detect)-.92 E F0 .714(method runs one iteration of the deadlock detector on the current lock table.) +3.214 F(The)5.714 E .078(deadlock detector tra)108 489.6 R -.15(ve)-.2 G +.078(rses the lock table, detects deadlocks, and if it \214nds one, marks one of the participat-) +.15 F(ing transactions for abort and then returns.)108 501.6 Q +(The \215ags v)108 518.4 Q(alue is speci\214ed by)-.25 E/F2 10 +/Times-Bold@0 SF(or)2.5 E F0('ing together one or more of the follo)A +(wing v)-.25 E(alues:)-.25 E(DB_LOCK_CONFLICT)108 552 Q .988(Only run the deadlock detector if a lock con\215ict has occurred since the last time that the deadlock) +133 564 R(detector w)133 576 Q(as run.)-.1 E(The)108 592.8 Q F1(atype) +3.18 E F0 .68(parameter speci\214es which transaction to abort in the case of deadlock.) +3.18 F .68(It must be set to one of)5.68 F -.25(va)108 604.8 S +(lues described abo).25 E .3 -.15(ve f)-.15 H(or the).15 E F1(lk_detect) +2.5 E F0(\214eld of the)2.5 E F1(DbEn)2.5 E(v)-.4 E F0(object.)2.5 E +(The)108 621.6 Q F1(DbLoc)3.036 E(kT)-.2 E(ab::detect)-.92 E F0 .536 +(method thro)3.036 F .536(ws a)-.25 F F1(DbException)3.036 E F0 .536 +(\(3\) or returns the v).24 F .536(alue of)-.25 F F1(errno)3.035 E F0 +.535(on f)3.035 F .535(ailure and 0 on)-.1 F(success.)108 633.6 Q(The) +108 650.4 Q F1(DbLoc)3.594 E(kT)-.2 E(ab::detect)-.92 E F0 1.094 +(method is based on the C)3.594 F F1(loc)3.594 E(k_detect)-.2 E F0 1.095 +(function, which is the underlying function)3.594 F .137(used by the)108 +662.4 R F1(db_deadloc)2.637 E(k)-.2 E F0 .137(\(1\) utility).67 F 5.137 +(.S)-.65 G .137(ee the source code for the)-5.137 F F1(db_deadloc)2.636 +E(k)-.2 E F0 .136(utility for an e)2.636 F .136(xample of using)-.15 F +F1(loc)108 674.4 Q(k_detect)-.2 E F0(in a UNIX en)2.5 E(vironment.)-.4 E +/F3 9/Times-Bold@0 SF(ENVIR)72 691.2 Q(ONMENT V)-.27 E(ARIABLES)-1.215 E +F0(The follo)108 703.2 Q(wing en)-.25 E(vironment v)-.4 E(ariables af) +-.25 E(fect the e)-.25 E -.15(xe)-.15 G(cution of).15 E F1(db_loc)2.5 E +(k)-.2 E F0(:).67 E(April 10, 1998)276.695 768 Q(5)199.695 E EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DbLockT)72 48 Q 347.14(ab\(3\) DbLockT)-.8 F +(ab\(3\))-.8 E(DB_HOME)108 84 Q 1.035(If the)133 96 R/F1 10 +/Times-Italic@0 SF(dben)3.535 E(v)-.4 E F0(ar)3.536 E 1.036(gument to) +-.18 F F1(DbLoc)3.536 E(kT)-.2 E(ab::open)-.92 E F0 -.1(wa)3.536 G 3.536 +(si).1 G 1.036(nitialized using)-3.536 F F1(db_appinit)3.536 E F0 3.536 +(,t).68 G 1.036(he en)-3.536 F 1.036(vironment v)-.4 F(ari-)-.25 E .342 +(able DB_HOME may be used as the path of the database home for the interpretation of the) +133 108 R F1(dir)2.841 E F0(ar)2.841 E(gu-)-.18 E(ment to)133 120 Q F1 +(DbLoc)2.5 E(kT)-.2 E(ab::open)-.92 E F0 2.5(,a).24 G 2.5(sd)-2.5 G +(escribed in)-2.5 E F1(db_appinit)2.5 E F0(\(3\).).68 E(TMPDIR)108 136.8 +Q .592(If the)133 148.8 R F1(dben)3.092 E(v)-.4 E F0(ar)3.092 E .592 +(gument to)-.18 F F1(DbLoc)3.092 E(kT)-.2 E(ab::open)-.92 E F0 -.1(wa) +3.092 G 3.092(sN).1 G .592(ULL or not initialized using)-3.092 F F1 +(db_appinit)3.092 E F0 3.093(,t).68 G .593(he en)-3.093 F(vi-)-.4 E 2.42 +(ronment v)133 160.8 R 2.419(ariable TMPDIR may be used as the directory in which to create the lock table, as) +-.25 F(described in the)133 172.8 Q F1(DbLoc)2.5 E(kT)-.2 E(ab::open) +-.92 E F0(section abo)2.5 E -.15(ve)-.15 G(.).15 E/F2 9/Times-Bold@0 SF +(ST)72 189.6 Q(AND)-.81 E(ARD LOCK MODES)-.315 E F0 +(The include \214le declares tw)108 201.6 Q 2.5(oc)-.1 G +(ommonly used con\215ict arrays:)-2.5 E +(const u_int8_t db_lock_rw_con\215icts[];)108 218.4 Q +(This is a con\215ict array for a simple scheme using shared and e)133 +230.4 Q(xclusi)-.15 E .3 -.15(ve l)-.25 H(ock modes.).15 E +(const u_int8_t db_lock_riw_con\215icts[];)108 247.2 Q .703 +(This is a con\215ict array that in)133 259.2 R -.2(vo)-.4 G(lv).2 E +.703(es v)-.15 F .703 +(arious intent lock modes \(e.g., intent shared\) that are used for)-.25 +F(multigranularity locking.)133 271.2 Q +(Their associated sizes are DB_LOCK_R)108 288 Q(W_N and DB_LOCK_RIW_N.) +-.55 E 1.598 +(In addition, the include \214le de\214nes the type)108 316.8 +R F1(db_loc)4.097 E(kmode_t)-.2 E F0 4.097(,w).68 G 1.597 +(hich is the type of the lock)-4.097 F +(modes used with the standard tables abo)108 328.8 Q -.15(ve)-.15 G(:) +.15 E(DB_LOCK_NG)144 357.6 Q(not granted \(al)169 369.6 Q -.1(wa)-.1 G +(ys 0\)).1 E(DB_LOCK_READ)144 398.4 Q(read \(shared\))169 410.4 Q +(DB_LOCK_WRITE)144 439.2 Q(write \(e)169 451.2 Q(xclusi)-.15 E -.15(ve) +-.25 G(\)).15 E F2(ERR)72 468 Q(ORS)-.27 E F0 .049(Methods mark)108 480 +R .049(ed as returning)-.1 F F1(errno)2.549 E F0 .049(will, by def)2.549 +F .049(ault, thro)-.1 F 2.549(wa)-.25 G 2.549(ne)-2.549 G .05 +(xception that encapsulates the error informa-)-2.699 F 2.5(tion. The) +108 492 R(def)2.5 E(ault error beha)-.1 E(vior can be changed, see)-.2 E +F1(DbException)2.5 E F0(\(3\).).24 E(The)108 508.8 Q F1(DbLoc)2.5 E(kT) +-.2 E(ab::open)-.92 E F0(method may f)2.5 E(ail and thro)-.1 E 2.5(wa) +-.25 G F1(DbException)A F0(\(3\)).24 E(or return)108 532.8 Q F1(errno) +2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions:)-.25 E +(DbLock::unlink\(3\), close\(2\), db_v)108 544.8 Q +(ersion\(3\), fcntl\(2\), f)-.15 E +(\215ush\(3\), lseek\(2\), malloc\(3\), memcp)-.25 E +(y\(3\), memset\(3\),)-.1 E(mmap\(2\), munmap\(2\), open\(2\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp) +108 556.8 Q(y\(3\), strdup\(3\), strerror\(3\),)-.1 E +(strlen\(3\), unlink\(2\), and write\(2\).)108 568.8 Q .293 +(In addition, the)108 585.6 R F1(DbLoc)2.793 E(kT)-.2 E(ab::open)-.92 E +F0 .294(method may f)2.793 F .294(ail and thro)-.1 F 2.794(wa)-.25 G F1 +(DbException)A F0 .294(\(3\) or return).24 F F1(errno)2.794 E F0 .294 +(for the fol-)2.794 F(lo)108 597.6 Q(wing conditions:)-.25 E([EA)108 +614.4 Q(GAIN])-.4 E(The shared memory re)133 626.4 Q(gion w)-.15 E +(as lock)-.1 E(ed and \(repeatedly\) una)-.1 E -.25(va)-.2 G(ilable.).25 +E([EINV)108 643.2 Q(AL])-1.35 E(An in)133 655.2 Q -.25(va)-.4 G +(lid \215ag v).25 E(alue or parameter w)-.25 E(as speci\214ed.)-.1 E +(The DB_THREAD \215ag w)133 679.2 Q(as speci\214ed and spinlocks are not implemented for this architecture.) +-.1 E(The)108 708 Q F1(DbLoc)2.5 E(kT)-.2 E(ab::vec)-.92 E F0 +(method may f)2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0 +(\(3\)).24 E(April 10, 1998)276.695 768 Q(6)199.695 E EP +%%Page: 7 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DbLockT)72 48 Q 347.14(ab\(3\) DbLockT)-.8 F +(ab\(3\))-.8 E(or return)108 84 Q/F1 10/Times-Italic@0 SF(errno)2.5 E F0 +(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions:)-.25 E +(DbLock::detect\(3\), fcntl\(2\), f)108 96 Q +(\215ush\(3\), lseek\(2\), memcp)-.25 E +(y\(3\), memset\(3\), mmap\(2\), munmap\(2\), strerror\(3\),)-.1 E +(and write\(2\).)108 108 Q .677(In addition, the)108 124.8 R F1(DbLoc) +3.177 E(kT)-.2 E(ab::vec)-.92 E F0 .676(method may f)3.177 F .676 +(ail and thro)-.1 F 3.176(wa)-.25 G F1(DbException)A F0 .676 +(\(3\) or return).24 F F1(errno)3.176 E F0 .676(for the fol-)3.176 F(lo) +108 136.8 Q(wing conditions:)-.25 E([EA)108 153.6 Q(CCES])-.4 E +(An attempt w)133 165.6 Q(as made to release lock held by another lock) +-.1 E(er)-.1 E(.)-.55 E([EINV)108 182.4 Q(AL])-1.35 E(An in)133 194.4 Q +-.25(va)-.4 G(lid \215ag v).25 E(alue or parameter w)-.25 E +(as speci\214ed.)-.1 E(The)108 211.2 Q F1(DbLoc)2.5 E(kT)-.2 E(ab::g) +-.92 E(et)-.1 E F0(method may f)2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G +F1(DbException)A F0(\(3\)).24 E(or return)108 235.2 Q F1(errno)2.5 E F0 +(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions:)-.25 E +(DbLock::detect\(3\), fcntl\(2\), f)108 247.2 Q +(\215ush\(3\), lseek\(2\), memcp)-.25 E +(y\(3\), memset\(3\), mmap\(2\), munmap\(2\), strerror\(3\),)-.1 E +(and write\(2\).)108 259.2 Q .751(In addition, the)108 276 R F1(DbLoc) +3.251 E(kT)-.2 E(ab::g)-.92 E(et)-.1 E F0 .751(method may f)3.251 F .751 +(ail and thro)-.1 F 3.251(wa)-.25 G F1(DbException)A F0 .751 +(\(3\) or return).24 F F1(errno)3.252 E F0 .752(for the fol-)3.252 F(lo) +108 288 Q(wing conditions:)-.25 E([EINV)108 304.8 Q(AL])-1.35 E(An in) +133 316.8 Q -.25(va)-.4 G(lid \215ag v).25 E(alue or parameter w)-.25 E +(as speci\214ed.)-.1 E(The)108 333.6 Q F1(DbLoc)2.5 E(kT)-.2 E +(ab::close)-.92 E F0(method may f)2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G +F1(DbException)A F0(\(3\)).24 E(or return)108 357.6 Q F1(errno)2.5 E F0 +(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: close\(2\), fcntl\(2\),)-.25 E -.25 +<668d>108 369.6 S(ush\(3\), munmap\(2\), and strerror\(3\).).25 E(The) +108 386.4 Q F1(DbLoc)2.5 E(kT)-.2 E(ab::unlink)-.92 E F0(method may f) +2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0(\(3\)).24 E +(or return)108 410.4 Q F1(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5 +(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: close\(2\), fcntl\(2\),)-.25 E -.25 +<668d>108 422.4 S(ush\(3\), malloc\(3\), memcp).25 E(y\(3\), memset\(3\), mmap\(2\), munmap\(2\), open\(2\), sig\214llset\(3\), sigprocmask\(2\),) +-.1 E(stat\(2\), strcp)108 434.4 Q +(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), and unlink\(2\).)-.1 E +1.072(In addition, the)108 451.2 R F1(DbLoc)3.572 E(kT)-.2 E(ab::unlink) +-.92 E F0 1.072(method may f)3.572 F 1.072(ail and thro)-.1 F 3.572(wa) +-.25 G F1(DbException)A F0 1.072(\(3\) or return).24 F F1(errno)3.572 E +F0 1.072(for the)3.572 F(follo)108 463.2 Q(wing conditions:)-.25 E([EB) +108 480 Q(USY])-.1 E(The shared memory re)133 492 Q(gion w)-.15 E +(as in use and the force \215ag w)-.1 E(as not set.)-.1 E(The)108 508.8 +Q F1(DbLoc)2.5 E(kT)-.2 E(ab::detect)-.92 E F0(method may f)2.5 E +(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0(\(3\)).24 E +(or return)108 532.8 Q F1(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5 +(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: calloc\(3\), fcntl\(2\),)-.25 E -.25 +<668d>108 544.8 S(ush\(3\), lseek\(2\), malloc\(3\), memcp).25 E(y\(3\), memset\(3\), mmap\(2\), munmap\(2\), strerror\(3\), and write\(2\).) +-.1 E/F2 9/Times-Bold@0 SF -.09(BU)72 561.6 S(GS).09 E F0 .342 +(If a process dies while holding locks, those locks remain held and are) +108 573.6 R/F3 10/Times-Bold@0 SF(ne)2.843 E -.1(ve)-.15 G(r).1 E F0 +2.843(released. In)2.843 F .343(this case, all pro-)2.843 F +(cesses should e)108 585.6 Q(xit as quickly as possible, so that)-.15 E +F1(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(can be run.)2.5 E F2(SEE ALSO)72 +602.4 Q F1(db_ar)108 614.4 Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E F1 +(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F0(\(1\),).68 E F1(db_deadloc)2.5 E +(k)-.2 E F0(\(1\),).67 E F1(db_dump)2.5 E F0(\(1\),).19 E F1(db_load)2.5 +E F0(\(1\),).77 E F1(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F1 +(db_stat)2.5 E F0(\(1\),).68 E F1(db_intr)108 626.4 Q(o)-.45 E F0 +(\(3\),).18 E F1(db_internal)2.5 E F0(\(3\),).51 E F1(db_thr)2.5 E(ead) +-.37 E F0(\(3\),).77 E F1(Db)2.5 E F0(\(3\),).23 E F1(Dbc)2.5 E F0 +(\(3\),).31 E F1(DbEn)2.5 E(v)-.4 E F0(\(3\),).32 E F1(DbException)2.5 E +F0(\(3\),).24 E F1(DbInfo)2.5 E F0(\(3\),).18 E F1(DbLoc)108 638.4 Q(k) +-.2 E F0(\(3\),).67 E F1(DbLoc)2.5 E(kT)-.2 E(ab)-.92 E F0(\(3\),).23 E +F1(DbLo)2.5 E(g)-.1 E F0(\(3\),).22 E F1(DbLsn)2.5 E F0(\(3\),).24 E F1 +(DbMpool)2.5 E F0(\(3\),).51 E F1(DbMpoolF)2.5 E(ile)-.45 E F0(\(3\),) +.18 E F1(Dbt)2.5 E F0(\(3\),).68 E F1(DbTxn)2.5 E F0(\(3\),).24 E F1 +(DbTxnMgr)108 650.4 Q F0(\(3\)).73 E(April 10, 1998)276.695 768 Q(7) +199.695 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/mancxx.ps/DbLog.ps b/mozilla/db/man/mancxx.ps/DbLog.ps new file mode 100644 index 00000000000..6939392bf08 --- /dev/null +++ b/mozilla/db/man/mancxx.ps/DbLog.ps @@ -0,0 +1,1010 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:35 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 10 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(DbLog \255 log management class)108 40.8 Q F0(SYNOPSIS)72 57.6 Q/F2 10 +/Times-Bold@0 SF(#include )108 69.6 Q(static int)108 93.6 Q +(DbLog::open\(const char *dir)108 105.6 Q(,)-.92 E +(u_int32_t \215ags, int mode, DbEn)158 117.6 Q 2.5(v*)-.4 G(dben)-2.5 E +1.1 -.55(v, D)-.4 H(bLog **r).55 E(egionp\);)-.18 E(int)108 141.6 Q +(DbLog::close\(\);)108 153.6 Q(int)108 177.6 Q +(DbLog::\215ush\(const DbLsn *lsn\);)108 189.6 Q(int)108 213.6 Q +(DbLog::get\(DbLsn *lsn, Dbt *data, u_int32_t \215ags\);)108 225.6 Q +(static int)108 249.6 Q(DbLog::compar)108 261.6 Q +(e\(const DbLsn *lsn0, const DbLsn *lsn1\);)-.18 E(int)108 285.6 Q +(DbLog::\214le\(const DbLsn *lsn, char *namep, size_t len\);)108 297.6 Q +(int)108 321.6 Q +(DbLog::put\(DbLsn *lsn, const Dbt *data, u_int32_t \215ags\);)108 333.6 +Q(static int)108 357.6 Q(DbLog::unlink\(const char *dir)108 369.6 Q 2.5 +(,i)-.92 G(nt f)-2.5 E(or)-.25 E(ce, DbEn)-.18 E 2.5(v*)-.4 G(\);)-2.5 E +(int)108 393.6 Q(DbLog::ar)108 405.6 Q(chi)-.18 E -.1(ve)-.1 G +(\(char **list[],).1 E(u_int32_t \215ags, v)158 417.6 Q +(oid *\(*db_malloc\)\(size_t\)\);)-.1 E(int)108 441.6 Q(DbLog::db_r)108 +453.6 Q(egister\(const Db *dbp,)-.18 E +(const char *name, DBTYPE type, u_int32_t *\214dp\);)158 465.6 Q(int)108 +489.6 Q(DbLog::db_unr)108 501.6 Q(egister\(u_int32_t \214d\);)-.18 E +(int)108 525.6 Q(DbLog::stat\(DB_LOG_ST)108 537.6 Q 1.9 -.95(AT *)-.9 H +(*spp, v).95 E(oid *\(*db_malloc\)\(size_t\)\);)-.1 E F0(DESCRIPTION)72 +554.4 Q F1 1.02(The DB library is a f)108 566.4 R 1.019 +(amily of classes that pro)-.1 F 1.019 +(vides a modular programming interf)-.15 F 1.019 +(ace to transactions and)-.1 F 1.377(record-oriented \214le access.)108 +578.4 R 1.378(The library includes support for transactions, locking, logging and \214le page) +6.377 F .443(caching, as well as v)108 590.4 R .443(arious inde)-.25 F +-.15(xe)-.15 G 2.943(da).15 G .442(ccess methods.)-2.943 F(Man)5.442 E +2.942(yo)-.15 G 2.942(ft)-2.942 G .442 +(he classes \(e.g., the \214le page caching class\))-2.942 F .4(are useful independent of the other DB classes, although some classes are e) +108 602.4 R .4(xplicitly based on other classes)-.15 F +(\(e.g., transactions and logging\).)108 614.4 Q -.15(Fo)5 G 2.5(rag).15 +G(eneral description of the DB package, see)-2.5 E/F3 10/Times-Italic@0 +SF(db_intr)2.5 E(o)-.45 E F1(\(3\).).18 E +(This manual page describes the speci\214c details of the log class.)108 +631.2 Q .947(This class pro)108 648 R .946 +(vide a general-purpose logging f)-.15 F .946(acility suf)-.1 F .946 +(\214cient for transaction management.)-.25 F .946(Logs can be)5.946 F +(shared by multiple processes.)108 660 Q .347(The DB transaction log is represented by a directory containing a set of \214les.) +108 676.8 R .348(The log is a record-oriented,)5.347 F +(append-only \214le, with records identi\214ed and accessed via)108 +688.8 Q F3(DbLsn)2.5 E F1 1.1 -.55('s \().24 H +(database log sequence numbers\).).55 E(DbLsn')108 705.6 Q 3.238(sa)-.55 +G .738(re returned on each)-3.238 F F3(DbLo)3.238 E(g::put)-.1 E F1 .738 +(operation, and only those DbLsn')3.238 F 3.238(sr)-.55 G .738 +(eturned by)-3.238 F F3(DbLo)3.237 E(g::put)-.1 E F1(can)3.237 E +(later be used to retrie)108 717.6 Q .3 -.15(ve r)-.25 H +(ecords from the log.).15 E(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 385.52(DbLog\(3\) DbLog\(3\))72 48 R/F1 10 +/Times-Italic@0 SF(DbLo)92 84 Q(g::open)-.1 E F0(The)108 96 Q F1(DbLo) +2.601 E(g::open)-.1 E F0 .101(method copies a pointer)2.601 F 2.601(,t) +-.4 G 2.601(ot)-2.601 G .101(he log identi\214ed by the)-2.601 F/F2 10 +/Times-Bold@0 SF(dir)2.601 E(ectory)-.18 E F1(dir)2.601 E F0 2.601(,i) +.73 G .102(nto the memory loca-)-2.601 F(tion referenced by)108 108 Q F1 +-.37(re)2.5 G(gionp)-.03 E F0(.).19 E .323(If the)108 124.8 R F1(dben) +2.823 E(v)-.4 E F0(ar)2.822 E .322(gument to)-.18 F F1(DbLo)2.822 E +(g::open)-.1 E F0 -.1(wa)2.822 G 2.822(si).1 G .322(nitialized using) +-2.822 F F1(DbEn)2.822 E(v::appinit)-.4 E F0(,).68 E F1(dir)2.822 E F0 +.322(is interpreted as described)2.822 F(by)108 136.8 Q F1(DbEn)2.5 E(v) +-.4 E F0(\(3\).).32 E .667(Otherwise, if)108 153.6 R F1(dir)3.167 E F0 +.668(is not NULL, it is interpreted relati)3.167 F .968 -.15(ve t)-.25 H +3.168(ot).15 G .668(he current w)-3.168 F .668 +(orking directory of the process.)-.1 F(If)5.668 E F1(dir)108 165.6 Q F0 +2.388(is NULL, the follo)4.888 F 2.388(wing en)-.25 F 2.388(vironment v) +-.4 F 2.388(ariables are check)-.25 F 2.387(ed in order: `)-.1 F +(`TMPDIR')-.74 E 2.387(', `)-.74 F(`TEMP')-.74 E 2.387(', and)-.74 F +-.74(``)108 177.6 S(TMP').74 E 2.715('. If)-.74 F .216 +(one of them is set, log \214les are created relati)2.715 F .516 -.15 +(ve t)-.25 H 2.716(ot).15 G .216(he directory it speci\214es.)-2.716 F +.216(If none of them are)5.216 F .598 +(set, the \214rst possible one of the follo)108 189.6 R .597 +(wing directories is used:)-.25 F F1(/var/tmp)3.097 E F0(,).19 E F1 +(/usr/tmp)3.097 E F0(,).19 E F1(/temp)3.097 E F0(,).19 E F1(/tmp)3.097 E +F0(,).19 E F1(C:/temp)3.097 E F0(and)3.097 E F1(C:/tmp)108 201.6 Q F0(.) +.19 E 1.984 +(All \214les associated with the log are created in this directory)108 +218.4 R 6.985(.T)-.65 G 1.985(his directory must already e)-6.985 F +1.985(xist when)-.15 F 1.066(DbLog::open is called.)108 230.4 R 1.066 +(If the log already e)6.066 F 1.066(xists, the process must ha)-.15 F +1.366 -.15(ve p)-.2 H 1.066(ermission to read and write the).15 F -.15 +(ex)108 242.4 S(isting \214les.).15 E(If the log does not already e)5 E +(xist, it is optionally created and initialized.)-.15 E .417 +(If the log re)108 259.2 R .418(gion is being created and log \214les are already present, the log \214les are `) +-.15 F(`reco)-.74 E -.15(ve)-.15 G(red').15 E 2.918('a)-.74 G .418 +(nd subse-)-2.918 F +(quent log writes are appended to the end of the log.)108 271.2 Q +(The log is stored in one or more \214les in the speci\214ed directory) +108 288 Q 5(.E)-.65 G(ach \214le is named using the format)-5 E +(log.NNNNN)158 312 Q(where `)108 336 Q(`NNNNN')-.74 E 2.5('i)-.74 G 2.5 +(st)-2.5 G(he sequence number of the \214le within the log.)-2.5 E(The) +108 352.8 Q F1<8d61>3.761 E(gs)-.1 E F0(and)3.761 E F1(mode)3.761 E F0 +(ar)3.761 E 1.261(guments specify ho)-.18 F 3.761<778c>-.25 G 1.26 +(les will be opened and/or created when the)-3.761 F 3.76(yd)-.15 G(on') +-3.76 E 3.76(ta)-.18 G(lready)-3.76 E -.15(ex)108 364.8 S 2.5(ist. The) +.15 F(\215ags v)2.5 E(alue is speci\214ed by)-.25 E F2(or)2.5 E F0 +('ing together one or more of the follo)A(wing v)-.25 E(alues:)-.25 E +(DB_CREA)108 381.6 Q(TE)-1.11 E .483(Create an)133 393.6 R 2.983(yu)-.15 +G .483(nderlying \214les, as necessary)-2.983 F 5.483(.I)-.65 G 2.983 +(ft)-5.483 G .483(he \214les do not already e)-2.983 F .483 +(xist and the DB_CREA)-.15 F .484(TE \215ag)-1.11 F +(is not speci\214ed, the call will f)133 405.6 Q(ail.)-.1 E(DB_THREAD) +108 434.4 Q 1.543(Cause the DbLog handle returned by the)133 446.4 R F1 +(DbLo)4.043 E(g::open)-.1 E F0 1.543 +(method to be useable by multiple threads)4.043 F +(within a single address space, i.e., to be `)133 458.4 Q +(`free-threaded')-.74 E('.)-.74 E .102 +(All \214les created by the log subsystem are created with mode)108 +475.2 R F1(mode)2.602 E F0 .103(\(as described in)2.603 F F1 -.15(ch) +2.603 G(mod).15 E F0 .103(\(2\)\) and modi\214ed).77 F .169 +(by the process' umask v)108 487.2 R .169 +(alue at the time of creation \(see)-.25 F F1(umask)2.669 E F0 2.669 +(\(2\)\). The).67 F .169(group o)2.669 F .169 +(wnership of created \214les is)-.25 F +(based on the system and directory def)108 499.2 Q +(aults, and is not further speci\214ed by DB.)-.1 E .166 +(The logging subsystem is con\214gured based on which set methods ha)108 +516 R .467 -.15(ve b)-.2 H .167(een used.).15 F .167(It is e)5.167 F +.167(xpected that appli-)-.15 F .914(cations will use a single DbEn)108 +528 R 3.413(vo)-.4 G .913(bject as the ar)-3.413 F .913 +(gument to all of the subsystems in the DB package.)-.18 F(The)5.913 E +.729(\214elds of the DbEn)108 540 R 3.229(vo)-.4 G .729(bject used by) +-3.229 F F1(DbLo)3.229 E(g::open)-.1 E F0 .729(are described belo)3.229 +F 4.53 -.65(w. A)-.25 H 3.23(sr).65 G .73(eferences to the DbEn)-3.23 F +3.23(vo)-.4 G(bject)-3.23 E 1.24(may be maintained by)108 552 R F1(DbLo) +3.74 E(g::open)-.1 E F0 3.74(,i).24 G 3.74(ti)-3.74 G 3.74(sn)-3.74 G +1.24(ecessary that the DbEn)-3.74 F 3.74(vo)-.4 G 1.24 +(bject and memory it references be)-3.74 F -.25(va)108 564 S .328 +(lid until the object is destro).25 F 2.828(yed. An)-.1 F 2.828(yo)-.15 +G 2.828(ft)-2.828 G .328(he DbEn)-2.828 F 2.828<768c>-.4 G .329 +(elds that are not e)-2.828 F .329(xplicitly set will def)-.15 F .329 +(ault to appro-)-.1 F(priate v)108 576 Q(alues.)-.25 E .517(The follo) +108 592.8 R .517(wing \214elds in the DbEn)-.25 F 3.016(vo)-.4 G .516(bject may be initialized, using the appropriate set method, before call-) +-3.016 F(ing)108 604.8 Q F1(DbLo)2.5 E(g::open)-.1 E F0(:).24 E -.2(vo) +108 633.6 S(id *\(*db_errcall\)\(char *db_errpfx, char *b).2 E(uf)-.2 E +(fer\);)-.25 E(FILE *db_err\214le;)108 645.6 Q(const char *db_errpfx;) +108 657.6 Q(class ostream *db_error_stream;)108 669.6 Q(int db_v)108 +681.6 Q(erbose;)-.15 E(The error \214elds of the DbEn)133 693.6 Q 2.5 +(vb)-.4 G(eha)-2.5 E .3 -.15(ve a)-.2 H 2.5(sd).15 G(escribed for)-2.5 E +F1(DbEn)2.5 E(v)-.4 E F0(\(3\).).32 E(May 10, 1998)278.085 768 Q(2) +201.085 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 385.52(DbLog\(3\) DbLog\(3\))72 48 R +(u_int32_t lg_max;)108 84 Q .248 +(The maximum size of a single \214le in the log.)133 96 R .248 +(Because DbLsn \214le of)5.248 F .249(fsets are unsigned 4-byte v)-.25 F +(alues,)-.25 E/F1 10/Times-Italic@0 SF(lg_max)133 108 Q F0 +(may not be lar)2.5 E(ger than the maximum unsigned 4-byte v)-.18 E +(alue.)-.25 E(If)133 132 Q F1(lg_max)2.5 E F0(is 0, a def)2.5 E(ault v) +-.1 E(alue is used.)-.25 E(See the section "LOG FILE LIMITS" belo)133 +156 Q 1.3 -.65(w, f)-.25 H(or further information.).65 E(The)108 172.8 Q +F1(DbLo)3.222 E(g::open)-.1 E F0 .722(method thro)3.222 F .722(ws a)-.25 +F F1(DbException)3.222 E F0 .722(\(3\) or returns the v).24 F .722 +(alue of)-.25 F F1(errno)3.222 E F0 .722(on f)3.222 F .721 +(ailure and 0 on suc-)-.1 F(cess.)108 184.8 Q F1(DbLo)92 201.6 Q +(g::close)-.1 E F0(The)108 213.6 Q F1(DbLo)2.5 E(g::close)-.1 E F0 +(method closes the log associated with the DbLog object.)2.5 E 3.454 +(In addition, if the)108 230.4 R F1(dir)5.954 E F0(ar)5.954 E 3.454 +(gument to)-.18 F F1(DbLo)5.954 E(g::open)-.1 E F0 -.1(wa)5.954 G 5.954 +(sN).1 G 3.454(ULL and)-5.954 F F1(dben)5.954 E(v)-.4 E F0 -.1(wa)5.954 +G 5.954(sn).1 G 3.454(ot initialized using)-5.954 F F1(DbEn)108 242.4 Q +(v::appinit)-.4 E F0 2.5(,a).68 G(ll \214les created for this shared re) +-2.5 E(gion will be remo)-.15 E -.15(ve)-.15 G(d, as if).15 E F1(DbLo) +2.5 E(g::unlink)-.1 E F0(were called.)2.5 E 2.663 +(When multiple threads are using the DbLog handle concurrently)108 259.2 +R 5.163(,o)-.65 G 2.662(nly a single thread may call the)-5.163 F F1 +(DbLo)108 271.2 Q(g::close)-.1 E F0(method.)2.5 E(The)108 288 Q F1(DbLo) +3.156 E(g::close)-.1 E F0 .656(method thro)3.156 F .656(ws a)-.25 F F1 +(DbException)3.156 E F0 .656(\(3\) or returns the v).24 F .657(alue of) +-.25 F F1(errno)3.157 E F0 .657(on f)3.157 F .657(ailure and 0 on suc-) +-.1 F(cess.)108 300 Q F1(DbLo)92 316.8 Q(g::\215ush)-.1 E F0(The)108 +328.8 Q F1(DbLo)3.559 E(g::\215ush)-.1 E F0 1.059(method guarantees that all log records whose DbLsns are less than or equal to the) +3.559 F F1(lsn)3.558 E F0(parameter ha)108 340.8 Q .3 -.15(ve b)-.2 H +(een written to disk.).15 E(If)5 E F1(lsn)2.5 E F0 +(is NULL, all records in the log are \215ushed.)2.5 E(The)108 357.6 Q F1 +(DbLo)3.254 E(g::\215ush)-.1 E F0 .754(method thro)3.254 F .754(ws a) +-.25 F F1(DbException)3.254 E F0 .754(\(3\) or returns the v).24 F .754 +(alue of)-.25 F F1(errno)3.254 E F0 .754(on f)3.254 F .754 +(ailure and 0 on suc-)-.1 F(cess.)108 369.6 Q F1(DbLo)92 386.4 Q(g::g) +-.1 E(et)-.1 E F0(The)108 398.4 Q F1(DbLo)2.779 E(g::g)-.1 E(et)-.1 E F0 +.279(method implements a cursor inside of the log, retrie)2.779 F .278 +(ving records from the log according to)-.25 F(the)108 410.4 Q F1(lsn) +2.5 E F0(and)2.5 E F1<8d61>2.5 E(gs)-.1 E F0(parameters.)2.5 E .025 +(The data \214eld of the)108 427.2 R F1(data)2.525 E F0 .025 +(object is set to the record retrie)2.525 F -.15(ve)-.25 G 2.525(da).15 +G .026(nd the size \214eld indicates the number of bytes)-2.525 F .529 +(in the record.)108 439.2 R(See)5.529 E F1(Dbt)3.029 E F0 .528 +(\(3\) for a description of other \214elds in the).68 F F1(data)3.028 E +F0(object.)3.028 E/F2 10/Times-Bold@0 SF .528(When multiple thr)5.528 F +.528(eads ar)-.18 F(e)-.18 E .667(using the r)108 451.2 R(etur)-.18 E +.667(ned DbLog handle concurr)-.15 F(ently)-.18 E 3.167(,e)-.55 G .667 +(ither the DB_DBT_MALLOC or DB_DBT_USER-)-3.167 F +(MEM \215ags must be speci\214ed f)108 463.2 Q(or any Dbt used f)-.25 E +(or data r)-.25 E(etrie)-.18 E -.1(va)-.15 G(l.).1 E F0(The)108 480 Q F1 +<8d61>2.5 E(gs)-.1 E F0(parameter must be set to e)2.5 E +(xactly one of the follo)-.15 E(wing v)-.25 E(alues:)-.25 E +(DB_CHECKPOINT)108 508.8 Q 1.895(The last record written with the DB_CHECKPOINT \215ag speci\214ed to the) +133 520.8 R F1(DbLo)4.394 E(g::put)-.1 E F0 1.894(method is)4.394 F +2.348(returned in the)133 532.8 R F1(data)4.848 E F0(ar)4.848 E 4.848 +(gument. The)-.18 F F1(lsn)4.848 E F0(ar)4.848 E 2.348(gument is o)-.18 +F -.15(ve)-.15 G 2.348(rwritten with the DbLsn of the record).15 F 3.576 +(returned. If)133 544.8 R 1.076(no record has been pre)3.576 F 1.075 +(viously written with the DB_CHECKPOINT \215ag speci\214ed, the)-.25 F +(\214rst record in the log is returned.)133 556.8 Q +(If the log is empty the)133 573.6 Q F1(DbLo)2.5 E(g::g)-.1 E(et)-.1 E +F0(method will return DB_NO)2.5 E(TFOUND.)-.4 E(DB_FIRST)108 602.4 Q +.476(The \214rst record from an)133 614.4 R 2.976(yo)-.15 G 2.976(ft) +-2.976 G .476 +(he log \214les found in the log directory is returned in the)-2.976 F +F1(data)2.977 E F0(ar)2.977 E(gument.)-.18 E(The)133 626.4 Q F1(lsn)2.5 +E F0(ar)2.5 E(gument is o)-.18 E -.15(ve)-.15 G +(rwritten with the DbLsn of the record returned.).15 E +(If the log is empty the)133 643.2 Q F1(DbLo)2.5 E(g::g)-.1 E(et)-.1 E +F0(method will return DB_NO)2.5 E(TFOUND.)-.4 E(DB_LAST)108 672 Q .367 +(The last record in the log is returned in the)133 684 R F1(data)2.867 E +F0(ar)2.867 E 2.867(gument. The)-.18 F F1(lsn)2.866 E F0(ar)2.866 E .366 +(gument is o)-.18 F -.15(ve)-.15 G .366(rwritten with the).15 F +(DbLsn of the record returned.)133 696 Q(If the log is empty)133 712.8 Q +2.5(,t)-.65 G(he)-2.5 E F1(DbLo)2.5 E(g::g)-.1 E(et)-.1 E F0 +(method will return DB_NO)2.5 E(TFOUND.)-.4 E(May 10, 1998)278.085 768 Q +(3)201.085 E EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 385.52(DbLog\(3\) DbLog\(3\))72 48 R(DB_NEXT)108 +84 Q .846(The current log position is adv)133 96 R .846(anced to the ne) +-.25 F .847(xt record in the log and that record is returned in the)-.15 +F/F1 10/Times-Italic@0 SF(data)133 108 Q F0(ar)2.5 E 2.5(gument. The) +-.18 F F1(lsn)2.5 E F0(ar)2.5 E(gument is o)-.18 E -.15(ve)-.15 G +(rwritten with the DbLsn of the record returned.).15 E 3.749 +(If the pointer has not been initialized via DB_FIRST)133 124.8 R 6.248 +(,D)-.74 G(B_LAST)-6.248 E 6.248(,D)-.74 G(B_SET)-6.248 E 6.248(,D)-.74 +G(B_NEXT)-6.248 E 6.248(,o)-.74 G(r)-6.248 E(DB_PREV)133 136.8 Q(,)-1.29 +E F1(DbLo)3.035 E(g::g)-.1 E(et)-.1 E F0 .536 +(will return the \214rst record in the log.)3.035 F .536 +(If the last log record has already been)5.536 F +(returned or the log is empty)133 148.8 Q 2.5(,t)-.65 G(he)-2.5 E F1 +(DbLo)2.5 E(g::g)-.1 E(et)-.1 E F0(method will return DB_NO)2.5 E +(TFOUND.)-.4 E .615(If the log w)133 165.6 R .615 +(as opened with the DB_THREAD \215ag set, calls to)-.1 F F1(DbLo)3.115 E +(g::g)-.1 E(et)-.1 E F0 .615(with the DB_NEXT \215ag)3.115 F +(set will return EINV)133 177.6 Q(AL.)-1.35 E(DB_PREV)108 206.4 Q .502 +(The current log position is mo)133 218.4 R -.15(ve)-.15 G 3.002(dt).15 +G 3.002(ot)-3.002 G .503(he pre)-3.002 F .503 +(vious record in the log and that record is returned in the)-.25 F F1 +(data)133 230.4 Q F0(ar)2.5 E 2.5(gument. The)-.18 F F1(lsn)2.5 E F0(ar) +2.5 E(gument is o)-.18 E -.15(ve)-.15 G +(rwritten with the DbLsn of the record returned.).15 E 3.749 +(If the pointer has not been initialized via DB_FIRST)133 247.2 R 6.248 +(,D)-.74 G(B_LAST)-6.248 E 6.248(,D)-.74 G(B_SET)-6.248 E 6.248(,D)-.74 +G(B_NEXT)-6.248 E 6.248(,o)-.74 G(r)-6.248 E(DB_PREV)133 259.2 Q(,)-1.29 +E F1(DbLo)3.035 E(g::g)-.1 E(et)-.1 E F0 .536 +(will return the last record in the log.)3.035 F .536 +(If the \214rst log record has already been)5.536 F +(returned or the log is empty)133 271.2 Q 2.5(,t)-.65 G(he)-2.5 E F1 +(DbLo)2.5 E(g::g)-.1 E(et)-.1 E F0(method will return DB_NO)2.5 E +(TFOUND.)-.4 E .684(If the log w)133 288 R .684 +(as opened with the DB_THREAD \215ag set, calls to)-.1 F F1(DbLo)3.184 E +(g::g)-.1 E(et)-.1 E F0 .683(with the DB_PREV \215ag)3.183 F +(set will return EINV)133 300 Q(AL.)-1.35 E(DB_CURRENT)108 328.8 Q +(Return the log record currently referenced by the log.)133 340.8 Q +2.284(If the log pointer has not been initialized via DB_FIRST)133 357.6 +R 4.785(,D)-.74 G(B_LAST)-4.785 E 4.785(,D)-.74 G(B_SET)-4.785 E 4.785 +(,D)-.74 G(B_NEXT)-4.785 E 4.785(,o)-.74 G(r)-4.785 E(DB_PREV)133 369.6 +Q 3.576(,o)-1.29 G 3.576(ri)-3.576 G 3.576(ft)-3.576 G 1.076(he log w) +-3.576 F 1.075(as opened with the DB_THREAD \215ag set,)-.1 F F1(DbLo) +3.575 E(g::g)-.1 E(et)-.1 E F0 1.075(will return EIN-)3.575 F -1.35(VA) +133 381.6 S(L.)1.35 E(DB_SET)108 398.4 Q(Retrie)133 410.4 Q 1.356 -.15 +(ve t)-.25 H 1.056(he record speci\214ed by the).15 F F1(lsn)3.556 E F0 +(ar)3.556 E 3.556(gument. If)-.18 F 1.056(the speci\214ed DbLsn is in) +3.556 F -.25(va)-.4 G 1.057(lid \(e.g., does not).25 F +(appear in the log\))133 422.4 Q F1(DbLo)2.5 E(g::g)-.1 E(et)-.1 E F0 +(will return EINV)2.5 E(AL.)-1.35 E .53(Otherwise, the)108 439.2 R F1 +(DbLo)3.03 E(g::g)-.1 E(et)-.1 E F0 .53(method thro)3.03 F .53(ws a)-.25 +F F1(DbException)3.03 E F0 .53(\(3\) or returns the v).24 F .53(alue of) +-.25 F F1(errno)3.03 E F0 .53(on f)3.03 F .53(ailure and 0)-.1 F +(on success.)108 451.2 Q F1(DbLo)92 468 Q(g::compar)-.1 E(e)-.37 E F0 +(The)108 480 Q F1(DbLo)2.938 E(g::compar)-.1 E(e)-.37 E F0 .438 +(method allo)2.938 F .438(ws the caller to compare tw)-.25 F 2.939(oD) +-.1 G(bLsn')-2.939 E(s.)-.55 E F1(DbLo)5.439 E(g::compar)-.1 E(e)-.37 E +F0 .439(returns 0 if the)2.939 F(tw)108 492 Q 2.5(oD)-.1 G(bLsn')-2.5 E +2.5(sa)-.55 G(re equal, 1 if)-2.5 E F1(lsn0)2.5 E F0(is greater than)2.5 +E F1(lsn1)2.5 E F0 2.5(,a)C(nd -1 if)-2.5 E F1(lsn0)2.5 E F0 +(is less than)2.5 E F1(lsn1)2.5 E F0(.)A F1(DbLo)92 508.8 Q(g::\214le) +-.1 E F0(The)108 520.8 Q F1(DbLo)3.057 E(g::\214le)-.1 E F0 .557 +(method maps DbLsn')3.057 F 3.057(st)-.55 G 3.057<6f8c>-3.057 G .557 +(le names.)-3.057 F(The)5.557 E F1(DbLo)3.057 E(g::\214le)-.1 E F0 .557 +(method copies the name of the \214le)3.057 F 1.625 +(containing the record named by)108 532.8 R F1(lsn)4.125 E F0 1.625 +(into the memory location referenced by)4.125 F F1(namep)4.126 E F0 +6.626(.\().19 G 1.626(This mapping of)-6.626 F .587 +(DbLsn to \214le is needed for database administration.)108 544.8 R -.15 +(Fo)5.586 G 3.086(re).15 G .586 +(xample, a transaction manager typically records)-3.236 F .707(the earliest DbLsn needed for restart, and the database administrator may w) +108 556.8 R .708(ant to archi)-.1 F 1.008 -.15(ve l)-.25 H .708 +(og \214les to tape).15 F(when the)108 568.8 Q 2.5(yc)-.15 G +(ontain only DbLsn')-2.5 E 2.5(sb)-.55 G +(efore the earliest one needed for restart.\))-2.5 E(The)108 585.6 Q F1 +(len)3.342 E F0(ar)3.342 E .842(gument is the length of the)-.18 F F1 +(namep)3.342 E F0 -.2(bu)3.342 G -.25(ff).2 G .842(er in bytes.).25 F +(If)5.842 E F1(namep)3.342 E F0 .842 +(is too short to hold the \214le name,)3.342 F F1(DbLo)108 597.6 Q +(g::\214le)-.1 E F0 .113(will return ENOMEM.)2.612 F .113 +(Note, as described abo)5.113 F -.15(ve)-.15 G 2.613(,l).15 G .113 +(og \214le names are quite short, on the order of)-2.613 F +(10 characters.)108 609.6 Q(The)108 626.4 Q F1(DbLo)2.716 E(g::\214le) +-.1 E F0 .216(method thro)2.716 F .216(ws a)-.25 F F1(DbException)2.716 +E F0 .215(\(3\) or returns the v).24 F .215(alue of)-.25 F F1(errno) +2.715 E F0 .215(on f)2.715 F .215(ailure and 0 on success.)-.1 F F1 +(DbLo)92 643.2 Q(g::put)-.1 E F0(The)108 655.2 Q F1(DbLo)3.669 E(g::put) +-.1 E F0 1.169(method appends records to the log.)3.669 F 1.17 +(The DbLsn of the put record is returned in the)6.169 F F1(lsn)3.67 E F0 +(parameter)108 667.2 Q 5(.T)-.55 G(he)-5 E F1<8d61>2.5 E(gs)-.1 E F0 +(parameter may be set to one of the follo)2.5 E(wing v)-.25 E(alues:) +-.25 E(DB_CHECKPOINT)108 696 Q .119 +(The log should write a checkpoint record, recording an)133 708 R 2.619 +(yi)-.15 G .118(nformation necessary to mak)-2.619 F 2.618(et)-.1 G .118 +(he log struc-)-2.618 F(tures reco)133 720 Q -.15(ve)-.15 G +(rable after a crash.).15 E(May 10, 1998)278.085 768 Q(4)201.085 E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 385.52(DbLog\(3\) DbLog\(3\))72 48 R(DB_CURLSN) +108 84 Q(The DB_LSN of the ne)133 96 Q +(xt record to be put is returned in the)-.15 E/F1 10/Times-Italic@0 SF +(lsn)2.5 E F0(parameter)2.5 E(.)-.55 E(DB_FLUSH)108 124.8 Q .808(The log is forced to disk after this record is written, guaranteeing that all records with DbLsns less) +133 136.8 R .444(than or equal to the one being put are on disk before this method returns \(this function is most often) +133 148.8 R(used for a transaction commit, see)133 160.8 Q F1(Db::Txn) +2.5 E F0(in Db \(3\)\).)2.5 E .238(The caller is responsible for pro)108 +177.6 R .239(viding an)-.15 F 2.739(yn)-.15 G .239 +(ecessary structure to)-2.739 F F1(data)2.739 E F0 5.239(.\().26 G -.15 +(Fo)-5.239 G 2.739(re).15 G .239(xample, in a write-ahead log-)-2.889 F +1.183(ging protocol, the application must understand what part of)108 +189.6 R F1(data)3.683 E F0 1.183 +(is an operation code, what part is redo)3.683 F .709 +(information, and what part is undo information.)108 201.6 R .71 +(In addition, most transaction managers will store in)5.709 F F1(data) +3.21 E F0 .007(the DbLsn of the pre)108 213.6 R .006(vious log record for the same transaction, to support chaining back through the transac-) +-.25 F(tion')108 225.6 Q 2.5(sl)-.55 G(og records during undo.\))-2.5 E +(The)108 242.4 Q F1(DbLo)2.682 E(g::put)-.1 E F0 .182(method thro)2.682 +F .182(ws a)-.25 F F1(DbException)2.682 E F0 .182 +(\(3\) or returns the v).24 F .182(alue of)-.25 F F1(errno)2.682 E F0 +.183(on f)2.683 F .183(ailure and 0 on success.)-.1 F F1(DbLo)92 271.2 Q +(g::unlink)-.1 E F0(The)108 283.2 Q F1(DbLo)2.595 E(g::unlink)-.1 E F0 +.095(method destro)2.595 F .095(ys the log re)-.1 F .095 +(gion identi\214ed by the directory)-.15 F F1(dir)2.595 E F0 2.595(,r) +.73 G(emo)-2.595 E .095(ving all \214les used to)-.15 F 1.881 +(implement the log re)108 295.2 R 4.382(gion. \(The)-.15 F(directory) +4.382 E F1(dir)4.382 E F0 1.882(is not remo)4.382 F -.15(ve)-.15 G 4.382 +(d.\) If).15 F 1.882(there are processes that ha)4.382 F 2.182 -.15 +(ve c)-.2 H(alled).15 E F1(DbLo)108 307.2 Q(g::open)-.1 E F0 2.749 +(without calling)5.249 F F1(DbLo)5.249 E(g::close)-.1 E F0 2.748 +(\(i.e., there are processes currently using the log re)5.249 F(gion\),) +-.15 E F1(DbLo)108 319.2 Q(g::unlink)-.1 E F0 .111(will f)2.611 F .112(ail without further action, unless the force \215ag is set, in which case) +-.1 F F1(DbLo)2.612 E(g::unlink)-.1 E F0(will)2.612 E(attempt to remo) +108 331.2 Q .3 -.15(ve t)-.15 H(he log re).15 E(gion \214les re)-.15 E +-.05(ga)-.15 G(rdless of an).05 E 2.5(yp)-.15 G +(rocesses still using the log re)-2.5 E(gion.)-.15 E .766 +(The result of attempting to forcibly destro)108 348 R 3.266(yt)-.1 G +.766(he re)-3.266 F .766(gion when a process has the re)-.15 F .765 +(gion open is unspeci\214ed.)-.15 F 1.232 +(Processes using a shared memory re)108 360 R 1.232 +(gion maintain an open \214le descriptor for it.)-.15 F 1.232 +(On UNIX systems, the)6.232 F(re)108 372 Q .474(gion remo)-.15 F -.25 +(va)-.15 G 2.974(ls).25 G .473(hould succeed and processes that ha) +-2.974 F .773 -.15(ve a)-.2 H .473(lready joined the re).15 F .473 +(gion should continue to run in)-.15 F .247(the re)108 384 R .247 +(gion without change, ho)-.15 F(we)-.25 E -.15(ve)-.25 G 2.747(rp).15 G +.248(rocesses attempting to join the log re)-2.747 F .248 +(gion will either f)-.15 F .248(ail or attempt to)-.1 F .45(create a ne) +108 396 R 2.95(wr)-.25 G -.15(eg)-2.95 G 2.95(ion. On).15 F .45 +(other systems, e.g., WNT)2.95 F 2.949(,w)-.74 G .449(here the)-2.949 F +F1(unlink)2.949 E F0 .449(\(2\) system call will f).67 F .449(ail if an) +-.1 F 2.949(yp)-.15 G(rocess)-2.949 E +(has an open \214le descriptor for the \214le, the re)108 408 Q +(gion remo)-.15 E -.25(va)-.15 G 2.5(lw).25 G(ill f)-2.5 E(ail.)-.1 E +.929(In the case of catastrophic or system f)108 424.8 R .929 +(ailure, database reco)-.1 F -.15(ve)-.15 G .93 +(ry must be performed \(see).15 F F1(db_r)3.43 E(eco)-.37 E(ver)-.1 E F0 +.93(\(1\) or).73 F .439(the DB_RECO)108 436.8 R .439(VER and DB_RECO)-.5 +F(VER_F)-.5 E -1.21 -1.11(AT A)-.74 H 2.939<4c8d>1.11 G .439(ags to) +-2.939 F F1(DbEn)2.939 E(v::appinit)-.4 E F0 2.939(\(3\)\). Alternati) +.68 F -.15(ve)-.25 G(ly).15 E 2.939(,i)-.65 G 2.939(fr)-2.939 G(eco) +-2.939 E -.15(ve)-.15 G .439(ry is).15 F .638 +(not required because no database state is maintained across f)108 448.8 +R .639(ailures, it is possible to clean up a log re)-.1 F(gion)-.15 E +1.016(by remo)108 460.8 R 1.016 +(ving all of the \214les in the directory speci\214ed to the)-.15 F F1 +(DbLo)3.515 E(g::open)-.1 E F0 1.015(method, as log re)3.515 F 1.015 +(gion \214les are)-.15 F(ne)108 472.8 Q -.15(ve)-.25 G 2.561(rc).15 G +.061(reated in an)-2.561 F 2.561(yd)-.15 G .062 +(irectory other than the one speci\214ed to)-2.561 F F1(DbLo)2.562 E +(g::open)-.1 E F0 5.062(.N).24 G .062(ote, ho)-5.062 F(we)-.25 E -.15 +(ve)-.25 G .862 -.4(r, t).15 H .062(hat this has the).4 F +(potential to remo)108 484.8 Q .3 -.15(ve \214)-.15 H +(les created by the other DB subsystems in this database en).15 E +(vironment.)-.4 E(The)108 501.6 Q F1(DbLo)2.895 E(g::unlink)-.1 E F0 +.395(method thro)2.895 F .395(ws a)-.25 F F1(DbException)2.895 E F0 .395 +(\(3\) or returns the v).24 F .395(alue of)-.25 F F1(errno)2.895 E F0 +.394(on f)2.895 F .394(ailure and 0 on suc-)-.1 F(cess.)108 513.6 Q F1 +(DbLo)92 530.4 Q(g::ar)-.1 E -.15(ch)-.37 G(ive).15 E F0(The)108 542.4 Q +F1(DbLo)3.367 E(g::ar)-.1 E -.15(ch)-.37 G(ive).15 E F0 .867(method creates a NULL-terminated array of log or database \214le names and copies a) +3.367 F(pointer to them into the user)108 554.4 Q +(-speci\214ed memory location)-.2 E F1(list)2.5 E F0(.).68 E .14(By def) +108 571.2 R(ault,)-.1 E F1(DbLo)2.64 E(g::ar)-.1 E -.15(ch)-.37 G(ive) +.15 E F0 .139(returns the names of all of the log \214les that are no longer in use \(e.g., no longer) +2.64 F(in)108 583.2 Q -.2(vo)-.4 G(lv).2 E .32(ed in acti)-.15 F .62 +-.15(ve t)-.25 H .321(ransactions\), and that may be archi).15 F -.15 +(ve)-.25 G 2.821(df).15 G .321(or catastrophic reco)-2.821 F -.15(ve) +-.15 G .321(ry and then remo).15 F -.15(ve)-.15 G 2.821(df).15 G(rom) +-2.821 E(the system.)108 595.2 Q +(If there were no \214le names to return,)5 E F1(list)2.5 E F0 +(will be set to NULL.)2.5 E .692 +(Arrays of log \214le names are created in allocated memory)108 612 R +5.692(.I)-.65 G(f)-5.692 E F1(db_malloc)3.192 E F0 .691 +(is non-NULL, it is called to allo-)3.192 F .067(cate the memory)108 624 +R 2.567(,o)-.65 G .067(therwise, the library function)-2.567 F F1 +(malloc)2.567 E F0 .067(\(3\) is used.).31 F .068(The function)5.067 F +F1(db_malloc)2.568 E F0 .068(must match the)2.568 F .877(calling con)108 +636 R -.15(ve)-.4 G .877(ntions of the).15 F F1(malloc)3.377 E F0 .877 +(\(3\) library routine.).31 F(Re)5.877 E -.05(ga)-.15 G .877 +(rdless, the caller is responsible for deallocating).05 F 1.605 +(the returned memory)108 648 R 6.605(.T)-.65 G 4.105(od)-7.405 G 1.605 +(eallocate the returned memory)-4.105 F 4.105(,f)-.65 G 1.606 +(ree each returned memory pointer; pointers)-4.105 F +(inside the memory do not need to be indi)108 660 Q(vidually freed.)-.25 +E(The)108 676.8 Q F1<8d61>2.5 E(gs)-.1 E F0(ar)2.5 E +(gument is speci\214ed by)-.18 E/F2 10/Times-Bold@0 SF(or)2.5 E F0 +('ing together one or more of the follo)A(wing v)-.25 E(alues:)-.25 E +(DB_ARCH_ABS)108 705.6 Q .224 +(All pathnames are returned as absolute pathnames, instead of relati)133 +717.6 R .524 -.15(ve t)-.25 H 2.724(ot).15 G .224 +(he database home directory)-2.724 F(.)-.65 E(May 10, 1998)278.085 768 Q +(5)201.085 E EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 385.52(DbLog\(3\) DbLog\(3\))72 48 R(DB_ARCH_D) +108 84 Q -1.21 -1.11(AT A)-.4 H .661 +(Return the database \214les that need to be archi)133 96 R -.15(ve)-.25 +G 3.161(di).15 G 3.161(no)-3.161 G .661(rder to reco)-3.161 F -.15(ve) +-.15 G 3.162(rt).15 G .662(he database from catastrophic)-3.162 F -.1 +(fa)133 108 S 2.665(ilure. If).1 F(an)2.665 E 2.665(yo)-.15 G 2.665(ft) +-2.665 G .165(he database \214les ha)-2.665 F .465 -.15(ve n)-.2 H .165 +(ot been accessed during the lifetime of the current log \214les,).15 F +/F1 10/Times-Italic@0 SF(DbLo)133 120 Q(g::ar)-.1 E -.15(ch)-.37 G(ive) +.15 E F0 .368(will not include them in this list.)2.868 F .368 +(It is also possible that some of the \214les referenced)5.368 F +(in the log ha)133 132 Q .3 -.15(ve s)-.2 H +(ince been deleted from the system.).15 E(DB_ARCH_LOG)108 160.8 Q +(Return all the log \214le names re)133 172.8 Q -.05(ga)-.15 G +(rdless of whether or not the).05 E 2.5(ya)-.15 G(re in use.)-2.5 E +(The DB_ARCH_D)108 189.6 Q -1.21 -1.11(AT A)-.4 H +(and DB_ARCH_LOG \215ags are mutually e)3.61 E(xclusi)-.15 E -.15(ve) +-.25 G(.).15 E(The)108 206.4 Q F1(DbLo)2.632 E(g::ar)-.1 E -.15(ch)-.37 +G(ive).15 E F0 .132(method thro)2.632 F .132(ws a)-.25 F F1(DbException) +2.632 E F0 .132(\(3\) or returns the v).24 F .132(alue of)-.25 F F1 +(errno)2.632 E F0 .132(on f)2.632 F .131(ailure and 0 on suc-)-.1 F +(cess.)108 218.4 Q(The)108 235.2 Q F1(DbLo)2.867 E(g::ar)-.1 E -.15(ch) +-.37 G(ive).15 E F0 .367(method is based on the C)2.867 F F1(lo)2.867 E +(g_ar)-.1 E -.15(ch)-.37 G(ive).15 E F0 .368 +(function, which is the underlying function used)2.867 F 2.282(by the) +108 247.2 R F1(db_ar)4.782 E -.15(ch)-.37 G(ive).15 E F0 2.282 +(\(1\) utility).18 F 7.282(.S)-.65 G 2.281(ee the source code for the) +-7.282 F F1(db_ar)4.781 E -.15(ch)-.37 G(ive).15 E F0 2.281 +(utility for an e)4.781 F 2.281(xample of using)-.15 F F1(lo)108 259.2 Q +(g_ar)-.1 E -.15(ch)-.37 G(ive).15 E F0 .167(in a UNIX en)2.667 F 2.667 +(vironment. See)-.4 F(the)2.667 E F1(db_ar)2.667 E -.15(ch)-.37 G(ive) +.15 E F0 .167(\(1\) manual page for more information on database).18 F +(archi)108 271.2 Q -.25(va)-.25 G 2.5(lp).25 G(rocedures.)-2.5 E F1 +(DbLo)92 288 Q(g::db_r)-.1 E -.4(eg)-.37 G(ister).4 E F0(The)108 300 Q +F1(DbLo)3.131 E(g::db_r)-.1 E -.4(eg)-.37 G(ister).4 E F0 .631 +(method re)3.131 F .631(gisters a \214le name with the log manager and copies a \214le identi\214cation) +-.15 F .602(number into the memory location referenced by)108 312 R F1 +(\214dp)3.102 E F0 5.602(.T).19 G .602 +(his \214le identi\214cation number should be used in all)-5.602 F .516 +(subsequent log messages that refer to operations on this \214le.)108 +324 R .515(The log manager records all \214le name to \214le)5.516 F +.322(identi\214cation number mappings at each checkpoint so that a reco) +108 336 R -.15(ve)-.15 G .322 +(ry process can identify the \214le to which).15 F 2.5(ar)108 348 S +(ecord in the log refers.)-2.5 E(The)108 364.8 Q F1(DbLo)3.944 E +(g::db_r)-.1 E -.4(eg)-.37 G(ister).4 E F0 1.443 +(method is called when an access method re)3.944 F 1.443 +(gisters the open of a \214le.)-.15 F(The)6.443 E F1(dbp)3.943 E F0(parameter should be a pointer to the Db object which is being returned by the access method.) +108 376.8 Q(The)108 393.6 Q F1(type)2.5 E F0 +(parameter should be one of the Db types speci\214ed in)2.5 E F1 +(Db::open \(see)2.5 E F0(Db).18 E F1(\(3\)\),).08 E F0(e.g., DB_HASH.) +2.5 E(The)108 410.4 Q F1(DbLo)2.845 E(g::db_r)-.1 E -.4(eg)-.37 G(ister) +.4 E F0 .345(method thro)2.845 F .345(ws a)-.25 F F1(DbException)2.845 E +F0 .346(\(3\) or returns the v).24 F .346(alue of)-.25 F F1(errno)2.846 +E F0 .346(on f)2.846 F .346(ailure and 0 on)-.1 F(success.)108 422.4 Q +F1(DbLo)92 439.2 Q(g::db_unr)-.1 E -.4(eg)-.37 G(ister).4 E F0(The)108 +451.2 Q F1(DbLo)2.745 E(g::db_unr)-.1 E -.4(eg)-.37 G(ister).4 E F0 .245 +(method disassociates the \214le name to \214le identi\214cation number mapping for the) +2.745 F .136(\214le identi\214cation number speci\214ed by the)108 463.2 +R F1<8c64>2.637 E F0(parameter)2.637 E 5.137(.T)-.55 G .137 +(he \214le identi\214cation number may then be reused.)-5.137 F(The)108 +480 Q F1(DbLo)3.036 E(g::db_unr)-.1 E -.4(eg)-.37 G(ister).4 E F0 .536 +(method thro)3.036 F .536(ws a)-.25 F F1(DbException)3.036 E F0 .535 +(\(3\) or returns the v).24 F .535(alue of)-.25 F F1(errno)3.035 E F0 +.535(on f)3.035 F .535(ailure and 0)-.1 F(on success.)108 492 Q F1(DbLo) +92 508.8 Q(g::stat)-.1 E F0(The)108 520.8 Q F1(DbLo)4.009 E(g::stat)-.1 +E F0 1.509(function creates a statistical structure and copies a pointer to it into the user) +4.009 F(-speci\214ed)-.2 E(memory location.)108 532.8 Q .049 +(Statistical structures are created in allocated memory)108 549.6 R +5.049(.I)-.65 G(f)-5.049 E F1(db_malloc)2.549 E F0 .048 +(is non-NULL, it is called to allocate the)2.549 F(memory)108 561.6 Q +2.829(,o)-.65 G .329(therwise, the library function)-2.829 F F1(malloc) +2.829 E F0 .329(\(3\) is used.).31 F .329(The function)5.329 F F1 +(db_malloc)2.829 E F0 .33(must match the calling)2.83 F(con)108 573.6 Q +-.15(ve)-.4 G 2.031(ntions of the).15 F F1(malloc)4.531 E F0 2.031 +(\(3\) library routine.).31 F(Re)7.031 E -.05(ga)-.15 G 2.031 +(rdless, the caller is responsible for deallocating the).05 F .707 +(returned memory)108 585.6 R 5.707(.T)-.65 G 3.207(od)-6.507 G .708 +(eallocate the returned memory)-3.207 F 3.208(,f)-.65 G .708 +(ree each returned memory pointer; pointers inside)-3.208 F 2.042 +(the memory do not need to be indi)108 597.6 R 2.042(vidually freed.) +-.25 F 2.041(The log statistics are stored in a structure of type)7.042 +F(DB_LOG_ST)108 609.6 Q 2.22 -1.11(AT \()-.93 H -1.95(typedef ')1.11 F +2.5(di)-.5 G 2.5(n<)-2.5 G(db)-2.5 E 2.5(.h>\). The)-.4 F(follo)2.5 E +(wing DB_LOG_ST)-.25 E 2.22 -1.11(AT \214)-.93 H +(elds will be \214lled in:)1.11 E(u_int32_t st_magic;)108 626.4 Q +(The magic number that identi\214es a \214le as a log \214le.)133 638.4 +Q(u_int32_t st_v)108 650.4 Q(ersion;)-.15 E(The v)133 662.4 Q +(ersion of the log \214le type.)-.15 E(u_int32_t st_refcnt;)108 674.4 Q +(The number of references to the re)133 686.4 Q(gion.)-.15 E +(u_int32_t st_re)108 698.4 Q(gsize;)-.15 E(The size of the re)133 710.4 +Q(gion.)-.15 E(May 10, 1998)278.085 768 Q(6)201.085 E EP +%%Page: 7 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 385.52(DbLog\(3\) DbLog\(3\))72 48 R +(u_int32_t st_mode;)108 84 Q(The mode of an)133 96 Q 2.5(yc)-.15 G +(reated log \214les.)-2.5 E(u_int32_t st_lg_max;)108 108 Q +(The maximum size of an)133 120 Q 2.5(yi)-.15 G(ndi)-2.5 E +(vidual \214le comprising the log.)-.25 E(u_int32_t st_written;)108 132 +Q(The total number of bytes written to this log.)133 144 Q +(u_int32_t st_written_chkpt;)108 156 Q +(The number of bytes written since the last checkpoint.)133 168 Q +(u_int32_t st_re)108 180 Q(gion_w)-.15 E(ait;)-.1 E +(The number of times that a process w)133 192 Q +(as able to obtain the re)-.1 E(gion lock without w)-.15 E(aiting.)-.1 E +(u_int32_t st_re)108 204 Q(gion_no)-.15 E -.1(wa)-.25 G(it;).1 E +(The number of times that a process w)133 216 Q(as forced to w)-.1 E +(ait before obtaining the re)-.1 E(gion lock.)-.15 E/F1 9/Times-Bold@0 +SF(LOG FILE LIMITS)72 232.8 Q F0 .474(Log \214le sizes impose a time limit on the length of time a database may be accessed under transaction pro-) +108 244.8 R .91 +(tection, before it needs to be dumped and reloaded \(see)108 256.8 R/F2 +10/Times-Italic@0 SF(db_dump\(3\))3.41 E F0(and)3.41 E F2 +(db_load\(3\)\).)3.41 E F0(Unfortunately)5.91 E 3.41(,t)-.65 G(he)-3.41 +E(limits are potentially dif)108 268.8 Q(\214cult to calculate.)-.25 E +.273(The log \214le name consists of "log." follo)108 285.6 R .274 +(wed by 5 digits, resulting in a maximum of 99,999 log \214les.)-.25 F +(Con-)5.274 E .127(sider an application performing 600 transactions per second, for 15 hours a day) +108 297.6 R 2.626(,l)-.65 G .126(ogged into 10Mb log \214les,)-2.626 F +(where each transaction is logging approximately 100 bytes of data.)108 +309.6 Q(The calculation:)5 E(\(10 * 2^20 * 99999\) /)144 326.4 Q +(\(600 * 60 * 60 * 15 * 100\) = 323.63)194 338.4 Q .795(indicates that the system will run out of log \214le space in roughly 324 days.) +108 355.2 R .795(If we increase the maximum)5.795 F .136(size of the \214les from 10Mb to 100Mb, the same calculation indicates that the application will run out of log) +108 367.2 R(\214le space in roughly 9 years.)108 379.2 Q .314 +(There is no w)108 396 R .314 +(ay to reset the log \214le name space in Berk)-.1 F(ele)-.1 E 2.814(yD) +-.15 G 2.814(B. If)-2.814 F .315 +(your application is reaching the end of)2.814 F +(its log \214le name space, you should:)108 408 Q 15(1. Archi)108 424.8 +R .711 -.15(ve y)-.25 H .411 +(our databases as if to prepare for catastrophic f).15 F .411 +(ailure \(see)-.1 F F2(db_ar)2.91 E -.15(ch)-.37 G(ive).15 E F0 .41 +(\(1\) for more informa-).18 F(tion\).)133 436.8 Q 15(2. Dump)108 453.6 +R(and re-load)2.5 E/F3 10/Times-Bold@0 SF(all)2.5 E F0 +(your databases \(see)2.5 E F2(db_dump)2.5 E F0(\(1\) and).19 E F2 +(db_load)2.5 E F0(\(1\) for more information\).).77 E 15(3. Remo)108 +470.4 R .3 -.15(ve a)-.15 H(ll of the log \214les from the database en) +.15 E(vironment \(see)-.4 E F2(db_ar)2.5 E -.15(ch)-.37 G(ive).15 E F0 +(\(1\) for more information\).).18 E 15(4. Restart)108 487.2 R +(your applications.)2.5 E F1(ENVIR)72 504 Q(ONMENT V)-.27 E(ARIABLES) +-1.215 E F0(The follo)108 516 Q(wing en)-.25 E(vironment v)-.4 E +(ariables af)-.25 E(fect the e)-.25 E -.15(xe)-.15 G(cution of).15 E F2 +(db_lo)2.5 E(g)-.1 E F0(:).22 E(DB_HOME)108 532.8 Q 1.46(If the)133 +544.8 R F2(dben)3.96 E(v)-.4 E F0(ar)3.96 E 1.46(gument to)-.18 F F2 +(DbLo)3.96 E(g::open)-.1 E F0 -.1(wa)3.96 G 3.96(si).1 G 1.46 +(nitialized using)-3.96 F F2(db_appinit)3.96 E F0 3.96(,t).68 G 1.46 +(he en)-3.96 F 1.46(vironment v)-.4 F(ariable)-.25 E .508(DB_HOME may be used as the path of the database home for the interpretation of the) +133 556.8 R F2(dir)3.008 E F0(ar)3.008 E(gument)-.18 E(to)133 568.8 Q F2 +(DbLo)2.547 E(g::open)-.1 E F0 2.547(,a).24 G 2.547(sd)-2.547 G .047 +(escribed in)-2.547 F F2(db_appinit)2.547 E F0 2.547 +(\(3\). Speci\214cally).68 F(,)-.65 E F2(DbLo)2.548 E(g::open)-.1 E F0 +.048(is af)2.548 F .048(fected by the con\214gu-)-.25 F(ration string v) +133 580.8 Q(alue of DB_LOG_DIR.)-.25 E(TMPDIR)108 597.6 Q .956(If the) +133 609.6 R F2(dben)3.456 E(v)-.4 E F0(ar)3.456 E .956(gument to)-.18 F +F2(DbLo)3.456 E(g::open)-.1 E F0 -.1(wa)3.456 G 3.456(sN).1 G .956 +(ULL or not initialized using)-3.456 F F2(db_appinit)3.455 E F0 3.455 +(,t).68 G .955(he en)-3.455 F(viron-)-.4 E .7(ment v)133 621.6 R .7(ariable TMPDIR may be used as the directory in which to create the log, as described in the) +-.25 F F2(DbLo)133 633.6 Q(g::open)-.1 E F0(section abo)2.5 E -.15(ve) +-.15 G(.).15 E F1(ERR)72 650.4 Q(ORS)-.27 E F0 .05(Methods mark)108 +662.4 R .05(ed as returning)-.1 F F2(errno)2.55 E F0 .049(will, by def) +2.55 F .049(ault, thro)-.1 F 2.549(wa)-.25 G 2.549(ne)-2.549 G .049 +(xception that encapsulates the error informa-)-2.699 F 2.5(tion. The) +108 674.4 R(def)2.5 E(ault error beha)-.1 E(vior can be changed, see)-.2 +E F2(DbException)2.5 E F0(\(3\).).24 E(The)108 691.2 Q F2(DbLo)2.5 E +(g::open)-.1 E F0(method may f)2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G F2 +(DbException)A F0(\(3\)).24 E(or return)108 715.2 Q F2(errno)2.5 E F0 +(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: DbLog::close\(3\),)-.25 E +(DbLog::unlink\(3\), atoi\(3\), close\(2\), db_v)108 727.2 Q +(ersion\(3\), fcntl\(2\), f)-.15 E +(\215ush\(3\), lseek\(2\), malloc\(3\), memcp)-.25 E(y\(3\),)-.1 E +(May 10, 1998)278.085 768 Q(7)201.085 E EP +%%Page: 8 8 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 385.52(DbLog\(3\) DbLog\(3\))72 48 R(memset\(3\), mmap\(2\), munmap\(2\), open\(2\), opendir\(3\), read\(2\), readdir\(3\), realloc\(3\), sig\214llset\(3\), sigproc-) +108 84 Q(mask\(2\), stat\(2\), strchr\(3\), strcp)108 96 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), strncmp\(3\), unlink\(2\), and write\(2\).) +-.1 E .524(In addition, the)108 112.8 R/F1 10/Times-Italic@0 SF(DbLo) +3.023 E(g::open)-.1 E F0 .523(method may f)3.023 F .523(ail and thro)-.1 +F 3.023(wa)-.25 G F1(DbException)A F0 .523(\(3\) or return).24 F F1 +(errno)3.023 E F0 .523(for the follo)3.023 F(w-)-.25 E(ing conditions:) +108 124.8 Q([EA)108 141.6 Q(GAIN])-.4 E(The shared memory re)133 153.6 Q +(gion w)-.15 E(as lock)-.1 E(ed and \(repeatedly\) una)-.1 E -.25(va)-.2 +G(ilable.).25 E([EINV)108 170.4 Q(AL])-1.35 E(An in)133 182.4 Q -.25(va) +-.4 G(lid \215ag v).25 E(alue or parameter w)-.25 E(as speci\214ed.)-.1 +E(The DB_THREAD \215ag w)133 206.4 Q(as speci\214ed and spinlocks are not implemented for this architecture.) +-.1 E(The speci\214ed \214le size w)133 230.4 Q(as too lar)-.1 E(ge.) +-.18 E(The)108 247.2 Q F1(DbLo)2.5 E(g::close)-.1 E F0(method may f)2.5 +E(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0(\(3\)).24 E +(or return)108 271.2 Q F1(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5 +(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: close\(2\), fcntl\(2\),)-.25 E -.25 +<668d>108 283.2 S(ush\(3\), munmap\(2\), and strerror\(3\).).25 E(The) +108 300 Q F1(DbLo)2.5 E(g::\215ush)-.1 E F0(method may f)2.5 E +(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0(\(3\)).24 E +(or return)108 324 Q F1(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5 +(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: close\(2\), fcntl\(2\),)-.25 E -.25 +<668d>108 336 S(ush\(3\), fsync\(2\), lseek\(2\), malloc\(3\), memcp).25 +E(y\(3\), memset\(3\), open\(2\), sig\214llset\(3\), sigprocmask\(2\),) +-.1 E(stat\(2\), strcp)108 348 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), unlink\(2\), and write\(2\).) +-.1 E .558(In addition, the)108 364.8 R F1(DbLo)3.058 E(g::\215ush)-.1 E +F0 .558(method may f)3.058 F .558(ail and thro)-.1 F 3.057(wa)-.25 G F1 +(DbException)A F0 .557(\(3\) or return).24 F F1(errno)3.057 E F0 .557 +(for the follo)3.057 F(w-)-.25 E(ing conditions:)108 376.8 Q([EINV)108 +393.6 Q(AL])-1.35 E(An in)133 405.6 Q -.25(va)-.4 G(lid \215ag v).25 E +(alue or parameter w)-.25 E(as speci\214ed.)-.1 E(The)108 422.4 Q F1 +(DbLo)2.5 E(g::g)-.1 E(et)-.1 E F0(method may f)2.5 E(ail and thro)-.1 E +2.5(wa)-.25 G F1(DbException)A F0(\(3\)).24 E(or return)108 446.4 Q F1 +(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: atoi\(3\), close\(2\),)-.25 E +(fcntl\(2\), f)108 458.4 Q(\215ush\(3\), lseek\(2\), malloc\(3\), memcp) +-.25 E +(y\(3\), memset\(3\), open\(2\), opendir\(3\), read\(2\), readdir\(3\),) +-.1 E(realloc\(3\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strchr\(3\), strcp) +108 470.4 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\),)-.1 E +(strncmp\(3\), and unlink\(2\).)108 482.4 Q .39(In addition, the)108 +499.2 R F1(DbLo)2.89 E(g::g)-.1 E(et)-.1 E F0 .39(method may f)2.89 F +.39(ail and thro)-.1 F 2.89(wa)-.25 G F1(DbException)A F0 .39 +(\(3\) or return).24 F F1(errno)2.89 E F0 .39(for the follo)2.89 F(wing) +-.25 E(conditions:)108 511.2 Q([EINV)108 528 Q(AL])-1.35 E(An in)133 540 +Q -.25(va)-.4 G(lid \215ag v).25 E(alue or parameter w)-.25 E +(as speci\214ed.)-.1 E(The DB_FIRST \215ag w)133 564 Q +(as speci\214ed and no log \214les were found.)-.1 E(The)108 580.8 Q F1 +(DbLo)2.5 E(g::\214le)-.1 E F0(method may f)2.5 E(ail and thro)-.1 E 2.5 +(wa)-.25 G F1(DbException)A F0(\(3\)).24 E(or return)108 604.8 Q F1 +(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: close\(2\), fcntl\(2\),)-.25 E -.25 +<668d>108 616.8 S(ush\(3\), malloc\(3\), memcp).25 E(y\(3\), memset\(3\), open\(2\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp) +-.1 E(y\(3\),)-.1 E +(strdup\(3\), strerror\(3\), strlen\(3\), and unlink\(2\).)108 628.8 Q +.383(In addition, the)108 645.6 R F1(DbLo)2.883 E(g::\214le)-.1 E F0 +.384(method may f)2.883 F .384(ail and thro)-.1 F 2.884(wa)-.25 G F1 +(DbException)A F0 .384(\(3\) or return).24 F F1(errno)2.884 E F0 .384 +(for the follo)2.884 F(wing)-.25 E(conditions:)108 657.6 Q([ENOMEM])108 +674.4 Q(The supplied b)133 686.4 Q(uf)-.2 E(fer w)-.25 E +(as too small to hold the log \214le name.)-.1 E(The)108 703.2 Q F1 +(DbLo)2.5 E(g::put)-.1 E F0(method may f)2.5 E(ail and thro)-.1 E 2.5 +(wa)-.25 G F1(DbException)A F0(\(3\)).24 E(or return)108 727.2 Q F1 +(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: close\(2\), fcntl\(2\),)-.25 E +(May 10, 1998)278.085 768 Q(8)201.085 E EP +%%Page: 9 9 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 385.52(DbLog\(3\) DbLog\(3\))72 48 R -.25<668d> +108 84 S(ush\(3\), fsync\(2\), lseek\(2\), malloc\(3\), memcp).25 E +(y\(3\), memset\(3\), open\(2\), sig\214llset\(3\), sigprocmask\(2\),) +-.1 E(stat\(2\), strcp)108 96 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), time\(3\), unlink\(2\), and write\(2\).) +-.1 E .349(In addition, the)108 112.8 R/F1 10/Times-Italic@0 SF(DbLo) +2.849 E(g::put)-.1 E F0 .349(method may f)2.849 F .349(ail and thro)-.1 +F 2.849(wa)-.25 G F1(DbException)A F0 .349(\(3\) or return).24 F F1 +(errno)2.848 E F0 .348(for the follo)2.848 F(wing)-.25 E(conditions:)108 +124.8 Q([EINV)108 141.6 Q(AL])-1.35 E(An in)133 153.6 Q -.25(va)-.4 G +(lid \215ag v).25 E(alue or parameter w)-.25 E(as speci\214ed.)-.1 E +(The record to be logged is lar)133 177.6 Q +(ger than the maximum log record.)-.18 E(The)108 194.4 Q F1(DbLo)2.5 E +(g::unlink)-.1 E F0(method may f)2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G +F1(DbException)A F0(\(3\)).24 E(or return)108 218.4 Q F1(errno)2.5 E F0 +(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: close\(2\), fcntl\(2\),)-.25 E -.25 +<668d>108 230.4 S(ush\(3\), malloc\(3\), memcp).25 E(y\(3\), memset\(3\), mmap\(2\), munmap\(2\), open\(2\), sig\214llset\(3\), sigprocmask\(2\),) +-.1 E(stat\(2\), strcp)108 242.4 Q +(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), and unlink\(2\).)-.1 E +.175(In addition, the)108 259.2 R F1(DbLo)2.675 E(g::unlink)-.1 E F0 +.175(method may f)2.675 F .176(ail and thro)-.1 F 2.676(wa)-.25 G F1 +(DbException)A F0 .176(\(3\) or return).24 F F1(errno)2.676 E F0 .176 +(for the follo)2.676 F(w-)-.25 E(ing conditions:)108 271.2 Q([EB)108 288 +Q(USY])-.1 E(The shared memory re)133 300 Q(gion w)-.15 E +(as in use and the force \215ag w)-.1 E(as not set.)-.1 E(The)108 316.8 +Q F1(DbLo)2.5 E(g::ar)-.1 E -.15(ch)-.37 G(ive).15 E F0(method may f)2.5 +E(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0(\(3\)).24 E +(or return)108 340.8 Q F1(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5 +(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: DbLog::com-)-.25 E +(pare\(3\), DbLog::get\(3\), close\(2\), fcntl\(2\), f)108 352.8 Q +(\215ush\(3\), getcwd\(3\), malloc\(3\), memcp)-.25 E +(y\(3\), memset\(3\), open\(2\),)-.1 E(qsort\(3\), realloc\(3\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strchr\(3\), strcmp\(3\), strcp) +108 364.8 Q(y\(3\), strdup\(3\), str)-.1 E(-)-.2 E +(error\(3\), strlen\(3\), and unlink\(2\).)108 376.8 Q .818 +(In addition, the)108 393.6 R F1(DbLo)3.318 E(g::ar)-.1 E -.15(ch)-.37 G +(ive).15 E F0 .818(method may f)3.318 F .818(ail and thro)-.1 F 3.318 +(wa)-.25 G F1(DbException)A F0 .818(\(3\) or return).24 F F1(errno)3.318 +E F0 .819(for the fol-)3.318 F(lo)108 405.6 Q(wing conditions:)-.25 E +([EINV)108 422.4 Q(AL])-1.35 E(An in)133 434.4 Q -.25(va)-.4 G +(lid \215ag v).25 E(alue or parameter w)-.25 E(as speci\214ed.)-.1 E +(The log w)133 458.4 Q(as corrupted.)-.1 E(The)108 475.2 Q F1(DbLo)2.5 E +(g::db_r)-.1 E -.4(eg)-.37 G(ister).4 E F0(method may f)2.5 E +(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0(\(3\)).24 E +(or return)108 499.2 Q F1(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5 +(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: close\(2\), fcntl\(2\),)-.25 E -.25 +<668d>108 511.2 S +(ush\(3\), fsync\(2\), lseek\(2\), malloc\(3\), memcmp\(3\), memcp).25 E +(y\(3\), memset\(3\), open\(2\), realloc\(3\), sig-)-.1 E +(\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp)108 523.2 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), time\(3\), unlink\(2\), and) +-.1 E(write\(2\).)108 535.2 Q .944(In addition, the)108 552 R F1(DbLo) +3.444 E(g::db_r)-.1 E -.4(eg)-.37 G(ister).4 E F0 .944(method may f) +3.444 F .944(ail and thro)-.1 F 3.444(wa)-.25 G F1(DbException)A F0 .944 +(\(3\) or return).24 F F1(errno)3.444 E F0 .944(for the)3.444 F(follo) +108 564 Q(wing conditions:)-.25 E([EINV)108 580.8 Q(AL])-1.35 E(An in) +133 592.8 Q -.25(va)-.4 G(lid \215ag v).25 E(alue or parameter w)-.25 E +(as speci\214ed.)-.1 E(The)108 609.6 Q F1(DbLo)2.5 E(g::db_unr)-.1 E -.4 +(eg)-.37 G(ister).4 E F0(method may f)2.5 E(ail and thro)-.1 E 2.5(wa) +-.25 G F1(DbException)A F0(\(3\)).24 E(or return)108 633.6 Q F1(errno) +2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: close\(2\), fcntl\(2\),)-.25 E -.25 +<668d>108 645.6 S(ush\(3\), fsync\(2\), lseek\(2\), malloc\(3\), memcp) +.25 E +(y\(3\), memset\(3\), open\(2\), sig\214llset\(3\), sigprocmask\(2\),) +-.1 E(stat\(2\), strcp)108 657.6 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), time\(3\), unlink\(2\), and write\(2\).) +-.1 E .278(In addition, the)108 674.4 R F1(DbLo)2.778 E(g::db_unr)-.1 E +-.4(eg)-.37 G(ister).4 E F0 .278(method may f)2.778 F .277(ail and thro) +-.1 F 2.777(wa)-.25 G F1(DbException)A F0 .277(\(3\) or return).24 F F1 +(errno)2.777 E F0 .277(for the)2.777 F(follo)108 686.4 Q +(wing conditions:)-.25 E([EINV)108 703.2 Q(AL])-1.35 E(An in)133 715.2 Q +-.25(va)-.4 G(lid \215ag v).25 E(alue or parameter w)-.25 E +(as speci\214ed.)-.1 E(May 10, 1998)278.085 768 Q(9)201.085 E EP +%%Page: 10 10 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 385.52(DbLog\(3\) DbLog\(3\))72 48 R/F1 9 +/Times-Bold@0 SF -.09(BU)72 84 S(GS).09 E F0 .128 +(The log \214les are not machine architecture independent.)108 96 R +(Speci\214cally)5.128 E 2.628(,t)-.65 G .128 +(heir metadata are not stored in a \214x)-2.628 F(ed)-.15 E(byte order) +108 108 Q(.)-.55 E F1(SEE ALSO)72 124.8 Q/F2 10/Times-Italic@0 SF(db_ar) +108 136.8 Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E F2(db_c)2.5 E(hec) +-.15 E(kpoint)-.2 E F0(\(1\),).68 E F2(db_deadloc)2.5 E(k)-.2 E F0 +(\(1\),).67 E F2(db_dump)2.5 E F0(\(1\),).19 E F2(db_load)2.5 E F0 +(\(1\),).77 E F2(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F2 +(db_stat)2.5 E F0(\(1\),).68 E F2(db_intr)108 148.8 Q(o)-.45 E F0 +(\(3\),).18 E F2(db_internal)2.5 E F0(\(3\),).51 E F2(db_thr)2.5 E(ead) +-.37 E F0(\(3\),).77 E F2(Db)2.5 E F0(\(3\),).23 E F2(Dbc)2.5 E F0 +(\(3\),).31 E F2(DbEn)2.5 E(v)-.4 E F0(\(3\),).32 E F2(DbException)2.5 E +F0(\(3\),).24 E F2(DbInfo)2.5 E F0(\(3\),).18 E F2(DbLoc)108 160.8 Q(k) +-.2 E F0(\(3\),).67 E F2(DbLoc)2.5 E(kT)-.2 E(ab)-.92 E F0(\(3\),).23 E +F2(DbLo)2.5 E(g)-.1 E F0(\(3\),).22 E F2(DbLsn)2.5 E F0(\(3\),).24 E F2 +(DbMpool)2.5 E F0(\(3\),).51 E F2(DbMpoolF)2.5 E(ile)-.45 E F0(\(3\),) +.18 E F2(Dbt)2.5 E F0(\(3\),).68 E F2(DbTxn)2.5 E F0(\(3\),).24 E F2 +(DbTxnMgr)108 172.8 Q F0(\(3\)).73 E(May 10, 1998)278.085 768 Q(10) +196.085 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/mancxx.ps/DbLsn.ps b/mozilla/db/man/mancxx.ps/DbLsn.ps new file mode 100644 index 00000000000..9b41c843ba3 --- /dev/null +++ b/mozilla/db/man/mancxx.ps/DbLsn.ps @@ -0,0 +1,249 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:36 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 1 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(DbLsn \255 Log sequence numbers)108 40.8 Q F0(SYNOPSIS)72 57.6 Q/F2 10 +/Times-Bold@0 SF(#include )108 69.6 Q F0(DESCRIPTION)72 86.4 Q +F1 1.02(The DB library is a f)108 98.4 R 1.019 +(amily of classes that pro)-.1 F 1.019 +(vides a modular programming interf)-.15 F 1.019 +(ace to transactions and)-.1 F 1.377(record-oriented \214le access.)108 +110.4 R 1.378(The library includes support for transactions, locking, logging and \214le page) +6.377 F .443(caching, as well as v)108 122.4 R .443(arious inde)-.25 F +-.15(xe)-.15 G 2.943(da).15 G .442(ccess methods.)-2.943 F(Man)5.442 E +2.942(yo)-.15 G 2.942(ft)-2.942 G .442 +(he classes \(e.g., the \214le page caching class\))-2.942 F .4(are useful independent of the other DB classes, although some classes are e) +108 134.4 R .4(xplicitly based on other classes)-.15 F +(\(e.g., transactions and logging\).)108 146.4 Q -.15(Fo)5 G 2.5(rag).15 +G(eneral description of the DB package, see)-2.5 E/F3 10/Times-Italic@0 +SF(db_intr)2.5 E(o)-.45 E F1(\(3\).).18 E +(This manual page describes the DbLsn class.)108 163.2 Q 2.702(AD)108 +180 S .201(bLsn is a "log sequence number" that is fully encapsulated.) +-2.702 F .201(The class itself has no methods, other than)5.201 F 2.568 +(ad)108 192 S(ef)-2.568 E .068(ault constructor)-.1 F 2.568(,s)-.4 G +2.568(ot)-2.568 G .068(here is no w)-2.568 F .069 +(ay for the user to manipulate its data directly)-.1 F 5.069(.I)-.65 G +2.569(ti)-5.069 G 2.569(si)-2.569 G .069(nitialized and used)-2.569 F +(by methods in)108 204 Q F3(DbLo)2.5 E(g)-.1 E F1(\(3\) and).22 E F3 +(DbMpool)2.5 E F1 2.5(\(3\). These).51 F(methods al)2.5 E -.1(wa)-.1 G +(ys accept a pointer to a DbLsn.).1 E F0(SEE ALSO)72 220.8 Q F3(db_ar) +108 232.8 Q -.15(ch)-.37 G(ive).15 E F1(\(1\),).18 E F3(db_c)2.5 E(hec) +-.15 E(kpoint)-.2 E F1(\(1\),).68 E F3(db_deadloc)2.5 E(k)-.2 E F1 +(\(1\),).67 E F3(db_dump)2.5 E F1(\(1\),).19 E F3(db_load)2.5 E F1 +(\(1\),).77 E F3(db_r)2.5 E(eco)-.37 E(ver)-.1 E F1(\(1\),).73 E F3 +(db_stat)2.5 E F1(\(1\),).68 E F3(db_intr)108 244.8 Q(o)-.45 E F1 +(\(3\),).18 E F3(db_internal)2.5 E F1(\(3\),).51 E F3(db_thr)2.5 E(ead) +-.37 E F1(\(3\),).77 E F3(Db)2.5 E F1(\(3\),).23 E F3(Dbc)2.5 E F1 +(\(3\),).31 E F3(DbEn)2.5 E(v)-.4 E F1(\(3\),).32 E F3(DbException)2.5 E +F1(\(3\),).24 E F3(DbInfo)2.5 E F1(\(3\),).18 E F3(DbLoc)108 256.8 Q(k) +-.2 E F1(\(3\),).67 E F3(DbLoc)2.5 E(kT)-.2 E(ab)-.92 E F1(\(3\),).23 E +F3(DbLo)2.5 E(g)-.1 E F1(\(3\),).22 E F3(DbLsn)2.5 E F1(\(3\),).24 E F3 +(DbMpool)2.5 E F1(\(3\),).51 E F3(DbMpoolF)2.5 E(ile)-.45 E F1(\(3\),) +.18 E F3(Dbt)2.5 E F1(\(3\),).68 E F3(DbTxn)2.5 E F1(\(3\),).24 E F3 +(DbTxnMgr)108 268.8 Q F1(\(3\)).73 E(1)535 768 Q EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/mancxx.ps/DbMpool.ps b/mozilla/db/man/mancxx.ps/DbMpool.ps new file mode 100644 index 00000000000..89e4f2ef2eb --- /dev/null +++ b/mozilla/db/man/mancxx.ps/DbMpool.ps @@ -0,0 +1,815 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:36 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 7 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(DbMpool \255 shared memory b)108 40.8 Q(uf)-.2 E(fer pool)-.25 E F0 +(SYNOPSIS)72 57.6 Q/F2 10/Times-Bold@0 SF(#include )108 69.6 Q +(static int)108 93.6 Q(DbMpool::open\(char *dir)108 105.6 Q(,)-.92 E +(u_int32_t \215ags, int mode, DbEn)158 117.6 Q 2.5(v*)-.4 G(dben)-2.5 E +1.1 -.55(v, D)-.4 H(bMpool **r).55 E(egionp\);)-.18 E(int)108 141.6 Q +(DbMpool::close\(\);)108 153.6 Q(static int)108 177.6 Q +(DbMpool::unlink\(const char *dir)108 189.6 Q 2.5(,i)-.92 G(nt f)-2.5 E +(or)-.25 E(ce, DbEn)-.18 E 2.5(v*)-.4 G(\);)-2.5 E(int)108 213.6 Q +(DbMpool::db_r)108 225.6 Q(egister\(int ftype,)-.18 E +(int \(*pgin\)\(db_pgno_t pgno, v)158 237.6 Q(oid *pgaddr)-.1 E 2.5(,D) +-.92 G(bt *pgcookie\),)-2.5 E(int \(*pgout\)\(db_pgno_t pgno, v)158 +249.6 Q(oid *pgaddr)-.1 E 2.5(,D)-.92 G(bt *pgcookie\)\);)-2.5 E(int)108 +273.6 Q(DbMpool::trickle\(int pct, int *nwr)108 285.6 Q(otep\);)-.18 E +(int)108 309.6 Q(DbMpool::sync\(LSN *lsn\);)108 321.6 Q(int)108 345.6 Q +(DbMpool::stat\(DB_MPOOL_ST)108 357.6 Q 1.9 -.95(AT *)-.9 H(*gsp,).95 E +(DB_MPOOL_FST)158 369.6 Q 1.9 -.95(AT *)-.9 H(\(*fsp\)[], v).95 E +(oid *\(*db_malloc\)\(size_t\)\);)-.1 E F0(DESCRIPTION)72 386.4 Q F1 +1.02(The DB library is a f)108 398.4 R 1.019(amily of classes that pro) +-.1 F 1.019(vides a modular programming interf)-.15 F 1.019 +(ace to transactions and)-.1 F 1.377(record-oriented \214le access.)108 +410.4 R 1.378(The library includes support for transactions, locking, logging and \214le page) +6.377 F .443(caching, as well as v)108 422.4 R .443(arious inde)-.25 F +-.15(xe)-.15 G 2.943(da).15 G .442(ccess methods.)-2.943 F(Man)5.442 E +2.942(yo)-.15 G 2.942(ft)-2.942 G .442 +(he classes \(e.g., the \214le page caching class\))-2.942 F .4(are useful independent of the other DB classes, although some classes are e) +108 434.4 R .4(xplicitly based on other classes)-.15 F +(\(e.g., transactions and logging\).)108 446.4 Q -.15(Fo)5 G 2.5(rag).15 +G(eneral description of the DB package, see)-2.5 E/F3 10/Times-Italic@0 +SF(db_intr)2.5 E(o)-.45 E F1(\(3\).).18 E(This manual page describes the speci\214c details of the memory pool interf) +108 463.2 Q(ace.)-.1 E(The)108 480 Q F3(DbMpool)2.7 E F1 .2(\(3\) and) +.51 F F3(DbMpoolF)2.7 E(ile)-.45 E F1 .2 +(\(3\) classes are the library interf).18 F .2(ace intended to pro)-.1 F +.2(vide general-purpose,)-.15 F .46(page-oriented b)108 492 R(uf)-.2 E +.46(fer management of one or more \214les.)-.25 F .46 +(While designed to w)5.46 F .46(ork with the other Db classes,)-.1 F +.563(this class is also useful for more general purposes.)108 504 R .563 +(The memory pools \(DbMpool')5.563 F .563(s\) are referred to in this) +-.55 F .846(document as simply `)108 516 R(`pools')-.74 E 3.346 +('. Pools)-.74 F .847(may be shared between processes.)3.346 F .847 +(Pools are usually \214lled by pages)5.847 F .166 +(from one or more \214les \(DbMpoolFile')108 528 R 2.665(s\). P)-.55 F +.165(ages in the pool are replaced in LR)-.15 F 2.665(U\()-.4 G .165 +(least-recently-used\) order)-2.665 F(,)-.4 E 1.199(with each ne)108 540 +R 3.699(wp)-.25 G 1.199 +(age replacing the page that has been unused the longest.)-3.699 F -.15 +(Pa)6.2 G 1.2(ges retrie).15 F -.15(ve)-.25 G 3.7(df).15 G 1.2 +(rom the pool)-3.7 F(using)108 552 Q F3(DbMpoolF)3.258 E(ile::g)-.45 E +(et)-.1 E F1 .758(are `)3.258 F(`pinned')-.74 E 3.258('i)-.74 G 3.258 +(nt)-3.258 G .758(he pool, by def)-3.258 F .757(ault, until the)-.1 F +3.257(ya)-.15 G .757(re returned to the pool')-3.257 F 3.257(sc)-.55 G +(ontrol)-3.257 E(using the)108 564 Q F3(DbMpoolF)2.5 E(ile::put)-.45 E +F1(method.)2.5 E F3(DbMpool::open)92 580.8 Q F1(The)108 592.8 Q F3 +(DbMpool::open)3.035 E F1 .535(method copies a pointer)3.035 F 3.035(,t) +-.4 G 3.035(ot)-3.035 G .535(he memory pool identi\214ed by the)-3.035 F +F2(dir)3.035 E(ectory)-.18 E F3(dir)3.035 E F1 3.035(,i).73 G .535 +(nto the)-3.035 F(memory location referenced by)108 604.8 Q F3 -.37(re) +2.5 G(gionp)-.03 E F1(.).19 E 2.668(If the)108 621.6 R F3(dben)5.168 E +(v)-.4 E F1(ar)5.168 E 2.668(gument to)-.18 F F3(DbMpool::open)5.168 E +F1 -.1(wa)5.168 G 5.168(si).1 G 2.668(nitialized using)-5.168 F F3(DbEn) +5.168 E(v::appinit)-.4 E F1(,).68 E F3(dir)5.167 E F1 2.667 +(is interpreted as)5.167 F(described by)108 633.6 Q F3(DbEn)2.5 E(v)-.4 +E F1(\(3\).).32 E .667(Otherwise, if)108 650.4 R F3(dir)3.167 E F1 .668 +(is not NULL, it is interpreted relati)3.167 F .968 -.15(ve t)-.25 H +3.168(ot).15 G .668(he current w)-3.168 F .668 +(orking directory of the process.)-.1 F(If)5.668 E F3(dir)108 662.4 Q F1 +2.388(is NULL, the follo)4.888 F 2.388(wing en)-.25 F 2.388(vironment v) +-.4 F 2.388(ariables are check)-.25 F 2.387(ed in order: `)-.1 F +(`TMPDIR')-.74 E 2.387(', `)-.74 F(`TEMP')-.74 E 2.387(', and)-.74 F +-.74(``)108 674.4 S(TMP').74 E 2.545('. If)-.74 F .045 +(one of them is set, memory pool \214les are created relati)2.545 F .346 +-.15(ve t)-.25 H 2.546(ot).15 G .046(he directory it speci\214es.)-2.546 +F .046(If none of)5.046 F 1.501 +(them are set, the \214rst possible one of the follo)108 686.4 R 1.5 +(wing directories is used:)-.25 F F3(/var/tmp)4 E F1(,).19 E F3 +(/usr/tmp)4 E F1(,).19 E F3(/temp)4 E F1(,).19 E F3(/tmp)4 E F1(,).19 E +F3(C:/temp)108 698.4 Q F1(and)2.5 E F3(C:/tmp)2.5 E F1(.).19 E .942(All \214les associated with the memory pool are created in this directory) +108 715.2 R 5.943(.T)-.65 G .943(his directory must already e)-5.943 F +(xist)-.15 E 1.133(when DbMpool::open is called.)108 727.2 R 1.133 +(If the memory pool already e)6.133 F 1.132(xists, the process must ha) +-.15 F 1.432 -.15(ve p)-.2 H 1.132(ermission to).15 F(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 364.4(DbMpool\(3\) DbMpool\(3\))72 48 R .27 +(read and write the e)108 84 R .27(xisting \214les.)-.15 F .27 +(If the memory pool does not already e)5.27 F .27 +(xist, it is optionally created and ini-)-.15 F(tialized.)108 96 Q(The) +108 112.8 Q/F1 10/Times-Italic@0 SF<8d61>3.761 E(gs)-.1 E F0(and)3.761 E +F1(mode)3.761 E F0(ar)3.761 E 1.261(guments specify ho)-.18 F 3.761 +<778c>-.25 G 1.26(les will be opened and/or created when the)-3.761 F +3.76(yd)-.15 G(on')-3.76 E 3.76(ta)-.18 G(lready)-3.76 E -.15(ex)108 +124.8 S 2.5(ist. The).15 F(\215ags v)2.5 E(alue is speci\214ed by)-.25 E +/F2 10/Times-Bold@0 SF(or)2.5 E F0 +('ing together one or more of the follo)A(wing v)-.25 E(alues:)-.25 E +(DB_CREA)108 141.6 Q(TE)-1.11 E .483(Create an)133 153.6 R 2.983(yu)-.15 +G .483(nderlying \214les, as necessary)-2.983 F 5.483(.I)-.65 G 2.983 +(ft)-5.483 G .483(he \214les do not already e)-2.983 F .483 +(xist and the DB_CREA)-.15 F .484(TE \215ag)-1.11 F +(is not speci\214ed, the call will f)133 165.6 Q(ail.)-.1 E +(DB_MPOOL_PRIV)108 182.4 Q -1.11(AT)-1.35 G(E)1.11 E .83(Create a pri) +133 194.4 R -.25(va)-.25 G .83(te MPOOL that is not shared with an).25 F +3.329(yo)-.15 G .829(ther process \(although it may be shared with) +-3.329 F(other threads\).)133 206.4 Q(DB_NOMMAP)108 223.2 Q(Al)133 235.2 +Q -.1(wa)-.1 G 1.256(ys cop).1 F 3.756<798c>-.1 G 1.257(les in this memory pool into the local cache instead of mapping them into process) +-3.756 F(memory \(see the description of the)133 247.2 Q F1(mp_mmapsize) +2.5 E F0(\214eld of the DbEn)2.5 E 2.5(vo)-.4 G +(bject for further information\).)-2.5 E(DB_THREAD)108 276 Q .028 +(Cause the DbMpool handle returned by the)133 288 R F1(DbMpool::open) +2.528 E F0 .028(method to be useable by multiple threads)2.528 F +(within a single address space, i.e., to be `)133 300 Q(`free-threaded') +-.74 E('.)-.74 E .111(All \214les created by the memory pool subsystem \(other than \214les created by the) +108 316.8 R F1(memp_fopen)2.612 E F0 .112(method, which)2.612 F .545 +(are separately speci\214ed\) are created with mode)108 328.8 R F1(mode) +3.045 E F0 .545(\(as described in)3.045 F F1 -.15(ch)3.045 G(mod).15 E +F0 .545(\(2\)\) and modi\214ed by the pro-).77 F .323(cess' umask v)108 +340.8 R .323(alue at the time of creation \(see)-.25 F F1(umask)2.823 E +F0 2.823(\(2\)\). The).67 F .323(group o)2.823 F .324 +(wnership of created \214les is based on)-.25 F +(the system and directory def)108 352.8 Q +(aults, and is not further speci\214ed by DB.)-.1 E .33(The memory pool subsystem is con\214gured based on which set methods ha) +108 369.6 R .63 -.15(ve b)-.2 H .33(een used.).15 F .33(It is e)5.33 F +.33(xpected that)-.15 F .994(applications will use a single DbEn)108 +381.6 R 3.494(vo)-.4 G .994(bject as the ar)-3.494 F .995 +(gument to all of the subsystems in the DB package.)-.18 F .62 +(The \214elds of the DbEn)108 393.6 R 3.12(vo)-.4 G .62(bject used by) +-3.12 F F1(DbMpool::open)3.119 E F0 .619(are described belo)3.119 F +4.419 -.65(w. A)-.25 H 3.119(sr).65 G .619(eferences to the DbEn)-3.119 +F(v)-.4 E .829(object may be maintained by)108 405.6 R F1(DbMpool::open) +3.329 E F0 3.329(,i).24 G 3.329(ti)-3.329 G 3.329(sn)-3.329 G .829 +(ecessary that the DbEn)-3.329 F 3.33(vo)-.4 G .83 +(bject and memory it refer)-3.33 F(-)-.2 E .446(ences be v)108 417.6 R +.446(alid until the object is destro)-.25 F 2.946(yed. An)-.1 F 2.946 +(yo)-.15 G 2.946(ft)-2.946 G .446(he DbEn)-2.946 F 2.946<768c>-.4 G .446 +(elds that are not e)-2.946 F .445(xplicitly set will def)-.15 F(ault) +-.1 E(to appropriate v)108 429.6 Q(alues.)-.25 E .516(The follo)108 +446.4 R .516(wing \214elds in the DbEn)-.25 F 3.016(vo)-.4 G .516(bject may be initialized, using the appropriate set method, before call-) +-3.016 F(ing)108 458.4 Q F1(DbMpool::open)2.5 E F0(:).24 E -.2(vo)108 +487.2 S(id *\(*db_errcall\)\(char *db_errpfx, char *b).2 E(uf)-.2 E +(fer\);)-.25 E(FILE *db_err\214le;)108 499.2 Q(const char *db_errpfx;) +108 511.2 Q(class ostream *db_error_stream;)108 523.2 Q(int db_v)108 +535.2 Q(erbose;)-.15 E(The error \214elds of the DbEn)133 547.2 Q 2.5 +(vb)-.4 G(eha)-2.5 E .3 -.15(ve a)-.2 H 2.5(sd).15 G(escribed for)-2.5 E +F1(DbEn)2.5 E(v)-.4 E F0(\(3\).).32 E(size_t mp_mmapsize;)108 564 Q +1.631 +(Files that are opened read-only in the pool \(and that satisfy a fe)133 +576 R 4.13(wo)-.25 G 1.63(ther criteria\) are, by def)-4.13 F(ault,)-.1 +E .04(mapped into the process address space instead of being copied into the local cache.) +133 588 R .041(This can result in)5.041 F(better)133 600 Q 1.331 +(-than-usual performance, as a)-.2 F -.25(va)-.2 G 1.331 +(ilable virtual memory is normally much lar).25 F 1.33 +(ger than the local)-.18 F .85(cache, and page f)133 612 R .85 +(aults are f)-.1 F .851(aster than page cop)-.1 F .851(ying on man)-.1 F +3.351(ys)-.15 G 3.351(ystems. Ho)-3.351 F(we)-.25 E -.15(ve)-.25 G 1.651 +-.4(r, i).15 H 3.351(nt).4 G .851(he presence of)-3.351 F .262 +(limited virtual memory it can cause resource starv)133 624 R .262 +(ation, and in the presence of lar)-.25 F .261(ge databases, it can)-.18 +F .636(result in immense process sizes.)133 636 R(If)5.636 E F1 +(mp_mmapsize)3.136 E F0 .636 +(is non-zero, it speci\214es the maximum \214le size, in)3.136 F +(bytes, for a \214le to be mapped into the process address space.)133 +648 Q(By def)5 E(ault, it is set to 10Mb)-.1 E(.)-.4 E(size_t mp_size;) +108 664.8 Q .757(The suggested size of the pool, in bytes.)133 676.8 R +.756(This should be the size of the normal w)5.756 F .756 +(orking data set of)-.1 F 1.501(the application, with some small amount of additional memory for unusual situations.) +133 688.8 R 1.502(\(Note, the)6.502 F -.1(wo)133 700.8 S .324(rking set is not the same as the number of simultaneously referenced pages, and should be quite a) +.1 F .548(bit lar)133 712.8 R 3.048(ger!\) The)-.18 F(def)3.048 E .548(ault cache size is 128K bytes \(16 8K byte pages\), and may not be less than 20K) +-.1 F(bytes.)133 724.8 Q(May 10, 1998)278.085 768 Q(2)201.085 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 364.4(DbMpool\(3\) DbMpool\(3\))72 48 R(The)108 +84 Q/F1 10/Times-Italic@0 SF(DbMpool::open)2.596 E F0 .096(method thro) +2.596 F .096(ws a)-.25 F F1(DbException)2.596 E F0 .095 +(\(3\) or returns the v).24 F .095(alue of)-.25 F F1(errno)2.595 E F0 +.095(on f)2.595 F .095(ailure and 0 on suc-)-.1 F(cess.)108 96 Q F1 +(DbMpool::close)92 112.8 Q F0(The)108 124.8 Q F1(DbMpool::close)4.73 E +F0 2.231 +(method closes the pool indicated by the DbMpool object, as returned by) +4.73 F F1(DbM-)4.731 E(pool::open)108 136.8 Q F0 6.749(.T).24 G 1.748 +(his method does not imply a call to)-6.749 F F1(DbMpoolF)4.248 E +(ile::sync)-.45 E F0 4.248(,b).31 G 1.748(ut does imply a call to)-4.448 +F F1(DbM-)4.248 E(poolF)108 148.8 Q(ile::close)-.45 E F0 1.578(for an) +4.078 F 4.078(yr)-.15 G 1.579 +(emaining open DbMpoolFile objects returned to this process by calls to) +-4.078 F F1(DbM-)4.079 E(poolF)108 160.8 Q(ile::open)-.45 E F0(.).24 E +2.744(In addition, if the)108 177.6 R F1(dir)5.244 E F0(ar)5.244 E 2.744 +(gument to)-.18 F F1(DbMpool::open)5.244 E F0 -.1(wa)5.244 G 5.244(sN).1 +G 2.744(ULL and)-5.244 F F1(dben)5.244 E(v)-.4 E F0 -.1(wa)5.244 G 5.244 +(sn).1 G 2.744(ot initialized using)-5.244 F F1(DbEn)108 189.6 Q +(v::appinit)-.4 E F0 2.724(,a).68 G .224 +(ll \214les created for this shared re)-2.724 F .225(gion will be remo) +-.15 F -.15(ve)-.15 G .225(d, as if).15 F F1(DbMpool::unlink)2.725 E F0 +.225(were called.)2.725 F .188 +(When multiple threads are using the DbMpool handle concurrently)108 +206.4 R 2.687(,o)-.65 G .187(nly a single thread may call the)-2.687 F +F1(DbM-)2.687 E(pool::close)108 218.4 Q F0(method.)2.5 E(The)108 235.2 Q +F1(DbMpool::close)2.53 E F0 .03(method thro)2.53 F .03(ws a)-.25 F F1 +(DbException)2.53 E F0 .03(\(3\) or returns the v).24 F .03(alue of)-.25 +F F1(errno)2.53 E F0 .03(on f)2.53 F .03(ailure and 0 on suc-)-.1 F +(cess.)108 247.2 Q F1(DbMpool::unlink)92 276 Q F0(The)108 288 Q F1 +(DbMpool::unlink)3.147 E F0 .647(method destro)3.147 F .646 +(ys the memory pool identi\214ed by the directory)-.1 F F1(dir)3.146 E +F0 3.146(,r).73 G(emo)-3.146 E .646(ving all \214les)-.15 F .732 +(used to implement the memory pool.)108 300 R .732(\(The directory)5.732 +F F1(dir)3.232 E F0 .732(is not remo)3.232 F -.15(ve)-.15 G 3.233 +(d.\) If).15 F .733(there are processes that ha)3.233 F -.15(ve)-.2 G +(called)108 312 Q F1(DbMpool::open)3.207 E F0 .707(without calling)3.207 +F F1(DbMpool::close)3.207 E F0 .706 +(\(i.e., there are processes currently using the mem-)3.207 F .16 +(ory pool\),)108 324 R F1(DbMpool::unlink)2.66 E F0 .16(will f)2.66 F +.16(ail without further action, unless the force \215ag is set, in which case) +-.1 F F1(DbM-)2.66 E(pool::unlink)108 336 Q F0 .377 +(will attempt to remo)2.877 F .676 -.15(ve t)-.15 H .376 +(he memory pool \214les re).15 F -.05(ga)-.15 G .376(rdless of an).05 F +2.876(yp)-.15 G .376(rocesses still using the mem-)-2.876 F(ory pool.) +108 348 Q .766(The result of attempting to forcibly destro)108 364.8 R +3.266(yt)-.1 G .766(he re)-3.266 F .766(gion when a process has the re) +-.15 F .766(gion open is unspeci\214ed.)-.15 F 1.232 +(Processes using a shared memory re)108 376.8 R 1.232 +(gion maintain an open \214le descriptor for it.)-.15 F 1.231 +(On UNIX systems, the)6.232 F(re)108 388.8 Q .473(gion remo)-.15 F -.25 +(va)-.15 G 2.973(ls).25 G .473(hould succeed and processes that ha) +-2.973 F .773 -.15(ve a)-.2 H .473(lready joined the re).15 F .473 +(gion should continue to run in)-.15 F .098(the re)108 400.8 R .098 +(gion without change, ho)-.15 F(we)-.25 E -.15(ve)-.25 G 2.598(rp).15 G +.097(rocesses attempting to join the memory pool will either f)-2.598 F +.097(ail or attempt)-.1 F .586(to create a ne)108 412.8 R 3.086(wr)-.25 +G -.15(eg)-3.086 G 3.086(ion. On).15 F .586(other systems, e.g., WNT) +3.086 F 3.086(,w)-.74 G .586(here the)-3.086 F F1(unlink)3.086 E F0 .587 +(\(2\) system call will f).67 F .587(ail if an)-.1 F 3.087(yp)-.15 G +(ro-)-3.087 E(cess has an open \214le descriptor for the \214le, the re) +108 424.8 Q(gion remo)-.15 E -.25(va)-.15 G 2.5(lw).25 G(ill f)-2.5 E +(ail.)-.1 E .93(In the case of catastrophic or system f)108 441.6 R .929 +(ailure, database reco)-.1 F -.15(ve)-.15 G .929 +(ry must be performed \(see).15 F F1(db_r)3.429 E(eco)-.37 E(ver)-.1 E +F0 .929(\(1\) or).73 F .439(the DB_RECO)108 453.6 R .439 +(VER and DB_RECO)-.5 F(VER_F)-.5 E -1.21 -1.11(AT A)-.74 H 2.939<4c8d> +1.11 G .439(ags to)-2.939 F F1(DbEn)2.939 E(v::appinit)-.4 E F0 2.939 +(\(3\)\). Alternati).68 F -.15(ve)-.25 G(ly).15 E 2.939(,i)-.65 G 2.939 +(fr)-2.939 G(eco)-2.939 E -.15(ve)-.15 G .439(ry is).15 F 1.108 +(not required because no database state is maintained across f)108 465.6 +R 1.108(ailures, it is possible to clean up a memory)-.1 F .488 +(pool by remo)108 477.6 R .488 +(ving all of the \214les in the directory speci\214ed to the)-.15 F F1 +(DbMpool::open)2.988 E F0 .489(method, as memory pool)2.989 F .252 +(\214les are ne)108 489.6 R -.15(ve)-.25 G 2.752(rc).15 G .252 +(reated in an)-2.752 F 2.751(yd)-.15 G .251 +(irectory other than the one speci\214ed to)-2.751 F F1(DbMpool::open) +2.751 E F0 5.251(.N).24 G .251(ote, ho)-5.251 F(we)-.25 E -.15(ve)-.25 G +1.051 -.4(r, t).15 H(hat).4 E(this has the potential to remo)108 501.6 Q +.3 -.15(ve \214)-.15 H +(les created by the other DB subsystems in this database en).15 E +(vironment.)-.4 E(The)108 518.4 Q F1(DbMpool::unlink)3.451 E F0 .951 +(method thro)3.451 F .951(ws a)-.25 F F1(DbException)3.451 E F0 .951 +(\(3\) or returns the v).24 F .951(alue of)-.25 F F1(errno)3.451 E F0 +.952(on f)3.451 F .952(ailure and 0 on)-.1 F(success.)108 530.4 Q F1 +(DbMpool::db_r)92 547.2 Q -.4(eg)-.37 G(ister).4 E F0(The)108 559.2 Q F1 +(DbMpool::db_r)3.745 E -.4(eg)-.37 G(ister).4 E F0 1.245(method re)3.745 +F 1.245(gisters page-in and page-out functions for \214les of type)-.15 +F F1(ftype)3.745 E F0 1.245(in the)3.745 F(speci\214ed pool.)108 571.2 Q +.434(If the)108 588 R F1(pgin)2.934 E F0 .435(function is non-NULL, it is called each time a page is read into the memory pool from a \214le of) +2.934 F(type)108 600 Q F1(ftype)3.361 E F0 3.361(,o).18 G 3.361(rap) +-3.361 G .861(age is created for a \214le of type)-3.361 F F1(ftype)3.36 +E F0 .86(\(see the DB_MPOOL_CREA)3.36 F .86(TE \215ag for the)-1.11 F F1 +(DbM-)3.36 E(poolF)108 612 Q(ile::g)-.45 E(et)-.1 E F0 2.987 +(method\). If)2.987 F(the)2.988 E F1(pgout)2.988 E F0 .488(function is non-NULL, it is called each time a page is written to a \214le) +2.988 F(of type)108 624 Q F1(ftype)2.5 E F0(.).18 E .082(Both the)108 +640.8 R F1(pgin)2.582 E F0(and)2.582 E F1(pgout)2.582 E F0 .082 +(functions are called with the page number)2.582 F 2.582(,ap)-.4 G .082 +(ointer to the page being read or writ-)-2.582 F 1.277(ten, and an)108 +652.8 R 3.777(ya)-.15 G -.18(rg)-3.777 G(ument).18 E F1(pgcookie)3.777 E +F0 1.277(that w)3.777 F 1.277(as speci\214ed to the)-.1 F F1(DbMpoolF) +3.777 E(ile::open)-.45 E F0 1.278(method when the \214le w)3.778 F(as) +-.1 E 3.01(opened. The)108 664.8 R F1(pgin)3.01 E F0(and)3.01 E F1 +(pgout)3.01 E F0 .51 +(functions should return 0 on success, and an applicable non-zero)3.01 F +F1(errno)3.01 E F0 -.25(va)3.01 G(lue).25 E(on f)108 676.8 Q +(ailure, in which case the)-.1 E F1(DbMpool)2.5 E F0 +(method calling it will also f)2.5 E(ail, returning that)-.1 E F1(errno) +2.5 E F0 -.25(va)2.5 G(lue.).25 E .448(The purpose of the)108 693.6 R F1 +(DbMpool::db_r)2.948 E -.4(eg)-.37 G(ister).4 E F0 .449 +(method is to support processing when pages are entered into, or)2.948 F +.274(\215ushed from, the pool.)108 705.6 R 2.774<418c>5.274 G .274 +(le type must be speci\214ed to mak)-2.774 F 2.774(ei)-.1 G 2.774(tp) +-2.774 G .274(ossible for unrelated threads or processes,)-2.774 F 2.8 +(that are sharing a pool, to e)108 717.6 R 2.801(vict each other')-.25 F +5.301(sp)-.55 G 2.801(ages from the pool.)-5.301 F 2.801 +(Applications should call)7.801 F F1(DbM-)5.301 E(pool::db_r)108 729.6 Q +-.4(eg)-.37 G(ister).4 E F0 2.509(,d).73 G .009(uring initialization, for each type of \214le requiring input or output processing that will be) +-2.509 F(May 10, 1998)278.085 768 Q(3)201.085 E EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 364.4(DbMpool\(3\) DbMpool\(3\))72 48 R .035 +(sharing the underlying pool.)108 84 R .035(\(No re)5.035 F .036(gistry is necessary for the standard access method types, btree, hash and) +-.15 F(recno, as)108 96 Q/F1 10/Times-Italic@0 SF(Db::open)2.5 E F0 +(\(3\) re).24 E(gisters them separately)-.15 E(.\))-.65 E .029 +(If a thread or process does not call)108 112.8 R F1(DbMpool::db_r)2.529 +E -.4(eg)-.37 G(ister).4 E F0 .029 +(for a \214le type, it is impossible for it to e)2.529 F .029 +(vict pages)-.25 F 1.63(for an)108 124.8 R 4.13<798c>-.15 G 1.631 +(le requiring input or output processing from the pool.)-4.13 F -.15(Fo) +6.631 G 4.131(rt).15 G 1.631(his reason,)-4.131 F F1(DbMpool::db_r)4.131 +E -.4(eg)-.37 G(ister).4 E F0 .044(should al)108 136.8 R -.1(wa)-.1 G +.043(ys be called by each application sharing a pool for each type of \214le included in the pool, re) +.1 F -.05(ga)-.15 G(rd-).05 E(less of whether or not the application itself uses \214les of that type.) +108 148.8 Q .375(There are no standard v)108 165.6 R .376(alues for)-.25 +F F1(ftype)2.876 E F0(,).18 E F1(pgin)2.876 E F0(,).24 E F1(pgout)2.876 +E F0(and)2.876 E F1(pgcookie)2.876 E F0 2.876(,e).18 G .376 +(xcept that the)-3.026 F F1(ftype)2.876 E F0 -.25(va)2.876 G .376 +(lue for a \214le must).25 F .047(be a non-zero positi)108 177.6 R .346 +-.15(ve n)-.25 H(umber).15 E 2.546(,a)-.4 G 2.546(sn)-2.546 G -2.25 -.15 +(eg a)-2.546 H(ti).15 E .346 -.15(ve n)-.25 H .046(umbers are reserv).15 +F .046(ed for internal use by the DB library)-.15 F 5.046(.F)-.65 G .046 +(or this)-5.196 F +(reason, applications sharing a pool must coordinate their v)108 189.6 Q +(alues amongst themselv)-.25 E(es.)-.15 E(The)108 206.4 Q F1 +(DbMpool::db_r)2.992 E -.4(eg)-.37 G(ister).4 E F0 .492(method thro) +2.992 F .492(ws a)-.25 F F1(DbException)2.992 E F0 .492 +(\(3\) or returns the v).24 F .492(alue of)-.25 F F1(errno)2.992 E F0 +.492(on f)2.992 F .492(ailure and 0)-.1 F(on success.)108 218.4 Q F1 +(DbMpool::tric)92 235.2 Q(kle)-.2 E F0(The)108 247.2 Q F1(DbMpool::tric) +3.011 E(kle)-.2 E F0 .511(method ensures that at least)3.011 F F1(pct) +3.011 E F0 .51(percent of the pages in the shared memory pool are)3.011 +F .844(clean by writing dirty pages to their backing \214les.)108 259.2 +R .844(If the)5.844 F F1(nwr)3.344 E(otep)-.45 E F0(ar)3.344 E .844 +(gument is non-NULL, the number of)-.18 F(pages that were written to reach the correct percentage is returned in the memory location it references.) +108 271.2 Q .528(The purpose of the)108 288 R F1(DbMpool::tric)3.028 E +(kle)-.2 E F0 .528 +(method is to enable a memory pool manager to ensure that a page is) +3.028 F(al)108 300 Q -.1(wa)-.1 G(ys a).1 E -.25(va)-.2 G +(ilable for reading in ne).25 E 2.5(wi)-.25 G(nformation without ha)-2.5 +E(ving to w)-.2 E(ait for a write.)-.1 E(The)108 316.8 Q F1 +(DbMpool::tric)3.429 E(kle)-.2 E F0 .929(method thro)3.429 F .929(ws a) +-.25 F F1(DbException)3.429 E F0 .929(\(3\) or returns the v).24 F .929 +(alue of)-.25 F F1(errno)3.43 E F0 .93(on f)3.43 F .93(ailure and 0 on) +-.1 F(success.)108 328.8 Q F1(DbMpool::sync)92 345.6 Q F0(The)108 357.6 +Q F1(DbMpool::sync)3.915 E F0 1.415(method ensures that all the modi\214ed pages in the pool with log sequence numbers) +3.915 F(\(LSNs\) less than the)108 369.6 Q F1(lsn)2.5 E F0(ar)2.5 E +(gument are written to disk.)-.18 E(The)108 386.4 Q F1(DbMpool::sync) +2.618 E F0 .118(method thro)2.618 F .118(ws a)-.25 F F1(DbException) +2.619 E F0 .119(\(3\) or returns the v).24 F .119(alue of)-.25 F F1 +(errno)2.619 E F0 .119(on f)2.619 F .119(ailure, 0 on success,)-.1 F +1.996(and DB_INCOMPLETE if there were pages which need to be written b) +108 398.4 R 1.995(ut which)-.2 F F1(DbMpool::sync)4.495 E F0 -.1(wa) +4.495 G(s).1 E .668(unable to write immediately)108 410.4 R 5.668(.I) +-.65 G 3.168(na)-5.668 G .668(ddition, if)-3.168 F F1(DbMpool::sync) +3.168 E F0 .668(returns success, the v)3.168 F .668(alue of)-.25 F F1 +(lsn)3.168 E F0 .669(will be o)3.168 F -.15(ve)-.15 G -.2(r-).15 G +(written with the lar)108 422.4 Q(gest LSN from an)-.18 E 2.5(yp)-.15 G +(age which w)-2.5 E(as written by)-.1 E F1(DbMpool::sync)2.5 E F0 +(to satisfy this request.)2.5 E .195(The purpose of the)108 439.2 R F1 +(DbMpool::sync)2.695 E F0 .194(method is to enable a transaction manager to ensure, as part of a check-) +2.695 F .601(point, that all pages modi\214ed by a certain time ha)108 +451.2 R .902 -.15(ve b)-.2 H .602(een written to disk.).15 F -.15(Pa) +5.602 G .602(ges in the pool which cannot).15 F .459(be written back to disk immediately \(e.g., are currently pinned\) are written to disk as soon as it is possible) +108 463.2 R .306(to do so.)108 475.2 R .306(The e)5.306 F .306 +(xpected beha)-.15 F .306 +(vior of the transaction manager is to call the)-.2 F F1(DbMpool::sync) +2.807 E F0 .307(method and then,)2.807 F .112(if the return indicates that some pages could not be written immediately) +108 487.2 R 2.612(,t)-.65 G 2.612(ow)-2.612 G .112 +(ait brie\215y and retry ag)-2.712 F .112(ain with)-.05 F +(the same LSN until the)108 499.2 Q F1(DbMpool::sync)2.5 E F0 +(method returns that all pages ha)2.5 E .3 -.15(ve b)-.2 H(een written.) +.15 E 2.025 -.8(To s)108 516 T .425(upport the).8 F F1(DbMpool::sync) +2.925 E F0(functionality)2.925 E 2.925(,i)-.65 G 2.925(ti)-2.925 G 2.925 +(sn)-2.925 G .425(ecessary that the pool methods kno)-2.925 F 2.925(wt) +-.25 G .425(he location of the)-2.925 F 1.146 +(LSN on the page for each \214le type.)108 528 R 1.146(This location should be speci\214ed when the \214le is opened using the) +6.146 F F1(DbMpoolF)108 540 Q(ile::open)-.45 E F0 2.5(method. \(Note,) +2.5 F(it is not required that the LSN be aligned on the page in an)2.5 E +2.5(yw)-.15 G(ay)-2.6 E(.\))-.65 E F1(DbMpool::stat)92 556.8 Q F0(The) +108 580.8 Q F1(DbMpool::stat)4.308 E F0 1.808(method creates statistical structures and copies pointers to them into user) +4.308 F(-speci\214ed)-.2 E .83(memory locations.)108 592.8 R .829(The statistics include the number of \214les participating in the pool, the acti) +5.83 F 1.129 -.15(ve p)-.25 H .829(ages in).15 F +(the pool, and information as to ho)108 604.8 Q 2.5(we)-.25 G -.25(ff) +-2.5 G(ecti).25 E .3 -.15(ve t)-.25 H(he cache has been.).15 E .048 +(Statistical structures are created in allocated memory)108 621.6 R +5.049(.I)-.65 G(f)-5.049 E F1(db_malloc)2.549 E F0 .049 +(is non-NULL, it is called to allocate the)2.549 F(memory)108 633.6 Q +2.83(,o)-.65 G .33(therwise, the library function)-2.83 F F1(malloc) +2.829 E F0 .329(\(3\) is used.).31 F .329(The function)5.329 F F1 +(db_malloc)2.829 E F0 .329(must match the calling)2.829 F(con)108 645.6 +Q -.15(ve)-.4 G 2.03(ntions of the).15 F F1(malloc)4.53 E F0 2.031 +(\(3\) library routine.).31 F(Re)7.031 E -.05(ga)-.15 G 2.031 +(rdless, the caller is responsible for deallocating the).05 F .708 +(returned memory)108 657.6 R 5.708(.T)-.65 G 3.208(od)-6.508 G .708 +(eallocate the returned memory)-3.208 F 3.208(,f)-.65 G .707 +(ree each returned memory pointer; pointers inside)-3.208 F +(the memory do not need to be indi)108 669.6 Q(vidually freed.)-.25 E +(If)108 686.4 Q F1(gsp)2.69 E F0 .191(is non-NULL, the global statistics for the memory pool object are copied into the memory location it) +2.69 F 5.399(references. The)108 698.4 R 2.898 +(global statistics are stored in a structure of type DB_MPOOL_ST)5.399 F +5.118 -1.11(AT \()-.93 H -1.95(typedef ')1.11 F 5.398(di)-.5 G(n)-5.398 +E(\).)108 710.4 Q(The follo)108 727.2 Q(wing DB_MPOOL_ST)-.25 +E 2.22 -1.11(AT \214)-.93 H(elds will be \214lled in:)1.11 E +(May 10, 1998)278.085 768 Q(4)201.085 E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 364.4(DbMpool\(3\) DbMpool\(3\))72 48 R +(u_int32_t st_refcnt;)108 84 Q(The number of references to the re)133 96 +Q(gion.)-.15 E(u_int32_t st_re)108 108 Q(gsize;)-.15 E +(The size of the re)133 120 Q(gion.)-.15 E(size_t st_cachesize;)108 132 +Q(Cache size in bytes.)135.5 144 Q(u_int32_t st_cache_hit;)108 156 Q +(Requested pages found in the cache.)133 168 Q(u_int32_t st_cache_miss;) +108 180 Q(Requested pages not found in the cache.)133 192 Q +(u_int32_t st_map;)108 204 Q 1.688 +(Requested pages mapped into the process' address space \(there is no a) +133 216 R -.25(va)-.2 G 1.689(ilable information as to).25 F .673 +(whether or not this request caused disk I/O, although e)133 228 R .672 +(xamining the application page f)-.15 F .672(ault rate may)-.1 F +(be helpful\).)133 240 Q(u_int32_t st_page_create;)108 252 Q -.15(Pa)133 +264 S(ges created in the cache.).15 E(u_int32_t st_page_in;)108 276 Q +-.15(Pa)133 288 S(ges read into the cache.).15 E(u_int32_t st_page_out;) +108 300 Q -.15(Pa)133 312 S +(ges written from the cache to the backing \214le.).15 E +(u_int32_t st_ro_e)108 324 Q(vict;)-.25 E +(Clean pages forced from the cache.)133 336 Q(u_int32_t st_rw_e)108 348 +Q(vict;)-.25 E(Dirty pages forced from the cache.)133 360 Q +(u_int32_t st_hash_b)108 372 Q(uck)-.2 E(ets;)-.1 E(Number of hash b)133 +384 Q(uck)-.2 E(ets in b)-.1 E(uf)-.2 E(fer hash table.)-.25 E +(u_int32_t st_hash_searches;)108 396 Q -.8(To)133 408 S(tal number of b) +.8 E(uf)-.2 E(fer hash table lookups.)-.25 E(u_int32_t st_hash_longest;) +108 420 Q(The longest chain e)133 432 Q -.15(ve)-.25 G 2.5(re).15 G +(ncountered in b)-2.5 E(uf)-.2 E(fer hash table lookups.)-.25 E +(u_int32_t st_hash_e)108 444 Q(xamined;)-.15 E -.8(To)133 456 S +(tal number of hash elements tra).8 E -.15(ve)-.2 G +(rsed during hash table lookups.).15 E(u_int32_t st_page_clean;)108 468 +Q(Clean pages currently in the cache.)133 480 Q +(u_int32_t st_page_dirty;)108 492 Q(Dirty pages currently in the cache.) +133 504 Q(u_int32_t st_page_trickle;)108 516 Q +(Dirty pages written using the)133 528 Q/F1 10/Times-Italic@0 SF +(memp_tric)2.5 E(kle)-.2 E F0(interf)2.5 E(ace.)-.1 E(If)108 544.8 Q F1 +(fsp)2.65 E F0 .15(is non-NULL, a pointer to a NULL-terminated v)2.65 F +.151(ariable length array of statistics for indi)-.25 F .151 +(vidual \214les in)-.25 F .683 +(the memory pool is copied into the memory location it references.)108 +556.8 R .683(If no indi)5.683 F .683(vidual \214les currently e)-.25 F +.682(xist in)-.15 F(the memory pool,)108 568.8 Q F1(fsp)2.5 E F0 +(will be set to NULL.)2.5 E .228(The per)108 585.6 R .228 +(-\214le statistics are stored in structures of type DB_MPOOL_FST)-.2 F +2.449 -1.11(AT \()-.93 H -1.95(typedef ')1.11 F 2.729(di)-.5 G 2.729(n<) +-2.729 G 2.729(db_cxx.h>\). The)-2.729 F(follo)108 597.6 Q 1.186 +(wing DB_MPOOL_FST)-.25 F 3.406 -1.11(AT \214)-.93 H 1.185(elds will be \214lled in for each \214le in the pool, i.e., each element of the) +1.11 F(array:)108 609.6 Q(char *\214le_name;)108 626.4 Q +(The name of the \214le.)133 638.4 Q(size_t st_pagesize;)108 650.4 Q +-.15(Pa)135.5 662.4 S(ge size in bytes.).15 E(u_int32_t st_cache_hit;) +108 674.4 Q(Requested pages found in the cache.)133 686.4 Q +(u_int32_t st_cache_miss;)108 698.4 Q +(Requested pages not found in the cache.)133 710.4 Q(May 10, 1998) +278.085 768 Q(5)201.085 E EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 364.4(DbMpool\(3\) DbMpool\(3\))72 48 R +(u_int32_t st_map;)108 84 Q +(Requested pages mapped into the process' address space.)133 96 Q +(u_int32_t st_page_create;)108 108 Q -.15(Pa)133 120 S +(ges created in the cache.).15 E(u_int32_t st_page_in;)108 132 Q -.15 +(Pa)133 144 S(ges read into the cache.).15 E(u_int32_t st_page_out;)108 +156 Q -.15(Pa)133 168 S +(ges written from the cache to the backing \214le.).15 E(The)108 184.8 Q +/F1 10/Times-Italic@0 SF(DbMpool::stat)2.888 E F0 .388(method thro)2.888 +F .389(ws a)-.25 F F1(DbException)2.889 E F0 .389 +(\(3\) or returns the v).24 F .389(alue of)-.25 F F1(errno)2.889 E F0 +.389(on f)2.889 F .389(ailure and 0 on suc-)-.1 F(cess.)108 196.8 Q/F2 9 +/Times-Bold@0 SF(ENVIR)72 213.6 Q(ONMENT V)-.27 E(ARIABLES)-1.215 E F0 +(The follo)108 225.6 Q(wing en)-.25 E(vironment v)-.4 E(ariables af)-.25 +E(fect the beha)-.25 E(vior of)-.2 E F1(DbMpoolF)2.5 E(ile)-.45 E F0(:) +.18 E(DB_HOME)108 242.4 Q .573(If the)133 254.4 R F1(dben)3.073 E(v)-.4 +E F0(ar)3.073 E .573(gument to)-.18 F F1(DbMpool::open)3.073 E F0 -.1 +(wa)3.073 G 3.072(si).1 G .572(nitialized using)-3.072 F F1(db_appinit) +3.072 E F0 3.072(,t).68 G .572(he en)-3.072 F .572(vironment v)-.4 F +(ariable)-.25 E .508(DB_HOME may be used as the path of the database home for the interpretation of the) +133 266.4 R F1(dir)3.009 E F0(ar)3.009 E(gument)-.18 E(to)133 278.4 Q F1 +(DbMpool::open)2.5 E F0 2.5(,a).24 G 2.5(sd)-2.5 G(escribed in)-2.5 E F1 +(db_appinit)2.5 E F0(\(3\).).68 E(TMPDIR)108 295.2 Q .195(If the)133 +307.2 R F1(dben)2.695 E(v)-.4 E F0(ar)2.695 E .195(gument to)-.18 F F1 +(DbMpool::open)2.695 E F0 -.1(wa)2.695 G 2.695(sN).1 G .195 +(ULL or not initialized using)-2.695 F F1(db_appinit)2.695 E F0 2.695 +(,t).68 G .195(he en)-2.695 F(viron-)-.4 E 2.349(ment v)133 319.2 R +2.349(ariable TMPDIR may be used as the directory in which to create the memory pool, as) +-.25 F(described in the)133 331.2 Q F1(DbMpool::open)2.5 E F0 +(section abo)2.5 E -.15(ve)-.15 G(.).15 E F2(ERR)72 348 Q(ORS)-.27 E F0 +.05(Methods mark)108 360 R .05(ed as returning)-.1 F F1(errno)2.55 E F0 +.049(will, by def)2.55 F .049(ault, thro)-.1 F 2.549(wa)-.25 G 2.549(ne) +-2.549 G .049(xception that encapsulates the error informa-)-2.699 F 2.5 +(tion. The)108 372 R(def)2.5 E(ault error beha)-.1 E +(vior can be changed, see)-.2 E F1(DbException)2.5 E F0(\(3\).).24 E +(The)108 388.8 Q F1(DbMpool::open)2.5 E F0(method may f)2.5 E +(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0(\(3\)).24 E +(or return)108 412.8 Q F1(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5 +(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions:)-.25 E(DBmemp->pgin\(3\), DBmemp->pgout\(3\), DbLog::compare\(3\), DbLog::\215ush\(3\), DbMpool::close\(3\), DbM-) +108 424.8 Q(pool::unlink\(3\), close\(2\), db_v)108 436.8 Q +(ersion\(3\), fcntl\(2\), f)-.15 E +(\215ush\(3\), fsync\(2\), lseek\(2\), malloc\(3\), memcmp\(3\),)-.25 E +(memcp)108 448.8 Q(y\(3\), memset\(3\), mmap\(2\), munmap\(2\), open\(2\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp) +-.1 E(y\(3\),)-.1 E(strdup\(3\), strerror\(3\), strlen\(3\), time\(3\), unlink\(2\), and write\(2\).) +108 460.8 Q .779(In addition, the)108 477.6 R F1(DbMpool::open)3.279 E +F0 .779(method may f)3.279 F .779(ail and thro)-.1 F 3.279(wa)-.25 G F1 +(DbException)A F0 .78(\(3\) or return).24 F F1(errno)3.28 E F0 .78 +(for the fol-)3.28 F(lo)108 489.6 Q(wing conditions:)-.25 E([EA)108 +506.4 Q(GAIN])-.4 E(The shared memory re)133 518.4 Q(gion w)-.15 E +(as lock)-.1 E(ed and \(repeatedly\) una)-.1 E -.25(va)-.2 G(ilable.).25 +E([EINV)108 535.2 Q(AL])-1.35 E(An in)133 547.2 Q -.25(va)-.4 G +(lid \215ag v).25 E(alue or parameter w)-.25 E(as speci\214ed.)-.1 E +(The DB_THREAD \215ag w)133 571.2 Q(as speci\214ed and spinlocks are not implemented for this architecture.) +-.1 E 2.5(AN)133 595.2 S(ULL pathname w)-2.5 E +(as speci\214ed without the DB_MPOOL_PRIV)-.1 E -1.11(AT)-1.35 G 2.5 +<458d>1.11 G(ag.)-2.5 E(The speci\214ed cache size w)133 619.2 Q +(as impossibly small.)-.1 E(The)108 636 Q F1(DbMpool::close)2.5 E F0 +(method may f)2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0 +(\(3\)).24 E(or return)108 660 Q F1(errno)2.5 E F0(for an)2.5 E 2.5(yo) +-.15 G 2.5(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: DbM-)-.25 E +(poolFile::close\(3\), close\(2\), fcntl\(2\), f)108 672 Q +(\215ush\(3\), munmap\(2\), and strerror\(3\).)-.25 E(The)108 688.8 Q F1 +(DbMpool::unlink)2.5 E F0(method may f)2.5 E(ail and thro)-.1 E 2.5(wa) +-.25 G F1(DbException)A F0(\(3\)).24 E(or return)108 712.8 Q F1(errno) +2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: close\(2\), fcntl\(2\),)-.25 E -.25 +<668d>108 724.8 S(ush\(3\), malloc\(3\), memcp).25 E(y\(3\), memset\(3\), mmap\(2\), munmap\(2\), open\(2\), sig\214llset\(3\), sigprocmask\(2\),) +-.1 E(May 10, 1998)278.085 768 Q(6)201.085 E EP +%%Page: 7 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 364.4(DbMpool\(3\) DbMpool\(3\))72 48 R +(stat\(2\), strcp)108 84 Q +(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), and unlink\(2\).)-.1 E +.431(In addition, the)108 100.8 R/F1 10/Times-Italic@0 SF +(DbMpool::unlink)2.932 E F0 .432(method may f)2.932 F .432(ail and thro) +-.1 F 2.932(wa)-.25 G F1(DbException)A F0 .432(\(3\) or return).24 F F1 +(errno)2.932 E F0 .432(for the fol-)2.932 F(lo)108 112.8 Q +(wing conditions:)-.25 E([EB)108 129.6 Q(USY])-.1 E +(The shared memory re)133 141.6 Q(gion w)-.15 E +(as in use and the force \215ag w)-.1 E(as not set.)-.1 E(The)108 158.4 +Q F1(DbMpool::db_r)2.5 E -.4(eg)-.37 G(ister).4 E F0(method may f)2.5 E +(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0(\(3\)).24 E +(or return)108 182.4 Q F1(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5 +(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: fcntl\(2\), and mal-)-.25 E(loc\(3\).) +108 194.4 Q(The)108 211.2 Q F1(DbMpool::tric)2.5 E(kle)-.2 E F0 +(method may f)2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0 +(\(3\)).24 E(or return)108 235.2 Q F1(errno)2.5 E F0(for an)2.5 E 2.5 +(yo)-.15 G 2.5(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions:)-.25 E(DBmemp->pgin\(3\), DBmemp->pgout\(3\), DbLog::compare\(3\), DbLog::\215ush\(3\), close\(2\), fcntl\(2\),) +108 247.2 Q -.25<668d>108 259.2 S +(ush\(3\), fsync\(2\), lseek\(2\), malloc\(3\), memcmp\(3\), memcp).25 E +(y\(3\), memset\(3\), mmap\(2\), open\(2\), sig-)-.1 E +(\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp)108 271.2 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), time\(3\), unlink\(2\), and) +-.1 E(write\(2\).)108 283.2 Q .41(In addition, the)108 300 R F1 +(DbMpool::tric)2.91 E(kle)-.2 E F0 .41(method may f)2.91 F .41 +(ail and thro)-.1 F 2.91(wa)-.25 G F1(DbException)A F0 .41 +(\(3\) or return).24 F F1(errno)2.91 E F0 .41(for the fol-)2.91 F(lo)108 +312 Q(wing conditions:)-.25 E([EINV)108 328.8 Q(AL])-1.35 E(An in)133 +340.8 Q -.25(va)-.4 G(lid \215ag v).25 E(alue or parameter w)-.25 E +(as speci\214ed.)-.1 E(The)108 357.6 Q F1(DbMpool::sync)2.5 E F0 +(method may f)2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0 +(\(3\)).24 E(or return)108 381.6 Q F1(errno)2.5 E F0(for an)2.5 E 2.5 +(yo)-.15 G 2.5(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions:)-.25 E(DBmemp->pgin\(3\), DBmemp->pgout\(3\), DbLog::compare\(3\), DbLog::\215ush\(3\), close\(2\), fcntl\(2\),) +108 393.6 Q -.25<668d>108 405.6 S +(ush\(3\), fsync\(2\), lseek\(2\), malloc\(3\), memcmp\(3\), memcp).25 E +(y\(3\), memset\(3\), mmap\(2\), open\(2\), qsort\(3\),)-.1 E +(realloc\(3\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp)108 +417.6 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), time\(3\),)-.1 +E(unlink\(2\), and write\(2\).)108 429.6 Q .884(In addition, the)108 +446.4 R F1(DbMpool::sync)3.384 E F0 .884(method may f)3.384 F .884 +(ail and thro)-.1 F 3.384(wa)-.25 G F1(DbException)A F0 .884 +(\(3\) or return).24 F F1(errno)3.383 E F0 .883(for the fol-)3.383 F(lo) +108 458.4 Q(wing conditions:)-.25 E([EINV)108 475.2 Q(AL])-1.35 E(An in) +133 487.2 Q -.25(va)-.4 G(lid \215ag v).25 E(alue or parameter w)-.25 E +(as speci\214ed.)-.1 E(The)133 511.2 Q F1(DbMpool::sync)2.5 E F0 +(method w)2.5 E(as called without logging ha)-.1 E +(ving been initialized in the en)-.2 E(vironment.)-.4 E(The)108 528 Q F1 +(DbMpool::stat)2.5 E F0(method may f)2.5 E(ail and thro)-.1 E 2.5(wa) +-.25 G F1(DbException)A F0(\(3\)).24 E(or return)108 552 Q F1(errno)2.5 +E F0(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: fcntl\(2\), mal-)-.25 E(loc\(3\), memcp) +108 564 Q(y\(3\), and strlen\(3\).)-.1 E/F2 9/Times-Bold@0 SF(SEE ALSO) +72 580.8 Q F1(db_ar)108 592.8 Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E +F1(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F0(\(1\),).68 E F1(db_deadloc)2.5 +E(k)-.2 E F0(\(1\),).67 E F1(db_dump)2.5 E F0(\(1\),).19 E F1(db_load) +2.5 E F0(\(1\),).77 E F1(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E +F1(db_stat)2.5 E F0(\(1\),).68 E F1(db_intr)108 604.8 Q(o)-.45 E F0 +(\(3\),).18 E F1(db_internal)2.5 E F0(\(3\),).51 E F1(db_thr)2.5 E(ead) +-.37 E F0(\(3\),).77 E F1(Db)2.5 E F0(\(3\),).23 E F1(Dbc)2.5 E F0 +(\(3\),).31 E F1(DbEn)2.5 E(v)-.4 E F0(\(3\),).32 E F1(DbException)2.5 E +F0(\(3\),).24 E F1(DbInfo)2.5 E F0(\(3\),).18 E F1(DbLoc)108 616.8 Q(k) +-.2 E F0(\(3\),).67 E F1(DbLoc)2.5 E(kT)-.2 E(ab)-.92 E F0(\(3\),).23 E +F1(DbLo)2.5 E(g)-.1 E F0(\(3\),).22 E F1(DbLsn)2.5 E F0(\(3\),).24 E F1 +(DbMpool)2.5 E F0(\(3\),).51 E F1(DbMpoolF)2.5 E(ile)-.45 E F0(\(3\),) +.18 E F1(Dbt)2.5 E F0(\(3\),).68 E F1(DbTxn)2.5 E F0(\(3\),).24 E F1 +(DbTxnMgr)108 628.8 Q F0(\(3\)).73 E(May 10, 1998)278.085 768 Q(7) +201.085 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/mancxx.ps/DbMpoolFile.ps b/mozilla/db/man/mancxx.ps/DbMpoolFile.ps new file mode 100644 index 00000000000..034128ceda3 --- /dev/null +++ b/mozilla/db/man/mancxx.ps/DbMpoolFile.ps @@ -0,0 +1,635 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:36 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 5 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(DbMpoolFile \255 shared memory b)108 40.8 Q(uf)-.2 E(fer pool)-.25 E F0 +(SYNOPSIS)72 57.6 Q/F2 10/Times-Bold@0 SF(#include )108 69.6 Q +(static int)108 93.6 Q(DbMpoolFile::open\(DbMpool *mp, char *\214le, u_int32_t \215ags, int mode,) +108 105.6 Q(size_t pagesize, DbMpoolFinf)158 117.6 Q 2.5(o*)-.25 G +(\214nf)-2.5 E(op, DbMpoolFile **mpf\);)-.25 E(int)108 141.6 Q +(DbMpoolFile::close\(\);)108 153.6 Q(int)108 177.6 Q +(DbMpoolFile::get\(db_pgno_t *pgnoaddr)108 189.6 Q 2.5(,u)-.92 G +(_int32_t \215ags, v)-2.5 E(oid **pagep\);)-.1 E(int)108 213.6 Q +(DbMpoolFile::put\(v)108 225.6 Q(oid *pgaddr)-.1 E 2.5(,u)-.92 G +(_int32_t \215ags\);)-2.5 E(int)108 249.6 Q(DbMpoolFile::set\(v)108 +261.6 Q(oid *pgaddr)-.1 E 2.5(,u)-.92 G(_int32_t \215ags\);)-2.5 E(int) +108 285.6 Q(DbMpoolFile::sync\(\);)108 297.6 Q F0(DESCRIPTION)72 314.4 Q +F1 1.02(The DB library is a f)108 326.4 R 1.019 +(amily of classes that pro)-.1 F 1.019 +(vides a modular programming interf)-.15 F 1.019 +(ace to transactions and)-.1 F 1.377(record-oriented \214le access.)108 +338.4 R 1.378(The library includes support for transactions, locking, logging and \214le page) +6.377 F .443(caching, as well as v)108 350.4 R .443(arious inde)-.25 F +-.15(xe)-.15 G 2.943(da).15 G .442(ccess methods.)-2.943 F(Man)5.442 E +2.942(yo)-.15 G 2.942(ft)-2.942 G .442 +(he classes \(e.g., the \214le page caching class\))-2.942 F .4(are useful independent of the other DB classes, although some classes are e) +108 362.4 R .4(xplicitly based on other classes)-.15 F +(\(e.g., transactions and logging\).)108 374.4 Q -.15(Fo)5 G 2.5(rag).15 +G(eneral description of the DB package, see)-2.5 E/F3 10/Times-Italic@0 +SF(db_intr)2.5 E(o)-.45 E F1(\(3\).).18 E +(This manual page describes the speci\214c details of the per)108 391.2 +Q(-\214le memory pool interf)-.2 E(ace.)-.1 E(The)108 408 Q F3(DbMpool) +2.7 E F1 .2(\(3\) and).51 F F3(DbMpoolF)2.7 E(ile)-.45 E F1 .2 +(\(3\) classes are the library interf).18 F .2(ace intended to pro)-.1 F +.2(vide general-purpose,)-.15 F 1.033(page-oriented b)108 420 R(uf)-.2 E +1.033(fer management of one or more \214les.)-.25 F 1.033 +(While designed to w)6.033 F 1.033(ork with the other Db func-)-.1 F +1.518(tions, these functions are also useful for more general purposes.) +108 432 R 1.518(The memory pools \()6.518 F F3(DbMpool::)A F1 -.55('s)C +4.017(\)a).55 G(re)-4.017 E .117 +(referred to in this document as simply `)108 444 R(`pools')-.74 E 2.617 +('. Pools)-.74 F .118(may be shared between processes.)2.618 F .118 +(Pools are usually)5.118 F 1.461 +(\214lled by pages from one or more \214les \()108 456 R F3(DbMpoolF)A +(ile)-.45 E F1 -.55('s).18 G 3.961(\). P).55 F 1.46 +(ages in the pool are replaced in LR)-.15 F 3.96(U\()-.4 G(least-)-3.96 +E 1.971(recently-used\) order)108 468 R 4.471(,w)-.4 G 1.971 +(ith each ne)-4.471 F 4.471(wp)-.25 G 1.971 +(age replacing the page that has been unused the longest.)-4.471 F -.15 +(Pa)6.972 G(ges).15 E(retrie)108 480 Q -.15(ve)-.25 G 2.52(df).15 G .02 +(rom the pool using)-2.52 F F3(DbMpoolF)2.52 E(ile::g)-.45 E(et)-.1 E F1 +.02(are `)2.52 F(`pinned')-.74 E 2.52('i)-.74 G 2.52(nt)-2.52 G .02 +(he pool, by def)-2.52 F .02(ault, until the)-.1 F 2.52(ya)-.15 G .02 +(re returned)-2.52 F(to the pool')108 492 Q 2.5(sc)-.55 G +(ontrol using the)-2.5 E F3(DbMpoolF)2.5 E(ile::put)-.45 E F1(method.) +2.5 E F3(DbMpoolF)92 508.8 Q(ile::open)-.45 E F1(The)108 520.8 Q F3 +(DbMpoolF)3.166 E(ile::open)-.45 E F1 .667 +(method opens a \214le in the pool speci\214ed by the)3.166 F F3 +(DbMpool)3.167 E F1(ar)3.167 E .667(gument, cop)-.18 F .667(ying the)-.1 +F(DbMpoolFile pointer representing it into the memory location referenced by) +108 532.8 Q F3(mpf)2.5 E F1(.)1.96 E(The)108 549.6 Q F3(\214le)2.967 E +F1(ar)2.967 E .467(gument is the name of the \214le to be opened.)-.18 F +(If)5.466 E F3(\214le)2.966 E F1 .466(is NULL, a pri)2.966 F -.25(va) +-.25 G .466(te \214le is created that cannot).25 F(be shared with an)108 +561.6 Q 2.5(yo)-.15 G +(ther process \(although it may be shared with other threads\).)-2.5 E +(The)108 578.4 Q F3<8d61>3.76 E(gs)-.1 E F1(and)3.76 E F3(mode)3.76 E F1 +(ar)3.76 E 1.26(guments specify ho)-.18 F 3.761<778c>-.25 G 1.261 +(les will be opened and/or created when the)-3.761 F 3.761(yd)-.15 G +(on')-3.761 E 3.761(ta)-.18 G(lready)-3.761 E -.15(ex)108 590.4 S 2.5 +(ist. The).15 F(\215ags v)2.5 E(alue is speci\214ed by)-.25 E F2(or)2.5 +E F1('ing together one or more of the follo)A(wing v)-.25 E(alues:)-.25 +E(DB_CREA)108 607.2 Q(TE)-1.11 E .484(Create an)133 619.2 R 2.984(yu) +-.15 G .483(nderlying \214les, as necessary)-2.984 F 5.483(.I)-.65 G +2.983(ft)-5.483 G .483(he \214les do not already e)-2.983 F .483 +(xist and the DB_CREA)-.15 F .483(TE \215ag)-1.11 F +(is not speci\214ed, the call will f)133 631.2 Q(ail.)-.1 E(DB_NOMMAP) +108 660 Q(Al)133 672 Q -.1(wa)-.1 G .057(ys cop).1 F 2.557(yt)-.1 G .057 +(his \214le into the local cache instead of mapping it into process memory \(see the descrip-) +-2.557 F(tion of the)133 684 Q F3(mp_mmapsize)2.5 E F1 +(\214eld of the DbEn)2.5 E 2.5(vo)-.4 G +(bject for further information\).)-2.5 E(DB_RDONL)108 712.8 Q(Y)-1 E +1.124(Open an)133 724.8 R 3.624(yu)-.15 G 1.124 +(nderlying \214les for reading only)-3.624 F 6.124(.A)-.65 G 1.424 -.15 +(ny a)-6.124 H 1.124 +(ttempt to write the \214le using the pool functions).15 F(1)535 768 Q +EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 333.28(DbMpoolFile\(3\) DbMpoolFile\(3\))72 48 R +(will f)133 84 Q(ail, re)-.1 E -.05(ga)-.15 G +(rdless of the actual permissions of the \214le.).05 E .073 +(All \214les created by the method)108 100.8 R/F1 10/Times-Italic@0 SF +(DbMpoolF)2.573 E(ile::open)-.45 E F0 .073(are created with mode)2.573 F +F1(mode)2.574 E F0 .074(\(as described in)2.574 F F1 -.15(ch)2.574 G +(mod).15 E F0(\(2\)\)).77 E .456(and modi\214ed by the process' umask v) +108 112.8 R .456(alue at the time of creation \(see)-.25 F F1(umask) +2.956 E F0 2.956(\(2\)\). The).67 F .455(group o)2.956 F .455 +(wnership of)-.25 F +(created \214les is based on the system and directory def)108 124.8 Q +(aults, and is not further speci\214ed by DB.)-.1 E(The)108 141.6 Q F1 +(pa)3.577 E -.1(ge)-.1 G(size).1 E F0(ar)3.577 E 1.077(gument is the size, in bytes, of the unit of transfer between the application and the pool,) +-.18 F(although it is not necessarily the unit of transfer between the pool and the source \214le.) +108 153.6 Q .096 +(Files opened in the pool may be further con\214gured based on the)108 +170.4 R F1(\214nfop)2.595 E F0(ar)2.595 E .095(gument to)-.18 F F1 +(memp_fopen)2.595 E F0 2.595(,w).24 G .095(hich is a)-2.595 F .039 +(pointer to a structure of type DB_MPOOL_FINFO \(typedef)108 182.4 R +1.039 -.5('d i).55 H 2.539(n<).5 G(db)-2.539 E 2.539(.h>\). No)-.4 F .04 +(references to the)2.54 F F1(\214nfop)2.54 E F0(struc-)2.54 E 1.364 +(ture are maintained by DB, so it may be discarded when the)108 194.4 R +F1(memp_fopen)3.864 E F0 1.364(function returns.)3.864 F 1.364 +(In order to)6.364 F .137(ensure compatibility with future releases of DB, all \214elds of the DB_MPOOL_FINFO structure that are not) +108 206.4 R -.15(ex)108 218.4 S .656(plicitly set should be initialized to 0 before the \214rst time the structure is used.) +.15 F .655(Do this by declaring the)5.656 F(structure e)108 230.4 Q +(xternal or static, or by calling the C library routine)-.15 E F1(bzer) +2.5 E(o)-.45 E F0(\(3\) or).18 E F1(memset)2.5 E F0(\(3\).).68 E .691 +(The \214elds of the DB_MPOOL_FINFO structure used by)108 247.2 R F1 +(DbMpoolF)3.191 E(ile::open)-.45 E F0 .691(are described)3.191 F(belo) +5.691 E 4.491 -.65(w. I)-.25 H(f).65 E F1(\214n-)3.191 E(fop)108 259.2 Q +F0(is NULL or an)2.5 E 2.5(yo)-.15 G 2.5(fi)-2.5 G +(ts \214elds are set to their def)-2.5 E(ault v)-.1 E(alue, def)-.25 E +(aults appropriate for the system are used.)-.1 E(int ftype;)108 276 Q +(The)133 288 Q F1(ftype)6.277 E F0 3.777 +(\214eld should be the same as a)6.277 F F1(ftype)6.277 E F0(ar)6.277 E +3.776(gument pre)-.18 F 3.776(viously speci\214ed to the)-.25 F F1(DbM-) +6.276 E(pool::db_r)133 300 Q -.4(eg)-.37 G(ister).4 E F0 1.001 +(method, unless no input or output processing of the \214le')3.501 F +3.502(sp)-.55 G 1.002(ages are necessary)-3.502 F 3.502(,i)-.65 G(n) +-3.502 E .406(which case it should be 0.)133 312 R .406 +(\(See the description of the)5.406 F F1(DbMpool::db_r)2.906 E -.4(eg) +-.37 G(ister).4 E F0 .406(method for more infor)2.906 F(-)-.2 E +(mation.\))133 324 Q(DBT *pgcookie;)108 340.8 Q(The)133 352.8 Q F1 +(pgcookie)2.679 E F0(ar)2.679 E .179 +(gument contains the byte string that is passed to the)-.18 F F1(pgin) +2.68 E F0(and)2.68 E F1(pgout)2.68 E F0 .18(functions for this)2.68 F +.283(\214le, if an)133 364.8 R 4.083 -.65(y. I)-.15 H 2.783(fn).65 G(o) +-2.783 E F1(pgin)2.782 E F0(or)2.782 E F1(pgout)2.782 E F0 .282 +(functions are speci\214ed, the)2.782 F F1(pgcookie)2.782 E F0 .282 +(\214eld should be NULL.)2.782 F .282(\(See the)5.282 F +(description of the)133 376.8 Q F1(DbMpool::db_r)2.5 E -.4(eg)-.37 G +(ister).4 E F0(method for more information.\))2.5 E(u_int8_t *\214leid;) +108 393.6 Q(The)133 405.6 Q F1(\214leid)2.797 E F0 .298 +(\214eld is a unique identi\214er for the \214le.)2.797 F .298 +(The mpool functions must be able to uniquely iden-)5.298 F .176(tify \214les in order that multiple processes sharing a \214le will correctly share its underlying pages.) +133 417.6 R(Nor)5.175 E(-)-.2 E(mally)133 429.6 Q 3.358(,t)-.65 G(he) +-3.358 E F1(\214leid)3.358 E F0 .858 +(\214eld should be NULL and the mpool functions will use the \214le') +3.358 F 3.359(sd)-.55 G -.25(ev)-3.359 G .859(ice and inode).25 F .044 +(numbers \(see)133 441.6 R F1(stat)2.544 E F0 .043 +(\(2\)\) for this purpose.).68 F .043(On some \214lesystems, \(e.g., F) +5.043 F 2.263 -1.11(AT o)-.74 H 2.543(rN)1.11 G .043(FS\) \214le de) +-2.543 F .043(vice and inode)-.25 F 1.578 +(numbers are not necessarily unique across system reboots.)133 453.6 R +/F2 10/Times-Bold@0 SF -.25(Ap)6.578 G 1.579 +(plications wanting to maintain a).25 F(shar)133 465.6 Q 1.653 +(ed memory b)-.18 F 1.653(uffer pool acr)-.2 F 1.652(oss system r)-.18 F +1.652(eboots, wher)-.18 F 4.152(et)-.18 G 1.652 +(he pool contains pages fr)-4.152 F 1.652(om \214les)-.18 F(stor)133 +477.6 Q .011(ed on such \214lesystems, must specify a unique \214le identi\214er to the) +-.18 F F1(DbMpoolF)2.511 E(ile::open)-.45 E F0 .011(call and)2.511 F +.217(each process opening or re)133 489.6 R .216 +(gistering the \214le must pro)-.15 F .216 +(vide the same unique identi\214er)-.15 F 5.216(.I)-.55 G 2.716(ft) +-5.216 G(he)-2.716 E F1(\214leid)2.716 E F0(\214eld)2.716 E 1.493(is non-NULL, it must reference a DB_FILE_ID_LEN \(as de\214ned in \) length array of) +133 501.6 R .724 +(bytes that will be used to uniquely identify the \214le.)133 513.6 R +.724(This should not be necessary for most applica-)5.724 F 2.92 +(tions. Speci\214cally)133 525.6 R 2.92(,i)-.65 G 2.92(ti)-2.92 G 2.92 +(sn)-2.92 G .421(ot necessary if the memory pool is re-instantiated after each system reboot,) +-2.92 F .438(the application is using the Db access methods instead of calling the pool functions e) +133 537.6 R(xplicitly)-.15 E 2.937(,o)-.65 G 2.937(rt)-2.937 G(he)-2.937 +E .968(\214les in the memory pool are stored on \214lesystems where the \214le de) +133 549.6 R .969(vice and inode numbers do not)-.25 F +(change across system reboots.)133 561.6 Q(int32_t lsn_of)108 578.4 Q +(fset;)-.25 E(The)133 590.4 Q F1(lsn_of)3.05 E(fset)-.18 E F0(ar)3.05 E +.55(gument is the zero-based byte of)-.18 F .55 +(fset in the page of the page')-.25 F 3.05(sl)-.55 G .55 +(og sequence number)-3.05 F .99(\(LSN\), or \2551 if no LSN of)133 602.4 +R .99(fset is speci\214ed.)-.25 F .99(\(See the description of the)5.99 +F F1(DbMpool::sync)3.49 E F0 .99(method for)3.49 F(more information.\)) +133 614.4 Q(u_int32_t clear_len;)108 631.2 Q(The)133 643.2 Q F1 +(clear_len)2.664 E F0 .164(\214eld is the number of initial bytes in a page that should be set to zero when the page is) +2.664 F 1.791(created as a result of the DB_MPOOL_CREA)133 655.2 R 1.791 +(TE or DB_MPOOL_NEW \215ags being speci\214ed to)-1.11 F F1(DbMpoolF)133 +667.2 Q(ile::g)-.45 E(et)-.1 E F0 5(.I).68 G(f)-5 E F1(\214nfop)2.5 E F0 +(is NULL or)2.5 E F1(clear_len)2.5 E F0 +(is 0, the entire page is cleared.)2.5 E(The)108 684 Q F1(DbMpoolF)2.82 +E(ile::open)-.45 E F0 .32(method thro)2.82 F .32(ws a)-.25 F F1 +(DbException)2.82 E F0 .32(\(3\) or returns the v).24 F .32(alue of)-.25 +F F1(errno)2.82 E F0 .32(on f)2.82 F .32(ailure and 0 on)-.1 F(success.) +108 696 Q F1(DbMpoolF)92 712.8 Q(ile::close)-.45 E F0(The)108 724.8 Q F1 +(DbMpoolF)3.012 E(ile::close)-.45 E F0 .512 +(method closes the source \214le indicated by the DbMpoolFile object.) +3.012 F .513(This method)5.513 F(May 2, 1998)280.585 768 Q(2)203.585 E +EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 333.28(DbMpoolFile\(3\) DbMpoolFile\(3\))72 48 R +.159(does not imply a call to)108 84 R/F1 10/Times-Italic@0 SF(DbMpoolF) +2.659 E(ile::sync)-.45 E F0 2.659(,i).31 G .158 +(.e. no pages are written to the source \214le as as a result of call-) +-2.659 F(ing)108 96 Q F1(DbMpoolF)2.5 E(ile::close)-.45 E F0(.).18 E 1.4 +(In addition, if the)108 112.8 R F1(\214le)3.9 E F0(ar)3.9 E 1.4 +(gument to)-.18 F F1(DbMpoolF)3.9 E(ile::open)-.45 E F0 -.1(wa)3.9 G 3.9 +(sN).1 G 1.4(ULL, an)-3.9 F 3.9(yu)-.15 G 1.4 +(nderlying \214les created for this)-3.9 F(DbMpoolFile will be remo)108 +124.8 Q -.15(ve)-.15 G(d.).15 E(The)108 141.6 Q F1(DbMpoolF)2.751 E +(ile::close)-.45 E F0 .251(method thro)2.751 F .251(ws a)-.25 F F1 +(DbException)2.751 E F0 .251(\(3\) or returns the v).24 F .251(alue of) +-.25 F F1(errno)2.75 E F0 .25(on f)2.75 F .25(ailure and 0 on)-.1 F +(success.)108 153.6 Q F1(DbMpoolF)92 170.4 Q(ile::g)-.45 E(et)-.1 E F0 +(The)108 182.4 Q F1(DbMpoolF)3.292 E(ile::g)-.45 E(et)-.1 E F0 .792(method copies a pointer to the page with the page number speci\214ed by) +3.292 F F1(pgnoaddr)3.292 E F0(,).73 E .199(from the source \214le speci\214ed by the DbMpoolFile object into the memory location referenced by) +108 194.4 R F1(pa)2.699 E -.1(ge)-.1 G(p).1 E F0 5.199(.I).19 G(f)-5.199 +E(the page does not e)108 206.4 Q(xist or cannot be retrie)-.15 E -.15 +(ve)-.25 G(d,).15 E F1(DbMpoolF)2.5 E(ile::g)-.45 E(et)-.1 E F0(will f) +2.5 E(ail.)-.1 E(The returned page is size_t type aligned.)108 223.2 Q +/F2 10/Times-Bold@0 SF -.1(Pa)108 240 S(ge numbers begin at 0, e.g).1 E +(., the \214rst page in the \214le is page number 0, not page number 1.) +-.15 E F0(The)108 256.8 Q F1<8d61>2.5 E(gs)-.1 E F0(ar)2.5 E +(gument is speci\214ed by)-.18 E F2(or)2.5 E F0 +('ing together one or more of the follo)A(wing v)-.25 E(alues:)-.25 E +(DB_MPOOL_CREA)108 285.6 Q(TE)-1.11 E +(If the speci\214ed page does not e)133 297.6 Q(xist, create it.)-.15 E +(In this case, the)5 E F1(pgin)2.5 E F0 +(method, if speci\214ed, is called.)2.5 E(DB_MPOOL_LAST)108 326.4 Q +2.105(Return the last page of the source \214le and cop)133 338.4 R +4.605(yi)-.1 G 2.106(ts page number to the location referenced by)-4.605 +F F1(pgnoaddr)133 350.4 Q F0(.).73 E(DB_MPOOL_NEW)108 379.2 Q .743 +(Create a ne)133 391.2 R 3.243(wp)-.25 G .743(age in the \214le and cop) +-3.243 F 3.243(yi)-.1 G .743 +(ts page number to the location referenced by)-3.243 F F1(pgnoaddr)3.242 +E F0 5.742(.I).73 G(n)-5.742 E(this case, the)133 403.2 Q F1(pgin)2.5 E +F0(method, if speci\214ed, is not called.)2.5 E(The DB_MPOOL_CREA)108 +420 Q(TE, DB_MPOOL_LAST and DB_MPOOL_NEW \215ags are mutually e)-1.11 E +(xclusi)-.15 E -.15(ve)-.25 G(.).15 E(Created pages ha)108 436.8 Q .3 +-.15(ve a)-.2 H(ll their bytes set to 0, unless otherwise speci\214ed when the \214le w) +.15 E(as opened.)-.1 E .36(All pages returned by)108 453.6 R F1 +(DbMpoolF)2.86 E(ile::g)-.45 E(et)-.1 E F0 .361 +(will be retained \(i.e. `)2.86 F(`pinned')-.74 E .361 +('\) in the pool until a subsequent call)-.74 F(to)108 465.6 Q F1 +(DbMpoolF)2.5 E(ile::put)-.45 E F0(.).68 E(The)108 482.4 Q F1(DbMpoolF) +3.278 E(ile::g)-.45 E(et)-.1 E F0 .778(method thro)3.278 F .778(ws a) +-.25 F F1(DbException)3.278 E F0 .778(\(3\) or returns the v).24 F .777 +(alue of)-.25 F F1(errno)3.277 E F0 .777(on f)3.277 F .777 +(ailure and 0 on)-.1 F(success.)108 494.4 Q F1(DbMpoolF)92 511.2 Q +(ile::put)-.45 E F0(The)108 523.2 Q F1(DbMpoolF)3.093 E(ile::put)-.45 E +F0 .593(method indicates that the page referenced by)3.093 F F1(pgaddr) +3.093 E F0 .594(can be e)3.093 F .594(victed from the pool.)-.25 F F1 +(Pgaddr)108 535.2 Q F0(must be an address pre)2.5 E(viously returned by) +-.25 E F1(DbMpoolF)2.5 E(ile::g)-.45 E(et)-.1 E F0(.).68 E(The)108 552 Q +F1<8d61>2.5 E(gs)-.1 E F0(ar)2.5 E(gument is speci\214ed by)-.18 E F2 +(or)2.5 E F0('ing together one or more of the follo)A(wing v)-.25 E +(alues:)-.25 E(DB_MPOOL_CLEAN)108 580.8 Q 1.557(Clear an)133 592.8 R +4.057(yp)-.15 G(re)-4.057 E 1.557 +(viously set modi\214cation information \(i.e., don')-.25 F 4.056(tb) +-.18 G 1.556(other writing the page back to the)-4.056 F +(source \214le\).)133 604.8 Q(DB_MPOOL_DIR)108 633.6 Q(TY)-.6 E .052(The page has been modi\214ed and must be written to the source \214le before being e) +133 645.6 R .052(victed from the pool.)-.25 F(DB_MPOOL_DISCARD)108 674.4 +Q .145(The page is unlik)133 686.4 R .144(ely to be useful in the near future, and should be discarded before other pages in the) +-.1 F(pool.)133 698.4 Q(The DB_MPOOL_CLEAN and DB_MPOOL_DIR)108 715.2 Q +(TY \215ags are mutually e)-.6 E(xclusi)-.15 E -.15(ve)-.25 G(.).15 E +(May 2, 1998)280.585 768 Q(3)203.585 E EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 333.28(DbMpoolFile\(3\) DbMpoolFile\(3\))72 48 R +(The)108 84 Q/F1 10/Times-Italic@0 SF(DbMpoolF)3.236 E(ile::put)-.45 E +F0 .736(method thro)3.236 F .736(ws a)-.25 F F1(DbException)3.236 E F0 +.736(\(3\) or returns the v).24 F .736(alue of)-.25 F F1(errno)3.236 E +F0 .737(on f)3.236 F .737(ailure and 0 on)-.1 F(success.)108 96 Q F1 +(DbMpoolF)92 112.8 Q(ile::set)-.45 E F0(The)108 124.8 Q F1(DbMpoolF) +2.918 E(ile::set)-.45 E F0 .418 +(method sets the \215ags associated with the page referenced by)2.918 F +F1(pgaddr)2.918 E F0 .417(without unpin-)2.917 F 1.354 +(ning it from the pool.)108 136.8 R F1(Pgaddr)6.354 E F0 1.355 +(must be an address pre)3.855 F 1.355(viously returned by)-.25 F F1 +(DbMpoolF)3.855 E(ile::g)-.45 E(et)-.1 E F0 6.355(.T).68 G(he)-6.355 E +F1<8d61>3.855 E(gs)-.1 E F0(ar)108 148.8 Q .775(gument to)-.18 F F1 +(DbMpoolF)3.275 E(ile::set)-.45 E F0 .775(is speci\214ed by)3.275 F/F2 +10/Times-Bold@0 SF(or)3.275 E F0 .774 +('ing together one or more of the v)B .774(alues speci\214ed as \215ags) +-.25 F(for the)108 160.8 Q F1(DbMpoolF)2.5 E(ile::put)-.45 E F0(call.) +2.5 E(The)108 177.6 Q F1(DbMpoolF)3.34 E(ile::set)-.45 E F0 .84 +(method thro)3.34 F .84(ws a)-.25 F F1(DbException)3.34 E F0 .841 +(\(3\) or returns the v).24 F .841(alue of)-.25 F F1(errno)3.341 E F0 +.841(on f)3.341 F .841(ailure and 0 on)-.1 F(success.)108 189.6 Q F1 +(DbMpoolF)92 206.4 Q(ile::sync)-.45 E F0(The)108 218.4 Q F1(DbMpoolF) +2.809 E(ile::sync)-.45 E F0 .308(method writes all pages associated with the DbMpoolFile object that were mark) +2.809 F(ed)-.1 E .828(as modi\214ed using)108 230.4 R F1(DbMpoolF)3.328 +E(ile::put)-.45 E F0(or)3.328 E F1(DbMpoolF)3.328 E(ile::set)-.45 E F0 +3.328(,b).68 G .828(ack to the source \214le.)-3.328 F .828(If an)5.828 +F 3.328(yo)-.15 G 3.328(ft)-3.328 G .828(he modi\214ed)-3.328 F .481(pages are also pinned \(i.e., currently referenced by this or another process\)) +108 242.4 R F1(DbMpoolF)2.98 E(ile::sync)-.45 E F0 .48(will ignore)2.98 +F(them.)108 254.4 Q(The)108 271.2 Q F1(DbMpoolF)2.629 E(ile::sync)-.45 E +F0 .129(method thro)2.629 F .129(ws a)-.25 F F1(DbException)2.629 E F0 +.129(\(3\) or returns the v).24 F .129(alue of)-.25 F F1(errno)2.63 E F0 +.13(on f)2.63 F .13(ailure, 0 on suc-)-.1 F .389 +(cess, and DB_INCOMPLETE if there were pages which were modi\214ed b)108 +283.2 R .389(ut which)-.2 F F1(DbMpoolF)2.889 E(ile::sync)-.45 E F0 -.1 +(wa)2.889 G(s).1 E(unable to write.)108 295.2 Q/F3 9/Times-Bold@0 SF +(ERR)72 312 Q(ORS)-.27 E F0 .049(Methods mark)108 324 R .049 +(ed as returning)-.1 F F1(errno)2.549 E F0 .049(will, by def)2.549 F +.049(ault, thro)-.1 F 2.549(wa)-.25 G 2.549(ne)-2.549 G .05 +(xception that encapsulates the error informa-)-2.699 F 2.5(tion. The) +108 336 R(def)2.5 E(ault error beha)-.1 E(vior can be changed, see)-.2 E +F1(DbException)2.5 E F0(\(3\).).24 E(The)108 352.8 Q F1(DbMpoolF)2.5 E +(ile::open)-.45 E F0(method may f)2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G +F1(DbException)A F0(\(3\)).24 E(or return)108 376.8 Q F1(errno)2.5 E F0 +(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions:)-.25 E(DBmemp->pgin\(3\), DBmemp->pgout\(3\), DbLog::compare\(3\), DbLog::\215ush\(3\), close\(2\), fcntl\(2\),) +108 388.8 Q -.25<668d>108 400.8 S +(ush\(3\), fsync\(2\), lseek\(2\), malloc\(3\), memcmp\(3\), memcp).25 E +(y\(3\), memset\(3\), mmap\(2\), open\(2\), sig-)-.1 E +(\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp)108 412.8 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), time\(3\), unlink\(2\), and) +-.1 E(write\(2\).)108 424.8 Q .917(In addition, the)108 441.6 R F1 +(DbMpoolF)3.417 E(ile::open)-.45 E F0 .917(method may f)3.417 F .917 +(ail and thro)-.1 F 3.417(wa)-.25 G F1(DbException)A F0 .916 +(\(3\) or return).24 F F1(errno)3.416 E F0 .916(for the)3.416 F(follo) +108 453.6 Q(wing conditions:)-.25 E([EINV)108 470.4 Q(AL])-1.35 E(An in) +133 482.4 Q -.25(va)-.4 G(lid \215ag v).25 E(alue or parameter w)-.25 E +(as speci\214ed.)-.1 E .001 +(The \214le has already been entered into the pool, and the)133 506.4 R +F1(pa)2.501 E -.1(ge)-.1 G(size).1 E F0 -.25(va)2.501 G .001 +(lue is not the same as when the \214le).25 F -.1(wa)133 518.4 S 2.5(se) +.1 G(ntered into the pool, or the length of the \214le is not zero or a multiple of the) +-2.5 E F1(pa)2.5 E -.1(ge)-.1 G(size).1 E F0(.).18 E(The DB_RDONL)133 +542.4 Q 2.5<598d>-1 G(ag w)-2.5 E(as speci\214ed for an in-memory pool.) +-.1 E(The)108 559.2 Q F1(DbMpoolF)2.5 E(ile::close)-.45 E F0 +(method may f)2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0 +(\(3\)).24 E(or return)108 583.2 Q F1(errno)2.5 E F0(for an)2.5 E 2.5 +(yo)-.15 G 2.5(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: close\(2\), fcntl\(2\),)-.25 E -.25 +<668d>108 595.2 S(ush\(3\), munmap\(2\), and strerror\(3\).).25 E(The) +108 612 Q F1(DbMpoolF)2.5 E(ile::g)-.45 E(et)-.1 E F0(method may f)2.5 E +(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0(\(3\)).24 E +(or return)108 636 Q F1(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5 +(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions:)-.25 E(DBmemp->pgin\(3\), DBmemp->pgout\(3\), DbLog::compare\(3\), DbLog::\215ush\(3\), close\(2\), fcntl\(2\),) +108 648 Q -.25<668d>108 660 S +(ush\(3\), fsync\(2\), lseek\(2\), malloc\(3\), memcmp\(3\), memcp).25 E +(y\(3\), memset\(3\), mmap\(2\), open\(2\), read\(2\),)-.1 E +(sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp)108 672 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), time\(3\), unlink\(2\), and) +-.1 E(write\(2\).)108 684 Q .258(In addition, the)108 700.8 R F1 +(DbMpoolF)2.758 E(ile::g)-.45 E(et)-.1 E F0 .258(method may f)2.758 F +.258(ail and thro)-.1 F 2.758(wa)-.25 G F1(DbException)A F0 .258 +(\(3\) or return).24 F F1(errno)2.758 E F0 .259(for the fol-)2.758 F(lo) +108 712.8 Q(wing conditions:)-.25 E(May 2, 1998)280.585 768 Q(4)203.585 +E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 333.28(DbMpoolFile\(3\) DbMpoolFile\(3\))72 48 R +([EA)108 84 Q(GAIN])-.4 E 1.568(The page reference count has o)133 96 R +-.15(ve)-.15 G(r\215o).15 E 4.068(wed. \(This)-.25 F 1.568(should ne) +4.068 F -.15(ve)-.25 G 4.068(rh).15 G 1.568(appen unless there')-4.068 F +4.068(sab)-.55 G 1.568(ug in the)-4.268 F(application.\))133 108 Q +([EINV)108 124.8 Q(AL])-1.35 E(An in)133 136.8 Q -.25(va)-.4 G +(lid \215ag v).25 E(alue or parameter w)-.25 E(as speci\214ed.)-.1 E +(The DB_MPOOL_NEW \215ag w)133 160.8 Q(as set and the source \214le w) +-.1 E(as not opened for writing.)-.1 E(The requested page does not e)133 +184.8 Q(xist and DB_MPOOL_CREA)-.15 E(TE w)-1.11 E(as not set.)-.1 E +(More than one of DB_MPOOL_CREA)133 208.8 Q +(TE, DB_MPOOL_LAST and DB_MPOOL_NEW w)-1.11 E(as set.)-.1 E([ENOMEM])108 +225.6 Q(The cache is full and no more pages will \214t in the pool.)133 +237.6 Q(The)108 254.4 Q/F1 10/Times-Italic@0 SF(DbMpoolF)2.5 E(ile::put) +-.45 E F0(method may f)2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G F1 +(DbException)A F0(\(3\)).24 E(or return)108 278.4 Q F1(errno)2.5 E F0 +(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions:)-.25 E(DBmemp->pgin\(3\), DBmemp->pgout\(3\), DbLog::compare\(3\), DbLog::\215ush\(3\), close\(2\), fcntl\(2\),) +108 290.4 Q -.25<668d>108 302.4 S +(ush\(3\), fsync\(2\), lseek\(2\), malloc\(3\), memcmp\(3\), memcp).25 E +(y\(3\), memset\(3\), mmap\(2\), open\(2\), sig-)-.1 E +(\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp)108 314.4 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), time\(3\), unlink\(2\), and) +-.1 E(write\(2\).)108 326.4 Q .216(In addition, the)108 343.2 R F1 +(DbMpoolF)2.717 E(ile::put)-.45 E F0 .217(method may f)2.717 F .217 +(ail and thro)-.1 F 2.717(wa)-.25 G F1(DbException)A F0 .217 +(\(3\) or return).24 F F1(errno)2.717 E F0 .217(for the fol-)2.717 F(lo) +108 355.2 Q(wing conditions:)-.25 E([EA)108 372 Q(CCES])-.4 E +(The DB_MPOOL_DIR)133 384 Q(TY \215ag w)-.6 E +(as set and the source \214le w)-.1 E(as not opened for writing.)-.1 E +([EINV)108 400.8 Q(AL])-1.35 E(An in)133 412.8 Q -.25(va)-.4 G +(lid \215ag v).25 E(alue or parameter w)-.25 E(as speci\214ed.)-.1 E +(The)133 436.8 Q F1(pgaddr)2.5 E F0 +(parameter does not reference a page returned by)2.5 E F1(DbMpoolF)2.5 E +(ile::g)-.45 E(et)-.1 E F0(.).68 E +(More than one of DB_MPOOL_CLEAN and DB_MPOOL_DIR)133 460.8 Q(TY w)-.6 E +(as set.)-.1 E(The)108 477.6 Q F1(DbMpoolF)2.5 E(ile::set)-.45 E F0 +(method may f)2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0 +(\(3\)).24 E(or return)108 501.6 Q F1(errno)2.5 E F0(for an)2.5 E 2.5 +(yo)-.15 G 2.5(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: fcntl\(2\), and)-.25 E -.25<668d>108 +513.6 S(ush\(3\).).25 E .321(In addition, the)108 530.4 R F1(DbMpoolF) +2.821 E(ile::set)-.45 E F0 .321(method may f)2.821 F .321(ail and thro) +-.1 F 2.821(wa)-.25 G F1(DbException)A F0 .321(\(3\) or return).24 F F1 +(errno)2.822 E F0 .322(for the fol-)2.822 F(lo)108 542.4 Q +(wing conditions:)-.25 E([EINV)108 559.2 Q(AL])-1.35 E(An in)133 571.2 Q +-.25(va)-.4 G(lid \215ag v).25 E(alue or parameter w)-.25 E +(as speci\214ed.)-.1 E(The)108 588 Q F1(DbMpoolF)2.5 E(ile::sync)-.45 E +F0(method may f)2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A +F0(\(3\)).24 E(or return)108 612 Q F1(errno)2.5 E F0(for an)2.5 E 2.5 +(yo)-.15 G 2.5(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions:)-.25 E(DBmemp->pgin\(3\), DBmemp->pgout\(3\), DbLog::compare\(3\), DbLog::\215ush\(3\), close\(2\), fcntl\(2\),) +108 624 Q -.25<668d>108 636 S +(ush\(3\), fsync\(2\), lseek\(2\), malloc\(3\), memcp).25 E(y\(3\), memset\(3\), open\(2\), qsort\(3\), realloc\(3\), sig\214llset\(3\),) +-.1 E(sigprocmask\(2\), stat\(2\), strcp)108 648 Q(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), unlink\(2\), and write\(2\).) +-.1 E/F2 9/Times-Bold@0 SF(SEE ALSO)72 669.6 Q F1(db_ar)108 681.6 Q -.15 +(ch)-.37 G(ive).15 E F0(\(1\),).18 E F1(db_c)2.5 E(hec)-.15 E(kpoint)-.2 +E F0(\(1\),).68 E F1(db_deadloc)2.5 E(k)-.2 E F0(\(1\),).67 E F1 +(db_dump)2.5 E F0(\(1\),).19 E F1(db_load)2.5 E F0(\(1\),).77 E F1(db_r) +2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F1(db_stat)2.5 E F0(\(1\),) +.68 E F1(db_intr)108 693.6 Q(o)-.45 E F0(\(3\),).18 E F1(db_internal)2.5 +E F0(\(3\),).51 E F1(db_thr)2.5 E(ead)-.37 E F0(\(3\),).77 E F1(Db)2.5 E +F0(\(3\),).23 E F1(Dbc)2.5 E F0(\(3\),).31 E F1(DbEn)2.5 E(v)-.4 E F0 +(\(3\),).32 E F1(DbException)2.5 E F0(\(3\),).24 E F1(DbInfo)2.5 E F0 +(\(3\),).18 E F1(DbLoc)108 705.6 Q(k)-.2 E F0(\(3\),).67 E F1(DbLoc)2.5 +E(kT)-.2 E(ab)-.92 E F0(\(3\),).23 E F1(DbLo)2.5 E(g)-.1 E F0(\(3\),).22 +E F1(DbLsn)2.5 E F0(\(3\),).24 E F1(DbMpool)2.5 E F0(\(3\),).51 E F1 +(DbMpoolF)2.5 E(ile)-.45 E F0(\(3\),).18 E F1(Dbt)2.5 E F0(\(3\),).68 E +F1(DbTxn)2.5 E F0(\(3\),).24 E F1(DbTxnMgr)108 717.6 Q F0(\(3\)).73 E +(May 2, 1998)280.585 768 Q(5)203.585 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/mancxx.ps/DbTxn.ps b/mozilla/db/man/mancxx.ps/DbTxn.ps new file mode 100644 index 00000000000..c2c3f2e4207 --- /dev/null +++ b/mozilla/db/man/mancxx.ps/DbTxn.ps @@ -0,0 +1,503 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:37 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 3 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(DbTxn \255 Db transaction management)108 40.8 Q F0(SYNOPSIS)72 57.6 Q +/F2 10/Times-Bold@0 SF(#include )108 69.6 Q(int)108 93.6 Q +(DbTxn::pr)108 105.6 Q(epar)-.18 E(e\(\);)-.18 E(int)108 129.6 Q +(DbTxn::commit\(\);)108 141.6 Q(int)108 165.6 Q(DbTxn::abort\(\);)108 +177.6 Q(u_int32_t)108 201.6 Q(DbTxn::id\(\);)108 213.6 Q F0(DESCRIPTION) +72 230.4 Q F1 1.02(The DB library is a f)108 242.4 R 1.019 +(amily of classes that pro)-.1 F 1.019 +(vides a modular programming interf)-.15 F 1.019 +(ace to transactions and)-.1 F 1.377(record-oriented \214le access.)108 +254.4 R 1.378(The library includes support for transactions, locking, logging and \214le page) +6.377 F .443(caching, as well as v)108 266.4 R .443(arious inde)-.25 F +-.15(xe)-.15 G 2.943(da).15 G .442(ccess methods.)-2.943 F(Man)5.442 E +2.942(yo)-.15 G 2.942(ft)-2.942 G .442 +(he classes \(e.g., the \214le page caching class\))-2.942 F .4(are useful independent of the other DB classes, although some classes are e) +108 278.4 R .4(xplicitly based on other classes)-.15 F +(\(e.g., transactions and logging\).)108 290.4 Q -.15(Fo)5 G 2.5(rag).15 +G(eneral description of the DB package, see)-2.5 E/F3 10/Times-Italic@0 +SF(db_intr)2.5 E(o)-.45 E F1(\(3\).).18 E .563(This manual page describes the speci\214c details of the Db transaction support.) +108 307.2 R .562(The DbTxn class is used in)5.562 F .358 +(conjunction with)108 319.2 R F3(DbTxnMgr)2.858 E F1 .358(\(3\) to pro) +.73 F .358(vide transaction semantics.)-.15 F .359 +(Full transaction support is pro)5.358 F .359(vided by a)-.15 F .262 +(collection of modules that pro)108 331.2 R .262(vide interf)-.15 F .261 +(aces to the services required for transaction processing.)-.1 F .261 +(These ser)5.261 F(-)-.2 E .585(vices are reco)108 343.2 R -.15(ve)-.15 +G .585(ry \(see).15 F F3(DbLo)3.085 E(g)-.1 E F1 .585 +(\(3\)\), concurrenc).22 F 3.085(yc)-.15 G .585(ontrol \(see)-3.085 F F3 +(DbLoc)3.085 E(k)-.2 E F1 .586(\(3\) and).67 F F3(DbLoc)3.086 E(kT)-.2 E +(ab)-.92 E F1 .586(\(3\)\), and the man-).23 F .961 +(agement of shared data \(see)108 355.2 R F3(DbMpool)3.461 E F1 .961 +(\(3\) and).51 F F3(DbMpoolF)3.461 E(ile)-.45 E F1 3.461(\(3\)\). T).18 +F .96(ransaction semantics can be applied to)-.35 F +(the access methods described in)108 367.2 Q F3(Db)2.5 E F1 +(\(3\) through method call parameters.).23 E .891(The model intended for transactional use \(and the one that is used by the access methods\) is write-ahead) +108 384 R .508(logging pro)108 396 R .508(vided by)-.15 F F3(DbLo)3.008 +E(g)-.1 E F1 .508(\(3\) to record both before- and after).22 F 3.008 +(-images. Locking)-.2 F(follo)3.008 E .508(ws a tw)-.25 F .507 +(o-phase pro-)-.1 F +(tocol, with all locks being released at transaction commit.)108 408 Q +F3(DbTxn::pr)92 424.8 Q(epar)-.37 E(e)-.37 E F1(The)108 436.8 Q F3 +(DbTxn::pr)3.762 E(epar)-.37 E(e)-.37 E F1 1.263 +(method initiates the be)3.762 F 1.263(ginning of a tw)-.15 F 3.763(op) +-.1 G 1.263(hase commit.)-3.763 F 1.263(In a distrib)6.263 F 1.263 +(uted transaction)-.2 F(en)108 448.8 Q(vironment,)-.4 E F3(db)3.189 E F1 +.688(can be used as a local transaction manager)3.189 F 5.688(.I)-.55 G +3.188(nt)-5.688 G .688(his case, the distrib)-3.188 F .688 +(uted transaction man-)-.2 F .2(ager must send)108 460.8 R F3(pr)2.7 E +(epar)-.37 E(e)-.37 E F1 .2(messages to each local manager)2.7 F 5.2(.T) +-.55 G .2(he local manager must then issue a)-5.2 F F3(DbTxn::pr)2.7 E +(e-)-.37 E(par)108 472.8 Q(e)-.37 E F1 .027(and a)2.527 F -.1(wa)-.15 G +.027(it its successful return before responding to the distrib).1 F .026 +(uted transaction manager)-.2 F 5.026(.O)-.55 G .026(nly after the) +-5.026 F(distrib)108 484.8 Q 1.394(uted transaction manager recei)-.2 F +-.15(ve)-.25 G 3.894(ss).15 G 1.395(uccessful responses from all of its) +-3.894 F F3(pr)3.895 E(epar)-.37 E(e)-.37 E F1 1.395(messages should it) +3.895 F(issue an)108 496.8 Q(y)-.15 E F3(commit)2.5 E F1(messages.)2.5 E +(The)108 513.6 Q F3(DbTxn::pr)2.574 E(epar)-.37 E(e)-.37 E F1 .074 +(method thro)2.574 F .074(ws a)-.25 F F3(DbException)2.574 E F1 .074 +(\(3\) or returns the v).24 F .073(alue of)-.25 F F3(errno)2.573 E F1 +.073(on f)2.573 F .073(ailure and 0 on suc-)-.1 F(cess.)108 525.6 Q F3 +(DbTxn::commit)92 542.4 Q F1(The)108 554.4 Q F3(DbTxn::commit)3.05 E F1 +.551(method ends the transaction associated with the DbTxn.)3.05 F .551 +(If DB_TXN_NOSYNC w)5.551 F(as)-.1 E .019(not speci\214ed, a commit log record is written and \215ushed to disk, as are all pre) +108 566.4 R .019(viously written log records.)-.25 F(If)5.018 E .842(the transaction is nested, its locks are acquired by the parent transaction, otherwise its locks are released.) +108 578.4 R(An)108 590.4 Q 2.545(ya)-.15 G .045 +(pplications that require strict tw)-2.545 F .045 +(o-phase locking must not release an)-.1 F 2.544(yl)-.15 G .044(ocks e) +-2.544 F(xplicitly)-.15 E 2.544(,l)-.65 G(ea)-2.544 E .044 +(ving them all)-.2 F(to be released by)108 602.4 Q F3(DbTxn::commit)2.5 +E F1(.).68 E(The)108 619.2 Q F3(DbTxn::commit)2.66 E F1 .16(method thro) +2.66 F .16(ws a)-.25 F F3(DbException)2.66 E F1 .16 +(\(3\) or returns the v).24 F .161(alue of)-.25 F F3(errno)2.661 E F1 +.161(on f)2.661 F .161(ailure and 0 on suc-)-.1 F(cess.)108 631.2 Q F3 +(DbTxn::abort)92 648 Q F1(The)108 660 Q F3(DbTxn::abort)2.695 E F1 .195 +(method causes an abnormal termination of the transaction.)2.695 F .195 +(The log is played backw)5.195 F(ards)-.1 E 2.56(and an)108 672 R 5.06 +(yn)-.15 G 2.56(ecessary reco)-5.06 F -.15(ve)-.15 G 2.561 +(ry operations are initiated through the).15 F F3 -.37(re)5.061 G(co).37 +E(ver)-.1 E F1 2.561(method speci\214ed to)5.061 F F3(DbTxn-)5.061 E +(Mgr::open)108 684 Q F1 5.362(.A).24 G .362(fter reco)-5.362 F -.15(ve) +-.15 G .361(ry is completed, all locks held by the transaction are acquired by the parent trans-) +.15 F .355(action in the case of a nested transaction or released in the case of a non-nested transaction.) +108 696 R .356(As is the case)5.356 F(for)108 708 Q F3(DbTxn::commit) +4.261 E F1 4.261(,a).68 G 1.761(pplications that require strict tw) +-4.261 F 4.261(op)-.1 G 1.761(hase locking should not e)-4.261 F 1.76 +(xplicitly release an)-.15 F(y)-.15 E(locks.)108 720 Q(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 385.52(DbTxn\(3\) DbTxn\(3\))72 48 R(The)108 84 +Q/F1 10/Times-Italic@0 SF(DbTxn::abort)3.117 E F0 .617(method thro)3.117 +F .617(ws a)-.25 F F1(DbException)3.117 E F0 .618 +(\(3\) or returns the v).24 F .618(alue of)-.25 F F1(errno)3.118 E F0 +.618(on f)3.118 F .618(ailure and 0 on suc-)-.1 F(cess.)108 96 Q F1 +(DbTxn::id)92 112.8 Q F0(The)108 124.8 Q F1(DbTxn::id)2.851 E F0 .351(method returns the unique transaction id associated with the speci\214ed transaction.) +2.851 F(Locking)5.35 E .094 +(calls made on behalf of this transaction should use the v)108 136.8 R +.095(alue returned from)-.25 F F1(DbTxn::id)2.595 E F0 .095(as the lock) +2.595 F .095(er parame-)-.1 F(ter to the)108 148.8 Q F1(DbLoc)2.5 E(kT) +-.2 E(ab::g)-.92 E(et)-.1 E F0(or)2.5 E F1(DbLoc)2.5 E(kT)-.2 E(ab::vec) +-.92 E F0(calls.)2.5 E/F2 9/Times-Bold@0 SF(TRANSA)72 170.4 Q(CTIONS) +-.495 E F0 .866(Creating transaction protected applications using the Db access methods requires little system customiza-) +108 182.4 R 3.254(tion. In)108 194.4 R .754(most cases, the def)3.254 F +.754(ault parameters to the locking, logging, memory pool, and transaction subsys-) +-.1 F 1.411(tems will suf)108 206.4 R 3.911(\214ce. Applications)-.25 F +1.411(can use)3.911 F F1(DbEn)3.911 E(v::appinit)-.4 E F0(\(see)3.911 E +F1(DbEn)3.911 E(v)-.4 E F0 1.41 +(\(3\)\) to perform this initialization, or).32 F(the)108 218.4 Q 2.5 +(ym)-.15 G(ay do it e)-2.5 E(xplicitly)-.15 E(.)-.65 E 2.075 +(Each database operation \(i.e., an)108 235.2 R 4.575(yc)-.15 G 2.075 +(all to a method underlying the handles returned by)-4.575 F F1 +(Db::open)4.576 E F0(and)4.576 E F1(Db::cur)108 247.2 Q(sor)-.1 E F0 +1.031(described in)3.531 F F1(Db)3.531 E F0 1.031 +(\(3\)\) is normally performed on behalf of a unique lock).23 F(er)-.1 E +6.03(.I)-.55 G 3.53(fm)-6.03 G 1.03(ultiple calls on)-3.53 F +(behalf of the same lock)108 259.2 Q +(er are desired, then transactions must be used.)-.1 E .684(Once the application has initialized the Db subsystems that it is using, it may open the Db access method) +108 276 R 3.032(databases. F)108 288 R .532(or applications performing transactions, the databases must be opened after subsystem initial-) +-.15 F .533(ization, and cannot be opened as part of a transaction.)108 +300 R .533(Once the databases are opened, the application can)5.533 F +2.081(group sets of operations into transactions, by surrounding the operations with the appropriate) +108 312 R F1(DbTxn-)4.58 E(Mgr::be)108 324 Q(gin)-.4 E F0(,).24 E F1 +(DbTxn::commit)4.284 E F0(and)4.284 E F1(DbTxn::abort)4.284 E F0 4.284 +(calls. Databases)4.284 F 1.784(accessed by a transaction must not be) +4.284 F .386(closed during the transaction.)108 336 R .386(Note, it is not necessary to transaction protect read-only transactions, unless) +5.386 F(those transactions require repeatable reads.)108 348 Q .583 +(The Db access methods will mak)108 364.8 R 3.083(et)-.1 G .584 +(he appropriate calls into the lock, log and memory pool subsystems in) +-3.083 F 1.164 +(order to guarantee that transaction semantics are applied.)108 376.8 R +1.164(When the application is ready to e)6.164 F 1.163(xit, all out-) +-.15 F 1.138(standing transactions should ha)108 388.8 R 1.438 -.15 +(ve b)-.2 H 1.138(een committed or aborted.).15 F 1.138 +(At this point, all open Db \214les should be)6.138 F 3.039 +(closed. Once)108 400.8 R .539(the Db database \214les are closed, the Db subsystems should be closed, either e) +3.039 F .538(xplicitly or by)-.15 F(destro)108 412.8 Q(ying the)-.1 E F1 +(DbEn)2.5 E(v)-.4 E F0(\(3\) object.).32 E 1.716(It is also possible to use the locking, logging and transaction subsystems of Db to pro) +108 429.6 R 1.716(vide transaction)-.15 F .703(semantics to objects other than those described by the Db access methods.) +108 441.6 R .702(In these cases, the application)5.702 F 1.081 +(will need more e)108 453.6 R 1.081 +(xplicit customization of the subsystems as well as the de)-.15 F -.15 +(ve)-.25 G 1.082(lopment of appropriate data-).15 F +(structure-speci\214c reco)108 465.6 Q -.15(ve)-.15 G(ry functions.).15 +E -.15(Fo)108 482.4 S 2.89(re).15 G .39 +(xample, consider an application that pro)-3.04 F .389 +(vides transaction semantics to data stored in plain UNIX \214les)-.15 F +1.098(accessed using the)108 494.4 R F1 -.37(re)3.598 G(ad).37 E F0 +1.098(\(2\) and).77 F F1(write)3.598 E F0 1.098(\(2\) system calls.).18 +F 1.099(The operations for which transaction protection is)6.099 F +(desired are brack)108 506.4 Q(eted by calls to)-.1 E F1(DbTxnMgr::be) +2.5 E(gin)-.4 E F0(and)2.5 E F1(DbTxn::commit)2.5 E F0(.).68 E .444 +(Before data are referenced, the application must mak)108 523.2 R 2.944 +(eac)-.1 G .444(all to the lock manager)-2.944 F(,)-.4 E F1(DbLoc)2.944 +E(k)-.2 E F0 .444(\(3\), for a lock of).67 F .157 +(the appropriate type \(e.g., read\) on the object being lock)108 535.2 +R 2.657(ed. The)-.1 F .157 +(object might be a page in the \214le, a byte, a)2.657 F .041 +(range of bytes, or some k)108 547.2 R -.15(ey)-.1 G 5.041(.I)-.5 G +2.541(ti)-5.041 G 2.541(su)-2.541 G 2.541(pt)-2.541 G 2.541(ot)-2.541 G +.04(he application to ensure that appropriate locks are acquired.)-2.541 +F(Before)5.04 E 3.357(aw)108 559.2 S .858(rite is performed, the application should acquire a write lock on the object, by making an appropriate) +-3.357 F .339(call to the lock manager)108 571.2 R(,)-.4 E F1(DbLoc) +2.839 E(k)-.2 E F0(\(3\)).67 E F1(.).23 E F0 .339 +(Then, the application should mak)5.339 F 2.839(eac)-.1 G .339 +(all to the log manager)-2.839 F(,)-.4 E F1(DbLo)2.838 E(g)-.1 E F0(,) +.22 E .059 +(to record enough information to redo the operation in case of f)108 +583.2 R .06(ailure after commit and to undo the operation)-.1 F .877 +(in case of abort.)108 595.2 R .877(As discussed in the)5.877 F F1(DbLo) +3.377 E(g)-.1 E F0 .877 +(\(3\) manual page, the application is responsible for pro).22 F(viding) +-.15 E(an)108 607.2 Q 3.439(yn)-.15 G .939 +(ecessary structure to the log record.)-3.439 F -.15(Fo)5.939 G 3.439 +(re).15 G .94(xample, the application must understand what part of the) +-3.589 F .578(log record is an operation code, what part identi\214es the \214le being modi\214ed, what part is redo information,) +108 619.2 R(and what part is undo information.)108 631.2 Q 1.298(After the log message is written, the application may issue the write system call.) +108 648 R 1.299(After all requests are)6.299 F 1.229 +(issued, the application may call)108 660 R F1(DbTxn::commit)3.728 E F0 +6.228(.W).68 G(hen)-6.228 E F1(DbTxn::commit)3.728 E F0 1.228 +(returns, the caller is guaranteed)3.728 F +(that all necessary log writes ha)108 672 Q .3 -.15(ve b)-.2 H +(een written to disk.).15 E .101(At an)108 688.8 R 2.601(yt)-.15 G .101 +(ime, the application may call)-2.601 F F1(DbTxn::abort)2.601 E F0 2.601 +(,w).68 G .101(hich will result in the appropriate calls to the)-2.601 F +F1 -.37(re)2.602 G(co).37 E(ver)-.1 E F0 .069(method to restore the `) +108 700.8 R(`database')-.74 E 2.569('t)-.74 G 2.569(oac)-2.569 G .069 +(onsistent pre-transaction state.)-2.569 F .069(\(The reco)5.069 F -.15 +(ve)-.15 G 2.569(rm).15 G .068(ethod must be able to)-2.569 F +(either re-apply or undo the update depending on the conte)108 712.8 Q +(xt, for each dif)-.15 E(ferent type of log record.\))-.25 E .746 +(If the application should crash, the reco)108 729.6 R -.15(ve)-.15 G +.746(ry process uses the).15 F F1(DbLo)3.246 E(g)-.1 E F0(interf)3.246 E +.746(ace to read the log and call the)-.1 F(May 3, 1998)280.585 768 Q(2) +203.585 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 385.52(DbTxn\(3\) DbTxn\(3\))72 48 R/F1 10 +/Times-Italic@0 SF -.37(re)108 84 S(co).37 E(ver)-.1 E F0 +(method to restore the database to a consistent state.)2.5 E(The)108 +100.8 Q F1(DbTxn::pr)3.773 E(epar)-.37 E(e)-.37 E F0 1.273(method pro) +3.773 F 1.273(vides the core functionality to implement distrib)-.15 F +1.272(uted transactions, b)-.2 F 1.272(ut it)-.2 F .637 +(does not manage the noti\214cation of distrib)108 112.8 R .637 +(uted transaction managers.)-.2 F .637 +(The caller is responsible for issuing)5.637 F F1(DbTxn::pr)108 124.8 Q +(epar)-.37 E(e)-.37 E F0 .253 +(calls to all sites participating in the transaction.)2.754 F .253 +(If all responses are positi)5.253 F -.15(ve)-.25 G 2.753(,t).15 G .253 +(he caller can)-2.753 F .943(issue a)108 136.8 R F1(DbTxn::commit)3.443 +E F0 5.943(.I).68 G 3.443(fa)-5.943 G 1.243 -.15(ny o)-3.443 H 3.443(ft) +.15 G .943(he responses are ne)-3.443 F -.05(ga)-.15 G(ti).05 E -.15(ve) +-.25 G 3.443(,t).15 G .943(he caller should issue a)-3.443 F F1 +(DbTxn::abort)3.444 E F0 5.944(.I).68 G(n)-5.944 E(general, the)108 +148.8 Q F1(DbTxn::pr)2.5 E(epar)-.37 E(e)-.37 E F0 +(call requires that the transaction log be \215ushed to disk.)2.5 E/F2 9 +/Times-Bold@0 SF(TRANSA)72 165.6 Q(CTION ID LIMITS)-.495 E F0 .165 +(The transaction ID space in Berk)108 177.6 R(ele)-.1 E 2.665(yD)-.15 G +2.665(Bi)-2.665 G 2.665(s2)-2.665 G .165(^31, or 2 billion entries.) +-2.665 F .165(It is possible that some en)5.165 F(vironments)-.4 E .422 +(may need to be a)108 189.6 R -.1(wa)-.15 G .422(re of this limitation.) +.1 F .423 +(Consider an application performing 600 transactions a second for)5.422 +F(15 hours a day)108 201.6 Q 5(.T)-.65 G +(he transaction ID space will run out in roughly 66 days:)-5 E +(2^31 / \(600 * 15 * 60 * 60\) = 66)144 218.4 Q +(Doing only 100 transactions a second e)108 235.2 Q +(xhausts the transaction ID space in roughly one year)-.15 E(.)-.55 E +1.049(The transaction ID space is reset each time reco)108 252 R -.15 +(ve)-.15 G 1.048(ry is run.).15 F 1.048 +(If you reach the end of your transaction ID)6.048 F 1.262 +(space, shut do)108 264 R 1.263 +(wn your applications and restart them after running reco)-.25 F -.15 +(ve)-.15 G 1.263(ry \(see).15 F F1(db_r)3.763 E(eco)-.37 E(ver)-.1 E F0 +1.263(\(1\) for more).73 F 2.823(information\). The)108 276 R .323 +(most recently allocated transaction ID is the)2.823 F F1(st_last_txnid) +2.823 E F0 -.25(va)2.823 G .323(lue in the transaction statis-).25 F +(tics information, and is displayed by the)108 288 Q F1(db_stat)2.5 E F0 +(\(1\) utility).68 E(.)-.65 E F2(ERR)72 304.8 Q(ORS)-.27 E F0 .049 +(Methods mark)108 316.8 R .049(ed as returning)-.1 F F1(errno)2.549 E F0 +.049(will, by def)2.549 F .049(ault, thro)-.1 F 2.549(wa)-.25 G 2.549 +(ne)-2.549 G .05(xception that encapsulates the error informa-)-2.699 F +2.5(tion. The)108 328.8 R(def)2.5 E(ault error beha)-.1 E +(vior can be changed, see)-.2 E F1(DbException)2.5 E F0(\(3\).).24 E +(The)108 345.6 Q F1(DbTxn::pr)2.5 E(epar)-.37 E(e)-.37 E F0 +(method may f)2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0 +(\(3\)).24 E(or return)108 369.6 Q F1(errno)2.5 E F0(for an)2.5 E 2.5 +(yo)-.15 G 2.5(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: DbLog::\215ush\(3\),)-.25 E +(fcntl\(2\), f)108 381.6 Q(\215ush\(3\), and strerror\(3\).)-.25 E(The) +108 398.4 Q F1(DbTxn::commit)2.5 E F0(method may f)2.5 E(ail and thro) +-.1 E 2.5(wa)-.25 G F1(DbException)A F0(\(3\)).24 E(or return)108 422.4 +Q F1(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: DbLock-)-.25 E -.8(Ta)108 434.4 S(b::v) +.8 E(ec\(3\), DbLog::put\(3\), fcntl\(2\), f)-.15 E +(\215ush\(3\), malloc\(3\), memcp)-.25 E(y\(3\), and strerror\(3\).)-.1 +E .849(In addition, the)108 451.2 R F1(DbTxn::commit)3.349 E F0 .849 +(method may f)3.349 F .849(ail and thro)-.1 F 3.349(wa)-.25 G F1 +(DbException)A F0 .849(\(3\) or return).24 F F1(errno)3.348 E F0 .848 +(for the fol-)3.348 F(lo)108 463.2 Q(wing conditions:)-.25 E([EINV)108 +480 Q(AL])-1.35 E(The transaction w)133 492 Q(as aborted.)-.1 E(The)108 +508.8 Q F1(DbTxn::abort)2.5 E F0(method may f)2.5 E(ail and thro)-.1 E +2.5(wa)-.25 G F1(DbException)A F0(\(3\)).24 E(or return)108 532.8 Q F1 +(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions:)-.25 E(DBen)108 544.8 Q(v->tx_reco)-.4 E +-.15(ve)-.15 G(r\(3\), DbLockT).15 E(ab::v)-.8 E +(ec\(3\), DbLog::get\(3\), fcntl\(2\), f)-.15 E +(\215ush\(3\), memset\(3\), and strerror\(3\).)-.25 E([EINV)108 561.6 Q +(AL])-1.35 E(The transaction w)133 573.6 Q(as already aborted.)-.1 E F2 +(SEE ALSO)72 590.4 Q F1 .904(LIBTP: P)108 602.4 R(ortable)-.8 E 3.404 +(,M)-.1 G .904(odular T)-3.404 F -.15(ra)-.55 G .904(nsactions for UNIX) +.15 F F0 3.404(,M).94 G(ar)-3.404 E .904(go Seltzer)-.18 F 3.403(,M)-.4 +G .903(ichael Olson, USENIX proceedings,)-3.403 F -.4(Wi)108 614.4 S +(nter 1992.).4 E F2 -.09(BU)72 631.2 S(GS).09 E F0 +(Nested transactions are not yet implemented.)108 643.2 Q F1(db_ar)108 +667.2 Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E F1(db_c)2.5 E(hec)-.15 +E(kpoint)-.2 E F0(\(1\),).68 E F1(db_deadloc)2.5 E(k)-.2 E F0(\(1\),).67 +E F1(db_dump)2.5 E F0(\(1\),).19 E F1(db_load)2.5 E F0(\(1\),).77 E F1 +(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F1(db_stat)2.5 E F0 +(\(1\),).68 E F1(db_intr)108 679.2 Q(o)-.45 E F0(\(3\),).18 E F1 +(db_internal)2.5 E F0(\(3\),).51 E F1(db_thr)2.5 E(ead)-.37 E F0(\(3\),) +.77 E F1(Db)2.5 E F0(\(3\),).23 E F1(Dbc)2.5 E F0(\(3\),).31 E F1(DbEn) +2.5 E(v)-.4 E F0(\(3\),).32 E F1(DbException)2.5 E F0(\(3\),).24 E F1 +(DbInfo)2.5 E F0(\(3\),).18 E F1(DbLoc)108 691.2 Q(k)-.2 E F0(\(3\),).67 +E F1(DbLoc)2.5 E(kT)-.2 E(ab)-.92 E F0(\(3\),).23 E F1(DbLo)2.5 E(g)-.1 +E F0(\(3\),).22 E F1(DbLsn)2.5 E F0(\(3\),).24 E F1(DbMpool)2.5 E F0 +(\(3\),).51 E F1(DbMpoolF)2.5 E(ile)-.45 E F0(\(3\),).18 E F1(Dbt)2.5 E +F0(\(3\),).68 E F1(DbTxn)2.5 E F0(\(3\),).24 E F1(DbTxnMgr)108 703.2 Q +F0(\(3\)).73 E(May 3, 1998)280.585 768 Q(3)203.585 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/mancxx.ps/DbTxnMgr.ps b/mozilla/db/man/mancxx.ps/DbTxnMgr.ps new file mode 100644 index 00000000000..69f442501f8 --- /dev/null +++ b/mozilla/db/man/mancxx.ps/DbTxnMgr.ps @@ -0,0 +1,738 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:37 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 7 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(DbTxnMgr \255 Db transaction management)108 40.8 Q F0(SYNOPSIS)72 57.6 +Q/F2 10/Times-Bold@0 SF(#include )108 69.6 Q(static int)108 +93.6 Q(DbTxnMgr::open\(const char *dir)108 105.6 Q(,)-.92 E +(u_int32_t \215ags, int mode, DbEn)158 117.6 Q 2.5(v*)-.4 G(dben)-2.5 E +1.1 -.55(v, D)-.4 H(bTxnMgr **r).55 E(egionp\);)-.18 E(int)108 141.6 Q +(DbTxnMgr::begin\(DbTxn *pid, DbTxn **tid\);)108 153.6 Q(int)108 177.6 Q +(DbTxnMgr::checkpoint\(u_int32_t kbyte, u_int32_t min\) const;)108 189.6 +Q(int)108 213.6 Q(DbTxnMgr::close\(\);)108 225.6 Q(static int)108 249.6 +Q(DbTxnMgr::unlink\(const char *dir)108 261.6 Q 2.5(,i)-.92 G(nt f)-2.5 +E(or)-.25 E(ce, DbEn)-.18 E 2.5(v*)-.4 G(dben)-2.5 E(v\);)-.4 E(int)108 +285.6 Q(DbTxnMgr::stat\(DB_TXN_ST)108 297.6 Q 1.9 -.95(AT *)-.9 H +(*statp, v).95 E(oid *\(*db_malloc\)\(size_t\)\);)-.1 E F0(DESCRIPTION) +72 314.4 Q F1 1.02(The DB library is a f)108 326.4 R 1.019 +(amily of classes that pro)-.1 F 1.019 +(vides a modular programming interf)-.15 F 1.019 +(ace to transactions and)-.1 F 1.377(record-oriented \214le access.)108 +338.4 R 1.378(The library includes support for transactions, locking, logging and \214le page) +6.377 F .443(caching, as well as v)108 350.4 R .443(arious inde)-.25 F +-.15(xe)-.15 G 2.943(da).15 G .442(ccess methods.)-2.943 F(Man)5.442 E +2.942(yo)-.15 G 2.942(ft)-2.942 G .442 +(he classes \(e.g., the \214le page caching class\))-2.942 F .4(are useful independent of the other DB classes, although some classes are e) +108 362.4 R .4(xplicitly based on other classes)-.15 F +(\(e.g., transactions and logging\).)108 374.4 Q -.15(Fo)5 G 2.5(rag).15 +G(eneral description of the DB package, see)-2.5 E/F3 10/Times-Italic@0 +SF(db_intr)2.5 E(o)-.45 E F1(\(3\).).18 E .164(This manual page describes the speci\214c details of the Db transaction support.) +108 391.2 R .163(The DbTxnMgr class is used)5.164 F .863 +(in conjunction with)108 403.2 R F3(DbTxn)3.363 E F1 .863(\(3\) to pro) +.24 F .863(vide transaction semantics.)-.15 F .864 +(Full transaction support is pro)5.864 F .864(vided by a)-.15 F .262 +(collection of modules that pro)108 415.2 R .262(vide interf)-.15 F .261 +(aces to the services required for transaction processing.)-.1 F .261 +(These ser)5.261 F(-)-.2 E .585(vices are reco)108 427.2 R -.15(ve)-.15 +G .585(ry \(see).15 F F3(DbLo)3.085 E(g)-.1 E F1 .585 +(\(3\)\), concurrenc).22 F 3.085(yc)-.15 G .585(ontrol \(see)-3.085 F F3 +(DbLoc)3.085 E(k)-.2 E F1 .586(\(3\) and).67 F F3(DbLoc)3.086 E(kT)-.2 E +(ab)-.92 E F1 .586(\(3\)\), and the man-).23 F .961 +(agement of shared data \(see)108 439.2 R F3(DbMpool)3.461 E F1 .961 +(\(3\) and).51 F F3(DbMpoolF)3.461 E(ile)-.45 E F1 3.461(\(3\)\). T).18 +F .96(ransaction semantics can be applied to)-.35 F +(the access methods described in)108 451.2 Q F3(Db)2.5 E F1 +(\(3\) through method call parameters.).23 E .629(The model intended for transactional use \(and that is used by the access methods\) is that write-ahead log-) +108 468 R .048(ging is pro)108 480 R .048(vided by)-.15 F F3(DbLo)2.548 +E(g)-.1 E F1 .047(\(3\) to record both before- and after).22 F .047 +(-image logging.)-.2 F .047(Locking follo)5.047 F .047(ws a tw)-.25 F +(o-phase)-.1 E +(protocol \(i.e., all locks are released at transaction commit\).)108 +492 Q F3(DbTxnMgr::open)92 508.8 Q F1(The)108 520.8 Q F3(DbTxnMgr::open) +3.718 E F1 1.218(method copies a pointer)3.718 F 3.718(,t)-.4 G 3.719 +(ot)-3.718 G 1.219(he transaction re)-3.719 F 1.219 +(gion identi\214ed by the)-.15 F F2(dir)3.719 E(ectory)-.18 E F3(dir) +3.719 E F1(,).73 E(into the memory location referenced by)108 532.8 Q F3 +-.37(re)2.5 G(gionp)-.03 E F1(.).19 E 2.198(If the)108 549.6 R F3(dben) +4.698 E(v)-.4 E F1(ar)4.698 E 2.198(gument to)-.18 F F3(DbTxnMgr::open) +4.698 E F1 -.1(wa)4.698 G 4.698(si).1 G 2.198(nitialized using)-4.698 F +F3(DbEn)4.698 E(v::appinit)-.4 E F1(,).68 E F3(dir)4.697 E F1 2.197 +(is interpreted as)4.697 F(described by)108 561.6 Q F3(DbEn)2.5 E(v)-.4 +E F1(\(3\).).32 E .667(Otherwise, if)108 578.4 R F3(dir)3.167 E F1 .668 +(is not NULL, it is interpreted relati)3.167 F .968 -.15(ve t)-.25 H +3.168(ot).15 G .668(he current w)-3.168 F .668 +(orking directory of the process.)-.1 F(If)5.668 E F3(dir)108 590.4 Q F1 +2.388(is NULL, the follo)4.888 F 2.388(wing en)-.25 F 2.388(vironment v) +-.4 F 2.388(ariables are check)-.25 F 2.387(ed in order: `)-.1 F +(`TMPDIR')-.74 E 2.387(', `)-.74 F(`TEMP')-.74 E 2.387(', and)-.74 F +-.74(``)108 602.4 S(TMP').74 E 3.361('. If)-.74 F .861 +(one of them is set, transaction re)3.361 F .862 +(gion \214les are created relati)-.15 F 1.162 -.15(ve t)-.25 H 3.362(ot) +.15 G .862(he directory it speci\214es.)-3.362 F(If)5.862 E .836 +(none of them are set, the \214rst possible one of the follo)108 614.4 R +.836(wing directories is used:)-.25 F F3(/var/tmp)3.336 E F1(,).19 E F3 +(/usr/tmp)3.335 E F1(,).19 E F3(/temp)3.335 E F1(,).19 E F3(/tmp)108 +626.4 Q F1(,).19 E F3(C:/temp)2.5 E F1(and)2.5 E F3(C:/tmp)2.5 E F1(.) +.19 E 1.21(All \214les associated with the transaction re)108 643.2 R +1.21(gion are created in this directory)-.15 F 6.21(.T)-.65 G 1.21 +(his directory must already)-6.21 F -.15(ex)108 655.2 S .613 +(ist when DbTxnMgr::open is called.).15 F .613(If the transaction re) +5.613 F .613(gion already e)-.15 F .612(xists, the process must ha)-.15 +F .912 -.15(ve p)-.2 H(er).15 E(-)-.2 E .431 +(mission to read and write the e)108 667.2 R .431(xisting \214les.)-.15 +F .431(If the transaction re)5.431 F .431(gion does not already e)-.15 F +.432(xist, it is optionally)-.15 F(created and initialized.)108 679.2 Q +(The)108 696 Q F3<8d61>3.761 E(gs)-.1 E F1(and)3.761 E F3(mode)3.761 E +F1(ar)3.761 E 1.261(guments specify ho)-.18 F 3.761<778c>-.25 G 1.26 +(les will be opened and/or created when the)-3.761 F 3.76(yd)-.15 G(on') +-3.76 E 3.76(ta)-.18 G(lready)-3.76 E -.15(ex)108 708 S 2.5(ist. The).15 +F(\215ags v)2.5 E(alue is speci\214ed by)-.25 E F2(or)2.5 E F1 +('ing together one or more of the follo)A(wing v)-.25 E(alues:)-.25 E(1) +535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 351.08(DbTxnMgr\(3\) DbTxnMgr\(3\))72 48 R +(DB_CREA)108 84 Q(TE)-1.11 E .483(Create an)133 96 R 2.983(yu)-.15 G +.483(nderlying \214les, as necessary)-2.983 F 5.483(.I)-.65 G 2.983(ft) +-5.483 G .483(he \214les do not already e)-2.983 F .483 +(xist and the DB_CREA)-.15 F .484(TE \215ag)-1.11 F +(is not speci\214ed, the call will f)133 108 Q(ail.)-.1 E(DB_THREAD)108 +136.8 Q 1.462(Cause the DbTxnMgr handle returned by the)133 148.8 R/F1 +10/Times-Italic@0 SF(DbTxnMgr::open)3.962 E F0 1.461 +(method to be useable by multiple)3.961 F +(threads within a single address space, i.e., to be `)133 160.8 Q +(`free-threaded')-.74 E('.)-.74 E(DB_TXN_NOSYNC)108 189.6 Q .452 +(On transaction commit, do not synchronously \215ush the log.)133 201.6 +R .452(This means that transactions e)5.452 F .453(xhibit the)-.15 F -.4 +(AC)133 213.6 S 3.54(I\().4 G(atomicity)-3.54 E 3.54(,c)-.65 G +(onsistenc)-3.54 E 3.54(ya)-.15 G 1.04(nd isolation\) properties, b) +-3.54 F 1.04(ut not D \(durability\), i.e., database inte)-.2 F(grity) +-.15 E .87(will be maintained b)133 225.6 R .87(ut it is possible that some number of the most recently committed transactions) +-.2 F(may be undone during reco)133 237.6 Q -.15(ve)-.15 G +(ry instead of being redone.).15 E 1.216 +(The number of transactions that are potentially at risk is go)133 261.6 +R -.15(ve)-.15 G 1.216(rned by ho).15 F 3.716(wo)-.25 G 1.216 +(ften the log is check-)-3.716 F(pointed \(see)133 273.6 Q F1(db_c)2.5 E +(hec)-.15 E(kpoint)-.2 E F0(\(1\)\) and ho).68 E 2.5(wm)-.25 G(an)-2.5 E +2.5(yl)-.15 G(og updates can \214t on a single log page.)-2.5 E .544 +(All \214les created by the transaction subsystem are created with mode) +108 290.4 R F1(mode)3.044 E F0 .544(\(as described in)3.044 F F1 -.15 +(ch)3.044 G(mod).15 E F0 .544(\(2\)\) and).77 F .392 +(modi\214ed by the process' umask v)108 302.4 R .391 +(alue at the time of creation \(see)-.25 F F1(umask)2.891 E F0 2.891 +(\(2\)\). The).67 F .391(group o)2.891 F .391(wnership of cre-)-.25 F +(ated \214les is based on the system and directory def)108 314.4 Q +(aults, and is not further speci\214ed by DB.)-.1 E .959(The transaction subsystem is con\214gured based on which set methods ha) +108 331.2 R 1.259 -.15(ve b)-.2 H .959(een used.).15 F .959(It is e) +5.959 F .959(xpected that)-.15 F .995 +(applications will use a single DbEn)108 343.2 R 3.495(vo)-.4 G .995 +(bject as the ar)-3.495 F .994 +(gument to all of the subsystems in the DB package.)-.18 F .237 +(The \214elds of the DbEn)108 355.2 R 2.737(vo)-.4 G .237(bject used by) +-2.737 F F1(DbTxnMgr::open)2.737 E F0 .238(are described belo)2.738 F +4.038 -.65(w. A)-.25 H 2.738(sr).65 G .238(eferences to the DbEn)-2.738 +F(v)-.4 E .448(object may be maintained by)108 367.2 R F1 +(DbTxnMgr::open)2.948 E F0 2.948(,i).24 G 2.948(ti)-2.948 G 2.948(sn) +-2.948 G .447(ecessary that the DbEn)-2.948 F 2.947(vo)-.4 G .447 +(bject and memory it refer)-2.947 F(-)-.2 E .445(ences be v)108 379.2 R +.446(alid until the object is destro)-.25 F 2.946(yed. An)-.1 F 2.946 +(yo)-.15 G 2.946(ft)-2.946 G .446(he DbEn)-2.946 F 2.946<768c>-.4 G .446 +(elds that are not e)-2.946 F .446(xplicitly set will def)-.15 F(ault) +-.1 E(to appropriate v)108 391.2 Q(alues.)-.25 E .517(The follo)108 408 +R .517(wing \214elds in the DbEn)-.25 F 3.016(vo)-.4 G .516(bject may be initialized, using the appropriate set method, before call-) +-3.016 F(ing)108 420 Q F1(DbTxnMgr::open)2.5 E F0(:).24 E -.2(vo)108 +448.8 S(id *\(*db_errcall\)\(char *db_errpfx, char *b).2 E(uf)-.2 E +(fer\);)-.25 E(FILE *db_err\214le;)108 460.8 Q(const char *db_errpfx;) +108 472.8 Q(class ostream *db_error_stream;)108 484.8 Q(int db_v)108 +496.8 Q(erbose;)-.15 E(The error \214elds of the DbEn)133 508.8 Q 2.5 +(vb)-.4 G(eha)-2.5 E .3 -.15(ve a)-.2 H 2.5(sd).15 G(escribed for)-2.5 E +F1(DbEn)2.5 E(v)-.4 E F0(\(3\).).32 E(DbLog *lg_info;)108 525.6 Q .543 +(The logging re)136.043 537.6 R .543 +(gion that is being used for this transaction en)-.15 F 3.043 +(vironment. The)-.4 F F1(lg_info)3.043 E F0 .544(\214eld contains a) +3.043 F 1.263(return v)133 549.6 R 1.263(alue from the method)-.25 F F1 +(DbLo)3.763 E(g::open)-.1 E F0(.).24 E/F2 10/Times-Bold@0 SF 1.263 +(Logging is r)6.263 F(equir)-.18 E 1.262(ed f)-.18 F 1.262 +(or transaction en)-.25 F(vir)-.4 E(onments,)-.18 E(and it is an err)133 +561.6 Q(or to not specify a logging r)-.18 E(egion.)-.18 E F0(DbLockT) +108 578.4 Q(ab *lk_info;)-.8 E .613(The locking re)136.113 590.4 R .613 +(gion that is being used for this transaction en)-.15 F 3.113 +(vironment. The)-.4 F F1(lk_info)3.113 E F0 .614(\214eld contains a) +3.113 F .077(return v)133 602.4 R .077(alue from the method)-.25 F F1 +(DbLoc)2.577 E(kT)-.2 E(ab::open)-.92 E F0 5.077(.I).24 G(f)-5.077 E F1 +(lk_info)2.577 E F0 .077(is NULL, no locking is done in this trans-) +2.577 F(action en)133 614.4 Q(vironment.)-.4 E(u_int32_t tx_max;)108 +631.2 Q 1.887 +(The maximum number of simultaneous transactions that are supported.)133 +643.2 R 1.888(This bounds the size of)6.888 F .474 +(backing \214les and is used to deri)133 655.2 R .774 -.15(ve l)-.25 H +.474(imits for the size of the lock re).15 F .473(gion and log\214les.) +-.15 F .473(When there are)5.473 F 1.895(more than)133 667.2 R F1 +(tx_max)4.395 E F0 1.896(concurrent transactions, calls to)4.396 F F1 +(DbTxnMgr::be)4.396 E(gin)-.4 E F0 1.896(may cause backing \214les to) +4.396 F(gro)133 679.2 Q 3.8 -.65(w. I)-.25 H(f).65 E F1(tx_max)2.5 E F0 +(is 0, a def)2.5 E(ault v)-.1 E(alue is used.)-.25 E(int DbTxnMgr::reco) +108 696 Q -.15(ve)-.15 G(r\(DbLog *logp, Dbt *DbLog::rec,).15 E +(DbLsn *lsnp, int redo, v)183 708 Q(oid *info\);)-.2 E 2.558(Am)133 720 +S .057(ethod that is called by)-2.558 F F1(DbTxn::abort)2.557 E F0 .057 +(during transaction abort.)2.557 F .057(This method tak)5.057 F .057 +(es \214v)-.1 F 2.557(ea)-.15 G -.18(rg)-2.557 G(uments:).18 E +(May 4, 1998)280.585 768 Q(2)203.585 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 351.08(DbTxnMgr\(3\) DbTxnMgr\(3\))72 48 R 4.72 +(logp A)133 84 R(pointer to the transaction log \(DbLog *\).)2.5 E +(DbLog::rec)133 100.8 Q 2.5(Al)158 112.8 S(og record.)-2.5 E 5.83 +(lsnp A)133 129.6 R(pointer to a log sequence number \(DbLsn *\).)2.5 E +4.73(redo An)133 146.4 R(inte)2.5 E(ger v)-.15 E +(alue that is set to one of the follo)-.25 E(wing v)-.25 E(alues:)-.25 E +(DB_TXN_B)158 175.2 Q -.4(AC)-.35 G(KW).4 E(ARD_R)-1.2 E(OLL)-.4 E 1.136 +(The log is being read backw)183 187.2 R 1.136 +(ard to determine which transactions ha)-.1 F 1.436 -.15(ve b)-.2 H +1.136(een committed).15 F(and which transactions were not \(and should therefore be aborted during reco) +183 199.2 Q -.15(ve)-.15 G(ry\).).15 E(DB_TXN_FOR)158 228 Q -1.2(WA)-.55 +G(RD_R)1.2 E(OLL)-.4 E 1.744(The log is being played forw)183 240 R +1.744(ard, an)-.1 F 4.244(yt)-.15 G 1.744 +(ransaction ids encountered that ha)-4.244 F 2.043 -.15(ve n)-.2 H 1.743 +(ot been).15 F(entered into the list referenced by)183 252 Q/F1 10 +/Times-Italic@0 SF(info)2.5 E F0(should be ignored.)2.5 E +(DB_TXN_OPENFILES)158 280.8 Q +(The log is being read to open all the \214les required to perform reco) +183 292.8 Q -.15(ve)-.15 G(ry).15 E(.)-.65 E(DB_TXN_REDO)158 321.6 Q +(Redo the operation described by the log record.)183 333.6 Q +(DB_TXN_UNDO)158 362.4 Q +(Undo the operation described by the log record.)183 374.4 Q 6.39 +(info An)133 391.2 R(opaque pointer used to reference the list of transaction IDs encountered during reco) +2.5 E -.15(ve)-.15 G(ry).15 E(.)-.65 E(If)133 408 Q F1 -.37(re)3.325 G +(co).37 E(ver)-.1 E F0 .825(is NULL, the def)3.325 F .825(ault is that only Db access method operations are transaction protected,) +-.1 F(and the def)133 420 Q(ault reco)-.1 E -.15(ve)-.15 G 2.5(rm).15 G +(ethod will be used.)-2.5 E(The)108 436.8 Q F1(DbTxnMgr::open)3.417 E F0 +.917(method thro)3.417 F .917(ws a)-.25 F F1(DbException)3.417 E F0 .917 +(\(3\) or returns the v).24 F .917(alue of)-.25 F F1(errno)3.417 E F0 +.917(on f)3.417 F .916(ailure and 0 on)-.1 F(success.)108 448.8 Q F1 +(DbTxnMgr::be)92 465.6 Q(gin)-.4 E F0(The)108 477.6 Q F1(DbTxnMgr::be) +2.901 E(gin)-.4 E F0 .401(method creates a ne)2.901 F 2.901(wt)-.25 G +.401(ransaction in the transaction manager)-2.901 F 2.902(,c)-.4 G(op) +-2.902 E .402(ying a pointer to a)-.1 F .217 +(DbTxn that uniquely identi\214es it into the memory referenced by)108 +489.6 R F1(tid)2.716 E F0 5.216(.I).77 G 2.716(ft)-5.216 G(he)-2.716 E +F1(pid)2.716 E F0(ar)2.716 E .216(gument is non-NULL, the)-.18 F(ne)108 +501.6 Q 2.5(wt)-.25 G +(ransaction is a nested transaction with the transaction indicated by) +-2.5 E F1(pid)2.5 E F0(as its parent.)2.5 E -.35(Tr)108 518.4 S .642 +(ansactions may not span threads, i.e., each transaction must be).35 F +.643(gin and end in the same thread, and each)-.15 F +(transaction may only be used by a single thread.)108 530.4 Q(The)108 +547.2 Q F1(DbTxnMgr::be)3.269 E(gin)-.4 E F0 .768(method thro)3.269 F +.768(ws a)-.25 F F1(DbException)3.268 E F0 .768(\(3\) or returns the v) +.24 F .768(alue of)-.25 F F1(errno)3.268 E F0 .768(on f)3.268 F .768 +(ailure and 0 on)-.1 F(success.)108 559.2 Q F1(DbTxnMgr::close)92 576 Q +F0(The)108 588 Q F1(DbTxnMgr::close)5.206 E F0 2.707 +(method detaches a process from the transaction en)5.206 F 2.707 +(vironment speci\214ed by the)-.4 F .461(DbTxnMgr object.)108 600 R .461 +(All mapped re)5.461 F .461(gions are unmapped and an)-.15 F 2.961(ya) +-.15 G .46(llocated resources are freed.)-2.961 F(An)5.46 E 2.96(yu)-.15 +G(ncom-)-2.96 E(mitted transactions are aborted.)108 612 Q 2.336 +(In addition, if the)108 628.8 R F1(dir)4.836 E F0(ar)4.836 E 2.337 +(gument to)-.18 F F1(DbTxnMgr::open)4.837 E F0 -.1(wa)4.837 G 4.837(sN) +.1 G 2.337(ULL and)-4.837 F F1(dben)4.837 E(v)-.4 E F0 -.1(wa)4.837 G +4.837(sn).1 G 2.337(ot initialized using)-4.837 F F1(DbEn)108 640.8 Q +(v::appinit)-.4 E F0 4.368(,a).68 G 1.867 +(ll \214les created for this shared re)-4.368 F 1.867(gion will be remo) +-.15 F -.15(ve)-.15 G 1.867(d, as if).15 F F1(DbTxnMgr::unlink)4.367 E +F0(were)4.367 E(called.)108 652.8 Q 1.514 +(When multiple threads are using the DbTxnMgr handle concurrently)108 +669.6 R 4.015(,o)-.65 G 1.515(nly a single thread may call the)-4.015 F +F1(DbTxnMgr::close)108 681.6 Q F0(method.)2.5 E(The)108 698.4 Q F1 +(DbTxnMgr::close)3.348 E F0 .848(method thro)3.348 F .848(ws a)-.25 F F1 +(DbException)3.348 E F0 .848(\(3\) or returns the v).24 F .847(alue of) +-.25 F F1(errno)3.347 E F0 .847(on f)3.347 F .847(ailure and 0 on)-.1 F +(success.)108 710.4 Q(May 4, 1998)280.585 768 Q(3)203.585 E EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 351.08(DbTxnMgr\(3\) DbTxnMgr\(3\))72 48 R/F1 10 +/Times-Italic@0 SF(DbTxnMgr::unlink)92 84 Q F0(The)108 96 Q F1 +(DbTxnMgr::unlink)2.803 E F0 .303(method destro)2.803 F .303 +(ys the transaction re)-.1 F .303(gion identi\214ed by the directory) +-.15 F F1(dir)2.803 E F0 2.803(,r).73 G(emo)-2.803 E .304(ving all)-.15 +F .853(\214les used to implement the transaction re)108 108 R 3.353 +(gion. \(The)-.15 F(directory)3.353 E F1(dir)3.352 E F0 .852 +(is not remo)3.352 F -.15(ve)-.15 G 3.352(d.\) If).15 F .852 +(there are processes)3.352 F 2.04(that ha)108 120 R 2.341 -.15(ve c)-.2 +H(alled).15 E F1(DbTxnMgr::open)4.541 E F0 2.041(without calling)4.541 F +F1(DbTxnMgr::close)4.541 E F0 2.041 +(\(i.e., there are processes currently)4.541 F .191 +(using the transaction re)108 132 R(gion\),)-.15 E F1(DbTxnMgr::unlink) +2.691 E F0 .191(will f)2.691 F .19 +(ail without further action, unless the force \215ag is set,)-.1 F .543 +(in which case)108 144 R F1(DbTxnMgr::unlink)3.043 E F0 .543 +(will attempt to remo)3.043 F .843 -.15(ve t)-.15 H .543 +(he transaction re).15 F .544(gion \214les re)-.15 F -.05(ga)-.15 G .544 +(rdless of an).05 F 3.044(yp)-.15 G(ro-)-3.044 E +(cesses still using the transaction re)108 156 Q(gion.)-.15 E .766 +(The result of attempting to forcibly destro)108 172.8 R 3.266(yt)-.1 G +.766(he re)-3.266 F .766(gion when a process has the re)-.15 F .765 +(gion open is unspeci\214ed.)-.15 F 1.232 +(Processes using a shared memory re)108 184.8 R 1.232 +(gion maintain an open \214le descriptor for it.)-.15 F 1.232 +(On UNIX systems, the)6.232 F(re)108 196.8 Q .474(gion remo)-.15 F -.25 +(va)-.15 G 2.974(ls).25 G .473(hould succeed and processes that ha) +-2.974 F .773 -.15(ve a)-.2 H .473(lready joined the re).15 F .473 +(gion should continue to run in)-.15 F 1.059(the re)108 208.8 R 1.059 +(gion without change, ho)-.15 F(we)-.25 E -.15(ve)-.25 G 3.559(rp).15 G +1.059(rocesses attempting to join the transaction re)-3.559 F 1.06 +(gion will either f)-.15 F 1.06(ail or)-.1 F .811 +(attempt to create a ne)108 220.8 R 3.311(wr)-.25 G -.15(eg)-3.311 G +3.311(ion. On).15 F .811(other systems, e.g., WNT)3.311 F 3.31(,w)-.74 G +.81(here the)-3.31 F F1(unlink)3.31 E F0 .81(\(2\) system call will f) +.67 F .81(ail if)-.1 F(an)108 232.8 Q 2.5(yp)-.15 G +(rocess has an open \214le descriptor for the \214le, the re)-2.5 E +(gion remo)-.15 E -.25(va)-.15 G 2.5(lw).25 G(ill f)-2.5 E(ail.)-.1 E +.929(In the case of catastrophic or system f)108 249.6 R .929 +(ailure, database reco)-.1 F -.15(ve)-.15 G .93 +(ry must be performed \(see).15 F F1(db_r)3.43 E(eco)-.37 E(ver)-.1 E F0 +.93(\(1\) or).73 F .439(the DB_RECO)108 261.6 R .439(VER and DB_RECO)-.5 +F(VER_F)-.5 E -1.21 -1.11(AT A)-.74 H 2.939<4c8d>1.11 G .439(ags to) +-2.939 F F1(DbEn)2.939 E(v::appinit)-.4 E F0 2.939(\(3\)\). Alternati) +.68 F -.15(ve)-.25 G(ly).15 E 2.939(,i)-.65 G 2.939(fr)-2.939 G(eco) +-2.939 E -.15(ve)-.15 G .439(ry is).15 F .487 +(not required because no database state is maintained across f)108 273.6 +R .488(ailures, it is possible to clean up a transaction)-.1 F(re)108 +285.6 Q .269(gion by remo)-.15 F .269 +(ving all of the \214les in the directory speci\214ed to the)-.15 F F1 +(DbTxnMgr::open)2.768 E F0 .268(method, as transaction)2.768 F(re)108 +297.6 Q .193(gion \214les are ne)-.15 F -.15(ve)-.25 G 2.693(rc).15 G +.193(reated in an)-2.693 F 2.693(yd)-.15 G .193 +(irectory other than the one speci\214ed to)-2.693 F F1(DbTxnMgr::open) +2.693 E F0 5.194(.N).24 G .194(ote, ho)-5.194 F(w-)-.25 E -2.15 -.25 +(ev e)108 309.6 T .952 -.4(r, t).25 H .151 +(hat this has the potential to remo).4 F .451 -.15(ve \214)-.15 H .151 +(les created by the other DB subsystems in this database en).15 F +(viron-)-.4 E(ment.)108 321.6 Q(The)108 338.4 Q F1(DbTxnMgr::unlink) +3.069 E F0 .569(method thro)3.069 F .569(ws a)-.25 F F1(DbException) +3.069 E F0 .569(\(3\) or returns the v).24 F .569(alue of)-.25 F F1 +(errno)3.07 E F0 .57(on f)3.07 F .57(ailure and 0 on)-.1 F(success.)108 +350.4 Q F1(DbTxnMgr::c)92 367.2 Q(hec)-.15 E(kpoint)-.2 E F0(The)108 +379.2 Q F1(DbTxnMgr::c)3.285 E(hec)-.15 E(kpoint)-.2 E F0 .785(method syncs the underlying memory pool, writes a checkpoint record to the) +3.285 F(log and then \215ushes the log.)108 391.2 Q .507(If either)108 +408 R F1(kbyte)3.007 E F0(or)3.008 E F1(min)3.008 E F0 .508 +(is non-zero, the checkpoint is only done if more than)3.008 F F1(min) +3.008 E F0 .508(minutes ha)3.008 F .808 -.15(ve p)-.2 H .508 +(assed since).15 F(the last checkpoint, or if more than)108 420 Q F1 +(kbyte)2.5 E F0(kilobytes of log data ha)2.5 E .3 -.15(ve b)-.2 H +(een written since the last checkpoint.).15 E(The)108 436.8 Q F1 +(DbTxnMgr::c)2.872 E(hec)-.15 E(kpoint)-.2 E F0 .372(method thro)2.872 F +.372(ws a)-.25 F F1(DbException)2.872 E F0 .372(\(3\) or returns the v) +.24 F .372(alue of)-.25 F F1(errno)2.872 E F0 .372(on f)2.872 F .372 +(ailure, 0 on)-.1 F .412(success, and DB_INCOMPLETE if there were pages that needed to be written b) +108 448.8 R .412(ut that)-.2 F F1 .412(DbMpool::sync \(3\))2.912 F F0 +(\(see)108 460.8 Q F1 .064(DbMpool \(3\)\))2.564 F F0 -.1(wa)2.564 G +2.564(su).1 G .064(nable to write immediately)-2.564 F 5.064(.I)-.65 G +2.564(nt)-5.064 G .064(his case, the)-2.564 F F1(DbTxnMgr::c)2.564 E +(hec)-.15 E(kpoint)-.2 E F0 .064(call should be)2.564 F(retried.)108 +472.8 Q(The)108 489.6 Q F1(DbTxnMgr::c)3.951 E(hec)-.15 E(kpoint)-.2 E +F0 1.451(method is based on the C)3.951 F F1(txn_c)3.952 E(hec)-.15 E +(kpoint)-.2 E F0 1.452(function, which is the underlying)3.952 F 1.572 +(function used by the)108 501.6 R F1(db_c)4.072 E(hec)-.15 E(kpoint)-.2 +E F0 1.572(\(1\) utility).68 F 6.571(.S)-.65 G 1.571 +(ee the source code for the)-6.571 F F1(db_c)4.071 E(hec)-.15 E(kpoint) +-.2 E F0 1.571(utility for an)4.071 F -.15(ex)108 513.6 S +(ample of using).15 E F1(txn_c)2.5 E(hec)-.15 E(kpoint)-.2 E F0 +(in a UNIX en)2.5 E(vironment.)-.4 E F1(DbTxnMgr::stat)92 530.4 Q F0 +(The)108 542.4 Q F1(DbTxnMgr::stat)2.5 E F0(method creates a statistical structure and copies pointers to it into user) +108 566.4 Q(-speci\214ed memory locations.)-.2 E .048 +(Statistical structures are created in allocated memory)108 583.2 R +5.049(.I)-.65 G(f)-5.049 E F1(db_malloc)2.549 E F0 .049 +(is non-NULL, it is called to allocate the)2.549 F(memory)108 595.2 Q +2.83(,o)-.65 G .33(therwise, the library function)-2.83 F F1(malloc) +2.829 E F0 .329(\(3\) is used.).31 F .329(The function)5.329 F F1 +(db_malloc)2.829 E F0 .329(must match the calling)2.829 F(con)108 607.2 +Q -.15(ve)-.4 G 2.03(ntions of the).15 F F1(malloc)4.53 E F0 2.031 +(\(3\) library routine.).31 F(Re)7.031 E -.05(ga)-.15 G 2.031 +(rdless, the caller is responsible for deallocating the).05 F .708 +(returned memory)108 619.2 R 5.708(.T)-.65 G 3.208(od)-6.508 G .708 +(eallocate the returned memory)-3.208 F 3.208(,f)-.65 G .707 +(ree each returned memory pointer; pointers inside)-3.208 F +(the memory do not need to be indi)108 631.2 Q(vidually freed.)-.25 E +4.148(The transaction re)108 660 R 4.148 +(gion statistics are stored in a structure of type DB_TXN_ST)-.15 F +6.369 -1.11(AT \()-.93 H -1.95(typedef ')1.11 F 6.649(di)-.5 G(n)-6.649 +E 2.5(\). The)108 672 R(follo)2.5 E(wing DB_TXN_ST)-.25 E 2.22 +-1.11(AT \214)-.93 H(elds will be \214lled in:)1.11 E +(DbLsn st_last_ckp;)108 688.8 Q(The LSN of the last checkpoint.)133 +700.8 Q(May 4, 1998)280.585 768 Q(4)203.585 E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 351.08(DbTxnMgr\(3\) DbTxnMgr\(3\))72 48 R +(DbLsn st_pending_ckp;)108 84 Q 3.142(The LSN of an)133 96 R 5.642(yc) +-.15 G 3.142(heckpoint that is currently in progress.)-5.642 F(If)8.142 +E/F1 10/Times-Italic@0 SF(st_pending_c)5.642 E(kp)-.2 E F0 3.142 +(is the same as)5.642 F F1(st_last_c)133 108 Q(kp)-.2 E F0 +(there is no checkpoint in progress.)2.5 E(time_t st_time_ckp;)108 120 Q +(The time the last completed checkpoint \214nished \(as returned by)133 +132 Q F1(time)2.5 E F0(\(2\)\).).18 E(u_int32_t st_last_txnid;)108 144 Q +(The last transaction ID allocated.)133 156 Q(u_int32_t st_maxtxns;)108 +168 Q(The maximum number of acti)133 180 Q .3 -.15(ve t)-.25 H +(ransactions supported by the re).15 E(gion.)-.15 E +(u_int32_t st_naborts;)108 192 Q(The number of transactions that ha)133 +204 Q .3 -.15(ve a)-.2 H(borted.).15 E(u_int32_t st_nacti)108 216 Q -.15 +(ve)-.25 G(;).15 E(The number of transactions that are currently acti) +133 228 Q -.15(ve)-.25 G(.).15 E(u_int32_t st_nbe)108 240 Q(gins;)-.15 E +(The number of transactions that ha)133 252 Q .3 -.15(ve b)-.2 H -.15 +(eg).15 G(un.).15 E(u_int32_t st_ncommits;)108 264 Q +(The number of transactions that ha)133 276 Q .3 -.15(ve c)-.2 H +(ommitted.).15 E(u_int32_t ;)108 288 Q +(The number of times that a thread of control w)133 300 Q +(as forced to w)-.1 E(ait before obtaining the re)-.1 E(gion lock.)-.15 +E(u_int32_t ;)108 312 Q(The number of times that a thread of control w) +133 324 Q(as able to obtain the re)-.1 E(gion lock without w)-.15 E +(aiting.)-.1 E(DB_TXN_A)108 348 Q(CTIVE *st_txnarray;)-.4 E 4.105(Ap)133 +360 S 1.606(ointer to an array of)-4.105 F F1(st_nactive)4.106 E F0 +(DB_TXN_A)4.106 E 1.606(CTIVE structures, describing the currently acti) +-.4 F -.15(ve)-.25 G 4.11(transactions. The)133 372 R(follo)4.11 E 1.61 +(wing \214elds of the DB_TXN_A)-.25 F 1.61(CTIVE structure \(typedef)-.4 +F 2.61 -.5('d i).55 H 4.11(n<).5 G(db_cxx.h>\))-4.11 E +(will be \214lled in:)133 384 Q(u_int32_t txnid;)133 412.8 Q +(The transaction ID as returned by)158 424.8 Q F1(DbTxnMgr::be)2.5 E +(gin)-.4 E F0(\(3\).).24 E(DbLsn lsn;)133 436.8 Q +(The LSN of the transaction-be)158 448.8 Q(gin record.)-.15 E/F2 9 +/Times-Bold@0 SF(ENVIR)72 470.4 Q(ONMENT V)-.27 E(ARIABLES)-1.215 E F0 +(The follo)108 482.4 Q(wing en)-.25 E(vironment v)-.4 E(ariables af)-.25 +E(fect the e)-.25 E -.15(xe)-.15 G(cution of).15 E F1(db_txn)2.5 E F0(:) +.24 E(DB_HOME)108 499.2 Q .063(If the)133 511.2 R F1(dben)2.563 E(v)-.4 +E F0(ar)2.563 E .063(gument to)-.18 F F1(DbTxnMgr::open)2.563 E F0 -.1 +(wa)2.563 G 2.563(si).1 G .063(nitialized using)-2.563 F F1(db_appinit) +2.564 E F0 2.564(,t).68 G .064(he en)-2.564 F .064(vironment v)-.4 F +(ariable)-.25 E .508(DB_HOME may be used as the path of the database home for the interpretation of the) +133 523.2 R F1(dir)3.008 E F0(ar)3.008 E(gument)-.18 E(to)133 535.2 Q F1 +(DbTxnMgr::open)2.5 E F0 2.5(,a).24 G 2.5(sd)-2.5 G(escribed in)-2.5 E +F1(db_appinit)2.5 E F0(\(3\).).68 E(TMPDIR)108 552 Q .71(If the)133 564 +R F1(dben)3.21 E(v)-.4 E F0(ar)3.21 E .71(gument to)-.18 F F1 +(DbTxnMgr::open)3.211 E F0 -.1(wa)3.211 G 3.211(sN).1 G .711 +(ULL or not initialized using)-3.211 F F1(db_appinit)3.211 E F0 3.211 +(,t).68 G .711(he en)-3.211 F(vi-)-.4 E .381(ronment v)133 576 R .381(ariable TMPDIR may be used as the directory in which to create the transaction re) +-.25 F .38(gion, as)-.15 F(described in the)133 588 Q F1(DbTxnMgr::open) +2.5 E F0(section abo)2.5 E -.15(ve)-.15 G(.).15 E F2(ERR)72 604.8 Q(ORS) +-.27 E F0 .049(Methods mark)108 616.8 R .049(ed as returning)-.1 F F1 +(errno)2.549 E F0 .049(will, by def)2.549 F .049(ault, thro)-.1 F 2.549 +(wa)-.25 G 2.549(ne)-2.549 G .05 +(xception that encapsulates the error informa-)-2.699 F 2.5(tion. The) +108 628.8 R(def)2.5 E(ault error beha)-.1 E(vior can be changed, see)-.2 +E F1(DbException)2.5 E F0(\(3\).).24 E(The)108 645.6 Q F1 +(DbTxnMgr::open)2.5 E F0(method may f)2.5 E(ail and thro)-.1 E 2.5(wa) +-.25 G F1(DbException)A F0(\(3\)).24 E(or return)108 669.6 Q F1(errno) +2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: DbTxn-)-.25 E +(Mgr::unlink\(3\), close\(2\), db_v)108 681.6 Q +(ersion\(3\), fcntl\(2\), f)-.15 E +(\215ush\(3\), lseek\(2\), malloc\(3\), memcp)-.25 E +(y\(3\), memset\(3\),)-.1 E(mmap\(2\), munmap\(2\), open\(2\), sig\214llset\(3\), sigprocmask\(2\), stat\(2\), strcp) +108 693.6 Q(y\(3\), strdup\(3\), strerror\(3\),)-.1 E +(strlen\(3\), time\(3\), unlink\(2\), and write\(2\).)108 705.6 Q 1.553 +(In addition, the)108 722.4 R F1(DbTxnMgr::open)4.053 E F0 1.553 +(method may f)4.053 F 1.553(ail and thro)-.1 F 4.053(wa)-.25 G F1 +(DbException)A F0 1.554(\(3\) or return).24 F F1(errno)4.054 E F0 1.554 +(for the)4.054 F(May 4, 1998)280.585 768 Q(5)203.585 E EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 351.08(DbTxnMgr\(3\) DbTxnMgr\(3\))72 48 R +(follo)108 84 Q(wing conditions:)-.25 E([EINV)108 100.8 Q(AL])-1.35 E +(An in)133 112.8 Q -.25(va)-.4 G(lid \215ag v).25 E(alue or parameter w) +-.25 E(as speci\214ed.)-.1 E(The DB_THREAD \215ag w)133 136.8 Q(as speci\214ed and spinlocks are not implemented for this architecture.) +-.1 E(The)133 160.8 Q/F1 10/Times-Italic@0 SF(dben)2.5 E(v)-.4 E F0 +(parameter w)2.5 E(as NULL.)-.1 E([EA)108 177.6 Q(GAIN])-.4 E +(The shared memory re)133 189.6 Q(gion w)-.15 E(as lock)-.1 E +(ed and \(repeatedly\) una)-.1 E -.25(va)-.2 G(ilable.).25 E(The)108 +206.4 Q F1(DbTxnMgr::be)2.5 E(gin)-.4 E F0(method may f)2.5 E +(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0(\(3\)).24 E +(or return)108 230.4 Q F1(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5 +(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: DbLog::put\(3\),)-.25 E(fcntl\(2\), f) +108 242.4 Q(\215ush\(3\), lseek\(2\), malloc\(3\), memcp)-.25 E +(y\(3\), memset\(3\), mmap\(2\), munmap\(2\), strerror\(3\), and)-.1 E +(write\(2\).)108 254.4 Q .249(In addition, the)108 271.2 R F1 +(DbTxnMgr::be)2.749 E(gin)-.4 E F0 .249(method may f)2.749 F .249 +(ail and thro)-.1 F 2.749(wa)-.25 G F1(DbException)A F0 .249 +(\(3\) or return).24 F F1(errno)2.748 E F0 .248(for the fol-)2.748 F(lo) +108 283.2 Q(wing conditions:)-.25 E([ENOSPC])108 300 Q +(The maximum number of concurrent transactions has been reached.)133 312 +Q(The)108 328.8 Q F1(DbTxnMgr::c)2.5 E(hec)-.15 E(kpoint)-.2 E F0 +(method may f)2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0 +(\(3\)).24 E(or return)108 352.8 Q F1(errno)2.5 E F0(for an)2.5 E 2.5 +(yo)-.15 G 2.5(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: DbLog::com-)-.25 E +(pare\(3\), DbLog::put\(3\), DbMpool::sync\(3\), fcntl\(2\), f)108 364.8 +Q(\215ush\(3\), malloc\(3\), memcp)-.25 E(y\(3\), memset\(3\), str)-.1 E +(-)-.2 E(error\(3\), and time\(3\).)108 376.8 Q([EINV)108 393.6 Q(AL]) +-1.35 E(An in)133 405.6 Q -.25(va)-.4 G(lid \215ag v).25 E +(alue or parameter w)-.25 E(as speci\214ed.)-.1 E(The)108 422.4 Q F1 +(DbTxnMgr::close)2.5 E F0(method may f)2.5 E(ail and thro)-.1 E 2.5(wa) +-.25 G F1(DbException)A F0(\(3\)).24 E(or return)108 446.4 Q F1(errno) +2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: DbLog::\215ush\(3\),)-.25 E +(DbTxn::abort\(3\), close\(2\), fcntl\(2\), f)108 458.4 Q +(\215ush\(3\), munmap\(2\), and strerror\(3\).)-.25 E(The)108 475.2 Q F1 +(DbTxnMgr::unlink)2.5 E F0(method may f)2.5 E(ail and thro)-.1 E 2.5(wa) +-.25 G F1(DbException)A F0(\(3\)).24 E(or return)108 499.2 Q F1(errno) +2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: close\(2\), fcntl\(2\),)-.25 E -.25 +<668d>108 511.2 S(ush\(3\), malloc\(3\), memcp).25 E(y\(3\), memset\(3\), mmap\(2\), munmap\(2\), open\(2\), sig\214llset\(3\), sigprocmask\(2\),) +-.1 E(stat\(2\), strcp)108 523.2 Q +(y\(3\), strdup\(3\), strerror\(3\), strlen\(3\), and unlink\(2\).)-.1 E +.05(In addition, the)108 540 R F1(DbTxnMgr::unlink)2.55 E F0 .05 +(method may f)2.55 F .05(ail and thro)-.1 F 2.55(wa)-.25 G F1 +(DbException)A F0 .05(\(3\) or return).24 F F1(errno)2.55 E F0 .05 +(for the fol-)2.55 F(lo)108 552 Q(wing conditions:)-.25 E([EB)108 568.8 +Q(USY])-.1 E(The shared memory re)133 580.8 Q(gion w)-.15 E +(as in use and the force \215ag w)-.1 E(as not set.)-.1 E(The)108 597.6 +Q F1(DbTxnMgr::stat)2.5 E F0(method may f)2.5 E(ail and thro)-.1 E 2.5 +(wa)-.25 G F1(DbException)A F0(\(3\)).24 E(or return)108 621.6 Q F1 +(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: fcntl\(2\), and mal-)-.25 E(loc\(3\).) +108 633.6 Q/F2 9/Times-Bold@0 SF(SEE ALSO)72 650.4 Q F1 .904(LIBTP: P) +108 662.4 R(ortable)-.8 E 3.404(,M)-.1 G .904(odular T)-3.404 F -.15(ra) +-.55 G .904(nsactions for UNIX).15 F F0 3.404(,M).94 G(ar)-3.404 E .904 +(go Seltzer)-.18 F 3.403(,M)-.4 G .903 +(ichael Olson, USENIX proceedings,)-3.403 F -.4(Wi)108 674.4 S +(nter 1992.).4 E F2 -.09(BU)72 691.2 S(GS).09 E F0 +(Nested transactions are not yet implemented.)108 703.2 Q F1(db_ar)108 +727.2 Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E F1(db_c)2.5 E(hec)-.15 +E(kpoint)-.2 E F0(\(1\),).68 E F1(db_deadloc)2.5 E(k)-.2 E F0(\(1\),).67 +E F1(db_dump)2.5 E F0(\(1\),).19 E F1(db_load)2.5 E F0(\(1\),).77 E F1 +(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F1(db_stat)2.5 E F0 +(\(1\),).68 E(May 4, 1998)280.585 768 Q(6)203.585 E EP +%%Page: 7 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 351.08(DbTxnMgr\(3\) DbTxnMgr\(3\))72 48 R/F1 10 +/Times-Italic@0 SF(db_intr)108 84 Q(o)-.45 E F0(\(3\),).18 E F1 +(db_internal)2.5 E F0(\(3\),).51 E F1(db_thr)2.5 E(ead)-.37 E F0(\(3\),) +.77 E F1(Db)2.5 E F0(\(3\),).23 E F1(Dbc)2.5 E F0(\(3\),).31 E F1(DbEn) +2.5 E(v)-.4 E F0(\(3\),).32 E F1(DbException)2.5 E F0(\(3\),).24 E F1 +(DbInfo)2.5 E F0(\(3\),).18 E F1(DbLoc)108 96 Q(k)-.2 E F0(\(3\),).67 E +F1(DbLoc)2.5 E(kT)-.2 E(ab)-.92 E F0(\(3\),).23 E F1(DbLo)2.5 E(g)-.1 E +F0(\(3\),).22 E F1(DbLsn)2.5 E F0(\(3\),).24 E F1(DbMpool)2.5 E F0 +(\(3\),).51 E F1(DbMpoolF)2.5 E(ile)-.45 E F0(\(3\),).18 E F1(Dbt)2.5 E +F0(\(3\),).68 E F1(DbTxn)2.5 E F0(\(3\),).24 E F1(DbTxnMgr)108 108 Q F0 +(\(3\)).73 E(May 4, 1998)280.585 768 Q(7)203.585 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/mancxx.ps/Dbc.ps b/mozilla/db/man/mancxx.ps/Dbc.ps new file mode 100644 index 00000000000..eada3360f9f --- /dev/null +++ b/mozilla/db/man/mancxx.ps/Dbc.ps @@ -0,0 +1,644 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:37 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 6 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(Dbc \255 database sequential access functions)108 40.8 Q F0(SYNOPSIS)72 +57.6 Q/F2 10/Times-Bold@0 SF(#include )108 69.6 Q(int)108 93.6 +Q(Dbc::close\(v)108 105.6 Q(oid\);)-.1 E(int)108 129.6 Q +(Dbc::del\(u_int32_t \215ags\);)108 141.6 Q(int)108 165.6 Q +(Dbc::get\(Dbt *k)108 177.6 Q(ey)-.1 E 2.5(,D)-.55 G +(bt *data, u_int32_t \215ags\);)-2.5 E(int)108 201.6 Q(Dbc::put\(Dbt *k) +108 213.6 Q(ey)-.1 E 2.5(,D)-.55 G(bt *data, u_int32_t \215ags\);)-2.5 E +F0(DESCRIPTION)72 230.4 Q F1 1.02(The DB library is a f)108 242.4 R +1.019(amily of classes that pro)-.1 F 1.019 +(vides a modular programming interf)-.15 F 1.019 +(ace to transactions and)-.1 F 1.377(record-oriented \214le access.)108 +254.4 R 1.378(The library includes support for transactions, locking, logging and \214le page) +6.377 F .443(caching, as well as v)108 266.4 R .443(arious inde)-.25 F +-.15(xe)-.15 G 2.943(da).15 G .442(ccess methods.)-2.943 F(Man)5.442 E +2.942(yo)-.15 G 2.942(ft)-2.942 G .442 +(he classes \(e.g., the \214le page caching class\))-2.942 F .4(are useful independent of the other DB classes, although some classes are e) +108 278.4 R .4(xplicitly based on other classes)-.15 F +(\(e.g., transactions and logging\).)108 290.4 Q -.15(Fo)5 G 2.5(rag).15 +G(eneral description of the DB package, see)-2.5 E/F3 10/Times-Italic@0 +SF(db_intr)2.5 E(o)-.45 E F1(\(3\).).18 E(This manual page describes the speci\214c details of the cursor support for the access methods in) +108 307.2 Q F3(Db\(3\))2.5 E F1(.).06 E(The)108 324 Q F3(Dbc)2.882 E F1 +.382(functions are the library interf)2.882 F .381 +(ace supporting sequential access to the records stored by the access) +-.1 F 1.025(methods of the Db library)108 336 R 6.025(.C)-.65 G 1.025 +(ursors are created by calling)-6.025 F F3(Db::cur)3.525 E(sor)-.1 E F1 +1.026(method described in)3.526 F F3(Db)3.526 E F1 1.026(\(3\), which) +.23 F(returns a pointer to a Dbc object.)108 348 Q 1.026 +(Each cursor maintains positioning information within a set of k)108 +364.8 R -.15(ey)-.1 G 1.025(/data pairs.).15 F 1.025 +(In the presence of transac-)6.025 F .173(tions, cursors are only v)108 +376.8 R .173(alid within the conte)-.25 F .173 +(xt of a single transaction, the one speci\214ed during the)-.15 F F3 +(Db::cur)2.673 E(-)-.2 E(sor)108 388.8 Q F1 1.932(call described in) +4.432 F F3(Db)4.432 E F1 4.431(\(3\). All).23 F 1.931 +(cursor operations will be e)4.431 F -.15(xe)-.15 G 1.931 +(cuted in the conte).15 F 1.931(xt of that transaction.)-.15 F .284(Before aborting or committing a transaction, all cursors used within that transaction must be closed.) +108 400.8 R .285(In the)5.285 F .297 +(presence of transactions, the application must call)108 412.8 R F3 +(DbTxn::abort)2.797 E F1 .297(if an)2.797 F 2.797(yo)-.15 G 2.796(ft) +-2.797 G .296(he cursor operations returns that)-2.796 F 2.5(ad)108 +424.8 S(eadlock \(EA)-2.5 E(GAIN\) or system f)-.4 E(ailure occurred.) +-.1 E .512 +(When locking is enabled, page locks are retained between consecuti)108 +441.6 R .813 -.15(ve c)-.25 H .513(ursor calls.).15 F -.15(Fo)5.513 G +3.013(rt).15 G .513(his reason, in the)-3.013 F .92(presence of locking, applications should discard cursors as soon as the) +108 453.6 R 3.419(ya)-.15 G .919(re done with them.)-3.419 F .919 +(Calling the)5.919 F F3(Db::close)108 465.6 Q F1 .24(method \(see)2.74 F +F3(Db)2.74 E F1 .24(\(3\)\) discards an).23 F 2.74(yc)-.15 G .241 +(ursors opened in the conte)-2.74 F .241 +(xt of a particular Db object returned)-.15 F(by the)108 477.6 Q F3 +(Db::open)2.5 E F1(call.)2.5 E +(The methods of the Dbc are de\214ned as follo)108 494.4 Q(ws:)-.25 E +(int Dbc::close\(\);)108 511.2 Q 2.5(Am)133 523.2 S +(ethod that discards the cursor)-2.5 E 5(.N)-.55 G 2.5(of)-5 G +(urther references to the Dbc object should be made.)-2.5 E(The)133 540 +Q F3(Dbc::close)3.522 E F1 1.022(method thro)3.522 F 1.022(ws a)-.25 F +F3(DbException)3.521 E F1 1.021(\(3\) or returns the v).24 F 1.021 +(alue of)-.25 F F3(errno)3.521 E F1 1.021(on f)3.521 F 1.021 +(ailure and 0 on)-.1 F(success.)133 552 Q +(int Dbc::del\(u_int32_t \215ags\);)108 568.8 Q 2.5(Am)133 580.8 S +(ethod that deletes the k)-2.5 E -.15(ey)-.1 G +(/data pair currently referenced by the cursor).15 E(.)-.55 E(The)133 +597.6 Q F3<8d61>2.5 E(gs)-.1 E F1 +(parameter is currently unused, and must be set to 0.)2.5 E .13(The cursor position is unchanged after a delete and subsequent calls to cursor functions e) +133 614.4 R .13(xpecting the)-.15 F(cursor to reference an e)133 626.4 Q +(xisting k)-.15 E .3 -.15(ey w)-.1 H(ill f).15 E(ail.)-.1 E(The)133 +643.2 Q F3(Dbc::del)2.758 E F1 .258(method thro)2.758 F .258(ws a)-.25 F +F3(DbException)2.758 E F1 .258(\(3\) or returns the v).24 F .257 +(alue of)-.25 F F3(errno)2.757 E F1 .257(on f)2.757 F .257 +(ailure, 0 on success,)-.1 F +(and DB_KEYEMPTY if the element has already been deleted.)133 655.2 Q +(int Dbc::get\(Dbt *k)108 672 Q -.15(ey)-.1 G 2.5(,D)-.5 G +(bt *data, u_int32_t \215ags\);)-2.5 E 4.041(Am)133 684 S 1.541 +(ethod that retrie)-4.041 F -.15(ve)-.25 G 4.041(sk).15 G -.15(ey)-4.141 +G 1.541(/data pairs from the database.).15 F 1.541 +(The address and length of the k)6.541 F 1.842 -.15(ey a)-.1 H(re).15 E +.141(returned in the object referenced by)133 696 R F3 -.1(ke)2.641 G(y) +-.2 E F1(\(e)2.641 E .14 +(xcept for the case of the DB_SET \215ag where the)-.15 F F3 -.1(ke)2.64 +G(y)-.2 E F1(object)2.64 E(is unchanged\), and the address and length of the data are returned in the object referenced by) +133 708 Q F3(data)2.5 E F1(.).26 E(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 408.86(Dbc\(3\) Dbc\(3\))72 48 R 1.953(Modi\214cations to the database during a sequential scan will be re\215ected in the scan, i.e. records) +133 84 R 1.871(inserted behind a cursor will not be returned while records inserted in front of a cursor will be) +133 96 R(returned.)133 108 Q .085 +(In recno databases, missing entries \(i.e., entries that were ne)133 +132 R -.15(ve)-.25 G 2.585(re).15 G .086 +(xplicitly created or that were created)-2.735 F +(and then deleted\), will be skipped during a sequential scan.)133 144 Q +1.173(If multiple threads or processes insert items into the same database \214le without using locking, the) +133 168 R(results are unde\214ned.)133 180 Q -.15(Fo)5 G 2.5(rm).15 G +(ore detail, see the section belo)-2.5 E 2.5(wo)-.25 G 2.5(nc)-2.5 G +(ursor stability)-2.5 E(.)-.65 E(The parameter)133 196.8 Q/F1 10 +/Times-Italic@0 SF<8d61>2.5 E(gs)-.1 E F0(must be set to e)2.5 E +(xactly one of the follo)-.15 E(wing v)-.25 E(alues:)-.25 E(DB_FIRST)133 +225.6 Q .053(The cursor is set to reference the \214rst k)158 237.6 R +-.15(ey)-.1 G .054 +(/data pair of the database, and that pair is returned.).15 F(In)5.054 E +(the presence of duplicate k)158 249.6 Q .3 -.15(ey v)-.1 H +(alues, the \214rst data item in the set of duplicates is returned.)-.1 +E(If the database is empty)158 266.4 Q 2.5(,t)-.65 G(he)-2.5 E F1 +(Dbc::g)2.5 E(et)-.1 E F0(method will return DB_NO)2.5 E(TFOUND.)-.4 E +(DB_LAST)133 295.2 Q .146(The cursor is set to reference the last k)158 +307.2 R -.15(ey)-.1 G .146 +(/data pair of the database, and that pair is returned.).15 F(In)5.146 E +(the presence of duplicate k)158 319.2 Q .3 -.15(ey v)-.1 H +(alues, the last data item in the set of duplicates is returned.)-.1 E +(If the database is empty)158 336 Q 2.5(,t)-.65 G(he)-2.5 E F1(Dbc::g) +2.5 E(et)-.1 E F0(method will return DB_NO)2.5 E(TFOUND.)-.4 E(DB_NEXT) +133 364.8 Q +(If the cursor is not yet initialized, DB_NEXT is identical to DB_FIRST) +158 376.8 Q(.)-.74 E .503(Otherwise, mo)158 393.6 R .803 -.15(ve t)-.15 +H .503(he cursor to the ne).15 F .504(xt k)-.15 F -.15(ey)-.1 G .504 +(/data pair of the database, and that pair is returned.).15 F +(In the presence of duplicate k)158 405.6 Q .3 -.15(ey v)-.1 H +(alues, the v)-.1 E(alue of the k)-.25 E .3 -.15(ey m)-.1 H +(ay not change.).15 E 1.647 +(If the cursor is already on the last record in the database, the)158 +422.4 R F1(Dbc::g)4.147 E(et)-.1 E F0 1.646(method will return)4.147 F +(DB_NO)158 434.4 Q(TFOUND.)-.4 E(DB_PREV)133 463.2 Q +(If the cursor is not yet initialized, DB_PREV is identical to DB_LAST) +158 475.2 Q(.)-.74 E 1.95(Otherwise, mo)158 492 R 2.25 -.15(ve t)-.15 H +1.95(he cursor to the pre).15 F 1.951(vious k)-.25 F -.15(ey)-.1 G 1.951 +(/data pair of the database, and that pair is).15 F 2.5(returned. In)158 +504 R(the presence of duplicate k)2.5 E .3 -.15(ey v)-.1 H(alues, the v) +-.1 E(alue of the k)-.25 E .3 -.15(ey m)-.1 H(ay not change.).15 E 1.543 +(If the cursor is already on the \214rst record in the database, the)158 +520.8 R F1(Dbc::g)4.042 E(et)-.1 E F0 1.542(method will return)4.042 F +(DB_NO)158 532.8 Q(TFOUND.)-.4 E(DB_CURRENT)133 561.6 Q(Return the k)158 +573.6 Q -.15(ey)-.1 G(/data pair currently referenced by the cursor).15 +E(.)-.55 E .093(If the cursor k)158 590.4 R -.15(ey)-.1 G .094 +(/data pair has been deleted, the).15 F F1(Dbc::g)2.594 E(et)-.1 E F0 +.094(method will return DB_KEYEMPTY)2.594 F(.)-1.29 E +(If the cursor is not yet initialized, the)158 607.2 Q F1(Dbc::g)2.5 E +(et)-.1 E F0(method will return EINV)2.5 E(AL.)-1.35 E(DB_SET)133 636 Q +(Mo)158 648 Q .661 -.15(ve t)-.15 H .361(he cursor to the speci\214ed k) +.15 F -.15(ey)-.1 G .36 +(/data pair of the database, and return the datum associated).15 F +(with the gi)158 660 Q -.15(ve)-.25 G 2.5(nk).15 G -.15(ey)-2.6 G(.)-.5 +E 1.043(In the presence of duplicate k)158 676.8 R 1.343 -.15(ey v)-.1 H +(alues,)-.1 E F1(Dbc::g)3.543 E(et)-.1 E F0 1.043 +(will return the \214rst data item for the gi)3.543 F -.15(ve)-.25 G(n) +.15 E -.1(ke)158 688.8 S -.65(y.)-.05 G .019 +(If the database is a recno database and the requested k)158 705.6 R +.319 -.15(ey ex)-.1 H .019(ists, b).15 F .018(ut w)-.2 F .018(as ne)-.1 +F -.15(ve)-.25 G 2.518(re).15 G .018(xplicitly created)-2.668 F +(by the application or w)158 717.6 Q(as later deleted, the)-.1 E F1 +(Dbc::g)2.5 E(et)-.1 E F0(method returns DB_KEYEMPTY)2.5 E(.)-1.29 E +(April 10, 1998)276.695 768 Q(2)199.695 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 408.86(Dbc\(3\) Dbc\(3\))72 48 R +(If no matching k)158 84 Q -.15(ey)-.1 G 2.5(sa).15 G(re found, the)-2.5 +E/F1 10/Times-Italic@0 SF(Dbc::g)2.5 E(et)-.1 E F0 +(method will return DB_NO)2.5 E(TFOUND.)-.4 E(DB_SET_RANGE)133 112.8 Q +.458(The DB_SET_RANGE \215ag is identical to the DB_SET \215ag, e)158 +124.8 R .459(xcept that the k)-.15 F .759 -.15(ey i)-.1 H 2.959(sr).15 G +.459(eturned as)-2.959 F .454(well as the data item, and, in the case of the btree access method, the returned k) +158 136.8 R -.15(ey)-.1 G .453(/data pair is).15 F 1.004(the smallest k) +158 148.8 R 1.304 -.15(ey g)-.1 H 1.005 +(reater than or equal to the speci\214ed k).15 F 1.305 -.15(ey \()-.1 H +1.005(as determined by the comparison).15 F +(function\), permitting partial k)158 160.8 Q .3 -.15(ey m)-.1 H +(atches and range searches.).15 E(DB_SET_RECNO)133 189.6 Q(Mo)158 201.6 +Q 1.84 -.15(ve t)-.15 H 1.54(he cursor to the speci\214c numbered record of the database, and return the associated) +.15 F -.1(ke)158 213.6 S .404(y/data pair)-.05 F 5.404(.T)-.55 G(he) +-5.404 E F1(data)2.904 E F0 .404(\214eld of the speci\214ed)2.904 F F1 +-.1(ke)2.904 G(y)-.2 E F0 .404 +(must be a pointer to a memory location from)2.904 F .093(which a)158 +225.6 R F1(db_r)2.593 E(ecno_t)-.37 E F0 .093 +(may be read, as described in)2.593 F F1(Dbt)2.592 E F0 2.592 +(\(3\). This).68 F .092(memory location will be read to)2.592 F +(determine the record to be retrie)158 237.6 Q -.15(ve)-.25 G(d.).15 E +-.15(Fo)158 261.6 S 3.787(rD).15 G 1.287(B_SET_RECNO to be speci\214ed, the underlying database must be of type btree and it) +-3.787 F(must ha)158 273.6 Q .3 -.15(ve b)-.2 H +(een created with the DB_RECNUM \215ag \(see).15 E F1(Db::open)2.5 E F0 +(in)2.5 E F1(Db)2.5 E F0(\(3\)\).).23 E(DB_GET_RECNO)133 302.4 Q .942 +(Return the record number associated with the cursor)158 314.4 R 5.942 +(.T)-.55 G .942(he record number will be returned in)-5.942 F +(the data Dbt as described in)158 326.4 Q F1(Dbt)2.5 E F0 2.5 +(\(3\). The).68 F F1 -.1(ke)2.5 G(y)-.2 E F0(parameter is ignored.)2.5 E +-.15(Fo)158 350.4 S 3.668(rD).15 G 1.169(B_GET_RECNO to be speci\214ed, the underlying database must be of type btree and it) +-3.668 F(must ha)158 362.4 Q .3 -.15(ve b)-.2 H +(een created with the DB_RECNUM \215ag \(see).15 E F1(Db::open)2.5 E F0 +(in)2.5 E F1(Db)2.5 E F0(\(3\)\).).23 E .134(Otherwise, the)133 379.2 R +F1(Dbc::g)2.634 E(et)-.1 E F0 .134(method thro)2.634 F .134(ws a)-.25 F +F1(DbException)2.633 E F0 .133(\(3\) or returns the v).24 F .133 +(alue of)-.25 F F1(errno)2.633 E F0 .133(on f)2.633 F .133(ailure and) +-.1 F 2.5(0o)133 391.2 S 2.5(ns)-2.5 G(uccess.)-2.5 E(If)133 408 Q F1 +(Dbc::g)2.5 E(et)-.1 E F0 -.1(fa)2.5 G(ils for an).1 E 2.5(yr)-.15 G +(eason, the state of the cursor will be unchanged.)-2.5 E +(int Dbc::put\(Dbt *k)108 424.8 Q -.15(ey)-.1 G 2.5(,D)-.5 G +(bt *data, u_int32_t \215ags\);)-2.5 E 2.5(Am)135.5 436.8 S +(ethod that stores k)-2.5 E -.15(ey)-.1 G +(/data pairs into the database.).15 E(The)133 453.6 Q F1<8d61>2.5 E(gs) +-.1 E F0(parameter must be set to e)2.5 E(xactly one of the follo)-.15 E +(wing v)-.25 E(alues:)-.25 E(DB_AFTER)133 482.4 Q .156(In the case of the btree and hash access methods, insert the data element as a duplicate element) +158 494.4 R 1.1(of the k)158 506.4 R 1.4 -.15(ey r)-.1 H 1.099 +(eferenced by the cursor).15 F 6.099(.T)-.55 G 1.099(he ne)-6.099 F +3.599(we)-.25 G 1.099(lement appears immediately after the current) +-3.599 F .711(cursor position.)158 518.4 R .711(It is an error to specify DB_AFTER if the underlying btree or hash database) +5.711 F -.1(wa)158 530.4 S 2.5(sn).1 G +(ot created with the DB_DUP \215ag.)-2.5 E(The)5 E F1 -.1(ke)2.5 G(y)-.2 +E F0(parameter is ignored.)2.5 E .645(In the case of the recno access method, it is an error to specify DB_AFTER if the underlying) +158 547.2 R .456(recno database w)158 559.2 R .457 +(as not created with the DB_RENUMBER \215ag.)-.1 F .457 +(If the DB_RENUMBER \215ag)5.457 F -.1(wa)158 571.2 S 2.699(ss).1 G .199 +(peci\214ed, a ne)-2.699 F 2.699(wk)-.25 G .499 -.15(ey i)-2.799 H 2.699 +(sc).15 G .198 +(reated, all records after the inserted item are automatically renum-) +-2.699 F .404(bered, and the k)158 583.2 R .704 -.15(ey o)-.1 H 2.904 +(ft).15 G .405(he ne)-2.904 F 2.905(wr)-.25 G .405 +(ecord is returned in the object referenced by the parameter)-2.905 F F1 +-.1(ke)2.905 G(y)-.2 E F0(.).32 E .13(The initial v)158 595.2 R .13 +(alue of the)-.25 F F1 -.1(ke)2.63 G(y)-.2 E F0 .13 +(parameter is ignored.)2.63 F(See)5.13 E F1(Db::open)2.63 E F0(in)2.63 E +F1(Db)2.63 E F0 .13(\(3\) for more information.).23 F +(If the cursor is not yet initialized, the)158 612 Q F1(Dbc::put)2.5 E +F0(method will return EINV)2.5 E(AL.)-1.35 E(DB_BEFORE)133 640.8 Q .156 +(In the case of the btree and hash access methods, insert the data element as a duplicate element) +158 652.8 R .584(of the k)158 664.8 R .884 -.15(ey r)-.1 H .584 +(eferenced by the cursor).15 F 5.584(.T)-.55 G .584(he ne)-5.584 F 3.083 +(we)-.25 G .583(lement appears immediately before the current)-3.083 F +.266(cursor position.)158 676.8 R .267(It is an error to specify DB_BEFORE if the underlying btree or hash database) +5.266 F -.1(wa)158 688.8 S 2.5(sn).1 G +(ot created with the DB_DUP \215ag.)-2.5 E(The)5 E F1 -.1(ke)2.5 G(y)-.2 +E F0(parameter is ignored.)2.5 E .252(In the case of the recno access method, it is an error to specify DB_BEFORE if the underlying) +158 705.6 R .456(recno database w)158 717.6 R .457 +(as not created with the DB_RENUMBER \215ag.)-.1 F .457 +(If the DB_RENUMBER \215ag)5.457 F -.1(wa)158 729.6 S 2.809(ss).1 G .309 +(peci\214ed, a ne)-2.809 F 2.809(wk)-.25 G .609 -.15(ey i)-2.909 H 2.809 +(sc).15 G .309 +(reated, the current record and all records after it are automatically) +-2.809 F(April 10, 1998)276.695 768 Q(3)199.695 E EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 408.86(Dbc\(3\) Dbc\(3\))72 48 R .424 +(renumbered, and the k)158 84 R .724 -.15(ey o)-.1 H 2.924(ft).15 G .424 +(he ne)-2.924 F 2.924(wr)-.25 G .425 +(ecord is returned in the object referenced by the parame-)-2.924 F(ter) +158 96 Q/F1 10/Times-Italic@0 SF -.1(ke)3.774 G(y)-.2 E F0 6.274(.T).32 +G 1.274(he initial v)-6.274 F 1.274(alue of the)-.25 F F1 -.1(ke)3.774 G +(y)-.2 E F0 1.274(parameter is ignored.)3.774 F(See)6.274 E F1(Db::open) +3.774 E F0(in)3.773 E F1(Db)3.773 E F0 1.273(\(3\) for more).23 F +(information.)158 108 Q(If the cursor is not yet initialized, the)158 +124.8 Q F1(Dbc::put)2.5 E F0(method will return EINV)2.5 E(AL.)-1.35 E +(DB_CURRENT)133 153.6 Q(Ov)158 165.6 Q(erwrite the data of the k)-.15 E +-.15(ey)-.1 G +(/data pair referenced by the cursor with the speci\214ed data item.).15 +E(The)158 182.4 Q F1 -.1(ke)2.5 G(y)-.2 E F0(parameter is ignored.)2.5 E +(If the cursor is not yet initialized, the)158 199.2 Q F1(Dbc::put)2.5 E +F0(method will return EINV)2.5 E(AL.)-1.35 E(DB_KEYFIRST)133 228 Q 1.378 +(In the case of the btree and hash access methods, insert the speci\214ed k) +158 240 R -.15(ey)-.1 G 1.379(/data pair into the).15 F 2.623 +(database. If)158 252 R .123(the k)2.623 F .423 -.15(ey a)-.1 H .122 +(lready e).15 F .122(xists in the database, the inserted data item is added as the \214rst of) +-.15 F(the data items for that k)158 264 Q -.15(ey)-.1 G(.)-.5 E(The DB_KEYFIRST \215ag may not be speci\214ed to the recno access method.) +158 280.8 Q(DB_KEYLAST)133 309.6 Q .049(Insert the speci\214ed k)158 +321.6 R -.15(ey)-.1 G .049(/data pair into the database.).15 F .049 +(If the k)5.049 F .35 -.15(ey a)-.1 H .05(lready e).15 F .05 +(xists in the database, the)-.15 F +(inserted data item is added as the last of the data items for that k) +158 333.6 Q -.15(ey)-.1 G(.)-.5 E(The DB_KEYLAST \215ag may not be speci\214ed to the recno access method.) +158 350.4 Q(If the cursor record has been deleted, the)133 367.2 Q F1 +(Dbc::put)2.5 E F0(method will return DB_KEYEMPTY)2.5 E(.)-1.29 E .09 +(Otherwise, the)133 384 R F1(Dbc::put)2.59 E F0 .09(method thro)2.59 F +.09(ws a)-.25 F F1(DbException)2.589 E F0 .089(\(3\) or returns the v) +.24 F .089(alue of)-.25 F F1(errno)2.589 E F0 .089(on f)2.589 F .089 +(ailure and)-.1 F 2.5(0o)133 396 S 2.5(ns)-2.5 G(uccess.)-2.5 E(If)133 +412.8 Q F1(Dbc::put)2.965 E F0 -.1(fa)2.965 G .466(ils for an).1 F 2.966 +(yr)-.15 G .466(eason, the state of the cursor will be unchanged.)-2.966 +F(If)5.466 E F1(Dbc::put)2.966 E F0 .466(succeeds and)2.966 F .661 +(an item is inserted into the database, the cursor is al)133 424.8 R -.1 +(wa)-.1 G .661(ys positioned to reference the ne).1 F .661(wly inserted) +-.25 F(item.)133 436.8 Q/F2 9/Times-Bold@0 SF(CURSOR ST)72 453.6 Q +(ABILITY)-.81 E F0 1.021(In the absence of locking, no guarantees are made about the stability of cursors in dif) +108 465.6 R 1.021(ferent processes or)-.25 F 3.278(threads. Ho)108 477.6 +R(we)-.25 E -.15(ve)-.25 G 1.578 -.4(r, t).15 H .778(he btree and recno access methods guarantee that cursor operations, interspersed with) +.4 F .307(other cursor or non-cursor operations in the same thread of control \(i.e., thread or single-threaded process\),) +108 489.6 R .706(will al)108 501.6 R -.1(wa)-.1 G .706(ys return k).1 F +-.15(ey)-.1 G 3.206(si).15 G 3.206(no)-3.206 G .706 +(rder and will return each non-deleted k)-3.206 F -.15(ey)-.1 G .705 +(/data pair e).15 F .705(xactly once.)-.15 F .705(Because the)5.705 F +.097(hash access method uses a dynamic hashing algorithm, it cannot guarantee an) +108 513.6 R 2.598(yf)-.15 G .098(orm of stability in the pres-)-2.598 F +(ence of inserts and deletes unless locking is performed.)108 525.6 Q +.214(If locking w)108 542.4 R .214(as speci\214ed when the Db \214le w) +-.1 F .214(as opened, b)-.1 F .214(ut transactions are not in ef)-.2 F +.213(fect, the access methods)-.25 F(pro)108 554.4 Q .294 +(vide repeatable reads with respect to the cursor)-.15 F 5.295(.T)-.55 G +.295(hat is, a DB_CURRENT call on the cursor is guaran-)-5.295 F +(teed to return the same record as w)108 566.4 Q +(as returned on the last call to the cursor)-.1 E(.)-.55 E 1.132 +(In the presence of transactions, the access method calls between)108 +583.2 R F1(DbTxnMgr::be)3.632 E(gin)-.4 E F0(and)3.632 E F1 +(DbTxn::abort)3.632 E F0(or)3.632 E F1(DbTxn::commit)108 595.2 Q F0(pro) +3.478 E .978(vide de)-.15 F .978(gree 3 consistenc)-.15 F 4.778 -.65 +(y. F)-.15 H .978 +(or all access methods, a cursor scan of the database per).5 F(-)-.2 E +.866(formed within the conte)108 607.2 R .866 +(xt of a transaction is guaranteed to return each k)-.15 F -.15(ey)-.1 G +.866(/data pair once and only once,).15 F -.15(ex)108 619.2 S .294 +(cept in the follo).15 F .294(wing case.)-.25 F .294(If, while performing a cursor scan using the hash access method, the transac-) +5.294 F .219(tion performing the scan inserts a ne)108 631.2 R 2.719(wp) +-.25 G .219(air into the database, it is possible that duplicate k) +-2.719 F -.15(ey)-.1 G .218(/data pairs will).15 F(be returned.)108 +643.2 Q F2(ERR)72 660 Q(ORS)-.27 E F0 .049(Methods mark)108 672 R .049 +(ed as returning)-.1 F F1(errno)2.549 E F0 .049(will, by def)2.549 F +.049(ault, thro)-.1 F 2.549(wa)-.25 G 2.549(ne)-2.549 G .05 +(xception that encapsulates the error informa-)-2.699 F 2.5(tion. The) +108 684 R(def)2.5 E(ault error beha)-.1 E(vior can be changed, see)-.2 E +F1(DbException)2.5 E F0(\(3\).).24 E(The)108 700.8 Q F1(Dbc::close)2.5 E +F0(method may f)2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A +F0(\(3\)).24 E(or return)108 724.8 Q F1(errno)2.5 E F0(for an)2.5 E 2.5 +(yo)-.15 G 2.5(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: DbLock::get\(3\),)-.25 E(April 10, 1998) +276.695 768 Q(4)199.695 E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 408.86(Dbc\(3\) Dbc\(3\))72 48 R +(DbLock::put\(3\), DbLockT)108 84 Q(ab::id\(3\), DbLockT)-.8 E(ab::v)-.8 +E(ec\(3\), DbLog::put\(3\), DbMpoolFile::get\(3\), DbM-)-.15 E +(poolFile::put\(3\), DbMpoolFile::set\(3\), calloc\(3\), fcntl\(2\), f) +108 96 Q(\215ush\(3\), malloc\(3\), memcp)-.25 E(y\(3\), memmo)-.1 E +-.15(ve)-.15 G(\(3\),).15 E +(memset\(3\), realloc\(3\), and strerror\(3\).)108 108 Q .551 +(In addition, the)108 124.8 R/F1 10/Times-Italic@0 SF(Dbc::close)3.052 E +F0 .552(method may f)3.052 F .552(ail and thro)-.1 F 3.052(wa)-.25 G F1 +(DbException)A F0 .552(\(3\) or return).24 F F1(errno)3.052 E F0 .552 +(for the follo)3.052 F(wing)-.25 E(conditions:)108 136.8 Q([EA)108 153.6 +Q(GAIN])-.4 E 2.5(Al)133 165.6 S(ock w)-2.5 E(as una)-.1 E -.25(va)-.2 G +(ilable.).25 E([EPERM])108 182.4 Q .955(Database corruption w)133 194.4 +R .955(as detected.)-.1 F .955 +(All subsequent database calls \(other than)5.955 F F1(Db::close)3.455 E +F0 3.455(\)w).18 G .955(ill return)-3.455 F(EPERM.)133 206.4 Q(The)108 +223.2 Q F1(Dbc::del)2.5 E F0(method may f)2.5 E(ail and thro)-.1 E 2.5 +(wa)-.25 G F1(DbException)A F0(\(3\)).24 E(or return)108 247.2 Q F1 +(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)-2.5 G +(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: Db::del\(3\),)-.25 E +(DbLock::get\(3\), DbLock::put\(3\), DbLockT)108 259.2 Q +(ab::id\(3\), DbLockT)-.8 E(ab::v)-.8 E(ec\(3\), DbLog::put\(3\), DbM-) +-.15 E(poolFile::get\(3\), DbMpoolFile::put\(3\), DbMpoolFile::set\(3\), calloc\(3\), fcntl\(2\), f) +108 271.2 Q(\215ush\(3\), malloc\(3\), mem-)-.25 E(cp)108 283.2 Q +(y\(3\), memmo)-.1 E -.15(ve)-.15 G +(\(3\), memset\(3\), realloc\(3\), and strerror\(3\).).15 E 1.073 +(In addition, the)108 300 R F1(Dbc::del)3.573 E F0 1.073(method may f) +3.573 F 1.073(ail and thro)-.1 F 3.572(wa)-.25 G F1(DbException)A F0 +1.072(\(3\) or return).24 F F1(errno)3.572 E F0 1.072(for the follo) +3.572 F(wing)-.25 E(conditions:)108 312 Q([EA)108 328.8 Q(GAIN])-.4 E +2.5(Al)133 340.8 S(ock w)-2.5 E(as una)-.1 E -.25(va)-.2 G(ilable.).25 E +([EINV)108 357.6 Q(AL])-1.35 E(An in)133 369.6 Q -.25(va)-.4 G +(lid \215ag v).25 E(alue or parameter w)-.25 E(as speci\214ed.)-.1 E +([EPERM])108 386.4 Q .955(Database corruption w)133 398.4 R .955 +(as detected.)-.1 F .955(All subsequent database calls \(other than) +5.955 F F1(Db::close)3.455 E F0 3.455(\)w).18 G .955(ill return)-3.455 F +(EPERM.)133 410.4 Q(The)108 427.2 Q F1(Dbc::g)2.5 E(et)-.1 E F0 +(method may f)2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0 +(\(3\)).24 E(or return)108 451.2 Q F1(errno)2.5 E F0(for an)2.5 E 2.5 +(yo)-.15 G 2.5(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: Db::get\(3\),)-.25 E +(DbLock::get\(3\), DbLock::put\(3\), DbLockT)108 463.2 Q +(ab::id\(3\), DbLockT)-.8 E(ab::v)-.8 E(ec\(3\), DbLog::put\(3\), DbM-) +-.15 E(poolFile::get\(3\), DbMpoolFile::put\(3\), DbMpoolFile::set\(3\), calloc\(3\), fcntl\(2\), f) +108 475.2 Q(\215ush\(3\), malloc\(3\), mem-)-.25 E(cmp\(3\), memcp)108 +487.2 Q(y\(3\), memmo)-.1 E -.15(ve)-.15 G +(\(3\), memset\(3\), realloc\(3\), and strerror\(3\).).15 E 1.078 +(In addition, the)108 504 R F1(Dbc::g)3.578 E(et)-.1 E F0 1.079 +(method may f)3.578 F 1.079(ail and thro)-.1 F 3.579(wa)-.25 G F1 +(DbException)A F0 1.079(\(3\) or return).24 F F1(errno)3.579 E F0 1.079 +(for the follo)3.579 F(wing)-.25 E(conditions:)108 516 Q([EA)108 532.8 Q +(GAIN])-.4 E 2.5(Al)133 544.8 S(ock w)-2.5 E(as una)-.1 E -.25(va)-.2 G +(ilable.).25 E([EINV)108 561.6 Q(AL])-1.35 E(An in)133 573.6 Q -.25(va) +-.4 G(lid \215ag v).25 E(alue or parameter w)-.25 E(as speci\214ed.)-.1 +E 1.29(The DB_THREAD \215ag w)133 597.6 R 1.289(as speci\214ed to the) +-.1 F F1(Db::open)3.789 E F0 1.289(method described in)3.789 F F1(Db) +3.789 E F0 1.289(\(3\) and neither the).23 F +(DB_DBT_MALLOC or DB_DBT_USERMEM \215ags were set in the Dbt.)133 609.6 +Q([EPERM])108 626.4 Q .955(Database corruption w)133 638.4 R .955 +(as detected.)-.1 F .955(All subsequent database calls \(other than) +5.955 F F1(Db::close)3.455 E F0 3.455(\)w).18 G .955(ill return)-3.455 F +(EPERM.)133 650.4 Q(The)108 667.2 Q F1(Dbc::put)2.5 E F0(method may f) +2.5 E(ail and thro)-.1 E 2.5(wa)-.25 G F1(DbException)A F0(\(3\)).24 E +(or return)108 691.2 Q F1(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5 +(ft)-2.5 G(he errors speci\214ed for the follo)-2.5 E +(wing DB and library functions: DbLock::get\(3\),)-.25 E +(DbLock::put\(3\), DbLockT)108 703.2 Q(ab::id\(3\), DbLockT)-.8 E(ab::v) +-.8 E(ec\(3\), DbLog::put\(3\), DbMpoolFile::get\(3\), DbM-)-.15 E +(poolFile::put\(3\), DbMpoolFile::set\(3\), calloc\(3\), fcntl\(2\), f) +108 715.2 Q(\215ush\(3\), malloc\(3\), memcmp\(3\), memcp)-.25 E +(y\(3\),)-.1 E(memmo)108 727.2 Q -.15(ve)-.15 G +(\(3\), memset\(3\), realloc\(3\), and strerror\(3\).).15 E +(April 10, 1998)276.695 768 Q(5)199.695 E EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 408.86(Dbc\(3\) Dbc\(3\))72 48 R 1.037 +(In addition, the)108 84 R/F1 10/Times-Italic@0 SF(Dbc::put)3.537 E F0 +1.037(method may f)3.537 F 1.037(ail and thro)-.1 F 3.538(wa)-.25 G F1 +(DbException)A F0 1.038(\(3\) or return).24 F F1(errno)3.538 E F0 1.038 +(for the follo)3.538 F(wing)-.25 E(conditions:)108 96 Q([EA)108 112.8 Q +(CCES])-.4 E(An attempt w)133 124.8 Q +(as made to modify a read-only database.)-.1 E([EA)108 141.6 Q(GAIN])-.4 +E 2.5(Al)133 153.6 S(ock w)-2.5 E(as una)-.1 E -.25(va)-.2 G(ilable.).25 +E([EINV)108 170.4 Q(AL])-1.35 E(An in)133 182.4 Q -.25(va)-.4 G +(lid \215ag v).25 E(alue or parameter w)-.25 E(as speci\214ed.)-.1 E +([EPERM])108 199.2 Q .955(Database corruption w)133 211.2 R .955 +(as detected.)-.1 F .955(All subsequent database calls \(other than) +5.955 F F1(Db::close)3.455 E F0 3.455(\)w).18 G .955(ill return)-3.455 F +(EPERM.)133 223.2 Q/F2 9/Times-Bold@0 SF(SEE ALSO)72 240 Q F1(db_ar)108 +252 Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E F1(db_c)2.5 E(hec)-.15 E +(kpoint)-.2 E F0(\(1\),).68 E F1(db_deadloc)2.5 E(k)-.2 E F0(\(1\),).67 +E F1(db_dump)2.5 E F0(\(1\),).19 E F1(db_load)2.5 E F0(\(1\),).77 E F1 +(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F1(db_stat)2.5 E F0 +(\(1\),).68 E F1(db_intr)108 264 Q(o)-.45 E F0(\(3\),).18 E F1 +(db_internal)2.5 E F0(\(3\),).51 E F1(db_thr)2.5 E(ead)-.37 E F0(\(3\),) +.77 E F1(Db)2.5 E F0(\(3\),).23 E F1(Dbc)2.5 E F0(\(3\),).31 E F1(DbEn) +2.5 E(v)-.4 E F0(\(3\),).32 E F1(DbException)2.5 E F0(\(3\),).24 E F1 +(DbInfo)2.5 E F0(\(3\),).18 E F1(DbLoc)108 276 Q(k)-.2 E F0(\(3\),).67 E +F1(DbLoc)2.5 E(kT)-.2 E(ab)-.92 E F0(\(3\),).23 E F1(DbLo)2.5 E(g)-.1 E +F0(\(3\),).22 E F1(DbLsn)2.5 E F0(\(3\),).24 E F1(DbMpool)2.5 E F0 +(\(3\),).51 E F1(DbMpoolF)2.5 E(ile)-.45 E F0(\(3\),).18 E F1(Dbt)2.5 E +F0(\(3\),).68 E F1(DbTxn)2.5 E F0(\(3\),).24 E F1(DbTxnMgr)108 288 Q F0 +(\(3\)).73 E(April 10, 1998)276.695 768 Q(6)199.695 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/mancxx.ps/Dbt.ps b/mozilla/db/man/mancxx.ps/Dbt.ps new file mode 100644 index 00000000000..9b4e7fc755e --- /dev/null +++ b/mozilla/db/man/mancxx.ps/Dbt.ps @@ -0,0 +1,476 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:38 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 3 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(Dbt \255 Db k)108 40.8 Q -.15(ey)-.1 G(/data class).15 E F0(SYNOPSIS)72 +57.6 Q/F2 10/Times-Bold@0 SF -.1(vo)108 69.6 S +(id *Dbt::get_data\(\) const;).1 E -.1(vo)108 81.6 S +(id Dbt::set_data\(v).1 E(oid *\);)-.1 E +(u_int32_t Dbt::get_size\(\) const;)108 105.6 Q -.1(vo)108 117.6 S +(id Dbt::set_size\(u_int32_t\);).1 E(u_int32_t Dbt::get_ulen\(\) const;) +108 141.6 Q -.1(vo)108 153.6 S(id Dbt::set_ulen\(u_int32_t\);).1 E +(u_int32_t Dbt::get_dlen\(\) const;)108 177.6 Q -.1(vo)108 189.6 S +(id Dbt::set_dlen\(u_int32_t\);).1 E(u_int32_t Dbt::get_doff\(\) const;) +108 213.6 Q -.1(vo)108 225.6 S(id Dbt::set_doff\(u_int32_t\);).1 E +(u_int32_t Dbt::get_\215ags\(\) const;)108 249.6 Q -.1(vo)108 261.6 S +(id Dbt::set_\215ags\(u_int32_t\);).1 E(Dbt::Dbt\(v)108 285.6 Q +(oid *data, size_t size\);)-.1 E(Dbt::Dbt\(\);)108 297.6 Q +(Dbt::~Dbt\(\);)108 309.6 Q(Dbt::Dbt\(const Dbt &\);)108 321.6 Q +(Dbt::Dbt &operator = \(const Dbt &\);)108 333.6 Q F0(DESCRIPTION)72 +350.4 Q F1 1.02(The DB library is a f)108 362.4 R 1.019 +(amily of classes that pro)-.1 F 1.019 +(vides a modular programming interf)-.15 F 1.019 +(ace to transactions and)-.1 F 1.377(record-oriented \214le access.)108 +374.4 R 1.378(The library includes support for transactions, locking, logging and \214le page) +6.377 F .443(caching, as well as v)108 386.4 R .443(arious inde)-.25 F +-.15(xe)-.15 G 2.943(da).15 G .442(ccess methods.)-2.943 F(Man)5.442 E +2.942(yo)-.15 G 2.942(ft)-2.942 G .442 +(he classes \(e.g., the \214le page caching class\))-2.942 F .4(are useful independent of the other DB classes, although some classes are e) +108 398.4 R .4(xplicitly based on other classes)-.15 F .037 +(\(e.g., transactions and logging\).)108 410.4 R -.15(Fo)5.037 G 2.537 +(rag).15 G .037(eneral description of the DB package, see)-2.537 F/F3 10 +/Times-Italic@0 SF(db_intr)2.536 E(o)-.45 E F1 2.536(\(3\). This).18 F +(manual)2.536 E(page describes the speci\214c details of the)108 422.4 Q +F3(Dbt)2.5 E F1(class, used to encode k)2.5 E -.15(ey)-.1 G 2.5(sa).15 G +(nd data items in a database.)-2.5 E F0(KEY/D)72 444 Q -1.35 -.855(AT A) +-.315 H -.666(PA)3.105 G(IRS).666 E F1 .666(Storage and retrie)108 456 R +-.25(va)-.25 G 3.166(lf).25 G .666 +(or the Db access methods are based on k)-3.166 F -.15(ey)-.1 G .666 +(/data pairs.).15 F .666(Both k)5.666 F .966 -.15(ey a)-.1 H .667 +(nd data items are).15 F(represented by Dbt objects.)108 468 Q -2.15 +-.25(Ke y)108 484.8 T .098(and data byte strings may reference strings of essentially unlimited length, although an) +2.848 F 2.597(yt)-.15 G .297 -.1(wo ke)-2.597 H .097(ys must)-.05 F .82 +(\214t into a)108 496.8 R -.25(va)-.2 G .82 +(ilable memory at the same time so that the).25 F 3.32(ym)-.15 G .82 +(ay be compared, and an)-3.32 F 3.32(yo)-.15 G .82 +(ne data item must \214t)-3.32 F(into a)108 508.8 Q -.25(va)-.2 G +(ilable memory so that it may be returned.).25 E .584(The Dbt class pro) +108 525.6 R .583(vides simple access to an underlying data structure, whose elements can be e) +-.15 F .583(xamined or)-.15 F 1.594(changed using the)108 537.6 R F3 +(set_)4.094 E F1(or)4.094 E F3 -.1(ge)4.094 G(t_).1 E F1 4.094 +(methods. The)4.094 F 1.595 +(remainder of the manual page sometimes refers to these)4.094 F .852 +(accesses using the underlying name, e.g., simply)108 549.6 R F3(ulen) +3.351 E F1 .851(instead of)3.351 F F3 -.1(ge)3.351 G(t_ulen).1 E F1(and) +3.351 E F3(set_ulen)3.351 E F1 5.851(.T).24 G .851(he constructors) +-5.851 F .758(set all elements of the underlying structure to zero.)108 +561.6 R .758(The constructor with tw)5.758 F 3.258(oa)-.1 G -.18(rg) +-3.258 G .759(uments has the ef).18 F .759(fect of)-.25 F 1.303 +(setting all elements to zero e)108 573.6 R 1.302 +(xcept for the speci\214ed)-.15 F F3(data)3.802 E F1(and)3.802 E F3 +(size)3.802 E F1 3.802(elements. In)3.802 F 1.302(the case where the) +3.802 F F3<8d61>3.802 E(gs)-.1 E F1 .424 +(structure element is 0, when being pro)108 585.6 R .424(vided a k)-.15 +F .724 -.15(ey o)-.1 H 2.924(rd).15 G .424 +(ata item by the application, the DB package e)-2.924 F(xpects)-.15 E +(the)108 597.6 Q F3(data)2.601 E F1 .101 +(object to point to a byte string of)2.601 F F3(size)2.601 E F1 2.6 +(bytes. When)2.6 F .1(returning a k)2.6 F -.15(ey)-.1 G .1 +(/data item to the application, the).15 F .144 +(DB package will store into the)108 609.6 R F3(data)2.644 E F1 .144 +(object a pointer to a byte string of)2.644 F F3(size)2.644 E F1(bytes.) +2.644 E F2 .144(By default, the memory)5.144 F -.18(re)108 621.6 S(fer) +.18 E .212(enced by this stor)-.18 F .212(ed pointer is only v)-.18 F +.211(alid until the next call to the DB package using the Db han-)-.1 F +(dle r)108 633.6 Q(etur)-.18 E(ned by)-.15 E F3(Db::open)2.5 E F1(.).24 +E F2 .33(The access methods pr)108 650.4 R -.1(ov)-.18 G .331 +(ide no guarantees about byte string alignment, and applications ar).1 F +2.831(er)-.18 G(espon-)-3.011 E 1.208(sible f)108 662.4 R 1.208 +(or maintaining any necessary alignment.)-.25 F F1 1.207 +(Use the DB_DBT_USERMEM \215ag to cause returned)6.208 F .495 +(items to be placed in memory of arbitrary alignment.)108 674.4 R .496 +(Although Ja)5.496 F .996 -.25(va n)-.2 H .496 +(ormally maintains proper alignment).25 F 2.211 +(of byte arrays, the set_of)108 686.4 R 2.211 +(fset method can be used to specify unaligned addresses.)-.25 F 2.21 +(Unaligned address)7.21 F .726 +(accesses that are not supported by the underlying hardw)108 698.4 R +.727(are may be reported as an e)-.1 F .727(xception, or may stop)-.15 F +(the running Ja)108 710.4 Q .5 -.25(va p)-.2 H(rogram.).25 E(The elements of the structure underlying the Dbt class are de\214ned as follo) +108 727.2 Q(ws:)-.25 E(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 412.18(Dbt\(3\) Dbt\(3\))72 48 R -.2(vo)108 84 S +(id *data;).2 E 2.807(Ap)133 96 S .307(ointer to a byte string.)-2.807 F +.307(This element is accessed using)5.307 F/F1 10/Times-Italic@0 SF -.1 +(ge)2.806 G(t_data).1 E F0(and)2.806 E F1(set_data)2.806 E F0 2.806(,a) +.26 G .306(nd may be initial-)-2.806 F +(ized using one of the constructors.)133 108 Q(int of)108 124.8 Q(fset;) +-.25 E 1.051(The number of bytes of)133 136.8 R 1.052(fset into the)-.25 +F F1(data)3.552 E F0 1.052 +(array to determine the portion of the array actually used.)3.552 F +(This element is accessed using)133 148.8 Q F1 -.1(ge)2.5 G(t_of).1 E +(fset)-.18 E F0(and)2.5 E F1(set_of)2.5 E(fset)-.18 E F0(.).68 E +(u_int32_t size;)108 165.6 Q .019(The length of)133 177.6 R F1(data) +2.519 E F0 2.519(,i).26 G 2.518(nb)-2.519 G 2.518(ytes. This)-2.518 F +.018(element is accessed using)2.518 F F1 -.1(ge)2.518 G(t_size).1 E F0 +(and)2.518 E F1(set_size)2.518 E F0 2.518(,a).18 G .018 +(nd may be initial-)-2.518 F(ized using the constructor with tw)133 +189.6 Q 2.5(oa)-.1 G -.18(rg)-2.5 G(uments.).18 E(u_int32_t ulen;)108 +206.4 Q .974(The size of the user')133 218.4 R 3.474(sb)-.55 G(uf)-3.674 +E .974(fer \(referenced by)-.25 F F1(data)3.474 E F0 .974(\), in bytes.) +.26 F .975(This location is not written by the Db)5.975 F 2.716 +(functions. See)133 230.4 R .216 +(the DB_DBT_USERMEM \215ag for more information.)2.716 F .216 +(This element is accessed using)5.216 F F1 -.1(ge)133 242.4 S(t_ulen).1 +E F0(and)2.5 E F1(set_ulen)2.5 E F0(.).24 E(u_int32_t dlen;)108 259.2 Q +3.063(The length of the partial record being read or written by the application, in bytes.) +133 271.2 R 3.064(See the)8.064 F(DB_DBT_P)133 283.2 Q(AR)-.92 E 3.086 +(TIAL \215ag for more information.)-.6 F 3.085 +(This element is accessed using)8.086 F F1 -.1(ge)5.585 G(t_dlen).1 E F0 +(and)5.585 E F1(set_dlen)133 295.2 Q F0(.).24 E(u_int32_t dof)108 312 Q +(f;)-.25 E 3.218(The of)133 324 R 3.218(fset of the partial record being read or written by the application, in bytes.) +-.25 F 3.219(See the)8.219 F(DB_DBT_P)133 336 Q(AR)-.92 E 3.253 +(TIAL \215ag for more information.)-.6 F 3.253 +(This element is accessed using)8.253 F F1 -.1(ge)5.752 G(t_dof).1 E(f) +-.18 E F0(and)5.752 E F1(set_dof)133 348 Q(f)-.18 E F0(.)1.96 E +(u_int32_t \215ags;)108 364.8 Q 2.507(This element is accessed using)133 +376.8 R F1 -.1(ge)5.007 G(t_\215a).1 E(gs)-.1 E F0(and)5.007 E F1 +(set_\215a)5.007 E(gs)-.1 E F0 7.507(.T).27 G 2.507(he \215ags v)-7.507 +F 2.507(alue is speci\214ed by)-.25 F/F2 10/Times-Bold@0 SF(or)5.008 E +F0('ing)A(together one or more of the follo)133 388.8 Q(wing v)-.25 E +(alues:)-.25 E(DB_DBT_MALLOC)133 417.6 Q .85(Ignored e)158 429.6 R .85 +(xcept when retrie)-.15 F .849 +(ving information from a database, e.g., a)-.25 F F1(Db::g)3.349 E(et) +-.1 E F0(or)3.349 E F1(Dbc::g)3.349 E(et)-.1 E F0(call.)3.349 E .594 +(This \215ag causes Db to allocate memory for the returned k)158 441.6 R +.895 -.15(ey o)-.1 H 3.095(rd).15 G .595(ata item \(using)-3.095 F F1 +(malloc)3.095 E F0 .595(\(3\), or).31 F .51(the user)158 453.6 R .51 +(-speci\214ed malloc method\) and return a pointer to it in the)-.2 F F1 +(data)3.009 E F0 .509(\214eld of the k)3.009 F .809 -.15(ey o)-.1 H +3.009(rd).15 G(ata)-3.009 E .648(Dbt object.)158 465.6 R .648(The allocated memory becomes the responsibility of the calling application.) +5.648 F .649(It is)5.649 F +(an error to specify both DB_DBT_MALLOC and DB_DBT_USERMEM.)158 477.6 Q +(DB_DBT_USERMEM)133 506.4 Q .85(Ignored e)158 518.4 R .85 +(xcept when retrie)-.15 F .849 +(ving information from a database, e.g., a)-.25 F F1(Db::g)3.349 E(et) +-.1 E F0(or)3.349 E F1(Dbc::g)3.349 E(et)-.1 E F0(call.)3.349 E(The)158 +530.4 Q F1(data)3.523 E F0 1.023(\214eld of the k)3.523 F 1.323 -.15 +(ey o)-.1 H 3.523(rd).15 G 1.023 +(ata object must reference memory that is at least)-3.523 F F1(ulen) +3.524 E F0 1.024(bytes in)3.524 F 3.617(length. If)158 542.4 R 1.117(the length of the requested item is less than or equal to that number of bytes, the) +3.617 F .823(item is copied into the memory referenced by the)158 554.4 +R F1(data)3.323 E F0 3.324(\214eld. Otherwise,)3.323 F .824 +(an error is returned,)3.324 F(the)158 566.4 Q F1(size)3.002 E F0 .501 +(\214eld is set to the length needed for the requested item, and the) +3.001 F F1(errno)3.001 E F0 -.25(va)3.001 G .501(riable is set to).25 F +2.5(ENOMEM. It)158 578.4 R +(is an error to specify both DB_DBT_MALLOC and DB_DBT_USERMEM.)2.5 E +(DB_DBT_P)133 607.2 Q(AR)-.92 E(TIAL)-.6 E .523(Ignored e)158 619.2 R +.523(xcept when speci\214ed for a data parameter)-.15 F 3.024(,w)-.4 G +.524(here this \215ag causes the partial retrie)-3.024 F -.25(va)-.25 G +(l).25 E .17(or storage of an item.)158 631.2 R .169 +(If the calling application is doing a get, the)5.17 F F1(dlen)2.669 E +F0 .169(bytes starting)2.669 F F1(dof)2.669 E(f)-.18 E F0(bytes)2.669 E +1.427(from the be)158 643.2 R 1.427(ginning of the retrie)-.15 F -.15 +(ve)-.25 G 3.927(dd).15 G 1.427(ata record are returned as if the)-3.927 +F 3.928(yc)-.15 G 1.428(omprised the entire)-3.928 F 3.093(record. If) +158 655.2 R(an)3.093 E 3.093(yo)-.15 G 3.093(ra)-3.093 G .593 +(ll of the speci\214ed bytes do not e)-3.093 F .592 +(xist in the record, the get is successful and)-.15 F(the e)158 667.2 Q +(xisting bytes or 0 bytes are returned.)-.15 E -.15(Fo)158 691.2 S 2.82 +(re).15 G .32(xample, if the data portion of a retrie)-2.97 F -.15(ve) +-.25 G 2.82(dr).15 G .32(ecord w)-2.82 F .32 +(as 100 bytes, and a partial retrie)-.1 F -.25(va)-.25 G 2.82(lw).25 G +(as)-2.92 E .055(done using a Dbt ha)158 703.2 R .055(ving a)-.2 F F1 +(dlen)2.555 E F0 .054(\214eld of 20 and a)2.554 F F1(dof)2.554 E(f)-.18 +E F0 .054(\214eld of 85, the get call w)2.554 F .054(ould succeed, the) +-.1 F F1(data)158 715.2 Q F0(\214eld w)2.5 E +(ould reference the last 15 bytes of the record, and the)-.1 E F1(size) +2.5 E F0(\214eld w)2.5 E(ould be set to 15.)-.1 E(April 10, 1998)276.695 +768 Q(2)199.695 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 412.18(Dbt\(3\) Dbt\(3\))72 48 R .171 +(If the calling application is doing a put, the)158 84 R/F1 10 +/Times-Italic@0 SF(dlen)2.671 E F0 .171(bytes starting)2.671 F F1(dof) +2.671 E(f)-.18 E F0 .172(bytes from the be)2.671 F .172(ginning of)-.15 +F .65(the speci\214ed k)158 96 R -.15(ey)-.1 G 1.75 -.55('s d).15 H .649 +(ata record are replaced by the data speci\214ed by the).55 F F1(data) +3.149 E F0(and)3.149 E F1(size)3.149 E F0(objects.)3.149 E(If)158 108 Q +F1(dlen)2.938 E F0 .439(is smaller than)2.939 F F1(size)2.939 E F0 2.939 +(,t).18 G .439(he record will gro)-2.939 F 1.739 -.65(w, a)-.25 H .439 +(nd if).65 F F1(dlen)2.939 E F0 .439(is lar)2.939 F .439(ger than)-.18 F +F1(size)2.939 E F0 2.939(,t).18 G .439(he record will)-2.939 F 2.606 +(shrink. If)158 120 R .106(the speci\214ed bytes do not e)2.606 F .106 +(xist, the record will be e)-.15 F .106 +(xtended using nul bytes as neces-)-.15 F(sary)158 132 Q 2.5(,a)-.65 G +(nd the put call will succeed.)-2.5 E 1.542 +(It is an error to attempt a partial put using the)158 156 R F1(Db::put) +4.042 E F0 1.542(method in a database that supports)4.042 F .49 +(duplicate records.)158 168 R -.15(Pa)5.49 G .49(rtial puts in databases supporting duplicate records must be done using a) +.15 F F1(Db::cur)158 180 Q(sor)-.1 E F0 2.803(method. It)2.802 F .303 +(is an error to attempt a partial put with dif)2.803 F(fering)-.25 E F1 +(dlen)2.803 E F0(and)2.803 E F1(size)2.803 E F0 -.25(va)2.803 G .303 +(lues in).25 F 2.5(ar)158 192 S(ecno database with \214x)-2.5 E +(ed-length records.)-.15 E -.15(Fo)158 216 S 2.697(re).15 G .197 +(xample, if the data portion of a retrie)-2.847 F -.15(ve)-.25 G 2.697 +(dr).15 G .197(ecord w)-2.697 F .196(as 100 bytes, and a partial put w) +-.1 F .196(as done)-.1 F 1.093(using a Dbt ha)158 228 R 1.093(ving a)-.2 +F F1(dlen)3.593 E F0 1.093(\214eld of 20, a)3.593 F F1(dof)3.593 E(f) +-.18 E F0 1.093(\214eld of 85, and a)3.593 F F1(size)3.594 E F0 1.094 +(\214eld of 30, the resulting)3.594 F .786(record w)158 240 R .786 +(ould be 115 bytes in length, where the last 30 bytes w)-.1 F .786 +(ould be those speci\214ed by the)-.1 F(put call.)158 252 Q .033 +(The def)108 268.8 R .033(ault algorithm of associating returned k)-.1 F +.333 -.15(ey o)-.1 H 2.533(rd).15 G .033 +(ata items with the Db handle returned by)-2.533 F F1(Db::open)2.534 E +F0(\(3\)).24 E .092(will ob)108 280.8 R .092(viously not w)-.15 F .092(ork when Db handles are being used concurrently by multiple threads within a process,) +-.1 F .904(i.e, when DB_THREAD w)108 292.8 R .904(as speci\214ed to)-.1 +F F1(Db::open)3.405 E F0(\(3\).).24 E/F2 10/Times-Bold@0 SF .905 +(When multiple thr)5.905 F .905(eads ar)-.18 F 3.405(eu)-.18 G .905 +(sing the r)-3.405 F(etur)-.18 E(ned)-.15 E 2.412(Db handle concurr)108 +304.8 R(ently)-.18 E 4.912(,e)-.55 G 2.412 +(ither the DB_DBT_MALLOC or DB_DBT_USERMEM \215ags must be)-4.912 F +(speci\214ed f)108 316.8 Q(or any Dbt used f)-.25 E(or k)-.25 E +(ey or data r)-.1 E(etrie)-.18 E -.1(va)-.15 G(l.).1 E/F3 9/Times-Bold@0 +SF(LOGICAL RECORD NUMBERS)72 333.6 Q F0 1.312 +(In all cases for the recno access method, and when calling the)108 +345.6 R F1(Db::g)3.812 E(et)-.1 E F0(and)3.812 E F1(Dbc::g)3.812 E(et) +-.1 E F0 1.312(functions with the)3.812 F +(DB_GET_RECNO \215ag speci\214ed, the)108 357.6 Q F1(data)2.5 E F0 .196 +(\214eld of the k)108 381.6 R .496 -.15(ey m)-.1 H .196 +(ust be a pointer to a memory location of type).15 F F1(db_r)2.696 E +(ecno_t)-.37 E F0 2.696(,a).68 G 2.695(st)-2.696 G -1.95(ypedef ')-2.695 +F 2.695(di)-.5 G 2.695(nt)-2.695 G .195(he )-2.695 F 1.178 +(include \214le.)108 393.6 R 1.178(This type is a 32-bit unsigned type, \(which limits the number of logical records in a recno) +6.178 F 2.148 +(database, and the maximum logical record which may be directly retrie) +108 405.6 R -.15(ve)-.25 G 4.648(df).15 G 2.148 +(rom a btree database, to)-4.648 F 2.5(4,294,967,296\). The)108 417.6 R +F1(size)2.5 E F0(\214eld of the k)2.5 E .3 -.15(ey s)-.1 H +(hould be the size of that type, e.g.,).15 E +(in the C programming language, `)108 441.6 Q(`sizeof\(db_recno_t\)') +-.74 E('.)-.74 E(Logical record numbers are 1-based, not 0-based, i.e., the \214rst record in the database is record number 1.) +108 465.6 Q F3 -.09(BU)72 482.4 S(GS).09 E F0 .099 +(The Db access methods pro)108 494.4 R .099(vide no guarantees about byte string alignment, and applications are responsible) +-.15 F(for maintaining an)108 506.4 Q 2.5(yn)-.15 G(ecessary alignment.) +-2.5 E .37(The name Dbt is a mnemonic for `)108 523.2 R .37 +(`data base thang')-.74 F .369(', and w)-.74 F .369 +(as used because noone could think of a reason-)-.1 F(able name that w) +108 535.2 Q(asn')-.1 E 2.5(ta)-.18 G(lready in use some)-2.5 E +(where else.)-.25 E F3(SEE ALSO)72 552 Q F1(db_ar)108 564 Q -.15(ch)-.37 +G(ive).15 E F0(\(1\),).18 E F1(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F0 +(\(1\),).68 E F1(db_deadloc)2.5 E(k)-.2 E F0(\(1\),).67 E F1(db_dump)2.5 +E F0(\(1\),).19 E F1(db_load)2.5 E F0(\(1\),).77 E F1(db_r)2.5 E(eco) +-.37 E(ver)-.1 E F0(\(1\),).73 E F1(db_stat)2.5 E F0(\(1\),).68 E F1 +(db_intr)108 576 Q(o)-.45 E F0(\(3\),).18 E F1(db_internal)2.5 E F0 +(\(3\),).51 E F1(db_thr)2.5 E(ead)-.37 E F0(\(3\),).77 E F1(Db)2.5 E F0 +(\(3\),).23 E F1(Dbc)2.5 E F0(\(3\),).31 E F1(DbEn)2.5 E(v)-.4 E F0 +(\(3\),).32 E F1(DbException)2.5 E F0(\(3\),).24 E F1(DbInfo)2.5 E F0 +(\(3\),).18 E F1(DbLoc)108 588 Q(k)-.2 E F0(\(3\),).67 E F1(DbLoc)2.5 E +(kT)-.2 E(ab)-.92 E F0(\(3\),).23 E F1(DbLo)2.5 E(g)-.1 E F0(\(3\),).22 +E F1(DbLsn)2.5 E F0(\(3\),).24 E F1(DbMpool)2.5 E F0(\(3\),).51 E F1 +(DbMpoolF)2.5 E(ile)-.45 E F0(\(3\),).18 E F1(Dbt)2.5 E F0(\(3\),).68 E +F1(DbTxn)2.5 E F0(\(3\),).24 E F1(DbTxnMgr)108 600 Q F0(\(3\)).73 E +(April 10, 1998)276.695 768 Q(3)199.695 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/mancxx.ps/db_archive.ps b/mozilla/db/man/mancxx.ps/db_archive.ps new file mode 100644 index 00000000000..645f82c5c9b --- /dev/null +++ b/mozilla/db/man/mancxx.ps/db_archive.ps @@ -0,0 +1,415 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:31 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 2 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_archi)108 40.8 Q .3 -.15(ve \255 t)-.25 H(he DB database archi).15 E +-.15(ve)-.25 G(r).15 E F0(SYNOPSIS)72 57.6 Q/F2 10/Times-Bold@0 SF +(db_ar)108 69.6 Q(chi)-.18 E -.1(ve)-.1 G F1([)2.6 E F2(-alsv)A F1 2.5 +(][)C F2(-h home)-2.5 E F1(])A F0(DESCRIPTION)72 86.4 Q F1(The)108 98.4 +Q/F3 10/Times-Italic@0 SF(db_ar)2.587 E -.15(ch)-.37 G(ive).15 E F1 .087 +(utility writes the pathnames of log \214les that are no longer in use \(e.g., no longer in) +2.587 F -.2(vo)-.4 G(lv).2 E .086(ed in)-.15 F(acti)108 110.4 Q 1.633 +-.15(ve t)-.25 H 1.334 +(ransactions\), to the standard output, one pathname per line.).15 F +1.334(These log \214les should be written to)6.334 F .467 +(backup media to pro)108 122.4 R .467(vide for reco)-.15 F -.15(ve)-.15 +G .467(ry in the case of catastrophic f).15 F .467 +(ailure \(which also requires a snapshot of)-.1 F +(the database \214les\), b)108 134.4 Q(ut the)-.2 E 2.5(ym)-.15 G +(ay then be deleted from the system to reclaim disk space.)-2.5 E +(The options are as follo)108 151.2 Q(ws:)-.25 E F2108 168 Q F1 +(Write all pathnames as absolute pathnames, instead of relati)14.3 E .3 +-.15(ve t)-.25 H 2.5(ot).15 G(he database home directories.)-2.5 E F2 +108 184.8 Q F1(Specify a home directory for the database.)13.74 E +F2108 201.6 Q F1 1.005(Write out the pathnames of all of the database log \214les, whether or not the) +16.52 F 3.505(ya)-.15 G 1.005(re in)-3.505 F -.2(vo)-.4 G(lv).2 E 1.005 +(ed in acti)-.15 F -.15(ve)-.25 G(transactions.)133 213.6 Q F2108 +230.4 Q F1 1.698(Write the pathnames of all of the database \214les that need to be archi) +15.41 F -.15(ve)-.25 G 4.198(di).15 G 4.198(no)-4.198 G 1.698 +(rder to reco)-4.198 F -.15(ve)-.15 G 4.198(rt).15 G(he)-4.198 E .065 +(database from catastrophic f)133 242.4 R 2.565(ailure. If)-.1 F(an) +2.565 E 2.565(yo)-.15 G 2.566(ft)-2.565 G .066(he database \214les ha) +-2.566 F .366 -.15(ve n)-.2 H .066(ot been accessed during the life-).15 +F(time of the current log \214les,)133 254.4 Q F3(db_ar)2.5 E -.15(ch) +-.37 G(ive).15 E F1(will not include them in this output.)2.5 E .318 +(It is possible that some of the \214les referenced in the log ha)133 +278.4 R .617 -.15(ve s)-.2 H .317(ince been deleted from the system.).15 +F(In)5.317 E .999(this case,)133 290.4 R F3(db_ar)3.499 E -.15(ch)-.37 G +(ive).15 E F1 .999(will ignore them.)3.499 F(When)5.999 E F3(db_r)3.499 +E(eco)-.37 E(ver)-.1 E F1 .999(\(1\) is run, an).73 F 3.5<798c>-.15 G 1 +(les referenced in the log)-3.5 F(that are not present during reco)133 +302.4 Q -.15(ve)-.15 G(ry are assumed to ha).15 E .3 -.15(ve b)-.2 H +(een deleted and will not be reco).15 E -.15(ve)-.15 G(red.).15 E F2 +108 319.2 Q F1(Run in v)14.3 E +(erbose mode, listing the checkpoints in the log \214les as the)-.15 E +2.5(ya)-.15 G(re re)-2.5 E(vie)-.25 E(wed.)-.25 E(The)108 336 Q F3 +(db_ar)4.422 E -.15(ch)-.37 G(ive).15 E F1 1.922 +(utility attaches to DB shared memory re)4.422 F 4.422(gions. In)-.15 F +1.922(order to a)4.422 F -.2(vo)-.2 G 1.922(id re).2 F 1.922 +(gion corruption, it)-.15 F 1.28(should al)108 348 R -.1(wa)-.1 G 1.28 +(ys be gi).1 F -.15(ve)-.25 G 3.78(nt).15 G 1.28 +(he chance to detach and e)-3.78 F 1.281(xit gracefully)-.15 F 6.281(.T) +-.65 G 3.781(oc)-7.081 G(ause)-3.781 E F3(db_ar)3.781 E -.15(ch)-.37 G +(ive).15 E F1 1.281(to clean up after)3.781 F(itself and e)108 360 Q +(xit, send it an interrupt signal \(SIGINT\).)-.15 E(The)108 376.8 Q F3 +(db_ar)2.5 E -.15(ch)-.37 G(ive).15 E F1(utility e)2.5 E +(xits 0 on success, and >0 if an error occurs.)-.15 E F0(DB ARCHIV)72 +393.6 Q(AL PR)-1.215 E(OCEDURES)-.27 E F1 .868(There are tw)108 405.6 R +3.368(oa)-.1 G .868(spects to managing the reco)-3.368 F -.15(ve)-.15 G +.868(rability and disk consumption of your DB databases.).15 F(First,) +5.868 E .592(you may w)108 417.6 R .592 +(ant to periodically create snapshots of your databases to mak)-.1 F +3.093(ei)-.1 G 3.093(tp)-3.093 G .593(ossible to reco)-3.093 F -.15(ve) +-.15 G 3.093(rt).15 G .593(hem from)-3.093 F 1.78(catastrophic f)108 +429.6 R 4.28(ailure. Second,)-.1 F(you')4.28 E 1.78(ll w)-.1 F 1.78 +(ant to periodically remo)-.1 F 2.08 -.15(ve l)-.15 H 1.78 +(og \214les in order to conserv).15 F 4.28(eo)-.15 G 4.28(nd)-4.28 G +(isk)-4.28 E 2.67(space. The)108 441.6 R(tw)2.67 E 2.67(op)-.1 G .17 +(rocedures are distinct from each other)-2.67 F 2.67(,a)-.4 G .17 +(nd you cannot remo)-2.67 F .47 -.15(ve t)-.15 H .17 +(he current log \214les simply).15 F(because you ha)108 453.6 Q .3 -.15 +(ve c)-.2 H(reated a database snapshot.).15 E 2.398 -.8(To c)108 470.4 T +.798(reate a snapshot of your database that can be used to reco).8 F +-.15(ve)-.15 G 3.297(rf).15 G .797(rom catastrophic f)-3.297 F .797 +(ailure, the follo)-.1 F(wing)-.25 E(steps should be tak)108 482.4 Q +(en:)-.1 E 15(1. Run)108 499.2 R F3(db_ar)3.385 E -.15(ch)-.37 G(ive).15 +E F1 .885 +(\255s to identify all of the database data \214les that must be sa) +3.385 F -.15(ve)-.2 G .886(d, and cop).15 F 3.386(yt)-.1 G .886 +(hem to a)-3.386 F 1.537(backup de)133 511.2 R 1.537 +(vice, \(e.g., tape\).)-.25 F 1.537(If the database \214les are stored in a separate directory from the other) +6.537 F(database \214les, it may be simpler to archi)133 523.2 Q .3 -.15 +(ve t)-.25 H(he directory itself instead of the indi).15 E +(vidual \214les.)-.25 E F2(Mor)133 547.2 Q 2.955(ei)-.18 G(mportantly) +-2.955 E 2.955(,i)-.55 G 2.955(fa)-2.955 G .455 +(ny of the database \214les ha)-2.955 F .655 -.1(ve n)-.25 H .455 +(ot been accessed during the lifetime of the).1 F(curr)133 559.2 Q .519 +(ent log \214les, db_ar)-.18 F(chi)-.18 E .719 -.1(ve w)-.1 H .519 +(ill not list them in its output!).1 F F1 -.15(Fo)5.519 G 3.019(rt).15 G +.518(his reason, it may be important)-3.019 F +(to use a separate database \214le directory)133 571.2 Q 2.5(,a)-.65 G +(rchi)-2.5 E(ving it instead of the \214les listed by)-.25 E F3(db_ar) +2.5 E -.15(ch)-.37 G(ive).15 E F1(.).18 E 15(2. If)108 588 R .914 +(your database is currently acti)3.414 F -.15(ve)-.25 G 3.414(,i).15 G +.914(.e., you are reading and writing to the database \214les while the) +-3.414 F 1.579(snapshot is being tak)133 600 R 1.579(en, run)-.1 F F3 +(db_ar)4.079 E -.15(ch)-.37 G(ive).15 E F1 1.579 +(\255l to identify the database log \214les, and cop)4.079 F 4.078(yt) +-.1 G 1.578(hem to a)-4.078 F .547(backup de)133 612 R .547 +(vice, \(e.g., tape\).)-.25 F .548(If the database log \214les are stored in a separate directory from the other) +5.547 F(database \214les, it may be simpler to archi)133 624 Q .3 -.15 +(ve t)-.25 H(he directory itself instead of the indi).15 E +(vidual \214les.)-.25 E .308(Note that the order of these operations is important, and that the database \214les) +108 640.8 R F2(must)2.808 E F1 .307(be archi)2.807 F -.15(ve)-.25 G +2.807(db).15 G .307(efore the)-2.807 F(log \214les.)108 652.8 Q .546(The DB library supports on-line backups, and it is not necessary to stop reading or writing your databases) +108 669.6 R .567(during the time when you create this snapshot.)108 +681.6 R .566(Note ho)5.567 F(we)-.25 E -.15(ve)-.25 G 1.366 -.4(r, t).15 +H .566(hat the snapshot of an acti).4 F .866 -.15(ve d)-.25 H .566 +(atabase will).15 F .312(be consistent as of some unspeci\214ed time between the start of the archi) +108 693.6 R -.25(va)-.25 G 2.812(la).25 G .312(nd when archi)-2.812 F +-.25(va)-.25 G 2.812(li).25 G 2.812(sc)-2.812 G(ompleted.)-2.812 E 2.19 +-.8(To c)108 705.6 T .59(reate a snapshot as of a speci\214c time, you must stop reading and writing your databases for the entire) +.8 F 1.555(time of the archi)108 717.6 R -.25(va)-.25 G 1.555 +(l, force a checkpoint \(see).25 F F3(db_c)4.056 E(hec)-.15 E(kpoint)-.2 +E F1 1.556(\(1\)\), and then archi).68 F 1.856 -.15(ve t)-.25 H 1.556 +(he \214les listed by the).15 F F3(db_ar)108 729.6 Q -.15(ch)-.37 G(ive) +.15 E F1(command')2.5 E(s)-.55 E F22.5 E F1(and)2.5 E F22.5 +E F1(options.)2.5 E(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 315.52(DB_ARCHIVE\(1\) DB_ARCHIVE\(1\))72 48 R +.606(Once these steps are completed, your database can be reco)108 84 R +-.15(ve)-.15 G .606(red from catastrophic f).15 F .606 +(ailure to its state as of)-.1 F .146(the time the archi)108 96 R -.25 +(va)-.25 G 2.646(lw).25 G .146(as done.)-2.746 F 1.746 -.8(To u)5.146 H +.147(pdate your snapshot so that reco).8 F -.15(ve)-.15 G .147 +(ry from catastrophic f).15 F .147(ailure is possi-)-.1 F +(ble up to a ne)108 108 Q 2.5(wp)-.25 G +(oint in time, repeat step #2, cop)-2.5 E(ying all e)-.1 E +(xisting log \214les to a backup de)-.15 E(vice.)-.25 E .357(Each time that a complete snapshot is made, i.e. all database and log \214les are copied to backup media, you) +108 124.8 R(may discard all pre)108 136.8 Q(vious snapshots and sa)-.25 +E -.15(ve)-.2 G 2.5(dl).15 G(og \214les.)-2.5 E .236 +(The time to restore from catastrophic f)108 153.6 R .236 +(ailure is a function of the number of log records that ha)-.1 F .537 +-.15(ve b)-.2 H .237(een writ-).15 F 2.088(ten since the snapshot w)108 +165.6 R 2.087(as originally created.)-.1 F 2.087 +(Perhaps more importantly)7.087 F 4.587(,t)-.65 G 2.087 +(he more separate pieces of)-4.587 F .608 +(backup media you use, the more lik)108 177.6 R .608 +(ely that you will ha)-.1 F .908 -.15(ve a p)-.2 H .608 +(roblem reading from one of them.).15 F -.15(Fo)5.608 G 3.108(rt).15 G +(hese)-3.108 E(reasons, it is often best to mak)108 189.6 Q 2.5(es)-.1 G +(napshots on a re)-2.5 E(gular basis.)-.15 E/F1 10/Times-Bold@0 SF -.25 +(Fo)108 206.4 S 2.758(ra).25 G -.18(rc)-2.758 G(hi).18 E -.1(va)-.1 G +2.758(ls).1 G .258(afety r)-2.758 F .258(emember to ensur)-.18 F 2.758 +(et)-.18 G .258(hat y)-2.758 F .258(ou ha)-.25 F .458 -.1(ve m)-.25 H +.258(ultiple copies of y).1 F .258(our database backups, that)-.25 F +-.25(yo)108 218.4 S 2.5(uv).25 G(erify that y)-2.6 E(our ar)-.25 E(chi) +-.18 E -.1(va)-.1 G 2.5(lm).1 G(edia is err)-2.5 E(or)-.18 E(-fr)-.37 E +(ee, and that copies of y)-.18 E(our backups ar)-.25 E 2.5(es)-.18 G +(tor)-2.5 E(ed off-site!)-.18 E F0 1.6 -.8(To r)108 235.2 T +(estore your database after catastrophic f).8 E(ailure, the follo)-.1 E +(wing steps should be tak)-.25 E(en:)-.1 E 15(1. Restore)108 252 R +(the copies of the database \214les from the backup media.)2.5 E 15 +(2. Restore)108 268.8 R .248 +(the copies of the log \214les from the backup media,)2.747 F F1 .248 +(in the order in which they wer)2.748 F 2.748(ew)-.18 G(ritten)-2.748 E +F0(.)A(\(It')133 280.8 Q 3.116(sp)-.55 G .616(ossible that the same log \214le appears on multiple backups, and you only w) +-3.116 F .615(ant the most recent)-.1 F -.15(ve)133 292.8 S +(rsion of that log \214le!\)).15 E 15(3. Run)108 309.6 R/F2 10 +/Times-Italic@0 SF(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\255c to reco)2.5 +E -.15(ve)-.15 G 2.5(rt).15 G(he database.)-2.5 E 1.344 +(It is possible to recreate the database in a location dif)108 326.4 R +1.344(ferent than the original, by specifying appropriate)-.25 F +(pathnames to the \255h option of the)108 338.4 Q F2(db_r)2.5 E(eco)-.37 +E(ver)-.1 E F0(utility)2.5 E(.)-.65 E 1.6 -.8(To r)108 355.2 T(emo).8 E +.3 -.15(ve l)-.15 H(og \214les, the follo).15 E +(wing steps should be tak)-.25 E(en:)-.1 E 15(1. If)108 372 R 2.19 +(you are concerned with catastrophic f)4.69 F 2.19(ailure, \214rst cop) +-.1 F 4.69(yt)-.1 G 2.19(hem to backup media \(e.g., tape\), as)-4.69 F +(described abo)133 384 Q -.15(ve)-.15 G 5(.T).15 G +(his is because log \214les are necessary for reco)-5 E -.15(ve)-.15 G +(ry from catastrophic f).15 E(ailure.)-.1 E 15(2. Run)108 400.8 R F2 +(db_ar)4.567 E -.15(ch)-.37 G(ive).15 E F0 4.567(,w).18 G 2.067(ithout options, to identify all of the log \214les that are no longer in use \(e.g.,) +-4.567 F(in)133 412.8 Q -.2(vo)-.4 G(lv).2 E(ed in an acti)-.15 E .3 +-.15(ve t)-.25 H(ransaction\).).15 E 15(3. Remo)108 429.6 R .3 -.15 +(ve t)-.15 H(hose log \214les from the system.).15 E/F3 9/Times-Bold@0 +SF(ENVIR)72 446.4 Q(ONMENT V)-.27 E(ARIABLES)-1.215 E F0(The follo)108 +458.4 Q(wing en)-.25 E(vironment v)-.4 E(ariables af)-.25 E(fect the e) +-.25 E -.15(xe)-.15 G(cution of).15 E F2(db_ar)2.5 E -.15(ch)-.37 G(ive) +.15 E F0(:).18 E(DB_HOME)108 475.2 Q .222(If the)133 487.2 R F1 +2.722 E F0 .222(option is not speci\214ed and the en)2.722 F .222 +(vironment v)-.4 F(ariable)-.25 E F2(DB_HOME)2.722 E F0 .221 +(is set, it is used as the path)2.721 F +(of the database home, as described in)133 499.2 Q F2(db_appinit)2.5 E +F0(\(3\).).68 E F3(SEE ALSO)72 516 Q F0 .485(The DB library is a f)108 +528 R .485(amily of groups of functions that pro)-.1 F .486 +(vides a modular programming interf)-.15 F .486(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 540 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .506(\214le page caching, as well as v)108 552 R .506 +(arious inde)-.25 F -.15(xe)-.15 G 3.006(da).15 G .506(ccess methods.) +-3.006 F(Man)5.507 E 3.007(yo)-.15 G 3.007(ft)-3.007 G .507 +(he functional groups \(e.g., the \214le)-3.007 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 564 R .121(are e)108 576 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.122 G 2.622(rag).15 G .122(eneral description of)-2.622 +F(the DB package, see)108 588 Q F2(db_intr)2.5 E(o)-.45 E F0(\(3\).).18 +E F2(db_ar)108 604.8 Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E F2(db_c) +2.5 E(hec)-.15 E(kpoint)-.2 E F0(\(1\),).68 E F2(db_deadloc)2.5 E(k)-.2 +E F0(\(1\),).67 E F2(db_dump)2.5 E F0(\(1\),).19 E F2(db_load)2.5 E F0 +(\(1\),).77 E F2(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F2 +(db_stat)2.5 E F0(\(1\),).68 E F2(db_intr)108 616.8 Q(o)-.45 E F0 +(\(3\),).18 E F2(db_appinit)2.5 E F0(\(3\),).68 E F2(db_cur)2.5 E(sor) +-.1 E F0(\(3\),).73 E F2(db_dbm)2.5 E F0(\(3\),).32 E F2(db_internal)2.5 +E F0(\(3\),).51 E F2(db_loc)2.5 E(k)-.2 E F0(\(3\),).67 E F2(db_lo)2.5 E +(g)-.1 E F0(\(3\),).22 E F2(db_mpool)2.5 E F0(\(3\),).51 E F2(db_open) +108 628.8 Q F0(\(3\),).24 E F2(db_thr)2.5 E(ead)-.37 E F0(\(3\),).77 E +F2(db_txn)2.5 E F0(\(3\)).24 E(May 3, 1998)280.585 768 Q(2)203.585 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/mancxx.ps/db_checkpoint.ps b/mozilla/db/man/mancxx.ps/db_checkpoint.ps new file mode 100644 index 00000000000..dabf1d99e31 --- /dev/null +++ b/mozilla/db/man/mancxx.ps/db_checkpoint.ps @@ -0,0 +1,277 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:32 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 1 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_checkpoint \255 the DB database checkpoint utility)108 40.8 Q F0 +(SYNOPSIS)72 57.6 Q/F2 10/Times-Bold@0 SF(db_checkpoint)108 69.6 Q F1([) +2.5 E F2(-1v)A F1 2.5(][)C F2(-h home)-2.5 E F1 2.5(][)C F2(-k kbytes) +-2.5 E F1 2.5(][)C F2(-L \214le)-2.5 E F1 2.5(][)C F2(-p min)-2.5 E F1 +(])A F0(DESCRIPTION)72 86.4 Q F1(The)108 98.4 Q/F3 10/Times-Italic@0 SF +(db_c)5.093 E(hec)-.15 E(kpoint)-.2 E F1 2.592(utility is a daemon process that monitors the database log and periodically calls) +5.093 F F3(txn_c)108 110.4 Q(hec)-.15 E(kpoint)-.2 E F1 +(\(3\) to checkpoint it.).68 E(The options are as follo)108 127.2 Q(ws:) +-.25 E F2108 144 Q F1(Checkpoint the log once, and then e)14.3 E +(xit.)-.15 E F2108 160.8 Q F1 +(Specify a home directory for the database.)13.74 E F2108 177.6 Q +F1(Checkpoint the database at least as often as e)13.74 E -.15(ve)-.25 G +(ry).15 E F3(kbytes)2.5 E F1(of log \214le are written.)2.5 E F2 +108 194.4 Q F1 1.246(Log the e)12.63 F -.15(xe)-.15 G 1.247(cution of the db_checkpoint utility to the speci\214ed \214le in the follo) +.15 F 1.247(wing format, where)-.25 F -.74(``)133 206.4 S(###').74 E 2.5 +('i)-.74 G 2.5(st)-2.5 G +(he process ID, and the date is the time the utility starting running.) +-2.5 E(db_checkpoint: ### W)133 230.4 Q(ed Jun 15 01:23:45 EDT 1995)-.8 +E(This \214le will be remo)133 254.4 Q -.15(ve)-.15 G 2.5(di).15 G 2.5 +(ft)-2.5 G(he db_checkpoint utility e)-2.5 E(xits gracefully)-.15 E(.) +-.65 E F2108 271.2 Q F1(Checkpoint the database at least e)13.74 E +-.15(ve)-.25 G(ry).15 E F3(min)2.5 E F1(minutes.)2.5 E F2108 288 Q +F1(Write the time of each checkpoint to the standard output.)14.3 E +(At least one of the)108 304.8 Q F22.5 E F1(,)A F22.5 E F1 +(and)2.5 E F22.5 E F1(options must be speci\214ed.)2.5 E(The)108 +321.6 Q F3(db_c)3.522 E(hec)-.15 E(kpoint)-.2 E F1 1.022 +(utility attaches to DB shared memory re)3.522 F 3.522(gions. In)-.15 F +1.022(order to a)3.522 F -.2(vo)-.2 G 1.022(id re).2 F 1.022 +(gion corruption, it)-.15 F .486(should al)108 333.6 R -.1(wa)-.1 G .486 +(ys be gi).1 F -.15(ve)-.25 G 2.986(nt).15 G .486 +(he chance to detach and e)-2.986 F .487(xit gracefully)-.15 F 5.487(.T) +-.65 G 2.987(oc)-6.287 G(ause)-2.987 E F3(db_c)2.987 E(hec)-.15 E +(kpoint)-.2 E F1 .487(to clean up after)2.987 F(itself and e)108 345.6 Q +(xit, send it an interrupt signal \(SIGINT\).)-.15 E(The)108 362.4 Q F3 +(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F1(utility e)2.5 E +(xits 0 on success, and >0 if an error occurs.)-.15 E F0(ENVIR)72 379.2 +Q(ONMENT V)-.27 E(ARIABLES)-1.215 E F1(The follo)108 391.2 Q(wing en) +-.25 E(vironment v)-.4 E(ariables af)-.25 E(fect the e)-.25 E -.15(xe) +-.15 G(cution of).15 E F3(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F1(:).68 E +(DB_HOME)108 408 Q .222(If the)133 420 R F22.722 E F1 .222 +(option is not speci\214ed and the en)2.722 F .222(vironment v)-.4 F +(ariable)-.25 E F3(DB_HOME)2.722 E F1 .221 +(is set, it is used as the path)2.721 F +(of the database home, as described in)133 432 Q F3(db_appinit)2.5 E F1 +(\(3\).).68 E F0(SEE ALSO)72 448.8 Q F1 .485(The DB library is a f)108 +460.8 R .485(amily of groups of functions that pro)-.1 F .486 +(vides a modular programming interf)-.15 F .486(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 472.8 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .506(\214le page caching, as well as v)108 484.8 R .506 +(arious inde)-.25 F -.15(xe)-.15 G 3.006(da).15 G .506(ccess methods.) +-3.006 F(Man)5.507 E 3.007(yo)-.15 G 3.007(ft)-3.007 G .507 +(he functional groups \(e.g., the \214le)-3.007 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 496.8 R .121(are e)108 508.8 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.122 G 2.622(rag).15 G .122(eneral description of)-2.622 +F(the DB package, see)108 520.8 Q F3(db_intr)2.5 E(o)-.45 E F1(\(3\).) +.18 E F3(db_ar)108 537.6 Q -.15(ch)-.37 G(ive).15 E F1(\(1\),).18 E F3 +(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F1(\(1\),).68 E F3(db_deadloc)2.5 E +(k)-.2 E F1(\(1\),).67 E F3(db_dump)2.5 E F1(\(1\),).19 E F3(db_load)2.5 +E F1(\(1\),).77 E F3(db_r)2.5 E(eco)-.37 E(ver)-.1 E F1(\(1\),).73 E F3 +(db_stat)2.5 E F1(\(1\),).68 E F3(db_intr)108 549.6 Q(o)-.45 E F1 +(\(3\),).18 E F3(db_appinit)2.5 E F1(\(3\),).68 E F3(db_cur)2.5 E(sor) +-.1 E F1(\(3\),).73 E F3(db_dbm)2.5 E F1(\(3\),).32 E F3(db_internal)2.5 +E F1(\(3\),).51 E F3(db_loc)2.5 E(k)-.2 E F1(\(3\),).67 E F3(db_lo)2.5 E +(g)-.1 E F1(\(3\),).22 E F3(db_mpool)2.5 E F1(\(3\),).51 E F3(db_open) +108 561.6 Q F1(\(3\),).24 E F3(db_thr)2.5 E(ead)-.37 E F1(\(3\),).77 E +F3(db_txn)2.5 E F1(\(3\)).24 E(1)535 768 Q EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/mancxx.ps/db_deadlock.ps b/mozilla/db/man/mancxx.ps/db_deadlock.ps new file mode 100644 index 00000000000..ca8b8eb4511 --- /dev/null +++ b/mozilla/db/man/mancxx.ps/db_deadlock.ps @@ -0,0 +1,286 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:32 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 1 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_deadlock \255 the DB database deadlock detector)108 40.8 Q F0 +(SYNOPSIS)72 57.6 Q/F2 10/Times-Bold@0 SF(db_deadlock)108 69.6 Q F1([) +2.5 E F2(-vw)A F1 2.5(][)C F2(-a m | o | y)-2.5 E F1 2.5(][)C F2 +(-h home)-2.5 E F1 2.5(][)C F2(-L \214le)-2.5 E F1 2.5(][)2.5 G F2 +(-t sec)-2.5 E F1(])2.5 E F0(DESCRIPTION)72 86.4 Q F1(The)108 98.4 Q/F3 +10/Times-Italic@0 SF(db_deadloc)2.665 E(k)-.2 E F1 .165(utility tra) +2.665 F -.15(ve)-.2 G .165(rses the database lock structures and aborts a transaction each time it detects a) +.15 F 3.239(deadlock. This)108 110.4 R .739 +(utility should be run as a background daemon whene)3.239 F -.15(ve)-.25 +G 3.24(rm).15 G .74(ultiple threads or processes are)-3.24 F +(using locking.)108 122.4 Q(By def)5 E(ault, a random transaction in)-.1 +E -.2(vo)-.4 G(lv).2 E(ed in the deadlock is aborted.)-.15 E +(The options are as follo)108 139.2 Q(ws:)-.25 E F2108 156 Q F1 +.858(When a deadlock is detected, abort the oldest \(`)14.3 F(`o')-.74 E +.858('\) transaction, the youngest \(`)-.74 F(`y')-.74 E .857 +('\) transaction, or)-.74 F +(the transaction with the minimum number of locks \(`)133 168 Q(`m')-.74 +E('\).)-.74 E F2108 184.8 Q F1 +(Specify a home directory for the database.)13.74 E F2108 201.6 Q +F1 1.765(Log the e)12.63 F -.15(xe)-.15 G 1.765(cution of the db_deadlock utility to the speci\214ed \214le in the follo) +.15 F 1.766(wing format, where)-.25 F -.74(``)133 213.6 S(###').74 E 2.5 +('i)-.74 G 2.5(st)-2.5 G +(he process ID, and the date is the time the utility starting running.) +-2.5 E(db_deadlock: ### W)133 237.6 Q(ed Jun 15 01:23:45 EDT 1995)-.8 E +(This \214le will be remo)133 261.6 Q -.15(ve)-.15 G 2.5(di).15 G 2.5 +(ft)-2.5 G(he db_deadlock utility e)-2.5 E(xits gracefully)-.15 E(.)-.65 +E F2108 278.4 Q F1(Initiate a pass o)15.97 E -.15(ve)-.15 G 2.5 +(rt).15 G(he database locks at least e)-2.5 E -.15(ve)-.25 G(ry).15 E F3 +(sec)2.5 E F1(seconds.)2.5 E F2108 295.2 Q F1(Run in v)14.3 E +(erbose mode, generating messages each time the detector runs.)-.15 E F2 +108 312 Q F1(Mak)12.08 E 2.5(eas)-.1 G(ingle pass o)-2.5 E -.15 +(ve)-.15 G 2.5(rt).15 G(he database locks e)-2.5 E -.15(ve)-.25 G +(ry time a process is forced to w).15 E(ait for a lock.)-.1 E +(At least one of the)108 328.8 Q F2(-t)2.5 E F1(and)2.5 E F2(-w)2.5 E F1 +(options must be speci\214ed.)2.5 E(The)108 345.6 Q F3(db_deadloc)3.994 +E(k)-.2 E F1 1.494(utility attaches to DB shared memory re)3.994 F 3.993 +(gions. In)-.15 F 1.493(order to a)3.993 F -.2(vo)-.2 G 1.493(id re).2 F +1.493(gion corruption, it)-.15 F .902(should al)108 357.6 R -.1(wa)-.1 G +.902(ys be gi).1 F -.15(ve)-.25 G 3.402(nt).15 G .902 +(he chance to detach and e)-3.402 F .902(xit gracefully)-.15 F 5.902(.T) +-.65 G 3.403(oc)-6.702 G(ause)-3.403 E F3(db_deadloc)3.403 E(k)-.2 E F1 +.903(to clean up after)3.403 F(itself and e)108 369.6 Q +(xit, send it an interrupt signal \(SIGINT\).)-.15 E(The)108 386.4 Q F3 +(db_deadloc)2.5 E(k)-.2 E F1(utility e)2.5 E +(xits 0 on success, and >0 if an error occurs.)-.15 E F0(ENVIR)72 403.2 +Q(ONMENT V)-.27 E(ARIABLES)-1.215 E F1(The follo)108 415.2 Q(wing en) +-.25 E(vironment v)-.4 E(ariables af)-.25 E(fect the e)-.25 E -.15(xe) +-.15 G(cution of).15 E F3(db_deadloc)2.5 E(k)-.2 E F1(:).67 E(DB_HOME) +108 432 Q .222(If the)133 444 R F22.722 E F1 .222 +(option is not speci\214ed and the en)2.722 F .222(vironment v)-.4 F +(ariable)-.25 E F3(DB_HOME)2.722 E F1 .221 +(is set, it is used as the path)2.721 F +(of the database home, as described in)133 456 Q F3(db_appinit)2.5 E F1 +(\(3\).).68 E F0(SEE ALSO)72 472.8 Q F1 .485(The DB library is a f)108 +484.8 R .485(amily of groups of functions that pro)-.1 F .486 +(vides a modular programming interf)-.15 F .486(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 496.8 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .506(\214le page caching, as well as v)108 508.8 R .506 +(arious inde)-.25 F -.15(xe)-.15 G 3.006(da).15 G .506(ccess methods.) +-3.006 F(Man)5.507 E 3.007(yo)-.15 G 3.007(ft)-3.007 G .507 +(he functional groups \(e.g., the \214le)-3.007 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 520.8 R .121(are e)108 532.8 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.122 G 2.622(rag).15 G .122(eneral description of)-2.622 +F(the DB package, see)108 544.8 Q F3(db_intr)2.5 E(o)-.45 E F1(\(3\).) +.18 E F3(db_ar)108 561.6 Q -.15(ch)-.37 G(ive).15 E F1(\(1\),).18 E F3 +(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F1(\(1\),).68 E F3(db_deadloc)2.5 E +(k)-.2 E F1(\(1\),).67 E F3(db_dump)2.5 E F1(\(1\),).19 E F3(db_load)2.5 +E F1(\(1\),).77 E F3(db_r)2.5 E(eco)-.37 E(ver)-.1 E F1(\(1\),).73 E F3 +(db_stat)2.5 E F1(\(1\),).68 E F3(db_intr)108 573.6 Q(o)-.45 E F1 +(\(3\),).18 E F3(db_appinit)2.5 E F1(\(3\),).68 E F3(db_cur)2.5 E(sor) +-.1 E F1(\(3\),).73 E F3(db_dbm)2.5 E F1(\(3\),).32 E F3(db_internal)2.5 +E F1(\(3\),).51 E F3(db_loc)2.5 E(k)-.2 E F1(\(3\),).67 E F3(db_lo)2.5 E +(g)-.1 E F1(\(3\),).22 E F3(db_mpool)2.5 E F1(\(3\),).51 E F3(db_open) +108 585.6 Q F1(\(3\),).24 E F3(db_thr)2.5 E(ead)-.37 E F1(\(3\),).77 E +F3(db_txn)2.5 E F1(\(3\)).24 E(1)535 768 Q EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/mancxx.ps/db_dump.ps b/mozilla/db/man/mancxx.ps/db_dump.ps new file mode 100644 index 00000000000..1866e229f70 --- /dev/null +++ b/mozilla/db/man/mancxx.ps/db_dump.ps @@ -0,0 +1,374 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:32 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 2 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_dump \255 the DB database dump utility)108 40.8 Q F0(SYNOPSIS)72 +57.6 Q/F2 10/Times-Bold@0 SF(db_dump)108 69.6 Q F1([)2.5 E F2(-d)A F1 +2.5(][)C F2(-f output)-2.5 E F1 2.5(]d)C(b_\214le)-2.5 E F2(db_dump)108 +81.6 Q F1([)2.5 E F2(-p)A F1 2.5(][)C F2(-f output)-2.5 E F1 2.5(][)C F2 +(-h home)-2.5 E F1 2.5(]d)C(b_\214le)-2.5 E F2(db_dump185)108 93.6 Q F1 +([)2.5 E F2(-p)A F1 2.5(][)C F2(-f output)-2.5 E F1 2.5(]d)C(b_\214le) +-2.5 E F0(DESCRIPTION)72 110.4 Q F1(The)108 122.4 Q/F3 10/Times-Italic@0 +SF(db_dump)2.707 E F1 .206(utility reads the database \214le)2.707 F F3 +(db_\214le)2.706 E F1 .206 +(and writes it to the standard output using a portable \215at-)2.706 F +(te)108 134.4 Q .8(xt format understood by the)-.15 F F3(db_load)3.3 E +F1 .8(\(1\) utility).77 F 5.8(.T)-.65 G .8(he ar)-5.8 F(gument)-.18 E F3 +(db_\214le)3.3 E F1 .8(must be a \214le produced using the)3.3 F F3(DB) +108 146.4 Q F1(library functions.)2.5 E(The)108 163.2 Q F3(db_dump185) +3.168 E F1 .667(utility is similar to the)3.167 F F3(db_dump)3.167 E F1 +.667(utility e)3.167 F .667 +(xcept that it reads databases in the format used)-.15 F(by DB v)108 +175.2 Q(ersions 1.85 and 1.86.)-.15 E(The options are as follo)108 192 Q +(ws:)-.25 E F2108 208.8 Q F1 .427 +(Dump the speci\214ed database in a format helpful for deb)13.74 F .428 +(ugging the DB library routines.)-.2 F F2 .428(The output)5.428 F -.25 +(fo)133 220.8 S .075(rmat of the \255d option is not standard and may change, without notice, between r) +.25 F .075(eleases of the)-.18 F(DB library)133 232.8 Q(.)-.7 E108 +249.6 Q F1(Write to the speci\214ed)15.97 E F3(\214le)2.5 E F1 +(instead of to the standard output.)2.5 E F2108 266.4 Q F1 .261 +(Specify a home directory for the database.)13.74 F .262(As DB v)5.262 F +.262(ersions before 2.0 did not support the concept of)-.15 F 2.5(ad)133 +278.4 S(atabase `)-2.5 E(`home')-.74 E(',)-.74 E F3(db_dump185)2.5 E F1 +(does not support this option.)2.5 E F2108 295.2 Q F1 1.442 +(If characters in either the k)13.74 F 1.741 -.15(ey o)-.1 H 3.941(rd) +.15 G 1.441(ata items are printing characters \(as de\214ned by)-3.941 F +F3(isprint)3.941 E F1 1.441(\(3\)\), use).68 F .415 +(printing characters in)133 307.2 R F3(\214le)2.915 E F1 .415 +(to represent them.)2.915 F .415 +(This option permits users to use standard te)5.415 F .415 +(xt editors to)-.15 F(modify the contents of databases.)133 319.2 Q +2.969(Note, dif)133 336 R 2.969(ferent systems may ha)-.25 F 3.269 -.15 +(ve d)-.2 H(if).15 E 2.968(ferent notions as to what characters are `) +-.25 F(`printing')-.74 E 2.968(', and)-.74 F +(databases dumped in this manner may be less portable to e)133 348 Q +(xternal systems.)-.15 E 1.211 +(Dumping and reloading hash databases that use user)108 364.8 R 1.212 +(-de\214ned hash functions will result in ne)-.2 F 3.712(wd)-.25 G +(atabases)-3.712 E .788(that use the def)108 376.8 R .788 +(ault hash function.)-.1 F .787(While using the def)5.787 F .787 +(ault hash function may not be optimal for the ne)-.1 F(w)-.25 E +(database, it will continue to w)108 388.8 Q(ork correctly)-.1 E(.)-.65 +E .717(Dumping and reloading btree databases that use user)108 405.6 R +.717(-de\214ned pre\214x or comparison functions will result in)-.2 F +(ne)108 417.6 Q 2.716(wd)-.25 G .216(atabases that use the def)-2.716 F +.216(ault pre\214x and comparison functions.)-.1 F F2 .215 +(In this case, it is quite lik)5.216 F .215(ely that the)-.1 F +(database will be damaged bey)108 429.6 Q(ond r)-.25 E +(epair permitting neither r)-.18 E(ecord storage or r)-.18 E(etrie)-.18 +E -.1(va)-.15 G(l.).1 E F1 .133(The only a)108 446.4 R -.25(va)-.2 G +.133(ilable w).25 F .133 +(orkaround for either case is to modify the sources for the)-.1 F F3 +(db_load)2.634 E F1 .134(\(1\) utility to load the).77 F +(database using the correct hash, pre\214x and comparison functions.)108 +458.4 Q(The)108 475.2 Q F3(db_dump185)3.698 E F1 1.198 +(utility may not be a)3.698 F -.25(va)-.2 G 1.198 +(ilable on your system as it is not al).25 F -.1(wa)-.1 G 1.197 +(ys installed when the DB).1 F 1.068 +(libraries and utilities are installed.)108 487.2 R 1.069(If you are unable to \214nd it, see your system administrator for further) +6.069 F(information.)108 499.2 Q(The)108 516 Q F3(db_dump)2.941 E F1 +.441(utility e)2.941 F .441 +(xits 0 on success, and >0 if an error occurs.)-.15 F(The)5.44 E F3 +(db_dump185)2.94 E F1 .44(utility e)2.94 F .44(xits 0 on suc-)-.15 F +(cess, and >0 if an error occurs.)108 528 Q F0(OUTPUT FORMA)72 544.8 Q +(TS)-.855 E F1(There are tw)108 556.8 Q 2.5(oo)-.1 G +(utput formats used by)-2.5 E F3(db_dump)2.5 E F1(and)2.5 E F3 +(db_dump185)2.5 E F1(.).41 E .543 +(In both output formats, the \214rst fe)108 573.6 R 3.043(wl)-.25 G .543 +(ines of the output contain header information describing the underly-) +-3.043 F .53(ing access method, \214lesystem page size and other bookk) +108 585.6 R .529(eeping information.)-.1 F .529 +(This information is output in)5.529 F -.74(``)108 597.6 S(name=v).74 E +(alue')-.25 E 3.59('p)-.74 G 1.09(airs, where `)-3.59 F(`name')-.74 E +3.59('m)-.74 G 1.09(ay be an)-3.59 F 3.59(yo)-.15 G 3.59(ft)-3.59 G 1.09 +(he k)-3.59 F -.15(ey)-.1 G -.1(wo).15 G 1.09(rds listed in the).1 F F3 +(db_load)3.59 E F1 1.09(\(1\) manual page,).77 F .273(and `)108 609.6 R +(`v)-.74 E(alue')-.25 E 2.773('w)-.74 G .273(ill be its v)-2.773 F 2.773 +(alue. While)-.25 F .273 +(this header information can be edited before the database is reloaded,) +2.773 F .196(there is rarely an)108 621.6 R 2.696(yr)-.15 G .197 +(eason to do so, as all of this information can be o)-2.696 F -.15(ve) +-.15 G .197(rridden by command-line ar).15 F(guments)-.18 E(to)108 633.6 +Q F3(db_load)2.5 E F1(.).77 E -.15(Fo)108 650.4 S(llo).15 E .137 +(wing the header information are the k)-.25 F -.15(ey)-.1 G .136 +(/data pairs from the database.).15 F .136 +(If the database being dumped is)5.136 F .307(of type)108 662.4 R F2 +(btr)2.807 E(ee)-.18 E F1(or)2.807 E F2(hash)2.807 E F1 2.807(,t)C .307 +(he output will be paired lines of te)-2.807 F .308 +(xt, where the \214rst line of the pair is the k)-.15 F .608 -.15(ey i) +-.1 H(tem,).15 E 1.381 +(and the second line of the pair is its corresponding data item.)108 +674.4 R 1.38(If the database being dumped is of type)6.38 F F2 -.18(re) +108 686.4 S(cno).18 E F1 2.5(,t)C(he output will be lines of te)-2.5 E +(xt, where each line is a ne)-.15 E 2.5(wd)-.25 G +(ata item for the database.)-2.5 E .223(If the)108 703.2 R F22.723 +E F1 .223(option w)2.723 F .224(as speci\214ed, each output line will consist of single characters representing an) +-.1 F 2.724(yc)-.15 G(haracters)-2.724 E 1.702 +(from the database that were `)108 715.2 R(`printing')-.74 E 1.702 +(', and backslash \(`)-.74 F(`\\')-.74 E 1.702 +('\) escaped characters for an)-.74 F 4.202(yt)-.15 G 1.702 +(hat were not.)-4.202 F .869 +(Backslash characters appearing in the output mean one of tw)108 727.2 R +3.369(ot)-.1 G .87(hings: if the backslash character precedes)-3.369 F +(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 346.62(DB_DUMP\(1\) DB_DUMP\(1\))72 48 R .523 +(another backslash character)108 84 R 3.023(,i)-.4 G 3.023(tm)-3.023 G +.523(eans that a literal backslash character occurred in the k)-3.023 F +.823 -.15(ey o)-.1 H 3.023(rd).15 G .523(ata item.)-3.023 F(If)5.522 E +.54(the backslash character precedes an)108 96 R 3.04(yo)-.15 G .54 +(ther character)-3.04 F 3.04(,t)-.4 G .54(he ne)-3.04 F .54(xt tw)-.15 F +3.04(oc)-.1 G .54(haracters should be interpreted as he)-3.04 F(x-)-.15 +E(adecimal speci\214cation of a single character)108 108 Q 2.5(,e)-.4 G +(.g., `)-2.5 E(`\\0a')-.74 E 2.5('i)-.74 G 2.5(san)-2.5 G -.25(ew)-2.5 G +(line character in the ASCII character set.).25 E .397(If the)108 124.8 +R/F1 10/Times-Bold@0 SF2.897 E F0 .396(option w)2.896 F .396 +(as not speci\214ed, each output line will consist of paired he)-.1 F +.396(xadecimal v)-.15 F .396(alues, e.g., the line)-.25 F -.74(``)108 +136.8 S(726f6f74').74 E 2.5('i)-.74 G 2.5(st)-2.5 G(he string `)-2.5 E +(`root')-.74 E 2.5('i)-.74 G 2.5(nt)-2.5 G(he ASCII character set.)-2.5 +E(In both output formats, a single ne)108 153.6 Q +(wline character ends both the k)-.25 E .3 -.15(ey a)-.1 H +(nd data items.).15 E/F2 9/Times-Bold@0 SF(ENVIR)72 170.4 Q(ONMENT V) +-.27 E(ARIABLES)-1.215 E F0(The follo)108 182.4 Q(wing en)-.25 E +(vironment v)-.4 E(ariables af)-.25 E(fect the e)-.25 E -.15(xe)-.15 G +(cution of).15 E/F3 10/Times-Italic@0 SF(db_dump)2.5 E F0(:).19 E +(DB_HOME)108 199.2 Q .221(If the)133 211.2 R F12.721 E F0 .221 +(option is not speci\214ed and the en)2.721 F .222(vironment v)-.4 F +(ariable)-.25 E F3(DB_HOME)2.722 E F0 .222 +(is set, it is used as the path)2.722 F +(of the database home, as described in)133 223.2 Q F3(db_appinit)2.5 E +F0(\(3\).).68 E F2(SEE ALSO)72 240 Q F3(isprint)108 252 Q F0(\(3\)).68 E +.486(The DB library is a f)108 268.8 R .485 +(amily of groups of functions that pro)-.1 F .485 +(vides a modular programming interf)-.15 F .485(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 280.8 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .507(\214le page caching, as well as v)108 292.8 R .507 +(arious inde)-.25 F -.15(xe)-.15 G 3.007(da).15 G .506(ccess methods.) +-3.007 F(Man)5.506 E 3.006(yo)-.15 G 3.006(ft)-3.006 G .506 +(he functional groups \(e.g., the \214le)-3.006 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 304.8 R .122(are e)108 316.8 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.121 G 2.621(rag).15 G .121(eneral description of)-2.621 +F(the DB package, see)108 328.8 Q F3(db_intr)2.5 E(o)-.45 E F0(\(3\).) +.18 E F3(db_ar)108 345.6 Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E F3 +(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F0(\(1\),).68 E F3(db_deadloc)2.5 E +(k)-.2 E F0(\(1\),).67 E F3(db_dump)2.5 E F0(\(1\),).19 E F3(db_load)2.5 +E F0(\(1\),).77 E F3(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F3 +(db_stat)2.5 E F0(\(1\),).68 E F3(db_intr)108 357.6 Q(o)-.45 E F0 +(\(3\),).18 E F3(db_appinit)2.5 E F0(\(3\),).68 E F3(db_cur)2.5 E(sor) +-.1 E F0(\(3\),).73 E F3(db_dbm)2.5 E F0(\(3\),).32 E F3(db_internal)2.5 +E F0(\(3\),).51 E F3(db_loc)2.5 E(k)-.2 E F0(\(3\),).67 E F3(db_lo)2.5 E +(g)-.1 E F0(\(3\),).22 E F3(db_mpool)2.5 E F0(\(3\),).51 E F3(db_open) +108 369.6 Q F0(\(3\),).24 E F3(db_thr)2.5 E(ead)-.37 E F0(\(3\),).77 E +F3(db_txn)2.5 E F0(\(3\)).24 E(April 10, 1998)276.695 768 Q(2)199.695 E +EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/mancxx.ps/db_load.ps b/mozilla/db/man/mancxx.ps/db_load.ps new file mode 100644 index 00000000000..eb6ea19f12b --- /dev/null +++ b/mozilla/db/man/mancxx.ps/db_load.ps @@ -0,0 +1,393 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Tue Jun 2 21:30:11 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 3 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_load \255 the DB database loader)108 40.8 Q F0(SYNOPSIS)72 57.6 Q/F2 +10/Times-Bold@0 SF(db_load)108 69.6 Q F1([)2.5 E F2(-nT)A F1 2.5(][)C F2 +(-c name=v)-2.5 E(alue)-.1 E F1(])A([)158 81.6 Q F2(-f \214le)A F1 2.5 +(][)C F2(-h home)-2.5 E F1 2.5(][)C F2(-t btr)-2.5 E(ee | hash | r)-.18 +E(ecno)-.18 E F1 2.5(]d)C(b_\214le)-2.5 E F0(DESCRIPTION)72 98.4 Q F1 +(The)108 110.4 Q/F3 10/Times-Italic@0 SF(db_load)4.18 E F1 1.679 +(utility reads from the standard input and loads it into the database) +4.18 F F3(db_\214le)4.179 E F1 6.679(.T).18 G 1.679(he database)-6.679 F +F3(db_\214le)108 122.4 Q F1(is created if it does not already e)2.5 E +(xist.)-.15 E .592(The input to)108 139.2 R F3(db_load)3.092 E F1 .592 +(must be in the output format speci\214ed by the)3.092 F F3(db_dump) +3.093 E F1(or)3.093 E F3(db_dump185)3.093 E F1 .593(utilities \(see) +3.093 F F3(db_dump)108 151.2 Q F1 +(\(1\) for more information\), or as speci\214ed for the).19 E F2 +2.5 E F1(option belo)2.5 E -.65(w.)-.25 G(The options are as follo)108 +168 Q(ws:)-.25 E F2108 184.8 Q F1 .081 +(Specify con\214guration options for the DB_INFO structure pro)14.86 F +.081(vided to)-.15 F F3(db_open)2.581 E F1 .081(\(3\), ignoring an).24 F +2.58(yv)-.15 G(alue)-2.83 E(the)133 196.8 Q 5.86(ym)-.15 G 3.36(ay ha) +-5.86 F 3.66 -.15(ve b)-.2 H 3.36(ased on the input.).15 F 3.36 +(The command-line format is `)8.36 F(`name=v)-.74 E(alue')-.25 E 5.86 +('. Supported)-.74 F -.1(ke)133 208.8 S(yw)-.05 E(ords are listed belo) +-.1 E -.65(w.)-.25 G F2108 225.6 Q F1(Read from the speci\214ed) +15.97 E F3(input)2.5 E F1(\214le instead of from the standard input.)2.5 +E F2108 242.4 Q F1(Specify a home directory for the database.) +13.74 E 1.579(If a home directory is speci\214ed, the database en)133 +266.4 R 1.578(vironment is opened using the DB_INIT_LOCK,)-.4 F 8.463 +(DB_INIT_LOG, DB_INIT_MPOOL, DB_INIT_TXN and DB_USE_ENVIR)133 278.4 R +8.464(ON \215ags to)-.4 F F3(db_appinit)133 290.4 Q F1 3.464 +(\(3\). \(This).68 F .963(means that)3.464 F F3(db_load)3.463 E F1 .963 +(can be used to load data into databases while the)3.463 F 3.463(ya)-.15 +G .963(re in)-3.463 F .209(use by other processes.\))133 302.4 R .209 +(If the)5.209 F F3(db_appinit)2.709 E F1 .209(call f)2.709 F .21 +(ails, or if no home directory is speci\214ed, the database)-.1 F +(is still updated, b)133 314.4 Q(ut the en)-.2 E +(vironment is ignored, e.g., no locking is done.)-.4 E F2108 331.2 +Q F1 .739(Do not o)13.74 F -.15(ve)-.15 G .738(rwrite e).15 F .738 +(xisting k)-.15 F -.15(ey)-.1 G 3.238(si).15 G 3.238(nt)-3.238 G .738 +(he database when loading into an already e)-3.238 F .738 +(xisting database.)-.15 F .738(If a)5.738 F -.1(ke)133 343.2 S .759 +(y/data pair cannot be loaded into the database for this reason, a w) +-.05 F .76(arning message is displayed on)-.1 F +(the standard error output and the k)133 355.2 Q -.15(ey)-.1 G +(/data pair are skipped.).15 E F2108 372 Q F1(The)12.63 E F2 +2.5 E F1(option allo)2.5 E(ws non-DB applications to easily load te)-.25 +E(xt \214les into databases.)-.15 E .102 +(If the database to be created is of type)133 396 R F2(btr)2.602 E(ee) +-.18 E F1(or)2.601 E F2(hash)2.601 E F1 2.601(,t)C .101 +(he input must be paired lines of te)-2.601 F .101(xt, where the)-.15 F +.453(\214rst line of the pair is the k)133 408 R .753 -.15(ey i)-.1 H +.453 +(tem, and the second line of the pair is its corresponding data item.) +.15 F(If)5.454 E .564(the database to be created is of type)133 420 R F2 +-.18(re)3.063 G(cno).18 E F1 3.063(,t)C .563 +(he input must be lines of te)-3.063 F .563(xt, where each line is a ne) +-.15 F(w)-.25 E(data item for the database.)133 432 Q 2.933(As)133 456 S +.433(imple escape mechanism, where ne)-2.933 F .434 +(wline and backslash \(`)-.25 F(`\\')-.74 E .434 +('\) characters are special, is applied to)-.74 F .9(the te)133 468 R .9 +(xt input.)-.15 F(Ne)5.9 E .899 +(wline characters are interpreted as record separators.)-.25 F .899 +(Backslash characters in the)5.899 F(te)133 480 Q 1.33 +(xt will be interpreted in one of tw)-.15 F 3.83(ow)-.1 G 1.33 +(ays: if the backslash character precedes another backslash)-3.93 F +(character)133 492 Q 3.235(,t)-.4 G .735 +(he pair will be interpreted as a literal backslash.)-3.235 F .734 +(If the backslash character precedes an)5.735 F(y)-.15 E .103 +(other character)133 504 R 2.603(,t)-.4 G .103(he tw)-2.603 F 2.603(oc) +-.1 G .103(haracters follo)-2.603 F .103 +(wing the backslash will be interpreted as he)-.25 F .104 +(xadecimal speci\214-)-.15 F(cation of a single character)133 516 Q 2.5 +(,e)-.4 G(.g., `)-2.5 E(`\\0a')-.74 E 2.5('i)-.74 G 2.5(san)-2.5 G -.25 +(ew)-2.5 G(line character in the ASCII character set.).25 E -.15(Fo)133 +540 S 3.732(rt).15 G 1.232(his reason, an)-3.732 F 3.732(yb)-.15 G 1.232 +(ackslash or ne)-3.732 F 1.232 +(wline characters that naturally occur in the te)-.25 F 1.231 +(xt input must be)-.15 F(escaped to a)133 552 Q -.2(vo)-.2 G +(id misinterpretation by).2 E F3(db_load)2.5 E F1(.).77 E 1.862(If the) +133 576 R F24.362 E F1 1.863(option is speci\214ed, the underlying access method type must be speci\214ed using the) +4.362 F F24.363 E F1(option.)133 588 Q F2108 604.8 Q F1 .211 +(Specify the underlying access method.)15.97 F .211(If no)5.211 F F2 +2.711 E F1 .21 +(option is speci\214ed, the database will be loaded into a)2.711 F .078 +(database of the same type as w)133 616.8 R .078 +(as dumped, e.g., a hash database will be created if a hash database w) +-.1 F(as)-.1 E(dumped.)133 628.8 Q .368 +(Btree and hash databases may be con)133 652.8 R -.15(ve)-.4 G .368 +(rted from one to the other).15 F 5.367(.R)-.55 G .367 +(ecno databases may not be con-)-5.367 F -.15(ve)133 664.8 S(rted to an) +.15 E 2.5(yo)-.15 G(ther database type or from an)-2.5 E 2.5(yo)-.15 G +(ther database type.)-2.5 E(The)108 681.6 Q F3(db_load)3.418 E F1 .919 +(utility e)3.419 F .919(xits 0 on success, 1 if one or more k)-.15 F +-.15(ey)-.1 G .919(/data pairs were not loaded into the database).15 F +(because the k)108 693.6 Q .3 -.15(ey a)-.1 H(lready e).15 E +(xisted, and >1 if an error occurs.)-.15 E(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DB_LO)72 48 Q 349.56(AD\(1\) DB_LO)-.35 F +(AD\(1\))-.35 E/F1 9/Times-Bold@0 SF(KEYW)72 84 Q(ORDS)-.09 E F0 .165 +(The follo)108 96 R .165(wing k)-.25 F -.15(ey)-.1 G -.1(wo).15 G .165 +(rds are supported for the).1 F/F2 10/Times-Bold@0 SF2.664 E F0 +.164(command-line option.)2.664 F(See)5.164 E/F3 10/Times-Italic@0 SF +(db_open)2.664 E F0 .164(\(3\) for further discus-).24 F +(sion of these k)108 108 Q -.15(ey)-.1 G -.1(wo).15 G(rds and what v).1 +E(alues should be speci\214ed.)-.25 E .411 +(The parenthetical listing speci\214es ho)108 124.8 R 2.911(wt)-.25 G +.411(he v)-2.911 F .411(alue part of the `)-.25 F(`name=v)-.74 E(alue') +-.25 E 2.912('p)-.74 G .412(air is interpreted.)-2.912 F .412 +(Items listed)5.412 F .375(as \(boolean\) e)108 136.8 R .375(xpect v) +-.15 F .374(alue to be `)-.25 F(`1')-.74 E 2.874('\()-.74 G .374 +(set\) or `)-2.874 F(`0')-.74 E 2.874('\()-.74 G 2.874(unset\). Items) +-2.874 F .374(listed as \(number\) con)2.874 F -.15(ve)-.4 G .374(rt v) +.15 F .374(alue to a num-)-.25 F(ber)108 148.8 Q 5(.I)-.55 G +(tems listed as \(string\) use the characters of v)-5 E(alue directly) +-.25 E(.)-.65 E(bt_mink)108 165.6 Q .3 -.15(ey \()-.1 H(number\)).15 E +(The minimum number of k)133 177.6 Q -.15(ey)-.1 G 2.5(sp).15 G +(er page.)-2.5 E(db_lorder \(number\))108 194.4 Q +(The byte order for inte)133 206.4 Q +(gers in the stored database metadata.)-.15 E(db_pagesize \(number\))108 +223.2 Q(The size of pages used for nodes in the tree, in bytes.)133 +235.2 Q(duplicates \(boolean\))108 252 Q(The v)133 264 Q +(alue of the DB_DUP \215ag.)-.25 E(h_f)108 280.8 Q -.1(fa)-.25 G +(ctor \(number\)).1 E(The density within the hash table.)133 292.8 Q +(h_nelem \(number\))108 309.6 Q(The size of the hash table.)133 321.6 Q +(re_len \(number\))108 338.4 Q(Specify \214x)133 350.4 Q +(ed-length records of the speci\214ed length.)-.15 E(re_pad \(string\)) +108 367.2 Q(Specify the \214x)133 379.2 Q +(ed-length record pad character)-.15 E(.)-.55 E(recnum \(boolean\))108 +396 Q(The v)133 408 Q(alue of the DB_RECNUM \215ag.)-.25 E +(renumber \(boolean\))108 424.8 Q(The v)133 436.8 Q +(alue of the DB_RENUMBER \215ag.)-.25 E F1(EXAMPLES)72 453.6 Q F0(The) +108 465.6 Q F3(db_load)3.903 E F0 1.403(utility can be used to load te) +3.903 F 1.403(xt \214les into databases.)-.15 F -.15(Fo)6.403 G 3.903 +(re).15 G 1.403(xample, the follo)-4.053 F 1.404(wing command)-.25 F +.093(loads the standard UNIX)108 477.6 R F3(/etc/passwd)2.592 E F0 .092 +(\214le into a database, with the login name as the k)2.592 F .392 -.15 +(ey i)-.1 H .092(tem and the entire).15 F(passw)108 489.6 Q +(ord entry as the data item:)-.1 E -.15(aw)144 501.6 S 2.5(k-).15 G +(F: '{print $1; print $0}' < /etc/passwd |)-2.5 E(sed ')154 513.6 Q +(s/\\\\/\\\\\\\\/g' | db_load -T -t hash passwd.db)-.55 E .64 +(Note that backslash characters naturally occurring in the te)108 530.4 +R .641(xt are escaped to a)-.15 F -.2(vo)-.2 G .641 +(id interpretation as escape).2 F(characters by)108 542.4 Q F3(db_load) +2.5 E F0(.).77 E F1(ENVIR)72 559.2 Q(ONMENT V)-.27 E(ARIABLES)-1.215 E +F0(The follo)108 571.2 Q(wing en)-.25 E(vironment v)-.4 E(ariables af) +-.25 E(fect the e)-.25 E -.15(xe)-.15 G(cution of).15 E F3(db_load)2.5 E +F0(:).77 E(DB_HOME)108 588 Q .222(If the)133 600 R F22.722 E F0 +.222(option is not speci\214ed and the en)2.722 F .222(vironment v)-.4 F +(ariable)-.25 E F3(DB_HOME)2.722 E F0 .221 +(is set, it is used as the path)2.721 F +(of the database home, as described in)133 612 Q F3(db_appinit)2.5 E F0 +(\(3\).).68 E F1(SEE ALSO)72 628.8 Q F0 .485(The DB library is a f)108 +640.8 R .485(amily of groups of functions that pro)-.1 F .486 +(vides a modular programming interf)-.15 F .486(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 652.8 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .506(\214le page caching, as well as v)108 664.8 R .506 +(arious inde)-.25 F -.15(xe)-.15 G 3.006(da).15 G .506(ccess methods.) +-3.006 F(Man)5.507 E 3.007(yo)-.15 G 3.007(ft)-3.007 G .507 +(he functional groups \(e.g., the \214le)-3.007 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 676.8 R .121(are e)108 688.8 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.122 G 2.622(rag).15 G .122(eneral description of)-2.622 +F(the DB package, see)108 700.8 Q F3(db_intr)2.5 E(o)-.45 E F0(\(3\).) +.18 E F3(db_ar)108 717.6 Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E F3 +(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F0(\(1\),).68 E F3(db_deadloc)2.5 E +(k)-.2 E F0(\(1\),).67 E F3(db_dump)2.5 E F0(\(1\),).19 E F3(db_load)2.5 +E F0(\(1\),).77 E F3(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F3 +(db_stat)2.5 E F0(\(1\),).68 E F3(db_intr)108 729.6 Q(o)-.45 E F0 +(\(3\),).18 E F3(db_appinit)2.5 E F0(\(3\),).68 E F3(db_cur)2.5 E(sor) +-.1 E F0(\(3\),).73 E F3(db_dbm)2.5 E F0(\(3\),).32 E F3(db_internal)2.5 +E F0(\(3\),).51 E F3(db_loc)2.5 E(k)-.2 E F0(\(3\),).67 E F3(db_lo)2.5 E +(g)-.1 E F0(\(3\),).22 E F3(db_mpool)2.5 E F0(\(3\),).51 E(June 2, 1998) +280.585 768 Q(2)203.585 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DB_LO)72 48 Q 349.56(AD\(1\) DB_LO)-.35 F +(AD\(1\))-.35 E/F1 10/Times-Italic@0 SF(db_open)108 84 Q F0(\(3\),).24 E +F1(db_thr)2.5 E(ead)-.37 E F0(\(3\),).77 E F1(db_txn)2.5 E F0(\(3\)).24 +E(June 2, 1998)280.585 768 Q(3)203.585 E EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/mancxx.ps/db_recover.ps b/mozilla/db/man/mancxx.ps/db_recover.ps new file mode 100644 index 00000000000..19a76b5d13e --- /dev/null +++ b/mozilla/db/man/mancxx.ps/db_recover.ps @@ -0,0 +1,401 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:33 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 2 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_reco)108 40.8 Q -.15(ve)-.15 G 2.5(r\255t).15 G(he DB database reco) +-2.5 E -.15(ve)-.15 G(ry utility).15 E F0(SYNOPSIS)72 57.6 Q/F2 10 +/Times-Bold@0 SF(db_r)108 69.6 Q(eco)-.18 E -.1(ve)-.1 G(r).1 E F1([)2.5 +E F2(-cv)A F1 2.5(][)C F2(-h home)-2.5 E F1(])A F0(DESCRIPTION)72 86.4 Q +F1(The)108 98.4 Q/F3 10/Times-Italic@0 SF(db_r)3.717 E(eco)-.37 E(ver) +-.1 E F1 1.216(utility must be run after an une)3.717 F 1.216 +(xpected application, DB, or system f)-.15 F 1.216 +(ailure to restore the)-.1 F 1.175(database to a consistent state.)108 +110.4 R 1.176(All committed transactions are guaranteed to appear after) +6.176 F F3(db_r)3.676 E(eco)-.37 E(ver)-.1 E F1(has)3.676 E +(run, and all uncommitted transactions will be completely undone.)108 +122.4 Q(The options are as follo)108 139.2 Q(ws:)-.25 E F2108 156 +Q F1 -.15(Fa)14.86 G(ilure w).15 E(as catastrophic.)-.1 E F2108 +172.8 Q F1(Specify a home directory for the database.)13.74 E F2 +108 189.6 Q F1(Run in v)14.3 E(erbose mode.)-.15 E 1.092 +(In the case of catastrophic f)108 206.4 R 1.091(ailure, an archi)-.1 F +-.25(va)-.25 G 3.591(lc).25 G(op)-3.591 E 2.391 -.65(y, o)-.1 H 3.591 +(r`).65 G(`snapshot')-4.331 E 3.591('o)-.74 G 3.591(fa)-3.591 G 1.091 +(ll database \214les must be restored)-3.591 F .038(along with all of the log \214les written since the database \214le snapshot w) +108 218.4 R .039(as made.)-.1 F .039(\(If disk space is a problem,)5.039 +F 1(log \214les may be referenced by symbolic links\).)108 230.4 R -.15 +(Fo)6 G 3.5(rf).15 G 1 +(urther information on creating a database snapshot,)-3.5 F(see `)108 +242.4 Q(`DB ARCHIV)-.74 E(AL PR)-1.35 E(OCEDURES')-.4 E 2.5('i)-.74 G(n) +-2.5 E F3(db_ar)2.5 E -.15(ch)-.37 G(ive).15 E F1(\(1\).).18 E .294 +(If the f)108 259.2 R .294(ailure w)-.1 F .294(as not catastrophic, the \214les present on the system at the time of f) +-.1 F .295(ailure are suf)-.1 F .295(\214cient to per)-.25 F(-)-.2 E +(form reco)108 271.2 Q -.15(ve)-.15 G(ry).15 E(.)-.65 E .608 +(If log \214les are missing,)108 288 R F3(db_r)3.107 E(eco)-.37 E(ver) +-.1 E F1 .607(will identify the missing log \214le\(s\) and f)3.107 F +.607(ail, in which case the missing)-.1 F +(log \214les need to be restored and reco)108 300 Q -.15(ve)-.15 G +(ry performed ag).15 E(ain.)-.05 E(The)108 316.8 Q F3(db_r)4.382 E(eco) +-.37 E(ver)-.1 E F1 1.882(utility attaches to DB shared memory re)4.382 +F 4.382(gions. In)-.15 F 1.882(order to a)4.382 F -.2(vo)-.2 G 1.882 +(id re).2 F 1.882(gion corruption, it)-.15 F 1.246(should al)108 328.8 R +-.1(wa)-.1 G 1.246(ys be gi).1 F -.15(ve)-.25 G 3.746(nt).15 G 1.245 +(he chance to detach and e)-3.746 F 1.245(xit gracefully)-.15 F 6.245 +(.T)-.65 G 3.745(oc)-7.045 G(ause)-3.745 E F3(db_r)3.745 E(eco)-.37 E +(ver)-.1 E F1 1.245(to clean up after)3.745 F(itself and e)108 340.8 Q +(xit, send it an interrupt signal \(SIGINT\).)-.15 E(The)108 357.6 Q F3 +(db_r)2.5 E(eco)-.37 E(ver)-.1 E F1(utility e)2.5 E +(xits 0 on success, and >0 if an error occurs.)-.15 E F0 +(FILESYSTEM OPERA)72 374.4 Q(TIONS)-.855 E F2 .59 +(Filesystem operations, e.g)108 386.4 R .59(., mo)-.15 F .591 +(ving the database en)-.1 F(vir)-.4 E .591(onment to a differ)-.18 F +.591(ent machine or \214le cr)-.18 F(eation,)-.18 E 1.39(deletion or r) +108 398.4 R 1.389(enaming, cannot be transaction pr)-.18 F(otected.)-.18 +E F1 -.15(Fo)6.389 G 3.889(rt).15 G 1.389(his reason,)-3.889 F F3(db_r) +3.889 E(eco)-.37 E(ver)-.1 E F1 1.389(cannot re-create,)3.889 F +(delete or rename \214les as part of reco)108 410.4 Q -.15(ve)-.15 G(ry) +.15 E(.)-.65 E(If)108 427.2 Q F3(db_r)2.907 E(eco)-.37 E(ver)-.1 E F1 +.408(cannot \214nd a database \214le referenced in the log, it will output a w) +2.907 F .408(arning message that it w)-.1 F(as)-.1 E .008 +(unable to locate a \214le it e)108 439.2 R .008(xpected to \214nd.)-.15 +F .007(This message is only a w)5.008 F .007 +(arning, as the \214le may ha)-.1 F .307 -.15(ve s)-.2 H(ubsequently).15 +E 1.866(been deleted as part of normal database operations before the f) +108 451.2 R 1.866(ailure occurred.)-.1 F F2 1.866(Note that committed) +6.866 F .168(transactions that in)108 463.2 R -.1(vo)-.4 G(lv).1 E .168 +(ed these missing \214les ar)-.1 F 2.667(er)-.18 G .167(olled f)-2.847 F +.167(orward, e)-.25 F -.1(ve)-.15 G 2.667(nt).1 G .167 +(hough the \214les wer)-2.667 F 2.667(en)-.18 G .167(ot f)-2.667 F +(ound.)-.25 E .288(If the \214les wer)108 475.2 R 2.788(en)-.18 G .288 +(ot intentionally deleted \(e.g)-2.788 F .288(., they wer)-.15 F 2.788 +(ec)-.18 G -.18(re)-2.788 G .288 +(ated after the last database snapshot, b).18 F(ut)-.2 E(wer)108 487.2 Q +2.744(el)-.18 G .244(ost during a failur)-2.744 F .243 +(e\), they must be manually cr)-.18 F .243(eated \(using)-.18 F F3 +(db_open)2.743 E F1 .243(\(3\)\), and).24 F F3(db_r)2.743 E(eco)-.37 E +(ver)-.1 E F1 .243(must be)2.743 F(rerun.)108 499.2 Q(Generally)108 516 +Q 3.932(,i)-.65 G 3.932(ti)-3.932 G 3.932(ss)-3.932 G 1.432(implest to perform \214lesystem operations at the same time as making a snapshot of the) +-3.932 F 2.5(database. T)108 528 R 2.5(op)-.8 G +(erform \214lesystem operations:)-2.5 E 15(1. Cleanly)144 544.8 R +(shutdo)2.5 E(wn database operations.)-.25 E 15(2. Rename,)144 556.8 R +(create or delete \214les.)2.5 E 15(3. Mak)144 568.8 R 2.5(eas)-.1 G +(napshot of the database.)-2.5 E 15(4. Restart)144 580.8 R +(database applications.)2.5 E 1.657 -.8(To c)108 597.6 T .057 +(leanly shutdo).8 F .057 +(wn database operations, all applications accessing the database en)-.25 +F .057(vironment must be shut-)-.4 F(do)108 609.6 Q 3.173(wn. If)-.25 F +.673(the applications are not implemented such that the)3.173 F 3.173 +(yc)-.15 G .673(an be shutdo)-3.173 F .673 +(wn gracefully \(i.e., closing all)-.25 F .74 +(references to the database en)108 621.6 R(vironment\),)-.4 E F3(db_r) +3.24 E(eco)-.37 E(ver)-.1 E F1 .74 +(must be run after all applications ha)3.24 F 1.04 -.15(ve b)-.2 H .74 +(een killed to).15 F(ensure that the underlying database is consistent and \215ushed to disk.) +108 633.6 Q F0(RECO)72 650.4 Q(VER)-.45 E(Y)-.315 E F1 .028 +(After an application or system f)108 662.4 R .029(ailure, there are tw) +-.1 F 2.529(op)-.1 G .029(ossible approaches to database reco)-2.529 F +-.15(ve)-.15 G(ry).15 E 5.029(.I)-.65 G 2.529(ft)-5.029 G .029 +(here is no)-2.529 F .919(need to retain state across the f)108 674.4 R +.919(ailure, and all databases can be started ane)-.1 F 2.219 -.65(w, t) +-.25 H .918(he database home directory).65 F .964(can simply be remo)108 +686.4 R -.15(ve)-.15 G 3.464(da).15 G .964(nd recreated.)-3.464 F .964 +(If it is necessary to retain persistent state across f)5.964 F .965 +(ailures, then the)-.1 F F3(db_r)108 698.4 Q(eco)-.37 E(ver)-.1 E F1 +.874(\(1\) utility should be run for each DB application en).73 F .873 +(vironment, i.e., each database home direc-)-.4 F(tory)108 710.4 Q(.) +-.65 E(The)108 727.2 Q F3(db_r)3.115 E(eco)-.37 E(ver)-.1 E F1 .615 +(utility will remo)3.115 F .915 -.15(ve a)-.15 H .616(ll the shared re) +.15 F .616(gions \(which may ha)-.15 F .916 -.15(ve b)-.2 H .616 +(een corrupted by the f).15 F(ailure\),)-.1 E(1)535 768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(DB_RECO)72 48 Q 312.06(VER\(1\) DB_RECO)-.5 F +(VER\(1\))-.5 E .839(establish the end of the log by identifying the last record written to the log, and then perform transaction) +108 84 R(reco)108 96 Q -.15(ve)-.15 G(ry).15 E 5.476(.D)-.65 G .477 +(atabase applications must not be restarted until reco)-5.476 F -.15(ve) +-.15 G .477(ry completes.).15 F .477(During transaction reco)5.477 F(v-) +-.15 E(ery)108 108 Q 3.016(,a)-.65 G .516(ll changes made by aborted transactions are undone and all changes made by committed transactions) +-3.016 F .92(are redone, as necessary)108 120 R 5.92(.A)-.65 G .921 +(fter reco)-5.92 F -.15(ve)-.15 G .921(ry runs, the en).15 F .921 +(vironment is properly initialized so that applications)-.4 F 1.089 +(may be restarted.)108 132 R(An)6.089 E 3.589(yt)-.15 G 1.088 +(ime an application crashes or the system f)-3.589 F(ails,)-.1 E/F1 10 +/Times-Italic@0 SF(db_r)3.588 E(eco)-.37 E(ver)-.1 E F0 1.088 +(should be run on an)3.588 F(y)-.15 E -.15(ex)108 144 S +(iting database en).15 E(vironments.)-.4 E(Additionally)108 160.8 Q +2.597(,t)-.65 G .097(here are tw)-2.597 F 2.598(of)-.1 G .098 +(orms of reco)-2.598 F -.15(ve)-.15 G .098(ry: normal reco).15 F -.15 +(ve)-.15 G .098(ry and catastrophic reco).15 F -.15(ve)-.15 G(ry).15 E +5.098(.T)-.65 G .098(he DB package)-5.098 F .682 +(de\214nes catastrophic f)108 172.8 R .681(ailure to be f)-.1 F .681 +(ailure where either the database or log \214les ha)-.1 F .981 -.15 +(ve b)-.2 H .681(een destro).15 F .681(yed or cor)-.1 F(-)-.2 E .57 +(rupted from the point of vie)108 184.8 R 3.07(wo)-.25 G 3.07(ft)-3.07 G +.57(he \214lesystem.)-3.07 F -.15(Fo)5.57 G 3.07(re).15 G .57 +(xample, catastrophic f)-3.22 F .57(ailure includes the case where)-.1 F +.788(the disk dri)108 196.8 R 1.088 -.15(ve o)-.25 H 3.288(nw).15 G .788 +(hich either the database or logs are stored has crashed, or when \214lesystem reco) +-3.288 F -.15(ve)-.15 G .787(ry is).15 F .107(unable to bring the database and log \214les to a consistent state with respect to the \214lesystem.) +108 208.8 R .108(If the f)5.108 F .108(ailure is)-.1 F .944(non-catastrophic, i.e., the database \214les and log are accessible on a \214lesystem that has reco) +108 220.8 R -.15(ve)-.15 G .944(red cleanly).15 F(,)-.65 E F1(db_r)108 +232.8 Q(eco)-.37 E(ver)-.1 E F0 .294(will re)2.794 F(vie)-.25 E 2.794 +(wt)-.25 G .294(he logs and database \214les to ensure that all committed transactions appear and that) +-2.794 F .432(all uncommitted transactions are undone.)108 244.8 R .431 +(If the f)5.431 F .431 +(ailure is catastrophic, a snapshot of the database \214les and)-.1 F +.251(the archi)108 256.8 R -.15(ve)-.25 G 2.751(dl).15 G .251 +(og \214les must be restored onto the system.)-2.751 F(Then)5.251 E F1 +(db_r)2.751 E(eco)-.37 E(ver)-.1 E F0 .251(will re)2.751 F(vie)-.25 E +2.751(wt)-.25 G .252(he logs and database)-2.751 F .345(\214les to bring the database to a consistent state as of the date of the last archi) +108 268.8 R -.15(ve)-.25 G 2.845(dl).15 G .345(og \214le.)-2.845 F .345 +(Only transactions)5.345 F .71 +(committed before that date will appear in the database.)108 280.8 R +(See)5.711 E F1(db_ar)3.211 E -.15(ch)-.37 G .711(ive \(1\)).15 F F0 +.711(for speci\214c information about)3.211 F(archi)108 292.8 Q +(ving and reco)-.25 E -.15(ve)-.15 G +(ring databases after catastrophic f).15 E(ailure.)-.1 E/F2 9 +/Times-Bold@0 SF(ENVIR)72 314.4 Q(ONMENT V)-.27 E(ARIABLES)-1.215 E F0 +(The follo)108 326.4 Q(wing en)-.25 E(vironment v)-.4 E(ariables af)-.25 +E(fect the e)-.25 E -.15(xe)-.15 G(cution of).15 E F1(db_r)2.5 E(eco) +-.37 E(ver)-.1 E F0(:).73 E(DB_HOME)108 343.2 Q .222(If the)133 355.2 R +/F3 10/Times-Bold@0 SF2.722 E F0 .222 +(option is not speci\214ed and the en)2.722 F .222(vironment v)-.4 F +(ariable)-.25 E F1(DB_HOME)2.722 E F0 .221 +(is set, it is used as the path)2.721 F +(of the database home, as described in)133 367.2 Q F1(db_appinit)2.5 E +F0(\(3\).).68 E F2 -.09(BU)72 384 S(GS).09 E F0 .723(Future v)108 396 R +.723(ersions of DB are e)-.15 F .723(xpected to remo)-.15 F 1.023 -.15 +(ve t)-.15 H .723 +(he restriction that database \214les must be manually created).15 F +(before reco)108 408 Q -.15(ve)-.15 G(ry is performed.).15 E F2 +(SEE ALSO)72 424.8 Q F0 .486(The DB library is a f)108 436.8 R .485 +(amily of groups of functions that pro)-.1 F .485 +(vides a modular programming interf)-.15 F .485(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 448.8 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .507(\214le page caching, as well as v)108 460.8 R .507 +(arious inde)-.25 F -.15(xe)-.15 G 3.007(da).15 G .506(ccess methods.) +-3.007 F(Man)5.506 E 3.006(yo)-.15 G 3.006(ft)-3.006 G .506 +(he functional groups \(e.g., the \214le)-3.006 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 472.8 R .122(are e)108 484.8 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.121 G 2.621(rag).15 G .121(eneral description of)-2.621 +F(the DB package, see)108 496.8 Q F1(db_intr)2.5 E(o)-.45 E F0(\(3\).) +.18 E F1(db_ar)108 513.6 Q -.15(ch)-.37 G(ive).15 E F0(\(1\),).18 E F1 +(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F0(\(1\),).68 E F1(db_deadloc)2.5 E +(k)-.2 E F0(\(1\),).67 E F1(db_dump)2.5 E F0(\(1\),).19 E F1(db_load)2.5 +E F0(\(1\),).77 E F1(db_r)2.5 E(eco)-.37 E(ver)-.1 E F0(\(1\),).73 E F1 +(db_stat)2.5 E F0(\(1\),).68 E F1(db_intr)108 525.6 Q(o)-.45 E F0 +(\(3\),).18 E F1(db_appinit)2.5 E F0(\(3\),).68 E F1(db_cur)2.5 E(sor) +-.1 E F0(\(3\),).73 E F1(db_dbm)2.5 E F0(\(3\),).32 E F1(db_internal)2.5 +E F0(\(3\),).51 E F1(db_loc)2.5 E(k)-.2 E F0(\(3\),).67 E F1(db_lo)2.5 E +(g)-.1 E F0(\(3\),).22 E F1(db_mpool)2.5 E F0(\(3\),).51 E F1(db_open) +108 537.6 Q F0(\(3\),).24 E F1(db_thr)2.5 E(ead)-.37 E F0(\(3\),).77 E +F1(db_txn)2.5 E F0(\(3\)).24 E(April 10, 1998)276.695 768 Q(2)199.695 E +EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/mancxx.ps/db_stat.ps b/mozilla/db/man/mancxx.ps/db_stat.ps new file mode 100644 index 00000000000..f0cc58f270e --- /dev/null +++ b/mozilla/db/man/mancxx.ps/db_stat.ps @@ -0,0 +1,296 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.11 +%%CreationDate: Sun May 31 22:58:33 1998 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Roman +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.11 0 +%%Pages: 1 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.11 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 9/Times-Bold@0 SF -.18(NA)72 28.8 S(ME).18 E/F1 10/Times-Roman@0 SF +(db_stat \255 display DB statistics)108 40.8 Q F0(SYNOPSIS)72 57.6 Q/F2 +10/Times-Bold@0 SF(db_stat)108 69.6 Q F1([)2.5 E F2(-clmNt)A F1(])A([) +158 81.6 Q F2(-C Acfhlmo)A F1 2.5(][)C F2(-d \214le)-2.5 E F1 2.5(][)C +F2(-h home)-2.5 E F1 2.5(][)C F2(-M Ahlm)-2.5 E F1(])A F0(DESCRIPTION)72 +98.4 Q F1(The)108 110.4 Q/F3 10/Times-Italic@0 SF(db_stat)2.5 E F1 +(utility displays statistics for DB en)2.5 E(vironments.)-.4 E +(The options are as follo)108 127.2 Q(ws:)-.25 E F2108 144 Q F1 +.584(Display internal information about the lock re)12.08 F 3.084 +(gion. \(The)-.15 F .584(output from this option is often both v)3.084 F +(olu-)-.2 E(minous and meaningless, and is intended only for deb)133 156 +Q(ugging.\))-.2 E F2133 172.8 Q F1(Display all information.)12.08 +E F2133 184.8 Q F1(Display lock con\215ict matrix.)14.86 E F2 +133 196.8 Q F1(Display lock and object free lists.)15.97 E F2 +133 208.8 Q F1(Display lock)16.52 E(ers within hash chains.)-.1 E +F2133 220.8 Q F1(Display re)10.97 E(gion memory information.)-.15 +E F2133 232.8 Q F1(Display objects within hash chains.)14.3 E F2 +108 249.6 Q F1(Display lock re)14.86 E +(gion statistics as described in)-.15 E F3(db_loc)2.5 E(k)-.2 E F1 +(\(3\).).67 E F2108 266.4 Q F1(Display database statistics for the speci\214ed database, as described in) +13.74 E F3(db_open)2.5 E F1(\(3\).).24 E F2108 283.2 Q F1 +(Specify a home directory for the database.)13.74 E F2108 300 Q F1 +(Display log re)16.52 E(gion statistics as described in)-.15 E F3(db_lo) +2.5 E(g)-.1 E F1(\(3\).).22 E F2108 316.8 Q F1 .852 +(Display internal information about the shared memory b)9.86 F(uf)-.2 E +.852(fer pool.)-.25 F .852(\(The output from this option is)5.852 F +(often both v)133 328.8 Q +(oluminous and meaningless, and is intended only for deb)-.2 E +(ugging.\))-.2 E F2133 345.6 Q F1(Display all information.)12.08 E +F2133 357.6 Q F1(Display b)13.74 E(uf)-.2 E +(fers within hash chains.)-.25 E F2133 369.6 Q F1(Display b)16.52 +E(uf)-.2 E(fers within LR)-.25 E 2.5(Uc)-.4 G(hains.)-2.5 E F2133 +381.6 Q F1(Display re)10.97 E(gion memory information.)-.15 E F2 +108 398.4 Q F1(Display shared memory b)10.97 E(uf)-.2 E +(fer pool statistics as described in)-.25 E F3(db_mpool)2.5 E F1(\(3\).) +.51 E F2108 415.2 Q F1(Don')12.08 E 3.282(ta)-.18 G .782 +(cquire locks while displaying the statistics.)-3.282 F .781 +(This option is intended only for deb)5.781 F .781(ugging cor)-.2 F(-) +-.2 E(rupt re)133 427.2 Q(gions and should not be used under an)-.15 E +2.5(yo)-.15 G(ther circumstances.)-2.5 E F2108 444 Q F1 +(Display transaction re)15.97 E(gion statistics as described in)-.15 E +F3(db_txn)2.5 E F1(\(3\).).24 E(The)108 460.8 Q F3(db_stat)3.417 E F1 +.917(utility attaches to DB shared memory re)3.417 F 3.418(gions. In) +-.15 F .918(order to a)3.418 F -.2(vo)-.2 G .918(id re).2 F .918 +(gion corruption, it should)-.15 F(al)108 472.8 Q -.1(wa)-.1 G .352 +(ys be gi).1 F -.15(ve)-.25 G 2.851(nt).15 G .351 +(he chance to detach and e)-2.851 F .351(xit gracefully)-.15 F 5.351(.T) +-.65 G 2.851(oc)-6.151 G(ause)-2.851 E F3(db_stat)2.851 E F1 .351 +(to clean up after itself and e)2.851 F(xit,)-.15 E +(send it an interrupt signal \(SIGINT\).)108 484.8 Q -1.11(Va)108 501.6 +S .474(lues smaller than 10 million are generally displayed without an) +1.11 F 2.974(ys)-.15 G .474(pecial notation.)-2.974 F -1.11(Va)5.474 G +.474(lues lar)1.11 F .474(ger than 10)-.18 F +(million are normally displayed as `)108 513.6 Q(`M')-.74 E('.) +-.74 E(The)108 530.4 Q F3(db_stat)2.5 E F1(utility e)2.5 E +(xits 0 on success, and >0 if an error occurs.)-.15 E F0(ENVIR)72 547.2 +Q(ONMENT V)-.27 E(ARIABLES)-1.215 E F1(The follo)108 559.2 Q(wing en) +-.25 E(vironment v)-.4 E(ariables af)-.25 E(fect the e)-.25 E -.15(xe) +-.15 G(cution of).15 E F3(db_stat)2.5 E F1(:).68 E(DB_HOME)108 576 Q +.222(If the)133 588 R F22.722 E F1 .222 +(option is not speci\214ed and the en)2.722 F .222(vironment v)-.4 F +(ariable)-.25 E F3(DB_HOME)2.722 E F1 .221 +(is set, it is used as the path)2.721 F +(of the database home, as described in)133 600 Q F3(db_appinit)2.5 E F1 +(\(3\).).68 E F0(SEE ALSO)72 616.8 Q F1 .485(The DB library is a f)108 +628.8 R .485(amily of groups of functions that pro)-.1 F .486 +(vides a modular programming interf)-.15 F .486(ace to trans-)-.1 F .523 +(actions and record-oriented \214le access.)108 640.8 R .523 +(The library includes support for transactions, locking, logging and) +5.523 F .506(\214le page caching, as well as v)108 652.8 R .506 +(arious inde)-.25 F -.15(xe)-.15 G 3.006(da).15 G .506(ccess methods.) +-3.006 F(Man)5.507 E 3.007(yo)-.15 G 3.007(ft)-3.007 G .507 +(he functional groups \(e.g., the \214le)-3.007 F .168(page caching functions\) are useful independent of the other DB functions, although some functional groups) +108 664.8 R .121(are e)108 676.8 R .121(xplicitly based on other functional groups \(e.g., transactions and logging\).) +-.15 F -.15(Fo)5.122 G 2.622(rag).15 G .122(eneral description of)-2.622 +F(the DB package, see)108 688.8 Q F3(db_intr)2.5 E(o)-.45 E F1(\(3\).) +.18 E F3(db_ar)108 705.6 Q -.15(ch)-.37 G(ive).15 E F1(\(1\),).18 E F3 +(db_c)2.5 E(hec)-.15 E(kpoint)-.2 E F1(\(1\),).68 E F3(db_deadloc)2.5 E +(k)-.2 E F1(\(1\),).67 E F3(db_dump)2.5 E F1(\(1\),).19 E F3(db_load)2.5 +E F1(\(1\),).77 E F3(db_r)2.5 E(eco)-.37 E(ver)-.1 E F1(\(1\),).73 E F3 +(db_stat)2.5 E F1(\(1\),).68 E F3(db_intr)108 717.6 Q(o)-.45 E F1 +(\(3\),).18 E F3(db_appinit)2.5 E F1(\(3\),).68 E F3(db_cur)2.5 E(sor) +-.1 E F1(\(3\),).73 E F3(db_dbm)2.5 E F1(\(3\),).32 E F3(db_internal)2.5 +E F1(\(3\),).51 E F3(db_loc)2.5 E(k)-.2 E F1(\(3\),).67 E F3(db_lo)2.5 E +(g)-.1 E F1(\(3\),).22 E F3(db_mpool)2.5 E F1(\(3\),).51 E F3(db_open) +108 729.6 Q F1(\(3\),).24 E F3(db_thr)2.5 E(ead)-.37 E F1(\(3\),).77 E +F3(db_txn)2.5 E F1(\(3\)).24 E(1)535 768 Q EP +%%Trailer +end +%%EOF diff --git a/mozilla/db/man/mancxx.roff/Db.3 b/mozilla/db/man/mancxx.roff/Db.3 new file mode 100644 index 00000000000..f2ecc9efdc8 --- /dev/null +++ b/mozilla/db/man/mancxx.roff/Db.3 @@ -0,0 +1,1887 @@ +.ds TYPE CXX +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)Db.sox 10.16 (Sleepycat) 5/4/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.\" Stat field macro. +.de Sf +.ie '\*[TYPE]'CXX'\{\ +u_int32_t \\$1;\} +.el\{\ +int get_\\$1();\} +.. +.TH Db 3 "May 4, 1998" +.UC 7 +.SH NAME +Db \- database access class +.SH SYNOPSIS +.nf +.ft B +.ie '\*[TYPE]'CXX'\{ +#include + +static int +Db::open(const char *fname, DBTYPE type, +.ti +5 +u_int32_t flags, int mode, DbEnv *dbenv, DbInfo *dbinfo, Db **dbpp); + +DBTYPE +Db::get_type(void) const; + +int +Db::close(u_int32_t flags); + +int +Db::cursor(DbTxn *txnid, Dbc **cursorp); + +int +Db::del(Dbt *key, DbTxn *txnid); + +int +Db::fd(int *fdp); + +int +Db::get(DbTxn *txnid, Dbt *key, Dbt *data, u_int32_t flags); + +int +Db::put(DbTxn *txnid, Dbt *key, Dbt *data, u_int32_t flags); + +int +Db::stat(void *sp, void *(*db_malloc)(size_t), u_int32_t flags); + +int +Db::sync(u_int32_t flags); +\} +.el\{\ +import com.sleepycat.db.*; + +public static Db open( +.ti +5 +String fname, int type, +.ti +5 +int flags, int mode, DbEnv dbenv, DbInfo dbinfo) +throws DbException; + +public int get_type(); + +public void close(int flags) +.ti +5 +throws DbException; + +public Dbc cursor(DbTxn txnid) +.ti +5 +throws DbException; + +public void del(Dbt key, DbTxn txnid) +.ti +5 +throws DbException; + +public int fd() +.ti +5 +throws DbException; + +public int get(DbTxn txnid, Dbt key, Dbt data, int flags) +.ti +5 +throws DbException; + +public void put(DbTxn txnid, Dbt key, Dbt data, int flags) +.ti +5 +throws DbException; + +public void sync(int flags) +.ti +5 +throws DbException; +\} +.ft R +.fi +.SH DESCRIPTION +.Gn +.PP +This manual page describes the Db class, which is the center of +access activity. +.PP +The currently supported file formats are btree, hashed and recno. +The btree format is a representation of a sorted, balanced tree structure. +The hashed format is an extensible, dynamic hashing scheme. +The recno format supports fixed or variable length records (optionally +retrieved from a flat text file). +.PP +Storage and retrieval for the Db access methods are based on key/data pairs, +using the Dbt class. +See +.IR Dbt (3) +for specific information on the structure and capabilities of a Dbt. +.PP +The +.I Db::open +method opens the database represented by +.I file +for both reading and writing. +Files never intended to be shared or preserved on disk may be created by +setting the file parameter to NULL. +.PP +The +.I Db::open +method +.ie '\*[TYPE]'CXX'\{\ +copies a pointer to a Db object into the memory location referenced by +.IR dbpp . +\} +.el\{\ +returns a Db object. +\} +The methods of this object allow you to perform various database actions, +as described below. +.Rt Db::open +.PP +Note, while most of the access methods use +.I file +as the name of an underlying file on disk, +this is not guaranteed. +Also, +calling +.I Db::open +is a reasonably expensive operation. +(This is based on a model where the DBMS keeps a set of files open for a +long time rather than opening and closing them on each query.) +.PP +The +.I type +argument is of type +.ie '\*[TYPE]'CXX'\{DBTYPE (as defined in the include file) +and must be set to one of DB_BTREE, DB_HASH, DB_RECNO or DB_UNKNOWN. +\} +.el\{int +and must be set to one of Db.DB_BTREE, Db.DB_HASH, Db.DB_RECNO or Db.DB_UNKNOWN. +\} +If +.I type +is DB_UNKNOWN, +the database must already exist and +.I Db::open +will then determine if it is of type DB_BTREE, DB_HASH or DB_RECNO. +.PP +.Fm +.TP 5 +.Sj DB_NOMMAP +Do not map this file (see +.IR DbMpool (3) +for further information). +.TP 5 +.Sj DB_RDONLY +Open the database for reading only. +Any attempt to write the database using the access methods will fail +regardless of the actual permissions of any underlying files. +.Ft Db::open Db +.TP 5 +.Sj DB_TRUNCATE +``Truncate'' the database if it exists, i.e., +behave as if the database were just created, +discarding any previous contents. +.PP +.Mo "access methods" +.PP +See +.IR DbEnv (3) +for a description of the +.I dbenv +argument, and +.IR DbInfo (3) +for a description of the +.I dbinfo +argument. +.SH "Db OPERATIONS" +The Db object returned by +.I Db::open +describes a database type, +and includes a set of functions to perform various actions, +as described below. +The methods for Db are as follows: +.ie '\*[TYPE]'CXX'\{ +.TP 5 +DBTYPE Db::get_type(void);\} +.el\{ +.TP 5 +int Db.get_type();\} +The type of the underlying access method (and file format). +Returns one of DB_BTREE, DB_HASH or DB_RECNO. +This value may be used to determine the type of the database after a +return from +.I Db::open +with the +.I type +argument set to DB_UNKNOWN. +.ie '\*[TYPE]'CXX'\{ +.TP 5 +int Db::close(u_int32_t flags);\} +.el\{ +.TP 5 +public void Db.close(int flags);\} +A method to flush any cached information to disk, +close any open cursors (see +.IR Dbc (3)), +free any allocated resources, and close any underlying files. +Since key/data pairs are cached in memory, failing to sync the +file with the +.I close +or +.I sync +method may result in inconsistent or lost information. +.IP +The +.I flags +parameter must be set to 0 or the following value: +.RS +.TP 5 +.Sj DB_NOSYNC +Do not flush cached information to disk. +.RE +.IP +The DB_NOSYNC flag is a dangerous option. +It should only be set 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. +.IP +.ft B +It is important to understand that flushing cached information to disk +only minimizes the window of opportunity for corrupted data. +.ft R +While 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 +.IR close , +replace the original database with the updated copy. +.IP +When multiple threads are using the Db handle concurrently, +only a single thread may call the Db handle close method. +.IP +.Rt close +.ie '\*[TYPE]'CXX'\{ +.TP 5 +int Db::cursor(DbTxn *txnid, Dbc **cursorp); +A method to create a cursor and copy a pointer to it into +the memory referenced by +.IR cursorp . +\} +.el\{ +.TP 5 +public Dbc Db.cursor(DbTxn txnid); +A method to create a cursor. +\} +.IP +A cursor is an object used to provide sequential access through a database. +.IP +.Tx +If transaction protection is enabled, +cursors must be opened and closed within the context of a transaction, +and the +.I txnid +parameter specifies the transaction context in which the cursor may be used. +See +.IR Dbc (3) +for more information. +.IP +.Rt cursor +.ie '\*[TYPE]'CXX'\{ +.TP 5 +int Db::del(DbTxn *txnid, Dbt *key, u_int32_t flags);\} +.el\{ +.TP 5 +public void Db.del(DbTxn txnid, Dbt key, int flags);\} +.br +A method to remove key/data pairs from the database. +The key/data pair associated with the specified +.I key +is discarded from the database. +In the presence of duplicate key values, +all records associated with the designated key will be discarded. +.Tx +.IP +.Fl +.IP +.Rc del +and DB_NOTFOUND if the specified +.I key +did not exist in the file. +.ie '\*[TYPE]'CXX'\{ +.TP 5 +int Db::fd(int *fdp); +A method that copies a file descriptor representative +of the underlying database into the memory referenced by +.IR fdp . +A file descriptor referencing the same file will be returned to all +processes that call +.I Db::open +with the same +.I file +argument. +This file descriptor may be safely used as an argument to the +.IR fcntl (2) +and +.IR flock (2) +locking functions. +The file descriptor is not necessarily associated with any of the +underlying files used by the access method. +.IP +The +.I fd +method only supports a coarse-grained form of locking. +\} +.el\{ +.TP 5 +public int Db.fd(); +A method that returns a file descriptor representative +of the underlying database. +This method does not fit well into the Java framework and +may not appear in subsequent releases. +\} +Applications should use the lock manager where possible. +.IP +.Rt fd +.ie '\*[TYPE]'CXX'\{ +.TP 5 +int Db::get(DbTxn *txnid, Dbt *key, Dbt *data, u_int32_t flags);\} +.el\{ +.TP 5 +public int Db.get(DbTxn txnid, Dbt key, Dbt data, int flags);\} +.br +A method that is an interface for keyed retrieval from +the database. +.ie '\*[TYPE]'CXX'\{\ +The address +\} +.el\{\ +The byte array +\} +and length of the data associated with the specified +.I key +are returned in the object referenced by +.IR data . +.sp +In the presence of duplicate key values, +.I get +will return the first data item for the designated key. +Duplicates are sorted by insert order except where this order has been +overridden by cursor operations. +.ft B +Retrieval of duplicates requires the use of cursor operations. +.ft R +See +.IR Dbc (3) +for details. +.Tx +.IP +The +.I flags +parameter must be set to 0 or the following value: +.RS +.TP 5 +.Sj DB_GET_RECNO +Retrieve a specific numbered record from a database. +Upon return, +both the +.I key +and +.I data +items will have been filled in, +not just the data item as is done for all other uses of the +.I get +method. +.sp +For DB_GET_RECNO to be specified, +the underlying database must be of type btree, +and it must have been created with the DB_RECNUM flag (see +.IR Db::open (3)). +In this case, the +.I data +field of the +.I key +.ie '\*[TYPE]'CXX'\{\ +must be a pointer to a memory location of type +.IR db_recno_t , +\} +.el\{\ +must be byte array to a memory location large enough to +hold an int, +\} +as described in +.IR Dbt (3). +.RE +.IP +If the database is a recno database and the requested key exists, +but was never explicitly created by the application or was later +deleted, the +.I get +method returns DB_KEYEMPTY. +Otherwise, if the requested key isn't in the database, the +.I get +method returns DB_NOTFOUND. +.Ro get +.ie '\*[TYPE]'CXX'\{ +.TP 5 +int Db::put(DbTxn *txnid, Dbt *key, Dbt *data, u_int32_t flags);\} +.el\{ +.TP 5 +public int Db::put(DbTxn txnid, Dbt key, Dbt data, int flags);\} +.br +A method to store key/data pairs in the database. +If the database supports duplicates, +the +.I put +method adds the new data value at the end of the duplicate set. +.Tx +.IP +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.RS +.TP 5 +.Sj DB_APPEND +Append the key/data pair to the end of the database. +For DB_APPEND to be specified, +the underlying database must be of type recno. +The record number allocated to the record is returned in the specified +.IR key . +.TP 5 +.Sj DB_NOOVERWRITE +Enter the new key/data pair only if the key does not already appear +in the database. +.RE +.IP +The default behavior of the +.I put +method is to enter the new key/data pair, +replacing any previously existing key if duplicates are +disallowed, or to add a duplicate entry if duplicates are +allowed. +Even if the designated database allows duplicates, +a call to +.I put +with the DB_NOOVERWRITE flag set will fail if the key already exists in +the database. +.IP +.Rc put +and DB_KEYEXIST if the DB_NOOVERWRITE +.I flag +was set and the key already exists in the file. +.ie '\*[TYPE]'CXX'\{ +.TP 5 +int Db::sync(u_int32_t flags);\} +.el\{ +.TP 5 +public void Db.sync(int flags);\} +A method to flush any cached information to disk. +If the database is in memory only, the +.I sync +method has no effect and will always succeed. +.IP +.Fl +.IP +See the +.I close +method description above for a discussion of Db and cached data. +.IP +.Rt sync +.ie '\*[TYPE]'CXX'\{ +.TP 5 +int Db::stat(void *sp, +.ti +5 +void *(*db_malloc)(size_t), u_int32_t flags); +.br +A method to create a statistical structure and copy a pointer +to it into user-specified memory locations. +Specifically, if +.I sp +is non-NULL, +a pointer to the statistics for the database are copied into the memory +location it references. +\} +.el\{ +.TP 5 +public int DbBtreeStat Db.stat(int flags); +.br +A method to create a statistical structure and fill it with +statistics for the database. +\} +.sp +.Ma "Statistical structures" +.sp +.ft B +In the presence of multiple threads or processes accessing an active +database, +the returned information may be out-of-date. +.ft R +.sp +.ft B +This method may access all of the pages in the database, +and therefore may incur a severe performance penalty and have obvious +negative effects on the underlying buffer pool. +.ft R +.sp +.IP +The +.I flags +parameter must be set to 0 or the following value: +.IP +.RS +.TP 5 +.Sj DB_RECORDCOUNT +In the case of a btree or recno database, +fill in the +.I bt_nrecs +field, but do not collect any other information. +This flag makes it reasonable for applications to request a record count from +a database without incurring a performance penalty. +.RE +.IP +.Rt stat +.IP +.ie '\*[TYPE]'CXX'\{ +In the case of a btree or recno database, +the statistics are stored in a structure of type DB_BTREE_STAT +(typedef'd in ). +The following fields will be filled in: +\} +.el\{\ +In the case of a btree or recno database, +the statistics are returned in an instance of DbBtreeStat. +The following methods are available on DbBtreeStat: +\} +.RS +.TP 5 +.Sf bt_magic +Magic number that identifies the file as a btree file. +.Nt +.Sf bt_version +The version of the btree file type. +.Nt +.Sf bt_flags +Permanent database flags, +including DB_DUP, DB_FIXEDLEN, DB_RECNUM and DB_RENUMBER. +.\".Nt +.\"Sf bt_maxkey +.\"The +.\".I bt_maxkey +.\"value specified to +.\".IR Db::open (3), +.\"if any. +.Nt +.Sf bt_minkey +The +.I bt_minkey +value specified to +.IR Db::open (3), +if any. +.Nt +.Sf bt_re_len +The +.I re_len +value specified to +.IR Db::open (3), +if any. +.Nt +.Sf bt_re_pad +The +.I re_pad +value specified to +.IR Db::open (3), +if any. +.Nt +.Sf bt_pagesize +Underlying tree page size. +.Nt +.Sf bt_levels +Number of levels in the tree. +.Nt +.Sf bt_nrecs +Number of data items in the tree (since there may be multiple data items +per key, this number may not be the same as the number of keys). +.Nt +.Sf bt_int_pg +Number of tree internal pages. +.Nt +.Sf bt_leaf_pg +Number of tree leaf pages. +.Nt +.Sf bt_dup_pg +Number of tree duplicate pages. +.Nt +.Sf bt_over_pg +Number of tree overflow pages. +.Nt +.Sf bt_free +Number of pages on the free list. +.Nt +.Sf bt_freed +Number of pages made available for reuse because they were emptied. +.Nt +.Sf bt_int_pgfree +Number of bytes free in tree internal pages. +.Nt +.Sf bt_leaf_pgfree +Number of bytes free in tree leaf pages. +.Nt +.Sf bt_dup_pgfree +Number of bytes free in tree duplicate pages. +.Nt +.Sf bt_over_pgfree +Number of bytes free in tree overflow pages. +.Nt +.Sf bt_pfxsaved +Number of bytes saved by prefix compression. +.Nt +.Sf bt_split +Total number of tree page splits (includes fast and root splits). +.Nt +.Sf bt_rootsplit +Number of root page splits. +.Nt +.Sf bt_fastsplit +Number of fast splits. +When sorted keys are added to the database, +the Db btree implementation will split left or right to increase the +page-fill factor. +This number is a measure of how often it was possible to make such a +split. +.Nt +.Sf bt_added +Number of keys added. +.Nt +.Sf bt_deleted +Number of keys deleted. +.Nt +.Sf bt_get +Number of keys retrieved. +(Note, this value will not reflect any keys retrieved when the database was +open for read-only access, as there is no permanent location to store the +information in this case.) +.Nt +.Sf bt_cache_hit +Number of hits in tree fast-insert code. +When sorted keys are added to the database, +the Db btree implementation will check the last page where an insert +occurred before doing a full lookup. +This number is a measure of how often the lookup was successful. +.Nt +.Sf bt_cache_miss +Number of misses in tree fast-insert code. +See the description of bt_cache_hit; +this number is a measure of how often the lookup failed. +.RE +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR Db::open : +.TP 5 +.Eh Db::open DB_DATA_DIR +.SH EXAMPLES +Applications that create short-lived databases that are discarded or +recreated when the system fails and are unconcerned with concurrent +access and loss of data due to catastrophic failure, +may wish to use the +.I Db::open +functionality without other parts of the Db library. +Such applications will only be concerned with the Db access methods. +The Db access methods will use the memory pool subsystem, +but the application is unlikely to be aware of this. +See the file +.ie '\*[TYPE]'CXX'\{\ +.I examples_cxx/AccessExample.cpp +in the Db source distribution for a C++ +\} +.el\{\ +.I java/src/com/sleepycat/examples/AccessExample.java +in the Db source distribution for a Java +\} +language code example of how such +an application might use the Db library. +.SH ERRORS +.Ek +.PP +.Ee Db::open +.na +.Nh +Db::sync(3), +DbLock::get(3), +DbLock::put(3), +DbLockTab::id(3), +DbLockTab::vec(3), +DbLog::db_register(3), +DbLog::put(3), +DbMpool::close(3), +DbMpool::db_register(3), +DbMpool::open(3), +DbMpoolFile::close(3), +DbMpoolFile::get(3), +DbMpoolFile::open(3), +DbMpoolFile::put(3), +DbMpoolFile::set(3), +DbMpoolFile::sync(3), +calloc(3), +close(2), +fcntl(2), +fflush(3), +malloc(3), +memcpy(3), +memmove(3), +memset(3), +mmap(2), +munmap(2), +open(2), +read(2), +realloc(3), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +time(3), +and +unlink(2). +.Hy +.ad +.PP +.Ec Db::open +.TP 5 +.Ea +.TP 5 +[EINVAL] +An invalid flag value or parameter was specified (e.g., unknown database +type, page size, hash method, recno pad byte, byte order) or a flag +value or parameter that is incompatible with the current +.I file +specification. +.sp +.Et +.sp +There is a mismatch between the version number of +.I file +and the software. +.sp +A +.I re_source +file was specified with either the DB_THREAD flag or a non-NULL +.I tx_info +field in the DbEnv argument to +.IR Db::open . +.TP 5 +[ENOENT] +A non-existent +.I re_source +file was specified. +.TP 5 +.Ep +.PP +.Ee Db::close +.na +.Nh +Db::sync(3), +DbLock::get(3), +DbLock::put(3), +DbLockTab::vec(3), +DbLog::db_register(3), +DbLog::put(3), +DbMpool::close(3), +DbMpoolFile::close(3), +DbMpoolFile::get(3), +DbMpoolFile::put(3), +DbMpoolFile::set(3), +DbMpoolFile::sync(3), +calloc(3), +close(2), +fflush(3), +malloc(3), +memcpy(3), +memmove(3), +memset(3), +munmap(2), +realloc(3), +and +strerror(3). +.Hy +.ad +.PP +.Ee Db::cursor +.na +.Nh +calloc(3). +.Hy +.ad +.PP +.Ec Db::cursor +.TP 5 +.Ei +.TP 5 +.Ep +.PP +.Ee Db::del +.na +.Nh +DbLock::get(3), +DbLock::put(3), +DbLockTab::id(3), +DbLockTab::vec(3), +DbLog::put(3), +DbMpoolFile::get(3), +DbMpoolFile::put(3), +DbMpoolFile::set(3), +calloc(3), +fcntl(2), +fflush(3), +malloc(3), +memcmp(3), +memcpy(3), +memmove(3), +memset(3), +realloc(3), +and +strerror(3). +.Hy +.ad +.PP +.Ec Db::del +.TP 5 +.Ea +.TP 5 +.Ei +.TP 5 +.Ep +.PP +.Ec Db::fd +.TP 5 +[ENOENT] +The +.I Db::fd +method was called for an in-memory database, +or no underlying file has yet been created. +.TP 5 +.Ep +.PP +.Ee Db::get +.na +.Nh +DbLock::get(3), +DbLock::put(3), +DbLockTab::id(3), +DbLockTab::vec(3), +DbLog::put(3), +DbMpoolFile::get(3), +DbMpoolFile::put(3), +DbMpoolFile::set(3), +Dbc::get(3), +calloc(3), +fcntl(2), +fflush(3), +malloc(3), +memcmp(3), +memcpy(3), +memmove(3), +memset(3), +realloc(3), +and +strerror(3). +.Hy +.ad +.PP +.Ec Db::get +.TP 5 +.Ea +.TP 5 +.Ei +.sp +The DB_THREAD flag was specified to the +.IR Db::open (3) +method and neither the DB_DBT_MALLOC or DB_DBT_USERMEM flags were set +in the Dbt. +.sp +A record number of 0 was specified. +.TP 5 +.Ep +.PP +.Ee Db::put +.na +.Nh +DbLock::get(3), +DbLock::put(3), +DbLockTab::id(3), +DbLockTab::vec(3), +DbLog::put(3), +DbMpoolFile::get(3), +DbMpoolFile::put(3), +DbMpoolFile::set(3), +calloc(3), +fcntl(2), +fflush(3), +malloc(3), +memcmp(3), +memcpy(3), +memmove(3), +memset(3), +realloc(3), +and +strerror(3). +.Hy +.ad +.PP +.Ec Db::put +.TP 5 +.Es +.TP 5 +.Ea +.TP 5 +.Ei +.sp +A record number of 0 was specified. +.sp +An attempt was made to add a record to a fixed-length database that +was too large to fit. +.sp +An attempt was made to do a partial put. +.TP 5 +.Ep +.TP 5 +[ENOSPC] +A btree exceeded the maximum btree depth (255). +.PP +.Ee Db::stat +.na +.Nh +DbLock::get(3), +DbLock::put(3), +DbLockTab::id(3), +DbLockTab::vec(3), +DbMpoolFile::get(3), +DbMpoolFile::put(3), +calloc(3), +fcntl(2), +fflush(3), +malloc(3), +memcpy(3), +and +memset(3). +.Hy +.ad +.PP +.Ee Db::sync +.na +.Nh +Db::get(3), +Db::sync(3), +DbLock::get(3), +DbLock::put(3), +DbLockTab::id(3), +DbLockTab::vec(3), +DbLog::put(3), +DbMpoolFile::get(3), +DbMpoolFile::put(3), +DbMpoolFile::set(3), +DbMpoolFile::sync(3), +calloc(3), +close(2), +fcntl(2), +fflush(3), +malloc(3), +memcpy(3), +memmove(3), +memset(3), +munmap(2), +open(2), +realloc(3), +strerror(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec Db::sync +.TP 5 +.Ei +.TP 5 +.Ep +.SH "SEE ALSO" +.IR "The Ubiquitous B-tree" , +Douglas Comer, ACM Comput. Surv. 11, 2 (June 1979), 121-138. +.sp +.IR "Prefix B-trees" , +Bayer and Unterauer, ACM Transactions on Database Systems, Vol. 2, 1 +(March 1977), 11-26. +.sp +.IR "The Art of Computer Programming Vol. 3: Sorting and Searching" , +D.E. Knuth, 1968, pp 471-480. +.sp +.IR "Dynamic Hash Tables" , +Per-Ake Larson, Communications of the ACM, April 1988. +.sp +.IR "A New Hash Package for UNIX" , +Margo Seltzer, USENIX Proceedings, Winter 1991. +.sp +.IR "Document Processing in a Relational Database System" , +Michael Stonebraker, Heidi Stettner, Joseph Kalash, Antonin Guttman, +Nadene Lynn, Memorandum No. UCB/ERL M82/32, May 1982. +.sp +.Sa diff --git a/mozilla/db/man/mancxx.roff/DbEnv.3 b/mozilla/db/man/mancxx.roff/DbEnv.3 new file mode 100644 index 00000000000..1cae7dace59 --- /dev/null +++ b/mozilla/db/man/mancxx.roff/DbEnv.3 @@ -0,0 +1,1907 @@ +.ds TYPE CXX +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)DbEnv.sox 10.17 (Sleepycat) 5/1/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DbEnv 3 "May 1, 1998" +.UC 7 +.SH NAME +DbEnv \- Db initialization and environment options +.SH SYNOPSIS +.nf +.ft B +.ie '\*[TYPE]'CXX'\{ +#include + +DbEnv::DbEnv(const char *db_home, char *const *db_config, u_int32_t flags); +DbEnv::DbEnv(); +DbEnv::~DbEnv(); + +int DbEnv::appinit(const char *db_home, +.ti +5 +char *const *db_config, u_int32_t flags); + +int DbEnv::get_lorder() const; +void DbEnv::set_lorder(int); + +typedef void (*db_errcall_fcn)(const char *, char *); +db_errcall_fcn DbEnv::get_errcall() const; +void DbEnv::set_errcall(db_errcall_fcn); + +FILE DbEnv::*get_errfile() const; +void DbEnv::set_errfile(FILE *); + +const char DbEnv::*get_errpfx() const; +void DbEnv::set_errpfx(const char *); + +int DbEnv::get_verbose() const; +void DbEnv::set_verbose(int); + +char DbEnv::*get_home() const; +void DbEnv::set_home(char *); + +char DbEnv::*get_log_dir() const; +void DbEnv::set_log_dir(char *); + +char DbEnv::*get_tmp_dir() const; +void DbEnv::set_tmp_dir(char *); + +char DbEnv::**get_data_dir() const; +void DbEnv::set_data_dir(char **); + +DbLockTab DbEnv::*get_lk_info() const; + +u_int8_t DbEnv::*get_lk_conflicts() const; +void DbEnv::set_lk_conflicts(u_int8_t *); + +u_int32_t DbEnv::get_lk_modes() const; +void DbEnv::set_lk_modes(u_int32_t); + +u_int32_t DbEnv::get_lk_max() const; +void DbEnv::set_lk_max(u_int32_t); + +u_int32_t DbEnv::get_lk_detect() const; +void DbEnv::set_lk_detect(u_int32_t); + +DbLog DbEnv::*get_lg_info() const; + +u_int32_t DbEnv::get_lg_max() const; +void DbEnv::set_lg_max(u_int32_t); + +DbMpool DbEnv::*get_mp_info() const; + +size_t DbEnv::get_mp_mmapsize() const; +void DbEnv::set_mp_mmapsize(size_t); + +size_t DbEnv::get_mp_size() const; +void DbEnv::set_mp_size(size_t); + +DbTxnMgr DbEnv::*get_tx_info() const; + +u_int32_t DbEnv::get_tx_max() const; +void DbEnv::set_tx_max(u_int32_t); + +typedef int (*tx_recover_fcn)(DB_LOG *, DBT *, DB_LSN *, int, void *); +tx_recover_fcn DbEnv::get_tx_recover() const; +void DbEnv::set_tx_recover(tx_recover_fcn); + +u_int32_t DbEnv::get_flags() const; +void DbEnv::set_flags(u_int32_t); + +enum ErrorModel { Exception, ErrorReturn }; +void DbEnv::set_error_model(ErrorModel); +ErrorModel DbEnv::get_error_model() const; + +class ostream* DbEnv::get_error_stream() const; +void DbEnv::set_error_stream(class ostream*); +\} +.el\{\ +import com.sleepycat.db.*; + +public DbEnv(String homeDir, String[] db_config, int flags) +.ti +5 +throws DbException; + +public DbEnv(); + +public void appinit(String homeDir, String[] db_config, int flags) +.ti +5 +throws DbException; + +public void appexit() +.ti +5 +throws DbException; + +public int get_lorder(); +public void set_lorder(int lorder); + +public DbErrcall get_errcall(); +public void set_errcall(DbErrcall errcall); + +public String get_errpfx(); +public void set_errpfx(String errpfx); + +public int get_verbose(); +public void set_verbose(int verbose); + +public String get_home(); +public void set_home(String home); + +public String get_log_dir(); +public void set_log_dir(String log_dir); + +public String get_tmp_dir(); +public void set_tmp_dir(String tmp_dir); + +public DbLockTab get_lk_info(); + +public byte[][] get_lk_conflicts(); +public void set_lk_conflicts(byte[][] lk_conflicts); + +public int get_lk_modes(); +public void set_lk_modes(int lk_modes); + +public int get_lk_max(); +public void set_lk_max(int lk_max); + +public int get_lk_detect(); +public void set_lk_detect(int lk_detect); + +public DbLog get_lg_info(); + +public int get_lg_max(); +public void set_lg_max(int lg_max); + +public DbMpool get_mp_info(); + +public long get_mp_mmapsize(); +public void set_mp_mmapsize(long mmapsize); + +public long get_mp_size(); +public void set_mp_size(long mp_size); + +public DbTxnMgr get_tx_info(); + +public int get_tx_max(); +public void set_tx_max(int tx_max); + +public int get_flags(); +public void set_flags(int flags); + +public static int get_version_major(); +public static int get_version_minor(); +public static int get_version_patch(); +public static String get_version_string(); +public static String get_java_version_string(); + +public void set_error_stream(OutputStream s); +\} +.ft R +.fi +.SH DESCRIPTION +.Gn +.PP +The DbEnv class provides simple access to an underlying data structure, +whose elements can be examined or changed using the +.I set_ +or +.I get_ +methods. The remainder of the manual page sometimes +refers to these accesses using the underlying name, e.g., simply +.I lorder +instead of +.I get_lorder +and +.IR set_lorder . +The constructors set all elements of the underlying structure to zero. +The constructor with three arguments has the effect of calling +.I DbEnv::appinit +immediately to initialize the application with default parameters. +To delay the initialization, use the default constructor. +The various set_ methods can then be used to initialize the +DbEnv, and finally, a call to +.I DbEnv::appinit +should be made to initialize DB. +.PP +Once the DB environment has been initialized by a call to +.IR DbEnv::appinit , +no set methods other than +.I set_errpfx +should be called. +.PP +.Fn appinit +The +.I appinit +method provides a simple way to initialize and configure the Db +environment. +It is not necessary that it be called, +but it provides a method of creating a consistent environment for +processes using one or more of the features of Db. +.PP +The +.I db_home +and +.I db_config +arguments to +.I appinit +are described in the section below entitled ``FILE NAMING''. +.PP +The +.I flags +argument specifies the subsystems that are initialized +and how the environment affects Db file naming, +among other things. +The +.I flags +value is specified by +.BR or 'ing +together one or more of the following values: +.TP 5 +.Sj DB_CREATE +Cause subsystems to create any underlying files, as necessary. +(See +.IR Db (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbMpool (3) +and +.IR DbTxnMgr (3) +for more information.) +.TP 5 +.Sj DB_INIT_LOCK +Initialize the lock subsystem; see +.IR DbLockTab (3). +This subsystem should be used when multiple processes or threads are +going to be reading and writing a Db database, +so that they do not interfere with each other. +If all threads are accessing the database(s) read-only, then locking +is unnecessary. +When the DB_INIT_LOCK flag is specified, it is usually necessary +to run the deadlock detector, +.IR db_deadlock (1), +as well. +.TP 5 +.Sj DB_INIT_LOG +Initialize the log subsystem; see +.IR DbLog (3). +This subsystem is used when recovery from application or system +failure is important. +.TP 5 +.Sj DB_INIT_MPOOL +Initialize the mpool subsystem; see +.IR DbMpool (3). +This subsystem is used whenever the application is using the Db access +methods for any purpose. +.TP 5 +.Sj DB_INIT_TXN +Initialize the transaction subsystem; see +.IR DbTxn (3). +This subsystem is used when atomicity of multiple operations +and recovery are important. +The DB_INIT_TXN flag implies the DB_INIT_LOG flag. +.TP 5 +.Sj DB_MPOOL_PRIVATE +Create a private memory pool (see +.IR DbMpool (3) +for further information). +Ignored unless DB_INIT_MPOOL is also specified. +.TP 5 +.Sj DB_NOMMAP +Do not map any files within this environment (see +.IR DbMpool (3) +for further information). +Ignored unless DB_INIT_MPOOL is also specified. +.TP 5 +.Sj DB_RECOVER +Run normal recovery on this environment before opening it for normal use. +If this flag is set, the DB_CREATE flag must also be set since the regions +will be removed and recreated. +.sp +The +.I DbEnv::appinit +function returns successfully if DB_RECOVER is specified and no log files +exist, so it is necessary to ensure all necessary log files are present +before running recovery. +For further information, consult the man page for +.IR db_archive (1) +and +.IR db_recover (1). +.TP 5 +.Sj DB_RECOVER_FATAL +Run catastrophic recovery on this environment before opening it for normal use. +If this flag is set, the DB_CREATE flag must also be set since the regions +will be removed and recreated. +.sp +The +.I DbEnv::appinit +function returns successfully if DB_RECOVER is specified and no log files +exist, so it is necessary to ensure all necessary log files are present +before running recovery. +For further information, consult the man page for +.IR db_archive (1) +and +.IR db_recover (1). +.TP 5 +.Sj DB_THREAD +Ensure that handles returned by the Db subsystems are useable by multiple +threads within a single process, i.e., that the system is ``free-threaded''. +(See +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbMpool (3), +.IR Db::open (3) +and +.IR DbTxn (3) +for more information.) +.if '\*[TYPE]'JAVA'\{\ +.sp +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.TP 5 +.Sj DB_TXN_NOSYNC +On transaction commit, do not synchronously flush the log (see +.IR DbTxn (3) +for further information). +Ignored unless DB_INIT_TXN is also specified. +.TP 5 +.Sj DB_USE_ENVIRON +The Db process' environment may be permitted to specify information to +be used when naming files (see the section entitled ``FILE NAMING'' below). +As permitting users to specify which files are used can create security +problems, +environment information will be used in file naming for all users only +if the DB_USE_ENVIRON flag is set. +.TP 5 +.Sj DB_USE_ENVIRON_ROOT +The Db process' environment may be permitted to specify information to +be used when naming files (see the section entitled ``FILE NAMING'' below). +As permitting users to specify which files are used can create security +problems, +if the DB_USE_ENVIRON_ROOT flag is set, +environment information will be used for file naming only +for users with a user-ID matching that of the superuser (specifically, +users for whom the +.I getuid +system call returns the user-ID 0). +.PP +The Db environment is configured +.En "appinit" "appexit" +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void (*db_errcall)(char *db_errpfx, char *buffer);\} +.el\{\ +.TP 5 +DbErrcall db_errcall;\} +When an error occurs in the DB package, an +.I errno +value is returned by the method. +In some cases, however, the +.I errno +value may be insufficient to completely describe the cause of the error. +.IP +If +.I db_errcall +.ie '\*[TYPE]'CXX'\{\ +is non-NULL, +it may be called with additional error information. +The +.I db_errpfx +argument is the current environment's +.I db_errpfx +field. +The +.I buffer +argument contains a nul-terminated string with the additional information. +\} +.el\{\ +is not null, +db_errcall.errcall() may be called with additional error information. +This method takes two arguments. The +.I prefix +argument is the current environment's +.I db_errpfx +field. +The +.I buffer +argument is a string with the additional information. +\} +.sp +This error logging facility should not be required for normal operation, +but may be useful in debugging applications. +.if '\*[TYPE]'CXX'\{\ +.TP 5 +FILE *db_errfile; +The +.I db_errfile +field behaves similarly to the +.I db_errcall +field, +except that the error message is written to the file stream represented by +.IR db_errfile . +.sp +If +.I db_errpfx +is non-NULL, +the message will be preceded by the string referenced by +.IR db_errpfx , +a colon (``:'') and a space. +The message will be followed by a newline character. +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +const char *db_errpfx;\} +.el\{\ +.TP 5 +String db_errpfx;\} +A prefix to prepend to error messages. +Because Db does not copy the memory referenced by the +.I db_errpfx +field, +the application may modify the error message prefix at +any time. +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +ostream* error_stream; +The error_stream functions like the error file, allowing errors +to be redirected to a C++ error stream. It is unwise to use +both error_stream with nonzero values of either errcall or errfile. +\} +.el\{\ +.TP 5 +java.io.OutputStream error_stream; +The +.I error_stream +field behaves similarly to the +.I db_errcall +field, +except that the error message is written to the OutputStream represented by +.IR error_stream . +.sp +If +.I db_errpfx +is not null, +the message will be preceded by the string referenced by +.IR db_errpfx , +a colon (``:'') and a space. +The message will be followed by a newline character. +\} +.TP 5 +int db_verbose; +Include informational and debugging messages as well as error messages in the +.I db_errcall +and +.I db_errfile +output. +.PP +Each of the open functions that +.I appinit +may call (\c +.IR DbLockTab::open , +.IR DbLog::open , +.I DbMpool::open +and +.IR DbTxnMgr::open ) +is called as follows, +where the DB_CREATE flag is optional: +.ie '\*[TYPE]'CXX'\{\ +.sp +.ti +5 +XXX::open(NULL, DB_CREATE, +.ti +8 +S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, dbenv) +\} +.el\{\ +.sp +.ti +5 +XXX::open(null, Db.DB_CREATE, 0660, dbenv) +\} +.PP +This call will cause each subsystem to construct pathnames as described in +the section on ``FILE NAMING''. +The subsystem has permission to read and write underlying files as necessary, +and optionally to create files. +(All created files will be created readable and writeable by the owner and +the group. +The group ownership of created files is based on the system and directory +defaults, and is not further specified by Db.) +.PP +In addition, the +.I dbenv +argument is passed to the open functions of any subsystems initialized by +.IR appinit . +For this reason the fields of the DbEnv object relevant to the +subsystems being initialized must themselves be initialized before +.I appinit +is called. +See the manual page for each subsystem for a list of these fields and +their uses. +.PP +The return value from each of these calls is placed in the appropriate +field of the DbEnv object: +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +DbLockTab *lk_info; +\} +.el\{\ +.TP 5 +DbLockTab lk_info; +\} +The return value of the +.IR DbLockTab::open (3) +call. +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +DbLog *lg_info; +\} +.el\{\ +.TP 5 +DbLog lg_info; +\} +The return value of the +.IR DbLog::open (3) +call. +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +DbMpool *mp_info; +\} +.el\{\ +.TP 5 +DbMpool mp_info; +\} +The return value of the +.IR DbMpool::open (3) +call. +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +DbTxnMgr *tx_info; +\} +.el\{\ +.TP 5 +DbTxnMgr tx_info; +\} +The return value of the +.IR DbTxnMgr::open (3) +call. +.PP +In general, +these fields are not directly used by applications; subsystems of Db that +use these fields will simply reference them using the DbEnv argument passed +to the subsystem. +.PP +For example, +an application using the Db hash access method functions to access a +database will first call +.I Db::open +passing it the DbEnv argument filled in by the initial call to +.IR appinit . +Then, +all future calls to the hash access method functions for that database will +automatically use the underlying shared memory buffer pool that was specified +by the +.I mp_info +field of that DbEnv argument. +.PP +The single exception to this rule is the +.I tx_info +field, +which applications must explicitly specify to the +.IR DbTxnMgr::begin , +.I DbTxnMgr::checkpoint +and +.I DbTxnMgr::close +functions. +.PP +The +.I error_model +field of DbEnv allows the user to configure the way +errors are treated in DB. It can be changed at +any time (e.g., after the call to +.IR DbEnv::appinit ). +The error model is described in +.IR DbException (3). +.SH "FILE NAMING" +The most important task of +.I appinit +is to structure file naming within Db. +.PP +Each of the locking, logging, +memory pool and transaction subsystems of Db require shared memory regions, +backed by the filesystem. +Further, +cooperating applications (or multiple invocations of the same application) +must agree on the location of the shared memory regions and other files used +by the Db subsystems, +the log files used by the logging subsystem, +and, of course, the data files. +.PP +Although it is possible to specify full pathnames to all Db functions, +this is cumbersome and requires that applications be recompiled when +database files are moved. +The +.I appinit +method makes it possible to place database files in a single directory, +or in multiple directories, +grouped by their method within the database. +.PP +Applications are normally expected to specify a single directory home for +their database. +This can be done easily in the call to +.I appinit +by specifying a value for the +.I db_home +argument. +There are more complex configurations where it may be desirable to override +.I db_home +or provide supplementary path information. +.PP +The following describes the possible ways in which file naming information +may be specified to the Db library. +The specific circumstances and order in which these ways are applied are +described in a subsequent paragraph. +.TP 5 +.I db_home +If the +.I db_home +argument to +.I appinit +is non-NULL, +its value may be used as the database home, +and files named relative to its path. +.TP 5 +DB_HOME +If the DB_HOME environment variable is set when +.I appinit +is called, +its value may be used as the database home, +and files named relative to its path. +.TP 5 +.I db_config +The +.I db_config +argument to +.I appinit +may be used to specify an array of character strings of the +format ``NAME VALUE'', +that specify file name information for the process' Db environment. +The whitespace delimiting the two parts of the entry may be one or +more or characters. +(Leading or trailing and characters are discarded.) +Each entry must specify both the NAME and the VALUE of the pair. +All entries with unrecognized NAME values will be ignored. +The +.I db_config +array must be NULL terminated. +.TP 5 +DB_CONFIG +The same information specified to the +.I db_config +argument to +.I appinit +may be specified using a configuration file. +If a database home directory has been specified (either by the +application specifying a non-NULL +.I db_home +argument to +.IR appinit , +or by the application setting the DB_USE_ENVIRON or DB_USE_ENVIRON_ROOT +flags and the DB_HOME environment variable being set), +any file named ``DB_CONFIG'' in the database home directory will be read +for lines of the format ``NAME VALUE''. +The whitespace delimiting the two parts of the line may be one or more + or characters. +(Leading or trailing and characters are discarded.) +All empty lines or lines whose first non-whitespace character is a +hash character (``#'') will be ignored. +Each line must specify both the NAME and the VALUE of the pair. +All lines with unrecognized NAME values will be ignored. +.PP +The following ``NAME VALUE'' pairs in the +.I db_config +argument and the DB_CONFIG file are currently supported by Db. +.TP 5 +DB_DATA_DIR +The path of a directory to be used as the location of the access method +data files, e.g., +paths specified to the +.IR Db::open (3) +method will be relative to this path. +.IP +The DB_DATA_DIR paths are additive, +and specifying more than one will result in each specified directory being +searched for database data files. +If multiple paths are specified, +created data files will always be created in the +.B first +directory specified. +.TP 5 +DB_LOG_DIR +The path of a directory to be used as the location of logging files, e.g., +files created by the +.IR DbLog (3) +subsystem will be relative to this directory. +If specified, +this is the directory name that will be passed to +.IR DbLog::open (3). +.\".TP 5 +.\"DB_SUPPORT_DIR +.\"The path of a directory to be used as the location for shared memory +.\"segments, e.g., the supporting shared memory region for the shared +.\"memory buffer pool will be created in this directory. +.TP 5 +DB_TMP_DIR +The path of a directory to be used as the location of temporary files, e.g., +files created to back in-memory access method databases will be created +relative to this path. +Note, these temporary files can potentially be quite large, depending on the +size of the database. +.sp +If DB_TMP_DIR is not specified, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', ``TMP'' and ``TempFolder''. +If one of them is set, +temporary files are created relative to the directory it specifies. +.sp +If DB_TMP_DIR is not specified and none of the above environment variables +are set, +the first possible one of the following directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +The following describes the specific circumstances and order in which the +different ways of specifying file naming information are applied. +Specifically, +Db file name processing proceeds sequentially through the following steps: +.TP 5 +``/'' +If any file name specified to any Db method begins with a leading slash, +that file name is used without modification by Db. +.TP 5 +DB_CONFIG +If a relevant configuration string (e.g., DB_DATA_DIR), +is specified in the DB_CONFIG configuration file, +the VALUE from the ``NAME VALUE'' pair is prepended to the current file name. +If the resulting file name begins with a leading slash, +the file name is used without further modification by Db. +.sp +The DB_CONFIG configuration file is intended to permit systems to customize +file location for a database independent of applications using that database. +For example, +a database administrator can move the database log and data files to a +different location without application recompilation. +.TP 5 +.I db_config +If a relevant configuration string (e.g., DB_DATA_DIR), +is specified in the +.I db_config +argument and is not specified in the DB_CONFIG file, +the VALUE from the ``NAME VALUE'' pair is prepended to the current file name. +If the resulting file name begins with a leading slash, +the file name is used without further modification by Db. +.sp +The +.I db_config +argument is intended to permit applications to customize file location +for a database. +For example, +an application writer can place data files and log files in different +directories, +or instantiate a new log directory each time the application runs. +.TP 5 +DB_HOME +If the DB_HOME environment variable was set, +(and the application has set the appropriate DB_USE_ENVIRON or +DB_USE_ENVIRON_ROOT environment variable), +its value is prepended to the current file name. +If the resulting file name begins with a leading slash, +the file name is used without further modification by Db. +.sp +The DB_HOME environment variable is intended to permit users and system +administrators to override application and installation defaults, e.g., +.sp +.ti +5 +env DB_HOME=/database/my_home application +.sp +Alternatively, +application writers are encouraged to support the +.B \-h +option found in the supporting Db utilities to let users specify a database +home. +.TP 5 +.I db_home +If the application specified a non-NULL +.I db_home +argument to +.I appinit +(and the database home was not already specified using the DB_HOME +environment variable) its value is prepended to the current file name. +If the resulting file name begins with a leading slash, +the file name is used without further modification by Db. +.TP 5 +(nothing) +Finally, all file names are interpreted relative to the current working +directory of the process. +.PP +The common model for a Db environment is one where only the DB_HOME +environment variable, +or the +.I db_home +argument, is specified. +In this case, +all data files will be presumed to be relative to that directory, +and all files created by the Db subsystems will be created in that +directory. +.PP +The more complex model for a transaction environment might be one where +a database home is specified, +using either the DB_HOME environment variable or the +.I db_home +argument to +.IR appinit , +and then DB_DATA_DIR and DB_LOG_DIR are set to the relative path names +of directories underneath the home directory using the +.I db_config +argument to +.I appinit +or the DB_CONFIG file. +.SH EXAMPLES +Store all files in the directory +.IR /a/database : +.PP +.RS +.nf +.ie '\*[TYPE]'CXX'\{\ +DbEnv::appinit("/a/database", NULL, ...); +\} +.el\{\ +DbEnv::appinit("/a/database", null, ...); +\} +.fi +.RE +.PP +Create temporary backing files in +.IR /b/temporary , +and all other files in +.IR /a/database : +.PP +.RS +.nf +.ie '\*[TYPE]'CXX'\{\ +char *config[] = { + "DB_TMP_DIR /b/temporary", + NULL +}; + +DbEnv::appinit("/a/database", config, ...); +\} +.el\{\ +String[] config = new String[1]; +config[0] = "DB_TMP_DIR /b/temporary"; + +DbEnv::appinit("/a/database", config, ...); +\} +.fi +.RE +.PP +Store data files in +.IR /a/database/datadir , +log files in +.IR /a/database/logdir , +and all other files in the directory +.IR /a/database : +.PP +.RS +.nf +.ie '\*[TYPE]'CXX'\{\ +char *config[] = { + "DB_DATA_DIR datadir", + "DB_LOG_DIR logdir", + NULL +}; + +DbEnv::appinit("/a/database", config, ...); +\} +.el\{\ +String[] config = new String[2]; +config[0] = "DB_DATA_DIR datadir"; +config[1] = "DB_LOG_DIR logdir", + +DbEnv::appinit("/a/database", config, ...); +\} +.fi +.RE +.PP +Store data files in +.I /a/database/data1 +and +.IR /b/data2 , +and all other files in the directory +.IR /a/database . +Any data files that are created will be created in +.IR /b/data2 : +.PP +.RS +.nf +.ie '\*[TYPE]'CXX'\{\ +char *config[] = { + "DB_DATA_DIR /b/data2", + "DB_DATA_DIR data1", + NULL +}; + +DbEnv::appinit("/a/database", config, ...); +\} +.el\{\ +String[] config = new String[2]; +config[0] = "DB_DATA_DIR /b/data2"; +config[1] = "DB_DATA_DIR data1"; + +DbEnv::appinit("/a/database", config, ...); +\} +.fi +.RE +.PP +.ie '\*[TYPE]'CXX'\{\ +See the file +.I examples_cxx/AppinitExample.cpp +in the Db source distribution for a C++ language code example of how an +\} +.el\{\ +See the file +.I java/src/com/sleepycat/examples/AppinitExample.java +in the Db source distribution for a Java language code example of how an +\} +application might use +.I appinit +to configure its Db environment. +.SH ERRORS +.Ek +.PP +.Ee appinit +.na +.Nh +Db::close(3), +DbEnv::appexit(3), +DbLock::unlink(3), +DbLockTab::open(3), +DbLog::compare(3), +DbLog::get(3), +DbLog::open(3), +DbLog::unlink(3), +DbMpool::open(3), +DbMpool::unlink(3), +DbTxnMgr::checkpoint(3), +DbTxnMgr::open(3), +DbTxnMgr::unlink(3), +calloc(3), +fclose(3), +fcntl(2), +fflush(3), +fgets(3), +fopen(3), +malloc(3), +memcpy(3), +memset(3), +realloc(3), +stat(2), +strchr(3), +strcmp(3), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +strsep(3), +and +time(3). +.Hy +.ad +.PP +.Ec appinit +.TP 5 +.Ei +.sp +.Et +.sp +The DB_RECOVER or DB_RECOVER_FATAL flag was specified, and no +log files were found. +.sp +The DB_HOME or TMPDIR environment variables were set but empty. +.sp +An incorrectly formatted ``NAME VALUE'' entry or line was found. +.TP 5 +[ENOSPC] +HP-UX only: a previously created Db environment for this process still +exists. +.PP +.Ee DbEnv::appexit +.na +.Nh +DbLockTab::close(3), +DbLog::close(3), +DbMpool::close(3), +and +DbTxnMgr::close(3). +.Hy +.ad +.SH "BUGS" +Due to the constraints of the PA-RISC memory architecture, +HP-UX does not allow a process to map a file into its address space +multiple times. +For this reason, +each DB environment may be opened only once by a process on HP-UX, +i.e., calls to +.I appinit +will fail if the specified Db environment has been opened and not +subsequently closed. +.PP +On Windows/95, files that are opened by multiple processes do not share +data correctly. To tell Berkeley DB to use the paging file to share +memory among processes, use the DB_REGION_NAME flag of the +.I db_value_set +function. +Obviously, you do not need to do this if only a single process will be +accessing database files. +.SH "SEE ALSO" +.Sa diff --git a/mozilla/db/man/mancxx.roff/DbException.3 b/mozilla/db/man/mancxx.roff/DbException.3 new file mode 100644 index 00000000000..fe742f0ce63 --- /dev/null +++ b/mozilla/db/man/mancxx.roff/DbException.3 @@ -0,0 +1,945 @@ +.ds TYPE CXX +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)DbException.sox 10.6 (Sleepycat) 4/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DbException 3 "April 10, 1998" +.UC 7 +.SH NAME +DbException \- Exception class for Db activity +.SH SYNOPSIS +.nf +.ft B +.ie '\*[TYPE]'CXX'\{ +#include + +DbException::DbException(int err); +DbException::DbException(const char *description); +DbException::DbException(const char *prefix, int err); +DbException::DbException(const char *prefix1, +.ti +5 +const char *prefix2, int err); + +const int +DbException::get_errno(); + +virtual const char * +DbException::what() const; +\} +.el\{\ +import com.sleepycat.db.*; + +public class DbException extends Exception; + +public DbException(String s); +public DbException(String s, int errno); + +public int get_errno(); +\} +.ft R +.fi +.SH DESCRIPTION +.Gn +.PP +This manual page describes the DbException class and how it is used +by the various Db* classes. +.PP +.ie '\*[TYPE]'CXX'\{ +Most methods in the Db classes return an int but also throw an exception. +This allows for two different error behaviors, that are known as +.IR "error models" . +By default, the error model is configured to throw an exception whenever +a serious error occurs. +This generally allows for cleaner logic for transaction processing, +as a try block can surround a single transaction. +Alternatively, the error model can be set to not throw exceptions, +and instead request the individual function to return an error code. +The error model can be changed using the +.I DbEnv::set_error_model +method, see +.IR DbEnv (3). +.PP +A DbException object contains an informational string and an errno. +The errno can be obtained using +.IR DbException::get_errno (). +The informational string can be obtained using +.IR DbException::what (). +.PP +We expect in the future that this class will inherit from the standard +class exception, but certain language implementation bugs currently +prevent this on some platforms. +\} +.el\{\ +Most methods in the Db classes throw an exception when an error occurs. +A DbException object contains an informational string and an errno. +The errno can be obtained using +.IR DbException::get_errno (). +Since DbException inherits from the java.Exception, the string +portion is available using toString(). +\} +.PP +Some methods may return non-zero values without issuing an exception. +This occurs in situations that are not normally considered an error, +but when some informational status is returned. +For example, +.I Db::get +returns DB_KEYNOTFOUND when a requested key does not appear in the +database. +.SH "SEE ALSO" +.Sa diff --git a/mozilla/db/man/mancxx.roff/DbInfo.3 b/mozilla/db/man/mancxx.roff/DbInfo.3 new file mode 100644 index 00000000000..3e93cc69a43 --- /dev/null +++ b/mozilla/db/man/mancxx.roff/DbInfo.3 @@ -0,0 +1,1550 @@ +.ds TYPE CXX +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)DbInfo.sox 10.13 (Sleepycat) 5/3/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DbInfo 3 "May 3, 1998" +.UC 7 +.SH NAME +DbInfo \- informational parameters for database open +.SH SYNOPSIS +.nf +.ft B +.ie '\*[TYPE]'CXX'\{ +#include + +DbInfo::DbInfo(); +DbInfo::~DbInfo(); +DbInfo::DbInfo(const DbInfo &); +DbInfo::DbInfo &operator = (const DbInfo &); + +int DbInfo::get_lorder() const; +void DbInfo::set_lorder(int); + +size_t DbInfo::get_cachesize() const; +void DbInfo::set_cachesize(size_t); + +size_t DbInfo::get_pagesize() const; +void DbInfo::set_pagesize(size_t); + +typedef void *(*db_malloc_fcn)(size_t); +DbInfo::db_malloc_fcn DbInfo::get_malloc() const; +void DbInfo::set_malloc(db_malloc_fcn); + +.\"u_int32_t DbInfo::get_bt_maxkey() const; +.\"void DbInfo::set_bt_maxkey(u_int32_t); +.\" +u_int32_t DbInfo::get_bt_minkey() const; +void DbInfo::set_bt_minkey(u_int32_t); + +typedef int (*bt_compare_fcn)(const DBT *, const DBT *); +bt_compare_fcn DbInfo::get_bt_compare() const; +void DbInfo::set_bt_compare(bt_compare_fcn); + +typedef size_t (*bt_prefix_fcn)(const DBT *, const DBT *); +bt_prefix_fcn DbInfo::get_bt_prefix() const; +void DbInfo::set_bt_prefix(bt_prefix_fcn); + +u_int32_t DbInfo::get_h_ffactor() const; +void DbInfo::set_h_ffactor(u_int32_t); + +u_int32_t DbInfo::get_h_nelem() const; +void DbInfo::set_h_nelem(u_int32_t); + +typedef u_int32_t (*h_hash_fcn)(const void *, u_int32_t); +h_hash_fcn DbInfo::get_h_hash() const; +void DbInfo::set_h_hash(h_hash_fcn); + +int DbInfo::get_re_pad() const; +void DbInfo::set_re_pad(int); + +int DbInfo::get_re_delim() const; +void DbInfo::set_re_delim(int); + +u_int32_t DbInfo::get_re_len() const; +void DbInfo::set_re_len(u_int32_t); + +char DbInfo::*get_re_source() const; +void DbInfo::set_re_source(char *); + +u_int32_t DbInfo::get_flags() const; +void DbInfo::set_flags(u_int32_t); +\} +.el\{\ +import com.sleepycat.db.*; + +public DbInfo(); +public DbInfo(DbInfo that); + +public int get_lorder(); +public void set_lorder(int lorder); + +public long get_cachesize(); +public void set_cachesize(long cachesize); + +public long get_pagesize(); +public void set_pagesize(long pagesize); + +.\"public int get_bt_maxkey(); +.\"public void set_bt_maxkey(int bt_maxkey); +.\" +public int get_bt_minkey(); +public void set_bt_minkey(int bt_minkey); + +public int get_h_ffactor(); +public void set_h_ffactor(int h_ffactor); + +public int get_h_nelem(); +public void set_h_nelem(int h_nelem); + +public int get_re_pad(); +public void set_re_pad(int re_pad); + +public int get_re_delim(); +public void set_re_delim(int re_delim); + +public int get_re_len(); +public void set_re_len(int re_len); + +public String get_re_source(); +public void set_re_source(String re_source); + +public int get_flags(); +public void set_flags(int flags); +\} +.ft R +.fi +.SH DESCRIPTION +.Gn +.PP +This manual page describes the DbInfo class. A DbInfo object +is used in conjunction with the +.I Db::open +method (see +.IR Db (3)) +to specify particular configuration options for the open. +The DbInfo class provides simple access to an underlying data structure, +whose elements can be examined or changed using the +.I set_ +or +.I get_ +methods. +The remainder of the manual page refers to these accesses using the +underlying name, e.g., +.I cachesize +instead of +.I get_cachesize +and +.IR set_cachesize . +The default constructor sets all elements of the underlying structure +to zero. +Some of the fields are specific to a type of file format (one of btree, +hashed and recno) and are thus named with an underscore separated string, +``bt'', ``h'' and ``re'', respectively. +For example, the method +.I set_bt_minkey +sets the underlying +.I bt_minkey +field, and this field is only used when opening a btree file. +.PP +The fields that are common to all access methods are listed here; +those specific to an individual access method are described below. +.if '\*[TYPE]'CXX'\{\ +No reference to the DbInfo object is maintained by Db, +so it is possible to discard it as soon as the +.I Db::open +call returns. +\} +.PP +If possible, +defaults appropriate for the system are used for the DbInfo fields if +.I dbinfo +is NULL or any fields of the DbInfo object are not explicitly set. +The following DbInfo fields may be initialized before calling +.IR Db::open : +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +size_t cachesize;\} +.el\{\ +.TP 5 +long cachesize;\} +A suggested maximum size of the memory pool cache, in bytes. +If +.I cachesize +is not explicitly set, an appropriate default is used. +It is an error to specify both the +.I mp_info +field and a non-zero +.IR db_cachesize . +.sp +.ft B +Note, +the minimum number of pages in the cache should be no less than 10, +and the access methods will fail if an insufficiently large cache is specified. +.ft R +In addition, +for applications that exhibit strong locality in their data access +patterns, +increasing the size of the cache can significantly improve application +performance. +.TP 5 +int lorder; +The byte order for integers in the stored database metadata. +The number should represent the order as an integer, for example, +big endian order is the number 4,321, and little endian order is +the number 1,234. +If +.I lorder +is not explicitly set, +the host order of the machine where the Db library was compiled is used. +.sp +The value of +.I lorder +is ignored except when databases are being created. +If a database already exists, +the byte order it uses is determined when the file is read. +.sp +.ft B +The access methods provide no guarantees about the byte ordering of the +application data stored in the database, +and applications are responsible for maintaining any necessary ordering. +.ft R +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +size_t pagesize;\} +.el\{\ +.TP 5 +long pagesize;\} +The size of the pages used to hold items in the database, in bytes. +The minimum page size is 512 bytes and the maximum page size is 64K bytes. +If +.I pagesize +is not explicitly set, +a page size is selected based on the underlying filesystem I/O block +size. +The selected size has a lower limit of 512 bytes and an upper limit +of 16K bytes. +.if '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*malloc)(size_t); +The flag DB_DBT_MALLOC, when specified in the Dbt object, will cause +the Db library to allocate memory which then becomes the responsibility +of the calling application. +See +.IR Dbt (3) +for more information. +.sp +On systems where there may be multiple library versions of malloc +(notably Windows NT), specifying the DB_DBT_MALLOC flag will fail +because the Db library will allocate memory from a different heap +than the application will use to free it. +To avoid this problem, the +.I malloc +function should be set to point to the application's allocation routine. +If +.I malloc +is not explicitly set, +it will be used to allocate the memory returned when the DB_DBT_MALLOC flag +is set. +The +.I malloc +method must match the calling conventions of the +.IR malloc (3) +library routine. +\} +.SH BTREE +The btree data structure is a sorted, balanced tree structure storing +associated key/data pairs. +Searches, insertions, +and deletions in the btree will all complete in O (lg base N) where base +is the average number of keys per page. +Often, +inserting ordered data into btrees results in pages that are half-full. +This implementation has been modified to make ordered (or inverse ordered) +insertion the best case, +resulting in nearly perfect page space utilization. +.PP +Space freed by deleting key/data pairs from the database is never reclaimed +from the filesystem, +although it is reused where possible. +This means that the btree storage structure is grow-only. +If sufficiently many keys are deleted from a tree that shrinking the +underlying database file is desirable, +this can be accomplished by creating a new tree from a scan of the existing +one. +.PP +The following additional fields and flags may be initialized in the DbInfo +object before calling +.IR Db::open , +when using the btree access method: +.if '\*[TYPE]'CXX'\{\ +.TP 5 +int (*bt_compare)(const Dbt *, const Dbt *); +The +.I bt_compare +function is the key comparison method. +It must return an integer less than, equal to, or greater than zero if the +first key argument is considered to be respectively less than, equal to, +or greater than the second key argument. +The same comparison method must be used on a given tree every time it +is opened. +.sp +The +.I data +and +.I size +fields of the DBT are the only fields that may be used for the purposes +of this comparison. +.sp +If +.I bt_compare +is NULL, +the keys are compared lexically, +with shorter keys collating before longer keys. +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +u_int32_t bt_minkey;\} +.el\{\ +.TP 5 +int bt_minkey;\} +The minimum number of keys that will be stored on any single page. +This value is used to determine which keys will be stored on overflow +pages, i.e. if a key or data item is larger than the pagesize divided +by the +.I bt_minkey +value, +it will be stored on overflow pages instead of in the page itself. +The +.I bt_minkey +value specified must be at least 2; if +.I bt_minkey +is not explicitly set, a value of 2 is used. +.if '\*[TYPE]'CXX'\{\ +.TP 5 +size_t (*bt_prefix)(const Dbt *, const Dbt *); +The +.I bt_prefix +function is the prefix comparison method. +If specified, this method must return the number of bytes of the second key +argument that are necessary to determine that it is greater than the first +key argument. +If the keys are equal, the key length should be returned. +.sp +The +.I data +and +.I size +fields of the DBT are the only fields that may be used for the purposes +of this comparison. +.sp +This is used to compress the keys stored on the btree internal pages. +The usefulness of this is data dependent, +but in some data sets can produce significantly reduced tree sizes and +search times. +If +.I bt_prefix +is not explicitly set, and no comparison method is specified, +a default lexical comparison method is used. +If +.I bt_prefix +is NULL and a comparison method is specified, no prefix comparison is +done. +\} +.TP 5 +unsigned long flags; +The following additional flags may be specified: +.RS +.TP 5 +.de DU +DB_DUP +Permit duplicate keys in the tree, +i.e. insertion when the key of the key/data pair being inserted already +exists in the tree will be successful. +The ordering of duplicates in the tree is determined by the order of +insertion, +unless the ordering is otherwise specified by use of a cursor (see +.IR Dbc (3) +for more information.) +.. +.DU +It is an error to specify both DB_DUP and DB_RECNUM. +.TP 5 +.Sj DB_RECNUM +Support retrieval from btrees using record numbers. +For more information, see the DB_GET_RECNO flag to the +.ie '\*[TYPE]'CXX'\{\ +.I db->get +\} +.el\{\ +.I db.get +\} +method (below), +and the cursor +.I Dbc::get +method (in +.IR Dbc (3)). +.sp +Logical record numbers in btrees are mutable in the face of record +insertion or deletion. +See the DB_RENUMBER flag in the RECNO section below for further discussion. +.sp +Maintaining record counts within a btree introduces a serious point of +contention, +namely the page locations where the record counts are stored. +In addition, +the entire tree must be locked during both insertions and deletions, +effectively single-threading the tree for those operations. +Specifying DB_RECNUM can result in serious performance degradation for +some applications and data sets. +.sp +It is an error to specify both DB_DUP and DB_RECNUM. +.RE +.SH HASH +The hash data structure is an extensible, dynamic hashing scheme. +Backward compatible interfaces to the functions described in +.IR dbm (3), +.IR ndbm (3) +and +.IR hsearch (3) +are provided, however these interfaces are not compatible with +previous file formats. +.PP +The following additional fields and flags may be initialized in the DbInfo +object before calling +.IR Db::open , +when using the hash access method: +.TP 5 +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +u_int32_t h_ffactor;\} +.el\{\ +.TP 5 +int h_ffactor;\} +The desired density within the hash table. +It is an approximation of the number of keys allowed to accumulate in any +one bucket, determining when the hash table grows or shrinks. +The default value is 0, indicating that the fill factor will be selected +dynamically as pages are filled. +.if '\*[TYPE]'CXX'\{\ +.TP 5 +u_int32_t (*h_hash)(const void *, u_int32_t); +The +.I h_hash +field is a user defined hash method; +if +.I h_hash +is NULL, +a default hash method is used. +Since no hash method performs equally well on all possible data, +the user may find that the built-in hash method performs poorly with +a particular data set. +User specified hash functions must take a pointer to a byte string and +a length as arguments and return a u_int32_t value. +.IP +If a hash method is specified, +.I hash_open +will attempt to determine if the hash method specified is the same as +the one with which the database was created, and will fail if it detects +that it is not. +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +u_int32_t h_nelem;\} +.el\{\ +.TP 5 +int h_nelem;\} +An estimate of the final size of the hash table. +If not set or set too low, +hash tables will expand gracefully as keys are entered, +although a slight performance degradation may be noticed. +The default value is 1. +.TP 5 +unsigned long flags; +The following additional flags may be specified by +.BR or 'ing +together one or more of the following values: +.RS +.TP 5 +.DU +.SH RECNO +The recno access method provides support for fixed and variable length +records, +optionally backed by a flat text (byte stream) file. +Both fixed and variable length records are accessed by their logical +record number. +.PP +It is valid to create a record whose record number is more than one +greater than the last record currently in the database. +For example, the creation of record number 8, when records 6 and 7 +do not yet exist, is not an error. +However, any attempt to retrieve such records (e.g., records 6 and 7) +will return DB_KEYEMPTY. +.PP +Deleting a record will not, by default, renumber records following +the deleted record (see DB_RENUMBER below for more information). +Any attempt to retrieve deleted records will return DB_KEYEMPTY. +.PP +The following additional fields and flags may be initialized in the DbInfo +object before calling +.IR Db::open , +when using the recno access method: +.TP 5 +int re_delim; +For variable length records, +if the +.I re_source +file is specified and the DB_DELIMITER flag is set, +the delimiting byte used to mark the end of a record in the source file. +If the +.I re_source +file is specified and the DB_DELIMITER flag is not set, + characters (i.e. ``\en'', 0x0a) are interpreted as +end-of-record markers. +.TP 5 +.ie '\*[TYPE]'CXX'\{\ +u_int32_t re_len;\} +.el\{\ +int re_len;\} +The length of a fixed-length record. +.TP 5 +int re_pad; +For fixed length records, +if the DB_PAD flag is set, +the pad character for short records. +If the DB_PAD flag is not explicitly set, + characters (i.e., 0x20) are used for padding. +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +char *re_source;\} +.el\{\ +.TP 5 +String re_source;\} +The purpose of the +.I re_source +field is to provide fast access and modification to databases that are +normally stored as flat text files. +.sp +If the +.I re_source +field is explicitly set, +it specifies an underlying flat text database file that is read to initialize +a transient record number index. +In the case of variable length records, +the records are separated by the byte value +.IR re_delim . +For example, +standard UNIX byte stream files can be interpreted as a sequence of variable +length records separated by characters. +.sp +In addition, +when cached data would normally be written back to the underlying database +file (e.g., the +.I close +or +.I sync +.ie '\*[TYPE]'CXX'\{\ +functions\} +.el\{\ +methods\} +are called), +the in-memory copy of the database will be written back to the +.I re_source +file. +.sp +By default, the backing source file is read lazily, +i.e., records are not read from the file until they are requested by the +application. +.ft B +If multiple processes (not threads) are accessing a recno database +concurrently and either inserting or deleting records, +the backing source file must be read in its entirety before more than +a single process accesses the database, +and only that process should specify the backing source file as part +of the +.I Db::open +call. +.ft R +See the DB_SNAPSHOT flag below for more information. +.sp +.ft B +Reading and writing the backing source file specified by re_source +cannot be transactionally protected because it involves filesystem +operations that are not part of the Db transaction methodology. +.ft R +For this reason, +if a temporary database is used to hold the records, i.e., a NULL was +specified as the +.I file +argument to +.IR Db::open , +it is possible to lose the contents of the +.I re_source +file, e.g., if the system crashes at the right instant. +If a file is used to hold the database, i.e., a file name was specified +as the +.I file +argument to +.IR Db::open , +normal database recovery on that file can be used to prevent information +loss, +although it is still possible that the contents of +.I re_source +will be lost if the system crashes. +.sp +The +.I re_source +file must already exist (but may be zero-length) when +.I Db::open +is called. +.sp +For all of the above reasons, the +.I re_source +field is generally used to specify databases that are read-only for Db +applications, +and that are either generated on the fly by software tools, +or modified using a different mechanism, e.g., a text editor. +.TP 5 +unsigned long flags; +The following additional flags may be specified by +.BR or 'ing +together one or more of the following values: +.RS +.TP 5 +.Sj DB_DELIMITER +The +.I re_delim +field is set. +.TP 5 +.Sj DB_FIXEDLEN +The records are fixed-length, not byte delimited. +The +.I re_len +value specifies the length of the record, +and the +.I re_pad +value is used as the pad character. +.sp +Any records added to the database that are less than +.I re_len +bytes long are automatically padded. +Any attempt to insert records into the database that are greater than +.I re_len +bytes long will cause the call to fail immediately and return an error. +.TP 5 +.Sj DB_PAD +The +.I re_pad +field is set. +.TP 5 +.Sj DB_RENUMBER +Specifying the DB_RENUMBER flag causes the logical record numbers to be +mutable, +and change as records are added to and deleted from the database. +For example, +the deletion of record number 4 causes records numbered 5 and greater +to be renumbered downward by 1. +If a cursor was positioned to record number 4 before the deletion, +it will reference the new record number 4, if any such record exists, +after the deletion. +If a cursor was positioned after record number 4 before the deletion, +it will be shifted downward 1 logical record, +continuing to reference the same record as it did before. +.sp +Using the +.I Dbc::put +or +.I put +interfaces to create new records will cause the creation of multiple +records if the record number is more than one greater than the largest +record currently in the database. +For example, creating record 28, +when record 25 was previously the last record in the database, +will create records 26 and 27 as well as 28. +Attempts to retrieve records that were created in this manner +will result in an error return of DB_KEYEMPTY. +.sp +If a created record is not at the end of the database, +all records following the new record will be automatically renumbered +upward by 1. +For example, +the creation of a new record numbered 8 causes records numbered 8 and +greater to be renumbered upward by 1. +If a cursor was positioned to record number 8 or greater before the insertion, +it will be shifted upward 1 logical record, +continuing to reference the same record as it did before. +.sp +For these reasons, +concurrent access to a recno database with the DB_RENUMBER flag specified +may be largely meaningless, although it is supported. +.TP 5 +.Sj DB_SNAPSHOT +This flag specifies that any specified +.I re_source +file be read in its entirety when +.I Db::open +is called. +If this flag is not specified, +the +.I re_source +file may be read lazily. +.RE +.PP +.SH "SEE ALSO" +.Sa diff --git a/mozilla/db/man/mancxx.roff/DbLock.3 b/mozilla/db/man/mancxx.roff/DbLock.3 new file mode 100644 index 00000000000..a51cdcad9d0 --- /dev/null +++ b/mozilla/db/man/mancxx.roff/DbLock.3 @@ -0,0 +1,1017 @@ +.ds TYPE CXX +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)DbLock.sox 10.6 (Sleepycat) 4/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DbLock 3 "April 10, 1998" +.UC 7 +.SH NAME +DbLock \- lock class +.SH SYNOPSIS +.nf +.ft B +.ie '\*[TYPE]'CXX'\{ +#include + +int +DbLock::put(DbLockTab *lt); + +unsigned int +DbLock::get_lock_id(); + +void +DbLock::set_lock_id(unsigned int); + +DBLock::DbLock(unsigned int); +DBLock::DbLock(); +DBLock::DbLock(const DbLock &); +DbLock &DBLock::operator = (const DbLock &); +\} +.el\{\ +import com.sleepycat.db.*; + +public DbLock() +.ti +5 +throws DbException; + +public DbLock(DbLock that) +.ti +5 +throws DbException; + +public DbLock(int lockid); +.ti +5 +throws DbException; + +public native void put(DbLockTab locktab) +.ti +5 +throws DbException; + +public native int get_lock_id() +.ti +5 +throws DbException; + +public native void set_lock_id(int lockid) +.ti +5 +throws DbException; +\} +.ft R +.fi +.SH DESCRIPTION +.Gn +.PP +This manual page describes the specific details of the locking interface. +The DbLock class is used in conjunction with +.IR DbLockTab (3) +to provide general-purpose +locking. +While designed to work with the other Db classes, these classes are +also useful for more general locking purposes. +Locks can be shared between processes. +In most cases, when multiple threads or processes are using locking, the +deadlock detector, +.IR db_deadlock (1), +should be run. +.PP +.Fn DbLock::put +.ie '\*[TYPE]'CXX'\{\ +The +.I DbLock::put +method is a simple interface to the +.I DbLockTab::vec +functionality, and is equivalent to calling the +.I DbLockTab::vec +method with a single element +.I list +array, for which the +.I op +field is DB_LOCK_PUT and the +.I lock +field is represented by the DbLock object. +The +.I DbLock::put +method returns success and failure as described for the +.I DbLockTab::vec +method. +\} +.el\{\ +The +.I DbLock::put +method releases a lock, previously obtained from the +specified DbLockTab using DbLockTab.get. +\} +.PP +.Fn DbLock::get_lock_id +The +.I DbLock::get_lock_id +method gets the underlying representation of the lock id. +Direct manipulation of the underlying representation is not recommended. +.PP +.Fn DbLock::set_lock_id +The +.I DbLock::set_lock_id +method sets the underlying representation of the lock id. +Direct manipulation of the underlying representation is not recommended. +Rather, +.I DbLockTab::get +should be used to initialize locks (see +.IR DbLockTab (3)), +.ie '\*[TYPE]'CXX'\{\ +and the copy constructor and assignment operators can be used to +assign to other DbLock objects. +\} +.el\{\ +and the copy constructor can be used to create new DbLock objects +from existing ones. +\} +.SH "ERRORS" +.Ek +.PP +.Ee DbLock::put +.na +.Nh +DbLock::detect(3), +fcntl(2), +fflush(3), +lseek(2), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +strerror(3), +and +write(2). +.Hy +.ad +.PP +.Ec DbLock::put +.TP 5 +[EACCES] +An attempt was made to release lock held by another locker. +.TP 5 +.Ei +.SH "BUGS" +If a process dies while holding locks, those locks remain held and are +.B never +released. +In this case, all processes should exit as quickly as possible, so +that +.I db_recover +can be run. +.SH "SEE ALSO" +.Sa diff --git a/mozilla/db/man/mancxx.roff/DbLockTab.3 b/mozilla/db/man/mancxx.roff/DbLockTab.3 new file mode 100644 index 00000000000..fc53d7bfd01 --- /dev/null +++ b/mozilla/db/man/mancxx.roff/DbLockTab.3 @@ -0,0 +1,1551 @@ +.ds TYPE CXX +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)DbLockTab.sox 10.13 (Sleepycat) 4/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.de Vc +.ie '\*[TYPE]'CXX'\{ +.I DbLockTab::vec +\} +.el\{\ +.I db_vec +\} +.. +.TH DbLockTab 3 "April 10, 1998" +.UC 7 +.SH NAME +DbLockTab \- lock manager +.SH SYNOPSIS +.nf +.ft B +.ie '\*[TYPE]'CXX'\{ +#include + +static int +DbLockTab::open(const char *dir, +.ti +5 +u_int32_t flags, int mode, DbEnv *dbenv, DbLockTab **regionp); + +int +DbLockTab::id(u_int32_t *idp); + +int +DbLockTab::vec(u_int32_t locker, u_int32_t flags, +.ti +5 +DB_LOCKREQ list[], int nlist, DB_LOCKREQ **elistp); + +int +DbLockTab::get(u_int32_t locker, u_int32_t flags, +.ti +5 +const Dbt *obj, const db_lockmode_t lock_mode, DB_LOCK *lock); + +int +DbLockTab::close(); + +static int +DbLockTab::unlink(const char *dir, int force, DbEnv *dbenv); + +int +DbLockTab::detect(u_int32_t flags, u_int32_t atype); +\} +.el\{\ +import com.sleepycat.db.*; + +public void close() +.ti +5 +throws DbException; + +public void detect(int flags, int atype) +.ti +5 +throws DbException; + +public DbLock get(int locker, int flags, Dbt obj, int lock_mode) +.ti +5 +throws DbException; + +public int id() +.ti +5 +throws DbException; + +public static DbLockTab open(String dir, int flags, int mode, DbEnv dbenv) +.ti +5 +throws DbException; + +public static void unlink(String dir, int force, DbEnv dbenv) +.ti +5 +throws DbException; +\} +.ft R +.fi +.SH DESCRIPTION +.Gn +.PP +This manual page describes the specific details of the locking interface. +.PP +The +.I DbLockTab +class is intended to provide general-purpose +locking. +While designed to work with the other Db classes, this class is +also useful for more general locking purposes. +Locks can be shared between processes. +In most cases, when multiple treads or processes are using locking, the +deadlock detector, +.IR db_deadlock (1), +should be run. +.if '\*[TYPE]'JAVA'\{ +.PP +The +.I vec +method (as it appears in the C and C++ APIs) +is not yet implemented for Java and so it not described. +However, understanding this function in the C or C++ API +is helpful in understanding the +.I get +method, so please refer to lock_vec in +.IR db_lock(3) . +\} +.PP +.Co "lock table" DbLockTab +.PP +.Fm +.Ft DbLockTab::open DbLockTab +.PP +.Mo "lock subsystem" +.PP +The locking subsystem is configured +.En "DbLockTab::open" "DbLockTab::close" +.TP 5 +.Se +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +const u_int8_t lk_conflicts[][];\} +.el\{\ +.TP 5 +byte[][] lk_conflicts;\} +A +.I lk_modes +by +.I lk_modes +array. +A non-0 value for the array element: +.sp +.ti +5 +lk_conflicts[requested_mode][held_mode] +.sp +indicates that requested_mode and held_mode conflict. +The ``not-granted'' mode must be represented by 0. +If +.I lk_conflicts +is NULL, the conflicts array +.I db_rw_conflicts +is used; +see the section below entitled ``STANDARD LOCK MODES'' for a description +of that array. +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +u_int32_t lk_detect;\} +.el\{\ +.TP 5 +int lk_detect;\} +If non-0, +specifies that the deadlock detector be run whenever a lock conflict occurs, +and specifies which transaction should be aborted in the case of a deadlock. +The +.I lk_detect +field must be set to one of the following values. +.RS +.TP 5 +.Sj DB_LOCK_DEFAULT +Use the default policy as specified in the +.IR db_deadlock (1) +man page. +.TP 5 +.Sj DB_LOCK_OLDEST +Abort the oldest transaction. +.TP 5 +.Sj DB_LOCK_RANDOM +Abort a random transaction involved in the deadlock. +.TP 5 +.Sj DB_LOCK_YOUNGEST +Abort the youngest transaction. +.RE +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +u_int32_t lk_max;\} +.el\{\ +.TP 5 +int lk_max;\} +The maximum number of locks to be held or requested in the table. +This value is used by +.I DbLockTab::open +to estimate how much space to allocate for various lock-table data +structures. +If +.I lk_max +is not explicitly set, a default value is used. +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +u_int32_t lk_modes;\} +.el\{\ +.TP 5 +int lk_modes;\} +.TP 5 +The number of lock modes to be recognized by the lock table (including +the ``not-granted'' mode). +If +.I lk_modes +is 0, the value DB_LOCK_RW_N is used; +see below for a description of that value. +.PP +.Rt DbLockTab::open +.PP +.Fn DbLockTab::id +The +.I DbLockTab::id +method +.ie '\*[TYPE]'CXX'\{\ +copies a locker ID, +which is guaranteed to be unique in the specified lock table, +into the memory location referenced by +.IR idp . +\} +.el\{\ +returns a locker ID, which is guaranteed to be unique in +the specified lock table. +\} +.PP +The access methods +(see +.I Db::open +in +.IR Db (3)), +generate a unique locker ID for each file that is opened with locking. +During Db access method operation, +this locker ID will be used for all lock calls unless a transaction +identifier was specified for the call, +in which case the transaction ID specified is used for locking. +.PP +.Rt DbLockTab::id +.PP +.if '\*[TYPE]'CXX'\{ +.Fn DbLockTab::vec +The +.I DbLockTab::vec +method atomically obtains and releases one or more locks from the +specified table. +The +.I DbLockTab::vec +method is intended to support acquisition or trading of multiple locks +under one lock table semaphore, +as is needed for lock coupling or in multigranularity locking for lock +escalation. +.PP +The +.I locker +argument specified to +.I DbLockTab::vec +is an unsigned 32-bit integer quantity. +It represents the entity requesting or releasing the lock. +.PP +The +.I flags +value must be set to 0 or the following value: +.TP 5 +.Sj DB_LOCK_NOWAIT +If a lock cannot be granted because the requested lock conflicts with an +existing lock, return immediately instead of waiting for the lock to +become available. +.PP +The +.I list +array provided to +.I DbLockTab::vec +is typedef'd in as DB_LOCKREQ. +A DB_LOCKREQ structure has at least the following fields, +which must be initialized before calling +.IR DbLockTab::vec : +.TP 5 +lockop_t op; +The operation to be performed, which must be set to one of the +following values: +.RS +.TP 5 +.Sj DB_LOCK_GET +Get a lock, as defined by the values of +.IR locker , +.I obj +and +.IR mode . +Upon return from +.IR DbLockTab::vec , +if the +.I lock +field is non-NULL, a reference to the acquired lock is stored there. +(This reference is invalidated by any call to +.I DbLockTab::vec +or +.I DbLock::put +that releases the lock.) +See +.IR DbLock (3). +.TP 5 +.Sj DB_LOCK_PUT +The lock referenced by the contents of the +.I lock +field is released. +.TP 5 +.Sj DB_LOCK_PUT_ALL +All locks held by the +.I locker +are released. +(Any locks acquired as a part of the current call to +.I DbLockTab::vec +that appear after the DB_LOCK_PUT_ALL entry are not considered for this +operation). +.TP 5 +.Sj DB_LOCK_PUT_OBJ +All locks held by the +.IR locker , +on the object +.IR obj , +with the mode specified by +.IR lock_mode , +are released. +A +.I lock_mode +of DB_LOCK_NG indicates that all locks on the object should be released. +Note that any locks acquired as a part of the current call to +.I DbLockTab::vec +that occur before the DB_LOCK_PUT_OBJ will also be released; those acquired +afterwards will not be released. +.RE +.TP 5 +const Dbt obj; +An untyped byte string that specifies the object to be locked or +released. +.TP 5 +const lockmode_t mode; +The lock mode, used as an index into object's +conflict array. +.TP 5 +DB_LOCK lock; +A lock reference. +.PP +The +.I nlist +argument specifies the number of elements in the +.I list +array. +.PP +If any of the requested locks cannot be acquired, +or any of the locks to be released cannot be released, +the operations before the failing operation are guaranteed to have completed +successfully, and +.I DbLockTab::vec +returns a non-zero value. +In addition, if +.I elistp +is not NULL, it is set to point to the DB_LOCKREQ entry that +was being processed when the error occurred. +.PP +In the case of an error, +.I DbLockTab::vec +may return one of the following values: +.TP 5 +.Sj DB_LOCK_DEADLOCK +The specified +.I locker +was selected as a victim in order to resolve a deadlock. +.TP 5 +.Sj DB_LOCK_NOTHELD +The lock cannot be released, as it was not held by the +.IR locker . +.TP 5 +.Sj DB_LOCK_NOTGRANTED +A lock was requested that could not be granted and the +.I flag +parameter was set to DB_LOCK_NOWAIT. +In this case, if non-NULL, +.I elistp +identifies the request that was granted. +.PP +.Ro DbLockTab::vec +.PP +\} +.Fn DbLockTab::get +The +.I DbLockTab::get +.ie '\*[TYPE]'CXX'\{\ +method is a simple interface to the +.Vc +functionality, and is equivalent to calling the +.Vc +method with the +.I locker +argument, +.I elistp +and +.I conflict +arguments, and a single element +.I list +array, for which the +.I op +field is DB_LOCK_GET, and the +.IR obj , +.I lock_mode +and +.I lock +fields are represented by the arguments of the same name. +Note that the type of the +.I obj +argument to +.I DbLockTab::get +is different from the +.I obj +element found in the DB_LOCKREQ structure. +The +.I DbLockTab::get +method returns success and failure as described for the +.Vc +method. +\} +.el\{\ +method gets a lock, as defined by the values of +.IR locker , +.I obj +and +.IR mode . +The +.I locker +argument is an unsigned 32-bit integer quantity. +It represents the entity requesting or releasing the lock. +.PP +The +.I flags +value must be set to 0 or the following value: +.TP 5 +.Sj DB_LOCK_NOWAIT +If a lock cannot be granted because the requested lock conflicts with an +existing lock, return immediately instead of waiting for the lock to +become available. +.PP +A reference to the acquired lock is returned. +(This reference is invalidated by any call to +.I DbLock::put +that releases the lock.) +See +.IR DbLock (3). +\} +.PP +.Fn DbLockTab::close +The +.I DbLockTab::close +method disassociates the calling process from the lock table. +The object should not be used after a call to close. +Note that +.I DbLockTab::close +does not release any locks still held by the closing process. +(This provides functionality for long-lived locks.) +.if '\*[TYPE]'CXX'\{ +Processes that wish to have all their locks released can do so by +issuing the appropriate +.I DbLockTab::vec +call. +\} +.PP +.Cc DbLockTab +.PP +When multiple threads are using the DbLockTab object concurrently, +only a single thread may call the +.I DbLockTab::close +method. +.PP +.Rt DbLockTab::close +.PP +.Un "lock table" DbLockTab +.PP +.Fn DbLockTab::detect +The +.I DbLockTab::detect +method runs one iteration of the deadlock detector on the current +lock table. +The deadlock detector traverses the lock table, detects deadlocks, +and if it finds one, +marks one of the participating transactions for abort and then +returns. +.PP +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.PP +.TP 5 +.Sj DB_LOCK_CONFLICT +Only run the deadlock detector if a lock conflict has occurred since +the last time that the deadlock detector was run. +.PP +The +.I atype +parameter specifies which transaction to abort in the case of deadlock. +It must be set to one of values described above for the +.I lk_detect +field of the +.I DbEnv +object. +.PP +.Rt DbLockTab::detect +.PP +.Ux DbLockTab::detect lock_detect db_deadlock +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR db_lock : +.TP 5 +.Eh DbLockTab::open +.TP 5 +.Ev "lock table" DbLockTab +.SH "STANDARD LOCK MODES" +.if '\*[TYPE]'CXX'\{ +The include file declares two commonly used conflict arrays: +.TP 5 +const u_int8_t db_lock_rw_conflicts[]; +This is a conflict array for a simple scheme using shared and exclusive +lock modes. +.TP 5 +const u_int8_t db_lock_riw_conflicts[]; +This is a conflict array that involves various intent lock modes (e.g., +intent shared) that are used for multigranularity locking. +.PP +Their associated sizes are DB_LOCK_RW_N and DB_LOCK_RIW_N. +\} +.ie '\*[TYPE]'CXX'\{ +.PP +In addition, the include file defines the type +.IR db_lockmode_t , +which is the type of the lock modes used with the standard tables above: +\} +.el\{\ +The DbLockTab class defines the following integer constants, known +elsewhere as +.IR db_lockmode_t , +which which specify the type of the lock mode used with the standard tables above: +\} +.RS +.TP 5 +.Sj DB_LOCK_NG +not granted (always 0) +.TP 5 +.Sj DB_LOCK_READ +read (shared) +.TP 5 +.Sj DB_LOCK_WRITE +write (exclusive) +.RE +.SH "ERRORS" +.Ek +.PP +.Ee DbLockTab::open +.na +.Nh +DbLock::unlink(3), +close(2), +db_version(3), +fcntl(2), +fflush(3), +lseek(2), +malloc(3), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec DbLockTab::open +.TP 5 +.Em +.TP 5 +.Ei +.sp +.Et +.if '\*[TYPE]'CXX'\{ +.PP +.Ee DbLockTab::vec +.na +.Nh +DbLock::detect(3), +fcntl(2), +fflush(3), +lseek(2), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +strerror(3), +and +write(2). +.Hy +.ad +.PP +.Ec DbLockTab::vec +.TP 5 +[EACCES] +An attempt was made to release lock held by another locker. +.TP 5 +.Ei +\} +.PP +.Ee DbLockTab::get +.na +.Nh +DbLock::detect(3), +fcntl(2), +fflush(3), +lseek(2), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +strerror(3), +and +write(2). +.Hy +.ad +.PP +.Ec DbLockTab::get +.TP 5 +.Ei +.PP +.Ee DbLockTab::close +.na +.Nh +close(2), +fcntl(2), +fflush(3), +munmap(2), +and +strerror(3). +.Hy +.ad +.PP +.Ee DbLockTab::unlink +.na +.Nh +close(2), +fcntl(2), +fflush(3), +malloc(3), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +and +unlink(2). +.Hy +.ad +.PP +.Ec DbLockTab::unlink +.TP 5 +.Eb +.PP +.Ee DbLockTab::detect +.na +.Nh +calloc(3), +fcntl(2), +fflush(3), +lseek(2), +malloc(3), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +strerror(3), +and +write(2). +.Hy +.ad +.SH "BUGS" +If a process dies while holding locks, those locks remain held and are +.B never +released. +In this case, all processes should exit as quickly as possible, so +that +.I db_recover +can be run. +.SH "SEE ALSO" +.Sa diff --git a/mozilla/db/man/mancxx.roff/DbLog.3 b/mozilla/db/man/mancxx.roff/DbLog.3 new file mode 100644 index 00000000000..ec39ed4f9b5 --- /dev/null +++ b/mozilla/db/man/mancxx.roff/DbLog.3 @@ -0,0 +1,1882 @@ +.ds TYPE CXX +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)DbLog.sox 10.15 (Sleepycat) 5/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.\" Stat field macro. +.de Sf +.ie '\*[TYPE]'CXX'\{\ +u_int32_t \\$1;\} +.el\{\ +int get_\\$1();\} +.. +.TH DbLog 3 "May 10, 1998" +.UC 7 +.SH NAME +DbLog \- log management class +.SH SYNOPSIS +.nf +.ft B +.ie '\*[TYPE]'CXX'\{ +#include + +static int +DbLog::open(const char *dir, +.ti +5 +u_int32_t flags, int mode, DbEnv *dbenv, DbLog **regionp); + +int +DbLog::close(); + +int +DbLog::flush(const DbLsn *lsn); + +int +DbLog::get(DbLsn *lsn, Dbt *data, u_int32_t flags); + +static int +DbLog::compare(const DbLsn *lsn0, const DbLsn *lsn1); + +int +DbLog::file(const DbLsn *lsn, char *namep, size_t len); + +int +DbLog::put(DbLsn *lsn, const Dbt *data, u_int32_t flags); + +static int +DbLog::unlink(const char *dir, int force, DbEnv *); + +int +DbLog::archive(char **list[], +.ti +5 +u_int32_t flags, void *(*db_malloc)(size_t)); + +int +DbLog::db_register(const Db *dbp, +.ti +5 +const char *name, DBTYPE type, u_int32_t *fidp); + +int +DbLog::db_unregister(u_int32_t fid); + +int +DbLog::stat(DB_LOG_STAT **spp, void *(*db_malloc)(size_t)); +\} +.el\{\ +import com.sleepycat.db.*; + +public static DbLog open(String dir, int flags, int mode, DbEnv dbenv) +.ti +5 +throws DbException; + +public void close() +.ti +5 +throws DbException; + +public static int compare(DbLsn lsn0, DbLsn lsn1); + +public String file(DbLsn lsn) +.ti +5 +throws DbException; + +public void flush(DbLsn lsn) +.ti +5 +throws DbException; + +public void get(DbLsn lsn, Dbt data, int flags) +.ti +5 +throws DbException; + +public void put(DbLsn lsn, Dbt data, int flags) +.ti +5 +throws DbException; + +public DbLogStat stat() +.ti +5 +throws DbException; + +public int db_register(Db dbp, String name, int dbtype) +.ti +5 +throws DbException; + +public void db_unregister(int fid) +.ti +5 +throws DbException; + +public static void unlink(String dir, int force, DbEnv dbenv) +.ti +5 +throws DbException; +\} +.ft R +.fi +.SH DESCRIPTION +.Gn +.PP +This manual page describes the specific details of the log class. +.PP +This class provide a general-purpose logging facility sufficient +for transaction management. +Logs can be shared by multiple processes. +.PP +The DB transaction log is represented by a directory containing a set of +files. +The log is a record-oriented, append-only file, with records identified +and accessed via +.IR DbLsn 's +(database log sequence numbers). +.PP +DbLsn's are returned on each +.I DbLog::put +operation, and only those DbLsn's returned by +.I DbLog::put +can later be used to retrieve records from the log. +.PP +.Co log DbLog +.PP +If the log region is being created and log files are already present, +the log files are ``recovered'' and subsequent log writes are appended +to the end of the log. +.PP +The log is stored in one or more files in the specified directory. +Each file is named using the format +.sp +.ti +5 +log.NNNNN +.sp +where ``NNNNN'' is the sequence number of the file within the log. +.PP +.Fm +.Ft DbLog::open DbLog +.PP +.Mo "log subsystem" +.PP +The logging subsystem is configured +.En "DbLog::open" "DbLog::close" +.TP 5 +.Se +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +u_int32_t lg_max;\} +.el\{\ +.TP 5 +int lg_max;\} +The maximum size of a single file in the log. +Because DbLsn file offsets are unsigned 4-byte values, +.I lg_max +may not be larger than the maximum unsigned 4-byte value. +.sp +If +.I lg_max +is 0, a default value is used. +.sp +See the section "LOG FILE LIMITS" below, for further information. +.PP +.Rt DbLog::open +.PP +.Fn DbLog::close +The +.I DbLog::close +method closes the log associated with the DbLog object. +.PP +.Cc DbLog +.PP +When multiple threads are using the DbLog handle concurrently, +only a single thread may call the +.I DbLog::close +method. +.PP +.Rt DbLog::close +.PP +.Fn DbLog::flush +The +.I DbLog::flush +method guarantees that all log records whose DbLsns are less than or +equal to the +.I lsn +parameter have been written to disk. +If +.I lsn +is NULL, +all records in the log are flushed. +.PP +.Rt DbLog::flush +.PP +.Fn DbLog::get +The +.I DbLog::get +method implements a cursor inside of the log, +retrieving records from the log according to the +.I lsn +and +.I flags +parameters. +.PP +The data field of the +.I data +object is set to the record retrieved and the size field indicates the +number of bytes in the record. +See +.IR Dbt (3) +for a description of other fields in the +.I data +object. +.ft B +When multiple threads are using the returned DbLog handle concurrently, +either the DB_DBT_MALLOC or DB_DBT_USERMEM flags must be specified for +any Dbt used for data retrieval. +.ft R +.PP +The +.I flags +parameter must be set to exactly one of the following values: +.TP 5 +.Sj DB_CHECKPOINT +The last record written with the DB_CHECKPOINT flag specified to the +.I DbLog::put +method is returned in the +.I data +argument. +The +.I lsn +argument is overwritten with the DbLsn of the record returned. +If no record has been previously written with the DB_CHECKPOINT flag +specified, +the first record in the log is returned. +.IP +If the log is empty the +.I DbLog::get +method will return DB_NOTFOUND. +.TP 5 +.Sj DB_FIRST +The first record from any of the log files found in the log directory +is returned in the +.I data +argument. +The +.I lsn +argument is overwritten with the DbLsn of the record returned. +.IP +If the log is empty the +.I DbLog::get +method will return DB_NOTFOUND. +.TP 5 +.Sj DB_LAST +The last record in the log is returned in the +.I data +argument. +The +.I lsn +argument is overwritten with the DbLsn of the record returned. +.IP +If the log is empty, +the +.I DbLog::get +method will return DB_NOTFOUND. +.TP 5 +.Sj DB_NEXT +The current log position is advanced to the next record in the log and that +record is returned in the +.I data +argument. +The +.I lsn +argument is overwritten with the DbLsn of the record returned. +.IP +If the pointer has not been initialized via DB_FIRST, DB_LAST, +DB_SET, DB_NEXT, or DB_PREV, +.I DbLog::get +will return the first record in the log. +If the last log record has already been returned or the log is empty, +the +.I DbLog::get +method will return DB_NOTFOUND. +.IP +If the log was opened with the DB_THREAD flag set, +calls to +.I DbLog::get +with the DB_NEXT flag set will return EINVAL. +.TP 5 +.Sj DB_PREV +The current log position is moved to the previous record in the log and that +record is returned in the +.I data +argument. +The +.I lsn +argument is overwritten with the DbLsn of the record returned. +.IP +If the pointer has not been initialized via DB_FIRST, DB_LAST, +DB_SET, DB_NEXT, or DB_PREV, +.I DbLog::get +will return the last record in the log. +If the first log record has already been returned or the log is empty, +the +.I DbLog::get +method will return DB_NOTFOUND. +.IP +If the log was opened with the DB_THREAD flag set, +calls to +.I DbLog::get +with the DB_PREV flag set will return EINVAL. +.TP 5 +.Sj DB_CURRENT +Return the log record currently referenced by the log. +.IP +If the log pointer has not been initialized via DB_FIRST, DB_LAST, DB_SET, +DB_NEXT, or DB_PREV, or if the log was opened with the DB_THREAD flag set, +.I DbLog::get +will return EINVAL. +.Sj DB_SET +Retrieve the record specified by the +.I lsn +argument. +If the specified DbLsn is invalid (e.g., does not appear in the log) +.I DbLog::get +will return EINVAL. +.PP +.Ro DbLog::get +.PP +.Fn DbLog::compare +The +.I DbLog::compare +method allows the caller to compare two DbLsn's. +.I DbLog::compare +returns 0 if the two DbLsn's are equal, 1 if +.I lsn0 +is greater than +.IR lsn1 , +and -1 if +.I lsn0 +is less than +.IR lsn1 . +.PP +.Fn DbLog::file +The +.I DbLog::file +method maps DbLsn's to file names. +The +.I DbLog::file +method +.ie '\*[TYPE]'CXX'\{\ +copies the name of the file containing the record named by +.I lsn +into the memory location referenced by +.IR namep . +(This mapping of DbLsn to file is needed for database administration. +For example, a transaction manager typically records the earliest DbLsn +needed for restart, and the database administrator may want to archive +log files to tape when they contain only DbLsn's before the earliest one +needed for restart.) +.PP +The +.I len +argument is the length of the +.I namep +buffer in bytes. +If +.I namep +is too short to hold the file name, +.I DbLog::file +will return ENOMEM. +Note, as described above, +log file names are quite short, +on the order of 10 characters. +\} +.el\{\ +returns the name of the file containing the record named by +.IR lsn . +(This mapping of DbLsn to file is needed for database administration. +For example, a transaction manager typically records the earliest DbLsn +needed for restart, and the database administrator may want to archive +log files to tape when they contain only DbLsn's before the earliest one +needed for restart.) +\} +.PP +.Rt DbLog::file +.PP +.Fn DbLog::put +The +.I DbLog::put +method appends records to the log. +The DbLsn of the put record is returned in the +.I lsn +parameter. +The +.I flags +parameter may be set to one of the following values: +.TP 5 +.Sj DB_CHECKPOINT +The log should write a checkpoint record, recording any information +necessary to make the log structures recoverable after a crash. +.TP 5 +.Sj DB_CURLSN +The DB_LSN of the next record to be put is returned in the +.I lsn +parameter. +.TP 5 +.Sj DB_FLUSH +The log is forced to disk after this record is written, guaranteeing +that all records with DbLsns less than or equal to the one being put +are on disk +before this method returns (this function is most often used for +a transaction commit, see +.I Db::Txn +in +Db (3)). +.PP +The caller is responsible for providing any necessary structure to +.IR data . +(For example, in a write-ahead logging protocol, the application must +understand what part of +.I data +is an operation code, what part is redo information, and what part is +undo information. +In addition, most transaction managers will store in +.I data +the DbLsn of the previous log record for the same transaction, +to support chaining back through the transaction's log records +during undo.) +.PP +.Rt DbLog::put +.PP +.Un "log region" DbLog +.PP +.Fn DbLog::archive +The +.I DbLog::archive +method creates +.ie '\*[TYPE]'CXX'\{\ +a NULL-terminated +array of log or database file names +and copies a pointer to them into the user-specified memory location +.IR list . +\} +.el \{\ +and returns an array of log or database file names. +\} +.PP +By default, +.I DbLog::archive +returns the names of all of the log files that are no longer in use (e.g., +no longer involved in active transactions), +and that may be archived for catastrophic recovery and then removed +from the system. +If there were no file names to return, +.I list +will be set to NULL. +.PP +.if '\*[TYPE]'CXX'\{\ +.Ma "Arrays of log file names" +\} +.PP +The +.I flags +argument is specified by +.BR or 'ing +together one or more of the following values: +.TP 5 +.Sj DB_ARCH_ABS +All pathnames are returned as absolute pathnames, +instead of relative to the database home directory. +.TP 5 +.Sj DB_ARCH_DATA +Return the database files that need to be archived in order to recover +the database from catastrophic failure. +If any of the database files have not been accessed during the lifetime of +the current log files, +.I DbLog::archive +will not include them in this list. +It is also possible that some of the files referenced in the log have +since been deleted from the system. +.TP 5 +.Sj DB_ARCH_LOG +Return all the log file names regardless of whether or not they are in +use. +.PP +The DB_ARCH_DATA and DB_ARCH_LOG flags are mutually exclusive. +.PP +.Rt DbLog::archive +.PP +.Ux DbLog::archive log_archive db_archive +See the +.IR db_archive (1) +manual page for more information on database archival procedures. +.PP +.Fn DbLog::db_register +The +.I DbLog::db_register +method registers a file name with the log manager and +.ie '\*[TYPE]'CXX'\{\ +copies a file +identification number into the memory location referenced by +.IR fidp . +\} +.el\{\ +returns a file identification number. +\} +This file identification number should be used in all subsequent log +messages that refer to operations on this file. +The log manager records all file name to file identification number mappings +at each checkpoint so that a recovery process can identify the file to which +a record in the log refers. +.PP +The +.I DbLog::db_register +method is called when an access method registers the open of a file. +The +.I dbp +parameter should be a +.if '\*[TYPE]'CXX'\{\ +pointer to the +\} +Db object which is being returned +by the access method. +.PP +The +.I type +parameter should be one of the Db types specified in +.I Db::open +.IR (see Db (3)), +e.g., DB_HASH. +.PP +.Rt DbLog::db_register +.PP +.Fn DbLog::db_unregister +The +.I DbLog::db_unregister +method disassociates the file name to file identification number +mapping for the file identification number specified by the +.I fid +parameter. +The file identification number may then be reused. +.PP +.Rt DbLog::db_unregister +.PP +.Fn DbLog::stat +The +.I DbLog::stat +function creates a statistical structure and +.ie '\*[TYPE]'CXX'\{\ +copies a pointer to it into +the user-specified memory location. +\} +.el\{\ +returns it to the caller. +\} +.PP +.Ma "Statistical structures" +The log statistics are stored in a +.ie '\*[TYPE]'CXX'\{\ +structure of type +DB_LOG_STAT (typedef'd in ). +The following DB_LOG_STAT fields will be filled in: +\} +.el\{\ +DbLogStat object. Data fields in DbLogStat can be accessed +via +.I get +methods. +\} +.TP 5 +.Sf st_magic +The magic number that identifies a file as a log file. +.Nt +.Sf st_version +The version of the log file type. +.Nt +.Sf st_refcnt +The number of references to the region. +.Nt +.Sf st_regsize +The size of the region. +.Nt +.Sf st_mode +The mode of any created log files. +.Nt +.Sf st_lg_max +The maximum size of any individual file comprising the log. +.Nt +.Sf st_written +The total number of bytes written to this log. +.Nt +.Sf st_written_chkpt +The number of bytes written since the last checkpoint. +.Nt +.Sf st_region_wait +The number of times that a process was able to obtain +the region lock without waiting. +.Nt +.Sf st_region_nowait +The number of times that a process was forced to wait before +obtaining the region lock. +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)limits.so 8.1 (Sleepycat) 5/3/98 +.\" +.de Ll +.SH "LOG FILE LIMITS +Log file sizes impose a time limit on the length of time a database +may be accessed under transaction protection, before it needs to be +dumped and reloaded (see +.IR db_dump(3) +and +.IR db_load(3)). +Unfortunately, the limits are potentially difficult to calculate. +.PP +The log file name consists of "log." followed by 5 digits, resulting +in a maximum of 99,999 log files. +Consider an application performing 600 transactions per second, for +15 hours a day, logged into 10Mb log files, where each transaction +is logging approximately 100 bytes of data. The calculation: +.PP +.nf +.RS +(10 * 2^20 * 99999) / +.ti +5 +(600 * 60 * 60 * 15 * 100) = 323.63 +.RE +.fi +.PP +indicates that the system will run out of log file space in +roughly 324 days. +If we increase the maximum size of the files from 10Mb to 100Mb, +the same calculation indicates that the application will run out +of log file space in roughly 9 years. +.PP +There is no way to reset the log file name space in Berkeley DB. +If your application is reaching the end of its log file name space, +you should: +.TP 5 +1. +Archive your databases as if to prepare for catastrophic failure (see +.IR db_archive (1) +for more information). +.TP 5 +2. +Dump and re-load +.B all +your databases (see +.IR db_dump (1) +and +.IR db_load (1) +for more information). +.TP 5 +3. +Remove all of the log files from the database environment (see +.IR db_archive (1) +for more information). +.TP 5 +4. +Restart your applications. +.. +.de Tl +.SH "TRANSACTION ID LIMITS +The transaction ID space in Berkeley DB is 2^31, or 2 billion entries. +It is possible that some environments may need to be aware of this +limitation. +Consider an application performing 600 transactions a second for 15 +hours a day. +The transaction ID space will run out in roughly 66 days: +.PP +.nf +.RS +2^31 / (600 * 15 * 60 * 60) = 66 +.RE +.fi +.PP +Doing only 100 transactions a second exhausts the transaction ID space +in roughly one year. +.PP +The transaction ID space is reset each time recovery is run. +If you reach the end of your transaction ID space, +shut down your applications and restart them after running recovery (see +.IR db_recover (1) +for more information). +The most recently allocated transaction ID is the +.I st_last_txnid +value in the transaction statistics information, and is displayed by the +.IR db_stat (1) +utility. +.. +.Ll +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR db_log : +.TP 5 +.Eh DbLog::open DB_LOG_DIR +.TP 5 +.Ev log DbLog +.SH ERRORS +.Ek +.PP +.Ee DbLog::open +.na +.Nh +DbLog::close(3), +DbLog::unlink(3), +atoi(3), +close(2), +db_version(3), +fcntl(2), +fflush(3), +lseek(2), +malloc(3), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +open(2), +opendir(3), +read(2), +readdir(3), +realloc(3), +sigfillset(3), +sigprocmask(2), +stat(2), +strchr(3), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +strncmp(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec DbLog::open +.TP 5 +.Em +.TP 5 +.Ei +.sp +.Et +.sp +The specified file size was too large. +.PP +.Ee DbLog::close +.na +.Nh +close(2), +fcntl(2), +fflush(3), +munmap(2), +and +strerror(3). +.Hy +.ad +.PP +.Ee DbLog::flush +.na +.Nh +close(2), +fcntl(2), +fflush(3), +fsync(2), +lseek(2), +malloc(3), +memcpy(3), +memset(3), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec DbLog::flush +.TP 5 +.Ei +.PP +.Ee DbLog::get +.na +.Nh +atoi(3), +close(2), +fcntl(2), +fflush(3), +lseek(2), +malloc(3), +memcpy(3), +memset(3), +open(2), +opendir(3), +read(2), +readdir(3), +realloc(3), +sigfillset(3), +sigprocmask(2), +stat(2), +strchr(3), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +strncmp(3), +and +unlink(2). +.Hy +.ad +.PP +.Ec DbLog::get +.TP 5 +.Ei +.sp +The DB_FIRST flag was specified and no log files were found. +.PP +.Ee DbLog::file +.na +.Nh +close(2), +fcntl(2), +fflush(3), +malloc(3), +memcpy(3), +memset(3), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +and +unlink(2). +.Hy +.ad +.PP +.Ec DbLog::file +.TP 5 +[ENOMEM] +The supplied buffer was too small to hold the log file name. +.PP +.Ee DbLog::put +.na +.Nh +close(2), +fcntl(2), +fflush(3), +fsync(2), +lseek(2), +malloc(3), +memcpy(3), +memset(3), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +time(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec DbLog::put +.TP 5 +.Ei +.sp +The record to be logged is larger than the maximum log record. +.PP +.Ee DbLog::unlink +.na +.Nh +close(2), +fcntl(2), +fflush(3), +malloc(3), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +and +unlink(2). +.Hy +.ad +.PP +.Ec DbLog::unlink +.TP 5 +.Eb +.PP +.Ee DbLog::archive +.na +.Nh +DbLog::compare(3), +DbLog::get(3), +close(2), +fcntl(2), +fflush(3), +getcwd(3), +malloc(3), +memcpy(3), +memset(3), +open(2), +qsort(3), +realloc(3), +sigfillset(3), +sigprocmask(2), +stat(2), +strchr(3), +strcmp(3), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +and +unlink(2). +.Hy +.ad +.PP +.Ec DbLog::archive +.TP 5 +.Ei +.sp +The log was corrupted. +.PP +.Ee DbLog::db_register +.na +.Nh +close(2), +fcntl(2), +fflush(3), +fsync(2), +lseek(2), +malloc(3), +memcmp(3), +memcpy(3), +memset(3), +open(2), +realloc(3), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +time(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec DbLog::db_register +.TP 5 +.Ei +.PP +.Ee DbLog::db_unregister +.na +.Nh +close(2), +fcntl(2), +fflush(3), +fsync(2), +lseek(2), +malloc(3), +memcpy(3), +memset(3), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +time(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec DbLog::db_unregister +.TP 5 +.Ei +.SH BUGS +The log files are not machine architecture independent. +Specifically, their metadata are not stored in a fixed byte order. +.SH "SEE ALSO" +.Sa diff --git a/mozilla/db/man/mancxx.roff/DbLsn.3 b/mozilla/db/man/mancxx.roff/DbLsn.3 new file mode 100644 index 00000000000..8ead80e1bb8 --- /dev/null +++ b/mozilla/db/man/mancxx.roff/DbLsn.3 @@ -0,0 +1,893 @@ +.ds TYPE CXX +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)DbLsn.sox 10.4 (Sleepycat) 4/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DbLsn 3 "April 10, 1998" +.UC 7 +.SH NAME +DbLsn \- Log sequence numbers +.SH SYNOPSIS +.nf +.ft B +.ie '\*[TYPE]'CXX'\{ +#include +\} +.el\{\ +import com.sleepycat.db.*; +\} +.ft R +.fi +.SH DESCRIPTION +.Gn +.PP +This manual page describes the DbLsn class. +.PP +A DbLsn is a "log sequence number" that is fully encapsulated. +The class itself has no methods, other than a default constructor, +so there is no way for the user to manipulate its data directly. +It is initialized and used by methods in +.IR DbLog (3) +and +.IR DbMpool (3). +.if '\*[TYPE]'CXX'\{\ +These methods always accept a pointer to a DbLsn. +\} +.SH "SEE ALSO" +.Sa diff --git a/mozilla/db/man/mancxx.roff/DbMpool.3 b/mozilla/db/man/mancxx.roff/DbMpool.3 new file mode 100644 index 00000000000..61c5728b05f --- /dev/null +++ b/mozilla/db/man/mancxx.roff/DbMpool.3 @@ -0,0 +1,1575 @@ +.ds TYPE CXX +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)DbMpool.sox 10.22 (Sleepycat) 5/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.\" Stat field macro. +.de Sf +.ie '\*[TYPE]'CXX'\{\ +u_int32_t \\$1;\} +.el\{\ +int get_\\$1();\} +.. +.TH DbMpool 3 "May 10, 1998" +.UC 7 +.SH NAME +DbMpool \- shared memory buffer pool +.SH SYNOPSIS +.nf +.ft B +.ie '\*[TYPE]'CXX'\{ +#include + +static int +DbMpool::open(char *dir, +.ti +5 +u_int32_t flags, int mode, DbEnv *dbenv, DbMpool **regionp); + +int +DbMpool::close(); + +static int +DbMpool::unlink(const char *dir, int force, DbEnv *); + +int +DbMpool::db_register(int ftype, +.ti +5 +int (*pgin)(db_pgno_t pgno, void *pgaddr, Dbt *pgcookie), +.ti +5 +int (*pgout)(db_pgno_t pgno, void *pgaddr, Dbt *pgcookie)); + +int +DbMpool::trickle(int pct, int *nwrotep); + +int +DbMpool::sync(LSN *lsn); + +int +DbMpool::stat(DB_MPOOL_STAT **gsp, +.ti +5 +DB_MPOOL_FSTAT *(*fsp)[], void *(*db_malloc)(size_t)); +\} +.el\{\ +import com.sleepycat.db.*; + +public DbMpoolStat stat() +.ti +5 +throws DbException; + +public DbMpoolFStat[] fstat() +.ti +5 +throws DbException; + +public int trickle(int pct) +.ti +5 +throws DbException; + +\} +.ft R +.fi +.SH DESCRIPTION +.Gn +.PP +This manual page describes the specific details of the memory pool interface. +.PP +The +.IR DbMpool (3) +.ie '\*[TYPE]'CXX'\{\ +and +.IR DbMpoolFile (3) +classes are +\} +.el\{\ +class is +\} +the library interface intended to provide general-purpose, +page-oriented buffer management of one or more files. +While designed to work with the other Db classes, this class is +also useful for more general purposes. +The memory pools (DbMpool's) are referred to in this document as +simply ``pools''. +.if '\*[TYPE]'JAVA'\{\ +The DbMpool class has a small subset of the corresponding DB/C++ +functionality. This class has been provided to allow certain +administrative actions on underlying Mpool's opened as a consequence +of DbEnv.appinit(). Direct access to other Mpool functionality is +not appropriate for the Java environment. +\} +.if '\*[TYPE]'CXX'\{\ +Pools may be shared between processes. +Pools are usually filled by pages from one or more files (DbMpoolFile's). +Pages in the pool are replaced in LRU (least-recently-used) order, +with each new page replacing the page that has been unused the longest. +Pages retrieved from the pool using +.I DbMpoolFile::get +are ``pinned'' in the pool, by default, +until they are returned to the pool's control using the +.I DbMpoolFile::put +method. +.PP +.Co "memory pool" DbMpool +.PP +.Fm +.Sj DB_MPOOL_PRIVATE +Create a private MPOOL that is not shared with any other process (although +it may be shared with other threads). +.Sj DB_NOMMAP +Always copy files in this memory pool into the local cache instead of mapping +them into process memory (see the description of the +.I mp_mmapsize +field of the DbEnv object for further information). +.Ft DbMpool::open DbMpool +.PP +.Mo "memory pool subsystem (other than files created by the \fImemp_fopen\fP method, which are separately specified)" +.PP +The memory pool subsystem is configured +.En "DbMpool::open" "DbMpool::closed" +.TP 5 +.Se +.TP 5 +size_t mp_mmapsize; +Files that are opened read-only in the pool (and that satisfy a few other +criteria) are, by default, +mapped into the process address space instead of being copied into the local +cache. +This can result in better-than-usual performance, +as available virtual memory is normally much larger than the local cache, +and page faults are faster than page copying on many systems. +However, +in the presence of limited virtual memory it can cause resource starvation, +and in the presence of large databases, +it can result in immense process sizes. +If +.I mp_mmapsize +is non-zero, +it specifies the maximum file size, in bytes, +for a file to be mapped into the process address space. +By default, +it is set to 10Mb. +.TP 5 +size_t mp_size; +The suggested size of the pool, in bytes. +This should be the size of the normal working data set of the application, +with some small amount of additional memory for unusual situations. +(Note, +the working set is not the same as the number of simultaneously referenced +pages, +and should be quite a bit larger!) +The default cache size is 128K bytes (16 8K byte pages), +and may not be less than 20K bytes. +.PP +.Rt DbMpool::open +.PP +.Fn DbMpool::close +The +.I DbMpool::close +method closes the pool indicated by the DbMpool object, +as returned by +.IR DbMpool::open . +This method does not imply a call to +.IR DbMpoolFile::sync , +but does imply a call to +.I DbMpoolFile::close +for any remaining open DbMpoolFile objects returned to this process by +calls to +.IR DbMpoolFile::open . +.PP +.Cc DbMpool +.PP +When multiple threads are using the DbMpool handle concurrently, +only a single thread may call the +.I DbMpool::close +method. +.PP +.Rt DbMpool::close +.PP +.Un "memory pool" DbMpool +.PP +.Fn DbMpool::db_register +The +.I DbMpool::db_register +method registers page-in and page-out functions for files of type +.I ftype +in the specified pool. +.PP +If the +.I pgin +function is non-NULL, +it is called each time a page is read into the memory pool from a file +of type +.IR ftype , +or a page is created for a file of type +.I ftype +(see the DB_MPOOL_CREATE flag for the +.I DbMpoolFile::get +method). +If the +.I pgout +function is non-NULL, +it is called each time a page is written to a file of type +.IR ftype . +.PP +Both the +.I pgin +and +.I pgout +functions are called with the page number, +a pointer to the page being read or written, +and any argument +.I pgcookie +that was specified to the +.I DbMpoolFile::open +method when the file was opened. +The +.I pgin +and +.I pgout +functions should return 0 on success, +and an applicable non-zero +.I errno +value on failure, +in which case the +.I DbMpool +method calling it will also fail, +returning that +.I errno +value. +.PP +The purpose of the +.I DbMpool::db_register +method is to support processing when pages are entered into, +or flushed from, +the pool. +A file type must be specified to make it possible for unrelated +threads or processes, +that are sharing a pool, +to evict each other's pages from the pool. +Applications should call +.IR DbMpool::db_register , +during initialization, +for each type of file requiring input or output processing that will be +sharing the underlying pool. +(No registry is necessary for the standard access method types, +btree, hash and recno, as +.IR Db::open (3) +registers them separately.) +.PP +If a thread or process does not call +.I DbMpool::db_register +for a file type, +it is impossible for it to evict pages for any file requiring input or +output processing from the pool. +For this reason, +.I DbMpool::db_register +should always be called by each application sharing a pool for each type of +file included in the pool, +regardless of whether or not the application itself uses files of that type. +.PP +There are no standard values for +.IR ftype , +.IR pgin , +.I pgout +and +.IR pgcookie , +except that the +.I ftype +value for a file must be a non-zero positive number, +as negative numbers are reserved for internal use by the DB library. +For this reason, +applications sharing a pool must coordinate their values amongst themselves. +.PP +.Rt DbMpool::db_register +\} +.PP +.Fn DbMpool::trickle +The +.I DbMpool::trickle +method ensures that at least +.I pct +percent of the pages in the shared memory pool are clean by writing dirty +pages to their backing files. +.ie '\*[TYPE]'CXX'\{\ +If the +.I nwrotep +argument is non-NULL, +the number of pages that were written to reach the correct percentage is +returned in the memory location it references. +\} +.el\{\ +The number of pages that were written to reach the correct percentage is +returned. +\} +.PP +The purpose of the +.I DbMpool::trickle +method is to enable a memory pool manager to ensure that a page is +always available for reading in new information without having to wait +for a write. +.PP +.Rt DbMpool::trickle +.if '\*[TYPE]'CXX'\{\ +.PP +.Fn DbMpool::sync +The +.I DbMpool::sync +method ensures that all the modified pages in the pool with log sequence +numbers (LSNs) less than the +.I lsn +argument are written to disk. +.PP +.Rc DbMpool::sync +and DB_INCOMPLETE if there were pages which need to be written but which +.I DbMpool::sync +was unable to write immediately. +In addition, +if +.I DbMpool::sync +returns success, +the value of +.I lsn +will be overwritten with the largest LSN from any page which was written by +.I DbMpool::sync +to satisfy this request. +.PP +The purpose of the +.I DbMpool::sync +method is to enable a transaction manager to ensure, +as part of a checkpoint, +that all pages modified by a certain time have been written to disk. +Pages in the pool which cannot be written back to disk immediately (e.g., +are currently pinned) are written to disk as soon as it is possible to do +so. +The expected behavior of the transaction manager is to call the +.I DbMpool::sync +method and then, +if the return indicates that some pages could not be written immediately, +to wait briefly and retry again with the same LSN until the +.I DbMpool::sync +method returns that all pages have been written. +.PP +To support the +.I DbMpool::sync +functionality, +it is necessary that the pool methods know the location of the LSN on +the page for each file type. +This location should be specified when the file is opened using the +.I DbMpoolFile::open +method. +(Note, it is not required that the LSN be aligned on the page in any way.) +\} +.PP +.Fn DbMpool::stat +.ie '\*[TYPE]'CXX'\{ +The +.I DbMpool::stat +method creates statistical structures and copies +pointers to them into +user-specified memory locations. +\} +.el\{\ +.Fn DbMpool::fstat +The +.I DbMpool::stat +and +.I DbMpool::fstat +methods create statistical structures and return +to the caller. +\} +The statistics include the number of files participating in the pool, +the active pages in the pool, +and information as to how effective the cache has been. +.PP +.Ma "Statistical structures" +.PP +.ie '\*[TYPE]'CXX'\{\ +If +.I gsp +is non-NULL, the global statistics for the memory pool +object +are copied into the memory location it references. +The global statistics are stored in a structure of type +DB_MPOOL_STAT (typedef'd in ). +.PP +The following DB_MPOOL_STAT fields will be filled in: +.TP 5 +u_int32_t st_refcnt; +The number of references to the region. +.Nt +u_int32_t st_regsize; +The size of the region. +.Nt +size_t st_cachesize; +\} +.el\{\ +The +.I stat +method creates a DbMpoolStat object containing global +statistics. The fields can be accessed via methods: +.TP 5 +long get_st_cachesize(); +\} +Cache size in bytes. +.Nt +.Sf st_cache_hit +Requested pages found in the cache. +.Nt +.Sf st_cache_miss +Requested pages not found in the cache. +.Nt +.Sf st_map +Requested pages mapped into the process' address space (there is no +available information as to whether or not this request caused disk I/O, +although examining the application page fault rate may be helpful). +.Nt +.Sf st_page_create +Pages created in the cache. +.Nt +.Sf st_page_in +Pages read into the cache. +.Nt +.Sf st_page_out +Pages written from the cache to the backing file. +.Nt +.Sf st_ro_evict +Clean pages forced from the cache. +.Nt +.Sf st_rw_evict +Dirty pages forced from the cache. +.Nt +.Sf st_hash_buckets +Number of hash buckets in buffer hash table. +.Nt +.Sf st_hash_searches +Total number of buffer hash table lookups. +.Nt +.Sf st_hash_longest +The longest chain ever encountered in buffer hash table lookups. +.Nt +.Sf st_hash_examined +Total number of hash elements traversed during hash table lookups. +.Nt +.Sf st_page_clean +Clean pages currently in the cache. +.Nt +.Sf st_page_dirty +Dirty pages currently in the cache. +.Nt +.Sf st_page_trickle +Dirty pages written using the +.I memp_trickle +interface. +.PP +.ie '\*[TYPE]'CXX'\{\ +If +.I fsp +is non-NULL, +a pointer to a NULL-terminated variable length array of statistics for +individual files +in the memory pool +is copied into the memory location it references. +If no individual files currently exist in the memory pool, +.I fsp +will be set to NULL. +.PP +The per-file statistics are stored in structures of type +DB_MPOOL_FSTAT (typedef'd in ). +The following DB_MPOOL_FSTAT fields will be filled in for each file in the +pool, i.e., each element of the array: +.TP 5 +char *file_name; +The name of the file. +.Nt +size_t st_pagesize; +\} +.el\{\ +The +.I fstat +method creates an array of DbMpoolFStat objects containing +statistics for individual files in the pool. Each DbMpoolFStat +object contains statistics for an individual DbMpoolFile, and +the statistics can be accessed via methods: +.TP 5 +String get_file_name(); +The name of the file. +.Nt +long get_st_pagesize(); +\} +Page size in bytes. +.Nt +.Sf st_cache_hit +Requested pages found in the cache. +.Nt +.Sf st_cache_miss +Requested pages not found in the cache. +.Nt +.Sf st_map +Requested pages mapped into the process' address space. +.Nt +.Sf st_page_create +Pages created in the cache. +.Nt +.Sf st_page_in +Pages read into the cache. +.Nt +.Sf st_page_out +Pages written from the cache to the backing file. +.PP +.Rt DbMpool::stat +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the behavior of +.IR DbMpoolFile : +.TP 5 +.Eh DbMpool::open +.TP 5 +.Ev "memory pool" DbMpool +.SH ERRORS +.Ek +.if '\*[TYPE]'CXX'\{\ +.PP +.Ee DbMpool::open +.na +.Nh +DBmemp->pgin(3), +DBmemp->pgout(3), +DbLog::compare(3), +DbLog::flush(3), +DbMpool::close(3), +DbMpool::unlink(3), +close(2), +db_version(3), +fcntl(2), +fflush(3), +fsync(2), +lseek(2), +malloc(3), +memcmp(3), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +time(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec DbMpool::open +.TP 5 +.Em +.TP 5 +.Ei +.sp +.Et +.sp +A NULL pathname was specified without the DB_MPOOL_PRIVATE flag. +.sp +The specified cache size was impossibly small. +.PP +.Ee DbMpool::close +.na +.Nh +DbMpoolFile::close(3), +close(2), +fcntl(2), +fflush(3), +munmap(2), +and +strerror(3). +.Hy +.ad +.PP +.Ee DbMpool::unlink +.na +.Nh +close(2), +fcntl(2), +fflush(3), +malloc(3), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +and +unlink(2). +.Hy +.ad +.PP +.Ec DbMpool::unlink +.TP 5 +.Eb +.PP +.Ee DbMpool::db_register +.na +.Nh +fcntl(2), +and +malloc(3). +.Hy +.ad +\} +.PP +.Ee DbMpool::trickle +.na +.Nh +DBmemp->pgin(3), +DBmemp->pgout(3), +DbLog::compare(3), +DbLog::flush(3), +close(2), +fcntl(2), +fflush(3), +fsync(2), +lseek(2), +malloc(3), +memcmp(3), +memcpy(3), +memset(3), +mmap(2), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +time(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec DbMpool::trickle +.TP 5 +.Ei +.if '\*[TYPE]'CXX'\{\ +.PP +.Ee DbMpool::sync +.na +.Nh +DBmemp->pgin(3), +DBmemp->pgout(3), +DbLog::compare(3), +DbLog::flush(3), +close(2), +fcntl(2), +fflush(3), +fsync(2), +lseek(2), +malloc(3), +memcmp(3), +memcpy(3), +memset(3), +mmap(2), +open(2), +qsort(3), +realloc(3), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +time(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec DbMpool::sync +.TP 5 +.Ei +.sp +The +.I DbMpool::sync +method was called without logging having been initialized in the environment. +\} +.PP +.Ee DbMpool::stat +.na +.Nh +fcntl(2), +malloc(3), +memcpy(3), +and +strlen(3). +.Hy +.ad +.SH "SEE ALSO" +.Sa diff --git a/mozilla/db/man/mancxx.roff/DbMpoolFile.3 b/mozilla/db/man/mancxx.roff/DbMpoolFile.3 new file mode 100644 index 00000000000..646a4453d96 --- /dev/null +++ b/mozilla/db/man/mancxx.roff/DbMpoolFile.3 @@ -0,0 +1,1432 @@ +.ds TYPE CXX +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)DbMpoolFile.sox 10.12 (Sleepycat) 5/2/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DbMpoolFile 3 "May 2, 1998" +.UC 7 +.SH NAME +DbMpoolFile \- shared memory buffer pool +.SH SYNOPSIS +.nf +.ft B +#include + +static int +DbMpoolFile::open(DbMpool *mp, char *file, u_int32_t flags, int mode, +.ti +5 +size_t pagesize, DbMpoolFinfo *finfop, DbMpoolFile **mpf); + +int +DbMpoolFile::close(); + +int +DbMpoolFile::get(db_pgno_t *pgnoaddr, u_int32_t flags, void **pagep); + +int +DbMpoolFile::put(void *pgaddr, u_int32_t flags); + +int +DbMpoolFile::set(void *pgaddr, u_int32_t flags); + +int +DbMpoolFile::sync(); +.ft R +.fi +.SH DESCRIPTION +.Gn +.PP +This manual page describes the specific details of the per-file +memory pool interface. +.PP +The +.IR DbMpool (3) +and +.IR DbMpoolFile (3) +classes are the library interface intended to provide general-purpose, +page-oriented buffer management of one or more files. +While designed to work with the other Db functions, these functions are +also useful for more general purposes. +The memory pools (\c +.IR DbMpool:: 's) +are referred to in this document as simply ``pools''. +Pools may be shared between processes. +Pools are usually filled by pages from one or more files (\c +.IR DbMpoolFile 's). +Pages in the pool are replaced in LRU (least-recently-used) order, +with each new page replacing the page that has been unused the longest. +Pages retrieved from the pool using +.I DbMpoolFile::get +are ``pinned'' in the pool, by default, +until they are returned to the pool's control using the +.I DbMpoolFile::put +method. +.PP +.Fn DbMpoolFile::open +The +.I DbMpoolFile::open +method opens a file in the pool specified by the +.I DbMpool +argument, +copying the DbMpoolFile pointer representing it into the memory +location referenced by +.IR mpf . +.PP +The +.I file +argument is the name of the file to be opened. +If +.I file +is NULL, +a private file is created that cannot be shared with any other process +(although it may be shared with other threads). +.PP +.Fm +.TP 5 +.Sj DB_NOMMAP +Always copy this file into the local cache instead of mapping it into +process memory (see the description of the +.I mp_mmapsize +field of the DbEnv object for further information). +.TP 5 +.Sj DB_RDONLY +Open any underlying files for reading only. +Any attempt to write the file using the pool functions will fail, +regardless of the actual permissions of the file. +.PP +.Mo "method \fIDbMpoolFile::open\fP" +.PP +The +.I pagesize +argument is the size, in bytes, +of the unit of transfer between the application and the pool, +although it is not necessarily the unit of transfer between the pool and +the source file. +.PP +Files opened in the pool may be further configured based on the +.I finfop +argument to +.IR memp_fopen , +which is a pointer to a structure of type DB_MPOOL_FINFO (typedef'd +in ). +No references to the +.I finfop +structure are maintained by DB, so it may be discarded when the +.I memp_fopen +function returns. +In order to ensure compatibility with future releases of DB, all fields +of the DB_MPOOL_FINFO structure that are not explicitly set should be +initialized to 0 before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the +C library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_MPOOL_FINFO structure used by +.I DbMpoolFile::open +are described below. +If +.I finfop +is NULL or any of its fields are set to their default value, +defaults appropriate for the system are used. +.TP 5 +int ftype; +The +.I ftype +field should be the same as a +.I ftype +argument previously specified to the +.I DbMpool::db_register +method, +unless no input or output processing of the file's pages are necessary, +in which case it should be 0. +(See the description of the +.I DbMpool::db_register +method for more information.) +.TP 5 +DBT *pgcookie; +The +.I pgcookie +argument contains the byte string that is passed to the +.I pgin +and +.I pgout +functions for this file, if any. +If no +.I pgin +or +.I pgout +functions are specified, the +.I pgcookie +field should be NULL. +(See the description of the +.I DbMpool::db_register +method for more information.) +.TP 5 +u_int8_t *fileid; +The +.I fileid +field is a unique identifier for the file. +The mpool +functions must be able to uniquely identify files in order that multiple +processes sharing a file will correctly share its underlying pages. +Normally, the +.I fileid +field should be NULL and the mpool functions will use the file's +device and inode numbers (see +.IR stat (2)) +for this purpose. +On some filesystems, (e.g., FAT or NFS) file device and inode numbers are +not necessarily unique across system reboots. +.ft B +Applications wanting to maintain a shared memory buffer pool across system +reboots, where the pool contains pages from files stored on such filesystems, +must specify a unique file identifier to the +.I DbMpoolFile::open +call and each process opening or registering the file must provide the same +unique identifier. +.ft R +If the +.I fileid +field is non-NULL, +it must reference a DB_FILE_ID_LEN (as defined in ) length array of +bytes that will be used to uniquely identify the file. +This should not be necessary for most applications. +Specifically, it is not necessary if the memory pool is re-instantiated after +each system reboot, the application is using the Db access methods instead of +calling the pool functions explicitly, or the files in the memory pool are +stored on filesystems where the file device and inode numbers do not change +across system reboots. +.TP 5 +int32_t lsn_offset; +The +.I lsn_offset +argument is the zero-based byte offset in the page of the page's log sequence +number (LSN), +or \-1 if no LSN offset is specified. +(See the description of the +.I DbMpool::sync +method for more information.) +.TP 5 +u_int32_t clear_len; +The +.I clear_len +field is the number of initial bytes in a page that should be set to zero +when the page is created as a result of the DB_MPOOL_CREATE or DB_MPOOL_NEW +flags being specified to +.IR DbMpoolFile::get . +If +.I finfop +is NULL or +.I clear_len +is 0, the entire page is cleared. +.PP +.Rt DbMpoolFile::open +.PP +.Fn DbMpoolFile::close +The +.I DbMpoolFile::close +method closes the source file indicated by the DbMpoolFile object. +This method does not imply a call to +.IR DbMpoolFile::sync , +i.e. no pages are written to the source file as as a result of calling +.IR DbMpoolFile::close . +.PP +In addition, +if the +.I file +argument to +.I DbMpoolFile::open +was NULL, +any underlying files created for this DbMpoolFile will be removed. +.PP +.Rt DbMpoolFile::close +.PP +.Fn DbMpoolFile::get +The +.I DbMpoolFile::get +method copies a pointer to the page with the page number specified by +.IR pgnoaddr , +from the source file specified by the DbMpoolFile object +into the memory location referenced by +.IR pagep . +If the page does not exist or cannot be retrieved, +.I DbMpoolFile::get +will fail. +.PP +The returned page is size_t type aligned. +.PP +.ft B +Page numbers begin at 0, e.g., the first page in the file is page number 0, +not page number 1. +.ft R +.PP +The +.I flags +argument is specified by +.BR or 'ing +together one or more of the following values: +.TP 5 +.Sj DB_MPOOL_CREATE +If the specified page does not exist, create it. +In this case, the +.I pgin +method, if specified, is called. +.TP 5 +.Sj DB_MPOOL_LAST +Return the last page of the source file and copy its page number +to the location referenced by +.IR pgnoaddr . +.TP 5 +.Sj DB_MPOOL_NEW +Create a new page in the file and copy its page number to the location +referenced by +.IR pgnoaddr . +In this case, the +.I pgin +method, if specified, is not called. +.PP +The DB_MPOOL_CREATE, DB_MPOOL_LAST and DB_MPOOL_NEW flags are mutually +exclusive. +.PP +Created pages have all their bytes set to 0, unless otherwise specified +when the file was opened. +.PP +All pages returned by +.I DbMpoolFile::get +will be retained (i.e. ``pinned'') in the pool until a subsequent call to +.IR DbMpoolFile::put . +.PP +.Rt DbMpoolFile::get +.PP +.Fn DbMpoolFile::put +The +.I DbMpoolFile::put +method indicates that the page referenced by +.I pgaddr +can be evicted from the pool. +.I Pgaddr +must be an address previously returned by +.IR DbMpoolFile::get . +.PP +The +.I flags +argument is specified by +.BR or 'ing +together one or more of the following values: +.TP 5 +.Sj DB_MPOOL_CLEAN +Clear any previously set modification information (i.e., +don't bother writing the page back to the source file). +.TP 5 +.Sj DB_MPOOL_DIRTY +The page has been modified and must be written to the source file +before being evicted from the pool. +.TP 5 +.Sj DB_MPOOL_DISCARD +The page is unlikely to be useful in the near future, +and should be discarded before other pages in the pool. +.PP +The DB_MPOOL_CLEAN and DB_MPOOL_DIRTY flags are mutually exclusive. +.PP +.Rt DbMpoolFile::put +.PP +.Fn DbMpoolFile::set +The +.I DbMpoolFile::set +method sets the flags associated with the page referenced by +.I pgaddr +without unpinning it from the pool. +.I Pgaddr +must be an address previously returned by +.IR DbMpoolFile::get . +The +.I flags +argument to +.I DbMpoolFile::set +is specified by +.BR or 'ing +together one or more of the values specified as flags for the +.I DbMpoolFile::put +call. +.PP +.Rt DbMpoolFile::set +.PP +.Fn DbMpoolFile::sync +The +.I DbMpoolFile::sync +method writes all pages associated with the DbMpoolFile object +that were marked as modified using +.I DbMpoolFile::put +or +.IR DbMpoolFile::set , +back to the source file. +If any of the modified pages are also pinned (i.e., +currently referenced by this or another process) +.I DbMpoolFile::sync +will ignore them. +.PP +.Rc DbMpoolFile::sync +and DB_INCOMPLETE if there were pages which were modified but which +.I DbMpoolFile::sync +was unable to write. +.SH ERRORS +.Ek +.PP +.Ee DbMpoolFile::open +.na +.Nh +DBmemp->pgin(3), +DBmemp->pgout(3), +DbLog::compare(3), +DbLog::flush(3), +close(2), +fcntl(2), +fflush(3), +fsync(2), +lseek(2), +malloc(3), +memcmp(3), +memcpy(3), +memset(3), +mmap(2), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +time(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec DbMpoolFile::open +.TP 5 +.Ei +.sp +The file has already been entered into the pool, +and the +.I pagesize +value is not the same as when the file was entered into the pool, +or the length of the file is not zero or a multiple of the +.IR pagesize . +.sp +The DB_RDONLY flag was specified for an in-memory pool. +.PP +.Ee DbMpoolFile::close +.na +.Nh +close(2), +fcntl(2), +fflush(3), +munmap(2), +and +strerror(3). +.Hy +.ad +.PP +.Ee DbMpoolFile::get +.na +.Nh +DBmemp->pgin(3), +DBmemp->pgout(3), +DbLog::compare(3), +DbLog::flush(3), +close(2), +fcntl(2), +fflush(3), +fsync(2), +lseek(2), +malloc(3), +memcmp(3), +memcpy(3), +memset(3), +mmap(2), +open(2), +read(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +time(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec DbMpoolFile::get +.TP 5 +[EAGAIN] +The page reference count has overflowed. +(This should never happen unless there's a bug in the application.) +.TP 5 +.Ei +.sp +The DB_MPOOL_NEW flag was set and the source file was not opened for writing. +.sp +The requested page does not exist and DB_MPOOL_CREATE was not set. +.sp +More than one of DB_MPOOL_CREATE, DB_MPOOL_LAST and DB_MPOOL_NEW was set. +.TP 5 +[ENOMEM] +The cache is full and no more pages will fit in the pool. +.PP +.Ee DbMpoolFile::put +.na +.Nh +DBmemp->pgin(3), +DBmemp->pgout(3), +DbLog::compare(3), +DbLog::flush(3), +close(2), +fcntl(2), +fflush(3), +fsync(2), +lseek(2), +malloc(3), +memcmp(3), +memcpy(3), +memset(3), +mmap(2), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +time(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec DbMpoolFile::put +.TP 5 +[EACCES] +The DB_MPOOL_DIRTY flag was set and the source file was not opened for +writing. +.TP 5 +.Ei +.sp +The +.I pgaddr +parameter does not reference a page returned by +.IR DbMpoolFile::get . +.sp +More than one of DB_MPOOL_CLEAN and DB_MPOOL_DIRTY was set. +.PP +.Ee DbMpoolFile::set +.na +.Nh +fcntl(2), +and +fflush(3). +.Hy +.ad +.PP +.Ec DbMpoolFile::set +.TP 5 +.Ei +.PP +.Ee DbMpoolFile::sync +.na +.Nh +DBmemp->pgin(3), +DBmemp->pgout(3), +DbLog::compare(3), +DbLog::flush(3), +close(2), +fcntl(2), +fflush(3), +fsync(2), +lseek(2), +malloc(3), +memcpy(3), +memset(3), +open(2), +qsort(3), +realloc(3), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.SH "SEE ALSO" +.Sa diff --git a/mozilla/db/man/mancxx.roff/DbTxn.3 b/mozilla/db/man/mancxx.roff/DbTxn.3 new file mode 100644 index 00000000000..48e5f47fa9e --- /dev/null +++ b/mozilla/db/man/mancxx.roff/DbTxn.3 @@ -0,0 +1,1295 @@ +.ds TYPE CXX +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)DbTxn.sox 10.10 (Sleepycat) 5/3/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DbTxn 3 "May 3, 1998" +.UC 7 +.SH NAME +DbTxn \- Db transaction management +.SH SYNOPSIS +.nf +.ft B +.ie '\*[TYPE]'CXX'\{ +#include + +int +DbTxn::prepare(); + +int +DbTxn::commit(); + +int +DbTxn::abort(); + +u_int32_t +DbTxn::id(); +\} +.el\{\ +import com.sleepycat.db.*; + +public void abort() +.ti +5 +throws DbException; + +public void commit() +.ti +5 +throws DbException; + +public int id() +.ti +5 +throws DbException; + +public void prepare() +.ti +5 +throws DbException; +\} +.ft R +.fi +.SH DESCRIPTION +.Gn +.PP +This manual page describes the specific details of the Db transaction +support. +The DbTxn class is used in conjunction with +.IR DbTxnMgr (3) +to provide transaction semantics. +Full transaction support is provided by a collection of modules that +provide interfaces to the services required for transaction processing. +These services are recovery (see +.IR DbLog (3)), +concurrency control (see +.IR DbLock (3) +and +.IR DbLockTab (3)), +and the management of shared data (see +.IR DbMpool (3) +and +.IR DbMpoolFile (3)). +Transaction semantics can be applied to the access methods described in +.IR Db (3) +through method call parameters. +.PP +The model intended for transactional use (and the one that is used by +the access methods) is write-ahead logging provided by +.IR DbLog (3) +to record both before- and after-images. +Locking follows a two-phase protocol, with all locks being released +at transaction commit. +.PP +.Fn DbTxn::prepare +The +.I DbTxn::prepare +method initiates the beginning of a two phase commit. +In a distributed transaction environment, +.I db +can be used as a local transaction manager. +In this case, +the distributed transaction manager must send +.I prepare +messages to each local manager. +The local manager must then issue a +.I DbTxn::prepare +and await its successful return before responding to the distributed +transaction manager. +Only after the distributed transaction manager receives successful +responses from all of its +.I prepare +messages should it issue any +.I commit +messages. +.PP +.Rt DbTxn::prepare +.PP +.Fn DbTxn::commit +The +.I DbTxn::commit +method ends the transaction associated with the DbTxn. +If DB_TXN_NOSYNC was not specified, a commit log record is written and +flushed to disk, as are all previously written log records. +If the transaction is nested, its locks are acquired by the parent +transaction, otherwise its locks are released. +Any applications that require strict two-phase locking must not +release any locks explicitly, leaving them all to be released by +.IR DbTxn::commit . +.PP +.Rt DbTxn::commit +.PP +.Fn DbTxn::abort +The +.I DbTxn::abort +method causes an abnormal termination of the transaction. +The log is played backwards and any necessary recovery operations are +initiated through the +.I recover +method specified to +.IR DbTxnMgr::open . +After recovery is completed, all locks held by the transaction are acquired +by the parent transaction in the case of a nested transaction or released +in the case of a non-nested transaction. +As is the case for +.IR DbTxn::commit , +applications that require strict two phase locking should not explicitly +release any locks. +.PP +.Rt DbTxn::abort +.PP +.Fn DbTxn::id +The +.I DbTxn::id +method returns the unique transaction id associated with the specified +transaction. +Locking calls made on behalf of this transaction should use the value +returned from +.I DbTxn::id +as the locker parameter to the +.I DbLockTab::get +or +.I DbLockTab::vec +calls. +.PP +.SH "TRANSACTIONS +Creating transaction protected applications using the Db access methods +requires little system customization. +In most cases, +the default parameters to the locking, logging, memory pool, +and transaction subsystems will suffice. +Applications can use +.I DbEnv::appinit +(see +.IR DbEnv (3)) +to perform this initialization, or they may do it explicitly. +.PP +Each database operation (i.e., any call to a method underlying the +handles returned by +.I Db::open +and +.I Db::cursor +described in +.IR Db (3)) +is normally performed on behalf of a unique locker. +If multiple calls on behalf of the same locker are desired, +then transactions must be used. +.PP +Once the application has initialized the Db subsystems that it is using, +it may open the Db access method databases. +For applications performing transactions, +the databases must be opened after subsystem initialization, +and cannot be opened as part of a transaction. +Once the databases are opened, the application can group sets of +operations into transactions, by surrounding the operations +with the appropriate +.IR DbTxnMgr::begin , +.I DbTxn::commit +and +.I DbTxn::abort +calls. +Databases accessed by a transaction must not be closed +during the transaction. +Note, +it is not necessary to transaction protect read-only transactions, +unless those transactions require repeatable reads. +.PP +The Db access methods will make the appropriate calls into the +lock, log and memory pool subsystems in order to guarantee that +transaction semantics are applied. +When the application is ready to exit, all outstanding transactions +should have been committed or aborted. +At this point, all open Db files should be closed. +Once the Db database files are closed, +the Db subsystems should be closed, +either explicitly or by destroying +the +.IR DbEnv (3) +object. +.PP +It is also possible to use the locking, logging and transaction subsystems +of Db to provide transaction semantics to objects other than those described +by the Db access methods. +In these cases, the application will need more explicit customization of +the subsystems as well as the development of appropriate +data-structure-specific recovery functions. +.PP +For example, consider an application that provides transaction semantics +to data stored in plain UNIX files accessed using the +.IR read (2) +and +.IR write (2) +system calls. +The operations for which transaction protection is desired are bracketed +by calls to +.I DbTxnMgr::begin +and +.IR DbTxn::commit . +.PP +Before data are referenced, +the application must make a call to the lock manager, +.IR DbLock (3), +for a lock of the appropriate type (e.g., 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, +.IR DbLock (3) . +Then, the application should make a call to the +log manager, +.IR DbLog , +to record enough information to redo the operation in case of +failure after commit and to undo the operation in case of abort. +As discussed in the +.IR DbLog (3) +manual page, +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. +.PP +After the log message is written, the application may issue the write system call. +After all requests are issued, the application may call +.IR DbTxn::commit . +When +.I DbTxn::commit +returns, the caller is guaranteed that all necessary log writes have +been written to disk. +.PP +At any time, the application may call +.IR DbTxn::abort , +which will result in the appropriate calls to the +.I recover +method to restore the ``database'' to a consistent pre-transaction +state. +(The recover method must be able to either re-apply or undo the update +depending on the context, for each different type of log record.) +.PP +If the application should crash, the recovery process uses the +.I DbLog +interface to read the log and call the +.I recover +method to restore the database to a consistent state. +.PP +The +.I DbTxn::prepare +method provides the core functionality to implement distributed +transactions, +but it does not manage the notification of distributed transaction managers. +The caller is responsible for issuing +.I DbTxn::prepare +calls to all sites participating in the transaction. +If all responses are positive, the caller can issue a +.IR DbTxn::commit . +If any of the responses are negative, the caller should issue a +.IR DbTxn::abort . +In general, the +.I DbTxn::prepare +call requires that the transaction log be flushed to disk. +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)limits.so 8.1 (Sleepycat) 5/3/98 +.\" +.de Ll +.SH "LOG FILE LIMITS +Log file sizes impose a time limit on the length of time a database +may be accessed under transaction protection, before it needs to be +dumped and reloaded (see +.IR db_dump(3) +and +.IR db_load(3)). +Unfortunately, the limits are potentially difficult to calculate. +.PP +The log file name consists of "log." followed by 5 digits, resulting +in a maximum of 99,999 log files. +Consider an application performing 600 transactions per second, for +15 hours a day, logged into 10Mb log files, where each transaction +is logging approximately 100 bytes of data. The calculation: +.PP +.nf +.RS +(10 * 2^20 * 99999) / +.ti +5 +(600 * 60 * 60 * 15 * 100) = 323.63 +.RE +.fi +.PP +indicates that the system will run out of log file space in +roughly 324 days. +If we increase the maximum size of the files from 10Mb to 100Mb, +the same calculation indicates that the application will run out +of log file space in roughly 9 years. +.PP +There is no way to reset the log file name space in Berkeley DB. +If your application is reaching the end of its log file name space, +you should: +.TP 5 +1. +Archive your databases as if to prepare for catastrophic failure (see +.IR db_archive (1) +for more information). +.TP 5 +2. +Dump and re-load +.B all +your databases (see +.IR db_dump (1) +and +.IR db_load (1) +for more information). +.TP 5 +3. +Remove all of the log files from the database environment (see +.IR db_archive (1) +for more information). +.TP 5 +4. +Restart your applications. +.. +.de Tl +.SH "TRANSACTION ID LIMITS +The transaction ID space in Berkeley DB is 2^31, or 2 billion entries. +It is possible that some environments may need to be aware of this +limitation. +Consider an application performing 600 transactions a second for 15 +hours a day. +The transaction ID space will run out in roughly 66 days: +.PP +.nf +.RS +2^31 / (600 * 15 * 60 * 60) = 66 +.RE +.fi +.PP +Doing only 100 transactions a second exhausts the transaction ID space +in roughly one year. +.PP +The transaction ID space is reset each time recovery is run. +If you reach the end of your transaction ID space, +shut down your applications and restart them after running recovery (see +.IR db_recover (1) +for more information). +The most recently allocated transaction ID is the +.I st_last_txnid +value in the transaction statistics information, and is displayed by the +.IR db_stat (1) +utility. +.. +.Tl +.SH ERRORS +.Ek +.PP +.Ee DbTxn::prepare +.na +.Nh +DbLog::flush(3), +fcntl(2), +fflush(3), +and +strerror(3). +.Hy +.ad +.PP +.Ee DbTxn::commit +.na +.Nh +DbLockTab::vec(3), +DbLog::put(3), +fcntl(2), +fflush(3), +malloc(3), +memcpy(3), +and +strerror(3). +.Hy +.ad +.PP +.Ec DbTxn::commit +.TP 5 +[EINVAL] +The transaction was aborted. +.PP +.Ee DbTxn::abort +.na +.Nh +DBenv->tx_recover(3), +DbLockTab::vec(3), +DbLog::get(3), +fcntl(2), +fflush(3), +memset(3), +and +strerror(3). +.Hy +.ad +.TP 5 +[EINVAL] +The transaction was already aborted. +.SH "SEE ALSO" +.IR "LIBTP: Portable, Modular Transactions for UNIX" , +Margo Seltzer, Michael Olson, USENIX proceedings, Winter 1992. +.SH BUGS +Nested transactions are not yet implemented. +.sp +.Sa diff --git a/mozilla/db/man/mancxx.roff/DbTxnMgr.3 b/mozilla/db/man/mancxx.roff/DbTxnMgr.3 new file mode 100644 index 00000000000..723d7b0f419 --- /dev/null +++ b/mozilla/db/man/mancxx.roff/DbTxnMgr.3 @@ -0,0 +1,1400 @@ +.ds TYPE CXX +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)DbTxnMgr.sox 10.14 (Sleepycat) 5/4/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.\" Stat field macro. +.de Sf +.ie '\*[TYPE]'CXX'\{\ +\\$1 \\$3;\} +.el\{\ +\\$2 get_\\$3();\} +.. +.TH DbTxnMgr 3 "May 4, 1998" +.UC 7 +.SH NAME +DbTxnMgr \- Db transaction management +.SH SYNOPSIS +.nf +.ft B +.ie '\*[TYPE]'CXX'\{ +#include + +static int +DbTxnMgr::open(const char *dir, +.ti +5 +u_int32_t flags, int mode, DbEnv *dbenv, DbTxnMgr **regionp); + +int +DbTxnMgr::begin(DbTxn *pid, DbTxn **tid); + +int +DbTxnMgr::checkpoint(u_int32_t kbyte, u_int32_t min) const; + +int +DbTxnMgr::close(); + +static int +DbTxnMgr::unlink(const char *dir, int force, DbEnv *dbenv); + +int +DbTxnMgr::stat(DB_TXN_STAT **statp, void *(*db_malloc)(size_t)); +\} +.el\{\ +import com.sleepycat.db.*; + +public static DbTxnMgr open(String dir, int flags, int mode, DbEnv dbenv) +.ti +5 +throws DbException; + +public DbTxn begin(DbTxn pid) +.ti +5 +throws DbException; + +public void checkpoint(int kbyte, int min) +.ti +5 +throws DbException; + +public void close() +.ti +5 +throws DbException; + +public static void unlink(String dir, int force, DbEnv dbenv) +.ti +5 +throws DbException; + +public DbTxnStat stat() +.ti +5 +throws DbException; +\} +.ft R +.fi +.SH DESCRIPTION +.Gn +.PP +This manual page describes the specific details of the Db transaction +support. +The DbTxnMgr class is used in conjunction with +.IR DbTxn (3) +to provide transaction semantics. +Full transaction support is provided by a collection of modules that +provide interfaces to the services required for transaction processing. +These services are recovery (see +.IR DbLog (3)), +concurrency control (see +.IR DbLock (3) +and +.IR DbLockTab (3)), +and the management of shared data (see +.IR DbMpool (3) +and +.IR DbMpoolFile (3)). +Transaction semantics can be applied to the access methods described in +.IR Db (3) +through method call parameters. +.PP +The model intended for transactional use (and that is used by the +access methods) is that write-ahead logging is provided by +.IR DbLog (3) +to record both before- and after-image logging. +Locking follows a two-phase protocol (i.e., all locks are released +at transaction commit). +.PP +.Co "transaction region" DbTxnMgr +.PP +.Fm +.Ft DbTxnMgr::open DbTxnMgr +.TP 5 +.Sj DB_TXN_NOSYNC +On transaction commit, do not synchronously flush the log. +This means that transactions exhibit the ACI (atomicity, +consistency and isolation) properties, but not D (durability), i.e., +database integrity will be maintained but it is possible that some number +of the most recently committed transactions may be undone during recovery +instead of being redone. +.sp +The number of transactions that are potentially at risk is governed by +how often the log is checkpointed (see +.IR db_checkpoint (1)) +and how many log updates can fit on a single log page. +.PP +.Mo "transaction subsystem" +.PP +The transaction subsystem is configured +.En "DbTxnMgr::open" "DbTxnMgr::close" +.TP 5 +.Se +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +DbLog *lg_info; +\} +.el\{\ +.TP 5 +DbLog lg_info; +\} +The logging region that is being used for this transaction environment. +The +.I lg_info +field contains a return value from the method +.IR DbLog::open . +.ft B +Logging is required for transaction environments, +and it is an error to not specify a logging region. +.ft R +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +DbLockTab *lk_info; +\} +.el\{\ +.TP 5 +DbLockTab lk_info; +\} +The locking region that is being used for this transaction environment. +The +.I lk_info +field contains a return value from the method +.IR DbLockTab::open . +If +.I lk_info +is NULL, no locking is done in this transaction environment. +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +u_int32_t tx_max;\} +.el\{\ +.TP 5 +int tx_max;\} +The maximum number of simultaneous transactions that are supported. +This bounds the size of backing files and is used to derive limits for +the size of the lock region and logfiles. +When there are more than +.I tx_max +concurrent transactions, calls to +.I DbTxnMgr::begin +may cause backing files to grow. +If +.I tx_max +is 0, a default value is used. +.if '\*[TYPE]'CXX'\{\ +.TP 5 +int DbTxnMgr::recover(DbLog *logp, Dbt *DbLog::rec, +.ti +5 +DbLsn *lsnp, int redo, void *info); +.br +A method that is called by +.I DbTxn::abort +during transaction abort. +This method takes five arguments: +.RS +.TP 5 +logp +A pointer to the transaction log (DbLog *). +.TP 5 +DbLog::rec +A log record. +.TP 5 +lsnp +A pointer to a log sequence number (DbLsn *). +.TP 5 +redo +An integer value that is set to one of the following values: +.RS +.TP 5 +.Sj DB_TXN_BACKWARD_ROLL +The log is being read backward to determine which transactions have been +committed and which transactions were not (and should therefore be aborted +during recovery). +.TP 5 +.Sj DB_TXN_FORWARD_ROLL +The log is being played forward, any transaction ids encountered that +have not been entered into the list referenced by +.I info +should be ignored. +.TP 5 +.Sj DB_TXN_OPENFILES +The log is being read to open all the files required to perform recovery. +.TP 5 +.Sj DB_TXN_REDO +Redo the operation described by the log record. +.TP 5 +.Sj DB_TXN_UNDO +Undo the operation described by the log record. +.RE +.TP 5 +info +An opaque pointer used to reference the list of transaction IDs encountered +during recovery. +.RE +.IP +If +.I recover +is NULL, +the default is that only Db access method operations are transaction +protected, +and the default recover method will be used. +\} +.PP +.Rt DbTxnMgr::open +.PP +.Fn DbTxnMgr::begin +The +.I DbTxnMgr::begin +method creates a new transaction in the transaction manager, +.ie '\*[TYPE]'CXX'\{\ +copying a pointer to a DbTxn that uniquely identifies it into the memory +referenced by +.IR tid . +\} +.el\{\ +and returns a DbTxn that uniquely identifies it. +\} +If the +.I pid +argument is non-NULL, +the new transaction is a nested transaction with the transaction indicated by +.I pid +as its parent. +.PP +Transactions may not span threads, i.e., +each transaction must begin and end in the same thread, +and each transaction may only be used by a single thread. +.PP +.Rt DbTxnMgr::begin +.PP +.Fn DbTxnMgr::close +The +.I DbTxnMgr::close +method detaches a process from the transaction environment specified +by the DbTxnMgr object. +All mapped regions are unmapped and any allocated resources are freed. +Any uncommitted transactions are aborted. +.PP +.Cc DbTxnMgr +.PP +When multiple threads are using the DbTxnMgr handle concurrently, +only a single thread may call the +.I DbTxnMgr::close +method. +.PP +.Rt DbTxnMgr::close +.PP +.Un "transaction region" DbTxnMgr +.PP +.Fn DbTxnMgr::checkpoint +The +.I DbTxnMgr::checkpoint +method syncs the underlying memory pool, +writes a checkpoint record to the log and then flushes the log. +.PP +If either +.I kbyte +or +.I min +is non-zero, +the checkpoint is only done if more than +.I min +minutes have passed since the last checkpoint, +or if more than +.I kbyte +kilobytes of log data have been written since the last checkpoint. +.PP +.Rc DbTxnMgr::checkpoint +and DB_INCOMPLETE if there were pages that needed to be written but that +.I DbMpool::sync (3) +(see +.I DbMpool (3)) +was unable to write immediately. +In this case, the +.I DbTxnMgr::checkpoint +call should be retried. +.PP +.Ux DbTxnMgr::checkpoint txn_checkpoint db_checkpoint +.PP +.Fn DbTxnMgr::stat +The +.I DbTxnMgr::stat +.ie '\*[TYPE]'CXX'\{ +method creates a statistical structure and copies pointers to it into +user-specified memory locations. +.PP +.Ma "Statistical structures" +\} +.el \{ +method creates a DbTxnStat object encapsulating a statistical structure. +\} +.PP +.ie '\*[TYPE]'CXX'\{ +The transaction region statistics are stored in a structure of type +DB_TXN_STAT (typedef'd in ). +The following DB_TXN_STAT fields will be filled in: +\} +.el \{ +The transaction region statistics are stored in a DbTxnStat object. +The following methods are available on DbTxnStat: +\} +.TP 5 +.Sf DbLsn DbLsn st_last_ckp +The LSN of the last checkpoint. +.Nt +.Sf DbLsn DbLsn st_pending_ckp +The LSN of any checkpoint that is currently in progress. +If +.I st_pending_ckp +is the same as +.I st_last_ckp +there is no checkpoint in progress. +.Nt +.Sf time_t int st_time_ckp +The time the last completed checkpoint finished (as returned by +.IR time (2)). +.Nt +.Sf u_int32_t int st_last_txnid +The last transaction ID allocated. +.Nt +.Sf u_int32_t int st_maxtxns +The maximum number of active transactions supported by the region. +.Nt +.Sf u_int32_t int st_naborts +The number of transactions that have aborted. +.Nt +.Sf u_int32_t int st_nactive +The number of transactions that are currently active. +.Nt +.Sf u_int32_t int st_nbegins +The number of transactions that have begun. +.Nt +.Sf u_int32_t int st_ncommits +The number of transactions that have committed. +.Nt +.Sf u_int32_t st_region_wait +The number of times that a thread of control was forced to wait before +obtaining the region lock. +.Nt +.Sf u_int32_t st_region_nowait +The number of times that a thread of control was able to obtain +the region lock without waiting. +.if '\*[TYPE]'CXX'\{ +.Nt +DB_TXN_ACTIVE *st_txnarray; +A pointer to an array of +.I st_nactive +DB_TXN_ACTIVE structures, describing the currently active transactions. +The following fields of the DB_TXN_ACTIVE structure (typedef'd in ) +will be filled in: +.sp +.RS +.TP 5 +u_int32_t txnid; +The transaction ID as returned by +.IR DbTxnMgr::begin (3). +.Nt +DbLsn lsn; +The LSN of the transaction-begin record. +\} +.RE +.PP +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR db_txn : +.TP 5 +.Eh DbTxnMgr::open +.TP 5 +.Ev "transaction region" DbTxnMgr +.SH ERRORS +.Ek +.PP +.Ee DbTxnMgr::open +.na +.Nh +DbTxnMgr::unlink(3), +close(2), +db_version(3), +fcntl(2), +fflush(3), +lseek(2), +malloc(3), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +time(3), +unlink(2), +and +write(2). +.Hy +.ad +.PP +.Ec DbTxnMgr::open +.TP 5 +.Ei +.sp +.Et +.sp +The +.I dbenv +parameter was NULL. +.TP 5 +.Em +.PP +.Ee DbTxnMgr::begin +.na +.Nh +DbLog::put(3), +fcntl(2), +fflush(3), +lseek(2), +malloc(3), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +strerror(3), +and +write(2). +.Hy +.ad +.PP +.Ec DbTxnMgr::begin +.TP 5 +[ENOSPC] +The maximum number of concurrent transactions has been reached. +.PP +.Ee DbTxnMgr::checkpoint +.na +.Nh +DbLog::compare(3), +DbLog::put(3), +DbMpool::sync(3), +fcntl(2), +fflush(3), +malloc(3), +memcpy(3), +memset(3), +strerror(3), +and +time(3). +.Hy +.ad +.TP 5 +.Ei +.PP +.Ee DbTxnMgr::close +.na +.Nh +DbLog::flush(3), +DbTxn::abort(3), +close(2), +fcntl(2), +fflush(3), +munmap(2), +and +strerror(3). +.Hy +.ad +.PP +.Ee DbTxnMgr::unlink +.na +.Nh +close(2), +fcntl(2), +fflush(3), +malloc(3), +memcpy(3), +memset(3), +mmap(2), +munmap(2), +open(2), +sigfillset(3), +sigprocmask(2), +stat(2), +strcpy(3), +strdup(3), +strerror(3), +strlen(3), +and +unlink(2). +.Hy +.ad +.PP +.Ec DbTxnMgr::unlink +.TP 5 +.Eb +.PP +.Ee DbTxnMgr::stat +.na +.Nh +fcntl(2), +and +malloc(3). +.Hy +.ad +.SH "SEE ALSO" +.IR "LIBTP: Portable, Modular Transactions for UNIX" , +Margo Seltzer, Michael Olson, USENIX proceedings, Winter 1992. +.SH BUGS +Nested transactions are not yet implemented. +.sp +.Sa diff --git a/mozilla/db/man/mancxx.roff/Dbc.3 b/mozilla/db/man/mancxx.roff/Dbc.3 new file mode 100644 index 00000000000..612de070c20 --- /dev/null +++ b/mozilla/db/man/mancxx.roff/Dbc.3 @@ -0,0 +1,1457 @@ +.ds TYPE CXX +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)Dbc.sox 10.11 (Sleepycat) 4/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH Dbc 3 "April 10, 1998" +.UC 7 +.SH NAME +Dbc \- database sequential access functions +.SH SYNOPSIS +.nf +.ft B +.ie '\*[TYPE]'CXX'\{ +#include + +int +Dbc::close(void); + +int +Dbc::del(u_int32_t flags); + +int +Dbc::get(Dbt *key, Dbt *data, u_int32_t flags); + +int +Dbc::put(Dbt *key, Dbt *data, u_int32_t flags); +\} +.el\{\ +import com.sleepycat.db.*; + +public void close() +.ti +5 +throws DbException; + +public void del(int flags) +.ti +5 +throws DbException; + +public int get(Dbt key, Dbt data, int flags) +.ti +5 +throws DbException; + +public void put(Dbt key, Dbt data, int flags) +.ti +5 +throws DbException; +\} +.ft R +.fi +.SH DESCRIPTION +.Gn +.PP +This manual page describes the specific details of the cursor support +for the access methods in +.IR Db(3) . +.PP +The +.I Dbc +functions are the library interface supporting sequential access to the +records stored by the access methods of the Db library. +Cursors are created by calling +.I Db::cursor +method described in +.IR Db (3), +which returns a +.if '\*[TYPE]'CXX'\{\ +pointer to a +\} +Dbc object. +.PP +Each cursor maintains positioning information within a set of key/data pairs. +In the presence of transactions, cursors are only valid within the +context of a single transaction, the one specified during the +.I Db::cursor +call described in +.IR Db (3). +All cursor operations will be executed in the context of that transaction. +Before aborting or committing a transaction, all cursors used within that +transaction must be closed. +In the presence of transactions, the application must call +.I DbTxn::abort +if any of the cursor operations returns that a deadlock (EAGAIN) or +system failure occurred. +.PP +When locking is enabled, +page locks are retained between consecutive cursor calls. +For this reason, in the presence of locking, +applications should discard cursors as soon as they are done with them. +Calling the +.I Db::close +method (see +.IR Db (3)) +discards any cursors opened in the context of a particular Db object +returned by the +.I Db::open +call. +.PP +The methods of the Dbc are defined as follows: +.TP 5 +int Dbc::close(); +A method that discards the cursor. +No further references to the Dbc object should be made. +.IP +.Rt Dbc::close +.TP 5 +int Dbc::del(u_int32_t flags); +A method that deletes the key/data pair currently +referenced by the cursor. +.IP +.Fl +.IP +The cursor position is unchanged after a delete and subsequent calls +to cursor functions expecting the cursor to reference an existing +key will fail. +.IP +.Rc Dbc::del +and DB_KEYEMPTY if the element has already been deleted. +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +int Dbc::get(Dbt *key, Dbt *data, u_int32_t flags); +A method that retrieves key/data pairs from the database. +The address +\} +.el\{\ +.TP 5 +int Dbc::get(Dbt key, Dbt data, int flags); +A method that retrieves key/data pairs from the database. +The byte array +\} +and length of the key are returned in the object referenced by +.I key +(except for the case of the DB_SET flag where the +.I key +object is unchanged), and the +.ie '\*[TYPE]'CXX'\{\ +address +\} +.el\{\ +byte array +\} +and length of the data are returned in the object +referenced by +.IR data . +.sp +Modifications to the database during a sequential scan will be reflected +in the scan, +i.e. records inserted behind a cursor will not be returned while records +inserted in front of a cursor will be returned. +.sp +In recno databases, missing entries +(i.e., entries that were never explicitly created or that were created +and then deleted), +will be skipped during a sequential scan. +.sp +If multiple threads or processes insert items into the same database file +without using locking, the results are undefined. +For more detail, see the section below on cursor stability. +.IP +The parameter +.I flags +must be set to exactly one of the following values: +.RS +.TP 5 +.Sj DB_FIRST +The cursor is set to reference the first key/data pair of the database, +and that pair is returned. +In the presence of duplicate key values, +the first data item in the set of duplicates is returned. +.IP +If the database is empty, +the +.I Dbc::get +method will return DB_NOTFOUND. +.TP 5 +.Sj DB_LAST +The cursor is set to reference the last key/data pair of the database, +and that pair is returned. +In the presence of duplicate key values, +the last data item in the set of duplicates is returned. +.IP +If the database is empty, +the +.I Dbc::get +method will return DB_NOTFOUND. +.TP 5 +.Sj DB_NEXT +If the cursor is not yet initialized, DB_NEXT is identical to DB_FIRST. +.IP +Otherwise, +move the cursor to the next key/data pair of the database, +and that pair is returned. +In the presence of duplicate key values, +the value of the key may not change. +.IP +If the cursor is already on the last record in the database, +the +.I Dbc::get +method will return DB_NOTFOUND. +.TP 5 +.Sj DB_PREV +If the cursor is not yet initialized, DB_PREV is identical to DB_LAST. +.IP +Otherwise, +move the cursor to the previous key/data pair of the database, +and that pair is returned. +In the presence of duplicate key values, +the value of the key may not change. +.IP +If the cursor is already on the first record in the database, +the +.I Dbc::get +method will return DB_NOTFOUND. +.TP 5 +.Sj DB_CURRENT +Return the key/data pair currently referenced by the cursor. +.IP +If the cursor key/data pair has been deleted, +the +.I Dbc::get +method will return DB_KEYEMPTY. +.IP +If the cursor is not yet initialized, +the +.I Dbc::get +method will return EINVAL. +.TP 5 +.Sj DB_SET +Move the cursor to the specified key/data pair of the database, +and return the datum associated with the given key. +.IP +In the presence of duplicate key values, +.I Dbc::get +will return the first data item for the given key. +.IP +If the database is a recno database and the requested key exists, +but was never explicitly created by the application or was later +deleted, the +.I Dbc::get +method returns DB_KEYEMPTY. +.IP +If no matching keys are found, +the +.I Dbc::get +method will return DB_NOTFOUND. +.TP 5 +.Sj DB_SET_RANGE +The DB_SET_RANGE flag is identical to the DB_SET flag, +except that the key is returned as well as the data item, +and, in the case of the btree access method, +the returned key/data pair is the smallest key greater than or +equal to the specified key (as determined by the comparison function), +permitting partial key matches and range searches. +.TP 5 +.Sj DB_SET_RECNO +Move the cursor to the specific numbered record of the database, +and return the associated key/data pair. +The +.I data +field of the specified +.I key +.ie '\*[TYPE]'CXX'\{\ +must be a pointer to a memory location from which a +.I db_recno_t +may be read, as described in +.IR Dbt (3). +This memory location will be read to determine the record to be retrieved. +\} +.el\{\ +must be a byte array containing a record number, +as described in +.IR Dbt (3). +This determines the record to be retrieved. +\} +.sp +For DB_SET_RECNO to be specified, the underlying database must be of type +btree and it must have been created with the DB_RECNUM flag (see +.I Db::open +in +.IR Db (3)). +.TP 5 +.Sj DB_GET_RECNO +Return the record number associated with the cursor. +The record number +will be returned in the data Dbt as described in +.IR Dbt (3). +The +.I key +parameter is ignored. +.sp +For DB_GET_RECNO to be specified, the underlying database must be of type +btree and it must have been created with the DB_RECNUM flag (see +.I Db::open +in +.IR Db (3)). +.RE +.IP +.Ro Dbc::get +.IP +If +.I Dbc::get +fails for any reason, the state of the cursor will be unchanged. +.TP 5 +.ie '\*[TYPE]'CXX'\{\ +int Dbc::put(Dbt *key, Dbt *data, u_int32_t flags); +\} +.el\{\ +int Dbc::put(Dbt key, Dbt data, int flags); +\} +A method that stores key/data pairs into the database. +.IP +The +.I flags +parameter must be set to exactly one of the following values: +.RS +.TP 5 +.Sj DB_AFTER +In the case of the btree and hash access methods, +insert the data element as a duplicate element of the key referenced +by the cursor. +The new element appears immediately after the current cursor position. +It is an error to specify DB_AFTER if the underlying btree or hash database +was not created with the DB_DUP flag. +The +.I key +parameter is ignored. +.IP +In the case of the recno access method, +it is an error to specify DB_AFTER if the underlying recno database was +not created with the DB_RENUMBER flag. +If the DB_RENUMBER flag was specified, a new key is created, +all records after the inserted item are automatically renumbered, +and the key of the new record is returned in the object referenced +by the parameter +.IR key . +The initial value of the +.I key +parameter is ignored. +See +.I Db::open +in +.IR Db (3) +for more information. +.IP +If the cursor is not yet initialized, +the +.I Dbc::put +method will return EINVAL. +.TP 5 +.Sj DB_BEFORE +In the case of the btree and hash access methods, +insert the data element as a duplicate element of the key referenced +by the cursor. +The new element appears immediately before the current cursor position. +It is an error to specify DB_BEFORE if the underlying btree or hash database +was not created with the DB_DUP flag. +The +.I key +parameter is ignored. +.IP +In the case of the recno access method, +it is an error to specify DB_BEFORE if the underlying recno database was +not created with the DB_RENUMBER flag. +If the DB_RENUMBER flag was specified, a new key is created, +the current record and all records after it are automatically renumbered, +and the key of the new record is returned in the object referenced by +the parameter +.IR key . +The initial value of the +.I key +parameter is ignored. +See +.I Db::open +in +.IR Db (3) +for more information. +.IP +If the cursor is not yet initialized, +the +.I Dbc::put +method will return EINVAL. +.TP 5 +.Sj DB_CURRENT +Overwrite the data of the key/data pair referenced by the cursor with the +specified data item. +.IP +The +.I key +parameter is ignored. +.IP +If the cursor is not yet initialized, +the +.I Dbc::put +method will return EINVAL. +.TP 5 +.Sj DB_KEYFIRST +In the case of the btree and hash access methods, +insert the specified key/data pair into the database. +If the key already exists in the database, +the inserted data item is added as the first of the data items for that key. +.IP +The DB_KEYFIRST flag may not be specified to the recno access method. +.TP 5 +.Sj DB_KEYLAST +Insert the specified key/data pair into the database. +If the key already exists in the database, +the inserted data item is added as the last of the data items for that key. +.IP +The DB_KEYLAST flag may not be specified to the recno access method. +.RE +.IP +If the cursor record has been deleted, +the +.I Dbc::put +method will return DB_KEYEMPTY. +.IP +.Ro Dbc::put +.IP +If +.I Dbc::put +fails for any reason, the state of the cursor will be unchanged. +If +.I Dbc::put +succeeds and an item is inserted into the database, +the cursor is always positioned to reference the newly inserted item. +.SH "CURSOR STABILITY" +.PP +In the absence of locking, no guarantees are made about the stability +of cursors in different processes or threads. +However, +the btree and recno access methods guarantee that cursor operations, +interspersed with other cursor or non-cursor operations in the same +thread of control (i.e., thread or single-threaded process), +will always return keys in order and will return each non-deleted +key/data pair exactly once. +Because the hash access method uses a dynamic hashing algorithm, +it cannot guarantee any form of stability in the presence of inserts and +deletes unless locking is performed. +.PP +If locking was specified when the Db file was opened, +but transactions are not in effect, +the access methods provide repeatable reads with respect to the cursor. +That is, a DB_CURRENT call on the cursor is guaranteed to return the same +record as was returned on the last call to the cursor. +.PP +In the presence of transactions, the access method calls between +.I DbTxnMgr::begin +and +.I DbTxn::abort +or +.I DbTxn::commit +provide degree 3 consistency. +For all access methods, +a cursor scan of the database performed within the context of a transaction +is guaranteed to return each key/data pair once and only once, +except in the following case. +If, while performing a cursor scan using the hash access method, +the transaction performing the scan inserts a new pair into the database, +it is possible that duplicate key/data pairs will be returned. +.SH ERRORS +.Ek +.PP +.Ee Dbc::close +.na +.Nh +DbLock::get(3), +DbLock::put(3), +DbLockTab::id(3), +DbLockTab::vec(3), +DbLog::put(3), +DbMpoolFile::get(3), +DbMpoolFile::put(3), +DbMpoolFile::set(3), +calloc(3), +fcntl(2), +fflush(3), +malloc(3), +memcpy(3), +memmove(3), +memset(3), +realloc(3), +and +strerror(3). +.Hy +.ad +.PP +.Ec Dbc::close +.TP 5 +.Ea +.TP 5 +.Ep +.PP +.Ee Dbc::del +.na +.Nh +Db::del(3), +DbLock::get(3), +DbLock::put(3), +DbLockTab::id(3), +DbLockTab::vec(3), +DbLog::put(3), +DbMpoolFile::get(3), +DbMpoolFile::put(3), +DbMpoolFile::set(3), +calloc(3), +fcntl(2), +fflush(3), +malloc(3), +memcpy(3), +memmove(3), +memset(3), +realloc(3), +and +strerror(3). +.Hy +.ad +.PP +.Ec Dbc::del +.TP 5 +.Ea +.TP 5 +.Ei +.TP 5 +.Ep +.PP +.Ee Dbc::get +.na +.Nh +Db::get(3), +DbLock::get(3), +DbLock::put(3), +DbLockTab::id(3), +DbLockTab::vec(3), +DbLog::put(3), +DbMpoolFile::get(3), +DbMpoolFile::put(3), +DbMpoolFile::set(3), +calloc(3), +fcntl(2), +fflush(3), +malloc(3), +memcmp(3), +memcpy(3), +memmove(3), +memset(3), +realloc(3), +and +strerror(3). +.Hy +.ad +.PP +.Ec Dbc::get +.TP 5 +.Ea +.TP 5 +.Ei +.sp +The DB_THREAD flag was specified to the +.I Db::open +method +described in +.IR Db (3) +and neither the DB_DBT_MALLOC or DB_DBT_USERMEM flags were set +in the Dbt. +.TP 5 +.Ep +.PP +.Ee Dbc::put +.na +.Nh +DbLock::get(3), +DbLock::put(3), +DbLockTab::id(3), +DbLockTab::vec(3), +DbLog::put(3), +DbMpoolFile::get(3), +DbMpoolFile::put(3), +DbMpoolFile::set(3), +calloc(3), +fcntl(2), +fflush(3), +malloc(3), +memcmp(3), +memcpy(3), +memmove(3), +memset(3), +realloc(3), +and +strerror(3). +.Hy +.ad +.PP +.Ec Dbc::put +.TP 5 +.Es +.TP 5 +.Ea +.TP 5 +.Ei +.TP 5 +.Ep +.SH "SEE ALSO" +.Sa diff --git a/mozilla/db/man/mancxx.roff/Dbt.3 b/mozilla/db/man/mancxx.roff/Dbt.3 new file mode 100644 index 00000000000..d49dbf0cd1f --- /dev/null +++ b/mozilla/db/man/mancxx.roff/Dbt.3 @@ -0,0 +1,1320 @@ +.ds TYPE CXX +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)Dbt.sox 10.10 (Sleepycat) 4/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH Dbt 3 "April 10, 1998" +.UC 7 +.SH NAME +Dbt \- Db key/data class +.SH SYNOPSIS +.nf +.ft B +.ie '\*[TYPE]'CXX'\{ +void *Dbt::get_data() const; +void Dbt::set_data(void *); + +u_int32_t Dbt::get_size() const; +void Dbt::set_size(u_int32_t); + +u_int32_t Dbt::get_ulen() const; +void Dbt::set_ulen(u_int32_t); + +u_int32_t Dbt::get_dlen() const; +void Dbt::set_dlen(u_int32_t); + +u_int32_t Dbt::get_doff() const; +void Dbt::set_doff(u_int32_t); + +u_int32_t Dbt::get_flags() const; +void Dbt::set_flags(u_int32_t); + +Dbt::Dbt(void *data, size_t size); +Dbt::Dbt(); +Dbt::~Dbt(); +Dbt::Dbt(const Dbt &); +Dbt::Dbt &operator = (const Dbt &); +\} +.el\{\ +import com.sleepycat.db.*; + +public Dbt(); +public Dbt(byte[] data); +public Dbt(byte[] data, int off, int len); + +public void set_data(byte[] data); +public byte[] get_data(); + +public void set_offset(int off); +public int get_offset(); + +public int get_size(); +public void set_size(int size); + +public int get_ulen(); +public void set_ulen(int ulen); + +public int get_dlen(); +public void set_dlen(int dlen); + +public int get_doff(); +public void set_doff(int doff); + +public int get_flags(); +public void set_flags(int flags); + +public void set_recno_key_data(int recno); +public int get_recno_key_data(); +\} +.ft R +.fi +.SH "DESCRIPTION +.Gn +This manual page describes the specific details of the +.I Dbt +class, used to encode keys and data items in a database. +.PP +.SH "KEY/DATA PAIRS +Storage and retrieval for the Db access methods are based on key/data pairs. +Both key and data items are represented by Dbt objects. +.PP +Key and data byte strings may reference strings of essentially unlimited +length, +although any two keys must fit into available memory at the same time so +that they may be compared, +and any one data item must fit into available memory so that it may be +returned. +.PP +The Dbt class provides simple access to an underlying data structure, +whose elements can be examined or changed using the +.I set_ +or +.I get_ +methods. The remainder of the manual page sometimes +refers to these accesses using the underlying name, e.g., simply +.I ulen +instead of +.I get_ulen +and +.IR set_ulen . +The constructors set all elements of the underlying structure to zero. +The constructor with two arguments has the effect of setting all elements +to zero except for the specified +.I data +and +.I size +elements. +In the case where the +.I flags +structure element is 0, +when being provided a key or data item by the application, +the DB package expects the +.I data +object to +.ie '\*[TYPE]'CXX'\{\ +point to a byte string of +\} +.el\{\ +be set to a byte array of +\} +.I size +bytes. +When returning a key/data item to the application, +the DB package will store into the +.I data +object a +.ie '\*[TYPE]'CXX'\{\ +pointer to a byte string +\} +.el\{\ +a byte array +\} +of +.I size +bytes. +.if '\*[TYPE]'CXX'\{\ +.ft B +By default, +the memory referenced by this stored pointer is only valid until the next +call to the DB package using the Db handle returned by +.IR Db::open . +.ft R +\} +.PP +.ft B +The access methods provide no guarantees about byte string alignment, +and applications are responsible for maintaining any necessary alignment. +.ft R +Use the DB_DBT_USERMEM flag to cause returned items to be placed in memory +of arbitrary alignment. +.if '\*[TYPE]'CXX'\{\ +Although Java normally maintains proper alignment of byte arrays, +the set_offset method can be used to specify unaligned addresses. +Unaligned address accesses that are not supported by the underlying +hardware may be reported as an exception, or may stop the running +Java program. +\} +.PP +The elements of the structure underlying the Dbt class are defined as follows: +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *data; +A pointer to a byte string. +\} +.el\{\ +.TP 5 +byte[] data; +A byte array containing the data. +\} +This element is accessed using +.I get_data +and +.IR set_data , +and may be initialized using one of the constructors. +.if '\*[TYPE]'JAVA'\{\ +Note that the array data is not copied immediately, +but only when the Dbt is used. +\} +.ns +.br +.TP 5 +int offset; +The number of bytes offset into the +.I data +array to determine the portion of the array actually used. +This element is accessed using +.I get_offset +and +.IR set_offset . +.TP 5 +.ie '\*[TYPE]'CXX'\{\ +u_int32_t size;\} +.el\{\ +int size;\} +The length of +.IR data , +in bytes. +This element is accessed using +.I get_size +and +.IR set_size , +and may be initialized +.ie '\*[TYPE]'CXX'\{\ +using the constructor with two arguments. +\} +.el\{\ +implicitly to the length of the data array +with the constructor having one argument. +\} +.TP 5 +.ie '\*[TYPE]'CXX'\{\ +u_int32_t ulen;\} +.el\{\ +int ulen;\} +The size of the user's buffer (referenced by +.IR data ), +in bytes. +This location is not written by the Db functions. +See the DB_DBT_USERMEM flag for more information. +This element is accessed using +.I get_ulen +and +.IR set_ulen . +.TP 5 +.ie '\*[TYPE]'CXX'\{\ +u_int32_t dlen;\} +.el\{\ +int dlen;\} +The length of the partial record being read or written by the application, +in bytes. +See the DB_DBT_PARTIAL flag for more information. +This element is accessed using +.I get_dlen +and +.IR set_dlen . +.TP 5 +.ie '\*[TYPE]'CXX'\{\ +u_int32_t doff;\} +.el\{\ +int doff;\} +The offset of the partial record being read or written by the application, +in bytes. +See the DB_DBT_PARTIAL flag for more information. +This element is accessed using +.I get_doff +and +.IR set_doff . +.TP 5 +.ie '\*[TYPE]'CXX'\{\ +u_int32_t flags;\} +.el\{\ +int flags;\} +This element is accessed using +.I get_flags +and +.IR set_flags . +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.RS +.TP 5 +.Sj DB_DBT_MALLOC +Ignored except when retrieving information from a database, e.g., a +.I Db::get +or +.I Dbc::get +call. +This flag causes Db to allocate memory for the returned key or data +item +.ie '\*[TYPE]'CXX'\{\ +(using +.IR malloc (3), +or the user-specified malloc method) +and return a pointer to it in the +.I data +field of the key or data Dbt object. +The allocated memory becomes the responsibility of the calling application. +\} +.el\{\ +and return a +byte array containing the data in the +.I data +field of the key or data Dbt object. +\} +It is an error to specify both DB_DBT_MALLOC and DB_DBT_USERMEM. +.TP 5 +.Sj DB_DBT_USERMEM +Ignored except when retrieving information from a database, e.g., a +.I Db::get +or +.I Dbc::get +call. +The +.I data +field of the key or data object must reference memory that is at least +.I ulen +bytes in length. +If the length of the requested item is less than or equal to that number +of bytes, +the item is copied into the memory referenced by the +.I data +field. +Otherwise, an error is returned, the +.I size +field is set to the length needed for the requested item, +and the +.I errno +variable is set to ENOMEM. +It is an error to specify both DB_DBT_MALLOC and DB_DBT_USERMEM. +.TP 5 +.Sj DB_DBT_PARTIAL +Ignored except when specified for a data parameter, +where this flag causes the partial retrieval or storage of an item. +If the calling application is doing a get, the +.I dlen +bytes starting +.I doff +bytes from the beginning of the retrieved data record are returned +as if they comprised the entire record. +If any or all of the specified bytes do not exist in the record, +the get is successful and the existing bytes or 0 bytes are returned. +.sp +For example, if the data portion of a retrieved record was 100 bytes, +and a partial retrieval was done using a Dbt having a +.I dlen +field of 20 and a +.I doff +field of 85, +the get call would succeed, +the +.I data +field would reference the last 15 bytes of the record, +and the +.I size +field would be set to 15. +.sp +If the calling application is doing a put, +the +.I dlen +bytes starting +.I doff +bytes from the beginning of the specified key's data record are replaced +by the data specified by the +.I data +and +.I size +objects. +If +.I dlen +is smaller than +.IR size , +the record will grow, and if +.I dlen +is larger than +.IR size , +the record will shrink. +If the specified bytes do not exist, +the record will be extended using nul bytes as necessary, +and the put call will succeed. +.sp +It is an error to attempt a partial put using the +.I Db::put +method in a database that supports duplicate records. +Partial puts in databases supporting duplicate records must be done +using a +.I Db::cursor +method. +It is an error to attempt a partial put with differing +.I dlen +and +.I size +values in a recno database with fixed-length records. +.sp +For example, if the data portion of a retrieved record was 100 bytes, +and a partial put was done using a Dbt having a +.I dlen +field of 20, +a +.I doff +field of 85, +and a +.I size +field of 30, +the resulting record would be 115 bytes in length, where the last 30 +bytes would be those specified by the put call. +.RE +.PP +The default algorithm of associating returned key or data items with the +Db handle returned by +.IR Db::open (3) +will obviously not work when Db handles are being used concurrently by +multiple threads within a process, i.e, when DB_THREAD was specified to +.IR Db::open (3). +.ft B +When multiple threads are using the returned Db handle concurrently, +either the DB_DBT_MALLOC or DB_DBT_USERMEM flags must be specified +for any Dbt used for key or data retrieval. +.ft R +.if '\*[TYPE]'JAVA'\{ +.PP +.ft B +For this reason, +when using the JAVA DB API, either the DB_DBT_MALLOC or DB_DBT_USERMEM +flags must be specified for any Dbt used for key or data retrieval. +.ft R +If DB_DBT_USERMEM is specified, the data field of the Dbt must be set +to an appropriately sized byte array. +.PP +If DB_DBT_MALLOC is specified, DB allocates a properly sized byte +array to contain the data. This can be convenient if you know little +about the nature of the data, specifically the size of data in the +database. However, if your application makes repeated calls to +retrieve keys or data, you may notice increased garbage collection due +to this allocation. If you know the maximum size of data you are +retrieving, you might decrease the memory burden and speed your +application by allocating your own byte array and using DB_DBT_USERMEM. +Even if you don't know the maximum size, you can use this option +and reallocate your array whenever your retrieval API call returns +an ENOMEM error. +\} +.SH "LOGICAL RECORD NUMBERS +In all cases for the recno access method, +and when calling the +.I Db::get +and +.I Dbc::get +functions with the DB_GET_RECNO flag specified, the +.I data +.ie '\*[TYPE]'CXX'\{ +field of the key must be a pointer to a memory location of type +.IR db_recno_t , +as typedef'd in the include file. +This type is a 32-bit unsigned type, +\} +.el\{\ +field of the key must be a four byte array, large enough +to store an int. The +.I set_recno_key_data +method can be used to set the value of the array. +An int is a 32-bit type, +\} +(which limits the number of logical records in a recno database, +and the maximum logical record which may be directly retrieved +from a btree database, to 4,294,967,296). +The +.I size +field of the key should be the size of that type, e.g., +.ie '\*[TYPE]'CXX'\{ +in the C programming language, ``sizeof(db_recno_t)''. +\} +.el\{\ +4. +\} +.sp +Logical record numbers are 1-based, not 0-based, i.e., the first record +in the database is record number 1. +.SH BUGS +The Db access methods provide no guarantees about byte string alignment, +and applications are responsible for maintaining any necessary alignment. +.PP +The name Dbt is a mnemonic for ``data base thang'', and was used because +noone could think of a reasonable name that wasn't already in use somewhere +else. +.SH "SEE ALSO" +.Sa diff --git a/mozilla/db/man/mancxx.roff/db_archive.1 b/mozilla/db/man/mancxx.roff/db_archive.1 new file mode 100644 index 00000000000..03db0798f04 --- /dev/null +++ b/mozilla/db/man/mancxx.roff/db_archive.1 @@ -0,0 +1,1062 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_archive.so 10.11 (Sleepycat) 5/3/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_ARCHIVE 1 "May 3, 1998" +.UC 7 +.SH NAME +db_archive \- the DB database archiver +.SH SYNOPSIS +\fBdb_archive\fP [\fB-alsv\fP] [\fB-h home\fP] +.SH DESCRIPTION +The +.I db_archive +utility writes the pathnames of log files that are no longer in use (e.g., +no longer involved in active transactions), +to the standard output, one pathname per line. +These log files should be written to backup media to provide for recovery +in the case of catastrophic failure (which also requires a snapshot of the +database files), +but they may then be deleted from the system to reclaim disk space. +.PP +The options are as follows: +.TP 5 +.B \-a +Write all pathnames as absolute pathnames, +instead of relative to the database home directories. +.TP 5 +.B \-h +Specify a home directory for the database. +.TP 5 +.B \-l +Write out the pathnames of all of the database log files, +whether or not they are involved in active transactions. +.TP 5 +.B \-s +Write the pathnames of all of the database files that need to be archived +in order to recover the database from catastrophic failure. +If any of the database files have not been accessed during the lifetime of +the current log files, +.I db_archive +will not include them in this output. +.sp +It is possible that some of the files referenced in the log have since +been deleted from the system. +In this case, +.I db_archive +will ignore them. +When +.IR db_recover (1) +is run, +any files referenced in the log that are not present during recovery are +assumed to have been deleted and will not be recovered. +.TP 5 +.B \-v +Run in verbose mode, listing the checkpoints in the log files as they +are reviewed. +.PP +.Si db_archive +.PP +.Ex db_archive +.SH "DB ARCHIVAL PROCEDURES +There are two aspects to managing the recoverability and disk consumption +of your DB databases. +First, you may want to periodically create snapshots of your databases +to make it possible to recover them from catastrophic failure. +Second, you'll want to periodically remove log files in order to conserve +on disk space. +The two procedures are distinct from each other, and you cannot remove the +current log files simply because you have created a database snapshot. +.PP +To create a snapshot of your database that can be used to recover +from catastrophic failure, the following steps should be taken: +.TP 5 +1. +Run +.I db_archive +\-s to identify all of the database data files that must be saved, +and copy them to a backup device, (e.g., tape). +If the database files are stored in a separate directory from the +other database files, it may be simpler to archive the directory +itself instead of the individual files. +.sp +.ft B +More importantly, if any of the database files have not been accessed during +the lifetime of the current log files, db_archive will not list them in its +output! +.ft R +For this reason, +it may be important to use a separate database file directory, +archiving it instead of the files listed by +.IR db_archive . +.TP 5 +2. +If your database is currently active, +i.e., you are reading and writing to the database files while the snapshot +is being taken, +run +.I db_archive +\-l to identify the database log files, +and copy them to a backup device, (e.g., tape). +If the database log files are stored in a separate directory from the +other database files, it may be simpler to archive the directory itself +instead of the individual files. +.PP +Note that the order of these operations is important, +and that the database files +.B must +be archived before the log files. +.PP +The DB library supports on-line backups, +and it is not necessary to stop reading or writing your databases during +the time when you create this snapshot. +Note however, +that the snapshot of an active database will be consistent as of some +unspecified time between the start of the archival and when archival is +completed. +To create a snapshot as of a specific time, +you must stop reading and writing your databases for the entire time of +the archival, force a checkpoint (see +.IR db_checkpoint (1)), +and then archive the files listed by the +.I db_archive +command's +.B \-s +and +.B \-l +options. +.PP +Once these steps are completed, +your database can be recovered from catastrophic failure to its state +as of the time the archival was done. +To update your snapshot so that recovery from catastrophic failure is +possible up to a new point in time, +repeat step #2, copying all existing log files to a backup device. +.PP +Each time that a complete snapshot is made, +i.e. all database and log files are copied to backup media, +you may discard all previous snapshots and saved log files. +.PP +The time to restore from catastrophic failure is a function of the number +of log records that have been written since the snapshot was originally +created. +Perhaps more importantly, +the more separate pieces of backup media you use, +the more likely that you will have a problem reading from one of them. +For these reasons, +it is often best to make snapshots on a regular basis. +.PP +.ft B +For archival safety remember to ensure that you have multiple copies of +your database backups, +that you verify that your archival media is error-free, +and that copies of your backups are stored off-site! +.ft R +.PP +To restore your database after catastrophic failure, +the following steps should be taken: +.TP 5 +1. +Restore the copies of the database files from the backup media. +.TP 5 +2. +Restore the copies of the log files from the backup media, +.BR "in the order in which they were written" . +(It's possible that the same log file appears on multiple backups, +and you only want the most recent version of that log file!) +.TP 5 +3. +Run +.I db_recover +\-c +to recover the database. +.PP +It is possible to recreate the database in a location different than the +original, +by specifying appropriate pathnames to the \-h option of the +.I db_recover +utility. +.PP +To remove log files, the following steps should be taken: +.TP 5 +1. +If you are concerned with catastrophic failure, +first copy them to backup media (e.g., tape), as described above. +This is because log files are necessary for recovery from catastrophic +failure. +.TP 5 +2. +Run +.IR db_archive , +without options, +to identify all of the log files that are no longer in use (e.g., involved +in an active transaction). +.TP 5 +3. +Remove those log files from the system. +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR db_archive : +.TP 5 +.Dh db_archive +.SH "SEE ALSO" +.Gn +.PP +.Sa diff --git a/mozilla/db/man/mancxx.roff/db_checkpoint.1 b/mozilla/db/man/mancxx.roff/db_checkpoint.1 new file mode 100644 index 00000000000..e6a6c18e876 --- /dev/null +++ b/mozilla/db/man/mancxx.roff/db_checkpoint.1 @@ -0,0 +1,919 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_checkpoint.so 10.11 (Sleepycat) 5/3/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_CHECKPOINT 1 "May 3, 1998" +.UC 7 +.SH NAME +db_checkpoint \- the DB database checkpoint utility +.SH SYNOPSIS +.nf +\fBdb_checkpoint\fP [\fB-1v\fP] [\fB-h home\fP] [\fB-k kbytes\fP] [\fB-L file\fP] [\fB-p min\fP] +.fi +.SH DESCRIPTION +The +.I db_checkpoint +utility is a daemon process that monitors the database log and periodically +calls +.IR txn_checkpoint (3) +to checkpoint it. +.PP +The options are as follows: +.TP 5 +.B \-1 +Checkpoint the log once, and then exit. +.TP 5 +.B \-h +Specify a home directory for the database. +.TP 5 +.B \-k +Checkpoint the database at least as often as every +.I kbytes +of log file are written. +.TP 5 +.Pi db_checkpoint +.TP 5 +.B \-p +Checkpoint the database at least every +.I min +minutes. +.TP 5 +.B \-v +Write the time of each checkpoint to the standard output. +.PP +At least one of the +.BR \-1 , +.B \-k +and +.B \-p +options must be specified. +.PP +.Si db_checkpoint +.PP +.Ex db_checkpoint +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR db_checkpoint : +.TP 5 +.Dh db_checkpoint +.SH "SEE ALSO" +.Gn +.PP +.Sa diff --git a/mozilla/db/man/mancxx.roff/db_deadlock.1 b/mozilla/db/man/mancxx.roff/db_deadlock.1 new file mode 100644 index 00000000000..81da69072b8 --- /dev/null +++ b/mozilla/db/man/mancxx.roff/db_deadlock.1 @@ -0,0 +1,922 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_deadlock.so 10.9 (Sleepycat) 4/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_DEADLOCK 1 "April 10, 1998" +.UC 7 +.SH NAME +db_deadlock \- the DB database deadlock detector +.SH SYNOPSIS +.nf +\fBdb_deadlock\fP [\fB-vw\fP] [\fB-a m | o | y\fP] [\fB-h home\fP]\c + [\fB-L file \fP] [\fB-t sec \fP] +.fi +.SH DESCRIPTION +The +.I db_deadlock +utility traverses the database lock structures and aborts a transaction +each time it detects a deadlock. +This utility should be run as a background daemon whenever multiple threads +or processes are using locking. +By default, +a random transaction involved in the deadlock is aborted. +.PP +The options are as follows: +.TP 5 +.B \-a +When a deadlock is detected, +abort the oldest (``o'') transaction, the youngest (``y'') transaction, +or the transaction with the minimum number of locks (``m''). +.TP 5 +.B \-h +Specify a home directory for the database. +.TP 5 +.Pi db_deadlock +.TP 5 +.B \-t +Initiate a pass over the database locks at least every +.I sec +seconds. +.TP 5 +.B \-v +Run in verbose mode, generating messages each time the detector runs. +.TP 5 +.B \-w +Make a single pass over the database locks every time a process is forced +to wait for a lock. +.PP +At least one of the +.B -t +and +.B -w +options must be specified. +.PP +.Si db_deadlock +.PP +.Ex db_deadlock +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR db_deadlock : +.TP 5 +.Dh db_deadlock +.SH "SEE ALSO" +.Gn +.PP +.Sa diff --git a/mozilla/db/man/mancxx.roff/db_dump.1 b/mozilla/db/man/mancxx.roff/db_dump.1 new file mode 100644 index 00000000000..f1bcb20e627 --- /dev/null +++ b/mozilla/db/man/mancxx.roff/db_dump.1 @@ -0,0 +1,1022 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_dump.so 10.10 (Sleepycat) 4/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_DUMP 1 "April 10, 1998" +.UC 7 +.SH NAME +db_dump \- the DB database dump utility +.SH SYNOPSIS +\fBdb_dump\fP [\fB-d\fP] [\fB-f output\fP] db_file +.br +\fBdb_dump\fP [\fB-p\fP] [\fB-f output\fP] [\fB-h home\fP] db_file +.br +\fBdb_dump185\fP [\fB-p\fP] [\fB-f output\fP] db_file +.SH DESCRIPTION +The +.I db_dump +utility reads the database file +.I db_file +and writes it to the standard output using a portable flat-text format +understood by the +.IR db_load (1) +utility. +The argument +.I db_file +must be a file produced using the +.I DB +library functions. +.PP +The +.I db_dump185 +utility is similar to the +.I db_dump +utility except that it reads databases in the format used by DB versions +1.85 and 1.86. +.PP +The options are as follows: +.TP 5 +.B \-d +Dump the specified database in a format helpful for debugging the DB +library routines. +.ft B +The output format of the \-d option is not standard and may change, +without notice, +between releases of the DB library. +.ft R +.TP 5 +.B \-f +Write to the specified +.I file +instead of to the standard output. +.TP 5 +.B \-h +Specify a home directory for the database. +As DB versions before 2.0 did not support the concept of a database ``home'', +.I db_dump185 +does not support this option. +.TP 5 +.B \-p +If characters in either the key or data items are printing characters +(as defined by +.IR isprint (3)), +use printing characters in +.I file +to represent them. +This option permits users to use standard text editors to modify +the contents of databases. +.IP +Note, different systems may have different notions as to what characters +are ``printing'', and databases dumped in this manner may be less portable +to external systems. +.PP +Dumping and reloading hash databases that use user-defined hash functions +will result in new databases that use the default hash function. +While using the default hash function may not be optimal for the new database, +it will continue to work correctly. +.PP +Dumping and reloading btree databases that use user-defined prefix or +comparison functions will result in new databases that use the default +prefix and comparison functions. +.ft B +In this case, it is quite likely that the database will be damaged +beyond repair permitting neither record storage or retrieval. +.ft R +.PP +The only available workaround for either case is to modify the sources +for the +.IR db_load (1) +utility to load the database using the correct hash, prefix and comparison +functions. +.PP +The +.I db_dump185 +utility may not be available on your system as it is not always installed +when the DB libraries and utilities are installed. +If you are unable to find it, +see your system administrator for further information. +.PP +.Ex db_dump +.Ex db_dump185 +.SH "OUTPUT FORMATS +There are two output formats used by +.I db_dump +and +.IR db_dump185 . +.PP +In both output formats, the first few lines of the output contain +header information describing the underlying access method, filesystem page +size and other bookkeeping information. +This information is output in ``name=value'' pairs, where ``name'' may +be any of the keywords listed in the +.IR db_load (1) +manual page, and ``value'' will be its value. +While this header information can be edited before the database is +reloaded, +there is rarely any reason to do so, as all of this information can be +overridden by command-line arguments to +.IR db_load . +.PP +Following the header information are the key/data pairs from the database. +If the database being dumped is of type +.B btree +or +.BR hash , +the output will be paired lines of text, +where the first line of the pair is the key item, +and the second line of the pair is its corresponding data item. +If the database being dumped is of type +.BR recno , +the output will be lines of text, +where each line is a new data item for the database. +.PP +If the +.B \-p +option was specified, each output line will consist of single characters +representing any characters from the database that were ``printing'', +and backslash (``\e'') escaped characters for any that were not. +Backslash characters appearing in the output mean one of two things: +if the backslash character precedes another backslash character, +it means that a literal backslash character occurred in the key or data +item. +If the backslash character precedes any other character, +the next two characters should be interpreted as hexadecimal specification +of a single character, e.g., ``\e0a'' is a newline character in the ASCII +character set. +.PP +If the +.B \-p +option was not specified, each output line will consist of paired hexadecimal +values, e.g., the line ``726f6f74'' is the string ``root'' in the ASCII +character set. +.PP +In both output formats, +a single newline character ends both the key and data items. +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR db_dump : +.TP 5 +.Dh db_dump +.SH "SEE ALSO" +.IR isprint (3) +.PP +.Gn +.PP +.Sa diff --git a/mozilla/db/man/mancxx.roff/db_load.1 b/mozilla/db/man/mancxx.roff/db_load.1 new file mode 100644 index 00000000000..0c9e38f2a10 --- /dev/null +++ b/mozilla/db/man/mancxx.roff/db_load.1 @@ -0,0 +1,1056 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_load.so 10.11 (Sleepycat) 6/2/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_LOAD 1 "June 2, 1998" +.UC 7 +.SH NAME +db_load \- the DB database loader +.SH SYNOPSIS +\fBdb_load\fP [\fB-nT\fP] [\fB-c name=value\fP] +.br +.ti +5 +[\fB-f file\fP] [\fB-h home\fP] [\fB-t btree | hash | recno\fP] db_file +.SH DESCRIPTION +The +.I db_load +utility reads from the standard input +and loads it into the database +.IR db_file . +The database +.I db_file +is created if it does not already exist. +.PP +The input to +.I db_load +must be in the output format specified by the +.I db_dump +or +.I db_dump185 +utilities (see +.IR db_dump (1) +for more information), or as specified for the +.B \-T +option below. +.PP +The options are as follows: +.TP 5 +.B \-c +Specify configuration options for the DB_INFO structure provided to +.IR db_open (3), +ignoring any value they may have based on the input. +The command-line format is ``name=value''. +Supported keywords are listed below. +.TP 5 +.B \-f +Read from the specified +.I input +file instead of from the standard input. +.TP 5 +.B \-h +Specify a home directory for the database. +.sp +If a home directory is specified, the database environment is opened +using the DB_INIT_LOCK, DB_INIT_LOG, DB_INIT_MPOOL, DB_INIT_TXN and +DB_USE_ENVIRON flags to +.IR db_appinit (3). +(This means that +.I db_load +can be used to load data into databases while they are in use by other +processes.) +If the +.I db_appinit +call fails, or if no home directory is specified, the database is still +updated, but the environment is ignored, e.g., no locking is done. +.TP 5 +.B \-n +Do not overwrite existing keys in the database when loading into an +already existing database. +If a key/data pair cannot be loaded into the database for this reason, +a warning message is displayed on the standard error output and the +key/data pair are skipped. +.TP 5 +.B \-T +The +.B \-T +option allows non-DB applications to easily load text files into databases. +.sp +If the database to be created is of type +.B btree +or +.BR hash , +the input must be paired lines of text, +where the first line of the pair is the key item, +and the second line of the pair is its corresponding data item. +If the database to be created is of type +.BR recno , +the input must be lines of text, +where each line is a new data item for the database. +.sp +A simple escape mechanism, where newline and backslash (``\e'') characters +are special, is applied to the text input. +Newline characters are interpreted as record separators. +Backslash characters in the text will be interpreted in one of two ways: +if the backslash character precedes another backslash character, the pair +will be interpreted as a literal backslash. +If the backslash character precedes any other character, the two characters +following the backslash will be interpreted as hexadecimal specification of +a single character, e.g., ``\e0a'' is a newline character in the ASCII +character set. +.sp +For this reason, any backslash or newline characters that naturally occur +in the text input must be escaped to avoid misinterpretation by +.IR db_load . +.sp +If the +.B \-T +option is specified, the underlying access method type must be specified +using the +.B \-t +option. +.TP 5 +.B \-t +Specify the underlying access method. +If no +.B \-t +option is specified, the database will be loaded into a database of the +same type as was dumped, +e.g., a hash database will be created if a hash database was dumped. +.sp +Btree and hash databases may be converted from one to the other. +Recno databases may not be converted to any other database type +or from any other database type. +.PP +The +.I db_load +utility exits 0 on success, 1 if one or more key/data pairs were not +loaded into the database because the key already existed, and >1 if +an error occurs. +.SH KEYWORDS +The following keywords are supported for the +.B \-c +command-line option. +See +.IR db_open (3) +for further discussion of these keywords and what values should be specified. +.PP +The parenthetical listing specifies how the value part of the ``name=value'' +pair is interpreted. +Items listed as (boolean) expect value to be ``1'' (set) or ``0'' (unset). +Items listed as (number) convert value to a number. +Items listed as (string) use the characters of value directly. +.TP 5 +bt_minkey (number) +The minimum number of keys per page. +.TP 5 +db_lorder (number) +The byte order for integers in the stored database metadata. +.TP 5 +db_pagesize (number) +The size of pages used for nodes in the tree, in bytes. +.TP 5 +duplicates (boolean) +The value of the DB_DUP flag. +.TP 5 +h_ffactor (number) +The density within the hash table. +.TP 5 +h_nelem (number) +The size of the hash table. +.TP 5 +re_len (number) +Specify fixed-length records of the specified length. +.TP 5 +re_pad (string) +Specify the fixed-length record pad character. +.TP 5 +recnum (boolean) +The value of the DB_RECNUM flag. +.TP 5 +renumber (boolean) +The value of the DB_RENUMBER flag. +.SH "EXAMPLES +The +.I db_load +utility can be used to load text files into databases. +For example, the following command loads the standard UNIX +.I /etc/passwd +file into a database, +with the login name as the key item and the entire password entry as the +data item: +.nf +.RS +awk -F: '{print $1; print $0}' < /etc/passwd | + sed 's/\e\e/\e\e\e\e/g' | db_load -T -t hash passwd.db +.RE +.fi +.PP +Note that backslash characters naturally occurring in the text are escaped +to avoid interpretation as escape characters by +.IR db_load . +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR db_load : +.TP 5 +.Dh db_load +.SH "SEE ALSO" +.Gn +.PP +.Sa diff --git a/mozilla/db/man/mancxx.roff/db_recover.1 b/mozilla/db/man/mancxx.roff/db_recover.1 new file mode 100644 index 00000000000..10460cfc832 --- /dev/null +++ b/mozilla/db/man/mancxx.roff/db_recover.1 @@ -0,0 +1,1030 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_recover.so 10.11 (Sleepycat) 4/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_RECOVER 1 "April 10, 1998" +.UC 7 +.SH NAME +db_recover \- the DB database recovery utility +.SH SYNOPSIS +\fBdb_recover\fP [\fB-cv\fP] [\fB-h home\fP] +.SH DESCRIPTION +The +.I db_recover +utility must be run after an unexpected application, DB, or system failure to +restore the database to a consistent state. +All committed transactions are guaranteed to appear after +.I db_recover +has run, and all uncommitted transactions will be completely undone. +.PP +The options are as follows: +.TP 5 +.B \-c +Failure was catastrophic. +.TP 5 +.B \-h +Specify a home directory for the database. +.TP 5 +.B \-v +Run in verbose mode. +.PP +In the case of catastrophic failure, an archival copy, +or ``snapshot'' of all database files must be restored along with all of the +log files written since the database file snapshot was made. +(If disk space is a problem, log files may be referenced by symbolic links). +For further information on creating a database snapshot, see ``DB ARCHIVAL +PROCEDURES'' in +.IR db_archive (1). +.PP +If the failure was not catastrophic, +the files present on the system at the time of failure are sufficient +to perform recovery. +.PP +If log files are missing, +.I db_recover +will identify the missing log file(s) and fail, +in which case the missing log files need to be restored and recovery +performed again. +.PP +.Si db_recover +.PP +.Ex db_recover +.SH "FILESYSTEM OPERATIONS +.ft B +Filesystem operations, +e.g., moving the database environment to a different machine or file creation, +deletion or renaming, cannot be transaction protected. +.ft R +For this reason, +.I db_recover +cannot re-create, delete or rename files as part of recovery. +.PP +If +.I db_recover +cannot find a database file referenced in the log, it will output a warning +message that it was unable to locate a file it expected to find. +This message is only a warning, as the file may have subsequently been +deleted as part of normal database operations before the failure occurred. +.ft B +Note that committed transactions that involved these missing files are rolled +forward, even though the files were not found. +If the files were not intentionally deleted (e.g., they were created after +the last database snapshot, but were lost during a failure), they +must be manually created (using +.IR db_open (3)), +and +.I db_recover +must be rerun. +.ft R +.PP +Generally, it is simplest to perform filesystem operations at the same time as +making a snapshot of the database. +To perform filesystem operations: +.RS +.TP 5 +1. +Cleanly shutdown database operations. +.Nt +2. +Rename, create or delete files. +.Nt +3. +Make a snapshot of the database. +.Nt +4. +Restart database applications. +.RE +.PP +To cleanly shutdown database operations, +all applications accessing the database environment must be shutdown. +If the applications are not implemented such that they can be shutdown +gracefully (i.e., closing all references to the database environment), +.I db_recover +must be run after all applications have been killed to ensure that the +underlying database is consistent and flushed to disk. +.SH "RECOVERY +After an application or system failure, +there are two possible approaches to database recovery. +If there is no need to retain state across the failure, +and all databases can be started anew, +the database home directory can simply be removed and recreated. +If it is necessary to retain persistent state across failures, +then the +.IR db_recover (1) +utility should be run for each DB application environment, i.e., +each database home directory. +.PP +The +.I db_recover +utility will remove all the shared regions (which may have been corrupted +by the failure), +establish the end of the log by identifying the last record written to the +log, +and then perform transaction recovery. +Database applications must not be restarted until recovery completes. +During transaction recovery, +all changes made by aborted transactions are undone and all changes made by +committed transactions are redone, as necessary. +After recovery runs, +the environment is properly initialized so that applications may be restarted. +Any time an application crashes or the system fails, +.I db_recover +should be run on any exiting database environments. +.PP +Additionally, +there are two forms of recovery: normal recovery and catastrophic recovery. +The DB package defines catastrophic failure to be failure where either the +database or log files have been destroyed or corrupted from the point of +view of the filesystem. +For example, +catastrophic failure includes the case where the disk drive on which either +the database or logs are stored has crashed, +or when filesystem recovery is unable to bring the database and log files +to a consistent state with respect to the filesystem. +If the failure is non-catastrophic, i.e., the database files and log +are accessible on a filesystem that has recovered cleanly, +.I db_recover +will review the logs and database files to ensure that all committed +transactions appear and that all uncommitted transactions are undone. +If the failure is catastrophic, +a snapshot of the database files and the archived log files must be restored +onto the system. +Then +.I db_recover +will review the logs and database files to bring the database to a +consistent state as of the date of the last archived log file. +Only transactions committed before that date will appear in the database. +See +.I db_archive (1) +for specific information about archiving and recovering databases +after catastrophic failure. +.PP +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR db_recover : +.TP 5 +.Dh db_recover +.SH BUGS +Future versions of DB are expected to remove the restriction that database +files must be manually created before recovery is performed. +.SH "SEE ALSO" +.Gn +.PP +.Sa diff --git a/mozilla/db/man/mancxx.roff/db_stat.1 b/mozilla/db/man/mancxx.roff/db_stat.1 new file mode 100644 index 00000000000..4026b79094f --- /dev/null +++ b/mozilla/db/man/mancxx.roff/db_stat.1 @@ -0,0 +1,965 @@ +.ds TYPE C +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1996, 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)db_stat.so 8.13 (Sleepycat) 5/10/98 +.\" +.\" +.\" See the file LICENSE for redistribution information. +.\" +.\" Copyright (c) 1997, 1998 +.\" Sleepycat Software. All rights reserved. +.\" +.\" @(#)macros.so 10.45 (Sleepycat) 5/4/98 +.\" +.\" We don't want hyphenation for any HTML documents. +.ie '\*[HTML]'YES'\{\ +.nh +\} +.el\{\ +.ds Hy +.hy +.. +.ds Nh +.nh +.. +\} +.\" The alternative text macro +.\" This macro takes two arguments: +.\" + the text produced if this is a "C" manpage +.\" + the text produced if this is a "CXX" or "JAVA" manpage +.\" +.de Al +.ie '\*[TYPE]'C'\{\\$1 +\} +.el\{\\$2 +\} +.. +.\" Scoped name macro. +.\" Produces a_b, a::b, a.b depending on language +.\" This macro takes two arguments: +.\" + the class or prefix (without underscore) +.\" + the name within the class or following the prefix +.de Sc +.ie '\*[TYPE]'C'\{\\$1_\\$2 +\} +.el\{\ +.ie '\*[TYPE]'CXX'\{\\$1::\\$2 +\} +.el\{\\$1.\\$2 +\} +\} +.. +.\" Scoped name for Java. +.\" Produces Db.b, for Java, otherwise just b. This macro is used for +.\" constants that must be scoped in Java, but are global otherwise. +.\" This macro takes two arguments: +.\" + the class +.\" + the name within the class or following the prefix +.de Sj +.ie '\*[TYPE]'JAVA'\{\ +.TP 5 +Db.\\$1\} +.el\{\ +.TP 5 +\\$1\} +.. +.\" The general information text macro. +.de Gn +.ie '\*[TYPE]'C'\{The DB library is a family of groups of functions that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the functional groups (e.g., the file page caching functions) +are useful independent of the other DB functions, +although some functional groups are explicitly based on other functional +groups (e.g., transactions and logging). +\} +.el\{The DB library is a family of classes that provides a modular +programming interface to transactions and record-oriented file access. +The library includes support for transactions, locking, logging and file +page caching, as well as various indexed access methods. +Many of the classes (e.g., the file page caching class) +are useful independent of the other DB classes, +although some classes are explicitly based on other classes +(e.g., transactions and logging). +\} +For a general description of the DB package, see +.IR db_intro (3). +.. +.\" The library error macro, the local error macro. +.\" These macros take one argument: +.\" + the function name. +.de Ee +The +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.if '\*[TYPE]'CXX'\{ +or return +.I errno +\} +\} +for any of the errors specified for the following DB and library functions: +.. +.de Ec +In addition, the +.I \\$1 +.ie '\*[TYPE]'C'\{function may fail and return +.I errno +\} +.el\{method may fail and throw a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or return +.I errno +\} +.el\{encapsulating an +.I errno +\} +\} +for the following conditions: +.. +.de Ea +[EAGAIN] +A lock was unavailable. +.. +.de Eb +[EBUSY] +The shared memory region was in use and the force flag was not set. +.. +.de Em +[EAGAIN] +The shared memory region was locked and (repeatedly) unavailable. +.. +.de Ei +[EINVAL] +An invalid flag value or parameter was specified. +.. +.de Es +[EACCES] +An attempt was made to modify a read-only database. +.. +.de Et +The DB_THREAD flag was specified and spinlocks are not implemented for +this architecture. +.. +.de Ep +[EPERM] +Database corruption was detected. +All subsequent database calls (other than +.ie '\*[TYPE]'C'\{\ +.IR DB->close ) +\} +.el\{\ +.IR Db::close ) +\} +will return EPERM. +.. +.de Ek +.if '\*[TYPE]'CXX'\{\ +Methods marked as returning +.I errno +will, by default, throw an exception that encapsulates the error information. +The default error behavior can be changed, see +.IR DbException (3). +\} +.. +.\" The SEE ALSO text macro +.de Sa +.\" make the line long for nroff. +.if n .ll 72 +.nh +.na +.IR db_archive (1), +.IR db_checkpoint (1), +.IR db_deadlock (1), +.IR db_dump (1), +.IR db_load (1), +.IR db_recover (1), +.IR db_stat (1), +.IR db_intro (3), +.ie '\*[TYPE]'C'\{\ +.IR db_appinit (3), +.IR db_cursor (3), +.IR db_dbm (3), +.IR db_internal (3), +.IR db_lock (3), +.IR db_log (3), +.IR db_mpool (3), +.IR db_open (3), +.IR db_thread (3), +.IR db_txn (3) +\} +.el\{\ +.IR db_internal (3), +.IR db_thread (3), +.IR Db (3), +.IR Dbc (3), +.IR DbEnv (3), +.IR DbException (3), +.IR DbInfo (3), +.IR DbLock (3), +.IR DbLockTab (3), +.IR DbLog (3), +.IR DbLsn (3), +.IR DbMpool (3), +.if !'\*[TYPE]'JAVA'\{\ +.IR DbMpoolFile (3), +\} +.IR Dbt (3), +.IR DbTxn (3), +.IR DbTxnMgr (3) +\} +.ad +.Hy +.. +.\" The function header macro. +.\" This macro takes one argument: +.\" + the function name. +.de Fn +.in 2 +.I \\$1 +.in +.. +.\" The XXX_open function text macro, for merged create/open calls. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Co +.ie '\*[TYPE]'C'\{\ +.Fn \\$2_open +The +.I \\$2_open +function copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +.PP +If the +.I dbenv +argument to +.I \\$2_open +was initialized using +.IR db_appinit , +.I dir +is interpreted as described by +.IR db_appinit (3). +\} +.el\{\ +.Fn \\$2::open +The +.I \\$2::open +.ie '\*[TYPE]'CXX'\{\ +method copies a pointer, to the \\$1 identified by the +.B directory +.IR dir , +into the memory location referenced by +.IR regionp . +\} +.el\{\ +method returns a \\$1 identified by the +.B directory +.IR dir . +\} +.PP +If the +.I dbenv +argument to +.I \\$2::open +was initialized using +.IR DbEnv::appinit , +.I dir +is interpreted as described by +.IR DbEnv (3). +\} +.PP +Otherwise, +if +.I dir +is not NULL, +it is interpreted relative to the current working directory of the process. +If +.I dir +is NULL, +the following environment variables are checked in order: +``TMPDIR'', ``TEMP'', and ``TMP''. +If one of them is set, +\\$1 files are created relative to the directory it specifies. +If none of them are set, the first possible one of the following +directories is used: +.IR /var/tmp , +.IR /usr/tmp , +.IR /temp , +.IR /tmp , +.I C:/temp +and +.IR C:/tmp . +.PP +All files associated with the \\$1 are created in this directory. +This directory must already exist when +.ie '\*[TYPE]'C'\{ +\\$1_open +\} +.el\{\ +\\$2::open +\} +is called. +If the \\$1 already exists, +the process must have permission to read and write the existing files. +If the \\$1 does not already exist, +it is optionally created and initialized. +.. +.\" The common close language macro, for discarding created regions +.\" This macro takes one argument: +.\" + the function prefix, e.g., txn (the class name for C++, e.g., DbTxn) +.de Cc +In addition, if the +.I dir +argument to +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vo \\$1_open +.ds Vu \\$1_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vo \\$1::open +.ds Vu \\$1::unlink +\} +.I \\*(Vo +was NULL +and +.I dbenv +was not initialized using +.IR \\*(Va , +.if '\\$1'memp'\{\ +or the DB_MPOOL_PRIVATE flag was set, +\} +all files created for this shared region will be removed, +as if +.I \\*(Vu +were called. +.rm Va +.rm Vo +.rm Vu +.. +.\" The DB_ENV information macro. +.\" This macro takes two arguments: +.\" + the function called to open, e.g., "txn_open" +.\" + the function called to close, e.g., "txn_close" +.de En +.ie '\*[TYPE]'C'\{\ +based on the +.I dbenv +argument to +.IR \\$1 , +which is a pointer to a structure of type DB_ENV (typedef'd in ). +Applications will normally use the same DB_ENV structure (initialized +by +.IR db_appinit (3)), +as an argument to all of the subsystems in the DB package. +.PP +References to the DB_ENV structure are maintained by DB, +so it may not be discarded until the last close function, +corresponding to an open function for which it was an argument, +has returned. +In order to ensure compatibility with future releases of DB, all fields of +the DB_ENV structure that are not explicitly set should be initialized to 0 +before the first time the structure is used. +Do this by declaring the structure external or static, or by calling the C +library routine +.IR bzero (3) +or +.IR memset (3). +.PP +The fields of the DB_ENV structure used by +.I \\$1 +are described below. +.if '\*[TYPE]'CXX'\{\ +As references to the DB_ENV structure may be maintained by +.IR \\$1 , +it is necessary that the DB_ENV structure and memory it references be valid +until the +.I \\$2 +function is called. +\} +.ie '\\$1'db_appinit'\{The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{If +.I dbenv +is NULL +or any of its fields are set to 0, +defaults appropriate for the system are used where possible. +\} +.PP +The following fields in the DB_ENV structure may be initialized before calling +.IR \\$1 : +\} +.el\{\ +based on which set methods have been used. +It is expected that applications will use a single DbEnv object as the +argument to all of the subsystems in the DB package. +The fields of the DbEnv object used by +.I \\$1 +are described below. +As references to the DbEnv object may be maintained by +.IR \\$1 , +it is necessary that the DbEnv object and memory it references be valid +until the object is destroyed. +.ie '\\$1'appinit'\{\ +The +.I dbenv +argument may not be NULL. +If any of the fields of the +.I dbenv +are set to 0, +defaults appropriate for the system are used where possible. +\} +.el\{\ +Any of the DbEnv fields that are not explicitly set will default to +appropriate values. +\} +.PP +The following fields in the DbEnv object may be initialized, using the +appropriate set method, before calling +.IR \\$1 : +\} +.. +.\" The DB_ENV common fields macros. +.de Se +.if '\*[TYPE]'JAVA'\{\ +.TP 5 +DbErrcall db_errcall; +.ns +.TP 5 +String db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.ie '\*[TYPE]'CXX'\{\ +.TP 5 +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +class ostream *db_error_stream; +.ns +.TP 5 +int db_verbose; +The error fields of the DbEnv behave as described for +.IR DbEnv (3). +\} +.el\{\ +void *(*db_errcall)(char *db_errpfx, char *buffer); +.ns +.TP 5 +FILE *db_errfile; +.ns +.TP 5 +const char *db_errpfx; +.ns +.TP 5 +int db_verbose; +The error fields of the DB_ENV behave as described for +.IR db_appinit (3). +.sp +\} +.. +.\" The open flags. +.de Fm +The +.I flags +and +.I mode +arguments specify how files will be opened and/or created when they +don't already exist. +The flags value is specified by +.BR or 'ing +together one or more of the following values: +.Sj DB_CREATE +Create any underlying files, as necessary. +If the files do not already exist and the DB_CREATE flag is not specified, +the call will fail. +.. +.\" DB_THREAD open flag macro. +.\" This macro takes two arguments: +.\" + the open function name +.\" + the object it returns. +.de Ft +.TP 5 +.Sj DB_THREAD +Cause the \\$2 handle returned by the +.I \\$1 +.Al function method +to be useable by multiple threads within a single address space, +i.e., to be ``free-threaded''. +.if '\*[TYPE]'JAVA'\{\ +Threading is assumed in the Java API, +so no special flags are required, +and DB functions will always behave as if the DB_THREAD flag was specified. +\} +.. +.\" The mode macro. +.\" This macro takes one argument: +.\" + the subsystem name. +.de Mo +All files created by the \\$1 are created with mode +.I mode +(as described in +.IR chmod (2)) +and modified by the process' umask value at the time of creation (see +.IR umask (2)). +The group ownership of created files is based on the system and directory +defaults, and is not further specified by DB. +.. +.\" The application exits macro. +.\" This macro takes one argument: +.\" + the application name. +.de Ex +The +.I \\$1 +utility exits 0 on success, and >0 if an error occurs. +.. +.\" The application -h section. +.\" This macro takes one argument: +.\" + the application name +.de Dh +DB_HOME +If the +.B \-h +option is not specified and the environment variable +.I DB_HOME +is set, it is used as the path of the database home, as described in +.IR db_appinit (3). +.. +.\" The function DB_HOME ENVIRONMENT VARIABLES section. +.\" This macro takes one argument: +.\" + the open function name +.de Eh +DB_HOME +If the +.I dbenv +argument to +.I \\$1 +was initialized using +.IR db_appinit , +the environment variable DB_HOME may be used as the path of the database +home for the interpretation of the +.I dir +argument to +.IR \\$1 , +as described in +.IR db_appinit (3). +.if \\n(.$>1 \{Specifically, +.I \\$1 +is affected by the configuration string value of \\$2.\} +.. +.\" The function TMPDIR ENVIRONMENT VARIABLES section. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix, e.g., "txn" (or the class name for C++, e.g., "DbTxn") +.de Ev +TMPDIR +If the +.I dbenv +argument to +.ie '\*[TYPE]'C'\{\ +.ds Vo \\$2_open +\} +.el\{\ +.ds Vo \\$2::open +\} +.I \\*(Vo +was NULL or not initialized using +.IR db_appinit , +the environment variable TMPDIR may be used as the directory in which to +create the \\$1, +as described in the +.I \\*(Vo +section above. +.rm Vo +.. +.\" The unused flags macro. +.de Fl +The +.I flags +parameter is currently unused, and must be set to 0. +.. +.\" The no-space TP macro. +.de Nt +.br +.ns +.TP 5 +.. +.\" The return values of the functions macros. +.\" Rc is the standard two-value return with a suffix for more values. +.\" Ro is the standard two-value return but there were previous values. +.\" Rt is the standard two-value return, returning errno, 0, or < 0. +.\" These macros take one argument: +.\" + the routine name +.de Rc +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure, +0 on success, +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure, +0 on success, +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Ro +Otherwise, the +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure, +\} +\} +.. +.de Rt +The +.I \\$1 +.ie '\*[TYPE]'C'\{function returns the value of +.I errno +on failure and 0 on success. +\} +.el\{method throws a +.IR DbException (3) +.ie '\*[TYPE]'CXX'\{or returns the value of +.I errno +on failure and 0 on success. +\} +.el\{that encapsulates an +.I errno +on failure. +\} +\} +.. +.\" The TXN id macro. +.de Tx +.IP +If the file is being accessed under transaction protection, +the +.I txnid +parameter is a transaction ID returned from +.IR txn_begin , +otherwise, NULL. +.. +.\" The XXX_unlink function text macro. +.\" This macro takes two arguments: +.\" + the interface, e.g., "transaction region" +.\" + the prefix (for C++, this is the class name) +.de Un +.ie '\*[TYPE]'C'\{\ +.ds Va db_appinit +.ds Vc \\$2_close +.ds Vo \\$2_open +.ds Vu \\$2_unlink +\} +.el\{\ +.ds Va DbEnv::appinit +.ds Vc \\$2::close +.ds Vo \\$2::open +.ds Vu \\$2::unlink +\} +.Fn \\*(Vu +The +.I \\*(Vu +.Al function method +destroys the \\$1 identified by the directory +.IR dir , +removing all files used to implement the \\$1. +.ie '\\$2'log' \{(The log files themselves and the directory +.I dir +are not removed.)\} +.el \{(The directory +.I dir +is not removed.)\} +If there are processes that have called +.I \\*(Vo +without calling +.I \\*(Vc +(i.e., there are processes currently using the \\$1), +.I \\*(Vu +will fail without further action, +unless the force flag is set, +in which case +.I \\*(Vu +will attempt to remove the \\$1 files regardless of any processes +still using the \\$1. +.PP +The result of attempting to forcibly destroy the region when a process +has the region open is unspecified. +Processes using a shared memory region maintain an open file descriptor +for it. +On UNIX systems, the region removal should succeed +and processes that have already joined the region should continue to +run in the region without change, +however processes attempting to join the \\$1 will either fail or +attempt to create a new region. +On other systems, e.g., WNT, where the +.IR unlink (2) +system call will fail if any process has an open file descriptor +for the file, +the region removal will fail. +.PP +In the case of catastrophic or system failure, +database recovery must be performed (see +.IR db_recover (1) +or the DB_RECOVER and DB_RECOVER_FATAL flags to +.IR \\*(Va (3)). +Alternatively, if recovery is not required because no database state is +maintained across failures, +it is possible to clean up a \\$1 by removing all of the +files in the directory specified to the +.I \\*(Vo +.Al function, method, +as \\$1 files are never created in any directory other than the one +specified to +.IR \\*(Vo . +Note, however, +that this has the potential to remove files created by the other DB +subsystems in this database environment. +.PP +.Rt \\*(Vu +.rm Va +.rm Vo +.rm Vu +.rm Vc +.. +.\" Signal paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Si +The +.I \\$1 +utility attaches to DB shared memory regions. +In order to avoid region corruption, +it should always be given the chance to detach and exit gracefully. +To cause +.I \\$1 +to clean up after itself and exit, +send it an interrupt signal (SIGINT). +.. +.\" Logging paragraph for standard utilities. +.\" This macro takes one argument: +.\" + the utility name. +.de Pi +.B \-L +Log the execution of the \\$1 utility to the specified file in the +following format, where ``###'' is the process ID, and the date is +the time the utility starting running. +.sp +\\$1: ### Wed Jun 15 01:23:45 EDT 1995 +.sp +This file will be removed if the \\$1 utility exits gracefully. +.. +.\" Malloc paragraph. +.\" This macro takes one argument: +.\" + the allocated object +.de Ma +.if !'\*[TYPE]'JAVA'\{\ +\\$1 are created in allocated memory. +If +.I db_malloc +is non-NULL, +it is called to allocate the memory, +otherwise, +the library function +.IR malloc (3) +is used. +The function +.I db_malloc +must match the calling conventions of the +.IR malloc (3) +library routine. +Regardless, +the caller is responsible for deallocating the returned memory. +To deallocate the returned memory, +free each returned memory pointer; +pointers inside the memory do not need to be individually freed. +\} +.. +.\" Underlying function paragraph. +.\" This macro takes two arguments: +.\" + the function name +.\" + the utility name +.de Uf +The +.I \\$1 +.Al function method +is the underlying function used by the +.IR \\$2 (1) +utility. +See the source code for the +.I \\$2 +utility for an example of using +.I \\$1 +in a UNIX environment. +.. +.\" Underlying function paragraph, for C++. +.\" This macro takes three arguments: +.\" + the C++ method name +.\" + the function name for C +.\" + the utility name +.de Ux +The +.I \\$1 +method is based on the C +.I \\$2 +function, which +is the underlying function used by the +.IR \\$3 (1) +utility. +See the source code for the +.I \\$3 +utility for an example of using +.I \\$2 +in a UNIX environment. +.. +.TH DB_STAT 1 "May 10, 1998" +.UC 7 +.SH NAME +db_stat \- display DB statistics +.SH SYNOPSIS +\fBdb_stat\fP [\fB-clmNt\fP] +.ti +5 +[\fB-C Acfhlmo\fP] [\fB-d file\fP] [\fB-h home\fP] [\fB-M Ahlm\fP] +.SH DESCRIPTION +The +.I db_stat +utility displays statistics for DB environments. +.PP +The options are as follows: +.TP 5 +.B \-C +Display internal information about the lock region. +(The output from this option is often both voluminous and meaningless, +and is intended only for debugging.) +.RS +.TP 5 +.B \-A +Display all information. +.Nt +.B \-c +Display lock conflict matrix. +.Nt +.B \-f +Display lock and object free lists. +.Nt +.B \-l +Display lockers within hash chains. +.Nt +.B \-m +Display region memory information. +.Nt +.B \-o +Display objects within hash chains. +.RE +.TP 5 +.B \-c +Display lock region statistics as described in +.IR db_lock (3). +.TP 5 +.B \-d +Display database statistics for the specified database, +as described in +.IR db_open (3). +.TP 5 +.B \-h +Specify a home directory for the database. +.TP 5 +.B \-l +Display log region statistics as described in +.IR db_log (3). +.TP 5 +.B \-M +Display internal information about the shared memory buffer pool. +(The output from this option is often both voluminous and meaningless, +and is intended only for debugging.) +.RS +.TP 5 +.B \-A +Display all information. +.Nt +.B \-h +Display buffers within hash chains. +.Nt +.B \-l +Display buffers within LRU chains. +.Nt +.B \-m +Display region memory information. +.RE +.TP 5 +.B \-m +Display shared memory buffer pool statistics as described in +.IR db_mpool (3). +.TP 5 +.B \-N +Don't acquire locks while displaying the statistics. +This option is intended only for debugging corrupt regions and should not +be used under any other circumstances. +.TP 5 +.B \-t +Display transaction region statistics as described in +.IR db_txn (3). +.PP +.Si db_stat +.PP +Values smaller than 10 million are generally displayed without +any special notation. +Values larger than 10 million are normally displayed as ``M''. +.PP +.Ex db_stat +.SH "ENVIRONMENT VARIABLES" +The following environment variables affect the execution of +.IR db_stat : +.TP 5 +.Dh db_load +.SH "SEE ALSO" +.Gn +.PP +.Sa diff --git a/mozilla/db/man/mancxx.text/Db.0 b/mozilla/db/man/mancxx.text/Db.0 new file mode 100644 index 00000000000..715847693a1 --- /dev/null +++ b/mozilla/db/man/mancxx.text/Db.0 @@ -0,0 +1,756 @@ + + +NNAAMMEE + Db - database access class + +SSYYNNOOPPSSIISS + ##iinncclluuddee <> + + ssttaattiicc iinntt + DDbb::::ooppeenn((ccoonnsstt cchhaarr **ffnnaammee,, DDBBTTYYPPEE ttyyppee,, + uu__iinntt3322__tt ffllaaggss,, iinntt mmooddee,, DDbbEEnnvv **ddbbeennvv,, DDbbIInnffoo **ddbbiinnffoo,, DDbb ****ddbbpppp));; + + DDBBTTYYPPEE + DDbb::::ggeett__ttyyppee((vvooiidd)) ccoonnsstt;; + + iinntt + DDbb::::cclloossee((uu__iinntt3322__tt ffllaaggss));; + + iinntt + DDbb::::ccuurrssoorr((DDbbTTxxnn **ttxxnniidd,, DDbbcc ****ccuurrssoorrpp));; + + iinntt + DDbb::::ddeell((DDbbtt **kkeeyy,, DDbbTTxxnn **ttxxnniidd));; + + iinntt + DDbb::::ffdd((iinntt **ffddpp));; + + iinntt + DDbb::::ggeett((DDbbTTxxnn **ttxxnniidd,, DDbbtt **kkeeyy,, DDbbtt **ddaattaa,, uu__iinntt3322__tt ffllaaggss));; + + iinntt + DDbb::::ppuutt((DDbbTTxxnn **ttxxnniidd,, DDbbtt **kkeeyy,, DDbbtt **ddaattaa,, uu__iinntt3322__tt ffllaaggss));; + + iinntt + DDbb::::ssttaatt((vvooiidd **sspp,, vvooiidd **((**ddbb__mmaalllloocc))((ssiizzee__tt)),, uu__iinntt3322__tt ffllaaggss));; + + iinntt + DDbb::::ssyynncc((uu__iinntt3322__tt ffllaaggss));; + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of classes that provides a mod- + ular programming interface to transactions and record-ori- + ented file access. The library includes support for + transactions, locking, logging and file page caching, as + well as various indexed access methods. Many of the + classes (e.g., the file page caching class) are useful + independent of the other DB classes, although some classes + are explicitly based on other classes (e.g., transactions + and logging). For a general description of the DB pack- + age, see _d_b___i_n_t_r_o(3). + + This manual page describes the Db class, which is the cen- + ter of access activity. + + The currently supported file formats are btree, hashed and + recno. The btree format is a representation of a sorted, + balanced tree structure. The hashed format is an extensi- + ble, dynamic hashing scheme. The recno format supports + fixed or variable length records (optionally retrieved + from a flat text file). + + Storage and retrieval for the Db access methods are based + on key/data pairs, using the Dbt class. See _D_b_t(3) for + specific information on the structure and capabilities of + a Dbt. + + The _D_b_:_:_o_p_e_n method opens the database represented by _f_i_l_e + for both reading and writing. Files never intended to be + shared or preserved on disk may be created by setting the + file parameter to NULL. + + The _D_b_:_:_o_p_e_n method copies a pointer to a Db object into + the memory location referenced by _d_b_p_p. The methods of + this object allow you to perform various database actions, + as described below. The _D_b_:_:_o_p_e_n method throws a _D_b_E_x_c_e_p_- + _t_i_o_n(3) or returns the value of _e_r_r_n_o on failure and 0 on + success. + + Note, while most of the access methods use _f_i_l_e as the + name of an underlying file on disk, this is not guaran- + teed. Also, calling _D_b_:_:_o_p_e_n is a reasonably expensive + operation. (This is based on a model where the DBMS keeps + a set of files open for a long time rather than opening + and closing them on each query.) + + The _t_y_p_e argument is of type DBTYPE (as defined in the + include file) and must be set to one of + DB_BTREE, DB_HASH, DB_RECNO or DB_UNKNOWN. If _t_y_p_e is + DB_UNKNOWN, the database must already exist and _D_b_:_:_o_p_e_n + will then determine if it is of type DB_BTREE, DB_HASH or + DB_RECNO. + + The _f_l_a_g_s and _m_o_d_e arguments specify how files will be + opened and/or created when they don't already exist. The + flags value is specified by oorr'ing together one or more of + the following values: + + DB_CREATE + Create any underlying files, as necessary. If the + files do not already exist and the DB_CREATE flag is + not specified, the call will fail. + + + DB_NOMMAP + Do not map this file (see _D_b_M_p_o_o_l(3) for further + information). + + + DB_RDONLY + Open the database for reading only. Any attempt to + write the database using the access methods will fail + regardless of the actual permissions of any underly- + ing files. + + + DB_THREAD + Cause the Db handle returned by the _D_b_:_:_o_p_e_n method + to be useable by multiple threads within a single + address space, i.e., to be ``free-threaded''. + + + DB_TRUNCATE + ``Truncate'' the database if it exists, i.e., behave + as if the database were just created, discarding any + previous contents. + + All files created by the access methods are created with + mode _m_o_d_e (as described in _c_h_m_o_d(2)) and modified by the + process' umask value at the time of creation (see + _u_m_a_s_k(2)). The group ownership of created files is based + on the system and directory defaults, and is not further + specified by DB. + + See _D_b_E_n_v(3) for a description of the _d_b_e_n_v argument, and + _D_b_I_n_f_o(3) for a description of the _d_b_i_n_f_o argument. + +DDbb OOPPEERRAATTIIOONNSS + The Db object returned by _D_b_:_:_o_p_e_n describes a database + type, and includes a set of functions to perform various + actions, as described below. The methods for Db are as + follows: + + + DBTYPE Db::get_type(void); + The type of the underlying access method (and file + format). Returns one of DB_BTREE, DB_HASH or + DB_RECNO. This value may be used to determine the + type of the database after a return from _D_b_:_:_o_p_e_n + with the _t_y_p_e argument set to DB_UNKNOWN. + + + int Db::close(u_int32_t flags); + A method to flush any cached information to disk, + close any open cursors (see _D_b_c(3)), free any allo- + cated resources, and close any underlying files. + Since key/data pairs are cached in memory, failing to + sync the file with the _c_l_o_s_e or _s_y_n_c method may + result in inconsistent or lost information. + + The _f_l_a_g_s parameter must be set to 0 or the following + value: + + + DB_NOSYNC + Do not flush cached information to disk. + + The DB_NOSYNC flag is a dangerous option. It should + only be set 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. + + IItt iiss iimmppoorrttaanntt ttoo uunnddeerrssttaanndd tthhaatt fflluusshhiinngg ccaacchheedd + iinnffoorrmmaattiioonn ttoo ddiisskk oonnllyy mmiinniimmiizzeess tthhee wwiinnddooww ooff + ooppppoorrttuunniittyy ffoorr ccoorrrruupptteedd ddaattaa.. While 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 transac- + tions and logging with automatic recovery, use log- + ging and application-specific recovery, or edit a + copy of the database, and, once all applications + using the database have successfully called _c_l_o_s_e, + replace the original database with the updated copy. + + When multiple threads are using the Db handle concur- + rently, only a single thread may call the Db handle + close method. + + The _c_l_o_s_e method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or returns + the value of _e_r_r_n_o on failure and 0 on success. + + + int Db::cursor(DbTxn *txnid, Dbc **cursorp); + A method to create a cursor and copy a pointer to it + into the memory referenced by _c_u_r_s_o_r_p. + + A cursor is an object used to provide sequential + access through a database. + + + If the file is being accessed under transaction pro- + tection, the _t_x_n_i_d parameter is a transaction ID + returned from _t_x_n___b_e_g_i_n, otherwise, NULL. If trans- + action protection is enabled, cursors must be opened + and closed within the context of a transaction, and + the _t_x_n_i_d parameter specifies the transaction context + in which the cursor may be used. See _D_b_c(3) for more + information. + + The _c_u_r_s_o_r method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or returns + the value of _e_r_r_n_o on failure and 0 on success. + + + int Db::del(DbTxn *txnid, Dbt *key, u_int32_t flags); + A method to remove key/data pairs from the database. + The key/data pair associated with the specified _k_e_y + is discarded from the database. In the presence of + duplicate key values, all records associated with the + designated key will be discarded. + + If the file is being accessed under transaction + protection, the _t_x_n_i_d parameter is a transaction ID + returned from _t_x_n___b_e_g_i_n, otherwise, NULL. + + The _f_l_a_g_s parameter is currently unused, and must be + set to 0. + + The _d_e_l method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or returns the + value of _e_r_r_n_o on failure, 0 on success, and DB_NOT- + FOUND if the specified _k_e_y did not exist in the file. + + + int Db::fd(int *fdp); + A method that copies a file descriptor representative + of the underlying database into the memory referenced + by _f_d_p. A file descriptor referencing the same file + will be returned to all processes that call _D_b_:_:_o_p_e_n + with the same _f_i_l_e argument. This file descriptor + may be safely used as an argument to the _f_c_n_t_l(2) and + _f_l_o_c_k(2) locking functions. The file descriptor is + not necessarily associated with any of the underlying + files used by the access method. + + The _f_d method only supports a coarse-grained form of + locking. Applications should use the lock manager + where possible. + + The _f_d method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or returns the + value of _e_r_r_n_o on failure and 0 on success. + + + int Db::get(DbTxn *txnid, Dbt *key, Dbt *data, u_int32_t + flags); + A method that is an interface for keyed retrieval + from the database. The address and length of the + data associated with the specified _k_e_y are returned + in the object referenced by _d_a_t_a. + + In the presence of duplicate key values, _g_e_t will + return the first data item for the designated key. + Duplicates are sorted by insert order except where + this order has been overridden by cursor operations. + RReettrriieevvaall ooff dduupplliiccaatteess rreeqquuiirreess tthhee uussee ooff ccuurrssoorr + ooppeerraattiioonnss.. See _D_b_c(3) for details. + + If the file is being accessed under transaction pro- + tection, the _t_x_n_i_d parameter is a transaction ID + returned from _t_x_n___b_e_g_i_n, otherwise, NULL. + + The _f_l_a_g_s parameter must be set to 0 or the following + value: + + + DB_GET_RECNO + Retrieve a specific numbered record from a + database. Upon return, both the _k_e_y and _d_a_t_a + items will have been filled in, not just the + data item as is done for all other uses of the + _g_e_t method. + + For DB_GET_RECNO to be specified, the underlying + database must be of type btree, and it must have + been created with the DB_RECNUM flag (see + _D_b_:_:_o_p_e_n(3)). In this case, the _d_a_t_a field of + the _k_e_y must be a pointer to a memory location + of type _d_b___r_e_c_n_o___t, as described in _D_b_t(3). + + If the database is a recno database and the requested + key exists, but was never explicitly created by the + application or was later deleted, the _g_e_t method + returns DB_KEYEMPTY. Otherwise, if the requested key + isn't in the database, the _g_e_t method returns DB_NOT- + FOUND. Otherwise, the _g_e_t method throws a _D_b_E_x_c_e_p_- + _t_i_o_n(3) or returns the value of _e_r_r_n_o on failure and + 0 on success. + + + int Db::put(DbTxn *txnid, Dbt *key, Dbt *data, u_int32_t + flags); + A method to store key/data pairs in the database. If + the database supports duplicates, the _p_u_t method adds + the new data value at the end of the duplicate set. + + If the file is being accessed under transaction pro- + tection, the _t_x_n_i_d parameter is a transaction ID + returned from _t_x_n___b_e_g_i_n, otherwise, NULL. + + The flags value is specified by oorr'ing together one + or more of the following values: + + + DB_APPEND + Append the key/data pair to the end of the + database. For DB_APPEND to be specified, the + underlying database must be of type recno. The + record number allocated to the record is + returned in the specified _k_e_y. + + + DB_NOOVERWRITE + Enter the new key/data pair only if the key does + not already appear in the database. + + The default behavior of the _p_u_t method is to enter + the new key/data pair, replacing any previously + existing key if duplicates are disallowed, or to add + a duplicate entry if duplicates are allowed. Even if + the designated database allows duplicates, a call to + _p_u_t with the DB_NOOVERWRITE flag set will fail if the + key already exists in the database. + + The _p_u_t method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or returns the + value of _e_r_r_n_o on failure, 0 on success, and + DB_KEYEXIST if the DB_NOOVERWRITE _f_l_a_g was set and + the key already exists in the file. + + + int Db::sync(u_int32_t flags); + A method to flush any cached information to disk. If + the database is in memory only, the _s_y_n_c method has + no effect and will always succeed. + + The _f_l_a_g_s parameter is currently unused, and must be + set to 0. + + See the _c_l_o_s_e method description above for a discus- + sion of Db and cached data. + + The _s_y_n_c method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or returns + the value of _e_r_r_n_o on failure and 0 on success. + + + int Db::stat(void *sp, + void *(*db_malloc)(size_t), u_int32_t flags); + A method to create a statistical structure and copy a + pointer to it into user-specified memory locations. + Specifically, if _s_p is non-NULL, a pointer to the + statistics for the database are copied into the mem- + ory location it references. + + Statistical structures are created in allocated mem- + ory. If _d_b___m_a_l_l_o_c is non-NULL, it is called to allo- + cate the memory, otherwise, the library function _m_a_l_- + _l_o_c(3) is used. The function _d_b___m_a_l_l_o_c must match + the calling conventions of the _m_a_l_l_o_c(3) library rou- + tine. Regardless, the caller is responsible for + deallocating the returned memory. To deallocate the + returned memory, free each returned memory pointer; + pointers inside the memory do not need to be individ- + ually freed. + + IInn tthhee pprreesseennccee ooff mmuullttiippllee tthhrreeaaddss oorr pprroocceesssseess + aacccceessssiinngg aann aaccttiivvee ddaattaabbaassee,, tthhee rreettuurrnneedd iinnffoorrmmaa-- + ttiioonn mmaayy bbee oouutt--ooff--ddaattee.. + + TThhiiss mmeetthhoodd mmaayy aacccceessss aallll ooff tthhee ppaaggeess iinn tthhee + ddaattaabbaassee,, aanndd tthheerreeffoorree mmaayy iinnccuurr aa sseevveerree ppeerrffoorr-- + mmaannccee ppeennaallttyy aanndd hhaavvee oobbvviioouuss nneeggaattiivvee eeffffeeccttss oonn + tthhee uunnddeerrllyyiinngg bbuuffffeerr ppooooll.. + + + The _f_l_a_g_s parameter must be set to 0 or the following + value: + DB_RECORDCOUNT + In the case of a btree or recno database, fill + in the _b_t___n_r_e_c_s field, but do not collect any + other information. This flag makes it reason- + able for applications to request a record count + from a database without incurring a performance + penalty. + + The _s_t_a_t method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or returns + the value of _e_r_r_n_o on failure and 0 on success. + + + In the case of a btree or recno database, the statis- + tics are stored in a structure of type DB_BTREE_STAT + (typedef'd in ). The following fields will + be filled in: + + u_int32_t bt_magic; + Magic number that identifies the file as a btree + file. + u_int32_t bt_version; + The version of the btree file type. + u_int32_t bt_flags; + Permanent database flags, including DB_DUP, + DB_FIXEDLEN, DB_RECNUM and DB_RENUMBER. + u_int32_t bt_minkey; + The _b_t___m_i_n_k_e_y value specified to _D_b_:_:_o_p_e_n(3), if + any. + u_int32_t bt_re_len; + The _r_e___l_e_n value specified to _D_b_:_:_o_p_e_n(3), if + any. + u_int32_t bt_re_pad; + The _r_e___p_a_d value specified to _D_b_:_:_o_p_e_n(3), if + any. + u_int32_t bt_pagesize; + Underlying tree page size. + u_int32_t bt_levels; + Number of levels in the tree. + u_int32_t bt_nrecs; + Number of data items in the tree (since there + may be multiple data items per key, this number + may not be the same as the number of keys). + u_int32_t bt_int_pg; + Number of tree internal pages. + u_int32_t bt_leaf_pg; + Number of tree leaf pages. + u_int32_t bt_dup_pg; + Number of tree duplicate pages. + u_int32_t bt_over_pg; + Number of tree overflow pages. + u_int32_t bt_free; + Number of pages on the free list. + u_int32_t bt_freed; + Number of pages made available for reuse because + they were emptied. + u_int32_t bt_int_pgfree; + Number of bytes free in tree internal pages. + u_int32_t bt_leaf_pgfree; + Number of bytes free in tree leaf pages. + u_int32_t bt_dup_pgfree; + Number of bytes free in tree duplicate pages. + u_int32_t bt_over_pgfree; + Number of bytes free in tree overflow pages. + u_int32_t bt_pfxsaved; + Number of bytes saved by prefix compression. + u_int32_t bt_split; + Total number of tree page splits (includes fast + and root splits). + u_int32_t bt_rootsplit; + Number of root page splits. + u_int32_t bt_fastsplit; + Number of fast splits. When sorted keys are + added to the database, the Db btree implementa- + tion will split left or right to increase the + page-fill factor. This number is a measure of + how often it was possible to make such a split. + u_int32_t bt_added; + Number of keys added. + u_int32_t bt_deleted; + Number of keys deleted. + u_int32_t bt_get; + Number of keys retrieved. (Note, this value + will not reflect any keys retrieved when the + database was open for read-only access, as there + is no permanent location to store the informa- + tion in this case.) + u_int32_t bt_cache_hit; + Number of hits in tree fast-insert code. When + sorted keys are added to the database, the Db + btree implementation will check the last page + where an insert occurred before doing a full + lookup. This number is a measure of how often + the lookup was successful. + u_int32_t bt_cache_miss; + Number of misses in tree fast-insert code. See + the description of bt_cache_hit; this number is + a measure of how often the lookup failed. + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _D_b_:_:_o_p_e_n: + + DB_HOME + If the _d_b_e_n_v argument to _D_b_:_:_o_p_e_n was initialized + using _d_b___a_p_p_i_n_i_t, the environment variable DB_HOME + may be used as the path of the database home for the + interpretation of the _d_i_r argument to _D_b_:_:_o_p_e_n, as + described in _d_b___a_p_p_i_n_i_t(3). Specifically, _D_b_:_:_o_p_e_n + is affected by the configuration string value of + DB_DATA_DIR. + +EEXXAAMMPPLLEESS + Applications that create short-lived databases that are + discarded or recreated when the system fails and are + unconcerned with concurrent access and loss of data due to + catastrophic failure, may wish to use the _D_b_:_:_o_p_e_n func- + tionality without other parts of the Db library. Such + applications will only be concerned with the Db access + methods. The Db access methods will use the memory pool + subsystem, but the application is unlikely to be aware of + this. See the file _e_x_a_m_p_l_e_s___c_x_x_/_A_c_c_e_s_s_E_x_a_m_p_l_e_._c_p_p in the + Db source distribution for a C++ language code example of + how such an application might use the Db library. + +EERRRROORRSS + Methods marked as returning _e_r_r_n_o will, by default, throw + an exception that encapsulates the error information. The + default error behavior can be changed, see _D_b_E_x_c_e_p_t_i_o_n(3). + + The _D_b_:_:_o_p_e_n method may fail and throw a _D_b_E_x_c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: Db::sync(3), + DbLock::get(3), DbLock::put(3), DbLockTab::id(3), DbLock- + Tab::vec(3), DbLog::db_register(3), DbLog::put(3), DbM- + pool::close(3), DbMpool::db_register(3), DbMpool::open(3), + DbMpoolFile::close(3), DbMpoolFile::get(3), DbM- + poolFile::open(3), DbMpoolFile::put(3), DbM- + poolFile::set(3), DbMpoolFile::sync(3), calloc(3), + close(2), fcntl(2), fflush(3), malloc(3), memcpy(3), mem- + move(3), memset(3), mmap(2), munmap(2), open(2), read(2), + realloc(3), sigfillset(3), sigprocmask(2), stat(2), str- + cpy(3), strdup(3), strerror(3), strlen(3), time(3), and + unlink(2). + + In addition, the _D_b_:_:_o_p_e_n method may fail and throw a + _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [EAGAIN] + A lock was unavailable. + + [EINVAL] + An invalid flag value or parameter was specified + (e.g., unknown database type, page size, hash method, + recno pad byte, byte order) or a flag value or param- + eter that is incompatible with the current _f_i_l_e spec- + ification. + + The DB_THREAD flag was specified and spinlocks are + not implemented for this architecture. + + + There is a mismatch between the version number of + _f_i_l_e and the software. + + A _r_e___s_o_u_r_c_e file was specified with either the + DB_THREAD flag or a non-NULL _t_x___i_n_f_o field in the + DbEnv argument to _D_b_:_:_o_p_e_n. + + [ENOENT] + A non-existent _r_e___s_o_u_r_c_e file was specified. + + [EPERM] + Database corruption was detected. All subsequent + database calls (other than _D_b_:_:_c_l_o_s_e) will return + EPERM. + + The _D_b_:_:_c_l_o_s_e method may fail and throw a _D_b_E_x_c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: Db::sync(3), + DbLock::get(3), DbLock::put(3), DbLockTab::vec(3), + DbLog::db_register(3), DbLog::put(3), DbMpool::close(3), + DbMpoolFile::close(3), DbMpoolFile::get(3), DbM- + poolFile::put(3), DbMpoolFile::set(3), DbM- + poolFile::sync(3), calloc(3), close(2), fflush(3), mal- + loc(3), memcpy(3), memmove(3), memset(3), munmap(2), real- + loc(3), and strerror(3). + + The _D_b_:_:_c_u_r_s_o_r method may fail and throw a _D_b_E_x_c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: calloc(3). + + In addition, the _D_b_:_:_c_u_r_s_o_r method may fail and throw a + _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [EINVAL] + An invalid flag value or parameter was specified. + + [EPERM] + Database corruption was detected. All subsequent + database calls (other than _D_b_:_:_c_l_o_s_e) will return + EPERM. + + The _D_b_:_:_d_e_l method may fail and throw a _D_b_E_x_c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DbLock::get(3), + DbLock::put(3), DbLockTab::id(3), DbLockTab::vec(3), + DbLog::put(3), DbMpoolFile::get(3), DbMpoolFile::put(3), + DbMpoolFile::set(3), calloc(3), fcntl(2), fflush(3), mal- + loc(3), memcmp(3), memcpy(3), memmove(3), memset(3), real- + loc(3), and strerror(3). + + + In addition, the _D_b_:_:_d_e_l method may fail and throw a _D_b_E_x_- + _c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following conditions: + + [EAGAIN] + A lock was unavailable. + + [EINVAL] + An invalid flag value or parameter was specified. + + [EPERM] + Database corruption was detected. All subsequent + database calls (other than _D_b_:_:_c_l_o_s_e) will return + EPERM. + + In addition, the _D_b_:_:_f_d method may fail and throw a _D_b_E_x_- + _c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following conditions: + + [ENOENT] + The _D_b_:_:_f_d method was called for an in-memory + database, or no underlying file has yet been created. + + [EPERM] + Database corruption was detected. All subsequent + database calls (other than _D_b_:_:_c_l_o_s_e) will return + EPERM. + + The _D_b_:_:_g_e_t method may fail and throw a _D_b_E_x_c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DbLock::get(3), + DbLock::put(3), DbLockTab::id(3), DbLockTab::vec(3), + DbLog::put(3), DbMpoolFile::get(3), DbMpoolFile::put(3), + DbMpoolFile::set(3), Dbc::get(3), calloc(3), fcntl(2), + fflush(3), malloc(3), memcmp(3), memcpy(3), memmove(3), + memset(3), realloc(3), and strerror(3). + + In addition, the _D_b_:_:_g_e_t method may fail and throw a _D_b_E_x_- + _c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following conditions: + + [EAGAIN] + A lock was unavailable. + + [EINVAL] + An invalid flag value or parameter was specified. + + The DB_THREAD flag was specified to the _D_b_:_:_o_p_e_n(3) + method and neither the DB_DBT_MALLOC or DB_DBT_USER- + MEM flags were set in the Dbt. + + A record number of 0 was specified. + + [EPERM] + Database corruption was detected. All subsequent + database calls (other than _D_b_:_:_c_l_o_s_e) will return + EPERM. + + The _D_b_:_:_p_u_t method may fail and throw a _D_b_E_x_c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DbLock::get(3), + DbLock::put(3), DbLockTab::id(3), DbLockTab::vec(3), + DbLog::put(3), DbMpoolFile::get(3), DbMpoolFile::put(3), + DbMpoolFile::set(3), calloc(3), fcntl(2), fflush(3), mal- + loc(3), memcmp(3), memcpy(3), memmove(3), memset(3), real- + loc(3), and strerror(3). + + In addition, the _D_b_:_:_p_u_t method may fail and throw a _D_b_E_x_- + _c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following conditions: + + [EACCES] + An attempt was made to modify a read-only database. + + [EAGAIN] + A lock was unavailable. + + [EINVAL] + An invalid flag value or parameter was specified. + + A record number of 0 was specified. + + An attempt was made to add a record to a fixed-length + database that was too large to fit. + + An attempt was made to do a partial put. + + [EPERM] + Database corruption was detected. All subsequent + database calls (other than _D_b_:_:_c_l_o_s_e) will return + EPERM. + + [ENOSPC] + A btree exceeded the maximum btree depth (255). + + The _D_b_:_:_s_t_a_t method may fail and throw a _D_b_E_x_c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DbLock::get(3), + DbLock::put(3), DbLockTab::id(3), DbLockTab::vec(3), DbM- + poolFile::get(3), DbMpoolFile::put(3), calloc(3), + fcntl(2), fflush(3), malloc(3), memcpy(3), and memset(3). + + The _D_b_:_:_s_y_n_c method may fail and throw a _D_b_E_x_c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: Db::get(3), + Db::sync(3), DbLock::get(3), DbLock::put(3), DbLock- + Tab::id(3), DbLockTab::vec(3), DbLog::put(3), DbM- + poolFile::get(3), DbMpoolFile::put(3), + + DbMpoolFile::set(3), DbMpoolFile::sync(3), calloc(3), + close(2), fcntl(2), fflush(3), malloc(3), memcpy(3), mem- + move(3), memset(3), munmap(2), open(2), realloc(3), str- + error(3), unlink(2), and write(2). + + In addition, the _D_b_:_:_s_y_n_c method may fail and throw a + _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [EINVAL] + An invalid flag value or parameter was specified. + + [EPERM] + Database corruption was detected. All subsequent + database calls (other than _D_b_:_:_c_l_o_s_e) will return + EPERM. + +SSEEEE AALLSSOO + _T_h_e _U_b_i_q_u_i_t_o_u_s _B_-_t_r_e_e, Douglas Comer, ACM Comput. Surv. + 11, 2 (June 1979), 121-138. + + _P_r_e_f_i_x _B_-_t_r_e_e_s, Bayer and Unterauer, ACM Transactions on + Database Systems, Vol. 2, 1 (March 1977), 11-26. + + _T_h_e _A_r_t _o_f _C_o_m_p_u_t_e_r _P_r_o_g_r_a_m_m_i_n_g _V_o_l_. _3_: _S_o_r_t_i_n_g _a_n_d + _S_e_a_r_c_h_i_n_g, D.E. Knuth, 1968, pp 471-480. + + _D_y_n_a_m_i_c _H_a_s_h _T_a_b_l_e_s, Per-Ake Larson, Communications of the + ACM, April 1988. + + _A _N_e_w _H_a_s_h _P_a_c_k_a_g_e _f_o_r _U_N_I_X, Margo Seltzer, USENIX Pro- + ceedings, Winter 1991. + + _D_o_c_u_m_e_n_t _P_r_o_c_e_s_s_i_n_g _i_n _a _R_e_l_a_t_i_o_n_a_l _D_a_t_a_b_a_s_e _S_y_s_t_e_m, + Michael Stonebraker, Heidi Stettner, Joseph Kalash, + Antonin Guttman, Nadene Lynn, Memorandum No. UCB/ERL + M82/32, May 1982. + + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___i_n_t_e_r_n_a_l(3), _d_b___t_h_r_e_a_d(3), _D_b(3), _D_b_c(3), _D_b_E_n_v(3), + _D_b_E_x_c_e_p_t_i_o_n(3), _D_b_I_n_f_o(3), _D_b_L_o_c_k(3), _D_b_L_o_c_k_T_a_b(3), _D_b_L_o_g(3), + _D_b_L_s_n(3), _D_b_M_p_o_o_l(3), _D_b_M_p_o_o_l_F_i_l_e(3), _D_b_t(3), _D_b_T_x_n(3), + _D_b_T_x_n_M_g_r(3) diff --git a/mozilla/db/man/mancxx.text/DbEnv.0 b/mozilla/db/man/mancxx.text/DbEnv.0 new file mode 100644 index 00000000000..fbfd4fd0a30 --- /dev/null +++ b/mozilla/db/man/mancxx.text/DbEnv.0 @@ -0,0 +1,684 @@ + + +NNAAMMEE + DbEnv - Db initialization and environment options + +SSYYNNOOPPSSIISS + ##iinncclluuddee <> + + DDbbEEnnvv::::DDbbEEnnvv((ccoonnsstt cchhaarr **ddbb__hhoommee,, cchhaarr **ccoonnsstt **ddbb__ccoonnffiigg,, uu__iinntt3322__tt ffllaaggss));; + DDbbEEnnvv::::DDbbEEnnvv(());; + DDbbEEnnvv::::~~DDbbEEnnvv(());; + + iinntt DDbbEEnnvv::::aappppiinniitt((ccoonnsstt cchhaarr **ddbb__hhoommee,, + cchhaarr **ccoonnsstt **ddbb__ccoonnffiigg,, uu__iinntt3322__tt ffllaaggss));; + + iinntt DDbbEEnnvv::::ggeett__lloorrddeerr(()) ccoonnsstt;; + vvooiidd DDbbEEnnvv::::sseett__lloorrddeerr((iinntt));; + + ttyyppeeddeeff vvooiidd ((**ddbb__eerrrrccaallll__ffccnn))((ccoonnsstt cchhaarr **,, cchhaarr **));; + ddbb__eerrrrccaallll__ffccnn DDbbEEnnvv::::ggeett__eerrrrccaallll(()) ccoonnsstt;; + vvooiidd DDbbEEnnvv::::sseett__eerrrrccaallll((ddbb__eerrrrccaallll__ffccnn));; + + FFIILLEE DDbbEEnnvv::::**ggeett__eerrrrffiillee(()) ccoonnsstt;; + vvooiidd DDbbEEnnvv::::sseett__eerrrrffiillee((FFIILLEE **));; + + ccoonnsstt cchhaarr DDbbEEnnvv::::**ggeett__eerrrrppffxx(()) ccoonnsstt;; + vvooiidd DDbbEEnnvv::::sseett__eerrrrppffxx((ccoonnsstt cchhaarr **));; + + iinntt DDbbEEnnvv::::ggeett__vveerrbboossee(()) ccoonnsstt;; + vvooiidd DDbbEEnnvv::::sseett__vveerrbboossee((iinntt));; + + cchhaarr DDbbEEnnvv::::**ggeett__hhoommee(()) ccoonnsstt;; + vvooiidd DDbbEEnnvv::::sseett__hhoommee((cchhaarr **));; + + cchhaarr DDbbEEnnvv::::**ggeett__lloogg__ddiirr(()) ccoonnsstt;; + vvooiidd DDbbEEnnvv::::sseett__lloogg__ddiirr((cchhaarr **));; + + cchhaarr DDbbEEnnvv::::**ggeett__ttmmpp__ddiirr(()) ccoonnsstt;; + vvooiidd DDbbEEnnvv::::sseett__ttmmpp__ddiirr((cchhaarr **));; + + cchhaarr DDbbEEnnvv::::****ggeett__ddaattaa__ddiirr(()) ccoonnsstt;; + vvooiidd DDbbEEnnvv::::sseett__ddaattaa__ddiirr((cchhaarr ****));; + + DDbbLLoocckkTTaabb DDbbEEnnvv::::**ggeett__llkk__iinnffoo(()) ccoonnsstt;; + + uu__iinntt88__tt DDbbEEnnvv::::**ggeett__llkk__ccoonnfflliiccttss(()) ccoonnsstt;; + vvooiidd DDbbEEnnvv::::sseett__llkk__ccoonnfflliiccttss((uu__iinntt88__tt **));; + + uu__iinntt3322__tt DDbbEEnnvv::::ggeett__llkk__mmooddeess(()) ccoonnsstt;; + vvooiidd DDbbEEnnvv::::sseett__llkk__mmooddeess((uu__iinntt3322__tt));; + + uu__iinntt3322__tt DDbbEEnnvv::::ggeett__llkk__mmaaxx(()) ccoonnsstt;; + vvooiidd DDbbEEnnvv::::sseett__llkk__mmaaxx((uu__iinntt3322__tt));; + + uu__iinntt3322__tt DDbbEEnnvv::::ggeett__llkk__ddeetteecctt(()) ccoonnsstt;; + vvooiidd DDbbEEnnvv::::sseett__llkk__ddeetteecctt((uu__iinntt3322__tt));; + + DDbbLLoogg DDbbEEnnvv::::**ggeett__llgg__iinnffoo(()) ccoonnsstt;; + + uu__iinntt3322__tt DDbbEEnnvv::::ggeett__llgg__mmaaxx(()) ccoonnsstt;; + vvooiidd DDbbEEnnvv::::sseett__llgg__mmaaxx((uu__iinntt3322__tt));; + + DDbbMMppooooll DDbbEEnnvv::::**ggeett__mmpp__iinnffoo(()) ccoonnsstt;; + + ssiizzee__tt DDbbEEnnvv::::ggeett__mmpp__mmmmaappssiizzee(()) ccoonnsstt;; + vvooiidd DDbbEEnnvv::::sseett__mmpp__mmmmaappssiizzee((ssiizzee__tt));; + + ssiizzee__tt DDbbEEnnvv::::ggeett__mmpp__ssiizzee(()) ccoonnsstt;; + vvooiidd DDbbEEnnvv::::sseett__mmpp__ssiizzee((ssiizzee__tt));; + + DDbbTTxxnnMMggrr DDbbEEnnvv::::**ggeett__ttxx__iinnffoo(()) ccoonnsstt;; + + uu__iinntt3322__tt DDbbEEnnvv::::ggeett__ttxx__mmaaxx(()) ccoonnsstt;; + vvooiidd DDbbEEnnvv::::sseett__ttxx__mmaaxx((uu__iinntt3322__tt));; + + ttyyppeeddeeff iinntt ((**ttxx__rreeccoovveerr__ffccnn))((DDBB__LLOOGG **,, DDBBTT **,, DDBB__LLSSNN **,, iinntt,, vvooiidd **));; + ttxx__rreeccoovveerr__ffccnn DDbbEEnnvv::::ggeett__ttxx__rreeccoovveerr(()) ccoonnsstt;; + vvooiidd DDbbEEnnvv::::sseett__ttxx__rreeccoovveerr((ttxx__rreeccoovveerr__ffccnn));; + + uu__iinntt3322__tt DDbbEEnnvv::::ggeett__ffllaaggss(()) ccoonnsstt;; + vvooiidd DDbbEEnnvv::::sseett__ffllaaggss((uu__iinntt3322__tt));; + + eennuumm EErrrroorrMMooddeell {{ EExxcceeppttiioonn,, EErrrroorrRReettuurrnn }};; + vvooiidd DDbbEEnnvv::::sseett__eerrrroorr__mmooddeell((EErrrroorrMMooddeell));; + EErrrroorrMMooddeell DDbbEEnnvv::::ggeett__eerrrroorr__mmooddeell(()) ccoonnsstt;; + + ccllaassss oossttrreeaamm** DDbbEEnnvv::::ggeett__eerrrroorr__ssttrreeaamm(()) ccoonnsstt;; + vvooiidd DDbbEEnnvv::::sseett__eerrrroorr__ssttrreeaamm((ccllaassss oossttrreeaamm**));; + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of classes that provides a mod- + ular programming interface to transactions and record-ori- + ented file access. The library includes support for + transactions, locking, logging and file page caching, as + well as various indexed access methods. Many of the + classes (e.g., the file page caching class) are useful + independent of the other DB classes, although some classes + are explicitly based on other classes (e.g., transactions + and logging). For a general description of the DB pack- + age, see _d_b___i_n_t_r_o(3). + + The DbEnv class provides simple access to an underlying + data structure, whose elements can be examined or changed + using the _s_e_t__ or _g_e_t__ methods. The remainder of the man- + ual page sometimes refers to these accesses using the + underlying name, e.g., simply _l_o_r_d_e_r instead of _g_e_t___l_o_r_d_e_r + and _s_e_t___l_o_r_d_e_r. The constructors set all elements of the + underlying structure to zero. The constructor with three + arguments has the effect of calling _D_b_E_n_v_:_:_a_p_p_i_n_i_t immedi- + ately to initialize the application with default parame- + ters. To delay the initialization, use the default con- + structor. The various set_ methods can then be used to + initialize the DbEnv, and finally, a call to + _D_b_E_n_v_:_:_a_p_p_i_n_i_t should be made to initialize DB. + + Once the DB environment has been initialized by a call to + _D_b_E_n_v_:_:_a_p_p_i_n_i_t, no set methods other than _s_e_t___e_r_r_p_f_x + should be called. + + _a_p_p_i_n_i_t + The _a_p_p_i_n_i_t method provides a simple way to initialize and + configure the Db environment. It is not necessary that it + be called, but it provides a method of creating a consis- + tent environment for processes using one or more of the + features of Db. + + The _d_b___h_o_m_e and _d_b___c_o_n_f_i_g arguments to _a_p_p_i_n_i_t are + described in the section below entitled ``FILE NAMING''. + + The _f_l_a_g_s argument specifies the subsystems that are ini- + tialized and how the environment affects Db file naming, + among other things. The _f_l_a_g_s value is specified by + oorr'ing together one or more of the following values: + + + DB_CREATE + Cause subsystems to create any underlying files, as + necessary. (See _D_b(3), _D_b_L_o_c_k_T_a_b(3), _D_b_L_o_g(3), _D_b_M_- + _p_o_o_l(3) and _D_b_T_x_n_M_g_r(3) for more information.) + + + DB_INIT_LOCK + Initialize the lock subsystem; see _D_b_L_o_c_k_T_a_b(3). + This subsystem should be used when multiple processes + or threads are going to be reading and writing a Db + database, so that they do not interfere with each + other. If all threads are accessing the database(s) + read-only, then locking is unnecessary. When the + DB_INIT_LOCK flag is specified, it is usually neces- + sary to run the deadlock detector, _d_b___d_e_a_d_l_o_c_k(1), as + well. + + + DB_INIT_LOG + Initialize the log subsystem; see _D_b_L_o_g(3). This + subsystem is used when recovery from application or + system failure is important. + + + DB_INIT_MPOOL + Initialize the mpool subsystem; see _D_b_M_p_o_o_l(3). This + subsystem is used whenever the application is using + the Db access methods for any purpose. + + + DB_INIT_TXN + Initialize the transaction subsystem; see _D_b_T_x_n(3). + This subsystem is used when atomicity of multiple + operations and recovery are important. The + DB_INIT_TXN flag implies the DB_INIT_LOG flag. + + + DB_MPOOL_PRIVATE + Create a private memory pool (see _D_b_M_p_o_o_l(3) for fur- + ther information). Ignored unless DB_INIT_MPOOL is + also specified. + + + DB_NOMMAP + Do not map any files within this environment (see + _D_b_M_p_o_o_l(3) for further information). Ignored unless + DB_INIT_MPOOL is also specified. + + + DB_RECOVER + Run normal recovery on this environment before open- + ing it for normal use. If this flag is set, the + DB_CREATE flag must also be set since the regions + will be removed and recreated. + + The _D_b_E_n_v_:_:_a_p_p_i_n_i_t function returns successfully if + DB_RECOVER is specified and no log files exist, so it + is necessary to ensure all necessary log files are + present before running recovery. For further infor- + mation, consult the man page for _d_b___a_r_c_h_i_v_e(1) and + _d_b___r_e_c_o_v_e_r(1). + + + DB_RECOVER_FATAL + Run catastrophic recovery on this environment before + opening it for normal use. If this flag is set, the + DB_CREATE flag must also be set since the regions + will be removed and recreated. + + The _D_b_E_n_v_:_:_a_p_p_i_n_i_t function returns successfully if + DB_RECOVER is specified and no log files exist, so it + is necessary to ensure all necessary log files are + present before running recovery. For further infor- + mation, consult the man page for _d_b___a_r_c_h_i_v_e(1) and + _d_b___r_e_c_o_v_e_r(1). + + + DB_THREAD + Ensure that handles returned by the Db subsystems are + useable by multiple threads within a single process, + i.e., that the system is ``free-threaded''. (See + _D_b_L_o_c_k_T_a_b(3), _D_b_L_o_g(3), _D_b_M_p_o_o_l(3), _D_b_:_:_o_p_e_n(3) and + _D_b_T_x_n(3) for more information.) + + + DB_TXN_NOSYNC + On transaction commit, do not synchronously flush the + log (see _D_b_T_x_n(3) for further information). Ignored + unless DB_INIT_TXN is also specified. + + + DB_USE_ENVIRON + The Db process' environment may be permitted to spec- + ify information to be used when naming files (see the + section entitled ``FILE NAMING'' below). As permit- + ting users to specify which files are used can create + security problems, environment information will be + used in file naming for all users only if the + DB_USE_ENVIRON flag is set. + + + DB_USE_ENVIRON_ROOT + The Db process' environment may be permitted to spec- + ify information to be used when naming files (see the + section entitled ``FILE NAMING'' below). As permit- + ting users to specify which files are used can create + security problems, if the DB_USE_ENVIRON_ROOT flag is + set, environment information will be used for file + naming only for users with a user-ID matching that of + the superuser (specifically, users for whom the + _g_e_t_u_i_d system call returns the user-ID 0). + + The Db environment is configured based on which set meth- + ods have been used. It is expected that applications will + use a single DbEnv object as the argument to all of the + subsystems in the DB package. The fields of the DbEnv + object used by _a_p_p_i_n_i_t are described below. As references + to the DbEnv object may be maintained by _a_p_p_i_n_i_t, it is + necessary that the DbEnv object and memory it references + be valid until the object is destroyed. The _d_b_e_n_v argu- + ment may not be NULL. If any of the fields of the _d_b_e_n_v + are set to 0, defaults appropriate for the system are used + where possible. + + The following fields in the DbEnv object may be initial- + ized, using the appropriate set method, before calling + _a_p_p_i_n_i_t: + + void (*db_errcall)(char *db_errpfx, char *buffer); + When an error occurs in the DB package, an _e_r_r_n_o + value is returned by the method. In some cases, how- + ever, the _e_r_r_n_o value may be insufficient to com- + pletely describe the cause of the error. + + If _d_b___e_r_r_c_a_l_l is non-NULL, it may be called with + additional error information. The _d_b___e_r_r_p_f_x argument + is the current environment's _d_b___e_r_r_p_f_x field. The + _b_u_f_f_e_r argument contains a nul-terminated string with + the additional information. + + This error logging facility should not be required + for normal operation, but may be useful in debugging + applications. + + FILE *db_errfile; + The _d_b___e_r_r_f_i_l_e field behaves similarly to the + _d_b___e_r_r_c_a_l_l field, except that the error message is + written to the file stream represented by _d_b___e_r_r_f_i_l_e. + + If _d_b___e_r_r_p_f_x is non-NULL, the message will be pre- + ceded by the string referenced by _d_b___e_r_r_p_f_x, a colon + (``:'') and a space. The message will be followed by + a newline character. + + const char *db_errpfx; + A prefix to prepend to error messages. Because Db + does not copy the memory referenced by the _d_b___e_r_r_p_f_x + field, the application may modify the error message + prefix at any time. + + ostream* error_stream; + The error_stream functions like the error file, + allowing errors to be redirected to a C++ error + stream. It is unwise to use both error_stream with + nonzero values of either errcall or errfile. + + int db_verbose; + Include informational and debugging messages as well + as error messages in the _d_b___e_r_r_c_a_l_l and _d_b___e_r_r_f_i_l_e + output. + + Each of the open functions that _a_p_p_i_n_i_t may call (_D_b_L_o_c_k_- + _T_a_b_:_:_o_p_e_n, _D_b_L_o_g_:_:_o_p_e_n, _D_b_M_p_o_o_l_:_:_o_p_e_n and _D_b_T_x_n_M_g_r_:_:_o_p_e_n) + is called as follows, where the DB_CREATE flag is + optional: + + XXX::open(NULL, DB_CREATE, + S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, dbenv) + + This call will cause each subsystem to construct pathnames + as described in the section on ``FILE NAMING''. The sub- + system has permission to read and write underlying files + as necessary, and optionally to create files. (All cre- + ated files will be created readable and writeable by the + owner and the group. The group ownership of created files + is based on the system and directory defaults, and is not + further specified by Db.) + + In addition, the _d_b_e_n_v argument is passed to the open + functions of any subsystems initialized by _a_p_p_i_n_i_t. For + this reason the fields of the DbEnv object relevant to the + subsystems being initialized must themselves be initial- + ized before _a_p_p_i_n_i_t is called. See the manual page for + each subsystem for a list of these fields and their uses. + + The return value from each of these calls is placed in the + appropriate field of the DbEnv object: + + DbLockTab *lk_info; + The return value of the _D_b_L_o_c_k_T_a_b_:_:_o_p_e_n(3) call. + + DbLog *lg_info; + The return value of the _D_b_L_o_g_:_:_o_p_e_n(3) call. + + DbMpool *mp_info; + The return value of the _D_b_M_p_o_o_l_:_:_o_p_e_n(3) call. + + DbTxnMgr *tx_info; + The return value of the _D_b_T_x_n_M_g_r_:_:_o_p_e_n(3) call. + + In general, these fields are not directly used by applica- + tions; subsystems of Db that use these fields will simply + reference them using the DbEnv argument passed to the sub- + system. + + For example, an application using the Db hash access + method functions to access a database will first call + _D_b_:_:_o_p_e_n passing it the DbEnv argument filled in by the + initial call to _a_p_p_i_n_i_t. Then, all future calls to the + hash access method functions for that database will auto- + matically use the underlying shared memory buffer pool + that was specified by the _m_p___i_n_f_o field of that DbEnv + argument. + + The single exception to this rule is the _t_x___i_n_f_o field, + which applications must explicitly specify to the _D_b_T_x_n_- + _M_g_r_:_:_b_e_g_i_n, _D_b_T_x_n_M_g_r_:_:_c_h_e_c_k_p_o_i_n_t and _D_b_T_x_n_M_g_r_:_:_c_l_o_s_e func- + tions. + + The _e_r_r_o_r___m_o_d_e_l field of DbEnv allows the user to config- + ure the way errors are treated in DB. It can be changed + at any time (e.g., after the call to _D_b_E_n_v_:_:_a_p_p_i_n_i_t). The + error model is described in _D_b_E_x_c_e_p_t_i_o_n(3). + +FFIILLEE NNAAMMIINNGG + The most important task of _a_p_p_i_n_i_t is to structure file + naming within Db. + + Each of the locking, logging, memory pool and transaction + subsystems of Db require shared memory regions, backed by + the filesystem. Further, cooperating applications (or + multiple invocations of the same application) must agree + on the location of the shared memory regions and other + files used by the Db subsystems, the log files used by the + logging subsystem, and, of course, the data files. + + Although it is possible to specify full pathnames to all + Db functions, this is cumbersome and requires that appli- + cations be recompiled when database files are moved. The + _a_p_p_i_n_i_t method makes it possible to place database files + in a single directory, or in multiple directories, grouped + by their method within the database. + + Applications are normally expected to specify a single + directory home for their database. This can be done eas- + ily in the call to _a_p_p_i_n_i_t by specifying a value for the + _d_b___h_o_m_e argument. There are more complex configurations + where it may be desirable to override _d_b___h_o_m_e or provide + supplementary path information. + + The following describes the possible ways in which file + naming information may be specified to the Db library. + The specific circumstances and order in which these ways + are applied are described in a subsequent paragraph. + + _d_b___h_o_m_e + If the _d_b___h_o_m_e argument to _a_p_p_i_n_i_t is non-NULL, its + value may be used as the database home, and files + named relative to its path. + + DB_HOME + If the DB_HOME environment variable is set when + _a_p_p_i_n_i_t is called, its value may be used as the + database home, and files named relative to its path. + + _d_b___c_o_n_f_i_g + The _d_b___c_o_n_f_i_g argument to _a_p_p_i_n_i_t may be used to + specify an array of character strings of the format + ``NAME VALUE'', that specify file name information + for the process' Db environment. The whitespace + delimiting the two parts of the entry may be one or + more or characters. (Leading or trail- + ing and characters are discarded.) + Each entry must specify both the NAME and the VALUE + of the pair. All entries with unrecognized NAME val- + ues will be ignored. The _d_b___c_o_n_f_i_g array must be + NULL terminated. + + DB_CONFIG + The same information specified to the _d_b___c_o_n_f_i_g argu- + ment to _a_p_p_i_n_i_t may be specified using a configura- + tion file. If a database home directory has been + specified (either by the application specifying a + non-NULL _d_b___h_o_m_e argument to _a_p_p_i_n_i_t, or by the + application setting the DB_USE_ENVIRON or DB_USE_ENV- + IRON_ROOT flags and the DB_HOME environment variable + being set), any file named ``DB_CONFIG'' in the + database home directory will be read for lines of the + format ``NAME VALUE''. The whitespace delimiting the + two parts of the line may be one or more or + characters. (Leading or trailing and + characters are discarded.) All empty lines or + lines whose first non-whitespace character is a hash + character (``#'') will be ignored. Each line must + specify both the NAME and the VALUE of the pair. All + lines with unrecognized NAME values will be ignored. + + The following ``NAME VALUE'' pairs in the _d_b___c_o_n_f_i_g argu- + ment and the DB_CONFIG file are currently supported by Db. + + DB_DATA_DIR + The path of a directory to be used as the location of + the access method data files, e.g., paths specified + to the _D_b_:_:_o_p_e_n(3) method will be relative to this + path. + + The DB_DATA_DIR paths are additive, and specifying + more than one will result in each specified directory + being searched for database data files. If multiple + paths are specified, created data files will always + be created in the ffiirrsstt directory specified. + + DB_LOG_DIR + The path of a directory to be used as the location of + logging files, e.g., files created by the _D_b_L_o_g(3) + subsystem will be relative to this directory. If + specified, this is the directory name that will be + passed to _D_b_L_o_g_:_:_o_p_e_n(3). + + DB_TMP_DIR + The path of a directory to be used as the location of + temporary files, e.g., files created to back in-mem- + ory access method databases will be created relative + to this path. Note, these temporary files can poten- + tially be quite large, depending on the size of the + database. + + If DB_TMP_DIR is not specified, the following envi- + ronment variables are checked in order: ``TMPDIR'', + ``TEMP'', ``TMP'' and ``TempFolder''. If one of them + is set, temporary files are created relative to the + directory it specifies. + + If DB_TMP_DIR is not specified and none of the above + environment variables are set, the first possible one + of the following directories is used: _/_v_a_r_/_t_m_p, + _/_u_s_r_/_t_m_p, _/_t_e_m_p, _/_t_m_p, _C_:_/_t_e_m_p and _C_:_/_t_m_p. + + The following describes the specific circumstances and + order in which the different ways of specifying file nam- + ing information are applied. Specifically, Db file name + processing proceeds sequentially through the following + steps: + + ``/'' + If any file name specified to any Db method begins + with a leading slash, that file name is used without + modification by Db. + DB_CONFIG + If a relevant configuration string (e.g., + DB_DATA_DIR), is specified in the DB_CONFIG configu- + ration file, the VALUE from the ``NAME VALUE'' pair + is prepended to the current file name. If the + resulting file name begins with a leading slash, the + file name is used without further modification by Db. + + The DB_CONFIG configuration file is intended to per- + mit systems to customize file location for a database + independent of applications using that database. For + example, a database administrator can move the + database log and data files to a different location + without application recompilation. + + _d_b___c_o_n_f_i_g + If a relevant configuration string (e.g., + DB_DATA_DIR), is specified in the _d_b___c_o_n_f_i_g argument + and is not specified in the DB_CONFIG file, the VALUE + from the ``NAME VALUE'' pair is prepended to the cur- + rent file name. If the resulting file name begins + with a leading slash, the file name is used without + further modification by Db. + + The _d_b___c_o_n_f_i_g argument is intended to permit applica- + tions to customize file location for a database. For + example, an application writer can place data files + and log files in different directories, or instanti- + ate a new log directory each time the application + runs. + + DB_HOME + If the DB_HOME environment variable was set, (and the + application has set the appropriate DB_USE_ENVIRON or + DB_USE_ENVIRON_ROOT environment variable), its value + is prepended to the current file name. If the + resulting file name begins with a leading slash, the + file name is used without further modification by Db. + + The DB_HOME environment variable is intended to per- + mit users and system administrators to override + application and installation defaults, e.g., + + env DB_HOME=/database/my_home application + + Alternatively, application writers are encouraged to + support the --hh option found in the supporting Db + utilities to let users specify a database home. + + _d_b___h_o_m_e + If the application specified a non-NULL _d_b___h_o_m_e argu- + ment to _a_p_p_i_n_i_t (and the database home was not + already specified using the DB_HOME environment vari- + able) its value is prepended to the current file + name. If the resulting file name begins with a lead- + ing slash, the file name is used without further mod- + ification by Db. + + (nothing) + Finally, all file names are interpreted relative to + the current working directory of the process. + + The common model for a Db environment is one where only + the DB_HOME environment variable, or the _d_b___h_o_m_e argument, + is specified. In this case, all data files will be pre- + sumed to be relative to that directory, and all files cre- + ated by the Db subsystems will be created in that direc- + tory. + + The more complex model for a transaction environment might + be one where a database home is specified, using either + the DB_HOME environment variable or the _d_b___h_o_m_e argument + to _a_p_p_i_n_i_t, and then DB_DATA_DIR and DB_LOG_DIR are set to + the relative path names of directories underneath the home + directory using the _d_b___c_o_n_f_i_g argument to _a_p_p_i_n_i_t or the + DB_CONFIG file. + +EEXXAAMMPPLLEESS + Store all files in the directory _/_a_/_d_a_t_a_b_a_s_e: + + DbEnv::appinit("/a/database", NULL, ...); + + Create temporary backing files in _/_b_/_t_e_m_p_o_r_a_r_y, and all + other files in _/_a_/_d_a_t_a_b_a_s_e: + + char *config[] = { + "DB_TMP_DIR /b/temporary", + NULL + }; + + DbEnv::appinit("/a/database", config, ...); + + Store data files in _/_a_/_d_a_t_a_b_a_s_e_/_d_a_t_a_d_i_r, log files in + _/_a_/_d_a_t_a_b_a_s_e_/_l_o_g_d_i_r, and all other files in the directory + _/_a_/_d_a_t_a_b_a_s_e: + + char *config[] = { + "DB_DATA_DIR datadir", + "DB_LOG_DIR logdir", + NULL + }; + + DbEnv::appinit("/a/database", config, ...); + + Store data files in _/_a_/_d_a_t_a_b_a_s_e_/_d_a_t_a_1 and _/_b_/_d_a_t_a_2, and + all other files in the directory _/_a_/_d_a_t_a_b_a_s_e. Any data + files that are created will be created in _/_b_/_d_a_t_a_2: + + char *config[] = { + "DB_DATA_DIR /b/data2", + "DB_DATA_DIR data1", + NULL + }; + + DbEnv::appinit("/a/database", config, ...); + + See the file _e_x_a_m_p_l_e_s___c_x_x_/_A_p_p_i_n_i_t_E_x_a_m_p_l_e_._c_p_p in the Db + source distribution for a C++ language code example of how + an application might use _a_p_p_i_n_i_t to configure its Db envi- + ronment. + +EERRRROORRSS + Methods marked as returning _e_r_r_n_o will, by default, throw + an exception that encapsulates the error information. The + default error behavior can be changed, see _D_b_E_x_c_e_p_t_i_o_n(3). + + The _a_p_p_i_n_i_t method may fail and throw a _D_b_E_x_c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: Db::close(3), + DbEnv::appexit(3), DbLock::unlink(3), DbLockTab::open(3), + DbLog::compare(3), DbLog::get(3), DbLog::open(3), + DbLog::unlink(3), DbMpool::open(3), DbMpool::unlink(3), + DbTxnMgr::checkpoint(3), DbTxnMgr::open(3), DbTxn- + Mgr::unlink(3), calloc(3), fclose(3), fcntl(2), fflush(3), + fgets(3), fopen(3), malloc(3), memcpy(3), memset(3), real- + loc(3), stat(2), strchr(3), strcmp(3), strcpy(3), + strdup(3), strerror(3), strlen(3), strsep(3), and time(3). + + In addition, the _a_p_p_i_n_i_t method may fail and throw a _D_b_E_x_- + _c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following conditions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The DB_THREAD flag was specified and spinlocks are + not implemented for this architecture. + + The DB_RECOVER or DB_RECOVER_FATAL flag was speci- + fied, and no log files were found. + + The DB_HOME or TMPDIR environment variables were set + but empty. + + An incorrectly formatted ``NAME VALUE'' entry or line + was found. + + [ENOSPC] + HP-UX only: a previously created Db environment for + this process still exists. + + The _D_b_E_n_v_:_:_a_p_p_e_x_i_t method may fail and throw a + _D_b_E_x_c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DbLockTab::close(3), + DbLog::close(3), DbMpool::close(3), and DbTxn- + Mgr::close(3). + +BBUUGGSS + Due to the constraints of the PA-RISC memory architecture, + HP-UX does not allow a process to map a file into its + address space multiple times. For this reason, each DB + environment may be opened only once by a process on HP-UX, + i.e., calls to _a_p_p_i_n_i_t will fail if the specified Db envi- + ronment has been opened and not subsequently closed. + + On Windows/95, files that are opened by multiple processes + do not share data correctly. To tell Berkeley DB to use + the paging file to share memory among processes, use the + DB_REGION_NAME flag of the _d_b___v_a_l_u_e___s_e_t function. Obvi- + ously, you do not need to do this if only a single process + will be accessing database files. + +SSEEEE AALLSSOO + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___i_n_t_e_r_n_a_l(3), _d_b___t_h_r_e_a_d(3), _D_b(3), _D_b_c(3), _D_b_E_n_v(3), + _D_b_E_x_c_e_p_t_i_o_n(3), _D_b_I_n_f_o(3), _D_b_L_o_c_k(3), _D_b_L_o_c_k_T_a_b(3), _D_b_L_o_g(3), + _D_b_L_s_n(3), _D_b_M_p_o_o_l(3), _D_b_M_p_o_o_l_F_i_l_e(3), _D_b_t(3), _D_b_T_x_n(3), + _D_b_T_x_n_M_g_r(3) diff --git a/mozilla/db/man/mancxx.text/DbException.0 b/mozilla/db/man/mancxx.text/DbException.0 new file mode 100644 index 00000000000..4e241fa70cd --- /dev/null +++ b/mozilla/db/man/mancxx.text/DbException.0 @@ -0,0 +1,71 @@ + + +NNAAMMEE + DbException - Exception class for Db activity + +SSYYNNOOPPSSIISS + ##iinncclluuddee <> + + DDbbEExxcceeppttiioonn::::DDbbEExxcceeppttiioonn((iinntt eerrrr));; + DDbbEExxcceeppttiioonn::::DDbbEExxcceeppttiioonn((ccoonnsstt cchhaarr **ddeessccrriippttiioonn));; + DDbbEExxcceeppttiioonn::::DDbbEExxcceeppttiioonn((ccoonnsstt cchhaarr **pprreeffiixx,, iinntt eerrrr));; + DDbbEExxcceeppttiioonn::::DDbbEExxcceeppttiioonn((ccoonnsstt cchhaarr **pprreeffiixx11,, + ccoonnsstt cchhaarr **pprreeffiixx22,, iinntt eerrrr));; + + ccoonnsstt iinntt + DDbbEExxcceeppttiioonn::::ggeett__eerrrrnnoo(());; + + vviirrttuuaall ccoonnsstt cchhaarr ** + DDbbEExxcceeppttiioonn::::wwhhaatt(()) ccoonnsstt;; + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of classes that provides a mod- + ular programming interface to transactions and record-ori- + ented file access. The library includes support for + transactions, locking, logging and file page caching, as + well as various indexed access methods. Many of the + classes (e.g., the file page caching class) are useful + independent of the other DB classes, although some classes + are explicitly based on other classes (e.g., transactions + and logging). For a general description of the DB pack- + age, see _d_b___i_n_t_r_o(3). + + This manual page describes the DbException class and how + it is used by the various Db* classes. + + + Most methods in the Db classes return an int but also + throw an exception. This allows for two different error + behaviors, that are known as _e_r_r_o_r _m_o_d_e_l_s. By default, + the error model is configured to throw an exception when- + ever a serious error occurs. This generally allows for + cleaner logic for transaction processing, as a try block + can surround a single transaction. Alternatively, the + error model can be set to not throw exceptions, and + instead request the individual function to return an error + code. The error model can be changed using the + _D_b_E_n_v_:_:_s_e_t___e_r_r_o_r___m_o_d_e_l method, see _D_b_E_n_v(3). + + A DbException object contains an informational string and + an errno. The errno can be obtained using _D_b_E_x_c_e_p_- + _t_i_o_n_:_:_g_e_t___e_r_r_n_o(). The informational string can be + obtained using _D_b_E_x_c_e_p_t_i_o_n_:_:_w_h_a_t(). + + We expect in the future that this class will inherit from + the standard class exception, but certain language imple- + mentation bugs currently prevent this on some platforms. + + Some methods may return non-zero values without issuing an + exception. This occurs in situations that are not nor- + mally considered an error, but when some informational + status is returned. For example, _D_b_:_:_g_e_t returns + DB_KEYNOTFOUND when a requested key does not appear in the + database. + +SSEEEE AALLSSOO + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___i_n_t_e_r_n_a_l(3), _d_b___t_h_r_e_a_d(3), _D_b(3), _D_b_c(3), _D_b_E_n_v(3), + _D_b_E_x_c_e_p_t_i_o_n(3), _D_b_I_n_f_o(3), _D_b_L_o_c_k(3), _D_b_L_o_c_k_T_a_b(3), _D_b_L_o_g(3), + _D_b_L_s_n(3), _D_b_M_p_o_o_l(3), _D_b_M_p_o_o_l_F_i_l_e(3), _D_b_t(3), _D_b_T_x_n(3), + _D_b_T_x_n_M_g_r(3) diff --git a/mozilla/db/man/mancxx.text/DbInfo.0 b/mozilla/db/man/mancxx.text/DbInfo.0 new file mode 100644 index 00000000000..17a1b977f0f --- /dev/null +++ b/mozilla/db/man/mancxx.text/DbInfo.0 @@ -0,0 +1,506 @@ + + +NNAAMMEE + DbInfo - informational parameters for database open + +SSYYNNOOPPSSIISS + ##iinncclluuddee <> + + DDbbIInnffoo::::DDbbIInnffoo(());; + DDbbIInnffoo::::~~DDbbIInnffoo(());; + DDbbIInnffoo::::DDbbIInnffoo((ccoonnsstt DDbbIInnffoo &&));; + DDbbIInnffoo::::DDbbIInnffoo &&ooppeerraattoorr == ((ccoonnsstt DDbbIInnffoo &&));; + + iinntt DDbbIInnffoo::::ggeett__lloorrddeerr(()) ccoonnsstt;; + vvooiidd DDbbIInnffoo::::sseett__lloorrddeerr((iinntt));; + + ssiizzee__tt DDbbIInnffoo::::ggeett__ccaacchheessiizzee(()) ccoonnsstt;; + vvooiidd DDbbIInnffoo::::sseett__ccaacchheessiizzee((ssiizzee__tt));; + + ssiizzee__tt DDbbIInnffoo::::ggeett__ppaaggeessiizzee(()) ccoonnsstt;; + vvooiidd DDbbIInnffoo::::sseett__ppaaggeessiizzee((ssiizzee__tt));; + + ttyyppeeddeeff vvooiidd **((**ddbb__mmaalllloocc__ffccnn))((ssiizzee__tt));; + DDbbIInnffoo::::ddbb__mmaalllloocc__ffccnn DDbbIInnffoo::::ggeett__mmaalllloocc(()) ccoonnsstt;; + vvooiidd DDbbIInnffoo::::sseett__mmaalllloocc((ddbb__mmaalllloocc__ffccnn));; + + uu__iinntt3322__tt DDbbIInnffoo::::ggeett__bbtt__mmiinnkkeeyy(()) ccoonnsstt;; + vvooiidd DDbbIInnffoo::::sseett__bbtt__mmiinnkkeeyy((uu__iinntt3322__tt));; + + ttyyppeeddeeff iinntt ((**bbtt__ccoommppaarree__ffccnn))((ccoonnsstt DDBBTT **,, ccoonnsstt DDBBTT **));; + bbtt__ccoommppaarree__ffccnn DDbbIInnffoo::::ggeett__bbtt__ccoommppaarree(()) ccoonnsstt;; + vvooiidd DDbbIInnffoo::::sseett__bbtt__ccoommppaarree((bbtt__ccoommppaarree__ffccnn));; + + ttyyppeeddeeff ssiizzee__tt ((**bbtt__pprreeffiixx__ffccnn))((ccoonnsstt DDBBTT **,, ccoonnsstt DDBBTT **));; + bbtt__pprreeffiixx__ffccnn DDbbIInnffoo::::ggeett__bbtt__pprreeffiixx(()) ccoonnsstt;; + vvooiidd DDbbIInnffoo::::sseett__bbtt__pprreeffiixx((bbtt__pprreeffiixx__ffccnn));; + + uu__iinntt3322__tt DDbbIInnffoo::::ggeett__hh__ffffaaccttoorr(()) ccoonnsstt;; + vvooiidd DDbbIInnffoo::::sseett__hh__ffffaaccttoorr((uu__iinntt3322__tt));; + + uu__iinntt3322__tt DDbbIInnffoo::::ggeett__hh__nneelleemm(()) ccoonnsstt;; + vvooiidd DDbbIInnffoo::::sseett__hh__nneelleemm((uu__iinntt3322__tt));; + + ttyyppeeddeeff uu__iinntt3322__tt ((**hh__hhaasshh__ffccnn))((ccoonnsstt vvooiidd **,, uu__iinntt3322__tt));; + hh__hhaasshh__ffccnn DDbbIInnffoo::::ggeett__hh__hhaasshh(()) ccoonnsstt;; + vvooiidd DDbbIInnffoo::::sseett__hh__hhaasshh((hh__hhaasshh__ffccnn));; + + iinntt DDbbIInnffoo::::ggeett__rree__ppaadd(()) ccoonnsstt;; + vvooiidd DDbbIInnffoo::::sseett__rree__ppaadd((iinntt));; + + iinntt DDbbIInnffoo::::ggeett__rree__ddeelliimm(()) ccoonnsstt;; + vvooiidd DDbbIInnffoo::::sseett__rree__ddeelliimm((iinntt));; + + uu__iinntt3322__tt DDbbIInnffoo::::ggeett__rree__lleenn(()) ccoonnsstt;; + vvooiidd DDbbIInnffoo::::sseett__rree__lleenn((uu__iinntt3322__tt));; + + cchhaarr DDbbIInnffoo::::**ggeett__rree__ssoouurrccee(()) ccoonnsstt;; + vvooiidd DDbbIInnffoo::::sseett__rree__ssoouurrccee((cchhaarr **));; + + uu__iinntt3322__tt DDbbIInnffoo::::ggeett__ffllaaggss(()) ccoonnsstt;; + vvooiidd DDbbIInnffoo::::sseett__ffllaaggss((uu__iinntt3322__tt));; + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of classes that provides a mod- + ular programming interface to transactions and record-ori- + ented file access. The library includes support for + transactions, locking, logging and file page caching, as + well as various indexed access methods. Many of the + classes (e.g., the file page caching class) are useful + independent of the other DB classes, although some classes + are explicitly based on other classes (e.g., transactions + and logging). For a general description of the DB pack- + age, see _d_b___i_n_t_r_o(3). + + This manual page describes the DbInfo class. A DbInfo + object is used in conjunction with the _D_b_:_:_o_p_e_n method + (see _D_b(3)) to specify particular configuration options + for the open. The DbInfo class provides simple access to + an underlying data structure, whose elements can be exam- + ined or changed using the _s_e_t__ or _g_e_t__ methods. The + remainder of the manual page refers to these accesses + using the underlying name, e.g., _c_a_c_h_e_s_i_z_e instead of + _g_e_t___c_a_c_h_e_s_i_z_e and _s_e_t___c_a_c_h_e_s_i_z_e. The default constructor + sets all elements of the underlying structure to zero. + Some of the fields are specific to a type of file format + (one of btree, hashed and recno) and are thus named with + an underscore separated string, ``bt'', ``h'' and ``re'', + respectively. For example, the method _s_e_t___b_t___m_i_n_k_e_y sets + the underlying _b_t___m_i_n_k_e_y field, and this field is only + used when opening a btree file. + + The fields that are common to all access methods are + listed here; those specific to an individual access method + are described below. No reference to the DbInfo object is + maintained by Db, so it is possible to discard it as soon + as the _D_b_:_:_o_p_e_n call returns. + + If possible, defaults appropriate for the system are used + for the DbInfo fields if _d_b_i_n_f_o is NULL or any fields of + the DbInfo object are not explicitly set. The following + DbInfo fields may be initialized before calling _D_b_:_:_o_p_e_n: + + size_t cachesize; + A suggested maximum size of the memory pool cache, in + bytes. If _c_a_c_h_e_s_i_z_e is not explicitly set, an appro- + priate default is used. It is an error to specify + both the _m_p___i_n_f_o field and a non-zero _d_b___c_a_c_h_e_s_i_z_e. + + NNoottee,, tthhee mmiinniimmuumm nnuummbbeerr ooff ppaaggeess iinn tthhee ccaacchhee sshhoouulldd + bbee nnoo lleessss tthhaann 1100,, aanndd tthhee aacccceessss mmeetthhooddss wwiillll ffaaiill + iiff aann iinnssuuffffiicciieennttllyy llaarrggee ccaacchhee iiss ssppeecciiffiieedd.. In + addition, for applications that exhibit strong local- + ity in their data access patterns, increasing the + size of the cache can significantly improve + application performance. + + int lorder; + The byte order for integers in the stored database + metadata. The number should represent the order as + an integer, for example, big endian order is the num- + ber 4,321, and little endian order is the number + 1,234. If _l_o_r_d_e_r is not explicitly set, the host + order of the machine where the Db library was com- + piled is used. + + The value of _l_o_r_d_e_r is ignored except when databases + are being created. If a database already exists, the + byte order it uses is determined when the file is + read. + + TThhee aacccceessss mmeetthhooddss pprroovviiddee nnoo gguuaarraanntteeeess aabboouutt tthhee + bbyyttee oorrddeerriinngg ooff tthhee aapppplliiccaattiioonn ddaattaa ssttoorreedd iinn tthhee + ddaattaabbaassee,, aanndd aapppplliiccaattiioonnss aarree rreessppoonnssiibbllee ffoorr mmaaiinn-- + ttaaiinniinngg aannyy nneecceessssaarryy oorrddeerriinngg.. + + size_t pagesize; + The size of the pages used to hold items in the + database, in bytes. The minimum page size is 512 + bytes and the maximum page size is 64K bytes. If + _p_a_g_e_s_i_z_e is not explicitly set, a page size is + selected based on the underlying filesystem I/O block + size. The selected size has a lower limit of 512 + bytes and an upper limit of 16K bytes. + + void *(*malloc)(size_t); + The flag DB_DBT_MALLOC, when specified in the Dbt + object, will cause the Db library to allocate memory + which then becomes the responsibility of the calling + application. See _D_b_t(3) for more information. + + On systems where there may be multiple library ver- + sions of malloc (notably Windows NT), specifying the + DB_DBT_MALLOC flag will fail because the Db library + will allocate memory from a different heap than the + application will use to free it. To avoid this prob- + lem, the _m_a_l_l_o_c function should be set to point to + the application's allocation routine. If _m_a_l_l_o_c is + not explicitly set, it will be used to allocate the + memory returned when the DB_DBT_MALLOC flag is set. + The _m_a_l_l_o_c method must match the calling conventions + of the _m_a_l_l_o_c(3) library routine. + +BBTTRREEEE + The btree data structure is a sorted, balanced tree struc- + ture storing associated key/data pairs. Searches, inser- + tions, and deletions in the btree will all complete in O + (lg base N) where base is the average number of keys per + page. Often, inserting ordered data into btrees results + in pages that are half-full. This implementation has been + modified to make ordered (or inverse ordered) insertion + the best case, resulting in nearly perfect page space uti- + lization. + + Space freed by deleting key/data pairs from the database + is never reclaimed from the filesystem, although it is + reused where possible. This means that the btree storage + structure is grow-only. If sufficiently many keys are + deleted from a tree that shrinking the underlying database + file is desirable, this can be accomplished by creating a + new tree from a scan of the existing one. + + The following additional fields and flags may be initial- + ized in the DbInfo object before calling _D_b_:_:_o_p_e_n, when + using the btree access method: + + int (*bt_compare)(const Dbt *, const Dbt *); + The _b_t___c_o_m_p_a_r_e function is the key comparison method. + It must return an integer less than, equal to, or + greater than zero if the first key argument is con- + sidered to be respectively less than, equal to, or + greater than the second key argument. The same com- + parison method must be used on a given tree every + time it is opened. + + The _d_a_t_a and _s_i_z_e fields of the DBT are the only + fields that may be used for the purposes of this com- + parison. + + If _b_t___c_o_m_p_a_r_e is NULL, the keys are compared lexi- + cally, with shorter keys collating before longer + keys. + + u_int32_t bt_minkey; + The minimum number of keys that will be stored on any + single page. This value is used to determine which + keys will be stored on overflow pages, i.e. if a key + or data item is larger than the pagesize divided by + the _b_t___m_i_n_k_e_y value, it will be stored on overflow + pages instead of in the page itself. The _b_t___m_i_n_k_e_y + value specified must be at least 2; if _b_t___m_i_n_k_e_y is + not explicitly set, a value of 2 is used. + + size_t (*bt_prefix)(const Dbt *, const Dbt *); + The _b_t___p_r_e_f_i_x function is the prefix comparison + method. If specified, this method must return the + number of bytes of the second key argument that are + necessary to determine that it is greater than the + first key argument. If the keys are equal, the key + length should be returned. + + The _d_a_t_a and _s_i_z_e fields of the DBT are the only + fields that may be used for the purposes of this + comparison. + + This is used to compress the keys stored on the btree + internal pages. The usefulness of this is data + dependent, but in some data sets can produce signifi- + cantly reduced tree sizes and search times. If + _b_t___p_r_e_f_i_x is not explicitly set, and no comparison + method is specified, a default lexical comparison + method is used. If _b_t___p_r_e_f_i_x is NULL and a compari- + son method is specified, no prefix comparison is + done. + + unsigned long flags; + The following additional flags may be specified: + + DB_DUP + Permit duplicate keys in the tree, i.e. inser- + tion when the key of the key/data pair being + inserted already exists in the tree will be suc- + cessful. The ordering of duplicates in the tree + is determined by the order of insertion, unless + the ordering is otherwise specified by use of a + cursor (see _D_b_c(3) for more information.) It is + an error to specify both DB_DUP and DB_RECNUM. + + + DB_RECNUM + Support retrieval from btrees using record num- + bers. For more information, see the + DB_GET_RECNO flag to the _d_b_-_>_g_e_t method (below), + and the cursor _D_b_c_:_:_g_e_t method (in _D_b_c(3)). + + Logical record numbers in btrees are mutable in + the face of record insertion or deletion. See + the DB_RENUMBER flag in the RECNO section below + for further discussion. + + Maintaining record counts within a btree intro- + duces a serious point of contention, namely the + page locations where the record counts are + stored. In addition, the entire tree must be + locked during both insertions and deletions, + effectively single-threading the tree for those + operations. Specifying DB_RECNUM can result in + serious performance degradation for some appli- + cations and data sets. + + It is an error to specify both DB_DUP and + DB_RECNUM. + +HHAASSHH + The hash data structure is an extensible, dynamic hashing + scheme. Backward compatible interfaces to the functions + described in _d_b_m(3), _n_d_b_m(3) and _h_s_e_a_r_c_h(3) are provided, + however these interfaces are not compatible with previous + file formats. + + The following additional fields and flags may be initial- + ized in the DbInfo object before calling _D_b_:_:_o_p_e_n, when + using the hash access method: + + + u_int32_t h_ffactor; + The desired density within the hash table. It is an + approximation of the number of keys allowed to accu- + mulate in any one bucket, determining when the hash + table grows or shrinks. The default value is 0, + indicating that the fill factor will be selected + dynamically as pages are filled. + + u_int32_t (*h_hash)(const void *, u_int32_t); + The _h___h_a_s_h field is a user defined hash method; if + _h___h_a_s_h is NULL, a default hash method is used. Since + no hash method performs equally well on all possible + data, the user may find that the built-in hash method + performs poorly with a particular data set. User + specified hash functions must take a pointer to a + byte string and a length as arguments and return a + u_int32_t value. + + If a hash method is specified, _h_a_s_h___o_p_e_n will attempt + to determine if the hash method specified is the same + as the one with which the database was created, and + will fail if it detects that it is not. + + u_int32_t h_nelem; + An estimate of the final size of the hash table. If + not set or set too low, hash tables will expand + gracefully as keys are entered, although a slight + performance degradation may be noticed. The default + value is 1. + + unsigned long flags; + The following additional flags may be specified by + oorr'ing together one or more of the following values: + + DB_DUP + Permit duplicate keys in the tree, i.e. inser- + tion when the key of the key/data pair being + inserted already exists in the tree will be suc- + cessful. The ordering of duplicates in the tree + is determined by the order of insertion, unless + the ordering is otherwise specified by use of a + cursor (see _D_b_c(3) for more information.) + +RREECCNNOO + The recno access method provides support for fixed and + variable length records, optionally backed by a flat text + (byte stream) file. Both fixed and variable length + records are accessed by their logical record number. + + It is valid to create a record whose record number is more + than one greater than the last record currently in the + database. For example, the creation of record number 8, + when records 6 and 7 do not yet exist, is not an error. + However, any attempt to retrieve such records (e.g., + records 6 and 7) will return DB_KEYEMPTY. + + Deleting a record will not, by default, renumber records + following the deleted record (see DB_RENUMBER below for + more information). Any attempt to retrieve deleted + records will return DB_KEYEMPTY. + + The following additional fields and flags may be initial- + ized in the DbInfo object before calling _D_b_:_:_o_p_e_n, when + using the recno access method: + + int re_delim; + For variable length records, if the _r_e___s_o_u_r_c_e file is + specified and the DB_DELIMITER flag is set, the + delimiting byte used to mark the end of a record in + the source file. If the _r_e___s_o_u_r_c_e file is specified + and the DB_DELIMITER flag is not set, char- + acters (i.e. ``\n'', 0x0a) are interpreted as end-of- + record markers. + + u_int32_t re_len; + The length of a fixed-length record. + + int re_pad; + For fixed length records, if the DB_PAD flag is set, + the pad character for short records. If the DB_PAD + flag is not explicitly set, characters (i.e., + 0x20) are used for padding. + + char *re_source; + The purpose of the _r_e___s_o_u_r_c_e field is to provide fast + access and modification to databases that are nor- + mally stored as flat text files. + + If the _r_e___s_o_u_r_c_e field is explicitly set, it speci- + fies an underlying flat text database file that is + read to initialize a transient record number index. + In the case of variable length records, the records + are separated by the byte value _r_e___d_e_l_i_m. For exam- + ple, standard UNIX byte stream files can be inter- + preted as a sequence of variable length records sepa- + rated by characters. + + In addition, when cached data would normally be writ- + ten back to the underlying database file (e.g., the + _c_l_o_s_e or _s_y_n_c functions are called), the in-memory + copy of the database will be written back to the + _r_e___s_o_u_r_c_e file. + + By default, the backing source file is read lazily, + i.e., records are not read from the file until they + are requested by the application. IIff mmuullttiippllee pprroo-- + cceesssseess ((nnoott tthhrreeaaddss)) aarree aacccceessssiinngg aa rreeccnnoo ddaattaabbaassee + ccoonnccuurrrreennttllyy aanndd eeiitthheerr iinnsseerrttiinngg oorr ddeelleettiinngg + rreeccoorrddss,, tthhee bbaacckkiinngg ssoouurrccee ffiillee mmuusstt bbee rreeaadd iinn iittss + eennttiirreettyy bbeeffoorree mmoorree tthhaann aa ssiinnggllee pprroocceessss aacccceesssseess + tthhee ddaattaabbaassee,, aanndd oonnllyy tthhaatt pprroocceessss sshhoouulldd ssppeecciiffyy + tthhee bbaacckkiinngg ssoouurrccee ffiillee aass ppaarrtt ooff tthhee _D_b_:_:_o_p_e_n call. + See the DB_SNAPSHOT flag below for more information. + + RReeaaddiinngg aanndd wwrriittiinngg tthhee bbaacckkiinngg ssoouurrccee ffiillee ssppeecciiffiieedd + bbyy rree__ssoouurrccee ccaannnnoott bbee ttrraannssaaccttiioonnaallllyy pprrootteecctteedd + bbeeccaauussee iitt iinnvvoollvveess ffiilleessyysstteemm ooppeerraattiioonnss tthhaatt aarree + nnoott ppaarrtt ooff tthhee DDbb ttrraannssaaccttiioonn mmeetthhooddoollooggyy.. For this + reason, if a temporary database is used to hold the + records, i.e., a NULL was specified as the _f_i_l_e argu- + ment to _D_b_:_:_o_p_e_n, it is possible to lose the contents + of the _r_e___s_o_u_r_c_e file, e.g., if the system crashes at + the right instant. If a file is used to hold the + database, i.e., a file name was specified as the _f_i_l_e + argument to _D_b_:_:_o_p_e_n, normal database recovery on + that file can be used to prevent information loss, + although it is still possible that the contents of + _r_e___s_o_u_r_c_e will be lost if the system crashes. + + The _r_e___s_o_u_r_c_e file must already exist (but may be + zero-length) when _D_b_:_:_o_p_e_n is called. + + For all of the above reasons, the _r_e___s_o_u_r_c_e field is + generally used to specify databases that are read- + only for Db applications, and that are either gener- + ated on the fly by software tools, or modified using + a different mechanism, e.g., a text editor. + + unsigned long flags; + The following additional flags may be specified by + oorr'ing together one or more of the following values: + + + DB_DELIMITER + The _r_e___d_e_l_i_m field is set. + + + DB_FIXEDLEN + The records are fixed-length, not byte delim- + ited. The _r_e___l_e_n value specifies the length of + the record, and the _r_e___p_a_d value is used as the + pad character. + + Any records added to the database that are less + than _r_e___l_e_n bytes long are automatically padded. + Any attempt to insert records into the database + that are greater than _r_e___l_e_n bytes long will + cause the call to fail immediately and return an + error. + + + DB_PAD + The _r_e___p_a_d field is set. + + + DB_RENUMBER + Specifying the DB_RENUMBER flag causes the logi- + cal record numbers to be mutable, and change as + records are added to and deleted from the + database. For example, the deletion of record + number 4 causes records numbered 5 and greater + to be renumbered downward by 1. If a cursor was + positioned to record number 4 before the dele- + tion, it will reference the new record number 4, + if any such record exists, after the deletion. + If a cursor was positioned after record number 4 + before the deletion, it will be shifted downward + 1 logical record, continuing to reference the + same record as it did before. + + Using the _D_b_c_:_:_p_u_t or _p_u_t interfaces to create + new records will cause the creation of multiple + records if the record number is more than one + greater than the largest record currently in the + database. For example, creating record 28, when + record 25 was previously the last record in the + database, will create records 26 and 27 as well + as 28. Attempts to retrieve records that were + created in this manner will result in an error + return of DB_KEYEMPTY. + + If a created record is not at the end of the + database, all records following the new record + will be automatically renumbered upward by 1. + For example, the creation of a new record num- + bered 8 causes records numbered 8 and greater to + be renumbered upward by 1. If a cursor was + positioned to record number 8 or greater before + the insertion, it will be shifted upward 1 logi- + cal record, continuing to reference the same + record as it did before. + + For these reasons, concurrent access to a recno + database with the DB_RENUMBER flag specified may + be largely meaningless, although it is sup- + ported. + + + DB_SNAPSHOT + This flag specifies that any specified _r_e___s_o_u_r_c_e + file be read in its entirety when _D_b_:_:_o_p_e_n is + called. If this flag is not specified, the + _r_e___s_o_u_r_c_e file may be read lazily. + + +SSEEEE AALLSSOO + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___i_n_t_e_r_n_a_l(3), _d_b___t_h_r_e_a_d(3), _D_b(3), _D_b_c(3), _D_b_E_n_v(3), + _D_b_E_x_c_e_p_t_i_o_n(3), _D_b_I_n_f_o(3), _D_b_L_o_c_k(3), _D_b_L_o_c_k_T_a_b(3), _D_b_L_o_g(3), + _D_b_L_s_n(3), _D_b_M_p_o_o_l(3), _D_b_M_p_o_o_l_F_i_l_e(3), _D_b_t(3), _D_b_T_x_n(3), + _D_b_T_x_n_M_g_r(3) diff --git a/mozilla/db/man/mancxx.text/DbLock.0 b/mozilla/db/man/mancxx.text/DbLock.0 new file mode 100644 index 00000000000..ac3b1b7884d --- /dev/null +++ b/mozilla/db/man/mancxx.text/DbLock.0 @@ -0,0 +1,101 @@ + + +NNAAMMEE + DbLock - lock class + +SSYYNNOOPPSSIISS + ##iinncclluuddee <> + + iinntt + DDbbLLoocckk::::ppuutt((DDbbLLoocckkTTaabb **lltt));; + + uunnssiiggnneedd iinntt + DDbbLLoocckk::::ggeett__lloocckk__iidd(());; + + vvooiidd + DDbbLLoocckk::::sseett__lloocckk__iidd((uunnssiiggnneedd iinntt));; + + DDBBLLoocckk::::DDbbLLoocckk((uunnssiiggnneedd iinntt));; + DDBBLLoocckk::::DDbbLLoocckk(());; + DDBBLLoocckk::::DDbbLLoocckk((ccoonnsstt DDbbLLoocckk &&));; + DDbbLLoocckk &&DDBBLLoocckk::::ooppeerraattoorr == ((ccoonnsstt DDbbLLoocckk &&));; + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of classes that provides a mod- + ular programming interface to transactions and record-ori- + ented file access. The library includes support for + transactions, locking, logging and file page caching, as + well as various indexed access methods. Many of the + classes (e.g., the file page caching class) are useful + independent of the other DB classes, although some classes + are explicitly based on other classes (e.g., transactions + and logging). For a general description of the DB pack- + age, see _d_b___i_n_t_r_o(3). + + This manual page describes the specific details of the + locking interface. The DbLock class is used in conjunc- + tion with _D_b_L_o_c_k_T_a_b(3) to provide general-purpose locking. + While designed to work with the other Db classes, these + classes are also useful for more general locking purposes. + Locks can be shared between processes. In most cases, + when multiple threads or processes are using locking, the + deadlock detector, _d_b___d_e_a_d_l_o_c_k(1), should be run. + + _D_b_L_o_c_k_:_:_p_u_t + The _D_b_L_o_c_k_:_:_p_u_t method is a simple interface to the + _D_b_L_o_c_k_T_a_b_:_:_v_e_c functionality, and is equivalent to calling + the _D_b_L_o_c_k_T_a_b_:_:_v_e_c method with a single element _l_i_s_t + array, for which the _o_p field is DB_LOCK_PUT and the _l_o_c_k + field is represented by the DbLock object. The + _D_b_L_o_c_k_:_:_p_u_t method returns success and failure as + described for the _D_b_L_o_c_k_T_a_b_:_:_v_e_c method. + + _D_b_L_o_c_k_:_:_g_e_t___l_o_c_k___i_d + The _D_b_L_o_c_k_:_:_g_e_t___l_o_c_k___i_d method gets the underlying repre- + sentation of the lock id. Direct manipulation of the + underlying representation is not recommended. + + _D_b_L_o_c_k_:_:_s_e_t___l_o_c_k___i_d + The _D_b_L_o_c_k_:_:_s_e_t___l_o_c_k___i_d method sets the underlying repre- + sentation of the lock id. Direct manipulation of the + underlying representation is not recommended. Rather, + _D_b_L_o_c_k_T_a_b_:_:_g_e_t should be used to initialize locks (see + _D_b_L_o_c_k_T_a_b(3)), and the copy constructor and assignment + operators can be used to assign to other DbLock objects. + +EERRRROORRSS + Methods marked as returning _e_r_r_n_o will, by default, throw + an exception that encapsulates the error information. The + default error behavior can be changed, see _D_b_E_x_c_e_p_t_i_o_n(3). + + The _D_b_L_o_c_k_:_:_p_u_t method may fail and throw a _D_b_E_x_c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DbLock::detect(3), + fcntl(2), fflush(3), lseek(2), memcpy(3), memset(3), + mmap(2), munmap(2), strerror(3), and write(2). + + In addition, the _D_b_L_o_c_k_:_:_p_u_t method may fail and throw a + _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [EACCES] + An attempt was made to release lock held by another + locker. + + [EINVAL] + An invalid flag value or parameter was specified. + +BBUUGGSS + If a process dies while holding locks, those locks remain + held and are nneevveerr released. In this case, all processes + should exit as quickly as possible, so that _d_b___r_e_c_o_v_e_r can + be run. + +SSEEEE AALLSSOO + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___i_n_t_e_r_n_a_l(3), _d_b___t_h_r_e_a_d(3), _D_b(3), _D_b_c(3), _D_b_E_n_v(3), + _D_b_E_x_c_e_p_t_i_o_n(3), _D_b_I_n_f_o(3), _D_b_L_o_c_k(3), _D_b_L_o_c_k_T_a_b(3), _D_b_L_o_g(3), + _D_b_L_s_n(3), _D_b_M_p_o_o_l(3), _D_b_M_p_o_o_l_F_i_l_e(3), _D_b_t(3), _D_b_T_x_n(3), + _D_b_T_x_n_M_g_r(3) diff --git a/mozilla/db/man/mancxx.text/DbLockTab.0 b/mozilla/db/man/mancxx.text/DbLockTab.0 new file mode 100644 index 00000000000..68c8f4c6188 --- /dev/null +++ b/mozilla/db/man/mancxx.text/DbLockTab.0 @@ -0,0 +1,584 @@ + + +NNAAMMEE + DbLockTab - lock manager + +SSYYNNOOPPSSIISS + ##iinncclluuddee <> + + ssttaattiicc iinntt + DDbbLLoocckkTTaabb::::ooppeenn((ccoonnsstt cchhaarr **ddiirr,, + uu__iinntt3322__tt ffllaaggss,, iinntt mmooddee,, DDbbEEnnvv **ddbbeennvv,, DDbbLLoocckkTTaabb ****rreeggiioonnpp));; + + iinntt + DDbbLLoocckkTTaabb::::iidd((uu__iinntt3322__tt **iiddpp));; + + iinntt + DDbbLLoocckkTTaabb::::vveecc((uu__iinntt3322__tt lloocckkeerr,, uu__iinntt3322__tt ffllaaggss,, + DDBB__LLOOCCKKRREEQQ lliisstt[[]],, iinntt nnlliisstt,, DDBB__LLOOCCKKRREEQQ ****eelliissttpp));; + + iinntt + DDbbLLoocckkTTaabb::::ggeett((uu__iinntt3322__tt lloocckkeerr,, uu__iinntt3322__tt ffllaaggss,, + ccoonnsstt DDbbtt **oobbjj,, ccoonnsstt ddbb__lloocckkmmooddee__tt lloocckk__mmooddee,, DDBB__LLOOCCKK **lloocckk));; + + iinntt + DDbbLLoocckkTTaabb::::cclloossee(());; + + ssttaattiicc iinntt + DDbbLLoocckkTTaabb::::uunnlliinnkk((ccoonnsstt cchhaarr **ddiirr,, iinntt ffoorrccee,, DDbbEEnnvv **ddbbeennvv));; + + iinntt + DDbbLLoocckkTTaabb::::ddeetteecctt((uu__iinntt3322__tt ffllaaggss,, uu__iinntt3322__tt aattyyppee));; + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of classes that provides a mod- + ular programming interface to transactions and record-ori- + ented file access. The library includes support for + transactions, locking, logging and file page caching, as + well as various indexed access methods. Many of the + classes (e.g., the file page caching class) are useful + independent of the other DB classes, although some classes + are explicitly based on other classes (e.g., transactions + and logging). For a general description of the DB pack- + age, see _d_b___i_n_t_r_o(3). + + This manual page describes the specific details of the + locking interface. + + The _D_b_L_o_c_k_T_a_b class is intended to provide general-purpose + locking. While designed to work with the other Db + classes, this class is also useful for more general lock- + ing purposes. Locks can be shared between processes. In + most cases, when multiple treads or processes are using + locking, the deadlock detector, _d_b___d_e_a_d_l_o_c_k(1), should be + run. + + _D_b_L_o_c_k_T_a_b_:_:_o_p_e_n + The _D_b_L_o_c_k_T_a_b_:_:_o_p_e_n method copies a pointer, to the lock + table identified by the ddiirreeccttoorryy _d_i_r, into the memory + location referenced by _r_e_g_i_o_n_p. + + + If the _d_b_e_n_v argument to _D_b_L_o_c_k_T_a_b_:_:_o_p_e_n was initialized + using _D_b_E_n_v_:_:_a_p_p_i_n_i_t, _d_i_r is interpreted as described by + _D_b_E_n_v(3). + + Otherwise, if _d_i_r is not NULL, it is interpreted relative + to the current working directory of the process. If _d_i_r + is NULL, the following environment variables are checked + in order: ``TMPDIR'', ``TEMP'', and ``TMP''. If one of + them is set, lock table files are created relative to the + directory it specifies. If none of them are set, the + first possible one of the following directories is used: + _/_v_a_r_/_t_m_p, _/_u_s_r_/_t_m_p, _/_t_e_m_p, _/_t_m_p, _C_:_/_t_e_m_p and _C_:_/_t_m_p. + + All files associated with the lock table are created in + this directory. This directory must already exist when + DbLockTab::open is called. If the lock table already + exists, the process must have permission to read and write + the existing files. If the lock table does not already + exist, it is optionally created and initialized. + + The _f_l_a_g_s and _m_o_d_e arguments specify how files will be + opened and/or created when they don't already exist. The + flags value is specified by oorr'ing together one or more of + the following values: + + DB_CREATE + Create any underlying files, as necessary. If the + files do not already exist and the DB_CREATE flag is + not specified, the call will fail. + + + DB_THREAD + Cause the DbLockTab handle returned by the _D_b_L_o_c_k_- + _T_a_b_:_:_o_p_e_n method to be useable by multiple threads + within a single address space, i.e., to be ``free- + threaded''. + + All files created by the lock subsystem are created with + mode _m_o_d_e (as described in _c_h_m_o_d(2)) and modified by the + process' umask value at the time of creation (see + _u_m_a_s_k(2)). The group ownership of created files is based + on the system and directory defaults, and is not further + specified by DB. + + The locking subsystem is configured based on which set + methods have been used. It is expected that applications + will use a single DbEnv object as the argument to all of + the subsystems in the DB package. The fields of the DbEnv + object used by _D_b_L_o_c_k_T_a_b_:_:_o_p_e_n are described below. As + references to the DbEnv object may be maintained by + _D_b_L_o_c_k_T_a_b_:_:_o_p_e_n, it is necessary that the DbEnv object and + memory it references be valid until the object is + destroyed. Any of the DbEnv fields that are not explic- + itly set will default to appropriate values. + + The following fields in the DbEnv object may be initial- + ized, using the appropriate set method, before calling + _D_b_L_o_c_k_T_a_b_:_:_o_p_e_n: + + + void *(*db_errcall)(char *db_errpfx, char *buffer); + FILE *db_errfile; + const char *db_errpfx; + class ostream *db_error_stream; + int db_verbose; + The error fields of the DbEnv behave as described for + _D_b_E_n_v(3). + + const u_int8_t lk_conflicts[][]; + A _l_k___m_o_d_e_s by _l_k___m_o_d_e_s array. A non-0 value for the + array element: + + lk_conflicts[requested_mode][held_mode] + + indicates that requested_mode and held_mode conflict. + The ``not-granted'' mode must be represented by 0. + If _l_k___c_o_n_f_l_i_c_t_s is NULL, the conflicts array + _d_b___r_w___c_o_n_f_l_i_c_t_s is used; see the section below enti- + tled ``STANDARD LOCK MODES'' for a description of + that array. + + u_int32_t lk_detect; + If non-0, specifies that the deadlock detector be run + whenever a lock conflict occurs, and specifies which + transaction should be aborted in the case of a dead- + lock. The _l_k___d_e_t_e_c_t field must be set to one of the + following values. + + + DB_LOCK_DEFAULT + Use the default policy as specified in the + _d_b___d_e_a_d_l_o_c_k(1) man page. + + + DB_LOCK_OLDEST + Abort the oldest transaction. + + + DB_LOCK_RANDOM + Abort a random transaction involved in the dead- + lock. + + + DB_LOCK_YOUNGEST + Abort the youngest transaction. + + u_int32_t lk_max; + The maximum number of locks to be held or requested + in the table. This value is used by _D_b_L_o_c_k_T_a_b_:_:_o_p_e_n + to estimate how much space to allocate for various + lock-table data structures. If _l_k___m_a_x is not explic- + itly set, a default value is used. + + u_int32_t lk_modes; + + The number of lock modes to be recognized by the lock + table (including + the ``not-granted'' mode). If _l_k___m_o_d_e_s is 0, the + value DB_LOCK_RW_N is used; see below for a descrip- + tion of that value. + + The _D_b_L_o_c_k_T_a_b_:_:_o_p_e_n method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_L_o_c_k_T_a_b_:_:_i_d + The _D_b_L_o_c_k_T_a_b_:_:_i_d method copies a locker ID, which is + guaranteed to be unique in the specified lock table, into + the memory location referenced by _i_d_p. + + The access methods (see _D_b_:_:_o_p_e_n in _D_b(3)), generate a + unique locker ID for each file that is opened with lock- + ing. During Db access method operation, this locker ID + will be used for all lock calls unless a transaction iden- + tifier was specified for the call, in which case the + transaction ID specified is used for locking. + + The _D_b_L_o_c_k_T_a_b_:_:_i_d method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + + _D_b_L_o_c_k_T_a_b_:_:_v_e_c + The _D_b_L_o_c_k_T_a_b_:_:_v_e_c method atomically obtains and releases + one or more locks from the specified table. The _D_b_L_o_c_k_- + _T_a_b_:_:_v_e_c method is intended to support acquisition or + trading of multiple locks under one lock table semaphore, + as is needed for lock coupling or in multigranularity + locking for lock escalation. + + The _l_o_c_k_e_r argument specified to _D_b_L_o_c_k_T_a_b_:_:_v_e_c is an + unsigned 32-bit integer quantity. It represents the + entity requesting or releasing the lock. + + The _f_l_a_g_s value must be set to 0 or the following value: + + + DB_LOCK_NOWAIT + If a lock cannot be granted because the requested + lock conflicts with an existing lock, return immedi- + ately instead of waiting for the lock to become + available. + + The _l_i_s_t array provided to _D_b_L_o_c_k_T_a_b_:_:_v_e_c is typedef'd in + as DB_LOCKREQ. A DB_LOCKREQ structure has at + least the following fields, which must be initialized + before calling _D_b_L_o_c_k_T_a_b_:_:_v_e_c: + + lockop_t op; + The operation to be performed, which must be set to + one of the following values: + + + DB_LOCK_GET + Get a lock, as defined by the values of _l_o_c_k_e_r, + _o_b_j and _m_o_d_e. Upon return from _D_b_L_o_c_k_T_a_b_:_:_v_e_c, + if the _l_o_c_k field is non-NULL, a reference to + the acquired lock is stored there. (This refer- + ence is invalidated by any call to _D_b_L_o_c_k_- + _T_a_b_:_:_v_e_c or _D_b_L_o_c_k_:_:_p_u_t that releases the lock.) + See _D_b_L_o_c_k(3). + + + DB_LOCK_PUT + The lock referenced by the contents of the _l_o_c_k + field is released. + + + DB_LOCK_PUT_ALL + All locks held by the _l_o_c_k_e_r are released. (Any + locks acquired as a part of the current call to + _D_b_L_o_c_k_T_a_b_:_:_v_e_c that appear after the + DB_LOCK_PUT_ALL entry are not considered for + this operation). + + + DB_LOCK_PUT_OBJ + All locks held by the _l_o_c_k_e_r, on the object _o_b_j, + with the mode specified by _l_o_c_k___m_o_d_e, are + released. A _l_o_c_k___m_o_d_e of DB_LOCK_NG indicates + that all locks on the object should be released. + Note that any locks acquired as a part of the + current call to _D_b_L_o_c_k_T_a_b_:_:_v_e_c that occur before + the DB_LOCK_PUT_OBJ will also be released; those + acquired afterwards will not be released. + + const Dbt obj; + An untyped byte string that specifies the object to + be locked or released. + + const lockmode_t mode; + The lock mode, used as an index into object's con- + flict array. + + DB_LOCK lock; + A lock reference. + + The _n_l_i_s_t argument specifies the number of elements in the + _l_i_s_t array. + + If any of the requested locks cannot be acquired, or any + of the locks to be released cannot be released, the opera- + tions before the failing operation are guaranteed to have + completed successfully, and _D_b_L_o_c_k_T_a_b_:_:_v_e_c returns a non- + zero value. In addition, if _e_l_i_s_t_p is not NULL, it is set + to point to the DB_LOCKREQ entry that was being processed + when the error occurred. + + In the case of an error, _D_b_L_o_c_k_T_a_b_:_:_v_e_c may return one of + the following values: + + + DB_LOCK_DEADLOCK + The specified _l_o_c_k_e_r was selected as a victim in + order to resolve a deadlock. + + + DB_LOCK_NOTHELD + The lock cannot be released, as it was not held by + the _l_o_c_k_e_r. + + + DB_LOCK_NOTGRANTED + A lock was requested that could not be granted and + the _f_l_a_g parameter was set to DB_LOCK_NOWAIT. In + this case, if non-NULL, _e_l_i_s_t_p identifies the request + that was granted. + + Otherwise, the _D_b_L_o_c_k_T_a_b_:_:_v_e_c method throws a _D_b_E_x_c_e_p_- + _t_i_o_n(3) or returns the value of _e_r_r_n_o on failure and 0 on + success. + + + _D_b_L_o_c_k_T_a_b_:_:_g_e_t + The _D_b_L_o_c_k_T_a_b_:_:_g_e_t method is a simple interface to the + + _D_b_L_o_c_k_T_a_b_:_:_v_e_c functionality, and is equivalent to calling + the + + _D_b_L_o_c_k_T_a_b_:_:_v_e_c method with the _l_o_c_k_e_r argument, _e_l_i_s_t_p and + _c_o_n_f_l_i_c_t arguments, and a single element _l_i_s_t array, for + which the _o_p field is DB_LOCK_GET, and the _o_b_j, _l_o_c_k___m_o_d_e + and _l_o_c_k fields are represented by the arguments of the + same name. Note that the type of the _o_b_j argument to + _D_b_L_o_c_k_T_a_b_:_:_g_e_t is different from the _o_b_j element found in + the DB_LOCKREQ structure. The _D_b_L_o_c_k_T_a_b_:_:_g_e_t method + returns success and failure as described for the + + _D_b_L_o_c_k_T_a_b_:_:_v_e_c method. + + _D_b_L_o_c_k_T_a_b_:_:_c_l_o_s_e + The _D_b_L_o_c_k_T_a_b_:_:_c_l_o_s_e method disassociates the calling pro- + cess from the lock table. The object should not be used + after a call to close. Note that _D_b_L_o_c_k_T_a_b_:_:_c_l_o_s_e does + not release any locks still held by the closing process. + (This provides functionality for long-lived locks.) + + Processes that wish to have all their locks released can + do so by issuing the appropriate _D_b_L_o_c_k_T_a_b_:_:_v_e_c call. + + In addition, if the _d_i_r argument to _D_b_L_o_c_k_T_a_b_:_:_o_p_e_n was + NULL and _d_b_e_n_v was not initialized using _D_b_E_n_v_:_:_a_p_p_i_n_i_t, + all files created for this shared region will be removed, + as if _D_b_L_o_c_k_T_a_b_:_:_u_n_l_i_n_k were called. + + When multiple threads are using the DbLockTab object con- + currently, only a single thread may call the _D_b_L_o_c_k_- + _T_a_b_:_:_c_l_o_s_e method. + + The _D_b_L_o_c_k_T_a_b_:_:_c_l_o_s_e method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + + _D_b_L_o_c_k_T_a_b_:_:_u_n_l_i_n_k + The _D_b_L_o_c_k_T_a_b_:_:_u_n_l_i_n_k method destroys the lock table iden- + tified by the directory _d_i_r, removing all files used to + implement the lock table. (The directory _d_i_r is not + removed.) If there are processes that have called _D_b_L_o_c_k_- + _T_a_b_:_:_o_p_e_n without calling _D_b_L_o_c_k_T_a_b_:_:_c_l_o_s_e (i.e., there + are processes currently using the lock table), _D_b_L_o_c_k_- + _T_a_b_:_:_u_n_l_i_n_k will fail without further action, unless the + force flag is set, in which case _D_b_L_o_c_k_T_a_b_:_:_u_n_l_i_n_k will + attempt to remove the lock table files regardless of any + processes still using the lock table. + + The result of attempting to forcibly destroy the region + when a process has the region open is unspecified. Pro- + cesses using a shared memory region maintain an open file + descriptor for it. On UNIX systems, the region removal + should succeed and processes that have already joined the + region should continue to run in the region without + change, however processes attempting to join the lock + table will either fail or attempt to create a new region. + On other systems, e.g., WNT, where the _u_n_l_i_n_k(2) system + call will fail if any process has an open file descriptor + for the file, the region removal will fail. + + In the case of catastrophic or system failure, database + recovery must be performed (see _d_b___r_e_c_o_v_e_r(1) or the + DB_RECOVER and DB_RECOVER_FATAL flags to + _D_b_E_n_v_:_:_a_p_p_i_n_i_t(3)). Alternatively, if recovery is not + required because no database state is maintained across + failures, it is possible to clean up a lock table by + removing all of the files in the directory specified to + the _D_b_L_o_c_k_T_a_b_:_:_o_p_e_n method, as lock table files are never + created in any directory other than the one specified to + _D_b_L_o_c_k_T_a_b_:_:_o_p_e_n. Note, however, that this has the poten- + tial to remove files created by the other DB subsystems in + this database environment. + + The _D_b_L_o_c_k_T_a_b_:_:_u_n_l_i_n_k method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_L_o_c_k_T_a_b_:_:_d_e_t_e_c_t + The _D_b_L_o_c_k_T_a_b_:_:_d_e_t_e_c_t method runs one iteration of the + deadlock detector on the current lock table. The deadlock + detector traverses the lock table, detects deadlocks, and + if it finds one, marks one of the participating transac- + tions for abort and then returns. + + The flags value is specified by oorr'ing together one or + more of the following values: + + + + DB_LOCK_CONFLICT + Only run the deadlock detector if a lock conflict has + occurred since the last time that the deadlock detec- + tor was run. + + The _a_t_y_p_e parameter specifies which transaction to abort + in the case of deadlock. It must be set to one of values + described above for the _l_k___d_e_t_e_c_t field of the _D_b_E_n_v + object. + + The _D_b_L_o_c_k_T_a_b_:_:_d_e_t_e_c_t method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + The _D_b_L_o_c_k_T_a_b_:_:_d_e_t_e_c_t method is based on the C _l_o_c_k___d_e_t_e_c_t + function, which is the underlying function used by the + _d_b___d_e_a_d_l_o_c_k(1) utility. See the source code for the + _d_b___d_e_a_d_l_o_c_k utility for an example of using _l_o_c_k___d_e_t_e_c_t in + a UNIX environment. + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _d_b___l_o_c_k: + + DB_HOME + If the _d_b_e_n_v argument to _D_b_L_o_c_k_T_a_b_:_:_o_p_e_n was initial- + ized using _d_b___a_p_p_i_n_i_t, the environment variable + DB_HOME may be used as the path of the database home + for the interpretation of the _d_i_r argument to _D_b_L_o_c_k_- + _T_a_b_:_:_o_p_e_n, as described in _d_b___a_p_p_i_n_i_t(3). + + TMPDIR + If the _d_b_e_n_v argument to _D_b_L_o_c_k_T_a_b_:_:_o_p_e_n was NULL or + not initialized using _d_b___a_p_p_i_n_i_t, the environment + variable TMPDIR may be used as the directory in which + to create the lock table, as described in the _D_b_L_o_c_k_- + _T_a_b_:_:_o_p_e_n section above. + +SSTTAANNDDAARRDD LLOOCCKK MMOODDEESS + The include file declares two commonly used + conflict arrays: + + const u_int8_t db_lock_rw_conflicts[]; + This is a conflict array for a simple scheme using + shared and exclusive lock modes. + + const u_int8_t db_lock_riw_conflicts[]; + This is a conflict array that involves various intent + lock modes (e.g., intent shared) that are used for + multigranularity locking. + + Their associated sizes are DB_LOCK_RW_N and DB_LOCK_RIW_N. + + + In addition, the include file defines the type + _d_b___l_o_c_k_m_o_d_e___t, which is the type of the lock modes used + with the standard tables above: + + + DB_LOCK_NG + not granted (always 0) + + + DB_LOCK_READ + read (shared) + + + DB_LOCK_WRITE + write (exclusive) + +EERRRROORRSS + Methods marked as returning _e_r_r_n_o will, by default, throw + an exception that encapsulates the error information. The + default error behavior can be changed, see _D_b_E_x_c_e_p_t_i_o_n(3). + + The _D_b_L_o_c_k_T_a_b_:_:_o_p_e_n method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DbLock::unlink(3), + close(2), db_version(3), fcntl(2), fflush(3), lseek(2), + malloc(3), memcpy(3), memset(3), mmap(2), munmap(2), + open(2), sigfillset(3), sigprocmask(2), stat(2), str- + cpy(3), strdup(3), strerror(3), strlen(3), unlink(2), and + write(2). + + In addition, the _D_b_L_o_c_k_T_a_b_:_:_o_p_e_n method may fail and throw + a _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [EAGAIN] + The shared memory region was locked and (repeatedly) + unavailable. + + [EINVAL] + An invalid flag value or parameter was specified. + + The DB_THREAD flag was specified and spinlocks are + not implemented for this architecture. + + + The _D_b_L_o_c_k_T_a_b_:_:_v_e_c method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DbLock::detect(3), + fcntl(2), fflush(3), lseek(2), memcpy(3), memset(3), + mmap(2), munmap(2), strerror(3), and write(2). + + In addition, the _D_b_L_o_c_k_T_a_b_:_:_v_e_c method may fail and throw + a _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [EACCES] + An attempt was made to release lock held by another + locker. + + [EINVAL] + An invalid flag value or parameter was specified. + + The _D_b_L_o_c_k_T_a_b_:_:_g_e_t method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DbLock::detect(3), + fcntl(2), fflush(3), lseek(2), memcpy(3), memset(3), + mmap(2), munmap(2), strerror(3), and write(2). + + In addition, the _D_b_L_o_c_k_T_a_b_:_:_g_e_t method may fail and throw + a _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The _D_b_L_o_c_k_T_a_b_:_:_c_l_o_s_e method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: close(2), fcntl(2), + fflush(3), munmap(2), and strerror(3). + + The _D_b_L_o_c_k_T_a_b_:_:_u_n_l_i_n_k method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: close(2), fcntl(2), + fflush(3), malloc(3), memcpy(3), memset(3), mmap(2), mun- + map(2), open(2), sigfillset(3), sigprocmask(2), stat(2), + strcpy(3), strdup(3), strerror(3), strlen(3), and + unlink(2). + + In addition, the _D_b_L_o_c_k_T_a_b_:_:_u_n_l_i_n_k method may fail and + throw a _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following + conditions: + + [EBUSY] + The shared memory region was in use and the force + flag was not set. + + The _D_b_L_o_c_k_T_a_b_:_:_d_e_t_e_c_t method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: calloc(3), fcntl(2), + fflush(3), lseek(2), malloc(3), memcpy(3), memset(3), + mmap(2), munmap(2), strerror(3), and write(2). + +BBUUGGSS + If a process dies while holding locks, those locks remain + held and are nneevveerr released. In this case, all processes + should exit as quickly as possible, so that _d_b___r_e_c_o_v_e_r can + be run. + +SSEEEE AALLSSOO + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___i_n_t_e_r_n_a_l(3), _d_b___t_h_r_e_a_d(3), _D_b(3), _D_b_c(3), _D_b_E_n_v(3), + _D_b_E_x_c_e_p_t_i_o_n(3), _D_b_I_n_f_o(3), _D_b_L_o_c_k(3), _D_b_L_o_c_k_T_a_b(3), _D_b_L_o_g(3), + _D_b_L_s_n(3), _D_b_M_p_o_o_l(3), _D_b_M_p_o_o_l_F_i_l_e(3), _D_b_t(3), _D_b_T_x_n(3), + _D_b_T_x_n_M_g_r(3) diff --git a/mozilla/db/man/mancxx.text/DbLog.0 b/mozilla/db/man/mancxx.text/DbLog.0 new file mode 100644 index 00000000000..45dd9d87180 --- /dev/null +++ b/mozilla/db/man/mancxx.text/DbLog.0 @@ -0,0 +1,790 @@ + + +NNAAMMEE + DbLog - log management class + +SSYYNNOOPPSSIISS + ##iinncclluuddee <> + + ssttaattiicc iinntt + DDbbLLoogg::::ooppeenn((ccoonnsstt cchhaarr **ddiirr,, + uu__iinntt3322__tt ffllaaggss,, iinntt mmooddee,, DDbbEEnnvv **ddbbeennvv,, DDbbLLoogg ****rreeggiioonnpp));; + + iinntt + DDbbLLoogg::::cclloossee(());; + + iinntt + DDbbLLoogg::::fflluusshh((ccoonnsstt DDbbLLssnn **llssnn));; + + iinntt + DDbbLLoogg::::ggeett((DDbbLLssnn **llssnn,, DDbbtt **ddaattaa,, uu__iinntt3322__tt ffllaaggss));; + + ssttaattiicc iinntt + DDbbLLoogg::::ccoommppaarree((ccoonnsstt DDbbLLssnn **llssnn00,, ccoonnsstt DDbbLLssnn **llssnn11));; + + iinntt + DDbbLLoogg::::ffiillee((ccoonnsstt DDbbLLssnn **llssnn,, cchhaarr **nnaammeepp,, ssiizzee__tt lleenn));; + + iinntt + DDbbLLoogg::::ppuutt((DDbbLLssnn **llssnn,, ccoonnsstt DDbbtt **ddaattaa,, uu__iinntt3322__tt ffllaaggss));; + + ssttaattiicc iinntt + DDbbLLoogg::::uunnlliinnkk((ccoonnsstt cchhaarr **ddiirr,, iinntt ffoorrccee,, DDbbEEnnvv **));; + + iinntt + DDbbLLoogg::::aarrcchhiivvee((cchhaarr ****lliisstt[[]],, + uu__iinntt3322__tt ffllaaggss,, vvooiidd **((**ddbb__mmaalllloocc))((ssiizzee__tt))));; + + iinntt + DDbbLLoogg::::ddbb__rreeggiisstteerr((ccoonnsstt DDbb **ddbbpp,, + ccoonnsstt cchhaarr **nnaammee,, DDBBTTYYPPEE ttyyppee,, uu__iinntt3322__tt **ffiiddpp));; + + iinntt + DDbbLLoogg::::ddbb__uunnrreeggiisstteerr((uu__iinntt3322__tt ffiidd));; + + iinntt + DDbbLLoogg::::ssttaatt((DDBB__LLOOGG__SSTTAATT ****sspppp,, vvooiidd **((**ddbb__mmaalllloocc))((ssiizzee__tt))));; + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of classes that provides a mod- + ular programming interface to transactions and record-ori- + ented file access. The library includes support for + transactions, locking, logging and file page caching, as + well as various indexed access methods. Many of the + classes (e.g., the file page caching class) are useful + independent of the other DB classes, although some classes + are explicitly based on other classes (e.g., transactions + and logging). For a general description of the DB pack- + age, see _d_b___i_n_t_r_o(3). + + This manual page describes the specific details of the log + class. + + This class provide a general-purpose logging facility suf- + ficient for transaction management. Logs can be shared by + multiple processes. + + The DB transaction log is represented by a directory con- + taining a set of files. The log is a record-oriented, + append-only file, with records identified and accessed via + _D_b_L_s_n's (database log sequence numbers). + + DbLsn's are returned on each _D_b_L_o_g_:_:_p_u_t operation, and + only those DbLsn's returned by _D_b_L_o_g_:_:_p_u_t can later be + used to retrieve records from the log. + + _D_b_L_o_g_:_:_o_p_e_n + The _D_b_L_o_g_:_:_o_p_e_n method copies a pointer, to the log iden- + tified by the ddiirreeccttoorryy _d_i_r, into the memory location ref- + erenced by _r_e_g_i_o_n_p. + + If the _d_b_e_n_v argument to _D_b_L_o_g_:_:_o_p_e_n was initialized using + _D_b_E_n_v_:_:_a_p_p_i_n_i_t, _d_i_r is interpreted as described by + _D_b_E_n_v(3). + + Otherwise, if _d_i_r is not NULL, it is interpreted relative + to the current working directory of the process. If _d_i_r + is NULL, the following environment variables are checked + in order: ``TMPDIR'', ``TEMP'', and ``TMP''. If one of + them is set, log files are created relative to the direc- + tory it specifies. If none of them are set, the first + possible one of the following directories is used: + _/_v_a_r_/_t_m_p, _/_u_s_r_/_t_m_p, _/_t_e_m_p, _/_t_m_p, _C_:_/_t_e_m_p and _C_:_/_t_m_p. + + All files associated with the log are created in this + directory. This directory must already exist when + DbLog::open is called. If the log already exists, the + process must have permission to read and write the exist- + ing files. If the log does not already exist, it is + optionally created and initialized. + + If the log region is being created and log files are + already present, the log files are ``recovered'' and sub- + sequent log writes are appended to the end of the log. + + The log is stored in one or more files in the specified + directory. Each file is named using the format + + log.NNNNN + + where ``NNNNN'' is the sequence number of the file within + the log. + + The _f_l_a_g_s and _m_o_d_e arguments specify how files will be + opened and/or created when they don't already exist. The + flags value is specified by oorr'ing together one or more of + the following values: + + DB_CREATE + Create any underlying files, as necessary. If the + files do not already exist and the DB_CREATE flag is + not specified, the call will fail. + + + DB_THREAD + Cause the DbLog handle returned by the _D_b_L_o_g_:_:_o_p_e_n + method to be useable by multiple threads within a + single address space, i.e., to be ``free-threaded''. + + All files created by the log subsystem are created with + mode _m_o_d_e (as described in _c_h_m_o_d(2)) and modified by the + process' umask value at the time of creation (see + _u_m_a_s_k(2)). The group ownership of created files is based + on the system and directory defaults, and is not further + specified by DB. + + The logging subsystem is configured based on which set + methods have been used. It is expected that applications + will use a single DbEnv object as the argument to all of + the subsystems in the DB package. The fields of the DbEnv + object used by _D_b_L_o_g_:_:_o_p_e_n are described below. As refer- + ences to the DbEnv object may be maintained by + _D_b_L_o_g_:_:_o_p_e_n, it is necessary that the DbEnv object and + memory it references be valid until the object is + destroyed. Any of the DbEnv fields that are not explic- + itly set will default to appropriate values. + + The following fields in the DbEnv object may be initial- + ized, using the appropriate set method, before calling + _D_b_L_o_g_:_:_o_p_e_n: + + + void *(*db_errcall)(char *db_errpfx, char *buffer); + FILE *db_errfile; + const char *db_errpfx; + class ostream *db_error_stream; + int db_verbose; + The error fields of the DbEnv behave as described for + _D_b_E_n_v(3). + + u_int32_t lg_max; + The maximum size of a single file in the log. + Because DbLsn file offsets are unsigned 4-byte val- + ues, _l_g___m_a_x may not be larger than the maximum + unsigned 4-byte value. + + If _l_g___m_a_x is 0, a default value is used. + + See the section "LOG FILE LIMITS" below, for further + information. + + The _D_b_L_o_g_:_:_o_p_e_n method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or returns + the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_L_o_g_:_:_c_l_o_s_e + The _D_b_L_o_g_:_:_c_l_o_s_e method closes the log associated with the + DbLog object. + + In addition, if the _d_i_r argument to _D_b_L_o_g_:_:_o_p_e_n was NULL + and _d_b_e_n_v was not initialized using _D_b_E_n_v_:_:_a_p_p_i_n_i_t, all + files created for this shared region will be removed, as + if _D_b_L_o_g_:_:_u_n_l_i_n_k were called. + + When multiple threads are using the DbLog handle concur- + rently, only a single thread may call the _D_b_L_o_g_:_:_c_l_o_s_e + method. + + The _D_b_L_o_g_:_:_c_l_o_s_e method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or returns + the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_L_o_g_:_:_f_l_u_s_h + The _D_b_L_o_g_:_:_f_l_u_s_h method guarantees that all log records + whose DbLsns are less than or equal to the _l_s_n parameter + have been written to disk. If _l_s_n is NULL, all records in + the log are flushed. + + The _D_b_L_o_g_:_:_f_l_u_s_h method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or returns + the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_L_o_g_:_:_g_e_t + The _D_b_L_o_g_:_:_g_e_t method implements a cursor inside of the + log, retrieving records from the log according to the _l_s_n + and _f_l_a_g_s parameters. + + The data field of the _d_a_t_a object is set to the record + retrieved and the size field indicates the number of bytes + in the record. See _D_b_t(3) for a description of other + fields in the _d_a_t_a object. WWhheenn mmuullttiippllee tthhrreeaaddss aarree + uussiinngg tthhee rreettuurrnneedd DDbbLLoogg hhaannddllee ccoonnccuurrrreennttllyy,, eeiitthheerr tthhee + DDBB__DDBBTT__MMAALLLLOOCC oorr DDBB__DDBBTT__UUSSEERRMMEEMM ffllaaggss mmuusstt bbee ssppeecciiffiieedd + ffoorr aannyy DDbbtt uusseedd ffoorr ddaattaa rreettrriieevvaall.. + + The _f_l_a_g_s parameter must be set to exactly one of the fol- + lowing values: + + + DB_CHECKPOINT + The last record written with the DB_CHECKPOINT flag + specified to the _D_b_L_o_g_:_:_p_u_t method is returned in the + _d_a_t_a argument. The _l_s_n argument is overwritten with + the DbLsn of the record returned. If no record has + been previously written with the DB_CHECKPOINT flag + specified, the first record in the log is returned. + + If the log is empty the _D_b_L_o_g_:_:_g_e_t method will return + DB_NOTFOUND. + + + DB_FIRST + The first record from any of the log files found in + the log directory is returned in the _d_a_t_a argument. + The _l_s_n argument is overwritten with the DbLsn of the + record returned. + + If the log is empty the _D_b_L_o_g_:_:_g_e_t method will return + DB_NOTFOUND. + + + DB_LAST + The last record in the log is returned in the _d_a_t_a + argument. The _l_s_n argument is overwritten with the + DbLsn of the record returned. + + If the log is empty, the _D_b_L_o_g_:_:_g_e_t method will + return DB_NOTFOUND. + + + DB_NEXT + The current log position is advanced to the next + record in the log and that record is returned in the + _d_a_t_a argument. The _l_s_n argument is overwritten with + the DbLsn of the record returned. + + If the pointer has not been initialized via DB_FIRST, + DB_LAST, DB_SET, DB_NEXT, or DB_PREV, _D_b_L_o_g_:_:_g_e_t will + return the first record in the log. If the last log + record has already been returned or the log is empty, + the _D_b_L_o_g_:_:_g_e_t method will return DB_NOTFOUND. + + If the log was opened with the DB_THREAD flag set, + calls to _D_b_L_o_g_:_:_g_e_t with the DB_NEXT flag set will + return EINVAL. + + + DB_PREV + The current log position is moved to the previous + record in the log and that record is returned in the + _d_a_t_a argument. The _l_s_n argument is overwritten with + the DbLsn of the record returned. + + If the pointer has not been initialized via DB_FIRST, + DB_LAST, DB_SET, DB_NEXT, or DB_PREV, _D_b_L_o_g_:_:_g_e_t will + return the last record in the log. If the first log + record has already been returned or the log is empty, + the _D_b_L_o_g_:_:_g_e_t method will return DB_NOTFOUND. + + If the log was opened with the DB_THREAD flag set, + calls to _D_b_L_o_g_:_:_g_e_t with the DB_PREV flag set will + return EINVAL. + + + DB_CURRENT + Return the log record currently referenced by the + log. + + If the log pointer has not been initialized via + DB_FIRST, DB_LAST, DB_SET, DB_NEXT, or DB_PREV, or if + the log was opened with the DB_THREAD flag set, + _D_b_L_o_g_:_:_g_e_t will return EINVAL. + + DB_SET + Retrieve the record specified by the _l_s_n argument. + If the specified DbLsn is invalid (e.g., does not + appear in the log) _D_b_L_o_g_:_:_g_e_t will return EINVAL. + + Otherwise, the _D_b_L_o_g_:_:_g_e_t method throws a _D_b_E_x_c_e_p_t_i_o_n(3) + or returns the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_L_o_g_:_:_c_o_m_p_a_r_e + The _D_b_L_o_g_:_:_c_o_m_p_a_r_e method allows the caller to compare two + DbLsn's. _D_b_L_o_g_:_:_c_o_m_p_a_r_e returns 0 if the two DbLsn's are + equal, 1 if _l_s_n_0 is greater than _l_s_n_1, and -1 if _l_s_n_0 is + less than _l_s_n_1. + + _D_b_L_o_g_:_:_f_i_l_e + The _D_b_L_o_g_:_:_f_i_l_e method maps DbLsn's to file names. The + _D_b_L_o_g_:_:_f_i_l_e method copies the name of the file containing + the record named by _l_s_n into the memory location refer- + enced by _n_a_m_e_p. (This mapping of DbLsn to file is needed + for database administration. For example, a transaction + manager typically records the earliest DbLsn needed for + restart, and the database administrator may want to + archive log files to tape when they contain only DbLsn's + before the earliest one needed for restart.) + + The _l_e_n argument is the length of the _n_a_m_e_p buffer in + bytes. If _n_a_m_e_p is too short to hold the file name, + _D_b_L_o_g_:_:_f_i_l_e will return ENOMEM. Note, as described above, + log file names are quite short, on the order of 10 charac- + ters. + + The _D_b_L_o_g_:_:_f_i_l_e method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or returns + the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_L_o_g_:_:_p_u_t + The _D_b_L_o_g_:_:_p_u_t method appends records to the log. The + DbLsn of the put record is returned in the _l_s_n parameter. + The _f_l_a_g_s parameter may be set to one of the following + values: + + + DB_CHECKPOINT + + The log should write a checkpoint record, recording + any information necessary to make the log structures + recoverable after a crash. + + + DB_CURLSN + The DB_LSN of the next record to be put is returned + in the _l_s_n parameter. + + + DB_FLUSH + The log is forced to disk after this record is writ- + ten, guaranteeing that all records with DbLsns less + than or equal to the one being put are on disk before + this method returns (this function is most often used + for a transaction commit, see _D_b_:_:_T_x_n in Db (3)). + + The caller is responsible for providing any necessary + structure to _d_a_t_a. (For example, in a write-ahead logging + protocol, the application must understand what part of + _d_a_t_a is an operation code, what part is redo information, + and what part is undo information. In addition, most + transaction managers will store in _d_a_t_a the DbLsn of the + previous log record for the same transaction, to support + chaining back through the transaction's log records during + undo.) + + The _D_b_L_o_g_:_:_p_u_t method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or returns + the value of _e_r_r_n_o on failure and 0 on success. + + + _D_b_L_o_g_:_:_u_n_l_i_n_k + The _D_b_L_o_g_:_:_u_n_l_i_n_k method destroys the log region identi- + fied by the directory _d_i_r, removing all files used to + implement the log region. (The directory _d_i_r is not + removed.) If there are processes that have called + _D_b_L_o_g_:_:_o_p_e_n without calling _D_b_L_o_g_:_:_c_l_o_s_e (i.e., there are + processes currently using the log region), _D_b_L_o_g_:_:_u_n_l_i_n_k + will fail without further action, unless the force flag is + set, in which case _D_b_L_o_g_:_:_u_n_l_i_n_k will attempt to remove + the log region files regardless of any processes still + using the log region. + + The result of attempting to forcibly destroy the region + when a process has the region open is unspecified. Pro- + cesses using a shared memory region maintain an open file + descriptor for it. On UNIX systems, the region removal + should succeed and processes that have already joined the + region should continue to run in the region without + change, however processes attempting to join the log + region will either fail or attempt to create a new region. + On other systems, e.g., WNT, where the _u_n_l_i_n_k(2) system + call will fail if any process has an open file descriptor + for the file, the region removal will fail. + + In the case of catastrophic or system failure, database + recovery must be performed (see _d_b___r_e_c_o_v_e_r(1) or the + DB_RECOVER and DB_RECOVER_FATAL flags to + _D_b_E_n_v_:_:_a_p_p_i_n_i_t(3)). Alternatively, if recovery is not + required because no database state is maintained across + failures, it is possible to clean up a log region by + removing all of the files in the directory specified to + the _D_b_L_o_g_:_:_o_p_e_n method, as log region files are never cre- + ated in any directory other than the one specified to + _D_b_L_o_g_:_:_o_p_e_n. Note, however, that this has the potential + to remove files created by the other DB subsystems in this + database environment. + + The _D_b_L_o_g_:_:_u_n_l_i_n_k method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_L_o_g_:_:_a_r_c_h_i_v_e + The _D_b_L_o_g_:_:_a_r_c_h_i_v_e method creates a NULL-terminated array + of log or database file names and copies a pointer to them + into the user-specified memory location _l_i_s_t. + + By default, _D_b_L_o_g_:_:_a_r_c_h_i_v_e returns the names of all of the + log files that are no longer in use (e.g., no longer + involved in active transactions), and that may be archived + for catastrophic recovery and then removed from the sys- + tem. If there were no file names to return, _l_i_s_t will be + set to NULL. + + Arrays of log file names are created in allocated memory. + If _d_b___m_a_l_l_o_c is non-NULL, it is called to allocate the + memory, otherwise, the library function _m_a_l_l_o_c(3) is used. + The function _d_b___m_a_l_l_o_c must match the calling conventions + of the _m_a_l_l_o_c(3) library routine. Regardless, the caller + is responsible for deallocating the returned memory. To + deallocate the returned memory, free each returned memory + pointer; pointers inside the memory do not need to be + individually freed. + + The _f_l_a_g_s argument is specified by oorr'ing together one or + more of the following values: + + + DB_ARCH_ABS + All pathnames are returned as absolute pathnames, + instead of relative to the database home directory. + + + DB_ARCH_DATA + Return the database files that need to be archived in + order to recover the database from catastrophic fail- + ure. If any of the database files have not been + accessed during the lifetime of the current log + files, _D_b_L_o_g_:_:_a_r_c_h_i_v_e will not include them in this + list. It is also possible that some of the files + referenced in the log have since been deleted from + the system. + + + DB_ARCH_LOG + Return all the log file names regardless of whether + or not they are in use. + + The DB_ARCH_DATA and DB_ARCH_LOG flags are mutually exclu- + sive. + + The _D_b_L_o_g_:_:_a_r_c_h_i_v_e method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + The _D_b_L_o_g_:_:_a_r_c_h_i_v_e method is based on the C _l_o_g___a_r_c_h_i_v_e + function, which is the underlying function used by the + _d_b___a_r_c_h_i_v_e(1) utility. See the source code for the + _d_b___a_r_c_h_i_v_e utility for an example of using _l_o_g___a_r_c_h_i_v_e in + a UNIX environment. See the _d_b___a_r_c_h_i_v_e(1) manual page for + more information on database archival procedures. + + _D_b_L_o_g_:_:_d_b___r_e_g_i_s_t_e_r + The _D_b_L_o_g_:_:_d_b___r_e_g_i_s_t_e_r method registers a file name with + the log manager and copies a file identification number + into the memory location referenced by _f_i_d_p. This file + identification number should be used in all subsequent log + messages that refer to operations on this file. The log + manager records all file name to file identification num- + ber mappings at each checkpoint so that a recovery process + can identify the file to which a record in the log refers. + + The _D_b_L_o_g_:_:_d_b___r_e_g_i_s_t_e_r method is called when an access + method registers the open of a file. The _d_b_p parameter + should be a pointer to the Db object which is being + returned by the access method. + + The _t_y_p_e parameter should be one of the Db types specified + in _D_b_:_:_o_p_e_n _(_s_e_eDb_(_3_)_)_, e.g., DB_HASH. + + The _D_b_L_o_g_:_:_d_b___r_e_g_i_s_t_e_r method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_L_o_g_:_:_d_b___u_n_r_e_g_i_s_t_e_r + The _D_b_L_o_g_:_:_d_b___u_n_r_e_g_i_s_t_e_r method disassociates the file + name to file identification number mapping for the file + identification number specified by the _f_i_d parameter. The + file identification number may then be reused. + + The _D_b_L_o_g_:_:_d_b___u_n_r_e_g_i_s_t_e_r method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_L_o_g_:_:_s_t_a_t + The _D_b_L_o_g_:_:_s_t_a_t function creates a statistical structure + and copies a pointer to it into the user-specified memory + location. + + Statistical structures are created in allocated memory. + If _d_b___m_a_l_l_o_c is non-NULL, it is called to allocate the + memory, otherwise, the library function _m_a_l_l_o_c(3) is used. + The function _d_b___m_a_l_l_o_c must match the calling conventions + of the _m_a_l_l_o_c(3) library routine. Regardless, the caller + is responsible for deallocating the returned memory. To + deallocate the returned memory, free each returned memory + pointer; pointers inside the memory do not need to be + individually freed. The log statistics are stored in a + structure of type DB_LOG_STAT (typedef'd in ). The + following DB_LOG_STAT fields will be filled in: + + u_int32_t st_magic; + The magic number that identifies a file as a log + file. + u_int32_t st_version; + The version of the log file type. + u_int32_t st_refcnt; + The number of references to the region. + u_int32_t st_regsize; + The size of the region. + u_int32_t st_mode; + The mode of any created log files. + u_int32_t st_lg_max; + The maximum size of any individual file comprising + the log. + u_int32_t st_written; + The total number of bytes written to this log. + u_int32_t st_written_chkpt; + The number of bytes written since the last check- + point. + u_int32_t st_region_wait; + The number of times that a process was able to obtain + the region lock without waiting. + u_int32_t st_region_nowait; + The number of times that a process was forced to wait + before obtaining the region lock. + +LLOOGG FFIILLEE LLIIMMIITTSS + Log file sizes impose a time limit on the length of time a + database may be accessed under transaction protection, + before it needs to be dumped and reloaded (see _d_b___d_u_m_p_(_3_) + and _d_b___l_o_a_d_(_3_)_)_. Unfortunately, the limits are poten- + tially difficult to calculate. + + The log file name consists of "log." followed by 5 digits, + resulting in a maximum of 99,999 log files. Consider an + application performing 600 transactions per second, for 15 + hours a day, logged into 10Mb log files, where each trans- + action is logging approximately 100 bytes of data. The + calculation: + + (10 * 2^20 * 99999) / + (600 * 60 * 60 * 15 * 100) = 323.63 + + indicates that the system will run out of log file space + in roughly 324 days. If we increase the maximum size of + the files from 10Mb to 100Mb, the same calculation indi- + cates that the application will run out of log file space + in roughly 9 years. + + There is no way to reset the log file name space in Berke- + ley DB. If your application is reaching the end of its + log file name space, you should: + + 1. Archive your databases as if to prepare for catas- + trophic failure (see _d_b___a_r_c_h_i_v_e(1) for more informa- + tion). + + 2. Dump and re-load aallll your databases (see _d_b___d_u_m_p(1) + and _d_b___l_o_a_d(1) for more information). + + 3. Remove all of the log files from the database envi- + ronment (see _d_b___a_r_c_h_i_v_e(1) for more information). + + 4. Restart your applications. + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _d_b___l_o_g: + + DB_HOME + If the _d_b_e_n_v argument to _D_b_L_o_g_:_:_o_p_e_n was initialized + using _d_b___a_p_p_i_n_i_t, the environment variable DB_HOME + may be used as the path of the database home for the + interpretation of the _d_i_r argument to _D_b_L_o_g_:_:_o_p_e_n, as + described in _d_b___a_p_p_i_n_i_t(3). Specifically, + _D_b_L_o_g_:_:_o_p_e_n is affected by the configuration string + value of DB_LOG_DIR. + + TMPDIR + If the _d_b_e_n_v argument to _D_b_L_o_g_:_:_o_p_e_n was NULL or not + initialized using _d_b___a_p_p_i_n_i_t, the environment vari- + able TMPDIR may be used as the directory in which to + create the log, as described in the _D_b_L_o_g_:_:_o_p_e_n sec- + tion above. + +EERRRROORRSS + Methods marked as returning _e_r_r_n_o will, by default, throw + an exception that encapsulates the error information. The + default error behavior can be changed, see _D_b_E_x_c_e_p_t_i_o_n(3). + + The _D_b_L_o_g_:_:_o_p_e_n method may fail and throw a _D_b_E_x_c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DbLog::close(3), + + DbLog::unlink(3), atoi(3), close(2), db_version(3), + fcntl(2), fflush(3), lseek(2), malloc(3), memcpy(3), mem- + set(3), mmap(2), munmap(2), open(2), opendir(3), read(2), + readdir(3), realloc(3), sigfillset(3), sigprocmask(2), + stat(2), strchr(3), strcpy(3), strdup(3), strerror(3), + strlen(3), strncmp(3), unlink(2), and write(2). + + In addition, the _D_b_L_o_g_:_:_o_p_e_n method may fail and throw a + _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [EAGAIN] + The shared memory region was locked and (repeatedly) + unavailable. + + [EINVAL] + An invalid flag value or parameter was specified. + + The DB_THREAD flag was specified and spinlocks are + not implemented for this architecture. + + The specified file size was too large. + + The _D_b_L_o_g_:_:_c_l_o_s_e method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: close(2), fcntl(2), + fflush(3), munmap(2), and strerror(3). + + The _D_b_L_o_g_:_:_f_l_u_s_h method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: close(2), fcntl(2), + fflush(3), fsync(2), lseek(2), malloc(3), memcpy(3), mem- + set(3), open(2), sigfillset(3), sigprocmask(2), stat(2), + strcpy(3), strdup(3), strerror(3), strlen(3), unlink(2), + and write(2). + + In addition, the _D_b_L_o_g_:_:_f_l_u_s_h method may fail and throw a + _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The _D_b_L_o_g_:_:_g_e_t method may fail and throw a _D_b_E_x_c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: atoi(3), close(2), + fcntl(2), fflush(3), lseek(2), malloc(3), memcpy(3), mem- + set(3), open(2), opendir(3), read(2), readdir(3), real- + loc(3), sigfillset(3), sigprocmask(2), stat(2), strchr(3), + strcpy(3), strdup(3), strerror(3), strlen(3), strncmp(3), + and unlink(2). + + In addition, the _D_b_L_o_g_:_:_g_e_t method may fail and throw a + _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The DB_FIRST flag was specified and no log files were + found. + + The _D_b_L_o_g_:_:_f_i_l_e method may fail and throw a _D_b_E_x_c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: close(2), fcntl(2), + fflush(3), malloc(3), memcpy(3), memset(3), open(2), sig- + fillset(3), sigprocmask(2), stat(2), strcpy(3), strdup(3), + strerror(3), strlen(3), and unlink(2). + + In addition, the _D_b_L_o_g_:_:_f_i_l_e method may fail and throw a + _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [ENOMEM] + The supplied buffer was too small to hold the log + file name. + + The _D_b_L_o_g_:_:_p_u_t method may fail and throw a _D_b_E_x_c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: close(2), fcntl(2), + fflush(3), fsync(2), lseek(2), malloc(3), memcpy(3), mem- + set(3), open(2), sigfillset(3), sigprocmask(2), stat(2), + strcpy(3), strdup(3), strerror(3), strlen(3), time(3), + unlink(2), and write(2). + + In addition, the _D_b_L_o_g_:_:_p_u_t method may fail and throw a + _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The record to be logged is larger than the maximum + log record. + + The _D_b_L_o_g_:_:_u_n_l_i_n_k method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: close(2), fcntl(2), + fflush(3), malloc(3), memcpy(3), memset(3), mmap(2), + munmap(2), open(2), sigfillset(3), sigprocmask(2), + stat(2), strcpy(3), strdup(3), strerror(3), strlen(3), and + unlink(2). + + In addition, the _D_b_L_o_g_:_:_u_n_l_i_n_k method may fail and throw a + _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [EBUSY] + The shared memory region was in use and the force + flag was not set. + + The _D_b_L_o_g_:_:_a_r_c_h_i_v_e method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DbLog::compare(3), + DbLog::get(3), close(2), fcntl(2), fflush(3), getcwd(3), + malloc(3), memcpy(3), memset(3), open(2), qsort(3), real- + loc(3), sigfillset(3), sigprocmask(2), stat(2), strchr(3), + strcmp(3), strcpy(3), strdup(3), strerror(3), strlen(3), + and unlink(2). + + In addition, the _D_b_L_o_g_:_:_a_r_c_h_i_v_e method may fail and throw + a _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The log was corrupted. + + The _D_b_L_o_g_:_:_d_b___r_e_g_i_s_t_e_r method may fail and throw a _D_b_E_x_- + _c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: close(2), fcntl(2), + fflush(3), fsync(2), lseek(2), malloc(3), memcmp(3), mem- + cpy(3), memset(3), open(2), realloc(3), sigfillset(3), + sigprocmask(2), stat(2), strcpy(3), strdup(3), str- + error(3), strlen(3), time(3), unlink(2), and write(2). + + In addition, the _D_b_L_o_g_:_:_d_b___r_e_g_i_s_t_e_r method may fail and + throw a _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following + conditions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The _D_b_L_o_g_:_:_d_b___u_n_r_e_g_i_s_t_e_r method may fail and throw a _D_b_E_x_- + _c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: close(2), fcntl(2), + fflush(3), fsync(2), lseek(2), malloc(3), memcpy(3), mem- + set(3), open(2), sigfillset(3), sigprocmask(2), stat(2), + strcpy(3), strdup(3), strerror(3), strlen(3), time(3), + unlink(2), and write(2). + + In addition, the _D_b_L_o_g_:_:_d_b___u_n_r_e_g_i_s_t_e_r method may fail and + throw a _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following + conditions: + + [EINVAL] + An invalid flag value or parameter was specified. + +BBUUGGSS + The log files are not machine architecture independent. + Specifically, their metadata are not stored in a fixed + byte order. + +SSEEEE AALLSSOO + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___i_n_t_e_r_n_a_l(3), _d_b___t_h_r_e_a_d(3), _D_b(3), _D_b_c(3), _D_b_E_n_v(3), + _D_b_E_x_c_e_p_t_i_o_n(3), _D_b_I_n_f_o(3), _D_b_L_o_c_k(3), _D_b_L_o_c_k_T_a_b(3), _D_b_L_o_g(3), + _D_b_L_s_n(3), _D_b_M_p_o_o_l(3), _D_b_M_p_o_o_l_F_i_l_e(3), _D_b_t(3), _D_b_T_x_n(3), + _D_b_T_x_n_M_g_r(3) diff --git a/mozilla/db/man/mancxx.text/DbLsn.0 b/mozilla/db/man/mancxx.text/DbLsn.0 new file mode 100644 index 00000000000..6b53ce8fc11 --- /dev/null +++ b/mozilla/db/man/mancxx.text/DbLsn.0 @@ -0,0 +1,36 @@ + + +NNAAMMEE + DbLsn - Log sequence numbers + +SSYYNNOOPPSSIISS + ##iinncclluuddee <> + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of classes that provides a mod- + ular programming interface to transactions and record-ori- + ented file access. The library includes support for + transactions, locking, logging and file page caching, as + well as various indexed access methods. Many of the + classes (e.g., the file page caching class) are useful + independent of the other DB classes, although some classes + are explicitly based on other classes (e.g., transactions + and logging). For a general description of the DB pack- + age, see _d_b___i_n_t_r_o(3). + + This manual page describes the DbLsn class. + + A DbLsn is a "log sequence number" that is fully encapsu- + lated. The class itself has no methods, other than a + default constructor, so there is no way for the user to + manipulate its data directly. It is initialized and used + by methods in _D_b_L_o_g(3) and _D_b_M_p_o_o_l(3). These methods + always accept a pointer to a DbLsn. + +SSEEEE AALLSSOO + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___i_n_t_e_r_n_a_l(3), _d_b___t_h_r_e_a_d(3), _D_b(3), _D_b_c(3), _D_b_E_n_v(3), + _D_b_E_x_c_e_p_t_i_o_n(3), _D_b_I_n_f_o(3), _D_b_L_o_c_k(3), _D_b_L_o_c_k_T_a_b(3), _D_b_L_o_g(3), + _D_b_L_s_n(3), _D_b_M_p_o_o_l(3), _D_b_M_p_o_o_l_F_i_l_e(3), _D_b_t(3), _D_b_T_x_n(3), + _D_b_T_x_n_M_g_r(3) diff --git a/mozilla/db/man/mancxx.text/DbMpool.0 b/mozilla/db/man/mancxx.text/DbMpool.0 new file mode 100644 index 00000000000..14d10ee09ae --- /dev/null +++ b/mozilla/db/man/mancxx.text/DbMpool.0 @@ -0,0 +1,581 @@ + + +NNAAMMEE + DbMpool - shared memory buffer pool + +SSYYNNOOPPSSIISS + ##iinncclluuddee <> + + ssttaattiicc iinntt + DDbbMMppooooll::::ooppeenn((cchhaarr **ddiirr,, + uu__iinntt3322__tt ffllaaggss,, iinntt mmooddee,, DDbbEEnnvv **ddbbeennvv,, DDbbMMppooooll ****rreeggiioonnpp));; + + iinntt + DDbbMMppooooll::::cclloossee(());; + + ssttaattiicc iinntt + DDbbMMppooooll::::uunnlliinnkk((ccoonnsstt cchhaarr **ddiirr,, iinntt ffoorrccee,, DDbbEEnnvv **));; + + iinntt + DDbbMMppooooll::::ddbb__rreeggiisstteerr((iinntt ffttyyppee,, + iinntt ((**ppggiinn))((ddbb__ppggnnoo__tt ppggnnoo,, vvooiidd **ppggaaddddrr,, DDbbtt **ppggccooookkiiee)),, + iinntt ((**ppggoouutt))((ddbb__ppggnnoo__tt ppggnnoo,, vvooiidd **ppggaaddddrr,, DDbbtt **ppggccooookkiiee))));; + + iinntt + DDbbMMppooooll::::ttrriicckkllee((iinntt ppcctt,, iinntt **nnwwrrootteepp));; + + iinntt + DDbbMMppooooll::::ssyynncc((LLSSNN **llssnn));; + + iinntt + DDbbMMppooooll::::ssttaatt((DDBB__MMPPOOOOLL__SSTTAATT ****ggsspp,, + DDBB__MMPPOOOOLL__FFSSTTAATT **((**ffsspp))[[]],, vvooiidd **((**ddbb__mmaalllloocc))((ssiizzee__tt))));; + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of classes that provides a mod- + ular programming interface to transactions and record-ori- + ented file access. The library includes support for + transactions, locking, logging and file page caching, as + well as various indexed access methods. Many of the + classes (e.g., the file page caching class) are useful + independent of the other DB classes, although some classes + are explicitly based on other classes (e.g., transactions + and logging). For a general description of the DB pack- + age, see _d_b___i_n_t_r_o(3). + + This manual page describes the specific details of the + memory pool interface. + + The _D_b_M_p_o_o_l(3) and _D_b_M_p_o_o_l_F_i_l_e(3) classes are the library + interface intended to provide general-purpose, page-ori- + ented buffer management of one or more files. While + designed to work with the other Db classes, this class is + also useful for more general purposes. The memory pools + (DbMpool's) are referred to in this document as simply + ``pools''. Pools may be shared between processes. Pools + are usually filled by pages from one or more files (DbM- + poolFile's). Pages in the pool are replaced in LRU + (least-recently-used) order, with each new page replacing + the page that has been unused the longest. Pages + retrieved from the pool using _D_b_M_p_o_o_l_F_i_l_e_:_:_g_e_t are + ``pinned'' in the pool, by default, until they are + returned to the pool's control using the _D_b_M_p_o_o_l_F_i_l_e_:_:_p_u_t + method. + + _D_b_M_p_o_o_l_:_:_o_p_e_n + The _D_b_M_p_o_o_l_:_:_o_p_e_n method copies a pointer, to the memory + pool identified by the ddiirreeccttoorryy _d_i_r, into the memory + location referenced by _r_e_g_i_o_n_p. + + If the _d_b_e_n_v argument to _D_b_M_p_o_o_l_:_:_o_p_e_n was initialized + using _D_b_E_n_v_:_:_a_p_p_i_n_i_t, _d_i_r is interpreted as described by + _D_b_E_n_v(3). + + Otherwise, if _d_i_r is not NULL, it is interpreted relative + to the current working directory of the process. If _d_i_r + is NULL, the following environment variables are checked + in order: ``TMPDIR'', ``TEMP'', and ``TMP''. If one of + them is set, memory pool files are created relative to the + directory it specifies. If none of them are set, the + first possible one of the following directories is used: + _/_v_a_r_/_t_m_p, _/_u_s_r_/_t_m_p, _/_t_e_m_p, _/_t_m_p, _C_:_/_t_e_m_p and _C_:_/_t_m_p. + + All files associated with the memory pool are created in + this directory. This directory must already exist when + DbMpool::open is called. If the memory pool already + exists, the process must have permission to read and write + the existing files. If the memory pool does not already + exist, it is optionally created and initialized. + + The _f_l_a_g_s and _m_o_d_e arguments specify how files will be + opened and/or created when they don't already exist. The + flags value is specified by oorr'ing together one or more of + the following values: + + DB_CREATE + Create any underlying files, as necessary. If the + files do not already exist and the DB_CREATE flag is + not specified, the call will fail. + + DB_MPOOL_PRIVATE + Create a private MPOOL that is not shared with any + other process (although it may be shared with other + threads). + + DB_NOMMAP + Always copy files in this memory pool into the local + cache instead of mapping them into process memory + (see the description of the _m_p___m_m_a_p_s_i_z_e field of the + DbEnv object for further information). + + + DB_THREAD + Cause the DbMpool handle returned by the _D_b_M_- + _p_o_o_l_:_:_o_p_e_n method to be useable by multiple threads + within a single address space, i.e., to be ``free- + threaded''. + + All files created by the memory pool subsystem (other than + files created by the _m_e_m_p___f_o_p_e_n method, which are sepa- + rately specified) are created with mode _m_o_d_e (as described + in _c_h_m_o_d(2)) and modified by the process' umask value at + the time of creation (see _u_m_a_s_k(2)). The group ownership + of created files is based on the system and directory + defaults, and is not further specified by DB. + + The memory pool subsystem is configured based on which set + methods have been used. It is expected that applications + will use a single DbEnv object as the argument to all of + the subsystems in the DB package. The fields of the DbEnv + object used by _D_b_M_p_o_o_l_:_:_o_p_e_n are described below. As ref- + erences to the DbEnv object may be maintained by _D_b_M_- + _p_o_o_l_:_:_o_p_e_n, it is necessary that the DbEnv object and mem- + ory it references be valid until the object is destroyed. + Any of the DbEnv fields that are not explicitly set will + default to appropriate values. + + The following fields in the DbEnv object may be initial- + ized, using the appropriate set method, before calling + _D_b_M_p_o_o_l_:_:_o_p_e_n: + + + void *(*db_errcall)(char *db_errpfx, char *buffer); + FILE *db_errfile; + const char *db_errpfx; + class ostream *db_error_stream; + int db_verbose; + The error fields of the DbEnv behave as described for + _D_b_E_n_v(3). + + size_t mp_mmapsize; + Files that are opened read-only in the pool (and that + satisfy a few other criteria) are, by default, mapped + into the process address space instead of being + copied into the local cache. This can result in bet- + ter-than-usual performance, as available virtual mem- + ory is normally much larger than the local cache, and + page faults are faster than page copying on many sys- + tems. However, in the presence of limited virtual + memory it can cause resource starvation, and in the + presence of large databases, it can result in immense + process sizes. If _m_p___m_m_a_p_s_i_z_e is non-zero, it speci- + fies the maximum file size, in bytes, for a file to + be mapped into the process address space. By + default, it is set to 10Mb. + + size_t mp_size; + The suggested size of the pool, in bytes. This + should be the size of the normal working data set of + the application, with some small amount of additional + memory for unusual situations. (Note, the working + set is not the same as the number of simultaneously + referenced pages, and should be quite a bit larger!) + The default cache size is 128K bytes (16 8K byte + pages), and may not be less than 20K bytes. + + The _D_b_M_p_o_o_l_:_:_o_p_e_n method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_M_p_o_o_l_:_:_c_l_o_s_e + The _D_b_M_p_o_o_l_:_:_c_l_o_s_e method closes the pool indicated by the + DbMpool object, as returned by _D_b_M_p_o_o_l_:_:_o_p_e_n. This method + does not imply a call to _D_b_M_p_o_o_l_F_i_l_e_:_:_s_y_n_c, but does imply + a call to _D_b_M_p_o_o_l_F_i_l_e_:_:_c_l_o_s_e for any remaining open DbM- + poolFile objects returned to this process by calls to _D_b_M_- + _p_o_o_l_F_i_l_e_:_:_o_p_e_n. + + In addition, if the _d_i_r argument to _D_b_M_p_o_o_l_:_:_o_p_e_n was NULL + and _d_b_e_n_v was not initialized using _D_b_E_n_v_:_:_a_p_p_i_n_i_t, all + files created for this shared region will be removed, as + if _D_b_M_p_o_o_l_:_:_u_n_l_i_n_k were called. + + When multiple threads are using the DbMpool handle concur- + rently, only a single thread may call the _D_b_M_p_o_o_l_:_:_c_l_o_s_e + method. + + The _D_b_M_p_o_o_l_:_:_c_l_o_s_e method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + + _D_b_M_p_o_o_l_:_:_u_n_l_i_n_k + The _D_b_M_p_o_o_l_:_:_u_n_l_i_n_k method destroys the memory pool iden- + tified by the directory _d_i_r, removing all files used to + implement the memory pool. (The directory _d_i_r is not + removed.) If there are processes that have called _D_b_M_- + _p_o_o_l_:_:_o_p_e_n without calling _D_b_M_p_o_o_l_:_:_c_l_o_s_e (i.e., there are + processes currently using the memory pool), _D_b_M_- + _p_o_o_l_:_:_u_n_l_i_n_k will fail without further action, unless the + force flag is set, in which case _D_b_M_p_o_o_l_:_:_u_n_l_i_n_k will + attempt to remove the memory pool files regardless of any + processes still using the memory pool. + + The result of attempting to forcibly destroy the region + when a process has the region open is unspecified. Pro- + cesses using a shared memory region maintain an open file + descriptor for it. On UNIX systems, the region removal + should succeed and processes that have already joined the + region should continue to run in the region without + change, however processes attempting to join the memory + pool will either fail or attempt to create a new region. + On other systems, e.g., WNT, where the _u_n_l_i_n_k(2) system + call will fail if any process has an open file descriptor + for the file, the region removal will fail. + + In the case of catastrophic or system failure, database + recovery must be performed (see _d_b___r_e_c_o_v_e_r(1) or the + DB_RECOVER and DB_RECOVER_FATAL flags to + _D_b_E_n_v_:_:_a_p_p_i_n_i_t(3)). Alternatively, if recovery is not + required because no database state is maintained across + failures, it is possible to clean up a memory pool by + removing all of the files in the directory specified to + the _D_b_M_p_o_o_l_:_:_o_p_e_n method, as memory pool files are never + created in any directory other than the one specified to + _D_b_M_p_o_o_l_:_:_o_p_e_n. Note, however, that this has the potential + to remove files created by the other DB subsystems in this + database environment. + + The _D_b_M_p_o_o_l_:_:_u_n_l_i_n_k method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_M_p_o_o_l_:_:_d_b___r_e_g_i_s_t_e_r + The _D_b_M_p_o_o_l_:_:_d_b___r_e_g_i_s_t_e_r method registers page-in and + page-out functions for files of type _f_t_y_p_e in the speci- + fied pool. + + If the _p_g_i_n function is non-NULL, it is called each time a + page is read into the memory pool from a file of type + _f_t_y_p_e, or a page is created for a file of type _f_t_y_p_e (see + the DB_MPOOL_CREATE flag for the _D_b_M_p_o_o_l_F_i_l_e_:_:_g_e_t method). + If the _p_g_o_u_t function is non-NULL, it is called each time + a page is written to a file of type _f_t_y_p_e. + + Both the _p_g_i_n and _p_g_o_u_t functions are called with the page + number, a pointer to the page being read or written, and + any argument _p_g_c_o_o_k_i_e that was specified to the _D_b_M_- + _p_o_o_l_F_i_l_e_:_:_o_p_e_n method when the file was opened. The _p_g_i_n + and _p_g_o_u_t functions should return 0 on success, and an + applicable non-zero _e_r_r_n_o value on failure, in which case + the _D_b_M_p_o_o_l method calling it will also fail, returning + that _e_r_r_n_o value. + + The purpose of the _D_b_M_p_o_o_l_:_:_d_b___r_e_g_i_s_t_e_r method is to sup- + port processing when pages are entered into, or flushed + from, the pool. A file type must be specified to make it + possible for unrelated threads or processes, that are + sharing a pool, to evict each other's pages from the pool. + Applications should call _D_b_M_p_o_o_l_:_:_d_b___r_e_g_i_s_t_e_r, during ini- + tialization, for each type of file requiring input or out- + put processing that will be sharing the underlying pool. + (No registry is necessary for the standard access method + types, btree, hash and recno, as _D_b_:_:_o_p_e_n(3) registers + them separately.) + + If a thread or process does not call _D_b_M_p_o_o_l_:_:_d_b___r_e_g_i_s_t_e_r + for a file type, it is impossible for it to evict pages + for any file requiring input or output processing from the + pool. For this reason, _D_b_M_p_o_o_l_:_:_d_b___r_e_g_i_s_t_e_r should always + be called by each application sharing a pool for each type + of file included in the pool, regardless of whether or not + the application itself uses files of that type. + + There are no standard values for _f_t_y_p_e, _p_g_i_n, _p_g_o_u_t and + _p_g_c_o_o_k_i_e, except that the _f_t_y_p_e value for a file must be a + non-zero positive number, as negative numbers are reserved + for internal use by the DB library. For this reason, + applications sharing a pool must coordinate their values + amongst themselves. + + The _D_b_M_p_o_o_l_:_:_d_b___r_e_g_i_s_t_e_r method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_M_p_o_o_l_:_:_t_r_i_c_k_l_e + The _D_b_M_p_o_o_l_:_:_t_r_i_c_k_l_e method ensures that at least _p_c_t per- + cent of the pages in the shared memory pool are clean by + writing dirty pages to their backing files. If the + _n_w_r_o_t_e_p argument is non-NULL, the number of pages that + were written to reach the correct percentage is returned + in the memory location it references. + + The purpose of the _D_b_M_p_o_o_l_:_:_t_r_i_c_k_l_e method is to enable a + memory pool manager to ensure that a page is always avail- + able for reading in new information without having to wait + for a write. + + The _D_b_M_p_o_o_l_:_:_t_r_i_c_k_l_e method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_M_p_o_o_l_:_:_s_y_n_c + The _D_b_M_p_o_o_l_:_:_s_y_n_c method ensures that all the modified + pages in the pool with log sequence numbers (LSNs) less + than the _l_s_n argument are written to disk. + + The _D_b_M_p_o_o_l_:_:_s_y_n_c method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure, 0 on success, and + DB_INCOMPLETE if there were pages which need to be written + but which _D_b_M_p_o_o_l_:_:_s_y_n_c was unable to write immediately. + In addition, if _D_b_M_p_o_o_l_:_:_s_y_n_c returns success, the value + of _l_s_n will be overwritten with the largest LSN from any + page which was written by _D_b_M_p_o_o_l_:_:_s_y_n_c to satisfy this + request. + + The purpose of the _D_b_M_p_o_o_l_:_:_s_y_n_c method is to enable a + transaction manager to ensure, as part of a checkpoint, + that all pages modified by a certain time have been writ- + ten to disk. Pages in the pool which cannot be written + back to disk immediately (e.g., are currently pinned) are + written to disk as soon as it is possible to do so. The + expected behavior of the transaction manager is to call + the _D_b_M_p_o_o_l_:_:_s_y_n_c method and then, if the return indicates + that some pages could not be written immediately, to wait + briefly and retry again with the same LSN until the _D_b_M_- + _p_o_o_l_:_:_s_y_n_c method returns that all pages have been + written. + + To support the _D_b_M_p_o_o_l_:_:_s_y_n_c functionality, it is neces- + sary that the pool methods know the location of the LSN on + the page for each file type. This location should be + specified when the file is opened using the _D_b_M_- + _p_o_o_l_F_i_l_e_:_:_o_p_e_n method. (Note, it is not required that the + LSN be aligned on the page in any way.) + + _D_b_M_p_o_o_l_:_:_s_t_a_t + + The _D_b_M_p_o_o_l_:_:_s_t_a_t method creates statistical structures + and copies pointers to them into user-specified memory + locations. The statistics include the number of files + participating in the pool, the active pages in the pool, + and information as to how effective the cache has been. + + Statistical structures are created in allocated memory. + If _d_b___m_a_l_l_o_c is non-NULL, it is called to allocate the + memory, otherwise, the library function _m_a_l_l_o_c(3) is used. + The function _d_b___m_a_l_l_o_c must match the calling conventions + of the _m_a_l_l_o_c(3) library routine. Regardless, the caller + is responsible for deallocating the returned memory. To + deallocate the returned memory, free each returned memory + pointer; pointers inside the memory do not need to be + individually freed. + + If _g_s_p is non-NULL, the global statistics for the memory + pool object are copied into the memory location it refer- + ences. The global statistics are stored in a structure of + type DB_MPOOL_STAT (typedef'd in ). + + The following DB_MPOOL_STAT fields will be filled in: + + u_int32_t st_refcnt; + The number of references to the region. + u_int32_t st_regsize; + The size of the region. + size_t st_cachesize; + Cache size in bytes. + u_int32_t st_cache_hit; + Requested pages found in the cache. + u_int32_t st_cache_miss; + Requested pages not found in the cache. + u_int32_t st_map; + Requested pages mapped into the process' address + space (there is no available information as to + whether or not this request caused disk I/O, although + examining the application page fault rate may be + helpful). + u_int32_t st_page_create; + Pages created in the cache. + u_int32_t st_page_in; + Pages read into the cache. + u_int32_t st_page_out; + Pages written from the cache to the backing file. + u_int32_t st_ro_evict; + Clean pages forced from the cache. + u_int32_t st_rw_evict; + Dirty pages forced from the cache. + u_int32_t st_hash_buckets; + Number of hash buckets in buffer hash table. + u_int32_t st_hash_searches; + Total number of buffer hash table lookups. + u_int32_t st_hash_longest; + The longest chain ever encountered in buffer hash + table lookups. + u_int32_t st_hash_examined; + Total number of hash elements traversed during hash + table lookups. + u_int32_t st_page_clean; + Clean pages currently in the cache. + u_int32_t st_page_dirty; + Dirty pages currently in the cache. + u_int32_t st_page_trickle; + Dirty pages written using the _m_e_m_p___t_r_i_c_k_l_e interface. + + If _f_s_p is non-NULL, a pointer to a NULL-terminated vari- + able length array of statistics for individual files in + the memory pool is copied into the memory location it ref- + erences. If no individual files currently exist in the + memory pool, _f_s_p will be set to NULL. + + The per-file statistics are stored in structures of type + DB_MPOOL_FSTAT (typedef'd in ). The following + DB_MPOOL_FSTAT fields will be filled in for each file in + the pool, i.e., each element of the array: + + char *file_name; + The name of the file. + size_t st_pagesize; + Page size in bytes. + u_int32_t st_cache_hit; + Requested pages found in the cache. + u_int32_t st_cache_miss; + Requested pages not found in the cache. + u_int32_t st_map; + Requested pages mapped into the process' address + space. + u_int32_t st_page_create; + Pages created in the cache. + u_int32_t st_page_in; + Pages read into the cache. + u_int32_t st_page_out; + Pages written from the cache to the backing file. + + The _D_b_M_p_o_o_l_:_:_s_t_a_t method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the behavior of + _D_b_M_p_o_o_l_F_i_l_e: + + DB_HOME + If the _d_b_e_n_v argument to _D_b_M_p_o_o_l_:_:_o_p_e_n was initial- + ized using _d_b___a_p_p_i_n_i_t, the environment variable + DB_HOME may be used as the path of the database home + for the interpretation of the _d_i_r argument to _D_b_M_- + _p_o_o_l_:_:_o_p_e_n, as described in _d_b___a_p_p_i_n_i_t(3). + + TMPDIR + If the _d_b_e_n_v argument to _D_b_M_p_o_o_l_:_:_o_p_e_n was NULL or + not initialized using _d_b___a_p_p_i_n_i_t, the environment + variable TMPDIR may be used as the directory in which + to create the memory pool, as described in the _D_b_M_- + _p_o_o_l_:_:_o_p_e_n section above. + +EERRRROORRSS + Methods marked as returning _e_r_r_n_o will, by default, throw + an exception that encapsulates the error information. The + default error behavior can be changed, see _D_b_E_x_c_e_p_t_i_o_n(3). + + The _D_b_M_p_o_o_l_:_:_o_p_e_n method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DBmemp->pgin(3), + DBmemp->pgout(3), DbLog::compare(3), DbLog::flush(3), DbM- + pool::close(3), DbMpool::unlink(3), close(2), db_ver- + sion(3), fcntl(2), fflush(3), fsync(2), lseek(2), mal- + loc(3), memcmp(3), memcpy(3), memset(3), mmap(2), mun- + map(2), open(2), sigfillset(3), sigprocmask(2), stat(2), + strcpy(3), strdup(3), strerror(3), strlen(3), time(3), + unlink(2), and write(2). + + In addition, the _D_b_M_p_o_o_l_:_:_o_p_e_n method may fail and throw a + _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [EAGAIN] + The shared memory region was locked and (repeatedly) + unavailable. + + [EINVAL] + An invalid flag value or parameter was specified. + + The DB_THREAD flag was specified and spinlocks are + not implemented for this architecture. + + A NULL pathname was specified without the + DB_MPOOL_PRIVATE flag. + + The specified cache size was impossibly small. + + The _D_b_M_p_o_o_l_:_:_c_l_o_s_e method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DbMpoolFile::close(3), + close(2), fcntl(2), fflush(3), munmap(2), and strerror(3). + + The _D_b_M_p_o_o_l_:_:_u_n_l_i_n_k method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: close(2), fcntl(2), + fflush(3), malloc(3), memcpy(3), memset(3), mmap(2), mun- + map(2), open(2), sigfillset(3), sigprocmask(2), stat(2), + strcpy(3), strdup(3), strerror(3), strlen(3), and + unlink(2). + + In addition, the _D_b_M_p_o_o_l_:_:_u_n_l_i_n_k method may fail and throw + a _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [EBUSY] + The shared memory region was in use and the force + flag was not set. + + The _D_b_M_p_o_o_l_:_:_d_b___r_e_g_i_s_t_e_r method may fail and throw a _D_b_E_x_- + _c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: fcntl(2), and mal- + loc(3). + + The _D_b_M_p_o_o_l_:_:_t_r_i_c_k_l_e method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DBmemp->pgin(3), + DBmemp->pgout(3), DbLog::compare(3), DbLog::flush(3), + close(2), fcntl(2), fflush(3), fsync(2), lseek(2), mal- + loc(3), memcmp(3), memcpy(3), memset(3), mmap(2), open(2), + sigfillset(3), sigprocmask(2), stat(2), strcpy(3), + strdup(3), strerror(3), strlen(3), time(3), unlink(2), and + write(2). + + In addition, the _D_b_M_p_o_o_l_:_:_t_r_i_c_k_l_e method may fail and + throw a _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following + conditions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The _D_b_M_p_o_o_l_:_:_s_y_n_c method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DBmemp->pgin(3), + DBmemp->pgout(3), DbLog::compare(3), DbLog::flush(3), + close(2), fcntl(2), fflush(3), fsync(2), lseek(2), mal- + loc(3), memcmp(3), memcpy(3), memset(3), mmap(2), open(2), + qsort(3), realloc(3), sigfillset(3), sigprocmask(2), + stat(2), strcpy(3), strdup(3), strerror(3), strlen(3), + time(3), unlink(2), and write(2). + + In addition, the _D_b_M_p_o_o_l_:_:_s_y_n_c method may fail and throw a + _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The _D_b_M_p_o_o_l_:_:_s_y_n_c method was called without logging + having been initialized in the environment. + + The _D_b_M_p_o_o_l_:_:_s_t_a_t method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: fcntl(2), malloc(3), + memcpy(3), and strlen(3). + +SSEEEE AALLSSOO + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___i_n_t_e_r_n_a_l(3), _d_b___t_h_r_e_a_d(3), _D_b(3), _D_b_c(3), _D_b_E_n_v(3), + _D_b_E_x_c_e_p_t_i_o_n(3), _D_b_I_n_f_o(3), _D_b_L_o_c_k(3), _D_b_L_o_c_k_T_a_b(3), _D_b_L_o_g(3), + _D_b_L_s_n(3), _D_b_M_p_o_o_l(3), _D_b_M_p_o_o_l_F_i_l_e(3), _D_b_t(3), _D_b_T_x_n(3), + _D_b_T_x_n_M_g_r(3) diff --git a/mozilla/db/man/mancxx.text/DbMpoolFile.0 b/mozilla/db/man/mancxx.text/DbMpoolFile.0 new file mode 100644 index 00000000000..80e7c695c04 --- /dev/null +++ b/mozilla/db/man/mancxx.text/DbMpoolFile.0 @@ -0,0 +1,434 @@ + + +NNAAMMEE + DbMpoolFile - shared memory buffer pool + +SSYYNNOOPPSSIISS + ##iinncclluuddee <> + + ssttaattiicc iinntt + DDbbMMppoooollFFiillee::::ooppeenn((DDbbMMppooooll **mmpp,, cchhaarr **ffiillee,, uu__iinntt3322__tt ffllaaggss,, iinntt mmooddee,, + ssiizzee__tt ppaaggeessiizzee,, DDbbMMppoooollFFiinnffoo **ffiinnffoopp,, DDbbMMppoooollFFiillee ****mmppff));; + + iinntt + DDbbMMppoooollFFiillee::::cclloossee(());; + + iinntt + DDbbMMppoooollFFiillee::::ggeett((ddbb__ppggnnoo__tt **ppggnnooaaddddrr,, uu__iinntt3322__tt ffllaaggss,, vvooiidd ****ppaaggeepp));; + + iinntt + DDbbMMppoooollFFiillee::::ppuutt((vvooiidd **ppggaaddddrr,, uu__iinntt3322__tt ffllaaggss));; + + iinntt + DDbbMMppoooollFFiillee::::sseett((vvooiidd **ppggaaddddrr,, uu__iinntt3322__tt ffllaaggss));; + + iinntt + DDbbMMppoooollFFiillee::::ssyynncc(());; + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of classes that provides a mod- + ular programming interface to transactions and record-ori- + ented file access. The library includes support for + transactions, locking, logging and file page caching, as + well as various indexed access methods. Many of the + classes (e.g., the file page caching class) are useful + independent of the other DB classes, although some classes + are explicitly based on other classes (e.g., transactions + and logging). For a general description of the DB pack- + age, see _d_b___i_n_t_r_o(3). + + This manual page describes the specific details of the + per-file memory pool interface. + + The _D_b_M_p_o_o_l(3) and _D_b_M_p_o_o_l_F_i_l_e(3) classes are the library + interface intended to provide general-purpose, page-ori- + ented buffer management of one or more files. While + designed to work with the other Db functions, these func- + tions are also useful for more general purposes. The mem- + ory pools (_D_b_M_p_o_o_l_:_:'s) are referred to in this document + as simply ``pools''. Pools may be shared between pro- + cesses. Pools are usually filled by pages from one or + more files (_D_b_M_p_o_o_l_F_i_l_e's). Pages in the pool are + replaced in LRU (least-recently-used) order, with each new + page replacing the page that has been unused the longest. + Pages retrieved from the pool using _D_b_M_p_o_o_l_F_i_l_e_:_:_g_e_t are + ``pinned'' in the pool, by default, until they are + returned to the pool's control using the _D_b_M_p_o_o_l_F_i_l_e_:_:_p_u_t + method. + + _D_b_M_p_o_o_l_F_i_l_e_:_:_o_p_e_n + The _D_b_M_p_o_o_l_F_i_l_e_:_:_o_p_e_n method opens a file in the pool + specified by the _D_b_M_p_o_o_l argument, copying the DbMpoolFile + pointer representing it into the memory location refer- + enced by _m_p_f. + + The _f_i_l_e argument is the name of the file to be opened. + If _f_i_l_e is NULL, a private file is created that cannot be + shared with any other process (although it may be shared + with other threads). + + The _f_l_a_g_s and _m_o_d_e arguments specify how files will be + opened and/or created when they don't already exist. The + flags value is specified by oorr'ing together one or more of + the following values: + + DB_CREATE + Create any underlying files, as necessary. If the + files do not already exist and the DB_CREATE flag is + not specified, the call will fail. + + + DB_NOMMAP + Always copy this file into the local cache instead of + mapping it into process memory (see the description + of the _m_p___m_m_a_p_s_i_z_e field of the DbEnv object for fur- + ther information). + + + DB_RDONLY + Open any underlying files for reading only. Any + attempt to write the file using the pool functions + will fail, regardless of the actual permissions of + the file. + + All files created by the method _D_b_M_p_o_o_l_F_i_l_e_:_:_o_p_e_n are cre- + ated with mode _m_o_d_e (as described in _c_h_m_o_d(2)) and modi- + fied by the process' umask value at the time of creation + (see _u_m_a_s_k(2)). The group ownership of created files is + based on the system and directory defaults, and is not + further specified by DB. + + The _p_a_g_e_s_i_z_e argument is the size, in bytes, of the unit + of transfer between the application and the pool, although + it is not necessarily the unit of transfer between the + pool and the source file. + + Files opened in the pool may be further configured based + on the _f_i_n_f_o_p argument to _m_e_m_p___f_o_p_e_n, which is a pointer + to a structure of type DB_MPOOL_FINFO (typedef'd in + ). No references to the _f_i_n_f_o_p structure are main- + tained by DB, so it may be discarded when the _m_e_m_p___f_o_p_e_n + function returns. In order to ensure compatibility with + future releases of DB, all fields of the DB_MPOOL_FINFO + structure that are not explicitly set should be initial- + ized to 0 before the first time the structure is used. Do + this by declaring the structure external or static, or by + calling the C library routine _b_z_e_r_o(3) or _m_e_m_s_e_t(3). + + The fields of the DB_MPOOL_FINFO structure used by _D_b_M_- + _p_o_o_l_F_i_l_e_:_:_o_p_e_n are described below. If _f_i_n_f_o_p is NULL or + any of its fields are set to their default value, defaults + appropriate for the system are used. + + int ftype; + The _f_t_y_p_e field should be the same as a _f_t_y_p_e argu- + ment previously specified to the _D_b_M_p_o_o_l_:_:_d_b___r_e_g_i_s_t_e_r + method, unless no input or output processing of the + file's pages are necessary, in which case it should + be 0. (See the description of the _D_b_M_p_o_o_l_:_:_d_b___r_e_g_i_s_- + _t_e_r method for more information.) + + DBT *pgcookie; + The _p_g_c_o_o_k_i_e argument contains the byte string that + is passed to the _p_g_i_n and _p_g_o_u_t functions for this + file, if any. If no _p_g_i_n or _p_g_o_u_t functions are + specified, the _p_g_c_o_o_k_i_e field should be NULL. (See + the description of the _D_b_M_p_o_o_l_:_:_d_b___r_e_g_i_s_t_e_r method + for more information.) + + u_int8_t *fileid; + The _f_i_l_e_i_d field is a unique identifier for the file. + The mpool functions must be able to uniquely identify + files in order that multiple processes sharing a file + will correctly share its underlying pages. Normally, + the _f_i_l_e_i_d field should be NULL and the mpool func- + tions will use the file's device and inode numbers + (see _s_t_a_t(2)) for this purpose. On some filesystems, + (e.g., FAT or NFS) file device and inode numbers are + not necessarily unique across system reboots. AAppppllii-- + ccaattiioonnss wwaannttiinngg ttoo mmaaiinnttaaiinn aa sshhaarreedd mmeemmoorryy bbuuffffeerr + ppooooll aaccrroossss ssyysstteemm rreebboooottss,, wwhheerree tthhee ppooooll ccoonnttaaiinnss + ppaaggeess ffrroomm ffiilleess ssttoorreedd oonn ssuucchh ffiilleessyysstteemmss,, mmuusstt + ssppeecciiffyy aa uunniiqquuee ffiillee iiddeennttiiffiieerr ttoo tthhee _D_b_M_- + _p_o_o_l_F_i_l_e_:_:_o_p_e_n call and each process opening or reg- + istering the file must provide the same unique iden- + tifier. If the _f_i_l_e_i_d field is non-NULL, it must + reference a DB_FILE_ID_LEN (as defined in ) + length array of bytes that will be used to uniquely + identify the file. This should not be necessary for + most applications. Specifically, it is not necessary + if the memory pool is re-instantiated after each sys- + tem reboot, the application is using the Db access + methods instead of calling the pool functions explic- + itly, or the files in the memory pool are stored on + filesystems where the file device and inode numbers + do not change across system reboots. + + int32_t lsn_offset; + The _l_s_n___o_f_f_s_e_t argument is the zero-based byte offset + in the page of the page's log sequence number (LSN), + or -1 if no LSN offset is specified. (See the + description of the _D_b_M_p_o_o_l_:_:_s_y_n_c method for more + information.) + + u_int32_t clear_len; + The _c_l_e_a_r___l_e_n field is the number of initial bytes in + a page that should be set to zero when the page is + created as a result of the DB_MPOOL_CREATE or + DB_MPOOL_NEW flags being specified to _D_b_M_- + _p_o_o_l_F_i_l_e_:_:_g_e_t. If _f_i_n_f_o_p is NULL or _c_l_e_a_r___l_e_n is 0, + the entire page is cleared. + + The _D_b_M_p_o_o_l_F_i_l_e_:_:_o_p_e_n method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_M_p_o_o_l_F_i_l_e_:_:_c_l_o_s_e + The _D_b_M_p_o_o_l_F_i_l_e_:_:_c_l_o_s_e method closes the source file indi- + cated by the DbMpoolFile object. This method does not + imply a call to _D_b_M_p_o_o_l_F_i_l_e_:_:_s_y_n_c, i.e. no pages are writ- + ten to the source file as as a result of calling _D_b_M_- + _p_o_o_l_F_i_l_e_:_:_c_l_o_s_e. + + In addition, if the _f_i_l_e argument to _D_b_M_p_o_o_l_F_i_l_e_:_:_o_p_e_n was + NULL, any underlying files created for this DbMpoolFile + will be removed. + + The _D_b_M_p_o_o_l_F_i_l_e_:_:_c_l_o_s_e method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_M_p_o_o_l_F_i_l_e_:_:_g_e_t + The _D_b_M_p_o_o_l_F_i_l_e_:_:_g_e_t method copies a pointer to the page + with the page number specified by _p_g_n_o_a_d_d_r, from the + source file specified by the DbMpoolFile object into the + memory location referenced by _p_a_g_e_p. If the page does not + exist or cannot be retrieved, _D_b_M_p_o_o_l_F_i_l_e_:_:_g_e_t will fail. + + The returned page is size_t type aligned. + + PPaaggee nnuummbbeerrss bbeeggiinn aatt 00,, ee..gg..,, tthhee ffiirrsstt ppaaggee iinn tthhee ffiillee + iiss ppaaggee nnuummbbeerr 00,, nnoott ppaaggee nnuummbbeerr 11.. + + The _f_l_a_g_s argument is specified by oorr'ing together one or + more of the following values: + + + DB_MPOOL_CREATE + If the specified page does not exist, create it. In + this case, the _p_g_i_n method, if specified, is called. + + + DB_MPOOL_LAST + Return the last page of the source file and copy its + page number to the location referenced by _p_g_n_o_a_d_d_r. + DB_MPOOL_NEW + Create a new page in the file and copy its page num- + ber to the location referenced by _p_g_n_o_a_d_d_r. In this + case, the _p_g_i_n method, if specified, is not called. + + The DB_MPOOL_CREATE, DB_MPOOL_LAST and DB_MPOOL_NEW flags + are mutually exclusive. + + Created pages have all their bytes set to 0, unless other- + wise specified when the file was opened. + + All pages returned by _D_b_M_p_o_o_l_F_i_l_e_:_:_g_e_t will be retained + (i.e. ``pinned'') in the pool until a subsequent call to + _D_b_M_p_o_o_l_F_i_l_e_:_:_p_u_t. + + The _D_b_M_p_o_o_l_F_i_l_e_:_:_g_e_t method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_M_p_o_o_l_F_i_l_e_:_:_p_u_t + The _D_b_M_p_o_o_l_F_i_l_e_:_:_p_u_t method indicates that the page refer- + enced by _p_g_a_d_d_r can be evicted from the pool. _P_g_a_d_d_r must + be an address previously returned by _D_b_M_p_o_o_l_F_i_l_e_:_:_g_e_t. + + The _f_l_a_g_s argument is specified by oorr'ing together one or + more of the following values: + + + DB_MPOOL_CLEAN + Clear any previously set modification information + (i.e., don't bother writing the page back to the + source file). + + + DB_MPOOL_DIRTY + The page has been modified and must be written to the + source file before being evicted from the pool. + + + DB_MPOOL_DISCARD + The page is unlikely to be useful in the near future, + and should be discarded before other pages in the + pool. + + The DB_MPOOL_CLEAN and DB_MPOOL_DIRTY flags are mutually + exclusive. + + The _D_b_M_p_o_o_l_F_i_l_e_:_:_p_u_t method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_M_p_o_o_l_F_i_l_e_:_:_s_e_t + The _D_b_M_p_o_o_l_F_i_l_e_:_:_s_e_t method sets the flags associated with + the page referenced by _p_g_a_d_d_r without unpinning it from + the pool. _P_g_a_d_d_r must be an address previously returned + by _D_b_M_p_o_o_l_F_i_l_e_:_:_g_e_t. The _f_l_a_g_s argument to + _D_b_M_p_o_o_l_F_i_l_e_:_:_s_e_t is specified by oorr'ing together one or + more of the values specified as flags for the _D_b_M_- + _p_o_o_l_F_i_l_e_:_:_p_u_t call. + + The _D_b_M_p_o_o_l_F_i_l_e_:_:_s_e_t method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_M_p_o_o_l_F_i_l_e_:_:_s_y_n_c + The _D_b_M_p_o_o_l_F_i_l_e_:_:_s_y_n_c method writes all pages associated + with the DbMpoolFile object that were marked as modified + using _D_b_M_p_o_o_l_F_i_l_e_:_:_p_u_t or _D_b_M_p_o_o_l_F_i_l_e_:_:_s_e_t, back to the + source file. If any of the modified pages are also pinned + (i.e., currently referenced by this or another process) + _D_b_M_p_o_o_l_F_i_l_e_:_:_s_y_n_c will ignore them. + + The _D_b_M_p_o_o_l_F_i_l_e_:_:_s_y_n_c method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure, 0 on success, and + DB_INCOMPLETE if there were pages which were modified but + which _D_b_M_p_o_o_l_F_i_l_e_:_:_s_y_n_c was unable to write. + +EERRRROORRSS + Methods marked as returning _e_r_r_n_o will, by default, throw + an exception that encapsulates the error information. The + default error behavior can be changed, see _D_b_E_x_c_e_p_t_i_o_n(3). + + The _D_b_M_p_o_o_l_F_i_l_e_:_:_o_p_e_n method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DBmemp->pgin(3), + DBmemp->pgout(3), DbLog::compare(3), DbLog::flush(3), + close(2), fcntl(2), fflush(3), fsync(2), lseek(2), mal- + loc(3), memcmp(3), memcpy(3), memset(3), mmap(2), open(2), + sigfillset(3), sigprocmask(2), stat(2), strcpy(3), + strdup(3), strerror(3), strlen(3), time(3), unlink(2), and + write(2). + + In addition, the _D_b_M_p_o_o_l_F_i_l_e_:_:_o_p_e_n method may fail and + throw a _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following + conditions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The file has already been entered into the pool, and + the _p_a_g_e_s_i_z_e value is not the same as when the file + was entered into the pool, or the length of the file + is not zero or a multiple of the _p_a_g_e_s_i_z_e. + + The DB_RDONLY flag was specified for an in-memory + pool. + + The _D_b_M_p_o_o_l_F_i_l_e_:_:_c_l_o_s_e method may fail and throw a _D_b_E_x_- + _c_e_p_t_i_o_n(3) + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: close(2), fcntl(2), + fflush(3), munmap(2), and strerror(3). + + The _D_b_M_p_o_o_l_F_i_l_e_:_:_g_e_t method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DBmemp->pgin(3), + DBmemp->pgout(3), DbLog::compare(3), DbLog::flush(3), + close(2), fcntl(2), fflush(3), fsync(2), lseek(2), mal- + loc(3), memcmp(3), memcpy(3), memset(3), mmap(2), open(2), + read(2), sigfillset(3), sigprocmask(2), stat(2), str- + cpy(3), strdup(3), strerror(3), strlen(3), time(3), + unlink(2), and write(2). + + In addition, the _D_b_M_p_o_o_l_F_i_l_e_:_:_g_e_t method may fail and + throw a _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following + conditions: + + [EAGAIN] + The page reference count has overflowed. (This + should never happen unless there's a bug in the + application.) + + [EINVAL] + An invalid flag value or parameter was specified. + + The DB_MPOOL_NEW flag was set and the source file was + not opened for writing. + + The requested page does not exist and DB_MPOOL_CREATE + was not set. + + More than one of DB_MPOOL_CREATE, DB_MPOOL_LAST and + DB_MPOOL_NEW was set. + + [ENOMEM] + The cache is full and no more pages will fit in the + pool. + + The _D_b_M_p_o_o_l_F_i_l_e_:_:_p_u_t method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DBmemp->pgin(3), + DBmemp->pgout(3), DbLog::compare(3), DbLog::flush(3), + close(2), fcntl(2), fflush(3), fsync(2), lseek(2), mal- + loc(3), memcmp(3), memcpy(3), memset(3), mmap(2), open(2), + sigfillset(3), sigprocmask(2), stat(2), strcpy(3), + strdup(3), strerror(3), strlen(3), time(3), unlink(2), and + write(2). + + In addition, the _D_b_M_p_o_o_l_F_i_l_e_:_:_p_u_t method may fail and + throw a _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following + conditions: + + [EACCES] + The DB_MPOOL_DIRTY flag was set and the source file + was not opened for writing. + + [EINVAL] + An invalid flag value or parameter was specified. + + The _p_g_a_d_d_r parameter does not reference a page + returned by _D_b_M_p_o_o_l_F_i_l_e_:_:_g_e_t. + + More than one of DB_MPOOL_CLEAN and DB_MPOOL_DIRTY + was set. + + The _D_b_M_p_o_o_l_F_i_l_e_:_:_s_e_t method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: fcntl(2), and + fflush(3). + + In addition, the _D_b_M_p_o_o_l_F_i_l_e_:_:_s_e_t method may fail and + throw a _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following + conditions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The _D_b_M_p_o_o_l_F_i_l_e_:_:_s_y_n_c method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DBmemp->pgin(3), + DBmemp->pgout(3), DbLog::compare(3), DbLog::flush(3), + close(2), fcntl(2), fflush(3), fsync(2), lseek(2), mal- + loc(3), memcpy(3), memset(3), open(2), qsort(3), real- + loc(3), sigfillset(3), sigprocmask(2), stat(2), strcpy(3), + strdup(3), strerror(3), strlen(3), unlink(2), and + write(2). + + +SSEEEE AALLSSOO + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___i_n_t_e_r_n_a_l(3), _d_b___t_h_r_e_a_d(3), _D_b(3), _D_b_c(3), _D_b_E_n_v(3), + _D_b_E_x_c_e_p_t_i_o_n(3), _D_b_I_n_f_o(3), _D_b_L_o_c_k(3), _D_b_L_o_c_k_T_a_b(3), _D_b_L_o_g(3), + _D_b_L_s_n(3), _D_b_M_p_o_o_l(3), _D_b_M_p_o_o_l_F_i_l_e(3), _D_b_t(3), _D_b_T_x_n(3), + _D_b_T_x_n_M_g_r(3) diff --git a/mozilla/db/man/mancxx.text/DbTxn.0 b/mozilla/db/man/mancxx.text/DbTxn.0 new file mode 100644 index 00000000000..82f2502ee78 --- /dev/null +++ b/mozilla/db/man/mancxx.text/DbTxn.0 @@ -0,0 +1,273 @@ + + +NNAAMMEE + DbTxn - Db transaction management + +SSYYNNOOPPSSIISS + ##iinncclluuddee <> + + iinntt + DDbbTTxxnn::::pprreeppaarree(());; + + iinntt + DDbbTTxxnn::::ccoommmmiitt(());; + + iinntt + DDbbTTxxnn::::aabboorrtt(());; + + uu__iinntt3322__tt + DDbbTTxxnn::::iidd(());; + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of classes that provides a mod- + ular programming interface to transactions and record-ori- + ented file access. The library includes support for + transactions, locking, logging and file page caching, as + well as various indexed access methods. Many of the + classes (e.g., the file page caching class) are useful + independent of the other DB classes, although some classes + are explicitly based on other classes (e.g., transactions + and logging). For a general description of the DB pack- + age, see _d_b___i_n_t_r_o(3). + + This manual page describes the specific details of the Db + transaction support. The DbTxn class is used in conjunc- + tion with _D_b_T_x_n_M_g_r(3) to provide transaction semantics. + Full transaction support is provided by a collection of + modules that provide interfaces to the services required + for transaction processing. These services are recovery + (see _D_b_L_o_g(3)), concurrency control (see _D_b_L_o_c_k(3) and + _D_b_L_o_c_k_T_a_b(3)), and the management of shared data (see _D_b_M_- + _p_o_o_l(3) and _D_b_M_p_o_o_l_F_i_l_e(3)). Transaction semantics can be + applied to the access methods described in _D_b(3) through + method call parameters. + + The model intended for transactional use (and the one that + is used by the access methods) is write-ahead logging pro- + vided by _D_b_L_o_g(3) to record both before- and after-images. + Locking follows a two-phase protocol, with all locks being + released at transaction commit. + + _D_b_T_x_n_:_:_p_r_e_p_a_r_e + The _D_b_T_x_n_:_:_p_r_e_p_a_r_e method initiates the beginning of a two + phase commit. In a distributed transaction environment, + _d_b can be used as a local transaction manager. In this + case, the distributed transaction manager must send _p_r_e_- + _p_a_r_e messages to each local manager. The local manager + must then issue a _D_b_T_x_n_:_:_p_r_e_p_a_r_e and await its successful + return before responding to the distributed transaction + manager. Only after the distributed transaction manager + receives successful responses from all of its _p_r_e_p_a_r_e + messages should it issue any _c_o_m_m_i_t messages. + + The _D_b_T_x_n_:_:_p_r_e_p_a_r_e method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_T_x_n_:_:_c_o_m_m_i_t + The _D_b_T_x_n_:_:_c_o_m_m_i_t method ends the transaction associated + with the DbTxn. If DB_TXN_NOSYNC was not specified, a + commit log record is written and flushed to disk, as are + all previously written log records. If the transaction is + nested, its locks are acquired by the parent transaction, + otherwise its locks are released. Any applications that + require strict two-phase locking must not release any + locks explicitly, leaving them all to be released by + _D_b_T_x_n_:_:_c_o_m_m_i_t. + + The _D_b_T_x_n_:_:_c_o_m_m_i_t method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_T_x_n_:_:_a_b_o_r_t + The _D_b_T_x_n_:_:_a_b_o_r_t method causes an abnormal termination of + the transaction. The log is played backwards and any nec- + essary recovery operations are initiated through the + _r_e_c_o_v_e_r method specified to _D_b_T_x_n_M_g_r_:_:_o_p_e_n. After recov- + ery is completed, all locks held by the transaction are + acquired by the parent transaction in the case of a nested + transaction or released in the case of a non-nested trans- + action. As is the case for _D_b_T_x_n_:_:_c_o_m_m_i_t, applications + that require strict two phase locking should not explic- + itly release any locks. + + The _D_b_T_x_n_:_:_a_b_o_r_t method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or returns + the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_T_x_n_:_:_i_d + The _D_b_T_x_n_:_:_i_d method returns the unique transaction id + associated with the specified transaction. Locking calls + made on behalf of this transaction should use the value + returned from _D_b_T_x_n_:_:_i_d as the locker parameter to the + _D_b_L_o_c_k_T_a_b_:_:_g_e_t or _D_b_L_o_c_k_T_a_b_:_:_v_e_c calls. + + +TTRRAANNSSAACCTTIIOONNSS + Creating transaction protected applications using the Db + access methods requires little system customization. In + most cases, the default parameters to the locking, log- + ging, memory pool, and transaction subsystems will suf- + fice. Applications can use _D_b_E_n_v_:_:_a_p_p_i_n_i_t (see _D_b_E_n_v(3)) + to perform this initialization, or they may do it explic- + itly. + + Each database operation (i.e., any call to a method under- + lying the handles returned by _D_b_:_:_o_p_e_n and _D_b_:_:_c_u_r_s_o_r + described in _D_b(3)) is normally performed on behalf of a + unique locker. If multiple calls on behalf of the same + locker are desired, then transactions must be used. + + Once the application has initialized the Db subsystems + that it is using, it may open the Db access method + databases. For applications performing transactions, the + databases must be opened after subsystem initialization, + and cannot be opened as part of a transaction. Once the + databases are opened, the application can group sets of + operations into transactions, by surrounding the opera- + tions with the appropriate _D_b_T_x_n_M_g_r_:_:_b_e_g_i_n, _D_b_T_x_n_:_:_c_o_m_m_i_t + and _D_b_T_x_n_:_:_a_b_o_r_t calls. Databases accessed by a transac- + tion must not be closed during the transaction. Note, it + is not necessary to transaction protect read-only transac- + tions, unless those transactions require repeatable reads. + + The Db access methods will make the appropriate calls into + the lock, log and memory pool subsystems in order to guar- + antee that transaction semantics are applied. When the + application is ready to exit, all outstanding transactions + should have been committed or aborted. At this point, all + open Db files should be closed. Once the Db database + files are closed, the Db subsystems should be closed, + either explicitly or by destroying the _D_b_E_n_v(3) object. + + It is also possible to use the locking, logging and trans- + action subsystems of Db to provide transaction semantics + to objects other than those described by the Db access + methods. In these cases, the application will need more + explicit customization of the subsystems as well as the + development of appropriate data-structure-specific recov- + ery functions. + + For example, consider an application that provides trans- + action semantics to data stored in plain UNIX files + accessed using the _r_e_a_d(2) and _w_r_i_t_e(2) system calls. The + operations for which transaction protection is desired are + bracketed by calls to _D_b_T_x_n_M_g_r_:_:_b_e_g_i_n and _D_b_T_x_n_:_:_c_o_m_m_i_t. + + Before data are referenced, the application must make a + call to the lock manager, _D_b_L_o_c_k(3), for a lock of the + appropriate type (e.g., 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 man- + ager, _D_b_L_o_c_k(3)_. Then, the application should make a call + to the log manager, _D_b_L_o_g, to record enough information to + redo the operation in case of failure after commit and to + undo the operation in case of abort. As discussed in the + _D_b_L_o_g(3) manual page, 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. + + After the log message is written, the application may + issue the write system call. After all requests are + issued, the application may call _D_b_T_x_n_:_:_c_o_m_m_i_t. When + _D_b_T_x_n_:_:_c_o_m_m_i_t returns, the caller is guaranteed that all + necessary log writes have been written to disk. + + At any time, the application may call _D_b_T_x_n_:_:_a_b_o_r_t, which + will result in the appropriate calls to the _r_e_c_o_v_e_r method + to restore the ``database'' to a consistent pre-transac- + tion state. (The recover method must be able to either + re-apply or undo the update depending on the context, for + each different type of log record.) + + If the application should crash, the recovery process uses + the _D_b_L_o_g interface to read the log and call the _r_e_c_o_v_e_r + method to restore the database to a consistent state. + + The _D_b_T_x_n_:_:_p_r_e_p_a_r_e method provides the core functionality + to implement distributed transactions, but it does not + manage the notification of distributed transaction man- + agers. The caller is responsible for issuing _D_b_T_x_n_:_:_p_r_e_- + _p_a_r_e calls to all sites participating in the transaction. + If all responses are positive, the caller can issue a + _D_b_T_x_n_:_:_c_o_m_m_i_t. If any of the responses are negative, the + caller should issue a _D_b_T_x_n_:_:_a_b_o_r_t. In general, the + _D_b_T_x_n_:_:_p_r_e_p_a_r_e call requires that the transaction log be + flushed to disk. + +TTRRAANNSSAACCTTIIOONN IIDD LLIIMMIITTSS + The transaction ID space in Berkeley DB is 2^31, or 2 bil- + lion entries. It is possible that some environments may + need to be aware of this limitation. Consider an applica- + tion performing 600 transactions a second for 15 hours a + day. The transaction ID space will run out in roughly 66 + days: + + 2^31 / (600 * 15 * 60 * 60) = 66 + + Doing only 100 transactions a second exhausts the transac- + tion ID space in roughly one year. + + The transaction ID space is reset each time recovery is + run. If you reach the end of your transaction ID space, + shut down your applications and restart them after running + recovery (see _d_b___r_e_c_o_v_e_r(1) for more information). The + most recently allocated transaction ID is the + _s_t___l_a_s_t___t_x_n_i_d value in the transaction statistics informa- + tion, and is displayed by the _d_b___s_t_a_t(1) utility. + + +EERRRROORRSS + Methods marked as returning _e_r_r_n_o will, by default, throw + an exception that encapsulates the error information. The + default error behavior can be changed, see _D_b_E_x_c_e_p_t_i_o_n(3). + + The _D_b_T_x_n_:_:_p_r_e_p_a_r_e method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DbLog::flush(3), + fcntl(2), fflush(3), and strerror(3). + + The _D_b_T_x_n_:_:_c_o_m_m_i_t method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DbLockTab::vec(3), + DbLog::put(3), fcntl(2), fflush(3), malloc(3), memcpy(3), + and strerror(3). + + In addition, the _D_b_T_x_n_:_:_c_o_m_m_i_t method may fail and throw a + _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [EINVAL] + The transaction was aborted. + + The _D_b_T_x_n_:_:_a_b_o_r_t method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DBenv->tx_recover(3), + DbLockTab::vec(3), DbLog::get(3), fcntl(2), fflush(3), + memset(3), and strerror(3). + + [EINVAL] + The transaction was already aborted. + +SSEEEE AALLSSOO + _L_I_B_T_P_: _P_o_r_t_a_b_l_e_, _M_o_d_u_l_a_r _T_r_a_n_s_a_c_t_i_o_n_s _f_o_r _U_N_I_X, Margo + Seltzer, Michael Olson, USENIX proceedings, Winter 1992. + +BBUUGGSS + Nested transactions are not yet implemented. + + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___i_n_t_e_r_n_a_l(3), _d_b___t_h_r_e_a_d(3), _D_b(3), _D_b_c(3), _D_b_E_n_v(3), + _D_b_E_x_c_e_p_t_i_o_n(3), _D_b_I_n_f_o(3), _D_b_L_o_c_k(3), _D_b_L_o_c_k_T_a_b(3), _D_b_L_o_g(3), + _D_b_L_s_n(3), _D_b_M_p_o_o_l(3), _D_b_M_p_o_o_l_F_i_l_e(3), _D_b_t(3), _D_b_T_x_n(3), + _D_b_T_x_n_M_g_r(3) diff --git a/mozilla/db/man/mancxx.text/DbTxnMgr.0 b/mozilla/db/man/mancxx.text/DbTxnMgr.0 new file mode 100644 index 00000000000..a5a97765810 --- /dev/null +++ b/mozilla/db/man/mancxx.text/DbTxnMgr.0 @@ -0,0 +1,509 @@ + + +NNAAMMEE + DbTxnMgr - Db transaction management + +SSYYNNOOPPSSIISS + ##iinncclluuddee <> + + ssttaattiicc iinntt + DDbbTTxxnnMMggrr::::ooppeenn((ccoonnsstt cchhaarr **ddiirr,, + uu__iinntt3322__tt ffllaaggss,, iinntt mmooddee,, DDbbEEnnvv **ddbbeennvv,, DDbbTTxxnnMMggrr ****rreeggiioonnpp));; + + iinntt + DDbbTTxxnnMMggrr::::bbeeggiinn((DDbbTTxxnn **ppiidd,, DDbbTTxxnn ****ttiidd));; + + iinntt + DDbbTTxxnnMMggrr::::cchheecckkppooiinntt((uu__iinntt3322__tt kkbbyyttee,, uu__iinntt3322__tt mmiinn)) ccoonnsstt;; + + iinntt + DDbbTTxxnnMMggrr::::cclloossee(());; + + ssttaattiicc iinntt + DDbbTTxxnnMMggrr::::uunnlliinnkk((ccoonnsstt cchhaarr **ddiirr,, iinntt ffoorrccee,, DDbbEEnnvv **ddbbeennvv));; + + iinntt + DDbbTTxxnnMMggrr::::ssttaatt((DDBB__TTXXNN__SSTTAATT ****ssttaattpp,, vvooiidd **((**ddbb__mmaalllloocc))((ssiizzee__tt))));; + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of classes that provides a mod- + ular programming interface to transactions and record-ori- + ented file access. The library includes support for + transactions, locking, logging and file page caching, as + well as various indexed access methods. Many of the + classes (e.g., the file page caching class) are useful + independent of the other DB classes, although some classes + are explicitly based on other classes (e.g., transactions + and logging). For a general description of the DB pack- + age, see _d_b___i_n_t_r_o(3). + + This manual page describes the specific details of the Db + transaction support. The DbTxnMgr class is used in con- + junction with _D_b_T_x_n(3) to provide transaction semantics. + Full transaction support is provided by a collection of + modules that provide interfaces to the services required + for transaction processing. These services are recovery + (see _D_b_L_o_g(3)), concurrency control (see _D_b_L_o_c_k(3) and + _D_b_L_o_c_k_T_a_b(3)), and the management of shared data (see _D_b_M_- + _p_o_o_l(3) and _D_b_M_p_o_o_l_F_i_l_e(3)). Transaction semantics can be + applied to the access methods described in _D_b(3) through + method call parameters. + + The model intended for transactional use (and that is used + by the access methods) is that write-ahead logging is pro- + vided by _D_b_L_o_g(3) to record both before- and after-image + logging. Locking follows a two-phase protocol (i.e., all + locks are released at transaction commit). + + _D_b_T_x_n_M_g_r_:_:_o_p_e_n + The _D_b_T_x_n_M_g_r_:_:_o_p_e_n method copies a pointer, to the trans- + action region identified by the ddiirreeccttoorryy _d_i_r, into the + memory location referenced by _r_e_g_i_o_n_p. + + If the _d_b_e_n_v argument to _D_b_T_x_n_M_g_r_:_:_o_p_e_n was initialized + using _D_b_E_n_v_:_:_a_p_p_i_n_i_t, _d_i_r is interpreted as described by + _D_b_E_n_v(3). + + Otherwise, if _d_i_r is not NULL, it is interpreted relative + to the current working directory of the process. If _d_i_r + is NULL, the following environment variables are checked + in order: ``TMPDIR'', ``TEMP'', and ``TMP''. If one of + them is set, transaction region files are created relative + to the directory it specifies. If none of them are set, + the first possible one of the following directories is + used: _/_v_a_r_/_t_m_p, _/_u_s_r_/_t_m_p, _/_t_e_m_p, _/_t_m_p, _C_:_/_t_e_m_p and _C_:_/_t_m_p. + + All files associated with the transaction region are cre- + ated in this directory. This directory must already exist + when DbTxnMgr::open is called. If the transaction region + already exists, the process must have permission to read + and write the existing files. If the transaction region + does not already exist, it is optionally created and ini- + tialized. + + The _f_l_a_g_s and _m_o_d_e arguments specify how files will be + opened and/or created when they don't already exist. The + flags value is specified by oorr'ing together one or more of + the following values: + + DB_CREATE + Create any underlying files, as necessary. If the + files do not already exist and the DB_CREATE flag is + not specified, the call will fail. + + + DB_THREAD + Cause the DbTxnMgr handle returned by the _D_b_T_x_n_- + _M_g_r_:_:_o_p_e_n method to be useable by multiple threads + within a single address space, i.e., to be ``free- + threaded''. + + + DB_TXN_NOSYNC + On transaction commit, do not synchronously flush the + log. This means that transactions exhibit the ACI + (atomicity, consistency and isolation) properties, + but not D (durability), i.e., database integrity will + be maintained but it is possible that some number of + the most recently committed transactions may be + undone during recovery instead of being redone. + + The number of transactions that are potentially at + risk is governed by how often the log is checkpointed + (see _d_b___c_h_e_c_k_p_o_i_n_t(1)) and how many log updates can + fit on a single log page. + + All files created by the transaction subsystem are created + with mode _m_o_d_e (as described in _c_h_m_o_d(2)) and modified by + the process' umask value at the time of creation (see + _u_m_a_s_k(2)). The group ownership of created files is based + on the system and directory defaults, and is not further + specified by DB. + + The transaction subsystem is configured based on which set + methods have been used. It is expected that applications + will use a single DbEnv object as the argument to all of + the subsystems in the DB package. The fields of the DbEnv + object used by _D_b_T_x_n_M_g_r_:_:_o_p_e_n are described below. As + references to the DbEnv object may be maintained by _D_b_T_x_n_- + _M_g_r_:_:_o_p_e_n, it is necessary that the DbEnv object and mem- + ory it references be valid until the object is destroyed. + Any of the DbEnv fields that are not explicitly set will + default to appropriate values. + + The following fields in the DbEnv object may be initial- + ized, using the appropriate set method, before calling + _D_b_T_x_n_M_g_r_:_:_o_p_e_n: + + + void *(*db_errcall)(char *db_errpfx, char *buffer); + FILE *db_errfile; + const char *db_errpfx; + class ostream *db_error_stream; + int db_verbose; + The error fields of the DbEnv behave as described for + _D_b_E_n_v(3). + + DbLog *lg_info; + The logging region that is being used for this + transaction environment. The _l_g___i_n_f_o field contains + a return value from the method _D_b_L_o_g_:_:_o_p_e_n. LLooggggiinngg + iiss rreeqquuiirreedd ffoorr ttrraannssaaccttiioonn eennvviirroonnmmeennttss,, aanndd iitt iiss + aann eerrrroorr ttoo nnoott ssppeecciiffyy aa llooggggiinngg rreeggiioonn.. + + DbLockTab *lk_info; + The locking region that is being used for this + transaction environment. The _l_k___i_n_f_o field contains + a return value from the method _D_b_L_o_c_k_T_a_b_:_:_o_p_e_n. If + _l_k___i_n_f_o is NULL, no locking is done in this transac- + tion environment. + + u_int32_t tx_max; + The maximum number of simultaneous transactions that + are supported. This bounds the size of backing files + and is used to derive limits for the size of the lock + region and logfiles. When there are more than _t_x___m_a_x + concurrent transactions, calls to _D_b_T_x_n_M_g_r_:_:_b_e_g_i_n may + cause backing files to grow. If _t_x___m_a_x is 0, a + default value is used. + + int DbTxnMgr::recover(DbLog *logp, Dbt *DbLog::rec, + DbLsn *lsnp, int redo, void *info); + A method that is called by _D_b_T_x_n_:_:_a_b_o_r_t during trans- + action abort. This method takes five arguments: + + logp A pointer to the transaction log (DbLog *). + + DbLog::rec + A log record. + + lsnp A pointer to a log sequence number (DbLsn *). + + redo An integer value that is set to one of the fol- + lowing values: + + + DB_TXN_BACKWARD_ROLL + The log is being read backward to determine + which transactions have been committed and + which transactions were not (and should + therefore be aborted during recovery). + + + DB_TXN_FORWARD_ROLL + The log is being played forward, any trans- + action ids encountered that have not been + entered into the list referenced by _i_n_f_o + should be ignored. + + + DB_TXN_OPENFILES + The log is being read to open all the files + required to perform recovery. + + + DB_TXN_REDO + Redo the operation described by the log + record. + + + DB_TXN_UNDO + Undo the operation described by the log + record. + + info An opaque pointer used to reference the list of + transaction IDs encountered during recovery. + + If _r_e_c_o_v_e_r is NULL, the default is that only Db + access method operations are transaction protected, + and the default recover method will be used. + + The _D_b_T_x_n_M_g_r_:_:_o_p_e_n method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_T_x_n_M_g_r_:_:_b_e_g_i_n + The _D_b_T_x_n_M_g_r_:_:_b_e_g_i_n method creates a new transaction in + the transaction manager, copying a pointer to a DbTxn that + uniquely identifies it into the memory referenced by _t_i_d. + If the _p_i_d argument is non-NULL, the new transaction is a + nested transaction with the transaction indicated by _p_i_d + as its parent. + + Transactions may not span threads, i.e., each transaction + must begin and end in the same thread, and each transac- + tion may only be used by a single thread. + + The _D_b_T_x_n_M_g_r_:_:_b_e_g_i_n method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_T_x_n_M_g_r_:_:_c_l_o_s_e + The _D_b_T_x_n_M_g_r_:_:_c_l_o_s_e method detaches a process from the + transaction environment specified by the DbTxnMgr object. + All mapped regions are unmapped and any allocated + resources are freed. Any uncommitted transactions are + aborted. + + In addition, if the _d_i_r argument to _D_b_T_x_n_M_g_r_:_:_o_p_e_n was + NULL and _d_b_e_n_v was not initialized using _D_b_E_n_v_:_:_a_p_p_i_n_i_t, + all files created for this shared region will be removed, + as if _D_b_T_x_n_M_g_r_:_:_u_n_l_i_n_k were called. + + When multiple threads are using the DbTxnMgr handle con- + currently, only a single thread may call the _D_b_T_x_n_- + _M_g_r_:_:_c_l_o_s_e method. + + The _D_b_T_x_n_M_g_r_:_:_c_l_o_s_e method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + + _D_b_T_x_n_M_g_r_:_:_u_n_l_i_n_k + The _D_b_T_x_n_M_g_r_:_:_u_n_l_i_n_k method destroys the transaction + region identified by the directory _d_i_r, removing all files + used to implement the transaction region. (The directory + _d_i_r is not removed.) If there are processes that have + called _D_b_T_x_n_M_g_r_:_:_o_p_e_n without calling _D_b_T_x_n_M_g_r_:_:_c_l_o_s_e + (i.e., there are processes currently using the transaction + region), _D_b_T_x_n_M_g_r_:_:_u_n_l_i_n_k will fail without further + action, unless the force flag is set, in which case _D_b_T_x_n_- + _M_g_r_:_:_u_n_l_i_n_k will attempt to remove the transaction region + files regardless of any processes still using the transac- + tion region. + + The result of attempting to forcibly destroy the region + when a process has the region open is unspecified. Pro- + cesses using a shared memory region maintain an open file + descriptor for it. On UNIX systems, the region removal + should succeed and processes that have already joined the + region should continue to run in the region without + change, however processes attempting to join the transac- + tion region will either fail or attempt to create a new + region. On other systems, e.g., WNT, where the _u_n_l_i_n_k(2) + system call will fail if any process has an open file + descriptor for the file, the region removal will fail. + + In the case of catastrophic or system failure, database + recovery must be performed (see _d_b___r_e_c_o_v_e_r(1) or the + DB_RECOVER and DB_RECOVER_FATAL flags to + _D_b_E_n_v_:_:_a_p_p_i_n_i_t(3)). Alternatively, if recovery is not + required because no database state is maintained across + failures, it is possible to clean up a transaction region + by removing all of the files in the directory specified to + the _D_b_T_x_n_M_g_r_:_:_o_p_e_n method, as transaction region files are + never created in any directory other than the one speci- + fied to _D_b_T_x_n_M_g_r_:_:_o_p_e_n. Note, however, that this has the + potential to remove files created by the other DB subsys- + tems in this database environment. + + The _D_b_T_x_n_M_g_r_:_:_u_n_l_i_n_k method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on success. + + _D_b_T_x_n_M_g_r_:_:_c_h_e_c_k_p_o_i_n_t + The _D_b_T_x_n_M_g_r_:_:_c_h_e_c_k_p_o_i_n_t method syncs the underlying mem- + ory pool, writes a checkpoint record to the log and then + flushes the log. + + If either _k_b_y_t_e or _m_i_n is non-zero, the checkpoint is only + done if more than _m_i_n minutes have passed since the last + checkpoint, or if more than _k_b_y_t_e kilobytes of log data + have been written since the last checkpoint. + + The _D_b_T_x_n_M_g_r_:_:_c_h_e_c_k_p_o_i_n_t method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure, 0 on success, and + DB_INCOMPLETE if there were pages that needed to be writ- + ten but that _D_b_M_p_o_o_l_:_:_s_y_n_c _(_3_) (see _D_b_M_p_o_o_l _(_3_)_) was + unable to write immediately. In this case, the _D_b_T_x_n_- + _M_g_r_:_:_c_h_e_c_k_p_o_i_n_t call should be retried. + + The _D_b_T_x_n_M_g_r_:_:_c_h_e_c_k_p_o_i_n_t method is based on the C + _t_x_n___c_h_e_c_k_p_o_i_n_t function, which is the underlying function + used by the _d_b___c_h_e_c_k_p_o_i_n_t(1) utility. See the source code + for the _d_b___c_h_e_c_k_p_o_i_n_t utility for an example of using + _t_x_n___c_h_e_c_k_p_o_i_n_t in a UNIX environment. + + _D_b_T_x_n_M_g_r_:_:_s_t_a_t + The _D_b_T_x_n_M_g_r_:_:_s_t_a_t + + method creates a statistical structure and copies pointers + to it into user-specified memory locations. + + Statistical structures are created in allocated memory. + If _d_b___m_a_l_l_o_c is non-NULL, it is called to allocate the + memory, otherwise, the library function _m_a_l_l_o_c(3) is used. + + The function _d_b___m_a_l_l_o_c must match the calling conventions + of the _m_a_l_l_o_c(3) library routine. Regardless, the caller + is responsible for deallocating the returned memory. To + deallocate the returned memory, free each returned memory + pointer; pointers inside the memory do not need to be + individually freed. + + + The transaction region statistics are stored in a struc- + ture of type DB_TXN_STAT (typedef'd in ). The + following DB_TXN_STAT fields will be filled in: + + DbLsn st_last_ckp; + The LSN of the last checkpoint. + DbLsn st_pending_ckp; + The LSN of any checkpoint that is currently in + progress. If _s_t___p_e_n_d_i_n_g___c_k_p is the same as + _s_t___l_a_s_t___c_k_p there is no checkpoint in progress. + time_t st_time_ckp; + The time the last completed checkpoint finished (as + returned by _t_i_m_e(2)). + u_int32_t st_last_txnid; + The last transaction ID allocated. + u_int32_t st_maxtxns; + The maximum number of active transactions supported + by the region. + u_int32_t st_naborts; + The number of transactions that have aborted. + u_int32_t st_nactive; + The number of transactions that are currently active. + u_int32_t st_nbegins; + The number of transactions that have begun. + u_int32_t st_ncommits; + The number of transactions that have committed. + u_int32_t ; + The number of times that a thread of control was + forced to wait before obtaining the region lock. + u_int32_t ; + The number of times that a thread of control was able + to obtain the region lock without waiting. + + DB_TXN_ACTIVE *st_txnarray; + A pointer to an array of _s_t___n_a_c_t_i_v_e DB_TXN_ACTIVE + structures, describing the currently active transac- + tions. The following fields of the DB_TXN_ACTIVE + structure (typedef'd in ) will be filled + in: + + + u_int32_t txnid; + The transaction ID as returned by _D_b_T_x_n_- + _M_g_r_:_:_b_e_g_i_n(3). + DbLsn lsn; + The LSN of the transaction-begin record. +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _d_b___t_x_n: + + DB_HOME + If the _d_b_e_n_v argument to _D_b_T_x_n_M_g_r_:_:_o_p_e_n was initial- + ized using _d_b___a_p_p_i_n_i_t, the environment variable + DB_HOME may be used as the path of the database home + for the interpretation of the _d_i_r argument to _D_b_T_x_n_- + _M_g_r_:_:_o_p_e_n, as described in _d_b___a_p_p_i_n_i_t(3). + + TMPDIR + If the _d_b_e_n_v argument to _D_b_T_x_n_M_g_r_:_:_o_p_e_n was NULL or + not initialized using _d_b___a_p_p_i_n_i_t, the environment + variable TMPDIR may be used as the directory in which + to create the transaction region, as described in the + _D_b_T_x_n_M_g_r_:_:_o_p_e_n section above. + +EERRRROORRSS + Methods marked as returning _e_r_r_n_o will, by default, throw + an exception that encapsulates the error information. The + default error behavior can be changed, see _D_b_E_x_c_e_p_t_i_o_n(3). + + The _D_b_T_x_n_M_g_r_:_:_o_p_e_n method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DbTxnMgr::unlink(3), + close(2), db_version(3), fcntl(2), fflush(3), lseek(2), + malloc(3), memcpy(3), memset(3), mmap(2), munmap(2), + open(2), sigfillset(3), sigprocmask(2), stat(2), str- + cpy(3), strdup(3), strerror(3), strlen(3), time(3), + unlink(2), and write(2). + + In addition, the _D_b_T_x_n_M_g_r_:_:_o_p_e_n method may fail and throw + a _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [EINVAL] + An invalid flag value or parameter was specified. + + The DB_THREAD flag was specified and spinlocks are + not implemented for this architecture. + + The _d_b_e_n_v parameter was NULL. + + [EAGAIN] + The shared memory region was locked and (repeatedly) + unavailable. + + The _D_b_T_x_n_M_g_r_:_:_b_e_g_i_n method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DbLog::put(3), + fcntl(2), fflush(3), lseek(2), malloc(3), memcpy(3), mem- + set(3), mmap(2), munmap(2), strerror(3), and write(2). + + In addition, the _D_b_T_x_n_M_g_r_:_:_b_e_g_i_n method may fail and throw + a _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [ENOSPC] + The maximum number of concurrent transactions has + been reached. + + The _D_b_T_x_n_M_g_r_:_:_c_h_e_c_k_p_o_i_n_t method may fail and throw a _D_b_E_x_- + _c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DbLog::compare(3), + DbLog::put(3), DbMpool::sync(3), fcntl(2), fflush(3), mal- + loc(3), memcpy(3), memset(3), strerror(3), and time(3). + + [EINVAL] + An invalid flag value or parameter was specified. + + The _D_b_T_x_n_M_g_r_:_:_c_l_o_s_e method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DbLog::flush(3), + DbTxn::abort(3), close(2), fcntl(2), fflush(3), munmap(2), + and strerror(3). + + The _D_b_T_x_n_M_g_r_:_:_u_n_l_i_n_k method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: close(2), fcntl(2), + fflush(3), malloc(3), memcpy(3), memset(3), mmap(2), mun- + map(2), open(2), sigfillset(3), sigprocmask(2), stat(2), + strcpy(3), strdup(3), strerror(3), strlen(3), and + unlink(2). + + In addition, the _D_b_T_x_n_M_g_r_:_:_u_n_l_i_n_k method may fail and + throw a _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following + conditions: + + [EBUSY] + The shared memory region was in use and the force + flag was not set. + + The _D_b_T_x_n_M_g_r_:_:_s_t_a_t method may fail and throw a _D_b_E_x_c_e_p_- + _t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: fcntl(2), and + malloc(3). + +SSEEEE AALLSSOO + _L_I_B_T_P_: _P_o_r_t_a_b_l_e_, _M_o_d_u_l_a_r _T_r_a_n_s_a_c_t_i_o_n_s _f_o_r _U_N_I_X, Margo + Seltzer, Michael Olson, USENIX proceedings, Winter 1992. + +BBUUGGSS + Nested transactions are not yet implemented. + + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___i_n_t_e_r_n_a_l(3), _d_b___t_h_r_e_a_d(3), _D_b(3), _D_b_c(3), _D_b_E_n_v(3), + _D_b_E_x_c_e_p_t_i_o_n(3), _D_b_I_n_f_o(3), _D_b_L_o_c_k(3), _D_b_L_o_c_k_T_a_b(3), _D_b_L_o_g(3), + _D_b_L_s_n(3), _D_b_M_p_o_o_l(3), _D_b_M_p_o_o_l_F_i_l_e(3), _D_b_t(3), _D_b_T_x_n(3), + _D_b_T_x_n_M_g_r(3) diff --git a/mozilla/db/man/mancxx.text/Dbc.0 b/mozilla/db/man/mancxx.text/Dbc.0 new file mode 100644 index 00000000000..5ed20841721 --- /dev/null +++ b/mozilla/db/man/mancxx.text/Dbc.0 @@ -0,0 +1,491 @@ + + +NNAAMMEE + Dbc - database sequential access functions + +SSYYNNOOPPSSIISS + ##iinncclluuddee <> + + iinntt + DDbbcc::::cclloossee((vvooiidd));; + + iinntt + DDbbcc::::ddeell((uu__iinntt3322__tt ffllaaggss));; + + iinntt + DDbbcc::::ggeett((DDbbtt **kkeeyy,, DDbbtt **ddaattaa,, uu__iinntt3322__tt ffllaaggss));; + + iinntt + DDbbcc::::ppuutt((DDbbtt **kkeeyy,, DDbbtt **ddaattaa,, uu__iinntt3322__tt ffllaaggss));; + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of classes that provides a mod- + ular programming interface to transactions and record-ori- + ented file access. The library includes support for + transactions, locking, logging and file page caching, as + well as various indexed access methods. Many of the + classes (e.g., the file page caching class) are useful + independent of the other DB classes, although some classes + are explicitly based on other classes (e.g., transactions + and logging). For a general description of the DB pack- + age, see _d_b___i_n_t_r_o(3). + + This manual page describes the specific details of the + cursor support for the access methods in _D_b_(_3_). + + The _D_b_c functions are the library interface supporting + sequential access to the records stored by the access + methods of the Db library. Cursors are created by calling + _D_b_:_:_c_u_r_s_o_r method described in _D_b(3), which returns a + pointer to a Dbc object. + + Each cursor maintains positioning information within a set + of key/data pairs. In the presence of transactions, cur- + sors are only valid within the context of a single trans- + action, the one specified during the _D_b_:_:_c_u_r_s_o_r call + described in _D_b(3). All cursor operations will be exe- + cuted in the context of that transaction. Before aborting + or committing a transaction, all cursors used within that + transaction must be closed. In the presence of transac- + tions, the application must call _D_b_T_x_n_:_:_a_b_o_r_t if any of + the cursor operations returns that a deadlock (EAGAIN) or + system failure occurred. + + When locking is enabled, page locks are retained between + consecutive cursor calls. For this reason, in the pres- + ence of locking, applications should discard cursors as + soon as they are done with them. Calling the _D_b_:_:_c_l_o_s_e + method (see _D_b(3)) discards any cursors opened in the con- + text of a particular Db object returned by the _D_b_:_:_o_p_e_n + call. + + The methods of the Dbc are defined as follows: + + int Dbc::close(); + A method that discards the cursor. No further refer- + ences to the Dbc object should be made. + + The _D_b_c_:_:_c_l_o_s_e method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure and 0 on suc- + cess. + + int Dbc::del(u_int32_t flags); + A method that deletes the key/data pair currently + referenced by the cursor. + + The _f_l_a_g_s parameter is currently unused, and must be + set to 0. + + The cursor position is unchanged after a delete and + subsequent calls to cursor functions expecting the + cursor to reference an existing key will fail. + + The _D_b_c_:_:_d_e_l method throws a _D_b_E_x_c_e_p_t_i_o_n(3) or + returns the value of _e_r_r_n_o on failure, 0 on success, + and DB_KEYEMPTY if the element has already been + deleted. + + int Dbc::get(Dbt *key, Dbt *data, u_int32_t flags); + A method that retrieves key/data pairs from the + database. The address and length of the key are + returned in the object referenced by _k_e_y (except for + the case of the DB_SET flag where the _k_e_y object is + unchanged), and the address and length of the data + are returned in the object referenced by _d_a_t_a. + + Modifications to the database during a sequential + scan will be reflected in the scan, i.e. records + inserted behind a cursor will not be returned while + records inserted in front of a cursor will be + returned. + + In recno databases, missing entries (i.e., entries + that were never explicitly created or that were cre- + ated and then deleted), will be skipped during a + sequential scan. + + If multiple threads or processes insert items into + the same database file without using locking, the + results are undefined. For more detail, see the sec- + tion below on cursor stability. + + The parameter _f_l_a_g_s must be set to exactly one of the + following values: + + + DB_FIRST + The cursor is set to reference the first + key/data pair of the database, and that pair is + returned. In the presence of duplicate key val- + ues, the first data item in the set of dupli- + cates is returned. + + If the database is empty, the _D_b_c_:_:_g_e_t method + will return DB_NOTFOUND. + + + DB_LAST + The cursor is set to reference the last key/data + pair of the database, and that pair is returned. + In the presence of duplicate key values, the + last data item in the set of duplicates is + returned. + + If the database is empty, the _D_b_c_:_:_g_e_t method + will return DB_NOTFOUND. + + + DB_NEXT + If the cursor is not yet initialized, DB_NEXT is + identical to DB_FIRST. + + Otherwise, move the cursor to the next key/data + pair of the database, and that pair is returned. + In the presence of duplicate key values, the + value of the key may not change. + + If the cursor is already on the last record in + the database, the _D_b_c_:_:_g_e_t method will return + DB_NOTFOUND. + + + DB_PREV + If the cursor is not yet initialized, DB_PREV is + identical to DB_LAST. + + Otherwise, move the cursor to the previous + key/data pair of the database, and that pair is + returned. In the presence of duplicate key val- + ues, the value of the key may not change. + + If the cursor is already on the first record in + the database, the _D_b_c_:_:_g_e_t method will return + DB_NOTFOUND. + + + DB_CURRENT + Return the key/data pair currently referenced by + the cursor. + + + If the cursor key/data pair has been deleted, + the _D_b_c_:_:_g_e_t method will return DB_KEYEMPTY. + + If the cursor is not yet initialized, the + _D_b_c_:_:_g_e_t method will return EINVAL. + + + DB_SET + Move the cursor to the specified key/data pair + of the database, and return the datum associated + with the given key. + + In the presence of duplicate key values, + _D_b_c_:_:_g_e_t will return the first data item for the + given key. + + If the database is a recno database and the + requested key exists, but was never explicitly + created by the application or was later deleted, + the _D_b_c_:_:_g_e_t method returns DB_KEYEMPTY. + + If no matching keys are found, the _D_b_c_:_:_g_e_t + method will return DB_NOTFOUND. + + + DB_SET_RANGE + The DB_SET_RANGE flag is identical to the DB_SET + flag, except that the key is returned as well as + the data item, and, in the case of the btree + access method, the returned key/data pair is the + smallest key greater than or equal to the speci- + fied key (as determined by the comparison func- + tion), permitting partial key matches and range + searches. + + + DB_SET_RECNO + Move the cursor to the specific numbered record + of the database, and return the associated + key/data pair. The _d_a_t_a field of the specified + _k_e_y must be a pointer to a memory location from + which a _d_b___r_e_c_n_o___t may be read, as described in + _D_b_t(3). This memory location will be read to + determine the record to be retrieved. + + For DB_SET_RECNO to be specified, the underlying + database must be of type btree and it must have + been created with the DB_RECNUM flag (see + _D_b_:_:_o_p_e_n in _D_b(3)). + + + DB_GET_RECNO + Return the record number associated with the + cursor. The record number will be returned in + the data Dbt as described in _D_b_t(3). The _k_e_y + parameter is ignored. + + For DB_GET_RECNO to be specified, the underlying + database must be of type btree and it must have + been created with the DB_RECNUM flag (see + _D_b_:_:_o_p_e_n in _D_b(3)). + + Otherwise, the _D_b_c_:_:_g_e_t method throws a _D_b_E_x_c_e_p_- + _t_i_o_n(3) or returns the value of _e_r_r_n_o on failure and + 0 on success. + + If _D_b_c_:_:_g_e_t fails for any reason, the state of the + cursor will be unchanged. + + int Dbc::put(Dbt *key, Dbt *data, u_int32_t flags); + A method that stores key/data pairs into the + database. + + The _f_l_a_g_s parameter must be set to exactly one of the + following values: + + + DB_AFTER + In the case of the btree and hash access meth- + ods, insert the data element as a duplicate ele- + ment of the key referenced by the cursor. The + new element appears immediately after the cur- + rent cursor position. It is an error to specify + DB_AFTER if the underlying btree or hash + database was not created with the DB_DUP flag. + The _k_e_y parameter is ignored. + + In the case of the recno access method, it is an + error to specify DB_AFTER if the underlying + recno database was not created with the + DB_RENUMBER flag. If the DB_RENUMBER flag was + specified, a new key is created, all records + after the inserted item are automatically renum- + bered, and the key of the new record is returned + in the object referenced by the parameter _k_e_y. + The initial value of the _k_e_y parameter is + ignored. See _D_b_:_:_o_p_e_n in _D_b(3) for more infor- + mation. + + If the cursor is not yet initialized, the + _D_b_c_:_:_p_u_t method will return EINVAL. + + + DB_BEFORE + In the case of the btree and hash access meth- + ods, insert the data element as a duplicate ele- + ment of the key referenced by the cursor. The + new element appears immediately before the + current cursor position. It is an error to + specify DB_BEFORE if the underlying btree or + hash database was not created with the DB_DUP + flag. The _k_e_y parameter is ignored. + + In the case of the recno access method, it is an + error to specify DB_BEFORE if the underlying + recno database was not created with the + DB_RENUMBER flag. If the DB_RENUMBER flag was + specified, a new key is created, the current + record and all records after it are automati- + cally renumbered, and the key of the new record + is returned in the object referenced by the + parameter _k_e_y. The initial value of the _k_e_y + parameter is ignored. See _D_b_:_:_o_p_e_n in _D_b(3) for + more information. + + If the cursor is not yet initialized, the + _D_b_c_:_:_p_u_t method will return EINVAL. + + + DB_CURRENT + Overwrite the data of the key/data pair refer- + enced by the cursor with the specified data + item. + + The _k_e_y parameter is ignored. + + If the cursor is not yet initialized, the + _D_b_c_:_:_p_u_t method will return EINVAL. + + + DB_KEYFIRST + In the case of the btree and hash access meth- + ods, insert the specified key/data pair into the + database. If the key already exists in the + database, the inserted data item is added as the + first of the data items for that key. + + The DB_KEYFIRST flag may not be specified to the + recno access method. + + + DB_KEYLAST + Insert the specified key/data pair into the + database. If the key already exists in the + database, the inserted data item is added as the + last of the data items for that key. + + The DB_KEYLAST flag may not be specified to the + recno access method. + + If the cursor record has been deleted, the _D_b_c_:_:_p_u_t + method will return DB_KEYEMPTY. + + Otherwise, the _D_b_c_:_:_p_u_t method throws a _D_b_E_x_c_e_p_- + _t_i_o_n(3) or returns the value of _e_r_r_n_o on failure and + 0 on success. + + If _D_b_c_:_:_p_u_t fails for any reason, the state of the + cursor will be unchanged. If _D_b_c_:_:_p_u_t succeeds and + an item is inserted into the database, the cursor is + always positioned to reference the newly inserted + item. + +CCUURRSSOORR SSTTAABBIILLIITTYY + In the absence of locking, no guarantees are made about + the stability of cursors in different processes or + threads. However, the btree and recno access methods + guarantee that cursor operations, interspersed with other + cursor or non-cursor operations in the same thread of con- + trol (i.e., thread or single-threaded process), will + always return keys in order and will return each non- + deleted key/data pair exactly once. Because the hash + access method uses a dynamic hashing algorithm, it cannot + guarantee any form of stability in the presence of inserts + and deletes unless locking is performed. + + If locking was specified when the Db file was opened, but + transactions are not in effect, the access methods provide + repeatable reads with respect to the cursor. That is, a + DB_CURRENT call on the cursor is guaranteed to return the + same record as was returned on the last call to the cur- + sor. + + In the presence of transactions, the access method calls + between _D_b_T_x_n_M_g_r_:_:_b_e_g_i_n and _D_b_T_x_n_:_:_a_b_o_r_t or _D_b_T_x_n_:_:_c_o_m_m_i_t + provide degree 3 consistency. For all access methods, a + cursor scan of the database performed within the context + of a transaction is guaranteed to return each key/data + pair once and only once, except in the following case. + If, while performing a cursor scan using the hash access + method, the transaction performing the scan inserts a new + pair into the database, it is possible that duplicate + key/data pairs will be returned. + +EERRRROORRSS + Methods marked as returning _e_r_r_n_o will, by default, throw + an exception that encapsulates the error information. The + default error behavior can be changed, see _D_b_E_x_c_e_p_t_i_o_n(3). + + The _D_b_c_:_:_c_l_o_s_e method may fail and throw a _D_b_E_x_c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DbLock::get(3), + DbLock::put(3), DbLockTab::id(3), DbLockTab::vec(3), + DbLog::put(3), DbMpoolFile::get(3), DbMpoolFile::put(3), + DbMpoolFile::set(3), calloc(3), fcntl(2), fflush(3), mal- + loc(3), memcpy(3), memmove(3), memset(3), realloc(3), and + strerror(3). + + In addition, the _D_b_c_:_:_c_l_o_s_e method may fail and throw a + _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [EAGAIN] + A lock was unavailable. + + [EPERM] + Database corruption was detected. All subsequent + database calls (other than _D_b_:_:_c_l_o_s_e) will return + EPERM. + + The _D_b_c_:_:_d_e_l method may fail and throw a _D_b_E_x_c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: Db::del(3), + DbLock::get(3), DbLock::put(3), DbLockTab::id(3), DbLock- + Tab::vec(3), DbLog::put(3), DbMpoolFile::get(3), DbM- + poolFile::put(3), DbMpoolFile::set(3), calloc(3), + fcntl(2), fflush(3), malloc(3), memcpy(3), memmove(3), + memset(3), realloc(3), and strerror(3). + + In addition, the _D_b_c_:_:_d_e_l method may fail and throw a + _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [EAGAIN] + A lock was unavailable. + + [EINVAL] + An invalid flag value or parameter was specified. + + [EPERM] + Database corruption was detected. All subsequent + database calls (other than _D_b_:_:_c_l_o_s_e) will return + EPERM. + + The _D_b_c_:_:_g_e_t method may fail and throw a _D_b_E_x_c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: Db::get(3), + DbLock::get(3), DbLock::put(3), DbLockTab::id(3), DbLock- + Tab::vec(3), DbLog::put(3), DbMpoolFile::get(3), DbM- + poolFile::put(3), DbMpoolFile::set(3), calloc(3), + fcntl(2), fflush(3), malloc(3), memcmp(3), memcpy(3), mem- + move(3), memset(3), realloc(3), and strerror(3). + + In addition, the _D_b_c_:_:_g_e_t method may fail and throw a + _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + + [EAGAIN] + A lock was unavailable. + + [EINVAL] + An invalid flag value or parameter was specified. + + The DB_THREAD flag was specified to the _D_b_:_:_o_p_e_n + method described in _D_b(3) and neither the DB_DBT_MAL- + LOC or DB_DBT_USERMEM flags were set in the Dbt. + + [EPERM] + Database corruption was detected. All subsequent + database calls (other than _D_b_:_:_c_l_o_s_e) will return + EPERM. + + The _D_b_c_:_:_p_u_t method may fail and throw a _D_b_E_x_c_e_p_t_i_o_n(3) + + or return _e_r_r_n_o for any of the errors specified for the + following DB and library functions: DbLock::get(3), + DbLock::put(3), DbLockTab::id(3), DbLockTab::vec(3), + DbLog::put(3), DbMpoolFile::get(3), DbMpoolFile::put(3), + DbMpoolFile::set(3), calloc(3), fcntl(2), fflush(3), mal- + loc(3), memcmp(3), memcpy(3), memmove(3), memset(3), real- + loc(3), and strerror(3). + + In addition, the _D_b_c_:_:_p_u_t method may fail and throw a + _D_b_E_x_c_e_p_t_i_o_n(3) or return _e_r_r_n_o for the following condi- + tions: + + [EACCES] + An attempt was made to modify a read-only database. + + [EAGAIN] + A lock was unavailable. + + [EINVAL] + An invalid flag value or parameter was specified. + + [EPERM] + Database corruption was detected. All subsequent + database calls (other than _D_b_:_:_c_l_o_s_e) will return + EPERM. + +SSEEEE AALLSSOO + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___i_n_t_e_r_n_a_l(3), _d_b___t_h_r_e_a_d(3), _D_b(3), _D_b_c(3), _D_b_E_n_v(3), + _D_b_E_x_c_e_p_t_i_o_n(3), _D_b_I_n_f_o(3), _D_b_L_o_c_k(3), _D_b_L_o_c_k_T_a_b(3), _D_b_L_o_g(3), + _D_b_L_s_n(3), _D_b_M_p_o_o_l(3), _D_b_M_p_o_o_l_F_i_l_e(3), _D_b_t(3), _D_b_T_x_n(3), + _D_b_T_x_n_M_g_r(3) diff --git a/mozilla/db/man/mancxx.text/Dbt.0 b/mozilla/db/man/mancxx.text/Dbt.0 new file mode 100644 index 00000000000..72f1cb1db3c --- /dev/null +++ b/mozilla/db/man/mancxx.text/Dbt.0 @@ -0,0 +1,249 @@ + + +NNAAMMEE + Dbt - Db key/data class + +SSYYNNOOPPSSIISS + vvooiidd **DDbbtt::::ggeett__ddaattaa(()) ccoonnsstt;; + vvooiidd DDbbtt::::sseett__ddaattaa((vvooiidd **));; + + uu__iinntt3322__tt DDbbtt::::ggeett__ssiizzee(()) ccoonnsstt;; + vvooiidd DDbbtt::::sseett__ssiizzee((uu__iinntt3322__tt));; + + uu__iinntt3322__tt DDbbtt::::ggeett__uulleenn(()) ccoonnsstt;; + vvooiidd DDbbtt::::sseett__uulleenn((uu__iinntt3322__tt));; + + uu__iinntt3322__tt DDbbtt::::ggeett__ddlleenn(()) ccoonnsstt;; + vvooiidd DDbbtt::::sseett__ddlleenn((uu__iinntt3322__tt));; + + uu__iinntt3322__tt DDbbtt::::ggeett__ddooffff(()) ccoonnsstt;; + vvooiidd DDbbtt::::sseett__ddooffff((uu__iinntt3322__tt));; + + uu__iinntt3322__tt DDbbtt::::ggeett__ffllaaggss(()) ccoonnsstt;; + vvooiidd DDbbtt::::sseett__ffllaaggss((uu__iinntt3322__tt));; + + DDbbtt::::DDbbtt((vvooiidd **ddaattaa,, ssiizzee__tt ssiizzee));; + DDbbtt::::DDbbtt(());; + DDbbtt::::~~DDbbtt(());; + DDbbtt::::DDbbtt((ccoonnsstt DDbbtt &&));; + DDbbtt::::DDbbtt &&ooppeerraattoorr == ((ccoonnsstt DDbbtt &&));; + +DDEESSCCRRIIPPTTIIOONN + The DB library is a family of classes that provides a mod- + ular programming interface to transactions and record-ori- + ented file access. The library includes support for + transactions, locking, logging and file page caching, as + well as various indexed access methods. Many of the + classes (e.g., the file page caching class) are useful + independent of the other DB classes, although some classes + are explicitly based on other classes (e.g., transactions + and logging). For a general description of the DB pack- + age, see _d_b___i_n_t_r_o(3). This manual page describes the spe- + cific details of the _D_b_t class, used to encode keys and + data items in a database. + + +KKEEYY//DDAATTAA PPAAIIRRSS + Storage and retrieval for the Db access methods are based + on key/data pairs. Both key and data items are repre- + sented by Dbt objects. + + Key and data byte strings may reference strings of essen- + tially unlimited length, although any two keys must fit + into available memory at the same time so that they may be + compared, and any one data item must fit into available + memory so that it may be returned. + + The Dbt class provides simple access to an underlying data + structure, whose elements can be examined or changed using + the _s_e_t__ or _g_e_t__ methods. The remainder of the manual + page sometimes refers to these accesses using the + underlying name, e.g., simply _u_l_e_n instead of _g_e_t___u_l_e_n and + _s_e_t___u_l_e_n. The constructors set all elements of the under- + lying structure to zero. The constructor with two argu- + ments has the effect of setting all elements to zero + except for the specified _d_a_t_a and _s_i_z_e elements. In the + case where the _f_l_a_g_s structure element is 0, when being + provided a key or data item by the application, the DB + package expects the _d_a_t_a object to point to a byte string + of _s_i_z_e bytes. When returning a key/data item to the + application, the DB package will store into the _d_a_t_a + object a pointer to a byte string of _s_i_z_e bytes. BByy + ddeeffaauulltt,, tthhee mmeemmoorryy rreeffeerreenncceedd bbyy tthhiiss ssttoorreedd ppooiinntteerr iiss + oonnllyy vvaalliidd uunnttiill tthhee nneexxtt ccaallll ttoo tthhee DDBB ppaacckkaaggee uussiinngg tthhee + DDbb hhaannddllee rreettuurrnneedd bbyy _D_b_:_:_o_p_e_n. + + TThhee aacccceessss mmeetthhooddss pprroovviiddee nnoo gguuaarraanntteeeess aabboouutt bbyyttee ssttrriinngg + aalliiggnnmmeenntt,, aanndd aapppplliiccaattiioonnss aarree rreessppoonnssiibbllee ffoorr mmaaiinnttaaiinn-- + iinngg aannyy nneecceessssaarryy aalliiggnnmmeenntt.. Use the DB_DBT_USERMEM flag + to cause returned items to be placed in memory of arbi- + trary alignment. Although Java normally maintains proper + alignment of byte arrays, the set_offset method can be + used to specify unaligned addresses. Unaligned address + accesses that are not supported by the underlying hardware + may be reported as an exception, or may stop the running + Java program. + + The elements of the structure underlying the Dbt class are + defined as follows: + + void *data; + A pointer to a byte string. This element is accessed + using _g_e_t___d_a_t_a and _s_e_t___d_a_t_a, and may be initialized + using one of the constructors. + + int offset; + The number of bytes offset into the _d_a_t_a array to + determine the portion of the array actually used. + This element is accessed using _g_e_t___o_f_f_s_e_t and + _s_e_t___o_f_f_s_e_t. + + u_int32_t size; + The length of _d_a_t_a, in bytes. This element is + accessed using _g_e_t___s_i_z_e and _s_e_t___s_i_z_e, and may be ini- + tialized using the constructor with two arguments. + + u_int32_t ulen; + The size of the user's buffer (referenced by _d_a_t_a), + in bytes. This location is not written by the Db + functions. See the DB_DBT_USERMEM flag for more + information. This element is accessed using _g_e_t___u_l_e_n + and _s_e_t___u_l_e_n. + + u_int32_t dlen; + The length of the partial record being read or + written by the application, in bytes. See the + DB_DBT_PARTIAL flag for more information. This ele- + ment is accessed using _g_e_t___d_l_e_n and _s_e_t___d_l_e_n. + + u_int32_t doff; + The offset of the partial record being read or writ- + ten by the application, in bytes. See the + DB_DBT_PARTIAL flag for more information. This ele- + ment is accessed using _g_e_t___d_o_f_f and _s_e_t___d_o_f_f. + + u_int32_t flags; + This element is accessed using _g_e_t___f_l_a_g_s and + _s_e_t___f_l_a_g_s. The flags value is specified by oorr'ing + together one or more of the following values: + + + DB_DBT_MALLOC + Ignored except when retrieving information from + a database, e.g., a _D_b_:_:_g_e_t or _D_b_c_:_:_g_e_t call. + This flag causes Db to allocate memory for the + returned key or data item (using _m_a_l_l_o_c(3), or + the user-specified malloc method) and return a + pointer to it in the _d_a_t_a field of the key or + data Dbt object. The allocated memory becomes + the responsibility of the calling application. + It is an error to specify both DB_DBT_MALLOC and + DB_DBT_USERMEM. + + + DB_DBT_USERMEM + Ignored except when retrieving information from + a database, e.g., a _D_b_:_:_g_e_t or _D_b_c_:_:_g_e_t call. + The _d_a_t_a field of the key or data object must + reference memory that is at least _u_l_e_n bytes in + length. If the length of the requested item is + less than or equal to that number of bytes, the + item is copied into the memory referenced by the + _d_a_t_a field. Otherwise, an error is returned, + the _s_i_z_e field is set to the length needed for + the requested item, and the _e_r_r_n_o variable is + set to ENOMEM. It is an error to specify both + DB_DBT_MALLOC and DB_DBT_USERMEM. + + + DB_DBT_PARTIAL + Ignored except when specified for a data parame- + ter, where this flag causes the partial + retrieval or storage of an item. If the calling + application is doing a get, the _d_l_e_n bytes + starting _d_o_f_f bytes from the beginning of the + retrieved data record are returned as if they + comprised the entire record. If any or all of + the specified bytes do not exist in the record, + the get is successful and the existing bytes or + 0 bytes are returned. + + For example, if the data portion of a retrieved + record was 100 bytes, and a partial retrieval + was done using a Dbt having a _d_l_e_n field of 20 + and a _d_o_f_f field of 85, the get call would suc- + ceed, the _d_a_t_a field would reference the last 15 + bytes of the record, and the _s_i_z_e field would be + set to 15. + + If the calling application is doing a put, the + _d_l_e_n bytes starting _d_o_f_f bytes from the begin- + ning of the specified key's data record are + replaced by the data specified by the _d_a_t_a and + _s_i_z_e objects. If _d_l_e_n is smaller than _s_i_z_e, the + record will grow, and if _d_l_e_n is larger than + _s_i_z_e, the record will shrink. If the specified + bytes do not exist, the record will be extended + using nul bytes as necessary, and the put call + will succeed. + + It is an error to attempt a partial put using + the _D_b_:_:_p_u_t method in a database that supports + duplicate records. Partial puts in databases + supporting duplicate records must be done using + a _D_b_:_:_c_u_r_s_o_r method. It is an error to attempt + a partial put with differing _d_l_e_n and _s_i_z_e val- + ues in a recno database with fixed-length + records. + + For example, if the data portion of a retrieved + record was 100 bytes, and a partial put was done + using a Dbt having a _d_l_e_n field of 20, a _d_o_f_f + field of 85, and a _s_i_z_e field of 30, the result- + ing record would be 115 bytes in length, where + the last 30 bytes would be those specified by + the put call. + + The default algorithm of associating returned key or data + items with the Db handle returned by _D_b_:_:_o_p_e_n(3) will + obviously not work when Db handles are being used concur- + rently by multiple threads within a process, i.e, when + DB_THREAD was specified to _D_b_:_:_o_p_e_n(3). WWhheenn mmuullttiippllee + tthhrreeaaddss aarree uussiinngg tthhee rreettuurrnneedd DDbb hhaannddllee ccoonnccuurrrreennttllyy,, + eeiitthheerr tthhee DDBB__DDBBTT__MMAALLLLOOCC oorr DDBB__DDBBTT__UUSSEERRMMEEMM ffllaaggss mmuusstt bbee + ssppeecciiffiieedd ffoorr aannyy DDbbtt uusseedd ffoorr kkeeyy oorr ddaattaa rreettrriieevvaall.. + +LLOOGGIICCAALL RREECCOORRDD NNUUMMBBEERRSS + In all cases for the recno access method, and when calling + the _D_b_:_:_g_e_t and _D_b_c_:_:_g_e_t functions with the DB_GET_RECNO + flag specified, the _d_a_t_a + + field of the key must be a pointer to a memory location of + type _d_b___r_e_c_n_o___t, as typedef'd in the include + file. This type is a 32-bit unsigned type, (which limits + the number of logical records in a recno database, and the + maximum logical record which may be directly retrieved + from a btree database, to 4,294,967,296). The _s_i_z_e field + of the key should be the size of that type, e.g., + + in the C programming language, ``sizeof(db_recno_t)''. + + Logical record numbers are 1-based, not 0-based, i.e., the + first record in the database is record number 1. + +BBUUGGSS + The Db access methods provide no guarantees about byte + string alignment, and applications are responsible for + maintaining any necessary alignment. + + The name Dbt is a mnemonic for ``data base thang'', and + was used because noone could think of a reasonable name + that wasn't already in use somewhere else. + +SSEEEE AALLSSOO + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___i_n_t_e_r_n_a_l(3), _d_b___t_h_r_e_a_d(3), _D_b(3), _D_b_c(3), _D_b_E_n_v(3), + _D_b_E_x_c_e_p_t_i_o_n(3), _D_b_I_n_f_o(3), _D_b_L_o_c_k(3), _D_b_L_o_c_k_T_a_b(3), _D_b_L_o_g(3), + _D_b_L_s_n(3), _D_b_M_p_o_o_l(3), _D_b_M_p_o_o_l_F_i_l_e(3), _D_b_t(3), _D_b_T_x_n(3), + _D_b_T_x_n_M_g_r(3) diff --git a/mozilla/db/man/mancxx.text/db_archive.0 b/mozilla/db/man/mancxx.text/db_archive.0 new file mode 100644 index 00000000000..3ec175b4d8d --- /dev/null +++ b/mozilla/db/man/mancxx.text/db_archive.0 @@ -0,0 +1,191 @@ + + +NNAAMMEE + db_archive - the DB database archiver + +SSYYNNOOPPSSIISS + ddbb__aarrcchhiivvee [--aallssvv] [--hh hhoommee] + +DDEESSCCRRIIPPTTIIOONN + The _d_b___a_r_c_h_i_v_e utility writes the pathnames of log files + that are no longer in use (e.g., no longer involved in + active transactions), to the standard output, one pathname + per line. These log files should be written to backup + media to provide for recovery in the case of catastrophic + failure (which also requires a snapshot of the database + files), but they may then be deleted from the system to + reclaim disk space. + + The options are as follows: + + --aa Write all pathnames as absolute pathnames, instead of + relative to the database home directories. + + --hh Specify a home directory for the database. + + --ll Write out the pathnames of all of the database log + files, whether or not they are involved in active + transactions. + + --ss Write the pathnames of all of the database files that + need to be archived in order to recover the database + from catastrophic failure. If any of the database + files have not been accessed during the lifetime of + the current log files, _d_b___a_r_c_h_i_v_e will not include + them in this output. + + It is possible that some of the files referenced in + the log have since been deleted from the system. In + this case, _d_b___a_r_c_h_i_v_e will ignore them. When + _d_b___r_e_c_o_v_e_r(1) is run, any files referenced in the log + that are not present during recovery are assumed to + have been deleted and will not be recovered. + + --vv Run in verbose mode, listing the checkpoints in the + log files as they are reviewed. + + The _d_b___a_r_c_h_i_v_e utility attaches to DB shared memory + regions. In order to avoid region corruption, it should + always be given the chance to detach and exit gracefully. + To cause _d_b___a_r_c_h_i_v_e to clean up after itself and exit, + send it an interrupt signal (SIGINT). + + The _d_b___a_r_c_h_i_v_e utility exits 0 on success, and >0 if an + error occurs. + +DDBB AARRCCHHIIVVAALL PPRROOCCEEDDUURREESS + There are two aspects to managing the recoverability and + disk consumption of your DB databases. First, you may + want to periodically create snapshots of your databases to + make it possible to recover them from catastrophic + failure. Second, you'll want to periodically remove log + files in order to conserve on disk space. The two proce- + dures are distinct from each other, and you cannot remove + the current log files simply because you have created a + database snapshot. + + To create a snapshot of your database that can be used to + recover from catastrophic failure, the following steps + should be taken: + + 1. Run _d_b___a_r_c_h_i_v_e -s to identify all of the database + data files that must be saved, and copy them to a + backup device, (e.g., tape). If the database files + are stored in a separate directory from the other + database files, it may be simpler to archive the + directory itself instead of the individual files. + + MMoorree iimmppoorrttaannttllyy,, iiff aannyy ooff tthhee ddaattaabbaassee ffiilleess hhaavvee + nnoott bbeeeenn aacccceesssseedd dduurriinngg tthhee lliiffeettiimmee ooff tthhee ccuurrrreenntt + lloogg ffiilleess,, ddbb__aarrcchhiivvee wwiillll nnoott lliisstt tthheemm iinn iittss oouutt-- + ppuutt!! For this reason, it may be important to use a + separate database file directory, archiving it + instead of the files listed by _d_b___a_r_c_h_i_v_e. + + 2. If your database is currently active, i.e., you are + reading and writing to the database files while the + snapshot is being taken, run _d_b___a_r_c_h_i_v_e -l to iden- + tify the database log files, and copy them to a + backup device, (e.g., tape). If the database log + files are stored in a separate directory from the + other database files, it may be simpler to archive + the directory itself instead of the individual files. + + Note that the order of these operations is important, and + that the database files mmuusstt be archived before the log + files. + + The DB library supports on-line backups, and it is not + necessary to stop reading or writing your databases during + the time when you create this snapshot. Note however, + that the snapshot of an active database will be consistent + as of some unspecified time between the start of the + archival and when archival is completed. To create a + snapshot as of a specific time, you must stop reading and + writing your databases for the entire time of the + archival, force a checkpoint (see _d_b___c_h_e_c_k_p_o_i_n_t(1)), and + then archive the files listed by the _d_b___a_r_c_h_i_v_e command's + --ss and --ll options. + + Once these steps are completed, your database can be + recovered from catastrophic failure to its state as of the + time the archival was done. To update your snapshot so + that recovery from catastrophic failure is possible up to + a new point in time, repeat step #2, copying all existing + log files to a backup device. + + Each time that a complete snapshot is made, i.e. all + database and log files are copied to backup media, you may + discard all previous snapshots and saved log files. + + The time to restore from catastrophic failure is a func- + tion of the number of log records that have been written + since the snapshot was originally created. Perhaps more + importantly, the more separate pieces of backup media you + use, the more likely that you will have a problem reading + from one of them. For these reasons, it is often best to + make snapshots on a regular basis. + + FFoorr aarrcchhiivvaall ssaaffeettyy rreemmeemmbbeerr ttoo eennssuurree tthhaatt yyoouu hhaavvee mmuull-- + ttiippllee ccooppiieess ooff yyoouurr ddaattaabbaassee bbaacckkuuppss,, tthhaatt yyoouu vveerriiffyy + tthhaatt yyoouurr aarrcchhiivvaall mmeeddiiaa iiss eerrrroorr--ffrreeee,, aanndd tthhaatt ccooppiieess ooff + yyoouurr bbaacckkuuppss aarree ssttoorreedd ooffff--ssiittee!! + + To restore your database after catastrophic failure, the + following steps should be taken: + + 1. Restore the copies of the database files from the + backup media. + + 2. Restore the copies of the log files from the backup + media, iinn tthhee oorrddeerr iinn wwhhiicchh tthheeyy wweerree wwrriitttteenn. + (It's possible that the same log file appears on mul- + tiple backups, and you only want the most recent ver- + sion of that log file!) + + 3. Run _d_b___r_e_c_o_v_e_r -c to recover the database. + + It is possible to recreate the database in a location dif- + ferent than the original, by specifying appropriate path- + names to the -h option of the _d_b___r_e_c_o_v_e_r utility. + + To remove log files, the following steps should be taken: + + 1. If you are concerned with catastrophic failure, first + copy them to backup media (e.g., tape), as described + above. This is because log files are necessary for + recovery from catastrophic failure. + + 2. Run _d_b___a_r_c_h_i_v_e, without options, to identify all of + the log files that are no longer in use (e.g., + involved in an active transaction). + + 3. Remove those log files from the system. + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _d_b___a_r_c_h_i_v_e: + + DB_HOME + If the --hh option is not specified and the environment + variable _D_B___H_O_M_E is set, it is used as the path of + the database home, as described in _d_b___a_p_p_i_n_i_t(3). + +SSEEEE AALLSSOO + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/mancxx.text/db_checkpoint.0 b/mozilla/db/man/mancxx.text/db_checkpoint.0 new file mode 100644 index 00000000000..c036f4be868 --- /dev/null +++ b/mozilla/db/man/mancxx.text/db_checkpoint.0 @@ -0,0 +1,76 @@ + + +NNAAMMEE + db_checkpoint - the DB database checkpoint utility + +SSYYNNOOPPSSIISS + ddbb__cchheecckkppooiinntt [--11vv] [--hh hhoommee] [--kk kkbbyytteess] [--LL ffiillee] [--pp mmiinn] + +DDEESSCCRRIIPPTTIIOONN + The _d_b___c_h_e_c_k_p_o_i_n_t utility is a daemon process that moni- + tors the database log and periodically calls _t_x_n___c_h_e_c_k_- + _p_o_i_n_t(3) to checkpoint it. + + The options are as follows: + + --11 Checkpoint the log once, and then exit. + + --hh Specify a home directory for the database. + + --kk Checkpoint the database at least as often as every + _k_b_y_t_e_s of log file are written. + + --LL Log the execution of the db_checkpoint utility to the + specified file in the following format, where ``###'' + is the process ID, and the date is the time the util- + ity starting running. + + db_checkpoint: ### Wed Jun 15 01:23:45 EDT 1995 + + This file will be removed if the db_checkpoint util- + ity exits gracefully. + + --pp Checkpoint the database at least every _m_i_n minutes. + + --vv Write the time of each checkpoint to the standard + output. + + At least one of the --11, --kk and --pp options must be speci- + fied. + + The _d_b___c_h_e_c_k_p_o_i_n_t utility attaches to DB shared memory + regions. In order to avoid region corruption, it should + always be given the chance to detach and exit gracefully. + To cause _d_b___c_h_e_c_k_p_o_i_n_t to clean up after itself and exit, + send it an interrupt signal (SIGINT). + + The _d_b___c_h_e_c_k_p_o_i_n_t utility exits 0 on success, and >0 if an + error occurs. + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _d_b___c_h_e_c_k_p_o_i_n_t: + + DB_HOME + If the --hh option is not specified and the environment + variable _D_B___H_O_M_E is set, it is used as the path of + the database home, as described in _d_b___a_p_p_i_n_i_t(3). + +SSEEEE AALLSSOO + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/mancxx.text/db_deadlock.0 b/mozilla/db/man/mancxx.text/db_deadlock.0 new file mode 100644 index 00000000000..212cef941b1 --- /dev/null +++ b/mozilla/db/man/mancxx.text/db_deadlock.0 @@ -0,0 +1,81 @@ + + +NNAAMMEE + db_deadlock - the DB database deadlock detector + +SSYYNNOOPPSSIISS + ddbb__ddeeaaddlloocckk [--vvww] [--aa mm || oo || yy] [--hh hhoommee] [--LL ffiillee ] [--tt sseecc ] + +DDEESSCCRRIIPPTTIIOONN + The _d_b___d_e_a_d_l_o_c_k utility traverses the database lock struc- + tures and aborts a transaction each time it detects a + deadlock. This utility should be run as a background dae- + mon whenever multiple threads or processes are using lock- + ing. By default, a random transaction involved in the + deadlock is aborted. + + The options are as follows: + + --aa When a deadlock is detected, abort the oldest (``o'') + transaction, the youngest (``y'') transaction, or the + transaction with the minimum number of locks (``m''). + + --hh Specify a home directory for the database. + + --LL Log the execution of the db_deadlock utility to the + specified file in the following format, where ``###'' + is the process ID, and the date is the time the util- + ity starting running. + + db_deadlock: ### Wed Jun 15 01:23:45 EDT 1995 + + This file will be removed if the db_deadlock utility + exits gracefully. + + --tt Initiate a pass over the database locks at least + every _s_e_c seconds. + + --vv Run in verbose mode, generating messages each time + the detector runs. + + --ww Make a single pass over the database locks every time + a process is forced to wait for a lock. + + At least one of the --tt and --ww options must be specified. + + The _d_b___d_e_a_d_l_o_c_k utility attaches to DB shared memory + regions. In order to avoid region corruption, it should + always be given the chance to detach and exit gracefully. + To cause _d_b___d_e_a_d_l_o_c_k to clean up after itself and exit, + send it an interrupt signal (SIGINT). + + The _d_b___d_e_a_d_l_o_c_k utility exits 0 on success, and >0 if an + error occurs. + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _d_b___d_e_a_d_l_o_c_k: + + DB_HOME + If the --hh option is not specified and the environment + variable _D_B___H_O_M_E is set, it is used as the path of + the database home, as described in _d_b___a_p_p_i_n_i_t(3). + +SSEEEE AALLSSOO + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/mancxx.text/db_dump.0 b/mozilla/db/man/mancxx.text/db_dump.0 new file mode 100644 index 00000000000..56e1061ccd3 --- /dev/null +++ b/mozilla/db/man/mancxx.text/db_dump.0 @@ -0,0 +1,149 @@ + + +NNAAMMEE + db_dump - the DB database dump utility + +SSYYNNOOPPSSIISS + ddbb__dduummpp [--dd] [--ff oouuttppuutt] db_file + ddbb__dduummpp [--pp] [--ff oouuttppuutt] [--hh hhoommee] db_file + ddbb__dduummpp118855 [--pp] [--ff oouuttppuutt] db_file + +DDEESSCCRRIIPPTTIIOONN + The _d_b___d_u_m_p utility reads the database file _d_b___f_i_l_e and + writes it to the standard output using a portable flat- + text format understood by the _d_b___l_o_a_d(1) utility. The + argument _d_b___f_i_l_e must be a file produced using the _D_B + library functions. + + The _d_b___d_u_m_p_1_8_5 utility is similar to the _d_b___d_u_m_p utility + except that it reads databases in the format used by DB + versions 1.85 and 1.86. + + The options are as follows: + + --dd Dump the specified database in a format helpful for + debugging the DB library routines. TThhee oouuttppuutt ffoorrmmaatt + ooff tthhee --dd ooppttiioonn iiss nnoott ssttaannddaarrdd aanndd mmaayy cchhaannggee,, + wwiitthhoouutt nnoottiiccee,, bbeettwweeeenn rreelleeaasseess ooff tthhee DDBB lliibbrraarryy.. + + --ff Write to the specified _f_i_l_e instead of to the stan- + dard output. + + --hh Specify a home directory for the database. As DB + versions before 2.0 did not support the concept of a + database ``home'', _d_b___d_u_m_p_1_8_5 does not support this + option. + + --pp If characters in either the key or data items are + printing characters (as defined by _i_s_p_r_i_n_t(3)), use + printing characters in _f_i_l_e to represent them. This + option permits users to use standard text editors to + modify the contents of databases. + + Note, different systems may have different notions as + to what characters are ``printing'', and databases + dumped in this manner may be less portable to exter- + nal systems. + + Dumping and reloading hash databases that use user-defined + hash functions will result in new databases that use the + default hash function. While using the default hash func- + tion may not be optimal for the new database, it will con- + tinue to work correctly. + + Dumping and reloading btree databases that use user- + defined prefix or comparison functions will result in new + databases that use the default prefix and comparison func- + tions. IInn tthhiiss ccaassee,, iitt iiss qquuiittee lliikkeellyy tthhaatt tthhee ddaattaabbaassee + wwiillll bbee ddaammaaggeedd bbeeyyoonndd rreeppaaiirr ppeerrmmiittttiinngg nneeiitthheerr rreeccoorrdd + ssttoorraaggee oorr rreettrriieevvaall.. + + + The only available workaround for either case is to modify + the sources for the _d_b___l_o_a_d(1) utility to load the + database using the correct hash, prefix and comparison + functions. + + The _d_b___d_u_m_p_1_8_5 utility may not be available on your system + as it is not always installed when the DB libraries and + utilities are installed. If you are unable to find it, + see your system administrator for further information. + + The _d_b___d_u_m_p utility exits 0 on success, and >0 if an error + occurs. The _d_b___d_u_m_p_1_8_5 utility exits 0 on success, and >0 + if an error occurs. + +OOUUTTPPUUTT FFOORRMMAATTSS + There are two output formats used by _d_b___d_u_m_p and + _d_b___d_u_m_p_1_8_5. + + In both output formats, the first few lines of the output + contain header information describing the underlying + access method, filesystem page size and other bookkeeping + information. This information is output in ``name=value'' + pairs, where ``name'' may be any of the keywords listed in + the _d_b___l_o_a_d(1) manual page, and ``value'' will be its + value. While this header information can be edited before + the database is reloaded, there is rarely any reason to do + so, as all of this information can be overridden by com- + mand-line arguments to _d_b___l_o_a_d. + + Following the header information are the key/data pairs + from the database. If the database being dumped is of + type bbttrreeee or hhaasshh, the output will be paired lines of + text, where the first line of the pair is the key item, + and the second line of the pair is its corresponding data + item. If the database being dumped is of type rreeccnnoo, the + output will be lines of text, where each line is a new + data item for the database. + + If the --pp option was specified, each output line will con- + sist of single characters representing any characters from + the database that were ``printing'', and backslash (``\'') + escaped characters for any that were not. Backslash char- + acters appearing in the output mean one of two things: if + the backslash character precedes another backslash charac- + ter, it means that a literal backslash character occurred + in the key or data item. If the backslash character pre- + cedes any other character, the next two characters should + be interpreted as hexadecimal specification of a single + character, e.g., ``\0a'' is a newline character in the + ASCII character set. + + If the --pp option was not specified, each output line will + consist of paired hexadecimal values, e.g., the line + ``726f6f74'' is the string ``root'' in the ASCII character + set. + + In both output formats, a single newline character ends + both the key and data items. + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _d_b___d_u_m_p: + + DB_HOME + If the --hh option is not specified and the environment + variable _D_B___H_O_M_E is set, it is used as the path of + the database home, as described in _d_b___a_p_p_i_n_i_t(3). + +SSEEEE AALLSSOO + _i_s_p_r_i_n_t(3) + + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/mancxx.text/db_load.0 b/mozilla/db/man/mancxx.text/db_load.0 new file mode 100644 index 00000000000..864a43b7a1f --- /dev/null +++ b/mozilla/db/man/mancxx.text/db_load.0 @@ -0,0 +1,180 @@ + + +NNAAMMEE + db_load - the DB database loader + +SSYYNNOOPPSSIISS + ddbb__llooaadd [--nnTT] [--cc nnaammee==vvaalluuee] + [--ff ffiillee] [--hh hhoommee] [--tt bbttrreeee || hhaasshh || rreeccnnoo] db_file + +DDEESSCCRRIIPPTTIIOONN + The _d_b___l_o_a_d utility reads from the standard input and + loads it into the database _d_b___f_i_l_e. The database _d_b___f_i_l_e + is created if it does not already exist. + + The input to _d_b___l_o_a_d must be in the output format speci- + fied by the _d_b___d_u_m_p or _d_b___d_u_m_p_1_8_5 utilities (see + _d_b___d_u_m_p(1) for more information), or as specified for the + --TT option below. + + The options are as follows: + + --cc Specify configuration options for the DB_INFO struc- + ture provided to _d_b___o_p_e_n(3), ignoring any value they + may have based on the input. The command-line format + is ``name=value''. Supported keywords are listed + below. + + --ff Read from the specified _i_n_p_u_t file instead of from + the standard input. + + --hh Specify a home directory for the database. + + If a home directory is specified, the database envi- + ronment is opened using the DB_INIT_LOCK, + DB_INIT_LOG, DB_INIT_MPOOL, DB_INIT_TXN and + DB_USE_ENVIRON flags to _d_b___a_p_p_i_n_i_t(3). (This means + that _d_b___l_o_a_d can be used to load data into databases + while they are in use by other processes.) If the + _d_b___a_p_p_i_n_i_t call fails, or if no home directory is + specified, the database is still updated, but the + environment is ignored, e.g., no locking is done. + + --nn Do not overwrite existing keys in the database when + loading into an already existing database. If a + key/data pair cannot be loaded into the database for + this reason, a warning message is displayed on the + standard error output and the key/data pair are + skipped. + + --TT The --TT option allows non-DB applications to easily + load text files into databases. + + If the database to be created is of type bbttrreeee or + hhaasshh, the input must be paired lines of text, where + the first line of the pair is the key item, and the + second line of the pair is its corresponding data + item. If the database to be created is of type + rreeccnnoo, the input must be lines of text, where each + line is a new data item for the database. + + + A simple escape mechanism, where newline and back- + slash (``\'') characters are special, is applied to + the text input. Newline characters are interpreted + as record separators. Backslash characters in the + text will be interpreted in one of two ways: if the + backslash character precedes another backslash char- + acter, the pair will be interpreted as a literal + backslash. If the backslash character precedes any + other character, the two characters following the + backslash will be interpreted as hexadecimal specifi- + cation of a single character, e.g., ``\0a'' is a new- + line character in the ASCII character set. + + For this reason, any backslash or newline characters + that naturally occur in the text input must be + escaped to avoid misinterpretation by _d_b___l_o_a_d. + + If the --TT option is specified, the underlying access + method type must be specified using the --tt option. + + --tt Specify the underlying access method. If no --tt + option is specified, the database will be loaded into + a database of the same type as was dumped, e.g., a + hash database will be created if a hash database was + dumped. + + Btree and hash databases may be converted from one to + the other. Recno databases may not be converted to + any other database type or from any other database + type. + + The _d_b___l_o_a_d utility exits 0 on success, 1 if one or more + key/data pairs were not loaded into the database because + the key already existed, and >1 if an error occurs. + +KKEEYYWWOORRDDSS + The following keywords are supported for the --cc command- + line option. See _d_b___o_p_e_n(3) for further discussion of + these keywords and what values should be specified. + + The parenthetical listing specifies how the value part of + the ``name=value'' pair is interpreted. Items listed as + (boolean) expect value to be ``1'' (set) or ``0'' (unset). + Items listed as (number) convert value to a number. Items + listed as (string) use the characters of value directly. + + bt_minkey (number) + The minimum number of keys per page. + + db_lorder (number) + The byte order for integers in the stored database + metadata. + + + db_pagesize (number) + The size of pages used for nodes in the tree, in + bytes. + + duplicates (boolean) + The value of the DB_DUP flag. + + h_ffactor (number) + The density within the hash table. + + h_nelem (number) + The size of the hash table. + + re_len (number) + Specify fixed-length records of the specified length. + + re_pad (string) + Specify the fixed-length record pad character. + + recnum (boolean) + The value of the DB_RECNUM flag. + + renumber (boolean) + The value of the DB_RENUMBER flag. + +EEXXAAMMPPLLEESS + The _d_b___l_o_a_d utility can be used to load text files into + databases. For example, the following command loads the + standard UNIX _/_e_t_c_/_p_a_s_s_w_d file into a database, with the + login name as the key item and the entire password entry + as the data item: + awk -F: '{print $1; print $0}' < /etc/passwd | + sed 's/\\/\\\\/g' | db_load -T -t hash passwd.db + + Note that backslash characters naturally occurring in the + text are escaped to avoid interpretation as escape charac- + ters by _d_b___l_o_a_d. + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _d_b___l_o_a_d: + + DB_HOME + If the --hh option is not specified and the environment + variable _D_B___H_O_M_E is set, it is used as the path of + the database home, as described in _d_b___a_p_p_i_n_i_t(3). + +SSEEEE AALLSSOO + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/mancxx.text/db_recover.0 b/mozilla/db/man/mancxx.text/db_recover.0 new file mode 100644 index 00000000000..351ed244f77 --- /dev/null +++ b/mozilla/db/man/mancxx.text/db_recover.0 @@ -0,0 +1,166 @@ + + +NNAAMMEE + db_recover - the DB database recovery utility + +SSYYNNOOPPSSIISS + ddbb__rreeccoovveerr [--ccvv] [--hh hhoommee] + +DDEESSCCRRIIPPTTIIOONN + The _d_b___r_e_c_o_v_e_r utility must be run after an unexpected + application, DB, or system failure to restore the database + to a consistent state. All committed transactions are + guaranteed to appear after _d_b___r_e_c_o_v_e_r has run, and all + uncommitted transactions will be completely undone. + + The options are as follows: + + --cc Failure was catastrophic. + + --hh Specify a home directory for the database. + + --vv Run in verbose mode. + + In the case of catastrophic failure, an archival copy, or + ``snapshot'' of all database files must be restored along + with all of the log files written since the database file + snapshot was made. (If disk space is a problem, log files + may be referenced by symbolic links). For further infor- + mation on creating a database snapshot, see ``DB ARCHIVAL + PROCEDURES'' in _d_b___a_r_c_h_i_v_e(1). + + If the failure was not catastrophic, the files present on + the system at the time of failure are sufficient to per- + form recovery. + + If log files are missing, _d_b___r_e_c_o_v_e_r will identify the + missing log file(s) and fail, in which case the missing + log files need to be restored and recovery performed + again. + + The _d_b___r_e_c_o_v_e_r utility attaches to DB shared memory + regions. In order to avoid region corruption, it should + always be given the chance to detach and exit gracefully. + To cause _d_b___r_e_c_o_v_e_r to clean up after itself and exit, + send it an interrupt signal (SIGINT). + + The _d_b___r_e_c_o_v_e_r utility exits 0 on success, and >0 if an + error occurs. + +FFIILLEESSYYSSTTEEMM OOPPEERRAATTIIOONNSS + FFiilleessyysstteemm ooppeerraattiioonnss,, ee..gg..,, mmoovviinngg tthhee ddaattaabbaassee eennvviirroonn-- + mmeenntt ttoo aa ddiiffffeerreenntt mmaacchhiinnee oorr ffiillee ccrreeaattiioonn,, ddeelleettiioonn oorr + rreennaammiinngg,, ccaannnnoott bbee ttrraannssaaccttiioonn pprrootteecctteedd.. For this rea- + son, _d_b___r_e_c_o_v_e_r cannot re-create, delete or rename files + as part of recovery. + + If _d_b___r_e_c_o_v_e_r cannot find a database file referenced in + the log, it will output a warning message that it was + unable to locate a file it expected to find. This message + is only a warning, as the file may have subsequently been + deleted as part of normal database operations before the + failure occurred. NNoottee tthhaatt ccoommmmiitttteedd ttrraannssaaccttiioonnss tthhaatt + iinnvvoollvveedd tthheessee mmiissssiinngg ffiilleess aarree rroolllleedd ffoorrwwaarrdd,, eevveenn + tthhoouugghh tthhee ffiilleess wweerree nnoott ffoouunndd.. IIff tthhee ffiilleess wweerree nnoott + iinntteennttiioonnaallllyy ddeelleetteedd ((ee..gg..,, tthheeyy wweerree ccrreeaatteedd aafftteerr tthhee + llaasstt ddaattaabbaassee ssnnaappsshhoott,, bbuutt wweerree lloosstt dduurriinngg aa ffaaiilluurree)),, + tthheeyy mmuusstt bbee mmaannuuaallllyy ccrreeaatteedd ((uussiinngg _d_b___o_p_e_n(3)), and + _d_b___r_e_c_o_v_e_r must be rerun. + + Generally, it is simplest to perform filesystem operations + at the same time as making a snapshot of the database. To + perform filesystem operations: + + 1. Cleanly shutdown database operations. + 2. Rename, create or delete files. + 3. Make a snapshot of the database. + 4. Restart database applications. + + To cleanly shutdown database operations, all applications + accessing the database environment must be shutdown. If + the applications are not implemented such that they can be + shutdown gracefully (i.e., closing all references to the + database environment), _d_b___r_e_c_o_v_e_r must be run after all + applications have been killed to ensure that the underly- + ing database is consistent and flushed to disk. + +RREECCOOVVEERRYY + After an application or system failure, there are two pos- + sible approaches to database recovery. If there is no + need to retain state across the failure, and all databases + can be started anew, the database home directory can sim- + ply be removed and recreated. If it is necessary to + retain persistent state across failures, then the + _d_b___r_e_c_o_v_e_r(1) utility should be run for each DB applica- + tion environment, i.e., each database home directory. + + The _d_b___r_e_c_o_v_e_r utility will remove all the shared regions + (which may have been corrupted by the failure), establish + the end of the log by identifying the last record written + to the log, and then perform transaction recovery. + Database applications must not be restarted until recovery + completes. During transaction recovery, all changes made + by aborted transactions are undone and all changes made by + committed transactions are redone, as necessary. After + recovery runs, the environment is properly initialized so + that applications may be restarted. Any time an applica- + tion crashes or the system fails, _d_b___r_e_c_o_v_e_r should be run + on any exiting database environments. + + Additionally, there are two forms of recovery: normal + recovery and catastrophic recovery. The DB package + defines catastrophic failure to be failure where either + the database or log files have been destroyed or corrupted + from the point of view of the filesystem. For example, + catastrophic failure includes the case where the disk + drive on which either the database or logs are stored has + crashed, or when filesystem recovery is unable to bring + the database and log files to a consistent state with + respect to the filesystem. If the failure is non-catas- + trophic, i.e., the database files and log are accessible + on a filesystem that has recovered cleanly, _d_b___r_e_c_o_v_e_r + will review the logs and database files to ensure that all + committed transactions appear and that all uncommitted + transactions are undone. If the failure is catastrophic, + a snapshot of the database files and the archived log + files must be restored onto the system. Then _d_b___r_e_c_o_v_e_r + will review the logs and database files to bring the + database to a consistent state as of the date of the last + archived log file. Only transactions committed before + that date will appear in the database. See _d_b___a_r_c_h_i_v_e _(_1_) + for specific information about archiving and recovering + databases after catastrophic failure. + + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _d_b___r_e_c_o_v_e_r: + + DB_HOME + If the --hh option is not specified and the environment + variable _D_B___H_O_M_E is set, it is used as the path of + the database home, as described in _d_b___a_p_p_i_n_i_t(3). + +BBUUGGSS + Future versions of DB are expected to remove the restric- + tion that database files must be manually created before + recovery is performed. + +SSEEEE AALLSSOO + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/man/mancxx.text/db_stat.0 b/mozilla/db/man/mancxx.text/db_stat.0 new file mode 100644 index 00000000000..83adc0026be --- /dev/null +++ b/mozilla/db/man/mancxx.text/db_stat.0 @@ -0,0 +1,98 @@ + + +NNAAMMEE + db_stat - display DB statistics + +SSYYNNOOPPSSIISS + ddbb__ssttaatt [--ccllmmNNtt] + [--CC AAccffhhllmmoo] [--dd ffiillee] [--hh hhoommee] [--MM AAhhllmm] + +DDEESSCCRRIIPPTTIIOONN + The _d_b___s_t_a_t utility displays statistics for DB environ- + ments. + + The options are as follows: + + --CC Display internal information about the lock region. + (The output from this option is often both voluminous + and meaningless, and is intended only for debugging.) + + --AA Display all information. + --cc Display lock conflict matrix. + --ff Display lock and object free lists. + --ll Display lockers within hash chains. + --mm Display region memory information. + --oo Display objects within hash chains. + + --cc Display lock region statistics as described in + _d_b___l_o_c_k(3). + + --dd Display database statistics for the specified + database, as described in _d_b___o_p_e_n(3). + + --hh Specify a home directory for the database. + + --ll Display log region statistics as described in + _d_b___l_o_g(3). + + --MM Display internal information about the shared memory + buffer pool. (The output from this option is often + both voluminous and meaningless, and is intended only + for debugging.) + + --AA Display all information. + --hh Display buffers within hash chains. + --ll Display buffers within LRU chains. + --mm Display region memory information. + + --mm Display shared memory buffer pool statistics as + described in _d_b___m_p_o_o_l(3). + + --NN Don't acquire locks while displaying the statistics. + This option is intended only for debugging corrupt + regions and should not be used under any other cir- + cumstances. + + --tt Display transaction region statistics as described in + _d_b___t_x_n(3). + + The _d_b___s_t_a_t utility attaches to DB shared memory regions. + In order to avoid region corruption, it should always be + given the chance to detach and exit gracefully. To cause + _d_b___s_t_a_t to clean up after itself and exit, send it an + interrupt signal (SIGINT). + + Values smaller than 10 million are generally displayed + without any special notation. Values larger than 10 mil- + lion are normally displayed as ``M''. + + The _d_b___s_t_a_t utility exits 0 on success, and >0 if an error + occurs. + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + The following environment variables affect the execution + of _d_b___s_t_a_t: + + DB_HOME + If the --hh option is not specified and the environment + variable _D_B___H_O_M_E is set, it is used as the path of + the database home, as described in _d_b___a_p_p_i_n_i_t(3). + +SSEEEE AALLSSOO + The DB library is a family of groups of functions that + provides a modular programming interface to transactions + and record-oriented file access. The library includes + support for transactions, locking, logging and file page + caching, as well as various indexed access methods. Many + of the functional groups (e.g., the file page caching + functions) are useful independent of the other DB func- + tions, although some functional groups are explicitly + based on other functional groups (e.g., transactions and + logging). For a general description of the DB package, + see _d_b___i_n_t_r_o(3). + + _d_b___a_r_c_h_i_v_e(1), _d_b___c_h_e_c_k_p_o_i_n_t(1), _d_b___d_e_a_d_l_o_c_k(1), _d_b___d_u_m_p(1), + _d_b___l_o_a_d(1), _d_b___r_e_c_o_v_e_r(1), _d_b___s_t_a_t(1), _d_b___i_n_t_r_o(3), + _d_b___a_p_p_i_n_i_t(3), _d_b___c_u_r_s_o_r(3), _d_b___d_b_m(3), _d_b___i_n_t_e_r_n_a_l(3), + _d_b___l_o_c_k(3), _d_b___l_o_g(3), _d_b___m_p_o_o_l(3), _d_b___o_p_e_n(3), _d_b___t_h_r_e_a_d(3), + _d_b___t_x_n(3) diff --git a/mozilla/db/mp/mp_bh.c b/mozilla/db/mp/mp_bh.c new file mode 100644 index 00000000000..d89f9c2ded4 --- /dev/null +++ b/mozilla/db/mp/mp_bh.c @@ -0,0 +1,584 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)mp_bh.c 10.38 (Sleepycat) 5/20/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_shash.h" +#include "mp.h" +#include "common_ext.h" + +static int __memp_upgrade __P((DB_MPOOL *, DB_MPOOLFILE *, MPOOLFILE *)); + +/* + * __memp_bhwrite -- + * Write the page associated with a given bucket header. + * + * PUBLIC: int __memp_bhwrite + * PUBLIC: __P((DB_MPOOL *, MPOOLFILE *, BH *, int *, int *)); + */ +int +__memp_bhwrite(dbmp, mfp, bhp, restartp, wrotep) + DB_MPOOL *dbmp; + MPOOLFILE *mfp; + BH *bhp; + int *restartp, *wrotep; +{ + DB_MPOOLFILE *dbmfp; + DB_MPREG *mpreg; + + if (restartp != NULL) + *restartp = 0; + if (wrotep != NULL) + *wrotep = 0; + + /* + * Walk the process' DB_MPOOLFILE list and find a file descriptor for + * the file. We also check that the descriptor is open for writing. + * If we find a descriptor on the file that's not open for writing, we + * try and upgrade it to make it writeable. If that fails, we're done. + */ + LOCKHANDLE(dbmp, dbmp->mutexp); + for (dbmfp = TAILQ_FIRST(&dbmp->dbmfq); + dbmfp != NULL; dbmfp = TAILQ_NEXT(dbmfp, q)) + if (dbmfp->mfp == mfp) { + if (F_ISSET(dbmfp, MP_READONLY) && + __memp_upgrade(dbmp, dbmfp, mfp)) { + UNLOCKHANDLE(dbmp, dbmp->mutexp); + return (0); + } + break; + } + UNLOCKHANDLE(dbmp, dbmp->mutexp); + if (dbmfp != NULL) + goto found; + + /* + * It's not a page from a file we've opened. If the file requires + * input/output processing, see if this process has ever registered + * information as to how to write this type of file. If not, there's + * nothing we can do. + */ + if (mfp->ftype != 0) { + LOCKHANDLE(dbmp, dbmp->mutexp); + for (mpreg = LIST_FIRST(&dbmp->dbregq); + mpreg != NULL; mpreg = LIST_NEXT(mpreg, q)) + if (mpreg->ftype == mfp->ftype) + break; + UNLOCKHANDLE(dbmp, dbmp->mutexp); + if (mpreg == NULL) + return (0); + } + + /* + * Try and open the file, attaching to the underlying shared area. + * + * XXX + * Don't try to attach to temporary files. There are two problems in + * trying to do that. First, if we have different privileges than the + * process that "owns" the temporary file, we might create the backing + * disk file such that the owning process couldn't read/write its own + * buffers, e.g., memp_trickle() running as root creating a file owned + * as root, mode 600. Second, if the temporary file has already been + * created, we don't have any way of finding out what its real name is, + * and, even if we did, it was already unlinked (so that it won't be + * left if the process dies horribly). This decision causes a problem, + * however: if the temporary file consumes the entire buffer cache, + * and the owner doesn't flush the buffers to disk, we could end up + * with resource starvation, and the memp_trickle() thread couldn't do + * anything about it. That's a pretty unlikely scenario, though. + * + * XXX + * There's no negative cache, so we may repeatedly try and open files + * that we have previously tried (and failed) to open. + * + * Ignore any error, assume it's a permissions problem. + */ + if (F_ISSET(mfp, MP_TEMP)) + return (0); + + if (__memp_fopen(dbmp, mfp, R_ADDR(dbmp, mfp->path_off), + 0, 0, mfp->stat.st_pagesize, 0, NULL, &dbmfp) != 0) + return (0); + +found: return (__memp_pgwrite(dbmfp, bhp, restartp, wrotep)); +} + +/* + * __memp_pgread -- + * Read a page from a file. + * + * PUBLIC: int __memp_pgread __P((DB_MPOOLFILE *, BH *, int)); + */ +int +__memp_pgread(dbmfp, bhp, can_create) + DB_MPOOLFILE *dbmfp; + BH *bhp; + int can_create; +{ + DB_MPOOL *dbmp; + MPOOLFILE *mfp; + size_t pagesize; + ssize_t nr; + int ret; + + dbmp = dbmfp->dbmp; + mfp = dbmfp->mfp; + pagesize = mfp->stat.st_pagesize; + + F_SET(bhp, BH_LOCKED | BH_TRASH); + LOCKBUFFER(dbmp, bhp); + UNLOCKREGION(dbmp); + + /* + * Temporary files may not yet have been created. + * + * Seek to the page location. + */ + ret = 0; + LOCKHANDLE(dbmp, dbmfp->mutexp); + if (dbmfp->fd == -1 || (ret = + __db_seek(dbmfp->fd, pagesize, bhp->pgno, 0, 0, SEEK_SET)) != 0) { + if (!can_create) { + if (dbmfp->fd == -1) + ret = EINVAL; + UNLOCKHANDLE(dbmp, dbmfp->mutexp); + __db_err(dbmp->dbenv, + "%s: page %lu doesn't exist, create flag not set", + __memp_fn(dbmfp), (u_long)bhp->pgno); + goto err; + } + UNLOCKHANDLE(dbmp, dbmfp->mutexp); + + /* Clear the created page. */ + if (mfp->clear_len == 0) + memset(bhp->buf, 0, pagesize); + else { + memset(bhp->buf, 0, mfp->clear_len); +#ifdef DIAGNOSTIC + memset(bhp->buf + mfp->clear_len, + 0xff, pagesize - mfp->clear_len); +#endif + } + + goto pgin; + } + + /* + * Read the page; short reads are treated like creates, although + * any valid data is preserved. + */ + ret = __db_read(dbmfp->fd, bhp->buf, pagesize, &nr); + UNLOCKHANDLE(dbmp, dbmfp->mutexp); + if (ret != 0) + goto err; + + if (nr == (ssize_t)pagesize) + can_create = 0; + else { + if (!can_create) { + ret = EINVAL; + goto err; + } + + /* + * If we didn't fail until we tried the read, don't clear the + * whole page, it wouldn't be insane for a filesystem to just + * always behave that way. Else, clear any uninitialized data. + */ + if (nr == 0) + memset(bhp->buf, 0, + mfp->clear_len == 0 ? pagesize : mfp->clear_len); + else + memset(bhp->buf + nr, 0, pagesize - nr); + } + + /* Call any pgin function. */ +pgin: ret = mfp->ftype == 0 ? 0 : __memp_pg(dbmfp, bhp, 1); + + /* Unlock the buffer and reacquire the region lock. */ +err: UNLOCKBUFFER(dbmp, bhp); + LOCKREGION(dbmp); + + /* + * If no errors occurred, the data is now valid, clear the BH_TRASH + * flag; regardless, clear the lock bit and let other threads proceed. + */ + F_CLR(bhp, BH_LOCKED); + if (ret == 0) { + F_CLR(bhp, BH_TRASH); + + /* Update the statistics. */ + if (can_create) { + ++dbmp->mp->stat.st_page_create; + ++mfp->stat.st_page_create; + } else { + ++dbmp->mp->stat.st_page_in; + ++mfp->stat.st_page_in; + } + } + + return (ret); +} + +/* + * __memp_pgwrite -- + * Write a page to a file. + * + * PUBLIC: int __memp_pgwrite __P((DB_MPOOLFILE *, BH *, int *, int *)); + */ +int +__memp_pgwrite(dbmfp, bhp, restartp, wrotep) + DB_MPOOLFILE *dbmfp; + BH *bhp; + int *restartp, *wrotep; +{ + DB_ENV *dbenv; + DB_LOG *lg_info; + DB_LSN lsn; + DB_MPOOL *dbmp; + MPOOL *mp; + MPOOLFILE *mfp; + size_t pagesize; + ssize_t nw; + int callpgin, ret, syncfail; + const char *fail; + + dbmp = dbmfp->dbmp; + dbenv = dbmp->dbenv; + mp = dbmp->mp; + mfp = dbmfp->mfp; + + if (restartp != NULL) + *restartp = 0; + if (wrotep != NULL) + *wrotep = 0; + callpgin = 0; + pagesize = mfp->stat.st_pagesize; + + /* + * Check the dirty bit -- this buffer may have been written since we + * decided to write it. + */ + if (!F_ISSET(bhp, BH_DIRTY)) { + if (wrotep != NULL) + *wrotep = 1; + return (0); + } + + LOCKBUFFER(dbmp, bhp); + + /* + * If there were two writers, we may have just been waiting while the + * other writer completed I/O on this buffer. Check the dirty bit one + * more time. + */ + if (!F_ISSET(bhp, BH_DIRTY)) { + UNLOCKBUFFER(dbmp, bhp); + + if (wrotep != NULL) + *wrotep = 1; + return (0); + } + + F_SET(bhp, BH_LOCKED); + UNLOCKREGION(dbmp); + + if (restartp != NULL) + *restartp = 1; + + /* Copy the LSN off the page if we're going to need it. */ + lg_info = dbenv->lg_info; + if (lg_info != NULL || F_ISSET(bhp, BH_WRITE)) + memcpy(&lsn, bhp->buf + mfp->lsn_off, sizeof(DB_LSN)); + + /* Ensure the appropriate log records are on disk. */ + if (lg_info != NULL && (ret = log_flush(lg_info, &lsn)) != 0) + goto err; + + /* + * Call any pgout function. We set the callpgin flag so that we flag + * that the contents of the buffer will need to be passed through pgin + * before they are reused. + */ + if (mfp->ftype == 0) + ret = 0; + else { + callpgin = 1; + if ((ret = __memp_pg(dbmfp, bhp, 0)) != 0) + goto err; + } + + /* Temporary files may not yet have been created. */ + LOCKHANDLE(dbmp, dbmfp->mutexp); + if (dbmfp->fd == -1 && + ((ret = __db_appname(dbenv, DB_APP_TMP, NULL, NULL, + DB_CREATE | DB_EXCL | DB_TEMPORARY, &dbmfp->fd, NULL)) != 0 || + dbmfp->fd == -1)) { + UNLOCKHANDLE(dbmp, dbmfp->mutexp); + __db_err(dbenv, "unable to create temporary backing file"); + goto err; + } + + /* + * Write the page out. + * + * XXX + * Shut the compiler up; it doesn't understand the correlation between + * the failing clauses to __db_lseek and __db_write and this ret != 0. + */ + COMPQUIET(fail, NULL); + if ((ret = + __db_seek(dbmfp->fd, pagesize, bhp->pgno, 0, 0, SEEK_SET)) != 0) + fail = "seek"; + else if ((ret = __db_write(dbmfp->fd, bhp->buf, pagesize, &nw)) != 0) + fail = "write"; + UNLOCKHANDLE(dbmp, dbmfp->mutexp); + if (ret != 0) + goto syserr; + + if (nw != (ssize_t)pagesize) { + ret = EIO; + fail = "write"; + goto syserr; + } + + if (wrotep != NULL) + *wrotep = 1; + + /* Unlock the buffer and reacquire the region lock. */ + UNLOCKBUFFER(dbmp, bhp); + LOCKREGION(dbmp); + + /* + * Clean up the flags based on a successful write. + * + * If we rewrote the page, it will need processing by the pgin + * routine before reuse. + */ + if (callpgin) + F_SET(bhp, BH_CALLPGIN); + F_CLR(bhp, BH_DIRTY | BH_LOCKED); + + /* + * If we write a buffer for which a checkpoint is waiting, update + * the count of pending buffers (both in the mpool as a whole and + * for this file). If the count for this file goes to zero, flush + * the writes. + * + * XXX: + * Don't lock the region around the sync, fsync(2) has no atomicity + * issues. + * + * XXX: + * We ignore errors from the sync -- it makes no sense to return an + * error to the calling process, so set a flag causing the checkpoint + * to be retried later. + */ + if (F_ISSET(bhp, BH_WRITE)) { + if (mfp->lsn_cnt == 1) { + UNLOCKREGION(dbmp); + syncfail = __db_fsync(dbmfp->fd) != 0; + LOCKREGION(dbmp); + if (syncfail) + F_SET(mp, MP_LSN_RETRY); + + } + + F_CLR(bhp, BH_WRITE); + + /* + * If the buffer just written has a larger LSN than the current + * max LSN written for this checkpoint, update the saved value. + */ + if (log_compare(&lsn, &mp->lsn) > 0) + mp->lsn = lsn; + + --mp->lsn_cnt; + --mfp->lsn_cnt; + } + + /* Update the page clean/dirty statistics. */ + ++mp->stat.st_page_clean; + --mp->stat.st_page_dirty; + + /* Update I/O statistics. */ + ++mp->stat.st_page_out; + ++mfp->stat.st_page_out; + + return (0); + +syserr: __db_err(dbenv, "%s: %s failed for page %lu", + __memp_fn(dbmfp), fail, (u_long)bhp->pgno); + +err: /* Unlock the buffer and reacquire the region lock. */ + UNLOCKBUFFER(dbmp, bhp); + LOCKREGION(dbmp); + + /* + * Clean up the flags based on a failure. + * + * The page remains dirty but we remove our lock. If we rewrote the + * page, it will need processing by the pgin routine before reuse. + */ + if (callpgin) + F_SET(bhp, BH_CALLPGIN); + F_CLR(bhp, BH_LOCKED); + + return (ret); +} + +/* + * __memp_pg -- + * Call the pgin/pgout routine. + * + * PUBLIC: int __memp_pg __P((DB_MPOOLFILE *, BH *, int)); + */ +int +__memp_pg(dbmfp, bhp, is_pgin) + DB_MPOOLFILE *dbmfp; + BH *bhp; + int is_pgin; +{ + DBT dbt, *dbtp; + DB_MPOOL *dbmp; + DB_MPREG *mpreg; + MPOOLFILE *mfp; + int ftype, ret; + + dbmp = dbmfp->dbmp; + mfp = dbmfp->mfp; + + LOCKHANDLE(dbmp, dbmp->mutexp); + + ftype = mfp->ftype; + for (mpreg = LIST_FIRST(&dbmp->dbregq); + mpreg != NULL; mpreg = LIST_NEXT(mpreg, q)) { + if (ftype != mpreg->ftype) + continue; + if (mfp->pgcookie_len == 0) + dbtp = NULL; + else { + dbt.size = mfp->pgcookie_len; + dbt.data = R_ADDR(dbmp, mfp->pgcookie_off); + dbtp = &dbt; + } + UNLOCKHANDLE(dbmp, dbmp->mutexp); + + if (is_pgin) { + if (mpreg->pgin != NULL && (ret = + mpreg->pgin(bhp->pgno, bhp->buf, dbtp)) != 0) + goto err; + } else + if (mpreg->pgout != NULL && (ret = + mpreg->pgout(bhp->pgno, bhp->buf, dbtp)) != 0) + goto err; + break; + } + + if (mpreg == NULL) + UNLOCKHANDLE(dbmp, dbmp->mutexp); + + return (0); + +err: UNLOCKHANDLE(dbmp, dbmp->mutexp); + __db_err(dbmp->dbenv, "%s: %s failed for page %lu", + __memp_fn(dbmfp), is_pgin ? "pgin" : "pgout", (u_long)bhp->pgno); + return (ret); +} + +/* + * __memp_bhfree -- + * Free a bucket header and its referenced data. + * + * PUBLIC: void __memp_bhfree __P((DB_MPOOL *, MPOOLFILE *, BH *, int)); + */ +void +__memp_bhfree(dbmp, mfp, bhp, free_mem) + DB_MPOOL *dbmp; + MPOOLFILE *mfp; + BH *bhp; + int free_mem; +{ + size_t off; + + /* Delete the buffer header from the hash bucket queue. */ + off = BUCKET(dbmp->mp, R_OFFSET(dbmp, mfp), bhp->pgno); + SH_TAILQ_REMOVE(&dbmp->htab[off], bhp, hq, __bh); + + /* Delete the buffer header from the LRU queue. */ + SH_TAILQ_REMOVE(&dbmp->mp->bhq, bhp, q, __bh); + + /* + * If we're not reusing it immediately, free the buffer header + * and data for real. + */ + if (free_mem) { + __db_shalloc_free(dbmp->addr, bhp); + --dbmp->mp->stat.st_page_clean; + } +} + +/* + * __memp_upgrade -- + * Upgrade a file descriptor from readonly to readwrite. + */ +static int +__memp_upgrade(dbmp, dbmfp, mfp) + DB_MPOOL *dbmp; + DB_MPOOLFILE *dbmfp; + MPOOLFILE *mfp; +{ + int fd, ret; + char *rpath; + + /* + * !!! + * We expect the handle to already be locked. + */ + + /* Check to see if we've already upgraded. */ + if (F_ISSET(dbmfp, MP_UPGRADE)) + return (0); + + /* Check to see if we've already failed. */ + if (F_ISSET(dbmfp, MP_UPGRADE_FAIL)) + return (1); + + /* + * Calculate the real name for this file and try to open it read/write. + * We know we have a valid pathname for the file because it's the only + * way we could have gotten a file descriptor of any kind. + */ + if ((ret = __db_appname(dbmp->dbenv, DB_APP_DATA, + NULL, R_ADDR(dbmp, mfp->path_off), 0, NULL, &rpath)) != 0) + return (ret); + if (__db_open(rpath, 0, 0, 0, &fd) != 0) { + F_SET(dbmfp, MP_UPGRADE_FAIL); + ret = 1; + } else { + /* Swap the descriptors and set the upgrade flag. */ + (void)__db_close(dbmfp->fd); + dbmfp->fd = fd; + F_SET(dbmfp, MP_UPGRADE); + ret = 0; + } + FREES(rpath); + return (ret); +} diff --git a/mozilla/db/mp/mp_fget.c b/mozilla/db/mp/mp_fget.c new file mode 100644 index 00000000000..c8ae2e9d98a --- /dev/null +++ b/mozilla/db/mp/mp_fget.c @@ -0,0 +1,352 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)mp_fget.c 10.48 (Sleepycat) 6/2/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_shash.h" +#include "mp.h" +#include "common_ext.h" + +/* + * memp_fget -- + * Get a page from the file. + */ +int +memp_fget(dbmfp, pgnoaddr, flags, addrp) + DB_MPOOLFILE *dbmfp; + db_pgno_t *pgnoaddr; + u_int32_t flags; + void *addrp; +{ + BH *bhp; + DB_MPOOL *dbmp; + MPOOL *mp; + MPOOLFILE *mfp; + size_t bucket, mf_offset; + u_int32_t st_hsearch; + int b_incr, first, ret; + + dbmp = dbmfp->dbmp; + mp = dbmp->mp; + mfp = dbmfp->mfp; + + /* + * Validate arguments. + * + * !!! + * Don't test for DB_MPOOL_CREATE and DB_MPOOL_NEW flags for readonly + * files here, and create non-existent pages in readonly files if the + * flags are set, later. The reason is that the hash access method + * wants to get empty pages that don't really exist in readonly files. + * The only alternative is for hash to write the last "bucket" all the + * time, which we don't want to do because one of our big goals in life + * is to keep database files small. It's sleazy as hell, but we catch + * any attempt to actually write the file in memp_fput(). + */ +#define OKFLAGS (DB_MPOOL_CREATE | DB_MPOOL_LAST | DB_MPOOL_NEW) + if (flags != 0) { + if ((ret = + __db_fchk(dbmp->dbenv, "memp_fget", flags, OKFLAGS)) != 0) + return (ret); + + switch (flags) { + case DB_MPOOL_CREATE: + case DB_MPOOL_LAST: + case DB_MPOOL_NEW: + case 0: + break; + default: + return (__db_ferr(dbmp->dbenv, "memp_fget", 1)); + } + } + +#ifdef DIAGNOSTIC + /* + * XXX + * We want to switch threads as often as possible. Sleep every time + * we get a new page to make it more likely. + */ + if (DB_GLOBAL(db_pageyield) && + (__db_yield == NULL || __db_yield() != 0)) + __db_sleep(0, 1); +#endif + + /* Initialize remaining local variables. */ + mf_offset = R_OFFSET(dbmp, mfp); + bhp = NULL; + st_hsearch = 0; + b_incr = ret = 0; + + /* Determine the hash bucket where this page will live. */ + bucket = BUCKET(mp, mf_offset, *pgnoaddr); + + LOCKREGION(dbmp); + + /* + * Check for the last or last + 1 page requests. + * + * Examine and update the file's last_pgno value. We don't care if + * the last_pgno value immediately changes due to another thread -- + * at this instant in time, the value is correct. We do increment the + * current last_pgno value if the thread is asking for a new page, + * however, to ensure that two threads creating pages don't get the + * same one. + */ + if (LF_ISSET(DB_MPOOL_LAST | DB_MPOOL_NEW)) { + if (LF_ISSET(DB_MPOOL_NEW)) + ++mfp->last_pgno; + *pgnoaddr = mfp->last_pgno; + bucket = BUCKET(mp, mf_offset, mfp->last_pgno); + + if (LF_ISSET(DB_MPOOL_NEW)) + goto alloc; + } + + /* + * If mmap'ing the file and the page is not past the end of the file, + * just return a pointer. + * + * The page may be past the end of the file, so check the page number + * argument against the original length of the file. If we previously + * returned pages past the original end of the file, last_pgno will + * have been updated to match the "new" end of the file, and checking + * against it would return pointers past the end of the mmap'd region. + * + * If another process has opened the file for writing since we mmap'd + * it, we will start playing the game by their rules, i.e. everything + * goes through the cache. All pages previously returned will be safe, + * as long as the correct locking protocol was observed. + * + * XXX + * We don't discard the map because we don't know when all of the + * pages will have been discarded from the process' address space. + * It would be possible to do so by reference counting the open + * pages from the mmap, but it's unclear to me that it's worth it. + */ + if (dbmfp->addr != NULL && F_ISSET(mfp, MP_CAN_MMAP)) + if (*pgnoaddr > mfp->orig_last_pgno) { + /* + * !!! + * See the comment above about non-existent pages and + * the hash access method. + */ + if (!LF_ISSET(DB_MPOOL_CREATE)) { + __db_err(dbmp->dbenv, + "%s: page %lu doesn't exist", + __memp_fn(dbmfp), (u_long)*pgnoaddr); + ret = EINVAL; + goto err; + } + } else { + *(void **)addrp = + R_ADDR(dbmfp, *pgnoaddr * mfp->stat.st_pagesize); + ++mp->stat.st_map; + ++mfp->stat.st_map; + goto done; + } + + /* Search the hash chain for the page. */ + for (bhp = SH_TAILQ_FIRST(&dbmp->htab[bucket], __bh); + bhp != NULL; bhp = SH_TAILQ_NEXT(bhp, hq, __bh)) { + ++st_hsearch; + if (bhp->pgno != *pgnoaddr || bhp->mf_offset != mf_offset) + continue; + + /* Increment the reference count. */ + if (bhp->ref == UINT16_T_MAX) { + __db_err(dbmp->dbenv, + "%s: page %lu: reference count overflow", + __memp_fn(dbmfp), (u_long)bhp->pgno); + ret = EINVAL; + goto err; + } + + /* + * Increment the reference count. We may discard the region + * lock as we evaluate and/or read the buffer, so we need to + * ensure that it doesn't move and that its contents remain + * unchanged. + */ + ++bhp->ref; + b_incr = 1; + + /* + * Any buffer we find might be trouble. + * + * BH_LOCKED -- + * I/O is in progress. Because we've incremented the buffer + * reference count, we know the buffer can't move. Unlock + * the region lock, wait for the I/O to complete, and reacquire + * the region. + */ + for (first = 1; F_ISSET(bhp, BH_LOCKED); first = 0) { + UNLOCKREGION(dbmp); + + /* + * Explicitly yield the processor if it's not the first + * pass through this loop -- if we don't, we might end + * up running to the end of our CPU quantum as we will + * simply be swapping between the two locks. + */ + if (!first && (__db_yield == NULL || __db_yield() != 0)) + __db_sleep(0, 1); + + LOCKBUFFER(dbmp, bhp); + /* Wait for I/O to finish... */ + UNLOCKBUFFER(dbmp, bhp); + LOCKREGION(dbmp); + } + + /* + * BH_TRASH -- + * The contents of the buffer are garbage. Shouldn't happen, + * and this read is likely to fail, but might as well try. + */ + if (F_ISSET(bhp, BH_TRASH)) + goto reread; + + /* + * BH_CALLPGIN -- + * The buffer was converted so it could be written, and the + * contents need to be converted again. + */ + if (F_ISSET(bhp, BH_CALLPGIN)) { + if ((ret = __memp_pg(dbmfp, bhp, 1)) != 0) + goto err; + F_CLR(bhp, BH_CALLPGIN); + } + + ++mp->stat.st_cache_hit; + ++mfp->stat.st_cache_hit; + *(void **)addrp = bhp->buf; + goto done; + } + +alloc: /* Allocate new buffer header and data space. */ + if ((ret = __memp_ralloc(dbmp, sizeof(BH) - + sizeof(u_int8_t) + mfp->stat.st_pagesize, NULL, &bhp)) != 0) + goto err; + +#ifdef DIAGNOSTIC + if ((ALIGNTYPE)bhp->buf & (sizeof(size_t) - 1)) { + __db_err(dbmp->dbenv, + "Internal error: BH data NOT size_t aligned."); + ret = EINVAL; + goto err; + } +#endif + /* Initialize the BH fields. */ + memset(bhp, 0, sizeof(BH)); + LOCKINIT(dbmp, &bhp->mutex); + bhp->ref = 1; + bhp->pgno = *pgnoaddr; + bhp->mf_offset = mf_offset; + + /* + * Prepend the bucket header to the head of the appropriate MPOOL + * bucket hash list. Append the bucket header to the tail of the + * MPOOL LRU chain. + */ + SH_TAILQ_INSERT_HEAD(&dbmp->htab[bucket], bhp, hq, __bh); + SH_TAILQ_INSERT_TAIL(&mp->bhq, bhp, q); + + /* + * If we created the page, zero it out and continue. + * + * !!! + * Note: DB_MPOOL_NEW specifically doesn't call the pgin function. + * If DB_MPOOL_CREATE is used, then the application's pgin function + * has to be able to handle pages of 0's -- if it uses DB_MPOOL_NEW, + * it can detect all of its page creates, and not bother. + * + * Otherwise, read the page into memory, optionally creating it if + * DB_MPOOL_CREATE is set. + */ + if (LF_ISSET(DB_MPOOL_NEW)) { + if (mfp->clear_len == 0) + memset(bhp->buf, 0, mfp->stat.st_pagesize); + else { + memset(bhp->buf, 0, mfp->clear_len); +#ifdef DIAGNOSTIC + memset(bhp->buf + mfp->clear_len, 0xff, + mfp->stat.st_pagesize - mfp->clear_len); +#endif + } + + ++mp->stat.st_page_create; + ++mfp->stat.st_page_create; + } else { + /* + * It's possible for the read function to fail, which means + * that we fail as well. Note, the __memp_pgread() function + * discards the region lock, so the buffer must be pinned + * down so that it cannot move and its contents are unchanged. + */ +reread: if ((ret = __memp_pgread(dbmfp, + bhp, LF_ISSET(DB_MPOOL_CREATE))) != 0) { + /* + * !!! + * Discard the buffer unless another thread is waiting + * on our I/O to complete. Regardless, the header has + * the BH_TRASH flag set. + */ + if (bhp->ref == 1) + __memp_bhfree(dbmp, mfp, bhp, 1); + goto err; + } + + ++mp->stat.st_cache_miss; + ++mfp->stat.st_cache_miss; + } + + /* + * If we're returning a page after our current notion of the last-page, + * update our information. Note, there's no way to un-instantiate this + * page, it's going to exist whether it's returned to us dirty or not. + */ + if (bhp->pgno > mfp->last_pgno) + mfp->last_pgno = bhp->pgno; + + ++mp->stat.st_page_clean; + *(void **)addrp = bhp->buf; + +done: /* Update the chain search statistics. */ + if (st_hsearch) { + ++mp->stat.st_hash_searches; + if (st_hsearch > mp->stat.st_hash_longest) + mp->stat.st_hash_longest = st_hsearch; + mp->stat.st_hash_examined += st_hsearch; + } + + UNLOCKREGION(dbmp); + + LOCKHANDLE(dbmp, dbmfp->mutexp); + ++dbmfp->pinref; + UNLOCKHANDLE(dbmp, dbmfp->mutexp); + + return (0); + +err: /* Discard our reference. */ + if (b_incr) + --bhp->ref; + UNLOCKREGION(dbmp); + + *(void **)addrp = NULL; + return (ret); +} diff --git a/mozilla/db/mp/mp_fopen.c b/mozilla/db/mp/mp_fopen.c new file mode 100644 index 00000000000..a4cbac8d4e9 --- /dev/null +++ b/mozilla/db/mp/mp_fopen.c @@ -0,0 +1,505 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)mp_fopen.c 10.47 (Sleepycat) 5/4/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_shash.h" +#include "mp.h" +#include "common_ext.h" + +static int __memp_mf_close __P((DB_MPOOL *, DB_MPOOLFILE *)); +static int __memp_mf_open __P((DB_MPOOL *, + const char *, size_t, db_pgno_t, DB_MPOOL_FINFO *, MPOOLFILE **)); + +/* + * memp_fopen -- + * Open a backing file for the memory pool. + */ +int +memp_fopen(dbmp, path, flags, mode, pagesize, finfop, retp) + DB_MPOOL *dbmp; + const char *path; + u_int32_t flags; + int mode; + size_t pagesize; + DB_MPOOL_FINFO *finfop; + DB_MPOOLFILE **retp; +{ + int ret; + + /* Validate arguments. */ + if ((ret = __db_fchk(dbmp->dbenv, + "memp_fopen", flags, DB_CREATE | DB_NOMMAP | DB_RDONLY)) != 0) + return (ret); + + /* Require a non-zero pagesize. */ + if (pagesize == 0) { + __db_err(dbmp->dbenv, "memp_fopen: pagesize not specified"); + return (EINVAL); + } + + return (__memp_fopen(dbmp, + NULL, path, flags, mode, pagesize, 1, finfop, retp)); +} + +/* + * __memp_fopen -- + * Open a backing file for the memory pool; internal version. + * + * PUBLIC: int __memp_fopen __P((DB_MPOOL *, MPOOLFILE *, const char *, + * PUBLIC: u_int32_t, int, size_t, int, DB_MPOOL_FINFO *, DB_MPOOLFILE **)); + */ +int +__memp_fopen(dbmp, mfp, path, flags, mode, pagesize, needlock, finfop, retp) + DB_MPOOL *dbmp; + MPOOLFILE *mfp; + const char *path; + u_int32_t flags; + int mode, needlock; + size_t pagesize; + DB_MPOOL_FINFO *finfop; + DB_MPOOLFILE **retp; +{ + DB_ENV *dbenv; + DB_MPOOLFILE *dbmfp; + DB_MPOOL_FINFO finfo; + db_pgno_t last_pgno; + size_t size; + u_int32_t mbytes, bytes; + int ret; + u_int8_t idbuf[DB_FILE_ID_LEN]; + char *rpath; + + dbenv = dbmp->dbenv; + ret = 0; + rpath = NULL; + + /* + * If mfp is provided, we take the DB_MPOOL_FINFO information from + * the mfp. We don't bother initializing everything, because some + * of them are expensive to acquire. If no mfp is provided and the + * finfop argument is NULL, we default the values. + */ + if (finfop == NULL) { + memset(&finfo, 0, sizeof(finfo)); + if (mfp != NULL) { + finfo.ftype = mfp->ftype; + finfo.pgcookie = NULL; + finfo.fileid = NULL; + finfo.lsn_offset = mfp->lsn_off; + finfo.clear_len = mfp->clear_len; + } else { + finfo.ftype = 0; + finfo.pgcookie = NULL; + finfo.fileid = NULL; + finfo.lsn_offset = -1; + finfo.clear_len = 0; + } + finfop = &finfo; + } + + /* Allocate and initialize the per-process structure. */ + if ((dbmfp = + (DB_MPOOLFILE *)__db_calloc(1, sizeof(DB_MPOOLFILE))) == NULL) { + __db_err(dbenv, "memp_fopen: %s", strerror(ENOMEM)); + return (ENOMEM); + } + dbmfp->dbmp = dbmp; + dbmfp->fd = -1; + if (LF_ISSET(DB_RDONLY)) + F_SET(dbmfp, MP_READONLY); + + if (path == NULL) { + if (LF_ISSET(DB_RDONLY)) { + __db_err(dbenv, + "memp_fopen: temporary files can't be readonly"); + ret = EINVAL; + goto err; + } + size = 0; + last_pgno = 0; + } else { + /* Get the real name for this file and open it. */ + if ((ret = __db_appname(dbenv, + DB_APP_DATA, NULL, path, 0, NULL, &rpath)) != 0) + goto err; + if ((ret = __db_open(rpath, + LF_ISSET(DB_CREATE | DB_RDONLY), + DB_CREATE | DB_RDONLY, mode, &dbmfp->fd)) != 0) { + __db_err(dbenv, "%s: %s", rpath, strerror(ret)); + goto err; + } + + /* Don't permit files that aren't a multiple of the pagesize. */ + if ((ret = __db_ioinfo(rpath, + dbmfp->fd, &mbytes, &bytes, NULL)) != 0) { + __db_err(dbenv, "%s: %s", rpath, strerror(ret)); + goto err; + } + if (bytes % pagesize) { + __db_err(dbenv, + "%s: file size not a multiple of the pagesize", + rpath); + ret = EINVAL; + goto err; + } + size = mbytes * MEGABYTE + bytes; + last_pgno = size == 0 ? 0 : (size - 1) / pagesize; + + /* + * Get the file id if we weren't given one. Generated file id's + * don't use timestamps, otherwise there'd be no chance of any + * other process joining the party. + */ + if (finfop->fileid == NULL) { + if ((ret = __db_fileid(dbenv, rpath, 0, idbuf)) != 0) + goto err; + finfop->fileid = idbuf; + } + } + + /* + * If we weren't provided an underlying shared object to join with, + * find/allocate the shared file objects. Also allocate space for + * for the per-process thread lock. + */ + if (needlock) + LOCKREGION(dbmp); + + if (mfp == NULL) + ret = __memp_mf_open(dbmp, + path, pagesize, last_pgno, finfop, &mfp); + else { + ++mfp->ref; + ret = 0; + } + if (ret == 0 && + F_ISSET(dbmp, MP_LOCKHANDLE) && (ret = + __memp_ralloc(dbmp, sizeof(db_mutex_t), NULL, &dbmfp->mutexp)) == 0) + LOCKINIT(dbmp, dbmfp->mutexp); + + if (needlock) + UNLOCKREGION(dbmp); + if (ret != 0) + goto err; + + dbmfp->mfp = mfp; + + /* + * If a file: + * + is read-only + * + isn't temporary + * + doesn't require any pgin/pgout support + * + the DB_NOMMAP flag wasn't set + * + and is less than mp_mmapsize bytes in size + * + * we can mmap it instead of reading/writing buffers. Don't do error + * checking based on the mmap call failure. We want to do normal I/O + * on the file if the reason we failed was because the file was on an + * NFS mounted partition, and we can fail in buffer I/O just as easily + * as here. + * + * XXX + * We'd like to test to see if the file is too big to mmap. Since we + * don't know what size or type off_t's or size_t's are, or the largest + * unsigned integral type is, or what random insanity the local C + * compiler will perpetrate, doing the comparison in a portable way is + * flatly impossible. Hope that mmap fails if the file is too large. + */ +#define DB_MAXMMAPSIZE (10 * 1024 * 1024) /* 10 Mb. */ + if (F_ISSET(mfp, MP_CAN_MMAP)) { + if (!F_ISSET(dbmfp, MP_READONLY)) + F_CLR(mfp, MP_CAN_MMAP); + if (path == NULL) + F_CLR(mfp, MP_CAN_MMAP); + if (finfop->ftype != 0) + F_CLR(mfp, MP_CAN_MMAP); + if (LF_ISSET(DB_NOMMAP)) + F_CLR(mfp, MP_CAN_MMAP); + if (size > (dbenv == NULL || dbenv->mp_mmapsize == 0 ? + DB_MAXMMAPSIZE : dbenv->mp_mmapsize)) + F_CLR(mfp, MP_CAN_MMAP); + } + dbmfp->addr = NULL; + if (F_ISSET(mfp, MP_CAN_MMAP)) { + dbmfp->len = size; + if (__db_mapfile(rpath, + dbmfp->fd, dbmfp->len, 1, &dbmfp->addr) != 0) { + dbmfp->addr = NULL; + F_CLR(mfp, MP_CAN_MMAP); + } + } + if (rpath != NULL) + FREES(rpath); + + LOCKHANDLE(dbmp, dbmp->mutexp); + TAILQ_INSERT_TAIL(&dbmp->dbmfq, dbmfp, q); + UNLOCKHANDLE(dbmp, dbmp->mutexp); + + *retp = dbmfp; + return (0); + +err: /* + * Note that we do not have to free the thread mutex, because we + * never get to here after we have successfully allocated it. + */ + if (rpath != NULL) + FREES(rpath); + if (dbmfp->fd != -1) + (void)__db_close(dbmfp->fd); + if (dbmfp != NULL) + FREE(dbmfp, sizeof(DB_MPOOLFILE)); + return (ret); +} + +/* + * __memp_mf_open -- + * Open an MPOOLFILE. + */ +static int +__memp_mf_open(dbmp, path, pagesize, last_pgno, finfop, retp) + DB_MPOOL *dbmp; + const char *path; + size_t pagesize; + db_pgno_t last_pgno; + DB_MPOOL_FINFO *finfop; + MPOOLFILE **retp; +{ + MPOOLFILE *mfp; + int ret; + void *p; + +#define ISTEMPORARY (path == NULL) + + /* + * Walk the list of MPOOLFILE's, looking for a matching file. + * Temporary files can't match previous files. + */ + if (!ISTEMPORARY) + for (mfp = SH_TAILQ_FIRST(&dbmp->mp->mpfq, __mpoolfile); + mfp != NULL; mfp = SH_TAILQ_NEXT(mfp, q, __mpoolfile)) { + if (F_ISSET(mfp, MP_TEMP)) + continue; + if (!memcmp(finfop->fileid, + R_ADDR(dbmp, mfp->fileid_off), DB_FILE_ID_LEN)) { + if (finfop->clear_len != mfp->clear_len || + finfop->ftype != mfp->ftype || + pagesize != mfp->stat.st_pagesize) { + __db_err(dbmp->dbenv, + "%s: ftype, clear length or pagesize changed", + path); + return (EINVAL); + } + + /* Found it: increment the reference count. */ + ++mfp->ref; + *retp = mfp; + return (0); + } + } + + /* Allocate a new MPOOLFILE. */ + if ((ret = __memp_ralloc(dbmp, sizeof(MPOOLFILE), NULL, &mfp)) != 0) + return (ret); + *retp = mfp; + + /* Initialize the structure. */ + memset(mfp, 0, sizeof(MPOOLFILE)); + mfp->ref = 1; + mfp->ftype = finfop->ftype; + mfp->lsn_off = finfop->lsn_offset; + mfp->clear_len = finfop->clear_len; + + /* + * If the user specifies DB_MPOOL_LAST or DB_MPOOL_NEW on a memp_fget, + * we have to know the last page in the file. Figure it out and save + * it away. + */ + mfp->stat.st_pagesize = pagesize; + mfp->orig_last_pgno = mfp->last_pgno = last_pgno; + + F_SET(mfp, MP_CAN_MMAP); + if (ISTEMPORARY) + F_SET(mfp, MP_TEMP); + else { + /* Copy the file path into shared memory. */ + if ((ret = __memp_ralloc(dbmp, + strlen(path) + 1, &mfp->path_off, &p)) != 0) + goto err; + memcpy(p, path, strlen(path) + 1); + + /* Copy the file identification string into shared memory. */ + if ((ret = __memp_ralloc(dbmp, + DB_FILE_ID_LEN, &mfp->fileid_off, &p)) != 0) + goto err; + memcpy(p, finfop->fileid, DB_FILE_ID_LEN); + } + + /* Copy the page cookie into shared memory. */ + if (finfop->pgcookie == NULL || finfop->pgcookie->size == 0) { + mfp->pgcookie_len = 0; + mfp->pgcookie_off = 0; + } else { + if ((ret = __memp_ralloc(dbmp, + finfop->pgcookie->size, &mfp->pgcookie_off, &p)) != 0) + goto err; + memcpy(p, finfop->pgcookie->data, finfop->pgcookie->size); + mfp->pgcookie_len = finfop->pgcookie->size; + } + + /* Prepend the MPOOLFILE to the list of MPOOLFILE's. */ + SH_TAILQ_INSERT_HEAD(&dbmp->mp->mpfq, mfp, q, __mpoolfile); + + if (0) { +err: if (mfp->path_off != 0) + __db_shalloc_free(dbmp->addr, + R_ADDR(dbmp, mfp->path_off)); + if (mfp->fileid_off != 0) + __db_shalloc_free(dbmp->addr, + R_ADDR(dbmp, mfp->fileid_off)); + if (mfp != NULL) + __db_shalloc_free(dbmp->addr, mfp); + mfp = NULL; + } + return (0); +} + +/* + * memp_fclose -- + * Close a backing file for the memory pool. + */ +int +memp_fclose(dbmfp) + DB_MPOOLFILE *dbmfp; +{ + DB_MPOOL *dbmp; + int ret, t_ret; + + dbmp = dbmfp->dbmp; + ret = 0; + + /* Complain if pinned blocks never returned. */ + if (dbmfp->pinref != 0) + __db_err(dbmp->dbenv, "%s: close: %lu blocks left pinned", + __memp_fn(dbmfp), (u_long)dbmfp->pinref); + + /* Remove the DB_MPOOLFILE structure from the list. */ + LOCKHANDLE(dbmp, dbmp->mutexp); + TAILQ_REMOVE(&dbmp->dbmfq, dbmfp, q); + UNLOCKHANDLE(dbmp, dbmp->mutexp); + + /* Close the underlying MPOOLFILE. */ + (void)__memp_mf_close(dbmp, dbmfp); + + /* Discard any mmap information. */ + if (dbmfp->addr != NULL && + (ret = __db_unmapfile(dbmfp->addr, dbmfp->len)) != 0) + __db_err(dbmp->dbenv, + "%s: %s", __memp_fn(dbmfp), strerror(ret)); + + /* Close the file; temporary files may not yet have been created. */ + if (dbmfp->fd != -1 && (t_ret = __db_close(dbmfp->fd)) != 0) { + __db_err(dbmp->dbenv, + "%s: %s", __memp_fn(dbmfp), strerror(t_ret)); + if (ret != 0) + t_ret = ret; + } + + /* Free memory. */ + if (dbmfp->mutexp != NULL) { + LOCKREGION(dbmp); + __db_shalloc_free(dbmp->addr, dbmfp->mutexp); + UNLOCKREGION(dbmp); + } + + /* Discard the DB_MPOOLFILE structure. */ + FREE(dbmfp, sizeof(DB_MPOOLFILE)); + + return (ret); +} + +/* + * __memp_mf_close -- + * Close down an MPOOLFILE. + */ +static int +__memp_mf_close(dbmp, dbmfp) + DB_MPOOL *dbmp; + DB_MPOOLFILE *dbmfp; +{ + BH *bhp, *nbhp; + MPOOL *mp; + MPOOLFILE *mfp; + size_t mf_offset; + + mp = dbmp->mp; + mfp = dbmfp->mfp; + + LOCKREGION(dbmp); + + /* If more than a single reference, simply decrement. */ + if (mfp->ref > 1) { + --mfp->ref; + goto ret1; + } + + /* + * Move any BH's held by the file to the free list. We don't free the + * memory itself because we may be discarding the memory pool, and it's + * fairly expensive to reintegrate the buffers back into the region for + * no purpose. + */ + mf_offset = R_OFFSET(dbmp, mfp); + for (bhp = SH_TAILQ_FIRST(&mp->bhq, __bh); bhp != NULL; bhp = nbhp) { + nbhp = SH_TAILQ_NEXT(bhp, q, __bh); + +#ifdef DEBUG_NO_DIRTY + /* Complain if we find any blocks that were left dirty. */ + if (F_ISSET(bhp, BH_DIRTY)) + __db_err(dbmp->dbenv, + "%s: close: pgno %lu left dirty; ref %lu", + __memp_fn(dbmfp), + (u_long)bhp->pgno, (u_long)bhp->ref); +#endif + + if (bhp->mf_offset == mf_offset) { + if (F_ISSET(bhp, BH_DIRTY)) { + ++mp->stat.st_page_clean; + --mp->stat.st_page_dirty; + } + __memp_bhfree(dbmp, mfp, bhp, 0); + SH_TAILQ_INSERT_HEAD(&mp->bhfq, bhp, q, __bh); + } + } + + /* Delete from the list of MPOOLFILEs. */ + SH_TAILQ_REMOVE(&mp->mpfq, mfp, q, __mpoolfile); + + /* Free the space. */ + if (mfp->path_off != 0) + __db_shalloc_free(dbmp->addr, R_ADDR(dbmp, mfp->path_off)); + if (mfp->fileid_off != 0) + __db_shalloc_free(dbmp->addr, R_ADDR(dbmp, mfp->fileid_off)); + if (mfp->pgcookie_off != 0) + __db_shalloc_free(dbmp->addr, R_ADDR(dbmp, mfp->pgcookie_off)); + __db_shalloc_free(dbmp->addr, mfp); + +ret1: UNLOCKREGION(dbmp); + return (0); +} diff --git a/mozilla/db/mp/mp_fput.c b/mozilla/db/mp/mp_fput.c new file mode 100644 index 00000000000..5675493137c --- /dev/null +++ b/mozilla/db/mp/mp_fput.c @@ -0,0 +1,150 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)mp_fput.c 10.22 (Sleepycat) 4/26/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_shash.h" +#include "mp.h" +#include "common_ext.h" + +/* + * memp_fput -- + * Mpool file put function. + */ +int +memp_fput(dbmfp, pgaddr, flags) + DB_MPOOLFILE *dbmfp; + void *pgaddr; + u_int32_t flags; +{ + BH *bhp; + DB_MPOOL *dbmp; + MPOOL *mp; + int wrote, ret; + + dbmp = dbmfp->dbmp; + mp = dbmp->mp; + + /* Validate arguments. */ + if (flags) { + if ((ret = __db_fchk(dbmp->dbenv, "memp_fput", flags, + DB_MPOOL_CLEAN | DB_MPOOL_DIRTY | DB_MPOOL_DISCARD)) != 0) + return (ret); + if ((ret = __db_fcchk(dbmp->dbenv, "memp_fput", + flags, DB_MPOOL_CLEAN, DB_MPOOL_DIRTY)) != 0) + return (ret); + + if (LF_ISSET(DB_MPOOL_DIRTY) && F_ISSET(dbmfp, MP_READONLY)) { + __db_err(dbmp->dbenv, + "%s: dirty flag set for readonly file page", + __memp_fn(dbmfp)); + return (EACCES); + } + } + + /* Decrement the pinned reference count. */ + LOCKHANDLE(dbmp, dbmfp->mutexp); + if (dbmfp->pinref == 0) + __db_err(dbmp->dbenv, + "%s: put: more blocks returned than retrieved", + __memp_fn(dbmfp)); + else + --dbmfp->pinref; + UNLOCKHANDLE(dbmp, dbmfp->mutexp); + + /* + * If we're mapping the file, there's nothing to do. Because we can + * stop mapping the file at any time, we have to check on each buffer + * to see if the address we gave the application was part of the map + * region. + */ + if (dbmfp->addr != NULL && pgaddr >= dbmfp->addr && + (u_int8_t *)pgaddr <= (u_int8_t *)dbmfp->addr + dbmfp->len) + return (0); + + /* Convert the page address to a buffer header. */ + bhp = (BH *)((u_int8_t *)pgaddr - SSZA(BH, buf)); + + LOCKREGION(dbmp); + + /* Set/clear the page bits. */ + if (LF_ISSET(DB_MPOOL_CLEAN) && F_ISSET(bhp, BH_DIRTY)) { + ++mp->stat.st_page_clean; + --mp->stat.st_page_dirty; + F_CLR(bhp, BH_DIRTY); + } + if (LF_ISSET(DB_MPOOL_DIRTY) && !F_ISSET(bhp, BH_DIRTY)) { + --mp->stat.st_page_clean; + ++mp->stat.st_page_dirty; + F_SET(bhp, BH_DIRTY); + } + if (LF_ISSET(DB_MPOOL_DISCARD)) + F_SET(bhp, BH_DISCARD); + + /* + * Check for a reference count going to zero. This can happen if the + * application returns a page twice. + */ + if (bhp->ref == 0) { + __db_err(dbmp->dbenv, "%s: page %lu: unpinned page returned", + __memp_fn(dbmfp), (u_long)bhp->pgno); + UNLOCKREGION(dbmp); + return (EINVAL); + } + + /* + * If more than one reference to the page, we're done. Ignore the + * discard flags (for now) and leave it at its position in the LRU + * chain. The rest gets done at last reference close. + */ + if (--bhp->ref > 0) { + UNLOCKREGION(dbmp); + return (0); + } + + /* + * If this buffer is scheduled for writing because of a checkpoint, we + * need to write it (if we marked it dirty), or update the checkpoint + * counters (if we didn't mark it dirty). If we try to write it and + * can't, that's not necessarily an error, but set a flag so that the + * next time the memp_sync function runs we try writing it there, as + * the checkpoint application better be able to write all of the files. + */ + if (F_ISSET(bhp, BH_WRITE)) + if (F_ISSET(bhp, BH_DIRTY)) { + if (__memp_bhwrite(dbmp, + dbmfp->mfp, bhp, NULL, &wrote) != 0 || !wrote) + F_SET(mp, MP_LSN_RETRY); + } else { + F_CLR(bhp, BH_WRITE); + + --dbmfp->mfp->lsn_cnt; + --mp->lsn_cnt; + } + + /* Move the buffer to the head/tail of the LRU chain. */ + SH_TAILQ_REMOVE(&mp->bhq, bhp, q, __bh); + if (F_ISSET(bhp, BH_DISCARD)) + SH_TAILQ_INSERT_HEAD(&mp->bhq, bhp, q, __bh); + else + SH_TAILQ_INSERT_TAIL(&mp->bhq, bhp, q); + + + UNLOCKREGION(dbmp); + return (0); +} diff --git a/mozilla/db/mp/mp_fset.c b/mozilla/db/mp/mp_fset.c new file mode 100644 index 00000000000..3b352aa5532 --- /dev/null +++ b/mozilla/db/mp/mp_fset.c @@ -0,0 +1,81 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)mp_fset.c 10.15 (Sleepycat) 4/26/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_shash.h" +#include "mp.h" +#include "common_ext.h" + +/* + * memp_fset -- + * Mpool page set-flag routine. + */ +int +memp_fset(dbmfp, pgaddr, flags) + DB_MPOOLFILE *dbmfp; + void *pgaddr; + u_int32_t flags; +{ + BH *bhp; + DB_MPOOL *dbmp; + MPOOL *mp; + int ret; + + dbmp = dbmfp->dbmp; + mp = dbmp->mp; + + /* Validate arguments. */ + if (flags == 0) + return (__db_ferr(dbmp->dbenv, "memp_fset", 1)); + + if ((ret = __db_fchk(dbmp->dbenv, "memp_fset", flags, + DB_MPOOL_DIRTY | DB_MPOOL_CLEAN | DB_MPOOL_DISCARD)) != 0) + return (ret); + if ((ret = __db_fcchk(dbmp->dbenv, "memp_fset", + flags, DB_MPOOL_CLEAN, DB_MPOOL_DIRTY)) != 0) + return (ret); + + if (LF_ISSET(DB_MPOOL_DIRTY) && F_ISSET(dbmfp, MP_READONLY)) { + __db_err(dbmp->dbenv, + "%s: dirty flag set for readonly file page", + __memp_fn(dbmfp)); + return (EACCES); + } + + /* Convert the page address to a buffer header. */ + bhp = (BH *)((u_int8_t *)pgaddr - SSZA(BH, buf)); + + LOCKREGION(dbmp); + + if (LF_ISSET(DB_MPOOL_CLEAN) && F_ISSET(bhp, BH_DIRTY)) { + ++mp->stat.st_page_clean; + --mp->stat.st_page_dirty; + F_CLR(bhp, BH_DIRTY); + } + if (LF_ISSET(DB_MPOOL_DIRTY) && !F_ISSET(bhp, BH_DIRTY)) { + --mp->stat.st_page_clean; + ++mp->stat.st_page_dirty; + F_SET(bhp, BH_DIRTY); + } + if (LF_ISSET(DB_MPOOL_DISCARD)) + F_SET(bhp, BH_DISCARD); + + UNLOCKREGION(dbmp); + return (0); +} diff --git a/mozilla/db/mp/mp_open.c b/mozilla/db/mp/mp_open.c new file mode 100644 index 00000000000..fc985bc521f --- /dev/null +++ b/mozilla/db/mp/mp_open.c @@ -0,0 +1,202 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)mp_open.c 10.23 (Sleepycat) 5/3/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_shash.h" +#include "mp.h" +#include "common_ext.h" + +/* + * memp_open -- + * Initialize and/or join a memory pool. + */ +int +memp_open(path, flags, mode, dbenv, retp) + const char *path; + u_int32_t flags; + int mode; + DB_ENV *dbenv; + DB_MPOOL **retp; +{ + DB_MPOOL *dbmp; + size_t cachesize; + int is_private, ret; + + /* Validate arguments. */ +#ifdef HAVE_SPINLOCKS +#define OKFLAGS (DB_CREATE | DB_MPOOL_PRIVATE | DB_NOMMAP | DB_THREAD) +#else +#define OKFLAGS (DB_CREATE | DB_MPOOL_PRIVATE | DB_NOMMAP) +#endif + if ((ret = __db_fchk(dbenv, "memp_open", flags, OKFLAGS)) != 0) + return (ret); + + /* Extract fields from DB_ENV structure. */ + cachesize = dbenv == NULL ? 0 : dbenv->mp_size; + + /* Create and initialize the DB_MPOOL structure. */ + if ((dbmp = (DB_MPOOL *)__db_calloc(1, sizeof(DB_MPOOL))) == NULL) + return (ENOMEM); + LIST_INIT(&dbmp->dbregq); + TAILQ_INIT(&dbmp->dbmfq); + + dbmp->dbenv = dbenv; + + /* Decide if it's possible for anyone else to access the pool. */ + is_private = + (dbenv == NULL && path == NULL) || LF_ISSET(DB_MPOOL_PRIVATE); + + /* + * Map in the region. We do locking regardless, as portions of it are + * implemented in common code (if we put the region in a file, that is). + */ + F_SET(dbmp, MP_LOCKREGION); + if ((ret = __memp_ropen(dbmp, + path, cachesize, mode, is_private, LF_ISSET(DB_CREATE))) != 0) + goto err; + F_CLR(dbmp, MP_LOCKREGION); + + /* + * If there's concurrent access, then we have to lock the region. + * If it's threaded, then we have to lock both the handles and the + * region, and we need to allocate a mutex for that purpose. + */ + if (!is_private) + F_SET(dbmp, MP_LOCKREGION); + if (LF_ISSET(DB_THREAD)) { + F_SET(dbmp, MP_LOCKHANDLE | MP_LOCKREGION); + LOCKREGION(dbmp); + ret = __memp_ralloc(dbmp, + sizeof(db_mutex_t), NULL, &dbmp->mutexp); + UNLOCKREGION(dbmp); + if (ret != 0) { + (void)memp_close(dbmp); + goto err; + } + LOCKINIT(dbmp, dbmp->mutexp); + } + + *retp = dbmp; + return (0); + +err: if (dbmp != NULL) + FREE(dbmp, sizeof(DB_MPOOL)); + return (ret); +} + +/* + * memp_close -- + * Close a memory pool. + */ +int +memp_close(dbmp) + DB_MPOOL *dbmp; +{ + DB_MPOOLFILE *dbmfp; + DB_MPREG *mpreg; + int ret, t_ret; + + ret = 0; + + /* Discard DB_MPREGs. */ + while ((mpreg = LIST_FIRST(&dbmp->dbregq)) != NULL) { + LIST_REMOVE(mpreg, q); + FREE(mpreg, sizeof(DB_MPREG)); + } + + /* Discard DB_MPOOLFILEs. */ + while ((dbmfp = TAILQ_FIRST(&dbmp->dbmfq)) != NULL) + if ((t_ret = memp_fclose(dbmfp)) != 0 && ret == 0) + ret = t_ret; + + /* Discard thread mutex. */ + if (F_ISSET(dbmp, MP_LOCKHANDLE)) { + LOCKREGION(dbmp); + __db_shalloc_free(dbmp->addr, dbmp->mutexp); + UNLOCKREGION(dbmp); + } + + /* Close the region. */ + if ((t_ret = __db_rdetach(&dbmp->reginfo)) != 0 && ret == 0) + ret = t_ret; + + if (dbmp->reginfo.path != NULL) + FREES(dbmp->reginfo.path); + FREE(dbmp, sizeof(DB_MPOOL)); + + return (ret); +} + +/* + * memp_unlink -- + * Exit a memory pool. + */ +int +memp_unlink(path, force, dbenv) + const char *path; + int force; + DB_ENV *dbenv; +{ + REGINFO reginfo; + int ret; + + memset(®info, 0, sizeof(reginfo)); + reginfo.dbenv = dbenv; + reginfo.appname = DB_APP_NONE; + if (path != NULL && (reginfo.path = __db_strdup(path)) == NULL) + return (ENOMEM); + reginfo.file = DB_DEFAULT_MPOOL_FILE; + ret = __db_runlink(®info, force); + if (reginfo.path != NULL) + FREES(reginfo.path); + return (ret); +} + +/* + * memp_register -- + * Register a file type's pgin, pgout routines. + */ +int +memp_register(dbmp, ftype, pgin, pgout) + DB_MPOOL *dbmp; + int ftype; + int (*pgin) __P((db_pgno_t, void *, DBT *)); + int (*pgout) __P((db_pgno_t, void *, DBT *)); +{ + DB_MPREG *mpr; + + if ((mpr = (DB_MPREG *)__db_malloc(sizeof(DB_MPREG))) == NULL) + return (ENOMEM); + + mpr->ftype = ftype; + mpr->pgin = pgin; + mpr->pgout = pgout; + + /* + * Insert at the head. Because we do a linear walk, we'll find + * the most recent registry in the case of multiple entries, so + * we don't have to check for multiple registries. + */ + LOCKHANDLE(dbmp, dbmp->mutexp); + LIST_INSERT_HEAD(&dbmp->dbregq, mpr, q); + UNLOCKHANDLE(dbmp, dbmp->mutexp); + + return (0); +} diff --git a/mozilla/db/mp/mp_pr.c b/mozilla/db/mp/mp_pr.c new file mode 100644 index 00000000000..e83e0f44fa0 --- /dev/null +++ b/mozilla/db/mp/mp_pr.c @@ -0,0 +1,306 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)mp_pr.c 10.26 (Sleepycat) 5/23/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "shqueue.h" +#include "db_shash.h" +#include "mp.h" +#include "db_auto.h" +#include "db_ext.h" +#include "common_ext.h" + +static void __memp_pbh __P((DB_MPOOL *, BH *, size_t *, FILE *)); + +/* + * memp_stat -- + * Display MPOOL statistics. + */ +int +memp_stat(dbmp, gspp, fspp, db_malloc) + DB_MPOOL *dbmp; + DB_MPOOL_STAT **gspp; + DB_MPOOL_FSTAT ***fspp; + void *(*db_malloc) __P((size_t)); +{ + DB_MPOOL_FSTAT **tfsp; + MPOOLFILE *mfp; + size_t len, nlen; + char *name; + + /* Allocate space for the global statistics. */ + if (gspp != NULL) { + *gspp = NULL; + + if ((*gspp = db_malloc == NULL ? + (DB_MPOOL_STAT *)__db_malloc(sizeof(**gspp)) : + (DB_MPOOL_STAT *)db_malloc(sizeof(**gspp))) == NULL) + return (ENOMEM); + + LOCKREGION(dbmp); + + /* Copy out the global statistics. */ + **gspp = dbmp->mp->stat; + (*gspp)->st_hash_buckets = dbmp->mp->htab_buckets; + (*gspp)->st_region_wait = + dbmp->mp->rlayout.lock.mutex_set_wait; + (*gspp)->st_region_nowait = + dbmp->mp->rlayout.lock.mutex_set_nowait; + (*gspp)->st_refcnt = dbmp->mp->rlayout.refcnt; + (*gspp)->st_regsize = dbmp->mp->rlayout.size; + + UNLOCKREGION(dbmp); + } + + if (fspp != NULL) { + *fspp = NULL; + + LOCKREGION(dbmp); + + /* Count the MPOOLFILE structures. */ + for (len = 0, + mfp = SH_TAILQ_FIRST(&dbmp->mp->mpfq, __mpoolfile); + mfp != NULL; + ++len, mfp = SH_TAILQ_NEXT(mfp, q, __mpoolfile)) + ; + + UNLOCKREGION(dbmp); + + if (len == 0) + return (0); + + /* Allocate space for the pointers. */ + len = (len + 1) * sizeof(DB_MPOOL_FSTAT *); + if ((*fspp = db_malloc == NULL ? + (DB_MPOOL_FSTAT **)__db_malloc(len) : + (DB_MPOOL_FSTAT **)db_malloc(len)) == NULL) + return (ENOMEM); + + LOCKREGION(dbmp); + + /* Build each individual entry. */ + for (tfsp = *fspp, + mfp = SH_TAILQ_FIRST(&dbmp->mp->mpfq, __mpoolfile); + mfp != NULL; + ++tfsp, mfp = SH_TAILQ_NEXT(mfp, q, __mpoolfile)) { + name = __memp_fns(dbmp, mfp); + nlen = strlen(name); + len = sizeof(DB_MPOOL_FSTAT) + nlen + 1; + if ((*tfsp = db_malloc == NULL ? + (DB_MPOOL_FSTAT *)__db_malloc(len) : + (DB_MPOOL_FSTAT *)db_malloc(len)) == NULL) + return (ENOMEM); + **tfsp = mfp->stat; + (*tfsp)->file_name = (char *) + (u_int8_t *)*tfsp + sizeof(DB_MPOOL_FSTAT); + memcpy((*tfsp)->file_name, name, nlen + 1); + } + *tfsp = NULL; + + UNLOCKREGION(dbmp); + } + return (0); +} + +/* + * __memp_fn -- + * On errors we print whatever is available as the file name. + * + * PUBLIC: char * __memp_fn __P((DB_MPOOLFILE *)); + */ +char * +__memp_fn(dbmfp) + DB_MPOOLFILE *dbmfp; +{ + return (__memp_fns(dbmfp->dbmp, dbmfp->mfp)); +} + +/* + * __memp_fns -- + * On errors we print whatever is available as the file name. + * + * PUBLIC: char * __memp_fns __P((DB_MPOOL *, MPOOLFILE *)); + * + */ +char * +__memp_fns(dbmp, mfp) + DB_MPOOL *dbmp; + MPOOLFILE *mfp; +{ + if (mfp->path_off == 0) + return ((char *)"temporary"); + + return ((char *)R_ADDR(dbmp, mfp->path_off)); +} + +#define FMAP_ENTRIES 200 /* Files we map. */ + +#define MPOOL_DUMP_HASH 0x01 /* Debug hash chains. */ +#define MPOOL_DUMP_LRU 0x02 /* Debug LRU chains. */ +#define MPOOL_DUMP_MEM 0x04 /* Debug region memory. */ +#define MPOOL_DUMP_ALL 0x07 /* Debug all. */ + + +/* + * __memp_dump_region -- + * Display MPOOL structures. + * + * PUBLIC: void __memp_dump_region __P((DB_MPOOL *, char *, FILE *)); + */ +void +__memp_dump_region(dbmp, area, fp) + DB_MPOOL *dbmp; + char *area; + FILE *fp; +{ + BH *bhp; + DB_HASHTAB *htabp; + DB_MPOOLFILE *dbmfp; + MPOOL *mp; + MPOOLFILE *mfp; + size_t bucket, fmap[FMAP_ENTRIES + 1]; + u_int32_t flags; + int cnt; + + /* Make it easy to call from the debugger. */ + if (fp == NULL) + fp = stderr; + + for (flags = 0; *area != '\0'; ++area) + switch (*area) { + case 'A': + LF_SET(MPOOL_DUMP_ALL); + break; + case 'h': + LF_SET(MPOOL_DUMP_HASH); + break; + case 'l': + LF_SET(MPOOL_DUMP_LRU); + break; + case 'm': + LF_SET(MPOOL_DUMP_MEM); + break; + } + + LOCKREGION(dbmp); + + mp = dbmp->mp; + + /* Display MPOOL structures. */ + (void)fprintf(fp, "%s\nPool (region addr 0x%lx, alloc addr 0x%lx)\n", + DB_LINE, (u_long)dbmp->reginfo.addr, (u_long)dbmp->addr); + + /* Display the MPOOLFILE structures. */ + cnt = 0; + for (mfp = SH_TAILQ_FIRST(&dbmp->mp->mpfq, __mpoolfile); + mfp != NULL; mfp = SH_TAILQ_NEXT(mfp, q, __mpoolfile), ++cnt) { + (void)fprintf(fp, "file #%d: %s: %lu references: %s\n", + cnt + 1, __memp_fns(dbmp, mfp), (u_long)mfp->ref, + F_ISSET(mfp, MP_CAN_MMAP) ? "mmap" : "read/write"); + if (cnt < FMAP_ENTRIES) + fmap[cnt] = R_OFFSET(dbmp, mfp); + } + + for (dbmfp = TAILQ_FIRST(&dbmp->dbmfq); + dbmfp != NULL; dbmfp = TAILQ_NEXT(dbmfp, q), ++cnt) { + (void)fprintf(fp, "file #%d: %s: fd: %d: per-process, %s\n", + cnt + 1, __memp_fn(dbmfp), dbmfp->fd, + F_ISSET(dbmfp, MP_READONLY) ? "readonly" : "read/write"); + if (cnt < FMAP_ENTRIES) + fmap[cnt] = R_OFFSET(dbmp, mfp); + } + if (cnt < FMAP_ENTRIES) + fmap[cnt] = INVALID; + else + fmap[FMAP_ENTRIES] = INVALID; + + /* Display the hash table list of BH's. */ + if (LF_ISSET(MPOOL_DUMP_HASH)) { + (void)fprintf(fp, + "%s\nBH hash table (%lu hash slots)\npageno, file, ref, address\n", + DB_LINE, (u_long)mp->htab_buckets); + for (htabp = dbmp->htab, + bucket = 0; bucket < mp->htab_buckets; ++htabp, ++bucket) { + if (SH_TAILQ_FIRST(&dbmp->htab[bucket], __bh) != NULL) + (void)fprintf(fp, "%lu:\n", (u_long)bucket); + for (bhp = SH_TAILQ_FIRST(&dbmp->htab[bucket], __bh); + bhp != NULL; bhp = SH_TAILQ_NEXT(bhp, hq, __bh)) + __memp_pbh(dbmp, bhp, fmap, fp); + } + } + + /* Display the LRU list of BH's. */ + if (LF_ISSET(MPOOL_DUMP_LRU)) { + (void)fprintf(fp, "%s\nBH LRU list\n", DB_LINE); + (void)fprintf(fp, "pageno, file, ref, address\n"); + for (bhp = SH_TAILQ_FIRST(&dbmp->mp->bhq, __bh); + bhp != NULL; bhp = SH_TAILQ_NEXT(bhp, q, __bh)) + __memp_pbh(dbmp, bhp, fmap, fp); + } + + if (LF_ISSET(MPOOL_DUMP_MEM)) + __db_shalloc_dump(dbmp->addr, fp); + + UNLOCKREGION(dbmp); + + /* Flush in case we're debugging. */ + (void)fflush(fp); +} + +/* + * __memp_pbh -- + * Display a BH structure. + */ +static void +__memp_pbh(dbmp, bhp, fmap, fp) + DB_MPOOL *dbmp; + BH *bhp; + size_t *fmap; + FILE *fp; +{ + static const FN fn[] = { + { BH_CALLPGIN, "callpgin" }, + { BH_DIRTY, "dirty" }, + { BH_DISCARD, "discard" }, + { BH_LOCKED, "locked" }, + { BH_TRASH, "trash" }, + { BH_WRITE, "write" }, + { 0 }, + }; + int i; + + for (i = 0; i < FMAP_ENTRIES; ++i) + if (fmap[i] == INVALID || fmap[i] == bhp->mf_offset) + break; + + if (fmap[i] == INVALID) + (void)fprintf(fp, " %4lu, %lu, %2lu, %lu", + (u_long)bhp->pgno, (u_long)bhp->mf_offset, + (u_long)bhp->ref, (u_long)R_OFFSET(dbmp, bhp)); + else + (void)fprintf(fp, " %4lu, #%d, %2lu, %lu", + (u_long)bhp->pgno, i + 1, + (u_long)bhp->ref, (u_long)R_OFFSET(dbmp, bhp)); + + __db_prflags(bhp->flags, fn, fp); + + (void)fprintf(fp, "\n"); +} diff --git a/mozilla/db/mp/mp_region.c b/mozilla/db/mp/mp_region.c new file mode 100644 index 00000000000..6b92fbdad48 --- /dev/null +++ b/mozilla/db/mp/mp_region.c @@ -0,0 +1,307 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)mp_region.c 10.30 (Sleepycat) 5/31/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_shash.h" +#include "mp.h" +#include "common_ext.h" + +/* + * __memp_ralloc -- + * Allocate some space in the mpool region. + * + * PUBLIC: int __memp_ralloc __P((DB_MPOOL *, size_t, size_t *, void *)); + */ +int +__memp_ralloc(dbmp, len, offsetp, retp) + DB_MPOOL *dbmp; + size_t len, *offsetp; + void *retp; +{ + BH *bhp, *nbhp; + MPOOL *mp; + MPOOLFILE *mfp; + size_t fsize, total; + int nomore, restart, ret, wrote; + void *p; + + mp = dbmp->mp; + + nomore = 0; +alloc: if ((ret = __db_shalloc(dbmp->addr, len, MUTEX_ALIGNMENT, &p)) == 0) { + if (offsetp != NULL) + *offsetp = R_OFFSET(dbmp, p); + *(void **)retp = p; + return (0); + } + if (nomore) { + __db_err(dbmp->dbenv, "%s", strerror(ret)); + return (ret); + } + + /* Look for a buffer on the free list that's the right size. */ + for (bhp = + SH_TAILQ_FIRST(&mp->bhfq, __bh); bhp != NULL; bhp = nbhp) { + nbhp = SH_TAILQ_NEXT(bhp, q, __bh); + + if (__db_shsizeof(bhp) == len) { + SH_TAILQ_REMOVE(&mp->bhfq, bhp, q, __bh); + if (offsetp != NULL) + *offsetp = R_OFFSET(dbmp, bhp); + *(void **)retp = bhp; + return (0); + } + } + + /* Discard from the free list until we've freed enough memory. */ + total = 0; + for (bhp = + SH_TAILQ_FIRST(&mp->bhfq, __bh); bhp != NULL; bhp = nbhp) { + nbhp = SH_TAILQ_NEXT(bhp, q, __bh); + + SH_TAILQ_REMOVE(&mp->bhfq, bhp, q, __bh); + __db_shalloc_free(dbmp->addr, bhp); + --mp->stat.st_page_clean; + + /* + * Retry as soon as we've freed up sufficient space. If we + * will have to coalesce memory to satisfy the request, don't + * try until it's likely (possible?) that we'll succeed. + */ + total += fsize = __db_shsizeof(bhp); + if (fsize >= len || total >= 3 * len) + goto alloc; + } + +retry: /* Find a buffer we can flush; pure LRU. */ + total = 0; + for (bhp = + SH_TAILQ_FIRST(&mp->bhq, __bh); bhp != NULL; bhp = nbhp) { + nbhp = SH_TAILQ_NEXT(bhp, q, __bh); + + /* Ignore pinned or locked (I/O in progress) buffers. */ + if (bhp->ref != 0 || F_ISSET(bhp, BH_LOCKED)) + continue; + + /* Find the associated MPOOLFILE. */ + mfp = R_ADDR(dbmp, bhp->mf_offset); + + /* + * Write the page if it's dirty. + * + * If we wrote the page, fall through and free the buffer. We + * don't have to rewalk the list to acquire the buffer because + * it was never available for any other process to modify it. + * If we didn't write the page, but we discarded and reacquired + * the region lock, restart the buffer list walk. If we neither + * wrote the buffer nor discarded the region lock, continue down + * the buffer list. + */ + if (F_ISSET(bhp, BH_DIRTY)) { + if ((ret = __memp_bhwrite(dbmp, + mfp, bhp, &restart, &wrote)) != 0) + return (ret); + + /* + * It's possible that another process wants this buffer + * and incremented the ref count while we were writing + * it. + */ + if (bhp->ref != 0) + goto retry; + + if (wrote) + ++mp->stat.st_rw_evict; + else { + if (restart) + goto retry; + continue; + } + } else + ++mp->stat.st_ro_evict; + + /* + * Check to see if the buffer is the size we're looking for. + * If it is, simply reuse it. + */ + total += fsize = __db_shsizeof(bhp); + if (fsize == len) { + __memp_bhfree(dbmp, mfp, bhp, 0); + + if (offsetp != NULL) + *offsetp = R_OFFSET(dbmp, bhp); + *(void **)retp = bhp; + return (0); + } + + /* Free the buffer. */ + __memp_bhfree(dbmp, mfp, bhp, 1); + + /* + * Retry as soon as we've freed up sufficient space. If we + * have to coalesce of memory to satisfy the request, don't + * try until it's likely (possible?) that we'll succeed. + */ + if (fsize >= len || total >= 3 * len) + goto alloc; + + /* Restart the walk if we discarded the region lock. */ + if (restart) + goto retry; + } + nomore = 1; + goto alloc; +} + +/* + * __memp_ropen -- + * Attach to, and optionally create, the mpool region. + * + * PUBLIC: int __memp_ropen + * PUBLIC: __P((DB_MPOOL *, const char *, size_t, int, int, u_int32_t)); + */ +int +__memp_ropen(dbmp, path, cachesize, mode, is_private, flags) + DB_MPOOL *dbmp; + const char *path; + size_t cachesize; + int mode, is_private; + u_int32_t flags; +{ + MPOOL *mp; + size_t rlen; + int defcache, ret; + + /* + * Unlike other DB subsystems, mpool can't simply grow the region + * because it returns pointers into the region to its clients. To + * "grow" the region, we'd have to allocate a new region and then + * store a region number in the structures that reference regional + * objects. It's reasonable that we fail regardless, as clients + * shouldn't have every page in the region pinned, so the only + * "failure" mode should be a performance penalty because we don't + * find a page in the cache that we'd like to have found. + * + * Up the user's cachesize by 25% to account for our overhead. + */ + defcache = 0; + if (cachesize < DB_CACHESIZE_MIN) + if (cachesize == 0) { + defcache = 1; + cachesize = DB_CACHESIZE_DEF; + } else + cachesize = DB_CACHESIZE_MIN; + rlen = cachesize + cachesize / 4; + + /* + * Map in the region. + * + * If it's a private mpool, use malloc, it's a lot faster than + * instantiating a region. + */ + dbmp->reginfo.dbenv = dbmp->dbenv; + dbmp->reginfo.appname = DB_APP_NONE; + if (path == NULL) + dbmp->reginfo.path = NULL; + else + if ((dbmp->reginfo.path = __db_strdup(path)) == NULL) + return (ENOMEM); + dbmp->reginfo.file = DB_DEFAULT_MPOOL_FILE; + dbmp->reginfo.mode = mode; + dbmp->reginfo.size = rlen; + dbmp->reginfo.dbflags = flags; + dbmp->reginfo.flags = 0; + if (defcache) + F_SET(&dbmp->reginfo, REGION_SIZEDEF); + + /* + * If we're creating a temporary region, don't use any standard + * naming. + */ + if (is_private) { + dbmp->reginfo.appname = DB_APP_TMP; + dbmp->reginfo.file = NULL; + F_SET(&dbmp->reginfo, REGION_PRIVATE); + } + + if ((ret = __db_rattach(&dbmp->reginfo)) != 0) { + if (dbmp->reginfo.path != NULL) + FREES(dbmp->reginfo.path); + return (ret); + } + + /* + * The MPOOL structure is first in the region, the rest of the region + * is free space. + */ + dbmp->mp = dbmp->reginfo.addr; + dbmp->addr = (u_int8_t *)dbmp->mp + sizeof(MPOOL); + + /* Initialize a created region. */ + if (F_ISSET(&dbmp->reginfo, REGION_CREATED)) { + mp = dbmp->mp; + SH_TAILQ_INIT(&mp->bhq); + SH_TAILQ_INIT(&mp->bhfq); + SH_TAILQ_INIT(&mp->mpfq); + + __db_shalloc_init(dbmp->addr, rlen - sizeof(MPOOL)); + + /* + * Assume we want to keep the hash chains with under 10 pages + * on each chain. We don't know the pagesize in advance, and + * it may differ for different files. Use a pagesize of 1K for + * the calculation -- we walk these chains a lot, they should + * be short. + */ + mp->htab_buckets = + __db_tablesize((cachesize / (1 * 1024)) / 10); + + /* Allocate hash table space and initialize it. */ + if ((ret = __db_shalloc(dbmp->addr, + mp->htab_buckets * sizeof(DB_HASHTAB), + 0, &dbmp->htab)) != 0) + goto err; + __db_hashinit(dbmp->htab, mp->htab_buckets); + mp->htab = R_OFFSET(dbmp, dbmp->htab); + + ZERO_LSN(mp->lsn); + mp->lsn_cnt = 0; + + memset(&mp->stat, 0, sizeof(mp->stat)); + mp->stat.st_cachesize = cachesize; + + mp->flags = 0; + } + + /* Get the local hash table address. */ + dbmp->htab = R_ADDR(dbmp, dbmp->mp->htab); + + UNLOCKREGION(dbmp); + return (0); + +err: UNLOCKREGION(dbmp); + (void)__db_rdetach(&dbmp->reginfo); + if (F_ISSET(&dbmp->reginfo, REGION_CREATED)) + (void)memp_unlink(path, 1, dbmp->dbenv); + + if (dbmp->reginfo.path != NULL) + FREES(dbmp->reginfo.path); + return (ret); +} diff --git a/mozilla/db/mp/mp_sync.c b/mozilla/db/mp/mp_sync.c new file mode 100644 index 00000000000..c6c4b4837c0 --- /dev/null +++ b/mozilla/db/mp/mp_sync.c @@ -0,0 +1,513 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)mp_sync.c 10.25 (Sleepycat) 4/26/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_shash.h" +#include "mp.h" +#include "common_ext.h" + +static int __bhcmp __P((const void *, const void *)); +static int __memp_fsync __P((DB_MPOOLFILE *)); + +/* + * memp_sync -- + * Mpool sync function. + */ +int +memp_sync(dbmp, lsnp) + DB_MPOOL *dbmp; + DB_LSN *lsnp; +{ + BH *bhp, **bharray; + DB_ENV *dbenv; + MPOOL *mp; + MPOOLFILE *mfp; + int ar_cnt, cnt, nalloc, next, ret, wrote; + + dbenv = dbmp->dbenv; + + if (dbenv->lg_info == NULL) { + __db_err(dbenv, "memp_sync: requires logging"); + return (EINVAL); + } + + /* + * We try and write the buffers in page order so that the underlying + * filesystem doesn't have to seek and can write contiguous blocks, + * plus, we don't want to hold the region lock while we write the + * buffers. Get memory to hold the buffer pointers. Get a good-size + * block, too, because we realloc while holding the region lock if we + * run out. + */ + if ((bharray = + (BH **)__db_malloc((nalloc = 1024) * sizeof(BH *))) == NULL) + return (ENOMEM); + + LOCKREGION(dbmp); + + /* + * If the application is asking about a previous call to memp_sync(), + * and we haven't found any buffers that the application holding the + * pin couldn't write, return yes or no based on the current count. + * Note, if the application is asking about a LSN *smaller* than one + * we've already handled or are currently handling, then we return a + * result based on the count for the larger LSN. + */ + mp = dbmp->mp; + if (!F_ISSET(mp, MP_LSN_RETRY) && log_compare(lsnp, &mp->lsn) <= 0) { + if (mp->lsn_cnt == 0) { + *lsnp = mp->lsn; + ret = 0; + } else + ret = DB_INCOMPLETE; + goto done; + } + + /* Else, it's a new checkpoint. */ + F_CLR(mp, MP_LSN_RETRY); + + /* + * Save the LSN. We know that it's a new LSN or larger than the one + * for which we were already doing a checkpoint. (BTW, I don't expect + * to see multiple LSN's from the same or multiple processes, but You + * Just Never Know. Responding as if they all called with the largest + * of the LSNs specified makes everything work.) + * + * We don't currently use the LSN we save. We could potentially save + * the last-written LSN in each buffer header and use it to determine + * what buffers need to be written. The problem with this is that it's + * sizeof(LSN) more bytes of buffer header. We currently write all the + * dirty buffers instead. + * + * Walk the list of shared memory segments clearing the count of + * buffers waiting to be written. + */ + mp->lsn = *lsnp; + mp->lsn_cnt = 0; + for (mfp = SH_TAILQ_FIRST(&dbmp->mp->mpfq, __mpoolfile); + mfp != NULL; mfp = SH_TAILQ_NEXT(mfp, q, __mpoolfile)) + mfp->lsn_cnt = 0; + + /* + * Walk the list of buffers and mark all dirty buffers to be written + * and all pinned buffers to be potentially written (we can't know if + * we'll need to write them until the holding process returns them to + * the cache). We do this in one pass while holding the region locked + * so that processes can't make new buffers dirty, causing us to never + * finish. Since the application may have restarted the sync, clear + * any BH_WRITE flags that appear to be left over from previous calls. + * + * Keep a count of the total number of buffers we need to write in + * MPOOL->lsn_cnt, and for each file, in MPOOLFILE->lsn_count. + */ + ar_cnt = 0; + for (bhp = SH_TAILQ_FIRST(&mp->bhq, __bh); + bhp != NULL; bhp = SH_TAILQ_NEXT(bhp, q, __bh)) + if (F_ISSET(bhp, BH_DIRTY) || bhp->ref != 0) { + F_SET(bhp, BH_WRITE); + + ++mp->lsn_cnt; + + mfp = R_ADDR(dbmp, bhp->mf_offset); + ++mfp->lsn_cnt; + + /* + * If the buffer isn't in use, we should be able to + * write it immediately, so save a reference to it. + */ + if (bhp->ref == 0) { + if (ar_cnt == nalloc) { + nalloc *= 2; + if ((bharray = + (BH **)__db_realloc(bharray, + nalloc * sizeof(BH *))) == NULL) { + ret = ENOMEM; + goto err; + } + } + bharray[ar_cnt++] = bhp; + } + } else + if (F_ISSET(bhp, BH_WRITE)) + F_CLR(bhp, BH_WRITE); + + /* If there no buffers we can write immediately, we're done. */ + if (ar_cnt == 0) { + ret = mp->lsn_cnt ? DB_INCOMPLETE : 0; + goto done; + } + + /* Lock down the buffers and their contents. */ + for (cnt = 0; cnt < ar_cnt; ++cnt) + ++bharray[cnt]->ref; + + UNLOCKREGION(dbmp); + + /* Sort the buffers we're going to write. */ + qsort(bharray, ar_cnt, sizeof(BH *), __bhcmp); + + LOCKREGION(dbmp); + + /* Walk the array, writing buffers. */ + for (next = 0; next < ar_cnt; ++next) { + /* + * It's possible for a thread to have gotten the buffer since + * we listed it for writing. If the reference count is still + * 1, we're the only ones using the buffer, go ahead and write. + * If it's >1, then skip the buffer and assume that it will be + * written when it's returned to the cache. + */ + if (bharray[next]->ref > 1) { + --bharray[next]->ref; + continue; + } + + /* Write the buffer. */ + mfp = R_ADDR(dbmp, bharray[next]->mf_offset); + ret = __memp_bhwrite(dbmp, mfp, bharray[next], NULL, &wrote); + + /* Release the buffer. */ + --bharray[next]->ref; + + /* If there's an error, release the rest of the buffers. */ + if (ret != 0 || !wrote) { + /* + * Any process syncing the shared memory buffer pool + * had better be able to write to any underlying file. + * Be understanding, but firm, on this point. + */ + if (ret == 0) { + __db_err(dbenv, "%s: unable to flush page: %lu", + __memp_fns(dbmp, mfp), + (u_long)bharray[next]->pgno); + ret = EPERM; + } + + while (++next < ar_cnt) + --bharray[next]->ref; + goto err; + } + } + ret = mp->lsn_cnt ? DB_INCOMPLETE : 0; + +done: + if (0) { +err: /* + * On error, clear: + * MPOOL->lsn_cnt (the total sync count) + * MPOOLFILE->lsn_cnt (the per-file sync count) + * BH_WRITE flag (the scheduled for writing flag) + */ + mp->lsn_cnt = 0; + for (mfp = SH_TAILQ_FIRST(&dbmp->mp->mpfq, __mpoolfile); + mfp != NULL; mfp = SH_TAILQ_NEXT(mfp, q, __mpoolfile)) + mfp->lsn_cnt = 0; + for (bhp = SH_TAILQ_FIRST(&mp->bhq, __bh); + bhp != NULL; bhp = SH_TAILQ_NEXT(bhp, q, __bh)) + F_CLR(bhp, BH_WRITE); + } + UNLOCKREGION(dbmp); + __db_free(bharray); + return (ret); +} + +/* + * memp_fsync -- + * Mpool file sync function. + */ +int +memp_fsync(dbmfp) + DB_MPOOLFILE *dbmfp; +{ + DB_MPOOL *dbmp; + int is_tmp; + + dbmp = dbmfp->dbmp; + + /* + * If this handle doesn't have a file descriptor that's open for + * writing, or if the file is a temporary, there's no reason to + * proceed further. + */ + if (F_ISSET(dbmfp, MP_READONLY)) + return (0); + + LOCKREGION(dbmp); + is_tmp = F_ISSET(dbmfp->mfp, MP_TEMP); + UNLOCKREGION(dbmp); + if (is_tmp) + return (0); + + return (__memp_fsync(dbmfp)); +} + +/* + * __mp_xxx_fd -- + * Return a file descriptor for DB 1.85 compatibility locking. + * + * PUBLIC: int __mp_xxx_fd __P((DB_MPOOLFILE *, int *)); + */ +int +__mp_xxx_fd(dbmfp, fdp) + DB_MPOOLFILE *dbmfp; + int *fdp; +{ + int ret; + + /* + * This is a truly spectacular layering violation, intended ONLY to + * support compatibility for the DB 1.85 DB->fd call. + * + * Sync the database file to disk, creating the file as necessary. + * + * We skip the MP_READONLY and MP_TEMP tests done by memp_fsync(3). + * The MP_READONLY test isn't interesting because we will either + * already have a file descriptor (we opened the database file for + * reading) or we aren't readonly (we created the database which + * requires write privileges). The MP_TEMP test isn't interesting + * because we want to write to the backing file regardless so that + * we get a file descriptor to return. + */ + ret = dbmfp->fd == -1 ? __memp_fsync(dbmfp) : 0; + + return ((*fdp = dbmfp->fd) == -1 ? ENOENT : ret); +} + +/* + * __memp_fsync -- + * Mpool file internal sync function. + */ +static int +__memp_fsync(dbmfp) + DB_MPOOLFILE *dbmfp; +{ + BH *bhp, **bharray; + DB_MPOOL *dbmp; + size_t mf_offset; + int ar_cnt, cnt, nalloc, next, pincnt, ret, wrote; + + ret = 0; + dbmp = dbmfp->dbmp; + mf_offset = R_OFFSET(dbmp, dbmfp->mfp); + + /* + * We try and write the buffers in page order so that the underlying + * filesystem doesn't have to seek and can write contiguous blocks, + * plus, we don't want to hold the region lock while we write the + * buffers. Get memory to hold the buffer pointers. Get a good-size + * block, too, because we realloc while holding the region lock if we + * run out. + */ + nalloc = 1024; + if ((bharray = + (BH **)__db_malloc((size_t)nalloc * sizeof(BH *))) == NULL) + return (ENOMEM); + + LOCKREGION(dbmp); + + /* + * Walk the LRU list of buffer headers, and get a list of buffers to + * write for this MPOOLFILE. + */ + ar_cnt = pincnt = 0; + for (bhp = SH_TAILQ_FIRST(&dbmp->mp->bhq, __bh); + bhp != NULL; bhp = SH_TAILQ_NEXT(bhp, q, __bh)) { + if (!F_ISSET(bhp, BH_DIRTY) || bhp->mf_offset != mf_offset) + continue; + if (bhp->ref != 0 || F_ISSET(bhp, BH_LOCKED)) { + ++pincnt; + continue; + } + + if (ar_cnt == nalloc) { + nalloc *= 2; + if ((bharray = (BH **)__db_realloc(bharray, + nalloc * sizeof(BH *))) == NULL) { + ret = ENOMEM; + goto err; + } + } + + bharray[ar_cnt++] = bhp; + } + + /* Lock down the buffers and their contents. */ + for (cnt = 0; cnt < ar_cnt; ++cnt) + ++bharray[cnt]->ref; + + UNLOCKREGION(dbmp); + + /* Sort the buffers we're going to write. */ + qsort(bharray, ar_cnt, sizeof(BH *), __bhcmp); + + LOCKREGION(dbmp); + + /* Walk the array, writing buffers. */ + for (next = 0; next < ar_cnt; ++next) { + /* + * It's possible for a thread to have gotten the buffer since + * we listed it for writing. If the reference count is still + * 1, we're the only ones using the buffer, go ahead and write. + * If it's >1, then skip the buffer and assume that it will be + * written when it's returned to the cache. + */ + if (bharray[next]->ref > 1) { + ++pincnt; + + --bharray[next]->ref; + continue; + } + + /* Write the buffer. */ + ret = __memp_pgwrite(dbmfp, bharray[next], NULL, &wrote); + + /* Release the buffer. */ + --bharray[next]->ref; + + /* If there's an error, release the rest of the buffers. */ + if (ret != 0) { + while (++next < ar_cnt) + --bharray[next]->ref; + goto err; + } + if (!wrote) + ++pincnt; + } + +err: UNLOCKREGION(dbmp); + + __db_free(bharray); + + /* + * Sync the underlying file as the last thing we do, so that the OS + * has maximal opportunity to flush buffers before we request it. + * + * XXX: + * Don't lock the region around the sync, fsync(2) has no atomicity + * issues. + */ + if (ret == 0) + return (pincnt == 0 ? __db_fsync(dbmfp->fd) : DB_INCOMPLETE); + return (ret); +} + +/* + * memp_trickle -- + * Keep a specified percentage of the buffers clean. + */ +int +memp_trickle(dbmp, pct, nwrotep) + DB_MPOOL *dbmp; + int pct, *nwrotep; +{ + BH *bhp; + MPOOL *mp; + MPOOLFILE *mfp; + u_long total; + int ret, wrote; + + mp = dbmp->mp; + if (nwrotep != NULL) + *nwrotep = 0; + + if (pct < 1 || pct > 100) + return (EINVAL); + + LOCKREGION(dbmp); + + /* + * If there are sufficient clean buffers, or no buffers or no dirty + * buffers, we're done. + * + * XXX + * Using st_page_clean and st_page_dirty is our only choice at the + * moment, but it's not as correct as we might like in the presence + * of pools with more than one buffer size, as a free 512-byte buffer + * isn't the same as a free 8K buffer. + */ +loop: total = mp->stat.st_page_clean + mp->stat.st_page_dirty; + if (total == 0 || mp->stat.st_page_dirty == 0 || + (mp->stat.st_page_clean * 100) / total >= (u_long)pct) { + UNLOCKREGION(dbmp); + return (0); + } + + /* Loop until we write a buffer. */ + for (bhp = SH_TAILQ_FIRST(&mp->bhq, __bh); + bhp != NULL; bhp = SH_TAILQ_NEXT(bhp, q, __bh)) { + if (bhp->ref != 0 || + !F_ISSET(bhp, BH_DIRTY) || F_ISSET(bhp, BH_LOCKED)) + continue; + + mfp = R_ADDR(dbmp, bhp->mf_offset); + + /* + * We can't write to temporary files -- see the comment in + * mp_bh.c:__memp_bhwrite(). + */ + if (F_ISSET(mfp, MP_TEMP)) + continue; + + if ((ret = __memp_bhwrite(dbmp, mfp, bhp, NULL, &wrote)) != 0) + goto err; + + /* + * Any process syncing the shared memory buffer pool had better + * be able to write to any underlying file. Be understanding, + * but firm, on this point. + */ + if (!wrote) { + __db_err(dbmp->dbenv, "%s: unable to flush page: %lu", + __memp_fns(dbmp, mfp), (u_long)bhp->pgno); + ret = EPERM; + goto err; + } + + ++mp->stat.st_page_trickle; + if (nwrotep != NULL) + ++*nwrotep; + goto loop; + } + + /* No more buffers to write. */ + ret = 0; + +err: UNLOCKREGION(dbmp); + return (ret); +} + +static int +__bhcmp(p1, p2) + const void *p1, *p2; +{ + BH *bhp1, *bhp2; + + bhp1 = *(BH * const *)p1; + bhp2 = *(BH * const *)p2; + + /* Sort by file (shared memory pool offset). */ + if (bhp1->mf_offset < bhp2->mf_offset) + return (-1); + if (bhp1->mf_offset > bhp2->mf_offset) + return (1); + + /* Sort by page in file. */ + return (bhp1->pgno < bhp2->pgno ? -1 : 1); +} diff --git a/mozilla/db/mp/mp_sync.c.orig b/mozilla/db/mp/mp_sync.c.orig new file mode 100644 index 00000000000..33218eef1ae --- /dev/null +++ b/mozilla/db/mp/mp_sync.c.orig @@ -0,0 +1,513 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)mp_sync.c 10.25 (Sleepycat) 4/26/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_shash.h" +#include "mp.h" +#include "common_ext.h" + +static int __bhcmp __P((const void *, const void *)); +static int __memp_fsync __P((DB_MPOOLFILE *)); + +/* + * memp_sync -- + * Mpool sync function. + */ +int +memp_sync(dbmp, lsnp) + DB_MPOOL *dbmp; + DB_LSN *lsnp; +{ + BH *bhp, **bharray; + DB_ENV *dbenv; + MPOOL *mp; + MPOOLFILE *mfp; + int ar_cnt, cnt, nalloc, next, ret, wrote; + + dbenv = dbmp->dbenv; + + if (dbenv->lg_info == NULL) { + __db_err(dbenv, "memp_sync: requires logging"); + return (EINVAL); + } + + /* + * We try and write the buffers in page order so that the underlying + * filesystem doesn't have to seek and can write contiguous blocks, + * plus, we don't want to hold the region lock while we write the + * buffers. Get memory to hold the buffer pointers. Get a good-size + * block, too, because we realloc while holding the region lock if we + * run out. + */ + if ((bharray = + (BH **)__db_malloc((nalloc = 1024) * sizeof(BH *))) == NULL) + return (ENOMEM); + + LOCKREGION(dbmp); + + /* + * If the application is asking about a previous call to memp_sync(), + * and we haven't found any buffers that the application holding the + * pin couldn't write, return yes or no based on the current count. + * Note, if the application is asking about a LSN *smaller* than one + * we've already handled or are currently handling, then we return a + * result based on the count for the larger LSN. + */ + mp = dbmp->mp; + if (!F_ISSET(mp, MP_LSN_RETRY) && log_compare(lsnp, &mp->lsn) <= 0) { + if (mp->lsn_cnt == 0) { + *lsnp = mp->lsn; + ret = 0; + } else + ret = DB_INCOMPLETE; + goto done; + } + + /* Else, it's a new checkpoint. */ + F_CLR(mp, MP_LSN_RETRY); + + /* + * Save the LSN. We know that it's a new LSN or larger than the one + * for which we were already doing a checkpoint. (BTW, I don't expect + * to see multiple LSN's from the same or multiple processes, but You + * Just Never Know. Responding as if they all called with the largest + * of the LSNs specified makes everything work.) + * + * We don't currently use the LSN we save. We could potentially save + * the last-written LSN in each buffer header and use it to determine + * what buffers need to be written. The problem with this is that it's + * sizeof(LSN) more bytes of buffer header. We currently write all the + * dirty buffers instead. + * + * Walk the list of shared memory segments clearing the count of + * buffers waiting to be written. + */ + mp->lsn = *lsnp; + mp->lsn_cnt = 0; + for (mfp = SH_TAILQ_FIRST(&dbmp->mp->mpfq, __mpoolfile); + mfp != NULL; mfp = SH_TAILQ_NEXT(mfp, q, __mpoolfile)) + mfp->lsn_cnt = 0; + + /* + * Walk the list of buffers and mark all dirty buffers to be written + * and all pinned buffers to be potentially written (we can't know if + * we'll need to write them until the holding process returns them to + * the cache). We do this in one pass while holding the region locked + * so that processes can't make new buffers dirty, causing us to never + * finish. Since the application may have restarted the sync, clear + * any BH_WRITE flags that appear to be left over from previous calls. + * + * Keep a count of the total number of buffers we need to write in + * MPOOL->lsn_cnt, and for each file, in MPOOLFILE->lsn_count. + */ + ar_cnt = 0; + for (bhp = SH_TAILQ_FIRST(&mp->bhq, __bh); + bhp != NULL; bhp = SH_TAILQ_NEXT(bhp, q, __bh)) + if (F_ISSET(bhp, BH_DIRTY) || bhp->ref != 0) { + F_SET(bhp, BH_WRITE); + + ++mp->lsn_cnt; + + mfp = R_ADDR(dbmp, bhp->mf_offset); + ++mfp->lsn_cnt; + + /* + * If the buffer isn't in use, we should be able to + * write it immediately, so save a reference to it. + */ + if (bhp->ref == 0) { + if (ar_cnt == nalloc) { + nalloc *= 2; + if ((bharray = + (BH **)__db_realloc(bharray, + nalloc * sizeof(BH *))) == NULL) { + ret = ENOMEM; + goto err; + } + } + bharray[ar_cnt++] = bhp; + } + } else + if (F_ISSET(bhp, BH_WRITE)) + F_CLR(bhp, BH_WRITE); + + /* If there no buffers we can write immediately, we're done. */ + if (ar_cnt == 0) { + ret = mp->lsn_cnt ? DB_INCOMPLETE : 0; + goto done; + } + + /* Lock down the buffers and their contents. */ + for (cnt = 0; cnt < ar_cnt; ++cnt) + ++bharray[cnt]->ref; + + UNLOCKREGION(dbmp); + + /* Sort the buffers we're going to write. */ + qsort(bharray, ar_cnt, sizeof(BH *), __bhcmp); + + LOCKREGION(dbmp); + + /* Walk the array, writing buffers. */ + for (next = 0; next < ar_cnt; ++next) { + /* + * It's possible for a thread to have gotten the buffer since + * we listed it for writing. If the reference count is still + * 1, we're the only ones using the buffer, go ahead and write. + * If it's >1, then skip the buffer and assume that it will be + * written when it's returned to the cache. + */ + if (bharray[next]->ref > 1) { + --bharray[next]->ref; + continue; + } + + /* Write the buffer. */ + mfp = R_ADDR(dbmp, bharray[next]->mf_offset); + ret = __memp_bhwrite(dbmp, mfp, bharray[next], NULL, &wrote); + + /* Release the buffer. */ + --bharray[next]->ref; + + /* If there's an error, release the rest of the buffers. */ + if (ret != 0 || !wrote) { + /* + * Any process syncing the shared memory buffer pool + * had better be able to write to any underlying file. + * Be understanding, but firm, on this point. + */ + if (ret == 0) { + __db_err(dbenv, "%s: unable to flush page: %lu", + __memp_fns(dbmp, mfp), + (u_long)bharray[next]->pgno); + ret = EPERM; + } + + while (++next < ar_cnt) + --bharray[next]->ref; + goto err; + } + } + ret = mp->lsn_cnt ? DB_INCOMPLETE : 0; + +done: + if (0) { +err: /* + * On error, clear: + * MPOOL->lsn_cnt (the total sync count) + * MPOOLFILE->lsn_cnt (the per-file sync count) + * BH_WRITE flag (the scheduled for writing flag) + */ + mp->lsn_cnt = 0; + for (mfp = SH_TAILQ_FIRST(&dbmp->mp->mpfq, __mpoolfile); + mfp != NULL; mfp = SH_TAILQ_NEXT(mfp, q, __mpoolfile)) + mfp->lsn_cnt = 0; + for (bhp = SH_TAILQ_FIRST(&mp->bhq, __bh); + bhp != NULL; bhp = SH_TAILQ_NEXT(bhp, q, __bh)) + F_CLR(bhp, BH_WRITE); + } + UNLOCKREGION(dbmp); + __db_free(bharray); + return (ret); +} + +/* + * memp_fsync -- + * Mpool file sync function. + */ +int +memp_fsync(dbmfp) + DB_MPOOLFILE *dbmfp; +{ + DB_MPOOL *dbmp; + int is_tmp; + + dbmp = dbmfp->dbmp; + + /* + * If this handle doesn't have a file descriptor that's open for + * writing, or if the file is a temporary, there's no reason to + * proceed further. + */ + if (F_ISSET(dbmfp, MP_READONLY)) + return (0); + + LOCKREGION(dbmp); + is_tmp = F_ISSET(dbmfp->mfp, MP_TEMP); + UNLOCKREGION(dbmp); + if (is_tmp) + return (0); + + return (__memp_fsync(dbmfp)); +} + +/* + * __mp_xxx_fd -- + * Return a file descriptor for DB 1.85 compatibility locking. + * + * PUBLIC: int __mp_xxx_fd __P((DB_MPOOLFILE *, int *)); + */ +int +__mp_xxx_fd(dbmfp, fdp) + DB_MPOOLFILE *dbmfp; + int *fdp; +{ + int ret; + + /* + * This is a truly spectacular layering violation, intended ONLY to + * support compatibility for the DB 1.85 DB->fd call. + * + * Sync the database file to disk, creating the file as necessary. + * + * We skip the MP_READONLY and MP_TEMP tests done by memp_fsync(3). + * The MP_READONLY test isn't interesting because we will either + * already have a file descriptor (we opened the database file for + * reading) or we aren't readonly (we created the database which + * requires write privileges). The MP_TEMP test isn't interesting + * because we want to write to the backing file regardless so that + * we get a file descriptor to return. + */ + ret = dbmfp->fd == -1 ? __memp_fsync(dbmfp) : 0; + + return ((*fdp = dbmfp->fd) == -1 ? ENOENT : ret); +} + +/* + * __memp_fsync -- + * Mpool file internal sync function. + */ +static int +__memp_fsync(dbmfp) + DB_MPOOLFILE *dbmfp; +{ + BH *bhp, **bharray; + DB_MPOOL *dbmp; + size_t mf_offset; + int ar_cnt, cnt, nalloc, next, pincnt, ret, wrote; + + ret = 0; + dbmp = dbmfp->dbmp; + mf_offset = R_OFFSET(dbmp, dbmfp->mfp); + + /* + * We try and write the buffers in page order so that the underlying + * filesystem doesn't have to seek and can write contiguous blocks, + * plus, we don't want to hold the region lock while we write the + * buffers. Get memory to hold the buffer pointers. Get a good-size + * block, too, because we realloc while holding the region lock if we + * run out. + */ + nalloc = 1024; + if ((bharray = + (BH **)__db_malloc((size_t)nalloc * sizeof(BH *))) == NULL) + return (ENOMEM); + + LOCKREGION(dbmp); + + /* + * Walk the LRU list of buffer headers, and get a list of buffers to + * write for this MPOOLFILE. + */ + ar_cnt = pincnt = 0; + for (bhp = SH_TAILQ_FIRST(&dbmp->mp->bhq, __bh); + bhp != NULL; bhp = SH_TAILQ_NEXT(bhp, q, __bh)) { + if (!F_ISSET(bhp, BH_DIRTY) || bhp->mf_offset != mf_offset) + continue; + if (bhp->ref != 0 || F_ISSET(bhp, BH_LOCKED)) { + ++pincnt; + continue; + } + + if (ar_cnt == nalloc) { + nalloc *= 2; + if ((bharray = (BH **)__db_realloc(bharray, + nalloc * sizeof(BH *))) == NULL) { + ret = ENOMEM; + goto err; + } + } + + bharray[ar_cnt++] = bhp; + } + + /* Lock down the buffers and their contents. */ + for (cnt = 0; cnt < ar_cnt; ++cnt) + ++bharray[cnt]->ref; + + UNLOCKREGION(dbmp); + + /* Sort the buffers we're going to write. */ + qsort(bharray, ar_cnt, sizeof(BH *), __bhcmp); + + LOCKREGION(dbmp); + + /* Walk the array, writing buffers. */ + for (next = 0; next < ar_cnt; ++next) { + /* + * It's possible for a thread to have gotten the buffer since + * we listed it for writing. If the reference count is still + * 1, we're the only ones using the buffer, go ahead and write. + * If it's >1, then skip the buffer and assume that it will be + * written when it's returned to the cache. + */ + if (bharray[next]->ref > 1) { + ++pincnt; + + --bharray[next]->ref; + continue; + } + + /* Write the buffer. */ + ret = __memp_pgwrite(dbmfp, bharray[next], NULL, &wrote); + + /* Release the buffer. */ + --bharray[next]->ref; + + /* If there's an error, release the rest of the buffers. */ + if (ret != 0) { + while (++next < ar_cnt) + --bharray[next]->ref; + goto err; + } + if (!wrote) + ++pincnt; + } + +err: UNLOCKREGION(dbmp); + + __db_free(bharray); + + /* + * Sync the underlying file as the last thing we do, so that the OS + * has maximal opportunity to flush buffers before we request it. + * + * XXX: + * Don't lock the region around the sync, fsync(2) has no atomicity + * issues. + */ + if (ret == 0) + return (pincnt == 0 ? __db_fsync(dbmfp->fd) : DB_INCOMPLETE); + return (ret); +} + +/* + * memp_trickle -- + * Keep a specified percentage of the buffers clean. + */ +int +memp_trickle(dbmp, pct, nwrotep) + DB_MPOOL *dbmp; + int pct, *nwrotep; +{ + BH *bhp; + MPOOL *mp; + MPOOLFILE *mfp; + u_long total; + int ret, wrote; + + mp = dbmp->mp; + if (nwrotep != NULL) + *nwrotep = 0; + + if (pct < 1 || pct > 100) + return (EINVAL); + + LOCKREGION(dbmp); + + /* + * If there are sufficient clean buffers, or no buffers or no dirty + * buffers, we're done. + * + * XXX + * Using st_page_clean and st_page_dirty is our only choice at the + * moment, but it's not as correct as we might like in the presence + * of pools with more than one buffer size, as a free 512-byte buffer + * isn't the same as a free 8K buffer. + */ +loop: total = mp->stat.st_page_clean + mp->stat.st_page_dirty; + if (total == 0 || mp->stat.st_page_dirty == 0 || + (mp->stat.st_page_clean * 100) / total >= (u_long)pct) { + UNLOCKREGION(dbmp); + return (0); + } + + /* Loop until we write a buffer. */ + for (bhp = SH_TAILQ_FIRST(&mp->bhq, __bh); + bhp != NULL; bhp = SH_TAILQ_NEXT(bhp, q, __bh)) { + if (bhp->ref != 0 || + !F_ISSET(bhp, BH_DIRTY) || F_ISSET(bhp, BH_LOCKED)) + continue; + + mfp = R_ADDR(dbmp, bhp->mf_offset); + + /* + * We can't write to temporary files -- see the comment in + * mp_bh.c:__memp_bhwrite(). + */ + if (F_ISSET(mfp, MP_TEMP)) + continue; + + if ((ret = __memp_bhwrite(dbmp, mfp, bhp, NULL, &wrote)) != 0) + goto err; + + /* + * Any process syncing the shared memory buffer pool had better + * be able to write to any underlying file. Be understanding, + * but firm, on this point. + */ + if (!wrote) { + __db_err(dbmp->dbenv, "%s: unable to flush page: %lu", + __memp_fns(dbmp, mfp), (u_long)bhp->pgno); + ret = EPERM; + goto err; + } + + ++mp->stat.st_page_trickle; + if (nwrotep != NULL) + ++*nwrotep; + goto loop; + } + + /* No more buffers to write. */ + return (0); + +err: UNLOCKREGION(dbmp); + return (ret); +} + +static int +__bhcmp(p1, p2) + const void *p1, *p2; +{ + BH *bhp1, *bhp2; + + bhp1 = *(BH * const *)p1; + bhp2 = *(BH * const *)p2; + + /* Sort by file (shared memory pool offset). */ + if (bhp1->mf_offset < bhp2->mf_offset) + return (-1); + if (bhp1->mf_offset > bhp2->mf_offset) + return (1); + + /* Sort by page in file. */ + return (bhp1->pgno < bhp2->pgno ? -1 : 1); +} diff --git a/mozilla/db/mutex/68020.gcc b/mozilla/db/mutex/68020.gcc new file mode 100644 index 00000000000..21410e61d48 --- /dev/null +++ b/mozilla/db/mutex/68020.gcc @@ -0,0 +1,18 @@ +/* + * @(#)68020.gcc 10.2 (Sleepycat) 2/15/98 + * + * For gcc/68K, 0 is clear, 1 is set. + */ +#define TSL_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 TSL_UNSET(tsl) (*(tsl) = 0) +#define TSL_INIT(tsl) TSL_UNSET(tsl) diff --git a/mozilla/db/mutex/ARCHIVE/Makefile b/mozilla/db/mutex/ARCHIVE/Makefile new file mode 100644 index 00000000000..6863afed2a2 --- /dev/null +++ b/mozilla/db/mutex/ARCHIVE/Makefile @@ -0,0 +1,14 @@ +# @(#)Makefile 10.2 (Sleepycat) 7/5/97 + +#CC= gcc2 -Wall -O2 +DIR= ../build.local +CFLAGS= -DDEBUG -DMUTEX_PID -DMUTEX_STATISTICS -I$(DIR) -I../include + +run: test.o mutex.o db_os_sleep.o + $(CC) test.o mutex.o db_os_sleep.o -o $@ + +clean: + rm -f *.o mmap.file run run.core + +db_os_sleep.o: ../os/db_os_sleep.c +test.o mutex.o: Makefile diff --git a/mozilla/db/mutex/ARCHIVE/alpha.dec b/mozilla/db/mutex/ARCHIVE/alpha.dec new file mode 100644 index 00000000000..83ed3711361 --- /dev/null +++ b/mozilla/db/mutex/ARCHIVE/alpha.dec @@ -0,0 +1,25 @@ +/* + * @(#)alpha.dec 8.3 (Sleepycat Software) 1/18/97 + * + * The DEC C asm acts as a pseudo-call. The first argument is the assembly + * code, and the remaining arguments are assigned as in a procedure call, to + * r16, r17, etc. (represented in asm as %a0, %a1, and so forth). + * + * From: Dave Butenhof. + */ + +#include + +#define TSL_SET(tsl) (asm ("mb; \ + 10: ldl_l %v0,(%a0) ; \ + bne %v0,30f ; \ + or %v0,1,%r1 ; \ + stl_c %r1,(%a0) ; \ + beq %r1,20f ; \ + mb ; \ + br %r31,30f ; \ + 20: br %r31,10b ; \ + 30: ", (tsl))) + +THIS WAS NOT CONVERTED TO TAKE A POINTER AS AN ARGUMENT... +#define TSL_UNSET(tsl) (asm ("mb"), *(tsl) = 0) diff --git a/mozilla/db/mutex/ARCHIVE/alpha.gcc b/mozilla/db/mutex/ARCHIVE/alpha.gcc new file mode 100644 index 00000000000..247d04cf311 --- /dev/null +++ b/mozilla/db/mutex/ARCHIVE/alpha.gcc @@ -0,0 +1,52 @@ +/* + * @(#)alpha.gcc 10.1 (Sleepycat) 4/12/97 + * + * The code appearing below is taken from Richard L. Sites, ed. "Alpha + * Architecture Reference Manual", Digital Press, 1992, page 5-7 and 5-8. + * There are 2 modifications: + * + * 1. The jump from blbs __r1,30f to !__r1, which is dictated by the way the + * TSL_SET macro is used. The code suggested in Sites includes the main loop + * of the spin lock, whereas in this code the rest the loop is specified in C. + * The generated code might be suboptimal if the compiler generates a forward + * branch for the usual case in which the mutex is uncontested. + * + * 2. At label 20, Sites suggests including code for testing for an excessive + * number of _processor_ lock conflicts. (The seq_c instruction stores its + * first argument provided that no other processor has written to a byte range + * including its memory-location argument.) Absent such checking the code + * below could conceivably stall silently on a multiprocessor alpha, depending + * on how often processor/processor conflicts occur in a particular byte range. + * + * Note that the mb ("memory-barrier") instruction in TSL_UNSET is critical to + * correct operation in a multiprocessor alpha (as is, of course, the mb in + * the TSL_SET macro). Without the mb, changes to shared memory that occurred + * inside the critical section (before the TSL_UNSET) might reach shared memory + * _after_ the change of tsl to 0, thereby permitting another processor to see + * an inconsistent view of the data protected by the mutex. + * + * For gcc/alpha, 0 is clear, 1 is set. + */ +#define TSL_SET(tsl) ({ \ + register tsl_t *__l = (tsl); \ + register tsl_t __r1, __r2; \ + __asm__ volatile(" \n\ + 10: ldq_l %0,(%2) \n\ + blbs %0,30f \n\ + or %0,1,%1 \n\ + stq_c %1,(%2) \n\ + beq %1,20f \n\ + mb \n\ + br 30f \n\ + 20: br 10b \n\ + 30: " \ + : "=&r" (__r1), "=&r" (__r2) \ + : "r" (__l)); \ + !__r1; \ +}) + +#define TSL_UNSET(tsl) ({ \ + register tsl_t *__l = (tsl); \ + __asm__ volatile("mb; stq $31,(%0);" : : "r" (__l)); \ +}) +#define TSL_INIT(tsl) TSL_UNSET(tsl) diff --git a/mozilla/db/mutex/ARCHIVE/parisc.hp b/mozilla/db/mutex/ARCHIVE/parisc.hp new file mode 100644 index 00000000000..bd0e37fc788 --- /dev/null +++ b/mozilla/db/mutex/ARCHIVE/parisc.hp @@ -0,0 +1,29 @@ +/* + * @(#)parisc.hp 8.6 (Sleepycat) 6/2/98 + * + * Copyright (c) 1996-1997, The University of Utah and the Computer Systems + * Laboratory at the University of Utah (CSL). All rights reserved. + * + * Permission to use, copy, modify and distribute this software is hereby + * granted provided that (1) source code retains these copyright, permission, + * and disclaimer notices, and (2) redistributions including binaries + * reproduce the notices in supporting documentation, and (3) all advertising + * materials mentioning features or use of this software display the following + * acknowledgement: ``This product includes software developed by the Computer + * Systems Laboratory at the University of Utah.'' + * + * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS + * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF + * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * CSL requests users of this software to return to csl-dist@cs.utah.edu any + * improvements that they make and grant CSL redistribution rights. + */ + +/* + * 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 hence we + * allocate 16 bytes for a tsl_t and use the word that is properly aligned. + */ +#define TSL_SET(tsl) tsl_set(tsl) +#define TSL_UNSET(tsl) tsl_unset(tsl) diff --git a/mozilla/db/mutex/ARCHIVE/test.c b/mozilla/db/mutex/ARCHIVE/test.c new file mode 100644 index 00000000000..1e9543af179 --- /dev/null +++ b/mozilla/db/mutex/ARCHIVE/test.c @@ -0,0 +1,223 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997 + * Sleepycat Software. All rights reserved. + */ +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)test.c 10.4 (Sleepycat) 9/9/97"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#endif + +#include "db_int.h" + +void run_one(); +void usage(); + +#define MMAPFILE "mmap.file" + +#define MAXLOCKS 20 /* Number of locks. */ +#define NLOCKS 100 /* Number of locks per proc. */ +#define NPROCS 5 /* Number of processes. */ + +int +main(argc, argv) + int argc; + char *argv[]; +{ + extern int optind; + extern char *optarg; + db_mutex_t *marp, *mp; + pid_t pid; + int ch, cnt, fd, maxlock, nlock, nproc, status; + + maxlock = MAXLOCKS; + nlock = NLOCKS; + nproc = NPROCS; + while ((ch = getopt(argc, argv, "l:n:p:")) != EOF) + switch(ch) { + case 'l': + maxlock = atoi(optarg); + if (maxlock < 1) + usage(); + break; + case 'n': + nlock = atoi(optarg); + if (nlock < 1) + usage(); + break; + case 'p': + nproc = atoi(optarg); + if (nproc < 1) + usage(); + break; + case '?': + default: + usage(); + } + argc -= optind; + argv += optind; + + /* Cleanup for debugging. */ + unlink(MMAPFILE); + + /* Initialize the mutex file. */ + (void)printf("Initialize the mutex file...\n"); + fd = open(MMAPFILE, O_CREAT | O_RDWR | O_TRUNC, + S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); + if (fd == -1) { + (void)printf("parent: %s: %s\n", MMAPFILE, strerror(errno)); + exit(1); + } + if ((marp = + (db_mutex_t *)calloc(maxlock, sizeof(db_mutex_t))) == NULL) { + (void)printf("parent: %s\n", strerror(errno)); + exit(1); + } + if (write(fd, marp, + maxlock * sizeof(db_mutex_t)) != maxlock * sizeof(db_mutex_t)) { + (void)printf("parent: write: %s\n", strerror(errno)); + exit(1); + } + +#ifndef MAP_FAILED +#define MAP_FAILED -1 +#endif + (void)printf("Mmap the mutex file...\n"); + marp = (db_mutex_t *)mmap(NULL, MAXLOCKS * sizeof(db_mutex_t), + PROT_READ | PROT_WRITE, MAP_SHARED, fd, (off_t)0); + if (marp == (db_mutex_t *)MAP_FAILED) { + (void)printf("parent: mmap: %s\n", strerror(errno)); + exit(1); + } + + /* Initialize the mutexes. */ + (void)printf("Initialize the mutexes...\n"); + for (cnt = 0, mp = marp; cnt < MAXLOCKS; ++cnt, ++mp) + __db_mutex_init(mp, cnt); + + /* Run processes to compete for the locks. */ + (void)printf("%s: %d processes: %d requests from %d locks\n", +#ifdef HAVE_SPINLOCKS + "Using spinlocks", +#else + "Using fcntl", +#endif + nproc, nlock, maxlock); + for (cnt = 0; cnt < nproc; ++cnt) + run_one(maxlock, nlock, nproc, fd, marp); + + /* Wait for processes to finish. */ + (void)printf("Wait for processes...\n"); + while ((pid = waitpid(-1, &status, 0)) > 0) { + (void)printf("%d", (int)pid); + if (WIFEXITED(status)) + (void)printf(": exited %d", WEXITSTATUS(status)); + else if (WIFSIGNALED(status)) { + (void)printf(": signaled %d", WTERMSIG(status)); + if (WCOREDUMP(status)) + (void)printf(": core dumped"); + } + printf("\n"); + } + + /* Print mutex statistics. */ + for (cnt = 0, mp = marp; cnt < MAXLOCKS; ++cnt, ++mp) { + if (mp->mutex_set_wait == 0 && mp->mutex_set_nowait == 0) + continue; + (void)printf("mutex %2d: wait: %2lu; no wait %2lu\n", + cnt, mp->mutex_set_wait, mp->mutex_set_nowait); + } + +#ifdef MUTEX_DESTROY + /* Discard mutexes. */ + (void)printf("Discard mutexes...\n"); + for (cnt = 0, mp = marp; cnt < MAXLOCKS; ++cnt, ++mp) + if (__db_mutex_destroy(mp)) + perror("db_mutex_destroy"); +#endif + + /* Close the file descriptor. */ + (void)close(fd); + + /* Lose the mmap'd file. */ + (void)munmap((caddr_t)mp, sizeof(db_mutex_t)); + (void)unlink(MMAPFILE); + + exit(0); +} + +void +run_one(maxlock, nlock, nproc, fd, mp) + int maxlock, nlock, nproc, fd; + db_mutex_t *mp; +{ + pid_t mypid; + int lock; + char buf[128]; + + /* Create a new process. */ + if (nproc > 1) + switch (fork()) { + case -1: + perror("fork"); + exit (1); + case 0: + break; + default: + return; + } + + mypid = getpid(); + srand(time(NULL) / mypid); + while (nlock--) { + lock = rand() % maxlock; +#define VERBOSE +#ifdef VERBOSE + (void)sprintf(buf, "%d %d\n", (int)mypid, lock); + write(1, buf, strlen(buf)); +#endif + if (__db_mutex_lock(mp + lock, fd, NULL)) { + (void)printf("child %d: never got lock\n", (int)mypid); + goto err; + } + mp[lock].pid = mypid; + sleep(rand() & 2); + if (mypid != mp[lock].pid) { + (void)printf("child %d: RACE!\n", (int)mypid); + goto err; + } + if (__db_mutex_unlock(mp + lock, fd)) { + (void)printf("child %d: wakeup failed\n", (int)mypid); + goto err; + + } + } + exit(0); + +err: close(fd); + exit(1); +} + +void +usage() +{ + (void)fprintf(stderr, + "usage: run [-l max_locks] [-n locks] [-p procs]\n"); + exit (1); +} diff --git a/mozilla/db/mutex/ARCHIVE/tsl_parisc.s b/mozilla/db/mutex/ARCHIVE/tsl_parisc.s new file mode 100644 index 00000000000..e6054944ecc --- /dev/null +++ b/mozilla/db/mutex/ARCHIVE/tsl_parisc.s @@ -0,0 +1,65 @@ +/* + * Copyright (c) 1996-1997 The University of Utah and the Computer Systems + * Laboratory at the University of Utah (CSL). All rights reserved. + * + * Permission to use, copy, modify and distribute this software is hereby + * granted provided that (1) source code retains these copyright, permission, + * and disclaimer notices, and (2) redistributions including binaries + * reproduce the notices in supporting documentation, and (3) all advertising + * materials mentioning features or use of this software display the following + * acknowledgement: ``This product includes software developed by the Computer + * Systems Laboratory at the University of Utah.'' + * + * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS + * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF + * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * CSL requests users of this software to return to csl-dist@cs.utah.edu any + * improvements that they make and grant CSL redistribution rights. + * + * @(#)tsl_parisc.s 8.4 (Sleepycat) 1/18/97 + */ + +/* + * Spin locks for the PA-RISC. Based on Bob Wheeler's Mach implementation. + */ + .SPACE $TEXT$ + .SUBSPA $CODE$ + +/* + * int tsl_set(tsl_t *tsl) + * + * Try to acquire a lock, return 1 if successful, 0 if not. + */ + .EXPORT tsl_set,ENTRY +tsl_set + .PROC + .CALLINFO FRAME=0,NO_CALLS + .ENTRY + ldo 15(%r26),%r26 + depi 0,31,4,%r26 + ldcws 0(%r26),%r28 + subi,= 0,%r28,%r0 + ldi 1,%r28 + bv,n 0(%r2) + .EXIT + .PROCEND + + +/* + * void tsl_unset(tsl_t *tsl) + * + * Release a lock. + */ + .EXPORT tsl_unset,ENTRY +tsl_unset + .PROC + .CALLINFO FRAME=0,NO_CALLS + .ENTRY + ldo 15(%r26),%r26 + ldi -1,%r19 + depi 0,31,4,%r26 + bv 0(%r2) + stw %r19,0(%r26) + .EXIT + .PROCEND diff --git a/mozilla/db/mutex/README b/mozilla/db/mutex/README new file mode 100644 index 00000000000..fceeef7ed89 --- /dev/null +++ b/mozilla/db/mutex/README @@ -0,0 +1,105 @@ +# @(#)README 10.2 (Sleepycat) 11/25/97 + +Resource locking routines: lock based on a db_mutex_t. All this gunk +(including trying to make assembly code portable), is necessary because +System V semaphores require system calls for uncontested locks and we +don't want to make two system calls per resource lock. + +First, this is how it works. The db_mutex_t structure contains a resource +test-and-set lock (tsl), a file offset, a pid for debugging and statistics +information. + +If HAVE_SPINLOCKS is defined (i.e. we know how to do test-and-sets for +this compiler/architecture combination), we try and lock the resource tsl +__db_tsl_spins times. If we can't acquire the lock that way, we use a +system call to sleep for 10ms, 20ms, 40ms, etc. (The time is bounded at +1 second, just in case.) Using the timer backoff means that there are +two assumptions: that locks are held for brief periods (never over system +calls or I/O) and that locks are not hotly contested. + +If HAVE_SPINLOCKS is not defined, i.e. we can't do test-and-sets, we use +a file descriptor to do byte locking on a file at a specified offset. In +this case, ALL of the locking is done in the kernel. Because file +descriptors are allocated per process, we have to provide the file +descriptor as part of the lock/unlock call. We still have to do timer +backoff because we need to be able to block ourselves, i.e. the lock +manager causes processes to wait by having the process acquire a mutex +and then attempting to re-acquire the mutex. There's no way to use kernel +locking to block yourself, i.e. if you hold a lock and attempt to +re-acquire it, the attempt will succeed. + +Next, let's talk about why it doesn't work the way a reasonable person +would think it should work. + +Ideally, we'd have the ability to try to lock the resource tsl, and if +that fails, increment a counter of waiting processes, then block in the +kernel until the tsl is released. The process holding the resource tsl +would see the wait counter when it went to release the resource tsl, and +would wake any waiting processes up after releasing the lock. This would +actually require both another tsl (call it the mutex tsl) and +synchronization between the call that blocks in the kernel and the actual +resource tsl. The mutex tsl would be used to protect accesses to the +db_mutex_t itself. Locking the mutex tsl would be done by a busy loop, +which is safe because processes would never block holding that tsl (all +they would do is try to obtain the resource tsl and set/check the wait +count). The problem in this model is that the blocking call into the +kernel requires a blocking semaphore, i.e. one whose normal state is +locked. + +The only portable forms of locking under UNIX are fcntl(2) on a file +descriptor/offset, and System V semaphores. Neither of these locking +methods are sufficient to solve the problem. + +The problem with fcntl locking is that only the process that obtained the +lock can release it. Remember, we want the normal state of the kernel +semaphore to be locked. So, if the creator of the db_mutex_t were to +initialize the lock to "locked", then a second process locks the resource +tsl, and then a third process needs to block, waiting for the resource +tsl, when the second process wants to wake up the third process, it can't +because it's not the holder of the lock! For the second process to be +the holder of the lock, we would have to make a system call per +uncontested lock, which is what we were trying to get away from in the +first place. + +There are some hybrid schemes, such as signaling the holder of the lock, +or using a different blocking offset depending on which process is +holding the lock, but it gets complicated fairly quickly. I'm open to +suggestions, but I'm not holding my breath. + +Regardless, we use this form of locking when HAVE_SPINLOCKS is not +defined, (i.e. we're locking in the kernel) because it doesn't have the +limitations found in System V semaphores, and because the normal state of +the kernel object in that case is unlocked, so the process releasing the +lock is also the holder of the lock. + +The System V semaphore design has a number of other limitations that make +it inappropriate for this task. Namely: + +First, the semaphore key name space is separate from the file system name +space (although there exist methods for using file names to create +semaphore keys). If we use a well-known key, there's no reason to believe +that any particular key will not already be in use, either by another +instance of the DB application or some other application, in which case +the DB application will fail. If we create a key, then we have to use a +file system name to rendezvous and pass around the key. + +Second, System V semaphores traditionally have compile-time, system-wide +limits on the number of semaphore keys that you can have. Typically, that +number is far too low for any practical purpose. Since the semaphores +permit more than a single slot per semaphore key, we could try and get +around that limit by using multiple slots, but that means that the file +that we're using for rendezvous is going to have to contain slot +information as well as semaphore key information, and we're going to be +reading/writing it on every db_mutex_t init or destroy operation. Anyhow, +similar compile-time, system-wide limits on the numbers of slots per +semaphore key kick in, and you're right back where you started. + +My fantasy is that once POSIX.1 standard mutexes are in wide-spread use, +we can switch to them. My guess is that it won't happen, because the +POSIX semaphores are only required to work for threads within a process, +and not independent processes. + +Note: there are races in the statistics code, but since it's just that, +I didn't bother fixing them. (The fix requires a mutex tsl, so, when/if +this code is fixed to do rational locking (see above), then change the +statistics update code to acquire/release the mutex tsl. diff --git a/mozilla/db/mutex/mutex.c b/mozilla/db/mutex/mutex.c new file mode 100644 index 00000000000..de0d0e23fe2 --- /dev/null +++ b/mozilla/db/mutex/mutex.c @@ -0,0 +1,303 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)mutex.c 10.48 (Sleepycat) 5/23/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#include +#endif + +#include "db_int.h" + +#ifdef HAVE_SPINLOCKS + +#ifdef HAVE_FUNC_AIX +#define TSL_INIT(x) +#define TSL_SET(x) (!_check_lock(x, 0, 1)) +#define TSL_UNSET(x) _clear_lock(x, 0) +#endif + +#ifdef HAVE_ASSEM_MC68020_GCC +#include "68020.gcc" +#endif + +#if defined(HAVE_FUNC_MSEM) +/* + * XXX + * Should we not use MSEM_IF_NOWAIT and let the system block for us? + * I've no idea if this will block all threads in the process or not. + */ +#define TSL_INIT(x) (msem_init(x, MSEM_UNLOCKED) == NULL) +#define TSL_INIT_ERROR 1 +#define TSL_SET(x) (!msem_lock(x, MSEM_IF_NOWAIT)) +#define TSL_UNSET(x) msem_unlock(x, 0) +#endif + +#ifdef HAVE_FUNC_RELIANT +#define TSL_INIT(x) initspin(x, 1) +#define TSL_SET(x) (cspinlock(x) == 0) +#define TSL_UNSET(x) spinunlock(x) +#endif + +#ifdef HAVE_FUNC_SGI +#define TSL_INIT(x) (init_lock(x) != 0) +#define TSL_INIT_ERROR 1 +#define TSL_SET(x) (!acquire_lock(x)) +#define TSL_UNSET(x) release_lock(x) +#endif + +#ifdef HAVE_FUNC_SOLARIS +/* + * Semaphore calls don't work on Solaris 5.5. + * + * #define TSL_INIT(x) (sema_init(x, 1, USYNC_PROCESS, NULL) != 0) + * #define TSL_INIT_ERROR 1 + * #define TSL_SET(x) (sema_wait(x) == 0) + * #define TSL_UNSET(x) sema_post(x) + */ +#define TSL_INIT(x) +#define TSL_SET(x) (_lock_try(x)) +#define TSL_UNSET(x) _lock_clear(x) +#endif + +#ifdef HAVE_ASSEM_PARISC_GCC +#include "parisc.gcc" +#endif + +#ifdef HAVE_ASSEM_SCO_CC +#include "sco.cc" +#endif + +#ifdef HAVE_ASSEM_SPARC_GCC +#include "sparc.gcc" +#endif + +#ifdef HAVE_ASSEM_UTS4_CC +#define TSL_INIT(x) +#define TSL_SET(x) (!uts_lock(x, 1)) +#define TSL_UNSET(x) (*(x) = 0) +#endif + +#ifdef HAVE_ASSEM_X86_GCC +#include "x86.gcc" +#endif + +#ifdef WIN16 +/* Win16 spinlocks are simple because we cannot possibly be preempted. */ +#define TSL_INIT(tsl) +#define TSL_SET(tsl) (*(tsl) = 1) +#define TSL_UNSET(tsl) (*(tsl) = 0) +#endif + +#if defined(_WIN32) +/* + * XXX + * DBDB this needs to be byte-aligned!! + */ +#define TSL_INIT(tsl) +#define TSL_SET(tsl) (!InterlockedExchange((PLONG)tsl, 1)) +#define TSL_UNSET(tsl) (*(tsl) = 0) +#endif + +#endif /* HAVE_SPINLOCKS */ + +/* + * __db_mutex_init -- + * Initialize a DB mutex structure. + * + * PUBLIC: int __db_mutex_init __P((db_mutex_t *, u_int32_t)); + */ +int +__db_mutex_init(mp, off) + db_mutex_t *mp; + u_int32_t off; +{ +#ifdef DIAGNOSTIC + if ((ALIGNTYPE)mp & (MUTEX_ALIGNMENT - 1)) { + (void)fprintf(stderr, + "MUTEX ERROR: mutex NOT %d-byte aligned!\n", + MUTEX_ALIGNMENT); + abort(); + } +#endif + memset(mp, 0, sizeof(db_mutex_t)); + +#ifdef HAVE_SPINLOCKS + COMPQUIET(off, 0); + +#ifdef TSL_INIT_ERROR + if (TSL_INIT(&mp->tsl_resource)) + return (errno); +#else + TSL_INIT(&mp->tsl_resource); +#endif + mp->spins = __os_spin(); +#else + mp->off = off; +#endif + return (0); +} + +#define MS(n) ((n) * 1000) /* Milliseconds to micro-seconds. */ +#define SECOND (MS(1000)) /* A second's worth of micro-seconds. */ + +/* + * __db_mutex_lock + * Lock on a mutex, logically blocking if necessary. + * + * PUBLIC: int __db_mutex_lock __P((db_mutex_t *, int)); + */ +int +__db_mutex_lock(mp, fd) + db_mutex_t *mp; + int fd; +{ + u_long usecs; +#ifdef HAVE_SPINLOCKS + int nspins; +#else + struct flock k_lock; + pid_t mypid; + int locked; +#endif + + if (!DB_GLOBAL(db_mutexlocks)) + return (0); + +#ifdef HAVE_SPINLOCKS + COMPQUIET(fd, 0); + + for (usecs = MS(10);;) { + /* Try and acquire the uncontested resource lock for N spins. */ + for (nspins = mp->spins; nspins > 0; --nspins) + if (TSL_SET(&mp->tsl_resource)) { +#ifdef DIAGNOSTIC + if (mp->pid != 0) { + (void)fprintf(stderr, + "MUTEX ERROR: __db_mutex_lock: lock currently locked\n"); + abort(); + } + mp->pid = getpid(); +#endif + if (usecs == MS(10)) + ++mp->mutex_set_nowait; + else + ++mp->mutex_set_wait; + return (0); + } + + /* Yield the processor; wait 10ms initially, up to 1 second. */ + if (__db_yield == NULL || __db_yield() != 0) { + (void)__db_sleep(0, usecs); + if ((usecs <<= 1) > SECOND) + usecs = SECOND; + } + } + /* NOTREACHED */ + +#else /* !HAVE_SPINLOCKS */ + + /* Initialize the lock. */ + k_lock.l_whence = SEEK_SET; + k_lock.l_start = mp->off; + k_lock.l_len = 1; + + for (locked = 0, mypid = getpid();;) { + /* + * Wait for the lock to become available; wait 10ms initially, + * up to 1 second. + */ + for (usecs = MS(10); mp->pid != 0;) + if (__db_yield == NULL || __db_yield() != 0) { + (void)__db_sleep(0, usecs); + if ((usecs <<= 1) > SECOND) + usecs = SECOND; + } + + /* Acquire an exclusive kernel lock. */ + k_lock.l_type = F_WRLCK; + if (fcntl(fd, F_SETLKW, &k_lock)) + return (errno); + + /* If the resource tsl is still available, it's ours. */ + if (mp->pid == 0) { + locked = 1; + mp->pid = mypid; + } + + /* Release the kernel lock. */ + k_lock.l_type = F_UNLCK; + if (fcntl(fd, F_SETLK, &k_lock)) + return (errno); + + /* + * If we got the resource tsl we're done. + * + * !!! + * We can't check to see if the lock is ours, because we may + * be trying to block ourselves in the lock manager, and so + * the holder of the lock that's preventing us from getting + * the lock may be us! (Seriously.) + */ + if (locked) + break; + } + return (0); +#endif /* !HAVE_SPINLOCKS */ +} + +/* + * __db_mutex_unlock -- + * Release a lock. + * + * PUBLIC: int __db_mutex_unlock __P((db_mutex_t *, int)); + */ +int +__db_mutex_unlock(mp, fd) + db_mutex_t *mp; + int fd; +{ + if (!DB_GLOBAL(db_mutexlocks)) + return (0); + +#ifdef DIAGNOSTIC + if (mp->pid == 0) { + (void)fprintf(stderr, + "MUTEX ERROR: __db_mutex_unlock: lock already unlocked\n"); + abort(); + } +#endif + +#ifdef HAVE_SPINLOCKS + COMPQUIET(fd, 0); + +#ifdef DIAGNOSTIC + mp->pid = 0; +#endif + + /* Release the resource tsl. */ + TSL_UNSET(&mp->tsl_resource); +#else + /* + * Release the resource tsl. We don't have to acquire any locks + * because processes trying to acquire the lock are checking for + * a pid of 0, not a specific value. + */ + mp->pid = 0; +#endif + return (0); +} diff --git a/mozilla/db/mutex/parisc.gcc b/mozilla/db/mutex/parisc.gcc new file mode 100644 index 00000000000..2e4540f7678 --- /dev/null +++ b/mozilla/db/mutex/parisc.gcc @@ -0,0 +1,36 @@ +/* + * @(#)parisc.gcc 8.8 (Sleepycat) 6/2/98 + * + * Copyright (c) 1996-1997, The University of Utah and the Computer Systems + * Laboratory at the University of Utah (CSL). All rights reserved. + * + * Permission to use, copy, modify and distribute this software is hereby + * granted provided that (1) source code retains these copyright, permission, + * and disclaimer notices, and (2) redistributions including binaries + * reproduce the notices in supporting documentation, and (3) all advertising + * materials mentioning features or use of this software display the following + * acknowledgement: ``This product includes software developed by the Computer + * Systems Laboratory at the University of Utah.'' + * + * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS + * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF + * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * CSL requests users of this software to return to csl-dist@cs.utah.edu any + * improvements that they make and grant CSL redistribution rights. + */ + +/* + * 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 TSL_SET(tsl) ({ \ + register tsl_t *__l = (tsl); \ + int __r; \ + asm volatile("ldcws 0(%1),%0" : "=r" (__r) : "r" (__l)); \ + __r & 1; \ +}) + +#define TSL_UNSET(tsl) (*(tsl) = -1) +#define TSL_INIT(tsl) TSL_UNSET(tsl) diff --git a/mozilla/db/mutex/sco.cc b/mozilla/db/mutex/sco.cc new file mode 100644 index 00000000000..7c165a20724 --- /dev/null +++ b/mozilla/db/mutex/sco.cc @@ -0,0 +1,24 @@ +/* + * @(#)x86.uslc + * + * 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 TSL_SET(tsl) _tsl_set(tsl) +#define TSL_UNSET(tsl) (*(tsl) = 0) +#define TSL_INIT(tsl) TSL_UNSET(tsl) diff --git a/mozilla/db/mutex/sparc.gcc b/mozilla/db/mutex/sparc.gcc new file mode 100644 index 00000000000..8445a0629b3 --- /dev/null +++ b/mozilla/db/mutex/sparc.gcc @@ -0,0 +1,33 @@ +/* + * @(#)sparc.gcc 10.1 (Sleepycat) 4/12/97 + * + * 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 membar instructions are needed to ensure that writes to the lock are + * correctly ordered with writes that occur later in the instruction stream. + * + * For gcc/sparc, 0 is clear, 1 is set. + */ + +#if defined(__sparcv9__) +Does the following code need membar instructions for V9 processors? +#endif + +#define TSL_SET(tsl) ({ \ + register tsl_t *__l = (tsl); \ + register tsl_t __r; \ + __asm__ volatile \ + ("ldstub [%1],%0" \ + : "=r"( __r) : "r" (__l)); \ + !__r; \ +}) + +#define TSL_UNSET(tsl) ({ \ + register tsl_t *__l = (tsl); \ + __asm__ volatile ("stb %%g0,[%0]" : : "r" (__l)); \ +}) +#define TSL_INIT(tsl) TSL_UNSET(tsl) diff --git a/mozilla/db/mutex/uts4.cc.s b/mozilla/db/mutex/uts4.cc.s new file mode 100644 index 00000000000..ee5f4143bde --- /dev/null +++ b/mozilla/db/mutex/uts4.cc.s @@ -0,0 +1,21 @@ + / + / int uts_lock ( int *p, int i ); + / Update the lock word pointed to by p with the + / value i, using compare-and-swap. + / Returns 0 if update was successful. + / Returns 1 if update failed. + / + entry uts_lock + uts_lock: + using .,r15 + st r2,8(sp) / Save R2 + l r2,64+0(sp) / R2 -> word to update + slr r0, r0 / R0 = current lock value must be 0 + l r1,64+4(sp) / R1 = new lock value + cs r0,r1,0(r2) / Try the update ... + be x / ... Success. Return 0 + la r0,1 / ... Failure. Return 1 + x: / + l r2,8(sp) / Restore R2 + b 2(,r14) / Return to caller + drop r15 diff --git a/mozilla/db/mutex/x86.gcc b/mozilla/db/mutex/x86.gcc new file mode 100644 index 00000000000..566b9c4433e --- /dev/null +++ b/mozilla/db/mutex/x86.gcc @@ -0,0 +1,17 @@ +/* + * @(#)x86.gcc 10.3 (Sleepycat) 8/27/97 + * + * For gcc/x86, 0 is clear, 1 is set. + */ +#define TSL_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 TSL_UNSET(tsl) (*(tsl) = 0) +#define TSL_INIT(tsl) TSL_UNSET(tsl) diff --git a/mozilla/db/os.win16/os_fid.c b/mozilla/db/os.win16/os_fid.c new file mode 100644 index 00000000000..95def57af8f --- /dev/null +++ b/mozilla/db/os.win16/os_fid.c @@ -0,0 +1,65 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1998 + * Sleepycat Software. All rights reserved. + * + * This code is derived from software contributed to Sleepycat Software by + * Frederick G.M. Roeber of Netscape Communications Corp. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_fid.c 10.3 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include "db_int.h" +#include "common_ext.h" + +/* + * __db_fileid -- + * Return a unique identifier for a file. + * + * PUBLIC: int __db_fileid __P((DB_ENV *, const char *, int, u_int8_t *)); + */ +int +__db_fileid(dbenv, fname, timestamp, fidp) + DB_ENV *dbenv; + const char *fname; + int timestamp; + u_int8_t *fidp; +{ + time_t now; + size_t i, len; + u_int8_t *p; + + COMPQUIET(dbenv, NULL); + + /* + * Windows/16 has no unique identifier, like the inode number on + * UNIX. We use the name plus the timestamp, and hope that it's + * sufficient. + */ + len = DB_FILE_ID_LEN; + if (timestamp) { + (void)time(&now); + p = (u_int8_t *)&now; + for (i = 0; i < sizeof(time_t); ++i) + *fidp++ = *p++; + len -= sizeof(time_t); + } + + /* + * XXX + * We're appending the full path name here -- is that right? If + * the drive is mounted elsewhere next time, won't this be wrong. + * Maybe only append up to the path separator? + */ + for (p = (u_int8_t *)fname; *p != '\0'; ++p); + + for (; len > 0 && --p >= (u_int8_t *)fname; --len) + *fidp++ = *p; + + return (0); +} diff --git a/mozilla/db/os.win16/os_map.c b/mozilla/db/os.win16/os_map.c new file mode 100644 index 00000000000..11bc9fd986d --- /dev/null +++ b/mozilla/db/os.win16/os_map.c @@ -0,0 +1,412 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1998 + * Sleepycat Software. All rights reserved. + * + * This code is derived from software contributed to Sleepycat Software by + * Frederick G.M. Roeber of Netscape Communications Corp. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_map.c 10.6 (Sleepycat) 4/25/98"; +#endif /* not lint */ + +#include "db_int.h" +#include "common_ext.h" + +/* + * DB version 2 uses memory-mapped files for two things: 1) faster access of + * read-only databases, and 2) shared memory for process synchronization and + * locking. The code carefully does not mix the two uses. The first-case + * uses are actually written such that memory-mapping isn't really required + * -- it's merely a convenience -- so we don't have to worry much about it. + * In the second case, it's solely used as a shared memory mechanism, so that's + * all we have to replace. + * + * The mechanism I use for shared memory on Win16 is actually fairly simple. + * All memory in Win16 is shared, and a DLL can allocate memory and keep notes. + * This implementation of Win16, at least, is entirely done as a DLL. So I + * merely have to allocate memory, remember the "filename" for that memory, + * and issue small-integer segment IDs which index the DLL's list of these + * shared-memory segments. Subsequent opens are checked against the list of + * already open segments. + */ + +typedef struct { + void *segment; /* Segment address. */ + u_int32_t size; /* Segment size. */ + char *name; /* Segment name. */ +} os_segdata_t; + +static os_segdata_t *__os_segdata; /* Segment table. */ +static int __os_segdata_size; /* Segment table size. */ + +#define OS_SEGDATA_STARTING_SIZE 16 +#define OS_SEGDATA_INCREMENT 16 + +static int __os_map __P((char *, REGINFO *)); +static int __os_segdata_allocate __P((const char *, REGINFO *)); +static int __os_segdata_find_byname __P((const char *, REGINFO *)); +static int __os_segdata_new __P((int *)); +static int __os_segdata_release __P((int)); + +/* + * __db_mapanon_ok -- + * Return if this OS can support anonymous memory regions. + * + * PUBLIC: int __db_mapanon_ok __P((int)); + */ +int +__db_mapanon_ok(need_names) + int need_names; +{ + COMPQUIET(need_names, 0); + + /* + * All Win16 regions are in named anonymous shared memory, + * so the answer is always yes. + */ + return (0); +} + +/* + * __db_mapinit -- + * Return if shared regions need to be initialized. + * + * PUBLIC: int __db_mapinit __P((void)); + */ +int +__db_mapinit() +{ + /* Win16 regions do not need to be fully written. */ + return (0); +} + +/* + * __db_mapregion -- + * Attach to a shared memory region. + * + * PUBLIC: int __db_mapregion __P((char *, REGINFO *)); + */ +int +__db_mapregion(path, infop) + char *path; + REGINFO *infop; +{ + /* If the user replaces the map call, call through their interface. */ + if (__db_jump.j_map != NULL) + return (__db_jump.j_map(path, infop->fd, infop->size, + 1, F_ISSET(infop, REGION_ANONYMOUS), 0, &infop->addr)); + + /* + * XXX + * We could actually grow regions without a lot of difficulty, but + * since the maximum region is 64K, it's unclear to me it's worth + * the effort. + */ + return (__os_map(path, infop)); +} + +/* + * __db_unmapregion -- + * Detach from the shared memory region. + * + * PUBLIC: int __db_unmapregion __P((REGINFO *)); + */ +int +__db_unmapregion(infop) + REGINFO *infop; +{ + if (__db_jump.j_unmap != NULL) + return (__db_jump.j_unmap(infop->addr, infop->size)); + + /* There's no mapping to discard, we're done. */ + return (0); +} + +/* + * __db_unlinkregion -- + * Remove the shared memory region. + * + * PUBLIC: int __db_unlinkregion __P((char *, REGINFO *)); + */ +int +__db_unlinkregion(name, infop) + char *name; + REGINFO *infop; +{ + COMPQUIET(infop, NULL); + + if (__db_jump.j_runlink != NULL) + return (__db_jump.j_runlink(name)); + + return (__os_segdata_release(infop->segid)); +} + +/* + * __db_mapfile -- + * Map in a shared memory file. + * + * PUBLIC: int __db_mapfile __P((char *, int, size_t, int, void **)); + */ +int +__db_mapfile(path, fd, len, is_rdonly, addr) + char *path; + int fd, is_rdonly; + size_t len; + void **addr; +{ + if (__db_jump.j_map != NULL) + return (__db_jump.j_map(path, fd, len, 0, 0, is_rdonly, addr)); + + /* We cannot map in regular files in Win16. */ + return (EINVAL); +} + +/* + * __db_unmapfile -- + * Unmap the shared memory file. + * + * PUBLIC: int __db_unmapfile __P((void *, size_t)); + */ +int +__db_unmapfile(addr, len) + void *addr; + size_t len; +{ + if (__db_jump.j_unmap != NULL) + return (__db_jump.j_unmap(addr, len)); + + /* We cannot map in regular files in Win16. */ + return (EINVAL); +} + +/* + * __os_map -- + * Create/find a shared region. + */ +static int +__os_map(path, infop) + char *path; + REGINFO *infop; +{ + int ret; + + /* Try to find an already existing segment. */ + if (__os_segdata_find_byname(path, infop) == 0) + return (0); + + /* + * If we're trying to join the region and failing, assume + * that there was a reboot and the region no longer exists. + */ + if (!F_ISSET(infop, REGION_CREATED)) + return (EAGAIN); + + /* Create a new segment. */ + if ((ret = __os_segdata_allocate(path, infop)) != 0) + return (ret); + + return (0); +} + +/* + * __os_segdata_init -- + * Initialises the library's table of shared memory segments. Called + * (once!) from the DLL main routine. + * + * PUBLIC: int __os_segdata_init __P((void)); + */ +int +__os_segdata_init() +{ + if (__os_segdata != NULL) + return (EEXIST); + + __os_segdata_size = OS_SEGDATA_STARTING_SIZE; + if ((__os_segdata = (os_segdata_t *) + __db_calloc(__os_segdata_size, sizeof(os_segdata_t))) == NULL) + return (ENOMEM); + + return (0); +} + +/* + * __os_segdata_destroy -- + * Destroys the library's table of shared memory segments. It also + * frees all linked data: the segments themselves, and their names. + * Called (once!) from the DLL shutdown routine. + * + * PUBLIC: int __os_segdata_destroy __P((void)); + */ +int +__os_segdata_destroy() +{ + os_segdata_t *p; + int i; + + if (__os_segdata == NULL) + return (0); + + for (i = 0; i < __os_segdata_size; i++) { + p = &__os_segdata[i]; + if (p->name != NULL) { + FREES(p->name); + p->name = NULL; + } + if (p->segment != NULL) { + FREE(p->segment, p->size); + p->segment = NULL; + } + p->size = 0; + } + + FREE(__os_segdata, __os_segdata_size * sizeof(os_segdata_t)); + __os_segdata = NULL; + __os_segdata_size = 0; + + return (0); +} + +/* + * __os_segdata_allocate -- + * Creates a new segment of the specified size, optionally with the + * specified name. + */ +static int +__os_segdata_allocate(name, infop) + const char *name; + REGINFO *infop; +{ + os_segdata_t *p; + int segid, ret; + + if ((ret = __os_segdata_new(&segid)) != 0) + return (ret); + + p = &__os_segdata[segid]; + if ((p->segment = (void *)__db_calloc(infop->size, 1)) == NULL) + return (ENOMEM); + if ((p->name = __db_strdup(name)) == NULL) { + FREE(p->segment, infop->size); + p->segment = NULL; + return (ENOMEM); + } + p->size = infop->size; + + infop->addr = p->segment; + infop->segid = segid; + + return (0); +} + +/* + * __os_segdata_new -- + * Finds a new segdata slot. Does not initialise it, so the fd returned + * is only valid until you call this again. + */ +static int +__os_segdata_new(segidp) + int *segidp; +{ + os_segdata_t *p, *newptr; + int i, newsize; + + if (__os_segdata == NULL) + return (EAGAIN); + + for (i = 0; i < __os_segdata_size; i++) { + p = &__os_segdata[i]; + if (p->segment == NULL) { + *segidp = i; + return (0); + } + } + + /* + * This test is actually pedantic, since I can't malloc more than 64K, + * and the structure is more than two bytes big. But I'm a pedant. + */ + if ((u_int)__os_segdata_size >= + (32768 / sizeof(os_segdata_t) - OS_SEGDATA_INCREMENT)) + return (ENOMEM); + + newsize = __os_segdata_size + OS_SEGDATA_INCREMENT; + if ((newptr = (os_segdata_t *) + __db_realloc(__os_segdata, newsize * sizeof(os_segdata_t))) == NULL) + return (ENOMEM); + memset(&newptr[__os_segdata_size], + 0, OS_SEGDATA_INCREMENT * sizeof(os_segdata_t)); + __os_segdata = newptr; + __os_segdata_size = newsize; + + *segidp = __os_segdata_size; + + return (0); +} + +/* + * __os_segdata_find_byname -- + * Finds a segment by its name. + * + * PUBLIC: __os_segdata_find_byname __P((const char *, REGINFO *)); + */ +static int +__os_segdata_find_byname(name, infop) + const char *name; + REGINFO *infop; +{ + os_segdata_t *p; + int i; + + if (__os_segdata == NULL) + return (EAGAIN); + + if (name == NULL) + return (ENOENT); + + for (i = 0; i < __os_segdata_size; i++) { + p = &__os_segdata[i]; + if (p->name != NULL && strcmp(name, p->name) == 0) { + infop->addr = p->segment; + infop->segid = i; + return (0); + } + } + return (ENOENT); +} + +/* + * __os_segdata_release -- + * Free a segdata entry. + */ +static int +__os_segdata_release(segid) + int segid; +{ + os_segdata_t *p; + + if (__os_segdata == NULL) + return (EAGAIN); + + if (segid < 0 || segid >= __os_segdata_size) + return (EINVAL); + + p = &__os_segdata[segid]; + if (p->name != NULL) { + FREES(p->name); + p->name = NULL; + } + if (p->segment != NULL) { + FREE(p->segment, p->size); + p->segment = NULL; + } + p->size = 0; + + /* Any shrink-table logic could go here */ + + return (0); +} diff --git a/mozilla/db/os.win16/os_seek.c b/mozilla/db/os.win16/os_seek.c new file mode 100644 index 00000000000..7ff70d52baa --- /dev/null +++ b/mozilla/db/os.win16/os_seek.c @@ -0,0 +1,40 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * This code is derived from software contributed to Sleepycat Software by + * Frederick G.M. Roeber of Netscape Communications Corp. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_seek.c 10.4 (Sleepycat) 4/26/98"; +#endif /* not lint */ + +#include "db_int.h" + +/* + * __os_seek -- + * Seek to a page/byte offset in the file. + * + * PUBLIC: int __os_seek __P((int, size_t, db_pgno_t, u_int32_t, int, int)); + */ +int +__os_seek(fd, pgsize, pageno, relative, isrewind, whence) + int fd; + size_t pgsize; + db_pgno_t pageno; + u_int32_t relative; + int isrewind, whence; +{ + long int offset; + + offset = (long int)pgsize * pageno + relative; + if (isrewind) + offset = -offset; + + return (lseek(fd, offset, whence) == -1 ? errno : 0); +} diff --git a/mozilla/db/os.win16/os_sleep.c b/mozilla/db/os.win16/os_sleep.c new file mode 100644 index 00000000000..ce8776a4875 --- /dev/null +++ b/mozilla/db/os.win16/os_sleep.c @@ -0,0 +1,40 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1998 + * Sleepycat Software. All rights reserved. + * + * This code is derived from software contributed to Sleepycat Software by + * Frederick G.M. Roeber of Netscape Communications Corp. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_sleep.c 10.3 (Sleepycat) 4/27/98"; +#endif /* not lint */ + +#include "db_int.h" + +/* + * __os_sleep -- + * Yield the processor for a period of time. + * + * PUBLIC: int __os_sleep __P((u_long, u_long)); + */ +int +__os_sleep(secs, usecs) + u_long secs, usecs; /* Seconds and microseconds. */ +{ + /* Don't require that the values be normalized. */ + for (; usecs >= 1000000; ++secs, usecs -= 1000000) + ; + + /* unsigned *long* number of seconds? Okaaay... */ + for( ; secs >= 65535; secs -= 65535) + sleep((u_int)65535); /* About 18 hours. */ + + sleep(secs); + delay(usecs/1000); + return (0); +} diff --git a/mozilla/db/os.win32/os_abs.c b/mozilla/db/os.win32/os_abs.c new file mode 100644 index 00000000000..b1f539f0dd2 --- /dev/null +++ b/mozilla/db/os.win32/os_abs.c @@ -0,0 +1,33 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_abs.c 10.9 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include "db_int.h" + +/* + * __db_abspath -- + * Return if a path is an absolute path. + */ +int +__db_abspath(path) + const char *path; +{ + /* + * !!! + * Check for drive specifications, e.g., "C:". In addition, the path + * separator used by the win32 DB (PATH_SEPARATOR) is \; look for both + * / and \ since these are user-input paths. + */ + if (isalpha(path[0]) && path[1] == ':') + path += 2; + return (path[0] == '/' || path[0] == '\\'); +} diff --git a/mozilla/db/os.win32/os_dir.c b/mozilla/db/os.win32/os_dir.c new file mode 100644 index 00000000000..9249a64644b --- /dev/null +++ b/mozilla/db/os.win32/os_dir.c @@ -0,0 +1,77 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_dir.c 10.15 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#include "db_int.h" +#include "common_ext.h" + +/* + * __os_dirlist -- + * Return a list of the files in a directory. + */ +int +__os_dirlist(dir, namesp, cntp) + const char *dir; + char ***namesp; + int *cntp; +{ + struct _finddata_t fdata; + long dirhandle; + int arraysz, cnt, finished; + char **names, filespec[MAXPATHLEN]; + + (void)snprintf(filespec, sizeof(filespec), "%s/*", dir); + if ((dirhandle = _findfirst(filespec, &fdata)) == -1) + return (errno); + + names = NULL; + finished = 0; + for (arraysz = cnt = 0; finished != 1; ++cnt) { + if (cnt >= arraysz) { + arraysz += 100; + names = (char **)(names == NULL ? + __db_malloc(arraysz * sizeof(names[0])) : + __db_realloc(names, arraysz * sizeof(names[0]))); + if (names == NULL) + goto nomem; + } + if ((names[cnt] = (char *)__db_strdup(fdata.name)) == NULL) + goto nomem; + if (_findnext(dirhandle,&fdata) != 0) + finished = 1; + } + _findclose(dirhandle); + + *namesp = names; + *cntp = cnt; + return (0); + +nomem: if (names != NULL) + __os_dirfree(names, cnt); + return (ENOMEM); +} + +/* + * __os_dirfree -- + * Free the list of files. + * + * PUBLIC: void __os_dirfree __P((char **, int)); + */ +void +__os_dirfree(names, cnt) + char **names; + int cnt; +{ + while (cnt > 0) + __db_free(names[--cnt]); + __db_free(names); +} diff --git a/mozilla/db/os.win32/os_fid.c b/mozilla/db/os.win32/os_fid.c new file mode 100644 index 00000000000..833ea539ed0 --- /dev/null +++ b/mozilla/db/os.win32/os_fid.c @@ -0,0 +1,84 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_fid.c 10.13 (Sleepycat) 4/17/98"; +#endif /* not lint */ + +#include "db_int.h" + +/* + * __db_fileid -- + * Return a unique identifier for a file. + */ +int +__db_fileid(dbenv, fname, timestamp, fidp) + DB_ENV *dbenv; + const char *fname; + int timestamp; + u_int8_t *fidp; +{ + size_t i; + time_t now; + u_int8_t *p; + + /* + * The documentation for GetFileInformationByHandle() states that the + * inode-type numbers are not constant between processes. Actually, + * they are, they're the NTFS MFT indexes. So, this works on NTFS, + * but perhaps not on other platforms, and perhaps not over a network. + * Can't think of a better solution right now. + */ + int fd = 0; + HANDLE fh = 0; + BY_HANDLE_FILE_INFORMATION fi; + BOOL retval = FALSE; + + /* Clear the buffer. */ + memset(fidp, 0, DB_FILE_ID_LEN); + + /* first we open the file, because we're not given a handle to it */ + fd = __os_open(fname,_O_RDONLY,_S_IREAD); + if (-1 == fd) { + /* If we can't open it, we're in trouble */ + return (errno); + } + + /* File open, get its info */ + fh = (HANDLE)_get_osfhandle(fd); + if ((HANDLE)(-1) != fh) { + retval = GetFileInformationByHandle(fh,&fi); + } + __os_close(fd); + + /* + * We want the three 32-bit words which tell us the volume ID and + * the file ID. We make a crude attempt to copy the bytes over to + * the callers buffer. + * + * DBDB: really we should ensure that the bytes get packed the same + * way on all compilers, platforms etc. + */ + if ( ((HANDLE)(-1) != fh) && (TRUE == retval) ) { + memcpy(fidp, &fi.nFileIndexLow, sizeof(u_int32_t)); + fidp += sizeof(u_int32_t); + memcpy(fidp, &fi.nFileIndexHigh, sizeof(u_int32_t)); + fidp += sizeof(u_int32_t); + memcpy(fidp, &fi.dwVolumeSerialNumber, sizeof(u_int32_t)); + fidp += sizeof(u_int32_t); + } + + if (timestamp) { + (void)time(&now); + for (p = (u_int8_t *)&now + + sizeof(now), i = 0; i < sizeof(now); ++i) + *fidp++ = *--p; + } + return (0); +} diff --git a/mozilla/db/os.win32/os_map.c b/mozilla/db/os.win32/os_map.c new file mode 100644 index 00000000000..fb329fa911d --- /dev/null +++ b/mozilla/db/os.win32/os_map.c @@ -0,0 +1,270 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_map.c 10.19 (Sleepycat) 5/3/98"; +#endif /* not lint */ + +#include "db_int.h" + +/* Return if we're Windows/95 or Windows/NT. */ +#define IS_WNT ((GetVersion() & 0x80000000) == 0) + +static int __os_map __P((char *, int, size_t, int, int, int, int, void **)); +static int __os_unique_name __P((char *, int, char *)); + +/* + * __db_mapanon_ok -- + * Return if this OS can support anonymous memory regions. + * + * PUBLIC: int __db_mapanon_ok __P((int)); + */ +int +__db_mapanon_ok(need_names) + int need_names; +{ + /* + * XXX + * Windows/95 supports anonymous regions backed by the paging file. + * + * On Windows/NT, if you call CreateFileMapping with a file descriptor, + * you get proper sharing, but without a file descriptor (i.e. request + * to use a paging file), changes are not seen by any other processes + * that open that piece of named memory. + */ + if (IS_WNT && need_names) + return (ENXIO); + + return (0); +} + +/* + * __db_mapinit -- + * Return if shared regions need to be initialized. + * + * PUBLIC: int __db_mapinit __P((void)); + */ +int +__db_mapinit() +{ + /* + * XXX + * Windows/95 leaves file contents uninitialized, bless its heart. + * + * Windows/NT initializes them. + */ + return (!IS_WNT); +} + +/* + * __db_mapregion -- + * Attach to a shared memory region. + * + * PUBLIC: int __db_mapregion __P((char *, REGINFO *)); + */ +int +__db_mapregion(path, infop) + char *path; + REGINFO *infop; +{ + int ret; + + /* If the user replaces the map call, call through their interface. */ + if (__db_jump.j_map != NULL) + return (__db_jump.j_map(path, infop->fd, infop->size, + 1, F_ISSET(infop, REGION_ANONYMOUS), 0, &infop->addr)); + + /* CreateFileMapping regions that aren't anonymous can grow. */ + if (!F_ISSET(infop, REGION_ANONYMOUS)) + F_SET(infop, REGION_CANGROW); + + if ((ret = __os_map(path, infop->fd, infop->size, + 1, F_ISSET(infop, REGION_ANONYMOUS), + 0, F_ISSET(infop, REGION_CREATED), &infop->addr)) != 0) + return (ret); + + return (0); +} + +/* + * __db_unmapregion -- + * Detach from the shared memory region. + * + * PUBLIC: int __db_unmapregion __P((REGINFO *)); + */ +int +__db_unmapregion(infop) + REGINFO *infop; +{ + if (__db_jump.j_unmap != NULL) + return (__db_jump.j_unmap(infop->addr, infop->size)); + + return (!UnmapViewOfFile(infop->addr) ? errno : 0); +} + +/* + * __db_unlinkregion -- + * Remove the shared memory region. + * + * PUBLIC: int __db_unlinkregion __P((char *, REGINFO *)); + */ +int +__db_unlinkregion(name, infop) + char *name; + REGINFO *infop; +{ + COMPQUIET(infop, NULL); + + if (__db_jump.j_runlink != NULL) + return (__db_jump.j_runlink(name)); + + return (0); +} + +/* + * __db_mapfile -- + * Map in a shared memory file. + * + * PUBLIC: int __db_mapfile __P((char *, int, size_t, int, void **)); + */ +int +__db_mapfile(path, fd, len, is_rdonly, addr) + char *path; + int fd, is_rdonly; + size_t len; + void **addr; +{ + if (__db_jump.j_map != NULL) + return (__db_jump.j_map(path, fd, len, 0, 0, is_rdonly, addr)); + + return (__os_map(path, fd, len, 0, 0, is_rdonly, 0, addr)); +} + +/* + * __db_unmapfile -- + * Unmap the shared memory file. + * + * PUBLIC: int __db_unmapfile __P((void *, size_t)); + */ +int +__db_unmapfile(addr, len) + void *addr; + size_t len; +{ + if (__db_jump.j_unmap != NULL) + return (__db_jump.j_unmap(addr, len)); + + return (!UnmapViewOfFile(addr) ? errno : 0); +} + +/* + * __os_unique_name -- + * Create a unique identifying name from a pathname (may be absolute or + * relative) and/or a file descriptor. + * + * The name returned must be unique (different files map to different + * names), and repeatable (same files, map to same names). It's not so + * easy to do by name. Should handle not only: + * + * foo.bar == ./foo.bar == c:/whatever_path/foo.bar + * + * but also understand that: + * + * foo.bar == Foo.Bar (FAT file system) + * foo.bar != Foo.Bar (NTFS) + * + * The best solution is to use the identifying number in the file + * information structure (similar to UNIX inode #). + */ +static int +__os_unique_name(orig_path, fd, result_path) + char *orig_path, *result_path; + int fd; +{ + BY_HANDLE_FILE_INFORMATION fileinfo; + + if (!GetFileInformationByHandle( + (HANDLE)_get_osfhandle(fd), &fileinfo)) + return (errno); + (void)sprintf(result_path, "%ld.%ld.%ld", + fileinfo.dwVolumeSerialNumber, + fileinfo.nFileIndexHigh, fileinfo.nFileIndexLow); + return (0); +} + +/* + * __os_map -- + * The mmap(2) function for Windows. + */ +static int +__os_map(path, fd, len, is_region, is_anonymous, is_rdonly, is_create, addr) + char *path; + int fd, is_region, is_anonymous, is_rdonly, is_create; + size_t len; + void **addr; +{ + HANDLE hMemory; + RLAYOUT *rlp; + int ret; + void *pMemory; + char shmem_name[MAXPATHLEN]; + + ret = 0; + + if (is_region && is_anonymous) { + /* Get a matching name in the paging file namespace */ + (void)strcpy(shmem_name, "__db_shmem."); + if ((ret = __os_unique_name(path, fd, + &shmem_name[strlen(shmem_name)])) != 0) + return (ret); + } + + /* + * XXX + * DB: We have not implemented copy-on-write here. + * + * XXX + * DB: This code will fail if the library is ever compiled on a 64-bit + * machine. + */ + hMemory = CreateFileMapping( + is_region && is_anonymous ? + (HANDLE)0xFFFFFFFF : (HANDLE)_get_osfhandle(fd), + 0, + is_rdonly ? PAGE_READONLY : PAGE_READWRITE, + 0, len, + is_region && is_anonymous ? shmem_name : NULL); + + if (hMemory == NULL) + return (errno); + + pMemory = MapViewOfFile(hMemory, + (is_rdonly ? FILE_MAP_READ : FILE_MAP_ALL_ACCESS), 0, 0, len); + + CloseHandle(hMemory); + + if (is_region) { + /* + * Windows/95 zeroes anonymous memory regions at last close. + * This means that the backing file can exist and reference + * the region, but the region itself is no longer initialized. + * We handle this by returning EAGAIN to the caller, who will + * attempt to remove the backing file and start all over. + */ + rlp = (RLAYOUT *)pMemory; + if (rlp->valid == 0 && !is_create) { + (void)UnmapViewOfFile(pMemory); + pMemory = NULL; + ret = EAGAIN; + } + } + + *addr = pMemory; + return (ret); +} diff --git a/mozilla/db/os.win32/os_seek.c b/mozilla/db/os.win32/os_seek.c new file mode 100644 index 00000000000..ababa5fab35 --- /dev/null +++ b/mozilla/db/os.win32/os_seek.c @@ -0,0 +1,37 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_seek.c 10.9 (Sleepycat) 4/26/98"; +#endif /* not lint */ + +#include "db_int.h" + +/* + * __os_seek -- + * Seek to a page/byte offset in the file. + * + * PUBLIC: int __os_seek __P((int, size_t, db_pgno_t, u_int32_t, int, int)); + */ +int +__os_seek(fd, pgsize, pageno, relative, isrewind, whence) + int fd; + size_t pgsize; + db_pgno_t pageno; + u_int32_t relative; + int isrewind, whence; +{ + off_t offset; + + offset = (off_t)pgsize * pageno + relative; + if (isrewind) + offset = -offset; + + return (_lseeki64(fd, offset, whence) == -1 ? errno : 0); +} diff --git a/mozilla/db/os.win32/os_sleep.c b/mozilla/db/os.win32/os_sleep.c new file mode 100644 index 00000000000..7430237581b --- /dev/null +++ b/mozilla/db/os.win32/os_sleep.c @@ -0,0 +1,34 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_sleep.c 10.10 (Sleepycat) 4/27/98"; +#endif /* not lint */ + +#include "db_int.h" + +/* + * __os_sleep -- + * Yield the processor for a period of time. + */ +int +__os_sleep(secs, usecs) + u_long secs, usecs; /* Seconds and microseconds. */ +{ + /* Don't require that the values be normalized. */ + for (; usecs >= 1000000; ++secs, usecs -= 1000000) + ; + + /* + * It's important that we yield the processor here so that other + * processes or threads are permitted to run. + */ + Sleep(secs * 1000 + usecs / 1000); + return (0); +} diff --git a/mozilla/db/os.win32/os_spin.c b/mozilla/db/os.win32/os_spin.c new file mode 100644 index 00000000000..de575519d47 --- /dev/null +++ b/mozilla/db/os.win32/os_spin.c @@ -0,0 +1,48 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_spin.c 10.6 (Sleepycat) 6/2/98"; +#endif /* not lint */ + +#include "db_int.h" + +/* + * __os_spin -- + * Return the number of default spins before blocking. + * + * PUBLIC: int __os_spin __P((void)); + */ +int +__os_spin() +{ + static long sys_val; + SYSTEM_INFO SystemInfo; + + /* If the application specified the spins, use its value. */ + if (DB_GLOBAL(db_tsl_spins) != 0) + return (DB_GLOBAL(db_tsl_spins)); + + /* If we've already figured this out, return the value. */ + if (sys_val != 0) + return (sys_val); + + /* Get the number of processors */ + GetSystemInfo(&SystemInfo); + + /* + * Spin 50 times per processor -- we have anecdotal evidence that this + * is a reasonable value. + */ + if (SystemInfo.dwNumberOfProcessors > 1) + sys_val = 50 * SystemInfo.dwNumberOfProcessors; + else + sys_val = 1; + return (sys_val); +} diff --git a/mozilla/db/os/os_abs.c b/mozilla/db/os/os_abs.c new file mode 100644 index 00000000000..d9f49704677 --- /dev/null +++ b/mozilla/db/os/os_abs.c @@ -0,0 +1,31 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_abs.c 10.8 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#endif + +#include "db_int.h" + +/* + * __db_abspath -- + * Return if a path is an absolute path. + * + * PUBLIC: int __db_abspath __P((const char *)); + */ +int +__db_abspath(path) + const char *path; +{ + return (path[0] == '/'); +} diff --git a/mozilla/db/os/os_alloc.c b/mozilla/db/os/os_alloc.c new file mode 100644 index 00000000000..35784476c06 --- /dev/null +++ b/mozilla/db/os/os_alloc.c @@ -0,0 +1,107 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_alloc.c 10.6 (Sleepycat) 5/2/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#endif + +#include "db_int.h" + +/* + * __db_strdup -- + * The strdup(3) function for DB. + * + * PUBLIC: char *__db_strdup __P((const char *)); + */ +char * +__db_strdup(str) + const char *str; +{ + size_t len; + char *copy; + + len = strlen(str) + 1; + if ((copy = __db_malloc(len)) == NULL) + return (NULL); + + memcpy(copy, str, len); + return (copy); +} + +/* + * XXX + * Correct for systems that return NULL when you allocate 0 bytes of memory. + * There are several places in DB where we allocate the number of bytes held + * by the key/data item, and it can be 0. Correct here so that malloc never + * returns a NULL for that reason (which behavior is permitted by ANSI). We + * could make these calls macros on non-Alpha architectures (that's where we + * saw the problem), but it's probably not worth the autoconf complexity. + * + * Out of memory. + * We wish to hold the whole sky, + * But we never will. + */ +/* + * __db_calloc -- + * The calloc(3) function for DB. + * + * PUBLIC: void *__db_calloc __P((size_t, size_t)); + */ +void * +__db_calloc(num, size) + size_t num, size; +{ + void *p; + + size *= num; + if ((p = __db_jump.j_malloc(size == 0 ? 1 : size)) != NULL) + memset(p, 0, size); + return (p); +} + +/* + * __db_malloc -- + * The malloc(3) function for DB. + * + * PUBLIC: void *__db_malloc __P((size_t)); + */ +void * +__db_malloc(size) + size_t size; +{ +#ifdef DIAGNOSTIC + void *p; + + p = __db_jump.j_malloc(size == 0 ? 1 : size); + memset(p, 0xff, size == 0 ? 1 : size); + return (p); +#else + return (__db_jump.j_malloc(size == 0 ? 1 : size)); +#endif +} + +/* + * __db_realloc -- + * The realloc(3) function for DB. + * + * PUBLIC: void *__db_realloc __P((void *, size_t)); + */ +void * +__db_realloc(ptr, size) + void *ptr; + size_t size; +{ + return (__db_jump.j_realloc(ptr, size == 0 ? 1 : size)); +} diff --git a/mozilla/db/os/os_config.c b/mozilla/db/os/os_config.c new file mode 100644 index 00000000000..4150c843e45 --- /dev/null +++ b/mozilla/db/os/os_config.c @@ -0,0 +1,207 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_config.c 10.26 (Sleepycat) 5/23/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#endif + +#include "db_int.h" + +/* + * XXX + * We provide our own extern declarations so that we don't collide with + * systems that get them wrong, e.g., SunOS. + */ +#ifdef _WIN32 +#define fsync _commit +#define imported __declspec(dllimport) +#else +#define imported +#endif + +/* + * XXX + * HP/UX MPE doesn't have fsync, but you can build one using FCONTROL. + */ +#ifdef __hp3000s900 +#define fsync __mpe_fsync +#endif + +imported extern int close __P((int)); +imported extern void free __P((void *)); +imported extern int fsync __P((int)); +imported extern void *malloc __P((size_t)); +imported extern int open __P((const char *, int, ...)); +imported extern ssize_t read __P((int, void *, size_t)); +imported extern void *realloc __P((void *, size_t)); +imported extern int unlink __P((const char *)); +imported extern ssize_t write __P((int, const void *, size_t)); + +/* + * __db_jump -- + * This list of interfaces that applications can replace. In some + * cases, the user is permitted to replace the standard ANSI C or + * POSIX 1003.1 call, e.g., malloc or read. In others, we provide + * a local interface to the functionality, e.g., __os_ioinfo. + */ +struct __db_jumptab __db_jump = { + close, /* DB_FUNC_CLOSE */ + __os_dirfree, /* DB_FUNC_DIRFREE */ + __os_dirlist, /* DB_FUNC_DIRLIST */ + __os_exists, /* DB_FUNC_EXISTS */ + free, /* DB_FUNC_FREE */ + fsync, /* DB_FUNC_FSYNC */ + __os_ioinfo, /* DB_FUNC_IOINFO */ + malloc, /* DB_FUNC_MALLOC */ + NULL, /* DB_FUNC_MAP */ + open, /* DB_FUNC_OPEN */ + read, /* DB_FUNC_READ */ + realloc, /* DB_FUNC_REALLOC */ + NULL, /* DB_FUNC_RUNLINK */ + __os_seek, /* DB_FUNC_SEEK */ + __os_sleep, /* DB_FUNC_SLEEP */ + unlink, /* DB_FUNC_UNLINK */ + NULL, /* DB_FUNC_UNMAP */ + write, /* DB_FUNC_WRITE */ + NULL /* DB_FUNC_YIELD */ +}; + +DB_GLOBALS __db_global_values = { + 1, /* DB_MUTEXLOCKS */ + 0, /* DB_REGION_ANON, DB_REGION_NAME */ + 0, /* DB_REGION_INIT */ + 0, /* DB_TSL_SPINS */ + 0 /* DB_PAGEYIELD */ +}; + +/* + * db_jump_set -- + * Replace functions for the DB package. + */ +int +db_jump_set(func, which) + void *func; + int which; +{ + switch (which) { + case DB_FUNC_CLOSE: + __db_jump.j_close = (int (*) __P((int)))func; + break; + case DB_FUNC_DIRFREE: + __db_jump.j_dirfree = (void (*) __P((char **, int)))func; + break; + case DB_FUNC_DIRLIST: + __db_jump.j_dirlist = + (int (*) __P((const char *, char ***, int *)))func; + break; + case DB_FUNC_EXISTS: + __db_jump.j_exists = (int (*) __P((const char *, int *)))func; + break; + case DB_FUNC_FREE: + __db_jump.j_free = (void (*) __P((void *)))func; + break; + case DB_FUNC_FSYNC: + __db_jump.j_fsync = (int (*) __P((int)))func; + break; + case DB_FUNC_IOINFO: + __db_jump.j_ioinfo = (int (*) __P((const char *, + int, u_int32_t *, u_int32_t *, u_int32_t *)))func; + break; + case DB_FUNC_MALLOC: + __db_jump.j_malloc = (void *(*) __P((size_t)))func; + break; + case DB_FUNC_MAP: + __db_jump.j_map = (int (*) + __P((char *, int, size_t, int, int, int, void **)))func; + break; + case DB_FUNC_OPEN: + __db_jump.j_open = (int (*) __P((const char *, int, ...)))func; + break; + case DB_FUNC_READ: + __db_jump.j_read = + (ssize_t (*) __P((int, void *, size_t)))func; + break; + case DB_FUNC_REALLOC: + __db_jump.j_realloc = (void *(*) __P((void *, size_t)))func; + break; + case DB_FUNC_RUNLINK: + __db_jump.j_runlink = (int (*) __P((char *)))func; + break; + case DB_FUNC_SEEK: + __db_jump.j_seek = (int (*) + __P((int, size_t, db_pgno_t, u_int32_t, int, int)))func; + break; + case DB_FUNC_SLEEP: + __db_jump.j_sleep = (int (*) __P((u_long, u_long)))func; + break; + case DB_FUNC_UNLINK: + __db_jump.j_unlink = (int (*) __P((const char *)))func; + break; + case DB_FUNC_UNMAP: + __db_jump.j_unmap = (int (*) __P((void *, size_t)))func; + break; + case DB_FUNC_WRITE: + __db_jump.j_write = + (ssize_t (*) __P((int, const void *, size_t)))func; + break; + case DB_FUNC_YIELD: + __db_jump.j_yield = (int (*) __P((void)))func; + break; + default: + return (EINVAL); + } + return (0); +} + +/* + * db_value_set -- + * Replace values for the DB package. + */ +int +db_value_set(value, which) + int value, which; +{ + int ret; + + switch (which) { + case DB_MUTEXLOCKS: + DB_GLOBAL(db_mutexlocks) = value; + break; + case DB_PAGEYIELD: + DB_GLOBAL(db_pageyield) = value; + break; + case DB_REGION_ANON: + if (value != 0 && (ret = __db_mapanon_ok(0)) != 0) + return (ret); + DB_GLOBAL(db_region_anon) = value; + break; + case DB_REGION_INIT: + DB_GLOBAL(db_region_init) = value; + break; + case DB_REGION_NAME: + if (value != 0 && (ret = __db_mapanon_ok(1)) != 0) + return (ret); + DB_GLOBAL(db_region_anon) = value; + break; + case DB_TSL_SPINS: + if (value <= 0) + return (EINVAL); + DB_GLOBAL(db_tsl_spins) = value; + break; + default: + return (EINVAL); + } + return (0); +} diff --git a/mozilla/db/os/os_dir.c b/mozilla/db/os/os_dir.c new file mode 100644 index 00000000000..14a10ad23f7 --- /dev/null +++ b/mozilla/db/os/os_dir.c @@ -0,0 +1,96 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_dir.c 10.15 (Sleepycat) 4/26/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#if HAVE_DIRENT_H +# include +# define NAMLEN(dirent) strlen((dirent)->d_name) +#else +# define dirent direct +# define NAMLEN(dirent) (dirent)->d_namlen +# if HAVE_SYS_NDIR_H +# include +# endif +# if HAVE_SYS_DIR_H +# include +# endif +# if HAVE_NDIR_H +# include +# endif +#endif + +#include +#endif + +#include "db_int.h" + +/* + * __os_dirlist -- + * Return a list of the files in a directory. + * + * PUBLIC: int __os_dirlist __P((const char *, char ***, int *)); + */ +int +__os_dirlist(dir, namesp, cntp) + const char *dir; + char ***namesp; + int *cntp; +{ + struct dirent *dp; + DIR *dirp; + int arraysz, cnt; + char **names; + + if ((dirp = opendir(dir)) == NULL) + return (errno); + names = NULL; + for (arraysz = cnt = 0; (dp = readdir(dirp)) != NULL; ++cnt) { + if (cnt >= arraysz) { + arraysz += 100; + names = (char **)(names == NULL ? + __db_malloc(arraysz * sizeof(names[0])) : + __db_realloc(names, arraysz * sizeof(names[0]))); + if (names == NULL) + goto nomem; + } + if ((names[cnt] = (char *)__db_strdup(dp->d_name)) == NULL) + goto nomem; + } + (void)closedir(dirp); + + *namesp = names; + *cntp = cnt; + return (0); + +nomem: if (names != NULL) + __os_dirfree(names, cnt); + return (ENOMEM); +} + +/* + * __os_dirfree -- + * Free the list of files. + * + * PUBLIC: void __os_dirfree __P((char **, int)); + */ +void +__os_dirfree(names, cnt) + char **names; + int cnt; +{ + while (cnt > 0) + __db_free(names[--cnt]); + __db_free(names); +} diff --git a/mozilla/db/os/os_fid.c b/mozilla/db/os/os_fid.c new file mode 100644 index 00000000000..cf48c01bd8b --- /dev/null +++ b/mozilla/db/os/os_fid.c @@ -0,0 +1,76 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_fid.c 10.11 (Sleepycat) 4/26/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#include + +#include +#include +#include +#endif + +#include "db_int.h" +#include "common_ext.h" + +/* + * __db_fileid -- + * Return a unique identifier for a file. + * + * PUBLIC: int __db_fileid __P((DB_ENV *, const char *, int, u_int8_t *)); + */ +int +__db_fileid(dbenv, fname, timestamp, fidp) + DB_ENV *dbenv; + const char *fname; + int timestamp; + u_int8_t *fidp; +{ + struct stat sb; + size_t i; + time_t now; + u_int8_t *p; + + /* Clear the buffer. */ + memset(fidp, 0, DB_FILE_ID_LEN); + + /* Check for the unthinkable. */ + if (sizeof(sb.st_ino) + + sizeof(sb.st_dev) + sizeof(time_t) > DB_FILE_ID_LEN) + return (EINVAL); + + /* On UNIX, use a dev/inode pair. */ + if (stat(fname, &sb)) { + __db_err(dbenv, "%s: %s", fname, strerror(errno)); + return (errno); + } + + /* + * Use the inode first and in reverse order, hopefully putting the + * distinguishing information early in the string. + */ + for (p = (u_int8_t *)&sb.st_ino + + sizeof(sb.st_ino), i = 0; i < sizeof(sb.st_ino); ++i) + *fidp++ = *--p; + for (p = (u_int8_t *)&sb.st_dev + + sizeof(sb.st_dev), i = 0; i < sizeof(sb.st_dev); ++i) + *fidp++ = *--p; + + if (timestamp) { + (void)time(&now); + for (p = (u_int8_t *)&now + + sizeof(now), i = 0; i < sizeof(now); ++i) + *fidp++ = *--p; + } + return (0); +} diff --git a/mozilla/db/os/os_fsync.c b/mozilla/db/os/os_fsync.c new file mode 100644 index 00000000000..e1f271a75ca --- /dev/null +++ b/mozilla/db/os/os_fsync.c @@ -0,0 +1,49 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_fsync.c 10.5 (Sleepycat) 4/19/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" + +/* + * __db_fsync -- + * Flush a file descriptor. + * + * PUBLIC: int __db_fsync __P((int)); + */ +int +__db_fsync(fd) + int fd; +{ + return (__os_fsync(fd) ? errno : 0); +} + +#ifdef __hp3000s900 +#include + +int +__mpe_fsync(fd) + int fd; +{ + extern FCONTROL(short, short, void *); + + FCONTROL(_MPE_FILENO(fd), 2, NULL); /* Flush the buffers */ + FCONTROL(_MPE_FILENO(fd), 6, NULL); /* Write the EOF */ + return (0); +} +#endif diff --git a/mozilla/db/os/os_map.c b/mozilla/db/os/os_map.c new file mode 100644 index 00000000000..5f0fd790e62 --- /dev/null +++ b/mozilla/db/os/os_map.c @@ -0,0 +1,465 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_map.c 10.19 (Sleepycat) 5/3/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#ifdef HAVE_MMAP +#include +#endif + +#ifdef HAVE_SHMGET +#include +#include +#endif + +#include +#include +#endif + +#include "db_int.h" +#include "common_ext.h" + +#ifdef HAVE_MMAP +static int __os_map __P((char *, int, size_t, int, int, int, void **)); +#endif +#ifdef HAVE_SHMGET +static int __os_shmget __P((char *, REGINFO *)); +#endif + +/* + * __db_mapanon_ok -- + * Return if this OS can support anonymous memory regions. + * + * PUBLIC: int __db_mapanon_ok __P((int)); + */ +int +__db_mapanon_ok(need_names) + int need_names; +{ + int ret; + + ret = EINVAL; + + /* + * If we don't have spinlocks, we have to have a file descriptor + * for fcntl(2) locking, which implies using mmap(2) to map in a + * regular file. Theoretically, we could probably find ways to + * get a file descriptor to lock other types of shared regions, + * but I don't see any reason to do so. + * + * If need_names is set, the application wants to share anonymous + * memory among multiple processes, so we have to have a way to + * name it. This requires shmget(2), on UNIX systems. + */ +#ifdef HAVE_SPINLOCKS +#ifdef HAVE_SHMGET + ret = 0; +#endif +#ifdef HAVE_MMAP +#ifdef MAP_ANON + if (!need_names) + ret = 0; +#endif +#ifdef MAP_ANONYMOUS + if (!need_names) + ret = 0; +#endif +#else + COMPQUIET(need_names, 0); +#endif /* HAVE_MMAP */ +#endif /* HAVE_SPINLOCKS */ + + return (ret); +} + +/* + * __db_mapinit -- + * Return if shared regions need to be initialized. + * + * PUBLIC: int __db_mapinit __P((void)); + */ +int +__db_mapinit() +{ + /* + * Historically, some systems required that all of the bytes of the + * region be written before it could be mmapped and accessed randomly. + * We have the option of setting REGION_INIT_NEEDED at configuration + * time if we're running on one of those systems. + */ +#ifdef REGION_INIT_NEEDED + return (1); +#else + return (0); +#endif +} + +/* + * __db_mapregion -- + * Attach to a shared memory region. + * + * PUBLIC: int __db_mapregion __P((char *, REGINFO *)); + */ +int +__db_mapregion(path, infop) + char *path; + REGINFO *infop; +{ + int called, ret; + + called = 0; + ret = EINVAL; + + /* If the user replaces the map call, call through their interface. */ + if (__db_jump.j_map != NULL) { + F_SET(infop, REGION_HOLDINGSYS); + return (__db_jump.j_map(path, infop->fd, infop->size, + 1, F_ISSET(infop, REGION_ANONYMOUS), 0, &infop->addr)); + } + + if (F_ISSET(infop, REGION_ANONYMOUS)) { + /* + * !!! + * If we're creating anonymous regions: + * + * If it's private, we use mmap(2). The problem with using + * shmget(2) is that we may be creating a region of which the + * application isn't aware, and if the application crashes + * we'll have no way to remove the system resources for the + * region. + * + * If it's not private, we use the shmget(2) interface if it's + * available, because it allows us to name anonymous memory. + * If shmget(2) isn't available, use the mmap(2) calls. + * + * In the case of anonymous memory, using mmap(2) means the + * memory isn't named and only the single process and its + * threads can access the region. + */ +#ifdef HAVE_MMAP +#ifdef MAP_ANON +#define HAVE_MMAP_ANONYMOUS 1 +#else +#ifdef MAP_ANONYMOUS +#define HAVE_MMAP_ANONYMOUS 1 +#endif +#endif +#endif +#ifdef HAVE_MMAP_ANONYMOUS + if (!called && F_ISSET(infop, REGION_PRIVATE)) { + called = 1; + ret = __os_map(path, + infop->fd, infop->size, 1, 1, 0, &infop->addr); + } +#endif +#ifdef HAVE_SHMGET + if (!called) { + called = 1; + ret = __os_shmget(path, infop); + } +#endif +#ifdef HAVE_MMAP + /* + * If we're trying to join an unnamed anonymous region, fail -- + * that's not possible. + */ + if (!called) { + called = 1; + + if (!F_ISSET(infop, REGION_CREATED)) { + __db_err(infop->dbenv, + "cannot join region in unnamed anonymous memory"); + return (EINVAL); + } + + ret = __os_map(path, + infop->fd, infop->size, 1, 1, 0, &infop->addr); + } +#endif + } else { + /* + * !!! + * If we're creating normal regions, we use the mmap(2) + * interface if it's available because it's POSIX 1003.1 + * standard and we trust it more than we do shmget(2). + */ +#ifdef HAVE_MMAP + if (!called) { + called = 1; + + /* Mmap(2) regions that aren't anonymous can grow. */ + F_SET(infop, REGION_CANGROW); + + ret = __os_map(path, + infop->fd, infop->size, 1, 0, 0, &infop->addr); + } +#endif +#ifdef HAVE_SHMGET + if (!called) { + called = 1; + ret = __os_shmget(path, infop); + } +#endif + } + return (ret); +} + +/* + * __db_unmapregion -- + * Detach from the shared memory region. + * + * PUBLIC: int __db_unmapregion __P((REGINFO *)); + */ +int +__db_unmapregion(infop) + REGINFO *infop; +{ + int called, ret; + + called = 0; + ret = EINVAL; + + if (__db_jump.j_unmap != NULL) + return (__db_jump.j_unmap(infop->addr, infop->size)); + +#ifdef HAVE_SHMGET + if (infop->segid != INVALID_SEGID) { + called = 1; + ret = shmdt(infop->addr) ? errno : 0; + } +#endif +#ifdef HAVE_MMAP + if (!called) { + called = 1; + ret = munmap(infop->addr, infop->size) ? errno : 0; + } +#endif + return (ret); +} + +/* + * __db_unlinkregion -- + * Remove the shared memory region. + * + * PUBLIC: int __db_unlinkregion __P((char *, REGINFO *)); + */ +int +__db_unlinkregion(name, infop) + char *name; + REGINFO *infop; +{ + int called, ret; + + called = 0; + ret = EINVAL; + + if (__db_jump.j_runlink != NULL) + return (__db_jump.j_runlink(name)); + +#ifdef HAVE_SHMGET + if (infop->segid != INVALID_SEGID) { + called = 1; + ret = shmctl(infop->segid, IPC_RMID, NULL) ? errno : 0; + } +#else + COMPQUIET(infop, NULL); +#endif +#ifdef HAVE_MMAP + if (!called) { + called = 1; + ret = 0; + } +#endif + return (ret); +} + +/* + * __db_mapfile -- + * Map in a shared memory file. + * + * PUBLIC: int __db_mapfile __P((char *, int, size_t, int, void **)); + */ +int +__db_mapfile(path, fd, len, is_rdonly, addr) + char *path; + int fd, is_rdonly; + size_t len; + void **addr; +{ + if (__db_jump.j_map != NULL) + return (__db_jump.j_map(path, fd, len, 0, 0, is_rdonly, addr)); + +#ifdef HAVE_MMAP + return (__os_map(path, fd, len, 0, 0, is_rdonly, addr)); +#else + return (EINVAL); +#endif +} + +/* + * __db_unmapfile -- + * Unmap the shared memory file. + * + * PUBLIC: int __db_unmapfile __P((void *, size_t)); + */ +int +__db_unmapfile(addr, len) + void *addr; + size_t len; +{ + if (__db_jump.j_unmap != NULL) + return (__db_jump.j_unmap(addr, len)); + +#ifdef HAVE_MMAP + return (munmap(addr, len) ? errno : 0); +#else + return (EINVAL); +#endif +} + +#ifdef HAVE_MMAP +/* + * __os_map -- + * Call the mmap(2) function. + */ +static int +__os_map(path, fd, len, is_region, is_anonymous, is_rdonly, addr) + char *path; + int fd, is_region, is_anonymous, is_rdonly; + size_t len; + void **addr; +{ + void *p; + int flags, prot; + + COMPQUIET(path, NULL); + + /* + * If it's read-only, it's private, and if it's not, it's shared. + * Don't bother with an additional parameter. + */ + flags = is_rdonly ? MAP_PRIVATE : MAP_SHARED; + + if (is_region && is_anonymous) { + /* + * BSD derived systems use MAP_ANON; Digital Unix and HP/UX + * use MAP_ANONYMOUS. + */ +#ifdef MAP_ANON + flags |= MAP_ANON; +#endif +#ifdef MAP_ANONYMOUS + flags |= MAP_ANONYMOUS; +#endif + fd = -1; + } +#ifdef MAP_FILE + if (!is_region || !is_anonymous) { + /* + * Historically, MAP_FILE was required for mapping regular + * files, even though it was the default. Some systems have + * it, some don't, some that have it set it to 0. + */ + flags |= MAP_FILE; + } +#endif + + /* + * I know of no systems that implement the flag to tell the system + * that the region contains semaphores, but it's not an unreasonable + * thing to do, and has been part of the design since forever. I + * don't think anyone will object, but don't set it for read-only + * files, it doesn't make sense. + */ +#ifdef MAP_HASSEMAPHORE + if (!is_rdonly) + flags |= MAP_HASSEMAPHORE; +#endif + + prot = PROT_READ | (is_rdonly ? 0 : PROT_WRITE); + + /* MAP_FAILED was not defined in early mmap implementations. */ +#ifndef MAP_FAILED +#define MAP_FAILED -1 +#endif + if ((p = + mmap(NULL, len, prot, flags, fd, (off_t)0)) == (void *)MAP_FAILED) + return (errno); + + *addr = p; + return (0); +} +#endif + +#ifdef HAVE_SHMGET +/* + * __os_shmget -- + * Call the shmget(2) family of functions. + */ +static int +__os_shmget(path, infop) + REGINFO *infop; + char *path; +{ + key_t key; + int shmflg; + + if (F_ISSET(infop, REGION_CREATED)) { + /* + * The return key from ftok(3) is not guaranteed to be unique. + * The nice thing about the shmget(2) interface is that it + * allows you to name anonymous pieces of memory. The evil + * thing about it is that the name space is separate from the + * filesystem. + */ +#ifdef __hp3000s900 + {char mpe_path[MAXPATHLEN]; + /* + * MPE ftok() is broken as of 5.5pp4. If the file path does + * not start with '/' or '.', then ftok() tries to interpret + * the file path in MPE syntax instead of POSIX HFS syntax. + * The workaround is to prepend "./" to these paths. See HP + * SR 5003416081 for details. + */ + if (*path != '/' && *path != '.') { + if (strlen(path) + strlen("./") + 1 > sizeof(mpe_path)) + return (ENAMETOOLONG); + mpe_path[0] = '.'; + mpe_path[1] = '/'; + (void)strcpy(mpe_path + 2, path); + path = mpe_path; + } + } +#endif + if ((key = ftok(path, 1)) == (key_t)-1) + return (errno); + + shmflg = IPC_CREAT | 0600; + if ((infop->segid = shmget(key, infop->size, shmflg)) == -1) + return (errno); + } + + if ((infop->addr = shmat(infop->segid, NULL, 0)) == (void *)-1) { + /* + * If we're trying to join the region and failing, assume + * that there was a reboot and the region no longer exists. + */ + if (!F_ISSET(infop, REGION_CREATED)) + errno = EAGAIN; + return (errno); + } + + F_SET(infop, REGION_HOLDINGSYS); + return (0); +} +#endif diff --git a/mozilla/db/os/os_oflags.c b/mozilla/db/os/os_oflags.c new file mode 100644 index 00000000000..388c1c6faa3 --- /dev/null +++ b/mozilla/db/os/os_oflags.c @@ -0,0 +1,94 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_oflags.c 10.6 (Sleepycat) 4/19/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#include + +#include +#endif + +#include "db_int.h" + +/* + * __db_oflags -- + * Convert open(2) flags to DB flags. + * + * PUBLIC: u_int32_t __db_oflags __P((int)); + */ +u_int32_t +__db_oflags(oflags) + int oflags; +{ + u_int32_t dbflags; + + /* + * XXX + * Convert POSIX 1003.1 open(2) flags to DB flags. Not an exact + * science as most POSIX implementations don't have a flag value + * for O_RDONLY, it's simply the lack of a write flag. + */ + dbflags = 0; + if (oflags & O_CREAT) + dbflags |= DB_CREATE; + if (!(oflags & (O_RDWR | O_WRONLY)) || oflags & O_RDONLY) + dbflags |= DB_RDONLY; + if (oflags & O_TRUNC) + dbflags |= DB_TRUNCATE; + return (dbflags); +} + +/* + * __db_omode -- + * Convert a permission string to the correct open(2) flags. + * + * PUBLIC: int __db_omode __P((const char *)); + */ +int +__db_omode(perm) + const char *perm; +{ + int mode; + +#ifndef S_IRUSR +#if defined(_WIN32) || defined(WIN16) +#define S_IRUSR S_IREAD /* R for owner */ +#define S_IWUSR S_IWRITE /* W for owner */ +#define S_IRGRP 0 /* R for group */ +#define S_IWGRP 0 /* W for group */ +#define S_IROTH 0 /* R for other */ +#define S_IWOTH 0 /* W for other */ +#else +#define S_IRUSR 0000400 /* R for owner */ +#define S_IWUSR 0000200 /* W for owner */ +#define S_IRGRP 0000040 /* R for group */ +#define S_IWGRP 0000020 /* W for group */ +#define S_IROTH 0000004 /* R for other */ +#define S_IWOTH 0000002 /* W for other */ +#endif /* _WIN32 || WIN16 */ +#endif + mode = 0; + if (perm[0] == 'r') + mode |= S_IRUSR; + if (perm[1] == 'w') + mode |= S_IWUSR; + if (perm[2] == 'r') + mode |= S_IRGRP; + if (perm[3] == 'w') + mode |= S_IWGRP; + if (perm[4] == 'r') + mode |= S_IROTH; + if (perm[5] == 'w') + mode |= S_IWOTH; + return (mode); +} diff --git a/mozilla/db/os/os_open.c b/mozilla/db/os/os_open.c new file mode 100644 index 00000000000..e960377ebb4 --- /dev/null +++ b/mozilla/db/os/os_open.c @@ -0,0 +1,111 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_open.c 10.26 (Sleepycat) 5/4/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#endif + +#include "db_int.h" + +/* + * __db_open -- + * Open a file descriptor. + * + * PUBLIC: int __db_open __P((const char *, u_int32_t, u_int32_t, int, int *)); + */ +int +__db_open(name, arg_flags, ok_flags, mode, fdp) + const char *name; + u_int32_t arg_flags, ok_flags; + int mode, *fdp; +{ + int fd, flags; + + if (arg_flags & ~ok_flags) + return (EINVAL); + + flags = 0; + + /* + * DB requires the semantic that two files opened at the same time + * with O_CREAT and O_EXCL set will return failure in at least one. + */ + if (arg_flags & DB_CREATE) + flags |= O_CREAT; + + if (arg_flags & DB_EXCL) + flags |= O_EXCL; + + if (arg_flags & DB_RDONLY) + flags |= O_RDONLY; + else + flags |= O_RDWR; + +#if defined(_WIN32) || defined(WIN16) +#ifdef _MSC_VER + if (arg_flags & DB_SEQUENTIAL) + flags |= _O_SEQUENTIAL; + else + flags |= _O_RANDOM; + + if (arg_flags & DB_TEMPORARY) + flags |= _O_TEMPORARY; +#endif + flags |= O_BINARY | O_NOINHERIT; +#endif + + if (arg_flags & DB_TRUNCATE) + flags |= O_TRUNC; + + /* Open the file. */ + if ((fd = __os_open(name, flags, mode)) == -1) + return (errno); + +#ifndef _WIN32 + /* Delete any temporary file; done for Win32 by _O_TEMPORARY. */ + if (arg_flags & DB_TEMPORARY) + (void)__os_unlink(name); +#endif + +#if !defined(_WIN32) && !defined(WIN16) + /* + * Deny access to any child process; done for Win32 by O_NOINHERIT, + * MacOS has neither child processes nor fd inheritance. + */ + if (fcntl(fd, F_SETFD, 1) == -1) { + int ret = errno; + + (void)__os_close(fd); + return (ret); + } +#endif + *fdp = fd; + return (0); +} + +/* + * __db_close -- + * Close a file descriptor. + * + * PUBLIC: int __db_close __P((int)); + */ +int +__db_close(fd) + int fd; +{ + return (__os_close(fd) ? errno : 0); +} diff --git a/mozilla/db/os/os_rpath.c b/mozilla/db/os/os_rpath.c new file mode 100644 index 00000000000..23867b35aca --- /dev/null +++ b/mozilla/db/os/os_rpath.c @@ -0,0 +1,42 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_rpath.c 10.3 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#endif + +#include "db_int.h" + +/* + * __db_rpath -- + * Return the last path separator in the path or NULL if none found. + * + * PUBLIC: char *__db_rpath __P((const char *)); + */ +char * +__db_rpath(path) + const char *path; +{ + const char *s, *last; + + last = NULL; + if (PATH_SEPARATOR[1] != '\0') { + for (s = path; s[0] != '\0'; ++s) + if (strchr(PATH_SEPARATOR, s[0]) != NULL) + last = s; + } else + for (s = path; s[0] != '\0'; ++s) + if (s[0] == PATH_SEPARATOR[0]) + last = s; + return ((char *)last); +} diff --git a/mozilla/db/os/os_rw.c b/mozilla/db/os/os_rw.c new file mode 100644 index 00000000000..75910419816 --- /dev/null +++ b/mozilla/db/os/os_rw.c @@ -0,0 +1,74 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_rw.c 10.7 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" + +/* + * __db_read -- + * Read from a file handle. + * + * PUBLIC: int __db_read __P((int, void *, size_t, ssize_t *)); + */ +int +__db_read(fd, addr, len, nrp) + int fd; + void *addr; + size_t len; + ssize_t *nrp; +{ + size_t offset; + ssize_t nr; + u_int8_t *taddr; + + for (taddr = addr, + offset = 0; offset < len; taddr += nr, offset += nr) { + if ((nr = __os_read(fd, taddr, len - offset)) < 0) + return (errno); + if (nr == 0) + break; + } + *nrp = taddr - (u_int8_t *)addr; + return (0); +} + +/* + * __db_write -- + * Write to a file handle. + * + * PUBLIC: int __db_write __P((int, void *, size_t, ssize_t *)); + */ +int +__db_write(fd, addr, len, nwp) + int fd; + void *addr; + size_t len; + ssize_t *nwp; +{ + size_t offset; + ssize_t nw; + u_int8_t *taddr; + + for (taddr = addr, + offset = 0; offset < len; taddr += nw, offset += nw) + if ((nw = __os_write(fd, taddr, len - offset)) < 0) + return (errno); + *nwp = len; + return (0); +} diff --git a/mozilla/db/os/os_seek.c b/mozilla/db/os/os_seek.c new file mode 100644 index 00000000000..159425cc272 --- /dev/null +++ b/mozilla/db/os/os_seek.c @@ -0,0 +1,44 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_seek.c 10.9 (Sleepycat) 4/19/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" + +/* + * __os_seek -- + * Seek to a page/byte offset in the file. + * + * PUBLIC: int __os_seek __P((int, size_t, db_pgno_t, u_int32_t, int, int)); + */ +int +__os_seek(fd, pgsize, pageno, relative, isrewind, whence) + int fd; + size_t pgsize; + db_pgno_t pageno; + u_int32_t relative; + int isrewind, whence; +{ + off_t offset; + + offset = (off_t)pgsize * pageno + relative; + if (isrewind) + offset = -offset; + + return (lseek(fd, offset, whence) == -1 ? errno : 0); +} diff --git a/mozilla/db/os/os_sleep.c b/mozilla/db/os/os_sleep.c new file mode 100644 index 00000000000..6a5b91f5c4b --- /dev/null +++ b/mozilla/db/os/os_sleep.c @@ -0,0 +1,55 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_sleep.c 10.10 (Sleepycat) 4/27/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_SYS_SELECT_H +#include +#endif + +#include +#ifndef HAVE_SYS_TIME_H +#include +#endif +#include +#endif + +#include "db_int.h" + +/* + * __os_sleep -- + * Yield the processor for a period of time. + * + * PUBLIC: int __os_sleep __P((u_long, u_long)); + */ +int +__os_sleep(secs, usecs) + u_long secs, usecs; /* Seconds and microseconds. */ +{ + struct timeval t; + + /* Don't require that the values be normalized. */ + for (; usecs >= 1000000; ++secs, usecs -= 1000000) + ; + + /* + * It's important that we yield the processor here so that other + * processes or threads are permitted to run. + */ + t.tv_sec = secs; + t.tv_usec = usecs; + return (select(0, NULL, NULL, NULL, &t) == -1 ? errno : 0); +} diff --git a/mozilla/db/os/os_spin.c b/mozilla/db/os/os_spin.c new file mode 100644 index 00000000000..2fd21d018b4 --- /dev/null +++ b/mozilla/db/os/os_spin.c @@ -0,0 +1,61 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_spin.c 10.7 (Sleepycat) 5/20/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" + +/* + * __os_spin -- + * Return the number of default spins before blocking. + * + * PUBLIC: int __os_spin __P((void)); + */ +int +__os_spin() +{ + static long sys_val; + + /* If the application specified the spins, use its value. */ + if (DB_GLOBAL(db_tsl_spins) != 0) + return (DB_GLOBAL(db_tsl_spins)); + + /* If we've already figured this out, return the value. */ + if (sys_val != 0) + return (sys_val); + + /* + * XXX + * Solaris and Linux use _SC_NPROCESSORS_ONLN to return the number of + * online processors. We don't want to repeatedly call sysconf because + * it's quite expensive (requiring multiple filesystem accesses) under + * Debian Linux. + * + * Spin 50 times per processor -- we have anecdotal evidence that this + * is a reasonable value. + */ +#if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN) + if ((sys_val = sysconf(_SC_NPROCESSORS_ONLN)) > 1) + sys_val *= 50; + else + sys_val = 1; +#else + sys_val = 1; +#endif + return (sys_val); +} diff --git a/mozilla/db/os/os_stat.c b/mozilla/db/os/os_stat.c new file mode 100644 index 00000000000..e7d3f241746 --- /dev/null +++ b/mozilla/db/os/os_stat.c @@ -0,0 +1,94 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_stat.c 10.15 (Sleepycat) 4/27/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include +#include + +#include +#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; +{ + struct stat sb; + + if (stat(path, &sb) != 0) + return (errno); + +#if !defined(S_ISDIR) || defined(STAT_MACROS_BROKEN) +#if defined(_WIN32) || defined(WIN16) +#define S_ISDIR(m) (_S_IFDIR & (m)) +#else +#define S_ISDIR(m) (((m) & 0170000) == 0040000) +#endif +#endif + if (isdirp != NULL) + *isdirp = S_ISDIR(sb.st_mode); + + return (0); +} + +/* + * __os_ioinfo -- + * Return file size and I/O size; abstracted to make it easier + * to replace. + * + * PUBLIC: int __os_ioinfo + * PUBLIC: __P((const char *, int, u_int32_t *, u_int32_t *, u_int32_t *)); + */ +int +__os_ioinfo(path, fd, mbytesp, bytesp, iosizep) + const char *path; + int fd; + u_int32_t *mbytesp, *bytesp, *iosizep; +{ + struct stat sb; + + COMPQUIET(path, NULL); + + if (fstat(fd, &sb) == -1) + return (errno); + + /* Return the size of the file. */ + if (mbytesp != NULL) + *mbytesp = sb.st_size / MEGABYTE; + if (bytesp != NULL) + *bytesp = sb.st_size % MEGABYTE; + + /* + * Return the underlying filesystem blocksize, if available. + * + * XXX + * Check for a 0 size -- HP's MPE architecture has st_blksize, + * but it's always 0. + */ +#ifdef HAVE_ST_BLKSIZE + if (iosizep != NULL && (*iosizep = sb.st_blksize) == 0) + *iosizep = DB_DEF_IOSIZE; +#else + if (iosizep != NULL) + *iosizep = DB_DEF_IOSIZE; +#endif + return (0); +} diff --git a/mozilla/db/os/os_unlink.c b/mozilla/db/os/os_unlink.c new file mode 100644 index 00000000000..3a1fa3ff996 --- /dev/null +++ b/mozilla/db/os/os_unlink.c @@ -0,0 +1,34 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)os_unlink.c 10.5 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#endif + +#include "db_int.h" + +/* + * __db_unlink -- + * Remove a file. + * + * PUBLIC: int __db_unlink __P((const char *)); + */ +int +__db_unlink(path) + const char *path; +{ + return (__os_unlink(path) == -1 ? errno : 0); +} diff --git a/mozilla/db/test/README b/mozilla/db/test/README new file mode 100644 index 00000000000..86af6c962bf --- /dev/null +++ b/mozilla/db/test/README @@ -0,0 +1,334 @@ +# @(#)README 10.15 (Sleepycat) 6/2/98 + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +DB Test Suite + +If you specify --enable-test when you configure DB, the DB tester will be +built (see ../build.unix/README for further information.) + +All DB tests are run from the Tcl tester, "dbtest". To start the tester, +enter: + + $ ./dbtest + +A percent sign prompt (%) will appear. Some of the commands that you can +enter at the prompt are as follows: + + % # To run the entire test suite + % run_all + % # To run tests for a particular subsystem + % r btree + % r hash + % r lock + % r log + % r mpool + % r mutex + % r recd + % r recno + % r txn + +In the case of run_all, normal output is directed to a file named ALL.OUT, +as running all the tests can take several hours. After the test suite +has completed, you will get a single message that indicates whether the +entire suite succeeded or failed. If it failed, the file ALL.OUT will +contain more details describing what failed. Any errors will appear as +output lines beginning with the word: FAIL. + +For any of the other tests, a successful test will return you to the tcl +prompt (%). On failure, you will get a message indicating the expected +and actual values. + +Tests are run, by default, in the directory ./TESTDIR. However, the test +files can be quite large. To use a different directory for the test +directory, edit the file ".dbtestrc" in your build directory, and change +the line: + + set testdir ./TESTDIR + +to a more appropriate value for your system, e.g.: + + set testdir /var/tmp/db.test + +WARNING: On many platforms, the mmap(2) and/or fcntl(2) locking system +calls won't work correctly over remote filesystems (e.g., NFS and AFS), +so we strongly recommend that TESTDIR be a local filesystem. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Debugging DB + +The dbtest "debug" command provides assistance for debugging tests. If +you don't specify a parameter, e.g.: + + % debug + % r btree + +debug causes dbtest to display a running count of the calls made into the +DB library. There is one optional argument to debug which is the number +of the operation on which you want to stop. By using your debugger to +set a breakpoint in the function __db_loadme(), you can obtain control of +the tester immediately before a particular operation. For example: + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +mongoose:build.unix {1} gdb dbtest +(gdb) break __db_loadme +Breakpoint 1 at 0xe3f7: file ../dist/../db/db_pr.c, line 43. +(gdb) run +Starting program: /usr/src/db/build.unix/dbtest +% debug 10 +10 +% r btree +run_method: btree 1 19 +09:29:32 (00:00:00) +Test001: DB_BTREE 10000 equal key/data pairs + 1: Test001.a: put/get loop + 10: +Breakpoint 1, __db_loadme () at ../dist/../db/db_pr.c:43 +43 getpid(); +(gdb) n +44 } +(gdb) n +debug_check () at ../dist/../test/utils.c:1254 +1254 } +(gdb) n +db_put_cmd (interp=0x54000, argc=6, argv=0xefbfc408, dbp=0xea080) + at ../dist/../test/utils.c:859 +859 if ((err = dbp->put(dbp, txnid, &key, &data, flags)) == 0) { +(gdb) s +__bt_put (dbp=0xea080, txn=0x0, key=0xefbfc2bc, data=0xefbfc2d4, flags=0) + at ../dist/../btree/bt_put.c:91 +91 t = dbp->internal; +(gdb) where +#0 __bt_put (dbp=0xea080, txn=0x0, key=0xefbfc2bc, data=0xefbfc2d4, flags=0) + at ../dist/../btree/bt_put.c:91 +#1 0x7691 in db_put_cmd (interp=0x54000, argc=6, argv=0xefbfc408, dbp=0xea080) + at ../dist/../test/utils.c:859 +#2 0x68b2 in dbwidget_cmd (cd_dbp=0xea080, interp=0x54000, argc=6, + argv=0xefbfc408) at ../dist/../test/utils.c:517 +#3 0x3a690 in Tcl_Eval () +(gdb) quit +The program is running. Quit anyway (and kill it)? (y or n) y +mongoose:build.unix {2} + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +To set a counter breakpoint from inside a debugger, set the global variable +debug_test to the counter value at which you want to stop. For example, +you might first stop at operation 100, and then stop at operation 200 by +initially setting a breakpoint in __db_loadme, issuing a debug 100 command +and then setting debug_test to 200 in the debugger. (Some of the trickier +bugs in DB are best solved by binary search, looking for the precise moment +at which the page contents go bad.) + +If you want to stop on each iteration, set the variable debug_stop to a +non-zero value. + +There are also a number of routines to help you display page and tree +contents. These routines live in ../db/db_pr.c. The most useful are: + + __db_prpage(page_address, dump_all) + __db_dump(DB *, file_name, dump_all) + __memp_debug(DB_MPOOL *, file_pointer, dump_all) + +For example, you can call these from gdb as follows: + + print __db_prpage(cp->page, 1) # Display a page's contents + print __db_dump(dbp, "/tmp/dump", 1) # Display the entire file + print __memp_debug(dbp->mp, 0, 1) # Display the memory pool. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +There are two different modes of RECNO testing, with and without renumbering. +The default (as of 2.3.0) is that RECNO does not renumber by default. In +order to specify renumbering, all you need to do is set the DB_RENUMBER flag +as an optional parameter. However, in order to simplify testing, the access +method type RRECNO implies RECNO with renumbering. + +The DB tester currently has the following tests: + +test001: Small keys/data HASH, BTREE, RECNO + Put/get per key. + Dump file, verify. + Close, reopen. + Dump file, verify. + +test002: Small keys/medium data HASH, BTREE, RECNO + Put/get per key. + Dump file, verify. + Close, reopen. + Dump file, verify. + +test003: Small keys/large data HASH, BTREE, RECNO + Put/get per key. + Dump file, verify. + Close, reopen. + Dump file, verify. + +test004: Small keys/medium data HASH, BTREE, RECNO + Put/get per key. + Sequential (cursor) get/delete and verify + +test005: Small keys/medium data HASH, BTREE, RECNO + Put/get per key. + Close, reopen. + Sequential (cursor) get/delete and verify + +test006: Small keys/medium data HASH, BTREE, RECNO + Put/get per key. + Keyed delete and verify + +test007: Small keys/medium data HASH, BTREE, RECNO + Put/get per key. + Close, reopen. + Keyed delete and verify + +test008: Small keys/large data HASH, BTREE, RECNO + Put/get per key. + Loop through keys by steps (which change). + delete each key at step + add each key back + change step. + Tests that overflow pages are getting reused appropriately. + +test009: Same as 8; close and reopen database. + +test010: Duplicate test (small key/data pairs) (btree, hash) + +test011: Duplicate test (small key/data pairs). Test out + Keyfirst, Keylast, add_before and add_after. To verify + duplicates onto overflow pages, run with small pagesize. + +test012: Similar to test003 except we use big keys (executables) + and small data (the executable names). + +test013: First partial put test. Overwrite entire records using + partial puts. Make sure that we do not allow overwrites + when the NOOVERWRITE flag is set. + +test014: Exercise partial puts on short data. Run 5 combinations + of numbers of characters to replace, and number of times + to increase the size by. + +test015: Partial put where the key does not initially exist. + +test016: Partial put where the datum gets shorter as a result of + the put. + +test017: Basic offpage duplicate test. + +test018: Key_{first,last,before,after} offpage duplicates. + +test019: Partial get test. + +test020: In-Memory database tests. + +test021: Btree range tests. + +test022: Test multiple data directories. + +test023: Exercise deletes and cursor operations within a duplicate set. + +test024: Test Btree/Recno get by record number tests. + +test025: Test DB_APPEND for recno. + +test026: Small keys/medium data w/duplicates HASH, BTREE + Put/get per key. + Loop through keys -- delete each key + Tests that we are deleting dups correctly + with the cursor + +test027: Call test026 with parameters to force off-page duplicates. + +test028: Test put operations after deleting through a cursor. + +test029: Record renumbering for recno and btree. + +test030: Random tester. Runs a number of random add/delete/retrieve + operations. Tests both successful conditions and error + conditions. + +test031: Multi-process random test. Tests multiple processes running + random operations concurrently. Has the potential for + deadlocks. + +test032: System integration tests. Requires proper functioning of + the checkpoint daemon, recovery, transactions, etc. + +test033: Get/Put/Delete operation flags (not yet completed). + +parmtest: run access method tests with a combination of parameters. + +Locking Tests + +lock001 Specifically checks: open, close, unlink. +lock002 Gets/Puts. Contention without waiting. +lock003 Growing a shared region. +lock004 Multi-process lock tests. +lock005 Multiprocess random lock test. + +Log Tests +log001 Specifically checks: open, close, unlink. +log002 Read/write log records. +log003 Tests multiple logs, truncation, lsn comparison and file + functionality. +log004 Verify that log_flush is flushing records when we think + it should be. + +Mpool Tests +memp001 Randomly updates pages. +memp002 Tests multiple processes accessing and modifying the same + files. + +Txn Tests +txn001 Specifically checks: open, close, unlink. +txn002 Begin, commit, abort testing. +txn003 Region growing code. + +Recovery Tests + +recd001 Per-operation recovery tests for non-duplicate, non-split + messages. Makes sure that we exercise redo, undo, and + do-nothing condition. Any test that appears with the + message (change state) indicates that we've already run + the particular test, but we are running it again so that + we can change the state of the data base to prepare for + the next test (this applies to all other recovery tests + as well). + +recd002 Split recovery tests. For every known split log message, + makes sure that we exercise redo, undo, and do-nothing + condition. + +recd003 Duplicate recovery tests. For every known duplicate log + message, makes sure that we exercise redo, undo, and + do-nothing condition. + +recd004 Big key test where big key gets elevated to internal page. + +Deadlock detector tests + +dead001 Use two different configurations to test deadlock detection + among a variable number of processes. One configuration has + the processes deadlocked in a ring. The other has the + processes all deadlocked on a single resource. + +dead002 Same test as above, but use "detect on every collision" instead + of separate deadlockd detector. + +Bug tests + +bug001 Cursor maintenance in duplicates. +bug002 Cursor ops not in duplicates +bug003 Delete with cursor on a key. +bug004 Delete cursor key and re-add. +bug005 Verify that deleting and readding duplicates results in + correct ordering. +bug006 Log prev works across log files. +bug007 Cursor ops work with a partial length of 0. +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Planned tests that are not yet written: + +testXXX: Cursor locking test. + +test021: Interface test (all flags to all functions). + db_appinit options + +testXXX: errno testing (if -1 is returned, errno should be set) diff --git a/mozilla/db/test/README.win32 b/mozilla/db/test/README.win32 new file mode 100644 index 00000000000..eb17e4280b5 --- /dev/null +++ b/mozilla/db/test/README.win32 @@ -0,0 +1,134 @@ +# @(#)README.win32 8.4 (Sleepycat) 6/2/98 + +These notes are for build/running/changing dbtest on Win32 platforms +(only!). At this point, I've only really tried Win/NT. And because I +really want to test/debug DB, I've taken the path of least resistance in +fixing the dbtest environment. Hopefully, these hacks can be fixed over +time, via changes to the scripts or whatever. + +================ +BUILDING dbtest. + +1) Open the build.win32/Berkeley_DB.dsw workspace, +2) Set the active configuration to dbtest - Debug. +3) Build. That should create a build.win32/dbtest.exe file. + +Unlike the other executables made via this workspace, dbtest.exe is not +put in the debug subdirectory, but directly in build.win32. This is +needed because the tcl scripts expect subordinate dbtest processes to be +run via "./dbtest args..." . + +================ +RUNNING dbtest. + +You will need a set of UNIX-like utilities to even think of running these +tests. Currently, it requires: cp, diff, kill, ls, mkdir, mv, rm, sed, +sleep, sort and tr. I'm using the MKS/NT package, which mostly works. +If you use this package, see MKS/NT notes below. I'd bet the GNU +utilities would work better. Before starting the tests, you need to: + +1) cd build.win32 +2) Edit the ./include.tcl file, changing the command entries to point to + your executables. For example, the line: + + set DIFF c:/tools/diff.exe + + in my case is changed to: + + set DIFF c:/mksnt/diff.exe + +3) Copy debug/dbrecover.exe dbrecover.exe . (Needed for recd test.) +4) Make the source CHANGES discussed below. +5) ./dbtest (You should get a '%' prompt.) +6) % run_all (This will take hours, producing an ALL.OUT file.) + +================ +RUNNING individual tests. + +Instead of step 6) above, you can run individual tests, e.g. + + % r btree + +or: + % test001 hash + +See test/README for details. Note, you will probably want to run: + + ./dbtest -debug + +so that any traps stop in the debugger. + +================ +FAILURES + +Places where the tests still fail: + +1) memp003 (first time) + memp_unlink:./TESTDIR: expected 0, got memp_unlink: Error 0 + + I guess that someone still has the db open at the time of the unlink, + similar to the common/db_region.c/runlink() CHANGE above, but I don't + see where or how this happens. + +2) memp003 (second time? after dbtest ../test/mpoolscript.tcl ... -shmem name) + get_verify/RO: expected absenteesabsentees, got absentees + +3) Rsrc001.a: Read file, rewrite last record; write it out and diff + getlast: expected This is record 3 This is record 3 This is record 3, got This is record 3 This is record 3 This is record 3 + + Maybe CR/NL issue? + +4) Recd005.1.d: + About to run recovery ... Recovery error: db_recover: appinit failed: Permission denied. + +================ +DEVELOPER NOTES + +The dbtest program *cannot* current be linked with the DLL version of +libdb. This is because of the use of function pointers across dll +boundaries. The __db_jump structure (see os_func.h, os_map.c) stores +function pointers in a global structure. Unfortunately the address of +these functions apparently cannot be used to jump to the functions outside +of the DLL (presumably a way to store a "global-accessible" function +pointer is available with a pragma, dunno how MS does this). For now, +most of these issues are dealt with by linking static. Of course, this +may introduce other issues since we are linking against a DLL version of +Tcl, so we get multiple versions of malloc linked into our application. +Sigh. Fortunately that doesn't cause too much trouble, we merely need to +comment out a free call at the end of list_to_numarray() in test/utils.c +. That's the only known place where Tcl mallocs memory that we try to +free. (Linking with the DLL version of libdb doesn't fix this either!). + +Also due to shared library issues, you may see errors reported as: + + memp_unlink:./TESTDIR: expected 0, got memp_unlink: Error 0 + +Rather than a more meaningful error: + + ... got memp_unlink: no such file or directory + +This has been isolated to a shared lib in using the Tcl_PosixError() +function. Setting errno = n; in one shared library does not necessarily +make it visible in another shared library. Thank you, MS. + +================ +MKSNT notes: + +If you are using MKS NT, you will find that there are a few tests that +don't work out of the box, because there are some tests that produce +input/output data that has very long (> 2048 char) lines that are longer +than the MKS default limit. The 'diff' and 'sort' commands both break on +these long lines. The 'diff' problem can be more or less solved by +setting: + + set DIFF c:/mksnt/diff.exe + +since you only care in this case whether outputs are different, not so +much the actual differences. + +The 'sort' problem can be fixed by changing the maximum record length on +the command line, adding a '-z16384' option does the trick. You can +change the .tcl script or hack up a replacement for sort.exe that calls +the real sort.exe with the extra options. Unfortunately changing +include.tcl to have the extra option doesn't work (I'm a neophyte to tcl, +maybe there's an easy way to do this). diff --git a/mozilla/db/test/archive.tcl b/mozilla/db/test/archive.tcl new file mode 100644 index 00000000000..9df02c974f6 --- /dev/null +++ b/mozilla/db/test/archive.tcl @@ -0,0 +1,220 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)archive.tcl 10.8 (Sleepycat) 6/2/98 +# +# Options are: +# -checkrec +# -maxfilesize +# -stat +proc archive_usage {} { + puts "archive -checkrec -dir \ + -maxfilesize " +} +proc archive { args } { + source ./include.tcl + +# Set defaults +global alphabet + set maxfile [expr 1024 * 20] + set dostat 0 + set checkrec 500 + for { set i 0 } { $i < [llength $args] } {incr i} { + switch -regexp -- [lindex $args $i] { + -c.* { incr i; set checkrec [lindex $args $i] } + -d.* { incr i; set testdir [lindex $args $i] } + -m.* { incr i; set maxfile [lindex $args $i] } + -s.* { set dostat 1 } + default { + archive_usage + return + } + + } + } + if { [file exists $testdir] != 1 } { + exec $MKDIR $testdir + } elseif { [file isdirectory $testdir ] != 1 } { + error "$testdir is not a directory" + } + + # Clean out old log if it existed + puts "Unlinking log: error message OK" + cleanup $testdir + + # Now run the various functionality tests + set dbenv [dbenv -dbhome $testdir -maxsize $maxfile -dbflags \ + [expr $DB_CREATE | $DB_INIT_MPOOL | $DB_INIT_LOCK | \ + $DB_INIT_LOG | $DB_INIT_TXN]] + error_check_bad dbenv $dbenv NULL + error_check_good dbenv [is_substr $dbenv env] 1 + + # Open the log + set lp [ log "" 0 0 -maxsize $maxfile -dbenv $dbenv] + error_check_bad log:$testdir $lp NULL + error_check_good log:$testdir [is_substr $lp log] 1 + + # Open/Create the lock region + set txn [txn "" 0 0 -dbenv $dbenv] + error_check_bad txn $txn NULL + error_check_good txn [is_substr $txn mgr] 1 + + # The basic test structure here is that we write a lot of log + # records (enough to fill up 100 log files; each log file it + # small). We take periodic checkpoints. Between each pair + # of checkpoints, we refer to 2 files, overlapping them each + # checkpoint. We also start transactions and let them overlap + # checkpoints as well. The pattern that we try to create is: + # ---- write log records----|||||--- write log records --- + # -T1 T2 T3 --- D1 D2 ------CHECK--- CT1 --- D2 D3 CD1 ----CHECK + # where TX is begin transaction, CTx is commit transaction, DX is + # open data file and CDx is close datafile. + + set baserec "1:$alphabet:2:$alphabet:3:$alphabet:4:$alphabet" + puts "Archive.a: Writing log records; checkpoint every $checkrec records" + set nrecs $maxfile + set rec 0:$baserec + # Begin transaction and write a log record + set t1 [$txn begin] + set l1 [lindex [$lp put $rec 0] 1] + set lsnlist [list $l1] + + set t2 [$txn begin] + set l1 [lindex [$lp put $rec 0] 1] + lappend lsnlist $l1 + + set t3 [$txn begin] + set l1 [lindex [$lp put $rec 0] 1] + lappend lsnlist $l1 + + set txnlist [list $t1 $t2 $t3] + set db1 [dbopen ar1 $DB_CREATE 0644 DB_HASH -dbenv $dbenv] + set db2 [dbopen ar2 $DB_CREATE 0644 DB_BTREE -dbenv $dbenv] + set dbcount 3 + set dblist [list $db1 $db2] + for { set i 1 } { $i <= $nrecs } { incr i } { + set rec $i:$baserec + set lsn [$lp put $rec 0] + error_check_bad log_put [is_substr $lsn log_cmd] 1 + + if { [expr $i % $checkrec] == 0 } { + # Take a checkpoint + $txn check + set ckp_file [lindex [$lp last] 0] + + catch { exec ./db_archive -h $testdir -a } res_log_full + if { [string first db_archive $res_log_full] == 0 } { + set res_log_full "" + } + catch { exec ./db_archive -h $testdir } res_log + if { [string first db_archive $res_log] == 0 } { + set res_log "" + } + catch { exec ./db_archive -h $testdir -l } res_alllog + catch { exec ./db_archive -h $testdir -a -s } \ + res_data_full + catch { exec ./db_archive -h $testdir -s } res_data + + error_check_good nlogfiles [llength $res_alllog] \ + [lindex [$lp last] 0] + error_check_good logs_match [llength $res_log_full] \ + [llength $res_log] + error_check_good data_match [llength $res_data_full] \ + [llength $res_data] + + # Check right number of log files + error_check_good nlogs [llength $res_log] \ + [expr [lindex $lsnlist 0] - 1] + + # Check that the relative names are a subset of the + # full names + set n 0 + foreach x $res_log { + error_check_bad log_name_match:$res_log \ + [string first $x \ + [lindex $res_log_full $n]] -1 + incr n + } + + set n 0 + foreach x $res_data { + error_check_bad log_name_match:$res_data \ + [string first $x \ + [lindex $res_data_full $n]] -1 + incr n + } + + # Begin/commit any transactions + set t [lindex $txnlist 0] + if { [string length $t] != 0 } { + error_check_good txn_commit:$t [$t commit] 0 + set txnlist [lrange $txnlist 1 end] + } + set lsnlist [lrange $lsnlist 1 end] + + if { [llength $txnlist] == 0 } { + set t1 [$txn begin] + error_check_bad tx_begin $t1 NULL + error_check_good tx_begin [is_substr $t1 $txn] 1 + set l1 [lindex [$lp put $rec 0] 1] + lappend lsnlist [min $l1 $ckp_file] + + set t2 [$txn begin] + error_check_bad tx_begin $t2 NULL + error_check_good tx_begin [is_substr $t2 $txn] 1 + set l1 [lindex [$lp put $rec 0] 1] + lappend lsnlist [min $l1 $ckp_file] + + set t3 [$txn begin] + error_check_bad tx_begin $t3 NULL + error_check_good tx_begin [is_substr $t3 $txn] 1 + set l1 [lindex [$lp put $rec 0] 1] + lappend lsnlist [min $l1 $ckp_file] + + set txnlist [list $t1 $t2 $t3] + } + + # Open/close some DB files + if { [expr $dbcount % 2] == 0 } { + set type DB_HASH + } else { + set type DB_BTREE + } + set db [dbopen ar$dbcount \ + $DB_CREATE 0644 $type -dbenv $dbenv] + error_check_bad db_open:$dbcount $db NULL + error_check_good db_open:$dbcount [is_substr $db db] 1 + incr dbcount + + lappend dblist $db + set db [lindex $dblist 0] + error_check_good db_close:$db [$db close] 0 + set dblist [lrange $dblist 1 end] + + } + } + + # Commit any transactions still running. + foreach t $txnlist { + error_check_good txn_commit:$t [$t commit] 0 + } + + # Close any files that are still open. + foreach d $dblist { + error_check_good db_close:$db [$d close] 0 + } + + # Close and unlink the file + reset_env $dbenv +} + +proc min { a b } { + if {$a < $b} { + return $a + } else { + return $b + } +} diff --git a/mozilla/db/test/bug001.tcl b/mozilla/db/test/bug001.tcl new file mode 100644 index 00000000000..d7c922702a1 --- /dev/null +++ b/mozilla/db/test/bug001.tcl @@ -0,0 +1,342 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)bug001.tcl 10.3 (Sleepycat) 4/10/98 +# +# Bug Test001: +# This series of tests are designed to test for known problems or trouble +# areas in the distribution. +# This test checks for cursor maintenance in the presence of deletes. +# There are N different scenarios to tests: +# 1. No duplicates. Cursor A deletes a key, do a GET for the key. +# 2. No duplicates. Cursor is positioned right before key K, Delete K, +# do a next on the cursor. +# 3. No duplicates. Cursor is positioned on key K, do a regular delete of K. +# do a current get on K. +# 4. Repeat 3 but do a next instead of current. +# +# 5. Duplicates. Cursor A is on the first item of a duplicate set, A +# does a delete. Then we do a non-cursor get. +# 6. Duplicates. Cursor A is in a duplicate set and deletes the item. +# do a delete of the entire Key. Test cursor current. +# 7. Continue last test and try cursor next. +# 8. Duplicates. Cursor A is in a duplicate set and deletes the item. +# Cursor B is in the same duplicate set and deletes a different item. +# Verify that the cursor is in the right place. +# 9. Cursors A and B are in the place in the same duplicate set. A deletes +# its item. Do current on B. +# 10. Continue 8 and do a next on B. +proc bug001 { method args } { + set method [convert_method $method] + puts "Bug001: $method interspersed cursor and normal operations" + if { $method == "DB_RECNO" } { + puts "Bug001 skipping for method RECNO" + return + } + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile bug001.db + cleanup $testdir + + set flags 0 + set txn 0 + + puts "\tBug001.a: No Duplicate Tests" + set db [eval [concat dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method $args]] + error_check_good db_open:nodup [is_substr $db db] 1 + + set curs [$db cursor $txn] + error_check_good curs_open:nodup [is_substr $curs $db] 1 + + # Put three keys in the database + for { set key 1 } { $key <= 3 } {incr key} { + set r [$db put $txn $key datum$key $flags] + error_check_good put $r 0 + } + + # Retrieve keys sequentially so we can figure out their order + set i 1 + for {set d [$curs get 0 $DB_FIRST] } { [string length $d] != 0 } { + set d [$curs get 0 $DB_NEXT] } { + set key_set($i) [lindex $d 0] + incr i + } + + # TEST CASE 1 + puts "\tBug001.a1: Delete w/cursor, regular get" + + # Now set the cursor on the middle on. + set r [$curs get $key_set(2) $DB_SET] + error_check_bad cursor_get:DB_SET [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_SET:key $k $key_set(2) + error_check_good curs_get:DB_SET:data $d datum$key_set(2) + + # Now do the delete + set r [$curs del 0] + error_check_good curs_del $r 0 + + # Now do the get + set r [$db get $txn $key_set(2) 0] + error_check_good get_after_del [is_substr $r "not found"] 1 + + # Free up the cursor. + error_check_good cursor_close [$curs close] 0 + + # TEST CASE 2 + puts "\tBug001.a2: Cursor before K, delete K, cursor next" + + # Replace key 2 + set r [$db put $txn $key_set(2) datum$key_set(2) 0] + error_check_good put $r 0 + + # Open and position cursor on first item. + set curs [$db cursor $txn] + error_check_good curs_open:nodup [is_substr $curs $db] 1 + + # Retrieve keys sequentially so we can figure out their order + set i 1 + for {set d [$curs get 0 $DB_FIRST] } { [string length $d] != 0 } { + set d [$curs get 0 $DB_NEXT] } { + set key_set($i) [lindex $d 0] + incr i + } + + set r [$curs get $key_set(1) $DB_SET] + error_check_bad cursor_get:DB_SET [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_SET:key $k $key_set(1) + error_check_good curs_get:DB_SET:data $d datum$key_set(1) + + # Now delete (next item) $key_set(2) + error_check_good db_del:$key_set(2) [$db del $txn $key_set(2) 0] 0 + + # Now do next on cursor + set r [$curs get 0 $DB_NEXT] + error_check_bad cursor_get:DB_NEXT [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_NEXT:key $k $key_set(3) + error_check_good curs_get:DB_NEXT:data $d datum$key_set(3) + + # TEST CASE 3 + puts "\tBug001.a3: Cursor on K, delete K, cursor current" + + # delete item 3 + error_check_good db_del:$key_set(3) [$db del $txn $key_set(3) 0] 0 + set r [$curs get 0 $DB_CURRENT] + error_check_good current_after_del [llength $r] 0 + error_check_good cursor_close [$curs close] 0 + + puts "\tBug001.a4: Cursor on K, delete K, cursor next" + + # Restore keys 2 and 3 + set r [$db put $txn $key_set(2) datum$key_set(2) 0] + error_check_good put $r 0 + set r [$db put $txn $key_set(3) datum$key_set(3) 0] + error_check_good put $r 0 + + # Create the new cursor and put it on 1 + set curs [$db cursor $txn] + error_check_good curs_open:nodup [is_substr $curs $db] 1 + set r [$curs get $key_set(1) $DB_SET] + error_check_bad cursor_get:DB_SET [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_SET:key $k $key_set(1) + error_check_good curs_get:DB_SET:data $d datum$key_set(1) + + # Delete 2 + error_check_good db_del:$key_set(2) [$db del $txn $key_set(2) 0] 0 + + # Now do next on cursor + set r [$curs get 0 $DB_NEXT] + error_check_bad cursor_get:DB_NEXT [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_NEXT:key $k $key_set(3) + error_check_good curs_get:DB_NEXT:data $d datum$key_set(3) + + # Close cursor + error_check_good curs_close [$curs close] 0 + error_check_good db_close [$db close] 0 + + # Now get ready for duplicate tests + + + puts "\tBug001.b: Duplicate Tests" + set db [eval [concat dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method \ + -flags $DB_DUP $args]] + error_check_good db_open:dup [is_substr $db db] 1 + + set curs [$db cursor $txn] + error_check_good curs_open:dup [is_substr $curs $db] 1 + + # Put three keys in the database + for { set key 1 } { $key <= 3 } {incr key} { + set r [$db put $txn $key datum$key $flags] + error_check_good put $r 0 + } + + # Retrieve keys sequentially so we can figure out their order + set i 1 + for {set d [$curs get 0 $DB_FIRST] } { [string length $d] != 0 } { + set d [$curs get 0 $DB_NEXT] } { + set key_set($i) [lindex $d 0] + incr i + } + + # Now put in a bunch of duplicates for key 2 + for { set d 1 } { $d <= 5 } {incr d} { + set r [$db put $txn $key_set(2) dup_$d $flags] + error_check_good dup:put $r 0 + } + + # TEST CASE 5 + puts "\tBug001.b1: Delete dup w/cursor on first item. Get on key." + + # Now set the cursor on the first of the duplicate set. + set r [$curs get $key_set(2) $DB_SET] + error_check_bad cursor_get:DB_SET [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_SET:key $k $key_set(2) + error_check_good curs_get:DB_SET:data $d datum$key_set(2) + + # Now do the delete + set r [$curs del 0] + error_check_good curs_del $r 0 + + # Now do the get + set r [$db get $txn $key_set(2) 0] + error_check_good get_after_del $r dup_1 + + # TEST CASE 6 + puts "\tBug001.b2: Now get the next duplicate from the cursor." + + # Now do next on cursor + set r [$curs get 0 $DB_NEXT] + error_check_bad cursor_get:DB_NEXT [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_NEXT:key $k $key_set(2) + error_check_good curs_get:DB_NEXT:data $d dup_1 + + # TEST CASE 3 + puts "\tBug001.b3: Two cursors in set; each delete different items" + + # Open a new cursor. + set curs2 [$db cursor $txn] + error_check_good curs_open [is_substr $curs2 $db] 1 + + # Set on last of duplicate set. + set r [$curs2 get $key_set(3) $DB_SET] + error_check_bad cursor_get:DB_SET [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_SET:key $k $key_set(3) + error_check_good curs_get:DB_SET:data $d datum$key_set(3) + + set r [$curs2 get 0 $DB_PREV] + error_check_bad cursor_get:DB_PREV [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_PREV:key $k $key_set(2) + error_check_good curs_get:DB_PREV:data $d dup_5 + + # Delete the item at cursor 1 (dup_1) + error_check_good curs1_del [$curs del 0] 0 + + # Verify curs1 and curs2 + set r [$curs get 0 $DB_CURRENT] + error_check_good curs1_get_after_del [llength $r] 0 + + set r [$curs2 get 0 $DB_CURRENT] + error_check_bad curs2_get [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_CURRENT:key $k $key_set(2) + error_check_good curs_get:DB_CURRENT:data $d dup_5 + + # Now delete the item at cursor 2 (dup_5) + error_check_good curs2_del [$curs2 del 0] 0 + + # Verify curs1 and curs2 + set r [$curs get 0 $DB_CURRENT] + error_check_good curs1_get_after_del2 [llength $r] 0 + set r [$curs2 get 0 $DB_CURRENT] + error_check_good curs2_get_after_del2 [llength $r] 0 + + # Now verify that next and prev work. + + set r [$curs2 get 0 $DB_PREV] + error_check_bad cursor_get:DB_PREV [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_PREV:key $k $key_set(2) + error_check_good curs_get:DB_PREV:data $d dup_4 + + set r [$curs get 0 $DB_NEXT] + error_check_bad cursor_get:DB_NEXT [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_NEXT:key $k $key_set(2) + error_check_good curs_get:DB_NEXT:data $d dup_2 + + puts "\tBug001.b4: Two cursors same item, one delete, one get" + + # Move curs2 onto dup_2 + set r [$curs2 get 0 $DB_PREV] + error_check_bad cursor_get:DB_PREV [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_PREV:key $k $key_set(2) + error_check_good curs_get:DB_PREV:data $d dup_3 + + set r [$curs2 get 0 $DB_PREV] + error_check_bad cursor_get:DB_PREV [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_PREV:key $k $key_set(2) + error_check_good curs_get:DB_PREV:data $d dup_2 + + # delete on curs 1 + error_check_good curs1_del [$curs del 0] 0 + + # Verify gets on both 1 and 2 + set r [$curs get 0 $DB_CURRENT] + error_check_good curs1_get_after_del [llength $r] 0 + set r [$curs2 get 0 $DB_CURRENT] + error_check_good curs2_get_after_del [llength $r] 0 + + puts "\tBug001.b5: Now do a next on both cursors" + + set r [$curs get 0 $DB_NEXT] + error_check_bad cursor_get:DB_NEXT [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_NEXT:key $k $key_set(2) + error_check_good curs_get:DB_NEXT:data $d dup_3 + + set r [$curs2 get 0 $DB_NEXT] + error_check_bad cursor_get:DB_NEXT [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_NEXT:key $k $key_set(2) + error_check_good curs_get:DB_NEXT:data $d dup_3 + + # Close cursor + error_check_good curs_close [$curs close] 0 + error_check_good curs2_close [$curs2 close] 0 + error_check_good db_close [$db close] 0 +} diff --git a/mozilla/db/test/bug002.tcl b/mozilla/db/test/bug002.tcl new file mode 100644 index 00000000000..e19347a9ca2 --- /dev/null +++ b/mozilla/db/test/bug002.tcl @@ -0,0 +1,101 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)bug002.tcl 10.2 (Sleepycat) 4/10/98 +# +# Bug Test002: +# This test checks basic cursor operations. +# There are N different scenarios to tests: +# 1. (no dups) Set cursor, retrieve current. +# 2. (no dups) Set cursor, retrieve next. +# 3. (no dups) Set cursor, retrieve prev. +proc bug002 { method args } { + set method [convert_method $method] + puts "Bug002: $method interspersed cursor and normal operations" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile bug002.db + cleanup $testdir + + set flags 0 + set txn 0 + + puts "\tBug002.a: No duplicates" + set db [eval [concat dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method $args]] + error_check_good db_open:nodup [is_substr $db db] 1 + + set curs [$db cursor $txn] + error_check_good curs_open:nodup [is_substr $curs $db] 1 + + # Put three keys in the database + for { set key 1 } { $key <= 3 } {incr key} { + set r [$db put $txn $key datum$key $flags] + error_check_good put $r 0 + } + + # Retrieve keys sequentially so we can figure out their order + set i 1 + for {set d [$curs get 0 $DB_FIRST] } { [string length $d] != 0 } { + set d [$curs get 0 $DB_NEXT] } { + set key_set($i) [lindex $d 0] + incr i + } + + # TEST CASE 1 + puts "\tBug002.a1: Set cursor, retrieve current" + + # Now set the cursor on the middle on. + set r [$curs get $key_set(2) $DB_SET] + error_check_bad cursor_get:DB_SET [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_SET:key $k $key_set(2) + error_check_good curs_get:DB_SET:data $d datum$key_set(2) + + # Now retrieve current + set r [$curs get 0 $DB_CURRENT] + error_check_bad cursor_get:DB_CURRENT [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_CURRENT:key $k $key_set(2) + error_check_good curs_get:DB_CURRENT:data $d datum$key_set(2) + + # TEST CASE 2 + puts "\tBug002.a2: Set cursor, retrieve previous" + set r [$curs get 0 $DB_PREV] + error_check_bad cursor_get:DB_PREV [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_PREV:key $k $key_set(1) + error_check_good curs_get:DB_PREV:data $d datum$key_set(1) + + #TEST CASE 3 + puts "\tBug002.a2: Set cursor, retrieve next" + + # Now set the cursor on the middle on. + set r [$curs get $key_set(2) $DB_SET] + error_check_bad cursor_get:DB_SET [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_SET:key $k $key_set(2) + error_check_good curs_get:DB_SET:data $d datum$key_set(2) + + # Now retrieve next + set r [$curs get 0 $DB_NEXT] + error_check_bad cursor_get:DB_NEXT [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_NEXT:key $k $key_set(3) + error_check_good curs_get:DB_NEXT:data $d datum$key_set(3) + + # Close cursor and database. + error_check_good curs_close [$curs close] 0 + error_check_good db_close [$db close] 0 +} diff --git a/mozilla/db/test/bug003.tcl b/mozilla/db/test/bug003.tcl new file mode 100644 index 00000000000..442704f5a36 --- /dev/null +++ b/mozilla/db/test/bug003.tcl @@ -0,0 +1,133 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)bug003.tcl 10.3 (Sleepycat) 4/10/98 +# +# Bug Test003: +# Check if deleting a key when a cursor is on a duplicate of that key works. +proc bug003 { method args } { + set method [convert_method $method] + if { $method == "DB_RECNO" } { + puts "Bug003 skipping for method RECNO" + return + } + puts "Bug003: $method delete of key in presence of cursor" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile bug003.db + cleanup $testdir + + set flags 0 + set txn 0 + + set db [eval [concat dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method \ + -flags $DB_DUP $args]] + error_check_good db_open:dup [is_substr $db db] 1 + + set curs [$db cursor $txn] + error_check_good curs_open:dup [is_substr $curs $db] 1 + + puts "\tBug003.a: Key delete with cursor on duplicate." + # Put three keys in the database + for { set key 1 } { $key <= 3 } {incr key} { + set r [$db put $txn $key datum$key $flags] + error_check_good put $r 0 + } + + # Retrieve keys sequentially so we can figure out their order + set i 1 + for {set d [$curs get 0 $DB_FIRST] } { [string length $d] != 0 } { + set d [$curs get 0 $DB_NEXT] } { + set key_set($i) [lindex $d 0] + incr i + } + + # Now put in a bunch of duplicates for key 2 + for { set d 1 } { $d <= 5 } {incr d} { + set r [$db put $txn $key_set(2) dup_$d $flags] + error_check_good dup:put $r 0 + } + + # Now put the cursor on a duplicate of key 2 + + # Now set the cursor on the first of the duplicate set. + set r [$curs get $key_set(2) $DB_SET] + error_check_bad cursor_get:DB_SET [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_SET:key $k $key_set(2) + error_check_good curs_get:DB_SET:data $d datum$key_set(2) + + # Now do two nexts + set r [$curs get 0 $DB_NEXT] + error_check_bad cursor_get:DB_NEXT [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_NEXT:key $k $key_set(2) + error_check_good curs_get:DB_NEXT:data $d dup_1 + + set r [$curs get 0 $DB_NEXT] + error_check_bad cursor_get:DB_NEXT [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_NEXT:key $k $key_set(2) + error_check_good curs_get:DB_NEXT:data $d dup_2 + + # Now do the delete + set r [$db del $txn $key_set(2) 0] + error_check_good delete $r 0 + + # Now check the get current on the cursor. + set r [$curs get 0 $DB_CURRENT] + error_check_good curs_after_del [llength $r] 0 + + # Now check that the rest of the database looks intact. There + # should be only two keys, 1 and 3. + + set r [$curs get 0 $DB_FIRST] + error_check_bad cursor_get:DB_FIRST [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_FIRST:key $k $key_set(1) + error_check_good curs_get:DB_FIRST:data $d datum$key_set(1) + + set r [$curs get 0 $DB_NEXT] + error_check_bad cursor_get:DB_NEXT [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_NEXT:key $k $key_set(3) + error_check_good curs_get:DB_NEXT:data $d datum$key_set(3) + + set r [$curs get 0 $DB_NEXT] + error_check_good cursor_get:DB_NEXT [llength $r] 0 + + puts "\tBug003.b: Cursor delete of first item, followed by cursor FIRST" + # Set to beginning + set r [$curs get 0 $DB_FIRST] + error_check_bad cursor_get:DB_FIRST [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_FIRST:key $k $key_set(1) + error_check_good curs_get:DB_FIRST:data $d datum$key_set(1) + + # Now do delete + error_check_good curs_del [$curs del 0] 0 + + # Now do DB_FIRST + set r [$curs get 0 $DB_FIRST] + error_check_bad cursor_get:DB_FIRST [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_FIRST:key $k $key_set(3) + error_check_good curs_get:DB_FIRST:data $d datum$key_set(3) + + error_check_good curs_close [$curs close] 0 + error_check_good db_close [$db close] 0 +} diff --git a/mozilla/db/test/bug004.tcl b/mozilla/db/test/bug004.tcl new file mode 100644 index 00000000000..8fded5148ed --- /dev/null +++ b/mozilla/db/test/bug004.tcl @@ -0,0 +1,191 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)bug004.tcl 10.4 (Sleepycat) 4/10/98 +# +# Bug Test004: +# Check if we handle the case where we delete a key with the cursor on it +# and then add the same key. The cursor should not get the new item +# returned, but the item shouldn't disappear. +# Run test tests, one where the overwriting put is done with a put and +# one where it's done with a cursor put. +proc bug004 { method args } { + set method [convert_method $method] + if { $method == "DB_RECNO" } { + puts "Bug004 skipping for method RECNO" + return + } + puts "Bug004: $method delete and replace in presence of cursor." + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile bug004.db + cleanup $testdir + + set flags 0 + set txn 0 + + set db [eval [concat dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method \ + -flags $DB_DUP $args]] + error_check_good db_open:dup [is_substr $db db] 1 + + set curs [$db cursor $txn] + error_check_good curs_open:dup [is_substr $curs $db] 1 + + puts "\tBug004.a: Set cursor, delete cursor, put with key." + # Put three keys in the database + for { set key 1 } { $key <= 3 } {incr key} { + set r [$db put $txn $key datum$key $flags] + error_check_good put $r 0 + } + + # Retrieve keys sequentially so we can figure out their order + set i 1 + for {set d [$curs get 0 $DB_FIRST] } { [string length $d] != 0 } { + set d [$curs get 0 $DB_NEXT] } { + set key_set($i) [lindex $d 0] + incr i + } + + # Now put in a bunch of duplicates for key 2 + for { set d 1 } { $d <= 5 } {incr d} { + set r [$db put $txn $key_set(2) dup_$d $flags] + error_check_good dup:put $r 0 + } + + # Now put the cursor on key 1 + + # Now set the cursor on the first of the duplicate set. + set r [$curs get $key_set(1) $DB_SET] + error_check_bad cursor_get:DB_SET [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_SET:key $k $key_set(1) + error_check_good curs_get:DB_SET:data $d datum$key_set(1) + + # Now do the delete + set r [$curs del 0] + error_check_good delete $r 0 + + # Now check the get current on the cursor. + set r [$curs get 0 $DB_CURRENT] + error_check_good curs_after_del [llength $r] 0 + + # Now do a put on the key + set r [$db put $txn $key_set(1) new_datum$key_set(1) $flags] + error_check_good put $r 0 + + # Do a get + set r [$db get $txn $key_set(1) 0] + error_check_good get $r new_datum$key_set(1) + + # Recheck cursor + set r [$curs get 0 $DB_CURRENT] + error_check_good curs_after_del [llength $r] 0 + + # Move cursor and see if we get the key. + set r [$curs get 0 $DB_FIRST] + error_check_bad cursor_get:DB_FIRST [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_FIRST:key $k $key_set(1) + error_check_good curs_get:DB_FIRST:data $d new_datum$key_set(1) + + puts "\tBug004.b: Set two cursor on a key, delete one, overwrite other" + set curs2 [$db cursor $txn] + error_check_good curs2_open [is_substr $curs2 $db] 1 + + # Set both cursors on the 4rd key + set r [$curs get $key_set(3) $DB_SET] + error_check_bad cursor_get:DB_SET [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_SET:key $k $key_set(3) + error_check_good curs_get:DB_SET:data $d datum$key_set(3) + + set r [$curs2 get $key_set(3) $DB_SET] + error_check_bad cursor2_get:DB_SET [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs2_get:DB_SET:key $k $key_set(3) + error_check_good curs2_get:DB_SET:data $d datum$key_set(3) + + # Now delete through cursor 1 + error_check_good curs1_del [$curs del 0] 0 + + # Verify gets on both 1 and 2 + set r [$curs get 0 $DB_CURRENT] + error_check_good curs1_get_after_del [llength $r] 0 + set r [$curs2 get 0 $DB_CURRENT] + error_check_good curs2_get_after_del [llength $r] 0 + + # Now do a replace through cursor 2 + set r [$curs2 put 0 new_datum$key_set(3) $DB_CURRENT] + error_check_bad curs_replace $r 0 + + # Gets fail + set r [$curs get 0 $DB_CURRENT] + error_check_good curs1_get_after_replace [llength $r] 0 + set r [$curs2 get 0 $DB_CURRENT] + error_check_good curs2_get_after_replace [llength $r] 0 + + puts "\tBug004.c: Set two cursors on a dup, delete one, overwrite other" + + # Set both cursors on the 2nd duplicate of key 2 + set r [$curs get $key_set(2) $DB_SET] + error_check_bad cursor_get:DB_SET [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_SET:key $k $key_set(2) + error_check_good curs_get:DB_SET:data $d datum$key_set(2) + + set r [$curs get 0 $DB_NEXT] + error_check_bad cursor_get:DB_NEXT [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs_get:DB_NEXT:key $k $key_set(2) + error_check_good curs_get:DB_NEXT:data $d dup_1 + + set r [$curs2 get $key_set(2) $DB_SET] + error_check_bad cursor2_get:DB_SET [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs2_get:DB_SET:key $k $key_set(2) + error_check_good curs2_get:DB_SET:data $d datum$key_set(2) + + set r [$curs2 get 0 $DB_NEXT] + error_check_bad cursor2_get:DB_NEXT [llength $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + error_check_good curs2_get:DB_NEXT:key $k $key_set(2) + error_check_good curs2_get:DB_NEXT:data $d dup_1 + + # Now delete through cursor 1 + error_check_good curs1_del [$curs del 0] 0 + + # Verify gets on both 1 and 2 + set r [$curs get 0 $DB_CURRENT] + error_check_good curs1_get_after_del [llength $r] 0 + set r [$curs2 get 0 $DB_CURRENT] + error_check_good curs2_get_after_del [llength $r] 0 + + # Now do a replace through cursor 2 + set r [$curs2 put 0 new_dup_1 $DB_CURRENT] + error_check_bad curs_replace $r 0 + + # Both gets should fail + set r [$curs get 0 $DB_CURRENT] + error_check_good curs1_get_after_replace [llength $r] 0 + set r [$curs2 get 0 $DB_CURRENT] + error_check_good curs2_get_after_replace [llength $r] 0 + + error_check_good curs2_close [$curs2 close] 0 + error_check_good curs_close [$curs close] 0 + error_check_good db_close [$db close] 0 +} diff --git a/mozilla/db/test/bug005.tcl b/mozilla/db/test/bug005.tcl new file mode 100644 index 00000000000..23f7816355c --- /dev/null +++ b/mozilla/db/test/bug005.tcl @@ -0,0 +1,74 @@ +proc bug005 { method } { + source ./include.tcl + set method [convert_method $method] + set flags [expr $DB_CREATE | $DB_INIT_LOCK | \ + $DB_INIT_LOG | $DB_INIT_MPOOL | $DB_INIT_TXN] + set env [dbenv -dbhome $testdir -dbflags $flags] + error_check_good env [is_substr $env env] 1 + + set db [dbopen foo.db \ + [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method -flags $DB_DUP \ + -dbenv $env] + error_check_good dbopen [is_substr $db db] 1 + + set tmgr [txn "" 0 0 -dbenv $env] + error_check_good txnopen [is_substr $tmgr mgr] 1 + + set t [$tmgr begin] + error_check_good txn_begin [is_substr $t $tmgr] 1 + + puts "Bug005.a: Adding 10 duplicates" + # Add a bunch of dups + for { set i 0 } { $i < 10 } {incr i} { + set ret [$db put $t doghouse $i"DUPLICATE_DATA_VALUE" 0] + error_check_good db_put $ret 0 + } + + puts "Bug005.b: Adding key after duplicates" + # Now add one more key/data AFTER the dup set. + set ret [$db put $t zebrahouse NOT_A_DUP 0] + error_check_good db_put $ret 0 + + error_check_good txn_commit [$t commit] 0 + + set t [$tmgr begin] + error_check_good txn_begin [is_substr $t $tmgr] 1 + + # Now delete everything + puts "Bug005.c: Deleting duplicated key" + set ret [$db del $t doghouse 0] + error_check_good del $ret 0 + + # Now reput everything + set pad \ + abcdefghijklmnopqrtsuvabcdefghijklmnopqrtsuvabcdefghijklmnopqrtsuvabcdefghijklmnopqrtsuvabcdefghijklmnopqrtsuvabcdefghijklmnopqrtsuvabcdefghijklmnopqrtsuvabcdefghijklmnopqrtsuvabcdefghijklmnopqrtsuvabcdefghijklmnopqrtsuv + + puts "Bug005.d: Reputting duplicates with big data vals" + for { set i 0 } { $i < 10 } {incr i} { + set ret [$db put $t doghouse $i"DUPLICATE_DATA_VALUE"$pad 0] + error_check_good db_put $ret 0 + } + error_check_good txn_commit [$t commit] 0 + + # Check duplicates for order + set t [$tmgr begin] + error_check_good txn_begin [is_substr $t $tmgr] 1 + set dbc [$db cursor $t] + error_check_good dbcursor [is_substr $dbc $db] 1 + + + puts "Bug005.e: Verifying that duplicates are in order." + set i 0 + for { set ret [$dbc get doghouse $DB_SET] } {$i < 10 && \ + [llength $ret] != 0} { set ret [$dbc get 0 $DB_NEXT] } { + set data [lindex $ret 1] + error_check_good duplicate_value $data \ + $i"DUPLICATE_DATA_VALUE"$pad + incr i + } + + $db close + $tmgr close + rename $env "" + exec $RM $testdir/foo.db +} diff --git a/mozilla/db/test/bug006.tcl b/mozilla/db/test/bug006.tcl new file mode 100644 index 00000000000..b0a2ae6901b --- /dev/null +++ b/mozilla/db/test/bug006.tcl @@ -0,0 +1,28 @@ +# Make sure that if we do PREVs on a log, but the beginning of the +# log has been truncated, we do the right thing. +proc bug006 { } { +source ./include.tcl + puts "Bug006: Prev on log when beginning of log has been truncated." + # Use archive test to populate log + cleanup $testdir + archive + + # Delete all log files under 50 + set ret [catch { glob $testdir/log.000* } result] + if { $ret == 0 } { + eval exec $RM -rf $result + } + + # Now open the log and get the first record and try a prev + set lp [log "" 0 0] + error_check_good log_open [is_substr $lp log] 1 + + set ret [$lp get "0 0" $DB_FIRST] + error_check_bad log_get [string length $ret] 0 + + # This should give DB_NOTFOUND which is a ret of length 0 + set ret [$lp get "0 0" $DB_PREV] + error_check_good log_get_prev [string length $ret] 0 + + error_check_good log_close [$lp close] 0 +} diff --git a/mozilla/db/test/bug007.tcl b/mozilla/db/test/bug007.tcl new file mode 100644 index 00000000000..aac5a18b87c --- /dev/null +++ b/mozilla/db/test/bug007.tcl @@ -0,0 +1,111 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)bug007.tcl 8.2 (Sleepycat) 4/10/98 +# +# Bug Test001: +# Make sure that we handle retrieves of zero-length data items correctly. +# The following ops, should allow a partial data retrieve of 0-length. +# db_get +# db_cget FIRST, NEXT, LAST, PREV, CURRENT, SET, SET_RANGE +proc bug007 { method args } { + set method [convert_method $method] + puts "Bug007: $method 0-length partial data retrieval" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile bug007.db + cleanup $testdir + + set flags 0 + set txn 0 + + puts "\tBug007.a: Populate a database" + set db [eval [concat dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method $args]] + error_check_good db_create [is_substr $db db] 1 + + # Put ten keys in the database + for { set key 1 } { $key <= 10 } {incr key} { + set r [$db put $txn $key datum$key $flags] + error_check_good put $r 0 + } + + # Retrieve keys sequentially so we can figure out their order + set i 1 + set curs [$db cursor 0] + error_check_good db_curs [is_substr $curs $db] 1 + for {set d [$curs get 0 $DB_FIRST] } { [string length $d] != 0 } { + set d [$curs get 0 $DB_NEXT] } { + set key_set($i) [lindex $d 0] + incr i + } + + puts "\tBug007.a: db get with 0 partial length retrieve" + + # Now set the cursor on the middle on. + set ret [$db get 0 $key_set(5) $DB_DBT_PARTIAL 0 0] + error_check_good db_get_0 [string length $ret] 0 + + puts "\tBug007.a: db cget FIRST with 0 partial length retrieve" + set ret [$curs get 0 [expr $DB_FIRST|$DB_DBT_PARTIAL] 0 0] + set data [lindex $ret 1] + set key [lindex $ret 0] + error_check_good key_check_first $key $key_set(1) + error_check_good db_cget_first [string length $data] 0 + + puts "\tBug007.b: db cget NEXT with 0 partial length retrieve" + set ret [$curs get 0 [expr $DB_NEXT|$DB_DBT_PARTIAL] 0 0] + set data [lindex $ret 1] + set key [lindex $ret 0] + error_check_good key_check_next $key $key_set(2) + error_check_good db_cget_next [string length $data] 0 + + puts "\tBug007.c: db cget LAST with 0 partial length retrieve" + set ret [$curs get 0 [expr $DB_LAST|$DB_DBT_PARTIAL] 0 0] + set data [lindex $ret 1] + set key [lindex $ret 0] + error_check_good key_check_last $key $key_set(10) + error_check_good db_cget_last [string length $data] 0 + + puts "\tBug007.d: db cget PREV with 0 partial length retrieve" + set ret [$curs get 0 [expr $DB_PREV|$DB_DBT_PARTIAL] 0 0] + set data [lindex $ret 1] + set key [lindex $ret 0] + error_check_good key_check_prev $key $key_set(9) + error_check_good db_cget_prev [string length $data] 0 + + puts "\tBug007.e: db cget CURRENT with 0 partial length retrieve" + set ret [$curs get 0 [expr $DB_CURRENT|$DB_DBT_PARTIAL] 0 0] + set data [lindex $ret 1] + set key [lindex $ret 0] + error_check_good key_check_current $key $key_set(9) + error_check_good db_cget_current [string length $data] 0 + + puts "\tBug007.f: db cget SET with 0 partial length retrieve" + set ret [$curs get $key_set(7) [expr $DB_SET|$DB_DBT_PARTIAL] 0 0] + set data [lindex $ret 1] + set key [lindex $ret 0] + error_check_good key_check_set $key $key_set(7) + error_check_good db_cget_set [string length $data] 0 + + if {$method == "DB_BTREE"} { + puts "\tBug007.g: db cget SET_RANGE with 0 partial length \ + retrieve" + set ret [$curs get $key_set(5) \ + [expr $DB_SET_RANGE|$DB_DBT_PARTIAL] 0 0] + set data [lindex $ret 1] + set key [lindex $ret 0] + error_check_good key_check_set $key $key_set(5) + error_check_good db_cget_set [string length $data] 0 + } + + error_check_good curs_close [$curs close] 0 + error_check_good db_close [$db close] 0 + +} diff --git a/mozilla/db/test/byteorder.tcl b/mozilla/db/test/byteorder.tcl new file mode 100644 index 00000000000..28ac5f0f3fd --- /dev/null +++ b/mozilla/db/test/byteorder.tcl @@ -0,0 +1,25 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)byteorder.tcl 8.4 (Sleepycat) 4/10/98 +# +# Byte Order Test +# Use existing tests and run with both byte orders. +proc byteorder { method {nentries 1000} } { + set opts [convert_args $method ""] + set method [convert_method $method] + puts "Byteorder: $method $nentries" + + test001 $method $nentries -order 1234 $opts + test001 $method $nentries -order 4321 $opts + test003 $method -order 1234 $opts + test003 $method -order 4321 $opts + test010 $method $nentries 5 10 -order 1234 $opts + test010 $method $nentries 5 10 -order 4321 $opts + test011 $method $nentries 5 11 -order 1234 $opts + test011 $method $nentries 5 11 -order 4321 $opts + test018 $method $nentries -order 1234 $opts + test018 $method $nentries -order 4321 $opts +} diff --git a/mozilla/db/test/dbm.tcl b/mozilla/db/test/dbm.tcl new file mode 100644 index 00000000000..9e41c727034 --- /dev/null +++ b/mozilla/db/test/dbm.tcl @@ -0,0 +1,104 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)dbm.tcl 10.2 (Sleepycat) 4/10/98 +# +# Historic DBM interface test. +# Use the first 1000 entries from the dictionary. +# Insert each with self as key and data; retrieve each. +# After all are entered, retrieve all; compare output to original. +# Then reopen the file, re-retrieve everything. +# Finally, delete everything. +proc dbm { { nentries 1000 } } { + puts "DBM interfaces test: $nentries" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile $testdir/dbmtest + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + cleanup $testdir + + error_check_good dbminit [dbminit $testfile] 0 + set did [open $dict] + + set flags 0 + set txn 0 + set count 0 + + puts "\tDBM.a: put/get loop" + # Here is the loop where we put and get each key/data pair + while { [gets $did str] != -1 && $count < $nentries } { + set ret [store $str $str] + error_check_good dbm_store $ret 0 + + set d [fetch $str] + error_check_good dbm_fetch $d $str + incr count + } + close $did + + # Now we will get each key from the DB and compare the results + # to the original. + puts "\tDBM.b: dump file" + set oid [open $t1 w] + for { set key [firstkey] } { $key != -1 } { set key [nextkey $key] } { + puts $oid $key + set d [fetch $key] + error_check_good dbm_refetch $d $key + } + close $oid + + # Now compare the keys to see if they match the dictionary (or ints) + set q q + exec $SED $nentries$q $dict > $t2 + exec $SORT $t1 > $t3 + + error_check_good DBM:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + + puts "\tDBM.c: close, open, and dump file" + + # Now, reopen the file and run the last test again. + error_check_good dbminit2 [dbminit $testfile] 0 + set oid [open $t1 w] + + for { set key [firstkey] } { $key != -1 } { set key [nextkey $key] } { + puts $oid $key + set d [fetch $key] + error_check_good dbm_refetch $d $key + } + close $oid + + # Now compare the keys to see if they match the dictionary (or ints) + exec $SORT $t1 > $t3 + + error_check_good DBM:diff($t2,$t3) \ + [catch { exec $DIFF $t2 $t3 } res] 0 + + # Now, reopen the file and delete each entry + puts "\tDBM.d: sequential scan and delete" + + error_check_good dbminit3 [dbminit $testfile] 0 + set oid [open $t1 w] + + for { set key [firstkey] } { $key != -1 } { set key [nextkey $key] } { + puts $oid $key + set ret [delete $key] + error_check_good dbm_delete $ret 0 + } + close $oid + + # Now compare the keys to see if they match the dictionary (or ints) + exec $SORT $t1 > $t3 + + error_check_good DBM:diff($t2,$t3) \ + [catch { exec $DIFF $t2 $t3 } res] 0 + +} diff --git a/mozilla/db/test/dbscript.tcl b/mozilla/db/test/dbscript.tcl new file mode 100644 index 00000000000..b33f4b22b1a --- /dev/null +++ b/mozilla/db/test/dbscript.tcl @@ -0,0 +1,275 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)dbscript.tcl 8.12 (Sleepycat) 4/10/98 +# +# Random db tester. +# Usage: dbscript file numops min_del max_add key_avg data_avgdups +# file: db file on which to operate +# numops: number of operations to do +# ncurs: number of cursors +# min_del: minimum number of keys before you disable deletes. +# max_add: maximum number of keys before you disable adds. +# key_avg: average key size +# data_avg: average data size +# dups: 1 indicates dups allowed, 0 indicates no dups +# errpct: What percent of operations should generate errors +# seed: Random number generator seed (-1 means use pid) +source ./include.tcl +source ../test/testutils.tcl +set alphabet "abcdefghijklmnopqrstuvwxyz" + +set usage "dbscript file numops ncurs min_del max_add key_avg data_avg dups errpcnt seed" + +# Verify usage +if { $argc != 10 } { + puts stderr $usage + exit +} + +# Initialize arguments +set file [lindex $argv 0] +set numops [ lindex $argv 1 ] +set ncurs [ lindex $argv 2 ] +set min_del [ lindex $argv 3 ] +set max_add [ lindex $argv 4 ] +set key_avg [ lindex $argv 5 ] +set data_avg [ lindex $argv 6 ] +set dups [ lindex $argv 7 ] +set errpct [ lindex $argv 8 ] +set seed [ lindex $argv 9 ] + +# Initialize seed +if { $seed == -1 } { + set seed [pid] +} +srand $seed + +puts "Beginning execution for [pid]" +puts "$file database" +puts "$numops Operations" +puts "$ncurs cursors" +puts "$min_del keys before deletes allowed" +puts "$max_add or fewer keys to add" +puts "$key_avg average key length" +puts "$data_avg average data length" +if { $dups != 1 } { + puts "No dups" +} else { + puts "Dups allowed" +} +puts "$errpct % Errors" +puts "$seed seed" + +flush stdout + +set db [record dbopen $file 0 0 DB_UNKNOWN] +error_check_bad dbopen $db NULL +error_check_good dbopen [is_substr $db db] 1 + +# Initialize globals including data +set nkeys [db_init $db 1] +puts "Initial number of keys: $nkeys" + +set txn 0 + +# Open the cursors +set curslist {} +for { set i 0 } { $i < $ncurs } { incr i } { + set dbc [record $db cursor] + error_check_bad cursor_create $dbc NULL + lappend curslist $dbc + +} + +# On each iteration we're going to generate random keys and +# data. We'll select either a get/put/delete operation unless +# we have fewer than min_del keys in which case, delete is not +# an option or more than max_add in which case, add is not +# an option. The tcl global arrays a_keys and l_keys keep track +# of key-data pairs indexed by key and a list of keys, accessed +# by integer. +set adds 0 +set puts 0 +set gets 0 +set dels 0 +set bad_adds 0 +set bad_puts 0 +set bad_gets 0 +set bad_dels 0 +for { set iter 0 } { $iter < $numops } { incr iter } { + set op [pick_op $min_del $max_add $nkeys] + set err [is_err $errpct] + + # The op0's indicate that there aren't any duplicates, so we + # exercise regular operations. If dups is 1, then we'll use + # cursor ops. + switch $op$dups$err { + add00 { + incr adds + set k [random_data $key_avg 1 a_keys ] + set data [random_data $data_avg 0 0] + set ret [record $db put $txn $k $data $DB_NOOVERWRITE ] + newpair $k $data + } + add01 { + incr bad_adds + set k [random_key] + set data [random_data $data_avg 0 0] + set ret [record $db put $txn $k $data $DB_NOOVERWRITE ] + # Error case so no change to data state + } + add10 { + incr adds + set dbcinfo [random_cursor $curslist] + set dbc [lindex $dbcinfo 0] + if { [random_int 1 2] == 1 } { + # Add a new key + set k [random_data $key_avg 1 a_keys ] + set data [random_data $data_avg 0 0] + set ret [record $dbc put $txn $k $data \ + $DB_KEYFIRST ] + newpair $k $data + } else { + # Add a new duplicate + set dbc [lindex $dbcinfo 0] + set k [lindex $dbcinfo 1] + set data [random_data $data_avg 0 0] + + set op [pick_cursput] + set ret [record $dbc put $txn $k $data $op] + adddup $k [lindex $dbcinfo 2] $data + } + } + add11 { + # TODO + incr bad_adds + set ret 1 + } + put00 { + incr puts + set k [random_key] + set data [random_data $data_avg 0 0] + set ret [record $db put $txn $k $data 0] + changepair $k $data + } + put01 { + incr bad_puts + set k [random_key] + set data [random_data $data_avg 0 0] + set ret [record $db put $txn $k $data $DB_NOOVERWRITE] + # Error case so no change to data state + } + put10 { + incr puts + set dbcinfo [random_cursor $curslist] + set dbc [lindex $dbcinfo 0] + set k [lindex $dbcinfo 1] + set data [random_data $data_avg 0 0] + + set ret [record $dbc put $txn $k $data $DB_CURRENT] + changedup $k [lindex $dbcinfo 2] $data + } + put11 { + incr bad_puts + set k [random_key] + set data [random_data $data_avg 0 0] + set dbc [record $db cursor] + set ret [record $dbc put $txn $k $data $DB_CURRENT] + error_check_good curs_close [record $dbc close] 0 + # Error case so no change to data state + } + get00 { + incr gets + set k [random_key] + set val [record $db get $txn $k 0] + if { $val == $a_keys($k) } { + set ret 0 + } else { + set ret "Error got |$val| expected |$a_keys($k)|" + } + # Get command requires no state change + } + get01 { + incr bad_gets + set k [random_data $key_avg 1 a_keys ] + set ret [record $db get $txn $k 0] + # Error case so no change to data state + } + get10 { + incr gets + set dbcinfo [random_cursor $curslist] + if { [llength $dbcinfo] == 3 } { + set ret 0 + else + set ret 0 + } + # Get command requires no state change + } + get11 { + incr bad_gets + set k [random_key] + set dbc [record $db cursor] + if { [random_int 1 2] == 1 } { + set dir $DB_NEXT + } else { + set dir $DB_PREV + } + set ret [record $dbc get $txn $k $DB_NEXT] + error_check_good curs_close [record $dbc close] 0 + # Error and get case so no change to data state + } + del00 { + incr dels + set k [random_key] + set ret [record $db del $txn $k 0] + rempair $k + } + del01 { + incr bad_dels + set k [random_data $key_avg 1 a_keys ] + set ret [record $db del $txn $k 0] + # Error case so no change to data state + } + del10 { + incr dels + set dbcinfo [random_cursor $curslist] + set dbc [lindex $dbcinfo 0] + set ret [record $dbc del $txn 0] + remdup [lindex dbcinfo 1] [lindex dbcinfo 2] + } + del11 { + incr bad_dels + set c [record $db cursor] + set ret [record $c del $txn 0] + error_check_good curs_close [record $c close] 0 + # Error case so no change to data state + } + } + if { $err == 1 } { + # Verify failure. + error_check_good $op$dups$err:$k [is_substr Error $ret] 1 + } else { + # Verify success + error_check_good $op$dups$err:$k $ret 0 + } + + flush stdout +} + +# Close cursors and file +foreach i $curslist { + set r [record $i close] + error_check_good cursor_close:$i $r 0 +} +set r [record $db close] +error_check_good db_close:$db $r 0 + +puts "[timestamp] [pid] Complete" +puts "Successful ops: $adds adds $gets gets $puts puts $dels dels" +puts "Error ops: $bad_adds adds $bad_gets gets $bad_puts puts $bad_dels dels" +flush stdout + +filecheck $file $txn diff --git a/mozilla/db/test/dbtest.h b/mozilla/db/test/dbtest.h new file mode 100644 index 00000000000..04b79948276 --- /dev/null +++ b/mozilla/db/test/dbtest.h @@ -0,0 +1,47 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)dbtest.h 10.5 (Sleepycat) 4/10/98 + */ + +extern int debug_on, debug_print, debug_test; + +void debug_check __P((void)); +int process_am_options __P((Tcl_Interp *, int, char **, DB_INFO **)); +int process_env_options __P((Tcl_Interp *, int, char **, DB_ENV **)); + +#define DB_ENV_FLAGS \ +"\n\ +\t-cachesize \n\ +\t-config <{name val} pairs>\n\ +\t-conflicts \n\ +\t-detect \n\ +\t-dbenv \n\ +\t-dbflags \n\ +\t-dbhome \n\ +\t-flags \n\ +\t-maxlocks \n\ +\t-maxsize \n\ +\t-maxtxns \n\ +\t-nmodes \n\ +\t-shmem " + +#define DB_INFO_FLAGS \ +"\n\ +\t-cachesize \n\ +\t-compare \n\ +\t-ffactor \n\ +\t-flags \n\ +\t-hash \n\ +\t-minkey \n\ +\t-nelem \n\ +\t-order \n\ +\t-prefix \n\ +\t-psize \n\ +\t-recdelim \n\ +\t-reclen \n\ +\t-recpad \n\ +\t-recsrc " diff --git a/mozilla/db/test/ddscript.tcl b/mozilla/db/test/ddscript.tcl new file mode 100644 index 00000000000..aec1518b8ab --- /dev/null +++ b/mozilla/db/test/ddscript.tcl @@ -0,0 +1,37 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)ddscript.tcl 10.2 (Sleepycat) 4/10/98 +# +# Deadlock detector script tester. +# Usage: ddscript dir test lockerid objid numprocs +# dir: DBHOME directory +# test: Which test to run +# lockerid: Lock id for this locker +# objid: Object id to lock. +# numprocs: Total number of processes running +source ../test/testutils.tcl +source ./include.tcl + +set usage "ddscript dir test lockerid objid numprocs" + +# Verify usage +if { $argc != 5 } { + puts stderr $usage + exit +} + +# Initialize arguments +set dir [lindex $argv 0] +set tnum [ lindex $argv 1 ] +set lockerid [ lindex $argv 2 ] +set objid [ lindex $argv 3 ] +set numprocs [ lindex $argv 4 ] + +set lm [lock_open "" 0 0 -dbhome $dir] +error_check_bad lock_open $lm NULL +error_check_good lock_open [is_substr $lm lockmgr] 1 + +puts [eval $tnum $lm $lockerid $objid $numprocs] diff --git a/mozilla/db/test/dead001.tcl b/mozilla/db/test/dead001.tcl new file mode 100644 index 00000000000..3346d1a3baa --- /dev/null +++ b/mozilla/db/test/dead001.tcl @@ -0,0 +1,70 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)dead001.tcl 10.3 (Sleepycat) 4/10/98 +# +# Deadlock Test 1. +# We create various deadlock scenarios for different numbers of lockers +# and see if we can get the world cleaned up suitably. +proc dead001 { { procs "2 4 10" } {tests "ring clump" } } { + puts "Dead001: Deadlock detector tests" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + cleanup $testdir + + # Create the environment. + puts "\tDead001.a: creating environment" + set lm [lock_open "" $DB_CREATE 0644] + error_check_bad lock_open $lm NULL + error_check_good lock_open [is_substr $lm lockmgr] 1 + error_check_good lock_close [$lm close] 0 + + set dpid [exec ./db_deadlock -vw -h $testdir \ + >& $testdir/dd.out &] + + foreach t $tests { + set pidlist "" + foreach n $procs { + # Fire off the tests + puts "\tDead001: $n procs of test $t" + for { set i 0 } { $i < $n } { incr i } { +# puts "./dbtest ../test/ddscript.tcl $testdir \ +# $t $i $i $n >& $testdir/dead001.log.$i" + set p [ exec ./dbtest ../test/ddscript.tcl \ + $testdir $t $i $i $n >& \ + $testdir/dead001.log.$i &] + lappend pidlist $p + } + watch_procs $pidlist 5 + + # Now check output + set dead 0 + set clean 0 + set other 0 + for { set i 0 } { $i < $n } { incr i } { + set did [open $testdir/dead001.log.$i] + while { [gets $did val] != -1 } { + switch $val { + DEADLOCK { incr dead } + 1 { incr clean } + default { incr other } + } + } + close $did + } + dead_check $t $n $dead $clean $other + } + } + + exec $KILL $dpid + exec $RM -f $testdir/dd.out + # Remove log files + for { set i 0 } { $i < $n } { incr i } { + exec $RM -f $testdir/dead001.log.$i + } +} + diff --git a/mozilla/db/test/dead002.tcl b/mozilla/db/test/dead002.tcl new file mode 100644 index 00000000000..ed8cdfb3f88 --- /dev/null +++ b/mozilla/db/test/dead002.tcl @@ -0,0 +1,66 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)dead002.tcl 8.3 (Sleepycat) 4/10/98 +# +# Deadlock Test 2. +# Identical to Test 1 except that instead of running a standalone deadlock +# detector, we create the region with "detect on every wait" +proc dead002 { { procs "2 4 10" } {tests "ring clump" } } { + puts "Dead002: Deadlock detector tests" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + cleanup $testdir + + # Create the environment. + puts "\tDead002.a: creating environment" + set lm [lock_open "" $DB_CREATE 0644 -detect 1] + error_check_bad lock_open $lm NULL + error_check_good lock_open [is_substr $lm lockmgr] 1 + error_check_good lock_close [$lm close] 0 + + foreach t $tests { + set pidlist "" + foreach n $procs { + # Fire off the tests + puts "\tDead002: $n procs of test $t" + for { set i 0 } { $i < $n } { incr i } { +# puts "./dbtest ../test/ddscript.tcl $testdir \ +# $t $i $i $n >& $testdir/dead002.log.$i" + set p [ exec ./dbtest ../test/ddscript.tcl \ + $testdir $t $i $i $n >& \ + $testdir/dead002.log.$i &] + lappend pidlist $p + } + watch_procs $pidlist 5 + + # Now check output + set dead 0 + set clean 0 + set other 0 + for { set i 0 } { $i < $n } { incr i } { + set did [open $testdir/dead002.log.$i] + while { [gets $did val] != -1 } { + switch $val { + DEADLOCK { incr dead } + 1 { incr clean } + default { incr other } + } + } + close $did + } + dead_check $t $n $dead $clean $other + } + } + + exec $RM -f $testdir/dd.out + # Remove log files + for { set i 0 } { $i < $n } { incr i } { + exec $RM -f $testdir/dead002.log.$i + } +} + diff --git a/mozilla/db/test/hsearch.tcl b/mozilla/db/test/hsearch.tcl new file mode 100644 index 00000000000..c6b1f61c59f --- /dev/null +++ b/mozilla/db/test/hsearch.tcl @@ -0,0 +1,53 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)hsearch.tcl 10.2 (Sleepycat) 4/10/98 +# +# Historic Hsearch interface test. +# Use the first 1000 entries from the dictionary. +# Insert each with self as key and data; retrieve each. +# After all are entered, retrieve all; compare output to original. +# Then reopen the file, re-retrieve everything. +# Finally, delete everything. +proc htest { { nentries 1000 } } { + puts "HSEARCH interfaces test: $nentries" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + cleanup $testdir + + error_check_good hcreate [hcreate $nentries] 0 + set did [open $dict] + set count 0 + + puts "\tHSEARCH.a: put/get loop" + # Here is the loop where we put and get each key/data pair + while { [gets $did str] != -1 && $count < $nentries } { + set ret [hsearch $str $str enter] + error_check_good hsearch:enter $ret 0 + + set d [hsearch $str 0 find] + error_check_good hsearch:find $d $str + incr count + } + close $did + + puts "\tHSEARCH.b: re-get loop" + set did [open $dict] + # Here is the loop where we retrieve each key + while { [gets $did str] != -1 && $count < $nentries } { + set d [hsearch $str 0 find] + error_check_good hsearch:find $d $str + incr count + } + close $did + error_check_good hdestroy [hdestroy] 0 +} diff --git a/mozilla/db/test/include.tcl.src b/mozilla/db/test/include.tcl.src new file mode 100644 index 00000000000..f7e6b791805 --- /dev/null +++ b/mozilla/db/test/include.tcl.src @@ -0,0 +1,184 @@ +# DO NOT EDIT: automatically built by dist/distrib. +global dict +global testdir + +set CP @db_cv_path_cp@ +set DIFF @db_cv_path_diff@ +set KILL @db_cv_path_kill@ +set LS @db_cv_path_ls@ +set MKDIR @db_cv_path_mkdir@ +set MV @db_cv_path_mv@ +set RM @db_cv_path_rm@ +set SED @db_cv_path_sed@ +set SLEEP @db_cv_path_sleep@ +set SORT @db_cv_path_sort@ +set TR @db_cv_path_tr@ + +set DB_LOCK_GET 0 +set DB_LOCK_PUT 1 +set DB_LOCK_PUT_ALL 2 +set DB_LOCK_PUT_OBJ 3 +set DB_LOCK_NG 0 +set DB_LOCK_READ 1 +set DB_LOCK_WRITE 2 +set DB_LOCK_IREAD 3 +set DB_LOCK_IWRITE 4 +set DB_LOCK_IWR 5 +set DB_VERSION_MAJOR 2 +set DB_VERSION_MINOR 4 +set DB_VERSION_PATCH 14 +set DB_MAX_PAGES 0xffffffff +set DB_MAX_RECORDS 0xffffffff +set DB_FILE_ID_LEN 20 +set DB_DBT_INTERNAL 0x01 +set DB_DBT_MALLOC 0x02 +set DB_DBT_PARTIAL 0x04 +set DB_DBT_USERMEM 0x08 +set DB_FUNC_CALLOC 1 +set DB_FUNC_CLOSE 2 +set DB_FUNC_DIRFREE 3 +set DB_FUNC_DIRLIST 4 +set DB_FUNC_EXISTS 5 +set DB_FUNC_FREE 6 +set DB_FUNC_FSYNC 7 +set DB_FUNC_IOINFO 8 +set DB_FUNC_MALLOC 9 +set DB_FUNC_MAP 10 +set DB_FUNC_OPEN 11 +set DB_FUNC_READ 12 +set DB_FUNC_REALLOC 13 +set DB_FUNC_SEEK 14 +set DB_FUNC_SLEEP 15 +set DB_FUNC_STRDUP 16 +set DB_FUNC_UNLINK 17 +set DB_FUNC_UNMAP 18 +set DB_FUNC_WRITE 19 +set DB_FUNC_YIELD 20 +set DB_TSL_SPINS 21 +set DB_FUNC_RUNLINK 22 +set DB_REGION_ANON 23 +set DB_REGION_INIT 24 +set DB_REGION_NAME 25 +set DB_MUTEXLOCKS 26 +set DB_PAGEYIELD 27 +set DB_CREATE 0x000001 +set DB_NOMMAP 0x000002 +set DB_THREAD 0x000004 +set DB_INIT_LOCK 0x000008 +set DB_INIT_LOG 0x000010 +set DB_INIT_MPOOL 0x000020 +set DB_INIT_TXN 0x000040 +set DB_MPOOL_PRIVATE 0x000080 +set DB_RECOVER 0x000200 +set DB_RECOVER_FATAL 0x000400 +set DB_TXN_NOSYNC 0x000800 +set DB_USE_ENVIRON 0x001000 +set DB_USE_ENVIRON_ROOT 0x002000 +set DB_TXN_LOCK_2PL 0x000000 +set DB_TXN_LOCK_OPTIMIST 0x000000 +set DB_TXN_LOCK_MASK 0x000000 +set DB_TXN_LOG_REDO 0x000000 +set DB_TXN_LOG_UNDO 0x000000 +set DB_TXN_LOG_UNDOREDO 0x000000 +set DB_TXN_LOG_MASK 0x000000 +set DB_EXCL 0x008000 +set DB_RDONLY 0x010000 +set DB_SEQUENTIAL 0x020000 +set DB_TEMPORARY 0x040000 +set DB_TRUNCATE 0x080000 +set DB_LOCK_NORUN 0x0 +set DB_LOCK_DEFAULT 0x1 +set DB_LOCK_OLDEST 0x2 +set DB_LOCK_RANDOM 0x3 +set DB_LOCK_YOUNGEST 0x4 +set DB_ENV_APPINIT 0x01 +set DB_ENV_STANDALONE 0x02 +set DB_ENV_THREAD 0x04 +set DB_BTREEVERSION 6 +set DB_BTREEOLDVER 6 +set DB_BTREEMAGIC 0x053162 +set DB_HASHVERSION 5 +set DB_HASHOLDVER 4 +set DB_HASHMAGIC 0x061561 +set DB_LOGVERSION 2 +set DB_LOGOLDVER 2 +set DB_LOGMAGIC 0x040988 +set DB_DELIMITER 0x0001 +set DB_DUP 0x0002 +set DB_FIXEDLEN 0x0004 +set DB_PAD 0x0008 +set DB_RECNUM 0x0010 +set DB_RENUMBER 0x0020 +set DB_SNAPSHOT 0x0040 +set DB_AFTER 0x000001 +set DB_APPEND 0x000002 +set DB_BEFORE 0x000004 +set DB_CHECKPOINT 0x000008 +set DB_CURRENT 0x000010 +set DB_FIRST 0x000020 +set DB_FLUSH 0x000040 +set DB_GET_RECNO 0x000080 +set DB_KEYFIRST 0x000100 +set DB_KEYLAST 0x000200 +set DB_LAST 0x000400 +set DB_NEXT 0x000800 +set DB_NOOVERWRITE 0x001000 +set DB_NOSYNC 0x002000 +set DB_PREV 0x004000 +set DB_RECORDCOUNT 0x008000 +set DB_SET 0x010000 +set DB_SET_RANGE 0x020000 +set DB_SET_RECNO 0x040000 +set DB_CURLSN 0x080000 +set DB_INCOMPLETE -1 +set DB_KEYEMPTY -2 +set DB_KEYEXIST -3 +set DB_LOCK_DEADLOCK -4 +set DB_LOCK_NOTGRANTED -5 +set DB_LOCK_NOTHELD -6 +set DB_NOTFOUND -7 +set DB_DELETED -8 +set DB_NEEDSPLIT -9 +set DB_REGISTERED -10 +set DB_SWAPBYTES -11 +set DB_TXN_CKP -12 +set DB_AM_DUP 0x000001 +set DB_AM_INMEM 0x000002 +set DB_AM_LOCKING 0x000004 +set DB_AM_LOGGING 0x000008 +set DB_AM_MLOCAL 0x000010 +set DB_AM_PGDEF 0x000020 +set DB_AM_RDONLY 0x000040 +set DB_AM_RECOVER 0x000080 +set DB_AM_SWAP 0x000100 +set DB_AM_THREAD 0x000200 +set DB_BT_RECNUM 0x000400 +set DB_HS_DIRTYMETA 0x000800 +set DB_RE_DELIMITER 0x001000 +set DB_RE_FIXEDLEN 0x002000 +set DB_RE_PAD 0x004000 +set DB_RE_RENUMBER 0x008000 +set DB_RE_SNAPSHOT 0x010000 +set DB_LOCKVERSION 1 +set DB_LOCKMAGIC 0x090193 +set DB_LOCK_NOWAIT 0x01 +set DB_LOCK_CONFLICT 0x01 +set DB_LOCK_RW_N 3 +set DB_LOCK_RIW_N 6 +set DB_ARCH_ABS 0x001 +set DB_ARCH_DATA 0x002 +set DB_ARCH_LOG 0x004 +set DB_MPOOL_CREATE 0x001 +set DB_MPOOL_LAST 0x002 +set DB_MPOOL_NEW 0x004 +set DB_MPOOL_CLEAN 0x001 +set DB_MPOOL_DIRTY 0x002 +set DB_MPOOL_DISCARD 0x004 +set DB_TXNVERSION 1 +set DB_TXNMAGIC 0x041593 +set DB_TXN_BACKWARD_ROLL 1 +set DB_TXN_FORWARD_ROLL 2 +set DB_TXN_OPENFILES 3 +set DB_TXN_REDO 4 +set DB_TXN_UNDO 5 +set DB_DBM_HSEARCH 0 diff --git a/mozilla/db/test/lock.tcl b/mozilla/db/test/lock.tcl new file mode 100644 index 00000000000..4be78261646 --- /dev/null +++ b/mozilla/db/test/lock.tcl @@ -0,0 +1,279 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)lock.tcl 10.6 (Sleepycat) 4/10/98 +# +# Test driver for lock tests. +# General Multi Random +# Options are: +# -dir Y Y Y +# -iterations Y N Y +# -ldegree N N Y +# -maxlocks Y Y Y +# -objs N N Y +# -procs N N Y +# -reads N N Y +# -seeds N N Y +# -wait N N Y +# -conflicts Y Y Y +proc lock_usage {} { + puts stderr "randomlock\n\t-dir \n\t-iterations " + puts stderr "\t-conflicts " + puts stderr "\t-ldegree \n\t-maxlocks " + puts stderr "\t-objs \n\t-procs \n\t-reads <%reads>" + puts stderr "\t-seeds \n\t-wait " + return +} + +proc locktest { args } { +source ./include.tcl + + +# Set defaults + set conflicts { 0 0 0 0 0 1 0 1 1} + set iterations 1000 + set ldegree 5 + set maxlocks 1000 + set objs 75 + set procs 5 + set reads 65 + set seeds {} + set wait 5 + for { set i 0 } { $i < [llength $args] } {incr i} { + switch -regexp -- [lindex $args $i] { + -c.* { incr i; set conflicts [linkdex $args $i] } + -d.* { incr i; set testdir [lindex $args $i] } + -i.* { incr i; set iterations [lindex $args $i] } + -l.* { incr i; set ldegree [lindex $args $i] } + -m.* { incr i; set maxlocks [lindex $args $i] } + -o.* { incr i; set objs [lindex $args $i] } + -p.* { incr i; set procs [lindex $args $i] } + -r.* { incr i; set reads [lindex $args $i] } + -s.* { incr i; set seeds [lindex $args $i] } + -w.* { incr i; set wait [lindex $args $i] } + default { + lock_usage + return + } + } + } + set nmodes [isqrt [llength $conflicts]] + + if { [file exists $testdir] != 1 } { + exec $MKDIR $testdir + } elseif { [file isdirectory $testdir ] != 1 } { + error "$testdir is not a directory" + } + + # Cleanup + lock_cleanup $testdir + + # Open the lock + lock001 $maxlocks $nmodes $conflicts + # Now open the region we'll use for testing. + set lp [lock_open "" $DB_CREATE 0644 \ + -maxlocks $maxlocks -nmodes $nmodes -conflicts $conflicts] + lock002 $lp $iterations $nmodes + error_check_good lock_close [$lp close] 0 + set ret [ lock_unlink $testdir 0 ] + error_check_good lock_unlink $ret 0 + + lock003 $nmodes $conflicts + lock004 $maxlocks $conflicts + lock005 $testdir $iterations $maxlocks $procs $ldegree $objs \ + $reads $wait $conflicts $seeds +} + +# Make sure that we can create a region; destroy it, attach to it, +# detach from it, etc. + +proc lock001 { maxl nmodes conf } { +source ./include.tcl + puts "Lock001: open/close test" + + # Lock without create should fail. + set lp [lock_open "" 0 0644 -maxlocks $maxl -nmodes $nmodes \ + -conflicts $conf] + error_check_good lock_open $lp NULL + + # Now try to do open and create the region + set lp [lock_open "" $DB_CREATE 0644 \ + -maxlocks $maxl -nmodes $nmodes -conflicts $conf] + error_check_bad lock_open $lp NULL + + # Now try closing the region + set ret [ $lp close ] + error_check_good lock_close $ret 0 + + # Try reopening the region + set lp [lock_open "" 0 0644 -maxlocks $maxl -nmodes $nmodes \ + -conflicts $conf] + error_check_bad lock_open $lp NULL + + # Try unlinking without force (should fail) + set ret [ lock_unlink $testdir 0 ] + error_check_good lock_unlink $ret -1 + + # Close the region + error_check_good lock_close [$lp close] 0 + + # Create/open a new region + set lp [lock_open "" $DB_CREATE 0644 \ + -maxlocks $maxl -nmodes $nmodes -conflicts $conf] + error_check_bad lock_open $lp NULL + + # Close the region + set ret [$lp close] + error_check_good close $ret 0 + + # Finally, try unlinking the region without force and no live processes + set ret [ lock_unlink $testdir 0 ] + error_check_good lock_unlink $ret 0 + + # Now try creating the region in a different directory + if { [file exists $testdir/MYLOCK] != 1 } { + exec $MKDIR $testdir/MYLOCK + } + set lp [lock_open MYLOCK $DB_CREATE 0644 \ + -maxlocks $maxl -nmodes $nmodes -conflicts $conf] + error_check_bad lock_open $lp NULL + error_check_good lock_close [$lp close] 0 + error_check_good lock_unlink [lock_unlink $testdir/MYLOCK 0] 0 +} + +# Make sure that the basic lock tests work. Do some simple gets and puts for +# a single locker. +proc lock002 {lp iter nmodes} { + source ./include.tcl + puts "Lock002: test basic lock operations" + set locker 999 + + # Get and release each type of lock + for {set i 0} { $i < $nmodes } {incr i} { + set obj obj$i + set lockp [$lp get $locker $obj $i 0] + error_check_good lock_get [is_blocked $lockp] 0 + error_check_good lock_get [is_substr $lockp $lp] 1 + set ret [ $lockp put ] + error_check_good lock_put $ret 0 + } + + # Get a bunch of locks for the same locker; these should work + set obj OBJECT + for {set i 0} { $i < $nmodes } {incr i} { + set lockp [$lp get $locker $obj $i 0] + lappend locklist $lockp + error_check_good lock_get [is_blocked $lockp] 0 + error_check_good lock_get [is_substr $lockp $lp] 1 + } + release_list $locklist + + set locklist {} + # Check that reference counted locks work + for {set i 0} { $i < 10 } {incr i} { + set lockp [$lp get $locker $obj $DB_LOCK_WRITE 1] + error_check_good lock_get [is_blocked $lockp] 0 + error_check_good lock_get [is_substr $lockp $lp] 1 + lappend locklist $lockp + } + release_list $locklist + + # Finally try some failing locks + set locklist {} + for {set i 0} { $i < $nmodes } {incr i} { + set lockp [$lp get $locker $obj $i 0] + lappend locklist $lockp + error_check_good lock_get [is_blocked $lockp] 0 + error_check_good lock_get [is_substr $lockp $lp] 1 + } + + # Change the locker + set locker [incr locker] + set blocklist {} + # Skip NO_LOCK lock. + for {set i 1} { $i < $nmodes } {incr i} { + set lockp [$lp get $locker $obj $i $DB_LOCK_NOWAIT ] + error_check_good lock_get [is_substr $lockp $lp] 0 + error_check_good lock_get [is_blocked $lockp] 1 + } + + # Now release original locks + release_list $locklist + + # Now re-acquire blocking locks + set locklist {} + for {set i 1} { $i < $nmodes } {incr i} { + set lockp [$lp get $locker $obj $i $DB_LOCK_NOWAIT ] + error_check_good lock_get [is_substr $lockp $lp] 1 + error_check_good lock_get [is_blocked $lockp] 0 + lappend locklist $lockp + } + + # Now release new locks + release_list $locklist +} + +proc lock003 { nmodes conflicts } { +source ./include.tcl + puts "Lock003: lock region grow test" + set lp [lock_open "" $DB_CREATE 0644 \ + -maxlocks 10 -nmodes $nmodes -conflicts $conflicts ] + error_check_bad lock_open $lp NULL + +# First, cause to grow because of locks + set locker 12345 + set obj too_many_locks + set locklist {} + for {set i 0} { $i < 15 } { incr i } { + set lockp [$lp get $locker $obj $DB_LOCK_READ 0] + lappend locklist $lockp + error_check_good lock_get [is_blocked $lockp] 0 + error_check_good lock_get [is_substr $lockp $lp] 1 + } + release_list $locklist + +# Next, cause to grow because of objects + set locklist {} + for {set i 0} { $i < 30 } { incr i } { + set lockp [$lp get $locker $obj$i $DB_LOCK_WRITE 0] + lappend locklist $lockp + error_check_good lock_get [is_blocked $lockp] 0 + error_check_good lock_get [is_substr $lockp $lp] 1 + } + release_list $locklist + +# Finally, cause to grow because of string space; that means we need +# to lock objects with very long names +# +# XXX +# The loop end points, 50, and immediately below, 10, are for HPUX 9.05. +# If we grow the region more than 4 times on those systems, they crash. + set locker 12345 + set longobj "" + for {set i 0} { $i < 50} {incr i} { + set longobj $longobj$obj + } + + set locklist {} + for {set i 0} { $i < 10 } { incr i } { + set lockp [$lp get $locker $longobj$i $DB_LOCK_WRITE 0] + lappend locklist $lockp + error_check_good lock_get [is_blocked $lockp] 0 + error_check_good lock_get [is_substr $lockp $lp] 1 + } + release_list $locklist + + error_check_good lock_close [$lp close] 0 +} + + +# Blocked locks appear as lockmgrN.lockM\nBLOCKED +proc is_blocked { l } { + if { [string compare $l BLOCKED ] == 0 } { + return 1 + } else { + return 0 + } +} diff --git a/mozilla/db/test/lockscript.tcl b/mozilla/db/test/lockscript.tcl new file mode 100644 index 00000000000..94fdfaa114d --- /dev/null +++ b/mozilla/db/test/lockscript.tcl @@ -0,0 +1,89 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)lockscript.tcl 10.2 (Sleepycat) 4/10/98 +# +# Random lock tester. +# Usage: lockscript dir numiters numobjs sleepint degree readratio seed +# dir: lock directory. +# numiters: Total number of iterations. +# numobjs: Number of objects on which to lock. +# sleepint: Maximum sleep interval. +# degree: Maximum number of locks to acquire at once +# readratio: Percent of locks that should be reads. +# seed: Seed for random number generator. If -1, use pid. +source ../test/testutils.tcl +source ./include.tcl + +set usage "lockscript dir numiters numobjs sleepint degree readratio seed" + +# Verify usage +if { $argc != 7 } { + puts stderr $usage + exit +} + +# Initialize arguments +set dir [lindex $argv 0] +set numiters [ lindex $argv 1 ] +set numobjs [ lindex $argv 2 ] +set sleepint [ lindex $argv 3 ] +set degree [ lindex $argv 4 ] +set readratio [ lindex $argv 5 ] +set seed [ lindex $argv 6 ] +set locker [pid] + +# Initialize seed +if { $seed == -1 } { + srand $locker +} else { + srand $seed +} + +puts -nonewline "Beginning execution for $locker: $numiters $numobjs " +puts "$sleepint $degree $readratio $seed" +flush stdout + +set lp [lock_open "" 0 0 -dbhome $dir] +error_check_bad lock_open $lp NULL +error_check_good lock_open [is_substr $lp lockmgr] 1 + +for { set iter 0 } { $iter < $numiters } { incr iter } { + set nlocks [random_int 1 $degree] + # We will always lock objects in ascending order to avoid + # deadlocks. + set lastobj 1 + set locklist {} + for { set lnum 0 } { $lnum < $nlocks } { incr lnum } { + # Pick lock parameters + set obj [random_int $lastobj $numobjs] + set lastobj [expr $obj + 1] + set x [random_int 1 100 ] + if { $x <= $readratio } { + set rw $DB_LOCK_READ + } else { + set rw $DB_LOCK_WRITE + } + puts "[timestamp] $locker $lnum: $rw $obj" + + # Do get; add to list + set lockp [$lp get $locker $obj $rw 0] + lappend locklist $lockp + if {$lastobj > $numobjs} { + break + } + } + + # Pick sleep interval + exec $SLEEP [ random_int 1 $sleepint ] + + # Now release locks + puts "[timestamp] $locker released locks" + release_list $locklist + flush stdout +} + +puts "[timestamp] $locker Complete" +flush stdout diff --git a/mozilla/db/test/log.tcl b/mozilla/db/test/log.tcl new file mode 100644 index 00000000000..62ff9edee08 --- /dev/null +++ b/mozilla/db/test/log.tcl @@ -0,0 +1,330 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)log.tcl 10.7 (Sleepycat) 4/21/98 +# +# Options are: +# -dir +# -maxfilesize +# -iterations +# -stat +proc log_usage {} { + puts "log -dir -iterations \ + -maxfilesize -stat" +} +proc logtest { args } { + source ./include.tcl + +# Set defaults + set iterations 1000 + set maxfile [expr 1024 * 128] + set dostat 0 + for { set i 0 } { $i < [llength $args] } {incr i} { + switch -regexp -- [lindex $args $i] { + -d.* { incr i; set testdir [lindex $args $i] } + -i.* { incr i; set iterations [lindex $args $i] } + -m.* { incr i; set maxfile [lindex $args $i] } + -s.* { set dostat 1 } + default { + log_usage + return + } + } + } + if { [file exists $testdir] != 1 } { + exec $MKDIR $testdir + } elseif { [file isdirectory $testdir ] != 1 } { + error "$testdir is not a directory" + } + set multi_log [expr 3 * $iterations] + + # Clean out old log if it existed + puts "Unlinking log: error message OK" + cleanup $testdir + + # Now run the various functionality tests + log001 $testdir $maxfile + log002 $testdir $maxfile $iterations + log002 $testdir $maxfile $multi_log + log003 $testdir $maxfile + log004 $testdir $maxfile +} + +proc log001 { dir max } { +source ./include.tcl +puts "Log001: Open/Close/Create/Unlink test" + log_unlink $testdir 1 + log_cleanup $dir + + # Try opening without Create flag should error + set lp [ log "" 0 0 ] + error_check_good log:fail $lp NULL + + # Now try opening with create + set lp [ log "" $DB_CREATE 0644 -maxsize $max ] + error_check_bad log:$dir $lp NULL + error_check_good log:$dir [is_substr $lp log] 1 + + # Make sure that close works. + error_check_good log_close:$lp [$lp close] 0 + + # Make sure we can reopen. + set lp [ log "" 0 0 ] + error_check_bad log:$dir $lp NULL + error_check_good log:$dir [is_substr $lp log] 1 + + # Try unlinking while we're still attached, should fail. + error_check_good log_unlink:$dir [log_unlink $testdir 0] -1 + + # Now close it and unlink it + error_check_good log_close:$lp [$lp close] 0 + error_check_good log_unlink:$dir [log_unlink $testdir 0] 0 + log_cleanup $dir +} + +proc log002 { dir max nrecs } { +source ./include.tcl +puts "Log002: Basic put/get test" + + log_unlink $testdir 1 + log_cleanup $dir + + set lp [ log "" $DB_CREATE 0644 -maxsize $max ] + error_check_bad log:$dir $lp NULL + error_check_good log:$dir [is_substr $lp log] 1 + + # 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 "Log002.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 + } + set lsn [$lp put $rec 0] + error_check_bad log_put [is_substr $lsn log_cmd] 1 + lappend lsn_list $lsn + lappend rec_list $rec + } + puts "Log002.b: Retrieving log records sequentially (forward)" + set i 0 + for { set grec [$lp get {0 0} $DB_FIRST] } { [llength $grec] != 0 } { + set grec [$lp get {0 0} $DB_NEXT] } { + error_check_good log_get:seq $grec [lindex $rec_list $i] + incr i + } + + puts "Log002.c: Retrieving log records sequentially (backward)" + set i [llength $rec_list] + for { set grec [$lp get {0 0} $DB_LAST] } { [llength $grec] != 0 } { + set grec [$lp get {0 0} $DB_PREV] } { + incr i -1 + error_check_good log_get:seq $grec [lindex $rec_list $i] + } + + puts "Log002.d: Retrieving log records sequentially by LSN" + set i 0 + foreach lsn $lsn_list { + set grec [$lp get $lsn $DB_SET] + error_check_good log_get:seq $grec [lindex $rec_list $i] + incr i + } + + puts "Log002.e: Retrieving log records randomly by LSN" + set m [expr [llength $lsn_list] - 1] + for { set i 0 } { $i < $nrecs } { incr i } { + set recno [random_int 0 $m ] + set lsn [lindex $lsn_list $recno] + set grec [$lp get $lsn $DB_SET] + error_check_good log_get:seq $grec [lindex $rec_list $recno] + } + + # Close and unlink the file + error_check_good log_close:$lp [$lp close] 0 + error_check_good log_unlink:$dir [log_unlink $testdir 0] 0 + log_cleanup $dir +} + +proc log003 { dir {max 32768} } { +puts "Log003: Multiple log test w/trunc, file, compare functionality" +source ./include.tcl + + log_unlink $testdir 1 + log_cleanup $dir + + set lp [ log "" $DB_CREATE 0644 -maxsize $max ] + error_check_bad log:$dir $lp NULL + error_check_good log:$dir [is_substr $lp log] 1 + + # We'll record every hundred'th record for later use + set info_list {} + + set i 0 + puts "Log003.a: Writing log records" + 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 [$lp put $rec 0] + + if { [expr $i % 100 ] == 0 } { + lappend info_list [list $lsn $rec] + } + incr i + } + + puts "Log003.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 [$lp compare $l $last] 1 + error_check_good log_compare [$lp compare $last $l] -1 + error_check_good log_compare [$lp compare $l $l] 0 + } + set last $l + } + + puts "Log003.c: Checking log_file" + set flist [glob $dir/log*] + foreach p $info_list { + set f [$lp file [lindex $p 0]] + + # 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 "Log003.d: Verifying records" + for {set i [expr [llength $info_list] - 1] } { $i >= 0 } { incr i -1} { + set p [lindex $info_list $i] + set grec [$lp get [lindex $p 0] $DB_SET] + error_check_good log_get:$lp $grec [lindex $p 1] + } + + # Close and unlink the file + error_check_good log_close:$lp [$lp close] 0 + error_check_good log_unlink:$dir [log_unlink $testdir 0] 0 + log_cleanup $dir + + puts "Test003 Complete" +} + +proc log004 { dir {max 32768} } { +puts "Log004: Verify log_flush behavior" +source ./include.tcl + + log_unlink $testdir 1 + log_cleanup $dir + 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 "Log004.a: Verify flush on [string length $rec] byte rec" + + set lp [ log "" $DB_CREATE 0644 -maxsize $max ] + error_check_bad log:$dir $lp NULL + error_check_good log:$dir [is_substr $lp log] 1 + + set lsn [$lp put $rec 0] + error_check_bad log_put [lindex $lsn 0] "ERROR:" + set ret [$lp 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 [$lp close] + error_check_good log_close $ret 0 + + # Now, remove the log region + set ret [log_unlink $testdir 0] + error_check_good log_unlink $ret 0 + + # Re-open the log and try to read the record. + set lp [ log "" $DB_CREATE 0644 -maxsize $max ] + error_check_bad log:$dir $lp NULL + error_check_good log:$dir [is_substr $lp log] 1 + + set gotrec [$lp get "0 0" $DB_FIRST] + error_check_good lp_get $gotrec $rec + + # Close and unlink the file + error_check_good log_close:$lp [$lp close] 0 + error_check_good log_unlink:$dir [log_unlink $testdir 0] 0 + log_cleanup $dir + } + + foreach rec "$short_rec $long_rec $very_long_rec" { + puts "Log004.b: Verify flush on non-last record [string length $rec]" + set lp [ log "" $DB_CREATE 0644 -maxsize $max ] + error_check_bad log:$dir $lp NULL + error_check_good log:$dir [is_substr $lp log] 1 + + # Put 10 random records + for { set i 0 } { $i < 10 } { incr i} { + set r [random_data 450 0 0] + set lsn [$lp put $r 0] + error_check_bad log_put [lindex $lsn 0] "ERROR:" + } + + # Put the record we are interested in + set save_lsn [$lp put $rec 0] + 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 [$lp put $r 0] + error_check_bad log_put [lindex $lsn 0] "ERROR:" + } + + # Now check the flush + set ret [$lp 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" + set ret [$lp close] + error_check_good log_close $ret 0 + + # Now, remove the log region + set ret [log_unlink $testdir 0] + error_check_good log_unlink $ret 0 + + # Re-open the log and try to read the record. + set lp [ log "" $DB_CREATE 0644 -maxsize $max ] + error_check_bad log:$dir $lp NULL + error_check_good log:$dir [is_substr $lp log] 1 + + set gotrec [$lp get $save_lsn $DB_SET] + error_check_good lp_get $gotrec $rec + + # Close and unlink the file + error_check_good log_close:$lp [$lp close] 0 + error_check_good log_unlink:$dir [log_unlink $testdir 0] 0 + log_cleanup $dir + } + + puts "Test004 Complete" +} + +proc log_cleanup { dir } { + source ./include.tcl + + set files [glob -nocomplain $dir/log.*] + if { [llength $files] != 0} { + foreach f $files { + exec $RM -f $f + } + } +} diff --git a/mozilla/db/test/mdbscript.tcl b/mozilla/db/test/mdbscript.tcl new file mode 100644 index 00000000000..9d8afd1d4ab --- /dev/null +++ b/mozilla/db/test/mdbscript.tcl @@ -0,0 +1,135 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)mdbscript.tcl 10.2 (Sleepycat) 4/10/98 +# +# Process script for the multi-process db tester. +# Usage: mdbscript dir file nentries iter procid procs seed +# dir: DBHOME directory +# file: db file on which to operate +# nentries: number of entries taken from dictionary +# iter: number of operations to run +# procid: this procses' id number +# procs: total number of processes running +# seed: Random number generator seed (-1 means use pid) +source ./include.tcl +source ../test/testutils.tcl +set datastr abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz +set usage "mdbscript dir file nentries iter procid procs seed" + +# Verify usage +if { $argc != 7 } { + puts stderr $usage + exit +} + +# Initialize arguments +set dir [lindex $argv 0] +set file [lindex $argv 1] +set nentries [ lindex $argv 2 ] +set iter [ lindex $argv 3 ] +set procid [ lindex $argv 4 ] +set procs [ lindex $argv 5 ] +set seed [ lindex $argv 6 ] + +# Initialize seed +if { $seed == -1 } { + set seed [pid] +} +srand $seed + +puts "Beginning execution for [pid]" +puts "$dir db_home" +puts "$file database" +puts "$nentries data elements" +puts "$iter iterations" +puts "$procid process id" +puts "$procs processes" +puts "$seed seed" + +flush stdout + +set dbenv [dbenv -dbhome $dir -dbflags [expr $DB_INIT_LOCK | $DB_INIT_MPOOL]] +error_check_bad dbenv $dbenv NULL +error_check_good dbenv [is_substr $dbenv env] 1 + +set db [record dbopen $file 0 0 DB_UNKNOWN -dbenv $dbenv] +error_check_bad dbopen $db NULL +error_check_good dbopen [is_substr $db db] 1 + +set lm [lock_open "" 0 0 -dbenv $dbenv] +error_check_bad lockopen $lm NULL +error_check_good lockopen [is_substr $lm lockmgr] 1 + +# Init globals (no data) +set nkeys [db_init $db 0] +puts "Initial number of keys: $nkeys" +error_check_good db_init $nkeys $nentries + +set txn 0 + +# On each iteration we're going to randomly pick a key. +# We'll either get it (verifying that its content is reasonable). +# Put it (using an overwrite to make the data be datastr:ID). +# Get it and do a put through the cursor, tacking our ID on to +# whatever is already there. +set getput 0 +set overwrite 0 +set gets 0 +set dlen [string length $datastr] +for { set i 0 } { $i < $iter } { incr i } { + set op [random_int 0 2] + + switch $op { + 0 { + incr gets + set k [random_int 0 [expr $nkeys - 1]] + set key [lindex $l_keys $k] + set rec [record $db get $txn $key 0 ] + set rec [check_ret $db $lm $txn $rec ] + if { $rec != 0 } { + set partial [string range $rec 0 \ + [expr $dlen - 1]] + error_check_good db_get:$key $partial $datastr + } + } + 1 { + incr overwrite + set k [random_int 0 [expr $nkeys - 1]] + set key [lindex $l_keys $k] + set data $datastr:$procid + set ret [record $db put $txn $key $data 0] + set ret [check_ret $db $lm $txn $ret] + error_check_good db_put:$key $ret 0 + } + 2 { + incr getput + set dbc [$db cursor 0] + set k [random_int 0 [expr $nkeys - 1]] + set key [lindex $l_keys $k] + set ret [record $dbc get $key $DB_SET] + set ret [check_ret $db $lm $txn $ret] + if { $ret == 0 } { + break + } + + set rec [lindex $ret 1] + set partial [string range $rec 0 [expr $dlen - 1]] + error_check_good db_cget:$key $partial $datastr + append rec ":$procid" + set ret [record $dbc put $key $rec $DB_CURRENT] + set ret [check_ret $db $lm $txn $ret] + error_check_good db_cput:$key $ret 0 + error_check_good db_cclose:$dbc [$dbc close] 0 + } + } + flush stdout +} + +error_check_good db_close:$db [record $db close] 0 + +puts "[timestamp] [pid] Complete" +puts "Successful ops: $gets gets $overwrite overwrites $getput getputs" +flush stdout diff --git a/mozilla/db/test/mlock.tcl b/mozilla/db/test/mlock.tcl new file mode 100644 index 00000000000..76d3aec05c3 --- /dev/null +++ b/mozilla/db/test/mlock.tcl @@ -0,0 +1,175 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)mlock.tcl 10.4 (Sleepycat) 4/10/98 +# +# Exercise multi-process aspects of lock. +proc lock004 { {maxlocks 1000} {conflicts {0 0 0 0 0 1 0 1 1} } } { +source ./include.tcl + puts "Lock004: Basic multi-process lock tests." + + lock_cleanup $testdir + + set nmodes [isqrt [llength $conflicts]] + + # Open the lock + mlock_open $maxlocks $nmodes $conflicts + mlock_wait + set r [lock_unlink $testdir 0] + error_check_good lock_unlink $r 0 +} + +# Make sure that we can create a region; destroy it, attach to it, +# detach from it, etc. + +proc mlock_open { maxl nmodes conf } { +source ./include.tcl + + puts "Lock004.a multi-process open/close test" + # Open/Create region here. Then close it and try to open from + # other test process. + + set lp [lock_open "" $DB_CREATE 0644 \ + -maxlocks $maxl -nmodes $nmodes -conflicts $conf] + error_check_bad lock_open $lp NULL + set ret [ $lp close ] + error_check_good lock_close $ret 0 + set f1 [open |./dbtest r+] + puts $f1 "set lp \[lock_open \"\" 0 0 \]" + puts $f1 "puts \$lp" + puts $f1 "flush stdout" + flush $f1 + + set r [gets $f1 result] + error_check_bad remote:lock_open $r -1 + error_check_bad remote:lock_open $result NULL + + # Now make sure that we can reopen the region. + set lp [lock_open "" 0 0] + error_check_bad lock_open $lp NULL + error_check_good lock_open [is_substr $lp lockmgr] 1 + + # Try closing the remote region + puts $f1 "set ret \[\$lp close\]" + puts $f1 "puts \$ret" + puts $f1 "flush stdout" + flush $f1 + set r [gets $f1 result] + error_check_good remote:lock_close $result 0 + # Try opening for create. Will succeed because region exists. + puts $f1 "set lp \[lock_open \"\" $DB_CREATE 0644 -maxlocks $maxl -nmodes $nmodes -conflicts $conf\]" + puts $f1 "puts \$lp" + puts $f1 "flush stdout" + flush $f1 + + set r [gets $f1 result] + error_check_bad remote:lock_open $result NULL + error_check_good remote:lock_open [is_substr $result lockmgr] 1 + + # close locally + set r [$lp close] + error_check_good lock_close $r 0 + + # Close and exit remote + puts $f1 "set r \[\$lp close\]" + puts $f1 "puts \$r" + puts $f1 "flush stdout" + flush $f1 + + set r [gets $f1 result] + error_check_good remote_lock_close $result 0 + catch { close $f1 } result + puts "Exiting mlock_open" +} + +proc mlock_wait { } { + source ./include.tcl + + puts "Entering wait test" + # Open region locally + + set lp [lock_open "" 0 0] + error_check_bad lock_open $lp NULL + + # Open region remotely + set f1 [open |./dbtest r+] + puts $f1 "set lp \[lock_open \"\" 0 0 \]" + puts $f1 "puts \$lp" + puts $f1 "flush stdout" + flush $f1 + + debug_check + exec $SLEEP 5 + + set r [gets $f1 result] + error_check_bad remote:lock_open $r -1 + error_check_bad remote:lock_open $result NULL + + # Get a write lock locally; try for the read lock + # remotely. We hold the locks for several seconds + # so that we can use timestamps to figure out if the + # other process waited. + + set locker 1 + set l1 [$lp get $locker object1 $DB_LOCK_WRITE 0] + error_check_bad lock_get $l1 NULL + error_check_good lock_get [is_substr $l1 $lp] 1 + + # Now request a lock that we expect to hang; generate + # timestamps so we can tell if it actually hangs. + + set locker 2 + puts $f1 "set start \[timestamp -r\]" + puts $f1 "set l \[\$lp get $locker object1 $DB_LOCK_READ 0\]" + puts $f1 "puts \[expr \[timestamp -r\] - \$start\]" + puts $f1 "flush stdout" + flush $f1 + + # Now sleep before releasing lock + exec $SLEEP 5 + set result [$l1 put] + error_check_good lock_put $result 0 + + # Now get the result from the other script + set r [gets $f1 result] + error_check_good lock_get:remote_time [expr $result > 4] 1 + + # Now make the other guy wait 5 second and then release his + # lock while we try to get a write lock on it + puts $f1 "exec $SLEEP 5" + puts $f1 "set r \[\$l put\]" + puts $f1 "puts \$r" + puts $f1 "flush stdout" + flush $f1 + + set locker 1 + set start [timestamp -r] + set l [$lp get $locker object1 $DB_LOCK_WRITE 0] + error_check_good lock_get:time \ + [expr [expr [timestamp -r] - $start] > 4] 1 + error_check_bad lock_get:local $l NULL + error_check_good lock_get:local [is_substr $l $lp] 1 + + # Now check remote's result + set r [gets $f1 result] + error_check_good lock_put:remote $result 0 + + # Clean up remote + puts $f1 "set r \[\$lp close\]" + puts $f1 "puts \$r" + puts $f1 "flush stdout" + flush $f1 + + set r [gets $f1 result] + error_check_good lock_close:remote $result 0 + close $f1 + + # Now close up locally + set r [$l put] + error_check_good lock_put $r 0 + + set r [$lp close] + error_check_good lock_close $r 0 +} diff --git a/mozilla/db/test/mpool.tcl b/mozilla/db/test/mpool.tcl new file mode 100644 index 00000000000..9dc09df0c47 --- /dev/null +++ b/mozilla/db/test/mpool.tcl @@ -0,0 +1,396 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)mpool.tcl 10.15 (Sleepycat) 6/1/98 +# +# Options are: +# -cachesize +# -nfiles +# -iterations +# -pagesize +# -dir +# -stat +proc memp_usage {} { + puts "memp -cachesize -nfiles -iterations " + puts "\t-pagesize -dir " + puts "\t-shmem {anon named}" + return +} +proc mpool { args } { + source ./include.tcl + +# Set defaults + set cachesize [expr 50 * 1024] + set nfiles 5 + set iterations 500 + set pagesize "512 1024 2048 4096 8192" + set npages 100 + set procs 4 + set seeds "" + set envopts "" + set dostat 0 + for { set i 0 } { $i < [llength $args] } {incr i} { + switch -regexp -- [lindex $args $i] { + -c.* { incr i; set cachesize [lindex $args $i] } + -d.* { incr i; set testdir [lindex $args $i] } + -i.* { incr i; set iterations [lindex $args $i] } + -nf.* { incr i; set nfiles [lindex $args $i] } + -np.* { incr i; set npages [lindex $args $i] } + -pa.* { incr i; set pagesize [lindex $args $i] } + -pr.* { incr i; set procs [lindex $args $i] } + -se.* { incr i; set seeds [lindex $args $i] } + -sh.* { incr i; set envopts "-shmem [lindex $args $i]" } + -st.* { set dostat 1 } + default { + memp_usage + return + } + } + } + if { [file exists $testdir] != 1 } { + exec $MKDIR $testdir + } elseif { [file isdirectory $testdir ] != 1 } { + error "$testdir is not a directory" + } + + # Clean out old directory + cleanup $testdir + + # Open the memp with regioninit specified + set cmd {memp "" 0644 $DB_CREATE -cachesize $cachesize} + set cmd [concat $cmd $envopts] + set ri_cmd [concat $cmd "-rinit 1"] + set mp [eval $ri_cmd] + if { [string compare $mp EINVAL] == 0 } { + puts "$envopts not supported; test skipped" + return + } + error_check_good memp_close [$mp close] 0 + error_check_good memp_unlink:$testdir [memp_unlink $testdir 1] 0 + + # Now open without region init + + set mp [ eval $cmd] + if { [string compare $mp EINVAL] == 0 } { + puts "$envopts not supported" + return + } + error_check_good memp_open [is_valid_widget $mp mp] TRUE + memp001 $mp $testdir $nfiles $iterations [lindex $pagesize 0] $dostat $envopts + error_check_good memp_close [$mp close] 0 + error_check_good memp_unlink:$testdir [memp_unlink $testdir 1] 0 + set mp [ eval $cmd] + error_check_good memp_open [is_valid_widget $mp mp] TRUE + error_check_good memp_close [$mp close] 0 + memp002 $testdir \ + $procs $pagesize $iterations $npages $seeds $dostat $envopts + error_check_good memp_unlink:$testdir [memp_unlink $testdir 1] 0 + memp003 $envopts $iterations + error_check_good memp_unlink:$testdir [memp_unlink $testdir 1] 0 + error_check_good lock_unlink:$testdir [lock_unlink $testdir 1] 0 +} + +proc memp001 {mp dir n iter psize dostat envopts} { + source ./include.tcl + + puts "Memp001: {$envopts} random update $iter iterations on $n files." + # Open N memp files + for {set i 1} {$i <= $n} {incr i} { + set fname "data_file.$i" + file_create $dir/$fname 50 $psize + set files($i) [$mp open $fname $psize 0 0644] + } + srand 0xf0f0f0f0 + + # Now, loop, picking files at random + for {set i 0} {$i < $iter} {incr i} { + set f $files([random_int 1 $n]) + set p1 [get_range $f 10] + set p2 [get_range $f 10] + set p3 [get_range $f 10] + replace $p1 + replace $p3 + set p4 [get_range $f 20] + replace $p4 + set p5 [get_range $f 10] + set p6 [get_range $f 20] + set p7 [get_range $f 10] + set p8 [get_range $f 20] + replace $p5 + replace $p6 + set p9 [get_range $f 40] + replace $p2 + set p10 [get_range $f 40] + replace $p7 + replace $p8 + replace $p9 + replace $p10 + } + if { $dostat == 1 } { + $mp stat + for {set i 1} {$i <= $n} {incr i} { + error_check_good mp_sync [$files($i) sync] 0 +# error_check_good mp_close [$files($i) close] 0 + } + } + + # Close N memp files + for {set i 1} {$i <= $n} {incr i} { + error_check_good memp_close:$files($i) [$files($i) close] 0 + exec $RM -rf $dir/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 { file max } { + set pno [random_int 0 $max] + set p [$file get $pno 0 ] + set got [$p get] + if { $got != $pno } { +# if {[string compare $got $pno] != 0} \{ + puts "Get_range: Page mismatch page |$pno| val |$got|" + } + $p init "Page is pinned by [pid]" + return $p +} + +proc replace { p } { +global DB_MPOOL_DIRTY + $p init "Page is unpinned by [pid]" + $p put $DB_MPOOL_DIRTY +} + +proc memp002 { dir procs psizes iterations npages seeds dostat envopts } { + source ./include.tcl + + puts "Memp002: {$envopts} Multiprocess mpool tester" + if { [string compare [lindex $envopts 1] anon] == 0 } { + puts "Multiple processes not supported for unnamed anonymous memory." + return + } + set iter [expr $iterations / $procs] + + # Clean up old stuff and create new. + lock_unlink $dir 1 + for { set i 0 } { $i < [llength $psizes] } { incr i } { + exec $RM -rf $dir/file$i + } + set lp [lock_open "" $DB_CREATE 0644 $envopts] + if { [string compare $lp NULL] == 0 && [string length $envopts] != 0 } { + puts "Unable to initialize regions with $envopts" + return + } + error_check_good lock_open [is_valid_widget $lp lockmgr] TRUE + $lp close + + set pidlist {} + for { set i 0 } { $i < $procs } {incr i} { + if { [llength $seeds] == $procs } { + set seed [lindex $seeds $i] + } else { + set seed -1 + } + + puts "./dbtest ../test/mpoolscript.tcl $dir $i $procs \ + $iter \"$psizes\" $npages 3 $seed $envopts > \ + $dir/$i.mpoolout &" + set p [exec ./dbtest ../test/mpoolscript.tcl $dir $i $procs \ + $iter $psizes $npages 3 $seed $envopts > \ + $dir/$i.mpoolout & ] + lappend pidlist $p + } + puts "Memp002: $procs independent processes now running" + watch_procs $pidlist + # Remove output logs + for { set i 0 } { $i < $procs } {incr i} { + exec $RM $dir/$i.mpoolout + } + lock_unlink $dir 1 +} + +# Test reader-only/writer process combinations; we use the access methods +# for testing. +proc memp003 { envopts {nentries 10000} } { +global alphabet + source ./include.tcl + puts "Memp003: {$envopts} Reader/Writer tests" + if { [string compare [lindex $envopts 1] anon] == 0 } { + puts "{$envopts} Multiple processes not supported for unnamed anonymous memory." + return + } + + cleanup $testdir + set env_flags [expr $DB_CREATE | $DB_INIT_LOCK | $DB_INIT_MPOOL] + set psize 1024 + set testfile mpool.db + set t1 $testdir/t1 + + # Create an environment that the two processes can share + set cmd {dbenv -dbflags $env_flags -dbhome $testdir -cachesize \ + [expr $psize * 10]} + set cmd [concat $cmd $envopts] + set dbenv [eval $cmd] + + # First open and create the file. + + set db [dbopen $testfile [expr $DB_CREATE | $DB_TRUNCATE] \ + 0644 DB_BTREE -dbenv $dbenv -psize $psize] + error_check_good dbopen/RW [is_substr $db db] 1 + + set did [open $dict] + set flags 0 + set txn 0 + 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 [$db put $txn $str $str $flags] + error_check_good put $ret 0 + + set ret [$db get $txn $str $flags] + error_check_good get $ret $str + + incr count + } + close $did + error_check_good close [$db close] 0 + + # Now open the file for read-only + set db [dbopen $testfile $DB_RDONLY 0 DB_UNKNOWN -dbenv $dbenv] + 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 [random_int 0 [expr $nentries - 1]] + set key [lindex $keys $ndx] + if { [lsearch $testset $key] != -1 } { + incr i -1 + continue; + } + lappend testset $key + + set ret [$db get $txn $key $flags] + error_check_good get/RO $ret $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 |./dbtest r+] + puts $f1 "set dbenv \[dbenv -dbflags $env_flags -dbhome $testdir\ + -cachesize [expr $psize * 10] $envopts \]" + puts $f1 "puts \$dbenv" + puts $f1 "flush stdout" + flush $f1 + + set r [gets $f1 result] + error_check_bad gets $r -1 + error_check_good remote_dbenv [is_substr $result env] 1 + + puts $f1 "set db \[dbopen $testfile 0 0 DB_UNKNOWN -dbenv \$dbenv\]" + puts $f1 "puts \$db" + puts $f1 "flush stdout" + flush $f1 + + set r [gets $f1 result] + error_check_bad gets $r -1 + error_check_good remote_dbopen [is_substr $result db] 1 + + foreach k $testset { + # Get the key + puts $f1 "set ret \[\$db get 0 $k 0\]" + puts $f1 "puts \$ret" + puts $f1 "flush stdout" + flush $f1 + + set r [gets $f1 result] + error_check_bad gets $r -1 + error_check_good remote_get $result $k + + # Now replace the key + puts $f1 "set ret \[\$db put 0 $k $k$k 0\]" + puts $f1 "puts \$ret" + puts $f1 "flush stdout" + flush $f1 + + set r [gets $f1 result] + error_check_bad gets $r -1 + error_check_good remote_put $result 0 + } + + puts "\tMemp003.d: verify changes in local process" + foreach k $testset { + set ret [$db get $txn $key $flags] + error_check_good get_verify/RO $ret $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] + puts $f1 "set ret \[\$db put 0 $k $data 0\]" + puts $f1 "puts \$ret" + puts $f1 "flush stdout" + flush $f1 + + set r [gets $f1 result] + error_check_bad gets $r -1 + error_check_good remote_put $result 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] 0 + error_check_good db_close [$db close] 0 + + puts $f1 "set ret \[\$db close\]" + puts $f1 "puts \$ret" + puts $f1 "flush stdout" + flush $f1 + + set r [gets $f1 result] + error_check_bad gets $r -1 + error_check_good remote_get $result 0 + + # Close the environment both remotely and locally. + puts $f1 "set ret \[reset_env \$dbenv\]" + puts $f1 "puts \[string length \$ret\]" + puts $f1 "flush stdout" + flush $f1 + + set r [gets $f1 result] + error_check_bad gets$f1 $r -1 + error_check_good remote_reset_env $result 0 + close $f1 + + reset_env $dbenv +} diff --git a/mozilla/db/test/mpoolscript.tcl b/mozilla/db/test/mpoolscript.tcl new file mode 100644 index 00000000000..c958f8043ff --- /dev/null +++ b/mozilla/db/test/mpoolscript.tcl @@ -0,0 +1,187 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)mpoolscript.tcl 10.4 (Sleepycat) 4/10/98 +# +# Random multiple process mpool tester. +# Usage: mpoolscript dir id numiters numfiles numpages sleepint seed +# dir: lock directory. +# id: Unique identifier for this process. +# maxprocs: Number of procs in this test. +# numiters: Total number of iterations. +# pgsizes: Pagesizes for the different files. Length of this item indicates +# how many files to use. +# numpages: Number of pages per file. +# sleepint: Maximum sleep interval. +# seed: Seed for random number generator. If -1, use pid. +# envopt: Environment options. +source ../test/testutils.tcl +source ./include.tcl + +set usage \ + "mpoolscript dir id maxprocs numiters pgsizes numpages sleepint seed envopts" + +# Verify usage +if { $argc != 9 } { + puts stderr $usage + puts $argc + exit +} + +# Initialize arguments +set dir [lindex $argv 0] +set id [lindex $argv 1] +set maxprocs [lindex $argv 2] +set numiters [ lindex $argv 3 ] +set pgsizes [ lindex $argv 4 ] +set numpages [ lindex $argv 5 ] +set sleepint [ lindex $argv 6 ] +set seed [ lindex $argv 7 ] +set envopts [ lindex $argv 8] + +# Initialize seed +if { $seed == -1 } { + srand [pid] +} else { + srand $seed +} + +puts -nonewline "Beginning execution for $id: $maxprocs $dir $numiters" +puts " $pgsizes $numpages $sleepint $seed" +flush stdout + +# Figure out how small/large to make the cache +set max 0 +foreach i $pgsizes { + if { $i > $max } { + set max $i + } +} +set cache [expr $maxprocs * ([lindex $pgsizes 0] + $max)] + +set cmd {memp "" 0 0 -dbhome $dir -cachesize $cache} +set cmd [concat $cmd $envopts] +set mp [ eval $cmd] +error_check_bad memp $mp NULL +error_check_good memp [is_substr $mp mp] 1 + +# Now open files +set flist {} +set nfiles 0 +foreach psize $pgsizes { + set mpf [$mp open file$nfiles $psize $DB_CREATE 0644] + error_check_bad memp_fopen:$nfiles $mpf NULL + error_check_good memp_fopen:$nfiles [is_substr $mpf $mp] 1 + lappend flist $mpf + incr nfiles +} + +# Now create the lock region +# We'll use the convention that we lock by fileid:pageno +set lp [lock_open "" 0 0 -dbhome $dir $envopts] +error_check_bad lock_open $lp NULL +error_check_good lock_open [is_substr $lp lockmgr] 1 + +puts "Establishing long-term pin on file 0 page $id for process $id" + +# Set up the long-pin page +set lock [$lp get $id 0:$id $DB_LOCK_WRITE 0] +error_check_bad lock_get $lock NULL +error_check_good lock_get [is_substr $lock $lp] 1 + +set mpf [lindex $flist 0] +set master_page [$mpf get $id $DB_MPOOL_CREATE] +error_check_bad mp_get:$master_page $master_page NULL +error_check_good mp_get:$master_page [is_substr $master_page page] 1 + +set r [$master_page init MASTER$id] +error_check_good page_init $r 0 + +# Release the lock but keep the page pinned +set r [$lock put] +error_check_good lock_put $r 0 + +# Main loop. On each iteration, we'll check every page in each of +# of the files. On any file, if we see the appropriate tag in the +# field, we'll rewrite the page, else we won't. Keep track of +# how many pages we actually process. +set pages 0 +for { set iter 0 } { $iter < $numiters } { incr iter } { + puts "[timestamp]: iteration $iter, $pages pages set so far" + flush stdout + for { set fnum 1 } { $fnum < $nfiles } { incr fnum } { + if { [expr $fnum % 2 ] == 0 } { + set pred [expr ($id + $maxprocs - 1) % $maxprocs] + } else { + set pred [expr ($id + $maxprocs + 1) % $maxprocs] + } + + set mpf [lindex $flist $fnum] + for { set p 0 } { $p < $numpages } { incr p } { + set lock [$lp get $id $fnum:$p $DB_LOCK_WRITE 0] + error_check_bad lock_get:$fnum:$p $lock NULL + error_check_good lock_get:$fnum:$p \ + [is_substr $lock $lp] 1 + + # Now, get the page + set pp [$mpf get $p $DB_MPOOL_CREATE] + error_check_bad page_get:$fnum:$p $pp NULL + error_check_good page_get:$fnum:$p \ + [is_substr $pp page] 1 + + if { [$pp check $pred] == 0 || [$pp check nul] == 0 } { + # Set page to self. + set r [$pp init $id] + error_check_good page_init:$fnum:$p $r 0 + incr pages + set r [$pp put $DB_MPOOL_DIRTY] + error_check_good page_put:$fnum:$p $r 0 + } else { + error_check_good page_put:$fnum:$p [$pp put 0] 0 + } + error_check_good lock_put:$fnum:$p [$lock put] 0 + } + } + exec $SLEEP [random_int 1 $sleepint] +} + +# Now verify your master page, release its pin, then verify everyone else's +puts "$id: End of run verification of master page" +set r [$master_page check MASTER$id] +error_check_good page_check $r 0 +set r [$master_page put $DB_MPOOL_DIRTY] +error_check_good page_put $r 0 + +set i [expr ($id + 1) % $maxprocs] +set mpf [lindex $flist 0] +while { $i != $id } { + set p [ $mpf get $i $DB_MPOOL_CREATE ] + error_check_bad mp_get $p NULL + error_check_good mp_get [is_substr $p page] 1 + + if { [$p check MASTER$i] != 0 } { + puts "Warning: Master page $i not set." + } + error_check_good page_put:$p [$p put 0] 0 + + set i [expr ($i + 1) % $maxprocs] +} + +# Close lock system +set r [$lp close] +error_check_good lock_close $r 0 + +# Close files +foreach i $flist { + set r [$i close] + error_check_good mpf_close $r 0 +} + +# Close mpool system +set r [$mp close] +error_check_good memp_close $r 0 + +puts "[timestamp] $id Complete" +flush stdout diff --git a/mozilla/db/test/mutex.tcl b/mozilla/db/test/mutex.tcl new file mode 100644 index 00000000000..69058f691d0 --- /dev/null +++ b/mozilla/db/test/mutex.tcl @@ -0,0 +1,216 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)mutex.tcl 10.5 (Sleepycat) 4/20/98 +# +# Exercise mutex functionality. +# Options are: +# -dir +# -iter +# -mdegree +# -nmutex +# -procs +# -seeds +# -wait +proc mutex_usage {} { + puts stderr "mutex\n\t-dir \n\t-iter " + puts stderr "\t-mdegree \n\t-nmutex " + puts stderr "\t-procs " + puts stderr "\t-seeds \n\t-wait " + return +} + +proc mutex { args } { + source ./include.tcl + + set dir db + set iter 500 + set mdegree 3 + set nmutex 20 + set procs 5 + set seeds {} + set wait 2 + + for { set i 0 } { $i < [llength $args] } {incr i} { + switch -regexp -- [lindex $args $i] { + -d.* { incr i; set testdir [lindex $args $i] } + -i.* { incr i; set iter [lindex $args $i] } + -m.* { incr i; set mdegree [lindex $args $i] } + -n.* { incr i; set nmutex [lindex $args $i] } + -p.* { incr i; set procs [lindex $args $i] } + -s.* { incr i; set seeds [lindex $args $i] } + -w.* { incr i; set wait [lindex $args $i] } + default { + mutex_usage + return + } + } + } + + if { [file exists $testdir/$dir] != 1 } { + exec $MKDIR $testdir/$dir + } elseif { [file isdirectory $testdir/$dir ] != 1 } { + error "$testdir/$dir is not a directory" + } + + # Basic sanity tests + mutex001 $dir $nmutex + + # Basic synchronization tests + mutex002 $dir $nmutex + + # Multiprocess tests + mutex003 $dir $iter $nmutex $procs $mdegree $wait $seeds +} + +proc mutex001 { dir nlocks } { + source ./include.tcl + + puts "Mutex001: Basic functionality" + mutex_cleanup $testdir/$dir + + # Test open w/out create; should fail + set m [ mutex_init $dir $nlocks 0 0 ] + error_check_good mutex_init $m NULL + + # Now open for real + set m [ mutex_init $dir $nlocks $DB_CREATE 0644 ] + error_check_bad mutex_init $m NULL + error_check_good mutex_init [is_substr $m mutex] 1 + + # Get, set each mutex; sleep, then get Release + 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 + } + exec $SLEEP 5 + for { set i 0 } { $i < $nlocks } { incr i } { + set r [$m getval $i $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 + puts "Mutex001: completed successfully." +} + +# Test basic synchronization +proc mutex002 { dir nlocks } { + source ./include.tcl + + puts "Mutex002: Basic synchronization" + mutex_cleanup $testdir/$dir + + # Now open the region we'll use for multiprocess testing. + set mr [mutex_init $dir $nlocks $DB_CREATE 0644] + error_check_bad mutex_init $mr NULL + error_check_good mutex_init [is_substr $mr mutex] 1 + + set f1 [open |./dbtest r+] + puts $f1 "set m \[mutex_init $dir $nlocks 0 0 \]" + puts $f1 "puts \$m" + puts $f1 "flush stdout" + flush $f1 + + set r [gets $f1 result] + error_check_bad remote:mutex_init $r -1 + error_check_bad remote:mutex_init $result NULL + + # Do a get here, then set the value to be pid. + # On the remote side fire off a get and getval. + + set r [$mr get 1] + error_check_good lock_get $r 0 + + set r [$mr 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. + + puts $f1 "set start \[timestamp -r\]" + puts $f1 "set r \[\$m get 1]" + puts $f1 "puts \[expr \[timestamp -r\] - \$start\]" + puts $f1 "set r \[\$m getval 1\]" + puts $f1 "puts \$r" + puts $f1 "flush stdout" + flush $f1 + + # Now sleep before resetting and releasing lock + exec $SLEEP 5 + set newv [expr [pid] - 1] + set r [$mr setval 1 $newv] + error_check_good mutex_setval $r 0 + + set r [$mr release 1] + error_check_good mutex_release $r 0 + + # Now get the result from the other script + set r [gets $f1 result] + error_check_bad remote:gets $r -1 + error_check_good lock_get:remote_time [expr $result > 4] 1 + + set r [gets $f1 result] + error_check_bad remote:gets $r -1 + error_check_good lock_get:remote_getval $result $newv + + # Close down the remote + puts $f1 "\$m close" + flush $f1 + catch { close $f1 } result + + set r [$mr close] + error_check_good mutex_close $r 0 + puts "Mutex002: completed successfully." +} + +# Generate a bunch of parallel +# testers that try to randomly obtain locks. +proc mutex003 { dir iter nmutex procs mdegree wait seeds } { + source ./include.tcl + + puts "Mutex003: Multi-process random mutex test ($procs processes)" + + mutex_cleanup $testdir/$dir + + # Now open the region we'll use for multiprocess testing. + set mr [mutex_init $dir $nmutex $DB_CREATE 0644] + error_check_bad mutex_init $mr NULL + error_check_good mutex_init [is_substr $mr mutex] 1 + set r [$mr close] + error_check_good mutex_close $r 0 + + # Now spawn off processes + set proclist {} + for { set i 0 } {$i < $procs} {incr i} { + set s -1 + if { [llength $seeds] == $procs } { + set s [lindex $seeds $i] + } + puts "exec ./dbtest ../test/mutexscript.tcl $testdir/$dir \ + $iter $nmutex $wait $mdegree $s > $testdir/$i.mutexout &" + set p [exec ./dbtest ../test/mutexscript.tcl $testdir/$dir \ + $iter $nmutex $wait $mdegree $s > $testdir/$i.mutexout &] + lappend proclist $p + } + puts "Mutex003: $procs independent processes now running" + watch_procs $proclist + # Remove output files + for { set i 0 } {$i < $procs} {incr i} { + exec $RM -f $testdir/$i.mutexout + } +} + +proc mutex_cleanup { dir } { + source ./include.tcl + + exec $RM -rf $dir/__mutex.share +} diff --git a/mozilla/db/test/mutexscript.tcl b/mozilla/db/test/mutexscript.tcl new file mode 100644 index 00000000000..81b593cf309 --- /dev/null +++ b/mozilla/db/test/mutexscript.tcl @@ -0,0 +1,87 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)mutexscript.tcl 10.2 (Sleepycat) 4/10/98 +# +# Random mutex tester. +# Usage: mutexscript dir numiters mlocks sleepint degree seed +# dir: dir in which all the mutexes live. +# numiters: Total number of iterations. +# nmutex: Total number of mutexes. +# sleepint: Maximum sleep interval. +# degree: Maximum number of locks to acquire at once +# seed: Seed for random number generator. If -1, use pid. +source ../test/testutils.tcl +source ./include.tcl + +set usage "mutexscript dir numiters nmutex sleepint degree seed" + +# Verify usage +if { $argc != 6 } { + puts stderr $usage + exit +} + +# Initialize arguments +set dir [lindex $argv 0] +set numiters [ lindex $argv 1 ] +set nmutex [ lindex $argv 2 ] +set sleepint [ lindex $argv 3 ] +set degree [ lindex $argv 4 ] +set seed [ lindex $argv 5 ] +set locker [pid] + +# Initialize seed +if { $seed == -1 } { + srand $locker +} else { + srand $seed +} + +puts -nonewline "Mutexscript: Beginning execution for $locker:" +puts " $numiters $nmutex $sleepint $degree $seed" +flush stdout + +set m [mutex_init $dir $nmutex 0 0] +error_check_bad mutex_init $m NULL +error_check_good mutex_init [is_substr $m mutex] 1 + +for { set iter 0 } { $iter < $numiters } { incr iter } { + set nlocks [random_int 1 $degree] + # We will always lock objects in ascending order to avoid + # deadlocks. + set lastobj 1 + set mlist {} + for { set lnum 0 } { $lnum < $nlocks } { incr lnum } { + # Pick lock parameters + set obj [random_int $lastobj [expr $nmutex - 1]] + set lastobj [expr $obj + 1] + puts "[timestamp] $locker $lnum: $obj" + + # Do get, set its val to own pid, and then add to list + error_check_good mutex_get:$obj [$m get $obj] 0 + error_check_good mutex_setval:$obj [$m setval $obj [pid]] 0 + lappend mlist $obj + if {$lastobj >= $nmutex} { + break + } + } + + # Pick sleep interval + exec $SLEEP [ random_int 1 $sleepint ] + + # Now release locks + foreach i $mlist { + error_check_good mutex_getval:$i [$m getval $i] [pid] + error_check_good mutex_setval:$i \ + [$m setval $i [expr 0 - [pid]]] 0 + error_check_good mutex_release:$i [$m release $i] 0 + } + puts "[timestamp] $locker released mutexes" + flush stdout +} + +puts "[timestamp] $locker Complete" +flush stdout diff --git a/mozilla/db/test/ndbm.tcl b/mozilla/db/test/ndbm.tcl new file mode 100644 index 00000000000..4853bde5a69 --- /dev/null +++ b/mozilla/db/test/ndbm.tcl @@ -0,0 +1,122 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)ndbm.tcl 10.4 (Sleepycat) 4/10/98 +# +# Historic NDBM interface test. +# Use the first 1000 entries from the dictionary. +# Insert each with self as key and data; retrieve each. +# After all are entered, retrieve all; compare output to original. +# Then reopen the file, re-retrieve everything. +# Finally, delete everything. +proc ndbm { { nentries 1000 } } { + puts "NDBM interfaces test: $nentries" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile $testdir/ndbmtest + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + cleanup $testdir + + set flags [expr $DB_TRUNCATE | $DB_CREATE] + set db [ndbm_open $testfile $flags 0644] + error_check_good ndbm_open [is_substr $db ndbm] 1 + set did [open $dict] + + error_check_good rdonly_false [$db rdonly] 0 + + set flags 0 + set txn 0 + set count 0 + + puts "\tNDBM.a: put/get loop" + # Here is the loop where we put and get each key/data pair + while { [gets $did str] != -1 && $count < $nentries } { + set ret [$db store $str $str 0] + error_check_good ndbm_store $ret 0 + + set d [$db fetch $str] + error_check_good ndbm_fetch $d $str + incr count + } + close $did + + # Now we will get each key from the DB and compare the results + # to the original. + puts "\tNDBM.b: dump file" + set oid [open $t1 w] + for { set key [$db firstkey] } { $key != -1 } { + set key [$db nextkey] } { + puts $oid $key + set d [$db fetch $key] + error_check_good ndbm_refetch $d $key + } + close $oid + + # Now compare the keys to see if they match the dictionary (or ints) + set q q + exec $SED $nentries$q $dict > $t2 + exec $SORT $t1 > $t3 + + error_check_good NDBM:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + + puts "\tNDBM.c: pagf/dirf test" + set fd [$db pagfno] + error_check_bad pagf $fd -1 + set fd [$db dirfno] + error_check_bad dirf $fd -1 + + puts "\tNDBM.d: close, open, and dump file" + + # Now, reopen the file and run the last test again. + error_check_good ndbm_close [$db close] 0 + set db [ndbm_open $testfile $DB_RDONLY 0] + error_check_good ndbm_open2 [is_substr $db ndbm] 1 + set oid [open $t1 w] + + error_check_good rdonly_true [$db rdonly] 1 + + for { set key [$db firstkey] } { $key != -1 } { + set key [$db nextkey] } { + puts $oid $key + set d [$db fetch $key] + error_check_good ndbm_refetch2 $d $key + } + close $oid + + # Now compare the keys to see if they match the dictionary (or ints) + exec $SORT $t1 > $t3 + + error_check_good NDBM:diff($t2,$t3) \ + [catch { exec $DIFF $t2 $t3 } res] 0 + + # Now, reopen the file and delete each entry + puts "\tNDBM.e: sequential scan and delete" + + error_check_good ndbm_close [$db close] 0 + set db [ndbm_open $testfile 0 0] + error_check_good ndbm_open3 [is_substr $db ndbm] 1 + set oid [open $t1 w] + + for { set key [$db firstkey] } { $key != -1 } { + set key [$db nextkey] } { + puts $oid $key + set ret [$db delete $key] + error_check_good ndbm_delete $ret 0 + } + close $oid + + # Now compare the keys to see if they match the dictionary (or ints) + exec $SORT $t1 > $t3 + + error_check_good NDBM:diff($t2,$t3) \ + [catch { exec $DIFF $t2 $t3 } res] 0 +} diff --git a/mozilla/db/test/parmtest.tcl b/mozilla/db/test/parmtest.tcl new file mode 100644 index 00000000000..f0602c71b83 --- /dev/null +++ b/mozilla/db/test/parmtest.tcl @@ -0,0 +1,43 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)parmtest.tcl 10.2 (Sleepycat) 4/10/98 +# +# DB Parameter Test +# Run the numbered tests, exercising different parameter combinations. +proc parmtest { method {start 1} {nskip 0} } { + puts "Test011: $method" + set iter 0 + # Big cache and small cache tests + foreach cachesize "16777216 20480" { + # Small page medium page and big page tests + foreach pagesize "512 4096 65536" { + # Byte order tests + foreach lorder "4321 1234" { + if { $iter >= $nskip } { + run_method $method $start -lorder \ + $lorder -psize $pagesize \ + -cachesize $cachesize + } + incr iter + } + } + } +} + +proc parmtest.hash { {start 1} } { + foreach ffactor "-1 5 10 20 100" { + run_method $method 1 -ffactor $ffactor + } + foreach hash "1 2 3 4" { + run_method $method $start -hash $hash + } +} + +proc parmtest.btree { {start 1} } { + foreach minkey "2 4 8 16" { + run_method $method $start -minkey $minkey + } +} diff --git a/mozilla/db/test/randomlock.tcl b/mozilla/db/test/randomlock.tcl new file mode 100644 index 00000000000..034c575d7da --- /dev/null +++ b/mozilla/db/test/randomlock.tcl @@ -0,0 +1,42 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)randomlock.tcl 10.3 (Sleepycat) 4/10/98 +# +# Exercise multi-process aspects of lock. Generate a bunch of parallel +# testers that try to randomly obtain locks. +proc lock005 { dir {iter 500} {max 1000} {procs 5} {ldegree 5} {objs 75} \ + {reads 65} {wait 1} {conflicts { 0 0 0 0 0 1 0 1 1}} {seeds {}} } { +source ./include.tcl + puts "Lock005: Multi-process random lock test" + +# Clean up after previous runs + lock_cleanup $dir + + # Open/create the lock region + set lp [lock_open "" $DB_CREATE 0644 -maxlocks $max] + error_check_bad lock_open $lp NULL + error_check_good lock_open [is_substr $lp lockmgr] 1 + + # Now spawn off processes + set pidlist {} + for { set i 0 } {$i < $procs} {incr i} { + set s -1 + if { [llength $seeds] == $procs } { + set s [lindex $seeds $i] + } + puts "exec ./dbtest ../test/lockscript.tcl $dir $iter \ + $objs $wait $ldegree $reads $s > $dir/$i.lockout &" + set p [exec ./dbtest ../test/lockscript.tcl $dir $iter \ + $objs $wait $ldegree $reads $s > $dir/$i.lockout & ] + lappend pidlist $p + } + puts "Lock005: $procs independent processes now running" + watch_procs $pidlist + # Remove log files + for { set i 0 } {$i < $procs} {incr i} { + exec $RM -f $dir/$i.lockout + } +} diff --git a/mozilla/db/test/recd001.tcl b/mozilla/db/test/recd001.tcl new file mode 100644 index 00000000000..bf6b72c8b81 --- /dev/null +++ b/mozilla/db/test/recd001.tcl @@ -0,0 +1,98 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)recd001.tcl 10.8 (Sleepycat) 4/10/98 +# +# Recovery Test 1. +# These are the most basic recovery tests. We do individual recovery +# tests for each operation in the access method interface. First we +# create a file and capture the state of the database (i.e., we copy +# it. Then we run a transaction containing a single operation. In +# one test, we abort the transaction and compare the outcome to the +# original copy of the file. In the second test, we restore the +# original copy of the database and then run recovery and compare +# this against the actual database. +proc recd001 { method {select 0} } { + set opts [convert_args $method ""] + set method [convert_method $method] + puts "Recd001: $method operation/transaction tests" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and environment. + cleanup $testdir + + set testfile recd001.db + set flags [expr $DB_CREATE | $DB_THREAD | \ + $DB_INIT_LOG | $DB_INIT_LOCK | $DB_INIT_MPOOL | $DB_INIT_TXN] + + puts "\tRecd001.a: creating environment" + set env_cmd "dbenv -dbhome $testdir -dbflags $flags" + set dbenv [eval $env_cmd] + error_check_bad dbenv $dbenv NULL + + # Create the database and close the environment. + set db [dbopen $testfile [expr $DB_CREATE | $DB_TRUNCATE | $DB_THREAD] \ + 0644 $method -dbenv $dbenv $opts] + error_check_bad db_open $db NULL + error_check_good db_open [is_substr $db db] 1 + error_check_good db_close [$db close] 0 + reset_env $dbenv + + # List of recovery tests: {CMD MSG} pairs + set rlist { + { {DB put TXNID $key $data 0} "Recd001.b: put"} + { {DB del TXNID $key 0} "Recd001.c: delete"} + { {DB put TXNID $bigkey $data 0} "Recd001.d: big key put"} + { {DB del TXNID $bigkey 0} "Recd001.e: big key delete"} + { {DB put TXNID $key $bigdata 0} "Recd001.f: big data put"} + { {DB del TXNID $key 0} "Recd001.g: big data delete"} + { {DB put TXNID $key $data 0} "Recd001.h: put (change state)"} + { {DB put TXNID $key $newdata 0} "Recd001.i: overwrite"} + { {DB put TXNID $key $partial_grow $DB_DBT_PARTIAL $off $len} + "Recd001.j: partial put growing"} + { {DB put TXNID $key $newdata 0} "Recd001.k: overwrite (fix)"} + { {DB put TXNID $key $partial_shrink $DB_DBT_PARTIAL $off $len} + "Recd001.l: partial put growing"} + } + + # These are all the data values that we're going to need to read + # through the operation table and run the recovery tests. + + if { $method == "DB_RECNO" } { + set key 1 + } else { + set key recd001_key + } + set data recd001_data + set newdata NEWrecd001_dataNEW + set off 3 + set len 12 + set partial_grow replacement_record_grow + set partial_shrink xxx + set bigdata [replicate $key 1000] + if { $method == "DB_RECNO" } { + set bigkey 1000 + } else { + set bigkey [replicate $key 1000] + } + + foreach pair $rlist { + set cmd [my_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 + } + } + op_recover abort $testdir $env_cmd $testfile $cmd $msg + op_recover commit $testdir $env_cmd $testfile $cmd $msg + } +} diff --git a/mozilla/db/test/recd002.tcl b/mozilla/db/test/recd002.tcl new file mode 100644 index 00000000000..d4e1f2b8215 --- /dev/null +++ b/mozilla/db/test/recd002.tcl @@ -0,0 +1,61 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)recd002.tcl 10.6 (Sleepycat) 4/10/98 +# +# Recovery Test #2. Verify that splits can be recovered. +proc recd002 { method {select 0} } { + set opts [convert_args $method ""] + set method [convert_method $method] + puts "Recd002: $method split recovery tests" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + cleanup $testdir + set testfile recd002.db + set flags [expr $DB_CREATE | $DB_THREAD | \ + $DB_INIT_LOG | $DB_INIT_LOCK | $DB_INIT_MPOOL | $DB_INIT_TXN] + + puts "\tRecd002.a: creating environment" + set env_cmd "dbenv -dbhome $testdir -dbflags $flags" + set dbenv [eval $env_cmd] + error_check_bad dbenv $dbenv NULL + + # Create the database. We will use a small page size so that splits + # happen fairly quickly. + set db [dbopen $testfile [expr $DB_CREATE | $DB_TRUNCATE | $DB_THREAD] \ + 0644 $method -psize 512 -dbenv $dbenv $opts] + error_check_bad db_open $db NULL + error_check_good db_open [is_substr $db db] 1 + error_check_good db_close [$db close] 0 + reset_env $dbenv + + # List of recovery tests: {CMD MSG} pairs + set slist { + { {populate DB $method TXNID $n 0 0} "Recd002.b: splits"} + { {unpopulate DB TXNID $r} "Recd002.c: Remove keys"} + } + + # If pages are 512 bytes, then adding 512 key/data pairs + # should be more than sufficient. + set n 512 + set r [expr $n / 2 ] + foreach pair $slist { + set cmd [my_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 + } + } + op_recover abort $testdir $env_cmd $testfile $cmd $msg + op_recover commit $testdir $env_cmd $testfile $cmd $msg + } +} diff --git a/mozilla/db/test/recd003.tcl b/mozilla/db/test/recd003.tcl new file mode 100644 index 00000000000..97086677bc3 --- /dev/null +++ b/mozilla/db/test/recd003.tcl @@ -0,0 +1,82 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)recd003.tcl 10.6 (Sleepycat) 4/10/98 +# +# Recovery Test 3. +# Test all the duplicate log messages and recovery operations. We make +# sure that we exercise all possible recovery actions: redo, undo, undo +# but no fix necessary and redo but no fix necessary. +proc recd003 { method {select 0} } { + set method [convert_method $method] + if { $method == "DB_RECNO" } { + puts "Recd003 skipping for method RECNO" + return + } + puts "Recd003: $method duplicate recovery tests" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + cleanup $testdir + set testfile recd003.db + set flags [expr $DB_CREATE | $DB_THREAD | \ + $DB_INIT_LOG | $DB_INIT_LOCK | $DB_INIT_MPOOL | $DB_INIT_TXN] + + puts "\tRecd003.a: creating environment" + set env_cmd "dbenv -dbhome $testdir -dbflags $flags" + set dbenv [eval $env_cmd] + error_check_bad dbenv $dbenv NULL + + # Create the database. + set db [dbopen $testfile [expr $DB_CREATE | $DB_TRUNCATE | $DB_THREAD] \ + 0644 $method -flags $DB_DUP -dbenv $dbenv] + error_check_bad db_open $db NULL + error_check_good db_open [is_substr $db db] 1 + error_check_good db_close [$db close] 0 + reset_env $dbenv + + + # List of recovery tests: {CMD MSG} pairs + set dlist { + { {populate DB $m TXNID $n 1 0} "Recd003.b: add dups"} + { {DB del TXNID duplicate_key 0} "Recd003.c: remove dups all at once"} + { {populate DB $m TXNID $n 1 0} "Recd003.d: add dups (change state)"} + { {unpopulate DB TXNID 0} "Recd003.e: remove dups 1 at a time"} + { {populate DB $m TXNID $dupn 1 0} "Recd003.f: dup split"} + { {DB del TXNID duplicate_key 0} + "Recd003.g: remove dups (change state)"} + { {populate DB $m TXNID $n 1 1} "Recd003.h: add big dup"} + { {DB del TXNID duplicate_key 0} + "Recd003.i: remove big dup all at once"} + { {populate DB $m TXNID $n 1 1} + "Recd003.j: add big dup (change state)"} + { {unpopulate DB TXNID 0} "Recd003.k: remove big dup 1 at a time"} + { {populate DB $m TXNID $bign 1 1} "Recd003.l: split big dup"} + } + + # These are all the data values that we're going to need to read + # through the operation table and run the recovery tests. + set m $method + set n 10 + set dupn 2000 + set bign 500 + + foreach pair $dlist { + set cmd [my_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 + } + } + op_recover abort $testdir $env_cmd $testfile $cmd $msg + op_recover commit $testdir $env_cmd $testfile $cmd $msg + } +} diff --git a/mozilla/db/test/recd004.tcl b/mozilla/db/test/recd004.tcl new file mode 100644 index 00000000000..31df8d2cc25 --- /dev/null +++ b/mozilla/db/test/recd004.tcl @@ -0,0 +1,65 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)recd004.tcl 8.2 (Sleepycat) 4/10/98 +# +# Recovery Test #2. Verify that we work correctly when big keys +# get elevated. +proc recd004 { method {select 0} } { + set opts [convert_args $method ""] + set method [convert_method $method] + if { $method == "DB_RECNO" } { + puts "Recd003 skipping for method $method" + return + } + puts "Recd004: $method big-key on internal page recovery tests" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + cleanup $testdir + set testfile recd004.db + set flags [expr $DB_CREATE | $DB_THREAD | \ + $DB_INIT_LOG | $DB_INIT_LOCK | $DB_INIT_MPOOL | $DB_INIT_TXN] + + puts "\tRecd004.a: creating environment" + set env_cmd "dbenv -dbhome $testdir -dbflags $flags" + set dbenv [eval $env_cmd] + error_check_bad dbenv $dbenv NULL + + # Create the database. We will use a small page size so that we + # elevate quickly + set db [dbopen $testfile [expr $DB_CREATE | $DB_TRUNCATE | $DB_THREAD] \ + 0644 $method -psize 512 -dbenv $dbenv $opts] + error_check_bad db_open $db NULL + error_check_good db_open [is_substr $db db] 1 + error_check_good db_close [$db close] 0 + reset_env $dbenv + + # List of recovery tests: {CMD MSG} pairs + set slist { + { {big_populate DB TXNID $n} "Recd004.b: big key elevation"} + { {unpopulate DB TXNID 0} "Recd004.c: Remove keys"} + } + + # If pages are 512 bytes, then adding 512 key/data pairs + # should be more than sufficient. + set n 512 + foreach pair $slist { + set cmd [my_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 + } + } + op_recover abort $testdir $env_cmd $testfile $cmd $msg + op_recover commit $testdir $env_cmd $testfile $cmd $msg + } +} diff --git a/mozilla/db/test/recd005.tcl b/mozilla/db/test/recd005.tcl new file mode 100644 index 00000000000..2f7237145e6 --- /dev/null +++ b/mozilla/db/test/recd005.tcl @@ -0,0 +1,209 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)recd005.tcl 8.5 (Sleepycat) 5/3/98 +# +# Recovery Test 5. +# Make sure that we can do catastrophic recovery even if we open +# files using the same log file id. +proc recd005 { method {select 0} } { + set method [convert_method $method] + puts "Recd005: $method catastropic recovery" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + set testfile1 recd005.1.db + set testfile2 recd005.2.db + set flags [expr $DB_CREATE | $DB_THREAD | \ + $DB_INIT_LOG | $DB_INIT_LOCK | $DB_INIT_MPOOL | $DB_INIT_TXN] + + set tnum 0 + foreach sizes "{1000 10} {10 1000}" { + foreach ops "{abort abort} {abort commit} {commit abort} \ + {commit commit}" { + cleanup $testdir + incr tnum + + set s1 [lindex $sizes 0] + set s2 [lindex $sizes 1] + set op1 [lindex $ops 0] + set op2 [lindex $ops 1] + puts "\tRecd005.$tnum: $s1 $s2 $op1 $op2" + + puts "\tRecd005.$tnum.a: creating environment" + set env_cmd "dbenv -dbhome $testdir -dbflags $flags" + set dbenv [eval $env_cmd] + error_check_bad dbenv $dbenv NULL + + # Create the two databases. + set db1 [dbopen $testfile1 \ + [expr $DB_CREATE | $DB_TRUNCATE | $DB_THREAD] \ + 0644 $method -dbenv $dbenv] + error_check_bad db_open $db1 NULL + error_check_good db_open [is_substr $db1 db] 1 + error_check_good db_close [$db1 close] 0 + + set db2 [dbopen $testfile2 \ + [expr $DB_CREATE | $DB_TRUNCATE | $DB_THREAD] \ + 0644 $method -dbenv $dbenv] + error_check_bad db_open $db2 NULL + error_check_good db_open [is_substr $db2 db] 1 + error_check_good db_close [$db2 close] 0 + reset_env $dbenv + + set env [eval $env_cmd] + puts "\tRecd005.$tnum.b: Populating databases" + do_one_file $testdir $method $env $testfile1 $s1 $op1 + do_one_file $testdir $method $env $testfile2 $s2 $op2 + + puts "\tRecd005.$tnum.c: Verifying initial population" + check_file $testdir $env $testfile1 $op1 + check_file $testdir $env $testfile2 $op2 + + # Now, close the environment (so that recovery will work + # on NT which won't allow delete of an open file). + reset_env $env + + debug_check + puts -nonewline "\tRecd005.$tnum.d: About to run recovery ... " + flush stdout + + set stat \ + [catch {exec ./db_recover -h $testdir -c} result] + if { $stat == 1 && [is_substr $result \ + "db_recover: Recovering the log"] == 0 } { + error "Recovery error: $result." + } + puts "complete" + + + # Substitute a file that will need recovery and try + # running recovery again. + if { $op1 == "abort" } { + catch { exec $CP $dir/$testfile1.afterop \ + $dir/$testfile1 } res + } else { + catch { exec $CP $dir/$testfile1.init \ + $dir/$testfile1 } res + } + if { $op2 == "abort" } { + catch { exec $CP $dir/$testfile2.afterop \ + $dir/$testfile2 } res + } else { + catch { exec $CP $dir/$testfile2.init \ + $dir/$testfile2 } res + } + debug_check + puts -nonewline \ + "\tRecd005.$tnum.e: About to run recovery on pre-op database ... " + flush stdout + + set stat \ + [catch {exec ./db_recover -h $testdir -c} result] + if { $stat == 1 && + [is_substr $result \ + "db_recover: Recovering the log"] == 0 } { + error "Recovery error: $result." + } + puts "complete" + + set env [eval $env_cmd] + check_file $testdir $env $testfile1 $op1 + check_file $testdir $env $testfile2 $op2 + reset_env $env + } + } +} + +proc do_one_file { dir method env filename num op } { + source ./include.tcl + set init_file $dir/$filename.t1 + set afterop_file $dir/$filename.t2 + set final_file $dir/$filename.t3 + + # Save the initial file and open the environment and the first file + catch { exec $CP $dir/$filename $dir/$filename.init } res + set nolock_env [$env simpledup] + set tmgr [txn "" 0 0 -dbenv $env] + set db [dbopen $filename 0 0 DB_UNKNOWN -dbenv $env] + + # Dump out file contents for initial case + open_and_dump_file $filename $env 0 $init_file nop \ + dump_file_direction $DB_FIRST $DB_NEXT + + set txn [$tmgr begin] + error_check_bad txn_begin $txn NULL + error_check_good txn_begin [is_substr $txn $tmgr] 1 + + # Now fill in the db and the txnid in the command + populate $db $method $txn $num 0 0 + + # Sync the file so that we can capture a snapshot to test + # recovery. + error_check_good sync:$db [$db sync 0] 0 + catch { exec $CP $dir/$filename $dir/$filename.afterop } res + open_and_dump_file $filename.afterop $nolock_env 0 $afterop_file nop \ + dump_file_direction $DB_FIRST $DB_NEXT + error_check_good txn_$op:$txn [$txn $op] 0 + + if { $op == "commit" } { + puts "\t\tFile $filename executed and committed." + } else { + puts "\t\tFile $filename executed and aborted." + } + + # Dump out file and save a copy. + error_check_good sync:$db [$db sync 0] 0 + open_and_dump_file $filename $nolock_env 0 $final_file nop \ + dump_file_direction $DB_FIRST $DB_NEXT + catch { exec $CP $dir/$filename $dir/$filename.final } res + + # If this is an abort, it should match the original file. + # If this was a commit, then this file should match the + # afterop file. + if { $op == "abort" } { + exec $SORT $init_file > $init_file.sort + exec $SORT $final_file > $final_file.sort + error_check_good \ + diff(initial,post-$op):diff($init_file,$final_file) \ + [catch { exec $DIFF $init_file.sort $final_file.sort } res] 0 + } else { + exec $SORT $afterop_file > $afterop_file.sort + exec $SORT $final_file > $final_file.sort + error_check_good \ + diff(post-$op,pre-commit):diff($afterop_file,$final_file) \ + [catch { exec $DIFF $afterop_file.sort $final_file.sort } res] 0 + } + + error_check_good close:$db [$db close] 0 + error_check_good txn_close [$tmgr close] 0 +} + +proc check_file { dir env filename op } { + source ./include.tcl + + set init_file $dir/$filename.t1 + set afterop_file $dir/$filename.t2 + set final_file $dir/$filename.t3 + + set nolock_env [$env simpledup] + open_and_dump_file $filename $nolock_env 0 $final_file nop \ + dump_file_direction $DB_FIRST $DB_NEXT + if { $op == "abort" } { + exec $SORT $init_file > $init_file.sort + exec $SORT $final_file > $final_file.sort + error_check_good \ + diff(initial,post-$op):diff($init_file,$final_file) \ + [catch { exec $DIFF $init_file.sort $final_file.sort } res] 0 + } else { + exec $SORT $afterop_file > $afterop_file.sort + exec $SORT $final_file > $final_file.sort + error_check_good \ + diff(pre-commit,post-$op):diff($afterop_file,$final_file) \ + [catch { exec $DIFF $afterop_file.sort $final_file.sort } res] 0 + } +} diff --git a/mozilla/db/test/rsrc001.tcl b/mozilla/db/test/rsrc001.tcl new file mode 100644 index 00000000000..14921d96b03 --- /dev/null +++ b/mozilla/db/test/rsrc001.tcl @@ -0,0 +1,135 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)rsrc001.tcl 8.9 (Sleepycat) 5/26/98 +# +# Recno backing file test. +# Try different patterns of adding records and making sure that the +# corresponding file matches +proc rsrc001 { } { + puts "Rsrc001: Basic recno backing file writeback tests" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile rsrc001.db + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + cleanup $testdir + + # Create the starting files + set oid1 [open $testdir/rsrc.txt w] + set oid2 [open $testdir/check.txt w] + puts $oid1 "This is record 1" + puts $oid2 "This is record 1" + puts $oid1 "This is record 2 This is record 2" + puts $oid2 "This is record 2 This is record 2" + puts $oid1 "This is record 3 This is record 3 This is record 3" + puts $oid2 "This is record 3 This is record 3 This is record 3" + close $oid1 + close $oid2 + + sanitize_textfile $testdir/rsrc.txt + sanitize_textfile $testdir/check.txt + + puts "Rsrc001.a: Read file, rewrite last record; write it out and diff" + set db [dbopen $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 DB_RECNO\ + -recsrc rsrc.txt] + error_check_bad dbopen $db NULL + error_check_good dbopen [is_substr $db db] 1 + + # Read the last record; replace it (but we won't change it). + # Then close the file and diff the two files. + set txn 0 + set dbc [$db cursor $txn] + error_check_good db_cursor [is_substr $dbc $db] 1 + + set rec [$dbc get 0 $DB_LAST] + error_check_good get_last [llength $rec] 2 + set key [lindex $rec 0] + set data [lindex $rec 1] + + # Get the last record from the text file + set oid [open $testdir/rsrc.txt] + set laststr "" + while { [gets $oid str] != -1 } { + set laststr $str + } + close $oid + error_check_good getlast $data $laststr + + set ret [$db put0 $txn $key $data 0] + error_check_good replace_last $ret 0 + + error_check_good curs_close [$dbc close] 0 + error_check_good db_sync [$db sync 0] 0 + error_check_good Rsrc001:diff($testdir/rsrc.txt,$testdir/check.txt) \ + [catch { exec $DIFF $testdir/rsrc.txt $testdir/check.txt } res] 0 + + puts "Rsrc001.b: Append some records in tree and verify in file." + set oid [open $testdir/check.txt a] + for {set i 1} {$i < 10} {incr i} { + set rec [replicate "New Record $i" $i] + puts $oid $rec + incr key + set ret [$db put0 $txn 0 $rec $DB_APPEND] + error_check_good put_append $ret $key + } + error_check_good db_sync [$db sync 0] 0 + close $oid + sanitize_textfile $testdir/check.txt + set ret [catch { exec $DIFF $testdir/rsrc.txt $testdir/check.txt } res] + error_check_good Rsrc001:diff($testdir/{rsrc.txt,check.txt}) $ret 0 + + puts "Rsrc001.c: Append by record number" + set oid [open $testdir/check.txt a] + for {set i 1} {$i < 10} {incr i} { + set rec [replicate "New Record (set 2) $i" $i] + puts $oid $rec + incr key + set ret [$db put0 $txn $key $rec 0] + error_check_good put_byno $ret 0 + } + + error_check_good db_sync [$db sync 0] 0 + close $oid + sanitize_textfile $testdir/check.txt + set ret [catch { exec $DIFF $testdir/rsrc.txt $testdir/check.txt } res] + error_check_good Rsrc001:diff($testdir/{rsrc.txt,check.txt}) $ret 0 + + puts "Rsrc001.d: Put beyond end of file." + set oid [open $testdir/check.txt a] + for {set i 1} {$i < 10} {incr i} { + puts $oid "" + incr key + } + set rec "Last Record" + puts $oid $rec + incr key + set ret [$db put0 $txn $key $rec 0] + error_check_good put_byno $ret 0 + + error_check_good db_sync [$db sync 0] 0 + close $oid + sanitize_textfile $testdir/check.txt + set ret [catch { exec $DIFF $testdir/rsrc.txt $testdir/check.txt } res] + error_check_good Rsrc001:diff($testdir/{rsrc.txt,check.txt}) $ret 0 +} + +# convert CR/LF to just LF. +# Needed on Windows when a file is created as text but read as binary. +proc sanitize_textfile { filename } { + global is_windows_test + source ./include.tcl + + if { $is_windows_test == 1 } { + set TR "c:/mksnt/tr.exe" + catch { exec $TR -d '\015' <$filename > $testdir/nonl.tmp } res + catch { exec $MV $testdir/nonl.tmp $filename } res + } +} diff --git a/mozilla/db/test/spell.ok b/mozilla/db/test/spell.ok new file mode 100644 index 00000000000..02e148fab76 --- /dev/null +++ b/mozilla/db/test/spell.ok @@ -0,0 +1,74 @@ +API +BTREE +Eval +HTML +Keyfirst +Keylast +MPOOL +Mpool +NOOVERWRITE +NT +PostScript +README +RECNO +Sleepycat +Tcl +Txn +WNT +appinit +argc +argv +bsdos +bt +btree +cd +clib +cmd +cp +cxx +db +dbm +dbp +dbtest +dbwidget +dist +errno +gdb +getpid +hsearch +html +http +initially +int +interp +libdb +loadme +lsn +mancxx +memp +mkdir +mp +mpool +mutex +ndbm +offpage +os +pagesize +parmtest +pr +printlog +prpage +ps +recd +recno +sleepycat +src +stat +testXXX +tmp +txn +txnid +unix +usr +utils +www diff --git a/mozilla/db/test/sysscript.tcl b/mozilla/db/test/sysscript.tcl new file mode 100644 index 00000000000..f3761c763fc --- /dev/null +++ b/mozilla/db/test/sysscript.tcl @@ -0,0 +1,209 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)sysscript.tcl 10.3 (Sleepycat) 4/10/98 +# +# System integration test script. +# This script runs a single process that tests the full functionality of +# the system. The database under test contains nfiles files. Each process +# randomly generates a key and some data. Both keys and data are bimodally +# distributed between small keys (1-10 characters) and large keys (the avg +# length is indicated via the command line parameter. +# The process then decides on a replication factor between 1 and nfiles. +# It writes the key and data to that many files and tacks on the file ids +# of the files it writes to the data string. For example, let's say that +# I randomly generate the key dog and data cat. Then I pick a replication +# factor of 3. I pick 3 files from the set of n (say 1, 3, and 5). I then +# rewrite the data as 1:3:5:cat. I begin a transaction, add the key/data +# pair to each file and then commit. Notice that I may generate replication +# of the form 1:3:3:cat in which case I simply add a duplicate to file 3. +# +# Usage: sysscript dir nfiles key_avg data_avg seed +# +# dir: DB_HOME directory +# nfiles: number of files in the set +# key_avg: average big key size +# data_avg: average big data size +# seed: Random number generator seed (-1 means use pid) +source ./include.tcl +source ../test/testutils.tcl +set alphabet "abcdefghijklmnopqrstuvwxyz" +set mypid [pid] + +set usage "sysscript dir nfiles key_avg data_avg seed" + +# Verify usage +if { $argc != 5 } { + puts stderr $usage + exit +} + +# Initialize arguments +set dir [lindex $argv 0] +set nfiles [ lindex $argv 1 ] +set key_avg [ lindex $argv 2 ] +set data_avg [ lindex $argv 3 ] +set seed [ lindex $argv 4 ] + +# Initialize seed +if { $seed == -1 } { + set seed $mypid +} +srand $seed + +puts "Beginning execution for $mypid" +puts "$dir DB_HOME" +puts "$nfiles files" +puts "$key_avg average key length" +puts "$data_avg average data length" +puts "$seed seed" + +flush stdout + +# Create local environment +set flags [expr $DB_INIT_MPOOL | $DB_INIT_LOCK | $DB_INIT_LOG | $DB_INIT_TXN] +set dbenv [record dbenv -dbflags $flags -dbhome $dir] +error_check_bad $mypid:dbenv $dbenv NULL +error_check_good $mypid:dbenv [is_substr $dbenv env] 1 +set tm [record txn "" 0 0 -dbenv $dbenv] + +# Now open the files +for { set i 0 } { $i < $nfiles } { incr i } { + set file test024.$i.db + set db($i) [record dbopen $file 0 0 DB_UNKNOWN -dbenv $dbenv] + error_check_bad $mypid:dbopen $db($i) NULL + error_check_bad $mypid:dbopen [is_substr $db($i) error] 1 +} + +while { 1 } { + # Decide if we're going to create a big key or a small key + # We give small keys a 70% chance. + if { [random_int 1 10] < 8 } { + set k [random_data 5 0 0 ] + } else { + set k [random_data $key_avg 0 0 ] + } + set data [random_data $data_avg 0 0] + + set txn [record $tm begin] + error_check_bad $mypid:txn_begin $txn NULL + error_check_good $mypid:txn_begin [is_substr $txn $tm] 1 + + # Open cursors + for { set f 0 } {$f < $nfiles} {incr f} { + set cursors($f) [record $db($f) cursor $txn] + error_check_bad $mypid:cursor_open $cursors($f) NULL + error_check_good $mypid:cursor_open \ + [is_substr $cursors($f) $db($f)] 1 + } + set aborted 0 + + # Check to see if key is already in database + set found 0 + for { set i 0 } { $i < $nfiles } { incr i } { + set r [record $db($i) get $txn $k 0] + if { $r == "-1" } { + for {set f 0 } {$f < $nfiles} {incr f} { + error_check_good $mypid:cursor_close \ + [$cursors($f) close] 0 + } + error_check_good $mypid:txn_abort [record $txn abort] 0 + set aborted 1 + set found 2 + break + } elseif { $r != "Key $k not found." } { + set found 1 + break + } + } + switch $found { + 2 { + # Transaction aborted, no need to do anything. + } + 0 { + # Key was not found, decide how much to replicate + # and then create a list of that many file IDs. + set repl [random_int 1 $nfiles] + set fset "" + for { set i 0 } { $i < $repl } {incr i} { + set f [random_int 0 [expr $nfiles - 1]] + lappend fset $f + set data $f:$data + } + + foreach i $fset { + set r [record $db($i) put $txn $k $data 0] + if {$r == "-1"} { + for {set f 0 } {$f < $nfiles} {incr f} { + error_check_good $mypid:cursor_close \ + [$cursors($f) close] 0 + } + error_check_good $mypid:txn_abort \ + [record $txn abort] 0 + set aborted 1 + break + } + } + } + 1 { + # Key was found. Make sure that all the data values + # look good. + set f [zero_list $nfiles] + set data $r + while { [set ndx [string first : $r]] != -1 } { + set fnum [string range $r 0 [expr $ndx - 1]] + if { [lindex $f $fnum] == 0 } { + set flag $DB_SET + } else { + set flag $DB_NEXT + } + set full [record $cursors($fnum) get $k $flag] + if {$full == "-1"} { + for {set f 0 } {$f < $nfiles} {incr f} { + error_check_good $mypid:cursor_close \ + [$cursors($f) close] 0 + } + error_check_good $mypid:txn_abort \ + [record $txn abort] 0 + set aborted 1 + break + } + error_check_bad $mypid:curs_get($k,$data,$fnum,$flag) \ + [string length $full] 0 + set key [lindex $full 0] + set rec [lindex $full 1] + error_check_good $mypid:dbget_$fnum:key $key $k + error_check_good \ + $mypid:dbget_$fnum:data($k) $rec $data + set f [lreplace $f $fnum $fnum 1] + incr ndx + set r [string range $r $ndx end] + } + } + } + if { $aborted == 0 } { + for {set f 0 } {$f < $nfiles} {incr f} { + error_check_good $mypid:cursor_close \ + [$cursors($f) close] 0 + } + error_check_good $mypid:commit [record $txn commit] 0 + } +} + +# Close files +for { set i 0 } { $i < $nfiles} { incr i } { + set r [record $db($i) close] + error_check_good $mypid:db_close:$i $r 0 +} + +# Close tm and environment +error_check_good $mypid:txn_close [record $tm close] 0 +rename $dbenv {} + +puts "[timestamp] [pid] Complete" +flush stdout + +filecheck $file 0 + diff --git a/mozilla/db/test/tclAppInit.c b/mozilla/db/test/tclAppInit.c new file mode 100644 index 00000000000..fc2a7366b2d --- /dev/null +++ b/mozilla/db/test/tclAppInit.c @@ -0,0 +1,132 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)tclAppInit.c 10.7 (Sleepycat) 4/27/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#endif +#include + +#include "db_int.h" +#include "test_ext.h" + +/* + * XXX + * This is necessary so we can load with the additional DB C routines. + */ +const char + *progname = "dbtest"; /* Program name. */ + +/* + * XXX + * This is necessary to use Sun shared libraries with Tcl. + */ +#ifndef _WIN32 +extern int matherr(); +int *tclDummyMathPtr = (int *)matherr; +#endif + +#ifdef _WIN32 +extern void setup_terminate(); +#endif + +/* + * Global debugging variables. + */ +int debug_on, debug_print, debug_test; + +/* + * Tcl_AppInit -- + * General initialization. + */ +int +Tcl_AppInit(interp) + Tcl_Interp *interp; +{ + /* Initialize the interpreter. */ + if (Tcl_Init(interp) == TCL_ERROR) + return (TCL_ERROR); + + /* Create the commands. */ + Tcl_CreateCommand(interp, "args", args_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "db_version", dbversion_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "dbenv", dbenv_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "dbopen", dbopen_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "debug_check", debugcheck_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "lock_open", lockmgr_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "lock_unlink", lockunlink_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "log", log_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "log_unlink", logunlink_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "memp", memp_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "memp_unlink", mempunlink_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "mutex_init", mutex_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "mutex_unlink", mutexunlink_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "rand", rand_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "random_int", randomint_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "srand", srand_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "timestamp", stamp_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "txn", txnmgr_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "txn_unlink", txnunlink_cmd, NULL, NULL); + + /* Historic dbm functions */ + Tcl_CreateCommand(interp, "dbminit", dbminit_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "fetch", dbm_fetch_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "store", dbm_store_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "delete", dbm_delete_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "firstkey", dbm_first_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "nextkey", dbm_next_cmd, NULL, NULL); + + /* Historic ndbm functions */ + Tcl_CreateCommand(interp, "ndbm_open", ndbmopen_cmd, NULL, NULL); + + /* Historic hsearch functions */ + Tcl_CreateCommand(interp, "hcreate", hcreate_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "hdestroy", hdestroy_cmd, NULL, NULL); + Tcl_CreateCommand(interp, "hsearch", hsearch_cmd, NULL, NULL); + + /* Create shared global variables. */ + Tcl_LinkVar(interp, "debug_on", (char *)&debug_on, TCL_LINK_INT); + Tcl_LinkVar(interp, "debug_print", (char *)&debug_print, TCL_LINK_INT); + Tcl_LinkVar(interp, "debug_test", (char *)&debug_test, TCL_LINK_INT); + + /* Initialize shared global variables. */ + debug_on = debug_print = debug_test = 0; + + /* Specify the user startup file. */ +#if ((TCL_MAJOR_VERSION > 7) || \ + ((TCL_MAJOR_VERSION == 7) && (TCL_MINOR_VERSION > 4))) + Tcl_SetVar(interp, "tcl_rcFileName", ".dbtestrc", TCL_GLOBAL_ONLY); +#else + tcl_RcFileName = ".dbtestrc"; +#endif + return (TCL_OK); +} + +#if ((TCL_MAJOR_VERSION > 7) || \ + ((TCL_MAJOR_VERSION == 7) && (TCL_MINOR_VERSION >= 4))) +int +#ifdef _WIN32 +// Must let C++ have main in order to trap errors. +main2(argc, argv) +#else +main(argc, argv) +#endif + int argc; + char *argv[]; +{ + Tcl_Main(argc, argv, Tcl_AppInit); + + /* NOTREACHED */ + return (0); +} +#endif diff --git a/mozilla/db/test/tclWin32Init.cpp b/mozilla/db/test/tclWin32Init.cpp new file mode 100644 index 00000000000..78e2bc7d2a0 --- /dev/null +++ b/mozilla/db/test/tclWin32Init.cpp @@ -0,0 +1,81 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1998 + * Sleepycat Software. All rights reserved. + */ + +#ifndef lint +static const char sccsid[] = "@(#)tclWin32Init.cpp 10.2 (Sleepycat) 5/2/98"; +#endif /* not lint */ + +#include +#include +#include + +extern "C" { +#include "config.h" +#include "db_int.h" +#include "dbtest.h" +} + +/* + * The default exit handler on WIN32 brings up a dialog box. This is quite + * inconvenient when we want to run all the tests without user intervention, + * so tie this behavior to the debug_on var. + */ +void win32_terminate() +{ + fprintf(stderr, "\nFAIL: dbtest exited unexpectedly\n"); + if (debug_on) { + /* Dialog box with option to go into debugger */ + abort(); + } + else { + /* Immediate exit */ + exit(1); + } + // should not return +} + + +extern "C" void setup_terminate() +{ + (void)set_terminate(win32_terminate); +} + +extern "C" int main2(int argc, char *argv[]); + +#define IS_WNT ((GetVersion() & 0x80000000) == 0) + +int +main(int argc, char *argv[]) +{ + int argoff = 0; + int debug = 0; + + if (!IS_WNT) { + db_value_set(1, DB_REGION_NAME); + } + setup_terminate(); + if (argc > 1 && strcmp(argv[1], "-debug") == 0) { + debug++; + argoff++; + } + + // do not catch errors, let errors bring up dialog box + if (debug) { + return main2(argc-argoff, &argv[argoff]); + } + + try { + return main2(argc-argoff, &argv[argoff]); + } + catch (...) + { + win32_terminate(); + } + + // should not be reached. + return 99; +} diff --git a/mozilla/db/test/tcl_dbm.c b/mozilla/db/test/tcl_dbm.c new file mode 100644 index 00000000000..b974260978c --- /dev/null +++ b/mozilla/db/test/tcl_dbm.c @@ -0,0 +1,200 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)tcl_dbm.c 10.8 (Sleepycat) 4/27/98"; +#endif /* not lint */ + +/* + * This file is divided up into 2 sets of functions: + * 1. The dbminit command. + * 3. The dbm support functions (e.g. fetch, store, delete) + */ +#include +#include + +#define DB_DBM_HSEARCH 1 +#include + +#include "dbtest.h" +#include "test_ext.h" + +/* + * dbminit_cmd -- + * Implements dbminit for dbtest. Dbminit creates a widget that + * implements all the commands found off in the historical dbm interface. + */ + + +#define DBMINIT_USAGE "dbminit file" + +int +dbminit_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + char *name; + int ret; + + notused = NULL; + + /* Check number of arguments. */ + USAGE_GE(argc, 2, DBMINIT_USAGE, 0); + + name = strcmp(argv[1], "NULL") == 0 ? NULL : argv[1]; + + debug_check(); + + /* Call dbminit. */ + ret = dbminit(name); + if (ret != 0) { + Tcl_SetResult(interp, "dbminit: ", TCL_STATIC); + Tcl_AppendResult(interp, Tcl_PosixError(interp), NULL); + return (TCL_OK); + } + + Tcl_SetResult(interp, "0", TCL_STATIC); + return (TCL_OK); +} + +/* DBM support functions. */ + +#define DBMDEL_USAGE "delete key" +int +dbm_delete_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + datum key; + + USAGE(argc, 2, DBMDEL_USAGE, 0); + notused = NULL; + + key.dptr = argv[1]; + key.dsize = (int)strlen(argv[1]) + 1; /* Add NULL on end. */ + + debug_check(); + + if (delete(key) == 0) + Tcl_SetResult(interp, "0", TCL_STATIC); + else + Tcl_SetResult(interp, "-1", TCL_STATIC); + + return (TCL_OK); +} + +#define DBMFETCH_USAGE "fetch key" +int +dbm_fetch_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + datum data, key; + + USAGE_GE(argc, 2, DBMFETCH_USAGE, 0); + notused = NULL; + + key.dptr = argv[1]; + key.dsize = strlen(argv[1]) + 1; /* Add Null on end */ + + debug_check(); + + data = fetch(key); + if (data.dptr == NULL) + Tcl_SetResult(interp, "-1", TCL_STATIC); + else + Tcl_SetResult(interp, data.dptr, TCL_VOLATILE); + return (TCL_OK); +} + + +#define DBMSTORE_USAGE "store key data" + +int +dbm_store_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + datum data, key; + + USAGE_GE(argc, 3, DBMSTORE_USAGE, 0); + notused = NULL; + + key.dptr = argv[1]; + key.dsize = strlen(argv[1]) + 1; /* Add Null on end */ + + data.dptr = argv[2]; + data.dsize = strlen(argv[2]) + 1; + + debug_check(); + + if (store(key, data) == 0) + Tcl_SetResult(interp, "0", TCL_STATIC); + else + Tcl_SetResult(interp, "-1", TCL_STATIC); + return (TCL_OK); +} + +#define DBMFIRST_USAGE "firstkey" +int +dbm_first_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + datum key; + + USAGE(argc, 1, DBMFIRST_USAGE, 0); + argv = argv; + notused = NULL; + + key = firstkey(); + + if (key.dptr != 0) + Tcl_SetResult(interp, key.dptr, TCL_VOLATILE); + else + Tcl_SetResult(interp, "-1", TCL_STATIC); + + return (TCL_OK); +} + +#define DBMNEXT_USAGE "nextkey key" +int +dbm_next_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + datum nkey, key; + + USAGE(argc, 2, DBMNEXT_USAGE, 0); + notused = NULL; + + key.dptr = argv[1]; + key.dsize = strlen(argv[1]) + 1; + + nkey = nextkey(key); + + if (nkey.dptr != 0) + Tcl_SetResult(interp, nkey.dptr, TCL_VOLATILE); + else + Tcl_SetResult(interp, "-1", TCL_STATIC); + + return (TCL_OK); +} diff --git a/mozilla/db/test/tcl_hsearch.c b/mozilla/db/test/tcl_hsearch.c new file mode 100644 index 00000000000..69fd1df062c --- /dev/null +++ b/mozilla/db/test/tcl_hsearch.c @@ -0,0 +1,118 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)tcl_hsearch.c 10.6 (Sleepycat) 4/27/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#endif +#include + +#define DB_DBM_HSEARCH 1 +#include "db_int.h" + +#include "dbtest.h" +#include "test_ext.h" + +/* + * hcreate_cmd -- + * Implements hcreate for dbtest. hcreate creates an in-memory + * database compatible with the historical hsearch interface. + */ +#define HCREATE_USAGE "hcreate nelem" +int +hcreate_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + int nelem; + + notused = NULL; + + /* Check number of arguments. */ + USAGE_GE(argc, 2, HCREATE_USAGE, 0); + + if (Tcl_GetInt(interp, argv[1], &nelem) != TCL_OK) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, "\nUsage: ", HCREATE_USAGE, NULL); + return (TCL_OK); + } + debug_check(); + + /* Call hcreate. */ + if (hcreate(nelem) == 0) { + Tcl_SetResult(interp, "hcreate: ", TCL_STATIC); + Tcl_AppendResult(interp, Tcl_PosixError(interp), NULL); + return (TCL_OK); + } + + Tcl_SetResult(interp, "0", TCL_STATIC); + return (TCL_OK); +} + +#define HSEARCH_USAGE "hsearch key data find/enter" +int +hsearch_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + ENTRY item, *result; + ACTION action; + + USAGE(argc, 4, HSEARCH_USAGE, 0); + notused = NULL; + + item.key = argv[1]; + item.data = argv[2]; + if (strcmp(argv[3], "find") == 0) + action = FIND; + else if (strcmp(argv[3], "enter") == 0) + action = ENTER; + else + USAGE(0, 4, HSEARCH_USAGE, 0); + + debug_check(); + + if ((result = hsearch(item, action)) == NULL) + Tcl_SetResult(interp, "-1", TCL_STATIC); + else if (action == FIND) + Tcl_SetResult(interp, (char *)result->data, TCL_STATIC); + else + /* action is ENTER */ + Tcl_SetResult(interp, "0", TCL_STATIC); + + return (TCL_OK); +} + +#define HDESTROY_USAGE "hdestroy" +int +hdestroy_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + COMPQUIET(argv, NULL); + + USAGE_GE(argc, 1, HDESTROY_USAGE, 0); + notused = NULL; + + debug_check(); + hdestroy(); + Tcl_SetResult(interp, "0", TCL_STATIC); + return (TCL_OK); +} diff --git a/mozilla/db/test/tcl_lock.c b/mozilla/db/test/tcl_lock.c new file mode 100644 index 00000000000..6710558e0a5 --- /dev/null +++ b/mozilla/db/test/tcl_lock.c @@ -0,0 +1,403 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)tcl_lock.c 10.10 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +/* + * This file is divided up into 4 sets of functions: + * 1. The lock command and its support functions. + * 2. The lock_unlink command. + * 3. The lock manager widget commands. + * 4. The lock widget commands. + */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#endif +#include + +#include "db_int.h" +#include "dbtest.h" +#include "test_ext.h" + +/* Internal functions */ + +static int do_lockvec __P((Tcl_Interp *, DB_LOCKTAB *, int, char **)); + +#ifdef DEBUG +void __lock_dump_region __P((DB_LOCKTAB *, unsigned long)); +#endif +typedef struct _mgr_data { + DB_LOCKTAB *tabp; + DB_ENV *env; +} mgr_data; +typedef struct _lock_data { + DB_LOCKTAB *tabp; + DB_LOCK lock; +} lock_data; + +/* + * lock_cmd -- + * Implements lock_open for dbtest. Lock_open creates a lock + * manager and all the necessary files in the file system. It then + * creates a command that implements the other lock functions. + */ + +#define LOCKMGR_USAGE "lock_open path flags mode [options]\n\toptions:\n" + +int +lockmgr_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + static int mgr_number = 0; + DB_LOCKTAB *mgrp; + DB_ENV *env; + mgr_data *md; + u_int32_t flags; + int mode, ret, tclint; + char mgrname[50]; + + notused = NULL; + + debug_check(); + + /* Check number of arguments. */ + USAGE_GE(argc, 4, LOCKMGR_USAGE, DO_ENV); + if (Tcl_GetInt(interp, argv[2], &tclint) != TCL_OK || + Tcl_GetInt(interp, argv[3], &mode) != TCL_OK) + return (TCL_ERROR); + flags = (u_int32_t)tclint; + + /* + * Call lock_open. + */ + if (process_env_options(interp, argc, argv, &env)) { + Tcl_PosixError(interp); + Tcl_SetResult(interp, "NULL", TCL_STATIC); + return (TCL_OK); + } + + if (F_ISSET(env, DB_ENV_STANDALONE)) + mgrp = env->lk_info; + else if ((ret = lock_open(argv[1], flags, mode, env, &mgrp)) != 0) { + errno = ret; + Tcl_PosixError(interp); + Tcl_SetResult(interp, "NULL", TCL_STATIC); + return (TCL_OK); + } else + env->lk_info = mgrp; + + /* Create new command name. */ + if ((md = (mgr_data *)malloc(sizeof(mgr_data))) == NULL) { + if (!F_ISSET(env, DB_ENV_STANDALONE)) { + (void)db_appexit(env); + if (env->lk_conflicts) + free(env->lk_conflicts); + free(env); + } + Tcl_SetResult(interp, "lock_open: ", TCL_STATIC); + errno = ENOMEM; + Tcl_AppendResult(interp, Tcl_PosixError(interp), 0); + return (TCL_ERROR); + } + md->tabp = mgrp; + md->env = env; + sprintf(&mgrname[0], "lockmgr%d", mgr_number); + mgr_number++; + + /* Create widget command. */ + Tcl_CreateCommand(interp, mgrname, lockwidget_cmd, (int *)md, NULL); + Tcl_SetResult(interp, mgrname, TCL_VOLATILE); + return (TCL_OK); +} + +/* + * lockunlink_cmd -- + * Implements lock_unlink for dbtest. + */ + +#define LOCKUNLINK_USAGE "lock_unlink path force" + +int +lockunlink_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + int force; + + notused = NULL; + + debug_check(); + + USAGE_GE(argc, 3, LOCKUNLINK_USAGE, 0); + + if (Tcl_GetInt(interp, argv[2], &force) != TCL_OK) + return (TCL_ERROR); + + if (lock_unlink(argv[1], force, NULL) != 0) { + Tcl_SetResult(interp, "-1", TCL_STATIC); + return (TCL_OK); + } + Tcl_SetResult(interp, "0", TCL_STATIC); + return (TCL_OK); +} + +/* + * lockwidget -- + * This is that command that implements the lock widget. If we + * ever add new "methods" we add new widget commands here. + */ +#define LOCKWIDGET_USAGE "lockmgrN option ?arg arg ...?" +#define LOCKCLOSE_USAGE "lockmgrN close" +#define LOCKDUMP_USAGE "lockmgrN dump flags" +#define LOCKGET_USAGE "lockmgrN get locker obj mode flags" +#define LOCKVEC_USAGE \ + "lockmgrN vec locker flags ?{obj mode op} {obj mode op}...?" +/* Not yet implemented. */ + +int +lockwidget_cmd(cd_mgr, interp, argc, argv) + ClientData cd_mgr; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + static int id = 0; + DB_LOCKTAB *mgr; + DB_LOCK lock; + DBT obj_dbt; + DB_ENV *env; + db_lockmode_t mode; + lock_data *ld; + u_int32_t locker, flags; + int ret, tclint; + char lockname[128]; + + debug_check(); + + mgr = ((mgr_data *)cd_mgr)->tabp; + + USAGE_GE(argc, 2, LOCKWIDGET_USAGE, 0); + + if (strcmp(argv[1], "close") == 0) { + USAGE(argc, 2, LOCKCLOSE_USAGE, 0); + env = ((mgr_data *)cd_mgr)->env; + if (!F_ISSET(env, DB_ENV_STANDALONE)) { + (void)db_appexit(env); + if (env->lk_conflicts) + free(env->lk_conflicts); + free(env); + } + Tcl_DeleteCommand(interp, argv[0]); + Tcl_SetResult(interp, "0", TCL_STATIC); + return (TCL_OK); + } else if (strcmp(argv[1], "get") == 0) { + USAGE(argc, 6, LOCKGET_USAGE, 0); + if (Tcl_GetInt(interp, argv[2], &tclint) != TCL_OK) { + Tcl_PosixError(interp); + return (TCL_ERROR); + } + locker = (u_int32_t)tclint; + obj_dbt.data = argv[3]; + obj_dbt.size = strlen(argv[3]) + 1; + if (Tcl_GetInt(interp, argv[4], &tclint) != TCL_OK) + return (TCL_ERROR); + mode = tclint; + if (Tcl_GetInt(interp, argv[5], &tclint) != TCL_OK) + return (TCL_ERROR); + flags = (u_int32_t)tclint; + + ret = lock_get(mgr, locker, flags, &obj_dbt, mode, &lock); + + switch (ret) { + case 0: /* Success */ + sprintf(&lockname[0], "%s.lock%d", argv[0], id); + id++; + if ((ld = + (lock_data *)malloc(sizeof(lock_data))) == NULL) { + Tcl_PosixError(interp); + return (TCL_OK); + } + + ld->tabp = mgr; + ld->lock = lock; + + Tcl_CreateCommand(interp, + lockname, lock_cmd, (int *)ld, NULL); + Tcl_SetResult(interp, lockname, TCL_VOLATILE); + break; + case DB_LOCK_NOTGRANTED: + Tcl_SetResult(interp, "BLOCKED", TCL_STATIC); + return (TCL_OK); + case DB_LOCK_DEADLOCK: + Tcl_SetResult(interp, "DEADLOCK", TCL_STATIC); + return (TCL_OK); + default: + Tcl_PosixError(interp); + return (TCL_ERROR); + } + } else if (strcmp(argv[1], "vec") == 0) { + USAGE(argc, 5, LOCKVEC_USAGE, 0); + return (do_lockvec(interp, mgr, argc, argv)); +#ifdef DEBUG + } else if (strcmp(argv[1], "dump") == 0) { + USAGE(argc, 3, LOCKDUMP_USAGE, 0); + if (Tcl_GetInt(interp, argv[2], &tclint) != TCL_OK) + flags = 0xffff; + else + flags = (u_int32_t)tclint; + __lock_dump_region(mgr, flags); + return (TCL_OK); +#endif + } else { + Tcl_SetResult(interp, LOCKWIDGET_USAGE, TCL_STATIC); + return (TCL_ERROR); + } + return (TCL_OK); +} + +#define LOCK_USAGE "lockmgrN.lockM cmd ?arg arg ...?" +#define LOCKPUT_USAGE "lockmgrN.lockM put" +int +lock_cmd(cd_lock, interp, argc, argv) + ClientData cd_lock; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + DB_LOCK lock; + DB_LOCKTAB *tab; + lock_data *ld; + int ret; + + debug_check(); + + USAGE_GE(argc, 2, LOCK_USAGE, 0); + + ld = (lock_data *)cd_lock; + lock = ld->lock; + tab = ld->tabp; + free(ld); + + if (strcmp(argv[1], "put") == 0) { + USAGE(argc, 2, LOCKPUT_USAGE, 0); + Tcl_DeleteCommand(interp, argv[0]); + if ((ret = lock_put(tab, lock)) != 0) { + errno = ret; + Tcl_PosixError(interp); + return (TCL_OK); + } + } else { + Tcl_SetResult(interp, LOCK_USAGE, TCL_STATIC); + return (TCL_ERROR); + } + Tcl_SetResult(interp, "0", TCL_STATIC); + return (TCL_OK); +} + +static int +do_lockvec(interp, mgr, argc, argv) + Tcl_Interp *interp; + DB_LOCKTAB *mgr; + int argc; + char **argv; +{ + DB_LOCKREQ *reqlist, *err; + DBT *dblist; + db_lockmode_t mode; + db_lockop_t iop; + u_int32_t flags, locker; + int i, ntup, nreqs, ret, tclint; + char **ap, **tuplist; + + /* Get the locker id and the flags. */ + if (Tcl_GetInt(interp, argv[2], &tclint) != TCL_OK) + return (TCL_ERROR); + locker = (u_int32_t)tclint; + if (Tcl_GetInt(interp, argv[3], &tclint) != TCL_OK) + return (TCL_ERROR); + flags = (u_int32_t)tclint; + + /* The first three args are command, the rest are tuples. */ + nreqs = argc - 4; + if ((reqlist = + (DB_LOCKREQ *)calloc(sizeof(DB_LOCKREQ), nreqs)) == NULL || + (dblist = (DBT *)calloc(sizeof(DBT), nreqs)) == NULL) { + Tcl_PosixError(interp); + return (TCL_ERROR); + } + + for (i = 0; i < nreqs; i++) + reqlist[i].obj = &dblist[i]; + + for (ap = &argv[4], i = 0; i < nreqs; i++) { + tuplist = NULL; + if (Tcl_SplitList(interp, *ap, &ntup, &tuplist) != TCL_OK) + break; + if (Tcl_GetInt(interp, tuplist[1], &tclint) != TCL_OK) + break; + mode = (db_lockmode_t)tclint; + if (Tcl_GetInt(interp, tuplist[2], &tclint) != TCL_OK) + break; + iop = (db_lockop_t)tclint; + + reqlist[i].op = iop; + reqlist[i].obj->data = (char *)strdup(tuplist[0]); + reqlist[i].obj->size = strlen(tuplist[0]); + reqlist[i].mode = mode; + + free(tuplist); + } + + if (tuplist == NULL || i != nreqs) + ret = TCL_ERROR; + else if ((ret = + lock_vec(mgr, locker, flags, reqlist, nreqs, &err)) != 0) { + Tcl_SetResult(interp, "lock_vec failed, returned ", TCL_STATIC); + switch (ret) { + case DB_LOCK_DEADLOCK: + Tcl_AppendResult(interp, "DEADLOCK", 0); + break; + case DB_LOCK_NOTHELD: + Tcl_AppendResult(interp, "NOTHELD", 0); + break; + case DB_LOCK_NOTGRANTED: + Tcl_AppendResult(interp, "NOTGRANTED", 0); + break; + default: + errno = ret; + Tcl_AppendResult(interp, Tcl_PosixError(interp), 0); + break; + } + Tcl_AppendResult(interp, " on request ", + argv[4 + (err - reqlist)], NULL); + ret = TCL_ERROR; + } else { + Tcl_SetResult(interp, "0", TCL_STATIC); + ret = TCL_OK; + } + + for (i = 0; i < nreqs; i++) + if (reqlist[i].obj->data != NULL) + free(reqlist[i].obj->data); + free(reqlist); + free(dblist); + return (ret); +} diff --git a/mozilla/db/test/tcl_log.c b/mozilla/db/test/tcl_log.c new file mode 100644 index 00000000000..ac73a37bb75 --- /dev/null +++ b/mozilla/db/test/tcl_log.c @@ -0,0 +1,432 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)tcl_log.c 10.13 (Sleepycat) 4/10/98"; +#endif /* not lint */ + +/* + * This file is divided up into 5 sets of functions: + * 1. The log command and its support functions. + * 2. The logunlink command. + * 3. The log manager widget commands. + */ +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#endif +#include + +#include "db_int.h" +#include "dbtest.h" +#include "test_ext.h" + +/* Internal functions */ +static int get_lsn __P((Tcl_Interp *, char *, DB_LSN *)); +static int log_compare_cmd __P((Tcl_Interp *interp, int, char *argv[])); +static int log_file_cmd __P((DB_LOG *, Tcl_Interp *interp, int, char *argv[])); +static int log_flush_cmd __P((DB_LOG *, Tcl_Interp *interp, int, char *argv[])); +static int log_get_cmd __P((DB_LOG *, Tcl_Interp *interp, int, char *argv[])); +static int log_put_cmd __P((DB_LOG *, Tcl_Interp *interp, int, char *argv[])); +static int log_reg_cmd __P((DB_LOG *, Tcl_Interp *interp, int, char *argv[])); + +/* + * log_cmd -- + * Implements log_open for dbtest. Log_open creates a log manager + * and all the necessary files in the file system. It then creates + * a command that implements the other log functions. + */ + +#define LOG_USAGE "log path flags mode [options]\n\toptions:\n" + +typedef struct _log_data { + DB_LOG *logp; + DB_ENV *env; +} log_data; + +int +log_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + static int log_number = 0; + DB_LOG *lp; + DB_ENV *env; + log_data *ld; + u_int32_t flags; + int mode, tclint; + char logname[50]; + + notused = NULL; + + debug_check(); + + /* Check number of arguments. */ + USAGE_GE(argc, 4, LOG_USAGE, DO_ENV); + if (Tcl_GetInt(interp, argv[2], &tclint) != TCL_OK) + return (TCL_ERROR); + flags = (u_int32_t)tclint; + + if (Tcl_GetInt(interp, argv[3], &mode) != TCL_OK) + return (TCL_ERROR); + + if (process_env_options(interp, argc, argv, &env)) + return (TCL_ERROR); + + if (F_ISSET(env, DB_ENV_STANDALONE)) + lp = env->lg_info; + else if (log_open(argv[1], flags, mode, env, &lp) != 0) { + Tcl_SetResult(interp, "NULL", TCL_STATIC); + return (TCL_OK); + } else + env->lg_info = lp; + + if ((ld = (log_data *)malloc(sizeof(log_data))) == NULL) { + if (!F_ISSET(env, DB_ENV_STANDALONE)) { + (void)db_appexit(env); + if (env->lk_conflicts) + free(env->lk_conflicts); + free(env); + } + Tcl_SetResult(interp, "lock_open: ", TCL_STATIC); + errno = ENOMEM; + Tcl_AppendResult(interp, Tcl_PosixError(interp), 0); + return (TCL_ERROR); + } + ld->logp = lp; + ld->env = env; + + /* Create new command name. */ + sprintf(&logname[0], "log%d", log_number); + log_number++; + + /* Create widget command. */ + Tcl_CreateCommand(interp, logname, logwidget_cmd, (int *)ld, NULL); + Tcl_SetResult(interp, logname, TCL_VOLATILE); + return (TCL_OK); +} + +/* + * logunlink_cmd -- + * Implements txn_unlink for dbtest. + */ + +#define LOGUNLINK_USAGE "log_unlink path force" + +int +logunlink_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + int force; + + notused = NULL; + + debug_check(); + + USAGE_GE(argc, 3, LOGUNLINK_USAGE, 0); + + if (Tcl_GetInt(interp, argv[2], &force) != TCL_OK) + return (TCL_ERROR); + + if (log_unlink(argv[1], force, NULL) != 0) + Tcl_SetResult(interp, "-1", TCL_STATIC); + else + Tcl_SetResult(interp, "0", TCL_STATIC); + + return (TCL_OK); +} + +/* + * logwidget -- + * This is that command that implements the log widget. If we + * ever add new "methods" we add new widget commands here. + */ +#define LOGWIDGET_USAGE "logN option ?arg arg ...?" +#define LOGCLOSE_USAGE "logN close" +#define LOGFLUSH_USAGE "logN flush lsn" +#define LOGGET_USAGE "logN get lsn flags" +#define LOGCMP_USAGE "logN compare lsn1 lsn2" +#define LOGFILE_USAGE "logN file lsn" +#define LOGLAST_USAGE "logN last" +#define LOGPUT_USAGE "logN put record flags" +#define LOGREG_USAGE "logN register db name type" +#define LOG_UNREG "logN unregister id" + +int +logwidget_cmd(cd_lp, interp, argc, argv) + ClientData cd_lp; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + DB_LOG *lp; + DB_ENV *env; + DB_LSN lsn; + DBT rec; + int id, ret; + char fstr[16], dstr[16]; + + debug_check(); + + lp = ((log_data *)cd_lp)->logp; + + USAGE_GE(argc, 2, LOGWIDGET_USAGE, 0); + + if (strcmp(argv[1], "close") == 0) { + USAGE(argc, 2, LOGCLOSE_USAGE, 0); + env = ((log_data *)cd_lp)->env; + if (!F_ISSET(env, DB_ENV_STANDALONE)) { + (void)db_appexit(env); + if (env->lk_conflicts) + free(env->lk_conflicts); + free(env); + } + ret = Tcl_DeleteCommand(interp, argv[0]); + } else if (strcmp(argv[1], "flush") == 0) { + ret = log_flush_cmd(lp, interp, argc, argv); + } else if (strcmp(argv[1], "get") == 0) { + return (log_get_cmd(lp, interp, argc, argv)); + } else if (strcmp(argv[1], "last") == 0) { + memset(&rec, 0, sizeof(rec)); + ret = log_get(lp, &lsn, &rec, DB_LAST); + if (ret == 0) { + sprintf(fstr, "%lu", (u_long)lsn.file); + sprintf(dstr, "%lu", (u_long)lsn.offset); + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, fstr, " ", dstr, 0); + return (TCL_OK); + } + } else if (strcmp(argv[1], "compare") == 0) { + return (log_compare_cmd(interp, argc, argv)); + } else if (strcmp(argv[1], "file") == 0) { + return (log_file_cmd(lp, interp, argc, argv)); + } else if (strcmp(argv[1], "put") == 0) { + return (log_put_cmd(lp, interp, argc, argv)); + } else if (strcmp(argv[1], "register") == 0) { + return (log_reg_cmd(lp, interp, argc, argv)); + } else if (strcmp(argv[1], "unregister") == 0) { + if (Tcl_GetInt(interp, argv[2], &id) != TCL_OK) + return (TCL_ERROR); + ret = log_unregister(lp, id); + } else { + Tcl_SetResult(interp, LOGWIDGET_USAGE, TCL_STATIC); + return (TCL_ERROR); + } + + if (ret != 0) { + Tcl_SetResult(interp, "log_cmd: ", TCL_STATIC); + errno = ret; + Tcl_AppendResult(interp, argv[2], " ", + Tcl_PosixError(interp), 0); + } else + Tcl_SetResult(interp, "0", TCL_STATIC); + return (TCL_OK); +} + +/* + * Implementation of all the individual widget commands. + */ +static int +log_compare_cmd(interp, argc, argv) + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + DB_LSN lsn1, lsn2; + char resbuf[32]; + int cmp; + + USAGE(argc, 4, LOGCMP_USAGE, 0); + if (get_lsn(interp, argv[2], &lsn1) != TCL_OK || + get_lsn(interp, argv[3], &lsn2) != TCL_OK) + return (TCL_ERROR); + + cmp = log_compare(&lsn1, &lsn2); + sprintf(resbuf, "%d", cmp); + Tcl_SetResult(interp, resbuf, TCL_VOLATILE); + return (TCL_OK); +} + +static int +log_flush_cmd(lp, interp, argc, argv) + DB_LOG *lp; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + DB_LSN lsn; + int ret; + + USAGE(argc, 3, LOGFLUSH_USAGE, 0); + if (get_lsn(interp, argv[2], &lsn) != TCL_OK) + return (TCL_ERROR); + if (lsn.file == 0 && lsn.offset == 0) + ret = log_flush(lp, NULL); + else + ret = log_flush(lp, &lsn); + if (ret != 0) + return (TCL_ERROR); + + Tcl_SetResult(interp, "0", TCL_STATIC); + return (TCL_OK); +} + +static int +log_file_cmd(lp, interp, argc, argv) + DB_LOG *lp; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + DB_LSN lsn; + int ret; + char name[1024]; + + USAGE(argc, 3, LOGFILE_USAGE, 0); + if (get_lsn(interp, argv[2], &lsn) != TCL_OK) + return (TCL_ERROR); + if ((ret = log_file(lp, &lsn, name, sizeof(name))) != 0) { + Tcl_SetResult(interp, "log_file: ", TCL_STATIC); + errno = ret; + Tcl_AppendResult(interp, Tcl_PosixError(interp), 0); + return (TCL_OK); + } + Tcl_SetResult(interp, name, TCL_VOLATILE); + return (TCL_OK); +} + +static int +log_get_cmd(lp, interp, argc, argv) + DB_LOG *lp; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + DB_LSN lsn; + DBT data; + u_int32_t flags; + int ret, tclint; + + USAGE(argc, 4, LOGGET_USAGE, 0); + if (get_lsn(interp, argv[2], &lsn) != TCL_OK) + return (TCL_ERROR); + if (Tcl_GetInt(interp, argv[3], &tclint) != TCL_OK) + return (TCL_ERROR); + flags = (u_int32_t)tclint; + + memset(&data, 0, sizeof(data)); + switch (ret = log_get(lp, &lsn, &data, flags)) { + case 0: Tcl_SetResult(interp, data.data, TCL_VOLATILE); + break; + case DB_NOTFOUND: Tcl_ResetResult(interp); + break; + default: + Tcl_SetResult(interp, "log get: ", TCL_STATIC); + errno = ret; + Tcl_AppendResult(interp, Tcl_PosixError(interp), 0); + break; + } + return (TCL_OK); +} + +static int +log_put_cmd(lp, interp, argc, argv) + DB_LOG *lp; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + DB_LSN lsn; + DBT data; + u_int32_t flags; + int ret, tclint; + char resbuf[64]; + + USAGE(argc, 4, LOGPUT_USAGE, 0); + + if (Tcl_GetInt(interp, argv[3], &tclint) != TCL_OK) + return (TCL_ERROR); + flags = (u_int32_t)tclint; + + memset(&data, 0, sizeof(data)); + data.data = argv[2]; + data.size = strlen(argv[2]) + 1; + if ((ret = log_put(lp, &lsn, &data, flags)) != 0) { + errno = ret; + Tcl_SetResult(interp, "ERROR: ", TCL_STATIC); + Tcl_AppendResult(interp, Tcl_PosixError(interp), NULL); + return (TCL_ERROR); + } + + sprintf(resbuf, "%lu %lu", (unsigned long)lsn.offset, + (unsigned long)lsn.file); + Tcl_SetResult(interp, resbuf, TCL_VOLATILE); + return (TCL_OK); +} + +static int +log_reg_cmd(lp, interp, argc, argv) + DB_LOG *lp; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + DB *dbp; + DBTYPE type; + Tcl_CmdInfo cmd_info; + u_int32_t regid; + int ret, tclint; + + USAGE(argc, 5, LOGREG_USAGE, 0); + if (Tcl_GetInt(interp, argv[4], &tclint) != TCL_OK) + return (TCL_ERROR); + type = (DBTYPE)tclint; + + if (Tcl_GetCommandInfo(interp, argv[2], &cmd_info) != TCL_OK) + dbp = NULL; + else + dbp = (DB *)cmd_info.clientData; + ret = log_register(lp, dbp, argv[3], type, ®id); + if (ret != 0) { + errno = ret; + Tcl_SetResult(interp, "ERROR: ", TCL_STATIC); + Tcl_AppendResult(interp, Tcl_PosixError(interp), NULL); + return (TCL_ERROR); + } + sprintf(interp->result, "%lu", (unsigned long)regid); + return (TCL_OK); +} + +static int +get_lsn(interp, str, lsnp) + Tcl_Interp *interp; + char *str; + DB_LSN *lsnp; +{ + int largc, tclint; + char **largv; + + if (Tcl_SplitList(interp, str, &largc, &largv) != TCL_OK || largc != 2) + return (TCL_ERROR); + if (Tcl_GetInt(interp, largv[0], &tclint) != TCL_OK) + return (TCL_ERROR); + lsnp->offset = (u_int32_t)tclint; + if (Tcl_GetInt(interp, largv[1], &tclint) != TCL_OK) + return (TCL_ERROR); + lsnp->file = (u_int32_t)tclint; + return (TCL_OK); +} diff --git a/mozilla/db/test/tcl_mpool.c b/mozilla/db/test/tcl_mpool.c new file mode 100644 index 00000000000..d8cf81b7098 --- /dev/null +++ b/mozilla/db/test/tcl_mpool.c @@ -0,0 +1,428 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)tcl_mpool.c 10.15 (Sleepycat) 5/4/98"; +#endif /* not lint */ + +/* + * This file is divided up into 5 sets of functions: + * 1. The memp command and its support functions. + * 2. The memp_unlink command. + * 3. The memp widget commands. + * 4. The mool file commands. + * 5. The memp support functions (e.g. get, put, sync) + */ +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#endif +#include + +#include "db_int.h" +#include "dbtest.h" +#include "test_ext.h" + +typedef struct _mp_data { + DB_MPOOL *mp; + DB_ENV *env; +} mp_data; + +typedef struct _mpfinfo { + DB_MPOOLFILE *mpf; + size_t pgsize; +} mpfinfo; + +typedef struct _pginfo { + void *addr; + db_pgno_t pgno; + size_t pgsize; + DB_MPOOLFILE *mpf; +} pginfo; + +/* + * memp_cmd -- + * Implements memp_open for dbtest. Mpool_open creates an memp + * and creates an memp widget and command. + */ + +#define MPOOL_USAGE "memp path mode flags options [options]\n\toptions:\n" + +int +memp_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + static int mp_number = 0; + DB_ENV *env; + DB_MPOOL *mp; + mp_data *md; + u_int32_t flags; + int mode, tclint; + char mpname[50]; + + notused = NULL; + debug_check(); + + /* Check number of arguments. */ + USAGE_GE(argc, 4, MPOOL_USAGE, DO_ENV); + + if (Tcl_GetInt(interp, argv[2], &mode) != TCL_OK) + return (TCL_ERROR); + if (Tcl_GetInt(interp, argv[3], &tclint) != TCL_OK) + return (TCL_ERROR); + flags = (u_int32_t)tclint; + + /* Call memp_open. */ + if (process_env_options(interp, argc, argv, &env) != TCL_OK) { + /* + * Special case an EINVAL return which we want to pass + * back to the caller. + */ + if (strcmp(interp->result, "EINVAL") != 0) + Tcl_SetResult(interp, "NULL", TCL_STATIC); + return (TCL_OK); + } + if (F_ISSET(env, DB_ENV_STANDALONE)) + mp = env->mp_info; + else if (memp_open(argv[1], flags, mode, env, &mp) != 0) { + Tcl_SetResult(interp, "NULL", TCL_STATIC); + return (TCL_OK); + } else + env->mp_info = mp; + + md = (mp_data *)malloc(sizeof(mp_data)); + if (md == NULL) { + if (!F_ISSET(env, DB_ENV_STANDALONE)) { + (void)db_appexit(env); + if (env->lk_conflicts) + free(env->lk_conflicts); + free(env); + } + Tcl_SetResult(interp, "mp_open: ", TCL_STATIC); + errno = ENOMEM; + Tcl_AppendResult(interp, Tcl_PosixError(interp), 0); + return (TCL_ERROR); + } + md->mp = mp; + md->env = env; + /* Create new command name. */ + sprintf(&mpname[0], "mp%d", mp_number); + mp_number++; + + /* Create widget command. */ + Tcl_CreateCommand(interp, mpname, mpwidget_cmd, (int *)md, NULL); + Tcl_SetResult(interp, mpname, TCL_VOLATILE); + return (TCL_OK); +} + +/* + * mempunlink_cmd -- + * Implements memp_unlink for dbtest. + */ + +#define MPOOLUNLINK_USAGE "memp_unlink path force" + +int +mempunlink_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + u_int32_t flags; + int ret, tclint; + + notused = NULL; + debug_check(); + + USAGE_GE(argc, 3, MPOOLUNLINK_USAGE, 0); + + if (Tcl_GetInt(interp, argv[2], &tclint) != TCL_OK) + return (TCL_ERROR); + flags = (u_int32_t)tclint; + + if ((ret = memp_unlink(argv[1], flags, NULL)) != 0) { + Tcl_SetResult(interp, "memp_unlink: ", TCL_STATIC); + errno = ret; + Tcl_AppendResult(interp, Tcl_PosixError(interp), 0); + } else + Tcl_SetResult(interp, "0", TCL_STATIC); + return (TCL_OK); +} + +/* + * mpwidget -- + * This is that command that implements the memp widget. If we + * ever add new "methods" we add new widget commands here. + */ +#define MPWIDGET_USAGE "mpN option ?arg arg ...?" +#define MPCLOSE_USAGE "mpN close" +#define MPFOPEN_USAGE "mpN open path pagesize flags mode options" +#define MPSTAT_USAGE "mpN stat" + +int +mpwidget_cmd(cd_mp, interp, argc, argv) + ClientData cd_mp; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + static int mpf_id = 0; + DB_ENV *env; + DB_MPOOL *mp; + DB_MPOOLFILE *mpf; + mpfinfo *mfi; + size_t pagesize; + u_int32_t flags; + int mode, ret, tclint; + char mpfname[128]; + + debug_check(); + + mp = ((mp_data *)cd_mp)->mp; + + USAGE_GE(argc, 2, MPWIDGET_USAGE, 0); + + if (strcmp(argv[1], "close") == 0) { + USAGE(argc, 2, MPCLOSE_USAGE, 0); + env = ((mp_data *)cd_mp)->env; + if (!F_ISSET(env, DB_ENV_STANDALONE)) { + (void)db_appexit(env); + if (env->lk_conflicts) + free(env->lk_conflicts); + free(env); + } + ret = Tcl_DeleteCommand(interp, argv[0]); + if (ret) + Tcl_SetResult(interp, "-1", TCL_STATIC); + else + Tcl_SetResult(interp, "0", TCL_STATIC); + return (ret); + } else if (strcmp(argv[1], "open") == 0) { + USAGE(argc, 6, MPFOPEN_USAGE, 0); + + if (Tcl_GetInt(interp, argv[3], &tclint) != TCL_OK) + return (TCL_ERROR); + pagesize = (size_t)tclint; + if (Tcl_GetInt(interp, argv[4], &tclint) != TCL_OK) + return (TCL_ERROR); + flags = (u_int32_t)tclint; + if (Tcl_GetInt(interp, argv[5], &mode) != TCL_OK) + return (TCL_ERROR); + + if ((ret = memp_fopen(mp, + argv[2], flags, mode, pagesize, NULL, &mpf)) != 0) { + errno = ret; + Tcl_SetResult(interp, + Tcl_PosixError(interp), TCL_STATIC); + } + + sprintf(&mpfname[0], "%s.mpf%d", argv[0], mpf_id); + if ((mfi = (mpfinfo *)malloc(sizeof(mpfinfo))) == NULL) { + Tcl_SetResult(interp, "mp open: ", TCL_STATIC); + errno = ENOMEM; + Tcl_AppendResult(interp, Tcl_PosixError(interp), 0); + return (TCL_ERROR); + } + mfi->mpf = mpf; + mfi->pgsize = pagesize; + + mpf_id++; + Tcl_CreateCommand(interp, mpfname, mpf_cmd, (int *)mfi, NULL); + Tcl_SetResult(interp, mpfname, TCL_VOLATILE); + return (TCL_OK); + } else if (strcmp(argv[1], "stat") == 0) { + /* + * XXX + * THIS DOESN'T CURRENTLY WORK. + memp_stat(mp, stdout); + */ + return (TCL_OK); + } else { + Tcl_SetResult(interp, MPWIDGET_USAGE, TCL_STATIC); + return (TCL_ERROR); + } +} + +#define MPF_USAGE "mpN.mpfM cmd ?arg arg ...?" +#define MPFCLOSE_USAGE "mpN.mpfM close" +#define MPFGET_USAGE "mpN.mpfM get pgno flags" +#define MPFSYNC_USAGE "mpN.mpfM sync" +int +mpf_cmd(cd_mfi, interp, argc, argv) + ClientData cd_mfi; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + static int pg_id = 0; + DB_MPOOLFILE *mpf; + db_pgno_t pgno; + pginfo *pinfo; + void *paddr; + u_int32_t flags; + int ret, tclint; + char pgname[128]; + + debug_check(); + + USAGE_GE(argc, 2, MPF_USAGE, 0); + + mpf = ((mpfinfo *)cd_mfi)->mpf; + if (strcmp(argv[1], "close") == 0) { + USAGE(argc, 2, MPFCLOSE_USAGE, 0); + (void)free(cd_mfi); + ret = memp_fclose(mpf); + if (ret == 0) + ret = Tcl_DeleteCommand(interp, argv[0]); + if (ret) + Tcl_SetResult(interp, "-1", TCL_STATIC); + else + Tcl_SetResult(interp, "0", TCL_STATIC); + return (ret); + } else if (strcmp(argv[1], "get") == 0) { + USAGE(argc, 4, MPFGET_USAGE, 0); + if (Tcl_GetInt(interp, argv[2], (int *)&pgno) != TCL_OK) + return (TCL_ERROR); + if (Tcl_GetInt(interp, argv[3], &tclint) != TCL_OK) + return (TCL_ERROR); + flags = (u_int32_t)tclint; + ret = memp_fget(mpf, &pgno, flags, &paddr); + if (ret != 0 || + (pinfo = (pginfo *)malloc(sizeof(pginfo))) == NULL) { + Tcl_SetResult(interp, "mpf_cmd: ", TCL_STATIC); + if (ret != 0) + errno = ret; + Tcl_AppendResult(interp, Tcl_PosixError(interp), 0); + return (TCL_ERROR); + } + + /* Now create page widget. */ + pinfo->addr = paddr; + pinfo->pgno = pgno; + pinfo->pgsize = ((mpfinfo *)cd_mfi)->pgsize; + pinfo->mpf = ((mpfinfo *)cd_mfi)->mpf; + sprintf(&pgname[0], "page%d", pg_id); + pg_id++; + Tcl_CreateCommand(interp, pgname, pgwidget_cmd, (int *)pinfo, + NULL); + Tcl_SetResult(interp, &pgname[0], TCL_VOLATILE); + return (TCL_OK); + + } else if (strcmp(argv[1], "sync") == 0) { + USAGE(argc, 2, MPFSYNC_USAGE, 0); + if ((ret = memp_fsync(mpf)) == 0) + return (TCL_OK); + else { + Tcl_SetResult(interp, "mpf sync: ", TCL_STATIC); + errno = ret; + Tcl_AppendResult(interp, Tcl_PosixError(interp), 0); + return (TCL_ERROR); + } + } else { + Tcl_SetResult(interp, MPF_USAGE, TCL_STATIC); + return (TCL_ERROR); + } +} + +/* + * pagewidget -- + * This is that command that implements the memp page widget. This + * is returned from the get function of an mpf. + */ +#define PAGE_USAGE "pageN option ?arg arg ...?" +#define PAGEPUT_USAGE "pageN put flags" +#define PAGEINIT_USAGE "pageN init str" +#define PAGECHECK_USAGE "pageN check str" +#define PAGEGET_USAGE "pageN get" + +int +pgwidget_cmd(cd_page, interp, argc, argv) + ClientData cd_page; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + pginfo *pinfo; + size_t i, len; + u_int32_t flags; + int *ip, ret, tclint; + char *p, intbuf[50]; + + debug_check(); + + pinfo = (pginfo *)cd_page; + if (strcmp(argv[1], "put") == 0) { + USAGE(argc, 3, PAGEPUT_USAGE, 0); + if (Tcl_GetInt(interp, argv[2], &tclint) != TCL_OK) + return (TCL_ERROR); + flags = (u_int32_t)tclint; + if ((ret = memp_fput(pinfo->mpf, pinfo->addr, flags)) != 0) { + Tcl_SetResult(interp, "page put: ", TCL_STATIC); + errno = ret; + Tcl_AppendResult(interp, Tcl_PosixError(interp), 0); + return (TCL_ERROR); + } + free (cd_page); + Tcl_DeleteCommand(interp, argv[0]); + Tcl_SetResult(interp, "0", TCL_STATIC); + return (TCL_OK); + } else if (strcmp(argv[1], "init") == 0) { + USAGE(argc, 3, PAGEINIT_USAGE, 0); + len = strlen(argv[2]); + for (p = (char *)pinfo->addr, + i = 0; i < pinfo->pgsize; i += len, p += len) { + if (i + len > pinfo->pgsize) + len = pinfo->pgsize - i; + memcpy(p, argv[2], len); + } + Tcl_SetResult(interp, "0", TCL_STATIC); + return (TCL_OK); + } else if (strcmp(argv[1], "check") == 0) { + USAGE(argc, 3, PAGECHECK_USAGE, 0); + len = strlen(argv[2]); + + /* Special case, 0'd pages. */ + ret = 0; + if (strcmp(argv[2], "nul") == 0) { + for (ip = (int *)pinfo->addr, + i = 0; i < pinfo->pgsize; i += sizeof(int), ip++) + if ((ret = (*ip != 0)) != 0) + break; + } else { + for (p = (char *)pinfo->addr, + i = 0; i < pinfo->pgsize; i += len, p += len) { + if (i + len > pinfo->pgsize) + len = pinfo->pgsize - i; + if ((ret = memcmp(p, argv[2], len)) != 0) + break; + } + } + + if (ret) /* MISMATCH */ + Tcl_SetResult(interp, "1", TCL_STATIC); + else + Tcl_SetResult(interp, "0", TCL_STATIC); + return (TCL_OK); + } else if (strcmp(argv[1], "get") == 0) { + USAGE(argc, 2, PAGEGET_USAGE, 0); + sprintf(intbuf, "%lu", (unsigned long)pinfo->pgno); + Tcl_SetResult(interp, intbuf, TCL_VOLATILE); + return (TCL_OK); + } else { + Tcl_SetResult(interp, PAGE_USAGE, TCL_STATIC); + return (TCL_ERROR); + } +} diff --git a/mozilla/db/test/tcl_mutex.c b/mozilla/db/test/tcl_mutex.c new file mode 100644 index 00000000000..7b551f000b8 --- /dev/null +++ b/mozilla/db/test/tcl_mutex.c @@ -0,0 +1,277 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)tcl_mutex.c 10.16 (Sleepycat) 5/4/98"; +#endif /* not lint */ + +/* + * This file is divided up into 4 sets of functions: + * 1. The mutex command. + * 2. The mutex widget commands. + */ +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#endif +#include + +#include "db_int.h" +#include "dbtest.h" +#include "common_ext.h" +#include "test_ext.h" + + +typedef struct _mutex_entry { + union { + struct { + db_mutex_t 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_region { + RLAYOUT hdr; + u_int32_t n_mutex; +} mu_region; + +typedef struct _mutex_data { + DB_ENV *env; + REGINFO reginfo; + mutex_entry *marray; + mu_region *region; + size_t size; +} mutex_data; + +/* + * mutex_cmd -- + * Implements mutex_open for dbtest. Mutex_open optionally creates + * a file large enough to hold all the mutexes and then maps it in to + * the process' address space. + */ + +#define MUTEX_USAGE "mutex_init path nitems flags mode" +#define MUTEX_FILE "__mutex.share" +int +mutex_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + static int mut_number = 0; + DB_ENV *env; + mu_region *region; + mutex_data *md; + mutex_entry *marray; + u_int32_t flags; + int i, mode, nitems, tclint; + char mutname[50]; + + notused = NULL; + debug_check(); + + /* Check number of arguments. */ + USAGE_GE(argc, 5, MUTEX_USAGE, 0); + if (Tcl_GetInt(interp, argv[2], &nitems) != TCL_OK) + return (TCL_ERROR); + if (Tcl_GetInt(interp, argv[3], &tclint) != TCL_OK) + return (TCL_ERROR); + flags = (u_int32_t)tclint; + if (Tcl_GetInt(interp, argv[4], &mode) != TCL_OK) + return (TCL_ERROR); + + if ((md = (mutex_data *)malloc(sizeof(mutex_data))) == NULL) + goto posixout; + + md->size = ALIGN(sizeof(mu_region), 32) + sizeof(mutex_entry) * nitems; + + /* Create a file of the appropriate size. */ + if (process_env_options(interp, argc, argv, &env)) + goto errout; + + /* Map in the region. */ + memset(&md->reginfo, 0, sizeof(md->reginfo)); + md->reginfo.dbenv = env; + md->reginfo.appname = DB_APP_NONE; + md->reginfo.path = argv[1]; + md->reginfo.file = MUTEX_FILE; + md->reginfo.mode = mode; + md->reginfo.size = md->size; + md->reginfo.dbflags = flags; + md->reginfo.flags = 0; + if ((errno = __db_rattach(&md->reginfo)) != 0) + goto posixout; + md->region = region = md->reginfo.addr; + + /* Initialize a created region. */ + if (F_ISSET(&md->reginfo, REGION_CREATED)) { + region->n_mutex = nitems; + marray = (mutex_entry *)((u_int8_t *)region + + ALIGN(sizeof(mu_region), 32)); + for (i = 0; i < nitems; i++) { + marray[i].val = 0; + __db_mutex_init(&marray[i].m, i); + } + } + + md->marray = + (mutex_entry *)((u_int8_t *)region + ALIGN(sizeof(mu_region), 32)); + md->env = env; + + (void)__db_mutex_unlock(®ion->hdr.lock, md->reginfo.fd); + + /* Create new command name. */ + sprintf(&mutname[0], "mutex%d", mut_number); + mut_number++; + + /* Create widget command. */ + Tcl_CreateCommand(interp, mutname, mutexwidget_cmd, (int *)md, NULL); + Tcl_SetResult(interp, mutname, TCL_VOLATILE); + return (TCL_OK); + +posixout: + Tcl_PosixError(interp); +errout: + if (md != NULL) { + if (md->reginfo.addr != NULL) + (void)__db_rdetach(&md->reginfo); + free(md); + } + if (env != NULL) + free(env); + Tcl_SetResult(interp, "NULL", TCL_STATIC); + return (TCL_OK); +} + +#define MUTEXUNLINK_USAGE "mutex_unlink path" +int +mutexunlink_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + DB_ENV *env; + REGINFO reginfo; + + notused = NULL; + debug_check(); + + USAGE(argc, 3, MUTEXUNLINK_USAGE, 0); + + if (process_env_options(interp, argc, argv, &env)) { + Tcl_SetResult(interp, "mutex_unlink", TCL_STATIC); + Tcl_AppendResult(interp, Tcl_PosixError(interp), 0); + return (TCL_ERROR); + } + + memset(®info, 0, sizeof(reginfo)); + reginfo.dbenv = env; + reginfo.appname = DB_APP_NONE; + reginfo.path = argv[1]; + reginfo.file = MUTEX_FILE; + if (__db_runlink(®info, 1) == 0) + Tcl_SetResult(interp, "0", TCL_STATIC); + else + Tcl_SetResult(interp, "-1", TCL_STATIC); + return (TCL_OK); +} + +/* + * mutexwidget -- + * This is that command that implements the mutex widget. If we + * ever add new "methods" we add new widget commands here. + */ +#define MUTEXWIDGET_USAGE "mutexN option ?arg arg ...?" +#define MUTEXGR_USAGE "mutexN {get,release} id" +#define MUTEXV_USAGE "mutexN {set,get}val id val" +#define MUTEXCLOSE_USAGE "mutexN close" + +int +mutexwidget_cmd(cd_md, interp, argc, argv) + ClientData cd_md; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + mutex_data *md; + u_int32_t id; + int ret, tclint; + char intbuf[50]; + + debug_check(); + + md = (mutex_data *)cd_md; + + USAGE_GE(argc, 2, MUTEXWIDGET_USAGE, 0); + + if (strcmp(argv[1], "close") == 0) { + USAGE(argc, 2, MUTEXCLOSE_USAGE, 0); + (void)__db_rdetach(&md->reginfo); + Tcl_DeleteCommand(interp, argv[0]); + Tcl_SetResult(interp, "0", TCL_STATIC); + return (TCL_OK); + } + USAGE_GE(argc, 3, MUTEXGR_USAGE, 0); + + if (Tcl_GetInt(interp, argv[2], &tclint) != TCL_OK) { + Tcl_PosixError(interp); + return (TCL_ERROR); + } + id = (u_int32_t)tclint; + if (id >= md->region->n_mutex) { + Tcl_SetResult(interp, "Invalid mutex id", TCL_STATIC); + sprintf(intbuf, "%d", id); + Tcl_AppendResult(interp, intbuf, 0); + return (TCL_ERROR); + } + + ret = 0; + if (strcmp(argv[1], "get") == 0) + ret = __db_mutex_lock(&md->marray[id].m, md->reginfo.fd); + else if (strcmp(argv[1], "release") == 0) + ret = __db_mutex_unlock(&md->marray[id].m, md->reginfo.fd); + else if (strcmp(argv[1], "getval") == 0) { + sprintf(intbuf, "%d", md->marray[id].val); + Tcl_SetResult(interp, intbuf, TCL_VOLATILE); + return (TCL_OK); + } else if (strcmp(argv[1], "setval") == 0) { + USAGE(argc, 4, MUTEXV_USAGE, 0); + if (Tcl_GetInt(interp, argv[3], &tclint) != TCL_OK) { + Tcl_PosixError(interp); + return (TCL_ERROR); + } + md->marray[id].val = (u_int32_t)tclint; + } else { + Tcl_SetResult(interp, MUTEXWIDGET_USAGE, TCL_STATIC); + return (TCL_ERROR); + } + + if (ret) + Tcl_SetResult(interp, "-1", TCL_STATIC); + else + Tcl_SetResult(interp, "0", TCL_STATIC); + return (TCL_OK); +} diff --git a/mozilla/db/test/tcl_ndbm.c b/mozilla/db/test/tcl_ndbm.c new file mode 100644 index 00000000000..1861a772c01 --- /dev/null +++ b/mozilla/db/test/tcl_ndbm.c @@ -0,0 +1,244 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)tcl_ndbm.c 10.12 (Sleepycat) 4/27/98"; +#endif /* not lint */ + +/* + * This file is divided up into 2 sets of functions: + * 1. The ndbmopen command and its support functions. + * 2. The ndbmwidget commands. + */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#endif + +#include + +#define DB_DBM_HSEARCH 1 +#include "db_int.h" + +#include "dbtest.h" +#include "test_ext.h" + +/* + * ndbmopen_cmd -- + * Implements dbm_open (the ndbm interface) for dbtest. ndbm_open + * creates a widget that implements all the commands found off in the + * historical ndbm interface. + */ + + +#define NDBMOPEN_USAGE "ndbm_open file flags mode" + +int +ndbmopen_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + static int db_number = 0; + DBM *dbm; + u_int32_t flags; + int mode, oflags, tclint; + char dbname[50], *name; + + notused = NULL; + + /* Check number of arguments. */ + USAGE_GE(argc, 4, NDBMOPEN_USAGE, 0); + + name = strcmp(argv[1], "NULL") == 0 ? NULL : argv[1]; + + debug_check(); + + /* Check flags and mode. */ + if (Tcl_GetInt(interp, argv[2], &tclint) != TCL_OK) + goto usage; + flags = (u_int32_t)tclint; + if (Tcl_GetInt(interp, argv[3], &mode) != TCL_OK) { +usage: Tcl_ResetResult(interp); + Tcl_AppendResult(interp, "\nUsage: ", NDBMOPEN_USAGE, NULL); + return (TCL_OK); + } + oflags = 0; + if (flags & DB_RDONLY) + oflags |= O_RDONLY; + else + oflags |= O_RDWR; + if (flags & DB_CREATE) + oflags |= O_CREAT; + if (flags & DB_TRUNCATE) + oflags |= O_TRUNC; + + /* Call dbm_open. */ + if ((dbm = dbm_open(name, oflags, mode)) == NULL) { + Tcl_SetResult(interp, "ndbm_open: ", TCL_STATIC); + Tcl_AppendResult(interp, Tcl_PosixError(interp), NULL); + return (TCL_OK); + } + + /* Create widget command. */ + /* Create new command name. */ + sprintf(&dbname[0], "ndbm%d", db_number); + db_number++; + + Tcl_CreateCommand(interp, dbname, ndbmwidget_cmd, + (ClientData)dbm, NULL); + Tcl_SetResult(interp, dbname, TCL_VOLATILE); + return (TCL_OK); +} + + +/* + * ndbmwidget -- + * Since ndbm_open creates a widget, we need a command that then + * handles all the widget commands. This is that command. If we + * ever add new "methods" we add new widget commands here. + */ + +#define NDBMWIDGET_USAGE "ndbmN option ?arg arg ...?" +#define NDBMCLEAR_USAGE "ndbmN clearerr" +#define NDBMCLOSE_USAGE "ndbmN close" +#define NDBMDEL_USAGE "ndbmN delete key" +#define NDBMDIRFNO_USAGE "ndbmM dirfno" +#define NDBMERROR_USAGE "ndbmN error" +#define NDBMFETCH_USAGE "ndbmN fetch key" +#define NDBMFIRST_USAGE "ndbmN firstkey" +#define NDBMNEXT_USAGE "ndbmN nextkey" +#define NDBMPAGFNO_USAGE "ndbmM pagfno" +#define NDBMRDONLY_USAGE "ndbmM rdonly" +#define NDBMSTORE_USAGE "ndbmN store key datum flags" + +int +ndbmwidget_cmd(cd_dbm, interp, argc, argv) + ClientData cd_dbm; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + DBM *dbm; + datum data, key; + int flags, ret; + char *cmd, fdval[16]; + + COMPQUIET(cmd, NULL); + + USAGE_GE(argc, 2, NDBMWIDGET_USAGE, 0); + + Tcl_SetResult(interp, "0", TCL_STATIC); + + dbm = (DBM *)cd_dbm; + + if (strcmp(argv[1], "clearerr") == 0) { + USAGE(argc, 2, NDBMCLEAR_USAGE, 0); + debug_check(); + ret = dbm_clearerr(dbm); + cmd = "dbm_clearerr:"; + } else if (strcmp(argv[1], "close") == 0) { + USAGE(argc, 2, NDBMCLOSE_USAGE, 0); + debug_check(); + dbm_close(dbm); + (void)Tcl_DeleteCommand(interp, argv[0]); + ret = 0; + } else if (strcmp(argv[1], "delete") == 0) { + USAGE(argc, 3, NDBMDEL_USAGE, 0); + key.dptr = argv[2]; + key.dsize = strlen(argv[2]) + 1; + debug_check(); + ret = dbm_delete(dbm, key); + cmd = "dbm_delete:"; + } else if (strcmp(argv[1], "dirfno") == 0) { + USAGE(argc, 2, NDBMDIRFNO_USAGE, 0); + ret = dbm_dirfno(dbm); + sprintf(fdval, "%d", ret); + Tcl_SetResult(interp, fdval, TCL_VOLATILE); + return (TCL_OK); + } else if (strcmp(argv[1], "error") == 0) { + USAGE(argc, 2, NDBMERROR_USAGE, 0); + debug_check(); + errno = dbm_error(dbm); + Tcl_SetResult(interp, Tcl_PosixError(interp), TCL_STATIC); + return (TCL_OK); + } else if (strcmp(argv[1], "fetch") == 0) { + USAGE(argc, 3, NDBMFETCH_USAGE, 0); + key.dptr = argv[2]; + key.dsize = strlen(argv[2]) + 1; + debug_check(); + data = dbm_fetch(dbm, key); + if (data.dptr == NULL) + Tcl_SetResult(interp, "-1", TCL_STATIC); + else + Tcl_SetResult(interp, data.dptr, TCL_VOLATILE); + return (TCL_OK); + } else if (strcmp(argv[1], "firstkey") == 0) { + USAGE(argc, 2, NDBMFIRST_USAGE, 0); + debug_check(); + key = dbm_firstkey(dbm); + if (key.dptr == NULL) + Tcl_SetResult(interp, "-1", TCL_STATIC); + else + Tcl_SetResult(interp, key.dptr, TCL_VOLATILE); + return (TCL_OK); + } else if (strcmp(argv[1], "nextkey") == 0) { + USAGE(argc, 2, NDBMNEXT_USAGE, 0); + debug_check(); + data = dbm_nextkey(dbm); + if (data.dptr == NULL) + Tcl_SetResult(interp, "-1", TCL_STATIC); + else + Tcl_SetResult(interp, data.dptr, TCL_VOLATILE); + return (TCL_OK); + } else if (strcmp(argv[1], "pagfno") == 0) { + USAGE(argc, 2, NDBMPAGFNO_USAGE, 0); + ret = dbm_pagfno(dbm); + sprintf(fdval, "%d", ret); + Tcl_SetResult(interp, fdval, TCL_VOLATILE); + return (TCL_OK); + } else if (strcmp(argv[1], "rdonly") == 0) { + USAGE(argc, 2, NDBMRDONLY_USAGE, 0); + if (dbm_rdonly(dbm)) + Tcl_SetResult(interp, "1", TCL_STATIC); + else + Tcl_SetResult(interp, "0", TCL_STATIC); + return (TCL_OK); + } else if (strcmp(argv[1], "store") == 0) { + USAGE(argc, 5, NDBMSTORE_USAGE, 0); + if (Tcl_GetInt(interp, argv[4], &flags) != TCL_OK) + return (TCL_ERROR); + key.dptr = argv[2]; + key.dsize = strlen(argv[2]) + 1; + data.dptr = argv[3]; + data.dsize = strlen(argv[3]) + 1; + debug_check(); + ret = dbm_store(dbm, key, data, flags); + cmd = "dbm_store:"; + } else { + Tcl_SetResult(interp, NDBMWIDGET_USAGE, TCL_STATIC); + return (TCL_ERROR); + } + + if (ret == 0) + Tcl_SetResult(interp, "0", TCL_STATIC); + else if (ret > 0) + Tcl_SetResult(interp, "Not found", TCL_STATIC); + else { + Tcl_SetResult(interp, cmd, TCL_STATIC); + Tcl_AppendResult(interp, Tcl_PosixError(interp), 0); + } + return (TCL_OK); +} diff --git a/mozilla/db/test/tcl_txn.c b/mozilla/db/test/tcl_txn.c new file mode 100644 index 00000000000..fd4c0c43807 --- /dev/null +++ b/mozilla/db/test/tcl_txn.c @@ -0,0 +1,346 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)tcl_txn.c 10.15 (Sleepycat) 5/31/98"; +#endif /* not lint */ + +/* + * This file is divided up into 5 sets of functions: + * 1. The txn command and its support functions. + * 2. The txn_unlink command. + * 3. The txn manager widget commands. + * 4. The txn widget commands. + */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#endif +#include + +#include "db_int.h" +#include "dbtest.h" +#include "test_ext.h" + +typedef struct _txn_data { + DB_ENV *env; + DB_TXNMGR *txnp; +} txn_data; + +/* + * txn_cmd -- + * Implements txn_open for dbtest. Txn_open creates a transaction + * manager and all the necessary files in the file system. It then creates + * a command that implements the other transaction functions. + */ + +#define TXNMGR_USAGE "txn path flags mode [options]\n\toptions:\n" + +int +txnmgr_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + static int mgr_number = 0; + DB_ENV *env; + DB_TXNMGR *mgrp; + txn_data *td; + int mode, tclint; + u_int32_t flags; + char mgrname[50]; + + notused = NULL; + debug_check(); + + /* Check number of arguments. */ + USAGE_GE(argc, 4, TXNMGR_USAGE, DO_ENV); + if (Tcl_GetInt(interp, argv[2], &tclint) != TCL_OK) + return (TCL_ERROR); + flags = (u_int32_t)tclint; + + /* Don't specify DB_THREAD if the architecture can't do spinlocks. */ +#ifndef HAVE_SPINLOCKS + LF_CLR(DB_THREAD); +#endif + if (Tcl_GetInt(interp, argv[3], &mode) != TCL_OK) + return (TCL_ERROR); + + /* + * Call txn_open. + * For now the recovery proc is NULL + */ + if (process_env_options(interp, argc, argv, &env)) { + Tcl_SetResult(interp, "NULL", TCL_STATIC); + return (TCL_OK); + } + + if (F_ISSET(env, DB_ENV_STANDALONE)) + mgrp = env->tx_info; + else if (txn_open(argv[1], flags, mode, env, &mgrp) != 0) { + Tcl_SetResult(interp, "NULL", TCL_STATIC); + return (TCL_OK); + } else + env->tx_info = mgrp; + + td = (txn_data *)malloc(sizeof(txn_data)); + if (td == NULL) { + if (!F_ISSET(env, DB_ENV_STANDALONE)) { + (void)db_appexit(env); + if (env->lk_conflicts) + free(env->lk_conflicts); + free(env); + } + Tcl_SetResult(interp, "txn_open: ", TCL_STATIC); + errno = ENOMEM; + Tcl_AppendResult(interp, Tcl_PosixError(interp), 0); + return (TCL_ERROR); + } + td->txnp = mgrp; + td->env = env; + + /* Create new command name. */ + sprintf(&mgrname[0], "mgr%d", mgr_number); + mgr_number++; + + /* Create widget command. */ + Tcl_CreateCommand(interp, mgrname, txnwidget_cmd, (int *)td, NULL); + Tcl_SetResult(interp, mgrname, TCL_VOLATILE); + return (TCL_OK); +} + +/* + * txnunlink_cmd -- + * Implements txn_unlink for dbtest. + */ + +#define TXNUNLINK_USAGE "txn_unlink path force" + +int +txnunlink_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + int force; + + notused = NULL; + debug_check(); + + USAGE_GE(argc, 3, TXNUNLINK_USAGE, 0); + + if (Tcl_GetInt(interp, argv[2], &force) != TCL_OK) + return (TCL_ERROR); + + if (txn_unlink(argv[1], force, NULL) != 0) + Tcl_SetResult(interp, "-1", TCL_STATIC); + else + Tcl_SetResult(interp, "0", TCL_STATIC); + return (TCL_OK); +} + +/* + * txnwidget -- + * This is that command that implements the txn widget. If we + * ever add new "methods" we add new widget commands here. + */ +#define TXNWIDGET_USAGE "mgrN option ?arg arg ...?" +#define TXNBEGIN_USAGE "mgrN begin [parent]" +#define TXNCHECK_USAGE "mgrN checkpoint [kbytes] [minutes]" +#define TXNCLOSE_USAGE "mgrN close" +#define TXNSTAT_USAGE "mgrN stat" + +int +txnwidget_cmd(cd_mgr, interp, argc, argv) + ClientData cd_mgr; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + static int id = 0; + DB_ENV *env; + DB_TXN *txn, *parent; + DB_TXNMGR *mgr; + DB_TXN_STAT *statp; + Tcl_CmdInfo info; + u_int32_t i, kbytes, minutes; + int ret, tclint; + char *p, *statbuf, txnname[128]; + + debug_check(); + + mgr = ((txn_data *)cd_mgr)->txnp; + + USAGE_GE(argc, 2, TXNWIDGET_USAGE, 0); + + if (strcmp(argv[1], "close") == 0) { + USAGE(argc, 2, TXNCLOSE_USAGE, 0); + env = ((txn_data *)cd_mgr)->env; + if (!F_ISSET(env, DB_ENV_STANDALONE)) { + (void)db_appexit(env); + if (env->lk_conflicts) + free(env->lk_conflicts); + free(env); + } + ret = Tcl_DeleteCommand(interp, argv[0]); + if (ret) + Tcl_SetResult(interp, "-1", TCL_STATIC); + else + Tcl_SetResult(interp, "0", TCL_STATIC); + return (ret); + } else if (strcmp(argv[1], "begin") == 0) { + USAGE_GE(argc, 2, TXNBEGIN_USAGE, 0); + if (argc == 3) { + if (Tcl_GetCommandInfo(interp, argv[2], &info) == 0) { + Tcl_SetResult(interp, + "txn_begin: Invalid argument ", TCL_STATIC); + Tcl_AppendResult(interp, argv[2], + " not a transaction.", 0); + return (TCL_ERROR); + } + parent = (DB_TXN *)(info.clientData); + } else { + USAGE(argc, 2, TXNBEGIN_USAGE, 0); + parent = NULL; + } + + if ((ret = txn_begin(mgr, parent, &txn)) != 0) { + Tcl_SetResult(interp, "NULL", TCL_STATIC); + return (TCL_OK); + } + + sprintf(&txnname[0], "%s.txn%d", argv[0], id); + id++; + + Tcl_CreateCommand(interp, txnname, txn_cmd, (int *)txn, NULL); + Tcl_SetResult(interp, txnname, TCL_VOLATILE); + } else if (strcmp(argv[1], "check") == 0) { + USAGE_GE(argc, 2, TXNCHECK_USAGE, 0); + if (argc <= 2 || + (Tcl_GetInt(interp, argv[2], &tclint) != TCL_OK)) + tclint = 0; + kbytes = (u_int32_t)tclint; + + if (argc <= 3 || + (Tcl_GetInt(interp, argv[3], &tclint) != TCL_OK)) + tclint = 0; + minutes = (u_int32_t)tclint; + + if ((ret = txn_checkpoint(mgr, kbytes, minutes)) != 0) { + Tcl_SetResult(interp, "txn_checkpoint: ", TCL_STATIC); + if (ret > 0) { + errno = ret; + Tcl_AppendResult(interp, + Tcl_PosixError(interp), 0); + } else + Tcl_AppendResult(interp, + "Checkpoint pending", 0); + return (TCL_ERROR); + } + } else if (strcmp(argv[1], "stat") == 0) { + USAGE_GE(argc, 2, TXNSTAT_USAGE, 0); + if ((ret = txn_stat(mgr, &statp, NULL)) != 0) { + errno = ret; + Tcl_AppendResult(interp, Tcl_PosixError(interp), 0); + return (TCL_ERROR); + } + /* + * Allocate space for return message. Assume every u_int32_t + * will be printed out maximum size and with a label of 12 + * bytes. Then figure that we need 3 u_int32_t's for each + * active transaction. Leave plenty of room for newlines + * and space. + */ + statbuf = (char *)malloc(sizeof(DB_TXN_STAT) / sizeof(u_int32_t) + + (statp->st_nactive * 3) * (24 + 16)); + sprintf(statbuf, "%s %lx\n%s [%lu, %lu]\n%s %lu\n%s %lu\n%s %lu\n%s %lu\n%s %lu\n%s [%lu, %lu]\n", + "last txn id ", (unsigned long)statp->st_last_txnid, + "last ckp ", (unsigned long)statp->st_last_ckp.file, + (unsigned long)statp->st_last_ckp.offset, + "max txns ", (unsigned long)statp->st_maxtxns, + "Aborted txns ", (unsigned long)statp->st_naborts, + "Begun txns ", (unsigned long)statp->st_nbegins, + "Commited txns", (unsigned long)statp->st_ncommits, + "Active txns ", (unsigned long)statp->st_nactive, + "Pending ckp ", (unsigned long)statp->st_pending_ckp.file, + (unsigned long)statp->st_pending_ckp.offset); + Tcl_AppendResult(interp, "last ckp time ", + ctime(&statp->st_time_ckp), NULL); + p = statbuf + strlen(statbuf); + for (i = 0; i < statp->st_nactive; i++) { + sprintf(p, "%lx: %lu/%lu\n", + (unsigned long)statp->st_txnarray[i].txnid, + (unsigned long)statp->st_txnarray[i].lsn.file, + (unsigned long)statp->st_txnarray[i].lsn.offset); + p += strlen(p); + } + Tcl_SetResult(interp, statbuf, TCL_DYNAMIC); + } else { + Tcl_SetResult(interp, TXNWIDGET_USAGE, TCL_STATIC); + return (TCL_ERROR); + } + return (TCL_OK); +} + +#define TXN_USAGE "mgrN.txnM cmd ?arg arg ...?" +#define TXNCOMMIT_USAGE "mgrN.txnM commit" +#define TXNABORT_USAGE "mgrN.txnM abort" +#define TXNID_USAGE "mgrN.txnM id" +#define TXNPREP_USAGE "mgrN.txnM prep" +int +txn_cmd(cd_txn, interp, argc, argv) + ClientData cd_txn; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + DB_TXN *txn; + int ret; + char idbuf[16]; + + debug_check(); + + USAGE_GE(argc, 2, TXN_USAGE, 0); + + txn = (DB_TXN *)cd_txn; + + if (strcmp(argv[1], "commit") == 0) { + USAGE(argc, 2, TXNCOMMIT_USAGE, 0); + Tcl_DeleteCommand(interp, argv[0]); + ret = txn_commit(txn); + } else if (strcmp(argv[1], "abort") == 0) { + USAGE(argc, 2, TXNABORT_USAGE, 0); + Tcl_DeleteCommand(interp, argv[0]); + ret = txn_abort(txn); + } else if (strcmp(argv[1], "id") == 0) { + USAGE(argc, 2, TXNID_USAGE, 0); + ret = txn_id(txn); + sprintf(idbuf, "%d", ret); + Tcl_SetResult(interp, idbuf, TCL_VOLATILE); + return (TCL_OK); + } else if (strcmp(argv[1], "prepare") == 0) { + USAGE(argc, 2, TXNPREP_USAGE, 0); + ret = txn_prepare(txn); + } else { + Tcl_SetResult(interp, TXN_USAGE, TCL_STATIC); + return (TCL_ERROR); + } + if (ret) + Tcl_SetResult(interp, "-1", TCL_STATIC); + else + Tcl_SetResult(interp, "0", TCL_STATIC); + return (TCL_OK); +} diff --git a/mozilla/db/test/test.tcl b/mozilla/db/test/test.tcl new file mode 100644 index 00000000000..655fd20f363 --- /dev/null +++ b/mozilla/db/test/test.tcl @@ -0,0 +1,325 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test.tcl 10.28 (Sleepycat) 5/31/98 + +source ./include.tcl +source ../test/testutils.tcl +source ../test/byteorder.tcl + +set testdir ./TESTDIR +if { [file exists $testdir] != 1 } { + exec $MKDIR $testdir +} + +set is_windows_test 0 + +set parms(test001) 10000 +set parms(test002) 10000 +set parms(test003) "" +set parms(test004) {10000 4 0} +set parms(test005) 10000 +set parms(test006) {10000 6} +set parms(test007) 10000 +set parms(test008) {10000 8 0} +set parms(test009) 10000 +set parms(test010) {10000 5 10} +set parms(test011) {10000 5 11} +set parms(test012) "" +set parms(test013) 10000 +set parms(test014) 10000 +set parms(test015) {7500 0} +set parms(test016) 10000 +set parms(test017) 10000 +set parms(test018) 10000 +set parms(test019) 10000 +set parms(test020) 10000 +set parms(test021) 10000 +set parms(test022) "" +set parms(test023) "" +set parms(test024) 10000 +set parms(test025) 10000 +set parms(test026) {2000 5 26} +set parms(test027) {100} +set parms(test028) "" +set parms(test029) 10000 + +set dict ../test/wordlist +set alphabet "abcdefghijklmnopqrstuvwxyz" +set recd_debug 0 + +set loadtests 33 +set runtests 29 +set recdtests 5 +set deadtests 2 +set bugtests 7 +set rsrctests 1 +for { set i 1 } { $i <= $loadtests } {incr i} { + set name [format "test%03d.tcl" $i] + source ../test/$name +} +for { set i 1 } { $i <= $recdtests } {incr i} { + set name [format "recd%03d.tcl" $i] + source ../test/$name +} +for { set i 1 } { $i <= $deadtests } {incr i} { + set name [format "dead%03d.tcl" $i] + source ../test/$name +} +for { set i 1 } { $i <= $bugtests } {incr i} { + set name [format "bug%03d.tcl" $i] + source ../test/$name +} +for { set i 1 } { $i <= $rsrctests } {incr i} { + set name [format "rsrc%03d.tcl" $i] + source ../test/$name +} + +source ../test/archive.tcl +source ../test/dbm.tcl +source ../test/hsearch.tcl +source ../test/lock.tcl +source ../test/mpool.tcl +source ../test/mlock.tcl +source ../test/mutex.tcl +source ../test/ndbm.tcl +source ../test/randomlock.tcl +source ../test/log.tcl +source ../test/txn.tcl + +# Test driver programs + +# Use args for options +proc run_method { method {start 1} {stop 0} args } { + global parms + global debug_print + global debug_on + global runtests + if { $stop == 0 } { + set stop $runtests + } + puts "run_method: $method $start $stop $args" + + for { set i $start } { $i <= $stop } {incr i} { + puts "[timestamp]" + set name [format "test%03d" $i] + eval $name $method $parms($name) $args + if { $debug_print != 0 } { + puts "" + } + if { $debug_on != 0 } { + debug + } + flush stdout + flush stderr + } +} + +proc r { args } { + global recdtests + + set l [ lindex $args 0 ] + switch $l { + ampool { eval mpool -shmem anon [lrange $args 1 end] } + archive { eval archive [lrange $args 1 end] } + byte { + foreach method "DB_HASH DB_BTREE DB_RECNO DB_RRECNO" { + byteorder $method + } + } + dbm { eval dbm } + dead { + eval dead001 [lrange $args 1 end] + eval dead002 [lrange $args 1 end] + } + hsearch { eval htest } + lock { eval locktest [lrange $args 1 end] } + log { eval logtest [lrange $args 1 end] } + mpool { eval mpool [lrange $args 1 end] } + nmpool { eval mpool -shmem named [lrange $args 1 end] } + mutex { eval mutex [lrange $args 1 end] } + ndbm { eval ndbm } + recd { + foreach method "DB_HASH DB_BTREE DB_RECNO DB_RRECNO" { + for { set i 1 } {$i <= $recdtests} {incr i} { + set name [format "recd%03d" $i] + eval $name $method + flush stdout + flush stderr + } + } + } + rsrc { + eval rsrc001 + } + txn { eval txntest [lrange $args 1 end] } + default { eval run_method $args } + } + flush stdout + flush stderr +} + +proc run_all { } { +source include.tcl +global runtests +global recdtests + exec $RM -rf ALL.OUT + foreach i "archive byte lock log mpool ampool nmpool mutex txn" { + puts "Running $i tests" + if [catch {exec ./dbtest << "r $i" >>& ALL.OUT } res] { + set o [open ALL.OUT a] + puts $o "FAIL: $i test" + close $o + } + } + + # Add deadlock detector tests + puts "Running deadlock detection tests." + if [catch {exec ./dbtest << "r dead" >>& ALL.OUT} res] { + set o [open ALL.OUT a] + puts $o "FAIL: deadlock detector test" + close $o + } + + + foreach i "DB_BTREE DB_RBTREE DB_HASH DB_RECNO DB_RRECNO" { + puts "Running $i tests" + for { set j 1 } { $j <= $runtests } {incr j} { + if [catch {exec ./dbtest << "run_method $i $j $j" \ + >>& ALL.OUT } res] { + set o [open ALL.OUT a] + puts $o "FAIL: [format "test%03d" $j] $i" + close $o + } + } + } + + puts "Running RECNO source tests" + if [catch {exec ./dbtest << "r rsrc" >>& ALL.OUT } res] { + set o [open ALL.OUT a] + puts $o "FAIL: $i test" + close $o + } + + # Run recovery tests + foreach method "DB_HASH DB_BTREE DB_RECNO DB_RRECNO" { + puts "Running recovery tests for $method" + for { set i 1 } {$i <= $recdtests} {incr i} { + set name [format "recd%03d" $i] + if [catch {exec ./dbtest << "$name $method" \ + >>& ALL.OUT } res] { + set o [open ALL.OUT a] + puts $o "FAIL: $name $method" + close $o + } + } + } + + # Check historic interfaces + foreach t "dbm ndbm hsearch" { + if [catch {exec ./dbtest << "r $t" >>& ALL.OUT} res] { + set o [open ALL.OUT a] + puts $o "FAIL: $t test" + close $o + } + } + + catch { exec $SED -e /^FAIL/p -e d ALL.OUT } res + if { [string length $res] == 0 } { + puts "Regression Tests Succeeded" + } else { + puts "Regression Tests Failed; see ALL.OUT for log" + } +} + +proc convert_method { method } { + switch $method { + rrecno { return DB_RECNO } + RRECNO { return DB_RECNO } + db_rrecno { return DB_RECNO } + DB_RRECNO { return DB_RECNO } + rrec { return DB_RECNO } + recno { return DB_RECNO } + RECNO { return DB_RECNO } + db_recno { return DB_RECNO } + DB_RECNO { return DB_RECNO } + rec { return DB_RECNO } + btree { return DB_BTREE } + BTREE { return DB_BTREE } + db_btree { return DB_BTREE } + DB_BTREE { return DB_BTREE } + bt { return DB_BTREE } + rbtree { return DB_BTREE } + RBTREE { return DB_BTREE } + db_rbtree { return DB_BTREE } + DB_RBTREE { return DB_BTREE } + rbt { return DB_BTREE } + hash { return DB_HASH } + HASH { return DB_HASH } + db_hash { return DB_HASH } + DB_HASH { return DB_HASH } + h { return DB_HASH } + } +} + +proc is_rrecno { method } { + set names { rrecno RRECNO db_rrecno DB_RRECNO rrec } + if { [lsearch $names $method] >= 0 } { + return 1 + } else { + return 0 + } +} + +proc is_rbtree { method } { + set names { rbtree RBTREE db_rbtree DB_RBTREE rbt } + if { [lsearch $names $method] >= 0 } { + return 1 + } else { + return 0 + } +} + + +# If recno-with-renumbering or btree-with-renumbering is specified, then +# fix the arguments to specify the DB_RENUMBER/DB_RECNUM option for the +# -flags argument. +proc convert_args { method {largs ""} } { +source ./include.tcl + set do_flags 0 + if { [is_rrecno $method] == 1 } { + return [add_to_args $DB_RENUMBER $largs] + } elseif { [is_rbtree $method] == 1 } { + return [add_to_args $DB_RECNUM $largs] + } + return $largs +} + +# Make sure the DB_RECNUM flag is set if we are doing btree. +proc number_btree { method {largs ""} } { +source ./include.tcl + if { [string compare $method "DB_BTREE"] == 0 } { + return [add_to_args $DB_RECNUM $largs] + } + return $largs +} + +# We want to set a flag value. Since there already might be one in +# args, we need to add to it. +proc add_to_args { flag_val {largs ""} } { +source ./include.tcl + set ndx [lsearch $largs -flags] + if { $ndx >= 0 } { + # There is already a flags argument + incr ndx + set f [lindex $largs $ndx] + set f [expr $f | $flag_val] + set largs [lreplace $largs $ndx $ndx $f] + } else { + # There is no flags argument + lappend largs -flags $flag_val + } + return $largs +} diff --git a/mozilla/db/test/test001.tcl b/mozilla/db/test/test001.tcl new file mode 100644 index 00000000000..cfcc1223909 --- /dev/null +++ b/mozilla/db/test/test001.tcl @@ -0,0 +1,121 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test001.tcl 10.7 (Sleepycat) 4/26/98 +# +# DB Test 1 {access method} +# Use the first 10,000 entries from the dictionary. +# Insert each with self as key and data; retrieve each. +# After all are entered, retrieve all; compare output to original. +# Close file, reopen, do retrieve and re-verify. +proc test001 { method {nentries 10000} args } { + set args [convert_args $method $args] + set method [convert_method $method] + puts "Test001: $method ($args) $nentries equal key/data pairs" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile test001.db + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + cleanup $testdir + set db [eval [concat dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method $args]] + error_check_good dbopen [is_valid_db $db] TRUE + set did [open $dict] + + set flags 0 + set txn 0 + set count 0 + + if { [string compare $method DB_RECNO] == 0 } { + set checkfunc test001_recno.check + set put putn + } else { + set checkfunc test001.check + set put put + } + puts "\tTest001.a: put/get loop" + # Here is the loop where we put and get each key/data pair + while { [gets $did str] != -1 && $count < $nentries } { + if { [string compare $method DB_RECNO] == 0 } { + global kvals + + set key [expr $count + 1] + set kvals($key) $str + } else { + set key $str + } + set ret [$db $put $txn $key $str $flags] + error_check_good put $ret 0 + + set ret [$db get $txn $key $flags] + error_check_good get $ret $str + incr count + } + close $did + # Now we will get each key from the DB and compare the results + # to the original. + puts "\tTest001.b: dump file" + dump_file $db $txn $t1 $checkfunc + error_check_good db_close [$db close] 0 + + # Now compare the keys to see if they match the dictionary (or ints) + if { [string compare $method DB_RECNO] == 0 } { + set oid [open $t2 w] + for {set i 1} {$i <= $nentries} {set i [incr i]} { + puts $oid $i + } + close $oid + exec $MV $t1 $t3 + } else { + set q q + exec $SED $nentries$q $dict > $t2 + exec $SORT $t1 > $t3 + } + + error_check_good Test001:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + + puts "\tTest001.c: close, open, and dump file" + # Now, reopen the file and run the last test again. + open_and_dump_file $testfile NULL $txn $t1 $checkfunc \ + dump_file_direction $DB_FIRST $DB_NEXT + if { [string compare $method DB_RECNO] != 0 } { + exec $SORT $t1 > $t3 + } + + error_check_good Test001:diff($t2,$t3) \ + [catch { exec $DIFF $t2 $t3 } res] 0 + + # Now, reopen the file and run the last test again in the + # reverse direction. + puts "\tTest001.d: close, open, and dump file in reverse direction" + open_and_dump_file $testfile NULL $txn $t1 $checkfunc \ + dump_file_direction $DB_LAST $DB_PREV + + if { [string compare $method DB_RECNO] != 0 } { + exec $SORT $t1 > $t3 + } + + error_check_good Test001:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 +} + +# Check function for test001; keys and data are identical +proc test001.check { key data } { + error_check_good "key/data mismatch" $data $key +} + +proc test001_recno.check { key data } { +global dict +global kvals + error_check_good key"$key"_exists [info exists kvals($key)] 1 + error_check_good "key/data mismatch, key $key" $data $kvals($key) +} diff --git a/mozilla/db/test/test002.tcl b/mozilla/db/test/test002.tcl new file mode 100644 index 00000000000..e6bed298a15 --- /dev/null +++ b/mozilla/db/test/test002.tcl @@ -0,0 +1,111 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test002.tcl 10.6 (Sleepycat) 4/26/98 +# +# DB Test 2 {access method} +# Use the first 10,000 entries from the dictionary. +# Insert each with self as key and a fixed, medium length data string; +# retrieve each. After all are entered, retrieve all; compare output +# to original. Close file, reopen, do retrieve and re-verify. + +set datastr abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz + +proc test002 { method {nentries 10000} args } { + global datastr + set args [convert_args $method $args] + set method [convert_method $method] + puts "Test002: $method ($args) $nentries key pairs" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile test002.db + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + cleanup $testdir + set db [eval [concat dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method $args]] + error_check_good dbopen [is_valid_db $db] TRUE + set did [open $dict] + + set flags 0 + set txn 0 + set count 0 + + # Here is the loop where we put and get each key/data pair + + puts "\tTest002.a: put/get loop" + while { [gets $did str] != -1 && $count < $nentries } { + if { [string compare $method DB_RECNO] == 0 } { + set key [expr $count + 1] + set put putn + } else { + set key $str + set put put + } + set ret [$db $put $txn $key $datastr $flags] + error_check_good put $ret 0 + + set ret [$db get $txn $key $flags] + error_check_good get $ret $datastr + incr count + } + close $did + + # Now we will get each key from the DB and compare the results + # to the original. + puts "\tTest002.b: dump file" + dump_file $db $txn $t1 test002.check + error_check_good db_close [$db close] 0 + + # Now compare the keys to see if they match the dictionary + if { [string compare $method DB_RECNO] == 0 } { + set oid [open $t2 w] + for {set i 1} {$i <= $nentries} {set i [incr i]} { + puts $oid $i + } + close $oid + exec $MV $t1 $t3 + } else { + set q q + exec $SED $nentries$q $dict > $t2 + exec $SORT $t1 > $t3 + } + + error_check_good Test002:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + + # Now, reopen the file and run the last test again. + puts "\tTest002.c: close, open, and dump file" + open_and_dump_file $testfile NULL $txn $t1 test002.check \ + dump_file_direction $DB_FIRST $DB_NEXT + + if { [string compare $method DB_RECNO] != 0 } { + exec $SORT $t1 > $t3 + } + error_check_good Test002:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + + # Now, reopen the file and run the last test again in reverse direction. + puts "\tTest002.d: close, open, and dump file in reverse direction" + open_and_dump_file $testfile NULL $txn $t1 test002.check \ + dump_file_direction $DB_LAST $DB_PREV + + if { [string compare $method DB_RECNO] != 0 } { + exec $SORT $t1 > $t3 + } + error_check_good Test002:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 +} + +# Check function for test002; data should be fixed are identical +proc test002.check { key data } { + global datastr + error_check_good "data mismatch for key $key" $data $datastr +} diff --git a/mozilla/db/test/test003.tcl b/mozilla/db/test/test003.tcl new file mode 100644 index 00000000000..b64791e6a7f --- /dev/null +++ b/mozilla/db/test/test003.tcl @@ -0,0 +1,131 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test003.tcl 10.8 (Sleepycat) 4/28/98 + +# DB Test 3 {access method} +# Take the source files and dbtest executable and enter their names as the +# key with their contents as data. After all are entered, retrieve all; +# compare output to original. Close file, reopen, do retrieve and re-verify. +proc test003 { method args} { + global names + set args [convert_args $method $args] + set method [convert_method $method] + puts "Test003: $method ($args) filename=key filecontents=data pairs" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile test003.db + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + set t4 $testdir/t4 + + cleanup $testdir + set db [eval [concat dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method $args]] + error_check_good dbopen [is_valid_db $db] TRUE + set flags 0 + set txn 0 + if { [string compare $method DB_RECNO] == 0 } { + set checkfunc test003_recno.check + } else { + set checkfunc test003.check + } + + # Here is the loop where we put and get each key/data pair + set file_list [glob ../*/*.c ./dbtest ./dbtest.exe] + + puts "\tTest003.a: put/get loop" + set count 0 + foreach f $file_list { + if { [string compare $method DB_RECNO] == 0 } { + set key [expr $count + 1] + set names([expr $count + 1]) $f + } else { + set key $f + } + $db putbin $txn $key ./$f $flags + set ret [$db getbin $t4 $txn $key $flags] + + error_check_good Test003:diff(./$f,$t4) \ + [catch { exec $DIFF ./$f $t4 } res] 0 + + incr count + } + + # Now we will get each key from the DB and compare the results + # to the original. + puts "\tTest003.b: dump file" + dump_bin_file $db $txn $t1 $checkfunc + error_check_good db_close [$db close] 0 + + # Now compare the keys to see if they match the entries in the + # current directory + if { [string compare $method DB_RECNO] == 0 } { + set oid [open $t2 w] + for {set i 1} {$i <= $count} {set i [incr i]} { + puts $oid $i + } + close $oid + exec $MV $t1 $t3 + } else { + set oid [open $t2.tmp w] + foreach f $file_list { + puts $oid $f + } + close $oid + exec $SORT $t2.tmp > $t2 + exec $RM $t2.tmp + exec $SORT $t1 > $t3 + } + + error_check_good Test003:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + + # Now, reopen the file and run the last test again. + puts "\tTest003.c: close, open, and dump file" + open_and_dump_file $testfile NULL $txn $t1 $checkfunc \ + dump_bin_file_direction $DB_FIRST $DB_NEXT + + if { [string compare $method DB_RECNO] != 0 } { + exec $SORT $t1 > $t3 + } + + error_check_good Test003:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + + # Now, reopen the file and run the last test again in reverse direction. + puts "\tTest003.d: close, open, and dump file in reverse direction" + open_and_dump_file $testfile NULL $txn $t1 $checkfunc \ + dump_bin_file_direction $DB_LAST $DB_PREV + + if { [string compare $method DB_RECNO] != 0 } { + exec $SORT $t1 > $t3 + } + + error_check_good Test003:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 +} + +# Check function for test003; key should be file name; data should be contents +proc test003.check { binfile tmpfile } { + source ./include.tcl + + error_check_good Test003:datamismatch(./$binfile,$tmpfile) \ + [catch { exec $DIFF ./$binfile $tmpfile } res] 0 +} +proc test003_recno.check { binfile tmpfile } { + global names + source ./include.tcl + + set fname $names($binfile) + error_check_good key"$binfile"_exists [info exists names($binfile)] 1 + error_check_good Test003:datamismatch(./$fname,$tmpfile) \ + [catch { exec $DIFF ./$fname $tmpfile } res] 0 +} diff --git a/mozilla/db/test/test004.tcl b/mozilla/db/test/test004.tcl new file mode 100644 index 00000000000..ff5317c1398 --- /dev/null +++ b/mozilla/db/test/test004.tcl @@ -0,0 +1,116 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test004.tcl 10.5 (Sleepycat) 4/10/98 +# +# DB Test 4 {access method} +# Check that cursor operations work. Create a database. +# Read through the database sequentially using cursors and +# delete each element. +proc test004 { method {nentries 10000} {reopen 4} {build_only 0} args} { + set tnum Test00$reopen + set do_renumber [is_rrecno $method] + set args [convert_args $method $args] + set method [convert_method $method] + puts -nonewline "$tnum: $method ($args) $nentries delete small key; medium data pairs" + if {$reopen == 5} { + puts "(with close)" + } else { + puts "" + } + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile test004.db + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + cleanup $testdir + set db [eval [concat dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method $args]] + error_check_good dbopen [is_valid_db $db] TRUE + + set did [open $dict] + + set flags 0 + set txn 0 + set count 0 + + # Here is the loop where we put and get each key/data pair + + set kvals "" + puts "\tTest00$reopen.a: put/get loop" + while { [gets $did str] != -1 && $count < $nentries } { + if { [string compare $method DB_RECNO] == 0 } { + set key [expr $count + 1] + set put putn + lappend kvals $str + } else { + set key $str + set put put + } + + set datastr [ make_data_str $str ] + + $db $put $txn $key $datastr $flags + set ret [$db get $txn $key $flags] + error_check_good "$tnum:put" $ret $datastr + incr count + } + close $did + if { $build_only == 1 } { + return $db + } + if { $reopen == 5 } { + error_check_good db_close [$db close] 0 + set db [ dbopen $testfile 0 0 DB_UNKNOWN ] + error_check_good dbopen [is_valid_db $db] TRUE + } + puts "\tTest00$reopen.b: get/delete loop" + # Now we will get each key from the DB and compare the results + # to the original, then delete it. + set outf [open $t1 w] + set c [$db cursor $txn] + + set count 0 + for {set d [$c get 0 $DB_FIRST] } { [string length $d] != 0 } { + set d [$c get 0 $DB_NEXT] } { + set k [lindex $d 0] + set d2 [lindex $d 1] + if { [string compare $method DB_RECNO] == 0 } { + set datastr \ + [make_data_str [lindex $kvals [expr $k - 1]]] + } else { + set datastr [make_data_str $k] + } + error_check_good $tnum:$k $d2 $datastr + puts $outf $k + $c del 0 + if { [string compare $method DB_RECNO] == 0 && \ + $do_renumber == 1 } { + set kvals [lreplace $kvals 0 0] + } + incr count + } + close $outf + error_check_good curs_close [$c close] 0 + + # Now compare the keys to see if they match the dictionary + if { [string compare $method DB_RECNO] == 0 } { + error_check_good test00$reopen:keys_deleted $count $nentries + } else { + set q q + exec $SED $nentries$q $dict > $t2 + exec $SORT $t1 > $t3 + error_check_good Test00$reopen:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + } + + error_check_good db_close [$db close] 0 +} + diff --git a/mozilla/db/test/test005.tcl b/mozilla/db/test/test005.tcl new file mode 100644 index 00000000000..89f08344b8f --- /dev/null +++ b/mozilla/db/test/test005.tcl @@ -0,0 +1,14 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test005.tcl 10.2 (Sleepycat) 4/10/98 +# +# DB Test 5 {access method} +# Check that cursor operations work. Create a database; close database and +# reopen it. Then read through the database sequentially using cursors and +# delete each element. +proc test005 { method {nentries 10000} args } { + test004 $method $nentries 5 0 $args +} diff --git a/mozilla/db/test/test006.tcl b/mozilla/db/test/test006.tcl new file mode 100644 index 00000000000..22be07920da --- /dev/null +++ b/mozilla/db/test/test006.tcl @@ -0,0 +1,92 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test006.tcl 10.4 (Sleepycat) 4/10/98 +# +# DB Test 6 {access method} +# Keyed delete test. +# Create database. +# Go through database, deleting all entries by key. +proc test006 { method {nentries 10000} {reopen 6} args} { + set tnum Test00$reopen + set args [convert_args $method $args] + set do_renumber [is_rrecno $method] + set method [convert_method $method] + puts -nonewline "$tnum: $method ($args) $nentries equal small key; medium data pairs" + if {$reopen == 7} { + puts "(with close)" + } else { + puts "" + } + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile $tnum.db + + set flags 0 + set txn 0 + set count 0 + + # Here is the loop where we put and get each key/data pair + + cleanup $testdir + set db [eval [concat dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method $args]] + error_check_good dbopen [is_valid_db $db] TRUE + set did [open $dict] + while { [gets $did str] != -1 && $count < $nentries } { + if { [string compare $method DB_RECNO] == 0 } { + set key [expr $count + 1 ] + set put putn + } else { + set key $str + set put put + } + + set datastr [ make_data_str $str ] + + $db $put $txn $key $datastr $flags + set ret [$db get $txn $key $flags] + if { [string compare $ret $datastr] != 0 } { + puts "$tnum: put $datastr got $ret" + return + } + incr count + } + close $did + + if { $reopen == 7 } { + error_check_good db_close [$db close] 0 + set db [ dbopen $testfile 0 0 DB_UNKNOWN ] + error_check_good dbopen [is_valid_db $db] TRUE + } + + # Now we will get each key from the DB and compare the results + # to the original, then delete it. + set count 0 + set did [open $dict] + set key 0 + while { [gets $did str] != -1 && $count < $nentries } { + if { $do_renumber == 1 } { + set key 1 + } elseif { [string compare $method DB_RECNO] == 0 } { + incr key + } else { + set key $str + } + + set datastr [ make_data_str $str ] + + set ret [ $db del $txn $key $flags ] + error_check_good db_del:$key $ret 0 + incr count + } + close $did + + error_check_good db_close [$db close] 0 +} diff --git a/mozilla/db/test/test007.tcl b/mozilla/db/test/test007.tcl new file mode 100644 index 00000000000..6658227b5be --- /dev/null +++ b/mozilla/db/test/test007.tcl @@ -0,0 +1,13 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test007.tcl 10.2 (Sleepycat) 4/10/98 +# +# DB Test 7 {access method} +# Check that delete operations work. Create a database; close database and +# reopen it. Then issues delete by key for each entry. +proc test007 { method {nentries 10000} args} { + test006 $method $nentries 7 $args +} diff --git a/mozilla/db/test/test008.tcl b/mozilla/db/test/test008.tcl new file mode 100644 index 00000000000..75a66bac1a5 --- /dev/null +++ b/mozilla/db/test/test008.tcl @@ -0,0 +1,121 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test008.tcl 10.5 (Sleepycat) 4/28/98 + +# DB Test 8 {access method} +# Take the source files and dbtest executable and enter their names as the +# key with their contents as data. After all are entered, begin looping +# through the entries; deleting some pairs and then readding them. +proc test008 { method {nentries 10000} {reopen 8} {debug 0} args} { + set tnum Test00$reopen + set method [convert_method $method] + if { [string compare $method DB_RECNO] == 0 } { + puts "Test00$reopen skipping for method RECNO" + return + } + + puts -nonewline "$tnum: $method filename=key filecontents=data pairs" + if {$reopen == 9} { + puts "(with close)" + } else { + puts "" + } + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile $tnum.db + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + set t4 $testdir/t4 + + + cleanup $testdir + set db [eval [concat dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method $args]] + error_check_good dbopen [is_valid_db $db] TRUE + set flags 0 + set txn 0 + + # Here is the loop where we put and get each key/data pair + set file_list [glob ../*/*.c ./dbtest ./dbtest.exe] + + set count 0 + puts "\tTest00$reopen.a: Initial put/get loop" + foreach f $file_list { + set names($count) $f + set key $f + $db putbin $txn $key ./$f $flags + set ret [$db getbin $t4 $txn $key $flags] + error_check_good Test00$reopen:diff(./$f,$t4) \ + [catch { exec $DIFF ./$f $t4 } res] 0 + + incr count + } + + if {$reopen == 9} { + error_check_good db_close [$db close] 0 + set db [ dbopen $testfile 0 0 DB_UNKNOWN ] + error_check_good dbopen [is_valid_db $db] TRUE + } + + # Now we will get step through keys again (by increments) and + # delete all the entries, then re-insert them. + + puts "\tTest00$reopen.b: Delete re-add loop" + foreach i "1 2 4 8 16" { + for {set ndx 0} {$ndx < $count} { incr ndx $i} { + set r [$db del $txn $names($ndx) $flags] + error_check_good db_del:$names($ndx) $r 0 + } + for {set ndx 0} {$ndx < $count} { incr ndx $i} { + set r [$db putbin $txn $names($ndx) $names($ndx) $flags] + error_check_good db_putbin:$names($ndx) $r 0 + } + } + + if {$reopen == 9} { + error_check_good db_close [$db close] 0 + set db [ dbopen $testfile 0 0 DB_UNKNOWN ] + } + + # Now, reopen the file and make sure the key/data pairs look right. + puts "\tTest00$reopen.c: Dump contents forward" + dump_bin_file $db $txn $t1 test008.check + + set oid [open $t2.tmp w] + foreach f $file_list { + puts $oid $f + } + close $oid + exec $SORT $t2.tmp > $t2 + exec $RM $t2.tmp + exec $SORT $t1 > $t3 + + error_check_good Test00$reopen:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + + # Now, reopen the file and run the last test again in reverse direction. + puts "\tTest00$reopen.d: Dump contents backward" + dump_bin_file_direction $db $txn $t1 test008.check $DB_LAST $DB_PREV + + exec $SORT $t1 > $t3 + + error_check_good Test00$reopen:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + error_check_good close:$db [$db close] 0 +} + +proc test008.check { binfile tmpfile } { + global tnum + source ./include.tcl + + error_check_good diff(./$binfile,$tmpfile) \ + [catch { exec $DIFF ./$binfile $tmpfile } res] 0 +} diff --git a/mozilla/db/test/test009.tcl b/mozilla/db/test/test009.tcl new file mode 100644 index 00000000000..7a0358a25ee --- /dev/null +++ b/mozilla/db/test/test009.tcl @@ -0,0 +1,15 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test009.tcl 10.2 (Sleepycat) 4/10/98 +# +# DB Test 9 {access method} +# Check that we reuse overflow pages. Create database with lots of +# big key/data pairs. Go through and delete and add keys back +# randomly. Then close the DB and make sure that we have everything +# we think we should. +proc test009 { method {nentries 10000} args} { + test008 $method $nentries 9 0 $args +} diff --git a/mozilla/db/test/test010.tcl b/mozilla/db/test/test010.tcl new file mode 100644 index 00000000000..4f206cc6991 --- /dev/null +++ b/mozilla/db/test/test010.tcl @@ -0,0 +1,109 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test010.tcl 10.5 (Sleepycat) 4/25/98 +# +# DB Test 10 {access method} +# Use the first 10,000 entries from the dictionary. +# Insert each with self as key and data; add duplicate +# records for each. +# After all are entered, retrieve all; verify output. +# Close file, reopen, do retrieve and re-verify. +# This does not work for recno +proc test010 { method {nentries 10000} {ndups 5} {tnum 10} args } { + set omethod $method + set method [convert_method $method] + set args [convert_args $method $args] + puts "Test0$tnum: $method ($args) $nentries small dup key/data pairs" + if { [string compare $method DB_RECNO] == 0 || \ + [is_rbtree $omethod] == 1 } { + puts "Test0$tnum skipping for method $omethod" + return + } + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile test0$tnum.db + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + cleanup $testdir + set args [add_to_args $DB_DUP $args] + set db [eval [concat dbopen $testfile \ + [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method $args]] + error_check_good dbopen [is_valid_db $db] TRUE + set did [open $dict] + + set flags 0 + set txn 0 + set count 0 + + # Here is the loop where we put and get each key/data pair + set dbc [$db cursor $txn] + while { [gets $did str] != -1 && $count < $nentries } { + for { set i 1 } { $i <= $ndups } { incr i } { + set datastr $i:$str + $db put $txn $str $datastr $flags + } + + # Now retrieve all the keys matching this key + set x 1 + for {set ret [$dbc get $str $DB_SET]} \ + {[string length $ret] != 0} \ + {set ret [$dbc get 0 $DB_NEXT] } { + set k [lindex $ret 0] + if { [string compare $k $str] != 0 } { + break + } + set datastr [lindex $ret 1] + set d [data_of $datastr] + if {[string length $d] == 0} { + break + } + error_check_good "Test0$tnum:put" $d $str + set id [ id_of $datastr ] + error_check_good "Test0$tnum:dup#" $id $x + incr x + } + error_check_good "Test0$tnum:ndups:$str" [expr $x - 1] $ndups + incr count + } + error_check_good cursor_close [$dbc close] 0 + close $did + + # Now we will get each key from the DB and compare the results + # to the original. + puts "\tTest0$tnum.a: Checking file for correct duplicates" + set dlist "" + for { set i 1 } { $i <= $ndups } {incr i} { + lappend dlist $i + } + dup_check $db $txn $t1 $dlist + + # Now compare the keys to see if they match the dictionary entries + set q q + exec $SED $nentries$q $dict > $t2 + exec $SORT $t1 > $t3 + + error_check_good Test0$tnum:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + + error_check_good db_close [$db close] 0 + set db [dbopen $testfile 0 0 $method] + error_check_good dbopen [is_valid_db $db] TRUE + + puts "\tTest0$tnum.b: Checking file for correct duplicates after close" + dup_check $db $txn $t1 $dlist + + # Now compare the keys to see if they match the dictionary entries + exec $SORT $t1 > $t3 + error_check_good Test0$tnum:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + + error_check_good db_close [$db close] 0 +} diff --git a/mozilla/db/test/test011.tcl b/mozilla/db/test/test011.tcl new file mode 100644 index 00000000000..f886f445619 --- /dev/null +++ b/mozilla/db/test/test011.tcl @@ -0,0 +1,300 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test011.tcl 10.7 (Sleepycat) 4/26/98 +# +# DB Test 11 {access method} +# Use the first 10,000 entries from the dictionary. +# Insert each with self as key and data; add duplicate +# records for each. +# Then do some key_first/key_last add_before, add_after operations. +# This does not work for recno +# To test if dups work when they fall off the main page, run this with +# a very tiny page size. +proc test011 { method {nentries 10000} {ndups 5} {tnum 11} args } { +global dlist + set dlist "" + set omethod $method + set do_renumber [is_rrecno $method] + set args [convert_args $method $args] + set method [convert_method $method] + if { [is_rbtree $omethod] == 1 } { + puts "Test011 skipping for method $omethod" + return + } + if { [string compare $method DB_RECNO] == 0 } { + test011_recno $do_renumber $nentries $tnum $args + return + } else { + puts -nonewline "Test0$tnum: $method $nentries small dup " + puts "key/data pairs, cursor ops" + } + if {$ndups < 5} { + set ndups 5 + } + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile test0$tnum.db + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + cleanup $testdir + set args [add_to_args $DB_DUP $args] + set db [eval [concat dbopen $testfile \ + [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method $args]] + error_check_good dbopen [is_valid_db $db] TRUE + set did [open $dict] + + set flags 0 + set txn 0 + set count 0 + + # Here is the loop where we put and get each key/data pair + # We will add dups with values 1, 3, ... $ndups. Then we'll add + # 0 and $ndups+1 using keyfirst/keylast. We'll add 2 and 4 using + # add before and add after. + puts "\tTest0$tnum.a: put and get duplicate keys." + set dbc [$db cursor $txn] + set i "" + for { set i 1 } { $i <= $ndups } { incr i 2 } { + lappend dlist $i + } + set maxodd $i + while { [gets $did str] != -1 && $count < $nentries } { + for { set i 1 } { $i <= $ndups } { incr i 2 } { + set datastr $i:$str + set ret [$db put $txn $str $datastr $flags] + error_check_good put $ret 0 + } + + # Now retrieve all the keys matching this key + set x 1 + for {set ret [$dbc get $str $DB_SET]} \ + {[string length $ret] != 0} \ + {set ret [$dbc get 0 $DB_NEXT] } { + set k [lindex $ret 0] + if { [string compare $k $str] != 0 } { + break + } + set datastr [lindex $ret 1] + set d [data_of $datastr] + + if {[string length $d] == 0} { + break + } + error_check_good Test0$tnum:put $d $str + set id [ id_of $datastr ] + error_check_good Test0$tnum:dup# $id $x + incr x 2 + } + error_check_good Test011:numdups $x $maxodd + incr count + } + error_check_good curs_close [$dbc close] 0 + close $did + + # Now we will get each key from the DB and compare the results + # to the original. + puts "\tTest0$tnum.b: traverse entire file checking duplicates before close." + dup_check $db $txn $t1 $dlist + + # Now compare the keys to see if they match the dictionary entries + set q q + exec $SED $nentries$q $dict > $t2 + exec $SORT $t1 > $t3 + + error_check_good Test0$tnum:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + + error_check_good db_close [$db close] 0 + set db [dbopen $testfile 0 0 $method] + error_check_good dbopen [is_valid_db $db] TRUE + + puts "\tTest0$tnum.c: traverse entire file checking duplicates after close." + dup_check $db $txn $t1 $dlist + + # Now compare the keys to see if they match the dictionary entries + exec $SORT $t1 > $t3 + error_check_good Test0$tnum:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + + puts "\tTest0$tnum.d: Testing key_first functionality" + add_dup $db $txn $nentries $DB_KEYFIRST 0 0 + set dlist [linsert $dlist 0 0] + dup_check $db $txn $t1 $dlist + + puts "\tTest0$tnum.e: Testing key_last functionality" + add_dup $db $txn $nentries $DB_KEYLAST [expr $maxodd - 1] 0 + lappend dlist [expr $maxodd - 1] + dup_check $db $txn $t1 $dlist + + puts "\tTest0$tnum.f: Testing add_before functionality" + add_dup $db $txn $nentries $DB_BEFORE 2 3 + set dlist [linsert $dlist 2 2] + dup_check $db $txn $t1 $dlist + + puts "\tTest0$tnum.g: Testing add_after functionality" + add_dup $db $txn $nentries $DB_AFTER 4 4 + set dlist [linsert $dlist 4 4] + dup_check $db $txn $t1 $dlist + + error_check_good db_close [$db close] 0 +} + +proc add_dup {db txn nentries flag dataval iter} { +source ./include.tcl + + set dbc [$db cursor $txn] + set did [open $dict] + set count 0 + while { [gets $did str] != -1 && $count < $nentries } { + set datastr $dataval:$str + set ret [$dbc get $str $DB_SET] + error_check_bad "cget(SET)" [is_substr $ret Error] 1 + for { set i 1 } { $i < $iter } { incr i } { + set ret [ $dbc get $str $DB_NEXT ] + error_check_bad "cget(NEXT)" [is_substr $ret Error] 1 + } + + $dbc put $str $datastr $flag + incr count + } + close $did + $dbc close +} + +proc test011_recno { {renum 0} {nentries 10000} {tnum 11} largs } { +global dlist + puts "Test0$tnum: RECNO ($largs) $nentries test cursor insert functionality" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile test0$tnum.db + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + cleanup $testdir + set db [eval [concat dbopen $testfile [expr $DB_CREATE | $DB_TRUNCATE] \ + 0644 DB_RECNO $largs]] + error_check_good dbopen [is_valid_db $db] TRUE + set did [open $dict] + + set flags 0 + set txn 0 + set count 0 + + # The basic structure of the test is that we pick a random key + # in the database and then add items before, after, ?? it. The + # trickiness is that with RECNO, these are not duplicates, they + # are creating new keys. Therefore, every time we do this, the + # keys assigned to other values change. For this reason, we'll + # keep the database in tcl as a list and insert properly into + # it to verify that the right thing is happening. If we do not + # have renumber set, then the BEFORE and AFTER calls should fail. + + # Seed the database with an initial record + gets $did str + set ret [$db put $txn 1 $str 0] + error_check_good put $ret 0 + set count 1 + + set dlist "NULL $str" + + # Open a cursor + set dbc [$db cursor $txn] + puts "Test0$tnum.a: put and get entries" + while { [gets $did str] != -1 && $count < $nentries } { + # Pick a random key + set key [random_int 1 $count] + set ret [$dbc get $key $DB_SET] + set k [lindex $ret 0] + set d [lindex $ret 1] + error_check_good cget:SET:key $k $key + error_check_good cget:SET $d [lindex $dlist $key] + + # Current + set ret [$dbc put $key $str $DB_CURRENT] + error_check_good cput:$key $ret 0 + set dlist [lreplace $dlist $key $key $str] + + # Before + if { [gets $did str] == -1 } { + continue; + } + + if { $renum == 1 } { + set ret [$dbc put $key $str $DB_BEFORE] + error_check_good cput:$key:BEFORE $ret 0 + set dlist [linsert $dlist $key $str] + incr count + + # After + if { [gets $did str] == -1 } { + continue; + } + set ret [$dbc put $key $str $DB_AFTER] + error_check_good cput:$key:AFTER $ret 0 + set dlist [linsert $dlist [expr $key + 1] $str] + incr count + } + + # Now verify that the keys are in the right place + set i 0 + for {set ret [$dbc get $key $DB_SET]} \ + {[string length $ret] != 0 && $i < 3} \ + {set ret [$dbc get 0 $DB_NEXT] } { + set check_key [expr $key + $i] + + set k [lindex $ret 0] + error_check_good cget:$key:loop $k $check_key + + set d [lindex $ret 1] + error_check_good cget:data $d [lindex $dlist $check_key] + incr i + } + } + close $did + error_check_good cclose [$dbc close] 0 + + # Create check key file. + set oid [open $t2 w] + for {set i 1} {$i <= $count} {incr i} { + puts $oid $i + } + close $oid + + puts "\tTest0$tnum.b: dump file" + dump_file $db $txn $t1 test011_check + error_check_good Test0$tnum:diff($t2,$t1) \ + [catch { exec $DIFF $t2 $t1 } res] 0 + + error_check_good db_close [$db close] 0 + + puts "\tTest0$tnum.c: close, open, and dump file" + open_and_dump_file $testfile NULL $txn $t1 test011_check \ + dump_file_direction $DB_FIRST $DB_NEXT + error_check_good Test0$tnum:diff($t2,$t1) \ + [catch { exec $DIFF $t2 $t1 } res] 0 + + puts "\tTest0$tnum.d: close, open, and dump file in reverse direction" + open_and_dump_file $testfile NULL $txn $t1 test011_check \ + dump_file_direction $DB_LAST $DB_PREV + + exec $SORT -n $t1 > $t3 + error_check_good Test0$tnum:diff($t2,$t3) \ + [catch { exec $DIFF $t2 $t3 } res] 0 +} + +proc test011_check { key data } { +global dlist + error_check_good "get key $key" $data [lindex $dlist $key] +} diff --git a/mozilla/db/test/test012.tcl b/mozilla/db/test/test012.tcl new file mode 100644 index 00000000000..5f7a25e581a --- /dev/null +++ b/mozilla/db/test/test012.tcl @@ -0,0 +1,97 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test012.tcl 10.6 (Sleepycat) 4/28/98 + +# DB Test 12 {access method} +# Take the source files and dbtest executable and enter their contents as +# the key with their names as data. After all are entered, retrieve all; +# compare output to original. Close file, reopen, do retrieve and re-verify. +proc test012 { method args} { + global names + set method [convert_method $method] + puts "Test012: $method filename=data filecontents=key pairs" + if { [string compare $method DB_RECNO] == 0 } { + puts "Test012 skipping for method RECNO" + return + } + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile test012.db + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + set t4 $testdir/t4 + + cleanup $testdir + set db [eval [concat dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method $args]] + error_check_good dbopen [is_valid_db $db] TRUE + + set flags 0 + set txn 0 + + # Here is the loop where we put and get each key/data pair + set file_list [glob ../*/*.c ./dbtest ./dbtest.exe] + + puts "\tTest012.a: put/get loop" + set count 0 + foreach f $file_list { + $db putbinkey $txn $f $f $flags + set ret [$db getbinkey $t4 $txn $f $flags] + error_check_good getbinkey $ret $f + incr count + } + + # Now we will get each key from the DB and compare the results + # to the original. + puts "\tTest012.b: dump file" + dump_binkey_file $db $txn $t1 test012.check + error_check_good db_close [$db close] 0 + + # Now compare the data to see if they match the .o and dbtest files + set oid [open $t2.tmp w] + foreach f $file_list { + puts $oid $f + } + close $oid + exec $SORT $t2.tmp > $t2 + exec $RM $t2.tmp + exec $SORT $t1 > $t3 + + error_check_good Test012:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + + # Now, reopen the file and run the last test again. + puts "\tTest012.c: close, open, and dump file" + open_and_dump_file $testfile NULL $txn $t1 test012.check \ + dump_binkey_file_direction $DB_FIRST $DB_NEXT + + exec $SORT $t1 > $t3 + + error_check_good Test012:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + + # Now, reopen the file and run the last test again in reverse direction. + puts "\tTest012.d: close, open, and dump file in reverse direction" + open_and_dump_file $testfile NULL $txn $t1 test012.check\ + dump_binkey_file_direction $DB_LAST $DB_PREV + + exec $SORT $t1 > $t3 + + error_check_good Test012:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 +} + +# Check function for test012; key should be file name; data should be contents +proc test012.check { binfile tmpfile } { + source ./include.tcl + error_check_good Test012:diff($binfile,$tmpfile) \ + [catch { exec $DIFF $binfile $tmpfile } res] 0 +} diff --git a/mozilla/db/test/test013.tcl b/mozilla/db/test/test013.tcl new file mode 100644 index 00000000000..800f8822f79 --- /dev/null +++ b/mozilla/db/test/test013.tcl @@ -0,0 +1,165 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test013.tcl 10.6 (Sleepycat) 4/26/98 +# +# DB Test 13 {access method} +# Partial put and put flag testing 1. +# The data set consists of the first nentries of the dictionary. +# We will insert them (and retrieve them) as we do in test 1 (equal +# key/data pairs). Then we'll try to overwrite them without an appropriate +# flag set (expect error). Then we'll overwrite each one with its datum +# reversed. +proc test013 { method {nentries 10000} args } { + set args [convert_args $method $args] + set method [convert_method $method] + puts "Test013: $method ($args) $nentries equal key/data pairs, put test" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile test013.db + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + cleanup $testdir + set db [eval [concat dbopen $testfile [expr $DB_CREATE | $DB_TRUNCATE] \ + 0644 $method $args] ] + error_check_good dbopen [is_valid_db $db] TRUE + set did [open $dict] + + set flags 0 + set txn 0 + set count 0 + + if { [string compare $method DB_RECNO] == 0 } { + set checkfunc test013_recno.check + set put putn + global kvals + } else { + set checkfunc test013.check + set put put + } + puts "\tTest013.a: put/get loop" + # Here is the loop where we put and get each key/data pair + while { [gets $did str] != -1 && $count < $nentries } { + if { [string compare $method DB_RECNO] == 0 } { + set key [expr $count + 1] + set kvals($key) $str + } else { + set key $str + } + $db $put $txn $key $str $flags + set ret [$db get $txn $key $flags] + error_check_good get $ret $str + incr count + } + close $did + + # Now we will try to overwrite each datum, but set the + # NOOVERWRITE flag. + puts "\tTest013.b: overwrite values with NOOVERWRITE flag." + set did [open $dict] + set count 0 + while { [gets $did str] != -1 && $count < $nentries } { + if { [string compare $method DB_RECNO] == 0 } { + set key [expr $count + 1] + } else { + set key $str + } + set r [ $db $put $txn $key $str $DB_NOOVERWRITE ] + error_check_good put [is_substr $r Error ] 1 + + # Value should be unchanged. + set ret [$db get $txn $key $flags] + error_check_good get $ret $str + incr count + } + close $did + + # Now we will replace each item with its datum capitalized. + puts "\tTest013.c: overwrite values with capitalized datum" + set did [open $dict] + set count 0 + while { [gets $did str] != -1 && $count < $nentries } { + if { [string compare $method DB_RECNO] == 0 } { + set key [expr $count + 1] + } else { + set key $str + } + set rstr [string toupper $str] + set r [ $db $put $txn $key $rstr 0 ] + error_check_good put $r 0 + + # Value should be changed. + set ret [$db get $txn $key $flags] + error_check_good get $ret $rstr + incr count + } + close $did + + # Now make sure that everything looks OK + puts "\tTest013.d: check entire file contents" + dump_file $db $txn $t1 $checkfunc + error_check_good db_close [$db close] 0 + + # Now compare the keys to see if they match the dictionary (or ints) + if { [string compare $method DB_RECNO] == 0 } { + set oid [open $t2 w] + for {set i 1} {$i <= $nentries} {set i [incr i]} { + puts $oid $i + } + close $oid + exec $MV $t1 $t3 + } else { + set q q + exec $SED $nentries$q $dict > $t2 + exec $SORT $t1 > $t3 + } + + error_check_good Test013:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + + puts "\tTest013.e: close, open, and dump file" + # Now, reopen the file and run the last test again. + open_and_dump_file $testfile NULL $txn $t1 $checkfunc \ + dump_file_direction $DB_FIRST $DB_NEXT + + if { [string compare $method DB_RECNO] != 0 } { + exec $SORT $t1 > $t3 + } + + error_check_good Test013:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + + # Now, reopen the file and run the last test again in the + # reverse direction. + puts "\tTest013.f: close, open, and dump file in reverse direction" + open_and_dump_file $testfile NULL $txn $t1 $checkfunc \ + dump_file_direction $DB_LAST $DB_PREV + + if { [string compare $method DB_RECNO] != 0 } { + exec $SORT $t1 > $t3 + } + + error_check_good Test013:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 +} + +# Check function for test013; keys and data are identical +proc test013.check { key data } { + error_check_good "key/data mismatch for $key" $data \ + [string toupper $key] +} + +proc test013_recno.check { key data } { + global dict + global kvals + error_check_good key"$key"_exists [info exists kvals($key)] 1 + error_check_good "data mismatch for $key" $data \ + [string toupper $kvals($key)] +} diff --git a/mozilla/db/test/test014.tcl b/mozilla/db/test/test014.tcl new file mode 100644 index 00000000000..5523e20e4ee --- /dev/null +++ b/mozilla/db/test/test014.tcl @@ -0,0 +1,118 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test014.tcl 10.6 (Sleepycat) 4/26/98 +# +# DB Test 14 {access method} +# Partial put test, small data, replacing with same size. +# The data set consists of the first nentries of the dictionary. +# We will insert them (and retrieve them) as we do in test 1 (equal +# key/data pairs). Then we'll try to perform partial puts of some characters +# at the beginning, some at the end, and some at the middle. +proc test014 { method {nentries 10000} args } { + set args [convert_args $method $args] + set method [convert_method $method] + puts "Test014: $method ($args) $nentries equal key/data pairs, put test" + test014_body $method 1 1 $nentries $args + test014_body $method 1 5 $nentries $args + test014_body $method 2 4 $nentries $args + test014_body $method 1 100 $nentries $args + test014_body $method 2 10 $nentries $args + test014_body $method 1 8000 $nentries $args +} + +proc test014_body { method chars increase {nentries 10000} args } { + set method [convert_method $method] + puts "Replace $chars chars with string $increase times larger" + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile test014.db + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + cleanup $testdir + set db [eval [concat dbopen $testfile [expr $DB_CREATE | $DB_TRUNCATE] \ + 0644 $method $args] ] + error_check_good dbopen [is_valid_db $db] TRUE + + set flags 0 + set txn 0 + set count 0 + + puts "\tTest014.a: put/get loop" + # Here is the loop where we put and get each key/data pair + # We will do the initial put and then three Partial Puts + # for the beginning, middle and end of the string. + set did [open $dict] + while { [gets $did str] != -1 && $count < $nentries } { + if { [string compare $method DB_RECNO] == 0 } { + set key [expr $count + 1] + set put putn + } else { + set key $str + set put put + } + partial_put $put $db $txn $key $str $chars $increase + incr count + } + close $did + + # Now make sure that everything looks OK + puts "\tTest014.b: check entire file contents" + dump_file $db $txn $t1 test014.check + error_check_good db_close [$db close] 0 + + # Now compare the keys to see if they match the dictionary (or ints) + if { [string compare $method DB_RECNO] == 0 } { + set oid [open $t2 w] + for {set i 1} {$i <= $nentries} {set i [incr i]} { + puts $oid $i + } + close $oid + exec $MV $t1 $t3 + } else { + set q q + exec $SED $nentries$q $dict > $t2 + exec $SORT $t1 > $t3 + } + + error_check_good Test014:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + + puts "\tTest014.c: close, open, and dump file" + # Now, reopen the file and run the last test again. + open_and_dump_file $testfile NULL $txn \ + $t1 test014.check dump_file_direction $DB_FIRST $DB_NEXT + + if { [string compare $method DB_RECNO] != 0 } { + exec $SORT $t1 > $t3 + } + + error_check_good Test014:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + # Now, reopen the file and run the last test again in the + # reverse direction. + puts "\tTest014.d: close, open, and dump file in reverse direction" + open_and_dump_file $testfile NULL $txn $t1 \ + test014.check dump_file_direction $DB_LAST $DB_PREV + + if { [string compare $method DB_RECNO] != 0 } { + exec $SORT $t1 > $t3 + } + + error_check_good Test014:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 +} + +# Check function for test014; keys and data are identical +proc test014.check { key data } { +global dvals + error_check_good key"$key"_exists [info exists dvals($key)] 1 + error_check_good "data mismatch for key $key" $data $dvals($key) +} + diff --git a/mozilla/db/test/test015.tcl b/mozilla/db/test/test015.tcl new file mode 100644 index 00000000000..fedb4c8a398 --- /dev/null +++ b/mozilla/db/test/test015.tcl @@ -0,0 +1,167 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test015.tcl 10.6 (Sleepycat) 4/26/98 +# +# DB Test 15 {access method} +# Partial put test when item does not exist. +proc test015 { method {nentries 7500} { start 0 } args } { +global rvar + set t_table { + { 1 { 1 1 1 } } + { 2 { 1 1 5 } } + { 3 { 1 1 50 } } + { 4 { 1 100 1 } } + { 5 { 100 1000 5 } } + { 6 { 1 100 50 } } + } + set args [convert_args $method $args] + set method [convert_method $method] + puts "Test015: $method ($args) $nentries equal key/data pairs, partial put test" + test015_init + if { $start == 0 } { + set start { 1 2 3 4 5 6 } + } + foreach entry $t_table { + set this [lindex $entry 0] + if { [lsearch $start $this] == -1 } { + continue + } + puts -nonewline "$this: " + eval [concat test015_body $method [lindex $entry 1] \ + $nentries $args] + } +} + +proc test015_init { } { +global rvar + srand 0xf0f0f0f0 +} + +proc test015_body { method off_low off_hi rcount {nentries 10000} args } { +global rvar +global dvals + set method [convert_method $method] + puts "Put $rcount strings random offsets between $off_low and $off_hi" + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile test015.db + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + cleanup $testdir + set db [eval [concat dbopen $testfile [expr $DB_CREATE | $DB_TRUNCATE] \ + 0644 $method $args]] + error_check_good dbopen [is_valid_db $db] TRUE + + set flags 0 + set txn 0 + set count 0 + + puts "\tTest015.a: put/get loop" + # Here is the loop where we put and get each key/data pair + # Each put is a partial put of a record that does not exist. + set did [open $dict] + while { [gets $did str] != -1 && $count < $nentries } { + if { [string compare $method DB_RECNO] == 0 } { + set key [expr $count + 1] + set put putn + } else { + set key $str + set put put + } + set data [replicate $str $rcount] + # This is a hack. In DB we will store the records with + # some padding, but these will get lost if we just return + # them in TCL. As a result, we're going to have to hack + # get to check for 0 padding and return a list consisting + # of the number of 0's and the actual data. + set off [ random_int $off_low $off_hi ] + set dvals($key) [list $off $data] + set ret [$db $put $txn $key $data $DB_DBT_PARTIAL $off 0] + error_check_good put $ret 0 + incr count + } + close $did + + # Now make sure that everything looks OK + puts "\tTest015.b: check entire file contents" + dump_file $db $txn $t1 test015.check + error_check_good db_close [$db close] 0 + + # Now compare the keys to see if they match the dictionary (or ints) + if { [string compare $method DB_RECNO] == 0 } { + set oid [open $t2 w] + for {set i 1} {$i <= $nentries} {set i [incr i]} { + puts $oid $i + } + close $oid + exec $MV $t1 $t3 + } else { + set q q + exec $SED $nentries$q $dict > $t2 + exec $SORT $t1 > $t3 + } + + error_check_good Test015:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + + puts "\tTest015.c: close, open, and dump file" + # Now, reopen the file and run the last test again. + open_and_dump_file $testfile NULL $txn $t1 \ + test015.check dump_file_direction $DB_FIRST $DB_NEXT + + if { [string compare $method DB_RECNO] != 0 } { + exec $SORT $t1 > $t3 + } + + error_check_good Test015:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + + # Now, reopen the file and run the last test again in the + # reverse direction. + puts "\tTest015.d: close, open, and dump file in reverse direction" + open_and_dump_file $testfile NULL $txn $t1 \ + test015.check dump_file_direction $DB_LAST $DB_PREV + + if { [string compare $method DB_RECNO] != 0 } { + exec $SORT $t1 > $t3 + } + + error_check_good Test015:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + + unset dvals +} + +# Check function for test015; keys and data are identical +proc test015.check { key data } { +global dvals + error_check_good key"$key"_exists [info exists dvals($key)] 1 + error_check_good "mismatch on padding for key $key" $data $dvals($key) + if { [llength $data] == 2 } { + if { [lindex $data 0] != [lindex $dvals($key) 0] } { + error "FAIL: Test015: padding mismatch for key $key \ + Expected [lindex $dvals($key) 0] \ + Got [lindex $data 0]" + } + if { [string compare [lindex $data 1] [lindex $dvals($key) 1] ]\ + != 0 } { + error "FAIL: Test015: data mismatch for key $key\ + Expected [lindex $dvals($key) 1]\ + Got [lindex $data 1]" + } + } elseif { [string compare $dvals($key) $data] != 0 } { + if { [lindex $data 0] != [lindex $dvals($key) 0] } { + error \ + "FAIL: Test015: mismatch: expected |$dvals($keys)|\ + \tGot |$data|" + } + } +} + diff --git a/mozilla/db/test/test016.tcl b/mozilla/db/test/test016.tcl new file mode 100644 index 00000000000..9e9a7ca6be8 --- /dev/null +++ b/mozilla/db/test/test016.tcl @@ -0,0 +1,146 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test016.tcl 10.6 (Sleepycat) 4/26/98 +# +# DB Test 16 {access method} +# Partial put test where partial puts make the record smaller. +# Use the first 10,000 entries from the dictionary. +# Insert each with self as key and a fixed, medium length data string; +# retrieve each. After all are entered, go back and do partial puts, +# replacing a random-length string with the key value. +# Then verify. + +set datastr abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz + +proc test016 { method {nentries 10000} args } { +global datastr +global dvals + srand 0xf0f0f0f0 + set args [convert_args $method $args] + set method [convert_method $method] + puts "Test016: $method ($args) $nentries partial put shorten" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile test016.db + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + cleanup $testdir + set db [eval [concat dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method $args]] + error_check_good dbopen [is_valid_db $db] TRUE + + set flags 0 + set txn 0 + set count 0 + + # Here is the loop where we put and get each key/data pair + + puts "\tTest016.a: put/get loop" + set did [open $dict] + while { [gets $did str] != -1 && $count < $nentries } { + if { [string compare $method DB_RECNO] == 0 } { + set key [expr $count + 1] + set put putn + } else { + set key $str + set put put + } + $db $put $txn $key $datastr $flags + set ret [$db get $txn $key $flags] + if { [string compare $ret $datastr] != 0 } { + puts "Test016: put $datastr got $ret" + return + } + incr count + } + close $did + + # Next we will do a partial put replacement, making the data + # shorter + puts "\tTest016.b: partial put loop" + set did [open $dict] + set count 0 + set len [string length $datastr] + while { [gets $did str] != -1 && $count < $nentries } { + if { [string compare $method DB_RECNO] == 0 } { + set key [expr $count + 1] + } else { + set key $str + } + + set repl_len [random_int [string length $key] $len] + set repl_off [random_int 0 [expr $len - $repl_len] ] + set s1 [string range $datastr 0 [ expr $repl_off - 1] ] + set s2 [string toupper $key] + set s3 [string range $datastr [expr $repl_off + $repl_len] end ] + set dvals($key) $s1$s2$s3 + set ret [ $db $put $txn $key $s2 $DB_DBT_PARTIAL \ + $repl_off $repl_len ] + error_check_good put $ret 0 + set ret [$db get $txn $key $flags] + error_check_good put $ret $s1$s2$s3 + incr count + } + close $did + + # Now we will get each key from the DB and compare the results + # to the original. + puts "\tTest016.c: dump file" + dump_file $db $txn $t1 test016.check + error_check_good db_close [$db close] 0 + + # Now compare the keys to see if they match the dictionary + if { [string compare $method DB_RECNO] == 0 } { + set oid [open $t2 w] + for {set i 1} {$i <= $nentries} {set i [incr i]} { + puts $oid $i + } + close $oid + exec $MV $t1 $t3 + } else { + set q q + exec $SED $nentries$q $dict > $t2 + exec $SORT $t1 > $t3 + } + + error_check_good Test016:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + + # Now, reopen the file and run the last test again. + puts "\tTest016.d: close, open, and dump file" + open_and_dump_file $testfile NULL $txn $t1 test016.check \ + dump_file_direction $DB_FIRST $DB_NEXT + + if { [string compare $method DB_RECNO] != 0 } { + exec $SORT $t1 > $t3 + } + error_check_good Test016:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 + + # Now, reopen the file and run the last test again in reverse direction. + puts "\tTest016.e: close, open, and dump file in reverse direction" + open_and_dump_file $testfile NULL $txn $t1 test016.check \ + dump_file_direction $DB_LAST $DB_PREV + + if { [string compare $method DB_RECNO] != 0 } { + exec $SORT $t1 > $t3 + } + error_check_good Test016:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 +} + +# Check function for test016; data should be whatever is set in dvals +proc test016.check { key data } { +global datastr +global dvals + error_check_good key"$key"_exists [info exists dvals($key)] 1 + error_check_good "data mismatch for key $key" $data $dvals($key) +} diff --git a/mozilla/db/test/test017.tcl b/mozilla/db/test/test017.tcl new file mode 100644 index 00000000000..fc4420ad4f7 --- /dev/null +++ b/mozilla/db/test/test017.tcl @@ -0,0 +1,13 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test017.tcl 10.2 (Sleepycat) 4/10/98 +# +# DB Test 17 {access method} +# Run duplicates with small page size so that we test off page duplicates. +proc test017 { method {nentries 10000} args} { + puts "Test017: Off page duplicate tests" + test010 $method $nentries 19 17 -psize 512 $args +} diff --git a/mozilla/db/test/test018.tcl b/mozilla/db/test/test018.tcl new file mode 100644 index 00000000000..ca863722cc7 --- /dev/null +++ b/mozilla/db/test/test018.tcl @@ -0,0 +1,14 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test018.tcl 10.3 (Sleepycat) 4/26/98 +# +# DB Test 18 {access method} +# Run duplicates with small page size so that we test off page duplicates. +proc test018 { method {nentries 10000} args} { + puts "Test018: Off page duplicate tests" + set cmd [concat "test011 $method $nentries 19 18 -psize 512" $args] + eval $cmd +} diff --git a/mozilla/db/test/test019.tcl b/mozilla/db/test/test019.tcl new file mode 100644 index 00000000000..53b43cfc457 --- /dev/null +++ b/mozilla/db/test/test019.tcl @@ -0,0 +1,76 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test019.tcl 10.5 (Sleepycat) 4/10/98 +# +# Test019 { access_method nentries } +# Test the partial get functionality. +proc test019 { method {nentries 10000} args } { + set args [convert_args $method $args] + set method [convert_method $method] + puts "Test019: $method ($args) $nentries partial get test" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile test019.db + cleanup $testdir + + set db [eval [concat dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method $args]] + error_check_good dbopen [is_valid_db $db] TRUE + set did [open $dict] + srand [pid] + + set flags 0 + set txn 0 + set count 0 + + puts "\tTest019.a: put/get loop" + for { set i 0 } { [gets $did str] != -1 && $i < $nentries } \ + { incr i } { + + if { $method == "DB_RECNO" } { + set key [expr $i + 1] + } else { + set key $str + } + set repl [random_int 1 100] + set data [replicate $str $repl] + set ret [$db put $txn $key $data $DB_NOOVERWRITE] + error_check_good dbput:$key $ret 0 + + set ret [$db get $txn $key 0] + error_check_good dbget:$key $ret $data + set kvals($key) $repl + + } + close $did + + puts "\tTest019.b partial get loop" + set did [open $dict] + for { set i 0 } { [gets $did str] != -1 && $i < $nentries } \ + { incr i } { + if { $method == "DB_RECNO" } { + set key [expr $i + 1] + } else { + set key $str + } + set realdata [replicate $str $kvals($key)] + set maxndx [expr [string length $realdata] - 1] + set beg [random_int 0 [expr $maxndx - 1]] + set len [random_int 1 [expr $maxndx - $beg]] + + set ret [$db get $txn $key $DB_DBT_PARTIAL $beg $len] + # In order for tcl to handle this, we have to overwrite the + # last character with a NULL. That makes the length one + # less than we expect + error_check_good dbget:$key $ret \ + [string range $realdata $beg [expr $beg + $len - 2]] + } + error_check_good db_close [$db close] 0 +} diff --git a/mozilla/db/test/test020.tcl b/mozilla/db/test/test020.tcl new file mode 100644 index 00000000000..9129ff7ae46 --- /dev/null +++ b/mozilla/db/test/test020.tcl @@ -0,0 +1,92 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test020.tcl 10.7 (Sleepycat) 4/26/98 +# +# DB Test 20 {access method} +# Test in-memory databases. +proc test020 { method {nentries 10000} args } { + set args [convert_args $method $args] + set method [convert_method $method] + puts "Test020: $method ($args) $nentries equal key/data pairs" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + cleanup $testdir + set db [eval [concat dbopen NULL \ + [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method $args]] + error_check_good dbopen [is_valid_db $db] TRUE + set did [open $dict] + + set flags 0 + set txn 0 + set count 0 + + if { [string compare $method DB_RECNO] == 0 } { + set checkfunc test020_recno.check + set put putn + } else { + set checkfunc test020.check + set put put + } + puts "\tTest020.a: put/get loop" + # Here is the loop where we put and get each key/data pair + while { [gets $did str] != -1 && $count < $nentries } { + if { [string compare $method DB_RECNO] == 0 } { + global kvals + + set key [expr $count + 1] + set kvals($key) $str + } else { + set key $str + } + set ret [$db $put $txn $key $str $flags] + error_check_good put $ret 0 + set ret [$db get $txn $key $flags] + error_check_good get $ret $str + incr count + } + close $did + # Now we will get each key from the DB and compare the results + # to the original. + puts "\tTest020.b: dump file" + dump_file $db $txn $t1 $checkfunc + error_check_good db_close [$db close] 0 + + # Now compare the keys to see if they match the dictionary (or ints) + if { [string compare $method DB_RECNO] == 0 } { + set oid [open $t2 w] + for {set i 1} {$i <= $nentries} {set i [incr i]} { + puts $oid $i + } + close $oid + exec $MV $t1 $t3 + } else { + set q q + exec $SED $nentries$q $dict > $t2 + exec $SORT $t1 > $t3 + } + + error_check_good Test020:diff($t3,$t2) \ + [catch { exec $DIFF $t3 $t2 } res] 0 +} + +# Check function for test020; keys and data are identical +proc test020.check { key data } { + error_check_good "key/data mismatch" $data $key +} + +proc test020_recno.check { key data } { +global dict +global kvals + error_check_good key"$key"_exists [info exists kvals($key)] 1 + error_check_good "data mismatch: key $key" $data $kvals($key) +} diff --git a/mozilla/db/test/test021.tcl b/mozilla/db/test/test021.tcl new file mode 100644 index 00000000000..fde9924b328 --- /dev/null +++ b/mozilla/db/test/test021.tcl @@ -0,0 +1,118 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test021.tcl 8.8 (Sleepycat) 4/26/98 +# +# DB Test 21 {access method} +# Use the first 10,000 entries from the dictionary. +# Insert each with self, reversed as key and self as data. +# After all are entered, retrieve each using a cursor SET_RANGE, and getting +# about 20 keys sequentially after it (in some cases we'll run out towards +# the end of the file). +proc test021 { method {nentries 10000} args } { + set args [convert_args $method $args] + set method [convert_method $method] + puts "Test021: $method ($args) $nentries equal key/data pairs" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile test021.db + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + cleanup $testdir + set db [eval [concat dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method $args]] + error_check_good dbopen [is_valid_db $db] TRUE + + set did [open $dict] + + set flags 0 + set txn 0 + set count 0 + + if { [string compare $method DB_RECNO] == 0 } { + set checkfunc test021_recno.check + set put putn + } else { + set checkfunc test021.check + set put put + } + puts "\tTest021.a: put loop" + # Here is the loop where we put each key/data pair + while { [gets $did str] != -1 && $count < $nentries } { + if { [string compare $method DB_RECNO] == 0 } { + global kvals + + set key [expr $count + 1] + set kvals($key) $str + } else { + set key [reverse $str] + } + + set r [$db $put $txn $key $str $flags] + error_check_good db_put $r 0 + incr count + } + close $did + + # Now we will get each key from the DB and retrieve about 20 + # records after it. + error_check_good db_close [$db close] 0 + + puts "\tTest021.b: test ranges" + set db [dbopen $testfile $DB_RDONLY 0 $method] + error_check_good dbopen [is_valid_db $db] TRUE + + # Open a cursor + set dbc [$db cursor 0] + error_check_good db_cursor [is_substr $dbc $db] 1 + + set did [open $dict] + set i 0 + while { [gets $did str] != -1 && $i < $count } { + if { [string compare $method DB_RECNO] == 0 } { + set key [expr $i + 1] + } else { + set key [reverse $str] + } + + set r [$dbc get $key $DB_SET_RANGE] + error_check_bad dbc_get:$key [string length $r] 0 + set k [lindex $r 0] + set d [lindex $r 1] + $checkfunc $k $d + + for { set nrecs 0 } { $nrecs < 20 } { incr nrecs } { + set r [$dbc get 0 $DB_NEXT] + # no error checking because we may run off the end + # of the database + if { [llength $r] == 0 } { + continue; + } + set k [lindex $r 0] + set d [lindex $r 1] + $checkfunc $k $d + } + incr i + } + error_check_good db_close [$db close] 0 + +} + +# Check function for test021; keys and data are reversed +proc test021.check { key data } { + error_check_good "key/data mismatch for $key" $data [reverse $key] +} + +proc test021_recno.check { key data } { +global dict +global kvals + error_check_good key"$key"_exists [info exists kvals($key)] 1 + error_check_good "data mismatch: key $key" $data $kvals($key) +} diff --git a/mozilla/db/test/test022.tcl b/mozilla/db/test/test022.tcl new file mode 100644 index 00000000000..3cdb8d310eb --- /dev/null +++ b/mozilla/db/test/test022.tcl @@ -0,0 +1,95 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test022.tcl 8.4 (Sleepycat) 4/10/98 +# +# DB Test 22 {access method} +# Test multiple data directories. Do a bunch of different opens +# to make sure that the files are detected in different directories. +proc test022 { method args } { + set args [convert_args $method $args] + set method [convert_method $method] + puts "Test022: $method ($args) multiple data directory test" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + cleanup $testdir + exec $MKDIR $testdir/data1 + exec $MKDIR $testdir/data2 + exec $MKDIR $testdir/data3 + + puts "Test022.a: Multiple data directories in DB_CONFIG file" + + # Create a config file + set cid [open $testdir/DB_CONFIG w] + puts $cid "DB_DATA_DIR data1" + puts $cid "DB_DATA_DIR data2" + puts $cid "DB_DATA_DIR data3" + close $cid + + # Now get pathnames + set curdir [pwd] + cd $testdir + set fulldir [pwd] + cd $curdir + + set e [dbenv] + ddir_test $fulldir $method $e $args + rename $e "" + + puts "Test022.b: Multiple data directories in db_appinit call." + cleanup $testdir + exec $MKDIR $testdir/data1 + exec $MKDIR $testdir/data2 + exec $MKDIR $testdir/data3 + + # Now call dbenv with config specified + set e [dbenv -dbconfig \ + { {DB_DATA_DIR data1} {DB_DATA_DIR data2} {DB_DATA_DIR data3}} ] + ddir_test $fulldir $method $e $args + rename $e "" + + cleanup $testdir +} + +proc ddir_test { fulldir m e args } { + source ./include.tcl + + # Now create one file in each directory + set db1 [eval [concat dbopen $fulldir/data1/datafile1.db \ + [expr $DB_CREATE | $DB_TRUNCATE] 0644 $m -dbenv $e $args]] + error_check_good dbopen1 [is_valid_db $db1] TRUE + + set db2 [eval [concat dbopen $fulldir/data2/datafile2.db \ + [expr $DB_CREATE | $DB_TRUNCATE] 0644 $m -dbenv $e $args]] + error_check_good dbopen2 [is_valid_db $db2] TRUE + + set db3 [eval [concat dbopen $fulldir/data3/datafile3.db \ + [expr $DB_CREATE | $DB_TRUNCATE] 0644 $m -dbenv $e $args]] + error_check_good dbopen3 [is_valid_db $db3] TRUE + + # Close the files + error_check_good db_close1 [$db1 close] 0 + error_check_good db_close2 [$db2 close] 0 + error_check_good db_close3 [$db3 close] 0 + + # Now, reopen the files without complete pathnames and make + # sure that we find them. + + set db1 [dbopen datafile1.db 0 0 DB_UNKNOWN -dbenv $e] + error_check_good dbopen1 [is_valid_db $db1] TRUE + + set db2 [dbopen datafile2.db 0 0 DB_UNKNOWN -dbenv $e] + error_check_good dbopen2 [is_valid_db $db2] TRUE + + set db3 [dbopen datafile3.db 0 0 DB_UNKNOWN -dbenv $e] + error_check_good dbopen3 [is_valid_db $db3] TRUE + + # Finally close all the files + error_check_good db_close1 [$db1 close] 0 + error_check_good db_close2 [$db2 close] 0 + error_check_good db_close3 [$db3 close] 0 +} diff --git a/mozilla/db/test/test023.tcl b/mozilla/db/test/test023.tcl new file mode 100644 index 00000000000..2e1f78781cd --- /dev/null +++ b/mozilla/db/test/test023.tcl @@ -0,0 +1,193 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test023.tcl 8.7 (Sleepycat) 4/26/98 +# +# Duplicate delete test. +# Add a key with duplicates (first time on-page, second time off-page) +# Number the dups. +# Delete dups and make sure that CURRENT/NEXT/PREV work correctly. +proc test023 { method args } { + global dupnum + global dupstr + global alphabet + set omethod $method + set method [convert_method $method] + puts "Test023: $method delete duplicates/check cursor operations" + if { [string compare $method DB_RECNO] == 0 || \ + [is_rbtree $omethod] == 1 } { + puts "Test023: skipping for method $omethod" + return + } + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile test023.db + set t1 $testdir/t1 + cleanup $testdir + set db [eval [concat dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method -flags \ + $DB_DUP $args]] + error_check_good dbopen [is_valid_db $db] TRUE + + set flags 0 + set txn 0 + + set dbc [$db cursor $txn] + error_check_good db_cursor [is_substr $dbc $db] 1 + + foreach i { onpage offpage } { + if { $i == "onpage" } { + set dupstr DUP + } else { + set dupstr [repeat $alphabet 50] + } + puts "\tTest023.a: Insert key w/$i dups" + set key "duplicate_val_test" + for { set count 0 } { $count < 20 } { incr count } { + set ret [$db put $txn $key $count$dupstr $flags] + error_check_good db_put $ret 0 + } + + # Now let's get all the items and make sure they look OK. + puts "\tTest023.b: Check initial duplicates" + set dupnum 0 + dump_file $db $txn $t1 test023.check + + # Now delete a couple of random items (FIRST, LAST one in middle) + # Make sure that current returns an error and that NEXT and PREV + # do the right things + + set ret [$dbc get $key $DB_SET] + error_check_bad dbc_get:SET [llength $ret] 0 + + puts "\tTest023.c: Delete first and try gets" + # This should be the first duplicate + error_check_good dbc_get:SET [lindex $ret 0] duplicate_val_test + error_check_good dbc_get:SET [lindex $ret 1] 0$dupstr + + # Now delete it. + set ret [$dbc del 0] + error_check_good dbc_del:FIRST $ret 0 + + # Now current should fail + set ret [$dbc get $key $DB_CURRENT] + error_check_good dbc_get:deleted [llength $ret] 0 + + # Now Prev should fail + set ret [$dbc get $key $DB_PREV] + error_check_good dbc_get:prev0 [llength $ret] 0 + + # Now 10 nexts should work to get us in the middle + for { set j 1 } { $j <= 10 } { incr j } { + set ret [$dbc get $key $DB_NEXT] + error_check_good dbc_get:next [llength $ret] 2 + error_check_good dbc_get:next [lindex $ret 1] $j$dupstr + } + + puts "\tTest023.d: Delete middle and try gets" + # Now do the delete on the current key. + set ret [$dbc del 0] + error_check_good dbc_del:10 $ret 0 + + # Now current should fail + set ret [$dbc get $key $DB_CURRENT] + error_check_good dbc_get:deleted [llength $ret] 0 + + # Prev and Next should work + set ret [$dbc get $key $DB_NEXT] + error_check_good dbc_get:next [llength $ret] 2 + error_check_good dbc_get:next [lindex $ret 1] 11$dupstr + + set ret [$dbc get $key $DB_PREV] + error_check_good dbc_get:next [llength $ret] 2 + error_check_good dbc_get:next [lindex $ret 1] 9$dupstr + + # Now go to the last one + for { set j 11 } { $j <= 19 } { incr j } { + set ret [$dbc get $key $DB_NEXT] + error_check_good dbc_get:next [llength $ret] 2 + error_check_good dbc_get:next [lindex $ret 1] $j$dupstr + } + + puts "\tTest023.e: Delete last and try gets" + # Now do the delete on the current key. + set ret [$dbc del 0] + error_check_good dbc_del:LAST $ret 0 + + # Now current should fail + set ret [$dbc get $key $DB_CURRENT] + error_check_good dbc_get:deleted [llength $ret] 0 + + # Next should fail + set ret [$dbc get $key $DB_NEXT] + error_check_good dbc_get:next19 [llength $ret] 0 + + # Prev should work + set ret [$dbc get $key $DB_PREV] + error_check_good dbc_get:next [llength $ret] 2 + error_check_good dbc_get:next [lindex $ret 1] 18$dupstr + + + # Now overwrite the current one, then count the number + # of data items to make sure that we have the right number. + + puts "\tTest023.f: Count keys, overwrite current, count again" + # At this point we should have 17 keys the (initial 20 minus + # 3 deletes) + set dbc2 [$db cursor 0] + error_check_good db_cursor:2 [is_substr $dbc2 $db] 1 + + set count_check 0 + for { set rec [$dbc2 get 0 $DB_FIRST] } { + [llength $rec] != 0 } { set rec [$dbc2 get 0 $DB_NEXT] } { + incr count_check + } + error_check_good numdups $count_check 17 + + set ret [$dbc put $key OVERWRITE $DB_CURRENT] + error_check_good dbc_put:current $ret 0 + + set count_check 0 + for { set rec [$dbc2 get 0 $DB_FIRST] } { + [llength $rec] != 0 } { set rec [$dbc2 get 0 $DB_NEXT] } { + incr count_check + } + error_check_good numdups $count_check 17 + + # Done, delete all the keys for next iteration + error_check_good db_delete [$db del $txn $key 0] 0 + + # database should be empty + + set ret [$dbc get 0 $DB_FIRST] + error_check_good first_after_empty [llength $ret] 0 + } + + error_check_good dbc_close [$dbc close] 0 + error_check_good db_close [$db close] 0 + +} + +# Check function for test023; keys and data are identical +proc test023.check { key data } { + global dupnum + global dupstr + error_check_good "bad key" $key duplicate_val_test + error_check_good "data mismatch for $key" $data $dupnum$dupstr + incr dupnum +} + +proc repeat { str n } { + set ret "" + while { $n > 0 } { + set ret $str$ret + incr n -1 + } + return $ret +} diff --git a/mozilla/db/test/test024.tcl b/mozilla/db/test/test024.tcl new file mode 100644 index 00000000000..584ee1dd48d --- /dev/null +++ b/mozilla/db/test/test024.tcl @@ -0,0 +1,181 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test024.tcl 8.6 (Sleepycat) 4/26/98 +# +# DB Test 24 {method nentries} +# Test the Btree and Record number get-by-number functionality. + +proc test024 { method {nentries 10000} args} { + set do_renumber [is_rrecno $method] + set args [convert_args $method $args] + set method [convert_method $method] + set args [number_btree $method $args] + puts "Test024: $method ($args)" + + if { [string compare $method DB_HASH] == 0 } { + puts "Test024 skipping for method HASH" + return + } + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile test024.db + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + + cleanup $testdir + + # Read the first nentries dictionary elements and reverse them. + # Keep a list of these (these will be the keys). + puts "\tTest024.a: initialization" + set keys "" + set did [open $dict] + set count 0 + while { [gets $did str] != -1 && $count < $nentries } { + lappend keys [reverse $str] + incr count + } + close $did + + # Generate sorted order for the keys + set sorted_keys [lsort $keys] + # Create the database + set db [eval [concat dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method $args]] + error_check_good dbopen [is_valid_db $db] TRUE + + set flags 0 + set txn 0 + puts "\tTest024.b: put/get loop" + foreach k $keys { + if { [string compare $method DB_RECNO] == 0 } { + set key [lsearch $sorted_keys $k] + incr key + } else { + set key $k + } + set ret [$db put $txn $key $k $flags] + error_check_good put $ret 0 + set ret [$db get $txn $key $flags] + error_check_good get $ret $k + } + + # Now we will get each key from the DB and compare the results + # to the original. + puts "\tTest024.c: dump file" + + # Put sorted keys in file + set oid [open $t1 w] + foreach k $sorted_keys { + puts $oid $k + } + close $oid + + # Instead of using dump_file; get all the keys by keynum + set oid [open $t2 w] + if { [string compare $method "DB_BTREE"] == 0 } { + set flags $DB_SET_RECNO + set do_renumber 1 + } + + for { set k 1 } { $k <= $count } { incr k } { + set ret [$db getn $txn $k $flags] + puts $oid $ret + error_check_good recnum_get $ret \ + [lindex $sorted_keys [expr $k - 1]] + } + close $oid + error_check_good db_close [$db close] 0 + + error_check_good Test024.c:diff($t1,$t2) \ + [catch { exec $DIFF $t1 $t2 } res] 0 + + # Now, reopen the file and run the last test again. + puts "\tTest024.d: close, open, and dump file" + set db [ dbopen $testfile $DB_RDONLY 0 DB_UNKNOWN ] + error_check_good dbopen [is_valid_db $db] TRUE + set oid [open $t2 w] + for { set k 1 } { $k <= $count } { incr k } { + set ret [$db getn $txn $k $flags] + puts $oid $ret + error_check_good recnum_get $ret \ + [lindex $sorted_keys [expr $k - 1]] + } + close $oid + error_check_good db_close [$db close] 0 + error_check_good Test024.d:diff($t1,$t2) \ + [catch { exec $DIFF $t1 $t2 } res] 0 + + # Now, reopen the file and run the last test again in reverse direction. + puts "\tTest024.e: close, open, and dump file in reverse direction" + set db [ dbopen $testfile $DB_RDONLY 0 DB_UNKNOWN ] + error_check_good dbopen [is_valid_db $db] TRUE + # Put sorted keys in file + set rsorted "" + foreach k $sorted_keys { + set rsorted [concat $k $rsorted] + } + set oid [open $t1 w] + foreach k $rsorted { + puts $oid $k + } + close $oid + + set oid [open $t2 w] + for { set k $count } { $k > 0 } { incr k -1 } { + set ret [$db getn $txn $k $flags] + puts $oid $ret + error_check_good recnum_get $ret \ + [lindex $sorted_keys [expr $k - 1]] + } + close $oid + error_check_good db_close [$db close] 0 + error_check_good Test024.e:diff($t1,$t2) \ + [catch { exec $DIFF $t1 $t2 } res] 0 + + # Now try deleting elements and making sure they work + puts "\tTest024.f: delete test" + set db [ dbopen $testfile 0 0 DB_UNKNOWN ] + error_check_good dbopen [is_valid_db $db] TRUE + while { $count > 0 } { + set kndx [random_int 1 $count] + set kval [lindex $keys [expr $kndx - 1]] + set recno [expr [lsearch $sorted_keys $kval] + 1] + + if { [string compare $method "DB_RECNO"] == 0 } { + set ret [$db del $txn $recno 0] + } else { + set ret [$db del $txn $kval 0] + } + error_check_good delete $ret 0 + + # Remove the key from the key list + set ndx [expr $kndx - 1] + set keys [lreplace $keys $ndx $ndx] + + if { $do_renumber == 1 } { + set r [expr $recno - 1] + set sorted_keys [lreplace $sorted_keys $r $r] + } + + # Check that the keys after it have been renumbered + if { $do_renumber == 1 && $recno != $count } { + set r [expr $recno - 1] + set ret [$db getn $txn $recno $flags] + error_check_good get_after_del $ret \ + [lindex $sorted_keys $r] + } + + # Decrement count + incr count -1 + } + error_check_good db_close [$db close] 0 +} + diff --git a/mozilla/db/test/test025.tcl b/mozilla/db/test/test025.tcl new file mode 100644 index 00000000000..bb496c86d69 --- /dev/null +++ b/mozilla/db/test/test025.tcl @@ -0,0 +1,84 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test025.tcl 8.4 (Sleepycat) 4/26/98 +# +# DB Test 25 {method nentries} +# Test the DB_APPEND flag. + +proc test025 { method {nentries 10000} args} { +global kvals + set args [convert_args $method $args] + set method [convert_method $method] + set args [convert_args $method $args] + puts "Test025: $method ($args)" + + if { [string compare $method DB_BTREE] == 0 } { + puts "Test025 skipping for method BTREE" + return + } + if { [string compare $method DB_HASH] == 0 } { + puts "Test025 skipping for method HASH" + return + } + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile test025.db + set t1 $testdir/t1 + + cleanup $testdir + set db [eval [concat dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method $args]] + error_check_good dbopen [is_valid_db $db] TRUE + set did [open $dict] + + puts "\tTest025.a: put/get loop" + set txn 0 + set flags $DB_APPEND + set checkfunc test025_check + + + # Here is the loop where we put and get each key/data pair + set count 0 + while { [gets $did str] != -1 && $count < $nentries } { + set k [expr $count + 1] + set kvals($k) $str + set recno [$db put $txn 0 $str $flags] + error_check_good db_put $recno [expr $count + 1] + + set ret [$db get $txn $recno 0] + error_check_good "get $recno" $ret $str + incr count + } + close $did + + # Now we will get each key from the DB and compare the results + # to the original. + puts "\tTest025.b: dump file" + dump_file $db $txn $t1 $checkfunc + error_check_good db_close [$db close] 0 + + puts "\tTest025.c: close, open, and dump file" + # Now, reopen the file and run the last test again. + open_and_dump_file $testfile NULL $txn $t1 $checkfunc \ + dump_file_direction $DB_FIRST $DB_NEXT + + # Now, reopen the file and run the last test again in the + # reverse direction. + puts "\tTest001.d: close, open, and dump file in reverse direction" + open_and_dump_file $testfile NULL $txn $t1 $checkfunc \ + dump_file_direction $DB_LAST $DB_PREV + +} + +proc test025_check { key data } { +global kvals + error_check_good key"$key"_exists [info exists kvals($key)] 1 + error_check_good " key/data mismatch for |$key|" $data $kvals($key) +} diff --git a/mozilla/db/test/test026.tcl b/mozilla/db/test/test026.tcl new file mode 100644 index 00000000000..b1ce7afe5f1 --- /dev/null +++ b/mozilla/db/test/test026.tcl @@ -0,0 +1,100 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test026.tcl 8.5 (Sleepycat) 4/25/98 +# +# DB Test 26 {access method} +# Keyed delete test through cursor. +# If ndups is small; this will test on-page dups; if it's large, it +# will test off-page dups. +proc test026 { method {nentries 2000} {ndups 5} {tnum 26} args} { + set omethod $method + set method [convert_method $method] + set args [convert_args $method $args] + if { [string compare $method DB_RECNO] == 0 || \ + [is_rbtree $omethod] == 1 } { + puts "Test0$tnum skipping for method $omethod" + return + } + puts "Test0$tnum: $method ($args) $nentries keys with $ndups dups; cursor delete test" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile test0$tnum.db + + set flags 0 + set txn 0 + set count 0 + + # Here is the loop where we put and get each key/data pair + + puts "Test0$tnum.a: Put loop" + cleanup $testdir + set args [add_to_args $DB_DUP $args] + set db [eval [concat dbopen $testfile \ + [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method $args]] + error_check_good dbopen [is_valid_db $db] TRUE + set did [open $dict] + while { [gets $did str] != -1 && $count < [expr $nentries * $ndups] } { + set datastr [ make_data_str $str ] + for { set j 1 } { $j <= $ndups} {incr j} { + set ret [$db put $txn $str $j$datastr $flags] + error_check_good db_put $ret 0 + incr count + } + } + close $did + + error_check_good db_close [$db close] 0 + set db [ dbopen $testfile 0 0 DB_UNKNOWN ] + error_check_good dbopen [is_valid_db $db] TRUE + + # Now we will sequentially traverse the database getting each + # item and deleting it. + set count 0 + set dbc [$db cursor $txn] + error_check_good db_cursor [is_substr $dbc $db] 1 + + puts "Test0$tnum.b: Get/delete loop" + set i 1 + for { set ret [$dbc get 0 $DB_FIRST] } { + [string length $ret] != 0 } { + set ret [$dbc get 0 $DB_NEXT] } { + + set key [lindex $ret 0] + set data [lindex $ret 1] + if { $i == 1 } { + set curkey $key + } + error_check_good seq_get:key $key $curkey + error_check_good seq_get:data $data $i[make_data_str $key] + + if { $i == $ndups } { + set i 1 + } else { + incr i + } + + # Now delete the key + set ret [ $dbc del $flags ] + error_check_good db_del:$key $ret 0 + } + error_check_good dbc_close [$dbc close] 0 + error_check_good db_close [$db close] 0 + + puts "Test0$tnum.c: Verify empty file" + # Double check that file is now empty + set db [ dbopen $testfile 0 0 DB_UNKNOWN ] + error_check_good dbopen [is_valid_db $db] TRUE + set dbc [$db cursor $txn] + error_check_good db_cursor [is_substr $dbc $db] 1 + set ret [$dbc get 0 $DB_FIRST] + error_check_good get_on_empty [string length $ret] 0 + error_check_good dbc_close [$dbc close] 0 + error_check_good db_close [$db close] 0 +} diff --git a/mozilla/db/test/test027.tcl b/mozilla/db/test/test027.tcl new file mode 100644 index 00000000000..ed2a2b39d95 --- /dev/null +++ b/mozilla/db/test/test027.tcl @@ -0,0 +1,13 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test027.tcl 8.2 (Sleepycat) 4/10/98 +# +# DB Test 27 {access method} +# Check that delete operations work. Create a database; close database and +# reopen it. Then issues delete by key for each entry. +proc test027 { method {nentries 100} args} { + test026 $method $nentries 100 27 $args +} diff --git a/mozilla/db/test/test028.tcl b/mozilla/db/test/test028.tcl new file mode 100644 index 00000000000..2b9ffa59d43 --- /dev/null +++ b/mozilla/db/test/test028.tcl @@ -0,0 +1,191 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test028.tcl 8.7 (Sleepycat) 6/2/98 +# +# Put after cursor delete test. +proc test028 { method args } { + global dupnum + global dupstr + global alphabet + set omethod $method + set method [convert_method $method] + puts "Test028: $method put after cursor delete test" + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + if { [is_rbtree $omethod] == 1 } { + puts "Test0028 skipping for method $omethod" + return + } + if { [string compare $method DB_RECNO] == 0 } { + set args [add_to_args 0 $args] + set key 10 + } else { + set args [add_to_args $DB_DUP $args] + set key "put_after_cursor_del" + } + + + # Create the database and open the dictionary + set testfile test028.db + set t1 $testdir/t1 + cleanup $testdir + set db [eval [concat dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method $args]] + error_check_good dbopen [is_valid_db $db] TRUE + + set ndups 20 + set txn 0 + set flags 0 + + set dbc [$db cursor $txn] + error_check_good db_cursor [is_substr $dbc $db] 1 + + foreach i { offpage onpage } { + foreach b { bigitem smallitem } { + if { $i == "onpage" } { + if { $b == "bigitem" } { + set dupstr [repeat $alphabet 100] + } else { + set dupstr DUP + } + } else { + if { $b == "bigitem" } { + set dupstr [repeat $alphabet 100] + } else { + set dupstr [repeat $alphabet 50] + } + } + + if { $b == "bigitem" } { + set dupstr [repeat $dupstr 10] + } + puts "\tTest028: $i/$b" + + puts "\tTest028.a: Insert key with single data item" + set ret [$db put $txn $key $dupstr $flags] + error_check_good db_put $ret 0 + + # Now let's get the item and make sure its OK. + puts "\tTest028.b: Check initial entry" + set ret [$db get $txn $key $flags] + error_check_good db_get $ret $dupstr + + # Now try a put with NOOVERWRITE SET (should be error) + puts "\tTest028.c: No_overwrite test" + set ret [$db put $txn $key $dupstr $DB_NOOVERWRITE] + error_check_bad db_put $ret 0 + + # Now delete the item with a cursor + puts "\tTest028.d: Delete test" + set ret [$dbc get $key $DB_SET] + error_check_bad dbc_get:SET [llength $ret] 0 + + set ret [$dbc del $flags] + error_check_good dbc_del $ret 0 + + puts "\tTest028.e: Reput the item" + set ret [$db put $txn $key $dupstr $DB_NOOVERWRITE] + error_check_good db_put $ret 0 + + puts "\tTest028.f: Retrieve the item" + set ret [$db get $txn $key $flags] + error_check_good db_get $ret $dupstr + + # Delete the key to set up for next test + set ret [$db del $txn $key $flags] + error_check_good db_del $ret 0 + + # Now repeat the above set of tests with + # duplicates (if not RECNO). + if { [string compare $method DB_RECNO] == 0 } { + continue; + } + + puts "\tTest028.g: Insert key with duplicates" + for { set count 0 } { $count < $ndups } { incr count } { + set ret [$db put $txn $key $count$dupstr $flags] + error_check_good db_put $ret 0 + } + + puts "\tTest028.h: Check dups" + set dupnum 0 + dump_file $db $txn $t1 test028.check + + # Try no_overwrite + puts "\tTest028.i: No_overwrite test" + set ret [$db put $txn $key $dupstr $DB_NOOVERWRITE] + error_check_bad db_put $ret 0 + + # Now delete all the elements with a cursor + puts "\tTest028.j: Cursor Deletes" + set count 0 + for { set ret [$dbc get $key $DB_SET] } { + [string length $ret] != 0 } { + set ret [$dbc get 0 $DB_NEXT] } { + set k [lindex $ret 0] + set d [lindex $ret 1] + error_check_good db_seq(key) $k $key + error_check_good db_seq(data) $d $count$dupstr + set ret [$dbc del 0] + error_check_good dbc_del $ret 0 + incr count + if { $count == [expr $ndups - 1] } { + puts "\tTest028.k:\ + Duplicate No_Overwrite test" + set ret [$db put $txn $key $dupstr \ + $DB_NOOVERWRITE] + error_check_bad db_put $ret 0 + } + } + + # Make sure all the items are gone + puts "\tTest028.l: Get after delete" + set ret [$dbc get $key $DB_SET] + error_check_good get_after_del [string length $ret] 0 + + puts "\tTest028.m: Reput the item" + set ret [$db put $txn $key 0$dupstr $DB_NOOVERWRITE] + error_check_good db_put $ret 0 + for { set count 1 } { $count < $ndups } { incr count } { + set ret [$db put $txn $key $count$dupstr $flags] + error_check_good db_put $ret 0 + } + + puts "\tTest028.n: Retrieve the item" + set dupnum 0 + dump_file $db $txn $t1 test028.check + + # Clean out in prep for next test + set ret [$db del $txn $key 0] + error_check_good db_del $ret 0 + } + } + + error_check_good dbc_close [$dbc close] 0 + error_check_good db_close [$db close] 0 + +} + +# Check function for test028; keys and data are identical +proc test028.check { key data } { + global dupnum + global dupstr + error_check_good "Bad key" $key put_after_cursor_del + error_check_good "data mismatch for $key" $data $dupnum$dupstr + incr dupnum +} + +proc repeat { str n } { + set ret "" + while { $n > 0 } { + set ret $str$ret + incr n -1 + } + return $ret +} diff --git a/mozilla/db/test/test029.tcl b/mozilla/db/test/test029.tcl new file mode 100644 index 00000000000..36f0555ace5 --- /dev/null +++ b/mozilla/db/test/test029.tcl @@ -0,0 +1,168 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test029.tcl 10.7 (Sleepycat) 4/23/98 +# +# DB Test 29 {method nentries} +# Test the Btree and Record number renumbering. + +proc test029 { method {nentries 10000} args} { + set do_renumber [is_rrecno $method] + set args [convert_args $method $args] + set method [convert_method $method] + set args [number_btree $method $args] + puts "Test029: $method ($args)" + + if { [string compare $method DB_HASH] == 0 } { + puts "Test029 skipping for method HASH" + return + } + if { [string compare $method DB_RECNO] == 0 && $do_renumber != 1 } { + puts "Test029 skipping for method RECNO (w/out renumbering)" + return + } + + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + # Create the database and open the dictionary + set testfile test029.db + cleanup $testdir + + # Read the first nentries dictionary elements and reverse them. + # Keep a list of these (these will be the keys). + puts "\tTest029.a: initialization" + set keys "" + set did [open $dict] + set count 0 + while { [gets $did str] != -1 && $count < $nentries } { + lappend keys [reverse $str] + incr count + } + close $did + + # Generate sorted order for the keys + set sorted_keys [lsort $keys] + + # Save the first and last keys + set last_key [lindex $sorted_keys end] + set last_keynum [llength $sorted_keys] + + set first_key [lindex $sorted_keys 0] + set first_keynum 1 + + # Create the database + set db [eval [concat dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method $args]] + error_check_good dbopen [is_valid_db $db] TRUE + + set flags 0 + set txn 0 + puts "\tTest029.b: put/get loop" + foreach k $keys { + if { [string compare $method DB_RECNO] == 0 } { + set key [lsearch $sorted_keys $k] + incr key + } else { + set key $k + } + set ret [$db put $txn $key $k $flags] + error_check_good dbput $ret 0 + + set ret [$db get $txn $key $flags] + if { [string compare $ret $k] != 0 } { + puts "Test029: put key-data $key $k got $ret" + return + } + } + + # Now delete the first key in the database + puts "\tTest029.c: delete and verify renumber" + + # Delete the first key in the file + if { [string compare $method DB_RECNO] == 0 } { + set key $first_keynum + } else { + set key $first_key + } + + set ret [$db del $txn $key $flags] + error_check_good db_del $ret 0 + + # Verify that the keynumber of the last key changed + if { [string compare $method DB_BTREE] == 0 } { + set flags $DB_SET_RECNO + } + + # First try to get the old last key (shouldn't exist) + set ret [$db getn $txn $last_keynum $flags] + error_check_good get_after_del [is_substr $ret "not found"] 1 + + # Now try to get what we think should be the last key + set ret [$db getn $txn [expr $last_keynum - 1] $flags] + error_check_good getn_last_after_del $ret $last_key + + # Create a cursor; we need it for the next test and we + # need it for recno here. + + set dbc [$db cursor $txn] + error_check_good cursor [is_valid_widget $dbc $db.cursor] TRUE + + # OK, now re-put the first key and make sure that we + # renumber the last key appropriately. + if { [string compare $method DB_BTREE] == 0 } { + set ret [$db put $txn $key $first_key 0] + error_check_good db_put $ret 0 + } else { + # Recno + set ret [$dbc get 0 $DB_FIRST] + set ret [$dbc put $key $first_key $DB_BEFORE] + error_check_good dbc_put:DB_BEFORE $ret 0 + } + + # Now check that the last record matches the last record number + set ret [$db getn $txn $last_keynum $flags] + error_check_good getn_last_after_put $ret $last_key + + # Now delete the first key in the database using a cursor + puts "\tTest029.d: delete with cursor and verify renumber" + + set ret [$dbc get 0 $DB_FIRST] + error_check_good dbc_first [lindex $ret 0] $key + error_check_good dbc_first [lindex $ret 1] $first_key + + # Now delete at the cursor + set ret [$dbc del 0] + error_check_good dbc_del $ret 0 + + # Now check the record numbers of the last keys again. + # First try to get the old last key (shouldn't exist) + set ret [$db getn $txn $last_keynum $flags] + error_check_good get_last_after_cursor_del:$ret \ + [is_substr $ret "not found"] 1 + + # Now try to get what we think should be the last key + set ret [$db getn $txn [expr $last_keynum - 1] $flags] + error_check_good getn_after_cursor_del $ret $last_key + + # OK, now re-put the first key and make sure that we + # renumber the last key appropriately. + if { [string compare $method DB_BTREE] == 0 } { + set ret [$dbc put $key $first_key $DB_CURRENT] + error_check_good dbc_put:DB_CURRENT $ret 0 + } else { + set ret [$dbc put $key $first_key $DB_BEFORE] + error_check_good dbc_put:DB_BEFORE $ret 0 + } + + # Now check that the last record matches the last record number + set ret [$db getn $txn $last_keynum $flags] + error_check_good get_after_cursor_reput $ret $last_key + + error_check_good dbc_close [$dbc close] 0 + error_check_good db_close [$db close] 0 +} + diff --git a/mozilla/db/test/test030.tcl b/mozilla/db/test/test030.tcl new file mode 100644 index 00000000000..3a5e833bfb2 --- /dev/null +++ b/mozilla/db/test/test030.tcl @@ -0,0 +1,97 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test030.tcl 10.6 (Sleepycat) 4/10/98 +# +# DB Test 30 Run the random db tester on the specified access method. +# Options are: +# -adds +# -cursors +# -dataavg +# -dups +# -delete +# -errpct +# -init +# -keyavg +# -seed + +proc test030 { method {nops 10000} args } { +source ./include.tcl +set usage "\t-adds \ +\t-cursors \ +\t-dataavg \ +\t-dups \ +\t-delete \ +\t-errpct \ +\t-init \ +\t-keyavg \ +\t-seed " + + set method [convert_method $method] + if { [string compare $method DB_RECNO] == 0 } { + puts "Test$reopen skipping for method RECNO" + return + } + puts "Test030: Random tester on $method for $nops operations" + # Set initial parameters + set adds 100000 + set cursors 5 + set dataavg 40 + set delete 10000 + set dups 0 + set errpct 0 + set init 0 + set keyavg 25 + set seed -1 + + # Process parameters + for { set i 0 } { $i < [llength $args] } {incr i} { + switch -regexp -- [lindex $args $i] { + -a.* { incr i; set adds [lindex $args $i] } + -c.* { incr i; set cursors [lindex $args $i] } + -da.* { incr i; set dataavg [lindex $args $i] } + -de.* { incr i; set delete [lindex $args $i] } + -du.* { incr i; set dups [lindex $args $i] } + -e.* { incr i; set errpct [lindex $args $i] } + -i.* { incr i; set init [lindex $args $i] } + -k.* { incr i; set keyavg [lindex $args $i] } + -s.* { incr i; set seed [lindex $args $i] } + default { + puts $usage + return + } + } + } + + # Create the database and and initialize it. + set root $testdir/test030 + set f $root.db + cleanup $testdir + + # Run the script with 3 times the number of initial elements to + # set it up. + set db [dbopen $f [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method] + error_check_good dbopen:$f [is_valid_db $db] TRUE + + set r [$db close] + error_check_good dbclose:$f $r 0 + + # We redirect standard out, but leave standard error here so we + # can see errors. + + puts "\tTest030.a: Initializing database" + if { $init != 0 } { + set n [expr 3 * $init] + exec ./dbtest ../test/dbscript.tcl $f $n 1 $init $n $keyavg \ + $dataavg $dups 0 -1 > $testdir/test030.init + } + + puts "\tTest030.b: Now firing off random dbscript, running: " + # Now the database is initialized, run a test + puts "./dbtest ../test/dbscript.tcl $f $nops $cursors $delete $adds \ + $keyavg $dataavg $dups $errpct $seed > $testdir/test030.log" + exec ./dbtest ../test/dbscript.tcl $f $nops $cursors $delete $adds \ + $keyavg $dataavg $dups $errpct $seed > $testdir/test030.log +} diff --git a/mozilla/db/test/test031.tcl b/mozilla/db/test/test031.tcl new file mode 100644 index 00000000000..a7854e97712 --- /dev/null +++ b/mozilla/db/test/test031.tcl @@ -0,0 +1,138 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test031.tcl 10.8 (Sleepycat) 4/26/98 +# +# DB Test 31 {access method} +# Multiprocess DB test; verify that locking is basically working. +# Use the first "nentries" words from the dictionary. +# Insert each with self as key and a fixed, medium length data string. +# Then fire off multiple processes that bang on the database. Each +# one should trey to read and write random keys. When they rewrite +# They'll append their pid to the data string (sometimes doing a rewrite +# sometimes doing a partial put). + +set datastr abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz + +proc test031 { method {nentries 1000} args } { +global datastr +source ./include.tcl + + set method [convert_method $method] + if { [string compare $method DB_RECNO] == 0 } { + puts "Test$reopen skipping for method RECNO" + return + } + puts "Test031: multiprocess db $method $nentries items" + + # Parse options + set iter 1000 + set procs 5 + set seeds {} + set do_exit 0 + for { set i 0 } { $i < [llength $args] } {incr i} { + switch -regexp -- [lindex $args $i] { + -d.* { incr i; set testdir [lindex $args $i] } + -i.* { incr i; set iter [lindex $args $i] } + -p.* { incr i; set procs [lindex $args $i] } + -s.* { incr i; set seeds [lindex $args $i] } + -x.* { set do_exit 1 } + default { + test031_usage + return + } + } + } + + if { [file exists $testdir] != 1 } { + exec $MKDIR $testdir + } elseif { [file isdirectory $testdir ] != 1 } { + error "FAIL: $testdir is not a directory" + } + + # Create the database and open the dictionary + set testfile test031.db + set t1 $testdir/t1 + set t2 $testdir/t2 + set t3 $testdir/t3 + cleanup $testdir + set db [eval [concat dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method $args]] + error_check_good dbopen [is_valid_db $db] TRUE + set did [open $dict] + + set flags 0 + set txn 0 + set count 0 + + # Here is the loop where we put each key/data pair + + puts "\tTest031.a: put/get loop" + while { [gets $did str] != -1 && $count < $nentries } { + if { [string compare $method DB_RECNO] == 0 } { + set key [expr $count + 1] + set put putn + } else { + set key $str + set put put + } + set ret [$db $put $txn $key $datastr $flags] + error_check_good put:$db $ret 0 + incr count + } + close $did + error_check_good close:$db [$db close] 0 + + # Database is created, now fork off the kids. + puts "\tTest031.b: forking off $procs children" + + # Remove old mpools and Open/create the lock and mpool regions + # Test is done, blow away lock and mpool region + set ret [ lock_unlink $testdir 1 ] +# error_check_good lock_unlink $ret 0 + set ret [ memp_unlink $testdir 1 ] +# error_check_good memp_unlink $ret 0 + + set lp [lock_open "" $DB_CREATE 0644] + error_check_bad lock_open $lp NULL + error_check_good lock_open [is_substr $lp lockmgr] 1 + error_check_good lock_close [$lp close] 0 + + set mp [ memp $testdir 0644 $DB_CREATE] + error_check_bad memp $mp NULL + error_check_good memp [is_substr $mp mp] 1 + error_check_good memp_close [$mp close] 0 + + if { $do_exit == 1 } { + return + } + + # Now spawn off processes + set pidlist {} + for { set i 0 } {$i < $procs} {incr i} { + set s -1 + if { [llength $seeds] == $procs } { + set s [lindex $seeds $i] + } + puts "exec ./dbtest ../test/mdbscript.tcl $testdir $testfile \ + $nentries $iter $i $procs $s > $testdir/test031.$i.log &" + set p [exec ./dbtest ../test/mdbscript.tcl $testdir $testfile \ + $nentries $iter $i $procs $s > $testdir/test031.$i.log & ] + lappend pidlist $p + } + puts "Test031: $procs independent processes now running" + watch_procs $pidlist + + # Test is done, blow away lock and mpool region + set ret [ lock_unlink $testdir 0 ] +# error_check_good lock_unlink $ret 0 + set ret [ memp_unlink $testdir 0 ] +# error_check_good memp_unlink $ret 0 +} + +proc test031_usage { } { + puts -nonewline "test031 method nentries [-d directory] [-i iterations]" + puts " [-p procs] [-s {seeds} ] -x" +} diff --git a/mozilla/db/test/test032.tcl b/mozilla/db/test/test032.tcl new file mode 100644 index 00000000000..455515ee7f0 --- /dev/null +++ b/mozilla/db/test/test032.tcl @@ -0,0 +1,223 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test032.tcl 10.8 (Sleepycat) 4/26/98 +# +# DB Test 32 {access method} +# System integration DB test: verify that locking, recovery, checkpoint, +# and all the other utilities basically work. +# +# The test consists of $nprocs processes operating on $nfiles files. A +# transaction consists of adding the same key/data pair to some random +# number of these files. We generate a bimodal distribution in key +# size with 70% of the keys being small (1-10 characters) and the +# remaining 30% of the keys being large (uniform distribution about +# mean $key_avg). If we generate a key, we first check to make sure +# that the key is not already in the dataset. If it is, we do a lookup. +# +# XXX This test uses grow-only files currently! + +proc test032 { method {nprocs 5} {nfiles 10} {cont 0} args } { +source ./include.tcl + + set omethod $method + if { $method != "all" } { + set method [convert_method $method] + } + set args [convert_args $method $args] + if { [is_rbtree $omethod] == 1 } { + puts "Test032 skipping for method $omethod" + return + } + + puts "Test032: system integration test db $method $nprocs processes \ + on $nfiles files" + + # Parse options + set otherargs "" + set seeds {} + set key_avg 10 + set data_avg 20 + set do_exit 0 + for { set i 0 } { $i < [llength $args] } {incr i} { + switch -regexp -- [lindex $args $i] { + -key_avg { incr i; set key_avg [lindex $args $i] } + -data_avg { incr i; set data_avg [lindex $args $i] } + -s.* { incr i; set seeds [lindex $args $i] } + -testdir { incr i; set testdir [lindex $args $i] } + -x.* { set do_exit 1 } + default { + lappend otherargs [lindex $args $i] + } + } + } + + if { $cont == 0 } { + + if { [file exists $testdir] != 1 } { + exec $MKDIR $testdir + } elseif { [file isdirectory $testdir ] != 1 } { + error "FAIL: $testdir is not a directory" + } + + # Create the database and open the dictionary + cleanup $testdir + + # Create an environment + puts "\tTest032.a: creating environment and $nfiles files" + set flags [expr $DB_INIT_MPOOL | $DB_INIT_LOCK \ + | $DB_INIT_LOG | $DB_INIT_TXN] + set dbenv \ + [eval dbenv -dbflags $flags -dbhome $testdir $otherargs] + + # Create a bunch of files + set m $method + for { set i 0 } { $i < $nfiles } { incr i } { + if { $method == "all" } { + switch [random_int 1 2] { + 1 { set m DB_BTREE } + 2 { set m DB_HASH } + } + } + set otherargs [add_to_args $DB_DUP $otherargs] + set db [eval [concat dbopen \ + test032.$i.db $DB_CREATE 0644 $m \ + -dbenv $dbenv $otherargs]] + error_check_good dbopen [is_valid_db $db] TRUE + error_check_good db_close [$db close] 0 + } + } + # Close the environment + rename $dbenv {} + + if { $do_exit == 1 } { + return + } + + # Database is created, now fork off the kids. + puts "\tTest032.b: forking off $nprocs processes and utilities" + set cycle 1 + while { 1 } { + # Fire off deadlock detector and checkpointer + puts "Beginning cycle $cycle" + set ddpid [exec ./db_deadlock -h $testdir -t 5 &] + set cppid [exec ./db_checkpoint -h $testdir -p 2 &] + puts "Deadlock detector: $ddpid Checkpoint daemon $cppid" + + set pidlist {} + for { set i 0 } {$i < $nprocs} {incr i} { + set s -1 + if { [llength $seeds] == $nprocs } { + set s [lindex $seeds $i] + } + set p [exec ./dbtest ../test/sysscript.tcl $testdir \ + $nfiles $key_avg $data_avg $s > \ + $testdir/test032.$i.log & ] + lappend pidlist $p + } + puts "[timestamp] $nprocs processes running $pidlist" + exec $SLEEP [random_int 300 600] + + # Now simulate a crash + puts "[timestamp] Crashing" + exec $KILL -9 $ddpid + exec $KILL -9 $cppid + foreach p $pidlist { + exec $KILL -9 $p + } + + # Now run recovery + test032_verify $testdir $nfiles + incr cycle + } +} + +proc test032_usage { } { + puts -nonewline "test032 method nentries [-d directory] [-i iterations]" + puts " [-p procs] [-s {seeds} ] -x" +} + +proc test032_verify { dir nfiles } { +source ./include.tcl + # Save everything away in case something breaks +# for { set f 0 } { $f < $nfiles } {incr f} { +# exec $CP $dir/test032.$f.db $dir/test032.$f.save1 +# } +# foreach f [glob $dir/log.*] { +# if { [is_substr $f save] == 0 } { +# exec $CP $f $f.save1 +# } +# } + + # Run recovery and then read through all the database files to make + # sure that they all look good. + + puts "\tTest032.verify: Running recovery and verifying file contents" + set stat [catch {exec ./db_recover -v -h $dir} result] + if { $stat == 1 && [is_substr $result \ + "db_recover: Recovering the log"] == 0 } { + error "FAIL: Recovery error: $result." + } + + # Save everything away in case something breaks +# for { set f 0 } { $f < $nfiles } {incr f} { +# exec $CP $dir/test032.$f.db $dir/test032.$f.save2 +# } +# foreach f [glob $dir/log.*] { +# if { [is_substr $f save] == 0 } { +# exec $CP $f $f.save2 +# } +# } + + for { set f 0 } { $f < $nfiles } { incr f } { + set db($f) \ + [eval dbopen test032.$f.db 0 0 DB_UNKNOWN -dbhome $dir] + error_check_good $f:dbopen [is_valid_db $db($f)] TRUE + + set cursors($f) [$db($f) cursor 0] + error_check_bad $f:cursor_open $cursors($f) NULL + error_check_good $f:cursor_open [is_substr $cursors($f) $db($f)] 1 + } + + for { set f 0 } { $f < $nfiles } { incr f } { + for {set d [$cursors($f) get 0 $DB_FIRST] } \ + { [string length $d] != 0 } \ + { set d [$cursors($f) get 0 $DB_NEXT] } { + + set k [lindex $d 0] + set d [lindex $d 1] + + set flist [zero_list $nfiles] + set r $d + while { [set ndx [string first : $r]] != -1 } { + set fnum [string range $r 0 [expr $ndx - 1]] + if { [lindex $flist $fnum] == 0 } { + set fl $DB_SET + } else { + set fl $DB_NEXT + } + + if { $fl != $DB_SET || $fnum != $f } { + set full [$cursors($fnum) get $k $fl] + set key [lindex $full 0] + set rec [lindex $full 1] + error_check_good $f:dbget_$fnum:key \ + $key $k + error_check_good $f:dbget_$fnum:data \ + $rec $d + } + + set flist [lreplace $flist $fnum $fnum 1] + incr ndx + set r [string range $r $ndx end] + } + } + } + + for { set f 0 } { $f < $nfiles } { incr f } { + error_check_good $cursors($f) [$cursors($f) close] 0 + error_check_good db_close:$f [$db($f) close] 0 + } +} diff --git a/mozilla/db/test/test033.tcl b/mozilla/db/test/test033.tcl new file mode 100644 index 00000000000..afdddbf9db1 --- /dev/null +++ b/mozilla/db/test/test033.tcl @@ -0,0 +1,33 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)test033.tcl 8.2 (Sleepycat) 4/25/98 +# +proc test033 { method args } { + source ./include.tcl + set omethod $method + set method [convert_method $method] + if { [is_rbtree $omethod] == 1 } { + puts "Test033 skipping for method $omethod" + return + } + puts "Test033: $method interface test" + set testfile test033.db + cleanup $testdir + + # Create an initial database on which we can test + set flags \ + [expr $DB_INIT_MPOOL | $DB_INIT_TXN | $DB_INIT_LOCK | $DB_INIT_LOG] + set dbenv [dbenv -dbflags $flags -dbhome $testdir $args] + set db [eval dbopen \ + $testfile [expr $DB_CREATE | $DB_TRUNCATE] 0644 $method \ + -dbenv $dbenv -flags $DB_DUP $args] + error_check_good dbopen [is_valid_db $db] TRUE + + # Put a bunch of records in (including some duplicates) so that + # we can exercise all the various flags to get/put/delete and + # the cursor ops. + error_check_good db_close [$db close] 0 +} diff --git a/mozilla/db/test/test_ext.h b/mozilla/db/test/test_ext.h new file mode 100644 index 00000000000..0a1a362ed19 --- /dev/null +++ b/mozilla/db/test/test_ext.h @@ -0,0 +1,138 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * "@(#)test_ext.h 8.24 (Sleepycat) 4/10/98" + */ + +/* Macros for error handling. */ +#define DO_ENV 0x1 +#define DO_INFO 0x2 +#define USAGE(AC, R, STR, F) \ +if (AC != R) { \ + Tcl_AppendResult(interp, "Usage: ", STR, NULL); \ + if ((F) & DO_ENV) \ + Tcl_AppendResult(interp, DB_ENV_FLAGS, NULL); \ + if ((F) & DO_INFO) \ + Tcl_AppendResult(interp, DB_INFO_FLAGS, NULL); \ + return (TCL_ERROR); \ +} + +#define USAGE_GE(AC, DAC, STR, F) \ +if (AC < DAC) { \ + Tcl_AppendResult(interp, "Usage: ", STR, NULL); \ + if ((F) & DO_ENV) \ + Tcl_AppendResult(interp, DB_ENV_FLAGS, NULL); \ + if ((F) & DO_INFO) \ + Tcl_AppendResult(interp, DB_INFO_FLAGS, NULL); \ + return (TCL_ERROR); \ +} + + +#define USAGE_RANGE(AC, RL, RH, STR, F) \ +if (AC < RL || AC > RH) { \ + Tcl_AppendResult(interp, "Usage: ", STR, NULL); \ + if ((F) & DO_ENV) \ + Tcl_AppendResult(interp, DB_ENV_FLAGS, NULL); \ + if ((F) & DO_INFO) \ + Tcl_AppendResult(interp, DB_INFO_FLAGS, NULL); \ + return (TCL_ERROR); \ +} + +#define E_ERROR(S) \ + return (Tcl_AppendResult(interp, (S), ": ", Tcl_PosixError(interp), \ + NULL), TCL_ERROR) + +/* + * XXX + * These should all be Tcl_CmdProcs, but this doesn't seem to work + * under the SunOS Release 4.1.4 (LBL) #57 compiler. + */ +int args_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int dbcursor_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int dbwidget_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int debugcheck_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int dbenv_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int dbm_delete_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int dbm_fetch_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int dbm_first_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int dbm_next_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int dbm_store_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int dbminit_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int dbopen_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int dbversion_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int envwidget_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +void envwidget_delcmd __P((ClientData clientData)); +int hcreate_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int hdestroy_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int hsearch_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int lock_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int lockmgr_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int lockunlink_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int lockwidget_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int log_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int logunlink_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int logwidget_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int memp_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int mempunlink_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int mpf_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int mpwidget_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int mutex_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int mutexunlink_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int mutexwidget_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int ndbmopen_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int ndbmwidget_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int pgwidget_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int rand_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int randomint_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int srand_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int stamp_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int txn_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int txnmgr_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int txnunlink_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); +int txnwidget_cmd + __P((ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])); + diff --git a/mozilla/db/test/testutils.tcl b/mozilla/db/test/testutils.tcl new file mode 100644 index 00000000000..9a81d765ce3 --- /dev/null +++ b/mozilla/db/test/testutils.tcl @@ -0,0 +1,1128 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)testutils.tcl 10.12 (Sleepycat) 4/26/98 +# +# Test system utilities + +# open file and call dump_file to dumpkeys to tempfile +proc open_and_dump_file { + dbname dbenv txn outfile checkfunc dump_func beg cont} { + source ./include.tcl + if { $dbenv == "NULL" } { + set db [ dbopen $dbname $DB_RDONLY 0 DB_UNKNOWN ] + error_check_good dbopen [is_valid_db $db] TRUE + } else { + set db [ dbopen $dbname $DB_RDONLY 0 DB_UNKNOWN -dbenv $dbenv] + error_check_good dbopen [is_valid_db $db] TRUE + } + $dump_func $db $txn $outfile $checkfunc $beg $cont + error_check_good db_close [$db close] 0 +} + +# Sequentially read a file and call checkfunc on each key/data pair. +# Dump the keys out to the file specified by outfile. +proc dump_file { db txn outfile checkfunc } { + source ./include.tcl + dump_file_direction $db $txn $outfile $checkfunc $DB_FIRST $DB_NEXT +} + +proc dump_file_direction { db txn outfile checkfunc start continue } { + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + set outf [open $outfile w] + # Now we will get each key from the DB and dump to outfile + set c [$db cursor $txn] + for {set d [$c get 0 $start] } { [string length $d] != 0 } { + set d [$c get 0 $continue] } { + set k [lindex $d 0] + set d2 [lindex $d 1] + $checkfunc $k $d2 + puts $outf $k + } + close $outf + error_check_good curs_close [$c close] 0 +} + +proc dump_binkey_file { db txn outfile checkfunc } { + source ./include.tcl + dump_binkey_file_direction $db $txn $outfile $checkfunc \ + $DB_FIRST $DB_NEXT +} +proc dump_bin_file { db txn outfile checkfunc } { + source ./include.tcl + dump_bin_file_direction $db $txn $outfile $checkfunc $DB_FIRST $DB_NEXT +} + +proc dump_binkey_file_direction { db txn outfile checkfunc begin cont } { + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + set d1 $testdir/d1 + + set outf [open $outfile w] + + # Now we will get each key from the DB and dump to outfile + set c [$db cursor $txn] + + for {set d [$c getbinkey $d1 0 $begin] } \ + { [string length $d] != 0 } { + set d [$c getbinkey $d1 0 $cont] } { + set data [lindex $d 0] + set keyfile [lindex $d 1] + $checkfunc $data $keyfile + puts $outf $data + flush $outf + } + close $outf + error_check_good curs_close [$c close] 0 + exec $RM $d1 +} + +proc dump_bin_file_direction { db txn outfile checkfunc begin cont } { + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + set d1 $testdir/d1 + + set outf [open $outfile w] + + # Now we will get each key from the DB and dump to outfile + set c [$db cursor $txn] + + for {set d [$c getbin $d1 0 $begin] } \ + { [string length $d] != 0 } { + set d [$c getbin $d1 0 $cont] } { + set k [lindex $d 0] + set datfile [lindex $d 1] + $checkfunc $k $datfile + puts $outf $k + } + close $outf + error_check_good curs_close [$c close] 0 + exec $RM -f $d1 +} + +proc make_data_str { key } { + set datastr "" + for {set i 0} {$i < 10} {incr i} { + append datastr $key + } + return $datastr +} + +proc error_check_bad { func result bad {txn 0}} { + if { [string compare $result $bad] == 0 } { + if { $txn != 0 } { + $txn abort + } + flush stdout + flush stderr + error "FAIL:[timestamp] $func returned error value $bad" + } +} + +proc error_check_good { func result desired {txn 0} } { + if { [string compare $result $desired] != 0 } { + if { $txn != 0 } { + $txn abort + } + flush stdout + flush stderr + error "FAIL:[timestamp] $func: expected $desired, got $result" + } +} + +# Locks have the prefix of their manager. +proc is_substr { l mgr } { + if { [string first $mgr $l] == -1 } { + return 0 + } else { + return 1 + } +} + +proc release_list { l } { + + # Now release all the locks + foreach el $l { + set ret [ $el put ] + error_check_good lock_put $ret 0 + } +} + +proc debug { {stop 0} } { +global debug_on +global debug_print +global debug_test + set debug_on 1 + set debug_print 1 + set debug_test $stop +} + +# Check if each key appears exactly [llength dlist] times in the file with +# the duplicate tags matching those that appear in dlist. +proc dup_check { db txn tmpfile dlist } { +source ./include.tcl + set outf [open $tmpfile w] + # Now we will get each key from the DB and dump to outfile + set c [$db cursor $txn] + set lastkey "" + set done 0 + while { $done != 1} { + foreach did $dlist { + set rec [$c get 0 $DB_NEXT] + if { [string length $rec] == 0 } { + set done 1 + break + } + set key [lindex $rec 0] + set fulldata [lindex $rec 1] + set id [id_of $fulldata] + set d [data_of $fulldata] + if { [string compare $key $lastkey] != 0 && \ + $id != [lindex $dlist 0] } { + set e [lindex $dlist 0] + error "FAIL: \tKey $key, expected dup id $e, got $id" + } + error_check_good dupget $d $key + error_check_good dupget $id $did + set lastkey $key + } + if { $done != 1 } { + puts $outf $key + } + } + close $outf + error_check_good curs_close [$c close] 0 +} + +# Parse duplicate data entries of the form N:data. Data_of returns +# the data part; id_of returns the numerical part +proc data_of {str} { + set ndx [string first ":" $str] + if { $ndx == -1 } { + return "" + } + return [ string range $str [expr $ndx + 1] end] +} + +proc id_of {str} { + set ndx [string first ":" $str] + if { $ndx == -1 } { + return "" + } + + return [ string range $str 0 [expr $ndx - 1]] +} + +proc nop { {args} } { + return +} + +# Partial put test procedure. +# Munges a data val through three different partial puts. Stores +# the final munged string in the dvals array so that you can check +# it later (dvals should be global). We take the characters that +# are being replaced, make them capitals and then replicate them +# some number of times (n_add). We do this at the beginning of the +# data, at the middle and at the end. The parameters are: +# db, txn, key -- as per usual. Data is the original data element +# from which we are starting. n_replace is the number of characters +# that we will replace. n_add is the number of times we will add +# the replaced string back in. +proc partial_put { put db txn key data n_replace n_add } { +source ./include.tcl +global dvals + + # Here is the loop where we put and get each key/data pair + # We will do the initial put and then three Partial Puts + # for the beginning, middle and end of the string. + + $db $put $txn $key $data 0 + + # Beginning change + set s [string range $data 0 [ expr $n_replace - 1 ] ] + set repl [ replicate [string toupper $s] $n_replace ] + set newstr $repl[string range $data $n_replace end] + + set ret [$db $put $txn $key $repl $DB_DBT_PARTIAL 0 $n_replace] + error_check_good put $ret 0 + + set ret [$db get $txn $key 0] + error_check_good get $ret $newstr + + # End Change + set len [string length $newstr] + set s [string range $newstr [ expr $len - $n_replace ] end ] + set repl [ replicate [string toupper $s] $n_replace ] + set newstr [string range $newstr 0 [expr $len - $n_replace - 1 ] ]$repl + + set ret [$db $put $txn $key $repl $DB_DBT_PARTIAL \ + [expr $len - $n_replace] $n_replace ] + error_check_good put $ret 0 + + set ret [$db get $txn $key 0] + error_check_good get $ret $newstr + + # Middle Change + + set len [string length $newstr] + set mid [expr $len / 2 ] + set beg [expr $mid - [expr $n_replace / 2] ] + set end [expr $beg + $n_replace - 1] + set s [string range $newstr $beg $end] + set repl [ replicate [string toupper $s] $n_replace ] + set newstr [string range $newstr 0 [expr $beg - 1 ] ]$repl[string range $newstr [expr $end + 1] end] + + set ret [$db $put $txn $key $repl $DB_DBT_PARTIAL $beg $n_replace] + error_check_good put $ret 0 + + set ret [$db get $txn $key 0] + error_check_good get $ret $newstr + + set dvals($key) $newstr +} + +proc replicate { str times } { + set res $str + for { set i 1 } { $i < $times } { set i [expr $i * 2] } { + append res $res + } + return $res +} + +proc isqrt { l } { + set s [expr sqrt($l)] + set ndx [expr [string first "." $s] - 1] + return [string range $s 0 $ndx] +} + +proc watch_procs { l {delay 30} } { + source ./include.tcl + + while { 1 } { + set rlist {} + foreach i $l { + set r [ catch { exec $KILL -0 $i } result ] + if { $r == 0 } { + lappend rlist $i + } + } + if { [ llength $rlist] == 0 } { + break + } else { + puts "[timestamp] processes running: $rlist" + } + exec $SLEEP $delay + } + puts "All processes have exited." +} + +# These routines are all used from within the dbscript.tcl tester. +proc db_init { dbp do_data } { +global a_keys +global l_keys + set txn 0 + set nk 0 + set lastkey "" + source ./include.tcl + + set a_keys() BLANK + set l_keys "" + + set c [$dbp cursor 0] + for {set d [$c get 0 $DB_FIRST] } { [string length $d] != 0 } { + set d [$c get 0 $DB_NEXT] } { + set k [lindex $d 0] + set d2 [lindex $d 1] + incr nk + if { $do_data == 1 } { + if { [info exists a_keys($k)] } { + lappend a_keys($k) $d2] + } else { + set a_keys($k) $d2 + } + } + + lappend l_keys $k + } + error_check_good curs_close [$c close] 0 + + return $nk +} + +proc pick_op { min max n } { + if { $n == 0 } { + return add + } + + set x [random_int 1 12] + if {$n < $min} { + if { $x <= 4 } { + return put + } elseif { $x <= 8} { + return get + } else { + return add + } + } elseif {$n > $max} { + if { $x <= 4 } { + return put + } elseif { $x <= 8 } { + return get + } else { + return del + } + + } elseif { $x <= 3 } { + return del + } elseif { $x <= 6 } { + return get + } elseif { $x <= 9 } { + return put + } else { + return add + } +} + +# random_data: Generate a string of random characters. Use average +# to pick a length between 1 and 2 * avg. If the unique flag is 1, +# then make sure that the string is unique in the array "where" +proc random_data { avg unique where } { +upvar #0 $where arr +global debug_on + set min 1 + set max [expr $avg+$avg-1] + + while {1} { + set len [random_int $min $max] + set s "" + for {set i 0} {$i < $len} {incr i} { + append s [int_to_char [random_int 0 25]] + } + if { $unique == 0 || [info exists arr($s)] == 0 } { + break + } + } + + return $s +} + +proc random_key { } { +global l_keys +global nkeys + set x [random_int 0 [expr $nkeys - 1]] + return [lindex $l_keys $x] +} + +proc is_err { desired } { + set x [random_int 1 100] + if { $x <= $desired } { + return 1 + } else { + return 0 + } +} + +proc pick_cursput { } { + set x [random_int 1 4] + switch $x { + 1 { return $DB_KEYLAST } + 2 { return $DB_KEYFIRST } + 3 { return $DB_BEFORE } + 4 { return $DB_AFTER } + } +} + +proc random_cursor { curslist } { +global l_keys +global nkeys + + set x [random_int 0 [expr [llength $curslist] - 1]] + set dbc [lindex $curslist $x] + + # We want to randomly set the cursor. Pick a key. + set k [random_key] + set r [$dbc get $k $DB_SET] + error_check_good cursor_get:$k [is_substr Error $r] 0 + + # Now move forward or backward some hops to randomly + # position the cursor. + set dist [random_int -10 10] + + set dir $DB_NEXT + set boundary $DB_FIRST + if { $dist < 0 } { + set dir $DB_PREV + set boundary $DB_LAST + set dist [expr 0 - $dist] + } + + for { set i 0 } { $i < $dist } { incr i } { + set r [ record $dbc get $k $dir ] + if { [llength $d] == 0 } { + set r [ record $dbc get $k $boundary ] + } + error_check_bad dbcget [llength $r] 0 + } + return { [linsert r 0 $dbc] } +} + +proc record { args } { + puts $args + flush stdout + return [eval $args] +} + +proc newpair { k data } { +global l_keys +global a_keys +global nkeys + set a_keys($k) $data + lappend l_keys $k + incr nkeys +} + +proc rempair { k } { +global l_keys +global a_keys +global nkeys + unset a_keys($k) + set n [lsearch $l_keys $k] + error_check_bad rempair:$k $n -1 + set l_keys [lreplace $l_keys $n $n] + incr nkeys -1 +} + +proc changepair { k data } { +global l_keys +global a_keys +global nkeys + set a_keys($k) $data +} + +proc changedup { k olddata newdata } { +global l_keys +global a_keys +global nkeys + set d $a_keys($k) + error_check_bad changedup:$k [llength $d] 0 + + set n [lsearch $d $olddata] + error_check_bad changedup:$k $n -1 + + set a_keys($k) [lreplace $a_keys($k) $n $n $newdata] +} + +proc adddup { k olddata newdata where } { +global l_keys +global a_keys +global nkeys + set d $a_keys($k) + if { [llength $d] == 0 } { + lappend l_keys $k + incr nkeys + set a_keys($k) { $newdata } + } + + switch $where { + case $DB_KEYFIRST { set ndx 0 } + case $DB_KEYLAST { set ndx [llength $d] } + case $DB_KEYBEFORE { set ndx [lsearch $d $newdata] } + case $DB_KEYAFTER { set ndx [expr [lsearch $d $newdata] + 1]} + default { set ndx -1 } + } + if { $ndx == -1 } { + set ndx 0 + } + set d [linsert d $ndx $newdata] + set a_keys($k) $d +} + +proc remdup { k data } { +global l_keys +global a_keys +global nkeys + set d [$a_keys($k)] + error_check_bad changedup:$k [llength $d] 0 + + set n [lsearch $d $olddata] + error_check_bad changedup:$k $n -1 + + set a_keys($k) [lreplace $a_keys($k) $n $n] +} + +proc dump_full_file { db txn outfile checkfunc start continue } { + # Get global declarations since tcl doesn't support + # any useful equivalent to #defines! + source ./include.tcl + + set outf [open $outfile w] + # Now we will get each key from the DB and dump to outfile + set c [$db cursor $txn] + for {set d [$c get 0 $start] } { [string length $d] != 0 } { + set d [$c get 0 $continue] } { + set k [lindex $d 0] + set d2 [lindex $d 1] + $checkfunc $k $d2 + puts $outf "$k\t$d2" + } + close $outf + error_check_good curs_close [$c close] 0 +} + +proc int_to_char { i } { +global alphabet + return [string index $alphabet $i] +} + +proc dbcheck { key data } { +global l_keys +global a_keys +global nkeys +global check_array + + if { [lsearch $l_keys $key] == -1 } { + error "FAIL: Key |$key| not in list of valid keys" + } + + set d $a_keys($key) + + if { [info exists check_array($key) ] } { + set check $check_array($key) + } else { + set check {} + } + + if { [llength $d] > 1 } { + if { [llength $check] != [llength $d] } { + # Make the check array the right length + for { set i [llength $check] } { $i < [llength $d} \ + {incr i} { + lappend check 0 + } + set check_array($key) $check + } + + # Find this data's index + set ndx [lsearch $d $data] + if { $ndx == -1 } { + error "FAIL: Data |$data| not found for key $key. Found |$d|" + } + + # Set the bit in the check array + set check_array($key) [lreplace $check_array($key) $ndx $ndx 1] + } elseif { [string compare $d $data] != 0 } { + error "FAIL: Invalid data |$data| for key |$key|. Expected |$d|." + } else { + set check_array($key) 1 + } +} + +# Dump out the file and verify it +proc filecheck { file txn } { +source ./include.tcl +global check_array +global l_keys +global nkeys +global a_keys + if { [info exists check_array] == 1 } { + unset check_array + } + open_and_dump_file $file NULL $txn $file.dump dbcheck dump_full_file \ + $DB_FIRST $DB_NEXT + + # Check that everything we checked had all its data + foreach i [array names check_array] { + set count 0 + foreach j $check_array($i) { + if { $j != 1 } { + puts -nonewline "Key |$i| never found datum" + puts " [lindex $a_keys($i) $count]" + } + incr count + } + } + + # Check that all keys appeared in the checked array + set count 0 + foreach k $l_keys { + if { [info exists check_array($k)] == 0 } { + puts "filecheck: key |$k| not found. Data: $a_keys($k)" + } + incr count + } + + if { $count != $nkeys } { + puts "filecheck: Got $count keys; expected $nkeys" + } +} + +proc esetup { dir } { + source ./include.tcl + + memp_unlink $dir 1 + lock_unlink $dir 1 + exec $RM -rf $dir/file0 $dir/file1 $dir/file2 $dir/file3 + set mp [memp $dir 0644 $DB_CREATE -cachesize 10240] + set lp [lock_open "" $DB_CREATE 0644] + error_check_good memp_close [$mp close] 0 + error_check_good lock_close [$lp close] 0 +} + +proc cleanup { dir } { +source ./include.tcl + # Remove the database and environment. + txn_unlink $dir 1 + memp_unlink $dir 1 + log_unlink $dir 1 + lock_unlink $dir 1 + set ret [catch { glob $dir/* } result] + if { $ret == 0 } { + eval exec $RM -rf $result + } +} + +proc help { cmd } { + if { [info command $cmd] == $cmd } { + set is_proc [lsearch [info procs $cmd] $cmd] + if { $is_proc == -1 } { + # Not a procedure; must be a C command + # Let's hope that it takes some parameters + # and that it prints out a message + puts "Usage: [eval $cmd]" + } else { + # It is a tcl procedure + puts -nonewline "Usage: $cmd" + set args [info args $cmd] + foreach a $args { + set is_def [info default $cmd $a val] + if { $is_def != 0 } { + # Default value + puts -nonewline " $a=$val" + } elseif {$a == "args"} { + # Print out flag values + puts " options" + args + } else { + # No default value + puts -nonewline " $a" + } + } + puts "" + } + } else { + puts "$cmd is not a command" + } +} + +# Run a recovery test for a particular operation +# Notice that we catch the return from CP and do not do anything with it. +# This is because Solaris CP seems to exit non-zero on occasion, but +# everything else seems to run just fine. +proc op_recover { op dir env_cmd dbfile cmd msg } { +source ./include.tcl +global recd_debug +global recd_id +global recd_op + set init_file $dir/t1 + set afterop_file $dir/t2 + set final_file $dir/t3 + + puts "\t$msg $op" + + # Save the initial file and open the environment and the file + catch { exec $CP $dir/$dbfile $dir/$dbfile.init } res + set env [eval $env_cmd] + set nolock_env [$env simpledup] + set tmgr [txn "" 0 0 -dbenv $env] + set db [dbopen $dbfile 0 0 DB_UNKNOWN -dbenv $env] + error_check_good dbopen [is_valid_db $db] TRUE + + # Dump out file contents for initial case + open_and_dump_file $dbfile $env 0 $init_file nop \ + dump_file_direction $DB_FIRST $DB_NEXT + + set txn [$tmgr begin] + error_check_bad txn_begin $txn NULL + error_check_good txn_begin [is_substr $txn $tmgr] 1 + + # Now fill in the db and the txnid in the command + set i [lsearch $cmd TXNID] + if { $i != -1 } { + set exec_cmd [lreplace $cmd $i $i $txn] + } else { + set exec_cmd $cmd + } + set i [lsearch $exec_cmd DB] + if { $i != -1 } { + set exec_cmd [lreplace $exec_cmd $i $i $db] + } else { + set exec_cmd $exec_cmd + } + + # Execute command and commit/abort it. + set ret [eval $exec_cmd] + error_check_good "\"$exec_cmd\"" $ret 0 + + # Sync the file so that we can capture a snapshot to test + # recovery. + error_check_good sync:$db [$db sync 0] 0 + catch { exec $CP $dir/$dbfile $dir/$dbfile.afterop } res + open_and_dump_file $dbfile.afterop $nolock_env 0 $afterop_file nop \ + dump_file_direction $DB_FIRST $DB_NEXT + error_check_good txn_$op:$txn [$txn $op] 0 + + if { $op == "commit" } { + puts "\t\tCommand executed and committed." + } else { + puts "\t\tCommand executed and aborted." + } + + # Dump out file and save a copy. + error_check_good sync:$db [$db sync 0] 0 + open_and_dump_file $dbfile $nolock_env 0 $final_file nop \ + dump_file_direction $DB_FIRST $DB_NEXT + catch { exec $CP $dir/$dbfile $dir/$dbfile.final } res + + # If this is an abort, it should match the original file. + # If this was a commit, then this file should match the + # afterop file. + if { $op == "abort" } { + exec $SORT $init_file > $init_file.sort + exec $SORT $final_file > $final_file.sort + error_check_good \ + diff(initial,post-$op):diff($init_file,$final_file) \ + [catch { exec $DIFF $init_file.sort $final_file.sort } res] 0 + } else { + exec $SORT $afterop_file > $afterop_file.sort + exec $SORT $final_file > $final_file.sort + error_check_good \ + diff(post-$op,pre-commit):diff($afterop_file,$final_file) \ + [catch { exec $DIFF $afterop_file.sort $final_file.sort } res] 0 + } + + # Running recovery on this database should not do anything. + # Flush all data to disk, close the environment and save the + # file. + error_check_good close:$db [$db close] 0 + error_check_good txn_close [$tmgr close] 0 + reset_env $env + + debug_check + puts -nonewline "\t\tAbout to run recovery ... " + flush stdout + + set stat [catch {exec ./db_recover -h $dir -c} result] + if { $stat == 1 && + [is_substr $result "db_recover: Recovering the log"] == 0 } { + error "FAIL: Recovery error: $result." + } + puts "complete" + + set env [eval $env_cmd] + set nolock_env [$env simpledup] + open_and_dump_file $dbfile $nolock_env 0 $final_file nop \ + dump_file_direction $DB_FIRST $DB_NEXT + if { $op == "abort" } { + exec $SORT $init_file > $init_file.sort + exec $SORT $final_file > $final_file.sort + error_check_good \ + diff(initial,post-$op):diff($init_file,$final_file) \ + [catch { exec $DIFF $init_file.sort $final_file.sort } res] 0 + } else { + exec $SORT $afterop_file > $afterop_file.sort + exec $SORT $final_file > $final_file.sort + error_check_good \ + diff(pre-commit,post-$op):diff($afterop_file,$final_file) \ + [catch { exec $DIFF $afterop_file.sort $final_file.sort } res] 0 + } + + # Now close the environment, substitute a file that will need + # recovery and try running recovery again. + reset_env $env + if { $op == "abort" } { + catch { exec $CP $dir/$dbfile.afterop $dir/$dbfile } res + } else { + catch { exec $CP $dir/$dbfile.init $dir/$dbfile } res + } + debug_check + puts -nonewline \ + "\t\tAbout to run recovery on pre-operation database ... " + flush stdout + + set stat [catch {exec ./db_recover -h $dir -c} result] + if { $stat == 1 && + [is_substr $result "db_recover: Recovering the log"] == 0 } { + error "FAIL: Recovery error: $result." + } + puts "complete" + + set env [eval $env_cmd] + set nolock_env [$env simpledup] + open_and_dump_file $dbfile $nolock_env 0 $final_file nop \ + dump_file_direction $DB_FIRST $DB_NEXT + if { $op == "abort" } { + exec $SORT $init_file > $init_file.sort + exec $SORT $final_file > $final_file.sort + error_check_good \ + diff(initial,post-$op):diff($init_file,$final_file) \ + [catch { exec $DIFF $init_file.sort $final_file.sort } res] 0 + } else { + exec $SORT $final_file > $final_file.sort + exec $SORT $afterop_file > $afterop_file.sort + error_check_good \ + diff(post-$op,recovered):diff($afterop_file,$final_file) \ + [catch { exec $DIFF $afterop_file.sort $final_file.sort } res] 0 + } + + # This should just close the environment, not blow it away. + reset_env $env +} + +proc populate { db method txn n dups bigdata } { +source ./include.tcl + set did [open $dict] + set count 0 + while { [gets $did str] != -1 && $count < $n } { + if { $method == "DB_RECNO" } { + set key [expr $count + 1] + } elseif { $dups == 1 } { + set key duplicate_key + } else { + set key $str + } + if { $bigdata == 1 && [random_int 1 3] == 1} { + set str [replicate $str 1000] + } + + set ret [$db put $txn $key $str 0] + error_check_good db_put:$key $ret 0 + incr count + } + close $did + return 0 +} + +proc big_populate { db txn n } { +source ./include.tcl + set did [open $dict] + set count 0 + while { [gets $did str] != -1 && $count < $n } { + set key [replicate $str 50] + set ret [$db put $txn $key $str 0] + error_check_good db_put:$key $ret 0 + incr count + } + close $did + return 0 +} + +proc unpopulate { db txn num } { +source ./include.tcl + set c [$db cursor $txn] + error_check_bad $db:cursor $c NULL + error_check_good $db:cursor [is_substr $c $db] 1 + + set i 0 + for {set d [$c get 0 $DB_FIRST] } { [string length $d] != 0 } { + set d [$c get 0 $DB_NEXT] } { + $c del 0 + incr i + if { $num != 0 && $ >= $num } { + break + } + } + error_check_good cursor_close [$c close] 0 + return 0 +} + +proc reset_env { env } { + rename $env {} +} + +proc check_ret { db l txn ret } { +source ./include.tcl + if { $ret == -1 } { + if { $txn != 0 } { + puts "Aborting $txn" + return [$txn abort] + } else { + puts "Unlocking all for [$db locker]" + return [$l vec [$db locker] 0 "0 0 $DB_LOCK_PUT_ALL"] + } + } else { + return $ret + } +} +# This routine will let us obtain a ring of deadlocks. +# Each locker will get a lock on obj_id, then sleep, and +# then try to lock (obj_id + 1) % num. +# When the lock is finally granted, we release our locks and +# return 1 if we got both locks and DEADLOCK if we deadlocked. +# The results here should be that 1 locker deadlocks and the +# rest all finish successfully. +proc ring { lm locker_id obj_id num } { +source ./include.tcl + set lock1 [$lm get $locker_id $obj_id $DB_LOCK_WRITE 0] + error_check_bad lockget:$obj_id $lock1 NULL + error_check_good lockget:$obj_id [is_substr $lock1 $lm] 1 + + exec $SLEEP 4 + set nextobj [expr ($obj_id + 1) % $num] + set lock2 [$lm get $locker_id $nextobj $DB_LOCK_WRITE 0] + + # Now release the first lock + error_check_good lockput:$lock1 [$lock1 put] 0 + + if { $lock2 == "DEADLOCK" } { + return DEADLOCK + } else { + error_check_bad lockget:$obj_id $lock2 NULL + error_check_good lockget:$obj_id [is_substr $lock2 $lm] 1 + error_check_good lockput:$lock2 [$lock2 put] 0 + return 1 + } + +} + +# This routine will create massive deadlocks. +# Each locker will get a readlock on obj_id, then sleep, and +# then try to upgrade the readlock to a write lock. +# When the lock is finally granted, we release our first lock and +# return 1 if we got both locks and DEADLOCK if we deadlocked. +# The results here should be that 1 locker succeeds in getting all +# the locks and everyone else deadlocks. +proc clump { lm locker_id obj_id num } { +source ./include.tcl + set obj_id 10 + set lock1 [$lm get $locker_id $obj_id $DB_LOCK_READ 0] + error_check_bad lockget:$obj_id $lock1 NULL + error_check_good lockget:$obj_id [is_substr $lock1 $lm] 1 + + exec $SLEEP 4 + set lock2 [$lm get $locker_id $obj_id $DB_LOCK_WRITE 0] + + # Now release the first lock + error_check_good lockput:$lock1 [$lock1 put] 0 + + if { $lock2 == "DEADLOCK" } { + return DEADLOCK + } else { + error_check_bad lockget:$obj_id $lock2 NULL + error_check_good lockget:$obj_id [is_substr $lock2 $lm] 1 + error_check_good lockput:$lock2 [$lock2 put] 0 + return 1 + } + +} + +proc dead_check { t procs dead clean other } { + error_check_good $t:$procs:other $other 0 + switch $t { + ring { + error_check_good $t:$procs:deadlocks $dead 1 + error_check_good $t:$procs:success $clean \ + [expr $procs - 1] + } + clump { + error_check_good $t:$procs:deadlocks $dead \ + [expr $procs - 1] + error_check_good $t:$procs:success $clean 1 + } + default { + error "Test $t not implemented" + } + } +} +proc rdebug { id op where } { +global recd_debug +global recd_id +global recd_op + set recd_debug $where + set recd_id $id + set recd_op $op +} + +proc rtag { msg id } { + set tag [lindex $msg 0] + set tail [expr [string length $tag] - 2] + set tag [string range $tag $tail $tail] + if { $id == $tag } { + return 1 + } else { + return 0 + } +} + +proc zero_list { n } { + set ret "" + while { $n > 0 } { + lappend ret 0 + incr n -1 + } + return $ret +} + +proc check_dump { k d } { + puts "key: $k data: $d" +} + +proc lock_cleanup { dir } { + source ./include.tcl + + exec $RM -rf $dir/__db_lock.share +} +# This is defined internally in 7.4 and later versions, but since we have +# to write it 7.3 and earlier, it's easier to use it everywhere. +proc my_subst { l } { + set ret "" + foreach i $l { + if {[string range $i 0 0] == "$"} { + set v [string range $i 1 end] + upvar $v q + lappend ret [set q] + } else { + lappend ret $i + } + } + return $ret +} + +proc reverse { s } { + set res "" + for { set i 0 } { $i < [string length $s] } { incr i } { + set res "[string index $s $i]$res" + } + + return $res +} + +proc is_valid_widget { w expected } { + # First N characters must match "expected" + set l [string length $expected] + incr l -1 + if { [string compare [string range $w 0 $l] $expected] != 0 } { + puts "case 1" + return $w + } + + # Remaining characters must be digits + incr l 1 + for { set i $l } { $i < [string length $w] } { incr i} { + set c [string index $w $i] + if { $c < "0" || $c > "9" } { + return $w + } + } + + return TRUE +} +proc is_valid_db { db } { + return [is_valid_widget $db db] +} diff --git a/mozilla/db/test/txn.tcl b/mozilla/db/test/txn.tcl new file mode 100644 index 00000000000..75d01f4b7b5 --- /dev/null +++ b/mozilla/db/test/txn.tcl @@ -0,0 +1,247 @@ +# See the file LICENSE for redistribution information. +# +# Copyright (c) 1996, 1997, 1998 +# Sleepycat Software. All rights reserved. +# +# @(#)txn.tcl 10.9 (Sleepycat) 4/22/98 +# +# Options are: +# -dir +# -max +# -iterations +# -stat +proc txn_usage {} { + puts "txn -dir -iterations \ + -max -stat" +} +proc txntest { args } { +source ./include.tcl + +# Set defaults + set iterations 50 + set max 1024 + set dostat 0 + set flags 0 + for { set i 0 } { $i < [llength $args] } {incr i} { + switch -regexp -- [lindex $args $i] { + -d.* { incr i; set testdir [lindex $args $i] } + -f.* { incr i; set flags [lindex $args $i] } + -i.* { incr i; set iterations [lindex $args $i] } + -m.* { incr i; set max [lindex $args $i] } + -s.* { set dostat 1 } + default { + txn_usage + return + } + } + } + if { [file exists $testdir] != 1 } { + exec $MKDIR $testdir + } elseif { [file isdirectory $testdir ] != 1 } { + error "$testdir is not a directory" + } + + # Clean out old txn if it existed + puts "Unlinking txn: error message OK" + txn_unlink $testdir 1 + + # Now run the various functionality tests + txn001 $testdir $max $flags + txn002 $testdir $max $iterations $flags + txn003 $testdir $flags + txn004 $testdir $iterations +} + +proc txn001 { dir max flags } { +source ./include.tcl +puts "Txn001: Open/Close/Create/Unlink test" + # Try opening without Create flag should error + set tp [ txn "" 0 0 ] + error_check_good txn:fail $tp NULL + + # Now try opening with create + set tp [txn "" [expr $DB_CREATE | $flags] 0644 -maxtxns $max ] + error_check_bad txn:$dir $tp NULL + error_check_good txn:$dir [is_valid_widget $tp mgr] TRUE + + # Make sure that close works. + error_check_good txn_close:$tp [$tp close] 0 + + # Make sure we can reopen. + set tp [ txn "" $flags 0 ] + error_check_bad txn:$dir $tp NULL + error_check_good txn:$dir [is_substr $tp mgr] 1 + + # Try unlinking while we're still attached, should fail. + error_check_good txn_unlink:$dir [txn_unlink $testdir 0] -1 + + # Now close it and unlink it + error_check_good txn_close:$tp [$tp close] 0 + error_check_good txn_unlink:$dir [txn_unlink $testdir 0] 0 +} + +proc txn002 { dir max ntxns flags} { +source ./include.tcl + puts "Txn002: Basic begin, commit, abort" + + set e [dbenv -dbflags [expr $DB_CREATE | $DB_INIT_TXN | $flags]] + error_check_good dbenv [is_valid_widget $e env] TRUE + set tp [ txn "" 0 0644 -maxtxns $max -dbenv $e ] + + error_check_bad txn:$dir $tp NULL + error_check_good txn:$dir [is_substr $tp mgr] 1 + + # We will create a bunch of transactions and commit them. + set txn_list {} + set tid_list {} + puts "Txn002.a: Beginning/Committing Transactions" + for { set i 0 } { $i < $ntxns } { incr i } { + set txn [$tp begin] + error_check_good txn_begin [is_substr $txn $tp] 1 + error_check_bad txn_begin $txn NULL + 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 + } + + # We will create a bunch of transactions and abort them. + set txn_list {} + puts "Txn002.b: Beginning/Aborting Transactions" + for { set i 0 } { $i < $ntxns } { incr i } { + set txn [$tp begin] + error_check_good txn_begin [is_substr $txn $tp] 1 + error_check_bad txn_begin $txn NULL + 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 + } + + # We will create a bunch of transactions and commit them. + set txn_list {} + puts "Txn002.c: Beginning/Prepare/Committing Transactions" + for { set i 0 } { $i < $ntxns } { incr i } { + set txn [$tp begin] + error_check_good txn_begin [is_substr $txn $tp] 1 + error_check_bad txn_begin $txn NULL + 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] 0 + } + + # Now commit them all + foreach t $txn_list { + error_check_good txn_commit:$t [$t commit] 0 + } + + # Close and unlink the file + if { $e == "NULL" } { + error_check_good txn_close:$tp [$tp close] 0 + } else { + rename $e "" + } + error_check_good txn_unlink:$dir [txn_unlink $testdir 0] 0 +} + +proc txn003 { dir flags } { +source ./include.tcl + puts "Txn003: Transaction grow region test" + + set tp [ txn "" [expr $DB_CREATE | $DB_THREAD] 0644 -maxtxns 10 ] + error_check_bad txn:$dir $tp NULL + error_check_good txn:$dir [is_substr $tp mgr] 1 + + # Create initial 10 transactions. + set txn_list {} + puts "Txn003.a: Creating initial set of transactions" + for { set i 0 } { $i < 10 } { incr i } { + set txn [$tp begin] + error_check_good txn_begin [is_substr $txn $tp] 1 + error_check_bad txn_begin $txn NULL + lappend txn_list $txn + } + + # Create next set of transactions to grow region + puts "Txn003.b: Creating transactions to grow region" + for { set i 0 } { $i < 100 } { incr i } { + set txn [$tp begin] + error_check_good txn_begin [is_substr $txn $tp] 1 + error_check_bad txn_begin $txn NULL + lappend txn_list $txn + } + + # Now, randomly commit/abort the transactions + foreach t $txn_list { + if { [random_int 1 2] == 1 } { + error_check_good txn_commit:$t [$t commit] 0 + } else { + error_check_good txn_abort:$t [$t abort] 0 + } + } + + # Close and unlink the file + error_check_good txn_close:$tp [$tp close] 0 + error_check_good txn_unlink:$dir [txn_unlink $testdir 0] 0 +} + +# Verify that read-only transactions do not create +# any log records +proc txn004 { dir ntxns } { + puts "Txn004: Read-only transaction test" + source ./include.tcl + + cleanup $dir + set e [dbenv -dbflags [expr $DB_CREATE | $DB_INIT_TXN | $DB_INIT_LOG]] + error_check_good dbenv [is_valid_widget $e env] TRUE + set tp [ txn "" 0 0644 -dbenv $e ] + error_check_bad txn:$dir $tp NULL + error_check_good txn:$dir [is_substr $tp mgr] 1 + + set log [ log "" 0 0644 -dbenv $e ] + error_check_bad log:$dir $log NULL + error_check_good log:$dir:$log [is_substr $log log] 1 + + # We will create a bunch of transactions and commit them. + set txn_list {} + set tid_list {} + puts "Txn004.a: Beginning/Committing Transactions" + for { set i 0 } { $i < $ntxns } { incr i } { + set txn [$tp begin] + error_check_good txn_begin [is_substr $txn $tp] 1 + error_check_bad txn_begin $txn NULL + 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 + } + + # Now verify that there aren't any log records. + set r [$log get {0 0} $DB_FIRST ] + error_check_good log_get:$r [llength $r] 0 + + error_check_good log_close [$log close] 0 + error_check_good txn_close [$tp close] 0 + reset_env $e +} diff --git a/mozilla/db/test/utils.c b/mozilla/db/test/utils.c new file mode 100644 index 00000000000..505739f4d7d --- /dev/null +++ b/mozilla/db/test/utils.c @@ -0,0 +1,1784 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ + +#include "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)utils.c 10.46 (Sleepycat) 5/31/98"; +#endif /* not lint */ + +/* + * This file is divided up into 4 sets of functions: + * 1. The dbopen command and its support functions. + * 2. The dbwidget and dbcursor commands. + * 3. The db support functions (e.g. get, put, del) + * 4. The cursor support functions (e.g. get put, del) + */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#include +#include +#endif +#include + +#include "db_int.h" +#include "db_page.h" +#include "hash.h" +#include "dbtest.h" +#include "test_ext.h" + +/* Internal functions */ +int db_del_cmd __P((Tcl_Interp *interp, int argc, char *argv[], DB *dbp)); +int db_get_cmd __P((Tcl_Interp *interp, int argc, char *argv[], DB *dbp)); +int db_getbin_cmd __P((Tcl_Interp *interp, int argc, char *argv[], DB *dbp)); +int db_put_cmd __P((Tcl_Interp *interp, int argc, char *argv[], DB *dbp)); +int db_putbin_cmd __P((Tcl_Interp *interp, int argc, char *argv[], DB *dbp)); +int dbc_del_cmd __P((Tcl_Interp *interp, int argc, char *argv[], DBC *dbc)); +int dbc_get_cmd __P((Tcl_Interp *interp, int argc, char *argv[], DBC *dbc)); +int dbc_getbin_cmd __P((Tcl_Interp *interp, int argc, char *argv[], DBC *dbc)); +int dbc_put_cmd __P((Tcl_Interp *interp, int argc, char *argv[], DBC *dbc)); +int dbt_from_file __P((Tcl_Interp *interp, char *file, DBT *dbt)); +int dbt_to_file __P((Tcl_Interp *interp, char *file, DBT *dbt)); +u_int8_t *list_to_numarray __P((Tcl_Interp *, char *)); +void set_get_result __P((Tcl_Interp *interp, DBT *dbt)); + +/* + * dbopen_cmd -- + * Implements dbopen for dbtest. Dbopen creates a widget that + * implements all the commands found off the DB structure. + */ + +#define DBOPEN_USAGE "dbopen file flags mode type [options]\n\toptions:\n\t" + +int +dbopen_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + static int db_number = 0; + static struct { + const char *str; + DBTYPE type; + } list[] = { + {"DB_UNKNOWN", DB_UNKNOWN}, + {"db_unknown", DB_UNKNOWN}, + {"UNKNOWN", DB_UNKNOWN}, + {"unknown", DB_UNKNOWN}, + {"DB_BTREE", DB_BTREE}, + {"db_btree", DB_BTREE}, + {"BTREE", DB_BTREE}, + {"btree", DB_BTREE}, + {"DB_HASH", DB_HASH}, + {"db_hash", DB_HASH}, + {"HASH", DB_HASH}, + {"hash", DB_HASH}, + {"DB_RECNO", DB_RECNO}, + {"db_recno", DB_RECNO}, + {"RECNO", DB_RECNO}, + {"recno", DB_RECNO}, + { 0 } + }, *lp; + DB *dbp; + DBTYPE type; + DB_ENV *env; + DB_INFO *openinfo; + u_int32_t flags; + int mode, ret, tclint; + char dbname[50], *name; + + notused = NULL; + + /* Check number of arguments. */ + USAGE_GE(argc, 5, DBOPEN_USAGE, DO_INFO); + + /* Check flags and mode. */ + if (Tcl_GetInt(interp, argv[2], &tclint) != TCL_OK) + goto usage; + flags = (u_int32_t)tclint; + if (Tcl_GetInt(interp, argv[3], &mode) != TCL_OK) { +usage: Tcl_AppendResult(interp, + "\nUsage: ", DBOPEN_USAGE, DB_INFO_FLAGS, NULL); + return (TCL_OK); + } + + name = strcmp(argv[1], "NULL") == 0 ? NULL : argv[1]; + + process_am_options(interp, argc - 5, &argv[5], &openinfo); + process_env_options(interp, argc - 5, &argv[5], &env); + + /* Figure out type. */ + COMPQUIET(type, DB_HASH); + for (lp = list; lp->str != NULL; ++lp) + if (strcmp(argv[4], lp->str) == 0) { + type = lp->type; + break; + } + if (lp->str == NULL) { + Tcl_SetResult(interp, "Invalid type", TCL_STATIC); + return (TCL_ERROR); + } + + if (openinfo == NULL && type != DB_UNKNOWN) { + Tcl_AppendResult(interp, "Usage: ", DBOPEN_USAGE, + DB_INFO_FLAGS, NULL); + return (TCL_ERROR); + } + + debug_check(); + + /* Call dbopen. */ + ret = db_open(name, type, flags, mode, env, openinfo, &dbp); + if (openinfo && openinfo->re_source) + free(openinfo->re_source); + if (openinfo) + free(openinfo); + if (ret != 0) { + Tcl_SetResult(interp, "dbopen: ", TCL_STATIC); + errno = ret; + Tcl_AppendResult(interp, Tcl_PosixError(interp), NULL); + return (TCL_OK); + } + + /* Create widget command. */ + /* Create new command name. */ + sprintf(&dbname[0], "db%d", db_number); + db_number++; + + Tcl_CreateCommand(interp, dbname, dbwidget_cmd, (ClientData)dbp, NULL); + Tcl_SetResult(interp, dbname, TCL_VOLATILE); + return (TCL_OK); +} + +/* + * process_am_options -- + * Read the options in the command line and create a DB_INFO structure + * to pass to db_open. + */ +int +process_am_options(interp, argc, argv, openinfo) + Tcl_Interp *interp; + int argc; + char *argv[]; + DB_INFO **openinfo; +{ + DB_INFO *oi; + int err, tclint; + char *option; + + COMPQUIET(option, NULL); + + err = TCL_OK; + oi = (DB_INFO *)calloc(sizeof(DB_INFO), 1); + + while (argc > 1) { + if (**argv != '-') { /* Make sure it's an option */ + argc--; + argv++; + continue; + } + /* Set option to first character after "-" */ + option = argv[0]; + option++; + + if (strcmp(option, "flags") == 0) { + /* Contains flags for all access methods */ + if ((err = + Tcl_GetInt(interp, argv[1], &tclint)) != TCL_OK) + break; + oi->flags = (u_int32_t)tclint; + } else if (strcmp(option, "psize") == 0) { + if ((err = + Tcl_GetInt(interp, argv[1], &tclint)) != TCL_OK) + break; + oi->db_pagesize = (size_t)tclint; + } else if (strcmp(option, "order") == 0) { + if ((err = + Tcl_GetInt(interp, argv[1], &tclint)) != TCL_OK) + break; + oi->db_lorder = (int)tclint; + } else if (strcmp(option, "cachesize") == 0) { + if ((err = + Tcl_GetInt(interp, argv[1], &tclint)) != TCL_OK) + break; + oi->db_cachesize = (size_t)tclint; + } else if (strcmp(option, "minkey") == 0) { + /* Btree flags */ + if ((err = + Tcl_GetInt(interp, argv[1], &tclint)) != TCL_OK) + break; + oi->bt_minkey = (u_int32_t)tclint; + } else if (strcmp(option, "compare") == 0) { + /* Not sure how to handle this. */ + err = TCL_ERROR; + } else if (strcmp(option, "prefix") == 0) { + /* Not sure how to handle this. */ + err = TCL_ERROR; + } else if (strcmp(option, "ffactor") == 0) { + /* Hash flags */ + if ((err = + Tcl_GetInt(interp, argv[1], &tclint)) != TCL_OK) + break; + oi->h_ffactor = (u_int32_t)tclint; + } else if (strcmp(option, "nelem") == 0) { + if ((err = + Tcl_GetInt(interp, argv[1], &tclint)) != TCL_OK) + break; + oi->h_nelem = (u_int32_t)tclint; + } else if (strcmp(option, "hash") == 0) { + if ((err = + Tcl_GetInt(interp, argv[1], &tclint)) != TCL_OK) + break; + switch (tclint) { + case 2: oi->h_hash = __ham_func2; break; + case 3: oi->h_hash = __ham_func3; break; + case 4: oi->h_hash = __ham_func4; break; + case 5: oi->h_hash = __ham_func5; break; + } + if (oi->h_hash == NULL) { + err = TCL_ERROR; + break; + } + } else if (strcmp(option, "recdelim") == 0) { + /* Recno flags */ + if ((err = + Tcl_GetInt(interp, argv[1], &tclint)) != TCL_OK) + break; + oi->re_delim = (int)tclint; + } else if (strcmp(option, "recpad") == 0) { + if ((err = + Tcl_GetInt(interp, argv[1], &tclint)) != TCL_OK) + break; + oi->re_pad = (int)tclint; + } else if (strcmp(option, "reclen") == 0) { + if ((err = + Tcl_GetInt(interp, argv[1], &tclint)) != TCL_OK) + break; + oi->re_len = (u_int32_t)tclint; + } else if (strcmp(option, "recsrc") == 0) + oi->re_source = (char *)strdup(argv[1]); + + argc -= 2; + argv += 2; + } + if (err != TCL_OK) { + Tcl_AppendResult(interp, + "\nInvalid ", option, " value: ", argv[1], "\n", NULL); + free(oi); + oi = NULL; + } + *openinfo = oi; + return (oi ? 0 : 1); +} + +/* + * process_env_options -- + * Read the options in the command line and create a DB_ENV structure + * to pass to db_open. + */ +int +process_env_options(interp, argc, argv, envinfo) + Tcl_Interp *interp; + int argc; + char *argv[]; + DB_ENV **envinfo; +{ + DB_ENV *env; + Tcl_CmdInfo info; + u_int32_t flags; + int err, nconf, tclint; + char *option, *db_home, **config; + + COMPQUIET(option, NULL); + err = TCL_OK; + flags = 0; + db_home = Tcl_GetVar(interp, "testdir", 0); + config = NULL; + + env = (DB_ENV *)calloc(sizeof(DB_ENV), 1); + while (argc > 1) { + if (**argv != '-') { /* Make sure it's an option */ + argc--; + argv++; + continue; + } + /* Set option to first character after "-" */ + option = argv[0]; + option++; + + if (strcmp(option, "dbenv") == 0) { + /* environment already set up. */ + if (Tcl_GetCommandInfo(interp, argv[1], &info) == 0) { + Tcl_SetResult(interp, + "Invalid environment: ", TCL_STATIC); + Tcl_AppendResult(interp, argv[1], 0); + return (TCL_ERROR); + } + free(env); + *envinfo = (DB_ENV *)info.clientData; + return (TCL_OK); + } else if (strcmp(option, "dbflags") == 0) { + /* db_appinit parameters */ + if ((err = + Tcl_GetInt(interp, argv[1], &tclint)) != TCL_OK) + break; + flags = (u_int32_t)tclint; + /* + * Don't specify DB_THREAD if the architecture can't + * do spinlocks. + */ +#ifndef HAVE_SPINLOCKS + LF_CLR(DB_THREAD); +#endif + } else if (strcmp(option, "dbhome") == 0) { + db_home = argv[1]; + } else if (strcmp(option, "dbconfig") == 0) { + err = Tcl_SplitList(interp, argv[1], &nconf, &config); + if (err) + break; + } else if (strcmp(option, "maxlocks") == 0) { + /* Lock flags */ + if ((err = + Tcl_GetInt(interp, argv[1], &tclint)) != TCL_OK) + break; + env->lk_max = (u_int32_t)tclint; + } else if (strcmp(option, "nmodes") == 0) { + if ((err = + Tcl_GetInt(interp, argv[1], &tclint)) != TCL_OK) + break; + env->lk_modes = (u_int32_t)tclint; + } else if (strcmp(option, "detect") == 0) { + if ((err = + Tcl_GetInt(interp, argv[1], &tclint)) != TCL_OK) + break; + env->lk_detect = (u_int32_t)tclint; + } else if (strcmp(option, "conflicts") == 0) { + env->lk_conflicts = list_to_numarray(interp, argv[1]); + if (env->lk_conflicts == NULL) + break; + } else if (strcmp(option, "maxsize") == 0) { + /* Log flags */ + if ((err = + Tcl_GetInt(interp, argv[1], &tclint)) != TCL_OK) + break; + env->lg_max = (u_int32_t)tclint; + } else if (strcmp(option, "cachesize") == 0) { + /* Mpool flags */ + if ((err = + Tcl_GetInt(interp, argv[1], &tclint)) != TCL_OK) + break; + env->mp_size = (size_t)tclint; + } else if (strcmp(option, "maxtxns") == 0) { + /* Txn flags */ + if ((err = + Tcl_GetInt(interp, argv[1], &tclint)) != TCL_OK) + break; + env->tx_max = (u_int32_t)tclint; + } else if (strcmp(option, "rinit") == 0) { + /* Region init */ + if ((err = db_value_set(1, DB_REGION_INIT)) != 0) { + if (err == EINVAL) { + Tcl_SetResult(interp, + "EINVAL", TCL_STATIC); + return (TCL_ERROR); + } + Tcl_SetResult(interp, + "env/rinit:", TCL_STATIC); + errno = err; + Tcl_AppendResult(interp, + Tcl_PosixError(interp), 0); + return (TCL_ERROR); + } + } else if (strcmp(option, "shmem") == 0) { + /* Shared memory specification */ + if (strcmp(argv[1], "anon") == 0) { + if ((err = + db_value_set(1, DB_REGION_ANON)) != 0) { + if (err == EINVAL) { + Tcl_SetResult(interp, + "EINVAL", TCL_STATIC); + return (TCL_ERROR); + } + Tcl_SetResult(interp, + "env/shmem:", TCL_STATIC); + errno = err; + Tcl_AppendResult(interp, + Tcl_PosixError(interp), 0); + return (TCL_ERROR); + } + } else if (strcmp(argv[1], "named") == 0) { + if ((err = + db_value_set(1, DB_REGION_NAME)) != 0) { + if (err == EINVAL) { + Tcl_SetResult(interp, + "EINVAL", TCL_STATIC); + return (TCL_ERROR); + } + Tcl_SetResult(interp, + "env/shmem:", TCL_STATIC); + errno = err; + Tcl_AppendResult(interp, + Tcl_PosixError(interp), 0); + return (TCL_ERROR); + } + } else { + Tcl_SetResult(interp, + "Invalid shmem option", TCL_STATIC); + Tcl_AppendResult(interp, argv[1], NULL); + return (TCL_OK); + } + } + + argc -= 2; + argv += 2; + } + if (err != TCL_OK) { + Tcl_AppendResult(interp, "\nInvalid ", option, " value: ", + argv[1], "\n", NULL); + if (env->lk_conflicts) + free(env->lk_conflicts); + free(env); + env = NULL; + } + + /* + * Set up error stuff. + */ + + if (env) { + env->db_errfile = stderr; + env->db_errpfx = "dbtest"; + env->db_errcall = NULL; + env->db_verbose = 0; + + if ((errno = db_appinit(db_home, config, env, flags)) != 0) { + if (config) + free(config); + if (env->lk_conflicts) + free(env->lk_conflicts); + free(env); + env = NULL; + } + } + + *envinfo = env; + return (env ? 0 : 1); +} + +/* + * dbwidget -- + * Since dbopen creates a widget, we need a command that then + * handles all the widget commands. This is that command. If we + * ever add new "methods" we add new widget commands here. + */ +#define DBWIDGET_USAGE "dbN option ?arg arg ...?" +#define DBCLOSE_USAGE "dbN close" +#define DBCURS_USAGE "dbN cursor txn" +#define DBFD_USAGE "dbN fd" +#define DBSYNC_USAGE "dbN sync flags" +#define DBLOCKER_USAGE "dbN locker" + +int +dbwidget_cmd(cd_dbp, interp, argc, argv) + ClientData cd_dbp; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + static int curs_id = 0; + DB *dbp; + DBC *cursor; + DB_ENV *env; + DB_TXN *txnid; + Tcl_CmdInfo info; + u_int32_t flags; + int fd, ret, tclint; + char cursname[128]; + + dbp = (DB *)cd_dbp; + + USAGE_GE(argc, 2, DBWIDGET_USAGE, 0); + + Tcl_SetResult(interp, "0", TCL_STATIC); + + if (strcmp(argv[1], "close") == 0) { + USAGE(argc, 2, DBCLOSE_USAGE, 0); + env = dbp->dbenv; + debug_check(); +#ifdef STATISTICS + if (dbp->stat != NULL) + (void)dbp->stat(dbp, stdout); +#endif + ret = dbp->close(dbp, 0); + if (env && !F_ISSET(env, DB_ENV_STANDALONE)) { + (void)db_appexit(env); + if (env->lk_conflicts) + free(env->lk_conflicts); + free(env); + } + (void)Tcl_DeleteCommand(interp, argv[0]); + if (ret < 0) + Tcl_SetResult(interp, "1", TCL_STATIC); + else if (ret > 0) { + Tcl_SetResult(interp, "db_close:", TCL_STATIC); + errno = ret; + Tcl_AppendResult(interp, Tcl_PosixError(interp), 0); + } else + Tcl_SetResult(interp, "0", TCL_STATIC); + return (TCL_OK); + } else if (strcmp(argv[1], "cursor") == 0) { + USAGE(argc, 3, DBCURS_USAGE, 0); + sprintf(&cursname[0], "%s.cursor%d", argv[0], curs_id); + curs_id++; + if (argv[2][0] == '0' && argv[2][1] == '\0') + txnid = NULL; + else { + if (Tcl_GetCommandInfo(interp, argv[2], &info) == 0) { + Tcl_SetResult(interp, + "db_del: Invalid argument ", TCL_STATIC); + Tcl_AppendResult(interp, argv[2], + " not a transaction.", 0); + return (TCL_ERROR); + } + txnid = (DB_TXN *)(info.clientData); + } + debug_check(); + if ((ret = dbp->cursor(dbp, txnid, &cursor)) == 0) { + Tcl_CreateCommand(interp, cursname, dbcursor_cmd, + (ClientData)cursor, NULL); + Tcl_SetResult(interp, cursname, TCL_VOLATILE); + } else { + Tcl_SetResult(interp, "db_cursor:", TCL_STATIC); + errno = ret; + Tcl_AppendResult(interp, Tcl_PosixError(interp), 0); + } + return (TCL_OK); + } else if (strcmp(argv[1], "del") == 0) { + return (db_del_cmd(interp, argc, argv, dbp)); + } else if (strcmp(argv[1], "fd") == 0) { + USAGE(argc, 2, DBFD_USAGE, 0); + Tcl_ResetResult(interp); + debug_check(); + (void)dbp->fd(dbp, &fd); + sprintf(interp->result, "%d", fd); + return (TCL_OK); + } else if (strcmp(argv[1], "get") == 0) { + return (db_get_cmd(interp, argc, argv, dbp)); + } else if (strcmp(argv[1], "getn") == 0) { + return (db_get_cmd(interp, argc, argv, dbp)); + } else if (strcmp(argv[1], "getbin") == 0) { + return (db_getbin_cmd(interp, argc, argv, dbp)); + } else if (strcmp(argv[1], "getbinkey") == 0) { + return (db_getbin_cmd(interp, argc, argv, dbp)); + } else if (strcmp(argv[1], "locker") == 0) { + USAGE(argc, 2, DBLOCKER_USAGE, 0); + sprintf(cursname, "%lu", (u_long)dbp->locker); + Tcl_SetResult(interp, cursname, TCL_VOLATILE); + return (TCL_OK); + } else if (strcmp(argv[1], "put") == 0) { + return (db_put_cmd(interp, argc, argv, dbp)); + } else if (strcmp(argv[1], "putn") == 0) { + return (db_put_cmd(interp, argc, argv, dbp)); + } else if (strcmp(argv[1], "putbin") == 0) { + return (db_putbin_cmd(interp, argc, argv, dbp)); + } else if (strcmp(argv[1], "putbinkey") == 0) { + return (db_putbin_cmd(interp, argc, argv, dbp)); + } else if (strcmp(argv[1], "put0") == 0) { + return (db_put_cmd(interp, argc, argv, dbp)); + } else if (strcmp(argv[1], "sync") == 0) { + USAGE(argc, 3, DBSYNC_USAGE, 0); + if (Tcl_GetInt(interp, argv[2], &tclint) != TCL_OK) + return (TCL_ERROR); + flags = (u_int32_t)tclint; + debug_check(); + if ((ret = dbp->sync(dbp, flags)) < 0) + Tcl_SetResult(interp, "1", TCL_STATIC); + else if (ret > 0) { + Tcl_SetResult(interp, "db_sync:", TCL_STATIC); + errno = ret; + Tcl_AppendResult(interp, Tcl_PosixError(interp), 0); + } else + Tcl_SetResult(interp, "0", TCL_STATIC); + return (TCL_OK); + } else { + Tcl_SetResult(interp, DBWIDGET_USAGE, TCL_STATIC); + return (TCL_ERROR); + } +} + +#define DBCURSOR_USAGE "dbN.cursorM ?arg arg ...?" +#define DBCCLOSE_USAGE "dbN.cursorM close" +int +dbcursor_cmd(cd_dbc, interp, argc, argv) + ClientData cd_dbc; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + DBC *dbc; + + dbc = (DBC *)cd_dbc; + Tcl_SetResult(interp, "0", TCL_STATIC); + + if (strcmp(argv[1], "close") == 0) { + USAGE(argc, 2, DBCCLOSE_USAGE, 0); + debug_check(); + (void)dbc->c_close(dbc); + return (Tcl_DeleteCommand(interp, argv[0])); + } else if (strcmp(argv[1], "del") == 0) { + return (dbc_del_cmd(interp, argc, argv, dbc)); + } else if (strcmp(argv[1], "get") == 0) { + return (dbc_get_cmd(interp, argc, argv, dbc)); + } else if (strcmp(argv[1], "getn") == 0) { + return (dbc_get_cmd(interp, argc, argv, dbc)); + } else if (strcmp(argv[1], "getbin") == 0) { + return (dbc_getbin_cmd(interp, argc, argv, dbc)); + } else if (strcmp(argv[1], "getbinkey") == 0) { + return (dbc_getbin_cmd(interp, argc, argv, dbc)); + } else if (strcmp(argv[1], "put") == 0) { + return (dbc_put_cmd(interp, argc, argv, dbc)); + } else if (strcmp(argv[1], "putn") == 0) { + return (dbc_put_cmd(interp, argc, argv, dbc)); + } else { + Tcl_SetResult(interp, DBCURSOR_USAGE, TCL_STATIC); + return (TCL_ERROR); + } + /* NOTREACHED */ +} + +/* Widget support commands. */ + +#define DBDEL_USAGE "dbN del txn key flags" +int +db_del_cmd(interp, argc, argv, dbp) + Tcl_Interp *interp; + int argc; + char *argv[]; + DB *dbp; +{ + DBT key; + DB_TXN *txnid; + Tcl_CmdInfo info; + db_recno_t rkey; + u_int32_t flags; + int ret, tclint; + + USAGE(argc, 5, DBDEL_USAGE, 0); + + if (Tcl_GetInt(interp, argv[4], &tclint) != TCL_OK) { + Tcl_AppendResult(interp, "\n", DBDEL_USAGE, NULL); + return (TCL_ERROR); + } + flags = (u_int32_t)tclint; + + memset(&key, 0, sizeof(key)); + if (dbp->type == DB_RECNO) { + if (Tcl_GetInt(interp, argv[3], &tclint) != TCL_OK) + return (TCL_ERROR); + rkey = (db_recno_t)tclint; + key.data = &rkey; + key.size = sizeof(db_recno_t); + } else { + key.data = argv[3]; + key.size = strlen(argv[3]) + 1; /* Add NULL on end. */ + } + + if (argv[2][0] == '0' && argv[2][1] == '\0') + txnid = NULL; + else { + if (Tcl_GetCommandInfo(interp, argv[2], &info) == 0) { + Tcl_SetResult(interp, + "db_del: Invalid argument ", TCL_STATIC); + Tcl_AppendResult(interp, argv[2], + " not a transaction.", 0); + return (TCL_ERROR); + } + txnid = (DB_TXN *)(info.clientData); + } + + debug_check(); + + if ((ret = dbp->del(dbp, txnid, &key, flags)) == 0) + return (TCL_OK); + else if (ret == DB_NOTFOUND) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, "Key ", argv[3], " not found.", NULL); + return (TCL_OK); + } else { + Tcl_SetResult(interp, "-1", TCL_STATIC); + return (TCL_OK); + } +} + +#define DBGET_USAGE "dbN get txn key flags [beg len]" +int +db_get_cmd(interp, argc, argv, dbp) + Tcl_Interp *interp; + int argc; + char *argv[]; + DB *dbp; +{ + DBT data, key; + DB_TXN *txnid; + Tcl_CmdInfo info; + db_recno_t ikey; + u_int32_t flags; + int ret, tclint; + + USAGE_GE(argc, 5, DBGET_USAGE, 0); + + if (Tcl_GetInt(interp, argv[4], &tclint) != TCL_OK) { + Tcl_AppendResult(interp, "\n", DBGET_USAGE, NULL); + return (TCL_ERROR); + } + flags = (u_int32_t)tclint; + + memset(&key, 0, sizeof(key)); + if (dbp->type == DB_RECNO || strcmp(argv[1], "getn") == 0) { + if (Tcl_GetInt(interp, argv[3], &tclint) != TCL_OK) + return (TCL_ERROR); + ikey = (db_recno_t)tclint; + key.data = &ikey; + key.size = sizeof(db_recno_t); + } else { + key.data = argv[3]; + key.size = strlen(argv[3]) + 1; /* Add Null on end */ + } + + memset(&data, 0, sizeof(data)); + if (flags == DB_DBT_PARTIAL) { + USAGE(argc, 7, DBGET_USAGE, 0); + if (Tcl_GetInt(interp, argv[5], &tclint) != TCL_OK) + return (TCL_ERROR); + data.doff = (size_t)tclint; + if (Tcl_GetInt(interp, argv[6], &tclint) != TCL_OK) + return (TCL_ERROR); + data.dlen = (size_t)tclint; + data.flags = DB_DBT_PARTIAL; + flags = 0; + } + + if (argv[2][0] == '0' && argv[2][1] == '\0') + txnid = NULL; + else { + if (Tcl_GetCommandInfo(interp, argv[2], &info) == 0) { + Tcl_SetResult(interp, + "db_get: Invalid argument ", TCL_STATIC); + Tcl_AppendResult(interp, argv[2], + " not a transaction.", 0); + return (TCL_ERROR); + } + txnid = (DB_TXN *)(info.clientData); + } + + debug_check(); + + if (F_ISSET(dbp, DB_AM_THREAD)) + F_SET(&data, DB_DBT_MALLOC); + if ((ret = dbp->get(dbp, txnid, &key, &data, flags)) == 0) { + Tcl_ResetResult(interp); + set_get_result(interp, &data); + if (F_ISSET(&data, DB_DBT_MALLOC)) + free(data.data); + return (TCL_OK); + } else if (ret == DB_NOTFOUND) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, "Key ", argv[3], " not found.", NULL); + return (TCL_OK); + } else { + Tcl_SetResult(interp, "-1", TCL_STATIC); + return (TCL_OK); + } +} + +/* + * Used for getting and verifying the data associated with a binary + * data field in the database. These are big and tend to crash tcl. + * We do the handling of the big stuff in C. The path is the file + * into which to write the large key/data element. + */ +#define DBGETBIN_USAGE "dbN getbin path txn key flags" +int +db_getbin_cmd(interp, argc, argv, dbp) + Tcl_Interp *interp; + int argc; + char *argv[]; + DB *dbp; +{ + DBT data, key; + DB_TXN *txnid; + Tcl_CmdInfo info; + db_recno_t rkey; + u_int32_t flags; + int ret, tclint; + + USAGE(argc, 6, DBGETBIN_USAGE, 0); + + if (Tcl_GetInt(interp, argv[5], &tclint) != TCL_OK) { + Tcl_AppendResult(interp, "\n", DBGET_USAGE, NULL); + return (TCL_ERROR); + } + flags = (u_int32_t)tclint; + + memset(&key, 0, sizeof(key)); + if (strcmp(argv[1], "getbinkey") == 0) { + if (dbt_from_file(interp, argv[4], &key) != TCL_OK) + return (TCL_ERROR); + } else if (dbp->type == DB_RECNO) { + if (Tcl_GetInt(interp, argv[4], &tclint) != TCL_OK) + return (TCL_ERROR); + rkey = (db_recno_t)tclint; + key.data = &rkey; + key.size = sizeof(db_recno_t); + } else { + key.data = argv[4]; + key.size = strlen(argv[4]) + 1; /* Add Null on end */ + } + + memset(&data, 0, sizeof(data)); + if (strcmp(argv[1], "getbinkey") != 0) + F_SET(&data, DB_DBT_MALLOC); + + if (argv[3][0] == '0' && argv[3][1] == '\0') + txnid = NULL; + else { + if (Tcl_GetCommandInfo(interp, argv[3], &info) == 0) { + Tcl_SetResult(interp, + "db_getbin: Invalid argument ", TCL_STATIC); + Tcl_AppendResult(interp, argv[3], + " not a transaction.", 0); + return (TCL_ERROR); + } + txnid = (DB_TXN *)(info.clientData); + } + + debug_check(); + + if ((ret = dbp->get(dbp, txnid, &key, &data, flags)) == DB_NOTFOUND) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, "Key ", argv[3], " not found.", NULL); + return (TCL_OK); + } else if (ret != 0) { + Tcl_SetResult(interp, "-1", TCL_STATIC); + return (TCL_OK); + } + + /* Got item; write it to file. */ + if (strcmp(argv[1], "getbinkey") == 0) { + free(key.data); + Tcl_SetResult(interp, data.data, TCL_VOLATILE); + } else { + if (dbt_to_file(interp, argv[2], &data) != TCL_OK) + return (TCL_ERROR); + Tcl_SetResult(interp, argv[2], TCL_VOLATILE); + } + + return (TCL_OK); +} + +#define DBPUT_USAGE "dbN put txn key data flags" +#define DBPPUT_USAGE "dbN put txn key data flags doff dlen" +int +db_put_cmd(interp, argc, argv, dbp) + Tcl_Interp *interp; + int argc; + char *argv[]; + DB *dbp; +{ + DBT data, key; + DB_TXN *txnid; + Tcl_CmdInfo info; + db_recno_t ikey; + u_int32_t flags; + int ret, tclint; + char numbuf[16]; + + USAGE_GE(argc, 6, DBPUT_USAGE, 0); + + if (Tcl_GetInt(interp, argv[5], &tclint) != TCL_OK) { + Tcl_AppendResult(interp, "\n", DBPUT_USAGE, NULL); + return (TCL_ERROR); + } + flags = (u_int32_t)tclint; + + memset(&key, 0, sizeof(key)); + if (strcmp(argv[1], "putn") == 0 || dbp->type == DB_RECNO) { + if (Tcl_GetInt(interp, argv[3], &tclint) != TCL_OK) + return (TCL_ERROR); + ikey = (db_recno_t)tclint; + key.data = &ikey; + key.size = sizeof(db_recno_t); + } else { + key.data = argv[3]; + key.size = strlen(argv[3]) + 1; /* Add Null on end */ + } + + memset(&data, 0, sizeof(data)); + data.data = argv[4]; + data.size = strlen(argv[4]) + (strcmp(argv[1], "put0") == 0 ? 0 : 1); + + /* + * If the partial flag is set, then arguments 6 and 7 are the + * offset and length respectively. + */ + if (flags == DB_DBT_PARTIAL) { + USAGE_GE(argc, 8, DBPPUT_USAGE, 0); + if (Tcl_GetInt(interp, argv[6], &tclint) != TCL_OK) + return (TCL_ERROR); + data.doff = (size_t)tclint; + if (Tcl_GetInt(interp, argv[7], &tclint) != TCL_OK) + return (TCL_ERROR); + data.dlen = (size_t)tclint; + data.flags = DB_DBT_PARTIAL; + data.size--; /* Remove the NULL */ + flags = 0; + } + + if (argv[2][0] == '0' && argv[2][1] == '\0') + txnid = NULL; + else { + if (Tcl_GetCommandInfo(interp, argv[2], &info) == 0) { + Tcl_SetResult(interp, + "db_put: Invalid argument ", TCL_STATIC); + Tcl_AppendResult(interp, argv[2], + " not a transaction.", 0); + return (TCL_ERROR); + } + txnid = (DB_TXN *)(info.clientData); + } + debug_check(); + + if ((ret = dbp->put(dbp, txnid, &key, &data, flags)) == 0) { + if (LF_ISSET(DB_APPEND)) { + if (key.size != sizeof(db_recno_t)) { + Tcl_SetResult(interp, + "Error: key not integer", TCL_STATIC); + return (TCL_ERROR); + } + memcpy(&ikey, key.data, sizeof(db_recno_t)); + sprintf(numbuf, "%ld", (long)ikey); + Tcl_SetResult(interp, numbuf, TCL_VOLATILE); + } else { + Tcl_SetResult(interp, "0", TCL_STATIC); + } + } else if (ret < 0) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, "Error on put of key ", + argv[3], " either not found or bad flag values.", NULL); + } else { + Tcl_SetResult(interp, "-1", TCL_STATIC); + } + return (TCL_OK); +} + +/* + * Used for putting very large data items into a db file. Instead of + * passing the data in a DB, we'll pass a file name and read the data + * from the file and put it in the db. This can be checked using the + * getbin command. + */ +#define DBPUTBIN_USAGE "dbN put txn key data flags" +int +db_putbin_cmd(interp, argc, argv, dbp) + Tcl_Interp *interp; + int argc; + char *argv[]; + DB *dbp; +{ + DBT data, key; + DB_TXN *txnid; + Tcl_CmdInfo info; + db_recno_t rkey; + u_int32_t flags; + int ret, tclint; + void *p; + + USAGE(argc, 6, DBPUTBIN_USAGE, 0); + + if (Tcl_GetInt(interp, argv[5], &tclint) != TCL_OK) { + Tcl_AppendResult(interp, "\n", DBPUT_USAGE, NULL); + return (TCL_ERROR); + } + flags = (u_int32_t)tclint; + + memset(&key, 0, sizeof(key)); + memset(&data, 0, sizeof(data)); + if (strcmp(argv[1], "putbinkey") == 0) { + /* Get data from file. */ + if (dbt_from_file(interp, argv[3], &key) != TCL_OK) + return (TCL_ERROR); + data.data = argv[4]; + data.size = strlen(argv[4]) + 1; /* Add Null on end */ + p = key.data; + } else { + if (dbt_from_file(interp, argv[4], &data) != TCL_OK) + return (TCL_ERROR); + p = data.data; + + if (dbp->type == DB_RECNO) { + if (Tcl_GetInt(interp, argv[3], &tclint) != TCL_OK) + return (TCL_ERROR); + rkey = (db_recno_t)tclint; + key.data = &rkey; + key.size = sizeof(db_recno_t); + } else { + key.data = argv[3]; + key.size = strlen(argv[3]) + 1; /* Add Null on end */ + } + } + + if (argv[2][0] == '0' && argv[2][1] == '\0') + txnid = NULL; + else { + if (Tcl_GetCommandInfo(interp, argv[2], &info) == 0) { + Tcl_SetResult(interp, + "db_putbin: Invalid argument ", TCL_STATIC); + Tcl_AppendResult(interp, argv[2], + " not a transaction.", 0); + return (TCL_ERROR); + } + txnid = (DB_TXN *)(info.clientData); + } + debug_check(); + + ret = dbp->put(dbp, txnid, &key, &data, flags); + free(p); + + if (ret == 0) + return (TCL_OK); + else if (ret < 0) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, "Key ", argv[3], " not found.", NULL); + return (TCL_OK); + } else { + Tcl_SetResult(interp, "-1", TCL_STATIC); + return (TCL_OK); + } +} + +/* Cursor support commands. */ + +#define DBCDEL_USAGE "cursorN del flags" +int +dbc_del_cmd(interp, argc, argv, dbc) + Tcl_Interp *interp; + int argc; + char *argv[]; + DBC *dbc; +{ + u_int32_t flags; + int ret, tclint; + + USAGE(argc, 3, DBCDEL_USAGE, 0); + + if (Tcl_GetInt(interp, argv[2], &tclint) != TCL_OK) { + Tcl_AppendResult(interp, "\n", DBCDEL_USAGE, NULL); + return (TCL_ERROR); + } + flags = (u_int32_t)tclint; + + debug_check(); + + if ((ret = dbc->c_del(dbc, flags)) == 0) + return (TCL_OK); + else if (ret < 0) { + Tcl_SetResult(interp, "Uninitialized Cursor", TCL_STATIC); + return (TCL_OK); + } else { + Tcl_SetResult(interp, "-1", TCL_STATIC); + return (TCL_OK); + } +} + +#define DBCGET_USAGE "cursorN get key flags [beg len]" +int +dbc_get_cmd(interp, argc, argv, dbc) + Tcl_Interp *interp; + int argc; + char *argv[]; + DBC *dbc; +{ + DBT data, key; + db_recno_t rkey; + u_int32_t flags; + int ret, tclint; + char numbuf[16]; + + USAGE_GE(argc, 4, DBCGET_USAGE, 0); + + if (Tcl_GetInt(interp, argv[3], &tclint) != TCL_OK) { + Tcl_AppendResult(interp, "\n", DBCGET_USAGE, NULL); + return (TCL_ERROR); + } + flags = (u_int32_t)tclint; + + memset(&key, 0, sizeof(key)); + if (dbc->dbp->type == DB_RECNO || strcmp(argv[1], "getn") == 0) { + if (Tcl_GetInt(interp, argv[2], &tclint) != TCL_OK) + return (TCL_ERROR); + rkey = (db_recno_t)tclint; + key.data = &rkey; + key.size = sizeof(db_recno_t); + } else { + key.data = argv[2]; + key.size = strlen(argv[2]) + 1; /* Add Null on end */ + } + + memset(&data, 0, sizeof(data)); + if (LF_ISSET(DB_DBT_PARTIAL)) { + USAGE(argc, 6, DBCGET_USAGE, 0); + if (Tcl_GetInt(interp, argv[4], &tclint) != TCL_OK) + return (TCL_ERROR); + data.doff = (size_t)tclint; + if (Tcl_GetInt(interp, argv[5], &tclint) != TCL_OK) + return (TCL_ERROR); + data.dlen = (size_t)tclint; + data.flags = DB_DBT_PARTIAL; + LF_CLR(DB_DBT_PARTIAL); + } + + debug_check(); + + if (F_ISSET(dbc->dbp, DB_AM_THREAD)) { + F_SET(&data, DB_DBT_MALLOC); + switch(flags) { + case DB_FIRST: + case DB_LAST: + case DB_NEXT: + case DB_PREV: + case DB_CURRENT: + case DB_SET_RANGE: + case DB_SET_RECNO: + case DB_GET_RECNO: + F_SET(&key, DB_DBT_MALLOC); + break; + /* case DB_SET: Do nothing */ + } + } + if ((ret = dbc->c_get(dbc, &key, &data, flags)) == 0) { + if (dbc->dbp->type == DB_RECNO) { + if (key.size != sizeof(db_recno_t)) { + Tcl_SetResult(interp, + "Error: key not integer", TCL_STATIC); + if (F_ISSET(&data, DB_DBT_MALLOC)) + free(&data.data); + if (F_ISSET(&key, DB_DBT_MALLOC)) + free(&key.data); + return (TCL_ERROR); + } + memcpy(&rkey, key.data, sizeof(db_recno_t)); + sprintf(numbuf, "%ld", (long)rkey); + Tcl_SetResult(interp, numbuf, TCL_VOLATILE); + } else + Tcl_SetResult(interp, key.data, TCL_VOLATILE); + + Tcl_AppendResult(interp, " {", NULL); + set_get_result(interp, &data); + Tcl_AppendResult(interp, "} ", NULL); + if (F_ISSET(&data, DB_DBT_MALLOC)) + free(&data.data); + if (F_ISSET(&key, DB_DBT_MALLOC)) + free(&key.data); + return (TCL_OK); + } else if (ret < 0) { /* End/Beginning of file. */ + Tcl_ResetResult(interp); + return (TCL_OK); + } else { + Tcl_SetResult(interp, "-1", TCL_STATIC); + return (TCL_OK); + } +} + +#define DBCGETBIN_USAGE "cursorN getbin file key flags" +int +dbc_getbin_cmd(interp, argc, argv, dbc) + Tcl_Interp *interp; + int argc; + char *argv[]; + DBC *dbc; +{ + DBT data, key, *dbt; + db_recno_t rkey; + u_int32_t flags; + int ret, tclint; + char nbuf[32]; + + USAGE(argc, 5, DBCGET_USAGE, 0); + + if (Tcl_GetInt(interp, argv[4], &tclint) != TCL_OK) { + Tcl_AppendResult(interp, "\n", DBCGET_USAGE, NULL); + return (TCL_ERROR); + } + flags = (u_int32_t)tclint; + + memset(&key, 0, sizeof(key)); + if (flags == DB_SET || flags == DB_KEYFIRST || flags == DB_KEYLAST) + if (strcmp(argv[1], "getbinkey") == 0) { + if (dbt_from_file(interp, argv[3], &key) != TCL_OK) + return (TCL_ERROR); + } else if (dbc->dbp->type == DB_RECNO) { + if (Tcl_GetInt(interp, argv[3], &tclint) != TCL_OK) + return (TCL_ERROR); + rkey = (db_recno_t)tclint; + key.data = &rkey; + key.size = sizeof(db_recno_t); + } else { + key.data = argv[3]; + key.size = strlen(argv[3]) + 1; /* Add Null on end */ + } + + memset(&data, 0, sizeof(data)); + if (strcmp(argv[1], "getbinkey") != 0 && dbc->dbp->type != DB_RECNO) + F_SET(&data, DB_DBT_MALLOC); + + debug_check(); + + ret = dbc->c_get(dbc, &key, &data, flags); + if (ret < 0) { /* End/Beginning of file. */ + Tcl_ResetResult(interp); + return (TCL_OK); + } else if (ret != 0) { + Tcl_SetResult(interp, "-1", TCL_STATIC); + return (TCL_OK); + } + + /* Got key; write it or its data to a file. */ + if (strcmp(argv[1], "getbinkey") == 0) { + dbt = &key; + Tcl_SetResult(interp, data.data, TCL_VOLATILE); + } else if (dbc->dbp->type == DB_RECNO) { + dbt = &data; + memcpy(&rkey, key.data, sizeof(db_recno_t)); + sprintf(nbuf, "%ld", (long)rkey); + Tcl_SetResult(interp, nbuf, TCL_VOLATILE); + } else { + dbt = &data; + Tcl_SetResult(interp, key.data, TCL_VOLATILE); + } + + if (dbt_to_file(interp, argv[2], dbt) != TCL_OK) + return (TCL_ERROR); + + Tcl_AppendElement(interp, argv[2]); + return (TCL_OK); +} + +#define DBCPUT_USAGE "cursorN put key data flags" +int +dbc_put_cmd(interp, argc, argv, dbc) + Tcl_Interp *interp; + int argc; + char *argv[]; + DBC *dbc; +{ + DBT data, key; + db_recno_t ikey; + u_int32_t flags; + int ret, tclint; + + USAGE(argc, 5, DBCPUT_USAGE, 0); + + if (Tcl_GetInt(interp, argv[4], &tclint) != TCL_OK) { + Tcl_AppendResult(interp, "\n", DBCPUT_USAGE, NULL); + return (TCL_ERROR); + } + flags = (u_int32_t)tclint; + + /* + * If this is a DB_CURRENT, we should never look at the key, so + * send it a NULL. + */ + memset(&key, 0, sizeof(key)); + if (flags != DB_CURRENT) + if (strcmp(argv[1], "putn") == 0 || + dbc->dbp->type == DB_RECNO) { + if (Tcl_GetInt(interp, argv[2], &tclint) != TCL_OK) + return (TCL_ERROR); + ikey = (db_recno_t)tclint; + key.data = &ikey; + key.size = sizeof(db_recno_t); + } else { + key.data = argv[2]; + key.size = strlen(argv[2]) + 1; /* Add Null on end */ + } + + memset(&data, 0, sizeof(data)); + data.data = argv[3]; + data.size = strlen(argv[3]) + 1; + + debug_check(); + + if ((ret = dbc->c_put(dbc, &key, &data, flags)) == 0) + return (TCL_OK); + else if (ret < 0) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, "Key ", argv[2], " not found.", NULL); + return (TCL_OK); + } else { + Tcl_SetResult(interp, "-1", TCL_STATIC); + return (TCL_OK); + } +} + +u_int8_t * +list_to_numarray(interp, str) + Tcl_Interp *interp; + char *str; +{ + int argc, i, tmp; + u_int8_t *nums, *np; + char **argv, **ap; + + if (Tcl_SplitList(interp, str, &argc, &argv) != TCL_OK) + return (NULL); + if ((nums = (u_int8_t *)calloc(argc, sizeof(u_int8_t))) == NULL) { + Tcl_SetResult(interp, Tcl_PosixError(interp), TCL_STATIC); + return (NULL); + } + + for (np = nums, ap = argv, i = 0; i < argc; i++, ap++, np++) { + if (Tcl_GetInt(interp, *ap, &tmp) != TCL_OK) { + free (nums); + return (NULL); + } + *np = (u_int8_t)tmp; /* XXX: Possible overflow. */ + } +#ifndef _WIN32 + /* + * XXX + * This currently traps on Windows/NT, probably due to a mismatch of + * malloc/free implementations between the TCL library and this module. + * Sidestep the issue for now. + */ + free(argv); +#endif + return (nums); +} + +#define STAMP_USAGE "timestamp [-r]" +int +stamp_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + static time_t start; + struct tm *tp; + time_t elapsed, now; + static char buf[25]; + + notused = NULL; + + USAGE_GE(argc, 1, STAMP_USAGE, 0); + (void)time(&now); + if (now == (time_t)-1) + goto err; + if (argc > 1 && strcmp(argv[1], "-r") == 0) { + sprintf(buf, "%lu", (u_long)now); + Tcl_SetResult(interp, buf, TCL_STATIC); + return (TCL_OK); + } + if ((tp = localtime(&now)) == NULL) + goto err; + + if (start == 0) + start = now; + elapsed = now - start; + (void)sprintf(buf, "%02d:%02d:%02d (%02d:%02d:%02d)", + tp->tm_hour, tp->tm_min, tp->tm_sec, (int)(elapsed / 3600), + (int)((elapsed % 3600) / 60), (int)(((elapsed % 3600) % 60))); + start = now; + + Tcl_SetResult(interp, buf, TCL_STATIC); + return (TCL_OK); + +err: Tcl_SetResult(interp, Tcl_PosixError(interp), TCL_STATIC); + return (TCL_ERROR); +} + +int debug_stop; /* Stop on each iteration. */ + +void +debug_check() +{ + if (debug_on == 0) + return; + + if (debug_print != 0) { + printf("\r%6d:", debug_on); + fflush(stdout); + } + + if (debug_on++ == debug_test || debug_stop) + __db_loadme(); +} + +int +dbt_from_file(interp, file, dbt) + Tcl_Interp *interp; + char *file; + DBT *dbt; +{ + size_t len, size; + ssize_t nr; + u_int32_t mbytes, bytes; + int fd; + + /* Get data from file. */ + fd = -1; + len = strlen(file) + 1; + if ((errno = __db_open(file, DB_RDONLY, DB_RDONLY, 0, &fd)) != 0) + goto err; + if ((errno = __db_ioinfo(file, fd, &mbytes, &bytes, NULL)) != 0) + goto err; + size = mbytes * MEGABYTE + bytes; + if ((dbt->data = (void *)malloc(size + len)) == NULL) + goto err; + if ((errno = + __db_read(fd, ((u_int8_t *)dbt->data) + len, size, &nr)) != 0) + goto err; + if (nr != (ssize_t)size) { + errno = EIO; + goto err; + } + if ((errno =__db_close(fd)) != 0) { +err: if (fd != -1) + close(fd); + Tcl_SetResult(interp, Tcl_PosixError(interp), TCL_STATIC); + return (TCL_ERROR); + } + strcpy((char *)(dbt->data), file); + dbt->size = size + (u_int32_t)len; + dbt->flags = 0; + return (TCL_OK); +} + +/* + * file is the file we are creating. ofile is the original file + * name so we know how many characters to drop off the end. + */ +int +dbt_to_file(interp, file, dbt) + Tcl_Interp *interp; + char *file; + DBT *dbt; +{ + size_t len; + ssize_t nw; + int fd; + char *p; + + /* Got key; write it to file. */ + for (len = 1, p = (char *)(dbt->data); *p != '\0'; len++, p++) + ; + p++; + + fd = -1; + if ((errno = __db_open(file, DB_CREATE | DB_TRUNCATE, + DB_CREATE | DB_TRUNCATE, 0644, &fd)) != 0 || + (errno = __db_write(fd, p, dbt->size - len, &nw) != 0) || + nw != (ssize_t)(dbt->size - len) || + (errno = __db_close(fd)) != 0) { + if (errno == 0) + errno = EIO; + if (fd == -1) + (void)__db_close(fd); + Tcl_SetResult(interp, Tcl_PosixError(interp), TCL_STATIC); + return (TCL_ERROR); + } + if (F_ISSET(dbt, DB_DBT_MALLOC)) + free(dbt->data); + return (TCL_OK); +} + +void +set_get_result(interp, dbt) + Tcl_Interp *interp; + DBT *dbt; +{ + size_t i; + u_int8_t *p; + char numbuf[32], sprbuf[128], *outbuf; + + for (i = 0, p = dbt->data; i < dbt->size && *p == '\0'; i++, p++) + ; + /* + * If this is a partial get, we need to make sure that the last + * character is a NUL so that tcl can handle it. + */ + if (F_ISSET(dbt, DB_DBT_PARTIAL)) { + if (dbt->size == 0) + ((char *)dbt->data)[0] = '\0'; + else + ((char *)dbt->data)[dbt->size - 1] = '\0'; + } + + if (i == 0) { + if (((u_int8_t *)dbt->data)[dbt->size - 1] != '\0') { + outbuf = (char *)malloc(dbt->size + 1); + memcpy(outbuf, dbt->data, dbt->size); + outbuf[dbt->size] = '\0'; + } else + outbuf = dbt->data; + Tcl_AppendResult(interp, outbuf, NULL); + if (outbuf != dbt->data) + free(outbuf); + } else { + sprintf(&numbuf[0], "%lu", (u_long)i); + sprintf(&sprbuf[0], " %%.%ds", dbt->size - i); + outbuf = (char *)malloc(dbt->size - i + 5); + sprintf(outbuf, sprbuf, p); + Tcl_AppendResult(interp, numbuf, outbuf, NULL); + free(outbuf); + } +} + +#define SRAND_USAGE "srand seed" +int +srand_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + int ival; + + notused = NULL; + USAGE(argc, 2, SRAND_USAGE, 0); + if (Tcl_GetInt(interp, argv[1], &ival) != TCL_OK) + return (TCL_ERROR); + + srand((u_int)ival); + Tcl_SetResult(interp, "0", TCL_STATIC); + return (TCL_OK); +} + +#define RAND_USAGE "rand" +int +rand_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + char retbuf[50]; + + notused = NULL; + argv = NULL; + USAGE(argc, 1, RAND_USAGE, 0); + + sprintf(retbuf, "%ld", (long)rand()); + Tcl_SetResult(interp, retbuf, TCL_VOLATILE); + return (TCL_OK); +} + +#define RANDOMINT_USAGE "random_int lo hi" +int +randomint_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + long t; + int lo, hi, ret; + char retbuf[50]; + + notused = NULL; + USAGE(argc, 3, RANDOMINT_USAGE, 0); + if (Tcl_GetInt(interp, argv[1], &lo) != TCL_OK || + Tcl_GetInt(interp, argv[2], &hi) != TCL_OK) + return (TCL_ERROR); + +#ifndef RAND_MAX +#define RAND_MAX 0x7fffffff +#endif + t = rand(); + if (t > RAND_MAX) + printf("Max random is higher than %ld\n", (long)RAND_MAX); + ret = (int)(((double)t / ((double)(RAND_MAX) + 1)) * (hi - lo + 1)); + ret += lo; + sprintf(retbuf, "%d", ret); + Tcl_SetResult(interp, retbuf, TCL_VOLATILE); + return (TCL_OK); +} + +#define VERSION_USAGE "db_version" +int +dbversion_cmd(notused, interp, argc, notused2) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *notused2[]; +{ + char *str; + + notused = NULL; + notused2 = NULL; + USAGE(argc, 1, VERSION_USAGE, 0); + str = db_version(NULL, NULL, NULL); + if (str == NULL) { + Tcl_SetResult(interp, "db_version: ", TCL_STATIC); + Tcl_AppendResult(interp, Tcl_PosixError(interp), 0); + return (TCL_ERROR); + } + Tcl_SetResult(interp, str, TCL_DYNAMIC); + return (TCL_OK); +} + +/* + * Create an environment that we can pass around between different + * calls. + */ +#define DBENV_USAGE "dbenv " +int +dbenv_cmd(notused, interp, argc, argv) + ClientData notused; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + static int env_number = 0; + DB_ENV *env; + char envname[50]; + + debug_check(); + notused = NULL; + + /* Check number of arguments. */ + USAGE_GE(argc, 1, DBENV_USAGE, DO_ENV); + + process_env_options(interp, argc - 1, &argv[1], &env); + if (env == NULL) { + Tcl_SetResult(interp, "NULL", TCL_STATIC); + return (TCL_OK); + } + + F_SET(env, DB_ENV_STANDALONE); + + /* Create new command name. */ + sprintf(&envname[0], "env%d", env_number); + env_number++; + + Tcl_CreateCommand(interp, envname, envwidget_cmd, (ClientData)env, + envwidget_delcmd); + Tcl_SetResult(interp, envname, TCL_VOLATILE); + return (TCL_OK); +} + +void +envwidget_delcmd(cd) + ClientData cd; +{ + DB_ENV *env; + + debug_check(); + env = (DB_ENV *)cd; + + (void)db_appexit(env); + if (env->lk_conflicts) + free(env->lk_conflicts); + free(env); +} + +#define ENVWIDGET_USAGE "envN" +#define ENVWIDGET_SIMPLEDUP "envN simpledup" +int +envwidget_cmd(cd, interp, argc, argv) + ClientData cd; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + static int nenv_number = 0; + DB_ENV *env, *newenv; + char **p, nenvname[50]; + + argv = argv; + env = (DB_ENV *)cd; + + if (argc == 1) { + USAGE(argc, 1, ENVWIDGET_USAGE, 0); + + Tcl_ResetResult(interp); + if (env->db_home != NULL) + Tcl_AppendResult(interp, " Home: ", env->db_home, 0); + if ((p = env->db_data_dir) != NULL) + for (; *p != NULL; ++p) + Tcl_AppendResult(interp, " Data: ", *p, 0); + if (env->db_log_dir != NULL) + Tcl_AppendResult(interp, " Log: ", env->db_log_dir, 0); + if (env->db_tmp_dir != NULL) + Tcl_AppendResult(interp, " Tmp: ", env->db_tmp_dir, 0); + } else if (strcmp(argv[1], "simpledup") == 0) { + USAGE(argc, 2, ENVWIDGET_SIMPLEDUP, 0); + /* + * Copy the env and then NULL out the log, lock and + * transaction info pointers so that we only share an + * mpool. + */ + newenv = (DB_ENV *)malloc(sizeof(*newenv)); + *newenv = *env; + newenv->lg_info = NULL; + newenv->lk_info = NULL; + newenv->tx_info = NULL; + + /* Create new command name. */ + sprintf(&nenvname[0], "nenv%d", nenv_number); + nenv_number++; + + Tcl_CreateCommand(interp, nenvname, envwidget_cmd, + (ClientData)newenv, NULL); + Tcl_SetResult(interp, nenvname, TCL_VOLATILE); + } else { + Tcl_SetResult(interp, "Invalid command", TCL_STATIC); + return (TCL_ERROR); + } + + return (TCL_OK); +} + +#define ARGS_USAGE "args" +int +args_cmd(cd, interp, argc, argv) + ClientData cd; + Tcl_Interp *interp; + int argc; + char *argv[]; +{ + cd = cd; + argv = argv; + + USAGE(argc, 1, ARGS_USAGE, 0); + printf("Legal environment options are: %s\n", DB_ENV_FLAGS); + printf("Legal access method options are: %s\n", DB_INFO_FLAGS); + Tcl_ResetResult(interp); + return (TCL_OK); +} + +#define DEBUG_CHECK_USAGE "debug_check" +int +debugcheck_cmd(notused1, interp, argc, notused2) + ClientData notused1; + Tcl_Interp *interp; + int argc; + char *notused2[]; +{ + USAGE(argc, 1, DEBUG_CHECK_USAGE, 0); + notused1 = notused1; + notused2 = notused2; + debug_check(); + Tcl_ResetResult(interp); + return (TCL_OK); +} diff --git a/mozilla/db/test/wordlist b/mozilla/db/test/wordlist new file mode 100644 index 00000000000..f9b0af7263a --- /dev/null +++ b/mozilla/db/test/wordlist @@ -0,0 +1,10000 @@ +aback +abaft +abandon +abandoned +abandoning +abandonment +abandons +abase +abased +abasement +abasements +abases +abash +abashed +abashes +abashing +abasing +abate +abated +abatement +abatements +abater +abates +abating +abbe +abbey +abbey's +abbeys +abbot +abbot's +abbots +abbreviate +abbreviated +abbreviates +abbreviating +abbreviation +abbreviations +abdomen +abdomen's +abdomens +abdominal +abduct +abducted +abduction +abduction's +abductions +abductor +abductor's +abductors +abducts +abed +aberrant +aberration +aberrations +abet +abets +abetted +abetter +abetting +abeyance +abhor +abhorred +abhorrent +abhorrer +abhorring +abhors +abide +abided +abides +abiding +abilities +ability +ability's +abject +abjection +abjections +abjectly +abjectness +abjure +abjured +abjures +abjuring +ablate +ablated +ablates +ablating +ablation +ablative +ablaze +able +abler +ablest +ablute +ably +abnormal +abnormalities +abnormality +abnormally +aboard +abode +abode's +abodes +abolish +abolished +abolisher +abolishers +abolishes +abolishing +abolishment +abolishment's +abolishments +abolition +abolitionist +abolitionists +abominable +aboriginal +aborigine +aborigine's +aborigines +abort +aborted +aborting +abortion +abortion's +abortions +abortive +abortively +aborts +abound +abounded +abounding +abounds +about +above +aboveground +abrade +abraded +abrades +abrading +abrasion +abrasion's +abrasions +abreaction +abreactions +abreast +abridge +abridged +abridges +abridging +abridgment +abroad +abrogate +abrogated +abrogates +abrogating +abrupt +abruptly +abruptness +abscess +abscessed +abscesses +abscissa +abscissa's +abscissas +abscond +absconded +absconding +absconds +absence +absence's +absences +absent +absented +absentee +absentee's +absenteeism +absentees +absentia +absenting +absently +absentminded +absents +absinthe +absolute +absolutely +absoluteness +absolutes +absolution +absolve +absolved +absolves +absolving +absorb +absorbed +absorbency +absorbent +absorber +absorbing +absorbs +absorption +absorption's +absorptions +absorptive +abstain +abstained +abstainer +abstaining +abstains +abstention +abstentions +abstinence +abstract +abstracted +abstracting +abstraction +abstraction's +abstractionism +abstractionist +abstractions +abstractly +abstractness +abstractor +abstractor's +abstractors +abstracts +abstruse +abstruseness +absurd +absurdities +absurdity +absurdity's +absurdly +abundance +abundant +abundantly +abuse +abused +abuses +abusing +abusive +abut +abutment +abuts +abutted +abutter +abutter's +abutters +abutting +abysmal +abysmally +abyss +abyss's +abysses +acacia +academia +academic +academically +academics +academies +academy +academy's +accede +acceded +accedes +accelerate +accelerated +accelerates +accelerating +acceleration +accelerations +accelerator +accelerators +accelerometer +accelerometer's +accelerometers +accent +accented +accenting +accents +accentual +accentuate +accentuated +accentuates +accentuating +accentuation +accept +acceptability +acceptable +acceptably +acceptance +acceptance's +acceptances +accepted +accepter +accepters +accepting +acceptor +acceptor's +acceptors +accepts +access +accessed +accesses +accessibility +accessible +accessibly +accessing +accession +accession's +accessions +accessor +accessor's +accessories +accessors +accessory +accessory's +accident +accidental +accidentally +accidently +accidents +acclaim +acclaimed +acclaiming +acclaims +acclamation +acclimate +acclimated +acclimates +acclimating +acclimatization +acclimatized +accolade +accolades +accommodate +accommodated +accommodates +accommodating +accommodation +accommodations +accompanied +accompanies +accompaniment +accompaniment's +accompaniments +accompanist +accompanist's +accompanists +accompany +accompanying +accomplice +accomplices +accomplish +accomplished +accomplisher +accomplishers +accomplishes +accomplishing +accomplishment +accomplishment's +accomplishments +accord +accordance +accorded +accorder +accorders +according +accordingly +accordion +accordion's +accordions +accords +accost +accosted +accosting +accosts +account +accountability +accountable +accountably +accountancy +accountant +accountant's +accountants +accounted +accounting +accounts +accoutrement +accoutrements +accredit +accreditation +accreditations +accredited +accretion +accretion's +accretions +accrue +accrued +accrues +accruing +acculturate +acculturated +acculturates +acculturating +acculturation +accumulate +accumulated +accumulates +accumulating +accumulation +accumulations +accumulator +accumulator's +accumulators +accuracies +accuracy +accurate +accurately +accurateness +accursed +accusal +accusation +accusation's +accusations +accusative +accuse +accused +accuser +accuses +accusing +accusingly +accustom +accustomed +accustoming +accustoms +ace +ace's +aces +acetate +acetone +acetylene +ache +ached +aches +achievable +achieve +achieved +achievement +achievement's +achievements +achiever +achievers +achieves +achieving +achilles +aching +acid +acidic +acidities +acidity +acidly +acids +acidulous +acknowledge +acknowledged +acknowledger +acknowledgers +acknowledges +acknowledging +acknowledgment +acknowledgment's +acknowledgments +acme +acne +acolyte +acolytes +acorn +acorn's +acorns +acoustic +acoustical +acoustically +acoustician +acoustics +acquaint +acquaintance +acquaintance's +acquaintances +acquainted +acquainting +acquaints +acquiesce +acquiesced +acquiescence +acquiesces +acquiescing +acquirable +acquire +acquired +acquires +acquiring +acquisition +acquisition's +acquisitions +acquisitiveness +acquit +acquits +acquittal +acquitted +acquitter +acquitting +acre +acre's +acreage +acres +acrid +acrimonious +acrimony +acrobat +acrobat's +acrobatic +acrobatics +acrobats +acronym +acronym's +acronyms +acropolis +across +acrylic +act +acted +acting +actinium +actinometer +actinometers +action +action's +actions +activate +activated +activates +activating +activation +activations +activator +activator's +activators +active +actively +activism +activist +activist's +activists +activities +activity +activity's +actor +actor's +actors +actress +actress's +actresses +acts +actual +actualities +actuality +actualization +actually +actuals +actuarial +actuarially +actuate +actuated +actuates +actuating +actuator +actuator's +actuators +acuity +acumen +acute +acutely +acuteness +acyclic +acyclically +ad +adage +adages +adagio +adagios +adamant +adamantly +adapt +adaptability +adaptable +adaptation +adaptation's +adaptations +adapted +adapter +adapters +adapting +adaptive +adaptively +adaptor +adaptors +adapts +add +added +addenda +addendum +adder +adders +addict +addicted +addicting +addiction +addiction's +addictions +addicts +adding +addition +addition's +additional +additionally +additions +additive +additive's +additives +additivity +address +addressability +addressable +addressed +addressee +addressee's +addressees +addresser +addressers +addresses +addressing +adds +adduce +adduced +adduces +adducible +adducing +adduct +adducted +adducting +adduction +adductor +adducts +adept +adequacies +adequacy +adequate +adequately +adhere +adhered +adherence +adherent +adherent's +adherents +adherer +adherers +adheres +adhering +adhesion +adhesions +adhesive +adhesive's +adhesives +adiabatic +adiabatically +adieu +adjacency +adjacent +adjective +adjective's +adjectives +adjoin +adjoined +adjoining +adjoins +adjourn +adjourned +adjourning +adjournment +adjourns +adjudge +adjudged +adjudges +adjudging +adjudicate +adjudicated +adjudicates +adjudicating +adjudication +adjudication's +adjudications +adjunct +adjunct's +adjuncts +adjure +adjured +adjures +adjuring +adjust +adjustable +adjustably +adjusted +adjuster +adjusters +adjusting +adjustment +adjustment's +adjustments +adjustor +adjustor's +adjustors +adjusts +adjutant +adjutants +administer +administered +administering +administerings +administers +administration +administration's +administrations +administrative +administratively +administrator +administrator's +administrators +admirable +admirably +admiral +admiral's +admirals +admiralty +admiration +admirations +admire +admired +admirer +admirers +admires +admiring +admiringly +admissibility +admissible +admission +admission's +admissions +admit +admits +admittance +admitted +admittedly +admitter +admitters +admitting +admix +admixed +admixes +admixture +admonish +admonished +admonishes +admonishing +admonishment +admonishment's +admonishments +admonition +admonition's +admonitions +ado +adobe +adolescence +adolescent +adolescent's +adolescents +adopt +adopted +adopter +adopters +adopting +adoption +adoption's +adoptions +adoptive +adopts +adorable +adoration +adore +adored +adores +adorn +adorned +adornment +adornment's +adornments +adorns +adrenal +adrenaline +adrift +adroit +adroitness +ads +adsorb +adsorbed +adsorbing +adsorbs +adsorption +adulation +adult +adult's +adulterate +adulterated +adulterates +adulterating +adulterer +adulterer's +adulterers +adulterous +adulterously +adultery +adulthood +adults +adumbrate +adumbrated +adumbrates +adumbrating +advance +advanced +advancement +advancement's +advancements +advances +advancing +advantage +advantaged +advantageous +advantageously +advantages +advent +adventist +adventists +adventitious +adventure +adventured +adventurer +adventurers +adventures +adventuring +adventurous +adverb +adverb's +adverbial +adverbs +adversaries +adversary +adversary's +adverse +adversely +adversities +adversity +advertise +advertised +advertisement +advertisement's +advertisements +advertiser +advertisers +advertises +advertising +advice +advisability +advisable +advisably +advise +advised +advisedly +advisee +advisee's +advisees +advisement +advisements +adviser +advisers +advises +advising +advisor +advisor's +advisors +advisory +advocacy +advocate +advocated +advocates +advocating +aegis +aerate +aerated +aerates +aerating +aeration +aerator +aerators +aerial +aerial's +aerials +aeroacoustic +aerobic +aerobics +aerodynamic +aerodynamics +aeronautic +aeronautical +aeronautics +aerosol +aerosolize +aerosols +aerospace +aesthetic +aesthetic's +aesthetically +aesthetics +afar +affable +affair +affair's +affairs +affect +affectation +affectation's +affectations +affected +affecting +affectingly +affection +affection's +affectionate +affectionately +affections +affective +affector +affects +afferent +affianced +affidavit +affidavit's +affidavits +affiliate +affiliated +affiliates +affiliating +affiliation +affiliations +affinities +affinity +affinity's +affirm +affirmation +affirmation's +affirmations +affirmative +affirmatively +affirmed +affirming +affirms +affix +affixed +affixes +affixing +afflict +afflicted +afflicting +affliction +affliction's +afflictions +afflictive +afflicts +affluence +affluent +afford +affordable +afforded +affording +affords +affricate +affricates +affright +affront +affronted +affronting +affronts +afghan +afghanistan +afghans +aficionado +afield +afire +aflame +afloat +afoot +afore +aforementioned +aforesaid +aforethought +afoul +afraid +afresh +africa +african +africans +aft +after +aftereffect +aftermath +aftermost +afternoon +afternoon's +afternoons +aftershock +aftershocks +afterthought +afterthoughts +afterward +afterwards +again +against +agape +agar +agate +agates +age +aged +ageless +agencies +agency +agency's +agenda +agenda's +agendas +agent +agent's +agents +ager +agers +ages +agglomerate +agglomerated +agglomerates +agglomeration +agglutinate +agglutinated +agglutinates +agglutinating +agglutination +agglutinin +agglutinins +aggravate +aggravated +aggravates +aggravation +aggregate +aggregated +aggregately +aggregates +aggregating +aggregation +aggregations +aggression +aggression's +aggressions +aggressive +aggressively +aggressiveness +aggressor +aggressors +aggrieve +aggrieved +aggrieves +aggrieving +aghast +agile +agilely +agility +aging +agitate +agitated +agitates +agitating +agitation +agitations +agitator +agitator's +agitators +agleam +aglow +agnostic +agnostic's +agnostics +ago +agog +agonies +agonize +agonized +agonizes +agonizing +agony +agrarian +agree +agreeable +agreeableness +agreeably +agreed +agreeing +agreement +agreement's +agreements +agreer +agreers +agrees +agricultural +agriculturally +agriculture +ague +ah +ahead +aid +aide +aided +aides +aiding +aids +ail +aileron +ailerons +ailing +ailment +ailment's +ailments +aim +aimed +aimer +aimers +aiming +aimless +aimlessly +aims +air +airbag +airbags +airborne +aircraft +airdrop +airdrops +aired +airedale +airer +airers +airfield +airfield's +airfields +airflow +airfoil +airfoils +airframe +airframes +airily +airing +airings +airless +airlift +airlift's +airlifts +airline +airliner +airlines +airlock +airlock's +airlocks +airmail +airmails +airman +airmen +airplane +airplane's +airplanes +airport +airport's +airports +airs +airship +airship's +airships +airspace +airspeed +airstrip +airstrip's +airstrips +airway +airway's +airways +airy +aisle +ajar +akimbo +akin +alabama +alabamian +alabaster +alacrity +alarm +alarmed +alarming +alarmingly +alarmist +alarms +alas +alaska +alba +albacore +albania +albanian +albanians +albeit +album +albumin +albums +alchemy +alcibiades +alcohol +alcohol's +alcoholic +alcoholic's +alcoholics +alcoholism +alcohols +alcove +alcove's +alcoves +alden +alder +alderman +alderman's +aldermen +ale +alee +alert +alerted +alertedly +alerter +alerters +alerting +alertly +alertness +alerts +alfalfa +alfresco +alga +algae +algaecide +algebra +algebra's +algebraic +algebraically +algebras +algeria +algerian +alginate +algol +algorithm +algorithm's +algorithmic +algorithmically +algorithms +alias +aliased +aliases +aliasing +alibi +alibi's +alibis +alien +alien's +alienate +alienated +alienates +alienating +alienation +aliens +alight +align +aligned +aligning +alignment +alignments +aligns +alike +aliment +aliments +alimony +alive +alkali +alkali's +alkaline +alkalis +alkaloid +alkaloid's +alkaloids +alkyl +all +allah +allah's +allay +allayed +allaying +allays +allegation +allegation's +allegations +allege +alleged +allegedly +alleges +allegiance +allegiance's +allegiances +alleging +allegoric +allegorical +allegorically +allegories +allegory +allegory's +allegretto +allegretto's +allegrettos +allegro +allegro's +allegros +allele +alleles +allemande +allergic +allergies +allergy +allergy's +alleviate +alleviated +alleviater +alleviaters +alleviates +alleviating +alleviation +alley +alley's +alleys +alleyway +alleyway's +alleyways +alliance +alliance's +alliances +allied +allies +alligator +alligator's +alligators +alliteration +alliteration's +alliterations +alliterative +allocate +allocated +allocates +allocating +allocation +allocations +allocator +allocator's +allocators +allophone +allophones +allophonic +allot +allotment +allotment's +allotments +allots +allotted +allotter +allotting +allow +allowable +allowably +allowance +allowance's +allowances +allowed +allowing +allows +alloy +alloy's +alloys +allude +alluded +alludes +alluding +allure +allurement +alluring +allusion +allusion's +allusions +allusive +allusiveness +ally +allying +alma +almanac +almanac's +almanacs +almighty +almond +almond's +almonds +almoner +almost +alms +almsman +alnico +aloe +aloes +aloft +aloha +alone +aloneness +along +alongside +aloof +aloofness +aloud +alpha +alphabet +alphabet's +alphabetic +alphabetical +alphabetically +alphabetics +alphabetize +alphabetized +alphabetizes +alphabetizing +alphabets +alphanumeric +alpine +alps +already +also +altar +altar's +altars +alter +alterable +alteration +alteration's +alterations +altercation +altercation's +altercations +altered +alterer +alterers +altering +alternate +alternated +alternately +alternates +alternating +alternation +alternations +alternative +alternatively +alternatives +alternator +alternator's +alternators +alters +although +altitude +alto +alto's +altogether +altos +altruism +altruist +altruistic +altruistically +alum +aluminum +alumna +alumna's +alumnae +alumni +alumnus +alundum +alveolar +alveoli +alveolus +always +am +amain +amalgam +amalgam's +amalgamate +amalgamated +amalgamates +amalgamating +amalgamation +amalgams +amanuensis +amass +amassed +amasses +amassing +amateur +amateur's +amateurish +amateurishness +amateurism +amateurs +amatory +amaze +amazed +amazedly +amazement +amazer +amazers +amazes +amazing +amazingly +amazon +amazon's +amazons +ambassador +ambassador's +ambassadors +amber +ambiance +ambidextrous +ambidextrously +ambient +ambiguities +ambiguity +ambiguity's +ambiguous +ambiguously +ambition +ambition's +ambitions +ambitious +ambitiously +ambivalence +ambivalent +ambivalently +amble +ambled +ambler +ambles +ambling +ambrosial +ambulance +ambulance's +ambulances +ambulatory +ambuscade +ambush +ambushed +ambushes +amelia +ameliorate +ameliorated +ameliorating +amen +amenable +amend +amended +amending +amendment +amendment's +amendments +amends +amenities +amenity +amenorrhea +america +america's +american +american's +americana +americans +americas +americium +amiable +amicable +amicably +amid +amide +amidst +amigo +amino +amiss +amity +ammo +ammonia +ammoniac +ammonium +ammunition +amnesty +amoeba +amoeba's +amoebas +amok +among +amongst +amoral +amorality +amorist +amorous +amorphous +amorphously +amortize +amortized +amortizes +amortizing +amount +amounted +amounter +amounters +amounting +amounts +amour +amp +ampere +amperes +ampersand +ampersand's +ampersands +amphetamine +amphetamines +amphibian +amphibian's +amphibians +amphibious +amphibiously +amphibology +amphitheater +amphitheater's +amphitheaters +ample +amplification +amplified +amplifier +amplifiers +amplifies +amplify +amplifying +amplitude +amplitude's +amplitudes +amply +ampoule +ampoule's +ampoules +amps +amputate +amputated +amputates +amputating +amsterdam +amtrak +amulet +amulets +amuse +amused +amusedly +amusement +amusement's +amusements +amuser +amusers +amuses +amusing +amusingly +amyl +an +anabaptist +anabaptist's +anabaptists +anachronism +anachronism's +anachronisms +anachronistically +anaconda +anacondas +anaerobic +anaesthesia +anagram +anagram's +anagrams +anal +analog +analogical +analogies +analogous +analogously +analogue +analogue's +analogues +analogy +analogy's +analyses +analysis +analyst +analyst's +analysts +analytic +analytical +analytically +analyticities +analyticity +analyzable +analyze +analyzed +analyzer +analyzers +analyzes +analyzing +anaphora +anaphoric +anaphorically +anaplasmosis +anarchic +anarchical +anarchist +anarchist's +anarchists +anarchy +anastomoses +anastomosis +anastomotic +anathema +anatomic +anatomical +anatomically +anatomy +ancestor +ancestor's +ancestors +ancestral +ancestry +anchor +anchorage +anchorage's +anchorages +anchored +anchoring +anchorite +anchoritism +anchors +anchovies +anchovy +ancient +anciently +ancients +ancillary +and +anders +anding +andorra +anecdotal +anecdote +anecdote's +anecdotes +anechoic +anemia +anemic +anemometer +anemometer's +anemometers +anemometry +anemone +anesthesia +anesthetic +anesthetic's +anesthetically +anesthetics +anesthetize +anesthetized +anesthetizes +anesthetizing +anew +angel +angel's +angelic +angels +anger +angered +angering +angers +angiography +angle +angled +angler +anglers +angles +anglican +anglicanism +anglicans +angling +anglophilia +anglophobia +angola +angrier +angriest +angrily +angry +angst +angstrom +anguish +anguished +angular +angularly +anhydrous +anhydrously +aniline +animal +animal's +animals +animate +animated +animatedly +animately +animateness +animates +animating +animation +animations +animator +animator's +animators +animism +animized +animosity +anion +anion's +anionic +anions +anise +aniseikonic +anisotropic +anisotropy +ankle +ankle's +ankles +annal +annals +annex +annexation +annexed +annexes +annexing +annihilate +annihilated +annihilates +annihilating +annihilation +anniversaries +anniversary +anniversary's +annotate +annotated +annotates +annotating +annotation +annotations +announce +announced +announcement +announcement's +announcements +announcer +announcers +announces +announcing +annoy +annoyance +annoyance's +annoyances +annoyed +annoyer +annoyers +annoying +annoyingly +annoys +annual +annually +annuals +annul +annulled +annulling +annulment +annulment's +annulments +annuls +annum +annunciate +annunciated +annunciates +annunciating +annunciator +annunciators +anode +anode's +anodes +anodize +anodized +anodizes +anoint +anointed +anointing +anoints +anomalies +anomalous +anomalously +anomaly +anomaly's +anomic +anomie +anon +anonymity +anonymous +anonymously +anorexia +another +another's +answer +answerable +answered +answerer +answerers +answering +answers +ant +ant's +antagonism +antagonisms +antagonist +antagonist's +antagonistic +antagonistically +antagonists +antagonize +antagonized +antagonizes +antagonizing +antarctic +antarctica +ante +anteater +anteater's +anteaters +antecedent +antecedent's +antecedents +antedate +antelope +antelope's +antelopes +antenna +antenna's +antennae +antennas +anterior +anthem +anthem's +anthems +anther +anthologies +anthology +anthracite +anthropological +anthropologically +anthropologist +anthropologist's +anthropologists +anthropology +anthropomorphic +anthropomorphically +anti +antibacterial +antibiotic +antibiotics +antibodies +antibody +antic +antic's +anticipate +anticipated +anticipates +anticipating +anticipation +anticipations +anticipatory +anticoagulation +anticompetitive +antics +antidisestablishmentarianism +antidote +antidote's +antidotes +antiformant +antifundamentalist +antigen +antigen's +antigens +antihistorical +antimicrobial +antimony +antinomian +antinomy +antipathy +antiphonal +antipode +antipode's +antipodes +antiquarian +antiquarian's +antiquarians +antiquate +antiquated +antique +antique's +antiques +antiquities +antiquity +antiredeposition +antiresonance +antiresonator +antiseptic +antisera +antiserum +antislavery +antisocial +antisubmarine +antisymmetric +antisymmetry +antithesis +antithetical +antithyroid +antitoxin +antitoxin's +antitoxins +antitrust +antler +antlered +ants +anus +anvil +anvil's +anvils +anxieties +anxiety +anxious +anxiously +any +anybody +anyhow +anymore +anyone +anyplace +anything +anytime +anyway +anywhere +aorta +apace +apart +apartheid +apartment +apartment's +apartments +apathetic +apathy +ape +aped +aperiodic +aperiodicity +aperture +apes +apex +aphasia +aphasic +aphid +aphid's +aphids +aphonic +aphorism +aphorism's +aphorisms +aphrodite +apiaries +apiary +apical +apiece +aping +apish +aplenty +aplomb +apocalypse +apocalyptic +apocrypha +apocryphal +apogee +apogees +apollo +apollonian +apologetic +apologetically +apologia +apologies +apologist +apologist's +apologists +apologize +apologized +apologizes +apologizing +apology +apology's +apostate +apostle +apostle's +apostles +apostolic +apostrophe +apostrophes +apothecary +apotheoses +apotheosis +appalachia +appalachian +appalachians +appall +appalled +appalling +appallingly +appanage +apparatus +apparel +appareled +apparent +apparently +apparition +apparition's +apparitions +appeal +appealed +appealer +appealers +appealing +appealingly +appeals +appear +appearance +appearances +appeared +appearer +appearers +appearing +appears +appease +appeased +appeasement +appeases +appeasing +appellant +appellant's +appellants +appellate +append +appendage +appendage's +appendages +appended +appender +appenders +appendices +appendicitis +appending +appendix +appendix's +appendixes +appends +appertain +appertains +appetite +appetite's +appetites +appetizer +appetizing +applaud +applauded +applauding +applauds +applause +apple +apple's +applejack +apples +appliance +appliance's +appliances +applicability +applicable +applicant +applicant's +applicants +application +application's +applications +applicative +applicatively +applicator +applicator's +applicators +applied +applier +appliers +applies +applique +apply +applying +appoint +appointed +appointee +appointee's +appointees +appointer +appointers +appointing +appointive +appointment +appointment's +appointments +appoints +apportion +apportioned +apportioning +apportionment +apportionments +apportions +appraisal +appraisal's +appraisals +appraise +appraised +appraiser +appraisers +appraises +appraising +appraisingly +appreciable +appreciably +appreciate +appreciated +appreciates +appreciating +appreciation +appreciations +appreciative +appreciatively +apprehend +apprehended +apprehensible +apprehension +apprehension's +apprehensions +apprehensive +apprehensively +apprehensiveness +apprentice +apprenticed +apprentices +apprenticeship +apprise +apprised +apprises +apprising +approach +approachability +approachable +approached +approacher +approachers +approaches +approaching +approbate +approbation +appropriate +appropriated +appropriately +appropriateness +appropriates +appropriating +appropriation +appropriations +appropriator +appropriator's +appropriators +approval +approval's +approvals +approve +approved +approver +approvers +approves +approving +approvingly +approximate +approximated +approximately +approximates +approximating +approximation +approximations +appurtenance +appurtenances +apricot +apricot's +apricots +april +apron +apron's +aprons +apropos +apse +apsis +apt +aptitude +aptitudes +aptly +aptness +aqua +aquaria +aquarium +aquarius +aquatic +aqueduct +aqueduct's +aqueducts +aqueous +aquifer +aquifers +arab +arab's +arabesque +arabia +arabian +arabians +arabic +arable +arabs +arachnid +arachnid's +arachnids +arbiter +arbiter's +arbiters +arbitrarily +arbitrariness +arbitrary +arbitrate +arbitrated +arbitrates +arbitrating +arbitration +arbitrator +arbitrator's +arbitrators +arbor +arbor's +arboreal +arbors +arc +arcade +arcade's +arcaded +arcades +arcane +arced +arch +archaeological +archaeologist +archaeologist's +archaeologists +archaeology +archaic +archaically +archaicness +archaism +archaize +archangel +archangel's +archangels +archbishop +archdiocese +archdioceses +arched +archenemy +archeological +archeologist +archeology +archer +archers +archery +arches +archetype +archfool +arching +archipelago +archipelagoes +architect +architect's +architectonic +architects +architectural +architecturally +architecture +architecture's +architectures +archival +archive +archived +archiver +archivers +archives +archiving +archivist +archly +arcing +arclike +arcs +arctic +ardent +ardently +ardor +arduous +arduously +arduousness +are +area +area's +areas +aren't +arena +arena's +arenas +argentina +argo +argon +argonaut +argonauts +argos +argot +arguable +arguably +argue +argued +arguer +arguers +argues +arguing +argument +argument's +argumentation +argumentative +arguments +arianism +arianist +arianists +arid +aridity +aries +aright +arise +arisen +ariser +arises +arising +arisings +aristocracy +aristocrat +aristocrat's +aristocratic +aristocratically +aristocrats +aristotelian +aristotle +arithmetic +arithmetical +arithmetically +arithmetics +arithmetize +arithmetized +arithmetizes +arizona +ark +arkansas +arm +armadillo +armadillos +armageddon +armament +armament's +armaments +armchair +armchair's +armchairs +armed +armenian +armer +armers +armful +armhole +armies +arming +armistice +armload +armor +armored +armorer +armory +armour +armpit +armpit's +armpits +arms +armstrong +army +army's +aroma +aromas +aromatic +arose +around +arousal +arouse +aroused +arouses +arousing +arpeggio +arpeggio's +arpeggios +arrack +arraign +arraigned +arraigning +arraignment +arraignment's +arraignments +arraigns +arrange +arranged +arrangement +arrangement's +arrangements +arranger +arrangers +arranges +arranging +arrant +array +arrayed +arrays +arrears +arrest +arrested +arrester +arresters +arresting +arrestingly +arrestor +arrestor's +arrestors +arrests +arrival +arrival's +arrivals +arrive +arrived +arrives +arriving +arrogance +arrogant +arrogantly +arrogate +arrogated +arrogates +arrogating +arrogation +arrow +arrowed +arrowhead +arrowhead's +arrowheads +arrows +arroyo +arroyos +arsenal +arsenal's +arsenals +arsenic +arsine +arson +art +art's +artemis +arterial +arteries +arteriolar +arteriole +arteriole's +arterioles +arteriosclerosis +artery +artery's +artful +artfully +artfulness +arthogram +arthritis +arthropod +arthropod's +arthropods +artichoke +artichoke's +artichokes +article +article's +articles +articulate +articulated +articulately +articulateness +articulates +articulating +articulation +articulations +articulator +articulators +articulatory +artifact +artifact's +artifacts +artifactually +artifice +artificer +artifices +artificial +artificialities +artificiality +artificially +artificialness +artillerist +artillery +artisan +artisan's +artisans +artist +artist's +artistic +artistically +artistry +artists +artless +arts +artwork +aryan +as +asbestos +ascend +ascendancy +ascendant +ascended +ascendency +ascendent +ascender +ascenders +ascending +ascends +ascension +ascensions +ascent +ascertain +ascertainable +ascertained +ascertaining +ascertains +ascetic +ascetic's +asceticism +ascetics +ascii +ascot +ascribable +ascribe +ascribed +ascribes +ascribing +ascription +aseptic +ash +ashamed +ashamedly +ashen +asher +ashes +ashman +ashore +ashtray +ashtray's +ashtrays +asia +asian +asians +asiatic +aside +asinine +ask +askance +asked +asker +askers +askew +asking +asks +asleep +asocial +asp +asparagus +aspect +aspect's +aspects +aspen +aspersion +aspersion's +aspersions +asphalt +asphyxia +aspic +aspirant +aspirant's +aspirants +aspirate +aspirated +aspirates +aspirating +aspiration +aspiration's +aspirations +aspirator +aspirators +aspire +aspired +aspires +aspirin +aspiring +aspirins +ass +ass's +assail +assailant +assailant's +assailants +assailed +assailing +assails +assassin +assassin's +assassinate +assassinated +assassinates +assassinating +assassination +assassinations +assassins +assault +assaulted +assaulting +assaults +assay +assayed +assaying +assemblage +assemblage's +assemblages +assemble +assembled +assembler +assemblers +assembles +assemblies +assembling +assembly +assembly's +assent +assented +assenter +assenting +assents +assert +asserted +asserter +asserters +asserting +assertion +assertion's +assertions +assertive +assertively +assertiveness +asserts +asses +assess +assessed +assesses +assessing +assessment +assessment's +assessments +assessor +assessors +asset +asset's +assets +assiduity +assiduous +assiduously +assign +assignable +assigned +assignee +assignee's +assignees +assigner +assigners +assigning +assignment +assignment's +assignments +assigns +assimilate +assimilated +assimilates +assimilating +assimilation +assimilations +assist +assistance +assistances +assistant +assistant's +assistants +assistantship +assistantships +assisted +assisting +assists +associate +associated +associates +associating +association +associational +associations +associative +associatively +associativity +associator +associator's +associators +assonance +assonant +assort +assorted +assortment +assortment's +assortments +assorts +assuage +assuaged +assuages +assume +assumed +assumes +assuming +assumption +assumption's +assumptions +assurance +assurance's +assurances +assure +assured +assuredly +assurer +assurers +assures +assuring +assuringly +assyrian +assyriology +astatine +aster +aster's +asterisk +asterisk's +asterisks +asteroid +asteroid's +asteroidal +asteroids +asters +asthma +astonish +astonished +astonishes +astonishing +astonishingly +astonishment +astound +astounded +astounding +astounds +astral +astray +astride +astringency +astringent +astronaut +astronaut's +astronautics +astronauts +astronomer +astronomer's +astronomers +astronomical +astronomically +astronomy +astrophysical +astrophysics +astute +astuteness +asunder +asylum +asymmetric +asymmetrically +asymmetry +asymptomatically +asymptote +asymptote's +asymptotes +asymptotic +asymptotically +asynchronism +asynchronous +asynchronously +asynchrony +at +atavistic +ate +atemporal +atheist +atheist's +atheistic +atheists +athena +athenian +athenians +athens +atherosclerosis +athlete +athlete's +athletes +athletic +athleticism +athletics +atlantic +atlas +atmosphere +atmosphere's +atmospheres +atmospheric +atoll +atoll's +atolls +atom +atom's +atomic +atomically +atomics +atomization +atomize +atomized +atomizes +atomizing +atoms +atonal +atonally +atone +atoned +atonement +atones +atop +atrocious +atrociously +atrocities +atrocity +atrocity's +atrophic +atrophied +atrophies +atrophy +atrophying +attach +attache +attached +attacher +attachers +attaches +attaching +attachment +attachment's +attachments +attack +attackable +attacked +attacker +attackers +attacking +attacks +attain +attainable +attainably +attained +attainer +attainers +attaining +attainment +attainment's +attainments +attains +attempt +attempted +attempter +attempters +attempting +attempts +attend +attendance +attendance's +attendances +attendant +attendant's +attendants +attended +attendee +attendee's +attendees +attender +attenders +attending +attends +attention +attention's +attentional +attentionality +attentions +attentive +attentively +attentiveness +attenuate +attenuated +attenuates +attenuating +attenuation +attenuator +attenuator's +attenuators +attest +attested +attesting +attests +attic +attic's +attics +attire +attired +attires +attiring +attitude +attitude's +attitudes +attitudinal +attorney +attorney's +attorneys +attract +attracted +attracting +attraction +attraction's +attractions +attractive +attractively +attractiveness +attractor +attractor's +attractors +attracts +attributable +attribute +attributed +attributes +attributing +attribution +attributions +attributive +attributively +attrition +attune +attuned +attunes +attuning +atypical +atypically +auburn +auckland +auction +auctioneer +auctioneer's +auctioneers +audacious +audaciously +audaciousness +audacity +audible +audibly +audience +audience's +audiences +audio +audiogram +audiogram's +audiograms +audiological +audiologist +audiologist's +audiologists +audiology +audiometer +audiometers +audiometric +audiometry +audit +audited +auditing +audition +audition's +auditioned +auditioning +auditions +auditor +auditor's +auditorium +auditors +auditory +audits +audubon +auger +auger's +augers +aught +augment +augmentation +augmented +augmenting +augments +augur +augurs +august +augusta +augustly +augustness +aunt +aunt's +aunts +aura +aura's +aural +aurally +auras +aureole +aureomycin +aurora +auscultate +auscultated +auscultates +auscultating +auscultation +auscultations +auspice +auspices +auspicious +auspiciously +austere +austerely +austerity +austin +australia +australian +austria +austrian +authentic +authentically +authenticate +authenticated +authenticates +authenticating +authentication +authentications +authenticator +authenticators +authenticity +author +authored +authoring +authoritarian +authoritarianism +authoritative +authoritatively +authorities +authority +authority's +authorization +authorization's +authorizations +authorize +authorized +authorizer +authorizers +authorizes +authorizing +authors +authorship +autism +autistic +auto +auto's +autobiographic +autobiographical +autobiographies +autobiography +autobiography's +autocollimator +autocorrelate +autocorrelation +autocracies +autocracy +autocrat +autocrat's +autocratic +autocratically +autocrats +autofluorescence +autograph +autographed +autographing +autographs +automata +automate +automated +automates +automatic +automatically +automating +automation +automaton +automobile +automobile's +automobiles +automotive +autonavigator +autonavigator's +autonavigators +autonomic +autonomous +autonomously +autonomy +autopilot +autopilot's +autopilots +autopsied +autopsies +autopsy +autoregressive +autos +autosuggestibility +autotransformer +autumn +autumn's +autumnal +autumns +auxiliaries +auxiliary +avail +availabilities +availability +available +availably +availed +availer +availers +availing +avails +avalanche +avalanched +avalanches +avalanching +avant +avarice +avaricious +avariciously +ave +avenge +avenged +avenger +avenges +avenging +avenue +avenue's +avenues +aver +average +averaged +averages +averaging +averred +averrer +averring +avers +averse +aversion +aversion's +aversions +avert +averted +averting +averts +avian +aviaries +aviary +aviation +aviator +aviator's +aviators +avid +avidity +avidly +avionic +avionics +avocado +avocados +avocation +avocation's +avocations +avoid +avoidable +avoidably +avoidance +avoided +avoider +avoiders +avoiding +avoids +avouch +avow +avowed +avows +await +awaited +awaiting +awaits +awake +awaken +awakened +awakening +awakens +awakes +awaking +award +awarded +awarder +awarders +awarding +awards +aware +awareness +awash +away +awe +awed +awesome +awful +awfully +awfulness +awhile +awkward +awkwardly +awkwardness +awl +awl's +awls +awning +awning's +awnings +awoke +awry +ax +axe +axed +axer +axers +axes +axial +axially +axing +axiological +axiom +axiom's +axiomatic +axiomatically +axiomatization +axiomatization's +axiomatizations +axiomatize +axiomatized +axiomatizes +axiomatizing +axioms +axis +axle +axle's +axles +axolotl +axolotl's +axolotls +axon +axon's +axons +aye +ayes +azalea +azalea's +azaleas +azimuth +azimuth's +azimuths +azure +babble +babbled +babbles +babbling +babe +babe's +babel +babel's +babes +babied +babies +baby +babyhood +babying +babyish +baccalaureate +bach +bach's +bachelor +bachelor's +bachelors +bacilli +bacillus +back +backache +backache's +backaches +backarrow +backarrows +backbend +backbend's +backbends +backbone +backbone's +backbones +backdrop +backdrop's +backdrops +backed +backer +backers +background +background's +backgrounds +backing +backlash +backlog +backlog's +backlogs +backpack +backpack's +backpacks +backplane +backplane's +backplanes +backpointer +backpointer's +backpointers +backs +backscatter +backscattered +backscattering +backscatters +backslash +backslashes +backspace +backspaced +backspaces +backstage +backstairs +backstitch +backstitched +backstitches +backstitching +backtrack +backtracked +backtracker +backtrackers +backtracking +backtracks +backup +backups +backward +backwardness +backwards +backwater +backwater's +backwaters +backwoods +backyard +backyard's +backyards +bacon +bacteria +bacterial +bacterium +bad +bade +badge +badger +badger's +badgered +badgering +badgers +badges +badlands +badly +badminton +badness +baffle +baffled +baffler +bafflers +baffling +bag +bag's +bagatelle +bagatelle's +bagatelles +bagel +bagel's +bagels +baggage +bagged +bagger +bagger's +baggers +bagging +baggy +bagpipe +bagpipe's +bagpipes +bags +bah +bail +bailiff +bailiff's +bailiffs +bailing +bait +baited +baiter +baiting +baits +bake +baked +baker +bakeries +bakers +bakery +bakery's +bakes +baking +baklava +balalaika +balalaika's +balalaikas +balance +balanced +balancer +balancers +balances +balancing +balconies +balcony +balcony's +bald +balding +baldly +baldness +bale +baleful +baler +bales +balk +balkan +balkanize +balkanized +balkanizing +balkans +balked +balkiness +balking +balks +balky +ball +ballad +ballad's +ballads +ballast +ballast's +ballasts +balled +baller +ballerina +ballerina's +ballerinas +ballers +ballet +ballet's +ballets +ballgown +ballgown's +ballgowns +balling +ballistic +ballistics +balloon +ballooned +ballooner +ballooners +ballooning +balloons +ballot +ballot's +ballots +ballpark +ballpark's +ballparks +ballplayer +ballplayer's +ballplayers +ballroom +ballroom's +ballrooms +balls +ballyhoo +balm +balm's +balms +balmy +balsa +balsam +baltic +balustrade +balustrade's +balustrades +bamboo +ban +ban's +banal +banally +banana +banana's +bananas +band +bandage +bandaged +bandages +bandaging +banded +bandied +bandies +banding +bandit +bandit's +bandits +bandlimit +bandlimited +bandlimiting +bandlimits +bandpass +bands +bandstand +bandstand's +bandstands +bandwagon +bandwagon's +bandwagons +bandwidth +bandwidths +bandy +bandying +bane +baneful +bang +banged +banging +bangladesh +bangle +bangle's +bangles +bangs +banish +banished +banishes +banishing +banishment +banister +banister's +banisters +banjo +banjo's +banjos +bank +banked +banker +bankers +banking +bankrupt +bankruptcies +bankruptcy +bankruptcy's +bankrupted +bankrupting +bankrupts +banks +banned +banner +banner's +banners +banning +banquet +banqueting +banquetings +banquets +bans +banshee +banshee's +banshees +bantam +banter +bantered +bantering +banters +bantu +bantus +baptism +baptism's +baptismal +baptisms +baptist +baptist's +baptistery +baptistries +baptistry +baptistry's +baptists +baptize +baptized +baptizes +baptizing +bar +bar's +barb +barbados +barbarian +barbarian's +barbarians +barbaric +barbarities +barbarity +barbarous +barbarously +barbecue +barbecued +barbecueing +barbecues +barbed +barbell +barbell's +barbells +barber +barbital +barbiturate +barbiturates +barbs +bard +bard's +bards +bare +bared +barefoot +barefooted +barely +bareness +barer +bares +barest +barflies +barfly +barfly's +bargain +bargained +bargaining +bargains +barge +barges +barging +baring +baritone +baritone's +baritones +barium +bark +barked +barker +barkers +barking +barks +barley +barn +barn's +barns +barnstorm +barnstormed +barnstorming +barnstorms +barnyard +barnyard's +barnyards +barometer +barometer's +barometers +barometric +baron +baron's +baroness +baronial +baronies +barons +barony +barony's +baroque +baroqueness +barrack +barracks +barrage +barrage's +barrages +barred +barrel +barrel's +barrelled +barrelling +barrels +barren +barrenness +barricade +barricade's +barricades +barrier +barrier's +barriers +barring +barringer +barrow +bars +bartender +bartender's +bartenders +barter +bartered +bartering +barters +bas +basal +basalt +base +baseball +baseball's +baseballs +baseboard +baseboard's +baseboards +based +baseless +baseline +baseline's +baselines +basely +baseman +basement +basement's +basements +baseness +baser +bases +bash +bashed +bashes +bashful +bashfulness +bashing +basic +basically +basics +basil +basin +basin's +basing +basins +basis +bask +basked +basket +basket's +basketball +basketball's +basketballs +baskets +basking +bass +bass's +basses +basset +bassinet +bassinet's +bassinets +basso +bastard +bastard's +bastards +baste +basted +bastes +basting +bastion +bastion's +bastions +bat +bat's +batch +batched +batches +bath +bathe +bathed +bather +bathers +bathes +bathing +bathos +bathrobe +bathrobe's +bathrobes +bathroom +bathroom's +bathrooms +baths +bathtub +bathtub's +bathtubs +baton +baton's +batons +bats +battalion +battalion's +battalions +batted +batten +battens +batter +battered +batteries +battering +batters +battery +battery's +batting +battle +battled +battlefield +battlefield's +battlefields +battlefront +battlefront's +battlefronts +battleground +battleground's +battlegrounds +battlement +battlement's +battlements +battler +battlers +battles +battleship +battleship's +battleships +battling +bauble +bauble's +baubles +baud +bauxite +bawdy +bawl +bawled +bawling +bawls +bay +bayed +baying +bayonet +bayonet's +bayonets +bayou +bayou's +bayous +bays +bazaar +bazaar's +bazaars +be +beach +beached +beaches +beachhead +beachhead's +beachheads +beaching +beacon +beacon's +beacons +bead +beaded +beading +beadle +beadle's +beadles +beads +beady +beagle +beagle's +beagles +beak +beaked +beaker +beakers +beaks +beam +beamed +beamer +beamers +beaming +beams +bean +beaned +beaner +beaners +beaning +beans +bear +bearable +bearably +beard +bearded +beardless +beards +bearer +bearers +bearing +bearings +bearish +bears +beast +beastly +beasts +beat +beatable +beatably +beaten +beater +beaters +beatific +beatification +beatify +beating +beatings +beatitude +beatitude's +beatitudes +beatnik +beatnik's +beatniks +beats +beau +beau's +beaus +beauteous +beauteously +beauties +beautifications +beautified +beautifier +beautifiers +beautifies +beautiful +beautifully +beautify +beautifying +beauty +beauty's +beaver +beaver's +beavers +becalm +becalmed +becalming +becalms +became +because +beck +beckon +beckoned +beckoning +beckons +become +becomes +becoming +becomingly +bed +bed's +bedazzle +bedazzled +bedazzlement +bedazzles +bedazzling +bedbug +bedbug's +bedbugs +bedded +bedder +bedder's +bedders +bedding +bedevil +bedeviled +bedeviling +bedevils +bedfast +bedlam +bedpost +bedpost's +bedposts +bedraggle +bedraggled +bedridden +bedrock +bedrock's +bedroom +bedroom's +bedrooms +beds +bedside +bedspread +bedspread's +bedspreads +bedspring +bedspring's +bedsprings +bedstead +bedstead's +bedsteads +bedtime +bee +beech +beechen +beecher +beef +beefed +beefer +beefers +beefing +beefs +beefsteak +beefy +beehive +beehive's +beehives +been +beep +beeps +beer +beers +bees +beet +beet's +beethoven +beetle +beetle's +beetled +beetles +beetling +beets +befall +befallen +befalling +befalls +befell +befit +befit's +befits +befitted +befitting +befog +befogged +befogging +before +beforehand +befoul +befouled +befouling +befouls +befriend +befriended +befriending +befriends +befuddle +befuddled +befuddles +befuddling +beg +began +beget +begets +begetting +beggar +beggarly +beggars +beggary +begged +begging +begin +beginner +beginner's +beginners +beginning +beginning's +beginnings +begins +begot +begotten +begrudge +begrudged +begrudges +begrudging +begrudgingly +begs +beguile +beguiled +beguiles +beguiling +begun +behalf +behave +behaved +behaves +behaving +behavior +behavioral +behaviorally +behaviorism +behavioristic +behaviors +behead +beheading +beheld +behest +behind +behold +beholden +beholder +beholders +beholding +beholds +behoove +behooves +beige +being +beings +belabor +belabored +belaboring +belabors +belated +belatedly +belay +belayed +belaying +belays +belch +belched +belches +belching +belfries +belfry +belfry's +belgian +belgian's +belgians +belgium +belie +belied +belief +belief's +beliefs +belies +believable +believably +believe +believed +believer +believers +believes +believing +belittle +belittled +belittles +belittling +bell +bell's +bellboy +bellboy's +bellboys +belle +belle's +belles +bellhop +bellhop's +bellhops +bellicose +bellicosity +bellies +belligerence +belligerent +belligerent's +belligerently +belligerents +bellman +bellmen +bellow +bellowed +bellowing +bellows +bells +bellwether +bellwether's +bellwethers +belly +belly's +bellyfull +belong +belonged +belonging +belongings +belongs +beloved +below +belt +belted +belting +belts +bely +belying +bemoan +bemoaned +bemoaning +bemoans +bench +benched +benches +benchmark +benchmark's +benchmarks +bend +bendable +bender +benders +bending +bends +beneath +benedict +benedictine +benediction +benediction's +benedictions +benefactor +benefactor's +benefactors +beneficence +beneficences +beneficial +beneficially +beneficiaries +beneficiary +benefit +benefited +benefiting +benefits +benefitted +benefitting +benevolence +benevolent +bengal +bengali +benighted +benign +benignly +bent +benzedrine +benzene +bequeath +bequeathal +bequeathed +bequeathing +bequeaths +bequest +bequest's +bequests +berate +berated +berates +berating +bereave +bereaved +bereavement +bereavements +bereaves +bereaving +bereft +beret +beret's +berets +beribboned +beriberi +berkelium +berlin +berliner +berliners +bermuda +berries +berry +berry's +berth +berths +beryl +beryllium +beseech +beseeches +beseeching +beset +besets +besetting +beside +besides +besiege +besieged +besieger +besiegers +besieging +besmirch +besmirched +besmirches +besmirching +besotted +besotter +besotting +besought +bespeak +bespeaks +bespectacled +bessel +best +bested +bestial +besting +bestow +bestowal +bestowed +bests +bestseller +bestseller's +bestsellers +bestselling +bet +bet's +beta +betide +betray +betrayal +betrayed +betrayer +betraying +betrays +betroth +betrothal +betrothed +bets +better +bettered +bettering +betterment +betterments +betters +betting +between +betwixt +bevel +beveled +beveling +bevels +beverage +beverage's +beverages +bevy +bewail +bewailed +bewailing +bewails +beware +bewhiskered +bewilder +bewildered +bewildering +bewilderingly +bewilderment +bewilders +bewitch +bewitched +bewitches +bewitching +beyond +biannual +bias +biased +biases +biasing +bib +bib's +bibbed +bibbing +bible +bible's +bibles +biblical +biblically +bibliographic +bibliographical +bibliographies +bibliography +bibliography's +bibliophile +bibs +bicameral +bicarbonate +bicentennial +bicep +bicep's +biceps +bicker +bickered +bickering +bickers +biconcave +biconvex +bicycle +bicycled +bicycler +bicyclers +bicycles +bicycling +bid +bid's +biddable +bidden +bidder +bidder's +bidders +biddies +bidding +biddy +bide +bidirectional +bids +biennial +biennium +bier +bifocal +bifocals +big +bigger +biggest +bight +bight's +bights +bigness +bigot +bigot's +bigoted +bigotry +bigots +bijection +bijection's +bijections +bijective +bijectively +bike +bike's +bikes +biking +bikini +bikini's +bikinis +bilabial +bilateral +bilaterally +bile +bilge +bilge's +bilges +bilinear +bilingual +bilk +bilked +bilking +bilks +bill +billboard +billboard's +billboards +billed +biller +billers +billet +billeted +billeting +billets +billiard +billiards +billing +billings +billion +billions +billionth +billow +billowed +billows +bills +bimodal +bimolecular +bimonthlies +bimonthly +bin +bin's +binary +binaural +bind +binder +binders +binding +bindings +binds +bing +binge +binges +bingo +binocular +binoculars +binomial +bins +binuclear +biochemical +biochemistry +biofeedback +biographer +biographer's +biographers +biographic +biographical +biographically +biographies +biography +biography's +biological +biologically +biologist +biologist's +biologists +biology +biomedical +biomedicine +biopsies +biopsy +bipartisan +bipartite +biped +bipeds +biplane +biplane's +biplanes +bipolar +biracial +birch +birchen +birches +bird +bird's +birdbath +birdbath's +birdbaths +birdie +birdied +birdies +birdlike +birds +birefringence +birefringent +birth +birthday +birthday's +birthdays +birthed +birthplace +birthplaces +birthright +birthright's +birthrights +births +biscuit +biscuit's +biscuits +bisect +bisected +bisecting +bisection +bisection's +bisections +bisector +bisector's +bisectors +bisects +bishop +bishop's +bishops +bismuth +bison +bison's +bisons +bisque +bisques +bit +bit's +bitch +bitch's +bitches +bite +bited +biter +biters +bites +biting +bitingly +bits +bitten +bitter +bitterer +bitterest +bitterly +bitterness +bitters +bittersweet +bituminous +bitwise +bivalve +bivalve's +bivalves +bivariate +bivouac +bivouacs +biweekly +bizarre +blab +blabbed +blabbermouth +blabbermouths +blabbing +blabs +black +blackberries +blackberry +blackberry's +blackbird +blackbird's +blackbirds +blackboard +blackboard's +blackboards +blacked +blacken +blackened +blackening +blackens +blacker +blackest +blacking +blackjack +blackjack's +blackjacks +blacklist +blacklisted +blacklisting +blacklists +blackly +blackmail +blackmailed +blackmailer +blackmailers +blackmailing +blackmails +blackness +blackout +blackout's +blackouts +blacks +blacksmith +blacksmiths +bladder +bladder's +bladders +blade +blade's +blades +blamable +blame +blamed +blameless +blamelessness +blamer +blamers +blames +blaming +blanch +blanched +blanches +blanching +bland +blandly +blandness +blank +blanked +blanker +blankest +blanket +blanketed +blanketer +blanketers +blanketing +blankets +blanking +blankly +blankness +blanks +blare +blared +blares +blaring +blase +blaspheme +blasphemed +blasphemes +blasphemies +blaspheming +blasphemous +blasphemously +blasphemousness +blasphemy +blast +blasted +blaster +blasters +blasting +blasts +blatant +blatantly +blaze +blazed +blazer +blazers +blazes +blazing +bleach +bleached +bleacher +bleachers +bleaches +bleaching +bleak +bleakly +bleakness +blear +bleary +bleat +bleating +bleats +bled +bleed +bleeder +bleeding +bleedings +bleeds +blemish +blemish's +blemishes +blend +blended +blending +blends +bless +blessed +blessing +blessings +blew +blight +blighted +blimp +blimp's +blimps +blind +blinded +blinder +blinders +blindfold +blindfolded +blindfolding +blindfolds +blinding +blindingly +blindly +blindness +blinds +blink +blinked +blinker +blinkers +blinking +blinks +blip +blip's +blips +bliss +blissful +blissfully +blister +blistered +blistering +blisters +blithe +blithely +blitz +blitz's +blitzes +blitzkrieg +blizzard +blizzard's +blizzards +bloat +bloated +bloater +bloating +bloats +blob +blob's +blobs +bloc +bloc's +block +block's +blockade +blockaded +blockades +blockading +blockage +blockage's +blockages +blocked +blocker +blockers +blockhouse +blockhouses +blocking +blocks +blocs +bloke +bloke's +blokes +blond +blond's +blonde +blonde's +blondes +blonds +blood +blooded +bloodhound +bloodhound's +bloodhounds +bloodied +bloodiest +bloodless +bloods +bloodshed +bloodshot +bloodstain +bloodstain's +bloodstained +bloodstains +bloodstream +bloody +bloom +bloomed +bloomers +blooming +blooms +blossom +blossomed +blossoms +blot +blot's +blots +blotted +blotting +blouse +blouse's +blouses +blow +blower +blowers +blowfish +blowing +blown +blows +blowup +blubber +bludgeon +bludgeoned +bludgeoning +bludgeons +blue +blueberries +blueberry +blueberry's +bluebird +bluebird's +bluebirds +bluebonnet +bluebonnet's +bluebonnets +bluefish +blueness +blueprint +blueprint's +blueprints +bluer +blues +bluest +bluestocking +bluff +bluffing +bluffs +bluing +bluish +blunder +blundered +blundering +blunderings +blunders +blunt +blunted +blunter +bluntest +blunting +bluntly +bluntness +blunts +blur +blur's +blurb +blurred +blurring +blurry +blurs +blurt +blurted +blurting +blurts +blush +blushed +blushes +blushing +bluster +blustered +blustering +blusters +blustery +boar +board +boarded +boarder +boarders +boarding +boardinghouse +boardinghouse's +boardinghouses +boards +boast +boasted +boaster +boasters +boastful +boastfully +boasting +boastings +boasts +boat +boater +boaters +boathouse +boathouse's +boathouses +boating +boatload +boatload's +boatloads +boatman +boatmen +boats +boatsman +boatsmen +boatswain +boatswain's +boatswains +boatyard +boatyard's +boatyards +bob +bob's +bobbed +bobbin +bobbin's +bobbing +bobbins +bobby +bobolink +bobolink's +bobolinks +bobs +bobwhite +bobwhite's +bobwhites +bode +bodes +bodice +bodied +bodies +bodily +body +bodybuilder +bodybuilder's +bodybuilders +bodybuilding +bodyguard +bodyguard's +bodyguards +bodyweight +bog +bog's +bogged +boggle +boggled +boggles +boggling +bogs +bogus +boil +boiled +boiler +boilerplate +boilers +boiling +boils +boisterous +boisterously +bold +bolder +boldest +boldface +boldly +boldness +bolivia +boll +bologna +bolshevik +bolshevik's +bolsheviks +bolshevism +bolster +bolstered +bolstering +bolsters +bolt +bolted +bolting +bolts +bomb +bombard +bombarded +bombarding +bombardment +bombards +bombast +bombastic +bombed +bomber +bombers +bombing +bombings +bombproof +bombs +bonanza +bonanza's +bonanzas +bond +bondage +bonded +bonder +bonders +bonding +bonds +bondsman +bondsmen +bone +boned +boner +boners +bones +bonfire +bonfire's +bonfires +bong +boning +bonnet +bonneted +bonnets +bonny +bonus +bonus's +bonuses +bony +boo +boob +booboo +booby +book +bookcase +bookcase's +bookcases +booked +booker +bookers +bookie +bookie's +bookies +booking +bookings +bookish +bookkeeper +bookkeeper's +bookkeepers +bookkeeping +booklet +booklet's +booklets +books +bookseller +bookseller's +booksellers +bookshelf +bookshelf's +bookshelves +bookstore +bookstore's +bookstores +boolean +boom +boomed +boomerang +boomerang's +boomerangs +booming +booms +boomtown +boomtown's +boomtowns +boon +boor +boor's +boorish +boors +boos +boost +boosted +booster +boosting +boosts +boot +booted +booth +booths +booting +bootleg +bootleger +bootlegged +bootlegger +bootlegger's +bootleggers +bootlegging +bootlegs +boots +bootstrap +bootstrap's +bootstrapped +bootstrapping +bootstraps +booty +booze +borate +borates +borax +bordello +bordello's +bordellos +border +bordered +bordering +borderings +borderland +borderland's +borderlands +borderline +borders +bore +bored +boredom +borer +bores +boric +boring +born +borne +borneo +boron +borough +boroughs +borrow +borrowed +borrower +borrowers +borrowing +borrows +bosom +bosom's +bosoms +boss +bossed +bosses +boston +bostonian +bostonian's +bostonians +bosun +botanical +botanist +botanist's +botanists +botany +botch +botched +botcher +botchers +botches +botching +both +bother +bothered +bothering +bothers +bothersome +botswana +bottle +bottled +bottleneck +bottleneck's +bottlenecks +bottler +bottlers +bottles +bottling +bottom +bottomed +bottoming +bottomless +bottoms +botulinus +botulism +bouffant +bough +bough's +boughs +bought +boulder +boulder's +boulders +boulevard +boulevard's +boulevards +bounce +bounced +bouncer +bounces +bouncing +bouncy +bound +boundaries +boundary +boundary's +bounded +bounden +bounding +boundless +boundlessness +bounds +bounteous +bounteously +bounties +bounty +bounty's +bouquet +bouquet's +bouquets +bourbon +bourgeois +bourgeoisie +bout +bout's +bouts +bovine +bovines +bow +bowdlerize +bowdlerized +bowdlerizes +bowdlerizing +bowed +bowel +bowel's +bowels +bower +bowers +bowing +bowl +bowled +bowler +bowlers +bowline +bowline's +bowlines +bowling +bowls +bowman +bows +bowstring +bowstring's +bowstrings +box +boxcar +boxcar's +boxcars +boxed +boxer +boxers +boxes +boxing +boxtop +boxtop's +boxtops +boxwood +boy +boy's +boycott +boycotted +boycotts +boyfriend +boyfriend's +boyfriends +boyhood +boyish +boyishness +boys +bra +bra's +brace +braced +bracelet +bracelet's +bracelets +braces +bracing +bracket +bracketed +bracketing +brackets +brackish +brae +brae's +braes +brag +bragged +bragger +bragging +brags +braid +braided +braiding +braids +braille +brain +brainchild +brainchild's +brained +braining +brains +brainstem +brainstem's +brainstems +brainstorm +brainstorm's +brainstorms +brainwash +brainwashed +brainwashes +brainwashing +brainy +brake +braked +brakes +braking +bramble +bramble's +brambles +brambly +bran +branch +branched +branches +branching +branchings +brand +branded +branding +brandish +brandishes +brandishing +brands +brandy +bras +brash +brashly +brashness +brass +brasses +brassiere +brassy +brat +brat's +brats +bravado +brave +braved +bravely +braveness +braver +bravery +braves +bravest +braving +bravo +bravos +bravura +brawl +brawler +brawling +brawn +bray +brayed +brayer +braying +brays +braze +brazed +brazen +brazenly +brazenness +brazes +brazier +brazier's +braziers +brazil +brazilian +brazing +breach +breached +breacher +breachers +breaches +breaching +bread +breadboard +breadboard's +breadboards +breadbox +breadbox's +breadboxes +breaded +breading +breads +breadth +breadwinner +breadwinner's +breadwinners +break +breakable +breakables +breakage +breakaway +breakdown +breakdown's +breakdowns +breaker +breakers +breakfast +breakfasted +breakfaster +breakfasters +breakfasting +breakfasts +breaking +breakpoint +breakpoint's +breakpoints +breaks +breakthrough +breakthrough's +breakthroughes +breakthroughs +breakup +breakwater +breakwater's +breakwaters +breast +breasted +breasts +breastwork +breastwork's +breastworks +breath +breathable +breathe +breathed +breather +breathers +breathes +breathing +breathless +breathlessly +breaths +breathtaking +breathtakingly +breathy +bred +breech +breech's +breeches +breed +breeder +breeding +breeds +breeze +breeze's +breezes +breezily +breezy +bremsstrahlung +brethren +breve +brevet +breveted +breveting +brevets +brevity +brew +brewed +brewer +breweries +brewers +brewery +brewery's +brewing +brews +briar +briar's +briars +bribe +bribed +briber +bribers +bribes +bribing +brick +bricked +bricker +bricklayer +bricklayer's +bricklayers +bricklaying +bricks +bridal +bride +bride's +bridegroom +brides +bridesmaid +bridesmaid's +bridesmaids +bridge +bridgeable +bridged +bridgehead +bridgehead's +bridgeheads +bridges +bridgework +bridgework's +bridging +bridle +bridled +bridles +bridling +brief +briefcase +briefcase's +briefcases +briefed +briefer +briefest +briefing +briefing's +briefings +briefly +briefness +briefs +brier +brig +brig's +brigade +brigade's +brigades +brigadier +brigadier's +brigadiers +brigantine +bright +brighten +brightened +brightener +brighteners +brightening +brightens +brighter +brightest +brightly +brightness +brigs +brilliance +brilliancy +brilliant +brilliantly +brim +brimful +brimmed +brindle +brindled +brine +bring +bringed +bringer +bringers +bringing +brings +brink +brinkmanship +brisk +brisker +briskly +briskness +bristle +bristled +bristles +bristling +britain +britches +british +britisher +briton +briton's +britons +brittle +brittleness +broach +broached +broaches +broaching +broad +broadband +broadcast +broadcaster +broadcasters +broadcasting +broadcastings +broadcasts +broaden +broadened +broadener +broadeners +broadening +broadenings +broadens +broader +broadest +broadly +broadness +broadside +brocade +brocaded +broccoli +brochure +brochure's +brochures +broil +broiled +broiler +broilers +broiling +broils +broke +broken +brokenly +brokenness +broker +brokerage +brokers +bromide +bromide's +bromides +bromine +bronchi +bronchial +bronchiole +bronchiole's +bronchioles +bronchitis +bronchus +bronze +bronzed +bronzes +brooch +brooch's +brooches +brood +brooder +brooding +broods +brook +brooked +brooks +broom +broom's +brooms +broomstick +broomstick's +broomsticks +broth +brothel +brothel's +brothels +brother +brother's +brotherhood +brotherliness +brotherly +brothers +brought +brow +brow's +browbeat +browbeaten +browbeating +browbeats +brown +browned +browner +brownest +brownie +brownie's +brownies +browning +brownish +brownness +browns +brows +browse +browsing +bruise +bruised +bruises +bruising +brunch +brunches +brunette +brunt +brush +brushed +brushes +brushfire +brushfire's +brushfires +brushing +brushlike +brushy +brusque +brusquely +brutal +brutalities +brutality +brutalize +brutalized +brutalizes +brutalizing +brutally +brute +brute's +brutes +brutish +bubble +bubbled +bubbles +bubbling +bubbly +buck +buckboard +buckboard's +buckboards +bucked +bucket +bucket's +buckets +bucking +buckle +buckled +buckler +buckles +buckling +bucks +buckshot +buckskin +buckskins +buckwheat +bucolic +bud +bud's +budded +buddies +budding +buddy +buddy's +budge +budged +budges +budget +budgetary +budgeted +budgeter +budgeters +budgeting +budgets +budging +buds +buff +buff's +buffalo +buffaloes +buffer +buffer's +buffered +buffering +bufferrer +bufferrer's +bufferrers +buffers +buffet +buffeted +buffeting +buffetings +buffets +buffoon +buffoon's +buffoons +buffs +bug +bug's +bugged +bugger +bugger's +buggers +buggies +bugging +buggy +buggy's +bugle +bugled +bugler +bugles +bugling +bugs +build +builder +builders +building +buildings +builds +buildup +buildup's +buildups +built +bulb +bulb's +bulbs +bulge +bulged +bulging +bulk +bulked +bulkhead +bulkhead's +bulkheads +bulks +bulky +bull +bulldog +bulldog's +bulldogs +bulldoze +bulldozed +bulldozer +bulldozes +bulldozing +bulled +bullet +bullet's +bulletin +bulletin's +bulletins +bullets +bullied +bullies +bulling +bullion +bullish +bulls +bully +bullying +bulwark +bum +bum's +bumble +bumblebee +bumblebee's +bumblebees +bumbled +bumbler +bumblers +bumbles +bumbling +bummed +bumming +bump +bumped +bumper +bumpers +bumping +bumps +bumptious +bumptiously +bumptiousness +bums +bun +bun's +bunch +bunched +bunches +bunching +bundle +bundled +bundles +bundling +bungalow +bungalow's +bungalows +bungle +bungled +bungler +bunglers +bungles +bungling +bunion +bunion's +bunions +bunk +bunker +bunker's +bunkered +bunkers +bunkhouse +bunkhouse's +bunkhouses +bunkmate +bunkmate's +bunkmates +bunks +bunnies +bunny +bunny's +buns +bunt +bunted +bunter +bunters +bunting +bunts +buoy +buoyancy +buoyant +buoyed +buoys +burden +burdened +burdening +burdens +burdensome +bureau +bureau's +bureaucracies +bureaucracy +bureaucracy's +bureaucrat +bureaucrat's +bureaucratic +bureaucrats +bureaus +burgeon +burgeoned +burgeoning +burgess +burgess's +burgesses +burgher +burgher's +burghers +burglar +burglar's +burglaries +burglarize +burglarized +burglarizes +burglarizing +burglarproof +burglarproofed +burglarproofing +burglarproofs +burglars +burglary +burglary's +burial +buried +buries +burl +burlesque +burlesques +burly +burn +burned +burner +burners +burning +burningly +burnings +burnish +burnished +burnishes +burnishing +burns +burnt +burntly +burntness +burp +burped +burping +burps +burr +burr's +burro +burro's +burros +burrow +burrowed +burrower +burrowing +burrows +burrs +bursa +bursitis +burst +bursting +bursts +bury +burying +bus +busboy +busboy's +busboys +bused +buses +bush +bushel +bushel's +bushels +bushes +bushing +bushwhack +bushwhacked +bushwhacking +bushwhacks +bushy +busied +busier +busiest +busily +business +business's +businesses +businesslike +businessman +businessmen +busing +buss +bussed +busses +bussing +bust +bustard +bustard's +bustards +busted +buster +bustle +bustling +busts +busy +but +butane +butcher +butchered +butchers +butchery +butler +butler's +butlers +butt +butt's +butte +butted +butter +buttered +butterer +butterers +butterfat +butterflies +butterfly +butterfly's +buttering +butternut +butters +buttes +butting +buttock +buttock's +buttocks +button +buttoned +buttonhole +buttonhole's +buttonholes +buttoning +buttons +buttress +buttressed +buttresses +buttressing +butts +butyl +butyrate +buxom +buy +buyer +buyer's +buyers +buying +buys +buzz +buzzard +buzzard's +buzzards +buzzed +buzzer +buzzes +buzzing +buzzword +buzzword's +buzzwords +buzzy +by +bye +bygone +bylaw +bylaw's +bylaws +byline +byline's +bylines +bypass +bypassed +bypasses +bypassing +byproduct +byproduct's +byproducts +bystander +bystander's +bystanders +byte +byte's +bytes +byway +byways +byword +byword's +bywords +cab +cab's +cabbage +cabbage's +cabbages +cabin +cabin's +cabinet +cabinet's +cabinets +cabins +cable +cabled +cables +cabling +cabs +cache +cache's +caches +cackle +cackled +cackler +cackles +cackling +cacti +cactus +cadence +cadenced +cafe +cafe's +cafes +cage +caged +cager +cagers +cages +caging +cajole +cajoled +cajoles +cajoling +cake +caked +cakes +caking +calamities +calamity +calamity's +calcium +calculate +calculated +calculates +calculating +calculation +calculations +calculative +calculator +calculator's +calculators +calculus +calendar +calendar's +calendars +calf +caliber +calibers +calibrate +calibrated +calibrates +calibrating +calibration +calibrations +calico +california +caliph +caliphs +call +called +caller +callers +calling +callous +calloused +callously +callousness +calls +calm +calmed +calmer +calmest +calming +calmingly +calmly +calmness +calms +calorie +calorie's +calories +calves +cambridge +came +camel +camel's +camels +camera +camera's +cameras +camouflage +camouflaged +camouflages +camouflaging +camp +campaign +campaigned +campaigner +campaigners +campaigning +campaigns +camped +camper +campers +camping +camps +campus +campus's +campuses +campusses +can +can's +can't +canada +canal +canal's +canals +canaries +canary +canary's +cancel +canceled +canceling +cancellation +cancellation's +cancellations +cancels +cancer +cancer's +cancers +candid +candidate +candidate's +candidates +candidly +candidness +candied +candies +candle +candler +candles +candlestick +candlestick's +candlesticks +candor +candy +cane +caner +canker +canned +canner +canner's +canners +cannibal +cannibal's +cannibalize +cannibalized +cannibalizes +cannibalizing +cannibals +canning +cannister +cannister's +cannisters +cannon +cannon's +cannons +cannot +canoe +canoe's +canoes +canon +canon's +canonical +canonicalization +canonicalize +canonicalized +canonicalizes +canonicalizing +canonically +canonicals +canons +canopy +cans +cantankerous +cantankerously +canto +canton +canton's +cantons +cantor +cantor's +cantors +canvas +canvas's +canvases +canvass +canvassed +canvasser +canvassers +canvasses +canvassing +canyon +canyon's +canyons +cap +cap's +capabilities +capability +capability's +capable +capably +capacious +capaciously +capaciousness +capacitance +capacitances +capacities +capacitive +capacitor +capacitor's +capacitors +capacity +cape +caper +capers +capes +capillary +capita +capital +capitalism +capitalist +capitalist's +capitalists +capitalization +capitalizations +capitalize +capitalized +capitalizer +capitalizers +capitalizes +capitalizing +capitally +capitals +capitol +capitol's +capitols +capped +capping +capricious +capriciously +capriciousness +caps +captain +captained +captaining +captains +caption +caption's +captions +captivate +captivated +captivates +captivating +captivation +captive +captive's +captives +captivity +captor +captor's +captors +capture +captured +capturer +capturers +captures +capturing +car +car's +caravan +caravan's +caravans +carbohydrate +carbolic +carbon +carbon's +carbonate +carbonates +carbonation +carbonic +carbonization +carbonize +carbonized +carbonizer +carbonizers +carbonizes +carbonizing +carbons +carcass +carcass's +carcasses +card +cardboard +carder +cardiac +cardinal +cardinalities +cardinality +cardinality's +cardinally +cardinals +cards +care +cared +career +career's +careers +carefree +careful +carefully +carefulness +careless +carelessly +carelessness +cares +caress +caressed +caresser +caresses +caressing +caret +cargo +cargoes +caribou +caring +carnival +carnival's +carnivals +carnivorous +carnivorously +carol +carol's +carolina +carolina's +carolinas +carols +carpenter +carpenter's +carpenters +carpet +carpeted +carpeting +carpets +carriage +carriage's +carriages +carried +carrier +carriers +carries +carrot +carrot's +carrots +carry +carrying +carryover +carryovers +cars +cart +carted +carter +carters +cartesian +carting +cartography +carton +carton's +cartons +cartoon +cartoon's +cartoons +cartridge +cartridge's +cartridges +carts +carve +carved +carver +carves +carving +carvings +cascade +cascaded +cascades +cascading +case +cased +casement +casement's +casements +cases +cash +cashed +casher +cashers +cashes +cashier +cashier's +cashiers +cashing +casing +casings +cask +cask's +casket +casket's +caskets +casks +casserole +casserole's +casseroles +cast +cast's +caste +casted +caster +casters +castes +casting +castle +castled +castles +casts +casual +casually +casualness +casuals +casualties +casualty +casualty's +cat +cat's +catalog +cataloged +cataloger +cataloging +catalogs +catalogue +catalogued +catalogues +catalyst +catalyst's +catalysts +cataract +catastrophe +catastrophic +catch +catchable +catched +catcher +catchers +catches +catching +categorical +categorically +categories +categorization +categorize +categorized +categorizer +categorizers +categorizes +categorizing +category +category's +cater +catered +caterer +catering +caterpillar +caterpillar's +caterpillars +caters +cathedral +cathedral's +cathedrals +catheter +catheters +cathode +cathode's +cathodes +catholic +catholic's +catholics +cats +catsup +cattle +caught +causal +causality +causally +causation +causation's +causations +cause +caused +causer +causes +causeway +causeway's +causeways +causing +caustic +causticly +caustics +caution +cautioned +cautioner +cautioners +cautioning +cautionings +cautions +cautious +cautiously +cautiousness +cavalier +cavalierly +cavalierness +cavalry +cave +caveat +caveat's +caveats +caved +cavern +cavern's +caverns +caves +caving +cavities +cavity +cavity's +caw +cawing +cdr +cease +ceased +ceaseless +ceaselessly +ceaselessness +ceases +ceasing +cedar +ceiling +ceiling's +ceilings +celebrate +celebrated +celebrates +celebrating +celebration +celebrations +celebrities +celebrity +celebrity's +celery +celestial +celestially +cell +cellar +cellar's +cellars +celled +cellist +cellist's +cellists +cells +cellular +cement +cemented +cementing +cements +cemeteries +cemetery +cemetery's +censor +censored +censoring +censors +censorship +censure +censured +censurer +censures +census +census's +censuses +cent +center +centered +centering +centerpiece +centerpiece's +centerpieces +centers +centimeter +centimeters +centipede +centipede's +centipedes +central +centralization +centralize +centralized +centralizes +centralizing +centrally +centripetal +cents +centuries +century +century's +cereal +cereal's +cereals +cerebral +ceremonial +ceremonially +ceremonialness +ceremonies +ceremony +ceremony's +certain +certainly +certainties +certainty +certifiable +certificate +certificates +certification +certifications +certified +certifier +certifiers +certifies +certify +certifying +cessation +cessation's +cessations +chafe +chafer +chaff +chaffer +chaffing +chafing +chagrin +chain +chained +chaining +chains +chair +chaired +chairing +chairman +chairmen +chairperson +chairperson's +chairpersons +chairs +chalice +chalice's +chalices +chalk +chalked +chalking +chalks +challenge +challenged +challenger +challengers +challenges +challenging +chamber +chambered +chamberlain +chamberlain's +chamberlains +chambers +champagne +champaign +champion +championed +championing +champions +championship +championship's +championships +chance +chanced +chancellor +chances +chancing +chandelier +chandelier's +chandeliers +change +changeability +changeable +changeably +changed +changer +changers +changes +changing +channel +channeled +channeling +channelled +channeller +channeller's +channellers +channelling +channels +chant +chanted +chanter +chanticleer +chanticleer's +chanticleers +chanting +chants +chaos +chaotic +chap +chap's +chapel +chapel's +chapels +chaperon +chaperoned +chaplain +chaplain's +chaplains +chaps +chapter +chapter's +chapters +char +character +character's +characteristic +characteristic's +characteristically +characteristics +characterizable +characterization +characterization's +characterizations +characterize +characterized +characterizer +characterizers +characterizes +characterizing +characters +charcoal +charcoaled +charge +chargeable +charged +charger +chargers +charges +charging +chariot +chariot's +chariots +charitable +charitableness +charities +charity +charity's +charm +charmed +charmer +charmers +charming +charmingly +charms +chars +chart +chartable +charted +charter +chartered +chartering +charters +charting +chartings +charts +chase +chased +chaser +chasers +chases +chasing +chasm +chasm's +chasms +chaste +chastely +chasteness +chastise +chastised +chastiser +chastisers +chastises +chastising +chat +chateau +chateau's +chateaus +chatter +chattered +chatterer +chattererz +chattering +chatters +chauffeur +chauffeured +cheap +cheapen +cheapened +cheapening +cheapens +cheaper +cheapest +cheaply +cheapness +cheat +cheated +cheater +cheaters +cheating +cheats +check +checkable +checkbook +checkbook's +checkbooks +checked +checker +checkers +checking +checkout +checkpoint +checkpoint's +checkpoints +checks +checksum +checksum's +checksums +cheek +cheek's +cheeks +cheer +cheered +cheerer +cheerful +cheerfully +cheerfulness +cheerily +cheeriness +cheering +cheerless +cheerlessly +cheerlessness +cheers +cheery +cheese +cheese's +cheeses +chef +chef's +chefs +chemical +chemically +chemicals +chemise +chemist +chemist's +chemistries +chemistry +chemists +cherish +cherished +cherishes +cherishing +cherries +cherry +cherry's +cherub +cherub's +cherubim +cherubs +chess +chest +chester +chestnut +chestnut's +chestnuts +chests +chew +chewed +chewer +chewers +chewing +chews +chick +chickadee +chickadee's +chickadees +chicken +chickens +chicks +chide +chided +chides +chiding +chief +chiefly +chiefs +chieftain +chieftain's +chieftains +chiffon +child +childhood +childish +childishly +childishness +children +chill +chilled +chiller +chillers +chillier +chilliness +chilling +chillingly +chills +chilly +chime +chime's +chimes +chimney +chimney's +chimneys +chin +chin's +chinese +chink +chinked +chinks +chinned +chinner +chinners +chinning +chins +chintz +chip +chip's +chipmunk +chipmunk's +chipmunks +chips +chirp +chirped +chirping +chirps +chisel +chiseled +chiseler +chisels +chivalrous +chivalrously +chivalrousness +chivalry +chlorine +chloroplast +chloroplast's +chloroplasts +chock +chock's +chocks +chocolate +chocolate's +chocolates +choice +choices +choicest +choir +choir's +choirs +choke +choked +choker +chokers +chokes +choking +cholera +choose +chooser +choosers +chooses +choosing +chop +chopped +chopper +chopper's +choppers +chopping +chops +choral +chord +chord's +chords +chore +chores +choring +chorus +chorused +choruses +chose +chosen +christen +christened +christening +christens +christian +christian's +christians +christmas +chronic +chronicle +chronicled +chronicler +chroniclers +chronicles +chronological +chronologically +chronologies +chronology +chronology's +chubbier +chubbiest +chubbiness +chubby +chuck +chuck's +chuckle +chuckled +chuckles +chucks +chum +chunk +chunk's +chunks +church +churches +churchly +churchman +churchyard +churchyard's +churchyards +churn +churned +churning +churns +chute +chute's +chutes +cider +cigar +cigar's +cigarette +cigarette's +cigarettes +cigars +cinder +cinder's +cinders +cinnamon +cipher +cipher's +ciphers +circle +circled +circles +circling +circuit +circuit's +circuitous +circuitously +circuitry +circuits +circular +circularity +circularly +circulate +circulated +circulates +circulating +circulation +circumference +circumflex +circumlocution +circumlocution's +circumlocutions +circumspect +circumspectly +circumstance +circumstance's +circumstances +circumstantial +circumstantially +circumvent +circumventable +circumvented +circumventing +circumvents +circus +circus's +circuses +cistern +cistern's +cisterns +citadel +citadel's +citadels +citation +citation's +citations +cite +cited +cites +cities +citing +citizen +citizen's +citizens +citizenship +city +city's +civic +civics +civil +civilian +civilian's +civilians +civility +civilization +civilization's +civilizations +civilize +civilized +civilizes +civilizing +civilly +clad +claim +claimable +claimant +claimant's +claimants +claimed +claiming +claims +clairvoyant +clairvoyantly +clam +clam's +clamber +clambered +clambering +clambers +clamor +clamored +clamoring +clamorous +clamors +clamp +clamped +clamping +clamps +clams +clan +clang +clanged +clanging +clangs +clap +claps +clarification +clarifications +clarified +clarifies +clarify +clarifying +clarity +clash +clashed +clashes +clashing +clasp +clasped +clasping +clasps +class +classed +classes +classic +classical +classically +classics +classifiable +classification +classifications +classified +classifier +classifiers +classifies +classify +classifying +classmate +classmate's +classmates +classroom +classroom's +classrooms +clatter +clattered +clattering +clause +clause's +clauses +claw +clawed +clawing +claws +clay +clay's +clays +clean +cleaned +cleaner +cleaner's +cleaners +cleanest +cleaning +cleanliness +cleanly +cleanness +cleans +cleanse +cleansed +cleanser +cleansers +cleanses +cleansing +clear +clearance +clearance's +clearances +cleared +clearer +clearest +clearing +clearing's +clearings +clearly +clearness +clears +cleavage +cleave +cleaved +cleaver +cleavers +cleaves +cleaving +cleft +cleft's +clefts +clench +clenched +clenches +clergy +clergyman +clerical +clerk +clerked +clerking +clerks +clever +cleverer +cleverest +cleverly +cleverness +cliche +cliche's +cliches +click +clicked +clicking +clicks +client +client's +clients +cliff +cliff's +cliffs +climate +climate's +climates +climatic +climatically +climax +climaxed +climaxes +climb +climbed +climber +climbers +climbing +climbs +clime +clime's +climes +clinch +clinched +clincher +clinches +cling +clinging +clings +clinic +clinic's +clinical +clinically +clinics +clink +clinked +clinker +clip +clip's +clipped +clipper +clipper's +clippers +clipping +clipping's +clippings +clips +clique +clique's +cliques +cloak +cloak's +cloaks +clobber +clobbered +clobbering +clobbers +clock +clocked +clocker +clockers +clocking +clockings +clocks +clockwise +clockwork +clod +clod's +clods +clog +clog's +clogged +clogging +clogs +cloister +cloister's +cloisters +clone +cloned +clones +cloning +close +closed +closely +closeness +closenesses +closer +closers +closes +closest +closet +closeted +closets +closing +closure +closure's +closures +cloth +clothe +clothed +clothes +clothing +cloud +clouded +cloudier +cloudiest +cloudiness +clouding +cloudless +clouds +cloudy +clout +clove +clover +cloves +clown +clowning +clowns +club +club's +clubbed +clubbing +clubs +cluck +clucked +clucking +clucks +clue +clue's +clues +clump +clumped +clumping +clumps +clumsily +clumsiness +clumsy +clung +cluster +clustered +clustering +clusterings +clusters +clutch +clutched +clutches +clutching +clutter +cluttered +cluttering +clutters +coach +coached +coacher +coaches +coaching +coachman +coal +coalesce +coalesced +coalesces +coalescing +coalition +coals +coarse +coarsely +coarsen +coarsened +coarseness +coarser +coarsest +coast +coastal +coasted +coaster +coasters +coasting +coasts +coat +coated +coating +coatings +coats +coax +coaxed +coaxer +coaxes +coaxing +cobbler +cobbler's +cobblers +cobol +cobweb +cobweb's +cobwebs +cock +cocked +cocking +cocks +cocktail +cocktail's +cocktails +cocoa +coconut +coconut's +coconuts +cocoon +cocoon's +cocoons +cod +code +coded +coder +coders +codes +codeword +codeword's +codewords +codification +codification's +codifications +codified +codifier +codifier's +codifiers +codifies +codify +codifying +coding +codings +coefficient +coefficient's +coefficients +coerce +coerced +coerces +coercing +coercion +coercive +coexist +coexisted +coexistence +coexisting +coexists +coffee +coffee's +coffees +coffer +coffer's +coffers +coffin +coffin's +coffins +cogent +cogently +cogitate +cogitated +cogitates +cogitating +cogitation +cognition +cognitive +cognitively +cognizance +cognizant +cohabitate +cohabitation +cohabitations +cohere +cohered +coherence +coherent +coherently +coheres +cohering +cohesion +cohesive +cohesively +cohesiveness +coil +coiled +coiling +coils +coin +coinage +coincide +coincided +coincidence +coincidence's +coincidences +coincidental +coincides +coinciding +coined +coiner +coining +coins +coke +cokes +cold +colder +coldest +coldly +coldness +colds +collaborate +collaborated +collaborates +collaborating +collaboration +collaborations +collaborative +collaborator +collaborator's +collaborators +collapse +collapsed +collapses +collapsing +collar +collared +collaring +collars +collateral +colleague +colleague's +colleagues +collect +collected +collectible +collecting +collection +collection's +collections +collective +collectively +collectives +collector +collector's +collectors +collects +college +college's +colleges +collegiate +collide +collided +collides +colliding +collie +collier +collies +collision +collision's +collisions +cologne +colon +colon's +colonel +colonel's +colonels +colonial +colonially +colonials +colonies +colonist +colonist's +colonists +colonization +colonize +colonized +colonizer +colonizers +colonizes +colonizing +colons +colony +colony's +color +colorado +colored +colorer +colorers +colorful +coloring +colorings +colorless +colors +colossal +colt +colt's +colts +column +column's +columnate +columnated +columnates +columnating +columnation +columnize +columnized +columnizes +columnizing +columns +comb +combat +combatant +combatant's +combatants +combated +combating +combative +combats +combed +comber +combers +combination +combination's +combinational +combinations +combinator +combinator's +combinatorial +combinatorially +combinatoric +combinatorics +combinators +combine +combined +combines +combing +combings +combining +combs +combustion +come +comedian +comedian's +comedians +comedic +comedies +comedy +comedy's +comeliness +comely +comer +comers +comes +comestible +comet +comet's +comets +comfort +comfortabilities +comfortability +comfortable +comfortably +comforted +comforter +comforters +comforting +comfortingly +comforts +comic +comic's +comical +comically +comics +coming +comings +comma +comma's +command +command's +commandant +commandant's +commandants +commanded +commander +commanders +commanding +commandingly +commandment +commandment's +commandments +commands +commas +commemorate +commemorated +commemorates +commemorating +commemoration +commemorative +commence +commenced +commencement +commencement's +commencements +commences +commencing +commend +commendation +commendation's +commendations +commended +commending +commends +commensurate +comment +commentaries +commentary +commentary's +commentator +commentator's +commentators +commented +commenting +comments +commerce +commercial +commercially +commercialness +commercials +commission +commissioned +commissioner +commissioners +commissioning +commissions +commit +commitment +commitment's +commitments +commits +committed +committee +committee's +committees +committing +commodities +commodity +commodity's +commodore +commodore's +commodores +common +commonalities +commonality +commoner +commoner's +commoners +commonest +commonly +commonness +commonplace +commonplaces +commons +commonwealth +commonwealths +commotion +communal +communally +commune +communes +communicant +communicant's +communicants +communicate +communicated +communicates +communicating +communication +communications +communicative +communicator +communicator's +communicators +communion +communist +communist's +communists +communities +community +community's +commutative +commutativity +commute +commuted +commuter +commuters +commutes +commuting +compact +compacted +compacter +compactest +compacting +compactly +compactness +compactor +compactor's +compactors +compacts +companies +companion +companion's +companionable +companions +companionship +company +company's +comparability +comparable +comparably +comparative +comparatively +comparatives +comparator +comparator's +comparators +compare +compared +compares +comparing +comparison +comparison's +comparisons +compartment +compartmentalize +compartmentalized +compartmentalizes +compartmentalizing +compartmented +compartments +compass +compassion +compassionate +compassionately +compatibilities +compatibility +compatibility's +compatible +compatibly +compel +compelled +compelling +compellingly +compels +compendium +compensate +compensated +compensates +compensating +compensation +compensations +compensatory +compete +competed +competence +competent +competently +competes +competing +competition +competition's +competitions +competitive +competitively +competitor +competitor's +competitors +compilation +compilation's +compilations +compile +compiled +compiler +compiler's +compilers +compiles +compiling +complain +complained +complainer +complainers +complaining +complains +complaint +complaint's +complaints +complement +complementary +complemented +complementer +complementers +complementing +complements +complete +completed +completely +completeness +completes +completing +completion +completions +complex +complexes +complexion +complexities +complexity +complexly +compliance +complicate +complicated +complicates +complicating +complication +complications +complicator +complicator's +complicators +complicity +complied +compliment +complimentary +complimented +complimenter +complimenters +complimenting +compliments +comply +complying +component +component's +components +componentwise +compose +composed +composedly +composer +composers +composes +composing +composite +composites +composition +compositional +compositions +composure +compound +compounded +compounding +compounds +comprehend +comprehended +comprehending +comprehends +comprehensibility +comprehensible +comprehension +comprehensive +comprehensively +compress +compressed +compresses +compressible +compressing +compression +compressive +comprise +comprised +comprises +comprising +compromise +compromised +compromiser +compromisers +compromises +compromising +compromisingly +comptroller +comptroller's +comptrollers +compulsion +compulsion's +compulsions +compulsory +compunction +computability +computable +computation +computation's +computational +computationally +computations +compute +computed +computer +computer's +computerize +computerized +computerizes +computerizing +computers +computes +computing +comrade +comradely +comrades +comradeship +concatenate +concatenated +concatenates +concatenating +concatenation +concatenations +conceal +concealed +concealer +concealers +concealing +concealment +conceals +concede +conceded +concedes +conceding +conceit +conceited +conceits +conceivable +conceivably +conceive +conceived +conceives +conceiving +concentrate +concentrated +concentrates +concentrating +concentration +concentrations +concentrator +concentrators +concentric +concept +concept's +conception +conception's +conceptions +concepts +conceptual +conceptualization +conceptualization's +conceptualizations +conceptualize +conceptualized +conceptualizes +conceptualizing +conceptually +concern +concerned +concernedly +concerning +concerns +concert +concerted +concerts +concession +concession's +concessions +concise +concisely +conciseness +conclude +concluded +concludes +concluding +conclusion +conclusion's +conclusions +conclusive +conclusively +concomitant +concord +concrete +concretely +concreteness +concretes +concretion +concur +concurred +concurrence +concurrencies +concurrency +concurrent +concurrently +concurring +concurs +condemn +condemnation +condemnations +condemned +condemner +condemners +condemning +condemns +condensation +condense +condensed +condenser +condenses +condensing +condescend +condescending +condition +conditional +conditionally +conditionals +conditioned +conditioner +conditioners +conditioning +conditions +condone +condoned +condones +condoning +conducive +conduct +conducted +conducting +conduction +conductive +conductivity +conductor +conductor's +conductors +conducts +cone +cone's +cones +confederacy +confederate +confederates +confederation +confederations +confer +conference +conference's +conferences +conferred +conferrer +conferrer's +conferrers +conferring +confers +confess +confessed +confesses +confessing +confession +confession's +confessions +confessor +confessor's +confessors +confidant +confidant's +confidants +confide +confided +confidence +confidences +confident +confidential +confidentiality +confidentially +confidently +confides +confiding +confidingly +configurable +configuration +configuration's +configurations +configure +configured +configures +configuring +confine +confined +confinement +confinement's +confinements +confiner +confines +confining +confirm +confirmation +confirmation's +confirmations +confirmed +confirming +confirms +confiscate +confiscated +confiscates +confiscating +confiscation +confiscations +conflict +conflicted +conflicting +conflicts +conform +conformed +conforming +conformity +conforms +confound +confounded +confounding +confounds +confront +confrontation +confrontation's +confrontations +confronted +confronter +confronters +confronting +confronts +confuse +confused +confuser +confusers +confuses +confusing +confusingly +confusion +confusions +congenial +congenially +congested +congestion +congratulate +congratulated +congratulation +congratulations +congregate +congregated +congregates +congregating +congregation +congregations +congress +congress's +congresses +congressional +congressionally +congressman +congruence +congruent +conjecture +conjectured +conjectures +conjecturing +conjoined +conjunct +conjuncted +conjunction +conjunction's +conjunctions +conjunctive +conjunctively +conjuncts +conjure +conjured +conjurer +conjures +conjuring +connect +connected +connectedness +connecting +connection +connection's +connections +connective +connective's +connectives +connectivity +connector +connector's +connectors +connects +connoisseur +connoisseur's +connoisseurs +connote +connoted +connotes +connoting +conquer +conquerable +conquered +conquerer +conquerers +conquering +conqueror +conqueror's +conquerors +conquers +conquest +conquest's +conquests +cons +conscience +conscience's +consciences +conscientious +conscientiously +conscious +consciously +consciousness +consecrate +consecration +consecutive +consecutively +consensus +consent +consented +consenter +consenters +consenting +consents +consequence +consequence's +consequences +consequent +consequential +consequentialities +consequentiality +consequently +consequents +conservation +conservation's +conservationist +conservationist's +conservationists +conservations +conservatism +conservative +conservatively +conservatives +conserve +conserved +conserves +conserving +consider +considerable +considerably +considerate +considerately +consideration +considerations +considered +considering +considers +consign +consigned +consigning +consigns +consist +consisted +consistency +consistent +consistently +consisting +consists +consolable +consolation +consolation's +consolations +console +consoled +consoler +consolers +consoles +consolidate +consolidated +consolidates +consolidating +consolidation +consoling +consolingly +consonant +consonant's +consonants +consort +consorted +consorting +consortium +consorts +conspicuous +conspicuously +conspiracies +conspiracy +conspiracy's +conspirator +conspirator's +conspirators +conspire +conspired +conspires +constable +constable's +constables +constancy +constant +constantly +constants +constellation +constellation's +constellations +consternation +constituencies +constituency +constituency's +constituent +constituent's +constituents +constitute +constituted +constitutes +constituting +constitution +constitutional +constitutionality +constitutionally +constitutions +constitutive +constrain +constrained +constraining +constrains +constraint +constraint's +constraints +construct +constructed +constructibility +constructible +constructing +construction +construction's +constructions +constructive +constructively +constructor +constructor's +constructors +constructs +construe +construed +construing +consul +consul's +consulate +consulate's +consulates +consuls +consult +consultant +consultant's +consultants +consultation +consultation's +consultations +consulted +consulting +consults +consumable +consume +consumed +consumer +consumer's +consumers +consumes +consuming +consummate +consummated +consummately +consummation +consumption +consumption's +consumptions +consumptive +consumptively +contact +contacted +contacting +contacts +contagion +contagious +contagiously +contain +containable +contained +container +containers +containing +containment +containment's +containments +contains +contaminate +contaminated +contaminates +contaminating +contamination +contemplate +contemplated +contemplates +contemplating +contemplation +contemplations +contemplative +contemporaries +contemporariness +contemporary +contempt +contemptible +contemptuous +contemptuously +contend +contended +contender +contenders +contending +contends +content +contented +contenting +contention +contention's +contentions +contently +contentment +contents +contest +contestable +contested +contester +contesters +contesting +contests +context +context's +contexts +contextual +contextually +contiguity +contiguous +contiguously +continent +continent's +continental +continentally +continents +contingencies +contingency +contingency's +contingent +contingent's +contingents +continual +continually +continuance +continuance's +continuances +continuation +continuation's +continuations +continue +continued +continues +continuing +continuities +continuity +continuous +continuously +continuum +contour +contour's +contoured +contouring +contours +contract +contracted +contracting +contraction +contraction's +contractions +contractor +contractor's +contractors +contracts +contractual +contractually +contradict +contradicted +contradicting +contradiction +contradiction's +contradictions +contradictory +contradicts +contradistinction +contradistinctions +contrapositive +contrapositives +contraption +contraption's +contraptions +contrariness +contrary +contrast +contrasted +contraster +contrasters +contrasting +contrastingly +contrasts +contribute +contributed +contributes +contributing +contribution +contributions +contributor +contributor's +contributorily +contributors +contributory +contrivance +contrivance's +contrivances +contrive +contrived +contriver +contrives +contriving +control +control's +controllability +controllable +controllably +controlled +controller +controller's +controllers +controlling +controls +controversial +controversies +controversy +controversy's +conundrum +conundrum's +conundrums +convene +convened +convenes +convenience +convenience's +conveniences +convenient +conveniently +convening +convent +convent's +convention +convention's +conventional +conventionally +conventions +convents +converge +converged +convergence +convergent +converges +converging +conversant +conversantly +conversation +conversation's +conversational +conversationally +conversations +converse +conversed +conversely +converses +conversing +conversion +conversions +convert +converted +converter +converters +convertibility +convertible +converting +converts +convex +convey +conveyance +conveyance's +conveyances +conveyed +conveyer +conveyers +conveying +conveys +convict +convicted +convicting +conviction +conviction's +convictions +convicts +convince +convinced +convincer +convincers +convinces +convincing +convincingly +convoluted +convoy +convoyed +convoying +convoys +convulsion +convulsion's +convulsions +coo +cooing +cook +cooked +cookery +cookie +cookie's +cookies +cooking +cooks +cooky +cool +cooled +cooler +cooler's +coolers +coolest +coolie +coolie's +coolies +cooling +coolly +coolness +cools +coon +coon's +coons +coop +cooped +cooper +cooperate +cooperated +cooperates +cooperating +cooperation +cooperations +cooperative +cooperatively +cooperatives +cooperator +cooperator's +cooperators +coopers +coops +coordinate +coordinated +coordinates +coordinating +coordination +coordinations +coordinator +coordinator's +coordinators +cop +cop's +cope +coped +copes +copied +copier +copiers +copies +coping +copings +copious +copiously +copiousness +copper +copper's +coppers +cops +copse +copy +copying +copyright +copyright's +copyrights +coral +cord +corded +corder +cordial +cordially +cords +core +cored +corer +corers +cores +coring +cork +corked +corker +corkers +corking +corks +cormorant +corn +corner +cornered +corners +cornerstone +cornerstone's +cornerstones +cornfield +cornfield's +cornfields +corning +corns +corollaries +corollary +corollary's +coronaries +coronary +coronation +coronet +coronet's +coronets +coroutine +coroutine's +coroutines +corporacies +corporacy +corporal +corporal's +corporals +corporate +corporately +corporation +corporation's +corporations +corps +corpse +corpse's +corpses +corpus +correct +correctable +corrected +correcting +correction +corrections +corrective +correctively +correctives +correctly +correctness +corrector +corrects +correlate +correlated +correlates +correlating +correlation +correlations +correlative +correspond +corresponded +correspondence +correspondence's +correspondences +correspondent +correspondent's +correspondents +corresponding +correspondingly +corresponds +corridor +corridor's +corridors +corroborate +corroborated +corroborates +corroborating +corroboration +corroborations +corroborative +corrosion +corrupt +corrupted +corrupter +corrupting +corruption +corrupts +corset +cosine +cosines +cosmetic +cosmetics +cosmology +cosmopolitan +cost +costed +costing +costly +costs +costume +costumed +costumer +costumes +costuming +cot +cot's +cots +cottage +cottager +cottages +cotton +cottons +cotyledon +cotyledon's +cotyledons +couch +couched +couches +couching +cough +coughed +coughing +coughs +could +couldn't +council +council's +councillor +councillor's +councillors +councils +counsel +counseled +counseling +counselled +counselling +counsellor +counsellor's +counsellors +counselor +counselor's +counselors +counsels +count +countable +countably +counted +countenance +counter +counteract +counteracted +counteracting +counteractive +counterclockwise +countered +counterexample +counterexamples +counterfeit +counterfeited +counterfeiter +counterfeiting +countering +countermeasure +countermeasure's +countermeasures +counterpart +counterpart's +counterparts +counterpoint +counterpointing +counterproductive +counterrevolution +counters +countess +counties +counting +countless +countries +country +country's +countryman +countryside +counts +county +county's +couple +coupled +coupler +couplers +couples +coupling +couplings +coupon +coupon's +coupons +courage +courageous +courageously +courier +courier's +couriers +course +coursed +courser +courses +coursing +court +courted +courteous +courteously +courter +courters +courtesies +courtesy +courtesy's +courthouse +courthouse's +courthouses +courtier +courtier's +courtiers +courting +courtly +courtroom +courtroom's +courtrooms +courts +courtship +courtyard +courtyard's +courtyards +cousin +cousin's +cousins +cove +covenant +covenant's +covenants +cover +coverable +coverage +covered +covering +coverings +coverlet +coverlet's +coverlets +covers +covert +covertly +coves +covet +coveted +coveting +covetous +covetousness +covets +cow +coward +cowardice +cowardly +cowboy +cowboy's +cowboys +cowed +cower +cowered +cowerer +cowerers +cowering +coweringly +cowers +cowing +cowl +cowling +cowls +cows +cowslip +cowslip's +cowslips +coyote +coyote's +coyotes +cozier +coziness +cozy +crab +crab's +crabs +crack +cracked +cracker +crackers +cracking +crackle +crackled +crackles +crackling +cracks +cradle +cradled +cradles +craft +crafted +crafter +craftiness +crafting +crafts +craftsman +crafty +crag +crag's +crags +cram +cramp +cramp's +cramps +crams +cranberries +cranberry +cranberry's +crane +crane's +cranes +crank +cranked +crankier +crankiest +crankily +cranking +cranks +cranky +crash +crashed +crasher +crashers +crashes +crashing +crate +crater +craters +crates +cravat +cravat's +cravats +crave +craved +craven +craves +craving +crawl +crawled +crawler +crawlers +crawling +crawls +craze +crazed +crazes +crazier +craziest +crazily +craziness +crazing +crazy +creak +creaked +creaking +creaks +cream +creamed +creamer +creamers +creaming +creams +creamy +crease +creased +creases +creasing +create +created +creates +creating +creation +creations +creative +creatively +creativeness +creativity +creator +creator's +creators +creature +creature's +creatures +credence +credibility +credible +credibly +credit +creditable +creditably +credited +crediting +creditor +creditor's +creditors +credits +credulity +credulous +credulousness +creed +creed's +creeds +creek +creek's +creeks +creep +creeper +creepers +creeping +creeps +cremate +cremated +cremates +cremating +cremation +cremations +crepe +crept +crescent +crescent's +crescents +crest +crested +crests +crevice +crevice's +crevices +crew +crewed +crewing +crews +crib +crib's +cribs +cricket +cricket's +crickets +cried +crier +criers +cries +crime +crime's +crimes +criminal +criminally +criminals +crimson +crimsoning +cringe +cringed +cringes +cringing +cripple +crippled +cripples +crippling +crises +crisis +crisp +crisply +crispness +criteria +criterion +critic +critic's +critical +critically +criticise +criticised +criticism +criticism's +criticisms +criticize +criticized +criticizes +criticizing +critics +critique +critiques +critiquing +croak +croaked +croaking +croaks +crochet +crochets +crook +crooked +crooks +crop +crop's +cropped +cropper +cropper's +croppers +cropping +crops +cross +crossable +crossbar +crossbar's +crossbars +crossed +crosser +crossers +crosses +crossing +crossings +crossly +crossover +crossover's +crossovers +crossword +crossword's +crosswords +crouch +crouched +crouching +crow +crowd +crowded +crowder +crowding +crowds +crowed +crowing +crown +crowned +crowning +crowns +crows +crucial +crucially +crucified +crucifies +crucify +crucifying +crude +crudely +crudeness +crudest +cruel +crueler +cruelest +cruelly +cruelty +cruise +cruiser diff --git a/mozilla/db/txn/txn.c b/mozilla/db/txn/txn.c new file mode 100644 index 00000000000..4f3ffd8ed2e --- /dev/null +++ b/mozilla/db/txn/txn.c @@ -0,0 +1,833 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 1995, 1996 + * The President and Fellows of Harvard University. 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. 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)txn.c 10.58 (Sleepycat) 5/31/98"; +#endif /* not lint */ + + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_page.h" +#include "db_shash.h" +#include "txn.h" +#include "db_dispatch.h" +#include "lock.h" +#include "log.h" +#include "db_am.h" +#include "common_ext.h" + +static int __txn_check_running __P((const DB_TXN *)); +static int __txn_end __P((DB_TXN *, int)); +static int __txn_grow_region __P((DB_TXNMGR *)); +static int __txn_init __P((DB_TXNREGION *)); +static int __txn_undo __P((DB_TXN *)); +static int __txn_validate_region __P((DB_TXNMGR *)); + +/* + * This file contains the top level routines of the transaction library. + * It assumes that a lock manager and log manager that conform to the db_log(3) + * and db_lock(3) interfaces exist. + * + * Initialize a transaction region in shared memory. + * Return 0 on success, errno on failure. + */ +static int +__txn_init(txn_region) + DB_TXNREGION *txn_region; +{ + time_t now; + + (void)time(&now); + + /* maxtxns is already initialized. */ + txn_region->magic = DB_TXNMAGIC; + txn_region->version = DB_TXNVERSION; + txn_region->last_txnid = TXN_MINIMUM; + /* XXX If we ever do more types of locking and logging, this changes. */ + txn_region->logtype = 0; + txn_region->locktype = 0; + txn_region->time_ckp = now; + ZERO_LSN(txn_region->last_ckp); + ZERO_LSN(txn_region->pending_ckp); + SH_TAILQ_INIT(&txn_region->active_txn); + __db_shalloc_init((void *)&txn_region[1], + TXN_REGION_SIZE(txn_region->maxtxns) - sizeof(DB_TXNREGION)); + + return (0); +} + +int +txn_open(path, flags, mode, dbenv, mgrpp) + const char *path; + u_int32_t flags; + int mode; + DB_ENV *dbenv; + DB_TXNMGR **mgrpp; +{ + DB_TXNMGR *tmgrp; + u_int32_t maxtxns; + int ret; + + /* Validate arguments. */ + if (dbenv == NULL) + return (EINVAL); +#ifdef HAVE_SPINLOCKS +#define OKFLAGS (DB_CREATE | DB_THREAD | DB_TXN_NOSYNC) +#else +#define OKFLAGS (DB_CREATE | DB_TXN_NOSYNC) +#endif + if ((ret = __db_fchk(dbenv, "txn_open", flags, OKFLAGS)) != 0) + return (ret); + + maxtxns = dbenv->tx_max != 0 ? dbenv->tx_max : 20; + + /* Now, create the transaction manager structure and set its fields. */ + if ((tmgrp = (DB_TXNMGR *)__db_calloc(1, sizeof(DB_TXNMGR))) == NULL) { + __db_err(dbenv, "txn_open: %s", strerror(ENOMEM)); + return (ENOMEM); + } + + /* Initialize the transaction manager structure. */ + tmgrp->mutexp = NULL; + tmgrp->dbenv = dbenv; + tmgrp->recover = + dbenv->tx_recover == NULL ? __db_dispatch : dbenv->tx_recover; + tmgrp->flags = LF_ISSET(DB_TXN_NOSYNC | DB_THREAD); + TAILQ_INIT(&tmgrp->txn_chain); + + /* Join/create the txn region. */ + tmgrp->reginfo.dbenv = dbenv; + tmgrp->reginfo.appname = DB_APP_NONE; + if (path == NULL) + tmgrp->reginfo.path = NULL; + else + if ((tmgrp->reginfo.path = (char *)__db_strdup(path)) == NULL) + goto err; + tmgrp->reginfo.file = DEFAULT_TXN_FILE; + tmgrp->reginfo.mode = mode; + tmgrp->reginfo.size = TXN_REGION_SIZE(maxtxns); + tmgrp->reginfo.dbflags = flags; + tmgrp->reginfo.addr = NULL; + tmgrp->reginfo.fd = -1; + tmgrp->reginfo.flags = dbenv->tx_max == 0 ? REGION_SIZEDEF : 0; + if ((ret = __db_rattach(&tmgrp->reginfo)) != 0) + goto err; + + /* Fill in region-related fields. */ + tmgrp->region = tmgrp->reginfo.addr; + tmgrp->mem = &tmgrp->region[1]; + + if (F_ISSET(&tmgrp->reginfo, REGION_CREATED)) { + tmgrp->region->maxtxns = maxtxns; + if ((ret = __txn_init(tmgrp->region)) != 0) + goto err; + + } else if (tmgrp->region->magic != DB_TXNMAGIC) { + /* Check if valid region. */ + __db_err(dbenv, "txn_open: Bad magic number"); + ret = EINVAL; + goto err; + } + + if (LF_ISSET(DB_THREAD)) { + if ((ret = __db_shalloc(tmgrp->mem, sizeof(db_mutex_t), + MUTEX_ALIGNMENT, &tmgrp->mutexp)) == 0) + /* + * Since we only get here if threading is turned on, we + * know that we have spinlocks, so the offset is going + * to be ignored. We put 0 here as a valid placeholder. + */ + __db_mutex_init(tmgrp->mutexp, 0); + if (ret != 0) + goto err; + } + + UNLOCK_TXNREGION(tmgrp); + *mgrpp = tmgrp; + return (0); + +err: if (tmgrp->reginfo.addr != NULL) { + if (tmgrp->mutexp != NULL) + __db_shalloc_free(tmgrp->mem, tmgrp->mutexp); + + UNLOCK_TXNREGION(tmgrp); + (void)__db_rdetach(&tmgrp->reginfo); + if (F_ISSET(&tmgrp->reginfo, REGION_CREATED)) + (void)txn_unlink(path, 1, dbenv); + } + + if (tmgrp->reginfo.path != NULL) + FREES(tmgrp->reginfo.path); + FREE(tmgrp, sizeof(*tmgrp)); + return (ret); +} + +/* + * Internally, we use TXN_DETAIL structures, but we allocate and return + * DB_TXN structures that provide access to the transaction ID and the + * offset in the transaction region of the TXN_DETAIL structure. + */ +int +txn_begin(tmgrp, parent, txnpp) + DB_TXNMGR *tmgrp; + DB_TXN *parent; + DB_TXN **txnpp; +{ + DB_LSN begin_lsn; + DB_TXN *retp; + TXN_DETAIL *txnp; + size_t off; + u_int32_t id; + int ret; + + txnp = NULL; + *txnpp = NULL; + + if ((retp = (DB_TXN *)__db_malloc(sizeof(DB_TXN))) == NULL) { + __db_err(tmgrp->dbenv, "txn_begin : %s", strerror(ENOMEM)); + return (ENOMEM); + } + + /* + * We do not have to write begin records (and if we do not, then we + * need never write records for read-only transactions). However, + * we do need to find the current LSN so that we can store it in the + * transaction structure, so we can know where to take checkpoints. + */ + if (tmgrp->dbenv->lg_info != NULL && (ret = + log_put(tmgrp->dbenv->lg_info, &begin_lsn, NULL, DB_CURLSN)) != 0) + goto err2; + + LOCK_TXNREGION(tmgrp); + + /* Make sure that last_txnid is not going to wrap around. */ + if (tmgrp->region->last_txnid == TXN_INVALID) { + __db_err(tmgrp->dbenv, "txn_begin: %s %s", + "Transaction ID wrapping.", + "Snapshot your database and start a new log."); + ret = EINVAL; + goto err1; + } + + if ((ret = __txn_validate_region(tmgrp)) != 0) + goto err1; + + /* Allocate a new transaction detail structure. */ + if ((ret = __db_shalloc(tmgrp->mem, sizeof(TXN_DETAIL), 0, &txnp)) != 0 + && ret == ENOMEM && (ret = __txn_grow_region(tmgrp)) == 0) + ret = __db_shalloc(tmgrp->mem, sizeof(TXN_DETAIL), 0, &txnp); + if (ret != 0) + goto err1; + + /* Place transaction on active transaction list. */ + SH_TAILQ_INSERT_HEAD(&tmgrp->region->active_txn, + txnp, links, __txn_detail); + + id = ++tmgrp->region->last_txnid; + tmgrp->region->nbegins++; + + txnp->txnid = id; + txnp->begin_lsn = begin_lsn; + ZERO_LSN(txnp->last_lsn); + txnp->last_lock = 0; + txnp->status = TXN_RUNNING; + off = (u_int8_t *)txnp - (u_int8_t *)tmgrp->region; + UNLOCK_TXNREGION(tmgrp); + + ZERO_LSN(retp->last_lsn); + retp->txnid = id; + retp->parent = parent; + retp->mgrp = tmgrp; + retp->off = off; + + LOCK_TXNTHREAD(tmgrp); + TAILQ_INSERT_TAIL(&tmgrp->txn_chain, retp, links); + UNLOCK_TXNTHREAD(tmgrp); + + *txnpp = retp; + return (0); + +err1: UNLOCK_TXNREGION(tmgrp); + +err2: __db_free(retp); + return (ret); +} + +/* + * txn_commit -- + * Commit a transaction. + */ +int +txn_commit(txnp) + DB_TXN *txnp; +{ + DB_LOG *logp; + int ret; + + if ((ret = __txn_check_running(txnp)) != 0) + return (ret); + + /* + * If there are any log records, write a log record and sync + * the log, else do no log writes. + */ + if ((logp = txnp->mgrp->dbenv->lg_info) != NULL && + !IS_ZERO_LSN(txnp->last_lsn) && + (ret = __txn_regop_log(logp, txnp, &txnp->last_lsn, + F_ISSET(txnp->mgrp, DB_TXN_NOSYNC) ? 0 : DB_FLUSH, + TXN_COMMIT)) != 0) + return (ret); + + return (__txn_end(txnp, 1)); +} + +/* + * txn_abort -- + * Abort a transcation. + */ +int +txn_abort(txnp) + DB_TXN *txnp; +{ + int ret; + + if ((ret = __txn_check_running(txnp)) != 0) + return (ret); + + if ((ret = __txn_undo(txnp)) != 0) { + __db_err(txnp->mgrp->dbenv, + "txn_abort: Log undo failed %s", strerror(ret)); + return (ret); + } + return (__txn_end(txnp, 0)); +} + +/* + * Flush the log so a future commit is guaranteed to succeed. + */ +int +txn_prepare(txnp) + DB_TXN *txnp; +{ + TXN_DETAIL *tp; + int ret; + + if ((ret = __txn_check_running(txnp)) != 0) + return (ret); + + if (txnp->mgrp->dbenv->lg_info != NULL) { + if ((ret = log_flush(txnp->mgrp->dbenv->lg_info, + &txnp->last_lsn)) != 0) + __db_err(txnp->mgrp->dbenv, + "txn_prepare: log_flush failed %s\n", + strerror(ret)); + return (ret); + } + + LOCK_TXNTHREAD(txnp->mgrp); + tp = (TXN_DETAIL *)((u_int8_t *)txnp->mgrp->region + txnp->off); + tp->status = TXN_PREPARED; + UNLOCK_TXNTHREAD(txnp->mgrp); + return (ret); +} + +/* + * Return the transaction ID associated with a particular transaction + */ +u_int32_t +txn_id(txnp) + DB_TXN *txnp; +{ + return (txnp->txnid); +} + +/* + * txn_close -- + * Close the transaction region, does not imply a checkpoint. + */ +int +txn_close(tmgrp) + DB_TXNMGR *tmgrp; +{ + DB_TXN *txnp; + int ret, t_ret; + + ret = 0; + + /* + * This function had better only be called once per process + * (i.e., not per thread), so there should be no synchronization + * required. + */ + while ((txnp = + TAILQ_FIRST(&tmgrp->txn_chain)) != TAILQ_END(&tmgrp->txn_chain)) + if ((t_ret = txn_abort(txnp)) != 0) { + __txn_end(txnp, 0); + if (ret == 0) + ret = t_ret; + } + + if (tmgrp->dbenv->lg_info && + (t_ret = log_flush(tmgrp->dbenv->lg_info, NULL)) != 0 && ret == 0) + ret = t_ret; + + if (tmgrp->mutexp != NULL) { + LOCK_TXNREGION(tmgrp); + __db_shalloc_free(tmgrp->mem, tmgrp->mutexp); + UNLOCK_TXNREGION(tmgrp); + } + + if ((t_ret = __db_rdetach(&tmgrp->reginfo)) != 0 && ret == 0) + ret = t_ret; + + if (tmgrp->reginfo.path != NULL) + FREES(tmgrp->reginfo.path); + FREE(tmgrp, sizeof(*tmgrp)); + + return (ret); +} + +/* + * txn_unlink -- + * Remove the transaction region. + */ +int +txn_unlink(path, force, dbenv) + const char *path; + int force; + DB_ENV *dbenv; +{ + REGINFO reginfo; + int ret; + + memset(®info, 0, sizeof(reginfo)); + reginfo.dbenv = dbenv; + reginfo.appname = DB_APP_NONE; + if (path != NULL && (reginfo.path = (char *)__db_strdup(path)) == NULL) + return (ENOMEM); + reginfo.file = DEFAULT_TXN_FILE; + ret = __db_runlink(®info, force); + if (reginfo.path != NULL) + FREES(reginfo.path); + return (ret); +} + +/* Internal routines. */ + +/* + * Return 0 if the txnp is reasonable, otherwise returns EINVAL. + */ +static int +__txn_check_running(txnp) + const DB_TXN *txnp; +{ + TXN_DETAIL *tp; + + tp = NULL; + if (txnp != NULL && txnp->mgrp != NULL && txnp->mgrp->region != NULL) { + tp = (TXN_DETAIL *)((u_int8_t *)txnp->mgrp->region + txnp->off); + if (tp->status != TXN_RUNNING) + tp = NULL; + } + + return (tp == NULL ? EINVAL : 0); +} + +static int +__txn_end(txnp, is_commit) + DB_TXN *txnp; + int is_commit; +{ + DB_TXNMGR *mgr; + TXN_DETAIL *tp; + DB_LOCKREQ request; + int ret; + u_int32_t locker; + + mgr = txnp->mgrp; + + LOCK_TXNTHREAD(mgr); + TAILQ_REMOVE(&mgr->txn_chain, txnp, links); + UNLOCK_TXNTHREAD(mgr); + + /* Release the locks. */ + locker = txnp->txnid; + request.op = DB_LOCK_PUT_ALL; + + if (mgr->dbenv->lk_info) { + ret = lock_vec(mgr->dbenv->lk_info, locker, 0, + &request, 1, NULL); + if (ret != 0 && (ret != DB_LOCK_DEADLOCK || is_commit)) { + __db_err(mgr->dbenv, "%s: release locks failed %s", + is_commit ? "txn_commit" : "txn_abort", + strerror(ret)); + return (ret); + } + } + + /* End the transaction. */ + LOCK_TXNREGION(mgr); + tp = (TXN_DETAIL *)((u_int8_t *)mgr->region + txnp->off); + SH_TAILQ_REMOVE(&mgr->region->active_txn, tp, links, __txn_detail); + __db_shalloc_free(mgr->mem, tp); + if (is_commit) + mgr->region->ncommits++; + else + mgr->region->naborts++; + UNLOCK_TXNREGION(mgr); + + FREE(txnp, sizeof(*txnp)); + + return (0); +} + + +/* + * __txn_undo -- + * Undo the transaction with id txnid. Returns 0 on success and + * errno on failure. + */ +static int +__txn_undo(txnp) + DB_TXN *txnp; +{ + DBT rdbt; + DB_LOG *logp; + DB_LSN key_lsn; + DB_TXNMGR *mgr; + int ret; + + mgr = txnp->mgrp; + logp = mgr->dbenv->lg_info; + if (logp == NULL) + return (0); + + /* + * This is the simplest way to code this, but if the mallocs during + * recovery turn out to be a performance issue, we can do the + * allocation here and use DB_DBT_USERMEM. + */ + memset(&rdbt, 0, sizeof(rdbt)); + if (F_ISSET(logp, DB_AM_THREAD)) + F_SET(&rdbt, DB_DBT_MALLOC); + + key_lsn = txnp->last_lsn; /* structure assignment */ + for (ret = 0; ret == 0 && !IS_ZERO_LSN(key_lsn);) { + /* + * The dispatch routine returns the lsn of the record + * before the current one in the key_lsn argument. + */ + if ((ret = log_get(logp, &key_lsn, &rdbt, DB_SET)) == 0) { + ret = + mgr->recover(logp, &rdbt, &key_lsn, TXN_UNDO, NULL); + if (F_ISSET(logp, DB_AM_THREAD) && rdbt.data != NULL) { + __db_free(rdbt.data); + rdbt.data = NULL; + } + } + if (ret != 0) + return (ret); + } + + return (ret); +} + +/* + * Transaction checkpoint. + * If either kbytes or minutes is non-zero, then we only take the checkpoint + * more than "minutes" minutes have passed since the last checkpoint or if + * more than "kbytes" of log data have been written since the last checkpoint. + * When taking a checkpoint, find the oldest active transaction and figure out + * its first LSN. This is the lowest LSN we can checkpoint, since any record + * written after since that point may be involved in a transaction and may + * therefore need to be undone in the case of an abort. + */ +int +txn_checkpoint(mgr, kbytes, minutes) + const DB_TXNMGR *mgr; + u_int32_t kbytes, minutes; +{ + TXN_DETAIL *txnp; + DB_LSN ckp_lsn, last_ckp; + DB_LOG *dblp; + u_int32_t kbytes_written; + time_t last_ckp_time, now; + int ret; + + /* + * Check if we need to run recovery. + */ + ZERO_LSN(ckp_lsn); + if (minutes != 0) { + (void)time(&now); + + LOCK_TXNREGION(mgr); + last_ckp_time = mgr->region->time_ckp; + UNLOCK_TXNREGION(mgr); + + if (now - last_ckp_time >= (time_t)(minutes * 60)) + goto do_ckp; + } + + if (kbytes != 0) { + dblp = mgr->dbenv->lg_info; + LOCK_LOGREGION(dblp); + kbytes_written = + dblp->lp->stat.st_wc_mbytes * 1024 + + dblp->lp->stat.st_wc_bytes / 1024; + ckp_lsn = dblp->lp->lsn; + UNLOCK_LOGREGION(dblp); + if (kbytes_written >= (u_int32_t)kbytes) + goto do_ckp; + } + + /* + * If we checked time and data and didn't go to checkpoint, + * we're done. + */ + if (minutes != 0 || kbytes != 0) + return (0); + +do_ckp: + if (IS_ZERO_LSN(ckp_lsn)) { + dblp = mgr->dbenv->lg_info; + LOCK_LOGREGION(dblp); + ckp_lsn = dblp->lp->lsn; + UNLOCK_LOGREGION(dblp); + } + + /* + * We have to find an LSN such that all transactions begun + * before that LSN are complete. + */ + LOCK_TXNREGION(mgr); + + if (!IS_ZERO_LSN(mgr->region->pending_ckp)) + ckp_lsn = mgr->region->pending_ckp; + else + for (txnp = + SH_TAILQ_FIRST(&mgr->region->active_txn, __txn_detail); + txnp != NULL; + txnp = SH_TAILQ_NEXT(txnp, links, __txn_detail)) { + + /* + * Look through the active transactions for the + * lowest begin lsn. + */ + if (!IS_ZERO_LSN(txnp->begin_lsn) && + log_compare(&txnp->begin_lsn, &ckp_lsn) < 0) + ckp_lsn = txnp->begin_lsn; + } + + mgr->region->pending_ckp = ckp_lsn; + UNLOCK_TXNREGION(mgr); + + if (mgr->dbenv->mp_info != NULL && + (ret = memp_sync(mgr->dbenv->mp_info, &ckp_lsn)) != 0) { + /* + * ret == DB_INCOMPLETE means that there are still buffers to + * flush, the checkpoint is not complete. Wait and try again. + */ + if (ret > 0) + __db_err(mgr->dbenv, + "txn_checkpoint: system failure in memp_sync %s\n", + strerror(ret)); + return (ret); + } + if (mgr->dbenv->lg_info != NULL) { + LOCK_TXNREGION(mgr); + last_ckp = mgr->region->last_ckp; + ZERO_LSN(mgr->region->pending_ckp); + UNLOCK_TXNREGION(mgr); + + if ((ret = __txn_ckp_log(mgr->dbenv->lg_info, + NULL, &ckp_lsn, DB_CHECKPOINT, &ckp_lsn, &last_ckp)) != 0) { + __db_err(mgr->dbenv, + "txn_checkpoint: log failed at LSN [%ld %ld] %s\n", + (long)ckp_lsn.file, (long)ckp_lsn.offset, + strerror(ret)); + return (ret); + } + + LOCK_TXNREGION(mgr); + mgr->region->last_ckp = ckp_lsn; + (void)time(&mgr->region->time_ckp); + UNLOCK_TXNREGION(mgr); + } + return (0); +} + +/* + * __txn_validate_region -- + * Called at every interface to verify if the region has changed size, + * and if so, to remap the region in and reset the process' pointers. + */ +static int +__txn_validate_region(tp) + DB_TXNMGR *tp; +{ + int ret; + + if (tp->reginfo.size == tp->region->hdr.size) + return (0); + + /* Detach/reattach the region. */ + if ((ret = __db_rreattach(&tp->reginfo, tp->region->hdr.size)) != 0) + return (ret); + + /* Reset region information. */ + tp->region = tp->reginfo.addr; + tp->mem = &tp->region[1]; + + return (0); +} + +static int +__txn_grow_region(tp) + DB_TXNMGR *tp; +{ + size_t incr, oldsize; + u_int32_t mutex_offset, oldmax; + u_int8_t *curaddr; + int ret; + + oldmax = tp->region->maxtxns; + incr = oldmax * sizeof(DB_TXN); + mutex_offset = tp->mutexp != NULL ? + (u_int8_t *)tp->mutexp - (u_int8_t *)tp->region : 0; + + oldsize = tp->reginfo.size; + if ((ret = __db_rgrow(&tp->reginfo, oldsize + incr)) != 0) + return (ret); + tp->region = tp->reginfo.addr; + + /* Throw the new space on the free list. */ + curaddr = (u_int8_t *)tp->region + oldsize; + tp->mem = &tp->region[1]; + tp->mutexp = mutex_offset != 0 ? + (db_mutex_t *)((u_int8_t *)tp->region + mutex_offset) : NULL; + + *((size_t *)curaddr) = incr - sizeof(size_t); + curaddr += sizeof(size_t); + __db_shalloc_free(tp->mem, curaddr); + + tp->region->maxtxns = 2 * oldmax; + + return (0); +} + +int +txn_stat(mgr, statp, db_malloc) + DB_TXNMGR *mgr; + DB_TXN_STAT **statp; + void *(*db_malloc) __P((size_t)); +{ + DB_TXN_STAT *stats; + TXN_DETAIL *txnp; + size_t nbytes; + u_int32_t nactive, ndx; + + LOCK_TXNREGION(mgr); + nactive = mgr->region->nbegins - + mgr->region->naborts - mgr->region->ncommits; + UNLOCK_TXNREGION(mgr); + + /* + * Allocate a bunch of extra active structures to handle any + * that have been created since we unlocked the region. + */ + nbytes = sizeof(DB_TXN_STAT) + sizeof(DB_TXN_ACTIVE) * (nactive + 200); + if (db_malloc == NULL) + stats = (DB_TXN_STAT *)__db_malloc(nbytes); + else + stats = (DB_TXN_STAT *)db_malloc(nbytes); + + if (stats == NULL) + return (ENOMEM); + + LOCK_TXNREGION(mgr); + stats->st_last_txnid = mgr->region->last_txnid; + stats->st_last_ckp = mgr->region->last_ckp; + stats->st_maxtxns = mgr->region->maxtxns; + stats->st_naborts = mgr->region->naborts; + stats->st_nbegins = mgr->region->nbegins; + stats->st_ncommits = mgr->region->ncommits; + stats->st_pending_ckp = mgr->region->pending_ckp; + stats->st_time_ckp = mgr->region->time_ckp; + stats->st_nactive = stats->st_nbegins - + stats->st_naborts - stats->st_ncommits; + if (stats->st_nactive > nactive + 200) + stats->st_nactive = nactive + 200; + stats->st_txnarray = (DB_TXN_ACTIVE *)&stats[1]; + + ndx = 0; + for (txnp = SH_TAILQ_FIRST(&mgr->region->active_txn, __txn_detail); + txnp != NULL; + txnp = SH_TAILQ_NEXT(txnp, links, __txn_detail)) { + stats->st_txnarray[ndx].txnid = txnp->txnid; + stats->st_txnarray[ndx].lsn = txnp->begin_lsn; + ndx++; + + if (ndx >= stats->st_nactive) + break; + } + + stats->st_region_wait = mgr->region->hdr.lock.mutex_set_wait; + stats->st_region_nowait = mgr->region->hdr.lock.mutex_set_nowait; + stats->st_refcnt = mgr->region->hdr.refcnt; + stats->st_regsize = mgr->region->hdr.size; + + UNLOCK_TXNREGION(mgr); + *statp = stats; + return (0); +} diff --git a/mozilla/db/txn/txn.src b/mozilla/db/txn/txn.src new file mode 100644 index 00000000000..04809b69d6a --- /dev/null +++ b/mozilla/db/txn/txn.src @@ -0,0 +1,29 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + * + * @(#)txn.src 10.3 (Sleepycat) 4/10/98 + */ + +PREFIX txn + +/* + * Everything except for checkpointing takes the same logging routine. + */ +BEGIN regop +ARG opcode u_int32_t lu +END + +/* + * This is the checkpoint record. It contains the lsn that the checkpoint + * guarantees and a pointer to the last checkpoint so that we can walk + * backwards by checkpoint. + * ckp_lsn: + * last_ckp: + */ +BEGIN ckp +POINTER ckp_lsn DB_LSN * lu +POINTER last_ckp DB_LSN * lu +END diff --git a/mozilla/db/txn/txn_auto.c b/mozilla/db/txn/txn_auto.c new file mode 100644 index 00000000000..f03a52991f3 --- /dev/null +++ b/mozilla/db/txn/txn_auto.c @@ -0,0 +1,306 @@ +/* Do not edit: automatically built by dist/db_gen.sh. */ +#include "config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include +#include +#include +#include +#include +#endif + +#include "db_int.h" +#include "shqueue.h" +#include "db_page.h" +#include "db_dispatch.h" +#include "txn.h" +#include "db_am.h" +/* + * PUBLIC: int __txn_regop_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: u_int32_t)); + */ +int __txn_regop_log(logp, txnid, ret_lsnp, flags, + opcode) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + u_int32_t opcode; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_txn_regop; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(opcode); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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); + memcpy(bp, &opcode, sizeof(opcode)); + bp += sizeof(opcode); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __txn_regop_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__txn_regop_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __txn_regop_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __txn_regop_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]txn_regop: 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); + printf("\topcode: %lu\n", (u_long)argp->opcode); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __txn_regop_read __P((void *, __txn_regop_args **)); + */ +int +__txn_regop_read(recbuf, argpp) + void *recbuf; + __txn_regop_args **argpp; +{ + __txn_regop_args *argp; + u_int8_t *bp; + + argp = (__txn_regop_args *)__db_malloc(sizeof(__txn_regop_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->opcode, bp, sizeof(argp->opcode)); + bp += sizeof(argp->opcode); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __txn_ckp_log + * PUBLIC: __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, + * PUBLIC: DB_LSN *, DB_LSN *)); + */ +int __txn_ckp_log(logp, txnid, ret_lsnp, flags, + ckp_lsn, last_ckp) + DB_LOG *logp; + DB_TXN *txnid; + DB_LSN *ret_lsnp; + u_int32_t flags; + DB_LSN * ckp_lsn; + DB_LSN * last_ckp; +{ + DBT logrec; + DB_LSN *lsnp, null_lsn; + u_int32_t rectype, txn_num; + int ret; + u_int8_t *bp; + + rectype = DB_txn_ckp; + txn_num = txnid == NULL ? 0 : txnid->txnid; + if (txnid == NULL) { + null_lsn.file = 0; + null_lsn.offset = 0; + lsnp = &null_lsn; + } else + lsnp = &txnid->last_lsn; + logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN) + + sizeof(*ckp_lsn) + + sizeof(*last_ckp); + if ((logrec.data = (void *)__db_malloc(logrec.size)) == NULL) + return (ENOMEM); + + 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 (ckp_lsn != NULL) + memcpy(bp, ckp_lsn, sizeof(*ckp_lsn)); + else + memset(bp, 0, sizeof(*ckp_lsn)); + bp += sizeof(*ckp_lsn); + if (last_ckp != NULL) + memcpy(bp, last_ckp, sizeof(*last_ckp)); + else + memset(bp, 0, sizeof(*last_ckp)); + bp += sizeof(*last_ckp); +#ifdef DIAGNOSTIC + if ((u_int32_t)(bp - (u_int8_t *)logrec.data) != logrec.size) + fprintf(stderr, "Error in log record length"); +#endif + ret = log_put(logp, ret_lsnp, (DBT *)&logrec, flags); + if (txnid != NULL) + txnid->last_lsn = *ret_lsnp; + __db_free(logrec.data); + return (ret); +} + +/* + * PUBLIC: int __txn_ckp_print + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__txn_ckp_print(notused1, dbtp, lsnp, notused2, notused3) + DB_LOG *notused1; + DBT *dbtp; + DB_LSN *lsnp; + int notused2; + void *notused3; +{ + __txn_ckp_args *argp; + u_int32_t i; + u_int ch; + int ret; + + i = 0; + ch = 0; + notused1 = NULL; + notused2 = 0; + notused3 = NULL; + + if ((ret = __txn_ckp_read(dbtp->data, &argp)) != 0) + return (ret); + printf("[%lu][%lu]txn_ckp: 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); + printf("\tckp_lsn: [%lu][%lu]\n", + (u_long)argp->ckp_lsn.file, (u_long)argp->ckp_lsn.offset); + printf("\tlast_ckp: [%lu][%lu]\n", + (u_long)argp->last_ckp.file, (u_long)argp->last_ckp.offset); + printf("\n"); + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __txn_ckp_read __P((void *, __txn_ckp_args **)); + */ +int +__txn_ckp_read(recbuf, argpp) + void *recbuf; + __txn_ckp_args **argpp; +{ + __txn_ckp_args *argp; + u_int8_t *bp; + + argp = (__txn_ckp_args *)__db_malloc(sizeof(__txn_ckp_args) + + sizeof(DB_TXN)); + if (argp == 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); + memcpy(&argp->ckp_lsn, bp, sizeof(argp->ckp_lsn)); + bp += sizeof(argp->ckp_lsn); + memcpy(&argp->last_ckp, bp, sizeof(argp->last_ckp)); + bp += sizeof(argp->last_ckp); + *argpp = argp; + return (0); +} + +/* + * PUBLIC: int __txn_init_print __P((DB_ENV *)); + */ +int +__txn_init_print(dbenv) + DB_ENV *dbenv; +{ + int ret; + + if ((ret = __db_add_recovery(dbenv, + __txn_regop_print, DB_txn_regop)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __txn_ckp_print, DB_txn_ckp)) != 0) + return (ret); + return (0); +} + +/* + * PUBLIC: int __txn_init_recover __P((DB_ENV *)); + */ +int +__txn_init_recover(dbenv) + DB_ENV *dbenv; +{ + int ret; + + if ((ret = __db_add_recovery(dbenv, + __txn_regop_recover, DB_txn_regop)) != 0) + return (ret); + if ((ret = __db_add_recovery(dbenv, + __txn_ckp_recover, DB_txn_ckp)) != 0) + return (ret); + return (0); +} + diff --git a/mozilla/db/txn/txn_rec.c b/mozilla/db/txn/txn_rec.c new file mode 100644 index 00000000000..e53dc5f3b70 --- /dev/null +++ b/mozilla/db/txn/txn_rec.c @@ -0,0 +1,136 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1996, 1997, 1998 + * Sleepycat Software. All rights reserved. + */ +/* + * Copyright (c) 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. 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 "config.h" + +#ifndef lint +static const char sccsid[] = "@(#)txn_rec.c 10.11 (Sleepycat) 5/3/98"; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include + +#include +#endif + +#include "db_int.h" +#include "db_page.h" +#include "shqueue.h" +#include "txn.h" +#include "db_am.h" + +/* + * PUBLIC: int __txn_regop_recover + * PUBLIC: __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__txn_regop_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __txn_regop_args *argp; + int ret; + +#ifdef DEBUG_RECOVER + (void)__txn_regop_print(logp, dbtp, lsnp, redo, info); +#endif + COMPQUIET(redo, 0); + COMPQUIET(logp, NULL); + + if ((ret = __txn_regop_read(dbtp->data, &argp)) != 0) + return (ret); + + switch (argp->opcode) { + case TXN_COMMIT: + if (__db_txnlist_find(info, + argp->txnid->txnid) == DB_NOTFOUND) + __db_txnlist_add(info, argp->txnid->txnid); + break; + case TXN_PREPARE: /* Nothing to do. */ + /* Call __db_txnlist_find so that we update the maxid. */ + (void)__db_txnlist_find(info, argp->txnid->txnid); + break; + default: + ret = EINVAL; + break; + } + + *lsnp = argp->prev_lsn; + __db_free(argp); + return (0); +} + +/* + * PUBLIC: int __txn_ckp_recover __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); + */ +int +__txn_ckp_recover(logp, dbtp, lsnp, redo, info) + DB_LOG *logp; + DBT *dbtp; + DB_LSN *lsnp; + int redo; + void *info; +{ + __txn_ckp_args *argp; + int ret; + +#ifdef DEBUG_RECOVER + __txn_ckp_print(logp, dbtp, lsnp, redo, info); +#endif + COMPQUIET(logp, NULL); + + if ((ret = __txn_ckp_read(dbtp->data, &argp)) != 0) + return (ret); + + /* + * Check for 'restart' checkpoint record. This occurs when the + * checkpoint lsn is equal to the lsn of the checkpoint record + * and means that we could set the transaction ID back to 1, so + * that we don't exhaust the transaction ID name space. + */ + if (argp->ckp_lsn.file == lsnp->file && + argp->ckp_lsn.offset == lsnp->offset) + __db_txnlist_gen(info, redo ? -1 : 1); + *lsnp = argp->last_ckp; + __db_free(argp); + return (DB_TXN_CKP); +}