feat: add proclist command, fix TLS bug, link libc for system programs

This commit is contained in:
2026-06-19 12:03:12 +02:00
parent ac25a4edd5
commit f2aaa39ca6
7 changed files with 31 additions and 3 deletions
+28
View File
@@ -0,0 +1,28 @@
/*
* main.cpp
* Process list command for MontaukOS userspace
* Copyright (c) 2026 Daniel Hammer
*/
#include <montauk/syscall.h>
#include <libc/stdio.h>
extern "C" void _start() {
static montauk::abi::ProcInfo processes[256];
int n = montauk::proclist(processes, 256);
if (n <= 0) {
montauk::print("Failed to query processes.\n");
montauk::exit(-1);
}
montauk::print(" PID\tHeap\tImage Name\n");
for (int i = 0; i < n; i++) {
unsigned heapMb = (unsigned)(processes[i].heapUsed / (1024 * 1024));
printf(" %d\t%d MB\t%s\n", processes[i].pid, heapMb, processes[i].name);
}
montauk::exit(0);
}