The payoff milestone: files are served by a user-space process, reached over
IPC — the kernel never sees a path or an fd.
- lib/vfs_proto.zig: the VFS wire protocol (Op, Request/Reply fixed header +
inline payload, Stat), shared by client and server; one message <= MSG_MAX.
- lib/ipc.zig: replyWait() — the server-side dual-return stub (length in rax,
badge in rdx via a "+{rdx}" read-write operand), deferred from M7.
- sbin/vfs.zig: the real VFS server — an in-heap ramfs (open creates a node)
with an IPC_ReplyWait dispatch loop serving open/read/write/stat/close.
Registers its endpoint under the well-known vfs id at startup.
- lib/unistd.zig: POSIX-style client API in rt — a per-process fd table +
open/close/read/write/lseek/stat, each an IPC_Call to the VFS. The kernel
knows nothing of fds; the table lives here.
- lib/stdio.zig: C stdio over unistd — FILE + fopen/fclose/fread/fwrite/
fseek/ftell/rewind/feof/ferror/fputs/fputc/fgetc (unbuffered for now).
- sbin/vfstest.zig: a client that opens/writes/seeks/reads a file and only
heartbeats "vfstest: ok" if the round trip matched. Packed in the initrd.
- New `vfs` test drives it end to end. initrd test relaxed to generic
liveness. Suite 31/31.
29 lines
1.3 KiB
Zig
29 lines
1.3 KiB
Zig
//! danos user-space runtime library — a nascent libc. Every user binary (init,
|
|
//! and later the VFS server + device drivers) imports this as `@import("rt")`:
|
|
//! syscall wrappers, the C-convention heap, IPC helpers, and the process start
|
|
//! shim. It is compiled into each binary (inheriting its `.large` code model and
|
|
//! freestanding target), so all user programs share one implementation.
|
|
//!
|
|
//! A user binary needs three lines:
|
|
//! const rt = @import("rt");
|
|
//! pub const panic = rt.panic;
|
|
//! comptime { _ = &rt.start._start; } // pull the entry shim in
|
|
//! and a `pub fn main() void`.
|
|
|
|
pub const sys = @import("sys.zig");
|
|
pub const heap = @import("heap.zig");
|
|
pub const ipc = @import("ipc.zig");
|
|
pub const start = @import("start.zig");
|
|
/// The VFS wire protocol (shared with the VFS server).
|
|
pub const vfsproto = @import("vfs_proto.zig");
|
|
/// POSIX-style file API: open/read/write/lseek/stat/close.
|
|
pub const unistd = @import("unistd.zig");
|
|
/// C stdio: fopen/fread/fwrite/fseek/ftell/fclose over unistd.
|
|
pub const stdio = @import("stdio.zig");
|
|
|
|
/// Re-exported so a user binary can `pub const panic = rt.panic;`.
|
|
pub const panic = start.panic;
|
|
|
|
/// The heap as a `std.mem.Allocator`, for Zig `std` containers in user code.
|
|
pub const allocator = heap.allocator;
|