From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id D0DF23858C52 for ; Sat, 20 May 2023 16:15:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D0DF23858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q0PFC-0000dt-55; Sat, 20 May 2023 12:15:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=In-Reply-To:MIME-Version:References:Subject:To:From: Date; bh=wfNGwC/iQ63yXZuz+HistxLC4dJnUbdcOYXZwe1aFWk=; b=OzwsIuoolaAySjS/biW9 HKax0I1qT6UY/BpPr+TFDMDXcKHlhxCuQyusSccZS6CDmepWVmFa1hI+n0rSGmUeK7/H1WDMdhHi0 G+Zb/spS4fyh8oCpfPlwpOlOr9795TjNjG/MVx7qwlnYiCO+Cf07CTP1vOh5L3ioq2h2imvhLLrxM t8CFEojpI5E3227ErIfWvDgoBg5tKdP8HtSvaMr+oZrt50JQswnndiTuvqS9TZ5Kxe/7qQta9HkYt 23AnLLKAzTyb+f03AbN6YxMsHC2P6nSWr58cRTLgJozntvIVIwFKbMk062s630Q11EO6uXoQxwOXE r94m1LxC/Geo6A==; Received: from 2a02-8440-521d-0057-de41-a9ff-fe47-ec49.rev.sfr.net ([2a02:8440:521d:57:de41:a9ff:fe47:ec49] helo=begin) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q0PFB-0002Mo-R6; Sat, 20 May 2023 12:15:45 -0400 Received: from samy by begin with local (Exim 4.96) (envelope-from ) id 1q0PEz-008KBE-2I; Sat, 20 May 2023 18:15:33 +0200 Date: Sat, 20 May 2023 18:15:33 +0200 From: Samuel Thibault To: Sergey Bugaev Cc: libc-alpha@sourceware.org, bug-hurd@gnu.org Subject: Re: [PATCH 2/3] htl: Use __hurd_fail () instead of assigning errno Message-ID: <20230520161533.okfzmxiq4waqttuf@begin> Mail-Followup-To: Sergey Bugaev , libc-alpha@sourceware.org, bug-hurd@gnu.org References: <20230520115531.3911877-1-bugaevc@gmail.com> <20230520115531.3911877-2-bugaevc@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230520115531.3911877-2-bugaevc@gmail.com> Organization: I am not organized User-Agent: NeoMutt/20170609 (1.8.3) X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Applied, thanks! Sergey Bugaev via Libc-alpha, le sam. 20 mai 2023 14:55:30 +0300, a ecrit: > Signed-off-by: Sergey Bugaev > --- > > *Technically*, sysdeps/htl/ is not Hurd-specific (unlike, say, > sysdeps/hurd/htl), but I don't think this distinction is meaningful, > and the H in HTL must stand for something. Still, this is in a separate > patch so it can be (not) applied easily. > > sysdeps/htl/sem-destroy.c | 6 ++---- > sysdeps/htl/sem-init.c | 6 ++---- > sysdeps/htl/sem-post.c | 11 +++-------- > sysdeps/htl/sem-trywait.c | 4 ++-- > 4 files changed, 9 insertions(+), 18 deletions(-) > > diff --git a/sysdeps/htl/sem-destroy.c b/sysdeps/htl/sem-destroy.c > index 3e40151b..84a35ed5 100644 > --- a/sysdeps/htl/sem-destroy.c > +++ b/sysdeps/htl/sem-destroy.c > @@ -19,6 +19,7 @@ > #include > #include > > +#include > #include > > int > @@ -34,10 +35,7 @@ __sem_destroy (sem_t *sem) > #endif > ) > /* There are threads waiting on *SEM. */ > - { > - errno = EBUSY; > - return -1; > - } > + return __hurd_fail (EBUSY); > > return 0; > } > diff --git a/sysdeps/htl/sem-init.c b/sysdeps/htl/sem-init.c > index f04bbfdc..f2954acd 100644 > --- a/sysdeps/htl/sem-init.c > +++ b/sysdeps/htl/sem-init.c > @@ -19,6 +19,7 @@ > #include > #include > > +#include > #include > > int > @@ -26,10 +27,7 @@ __sem_init (sem_t *sem, int pshared, unsigned value) > { > #ifdef SEM_VALUE_MAX > if (value > SEM_VALUE_MAX) > - { > - errno = EINVAL; > - return -1; > - } > + return __hurd_fail (EINVAL); > #endif > > struct new_sem *isem = (struct new_sem *) sem; > diff --git a/sysdeps/htl/sem-post.c b/sysdeps/htl/sem-post.c > index e283161a..c57458c1 100644 > --- a/sysdeps/htl/sem-post.c > +++ b/sysdeps/htl/sem-post.c > @@ -20,6 +20,7 @@ > #include > > #include > +#include > > #include > > @@ -35,10 +36,7 @@ __sem_post (sem_t *sem) > do > { > if ((d & SEM_VALUE_MASK) == SEM_VALUE_MAX) > - { > - errno = EOVERFLOW; > - return -1; > - } > + return __hurd_fail (EOVERFLOW); > } > while (!atomic_compare_exchange_weak_release (&isem->data, &d, d + 1)); > > @@ -51,10 +49,7 @@ __sem_post (sem_t *sem) > do > { > if ((v >> SEM_VALUE_SHIFT) == SEM_VALUE_MAX) > - { > - errno = EOVERFLOW; > - return -1; > - } > + return __hurd_fail (EOVERFLOW); > } > while (!atomic_compare_exchange_weak_release > (&isem->value, &v, v + (1 << SEM_VALUE_SHIFT))); > diff --git a/sysdeps/htl/sem-trywait.c b/sysdeps/htl/sem-trywait.c > index 0959092e..43aa185c 100644 > --- a/sysdeps/htl/sem-trywait.c > +++ b/sysdeps/htl/sem-trywait.c > @@ -19,6 +19,7 @@ > #include > #include > > +#include > #include > > int > @@ -29,8 +30,7 @@ __sem_trywait (sem_t *sem) > if (__sem_waitfast (isem, 1) == 0) > return 0; > > - errno = EAGAIN; > - return -1; > + return __hurd_fail (EAGAIN); > } > > weak_alias (__sem_trywait, sem_trywait); > -- > 2.40.1 > -- Samuel --- Pour une évaluation indépendante, transparente et rigoureuse ! Je soutiens la Commission d'Évaluation de l'Inria.