2#include "pedigree/kernel/process/Scheduler.h"
3#include "pedigree/kernel/process/Thread.h"
4#include "pedigree/kernel/processor/PhysicalMemoryManager.h"
5#include "pedigree/kernel/processor/Processor.h"
6#include "pedigree/kernel/processor/ProcessorInformation.h"
7#include "pedigree/kernel/syscallError.h"
8#include "pedigree/kernel/time/Time.h"
10#include "PosixSubsystem.h"
12#include "system-information-abi.h"
13#include "system-information-syscalls.h"
15int posix_sysinfo(
void* information) {
18 if (!memory.available) {
19 SYSCALL_ERROR(OperationNotSupported);
23 if (!PosixSystemInformation::setMemory(
24 snapshot, memory.totalPages, memory.freePages, swap.active ? swap.totalPages : 0,
26 SYSCALL_ERROR(ValueTooLarge);
29 const uint64_t ticks = Time::getTicks();
30 snapshot.uptime = ticks / Time::Multiplier::Second + (ticks % Time::Multiplier::Second != 0);
32 snapshot.procs = activity.tasks > 65535 ? 65535 : activity.tasks;
33 for (
size_t i = 0; i < 3; ++i)
34 snapshot.loads[i] = activity.loads[i];
38 SYSCALL_ERROR(BadAddress);
44int posix_personality(
unsigned long requested) {
48 const uint32_t value =
static_cast<uint32_t
>(requested);
50 if (value == ExecutionPersonality::Linux32) {
51 SYSCALL_ERROR(InvalidArgument);
55 if (!thread.executionPersonality().select(value, previous)) {
56 SYSCALL_ERROR(InvalidArgument);
Memory-mapped file interface.
static MemoryMapManager & instance()
static PhysicalMemoryManager & instance()
static bool copyToUser(void *destination, const void *source, size_t count, size_t elementSize=1)
static ProcessorInformation & information()
static Scheduler & instance()