Files
RedBear-OS/local/patches/rust/02-libc-redox-fork.patch
T
vasilito 88b4d06ec2 libc: vendor a Redox-complete fork for waitid/CLD_*/P_*
local/sources/libc is libc 0.2.189 with src/unix/redox/mod.rs extended to
expose the waitid surface relibc already implements:

  - idtype_t (= c_int, as relibc defines it)
  - P_ALL / P_PID / P_PGID
  - CLD_EXITED / KILLED / DUMPED / TRAPPED / STOPPED / CONTINUED
  - extern fn waitid(idtype_t, id_t, *mut siginfo_t, c_int) -> c_int

All of it is real in relibc -- src/header/sys_wait/mod.rs defines the
types and constants, and `nm libc.a` shows `T waitid` -- but the libc
crate's Redox bindings never exposed any of it, and still do not as of
0.2.189. Any crate calling waitid therefore cannot build for
x86_64-unknown-redox:

  error[E0531]: cannot find unit struct, unit variant or constant
                `CLD_EXITED` in crate `libc`

which breaks nix, and through it ctrlc and rustc's bootstrap tooling --
the last thing blocking rust-native.

Values and types come from relibc, not from Linux. Every non-Redox target
is byte-for-byte upstream 0.2.189, so host builds are unaffected. Wired
into the rust workspace via [patch.crates-io]; the fork type-checks for
x86_64-unknown-redox.

Upstream-reportable: this gap belongs in the libc crate.
2026-08-03 18:02:32 +03:00

37 lines
1.8 KiB
Diff

Use the Red Bear libc fork for its Redox bindings.
The crates.io libc has an incomplete Redox surface. relibc implements
waitid() and defines idtype_t plus the P_* and CLD_* constants
(src/header/sys_wait/mod.rs; `nm libc.a` shows `T waitid`), but the libc
crate never exposed them for x86_64-unknown-redox -- still absent in
0.2.189. Anything using waitid therefore fails to build for Redox:
error[E0531]: cannot find unit struct, unit variant or constant
`CLD_EXITED` in crate `libc`
That breaks nix, and through it ctrlc and rustc's bootstrap tooling, which
is what blocked rust-native.
local/sources/libc is libc 0.2.189 with only src/unix/redox/mod.rs
extended; every other target is byte-for-byte upstream, so the host build
is unaffected. Values and types are taken from relibc rather than Linux.
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -97,4 +97,15 @@
form_urlencoded = { git = "https://github.com/Andy-Python-Programmer/rust-url/" }
percent-encoding = { git = "https://github.com/Andy-Python-Programmer/rust-url/" }
libz-sys = { git = "https://github.com/willnode/libz-sys", branch = "servo" }
+# Red Bear: the crates.io libc has an incomplete Redox binding surface. relibc
+# implements waitid() and defines idtype_t plus the P_* and CLD_* constants
+# (src/header/sys_wait/mod.rs, and `nm libc.a` shows `T waitid`), but the libc
+# crate never exposed them for x86_64-unknown-redox, so anything using waitid
+# fails to build for Redox:
+# error[E0531]: cannot find unit struct, unit variant or constant
+# `CLD_EXITED` in crate `libc`
+# That breaks nix, and through it ctrlc and rustc's bootstrap tooling. The fork
+# is libc 0.2.178 with only the Redox module extended -- every other target is
+# byte-for-byte upstream -- so this changes nothing for the host build.
+libc = { path = "../../../../local/sources/libc" }