Implement real, Redox-backed versions of the libc facilities PipeWire's
portable code relies on, rather than disabling its modules:
- gettid(): export the real per-thread id (Sys::gettid).
- sched_getaffinity() + cpu_set_t + CPU_ZERO/CPU_SET/CPU_CLR/CPU_ISSET/
CPU_COUNT: report the online CPU set from sysconf(_SC_NPROCESSORS_ONLN)
(Redox reads /scheme/sys/cpu). Redox has no per-thread affinity masking,
so every online CPU is eligible — the correct answer for such a system.
- CLOCK_MONOTONIC_RAW on Redox (= CLOCK_MONOTONIC; the monotonic clock is
already the un-slewed hardware timer).
- sys/statfs.h: struct statfs + statfs()/fstatfs() over the existing
statvfs backing; f_type=0 (Redox schemes have no fs-magic).
- net/if.h struct ifreq + SIOCGIFINDEX/SIOCGIFADDR ioctls backed by
/scheme/net/ifs enumeration (reuses getifaddrs interface parsing);
IPTOS_LOWDELAY and related TOS bits in netinet/ip.h.
cargo check clean for x86_64-unknown-redox.
The header-only static-inline error()/error_at_line() collided with gnulib's own
lib/error.c ('redefinition of error', building m4): autotools link-detects a
system error(), skips its replacement, then the inline in <error.h> clashes with
gnulib's definition. Implement them properly in relibc (src/header/error) with
the glibc globals (error_message_count, error_one_per_line, error_print_progname)
and make <error.h> a pure extern declaration. Fixes m4/gnulib and keeps
mesa/libelf (the original <error.h> consumers) working via the real symbol.
Portable ELF tooling (elfutils/libelf, needed by Mesa's radeonsi driver) relies
on several standard headers and functions Red Bear's relibc lacked:
- <byteswap.h>: bswap_16/32/64 (compiler builtins).
- <error.h>: GNU error()/error_at_line() (inline).
- <libintl.h>: gettext family as the identity map (catalog-less system; matches
glibc's no-catalog fallback behaviour).
- <ar.h>: Unix archive struct/magic (header-only).
- <search.h> + src/header/search: POSIX tsearch/tfind/tdelete/twalk + GNU
tdestroy, implemented as an unbalanced BST (conforming; POSIX mandates no
balancing).
- string: mempcpy (memcpy returning end) and rawmemchr (unbounded memchr).
All complete implementations, no stubs. Additive (no ABI break), so existing
sysroot binaries are unaffected.
Mesa's Intel Anvil Vulkan driver requires dl_iterate_phdr, which relibc lacked
(meson cc.has_function fails). Implement it against the dynamic linker's
authoritative object list: store each object's program headers on the DSO
(new DSO.phdrs, populated in both from_raw and new), add Linker::iter_dsos, and
add a src/header/link module exporting dl_iterate_phdr that walks the loaded
objects and reports each one's base/name/phdr-table to the callback (stopping
early on non-zero return, per spec). Static binaries (no linker) report zero
objects. Hand-written include/link.h declares struct dl_phdr_info with a
correctly-typed const Elf64_Phdr* dlpi_phdr.
The sys_timerfd module (timerfd_create/settime/gettime) existed on disk but was
never declared in header/mod.rs, so its code was NOT compiled and the symbols
were absent from libc — timerfd was entirely non-functional. The generated
header still declared the functions, so C programs compiled but failed to LINK
with 'undefined reference to timerfd_create/timerfd_settime' (e.g. libwayland's
event-loop.c, blocking the whole Wayland stack). Declare the module so the
implementation is built and the symbols exported.
Creates sys_eventfd header module providing eventfd(), eventfd_read(),
and eventfd_write(). Uses the kernel event scheme (/scheme/event) on
Redox, returning ENOSYS on Linux. Required for packages like Python
that link against eventfd.