Skip to content

One POSIX program on every row by what the row can do: capability facts, rows still missing, and a runner for the iOS simulator (measured with cmd, Sunrisepeak/cmd#1) #1005

Done

Description

@speak-agent

Context

Sunrisepeak/cmd#1 builds cmd.exe (a cmd.exe-compatible command interpreter written in C, POSIX interfaces only) for 29 targets with mcpp 2026.11.19.1 and openkal-platform 0.31.0, and CI runs its test script wherever a machine or an emulator exists. The next revision moves it to mcpp 2026.11.22.1 and openkal-platform ^0.31 (0.31.2) and grades each row by what it can do instead of listing per-target exceptions:

Level What the row offers What cmd does there
L0 a console and memory builtins, variables, IF, FOR, CALL :label
L1 L0 + files batch files, MD/COPY/DIR/DEL, redirection
L2 L1 + starting a program external commands, COMSPEC, exit statuses
+T a terminal line editing at the prompt

Measured today (the test script runs each part; L2 is left out where the row cannot start a program):

  • L2: Linux (gnu, musl; x86_64, aarch64, i686), macOS (aarch64, Intel; *-macos-musl incl. PureDarwin), Windows MinGW (x86_64, aarch64), FreeBSD, NetBSD, OpenBSD, Android x86_64, i686-svr4-musl, x86_64-hurd, x86_64-haiku.
  • L1: wasm32-emscripten (node: +T; the browser: an in-memory file system kept for the session), x86_64-uefi, i686-dos-musl, i586-dos-djgpp, x86_64-windows-musl, and *-openkal (a cmd-side fix of its own path, not an openkal fix, moves these to L2 under okrun 0.7.2).

The program's sources state no target: posix_spawn under _POSIX_SPAWN, the fallback from fork on ENOSYS, access(X_OK). What decides a row's level is the platform. The project therefore wants to read the level from mcpp rather than write it per row, and to add a row with one line once mcpp or the ecosystem serves it.

Requests

1. Capability facts per row (the main request)

Today a project learns whether a row can start a program, has files or has a terminal only by running there. CI then carries a hand-written list (process: false on six row groups in cmd#1), and the list goes stale when an implementation gains the capability.

Proposal: mcpp states per row the capabilities its platform claims. For openkal rows these come from the interfaces the implementation provides (openkal.process, openkal.fs, …); for built-in rows, from the system table. They would be available as:

  • a cfg predicate, e.g. cfg(has = "process"), so a manifest or a build program can condition on them; and
  • a machine-readable query (e.g. JSON for a target), so a test harness can choose which parts to run and which refusals to expect.

With this, when openkal-uefi or openkal-dos gains a program start, every project's tests pick it up without an edit.

2. A platform named once, as a series

cmd will state [target.'cfg(any(env = "musl", os = "openkal", os = "uefi"))'] platform = "openkal-platform@^0.31" (platforms spec §3.1, §3.2) in place of twelve per-row pins. The project also names mcpp.plugins 0.26.1 for its build program, and one build holds one version of it. Could the platform's series guarantee its pairing with mcpp.plugins (or let the project leave the plugins version to the platform)? Then a patch release of the platform reaches projects without a manifest edit and without a conflict.

3. Rows the program is ready for

Each would be one line in cmd's CI once served:

Row State in 2026.11.22.1 Expected level
riscv64-linux-musl planned, no platform L2
i686-linux-gnu planned L2
x86_64-macos (not musl) planned L2 (an Intel runner exists)
wasm32-wasi no row L1 with real files (wasmtime preopens); better suited to a command-line program than emscripten
an openkal row over firmware or bare metal, e.g. RISC-V SBI (openkal-opensbi exists) no row L0

4. A runner for the iOS simulator rows

aarch64-ios-sim and x86_64-ios-sim are verified rows but mcpp run has no runner for them. A platform runner over xcrun simctl spawn (booting a simulator device, passing the run's files and working directory) would let a project run its tests there with no project-side runner. cmd would add the two rows at L1 or above (a-Shell is a precedent for a command interpreter on iOS); aarch64-ios would build only.

5. Bare metal: L0 through openkal, not through picolibc

The *-none-elf and thumbv* rows link picolibc, which has no directory, process or terminal interfaces (opendir, fork, tcgetattr). A POSIX program would need target-specific stubs there. openkal-musl answers the missing interfaces truthfully with ENOSYS (openkal spec 3.1), so an openkal row over firmware is the route by which such a program reaches bare metal unchanged. Memory sets the floor: cmd's static program is about 1.3 MB, so Cortex-A / RISC-V64 / AArch64 machines (QEMU virt) are in reach and Cortex-M microcontrollers are not. This is a note on direction for item 3's last row, not a request to change the picolibc rows.

6. Implementation-side gaps (for the openkal repositories; listed here for one place)

  • A4: a synchronous program start in openkal-uefi (LoadImage/StartImage) and openkal-dos (DOS EXEC). With item 1, x86_64-uefi and i686-dos-musl would move from L1 to L2 in every project's tests by themselves.
  • A3: the environment holds at most 512 entries (kMaxEntries in openkal-linux and openkal-macos, kMaxVars in openkal-windows); a process inheriting a larger environment loses the rest. Cross-reference: mcpp#958.
  • A5 (low priority): whether the C library can answer getauxval(AT_EXECFN) truthfully. Not needed by cmd any more: it now prefers argv[0] when it names a path, as a loader started explicitly (okrun, or the system's ld.so) is what /proc/self/exe names.

Not requests

  • The x86_64-windows-musl row stays L1 by its nature: as a POSIX build it hands a started program its own name with / for \, and Windows' cmd.exe reads that as switches (measured). On Windows the MinGW rows run the whole script (the next revision adds the MSVC rows).
  • i586-dos-djgpp stays L1: DJGPP offers spawn*, not fork or posix_spawn, and cmd keeps to POSIX.

Supersedes the open part of mcpp#972 (closed).

Activity

  1. speak-agent commented on Nov 24, 2026

    @speak-agent
    MemberAuthor

    Fixed in mcpp 2026.11.23.1 (#1006). The kernel interface is the kernel-abi layer's statement. A row states its interfaces as data, and platform keys hold on every row. The runners and the missing rows from this issue are added as rows and as statements in the platform packages: openkal-linux 0.27.2, openkal-musl 0.30.3, openkal-platform 0.32.1 (the default).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions