Skip to content

Commit

Permalink
[WIP] sysdeps/managarm: implement sys_sysconf
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectrodeYT committed Oct 11, 2023
1 parent 7047232 commit cf27a71
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions sysdeps/managarm/generic/sched.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#include <bits/ensure.h>
#include <unistd.h>
#include <pwd.h>

#include <hel.h>
#include <hel-syscalls.h>
#include <mlibc/debug.hpp>
#include <mlibc/allocator.hpp>
// #include <mlibc/arch-defs.hpp>
#include <mlibc/posix-pipe.hpp>
#include <mlibc/posix-sysdeps.hpp>

Expand Down Expand Up @@ -94,5 +96,19 @@ int sys_setthreadaffinity(pid_t tid, size_t cpusetsize, const cpu_set_t *mask) {
return 0;
}

int sys_sysconf(int num, long *ret) {
mlibc::infoLogger() << "mlibc: sys_sysconf top" << frg::endlog;
switch(num) {
case _SC_NPROCESSORS_ONLN:
case _SC_NPROCESSORS_CONF:
*ret = 0;
mlibc::infoLogger() << "mlibc: ret = " << ret << ", *ret = " << *ret << frg::endlog;
HEL_CHECK(helGetCpuInformation((uint32_t*)ret));
mlibc::infoLogger() << "mlibc: ret = " << ret << ", *ret = " << *ret << frg::endlog;
return 0;
default:
return EINVAL;
}
}

}
1 change: 1 addition & 0 deletions sysdeps/managarm/rtdl-generic/support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ int sys_vm_map(void *hint, size_t size, int prot, int flags, int fd, off_t offse

managarm::posix::SvrResponse<MemoryAllocator> resp(getAllocator());
resp.ParseFromArray(recv_resp->data, recv_resp->length);
mlibc::infoLogger() << "mlibc: sys_vm_map resp.error()=" << (int)resp.error() << frg::endlog;
__ensure(resp.error() == managarm::posix::Errors::SUCCESS);
*window = reinterpret_cast<void *>(resp.offset());
return 0;
Expand Down

0 comments on commit cf27a71

Please sign in to comment.