mirror of
https://github.com/RPCSX/rpcsx.git
synced 2024-11-27 05:10:53 +00:00
[orbis-kernel] reduced log spam
fixed rmdir
This commit is contained in:
parent
d6a4d74d10
commit
0f86008b9b
@ -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: {
|
||||
|
@ -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:
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -574,7 +574,7 @@ orbis::ErrorCode HostFsDevice::mkdir(const char *path, int mode,
|
||||
}
|
||||
orbis::ErrorCode HostFsDevice::rmdir(const char *path, orbis::Thread *thread) {
|
||||
std::error_code ec;
|
||||
std::filesystem::remove(hostPath + "/" + path, ec);
|
||||
std::filesystem::remove_all(hostPath + "/" + path, ec);
|
||||
return convertErrorCode(ec);
|
||||
}
|
||||
orbis::ErrorCode HostFsDevice::rename(const char *from, const char *to,
|
||||
|
@ -1,7 +1,10 @@
|
||||
#include "io-device.hpp"
|
||||
#include "orbis/KernelAllocator.hpp"
|
||||
#include "orbis/file.hpp"
|
||||
#include "orbis/uio.hpp"
|
||||
#include "orbis/utils/Logs.hpp"
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
struct AoutFile : orbis::File {};
|
||||
|
||||
@ -9,11 +12,21 @@ static orbis::ErrorCode aout_ioctl(orbis::File *file, std::uint64_t request,
|
||||
void *argp, orbis::Thread *thread) {
|
||||
|
||||
ORBIS_LOG_FATAL("Unhandled aout ioctl", request);
|
||||
if (request == 0xc004500a) {
|
||||
std::this_thread::sleep_for(std::chrono::days(1));
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
static orbis::ErrorCode aout_write(orbis::File *file, orbis::Uio *uio,
|
||||
orbis::Thread *) {
|
||||
uio->resid = 0;
|
||||
return {};
|
||||
}
|
||||
|
||||
static const orbis::FileOps fileOps = {
|
||||
.ioctl = aout_ioctl,
|
||||
.write = aout_write,
|
||||
};
|
||||
|
||||
struct AoutDevice : IoDevice {
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "orbis/KernelAllocator.hpp"
|
||||
#include "orbis/file.hpp"
|
||||
#include "orbis/utils/Logs.hpp"
|
||||
#include "orbis/thread/Thread.hpp"
|
||||
|
||||
struct GbaseFile : orbis::File {};
|
||||
|
||||
@ -9,6 +10,7 @@ static orbis::ErrorCode gbase_ioctl(orbis::File *file, std::uint64_t request,
|
||||
void *argp, orbis::Thread *thread) {
|
||||
|
||||
ORBIS_LOG_FATAL("Unhandled gbase ioctl", request);
|
||||
thread->where();
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -53,8 +53,8 @@ static orbis::ErrorCode gc_ioctl(orbis::File *file, std::uint64_t request,
|
||||
|
||||
auto args = reinterpret_cast<Args *>(argp);
|
||||
|
||||
flockfile(stderr);
|
||||
ORBIS_LOG_ERROR("gc ioctl 0xc0108102", args->arg0, args->count, args->cmds);
|
||||
// flockfile(stderr);
|
||||
// ORBIS_LOG_ERROR("gc ioctl 0xc0108102", args->arg0, args->count, args->cmds);
|
||||
|
||||
for (unsigned i = 0; i < args->count; ++i) {
|
||||
auto cmd = args->cmds + (i * 2);
|
||||
@ -75,7 +75,7 @@ static orbis::ErrorCode gc_ioctl(orbis::File *file, std::uint64_t request,
|
||||
|
||||
rx::bridge.sendCommandBuffer(thread->tproc->pid, cmdId, address, size);
|
||||
}
|
||||
funlockfile(stderr);
|
||||
// funlockfile(stderr);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -88,7 +88,7 @@ static orbis::ErrorCode gc_ioctl(orbis::File *file, std::uint64_t request,
|
||||
|
||||
auto args = reinterpret_cast<Args *>(argp);
|
||||
|
||||
ORBIS_LOG_ERROR("gc ioctl 0xc0088101", args->arg0, args->arg1);
|
||||
// ORBIS_LOG_ERROR("gc ioctl 0xc0088101", args->arg0, args->arg1);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -257,9 +257,22 @@ static orbis::ErrorCode gc_ioctl(orbis::File *file, std::uint64_t request,
|
||||
break;
|
||||
}
|
||||
|
||||
case 0xc0048113: {
|
||||
// get client number
|
||||
*(std::uint32_t *)argp = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case 0xc0048115: {
|
||||
// is game closed
|
||||
*(std::uint32_t *)argp = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
ORBIS_LOG_FATAL("Unhandled gc ioctl", request);
|
||||
std::fflush(stdout);
|
||||
thread->where();
|
||||
// __builtin_trap();
|
||||
break;
|
||||
}
|
||||
|
@ -641,6 +641,7 @@ orbis::SysResult nmount(orbis::Thread *thread, orbis::ptr<orbis::IoVec> iovp,
|
||||
|
||||
orbis::SysResult exit(orbis::Thread *thread, orbis::sint status) {
|
||||
std::printf("Requested exit with status %d\n", status);
|
||||
thread->tproc->event.emit(orbis::kNoteExit, status);
|
||||
std::exit(status);
|
||||
}
|
||||
|
||||
@ -705,6 +706,7 @@ SysResult fork(Thread *thread, slong flags) {
|
||||
|
||||
kfree(flag, sizeof(*flag));
|
||||
|
||||
thread->tproc->event.emit(orbis::kNoteFork, childPid);
|
||||
thread->retval[0] = childPid;
|
||||
thread->retval[1] = 0;
|
||||
return {};
|
||||
@ -791,6 +793,20 @@ SysResult execve(Thread *thread, ptr<char> fname, ptr<ptr<char>> argv,
|
||||
std::string path = getAbsolutePath(fname, thread);
|
||||
ORBIS_LOG_ERROR(__FUNCTION__, path);
|
||||
|
||||
{
|
||||
auto name = path;
|
||||
if (auto slashP = name.rfind('/'); slashP != std::string::npos) {
|
||||
name = name.substr(slashP + 1);
|
||||
}
|
||||
|
||||
if (name.size() > 15) {
|
||||
name.resize(15);
|
||||
}
|
||||
|
||||
pthread_setname_np(pthread_self(), name.c_str());
|
||||
}
|
||||
|
||||
std::printf("pid: %u\n", ::getpid());
|
||||
{
|
||||
orbis::Ref<File> file;
|
||||
auto result = rx::vfs::open(path, kOpenFlagReadOnly, 0, &file, thread);
|
||||
@ -812,16 +828,7 @@ SysResult execve(Thread *thread, ptr<char> fname, ptr<ptr<char>> argv,
|
||||
thread->tproc->processParam = executableModule->processParam;
|
||||
thread->tproc->processParamSize = executableModule->processParamSize;
|
||||
|
||||
auto name = path;
|
||||
if (auto slashP = name.rfind('/'); slashP != std::string::npos) {
|
||||
name = name.substr(slashP + 1);
|
||||
}
|
||||
|
||||
if (name.size() > 15) {
|
||||
name.resize(15);
|
||||
}
|
||||
|
||||
pthread_setname_np(pthread_self(), name.c_str());
|
||||
thread->tproc->event.emit(orbis::kNoteExec);
|
||||
|
||||
ORBIS_LOG_ERROR(__FUNCTION__, "done");
|
||||
std::thread([&] {
|
||||
|
Loading…
Reference in New Issue
Block a user