feat: identify userspace logs by user and image

This commit is contained in:
daniel committed 2026-08-22 18:48:38 +02:00
1 parent 8a74b771e1
commit ffc9756e67
7 files changed
+24 -18

No files matched your search

+11 -7
View File
@@ -53,7 +53,6 @@ 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 ----
@@ -611,14 +610,19 @@ 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)
case SYS_LOG_WRITE: {
if (!UserMemory::String(frame->arg1, kMaxUserspaceLogEntryBytes)) return -1;
if (!UserMemory::String(frame->arg1, kMaxUserspaceLogComponentNameBytes)
|| !UserMemory::String(frame->arg2, kMaxUserspaceLogEntryBytes)
) return -1;
auto* process = Sched::GetCurrentProcessPtr();
const char* username = process != nullptr && process->user[0] != '\0'
? process->user
: "unknown";
const char* imageName = process != nullptr && process->name[0] != '\0'
? process->name
: "unknown";
Kt::UserspaceLogStream((const char*)frame->arg1) << (const char*)frame->arg2;
Kt::UserspaceLogStream(imageName, username)
<< (const char*)frame->arg1;
return 0;
}