From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 5307 invoked from network); 1 Sep 2023 15:06:22 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 1 Sep 2023 15:06:22 -0000 Received: (qmail 15563 invoked by uid 550); 1 Sep 2023 15:06:19 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 15531 invoked from network); 1 Sep 2023 15:06:19 -0000 Date: Fri, 1 Sep 2023 11:06:12 -0400 From: Rich Felker To: Natanael Copa Cc: musl@lists.openwall.com Message-ID: <20230901150612.GA4163@brightrain.aerifal.cx> References: <20230901080224.10889-1-ncopa@alpinelinux.org> <20230901135733.GZ4163@brightrain.aerifal.cx> <20230901165553.3755a1c7@ncopa-desktop.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230901165553.3755a1c7@ncopa-desktop.lan> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] [PATCH] add close_range() syscall wrapper On Fri, Sep 01, 2023 at 04:55:53PM +0200, Natanael Copa wrote: > On Fri, 1 Sep 2023 09:57:34 -0400 > Rich Felker wrote: > > > > > +int close_range(unsigned int first, unsigned int last, int flags) > > > +{ > > > + return __syscall_ret(syscall(SYS_close_range, first, last, flags)); > > > +} > > > -- > > > 2.42.0 > > > > This is double-processing errno. You need either return > > __syscall_ret(__syscall(...)) (note the second __) or just return > > syscall(...) (the syscall macro without __ automatically does the > > __syscall_ret). > > Ah, ok, I'll send a v2 patch. > > > Aside from that, I think there's a question whether, if we support > > this as a function rather than leaving it to the application to use > > the syscall, we should provide a fallback for ENOSYS. I'm not sure, > > but it's something that should be considered before adding it. > > It was mentioned earlier that CPython expects close_range() to > async-safe, and that glibc does not provide fallback. I would prefer > that musl does not provide fallback. > > https://www.openwall.com/lists/musl/2022/08/18/4 If musl were to provide a fallback it would be AS-safe. Rich