-
-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] sysdeps/managarm: implement sys_sysconf
- Loading branch information
1 parent
7047232
commit b2ee39b
Showing
4 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include <unistd.h> | ||
|
||
#include <hel.h> | ||
#include <hel-syscalls.h> | ||
#include <mlibc/debug.hpp> | ||
#include <mlibc/allocator.hpp> | ||
#include <mlibc/linux-sysdeps.hpp> | ||
#include <mlibc/posix-sysdeps.hpp> | ||
|
||
int sys_sysinfo(struct sysinfo *info) { | ||
mlibc::infoLogger() << "mlibc: sys_sysinfo top" << frg::endlog; | ||
// TODO: fill in missing fields | ||
uint64_t uptimeNanos; | ||
HEL_CHECK(helGetSystemInformation(&uptimeNanos)); | ||
|
||
info->uptime = uptimeNanos / 1'000'000'000; | ||
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters