From owner-freebsd-hackers Mon Oct 16 14:54:36 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id OAA23598 for hackers-outgoing; Mon, 16 Oct 1995 14:54:36 -0700 Received: from dawnrazor.campus.luth.se (root@dawnrazor.campus.luth.se [130.240.193.73]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id OAA23593 for ; Mon, 16 Oct 1995 14:54:32 -0700 Received: from localhost (offe@localhost [127.0.0.1]) by dawnrazor.campus.luth.se (8.6.12/8.6.9) with SMTP id WAA08655; Mon, 16 Oct 1995 22:54:05 +0100 Message-Id: <199510162154.WAA08655@dawnrazor.campus.luth.se> X-Authentication-Warning: dawnrazor.campus.luth.se: Host localhost didn't use HELO protocol X-Mailer: exmh version 1.6 4/21/95 To: "Justin T. Gibbs" Cc: hackers@freebsd.org Subject: Re: wtmp efficiency In-reply-to: Your message of "Mon, 16 Oct 1995 14:14:34 MST." <199510162114.OAA19312@aslan.cdrom.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 16 Oct 1995 22:54:04 +0100 From: Olof Johansson Sender: owner-hackers@freebsd.org Precedence: bulk I've found (and fixed) the problem. It's the fact that ftp and uucp connections get 'ftp' or 'uucp' + pid as tty_line in wtmp. The pid isn't removed when looking up the tty, so the list gets bigger and bigger. For 'ftp-only' wtmp files the time for parsing the file is proportional to n^2, where n is the number of entries in the file... (I have an exam on data structures and algorithms next week *grin*). The following patch fixes the problem. *** last.c Mon Aug 7 19:08:00 1995 --- lastold.c Mon Oct 16 22:43:48 1995 *************** *** 202,207 **** --- 202,215 ---- continue; } /* + * Fix tty-line for ftp and uucp entries. + * (same as in want(), see there for more info) + */ + if (!strncmp(bp->ut_line, "ftp", 3)) + bp->ut_line[3] = '\0'; + else if (!strncmp(bp->ut_line, "uucp", 3)) + bp->ut_line[4] = '\0'; + /* * if the line is '{' or '|', date got set; see * utmp(5) for more info. */