roadmap

What the review read and ran

An appendix to the milestone.

The crate

partsfoundry/program_argument_contract at b097970b8650ca8a370018f18ce533c1f22db3e4, version 0.1.0 with publish = false. Read: Cargo.toml, README.md, CHANGELOG.md, docs/stranger-test.md, .github/mutants-exempts, .github/coverage-exemptions and the whole of src/lib.rs, which holds the library, three Kani harnesses and fourteen unit tests. The census of milestone 1129 (the combine review) counted the crate at this commit.

The public interface is six constants (PAGE_BYTES, HEADER_BYTES, MAXIMUM_RECORDS_BYTES, MAGIC, VERSION and INTERFACE_ID), one function (record_bytes) and five types: PushRefused, WrongPageLength, PageBuilder, ArgumentPage and Iter.

The commands

Run with rustc 1.100.0 on a Linux x86_64 host, with the build directory outside the clone.

The scratch programs

One scratch crate depends on the clone by path, on argv at =0.1.14 and on crt0stack at =0.1.0. Each program below is one file in it.

The comparators read

Each of the five crates below came from crates.io as a .crate file at the version the prior-art table gives. Each was unpacked into its own empty directory, and the files named were read there.

Five more crates, measured at the same time as the prior-art table and not read:

crate version total 90 days reverse dependencies updated
auxv 0.3.3 83,406 1,993 0 2017-01-20
multiboot2 0.28.0 1,041,556 237,214 2 2026-09-04
clap_lex 1.1.2 1,103,581,987 273,096,242 37 2026-11-16
bstr 1.14.0 533,179,888 137,728,669 710 2026-11-18
xous 0.9.71 160,014 9,244 14 2026-10-07

Searches of crates.io by recent downloads for argv, auxv, crt0, initial stack, process arguments, processargs, execve, wasi args, cmdline and kernel command line found no crate that defines a page or a message of its own for a program's arguments.

The comparison

How the nearest four compare, read from each one's source:

axis program_argument_contract argv 0.1.14 kernel-elf-parser 0.3.4 crt0stack 0.1.0 WASI preview 1
sides writer and reader reader writer writer and reader reader calls, host answers
an argument is any bytes, length first bytes to the first zero a String, zero after a &str, zero after bytes, zero after
limit 4,080 bytes of records the system's none the caller's slice the host's
a line that does not fit push refuses one argument (P0-1) not applicable not applicable push refuses one argument an errno
the reader checks every record, before the first nothing not applicable UTF-8, one argument at a time not applicable
the reader's failure no arguments, no reason (P0-3) none not applicable the iterator ends early an errno
no_std, no allocation both needs std needs alloc both both
refusal type two, no Display none none one, no Display Errno, with Display
pointers inside the data none yes yes yes written by the host

The contract shape

What the crate holds of the shape the contract-layout decision of milestone 1129 asks about:

part here
identity INTERFACE_ID, a u64 of 18
version VERSION, a u32 of 2; a constant assertion ties it to the last byte of the magic
magic MAGIC, a [u8; 8], PROGARG2, the first eight bytes of the page
sizes PAGE_BYTES, HEADER_BYTES, MAXIMUM_RECORDS_BYTES and the function record_bytes
address none in the crate; the caller passes it to from_virtual_address as a u64
writer PageBuilder: new, push, remaining_bytes, finish
reader ArgumentPage: parse, from_virtual_address, len, is_empty, iter, EMPTY; and Iter
refusals the writer's PushRefused and WrongPageLength; the reader has none
on the page the magic, a count, a total, then records; no identity and no version field

The systems outside Rust

Linux is GPL; the review read it for its interface shape only.

The benchmark

A scratch crate depends on the clone by path, on argv at =0.1.14 and on crt0stack at =0.1.0, built with cargo build --release, rustc 1.100.0, on a Linux x86_64 host (an Intel Xeon Platinum 8160 at 2.10 GHz, 80 threads).

Each row runs a closure in a loop that starts at 64 repeats and doubles until one pass lasts 50 ms. Seven passes follow at that count, and the figure is the lowest pass divided by the count. std::hint::black_box wraps every input and every result.

The input is the benchmark program's own arguments, since argv can read no others. The program runs twice: as rg pattern src (3 arguments, 14 bytes) and as rg with 63 arguments of 8 bytes (64 arguments, 508 bytes). It copies its arguments once, builds this crate's page and a crt0stack stack from them outside the loops, and asserts that all three readers sum to the same byte count.

The results, in time per call:

operation 3 arguments 64 arguments
ArgumentPage::parse, returning len 7.1 ns 146.8 ns
parse, then iter and a sum of the lengths 24.8 ns 370.2 ns
iter and the sum, on a page parsed outside the loop 11.2 ns 204.1 ns
iter().last(), on a page parsed outside the loop 10.4 ns 223.0 ns
PageBuilder::new, push each argument, finish 33.6 ns 465.6 ns
argv: iter and a sum of the lengths 16.7 ns 358.7 ns
argv: iter().len() 3.5 ns 44.0 ns
crt0stack: Builder::new, push each argument, done three times 39.5 ns 420.5 ns
crt0stack: Reader::from_stack, done, a sum of the lengths 43.6 ns 1,019.6 ns

What each row includes:

What was not run