From owner-freebsd-hackers@FreeBSD.ORG  Fri May 16 22:22:33 2008
Return-Path: <owner-freebsd-hackers@FreeBSD.ORG>
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 14785106564A
	for <freebsd-hackers@freebsd.org>; Fri, 16 May 2008 22:22:33 +0000 (UTC)
	(envelope-from gonzo@pbxpress.com)
Received: from bugor.portaone.com (bugor.portaone.com [65.61.203.147])
	by mx1.freebsd.org (Postfix) with ESMTP id EE9DC8FC14
	for <freebsd-hackers@freebsd.org>; Fri, 16 May 2008 22:22:32 +0000 (UTC)
	(envelope-from gonzo@pbxpress.com)
Received: from mail.pbxpress.com ([65.61.203.142] helo=leaf.pbxpress.com)
	by bugor.portaone.com (8.11.3/8.11.3) with ESMTP
	(TLSv1:AES256-SHA:256)id 1Jx7vr-000BAI-Ic
	for freebsd-hackers@freebsd.org; Fri, 16 May 2008 14:57:45 -0700
Received: from jeeves.bluezbox.com (82.193.105.77.ipnet.kiev.ua
	[82.193.105.77]) (authenticated bits=0)
	by leaf.pbxpress.com (8.13.3/8.13.3) with ESMTP id m4GM17oR029048
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
	for <freebsd-hackers@freebsd.org>; Fri, 16 May 2008 15:01:15 -0700 (PDT)
	(envelope-from gonzo@pbxpress.com)
Message-ID: <482E034C.2080402@pbxpress.com>
Date: Sat, 17 May 2008 00:57:32 +0300
From: Oleksandr Tymoshenko <gonzo@pbxpress.com>
User-Agent: Thunderbird 2.0.0.6 (X11/20070907)
MIME-Version: 1.0
To: freebsd-hackers@freebsd.org
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, recieved from trusted server
Subject: aio_write issues
X-BeenThere: freebsd-hackers@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Technical Discussions relating to FreeBSD
	<freebsd-hackers.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-hackers>, 
	<mailto:freebsd-hackers-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-hackers>
List-Post: <mailto:freebsd-hackers@freebsd.org>
List-Help: <mailto:freebsd-hackers-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-hackers>,
	<mailto:freebsd-hackers-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 16 May 2008 22:22:33 -0000

    It looks like aio_write is out of sync with its man page(if it ever has been).
man 2 aio_write states:

      If O_APPEND is set for iocb->aio_fildes, aio_write() operations append to
      the file in the same order as the calls were made.

Though simple test[1] reveals that it's not true. Order is not preserved. In addition
the rest of the paragraph contradicts to SUSv3 specification of aio_write (or I got that
part of man page wrong, because function behaves just as should be conforming
to SUSv3).
man page:

      If O_APPEND is not set for the file descriptor, the write operation
      will occur at the absolute position from the beginning of the file
      plus iocb->aio_offset.

excerpt from IEEE 1003.1:
      If O_APPEND is not set for the file descriptor aio_fildes, then the requested
      operation shall take place at the absolute position in the file as given by
      aio_offset, as if lseek() were called immediately prior to the operation with
      an offset equal to aio_offset and a whence equal to SEEK_SET.

I'd like to know if I got things right in order to avoid fixing things
that are not broken.

[1] http://people.freebsd.org/~gonzo/aio.c

-- 
gonzo