Date: Fri, 18 Dec 1998 00:28:17 -0500 From: "Andrew J. Korty" <ajk@purdue.edu> To: freebsd-hackers@FreeBSD.ORG Subject: cgetent() with DB files Message-ID: <199812180528.AAA17684@poynting.physics.purdue.edu>
next in thread | raw e-mail | index | archive | help
I'm using the login_cap functions to make repeated accesses to the login.conf database. Since I'm walking the password database with getpwent() and calling login_getpwclass() on every entry, it ends up being hundreds of accesses. My program was running pretty slowly. After profiling, I found that the login.conf.db file was being opened for every call to getpwclass(). These numerous, expensive calls to dbopen() were what was slowing the program down. I changed my code so that it would cache the class data, making fewer calls to login_getpwclass(). Since our users belong to only a few different classes, the program now runs at a fraction of the original time. The getpw*() functions seem to open the master.passwd database once and leave it open until endpwent() is called. Why don't the login_cap functions behave similarly? I understand that the current implementation is built on top of cgetent(), but it seems like this underlying interface should be generalized so that DB files can be kept open between calls. Thanks for your help ... Andrew J. Korty, Director http://www.physics.purdue.edu/~ajk/ Physics Computer Network 85 73 1F 04 63 D9 9D 65 Purdue University 65 2E 7A A8 81 8C 45 75 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812180528.AAA17684>