xref: /freebsd-13.1/lib/libc/db/hash/README (revision 9fc74a87)
158f0484fSRodney W. Grimes#	@(#)README	8.1 (Berkeley) 6/4/93
2*9fc74a87SXin LI# $FreeBSD$
358f0484fSRodney W. Grimes
458f0484fSRodney W. GrimesThis package implements a superset of the hsearch and dbm/ndbm libraries.
558f0484fSRodney W. Grimes
658f0484fSRodney W. GrimesTest Programs:
758f0484fSRodney W. Grimes	All test programs which need key/data pairs expect them entered
858f0484fSRodney W. Grimes	with key and data on separate lines
958f0484fSRodney W. Grimes
1058f0484fSRodney W. Grimes	tcreat3.c
1158f0484fSRodney W. Grimes		Takes
1258f0484fSRodney W. Grimes			bucketsize (bsize),
1358f0484fSRodney W. Grimes			fill factor (ffactor), and
1458f0484fSRodney W. Grimes			initial number of elements (nelem).
1558f0484fSRodney W. Grimes		Creates a hash table named hashtest containing the
1658f0484fSRodney W. Grimes		keys/data pairs entered from standard in.
1758f0484fSRodney W. Grimes	thash4.c
1858f0484fSRodney W. Grimes		Takes
1958f0484fSRodney W. Grimes			bucketsize (bsize),
2058f0484fSRodney W. Grimes			fill factor (ffactor),
2158f0484fSRodney W. Grimes			initial number of elements (nelem)
2258f0484fSRodney W. Grimes			bytes of cache (ncached), and
2358f0484fSRodney W. Grimes			file from which to read data  (fname)
2458f0484fSRodney W. Grimes		Creates a table from the key/data pairs on standard in and
2558f0484fSRodney W. Grimes		then does a read of each key/data in fname
2658f0484fSRodney W. Grimes	tdel.c
2758f0484fSRodney W. Grimes		Takes
2858f0484fSRodney W. Grimes			bucketsize (bsize), and
2958f0484fSRodney W. Grimes			fill factor (ffactor).
3058f0484fSRodney W. Grimes			file from which to read data (fname)
3158f0484fSRodney W. Grimes		Reads each key/data pair from fname and deletes the
3258f0484fSRodney W. Grimes		key from the hash table hashtest
3358f0484fSRodney W. Grimes	tseq.c
3458f0484fSRodney W. Grimes		Reads the key/data pairs in the file hashtest and writes them
3558f0484fSRodney W. Grimes		to standard out.
3658f0484fSRodney W. Grimes	tread2.c
3758f0484fSRodney W. Grimes		Takes
3858f0484fSRodney W. Grimes			butes of cache (ncached).
3958f0484fSRodney W. Grimes		Reads key/data pairs from standard in and looks them up
4058f0484fSRodney W. Grimes		in the file hashtest.
4158f0484fSRodney W. Grimes	tverify.c
4258f0484fSRodney W. Grimes		Reads key/data pairs from standard in, looks them up
4358f0484fSRodney W. Grimes		in the file hashtest, and verifies that the data is
4458f0484fSRodney W. Grimes		correct.
4558f0484fSRodney W. Grimes
4658f0484fSRodney W. GrimesNOTES:
4758f0484fSRodney W. Grimes
4858f0484fSRodney W. GrimesThe man page ../man/db.3 explains the interface to the hashing system.
4958f0484fSRodney W. GrimesThe file hash.ps is a postscript copy of a paper explaining
5058f0484fSRodney W. Grimesthe history, implementation, and performance of the hash package.
5158f0484fSRodney W. Grimes
5258f0484fSRodney W. Grimes"bugs" or idiosyncracies
5358f0484fSRodney W. Grimes
5458f0484fSRodney W. GrimesIf you have a lot of overflows, it is possible to run out of overflow
5558f0484fSRodney W. Grimespages.  Currently, this will cause a message to be printed on stderr.
5658f0484fSRodney W. GrimesEventually, this will be indicated by a return error code.
5758f0484fSRodney W. Grimes
5858f0484fSRodney W. GrimesIf you are using the ndbm interface and exit without flushing or closing the
5958f0484fSRodney W. Grimesfile, you may lose updates since the package buffers all writes.  Also,
6058f0484fSRodney W. Grimesthe db interface only creates a single database file.  To avoid overwriting
6158f0484fSRodney W. Grimesthe user's original file, the suffix ".db" is appended to the file name
6258f0484fSRodney W. Grimespassed to dbm_open.  Additionally, if your code "knows" about the historic
6358f0484fSRodney W. Grimes.dir and .pag files, it will break.
6458f0484fSRodney W. Grimes
6558f0484fSRodney W. GrimesThere is a fundamental difference between this package and the old hsearch.
6658f0484fSRodney W. GrimesHsearch requires the user to maintain the keys and data in the application's
6758f0484fSRodney W. Grimesallocated memory while hash takes care of all storage management.  The down
6858f0484fSRodney W. Grimesside is that the byte strings passed in the ENTRY structure must be null
6958f0484fSRodney W. Grimesterminated (both the keys and the data).
70