From nobody Mon Jun 2 10:41:59 2025 X-Original-To: dev-commits-src-all@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 4b9r4w2fLMz5xsDK; Mon, 02 Jun 2025 10:42:08 +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 4b9r4v61jZz3h6D; Mon, 02 Jun 2025 10:42:07 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 552Afxxx098843; Mon, 2 Jun 2025 13:42:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 552Afxxx098843 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 552Afx1p098842; Mon, 2 Jun 2025 13:41:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 2 Jun 2025 13:41:59 +0300 From: Konstantin Belousov To: Bojan =?utf-8?B?Tm92a292acSH?= Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 1e0743f54d2d - main - glob: Add blocks support Message-ID: References: <202506020933.5529XEpk083101@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <202506020933.5529XEpk083101@gitrepo.freebsd.org> 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.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on tom.home X-Rspamd-Queue-Id: 4b9r4v61jZz3h6D X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] On Mon, Jun 02, 2025 at 09:33:14AM +0000, Bojan Novković wrote: > The branch main has been updated by bnovkov: > > URL: https://cgit.FreeBSD.org/src/commit/?id=1e0743f54d2d3624cd4de2167d373aa38597778e > > commit 1e0743f54d2d3624cd4de2167d373aa38597778e > Author: Bojan Novković > AuthorDate: 2025-05-23 13:26:04 +0000 > Commit: Bojan Novković > CommitDate: 2025-06-02 09:32:50 +0000 > > glob: Add blocks support > > This change introduces the `glob_b` function which takes a block instead > of a function pointer. > > Relnotes: yes > Sponsored by: Klara, Inc. > Inspired by: https://github.com/apple-oss-distributions/Libc > Differential Revision: https://reviews.freebsd.org/D50485 > --- > include/glob.h | 16 +++++++++-- > lib/libc/gen/Makefile.inc | 1 + > lib/libc/gen/Symbol.map | 1 + > lib/libc/gen/glob.3 | 66 ++++++++++++++++++++++++++++++++++++++------ > lib/libc/gen/glob.c | 70 +++++++++++++++++++++++++++++++++++++---------- > 5 files changed, 128 insertions(+), 26 deletions(-) > > diff --git a/include/glob.h b/include/glob.h > index dc86cdf99929..cbe99bfef6ed 100644 > --- a/include/glob.h > +++ b/include/glob.h > @@ -50,8 +50,15 @@ typedef struct { > size_t gl_offs; /* Reserved at beginning of gl_pathv. */ > int gl_flags; /* Copy of flags parameter to glob. */ > char **gl_pathv; /* List of paths matching pattern. */ > - /* Copy of errfunc parameter to glob. */ > - int (*gl_errfunc)(const char *, int); > + /* Copy of error callback parameter to glob. */ > + union { > + int (*gl_errfunc)(const char *, int); > +#ifdef __BLOCKS__ > + int (^gl_errblk)(const char *, int); > +#else > + void *gl_errblk; > +#endif > + }; > > /* > * Alternate filesystem access methods for glob; replacement > @@ -90,6 +97,7 @@ typedef struct { > #define GLOB_QUOTE 0x0400 /* Quote special chars with \. */ > #define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */ > #define GLOB_LIMIT 0x1000 /* limit number of returned paths */ > +#define _GLOB_ERR_BLOCK 0x08000000 /* (internal) error callback is a block */ > > /* source compatibility, these are the old names */ > #define GLOB_MAXPATH GLOB_LIMIT > @@ -99,6 +107,10 @@ typedef struct { > __BEGIN_DECLS > int glob(const char * __restrict, int, > int (*)(const char *, int), glob_t * __restrict); > +#ifdef __BLOCKS__ > +int glob_b(const char * __restrict, int, > + int (^)(const char *, int), glob_t * __restrict); > +#endif glob.h is POSIX header, the non-standard prototype visibility must be limited.