Re: aio_read2() and aio_write2()
- Reply: Vinícius_dos_Santos_Oliveira : "Re: aio_read2() and aio_write2()"
- In reply to: Vinícius_dos_Santos_Oliveira : "aio_read2() and aio_write2()"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 12 Jan 2024 17:36:53 UTC
On Fri, Jan 12, 2024 at 01:41:23PM -0300, Vinícius dos Santos Oliveira wrote: > Can we have some aio_read() function that ignores aio_offset (i.e. the > current file position is used)? I'm trying to port libboost's ASIO > file support to FreeBSD, and I stumbled upon this limitation. > > Boost.Asio only exposes file support for proactor systems (Windows > IOCP and Linux io_uring). For Windows and Linux, it's possible to > perform the feature I'm requesting (on Linux you just pass -1 as the > offset to ignore it in io_uring). > > Boost.Asio offers two interfaces for file IO on proactor systems: > serial access (current file offset is used) and random access (you > always specify an offset). Right now it's only possible to implement > the random access interface for FreeBSD. > > What I'd like to see: > > 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. This flag > should not conflict with LIO opcodes so one could OR it into > aio_lio_opcode for usage with lio_listio() as well. Do you need a new syscall for this? We have spares in sutrct aiocb, and can add flags there.