Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jan 2000 10:07:13 +1100
From:      Peter Jeremy <peter.jeremy@alcatel.com.au>
To:        Mike Heffner <spock@techfour.net>
Cc:        FreeBSD-audit <FreeBSD-audit@FreeBSD.ORG>, Mike Haertel <mike@gnu.ai.mit.edu>
Subject:   Re: use mkstemp(3) for sort
Message-ID:  <00Jan28.100714est.115208@border.alcanet.com.au>
In-Reply-To: <XFMail.20000127003005.mheffner@mailandnews.com>; from mheffner@mailandnews.com on Thu, Jan 27, 2000 at 04:29:26PM %2B1100
References:  <XFMail.20000127003005.mheffner@mailandnews.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2000-Jan-27 16:29:26 +1100, Mike Heffner <mheffner@mailandnews.com> wrote:
>This patch uses mkstemp(3), instead of a pid + sequence number(usually zero),
>for a tempfile name...reviewers?

Overall, I like the idea of using mkstemp(), but a serious drawback
(from the FSF's perspective) is the mkstemp() isn't widely implemented.

There also appear to be problems related to the change from opening
fd's as needed to keeping fd's open at all times: Whilst the sequence
number might be zero for small files, I just tried sorting ~80MB of
random text and wound up with 288 files - expecting an effectively
unlimited number of FDs to be available is not (IMHO) acceptable.

Also, the existing code appears to close FDs when it is (temporarily)
finished with them.  The patch does not change this close-when-
finished behaviour, but does to assume that the FDs will always be
open (note that fclose(fdopen(fd, ...)) will close fd).

I believe the patch needs to be re-written to restrict the number of
FD's required to sort an arbitrary amount of data.  The simplest
mechanism I can see for doing this would be to include a struct stat
(or relevant parts thereof) within struct tempnode.  tempname() would
populate it by doing an fstat() on the fd returned from mkstemp
and xtmpfopen() would do an fstat() on the file it opened and
confirm that the file hadn't changed.  (The comparison code can
be gleaned from mkstemp()).

Peter


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?00Jan28.100714est.115208>