Kernel: Add non standard value to sys$sysconf

Add `_SC_PHYS_PAGES` to sys$sysconf syscall. This value is needed
for a port I'm working on.
This commit is contained in:
Fabian Dellwing 2023-03-10 12:08:50 +01:00 committed by Sam Atkins
parent c705afa43a
commit 7c0b360881
Notes: sideshowbarker 2024-07-17 00:53:02 +09:00
2 changed files with 5 additions and 0 deletions

View file

@ -45,6 +45,7 @@ enum {
_SC_MAPPED_FILES,
_SC_ARG_MAX,
_SC_IOV_MAX,
_SC_PHYS_PAGES,
};
#define _SC_MONOTONIC_CLOCK _SC_MONOTONIC_CLOCK
@ -60,6 +61,7 @@ enum {
#define _SC_MAPPED_FILES _SC_MAPPED_FILES
#define _SC_ARG_MAX _SC_ARG_MAX
#define _SC_IOV_MAX _SC_IOV_MAX
#define _SC_PHYS_PAGES _SC_PHYS_PAGES
#ifdef __cplusplus
}

View file

@ -5,6 +5,7 @@
*/
#include <Kernel/FileSystem/VirtualFileSystem.h>
#include <Kernel/Memory/MemoryManager.h>
#include <Kernel/Process.h>
#include <Kernel/Time/TimeManagement.h>
@ -37,6 +38,8 @@ ErrorOr<FlatPtr> Process::sys$sysconf(int name)
return Process::max_arguments_size;
case _SC_IOV_MAX:
return IOV_MAX;
case _SC_PHYS_PAGES:
return MM.get_system_memory_info().physical_pages;
default:
return EINVAL;
}