rpcsx/orbis-kernel/src/sys/sys_uipc_shm.cpp
DH 65e653f5ef [rpcsx-os/orbis-kernel] random bugfixes
ipmi: fixed respond sync, get message, try get message, try send message
event: detach event emitter from file
signals: basic implementation
linker: fixed zero symbol relocation, fixed exec relocation
shared_cv/mutex: implement eintr response support
shared_cv: fixed possible loop instead of wait
ipmi: implement invoke async, respond async, get result, get client app id, client get name
rpcsx-os: add safemode flag
2024-01-13 20:57:02 +03:00

46 lines
1.1 KiB
C++

#include "file.hpp"
#include "orbis-config.hpp"
#include "sys/sysproto.hpp"
#include "thread/ProcessOps.hpp"
#include "thread/Thread.hpp"
#include "thread/Process.hpp"
orbis::SysResult orbis::sys_shm_open(Thread *thread, ptr<const char> path,
sint flags, mode_t mode) {
char _name[256];
if (auto result = ureadString(_name, sizeof(_name), path);
result != ErrorCode{}) {
return result;
}
if (auto shm_open = thread->tproc->ops->shm_open) {
Ref<File> file;
auto result = shm_open(thread, path, flags, mode, &file);
if (result.isError()) {
return result;
}
thread->retval[0] = thread->tproc->fileDescriptors.insert(file);
return {};
}
return ErrorCode::NOSYS;
}
orbis::SysResult orbis::sys_shm_unlink(Thread *thread, ptr<const char> path) {
char _name[256];
if (auto result = ureadString(_name, sizeof(_name), path);
result != ErrorCode{}) {
return result;
}
if (auto shm_unlink = thread->tproc->ops->shm_unlink) {
auto result = shm_unlink(thread, path);
if (result.isError()) {
return result;
}
return {};
}
return ErrorCode::NOSYS;
}