Repository navigation
0.2.1: os over the program's own C library on every host - #7
Merged
Merged
Conversation
A C library on openkal (openkal-musl over openkal-<os>, on the system's own triple) presents POSIX and openkal rather than the system. The per-system units now reach the system without it: - Linux: the kernel's calls, one trap per architecture (src/linux/kernel.h, src/linux/arch/), for uname, sysinfo, statfs and renameat2. Under such a C library uname named openkal, sysinfo was absent and renameat2's RENAME_EXCHANGE was a plain rename. - macOS: the kernel's statfs64 and renameatx_np (src/macos/kernel.h), and the libSystem names no C library defines for sysctl and the host's statistics (src/macos/darwin.h), declared rather than included and allowed undefined (-U) where the link's libSystem is openkal-macos's stub. - Windows: DWORD as 32 bits and WCHAR as char16_t in win32.h under every C environment, names converted from UTF-8 (text.h); kernel32's names beyond the ones openkal-windows calls are found when first called. - The process's output diversion, SIGPIPE's reset before exec and the ending for a closed reader use the kernel's descriptors and dispositions on Linux and macOS (src/posix/kernel.h); on Windows the diversion is the C runtime's (crt/stdio.cpp) or, for a C library on openkal, that library's descriptor and the process's standard handle (posix/stdio.cpp), selected by c-abi. Co-authored-by: speak-agent <[email protected]>
…in CI on four systems Each test of the package is compiled in that arrangement by an include from checks/hosted/tests; CI checks that every test has its counterpart and runs the suite on Linux x86_64 (dev, release), Linux aarch64, macOS and Windows (dev, release). The tests assert that Linux names the machine as the processor and that a volume's kind is named, and make a file executable through os::fs::set_executable, which works over every C library. Co-authored-by: speak-agent <[email protected]>
Co-authored-by: speak-agent <[email protected]>
…program in this arrangement names it Co-authored-by: speak-agent <[email protected]>
…uns, threads, environment entries, a bounded read, canonical names mcppls removes its modules/os and modules/platform in 0.0.18 and calls mcpplibs.os directly; what it needed and os did not have is here: - process::run(options, bounds, input): a hard bound, a grace, a drain, and per-output limits; it says whether the program was ended at the bound, whether a descendant held an output open (and ends the unit), and which output it cut. - process::threads(id): each thread of a program with its processor time (Linux /proc; none elsewhere). - env::assignments(entries): `NAME=value` entries as spawn_options overrides. - fs::read(file, at_most): errc::too_large past the bound (new condition, after timed_out). - fs::canonical(name): links followed and, on Windows, short components replaced by their long names. Tests in process_test and fs_test; native and hosted (openkal-musl + openkal-llvm-runtime) pass on Linux x86_64, and the hosted package cross-builds for x86_64-windows-gnu and aarch64-macos. Co-authored-by: speak-agent <[email protected]>
Sunrisepeak
added a commit
to Sunrisepeak/mcpp-language-server
that referenced
this pull request
Oct 27, 2026
…ules/os and modules/platform removed mcppls kept a layer of its own over mcpplibs.os (modules/os: the system in mcppls's names; modules/platform: files, processes, the environment, directories, loopback sockets, the standard streams, tool runs). The layer is removed, as mcpp 2026.10.26.2 removed its modules/platform, and every member calls mcpplibs.os directly. What was generic moved into mcpplibs.os 0.2.1 (mcpplibs/os#7, branch os-0.2.1, depended on by git until it is in the index): - the bounded run (process::run with a hard bound, a grace, a drain and per-output limits; held-open outputs end the unit), formerly platform::run and its RunBounds/RunResult; - the threads of a program (process::threads), formerly platform::thread_cpu; - `NAME=value` entries as a started program's overrides (env::assignments); - a bounded read (fs::read(file, at_most), errc::too_large); - the canonical name of a file (fs::canonical: links followed, Windows short names replaced). What is mcppls's own stays, in two small places: - modules/base: its home and cache directories (home.cppm), its payload names (payload.cppm: linux-x64, darwin-arm64, ...), the channel the event loop reads (channel.cppm, formerly platform/task), and in path.cppm the spelling of what the file system answers (children, files_under, current_directory, canonical_path, file_stamp, make_executable, file_time_now -- the file clock's own reading of now, which a sweep's bound must use) and last_lines in text; - modules/toolrun (new member, formerly platform/toolenv and platform/toolrun): the login shell's environment, offline and recorded runs, the rule that a program is never found through a relative PATH entry (find_program), the PRoot check (sandbox), and exit_code for a report. Process identity for leases, CPU time for StuckWatch, the client watch and the daemon's loopback sessions now ask mcpplibs.os (process::self/describe, net::loopback_listener, ipc::connection; a connection other threads use is shut down, not closed, as before). The LSP connection holds an os::process::process. Tests: test_process, test_fs, test_net, test_os, test_sandbox, test_gateway and the call sites of every other test are on mcpplibs.os; the lease takeover of a zombie is asserted through lease_owner_gone. Locally on Linux x86_64: `mcpp test --workspace` passes; the server builds for x86_64-windows-gnu, aarch64-macos and x86_64-openkal; mcpp-split, mcpp-emit-hang, mcpp-watch, build-program-manual, mcpp-emit-broken, clangd-crash-closure, cache-budget, diagnostic-bundle, reset-cache, xmake-basic, mcpp-target-race, self-mcpp and typing-pause pass (inferred-discover expects a machine without a compiler); `mcppls-devtools check all` passes, its layers rule now saying that the operating system is mcpplibs.os's and openkal is imported from nowhere. Traceability evidence for S2-6-3, S2-6-5, S2-6-6, S2-6-7 points at modules/toolrun, and S5-6.1-1's at the daemon's own `os::net::loopback_listener::listen(0)`. Co-authored-by: speak-agent <[email protected]>
…om their platform (mcpp SPEC-013); CI locates the runner through the target's configuration Co-authored-by: speak-agent <[email protected]>
…e toolchain, the C library and the C++ run-time (no layer named here) Co-authored-by: speak-agent <[email protected]>
…ages and checks/hosted stand on Co-authored-by: speak-agent <[email protected]>
Sunrisepeak
added a commit
to mcpplibs/mcpp-index
that referenced
this pull request
Oct 28, 2026
…t; mcpp.plugins latest is 0.20.0 (#617) - **mcpplibs.os 0.2.1** (mcpplibs/os#7): builds and passes its tests over the system's own C library and over openkal-musl with openkal-llvm-runtime on the system's own triple; an ok image's C library, C++ run-time and loader are its platform's (openkal-platform), so the package declares none of them. GLOBAL is the GitHub tag archive, CN the GitCode `mcpp-res/os` mirror (same sha256). Member `tests/examples/os` moves to 0.2.1. - CI and the openkal measurement run the released mcpp 2026.10.27.1 (the `MCPP_SOURCE_REF` variable that pointed them at its release branch is removed); `mcpp.plugins` names 0.20.0 as latest. Co-authored-by: speak-agent <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
mcpplibs.os 0.2.1 builds and passes its tests in both arrangements of the program's C library, on Linux, macOS and Windows:
posix) with openkal-llvm-runtime. This is mcpp docs/24, the arrangement mcpp-language-server uses, and design 2026-10-28 §5.4 makes it a first-class platform choice.Why
mcpp-language-server#72 failed to build os 0.2.0 in the second arrangement. That C library presents POSIX and openkal rather than the system, and five consequences followed:
sys/sysctl.h,mach/mach.h).wchar_t32 bits, sounsigned longis not a DWORD,wchar_tis not a WCHAR, andpath::c_str()ischar.unamenames openkal and itssysinfois absent.syscall(SYS_renameat2, …, RENAME_EXCHANGE)became a plain rename that replaced the second entry, an openkal-musl port issue reported separately.dup2andsignaldid not change the process's standard output or SIGPIPE's disposition.How
src/linux/kernel.h,src/linux/arch/).statfs64andrenameatx_np(src/macos/kernel.h), which openkal-macos issues itself;sysctlbyname,mach_host_self,host_page_size,host_statistics64), declared insrc/macos/darwin.hand linked with-U. Where the link's libSystem is openkal-macos' stub, they bind at load from libSystem (lib_ordinal -2, measured).win32.hdeclares DWORD as 32 bits and WCHAR aschar16_t;text.h);late::).execandend_as_output_closeduse the kernel's descriptors and dispositions (src/posix/kernel.h).crt/stdio.cpp). For a C library on openkal it moves that library's descriptor and the process's standard handle (posix/stdio.cpp), selected bycfg(c-abi = "musl").checks/hosted: compiles every test of the package in the second arrangement. CI runs it on Linux x86_64 (dev, release), Linux aarch64, macOS and Windows (dev, release), and checks that every test has a counterpart.Verified locally
x86_64-openkalimagesx86_64-windows-gnu, native and hosted, cross-linked and run under winemainaarch64-macoshosted, cross-linkedLater in this PR
This PR will also receive the platform migration once mcpp's platform release exists (design 2026-10-28 §11.5): removal of the
[target.'cfg(os = "openkal")']runtime and tool declarations, and the CI image job onmcpp toolchain install --targetandself env --target.Co-authored-by: speak-agent [email protected]