diff options
author | Richard Braun <rbraun@sceen.net> | 2018-02-24 06:45:44 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2018-02-24 06:48:21 +0100 |
commit | 7dcf6715ffb3cc2f00f6327b896d16f173a1b082 (patch) | |
tree | 210570e98e074d7abade0d22c64e05b9c02435ba /kern/mutex | |
parent | be5b9d6ab9f7e7a81c367e4bb0823ba11f85940f (diff) |
New errno.h standard header
Use standard errno codes. This change also adds strerror to string.h.
Diffstat (limited to 'kern/mutex')
-rw-r--r-- | kern/mutex/mutex_adaptive.c | 4 | ||||
-rw-r--r-- | kern/mutex/mutex_adaptive_i.h | 6 | ||||
-rw-r--r-- | kern/mutex/mutex_plain_i.h | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/kern/mutex/mutex_adaptive.c b/kern/mutex/mutex_adaptive.c index db92f9d5..b2af4561 100644 --- a/kern/mutex/mutex_adaptive.c +++ b/kern/mutex/mutex_adaptive.c @@ -16,13 +16,13 @@ */ #include <assert.h> +#include <errno.h> #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include <kern/atomic.h> #include <kern/clock.h> -#include <kern/error.h> #include <kern/init.h> #include <kern/mutex.h> #include <kern/mutex_types.h> @@ -152,7 +152,7 @@ mutex_adaptive_lock_slow_common(struct mutex *mutex, bool timed, uint64_t ticks) mutex_adaptive_inc_sc(MUTEX_ADAPTIVE_SC_SPINS); if (timed && clock_time_occurred(ticks, clock_get_time())) { - error = ERROR_TIMEDOUT; + error = ETIMEDOUT; break; } diff --git a/kern/mutex/mutex_adaptive_i.h b/kern/mutex/mutex_adaptive_i.h index ce2ac4f2..05e97640 100644 --- a/kern/mutex/mutex_adaptive_i.h +++ b/kern/mutex/mutex_adaptive_i.h @@ -24,10 +24,10 @@ #endif #include <assert.h> +#include <errno.h> #include <stdint.h> #include <kern/atomic.h> -#include <kern/error.h> #include <kern/init.h> #include <kern/macros.h> #include <kern/mutex_types.h> @@ -58,7 +58,7 @@ mutex_adaptive_lock_fast(struct mutex *mutex) owner = atomic_cas_acquire(&mutex->owner, 0, (uintptr_t)thread_self()); if (unlikely(owner != 0)) { - return ERROR_BUSY; + return EBUSY; } return 0; @@ -72,7 +72,7 @@ mutex_adaptive_unlock_fast(struct mutex *mutex) owner = atomic_cas_release(&mutex->owner, (uintptr_t)thread_self(), 0); if (unlikely(owner & MUTEX_ADAPTIVE_CONTENDED)) { - return ERROR_BUSY; + return EBUSY; } return 0; diff --git a/kern/mutex/mutex_plain_i.h b/kern/mutex/mutex_plain_i.h index 0c58174b..d28fd92b 100644 --- a/kern/mutex/mutex_plain_i.h +++ b/kern/mutex/mutex_plain_i.h @@ -24,10 +24,10 @@ #endif #include <assert.h> +#include <errno.h> #include <stdint.h> #include <kern/atomic.h> -#include <kern/error.h> #include <kern/init.h> #include <kern/mutex_types.h> @@ -52,7 +52,7 @@ mutex_plain_lock_fast(struct mutex *mutex) state = atomic_cas_acquire(&mutex->state, MUTEX_UNLOCKED, MUTEX_LOCKED); if (unlikely(state != MUTEX_UNLOCKED)) { - return ERROR_BUSY; + return EBUSY; } return 0; @@ -66,7 +66,7 @@ mutex_plain_unlock_fast(struct mutex *mutex) state = atomic_swap_release(&mutex->state, MUTEX_UNLOCKED); if (unlikely(state == MUTEX_CONTENDED)) { - return ERROR_BUSY; + return EBUSY; } return 0; |