From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 22 17:51:36 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F38831065675; Tue, 22 Feb 2011 17:51:35 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id C23438FC08; Tue, 22 Feb 2011 17:51:35 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 61AEF46B2E; Tue, 22 Feb 2011 12:51:35 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.10]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 4A6688A027; Tue, 22 Feb 2011 12:51:34 -0500 (EST) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Tue, 22 Feb 2011 12:51:33 -0500 User-Agent: KMail/1.13.5 (FreeBSD/7.4-CBSD-20110107; KDE/4.4.5; amd64; ; ) References: <20110222141112.GA98964@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message-Id: <201102221251.33717.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Tue, 22 Feb 2011 12:51:34 -0500 (EST) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=0.5 required=4.2 tests=BAYES_00,MAY_BE_FORGED, RDNS_DYNAMIC autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: Alexander Best , Garrett Cooper Subject: Re: seeking into /dev/{null,zero} X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Feb 2011 17:51:36 -0000 On Tuesday, February 22, 2011 11:46:05 am Garrett Cooper wrote: > (Please bottom post) >=20 > On Tue, Feb 22, 2011 at 8:31 AM, Andrew Duane wrote: > > I thought seeking past EOF was valid; writing something creates a file= =20 with a hole in it. I always assumed that was standard semantics. >=20 > That's with SET_HOLE/SET_DATA though, correct? If so, outside of > that functionality I would assume relatively standard POSIX semantics. Err, no, you can always seek past EOF and then call write(2) to extend a fi= le=20 (it does an implicit ftruncate(2)). SEEK_HOLE and SEEK_DATA are different,= =20 they are just used to discover sparse regions within a file. =46rom the manpage: The lseek() system call allows the file offset to be set beyond the end of the existing end-of-file of the file. If data is later written at this point, subsequent reads of the data in the gap return bytes of ze= ros (until data is actually written into the gap). =2D-=20 John Baldwin