From owner-freebsd-hackers@FreeBSD.ORG Thu Feb 24 00:15:22 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 858C3106564A; Thu, 24 Feb 2011 00:15:22 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 850908FC14; Thu, 24 Feb 2011 00:15:21 +0000 (UTC) Received: by wyb32 with SMTP id 32so18767wyb.13 for ; Wed, 23 Feb 2011 16:15:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=To7irkHGXnIXdwsEud19Dvfds1nkdyuuiMDn5iQaH0c=; b=NRTjLwlBUHJ8TZsUauroWFb2gVRDMvMz8n8aW5X9QhRCGOvfzQAY1hKd4iovc9WCzw mdkfWpkKMFqhLFa/RXdOR9ncIeuB64JfJHehIaWhsciLjKl/jt62FLBcRHPCQXxJGnDm Q/uG8YSlrQawyQswbw6JsnJ5TzqNKsJoeYek4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=gSCO31uQ95rswly3TLjylNhZq+fpimMoab5PxG0u9s2nwYxv4nhj6XLxpjzYu1RZ7i 804yoYRLsX5HsmZFuGKeyAmmAbw+bGBLLyfvS+MYmUmbhEHCqL2zGGwe7phJubSdb+n2 gVGOp4TsPcBb3xhgCwkKq4tLl/c3uXbGztoJQ= MIME-Version: 1.0 Received: by 10.216.173.7 with SMTP id u7mr5170271wel.50.1298506520275; Wed, 23 Feb 2011 16:15:20 -0800 (PST) Received: by 10.216.15.74 with HTTP; Wed, 23 Feb 2011 16:15:20 -0800 (PST) In-Reply-To: <20110223233612.GA46124@freebsd.org> References: <20110222141112.GA98964@freebsd.org> <201102221251.33717.jhb@freebsd.org> <3A287E45-A369-4C7A-BA8E-A205679AC0BC@gmail.com> <20110223233612.GA46124@freebsd.org> Date: Wed, 23 Feb 2011 16:15:20 -0800 Message-ID: From: Garrett Cooper To: Alexander Best Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org 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: Thu, 24 Feb 2011 00:15:22 -0000 On Wed, Feb 23, 2011 at 3:36 PM, Alexander Best wrote= : > On Wed Feb 23 11, Garrett Cooper wrote: >> On Feb 22, 2011, at 9:51 AM, John Baldwin wrote: >> >> > On Tuesday, February 22, 2011 11:46:05 am Garrett Cooper wrote: >> >> (Please bottom post) >> >> >> >> On Tue, Feb 22, 2011 at 8:31 AM, Andrew Duane wr= ote: >> >>> I thought seeking past EOF was valid; writing something creates a fi= le >> > with a hole in it. I always assumed that was standard semantics. >> >> >> >> =A0 =A0That'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 file >> > (it does an implicit ftruncate(2)). =A0SEEK_HOLE and SEEK_DATA are dif= ferent, >> > they are just used to discover sparse regions within a file. >> > >> > From the manpage: >> > >> > =A0 =A0 The lseek() system call allows the file offset to be set beyon= d the end >> > =A0 =A0 of the existing end-of-file of the file. =A0If data is later w= ritten at >> > =A0 =A0 this point, subsequent reads of the data in the gap return byt= es of zeros >> > =A0 =A0 (until data is actually written into the gap). >> >> =A0 =A0 =A0 You're correct. Linux (Fedora 13) isn't POSIX compliant (thi= s is from the official POSIX text): >> >> The lseek ( ) function shall allow the file offset to be set beyond the = end of the existing data in the file. If data is later written at this poin= t, subsequent reads of data in the gap shall return bytes with the value 0 = until data is actually written into the gap. > > so except for reading from /dev/zero freebsd also isn't posix compliant, = right? Huh...? Please better explain what you mean here. Thanks, -Garrett