This is a simple replacement for the POSIX Asynchronous IO (AIO) interfaces (aio_read, aio_write, lio_listio) implemented using pthreads with blocking pread and pwrite calls. This was developed because the AIO implementation in linux serializes requests on the same file descriptor, rather than performing requests concurrently. We have chosen to create threads on the fly for each aiocb structure, rather than using thread pools. On linux, thread creation/destruction is efficient (particularly NPTL) and gave us the best performance during testing.
This library has only been tested on linux and darwin (OS X), but should conform to POSIX. The standard does not specify that requests passed to lio_listio on the same file descriptor should be serialized, that is a specific "feature" of the linux implementation.
The library fully supports the following calls:
aio_error and aio_return are only supported on linux, where the aiocb structure has non-conformant fields error_code and return_value. To enable support for these functions, the preprocessor directives HAVE_AIOCB_ERROR_CODE and HAVE_AIOCB_RETURN_VALUE should be defined. Usually, an autoconf check can set these values at configure time.
aio_cancel and aio_suspend are not supported at this time, and will return -1 with an errno value of ENOSYS.
On linux, O_DSYNC maps to O_SYNC, so the aio_fsync function on linux does not support data sync only (fdatasync). Calls to aio_fsync with O_DSYNC will cause a sync of both data and metadata.
Source code for this project, after a long hiatus, has moved to git: http://git.mcs.anl.gov/radix/aio-lite.git/