[orbis-kernel] reduced log spam

fixed rmdir
This commit is contained in:
DH 2023-11-13 21:38:21 +03:00
parent d6a4d74d10
commit 0f86008b9b
8 changed files with 105 additions and 52 deletions

View file

@ -460,7 +460,7 @@ orbis::SysResult orbis::sys_osem_close(Thread *thread, sint id) {
}
orbis::SysResult orbis::sys_osem_wait(Thread *thread, sint id, sint need,
ptr<uint> pTimeout) {
ORBIS_LOG_NOTICE(__FUNCTION__, thread, id, need, pTimeout);
ORBIS_LOG_TRACE(__FUNCTION__, thread, id, need, pTimeout);
Ref<Semaphore> sem = thread->tproc->semMap.get(id);
if (need < 1 || need > sem->maxValue)
return ErrorCode::INVAL;
@ -510,7 +510,7 @@ orbis::SysResult orbis::sys_osem_wait(Thread *thread, sint id, sint need,
}
if (timedout) {
return ErrorCode::TIMEDOUT;
return SysResult::notAnError(ErrorCode::TIMEDOUT);
}
return {};
}
@ -863,8 +863,8 @@ struct mdbg_property {
orbis::SysResult orbis::sys_mdbg_service(Thread *thread, uint32_t op,
ptr<void> arg0, ptr<void> arg1) {
ORBIS_LOG_NOTICE("sys_mdbg_service", thread->tid, op, arg0, arg1);
thread->where();
// ORBIS_LOG_NOTICE("sys_mdbg_service", thread->tid, op, arg0, arg1);
// thread->where();
switch (op) {
case 1: {

View file

@ -82,16 +82,24 @@ orbis::SysResult orbis::sys_clock_gettime(Thread *, clockid_t clock_id,
result = getHostClock(CLOCK_PROCESS_CPUTIME_ID);
break;
case ClockId::Network:
ORBIS_LOG_ERROR("Unimplemented ClockId::Network\n");
// TODO
// ORBIS_LOG_ERROR("Unimplemented ClockId::Network");
result = getHostClock(CLOCK_PROCESS_CPUTIME_ID);
break;
case ClockId::DebugNetwork:
ORBIS_LOG_ERROR("Unimplemented ClockId::DebugNetwork\n");
// TODO
// ORBIS_LOG_ERROR("Unimplemented ClockId::DebugNetwork");
result = getHostClock(CLOCK_PROCESS_CPUTIME_ID);
break;
case ClockId::AdNetwork:
ORBIS_LOG_ERROR("Unimplemented ClockId::AdNetwork\n");
// TODO
// ORBIS_LOG_ERROR("Unimplemented ClockId::AdNetwork");
result = getHostClock(CLOCK_PROCESS_CPUTIME_ID);
break;
case ClockId::RawNetwork:
ORBIS_LOG_ERROR("Unimplemented ClockId::RawNetwork\n");
// TODO
// ORBIS_LOG_ERROR("Unimplemented ClockId::RawNetwork");
result = getHostClock(CLOCK_PROCESS_CPUTIME_ID);
break;
default:

View file

@ -8,46 +8,56 @@ namespace orbis::utils {
void shared_cv::impl_wait(shared_mutex &mutex, unsigned _val,
std::uint64_t usec_timeout) noexcept {
// Not supposed to fail
if (!_val)
if (!_val) {
std::abort();
}
// Wait with timeout
struct timespec timeout {};
timeout.tv_nsec = (usec_timeout % 1000'000) * 1000;
timeout.tv_sec = (usec_timeout / 1000'000);
again:
auto result = syscall(SYS_futex, &m_value, FUTEX_WAIT, _val,
usec_timeout + 1 ? &timeout : nullptr, 0, 0);
if (result < 0)
result = errno;
// Cleanup
const auto old = atomic_fetch_op(m_value, [&](unsigned &value) {
// Remove waiter if no signals
if (!(value & ~c_waiter_mask) && result != EAGAIN)
value -= 1;
while (true) {
auto result = syscall(SYS_futex, &m_value, FUTEX_WAIT, _val,
usec_timeout + 1 ? &timeout : nullptr, 0, 0);
if (result < 0) {
result = errno;
}
// Try to remove signal
if (value & c_signal_mask)
value -= c_signal_one;
if (value & c_locked_mask)
value -= c_locked_mask;
});
// Cleanup
const auto old = atomic_fetch_op(m_value, [&](unsigned &value) {
// Remove waiter if no signals
if (!(value & ~c_waiter_mask) && result != EAGAIN && result != EINTR) {
value -= 1;
}
// Lock is already acquired
if (old & c_locked_mask) {
return;
// Try to remove signal
if (value & c_signal_mask) {
value -= c_signal_one;
}
if (value & c_locked_mask) {
value -= c_locked_mask;
}
});
// Lock is already acquired
if (old & c_locked_mask) {
return;
}
// Wait directly (waiter has been added)
if (old & c_signal_mask) {
mutex.impl_wait();
return;
}
// Possibly spurious wakeup
if (result != EAGAIN && result != EINTR) {
break;
}
}
// Wait directly (waiter has been added)
if (old & c_signal_mask) {
mutex.impl_wait();
return;
}
// Possibly spurious wakeup
if (result == EAGAIN)
goto again;
mutex.lock();
}