From owner-cvs-lib Sun Oct 8 11:44:31 1995 Return-Path: owner-cvs-lib Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id LAA09017 for cvs-lib-outgoing; Sun, 8 Oct 1995 11:44:31 -0700 Received: (from phk@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id LAA09007 ; Sun, 8 Oct 1995 11:44:21 -0700 Date: Sun, 8 Oct 1995 11:44:21 -0700 From: Poul-Henning Kamp Message-Id: <199510081844.LAA09007@freefall.freebsd.org> To: CVS-commiters, cvs-lib Subject: cvs commit: src/lib/libc/stdlib malloc.3 malloc.c Sender: owner-cvs-lib@FreeBSD.org Precedence: bulk phk 95/10/08 11:44:21 Modified: lib/libc/stdlib malloc.3 malloc.c Log: phkmalloc/2 "zero' and 'junk' options to help find and diagnose malloc abuse. EXTRA_SANITY defaults "junk" to on. Don't dump the internal state, unless EXTRA_SANITY. General code cleanup. Error messages cleaned up a bit, more checking earlier. EXTRA_SANITY is default at this time (just in case). Performance (without EXTRA_SANITY) is better, beats gnumalloc in both time & space most of the time: # In-memory test. ./malloc 50000000 2000 8192 159.2u 1.5s 2:41.85 99.3% 5+7742k 0+0io 0pf+0w ./gnumalloc 50000000 2000 8192 272.6u 0.4s 4:35.01 99.3% 5+8533k 0+0io 0pf+0w # Swap-space test. ./malloc 500000 14000 8192 6.5u 4.1s 4:08.87 4.3% 5+49209k 0+0io 9772pf+0w ./gnumalloc 500000 14000 8192 16.2u 14.5s 15:36.14 3.2% 5+54100k 0+0io 47651pf+0w # Small items test. ./malloc 20000000 20000 2048 67.0u 0.3s 1:07.83 99.2% 5+18199k 0+0io 4pf+0w ./gnumalloc 20000000 20000 2048 66.2u 0.3s 1:07.03 99.3% 5+18107k 0+0io 0pf+0w SANITY is not an option anymore. (!!) From owner-cvs-lib Wed Oct 11 14:35:37 1995 Return-Path: owner-cvs-lib Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id OAA19441 for cvs-lib-outgoing; Wed, 11 Oct 1995 14:35:37 -0700 Received: (from wpaul@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id OAA19414 ; Wed, 11 Oct 1995 14:35:12 -0700 Date: Wed, 11 Oct 1995 14:35:12 -0700 From: Bill Paul Message-Id: <199510112135.OAA19414@freefall.freebsd.org> To: CVS-commiters, cvs-lib Subject: cvs commit: src/lib/libc/gen getpwent.c Sender: owner-cvs-lib@FreeBSD.org Precedence: bulk wpaul 95/10/11 14:35:11 Modified: lib/libc/gen getpwent.c Log: Another tweak/speedup pass: - Fix buffer overflow problem once and for all: do away with the buffer copies to 'user' prior to calling _scancaches() and just pass a pointer to the buffer returned by yp_match()/yp_first()/yp_next()/whatever. (We turn the first ':' to a NUL first so strcmp() works, then change it back later. Submitted by Bill Fenner and tweaked slightly by me. - Give _pw_breakout_yp() the 'more elegant solution' I promised way back when. Eliminate several copies to static buffers and replace them with just one copy. (The buffer returned by the NIS functions is at most YPMAXRECORD bytes long, so we should only need one static buffer of the same length (plus 2 for paranoia's sake).) - Also in _pw_breakout_yp(): always set pw.pw_passwd to the username obtained via NIS regardless of what pw_fields says: usernames cannot be overridden so we have no choice but to use the name returned by NIS. - _Again_ in _pw_breakout_yp(): before doing anything else, check that the first character of the NIS-returned buffer is not a '+' or '-'. If it is, drop the entry. (#define EXTRA_PARANOIA 1 :) - Probe for the master.passwd.* maps once during __initdb() instead of doing it each time _getyppass() or _nextyppass() is called. - Don't copy the NIS data buffers to static memory in _getyppass() and _nextyppass(): this is done in _pw_breakout_yp() now. - Test against phkmalloc and phkmalloc/2 (TNG!) to make sure we're free()ing the yp buffers sanely. - Put _havemaster(), _getyppass() and nextyppass() prototypes under #ifdef YP. (Somehow they ended up on the wrong side of the #endif.) - Remove unused variable ___yp_only.