Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Oct 1995 15:13:23 -0700
From:      "Justin T. Gibbs" <gibbs@freefall.freebsd.org>
To:        Olof Johansson <offe@dawnrazor.campus.luth.se>
Cc:        "Justin T. Gibbs" <gibbs@freefall.freebsd.org>, hackers@freebsd.org
Subject:   Re: wtmp efficiency 
Message-ID:  <199510162213.PAA19607@aslan.cdrom.com>
In-Reply-To: Your message of "Mon, 16 Oct 1995 22:54:04 BST." <199510162154.WAA08655@dawnrazor.campus.luth.se> 

next in thread | previous in thread | raw e-mail | index | archive | help
>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*).

Well you've put a finger on the problem, but your patch breaks last for
"last ftp" or "last uucp".

A better solution is to only add entries to the tty list that match our
interest, and to remove entries from the tty list once we find the matching
login time.  Since the tty records are small, bcopying the next record
over the matched record and freeing the next record should make the removal
easy.  Care to do the honors?

--
Justin T. Gibbs
===========================================
  Software Developer - Walnut Creek CDROM
  FreeBSD: Turning PCs into workstations
===========================================



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199510162213.PAA19607>