修改errno,使其与relibc的保持一致 (#234)

修改errno,使其与relibc的保持一致
This commit is contained in:
houmkh
2023-04-11 17:05:33 +08:00
committed by GitHub
parent ac48398d3f
commit 79a452ce8f
20 changed files with 593 additions and 402 deletions

View File

@ -114,13 +114,13 @@ impl LockRef {
return Err(SystemError::ETIMEDOUT.to_posix_errno());
}
/// @brief 对于不支持无锁lockref的架构直接返回Err(SystemError::ENOTSUP),表示不支持
/// @brief 对于不支持无锁lockref的架构直接返回Err(SystemError::EOPNOTSUPP_OR_ENOTSUP),表示不支持
#[cfg(not(target_arch = "x86_64"))]
#[inline]
fn cmpxchg_loop(&mut self, mode: CmpxchgMode) -> Result<i32, i32> {
use crate::include::bindings::bindings::ENOTSUP;
use crate::include::bindings::bindings::EOPNOTSUPP_OR_ENOTSUP;
return Err(SystemError::ENOTSUP.to_posix_errno());
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP.to_posix_errno());
}
/// @brief 原子的将引用计数加1
@ -239,7 +239,9 @@ impl LockRef {
return Err(SystemError::EPERM);
}
// 由于cmpxchg超时操作失败
if *cmpxchg_result.as_ref().unwrap_err() != SystemError::ENOTSUP.to_posix_errno() {
if *cmpxchg_result.as_ref().unwrap_err()
!= SystemError::EOPNOTSUPP_OR_ENOTSUP.to_posix_errno()
{
return Err(SystemError::EFAULT);
}

View File

@ -210,7 +210,7 @@ impl<T> SpinLock<T> {
flag: 0,
});
}
return Err(SystemError::EAGAIN);
return Err(SystemError::EAGAIN_OR_EWOULDBLOCK);
}
pub fn try_lock_irqsave(&self) -> Result<SpinLockGuard<T>, SystemError> {
@ -221,7 +221,7 @@ impl<T> SpinLock<T> {
flag: flags,
});
}
return Err(SystemError::EAGAIN);
return Err(SystemError::EAGAIN_OR_EWOULDBLOCK);
}
}