diff --git a/src/syscall/fs.rs b/src/syscall/fs.rs index eed7b76b99..b8aca7f4c4 100644 --- a/src/syscall/fs.rs +++ b/src/syscall/fs.rs @@ -857,6 +857,26 @@ pub fn sys_read(fd: FileHandle, buf: UserSliceWo, token: &mut CleanLockToken) -> Ok(bytes_read) } pub fn sys_write(fd: FileHandle, buf: UserSliceRo, token: &mut CleanLockToken) -> Result { + // Red Bear diagnostic (2026-07-15): procmgr (userspace process manager, + // scheme 18) has no serial-connected stdout, so its "PROCMGR ..." + // diagnostics written to fd 1 never reach the log. Mirror any userspace + // write whose payload begins with "PROCMGR" to the kernel log. This runs + // before fd validation, so it works even if procmgr's fd 1 is not a real + // sink. Cheap: only 7 bytes are peeked unless the marker matches. + if buf.len() >= 7 { + let mut marker = [0u8; 7]; + if buf.copy_common_bytes_to_slice(&mut marker).is_ok() && &marker == b"PROCMGR" { + let mut line = [0u8; 256]; + if let Ok(n) = buf.copy_common_bytes_to_slice(&mut line) { + error!( + "{}", + core::str::from_utf8(&line[..n]) + .unwrap_or("") + .trim_end_matches('\n') + ); + } + } + } let result = (|| { let (bytes_written, desc_arc, desc) = file_op_generic_ext(fd, token, |scheme, desc_arc, desc, token| {