Follow-ups so PipeWire's remaining modules compile against real relibc:
- struct ip_mreqn (netinet/in.h): index-based multicast join request, used
with IP_ADD_MEMBERSHIP + the SIOCGIFINDEX ifr_ifindex.
- sched_getcpu(): honest ENOSYS/-1 (Redox exposes no per-thread current-CPU
query) rather than a fabricated CPU number.
- ioctl() declared variadic (int, unsigned long, ...) as in POSIX/glibc, so
ioctl(fd, req, long) no longer trips -Werror=int-conversion; cbindgen's
fixed void* prototype is excluded in favor of this ABI-compatible one.
- sys/vfs.h: glibc-style thin wrapper re-exporting sys/statfs.h.
- sched.h: pull in stddef.h + usize_is_size_t so the sched_getaffinity
size_t parameter resolves.
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 code (Mesa util/build_id.c, unwinders) uses ElfW(Nhdr) etc. and
expects <link.h> to define ElfW -> Elf64_type (LP64) / Elf32_type. Without it
those TUs fall back to an undefined Elf_##type and fail to compile.
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.
Mesa 26.1.4's DRM UAPI headers include <sys/ioccom.h> as the BSD
include path for ioctl command encoding. The basic _IO / _IOR / _IOW /
_IOWR macros are already in <sys/ioctl.h> (musl-style via cbindgen),
but sys/ioccom.h adds the bitfield widths / masks / shifts / decoders
and the IOC_IN / IOC_OUT / IOC_INOUT / IOCSIZE_* macros that DRM and
other Linux UAPI consumers require.
This header includes <sys/ioctl.h> for the base macros and adds the
Linux-style constants as a thin shim. All new symbols are guarded
with #ifndef so including both headers is safe and idempotent.
This makes the Mesa-side 04-sys-ioccom-stub-header.patch redundant;
that patch can be removed from local/patches/mesa/ and the Mesa
recipe's patches list.