From owner-freebsd-hackers@FreeBSD.ORG Wed Feb 23 23:04:52 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 1BC58106566C; Wed, 23 Feb 2011 23:04:52 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-px0-f182.google.com (mail-px0-f182.google.com [209.85.212.182]) by mx1.freebsd.org (Postfix) with ESMTP id C6B778FC0A; Wed, 23 Feb 2011 23:04:51 +0000 (UTC) Received: by pxi20 with SMTP id 20so771926pxi.13 for ; Wed, 23 Feb 2011 15:04:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:subject:mime-version:content-type:from :in-reply-to:date:cc:message-id:references:to:x-mailer; bh=BqrNEvnL+Et0IYmDX+McDcvB866afNSWteBcHH6PvCg=; b=mdzsxmXVlBSyQowTtE8ddEKFYDv4i2pjWdFy0nWviU5luy/rlhvPsb/is8XYRtXCJ/ StxVkMxUP2XrTKwHNurmuW2mZZWlZmhwuQr8V4QRp/Ya5mh1maTTb5FC0u0Td/yyjWJz y/JZRvXbPDiPBkymj4QPRNWYOzRdBfq0L2vdA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :message-id:references:to:x-mailer; b=TATSX+lnW3Kwa2ZwAoMl343MoTucqyBZv2X8YkqGHGtnUrxD0ZMKLyK7q4DMWU9dbV wkyrXyTzfmkF5fZUpnY3RVdzGBMQ97DIScde/vPFj3g1T1qDua2q943cYtcZmiTAiMR0 9hTjskjX3RKfqZITYUH43RaEIeLS0u/n+EoDo= Received: by 10.142.125.3 with SMTP id x3mr34173wfc.402.1298502291227; Wed, 23 Feb 2011 15:04:51 -0800 (PST) Received: from dhcp-173-37-1-90.cisco.com (nat.ironport.com [63.251.108.100]) by mx.google.com with ESMTPS id w19sm7383854wfd.8.2011.02.23.15.04.48 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 23 Feb 2011 15:04:49 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1082) From: Garrett Cooper In-Reply-To: <201102221251.33717.jhb@freebsd.org> Date: Wed, 23 Feb 2011 15:04:47 -0800 Message-Id: <3A287E45-A369-4C7A-BA8E-A205679AC0BC@gmail.com> References: <20110222141112.GA98964@freebsd.org> <201102221251.33717.jhb@freebsd.org> To: John Baldwin X-Mailer: Apple Mail (2.1082) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org, 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: Wed, 23 Feb 2011 23:04:52 -0000 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) >>=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. >=20 > Err, no, you can always seek past EOF and then call write(2) to extend = a file=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. >=20 > =46rom the manpage: >=20 > 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 zeros > (until data is actually written into the gap). You're correct. Linux (Fedora 13) isn't POSIX compliant (this 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 = point, subsequent reads of data in the gap shall return bytes with the = value 0 until data is actually written into the gap. Thanks! -Garrett=