Fixate the hash bucket size to 4K. We were using the default,

which is stat.st_blksize (i.e., PAGE_SIZE).

This change causes the .db files that were cross-compiled on
another platform to be identical to the natively built ones.

Tested on:	alpha->amd64 build
This commit is contained in:
ru 2005-02-19 23:59:49 +00:00
parent 3a53fc798b
commit 5e18103b15

View File

@ -39,7 +39,7 @@ static const char copyright[] =
#if 0
#ifndef lint
static char sccsid[] = "@(#)cap_mkdb.c 8.1 (Berkeley) 6/6/93";
static char sccsid[] = "@(#)cap_mkdb.c 8.2 (Berkeley) 4/27/95";
#endif
#endif
@ -65,6 +65,15 @@ DB *capdbp;
int verbose;
char *capdb, *capname, buf[8 * 1024];
HASHINFO openinfo = {
4096, /* bsize */
0, /* ffactor */
0, /* nelem */
0, /* cachesize */
NULL, /* hash() */
0 /* lorder */
};
/*
* Mkcapdb creates a capability hash database for quick retrieval of capability
* records. The database contains 2 types of entries: records and references
@ -104,8 +113,8 @@ main(int argc, char *argv[])
(void)snprintf(buf, sizeof(buf), "%s.db", capname ? capname : *argv);
if ((capname = strdup(buf)) == NULL)
errx(1, "strdup failed");
if ((capdbp = dbopen(capname,
O_CREAT | O_TRUNC | O_RDWR, DEFFILEMODE, DB_HASH, NULL)) == NULL)
if ((capdbp = dbopen(capname, O_CREAT | O_TRUNC | O_RDWR,
DEFFILEMODE, DB_HASH, &openinfo)) == NULL)
err(1, "%s", buf);
if (atexit(dounlink))