feat: add userspace system logging, rename klog to syslog, rename relevant syscalls and API functions

This commit is contained in:
daniel committed 2026-08-14 18:37:27 +02:00
1 parent 8e45d43116
commit 724029cacb
26 files changed
+139 -52

No files matched your search

+1 -1
View File
@@ -12,4 +12,4 @@
#pragma once
#define MONTAUK_BUILD_NUMBER 120
#define MONTAUK_BUILD_NUMBER 141
+15 -2
View File
@@ -53,6 +53,8 @@ namespace montauk::abi {
static constexpr uint64_t kMaxWindowTitleBytes = 256;
static constexpr uint64_t kMaxHostnameBytes = 256;
static constexpr uint64_t kMaxUserNameBytes = 32;
static constexpr uint64_t kMaxUserspaceLogComponentNameBytes = 32;
static constexpr uint64_t kMaxUserspaceLogEntryBytes = 1024;
// ---- Dispatch ----
@@ -300,9 +302,9 @@ namespace montauk::abi {
case SYS_GETRANDOM:
if (!UserMemory::Range(frame->arg1, frame->arg2, true)) return -1;
return Sys_GetRandom((uint8_t*)frame->arg1, frame->arg2);
case SYS_KLOG:
case SYS_LOG:
if (!UserMemory::Range(frame->arg1, frame->arg2, true)) return -1;
return Kt::ReadKernelLog((char*)frame->arg1, frame->arg2);
return Kt::ReadKernelLogBuffer((char*)frame->arg1, frame->arg2);
case SYS_MOUSESTATE:
if (!UserMemory::Writable<MouseState>(frame->arg1)) return -1;
Sys_MouseState((MouseState*)frame->arg1);
@@ -609,6 +611,17 @@ namespace montauk::abi {
return Sys_ClipboardClear();
case SYS_INPUT_WAIT:
return (int64_t)Sys_InputWait(frame->arg1, frame->arg2);
case SYS_LOG_WRITE: { // "init" <---- component name (arg1)
// "started service ..." <---- log message (arg2)
if (!UserMemory::String(frame->arg1, kMaxUserspaceLogComponentNameBytes)
|| !UserMemory::String(frame->arg2, kMaxUserspaceLogEntryBytes)
) return -1;
Kt::UserspaceLogStream((const char*)frame->arg1) << (const char*)frame->arg2;
return 0;
}
default:
return -1;
}
+4 -1
View File
@@ -103,7 +103,7 @@ namespace montauk::abi {
/* Random.hpp */
static constexpr uint64_t SYS_GETRANDOM = 45;
static constexpr uint64_t SYS_KLOG = 46;
static constexpr uint64_t SYS_LOG = 46;
/* Mouse.hpp */
static constexpr uint64_t SYS_MOUSESTATE = 47;
@@ -157,6 +157,9 @@ namespace montauk::abi {
static constexpr uint64_t SYS_AUDIOWRITE = 82;
static constexpr uint64_t SYS_AUDIOCTL = 83;
/* Userspace log */
static constexpr uint64_t SYS_LOG_WRITE = 176;
// Audio control commands (for SYS_AUDIOCTL).
//
// Commands 0..3 act on the stream named by the handle argument.