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

+4
View File
@@ -7,6 +7,7 @@
#pragma once
#include <cstdint>
#include <cstddef>
#include <montauk/statuscodes.h>
namespace montauk::abi {
@@ -312,6 +313,9 @@ namespace montauk::abi {
static_assert((CAP_ADMIN_SESSION & CAP_COMPOSITOR) == 0,
"a session must not delegate the compositor's authority; "
"login grants it to the desktop directly");
// Capability denial for the Wi-Fi and USB syscalls only, which keep their
// own WIFI_ERR_* / USB_ERR_* spaces; everything else returns
// CapabilityDenied from StatusCodes.
static constexpr int SYS_ERR_PERMISSION = -13;
// A process holds two independent sets: what it may use (effective) and
+21
View File
@@ -219,6 +219,27 @@ extern "C" {
#define MTK_SYS_CONSENT_REPLY 193
/* @SYSCALLS-END */
/* Syscall status codes (montauk/statuscodes.h for C++). */
/* @STATUS-BEGIN
Generated from Common/StatusCodes.hpp by scripts/montauk-syscalls.py.
Do not edit by hand; run 'make gen-syscalls' to refresh. */
#define MTK_STATUS_SUCCESS (0)
#define MTK_STATUS_GENERIC_FAILURE (-1)
#define MTK_STATUS_PERMISSION_DENIED (-2)
#define MTK_STATUS_CAPABILITY_DENIED (-3)
#define MTK_STATUS_SYSTEM_INTEGRITY_ERROR (-4)
#define MTK_STATUS_BAD_POINTER (-5)
#define MTK_STATUS_INVALID_ARGUMENT (-6)
#define MTK_STATUS_UNSUPPORTED_OP (-7)
#define MTK_STATUS_NO_DEVICE (-8)
#define MTK_STATUS_IO_FAILURE (-9)
#define MTK_STATUS_BAD_INVOCATION (-10)
#define MTK_STATUS_NO_SUCH_PATH (-11)
#define MTK_STATUS_BUSY (-12)
#define MTK_STATUS_BUFFER_TOO_SMALL (-13)
#define MTK_STATUS_OUT_OF_MEMORY (-14)
/* @STATUS-END */
#define MTK_SOCK_TCP 1
#define MTK_SOCK_UDP 2
#define MTK_IPC_SIGNAL_READABLE (1u << 0)
+35
View File
@@ -0,0 +1,35 @@
/*
* statuscodes.h
* MontaukOS status codes
* Copyright (c) 2026 Daniel Hammer
*/
#pragma once
// Userspace mirror of kernel/src/Common/StatusCodes.hpp. Also usable from C
// (the libc includes it), where the enumerators are unqualified.
#ifdef __cplusplus
namespace montauk {
#endif
enum StatusCodes {
Success = 0,
GenericFailure = -1,
PermissionDenied = -2,
CapabilityDenied = -3,
SystemIntegrityError = -4,
BadPointer = -5,
InvalidArgument = -6,
UnsupportedOp = -7,
NoDevice = -8,
IoFailure = -9,
BadInvocation = -10,
NoSuchPath = -11,
Busy = -12,
BufferTooSmall = -13,
OutOfMemory = -14
};
#ifdef __cplusplus
}
#endif
+1
View File
@@ -6,6 +6,7 @@
#pragma once
#include <Api/Syscall.hpp>
#include <montauk/statuscodes.h>
namespace montauk {