fix(console): route background daemon startup logs to dmesg to keep interactive terminal pristine

This commit is contained in:
RarDog
2026-09-02 21:31:12 +03:00
parent 053be85ff7
commit 1ef1fe8a60
2 changed files with 13 additions and 2 deletions
+10 -1
View File
@@ -240,7 +240,16 @@ pub extern "C" fn kernel_syscall_dispatcher(regs: &mut SyscallRegisters) {
if !msg_ptr.is_null() && len > 0 && len < 4096 {
let slice = unsafe { core::slice::from_raw_parts(msg_ptr, len) };
if let Ok(s) = core::str::from_utf8(slice) {
SerialPort.write_str(s);
let is_daemon = unsafe {
let sched = &*core::ptr::addr_of!(SCHEDULER);
let name = sched.threads[sched.current_tid].name;
name.starts_with("gui") || name.starts_with("proc") || name.starts_with("init")
};
if is_daemon {
crate::drivers::dmesg::append_log(slice);
} else {
SerialPort.write_str(s);
}
regs.rax = 0;
return;
}
+3 -1
View File
@@ -603,10 +603,12 @@ static void handle_command(char *cmd) {
}
extern "C" void _start() {
for (int i = 0; i < 6; i++) {
// Yield until initial boot modules finish their startup messages
for (int i = 0; i < 15; i++) {
sys_yield();
}
// Clean screen after all boot logs are finished
sys_log_debug("\033[2J\033[H", 7);
print_fastfetch();