Bug #3364
openaio_read2() and aio_write2()
0%
Description
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 DragonFly BSD.
I propose the following interface:
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_IGNOREOFFSET
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.