From e6bb224e431eef3d33812f0c9479782051455ff1 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Sun, 19 Apr 1998 07:15:34 +0000 Subject: [PATCH] Allow specification of cache-size to pwd_mkdb PR: 5193 Reviewed by: phk Submitted by: Nick Hilliard --- usr.sbin/pwd_mkdb/pwd_mkdb.8 | 9 +++++++++ usr.sbin/pwd_mkdb/pwd_mkdb.c | 7 +++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.8 b/usr.sbin/pwd_mkdb/pwd_mkdb.8 index d097e7ac9fdf..54abc76a3989 100644 --- a/usr.sbin/pwd_mkdb/pwd_mkdb.8 +++ b/usr.sbin/pwd_mkdb/pwd_mkdb.8 @@ -42,6 +42,7 @@ .Op Fl C .Op Fl p .Op Fl d Ar directory +.Op Fl s Ar cachesize .Op Fl u Ar username .Ar file .Sh DESCRIPTION @@ -76,6 +77,14 @@ Store databases into specified destination directory instead of Only update the record for the specified user. Utilities that operate on a single user can use this option to avoid the overhead of rebuilding the entire database. +.It Fl s Ar cachesize +Specify in megabytes the size of the memory cache used by the +hashing library. On systems with a large user base, a small cache +size can lead to prohibitively long database file rebuild times. +As a rough guide, the memory usage of +.Nm pwd_mkdb +in megabytes will be a little bit more than twice the figure +specified here. The default is 2 megabytes. .El .Pp The two databases differ in that the secure version contains the user's diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.c b/usr.sbin/pwd_mkdb/pwd_mkdb.c index d8bf7af1bf21..2a8023ecf03e 100644 --- a/usr.sbin/pwd_mkdb/pwd_mkdb.c +++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)pwd_mkdb.c 8.5 (Berkeley) 4/20/94"; #endif static const char rcsid[] = - "$Id: pwd_mkdb.c,v 1.23 1998/02/16 19:08:18 guido Exp $"; + "$Id: pwd_mkdb.c,v 1.24 1998/02/19 08:12:11 guido Exp $"; #endif /* not lint */ #include @@ -114,7 +114,7 @@ main(argc, argv) strcpy(prefix, _PATH_PWD); makeold = 0; username = NULL; - while ((ch = getopt(argc, argv, "Cd:pu:v")) != -1) + while ((ch = getopt(argc, argv, "Cd:ps:u:v")) != -1) switch(ch) { case 'C': /* verify only */ Cflag = 1; @@ -125,6 +125,9 @@ main(argc, argv) case 'p': /* create V7 "file.orig" */ makeold = 1; break; + case 's': /* change default cachesize */ + openinfo.cachesize = atoi(optarg) * 1024 * 1024; + break; case 'u': /* only update this record */ username = optarg; break;