Applied, thanks! Sergey Bugaev via Libc-alpha, le sam. 20 mai 2023 14:55:30 +0300, a ecrit: > Signed-off-by: Sergey Bugaev <buga...@gmail.com> > --- > > *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 <semaphore.h> > #include <errno.h> > > +#include <hurd.h> > #include <pt-internal.h> > > 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 <semaphore.h> > #include <errno.h> > > +#include <hurd.h> > #include <pt-internal.h> > > 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 <assert.h> > > #include <hurdlock.h> > +#include <hurd.h> > > #include <pt-internal.h> > > @@ -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 <semaphore.h> > #include <errno.h> > > +#include <hurd.h> > #include <pt-internal.h> > > 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.