aio_write issues

Oleksandr Tymoshenko gonzo at pbxpress.com
Fri May 16 22:22:33 UTC 2008


    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


More information about the freebsd-hackers mailing list