Pass arguments to main via runtime.process.Init, dispatched on signature

This commit is contained in:
Daniel Samson
2026-07-11 14:22:48 +01:00
parent d218d93f79
commit 75ccfff171
6 changed files with 112 additions and 39 deletions
+4 -5
View File
@@ -8,7 +8,8 @@
//! const runtime = @import("runtime");
//! pub const panic = runtime.panic;
//! comptime { _ = &runtime.start._start; } // pull the entry shim in
//! and a `pub fn main() void`.
//! and a `pub fn main() void` or `pub fn main(init: runtime.process.Init) void`
//! (arguments arrive via `init`).
pub const system = @import("system.zig");
pub const heap = @import("heap.zig");
@@ -26,10 +27,8 @@ pub const dma = @import("dma.zig");
/// Re-exported so a user binary can `pub const panic = runtime.panic;`.
pub const panic = start.panic;
/// Process arguments (argc/argv, parsed from the kernel-built entry stack):
/// `argument(0)` is the path or name this binary was spawned as.
pub const argumentCount = start.argumentCount;
pub const argument = start.argument;
/// Process entry types: the `Init` handed to `main`, and its `Arguments`.
pub const process = @import("process.zig");
/// The heap as a `std.mem.Allocator`, for Zig `std` containers in user code.
pub const allocator = heap.allocator;