summaryrefslogtreecommitdiffstats
path: root/rsnix/src/klog.rs
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-08-01 18:03:20 +0200
committersalmonik <salmonik@tuta.io>2026-08-01 18:03:20 +0200
commitc2b6daeaaf1da5c6f81300e954f2b3592c0668c0 (patch)
tree62411383ea6a2d69ecf2b0fdf3e18155e660796d /rsnix/src/klog.rs
parentrsnix: preemptive kernel tasks (ADR 0003) — sched, IST fault stacks, 176-by... (diff)
downloadrs-dos-c2b6daeaaf1da5c6f81300e954f2b3592c0668c0.tar.gz
rs-dos-c2b6daeaaf1da5c6f81300e954f2b3592c0668c0.zip
klog/tty/pager: no more truncated lines — full lines flow, terminal wraps
- klog: MAX_LINE 128 -> 512 (lens widened u8 -> u16) — long serial_println lines (panics, boot messages) are no longer cut at 128 bytes; they print in full and the terminal wraps them at the screen edge - tty: LINE_BUF_SIZE 256 -> 1024 — typed command lines longer than 256 chars were silently dropped at the buffer limit; now they echo and submit in full (the terminal already wraps the echo mid-typing) - pager (-p): screenfuls now count wrapped rows, not lines — a line wider than the terminal occupies ceil(len/cols) rows, so the pause lands at a real screen boundary instead of overflowing it
Diffstat (limited to 'rsnix/src/klog.rs')
-rw-r--r--rsnix/src/klog.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/rsnix/src/klog.rs b/rsnix/src/klog.rs
index 5da5094..2e1fc82 100644
--- a/rsnix/src/klog.rs
+++ b/rsnix/src/klog.rs
@@ -21,7 +21,11 @@ extern crate alloc;
21use alloc::string::String; 21use alloc::string::String;
22 22
23pub const MAX_LINES: usize = 128; 23pub const MAX_LINES: usize = 128;
24pub const MAX_LINE: usize = 128; 24/// Max bytes stored per line. Wide enough that no real line truncates
25/// at any plausible terminal width (a 240-col 4K framebuffer row is
26/// still under this) — long lines flow in full and the terminal wraps
27/// them at the screen edge instead of cutting them off.
28pub const MAX_LINE: usize = 512;
25 29
26struct Ring { 30struct Ring {
27 /// Sequence counter for the next line to be appended (total ever). 31 /// Sequence counter for the next line to be appended (total ever).
@@ -36,7 +40,7 @@ struct Ring {
36 /// the timer is running (early-boot PIT reads are uninitialised). 40 /// the timer is running (early-boot PIT reads are uninitialised).
37 last_ms: u64, 41 last_ms: u64,
38 ms: [u64; MAX_LINES], 42 ms: [u64; MAX_LINES],
39 lens: [u8; MAX_LINES], 43 lens: [u16; MAX_LINES],
40 bytes: [[u8; MAX_LINE]; MAX_LINES], 44 bytes: [[u8; MAX_LINE]; MAX_LINES],
41} 45}
42 46
@@ -74,7 +78,7 @@ pub fn append(line: &str, mut ms: u64) {
74 } 78 }
75 r.ms[r.next] = ms; 79 r.ms[r.next] = ms;
76 r.bytes[r.next][..n].copy_from_slice(&b[..n]); 80 r.bytes[r.next][..n].copy_from_slice(&b[..n]);
77 r.lens[r.next] = n as u8; 81 r.lens[r.next] = n as u16;
78 r.next = (r.next + 1) % MAX_LINES; 82 r.next = (r.next + 1) % MAX_LINES;
79 r.seq += 1; 83 r.seq += 1;
80} 84}