[orbis-kenel] implement sys_access

fix shm_unlink
This commit is contained in:
DH 2023-11-11 22:25:31 +03:00
parent e9dfaf2573
commit 044c86dc3f
3 changed files with 63 additions and 2 deletions

View File

@ -1,5 +1,13 @@
#include "sys/sysproto.hpp"
namespace orbis {
struct rlimit {
int64_t softLimit;
int64_t hardLimit;
};
} // namespace orbis
orbis::SysResult orbis::sys_getpriority(Thread *thread, sint which, sint who) {
return ErrorCode::NOSYS;
}
@ -23,7 +31,55 @@ orbis::SysResult orbis::sys_setrlimit(Thread *thread, uint which,
}
orbis::SysResult orbis::sys_getrlimit(Thread *thread, uint which,
ptr<struct rlimit> rlp) {
return ErrorCode::NOSYS;
switch (which) {
case 0: { // cpu
break;
}
case 1: { // fsize
break;
}
case 2: { // data
break;
}
case 3: { // stack
break;
}
case 4: { // core
break;
}
case 5: { // rss
break;
}
case 6: { // memlock
break;
}
case 7: { // nproc
break;
}
case 8: { // nofile
break;
}
case 9: { // sbsize
break;
}
case 10: { // vmem
break;
}
case 11: { // npts
break;
}
case 12: { // swap
break;
}
default:
return ErrorCode::INVAL;
}
rlp->softLimit = 4096;
rlp->hardLimit = 4096;
return {};
}
orbis::SysResult orbis::sys_getrusage(Thread *thread, sint who,
ptr<struct rusage> rusage) {

View File

@ -146,6 +146,11 @@ orbis::SysResult orbis::sys_freebsd6_lseek(Thread *thread, sint fd, sint,
return sys_lseek(thread, fd, offset, whence);
}
orbis::SysResult orbis::sys_access(Thread *thread, ptr<char> path, sint flags) {
if (auto open = thread->tproc->ops->open) {
Ref<File> file;
return open(thread, path, flags, 0, &file);
}
return ErrorCode::NOSYS;
}
orbis::SysResult orbis::sys_faccessat(Thread *thread, sint fd, ptr<char> path,

View File

@ -358,7 +358,7 @@ orbis::SysResult socket(orbis::Thread *thread, orbis::ptr<const char> name,
orbis::SysResult shm_unlink(orbis::Thread *thread, const char *path) {
auto dev = static_cast<IoDevice *>(orbis::g_context.shmDevice.get());
return dev->unlink(getAbsolutePath(path, thread).c_str(), false, thread);
return dev->unlink(path, false, thread);
}
orbis::SysResult dynlib_get_obj_member(orbis::Thread *thread,