aboutsummaryrefslogtreecommitdiff
path: root/_db1.85/man
diff options
context:
space:
mode:
Diffstat (limited to '_db1.85/man')
-rw-r--r--_db1.85/man/CVS/Entries6
-rw-r--r--_db1.85/man/CVS/Repository1
-rw-r--r--_db1.85/man/CVS/Tag1
-rw-r--r--_db1.85/man/btree.3243
-rw-r--r--_db1.85/man/dbopen.3538
-rw-r--r--_db1.85/man/hash.3160
-rw-r--r--_db1.85/man/ndbm.3209
-rw-r--r--_db1.85/man/recno.3221
8 files changed, 1379 insertions, 0 deletions
diff --git a/_db1.85/man/CVS/Entries b/_db1.85/man/CVS/Entries
new file mode 100644
index 0000000..ef5b22d
--- /dev/null
+++ b/_db1.85/man/CVS/Entries
@@ -0,0 +1,6 @@
+/btree.3/1.23/Thu Sep 10 10:20:55 2015//TOPENBSD_6_4
+/dbopen.3/1.28/Thu Sep 10 10:20:55 2015//TOPENBSD_6_4
+/hash.3/1.20/Sat Nov 12 14:28:26 2016//TOPENBSD_6_4
+/ndbm.3/1.20/Sat Nov 12 14:28:26 2016//TOPENBSD_6_4
+/recno.3/1.20/Thu Sep 10 10:20:55 2015//TOPENBSD_6_4
+D
diff --git a/_db1.85/man/CVS/Repository b/_db1.85/man/CVS/Repository
new file mode 100644
index 0000000..6f5f8db
--- /dev/null
+++ b/_db1.85/man/CVS/Repository
@@ -0,0 +1 @@
+src/lib/libc/db/man
diff --git a/_db1.85/man/CVS/Tag b/_db1.85/man/CVS/Tag
new file mode 100644
index 0000000..b84d4de
--- /dev/null
+++ b/_db1.85/man/CVS/Tag
@@ -0,0 +1 @@
+TOPENBSD_6_4
diff --git a/_db1.85/man/btree.3 b/_db1.85/man/btree.3
new file mode 100644
index 0000000..1968a22
--- /dev/null
+++ b/_db1.85/man/btree.3
@@ -0,0 +1,243 @@
+.\" $OpenBSD: btree.3,v 1.23 2015/09/10 10:20:55 jmc Exp $
+.\" $NetBSD: btree.3,v 1.6 1996/05/03 21:26:48 cgd Exp $
+.\"
+.\" Copyright (c) 1997, Phillip F Knaack. All rights reserved.
+.\"
+.\" Copyright (c) 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)btree.3 8.4 (Berkeley) 8/18/94
+.\"
+.Dd $Mdocdate: September 10 2015 $
+.Dt BTREE 3
+.Os
+.Sh NAME
+.Nm btree
+.Nd btree database access method
+.Sh SYNOPSIS
+.In sys/types.h
+.In db.h
+.Sh DESCRIPTION
+The
+.Fn dbopen
+routine is the library interface to database files.
+One of the supported file formats is btree files.
+The general description of the database access methods is in
+.Xr dbopen 3 .
+This manual page describes only the btree specific information.
+.Pp
+The btree data structure is a sorted, balanced tree structure storing
+associated key/data pairs.
+.Pp
+The btree access method specific data structure provided to
+.Fn dbopen
+is defined in the
+.In db.h
+include file as follows:
+.Bd -literal -offset indent
+typedef struct {
+ unsigned long flags;
+ unsigned int cachesize;
+ int maxkeypage;
+ int minkeypage;
+ unsigned int psize;
+ int (*compare)(const DBT *key1, const DBT *key2);
+ size_t (*prefix)(const DBT *key1, const DBT *key2);
+ int lorder;
+} BTREEINFO;
+.Ed
+.Pp
+The elements of this structure are as follows:
+.Bl -tag -width "XXXXXX"
+.It Fa flags
+The flag value is specified by
+.Tn OR Ns 'ing
+any of the following values:
+.Bl -tag -width XXXXX
+.It Dv R_DUP
+Permit duplicate keys in the tree, i.e., permit insertion if the key to be
+inserted already exists in the tree.
+The default behavior, as described in
+.Xr dbopen 3 ,
+is to overwrite a matching key when inserting a new key or to fail if
+the
+.Dv R_NOOVERWRITE
+flag is specified.
+The
+.Dv R_DUP
+flag is overridden by the
+.Dv R_NOOVERWRITE
+flag, and if the
+.Dv R_NOOVERWRITE
+flag is specified, attempts to insert duplicate keys into
+the tree will fail.
+.Pp
+If the database contains duplicate keys, the order of retrieval of
+key/data pairs is undefined if the
+.Fn get
+routine is used; however,
+.Fn seq
+routine calls with the
+.Dv R_CURSOR
+flag set will always return the logical
+.Dq first
+of any group of duplicate keys.
+.El
+.It Fa cachesize
+A suggested maximum size (in bytes) of the memory cache.
+This value is
+.Em only
+advisory, and the access method will allocate more memory rather than fail.
+Since every search examines the root page of the tree, caching the most
+recently used pages substantially improves access time.
+In addition, physical writes are delayed as long as possible, so a moderate
+cache can reduce the number of I/O operations significantly.
+Obviously, using a cache increases (but only increases) the likelihood of
+corruption or lost data if the system crashes while a tree is being modified.
+If
+.Fa cachesize
+is 0 (no size is specified) a default cache is used.
+.It Fa maxkeypage
+The maximum number of keys which will be stored on any single page.
+Not currently implemented.
+.It Fa minkeypage
+The minimum number of keys which will be stored on any single page.
+This value is used to determine which keys will be stored on overflow
+pages, i.e., if a key or data item is longer than the pagesize divided
+by the minkeypage value, it will be stored on overflow pages instead
+of in the page itself.
+If
+.Fa minkeypage
+is 0 (no minimum number of keys is specified) a value of 2 is used.
+.It Fa psize
+Page size is the size (in bytes) of the pages used for nodes in the tree.
+The minimum page size is 512 bytes and the maximum page size is 64K.
+If
+.Fa psize
+is 0 (no page size is specified) a page size is chosen based on the
+underlying file system I/O block size.
+.It Fa compare
+Compare is the key comparison function.
+It must return an integer less than, equal to, or greater than zero if the
+first key argument is considered to be respectively less than, equal to,
+or greater than the second key argument.
+The same comparison function must be used on a given tree every time it
+is opened.
+If
+.Fa compare
+is
+.Dv NULL
+(no comparison function is specified), the keys are compared
+lexically, with shorter keys considered less than longer keys.
+.It Fa prefix
+Prefix is the prefix comparison function.
+If specified, this routine must return the number of bytes of the second key
+argument which are necessary to determine that it is greater than the first
+key argument.
+If the keys are equal, the key length should be returned.
+Note, the usefulness of this routine is very data dependent, but in some
+data sets it can produce significantly reduced tree sizes and search times.
+If
+.Fa prefix
+is
+.Dv NULL
+(no prefix function is specified),
+.Em and
+no comparison function is specified, a default lexical comparison routine
+is used.
+If
+.Fa prefix
+is
+.Dv NULL
+and a comparison routine is specified, no prefix comparison is done.
+.It Fa lorder
+The byte order for integers in the stored database metadata.
+The number should represent the order as an integer; for example,
+big endian order would be the number 4,321.
+If
+.Fa lorder
+is 0 (no order is specified) the current host order is used.
+.El
+.Pp
+If the file already exists (and the
+.Dv O_TRUNC
+flag is not specified), the
+values specified for the parameters
+.Fa flags ,
+.Fa lorder ,
+and
+.Fa psize
+are ignored in favor of the values used when the tree was created.
+.Pp
+Forward sequential scans of a tree are from the least key to the greatest.
+.Pp
+Space freed up by deleting key/data pairs from the tree is never reclaimed,
+although it is normally made available for reuse.
+This means that the btree storage structure is grow-only.
+The only solutions are to avoid excessive deletions, or to create a fresh
+tree periodically from a scan of an existing one.
+.Pp
+Searches, insertions, and deletions in a btree will all complete in
+O(lg\ base\ N) where base is the average fill factor.
+Often, inserting ordered data into btrees results in a low fill factor.
+This implementation has been modified to make ordered insertion the best
+case, resulting in a much better than normal page fill factor.
+.Sh ERRORS
+The
+.Nm
+access method routines may fail and set
+.Va errno
+for any of the errors specified for the library routine
+.Xr dbopen 3 .
+.Sh SEE ALSO
+.Xr dbopen 3 ,
+.Xr hash 3 ,
+.Xr recno 3
+.Rs
+.%T "The Ubiquitous B-tree"
+.%A Douglas Comer
+.%J ACM Comput. Surv. 11
+.%D June 1979
+.%P pp 121-138
+.Re
+.Rs
+.%T "Prefix B-trees"
+.%A Rudolf Bayer
+.%A Karl Unterauer
+.%J ACM Transactions on Database Systems
+.%V Vol. 2 , 1
+.%D March 1977
+.%P pp 11-26
+.Re
+.Rs
+.%B "The Art of Computer Programming Vol. 3: Sorting and Searching"
+.%A D. E. Knuth
+.%D 1968
+.%P pp 471-480
+.Re
+.Sh BUGS
+Only big and little endian byte order is supported.
diff --git a/_db1.85/man/dbopen.3 b/_db1.85/man/dbopen.3
new file mode 100644
index 0000000..87ed04c
--- /dev/null
+++ b/_db1.85/man/dbopen.3
@@ -0,0 +1,538 @@
+.\" $OpenBSD: dbopen.3,v 1.28 2015/09/10 10:20:55 jmc Exp $
+.\" $NetBSD: dbopen.3,v 1.6 1995/02/27 13:23:25 cgd Exp $
+.\"
+.\" Copyright (c) 1997, Phillip F Knaack. All rights reserved.
+.\"
+.\" Copyright (c) 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)dbopen.3 8.5 (Berkeley) 1/2/94
+.\"
+.Dd $Mdocdate: September 10 2015 $
+.Dt DBOPEN 3
+.Os
+.Sh NAME
+.Nm dbopen
+.Nd database access methods
+.Sh SYNOPSIS
+.In sys/types.h
+.In fcntl.h
+.In limits.h
+.In db.h
+.Ft DB *
+.Fn dbopen "const char *file" "int flags" "int mode" "DBTYPE type" "const void *openinfo"
+.Sh DESCRIPTION
+The
+.Fn dbopen
+function is the library interface to database files.
+The supported file formats are btree, hashed, and UNIX file oriented.
+The btree format is a representation of a sorted, balanced tree structure.
+The hashed format is an extensible, dynamic hashing scheme.
+The flat-file format is a byte stream file with fixed or variable length
+records.
+The formats and file format specific information are described in detail
+in their respective manual pages
+.Xr btree 3 ,
+.Xr hash 3 ,
+and
+.Xr recno 3 .
+.Pp
+.Fn dbopen
+opens
+.Fa file
+for reading and/or writing.
+Files never intended to be preserved on disk may be created by setting
+the file parameter to
+.Dv NULL .
+.Pp
+The
+.Fa flags
+and
+.Fa mode
+arguments
+are as specified to the
+.Xr open 2
+routine; however, only the
+.Dv O_CREAT ,
+.Dv O_EXCL ,
+.Dv O_EXLOCK ,
+.Dv O_NOFOLLOW ,
+.Dv O_NONBLOCK ,
+.Dv O_RDONLY ,
+.Dv O_RDWR ,
+.Dv O_SHLOCK ,
+.Dv O_SYNC ,
+and
+.Dv O_TRUNC
+flags are meaningful.
+(Note, opening a database file
+.Dv O_WRONLY
+is not possible.)
+.\"Three additional options may be specified by
+.\".IR or 'ing
+.\"them into the
+.\".I flags
+.\"argument.
+.\".Bl -tag -width XXXXX
+.\".It DB_LOCK
+.\"Do the necessary locking in the database to support concurrent access.
+.\"If concurrent access isn't needed or the database is read-only this
+.\"flag should not be set, as it tends to have an associated performance
+.\"penalty.
+.\".It DB_SHMEM
+.\"Place the underlying memory pool used by the database in shared
+.\"memory.
+.\"Necessary for concurrent access.
+.\".It DB_TXN
+.\"Support transactions in the database.
+.\"The DB_LOCK and DB_SHMEM flags must be set as well.
+.\".El
+.Pp
+The
+.Fa type
+argument is of type
+.Fa DBTYPE
+(as defined in the
+.In db.h
+include file) and may be set to
+.Dv DB_BTREE ,
+.Dv DB_HASH ,
+or
+.Dv DB_RECNO .
+.Pp
+The
+.Fa openinfo
+argument is a pointer to an access method specific structure described
+in the access method's manual page.
+If
+.Fa openinfo
+is
+.Dv NULL ,
+each access method will use defaults appropriate for the system
+and the access method.
+.Pp
+.Fn dbopen
+returns a pointer to a DB structure on success and
+.Dv NULL
+on error.
+The DB structure is defined in the
+.In db.h
+include file, and contains at least the following fields:
+.Bd -literal -offset indent
+typedef struct {
+ DBTYPE type;
+ int (*close)(const DB *db);
+ int (*del)(const DB *db, const DBT *key,
+ unsigned int flags);
+ int (*fd)(const DB *db);
+ int (*get)(const DB *db, DBT *key, DBT *data,
+ unsigned int flags);
+ int (*put)(const DB *db, DBT *key, const DBT *data,
+ unsigned int flags);
+ int (*sync)(const DB *db, u_int flags);
+ int (*seq)(const DB *db, DBT *key, DBT *data,
+ unsigned int flags);
+} DB;
+.Ed
+.Pp
+These elements describe a database type and a set of functions performing
+various actions.
+These functions take a pointer to a structure as returned by
+.Fn dbopen ,
+and sometimes one or more pointers to key/data structures and a flag value.
+.Bl -tag -width XXXXX -offset indent
+.It Fa type
+The type of the underlying access method (and file format).
+.It Fa close
+A pointer to a routine to flush any cached information to disk, free any
+allocated resources, and close the underlying file(s).
+Since key/data pairs may be cached in memory, failing to sync the file
+with a
+.Fa close
+or
+.Fa sync
+function may result in inconsistent or lost information.
+.Fa close
+routines return \-1 on error (setting
+.Va errno )
+and 0 on success.
+.It Fa del
+A pointer to a routine to remove key/data pairs from the database.
+.Pp
+The parameter
+.Fa flags
+may be set to the following value:
+.Bl -tag -width R_NOOVERWRITE
+.It Dv R_CURSOR
+Delete the record referenced by the cursor.
+The cursor must have previously been initialized.
+.El
+.Pp
+.Fa del
+routines return \-1 on error (setting
+.Va errno ) ,
+0 on success, and 1 if the specified
+.Fa key
+was not in the file.
+.It Fa 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
+.Fn dbopen
+with the same
+.Fa file
+name.
+This file descriptor may be safely used as an argument to the
+.Xr fcntl 2
+and
+.Xr 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.
+.Fa fd
+routines return \-1 on error (setting
+.Va errno )
+and the file descriptor on success.
+.It Fa get
+A pointer to a routine which is the interface for keyed retrieval from
+the database.
+The address and length of the data associated with the specified
+.Fa key
+are returned in the structure referenced by
+.Fa data .
+.Fa get
+routines return \-1 on error (setting
+.Va errno ) ,
+0 on success, and 1 if the
+.Fa key
+was not in the file.
+.Pp
+.Fa flags
+is currently unused.
+Specifying anything but 0 will result in an error.
+.It Fa put
+A pointer to a routine to store key/data pairs in the database.
+.Pp
+The parameter
+.Fa flags
+may be set to one of the following values:
+.Bl -tag -width R_NOOVERWRITE
+.It Dv R_CURSOR
+Replace the key/data pair referenced by the cursor.
+The cursor must have previously been initialized.
+.It Dv R_IAFTER
+Append the data immediately after the data referenced by
+.Fa key ,
+creating a new key/data pair.
+The record number of the appended key/data pair is returned in the
+.Fa key
+structure.
+(Applicable only to the
+.Dv DB_RECNO
+access method.)
+.It Dv R_IBEFORE
+Insert the data immediately before the data referenced by
+.Fa key ,
+creating a new key/data pair.
+The record number of the inserted key/data pair is returned in the
+.Fa key
+structure.
+(Applicable only to the
+.Dv DB_RECNO
+access method.)
+.It Dv R_NOOVERWRITE
+Enter the new key/data pair only if the key does not previously exist.
+.It Dv R_SETCURSOR
+Store the key/data pair, setting or initializing the position of the
+cursor to reference it.
+(Applicable only to the
+.Dv DB_BTREE
+and
+.Dv DB_RECNO
+access methods.)
+.El
+.Pp
+.Dv R_SETCURSOR
+is available only for the
+.Dv DB_BTREE
+and
+.Dv DB_RECNO
+access methods because it implies that the keys have an inherent order
+which does not change.
+.Pp
+.Dv R_IAFTER
+and
+.Dv R_IBEFORE
+are available only for the
+.Dv 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
+for example.
+.Pp
+The default behavior of the
+.Fa put
+routines is to enter the new key/data pair, replacing any previously
+existing key.
+.Pp
+.Fa put
+routines return \-1 on error (setting
+.Va errno ) ,
+0 on success, and 1 if the
+.Dv R_NOOVERWRITE
+flag was set and the key already exists in the file.
+.It Fa seq
+A pointer to a routine which is the interface for sequential
+retrieval from the database.
+The address and length of the key are returned in the structure
+referenced by
+.Fa key ,
+and the address and length of the data are returned in the
+structure referenced
+by
+.Fa data .
+.Pp
+Sequential key/data pair retrieval may begin at any time, and the
+position of the
+.Dq cursor
+is not affected by calls to the
+.Fa del ,
+.Fa get ,
+.Fa put ,
+or
+.Fa sync
+routines.
+Modifications to the database during a sequential scan will be reflected
+in the scan, i.e., records inserted behind the cursor will not be returned
+while records inserted in front of the cursor will be returned.
+.Pp
+The
+.Fa flags
+value
+.Sy must
+be set to one of the following values:
+.Bl -tag -width R_NOOVERWRITE
+.It Dv R_CURSOR
+The data associated with the specified key is returned.
+This differs from the
+.Fa get
+routines in that it sets or initializes the cursor to the location of
+the key as well.
+(Note, for the
+.Dv DB_BTREE
+access method, the returned key is not necessarily an
+exact match for the specified key.
+The returned key is the smallest key greater than or equal to the specified
+key, permitting partial key matches and range searches.)
+.It Dv R_FIRST
+The first key/data pair of the database is returned, and the cursor
+is set or initialized to reference it.
+.It Dv R_LAST
+The last key/data pair of the database is returned, and the cursor
+is set or initialized to reference it.
+(Applicable only to the
+.Dv DB_BTREE
+and
+.Dv DB_RECNO
+access methods.)
+.It Dv R_NEXT
+Retrieve the key/data pair immediately after the cursor.
+If the cursor is not yet set, this is the same as the
+.Dv R_FIRST
+flag.
+.It Dv R_PREV
+Retrieve the key/data pair immediately before the cursor.
+If the cursor is not yet set, this is the same as the
+.Dv R_LAST
+flag.
+(Applicable only to the
+.Dv DB_BTREE
+and
+.Dv DB_RECNO
+access methods.)
+.El
+.Pp
+.Dv R_LAST
+and
+.Dv R_PREV
+are available only for the
+.Dv DB_BTREE
+and
+.Dv DB_RECNO
+access methods because they each imply that the keys have an inherent
+order which does not change.
+.Pp
+.Fa seq
+routines return \-1 on error (setting
+.Va errno ) ,
+0 on success, and 1 if there are no key/data pairs less than or greater
+than the specified or current key.
+If the
+.Dv DB_RECNO
+access method is being used, and if the database file
+is a character special file and no complete key/data pairs are currently
+available, the
+.Fa seq
+routines return 2.
+.It Fa sync
+A pointer to a routine to flush any cached information to disk.
+If the database is in memory only, the
+.Fa sync
+routine has no effect and will always succeed.
+.Pp
+The
+.Fa flags
+value may be set to the following value:
+.Bl -tag -width R_NOOVERWRITE
+.It Dv R_RECNOSYNC
+If the
+.Dv DB_RECNO
+access method is being used, this flag causes the
+.Fa sync
+routine to apply to the btree file which underlies the
+recno file, not the recno file itself.
+(See the
+.Fa bfname
+field of the
+.Xr recno 3
+manual page for more information.)
+.El
+.Pp
+.Fa sync
+routines return \-1 on error (setting
+.Va errno )
+and 0 on success.
+.El
+.Sh KEY/DATA PAIRS
+Access to all file types is based on key/data pairs.
+Both keys and data are represented by the following data structure:
+.Bd -literal -offset indent
+typedef struct {
+ void *data;
+ size_t size;
+} DBT;
+.Ed
+.Pp
+The elements of the DBT structure are defined as follows:
+.Bl -tag -width Ds -offset indent
+.It Fa data
+A pointer to a byte string.
+.It Fa size
+The length of the byte string.
+.El
+.Pp
+Key and data byte strings may reference strings of essentially unlimited
+length although any two of them must fit into available memory at the same
+time.
+It should be noted that the access methods provide no guarantees about
+byte string alignment.
+.Sh ERRORS
+The
+.Fn dbopen
+routine may fail and set
+.Va errno
+for any of the errors specified for the library routines
+.Xr open 2
+and
+.Xr malloc 3
+or the following:
+.Bl -tag -width XEINVALX
+.It Bq Er EFTYPE
+A file is incorrectly formatted.
+.It Bq Er EINVAL
+A parameter has been specified (hash function, pad byte etc.) that is
+incompatible with the current file specification or which is not
+meaningful for the function (for example, use of the cursor without
+prior initialization) or there is a mismatch between the version
+number of the file and the software.
+.El
+.Pp
+The
+.Fa close
+routines may fail and set
+.Va errno
+for any of the errors specified for the library routines
+.Xr close 2 ,
+.Xr read 2 ,
+.Xr write 2 ,
+.Xr free 3 ,
+or
+.Xr fsync 2 .
+.Pp
+The
+.Fa del ,
+.Fa get ,
+.Fa put ,
+and
+.Fa seq
+routines may fail and set
+.Va errno
+for any of the errors specified for the library routines
+.Xr read 2 ,
+.Xr write 2 ,
+.Xr free 3 ,
+or
+.Xr malloc 3 .
+.Pp
+The
+.Fa fd
+routines will fail and set
+.Va errno
+to
+.Er ENOENT
+for in-memory databases.
+.Pp
+The
+.Fa sync
+routines may fail and set
+.Va errno
+for any of the errors specified for the library routine
+.Xr fsync 2 .
+.Sh SEE ALSO
+.Xr btree 3 ,
+.Xr hash 3 ,
+.Xr recno 3
+.Rs
+.%T "LIBTP: Portable, Modular Transactions for UNIX"
+.%A Margo Seltzer
+.%A Michael Olson
+.%J USENIX proceedings
+.%D Winter 1992
+.Re
+.Sh BUGS
+The typedef DBT is a mnemonic for
+.Dq data base thang ,
+and was used
+because no one could think of a reasonable name that wasn't already used.
+.Pp
+The file descriptor interface is a kludge 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/_db1.85/man/hash.3 b/_db1.85/man/hash.3
new file mode 100644
index 0000000..ae16292
--- /dev/null
+++ b/_db1.85/man/hash.3
@@ -0,0 +1,160 @@
+.\" $OpenBSD: hash.3,v 1.20 2016/05/09 11:13:10 naddy Exp $
+.\" $NetBSD: hash.3,v 1.6 1996/05/03 21:26:50 cgd Exp $
+.\"
+.\" Copyright (c) 1997, Phillip F Knaack. All rights reserved.
+.\"
+.\" Copyright (c) 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)hash.3 8.6 (Berkeley) 8/18/94
+.\"
+.Dd $Mdocdate: May 9 2016 $
+.Dt HASH 3
+.Os
+.Sh NAME
+.Nm hash
+.Nd hash database access method
+.Sh SYNOPSIS
+.In sys/types.h
+.In db.h
+.Sh DESCRIPTION
+The
+.Fn dbopen
+routine is the library interface to database files.
+One of the supported file formats is hash files.
+The general description of the database access methods is in
+.Xr dbopen 3 .
+This manual page describes only the hash specific information.
+.Pp
+The hash data structure is an extensible, dynamic hashing scheme.
+.Pp
+The access method specific data structure provided to
+.Fn dbopen
+is defined in the
+.In db.h
+include file as follows:
+.Bd -literal -offset indent
+typedef struct {
+ unsigned int bsize;
+ unsigned int ffactor;
+ unsigned int nelem;
+ unsigned int cachesize;
+ u_int32_t (*hash)(const void *, size_t);
+ int lorder;
+} HASHINFO;
+.Ed
+.Pp
+The elements of this structure are as follows:
+.Bl -tag -width XXXXXX -offset indent
+.It Fa bsize
+.Fa bsize
+defines the hash table bucket size, and is, by default,
+the block size of the underlying filesystem.
+It may be preferable to increase the page size for disk-resident tables
+and tables with large data items.
+.It Fa ffactor
+.Fa ffactor
+indicates a desired density within the hash table.
+It is an approximation of the number of keys allowed to accumulate in any
+one bucket, determining when the hash table grows or shrinks.
+The default value is the same as
+.Fa bsize .
+.It Fa nelem
+.Fa nelem
+is an estimate of the final size of the hash table.
+If not set or set too low, hash tables will expand gracefully as keys
+are entered, although a slight performance degradation may be noticed.
+The default value is 1.
+.It Fa cachesize
+A suggested maximum size, in bytes, of the memory cache.
+This value is
+.Em only
+advisory, and the access method will allocate more memory rather
+than fail.
+.It Fa hash
+.Fa hash
+is a user defined hash function.
+Since no hash function performs equally well on all possible data, the
+user may find that the built-in hash function does poorly on a particular
+data set.
+User specified hash functions must take two arguments (a pointer to a byte
+string and a length) and return a 32-bit quantity to be used as the hash
+value.
+.It Fa lorder
+The byte order for integers in the stored database metadata.
+The number should represent the order as an integer; for example,
+big endian order would be the number 4,321.
+If
+.Fa lorder
+is 0 (no order is specified) the current host order is used.
+If the file already exists, the specified value is ignored and the
+value specified when the tree was created is used.
+.El
+.Pp
+If the file already exists (and the
+.Dv O_TRUNC
+flag is not specified), the
+values specified for the parameters
+.Fa bsize , ffactor , lorder
+and
+.Fa nelem
+are ignored and the values specified when the tree was created are used.
+.Pp
+If a hash function is specified,
+.Fn hash_open
+will attempt to determine if the hash function specified is the same as
+the one with which the database was created, and will fail if it is not.
+.Pp
+Backward compatible interfaces to the routines described in
+.Xr ndbm 3
+are provided, although these interfaces are not compatible with
+previous file formats.
+.Sh ERRORS
+The
+.Nm
+access method routines may fail and set
+.Va errno
+for any of the errors specified for the library routine
+.Xr dbopen 3 .
+.Sh SEE ALSO
+.Xr btree 3 ,
+.Xr dbopen 3 ,
+.Xr recno 3
+.Rs
+.%T "Dynamic Hash Tables"
+.%A Per-Ake Larson
+.%J Communications of the ACM
+.%D April 1988
+.Re
+.Rs
+.%T "A New Hash Package for UNIX"
+.%A Margo Seltzer
+.%J USENIX Proceedings
+.%D Winter 1991
+.Re
+.Sh BUGS
+Only big and little endian byte order is supported.
diff --git a/_db1.85/man/ndbm.3 b/_db1.85/man/ndbm.3
new file mode 100644
index 0000000..9cdaed3
--- /dev/null
+++ b/_db1.85/man/ndbm.3
@@ -0,0 +1,209 @@
+.\" David Leonard, 1998. Placed in the public domain.
+.\" $OpenBSD: ndbm.3,v 1.20 2016/05/07 23:35:45 naddy Exp $
+.Dd $Mdocdate: May 7 2016 $
+.Dt DBM_OPEN 3
+.Os
+.Sh NAME
+.Nm dbm_clearerr ,
+.Nm dbm_close ,
+.Nm dbm_delete ,
+.Nm dbm_dirfno ,
+.Nm dbm_error ,
+.Nm dbm_fetch ,
+.Nm dbm_firstkey ,
+.Nm dbm_nextkey ,
+.Nm dbm_open ,
+.Nm dbm_pagfno ,
+.Nm dbm_rdonly ,
+.Nm dbm_store
+.Nd database access methods
+.Sh SYNOPSIS
+.In ndbm.h
+.Ft int
+.Fn dbm_clearerr "DBM *db"
+.Ft void
+.Fn dbm_close "DBM *db"
+.Ft int
+.Fn dbm_delete "DBM *db" "datum key"
+.Ft int
+.Fn dbm_dirfno "DBM *db"
+.Ft int
+.Fn dbm_error "DBM *db"
+.Ft datum
+.Fn dbm_fetch "DBM *db" "datum key"
+.Ft datum
+.Fn dbm_firstkey "DBM *db"
+.Ft datum
+.Fn dbm_nextkey "DBM *db"
+.Ft "DBM *"
+.Fn dbm_open "const char *file" "int flags" "mode_t mode"
+.Ft int
+.Fn dbm_pagfno "DBM *db"
+.Ft int
+.Fn dbm_rdonly "DBM *db"
+.Ft int
+.Fn dbm_store "DBM *db" "datum key" "datum content" "int store_mode"
+.Sh DESCRIPTION
+These functions provide a ndbm-compatible interface to the
+database access methods described in
+.Xr dbopen 3 .
+Each unique record in the database is a key/content pair,
+the components of which may be any arbitrary binary data.
+The key and the content data are described by the
+.Ft datum
+data structure:
+.Bd -literal -offset indent
+typedef struct {
+ void *dptr;
+ size_t dsize;
+} datum;
+.Ed
+.Pp
+The
+.Fn dbm_open
+function is used to open a database in the file named by
+.Fa file ,
+suffixed with
+.Dv DBM_SUFFIX
+.Pq Sq Pa .db .
+If necessary, the file is created with mode
+.Ar mode .
+Access to this file depends on the
+.Fa flags
+parameter (see
+.Xr open 2 ) .
+Read-only access may be indicated by specifying
+.Dv DBM_RDONLY .
+The
+.Fn dbm_rdonly
+function may be used to determine if a database is opened for read-only
+access.
+.Pp
+Once the database is open,
+.Fn dbm_fetch
+is used to retrieve the data content associated with the key
+.Fa key .
+Similarly,
+.Fn dbm_store
+is used to store the
+.Fa content
+data with the key
+.Fa key .
+When storing, the
+.Fa store_mode
+parameter must be one of:
+.Bl -tag -width DBM_REPLACE -offset indent
+.It Dv DBM_INSERT
+Only insert new keys into the database.
+Existing key/content pairs are untouched.
+.It Dv DBM_REPLACE
+Replace any existing entry with the same key.
+Any previously stored records with the same key are lost.
+.El
+.Pp
+The
+.Fn dbm_delete
+function removes the key
+.Fa key
+and its associated content from the database.
+.Pp
+The functions
+.Fn dbm_firstkey
+and
+.Fn dbm_nextkey
+are used to iterate over all of the records in the database.
+Each record will be reached exactly once, but in no particular order.
+The
+.Fn dbm_firstkey
+function returns the first record of the database, and thereafter
+.Fn dbm_nextkey
+returns the following records.
+The following code traverses the entire database:
+.Bd -literal -offset indent
+for (key = dbm_firstkey(db); key.dptr != NULL;
+ key = dbm_nextkey(db))
+.Ed
+.Pp
+The behaviour of
+.Fn dbm_nextkey
+is undefined if the database is modified after a call to
+.Fn dbm_firstkey .
+.Pp
+The
+.Fn dbm_error
+function returns the last error condition of the database,
+or 0 if no error had occurred or had been cleared.
+The
+.Fn dbm_clearerr
+function clears the error condition of the database.
+.Pp
+The
+.Fn dbm_dirfno
+function is used to find the file descriptor associated with the
+directory file of an open database.
+Since a directory bitmap file is not used in this implementation,
+this function returns the file descriptor of the database file opened with
+.Fn dbm_open .
+.Pp
+The
+.Fn dbm_pagfno
+function is used to find the file descriptor associated with the
+page file of an open database.
+Since a page file is not used in this implementation, this function
+is implemented as a macro that always returns the (undefined) value
+.Dv DBM_PAGFNO_NOT_AVAILABLE .
+.Pp
+The database is closed with the
+.Fn dbm_close
+function.
+Thereafter, the
+.Fa db
+handle is invalid.
+.Ss Implementation notes
+The underlying database is a
+.Xr hash 3
+database with a
+bucket size of 4096,
+a filling factor of 40,
+default hashing function and cache size,
+and uses the host's native byte order.
+.Sh RETURN VALUES
+Upon successful completion, all functions that return
+.Ft int
+return a value of 0, otherwise a negative value is returned.
+.Pp
+Routines that return a
+.Ft datum
+indicate errors by setting the
+.Va dptr
+field to
+.Dv NULL .
+.Pp
+The
+.Fn dbm_open
+function returns
+.Dv NULL
+on error, and sets
+.Va errno
+appropriately.
+On success, it returns a handle to the database that should be
+used as the
+.Fa db
+argument in the other functions.
+.Pp
+The
+.Fn dbm_store
+function returns 1 when it is called with a
+.Fa flags
+value of
+.Dv DBM_INSERT
+and a record with the specified key already exists.
+.Sh ERRORS
+If an error occurs, the error can be retrieved with
+.Fn dbm_error
+and corresponds to those errors described in
+.Xr dbopen 3 .
+.Sh SEE ALSO
+.Xr open 2 ,
+.Xr dbopen 3 ,
+.Xr hash 3
diff --git a/_db1.85/man/recno.3 b/_db1.85/man/recno.3
new file mode 100644
index 0000000..2a58f6f
--- /dev/null
+++ b/_db1.85/man/recno.3
@@ -0,0 +1,221 @@
+.\" $OpenBSD: recno.3,v 1.20 2015/09/10 10:20:55 jmc Exp $
+.\" $NetBSD: recno.3,v 1.6 1996/05/03 21:26:51 cgd Exp $
+.\"
+.\" Copyright (c) 1997, Phillip F Knaack. All rights reserved.
+.\"
+.\" Copyright (c) 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)recno.3 8.5 (Berkeley) 8/18/94
+.\"
+.Dd $Mdocdate: September 10 2015 $
+.Dt RECNO 3
+.Os
+.Sh NAME
+.Nm recno
+.Nd record number database access method
+.Sh SYNOPSIS
+.In sys/types.h
+.In db.h
+.Sh DESCRIPTION
+The
+.Fn dbopen
+routine is the library interface to database files.
+One of the supported file formats is record number files.
+The general description of the database access methods is in
+.Xr dbopen 3 .
+This manual page describes only the recno specific information.
+.Pp
+The record number data structure is either variable or fixed-length
+records stored in a flat-file format, accessed by the logical record
+number.
+The existence of record number five implies the existence of records
+one through four, and the deletion of record number one causes
+record number five to be renumbered to record number four, as well
+as the cursor, if positioned after record number one, to shift down
+one record.
+.Pp
+The
+.Nm
+access method specific data structure provided to
+.Fn dbopen
+is defined in the
+.In db.h
+include file as follows:
+.Bd -literal -offset indent
+typedef struct {
+ unsigned long flags;
+ unsigned int cachesize;
+ unsigned int psize;
+ int lorder;
+ size_t reclen;
+ unsigned char bval;
+ char *bfname;
+} RECNOINFO;
+.Ed
+.Pp
+The elements of this structure are defined as follows:
+.Bl -tag -width XXXXXX
+.It Fa flags
+The flag value is specified by
+.Tn OR Ns 'ing
+any of the following values:
+.Bl -tag -width R_FIXEDLEN
+.It Dv R_FIXEDLEN
+The records are fixed-length, not byte delimited.
+The structure element
+.Fa reclen
+specifies the length of the record, and the structure element
+.Fa bval
+is used as the pad character.
+Any records, inserted into the database, that are less than
+.Fa reclen
+bytes long are automatically padded.
+.It Dv R_NOKEY
+In the interface specified by
+.Fn dbopen ,
+the sequential record retrieval fills in both the caller's key and
+data structures.
+If the R_NOKEY flag is specified, the
+.Fa cursor
+routines are not required to fill in the key structure.
+This permits applications to retrieve records at the end of files without
+reading all of the intervening records.
+.It Dv R_SNAPSHOT
+This flag requires that a snapshot of the file be taken when
+.Fn dbopen
+is called, instead of permitting any unmodified records to be read from
+the original file.
+.El
+.It Fa cachesize
+A suggested maximum size, in bytes, of the memory cache.
+This value is
+.Em only
+advisory, and the access method will allocate more memory rather than fail.
+If
+.Fa cachesize
+is 0 (no size is specified) a default cache is used.
+.It Fa 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.
+If
+.Fa psize
+is 0 (no page size is specified) a page size is chosen based on the
+underlying file system I/O block size.
+See
+.Xr btree 3
+for more information.
+.It Fa lorder
+The byte order for integers in the stored database metadata.
+The number should represent the order as an integer; for example,
+big endian order would be the number 4,321.
+If
+.Fa lorder
+is 0 (no order is specified) the current host order is used.
+.It Fa reclen
+The length of a fixed-length record.
+.It Fa bval
+The delimiting byte to be used to mark the end of a record for
+variable-length records, and the pad character for fixed-length
+records.
+If no value is specified, newlines
+.Pq Ql \en
+are used to mark the end
+of variable-length records and fixed-length records are padded with
+spaces.
+.It Fa bfname
+The recno access method stores the in-memory copies of its records
+in a btree.
+If
+.Fa bfname
+is non-NULL, it specifies the name of the
+.Xr btree 3
+file, as if specified as the file name for a
+.Xr dbopen 3
+of a
+.Xr btree 3
+file.
+.El
+.Pp
+The data part of the key/data pair used by the recno access method
+is the same as other access methods.
+The key is different.
+The
+.Fa data
+field of the key should be a pointer to a memory location of type
+.Vt recno_t ,
+as defined in the
+.In db.h
+include file.
+This type is normally the largest unsigned integral type available to
+the implementation.
+The
+.Fa size
+field of the key should be the size of that type.
+.Pp
+Because there can be no meta-data associated with the underlying
+recno access method files, any changes made to the default values
+(e.g., fixed record length or byte separator value) must be explicitly
+specified each time the file is opened.
+.Pp
+In the interface specified by
+.Fn dbopen ,
+using the
+.Fa put
+interface to create a new record will cause the creation of multiple,
+empty records if the record number is more than one greater than the
+largest record currently in the database.
+.Sh ERRORS
+The
+.Fa recno
+access method routines may fail and set
+.Va errno
+for any of the errors specified for the library routine
+.Xr dbopen 3 ,
+or the following:
+.Bl -tag -width XEINVALX
+.It Bq Er EINVAL
+An attempt was made to add a record to a fixed-length database that
+was too large to fit.
+.El
+.Sh SEE ALSO
+.Xr btree 3 ,
+.Xr dbopen 3 ,
+.Xr hash 3
+.Rs
+.%T "Document Processing in a Relational Database System"
+.%A Michael Stonebraker
+.%A Heidi Stettner
+.%A Joseph Kalash
+.%A Antonin Guttman
+.%A Nadene Lynn
+.%J Memorandum No. UCB/ERL M82/32
+.%D May 1982
+.Re
+.Sh BUGS
+Only big and little endian byte order is supported.