Hi, I'd like to use AIO to read files w/o specifying an offset in the member aio_offset. Instead, I'd like for the current file offset to be used. For Linux, io_uring supports using -1 for the offset to indicate that the current file position should be used instead of passing in an explicit offset. I'd like to do the same on FreeBSD. Could a function aio_readpipe() (and aio_writepipe()) or something like that be added?
Maybe a good name for the new aio functions would be aio_stream_read() and aio_stream_write()? I need these functions to port Boost.Asio (part of libboost) file facilities to FreeBSD. Any software making use of Boost.Asio file facilities would then be able to work on FreeBSD.
I think I've reached a good interface for the new functions: int aio_read2(struct aiocb *iocb, unsigned flags); int aio_write2(struct aiocb *iocb, unsigned flags); aio_read(iocb) would be equivalent to aio_read2(iocb, 0) and aio_write(iocb) would be equivalent to aio_write2(iocb, 0). Then we would define the following flags: AIO_USEIOV AIO_IGNOREOFFSET aio_readv(iocb) would be equivalent to aio_read2(iocb, AIO_USEIOV) and aio_writev(iocb) would be equivalent to aio_write2(iocb, AIO_USEIOV). The flag AIO_IGNOREOFFSET would instruct the call to ignore aio_offset in aiocb and use the file position (lseek) if applicable.
The flag AIO_IGNOREOFFSET should not conflict with LIO opcodes so one could OR it into aio_lio_opcode for usage with lio_listio() as well. I think that should be enough to close all ties.
Fixed: * https://reviews.freebsd.org/rGe4b7bbd6ab77e908a60362aa29e518f224a117b0 * https://reviews.freebsd.org/rG06cb1c3f9528f088bdaf10d28dcfe7eeaad726d3 * https://reviews.freebsd.org/rG8dfc788b8480a13f1f945f0a94d8b1e327af5c6f