Some checks failed
Build and test / build (push) Has been cancelled
VFS functions now accept a single Process* pointer instead of credentials and groups. There is now a distinction between processes and threads Now to fix all the bugs... waitpid crashes the process with an NX error...
22 lines
597 B
C++
22 lines
597 B
C++
#include "Pledge.h"
|
|
#include "memory/MemoryManager.h"
|
|
#include "sys/Syscall.h"
|
|
#include "thread/Scheduler.h"
|
|
#include <bits/memstat.h>
|
|
|
|
Result<u64> sys_memstat(Registers*, SyscallArgs args)
|
|
{
|
|
auto* current = Process::current();
|
|
TRY(check_pledge(current, Promise::p_stdio));
|
|
|
|
struct membuf buf;
|
|
buf.mem_total = MemoryManager::total();
|
|
buf.mem_used = MemoryManager::used();
|
|
buf.mem_free = MemoryManager::free();
|
|
buf.mem_reserved = MemoryManager::reserved();
|
|
|
|
if (!MemoryManager::copy_to_user_typed((struct membuf*)args[0], &buf)) return err(EFAULT);
|
|
|
|
return 0;
|
|
}
|