Expand description
Shims for places where cosmopolitan’s libc and Rust’s std disagree.
Link this into any cosmo target and the fixes apply themselves – each is a
#[no_mangle] definition that the linker prefers over the one in
libcosmo.a, because an archive member is only pulled in to satisfy a symbol
that is still undefined.
Modules§
- shim
- The libc-boundary wrappers. cosmo-ld links every program with
--wrap=NAMEfor each name in ../wrap.txt, so a call toopenfrom std (or from anything else in the link) lands in__wrap_openhere, which translates the Linux-numbered arguments to the host’s numbering, calls__cosmo_real_open(cosmo’s), and translates errno / results back. - xlate
- Constant translation between Linux numbering (what std was compiled with) and the running host’s numbering (what cosmopolitan resolved at load time).
Functions§
- __
xpg_ ⚠strerror_ r - POSIX XSI
strerror_r, which is what Rust’s std actually calls. - waitid⚠
waitid, which cosmopolitan does not provide but std’sProcess::waitreferences unconditionally (its pidfd path,P_PIDFD, is compiled in for every linux target). Linking is the requirement; the semantics only matter if the function is ever reached, and on cosmo std never creates a pidfd, so it is not. Implemented overwaitpidfor theP_PID/P_ALLshapes anyway:siginfo_t.si_statusreceives the raw wait status andsi_pidthe pid, at the Linux offsets std reads (si_pidat byte 16,si_statusat 24).