From owner-freebsd-fs Mon Mar 19 10:54:35 2001 Delivered-To: freebsd-fs@freebsd.org Received: from peter3.wemm.org (c1315225-a.plstn1.sfba.home.com [65.0.135.147]) by hub.freebsd.org (Postfix) with ESMTP id EFD3437B718 for ; Mon, 19 Mar 2001 10:54:31 -0800 (PST) (envelope-from peter@netplex.com.au) Received: from mobile.wemm.org (mobile.wemm.org [10.0.0.5]) by peter3.wemm.org (8.11.0/8.11.0) with ESMTP id f2JIsVp78477 for ; Mon, 19 Mar 2001 10:54:31 -0800 (PST) (envelope-from peter@netplex.com.au) Received: from netplex.com.au (localhost [127.0.0.1]) by mobile.wemm.org (8.11.1/8.11.1) with ESMTP id f2JIsUh36403; Mon, 19 Mar 2001 10:54:30 -0800 (PST) (envelope-from peter@netplex.com.au) Message-Id: <200103191854.f2JIsUh36403@mobile.wemm.org> X-Mailer: exmh version 2.2 06/23/2000 with nmh-1.0.4 To: Terry Lambert Cc: andre@netvision.com.br, fs@FreeBSD.ORG Subject: Re: Truncating a file. In-Reply-To: <200103160600.XAA04319@usr05.primenet.com> Date: Mon, 19 Mar 2001 10:54:30 -0800 From: Peter Wemm Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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