feat: unify system status codes

This commit is contained in:
daniel committed 2026-09-30 09:43:18 +02:00
1 parent 93894b8fe5
commit 8a3ffb2be1
46 files changed
+1499 -489

No files matched your search

+7 -7
View File
@@ -15,16 +15,16 @@
namespace montauk::abi {
static int Sys_WinCreate(const char* title, int w, int h, WinCreateResult* result) {
if (result == nullptr || title == nullptr) return -1;
if (result == nullptr || title == nullptr) return InvalidArgument;
auto* proc = Sched::GetCurrentProcessPtr();
if (proc == nullptr) return -1;
if (proc == nullptr) return GenericFailure;
uint64_t outVa = 0;
int id = WinServer::Create(proc->pid, proc->pml4Phys, title, w, h,
proc->heapNext, outVa);
result->id = id;
result->pixelVa = (id >= 0) ? outVa : 0;
return id >= 0 ? 0 : -1;
return id >= 0 ? Success : id;
}
static int Sys_WinDestroy(int windowId) {
@@ -36,7 +36,7 @@ namespace montauk::abi {
}
static int Sys_WinPoll(int windowId, WinEvent* outEvent) {
if (outEvent == nullptr) return -1;
if (outEvent == nullptr) return InvalidArgument;
return WinServer::Poll(windowId, Sched::GetCurrentPid(), outEvent);
}
@@ -58,13 +58,13 @@ namespace montauk::abi {
static int Sys_WinUnmap(int windowId) {
auto* proc = Sched::GetCurrentProcessPtr();
if (proc == nullptr) return -1;
if (proc == nullptr) return GenericFailure;
return WinServer::Unmap(windowId, proc->pid, proc->pml4Phys);
}
static int Sys_WinSendEvent(int windowId, const WinEvent* event) {
if (!Sched::HasCapability(CAP_COMPOSITOR)) return SYS_ERR_PERMISSION;
if (event == nullptr) return -1;
if (!Sched::HasCapability(CAP_COMPOSITOR)) return CapabilityDenied;
if (event == nullptr) return InvalidArgument;
return WinServer::SendEvent(windowId, event);
}