Skip to content

Commit

Permalink
fix error codes sign to be negative
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisBiryukov91 committed Feb 28, 2024
1 parent 19e862f commit 33d7448
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/platform/synchronization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ pub struct z_mutex_t(usize);
impl_guarded_transmute!(z_mutex_t, ZMutexPtr);
impl_guarded_transmute!(ZMutexPtr, z_mutex_t);

// try to use the same error codes as in GNU pthreads
const EBUSY: i8 = 16;
const EINVAL: i8 = 22;
const EAGAIN: i8 = 11;
const EPOISON: i8 = 22; // same as EINVAL
// using the same error codes as in GNU pthreads, but with negative sign
// due to convention to return negative values on error
const EBUSY: i8 = -16;
const EINVAL: i8 = -22;
const EAGAIN: i8 = -11;
const EPOISON: i8 = -22; // same as EINVAL

#[no_mangle]
#[allow(clippy::missing_safety_doc)]
Expand Down

0 comments on commit 33d7448

Please sign in to comment.