| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
exec::spawn passes C-style argv with argv[0] = the command name, but
ls, cat, mkdir, touch and rm treated argv[0] as their first user
argument. Every path they were given resolved to the literal command
name ("ls", "mkdir", ...), so they failed silently: `mkdir .../sub`
never created the directory, `cat` printed nothing.
date formatted its last year digit as `y as u8 % 10`, which truncates
before the modulo (2026 -> 234 -> '4'), printing "2024".
Only visible now that the system image actually stages /bin — before,
/bin was empty and every command fell back to a built-in.
|
|
|
rsapi v2: 14 new ABI function pointers appended after v1 — fs_resolve,
fs_dir_next (iterator), fs_create, fs_remove, fs_read, fs_write,
fs_size, fs_close, rtc_now, mem_stats, pci_probe, pci_device,
klog_dump, kernel_version. New C-repr structs: DirEntry, RtcTime,
MemStats, PciDevice, KernelVersion. ABI_VERSION bumped to 2.
Shell-side: build_exports() constructs the full table at runtime per
invocation (replaces static const). 14 kernel-side wrapper functions
bridge rsapi types to rsnix kernel APIs; fs_dir_next maintains a
per-handle cache of children() results for iteration.
Tool binaries (10 crates, all linked against rsapi only):
- date: rtc_now → formatted YYYY-MM-DD HH:MM:SS
- mem: heap/pages free/total via mem_stats
- pci: pci_probe + pci_device enumerate all devices
- cat: fs_read paths or get_line stdin; put_line output
- ls: fs_resolve + fs_dir_next iteration; trailing / for dirs
- mkdir: fs_create(path, true)
- touch: fs_create(path, false)
- rm: fs_remove(path)
- klog: klog_dump 2048 bytes → put_line
- info: rtc_now + kernel_version (minimal; mem/pci deferred)
Gate verified: date prints RTC; pci lists all 4 QEMU devices
(8086:29c0, 1234:1111, 8086:10d3, 8086:2918); hello/boom/count
still work; test-disk PASS; poweroff clean.
|