Commit Graph

269 Commits

Author SHA1 Message Date
vasilito 599627a926 relibc: ip_mreqn, sched_getcpu, variadic ioctl, sys/vfs.h, sched size_t
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.
2026-08-01 13:03:55 +03:00
vasilito 1a6d3221b2 relibc: implement error()/error_at_line() as real symbols (not header inlines)
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.
2026-08-01 04:30:41 +03:00
vasilito a2f047712e link.h: add glibc-compatible ElfW(type) macro
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.
2026-07-31 17:33:38 +03:00
vasilito daeca3892e Add byteswap/error/libintl/ar/search headers + tsearch family, mempcpy, rawmemchr
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.
2026-07-31 15:03:51 +03:00
vasilito 991d05ce2f ld_so: implement dl_iterate_phdr (link.h)
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.
2026-07-31 09:55:43 +03:00
Red Bear OS ca7a7edbfb relibc: add sys/ioccom.h with Linux IOC bitfield constants
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.
2026-07-27 20:18:01 +09:00
vasilito d8ced461fa Add __fseterr and __freadahead to stdio ext (P3-stdio-fseterr patch) 2026-07-12 16:05:57 +03:00
Jeremy Soller 85625f86dd Define _GNU_SOURCE or _BSD_SOURCE the way musl does 2026-07-06 17:19:03 -06:00
auronandace 3be84f4b26 move stddef header from C to cbindgen 2026-06-24 11:52:15 +01:00
auronandace 7315ad5155 split out uint32_t for socklen_t for sys_socket header 2026-06-17 09:18:37 +01:00
auronandace f2310befc3 split out intptr_t from stdint.h for sys/shm.h 2026-06-16 20:00:20 +01:00
auronandace 47b5f56d0b move stdarg header from C to cbindgen and create valist bits header 2026-06-16 11:35:40 +01:00
Connor-GH 6da03f457c tests/stdlib/ptsname: fix test for Linux due to pty changes 2026-06-04 08:17:17 -05:00
auronandace d28a131ec5 split out wchar_t from stddef header 2026-06-04 11:17:36 +01:00
auronandace 4f5d535ebc split out NULL from stddef header 2026-06-02 16:56:12 +01:00
auronandace 5795eac276 change wchar_t type to int 2026-06-02 12:13:17 +01:00
auronandace a7b7e8dd27 move sysexits header from C to Rust 2026-05-19 15:20:49 +01:00
Wildan M f731a20e02 Move sigsetjmp and siglongjmp to setjmp.h 2026-05-18 19:03:11 +07:00
auronandace 3d16b8a1b8 move wchar_t to stddef header 2026-05-12 11:09:23 +01:00
auronandace dc28f2faef split out sizt_t from stddef header 2026-05-08 14:59:27 +01:00
Wildan M 043ec22076 FIx sigjmp_buf and add tests 2026-05-02 16:59:48 +07:00
auronandace 798d929254 remove unused C header 2026-04-29 08:09:37 +01:00
auronandace e7f311c2c4 move internal types from C to rust 2026-04-23 11:18:14 +01:00
auronandace f7ab0e579f move inttypes bits to cbindgen 2026-04-22 08:08:24 +01:00
auronandace abd64422c8 move float bits from C to cbindgen 2026-04-20 08:34:51 +01:00
Wildan M f59dfab490 Move sig_atomic_t from stdint 2026-04-18 02:31:35 +07:00
Wildan M 9ef2789287 Fix linux suseconds_t to fix alarm test 2026-04-16 00:11:44 +07:00
auronandace 1a6659ada1 move cpio header from C to Rust 2026-04-14 10:21:26 +01:00
Jeremy Soller 539d04009a Merge branch 'syssocket-bits' into 'master'
move sys_socket bits from C to cbindgen

See merge request redox-os/relibc!1185
2026-04-13 06:47:59 -06:00
auronandace e8429cdc5e move sys_socket bits from C to cbindgen 2026-04-13 10:18:40 +01:00
auronandace 1eed88923a verify signal header includes 2026-04-13 08:52:53 +01:00
auronandace 17ff347332 move assert bits from C to cbindgen 2026-04-12 08:37:54 +01:00
auronandace 121ee8edb0 remove ucred from sys_socket bits 2026-04-09 09:59:24 +01:00
Jeremy Soller 19b0b44eb9 Merge branch 'elf-bits' into 'master'
move elf bits to cbindgen

See merge request redox-os/relibc!1157
2026-04-03 07:01:10 -06:00
auronandace 700cf642e5 move elf bits to cbindgen 2026-04-03 09:15:08 +01:00
auronandace a0dd75a011 move unistd bits to cbindgen 2026-04-03 08:58:37 +01:00
Jeremy Soller 0630fa12f2 Merge branch 'stdio-bits' into 'master'
move stdio bits to cbindgen

See merge request redox-os/relibc!1145
2026-04-01 08:40:50 -06:00
auronandace 1764004b80 move stdio bits to cbindgen 2026-03-31 08:53:10 +01:00
auronandace afd9cad0c3 move stdlib bits to cbindgen 2026-03-31 08:31:26 +01:00
auronandace 3b69b617a2 move wchar bits to cbindgen 2026-03-29 15:49:01 +01:00
Jeremy Soller 18e47cdf5a Merge branch 'malloc-bits' into 'master'
move malloc bits to cbindgen

See merge request redox-os/relibc!1138
2026-03-29 07:10:14 -06:00
Jeremy Soller 078bfe81f1 Merge branch 'dirent-bits' into 'master'
move dirent bits to cbindgen

See merge request redox-os/relibc!1137
2026-03-29 07:09:58 -06:00
auronandace d84c8bf8f3 move malloc bits to cbindgen 2026-03-29 08:40:37 +01:00
auronandace 42d555b043 move dirent bits to cbindgen 2026-03-29 08:10:13 +01:00
auronandace 80db4127fd move errno bits from C to cbindgen 2026-03-29 07:44:55 +01:00
auronandace 306cd8b68f move netdb bits to cbindgen 2026-03-28 17:44:18 +00:00
auronandace 254e81ef74 move sys_wait bits from C to cbindgen 2026-03-28 15:12:54 +00:00
auronandace dbc6507c79 move sys_time bits from C to cbindgen 2026-03-28 14:57:11 +00:00
auronandace 516729bd83 move netinet_in bits to cbindgen 2026-03-28 08:15:24 +00:00
auronandace 71560ce9ca move ctype bits from C to cbindgen 2026-03-27 08:07:18 +00:00