diff --git a/include/db.h b/include/db.h index 2b4372697e47..f48c4e648f93 100644 --- a/include/db.h +++ b/include/db.h @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)db.h 5.21 (Berkeley) 2/14/93 + * @(#)db.h 5.25 (Berkeley) 5/22/93 */ #ifndef _DB_H_ @@ -59,7 +59,7 @@ typedef struct { /* Routine flags. */ #define R_CURSOR 1 /* del, put, seq */ -#define R_CURSORLOG 2 /* put (RECNO) */ +#define __R_UNUSED 2 /* UNUSED */ #define R_FIRST 3 /* seq */ #define R_IAFTER 4 /* put (RECNO) */ #define R_IBEFORE 5 /* put (RECNO) */ @@ -68,6 +68,7 @@ typedef struct { #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; @@ -79,10 +80,11 @@ typedef struct __db { DBTYPE type; /* underlying db type */ int (*close) __P((struct __db *)); int (*del) __P((const struct __db *, const DBT *, u_int)); + int (*fd) __P((const struct __db *)); 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 *)); + int (*sync) __P((const struct __db *, u_int)); void *internal; /* access method private */ } DB; @@ -92,15 +94,15 @@ typedef struct __db { /* Structure used to pass parameters to the btree routines. */ typedef struct { #define R_DUP 0x01 /* duplicate keys */ - u_long flags; - int cachesize; /* bytes to cache */ - int maxkeypage; /* maximum keys per page */ - int minkeypage; /* minimum keys per page */ - int psize; /* page size */ + u_long flags; + int cachesize; /* bytes to cache */ + int maxkeypage; /* maximum keys per page */ + int minkeypage; /* minimum keys per page */ + int psize; /* page size */ /* comparison, prefix functions */ - int (*compare) __P((const DBT *, const DBT *)); - int (*prefix) __P((const DBT *, const DBT *)); - int lorder; /* byte order */ + int (*compare) __P((const DBT *, const DBT *)); + int (*prefix) __P((const DBT *, const DBT *)); + int lorder; /* byte order */ } BTREEINFO; #define HASHMAGIC 0x061561 @@ -108,12 +110,13 @@ typedef struct { /* Structure used to pass parameters to the hashing routines. */ typedef struct { - int bsize; /* bucket size */ - int ffactor; /* fill factor */ - int nelem; /* number of elements */ - int cachesize; /* bytes to cache */ - int (*hash)(); /* hash function */ - int lorder; /* byte order */ + int bsize; /* bucket size */ + int ffactor; /* fill factor */ + int nelem; /* number of elements */ + int cachesize; /* bytes to cache */ + /* hash function */ + int (*hash) __P((const void *, size_t)); + int lorder; /* byte order */ } HASHINFO; /* Structure used to pass parameters to the record routines. */ @@ -121,33 +124,41 @@ typedef struct { #define R_FIXEDLEN 0x01 /* fixed-length records */ #define R_NOKEY 0x02 /* key not required */ #define R_SNAPSHOT 0x04 /* snapshot the input */ - u_long flags; - int cachesize; /* bytes to cache */ - int lorder; /* byte order */ - size_t reclen; /* record length (fixed-length records) */ - u_char bval; /* delimiting byte (variable-length records */ + u_long flags; + int cachesize; /* bytes to cache */ + int 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; -/* Key structure for the record routines. */ -typedef struct { - u_long number; - u_long offset; - u_long length; -#define R_LENGTH 0x01 /* length is valid */ -#define R_NUMBER 0x02 /* record number is valid */ -#define R_OFFSET 0x04 /* offset is valid */ - u_char valid; -} RECNOKEY; - /* * Little endian <==> big endian long swap macros. * BLSWAP swap a memory location * BLPSWAP swap a referenced memory location * BLSWAP_COPY swap from one location to another */ -#define BLSWAP(a) { a = __byte_swap_long(a); } -#define BLPSWAP(a) BLSWAP((*a)) -#define BLSWAP_COPY(a, b) { b = __byte_swap_long(a); } +#define BLSWAP(a) { \ + u_long _tmp = a; \ + ((char *)&a)[0] = ((char *)&_tmp)[3]; \ + ((char *)&a)[1] = ((char *)&_tmp)[2]; \ + ((char *)&a)[2] = ((char *)&_tmp)[1]; \ + ((char *)&a)[3] = ((char *)&_tmp)[0]; \ +} +#define BLPSWAP(a) { \ + u_long _tmp = *(u_long *)a; \ + ((char *)a)[0] = ((char *)&_tmp)[3]; \ + ((char *)a)[1] = ((char *)&_tmp)[2]; \ + ((char *)a)[2] = ((char *)&_tmp)[1]; \ + ((char *)a)[3] = ((char *)&_tmp)[0]; \ +} +#define BLSWAP_COPY(a, b) { \ + ((char *)&(b))[0] = ((char *)&(a))[3]; \ + ((char *)&(b))[1] = ((char *)&(a))[2]; \ + ((char *)&(b))[2] = ((char *)&(a))[1]; \ + ((char *)&(b))[3] = ((char *)&(a))[0]; \ +} /* * Little endian <==> big endian short swap macros. @@ -155,9 +166,20 @@ typedef struct { * BSPSWAP swap a referenced memory location * BSSWAP_COPY swap from one location to another */ -#define BSSWAP(a) { a = __byte_swap_word(a); } -#define BSPSWAP(a) BSSWAP((*a)) -#define BSSWAP_COPY(a, b) { b = __byte_swap_word(a); } +#define BSSWAP(a) { \ + u_short _tmp = a; \ + ((char *)&a)[0] = ((char *)&_tmp)[1]; \ + ((char *)&a)[1] = ((char *)&_tmp)[0]; \ +} +#define BSPSWAP(a) { \ + u_short _tmp = *(u_short *)a; \ + ((char *)a)[0] = ((char *)&_tmp)[1]; \ + ((char *)a)[1] = ((char *)&_tmp)[0]; \ +} +#define BSSWAP_COPY(a, b) { \ + ((char *)&(b))[0] = ((char *)&(a))[1]; \ + ((char *)&(b))[1] = ((char *)&(a))[0]; \ +} __BEGIN_DECLS DB *dbopen __P((const char *, int, int, DBTYPE, const void *)); diff --git a/include/mpool.h b/include/mpool.h index 6358549444cf..16c6d129b0da 100644 --- a/include/mpool.h +++ b/include/mpool.h @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)mpool.h 5.2 (Berkeley) 2/14/93 + * @(#)mpool.h 5.3 (Berkeley) 5/20/93 */ /* @@ -73,7 +73,7 @@ typedef struct MPOOL { pgno_t curcache; /* Current number of cached pages. */ pgno_t maxcache; /* Max number of cached pages. */ pgno_t npages; /* Number of pages in the file. */ - indx_t pagesize; /* File page size. */ + u_long pagesize; /* File page size. */ int fd; /* File descriptor. */ /* Page in conversion routine. */ void (*pgin) __P((void *, pgno_t, void *)); diff --git a/lib/libc/DB/Makefile.inc b/lib/libc/DB/Makefile.inc index 77c51ed7496f..7a1ac5d36b1a 100644 --- a/lib/libc/DB/Makefile.inc +++ b/lib/libc/DB/Makefile.inc @@ -1,8 +1,8 @@ -# @(#)Makefile 5.6 (Berkeley) 2/15/93 - +# @(#)Makefile.inc 5.3 (Berkeley) 9/4/91 +# .include "${.CURDIR}/DB/btree/Makefile.inc" -.include "${.CURDIR}/DB/hash/Makefile.inc" .include "${.CURDIR}/DB/db/Makefile.inc" +.include "${.CURDIR}/DB/hash/Makefile.inc" +.include "${.CURDIR}/DB/man/Makefile.inc" .include "${.CURDIR}/DB/mpool/Makefile.inc" .include "${.CURDIR}/DB/recno/Makefile.inc" -.include "${.CURDIR}/DB/man/Makefile.inc" diff --git a/lib/libc/DB/README b/lib/libc/DB/README index 25c50024fc56..e9796d598375 100644 --- a/lib/libc/DB/README +++ b/lib/libc/DB/README @@ -1,39 +1 @@ -# @(#)README 5.2 (Berkeley) 2/14/93 - -This is the directory to use for creating a library of the dbopen(3) -routines. The Makefile builds the base system. By changing it and -the compat.h file, you should be able to pick and choose the various -things your system needs to make libdb run. - -The knobs that you may have to turn: - -In the Makefile: - If you don't have mktemp or mkstemp on your system, add - "mktemp.o" to the COMP list. - -In include/compat.h: - Before attempting to build this library, you should skim through - the compat.h file, and adjust it as necessary for your system. - It's possible to use the #ifndef construct to figure out if a - #ifdef has been set, but C provides no similar method to figure - out if a typedef has been done. All of the typedef's are grouped - at the top of compat.h, your compile errors will tell you which - ones you need. - -Some other problems: - You may see warning messages about illegal pointer combinations. - It's because systems prototype malloc, calloc and realloc in - different places. If you want to stop the warnings, find out - where your system prototypes them, and include it in compat.h, - or, just prototype them yourself. - - The dbopen(3) routines also use the snprintf(3) function. If - you don't have this function, change the snprintf() call in - btree/bt_open.c:tmp() from snprintf() to sprintf(), making sure - to delete the SECOND argument, the size of the buffer. - -To install: - Programs using the dbopen(3) interface have to include db.h. - To install the library, you'll need to put db.h (found in the - directory PORT/include) and the library libdb.a in some place - accesible to your program. +(was symlink to VERSION. -- cgd) diff --git a/lib/libc/DB/VERSION b/lib/libc/DB/VERSION index a6b6d858c2ef..19d5477045d0 100644 --- a/lib/libc/DB/VERSION +++ b/lib/libc/DB/VERSION @@ -1,7 +1,47 @@ -# @(#)VERSION 5.3 (Berkeley) 3/19/93 +# @(#)VERSION 5.8 (Berkeley) 5/24/93 -This is version 1.1 of the Berkeley DB code. +This is version 1.5 of the Berkeley DB code. -If your version of the DB code doesn't have -a copy of this version file, it's really old, -please update it! +If your version of the DB code doesn't have a copy of +this version file, it's really old, please update it! + +============================================ +1.4 -> 1.5 23 May 1993 + hash: Set hash default fill factor dynamically. + recno: Fixed bug in sorted page splits. + Add page size parameter support. + Allow recno to specify the name of the underlying btree; + used for vi recovery. + btree/recno: + Support 64K pages. + btree/hash/recno: + Provide access to an underlying file descriptor. + Change sync routines to take a flag argument, recno + uses this to sync out the underlying btree. + +1.3 -> 1.4 10 May 1993 + recno: Delete the R_CURSORLOG flag from the recno interface. + Zero-length record fix for non-mmap reads. + Try and make SIZE_T_MAX test in open portable. + +1.2 -> 1.3 1 May 1993 + btree: Ignore user byte-order setting when reading already + existing database. Fixes to byte-order conversions. + +1.1 -> 1.2 15 Apr 1993 + No bug fixes, only compatibility hacks. +============================================ + +Distribution contents: + Makefile.inc Ignore this, it's Berkeley's internal Makefile. + PORT The directory to build in. + README This file. + VERSION This file. + btree B+tree routines. + db Dbopen(3) interface routine. + doc USENIX papers. + hash Extended linear hashing routines. + man Man pages. + mpool Memory pool routines. + recno Fixed/variable length routines. + test Test package. diff --git a/lib/libc/DB/btree/bt_close.c b/lib/libc/DB/btree/bt_close.c index f13e45898be4..894bf4c104fe 100644 --- a/lib/libc/DB/btree/bt_close.c +++ b/lib/libc/DB/btree/bt_close.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)bt_close.c 5.10 (Berkeley) 2/16/93"; +static char sccsid[] = "@(#)bt_close.c 5.12 (Berkeley) 5/16/93"; #endif /* LIBC_SCCS and not lint */ #include @@ -73,10 +73,10 @@ __bt_close(dbp) * Delete any already deleted record that we've been saving * because the cursor pointed to it. */ - if (ISSET(t, BTF_DELCRSR) && __bt_crsrdel(t, &t->bt_bcursor)) + if (ISSET(t, B_DELCRSR) && __bt_crsrdel(t, &t->bt_bcursor)) return (RET_ERROR); - if (__bt_sync(dbp) == RET_ERROR) + if (__bt_sync(dbp, 0) == RET_ERROR) return (RET_ERROR); if (mpool_close(t->bt_mp) == RET_ERROR) @@ -105,20 +105,26 @@ __bt_close(dbp) * RET_SUCCESS, RET_ERROR. */ int -__bt_sync(dbp) +__bt_sync(dbp, flags) const DB *dbp; + u_int flags; { BTREE *t; int status; PAGE *h; void *p; + if (flags != 0) { + errno = EINVAL; + return (RET_ERROR); + } + t = dbp->internal; - if (ISSET(t, BTF_INMEM | BTF_RDONLY) || !ISSET(t, BTF_MODIFIED)) + if (ISSET(t, B_INMEM | B_RDONLY) || !ISSET(t, B_MODIFIED)) return (RET_SUCCESS); - if (ISSET(t, BTF_METADIRTY) && bt_meta(t) == RET_ERROR) + if (ISSET(t, B_METADIRTY) && bt_meta(t) == RET_ERROR) return (RET_ERROR); /* @@ -127,22 +133,22 @@ __bt_sync(dbp) * key/data item, sync the file, and then restore the original page * contents. */ - if (ISSET(t, BTF_DELCRSR)) { + if (ISSET(t, B_DELCRSR)) { if ((p = malloc(t->bt_psize)) == NULL) return (RET_ERROR); if ((h = mpool_get(t->bt_mp, t->bt_bcursor.pgno, 0)) == NULL) return (RET_ERROR); memmove(p, h, t->bt_psize); - if (status = - __bt_dleaf(t, h, t->bt_bcursor.index) == RET_ERROR) + if ((status = + __bt_dleaf(t, h, t->bt_bcursor.index)) == RET_ERROR) goto ecrsr; mpool_put(t->bt_mp, h, MPOOL_DIRTY); } if ((status = mpool_sync(t->bt_mp)) == RET_SUCCESS) - CLR(t, BTF_MODIFIED); + CLR(t, B_MODIFIED); -ecrsr: if (ISSET(t, BTF_DELCRSR)) { +ecrsr: if (ISSET(t, B_DELCRSR)) { if ((h = mpool_get(t->bt_mp, t->bt_bcursor.pgno, 0)) == NULL) return (RET_ERROR); memmove(h, p, t->bt_psize); @@ -171,23 +177,13 @@ bt_meta(t) if ((p = mpool_get(t->bt_mp, P_META, 0)) == NULL) return (RET_ERROR); - /* Fill in metadata -- lorder is host-independent. */ + /* Fill in metadata. */ m.m_magic = BTREEMAGIC; m.m_version = BTREEVERSION; m.m_psize = t->bt_psize; m.m_free = t->bt_free; m.m_nrecs = t->bt_nrecs; m.m_flags = t->bt_flags & SAVEMETA; - m.m_lorder = htonl((u_long)t->bt_lorder); - - if (t->bt_lorder != BYTE_ORDER) { - BLSWAP(m.m_magic); - BLSWAP(m.m_version); - BLSWAP(m.m_psize); - BLSWAP(m.m_free); - BLSWAP(m.m_nrecs); - BLSWAP(m.m_flags); - } memmove(p, &m, sizeof(BTMETA)); mpool_put(t->bt_mp, p, MPOOL_DIRTY); diff --git a/lib/libc/DB/btree/bt_conv.c b/lib/libc/DB/btree/bt_conv.c index 0276fcb5ea28..1ec0d48aca7e 100644 --- a/lib/libc/DB/btree/bt_conv.c +++ b/lib/libc/DB/btree/bt_conv.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)bt_conv.c 5.7 (Berkeley) 2/14/93"; +static char sccsid[] = "@(#)bt_conv.c 5.10 (Berkeley) 5/16/93"; #endif /* LIBC_SCCS and not lint */ #include @@ -45,7 +45,7 @@ static char sccsid[] = "@(#)bt_conv.c 5.7 (Berkeley) 2/14/93"; #include #include "btree.h" -static void kdswap __P((PAGE *)); +static void mswap __P((PAGE *)); /* * __BT_BPGIN, __BT_BPGOUT -- @@ -58,68 +58,33 @@ static void kdswap __P((PAGE *)); * h: page to convert */ void -__bt_pgin(t, pg, p) +__bt_pgin(t, pg, pp) void *t; pgno_t pg; - void *p; + void *pp; { PAGE *h; - - if (((BTREE *)t)->bt_lorder == BYTE_ORDER) - return; - - h = p; - BLSWAP(h->pgno); - BLSWAP(h->prevpg); - BLSWAP(h->nextpg); - BLSWAP(h->flags); - BSSWAP(h->lower); - BSSWAP(h->upper); - kdswap(h); -} - -void -__bt_pgout(t, pg, p) - void *t; - pgno_t pg; - void *p; -{ - PAGE *h; - - if (((BTREE *)t)->bt_lorder == BYTE_ORDER) - return; - - h = p; - kdswap(h); - BLSWAP(h->pgno); - BLSWAP(h->prevpg); - BLSWAP(h->nextpg); - BLSWAP(h->flags); - BSSWAP(h->lower); - BSSWAP(h->upper); -} - -/* - * KDSWAP -- Actually swap the bytes on the page. - * - * Parameters: - * h: page to convert - * - * Warnings: - * Everywhere else in the code, the pgno_t and indx_t types are - * opaque. These routines know what they really are. - */ -static void -kdswap(h) - PAGE *h; -{ - register int i, top; - register char *p; /* Really void, thanks ANSI! */ + int i, top; u_char flags; + char *p; + + if (!ISSET(((BTREE *)t), B_NEEDSWAP)) + return; + if (pg == P_META) { + mswap(pp); + return; + } + + h = pp; + BLSWAP(h->pgno); + BLSWAP(h->prevpg); + BLSWAP(h->nextpg); + BLSWAP(h->flags); + BSSWAP(h->lower); + BSSWAP(h->upper); top = NEXTINDEX(h); - switch (h->flags & P_TYPE) { - case P_BINTERNAL: + if ((h->flags & P_TYPE) == P_BINTERNAL) for (i = 0; i < top; i++) { BSSWAP(h->linp[i]); p = (char *)GETBINTERNAL(h, i); @@ -134,8 +99,7 @@ kdswap(h) BLPSWAP(p); } } - break; - case P_BLEAF: + else if ((h->flags & P_TYPE) == P_BLEAF) for (i = 0; i < top; i++) { BSSWAP(h->linp[i]); p = (char *)GETBLEAF(h, i); @@ -159,6 +123,99 @@ kdswap(h) } } } - break; - } +} + +void +__bt_pgout(t, pg, pp) + void *t; + pgno_t pg; + void *pp; +{ + PAGE *h; + int i, top; + u_char flags; + char *p; + + if (!ISSET(((BTREE *)t), B_NEEDSWAP)) + return; + if (pg == P_META) { + mswap(pp); + return; + } + + h = pp; + top = NEXTINDEX(h); + if ((h->flags & P_TYPE) == P_BINTERNAL) + for (i = 0; i < top; i++) { + p = (char *)GETBINTERNAL(h, i); + BLPSWAP(p); + p += sizeof(size_t); + BLPSWAP(p); + p += sizeof(pgno_t); + if (*(u_char *)p & P_BIGKEY) { + p += sizeof(u_char); + BLPSWAP(p); + p += sizeof(pgno_t); + BLPSWAP(p); + } + BSSWAP(h->linp[i]); + } + else if ((h->flags & P_TYPE) == P_BLEAF) + for (i = 0; i < top; i++) { + p = (char *)GETBLEAF(h, i); + BLPSWAP(p); + p += sizeof(size_t); + BLPSWAP(p); + p += sizeof(size_t); + flags = *(u_char *)p; + if (flags & (P_BIGKEY | P_BIGDATA)) { + p += sizeof(u_char); + if (flags & P_BIGKEY) { + BLPSWAP(p); + p += sizeof(pgno_t); + BLPSWAP(p); + } + if (flags & P_BIGDATA) { + p += sizeof(size_t); + BLPSWAP(p); + p += sizeof(pgno_t); + BLPSWAP(p); + } + } + BSSWAP(h->linp[i]); + } + + BLSWAP(h->pgno); + BLSWAP(h->prevpg); + BLSWAP(h->nextpg); + BLSWAP(h->flags); + BSSWAP(h->lower); + BSSWAP(h->upper); +} + +/* + * MSWAP -- Actually swap the bytes on the meta page. + * + * Parameters: + * p: page to convert + */ +static void +mswap(pg) + PAGE *pg; +{ + char *p; + + p = (char *)pg; + BLPSWAP(p); /* m_magic */ + p += sizeof(u_long); + BLPSWAP(p); /* m_version */ + p += sizeof(u_long); + BLPSWAP(p); /* m_psize */ + p += sizeof(u_long); + BLPSWAP(p); /* m_free */ + p += sizeof(u_long); + BLPSWAP(p); /* m_nrecs */ + p += sizeof(u_long); + BLPSWAP(p); /* m_flags */ + p += sizeof(u_long); } diff --git a/lib/libc/DB/btree/bt_debug.c b/lib/libc/DB/btree/bt_debug.c index b95aa1560d3b..469f5ddc46e6 100644 --- a/lib/libc/DB/btree/bt_debug.c +++ b/lib/libc/DB/btree/bt_debug.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)bt_debug.c 5.7 (Berkeley) 2/14/93"; +static char sccsid[] = "@(#)bt_debug.c 5.9 (Berkeley) 5/16/93"; #endif /* LIBC_SCCS and not lint */ #include @@ -65,8 +65,8 @@ __bt_dump(dbp) t = dbp->internal; (void)fprintf(stderr, "%s: pgsz %d", - ISSET(t, BTF_INMEM) ? "memory" : "disk", t->bt_psize); - if (ISSET(t, BTF_RECNO)) + ISSET(t, B_INMEM) ? "memory" : "disk", t->bt_psize); + if (ISSET(t, R_RECNO)) (void)fprintf(stderr, " keys %lu", t->bt_nrecs); #undef X #define X(flag, name) \ @@ -76,14 +76,14 @@ __bt_dump(dbp) } if (t->bt_flags) { sep = " flags ("; - X(BTF_DELCRSR, "DELCRSR"); - X(BTF_FIXEDLEN, "FIXEDLEN"); - X(BTF_INMEM, "INMEM"); - X(BTF_NODUPS, "NODUPS"); - X(BTF_RDONLY, "RDONLY"); - X(BTF_RECNO, "RECNO"); - X(BTF_SEQINIT, "SEQINIT"); - X(BTF_METADIRTY,"METADIRTY"); + X(B_DELCRSR, "DELCRSR"); + X(R_FIXLEN, "FIXLEN"); + X(B_INMEM, "INMEM"); + X(B_NODUPS, "NODUPS"); + X(B_RDONLY, "RDONLY"); + X(R_RECNO, "RECNO"); + X(B_SEQINIT, "SEQINIT"); + X(B_METADIRTY,"METADIRTY"); (void)fprintf(stderr, ")\n"); } #undef X @@ -122,11 +122,10 @@ __bt_dmpage(h) } if (m->m_flags) { sep = " ("; - X(BTF_NODUPS, "NODUPS"); - X(BTF_RECNO, "RECNO"); + X(B_NODUPS, "NODUPS"); + X(R_RECNO, "RECNO"); (void)fprintf(stderr, ")"); } - (void)fprintf(stderr, "\nlorder %lu\n", m->m_lorder); } /* @@ -202,7 +201,7 @@ __bt_dpage(h) (void)fprintf(stderr, " (indirect)"); else if (bi->ksize) (void)fprintf(stderr, - " {%.*s}", bi->ksize, bi->bytes); + " {%.*s}", (int)bi->ksize, bi->bytes); break; case P_RINTERNAL: ri = GETRINTERNAL(h, cur); @@ -225,8 +224,8 @@ __bt_dpage(h) *(size_t *)(bl->bytes + bl->ksize + sizeof(pgno_t))); else if (bl->dsize) - (void)fprintf(stderr, - "%.*s", bl->dsize, bl->bytes + bl->ksize); + (void)fprintf(stderr, "%.*s", + (int)bl->dsize, bl->bytes + bl->ksize); break; case P_RLEAF: rl = GETRLEAF(h, cur); @@ -237,18 +236,12 @@ __bt_dpage(h) *(size_t *)(rl->bytes + sizeof(pgno_t))); else if (rl->dsize) (void)fprintf(stderr, - "%.*s", rl->dsize, rl->bytes); + "%.*s", (int)rl->dsize, rl->bytes); break; } (void)fprintf(stderr, "\n"); } } -#else -void -__bt_dump(dbp) - DB *dbp; -{ -} #endif #ifdef STATISTICS @@ -303,7 +296,7 @@ __bt_stat(dbp) (void)mpool_put(t->bt_mp, h, 0); break; } - i = ISSET(t, BTF_RECNO) ? + i = ISSET(t, R_RECNO) ? GETRINTERNAL(h, 0)->pgno : GETBINTERNAL(h, 0)->pgno; (void)mpool_put(t->bt_mp, h, 0); @@ -311,7 +304,7 @@ __bt_stat(dbp) (void)fprintf(stderr, "%d level%s with %ld keys", levels, levels == 1 ? "" : "s", nkeys); - if (ISSET(t, BTF_RECNO)) + if (ISSET(t, R_RECNO)) (void)fprintf(stderr, " (%ld header count)", t->bt_nrecs); (void)fprintf(stderr, "\n%lu pages (leaf %ld, internal %ld, overflow %ld)\n", @@ -336,10 +329,4 @@ __bt_stat(dbp) (void)fprintf(stderr, "prefix checking removed %lu bytes.\n", bt_pfxsaved); } -#else -void -__bt_stat(dbp) - DB *dbp; -{ -} #endif diff --git a/lib/libc/DB/btree/bt_delete.c b/lib/libc/DB/btree/bt_delete.c index eb28e4ffee72..901052230f89 100644 --- a/lib/libc/DB/btree/bt_delete.c +++ b/lib/libc/DB/btree/bt_delete.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)bt_delete.c 5.10 (Berkeley) 2/16/93"; +static char sccsid[] = "@(#)bt_delete.c 5.11 (Berkeley) 5/16/93"; #endif /* LIBC_SCCS and not lint */ #include @@ -70,7 +70,7 @@ __bt_delete(dbp, key, flags) int status; t = dbp->internal; - if (ISSET(t, BTF_RDONLY)) { + if (ISSET(t, B_RDONLY)) { errno = EPERM; return (RET_ERROR); } @@ -85,9 +85,9 @@ __bt_delete(dbp, key, flags) * the delete cursor bit to have been set requires that the * scan be initialized, so no reason to check. */ - if (!ISSET(t, BTF_SEQINIT)) + if (!ISSET(t, B_SEQINIT)) goto einval; - status = ISSET(t, BTF_DELCRSR) ? + status = ISSET(t, B_DELCRSR) ? RET_SPECIAL : __bt_crsrdel(t, &t->bt_bcursor); break; default: @@ -95,7 +95,7 @@ einval: errno = EINVAL; return (RET_ERROR); } if (status == RET_SUCCESS) - SET(t, BTF_MODIFIED); + SET(t, B_MODIFIED); return (status); } @@ -158,8 +158,8 @@ bt_bdelete(t, key) dirty2 = 0; do { if (h->pgno == cpgno && e->index == cindex) { - if (!ISSET(t, BTF_DELCRSR)) { - SET(t, BTF_DELCRSR); + if (!ISSET(t, B_DELCRSR)) { + SET(t, B_DELCRSR); deleted = 1; } ++e->index; @@ -225,8 +225,8 @@ done1: if (h->pgno != save.page->pgno) if (__bt_cmp(t, key, e) != 0) goto done2; if (h->pgno == cpgno && e->index == cindex) { - if (!ISSET(t, BTF_DELCRSR)) { - SET(t, BTF_DELCRSR); + if (!ISSET(t, B_DELCRSR)) { + SET(t, B_DELCRSR); deleted = 1; } } else { diff --git a/lib/libc/DB/btree/bt_get.c b/lib/libc/DB/btree/bt_get.c index a4ac842bf642..8db29f3c8807 100644 --- a/lib/libc/DB/btree/bt_get.c +++ b/lib/libc/DB/btree/bt_get.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)bt_get.c 5.8 (Berkeley) 2/14/93"; +static char sccsid[] = "@(#)bt_get.c 5.9 (Berkeley) 5/16/93"; #endif /* LIBC_SCCS and not lint */ #include @@ -89,7 +89,7 @@ __bt_get(dbp, key, data, flags) * __bt_first and have it redo the search, as __bt_first will not * return keys marked for deletion. Slow, but should never happen. */ - if (ISSET(t, BTF_DELCRSR) && e->page->pgno == t->bt_bcursor.pgno && + if (ISSET(t, B_DELCRSR) && e->page->pgno == t->bt_bcursor.pgno && e->index == t->bt_bcursor.index) { mpool_put(t->bt_mp, e->page, 0); if ((e = __bt_first(t, key, &exact)) == NULL) @@ -136,7 +136,7 @@ __bt_first(t, key, exactp) if (!*exactp) return (e); - if (ISSET(t, BTF_DELCRSR)) { + if (ISSET(t, B_DELCRSR)) { cpgno = t->bt_bcursor.pgno; cindex = t->bt_bcursor.index; } else { diff --git a/lib/libc/DB/btree/bt_open.c b/lib/libc/DB/btree/bt_open.c index 5fe924d4e600..e8587d24444b 100644 --- a/lib/libc/DB/btree/bt_open.c +++ b/lib/libc/DB/btree/bt_open.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)bt_open.c 5.26 (Berkeley) 2/16/93"; +static char sccsid[] = "@(#)bt_open.c 5.31 (Berkeley) 5/24/93"; #endif /* LIBC_SCCS and not lint */ /* @@ -62,6 +62,7 @@ static char sccsid[] = "@(#)bt_open.c 5.26 (Berkeley) 2/16/93"; #include #include "btree.h" +static int byteorder __P((void)); static int nroot __P((BTREE *)); static int tmp __P((void)); @@ -93,7 +94,7 @@ __bt_open(fname, flags, mode, openinfo) DB *dbp; pgno_t ncache; struct stat sb; - int nr; + int machine_lorder, nr; t = NULL; @@ -104,6 +105,7 @@ __bt_open(fname, flags, mode, openinfo) * file is opened. Also, the file's page size can cause the cachesize * to change. */ + machine_lorder = byteorder(); if (openinfo) { b = *openinfo; @@ -117,7 +119,7 @@ __bt_open(fname, flags, mode, openinfo) * transfer size. */ if (b.psize && - (b.psize < MINPSIZE || b.psize > MAX_PAGE_OFFSET || + (b.psize < MINPSIZE || b.psize > MAX_PAGE_OFFSET + 1 || b.psize & sizeof(indx_t) - 1)) goto einval; @@ -136,19 +138,21 @@ __bt_open(fname, flags, mode, openinfo) } if (b.lorder == 0) - b.lorder = BYTE_ORDER; - else if (b.lorder != BIG_ENDIAN && b.lorder != LITTLE_ENDIAN) - goto einval; + b.lorder = machine_lorder; } else { b.compare = __bt_defcmp; b.cachesize = 0; b.flags = 0; - b.lorder = BYTE_ORDER; + b.lorder = machine_lorder; b.minkeypage = DEFMINKEYPAGE; b.prefix = __bt_defpfx; b.psize = 0; } + /* Check for the ubiquitous PDP-11. */ + if (b.lorder != BIG_ENDIAN && b.lorder != LITTLE_ENDIAN) + goto einval; + /* Allocate and initialize DB and BTREE structures. */ if ((t = malloc(sizeof(BTREE))) == NULL) goto err; @@ -161,15 +165,19 @@ __bt_open(fname, flags, mode, openinfo) t->bt_sp = t->bt_maxstack = 0; t->bt_kbuf = t->bt_dbuf = NULL; t->bt_kbufsz = t->bt_dbufsz = 0; + t->bt_lorder = b.lorder; t->bt_order = NOT; t->bt_cmp = b.compare; t->bt_pfx = b.prefix; t->bt_flags = 0; + if (t->bt_lorder != machine_lorder) + SET(t, B_NEEDSWAP); dbp->type = DB_BTREE; dbp->internal = t; dbp->close = __bt_close; dbp->del = __bt_delete; + dbp->fd = __bt_fd; dbp->get = __bt_get; dbp->put = __bt_put; dbp->seq = __bt_seq; @@ -182,7 +190,7 @@ __bt_open(fname, flags, mode, openinfo) if (fname) { switch(flags & O_ACCMODE) { case O_RDONLY: - SET(t, BTF_RDONLY); + SET(t, B_RDONLY); break; case O_RDWR: break; @@ -200,7 +208,7 @@ __bt_open(fname, flags, mode, openinfo) goto einval; if ((t->bt_fd = tmp()) == -1) goto err; - SET(t, BTF_INMEM); + SET(t, B_INMEM); } if (fcntl(t->bt_fd, F_SETFD, 1) == -1) @@ -218,14 +226,15 @@ __bt_open(fname, flags, mode, openinfo) /* * Read in the meta-data. This can change the notion of what * the lorder, page size and flags are, and, when the page size - * changes the cachesize value can change as well. - * - * Lorder is always stored in host-independent format. + * changes, the cachesize value can change too. If the user + * specified the wrong byte order for an existing database, we + * don't bother to return an error, we just clear the NEEDSWAP + * bit. */ - m.m_lorder = ntohl(m.m_lorder); - if (m.m_lorder != BIG_ENDIAN && m.m_lorder != LITTLE_ENDIAN) - goto eftype; - if (m.m_lorder != BYTE_ORDER) { + if (m.m_magic == BTREEMAGIC) + CLR(t, B_NEEDSWAP); + else { + SET(t, B_NEEDSWAP); BLSWAP(m.m_magic); BLSWAP(m.m_version); BLSWAP(m.m_psize); @@ -235,7 +244,7 @@ __bt_open(fname, flags, mode, openinfo) } if (m.m_magic != BTREEMAGIC || m.m_version != BTREEVERSION) goto eftype; - if (m.m_psize < MINPSIZE || m.m_psize > MAX_PAGE_OFFSET || + if (m.m_psize < MINPSIZE || m.m_psize > MAX_PAGE_OFFSET + 1 || m.m_psize & sizeof(indx_t) - 1) goto eftype; if (m.m_flags & ~SAVEMETA) @@ -243,7 +252,6 @@ __bt_open(fname, flags, mode, openinfo) b.psize = m.m_psize; t->bt_flags |= m.m_flags; t->bt_free = m.m_free; - t->bt_lorder = m.m_lorder; t->bt_nrecs = m.m_nrecs; } else { /* @@ -254,15 +262,17 @@ __bt_open(fname, flags, mode, openinfo) b.psize = sb.st_blksize; if (b.psize < MINPSIZE) b.psize = MINPSIZE; - if (b.psize > MAX_PAGE_OFFSET) - b.psize = MAX_PAGE_OFFSET; + if (b.psize > MAX_PAGE_OFFSET + 1) + b.psize = MAX_PAGE_OFFSET + 1; } + + /* Set flag if duplicates permitted. */ if (!(b.flags & R_DUP)) - SET(t, BTF_NODUPS); + SET(t, B_NODUPS); + t->bt_free = P_INVALID; - t->bt_lorder = b.lorder; t->bt_nrecs = 0; - SET(t, BTF_METADIRTY); + SET(t, B_METADIRTY); } t->bt_psize = b.psize; @@ -297,7 +307,7 @@ __bt_open(fname, flags, mode, openinfo) if ((t->bt_mp = mpool_open(NULL, t->bt_fd, t->bt_psize, ncache)) == NULL) goto err; - if (!ISSET(t, BTF_INMEM)) + if (!ISSET(t, B_INMEM)) mpool_filter(t->bt_mp, __bt_pgin, __bt_pgout, t); /* Create a root page if new tree. */ @@ -383,3 +393,36 @@ tmp() (void)sigprocmask(SIG_SETMASK, &oset, NULL); return(fd); } + +static int +byteorder() +{ + u_long x; /* XXX: 32-bit assumption. */ + u_char *p; + + x = 0x01020304; + p = (u_char *)&x; + switch (*p) { + case 1: + return (BIG_ENDIAN); + case 4: + return (LITTLE_ENDIAN); + default: + return (0); + } +} + +int +__bt_fd(dbp) + const DB *dbp; +{ + BTREE *t; + + t = dbp->internal; + + if (ISSET(t, B_INMEM)) { + errno = ENOENT; + return (-1); + } + return (t->bt_fd); +} diff --git a/lib/libc/DB/btree/bt_put.c b/lib/libc/DB/btree/bt_put.c index 72bb422aed07..08707422d2a6 100644 --- a/lib/libc/DB/btree/bt_put.c +++ b/lib/libc/DB/btree/bt_put.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)bt_put.c 5.14 (Berkeley) 2/16/93"; +static char sccsid[] = "@(#)bt_put.c 5.15 (Berkeley) 5/16/93"; #endif /* LIBC_SCCS and not lint */ #include @@ -84,9 +84,9 @@ __bt_put(dbp, key, data, flags) switch (flags) { case R_CURSOR: - if (!ISSET(t, BTF_SEQINIT)) + if (!ISSET(t, B_SEQINIT)) goto einval; - if (ISSET(t, BTF_DELCRSR)) + if (ISSET(t, B_DELCRSR)) goto einval; break; case 0: @@ -97,7 +97,7 @@ einval: errno = EINVAL; return (RET_ERROR); } - if (ISSET(t, BTF_RDONLY)) { + if (ISSET(t, B_RDONLY)) { errno = EPERM; return (RET_ERROR); } @@ -174,15 +174,15 @@ storekey: if (__ovfl_put(t, key, &pg) == RET_ERROR) * leaving the cursor there -- this means that the inserted * record will not be seen in a cursor scan. */ - if (ISSET(t, BTF_DELCRSR) && t->bt_bcursor.pgno == h->pgno && + if (ISSET(t, B_DELCRSR) && t->bt_bcursor.pgno == h->pgno && t->bt_bcursor.index == index) { - CLR(t, BTF_DELCRSR); + CLR(t, B_DELCRSR); goto delete; } mpool_put(t->bt_mp, h, 0); return (RET_SPECIAL); default: - if (!exact || !ISSET(t, BTF_NODUPS)) + if (!exact || !ISSET(t, B_NODUPS)) break; delete: if (__bt_dleaf(t, h, index) == RET_ERROR) { mpool_put(t->bt_mp, h, 0); @@ -236,7 +236,7 @@ success: t->bt_bcursor.pgno = e->page->pgno; t->bt_bcursor.index = e->index; } - SET(t, BTF_MODIFIED); + SET(t, B_MODIFIED); return (RET_SUCCESS); } diff --git a/lib/libc/DB/btree/bt_seq.c b/lib/libc/DB/btree/bt_seq.c index 20071a56dc3f..0420ccee653a 100644 --- a/lib/libc/DB/btree/bt_seq.c +++ b/lib/libc/DB/btree/bt_seq.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)bt_seq.c 5.9 (Berkeley) 2/14/93"; +static char sccsid[] = "@(#)bt_seq.c 5.10 (Berkeley) 5/16/93"; #endif /* LIBC_SCCS and not lint */ #include @@ -95,7 +95,7 @@ __bt_seq(dbp, key, data, flags) switch(flags) { case R_NEXT: case R_PREV: - if (ISSET(t, BTF_SEQINIT)) { + if (ISSET(t, B_SEQINIT)) { status = bt_seqadv(t, &e, flags); break; } @@ -117,7 +117,7 @@ __bt_seq(dbp, key, data, flags) t->bt_bcursor.pgno = e.page->pgno; t->bt_bcursor.index = e.index; mpool_put(t->bt_mp, e.page, 0); - SET(t, BTF_SEQINIT); + SET(t, B_SEQINIT); } return (status); } @@ -154,7 +154,7 @@ bt_seqset(t, ep, key, flags) * the cursor pointed to it. Since going to a specific key, should * delete any logically deleted records so they aren't found. */ - if (ISSET(t, BTF_DELCRSR) && __bt_crsrdel(t, &t->bt_bcursor)) + if (ISSET(t, B_DELCRSR) && __bt_crsrdel(t, &t->bt_bcursor)) return (RET_ERROR); /* @@ -280,7 +280,7 @@ bt_seqadv(t, e, flags) /* Save the current cursor if going to delete it. */ c = &t->bt_bcursor; - if (ISSET(t, BTF_DELCRSR)) + if (ISSET(t, B_DELCRSR)) delc = *c; if ((h = mpool_get(t->bt_mp, c->pgno, 0)) == NULL) @@ -329,8 +329,8 @@ bt_seqadv(t, e, flags) * down by one if the record we're deleting is on the same page and has * a larger index. */ - if (ISSET(t, BTF_DELCRSR)) { - CLR(t, BTF_DELCRSR); /* Don't try twice. */ + if (ISSET(t, B_DELCRSR)) { + CLR(t, B_DELCRSR); /* Don't try twice. */ if (c->pgno == delc.pgno && c->index > delc.index) --c->index; if (__bt_crsrdel(t, &delc)) @@ -356,7 +356,7 @@ __bt_crsrdel(t, c) PAGE *h; int status; - CLR(t, BTF_DELCRSR); /* Don't try twice. */ + CLR(t, B_DELCRSR); /* Don't try twice. */ if ((h = mpool_get(t->bt_mp, c->pgno, 0)) == NULL) return (RET_ERROR); status = __bt_dleaf(t, h, c->index); diff --git a/lib/libc/DB/btree/bt_split.c b/lib/libc/DB/btree/bt_split.c index a6bccf8c8483..1b3a71255c01 100644 --- a/lib/libc/DB/btree/bt_split.c +++ b/lib/libc/DB/btree/bt_split.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)bt_split.c 5.15 (Berkeley) 2/19/93"; +static char sccsid[] = "@(#)bt_split.c 5.17 (Berkeley) 5/22/93"; #endif /* LIBC_SCCS and not lint */ #include @@ -95,7 +95,7 @@ __bt_split(t, sp, key, data, flags, ilen, skip) PAGE *h, *l, *r, *lchild, *rchild; indx_t nxtindex; size_t n, nbytes, nksize; - int nosplit; + int parentsplit; char *dest; /* @@ -116,14 +116,14 @@ __bt_split(t, sp, key, data, flags, ilen, skip) */ h->linp[skip] = h->upper -= ilen; dest = (char *)h + h->upper; - if (ISSET(t, BTF_RECNO)) + if (ISSET(t, R_RECNO)) WR_RLEAF(dest, data, flags) else WR_BLEAF(dest, key, data, flags) /* If the root page was split, make it look right. */ if (sp->pgno == P_ROOT && - (ISSET(t, BTF_RECNO) ? + (ISSET(t, R_RECNO) ? bt_rroot(t, sp, l, r) : bt_broot(t, sp, l, r)) == RET_ERROR) goto err2; @@ -150,7 +150,7 @@ __bt_split(t, sp, key, data, flags, ilen, skip) * This code must make sure that all pins are released other than the * root page or overflow page which is unlocked elsewhere. */ - for (nosplit = 0; (parent = BT_POP(t)) != NULL;) { + while ((parent = BT_POP(t)) != NULL) { lchild = l; rchild = r; @@ -221,12 +221,13 @@ __bt_split(t, sp, key, data, flags, ilen, skip) bt_page(t, h, &l, &r, &skip, nbytes); if (h == NULL) goto err1; + parentsplit = 1; } else { if (skip < (nxtindex = NEXTINDEX(h))) memmove(h->linp + skip + 1, h->linp + skip, (nxtindex - skip) * sizeof(indx_t)); h->lower += sizeof(indx_t); - nosplit = 1; + parentsplit = 0; } /* Insert the key into the parent page. */ @@ -248,38 +249,54 @@ __bt_split(t, sp, key, data, flags, ilen, skip) goto err1; break; case P_RINTERNAL: - /* Update both left and right page counts. */ + /* + * Update the left page count. If split + * added at index 0, fix the correct page. + */ + if (skip > 0) + dest = (char *)h + h->linp[skip - 1]; + else + dest = (char *)l + l->linp[NEXTINDEX(l) - 1]; + ((RINTERNAL *)dest)->nrecs = rec_total(lchild); + ((RINTERNAL *)dest)->pgno = lchild->pgno; + + /* Update the right page count. */ h->linp[skip] = h->upper -= nbytes; dest = (char *)h + h->linp[skip]; ((RINTERNAL *)dest)->nrecs = rec_total(rchild); ((RINTERNAL *)dest)->pgno = rchild->pgno; - dest = (char *)h + h->linp[skip - 1]; - ((RINTERNAL *)dest)->nrecs = rec_total(lchild); - ((RINTERNAL *)dest)->pgno = lchild->pgno; break; case P_RLEAF: - /* Update both left and right page counts. */ + /* + * Update the left page count. If split + * added at index 0, fix the correct page. + */ + if (skip > 0) + dest = (char *)h + h->linp[skip - 1]; + else + dest = (char *)l + l->linp[NEXTINDEX(l) - 1]; + ((RINTERNAL *)dest)->nrecs = NEXTINDEX(lchild); + ((RINTERNAL *)dest)->pgno = lchild->pgno; + + /* Update the right page count. */ h->linp[skip] = h->upper -= nbytes; dest = (char *)h + h->linp[skip]; ((RINTERNAL *)dest)->nrecs = NEXTINDEX(rchild); ((RINTERNAL *)dest)->pgno = rchild->pgno; - dest = (char *)h + h->linp[skip - 1]; - ((RINTERNAL *)dest)->nrecs = NEXTINDEX(lchild); - ((RINTERNAL *)dest)->pgno = lchild->pgno; break; default: abort(); } /* Unpin the held pages. */ - if (nosplit) { + if (!parentsplit) { mpool_put(t->bt_mp, h, MPOOL_DIRTY); break; } /* If the root page was split, make it look right. */ if (sp->pgno == P_ROOT && - (ISSET(t, BTF_RECNO) ? + (ISSET(t, R_RECNO) ? bt_rroot(t, sp, l, r) : bt_broot(t, sp, l, r)) == RET_ERROR) goto err1; @@ -687,7 +704,7 @@ bt_psplit(t, h, l, r, pskip, ilen) * one. If the cursor is on the right page, it is decremented by the * number of records split to the left page. * - * Don't bother checking for the BTF_SEQINIT flag, the page number will + * Don't bother checking for the B_SEQINIT flag, the page number will * be P_INVALID. */ c = &t->bt_bcursor; diff --git a/lib/libc/DB/btree/bt_utils.c b/lib/libc/DB/btree/bt_utils.c index b6bf73f0e42a..09b9a7ac9b4a 100644 --- a/lib/libc/DB/btree/bt_utils.c +++ b/lib/libc/DB/btree/bt_utils.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)bt_utils.c 5.10 (Berkeley) 2/16/93"; +static char sccsid[] = "@(#)bt_utils.c 5.11 (Berkeley) 5/1/93"; #endif /* LIBC_SCCS and not lint */ #include @@ -169,7 +169,7 @@ __bt_cmp(t, k1, e) return (RET_ERROR); k2.data = t->bt_dbuf; } - return((*t->bt_cmp)(k1, &k2)); + return ((*t->bt_cmp)(k1, &k2)); } /* @@ -194,8 +194,8 @@ __bt_defcmp(a, b) len = MIN(a->size, b->size); for (p1 = a->data, p2 = b->data; len--; ++p1, ++p2) if (diff = *p1 - *p2) - return(diff); - return(a->size - b->size); + return (diff); + return (a->size - b->size); } /* @@ -220,7 +220,7 @@ __bt_defpfx(a, b) len = MIN(a->size, b->size); for (p1 = a->data, p2 = b->data; len--; ++p1, ++p2, ++cnt) if (*p1 != *p2) - return(cnt); + return (cnt); /* 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/lib/libc/DB/btree/btree.h b/lib/libc/DB/btree/btree.h index 6b7ece6829a6..3262d116ac2c 100644 --- a/lib/libc/DB/btree/btree.h +++ b/lib/libc/DB/btree/btree.h @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)btree.h 5.12 (Berkeley) 3/19/93 + * @(#)btree.h 5.15 (Berkeley) 5/22/93 */ #include @@ -259,9 +259,9 @@ typedef struct BTMETA { u_long m_psize; /* page size */ u_long m_free; /* page number of first free page */ u_long m_nrecs; /* R: number of records */ -#define SAVEMETA (BTF_NODUPS | BTF_RECNO) +#define SAVEMETA (B_NODUPS | R_RECNO) u_long m_flags; /* bt_flags & SAVEMETA */ - u_long m_lorder; /* byte order */ + u_long m_unused; /* unused */ } BTMETA; /* The in-memory btree/recno data structure. */ @@ -287,7 +287,7 @@ typedef struct BTREE { int bt_fd; /* tree file descriptor */ pgno_t bt_free; /* next free page */ - indx_t bt_psize; /* page size */ + u_long bt_psize; /* page size */ indx_t bt_ovflsize; /* cut-off for key/data overflow */ int bt_lorder; /* byte order */ /* sorted order */ @@ -313,19 +313,28 @@ typedef struct BTREE { size_t bt_reclen; /* R: fixed record length */ u_char bt_bval; /* R: delimiting byte/pad character */ -#define BTF_CLOSEFP 0x0001 /* R: opened a file pointer */ -#define BTF_DELCRSR 0x0002 /* cursor has been deleted */ -#define BTF_EOF 0x0004 /* R: end of input file reached. */ -#define BTF_FIXEDLEN 0x0008 /* R: fixed length records */ -#define BTF_INMEM 0x0010 /* B: in-memory tree */ -#define BTF_MEMMAPPED 0x0020 /* R: memory mapped file. */ -#define BTF_METADIRTY 0x0040 /* B: need to write metadata */ -#define BTF_MODIFIED 0x0080 /* tree modified */ -#define BTF_NODUPS 0x0100 /* B: no duplicate keys permitted */ -#define BTF_RDONLY 0x0200 /* read-only tree */ -#define BTF_RECNO 0x0400 /* R: record oriented tree */ -#define BTF_RINMEM 0x0800 /* R: in-memory tree */ -#define BTF_SEQINIT 0x1000 /* sequential scan initialized */ +/* + * NB: + * B_NODUPS and R_RECNO are stored on disk, and may not be changed. + */ +#define B_DELCRSR 0x00001 /* cursor has been deleted */ +#define B_INMEM 0x00002 /* in-memory tree */ +#define B_METADIRTY 0x00004 /* need to write metadata */ +#define B_MODIFIED 0x00008 /* tree modified */ +#define B_NEEDSWAP 0x00010 /* if byte order requires swapping */ +#define B_NODUPS 0x00020 /* no duplicate keys permitted */ +#define B_RDONLY 0x00040 /* read-only tree */ +#define B_SEQINIT 0x00100 /* sequential scan initialized */ + +#define R_CLOSEFP 0x00200 /* opened a file pointer */ +#define R_EOF 0x00400 /* end of input file reached. */ +#define R_FIXLEN 0x00800 /* fixed length records */ +#define R_MEMMAPPED 0x01000 /* memory mapped file. */ +#define R_RECNO 0x00080 /* record oriented tree */ +#define R_INMEM 0x02000 /* in-memory file */ +#define R_MODIFIED 0x04000 /* modified file */ +#define R_RDONLY 0x08000 /* read-only file */ + u_long bt_flags; /* btree state */ } BTREE; diff --git a/lib/libc/DB/btree/extern.h b/lib/libc/DB/btree/extern.h index e3d2fb7f1cf5..84666b547920 100644 --- a/lib/libc/DB/btree/extern.h +++ b/lib/libc/DB/btree/extern.h @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)extern.h 5.6 (Berkeley) 2/19/93 + * @(#)extern.h 5.8 (Berkeley) 5/24/93 */ int __bt_close __P((DB *)); @@ -40,6 +40,7 @@ int __bt_defcmp __P((const DBT *, const DBT *)); int __bt_defpfx __P((const DBT *, const DBT *)); int __bt_delete __P((const DB *, const DBT *, u_int)); int __bt_dleaf __P((BTREE *, PAGE *, int)); +int __bt_fd __P((const DB *)); EPG *__bt_first __P((BTREE *, const DBT *, int *)); int __bt_free __P((BTREE *, PAGE *)); int __bt_get __P((const DB *, const DBT *, DBT *, u_int)); @@ -54,7 +55,7 @@ EPG *__bt_search __P((BTREE *, const DBT *, int *)); int __bt_seq __P((const DB *, DBT *, DBT *, u_int)); int __bt_split __P((BTREE *, PAGE *, const DBT *, const DBT *, u_long, size_t, u_int)); -int __bt_sync __P((const DB *)); +int __bt_sync __P((const DB *, u_int)); int __ovfl_delete __P((BTREE *, void *)); int __ovfl_get __P((BTREE *, void *, size_t *, char **, size_t *)); diff --git a/lib/libc/DB/db/db.c b/lib/libc/DB/db/db.c index 26e4cda35a15..9898867bb865 100644 --- a/lib/libc/DB/db/db.c +++ b/lib/libc/DB/db/db.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)db.c 5.4 (Berkeley) 2/11/93"; +static char sccsid[] = "@(#)db.c 5.6 (Berkeley) 5/24/93"; #endif /* LIBC_SCCS and not lint */ #include @@ -63,11 +63,11 @@ dbopen(fname, flags, mode, type, openinfo) return (NULL); } -static int __db_edel __P((const DB *, const DBT *, u_int)); -static int __db_eget __P((const DB *, const DBT *, DBT *, u_int)); -static int __db_eput __P((const DB *dbp, DBT *, const DBT *, u_int)); -static int __db_eseq __P((const DB *, DBT *, DBT *, u_int)); -static int __db_esync __P((const DB *)); +static int +__dberr() +{ + return (RET_ERROR); +} /* * __DBPANIC -- Stop. @@ -80,54 +80,10 @@ __dbpanic(dbp) DB *dbp; { /* The only thing that can succeed is a close. */ - dbp->del = __db_edel; - dbp->get = __db_eget; - dbp->put = __db_eput; - dbp->seq = __db_eseq; - dbp->sync = __db_esync; -} - -static int -__db_edel(dbp, key, flags) - const DB *dbp; - const DBT *key; - u_int flags; -{ - return (RET_ERROR); -} - -static int -__db_eget(dbp, key, data, flag) - const DB *dbp; - const DBT *key; - DBT *data; - u_int flag; -{ - return (RET_ERROR); -} - -static int -__db_eput(dbp, key, data, uflags) - const DB *dbp; - DBT *key; - const DBT *data; - u_int uflags; -{ - return (RET_ERROR); -} - -static int -__db_eseq(dbp, key, data, flags) - const DB *dbp; - DBT *key, *data; - u_int flags; -{ - return (RET_ERROR); -} - -static int -__db_esync(dbp) - const DB *dbp; -{ - return (RET_ERROR); + dbp->del = (int (*)())__dberr; + dbp->fd = (int (*)())__dberr; + dbp->get = (int (*)())__dberr; + dbp->put = (int (*)())__dberr; + dbp->seq = (int (*)())__dberr; + dbp->sync = (int (*)())__dberr; } diff --git a/lib/libc/DB/doc/btree.3.ps b/lib/libc/DB/doc/btree.3.ps index 2eb3c6dc44d7..7ae6af965b44 100644 --- a/lib/libc/DB/doc/btree.3.ps +++ b/lib/libc/DB/doc/btree.3.ps @@ -1,388 +1,364 @@ %!PS-Adobe-3.0 -%%Creator: groff version 1.03 +%%Creator: groff version 1.08 %%DocumentNeededResources: font Times-Roman %%+ font Times-Bold %%+ font Times-Italic -%%DocumentSuppliedResources: procset grops 1.03 0 +%%DocumentSuppliedResources: procset grops 1.08 0 %%Pages: 2 %%PageOrder: Ascend %%Orientation: Portrait %%EndComments %%BeginProlog -%%BeginResource: procset grops 1.03 0 - -/setpacking where { - pop - currentpacking - true setpacking -} if - -/grops 120 dict dup begin - -% The ASCII code of the space character. +%%BeginResource: procset grops 1.08 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 - -% name size font SF - - -/SF { - findfont exch - [ exch dup 0 exch 0 exch neg 0 0 ] makefont - dup setfont - [ exch /setfont cvx ] cvx bind def -} bind def - -% name a c d font MF - - -/MF { - findfont - [ 5 2 roll - 0 3 1 roll % b - neg 0 0 ] makefont - dup setfont - [ exch /setfont cvx ] cvx bind def -} bind 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 - -% BP - - -/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 - - -% centerx centery radius startangle endangle DA - - -/DA { - newpath arcn stroke -} bind def - -% x y SN - x' y' -% round a position to nearest (pixel + (.25,.25)) - -/SN { - transform - .25 sub exch .25 sub exch - round .25 add exch round .25 add exch - itransform -} bind def - -% endx endy startx starty DL - -% we round the endpoints of the line, so that parallel horizontal -% and vertical lines will appear even - -/DL { - SN - moveto - SN - lineto stroke -} bind def - -% centerx centery radius DC - - -/DC { - newpath 0 360 arc closepath -} 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 - -% width height centerx centery DE - - -/DE { - TM currentmatrix pop - translate scale newpath 0 0 .5 0 360 arc closepath - TM setmatrix -} bind def - -% these are for splines - -/RC /rcurveto load def -/RL /rlineto load def -/ST /stroke load def -/MT /moveto load def -/CL /closepath load def - -% fill the last path - -% amount FL - - -/FL { - currentgray exch setgray fill setgray -} bind def - -% fill with the ``current color'' - -/BL /fill load def - -/LW /setlinewidth load def -% new_font_name encoding_vector old_font_name RE - - -/RE { - findfont - dup maxlength dict begin - { - 1 index /FID ne { def } { pop pop } ifelse - } forall - /Encoding exch def - dup /FontName exch def - currentdict end definefont pop -} bind 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 - -% hpos vpos EBEGIN - - -/EBEGIN { - moveto - DEFS begin -} bind def - -/EEND /end load def - +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def /CNT 0 def /level1 0 def - -% llx lly newwid wid newht ht newllx newlly PBEGIN - - -/PBEGIN { - /level1 save def - translate - div 3 1 roll div exch scale - neg exch neg exch translate - % set the graphics state to default values - 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 - +/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 +/setpacking where{ +pop +setpacking +}if %%EndResource -%%EndProlog -%%BeginSetup %%IncludeResource: font Times-Roman %%IncludeResource: font Times-Bold %%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/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/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/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-Bold@0 ENC0/Times-Bold -RE/Times-Roman@0 ENC0/Times-Roman RE -%%EndSetup +/.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-Bold@0 ENC0/Times-Bold RE/Times-Roman@0 ENC0/Times-Roman RE +%%EndProlog %%Page: 1 1 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 378.84(BTREE\(3\) BTREE\(3\))72 48 R/F1 9/Times-Bold@0 -SF(NAME)72 84 Q F0(btree \255 btree database access method)108 96 Q F1 -(SYNOPSIS)72 112.8 Q/F2 10/Times-Bold@0 SF(#include )108 124.8 Q -(#include )108 136.8 Q F1(DESCRIPTION)72 153.6 Q F0 .193(The routine)108 -165.6 R/F3 10/Times-Italic@0 SF(dbopen)2.693 E F0 .192 -(is the library interface to database \214les.)2.693 F .192 -(One of the supported \214le formats is btree \214les.)5.192 F .976 +SF -.18(NA)72 84 S(ME).18 E F0(btree \255 btree database access method)108 96 Q +F1(SYNOPSIS)72 112.8 Q/F2 10/Times-Bold@0 SF(#include )108 124.8 Q +(#include )-.4 E F1(DESCRIPTION)72 153.6 Q F0 .198 +(The routine)108 165.6 R/F3 10/Times-Italic@0 SF(dbopen)2.698 E F0 .198 +(is the library interf)2.698 F .198(ace to database \214les.)-.1 F .198 +(One of the supported \214le formats is btree \214les.)5.198 F .974 (The general description of the database access methods is in)108 177.6 R F3 -(dbopen)3.477 E F0 .977(\(3\), this manual page describes only).21 F +(dbopen)3.475 E F0 .975(\(3\), this manual page describes only).24 F (the btree speci\214c information.)108 189.6 Q(The btree data structure is a s\ -orted, balanced tree structure storing associated key/data pairs.)108 206.4 Q -.471(The btree access method speci\214c data structure provided to)108 223.2 R -F3(dbopen)2.971 E F0 .471(is de\214ned in the include \214le as)2.971 F -(follows:)108 235.2 Q(typedef struct {)108 252 Q(u_long \215ags;)144 264 Q -(u_int cachesize;)144 276 Q(index_t psize;)144 288 Q(int lorder;)144 300 Q -(int minkeypage;)144 312 Q -(int \(*compare\)\(const DBT *key1, const DBT *key2\);)144 324 Q -(int \(*pre\214x\)\(const DBT *key1, const DBT *key2\);)144 336 Q 2.5(}B)108 -348 S(TREEINFO;)121.97 348 Q(The elements of this structure are as follows:)108 -364.8 Q 14.61(\215ags The)108 381.6 R(\215ag value is speci\214ed by)2.5 E F3 -(or)2.5 E F0('ing any of the following values:).53 E(R_DUP)144 398.4 Q 1.263(P\ -ermit duplicate keys in the tree, i.e. permit insertion if the key to be inser\ -ted already)180 410.4 R 1.884(exists in the tree.)180 422.4 R 1.884 -(The default behavior)6.884 F 4.384(,a)-.4 G 4.384(sd)358.308 422.4 S 1.883 -(escribed in)371.582 422.4 R F3(dbopen)4.383 E F0 1.883 -(\(3\), is to overwrite a).21 F .059 -(matching key when inserting a new key or to fail if the R_NOOVER)180 434.4 R -.059(WRITE \215ag is speci-)-.55 F 5.905(\214ed. The)180 446.4 R 3.405 -(R_DUP \215ag is overridden by the R_NOOVER)5.905 F 3.405 -(WRITE \215ag, and if the)-.55 F(R_NOOVER)180 458.4 Q .719(WRITE \215ag is spe\ -ci\214ed, attempts to insert duplicate keys into the tree will)-.55 F(fail.)180 -470.4 Q 1.058(If the database contains duplicate keys, the order of retrieval \ -of key/data pairs is unde-)180 487.2 R .787(\214ned if the)180 499.2 R F3(get) -3.287 E F0 .787(routine is used, however)3.287 F(,)-.4 E F3(seq)3.287 E F0 .788 -(routine calls with the R_CURSOR \215ag set)3.287 F -(will always return the logical `)180 511.2 Q(`\214rst')-.74 E 2.5('o)-.74 G -2.5(fa)334.05 511.2 S(ny group of duplicate keys.)344.32 511.2 Q(cachesize)108 -528 Q 3.04(As)144 540 S .54 -(uggested maximum size \(in bytes\) of the memory cache.)158.15 540 R .54 -(This value is)5.54 F F2(only)3.04 E F0(advisory)3.04 E 3.04(,a)-.65 G .54 -(nd the)514.74 540 R .713 -(access method will allocate more memory rather than fail.)144 552 R .713 -(Since every search examines the root)5.713 F .035(page of the tree, caching t\ -he most recently used pages substantially improves access time.)144 564 R .034 -(In addi-)5.034 F .659(tion, physical writes are delayed as long as possible, \ -so a moderate cache can reduce the number)144 576 R .567 -(of I/O operations signi\214cantly)144 588 R 5.566(.O)-.65 G(bviously)280.606 -588 Q 3.066(,u)-.65 G .566 -(sing a cache increases \(but only increases\) the likeli-)324.972 588 R .182(\ -hood of corruption or lost data if the system crashes while a tree is being mo\ -di\214ed.)144 600 R(If)5.183 E F3(cachesize)2.683 E F0(is)2.683 E 2.5(0\()144 -612 S(no size is speci\214ed\) a default cache is used.)154.83 612 Q 12.95 -(psize Page)108 628.8 R .442 -(size is the size \(in bytes\) of the pages used for nodes in the tree.)2.942 F -.442(The minimum page size is)5.442 F .442 +orted, balanced tree structure storing associated k)108 206.4 Q -.15(ey)-.1 G +(/data pairs.).15 E .504(The btree access method speci\214c data structure pro) +108 223.2 R .504(vided to)-.15 F F3(dbopen)3.004 E F0 .503 +(is de\214ned in the include \214le as)-.4 F(follo)108 +235.2 Q(ws:)-.25 E(typedef struct {)108 252 Q(u_long \215ags;)144 264 Q +(u_int cachesize;)144 276 Q(inde)144 288 Q(x_t psize;)-.15 E(int lorder;)144 +300 Q(int mink)144 312 Q -.15(ey)-.1 G(page;).15 E +(int \(*compare\)\(const DBT *k)144 324 Q -.15(ey)-.1 G(1, const DBT *k).15 E +-.15(ey)-.1 G(2\);).15 E(int \(*pre\214x\)\(const DBT *k)144 336 Q -.15(ey)-.1 +G(1, const DBT *k).15 E -.15(ey)-.1 G(2\);).15 E 2.5(}B)108 348 S(TREEINFO;) +121.97 348 Q(The elements of this structure are as follo)108 364.8 Q(ws:)-.25 E +14.61(\215ags The)108 381.6 R(\215ag v)2.5 E(alue is speci\214ed by)-.25 E F3 +(or)2.5 E F0('ing an).73 E 2.5(yo)-.15 G 2.5(ft)313.2 381.6 S(he follo)321.81 +381.6 Q(wing v)-.25 E(alues:)-.25 E(R_DUP)144 398.4 Q 1.296(Permit duplicate k) +180 410.4 R -.15(ey)-.1 G 3.796(si).15 G 3.796(nt)275.578 410.4 S 1.296 +(he tree, i.e. permit insertion if the k)287.154 410.4 R 1.596 -.15(ey t)-.1 H +3.796(ob).15 G 3.796(ei)466.878 410.4 S 1.296(nserted already)477.894 410.4 R +-.15(ex)180 422.4 S 1.935(ists in the tree.).15 F 1.935(The def)6.935 F 1.935 +(ault beha)-.1 F(vior)-.2 E 4.435(,a)-.4 G 4.435(sd)358.215 422.4 S 1.935 +(escribed in)371.54 422.4 R F3(dbopen)4.435 E F0 1.935(\(3\), is to o).24 F +-.15(ve)-.15 G 1.935(rwrite a).15 F .148(matching k)180 434.4 R .448 -.15(ey w) +-.1 H .148(hen inserting a ne).15 F 2.649(wk)-.25 G .449 -.15(ey o)329.709 +434.4 T 2.649(rt).15 G 2.649(of)355.407 434.4 S .149(ail if the R_NOO)366.286 +434.4 R(VER)-.5 E .149(WRITE \215ag is speci-)-.55 F 5.972(\214ed. The)180 +446.4 R 3.472(R_DUP \215ag is o)5.972 F -.15(ve)-.15 G 3.472 +(rridden by the R_NOO).15 F(VER)-.5 E 3.471(WRITE \215ag, and if the)-.55 F +(R_NOO)180 458.4 Q(VER)-.5 E .781 +(WRITE \215ag is speci\214ed, attempts to insert duplicate k)-.55 F -.15(ey)-.1 +G 3.282(si).15 G .782(nto the tree will)474.604 458.4 R -.1(fa)180 470.4 S(il.) +.1 E 1.13(If the database contains duplicate k)180 487.2 R -.15(ey)-.1 G 1.129 +(s, the order of retrie).15 F -.25(va)-.25 G 3.629(lo).25 G 3.629(fk)439.644 +487.2 S -.15(ey)451.503 487.2 S 1.129(/data pairs is unde-).15 F .837 +(\214ned if the)180 499.2 R F3 -.1(ge)3.337 G(t).1 E F0 .837 +(routine is used, ho)3.337 F(we)-.25 E -.15(ve)-.25 G -.4(r,).15 G F3(seq)3.737 +E F0 .838(routine calls with the R_CURSOR \215ag set)3.337 F(will al)180 511.2 +Q -.1(wa)-.1 G(ys return the logical `).1 E(`\214rst')-.74 E 2.5('o)-.74 G 2.5 +(fa)333.85 511.2 S .3 -.15(ny g)344.12 511.2 T(roup of duplicate k).15 E -.15 +(ey)-.1 G(s.).15 E(cachesize)108 528 Q 3.056(As)144 540 S .556 +(uggested maximum size \(in bytes\) of the memory cache.)158.166 540 R .555 +(This v)5.556 F .555(alue is)-.25 F F2(only)3.055 E F0(advisory)3.055 E 3.055 +(,a)-.65 G .555(nd the)514.725 540 R .759 +(access method will allocate more memory rather than f)144 552 R 3.259 +(ail. Since)-.1 F -2.15 -.25(ev e)3.259 H .76(ry search e).25 F .76 +(xamines the root)-.15 F .055 +(page of the tree, caching the most recently used pages substantially impro)144 +564 R -.15(ve)-.15 G 2.554(sa).15 G .054(ccess time.)459.578 564 R .054 +(In addi-)5.054 F .661(tion, ph)144 576 R .662(ysical writes are delayed as lo\ +ng as possible, so a moderate cache can reduce the number)-.05 F .601 +(of I/O operations signi\214cantly)144 588 R 5.601(.O)-.65 G -.15(bv)280.744 +588 S(iously).15 E 3.101(,u)-.65 G .601(sing a cache increases \(b)324.995 588 +R .6(ut only increases\) the lik)-.2 F(eli-)-.1 E .19(hood of corruption or lo\ +st data if the system crashes while a tree is being modi\214ed.)144 600 R(If) +5.191 E F3(cac)2.691 E(hesize)-.15 E F0(is)2.691 E 2.5(0\()144 612 S +(no size is speci\214ed\) a def)154.83 612 Q(ault cache is used.)-.1 E 12.95 +(psize P)108 628.8 R .45 +(age size is the size \(in bytes\) of the pages used for nodes in the tree.) +-.15 F .449(The minimum page size is)5.449 F .442 (512 bytes and the maximum page size is 64K.)144 640.8 R(If)5.442 E F3(psize) 2.942 E F0 .442(is 0 \(no page size is speci\214ed\) a page size)2.942 F (is chosen based on the underlying \214le system I/O block size.)144 652.8 Q -9.62(lorder The)108 669.6 R 1.586 -(byte order for integers in the stored database metadata.)4.086 F 1.585 -(The number should represent the)6.586 F .667 -(order as an integer; for example, big endian order would be the number 4,321.) -144 681.6 R(If)5.667 E F3(lor)3.167 E(der)-.37 E F0 .667(is 0 \(no)3.167 F -(order is speci\214ed\) the current host order is used.)144 693.6 Q(1)535 768 Q -EP +9.62(lorder The)108 669.6 R 1.597(byte order for inte)4.097 F 1.596 +(gers in the stored database metadata.)-.15 F 1.596 +(The number should represent the)6.596 F .688(order as an inte)144 681.6 R .689 +(ger; for e)-.15 F .689(xample, big endian order w)-.15 F .689 +(ould be the number 4,321.)-.1 F(If)5.689 E F3(lor)3.189 E(der)-.37 E F0 .689 +(is 0 \(no)3.189 F(order is speci\214ed\) the current host order is used.)144 +693.6 Q(1)535 768 Q EP %%Page: 2 2 %%BeginPageSetup BP %%EndPageSetup -/F0 10/Times-Roman@0 SF 378.84(BTREE\(3\) BTREE\(3\))72 48 R(minkeypage)108 84 -Q 1.384(The minimum number of keys which will be stored on any single page.)144 -96 R 1.384(This value is used to)6.384 F .202(determine which keys will be sto\ -red on over\215ow pages, i.e. if a key or data item is longer than the)144 108 -R 1.021(pagesize divided by the minkeypage value, it will be stored on over\ -\215ow pages instead of in the)144 120 R(page itself.)144 132 Q(If)5 E/F1 10 -/Times-Italic@0 SF(minkeypage)2.5 E F0 -(is 0 \(no minimum number of keys is speci\214ed\) a value of 2 is used.)2.5 E -(compare)108 148.8 Q .726(Compare is the key comparison function.)144 160.8 R -.726(It must return an integer less than, equal to, or greater)5.726 F .875 -(than zero if the \214rst key ar)144 172.8 R .875 -(gument is considered to be respectively less than, equal to, or greater)-.18 F -.286(than the second key ar)144 184.8 R 2.787(gument. The)-.18 F .287 -(same comparison function must be used on a given tree every)2.787 F .802 -(time it is opened.)144 196.8 R(If)5.802 E F1(compar)3.301 E(e)-.37 E F0 .801 -(is NULL \(no comparison function is speci\214ed\), the keys are com-)3.301 F -(pared lexically)144 208.8 Q 2.5(,w)-.65 G -(ith shorter keys considered less than longer keys.)214.72 208.8 Q 10.17 +/F0 10/Times-Roman@0 SF 378.84(BTREE\(3\) BTREE\(3\))72 48 R(mink)108 84 Q -.15 +(ey)-.1 G(page).15 E 1.423(The minimum number of k)144 96 R -.15(ey)-.1 G 3.923 +(sw).15 G 1.422(hich will be stored on an)282.245 96 R 3.922(ys)-.15 G 1.422 +(ingle page.)400.618 96 R 1.422(This v)6.422 F 1.422(alue is used to)-.25 F +.257(determine which k)144 108 R -.15(ey)-.1 G 2.757(sw).15 G .257 +(ill be stored on o)242.001 108 R -.15(ve)-.15 G(r\215o).15 E 2.757(wp)-.25 G +.257(ages, i.e. if a k)348.006 108 R .558 -.15(ey o)-.1 H 2.758(rd).15 G .258 +(ata item is longer than the)435.11 108 R 1.102(pagesize di)144 120 R 1.102 +(vided by the mink)-.25 F -.15(ey)-.1 G 1.102(page v).15 F 1.102 +(alue, it will be stored on o)-.25 F -.15(ve)-.15 G(r\215o).15 E 3.602(wp)-.25 +G 1.102(ages instead of in the)451.164 120 R(page itself.)144 132 Q(If)5 E/F1 +10/Times-Italic@0 SF(mink)2.5 E -.3(ey)-.1 G(pa).3 E -.1(ge)-.1 G F0 +(is 0 \(no minimum number of k)2.6 E -.15(ey)-.1 G 2.5(si).15 G 2.5(ss)392.84 +132 S(peci\214ed\) a v)403.12 132 Q(alue of 2 is used.)-.25 E(compare)108 148.8 +Q .751(Compare is the k)144 160.8 R 1.051 -.15(ey c)-.1 H .751 +(omparison function.).15 F .751(It must return an inte)5.751 F .752 +(ger less than, equal to, or greater)-.15 F .913(than zero if the \214rst k)144 +172.8 R 1.213 -.15(ey a)-.1 H -.18(rg).15 G .913 +(ument is considered to be respecti).18 F -.15(ve)-.25 G .913 +(ly less than, equal to, or greater).15 F .352(than the second k)144 184.8 R +.652 -.15(ey a)-.1 H -.18(rg).15 G 2.852(ument. The).18 F .353 +(same comparison function must be used on a gi)2.852 F -.15(ve)-.25 G 2.853(nt) +.15 G .353(ree e)503.127 184.8 R -.15(ve)-.25 G(ry).15 E .817 +(time it is opened.)144 196.8 R(If)5.817 E F1(compar)3.317 E(e)-.37 E F0 .817 +(is NULL \(no comparison function is speci\214ed\), the k)3.317 F -.15(ey)-.1 G +3.316(sa).15 G .816(re com-)508.364 196.8 R(pared le)144 208.8 Q(xically)-.15 E +2.5(,w)-.65 G(ith shorter k)214.57 208.8 Q -.15(ey)-.1 G 2.5(sc).15 G +(onsidered less than longer k)282.92 208.8 Q -.15(ey)-.1 G(s.).15 E 10.17 (pre\214x Pre\214x)108 225.6 R .291(is the pre\214x comparison function.)2.791 F .292(If speci\214ed, this routine must return the number of bytes)5.291 F -.908(of the second key ar)144 237.6 R .908(gument which are necessary to deter\ -mine that it is greater than the \214rst key)-.18 F(ar)144 249.6 Q 3.446 -(gument. If)-.18 F .946(the keys are equal, the key length should be returned.) -3.446 F .947(Note, the usefulness of this)5.946 F .535(routine is very data de\ -pendent, but, in some data sets can produce signi\214cantly reduced tree sizes) -144 261.6 R .354(and search times.)144 273.6 R(If)5.354 E F1(pr)2.854 E(e\214x) --.37 E F0 .354(is NULL \(no pre\214x function is speci\214ed\),)2.854 F/F2 10 -/Times-Bold@0 SF(and)2.854 E F0 .354(no comparison function)2.854 F .177 -(is speci\214ed, a default lexical comparison routine is used.)144 285.6 R(If) -5.177 E F1(pr)2.677 E(e\214x)-.37 E F0 .177(is NULL and a comparison rou-)2.677 -F(tine is speci\214ed, no pre\214x comparison is done.)144 297.6 Q .743(If the\ - \214le already exists \(and the O_TRUNC \215ag is not speci\214ed\), the valu\ -es speci\214ed for the parameters)108 314.4 R(\215ags, lorder and psize are ig\ -nored in favor of the values used when the tree was created.)108 326.4 Q -(Forward sequential scans of a tree are from the least key to the greatest.)108 -343.2 Q 1.005(Space freed up by deleting key/data pairs from the tree is never\ - reclaimed, although it is normally made)108 360 R 1.35(available for reuse.) -108 372 R 1.351(This means that the btree storage structure is grow-only)6.35 F -6.351(.T)-.65 G 1.351(he only solutions are to)441.266 372 R(avoid excessive d\ -eletions, or to create a fresh tree periodically from a scan of an existing on\ -e.)108 384 Q .326(Searches, insertions, and deletions in a btree will all comp\ -lete in O lg base N where base is the average \214ll)108 400.8 R(factor)108 -412.8 Q 5.77(.O)-.55 G .771 -(ften, inserting ordered data into btrees results in a low \214ll factor)146.26 -412.8 R 5.771(.T)-.55 G .771(his implementation has been)423.527 412.8 R(modi\ -\214ed to make ordered insertion the best case, resulting in a much better tha\ -n normal page \214ll factor)108 424.8 Q(.)-.55 E/F3 9/Times-Bold@0 SF(SEE ALSO) -72 441.6 Q F1(dbopen)108 453.6 Q F0(\(3\),).21 E F1(hash)2.5 E F0(\(3\),).23 E -F1(mpool)2.5 E F0(\(3\),).48 E F1 -.37(re)2.5 G(cno).37 E F0(\(3\)).17 E F1 -(The Ubiquitous B-tr)108 465.6 Q(ee)-.37 E F0 2.5(,D).18 G(ouglas Comer)209.47 -465.6 Q 2.5(,A)-.4 G(CM Comput. Surv)277.12 465.6 Q 2.5(.1)-.65 G -(1, 2 \(June 1979\), 121-138.)360.28 465.6 Q F1(The Art of Computer Pr)108 -477.6 Q(ogramming V)-.37 E(ol. 3: Sorting and Sear)-1.11 E(ching)-.37 E F0 2.5 -(,D).21 G(.E. Knuth, 1968, pp 471-480.)382.47 477.6 Q F3(BUGS)72 494.4 Q F0 -(Only big and little endian byte order is supported.)108 506.4 Q(2)535 768 Q EP +.937(of the second k)144 237.6 R 1.237 -.15(ey a)-.1 H -.18(rg).15 G .937 +(ument which are necessary to determine that it is greater than the \214rst k) +.18 F -.15(ey)-.1 G(ar)144 249.6 Q 3.477(gument. If)-.18 F .977(the k)3.477 F +-.15(ey)-.1 G 3.477(sa).15 G .977(re equal, the k)241.898 249.6 R 1.277 -.15 +(ey l)-.1 H .978(ength should be returned.).15 F .978 +(Note, the usefulness of this)5.978 F .558(routine is v)144 261.6 R .558 +(ery data dependent, b)-.15 F .558 +(ut, in some data sets can produce signi\214cantly reduced tree sizes)-.2 F +.354(and search times.)144 273.6 R(If)5.354 E F1(pr)2.854 E(e\214x)-.37 E F0 +.354(is NULL \(no pre\214x function is speci\214ed\),)2.854 F/F2 10 +/Times-Bold@0 SF(and)2.854 E F0 .354(no comparison function)2.854 F .193 +(is speci\214ed, a def)144 285.6 R .193(ault le)-.1 F .193 +(xical comparison routine is used.)-.15 F(If)5.192 E F1(pr)2.692 E(e\214x)-.37 +E F0 .192(is NULL and a comparison rou-)2.692 F +(tine is speci\214ed, no pre\214x comparison is done.)144 297.6 Q .79 +(If the \214le already e)108 314.4 R .79(xists \(and the O_TR)-.15 F .79 +(UNC \215ag is not speci\214ed\), the v)-.4 F .79 +(alues speci\214ed for the parameters)-.25 F +(\215ags, lorder and psize are ignored in f)108 326.4 Q -.2(avo)-.1 G 2.5(ro).2 +G 2.5(ft)284.4 326.4 S(he v)293.01 326.4 Q(alues used when the tree w)-.25 E +(as created.)-.1 E -.15(Fo)108 343.2 S(rw).15 E +(ard sequential scans of a tree are from the least k)-.1 E .3 -.15(ey t)-.1 H +2.5(ot).15 G(he greatest.)348.55 343.2 Q 1.043(Space freed up by deleting k)108 +360 R -.15(ey)-.1 G 1.043(/data pairs from the tree is ne).15 F -.15(ve)-.25 G +3.543(rr).15 G 1.043(eclaimed, although it is normally made)378.686 360 R -.2 +(av)108 372 S 1.394(ailable for reuse.)-.05 F 1.394 +(This means that the btree storage structure is gro)6.394 F(w-only)-.25 E 6.395 +(.T)-.65 G 1.395(he only solutions are to)441.09 372 R -.2(avo)108 384 S(id e) +.2 E(xcessi)-.15 E .3 -.15(ve d)-.25 H +(eletions, or to create a fresh tree periodically from a scan of an e).15 E +(xisting one.)-.15 E .344(Searches, insertions, and deletions in a btree will \ +all complete in O lg base N where base is the a)108 400.8 R -.15(ve)-.2 G .343 +(rage \214ll).15 F -.1(fa)108 412.8 S(ctor).1 E 5.798(.O)-.55 G .799 +(ften, inserting ordered data into btrees results in a lo)146.188 412.8 R 3.299 +<778c>-.25 G .799(ll f)377.505 412.8 R(actor)-.1 E 5.799(.T)-.55 G .799 +(his implementation has been)423.443 412.8 R(modi\214ed to mak)108 424.8 Q 2.5 +(eo)-.1 G(rdered insertion the best case, resulting in a much better than norm\ +al page \214ll f)185.4 424.8 Q(actor)-.1 E(.)-.55 E/F3 9/Times-Bold@0 SF +(SEE ALSO)72 441.6 Q F1(dbopen)108 453.6 Q F0(\(3\),).24 E F1(hash)2.5 E F0 +(\(3\),).28 E F1(mpool)2.5 E F0(\(3\),).51 E F1 -.37(re)2.5 G(cno).37 E F0 +(\(3\)).18 E F1(The Ubiquitous B-tr)108 477.6 Q(ee)-.37 E F0 2.5(,D).18 G +(ouglas Comer)209.47 477.6 Q 2.5(,A)-.4 G(CM Comput. Surv)276.72 477.6 Q 2.5 +(.1)-.65 G(1, 2 \(June 1979\), 121-138.)360.25 477.6 Q F1(Pr)108 501.6 Q 1.588 +(e\214x B-tr)-.37 F(ees)-.37 E F0 4.088(,B).27 G 1.587(ayer and Unterauer) +177.636 501.6 R 4.087(,A)-.4 G 1.587(CM T)270.447 501.6 R 1.587 +(ransactions on Database Systems, V)-.35 F 1.587(ol. 2, 1 \(March 1977\),)-1.29 +F(11-26.)108 513.6 Q F1(The Art of Computer Pr)108 537.6 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.)382 537.6 Q F3 -.09(BU)72 554.4 S +(GS).09 E F0(Only big and little endian byte order is supported.)108 566.4 Q(2) +535 768 Q EP %%Trailer end %%EOF diff --git a/lib/libc/DB/doc/dbopen.3.ps b/lib/libc/DB/doc/dbopen.3.ps index a4a4e99f5542..872c82e771c9 100644 --- a/lib/libc/DB/doc/dbopen.3.ps +++ b/lib/libc/DB/doc/dbopen.3.ps @@ -1,506 +1,496 @@ %!PS-Adobe-3.0 -%%Creator: groff version 1.03 +%%Creator: groff version 1.08 %%DocumentNeededResources: font Times-Roman %%+ font Times-Bold %%+ font Times-Italic -%%DocumentSuppliedResources: procset grops 1.03 0 +%%DocumentSuppliedResources: procset grops 1.08 0 %%Pages: 4 %%PageOrder: Ascend %%Orientation: Portrait %%EndComments %%BeginProlog -%%BeginResource: procset grops 1.03 0 - -/setpacking where { - pop - currentpacking - true setpacking -} if - -/grops 120 dict dup begin - -% The ASCII code of the space character. +%%BeginResource: procset grops 1.08 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 - -% name size font SF - - -/SF { - findfont exch - [ exch dup 0 exch 0 exch neg 0 0 ] makefont - dup setfont - [ exch /setfont cvx ] cvx bind def -} bind def - -% name a c d font MF - - -/MF { - findfont - [ 5 2 roll - 0 3 1 roll % b - neg 0 0 ] makefont - dup setfont - [ exch /setfont cvx ] cvx bind def -} bind 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 - -% BP - - -/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 - - -% centerx centery radius startangle endangle DA - - -/DA { - newpath arcn stroke -} bind def - -% x y SN - x' y' -% round a position to nearest (pixel + (.25,.25)) - -/SN { - transform - .25 sub exch .25 sub exch - round .25 add exch round .25 add exch - itransform -} bind def - -% endx endy startx starty DL - -% we round the endpoints of the line, so that parallel horizontal -% and vertical lines will appear even - -/DL { - SN - moveto - SN - lineto stroke -} bind def - -% centerx centery radius DC - - -/DC { - newpath 0 360 arc closepath -} 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 - -% width height centerx centery DE - - -/DE { - TM currentmatrix pop - translate scale newpath 0 0 .5 0 360 arc closepath - TM setmatrix -} bind def - -% these are for splines - -/RC /rcurveto load def -/RL /rlineto load def -/ST /stroke load def -/MT /moveto load def -/CL /closepath load def - -% fill the last path - -% amount FL - - -/FL { - currentgray exch setgray fill setgray -} bind def - -% fill with the ``current color'' - -/BL /fill load def - -/LW /setlinewidth load def -% new_font_name encoding_vector old_font_name RE - - -/RE { - findfont - dup maxlength dict begin - { - 1 index /FID ne { def } { pop pop } ifelse - } forall - /Encoding exch def - dup /FontName exch def - currentdict end definefont pop -} bind 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 - -% hpos vpos EBEGIN - - -/EBEGIN { - moveto - DEFS begin -} bind def - -/EEND /end load def - +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def /CNT 0 def /level1 0 def - -% llx lly newwid wid newht ht newllx newlly PBEGIN - - -/PBEGIN { - /level1 save def - translate - div 3 1 roll div exch scale - neg exch neg exch translate - % set the graphics state to default values - 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 - +/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 +/setpacking where{ +pop +setpacking +}if %%EndResource -%%EndProlog -%%BeginSetup %%IncludeResource: font Times-Roman %%IncludeResource: font Times-Bold %%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/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/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/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-Bold@0 ENC0/Times-Bold -RE/Times-Roman@0 ENC0/Times-Roman RE -%%EndSetup +/.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-Bold@0 ENC0/Times-Bold RE/Times-Roman@0 ENC0/Times-Roman RE +%%EndProlog %%Page: 1 1 %%BeginPageSetup BP %%EndPageSetup -/F0 10/Times-Roman@0 SF 169.84(DBOPEN\(3\) 1992 DBOPEN\(3\))72 48 R/F1 9 -/Times-Bold@0 SF(NAME)72 84 Q F0(dbopen \255 database access methods)108 96 Q -F1(SYNOPSIS)72 112.8 Q/F2 10/Times-Bold@0 SF(#include )108 124.8 Q -(#include )108 136.8 Q(#include )108 148.8 Q(DB *)108 172.8 Q +/F0 10/Times-Roman@0 SF 169.84(DBOPEN\(3\) 1993 DBOPEN\(3\))72 48 R/F1 9 +/Times-Bold@0 SF -.18(NA)72 84 S(ME).18 E F0 +(dbopen \255 database access methods)108 96 Q F1(SYNOPSIS)72 112.8 Q/F2 10 +/Times-Bold@0 SF(#include )108 124.8 Q(#include )108 +136.8 Q(#include )-.4 E(DB *)108 172.8 Q (dbopen\(const char *\214le, int \215ags, int mode, DBTYPE type,)108 184.8 Q -(const void *openinfo\);)158 196.8 Q F1(DESCRIPTION)72 213.6 Q/F3 10 -/Times-Italic@0 SF(Dbopen)108 225.6 Q F0 .026 -(is the library interface to database \214les.)2.526 F .025 -(The supported \214le formats are btree, hashed and UNIX \214le)5.025 F 2.82 +(const v)158 196.8 Q(oid *openinf)-.1 E(o\);)-.25 E F1(DESCRIPTION)72 213.6 Q +/F3 10/Times-Italic@0 SF(Dbopen)108 225.6 Q F0 .032(is the library interf)2.532 +F .031(ace to database \214les.)-.1 F .031 +(The supported \214le formats are btree, hashed and UNIX \214le)5.031 F 2.82 (oriented. The)108 237.6 R .32 (btree format is a representation of a sorted, balanced tree structure.)2.82 F -.321(The hashed format is an)5.321 F .389(extensible, dynamic hashing scheme.) -108 249.6 R .389(The \215at-\214le format is a byte stream \214le with \214xed\ - or variable length)5.389 F 2.88(records. The)108 261.6 R .38(formats and \214\ -le format speci\214c information are described in detail in their respective m\ -anual)2.88 F(pages)108 273.6 Q F3(btr)2.5 E(ee)-.37 E F0(\(3\),).18 E F3(hash) -2.5 E F0(\(3\) and).23 E F3 -.37(re)2.5 G(cno).37 E F0(\(3\).).17 E .401 -(Dbopen opens)108 290.4 R F3(\214le)2.901 E F0 .401 -(for reading and/or writing.)2.901 F .4 -(Files never intended to be preserved on disk may be created)5.401 F -(by setting the \214le parameter to NULL.)108 302.4 Q(The)108 319.2 Q F3 -(\215ags)4.613 E F0(and)4.613 E F3 2.113(mode ar)4.613 F(guments)-.37 E F0 -2.113(are as speci\214ed to the)4.613 F F3(open)4.613 E F0 2.114 -(\(2\) routine, however).21 F 4.614(,o)-.4 G 2.114(nly the O_CREA)460.122 319.2 -R -.74(T,)-1.11 G 2.519(O_EXCL, O_EXLOCK, O_RDONL)108 331.2 R 5.099 -1.29(Y, O) --1 H 2.519(_RDWR, O_SHLOCK and O_TRUNC \215ags are meaningful.)1.29 F -(\(Note, opening a database \214le O_WRONL)108 343.2 Q 2.5(Yi)-1 G 2.5(sn) -290.02 343.2 S(ot possible.\))301.41 343.2 Q(The)108 360 Q F3(type)5.315 E F0 -(ar)5.315 E 2.815(gument is of type DBTYPE \(as de\214ned in the includ\ -e \214le\) and may be set to)-.18 F(DB_BTREE, DB_HASH or DB_RECNO.)108 372 Q -(The)108 388.8 Q F3(openinfo)2.85 E F0(ar)2.85 E .349(gument is a pointer to a\ -n access method speci\214c structure described in the access method')-.18 F(s) --.55 E .024(manual page.)108 400.8 R(If)5.024 E F3(openinfo)2.524 E F0 .025(is\ - NULL, each access method will use defaults appropriate for the system and the) -2.524 F(access method.)108 412.8 Q F3(Dbopen)108 429.6 Q F0 .416 +.321(The hashed format is an)5.321 F -.15(ex)108 249.6 S .424 +(tensible, dynamic hashing scheme.).15 F .423 +(The \215at-\214le format is a byte stream \214le with \214x)5.423 F .423 +(ed or v)-.15 F .423(ariable length)-.25 F 2.906(records. The)108 261.6 R .407 +(formats and \214le format speci\214c information are described in detail in t\ +heir respecti)2.906 F .707 -.15(ve m)-.25 H(anual).15 E(pages)108 273.6 Q F3 +(btr)2.5 E(ee)-.37 E F0(\(3\),).18 E F3(hash)2.5 E F0(\(3\) and).28 E F3 -.37 +(re)2.5 G(cno).37 E F0(\(3\).).18 E .433(Dbopen opens)108 290.4 R F3(\214le) +2.933 E F0 .433(for reading and/or writing.)2.933 F .433(Files ne)5.433 F -.15 +(ve)-.25 G 2.933(ri).15 G .433(ntended to be preserv)346.737 290.4 R .433 +(ed on disk may be created)-.15 F(by setting the \214le parameter to NULL.)108 +302.4 Q(The)108 319.2 Q F3<8d61>4.661 E(gs)-.1 E F0(and)4.661 E F3 2.161 +(mode ar)4.661 F(guments)-.37 E F0 2.161(are as speci\214ed to the)4.661 F F3 +(open)4.661 E F0 2.162(\(2\) routine, ho).24 F(we)-.25 E -.15(ve)-.25 G 2.962 +-.4(r, o).15 H 2.162(nly the O_CREA).4 F -.74(T,)-1.11 G 2.597 +(O_EXCL, O_EXLOCK, O_RDONL)108 331.2 R 5.177 -1.29(Y, O)-1 H(_RD)1.29 E 2.597 +(WR, O_SHLOCK and O_TR)-.3 F 2.596(UNC \215ags are meaningful.)-.4 F +(\(Note, opening a database \214le O_WR)108 343.2 Q(ONL)-.4 E 2.5(Yi)-1 G 2.5 +(sn)289.62 343.2 S(ot possible.\))301.01 343.2 Q(The)108 360 Q F3(type)5.337 E +F0(ar)5.337 E 2.837(gument is of type DBTYPE \(as de\214ned in the include \214le\) and may be set to)-.4 F +(DB_BTREE, DB_HASH or DB_RECNO.)108 372 Q(The)108 388.8 Q F3(openinfo)2.85 E F0 +(ar)2.85 E .349(gument is a pointer to an access method speci\214c structure d\ +escribed in the access method')-.18 F(s)-.55 E .03(manual page.)108 400.8 R(If) +5.03 E F3(openinfo)2.53 E F0 .031(is NULL, each access method will use def)2.53 +F .031(aults appropriate for the system and the)-.1 F(access method.)108 412.8 +Q F3(Dbopen)108 429.6 Q F0 .416 (returns a pointer to a DB structure on success and NULL on error)2.917 F 5.416 -(.T)-.55 G .416(he DB structure is de\214ned in)423.21 429.6 R -(the include \214le, and contains at least the following \214elds:)108 -441.6 Q(typedef struct {)108 465.6 Q(DBTYPE type;)144 477.6 Q +(.T)-.55 G .416(he DB structure is de\214ned in)423.21 429.6 R(the include \214le, and contains at least the follo)-.4 E +(wing \214elds:)-.25 E(typedef struct {)108 465.6 Q(DBTYPE type;)144 477.6 Q (int \(*close\)\(const DB *db\);)144 489.6 Q -(int \(*del\)\(const DB *db, const DBT *key)144 501.6 Q 2.5(,u)-.65 G -(_int \215ags\);)319.17 501.6 Q(int \(*get\)\(const DB *db, DBT *key)144 513.6 -Q 2.5(,D)-.65 G(BT *data, u_int \215ags\);)297.78 513.6 Q -(int \(*put\)\(const DB *db, DBT *key)144 525.6 Q 2.5(,c)-.65 G -(onst DBT *data,)295.56 525.6 Q(u_int \215ags\);)194 537.6 Q -(int \(*sync\)\(const DB *db\);)144 549.6 Q -(int \(*seq\)\(const DB *db, DBT *key)144 561.6 Q 2.5(,D)-.65 G -(BT *data, u_int \215ags\);)298.89 561.6 Q 2.5(}D)108 573.6 S(B;)122.52 573.6 Q -.084(These elements describe a database type and a set of functions performing\ - various actions.)108 590.4 R .084(These functions)5.084 F .521 -(take a pointer to a structure as returned by)108 602.4 R F3(dbopen)3.021 E F0 -3.021(,a).21 G .52(nd sometimes one or more pointers to key/data struc-)323.09 -602.4 R(tures and a \215ag value.)108 614.4 Q 16.28(type The)108 631.2 R +(int \(*del\)\(const DB *db, const DBT *k)144 501.6 Q -.15(ey)-.1 G 2.5(,u)-.5 +G(_int \215ags\);)318.92 501.6 Q(int \(*fd\)\(const DB *db\);)144 513.6 Q +(int \(*get\)\(const DB *db, DBT *k)144 525.6 Q -.15(ey)-.1 G 2.5(,D)-.5 G +(BT *data, u_int \215ags\);)297.53 525.6 Q(int \(*put\)\(const DB *db, DBT *k) +144 537.6 Q -.15(ey)-.1 G 2.5(,c)-.5 G(onst DBT *data,)295.31 537.6 Q +(u_int \215ags\);)194 549.6 Q(int \(*sync\)\(const DB *db, u_int \215ags\);)144 +561.6 Q(int \(*seq\)\(const DB *db, DBT *k)144 573.6 Q -.15(ey)-.1 G 2.5(,D)-.5 +G(BT *data, u_int \215ags\);)298.64 573.6 Q 2.5(}D)108 585.6 S(B;)122.52 585.6 +Q .101 +(These elements describe a database type and a set of functions performing v) +108 602.4 R .101(arious actions.)-.25 F .101(These functions)5.101 F(tak)108 +614.4 Q 3.039(eap)-.1 G .539(ointer to a structure as returned by)140.078 614.4 +R F3(dbopen)3.038 E F0 3.038(,a).24 G .538 +(nd sometimes one or more pointers to k)323.196 614.4 R -.15(ey)-.1 G .538 +(/data struc-).15 F(tures and a \215ag v)108 626.4 Q(alue.)-.25 E 16.28 +(type The)108 643.2 R (type of the underlying access method \(and \214le format\).)2.5 E 12.95 -(close A)108 648 R .97(pointer to a routine to \215ush any cached information \ -to disk, free any allocated resources, and)3.47 F .09 -(close the underlying \214le\(s\).)144 660 R .089 -(Since key/data pairs may be cached in memory)5.09 F 2.589(,f)-.65 G .089 -(ailing to sync the \214le)455.754 660 R .494(with a)144 672 R F3(close)2.994 E +(close A)108 660 R .988(pointer to a routine to \215ush an)3.488 F 3.489(yc) +-.15 G .989(ached information to disk, free an)293.968 660 R 3.489(ya)-.15 G +.989(llocated resources, and)446.662 660 R .112 +(close the underlying \214le\(s\).)144 672 R .111(Since k)5.112 F -.15(ey)-.1 G +.111(/data pairs may be cached in memory).15 F 2.611(,f)-.65 G .111 +(ailing to sync the \214le)455.666 672 R .494(with a)144 684 R F3(close)2.994 E F0(or)2.994 E F3(sync)2.994 E F0 .495 (function may result in inconsistent or lost information.)2.994 F F3(Close) -5.495 E F0 .495(routines return)2.995 F(-1 on error \(setting)144 684 Q F3 -(errno)2.5 E F0 2.5(\)a).17 G(nd 0 on success.)254.42 684 Q 21.28(del A)108 -700.8 R(pointer to a routine to remove key/data pairs from the database.)2.5 E -(The parameter)144 717.6 Q F3(\215ag)2.5 E F0 -(may be set to the following value:)2.5 E 203.455(4, December)72 768 R(1)535 -768 Q EP +5.495 E F0 .495(routines return)2.995 F(-1 on error \(setting)144 696 Q F3 +(errno)2.5 E F0 2.5(\)a).18 G(nd 0 on success.)254.43 696 Q 21.28(del A)108 +712.8 R(pointer to a routine to remo)2.5 E .3 -.15(ve k)-.15 H -.15(ey).05 G +(/data pairs from the database.).15 E 209.835(24, May)72 768 R(1)535 768 Q EP %%Page: 2 2 %%BeginPageSetup BP %%EndPageSetup -/F0 10/Times-Roman@0 SF 169.84(DBOPEN\(3\) 1992 DBOPEN\(3\))72 48 R(R_CURSOR) -144 84 Q .243(Delete the record referenced by the cursor)180 96 R 5.242(.T)-.55 -G .242(he cursor must have previously been initial-)363.018 96 R(ized.)180 108 -Q/F1 10/Times-Italic@0 SF(Delete)144 124.8 Q F0 .004 -(routines return -1 on error \(setting)2.504 F F1(errno)2.504 E F0 .004 -(\), 0 on success, and 1 if the speci\214ed).17 F F1(key)2.505 E F0 .005 -(was not in)2.505 F(the \214le.)144 136.8 Q 21.28(get A)108 153.6 R 1.006(poin\ -ter to a routine which is the interface for keyed retrieval from the database.) -3.507 F 1.006(The address)6.006 F .417 -(and length of the data associated with the speci\214ed)144 165.6 R F1(key) -2.917 E F0 .417(are returned in the structure referenced by)2.917 F F1(data)144 -177.6 Q F0(.).24 E F1(Get)5.478 E F0 .478 -(routines return -1 on error \(setting)2.978 F F1(errno)2.978 E F0 .477 -(\), 0 on success, and 1 if the).17 F F1(key)2.977 E F0 .477(was not in the) -2.977 F(\214le.)144 189.6 Q 20.72(put A)108 206.4 R -(pointer to a routine to store key/data pairs in the database.)2.5 E -(The parameter)144 223.2 Q F1(\215ag)2.5 E F0 -(may be set to one of the following values:)2.5 E(R_CURSOR)144 240 Q 1.766 -(Replace the key/data pair referenced by the cursor)180 252 R 6.767(.T)-.55 G -1.767(he cursor must have previously)407.952 252 R(been initialized.)180 264 Q -(R_CURSORLOG)144 280.8 Q 1.923 -(Store the data into the tree after the record referenced by the cursor)180 -292.8 R 4.423(,c)-.4 G 1.923(reating a new)482.284 292.8 R 1.672(key/data pair\ - if the database is empty or if the cursor references the last entry in the)180 -304.8 R 1.211(database, otherwise overwriting the record after the cursor)180 -316.8 R 6.211(.I)-.55 G 3.711(ft)433.228 316.8 S 1.21 -(he cursor is unitialized,)443.049 316.8 R .56 -(the \214rst record in the database is created or overwritten.)180 328.8 R .561 -(In any case, the cursor is set to)5.561 F .489(reference the stored record, a\ -nd the record number of the stored record is returned in the)180 340.8 R F1 -(key)180 352.8 Q F0 2.5(structure. \(Applicable)2.5 F -(only to the DB_RECNO access method.\))2.5 E(R_IAFTER)144 369.6 Q 1.1 -(Append the data immediately after the data referenced by)180 381.6 R F1(key) -3.6 E F0 3.6(,c).26 G 1.1(reating a new key/data)446.45 381.6 R(pair)180 393.6 -Q 6.019(.T)-.55 G 1.019 -(he record number of the appended key/data pair is returned in the)209.629 -393.6 R F1(key)3.518 E F0(structure.)3.518 E -(\(Applicable only to the DB_RECNO access method.\))180 405.6 Q(R_IBEFORE)144 -422.4 Q 1.228(Insert the data immediately before the data referenced by)180 -434.4 R F1(key)3.729 E F0 3.729(,c).26 G 1.229(reating a new key/data)446.063 -434.4 R(pair)180 446.4 Q 6.495(.T)-.55 G 1.494 -(he record number of the inserted key/data pair is returned in the)210.105 -446.4 R F1(key)3.994 E F0(structure.)3.994 E -(\(Applicable only to the DB_RECNO access method.\))180 458.4 Q(R_NOOVER)144 -475.2 Q(WRITE)-.55 E -(Enter the new key/data pair only if the key does not previously exist.)180 -487.2 Q(R_SETCURSOR)144 504 Q 1.341(Store the key/data pair)180 516 R 3.841(,s) --.4 G 1.342(etting or initializing the position of the cursor to reference it.) -284.114 516 R(\(Applicable only to the DB_BTREE and DB_RECNO access methods.\)) -180 528 Q .523(R_SETCURSOR is available only for the DB_BTREE and DB_RECNO acc\ -ess methods because)144 544.8 R -(it implies that the keys have an inherent order which does not change.)144 -556.8 Q 1.353(R_CURSORLOG, R_IAFTER and R_IBEFORE are available only for the D\ -B_RECNO access)144 573.6 R .765(method because they each imply that the access\ - method is able to create new keys.)144 585.6 R .765(This is only)5.765 F -(true if the keys are ordered and independent, record numbers for example.)144 -597.6 Q .213(The default behavior of the)144 614.4 R F1(put)2.714 E F0 .214 -(routines is to enter the new key/data pair)2.714 F 2.714(,r)-.4 G .214 -(eplacing any previously)444.032 614.4 R(existing key)144 626.4 Q(.)-.65 E F1 -(Put)144 643.2 Q F0 .333(routines return -1 on error \(setting)2.834 F F1 -(errno)2.833 E F0 .333(\), 0 on success, and 1 if the R_NOOVER).17 F(WRITE)-.55 -E F1(\215ag)2.833 E F0(was set and the key already exists in the \214le.)144 -655.2 Q 20.17(seq A)108 672 R 2.128(pointer to a routine which is the interfac\ -e for sequential retrieval from the database.)4.628 F(The)7.128 E .541 -(address and length of the key are returned in the structure referenced by)144 -684 R F1(key)3.041 E F0 3.041(,a).26 G .541(nd the address and)464.227 684 R -(length of the data are returned in the structure referenced by)144 696 Q F1 -(data)2.5 E F0(.).24 E .847(Sequential key/data pair retrieval may begin at an\ -y time, and the position of the `)144 712.8 R -2.13(`cursor ')-.74 F 3.348('i) --.74 G 3.348(sn)519.982 712.8 S(ot)532.22 712.8 Q(af)144 724.8 Q 1.587 -(fected by calls to the)-.18 F F1(del)4.087 E F0(,).48 E F1(get)4.087 E F0(,).6 -E F1(put)4.087 E F0 4.087(,o).6 G(r)308.446 724.8 Q F1(sync)4.087 E F0 4.087 -(routines. Modi\214cations)4.087 F 1.587(to the database during a)4.087 F -203.455(4, December)72 768 R(2)535 768 Q EP +/F0 10/Times-Roman@0 SF 169.84(DBOPEN\(3\) 1993 DBOPEN\(3\))72 48 R +(The parameter)144 84 Q/F1 10/Times-Italic@0 SF<8d61>2.5 E(g)-.1 E F0 +(may be set to the follo)2.5 E(wing v)-.25 E(alue:)-.25 E(R_CURSOR)144 100.8 Q +.289(Delete the record referenced by the cursor)180 112.8 R 5.288(.T)-.55 G +.288(he cursor must ha)363.342 112.8 R .588 -.15(ve p)-.2 H(re).15 E .288 +(viously been initial-)-.25 F(ized.)180 124.8 Q F1(Delete)144 141.6 Q F0 .03 +(routines return -1 on error \(setting)2.53 F F1(errno)2.53 E F0 .03 +(\), 0 on success, and 1 if the speci\214ed).18 F F1 -.1(ke)2.53 G(y)-.2 E F0 +-.1(wa)2.53 G 2.53(sn).1 G .03(ot in)521.91 141.6 R(the \214le.)144 153.6 Q +25.17(fd A)108 170.4 R .451 +(pointer to a routine which returns a \214le descriptor representati)2.951 F +.75 -.15(ve o)-.25 H 2.95(ft).15 G .45(he underlying database.)431.73 170.4 R +(A)5.45 E .942(\214le descriptor referencing the same \214le will be returned \ +to all processes which call)144 182.4 R F1(dbopen)3.442 E F0(with)3.442 E 1.629 +(the same)144 194.4 R F1(\214le)4.129 E F0 4.129(name. This)4.129 F 1.628 +(\214le descriptor may be safely used as a ar)4.128 F 1.628(gument to the)-.18 +F F1(fcntl)4.128 E F0 1.628(\(2\) and).51 F F1(\215oc)144 206.4 Q(k)-.2 E F0 +.425(\(2\) locking functions.).67 F .425 +(The \214le descriptor is not necessarily associated with an)5.425 F 2.925(yo) +-.15 G 2.925(ft)492.7 206.4 S .425(he under)501.735 206.4 R(-)-.2 E .198 +(lying \214les used by the access method.)144 218.4 R .198 +(No \214le descriptor is a)5.198 F -.25(va)-.2 G .198 +(ilable for in memory databases.).25 F F1(Fd)5.198 E F0 +(routines return -1 on error \(setting)144 230.4 Q F1(errno)2.5 E F0 +(\), and the \214le descriptor on success.).18 E 21.28(get A)108 247.2 R +(pointer to a routine which is the interf)2.5 E .001(ace for k)-.1 F -.15(ey) +-.1 G .001(ed retrie).15 F -.25(va)-.25 G 2.501(lf).25 G .001 +(rom the database.)399.755 247.2 R .001(The address and)5.001 F .061 +(length of the data associated with the speci\214ed)144 259.2 R F1 -.1(ke)2.561 +G(y)-.2 E F0 .06(are returned in the structure referenced by)2.561 F F1(data) +2.56 E F0(.).26 E F1(Get)144 271.2 Q F0(routines return -1 on error \(setting) +2.5 E F1(errno)2.5 E F0(\), 0 on success, and 1 if the).18 E F1 -.1(ke)2.5 G(y) +-.2 E F0 -.1(wa)2.5 G 2.5(sn).1 G(ot in the \214le.)471.66 271.2 Q 20.72(put A) +108 288 R(pointer to a routine to store k)2.5 E -.15(ey)-.1 G +(/data pairs in the database.).15 E(The parameter)144 304.8 Q F1<8d61>2.5 E(g) +-.1 E F0(may be set to one of the follo)2.5 E(wing v)-.25 E(alues:)-.25 E +(R_CURSOR)144 321.6 Q .051(Replace the k)180 333.6 R -.15(ey)-.1 G .051 +(/data pair referenced by the cursor).15 F 5.052(.T)-.55 G .052 +(he cursor must ha)393.98 333.6 R .352 -.15(ve p)-.2 H(re).15 E .052 +(viously been)-.25 F(initialized.)180 345.6 Q(R_IAFTER)144 362.4 Q 1.165 +(Append the data immediately after the data referenced by)180 374.4 R F1 -.1 +(ke)3.664 G(y)-.2 E F0 3.664(,c).32 G 1.164(reating a ne)446.758 374.4 R 3.664 +(wk)-.25 G -.15(ey)511.27 374.4 S(/data).15 E(pair)180 386.4 Q 6.065(.T)-.55 G +1.065(he record number of the appended k)209.675 386.4 R -.15(ey)-.1 G 1.065 +(/data pair is returned in the).15 F F1 -.1(ke)3.565 G(y)-.2 E F0(structure.) +3.565 E(\(Applicable only to the DB_RECNO access method.\))180 398.4 Q +(R_IBEFORE)144 415.2 Q 1.293 +(Insert the data immediately before the data referenced by)180 427.2 R F1 -.1 +(ke)3.793 G(y)-.2 E F0 3.793(,c).32 G 1.293(reating a ne)446.371 427.2 R 3.793 +(wk)-.25 G -.15(ey)511.27 427.2 S(/data).15 E(pair)180 439.2 Q 6.54(.T)-.55 G +1.54(he record number of the inserted k)210.15 439.2 R -.15(ey)-.1 G 1.541 +(/data pair is returned in the).15 F F1 -.1(ke)4.041 G(y)-.2 E F0(structure.) +4.041 E(\(Applicable only to the DB_RECNO access method.\))180 451.2 Q(R_NOO) +144 468 Q(VER)-.5 E(WRITE)-.55 E(Enter the ne)180 480 Q 2.5(wk)-.25 G -.15(ey) +242.69 480 S(/data pair only if the k).15 E .3 -.15(ey d)-.1 H(oes not pre).15 +E(viously e)-.25 E(xist.)-.15 E(R_SETCURSOR)144 496.8 Q 1.36(Store the k)180 +508.8 R -.15(ey)-.1 G 1.36(/data pair).15 F 3.86(,s)-.4 G 1.359 +(etting or initializing the position of the cursor to reference it.)283.94 +508.8 R(\(Applicable only to the DB_BTREE and DB_RECNO access methods.\))180 +520.8 Q .563(R_SETCURSOR is a)144 537.6 R -.25(va)-.2 G .564 +(ilable only for the DB_BTREE and DB_RECNO access methods because).25 F +(it implies that the k)144 549.6 Q -.15(ey)-.1 G 2.5(sh).15 G -2.25 -.2(av e) +241.81 549.6 T(an inherent order which does not change.)2.7 E .416 +(R_IAFTER and R_IBEFORE are a)144 566.4 R -.25(va)-.2 G .416 +(ilable only for the DB_RECNO access method because the).25 F(y)-.15 E 1.221 +(each imply that the access method is able to create ne)144 578.4 R 3.722(wk) +-.25 G -.15(ey)385.644 578.4 S 3.722(s. This).15 F 1.222(is only true if the k) +3.722 F -.15(ey)-.1 G 3.722(sa).15 G(re)532.23 578.4 Q +(ordered and independent, record numbers for e)144 590.4 Q(xample.)-.15 E .289 +(The def)144 607.2 R .289(ault beha)-.1 F .289(vior of the)-.2 F F1(put)2.789 E +F0 .289(routines is to enter the ne)2.789 F 2.789(wk)-.25 G -.15(ey)388.998 +607.2 S .288(/data pair).15 F 2.788(,r)-.4 G .288(eplacing an)444.284 607.2 R +2.788(yp)-.15 G(re)503.03 607.2 Q(viously)-.25 E -.15(ex)144 619.2 S(isting k) +.15 E -.15(ey)-.1 G(.)-.5 E F1(Put)144 636 Q F0 .37 +(routines return -1 on error \(setting)2.87 F F1(errno)2.87 E F0 .37 +(\), 0 on success, and 1 if the R_NOO).18 F(VER)-.5 E(WRITE)-.55 E F1<8d61>2.87 +E(g)-.1 E F0 -.1(wa)144 648 S 2.5(ss).1 G(et and the k)165.84 648 Q .3 -.15 +(ey a)-.1 H(lready e).15 E(xists in the \214le.)-.15 E 20.17(seq A)108 664.8 R +.002(pointer to a routine which is the interf)2.502 F .002 +(ace for sequential retrie)-.1 F -.25(va)-.25 G 2.502(lf).25 G .002 +(rom the database.)416.694 664.8 R .001(The address)5.001 F .219 +(and length of the k)144 676.8 R .519 -.15(ey a)-.1 H .219 +(re returned in the structure referenced by).15 F F1 -.1(ke)2.72 G(y)-.2 E F0 +2.72(,a).32 G .22(nd the address and length of)426.42 676.8 R +(the data are returned in the structure referenced by)144 688.8 Q F1(data)2.5 E +F0(.).26 E .937(Sequential k)144 705.6 R -.15(ey)-.1 G .937(/data pair retrie) +.15 F -.25(va)-.25 G 3.437(lm).25 G .936(ay be)289.748 705.6 R .936(gin at an) +-.15 F 3.436(yt)-.15 G .936(ime, and the position of the `)359.292 705.6 R +(`cursor')-.74 E 3.436('i)-.74 G 3.436(sn)519.894 705.6 S(ot)532.22 705.6 Q(af) +144 717.6 Q 1.585(fected by calls to the)-.25 F F1(del)4.085 E F0(,).51 E F1 +-.1(ge)4.085 G(t).1 E F0(,).68 E F1(put)4.086 E F0 4.086(,o).68 G(r)308.452 +717.6 Q F1(sync)4.086 E F0 4.086(routines. Modi\214cations)4.086 F 1.586 +(to the database during a)4.086 F 1.404(sequential scan will be re\215ected in\ + the scan, i.e. records inserted behind the cursor will not be)144 729.6 R +209.835(24, May)72 768 R(2)535 768 Q EP %%Page: 3 3 %%BeginPageSetup BP %%EndPageSetup -/F0 10/Times-Roman@0 SF 169.84(DBOPEN\(3\) 1992 DBOPEN\(3\))72 48 R 1.404(sequ\ -ential scan will be re\215ected in the scan, i.e. records inserted behind the \ -cursor will not be)144 84 R +/F0 10/Times-Roman@0 SF 169.84(DBOPEN\(3\) 1993 DBOPEN\(3\))72 48 R (returned while records inserted in front of the cursor will be returned.)144 -96 Q(The \215ag value)144 112.8 Q/F1 10/Times-Bold@0 SF(must)2.5 E F0 -(be set to one of the following values:)2.5 E(R_CURSOR)144 129.6 Q .494 -(The data associated with the speci\214ed key is returned.)180 141.6 R .493 -(This dif)5.493 F .493(fers from the)-.18 F/F2 10/Times-Italic@0 SF(get)2.993 E -F0(routines)2.993 E 1.129 -(in that it sets or initializes the cursor to the location of the key as well.) -180 153.6 R 1.129(\(Note, for the)6.129 F 1.245(DB_BTREE access method, the re\ -turned key is not necessarily an exact match for the)180 165.6 R .548 -(speci\214ed key)180 177.6 R 5.548(.T)-.65 G .548 -(he returned key is the smallest key greater than or equal to the speci\214ed) -246.546 177.6 R(key)180 189.6 Q 2.5(,p)-.65 G -(ermitting partial key matches and range searches.\))203.79 189.6 Q(R_FIRST)144 -206.4 Q 1.028(The \214rst key/data pair of the database is returned, and the c\ -ursor is set or initialized to)180 218.4 R(reference it.)180 230.4 Q(R_LAST)144 -247.2 Q .07(The last key/data pair of the database is returned, and the cursor\ - is set or initialized to ref-)180 259.2 R(erence it.)180 271.2 Q -(\(Applicable only to the DB_BTREE and DB_RECNO access methods.\))5 E(R_NEXT) -144 288 Q .264(Retrieve the key/data pair immediately after the cursor)180 300 -R 5.264(.I)-.55 G 2.764(ft)410.952 300 S .263 -(he cursor is not yet set, this is)419.826 300 R -(the same as the R_FIRST \215ag.)180 312 Q(R_PREV)144 328.8 Q .411 -(Retrieve the key/data pair immediately before the cursor)180 340.8 R 5.411(.I) --.55 G 2.911(ft)419.348 340.8 S .412(he cursor is not yet set, this)428.369 -340.8 R .621(is the same as the R_LAST \215ag.)180 352.8 R .621 +84 Q(The \215ag v)144 100.8 Q(alue)-.25 E/F1 10/Times-Bold@0 SF(must)2.5 E F0 +(be set to one of the follo)2.5 E(wing v)-.25 E(alues:)-.25 E(R_CURSOR)144 +117.6 Q .523(The data associated with the speci\214ed k)180 129.6 R .824 -.15 +(ey i)-.1 H 3.024(sr).15 G 3.024(eturned. This)367.236 129.6 R(dif)3.024 E .524 +(fers from the)-.25 F/F2 10/Times-Italic@0 SF -.1(ge)3.024 G(t).1 E F0 +(routines)3.024 E 1.143 +(in that it sets or initializes the cursor to the location of the k)180 141.6 R +1.443 -.15(ey a)-.1 H 3.642(sw).15 G 3.642(ell. \(Note,)464.924 141.6 R 1.142 +(for the)3.642 F 1.275(DB_BTREE access method, the returned k)180 153.6 R 1.575 +-.15(ey i)-.1 H 3.775(sn).15 G 1.276(ot necessarily an e)386.425 153.6 R 1.276 +(xact match for the)-.15 F .598(speci\214ed k)180 165.6 R -.15(ey)-.1 G 5.598 +(.T)-.5 G .598(he returned k)246.396 165.6 R .898 -.15(ey i)-.1 H 3.098(st).15 +G .598(he smallest k)325.188 165.6 R .898 -.15(ey g)-.1 H .598 +(reater than or equal to the speci\214ed).15 F -.1(ke)180 177.6 S 1.3 -.65 +(y, p)-.05 H(ermitting partial k).65 E .3 -.15(ey m)-.1 H +(atches and range searches.\)).15 E(R_FIRST)144 194.4 Q 1.043(The \214rst k)180 +206.4 R -.15(ey)-.1 G 1.044(/data pair of the database is returned, and the cu\ +rsor is set or initialized to).15 F(reference it.)180 218.4 Q(R_LAST)144 235.2 +Q .085(The last k)180 247.2 R -.15(ey)-.1 G .085(/data pair of the database is\ + returned, and the cursor is set or initialized to ref-).15 F(erence it.)180 +259.2 Q(\(Applicable only to the DB_BTREE and DB_RECNO access methods.\))5 E +(R_NEXT)144 276 Q(Retrie)180 288 Q .604 -.15(ve t)-.25 H .304(he k).15 F -.15 +(ey)-.1 G .304(/data pair immediately after the cursor).15 F 5.304(.I)-.55 G +2.804(ft)410.622 288 S .305(he cursor is not yet set, this is)419.536 288 R +(the same as the R_FIRST \215ag.)180 300 Q(R_PREV)144 316.8 Q(Retrie)180 328.8 +Q .755 -.15(ve t)-.25 H .455(he k).15 F -.15(ey)-.1 G .455 +(/data pair immediately before the cursor).15 F 5.455(.I)-.55 G 2.955(ft)419.05 +328.8 S .454(he cursor is not yet set, this)428.115 328.8 R .62 +(is the same as the R_LAST \215ag.)180 340.8 R .621 (\(Applicable only to the DB_BTREE and DB_RECNO)5.621 F(access methods.\))180 -364.8 Q .873(R_LAST and R_PREV are available only for the DB_BTREE and DB_RECN\ -O access methods)144 381.6 R(because they each imply that the keys have an inh\ -erent order which does not change.)144 393.6 Q F2(Seq)144 410.4 Q F0 .049 -(routines return -1 on error \(setting)2.549 F F2(errno)2.549 E F0 .048 -(\), 0 on success and 1 if there are no key/data pairs less).17 F .333 -(than or greater than the speci\214ed or current key)144 422.4 R 5.334(.I)-.65 -G 2.834(ft)346.572 422.4 S .334(he DB_RECNO access method is being used,) -355.516 422.4 R 1.562(and if the database \214le is a character special \214le\ - and no complete key/data pairs are currently)144 434.4 R(available, the)144 -446.4 Q F2(seq)2.5 E F0(routines return 2.)2.5 E 15.17(sync A)108 463.2 R .449 -(pointer to a routine to \215ush any cached information to disk.)2.948 F .449 -(If the database is in memory only)5.449 F(,)-.65 E(the)144 475.2 Q F2(sync) -3.414 E F0 .913(routine has no ef)3.414 F .913(fect and will always succeed.) --.18 F F2(Sync)5.913 E F0 .913(routines return -1 on error \(setting)3.413 F F2 -(errno)144 487.2 Q F0 2.5(\)a).17 G(nd 0 on success.)176.66 487.2 Q/F3 9 -/Times-Bold@0 SF(KEY/DA)72 504 Q 1.332 -.666(TA PA)-.666 H(IRS).666 E F0 .094 -(Access to all \214le types is based on key/data pairs.)108 516 R .095 -(Both keys and data are represented by the following data)5.095 F(structure:) -108 528 Q(typedef struct {)108 544.8 Q(void *data;)144 556.8 Q(size_t size;)144 -568.8 Q 2.5(}D)108 580.8 S(BT)122.52 580.8 Q(;)-.55 E -(The elements of the DBT structure are de\214ned as follows:)108 597.6 Q 16.84 -(data A)108 614.4 R(pointer to a byte string.)2.5 E 17.95(size The)108 631.2 R -(length of the byte string.)2.5 E .788(Key and data byte strings may reference\ - strings of essentially unlimited length although any two of them)108 648 R 1.1 -(must \214t into available memory at the same time.)108 660 R 1.101 -(It should be noted that the access methods provide no)6.101 F -(guarantees about byte string alignment.)108 672 Q F3(ERRORS)72 688.8 Q F0(The) -108 700.8 Q F2(dbopen)3.377 E F0 .876(routine may fail and set)3.377 F F2 -(errno)3.376 E F0 .876 -(for any of the errors speci\214ed for the library routines)3.376 F F2(open) -3.376 E F0(\(2\)).21 E(and)108 712.8 Q F2(malloc)2.5 E F0 -(\(3\) or the following:).26 E 203.455(4, December)72 768 R(3)535 768 Q EP +352.8 Q .911(R_LAST and R_PREV are a)144 369.6 R -.25(va)-.2 G .911 +(ilable only for the DB_BTREE and DB_RECNO access methods).25 F(because the)144 +381.6 Q 2.5(ye)-.15 G(ach imply that the k)202.16 381.6 Q -.15(ey)-.1 G 2.5(sh) +.15 G -2.25 -.2(av e)302.18 381.6 T(an inherent order which does not change.) +2.7 E F2(Seq)144 398.4 Q F0 .061(routines return -1 on error \(setting)2.561 F +F2(errno)2.561 E F0 .061(\), 0 on success and 1 if there are no k).18 F -.15 +(ey)-.1 G .061(/data pairs less).15 F .35 +(than or greater than the speci\214ed or current k)144 410.4 R -.15(ey)-.1 G +5.349(.I)-.5 G 2.849(ft)346.467 410.4 S .349 +(he DB_RECNO access method is being used,)355.426 410.4 R .025 +(and if the database \214le is a character special \214le and no complete k)144 +422.4 R -.15(ey)-.1 G .025(/data pairs are currently a).15 F -.25(va)-.2 G(il-) +.25 E(able, the)144 434.4 Q F2(seq)2.5 E F0(routines return 2.)2.5 E 15.17 +(sync A)108 451.2 R .458(pointer to a routine to \215ush an)2.958 F 2.957(yc) +-.15 G .457(ached information to disk.)289.72 451.2 R .457 +(If the database is in memory only)5.457 F(,)-.65 E(the)144 463.2 Q F2(sync)2.5 +E F0(routine has no ef)2.5 E(fect and will al)-.25 E -.1(wa)-.1 G(ys succeed.) +.1 E(The \215ag v)144 480 Q(alue may be set to the follo)-.25 E(wing v)-.25 E +(alue:)-.25 E(R_RECNOSYNC)144 496.8 Q .077(If the DB_RECNO access method is be\ +ing used, this \215ag causes the sync routine to apply)180 508.8 R .75(to the \ +btree \214le which underlies the recno \214le, not the recno \214le itself.)180 +520.8 R .75(\(See the)5.75 F F2(bfname)3.25 E F0(\214eld of the)180 532.8 Q F2 +-.37(re)2.5 G(cno).37 E F0(\(3\) manual page for more information.\)).18 E F2 +(Sync)144 549.6 Q F0(routines return -1 on error \(setting)2.5 E F2(errno)2.5 E +F0 2.5(\)a).18 G(nd 0 on success.)336.91 549.6 Q/F3 9/Times-Bold@0 SF(KEY/D)72 +566.4 Q -1.35 -.855(AT A)-.315 H -.666(PA)3.105 G(IRS).666 E F0 .134 +(Access to all \214le types is based on k)108 578.4 R -.15(ey)-.1 G .134 +(/data pairs.).15 F .134(Both k)5.134 F -.15(ey)-.1 G 2.634(sa).15 G .134 +(nd data are represented by the follo)359.078 578.4 R .135(wing data)-.25 F +(structure:)108 590.4 Q(typedef struct {)108 607.2 Q -.2(vo)144 619.2 S +(id *data;).2 E(size_t size;)144 631.2 Q 2.5(}D)108 643.2 S(BT)122.52 643.2 Q +(;)-.55 E(The elements of the DBT structure are de\214ned as follo)108 660 Q +(ws:)-.25 E 16.84(data A)108 676.8 R(pointer to a byte string.)2.5 E 17.95 +(size The)108 693.6 R(length of the byte string.)2.5 E -2.15 -.25(Ke y)108 +710.4 T .829(and data byte strings may reference strings of essentially unlimi\ +ted length although an)3.579 F 3.328(yt)-.15 G 1.028 -.1(wo o)492.894 710.4 T +3.328(ft).1 G(hem)522.78 710.4 Q 1.133(must \214t into a)108 722.4 R -.25(va) +-.2 G 1.134(ilable memory at the same time.).25 F 1.134 +(It should be noted that the access methods pro)6.134 F 1.134(vide no)-.15 F +209.835(24, May)72 768 R(3)535 768 Q EP %%Page: 4 4 %%BeginPageSetup BP %%EndPageSetup -/F0 10/Times-Roman@0 SF 169.84(DBOPEN\(3\) 1992 DBOPEN\(3\))72 48 R([EFTYPE]) -108 84 Q 2.5<418c>144 96 S(le is incorrectly formatted.)159.28 96 Q([EINV)108 -112.8 Q(AL])-1.29 E 2.812(Ap)144 124.8 S .313(arameter has been speci\214ed \(\ -hash function, pad byte etc.\) that is incompatible with the current)159.032 -124.8 R .396(\214le speci\214cation or which is not meaningful for the functio\ -n \(for example, use of the cursor with-)144 136.8 R .084(out prior initializa\ -tion\) or there is a mismatch between the version number of \214le and the sof\ -tware.)144 148.8 R(The)108 165.6 Q/F1 10/Times-Italic@0 SF(close)3.455 E F0 -.955(routines may fail and set)3.455 F F1(errno)3.455 E F0 .955 -(for any of the errors speci\214ed for the library routines)3.455 F F1(close) -3.455 E F0(\(2\),).18 E F1 -.37(re)108 177.6 S(ad).37 E F0(\(2\),).71 E F1 -(write)2.5 E F0(\(2\),).18 E F1(fr)2.5 E(ee)-.37 E F0(\(3\), or).18 E F1(fsync) -2.5 E F0(\(2\).).26 E(The)108 194.4 Q F1(del)2.958 E F0(,).48 E F1(get)2.958 E -F0(,).6 E F1(put)2.958 E F0(and)2.958 E F1(seq)2.958 E F0 .458 -(routines may fail and set)2.958 F F1(errno)2.958 E F0 .458 -(for any of the errors speci\214ed for the library rou-)2.958 F(tines)108 206.4 -Q F1 -.37(re)2.5 G(ad).37 E F0(\(2\),).71 E F1(write)2.5 E F0(\(2\),).18 E F1 -(fr)2.5 E(ee)-.37 E F0(\(3\) or).18 E F1(malloc)2.5 E F0(\(3\).).26 E(The)108 -223.2 Q F1(sync)2.5 E F0(routines may fail and set)2.5 E F1(errno)2.5 E F0 -(for any of the errors speci\214ed for the library routine)2.5 E F1(fsync)2.5 E -F0(\(2\).).26 E/F2 9/Times-Bold@0 SF(SEE ALSO)72 240 Q F1(btr)108 252 Q(ee)-.37 -E F0(\(3\),).18 E F1(hash)2.5 E F0(\(3\),).23 E F1(mpool)2.5 E F0(\(3\),).48 E -F1 -.37(re)2.5 G(cno).37 E F0(\(3\)).17 E F2(BUGS)72 268.8 Q F0 .394 -(The typedef DBT is a mnemonic for `)108 280.8 R .394(`data base thang')-.74 F -.393(', and was used because noone could think of a rea-)-.74 F -(sonable name that wasn')108 292.8 Q 2.5(ta)-.18 G(lready used.)216.13 292.8 Q -(None of the access methods provide any form of concurrent access, locking, or\ - transactions.)108 309.6 Q 203.455(4, December)72 768 R(4)535 768 Q EP +/F0 10/Times-Roman@0 SF 169.84(DBOPEN\(3\) 1993 DBOPEN\(3\))72 48 R +(guarantees about byte string alignment.)108 84 Q/F1 9/Times-Bold@0 SF(ERR)72 +100.8 Q(ORS)-.27 E F0(The)108 112.8 Q/F2 10/Times-Italic@0 SF(dbopen)3.389 E F0 +.889(routine may f)3.389 F .889(ail and set)-.1 F F2(errno)3.388 E F0 .888 +(for an)3.388 F 3.388(yo)-.15 G 3.388(ft)324.376 112.8 S .888 +(he errors speci\214ed for the library routines)333.874 112.8 R F2(open)3.388 E +F0(\(2\)).24 E(and)108 124.8 Q F2(malloc)2.5 E F0(\(3\) or the follo).31 E +(wing:)-.25 E([EFTYPE])108 141.6 Q 2.5<418c>144 153.6 S +(le is incorrectly formatted.)159.28 153.6 Q([EINV)108 170.4 Q(AL])-1.35 E +2.812(Ap)144 182.4 S .313(arameter has been speci\214ed \(hash function, pad b\ +yte etc.\) that is incompatible with the current)159.032 182.4 R .406 +(\214le speci\214cation or which is not meaningful for the function \(for e)144 +194.4 R .405(xample, use of the cursor with-)-.15 F .099 +(out prior initialization\) or there is a mismatch between the v)144 206.4 R .1 +(ersion number of \214le and the softw)-.15 F(are.)-.1 E(The)108 223.2 Q F2 +(close)3.469 E F0 .969(routines may f)3.469 F .969(ail and set)-.1 F F2(errno) +3.469 E F0 .969(for an)3.469 F 3.469(yo)-.15 G 3.469(ft)320.18 223.2 S .969 +(he errors speci\214ed for the library routines)329.759 223.2 R F2(close)3.468 +E F0(\(2\),).18 E F2 -.37(re)108 235.2 S(ad).37 E F0(\(2\),).77 E F2(write)2.5 +E F0(\(2\),).18 E F2(fr)2.5 E(ee)-.37 E F0(\(3\), or).18 E F2(fsync)2.5 E F0 +(\(2\).).31 E(The)108 252 Q F2(del)2.969 E F0(,).51 E F2 -.1(ge)2.969 G(t).1 E +F0(,).68 E F2(put)2.969 E F0(and)2.969 E F2(seq)2.969 E F0 .469(routines may f) +2.969 F .469(ail and set)-.1 F F2(errno)2.97 E F0 .47(for an)2.97 F 2.97(yo) +-.15 G 2.97(ft)377.59 252 S .47(he errors speci\214ed for the library rou-) +386.67 252 R(tines)108 264 Q F2 -.37(re)2.5 G(ad).37 E F0(\(2\),).77 E F2 +(write)2.5 E F0(\(2\),).18 E F2(fr)2.5 E(ee)-.37 E F0(\(3\) or).18 E F2(malloc) +2.5 E F0(\(3\).).31 E(The)108 280.8 Q F2(fd)2.5 E F0(routines will f)2.5 E +(ail and set)-.1 E F2(errno)2.5 E F0(to ENOENT for in memory databases.)2.5 E +(The)108 297.6 Q F2(sync)2.5 E F0(routines may f)2.5 E(ail and set)-.1 E F2 +(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)307.71 297.6 S +(he errors speci\214ed for the library routine)316.32 297.6 Q F2(fsync)2.5 E F0 +(\(2\).).31 E F1(SEE ALSO)72 314.4 Q F2(btr)108 326.4 Q(ee)-.37 E F0(\(3\),).18 +E F2(hash)2.5 E F0(\(3\),).28 E F2(mpool)2.5 E F0(\(3\),).51 E F2 -.37(re)2.5 G +(cno).37 E F0(\(3\)).18 E F1 -.09(BU)72 343.2 S(GS).09 E F0 .399 +(The typedef DBT is a mnemonic for `)108 355.2 R .399(`data base thang')-.74 F +.399(', and w)-.74 F .399(as used because noone could think of a rea-)-.1 F +(sonable name that w)108 367.2 Q(asn')-.1 E 2.5(ta)-.18 G(lready used.)216.03 +367.2 Q(The \214le descriptor interf)108 384 Q +(ace is a kluge and will be deleted in a future v)-.1 E(ersion of the interf) +-.15 E(ace.)-.1 E(None of the access methods pro)108 400.8 Q(vide an)-.15 E 2.5 +(yf)-.15 G(orm of concurrent access, locking, or transactions.)275.16 400.8 Q +209.835(24, May)72 768 R(4)535 768 Q EP %%Trailer end %%EOF diff --git a/lib/libc/DB/doc/hash.3.ps b/lib/libc/DB/doc/hash.3.ps index 64ea0e3f0350..038c77b1c633 100644 --- a/lib/libc/DB/doc/hash.3.ps +++ b/lib/libc/DB/doc/hash.3.ps @@ -1,342 +1,289 @@ %!PS-Adobe-3.0 -%%Creator: groff version 1.03 +%%Creator: groff version 1.08 %%DocumentNeededResources: font Times-Roman %%+ font Times-Bold %%+ font Times-Italic -%%DocumentSuppliedResources: procset grops 1.03 0 +%%DocumentSuppliedResources: procset grops 1.08 0 %%Pages: 2 %%PageOrder: Ascend %%Orientation: Portrait %%EndComments %%BeginProlog -%%BeginResource: procset grops 1.03 0 - -/setpacking where { - pop - currentpacking - true setpacking -} if - -/grops 120 dict dup begin - -% The ASCII code of the space character. +%%BeginResource: procset grops 1.08 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 - -% name size font SF - - -/SF { - findfont exch - [ exch dup 0 exch 0 exch neg 0 0 ] makefont - dup setfont - [ exch /setfont cvx ] cvx bind def -} bind def - -% name a c d font MF - - -/MF { - findfont - [ 5 2 roll - 0 3 1 roll % b - neg 0 0 ] makefont - dup setfont - [ exch /setfont cvx ] cvx bind def -} bind 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 - -% BP - - -/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 - - -% centerx centery radius startangle endangle DA - - -/DA { - newpath arcn stroke -} bind def - -% x y SN - x' y' -% round a position to nearest (pixel + (.25,.25)) - -/SN { - transform - .25 sub exch .25 sub exch - round .25 add exch round .25 add exch - itransform -} bind def - -% endx endy startx starty DL - -% we round the endpoints of the line, so that parallel horizontal -% and vertical lines will appear even - -/DL { - SN - moveto - SN - lineto stroke -} bind def - -% centerx centery radius DC - - -/DC { - newpath 0 360 arc closepath -} 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 - -% width height centerx centery DE - - -/DE { - TM currentmatrix pop - translate scale newpath 0 0 .5 0 360 arc closepath - TM setmatrix -} bind def - -% these are for splines - -/RC /rcurveto load def -/RL /rlineto load def -/ST /stroke load def -/MT /moveto load def -/CL /closepath load def - -% fill the last path - -% amount FL - - -/FL { - currentgray exch setgray fill setgray -} bind def - -% fill with the ``current color'' - -/BL /fill load def - -/LW /setlinewidth load def -% new_font_name encoding_vector old_font_name RE - - -/RE { - findfont - dup maxlength dict begin - { - 1 index /FID ne { def } { pop pop } ifelse - } forall - /Encoding exch def - dup /FontName exch def - currentdict end definefont pop -} bind 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 - -% hpos vpos EBEGIN - - -/EBEGIN { - moveto - DEFS begin -} bind def - -/EEND /end load def - +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def /CNT 0 def /level1 0 def - -% llx lly newwid wid newht ht newllx newlly PBEGIN - - -/PBEGIN { - /level1 save def - translate - div 3 1 roll div exch scale - neg exch neg exch translate - % set the graphics state to default values - 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 - +/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 +/setpacking where{ +pop +setpacking +}if %%EndResource -%%EndProlog -%%BeginSetup %%IncludeResource: font Times-Roman %%IncludeResource: font Times-Bold %%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/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/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/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-Bold@0 ENC0/Times-Bold -RE/Times-Roman@0 ENC0/Times-Roman RE -%%EndSetup +/.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-Bold@0 ENC0/Times-Bold RE/Times-Roman@0 ENC0/Times-Roman RE +%%EndProlog %%Page: 1 1 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 182.62(HASH\(3\) 1991 HASH\(3\))72 48 R/F1 9 -/Times-Bold@0 SF(NAME)72 84 Q F0(hash \255 hash database access method)108 96 Q -F1(SYNOPSIS)72 112.8 Q/F2 10/Times-Bold@0 SF(#include )108 124.8 Q -(#include )108 136.8 Q F1(DESCRIPTION)72 153.6 Q F0 .285(The routine)108 -165.6 R/F3 10/Times-Italic@0 SF(dbopen)2.785 E F0 .285 -(is the library interface to database \214les.)2.785 F .284 -(One of the supported \214le formats is hash \214les.)5.284 F .976 +/Times-Bold@0 SF -.18(NA)72 84 S(ME).18 E F0 +(hash \255 hash database access method)108 96 Q F1(SYNOPSIS)72 112.8 Q/F2 10 +/Times-Bold@0 SF(#include )108 124.8 Q(#include )-.4 E F1(DESCRIPTION)72 153.6 Q F0 .29(The routine)108 165.6 R/F3 10 +/Times-Italic@0 SF(dbopen)2.79 E F0 .29(is the library interf)2.79 F .29 +(ace to database \214les.)-.1 F .29 +(One of the supported \214le formats is hash \214les.)5.29 F .974 (The general description of the database access methods is in)108 177.6 R F3 -(dbopen)3.477 E F0 .977(\(3\), this manual page describes only).21 F -(the hash speci\214c information.)108 189.6 Q -(The hash data structure is an extensible, dynamic hashing scheme.)108 206.4 Q -.798(The access method speci\214c data structure provided to)108 223.2 R F3 -(dbopen)3.298 E F0 .797(is de\214ned in the include \214le as fol-)3.298 -F(lows:)108 235.2 Q(typedef struct {)108 259.2 Q(int bsize;)144 271.2 Q -(u_int cachesize;)144 283.2 Q(int f)144 295.2 Q(factor;)-.18 E -(u_long \(*hash\)\(const void *, const size_t\);)144 307.2 Q(int lorder;)144 -319.2 Q(int nelem;)144 331.2 Q 2.5(}H)108 343.2 S(ASHINFO;)122.52 343.2 Q -(The elements of this structure are as follows:)108 360 Q(bsize)108 376.8 Q F3 -(Bsize)144 376.8 Q F0 1.37 -(de\214nes the hash table bucket size, and is, by default, 256 bytes.)3.87 F -1.37(It may be preferable to)6.37 F +(dbopen)3.475 E F0 .975(\(3\), this manual page describes only).24 F +(the hash speci\214c information.)108 189.6 Q(The hash data structure is an e) +108 206.4 Q(xtensible, dynamic hashing scheme.)-.15 E .83 +(The access method speci\214c data structure pro)108 223.2 R .83(vided to)-.15 +F F3(dbopen)3.33 E F0 .83(is de\214ned in the include \214le as fol-)-.4 F(lo)108 235.2 Q(ws:)-.25 E(typedef struct {) +108 259.2 Q(int bsize;)144 271.2 Q(u_int cachesize;)144 283.2 Q(int f)144 295.2 +Q -.1(fa)-.25 G(ctor;).1 E(u_long \(*hash\)\(const v)144 307.2 Q +(oid *, const size_t\);)-.2 E(int lorder;)144 319.2 Q(int nelem;)144 331.2 Q +2.5(}H)108 343.2 S(ASHINFO;)122.52 343.2 Q +(The elements of this structure are as follo)108 360 Q(ws:)-.25 E(bsize)108 +376.8 Q F3(Bsize)144 376.8 Q F0 1.393(de\214nes the hash table b)3.893 F(uck) +-.2 E 1.393(et size, and is, by def)-.1 F 1.394(ault, 256 bytes.)-.1 F 1.394 +(It may be preferable to)6.394 F (increase the page size for disk-resident tables and tables with lar)144 388.8 -Q(ge data items.)-.18 E(cachesize)108 405.6 Q 3.144(As)144 417.6 S .644 -(uggested maximum size, in bytes, of the memory cache.)158.254 417.6 R .644 -(This value is)5.644 F F2(only)3.143 E F0(advisory)3.143 E 3.143(,a)-.65 G .643 -(nd the)514.637 417.6 R -(access method will allocate more memory rather than fail.)144 429.6 Q -.18(ff) -108 446.4 S(actor).18 E F3(Ffactor)9.53 E F0 .482 +Q(ge data items.)-.18 E(cachesize)108 405.6 Q 3.16(As)144 417.6 S .66 +(uggested maximum size, in bytes, of the memory cache.)158.27 417.6 R .659 +(This v)5.659 F .659(alue is)-.25 F F2(only)3.159 E F0(advisory)3.159 E 3.159 +(,a)-.65 G .659(nd the)514.621 417.6 R +(access method will allocate more memory rather than f)144 429.6 Q(ail.)-.1 E +-2.1 -.25(ff a)108 446.4 T(ctor).25 E F3(Ffactor)9.7 E F0 .482 (indicates a desired density within the hash table.)2.981 F .482 -(It is an approximation of the number of)5.482 F .349(keys allowed to accumula\ -te in any one bucket, determining when the hash table grows or shrinks.)144 -458.4 R(The default value is 8.)144 470.4 Q(hash)108 487.2 Q F3(Hash)144 487.2 -Q F0 .1(is a user de\214ned hash function.)2.6 F .1 -(Since no hash function performs equally well on all possible)5.1 F .912(data,\ - the user may \214nd that the built-in hash function does poorly on a particul\ -ar data set.)144 499.2 R(User)5.911 E 1.396 -(speci\214ed hash functions must take two ar)144 511.2 R 1.396 -(guments \(a pointer to a byte string and a length\) and)-.18 F -(return an u_long to be used as the hash value.)144 523.2 Q 9.62(lorder The)108 -540 R 1.586(byte order for integers in the stored database metadata.)4.086 F -1.585(The number should represent the)6.586 F .667 -(order as an integer; for example, big endian order would be the number 4,321.) -144 552 R(If)5.667 E F3(lor)3.167 E(der)-.37 E F0 .667(is 0 \(no)3.167 F .799 -(order is speci\214ed\) the current host order is used.)144 564 R .798(If the) -5.798 F .798(\214le already exists, the speci\214ed value is)5.798 F -(ignored and the value speci\214ed when the tree was created is used.)144 576 Q -(nelem)108 592.8 Q F3(Nelem)144 592.8 Q F0 .689 -(is an estimate of the \214nal size of the hash table.)3.189 F .689 -(If not set or set too low)5.689 F 3.189(,h)-.65 G .689(ash tables will)481.401 -592.8 R .405(expand gracefully as keys are entered, although a slight performa\ -nce degradation may be noticed.)144 604.8 R(The default value is 1.)144 616.8 Q -.743(If the \214le already exists \(and the O_TRUNC \215ag is not speci\214ed\ -\), the values speci\214ed for the parameters)108 633.6 R(bsize, f)108 645.6 Q -(factor)-.18 E 2.5(,l)-.4 G(order and nelem are ignored and the values speci\ -\214ed when the tree was created are used.)167.4 645.6 Q 1.232 -(If a hash function is speci\214ed,)108 662.4 R F3(hash_open)3.731 E F0 1.231 -(will attempt to determine if the hash function speci\214ed is the)3.731 F(sam\ -e as the one with which the database was created, and will fail if it is not.) -108 674.4 Q .794(Backward compatible interfaces to the routines described in) -108 691.2 R F3(dbm)3.294 E F0 .794(\(3\), and).26 F F3(ndbm)3.294 E F0 .794 -(\(3\) are provided, however).26 F(,)-.4 E -(these interfaces are not compatible with previous \214le formats.)108 703.2 Q -202.615(4, September)72 768 R(1)535 768 Q EP +(It is an approximation of the number of)5.482 F -.1(ke)144 458.4 S .429 +(ys allo)-.05 F .429(wed to accumulate in an)-.25 F 2.929(yo)-.15 G .429(ne b) +291.454 458.4 R(uck)-.2 E .429(et, determining when the hash table gro)-.1 F +.428(ws or shrinks.)-.25 F(The def)144 470.4 Q(ault v)-.1 E(alue is 8.)-.25 E +(hash)108 487.2 Q F3(Hash)144 487.2 Q F0 .1(is a user de\214ned hash function.) +2.6 F .1(Since no hash function performs equally well on all possible)5.1 F +.924(data, the user may \214nd that the b)144 499.2 R .923 +(uilt-in hash function does poorly on a particular data set.)-.2 F(User)5.923 E +1.408(speci\214ed hash functions must tak)144 511.2 R 3.909(et)-.1 G 1.609 -.1 +(wo a)293.431 511.2 T -.18(rg).1 G 1.409 +(uments \(a pointer to a byte string and a length\) and).18 F +(return an u_long to be used as the hash v)144 523.2 Q(alue.)-.25 E 9.62 +(lorder The)108 540 R 1.597(byte order for inte)4.097 F 1.596 +(gers in the stored database metadata.)-.15 F 1.596 +(The number should represent the)6.596 F .688(order as an inte)144 552 R .689 +(ger; for e)-.15 F .689(xample, big endian order w)-.15 F .689 +(ould be the number 4,321.)-.1 F(If)5.689 E F3(lor)3.189 E(der)-.37 E F0 .689 +(is 0 \(no)3.189 F .822(order is speci\214ed\) the current host order is used.) +144 564 R .822(If the)5.822 F .822(\214le already e)5.822 F .821 +(xists, the speci\214ed v)-.15 F .821(alue is)-.25 F(ignored and the v)144 576 +Q(alue speci\214ed when the tree w)-.25 E(as created is used.)-.1 E(nelem)108 +592.8 Q F3(Nelem)144 592.8 Q F0 .701 +(is an estimate of the \214nal size of the hash table.)3.2 F .701 +(If not set or set too lo)5.701 F 2.001 -.65(w, h)-.25 H .701(ash tables will) +.65 F -.15(ex)144 604.8 S .448(pand gracefully as k).15 F -.15(ey)-.1 G 2.948 +(sa).15 G .448(re entered, although a slight performance de)255.912 604.8 R +.447(gradation may be noticed.)-.15 F(The def)144 616.8 Q(ault v)-.1 E +(alue is 1.)-.25 E .79(If the \214le already e)108 633.6 R .79 +(xists \(and the O_TR)-.15 F .79(UNC \215ag is not speci\214ed\), the v)-.4 F +.79(alues speci\214ed for the parameters)-.25 F(bsize, f)108 645.6 Q -.1(fa) +-.25 G(ctor).1 E 2.5(,l)-.4 G(order and nelem are ignored and the v)167.23 +645.6 Q(alues speci\214ed when the tree w)-.25 E(as created are used.)-.1 E +1.232(If a hash function is speci\214ed,)108 662.4 R F3(hash_open)3.731 E F0 +1.231(will attempt to determine if the hash function speci\214ed is the)3.731 F +(same as the one with which the database w)108 674.4 Q(as created, and will f) +-.1 E(ail if it is not.)-.1 E(Backw)108 691.2 Q .861(ard compatible interf)-.1 +F .861(aces to the routines described in)-.1 F F3(dbm)3.362 E F0 .862 +(\(3\), and).32 F F3(ndbm)3.362 E F0 .862(\(3\) are pro).32 F .862(vided, ho) +-.15 F(we)-.25 E -.15(ve)-.25 G -.4(r,).15 G(these interf)108 703.2 Q +(aces are not compatible with pre)-.1 E(vious \214le formats.)-.25 E 202.615 +(4, September)72 768 R(1)535 768 Q EP %%Page: 2 2 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 182.62(HASH\(3\) 1991 HASH\(3\))72 48 R/F1 9 /Times-Bold@0 SF(SEE ALSO)72 84 Q/F2 10/Times-Italic@0 SF(btr)108 96 Q(ee)-.37 -E F0(\(3\),).18 E F2(dbopen)2.5 E F0(\(3\),).21 E F2(mpool)2.5 E F0(\(3\),).48 -E F2 -.37(re)2.5 G(cno).37 E F0(\(3\)).17 E F2(Dynamic Hash T)108 108 Q(ables) --.92 E F0 2.5(,P).28 G(er)206.8 108 Q -(-Ake Larson, Communications of the ACM, April 1988.)-.2 E F2 2.5(AN)108 120 S -(ew Hash Package for UNIX)123.28 120 Q F0 2.5(,M).72 G(ar)249.54 120 Q -(go Seltzer)-.18 E 2.5(,U)-.4 G(SENIX Proceedings, W)309.22 120 Q(inter 1991.) --.4 E F1(BUGS)72 136.8 Q F0 -(Only big and little endian byte order is supported.)108 148.8 Q 202.615 -(4, September)72 768 R(2)535 768 Q EP +E F0(\(3\),).18 E F2(dbopen)2.5 E F0(\(3\),).24 E F2(mpool)2.5 E F0(\(3\),).51 +E F2 -.37(re)2.5 G(cno).37 E F0(\(3\)).18 E F2(Dynamic Hash T)108 108 Q(ables) +-.92 E F0 2.5(,P).27 G(er)206.79 108 Q(-Ak)-.2 E 2.5(eL)-.1 G +(arson, Communications of the A)242.86 108 Q(CM, April 1988.)-.4 E F2 2.5(AN) +108 120 S .3 -.15(ew H)123.28 120 T(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)248.41 120 Q(go Seltzer)-.18 E 2.5(,U)-.4 +G(SENIX Proceedings, W)308.09 120 Q(inter 1991.)-.4 E F1 -.09(BU)72 136.8 S(GS) +.09 E F0(Only big and little endian byte order is supported.)108 148.8 Q +202.615(4, September)72 768 R(2)535 768 Q EP %%Trailer end %%EOF diff --git a/lib/libc/DB/doc/hash.ps b/lib/libc/DB/doc/hash.ps index 3cf8240d5093..7403ba3ac0a5 100644 --- a/lib/libc/DB/doc/hash.ps +++ b/lib/libc/DB/doc/hash.ps @@ -7,7 +7,7 @@ % 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: /cvsroot/src/lib/libc/DB/doc/Attic/hash.ps,v 1.1.1.1 1993/04/21 04:51:16 proven Exp $ +% RCSID: $Header: /cvsroot/src/lib/libc/DB/doc/Attic/hash.ps,v 1.2 1993/05/27 19:55:50 cgd Exp $ % Changed by Edward Wang (edward@ucbarpa.berkeley.edu) to handle graphics, % 17 Feb, 87. diff --git a/lib/libc/DB/doc/mpool.3.ps b/lib/libc/DB/doc/mpool.3.ps index 4b833e0170ab..f595480d6be6 100644 --- a/lib/libc/DB/doc/mpool.3.ps +++ b/lib/libc/DB/doc/mpool.3.ps @@ -1,368 +1,317 @@ %!PS-Adobe-3.0 -%%Creator: groff version 1.03 +%%Creator: groff version 1.08 %%DocumentNeededResources: font Times-Roman %%+ font Times-Bold %%+ font Times-Italic -%%DocumentSuppliedResources: procset grops 1.03 0 +%%DocumentSuppliedResources: procset grops 1.08 0 %%Pages: 2 %%PageOrder: Ascend %%Orientation: Portrait %%EndComments %%BeginProlog -%%BeginResource: procset grops 1.03 0 - -/setpacking where { - pop - currentpacking - true setpacking -} if - -/grops 120 dict dup begin - -% The ASCII code of the space character. +%%BeginResource: procset grops 1.08 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 - -% name size font SF - - -/SF { - findfont exch - [ exch dup 0 exch 0 exch neg 0 0 ] makefont - dup setfont - [ exch /setfont cvx ] cvx bind def -} bind def - -% name a c d font MF - - -/MF { - findfont - [ 5 2 roll - 0 3 1 roll % b - neg 0 0 ] makefont - dup setfont - [ exch /setfont cvx ] cvx bind def -} bind 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 - -% BP - - -/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 - - -% centerx centery radius startangle endangle DA - - -/DA { - newpath arcn stroke -} bind def - -% x y SN - x' y' -% round a position to nearest (pixel + (.25,.25)) - -/SN { - transform - .25 sub exch .25 sub exch - round .25 add exch round .25 add exch - itransform -} bind def - -% endx endy startx starty DL - -% we round the endpoints of the line, so that parallel horizontal -% and vertical lines will appear even - -/DL { - SN - moveto - SN - lineto stroke -} bind def - -% centerx centery radius DC - - -/DC { - newpath 0 360 arc closepath -} 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 - -% width height centerx centery DE - - -/DE { - TM currentmatrix pop - translate scale newpath 0 0 .5 0 360 arc closepath - TM setmatrix -} bind def - -% these are for splines - -/RC /rcurveto load def -/RL /rlineto load def -/ST /stroke load def -/MT /moveto load def -/CL /closepath load def - -% fill the last path - -% amount FL - - -/FL { - currentgray exch setgray fill setgray -} bind def - -% fill with the ``current color'' - -/BL /fill load def - -/LW /setlinewidth load def -% new_font_name encoding_vector old_font_name RE - - -/RE { - findfont - dup maxlength dict begin - { - 1 index /FID ne { def } { pop pop } ifelse - } forall - /Encoding exch def - dup /FontName exch def - currentdict end definefont pop -} bind 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 - -% hpos vpos EBEGIN - - -/EBEGIN { - moveto - DEFS begin -} bind def - -/EEND /end load def - +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def /CNT 0 def /level1 0 def - -% llx lly newwid wid newht ht newllx newlly PBEGIN - - -/PBEGIN { - /level1 save def - translate - div 3 1 roll div exch scale - neg exch neg exch translate - % set the graphics state to default values - 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 - +/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 +/setpacking where{ +pop +setpacking +}if %%EndResource -%%EndProlog -%%BeginSetup %%IncludeResource: font Times-Roman %%IncludeResource: font Times-Bold %%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/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/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/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-Bold@0 ENC0/Times-Bold -RE/Times-Roman@0 ENC0/Times-Roman RE -%%EndSetup +/.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-Bold@0 ENC0/Times-Bold RE/Times-Roman@0 ENC0/Times-Roman RE +%%EndProlog %%Page: 1 1 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 174.84(MPOOL\(3\) 1991 MPOOL\(3\))72 48 R/F1 9 -/Times-Bold@0 SF(NAME)72 84 Q F0(mpool \255 shared memory buf)108 96 Q -(fer pool)-.18 E F1(SYNOPSIS)72 112.8 Q/F2 10/Times-Bold@0 SF(#include ) -108 124.8 Q(#include )108 136.8 Q(MPOOL *)108 160.8 Q -(mpool_open \(DBT *key)108 172.8 Q 2.5(,i)-.55 G -(nt fd, pgno_t pagesize, pgno_t maxcache\);)216.35 172.8 Q(void)108 196.8 Q -(mpool_\214lter \(MPOOL *mp, void \(*pgin\)\(void *, pgno_t, void *\),)108 -208.8 Q(void \(*pgout\)\(void *, pgno_t, void *\), void *pgcookie\);)158 220.8 -Q(void *)108 244.8 Q(mpool_new \(MPOOL *mp, pgno_t *pgnoaddr\);)108 256.8 Q -(void *)108 280.8 Q(mpool_get \(MPOOL *mp, pgno_t pgno, u_int \215ags\);)108 -292.8 Q(int)108 316.8 Q(mpool_put \(MPOOL *mp, void *pgaddr)108 328.8 Q 2.5(,u) --.92 G(_int \215ags\);)290.72 328.8 Q(int)108 352.8 Q +/Times-Bold@0 SF -.18(NA)72 84 S(ME).18 E F0(mpool \255 shared memory b)108 96 +Q(uf)-.2 E(fer pool)-.25 E F1(SYNOPSIS)72 112.8 Q/F2 10/Times-Bold@0 SF +(#include )-.4 E(#include )108 136.8 Q(MPOOL *)108 +160.8 Q(mpool_open \(DBT *k)108 172.8 Q(ey)-.1 E 2.5(,i)-.55 G +(nt fd, pgno_t pagesize, pgno_t maxcache\);)216.25 172.8 Q -.1(vo)108 196.8 S +(id).1 E(mpool_\214lter \(MPOOL *mp, v)108 208.8 Q(oid \(*pgin\)\(v)-.1 E +(oid *, pgno_t, v)-.1 E(oid *\),)-.1 E -.1(vo)158 220.8 S(id \(*pgout\)\(v).1 E +(oid *, pgno_t, v)-.1 E(oid *\), v)-.1 E(oid *pgcookie\);)-.1 E -.1(vo)108 +244.8 S(id *).1 E(mpool_new \(MPOOL *mp, pgno_t *pgnoaddr\);)108 256.8 Q -.1 +(vo)108 280.8 S(id *).1 E(mpool_get \(MPOOL *mp, pgno_t pgno, u_int \215ags\);) +108 292.8 Q(int)108 316.8 Q(mpool_put \(MPOOL *mp, v)108 328.8 Q(oid *pgaddr) +-.1 E 2.5(,u)-.92 G(_int \215ags\);)290.62 328.8 Q(int)108 352.8 Q (mpool_sync \(MPOOL *mp\);)108 364.8 Q(int)108 388.8 Q (mpool_close \(MPOOL *mp\);)108 400.8 Q F1(DESCRIPTION)72 417.6 Q/F3 10 -/Times-Italic@0 SF(Mpool)108 429.6 Q F0 .96 -(is the library interface intended to provide page oriented buf)3.46 F .96 -(fer management of \214les.)-.18 F .96(The buf)5.96 F(fers)-.18 E -(may be shared between processes.)108 441.6 Q .382(The function)108 458.4 R F3 -(mpool_open)2.882 E F0 .382(initializes a memory pool.)2.882 F(The)5.382 E F3 -(key)2.882 E F0(ar)2.883 E .383(gument is the byte string used to negotiate) --.18 F .663(between multiple processes wishing to share buf)108 470.4 R 3.163 -(fers. If)-.18 F .662(the \214le buf)3.163 F .662 -(fers are mapped in shared memory)-.18 F 3.162(,a)-.65 G(ll)534.44 470.4 Q .8 -(processes using the same key will share the buf)108 482.4 R 3.301(fers. If) --.18 F F3(key)3.301 E F0 .801(is NULL, the buf)3.301 F .801 -(fers are mapped into private)-.18 F(memory)108 494.4 Q 5.095(.T)-.65 G(he) -154.385 494.4 Q F3(fd)2.595 E F0(ar)2.595 E .094(gument is a \214le descriptor\ - for the underlying \214le, which must be seekable.)-.18 F(If)5.094 E F3(key) -2.594 E F0 .094(is non-)2.594 F -(NULL and matches a \214le already being mapped, the)108 506.4 Q F3(fd)2.5 E F0 -(ar)2.5 E(gument is ignored.)-.18 E(The)108 523.2 Q F3(pagesize)3.305 E F0(ar) -3.305 E .805(gument is the size, in bytes, of the pages into which the \214le \ -is broken up.)-.18 F(The)5.806 E F3(maxcache)3.306 E F0(ar)108 535.2 Q .132(gu\ -ment is the maximum number of pages from the underlying \214le to cache at any\ - one time.)-.18 F .132(This value is)5.132 F .04 -(not relative to the number of processes which share a \214le')108 547.2 R -2.541(sb)-.55 G(uf)350.342 547.2 Q .041(fers, but will be the lar)-.18 F .041 -(gest value speci\214ed by)-.18 F(any of the processes sharing the \214le.)108 -559.2 Q(The)108 576 Q F3(mpool_\214lter)3.248 E F0 .747(function is intended t\ -o make transparent input and output processing of the pages possi-)3.248 F -3.082(ble. If)108 588 R(the)3.082 E F3(pgin)3.082 E F0 .583 -(function is speci\214ed, it is called each time a buf)3.083 F .583 -(fer is read into the memory pool from the)-.18 F .112(backing \214le.)108 600 -R .112(If the)5.112 F F3(pgout)2.612 E F0 .112 -(function is speci\214ed, it is called each time a buf)2.612 F .111 -(fer is written into the backing \214le.)-.18 F .276 +/Times-Italic@0 SF(Mpool)108 429.6 Q F0 1.013(is the library interf)3.513 F +1.013(ace intended to pro)-.1 F 1.013(vide page oriented b)-.15 F(uf)-.2 E +1.012(fer management of \214les.)-.25 F 1.012(The b)6.012 F(uf)-.2 E(fers)-.25 +E(may be shared between processes.)108 441.6 Q .416(The function)108 458.4 R F3 +(mpool_open)2.916 E F0 .417(initializes a memory pool.)2.917 F(The)5.417 E F3 +-.1(ke)2.917 G(y)-.2 E F0(ar)2.917 E .417(gument is the byte string used to ne) +-.18 F(gotiate)-.15 E .697(between multiple processes wishing to share b)108 +470.4 R(uf)-.2 E 3.196(fers. If)-.25 F .696(the \214le b)3.196 F(uf)-.2 E .696 +(fers are mapped in shared memory)-.25 F 3.196(,a)-.65 G(ll)534.44 470.4 Q .894 +(processes using the same k)108 482.4 R 1.194 -.15(ey w)-.1 H .894 +(ill share the b).15 F(uf)-.2 E 3.394(fers. If)-.25 F F3 -.1(ke)3.394 G(y)-.2 E +F0 .895(is NULL, the b)3.395 F(uf)-.2 E .895(fers are mapped into pri)-.25 F +-.25(va)-.25 G(te).25 E(memory)108 494.4 Q 5.116(.T)-.65 G(he)154.406 494.4 Q +F3(fd)2.616 E F0(ar)2.616 E .115(gument is a \214le descriptor for the underly\ +ing \214le, which must be seekable.)-.18 F(If)5.115 E F3 -.1(ke)2.615 G(y)-.2 E +F0 .115(is non-)2.615 F(NULL and matches a \214le already being mapped, the)108 +506.4 Q F3(fd)2.5 E F0(ar)2.5 E(gument is ignored.)-.18 E(The)108 523.2 Q F3 +(pa)3.328 E -.1(ge)-.1 G(size).1 E F0(ar)3.329 E .829 +(gument is the size, in bytes, of the pages into which the \214le is brok)-.18 +F .829(en up.)-.1 F(The)5.829 E F3(maxcac)3.329 E(he)-.15 E F0(ar)108 535.2 Q +.153(gument is the maximum number of pages from the underlying \214le to cache\ + at an)-.18 F 2.653(yo)-.15 G .153(ne time.)451.308 535.2 R .153(This v)5.153 F +.153(alue is)-.25 F .099(not relati)108 547.2 R .399 -.15(ve t)-.25 H 2.599(ot) +.15 G .099(he number of processes which share a \214le')168.727 547.2 R 2.6(sb) +-.55 G(uf)350.39 547.2 Q .1(fers, b)-.25 F .1(ut will be the lar)-.2 F .1 +(gest v)-.18 F .1(alue speci\214ed by)-.25 F(an)108 559.2 Q 2.5(yo)-.15 G 2.5 +(ft)129.79 559.2 S(he processes sharing the \214le.)138.4 559.2 Q(The)108 576 Q +F3(mpool_\214lter)3.254 E F0 .754(function is intended to mak)3.254 F 3.254(et) +-.1 G .754(ransparent input and output processing of the pages possi-)301.778 +576 R 3.095(ble. If)108 588 R(the)3.095 E F3(pgin)3.095 E F0 .596 +(function is speci\214ed, it is called each time a b)3.095 F(uf)-.2 E .596 +(fer is read into the memory pool from the)-.25 F .125(backing \214le.)108 600 +R .125(If the)5.125 F F3(pgout)2.625 E F0 .125 +(function is speci\214ed, it is called each time a b)2.625 F(uf)-.2 E .125 +(fer is written into the backing \214le.)-.25 F .276 (Both functions are are called with the)108 612 R F3(pgcookie)2.777 E F0 (pointer)2.777 E 2.777(,t)-.4 G .277 (he page number and a pointer to the page to being)337.27 612 R -(read or written.)108 624 Q .096(The function)108 640.8 R F3(mpool_new)2.596 E -F0 .096(takes an MPOOL pointer and an address as ar)2.596 F 2.595(guments. If) --.18 F 2.595(an)2.595 G .095(ew page can be allo-)457.43 640.8 R .944(cated, a\ - pointer to the page is returned and the page number is stored into the)108 -652.8 R F3(pgnoaddr)3.445 E F0 3.445(address. Other)3.445 F(-)-.2 E -(wise, NULL is returned and errno is set.)108 664.8 Q 1.146(The function)108 -681.6 R F3(mpool_get)3.646 E F0 1.146 -(takes a MPOOL pointer and a page number as ar)3.646 F 3.646(guments. If)-.18 F -1.145(the page exists, a)3.646 F .686(pointer to the page is returned.)108 -693.6 R .687(Otherwise, NULL is returned and errno is set.)5.686 F .687 -(The \215ags parameter is not)5.687 F(currently used.)108 705.6 Q 1.459 -(The function)108 722.4 R F3(mpool_put)3.959 E F0 1.459 -(unpins the page referenced by)3.959 F F3(pgaddr)3.959 E F0(.).53 E F3(Pgaddr) -6.458 E F0 1.458(must be an address previously)3.958 F 197.615(12, September)72 -768 R(1)535 768 Q EP +(read or written.)108 624 Q .124(The function)108 640.8 R F3(mpool_ne)2.624 E +(w)-.15 E F0(tak)2.624 E .123(es an MPOOL pointer and an address as ar)-.1 F +2.623(guments. If)-.18 F 2.623(an)2.623 G .623 -.25(ew p)457.568 640.8 T .123 +(age can be allo-).25 F .944(cated, a pointer to the page is returned and the \ +page number is stored into the)108 652.8 R F3(pgnoaddr)3.445 E F0 3.445 +(address. Other)3.445 F(-)-.2 E(wise, NULL is returned and errno is set.)108 +664.8 Q 1.167(The function)108 681.6 R F3(mpool_g)3.667 E(et)-.1 E F0(tak)3.667 +E 1.167(es a MPOOL pointer and a page number as ar)-.1 F 3.666(guments. If)-.18 +F 1.166(the page e)3.666 F 1.166(xists, a)-.15 F .686 +(pointer to the page is returned.)108 693.6 R .687 +(Otherwise, NULL is returned and errno is set.)5.686 F .687 +(The \215ags parameter is not)5.687 F(currently used.)108 705.6 Q 1.463 +(The function)108 722.4 R F3(mpool_put)3.963 E F0 1.462 +(unpins the page referenced by)3.962 F F3(pgaddr)3.962 E F0(.).73 E F3(Pgaddr) +6.462 E F0 1.462(must be an address pre)3.962 F(viously)-.25 E 197.615 +(12, September)72 768 R(1)535 768 Q EP %%Page: 2 2 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 174.84(MPOOL\(3\) 1991 MPOOL\(3\))72 48 R(returned by) -108 84 Q/F1 10/Times-Italic@0 SF(mpool_get)2.5 E F0(or)2.5 E F1(mpool_new)2.5 E -F0 5(.T).33 G(he \215ag value is speci\214ed by)271.92 84 Q F1(or)2.5 E F0 -('ing any of the following values:).53 E(MPOOL_DIR)108 100.8 Q(TY)-.6 E +108 84 Q/F1 10/Times-Italic@0 SF(mpool_g)2.5 E(et)-.1 E F0(or)2.5 E F1 +(mpool_ne)2.5 E(w)-.15 E F0 5(.T).31 G(he \215ag v)271.65 84 Q +(alue is speci\214ed by)-.25 E F1(or)2.5 E F0('ing an).73 E 2.5(yo)-.15 G 2.5 +(ft)434.74 84 S(he follo)443.35 84 Q(wing v)-.25 E(alues:)-.25 E(MPOOL_DIR)108 +100.8 Q(TY)-.6 E (The page has been modi\214ed and needs to be written to the backing \214le.) 144 112.8 Q F1(Mpool_put)108 129.6 Q F0 (returns 0 on success and -1 if an error occurs.)2.5 E .247(The function)108 146.4 R F1(mpool_sync)2.747 E F0 .247(writes all modi\214ed pages associated w\ ith the MPOOL pointer to the backing \214le.)2.747 F F1(Mpool_sync)108 158.4 Q F0(returns 0 on success and -1 if an error occurs.)2.5 E(The)108 175.2 Q F1 -(mpool_close)2.688 E F0 .187(function free')2.688 F 2.687(su)-.55 G 2.687(pa) -245.39 175.2 S .187 -(ny allocated memory associated with the memory pool cookie.)257.517 175.2 R -(Modi-)5.187 E(\214ed pages are)108 187.2 Q/F2 10/Times-Bold@0 SF(not)2.5 E F0 +(mpool_close)2.698 E F0 .198(function free')2.698 F 2.698(su)-.55 G 2.698(pa) +245.432 175.2 S .498 -.15(ny a)257.57 175.2 T .198 +(llocated memory associated with the memory pool cookie.).15 F(Modi-)5.197 E +(\214ed pages are)108 187.2 Q/F2 10/Times-Bold@0 SF(not)2.5 E F0 (written to the backing \214le.)2.5 E F1(Mpool_close)5 E F0 (returns 0 on success and -1 if an error occurs.)2.5 E/F3 9/Times-Bold@0 SF -(ERRORS)72 204 Q F0(The)108 216 Q F1(mpool_open)2.924 E F0 .424 -(function may fail and set)2.924 F F1(errno)2.924 E F0 .425 -(for any of the errors speci\214ed for the library routine)2.924 F F1(mal-) -2.925 E(loc)108 228 Q F0(\(3\).).26 E(The)108 244.8 Q F1(mpool_get)2.5 E F0 -(function may fail and set)2.5 E F1(errno)2.5 E F0(for the following:)2.5 E -([EINV)108 261.6 Q 29.92(AL] The)-1.29 F(requested record doesn')2.5 E 2.5(te) --.18 G(xist.)306.11 261.6 Q(The)108 278.4 Q F1(mpool_new)4.044 E F0(and)4.044 E -F1(mpool_get)4.044 E F0 1.544(functions may fail and set)4.044 F F1(errno)4.044 -E F0 1.543(for any of the errors speci\214ed for the)4.043 F(library routines) -108 290.4 Q F1 -.37(re)2.5 G(ad).37 E F0(\(2\)).71 E F1 2.5(,w)-.07 G(rite) -213.81 290.4 Q F0(\(2\)).18 E F1(,)-.07 E F0(and)2.5 E F1(malloc)2.5 E F0 -(\(3\).).26 E(The)108 307.2 Q F1(mpool_sync)4.272 E F0 1.773 -(function may fail and set)4.273 F F1(errno)4.273 E F0 1.773 -(for any of the errors speci\214ed for the library routine)4.273 F F1(write)108 -319.2 Q F0(\(2\).).18 E(The)108 336 Q F1(mpool_close)4.11 E F0 1.61 -(function may fail and set)4.11 F F1(errno)4.11 E F0 1.609 -(for any of the errors speci\214ed for the library routine)4.109 F F1(fr)108 -348 Q(ee)-.37 E F0(\(3\).).18 E F3(SEE ALSO)72 364.8 Q F1(dbopen)108 376.8 Q F0 -(\(3\),).21 E F1(btr)2.5 E(ee)-.37 E F0(\(3\),).18 E F1(hash)2.5 E F0(\(3\),) -.23 E F1 -.37(re)2.5 G(cno).37 E F0(\(3\)).17 E 197.615(12, September)72 768 R +(ERR)72 204 Q(ORS)-.27 E F0(The)108 216 Q F1(mpool_open)2.938 E F0 .438 +(function may f)2.938 F .438(ail and set)-.1 F F1(errno)2.938 E F0 .438(for an) +2.938 F 2.938(yo)-.15 G 2.938(ft)344.87 216 S .439 +(he errors speci\214ed for the library routine)353.918 216 R F1(mal-)2.939 E +(loc)108 228 Q F0(\(3\).).31 E(The)108 244.8 Q F1(mpool_g)2.5 E(et)-.1 E F0 +(function may f)2.5 E(ail and set)-.1 E F1(errno)2.5 E F0(for the follo)2.5 E +(wing:)-.25 E([EINV)108 261.6 Q 29.98(AL] The)-1.35 F(requested record doesn') +2.5 E 2.5(te)-.18 G(xist.)305.96 261.6 Q(The)108 278.4 Q F1(mpool_ne)4.073 E(w) +-.15 E F0(and)4.073 E F1(mpool_g)4.073 E(et)-.1 E F0 1.573(functions may f) +4.073 F 1.573(ail and set)-.1 F F1(errno)4.073 E F0 1.573(for an)4.073 F 4.073 +(yo)-.15 G 4.073(ft)421.336 278.4 S 1.573(he errors speci\214ed for the)431.519 +278.4 R(library routines)108 290.4 Q F1 -.37(re)2.5 G(ad).37 E F0(\(2\)).77 E +F1 2.5(,w).54 G(rite)214.48 290.4 Q F0(\(2\)).18 E F1(,).54 E F0(and)2.5 E F1 +(malloc)2.5 E F0(\(3\).).31 E(The)108 307.2 Q F1(mpool_sync)4.287 E F0 1.787 +(function may f)4.287 F 1.787(ail and set)-.1 F F1(errno)4.288 E F0 1.788 +(for an)4.288 F 4.288(yo)-.15 G 4.288(ft)356.694 307.2 S 1.788 +(he errors speci\214ed for the library routine)367.092 307.2 R F1(write)108 +319.2 Q F0(\(2\).).18 E(The)108 336 Q F1(mpool_close)4.125 E F0 1.624 +(function may f)4.125 F 1.624(ail and set)-.1 F F1(errno)4.124 E F0 1.624 +(for an)4.124 F 4.124(yo)-.15 G 4.124(ft)357.842 336 S 1.624 +(he errors speci\214ed for the library routine)368.076 336 R F1(fr)108 348 Q +(ee)-.37 E F0(\(3\).).18 E F3(SEE ALSO)72 364.8 Q F1(dbopen)108 376.8 Q F0 +(\(3\),).24 E F1(btr)2.5 E(ee)-.37 E F0(\(3\),).18 E F1(hash)2.5 E F0(\(3\),) +.28 E F1 -.37(re)2.5 G(cno).37 E F0(\(3\)).18 E 197.615(12, September)72 768 R (2)535 768 Q EP %%Trailer end diff --git a/lib/libc/DB/doc/recno.3.ps b/lib/libc/DB/doc/recno.3.ps index a689e6b305ae..6ea5344151d7 100644 --- a/lib/libc/DB/doc/recno.3.ps +++ b/lib/libc/DB/doc/recno.3.ps @@ -1,356 +1,317 @@ %!PS-Adobe-3.0 -%%Creator: groff version 1.03 +%%Creator: groff version 1.08 %%DocumentNeededResources: font Times-Roman %%+ font Times-Bold %%+ font Times-Italic -%%DocumentSuppliedResources: procset grops 1.03 0 +%%DocumentSuppliedResources: procset grops 1.08 0 %%Pages: 2 %%PageOrder: Ascend %%Orientation: Portrait %%EndComments %%BeginProlog -%%BeginResource: procset grops 1.03 0 - -/setpacking where { - pop - currentpacking - true setpacking -} if - -/grops 120 dict dup begin - -% The ASCII code of the space character. +%%BeginResource: procset grops 1.08 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 - -% name size font SF - - -/SF { - findfont exch - [ exch dup 0 exch 0 exch neg 0 0 ] makefont - dup setfont - [ exch /setfont cvx ] cvx bind def -} bind def - -% name a c d font MF - - -/MF { - findfont - [ 5 2 roll - 0 3 1 roll % b - neg 0 0 ] makefont - dup setfont - [ exch /setfont cvx ] cvx bind def -} bind 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 - -% BP - - -/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 - - -% centerx centery radius startangle endangle DA - - -/DA { - newpath arcn stroke -} bind def - -% x y SN - x' y' -% round a position to nearest (pixel + (.25,.25)) - -/SN { - transform - .25 sub exch .25 sub exch - round .25 add exch round .25 add exch - itransform -} bind def - -% endx endy startx starty DL - -% we round the endpoints of the line, so that parallel horizontal -% and vertical lines will appear even - -/DL { - SN - moveto - SN - lineto stroke -} bind def - -% centerx centery radius DC - - -/DC { - newpath 0 360 arc closepath -} 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 - -% width height centerx centery DE - - -/DE { - TM currentmatrix pop - translate scale newpath 0 0 .5 0 360 arc closepath - TM setmatrix -} bind def - -% these are for splines - -/RC /rcurveto load def -/RL /rlineto load def -/ST /stroke load def -/MT /moveto load def -/CL /closepath load def - -% fill the last path - -% amount FL - - -/FL { - currentgray exch setgray fill setgray -} bind def - -% fill with the ``current color'' - -/BL /fill load def - -/LW /setlinewidth load def -% new_font_name encoding_vector old_font_name RE - - -/RE { - findfont - dup maxlength dict begin - { - 1 index /FID ne { def } { pop pop } ifelse - } forall - /Encoding exch def - dup /FontName exch def - currentdict end definefont pop -} bind 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 - -% hpos vpos EBEGIN - - -/EBEGIN { - moveto - DEFS begin -} bind def - -/EEND /end load def - +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def /CNT 0 def /level1 0 def - -% llx lly newwid wid newht ht newllx newlly PBEGIN - - -/PBEGIN { - /level1 save def - translate - div 3 1 roll div exch scale - neg exch neg exch translate - % set the graphics state to default values - 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 - +/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 +/setpacking where{ +pop +setpacking +}if %%EndResource -%%EndProlog -%%BeginSetup %%IncludeResource: font Times-Roman %%IncludeResource: font Times-Bold %%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/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/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/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-Bold@0 ENC0/Times-Bold -RE/Times-Roman@0 ENC0/Times-Roman RE -%%EndSetup +/.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-Bold@0 ENC0/Times-Bold RE/Times-Roman@0 ENC0/Times-Roman RE +%%EndProlog %%Page: 1 1 %%BeginPageSetup BP %%EndPageSetup -/F0 10/Times-Roman@0 SF 175.95(RECNO\(3\) 1992 RECNO\(3\))72 48 R/F1 9 -/Times-Bold@0 SF(NAME)72 84 Q F0 +/F0 10/Times-Roman@0 SF 175.95(RECNO\(3\) 1993 RECNO\(3\))72 48 R/F1 9 +/Times-Bold@0 SF -.18(NA)72 84 S(ME).18 E F0 (recno \255 record number database access method)108 96 Q F1(SYNOPSIS)72 112.8 -Q/F2 10/Times-Bold@0 SF(#include )108 124.8 Q(#include )108 -136.8 Q F1(DESCRIPTION)72 153.6 Q F0 1.152(The routine)108 165.6 R/F3 10 -/Times-Italic@0 SF(dbopen)3.652 E F0 1.152 -(is the library interface to database \214les.)3.652 F 1.151 -(One of the supported \214le formats is record)6.152 F 1.161(number \214les.) -108 177.6 R 1.161(The general description of the database access methods is in) -6.161 F F3(dbopen)3.662 E F0 1.162(\(3\), this manual page).21 F -(describes only the recno speci\214c information.)108 189.6 Q 1.917(The record\ - number data structure is either variable or \214xed-length records stored in \ -a \215at-\214le format,)108 206.4 R 2.01(accessed by the logical record number) -108 218.4 R 7.01(.T)-.55 G 2.01 -(he existence of record number \214ve implies the existence of)286.13 218.4 R -.867(records one through four)108 230.4 R 3.367(,a)-.4 G .866 -(nd the deletion of record number one causes record number \214ve to be renum-) -219.648 230.4 R .269(bered to record number four)108 242.4 R 2.769(,a)-.4 G -2.769(sw)231.125 242.4 S .269(ell as the cursor)245.004 242.4 R 2.769(,i)-.4 G -2.77(fp)316.5 242.4 S .27(ositioned after record number one, to shift down one) -327.6 242.4 R(record.)108 254.4 Q .341 -(The recno access method speci\214c data structure provided to)108 271.2 R F3 -(dbopen)2.841 E F0 .34(is de\214ned in the include \214le as)2.841 F -(follows:)108 283.2 Q(typedef struct {)108 300 Q(u_char bval;)144 312 Q -(u_int cachesize;)144 324 Q(u_long \215ags;)144 336 Q(int lorder;)144 348 Q -(size_t reclen;)144 360 Q 2.5(}R)108 372 S(ECNOINFO;)121.97 372 Q -(The elements of this structure are de\214ned as follows:)108 388.8 Q 16.28 -(bval The)108 405.6 R .168(delimiting byte to be used to mark the end of a rec\ -ord for variable-length records, and the pad)2.668 F .766 -(character for \214xed-length records.)144 417.6 R .765 -(If no value is speci\214ed, newlines \(`)5.766 F(`\\n')-.74 E .765 -('\) are used to mark the)-.74 F(end of variable-length records and \214xed-le\ -ngth records are padded with spaces.)144 429.6 Q(cachesize)108 446.4 Q 3.143 -(As)144 458.4 S .644(uggested maximum size, in bytes, of the memory cache.) -158.253 458.4 R .644(This value is)5.644 F F2(only)3.144 E F0(advisory)3.144 E -3.144(,a)-.65 G .644(nd the)514.636 458.4 R -(access method will allocate more memory rather than fail.)144 470.4 Q 14.61 -(\215ags The)108 487.2 R(\215ag value is speci\214ed by)2.5 E F3(or)2.5 E F0 -('ing any of the following values:).53 E(R_FIXEDLEN)144 504 Q .949 -(The records are \214xed-length, not byte delimited.)180 516 R .949 -(The structure element)5.949 F F3 -.37(re)3.449 G(clen).37 E F0(speci\214es) -3.449 E(the length of the record, and the structure element)180 528 Q F3(bval) -2.5 E F0(is used as the pad character)2.5 E(.)-.55 E(R_NOKEY)144 544.8 Q 2.296 -(In the interface speci\214ed by)180 556.8 R F3(dbopen)4.796 E F0 4.796(,t).21 -G 2.296(he sequential record retrieval \214lls in both the)344.786 556.8 R --2.13(caller ')180 568.8 R 3.502(sk)-.55 G 1.002(ey and data structures.) -217.752 568.8 R 1.001(If the R_NOKEY \215ag is speci\214ed, the)6.002 F F3 -(cursor)3.501 E F0(routines)3.501 E .678 -(are not required to \214ll in the key structure.)180 580.8 R .679 -(This permits applications to retrieve records)5.679 F -(at the end of \214les without reading all of the intervening records.)180 -592.8 Q(R_SNAPSHOT)144 609.6 Q .958 -(This \215ag requires that a snapshot of the \214le be taken when)180 621.6 R -F3(dbopen)3.458 E F0 .958(is called, instead of)3.458 F -(permitting any unmodi\214ed records to be read from the original \214le.)180 -633.6 Q 9.62(lorder The)108 650.4 R 1.586 -(byte order for integers in the stored database metadata.)4.085 F 1.586 -(The number should represent the)6.586 F .667 -(order as an integer; for example, big endian order would be the number 4,321.) -144 662.4 R(If)5.666 E F3(lor)3.166 E(der)-.37 E F0 .666(is 0 \(no)3.166 F -(order is speci\214ed\) the current host order is used.)144 674.4 Q 9.07 -(reclen The)108 691.2 R(length of a \214xed-length record.)2.5 E .958(The data\ - part of the key/data pair used by the recno access method is the same as othe\ -r access methods.)108 708 R .176(The key is dif)108 720 R 2.676(ferent. The) --.18 F F3(data)2.676 E F0 .175 -(\214eld of the key should be a pointer to a memory location of type)2.675 F F3 --.37(re)2.675 G(cno_t).37 E F0 2.675(,a).6 G(s)536.11 720 Q 203.455 -(4, December)72 768 R(1)535 768 Q EP +Q/F2 10/Times-Bold@0 SF(#include )108 124.8 Q(#include )-.4 E F1(DESCRIPTION)72 153.6 Q F0 1.158(The routine)108 165.6 R/F3 +10/Times-Italic@0 SF(dbopen)3.658 E F0 1.158(is the library interf)3.658 F +1.158(ace to database \214les.)-.1 F 1.157 +(One of the supported \214le formats is record)6.158 F 1.159(number \214les.) +108 177.6 R 1.159(The general description of the database access methods is in) +6.159 F F3(dbopen)3.66 E F0 1.16(\(3\), this manual page).24 F +(describes only the recno speci\214c information.)108 189.6 Q 1.944 +(The record number data structure is either v)108 206.4 R 1.944 +(ariable or \214x)-.25 F 1.944 +(ed-length records stored in a \215at-\214le format,)-.15 F 2.04 +(accessed by the logical record number)108 218.4 R 7.04(.T)-.55 G 2.04(he e) +286.31 218.4 R 2.04(xistence of record number \214v)-.15 F 4.54(ei)-.15 G 2.04 +(mplies the e)442.1 218.4 R 2.04(xistence of)-.15 F .876 +(records one through four)108 230.4 R 3.376(,a)-.4 G .875 +(nd the deletion of record number one causes record number \214v)219.684 230.4 +R 3.375(et)-.15 G 3.375(ob)489.93 230.4 S 3.375(er)503.305 230.4 S(enum-)514.45 +230.4 Q .282(bered to record number four)108 242.4 R 2.782(,a)-.4 G 2.782(sw) +231.19 242.4 S .283(ell as the cursor)245.082 242.4 R 2.783(,i)-.4 G 2.783(fp) +316.633 242.4 S .283(ositioned after record number one, to shift do)327.746 +242.4 R .283(wn one)-.25 F(record.)108 254.4 Q .373 +(The recno access method speci\214c data structure pro)108 271.2 R .373 +(vided to)-.15 F F3(dbopen)2.873 E F0 .373(is de\214ned in the include \214le as)-.4 F(follo)108 283.2 Q(ws:)-.25 E(typedef struct {)108 +300 Q(u_char b)144 312 Q -.25(va)-.15 G(l;).25 E(u_int cachesize;)144 324 Q +(inde)144 336 Q(x_t psize;)-.15 E(u_long \215ags;)144 348 Q(int lorder;)144 360 +Q(size_t reclen;)144 372 Q(char *bfname;)144 384 Q 2.5(}R)108 396 S(ECNOINFO;) +121.97 396 Q(The elements of this structure are de\214ned as follo)108 412.8 Q +(ws:)-.25 E -.15(bv)108 429.6 S 16.68(al The)-.1 F .182 +(delimiting byte to be used to mark the end of a record for v)2.682 F .183 +(ariable-length records, and the pad)-.25 F .809(character for \214x)144 441.6 +R .809(ed-length records.)-.15 F .809(If no v)5.809 F .809 +(alue is speci\214ed, ne)-.25 F .809(wlines \(`)-.25 F(`\\n')-.74 E .808 +('\) are used to mark the)-.74 F(end of v)144 453.6 Q +(ariable-length records and \214x)-.25 E +(ed-length records are padded with spaces.)-.15 E(cachesize)108 470.4 Q 3.159 +(As)144 482.4 S .659(uggested maximum size, in bytes, of the memory cache.) +158.269 482.4 R .66(This v)5.659 F .66(alue is)-.25 F F2(only)3.16 E F0 +(advisory)3.16 E 3.16(,a)-.65 G .66(nd the)514.62 482.4 R +(access method will allocate more memory rather than f)144 494.4 Q(ail.)-.1 E +12.95(psize The)108 511.2 R .715 +(recno access method stores the in-memory copies of its records in a btree.) +3.216 F .715(This v)5.715 F .715(alue is the)-.25 F +(size \(in bytes\) of the pages used for nodes in that tree.)144 523.2 Q(See)5 +E F3(btr)2.5 E(ee)-.37 E F0(\(3\) for more information.).18 E 3.51(bfname The) +108 540 R .505 +(recno access method stores the in-memory copies of its records in a btree.) +3.005 F .506(If bfname is non-)5.506 F .065(NULL, it speci\214es the name of t\ +he btree \214le, as if speci\214ed as the \214le name for a dbopen of a btree) +144 552 R(\214le.)144 564 Q 14.61(\215ags The)108 580.8 R(\215ag v)2.5 E +(alue is speci\214ed by)-.25 E F3(or)2.5 E F0('ing an).73 E 2.5(yo)-.15 G 2.5 +(ft)313.2 580.8 S(he follo)321.81 580.8 Q(wing v)-.25 E(alues:)-.25 E +(R_FIXEDLEN)144 597.6 Q .962(The records are \214x)180 609.6 R .963 +(ed-length, not byte delimited.)-.15 F .963(The structure element)5.963 F F3 +-.37(re)3.463 G(clen).37 E F0(speci\214es)3.463 E +(the length of the record, and the structure element)180 621.6 Q F3(bval)2.5 E +F0(is used as the pad character)2.5 E(.)-.55 E(R_NOKEY)144 638.4 Q 2.34 +(In the interf)180 650.4 R 2.34(ace speci\214ed by)-.1 F F3(dbopen)4.84 E F0 +4.84(,t).24 G 2.34(he sequential record retrie)344.98 650.4 R -.25(va)-.25 G +4.84<6c8c>.25 G 2.34(lls in both the)478.25 650.4 R(caller')180 662.4 Q 3.556 +(sk)-.55 G 1.357 -.15(ey a)217.336 662.4 T 1.057(nd data structures.).15 F +1.057(If the R_NOKEY \215ag is speci\214ed, the)6.057 F F3(cur)3.557 E(sor)-.1 +E F0(routines)3.557 E .029(are not required to \214ll in the k)180 674.4 R .329 +-.15(ey s)-.1 H 2.529(tructure. This).15 F .028(permits applications to retrie) +2.529 F .328 -.15(ve r)-.25 H .028(ecords at).15 F +(the end of \214les without reading all of the interv)180 686.4 Q +(ening records.)-.15 E(R_SN)144 703.2 Q(APSHO)-.35 E(T)-.4 E .964 +(This \215ag requires that a snapshot of the \214le be tak)180 715.2 R .965 +(en when)-.1 F F3(dbopen)3.465 E F0 .965(is called, instead of)3.465 F +(permitting an)180 727.2 Q 2.5(yu)-.15 G +(nmodi\214ed records to be read from the original \214le.)245.96 727.2 Q +209.835(16, May)72 768 R(1)535 768 Q EP %%Page: 2 2 %%BeginPageSetup BP %%EndPageSetup -/F0 10/Times-Roman@0 SF 175.95(RECNO\(3\) 1992 RECNO\(3\))72 48 R .447 -(de\214ned in the include \214le.)108 84 R .447 -(This type is normally the lar)5.447 F .447 -(gest unsigned integral type available to the)-.18 F 2.5(implementation. The) -108 96 R/F1 10/Times-Italic@0 SF(size)2.5 E F0 -(\214eld of the key should be the size of that type.)2.5 E .043 -(In the interface speci\214ed by)108 112.8 R F1(dbopen)2.542 E F0 2.542(,u).21 -G .042(sing the)261.484 112.8 R F1(put)2.542 E F0 .042 -(interface to create a new record will cause the creation of)2.542 F .755(mult\ -iple, empty records if the record number is more than one greater than the lar) -108 124.8 R .755(gest record currently in)-.18 F(the database.)108 136.8 Q/F2 9 -/Times-Bold@0 SF(SEE ALSO)72 153.6 Q F1(dbopen)108 165.6 Q F0(\(3\),).21 E F1 -(hash)2.5 E F0(\(3\),).23 E F1(mpool)2.5 E F0(\(3\),).48 E F1 -.37(re)2.5 G -(cno).37 E F0(\(3\)).17 E F1 2.744(Document Pr)108 189.6 R 2.744 -(ocessing in a Relational Database System)-.37 F F0 5.244(,M).26 G 2.743 -(ichael Stonebraker)362.078 189.6 R 5.243(,H)-.4 G 2.743(eidi Stettner)454.084 -189.6 R 5.243(,J)-.4 G(oseph)516.67 189.6 Q(Kalash, Antonin Guttman, Nadene L) -108 201.6 Q(ynn, Memorandum No. UCB/ERL M82/32, May 1982.)-.55 E F2(BUGS)72 -218.4 Q F0(Only big and little endian byte order is supported.)108 230.4 Q -203.455(4, December)72 768 R(2)535 768 Q EP +/F0 10/Times-Roman@0 SF 175.95(RECNO\(3\) 1993 RECNO\(3\))72 48 R 9.62 +(lorder The)108 84 R 1.597(byte order for inte)4.097 F 1.596 +(gers in the stored database metadata.)-.15 F 1.596 +(The number should represent the)6.596 F .688(order as an inte)144 96 R .689 +(ger; for e)-.15 F .689(xample, big endian order w)-.15 F .689 +(ould be the number 4,321.)-.1 F(If)5.689 E/F1 10/Times-Italic@0 SF(lor)3.189 E +(der)-.37 E F0 .689(is 0 \(no)3.189 F +(order is speci\214ed\) the current host order is used.)144 108 Q 9.07 +(reclen The)108 124.8 R(length of a \214x)2.5 E(ed-length record.)-.15 E .972 +(The data part of the k)108 141.6 R -.15(ey)-.1 G .971(/data pair used by the \ +recno access method is the same as other access methods.).15 F .198(The k)108 +153.6 R .498 -.15(ey i)-.1 H 2.698(sd).15 G(if)157.504 153.6 Q 2.698 +(ferent. The)-.25 F F1(data)2.698 E F0 .198(\214eld of the k)2.698 F .499 -.15 +(ey s)-.1 H .199(hould be a pointer to a memory location of type).15 F F1 -.37 +(re)2.699 G(cno_t).37 E F0 2.699(,a).68 G(s)536.11 153.6 Q .506 +(de\214ned in the include \214le.)-.4 F .506 +(This type is normally the lar)5.506 F .506(gest unsigned inte)-.18 F .506 +(gral type a)-.15 F -.25(va)-.2 G .505(ilable to the).25 F 2.5 +(implementation. The)108 177.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.).15 E .064(In the interf)108 +194.4 R .064(ace speci\214ed by)-.1 F F1(dbopen)2.564 E F0 2.564(,u).24 G .064 +(sing the)261.544 194.4 R F1(put)2.564 E F0(interf)2.564 E .064 +(ace to create a ne)-.1 F 2.564(wr)-.25 G .065 +(ecord will cause the creation of)414.436 194.4 R .755(multiple, empty records\ + if the record number is more than one greater than the lar)108 206.4 R .754 +(gest record currently in)-.18 F(the database.)108 218.4 Q/F2 9/Times-Bold@0 SF +(SEE ALSO)72 235.2 Q F1(dbopen)108 247.2 Q F0(\(3\),).24 E F1(hash)2.5 E F0 +(\(3\),).28 E F1(mpool)2.5 E F0(\(3\),).51 E F1 -.37(re)2.5 G(cno).37 E F0 +(\(3\)).18 E F1 2.754(Document Pr)108 271.2 R 2.754 +(ocessing in a Relational Database System)-.45 F F0 5.255(,M).32 G 2.755 +(ichael Stonebrak)362.13 271.2 R(er)-.1 E 5.255(,H)-.4 G 2.755(eidi Stettner) +454.06 271.2 R 5.255(,J)-.4 G(oseph)516.67 271.2 Q +(Kalash, Antonin Guttman, Nadene L)108 283.2 Q +(ynn, Memorandum No. UCB/ERL M82/32, May 1982.)-.55 E F2 -.09(BU)72 300 S(GS) +.09 E F0(Only big and little endian byte order is supported.)108 312 Q 209.835 +(16, May)72 768 R(2)535 768 Q EP %%Trailer end %%EOF diff --git a/lib/libc/DB/hash/hash.c b/lib/libc/DB/hash/hash.c index d3ff3a682f9d..dae460fe9da8 100644 --- a/lib/libc/DB/hash/hash.c +++ b/lib/libc/DB/hash/hash.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)hash.c 5.33 (Berkeley) 2/21/93"; +static char sccsid[] = "@(#)hash.c 5.35 (Berkeley) 5/23/93"; #endif /* LIBC_SCCS and not lint */ #include @@ -61,13 +61,14 @@ static int flush_meta __P((HTAB *)); static int hash_access __P((HTAB *, ACTION, DBT *, DBT *)); static int hash_close __P((DB *)); static int hash_delete __P((const DB *, const DBT *, u_int)); +static int hash_fd __P((const DB *)); static int hash_get __P((const DB *, const DBT *, DBT *, u_int)); static int hash_put __P((const DB *, DBT *, const DBT *, u_int)); static void *hash_realloc __P((SEGMENT **, int, int)); static int hash_seq __P((const DB *, DBT *, DBT *, u_int)); -static int hash_sync __P((const DB *)); +static int hash_sync __P((const DB *, u_int)); static int hdestroy __P((HTAB *)); -static HTAB *init_hash __P((HTAB *, HASHINFO *)); +static HTAB *init_hash __P((HTAB *, const char *, HASHINFO *)); static int init_htab __P((HTAB *, int)); #if BYTE_ORDER == LITTLE_ENDIAN static void swap_header __P((HTAB *)); @@ -131,7 +132,7 @@ __hash_open(file, flags, mode, info) (void)fcntl(hashp->fp, F_SETFD, 1); } if (new_table) { - if (!(hashp = init_hash(hashp, (HASHINFO *)info))) + if (!(hashp = init_hash(hashp, file, (HASHINFO *)info))) RETURN_ERROR(errno, error1); } else { /* Table already exists */ @@ -196,6 +197,7 @@ __hash_open(file, flags, mode, info) dbp->internal = hashp; dbp->close = hash_close; dbp->del = hash_delete; + dbp->fd = hash_fd; dbp->get = hash_get; dbp->put = hash_put; dbp->seq = hash_seq; @@ -252,12 +254,31 @@ hash_close(dbp) return (retval); } +static int +hash_fd(dbp) + const DB *dbp; +{ + HTAB *hashp; + + if (!dbp) + return (ERROR); + + hashp = (HTAB *)dbp->internal; + if (hashp->fp == -1) { + errno = ENOENT; + return (-1); + } + return (hashp->fp); +} + /************************** LOCAL CREATION ROUTINES **********************/ static HTAB * -init_hash(hashp, info) +init_hash(hashp, file, info) HTAB *hashp; + const char *file; HASHINFO *info; { + struct stat statbuf; int nelem; nelem = 1; @@ -273,6 +294,14 @@ init_hash(hashp, info) memset(hashp->SPARES, 0, sizeof(hashp->SPARES)); memset(hashp->BITMAPS, 0, sizeof (hashp->BITMAPS)); + /* Fix bucket size to be optimal for file system */ + if (file != NULL) { + if (stat(file, &statbuf)) + return (NULL); + hashp->BSIZE = statbuf.st_blksize; + hashp->BSHIFT = __log2(hashp->BSIZE); + } + if (info) { if (info->bsize) { /* Round pagesize up to power of 2 */ @@ -415,11 +444,17 @@ hdestroy(hashp) * -1 ERROR */ static int -hash_sync(dbp) +hash_sync(dbp, flags) const DB *dbp; + u_int flags; { HTAB *hashp; + if (flags != 0) { + errno = EINVAL; + return (ERROR); + } + if (!dbp) return (ERROR); diff --git a/lib/libc/DB/hash/hash.h b/lib/libc/DB/hash/hash.h index 4fd77a3cb659..9e57cb443f7d 100644 --- a/lib/libc/DB/hash/hash.h +++ b/lib/libc/DB/hash/hash.h @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)hash.h 5.6 (Berkeley) 9/8/91 + * @(#)hash.h 5.7 (Berkeley) 5/23/93 */ /* Operations */ @@ -115,12 +115,13 @@ typedef struct htab { /* Memory resident data structure */ #define MIN_BUFFERS 6 #define MINHDRSIZE 512 #define DEF_BUFSIZE 65536 /* 64 K */ -#define DEF_BUCKET_SIZE 256 -#define DEF_BUCKET_SHIFT 8 /* log2(BUCKET) */ +#define DEF_BUCKET_SIZE 4096 +#define DEF_BUCKET_SHIFT 12 /* log2(BUCKET) */ #define DEF_SEGSIZE 256 #define DEF_SEGSIZE_SHIFT 8 /* log2(SEGSIZE) */ #define DEF_DIRSIZE 256 -#define DEF_FFACTOR 5 +#define DEF_FFACTOR 65536 +#define MIN_FFACTOR 4 #define SPLTMAX 8 #define CHARKEY "%$sniglet^&" #define NUMKEY 1038583 diff --git a/lib/libc/DB/hash/hash_page.c b/lib/libc/DB/hash/hash_page.c index a4a6121dbfcb..893d6494fec5 100644 --- a/lib/libc/DB/hash/hash_page.c +++ b/lib/libc/DB/hash/hash_page.c @@ -55,7 +55,6 @@ static char sccsid[] = "@(#)hash_page.c 5.25 (Berkeley) 2/16/93"; */ #include -#include #include #include @@ -474,6 +473,13 @@ __add_ovflpage(hashp, bufp) int tmp1, tmp2; #endif sp = (u_short *)bufp->page; + + /* Check if we are dynamically determining the fill factor */ + if (hashp->FFACTOR == DEF_FFACTOR) { + hashp->FFACTOR = sp[0] >> 1; + if (hashp->FFACTOR < MIN_FFACTOR) + hashp->FFACTOR = MIN_FFACTOR; + } bufp->flags |= BUF_MOD; ovfl_num = overflow_page(hashp); #ifdef DEBUG1 diff --git a/lib/libc/DB/hash/ndbm.c b/lib/libc/DB/hash/ndbm.c index b9c4b81d6f16..5b66bcf3385a 100644 --- a/lib/libc/DB/hash/ndbm.c +++ b/lib/libc/DB/hash/ndbm.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)ndbm.c 5.13 (Berkeley) 2/11/93"; +static char sccsid[] = "@(#)ndbm.c 5.14 (Berkeley) 5/23/93"; #endif /* LIBC_SCCS and not lint */ /* @@ -64,8 +64,8 @@ dbm_open(file, flags, mode) HASHINFO info; char path[MAXPATHLEN]; - info.bsize = 1024; - info.ffactor = 5; + info.bsize = 4096; + info.ffactor = 40; info.nelem = 1; info.cachesize = NULL; info.hash = NULL; diff --git a/lib/libc/DB/man/dbopen.3 b/lib/libc/DB/man/dbopen.3 index c3e5670a7fcc..c136a70c8bb3 100644 --- a/lib/libc/DB/man/dbopen.3 +++ b/lib/libc/DB/man/dbopen.3 @@ -29,9 +29,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" @(#)dbopen.3 5.23 (Berkeley) 12/4/92 +.\" @(#)dbopen.3 5.26 (Berkeley) 5/24/93 .\" -.TH DBOPEN 3 "December 4, 1992" +.TH DBOPEN 3 "May 24, 1993" .UC 7 .SH NAME dbopen \- database access methods @@ -104,11 +104,12 @@ typedef struct { DBTYPE type; int (*close)(const DB *db); int (*del)(const DB *db, const DBT *key, u_int flags); +int (*fd)(const DB *db); int (*get)(const DB *db, DBT *key, DBT *data, u_int flags); int (*put)(const DB *db, DBT *key, const DBT *data, .ti +5 u_int flags); -int (*sync)(const DB *db); +int (*sync)(const DB *db, u_int flags); int (*seq)(const DB *db, DBT *key, DBT *data, u_int flags); .RE } DB; @@ -157,6 +158,28 @@ routines return -1 on error (setting .I key was not in the file. .TP +fd +A pointer to a routine which returns a file descriptor representative +of the underlying database. +A file descriptor referencing the same file will be returned to all +processes which call +.I dbopen +with the same +.I file +name. +This file descriptor may be safely used as a 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. +No file descriptor is available for in memory databases. +.I Fd +routines return -1 on error (setting +.IR errno ), +and the file descriptor on success. +.TP get A pointer to a routine which is the interface for keyed retrieval from the database. @@ -183,19 +206,6 @@ R_CURSOR Replace the key/data pair referenced by the cursor. The cursor must have previously been initialized. .TP -R_CURSORLOG -Store the data into the tree after the record referenced by the cursor, -creating a new key/data pair if the database is empty or if the cursor -references the last entry in the database, otherwise overwriting the -record after the cursor. -If the cursor is unitialized, the first record in the database is -created or overwritten. -In any case, the cursor is set to reference the stored record, and the -record number of the stored record is returned in the -.I key -structure. -(Applicable only to the DB_RECNO access method.) -.TP R_IAFTER Append the data immediately after the data referenced by .IR key , @@ -227,7 +237,7 @@ R_SETCURSOR is available only for the DB_BTREE and DB_RECNO access methods because it implies that the keys have an inherent order which does not change. .IP -R_CURSORLOG, R_IAFTER and R_IBEFORE are available only for the DB_RECNO +R_IAFTER and R_IBEFORE are available only for the DB_RECNO access method because they each imply that the access method is able to create new keys. This is only true if the keys are ordered and independent, record numbers @@ -323,6 +333,21 @@ A pointer to a routine to flush any cached information to disk. If the database is in memory only, the .I sync routine has no effect and will always succeed. +.IP +The flag value may be set to the following value: +.RS +.TP +R_RECNOSYNC +If the DB_RECNO access method is being used, this flag causes +the sync routine to apply to the btree file which underlies the +recno file, not the recno file itself. +(See the +.I bfname +field of the +.IR recno (3) +manual page for more information.) +.RE +.IP .I Sync routines return -1 on error (setting .IR errno ) @@ -401,6 +426,12 @@ or .IR malloc (3). .PP The +.I fd +routines will fail and set +.I errno +to ENOENT for in memory databases. +.PP +The .I sync routines may fail and set .I errno @@ -415,5 +446,8 @@ for any of the errors specified for the library routine The typedef DBT is a mnemonic for ``data base thang'', and was used because noone could think of a reasonable name that wasn't already used. .PP +The file descriptor interface is a kluge and will be deleted in a +future version of the interface. +.PP None of the access methods provide any form of concurrent access, locking, or transactions. diff --git a/lib/libc/DB/man/recno.3 b/lib/libc/DB/man/recno.3 index 4f8d315e03fc..cdbdf7309032 100644 --- a/lib/libc/DB/man/recno.3 +++ b/lib/libc/DB/man/recno.3 @@ -29,9 +29,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" @(#)recno.3 5.5 (Berkeley) 12/4/92 +.\" @(#)recno.3 5.6 (Berkeley) 5/16/93 .\" -.TH RECNO 3 "December 4, 1992" +.TH RECNO 3 "May 16, 1993" .UC 7 .SH NAME recno \- record number database access method @@ -70,11 +70,15 @@ u_char bval; .br u_int cachesize; .br +index_t psize; +.br u_long flags; .br int lorder; .br size_t reclen; +.br +char *bfname; .RE } RECNOINFO; .PP @@ -94,6 +98,20 @@ This value is .B only advisory, and the access method will allocate more memory rather than fail. .TP +psize +The recno access method stores the in-memory copies of its records +in a btree. +This value is the size (in bytes) of the pages used for nodes in that tree. +See +.IR btree (3) +for more information. +.TP +bfname +The recno access method stores the in-memory copies of its records +in a btree. +If bfname is non-NULL, it specifies the name of the btree file, +as if specified as the file name for a dbopen of a btree file. +.TP flags The flag value is specified by .IR or 'ing diff --git a/lib/libc/DB/recno/extern.h b/lib/libc/DB/recno/extern.h index 15567e049fca..3750042741d8 100644 --- a/lib/libc/DB/recno/extern.h +++ b/lib/libc/DB/recno/extern.h @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)extern.h 5.3 (Berkeley) 11/13/92 + * @(#)extern.h 5.5 (Berkeley) 5/24/93 */ #include "../btree/extern.h" @@ -38,6 +38,7 @@ int __rec_close __P((DB *)); int __rec_delete __P((const DB *, const DBT *, u_int)); int __rec_dleaf __P((BTREE *, PAGE *, int)); +int __rec_fd __P((const DB *)); int __rec_fmap __P((BTREE *, recno_t)); int __rec_fout __P((BTREE *)); int __rec_fpipe __P((BTREE *, recno_t)); @@ -47,7 +48,7 @@ int __rec_put __P((const DB *dbp, DBT *, const DBT *, u_int)); int __rec_ret __P((BTREE *, EPG *, recno_t, DBT *, DBT *)); EPG *__rec_search __P((BTREE *, recno_t, enum SRCHOP)); int __rec_seq __P((const DB *, DBT *, DBT *, u_int)); -int __rec_sync __P((const DB *)); +int __rec_sync __P((const DB *, u_int)); int __rec_vmap __P((BTREE *, recno_t)); int __rec_vout __P((BTREE *)); int __rec_vpipe __P((BTREE *, recno_t)); diff --git a/lib/libc/DB/recno/rec_close.c b/lib/libc/DB/recno/rec_close.c index 140cc9ad600a..29af212c2d44 100644 --- a/lib/libc/DB/recno/rec_close.c +++ b/lib/libc/DB/recno/rec_close.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)rec_close.c 5.9 (Berkeley) 3/19/93"; +static char sccsid[] = "@(#)rec_close.c 5.11 (Berkeley) 5/16/93"; #endif /* LIBC_SCCS and not lint */ #include @@ -63,19 +63,23 @@ __rec_close(dbp) BTREE *t; int rval; - if (__rec_sync(dbp) == RET_ERROR) + if (__rec_sync(dbp, 0) == RET_ERROR) return (RET_ERROR); /* Committed to closing. */ t = dbp->internal; rval = RET_SUCCESS; - if (ISSET(t, BTF_MEMMAPPED) && munmap(t->bt_smap, t->bt_msize)) + if (ISSET(t, R_MEMMAPPED) && munmap(t->bt_smap, t->bt_msize)) rval = RET_ERROR; - if (!ISSET(t, BTF_RINMEM) && - ISSET(t, BTF_CLOSEFP) ? fclose(t->bt_rfp) : close(t->bt_rfd)) - rval = RET_ERROR; + if (!ISSET(t, R_INMEM)) + if (ISSET(t, R_CLOSEFP)) { + if (fclose(t->bt_rfp)) + rval = RET_ERROR; + } else + if (close(t->bt_rfd)) + rval = RET_ERROR; if (__bt_close(dbp) == RET_ERROR) rval = RET_ERROR; @@ -93,8 +97,9 @@ __rec_close(dbp) * RET_SUCCESS, RET_ERROR. */ int -__rec_sync(dbp) +__rec_sync(dbp, flags) const DB *dbp; + u_int flags; { struct iovec iov[2]; BTREE *t; @@ -105,11 +110,14 @@ __rec_sync(dbp) t = dbp->internal; - if (ISSET(t, BTF_RDONLY | BTF_RINMEM) || !ISSET(t, BTF_MODIFIED)) + if (flags == R_RECNOSYNC) + return (__bt_sync(dbp, 0)); + + if (ISSET(t, R_RDONLY | R_INMEM) || !ISSET(t, R_MODIFIED)) return (RET_SUCCESS); /* Read any remaining records into the tree. */ - if (!ISSET(t, BTF_EOF) && t->bt_irec(t, MAX_REC_NUMBER) == RET_ERROR) + if (!ISSET(t, R_EOF) && t->bt_irec(t, MAX_REC_NUMBER) == RET_ERROR) return (RET_ERROR); /* Rewind the file descriptor. */ @@ -138,6 +146,6 @@ __rec_sync(dbp) return (RET_ERROR); if (ftruncate(t->bt_rfd, off)) return (RET_ERROR); - CLR(t, BTF_MODIFIED); + CLR(t, R_MODIFIED); return (RET_SUCCESS); } diff --git a/lib/libc/DB/recno/rec_delete.c b/lib/libc/DB/recno/rec_delete.c index dc022ab835b8..9bf62488d1e6 100644 --- a/lib/libc/DB/recno/rec_delete.c +++ b/lib/libc/DB/recno/rec_delete.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)rec_delete.c 5.7 (Berkeley) 2/16/93"; +static char sccsid[] = "@(#)rec_delete.c 5.8 (Berkeley) 5/16/93"; #endif /* LIBC_SCCS and not lint */ #include @@ -81,7 +81,7 @@ __rec_delete(dbp, key, flags) status = rec_rdelete(t, nrec); break; case R_CURSOR: - if (!ISSET(t, BTF_SEQINIT)) + if (!ISSET(t, B_SEQINIT)) goto einval; if (t->bt_nrecs == 0) return (RET_SPECIAL); @@ -95,7 +95,7 @@ einval: errno = EINVAL; } if (status == RET_SUCCESS) - SET(t, BTF_MODIFIED); + SET(t, B_MODIFIED | R_MODIFIED); return (status); } diff --git a/lib/libc/DB/recno/rec_get.c b/lib/libc/DB/recno/rec_get.c index ce5ac5bf2761..72c8d77ca7f8 100644 --- a/lib/libc/DB/recno/rec_get.c +++ b/lib/libc/DB/recno/rec_get.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)rec_get.c 5.8 (Berkeley) 3/19/93"; +static char sccsid[] = "@(#)rec_get.c 5.10 (Berkeley) 5/16/93"; #endif /* LIBC_SCCS and not lint */ #include @@ -82,7 +82,7 @@ __rec_get(dbp, key, data, flags) */ t = dbp->internal; if (nrec > t->bt_nrecs) { - if (ISSET(t, BTF_EOF | BTF_RINMEM)) + if (ISSET(t, R_EOF | R_INMEM)) return (RET_SPECIAL); if ((status = t->bt_irec(t, nrec)) != RET_SUCCESS) return (status); @@ -139,7 +139,7 @@ __rec_fpipe(t, top) break; } if (nrec < top) { - SET(t, BTF_EOF); + SET(t, R_EOF); return (RET_SPECIAL); } return (RET_SUCCESS); @@ -173,6 +173,8 @@ __rec_vpipe(t, top) if ((ch = getc(t->bt_rfp)) == EOF || ch == bval) { data.data = t->bt_dbuf; data.size = p - t->bt_dbuf; + if (ch == EOF && data.size == 0) + break; if (__rec_iput(t, nrec, &data, 0) != RET_SUCCESS) return (RET_ERROR); @@ -191,7 +193,7 @@ __rec_vpipe(t, top) break; } if (nrec < top) { - SET(t, BTF_EOF); + SET(t, R_EOF); return (RET_SPECIAL); } return (RET_SUCCESS); @@ -230,7 +232,7 @@ __rec_fmap(t, top) } for (nrec = t->bt_nrecs; nrec < top; ++nrec) { if (sp >= ep) { - SET(t, BTF_EOF); + SET(t, R_EOF); return (RET_SPECIAL); } len = t->bt_reclen; @@ -269,7 +271,7 @@ __rec_vmap(t, top) for (nrec = t->bt_nrecs; nrec < top; ++nrec) { if (sp >= ep) { - SET(t, BTF_EOF); + SET(t, R_EOF); return (RET_SPECIAL); } for (data.data = sp; sp < ep && *sp != bval; ++sp); diff --git a/lib/libc/DB/recno/rec_open.c b/lib/libc/DB/recno/rec_open.c index d6ea544ed8e2..9339dcd1dbbe 100644 --- a/lib/libc/DB/recno/rec_open.c +++ b/lib/libc/DB/recno/rec_open.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)rec_open.c 5.15 (Berkeley) 3/19/93"; +static char sccsid[] = "@(#)rec_open.c 5.20 (Berkeley) 5/24/93"; #endif /* LIBC_SCCS and not lint */ #include @@ -76,10 +76,14 @@ __rec_open(fname, flags, mode, openinfo) goto einval; btopeninfo.flags = 0; btopeninfo.cachesize = openinfo->cachesize; - btopeninfo.psize = 0; + btopeninfo.maxkeypage = 0; + btopeninfo.minkeypage = 0; + btopeninfo.psize = openinfo->psize; btopeninfo.compare = NULL; + btopeninfo.prefix = NULL; btopeninfo.lorder = openinfo->lorder; - dbp = __bt_open(NULL, O_RDWR, S_IRUSR | S_IWUSR, &btopeninfo); + dbp = __bt_open(openinfo->bfname, + O_RDWR, S_IRUSR | S_IWUSR, &btopeninfo); } else dbp = __bt_open(NULL, O_RDWR, S_IRUSR | S_IWUSR, NULL); if (dbp == NULL) @@ -94,7 +98,7 @@ __rec_open(fname, flags, mode, openinfo) t = dbp->internal; if (openinfo) { if (openinfo->flags & R_FIXEDLEN) { - SET(t, BTF_FIXEDLEN); + SET(t, R_FIXLEN); t->bt_reclen = openinfo->reclen; if (t->bt_reclen == 0) goto einval; @@ -103,9 +107,9 @@ __rec_open(fname, flags, mode, openinfo) } else t->bt_bval = '\n'; - SET(t, BTF_RECNO); + SET(t, R_RECNO); if (fname == NULL) - SET(t, BTF_EOF | BTF_RINMEM); + SET(t, R_EOF | R_INMEM); else t->bt_rfd = rfd; t->bt_rcursor = 0; @@ -114,42 +118,52 @@ __rec_open(fname, flags, mode, openinfo) * In 4.4BSD stat(2) returns true for ISSOCK on pipes. Until * then, this is fairly close. Pipes are read-only. */ - if (fname != NULL) + if (fname != NULL) { if (lseek(rfd, (off_t)0, SEEK_CUR) == -1 && errno == ESPIPE) { - switch(flags & O_ACCMODE) { + switch (flags & O_ACCMODE) { case O_RDONLY: - SET(t, BTF_RDONLY); + SET(t, R_RDONLY); break; - case O_RDWR: - case O_WRONLY: default: goto einval; } slow: if ((t->bt_rfp = fdopen(rfd, "r")) == NULL) goto err; - SET(t, BTF_CLOSEFP); + SET(t, R_CLOSEFP); t->bt_irec = - ISSET(t, BTF_FIXEDLEN) ? __rec_fpipe : __rec_vpipe; + ISSET(t, R_FIXLEN) ? __rec_fpipe : __rec_vpipe; } else { - switch(flags & O_ACCMODE) { + switch (flags & O_ACCMODE) { case O_RDONLY: - SET(t, BTF_RDONLY); + SET(t, R_RDONLY); break; case O_RDWR: break; - case O_WRONLY: default: goto einval; } - + if (fstat(rfd, &sb)) goto err; - if (sb.st_size > (off_t)SSIZE_MAX) { - errno = EFBIG; - goto err; + /* + * Kludge -- but we don't know what size an off_t + * is or what size a size_t is, although we do + * know that the former is signed and the latter + * unsigned. + */ + if (sizeof(sb.st_size) > sizeof(size_t)) { + if (sb.st_size > (off_t)INT_MAX) { + errno = EFBIG; + goto err; + } + } else { + if ((size_t)sb.st_size > INT_MAX) { + errno = EFBIG; + goto err; + } } if (sb.st_size == 0) - SET(t, BTF_EOF); + SET(t, R_EOF); else { t->bt_msize = sb.st_size; if ((t->bt_smap = @@ -158,15 +172,17 @@ slow: if ((t->bt_rfp = fdopen(rfd, "r")) == NULL) goto slow; t->bt_cmap = t->bt_smap; t->bt_emap = t->bt_smap + sb.st_size; - t->bt_irec = ISSET(t, BTF_FIXEDLEN) ? + t->bt_irec = ISSET(t, R_FIXLEN) ? __rec_fmap : __rec_vmap; - SET(t, BTF_MEMMAPPED); + SET(t, R_MEMMAPPED); } } + } /* Use the recno routines. */ dbp->close = __rec_close; dbp->del = __rec_delete; + dbp->fd = __rec_fd; dbp->get = __rec_get; dbp->put = __rec_put; dbp->seq = __rec_seq; @@ -182,7 +198,7 @@ slow: if ((t->bt_rfp = fdopen(rfd, "r")) == NULL) mpool_put(t->bt_mp, h, 0); if (openinfo && openinfo->flags & R_SNAPSHOT && - !ISSET(t, BTF_EOF | BTF_RINMEM) && + !ISSET(t, R_EOF | R_INMEM) && t->bt_irec(t, MAX_REC_NUMBER) == RET_ERROR) goto err; return (dbp); @@ -196,3 +212,18 @@ err: sverrno = errno; errno = sverrno; return (NULL); } + +int +__rec_fd(dbp) + const DB *dbp; +{ + BTREE *t; + + t = dbp->internal; + + if (ISSET(t, R_INMEM)) { + errno = ENOENT; + return (-1); + } + return (t->bt_rfd); +} diff --git a/lib/libc/DB/recno/rec_put.c b/lib/libc/DB/recno/rec_put.c index 7ad524a59ebc..43f7ee860656 100644 --- a/lib/libc/DB/recno/rec_put.c +++ b/lib/libc/DB/recno/rec_put.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)rec_put.c 5.11 (Berkeley) 3/19/93"; +static char sccsid[] = "@(#)rec_put.c 5.13 (Berkeley) 5/16/93"; #endif /* LIBC_SCCS and not lint */ #include @@ -52,11 +52,11 @@ static char sccsid[] = "@(#)rec_put.c 5.11 (Berkeley) 3/19/93"; * dbp: pointer to access method * key: key * data: data - * flag: R_CURSORLOG, R_CURSOR, R_IAFTER, R_IBEFORE, R_NOOVERWRITE + * flag: R_CURSOR, R_IAFTER, R_IBEFORE, R_NOOVERWRITE * * Returns: - * RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key is already in the - * tree and R_NOOVERWRITE specified. + * RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key is + * already in the tree and R_NOOVERWRITE specified. */ int __rec_put(dbp, key, data, flags) @@ -74,14 +74,10 @@ __rec_put(dbp, key, data, flags) switch (flags) { case R_CURSOR: - if (!ISSET(t, BTF_SEQINIT)) + if (!ISSET(t, B_SEQINIT)) goto einval; nrec = t->bt_rcursor; break; - case R_CURSORLOG: - nrec = t->bt_rcursor + 1; - SET(t, BTF_SEQINIT); - break; case R_SETCURSOR: if ((nrec = *(recno_t *)key->data) == 0) goto einval; @@ -113,7 +109,7 @@ einval: errno = EINVAL; * already in the database. If skipping records, create empty ones. */ if (nrec > t->bt_nrecs) { - if (!ISSET(t, BTF_EOF | BTF_RINMEM) && + if (!ISSET(t, R_EOF | R_INMEM) && t->bt_irec(t, nrec) == RET_ERROR) return (RET_ERROR); if (nrec > t->bt_nrecs + 1) { @@ -129,16 +125,10 @@ einval: errno = EINVAL; if ((status = __rec_iput(t, nrec - 1, data, flags)) != RET_SUCCESS) return (status); - SET(t, BTF_MODIFIED); - switch(flags) { - case R_CURSORLOG: - ++t->bt_rcursor; - break; - case R_SETCURSOR: + if (flags == R_SETCURSOR) t->bt_rcursor = nrec; - break; - } + SET(t, R_MODIFIED); return (__rec_ret(t, NULL, nrec, key, NULL)); } @@ -239,7 +229,9 @@ __rec_iput(t, nrec, data, flags) dest = (char *)h + h->upper; WR_RLEAF(dest, data, dflags); - mpool_put(t->bt_mp, h, MPOOL_DIRTY); ++t->bt_nrecs; + SET(t, B_MODIFIED); + mpool_put(t->bt_mp, h, MPOOL_DIRTY); + return (RET_SUCCESS); } diff --git a/lib/libc/DB/recno/rec_seq.c b/lib/libc/DB/recno/rec_seq.c index 3e1b4254f3f9..6e44e05ebb19 100644 --- a/lib/libc/DB/recno/rec_seq.c +++ b/lib/libc/DB/recno/rec_seq.c @@ -32,7 +32,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)rec_seq.c 5.8 (Berkeley) 3/19/93"; +static char sccsid[] = "@(#)rec_seq.c 5.9 (Berkeley) 5/16/93"; #endif /* not lint */ #include @@ -75,7 +75,7 @@ __rec_seq(dbp, key, data, flags) goto einval; break; case R_NEXT: - if (ISSET(t, BTF_SEQINIT)) { + if (ISSET(t, B_SEQINIT)) { nrec = t->bt_rcursor + 1; break; } @@ -84,14 +84,14 @@ __rec_seq(dbp, key, data, flags) nrec = 1; break; case R_PREV: - if (ISSET(t, BTF_SEQINIT)) { + if (ISSET(t, B_SEQINIT)) { if ((nrec = t->bt_rcursor - 1) == 0) return (RET_SPECIAL); break; } /* FALLTHROUGH */ case R_LAST: - if (!ISSET(t, BTF_EOF | BTF_RINMEM) && + if (!ISSET(t, R_EOF | R_INMEM) && t->bt_irec(t, MAX_REC_NUMBER) == RET_ERROR) return (RET_ERROR); nrec = t->bt_nrecs; @@ -102,7 +102,7 @@ einval: errno = EINVAL; } if (t->bt_nrecs == 0 || nrec > t->bt_nrecs) { - if (!ISSET(t, BTF_EOF | BTF_RINMEM) && + if (!ISSET(t, R_EOF | R_INMEM) && (status = t->bt_irec(t, nrec)) != RET_SUCCESS) return (status); if (t->bt_nrecs == 0 || nrec > t->bt_nrecs) @@ -112,7 +112,7 @@ einval: errno = EINVAL; if ((e = __rec_search(t, nrec - 1, SEARCH)) == NULL) return (RET_ERROR); - SET(t, BTF_SEQINIT); + SET(t, B_SEQINIT); t->bt_rcursor = nrec; status = __rec_ret(t, e, nrec, key, data);