diff --git a/kernel/src/Api/BuildNo.hpp b/kernel/src/Api/BuildNo.hpp index a7182e1..5e3f826 100644 --- a/kernel/src/Api/BuildNo.hpp +++ b/kernel/src/Api/BuildNo.hpp @@ -12,4 +12,4 @@ #pragma once -#define MONTAUK_BUILD_NUMBER 115 +#define MONTAUK_BUILD_NUMBER 126 diff --git a/programs/GNUmakefile b/programs/GNUmakefile index d288690..0c276e0 100644 --- a/programs/GNUmakefile +++ b/programs/GNUmakefile @@ -348,7 +348,7 @@ $(BINDIR)/config/%: $(CONFIGDIR)/% $(BINDIR)/os/%.elf: src/%/main.cpp link.ld GNUmakefile mkdir -p $(BINDIR)/os obj/$* $(CXX) $(CXXFLAGS) -c src/$*/main.cpp -o obj/$*/main.o - $(CXX) $(CXXFLAGS) $(LDFLAGS) obj/$*/main.o -o $@ + $(CXX) $(CXXFLAGS) $(LDFLAGS) obj/$*/main.o lib/libc/liblibc.a -o $@ clean: rm -rf $(BINDIR) obj diff --git a/programs/lib/tls/libtls.a b/programs/lib/tls/libtls.a index ef62ca3..c143167 100644 Binary files a/programs/lib/tls/libtls.a and b/programs/lib/tls/libtls.a differ diff --git a/programs/lib/tls/obj/tls.o b/programs/lib/tls/obj/tls.o index a87d493..a4ea6eb 100644 Binary files a/programs/lib/tls/obj/tls.o and b/programs/lib/tls/obj/tls.o differ diff --git a/programs/lib/tls/tls.cpp b/programs/lib/tls/tls.cpp index e3b4de4..c2c3e4e 100644 --- a/programs/lib/tls/tls.cpp +++ b/programs/lib/tls/tls.cpp @@ -151,7 +151,7 @@ void get_bearssl_time(uint32_t* days, uint32_t* seconds) { montauk::gettime(&dt); int y = dt.Year, m = dt.Month, d = dt.Day; uint32_t total = 365u * (uint32_t)y - + (uint32_t)(y/4) - (uint32_t)(y/100) + (uint32_t)(y/400); + + (uint32_t)((y+3)/4) - (uint32_t)((y+99)/100) + (uint32_t)((y+399)/400); const int md[] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; for (int mo = 1; mo < m && mo <= 12; mo++) total += md[mo]; if (y%4==0 && (y%100!=0 || y%400==0) && m > 2) total++; diff --git a/programs/src/proclist/main.cpp b/programs/src/proclist/main.cpp new file mode 100644 index 0000000..2128f92 --- /dev/null +++ b/programs/src/proclist/main.cpp @@ -0,0 +1,28 @@ +/* + * main.cpp + * Process list command for MontaukOS userspace + * Copyright (c) 2026 Daniel Hammer +*/ + +#include +#include + +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); +} \ No newline at end of file diff --git a/template/sysroot/lib/libtls.a b/template/sysroot/lib/libtls.a index 3923261..c143167 100644 Binary files a/template/sysroot/lib/libtls.a and b/template/sysroot/lib/libtls.a differ