[orbis-kernel] evf: implement shared evf

Protect shared evfs with mutex
Fixed memory leak on shared evf allocation
Fixed set condition on wait
Update RcIdMap usage to use new api
This commit is contained in:
DH 2023-07-08 02:21:10 +03:00
parent e613f09b6d
commit 800c1ffcdc
6 changed files with 50 additions and 22 deletions

View file

@ -114,7 +114,7 @@ orbis::SysResult open(orbis::Thread *thread, orbis::ptr<const char> path,
}
orbis::SysResult close(orbis::Thread *thread, orbis::sint fd) {
if (!thread->tproc->fileDescriptors.remove(fd)) {
if (!thread->tproc->fileDescriptors.close(fd)) {
return ErrorCode::BADF;
}
@ -240,7 +240,7 @@ static std::string ioctlToString(unsigned long arg) {
orbis::SysResult ioctl(orbis::Thread *thread, orbis::sint fd, orbis::ulong com,
orbis::caddr_t argp) {
std::printf("ioctl: %s\n", ioctlToString(com).c_str());
std::printf("ioctl: %d %s\n", (int)fd, ioctlToString(com).c_str());
Ref<IoDeviceInstance> handle =
static_cast<IoDeviceInstance *>(thread->tproc->fileDescriptors.get(fd));
@ -248,6 +248,10 @@ orbis::SysResult ioctl(orbis::Thread *thread, orbis::sint fd, orbis::ulong com,
return ErrorCode::BADF;
}
if (handle->ioctl == nullptr) {
return ErrorCode::NOTSUP;
}
auto result = handle->ioctl(handle.get(), com, argp);
if (result < 0) {
@ -411,7 +415,7 @@ orbis::SysResult dynlib_load_prx(orbis::Thread *thread,
thread->tproc->ops->processNeeded(thread);
auto result = module->relocate(thread->tproc);
if (result.isError()) {
thread->tproc->modulesMap.remove(module->id);
thread->tproc->modulesMap.close(module->id);
return result;
}