diff options
author | Sergey Bugaev <bugaevc@gmail.com> | 2023-05-20 14:55:30 +0300 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-05-20 18:16:06 +0200 |
commit | 70d0dda0c160cb1f9000a4da50baf27c63db51c8 (patch) | |
tree | d7ecf01ec837ed140abe523feac0f5f39eecb7ca | |
parent | 9ec31e57278ffc4e680ef03e75ce5b6b02e5edcf (diff) | |
download | glibc-70d0dda0c160cb1f9000a4da50baf27c63db51c8.tar.gz glibc-70d0dda0c160cb1f9000a4da50baf27c63db51c8.tar.xz glibc-70d0dda0c160cb1f9000a4da50baf27c63db51c8.zip |
htl: Use __hurd_fail () instead of assigning errno
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230520115531.3911877-2-bugaevc@gmail.com>
-rw-r--r-- | sysdeps/htl/sem-destroy.c | 6 | ||||
-rw-r--r-- | sysdeps/htl/sem-init.c | 6 | ||||
-rw-r--r-- | sysdeps/htl/sem-post.c | 11 | ||||
-rw-r--r-- | 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 3e40151bb1..84a35ed5be 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 f04bbfdc77..f2954acd60 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 e283161a35..c57458c140 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 0959092e10..43aa185c27 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); |