Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Mar 2001 10:51:08 -0800
From:      Peter Wemm <peter@netplex.com.au>
To:        Alfred Perlstein <bright@wintelcom.net>
Cc:        =?iso-8859-1?Q?Andr=E9_Luiz_dos_Santos?= <andre@netvision.com.br>, fs@FreeBSD.ORG
Subject:   Re: Truncating a file. 
Message-ID:  <200103191851.f2JIp8h36375@mobile.wemm.org>
In-Reply-To: <20010315181601.O29888@fw.wintelcom.net> 

next in thread | previous in thread | raw e-mail | index | archive | help
Alfred Perlstein wrote:
> * André Luiz dos Santos <andre@netvision.com.br> [010315 18:11] wrote:
> > 
> >   With ftruncate, you can remove part of the end of a file. Is there a way 
    to 
> > remove part of the beginning of a file?
> >   I'm developing a SOCKS5 server that stores the data received from the fir
    st 
> > connection to a local file, and when the second connection is writable, rea
    d 
> > that file and write the data to this second connection. As data is read fro
    m 
> > the local file, its beginning becomes useless, so I'd like to truncate it 
> > out. Is it possible?
> 
> No.

I tried to tempt the VIVAFS author into porting his BSDI 4.3-net2 based
filesystem to 4.4Lite and FreeBSD.  It had many unusual features, including
the ability to reverse truncate from the beginning of the file.  It also had
rotating files, etc.  When we last spoke in June 1996, he was intending to
take a shot at it in between working on QDDB.

The truncate-from-the-beginning stuff is nice because it didn't leave holes
like the F_FREESP fcntl method.  It actually shortened the file.  F_FREESP
does not do that.

The rotating file thing is also nice.  Suppose you set your file limit to
10MB, you keep writing data into it, and it never grows beyond 10MB.  As
you append data onto the end of it, a corresponding amount falls off the
beginning.  This is nearly perfect for self maintaining "recent activity"
log files.

I'm tempted to mention the name of the author and his email address, but
I'm sure that the determined among us can find him. :-)

Cheers,
-Peter
--
Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au
"All of this is for nothing if we don't go to the stars" - JMS/B5


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




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