Date: Mon, 19 Mar 2001 10:54:30 -0800 From: Peter Wemm <peter@netplex.com.au> To: Terry Lambert <tlambert@primenet.com> Cc: andre@netvision.com.br, fs@FreeBSD.ORG Subject: Re: Truncating a file. Message-ID: <200103191854.f2JIsUh36403@mobile.wemm.org> In-Reply-To: <200103160600.XAA04319@usr05.primenet.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Terry Lambert 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? > > FreeBSD doesn't support the defacto industry standard F_FREESP > fcntl(2) command argument (which would free the area referred > to by the contents of a flock structure). F_FREESP is not truncating. It just makes a hole. Truncating from the beginning means to take a 10MB file, truncate the first 1MB off the beginning and be left with a 9MB file.. VIVAFS implements this, but it was based on 4.3-net2 and BSD/OS 2.x and was considered "tainted" pending a reimplementation. 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?200103191854.f2JIsUh36403>