From owner-freebsd-arch@FreeBSD.ORG Sun Apr 13 16:05:20 2008 Return-Path: Delivered-To: arch@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3A11106566C for ; Sun, 13 Apr 2008 16:05:20 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id 967A78FC24 for ; Sun, 13 Apr 2008 16:05:20 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.2/8.14.2) with ESMTP id m3DG8Ta9043067; Sun, 13 Apr 2008 12:08:29 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.2/8.14.2/Submit) id m3DG8TAT043066; Sun, 13 Apr 2008 12:08:29 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Date: Sun, 13 Apr 2008 12:08:29 -0400 From: David Schultz To: Jeff Roberson Message-ID: <20080413160829.GA42972@zim.MIT.EDU> Mail-Followup-To: Jeff Roberson , arch@FreeBSD.ORG References: <20080412132457.W43186@desktop> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080412132457.W43186@desktop> Cc: arch@FreeBSD.ORG Subject: Re: f_offset X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Apr 2008 16:05:20 -0000 On Sat, Apr 12, 2008, Jeff Roberson wrote: > It's worth discussing what posix actually guarantees for f_offset as well > as what other operating systems do. POSIX actually does not guarantee any > behavior with simultaneous access. Multiple readers may read the same > position in the file concurrently and update the position to different > offsets. Multiple writers may write to the same file location, although > the io should be serialized by some other means. Posix allows for and > Solaris, Linux, and historic implementations of f_offset work in the > following way: This is not entirely true. In particular, files opened with O_APPEND have stronger guarantees, and this behavior can be useful. For example, I imagine that a database that opens its log file with O_APPEND can depend on being able to write log entries concurrently without losing any data. (There are also stronger requirements for pipes, FIFOs, etc.) As I recall, empiricial evidence shows that SunOS 5.10 and FreeBSD both make stronger guarantees than Linux in the presence of multiple concurrent writers. I haven't tested readers or looked at the fdesc code for any of these.