From nobody Fri Jan 12 17:36:53 2024 X-Original-To: freebsd-threads@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TBTHl6hkcz57DbC for ; Fri, 12 Jan 2024 17:37:07 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4TBTHk592Zz4gg2 for ; Fri, 12 Jan 2024 17:37:06 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.17.1/8.17.1) with ESMTP id 40CHasAn057502; Fri, 12 Jan 2024 19:36:57 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 40CHasAn057502 Received: (from kostik@localhost) by tom.home (8.17.1/8.17.1/Submit) id 40CHarmQ057501; Fri, 12 Jan 2024 19:36:53 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 12 Jan 2024 19:36:53 +0200 From: Konstantin Belousov To: =?utf-8?B?Vmluw61jaXVz?= dos Santos Oliveira Cc: freebsd-threads@freebsd.org Subject: Re: aio_read2() and aio_write2() Message-ID: References: List-Id: Threading List-Archive: https://lists.freebsd.org/archives/freebsd-threads List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-threads@freebsd.org X-BeenThere: freebsd-threads@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on tom.home X-Spamd-Bar: -- X-Spamd-Result: default: False [-2.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-0.999]; NEURAL_HAM_SHORT(-0.99)[-0.993]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_FROM(0.00)[gmail.com]; TAGGED_RCPT(0.00)[]; MISSING_XM_UA(0.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; R_SPF_SOFTFAIL(0.00)[~all]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MLMMJ_DEST(0.00)[freebsd-threads@freebsd.org]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; HAS_XAW(0.00)[] X-Rspamd-Queue-Id: 4TBTHk592Zz4gg2 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.