Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Jan 2024 19:36:53 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        =?utf-8?B?Vmluw61jaXVz?= dos Santos Oliveira <vini.ipsmaker@gmail.com>
Cc:        freebsd-threads@freebsd.org
Subject:   Re: aio_read2() and aio_write2()
Message-ID:  <ZaF4tWnqhKrNtNBI@kib.kiev.ua>
In-Reply-To: <CAK9RveK=sUc=xSExehvNwH92uTexjhp0=L63sbw-sfkRFdV4Dg@mail.gmail.com>
References:  <CAK9RveK=sUc=xSExehvNwH92uTexjhp0=L63sbw-sfkRFdV4Dg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ZaF4tWnqhKrNtNBI>