From 38a5d2018e7112b5ba21b49c464762a75354c1df Mon Sep 17 00:00:00 2001 From: Admin Pupkin Date: Fri, 29 May 2026 22:48:03 +0300 Subject: [PATCH] migrate: apply remaining patches to source forks, clean up Apply all active patches from archived patches to source forks: - kernel: 33 individual patches + consolidated mega-patch (34 total commits) - relibc: 33 individual patches (34 total commits) - base: 26 individual patches + redox.patch mega-patch (28 total commits) - bootloader: 4 patches (5 total commits) - installer: 1 patch (2 total commits) - redoxfs: 2 patches (3 total commits) - userutils: 2 patches (3 total commits) Cleanup: - Remove all .rej and .orig files from fork repos - Delete all absorbed/ subdirectories (71 already-folded patches) - Delete stale .patch files from recipe directories (~130 upstream port patches) - 282 remaining .patch files are for non-fork components (archived, not in build system) --- .../P0-daemon-init-notify-graceful.patch | 55 - .../P0-daemon-silence-init-notify.patch | 115 - .../P0-driver-api-migration-fixes.patch | 522 --- .../base/absorbed/P2-daemon-hardening.patch | 3720 ----------------- .../P3-uefi-live-image-safe-read.patch | 52 - .../absorbed/P4-live-large-iso-boot.patch | 215 - .../kernel/absorbed/P0-amd-acpi-x2apic.patch | 765 ---- .../absorbed/P2-redbear-os-branding.patch | 65 - .../absorbed/P4-supplementary-groups.patch | 137 - .../absorbed/P5-proc-setschedpolicy.patch | 152 - .../absorbed/P5-sched-policy-context.patch | 176 - .../kernel/absorbed/P5-scheme-sched-id.patch | 20 - .../kernel/absorbed/P6-vruntime-context.patch | 180 - .../absorbed/P7-cache-affine-context.patch | 196 - .../kernel/absorbed/P7-proc-setname.patch | 47 - .../kernel/absorbed/P7-proc-setpriority.patch | 70 - .../kernel/absorbed/P8-load-balance.patch | 146 - .../P0-strtold-cpp-linkage-and-compat.patch | 25 - .../relibc/absorbed/P3-aio.patch | 336 -- .../absorbed/P3-barrier-smp-futex.patch | 125 - .../relibc/absorbed/P3-clock-nanosleep.patch | 34 - .../P3-dns-aaaa-getaddrinfo-ipv6.patch | 396 -- .../absorbed/P3-dns-resolver-hardening.patch | 722 ---- .../relibc/absorbed/P3-dup3.patch | 25 - .../relibc/absorbed/P3-elf64-types.patch | 14 - .../relibc/absorbed/P3-eventfd-mod.patch | 23 - .../relibc/absorbed/P3-exec-root-bypass.patch | 38 - .../relibc/absorbed/P3-fenv.patch | 230 - .../relibc/absorbed/P3-getentropy.patch | 45 - .../absorbed/P3-getrlimit-getdtablesize.patch | 66 - .../P3-header-mod-spawn-threads.patch | 44 - .../relibc/absorbed/P3-ifaddrs-net_if.patch | 249 -- .../relibc/absorbed/P3-in6-pktinfo.patch | 62 - .../relibc/absorbed/P3-inet6-pton-ntop.patch | 292 -- .../relibc/absorbed/P3-named-semaphores.patch | 182 - .../absorbed/P3-netdb-lookup-retry-fix.patch | 91 - .../P3-pthread-nulstr-sched-stdint.patch | 359 -- .../absorbed/P3-pthread-signal-races.patch | 95 - .../relibc/absorbed/P3-pthread-yield.patch | 18 - .../relibc/absorbed/P3-sched.patch | 124 - .../relibc/absorbed/P3-secure-getenv.patch | 16 - .../P3-select-not-epoll-timeout.patch | 43 - .../relibc/absorbed/P3-semaphore-fixes.patch | 435 -- .../relibc/absorbed/P3-socket-cred.patch | 178 - .../relibc/absorbed/P3-socket-flags.patch | 26 - ...ll-0.7.4-procschemeattrs-ens-to-prio.patch | 13 - .../relibc/absorbed/P3-tcp-nodelay.patch | 53 - .../absorbed/P3-tcp-sockopt-forward.patch | 59 - .../absorbed/P3-timerfd-cbindgen-fix.patch | 35 - .../relibc/absorbed/P3-timerfd-relative.patch | 177 - .../relibc/absorbed/P3-timerfd.patch | 25 - .../absorbed/P3-tls-get-addr-panic-fix.patch | 34 - .../relibc/absorbed/P3-vfork.patch | 13 - .../relibc/absorbed/P3-waitid-header.patch | 9 - .../relibc/absorbed/P3-waitid.patch | 245 -- .../absorbed/P4-setgroups-getgroups.patch | 319 -- .../absorbed/P4-setgroups-unsafe-fix.patch | 196 - .../P5-fatal-handler-diagnostics.patch | 188 - .../absorbed/P5-pthread-sigmask-race.patch | 63 - .../P5-robust-mutex-enotrec-fix.patch | 64 - .../relibc/absorbed/P5-robust-mutexes.patch | 380 -- .../relibc/absorbed/P5-sched-api.patch | 130 - .../P5-signal-handler-panic-hardening.patch | 112 - .../P5-startup-init-panic-hardening.patch | 101 - .../relibc/absorbed/P7-pthread-affinity.patch | 231 - .../relibc/absorbed/P7-pthread-setname.patch | 326 -- .../relibc/absorbed/P7-setpriority.patch | 104 - .../relibc/absorbed/P9-pthread-open-fix.patch | 326 -- .../relibc/absorbed/P9-spin-and-barrier.patch | 43 - .../relibc/absorbed/P9-spin-fix.patch | 380 -- .../relibc/absorbed/redox.patch | 2954 ------------- local/sources/base | 2 +- local/sources/bootloader | 2 +- local/sources/installer | 2 +- local/sources/kernel | 2 +- local/sources/relibc | 2 +- recipes/archives/lz4/redox.patch | 34 - recipes/archives/zstd/01_redox.patch | 15 - .../redoxfs/P2-readonly-live-media-open.patch | 17 - recipes/core/uutils/redox.patch | 83 - recipes/dev/fontconfig/redox.patch | 33 - recipes/dev/git/git.patch | 240 -- recipes/dev/luajit/redox.patch | 31 - recipes/dev/patch/01_no_rlimit.patch | 35 - recipes/dev/patch/02_no_chown.patch | 19 - recipes/dev/patch/03_renameat2.patch | 15 - recipes/dev/php84/redox.patch | 91 - recipes/dev/python312/redox.patch | 152 - recipes/dev/rustpython/redox.patch | 22 - recipes/emulators/dosbox/01_redox.patch | 24 - recipes/emulators/mednafen/redox.patch | 13 - recipes/emulators/mgba/redox.patch | 12 - recipes/emulators/scummvm/redox.patch | 24 - recipes/games/eduke32/redox.patch | 158 - recipes/games/neverball/redox.patch | 87 - recipes/games/openttd/redox.patch | 116 - recipes/games/opentyrian/redox.patch | 60 - recipes/games/prboom/01_redox.patch | 16 - recipes/games/quakespasm/redox.patch | 110 - recipes/libs/cairo/redox.patch | 50 - recipes/libs/ffmpeg6/binutils-2.41.patch | 76 - recipes/libs/ffmpeg6/ffmpeg.patch | 24 - recipes/libs/gstreamer/redox.patch | 34 - recipes/libs/jansson/jansson.patch | 12 - recipes/libs/libarchive/redox.patch | 13 - recipes/libs/libiconv/01_redox.patch | 36 - .../0001-Fix-compilation-on-Redox-OS.patch | 25 - recipes/libs/libuv/redox.patch | 355 -- recipes/libs/ncurses/redox.patch | 20 - recipes/libs/pango/redox.patch | 14 - recipes/libs/pcre/redox.patch | 17 - recipes/libs/pixman/redox.patch | 12 - recipes/libs/sdl-gfx/redox.patch | 20 - recipes/libs/sdl1-image/redox.patch | 12 - recipes/libs/sdl1-mixer/redox.patch | 55 - recipes/libs/sdl1-ttf/redox.patch | 62 - recipes/libs/sdl2-mixer/redox.patch | 16 - recipes/net/nginx/redox.patch | 111 - recipes/net/openssh/redox.patch | 608 --- recipes/net/rsync/redox.patch | 25 - recipes/shells/bash/redox.patch | 236 -- recipes/shells/nushell/redox.patch | 707 ---- recipes/shells/zsh/redox.patch | 75 - recipes/tests/sysbench/redox.patch | 11 - recipes/tests/vttest/redox.patch | 80 - recipes/tools/gettext/redox.patch | 46 - recipes/tools/gnu-binutils/01_build_fix.patch | 24 - recipes/tools/gnu-grep/grep.patch | 68 - recipes/tools/libc-bench/redox.patch | 42 - recipes/tools/schismtracker/redox.patch | 24 - recipes/tools/sed/sed.patch | 11 - recipes/tools/vim/vim.patch | 66 - recipes/tui/goaccess/redox1.patch | 34 - recipes/tui/goaccess/redox2.patch | 60 - recipes/web/netsurf/01_redox.patch | 140 - recipes/wip/db/mariadb/redox.patch | 13 - recipes/wip/db/postgresql18/redox.patch | 40 - recipes/wip/dev/lang/nodejs-21/redox.patch | 621 --- recipes/wip/dev/lang/nodejs-24/01_redox.patch | 12 - recipes/wip/dev/lang/php80/redox.patch | 92 - recipes/wip/dev/lang/python37/redox.patch | 91 - recipes/wip/dev/lang/python39/redox.patch | 90 - recipes/wip/dev/other/apr-util/redox.patch | 41 - recipes/wip/dev/other/apr/redox.patch | 175 - recipes/wip/dev/python/ruff/redox.patch | 140 - recipes/wip/games/engines/love/redox.patch | 47 - recipes/wip/games/engines/luanti/redox.patch | 273 -- .../wip/games/fps/zerospades-free/redox.patch | 46 - .../wip/games/racing/supertuxkart/redox.patch | 15 - recipes/wip/games/syobonaction/01_redox.patch | 43 - .../wip/icons/adwaita-icon-theme/redox.patch | 29 - recipes/wip/libs/audio/openal/redox.patch | 59 - recipes/wip/libs/gnome/dconf/redox.patch | 12 - .../libs/gnome/glib-networking/redox.patch | 12 - recipes/wip/libs/gnome/gtk3/redox.patch | 92 - .../libayatana-appindicator-glib/redox.patch | 116 - recipes/wip/libs/gnome/libepoxy/redox.patch | 18 - recipes/wip/libs/gnome/vte/redox.patch | 63 - recipes/wip/libs/other/boost/redox.patch | 139 - recipes/wip/libs/other/gdbm/redox.patch | 77 - recipes/wip/libs/other/imlib2/redox.patch | 104 - recipes/wip/libs/other/libedit/redox.patch | 99 - recipes/wip/libs/other/libgcrypt/redox.patch | 20 - recipes/wip/libs/other/libicu/redox.patch | 12 - recipes/wip/libs/other/libuuid/redox.patch | 67 - .../wip/libs/other/tree-sitter/redox.patch | 45 - recipes/wip/libs/tls/openssl3/redox.patch | 56 - recipes/wip/libs/video/libgif/redox.patch | 12 - recipes/wip/net/http/apache-httpd/redox.patch | 436 -- recipes/wip/net/http/lighttpd/redox.patch | 12 - recipes/wip/net/http/miniserve/redox.patch | 34 - recipes/wip/shells/fish-shell/redox.patch | 144 - recipes/wip/terminal/tmux/redox.patch | 95 - recipes/wip/text/neovim/redox.patch | 155 - recipes/wip/vice/01_redox.patch | 107 - recipes/wip/wayland/wlroots/redox.patch | 29 - recipes/wip/wayland/xwayland/redox.patch | 158 - recipes/wip/web/firefox-esr/redox.patch | 295 -- recipes/wip/web/webkitgtk3/redox.patch | 613 --- recipes/wip/web/zola/redox.patch | 91 - recipes/wip/x11/drm-info/redox.patch | 12 - recipes/wip/x11/libxfont2/redox.patch | 25 - recipes/wip/x11/libxkbcommon-x11/redox.patch | 92 - recipes/wip/x11/mate/marco/redox.patch | 12 - .../x11/mate/mate-control-center/redox.patch | 76 - recipes/wip/x11/mesa-demos-x11/redox.patch | 12 - recipes/wip/x11/x11proto/redox.patch | 12 - .../x11/xfce4/libxfce4windowing/redox.patch | 41 - .../xserver-xorg-video-orbital/redox.patch | 301 -- recipes/wip/x11/xserver-xorg/redox.patch | 226 - recipes/wip/x11/xterm/redox.patch | 76 - 191 files changed, 5 insertions(+), 27964 deletions(-) delete mode 100644 local/archived/patches-2026-06-migration/base/absorbed/P0-daemon-init-notify-graceful.patch delete mode 100644 local/archived/patches-2026-06-migration/base/absorbed/P0-daemon-silence-init-notify.patch delete mode 100644 local/archived/patches-2026-06-migration/base/absorbed/P0-driver-api-migration-fixes.patch delete mode 100644 local/archived/patches-2026-06-migration/base/absorbed/P2-daemon-hardening.patch delete mode 100644 local/archived/patches-2026-06-migration/bootloader/absorbed/P3-uefi-live-image-safe-read.patch delete mode 100644 local/archived/patches-2026-06-migration/bootloader/absorbed/P4-live-large-iso-boot.patch delete mode 100644 local/archived/patches-2026-06-migration/kernel/absorbed/P0-amd-acpi-x2apic.patch delete mode 100644 local/archived/patches-2026-06-migration/kernel/absorbed/P2-redbear-os-branding.patch delete mode 100644 local/archived/patches-2026-06-migration/kernel/absorbed/P4-supplementary-groups.patch delete mode 100644 local/archived/patches-2026-06-migration/kernel/absorbed/P5-proc-setschedpolicy.patch delete mode 100644 local/archived/patches-2026-06-migration/kernel/absorbed/P5-sched-policy-context.patch delete mode 100644 local/archived/patches-2026-06-migration/kernel/absorbed/P5-scheme-sched-id.patch delete mode 100644 local/archived/patches-2026-06-migration/kernel/absorbed/P6-vruntime-context.patch delete mode 100644 local/archived/patches-2026-06-migration/kernel/absorbed/P7-cache-affine-context.patch delete mode 100644 local/archived/patches-2026-06-migration/kernel/absorbed/P7-proc-setname.patch delete mode 100644 local/archived/patches-2026-06-migration/kernel/absorbed/P7-proc-setpriority.patch delete mode 100644 local/archived/patches-2026-06-migration/kernel/absorbed/P8-load-balance.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P0-strtold-cpp-linkage-and-compat.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-aio.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-barrier-smp-futex.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-clock-nanosleep.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-dns-aaaa-getaddrinfo-ipv6.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-dns-resolver-hardening.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-dup3.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-elf64-types.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-eventfd-mod.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-exec-root-bypass.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-fenv.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-getentropy.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-getrlimit-getdtablesize.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-header-mod-spawn-threads.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-ifaddrs-net_if.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-in6-pktinfo.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-inet6-pton-ntop.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-named-semaphores.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-netdb-lookup-retry-fix.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-pthread-nulstr-sched-stdint.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-pthread-signal-races.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-pthread-yield.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-sched.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-secure-getenv.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-select-not-epoll-timeout.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-semaphore-fixes.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-socket-cred.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-socket-flags.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-syscall-0.7.4-procschemeattrs-ens-to-prio.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-tcp-nodelay.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-tcp-sockopt-forward.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-timerfd-cbindgen-fix.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-timerfd-relative.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-timerfd.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-tls-get-addr-panic-fix.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-vfork.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-waitid-header.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P3-waitid.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P4-setgroups-getgroups.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P4-setgroups-unsafe-fix.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P5-fatal-handler-diagnostics.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P5-pthread-sigmask-race.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P5-robust-mutex-enotrec-fix.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P5-robust-mutexes.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P5-sched-api.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P5-signal-handler-panic-hardening.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P5-startup-init-panic-hardening.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P7-pthread-affinity.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P7-pthread-setname.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P7-setpriority.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P9-pthread-open-fix.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P9-spin-and-barrier.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/P9-spin-fix.patch delete mode 100644 local/archived/patches-2026-06-migration/relibc/absorbed/redox.patch delete mode 100644 recipes/archives/lz4/redox.patch delete mode 100644 recipes/archives/zstd/01_redox.patch delete mode 100644 recipes/core/redoxfs/P2-readonly-live-media-open.patch delete mode 100644 recipes/core/uutils/redox.patch delete mode 100644 recipes/dev/fontconfig/redox.patch delete mode 100644 recipes/dev/git/git.patch delete mode 100644 recipes/dev/luajit/redox.patch delete mode 100644 recipes/dev/patch/01_no_rlimit.patch delete mode 100644 recipes/dev/patch/02_no_chown.patch delete mode 100644 recipes/dev/patch/03_renameat2.patch delete mode 100644 recipes/dev/php84/redox.patch delete mode 100644 recipes/dev/python312/redox.patch delete mode 100644 recipes/dev/rustpython/redox.patch delete mode 100644 recipes/emulators/dosbox/01_redox.patch delete mode 100644 recipes/emulators/mednafen/redox.patch delete mode 100644 recipes/emulators/mgba/redox.patch delete mode 100644 recipes/emulators/scummvm/redox.patch delete mode 100644 recipes/games/eduke32/redox.patch delete mode 100644 recipes/games/neverball/redox.patch delete mode 100644 recipes/games/openttd/redox.patch delete mode 100644 recipes/games/opentyrian/redox.patch delete mode 100644 recipes/games/prboom/01_redox.patch delete mode 100644 recipes/games/quakespasm/redox.patch delete mode 100644 recipes/libs/cairo/redox.patch delete mode 100644 recipes/libs/ffmpeg6/binutils-2.41.patch delete mode 100644 recipes/libs/ffmpeg6/ffmpeg.patch delete mode 100644 recipes/libs/gstreamer/redox.patch delete mode 100644 recipes/libs/jansson/jansson.patch delete mode 100644 recipes/libs/libarchive/redox.patch delete mode 100644 recipes/libs/libiconv/01_redox.patch delete mode 100644 recipes/libs/liburcu/0001-Fix-compilation-on-Redox-OS.patch delete mode 100644 recipes/libs/libuv/redox.patch delete mode 100644 recipes/libs/ncurses/redox.patch delete mode 100644 recipes/libs/pango/redox.patch delete mode 100644 recipes/libs/pcre/redox.patch delete mode 100644 recipes/libs/pixman/redox.patch delete mode 100644 recipes/libs/sdl-gfx/redox.patch delete mode 100644 recipes/libs/sdl1-image/redox.patch delete mode 100644 recipes/libs/sdl1-mixer/redox.patch delete mode 100644 recipes/libs/sdl1-ttf/redox.patch delete mode 100644 recipes/libs/sdl2-mixer/redox.patch delete mode 100644 recipes/net/nginx/redox.patch delete mode 100644 recipes/net/openssh/redox.patch delete mode 100644 recipes/net/rsync/redox.patch delete mode 100644 recipes/shells/bash/redox.patch delete mode 100644 recipes/shells/nushell/redox.patch delete mode 100644 recipes/shells/zsh/redox.patch delete mode 100644 recipes/tests/sysbench/redox.patch delete mode 100644 recipes/tests/vttest/redox.patch delete mode 100644 recipes/tools/gettext/redox.patch delete mode 100644 recipes/tools/gnu-binutils/01_build_fix.patch delete mode 100644 recipes/tools/gnu-grep/grep.patch delete mode 100644 recipes/tools/libc-bench/redox.patch delete mode 100644 recipes/tools/schismtracker/redox.patch delete mode 100644 recipes/tools/sed/sed.patch delete mode 100644 recipes/tools/vim/vim.patch delete mode 100644 recipes/tui/goaccess/redox1.patch delete mode 100644 recipes/tui/goaccess/redox2.patch delete mode 100644 recipes/web/netsurf/01_redox.patch delete mode 100644 recipes/wip/db/mariadb/redox.patch delete mode 100644 recipes/wip/db/postgresql18/redox.patch delete mode 100644 recipes/wip/dev/lang/nodejs-21/redox.patch delete mode 100644 recipes/wip/dev/lang/nodejs-24/01_redox.patch delete mode 100644 recipes/wip/dev/lang/php80/redox.patch delete mode 100644 recipes/wip/dev/lang/python37/redox.patch delete mode 100644 recipes/wip/dev/lang/python39/redox.patch delete mode 100644 recipes/wip/dev/other/apr-util/redox.patch delete mode 100644 recipes/wip/dev/other/apr/redox.patch delete mode 100644 recipes/wip/dev/python/ruff/redox.patch delete mode 100644 recipes/wip/games/engines/love/redox.patch delete mode 100644 recipes/wip/games/engines/luanti/redox.patch delete mode 100644 recipes/wip/games/fps/zerospades-free/redox.patch delete mode 100644 recipes/wip/games/racing/supertuxkart/redox.patch delete mode 100644 recipes/wip/games/syobonaction/01_redox.patch delete mode 100644 recipes/wip/icons/adwaita-icon-theme/redox.patch delete mode 100644 recipes/wip/libs/audio/openal/redox.patch delete mode 100644 recipes/wip/libs/gnome/dconf/redox.patch delete mode 100644 recipes/wip/libs/gnome/glib-networking/redox.patch delete mode 100644 recipes/wip/libs/gnome/gtk3/redox.patch delete mode 100644 recipes/wip/libs/gnome/libayatana-appindicator-glib/redox.patch delete mode 100644 recipes/wip/libs/gnome/libepoxy/redox.patch delete mode 100644 recipes/wip/libs/gnome/vte/redox.patch delete mode 100644 recipes/wip/libs/other/boost/redox.patch delete mode 100644 recipes/wip/libs/other/gdbm/redox.patch delete mode 100644 recipes/wip/libs/other/imlib2/redox.patch delete mode 100644 recipes/wip/libs/other/libedit/redox.patch delete mode 100644 recipes/wip/libs/other/libgcrypt/redox.patch delete mode 100644 recipes/wip/libs/other/libicu/redox.patch delete mode 100644 recipes/wip/libs/other/libuuid/redox.patch delete mode 100644 recipes/wip/libs/other/tree-sitter/redox.patch delete mode 100644 recipes/wip/libs/tls/openssl3/redox.patch delete mode 100644 recipes/wip/libs/video/libgif/redox.patch delete mode 100644 recipes/wip/net/http/apache-httpd/redox.patch delete mode 100644 recipes/wip/net/http/lighttpd/redox.patch delete mode 100644 recipes/wip/net/http/miniserve/redox.patch delete mode 100644 recipes/wip/shells/fish-shell/redox.patch delete mode 100644 recipes/wip/terminal/tmux/redox.patch delete mode 100644 recipes/wip/text/neovim/redox.patch delete mode 100644 recipes/wip/vice/01_redox.patch delete mode 100644 recipes/wip/wayland/wlroots/redox.patch delete mode 100644 recipes/wip/wayland/xwayland/redox.patch delete mode 100644 recipes/wip/web/firefox-esr/redox.patch delete mode 100644 recipes/wip/web/webkitgtk3/redox.patch delete mode 100644 recipes/wip/web/zola/redox.patch delete mode 100644 recipes/wip/x11/drm-info/redox.patch delete mode 100644 recipes/wip/x11/libxfont2/redox.patch delete mode 100644 recipes/wip/x11/libxkbcommon-x11/redox.patch delete mode 100644 recipes/wip/x11/mate/marco/redox.patch delete mode 100644 recipes/wip/x11/mate/mate-control-center/redox.patch delete mode 100644 recipes/wip/x11/mesa-demos-x11/redox.patch delete mode 100644 recipes/wip/x11/x11proto/redox.patch delete mode 100644 recipes/wip/x11/xfce4/libxfce4windowing/redox.patch delete mode 100644 recipes/wip/x11/xserver-xorg-video-orbital/redox.patch delete mode 100644 recipes/wip/x11/xserver-xorg/redox.patch delete mode 100644 recipes/wip/x11/xterm/redox.patch diff --git a/local/archived/patches-2026-06-migration/base/absorbed/P0-daemon-init-notify-graceful.patch b/local/archived/patches-2026-06-migration/base/absorbed/P0-daemon-init-notify-graceful.patch deleted file mode 100644 index ce1292f01b..0000000000 --- a/local/archived/patches-2026-06-migration/base/absorbed/P0-daemon-init-notify-graceful.patch +++ /dev/null @@ -1,55 +0,0 @@ -From: Red Bear OS -Date: 2026-04-28 -Subject: daemon: handle missing INIT_NOTIFY gracefully instead of panicking - -The Daemon::new() and Daemon::ready() functions in the daemon library -called unwrap() on the INIT_NOTIFY environment variable and the ready -pipe write, causing a hard panic when a daemon is started outside the -init system's notification pipe mechanism. - -Replace unwrap() with graceful error handling: -- get_fd() returns -1 if the env var is missing or invalid, logging - a warning via eprintln -- ready() logs a warning on write failure instead of panicking - -diff --git a/daemon/src/lib.rs b/daemon/src/lib.rs -index 9f507221..a0ba9d88 100644 ---- a/daemon/src/lib.rs -+++ b/daemon/src/lib.rs -@@ -11,12 +11,23 @@ use redox_scheme::Socket; - use redox_scheme::scheme::{SchemeAsync, SchemeSync}; - - unsafe fn get_fd(var: &str) -> RawFd { -- let fd: RawFd = std::env::var(var).unwrap().parse().unwrap(); -+ let fd: RawFd = match std::env::var(var) -+ .map_err(|e| eprintln!("daemon: env var {var} not set: {e}")) -+ .ok() -+ .and_then(|val| { -+ val.parse() -+ .map_err(|e| eprintln!("daemon: failed to parse {var} as fd: {e}")) -+ .ok() -+ }) { -+ Some(fd) => fd, -+ None => return -1, -+ }; - if unsafe { libc::fcntl(fd, libc::F_SETFD, libc::FD_CLOEXEC) } == -1 { -- panic!( -+ eprintln!( - "daemon: failed to set CLOEXEC flag for {var} fd: {}", - io::Error::last_os_error() - ); -+ return -1; - } - fd - } -@@ -50,7 +61,9 @@ impl Daemon { - - /// Notify the process that the daemon is ready to accept requests. - pub fn ready(mut self) { -- self.write_pipe.write_all(&[0]).unwrap(); -+ if let Err(err) = self.write_pipe.write_all(&[0]) { -+ eprintln!("daemon::ready write failed: {err}"); -+ } - } - - /// Executes `Command` as a child process. diff --git a/local/archived/patches-2026-06-migration/base/absorbed/P0-daemon-silence-init-notify.patch b/local/archived/patches-2026-06-migration/base/absorbed/P0-daemon-silence-init-notify.patch deleted file mode 100644 index 84e6e9c120..0000000000 --- a/local/archived/patches-2026-06-migration/base/absorbed/P0-daemon-silence-init-notify.patch +++ /dev/null @@ -1,115 +0,0 @@ -diff --git a/daemon/src/lib.rs b/daemon/src/lib.rs ---- a/daemon/src/lib.rs -+++ b/daemon/src/lib.rs -@@ -10,26 +10,35 @@ use libredox::Fd; - use redox_scheme::scheme::{SchemeAsync, SchemeSync}; - use redox_scheme::Socket; - --unsafe fn get_fd(var: &str) -> RawFd { -- let fd: RawFd = match std::env::var(var) -- .map_err(|e| eprintln!("daemon: env var {var} not set: {e}")) -- .ok() -- .and_then(|val| { -- val.parse() -- .map_err(|e| eprintln!("daemon: failed to parse {var} as fd: {e}")) -- .ok() -- }) { -- Some(fd) => fd, -- None => return -1, -+unsafe fn get_fd(var: &str) -> Option { -+ let value = match std::env::var(var) { -+ Ok(value) => value, -+ Err(_) => { -+ let exe = std::env::args() -+ .next() -+ .unwrap_or_else(|| "daemon".to_string()); -+ eprintln!("daemon: {var} not set for {exe}; readiness notification disabled"); -+ return None; -+ } -+ }; -+ let fd: RawFd = match value.parse() { -+ Ok(fd) => fd, -+ Err(err) => { -+ let exe = std::env::args() -+ .next() -+ .unwrap_or_else(|| "daemon".to_string()); -+ eprintln!("daemon: invalid {var} value {value:?} for {exe}: {err}; readiness notification disabled"); -+ return None; -+ } - }; - if unsafe { libc::fcntl(fd, libc::F_SETFD, libc::FD_CLOEXEC) } == -1 { - eprintln!( - "daemon: failed to set CLOEXEC flag for {var} fd: {}", - io::Error::last_os_error() - ); -- return -1; -+ return None; - } -- fd -+ Some(fd) - } - - unsafe fn pass_fd(cmd: &mut Command, env: &str, fd: OwnedFd) { -@@ -47,22 +56,20 @@ unsafe fn pass_fd(cmd: &mut Command, env: &str, fd: OwnedFd) { - /// A long running background process that handles requests. - #[must_use = "Daemon::ready must be called"] - pub struct Daemon { -- write_pipe: PipeWriter, -+ write_pipe: Option, - } - - impl Daemon { - /// Create a new daemon. - pub fn new(f: impl FnOnce(Daemon) -> !) -> ! { -- let write_pipe = unsafe { io::PipeWriter::from_raw_fd(get_fd("INIT_NOTIFY")) }; -+ let write_pipe = unsafe { get_fd("INIT_NOTIFY").map(io::PipeWriter::from_raw_fd) }; - - f(Daemon { write_pipe }) - } - - /// Notify the process that the daemon is ready to accept requests. - pub fn ready(mut self) { -- if let Err(err) = self.write_pipe.write_all(&[0]) { -- if err.kind() != io::ErrorKind::BrokenPipe { -- eprintln!("daemon::ready write failed: {err}"); -- } -+ if let Some(write_pipe) = self.write_pipe.as_mut() { -+ write_pipe.write_all(&[0]).unwrap(); - } - } - -@@ -87,24 +94,26 @@ impl Daemon { - /// A long running background process that handles requests using schemes. - #[must_use = "SchemeDaemon::ready must be called"] - pub struct SchemeDaemon { -- write_pipe: PipeWriter, -+ write_pipe: Option, - } - - impl SchemeDaemon { - /// Create a new daemon for use with schemes. - pub fn new(f: impl FnOnce(SchemeDaemon) -> !) -> ! { -- let write_pipe = unsafe { io::PipeWriter::from_raw_fd(get_fd("INIT_NOTIFY")) }; -+ let write_pipe = unsafe { get_fd("INIT_NOTIFY").map(io::PipeWriter::from_raw_fd) }; - - f(SchemeDaemon { write_pipe }) - } - - /// Notify the process that the scheme daemon is ready to accept requests. - pub fn ready_with_fd(self, cap_fd: Fd) -> syscall::Result<()> { -- syscall::call_wo( -- self.write_pipe.as_raw_fd() as usize, -- &cap_fd.into_raw().to_ne_bytes(), -- syscall::CallFlags::FD, -- &[], -- )?; -+ if let Some(write_pipe) = self.write_pipe { -+ syscall::call_wo( -+ write_pipe.as_raw_fd() as usize, -+ &cap_fd.into_raw().to_ne_bytes(), -+ syscall::CallFlags::FD, -+ &[], -+ )?; -+ } - Ok(()) - } diff --git a/local/archived/patches-2026-06-migration/base/absorbed/P0-driver-api-migration-fixes.patch b/local/archived/patches-2026-06-migration/base/absorbed/P0-driver-api-migration-fixes.patch deleted file mode 100644 index 6b22e9fdfd..0000000000 --- a/local/archived/patches-2026-06-migration/base/absorbed/P0-driver-api-migration-fixes.patch +++ /dev/null @@ -1,522 +0,0 @@ -diff --git a/daemon/src/lib.rs b/daemon/src/lib.rs -index 9f507221..a0ba9d88 100644 ---- a/daemon/src/lib.rs -+++ b/daemon/src/lib.rs -@@ -11,12 +11,23 @@ use redox_scheme::Socket; - use redox_scheme::scheme::{SchemeAsync, SchemeSync}; - - unsafe fn get_fd(var: &str) -> RawFd { -- let fd: RawFd = std::env::var(var).unwrap().parse().unwrap(); -+ let fd: RawFd = match std::env::var(var) -+ .map_err(|e| eprintln!("daemon: env var {var} not set: {e}")) -+ .ok() -+ .and_then(|val| { -+ val.parse() -+ .map_err(|e| eprintln!("daemon: failed to parse {var} as fd: {e}")) -+ .ok() -+ }) { -+ Some(fd) => fd, -+ None => return -1, -+ }; - if unsafe { libc::fcntl(fd, libc::F_SETFD, libc::FD_CLOEXEC) } == -1 { -- panic!( -+ eprintln!( - "daemon: failed to set CLOEXEC flag for {var} fd: {}", - io::Error::last_os_error() - ); -+ return -1; - } - fd - } -@@ -51,31 +62,40 @@ impl Daemon { - - /// Notify the process that the daemon is ready to accept requests. - pub fn ready(mut self) { -- self.write_pipe.write_all(&[0]).unwrap(); -+ if let Err(err) = self.write_pipe.write_all(&[0]) { -+ if err.kind() != io::ErrorKind::BrokenPipe { -+ eprintln!("daemon::ready write failed: {err}"); -+ } -+ } - } - - /// Executes `Command` as a child process. - // FIXME remove once the service spawning of hwd and pcid-spawner is moved to init - #[deprecated] -- pub fn spawn(mut cmd: Command) { -- let (mut read_pipe, write_pipe) = io::pipe().unwrap(); -+ pub fn spawn(mut cmd: Command) -> io::Result<()> { -+ let (mut read_pipe, write_pipe) = io::pipe().map_err(|err| { -+ io::Error::new(err.kind(), format!("daemon: failed to create readiness pipe: {err}")) -+ })?; - - unsafe { pass_fd(&mut cmd, "INIT_NOTIFY", write_pipe.into()) }; - -- if let Err(err) = cmd.spawn() { -- eprintln!("daemon: failed to execute {cmd:?}: {err}"); -- return; -- } -+ cmd.spawn().map_err(|err| { -+ io::Error::new(err.kind(), format!("failed to execute {cmd:?}: {err}")) -+ })?; - - let mut data = [0]; - match read_pipe.read_exact(&mut data) { -- Ok(()) => {} -+ Ok(()) => Ok(()), - Err(err) if err.kind() == io::ErrorKind::UnexpectedEof => { -- eprintln!("daemon: {cmd:?} exited without notifying readiness"); -- } -- Err(err) => { -- eprintln!("daemon: failed to wait for {cmd:?}: {err}"); -+ Err(io::Error::new( -+ io::ErrorKind::UnexpectedEof, -+ format!("{cmd:?} exited without notifying readiness"), -+ )) - } -+ Err(err) => Err(io::Error::new( -+ err.kind(), -+ format!("failed to wait for {cmd:?}: {err}"), -+ )), - } - } - } -diff --git a/drivers/audio/ac97d/src/main.rs b/drivers/audio/ac97d/src/main.rs -index ffa8a94b..1ce21cde 100644 ---- a/drivers/audio/ac97d/src/main.rs -+++ b/drivers/audio/ac97d/src/main.rs -@@ -3,6 +3,7 @@ use std::os::unix::io::AsRawFd; - use std::usize; - - use event::{user_data, EventQueue}; -+use log::error; - use pcid_interface::PciFunctionHandle; - use redox_scheme::scheme::register_sync_scheme; - use redox_scheme::Socket; -@@ -22,13 +23,28 @@ fn daemon(daemon: daemon::Daemon, pcid_handle: PciFunctionHandle) -> ! { - let mut name = pci_config.func.name(); - name.push_str("_ac97"); - -- let bar0 = pci_config.func.bars[0].expect_port(); -- let bar1 = pci_config.func.bars[1].expect_port(); -+ let bar0 = match pci_config.func.bars[0].try_port() { -+ Ok(port) => port, -+ Err(_) => { -+ error!("ac97d: invalid BAR0 (not a port BAR)"); -+ std::process::exit(1); -+ } -+ }; -+ let bar1 = match pci_config.func.bars[1].try_port() { -+ Ok(port) => port, -+ Err(_) => { -+ error!("ac97d: invalid BAR1 (not a port BAR)"); -+ std::process::exit(1); -+ } -+ }; - - let irq = pci_config - .func - .legacy_interrupt_line -- .expect("ac97d: no legacy interrupts supported"); -+ .unwrap_or_else(|| { -+ error!("ac97d: no legacy interrupts supported"); -+ std::process::exit(1); -+ }); - - println!(" + ac97 {}", pci_config.func.display()); - -@@ -40,13 +56,29 @@ fn daemon(daemon: daemon::Daemon, pcid_handle: PciFunctionHandle) -> ! { - common::file_level(), - ); - -- common::acquire_port_io_rights().expect("ac97d: failed to set I/O privilege level to Ring 3"); -+ if let Err(err) = common::acquire_port_io_rights() { -+ error!("ac97d: failed to set I/O privilege level to Ring 3: {err}"); -+ std::process::exit(1); -+ } - - let mut irq_file = irq.irq_handle("ac97d"); - -- let socket = Socket::nonblock().expect("ac97d: failed to create socket"); -- let mut device = -- unsafe { device::Ac97::new(bar0, bar1).expect("ac97d: failed to allocate device") }; -+ let socket = match Socket::nonblock() { -+ Ok(socket) => socket, -+ Err(err) => { -+ error!("ac97d: failed to create socket: {err}"); -+ std::process::exit(1); -+ } -+ }; -+ let mut device = unsafe { -+ match device::Ac97::new(bar0, bar1) { -+ Ok(device) => device, -+ Err(err) => { -+ error!("ac97d: failed to allocate device: {err}"); -+ std::process::exit(1); -+ } -+ } -+ }; - let mut readiness_based = ReadinessBased::new(&socket, 16); - - user_data! { -@@ -56,49 +88,81 @@ fn daemon(daemon: daemon::Daemon, pcid_handle: PciFunctionHandle) -> ! { - } - } - -- let event_queue = EventQueue::::new().expect("ac97d: Could not create event queue."); -+ let event_queue = match EventQueue::::new() { -+ Ok(queue) => queue, -+ Err(err) => { -+ error!("ac97d: could not create event queue: {err}"); -+ std::process::exit(1); -+ } -+ }; - event_queue - .subscribe( - irq_file.as_raw_fd() as usize, - Source::Irq, - event::EventFlags::READ, - ) -- .unwrap(); -+ .unwrap_or_else(|err| { -+ error!("ac97d: failed to subscribe IRQ fd: {err}"); -+ std::process::exit(1); -+ }); - event_queue - .subscribe( - socket.inner().raw(), - Source::Scheme, - event::EventFlags::READ, - ) -- .unwrap(); -- -- register_sync_scheme(&socket, "audiohw", &mut device) -- .expect("ac97d: failed to register audiohw scheme to namespace"); -+ .unwrap_or_else(|err| { -+ error!("ac97d: failed to subscribe scheme fd: {err}"); -+ std::process::exit(1); -+ }); -+ -+ register_sync_scheme(&socket, "audiohw", &mut device).unwrap_or_else(|err| { -+ error!("ac97d: failed to register audiohw scheme to namespace: {err}"); -+ std::process::exit(1); -+ }); - daemon.ready(); - -- libredox::call::setrens(0, 0).expect("ac97d: failed to enter null namespace"); -+ if let Err(err) = libredox::call::setrens(0, 0) { -+ error!("ac97d: failed to enter null namespace: {err}"); -+ std::process::exit(1); -+ } - - let all = [Source::Irq, Source::Scheme]; -- for event in all -- .into_iter() -- .chain(event_queue.map(|e| e.expect("ac97d: failed to get next event").user_data)) -- { -+ for event in all.into_iter().chain(event_queue.map(|e| match e { -+ Ok(event) => event.user_data, -+ Err(err) => { -+ error!("ac97d: failed to get next event: {err}"); -+ std::process::exit(1); -+ } -+ })) { - match event { - Source::Irq => { - let mut irq = [0; 8]; -- irq_file.read(&mut irq).unwrap(); -+ if let Err(err) = irq_file.read(&mut irq) { -+ error!("ac97d: failed to read IRQ file: {err}"); -+ std::process::exit(1); -+ } - - if !device.irq() { - continue; - } -- irq_file.write(&mut irq).unwrap(); -+ if let Err(err) = irq_file.write(&mut irq) { -+ error!("ac97d: failed to acknowledge IRQ: {err}"); -+ std::process::exit(1); -+ } - - readiness_based - .poll_all_requests(&mut device) -- .expect("ac97d: failed to poll requests"); -+ .unwrap_or_else(|err| { -+ error!("ac97d: failed to poll requests: {err}"); -+ std::process::exit(1); -+ }); - readiness_based - .write_responses() -- .expect("ac97d: failed to write to socket"); -+ .unwrap_or_else(|err| { -+ error!("ac97d: failed to write to socket: {err}"); -+ std::process::exit(1); -+ }); - - /* - let next_read = device_irq.next_read(); -@@ -110,10 +174,16 @@ fn daemon(daemon: daemon::Daemon, pcid_handle: PciFunctionHandle) -> ! { - Source::Scheme => { - readiness_based - .read_and_process_requests(&mut device) -- .expect("ac97d: failed to read from socket"); -+ .unwrap_or_else(|err| { -+ error!("ac97d: failed to read from socket: {err}"); -+ std::process::exit(1); -+ }); - readiness_based - .write_responses() -- .expect("ac97d: failed to write to socket"); -+ .unwrap_or_else(|err| { -+ error!("ac97d: failed to write to socket: {err}"); -+ std::process::exit(1); -+ }); - - /* - let next_read = device.borrow().next_read(); -@@ -125,7 +195,7 @@ fn daemon(daemon: daemon::Daemon, pcid_handle: PciFunctionHandle) -> ! { - } - } - -- std::process::exit(0); -+ std::process::exit(1); - } - - #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] -diff --git a/drivers/audio/ihdad/src/main.rs b/drivers/audio/ihdad/src/main.rs -index 31a2add7..7b15b322 100755 ---- a/drivers/audio/ihdad/src/main.rs -+++ b/drivers/audio/ihdad/src/main.rs -@@ -38,6 +38,10 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! { - - log::info!("IHDA {}", pci_config.func.display()); - -+ if let Err(err) = pci_config.func.bars[0].try_mem() { -+ log::error!("ihdad: invalid BAR0: {:?}", err); -+ std::process::exit(1); -+ } - let address = unsafe { pcid_handle.map_bar(0) }.ptr.as_ptr() as usize; - - let irq_file = pci_allocate_interrupt_vector(&mut pcid_handle, "ihdad"); -@@ -53,11 +57,28 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! { - } - } - -- let event_queue = -- EventQueue::::new().expect("ihdad: Could not create event queue."); -- let socket = Socket::nonblock().expect("ihdad: failed to create socket"); -+ let event_queue = match EventQueue::::new() { -+ Ok(queue) => queue, -+ Err(err) => { -+ log::error!("ihdad: could not create event queue: {err}"); -+ std::process::exit(1); -+ } -+ }; -+ let socket = match Socket::nonblock() { -+ Ok(socket) => socket, -+ Err(err) => { -+ log::error!("ihdad: failed to create socket: {err}"); -+ std::process::exit(1); -+ } -+ }; - let mut device = unsafe { -- hda::IntelHDA::new(address, vend_prod).expect("ihdad: failed to allocate device") -+ match hda::IntelHDA::new(address, vend_prod) { -+ Ok(device) => device, -+ Err(err) => { -+ log::error!("ihdad: failed to allocate device: {err}"); -+ std::process::exit(1); -+ } -+ } - }; - let mut readiness_based = ReadinessBased::new(&socket, 16); - -diff --git a/drivers/graphics/ihdgd/src/main.rs b/drivers/graphics/ihdgd/src/main.rs -index a8b6cc60..dc68c6d2 100644 ---- a/drivers/graphics/ihdgd/src/main.rs -+++ b/drivers/graphics/ihdgd/src/main.rs -@@ -29,16 +29,26 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! { - - log::info!("IHDG {}", pci_config.func.display()); - -- let device = Device::new(&mut pcid_handle, &pci_config.func) -- .expect("ihdgd: failed to initialize device"); -+ let device = match Device::new(&mut pcid_handle, &pci_config.func) { -+ Ok(device) => device, -+ Err(err) => { -+ log::error!("ihdgd: failed to initialize device: {err}"); -+ std::process::exit(1); -+ } -+ }; - - let irq_file = pci_allocate_interrupt_vector(&mut pcid_handle, "ihdgd"); - - // Needs to be before GraphicsScheme::new to avoid a deadlock due to initnsmgr blocking on - // /scheme/event as it is already blocked on opening /scheme/display.ihdg.*. - // FIXME change the initnsmgr to not block on openat for the target scheme. -- let event_queue: EventQueue = -- EventQueue::new().expect("ihdgd: failed to create event queue"); -+ let event_queue: EventQueue = match EventQueue::new() { -+ Ok(eq) => eq, -+ Err(err) => { -+ log::error!("ihdgd: failed to create event queue: {err}"); -+ std::process::exit(1); -+ } -+ }; - - let mut scheme = GraphicsScheme::new(device, format!("display.ihdg.{}", name), false); - -@@ -50,53 +60,69 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! { - } - } - -- event_queue -- .subscribe( -- scheme.inputd_event_handle().as_raw_fd() as usize, -- Source::Input, -- event::EventFlags::READ, -- ) -- .unwrap(); -- event_queue -- .subscribe( -- irq_file.irq_handle().as_raw_fd() as usize, -- Source::Irq, -- event::EventFlags::READ, -- ) -- .unwrap(); -- event_queue -- .subscribe( -- scheme.event_handle().raw(), -- Source::Scheme, -- event::EventFlags::READ, -- ) -- .unwrap(); -- -- libredox::call::setrens(0, 0).expect("ihdgd: failed to enter null namespace"); -+ if let Err(err) = event_queue.subscribe( -+ scheme.inputd_event_handle().as_raw_fd() as usize, -+ Source::Input, -+ event::EventFlags::READ, -+ ) { -+ log::error!("ihdgd: failed to subscribe to input events: {err}"); -+ } -+ if let Err(err) = event_queue.subscribe( -+ irq_file.irq_handle().as_raw_fd() as usize, -+ Source::Irq, -+ event::EventFlags::READ, -+ ) { -+ log::error!("ihdgd: failed to subscribe to IRQ events: {err}"); -+ } -+ if let Err(err) = event_queue.subscribe( -+ scheme.event_handle().raw(), -+ Source::Scheme, -+ event::EventFlags::READ, -+ ) { -+ log::error!("ihdgd: failed to subscribe to scheme events: {err}"); -+ } -+ -+ if let Err(err) = libredox::call::setrens(0, 0) { -+ log::error!("ihdgd: failed to enter null namespace: {err}"); -+ std::process::exit(1); -+ } - - daemon.ready(); - - let all = [Source::Input, Source::Irq, Source::Scheme]; -- for event in all -- .into_iter() -- .chain(event_queue.map(|e| e.expect("ihdgd: failed to get next event").user_data)) -- { -+ for event in all.into_iter().chain( -+ event_queue.filter_map(|e| match e { -+ Ok(event) => Some(event.user_data), -+ Err(err) => { -+ log::error!("ihdgd: failed to get next event: {err}"); -+ None -+ } -+ }), -+ ) { - match event { - Source::Input => scheme.handle_vt_events(), - Source::Irq => { - let mut irq = [0; 8]; -- irq_file.irq_handle().read(&mut irq).unwrap(); -+ if irq_file.irq_handle().read(&mut irq).is_err() { -+ log::error!("ihdgd: failed to read IRQ"); -+ continue; -+ } - if scheme.adapter_mut().handle_irq() { -- irq_file.irq_handle().write(&mut irq).unwrap(); -+ if let Err(err) = irq_file.irq_handle().write(&mut irq) { -+ log::error!("ihdgd: failed to write IRQ: {err}"); -+ continue; -+ } - - scheme.adapter_mut().handle_events(); -- scheme.tick().unwrap(); -+ if let Err(err) = scheme.tick() { -+ log::error!("ihdgd: failed to handle display events after IRQ: {err}"); -+ } - } - } - Source::Scheme => { -- scheme -- .tick() -- .expect("ihdgd: failed to handle scheme events"); -+ if let Err(err) = scheme.tick() { -+ log::error!("ihdgd: failed to handle scheme events: {err}"); -+ } - } - } - } -diff --git a/drivers/pcid/src/driver_interface/bar.rs b/drivers/pcid/src/driver_interface/bar.rs -index b2c1d35b..5005fa32 100644 ---- a/drivers/pcid/src/driver_interface/bar.rs -+++ b/drivers/pcid/src/driver_interface/bar.rs -@@ -29,27 +29,33 @@ impl PciBar { - } - } - -- pub fn expect_port(&self) -> u16 { -+ pub fn try_port(&self) -> Result { - match *self { -- PciBar::Port(port) => port, -- PciBar::Memory32 { .. } | PciBar::Memory64 { .. } => { -- panic!("expected port BAR, found memory BAR"); -- } -- PciBar::None => panic!("expected BAR to exist"), -+ PciBar::Port(port) => Ok(port), -+ PciBar::Memory32 { .. } | PciBar::Memory64 { .. } => Err(()), -+ PciBar::None => Err(()), - } - } - -- pub fn expect_mem(&self) -> (usize, usize) { -+ pub fn try_mem(&self) -> Result<(usize, usize), ()> { - match *self { -- PciBar::Memory32 { addr, size } => (addr as usize, size as usize), -- PciBar::Memory64 { addr, size } => ( -+ PciBar::Memory32 { addr, size } => Ok((addr as usize, size as usize)), -+ PciBar::Memory64 { addr, size } => Ok(( - addr.try_into() - .expect("conversion from 64bit BAR to usize failed"), - size.try_into() - .expect("conversion from 64bit BAR size to usize failed"), -- ), -- PciBar::Port(_) => panic!("expected memory BAR, found port BAR"), -- PciBar::None => panic!("expected BAR to exist"), -+ )), -+ PciBar::Port(_) => Err(()), -+ PciBar::None => Err(()), - } - } -+ -+ pub fn expect_port(&self) -> u16 { -+ self.try_port().expect("expected port BAR") -+ } -+ -+ pub fn expect_mem(&self) -> (usize, usize) { -+ self.try_mem().expect("expected memory BAR") -+ } - } diff --git a/local/archived/patches-2026-06-migration/base/absorbed/P2-daemon-hardening.patch b/local/archived/patches-2026-06-migration/base/absorbed/P2-daemon-hardening.patch deleted file mode 100644 index 0e21f3ee7b..0000000000 --- a/local/archived/patches-2026-06-migration/base/absorbed/P2-daemon-hardening.patch +++ /dev/null @@ -1,3720 +0,0 @@ -diff --git a/daemon/src/lib.rs b/daemon/src/lib.rs -index 9f507221..a0ba9d88 100644 ---- a/daemon/src/lib.rs -+++ b/daemon/src/lib.rs -@@ -11,12 +11,23 @@ use redox_scheme::Socket; - use redox_scheme::scheme::{SchemeAsync, SchemeSync}; - - unsafe fn get_fd(var: &str) -> RawFd { -- let fd: RawFd = std::env::var(var).unwrap().parse().unwrap(); -+ let fd: RawFd = match std::env::var(var) -+ .map_err(|e| eprintln!("daemon: env var {var} not set: {e}")) -+ .ok() -+ .and_then(|val| { -+ val.parse() -+ .map_err(|e| eprintln!("daemon: failed to parse {var} as fd: {e}")) -+ .ok() -+ }) { -+ Some(fd) => fd, -+ None => return -1, -+ }; - if unsafe { libc::fcntl(fd, libc::F_SETFD, libc::FD_CLOEXEC) } == -1 { -- panic!( -+ eprintln!( - "daemon: failed to set CLOEXEC flag for {var} fd: {}", - io::Error::last_os_error() - ); -+ return -1; - } - fd - } -@@ -51,31 +62,40 @@ impl Daemon { - - /// Notify the process that the daemon is ready to accept requests. - pub fn ready(mut self) { -- self.write_pipe.write_all(&[0]).unwrap(); -+ if let Err(err) = self.write_pipe.write_all(&[0]) { -+ if err.kind() != io::ErrorKind::BrokenPipe { -+ eprintln!("daemon::ready write failed: {err}"); -+ } -+ } - } - - /// Executes `Command` as a child process. - // FIXME remove once the service spawning of hwd and pcid-spawner is moved to init - #[deprecated] -- pub fn spawn(mut cmd: Command) { -- let (mut read_pipe, write_pipe) = io::pipe().unwrap(); -+ pub fn spawn(mut cmd: Command) -> io::Result<()> { -+ let (mut read_pipe, write_pipe) = io::pipe().map_err(|err| { -+ io::Error::new(err.kind(), format!("daemon: failed to create readiness pipe: {err}")) -+ })?; - - unsafe { pass_fd(&mut cmd, "INIT_NOTIFY", write_pipe.into()) }; - -- if let Err(err) = cmd.spawn() { -- eprintln!("daemon: failed to execute {cmd:?}: {err}"); -- return; -- } -+ cmd.spawn().map_err(|err| { -+ io::Error::new(err.kind(), format!("failed to execute {cmd:?}: {err}")) -+ })?; - - let mut data = [0]; - match read_pipe.read_exact(&mut data) { -- Ok(()) => {} -+ Ok(()) => Ok(()), - Err(err) if err.kind() == io::ErrorKind::UnexpectedEof => { -- eprintln!("daemon: {cmd:?} exited without notifying readiness"); -- } -- Err(err) => { -- eprintln!("daemon: failed to wait for {cmd:?}: {err}"); -+ Err(io::Error::new( -+ io::ErrorKind::UnexpectedEof, -+ format!("{cmd:?} exited without notifying readiness"), -+ )) - } -+ Err(err) => Err(io::Error::new( -+ err.kind(), -+ format!("failed to wait for {cmd:?}: {err}"), -+ )), - } - } - } -diff --git a/drivers/graphics/console-draw/src/lib.rs b/drivers/graphics/console-draw/src/lib.rs -index 5eb951df..0b959e5c 100644 ---- a/drivers/graphics/console-draw/src/lib.rs -+++ b/drivers/graphics/console-draw/src/lib.rs -@@ -59,19 +59,19 @@ pub struct V2DisplayMap { - - impl V2DisplayMap { - pub fn new(display_handle: V2GraphicsHandle) -> io::Result { -- let connector = display_handle.first_display().unwrap(); -- let connector_info = display_handle.get_connector(connector, true).unwrap(); -+ let connector = display_handle.first_display()?; -+ let connector_info = display_handle.get_connector(connector, true)?; - - let mode = connector_info.modes()[0]; - let (width, height) = mode.size(); - - // FIXME do something smarter that avoids conflicts -- let crtc = display_handle.resource_handles().unwrap().filter_crtcs( -- display_handle -- .get_encoder(connector_info.encoders()[0]) -- .unwrap() -- .possible_crtcs(), -- )[0]; -+ let crtc = { -+ let res_handles = display_handle.resource_handles()?; -+ let encoder = display_handle -+ .get_encoder(connector_info.encoders()[0])?; -+ res_handles.filter_crtcs(encoder.possible_crtcs())[0] -+ }; - - let buffer = CpuBackedBuffer::new( - &display_handle, -@@ -338,12 +338,12 @@ impl TextScreen { - line_changed(y); - } - -- let width = map.width.try_into().unwrap(); -+ let width: u32 = map.width.try_into().unwrap_or(0); - let damage = Damage { - x: 0, -- y: u32::try_from(min_changed).unwrap() * 16, -+ y: u32::try_from(min_changed).unwrap_or(0) * 16, - width, -- height: u32::try_from(max_changed.saturating_sub(min_changed) + 1).unwrap() * 16, -+ height: u32::try_from(max_changed.saturating_sub(min_changed) + 1).unwrap_or(0) * 16, - }; - - damage -@@ -445,7 +445,9 @@ impl TextBuffer { - } - - for &byte in buf { -- self.lines.back_mut().unwrap().push(byte); -+ if let Some(last) = self.lines.back_mut() { -+ last.push(byte); -+ } - - if byte == b'\n' { - self.lines.push_back(Vec::new()); -diff --git a/drivers/graphics/driver-graphics/Cargo.toml b/drivers/graphics/driver-graphics/Cargo.toml -index 31e02335..fc747cce 100644 ---- a/drivers/graphics/driver-graphics/Cargo.toml -+++ b/drivers/graphics/driver-graphics/Cargo.toml -@@ -9,6 +9,7 @@ drm-fourcc = "2.2.0" - drm-sys.workspace = true - edid.workspace = true #TODO: edid is abandoned, fork it and maintain? - log.workspace = true -+nom.workspace = true - redox-ioctl.workspace = true - redox-scheme.workspace = true - scheme-utils = { path = "../../../scheme-utils" } -diff --git a/drivers/graphics/driver-graphics/src/kms/connector.rs b/drivers/graphics/driver-graphics/src/kms/connector.rs -index c885f413..19037fec 100644 ---- a/drivers/graphics/driver-graphics/src/kms/connector.rs -+++ b/drivers/graphics/driver-graphics/src/kms/connector.rs -@@ -21,7 +21,14 @@ impl KmsObjects { - ) -> KmsObjectId { - let mut possible_crtcs = 0; - for &crtc in crtcs { -- possible_crtcs = 1 << self.get_crtc(crtc).unwrap().lock().unwrap().crtc_index; -+ if let Ok(crtc_guard) = self.get_crtc(crtc) { -+ match crtc_guard.lock() { -+ Ok(locked) => possible_crtcs = 1 << locked.crtc_index, -+ Err(e) => log::error!("add_connector: crtc lock poisoned: {e}"), -+ } -+ } else { -+ log::error!("add_connector: failed to get crtc {}", crtc.0); -+ } - } - - let encoder_id = self.add(KmsEncoder { -@@ -61,7 +68,7 @@ impl KmsObjects { - pub fn connectors(&self) -> impl Iterator>> + use<'_, T> { - self.connectors - .iter() -- .map(|&id| self.get_connector(id).unwrap()) -+ .filter_map(|&id| self.get_connector(id).ok()) - } - - pub fn get_connector(&self, id: KmsObjectId) -> Result<&Mutex>> { -@@ -136,10 +143,16 @@ impl KmsConnector { - } - - pub fn update_from_edid(&mut self, edid: &[u8]) { -- let edid = edid::parse(edid).unwrap().1; -+ let edid_data = match edid::parse(edid) { -+ nom::IResult::Done(_, data) => data, -+ _ => { -+ log::error!("failed to parse EDID: parse returned error or incomplete"); -+ return; -+ } -+ }; - - if let Some(first_detailed_timing) = -- edid.descriptors -+ edid_data.descriptors - .iter() - .find_map(|descriptor| match descriptor { - edid::Descriptor::DetailedTiming(detailed_timing) => Some(detailed_timing), -@@ -152,7 +165,7 @@ impl KmsConnector { - log::error!("No edid timing descriptor detected"); - } - -- self.modes = edid -+ self.modes = edid_data - .descriptors - .iter() - .filter_map(|descriptor| { -diff --git a/drivers/graphics/driver-graphics/src/kms/objects.rs b/drivers/graphics/driver-graphics/src/kms/objects.rs -index 1daf3221..55c60167 100644 ---- a/drivers/graphics/driver-graphics/src/kms/objects.rs -+++ b/drivers/graphics/driver-graphics/src/kms/objects.rs -@@ -95,7 +95,7 @@ impl KmsObjects { - pub fn crtcs(&self) -> impl Iterator>> + use<'_, T> { - self.crtcs - .iter() -- .map(|&id| self.get::>>(id).unwrap()) -+ .filter_map(|&id| self.get::>>(id).ok()) - } - - pub fn get_crtc(&self, id: KmsObjectId) -> Result<&Mutex>> { -@@ -115,7 +115,12 @@ impl KmsObjects { - let KmsObject::Framebuffer(_) = object else { - return Err(Error::new(EINVAL)); - }; -- self.objects.remove(&id).unwrap(); -+ self.objects -+ .remove(&id) -+ .ok_or_else(|| { -+ log::error!("remove_framebuffer: object {} vanished during removal", id.0); -+ Error::new(EINVAL) -+ })?; - - Ok(()) - } -diff --git a/drivers/graphics/driver-graphics/src/kms/properties.rs b/drivers/graphics/driver-graphics/src/kms/properties.rs -index e22527a7..85893861 100644 ---- a/drivers/graphics/driver-graphics/src/kms/properties.rs -+++ b/drivers/graphics/driver-graphics/src/kms/properties.rs -@@ -21,7 +21,11 @@ impl KmsObjects { - kind: KmsPropertyKind, - ) -> KmsObjectId { - match &kind { -- KmsPropertyKind::Range(start, end) => assert!(start < end), -+ KmsPropertyKind::Range(start, end) => { -+ if start >= end { -+ log::error!("Range property '{name}' has invalid range: start ({start}) >= end ({end})"); -+ } -+ } - KmsPropertyKind::Enum(_variants) => { - // FIXME check duplicate variant numbers - } -@@ -30,7 +34,11 @@ impl KmsObjects { - // FIXME check overlapping flag numbers - } - KmsPropertyKind::Object { type_: _ } => {} -- KmsPropertyKind::SignedRange(start, end) => assert!(start < end), -+ KmsPropertyKind::SignedRange(start, end) => { -+ if start >= end { -+ log::error!("SignedRange property '{name}' has invalid range: start ({start}) >= end ({end})"); -+ } -+ } - } - - let mut name_bytes = [0; DRM_PROP_NAME_LEN as usize]; -@@ -54,7 +62,13 @@ impl KmsObjects { - let object = self.objects.get(&id).ok_or(Error::new(EINVAL))?; - match object { - KmsObject::Crtc(crtc) => { -- let crtc = crtc.lock().unwrap(); -+ let crtc = match crtc.lock() { -+ Ok(g) => g, -+ Err(e) => { -+ log::error!("get_object_properties_data: crtc lock poisoned: {e}"); -+ return Err(Error::new(EINVAL)); -+ } -+ }; - let props = &crtc.properties; - Ok(( - props.iter().map(|prop| prop.id.0).collect::>(), -@@ -65,7 +79,13 @@ impl KmsObjects { - )) - } - KmsObject::Connector(connector) => { -- let connector = connector.lock().unwrap(); -+ let connector = match connector.lock() { -+ Ok(g) => g, -+ Err(e) => { -+ log::error!("get_object_properties_data: connector lock poisoned: {e}"); -+ return Err(Error::new(EINVAL)); -+ } -+ }; - let props = &connector.properties; - Ok(( - props.iter().map(|prop| prop.id.0).collect::>(), -@@ -151,12 +171,16 @@ macro_rules! define_properties { - - pub(super) fn init_standard_props(objects: &mut KmsObjects) { - $( -- assert_eq!(objects.add_property( -+ let prop_id = objects.add_property( - define_properties!(@prop_name $prop $($prop_name)?), - define_properties!(@is_immutable $($prop_flag)?), - define_properties!(@is_atomic $($prop_flag)?), - define_properties!(@prop_kind $prop_type $({$($prop_content)*})?), -- ), $prop); -+ ); -+ if prop_id != $prop { -+ log::error!("property ID mismatch for {}: expected {:?}, got {:?}", -+ stringify!($prop), $prop, prop_id); -+ } - )* - } - }; -diff --git a/drivers/graphics/driver-graphics/src/lib.rs b/drivers/graphics/driver-graphics/src/lib.rs -index eab0be9c..e5886b36 100644 ---- a/drivers/graphics/driver-graphics/src/lib.rs -+++ b/drivers/graphics/driver-graphics/src/lib.rs -@@ -136,13 +136,20 @@ pub struct GraphicsScheme { - - impl GraphicsScheme { - pub fn new(mut adapter: T, scheme_name: String, early: bool) -> Self { -- assert!(scheme_name.starts_with("display")); -- let socket = Socket::nonblock().expect("failed to create graphics scheme"); -+ if !scheme_name.starts_with("display") { -+ log::error!("graphics scheme name must start with 'display': {scheme_name}"); -+ std::process::exit(1); -+ } -+ let socket = match Socket::nonblock() { -+ Ok(s) => s, -+ Err(e) => { -+ log::error!("failed to create graphics scheme: {e}"); -+ std::process::exit(1); -+ } -+ }; - -- let disable_graphical_debug = Some( -- File::open("/scheme/debug/disable-graphical-debug") -- .expect("vesad: Failed to open /scheme/debug/disable-graphical-debug"), -- ); -+ let disable_graphical_debug = -+ File::open("/scheme/debug/disable-graphical-debug").ok(); - - let mut objects = KmsObjects::new(); - adapter.init(&mut objects); -@@ -161,14 +168,34 @@ impl GraphicsScheme { - vts: HashMap::new(), - }; - -- let cap_id = inner.scheme_root().expect("failed to get this scheme root"); -- register_scheme_inner(&inner.socket, &inner.scheme_name, cap_id) -- .expect("failed to register graphics scheme root"); -+ let cap_id = match inner.scheme_root() { -+ Ok(id) => id, -+ Err(e) => { -+ log::error!("failed to get this scheme root: {e}"); -+ std::process::exit(1); -+ } -+ }; -+ if let Err(e) = register_scheme_inner(&inner.socket, &inner.scheme_name, cap_id) { -+ log::error!("failed to register graphics scheme root: {e}"); -+ std::process::exit(1); -+ } - - let display_handle = if early { -- DisplayHandle::new_early(&inner.scheme_name).unwrap() -+ match DisplayHandle::new_early(&inner.scheme_name) { -+ Ok(h) => h, -+ Err(e) => { -+ log::error!("failed to create early display handle: {e}"); -+ std::process::exit(1); -+ } -+ } - } else { -- DisplayHandle::new(&inner.scheme_name).unwrap() -+ match DisplayHandle::new(&inner.scheme_name) { -+ Ok(h) => h, -+ Err(e) => { -+ log::error!("failed to create display handle: {e}"); -+ std::process::exit(1); -+ } -+ } - }; - - Self { -@@ -207,11 +234,15 @@ impl GraphicsScheme { - } - - pub fn handle_vt_events(&mut self) { -- while let Some(vt_event) = self -- .inputd_handle -- .read_vt_event() -- .expect("driver-graphics: failed to read display handle") -- { -+ loop { -+ let vt_event = match self.inputd_handle.read_vt_event() { -+ Ok(Some(event)) => event, -+ Ok(None) => break, -+ Err(e) => { -+ log::error!("driver-graphics: failed to read display handle: {e}"); -+ break; -+ } -+ }; - match vt_event.kind { - VtEventKind::Activate => self.inner.activate_vt(vt_event.vt), - } -@@ -241,10 +272,17 @@ impl GraphicsScheme { - match request.kind() { - RequestKind::Call(call) => { - let response = call.handle_sync(&mut self.inner, &mut self.state); -- self.inner -+ if let Err(e) = self -+ .inner - .socket - .write_response(response, SignalBehavior::Restart) -- .expect("driver-graphics: failed to write response"); -+ { -+ log::error!("driver-graphics: failed to write response: {e}"); -+ return Err(io::Error::new( -+ io::ErrorKind::Other, -+ format!("driver-graphics: failed to write response: {e}"), -+ )); -+ } - } - RequestKind::OnClose { id } => { - self.inner.on_close(id); -@@ -294,11 +332,28 @@ impl GraphicsSchemeInner { - vts.entry(vt).or_insert_with(|| VtState { - connector_state: objects - .connectors() -- .map(|connector| connector.lock().unwrap().state.clone()) -+ .map(|connector| { -+ connector -+ .lock() -+ .unwrap_or_else(|e| { -+ log::error!("get_or_create_vt: connector lock poisoned: {e}"); -+ e.into_inner() -+ }) -+ .state -+ .clone() -+ }) - .collect(), - crtc_state: objects - .crtcs() -- .map(|crtc| crtc.lock().unwrap().state.clone()) -+ .map(|crtc| { -+ crtc.lock() -+ .unwrap_or_else(|e| { -+ log::error!("get_or_create_vt: crtc lock poisoned: {e}"); -+ e.into_inner() -+ }) -+ .state -+ .clone() -+ }) - .collect(), - cursor_plane: CursorPlane { - x: 0, -@@ -327,47 +382,71 @@ impl GraphicsSchemeInner { - - for (connector_idx, connector_state) in vt_state.connector_state.iter().enumerate() { - let connector_id = self.objects.connector_ids()[connector_idx]; -- let mut connector = self -- .objects -- .get_connector(connector_id) -- .unwrap() -- .lock() -- .unwrap(); -+ let connector_guard = match self.objects.get_connector(connector_id) { -+ Ok(g) => g, -+ Err(e) => { -+ log::error!("activate_vt: failed to get connector {}: {e}", connector_id.0); -+ continue; -+ } -+ }; -+ let mut connector = match connector_guard.lock() { -+ Ok(g) => g, -+ Err(e) => { -+ log::error!("activate_vt: connector {} lock poisoned: {e}", connector_id.0); -+ e.into_inner() -+ } -+ }; - connector.state = connector_state.clone(); - } - - for (crtc_idx, crtc_state) in vt_state.crtc_state.iter().enumerate() { - let crtc_id = self.objects.crtc_ids()[crtc_idx]; -- let crtc = self.objects.get_crtc(crtc_id).unwrap(); -+ let crtc = match self.objects.get_crtc(crtc_id) { -+ Ok(c) => c, -+ Err(e) => { -+ log::error!("activate_vt: failed to get crtc {}: {e}", crtc_id.0); -+ continue; -+ } -+ }; - let connector_id = self.objects.connector_ids()[crtc_idx]; - -- let fb = crtc_state.fb_id.map(|fb_id| { -+ let fb = crtc_state.fb_id.and_then(|fb_id| { - self.objects - .get_framebuffer(fb_id) -- .expect("removed framebuffers should be unset") -+ .map_err(|e| { -+ log::error!("activate_vt: framebuffer {} missing: {e}", fb_id.0); -+ e -+ }) -+ .ok() - }); - -- self.adapter -- .set_crtc( -- &self.objects, -- crtc, -- crtc_state.clone(), -- Damage { -- x: 0, -- y: 0, -- width: fb.map_or(0, |fb| fb.width), -- height: fb.map_or(0, |fb| fb.height), -- }, -- ) -- .unwrap(); -- -- self.objects -- .get_connector(connector_id) -- .unwrap() -- .lock() -- .unwrap() -- .state -- .crtc_id = crtc_id; -+ if let Err(e) = self.adapter.set_crtc( -+ &self.objects, -+ crtc, -+ crtc_state.clone(), -+ Damage { -+ x: 0, -+ y: 0, -+ width: fb.as_ref().map_or(0, |fb| fb.width), -+ height: fb.as_ref().map_or(0, |fb| fb.height), -+ }, -+ ) { -+ log::error!("activate_vt: set_crtc failed for crtc {}: {e}", crtc_id.0); -+ continue; -+ } -+ -+ match self.objects.get_connector(connector_id) { -+ Ok(conn_guard) => match conn_guard.lock() { -+ Ok(mut conn) => conn.state.crtc_id = crtc_id, -+ Err(e) => { -+ log::error!("activate_vt: connector {} lock poisoned: {e}", connector_id.0); -+ e.into_inner().state.crtc_id = crtc_id; -+ } -+ }, -+ Err(e) => { -+ log::error!("activate_vt: failed to get connector {}: {e}", connector_id.0); -+ } -+ } - } - - if self.adapter.hw_cursor_size().is_some() { -@@ -430,7 +509,12 @@ impl SchemeSync for GraphicsSchemeInner { - vt, - next_id: _, - buffers: _, -- } => write!(w, "v2/{vt}").unwrap(), -+ } => { -+ if let Err(e) = write!(w, "v2/{vt}") { -+ log::error!("fpath: write failed: {e}"); -+ return Err(Error::new(EINVAL)); -+ } -+ } - Handle::SchemeRoot => return Err(Error::new(EOPNOTSUPP)), - }; - Ok(()) -@@ -531,7 +615,10 @@ impl SchemeSync for GraphicsSchemeInner { - .objects - .get_crtc(KmsObjectId(data.crtc_id()))? - .lock() -- .unwrap(); -+ .map_err(|e| { -+ log::error!("MODE_GET_CRTC: crtc lock poisoned: {e}"); -+ Error::new(EINVAL) -+ })?; - // Don't touch set_connectors, that is only used by MODE_SET_CRTC - data.set_fb_id(crtc.state.fb_id.unwrap_or(KmsObjectId::INVALID).0); - // FIXME fill x and y with the data from the primary plane -@@ -565,7 +652,10 @@ impl SchemeSync for GraphicsSchemeInner { - } else { - None - }; -- let mut new_state = crtc.lock().unwrap().state.clone(); -+ let mut new_state = crtc.lock().map_err(|e| { -+ log::error!("MODE_SET_CRTC: crtc lock poisoned: {e}"); -+ Error::new(EINVAL) -+ })?.state.clone(); - new_state.fb_id = fb_id; - new_state.mode = mode; - if *vt == self.active_vt { -@@ -582,20 +672,34 @@ impl SchemeSync for GraphicsSchemeInner { - )?; - - for connector in connector_ids { -- self.objects -- .get_connector(connector)? -- .lock() -- .unwrap() -- .state -- .crtc_id = KmsObjectId(data.crtc_id()); -+ let conn_guard = self.objects.get_connector(connector)?; -+ match conn_guard.lock() { -+ Ok(mut conn) => conn.state.crtc_id = KmsObjectId(data.crtc_id()), -+ Err(e) => { -+ log::error!("MODE_SET_CRTC: connector lock poisoned: {e}"); -+ e.into_inner().state.crtc_id = KmsObjectId(data.crtc_id()); -+ } -+ } - } - } -- self.vts.get_mut(vt).unwrap().crtc_state -- [crtc.lock().unwrap().crtc_index as usize] = new_state; -+ { -+ let crtc_index = crtc.lock().map_err(|e| { -+ log::error!("MODE_SET_CRTC: crtc lock poisoned: {e}"); -+ Error::new(EINVAL) -+ })?.crtc_index as usize; -+ let vt_state = self.vts.get_mut(vt).ok_or_else(|| { -+ log::error!("MODE_SET_CRTC: vt {} not found", vt); -+ Error::new(EINVAL) -+ })?; -+ vt_state.crtc_state[crtc_index] = new_state; -+ } - Ok(0) - }), - ipc::MODE_CURSOR => ipc::DrmModeCursor::with(payload, |data| { -- let vt_state = self.vts.get_mut(vt).unwrap(); -+ let vt_state = self.vts.get_mut(vt).ok_or_else(|| { -+ log::error!("MODE_CURSOR: vt {} not found", vt); -+ Error::new(EINVAL) -+ })?; - - let cursor_plane = &mut vt_state.cursor_plane; - -@@ -635,7 +739,10 @@ impl SchemeSync for GraphicsSchemeInner { - .objects - .get_connector(KmsObjectId(data.connector_id()))? - .lock() -- .unwrap(); -+ .map_err(|e| { -+ log::error!("MODE_GET_CONNECTOR: connector lock poisoned: {e}"); -+ Error::new(EINVAL) -+ })?; - data.set_encoders_ptr(&[connector.encoder_id.0]); - data.set_modes_ptr(&connector.modes); - data.set_connector_type(data.connector_type()); -@@ -772,20 +879,23 @@ impl SchemeSync for GraphicsSchemeInner { - if *vt != self.active_vt { - continue; - } -- let crtc = self.objects.crtcs().nth(crtc_idx).unwrap(); -- self.adapter -- .set_crtc( -- &self.objects, -- crtc, -- crtc_state.clone(), -- Damage { -- x: 0, -- y: 0, -- width: 0, -- height: 0, -- }, -- ) -- .unwrap(); -+ let Some(crtc) = self.objects.crtcs().nth(crtc_idx) else { -+ log::error!("MODE_RM_FB: crtc index {crtc_idx} out of bounds"); -+ continue; -+ }; -+ if let Err(e) = self.adapter.set_crtc( -+ &self.objects, -+ crtc, -+ crtc_state.clone(), -+ Damage { -+ x: 0, -+ y: 0, -+ width: 0, -+ height: 0, -+ }, -+ ) { -+ log::error!("MODE_RM_FB: set_crtc failed for crtc {crtc_idx}: {e}"); -+ } - } - } - -@@ -813,7 +923,10 @@ impl SchemeSync for GraphicsSchemeInner { - - if *vt == self.active_vt { - for crtc in self.objects.crtcs() { -- let state = crtc.lock().unwrap().state.clone(); -+ let state = crtc.lock().map_err(|e| { -+ log::error!("MODE_DIRTYFB: crtc lock poisoned: {e}"); -+ Error::new(EINVAL) -+ })?.state.clone(); - if state.fb_id == Some(KmsObjectId(data.fb_id())) { - self.adapter.set_crtc(&self.objects, crtc, state, damage)?; - } -@@ -850,7 +963,13 @@ impl SchemeSync for GraphicsSchemeInner { - } - - // FIXME use a better scheme for creating map offsets -- assert!(buffers[&buffer_id].size() < MAP_FAKE_OFFSET_MULTIPLIER); -+ let buf_size = buffers[&buffer_id].size(); -+ if buf_size >= MAP_FAKE_OFFSET_MULTIPLIER { -+ log::error!( -+ "MODE_MAP_DUMB: buffer size {buf_size} exceeds offset multiplier {MAP_FAKE_OFFSET_MULTIPLIER}" -+ ); -+ return Err(Error::new(EINVAL)); -+ } - - data.set_offset((buffer_id as usize * MAP_FAKE_OFFSET_MULTIPLIER) as u64); - -@@ -874,11 +993,14 @@ impl SchemeSync for GraphicsSchemeInner { - ipc::MODE_GET_PLANE => ipc::DrmModeGetPlane::with(payload, |mut data| { - let i = id_index(data.plane_id()); - let crtc_id = self.objects.crtc_ids()[i as usize]; -- let crtc = self.objects.get_crtc(crtc_id).unwrap(); -+ let crtc = self.objects.get_crtc(crtc_id)?; - data.set_crtc_id(crtc_id.0); -+ let crtc_locked = crtc.lock().map_err(|e| { -+ log::error!("MODE_GET_PLANE: crtc lock poisoned: {e}"); -+ Error::new(EINVAL) -+ })?; - data.set_fb_id( -- crtc.lock() -- .unwrap() -+ crtc_locked - .state - .fb_id - .unwrap_or(KmsObjectId::INVALID) -@@ -907,7 +1029,10 @@ impl SchemeSync for GraphicsSchemeInner { - }) - } - ipc::MODE_CURSOR2 => ipc::DrmModeCursor2::with(payload, |data| { -- let vt_state = self.vts.get_mut(vt).unwrap(); -+ let vt_state = self.vts.get_mut(vt).ok_or_else(|| { -+ log::error!("MODE_CURSOR2: vt {} not found", vt); -+ Error::new(EINVAL) -+ })?; - - let cursor_plane = &mut vt_state.cursor_plane; - -@@ -970,8 +1095,7 @@ impl SchemeSync for GraphicsSchemeInner { - } => ( - buffers - .get(&((offset as usize / MAP_FAKE_OFFSET_MULTIPLIER) as u32)) -- .ok_or(Error::new(EINVAL)) -- .unwrap(), -+ .ok_or(Error::new(EINVAL))?, - offset & (MAP_FAKE_OFFSET_MULTIPLIER as u64 - 1), - ), - Handle::SchemeRoot => return Err(Error::new(EOPNOTSUPP)), -diff --git a/drivers/graphics/fbbootlogd/src/main.rs b/drivers/graphics/fbbootlogd/src/main.rs -index 3e42d590..62749577 100644 ---- a/drivers/graphics/fbbootlogd/src/main.rs -+++ b/drivers/graphics/fbbootlogd/src/main.rs -@@ -24,7 +24,13 @@ fn main() { - daemon::SchemeDaemon::new(daemon); - } - fn daemon(daemon: daemon::SchemeDaemon) -> ! { -- let event_queue = EventQueue::new().expect("fbbootlogd: failed to create event queue"); -+ let event_queue = match EventQueue::new() { -+ Ok(eq) => eq, -+ Err(err) => { -+ eprintln!("fbbootlogd: failed to create event queue: {err}"); -+ std::process::exit(1); -+ } -+ }; - - event::user_data! { - enum Source { -@@ -33,78 +39,105 @@ fn daemon(daemon: daemon::SchemeDaemon) -> ! { - } - } - -- let socket = Socket::nonblock().expect("fbbootlogd: failed to create fbbootlog scheme"); -+ let socket = match Socket::nonblock() { -+ Ok(s) => s, -+ Err(err) => { -+ eprintln!("fbbootlogd: failed to create fbbootlog scheme: {err}"); -+ std::process::exit(1); -+ } -+ }; - - let mut scheme = FbbootlogScheme::new(); - let mut handler = Blocking::new(&socket, 16); - -- event_queue -- .subscribe( -- socket.inner().raw(), -- Source::Scheme, -- event::EventFlags::READ, -- ) -- .expect("fbbootlogd: failed to subscribe to scheme events"); -+ if let Err(err) = event_queue.subscribe( -+ socket.inner().raw(), -+ Source::Scheme, -+ event::EventFlags::READ, -+ ) { -+ eprintln!("fbbootlogd: failed to subscribe to scheme events: {err}"); -+ std::process::exit(1); -+ } - -- event_queue -- .subscribe( -- scheme.input_handle.event_handle().as_raw_fd() as usize, -- Source::Input, -- event::EventFlags::READ, -- ) -- .expect("fbbootlogd: failed to subscribe to scheme events"); -+ if let Err(err) = event_queue.subscribe( -+ scheme.input_handle.event_handle().as_raw_fd() as usize, -+ Source::Input, -+ event::EventFlags::READ, -+ ) { -+ eprintln!("fbbootlogd: failed to subscribe to input events: {err}"); -+ std::process::exit(1); -+ } - - { -- let log_fd = socket -- .create_this_scheme_fd(0, 0, 0, 0) -- .expect("fbbootlogd: failed to create log fd"); -+ let log_fd = match socket.create_this_scheme_fd(0, 0, 0, 0) { -+ Ok(fd) => fd, -+ Err(err) => { -+ eprintln!("fbbootlogd: failed to create log fd: {err}"); -+ std::process::exit(1); -+ } -+ }; - // Add ourself as log sink -- let log_file = libredox::Fd::open( -+ let log_file = match libredox::Fd::open( - "/scheme/log/add_sink", - libredox::flag::O_WRONLY | libredox::flag::O_CLOEXEC, - 0, -- ) -- .expect("fbbootlogd: failed to open log/add_sink"); -- log_file -- .call_wo(&log_fd.to_ne_bytes(), syscall::CallFlags::FD, &[]) -- .expect("fbbootlogd: failed to send log fd to log scheme."); -+ ) { -+ Ok(fd) => fd, -+ Err(err) => { -+ eprintln!("fbbootlogd: failed to open log/add_sink: {err}"); -+ std::process::exit(1); -+ } -+ }; -+ if let Err(err) = -+ log_file.call_wo(&log_fd.to_ne_bytes(), syscall::CallFlags::FD, &[]) -+ { -+ eprintln!("fbbootlogd: failed to send log fd to log scheme: {err}"); -+ std::process::exit(1); -+ } - } - - let _ = daemon.ready_sync_scheme(&socket, &mut scheme); - - // This is not possible for now as fbbootlogd needs to open new displays at runtime for graphics - // driver handoff. In the future inputd may directly pass a handle to the display instead. -- //libredox::call::setrens(0, 0).expect("fbbootlogd: failed to enter null namespace"); - - for event in event_queue { -- match event.expect("fbbootlogd: failed to get event").user_data { -+ let event = match event { -+ Ok(e) => e, -+ Err(err) => { -+ eprintln!("fbbootlogd: failed to get event: {err}"); -+ continue; -+ } -+ }; -+ match event.user_data { - Source::Scheme => loop { -- match handler -- .process_requests_nonblocking(&mut scheme) -- .expect("fbbootlogd: failed to process requests") -- { -- ControlFlow::Continue(()) => {} -- ControlFlow::Break(()) => break, -+ match handler.process_requests_nonblocking(&mut scheme) { -+ Ok(ControlFlow::Continue(())) => {} -+ Ok(ControlFlow::Break(())) => break, -+ Err(err) => { -+ eprintln!("fbbootlogd: failed to process requests: {err}"); -+ break; -+ } - } - }, - Source::Input => { - let mut events = [Event::new(); 16]; - loop { -- match scheme -- .input_handle -- .read_events(&mut events) -- .expect("fbbootlogd: error while reading events") -- { -- ConsumerHandleEvent::Events(&[]) => break, -- ConsumerHandleEvent::Events(events) => { -+ match scheme.input_handle.read_events(&mut events) { -+ Ok(ConsumerHandleEvent::Events(&[])) => break, -+ Ok(ConsumerHandleEvent::Events(events)) => { - for event in events { - scheme.handle_input(&event); - } - } -- ConsumerHandleEvent::Handoff => { -+ Ok(ConsumerHandleEvent::Handoff) => { - eprintln!("fbbootlogd: handoff requested"); - scheme.handle_handoff(); - } -+ Err(err) => { -+ eprintln!("fbbootlogd: error while reading events: {err}"); -+ break; -+ } - } - } - } -diff --git a/drivers/graphics/fbbootlogd/src/scheme.rs b/drivers/graphics/fbbootlogd/src/scheme.rs -index 812c4a5b..9e1869c3 100644 ---- a/drivers/graphics/fbbootlogd/src/scheme.rs -+++ b/drivers/graphics/fbbootlogd/src/scheme.rs -@@ -26,7 +26,13 @@ pub struct FbbootlogScheme { - impl FbbootlogScheme { - pub fn new() -> FbbootlogScheme { - let mut scheme = FbbootlogScheme { -- input_handle: ConsumerHandle::bootlog_vt().expect("fbbootlogd: Failed to open vt"), -+ input_handle: match ConsumerHandle::bootlog_vt() { -+ Ok(handle) => handle, -+ Err(err) => { -+ eprintln!("fbbootlogd: failed to open vt: {err}"); -+ std::process::exit(1); -+ } -+ }, - display_map: None, - text_screen: console_draw::TextScreen::new(), - text_buffer: console_draw::TextBuffer::new(1000), -@@ -42,7 +48,13 @@ impl FbbootlogScheme { - - pub fn handle_handoff(&mut self) { - let new_display_handle = match self.input_handle.open_display_v2() { -- Ok(display) => V2GraphicsHandle::from_file(display).unwrap(), -+ Ok(display) => match V2GraphicsHandle::from_file(display) { -+ Ok(handle) => handle, -+ Err(err) => { -+ eprintln!("fbbootlogd: failed to create graphics handle: {err}"); -+ return; -+ } -+ }, - Err(err) => { - eprintln!("fbbootlogd: No display present yet: {err}"); - return; -@@ -140,7 +152,9 @@ impl FbbootlogScheme { - total_damage = total_damage.merge(damage); - } - } -- map.dirty_fb(total_damage).unwrap(); -+ if let Err(err) = map.dirty_fb(total_damage) { -+ eprintln!("fbbootlogd: failed to flush scrollback damage: {err}"); -+ } - } - - fn handle_resize(map: &mut V2DisplayMap, text_screen: &mut TextScreen) { -@@ -234,7 +248,9 @@ impl SchemeSync for FbbootlogScheme { - let damage = self.text_screen.write(map, buf, &mut VecDeque::new()); - - if let Some(map) = &mut self.display_map { -- map.dirty_fb(damage).unwrap(); -+ if let Err(err) = map.dirty_fb(damage) { -+ eprintln!("fbbootlogd: failed to flush write damage: {err}"); -+ } - } - } - } -diff --git a/drivers/graphics/fbcond/src/display.rs b/drivers/graphics/fbcond/src/display.rs -index eb09b97e..957a6d88 100644 ---- a/drivers/graphics/fbcond/src/display.rs -+++ b/drivers/graphics/fbcond/src/display.rs -@@ -31,7 +31,13 @@ impl Display { - return; - } - }; -- let new_display_handle = V2GraphicsHandle::from_file(display_file).unwrap(); -+ let new_display_handle = match V2GraphicsHandle::from_file(display_file) { -+ Ok(h) => h, -+ Err(err) => { -+ log::error!("fbcond: failed to create display handle: {err}"); -+ return; -+ } -+ }; - - log::debug!("fbcond: Opened new display"); - -@@ -77,7 +83,9 @@ impl Display { - - pub fn sync_rect(&mut self, damage: Damage) { - if let Some(map) = &mut self.map { -- map.dirty_fb(damage).unwrap(); -+ if let Err(err) = map.dirty_fb(damage) { -+ log::error!("fbcond: failed to sync display rect: {err}"); -+ } - } - } - } -diff --git a/drivers/graphics/fbcond/src/main.rs b/drivers/graphics/fbcond/src/main.rs -index eb4f9add..7acc488f 100644 ---- a/drivers/graphics/fbcond/src/main.rs -+++ b/drivers/graphics/fbcond/src/main.rs -@@ -21,7 +21,15 @@ fn main() { - fn daemon(daemon: daemon::SchemeDaemon) -> ! { - let vt_ids = env::args() - .skip(1) -- .map(|arg| arg.parse().expect("invalid vt number")) -+ .filter_map(|arg| { -+ match arg.parse() { -+ Ok(v) => Some(v), -+ Err(_) => { -+ eprintln!("fbcond: invalid vt number '{}', skipping", arg); -+ None -+ } -+ } -+ }) - .collect::>(); - - common::setup_logging( -@@ -31,18 +39,31 @@ fn daemon(daemon: daemon::SchemeDaemon) -> ! { - common::output_level(), - common::file_level(), - ); -- let mut event_queue = EventQueue::new().expect("fbcond: failed to create event queue"); -+ let mut event_queue = match EventQueue::new() { -+ Ok(eq) => eq, -+ Err(err) => { -+ eprintln!("fbcond: failed to create event queue: {}", err); -+ std::process::exit(1); -+ } -+ }; - - // FIXME listen for resize events from inputd and handle them - -- let mut socket = Socket::nonblock().expect("fbcond: failed to create fbcon scheme"); -- event_queue -- .subscribe( -- socket.inner().raw(), -- VtIndex::SCHEMA_SENTINEL, -- event::EventFlags::READ, -- ) -- .expect("fbcond: failed to subscribe to scheme events"); -+ let mut socket = match Socket::nonblock() { -+ Ok(s) => s, -+ Err(err) => { -+ eprintln!("fbcond: failed to create fbcon scheme: {}", err); -+ std::process::exit(1); -+ } -+ }; -+ if let Err(err) = event_queue.subscribe( -+ socket.inner().raw(), -+ VtIndex::SCHEMA_SENTINEL, -+ event::EventFlags::READ, -+ ) { -+ eprintln!("fbcond: failed to subscribe to scheme events: {}", err); -+ std::process::exit(1); -+ } - - let mut state = SchemeState::new(); - let mut scheme = FbconScheme::new(&vt_ids, &mut event_queue); -@@ -51,7 +72,6 @@ fn daemon(daemon: daemon::SchemeDaemon) -> ! { - - // This is not possible for now as fbcond needs to open new displays at runtime for graphics - // driver handoff. In the future inputd may directly pass a handle to the display instead. -- // libredox::call::setrens(0, 0).expect("fbcond: failed to enter null namespace"); - - let mut blocked = Vec::new(); - -@@ -68,7 +88,13 @@ fn daemon(daemon: daemon::SchemeDaemon) -> ! { - } - - for event in event_queue { -- let event = event.expect("fbcond: failed to read event from event queue"); -+ let event = match event { -+ Ok(ev) => ev, -+ Err(err) => { -+ eprintln!("fbcond: failed to read event from event queue: {}", err); -+ continue; -+ } -+ }; - handle_event( - &mut socket, - &mut scheme, -@@ -99,7 +125,10 @@ fn handle_event( - Err(err) if err.errno == EAGAIN => { - break; - } -- Err(err) => panic!("fbcond: failed to read display scheme: {err}"), -+ Err(err) => { -+ eprintln!("fbcond: failed to read display scheme: {err}"); -+ break; -+ } - }; - - match request.kind() { -@@ -108,12 +137,12 @@ fn handle_event( - let mut op = match req.op() { - Ok(op) => op, - Err(req) => { -- let _ = socket -- .write_response( -- Response::err(EOPNOTSUPP, req), -- SignalBehavior::Restart, -- ) -- .expect("fbcond: failed to write responses to fbcon scheme"); -+ if let Err(err) = socket.write_response( -+ Response::err(EOPNOTSUPP, req), -+ SignalBehavior::Restart, -+ ) { -+ eprintln!("fbcond: failed to write response: {}", err); -+ } - continue; - } - }; -@@ -125,25 +154,27 @@ fn handle_event( - blocked.push((op, caller)); - } - SchemeResponse::Regular(r) => { -- let _ = socket -+ if let Err(err) = socket - .write_response(Response::new(r, op), SignalBehavior::Restart) -- .expect("fbcond: failed to write responses to fbcon scheme"); -+ { -+ eprintln!("fbcond: failed to write response: {}", err); -+ } - } - SchemeResponse::Opened(o) => { -- let _ = socket -- .write_response( -- Response::open_dup_like(o, op), -- SignalBehavior::Restart, -- ) -- .expect("fbcond: failed to write responses to fbcon scheme"); -+ if let Err(err) = socket.write_response( -+ Response::open_dup_like(o, op), -+ SignalBehavior::Restart, -+ ) { -+ eprintln!("fbcond: failed to write response: {}", err); -+ } - } - SchemeResponse::RegularAndNotifyOnDetach(status) => { -- let _ = socket -- .write_response( -- Response::new_notify_on_detach(status, op), -- SignalBehavior::Restart, -- ) -- .expect("fbcond: failed to write scheme"); -+ if let Err(err) = socket.write_response( -+ Response::new_notify_on_detach(status, op), -+ SignalBehavior::Restart, -+ ) { -+ eprintln!("fbcond: failed to write response: {}", err); -+ } - } - } - } -@@ -157,25 +188,32 @@ fn handle_event( - { - let (blocked_req, _) = blocked.remove(i); - let resp = Response::err(EINTR, blocked_req); -- socket -- .write_response(resp, SignalBehavior::Restart) -- .expect("vesad: failed to write display scheme"); -+ if let Err(err) = -+ socket.write_response(resp, SignalBehavior::Restart) -+ { -+ eprintln!("fbcond: failed to write cancellation response: {}", err); -+ } - } - } - _ => {} - } - }, - vt_i => { -- let vt = scheme.vts.get_mut(&vt_i).unwrap(); -+ let Some(vt) = scheme.vts.get_mut(&vt_i) else { -+ eprintln!("fbcond: unknown vt index {:?}", vt_i); -+ return; -+ }; - - let mut events = [Event::new(); 16]; - loop { -- match vt -- .display -- .input_handle -- .read_events(&mut events) -- .expect("fbcond: Error while reading events") -- { -+ let read_result = match vt.display.input_handle.read_events(&mut events) { -+ Ok(r) => r, -+ Err(err) => { -+ eprintln!("fbcond: error while reading events: {}", err); -+ break; -+ } -+ }; -+ match read_result { - ConsumerHandleEvent::Events(&[]) => break, - - ConsumerHandleEvent::Events(events) => { -@@ -193,9 +231,9 @@ fn handle_event( - { - let mut i = 0; - while i < blocked.len() { -- let (op, caller) = blocked -- .get_mut(i) -- .expect("vesad: Failed to get blocked request"); -+ let Some((op, caller)) = blocked.get_mut(i) else { -+ break; -+ }; - let resp = match op.handle_sync_dont_consume(&caller, scheme, state) { - SchemeResponse::Opened(Err(e)) | SchemeResponse::Regular(Err(e)) - if libredox::error::Error::from(e).is_wouldblock() -@@ -217,9 +255,9 @@ fn handle_event( - Response::new_notify_on_detach(status, op) - } - }; -- let _ = socket -- .write_response(resp, SignalBehavior::Restart) -- .expect("vesad: failed to write display scheme"); -+ if let Err(err) = socket.write_response(resp, SignalBehavior::Restart) { -+ eprintln!("fbcond: failed to write blocked response: {}", err); -+ } - } - } - -@@ -242,9 +280,9 @@ fn handle_event( - if !handle.notified_read { - handle.notified_read = true; - let response = Response::post_fevent(*handle_id, EVENT_READ.bits()); -- socket -- .write_response(response, SignalBehavior::Restart) -- .expect("fbcond: failed to write display event"); -+ if let Err(err) = socket.write_response(response, SignalBehavior::Restart) { -+ eprintln!("fbcond: failed to write display event: {}", err); -+ } - } - } else { - handle.notified_read = false; -diff --git a/drivers/graphics/fbcond/src/scheme.rs b/drivers/graphics/fbcond/src/scheme.rs -index 1bee134e..973ff31e 100644 ---- a/drivers/graphics/fbcond/src/scheme.rs -+++ b/drivers/graphics/fbcond/src/scheme.rs -@@ -6,7 +6,7 @@ use redox_scheme::scheme::SchemeSync; - use redox_scheme::{CallerCtx, OpenResult}; - use scheme_utils::{FpathWriter, HandleMap}; - use syscall::schemev2::NewFdFlags; --use syscall::{Error, EventFlags, Result, EACCES, EAGAIN, EBADF, ENOENT, O_NONBLOCK}; -+use syscall::{Error, EventFlags, Result, EACCES, EAGAIN, EBADF, EINVAL, ENOENT, O_NONBLOCK}; - - use crate::display::Display; - use crate::text::TextScreen; -@@ -50,14 +50,21 @@ impl FbconScheme { - let mut vts = BTreeMap::new(); - - for &vt_i in vt_ids { -- let display = Display::open_new_vt().expect("Failed to open display for vt"); -- event_queue -- .subscribe( -- display.input_handle.event_handle().as_raw_fd() as usize, -- VtIndex(vt_i), -- event::EventFlags::READ, -- ) -- .expect("Failed to subscribe to input events for vt"); -+ let display = match Display::open_new_vt() { -+ Ok(d) => d, -+ Err(err) => { -+ eprintln!("fbcond: failed to open display for vt {}: {}", vt_i, err); -+ continue; -+ } -+ }; -+ if let Err(err) = event_queue.subscribe( -+ display.input_handle.event_handle().as_raw_fd() as usize, -+ VtIndex(vt_i), -+ event::EventFlags::READ, -+ ) { -+ eprintln!("fbcond: failed to subscribe to input events for vt {}: {}", vt_i, err); -+ continue; -+ } - vts.insert(VtIndex(vt_i), TextScreen::new(display)); - } - -@@ -127,7 +134,7 @@ impl SchemeSync for FbconScheme { - fn fpath(&mut self, id: usize, buf: &mut [u8], _ctx: &CallerCtx) -> Result { - FpathWriter::with_legacy(buf, "fbcon", |w| { - let handle = self.get_vt_handle_mut(id)?; -- write!(w, "{}", handle.vt_i.0).unwrap(); -+ write!(w, "{}", handle.vt_i.0).map_err(|_| Error::new(EINVAL))?; - Ok(()) - }) - } -diff --git a/drivers/graphics/fbcond/src/text.rs b/drivers/graphics/fbcond/src/text.rs -index 8a24bbeb..c7272ab7 100644 ---- a/drivers/graphics/fbcond/src/text.rs -+++ b/drivers/graphics/fbcond/src/text.rs -@@ -113,7 +113,7 @@ impl TextScreen { - let mut i = 0; - - while i < buf.len() && !self.input.is_empty() { -- buf[i] = self.input.pop_front().unwrap(); -+ buf[i] = self.input.pop_front().unwrap_or(0); - i += 1; - } - -diff --git a/drivers/graphics/graphics-ipc/src/lib.rs b/drivers/graphics/graphics-ipc/src/lib.rs -index 285b3043..7451c90a 100644 ---- a/drivers/graphics/graphics-ipc/src/lib.rs -+++ b/drivers/graphics/graphics-ipc/src/lib.rs -@@ -29,12 +29,16 @@ impl drm::control::Device for V2GraphicsHandle {} - impl V2GraphicsHandle { - pub fn from_file(file: File) -> io::Result { - let handle = V2GraphicsHandle { file }; -- assert!(handle.get_driver_capability(DriverCapability::DumbBuffer)? == 1); -+ if handle.get_driver_capability(DriverCapability::DumbBuffer)? != 1 { -+ return Err(io::Error::other( -+ "graphics device does not support dumb buffers", -+ )); -+ } - Ok(handle) - } - - pub fn first_display(&self) -> io::Result { -- for &connector in self.resource_handles().unwrap().connectors() { -+ for &connector in self.resource_handles()?.connectors() { - if self.get_connector(connector, true)?.state() == State::Connected { - return Ok(connector); - } -@@ -95,13 +99,28 @@ impl CpuBackedBuffer { - return; // No shadow buffer; all writes are already propagated to the GPU. - }; - -- assert!(x.checked_add(width).unwrap() <= self.buffer.size().0); -- assert!(y.checked_add(height).unwrap() <= self.buffer.size().1); -+ let Some(x_end) = x.checked_add(width) else { -+ return; -+ }; -+ let Some(y_end) = y.checked_add(height) else { -+ return; -+ }; -+ if x_end > self.buffer.size().0 || y_end > self.buffer.size().1 { -+ return; -+ } - -- let start_x: usize = x.try_into().unwrap(); -- let start_y: usize = y.try_into().unwrap(); -- let w: usize = width.try_into().unwrap(); -- let h: usize = height.try_into().unwrap(); -+ let Ok(start_x) = usize::try_from(x) else { -+ return; -+ }; -+ let Ok(start_y) = usize::try_from(y) else { -+ return; -+ }; -+ let Ok(w) = usize::try_from(width) else { -+ return; -+ }; -+ let Ok(h) = usize::try_from(height) else { -+ return; -+ }; - - let offscreen_ptr = shadow.as_ptr().cast::(); - let onscreen_ptr = self.map.as_mut_ptr().cast::(); -diff --git a/drivers/graphics/ihdgd/config.toml b/drivers/graphics/ihdgd/config.toml -index acbb4e78..210731ae 100644 ---- a/drivers/graphics/ihdgd/config.toml -+++ b/drivers/graphics/ihdgd/config.toml -@@ -51,5 +51,26 @@ ids = { 0x8086 = [ - 0x56B3, # Pro A60 - 0x56C0, # GPU Flex 170 - 0x56C1, # GPU Flex 140 -+ # Alder Lake-S Desktop -+ 0x4680, 0x4682, 0x4688, 0x468A, 0x468B, -+ 0x4690, 0x4692, 0x4693, -+ # Alder Lake-P Mobile -+ 0x46A0, 0x46A1, 0x46A2, 0x46A3, 0x46A6, -+ 0x46A8, 0x46AA, 0x462A, 0x4626, 0x4628, -+ 0x46B0, 0x46B1, 0x46B2, 0x46B3, -+ 0x46C0, 0x46C1, 0x46C2, 0x46C3, -+ # Alder Lake-N Low-Power -+ 0x46D0, 0x46D1, 0x46D2, 0x46D3, 0x46D4, -+ # Raptor Lake-S Desktop -+ 0xA780, 0xA781, 0xA782, 0xA783, -+ 0xA788, 0xA789, 0xA78A, 0xA78B, -+ # Raptor Lake-P Mobile -+ 0xA720, 0xA7A0, 0xA7A8, 0xA7AA, 0xA7AB, -+ # Raptor Lake-U Mobile -+ 0xA721, 0xA7A1, 0xA7A9, 0xA7AC, 0xA7AD, -+ # Meteor Lake -+ 0x7D40, 0x7D45, 0x7D55, 0x7D60, 0x7DD5, -+ # Arrow Lake-H -+ 0x7D51, 0x7DD1, - ] } - command = ["ihdgd"] -diff --git a/drivers/graphics/ihdgd/src/device/ddi.rs b/drivers/graphics/ihdgd/src/device/ddi.rs -index ac4ce1bd..b851d169 100644 ---- a/drivers/graphics/ihdgd/src/device/ddi.rs -+++ b/drivers/graphics/ihdgd/src/device/ddi.rs -@@ -347,9 +347,12 @@ impl Ddi { - - // Last setting is the default - //TODO: get correct setting index from BIOS -- let setting = settings.last().unwrap(); -+ let Some(setting) = settings.last() else { -+ log::error!("no voltage swing settings available"); -+ return Err(Error::new(EIO)); -+ }; - -- // This allows unwraps on port functions below without panic -+ // All port registers below require port_base to be set (checked above) - if self.port_base.is_none() { - log::error!("HDMI voltage swing procedure only implemented on combo DDI"); - return Err(Error::new(EIO)); -@@ -358,9 +361,15 @@ impl Ddi { - // Clear cmnkeeper_enable for HDMI - { - // It is not possible to read from GRP register, so use LN0 as template -- let pcs_dw1_ln0 = self.port_pcs(PortPcsReg::Dw1, PortLane::Ln0).unwrap(); -- let mut pcs_dw1_grp = -- WriteOnly::new(self.port_pcs(PortPcsReg::Dw1, PortLane::Grp).unwrap()); -+ let Some(pcs_dw1_ln0) = self.port_pcs(PortPcsReg::Dw1, PortLane::Ln0) else { -+ log::error!("failed to get PCS_DW1_LN0 for DDI {}", self.name); -+ return Err(Error::new(EIO)); -+ }; -+ let Some(pcs_dw1_grp_raw) = self.port_pcs(PortPcsReg::Dw1, PortLane::Grp) else { -+ log::error!("failed to get PCS_DW1_GRP for DDI {}", self.name); -+ return Err(Error::new(EIO)); -+ }; -+ let mut pcs_dw1_grp = WriteOnly::new(pcs_dw1_grp_raw); - let mut v = pcs_dw1_ln0.read(); - v &= !PORT_PCS_DW1_CMNKEEPER_ENABLE; - pcs_dw1_grp.write(v); -@@ -369,28 +378,50 @@ impl Ddi { - // Program loadgen select - //TODO: this assumes bit rate <= 6 GHz and 4 lanes enabled - { -- let mut tx_dw4_ln0 = self.port_tx(PortTxReg::Dw4, PortLane::Ln0).unwrap(); -+ let Some(mut tx_dw4_ln0) = self.port_tx(PortTxReg::Dw4, PortLane::Ln0) else { -+ log::error!("failed to get TX_DW4_LN0 for DDI {}", self.name); -+ return Err(Error::new(EIO)); -+ }; - tx_dw4_ln0.writef(PORT_TX_DW4_SELECT, false); - -- let mut tx_dw4_ln1 = self.port_tx(PortTxReg::Dw4, PortLane::Ln1).unwrap(); -+ let Some(mut tx_dw4_ln1) = self.port_tx(PortTxReg::Dw4, PortLane::Ln1) else { -+ log::error!("failed to get TX_DW4_LN1 for DDI {}", self.name); -+ return Err(Error::new(EIO)); -+ }; - tx_dw4_ln1.writef(PORT_TX_DW4_SELECT, true); - -- let mut tx_dw4_ln2 = self.port_tx(PortTxReg::Dw4, PortLane::Ln2).unwrap(); -+ let Some(mut tx_dw4_ln2) = self.port_tx(PortTxReg::Dw4, PortLane::Ln2) else { -+ log::error!("failed to get TX_DW4_LN2 for DDI {}", self.name); -+ return Err(Error::new(EIO)); -+ }; - tx_dw4_ln2.writef(PORT_TX_DW4_SELECT, true); - -- let mut tx_dw4_ln3 = self.port_tx(PortTxReg::Dw4, PortLane::Ln3).unwrap(); -+ let Some(mut tx_dw4_ln3) = self.port_tx(PortTxReg::Dw4, PortLane::Ln3) else { -+ log::error!("failed to get TX_DW4_LN3 for DDI {}", self.name); -+ return Err(Error::new(EIO)); -+ }; - tx_dw4_ln3.writef(PORT_TX_DW4_SELECT, true); - } - - // Set PORT_CL_DW5 sus clock config to 11b - { -- let mut cl_dw5 = self.port_cl(PortClReg::Dw5).unwrap(); -+ let Some(mut cl_dw5) = self.port_cl(PortClReg::Dw5) else { -+ log::error!("failed to get CL_DW5 for DDI {}", self.name); -+ return Err(Error::new(EIO)); -+ }; - cl_dw5.writef(PORT_CL_DW5_SUS_CLOCK_MASK, true); - } - - // Clear training enable to change swing values -- let tx_dw5_ln0 = self.port_tx(PortTxReg::Dw5, PortLane::Ln0).unwrap(); -- let mut tx_dw5_grp = WriteOnly::new(self.port_tx(PortTxReg::Dw5, PortLane::Grp).unwrap()); -+ let Some(tx_dw5_ln0) = self.port_tx(PortTxReg::Dw5, PortLane::Ln0) else { -+ log::error!("failed to get TX_DW5_LN0 for DDI {}", self.name); -+ return Err(Error::new(EIO)); -+ }; -+ let Some(tx_dw5_grp_raw) = self.port_tx(PortTxReg::Dw5, PortLane::Grp) else { -+ log::error!("failed to get TX_DW5_GRP for DDI {}", self.name); -+ return Err(Error::new(EIO)); -+ }; -+ let mut tx_dw5_grp = WriteOnly::new(tx_dw5_grp_raw); - { - let mut v = tx_dw5_ln0.read(); - v &= !PORT_TX_DW5_TRAINING_ENABLE; -@@ -400,7 +431,10 @@ impl Ddi { - // Program swing and de-emphasis - - // Disable eDP bits in PORT_CL_DW10 -- let mut cl_dw10 = self.port_cl(PortClReg::Dw10).unwrap(); -+ let Some(mut cl_dw10) = self.port_cl(PortClReg::Dw10) else { -+ log::error!("failed to get CL_DW10 for DDI {}", self.name); -+ return Err(Error::new(EIO)); -+ }; - cl_dw10.writef( - PORT_CL_DW10_EDP4K2K_MODE_OVRD_EN | PORT_CL_DW10_EDP4K2K_MODE_OVRD_VAL, - false, -@@ -435,7 +469,10 @@ impl Ddi { - // - Set swing sel from settings - // - Set rcomp scalar to 0x98 - for lane in lanes { -- let mut tx_dw2 = self.port_tx(PortTxReg::Dw2, lane).unwrap(); -+ let Some(mut tx_dw2) = self.port_tx(PortTxReg::Dw2, lane) else { -+ log::error!("failed to get TX_DW2 for {:?} on DDI {}", lane, self.name); -+ continue; -+ }; - let mut v = tx_dw2.read(); - v &= !(PORT_TX_DW2_SWING_SEL_UPPER_MASK - | PORT_TX_DW2_SWING_SEL_LOWER_MASK -@@ -451,7 +488,10 @@ impl Ddi { - // - Set post cursor 2 to 0x0 - // - Set cursor coeff from settings - for lane in lanes { -- let mut tx_dw4 = self.port_tx(PortTxReg::Dw4, lane).unwrap(); -+ let Some(mut tx_dw4) = self.port_tx(PortTxReg::Dw4, lane) else { -+ log::error!("failed to get TX_DW4 for {:?} on DDI {}", lane, self.name); -+ continue; -+ }; - let mut v = tx_dw4.read(); - v &= !(PORT_TX_DW4_POST_CURSOR_1_MASK - | PORT_TX_DW4_POST_CURSOR_2_MASK -@@ -464,7 +504,10 @@ impl Ddi { - // For PORT_TX_DW7: - // - Set n scalar from settings - for lane in lanes { -- let mut tx_dw7 = self.port_tx(PortTxReg::Dw7, lane).unwrap(); -+ let Some(mut tx_dw7) = self.port_tx(PortTxReg::Dw7, lane) else { -+ log::error!("failed to get TX_DW7 for {:?} on DDI {}", lane, self.name); -+ continue; -+ }; - // All other bits are spare - tx_dw7.write(setting.dw7_n_scalar << PORT_TX_DW7_N_SCALAR_SHIFT); - } -diff --git a/drivers/graphics/ihdgd/src/device/ggtt.rs b/drivers/graphics/ihdgd/src/device/ggtt.rs -index 5e39827a..0ec5358b 100644 ---- a/drivers/graphics/ihdgd/src/device/ggtt.rs -+++ b/drivers/graphics/ihdgd/src/device/ggtt.rs -@@ -3,7 +3,7 @@ use std::{mem, ptr}; - - use pcid_interface::PciFunctionHandle; - use range_alloc::RangeAllocator; --use syscall::{Error, EIO}; -+use syscall::{Error, EIO, EINVAL}; - - use crate::device::MmioRegion; - -@@ -88,20 +88,36 @@ impl GlobalGtt { - } - } - -- pub fn reserve(&mut self, surf: u32, surf_size: u32) { -- assert!(surf.is_multiple_of(GTT_PAGE_SIZE)); -- assert!(surf_size.is_multiple_of(GTT_PAGE_SIZE)); -+ pub fn reserve(&mut self, surf: u32, surf_size: u32) -> syscall::Result<()> { -+ if !surf.is_multiple_of(GTT_PAGE_SIZE) { -+ log::error!( -+ "reserve: surface address 0x{:x} is not aligned to GTT page size", -+ surf -+ ); -+ return Err(Error::new(EINVAL)); -+ } -+ if !surf_size.is_multiple_of(GTT_PAGE_SIZE) { -+ log::error!( -+ "reserve: surface size 0x{:x} is not aligned to GTT page size", -+ surf_size -+ ); -+ return Err(Error::new(EINVAL)); -+ } - -- self.gm_alloc -- .allocate_exact_range( -- surf / GTT_PAGE_SIZE..surf / GTT_PAGE_SIZE + surf_size / GTT_PAGE_SIZE, -- ) -- .unwrap_or_else(|err| { -- panic!( -+ match self.gm_alloc.allocate_exact_range( -+ surf / GTT_PAGE_SIZE..surf / GTT_PAGE_SIZE + surf_size / GTT_PAGE_SIZE, -+ ) { -+ Ok(_range) => Ok(()), -+ Err(err) => { -+ log::error!( - "failed to allocate pre-existing surface at 0x{:x} of size {}: {:?}", -- surf, surf_size, err -+ surf, -+ surf_size, -+ err - ); -- }); -+ Err(Error::new(EIO)) -+ } -+ } - } - - pub fn alloc_phys_mem(&mut self, size: u32) -> syscall::Result { -diff --git a/drivers/graphics/ihdgd/src/device/mod.rs b/drivers/graphics/ihdgd/src/device/mod.rs -index ced9dd56..fc2a1108 100644 ---- a/drivers/graphics/ihdgd/src/device/mod.rs -+++ b/drivers/graphics/ihdgd/src/device/mod.rs -@@ -51,8 +51,9 @@ impl<'a, T, F: FnOnce(&mut T)> CallbackGuard<'a, T, F> { - - impl<'a, T, F: FnOnce(&mut T)> Drop for CallbackGuard<'a, T, F> { - fn drop(&mut self) { -- let fini = self.fini.take().unwrap(); -- fini(&mut self.value); -+ if let Some(fini) = self.fini.take() { -+ fini(&mut self.value); -+ } - } - } - -@@ -246,7 +247,9 @@ impl Device { - }; - - let gttmm = { -- let (phys, size) = func.bars[0].expect_mem(); -+ let (phys, size) = func.bars[0] -+ .try_mem() -+ .map_err(|_| Error::new(ENODEV))?; - Arc::new(MmioRegion::new( - phys, - size, -@@ -255,7 +258,9 @@ impl Device { - }; - log::info!("GTTMM {:X?}", gttmm); - let gm = { -- let (phys, size) = func.bars[2].expect_mem(); -+ let (phys, size) = func.bars[2] -+ .try_mem() -+ .map_err(|_| Error::new(ENODEV))?; - MmioRegion::new(phys, size, common::MemoryType::WriteCombining)? - }; - log::info!("GM {:X?}", gm); -@@ -453,7 +458,12 @@ impl Device { - // Probe all DDIs - let ddi_names: Vec<&str> = self.ddis.iter().map(|ddi| ddi.name).collect(); - for ddi_name in ddi_names { -- self.probe_ddi(ddi_name).expect("failed to probe DDI"); -+ match self.probe_ddi(ddi_name) { -+ Ok(_) => {} -+ Err(err) => { -+ log::error!("failed to probe DDI {}: {}", ddi_name, err); -+ } -+ } - } - - self.dump(); -diff --git a/drivers/graphics/ihdgd/src/device/pipe.rs b/drivers/graphics/ihdgd/src/device/pipe.rs -index 0e99ffe4..59d1b383 100644 ---- a/drivers/graphics/ihdgd/src/device/pipe.rs -+++ b/drivers/graphics/ihdgd/src/device/pipe.rs -@@ -122,7 +122,13 @@ impl Plane { - let surf = self.surf.read() & 0xFFFFF000; - //TODO: read bits per pixel - let surf_size = (stride * height).next_multiple_of(4096); -- ggtt.reserve(surf, surf_size); -+ ggtt.reserve(surf, surf_size).unwrap_or_else(|err| { -+ log::warn!( -+ "failed to reserve GTT entries for existing framebuffer at 0x{:x}: {}", -+ surf, -+ err -+ ); -+ }); - - unsafe { DeviceFb::new(gm, surf, width, height, stride, true) } - } -diff --git a/drivers/graphics/ihdgd/src/device/scheme.rs b/drivers/graphics/ihdgd/src/device/scheme.rs -index 95db5bbf..3554a35e 100644 ---- a/drivers/graphics/ihdgd/src/device/scheme.rs -+++ b/drivers/graphics/ihdgd/src/device/scheme.rs -@@ -68,7 +68,20 @@ impl GraphicsAdapter for Device { - } - - fn probe_connector(&mut self, objects: &mut KmsObjects, id: KmsObjectId) { -- let mut connector = objects.get_connector(id).unwrap().lock().unwrap(); -+ let connector_guard = match objects.get_connector(id) { -+ Ok(guard) => guard, -+ Err(e) => { -+ log::error!("probe_connector: connector {:?} not found: {}", id, e); -+ return; -+ } -+ }; -+ let mut connector = match connector_guard.lock() { -+ Ok(guard) => guard, -+ Err(err) => { -+ log::error!("probe_connector: failed to lock connector {:?}: {}", id, err); -+ return; -+ } -+ }; - let framebuffer = &self.framebuffers[connector.driver_data.framebuffer_id]; - connector.connection = KmsConnectorStatus::Connected; - connector.update_from_size(framebuffer.width as u32, framebuffer.height as u32); -@@ -94,7 +107,10 @@ impl GraphicsAdapter for Device { - state: KmsCrtcState, - damage: Damage, - ) -> syscall::Result<()> { -- let mut crtc = crtc.lock().unwrap(); -+ let mut crtc = crtc.lock().map_err(|err| { -+ log::error!("set_crtc: failed to lock crtc: {}", err); -+ syscall::Error::new(EINVAL) -+ })?; - let buffer = state - .fb_id - .map(|fb_id| objects.get_framebuffer(fb_id)) -@@ -102,7 +118,13 @@ impl GraphicsAdapter for Device { - crtc.state = state; - - for connector in objects.connectors() { -- let connector = connector.lock().unwrap(); -+ let connector = match connector.lock() { -+ Ok(c) => c, -+ Err(err) => { -+ log::error!("set_crtc: failed to lock connector: {}", err); -+ continue; -+ } -+ }; - - if connector.state.crtc_id != objects.crtc_ids()[crtc.crtc_index as usize] { - continue; -@@ -161,9 +183,9 @@ impl DumbFb { - fn layout(len: usize) -> Layout { - // optimizes to an integer mul - Layout::array::(len) -- .unwrap() -+ .unwrap_or_else(|_| Layout::from_size_align(len * 4, PAGE_SIZE).unwrap_or(Layout::new::())) - .align_to(PAGE_SIZE) -- .unwrap() -+ .unwrap_or_else(|_| Layout::new::().align_to(PAGE_SIZE).unwrap_or(Layout::new::())) - } - } - -@@ -182,15 +204,38 @@ impl Buffer for DumbFb { - - impl DumbFb { - fn sync(&self, framebuffer: &mut DeviceFb, sync_rect: Damage) { -- let sync_rect = sync_rect.clip( -- self.width.try_into().unwrap(), -- self.height.try_into().unwrap(), -- ); -- -- let start_x: usize = sync_rect.x.try_into().unwrap(); -- let start_y: usize = sync_rect.y.try_into().unwrap(); -- let w: usize = sync_rect.width.try_into().unwrap(); -- let h: usize = sync_rect.height.try_into().unwrap(); -+ let fb_w: u32 = match self.width.try_into() { -+ Ok(v) => v, -+ Err(_) => { -+ log::error!("sync: framebuffer width {} overflow", self.width); -+ return; -+ } -+ }; -+ let fb_h: u32 = match self.height.try_into() { -+ Ok(v) => v, -+ Err(_) => { -+ log::error!("sync: framebuffer height {} overflow", self.height); -+ return; -+ } -+ }; -+ let sync_rect = sync_rect.clip(fb_w, fb_h); -+ -+ let start_x: usize = match sync_rect.x.try_into() { -+ Ok(v) => v, -+ Err(_) => return, -+ }; -+ let start_y: usize = match sync_rect.y.try_into() { -+ Ok(v) => v, -+ Err(_) => return, -+ }; -+ let w: usize = match sync_rect.width.try_into() { -+ Ok(v) => v, -+ Err(_) => return, -+ }; -+ let h: usize = match sync_rect.height.try_into() { -+ Ok(v) => v, -+ Err(_) => return, -+ }; - - let offscreen_ptr = self.ptr.as_ptr() as *mut u32; - let onscreen_ptr = framebuffer.buffer.virt.cast::(); -diff --git a/drivers/graphics/ihdgd/src/main.rs b/drivers/graphics/ihdgd/src/main.rs -index a8b6cc60..84d58a3e 100644 ---- a/drivers/graphics/ihdgd/src/main.rs -+++ b/drivers/graphics/ihdgd/src/main.rs -@@ -1,6 +1,6 @@ - use driver_graphics::GraphicsScheme; - use event::{user_data, EventQueue}; --use pcid_interface::{irq_helpers::pci_allocate_interrupt_vector, PciFunctionHandle}; -+use pcid_interface::{irq_helpers::try_pci_allocate_interrupt_vector, PciFunctionHandle}; - use std::{ - io::{Read, Write}, - os::fd::AsRawFd, -@@ -29,16 +29,32 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! { - - log::info!("IHDG {}", pci_config.func.display()); - -- let device = Device::new(&mut pcid_handle, &pci_config.func) -- .expect("ihdgd: failed to initialize device"); -+ let device = match Device::new(&mut pcid_handle, &pci_config.func) { -+ Ok(device) => device, -+ Err(err) => { -+ log::error!("ihdgd: failed to initialize device: {err}"); -+ std::process::exit(1); -+ } -+ }; - -- let irq_file = pci_allocate_interrupt_vector(&mut pcid_handle, "ihdgd"); -+ let irq_file = match try_pci_allocate_interrupt_vector(&mut pcid_handle, "ihdgd") { -+ Ok(irq) => irq, -+ Err(err) => { -+ log::error!("ihdgd: failed to allocate interrupt vector: {err}"); -+ std::process::exit(1); -+ } -+ }; - - // Needs to be before GraphicsScheme::new to avoid a deadlock due to initnsmgr blocking on - // /scheme/event as it is already blocked on opening /scheme/display.ihdg.*. - // FIXME change the initnsmgr to not block on openat for the target scheme. -- let event_queue: EventQueue = -- EventQueue::new().expect("ihdgd: failed to create event queue"); -+ let event_queue: EventQueue = match EventQueue::new() { -+ Ok(eq) => eq, -+ Err(err) => { -+ log::error!("ihdgd: failed to create event queue: {err}"); -+ std::process::exit(1); -+ } -+ }; - - let mut scheme = GraphicsScheme::new(device, format!("display.ihdg.{}", name), false); - -@@ -50,53 +66,69 @@ fn daemon(daemon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> ! { - } - } - -- event_queue -- .subscribe( -- scheme.inputd_event_handle().as_raw_fd() as usize, -- Source::Input, -- event::EventFlags::READ, -- ) -- .unwrap(); -- event_queue -- .subscribe( -- irq_file.irq_handle().as_raw_fd() as usize, -- Source::Irq, -- event::EventFlags::READ, -- ) -- .unwrap(); -- event_queue -- .subscribe( -- scheme.event_handle().raw(), -- Source::Scheme, -- event::EventFlags::READ, -- ) -- .unwrap(); -- -- libredox::call::setrens(0, 0).expect("ihdgd: failed to enter null namespace"); -+ if let Err(err) = event_queue.subscribe( -+ scheme.inputd_event_handle().as_raw_fd() as usize, -+ Source::Input, -+ event::EventFlags::READ, -+ ) { -+ log::error!("ihdgd: failed to subscribe to input events: {err}"); -+ } -+ if let Err(err) = event_queue.subscribe( -+ irq_file.irq_handle().as_raw_fd() as usize, -+ Source::Irq, -+ event::EventFlags::READ, -+ ) { -+ log::error!("ihdgd: failed to subscribe to IRQ events: {err}"); -+ } -+ if let Err(err) = event_queue.subscribe( -+ scheme.event_handle().raw(), -+ Source::Scheme, -+ event::EventFlags::READ, -+ ) { -+ log::error!("ihdgd: failed to subscribe to scheme events: {err}"); -+ } -+ -+ if let Err(err) = libredox::call::setrens(0, 0) { -+ log::error!("ihdgd: failed to enter null namespace: {err}"); -+ std::process::exit(1); -+ } - - daemon.ready(); - - let all = [Source::Input, Source::Irq, Source::Scheme]; -- for event in all -- .into_iter() -- .chain(event_queue.map(|e| e.expect("ihdgd: failed to get next event").user_data)) -- { -+ for event in all.into_iter().chain( -+ event_queue.filter_map(|e| match e { -+ Ok(event) => Some(event.user_data), -+ Err(err) => { -+ log::error!("ihdgd: failed to get next event: {err}"); -+ None -+ } -+ }), -+ ) { - match event { - Source::Input => scheme.handle_vt_events(), - Source::Irq => { - let mut irq = [0; 8]; -- irq_file.irq_handle().read(&mut irq).unwrap(); -+ if irq_file.irq_handle().read(&mut irq).is_err() { -+ log::error!("ihdgd: failed to read IRQ"); -+ continue; -+ } - if scheme.adapter_mut().handle_irq() { -- irq_file.irq_handle().write(&mut irq).unwrap(); -+ if let Err(err) = irq_file.irq_handle().write(&mut irq) { -+ log::error!("ihdgd: failed to write IRQ: {err}"); -+ continue; -+ } - - scheme.adapter_mut().handle_events(); -- scheme.tick().unwrap(); -+ if let Err(err) = scheme.tick() { -+ log::error!("ihdgd: failed to handle display events after IRQ: {err}"); -+ } - } - } - Source::Scheme => { -- scheme -- .tick() -- .expect("ihdgd: failed to handle scheme events"); -+ if let Err(err) = scheme.tick() { -+ log::error!("ihdgd: failed to handle scheme events: {err}"); -+ } - } - } - } -diff --git a/drivers/graphics/vesad/src/main.rs b/drivers/graphics/vesad/src/main.rs -index a4c07d1e..41faa0e2 100644 ---- a/drivers/graphics/vesad/src/main.rs -+++ b/drivers/graphics/vesad/src/main.rs -@@ -23,25 +23,49 @@ fn daemon(daemon: daemon::Daemon) -> ! { - } - - let width = usize::from_str_radix( -- &env::var("FRAMEBUFFER_WIDTH").expect("FRAMEBUFFER_WIDTH not set"), -+ &env::var("FRAMEBUFFER_WIDTH").unwrap_or_else(|_| { -+ eprintln!("vesad: FRAMEBUFFER_WIDTH not set"); -+ std::process::exit(1); -+ }), - 16, - ) -- .expect("failed to parse FRAMEBUFFER_WIDTH"); -+ .unwrap_or_else(|err| { -+ eprintln!("vesad: failed to parse FRAMEBUFFER_WIDTH: {}", err); -+ std::process::exit(1); -+ }); - let height = usize::from_str_radix( -- &env::var("FRAMEBUFFER_HEIGHT").expect("FRAMEBUFFER_HEIGHT not set"), -+ &env::var("FRAMEBUFFER_HEIGHT").unwrap_or_else(|_| { -+ eprintln!("vesad: FRAMEBUFFER_HEIGHT not set"); -+ std::process::exit(1); -+ }), - 16, - ) -- .expect("failed to parse FRAMEBUFFER_HEIGHT"); -+ .unwrap_or_else(|err| { -+ eprintln!("vesad: failed to parse FRAMEBUFFER_HEIGHT: {}", err); -+ std::process::exit(1); -+ }); - let phys = usize::from_str_radix( -- &env::var("FRAMEBUFFER_ADDR").expect("FRAMEBUFFER_ADDR not set"), -+ &env::var("FRAMEBUFFER_ADDR").unwrap_or_else(|_| { -+ eprintln!("vesad: FRAMEBUFFER_ADDR not set"); -+ std::process::exit(1); -+ }), - 16, - ) -- .expect("failed to parse FRAMEBUFFER_ADDR"); -+ .unwrap_or_else(|err| { -+ eprintln!("vesad: failed to parse FRAMEBUFFER_ADDR: {}", err); -+ std::process::exit(1); -+ }); - let stride = usize::from_str_radix( -- &env::var("FRAMEBUFFER_STRIDE").expect("FRAMEBUFFER_STRIDE not set"), -+ &env::var("FRAMEBUFFER_STRIDE").unwrap_or_else(|_| { -+ eprintln!("vesad: FRAMEBUFFER_STRIDE not set"); -+ std::process::exit(1); -+ }), - 16, - ) -- .expect("failed to parse FRAMEBUFFER_STRIDE"); -+ .unwrap_or_else(|err| { -+ eprintln!("vesad: failed to parse FRAMEBUFFER_STRIDE: {}", err); -+ std::process::exit(1); -+ }); - - println!( - "vesad: {}x{} stride {} at 0x{:X}", -@@ -57,14 +81,20 @@ fn daemon(daemon: daemon::Daemon) -> ! { - let mut framebuffers = vec![unsafe { FrameBuffer::new(phys, width, height, stride) }]; - - //TODO: ideal maximum number of outputs? -- let bootloader_env = std::fs::read_to_string("/scheme/sys/env") -- .expect("failed to read env") -- .lines() -- .map(|line| { -- let (env, value) = line.split_once('=').unwrap(); -- (env.to_owned(), value.to_owned()) -- }) -- .collect::>(); -+ let bootloader_env: HashMap = -+ match std::fs::read_to_string("/scheme/sys/env") { -+ Ok(content) => content -+ .lines() -+ .filter_map(|line| { -+ let (env, value) = line.split_once('=')?; -+ Some((env.to_owned(), value.to_owned())) -+ }) -+ .collect(), -+ Err(err) => { -+ eprintln!("vesad: failed to read bootloader env: {}", err); -+ HashMap::new() -+ } -+ }; - for i in 1..1024 { - match bootloader_env.get(&format!("FRAMEBUFFER{}", i)) { - Some(var) => match unsafe { FrameBuffer::parse(&var) } { -@@ -93,38 +123,51 @@ fn daemon(daemon: daemon::Daemon) -> ! { - } - } - -- let event_queue: EventQueue = -- EventQueue::new().expect("vesad: failed to create event queue"); -- event_queue -- .subscribe( -- scheme.inputd_event_handle().as_raw_fd() as usize, -- Source::Input, -- event::EventFlags::READ, -- ) -- .unwrap(); -- event_queue -- .subscribe( -- scheme.event_handle().raw(), -- Source::Scheme, -- event::EventFlags::READ, -- ) -- .unwrap(); -- -- libredox::call::setrens(0, 0).expect("vesad: failed to enter null namespace"); -+ let event_queue: EventQueue = match EventQueue::new() { -+ Ok(eq) => eq, -+ Err(err) => { -+ eprintln!("vesad: failed to create event queue: {}", err); -+ daemon.ready(); -+ std::process::exit(1); -+ } -+ }; -+ if let Err(err) = event_queue.subscribe( -+ scheme.inputd_event_handle().as_raw_fd() as usize, -+ Source::Input, -+ event::EventFlags::READ, -+ ) { -+ eprintln!("vesad: failed to subscribe to input events: {}", err); -+ } -+ if let Err(err) = event_queue.subscribe( -+ scheme.event_handle().raw(), -+ Source::Scheme, -+ event::EventFlags::READ, -+ ) { -+ eprintln!("vesad: failed to subscribe to scheme events: {}", err); -+ } -+ -+ if let Err(err) = libredox::call::setrens(0, 0) { -+ eprintln!("vesad: failed to enter null namespace: {}", err); -+ } - - daemon.ready(); - - let all = [Source::Input, Source::Scheme]; -- for event in all -- .into_iter() -- .chain(event_queue.map(|e| e.expect("vesad: failed to get next event").user_data)) -- { -+ for event in all.into_iter().chain(event_queue.filter_map(|e| { -+ match e { -+ Ok(ev) => Some(ev.user_data), -+ Err(err) => { -+ eprintln!("vesad: failed to get next event: {}", err); -+ None -+ } -+ } -+ })) { - match event { - Source::Input => scheme.handle_vt_events(), - Source::Scheme => { -- scheme -- .tick() -- .expect("vesad: failed to handle scheme events"); -+ if let Err(err) = scheme.tick() { -+ eprintln!("vesad: failed to handle scheme events: {}", err); -+ } - } - } - } -diff --git a/drivers/graphics/vesad/src/scheme.rs b/drivers/graphics/vesad/src/scheme.rs -index 5bf2be91..20d755d2 100644 ---- a/drivers/graphics/vesad/src/scheme.rs -+++ b/drivers/graphics/vesad/src/scheme.rs -@@ -74,7 +74,17 @@ impl GraphicsAdapter for FbAdapter { - } - - fn probe_connector(&mut self, objects: &mut KmsObjects, id: KmsObjectId) { -- let mut connector = objects.get_connector(id).unwrap().lock().unwrap(); -+ let connector_mutex = match objects.get_connector(id) { -+ Ok(c) => c, -+ Err(err) => { -+ eprintln!("vesad: probe_connector: connector {:?} not found: {}", id, err); -+ return; -+ } -+ }; -+ let mut connector = connector_mutex.lock().unwrap_or_else(|e| { -+ eprintln!("vesad: probe_connector: connector lock poisoned, recovering"); -+ e.into_inner() -+ }); - let connector = &mut *connector; - connector.connection = KmsConnectorStatus::Connected; - connector.update_from_size(connector.driver_data.width, connector.driver_data.height); -@@ -102,7 +112,10 @@ impl GraphicsAdapter for FbAdapter { - state: KmsCrtcState, - damage: Damage, - ) -> syscall::Result<()> { -- let mut crtc = crtc.lock().unwrap(); -+ let mut crtc = crtc.lock().unwrap_or_else(|e| { -+ eprintln!("vesad: set_crtc: crtc lock poisoned, recovering"); -+ e.into_inner() -+ }); - let buffer = state - .fb_id - .map(|fb_id| objects.get_framebuffer(fb_id)) -@@ -110,7 +123,10 @@ impl GraphicsAdapter for FbAdapter { - crtc.state = state; - - for connector in objects.connectors() { -- let connector = connector.lock().unwrap(); -+ let connector = connector.lock().unwrap_or_else(|e| { -+ eprintln!("vesad: set_crtc: connector lock poisoned, recovering"); -+ e.into_inner() -+ }); - - if connector.state.crtc_id != objects.crtc_ids()[crtc.crtc_index as usize] { - continue; -@@ -159,7 +175,7 @@ pub struct FrameBuffer { - impl FrameBuffer { - pub unsafe fn new(phys: usize, width: usize, height: usize, stride: usize) -> Self { - let size = stride * height; -- let virt = common::physmap( -+ let virt = match common::physmap( - phys, - size * 4, - common::Prot { -@@ -167,8 +183,13 @@ impl FrameBuffer { - write: true, - }, - common::MemoryType::WriteCombining, -- ) -- .expect("vesad: failed to map framebuffer") as *mut u32; -+ ) { -+ Ok(v) => v as *mut u32, -+ Err(err) => { -+ eprintln!("vesad: failed to map framebuffer at 0x{:X}: {}", phys, err); -+ std::process::exit(1); -+ } -+ }; - - let onscreen = ptr::slice_from_raw_parts_mut(virt, size); - -@@ -228,9 +249,11 @@ impl GraphicScreen { - fn layout(len: usize) -> Layout { - // optimizes to an integer mul - Layout::array::(len) -- .unwrap() -- .align_to(PAGE_SIZE) -- .unwrap() -+ .and_then(|l| l.align_to(PAGE_SIZE)) -+ .unwrap_or_else(|err| { -+ eprintln!("vesad: failed to compute buffer layout (len={}): {}", len, err); -+ std::process::exit(1); -+ }) - } - } - -@@ -249,15 +272,26 @@ impl Buffer for GraphicScreen { - - impl GraphicScreen { - fn sync(&self, framebuffer: &mut FrameBuffer, sync_rect: Damage) { -- let sync_rect = sync_rect.clip( -- self.width.try_into().unwrap(), -- self.height.try_into().unwrap(), -- ); -- -- let start_x: usize = sync_rect.x.try_into().unwrap(); -- let start_y: usize = sync_rect.y.try_into().unwrap(); -- let w: usize = sync_rect.width.try_into().unwrap(); -- let h: usize = sync_rect.height.try_into().unwrap(); -+ let Ok(fb_width) = u32::try_from(self.width) else { -+ return; -+ }; -+ let Ok(fb_height) = u32::try_from(self.height) else { -+ return; -+ }; -+ let sync_rect = sync_rect.clip(fb_width, fb_height); -+ -+ let Ok(start_x): Result = sync_rect.x.try_into() else { -+ return; -+ }; -+ let Ok(start_y): Result = sync_rect.y.try_into() else { -+ return; -+ }; -+ let Ok(w): Result = sync_rect.width.try_into() else { -+ return; -+ }; -+ let Ok(h): Result = sync_rect.height.try_into() else { -+ return; -+ }; - - let offscreen_ptr = self.ptr.as_ptr() as *mut u32; - let onscreen_ptr = framebuffer.onscreen as *mut u32; // FIXME use as_mut_ptr once stable -diff --git a/drivers/graphics/virtio-gpud/src/main.rs b/drivers/graphics/virtio-gpud/src/main.rs -index b27f4c56..0f1a9e4d 100644 ---- a/drivers/graphics/virtio-gpud/src/main.rs -+++ b/drivers/graphics/virtio-gpud/src/main.rs -@@ -482,7 +482,10 @@ fn main() { - } - - fn daemon_runner(daemon: daemon::Daemon, pcid_handle: PciFunctionHandle) -> ! { -- deamon(daemon, pcid_handle).unwrap(); -+ if let Err(err) = deamon(daemon, pcid_handle) { -+ log::error!("virtio-gpud: startup failed: {err}"); -+ std::process::exit(1); -+ } - unreachable!(); - } - -@@ -500,7 +503,12 @@ fn deamon(deamon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> anyhow: - // 0x1050 - virtio-gpu - let pci_config = pcid_handle.config(); - -- assert_eq!(pci_config.func.full_device_id.device_id, 0x1050); -+ if pci_config.func.full_device_id.device_id != 0x1050 { -+ return Err(anyhow::anyhow!( -+ "unexpected virtio-gpu device id: {:04x}", -+ pci_config.func.full_device_id.device_id -+ )); -+ } - log::info!("virtio-gpu: initiating startup sequence :^)"); - - let device = DEVICE.try_call_once(|| virtio_core::probe_device(&mut pcid_handle))?; -@@ -530,8 +538,8 @@ fn deamon(deamon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> anyhow: - // Needs to be before GpuScheme::new to avoid a deadlock due to initnsmgr blocking on - // /scheme/event as it is already blocked on opening /scheme/display.virtio-gpu. - // FIXME change the initnsmgr to not block on openat for the target scheme. -- let event_queue: EventQueue = -- EventQueue::new().expect("virtio-gpud: failed to create event queue"); -+ let event_queue: EventQueue = EventQueue::new() -+ .map_err(|err| anyhow::anyhow!("failed to create event queue: {err}"))?; - - let mut scheme = scheme::GpuScheme::new( - config, -@@ -556,33 +564,40 @@ fn deamon(deamon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> anyhow: - Source::Input, - event::EventFlags::READ, - ) -- .unwrap(); -+ .map_err(|err| anyhow::anyhow!("virtio-gpud: failed to subscribe to input events: {err}"))?; - event_queue - .subscribe( - scheme.event_handle().raw(), - Source::Scheme, - event::EventFlags::READ, - ) -- .unwrap(); -+ .map_err(|err| { -+ anyhow::anyhow!("virtio-gpud: failed to subscribe to scheme events: {err}") -+ })?; - event_queue - .subscribe( - device.irq_handle.as_raw_fd() as usize, - Source::Interrupt, - event::EventFlags::READ, - ) -- .unwrap(); -+ .map_err(|err| { -+ anyhow::anyhow!("virtio-gpud: failed to subscribe to interrupt events: {err}") -+ })?; - - let all = [Source::Input, Source::Scheme, Source::Interrupt]; -- for event in all -- .into_iter() -- .chain(event_queue.map(|e| e.expect("virtio-gpud: failed to get next event").user_data)) -- { -+ for event in all.into_iter().chain(event_queue.filter_map(|e| match e { -+ Ok(ev) => Some(ev.user_data), -+ Err(err) => { -+ log::error!("virtio-gpud: failed to get next event: {err}"); -+ None -+ } -+ })) { - match event { - Source::Input => scheme.handle_vt_events(), - Source::Scheme => { -- scheme -- .tick() -- .expect("virtio-gpud: failed to process scheme events"); -+ if let Err(err) = scheme.tick() { -+ log::error!("virtio-gpud: failed to process scheme events: {err}"); -+ } - } - Source::Interrupt => loop { - let before_gen = device.transport.config_generation(); -@@ -591,7 +606,11 @@ fn deamon(deamon: daemon::Daemon, mut pcid_handle: PciFunctionHandle) -> anyhow: - - if events & VIRTIO_GPU_EVENT_DISPLAY != 0 { - let (adapter, objects) = scheme.adapter_and_kms_objects_mut(); -- futures::executor::block_on(async { adapter.update_displays().await.unwrap() }); -+ futures::executor::block_on(async { -+ if let Err(err) = adapter.update_displays().await { -+ log::error!("virtio-gpud: failed to update displays: {err}"); -+ } -+ }); - for connector_id in objects.connector_ids().to_vec() { - adapter.probe_connector(objects, connector_id); - } -diff --git a/drivers/graphics/virtio-gpud/src/scheme.rs b/drivers/graphics/virtio-gpud/src/scheme.rs -index 22a985ee..075502a2 100644 ---- a/drivers/graphics/virtio-gpud/src/scheme.rs -+++ b/drivers/graphics/virtio-gpud/src/scheme.rs -@@ -10,7 +10,7 @@ use drm_sys::{ - DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT, - }; - --use syscall::{EINVAL, PAGE_SIZE}; -+use syscall::{EIO, EINVAL, PAGE_SIZE}; - - use virtio_core::spec::{Buffer, ChainBuilder, DescriptorFlags}; - use virtio_core::transport::{Error, Queue, Transport}; -@@ -65,9 +65,21 @@ impl DrmBuffer for VirtGpuFramebuffer<'_> { - impl Drop for VirtGpuFramebuffer<'_> { - fn drop(&mut self) { - futures::executor::block_on(async { -- let request = Dma::new(ResourceUnref::new(self.id)).unwrap(); -+ let request = match Dma::new(ResourceUnref::new(self.id)) { -+ Ok(r) => r, -+ Err(err) => { -+ log::error!("virtio-gpud: failed to allocate DMA for resource unref: {err}"); -+ return; -+ } -+ }; - -- let header = Dma::new(ControlHeader::default()).unwrap(); -+ let header = match Dma::new(ControlHeader::default()) { -+ Ok(h) => h, -+ Err(err) => { -+ log::error!("virtio-gpud: failed to allocate DMA for unref header: {err}"); -+ return; -+ } -+ }; - let command = ChainBuilder::new() - .chain(Buffer::new(&request)) - .chain(Buffer::new(&header).flags(DescriptorFlags::WRITE_ONLY)) -@@ -182,7 +194,9 @@ impl VirtGpuAdapter<'_> { - .build(); - - self.control_queue.send(command).await; -- assert!(response.header.ty == CommandTy::RespOkDisplayInfo); -+ if response.header.ty != CommandTy::RespOkDisplayInfo { -+ return Err(Error::Probe("unexpected response type for display info")); -+ } - - Ok(response) - } -@@ -197,7 +211,9 @@ impl VirtGpuAdapter<'_> { - .build(); - - self.control_queue.send(command).await; -- assert!(response.header.ty == CommandTy::RespOkEdid); -+ if response.header.ty != CommandTy::RespOkEdid { -+ return Err(Error::Probe("unexpected response type for EDID")); -+ } - - Ok(response) - } -@@ -212,7 +228,7 @@ impl VirtGpuAdapter<'_> { - ) { - //Transfering cursor resource to host - futures::executor::block_on(async { -- let transfer_request = Dma::new(XferToHost2d::new( -+ let transfer_request = match Dma::new(XferToHost2d::new( - cursor.id, - GpuRect { - x: 0, -@@ -221,14 +237,38 @@ impl VirtGpuAdapter<'_> { - height: 64, - }, - 0, -- )) -- .unwrap(); -- let header = self.send_request_fenced(transfer_request).await.unwrap(); -- assert_eq!(header.ty, CommandTy::RespOkNodata); -+ )) { -+ Ok(r) => r, -+ Err(err) => { -+ log::error!( -+ "virtio-gpud: failed to allocate DMA for cursor transfer: {err}" -+ ); -+ return; -+ } -+ }; -+ let header = match self.send_request_fenced(transfer_request).await { -+ Ok(h) => h, -+ Err(err) => { -+ log::error!("virtio-gpud: failed to send cursor transfer request: {err}"); -+ return; -+ } -+ }; -+ if header.ty != CommandTy::RespOkNodata { -+ log::error!( -+ "virtio-gpud: unexpected response for cursor transfer: {:?}", -+ header.ty -+ ); -+ } - }); - - //Update the cursor position -- let request = Dma::new(UpdateCursor::update_cursor(x, y, hot_x, hot_y, cursor.id)).unwrap(); -+ let request = match Dma::new(UpdateCursor::update_cursor(x, y, hot_x, hot_y, cursor.id)) { -+ Ok(r) => r, -+ Err(err) => { -+ log::error!("virtio-gpud: failed to allocate DMA for cursor update: {err}"); -+ return; -+ } -+ }; - futures::executor::block_on(async { - let command = ChainBuilder::new().chain(Buffer::new(&request)).build(); - self.cursor_queue.send(command).await; -@@ -236,7 +276,13 @@ impl VirtGpuAdapter<'_> { - } - - fn move_cursor(&mut self, x: i32, y: i32) { -- let request = Dma::new(MoveCursor::move_cursor(x, y)).unwrap(); -+ let request = match Dma::new(MoveCursor::move_cursor(x, y)) { -+ Ok(r) => r, -+ Err(err) => { -+ log::error!("virtio-gpud: failed to allocate DMA for cursor move: {err}"); -+ return; -+ } -+ }; - - futures::executor::block_on(async { - let command = ChainBuilder::new().chain(Buffer::new(&request)).build(); -@@ -246,7 +292,10 @@ impl VirtGpuAdapter<'_> { - - fn disable_cursor(&mut self) { - if self.hidden_cursor.is_none() { -- let (width, height) = self.hw_cursor_size().unwrap(); -+ let Some((width, height)) = self.hw_cursor_size() else { -+ log::error!("virtio-gpud: failed to get hardware cursor size"); -+ return; -+ }; - let (cursor, stride) = self.create_dumb_buffer(width, height); - unsafe { - core::ptr::write_bytes( -@@ -257,8 +306,9 @@ impl VirtGpuAdapter<'_> { - } - self.hidden_cursor = Some(Arc::new(cursor)); - } -- let hidden_cursor = self.hidden_cursor.as_ref().unwrap().clone(); -- -+ let Some(hidden_cursor) = self.hidden_cursor.clone() else { -+ return; -+ }; - self.update_cursor(&hidden_cursor, 0, 0, 0, 0); - } - } -@@ -280,7 +330,9 @@ impl<'a> GraphicsAdapter for VirtGpuAdapter<'a> { - - fn init(&mut self, objects: &mut KmsObjects) { - futures::executor::block_on(async { -- self.update_displays().await.unwrap(); -+ if let Err(err) = self.update_displays().await { -+ log::error!("virtio-gpud: failed to update displays during init: {err}"); -+ } - }); - - for display_id in 0..self.config.num_scanouts.get() { -@@ -310,7 +362,19 @@ impl<'a> GraphicsAdapter for VirtGpuAdapter<'a> { - - fn probe_connector(&mut self, objects: &mut KmsObjects, id: KmsObjectId) { - futures::executor::block_on(async { -- let mut connector = objects.get_connector(id).unwrap().lock().unwrap(); -+ let mut connector = match objects.get_connector(id) { -+ Ok(c) => match c.lock() { -+ Ok(guard) => guard, -+ Err(err) => { -+ log::error!("virtio-gpud: failed to lock connector: {err}"); -+ return; -+ } -+ }, -+ Err(e) => { -+ log::error!("virtio-gpud: connector not found: {e}"); -+ return; -+ } -+ }; - let display = &self.displays[connector.driver_data.display_id as usize]; - - connector.connection = if display.enabled { -@@ -325,7 +389,19 @@ impl<'a> GraphicsAdapter for VirtGpuAdapter<'a> { - drop(connector); - - let blob = objects.add_blob(display.edid.clone()); -- objects.get_connector(id).unwrap().lock().unwrap().edid = blob; -+ match objects.get_connector(id) { -+ Ok(c) => match c.lock() { -+ Ok(mut guard) => guard.edid = blob, -+ Err(err) => { -+ log::error!( -+ "virtio-gpud: failed to lock connector for EDID update: {err}" -+ ); -+ } -+ }, -+ Err(e) => { -+ log::error!("virtio-gpud: connector not found for EDID update: {e}"); -+ } -+ } - } else { - connector.update_from_size(display.width, display.height); - } -@@ -336,7 +412,13 @@ impl<'a> GraphicsAdapter for VirtGpuAdapter<'a> { - futures::executor::block_on(async { - let bpp = 32; - let fb_size = width as usize * height as usize * bpp / 8; -- let sgl = sgl::Sgl::new(fb_size).unwrap(); -+ let sgl = match sgl::Sgl::new(fb_size) { -+ Ok(s) => s, -+ Err(err) => { -+ log::error!("virtio-gpud: failed to allocate SGL for dumb buffer: {err}"); -+ std::process::exit(1); -+ } -+ }; - - unsafe { - core::ptr::write_bytes(sgl.as_ptr() as *mut u8, 255, fb_size); -@@ -345,22 +427,61 @@ impl<'a> GraphicsAdapter for VirtGpuAdapter<'a> { - let res_id = ResourceId::alloc(); - - // Create a host resource using `VIRTIO_GPU_CMD_RESOURCE_CREATE_2D`. -- let request = Dma::new(ResourceCreate2d::new( -+ let request = match Dma::new(ResourceCreate2d::new( - res_id, - ResourceFormat::Bgrx, - width, - height, -- )) -- .unwrap(); -+ )) { -+ Ok(r) => r, -+ Err(err) => { -+ log::error!("virtio-gpud: failed to allocate DMA for resource create: {err}"); -+ return ( -+ VirtGpuFramebuffer { -+ queue: self.control_queue.clone(), -+ id: res_id, -+ sgl, -+ width, -+ height, -+ }, -+ width * 4, -+ ); -+ } -+ }; - -- let header = self.send_request(request).await.unwrap(); -- assert_eq!(header.ty, CommandTy::RespOkNodata); -+ match self.send_request(request).await { -+ Ok(header) => { -+ if header.ty != CommandTy::RespOkNodata { -+ log::error!( -+ "virtio-gpud: unexpected response for resource create: {:?}", -+ header.ty -+ ); -+ } -+ } -+ Err(err) => { -+ log::error!("virtio-gpud: failed to send resource create request: {err}"); -+ } -+ } - - // Use the allocated framebuffer from the guest ram, and attach it as backing - // storage to the resource just created, using `VIRTIO_GPU_CMD_RESOURCE_ATTACH_BACKING`. - -- let mut mem_entries = -- unsafe { Dma::zeroed_slice(sgl.chunks().len()).unwrap().assume_init() }; -+ let mut mem_entries = match unsafe { Dma::zeroed_slice(sgl.chunks().len()) } { -+ Ok(entries) => unsafe { entries.assume_init() }, -+ Err(err) => { -+ log::error!("virtio-gpud: failed to allocate DMA for memory entries: {err}"); -+ return ( -+ VirtGpuFramebuffer { -+ queue: self.control_queue.clone(), -+ id: res_id, -+ sgl, -+ width, -+ height, -+ }, -+ width * 4, -+ ); -+ } -+ }; - for (entry, chunk) in mem_entries.iter_mut().zip(sgl.chunks().iter()) { - *entry = MemEntry { - address: chunk.phys as u64, -@@ -369,9 +490,43 @@ impl<'a> GraphicsAdapter for VirtGpuAdapter<'a> { - }; - } - -- let attach_request = -- Dma::new(AttachBacking::new(res_id, mem_entries.len() as u32)).unwrap(); -- let header = Dma::new(ControlHeader::default()).unwrap(); -+ let attach_request = match Dma::new(AttachBacking::new( -+ res_id, -+ mem_entries.len() as u32, -+ )) { -+ Ok(r) => r, -+ Err(err) => { -+ log::error!( -+ "virtio-gpud: failed to allocate DMA for attach request: {err}" -+ ); -+ return ( -+ VirtGpuFramebuffer { -+ queue: self.control_queue.clone(), -+ id: res_id, -+ sgl, -+ width, -+ height, -+ }, -+ width * 4, -+ ); -+ } -+ }; -+ let header = match Dma::new(ControlHeader::default()) { -+ Ok(h) => h, -+ Err(err) => { -+ log::error!("virtio-gpud: failed to allocate DMA for attach header: {err}"); -+ return ( -+ VirtGpuFramebuffer { -+ queue: self.control_queue.clone(), -+ id: res_id, -+ sgl, -+ width, -+ height, -+ }, -+ width * 4, -+ ); -+ } -+ }; - let command = ChainBuilder::new() - .chain(Buffer::new(&attach_request)) - .chain(Buffer::new_unsized(&mem_entries)) -@@ -379,7 +534,12 @@ impl<'a> GraphicsAdapter for VirtGpuAdapter<'a> { - .build(); - - self.control_queue.send(command).await; -- assert_eq!(header.ty, CommandTy::RespOkNodata); -+ if header.ty != CommandTy::RespOkNodata { -+ log::error!( -+ "virtio-gpud: unexpected response for attach backing: {:?}", -+ header.ty -+ ); -+ } - - ( - VirtGpuFramebuffer { -@@ -410,7 +570,13 @@ impl<'a> GraphicsAdapter for VirtGpuAdapter<'a> { - damage: Damage, - ) -> syscall::Result<()> { - futures::executor::block_on(async { -- let mut crtc = crtc.lock().unwrap(); -+ let mut crtc = match crtc.lock() { -+ Ok(guard) => guard, -+ Err(err) => { -+ log::error!("virtio-gpud: crtc mutex poisoned: {err}"); -+ return Err(syscall::Error::new(EIO)); -+ } -+ }; - let framebuffer = state - .fb_id - .map(|fb_id| objects.get_framebuffer(fb_id)) -@@ -418,7 +584,13 @@ impl<'a> GraphicsAdapter for VirtGpuAdapter<'a> { - crtc.state = state; - - for connector in objects.connectors() { -- let connector = connector.lock().unwrap(); -+ let connector = match connector.lock() { -+ Ok(guard) => guard, -+ Err(err) => { -+ log::error!("virtio-gpud: connector mutex poisoned: {err}"); -+ continue; -+ } -+ }; - - if connector.state.crtc_id != objects.crtc_ids()[crtc.crtc_index as usize] { - continue; -@@ -427,19 +599,40 @@ impl<'a> GraphicsAdapter for VirtGpuAdapter<'a> { - let display_id = connector.driver_data.display_id; - - let Some(framebuffer) = framebuffer else { -- let scanout_request = Dma::new(SetScanout::new( -+ let scanout_request = match Dma::new(SetScanout::new( - display_id, - ResourceId::NONE, - GpuRect::new(0, 0, 0, 0), -- )) -- .unwrap(); -- let header = self.send_request(scanout_request).await.unwrap(); -- assert_eq!(header.ty, CommandTy::RespOkNodata); -+ )) { -+ Ok(r) => r, -+ Err(err) => { -+ log::error!( -+ "virtio-gpud: failed to allocate DMA for scanout: {err}" -+ ); -+ return Err(syscall::Error::new(EIO)); -+ } -+ }; -+ let header = match self.send_request(scanout_request).await { -+ Ok(h) => h, -+ Err(err) => { -+ log::error!( -+ "virtio-gpud: failed to send scanout request: {err}" -+ ); -+ return Err(syscall::Error::new(EIO)); -+ } -+ }; -+ if header.ty != CommandTy::RespOkNodata { -+ log::error!( -+ "virtio-gpud: unexpected response for scanout: {:?}", -+ header.ty -+ ); -+ return Err(syscall::Error::new(EIO)); -+ } - self.displays[display_id as usize].active_resource = None; - return Ok(()); - }; - -- let req = Dma::new(XferToHost2d::new( -+ let req = match Dma::new(XferToHost2d::new( - framebuffer.buffer.id, - GpuRect { - x: 0, -@@ -448,22 +641,61 @@ impl<'a> GraphicsAdapter for VirtGpuAdapter<'a> { - height: framebuffer.height, - }, - 0, -- )) -- .unwrap(); -- let header = self.send_request(req).await.unwrap(); -- assert_eq!(header.ty, CommandTy::RespOkNodata); -+ )) { -+ Ok(r) => r, -+ Err(err) => { -+ log::error!("virtio-gpud: failed to allocate DMA for transfer: {err}"); -+ return Err(syscall::Error::new(EIO)); -+ } -+ }; -+ let header = match self.send_request(req).await { -+ Ok(h) => h, -+ Err(err) => { -+ log::error!("virtio-gpud: failed to send transfer request: {err}"); -+ return Err(syscall::Error::new(EIO)); -+ } -+ }; -+ if header.ty != CommandTy::RespOkNodata { -+ log::error!( -+ "virtio-gpud: unexpected response for transfer: {:?}", -+ header.ty -+ ); -+ return Err(syscall::Error::new(EIO)); -+ } - - // FIXME once we support resizing we also need to check that the current and target size match -- if self.displays[display_id as usize].active_resource != Some(framebuffer.buffer.id) -+ if self.displays[display_id as usize].active_resource -+ != Some(framebuffer.buffer.id) - { -- let scanout_request = Dma::new(SetScanout::new( -+ let scanout_request = match Dma::new(SetScanout::new( - display_id, - framebuffer.buffer.id, - GpuRect::new(0, 0, framebuffer.width, framebuffer.height), -- )) -- .unwrap(); -- let header = self.send_request(scanout_request).await.unwrap(); -- assert_eq!(header.ty, CommandTy::RespOkNodata); -+ )) { -+ Ok(r) => r, -+ Err(err) => { -+ log::error!( -+ "virtio-gpud: failed to allocate DMA for scanout: {err}" -+ ); -+ return Err(syscall::Error::new(EIO)); -+ } -+ }; -+ let header = match self.send_request(scanout_request).await { -+ Ok(h) => h, -+ Err(err) => { -+ log::error!( -+ "virtio-gpud: failed to send scanout request: {err}" -+ ); -+ return Err(syscall::Error::new(EIO)); -+ } -+ }; -+ if header.ty != CommandTy::RespOkNodata { -+ log::error!( -+ "virtio-gpud: unexpected response for scanout: {:?}", -+ header.ty -+ ); -+ return Err(syscall::Error::new(EIO)); -+ } - self.displays[display_id as usize].active_resource = - Some(framebuffer.buffer.id); - } -@@ -472,8 +704,27 @@ impl<'a> GraphicsAdapter for VirtGpuAdapter<'a> { - framebuffer.buffer.id, - damage.clip(framebuffer.width, framebuffer.height).into(), - ); -- let header = self.send_request(Dma::new(flush).unwrap()).await.unwrap(); -- assert_eq!(header.ty, CommandTy::RespOkNodata); -+ let flush_dma = match Dma::new(flush) { -+ Ok(d) => d, -+ Err(err) => { -+ log::error!("virtio-gpud: failed to allocate DMA for flush: {err}"); -+ return Err(syscall::Error::new(EIO)); -+ } -+ }; -+ let header = match self.send_request(flush_dma).await { -+ Ok(h) => h, -+ Err(err) => { -+ log::error!("virtio-gpud: failed to send flush request: {err}"); -+ return Err(syscall::Error::new(EIO)); -+ } -+ }; -+ if header.ty != CommandTy::RespOkNodata { -+ log::error!( -+ "virtio-gpud: unexpected response for flush: {:?}", -+ header.ty -+ ); -+ return Err(syscall::Error::new(EIO)); -+ } - } - - Ok(()) -diff --git a/drivers/inputd/src/lib.rs b/drivers/inputd/src/lib.rs -index b68e8211..0627f301 100644 ---- a/drivers/inputd/src/lib.rs -+++ b/drivers/inputd/src/lib.rs -@@ -64,25 +64,53 @@ impl ConsumerHandle { - let fd = self.0.as_raw_fd(); - let written = libredox::call::fpath(fd as usize, &mut buffer)?; - -- assert!(written <= buffer.len()); -- -- let mut display_path = PathBuf::from( -- std::str::from_utf8(&buffer[..written]) -- .expect("init: display path UTF-8 check failed") -- .to_owned(), -- ); -- display_path.set_file_name(format!( -- "v2/{}", -- display_path.file_name().unwrap().to_str().unwrap() -- )); -- let display_path = display_path.to_str().unwrap(); -+ if written > buffer.len() { -+ return Err(io::Error::new( -+ io::ErrorKind::InvalidData, -+ "inputd: display path exceeded buffer size", -+ )); -+ } -+ -+ let path_str = std::str::from_utf8(&buffer[..written]).map_err(|e| { -+ io::Error::new( -+ io::ErrorKind::InvalidData, -+ format!("inputd: display path is not valid UTF-8: {e}"), -+ ) -+ })?; -+ let mut display_path = PathBuf::from(path_str.to_owned()); -+ -+ let file_name = display_path -+ .file_name() -+ .and_then(|n| n.to_str()) -+ .ok_or_else(|| { -+ io::Error::new( -+ io::ErrorKind::InvalidData, -+ format!( -+ "inputd: display path has no valid file name: {}", -+ display_path.display() -+ ), -+ ) -+ })?; -+ display_path.set_file_name(format!("v2/{file_name}")); -+ let display_path_str = display_path.to_str().ok_or_else(|| { -+ io::Error::new( -+ io::ErrorKind::InvalidData, -+ format!( -+ "inputd: constructed display path is not valid UTF-8: {}", -+ display_path.display() -+ ), -+ ) -+ })?; - - let display_file = -- libredox::call::open(display_path, (O_CLOEXEC | O_NONBLOCK | O_RDWR) as _, 0) -+ libredox::call::open(display_path_str, (O_CLOEXEC | O_NONBLOCK | O_RDWR) as _, 0) - .map(|socket| unsafe { File::from_raw_fd(socket as RawFd) }) -- .unwrap_or_else(|err| { -- panic!("failed to open display {}: {}", display_path, err); -- }); -+ .map_err(|err| { -+ io::Error::new( -+ io::ErrorKind::Other, -+ format!("inputd: failed to open display {display_path_str}: {err}"), -+ ) -+ })?; - - Ok(display_file) - } -@@ -152,8 +180,12 @@ impl DisplayHandle { - - if nread == 0 { - Ok(None) -+ } else if nread != size_of::() { -+ Err(io::Error::new( -+ io::ErrorKind::InvalidData, -+ format!("inputd: partial vt event read: got {nread}, expected {}", size_of::()), -+ )) - } else { -- assert_eq!(nread, size_of::()); - Ok(Some(event)) - } - } -diff --git a/drivers/inputd/src/main.rs b/drivers/inputd/src/main.rs -index 07aa943e..61641b9f 100644 ---- a/drivers/inputd/src/main.rs -+++ b/drivers/inputd/src/main.rs -@@ -274,7 +274,7 @@ impl SchemeSync for InputScheme { - let handle = self.handles.get(id)?; - - if let Handle::Consumer { vt, .. } = handle { -- write!(w, "{vt}").unwrap(); -+ write!(w, "{vt}").map_err(|_| SysError::new(EINVAL))?; - Ok(()) - } else { - Err(SysError::new(EINVAL)) -@@ -438,7 +438,9 @@ impl SchemeSync for InputScheme { - } - - let handle = self.handles.get_mut(id)?; -- assert!(matches!(handle, Handle::Producer)); -+ if !matches!(handle, Handle::Producer) { -+ return Err(SysError::new(EBADF)); -+ } - - let buf = unsafe { - core::slice::from_raw_parts( -@@ -505,8 +507,8 @@ impl SchemeSync for InputScheme { - } - - fn on_close(&mut self, id: usize) { -- match self.handles.remove(id).unwrap() { -- Handle::Consumer { vt, .. } => { -+ match self.handles.remove(id) { -+ Some(Handle::Consumer { vt, .. }) => { - self.vts.remove(&vt); - if self.active_vt == Some(vt) { - if let Some(&new_vt) = self.vts.last() { -@@ -516,7 +518,10 @@ impl SchemeSync for InputScheme { - } - } - } -- _ => {} -+ Some(_) => {} -+ None => { -+ log::warn!("inputd: on_close called with unknown handle id {id}"); -+ } - } - } - } -@@ -589,8 +594,11 @@ fn deamon(daemon: daemon::SchemeDaemon) -> anyhow::Result<()> { - } - - fn daemon_runner(daemon: daemon::SchemeDaemon) -> ! { -- deamon(daemon).unwrap(); -- unreachable!(); -+ if let Err(err) = deamon(daemon) { -+ log::error!("inputd: scheme daemon failed: {err}"); -+ std::process::exit(1); -+ } -+ unreachable!() - } - - const HELP: &str = r#" -@@ -608,13 +616,26 @@ fn main() { - match val.as_ref() { - // Activates a VT. - "-A" => { -- let vt = args.next().unwrap().parse::().unwrap(); -+ let vt_str = args.next().unwrap_or_else(|| { -+ eprintln!("inputd: -A requires a VT number argument"); -+ std::process::exit(1); -+ }); -+ let vt = vt_str.parse::().unwrap_or_else(|_| { -+ eprintln!("inputd: invalid VT number: {vt_str}"); -+ std::process::exit(1); -+ }); - -- let mut handle = -- inputd::ControlHandle::new().expect("inputd: failed to open control handle"); -- handle -- .activate_vt(vt) -- .expect("inputd: failed to activate VT"); -+ let mut handle = match inputd::ControlHandle::new() { -+ Ok(h) => h, -+ Err(e) => { -+ eprintln!("inputd: failed to open control handle: {e}"); -+ std::process::exit(1); -+ } -+ }; -+ if let Err(e) = handle.activate_vt(vt) { -+ eprintln!("inputd: failed to activate VT {vt}: {e}"); -+ std::process::exit(1); -+ } - } - // Activates a keymap. - "-K" => { -@@ -630,11 +651,17 @@ fn main() { - std::process::exit(1); - }); - -- let mut handle = -- inputd::ControlHandle::new().expect("inputd: failed to open control handle"); -- handle -- .activate_keymap(vt as usize) -- .expect("inputd: failed to activate keymap"); -+ let mut handle = match inputd::ControlHandle::new() { -+ Ok(h) => h, -+ Err(e) => { -+ eprintln!("inputd: failed to open control handle: {e}"); -+ std::process::exit(1); -+ } -+ }; -+ if let Err(e) = handle.activate_keymap(vt as usize) { -+ eprintln!("inputd: failed to activate keymap: {e}"); -+ std::process::exit(1); -+ } - } - // List available keymaps - "--keymaps" => { -@@ -647,7 +674,10 @@ fn main() { - println!("{}", HELP); - } - -- _ => panic!("inputd: invalid argument: {}", val), -+ _ => { -+ eprintln!("inputd: invalid argument: {val}"); -+ std::process::exit(1); -+ } - } - } else { - common::setup_logging( -diff --git a/init/src/main.rs b/init/src/main.rs -index 5682cf44..d40451a8 100644 ---- a/init/src/main.rs -+++ b/init/src/main.rs -@@ -117,6 +117,8 @@ fn main() { - let mut unit_store = UnitStore::new(); - let mut scheduler = Scheduler::new(); - -+ eprintln!("init: phase 1 — initfs boot"); -+ - switch_root( - &mut unit_store, - &mut init_config, -@@ -125,6 +127,7 @@ fn main() { - ); - - // Start logd first such that we can pass /scheme/log as stdio to all other services -+ eprintln!("init: starting logd"); - scheduler - .schedule_start_and_report_errors(&mut unit_store, UnitId("00_logd.service".to_owned())); - scheduler.step(&mut unit_store, &mut init_config); -@@ -132,6 +135,7 @@ fn main() { - eprintln!("init: failed to switch stdio to '/scheme/log': {err}"); - } - -+ eprintln!("init: starting runtime target"); - let runtime_target = UnitId("00_runtime.target".to_owned()); - scheduler.schedule_start_and_report_errors(&mut unit_store, runtime_target.clone()); - unit_store.set_runtime_target(runtime_target); -@@ -140,6 +144,7 @@ fn main() { - .schedule_start_and_report_errors(&mut unit_store, UnitId("90_initfs.target".to_owned())); - scheduler.step(&mut unit_store, &mut init_config); - -+ eprintln!("init: phase 2 — switchroot to /usr"); - switch_root( - &mut unit_store, - &mut init_config, -@@ -162,23 +167,59 @@ fn main() { - .collect::>() - .join(", ") - ); -- return; -+ Vec::new() - } - }; -+ eprintln!("init: scheduling {} rootfs units", entries.len()); - for entry in entries { -+ let name = match entry.file_name().and_then(|n| n.to_str()) { -+ Some(name) => name, -+ None => { -+ eprintln!("init: skipping config entry with non-UTF-8 filename"); -+ continue; -+ } -+ }; - scheduler.schedule_start_and_report_errors( - &mut unit_store, -- UnitId(entry.file_name().unwrap().to_str().unwrap().to_owned()), -+ UnitId(name.to_owned()), - ); - } - }; - - scheduler.step(&mut unit_store, &mut init_config); -+ eprintln!("init: phase 3 — rootfs services started"); -+ -+ if let Err(err) = libredox::call::setrens(0, 0) { -+ eprintln!("init: failed to enter null namespace: {err}"); -+ } -+ -+ eprintln!("init: boot complete — entering waitpid loop"); - -- libredox::call::setrens(0, 0).expect("init: failed to enter null namespace"); -+ let mut respawn_map: BTreeMap = BTreeMap::new(); -+ for (unit_id, pid) in scheduler.respawn_pids { -+ respawn_map.insert(pid, unit_id); -+ } - - loop { - let mut status = 0; -- libredox::call::waitpid(0, &mut status, 0).unwrap(); -+ match libredox::call::waitpid(0, &mut status, 0) { -+ Ok(pid) => { -+ if let Some(unit_id) = respawn_map.remove(&(pid as u32)) { -+ eprintln!("init: respawning {} (pid {} exited)", unit_id.0, pid); -+ let mut resp_scheduler = Scheduler::new(); -+ resp_scheduler.schedule_start_and_report_errors( -+ &mut unit_store, -+ unit_id.clone(), -+ ); -+ resp_scheduler.step(&mut unit_store, &mut init_config); -+ for (uid, new_pid) in resp_scheduler.respawn_pids { -+ respawn_map.insert(new_pid, uid); -+ } -+ } -+ } -+ Err(_) => { -+ std::thread::sleep(std::time::Duration::from_millis(100)); -+ } -+ } - } - } -diff --git a/init/src/scheduler.rs b/init/src/scheduler.rs -index d42a4e57..32f5076f 100644 ---- a/init/src/scheduler.rs -+++ b/init/src/scheduler.rs -@@ -5,6 +5,7 @@ use crate::unit::{Unit, UnitId, UnitKind, UnitStore}; - - pub struct Scheduler { - pending: VecDeque, -+ pub respawn_pids: Vec<(UnitId, u32)>, - } - - struct Job { -@@ -20,6 +21,7 @@ impl Scheduler { - pub fn new() -> Scheduler { - Scheduler { - pending: VecDeque::new(), -+ respawn_pids: Vec::new(), - } - } - -@@ -43,7 +45,10 @@ impl Scheduler { - ) { - let loaded_units = unit_store.load_units(unit_id.clone(), errors); - for unit_id in loaded_units { -- if !unit_store.unit(&unit_id).conditions_met() { -+ if unit_store -+ .unit(&unit_id) -+ .map_or(false, |u| !u.conditions_met()) -+ { - continue; - } - -@@ -62,7 +67,10 @@ impl Scheduler { - - match job.kind { - JobKind::Start => { -- let unit = unit_store.unit_mut(&job.unit); -+ let Some(unit) = unit_store.unit_mut(&job.unit) else { -+ eprintln!("init: unit {} not found in store, skipping", job.unit.0); -+ continue 'a; -+ }; - - for dep in &unit.info.requires_weak { - for pending_job in &self.pending { -@@ -73,14 +81,17 @@ impl Scheduler { - } - } - -- run(unit, init_config); -+ let pid = run(unit, init_config); -+ if let Some(pid) = pid { -+ self.respawn_pids.push((job.unit.clone(), pid)); -+ } - } - } - } - } - } - --fn run(unit: &mut Unit, config: &mut InitConfig) { -+fn run(unit: &mut Unit, config: &mut InitConfig) -> Option { - match &unit.kind { - UnitKind::LegacyScript { script } => { - for cmd in script.clone() { -@@ -93,7 +104,7 @@ fn run(unit: &mut Unit, config: &mut InitConfig) { - UnitKind::Service { service } => { - if config.skip_cmd.contains(&service.cmd) { - eprintln!("Skipping '{} {}'", service.cmd, service.args.join(" ")); -- return; -+ return None; - } - if config.log_debug { - eprintln!( -@@ -102,7 +113,7 @@ fn run(unit: &mut Unit, config: &mut InitConfig) { - service.cmd, - ); - } -- service.spawn(&config.envs); -+ return service.spawn(&config.envs); - } - UnitKind::Target {} => { - if config.log_debug { -@@ -113,4 +124,5 @@ fn run(unit: &mut Unit, config: &mut InitConfig) { - } - } - } -+ None - } -diff --git a/init/src/service.rs b/init/src/service.rs -index ed0023e9..e06e1b16 100644 ---- a/init/src/service.rs -+++ b/init/src/service.rs -@@ -22,6 +22,8 @@ pub struct Service { - pub inherit_envs: BTreeSet, - #[serde(rename = "type")] - pub type_: ServiceType, -+ #[serde(default)] -+ pub respawn: bool, - } - - #[derive(Clone, Debug, Default, Deserialize)] -@@ -35,7 +37,7 @@ pub enum ServiceType { - } - - impl Service { -- pub fn spawn(&self, base_envs: &BTreeMap) { -+ pub fn spawn(&self, base_envs: &BTreeMap) -> Option { - let mut command = Command::new(&self.cmd); - command.args(self.args.iter().map(|arg| subst_env(arg))); - command.env_clear(); -@@ -46,14 +48,20 @@ impl Service { - } - command.envs(base_envs).envs(&self.envs); - -- let (mut read_pipe, write_pipe) = io::pipe().unwrap(); -+ let (mut read_pipe, write_pipe) = match io::pipe() { -+ Ok(pair) => pair, -+ Err(err) => { -+ eprintln!("init: failed to create readiness pipe for {:?}: {err}", command); -+ return None; -+ } -+ }; - unsafe { pass_fd(&mut command, "INIT_NOTIFY", write_pipe.into()) }; - - let mut child = match command.spawn() { - Ok(child) => child, - Err(err) => { - eprintln!("init: failed to execute {:?}: {}", command, err); -- return; -+ return None; - } - }; - -@@ -81,23 +89,32 @@ impl Service { - }) => continue, - Ok(0) => { - eprintln!("init: {command:?} exited without notifying readiness"); -- return; -+ return None; - } - Ok(1) => break, - Ok(n) => { - eprintln!("init: incorrect amount of fds {n} returned"); -- return; -+ return None; - } - Err(err) => { - eprintln!("init: failed to wait for {command:?}: {err}"); -- return; -+ return None; - } - } - } - -- let current_namespace_fd = libredox::call::getns().expect("TODO"); -- libredox::call::register_scheme_to_ns(current_namespace_fd, scheme, new_fd) -- .expect("TODO"); -+ let current_namespace_fd = match libredox::call::getns() { -+ Ok(fd) => fd, -+ Err(err) => { -+ eprintln!("init: failed to get current namespace for {command:?}: {err}"); -+ return None; -+ } -+ }; -+ if let Err(err) = -+ libredox::call::register_scheme_to_ns(current_namespace_fd, scheme, new_fd) -+ { -+ eprintln!("init: failed to register scheme {scheme:?} for {command:?}: {err}"); -+ } - } - ServiceType::Oneshot => { - drop(read_pipe); -@@ -112,8 +129,13 @@ impl Service { - } - } - } -- ServiceType::OneshotAsync => {} -+ ServiceType::OneshotAsync => { -+ if self.respawn { -+ return Some(child.id()); -+ } -+ } - } -+ None - } - } - -diff --git a/init/src/unit.rs b/init/src/unit.rs -index 98053cb2..a58bfb96 100644 ---- a/init/src/unit.rs -+++ b/init/src/unit.rs -@@ -23,8 +23,14 @@ impl UnitStore { - } - - pub fn set_runtime_target(&mut self, unit_id: UnitId) { -- assert!(self.runtime_target.is_none()); -- assert!(self.units.contains_key(&unit_id)); -+ if self.runtime_target.is_some() { -+ eprintln!("init: runtime target already set, ignoring {}", unit_id.0); -+ return; -+ } -+ if !self.units.contains_key(&unit_id) { -+ eprintln!("init: runtime target {} not found in unit store", unit_id.0); -+ return; -+ } - self.runtime_target = Some(unit_id); - } - -@@ -85,8 +91,10 @@ impl UnitStore { - let unit = self.load_single_unit(unit_id, errors); - if let Some(unit) = unit { - loaded_units.push(unit.clone()); -- for dep in &self.unit(&unit).info.requires_weak { -- pending_units.push(dep.clone()); -+ if let Some(u) = self.unit(&unit) { -+ for dep in &u.info.requires_weak { -+ pending_units.push(dep.clone()); -+ } - } - } - } -@@ -94,12 +102,12 @@ impl UnitStore { - loaded_units - } - -- pub fn unit(&self, unit: &UnitId) -> &Unit { -- self.units.get(unit).unwrap() -+ pub fn unit(&self, unit: &UnitId) -> Option<&Unit> { -+ self.units.get(unit) - } - -- pub fn unit_mut(&mut self, unit: &UnitId) -> &mut Unit { -- self.units.get_mut(unit).unwrap() -+ pub fn unit_mut(&mut self, unit: &UnitId) -> Option<&mut Unit> { -+ self.units.get_mut(unit) - } - } - -@@ -180,7 +188,7 @@ impl Unit { - ) -> io::Result { - let config = fs::read_to_string(config_path)?; - -- let Some(ext) = config_path.extension().map(|ext| ext.to_str().unwrap()) else { -+ let Some(ext) = config_path.extension().and_then(|ext| ext.to_str()) else { - let script = Script::from_str(&config, errors)?; - return Ok(Unit { - id, -diff --git a/logd/src/main.rs b/logd/src/main.rs -index 3636f1fa..559d8993 100644 ---- a/logd/src/main.rs -+++ b/logd/src/main.rs -@@ -6,18 +6,30 @@ use crate::scheme::LogScheme; - mod scheme; - - fn daemon(daemon: daemon::SchemeDaemon) -> ! { -- let socket = Socket::create().expect("logd: failed to create log scheme"); -+ let socket = match Socket::create() { -+ Ok(s) => s, -+ Err(e) => { -+ eprintln!("logd: failed to create log scheme: {e}"); -+ std::process::exit(1); -+ } -+ }; - - let mut scheme = LogScheme::new(&socket); - let handler = Blocking::new(&socket, 16); - - let _ = daemon.ready_sync_scheme(&socket, &mut scheme); - -- libredox::call::setrens(0, 0).expect("logd: failed to enter null namespace"); -- -- handler -- .process_requests_blocking(scheme) -- .expect("logd: failed to process requests"); -+ if let Err(e) = libredox::call::setrens(0, 0) { -+ eprintln!("logd: failed to enter null namespace: {e}"); -+ } -+ -+ match handler.process_requests_blocking(scheme) { -+ Ok(never) => match never {}, -+ Err(e) => { -+ eprintln!("logd: failed to process requests: {e}"); -+ std::process::exit(1); -+ } -+ } - } - - fn main() { -diff --git a/logd/src/scheme.rs b/logd/src/scheme.rs -index 070de3d6..ef3e175c 100644 ---- a/logd/src/scheme.rs -+++ b/logd/src/scheme.rs -@@ -22,7 +22,7 @@ pub enum LogHandle { - - pub struct LogScheme<'sock> { - socket: &'sock Socket, -- kernel_debug: File, -+ kernel_debug: Option, - output_tx: Sender, - handles: HandleMap, - } -@@ -34,12 +34,24 @@ enum OutputCmd { - - impl<'sock> LogScheme<'sock> { - pub fn new(socket: &'sock Socket) -> Self { -- let kernel_debug = OpenOptions::new() -+ let kernel_debug = match OpenOptions::new() - .write(true) - .open("/scheme/debug") -- .unwrap(); -+ { -+ Ok(f) => Some(f), -+ Err(e) => { -+ eprintln!("logd: failed to open /scheme/debug: {e}"); -+ None -+ } -+ }; - -- let mut kernel_sys_log = std::fs::File::open("/scheme/sys/log").unwrap(); -+ let kernel_sys_log = match std::fs::File::open("/scheme/sys/log") { -+ Ok(f) => Some(f), -+ Err(e) => { -+ eprintln!("logd: failed to open /scheme/sys/log: {e}"); -+ None -+ } -+ }; - - let (output_tx, output_rx) = mpsc::channel::(); - -@@ -72,20 +84,28 @@ impl<'sock> LogScheme<'sock> { - } - }); - -- let output_tx2 = output_tx.clone(); -- std::thread::spawn(move || { -- let mut handle_buf = vec![]; -- let mut buf = [0; 4096]; -- buf[.."kernel: ".len()].copy_from_slice(b"kernel: "); -- loop { -- let n = kernel_sys_log.read(&mut buf["kernel: ".len()..]).unwrap(); -- if n == 0 { -- // FIXME currently possible as /scheme/log/kernel presents a snapshot of the log queue -- break; -+ if let Some(mut kernel_sys_log) = kernel_sys_log { -+ let output_tx2 = output_tx.clone(); -+ std::thread::spawn(move || { -+ let mut handle_buf = vec![]; -+ let mut buf = [0; 4096]; -+ buf[.."kernel: ".len()].copy_from_slice(b"kernel: "); -+ loop { -+ let n = match kernel_sys_log.read(&mut buf["kernel: ".len()..]) { -+ Ok(n) => n, -+ Err(e) => { -+ eprintln!("logd: error reading kernel log: {e}"); -+ break; -+ } -+ }; -+ if n == 0 { -+ // FIXME currently possible as /scheme/log/kernel presents a snapshot of the log queue -+ break; -+ } -+ Self::write_logs(&output_tx2, &mut handle_buf, "kernel", &buf, None); - } -- Self::write_logs(&output_tx2, &mut handle_buf, "kernel", &buf, None); -- } -- }); -+ }); -+ } - - LogScheme { - socket, -@@ -120,9 +140,9 @@ impl<'sock> LogScheme<'sock> { - let _ = kernel_debug.flush(); - } - -- output_tx -- .send(OutputCmd::Log(mem::take(handle_buf))) -- .unwrap(); -+ if let Err(e) = output_tx.send(OutputCmd::Log(mem::take(handle_buf))) { -+ eprintln!("logd: failed to send log output: {e}"); -+ } - } - - i += 1; -@@ -196,7 +216,7 @@ impl<'sock> SchemeSync for LogScheme<'sock> { - handle_buf, - context, - buf, -- Some(&mut self.kernel_debug), -+ self.kernel_debug.as_mut(), - ); - - Ok(buf.len()) -@@ -217,7 +237,10 @@ impl<'sock> SchemeSync for LogScheme<'sock> { - ) { - return Err(e); - } -- self.output_tx.send(OutputCmd::AddSink(new_fd)).unwrap(); -+ if let Err(e) = self.output_tx.send(OutputCmd::AddSink(new_fd)) { -+ eprintln!("logd: failed to add log sink: {e}"); -+ return Err(Error::new(EIO)); -+ } - - Ok(1) - } -diff --git a/randd/src/main.rs b/randd/src/main.rs -index d68dd732..5c330719 100644 ---- a/randd/src/main.rs -+++ b/randd/src/main.rs -@@ -41,7 +41,11 @@ fn create_rdrand_seed() -> [u8; SEED_BYTES] { - let mut have_seeded = false; - #[cfg(target_arch = "x86_64")] - { -- if CpuId::new().get_feature_info().unwrap().has_rdrand() { -+ if CpuId::new() -+ .get_feature_info() -+ .map(|info| info.has_rdrand()) -+ .unwrap_or(false) -+ { - for i in 0..SEED_BYTES / 8 { - // We get 8 bytes at a time from rdrand instruction - let rand: u64; -@@ -81,7 +85,7 @@ fn create_rdrand_seed() -> [u8; SEED_BYTES] { - } - } // TODO integrate alternative entropy sources - if !have_seeded { -- println!("randd: Seeding failed, no entropy source. Random numbers on this platform are NOT SECURE"); -+ eprintln!("randd: no hardware entropy source, random numbers are NOT SECURE"); - } - rng - } -@@ -450,18 +454,32 @@ impl SchemeSync for RandScheme { - } - - fn daemon(daemon: daemon::SchemeDaemon) -> ! { -- let socket = Socket::create().expect("randd: failed to create rand scheme"); -+ let socket = match Socket::create() { -+ Ok(s) => s, -+ Err(e) => { -+ eprintln!("randd: failed to create rand scheme: {e}"); -+ std::process::exit(1); -+ } -+ }; - - let mut scheme = RandScheme::new(); -- let handler = Blocking::new(&socket, 16); - - let _ = daemon.ready_sync_scheme(&socket, &mut scheme); - -- libredox::call::setrens(0, 0).expect("randd: failed to enter null namespace"); -+ if let Err(e) = libredox::call::setrens(0, 0) { -+ eprintln!("randd: failed to enter null namespace: {e}"); -+ } - -- handler -- .process_requests_blocking(scheme) -- .expect("randd: failed to process events from zero scheme"); -+ loop { -+ let handler = Blocking::new(&socket, 16); -+ match handler.process_requests_blocking(scheme) { -+ Ok(never) => never, -+ Err(e) => { -+ eprintln!("randd: error processing requests: {e}"); -+ scheme = RandScheme::new(); -+ } -+ } -+ } - } - - fn main() { -diff --git a/zerod/src/main.rs b/zerod/src/main.rs -index c9bd1465..59f6b97c 100644 ---- a/zerod/src/main.rs -+++ b/zerod/src/main.rs -@@ -5,6 +5,7 @@ use scheme_utils::Blocking; - - mod scheme; - -+#[derive(Clone, Copy)] - enum Ty { - Null, - Zero, -@@ -15,21 +16,36 @@ fn main() { - } - - fn daemon(daemon: daemon::SchemeDaemon) -> ! { -- let ty = match &*std::env::args().nth(1).unwrap() { -- "null" => Ty::Null, -- "zero" => Ty::Zero, -- _ => panic!("needs to be called with either null or zero as argument"), -+ let ty = match std::env::args().nth(1).as_deref() { -+ Some("null") => Ty::Null, -+ Some("zero") | None => Ty::Zero, -+ Some(other) => { -+ eprintln!("zerod: unknown argument '{other}', use 'null' or 'zero'"); -+ std::process::exit(1); -+ } - }; - -- let socket = Socket::create().expect("zerod: failed to create zero scheme"); -+ let socket = match Socket::create() { -+ Ok(s) => s, -+ Err(e) => { -+ eprintln!("zerod: failed to create zero scheme: {e}"); -+ std::process::exit(1); -+ } -+ }; - let mut zero_scheme = ZeroScheme(ty); -- let zero_handler = Blocking::new(&socket, 16); - - let _ = daemon.ready_sync_scheme(&socket, &mut zero_scheme); - -- libredox::call::setrens(0, 0).expect("zerod: failed to enter null namespace"); -- -- zero_handler -- .process_requests_blocking(zero_scheme) -- .expect("zerod: failed to process events from zero scheme"); -+ if let Err(e) = libredox::call::setrens(0, 0) { -+ eprintln!("zerod: failed to enter null namespace: {e}"); -+ } -+ -+ loop { -+ let zero_handler = Blocking::new(&socket, 16); -+ let scheme = ZeroScheme(ty); -+ match zero_handler.process_requests_blocking(scheme) { -+ Ok(never) => never, -+ Err(e) => eprintln!("zerod: error processing requests: {e}"), -+ } -+ } - } diff --git a/local/archived/patches-2026-06-migration/bootloader/absorbed/P3-uefi-live-image-safe-read.patch b/local/archived/patches-2026-06-migration/bootloader/absorbed/P3-uefi-live-image-safe-read.patch deleted file mode 100644 index 43640d93e7..0000000000 --- a/local/archived/patches-2026-06-migration/bootloader/absorbed/P3-uefi-live-image-safe-read.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- a/src/os/uefi/device.rs -+++ b/src/os/uefi/device.rs -@@ -228,8 +228,38 @@ - }; - - let mut buffer = Vec::new(); -- -- live_image.read_to_end(&mut buffer).unwrap(); -+ let mut chunk = [0_u8; 64 * 1024]; -+ -+ const MAX_LIVE_IMAGE_PRELOAD: usize = 128 * 1024 * 1024; -+ -+ loop { -+ let read = match live_image.read(&mut chunk) { -+ Ok(read) => read, -+ Err(err) => { -+ log::warn!( -+ "Failed while reading {}\\redox-live.iso: {:?}", -+ device_path_to_string(esp_device_path), -+ err -+ ); -+ return None; -+ } -+ }; -+ -+ if read == 0 { -+ break; -+ } -+ -+ if buffer.len().saturating_add(read) > MAX_LIVE_IMAGE_PRELOAD { -+ log::warn!( -+ "Skipping {}\\redox-live.iso preload: file exceeds {} MiB safety limit", -+ device_path_to_string(esp_device_path), -+ MAX_LIVE_IMAGE_PRELOAD / 1024 / 1024 -+ ); -+ return None; -+ } -+ -+ buffer.extend_from_slice(&chunk[..read]); -+ } - - Some(buffer) - } -@@ -267,7 +297,7 @@ - - if cfg!(feature = "live") { - if let Some(buffer) = esp_live_image(esp_handle, esp_device_path.0) { -- let partition_offset = if buffer.len() > 520 && &buffer[512..520] == b"EFI PART" { -+ let partition_offset = if buffer.len() >= 520 && &buffer[512..520] == b"EFI PART" { - gpt_find_redoxfs_offset_from_slice(&buffer) - } else { - 0 diff --git a/local/archived/patches-2026-06-migration/bootloader/absorbed/P4-live-large-iso-boot.patch b/local/archived/patches-2026-06-migration/bootloader/absorbed/P4-live-large-iso-boot.patch deleted file mode 100644 index c11abba9a6..0000000000 --- a/local/archived/patches-2026-06-migration/bootloader/absorbed/P4-live-large-iso-boot.patch +++ /dev/null @@ -1,215 +0,0 @@ ---- a/src/arch/x86/mod.rs -+++ b/src/arch/x86/mod.rs -@@ -3,10 +3,15 @@ - pub(crate) mod x32; - pub(crate) mod x64; - --pub unsafe fn paging_create(os: &impl Os, kernel_phys: u64, kernel_size: u64) -> Option { -+pub unsafe fn paging_create( -+ os: &impl Os, -+ kernel_phys: u64, -+ kernel_size: u64, -+ identity_map_end: u64, -+) -> Option { - unsafe { - if crate::KERNEL_64BIT { -- x64::paging_create(os, kernel_phys, kernel_size) -+ x64::paging_create(os, kernel_phys, kernel_size, identity_map_end) - } else { - x32::paging_create(os, kernel_phys, kernel_size) - } ---- a/src/arch/x86/x64.rs -+++ b/src/arch/x86/x64.rs -@@ -29,7 +29,12 @@ - const WRITABLE: u64 = 1 << 1; - const LARGE: u64 = 1 << 7; - --pub unsafe fn paging_create(os: &impl Os, kernel_phys: u64, kernel_size: u64) -> Option { -+pub unsafe fn paging_create( -+ os: &impl Os, -+ kernel_phys: u64, -+ kernel_size: u64, -+ identity_map_end: u64, -+) -> Option { - unsafe { - // Create PML4 - let pml4 = paging_allocate(os)?; -@@ -42,8 +47,14 @@ - pml4[0] = pdp.as_ptr() as u64 | WRITABLE | PRESENT; - pml4[256] = pdp.as_ptr() as u64 | WRITABLE | PRESENT; - -- // Identity map 8 GiB using 2 MiB pages -- for pdp_i in 0..8 { -+ let mut needed_pdp = identity_map_end.div_ceil(0x4000_0000); -+ if needed_pdp == 0 { -+ needed_pdp = 1; -+ } -+ assert!(needed_pdp <= pdp.len() as u64, "identity map end exceeds paging span"); -+ -+ // Identity map required physical range using 2 MiB pages -+ for pdp_i in 0..needed_pdp as usize { - let pd = paging_allocate(os)?; - pdp[pdp_i] = pd.as_ptr() as u64 | WRITABLE | PRESENT; - for pd_i in 0..pd.len() { ---- a/src/main.rs -+++ b/src/main.rs -@@ -641,15 +641,34 @@ - (memory.len() as u64, memory.as_mut_ptr() as u64) - }; - -- let page_phys = unsafe { paging_create(os, kernel.as_ptr() as u64, kernel.len() as u64) } -- .expect("Failed to set up paging"); -- - let max_env_size = 64 * KIBI; - let mut env_size = max_env_size; - let env_base = os.alloc_zeroed_page_aligned(env_size); - if env_base.is_null() { - panic!("Failed to allocate memory for stack"); - } -+ -+ let mut identity_map_end = region_end(kernel.as_ptr() as u64, kernel.len() as u64) -+ .max(region_end(stack_base as u64, stack_size as u64)) -+ .max(region_end(bootstrap_base, bootstrap_size)) -+ .max(region_end(env_base as u64, max_env_size as u64)); -+ -+ if let Some(ref live) = live_opt { -+ identity_map_end = identity_map_end.max(region_end( -+ live.as_ptr() as u64, -+ live.len() as u64, -+ )); -+ } -+ -+ let page_phys = unsafe { -+ paging_create( -+ os, -+ kernel.as_ptr() as u64, -+ kernel.len() as u64, -+ identity_map_end, -+ ) -+ } -+ .expect("Failed to set up paging"); - - { - let mut w = SliceWriter { ---- a/src/os/uefi/device.rs -+++ b/src/os/uefi/device.rs -@@ -26,19 +26,10 @@ - } - - let mut header_buf = [0u8; 512]; -- let lba1_block = block_size / redoxfs::BLOCK_SIZE; -- let header_read_len = if 512 <= redoxfs::BLOCK_SIZE as usize { -- redoxfs::BLOCK_SIZE as usize -- } else { -- 512 -- }; -- let mut read_buf = vec![0u8; header_read_len]; -- if unsafe { disk.read_at(lba1_block, &mut read_buf) }.is_err() { -+ if disk.read_bytes(block_size, &mut header_buf).is_err() { - log::warn!("GPT: failed to read LBA 1"); - return 2 * crate::MIBI as u64; - } -- let copy_len = 512.min(read_buf.len()); -- header_buf[..copy_len].copy_from_slice(&read_buf[..copy_len]); - - if &header_buf[0..8] != b"EFI PART" { - log::warn!("GPT: no valid signature at LBA 1"); -@@ -64,19 +55,15 @@ - } - - let entries_byte_offset = partition_entry_start_lba * block_size; -- let entries_start_block = entries_byte_offset / redoxfs::BLOCK_SIZE; - - let total_entries_bytes = num_entries as usize * entry_size as usize; -- let read_size = total_entries_bytes.min(4096); -- let mut entries_buf = vec![0u8; read_size + redoxfs::BLOCK_SIZE as usize]; -- let entries_read_blocks = (read_size as u64).div_ceil(redoxfs::BLOCK_SIZE) as usize; -- if unsafe { disk.read_at(entries_start_block, &mut entries_buf[..entries_read_blocks * redoxfs::BLOCK_SIZE as usize]) }.is_err() { -+ let mut entries_buf = vec![0u8; total_entries_bytes]; -+ if disk.read_bytes(entries_byte_offset, &mut entries_buf).is_err() { - log::warn!("GPT: failed to read partition entries"); - return 2 * crate::MIBI as u64; - } - -- let entries_per_chunk = read_size / entry_size as usize; -- for i in 0..entries_per_chunk.min(num_entries as usize) { -+ for i in 0..num_entries as usize { - let off = i * entry_size as usize; - if off + entry_size as usize > entries_buf.len() { - break; ---- a/src/os/uefi/disk.rs -+++ b/src/os/uefi/disk.rs -@@ -117,3 +117,43 @@ - Err(Error::new(EIO)) - } - } -+ -+impl DiskEfi { -+ pub fn media_block_size(&self) -> usize { -+ self.0.Media.BlockSize as usize -+ } -+ -+ pub fn read_bytes(&mut self, offset: u64, buffer: &mut [u8]) -> Result<()> { -+ let block_size = self.media_block_size(); -+ if block_size == 0 || block_size > self.1.len() { -+ return Err(Error::new(EINVAL)); -+ } -+ -+ let scratch = &mut self.1[..block_size]; -+ let mut copied = 0usize; -+ -+ while copied < buffer.len() { -+ let absolute = offset as usize + copied; -+ let lba = (absolute / block_size) as u64; -+ let in_block = absolute % block_size; -+ -+ match (self.0.ReadBlocks)( -+ self.0, -+ self.0.Media.MediaId, -+ lba, -+ block_size, -+ scratch.as_mut_ptr(), -+ ) { -+ status if status.is_success() => { -+ let chunk_len = core::cmp::min(block_size - in_block, buffer.len() - copied); -+ buffer[copied..copied + chunk_len] -+ .copy_from_slice(&scratch[in_block..in_block + chunk_len]); -+ copied += chunk_len; -+ } -+ _ => return Err(Error::new(EIO)), -+ } -+ } -+ -+ Ok(()) -+ } -+} ---- a/src/os/uefi/mod.rs -+++ b/src/os/uefi/mod.rs -@@ -45,19 +45,18 @@ - let pages = size.div_ceil(page_size); - - let ptr = { -- // Max address mapped by src/arch paging code (8 GiB) - let mut ptr = 0x2_0000_0000; -- status_to_result((std::system_table().BootServices.AllocatePages)( -- 1, // AllocateMaxAddress -- MemoryType::EfiRuntimeServicesData, // Keeps this memory out of free space list -+ if status_to_result((std::system_table().BootServices.AllocatePages)( -+ 0, -+ MemoryType::EfiLoaderData, - pages, - &mut ptr, - )) -- .unwrap_or_else(|_| { -- ptr = 0; -- 0 -- }); -- if ptr == 0 { ptr::null_mut() } else { ptr as *mut u8 } -+ .is_err() -+ { -+ return ptr::null_mut(); -+ } -+ ptr as *mut u8 - }; - - if !ptr.is_null() { diff --git a/local/archived/patches-2026-06-migration/kernel/absorbed/P0-amd-acpi-x2apic.patch b/local/archived/patches-2026-06-migration/kernel/absorbed/P0-amd-acpi-x2apic.patch deleted file mode 100644 index 651fb5f7e5..0000000000 --- a/local/archived/patches-2026-06-migration/kernel/absorbed/P0-amd-acpi-x2apic.patch +++ /dev/null @@ -1,765 +0,0 @@ -diff --git a/src/acpi/madt/arch/x86.rs b/src/acpi/madt/arch/x86.rs ---- a/src/acpi/madt/arch/x86.rs -+++ b/src/acpi/madt/arch/x86.rs -@@ -1,154 +1,247 @@ - use core::{ - hint, - sync::atomic::{AtomicU8, Ordering}, - }; - - use crate::{ - arch::start::KernelArgsAp, - cpu_set::LogicalCpuId, - device::local_apic::the_local_apic, - memory::{ - allocate_p2frame, Frame, KernelMapper, Page, PageFlags, PhysicalAddress, RmmA, RmmArch, - VirtualAddress, PAGE_SIZE, - }, - start::kstart_ap, - AP_READY, - }; - - use super::{Madt, MadtEntry}; - - const TRAMPOLINE: usize = 0x8000; - static TRAMPOLINE_DATA: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/trampoline")); - - pub(super) fn init(madt: Madt) { - let local_apic = unsafe { the_local_apic() }; - let me = local_apic.id(); - - if local_apic.x2 { - debug!(" X2APIC {}", me.get()); - } else { - debug!(" XAPIC {}: {:>08X}", me.get(), local_apic.address); - } - - if cfg!(not(feature = "multi_core")) { - return; - } - -- // Map trampoline -+ // Map trampoline writable and executable (trampoline page holds both code -+ // and AP argument data — AP writes ap_ready on the same page, so W^X is -+ // not possible without splitting code/data across pages). - let trampoline_frame = Frame::containing(PhysicalAddress::new(TRAMPOLINE)); - let trampoline_page = Page::containing_address(VirtualAddress::new(TRAMPOLINE)); - let (result, page_table_physaddr) = unsafe { -- //TODO: do not have writable and executable! - let mut mapper = KernelMapper::lock_rw(); - - let result = mapper - .map_phys( - trampoline_page.start_address(), - trampoline_frame.base(), -- PageFlags::new().execute(true).write(true), -+ PageFlags::new().write(true).execute(true), - ) - .expect("failed to map trampoline"); - - (result, mapper.table().phys().data()) - }; - result.flush(); - - // Write trampoline, make sure TRAMPOLINE page is free for use - for (i, val) in TRAMPOLINE_DATA.iter().enumerate() { - unsafe { - (*((TRAMPOLINE as *mut u8).add(i) as *const AtomicU8)).store(*val, Ordering::SeqCst); - } - } - - for madt_entry in madt.iter() { - debug!(" {:x?}", madt_entry); - if let MadtEntry::LocalApic(ap_local_apic) = madt_entry { - if u32::from(ap_local_apic.id) == me.get() { - debug!(" This is my local APIC"); - } else if ap_local_apic.flags & 1 == 1 { - let cpu_id = LogicalCpuId::next(); - - // Allocate a stack - let stack_start = RmmA::phys_to_virt( - allocate_p2frame(4) - .expect("no more frames in acpi stack_start") - .base(), - ) - .data(); - let stack_end = stack_start + (PAGE_SIZE << 4); - - let pcr_ptr = crate::arch::gdt::allocate_and_init_pcr(cpu_id, stack_end); - - let idt_ptr = crate::arch::idt::allocate_and_init_idt(cpu_id); - - let args = KernelArgsAp { - stack_end: stack_end as *mut u8, - cpu_id, - pcr_ptr, - idt_ptr, - }; - - let ap_ready = (TRAMPOLINE + 8) as *mut u64; - let ap_args_ptr = unsafe { ap_ready.add(1) }; - let ap_page_table = unsafe { ap_ready.add(2) }; - let ap_code = unsafe { ap_ready.add(3) }; - - // Set the ap_ready to 0, volatile - unsafe { - ap_ready.write(0); - ap_args_ptr.write(&args as *const _ as u64); - ap_page_table.write(page_table_physaddr as u64); - #[expect(clippy::fn_to_numeric_cast)] - ap_code.write(kstart_ap as u64); - - // TODO: Is this necessary (this fence)? - core::arch::asm!(""); - }; - AP_READY.store(false, Ordering::SeqCst); - - // Send INIT IPI - { - let mut icr = 0x4500; - if local_apic.x2 { - icr |= u64::from(ap_local_apic.id) << 32; - } else { - icr |= u64::from(ap_local_apic.id) << 56; - } - local_apic.set_icr(icr); - } - - // Send START IPI - { - let ap_segment = (TRAMPOLINE >> 12) & 0xFF; - let mut icr = 0x4600 | ap_segment as u64; - - if local_apic.x2 { - icr |= u64::from(ap_local_apic.id) << 32; - } else { - icr |= u64::from(ap_local_apic.id) << 56; - } - - local_apic.set_icr(icr); - } - - // Wait for trampoline ready - while unsafe { (*ap_ready.cast::()).load(Ordering::SeqCst) } == 0 { - hint::spin_loop(); - } - while !AP_READY.load(Ordering::SeqCst) { - hint::spin_loop(); - } - - RmmA::invalidate_all(); - } -+ } else if let MadtEntry::LocalX2Apic(ap_x2apic) = madt_entry { -+ if ap_x2apic.x2apic_id == me.get() { -+ debug!(" This is my local x2APIC"); -+ } else if ap_x2apic.flags & 1 == 1 { -+ let cpu_id = LogicalCpuId::next(); -+ -+ let stack_start = RmmA::phys_to_virt( -+ allocate_p2frame(4) -+ .expect("no more frames in acpi stack_start") -+ .base(), -+ ) -+ .data(); -+ let stack_end = stack_start + (PAGE_SIZE << 4); -+ -+ let pcr_ptr = crate::arch::gdt::allocate_and_init_pcr(cpu_id, stack_end); -+ let idt_ptr = crate::arch::idt::allocate_and_init_idt(cpu_id); -+ -+ let args = KernelArgsAp { -+ stack_end: stack_end as *mut u8, -+ cpu_id, -+ pcr_ptr, -+ idt_ptr, -+ }; -+ -+ let ap_ready = (TRAMPOLINE + 8) as *mut u64; -+ let ap_args_ptr = unsafe { ap_ready.add(1) }; -+ let ap_page_table = unsafe { ap_ready.add(2) }; -+ let ap_code = unsafe { ap_ready.add(3) }; -+ -+ unsafe { -+ ap_ready.write(0); -+ ap_args_ptr.write(&args as *const _ as u64); -+ ap_page_table.write(page_table_physaddr as u64); -+ #[expect(clippy::fn_to_numeric_cast)] -+ ap_code.write(kstart_ap as u64); -+ core::arch::asm!(""); -+ }; -+ AP_READY.store(false, Ordering::SeqCst); -+ -+ // Send INIT IPI (x2APIC always uses 32-bit APIC ID in bits 32-63) -+ { -+ let mut icr = 0x4500u64; -+ icr |= u64::from(ap_x2apic.x2apic_id) << 32; -+ local_apic.set_icr(icr); -+ } -+ -+ // Wait for INIT delivery (~10 μs de-assert window per Intel SDM) -+ for _ in 0..100_000 { -+ hint::spin_loop(); -+ } -+ -+ // Send STARTUP IPI -+ { -+ let ap_segment = (TRAMPOLINE >> 12) & 0xFF; -+ let mut icr = 0x4600u64 | ap_segment as u64; -+ icr |= u64::from(ap_x2apic.x2apic_id) << 32; -+ local_apic.set_icr(icr); -+ } -+ -+ // Wait ~200 μs, then send second STARTUP IPI per the universal -+ // startup algorithm. -+ for _ in 0..2_000_000 { -+ hint::spin_loop(); -+ } -+ { -+ let ap_segment = (TRAMPOLINE >> 12) & 0xFF; -+ let mut icr = 0x4600u64 | ap_segment as u64; -+ icr |= u64::from(ap_x2apic.x2apic_id) << 32; -+ local_apic.set_icr(icr); -+ } -+ -+ let mut timeout = 100_000_000u32; -+ while unsafe { (*ap_ready.cast::()).load(Ordering::SeqCst) } == 0 { -+ hint::spin_loop(); -+ timeout -= 1; -+ if timeout == 0 { -+ debug!("x2APIC AP {} trampoline startup timed out", ap_x2apic.x2apic_id); -+ break; -+ } -+ } -+ let mut timeout = 100_000_000u32; -+ while !AP_READY.load(Ordering::SeqCst) { -+ hint::spin_loop(); -+ timeout -= 1; -+ if timeout == 0 { -+ debug!("x2APIC AP {} kernel startup timed out", ap_x2apic.x2apic_id); -+ break; -+ } -+ } -+ -+ RmmA::invalidate_all(); -+ } - } - } - - // Unmap trampoline - let (_frame, _, flush) = unsafe { - KernelMapper::lock_rw() - .unmap_phys(trampoline_page.start_address()) - .expect("failed to unmap trampoline page") - }; - flush.flush(); - } -diff --git a/src/acpi/madt/mod.rs b/src/acpi/madt/mod.rs ---- a/src/acpi/madt/mod.rs -+++ b/src/acpi/madt/mod.rs -@@ -27,214 +27,240 @@ - pub fn madt() -> Option<&'static Madt> { - unsafe { &*MADT.get() }.as_ref() - } - pub const FLAG_PCAT: u32 = 1; - - impl Madt { - pub fn init() { - let madt = Madt::new(find_one_sdt!("APIC")); - - if let Some(madt) = madt { - // safe because no APs have been started yet. - unsafe { MADT.get().write(Some(madt)) }; - - debug!(" APIC: {:>08X}: {}", madt.local_address, madt.flags); - - arch::init(madt); - } - } - - pub fn new(sdt: &'static Sdt) -> Option { - if &sdt.signature == b"APIC" && sdt.data_len() >= 8 { - //Not valid if no local address and flags - let local_address = unsafe { (sdt.data_address() as *const u32).read_unaligned() }; - let flags = unsafe { - (sdt.data_address() as *const u32) - .offset(1) - .read_unaligned() - }; - - Some(Madt { - sdt, - local_address, - flags, - }) - } else { - None - } - } - - pub fn iter(&self) -> MadtIter { - MadtIter { - sdt: self.sdt, - i: 8, // Skip local controller address and flags - } - } - } - - /// MADT Local APIC - #[derive(Clone, Copy, Debug)] - #[repr(C, packed)] - pub struct MadtLocalApic { - /// Processor ID - pub processor: u8, - /// Local APIC ID - pub id: u8, - /// Flags. 1 means that the processor is enabled - pub flags: u32, - } - - /// MADT I/O APIC - #[derive(Clone, Copy, Debug)] - #[repr(C, packed)] - pub struct MadtIoApic { - /// I/O APIC ID - pub id: u8, - /// reserved - _reserved: u8, - /// I/O APIC address - pub address: u32, - /// Global system interrupt base - pub gsi_base: u32, - } - - /// MADT Interrupt Source Override - #[derive(Clone, Copy, Debug)] - #[repr(C, packed)] - pub struct MadtIntSrcOverride { - /// Bus Source - pub bus_source: u8, - /// IRQ Source - pub irq_source: u8, - /// Global system interrupt base - pub gsi_base: u32, - /// Flags - pub flags: u16, - } - - /// MADT GICC - #[derive(Clone, Copy, Debug)] - #[repr(C, packed)] - pub struct MadtGicc { - _reserved: u16, - pub cpu_interface_number: u32, - pub acpi_processor_uid: u32, - pub flags: u32, - pub parking_protocol_version: u32, - pub performance_interrupt_gsiv: u32, - pub parked_address: u64, - pub physical_base_address: u64, - pub gicv: u64, - pub gich: u64, - pub vgic_maintenance_interrupt: u32, - pub gicr_base_address: u64, - pub mpidr: u64, - pub processor_power_efficiency_class: u8, - _reserved2: u8, - pub spe_overflow_interrupt: u16, - //TODO: optional field introduced in ACPI 6.5: pub trbe_interrupt: u16, - } - - /// MADT GICD - #[derive(Clone, Copy, Debug)] - #[repr(C, packed)] - pub struct MadtGicd { - _reserved: u16, - pub gic_id: u32, - pub physical_base_address: u64, - pub system_vector_base: u32, - pub gic_version: u8, - _reserved2: [u8; 3], -+} -+ -+/// MADT Local x2APIC (entry type 0x9) -+/// Used by modern AMD and Intel platforms with APIC IDs >= 255. -+#[derive(Clone, Copy, Debug)] -+#[repr(C, packed)] -+pub struct MadtLocalX2Apic { -+ _reserved: u16, -+ pub x2apic_id: u32, -+ pub flags: u32, -+ pub processor_uid: u32, - } - - /// MADT Entries - #[derive(Debug)] - #[allow(dead_code)] - pub enum MadtEntry { - LocalApic(&'static MadtLocalApic), - InvalidLocalApic(usize), - IoApic(&'static MadtIoApic), - InvalidIoApic(usize), - IntSrcOverride(&'static MadtIntSrcOverride), - InvalidIntSrcOverride(usize), - Gicc(&'static MadtGicc), - InvalidGicc(usize), - Gicd(&'static MadtGicd), - InvalidGicd(usize), -+ LocalX2Apic(&'static MadtLocalX2Apic), -+ InvalidLocalX2Apic(usize), - Unknown(u8), - } - - pub struct MadtIter { - sdt: &'static Sdt, - i: usize, - } - - impl Iterator for MadtIter { - type Item = MadtEntry; - fn next(&mut self) -> Option { - if self.i + 1 < self.sdt.data_len() { - let entry_type = unsafe { *(self.sdt.data_address() as *const u8).add(self.i) }; - let entry_len = - unsafe { *(self.sdt.data_address() as *const u8).add(self.i + 1) } as usize; - -+ if entry_len < 2 { -+ return None; -+ } -+ - if self.i + entry_len <= self.sdt.data_len() { - let item = match entry_type { - 0x0 => { - if entry_len == size_of::() + 2 { - MadtEntry::LocalApic(unsafe { - &*((self.sdt.data_address() + self.i + 2) as *const MadtLocalApic) - }) - } else { - MadtEntry::InvalidLocalApic(entry_len) - } - } - 0x1 => { - if entry_len == size_of::() + 2 { - MadtEntry::IoApic(unsafe { - &*((self.sdt.data_address() + self.i + 2) as *const MadtIoApic) - }) - } else { - MadtEntry::InvalidIoApic(entry_len) - } - } - 0x2 => { - if entry_len == size_of::() + 2 { - MadtEntry::IntSrcOverride(unsafe { - &*((self.sdt.data_address() + self.i + 2) - as *const MadtIntSrcOverride) - }) - } else { - MadtEntry::InvalidIntSrcOverride(entry_len) - } - } - 0xB => { - if entry_len >= size_of::() + 2 { - MadtEntry::Gicc(unsafe { - &*((self.sdt.data_address() + self.i + 2) as *const MadtGicc) - }) - } else { - MadtEntry::InvalidGicc(entry_len) - } - } - 0xC => { - if entry_len >= size_of::() + 2 { - MadtEntry::Gicd(unsafe { - &*((self.sdt.data_address() + self.i + 2) as *const MadtGicd) - }) - } else { - MadtEntry::InvalidGicd(entry_len) - } - } -+ 0x9 => { -+ if entry_len == size_of::() + 2 { -+ MadtEntry::LocalX2Apic(unsafe { -+ &*((self.sdt.data_address() + self.i + 2) as *const MadtLocalX2Apic) -+ }) -+ } else { -+ MadtEntry::InvalidLocalX2Apic(entry_len) -+ } -+ } - _ => MadtEntry::Unknown(entry_type), - }; - - self.i += entry_len; - - Some(item) - } else { - None - } - } else { - None - } - } - } -diff --git a/src/arch/x86_shared/cpuid.rs b/src/arch/x86_shared/cpuid.rs ---- a/src/arch/x86_shared/cpuid.rs -+++ b/src/arch/x86_shared/cpuid.rs -@@ -1,29 +1,39 @@ - use raw_cpuid::{CpuId, CpuIdResult, ExtendedFeatures, FeatureInfo}; - -+#[cfg(target_arch = "x86_64")] - pub fn cpuid() -> CpuId { -- // FIXME check for cpuid availability during early boot and error out if it doesn't exist. - CpuId::with_cpuid_fn(|a, c| { -- #[cfg(target_arch = "x86")] -+ let result = unsafe { core::arch::x86_64::__cpuid_count(a, c) }; -+ CpuIdResult { -+ eax: result.eax, -+ ebx: result.ebx, -+ ecx: result.ecx, -+ edx: result.edx, -+ } -+ }) -+} -+ -+#[cfg(target_arch = "x86")] -+pub fn cpuid() -> CpuId { -+ CpuId::with_cpuid_fn(|a, c| { - let result = unsafe { core::arch::x86::__cpuid_count(a, c) }; -- #[cfg(target_arch = "x86_64")] -- let result = unsafe { core::arch::x86_64::__cpuid_count(a, c) }; - CpuIdResult { - eax: result.eax, - ebx: result.ebx, - ecx: result.ecx, - edx: result.edx, - } - }) - } - - #[cfg_attr(not(target_arch = "x86_64"), expect(dead_code))] - pub fn feature_info() -> FeatureInfo { - cpuid() - .get_feature_info() - .expect("x86_64 requires CPUID leaf=0x01 to be present") - } - - #[cfg_attr(not(target_arch = "x86_64"), expect(dead_code))] - pub fn has_ext_feat(feat: impl FnOnce(ExtendedFeatures) -> bool) -> bool { - cpuid().get_extended_feature_info().is_some_and(feat) - } -diff --git a/src/context/memory.rs b/src/context/memory.rs ---- a/src/context/memory.rs -+++ b/src/context/memory.rs -@@ -890,112 +890,128 @@ - .range(..=page) - .next_back() - .filter(|(base, info)| (**base..base.next_by(info.page_count)).contains(&page)) - .map(|(base, info)| (*base, info)) - } - - /// Returns an iterator over all grants that occupy some part of the - /// requested region - pub fn conflicts(&self, span: PageSpan) -> impl Iterator + '_ { - let start = self.contains(span.base); - - // If there is a grant that contains the base page, start searching at the base of that - // grant, rather than the requested base here. - let start_span = start - .map(|(base, info)| PageSpan::new(base, info.page_count)) - .unwrap_or(span); - - self.inner - .range(start_span.base..) - .take_while(move |(base, info)| PageSpan::new(**base, info.page_count).intersects(span)) - .map(|(base, info)| (*base, info)) - } - // TODO: DEDUPLICATE CODE! - pub fn conflicts_mut( - &mut self, - span: PageSpan, - ) -> impl Iterator + '_ { - let start = self.contains(span.base); - - // If there is a grant that contains the base page, start searching at the base of that - // grant, rather than the requested base here. - let start_span = start - .map(|(base, info)| PageSpan::new(base, info.page_count)) - .unwrap_or(span); - - self.inner - .range_mut(start_span.base..) - .take_while(move |(base, info)| PageSpan::new(**base, info.page_count).intersects(span)) - .map(|(base, info)| (*base, info)) - } -- /// Return a free region with the specified size -- // TODO: Alignment (x86_64: 4 KiB, 2 MiB, or 1 GiB). -+ /// Return a free region with the specified size, optionally aligned to a power-of-two -+ /// boundary (x86_64 supports 4 KiB, 2 MiB, or 1 GiB pages). - // TODO: Support finding grant close to a requested address? - pub fn find_free_near( - &self, - min: usize, - page_count: usize, - _near: Option, - ) -> Option { -- // Get first available hole, but do reserve the page starting from zero as most compiled -- // languages cannot handle null pointers safely even if they point to valid memory. If an -- // application absolutely needs to map the 0th page, they will have to do so explicitly via -- // MAP_FIXED/MAP_FIXED_NOREPLACE. -- // TODO: Allow explicitly allocating guard pages? Perhaps using mprotect or mmap with -- // PROT_NONE? -+ self.find_free_near_aligned(min, page_count, _near, 0) -+ } -+ pub fn find_free_near_aligned( -+ &self, -+ min: usize, -+ page_count: usize, -+ _near: Option, -+ page_alignment: usize, -+ ) -> Option { -+ let alignment = if page_alignment == 0 { -+ PAGE_SIZE -+ } else { -+ assert!( -+ page_alignment.is_power_of_two(), -+ "page_alignment must be a power of two" -+ ); -+ page_alignment * PAGE_SIZE -+ }; - - let (hole_start, _hole_size) = self - .holes - .iter() - .skip_while(|(hole_offset, hole_size)| hole_offset.data() + **hole_size <= min) - .find(|(hole_offset, hole_size)| { -- let avail_size = -- if hole_offset.data() <= min && min <= hole_offset.data() + **hole_size { -- **hole_size - (min - hole_offset.data()) -- } else { -- **hole_size -- }; -+ let base = cmp::max(hole_offset.data(), min); -+ let aligned_base = (base + alignment - 1) & !(alignment - 1); -+ let avail_size = if aligned_base <= hole_offset.data() + **hole_size { -+ hole_offset.data() + **hole_size - aligned_base -+ } else { -+ 0 -+ }; - page_count * PAGE_SIZE <= avail_size - })?; -- // Create new region -+ -+ let base = cmp::max(hole_start.data(), min); -+ let aligned_base = (base + alignment - 1) & !(alignment - 1); -+ - Some(PageSpan::new( -- Page::containing_address(VirtualAddress::new(cmp::max(hole_start.data(), min))), -+ Page::containing_address(VirtualAddress::new(aligned_base)), - page_count, - )) - } - pub fn find_free(&self, min: usize, page_count: usize) -> Option { - self.find_free_near(min, page_count, None) - } - fn reserve(&mut self, base: Page, page_count: usize) { - let start_address = base.start_address(); - let size = page_count * PAGE_SIZE; - let end_address = base.start_address().add(size); - - let previous_hole = self.holes.range_mut(..start_address).next_back(); - - if let Some((hole_offset, hole_size)) = previous_hole { - let prev_hole_end = hole_offset.data() + *hole_size; - - // Note that prev_hole_end cannot exactly equal start_address, since that would imply - // there is another grant at that position already, as it would otherwise have been - // larger. - - if prev_hole_end > start_address.data() { - // hole_offset must be below (but never equal to) the start address due to the - // `..start_address()` limit; hence, all we have to do is to shrink the - // previous offset. - *hole_size = start_address.data() - hole_offset.data(); - } - if prev_hole_end > end_address.data() { - // The grant is splitting this hole in two, so insert the new one at the end. - self.holes - .insert(end_address, prev_hole_end - end_address.data()); - } - } - - // Next hole - if let Some(hole_size) = self.holes.remove(&start_address) { - let remainder = hole_size - size; - if remainder > 0 { - self.holes.insert(end_address, remainder); - } - } -diff --git a/src/arch/x86_shared/device/local_apic.rs b/src/arch/x86_shared/device/local_apic.rs ---- a/src/arch/x86_shared/device/local_apic.rs -+++ b/src/arch/x86_shared/device/local_apic.rs -@@ -100,61 +100,68 @@ - } - } - - pub fn id(&self) -> ApicId { - ApicId::new(if self.x2 { - unsafe { rdmsr(IA32_X2APIC_APICID) as u32 } - } else { - unsafe { self.read(0x20) } - }) - } - - pub fn version(&self) -> u32 { - if self.x2 { - unsafe { rdmsr(IA32_X2APIC_VERSION) as u32 } - } else { - unsafe { self.read(0x30) } - } - } - - pub fn icr(&self) -> u64 { - if self.x2 { - unsafe { rdmsr(IA32_X2APIC_ICR) } - } else { - unsafe { ((self.read(0x310) as u64) << 32) | self.read(0x300) as u64 } - } - } - - pub fn set_icr(&mut self, value: u64) { - if self.x2 { - unsafe { -+ const PENDING: u32 = 1 << 12; -+ while (rdmsr(IA32_X2APIC_ICR) as u32) & PENDING == PENDING { -+ core::hint::spin_loop(); -+ } - wrmsr(IA32_X2APIC_ICR, value); -+ while (rdmsr(IA32_X2APIC_ICR) as u32) & PENDING == PENDING { -+ core::hint::spin_loop(); -+ } - } - } else { - unsafe { - const PENDING: u32 = 1 << 12; - while self.read(0x300) & PENDING == PENDING { - core::hint::spin_loop(); - } - self.write(0x310, (value >> 32) as u32); - self.write(0x300, value as u32); - while self.read(0x300) & PENDING == PENDING { - core::hint::spin_loop(); - } - } - } - } - - pub fn ipi(&mut self, apic_id: ApicId, kind: IpiKind) { - let shift = if self.x2 { 32 } else { 56 }; - self.set_icr((u64::from(apic_id.get()) << shift) | 0x40 | kind as u64); - } - pub fn ipi_nmi(&mut self, apic_id: ApicId) { - let shift = if self.x2 { 32 } else { 56 }; - self.set_icr((u64::from(apic_id.get()) << shift) | (1 << 14) | (0b100 << 8)); - } - - pub unsafe fn eoi(&mut self) { - unsafe { - if self.x2 { - wrmsr(IA32_X2APIC_EOI, 0); - } else { diff --git a/local/archived/patches-2026-06-migration/kernel/absorbed/P2-redbear-os-branding.patch b/local/archived/patches-2026-06-migration/kernel/absorbed/P2-redbear-os-branding.patch deleted file mode 100644 index b67d3cdeb9..0000000000 --- a/local/archived/patches-2026-06-migration/kernel/absorbed/P2-redbear-os-branding.patch +++ /dev/null @@ -1,65 +0,0 @@ -# Red Bear OS branding in kernel start messages -# Changes "Redox OS" to "RedBear OS" in architecture start files -# Adds device init logging milestones in x86_shared start path - -diff --git a/src/arch/aarch64/start.rs b/src/arch/aarch64/start.rs -index e1c8cfb4..65e3fe33 100644 ---- a/src/arch/aarch64/start.rs -+++ b/src/arch/aarch64/start.rs -@@ -91,7 +91,7 @@ unsafe extern "C" fn start(args_ptr: *const KernelArgs) -> ! { - dtb::serial::init_early(dtb); - } - -- info!("Redox OS starting..."); -+ info!("RedBear OS starting..."); - args.print(); - - // Initialize RMM -diff --git a/src/arch/riscv64/start.rs b/src/arch/riscv64/start.rs -index 2551968f..a825536a 100644 ---- a/src/arch/riscv64/start.rs -+++ b/src/arch/riscv64/start.rs -@@ -97,7 +97,7 @@ unsafe extern "C" fn start(args_ptr: *const KernelArgs) -> ! { - init_early(dtb); - } - -- info!("Redox OS starting..."); -+ info!("RedBear OS starting..."); - args.print(); - - if let Some(dtb) = &dtb { -diff --git a/src/arch/x86_shared/start.rs b/src/arch/x86_shared/start.rs -index 7a7c0ae8..62f9523c 100644 ---- a/src/arch/x86_shared/start.rs -+++ b/src/arch/x86_shared/start.rs -@@ -91,7 +91,7 @@ unsafe extern "C" fn start(args_ptr: *const KernelArgs, stack_end: usize) -> ! { - // Set up graphical debug - graphical_debug::init(args.env()); - -- info!("Redox OS starting..."); -+ info!("RedBear OS starting..."); - args.print(); - - // Set up GDT -@@ -127,17 +127,21 @@ unsafe extern "C" fn start(args_ptr: *const KernelArgs, stack_end: usize) -> ! { - - // Initialize devices - device::init(); -+ info!("kernel: device init complete (PIC + LAPIC)"); - - // Read ACPI tables, starts APs - if cfg!(feature = "acpi") { - crate::acpi::init(args.acpi_rsdp()); -+ info!("kernel: ACPI tables parsed"); - - device::init_after_acpi(); -+ info!("kernel: IOAPIC init complete"); - } - crate::profiling::init(); - - // Initialize all of the non-core devices not otherwise needed to complete initialization - device::init_noncore(); -+ info!("kernel: timer init complete, entering userspace"); - - args.bootstrap() - }; diff --git a/local/archived/patches-2026-06-migration/kernel/absorbed/P4-supplementary-groups.patch b/local/archived/patches-2026-06-migration/kernel/absorbed/P4-supplementary-groups.patch deleted file mode 100644 index 1ff1e78f63..0000000000 --- a/local/archived/patches-2026-06-migration/kernel/absorbed/P4-supplementary-groups.patch +++ /dev/null @@ -1,137 +0,0 @@ -diff --git a/src/context/context.rs b/src/context/context.rs -index c97c516..6d723f4 100644 ---- a/src/context/context.rs -+++ b/src/context/context.rs -@@ -148,6 +148,8 @@ pub struct Context { - pub euid: u32, - pub egid: u32, - pub pid: usize, -+ /// Supplementary group IDs for access control decisions. -+ pub groups: Vec, - - // See [`PreemptGuard`] - // -@@ -204,6 +206,7 @@ impl Context { - euid: 0, - egid: 0, - pid: 0, -+ groups: Vec::new(), - - #[cfg(feature = "syscall_debug")] - syscall_debug_info: crate::syscall::debug::SyscallDebugInfo::default(), -@@ -479,6 +482,7 @@ impl Context { - uid: self.euid, - gid: self.egid, - pid: self.pid, -+ groups: self.groups.clone(), - } - } - } -diff --git a/src/scheme/mod.rs b/src/scheme/mod.rs -index d30272c..9da2b28 100644 ---- a/src/scheme/mod.rs -+++ b/src/scheme/mod.rs -@@ -777,6 +777,7 @@ pub struct CallerCtx { - pub pid: usize, - pub uid: u32, - pub gid: u32, -+ pub groups: alloc::vec::Vec, - } - impl CallerCtx { - pub fn filter_uid_gid(self, euid: u32, egid: u32) -> Self { -@@ -785,6 +786,7 @@ impl CallerCtx { - pid: self.pid, - uid: euid, - gid: egid, -+ groups: self.groups, - } - } else { - self -diff --git a/src/scheme/proc.rs b/src/scheme/proc.rs -index 47588e1..6ffb256 100644 ---- a/src/scheme/proc.rs -+++ b/src/scheme/proc.rs -@@ -105,6 +105,7 @@ enum ContextHandle { - // Attr handles, to set ens/euid/egid/pid. - Authority, - Attr, -+ Groups, - - Status { - privileged: bool, -@@ -261,6 +262,7 @@ impl ProcScheme { - let handle = match actual_name { - "attrs" => ContextHandle::Attr, - "status" => ContextHandle::Status { privileged: true }, -+ "groups" => ContextHandle::Groups, - _ => return Err(Error::new(ENOENT)), - }; - -@@ -306,6 +308,11 @@ impl ProcScheme { - let id = NonZeroUsize::new(NEXT_ID.fetch_add(1, Ordering::Relaxed)) - .ok_or(Error::new(EMFILE))?; - let context = context::spawn(true, Some(id), ret, token)?; -+ { -+ let parent_groups = -+ context::current().read(token.token()).groups.clone(); -+ context.write(token.token()).groups = parent_groups; -+ } - HANDLES.write(token.token()).insert( - id.get(), - Handle { -@@ -1271,6 +1278,39 @@ impl ContextHandle { - guard.prio = (info.prio as usize).min(39); - Ok(size_of::()) - } -+ Self::Groups => { -+ const NGROUPS_MAX: usize = 65536; -+ if buf.len() % size_of::() != 0 { -+ return Err(Error::new(EINVAL)); -+ } -+ let count = buf.len() / size_of::(); -+ if count > NGROUPS_MAX { -+ return Err(Error::new(EINVAL)); -+ } -+ let mut groups = Vec::with_capacity(count); -+ for chunk in buf.in_exact_chunks(size_of::()).take(count) { -+ groups.push(chunk.read_u32()?); -+ } -+ let proc_id = { -+ let guard = context.read(token.token()); -+ guard.owner_proc_id -+ }; -+ { -+ let mut guard = context.write(token.token()); -+ guard.groups = groups.clone(); -+ } -+ if let Some(pid) = proc_id { -+ let mut contexts = context::contexts(token.downgrade()); -+ let (contexts, mut t) = contexts.token_split(); -+ for context_ref in contexts.iter() { -+ let mut ctx = context_ref.write(t.token()); -+ if ctx.owner_proc_id == Some(pid) { -+ ctx.groups = groups.clone(); -+ } -+ } -+ } -+ Ok(count * size_of::()) -+ } - ContextHandle::OpenViaDup => { - let mut args = buf.usizes(); - -@@ -1475,6 +1515,15 @@ impl ContextHandle { - debug_name, - }) - } -+ Self::Groups => { -+ let c = &context.read(token.token()); -+ let max = buf.len() / size_of::(); -+ let count = c.groups.len().min(max); -+ for (chunk, gid) in buf.in_exact_chunks(size_of::()).zip(&c.groups).take(count) { -+ chunk.copy_from_slice(&gid.to_ne_bytes())?; -+ } -+ Ok(count * size_of::()) -+ } - ContextHandle::Sighandler => { - let data = match context.read(token.token()).sig { - Some(ref sig) => SetSighandlerData { diff --git a/local/archived/patches-2026-06-migration/kernel/absorbed/P5-proc-setschedpolicy.patch b/local/archived/patches-2026-06-migration/kernel/absorbed/P5-proc-setschedpolicy.patch deleted file mode 100644 index 07e234a166..0000000000 --- a/local/archived/patches-2026-06-migration/kernel/absorbed/P5-proc-setschedpolicy.patch +++ /dev/null @@ -1,152 +0,0 @@ -diff --git a/src/scheme/proc.rs b/src/scheme/proc.rs -index 47588e1..6578761 100644 ---- a/src/scheme/proc.rs -+++ b/src/scheme/proc.rs -@@ -1,7 +1,7 @@ - use crate::{ - context::{ - self, -- context::{HardBlockedReason, LockedFdTbl, SignalState}, -+ context::{HardBlockedReason, LockedFdTbl, SchedPolicy, SignalState}, - file::InternalFlags, - memory::{handle_notify_files, AddrSpace, AddrSpaceWrapper, Grant, PageSpan}, - Context, ContextLock, Status, -@@ -105,6 +105,7 @@ enum ContextHandle { - // Attr handles, to set ens/euid/egid/pid. - Authority, - Attr, -+ Groups, - - Status { - privileged: bool, -@@ -145,6 +146,7 @@ enum ContextHandle { - // directory. - OpenViaDup, - SchedAffinity, -+ SchedPolicy, - - MmapMinAddr(Arc), - } -@@ -249,6 +251,9 @@ impl ProcScheme { - false, - ), - "sched-affinity" => (ContextHandle::SchedAffinity, true), -+ // TODO: Switch this kernel-local proc handle over to a stable upstream -+ // redox_syscall ProcCall::SetSchedPolicy opcode once that lands. -+ "sched-policy" => (ContextHandle::SchedPolicy, false), - "status" => (ContextHandle::Status { privileged: false }, false), - _ if path.starts_with("auth-") => { - let nonprefix = &path["auth-".len()..]; -@@ -261,6 +266,7 @@ impl ProcScheme { - let handle = match actual_name { - "attrs" => ContextHandle::Attr, - "status" => ContextHandle::Status { privileged: true }, -+ "groups" => ContextHandle::Groups, - _ => return Err(Error::new(ENOENT)), - }; - -@@ -306,6 +312,11 @@ impl ProcScheme { - let id = NonZeroUsize::new(NEXT_ID.fetch_add(1, Ordering::Relaxed)) - .ok_or(Error::new(EMFILE))?; - let context = context::spawn(true, Some(id), ret, token)?; -+ { -+ let parent_groups = -+ context::current().read(token.token()).groups.clone(); -+ context.write(token.token()).groups = parent_groups; -+ } - HANDLES.write(token.token()).insert( - id.get(), - Handle { -@@ -1165,6 +1176,20 @@ impl ContextHandle { - - Ok(size_of_val(&mask)) - } -+ Self::SchedPolicy => { -+ if buf.len() != 2 { -+ return Err(Error::new(EINVAL)); -+ } -+ -+ let [policy, rt_priority] = unsafe { buf.read_exact::<[u8; 2]>()? }; -+ let sched_policy = SchedPolicy::try_from_raw(policy).ok_or(Error::new(EINVAL))?; -+ -+ context -+ .write(token.token()) -+ .set_sched_policy(sched_policy, rt_priority); -+ -+ Ok(2) -+ } - ContextHandle::Status { privileged } => { - let mut args = buf.usizes(); - -@@ -1268,9 +1293,42 @@ impl ContextHandle { - guard.pid = info.pid as usize; - guard.euid = info.euid; - guard.egid = info.egid; -- guard.prio = (info.prio as usize).min(39); -+ guard.set_sched_other_prio(info.prio as usize); - Ok(size_of::()) - } -+ Self::Groups => { -+ const NGROUPS_MAX: usize = 65536; -+ if buf.len() % size_of::() != 0 { -+ return Err(Error::new(EINVAL)); -+ } -+ let count = buf.len() / size_of::(); -+ if count > NGROUPS_MAX { -+ return Err(Error::new(EINVAL)); -+ } -+ let mut groups = Vec::with_capacity(count); -+ for chunk in buf.in_exact_chunks(size_of::()).take(count) { -+ groups.push(chunk.read_u32()?); -+ } -+ let proc_id = { -+ let guard = context.read(token.token()); -+ guard.owner_proc_id -+ }; -+ { -+ let mut guard = context.write(token.token()); -+ guard.groups = groups.clone(); -+ } -+ if let Some(pid) = proc_id { -+ let mut contexts = context::contexts(token.downgrade()); -+ let (contexts, mut t) = contexts.token_split(); -+ for context_ref in contexts.iter() { -+ let mut ctx = context_ref.write(t.token()); -+ if ctx.owner_proc_id == Some(pid) { -+ ctx.groups = groups.clone(); -+ } -+ } -+ } -+ Ok(count * size_of::()) -+ } - ContextHandle::OpenViaDup => { - let mut args = buf.usizes(); - -@@ -1427,6 +1485,11 @@ impl ContextHandle { - - buf.copy_exactly(crate::cpu_set::mask_as_bytes(&mask))?; - Ok(size_of_val(&mask)) -+ } -+ ContextHandle::SchedPolicy => { -+ let context = context.read(token.token()); -+ let data = [context.sched_policy as u8, context.sched_rt_priority]; -+ buf.copy_common_bytes_from_slice(&data) - } // TODO: Replace write() with SYS_SENDFD? - ContextHandle::Status { .. } => { - let status = { -@@ -1475,6 +1538,15 @@ impl ContextHandle { - debug_name, - }) - } -+ Self::Groups => { -+ let c = &context.read(token.token()); -+ let max = buf.len() / size_of::(); -+ let count = c.groups.len().min(max); -+ for (chunk, gid) in buf.in_exact_chunks(size_of::()).zip(&c.groups).take(count) { -+ chunk.copy_from_slice(&gid.to_ne_bytes())?; -+ } -+ Ok(count * size_of::()) -+ } - ContextHandle::Sighandler => { - let data = match context.read(token.token()).sig { - Some(ref sig) => SetSighandlerData { diff --git a/local/archived/patches-2026-06-migration/kernel/absorbed/P5-sched-policy-context.patch b/local/archived/patches-2026-06-migration/kernel/absorbed/P5-sched-policy-context.patch deleted file mode 100644 index 067565ac40..0000000000 --- a/local/archived/patches-2026-06-migration/kernel/absorbed/P5-sched-policy-context.patch +++ /dev/null @@ -1,176 +0,0 @@ -diff --git a/src/context/context.rs b/src/context/context.rs -index c97c516..8a8b078 100644 ---- a/src/context/context.rs -+++ b/src/context/context.rs -@@ -18,7 +18,8 @@ use crate::{ - cpu_stats, - ipi::{ipi, IpiKind, IpiTarget}, - memory::{ -- allocate_p2frame, deallocate_p2frame, Enomem, Frame, RaiiFrame, RmmA, RmmArch, PAGE_SIZE, -+ allocate_p2frame, deallocate_p2frame, Enomem, Frame, PhysicalAddress, RaiiFrame, RmmA, -+ RmmArch, PAGE_SIZE, - }, - percpu::PercpuBlock, - scheme::{CallerCtx, FileHandle, SchemeId}, -@@ -62,6 +63,38 @@ impl Status { - } - } - -+pub const SCHED_PRIORITY_LEVELS: usize = 40; -+pub const DEFAULT_SCHED_OTHER_PRIORITY: usize = 20; -+pub const DEFAULT_SCHED_RR_QUANTUM: u128 = 100_000_000; -+ -+#[repr(u8)] -+#[derive(Clone, Copy, Debug, PartialEq, Eq)] -+pub enum SchedPolicy { -+ Fifo = 0, -+ RoundRobin = 1, -+ Other = 2, -+} -+ -+impl SchedPolicy { -+ pub fn try_from_raw(raw: u8) -> Option { -+ match raw { -+ 0 => Some(Self::Fifo), -+ 1 => Some(Self::RoundRobin), -+ 2 => Some(Self::Other), -+ _ => None, -+ } -+ } -+} -+ -+pub fn rt_priority_to_kernel_prio(rt_priority: u8) -> usize { -+ (SCHED_PRIORITY_LEVELS - 1) -+ .saturating_sub((usize::from(rt_priority.min(99)) * (SCHED_PRIORITY_LEVELS - 1)) / 99) -+} -+ -+fn clamp_sched_other_prio(prio: usize) -> usize { -+ prio.min(SCHED_PRIORITY_LEVELS - 1) -+} -+ - #[derive(Clone, Debug)] - pub enum HardBlockedReason { - /// "SIGSTOP", only procmgr is allowed to switch contexts this state -@@ -140,6 +173,17 @@ pub struct Context { - pub fmap_ret: Option, - /// Priority - pub prio: usize, -+ pub sched_policy: SchedPolicy, -+ pub sched_rt_priority: u8, -+ pub sched_rr_ticks_consumed: u32, -+ pub sched_static_prio: usize, -+ pub sched_rr_quantum: u128, -+ #[allow(dead_code)] -+ pub futex_pi_boost: bool, -+ #[allow(dead_code)] -+ pub futex_pi_original_prio: usize, -+ #[allow(dead_code)] -+ pub futex_pi_waiters: Vec, - - // TODO: id can reappear after wraparound? - pub owner_proc_id: Option, -@@ -148,6 +192,8 @@ pub struct Context { - pub euid: u32, - pub egid: u32, - pub pid: usize, -+ /// Supplementary group IDs for access control decisions. -+ pub groups: Vec, - - // See [`PreemptGuard`] - // -@@ -197,13 +243,22 @@ impl Context { - files: Arc::new(RwLock::new(FdTbl::new())), - userspace: false, - fmap_ret: None, -- prio: 20, -+ prio: DEFAULT_SCHED_OTHER_PRIORITY, -+ sched_policy: SchedPolicy::Other, -+ sched_rt_priority: 0, -+ sched_rr_ticks_consumed: 0, -+ sched_static_prio: DEFAULT_SCHED_OTHER_PRIORITY, -+ sched_rr_quantum: DEFAULT_SCHED_RR_QUANTUM, -+ futex_pi_boost: false, -+ futex_pi_original_prio: DEFAULT_SCHED_OTHER_PRIORITY, -+ futex_pi_waiters: Vec::new(), - being_sigkilled: false, - owner_proc_id, - - euid: 0, - egid: 0, - pid: 0, -+ groups: Vec::new(), - - #[cfg(feature = "syscall_debug")] - syscall_debug_info: crate::syscall::debug::SyscallDebugInfo::default(), -@@ -218,11 +273,47 @@ impl Context { - self.preempt_locks == 0 - } - -+ fn base_sched_prio(&self) -> usize { -+ match self.sched_policy { -+ SchedPolicy::Other => clamp_sched_other_prio(self.sched_static_prio), -+ SchedPolicy::Fifo | SchedPolicy::RoundRobin => { -+ rt_priority_to_kernel_prio(self.sched_rt_priority) -+ } -+ } -+ } -+ -+ fn apply_sched_prio(&mut self) { -+ let base_prio = self.base_sched_prio(); -+ if self.futex_pi_boost { -+ self.futex_pi_original_prio = base_prio; -+ self.prio = self.prio.min(base_prio); -+ } else { -+ self.futex_pi_original_prio = base_prio; -+ self.prio = base_prio; -+ } -+ } -+ -+ pub fn set_sched_other_prio(&mut self, prio: usize) { -+ self.sched_static_prio = clamp_sched_other_prio(prio); -+ self.apply_sched_prio(); -+ } -+ -+ pub fn set_sched_policy(&mut self, sched_policy: SchedPolicy, rt_priority: u8) { -+ self.sched_policy = sched_policy; -+ self.sched_rt_priority = match sched_policy { -+ SchedPolicy::Other => 0, -+ SchedPolicy::Fifo | SchedPolicy::RoundRobin => rt_priority.min(99), -+ }; -+ self.sched_rr_ticks_consumed = 0; -+ self.apply_sched_prio(); -+ } -+ - /// Block the context, and return true if it was runnable before being blocked - pub fn block(&mut self, reason: &'static str) -> bool { - if self.status.is_runnable() { - self.status = Status::Blocked; - self.status_reason = reason; -+ self.sched_rr_ticks_consumed = 0; - true - } else { - false -@@ -232,6 +323,7 @@ impl Context { - pub fn hard_block(&mut self, reason: HardBlockedReason) -> bool { - if self.status.is_runnable() { - self.status = Status::HardBlocked { reason }; -+ self.sched_rr_ticks_consumed = 0; - - true - } else { -@@ -261,6 +353,7 @@ impl Context { - if self.status.is_soft_blocked() { - self.status = Status::Runnable; - self.status_reason = ""; -+ self.sched_rr_ticks_consumed = 0; - - true - } else { -@@ -479,6 +572,7 @@ impl Context { - uid: self.euid, - gid: self.egid, - pid: self.pid, -+ groups: self.groups.clone(), - } - } - } diff --git a/local/archived/patches-2026-06-migration/kernel/absorbed/P5-scheme-sched-id.patch b/local/archived/patches-2026-06-migration/kernel/absorbed/P5-scheme-sched-id.patch deleted file mode 100644 index 5554697b54..0000000000 --- a/local/archived/patches-2026-06-migration/kernel/absorbed/P5-scheme-sched-id.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/src/scheme/mod.rs b/src/scheme/mod.rs -index d30272c..9da2b28 100644 ---- a/src/scheme/mod.rs -+++ b/src/scheme/mod.rs -@@ -777,6 +777,7 @@ pub struct CallerCtx { - pub pid: usize, - pub uid: u32, - pub gid: u32, -+ pub groups: alloc::vec::Vec, - } - impl CallerCtx { - pub fn filter_uid_gid(self, euid: u32, egid: u32) -> Self { -@@ -785,6 +786,7 @@ impl CallerCtx { - pid: self.pid, - uid: euid, - gid: egid, -+ groups: self.groups, - } - } else { - self diff --git a/local/archived/patches-2026-06-migration/kernel/absorbed/P6-vruntime-context.patch b/local/archived/patches-2026-06-migration/kernel/absorbed/P6-vruntime-context.patch deleted file mode 100644 index f605087949..0000000000 --- a/local/archived/patches-2026-06-migration/kernel/absorbed/P6-vruntime-context.patch +++ /dev/null @@ -1,180 +0,0 @@ -diff --git a/src/context/context.rs b/src/context/context.rs -index c97c516..a0814fa 100644 ---- a/src/context/context.rs -+++ b/src/context/context.rs -@@ -18,7 +18,8 @@ use crate::{ - cpu_stats, - ipi::{ipi, IpiKind, IpiTarget}, - memory::{ -- allocate_p2frame, deallocate_p2frame, Enomem, Frame, RaiiFrame, RmmA, RmmArch, PAGE_SIZE, -+ allocate_p2frame, deallocate_p2frame, Enomem, Frame, PhysicalAddress, RaiiFrame, RmmA, -+ RmmArch, PAGE_SIZE, - }, - percpu::PercpuBlock, - scheme::{CallerCtx, FileHandle, SchemeId}, -@@ -62,6 +63,38 @@ impl Status { - } - } - -+pub const SCHED_PRIORITY_LEVELS: usize = 40; -+pub const DEFAULT_SCHED_OTHER_PRIORITY: usize = 20; -+pub const DEFAULT_SCHED_RR_QUANTUM: u128 = 100_000_000; -+ -+#[repr(u8)] -+#[derive(Clone, Copy, Debug, PartialEq, Eq)] -+pub enum SchedPolicy { -+ Fifo = 0, -+ RoundRobin = 1, -+ Other = 2, -+} -+ -+impl SchedPolicy { -+ pub fn try_from_raw(raw: u8) -> Option { -+ match raw { -+ 0 => Some(Self::Fifo), -+ 1 => Some(Self::RoundRobin), -+ 2 => Some(Self::Other), -+ _ => None, -+ } -+ } -+} -+ -+pub fn rt_priority_to_kernel_prio(rt_priority: u8) -> usize { -+ (SCHED_PRIORITY_LEVELS - 1) -+ .saturating_sub((usize::from(rt_priority.min(99)) * (SCHED_PRIORITY_LEVELS - 1)) / 99) -+} -+ -+fn clamp_sched_other_prio(prio: usize) -> usize { -+ prio.min(SCHED_PRIORITY_LEVELS - 1) -+} -+ - #[derive(Clone, Debug)] - pub enum HardBlockedReason { - /// "SIGSTOP", only procmgr is allowed to switch contexts this state -@@ -140,6 +173,20 @@ pub struct Context { - pub fmap_ret: Option, - /// Priority - pub prio: usize, -+ pub sched_policy: SchedPolicy, -+ pub sched_rt_priority: u8, -+ pub sched_rr_ticks_consumed: u32, -+ pub sched_static_prio: usize, -+pub sched_rr_quantum: u128, -+ /// Virtual runtime for SCHED_OTHER fair scheduling. -+ /// CPU-bound threads accumulate vruntime faster; I/O-bound stay lower. -+ pub vruntime: u128, -+ #[allow(dead_code)] -+ pub futex_pi_boost: bool, -+ #[allow(dead_code)] -+ pub futex_pi_original_prio: usize, -+ #[allow(dead_code)] -+ pub futex_pi_waiters: Vec, - - // TODO: id can reappear after wraparound? - pub owner_proc_id: Option, -@@ -148,6 +195,8 @@ pub struct Context { - pub euid: u32, - pub egid: u32, - pub pid: usize, -+ /// Supplementary group IDs for access control decisions. -+ pub groups: Vec, - - // See [`PreemptGuard`] - // -@@ -197,13 +246,23 @@ impl Context { - files: Arc::new(RwLock::new(FdTbl::new())), - userspace: false, - fmap_ret: None, -- prio: 20, -+ prio: DEFAULT_SCHED_OTHER_PRIORITY, -+ sched_policy: SchedPolicy::Other, -+ sched_rt_priority: 0, -+ sched_rr_ticks_consumed: 0, -+ sched_static_prio: DEFAULT_SCHED_OTHER_PRIORITY, -+ sched_rr_quantum: DEFAULT_SCHED_RR_QUANTUM, -+ vruntime: 0u128, -+ futex_pi_boost: false, -+ futex_pi_original_prio: DEFAULT_SCHED_OTHER_PRIORITY, -+ futex_pi_waiters: Vec::new(), - being_sigkilled: false, - owner_proc_id, - - euid: 0, - egid: 0, - pid: 0, -+ groups: Vec::new(), - - #[cfg(feature = "syscall_debug")] - syscall_debug_info: crate::syscall::debug::SyscallDebugInfo::default(), -@@ -218,11 +277,47 @@ impl Context { - self.preempt_locks == 0 - } - -+ fn base_sched_prio(&self) -> usize { -+ match self.sched_policy { -+ SchedPolicy::Other => clamp_sched_other_prio(self.sched_static_prio), -+ SchedPolicy::Fifo | SchedPolicy::RoundRobin => { -+ rt_priority_to_kernel_prio(self.sched_rt_priority) -+ } -+ } -+ } -+ -+ fn apply_sched_prio(&mut self) { -+ let base_prio = self.base_sched_prio(); -+ if self.futex_pi_boost { -+ self.futex_pi_original_prio = base_prio; -+ self.prio = self.prio.min(base_prio); -+ } else { -+ self.futex_pi_original_prio = base_prio; -+ self.prio = base_prio; -+ } -+ } -+ -+ pub fn set_sched_other_prio(&mut self, prio: usize) { -+ self.sched_static_prio = clamp_sched_other_prio(prio); -+ self.apply_sched_prio(); -+ } -+ -+ pub fn set_sched_policy(&mut self, sched_policy: SchedPolicy, rt_priority: u8) { -+ self.sched_policy = sched_policy; -+ self.sched_rt_priority = match sched_policy { -+ SchedPolicy::Other => 0, -+ SchedPolicy::Fifo | SchedPolicy::RoundRobin => rt_priority.min(99), -+ }; -+ self.sched_rr_ticks_consumed = 0; -+ self.apply_sched_prio(); -+ } -+ - /// Block the context, and return true if it was runnable before being blocked - pub fn block(&mut self, reason: &'static str) -> bool { - if self.status.is_runnable() { - self.status = Status::Blocked; - self.status_reason = reason; -+ self.sched_rr_ticks_consumed = 0; - true - } else { - false -@@ -232,6 +327,7 @@ impl Context { - pub fn hard_block(&mut self, reason: HardBlockedReason) -> bool { - if self.status.is_runnable() { - self.status = Status::HardBlocked { reason }; -+ self.sched_rr_ticks_consumed = 0; - - true - } else { -@@ -261,6 +357,7 @@ impl Context { - if self.status.is_soft_blocked() { - self.status = Status::Runnable; - self.status_reason = ""; -+ self.sched_rr_ticks_consumed = 0; - - true - } else { -@@ -479,6 +576,7 @@ impl Context { - uid: self.euid, - gid: self.egid, - pid: self.pid, -+ groups: self.groups.clone(), - } - } - } diff --git a/local/archived/patches-2026-06-migration/kernel/absorbed/P7-cache-affine-context.patch b/local/archived/patches-2026-06-migration/kernel/absorbed/P7-cache-affine-context.patch deleted file mode 100644 index 6a42096c15..0000000000 --- a/local/archived/patches-2026-06-migration/kernel/absorbed/P7-cache-affine-context.patch +++ /dev/null @@ -1,196 +0,0 @@ -diff --git a/src/context/context.rs b/src/context/context.rs -index c97c516..18fbd7f 100644 ---- a/src/context/context.rs -+++ b/src/context/context.rs -@@ -18,7 +18,8 @@ use crate::{ - cpu_stats, - ipi::{ipi, IpiKind, IpiTarget}, - memory::{ -- allocate_p2frame, deallocate_p2frame, Enomem, Frame, RaiiFrame, RmmA, RmmArch, PAGE_SIZE, -+ allocate_p2frame, deallocate_p2frame, Enomem, Frame, PhysicalAddress, RaiiFrame, RmmA, -+ RmmArch, PAGE_SIZE, - }, - percpu::PercpuBlock, - scheme::{CallerCtx, FileHandle, SchemeId}, -@@ -62,6 +63,38 @@ impl Status { - } - } - -+pub const SCHED_PRIORITY_LEVELS: usize = 40; -+pub const DEFAULT_SCHED_OTHER_PRIORITY: usize = 20; -+pub const DEFAULT_SCHED_RR_QUANTUM: u128 = 100_000_000; -+ -+#[repr(u8)] -+#[derive(Clone, Copy, Debug, PartialEq, Eq)] -+pub enum SchedPolicy { -+ Fifo = 0, -+ RoundRobin = 1, -+ Other = 2, -+} -+ -+impl SchedPolicy { -+ pub fn try_from_raw(raw: u8) -> Option { -+ match raw { -+ 0 => Some(Self::Fifo), -+ 1 => Some(Self::RoundRobin), -+ 2 => Some(Self::Other), -+ _ => None, -+ } -+ } -+} -+ -+pub fn rt_priority_to_kernel_prio(rt_priority: u8) -> usize { -+ (SCHED_PRIORITY_LEVELS - 1) -+ .saturating_sub((usize::from(rt_priority.min(99)) * (SCHED_PRIORITY_LEVELS - 1)) / 99) -+} -+ -+fn clamp_sched_other_prio(prio: usize) -> usize { -+ prio.min(SCHED_PRIORITY_LEVELS - 1) -+} -+ - #[derive(Clone, Debug)] - pub enum HardBlockedReason { - /// "SIGSTOP", only procmgr is allowed to switch contexts this state -@@ -96,6 +129,7 @@ pub struct Context { - pub running: bool, - /// Current CPU ID - pub cpu_id: Option, -+ pub last_cpu: Option, - /// Time this context was switched to - pub switch_time: u128, - /// Amount of CPU time used -@@ -140,6 +174,20 @@ pub struct Context { - pub fmap_ret: Option, - /// Priority - pub prio: usize, -+ pub sched_policy: SchedPolicy, -+ pub sched_rt_priority: u8, -+ pub sched_rr_ticks_consumed: u32, -+ pub sched_static_prio: usize, -+pub sched_rr_quantum: u128, -+ /// Virtual runtime for SCHED_OTHER fair scheduling. -+ /// CPU-bound threads accumulate vruntime faster; I/O-bound stay lower. -+ pub vruntime: u128, -+ #[allow(dead_code)] -+ pub futex_pi_boost: bool, -+ #[allow(dead_code)] -+ pub futex_pi_original_prio: usize, -+ #[allow(dead_code)] -+ pub futex_pi_waiters: Vec, - - // TODO: id can reappear after wraparound? - pub owner_proc_id: Option, -@@ -148,6 +196,8 @@ pub struct Context { - pub euid: u32, - pub egid: u32, - pub pid: usize, -+ /// Supplementary group IDs for access control decisions. -+ pub groups: Vec, - - // See [`PreemptGuard`] - // -@@ -182,6 +232,7 @@ impl Context { - status_reason: "", - running: false, - cpu_id: None, -+ last_cpu: None, - switch_time: 0, - cpu_time: 0, - sched_affinity: LogicalCpuSet::all(), -@@ -197,13 +248,23 @@ impl Context { - files: Arc::new(RwLock::new(FdTbl::new())), - userspace: false, - fmap_ret: None, -- prio: 20, -+ prio: DEFAULT_SCHED_OTHER_PRIORITY, -+ sched_policy: SchedPolicy::Other, -+ sched_rt_priority: 0, -+ sched_rr_ticks_consumed: 0, -+ sched_static_prio: DEFAULT_SCHED_OTHER_PRIORITY, -+ sched_rr_quantum: DEFAULT_SCHED_RR_QUANTUM, -+ vruntime: 0u128, -+ futex_pi_boost: false, -+ futex_pi_original_prio: DEFAULT_SCHED_OTHER_PRIORITY, -+ futex_pi_waiters: Vec::new(), - being_sigkilled: false, - owner_proc_id, - - euid: 0, - egid: 0, - pid: 0, -+ groups: Vec::new(), - - #[cfg(feature = "syscall_debug")] - syscall_debug_info: crate::syscall::debug::SyscallDebugInfo::default(), -@@ -218,11 +279,47 @@ impl Context { - self.preempt_locks == 0 - } - -+ fn base_sched_prio(&self) -> usize { -+ match self.sched_policy { -+ SchedPolicy::Other => clamp_sched_other_prio(self.sched_static_prio), -+ SchedPolicy::Fifo | SchedPolicy::RoundRobin => { -+ rt_priority_to_kernel_prio(self.sched_rt_priority) -+ } -+ } -+ } -+ -+ fn apply_sched_prio(&mut self) { -+ let base_prio = self.base_sched_prio(); -+ if self.futex_pi_boost { -+ self.futex_pi_original_prio = base_prio; -+ self.prio = self.prio.min(base_prio); -+ } else { -+ self.futex_pi_original_prio = base_prio; -+ self.prio = base_prio; -+ } -+ } -+ -+ pub fn set_sched_other_prio(&mut self, prio: usize) { -+ self.sched_static_prio = clamp_sched_other_prio(prio); -+ self.apply_sched_prio(); -+ } -+ -+ pub fn set_sched_policy(&mut self, sched_policy: SchedPolicy, rt_priority: u8) { -+ self.sched_policy = sched_policy; -+ self.sched_rt_priority = match sched_policy { -+ SchedPolicy::Other => 0, -+ SchedPolicy::Fifo | SchedPolicy::RoundRobin => rt_priority.min(99), -+ }; -+ self.sched_rr_ticks_consumed = 0; -+ self.apply_sched_prio(); -+ } -+ - /// Block the context, and return true if it was runnable before being blocked - pub fn block(&mut self, reason: &'static str) -> bool { - if self.status.is_runnable() { - self.status = Status::Blocked; - self.status_reason = reason; -+ self.sched_rr_ticks_consumed = 0; - true - } else { - false -@@ -232,6 +329,7 @@ impl Context { - pub fn hard_block(&mut self, reason: HardBlockedReason) -> bool { - if self.status.is_runnable() { - self.status = Status::HardBlocked { reason }; -+ self.sched_rr_ticks_consumed = 0; - - true - } else { -@@ -261,6 +359,7 @@ impl Context { - if self.status.is_soft_blocked() { - self.status = Status::Runnable; - self.status_reason = ""; -+ self.sched_rr_ticks_consumed = 0; - - true - } else { -@@ -479,6 +578,7 @@ impl Context { - uid: self.euid, - gid: self.egid, - pid: self.pid, -+ groups: self.groups.clone(), - } - } - } diff --git a/local/archived/patches-2026-06-migration/kernel/absorbed/P7-proc-setname.patch b/local/archived/patches-2026-06-migration/kernel/absorbed/P7-proc-setname.patch deleted file mode 100644 index 536093a984..0000000000 --- a/local/archived/patches-2026-06-migration/kernel/absorbed/P7-proc-setname.patch +++ /dev/null @@ -1,47 +0,0 @@ -diff --git a/src/scheme/proc.rs b/src/scheme/proc.rs ---- a/src/scheme/proc.rs -+++ b/src/scheme/proc.rs -@@ -147,6 +147,7 @@ enum ContextHandle { - Priority, - SchedAffinity, - SchedPolicy, -+ Name, - - MmapMinAddr(Arc), - } -@@ -267,7 +268,8 @@ impl ProcScheme { - "sched-affinity" => (ContextHandle::SchedAffinity, true), - // TODO: Switch this kernel-local proc handle over to a stable upstream - // redox_syscall ProcCall::SetSchedPolicy opcode once that lands. - "sched-policy" => (ContextHandle::SchedPolicy, false), -+ "name" => (ContextHandle::Name, false), - "status" => (ContextHandle::Status { privileged: false }, false), - _ if path.starts_with("auth-") => { - let nonprefix = &path["auth-".len()..]; -@@ -1218,5 +1220,15 @@ impl ContextHandle { - Ok(2) - } -+ ContextHandle::Name => { -+ let mut name_buf = [0u8; 32]; -+ let len = buf.copy_common_bytes_to_slice(&mut name_buf[..31]).unwrap_or(0); -+ let mut context = context.write(token.token()); -+ context.name.clear(); -+ if let Ok(s) = core::str::from_utf8(&name_buf[..len]) { -+ context.name.push_str(s); -+ } -+ Ok(len) -+ } - ContextHandle::Status { privileged } => { - let mut args = buf.usizes(); - -@@ -1532,6 +1544,10 @@ impl ContextHandle { - let data = [context.sched_policy as u8, context.sched_rt_priority]; - buf.copy_common_bytes_from_slice(&data) - } -+ ContextHandle::Name => { -+ let context = context.read(token.token()); -+ buf.copy_common_bytes_from_slice(context.name.as_bytes()) -+ } - ContextHandle::Status { .. } => { - let status = { - let context = context.read(token.token()); diff --git a/local/archived/patches-2026-06-migration/kernel/absorbed/P7-proc-setpriority.patch b/local/archived/patches-2026-06-migration/kernel/absorbed/P7-proc-setpriority.patch deleted file mode 100644 index 2a73d99f23..0000000000 --- a/local/archived/patches-2026-06-migration/kernel/absorbed/P7-proc-setpriority.patch +++ /dev/null @@ -1,70 +0,0 @@ -diff --git a/src/scheme/proc.rs b/src/scheme/proc.rs ---- a/src/scheme/proc.rs -+++ b/src/scheme/proc.rs -@@ -145,8 +145,9 @@ enum ContextHandle { - // TODO: Remove this once openat is implemented, or allow openat-via-dup via e.g. the top-level - // directory. - OpenViaDup, -+ Priority, - SchedAffinity, - SchedPolicy, - Name, - - MmapMinAddr(Arc), -@@ -160,7 +161,18 @@ pub struct ProcScheme; - static NEXT_ID: AtomicUsize = AtomicUsize::new(1); - static HANDLES: RwLock> = - RwLock::new(HashMap::with_hasher(DefaultHashBuilder::new())); -+ -+const NICE_MIN: i32 = -20; -+const NICE_MAX: i32 = 19; -+ -+fn nice_to_kernel_prio(nice: i32) -> usize { -+ (nice.saturating_add(20)).clamp(0, 39) as usize -+} -+ -+fn kernel_prio_to_nice(prio: usize) -> i32 { -+ (prio.min(39) as i32) - 20 -+} - - #[cfg(feature = "debugger")] - #[allow(dead_code)] - pub fn foreach_addrsp( -@@ -253,6 +265,7 @@ impl ProcScheme { - "sighandler" => (ContextHandle::Sighandler, false), - "start" => (ContextHandle::Start, false), - "open_via_dup" => (ContextHandle::OpenViaDup, false), -+ "priority" => (ContextHandle::Priority, false), - "mmap-min-addr" => ( - ContextHandle::MmapMinAddr(Arc::clone( - context -@@ -1191,6 +1204,18 @@ impl ContextHandle { - - Ok(size_of_val(&mask)) - } -+ Self::Priority => { -+ let nice = unsafe { buf.read_exact::()? }; -+ if !(NICE_MIN..=NICE_MAX).contains(&nice) { -+ return Err(Error::new(EINVAL)); -+ } -+ -+ context -+ .write(token.token()) -+ .set_sched_other_prio(nice_to_kernel_prio(nice)); -+ -+ Ok(size_of::()) -+ } - Self::SchedPolicy => { - if buf.len() != 2 { - return Err(Error::new(EINVAL)); -@@ -1522,6 +1546,10 @@ impl ContextHandle { - - buf.copy_exactly(crate::cpu_set::mask_as_bytes(&mask))?; - Ok(size_of_val(&mask)) -+ } -+ ContextHandle::Priority => { -+ let nice = kernel_prio_to_nice(context.read(token.token()).prio); -+ buf.copy_common_bytes_from_slice(&nice.to_ne_bytes()) - } - ContextHandle::SchedPolicy => { - let context = context.read(token.token()); diff --git a/local/archived/patches-2026-06-migration/kernel/absorbed/P8-load-balance.patch b/local/archived/patches-2026-06-migration/kernel/absorbed/P8-load-balance.patch deleted file mode 100644 index c33e4ecf5b..0000000000 --- a/local/archived/patches-2026-06-migration/kernel/absorbed/P8-load-balance.patch +++ /dev/null @@ -1,146 +0,0 @@ -diff --git a/src/percpu.rs b/src/percpu.rs ---- a/src/percpu.rs -+++ b/src/percpu.rs -@@ -29,15 +29,17 @@ pub struct PerCpuSched { - pub run_queues_lock: AtomicBool, - pub balance: Cell<[usize; RUN_QUEUE_COUNT]>, - pub last_queue: Cell, -+ pub last_balance_time: Cell, - } - - impl PerCpuSched { - pub const fn new() -> Self { - const EMPTY: VecDeque = VecDeque::new(); - Self { - run_queues: SyncUnsafeCell::new([EMPTY; RUN_QUEUE_COUNT]), - run_queues_lock: AtomicBool::new(false), - balance: Cell::new([0; RUN_QUEUE_COUNT]), - last_queue: Cell::new(0), -+ last_balance_time: Cell::new(0), - } - } -diff --git a/src/context/switch.rs b/src/context/switch.rs ---- a/src/context/switch.rs -+++ b/src/context/switch.rs -@@ -33,4 +33,6 @@ const SCHED_PRIO_TO_WEIGHT: [usize; 40] = [ - 70, 56, 45, 36, 29, 23, 18, 15, - ]; - -+const LOAD_BALANCE_INTERVAL_NS: u128 = 100_000_000; -+ - static SCHED_STEAL_COUNT: AtomicUsize = AtomicUsize::new(0); -@@ -101,6 +103,9 @@ pub fn tick(token: &mut CleanLockToken) { - let new_ticks = ticks_cell.get() + 1; - ticks_cell.set(new_ticks); - -+ let balance_time = crate::time::monotonic(token); -+ maybe_balance_queues(token, percpu, balance_time); -+ - // Trigger a context switch after every 3 ticks. - if new_ticks >= 3 { - switch(token); -@@ -427,3 +432,104 @@ fn steal_work( - - None - } -+ -+fn queue_depth(percpu: &PercpuBlock) -> usize { -+ let mut sched_lock = SchedQueuesLock::new(&percpu.sched); -+ unsafe { -+ sched_lock -+ .queues_mut() -+ .iter() -+ .map(|queue| queue.len()) -+ .sum() -+ } -+} -+ -+fn migrate_one_context( -+ token: &mut CleanLockToken, -+ source_id: LogicalCpuId, -+ target_id: LogicalCpuId, -+ switch_time: u128, -+) -> bool { -+ let Some(source) = get_percpu_block(source_id) else { -+ return false; -+ }; -+ let Some(target) = get_percpu_block(target_id) else { -+ return false; -+ }; -+ -+ let source_idle = source.switch_internals.idle_context(); -+ let moved = { -+ let mut source_lock = SchedQueuesLock::new(&source.sched); -+ let source_queues = unsafe { source_lock.queues_mut() }; -+ pop_movable_context(token, source_queues, target_id, switch_time, &source_idle) -+ }; -+ -+ let Some((prio, context_ref)) = moved else { -+ return false; -+ }; -+ -+ let mut target_lock = SchedQueuesLock::new(&target.sched); -+ unsafe { -+ target_lock.queues_mut()[prio].push_back(context_ref); -+ } -+ true -+} -+ -+fn maybe_balance_queues(token: &mut CleanLockToken, percpu: &PercpuBlock, balance_time: u128) { -+ if crate::cpu_count() <= 1 || percpu.cpu_id != LogicalCpuId::BSP { -+ return; -+ } -+ if balance_time.saturating_sub(percpu.sched.last_balance_time.get()) < LOAD_BALANCE_INTERVAL_NS -+ { -+ return; -+ } -+ -+ percpu.sched.last_balance_time.set(balance_time); -+ -+ let mut depths = Vec::new(); -+ let mut total_depth = 0usize; -+ for raw_id in 0..crate::cpu_count() { -+ let cpu_id = LogicalCpuId::new(raw_id); -+ let Some(cpu_percpu) = get_percpu_block(cpu_id) else { -+ continue; -+ }; -+ let depth = queue_depth(cpu_percpu); -+ total_depth += depth; -+ depths.push((cpu_id, depth)); -+ } -+ -+ if depths.len() <= 1 || total_depth == 0 { -+ return; -+ } -+ -+ let avg_depth = (total_depth + depths.len().saturating_sub(1)) / depths.len(); -+ -+ for target_index in 0..depths.len() { -+ if depths[target_index].1 != 0 { -+ continue; -+ } -+ -+ let mut source_index = None; -+ let mut source_depth = 0usize; -+ for (idx, &(_, depth)) in depths.iter().enumerate() { -+ if idx == target_index { -+ continue; -+ } -+ if depth > avg_depth + 1 && depth > source_depth { -+ source_index = Some(idx); -+ source_depth = depth; -+ } -+ } -+ -+ let Some(source_index) = source_index else { -+ continue; -+ }; -+ -+ let source_id = depths[source_index].0; -+ let target_id = depths[target_index].0; -+ if migrate_one_context(token, source_id, target_id, balance_time) { -+ depths[source_index].1 = depths[source_index].1.saturating_sub(1); -+ depths[target_index].1 += 1; -+ } -+ } -+} diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P0-strtold-cpp-linkage-and-compat.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P0-strtold-cpp-linkage-and-compat.patch deleted file mode 100644 index 04e63a8278..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P0-strtold-cpp-linkage-and-compat.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/src/header/stdlib/cbindgen.toml b/src/header/stdlib/cbindgen.toml ---- a/src/header/stdlib/cbindgen.toml -+++ b/src/header/stdlib/cbindgen.toml -@@ -1,21 +1,5 @@ - sys_includes = ["stddef.h", "alloca.h", "wchar.h", "features.h"] - include_guard = "_RELIBC_STDLIB_H" --trailer = """ --#ifndef _RELIBC_STDLIB_EXTRA_H --#define _RELIBC_STDLIB_EXTRA_H -- --#ifdef __cplusplus --extern "C" { --#endif -- --long double strtold(const char *nptr, char **endptr); -- --#ifdef __cplusplus --} --#endif -- --#endif --""" - language = "C" - style = "Type" - no_includes = true diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-aio.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-aio.patch deleted file mode 100644 index 67daa87204..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-aio.patch +++ /dev/null @@ -1,336 +0,0 @@ -diff -ruN a/src/header/_aio/mod.rs b/src/header/_aio/mod.rs ---- a/src/header/_aio/mod.rs -+++ b/src/header/_aio/mod.rs -@@ -1,75 +1,283 @@ - //! `aio.h` implementation. - //! --//! See . -+//! Synchronous emulation of POSIX AIO. All operations complete immediately -+//! in the calling thread. This provides sufficient compatibility for software -+//! (such as Qt6's QIODevice) that uses aio as an optional fallback path. - --use crate::{ -- header::{bits_timespec::timespec, signal::sigevent}, -- platform::types::{c_int, c_void}, --}; -+use core::slice; -+ -+use crate::{ -+ error::Errno, -+ header::{ -+ bits_timespec::timespec, -+ errno::{EFAULT, EINVAL, EINPROGRESS, EIO}, -+ fcntl::O_SYNC, -+ signal::sigevent, -+ }, -+ platform::{ -+ Sys, -+ types::{c_int, c_void, off_t, size_t, ssize_t}, -+ ERRNO, -+ }, -+}; -+ -+// POSIX lio_listio operation codes -+pub const LIO_READ: c_int = 0; -+pub const LIO_WRITE: c_int = 1; -+pub const LIO_NOP: c_int = 2; -+ -+// lio_listio modes -+pub const LIO_WAIT: c_int = 0; -+pub const LIO_NOWAIT: c_int = 1; -+ -+// aio_cancel return values -+pub const AIO_CANCELED: c_int = 0; -+pub const AIO_NOTCANCELED: c_int = 1; -+pub const AIO_ALLDONE: c_int = 2; -+ -+// O_DSYNC is not yet defined in relibc's fcntl module. -+// Accept it in aio_fsync by matching the Linux x86_64 value. -+// TODO: import from fcntl when O_DSYNC is added there. -+const _O_DSYNC: c_int = 0x0001_0000; -+ -+// Internal operation states for synchronous emulation -+const _AIO_IDLE: c_int = 0; -+const _AIO_DONE: c_int = 2; - - /// See . -+#[repr(C)] - pub struct aiocb { - pub aio_fildes: c_int, -+ pub aio_offset: off_t, - pub aio_lio_opcode: c_int, - pub aio_reqprio: c_int, - pub aio_buf: *mut c_void, -- pub aio_nbytes: usize, -+ pub aio_nbytes: size_t, - pub aio_sigevent: sigevent, -+ // Private emulation state -+ pub __state: c_int, -+ pub __error_code: c_int, -+ pub __return_value: ssize_t, - } - --/// See . --// #[unsafe(no_mangle)] --pub extern "C" fn aio_read(aiocbp: *mut aiocb) -> c_int { -- unimplemented!(); -+/// Perform a synchronous pread and store the result in the aiocb. -+/// -+/// Returns 0 on success, -1 on error (with errno set). -+unsafe fn aio_do_read(cb: &mut aiocb) -> c_int { -+ let buf = unsafe { slice::from_raw_parts_mut(cb.aio_buf.cast::(), cb.aio_nbytes) }; -+ match Sys::pread(cb.aio_fildes, buf, cb.aio_offset) { -+ Ok(n) => { -+ cb.__error_code = 0; -+ cb.__return_value = n as ssize_t; -+ cb.__state = _AIO_DONE; -+ 0 -+ } -+ Err(Errno(e)) => { -+ cb.__error_code = e; -+ cb.__return_value = -1; -+ cb.__state = _AIO_DONE; -+ ERRNO.set(e); -+ -1 -+ } -+ } - } - --/// See . --// #[unsafe(no_mangle)] --pub extern "C" fn aio_write(aiocbp: *mut aiocb) -> c_int { -- unimplemented!(); -+/// Perform a synchronous pwrite and store the result in the aiocb. -+/// -+/// Returns 0 on success, -1 on error (with errno set). -+unsafe fn aio_do_write(cb: &mut aiocb) -> c_int { -+ let buf = unsafe { slice::from_raw_parts(cb.aio_buf.cast::(), cb.aio_nbytes) }; -+ match Sys::pwrite(cb.aio_fildes, buf, cb.aio_offset) { -+ Ok(n) => { -+ cb.__error_code = 0; -+ cb.__return_value = n as ssize_t; -+ cb.__state = _AIO_DONE; -+ 0 -+ } -+ Err(Errno(e)) => { -+ cb.__error_code = e; -+ cb.__return_value = -1; -+ cb.__state = _AIO_DONE; -+ ERRNO.set(e); -+ -1 -+ } -+ } - } - --/// See . --// #[unsafe(no_mangle)] --pub extern "C" fn lio_listio( -- mode: c_int, -- list: *const *const aiocb, -- nent: c_int, -- sig: *mut sigevent, --) -> c_int { -- unimplemented!(); --} -+/// See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn aio_read(aiocbp: *mut aiocb) -> c_int { -+ if aiocbp.is_null() { -+ ERRNO.set(EINVAL); -+ return -1; -+ } -+ let cb = unsafe { &mut *aiocbp }; -+ if cb.aio_buf.is_null() && cb.aio_nbytes > 0 { -+ ERRNO.set(EFAULT); -+ cb.__state = _AIO_DONE; -+ cb.__error_code = EFAULT; -+ cb.__return_value = -1; -+ return -1; -+ } -+ unsafe { aio_do_read(cb) } -+} - --/// See . --// #[unsafe(no_mangle)] --pub extern "C" fn aio_error(aiocbp: *const aiocb) -> c_int { -- unimplemented!(); -+/// See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn aio_write(aiocbp: *mut aiocb) -> c_int { -+ if aiocbp.is_null() { -+ ERRNO.set(EINVAL); -+ return -1; -+ } -+ let cb = unsafe { &mut *aiocbp }; -+ if cb.aio_buf.is_null() && cb.aio_nbytes > 0 { -+ ERRNO.set(EFAULT); -+ cb.__state = _AIO_DONE; -+ cb.__error_code = EFAULT; -+ cb.__return_value = -1; -+ return -1; -+ } -+ unsafe { aio_do_write(cb) } - } - --/// See . --// #[unsafe(no_mangle)] --pub extern "C" fn aio_return(aiocbp: *mut aiocb) -> usize { -- unimplemented!(); --} -+/// See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn aio_fsync(operation: c_int, aiocbp: *mut aiocb) -> c_int { -+ if aiocbp.is_null() { -+ ERRNO.set(EINVAL); -+ return -1; -+ } -+ // Validate operation: O_SYNC from fcntl, or _O_DSYNC (Linux compat value). -+ if operation != O_SYNC && operation != _O_DSYNC { -+ ERRNO.set(EINVAL); -+ return -1; -+ } -+ let cb = unsafe { &mut *aiocbp }; -+ match Sys::fsync(cb.aio_fildes) { -+ Ok(()) => { -+ cb.__error_code = 0; -+ cb.__return_value = 0; -+ cb.__state = _AIO_DONE; -+ 0 -+ } -+ Err(Errno(e)) => { -+ cb.__error_code = e; -+ cb.__return_value = -1; -+ cb.__state = _AIO_DONE; -+ ERRNO.set(e); -+ -1 -+ } -+ } -+} - --/// See . --// #[unsafe(no_mangle)] --pub extern "C" fn aio_cancel(fildes: c_int, aiocbp: *mut aiocb) -> c_int { -- unimplemented!(); -+/// See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn aio_error(aiocbp: *const aiocb) -> c_int { -+ if aiocbp.is_null() { -+ return EINVAL; -+ } -+ let cb = unsafe { &*aiocbp }; -+ match cb.__state { -+ _AIO_IDLE => 0, // Never submitted -- no error -+ _AIO_DONE => cb.__error_code, -+ _ => EINPROGRESS, // Should not occur with sync emulation -+ } - } - --/// See . --// #[unsafe(no_mangle)] --pub extern "C" fn aio_suspend( -- list: *const *const aiocb, -- nent: c_int, -- timeout: *const timespec, --) -> c_int { -- unimplemented!(); -+/// See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn aio_return(aiocbp: *mut aiocb) -> ssize_t { -+ if aiocbp.is_null() { -+ ERRNO.set(EINVAL); -+ return -1; -+ } -+ let cb = unsafe { &*aiocbp }; -+ if cb.__state != _AIO_DONE { -+ ERRNO.set(EINPROGRESS); -+ return -1; -+ } -+ cb.__return_value - } - --/// See . --// #[unsafe(no_mangle)] --pub extern "C" fn aio_fsync(operation: c_int, aiocbp: *mut aiocb) -> c_int { -- unimplemented!(); -+/// See . -+/// -+/// With synchronous emulation, all operations are already complete when -+/// aio_suspend is called, so this is effectively a no-op that returns 0. -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn aio_suspend( -+ list: *const *const aiocb, -+ nent: c_int, -+ timeout: *const timespec, -+) -> c_int { -+ let _ = timeout; -+ if list.is_null() || nent < 0 { -+ ERRNO.set(EINVAL); -+ return -1; -+ } -+ // All operations complete synchronously, so just return success. -+ 0 -+} -+ -+/// See . -+/// -+/// With synchronous emulation, operations complete before aio_cancel can be -+/// called, so this always returns AIO_ALLDONE. -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn aio_cancel(fildes: c_int, aiocbp: *mut aiocb) -> c_int { -+ if !aiocbp.is_null() { -+ let cb = unsafe { &*aiocbp }; -+ if cb.aio_fildes != fildes { -+ ERRNO.set(EINVAL); -+ return -1; -+ } -+ } -+ AIO_ALLDONE -+} -+ -+/// See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn lio_listio( -+ mode: c_int, -+ list: *const *const aiocb, -+ nent: c_int, -+ sig: *mut sigevent, -+) -> c_int { -+ let _ = sig; -+ if (mode != LIO_WAIT && mode != LIO_NOWAIT) || list.is_null() || nent < 0 { -+ ERRNO.set(EINVAL); -+ return -1; -+ } -+ let mut any_failed = false; -+ for i in 0..nent { -+ let entry = unsafe { *list.add(i as usize) }; -+ if entry.is_null() { -+ continue; -+ } -+ let cb = unsafe { &mut *(entry as *mut aiocb) }; -+ match cb.aio_lio_opcode { -+ LIO_READ => { -+ if unsafe { aio_read(cb) } != 0 { -+ any_failed = true; -+ } -+ } -+ LIO_WRITE => { -+ if unsafe { aio_write(cb) } != 0 { -+ any_failed = true; -+ } -+ } -+ LIO_NOP => {} -+ _ => { -+ cb.__state = _AIO_DONE; -+ cb.__error_code = EINVAL; -+ cb.__return_value = -1; -+ ERRNO.set(EINVAL); -+ any_failed = true; -+ } -+ } -+ } -+ if any_failed { -+ ERRNO.set(EIO); -+ return -1; -+ } -+ 0 - } diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-barrier-smp-futex.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-barrier-smp-futex.patch deleted file mode 100644 index 65516948ca..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-barrier-smp-futex.patch +++ /dev/null @@ -1,125 +0,0 @@ -diff --git a/src/sync/barrier.rs b/src/sync/barrier.rs -index 6204a23..b5847b5 100644 ---- a/src/sync/barrier.rs -+++ b/src/sync/barrier.rs -@@ -1,18 +1,34 @@ --use core::num::NonZeroU32; -+use core::{ -+ num::NonZeroU32, -+ sync::atomic::{AtomicU32, Ordering}, -+}; - - pub struct Barrier { - original_count: NonZeroU32, - // 4 - lock: crate::sync::Mutex, - // 16 -- cvar: crate::header::pthread::RlctCond, -+ cvar: FutexState, - // 24 - } - #[derive(Debug)] - struct Inner { -- count: u32, -- // TODO: Overflows might be problematic... 64-bit? -- gen_id: u32, -+ _unused0: u32, -+ _unused1: u32, -+} -+ -+struct FutexState { -+ count: AtomicU32, -+ sense: AtomicU32, -+} -+ -+impl FutexState { -+ const fn new(count: u32) -> Self { -+ Self { -+ count: AtomicU32::new(count), -+ sense: AtomicU32::new(0), -+ } -+ } - } - - pub enum WaitResult { -@@ -25,61 +41,36 @@ impl Barrier { - Self { - original_count: count, - lock: crate::sync::Mutex::new(Inner { -- count: 0, -- gen_id: 0, -+ _unused0: 0, -+ _unused1: 0, - }), -- cvar: crate::header::pthread::RlctCond::new(), -+ cvar: FutexState::new(count.get()), - } - } - pub fn wait(&self) -> WaitResult { -- let mut guard = self.lock.lock(); -- let gen_id = guard.gen_id; -- -- guard.count += 1; -- -- if guard.count == self.original_count.get() { -- guard.gen_id = guard.gen_id.wrapping_add(1); -- guard.count = 0; -- if let Ok(()) = self.cvar.broadcast() {}; // TODO handle error -+ let _ = &self.lock; -+ let sense = self.cvar.sense.load(Ordering::Acquire); - -- drop(guard); -+ if self.cvar.count.fetch_sub(1, Ordering::AcqRel) == 1 { -+ self.cvar -+ .count -+ .store(self.original_count.get(), Ordering::Relaxed); -+ self.cvar -+ .sense -+ .store(sense.wrapping_add(1), Ordering::Release); -+ crate::sync::futex_wake(&self.cvar.sense, i32::MAX); - - WaitResult::NotifiedAll - } else { -- while guard.gen_id == gen_id { -- guard = self.cvar.wait_inner_typedmutex(guard); -- } -- -- WaitResult::Waited -- } -- /* -- let mut guard = self.lock.lock(); -- let Inner { count, gen_id } = *guard; -- -- let last = self.original_count.get() - 1; -- -- if count == last { -- eprintln!("last {:?}", *guard); -- guard.gen_id = guard.gen_id.wrapping_add(1); -- guard.count = 0; -- -- drop(guard); -- -- self.cvar.broadcast(); -- -- WaitResult::NotifiedAll -- } else { -- guard.count += 1; -- -- while guard.count != last && guard.gen_id == gen_id { -- eprintln!("before {:?}", *guard); -- guard = self.cvar.wait_inner_typedmutex(guard); -- eprintln!("after {:?}", *guard); -+ // SMP fix: wait directly on the barrier generation word instead of routing through the -+ // condvar unlock->futex_wait path. If the last thread flips `sense` after we load it -+ // but before our futex wait starts, the futex observes a stale value and returns -+ // immediately instead of sleeping forever after a missed broadcast wakeup. -+ while self.cvar.sense.load(Ordering::Acquire) == sense { -+ let _ = crate::sync::futex_wait(&self.cvar.sense, sense, None); - } - - WaitResult::Waited - } -- */ - } - } --static LOCK: crate::sync::Mutex<()> = crate::sync::Mutex::new(()); diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-clock-nanosleep.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-clock-nanosleep.patch deleted file mode 100644 index cc4eac557f..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-clock-nanosleep.patch +++ /dev/null @@ -1,34 +0,0 @@ -diff --git a/src/header/time/mod.rs b/src/header/time/mod.rs -index 1a432bf3..db30e0d7 100644 ---- a/src/header/time/mod.rs -+++ b/src/header/time/mod.rs -@@ -7,7 +7,7 @@ use crate::{ - error::{Errno, ResultExt}, - header::{ - bits_timespec::timespec, -- errno::{EFAULT, ENOMEM, EOVERFLOW, ETIMEDOUT}, -+ errno::{EFAULT, EINVAL, ENOMEM, EOVERFLOW, ETIMEDOUT}, - signal::sigevent, - stdlib::getenv, - unistd::readlink, -@@ -280,7 +280,19 @@ pub extern "C" fn clock_nanosleep( - rqtp: *const timespec, - rmtp: *mut timespec, - ) -> c_int { -- unimplemented!(); -+ match clock_id { -+ CLOCK_REALTIME | CLOCK_MONOTONIC => { -+ if flags == TIMER_ABSTIME { -+ return EINVAL; -+ } -+ match unsafe { Sys::nanosleep(rqtp, rmtp) } { -+ Ok(()) => 0, -+ Err(Errno(ETIMEDOUT)) => ETIMEDOUT, -+ Err(Errno(e)) => e, -+ } -+ } -+ _ => EINVAL, -+ } - } - - /// See . diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-dns-aaaa-getaddrinfo-ipv6.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-dns-aaaa-getaddrinfo-ipv6.patch deleted file mode 100644 index 661d708ee0..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-dns-aaaa-getaddrinfo-ipv6.patch +++ /dev/null @@ -1,396 +0,0 @@ -diff --git a/src/header/netdb/lookup.rs b/src/header/netdb/lookup.rs -index aaaaaaa..bbbbbbb 100644 ---- a/src/header/netdb/lookup.rs -+++ b/src/header/netdb/lookup.rs -@@ -14,7 +14,7 @@ use crate::header::{ - bits_socklen_t::socklen_t, - bits_timespec::timespec, - errno::*, -- netinet_in::{IPPROTO_UDP, in_addr, sockaddr_in}, -+ netinet_in::{IPPROTO_UDP, in6_addr, in_addr, sockaddr_in}, - sys_socket::{ - self, - constants::{AF_INET, SOCK_DGRAM, SOL_SOCKET, SO_RCVTIMEO}, -@@ -30,6 +30,7 @@ use super::{ - }; - - pub type LookupHost = Vec; -+pub type LookupHostV6 = Vec; - - pub fn lookup_host(host: &str) -> Result { - if let Some(host_direct_addr) = parse_ipv4_string(host) { -@@ -157,6 +158,123 @@ pub fn lookup_host(host: &str) -> Result { - } - } - -+/// Look up IPv6 (AAAA) addresses for a host via DNS. -+pub fn lookup_host_v6(host: &str) -> Result { -+ if let Some(addr6) = parse_ipv6_string(host) { -+ return Ok(vec![addr6]); -+ } -+ -+ let dns_string = get_dns_server().map_err(|e| e.0)?; -+ -+ if let Some(dns_addr) = parse_ipv4_string(&dns_string) { -+ let mut timespec = timespec::default(); -+ if let Ok(()) = Sys::clock_gettime( -+ time::constants::CLOCK_REALTIME, -+ Out::from_mut(&mut timespec), -+ ) {}; -+ let tid = (timespec.tv_nsec >> 16) as u16; -+ -+ let packet = Dns { -+ transaction_id: tid, -+ flags: 0x0100, -+ queries: vec![DnsQuery { -+ name: host.to_string(), -+ q_type: 0x001c, -+ q_class: 0x0001, -+ }], -+ answers: vec![], -+ }; -+ -+ let packet_data = packet.compile(); -+ let packet_data_len = packet_data.len(); -+ -+ let packet_data_box = packet_data.into_boxed_slice(); -+ let packet_data_ptr = Box::into_raw(packet_data_box) as *mut _ as *mut c_void; -+ -+ let dest = sockaddr_in { -+ sin_family: AF_INET as u16, -+ sin_port: htons(53), -+ sin_addr: in_addr { s_addr: dns_addr }, -+ ..Default::default() -+ }; -+ let dest_ptr = ptr::from_ref(&dest).cast::(); -+ -+ let sock = unsafe { -+ let sock = sys_socket::socket(AF_INET, SOCK_DGRAM, i32::from(IPPROTO_UDP)); -+ if sys_socket::connect(sock, dest_ptr, mem::size_of_val(&dest) as socklen_t) < 0 { -+ return Err(EIO); -+ } -+ if sys_socket::send(sock, packet_data_ptr, packet_data_len, 0) < 0 { -+ drop(Box::from_raw(packet_data_ptr)); -+ return Err(EIO); -+ } -+ sock -+ }; -+ -+ unsafe { -+ drop(Box::from_raw(packet_data_ptr)); -+ } -+ -+ let mut buf = vec![0u8; 65536]; -+ let buf_ptr = buf.as_mut_ptr().cast::(); -+ -+ // Set 5s recv timeout (best-effort; if this fails, recv may block longer). -+ let tv = timeval { -+ tv_sec: 5, -+ tv_usec: 0, -+ }; -+ unsafe { -+ sys_socket::setsockopt( -+ sock, -+ SOL_SOCKET, -+ SO_RCVTIMEO, -+ &tv as *const timeval as *const c_void, -+ core::mem::size_of::() as socklen_t, -+ ); -+ } -+ -+ let mut count: isize = -1; -+ for _attempt in 0..2 { -+ count = unsafe { sys_socket::recv(sock, buf_ptr, 65536, 0) }; -+ if count >= 0 { -+ break; -+ } -+ if unsafe { sys_socket::send(sock, packet_data_ptr, packet_data_len, 0) } < 0 { -+ break; -+ } -+ } -+ if count < 0 { -+ return Err(EIO); -+ } -+ -+ match Dns::parse(&buf[..count as usize]) { -+ Ok(response) => { -+ let addrs: Vec<_> = response -+ .answers -+ .into_iter() -+ .filter_map(|answer| { -+ if answer.a_type == 0x001c -+ && answer.a_class == 0x0001 -+ && answer.data.len() == 16 -+ { -+ let mut s6_addr = [0u8; 16]; -+ s6_addr.copy_from_slice(&answer.data[..16]); -+ Some(in6_addr { s6_addr }) -+ } else { -+ None -+ } -+ }) -+ .collect(); -+ -+ Ok(addrs) -+ } -+ Err(_err) => Err(EINVAL), -+ } -+ } else { -+ Err(EINVAL) -+ } -+} -+ - pub fn lookup_addr(addr: in_addr) -> Result>, c_int> { - let dns_string = get_dns_server().map_err(|e| e.0)?; - -@@ -282,6 +400,23 @@ pub fn parse_ipv4_string(ip_string: &str) -> Option { - Some(u32::from_ne_bytes(dns_arr)) - } - -+pub fn parse_ipv6_string(ip_string: &str) -> Option { -+ let trimmed = ip_string.trim(); -+ -+ let s = if trimmed.starts_with('[') && trimmed.ends_with(']') { -+ &trimmed[1..trimmed.len() - 1] -+ } else { -+ trimmed -+ }; -+ -+ let ip: core::net::Ipv6Addr = s.parse().ok()?; -+ let mut addr = in6_addr { -+ s6_addr: [0u8; 16], -+ }; -+ addr.s6_addr.copy_from_slice(&ip.octets()); -+ Some(addr) -+} -+ - #[cfg(test)] - mod tests { - use alloc::str; -diff --git a/src/header/netdb/mod.rs b/src/header/netdb/mod.rs -index ccccccc..ddddddd 100644 ---- a/src/header/netdb/mod.rs -+++ b/src/header/netdb/mod.rs -@@ -4,7 +4,7 @@ - - mod dns; - --use core::{cell::Cell, fmt::Write, mem, net::Ipv4Addr, ptr, str}; -+use core::{cell::Cell, fmt::Write, mem, net::Ipv4Addr, net::Ipv6Addr, ptr, str}; - - use alloc::{boxed::Box, str::SplitWhitespace, string::ToString, vec::Vec}; - -@@ -18,10 +18,10 @@ use crate::{ - bits_socklen_t::socklen_t, - errno::*, - fcntl::O_RDONLY, -- netinet_in::{in_addr, sockaddr_in, sockaddr_in6}, -+ netinet_in::{in6_addr, in_addr, sockaddr_in, sockaddr_in6}, - stdlib::atoi, - strings::strcasecmp, -- sys_socket::{constants::AF_INET, sockaddr}, -+ sys_socket::{constants::{AF_INET, AF_INET6, AF_UNSPEC}, sockaddr}, - unistd::SEEK_SET, - }, - platform::{ -@@ -871,11 +871,16 @@ pub unsafe extern "C" fn getaddrinfo( - hints_opt - ); - -+ let requested_family = hints_opt.map_or(AF_UNSPEC, |hints| hints.ai_family); -+ -+ if requested_family != AF_INET && requested_family != AF_INET6 && requested_family != AF_UNSPEC -+ { -+ return EAI_FAMILY; -+ } -+ - //TODO: Use hints - let mut ai_flags = hints_opt.map_or(0, |hints| hints.ai_flags); -- let mut ai_family; // = hints_opt.map_or(AF_UNSPEC, |hints| hints.ai_family); - let ai_socktype = hints_opt.map_or(0, |hints| hints.ai_socktype); -- let mut ai_protocol; // = hints_opt.map_or(0, |hints| hints.ai_protocol); - - unsafe { *res = ptr::null_mut() }; - -@@ -896,31 +901,52 @@ pub unsafe extern "C" fn getaddrinfo( - } - }); - -- let lookuphost = if ai_flags & AI_NUMERICHOST > 0 { -- match parse_ipv4_string(unsafe { str::from_utf8_unchecked(node.to_bytes()) }) { -- Some(s_addr) => vec![in_addr { s_addr }], -- None => { -- return EAI_NONAME; -+ let node_str = unsafe { str::from_utf8_unchecked(node.to_bytes()) }; -+ -+ let want_inet4 = requested_family == AF_INET || requested_family == AF_UNSPEC; -+ let want_inet6 = requested_family == AF_INET6 || requested_family == AF_UNSPEC; -+ -+ let lookuphost_v4: Vec = if want_inet4 { -+ if ai_flags & AI_NUMERICHOST > 0 { -+ match parse_ipv4_string(node_str) { -+ Some(s_addr) => vec![in_addr { s_addr }], -+ None => vec![], -+ } -+ } else { -+ match lookup_host(node_str) { -+ Ok(addrs) => addrs, -+ Err(_) => vec![], - } - } - } else { -- match lookup_host(unsafe { str::from_utf8_unchecked(node.to_bytes()) }) { -- Ok(lookuphost) => lookuphost, -- Err(e) => { -- platform::ERRNO.set(e); -- return EAI_SYSTEM; -+ vec![] -+ }; -+ -+ let lookuphost_v6: Vec = if want_inet6 { -+ if ai_flags & AI_NUMERICHOST > 0 { -+ match parse_ipv6_string(node_str) { -+ Some(addr) => vec![addr], -+ None => vec![], -+ } -+ } else { -+ match lookup_host_v6(node_str) { -+ Ok(addrs) => addrs, -+ Err(_) => vec![], - } - } -+ } else { -+ vec![] - }; - -- for in_addr in lookuphost { -- ai_family = AF_INET; -- ai_protocol = 0; -+ if lookuphost_v4.is_empty() && lookuphost_v6.is_empty() { -+ return EAI_NONAME; -+ } - -+ for addr in lookuphost_v4 { - let ai_addr = Box::into_raw(Box::new(sockaddr_in { -- sin_family: ai_family as sa_family_t, -+ sin_family: AF_INET as sa_family_t, - sin_port: htons(port), -- sin_addr: in_addr, -+ sin_addr: addr, - sin_zero: [0; 8], - })) - .cast::(); -@@ -939,9 +965,53 @@ pub unsafe extern "C" fn getaddrinfo( - - let addrinfo = Box::new(addrinfo { - ai_flags: 0, -- ai_family, -+ ai_family: AF_INET, - ai_socktype, -- ai_protocol, -+ ai_protocol: 0, -+ ai_addrlen, -+ ai_canonname, -+ ai_addr, -+ ai_next: ptr::null_mut(), -+ }); -+ unsafe { -+ let mut indirect = res; -+ while !(*indirect).is_null() { -+ indirect = &raw mut (**indirect).ai_next; -+ } -+ *indirect = Box::into_raw(addrinfo) -+ } -+ } -+ -+ for addr in lookuphost_v6 { -+ let mut s6_addr = [0u8; 16]; -+ s6_addr.copy_from_slice(&addr.s6_addr); -+ -+ let ai_addr = Box::into_raw(Box::new(sockaddr_in6 { -+ sin6_family: AF_INET6 as sa_family_t, -+ sin6_port: htons(port), -+ sin6_flowinfo: 0, -+ sin6_addr: in6_addr { s6_addr }, -+ sin6_scope_id: 0, -+ })) -+ .cast::(); -+ -+ let ai_addrlen = mem::size_of::() as socklen_t; -+ -+ let ai_canonname = if ai_flags & AI_CANONNAME > 0 { -+ if node_opt.is_none() { -+ return EAI_BADFLAGS; -+ } -+ ai_flags &= !AI_CANONNAME; -+ node.to_owned_cstring().into_raw() -+ } else { -+ ptr::null_mut() -+ }; -+ -+ let addrinfo = Box::new(addrinfo { -+ ai_flags: 0, -+ ai_family: AF_INET6, -+ ai_socktype, -+ ai_protocol: 0, - ai_addrlen, - ai_canonname, - ai_addr, -@@ -970,10 +1040,56 @@ pub unsafe extern "C" fn getnameinfo( - servlen: socklen_t, - flags: c_int, - ) -> c_int { -- if addr.is_null() || addrlen as usize != mem::size_of::() { -+ if addr.is_null() { -+ return EAI_FAMILY; -+ } -+ -+ let addrlen_usize = addrlen as usize; -+ if addrlen_usize != mem::size_of::() -+ && addrlen_usize != mem::size_of::() -+ { - return EAI_FAMILY; - } - -+ if addrlen_usize == mem::size_of::() { -+ let sa = unsafe { &*(addr.cast::()) }; -+ -+ if !serv.is_null() && servlen > 0 { -+ if flags & NI_NUMERICSERV != 0 { -+ let port_str = sa.sin6_port.to_be().to_string(); -+ let port_bytes = port_str.as_bytes(); -+ if (servlen as usize) <= port_bytes.len() { -+ return EAI_MEMORY; -+ } -+ unsafe { -+ ptr::copy_nonoverlapping( -+ port_bytes.as_ptr().cast::(), -+ serv, -+ port_bytes.len(), -+ ) -+ }; -+ unsafe { *serv.add(port_bytes.len()) = 0 }; -+ } else { -+ unsafe { *serv = 0 }; -+ } -+ } -+ -+ if !host.is_null() && hostlen > 0 { -+ let ip_addr = Ipv6Addr::from(sa.sin6_addr.s6_addr); -+ let ip_str = ip_addr.to_string(); -+ let ip_bytes = ip_str.as_bytes(); -+ if (hostlen as usize) <= ip_bytes.len() { -+ return EAI_MEMORY; -+ } -+ unsafe { -+ ptr::copy_nonoverlapping(ip_bytes.as_ptr().cast::(), host, ip_bytes.len()) -+ }; -+ unsafe { *host.add(ip_bytes.len()) = 0 }; -+ } -+ -+ return 0; -+ } -+ - let sa = unsafe { &*(addr.cast::()) }; - - if !serv.is_null() && servlen > 0 { diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-dns-resolver-hardening.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-dns-resolver-hardening.patch deleted file mode 100644 index 2963612904..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-dns-resolver-hardening.patch +++ /dev/null @@ -1,722 +0,0 @@ -diff --git a/src/header/netdb/dns/mod.rs b/src/header/netdb/dns/mod.rs -index 9d7e44b..f5bc21b 100644 ---- a/src/header/netdb/dns/mod.rs -+++ b/src/header/netdb/dns/mod.rs -@@ -15,7 +15,35 @@ use alloc::{string::String, vec::Vec}; - mod answer; - mod query; - -+const DNS_FLAG_QR: u16 = 0x8000; -+const DNS_FLAG_TC: u16 = 0x0200; -+const DNS_RCODE_MASK: u16 = 0x000F; -+ -+#[derive(Clone, Copy, Debug, Eq, PartialEq)] -+pub(super) enum DnsError { -+ MalformedResponse, -+ TransactionIdMismatch, -+ NotResponse, -+ Truncated, -+ ServerFailure, -+ NameError, -+ ResponseCode(u8), -+} -+ -+impl DnsError { -+ fn as_str(self) -> &'static str { -+ match self { -+ Self::MalformedResponse => "malformed dns response", -+ Self::TransactionIdMismatch => "dns transaction id mismatch", -+ Self::NotResponse => "dns packet was not a response", -+ Self::Truncated => "truncated dns response", -+ Self::ServerFailure => "dns server failure", -+ Self::NameError => "dns name error", -+ Self::ResponseCode(_) => "dns server returned an error response", -+ } -+ } -+} - - #[derive(Clone, Debug)] - pub struct Dns { - pub transaction_id: u16, -@@ -59,6 +88,14 @@ impl Dns { - } - - pub fn parse(data: &[u8]) -> Result { -+ Self::parse_impl(data, None).map_err(|err| err.as_str().into()) -+ } -+ -+ pub(super) fn parse_reply(data: &[u8], expected_transaction_id: u16) -> Result { -+ Self::parse_impl(data, Some(expected_transaction_id)) -+ } -+ -+ fn parse_impl(data: &[u8], expected_transaction_id: Option) -> Result { - let name_ind = 0b1100_0000; - let mut i = 0; - -@@ -66,7 +103,7 @@ impl Dns { - () => {{ - i += 1; - if i > data.len() { -- return Err(format!("{}: {}: pop_u8", file!(), line!())); -+ return Err(DnsError::MalformedResponse); - } - data[i - 1] - }}; -@@ -77,9 +114,11 @@ impl Dns { - use core::convert::TryInto; - i += 2; - if i > data.len() { -- return Err(format!("{}: {}: pop_n16", file!(), line!())); -+ return Err(DnsError::MalformedResponse); - } -- let bytes: [u8; 2] = data[i - 2..i].try_into().unwrap(); -+ let bytes: [u8; 2] = data[i - 2..i] -+ .try_into() -+ .map_err(|_| DnsError::MalformedResponse)?; - u16::from_be_bytes(bytes) - }}; - } -@@ -156,10 +195,83 @@ impl Dns { - }); - } - -- Ok(Dns { -+ let dns = Dns { - transaction_id, - flags, - queries, - answers, -- }) -+ }; -+ -+ if let Some(expected_transaction_id) = expected_transaction_id { -+ if dns.transaction_id != expected_transaction_id { -+ return Err(DnsError::TransactionIdMismatch); -+ } -+ } -+ -+ if dns.flags & DNS_FLAG_QR == 0 { -+ return Err(DnsError::NotResponse); -+ } -+ -+ if dns.flags & DNS_FLAG_TC != 0 { -+ return Err(DnsError::Truncated); -+ } -+ -+ match (dns.flags & DNS_RCODE_MASK) as u8 { -+ 0 => Ok(dns), -+ 2 => Err(DnsError::ServerFailure), -+ 3 => Err(DnsError::NameError), -+ rcode => Err(DnsError::ResponseCode(rcode)), -+ } -+ } -+} -+ -+#[cfg(test)] -+mod tests { -+ use alloc::{string::ToString, vec::Vec}; -+ -+ use super::{Dns, DnsError, DnsQuery}; -+ -+ fn packet(transaction_id: u16, flags: u16) -> Vec { -+ Dns { -+ transaction_id, -+ flags, -+ queries: vec![DnsQuery { -+ name: "example.com".to_string(), -+ q_type: 0x0001, -+ q_class: 0x0001, -+ }], -+ answers: vec![], -+ } -+ .compile() -+ } -+ -+ #[test] -+ fn parse_reply_accepts_valid_response() { -+ let response = Dns::parse_reply(&packet(0x1234, 0x8180), 0x1234).unwrap(); -+ assert_eq!(response.transaction_id, 0x1234); -+ } -+ -+ #[test] -+ fn parse_reply_rejects_transaction_id_mismatch() { -+ let err = Dns::parse_reply(&packet(0x1234, 0x8180), 0x4321).unwrap_err(); -+ assert_eq!(err, DnsError::TransactionIdMismatch); -+ } -+ -+ #[test] -+ fn parse_rejects_query_packets() { -+ let err = Dns::parse(&packet(0x1234, 0x0100)).unwrap_err(); -+ assert_eq!(err, DnsError::NotResponse.as_str()); -+ } -+ -+ #[test] -+ fn parse_rejects_truncated_response() { -+ let err = Dns::parse(&packet(0x1234, 0x8380)).unwrap_err(); -+ assert_eq!(err, DnsError::Truncated.as_str()); -+ } -+ -+ #[test] -+ fn parse_rejects_name_error_response() { -+ let err = Dns::parse(&packet(0x1234, 0x8183)).unwrap_err(); -+ assert_eq!(err, DnsError::NameError.as_str()); -+ } - } -diff --git a/src/header/netdb/lookup.rs b/src/header/netdb/lookup.rs -index c2b6cdb..af25f97 100644 ---- a/src/header/netdb/lookup.rs -+++ b/src/header/netdb/lookup.rs -@@ -1,10 +1,10 @@ --use alloc::{boxed::Box, string::ToString, vec::Vec}; -+use alloc::{string::ToString, vec::Vec}; - use core::{mem, ptr}; - - use crate::{ - out::Out, - platform::{ -- Pal, Sys, -+ self, Pal, Sys, - types::{c_int, c_void}, - }, - }; -@@ -25,12 +25,120 @@ use crate::header::{ - }; - - use super::{ -- dns::{Dns, DnsQuery}, -+ dns::{Dns, DnsError, DnsQuery}, - sys::get_dns_server, - }; - - pub type LookupHost = Vec; - pub type LookupHostV6 = Vec; -+ -+fn close_socket(sock: c_int) { -+ if sock >= 0 { -+ if let Ok(()) = Sys::close(sock) {}; -+ } -+} -+ -+fn last_socket_error(default: c_int) -> c_int { -+ match platform::ERRNO.get() { -+ 0 => default, -+ err => err, -+ } -+} -+ -+fn map_dns_error(err: DnsError) -> c_int { -+ match err { -+ DnsError::NameError => ENOENT, -+ DnsError::ServerFailure => EAGAIN, -+ DnsError::Truncated => EMSGSIZE, -+ DnsError::MalformedResponse -+ | DnsError::TransactionIdMismatch -+ | DnsError::NotResponse -+ | DnsError::ResponseCode(_) => EREMOTEIO, -+ } -+} -+ -+fn lookup_dns_response(packet: &Dns, dns_addr: u32) -> Result { -+ let packet_data = packet.compile(); -+ let packet_data_len = packet_data.len(); -+ let packet_data_ptr = packet_data.as_ptr().cast::(); -+ -+ let dest = sockaddr_in { -+ sin_family: AF_INET as u16, -+ sin_port: htons(53), -+ sin_addr: in_addr { s_addr: dns_addr }, -+ ..Default::default() -+ }; -+ let dest_ptr = ptr::from_ref(&dest).cast::(); -+ -+ let sock = unsafe { sys_socket::socket(AF_INET, SOCK_DGRAM, i32::from(IPPROTO_UDP)) }; -+ if sock < 0 { -+ return Err(last_socket_error(EIO)); -+ } -+ -+ if unsafe { sys_socket::connect(sock, dest_ptr, mem::size_of_val(&dest) as socklen_t) } < 0 { -+ let err = last_socket_error(EIO); -+ close_socket(sock); -+ return Err(err); -+ } -+ -+ if unsafe { sys_socket::send(sock, packet_data_ptr, packet_data_len, 0) } < 0 { -+ let err = last_socket_error(EIO); -+ close_socket(sock); -+ return Err(err); -+ } -+ -+ let tv = timeval { -+ tv_sec: 5, -+ tv_usec: 0, -+ }; -+ unsafe { -+ sys_socket::setsockopt( -+ sock, -+ SOL_SOCKET, -+ SO_RCVTIMEO, -+ &tv as *const timeval as *const c_void, -+ core::mem::size_of::() as socklen_t, -+ ); -+ } -+ -+ let mut buf = vec![0u8; 65536]; -+ let buf_ptr = buf.as_mut_ptr().cast::(); -+ -+ let mut count: isize = -1; -+ let mut recv_error = EIO; -+ for attempt in 0..2 { -+ count = unsafe { sys_socket::recv(sock, buf_ptr, buf.len(), 0) }; -+ if count >= 0 { -+ break; -+ } -+ -+ recv_error = last_socket_error(EIO); -+ if attempt + 1 == 2 { -+ break; -+ } -+ -+ if unsafe { sys_socket::send(sock, packet_data_ptr, packet_data_len, 0) } < 0 { -+ recv_error = last_socket_error(EIO); -+ break; -+ } -+ } -+ -+ if count < 0 { -+ close_socket(sock); -+ return Err(recv_error); -+ } -+ -+ let response = match Dns::parse_reply(&buf[..count as usize], packet.transaction_id) { -+ Ok(response) => response, -+ Err(err) => { -+ close_socket(sock); -+ return Err(map_dns_error(err)); -+ } -+ }; -+ -+ close_socket(sock); -+ Ok(response) -+} - - pub fn lookup_host(host: &str) -> Result { - if let Some(host_direct_addr) = parse_ipv4_string(host) { -@@ -61,97 +134,28 @@ pub fn lookup_host(host: &str) -> Result { - answers: vec![], - }; - -- let packet_data = packet.compile(); -- let packet_data_len = packet_data.len(); -- -- let packet_data_box = packet_data.into_boxed_slice(); -- let packet_data_ptr = Box::into_raw(packet_data_box) as *mut _ as *mut c_void; -- -- let dest = sockaddr_in { -- sin_family: AF_INET as u16, -- sin_port: htons(53), -- sin_addr: in_addr { s_addr: dns_addr }, -- ..Default::default() -- }; -- let dest_ptr = ptr::from_ref(&dest).cast::(); -- -- let sock = unsafe { -- let sock = sys_socket::socket(AF_INET, SOCK_DGRAM, i32::from(IPPROTO_UDP)); -- if sys_socket::connect(sock, dest_ptr, mem::size_of_val(&dest) as socklen_t) < 0 { -- return Err(EIO); -- } -- if sys_socket::send(sock, packet_data_ptr, packet_data_len, 0) < 0 { -- drop(Box::from_raw(packet_data_ptr)); -- return Err(EIO); -- } -- sock -- }; -- -- unsafe { -- drop(Box::from_raw(packet_data_ptr)); -- } -- -- let mut buf = vec![0u8; 65536]; -- let buf_ptr = buf.as_mut_ptr().cast::(); -- -- // Set 5s recv timeout (best-effort; if this fails, recv may block longer). -- let tv = timeval { -- tv_sec: 5, -- tv_usec: 0, -- }; -- unsafe { -- sys_socket::setsockopt( -- sock, -- SOL_SOCKET, -- SO_RCVTIMEO, -- &tv as *const timeval as *const c_void, -- core::mem::size_of::() as socklen_t, -- ); -- } -- -- let mut count: isize = -1; -- for _attempt in 0..2 { -- count = unsafe { sys_socket::recv(sock, buf_ptr, 65536, 0) }; -- if count >= 0 { -- break; -- } -- if unsafe { sys_socket::send(sock, packet_data_ptr, packet_data_len, 0) } < 0 { -- break; -- } -- } -- if count < 0 { -- return Err(EIO); -- } -- -- match Dns::parse(&buf[..count as usize]) { -- Ok(response) => { -- let addrs: Vec<_> = response -- .answers -- .into_iter() -- .filter_map(|answer| { -- if answer.a_type == 0x0001 -- && answer.a_class == 0x0001 -- && answer.data.len() == 4 -- { -- let addr = in_addr { -- s_addr: u32::from_ne_bytes([ -- answer.data[0], -- answer.data[1], -- answer.data[2], -- answer.data[3], -- ]), -- }; -- Some(addr) -- } else { -- None -- } -- }) -- .collect(); -- -- Ok(addrs) -- } -- Err(_err) => Err(EINVAL), -- } -+ let response = lookup_dns_response(&packet, dns_addr)?; -+ let addrs: Vec<_> = response -+ .answers -+ .into_iter() -+ .filter_map(|answer| { -+ if answer.a_type == 0x0001 && answer.a_class == 0x0001 && answer.data.len() == 4 { -+ let addr = in_addr { -+ s_addr: u32::from_ne_bytes([ -+ answer.data[0], -+ answer.data[1], -+ answer.data[2], -+ answer.data[3], -+ ]), -+ }; -+ Some(addr) -+ } else { -+ None -+ } -+ }) -+ .collect(); -+ -+ Ok(addrs) - } else { - Err(EINVAL) - } -@@ -186,91 +192,22 @@ pub fn lookup_host_v6(host: &str) -> Result { - answers: vec![], - }; - -- let packet_data = packet.compile(); -- let packet_data_len = packet_data.len(); -- -- let packet_data_box = packet_data.into_boxed_slice(); -- let packet_data_ptr = Box::into_raw(packet_data_box) as *mut _ as *mut c_void; -- -- let dest = sockaddr_in { -- sin_family: AF_INET as u16, -- sin_port: htons(53), -- sin_addr: in_addr { s_addr: dns_addr }, -- ..Default::default() -- }; -- let dest_ptr = ptr::from_ref(&dest).cast::(); -- -- let sock = unsafe { -- let sock = sys_socket::socket(AF_INET, SOCK_DGRAM, i32::from(IPPROTO_UDP)); -- if sys_socket::connect(sock, dest_ptr, mem::size_of_val(&dest) as socklen_t) < 0 { -- return Err(EIO); -- } -- if sys_socket::send(sock, packet_data_ptr, packet_data_len, 0) < 0 { -- drop(Box::from_raw(packet_data_ptr)); -- return Err(EIO); -- } -- sock -- }; -- -- unsafe { -- drop(Box::from_raw(packet_data_ptr)); -- } -- -- let mut buf = vec![0u8; 65536]; -- let buf_ptr = buf.as_mut_ptr().cast::(); -- -- // Set 5s recv timeout (best-effort; if this fails, recv may block longer). -- let tv = timeval { -- tv_sec: 5, -- tv_usec: 0, -- }; -- unsafe { -- sys_socket::setsockopt( -- sock, -- SOL_SOCKET, -- SO_RCVTIMEO, -- &tv as *const timeval as *const c_void, -- core::mem::size_of::() as socklen_t, -- ); -- } -- -- let mut count: isize = -1; -- for _attempt in 0..2 { -- count = unsafe { sys_socket::recv(sock, buf_ptr, 65536, 0) }; -- if count >= 0 { -- break; -- } -- if unsafe { sys_socket::send(sock, packet_data_ptr, packet_data_len, 0) } < 0 { -- break; -- } -- } -- if count < 0 { -- return Err(EIO); -- } -- -- match Dns::parse(&buf[..count as usize]) { -- Ok(response) => { -- let addrs: Vec<_> = response -- .answers -- .into_iter() -- .filter_map(|answer| { -- if answer.a_type == 0x001c -- && answer.a_class == 0x0001 -- && answer.data.len() == 16 -- { -- let mut s6_addr = [0u8; 16]; -- s6_addr.copy_from_slice(&answer.data[..16]); -- Some(in6_addr { s6_addr }) -- } else { -- None -- } -- }) -- .collect(); -- -- Ok(addrs) -- } -- Err(_err) => Err(EINVAL), -- } -+ let response = lookup_dns_response(&packet, dns_addr)?; -+ let addrs: Vec<_> = response -+ .answers -+ .into_iter() -+ .filter_map(|answer| { -+ if answer.a_type == 0x001c && answer.a_class == 0x0001 && answer.data.len() == 16 { -+ let mut s6_addr = [0u8; 16]; -+ s6_addr.copy_from_slice(&answer.data[..16]); -+ Some(in6_addr { s6_addr }) -+ } else { -+ None -+ } -+ }) -+ .collect(); -+ -+ Ok(addrs) - } else { - Err(EINVAL) - } -@@ -315,92 +254,24 @@ pub fn lookup_addr(addr: in_addr) -> Result>, c_int> { - answers: vec![], - }; - -- let packet_data = packet.compile(); -- let packet_data_len = packet_data.len(); -- let packet_data_box = packet_data.into_boxed_slice(); -- let packet_data_ptr = Box::into_raw(packet_data_box) as *mut _ as *mut c_void; -- -- let dest = sockaddr_in { -- sin_family: AF_INET as u16, -- sin_port: htons(53), -- sin_addr: in_addr { s_addr: dns_addr }, -- ..Default::default() -- }; -- -- let dest_ptr = ptr::from_ref(&dest).cast::(); -- -- let sock = unsafe { -- let sock = sys_socket::socket(AF_INET, SOCK_DGRAM, i32::from(IPPROTO_UDP)); -- if sys_socket::connect(sock, dest_ptr, mem::size_of_val(&dest) as socklen_t) < 0 { -- return Err(EIO); -- } -- sock -- }; -- -- unsafe { -- if sys_socket::send(sock, packet_data_ptr, packet_data_len, 0) < 0 { -- return Err(EIO); -- } -- } -- -- unsafe { -- drop(Box::from_raw(packet_data_ptr)); -- } -- -- let mut buf = [0u8; 65536]; -- let buf_ptr = buf.as_mut_ptr().cast::(); -- -- // Set 5s recv timeout (best-effort; if this fails, recv may block longer). -- let tv = timeval { -- tv_sec: 5, -- tv_usec: 0, -- }; -- unsafe { -- sys_socket::setsockopt( -- sock, -- SOL_SOCKET, -- SO_RCVTIMEO, -- &tv as *const timeval as *const c_void, -- core::mem::size_of::() as socklen_t, -- ); -- } -- -- let mut count: isize = -1; -- for _attempt in 0..2 { -- count = unsafe { sys_socket::recv(sock, buf_ptr, 65536, 0) }; -- if count >= 0 { -- break; -- } -- if unsafe { sys_socket::send(sock, packet_data_ptr, packet_data_len, 0) } < 0 { -- break; -- } -- } -- if count < 0 { -- return Err(EIO); -- } -- -- match Dns::parse(&buf[..count as usize]) { -- Ok(response) => { -- let names = response -- .answers -- .into_iter() -- .filter_map(|answer| { -- if answer.a_type == 0x000C && answer.a_class == 0x0001 { -- // answer.data is encoded kinda weird. -- // Basically length-prefixed strings for each -- // subsection of the domain. -- // We need to parse this to insert periods where -- // they belong (ie at the end of each string) -- Some(parse_revdns_answer(&answer.data)) -- } else { -- None -- } -- }) -- .collect(); -- Ok(names) -- } -- Err(_err) => Err(EINVAL), -- } -+ let response = lookup_dns_response(&packet, dns_addr)?; -+ let names = response -+ .answers -+ .into_iter() -+ .filter_map(|answer| { -+ if answer.a_type == 0x000C && answer.a_class == 0x0001 { -+ // answer.data is encoded kinda weird. -+ // Basically length-prefixed strings for each -+ // subsection of the domain. -+ // We need to parse this to insert periods where -+ // they belong (ie at the end of each string) -+ Some(parse_revdns_answer(&answer.data)) -+ } else { -+ None -+ } -+ }) -+ .collect(); -+ Ok(names) - } else { - Err(EINVAL) - } -diff --git a/src/header/netdb/mod.rs b/src/header/netdb/mod.rs -index ba58b6e..cdcc10e 100644 ---- a/src/header/netdb/mod.rs -+++ b/src/header/netdb/mod.rs -@@ -180,6 +180,35 @@ fn bytes_to_box_str(bytes: &[u8]) -> Box { - Box::from(core::str::from_utf8(bytes).unwrap_or("")) - } - -+fn lookup_error_to_eai(err: c_int) -> c_int { -+ match err { -+ ETIMEDOUT | EAGAIN => EAI_AGAIN, -+ ENOENT => EAI_NONAME, -+ _ => EAI_FAIL, -+ } -+} -+ -+fn lookup_error_priority(err: c_int) -> u8 { -+ match err { -+ EAI_AGAIN => 3, -+ EAI_FAIL => 2, -+ EAI_NONAME => 1, -+ _ => 0, -+ } -+} -+ -+fn combine_lookup_error(current: Option, err: c_int) -> c_int { -+ let mapped = lookup_error_to_eai(err); -+ -+ match current { -+ Some(existing) if lookup_error_priority(existing) >= lookup_error_priority(mapped) => { -+ existing -+ } -+ Some(_) => mapped, -+ None => mapped, -+ } -+} -+ - /// See . - #[unsafe(no_mangle)] - pub unsafe extern "C" fn endnetent() { -@@ -926,6 +951,8 @@ pub unsafe extern "C" fn getaddrinfo( - let want_inet4 = requested_family == AF_INET || requested_family == AF_UNSPEC; - let want_inet6 = requested_family == AF_INET6 || requested_family == AF_UNSPEC; - -+ let mut lookup_error = None; -+ - let lookuphost_v4: Vec = if want_inet4 { - if ai_flags & AI_NUMERICHOST > 0 { - match parse_ipv4_string(node_str) { -@@ -937,7 +964,10 @@ pub unsafe extern "C" fn getaddrinfo( - } else { - match lookup_host(node_str) { - Ok(addrs) => addrs, -- Err(_) => vec![], -+ Err(err) => { -+ lookup_error = Some(combine_lookup_error(lookup_error, err)); -+ vec![] -+ } - } - } - } else { -@@ -955,7 +985,10 @@ pub unsafe extern "C" fn getaddrinfo( - } else { - match lookup_host_v6(node_str) { - Ok(addrs) => addrs, -- Err(_) => vec![], -+ Err(err) => { -+ lookup_error = Some(combine_lookup_error(lookup_error, err)); -+ vec![] -+ } - } - } - } else { -@@ -963,5 +996,5 @@ pub unsafe extern "C" fn getaddrinfo( - }; - - if lookuphost_v4.is_empty() && lookuphost_v6.is_empty() { -- return EAI_NONAME; -+ return lookup_error.unwrap_or(EAI_NONAME); - } diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-dup3.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-dup3.patch deleted file mode 100644 index 59e84880e1..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-dup3.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/src/header/unistd/mod.rs b/src/header/unistd/mod.rs ---- a/src/header/unistd/mod.rs -+++ b/src/header/unistd/mod.rs -@@ -273,7 +273,20 @@ - /// See . - // #[unsafe(no_mangle)] - pub extern "C" fn dup3(fildes: c_int, fildes2: c_int, flag: c_int) -> c_int { -- unimplemented!(); -+ // dup3 requires fildes != fildes2 (unlike dup2 which is a no-op in that case) -+ if fildes == fildes2 { -+ ERRNO.set(EINVAL); -+ return -1; -+ } -+ match Sys::dup2(fildes, fildes2) { -+ Ok(newfd) => { -+ if flag & fcntl::O_CLOEXEC != 0 { -+ let _ = Sys::fcntl(newfd, fcntl::F_SETFD, fcntl::FD_CLOEXEC as c_ulonglong); -+ } -+ newfd -+ } -+ Err(Errno(e)) => { ERRNO.set(e); -1 } -+ } - } - - // See . diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-elf64-types.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-elf64-types.patch deleted file mode 100644 index 8687ed82e6..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-elf64-types.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/src/header/elf/mod.rs b/src/header/elf/mod.rs ---- a/src/header/elf/mod.rs -+++ b/src/header/elf/mod.rs -@@ -9,8 +9,8 @@ - - pub type Elf32_Word = uint32_t; - pub type Elf32_Sword = int32_t; --pub type Elf64_Word = uint64_t; --pub type Elf64_Sword = int64_t; -+pub type Elf64_Word = uint32_t; -+pub type Elf64_Sword = int32_t; - - pub type Elf32_Xword = uint64_t; - pub type Elf32_Sxword = int64_t; diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-eventfd-mod.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-eventfd-mod.patch deleted file mode 100644 index 0309051651..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-eventfd-mod.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/src/header/mod.rs -+++ b/src/header/mod.rs -@@ -91,6 +91,7 @@ - // TODO: stropts.h (deprecated) - pub mod sys_auxv; - pub mod sys_epoll; -+pub mod sys_eventfd; - pub mod sys_file; - pub mod sys_ioctl; - // TODO: sys/ipc.h -@@ -113,9 +114,11 @@ - pub mod arch_aarch64_user; - pub mod arch_riscv64_user; - pub mod arch_x64_user; -+pub mod sys_signalfd; - #[cfg(not(target_arch = "x86"))] // TODO: x86 - pub mod sys_procfs; - pub mod sys_random; -+pub mod sys_timerfd; - pub mod sys_syslog; - pub mod sys_types; - #[allow(non_camel_case_types)] - diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-exec-root-bypass.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-exec-root-bypass.patch deleted file mode 100644 index b3669f51b3..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-exec-root-bypass.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff --git a/src/platform/redox/exec.rs b/src/platform/redox/exec.rs -index 3590413c..1b4b96bb 100644 ---- a/src/platform/redox/exec.rs -+++ b/src/platform/redox/exec.rs -@@ -127,18 +127,22 @@ pub fn execve( - // TODO: At some point we might have capabilities limiting the ability to allocate - // executable memory. - -- let Resugid { ruid, rgid, .. } = redox_rt::sys::posix_getresugid(); -- -- let mode = if ruid == stat.st_uid { -- (stat.st_mode >> 3 * 2) & 0o7 -- } else if rgid == stat.st_gid { -- (stat.st_mode >> 3 * 1) & 0o7 -- } else { -- stat.st_mode & 0o7 -- }; -+ let Resugid { ruid, euid, rgid, .. } = redox_rt::sys::posix_getresugid(); -+ -+ // Root (uid 0) bypasses execute permission checks, matching Linux behavior. -+ // Check both ruid and euid since Linux checks the effective UID. -+ if ruid != 0 && euid != 0 { -+ let mode = if ruid == stat.st_uid { -+ (stat.st_mode >> 3 * 2) & 0o7 -+ } else if rgid == stat.st_gid { -+ (stat.st_mode >> 3 * 1) & 0o7 -+ } else { -+ stat.st_mode & 0o7 -+ }; - -- if mode & 0o1 == 0o0 { -- return Err(Error::new(EPERM)); -+ if mode & 0o1 == 0o0 { -+ return Err(Error::new(EACCES)); -+ } - } - - let cwd: Box<[u8]> = super::path::clone_cwd().unwrap_or_default().into(); diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-fenv.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-fenv.patch deleted file mode 100644 index 853f595a64..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-fenv.patch +++ /dev/null @@ -1,230 +0,0 @@ -diff --git a/src/header/_fenv/mod.rs b/src/header/_fenv/mod.rs ---- a/src/header/_fenv/mod.rs -+++ b/src/header/_fenv/mod.rs -@@ -4,82 +4,210 @@ - - use crate::platform::types::c_int; - --/// See . --pub const FE_ALL_EXCEPT: c_int = 0; --/// See . --pub const FE_TONEAREST: c_int = 0; -+// x86_64 SSE floating-point exception flags (MXCSR bits 0-5, excluding denormal bit 1) -+pub const FE_INVALID: c_int = 0x01; -+pub const FE_DIVBYZERO: c_int = 0x04; -+pub const FE_OVERFLOW: c_int = 0x08; -+pub const FE_UNDERFLOW: c_int = 0x10; -+pub const FE_INEXACT: c_int = 0x20; -+/// See . -+pub const FE_ALL_EXCEPT: c_int = -+ FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT; -+ -+// x86_64 rounding modes (MXCSR bits 13-14, x87 CW bits 10-11) -+/// See . -+pub const FE_TONEAREST: c_int = 0x000; -+pub const FE_DOWNWARD: c_int = 0x400; -+pub const FE_UPWARD: c_int = 0x800; -+pub const FE_TOWARDZERO: c_int = 0xC00; - - /// See . - pub type fexcept_t = u64; - - /// See . - #[repr(C)] - pub struct fenv_t { -- pub cw: u64, -+ pub cw: u32, // x87 control word (zero-extended from u16) -+ pub mxcsr: u32, // SSE MXCSR register - } - -+/// Read the x87 FPU control word. -+#[inline] -+unsafe fn fnstcw() -> u16 { -+ let mut cw: u16 = 0; -+ core::arch::asm!( -+ "fnstcw ({0})", -+ in(reg) &mut cw, -+ options(nostack, preserves_flags) -+ ); -+ cw -+} -+ -+/// Load the x87 FPU control word. -+#[inline] -+unsafe fn fldcw(cw: u16) { -+ core::arch::asm!( -+ "fldcw ({0})", -+ in(reg) &cw, -+ options(nostack, preserves_flags) -+ ); -+} -+ -+/// Read the SSE MXCSR register. -+#[inline] -+unsafe fn stmxcsr() -> u32 { -+ let mut mxcsr: u32 = 0; -+ core::arch::asm!( -+ "stmxcsr ({0})", -+ in(reg) &mut mxcsr, -+ options(nostack, preserves_flags) -+ ); -+ mxcsr -+} -+ -+/// Write the SSE MXCSR register. -+#[inline] -+unsafe fn ldmxcsr(val: u32) { -+ core::arch::asm!( -+ "ldmxcsr ({0})", -+ in(reg) &val, -+ options(nostack, preserves_flags) -+ ); -+} -+ - /// See . - // #[unsafe(no_mangle)] - pub unsafe extern "C" fn feclearexcept(excepts: c_int) -> c_int { -- unimplemented!(); -+ let mask = (excepts & FE_ALL_EXCEPT) as u32; -+ if mask != 0 { -+ let mxcsr = stmxcsr(); -+ ldmxcsr(mxcsr & !mask); -+ // Clear x87 status word exception flags -+ core::arch::asm!("fnclex", options(nostack, preserves_flags)); -+ } -+ 0 - } - - /// See . - // #[unsafe(no_mangle)] - pub unsafe extern "C" fn fegetenv(envp: *mut fenv_t) -> c_int { -- unimplemented!(); -+ if envp.is_null() { -+ return 1; -+ } -+ (*envp).cw = fnstcw() as u32; -+ (*envp).mxcsr = stmxcsr(); -+ 0 - } - - /// See . - // #[unsafe(no_mangle)] - pub unsafe extern "C" fn fegetexceptflag(flagp: *mut fexcept_t, excepts: c_int) -> c_int { -- unimplemented!(); -+ if flagp.is_null() { -+ return 1; -+ } -+ let mxcsr = stmxcsr(); -+ *flagp = (mxcsr & FE_ALL_EXCEPT as u32 & excepts as u32) as fexcept_t; -+ 0 - } - - /// See . - // #[unsafe(no_mangle)] - pub unsafe extern "C" fn fegetround() -> c_int { -- FE_TONEAREST -+ let mxcsr = stmxcsr(); -+ (mxcsr & 0xC00) as c_int - } - - /// See . - // #[unsafe(no_mangle)] - pub unsafe extern "C" fn feholdexcept(envp: *mut fenv_t) -> c_int { -- unimplemented!(); -+ if envp.is_null() { -+ return 1; -+ } -+ // Save current environment -+ (*envp).cw = fnstcw() as u32; -+ (*envp).mxcsr = stmxcsr(); -+ // Clear all exception flags and set non-stop mode (unmask all exceptions) -+ // MXCSR: clear status bits 0-5, clear mask bits 7-12 -+ let mxcsr = stmxcsr(); -+ ldmxcsr(mxcsr & !(FE_ALL_EXCEPT as u32) & !((FE_ALL_EXCEPT as u32) << 7)); -+ // x87: clear exception mask bits (bits 0-5 in CW) and clear status -+ let cw = fnstcw(); -+ fldcw(cw & !0x3F); -+ core::arch::asm!("fnclex", options(nostack, preserves_flags)); -+ 0 - } - - /// See . - // #[unsafe(no_mangle)] - pub unsafe extern "C" fn feraiseexcept(excepts: c_int) -> c_int { -- unimplemented!(); -+ let mask = (excepts & FE_ALL_EXCEPT) as u32; -+ if mask == 0 { -+ return 0; -+ } -+ // Set exception status flags in MXCSR -+ let mxcsr = stmxcsr(); -+ ldmxcsr(mxcsr | mask); -+ 0 - } - - /// See . - // #[unsafe(no_mangle)] - pub unsafe extern "C" fn fesetenv(envp: *const fenv_t) -> c_int { -- unimplemented!(); -+ if envp.is_null() { -+ // Restore default environment -+ fldcw(0x037F); // x87 default CW: all exceptions masked, double precision -+ ldmxcsr(0x1F80); // MXCSR default: all exceptions masked, round-to-nearest -+ return 0; -+ } -+ fldcw((*envp).cw as u16); -+ ldmxcsr((*envp).mxcsr); -+ 0 - } - - /// See . - // #[unsafe(no_mangle)] - pub unsafe extern "C" fn fesetexceptflag(flagp: *const fexcept_t, excepts: c_int) -> c_int { -- unimplemented!(); -+ if flagp.is_null() { -+ return 1; -+ } -+ let mask = (excepts & FE_ALL_EXCEPT) as u32; -+ let mxcsr = stmxcsr(); -+ let flags = (*flagp as u32) & mask; -+ ldmxcsr((mxcsr & !mask) | flags); -+ 0 - } - - /// See . - // #[unsafe(no_mangle)] - pub unsafe extern "C" fn fesetround(round: c_int) -> c_int { -- unimplemented!(); -+ let rm = round & 0xC00; -+ if rm != FE_TONEAREST && rm != FE_DOWNWARD && rm != FE_UPWARD && rm != FE_TOWARDZERO { -+ return 1; -+ } -+ // Set rounding mode in MXCSR (bits 13-14) -+ let mxcsr = stmxcsr(); -+ ldmxcsr((mxcsr & !0xC00u32) | rm as u32); -+ // Set rounding mode in x87 CW (bits 10-11) -+ let cw = fnstcw(); -+ fldcw((cw & !0x0C00) | rm as u16); -+ 0 - } - - /// See . - // #[unsafe(no_mangle)] - pub unsafe extern "C" fn fetestexcept(excepts: c_int) -> c_int { -- unimplemented!(); -+ let mxcsr = stmxcsr(); -+ (mxcsr & FE_ALL_EXCEPT as u32 & excepts as u32) as c_int - } - - /// See . - // #[unsafe(no_mangle)] - pub unsafe extern "C" fn feupdateenv(envp: *const fenv_t) -> c_int { -- unimplemented!(); -+ let mxcsr = stmxcsr(); -+ let excepts = (mxcsr & FE_ALL_EXCEPT as u32) as c_int; -+ if fesetenv(envp) != 0 { -+ return 1; -+ } -+ feraiseexcept(excepts); -+ 0 - } diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-getentropy.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-getentropy.patch deleted file mode 100644 index 720da57b8c..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-getentropy.patch +++ /dev/null @@ -1,45 +0,0 @@ -diff --git a/src/header/unistd/mod.rs b/src/header/unistd/mod.rs ---- a/src/header/unistd/mod.rs -+++ b/src/header/unistd/mod.rs -@@ -537,8 +537,39 @@ - - /// See . - // #[unsafe(no_mangle)] --pub extern "C" fn getentropy(buffer: *mut c_void, length: size_t) -> c_int { -- unimplemented!(); -+pub unsafe extern "C" fn getentropy(buffer: *mut c_void, length: size_t) -> c_int { -+ // POSIX limits getentropy to 256 bytes per call -+ const GETENTROPY_MAX: size_t = 256; -+ -+ if length > GETENTROPY_MAX { -+ ERRNO.set(EINVAL); -+ return -1; -+ } -+ -+ let path = unsafe { CStr::from_ptr(c"/scheme/rand".as_ptr().cast()) }; -+ let fd = match Sys::open(path, fcntl::O_RDONLY, 0) { -+ Ok(fd) => fd, -+ Err(Errno(e)) => { -+ ERRNO.set(e); -+ return -1; -+ } -+ }; -+ -+ let buf = unsafe { slice::from_raw_parts_mut(buffer.cast::(), length) }; -+ let mut filled = 0usize; -+ while filled < length { -+ match Sys::read(fd, &mut buf[filled..]) { -+ Ok(0) => break, -+ Ok(n) => filled += n, -+ Err(Errno(e)) => { -+ let _ = Sys::close(fd); -+ ERRNO.set(e); -+ return -1; -+ } -+ } -+ } -+ let _ = Sys::close(fd); -+ if filled < length { ERRNO.set(errno::EIO); -1 } else { 0 } - } - - /// See . diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-getrlimit-getdtablesize.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-getrlimit-getdtablesize.patch deleted file mode 100644 index 10a2e86dc8..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-getrlimit-getdtablesize.patch +++ /dev/null @@ -1,66 +0,0 @@ -diff --git a/src/platform/redox/mod.rs b/src/platform/redox/mod.rs -index 752339a..30668f9 100644 ---- a/src/platform/redox/mod.rs -+++ b/src/platform/redox/mod.rs -@@ -749,8 +749,16 @@ impl Pal for Sys { - Err(Errno(EPERM)) - } - -- fn getrusage(who: c_int, r_usage: Out) -> Result<()> { -- todo_skip!(0, "getrusage({}, {:p}): not implemented", who, r_usage); -+ fn getrusage(_who: c_int, mut r_usage: Out) -> Result<()> { -+ r_usage.write(rusage { -+ ru_utime: timeval { tv_sec: 0, tv_usec: 0 }, -+ ru_stime: timeval { tv_sec: 0, tv_usec: 0 }, -+ ru_maxrss: 0, ru_ixrss: 0, ru_idrss: 0, ru_isrss: 0, -+ ru_minflt: 0, ru_majflt: 0, ru_nswap: 0, -+ ru_inblock: 0, ru_oublock: 0, -+ ru_msgsnd: 0, ru_msgrcv: 0, ru_nsignals: 0, -+ ru_nvcsw: 0, ru_nivcsw: 0, -+ }); - Ok(()) - } - -@@ -913,23 +921,7 @@ impl Pal for Sys { - Ok(()) - } - -- unsafe fn msync(addr: *mut c_void, len: usize, flags: c_int) -> Result<()> { -- todo_skip!( -- 0, -- "msync({:p}, 0x{:x}, 0x{:x}): not implemented", -- addr, -- len, -- flags -- ); -- Err(Errno(ENOSYS)) -- /* TODO -- syscall::msync( -- addr as usize, -- round_up_to_page_size(len), -- flags -- )?; -- */ -- } -+ unsafe fn msync(_addr: *mut c_void, _len: usize, _flags: c_int) -> Result<()> { Ok(()) } - - unsafe fn munlock(addr: *const c_void, len: usize) -> Result<()> { - // Redox never swaps -@@ -953,16 +945,7 @@ impl Pal for Sys { - Ok(()) - } - -- unsafe fn madvise(addr: *mut c_void, len: usize, flags: c_int) -> Result<()> { -- todo_skip!( -- 0, -- "madvise({:p}, 0x{:x}, 0x{:x}): not implemented", -- addr, -- len, -- flags -- ); -- Err(Errno(ENOSYS)) -- } -+ unsafe fn madvise(_addr: *mut c_void, _len: usize, _flags: c_int) -> Result<()> { Ok(()) } - - unsafe fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> Result<()> { - let redox_rqtp = unsafe { redox_timespec::from(&*rqtp) }; diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-header-mod-spawn-threads.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-header-mod-spawn-threads.patch deleted file mode 100644 index ff8a0ceb92..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-header-mod-spawn-threads.patch +++ /dev/null @@ -1,44 +0,0 @@ -diff --git a/src/header/mod.rs b/src/header/mod.rs -index 4bdb6b1..9d1da43 100644 ---- a/src/header/mod.rs -+++ b/src/header/mod.rs -@@ -76,7 +76,7 @@ pub mod setjmp; - pub mod sgtty; - pub mod shadow; - pub mod signal; --// TODO: spawn.h -+pub mod spawn; - // TODO: stdalign.h (likely C implementation) - // stdarg.h implemented in C - // stdatomic.h implemented in C -@@ -93,20 +93,17 @@ pub mod sys_auxv; - pub mod sys_epoll; - pub mod sys_file; - pub mod sys_ioctl; --// TODO: sys/ipc.h - pub mod sys_mman; --// TODO: sys/msg.h - pub mod sys_ptrace; - pub mod sys_resource; - pub mod sys_select; --// TODO: sys/sem.h --// TODO: sys/shm.h - pub mod sys_socket; - pub mod sys_stat; - pub mod sys_statvfs; - #[allow(non_upper_case_globals)] - pub mod sys_syscall; - pub mod sys_time; -+pub mod sys_timerfd; - #[deprecated] - pub mod sys_timeb; - //pub mod sys_times; -@@ -128,7 +125,7 @@ pub mod tar; - // TODO: term.h (deprecated) - pub mod termios; - // TODO: tgmath.h (likely C implementation) --// TODO: threads.h -+pub mod threads; - pub mod time; - // TODO: uchar.h - // TODO: ucontext.h (deprecated) diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-ifaddrs-net_if.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-ifaddrs-net_if.patch deleted file mode 100644 index 9ebab4a12b..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-ifaddrs-net_if.patch +++ /dev/null @@ -1,249 +0,0 @@ -diff --git a/src/header/ifaddrs/mod.rs b/src/header/ifaddrs/mod.rs -index bddb69b..e77a69c 100644 ---- a/src/header/ifaddrs/mod.rs -+++ b/src/header/ifaddrs/mod.rs -@@ -3,7 +3,13 @@ - //! Non-POSIX, see . - - use crate::{ -- header::{errno, stdlib, sys_socket::sockaddr}, -+ header::{ -+ errno, -+ net_if::interface_entries, -+ netinet_in::{in_addr, sockaddr_in}, -+ stdlib, -+ sys_socket::{constants::AF_INET, sockaddr}, -+ }, - platform::{ - self, - types::{c_char, c_int, c_uint, c_void}, -@@ -27,6 +33,83 @@ pub struct ifaddrs { - ifa_data: *mut c_void, - } - -+fn ipv4_addr(bytes: [u8; 4]) -> sockaddr_in { -+ sockaddr_in { -+ sin_family: AF_INET as _, -+ sin_port: 0, -+ sin_addr: in_addr { -+ s_addr: u32::from_ne_bytes(bytes), -+ }, -+ sin_zero: [0; 8], -+ } -+} -+ -+fn align_up(offset: usize, align: usize) -> usize { -+ (offset + (align - 1)) & !(align - 1) -+} -+ -+unsafe fn make_ifaddrs_node(entry: &crate::header::net_if::InterfaceEntry) -> *mut ifaddrs { -+ let name_len = entry.name.to_bytes_with_nul().len(); -+ let addr_size = if entry.addr.is_some() { core::mem::size_of::() } else { 0 }; -+ let netmask_size = if entry.netmask.is_some() { core::mem::size_of::() } else { 0 }; -+ let addr_align = core::mem::align_of::(); -+ let mut total = core::mem::size_of::() + name_len; -+ if addr_size != 0 { -+ total = align_up(total, addr_align) + addr_size; -+ } -+ if netmask_size != 0 { -+ total = align_up(total, addr_align) + netmask_size; -+ } -+ let raw = unsafe { stdlib::malloc(total) } as *mut u8; -+ if raw.is_null() { -+ return core::ptr::null_mut(); -+ } -+ -+ unsafe { raw.write_bytes(0, total) }; -+ -+ let node = raw.cast::(); -+ let mut cursor = unsafe { raw.add(core::mem::size_of::()) }; -+ -+ let name_ptr = cursor.cast::(); -+ unsafe { core::ptr::copy_nonoverlapping(entry.name.as_ptr(), name_ptr, name_len) }; -+ cursor = unsafe { cursor.add(name_len) }; -+ -+ let addr_ptr = if let Some(addr) = entry.addr { -+ let aligned = align_up(cursor as usize, addr_align); -+ cursor = aligned as *mut u8; -+ let ptr = cursor.cast::(); -+ unsafe { ptr.write(ipv4_addr(addr)) }; -+ cursor = unsafe { cursor.add(core::mem::size_of::()) }; -+ ptr.cast::() -+ } else { -+ core::ptr::null_mut() -+ }; -+ -+ let netmask_ptr = if let Some(netmask) = entry.netmask { -+ let aligned = align_up(cursor as usize, addr_align); -+ cursor = aligned as *mut u8; -+ let ptr = cursor.cast::(); -+ unsafe { ptr.write(ipv4_addr(netmask)) }; -+ ptr.cast::() -+ } else { -+ core::ptr::null_mut() -+ }; -+ -+ unsafe { -+ node.write(ifaddrs { -+ ifa_next: core::ptr::null_mut(), -+ ifa_name: name_ptr, -+ ifa_flags: entry.flags, -+ ifa_addr: addr_ptr, -+ ifa_netmask: netmask_ptr, -+ ifa_ifu: ifaddrs_ifa_ifu { ifu_broadaddr: core::ptr::null_mut() }, -+ ifa_data: core::ptr::null_mut(), -+ }) -+ }; -+ -+ node -+} -+ - #[unsafe(no_mangle)] - pub unsafe extern "C" fn freeifaddrs(mut ifa: *mut ifaddrs) { - while !ifa.is_null() { -@@ -38,7 +121,31 @@ pub unsafe extern "C" fn freeifaddrs(mut ifa: *mut ifaddrs) { - - #[unsafe(no_mangle)] - pub unsafe extern "C" fn getifaddrs(ifap: *mut *mut ifaddrs) -> c_int { -- //TODO: implement getifaddrs -- platform::ERRNO.set(errno::ENOSYS); -- -1 -+ if ifap.is_null() { -+ platform::ERRNO.set(errno::EFAULT); -+ return -1; -+ } -+ -+ let entries = interface_entries(); -+ let mut head = core::ptr::null_mut(); -+ let mut prev: *mut ifaddrs = core::ptr::null_mut(); -+ -+ for entry in &entries { -+ let node = unsafe { make_ifaddrs_node(entry) }; -+ if node.is_null() { -+ unsafe { freeifaddrs(head) }; -+ platform::ERRNO.set(errno::ENOMEM); -+ return -1; -+ } -+ -+ if head.is_null() { -+ head = node; -+ } else { -+ unsafe { (*prev).ifa_next = node }; -+ } -+ prev = node; -+ } -+ -+ unsafe { *ifap = head }; -+ 0 - } -diff --git a/src/header/net_if/mod.rs b/src/header/net_if/mod.rs -index edbfede..9ae1b02 100644 ---- a/src/header/net_if/mod.rs -+++ b/src/header/net_if/mod.rs -@@ -4,6 +4,8 @@ - - use core::ptr::null; - -+extern crate alloc; -+ - use crate::{ - c_str::CStr, - platform::{ -@@ -21,15 +23,56 @@ pub struct if_nameindex { - if_name: *const c_char, - } - -+#[derive(Clone)] -+pub(crate) struct InterfaceEntry { -+ pub index: c_uint, -+ pub name: CStr<'static>, -+ pub flags: c_uint, -+ pub addr: Option<[u8; 4]>, -+ pub netmask: Option<[u8; 4]>, -+} -+ - /// See . - pub const IF_NAMESIZE: usize = 16; - --const IF_STUB_INTERFACE: *const c_char = (c"stub").as_ptr(); -+pub(crate) fn interface_entries() -> alloc::vec::Vec { -+ alloc::vec![ -+ InterfaceEntry { -+ index: 1, -+ name: c"loopback".into(), -+ flags: (IFF_UP | IFF_RUNNING | IFF_LOOPBACK) as c_uint, -+ addr: Some([127, 0, 0, 1]), -+ netmask: Some([255, 0, 0, 0]), -+ }, -+ InterfaceEntry { -+ index: 2, -+ name: c"eth0".into(), -+ flags: (IFF_UP | IFF_RUNNING | IFF_BROADCAST | IFF_MULTICAST) as c_uint, -+ addr: Some([192, 168, 1, 100]), -+ netmask: Some([255, 255, 255, 0]), -+ }, -+ InterfaceEntry { -+ index: 3, -+ name: c"wlan0".into(), -+ flags: (IFF_UP | IFF_BROADCAST | IFF_MULTICAST) as c_uint, -+ addr: None, -+ netmask: None, -+ }, -+ ] -+} - --const INTERFACES: &[if_nameindex] = &[ -+const INTERFACES: [if_nameindex; 4] = [ - if_nameindex { - if_index: 1, -- if_name: IF_STUB_INTERFACE, -+ if_name: (c"loopback").as_ptr(), -+ }, -+ if_nameindex { -+ if_index: 2, -+ if_name: (c"eth0").as_ptr(), -+ }, -+ if_nameindex { -+ if_index: 3, -+ if_name: (c"wlan0").as_ptr(), - }, - if_nameindex { - if_index: 0, -@@ -52,8 +95,21 @@ pub unsafe extern "C" fn if_freenameindex(s: *mut if_nameindex) {} - /// Currently only checks against inteface index 1. - #[unsafe(no_mangle)] - pub unsafe extern "C" fn if_indextoname(idx: c_uint, buf: *mut c_char) -> *const c_char { -- if idx == 1 { -- return IF_STUB_INTERFACE; -+ let entries = interface_entries(); -+ for entry in &entries { -+ if entry.index == idx { -+ if !buf.is_null() { -+ unsafe { -+ core::ptr::copy_nonoverlapping( -+ entry.name.as_ptr(), -+ buf, -+ entry.name.to_bytes_with_nul().len(), -+ ); -+ } -+ return buf; -+ } -+ return entry.name.as_ptr(); -+ } - } - ERRNO.set(ENXIO); - null::() -@@ -80,8 +136,11 @@ pub unsafe extern "C" fn if_nametoindex(name: *const c_char) -> c_uint { - return 0; - } - let name = unsafe { CStr::from_ptr(name).to_str().unwrap_or("") }; -- if name.eq("stub") { -- return 1; -+ let entries = interface_entries(); -+ for entry in &entries { -+ if entry.name.to_str().map(|entry_name| entry_name == name).unwrap_or(false) { -+ return entry.index; -+ } - } - 0 - } diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-in6-pktinfo.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-in6-pktinfo.patch deleted file mode 100644 index cc1ebe57e3..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-in6-pktinfo.patch +++ /dev/null @@ -1,62 +0,0 @@ -diff --git a/src/header/netinet_in/cbindgen.toml b/src/header/netinet_in/cbindgen.toml -index d88dc7f..24fe4bc 100644 ---- a/src/header/netinet_in/cbindgen.toml -+++ b/src/header/netinet_in/cbindgen.toml -@@ -113,6 +113,7 @@ include = [ - "ip_mreq_source", - "group_req", - "group_source_req", -+ "in6_pktinfo", - ] - - [export.rename] -diff --git a/src/header/netinet_in/mod.rs b/src/header/netinet_in/mod.rs -index 0e4ced5..9a2a913 100644 ---- a/src/header/netinet_in/mod.rs -+++ b/src/header/netinet_in/mod.rs -@@ -54,6 +54,34 @@ pub struct ipv6_mreq { - pub ipv6mr_interface: u32, - } - -+/// See . -+#[repr(C)] -+pub struct in6_pktinfo { -+ pub ipi6_addr: in6_addr, -+ pub ipi6_ifindex: u32, -+} -+ -+impl Clone for in6_pktinfo { -+ fn clone(&self) -> Self { -+ Self { -+ ipi6_addr: in6_addr { s6_addr: self.ipi6_addr.s6_addr }, -+ ipi6_ifindex: self.ipi6_ifindex, -+ } -+ } -+} -+ -+impl Default for in6_pktinfo { -+ fn default() -> Self { -+ Self { -+ ipi6_addr: in6_addr { s6_addr: [0; 16] }, -+ ipi6_ifindex: 0, -+ } -+ } -+} -+ -+#[unsafe(no_mangle)] -+pub extern "C" fn _cbindgen_export_in6_pktinfo(in6_pktinfo: in6_pktinfo) {} -+ - // Address String Lengths - /// See . - pub const INET_ADDRSTRLEN: c_int = 16; -@@ -106,6 +134,10 @@ pub const IPV6_DROP_MEMBERSHIP: c_int = 21; - pub const IPV6_LEAVE_GROUP: c_int = 21; - /// See . - pub const IPV6_V6ONLY: c_int = 26; -+/// Non-POSIX, see . -+pub const IPV6_PKTINFO: c_int = 50; -+/// Non-POSIX, see . -+pub const IPV6_RECVPKTINFO: c_int = 49; - /// Non-POSIX, see . - pub const IP_MULTICAST_IF: c_int = 32; - /// Non-POSIX, see . diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-inet6-pton-ntop.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-inet6-pton-ntop.patch deleted file mode 100644 index 14440eec59..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-inet6-pton-ntop.patch +++ /dev/null @@ -1,292 +0,0 @@ -diff --git a/src/header/arpa_inet/mod.rs b/src/header/arpa_inet/mod.rs -index e982353f..56806d4a 100644 ---- a/src/header/arpa_inet/mod.rs -+++ b/src/header/arpa_inet/mod.rs -@@ -2,6 +2,7 @@ - //! - //! See . - -+use alloc::{string::String, vec::Vec}; - use core::{ - ptr, slice, - str::{self, FromStr}, -@@ -13,8 +14,8 @@ use crate::{ - bits_arpainet::ntohl, - bits_socklen_t::socklen_t, - errno::{EAFNOSUPPORT, ENOSPC}, -- netinet_in::{INADDR_NONE, in_addr, in_addr_t}, -- sys_socket::constants::AF_INET, -+ netinet_in::{INADDR_NONE, INET6_ADDRSTRLEN, in6_addr, in_addr, in_addr_t}, -+ sys_socket::constants::{AF_INET, AF_INET6}, - }, - platform::{ - self, -@@ -181,34 +182,111 @@ pub unsafe extern "C" fn inet_ntop( - dst: *mut c_char, - size: socklen_t, - ) -> *const c_char { -- if af != AF_INET { -- platform::ERRNO.set(EAFNOSUPPORT); -- ptr::null() -- } else if size < 16 { -- platform::ERRNO.set(ENOSPC); -- ptr::null() -- } else { -- let s_addr = unsafe { -- slice::from_raw_parts( -- ptr::from_ref(&(*(src.cast::())).s_addr).cast::(), -- 4, -- ) -- }; -- let addr = format!("{}.{}.{}.{}\0", s_addr[0], s_addr[1], s_addr[2], s_addr[3]); -+ if af == AF_INET6 { -+ if size < INET6_ADDRSTRLEN as socklen_t { -+ platform::ERRNO.set(ENOSPC); -+ return ptr::null(); -+ } -+ let s6_addr = unsafe { &(*(src.cast::())).s6_addr }; -+ let output = inet_ntop6(s6_addr); -+ let bytes = output.as_bytes(); - unsafe { -- ptr::copy(addr.as_ptr().cast::(), dst, addr.len()); -+ ptr::copy(bytes.as_ptr().cast::(), dst, bytes.len()); -+ *dst.add(bytes.len()) = 0; - } - dst -+ } else if af == AF_INET { -+ if size < 16 { -+ platform::ERRNO.set(ENOSPC); -+ ptr::null() -+ } else { -+ let s_addr = unsafe { -+ slice::from_raw_parts( -+ ptr::from_ref(&(*(src.cast::())).s_addr).cast::(), -+ 4, -+ ) -+ }; -+ let addr = format!("{}.{}.{}.{}\0", s_addr[0], s_addr[1], s_addr[2], s_addr[3]); -+ unsafe { -+ ptr::copy(addr.as_ptr().cast::(), dst, addr.len()); -+ } -+ dst -+ } -+ } else { -+ platform::ERRNO.set(EAFNOSUPPORT); -+ ptr::null() -+ } -+} -+ -+fn inet_ntop6(addr: &[u8; 16]) -> String { -+ let groups: [u16; 8] = core::array::from_fn(|i| { -+ u16::from_be_bytes([addr[i * 2], addr[i * 2 + 1]]) -+ }); -+ -+ let mut best_start = 8usize; -+ let mut best_len = 1usize; -+ let mut cur_start = 8usize; -+ let mut cur_len = 0usize; -+ -+ for i in 0..8 { -+ if groups[i] == 0 { -+ if cur_len == 0 { -+ cur_start = i; -+ } -+ cur_len += 1; -+ } else { -+ if cur_len > best_len { -+ best_start = cur_start; -+ best_len = cur_len; -+ } -+ cur_len = 0; -+ } -+ } -+ if cur_len > best_len { -+ best_start = cur_start; -+ best_len = cur_len; -+ } -+ -+ let mut parts = Vec::new(); -+ let mut i = 0usize; -+ while i < 8 { -+ if i == best_start && best_len > 1 { -+ if i == 0 { -+ parts.push(String::new()); -+ } -+ if i + best_len == 8 { -+ parts.push(String::new()); -+ } -+ i += best_len; -+ } else { -+ parts.push(format!("{:x}", groups[i])); -+ i += 1; -+ } -+ } -+ -+ if best_len == 8 { -+ return String::from("::"); - } -+ -+ parts.join(":") - } - - /// See . - #[unsafe(no_mangle)] - pub unsafe extern "C" fn inet_pton(af: c_int, src: *const c_char, dst: *mut c_void) -> c_int { -- if af != AF_INET { -- platform::ERRNO.set(EAFNOSUPPORT); -- -1 -- } else { -+ if af == AF_INET6 { -+ let src_cstr = unsafe { CStr::from_ptr(src) }; -+ let src_str = match src_cstr.to_str() { -+ Ok(s) => s, -+ Err(_) => return 0, -+ }; -+ let out = unsafe { &mut *(dst.cast::()) }; -+ if inet_pton6(src_str, &mut out.s6_addr) { -+ 1 -+ } else { -+ 0 -+ } -+ } else if af == AF_INET { - let s_addr = unsafe { - slice::from_raw_parts_mut( - ptr::from_mut(&mut (*dst.cast::()).s_addr).cast::(), -@@ -233,5 +311,137 @@ pub unsafe extern "C" fn inet_pton(af: c_int, src: *const c_char, dst: *mut c_vo - } else { - 0 - } -+ } else { -+ platform::ERRNO.set(EAFNOSUPPORT); -+ -1 -+ } -+} -+ -+fn inet_pton6(src: &str, dst: &mut [u8; 16]) -> bool { -+ dst.fill(0); -+ -+ let double_colon_pos = src.find("::"); -+ let second_double = if let Some(pos) = double_colon_pos { -+ src[pos + 2..].find("::").map(|p| p + pos + 2) -+ } else { -+ None -+ }; -+ if second_double.is_some() { -+ return false; -+ } -+ -+ let (left_str, right_str) = match double_colon_pos { -+ Some(pos) => (&src[..pos], &src[pos + 2..]), -+ None => (src, ""), -+ }; -+ -+ let left_groups: Vec<&str> = if left_str.is_empty() { -+ Vec::new() -+ } else { -+ left_str.split(':').collect() -+ }; -+ let right_groups: Vec<&str> = if right_str.is_empty() { -+ Vec::new() -+ } else { -+ right_str.split(':').collect() -+ }; -+ -+ let right_has_ipv4 = right_groups.last().is_some_and(|g| g.contains('.')); -+ let mut left_count = left_groups.len(); -+ let mut right_count = right_groups.len(); -+ if right_has_ipv4 { -+ right_count -= 1; -+ left_count += 1; -+ } -+ -+ let gap = 8 - left_count - right_count; -+ if double_colon_pos.is_none() && gap != 0 { -+ return false; -+ } -+ if double_colon_pos.is_some() && gap < 0 { -+ return false; -+ } -+ if double_colon_pos.is_none() && left_groups.len() + right_groups.len() != 8 { -+ return false; -+ } -+ -+ let mut idx = 0usize; -+ -+ for group in &left_groups { -+ if idx >= 16 { -+ return false; -+ } -+ let val = match parse_hex_group(group) { -+ Some(v) => v, -+ None => return false, -+ }; -+ dst[idx] = (val >> 8) as u8; -+ dst[idx + 1] = val as u8; -+ idx += 2; -+ } -+ -+ if double_colon_pos.is_some() { -+ for _ in 0..gap { -+ if idx >= 16 { -+ return false; -+ } -+ dst[idx] = 0; -+ dst[idx + 1] = 0; -+ idx += 2; -+ } -+ } -+ -+ let right_hex_count = if right_has_ipv4 { -+ right_groups.len().saturating_sub(1) -+ } else { -+ right_groups.len() -+ }; -+ -+ for group in &right_groups[..right_hex_count] { -+ if idx >= 16 { -+ return false; -+ } -+ let val = match parse_hex_group(group) { -+ Some(v) => v, -+ None => return false, -+ }; -+ dst[idx] = (val >> 8) as u8; -+ dst[idx + 1] = val as u8; -+ idx += 2; -+ } -+ -+ if right_has_ipv4 { -+ if idx != 12 { -+ return false; -+ } -+ let ipv4_str = right_groups[right_groups.len() - 1]; -+ let parts: Vec<&str> = ipv4_str.split('.').collect(); -+ if parts.len() != 4 { -+ return false; -+ } -+ for (i, part) in parts.iter().enumerate() { -+ match u8::from_str(part) { -+ Ok(v) => dst[12 + i] = v, -+ Err(_) => return false, -+ } -+ } -+ idx += 4; -+ } -+ -+ idx == 16 -+} -+ -+fn parse_hex_group(s: &str) -> Option { -+ if s.is_empty() || s.len() > 4 { -+ return None; -+ } -+ let mut val: u16 = 0; -+ for c in s.chars() { -+ val = val.checked_mul(16)?; -+ match c.to_digit(16) { -+ Some(d) => val = val.checked_add(d as u16)?, -+ None => return None, -+ } - } -+ Some(val) - } diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-named-semaphores.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-named-semaphores.patch deleted file mode 100644 index 6346d06716..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-named-semaphores.patch +++ /dev/null @@ -1,182 +0,0 @@ ---- a/src/header/semaphore/mod.rs 2026-04-25 17:07:53.742796721 +0100 -+++ b/src/header/semaphore/mod.rs 2026-04-25 17:08:54.527084219 +0100 -@@ -2,12 +2,24 @@ - //! - //! See . - -+use core::mem::size_of; -+ - use crate::{ -+ c_str::CStr, - header::{ - bits_timespec::timespec, -+ errno::{EEXIST, EINVAL}, -+ fcntl::{O_CREAT, O_EXCL, O_RDWR}, -+ sys_mman::{ -+ mmap, munmap, shm_open, shm_unlink, MAP_SHARED, MAP_FAILED, PROT_READ, PROT_WRITE, -+ }, - time::{CLOCK_MONOTONIC, CLOCK_REALTIME}, -+ unistd::{close, ftruncate}, -+ }, -+ platform::{ -+ ERRNO, -+ types::{c_char, c_int, c_long, c_uint, clockid_t, c_void, mode_t, off_t, size_t}, - }, -- platform::types::{c_char, c_int, c_long, c_uint, clockid_t}, - }; - - /// See . -@@ -18,12 +30,17 @@ - pub size: [c_char; 4], - pub align: c_long, - } -+ -+/// Pointer value returned by `sem_open` on failure. -+/// cbindgen:ignore -+pub const SEM_FAILED: *mut sem_t = usize::MAX as *mut sem_t; -+ - pub type RlctSempahore = crate::sync::Semaphore; - - /// See . --// #[unsafe(no_mangle)] -+#[unsafe(no_mangle)] - pub unsafe extern "C" fn sem_close(sem: *mut sem_t) -> c_int { -- todo!("named semaphores") -+ unsafe { munmap(sem.cast::(), size_of::()) } - } - - /// See . -@@ -50,13 +67,105 @@ - } - - /// See . --// TODO: va_list --// #[unsafe(no_mangle)] -+#[unsafe(no_mangle)] - pub unsafe extern "C" fn sem_open( - name: *const c_char, -- oflag: c_int, /* (va_list) value: c_uint */ -+ oflag: c_int, -+ mut __valist: ... - ) -> *mut sem_t { -- todo!("named semaphores") -+ // Validate name: must start with '/', no embedded '/'. -+ if name.is_null() { -+ ERRNO.set(EINVAL); -+ return SEM_FAILED; -+ } -+ -+ let name_c = unsafe { CStr::from_ptr(name) }; -+ let name_bytes = name_c.to_bytes(); -+ if name_bytes.is_empty() || name_bytes[0] != b'/' { -+ ERRNO.set(EINVAL); -+ return SEM_FAILED; -+ } -+ if name_bytes[1..].iter().any(|&b| b == b'/') { -+ ERRNO.set(EINVAL); -+ return SEM_FAILED; -+ } -+ -+ let creat = oflag & O_CREAT == O_CREAT; -+ let excl = oflag & O_EXCL == O_EXCL; -+ -+ let (mode, value): (mode_t, c_uint) = if creat { -+ ( -+ unsafe { __valist.arg::() }, -+ unsafe { __valist.arg::() }, -+ ) -+ } else { -+ (0, 0) -+ }; -+ -+ // Open or create the shared memory backing. -+ let (fd, created) = if creat && excl { -+ // O_CREAT | O_EXCL: must create exclusively. -+ let fd = unsafe { shm_open(name, O_CREAT | O_EXCL | O_RDWR, mode) }; -+ if fd < 0 { -+ return SEM_FAILED; -+ } -+ (fd, true) -+ } else if creat { -+ // O_CREAT without O_EXCL: try exclusive first, fall back to open. -+ let fd = unsafe { shm_open(name, O_CREAT | O_EXCL | O_RDWR, mode) }; -+ if fd >= 0 { -+ (fd, true) -+ } else if ERRNO.get() == EEXIST { -+ let fd = unsafe { shm_open(name, O_RDWR, 0) }; -+ if fd < 0 { -+ return SEM_FAILED; -+ } -+ (fd, false) -+ } else { -+ return SEM_FAILED; -+ } -+ } else { -+ // No O_CREAT: open existing. -+ let fd = unsafe { shm_open(name, O_RDWR, 0) }; -+ if fd < 0 { -+ return SEM_FAILED; -+ } -+ (fd, false) -+ }; -+ -+ // Set size if we created the backing. -+ if created { -+ if unsafe { ftruncate(fd, size_of::() as off_t) } < 0 { -+ let _ = unsafe { close(fd) }; -+ return SEM_FAILED; -+ } -+ } -+ -+ // Map the shared memory. -+ let ptr = unsafe { -+ mmap( -+ core::ptr::null_mut(), -+ size_of::(), -+ PROT_READ | PROT_WRITE, -+ MAP_SHARED, -+ fd, -+ 0, -+ ) -+ }; -+ let _ = unsafe { close(fd) }; -+ -+ if ptr == MAP_FAILED { -+ return SEM_FAILED; -+ } -+ -+ let sem_ptr = ptr.cast::(); -+ -+ // Initialize the semaphore value if we created the backing. -+ if created { -+ unsafe { sem_ptr.cast::().write(RlctSempahore::new(value)) }; -+ } -+ -+ sem_ptr - } - - /// See . -@@ -76,10 +185,10 @@ - } - - /// See . --// #[unsafe(no_mangle)] -+#[unsafe(no_mangle)] - pub unsafe extern "C" fn sem_unlink(name: *const c_char) -> c_int { -- todo!("named semaphores") -+ unsafe { shm_unlink(name) } - } - - /// See . ---- a/src/header/semaphore/cbindgen.toml 2026-04-25 17:07:53.743979154 +0100 -+++ b/src/header/semaphore/cbindgen.toml 2026-04-25 17:09:18.310792692 +0100 -@@ -3,6 +3,9 @@ - after_includes = """ - #include // for timespec - """ -+trailer = """ -+#define SEM_FAILED ((sem_t *) -1) -+""" - language = "C" - style = "Type" - no_includes = true diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-netdb-lookup-retry-fix.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-netdb-lookup-retry-fix.patch deleted file mode 100644 index 6216d10378..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-netdb-lookup-retry-fix.patch +++ /dev/null @@ -1,91 +0,0 @@ -diff --git a/src/header/netdb/lookup.rs b/src/header/netdb/lookup.rs -index 0734eec6..ccb00b65 100644 ---- a/src/header/netdb/lookup.rs -+++ b/src/header/netdb/lookup.rs -@@ -17,10 +17,11 @@ use crate::header::{ - netinet_in::{IPPROTO_UDP, in_addr, sockaddr_in}, - sys_socket::{ - self, -- constants::{AF_INET, SOCK_DGRAM}, -+ constants::{AF_INET, SOCK_DGRAM, SOL_SOCKET, SO_RCVTIMEO}, - sockaddr, - }, - time, -+ sys_select::timeval, - }; - - use super::{ -@@ -89,11 +90,34 @@ pub fn lookup_host(host: &str) -> Result { - drop(Box::from_raw(packet_data_ptr)); - } - -- let i = 0 as socklen_t; - let mut buf = vec![0u8; 65536]; - let buf_ptr = buf.as_mut_ptr().cast::(); - -- let count = unsafe { sys_socket::recv(sock, buf_ptr, 65536, 0) }; -+ // Set 5s recv timeout (best-effort; if this fails, recv may block longer). -+ let tv = timeval { -+ tv_sec: 5, -+ tv_usec: 0, -+ }; -+ unsafe { -+ sys_socket::setsockopt( -+ sock, -+ SOL_SOCKET, -+ SO_RCVTIMEO, -+ &tv as *const timeval as *const c_void, -+ core::mem::size_of::() as socklen_t, -+ ); -+ } -+ -+ let mut count: isize = -1; -+ for _attempt in 0..2 { -+ count = unsafe { sys_socket::recv(sock, buf_ptr, 65536, 0) }; -+ if count >= 0 { -+ break; -+ } -+ if unsafe { sys_socket::send(sock, packet_data_ptr, packet_data_len, 0) } < 0 { -+ break; -+ } -+ } - if count < 0 { - return Err(EIO); - } -@@ -193,11 +217,34 @@ pub fn lookup_addr(addr: in_addr) -> Result>, c_int> { - drop(Box::from_raw(packet_data_ptr)); - } - -- let i = mem::size_of::() as socklen_t; - let mut buf = [0u8; 65536]; - let buf_ptr = buf.as_mut_ptr().cast::(); - -- let count = unsafe { sys_socket::recv(sock, buf_ptr, 65536, 0) }; -+ // Set 5s recv timeout (best-effort; if this fails, recv may block longer). -+ let tv = timeval { -+ tv_sec: 5, -+ tv_usec: 0, -+ }; -+ unsafe { -+ sys_socket::setsockopt( -+ sock, -+ SOL_SOCKET, -+ SO_RCVTIMEO, -+ &tv as *const timeval as *const c_void, -+ core::mem::size_of::() as socklen_t, -+ ); -+ } -+ -+ let mut count: isize = -1; -+ for _attempt in 0..2 { -+ count = unsafe { sys_socket::recv(sock, buf_ptr, 65536, 0) }; -+ if count >= 0 { -+ break; -+ } -+ if unsafe { sys_socket::send(sock, packet_data_ptr, packet_data_len, 0) } < 0 { -+ break; -+ } -+ } - if count < 0 { - return Err(EIO); - } diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-pthread-nulstr-sched-stdint.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-pthread-nulstr-sched-stdint.patch deleted file mode 100644 index 459cda8922..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-pthread-nulstr-sched-stdint.patch +++ /dev/null @@ -1,359 +0,0 @@ -diff --git a/src/header/pthread/mod.rs b/src/header/pthread/mod.rs -index c742a42..03c4043 100644 ---- a/src/header/pthread/mod.rs -+++ b/src/header/pthread/mod.rs -@@ -3,15 +3,26 @@ - //! See . - - use alloc::collections::LinkedList; --use core::{cell::Cell, ptr::NonNull}; -+use core::{cell::Cell, mem::size_of, ptr::NonNull}; -+ -+#[cfg(target_os = "redox")] -+use redox_rt::proc::FdGuard; -+#[cfg(target_os = "linux")] -+use sc::syscall; -+#[cfg(target_os = "redox")] -+use syscall; - - use crate::{ - error::Errno, -- header::{bits_timespec::timespec, sched::*}, -+ header::{ -+ bits_timespec::timespec, -+ errno::{EINVAL, ERANGE}, -+ sched::*, -+ }, - platform::{ - Pal, Sys, - types::{ -- c_int, c_uchar, c_uint, c_void, clockid_t, pthread_attr_t, pthread_barrier_t, -+ c_char, c_int, c_uchar, c_uint, c_void, clockid_t, pthread_attr_t, pthread_barrier_t, - pthread_barrierattr_t, pthread_cond_t, pthread_condattr_t, pthread_key_t, - pthread_mutex_t, pthread_mutexattr_t, pthread_once_t, pthread_rwlock_t, - pthread_rwlockattr_t, pthread_spinlock_t, pthread_t, size_t, -@@ -20,6 +31,9 @@ use crate::{ - pthread, - }; - -+#[cfg(target_os = "linux")] -+use crate::platform::sys::e_raw; -+ - pub fn e(result: Result<(), Errno>) -> i32 { - match result { - Ok(()) => 0, -@@ -27,6 +41,96 @@ pub fn e(result: Result<(), Errno>) -> i32 { - } - } - -+const RLCT_AFFINITY_BYTES: usize = size_of::(); -+const RLCT_MAX_AFFINITY_CPUS: usize = u64::BITS as usize; -+ -+fn cpuset_bytes<'a>(cpusetsize: size_t, cpuset: *const cpu_set_t) -> Result<&'a [u8], Errno> { -+ if cpuset.is_null() || !(RLCT_AFFINITY_BYTES..=size_of::()).contains(&cpusetsize) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(unsafe { core::slice::from_raw_parts(cpuset.cast::(), cpusetsize) }) -+} -+ -+fn cpuset_bytes_mut<'a>(cpusetsize: size_t, cpuset: *mut cpu_set_t) -> Result<&'a mut [u8], Errno> { -+ if cpuset.is_null() || !(RLCT_AFFINITY_BYTES..=size_of::()).contains(&cpusetsize) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(unsafe { core::slice::from_raw_parts_mut(cpuset.cast::(), cpusetsize) }) -+} -+ -+fn cpuset_to_u64(cpusetsize: size_t, cpuset: *const cpu_set_t) -> Result { -+ let bytes = cpuset_bytes(cpusetsize, cpuset)?; -+ let mut mask = 0_u64; -+ -+ for (byte_index, byte) in bytes.iter().copied().enumerate() { -+ for bit in 0..u8::BITS as usize { -+ if byte & (1 << bit) == 0 { -+ continue; -+ } -+ -+ let cpu = byte_index * u8::BITS as usize + bit; -+ if cpu >= RLCT_MAX_AFFINITY_CPUS { -+ return Err(Errno(EINVAL)); -+ } -+ -+ mask |= 1_u64 << cpu; -+ } -+ } -+ -+ Ok(mask) -+} -+ -+fn copy_u64_to_cpuset(mask: u64, cpusetsize: size_t, cpuset: *mut cpu_set_t) -> Result<(), Errno> { -+ let bytes = cpuset_bytes_mut(cpusetsize, cpuset)?; -+ bytes.fill(0); -+ -+ for (byte_index, dst) in bytes.iter_mut().take(RLCT_AFFINITY_BYTES).enumerate() { -+ *dst = (mask >> (byte_index * u8::BITS as usize)) as u8; -+ } -+ -+ Ok(()) -+} -+ -+#[cfg(target_os = "redox")] -+fn redox_set_thread_affinity(thread: &pthread::Pthread, mask: u64) -> Result<(), Errno> { -+ let mut kernel_cpuset = cpu_set_t::default(); -+ kernel_cpuset.__bits[0] = mask; -+ -+ let handle = FdGuard::new(unsafe { -+ syscall::dup(thread.os_tid.get().read().thread_fd, b"sched-affinity")? -+ }); -+ let _ = handle.write(unsafe { -+ core::slice::from_raw_parts( -+ core::ptr::from_ref(&kernel_cpuset).cast::(), -+ size_of::(), -+ ) -+ })?; -+ -+ Ok(()) -+} -+ -+#[cfg(target_os = "redox")] -+fn redox_get_thread_affinity(thread: &pthread::Pthread) -> Result { -+ let handle = FdGuard::new(unsafe { -+ syscall::dup(thread.os_tid.get().read().thread_fd, b"sched-affinity")? -+ }); -+ let mut kernel_cpuset = cpu_set_t::default(); -+ let _ = handle.read(unsafe { -+ core::slice::from_raw_parts_mut( -+ core::ptr::from_mut(&mut kernel_cpuset).cast::(), -+ size_of::(), -+ ) -+ })?; -+ -+ if kernel_cpuset.__bits[1..].iter().any(|bits| *bits != 0) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(kernel_cpuset.__bits[0]) -+} -+ - #[derive(Clone)] - pub(crate) struct RlctAttr { - pub detachstate: c_uchar, -@@ -186,6 +290,43 @@ pub unsafe extern "C" fn pthread_getcpuclockid( - } - } - -+/// GNU extension. See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_getaffinity_np( -+ thread: pthread_t, -+ cpusetsize: size_t, -+ cpuset: *mut cpu_set_t, -+) -> c_int { -+ let thread: &pthread::Pthread = unsafe { &*thread.cast() }; -+ -+ let result = { -+ #[cfg(target_os = "redox")] -+ { -+ redox_get_thread_affinity(thread) -+ .and_then(|mask| copy_u64_to_cpuset(mask, cpusetsize, cpuset)) -+ } -+ -+ #[cfg(target_os = "linux")] -+ { -+ if cpuset.is_null() { -+ Err(Errno(EINVAL)) -+ } else { -+ e_raw(unsafe { -+ syscall!( -+ SCHED_GETAFFINITY, -+ thread.os_tid.get().read().thread_id, -+ cpusetsize, -+ cpuset.cast::() -+ ) -+ }) -+ .map(|_| ()) -+ } -+ } -+ }; -+ -+ e(result) -+} -+ - /// See . - #[unsafe(no_mangle)] - pub unsafe extern "C" fn pthread_getschedparam( -@@ -235,6 +376,43 @@ pub unsafe extern "C" fn pthread_self() -> pthread_t { - core::ptr::from_ref(unsafe { pthread::current_thread().unwrap_unchecked() }) as *mut _ - } - -+/// GNU extension. See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_setaffinity_np( -+ thread: pthread_t, -+ cpusetsize: size_t, -+ cpuset: *const cpu_set_t, -+) -> c_int { -+ let thread: &pthread::Pthread = unsafe { &*thread.cast() }; -+ -+ let result = { -+ #[cfg(target_os = "redox")] -+ { -+ cpuset_to_u64(cpusetsize, cpuset) -+ .and_then(|mask| redox_set_thread_affinity(thread, mask)) -+ } -+ -+ #[cfg(target_os = "linux")] -+ { -+ if cpuset.is_null() { -+ Err(Errno(EINVAL)) -+ } else { -+ e_raw(unsafe { -+ syscall!( -+ SCHED_SETAFFINITY, -+ thread.os_tid.get().read().thread_id, -+ cpusetsize, -+ cpuset.cast::() -+ ) -+ }) -+ .map(|_| ()) -+ } -+ } -+ }; -+ -+ e(result) -+} -+ - /// See . - #[unsafe(no_mangle)] - pub unsafe extern "C" fn pthread_setcancelstate(state: c_int, oldstate: *mut c_int) -> c_int { -@@ -307,6 +485,13 @@ pub unsafe extern "C" fn pthread_testcancel() { - unsafe { pthread::testcancel() }; - } - -+/// -+/// -+/// Non-standard GNU extension. Prefer `sched_yield()` instead. -+pub extern "C" fn pthread_yield() { -+ let _ = Sys::sched_yield(); -+} -+ - // Must be the same struct as defined in the pthread_cleanup_push macro. - #[repr(C)] - pub(crate) struct CleanupLinkedListEntry { -@@ -350,3 +535,84 @@ pub(crate) unsafe fn run_destructor_stack() { - (entry.routine)(entry.arg); - } - } -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_setname_np(thread: pthread_t, name: *const c_char) -> c_int { -+ if name.is_null() { -+ return EINVAL; -+ } -+ -+ let cstr = unsafe { core::ffi::CStr::from_ptr(name) }; -+ let name_bytes = cstr.to_bytes(); -+ let len = name_bytes.len().min(31); -+ -+ #[cfg(target_os = "redox")] -+ { -+ let thread = unsafe { &*thread.cast::() }; -+ let os_tid = unsafe { thread.os_tid.get().read() }; -+ let path = alloc::format!("proc:{}/name\0", os_tid.thread_fd); -+ let path_cstr = core::ffi::CStr::from_bytes_with_nul(path.as_bytes()).unwrap(); -+ let fd = match Sys::open(path_cstr.into(), crate::header::fcntl::O_WRONLY, 0) { -+ Ok(fd) => fd, -+ Err(Errno(code)) => return code, -+ }; -+ -+ let result = match Sys::write(fd, &name_bytes[..len]) { -+ Ok(written) if written == len => 0, -+ Ok(_) => crate::header::errno::EIO, -+ Err(Errno(code)) => code, -+ }; -+ let _ = Sys::close(fd); -+ result -+ } -+ #[cfg(not(target_os = "redox"))] -+ { -+ let _ = thread; -+ 0 -+ } -+} -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_getname_np( -+ thread: pthread_t, -+ name: *mut c_char, -+ len: size_t, -+) -> c_int { -+ if name.is_null() { -+ return EINVAL; -+ } -+ if len == 0 { -+ return ERANGE; -+ } -+ -+ #[cfg(target_os = "redox")] -+ { -+ let thread = unsafe { &*thread.cast::() }; -+ let os_tid = unsafe { thread.os_tid.get().read() }; -+ let path = alloc::format!("proc:{}/name\0", os_tid.thread_fd); -+ let path_cstr = core::ffi::CStr::from_bytes_with_nul(path.as_bytes()).unwrap(); -+ let fd = match Sys::open(path_cstr.into(), crate::header::fcntl::O_RDONLY, 0) { -+ Ok(fd) => fd, -+ Err(Errno(code)) => return code, -+ }; -+ -+ let mut buf = [0u8; 31]; -+ let result = match Sys::read(fd, &mut buf) { -+ Ok(read) if read < len => { -+ unsafe { core::ptr::copy_nonoverlapping(buf.as_ptr(), name.cast(), read) }; -+ unsafe { *name.add(read) = 0 }; -+ 0 -+ } -+ Ok(_) => ERANGE, -+ Err(Errno(code)) => code, -+ }; -+ let _ = Sys::close(fd); -+ result -+ } -+ #[cfg(not(target_os = "redox"))] -+ { -+ let _ = thread; -+ unsafe { *name = 0 }; -+ 0 -+ } -+} -diff --git a/src/header/sched/cbindgen.toml b/src/header/sched/cbindgen.toml -index b361fa4..d6d959d 100644 ---- a/src/header/sched/cbindgen.toml -+++ b/src/header/sched/cbindgen.toml -@@ -5,7 +5,7 @@ - # - "[SS|TSP] The header shall define the time_t type as described in ." - # - "The header shall define the timespec structure as described in ." - # - "Inclusion of the header may make visible all symbols from the header." --sys_includes = ["sys/types.h"] -+sys_includes = ["sys/types.h", "stdint.h"] - include_guard = "_RELIBC_SCHED_H" - after_includes = """ - #include // for timespec -@@ -20,3 +20,17 @@ prefix_with_name = true - - [export.rename] - "timespec" = "struct timespec" -+ -+[export] -+include = [ -+ "sched_param", -+ "cpu_set_t", -+ "sched_get_priority_max", -+ "sched_get_priority_min", -+ "sched_getparam", -+ "sched_getscheduler", -+ "sched_rr_get_interval", -+ "sched_setparam", -+ "sched_setscheduler", -+ "sched_yield", -+] diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-pthread-signal-races.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-pthread-signal-races.patch deleted file mode 100644 index 9d818bb427..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-pthread-signal-races.patch +++ /dev/null @@ -1,95 +0,0 @@ -diff --git a/src/header/signal/mod.rs b/src/header/signal/mod.rs ---- a/src/header/signal/mod.rs -+++ b/src/header/signal/mod.rs -@@ -2,7 +2,10 @@ - //! - //! See . - --use core::{mem, ptr}; -+use core::{ -+ mem, ptr, -+ sync::atomic::Ordering, -+}; - - use cbitset::BitSet; - -@@ -157,10 +160,17 @@ - /// See . - #[unsafe(no_mangle)] - pub unsafe extern "C" fn pthread_kill(thread: pthread_t, sig: c_int) -> c_int { -- let os_tid = { -- let pthread = unsafe { &*(thread as *const crate::pthread::Pthread) }; -- unsafe { pthread.os_tid.get().read() } -- }; -+ let pthread = unsafe { &*(thread as *const crate::pthread::Pthread) }; -+ let os_tid = unsafe { pthread.os_tid.get().read() }; -+ let flags = crate::pthread::PthreadFlags::from_bits_retain( -+ pthread.flags.load(Ordering::Acquire), -+ ); -+ if flags.contains( -+ crate::pthread::PthreadFlags::DETACHED | crate::pthread::PthreadFlags::FINISHED, -+ ) { -+ return errno::ESRCH; -+ } -+ - crate::header::pthread::e(unsafe { Sys::rlct_kill(os_tid, sig as usize) }) - } - -@@ -171,12 +181,10 @@ - set: *const sigset_t, - oldset: *mut sigset_t, - ) -> c_int { -- // On Linux and Redox, pthread_sigmask and sigprocmask are equivalent -- if unsafe { sigprocmask(how, set, oldset) } == 0 { -- 0 -- } else { -- //TODO: Fix race -- platform::ERRNO.get() -+ let result = unsafe { Sys::sigprocmask(how, set.as_ref(), oldset.as_mut()) }; -+ match result { -+ Ok(()) => 0, -+ Err(errno) => errno.0, - } - } - -diff --git a/src/pthread/mod.rs b/src/pthread/mod.rs ---- a/src/pthread/mod.rs -+++ b/src/pthread/mod.rs -@@ -31,6 +31,7 @@ - stack_size: 0, - - os_tid: UnsafeCell::new(Sys::current_os_tid()), -+ robust_list_head: UnsafeCell::new(ptr::null_mut()), - }; - - #[cfg(target_os = "redox")] -@@ -60,6 +61,7 @@ - bitflags::bitflags! { - pub struct PthreadFlags: usize { - const DETACHED = 1; -+ const FINISHED = 1 << 1; - } - } - -@@ -306,7 +308,9 @@ - - unsafe { crate::sync::pthread_mutex::mark_robust_mutexes_dead(this) }; - -- if this.flags.load(Ordering::Acquire) & PthreadFlags::DETACHED.bits() != 0 { -+ let flags = this.flags.fetch_or(PthreadFlags::FINISHED.bits(), Ordering::AcqRel); -+ -+ if flags & PthreadFlags::DETACHED.bits() != 0 { - unsafe { dealloc_thread(this) }; - } else { - unsafe { this.waitval.post(retval) }; -diff --git a/src/ld_so/tcb.rs b/src/ld_so/tcb.rs ---- a/src/ld_so/tcb.rs -+++ b/src/ld_so/tcb.rs -@@ -107,6 +107,7 @@ - stack_base: core::ptr::null_mut(), - stack_size: 0, - os_tid: UnsafeCell::new(OsTid::default()), -+ robust_list_head: UnsafeCell::new(ptr::null_mut()), - }, - - dtv_ptr: ptr::null_mut(), diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-pthread-yield.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-pthread-yield.patch deleted file mode 100644 index e2386de806..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-pthread-yield.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/src/header/pthread/mod.rs b/src/header/pthread/mod.rs -index c742a425..a6721cad 100644 ---- a/src/header/pthread/mod.rs -+++ b/src/header/pthread/mod.rs -@@ -307,6 +307,13 @@ pub unsafe extern "C" fn pthread_testcancel() { - unsafe { pthread::testcancel() }; - } - -+/// -+/// -+/// Non-standard GNU extension. Prefer `sched_yield()` instead. -+pub extern "C" fn pthread_yield() { -+ let _ = Sys::sched_yield(); -+} -+ - // Must be the same struct as defined in the pthread_cleanup_push macro. - #[repr(C)] - pub(crate) struct CleanupLinkedListEntry { diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-sched.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-sched.patch deleted file mode 100644 index 6549316860..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-sched.patch +++ /dev/null @@ -1,124 +0,0 @@ -diff --git a/src/header/sched/mod.rs b/src/header/sched/mod.rs ---- a/src/header/sched/mod.rs -+++ b/src/header/sched/mod.rs -@@ -2,11 +2,11 @@ - //! - //! See . - - use crate::{ - error::ResultExt, -- header::bits_timespec::timespec, -+ header::{bits_timespec::timespec, errno}, - platform::{ -- Pal, Sys, -+ self, Pal, Sys, - types::{c_int, pid_t}, - }, - }; -@@ -29,43 +31,100 @@ - pub const SCHED_OTHER: c_int = 2; - - /// See . - // #[unsafe(no_mangle)] - pub extern "C" fn sched_get_priority_max(policy: c_int) -> c_int { -- todo!() -+ match policy { -+ SCHED_FIFO | SCHED_RR => 99, -+ SCHED_OTHER => 0, -+ _ => { -+ platform::ERRNO.set(errno::EINVAL); -+ -1 -+ } -+ } - } - - /// See . - // #[unsafe(no_mangle)] - pub extern "C" fn sched_get_priority_min(policy: c_int) -> c_int { -- todo!() -+ match policy { -+ SCHED_FIFO | SCHED_RR => 0, -+ SCHED_OTHER => 0, -+ _ => { -+ platform::ERRNO.set(errno::EINVAL); -+ -1 -+ } -+ } - } - - /// See . - // #[unsafe(no_mangle)] - pub unsafe extern "C" fn sched_getparam(pid: pid_t, param: *mut sched_param) -> c_int { -- todo!() -+ if param.is_null() { -+ platform::ERRNO.set(errno::EINVAL); -+ return -1; -+ } -+ // Redox has no real-time scheduler; return default params -+ (*param).sched_priority = 0; -+ 0 - } - - /// See . - // #[unsafe(no_mangle)] - pub extern "C" fn sched_rr_get_interval(pid: pid_t, time: *const timespec) -> c_int { -- todo!() -+ if time.is_null() { -+ platform::ERRNO.set(errno::EINVAL); -+ return -1; -+ } -+ // Redox has no real-time scheduler; report a nominal 1-second round-robin interval -+ unsafe { -+ (*(time as *mut timespec)).tv_sec = 1; -+ (*(time as *mut timespec)).tv_nsec = 0; -+ } -+ 0 - } - - /// See . - // #[unsafe(no_mangle)] - pub unsafe extern "C" fn sched_setparam(pid: pid_t, param: *const sched_param) -> c_int { -- todo!() -+ if param.is_null() { -+ platform::ERRNO.set(errno::EINVAL); -+ return -1; -+ } -+ let priority = (*param).sched_priority; -+ if priority < 0 || priority > 99 { -+ platform::ERRNO.set(errno::EINVAL); -+ return -1; -+ } -+ // Redox has no real-time scheduler; validate and succeed as a no-op -+ 0 - } - - /// See . - // #[unsafe(no_mangle)] - pub extern "C" fn sched_setscheduler( - pid: pid_t, - policy: c_int, - param: *const sched_param, - ) -> c_int { -- todo!() -+ if param.is_null() { -+ platform::ERRNO.set(errno::EINVAL); -+ return -1; -+ } -+ match policy { -+ SCHED_FIFO | SCHED_RR | SCHED_OTHER => { -+ let priority = unsafe { (*param).sched_priority }; -+ if priority < 0 || priority > 99 { -+ platform::ERRNO.set(errno::EINVAL); -+ return -1; -+ } -+ // Redox has no real-time scheduler; validate and succeed as a no-op -+ 0 -+ } -+ _ => { -+ platform::ERRNO.set(errno::EINVAL); -+ -1 -+ } -+ } - } - - /// See . diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-secure-getenv.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-secure-getenv.patch deleted file mode 100644 index 5a11651241..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-secure-getenv.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/src/header/stdlib/mod.rs b/src/header/stdlib/mod.rs ---- a/src/header/stdlib/mod.rs -+++ b/src/header/stdlib/mod.rs -@@ -1233,7 +1233,11 @@ - /// See . - // #[unsafe(no_mangle)] - pub unsafe extern "C" fn secure_getenv(name: *const c_char) -> *mut c_char { -- unimplemented!(); -+ // Redox does not support setuid/setgid binaries, so there is no -+ // elevated-privilege case to guard against. Always delegate to getenv. -+ // If setuid support is ever added, this must check real vs effective -+ // uid/gid and return NULL when they differ. -+ unsafe { getenv(name) } - } - - /// See . diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-select-not-epoll-timeout.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-select-not-epoll-timeout.patch deleted file mode 100644 index 98aa8fc624..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-select-not-epoll-timeout.patch +++ /dev/null @@ -1,43 +0,0 @@ -diff --git a/src/header/signal/cbindgen.toml b/src/header/signal/cbindgen.toml -index e2e7cd12..280b1dbc 100644 ---- a/src/header/signal/cbindgen.toml -+++ b/src/header/signal/cbindgen.toml -@@ -6,7 +6,7 @@ - # - "pid_t As described in ." - # - "The header shall define the pthread_attr_t type as described in ." - # - "Inclusion of the header may make visible all symbols from the header." --sys_includes = ["sys/types.h"] -+sys_includes = ["sys/types.h", "stdint.h"] - include_guard = "_RELIBC_SIGNAL_H" - after_includes = """ - #include // for timespec from time.h -diff --git a/src/header/sys_select/mod.rs b/src/header/sys_select/mod.rs -index c70581db..245578b4 100644 ---- a/src/header/sys_select/mod.rs -+++ b/src/header/sys_select/mod.rs -@@ -130,8 +130,23 @@ pub fn select_epoll( - - let mut events: [epoll_event; 32] = unsafe { mem::zeroed() }; - let epoll_timeout = if not_epoll > 0 { -- // Do not wait if any non-epoll file descriptors were found -- 0 -+ // Non-epoll FDs (e.g. TTY on Redox) cannot be monitored by epoll. -+ // Poll with a 100ms interval instead of returning immediately (timeout=0), -+ // which would cause a busy-loop at 100% CPU for callers like mc. -+ match timeout { -+ Some(timeout) => { -+ let sec_ms = (timeout.tv_sec as c_int).checked_mul(1000); -+ let usec_ms = (timeout.tv_usec as c_int) / 1000; -+ match sec_ms.and_then(|s| s.checked_add(usec_ms)) { -+ Some(s) => { -+ let user_ms = s as c_int; -+ if user_ms > 100 { 100 } else { user_ms } -+ } -+ None => 100, -+ } -+ } -+ None => 100, -+ } - } else { - match timeout { - Some(timeout) => { diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-semaphore-fixes.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-semaphore-fixes.patch deleted file mode 100644 index 572715624c..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-semaphore-fixes.patch +++ /dev/null @@ -1,435 +0,0 @@ -diff --git a/src/sync/semaphore.rs b/src/sync/semaphore.rs ---- a/src/sync/semaphore.rs -+++ b/src/sync/semaphore.rs -@@ -2,8 +2,10 @@ - //TODO: improve implementation - - use crate::{ -+ error::{Errno, Result}, - header::{ - bits_timespec::timespec, -+ errno::{EINVAL, ETIMEDOUT}, - time::{CLOCK_MONOTONIC, CLOCK_REALTIME, timespec_realtime_to_monotonic}, - }, - platform::types::{c_uint, clockid_t}, -@@ -30,12 +32,12 @@ - crate::sync::futex_wake(&self.count, i32::MAX); - } - -- pub fn try_wait(&self) -> u32 { -+ pub fn try_wait(&self) -> bool { - loop { - let value = self.count.load(Ordering::SeqCst); - - if value == 0 { -- return 0; -+ return false; - } - - match self.count.compare_exchange_weak( -@@ -45,20 +47,16 @@ - Ordering::SeqCst, - ) { - Ok(_) => { -- // Acquired -- return value; -+ return true; - } - Err(_) => (), - } -- // Try again (as long as value > 0) - } - } - -- pub fn wait(&self, timeout_opt: Option<×pec>, clock_id: clockid_t) -> Result<(), ()> { -+ pub fn wait(&self, timeout_opt: Option<×pec>, clock_id: clockid_t) -> Result<()> { - loop { -- let value = self.try_wait(); -- -- if value == 0 { -+ if self.try_wait() { - return Ok(()); - } - -@@ -68,17 +66,20 @@ - CLOCK_MONOTONIC => timeout.clone(), - CLOCK_REALTIME => match timespec_realtime_to_monotonic(timeout.clone()) { - Ok(relative) => relative, -- Err(_) => return Err(()), -+ Err(_) => return Err(Errno(EINVAL)), - }, -- _ => return Err(()), -+ _ => return Err(Errno(EINVAL)), - }; -- crate::sync::futex_wait(&self.count, value, Some(&relative)); -+ match crate::sync::futex_wait(&self.count, 0, Some(&relative)) { -+ crate::sync::FutexWaitResult::TimedOut => return Err(Errno(ETIMEDOUT)), -+ crate::sync::FutexWaitResult::Waited | crate::sync::FutexWaitResult::Stale => {} -+ } - } else { -- // Use futex to wait for the next change, without a timeout -- crate::sync::futex_wait(&self.count, value, None); -+ crate::sync::futex_wait(&self.count, 0, None); - } - } - } -+ - pub fn value(&self) -> c_uint { - self.count.load(Ordering::SeqCst) - } -diff --git a/src/header/semaphore/mod.rs b/src/header/semaphore/mod.rs ---- a/src/header/semaphore/mod.rs -+++ b/src/header/semaphore/mod.rs -@@ -3,12 +3,20 @@ - //! See . - - use crate::{ -+ error::{Errno, ResultExt}, - header::{ - bits_timespec::timespec, -+ errno::{EAGAIN, EINVAL}, -+ fcntl::{O_CREAT, O_EXCL, O_RDWR}, -+ sys_mman::{MAP_FAILED, MAP_SHARED, PROT_READ, PROT_WRITE, mmap, munmap, shm_open, shm_unlink}, -+ sys_stat::stat, - time::{CLOCK_MONOTONIC, CLOCK_REALTIME}, -+ unistd::close, - }, -- platform::types::{c_char, c_int, c_long, c_uint, clockid_t}, -+ out::Out, -+ platform::{ERRNO, Pal, Sys, types::{c_char, c_int, c_long, c_uint, clockid_t, mode_t, c_void}}, - }; -+use core::{mem, ptr}; - - /// See . - // TODO: Statically verify size and align -@@ -20,10 +28,90 @@ - } - pub type RlctSempahore = crate::sync::Semaphore; - -+#[repr(C)] -+struct NamedSemaphore { -+ sem: RlctSempahore, -+} -+ -+const SEM_FAILED_PTR: *mut sem_t = usize::MAX as *mut sem_t; -+ -+unsafe fn map_named_semaphore( -+ name: *const c_char, -+ oflag: c_int, -+ mode: mode_t, -+ value: c_uint, -+) -> Result<*mut sem_t, Errno> { -+ if name.is_null() { -+ return Err(Errno(EINVAL)); -+ } -+ -+ let mut shm_flags = O_RDWR; -+ if oflag & O_CREAT == O_CREAT { -+ shm_flags |= O_CREAT; -+ } -+ if oflag & O_EXCL == O_EXCL { -+ shm_flags |= O_EXCL; -+ } -+ -+ let fd = unsafe { shm_open(name, shm_flags, mode) }; -+ if fd < 0 { -+ return Err(Errno(ERRNO.get())); -+ } -+ -+ let mut st = stat::default(); -+ if let Err(err) = Sys::fstat(fd, Out::from_mut(&mut st)) { -+ let _ = close(fd); -+ return Err(err); -+ } -+ -+ let size = mem::size_of::() as i64; -+ let created = st.st_size == 0; -+ if created { -+ if let Err(err) = Sys::ftruncate(fd, size) { -+ let _ = close(fd); -+ return Err(err); -+ } -+ } else if st.st_size < size { -+ let _ = close(fd); -+ return Err(Errno(EINVAL)); -+ } -+ -+ let mapped = unsafe { -+ mmap( -+ ptr::null_mut(), -+ size as usize, -+ PROT_READ | PROT_WRITE, -+ MAP_SHARED, -+ fd, -+ 0, -+ ) -+ }; -+ let _ = close(fd); -+ if mapped == MAP_FAILED { -+ return Err(Errno(ERRNO.get())); -+ } -+ -+ let named = mapped.cast::(); -+ if created { -+ unsafe { -+ named.write(NamedSemaphore { -+ sem: RlctSempahore::new(value), -+ }); -+ } -+ } -+ -+ Ok(named.cast()) -+} -+ - /// See . --// #[unsafe(no_mangle)] -+#[unsafe(no_mangle)] - pub unsafe extern "C" fn sem_close(sem: *mut sem_t) -> c_int { -- todo!("named semaphores") -+ if sem.is_null() || sem == SEM_FAILED_PTR { -+ ERRNO.set(EINVAL); -+ return -1; -+ } -+ -+ unsafe { munmap(sem.cast::(), mem::size_of::()) } - } - - /// See . -@@ -51,12 +139,25 @@ - - /// See . - // TODO: va_list --// #[unsafe(no_mangle)] -+#[unsafe(no_mangle)] - pub unsafe extern "C" fn sem_open( - name: *const c_char, -- oflag: c_int, /* (va_list) value: c_uint */ -+ oflag: c_int, -+ mut args: ..., - ) -> *mut sem_t { -- todo!("named semaphores") -+ let (mode, value) = if oflag & O_CREAT == O_CREAT { -+ (unsafe { args.arg::() }, unsafe { args.arg::() }) -+ } else { -+ (0o600 as mode_t, 0) -+ }; -+ -+ match unsafe { map_named_semaphore(name, oflag, mode, value) } { -+ Ok(sem) => sem, -+ Err(Errno(errno)) => { -+ ERRNO.set(errno); -+ SEM_FAILED_PTR -+ } -+ } - } - - /// See . -@@ -70,23 +171,27 @@ - /// See . - #[unsafe(no_mangle)] - pub unsafe extern "C" fn sem_trywait(sem: *mut sem_t) -> c_int { -- unsafe { get(sem) }.try_wait(); -- -- 0 -+ if unsafe { get(sem) }.try_wait() { -+ 0 -+ } else { -+ crate::platform::ERRNO.set(EAGAIN); -+ -1 -+ } - } - - /// See . --// #[unsafe(no_mangle)] -+#[unsafe(no_mangle)] - pub unsafe extern "C" fn sem_unlink(name: *const c_char) -> c_int { -- todo!("named semaphores") -+ unsafe { shm_unlink(name) } - } - - /// See . - #[unsafe(no_mangle)] - pub unsafe extern "C" fn sem_wait(sem: *mut sem_t) -> c_int { -- if let Ok(()) = unsafe { get(sem) }.wait(None, CLOCK_MONOTONIC) {}; // TODO handle error -- -- 0 -+ unsafe { get(sem) } -+ .wait(None, CLOCK_MONOTONIC) -+ .map(|()| 0) -+ .or_minus_one_errno() - } - - /// See . -@@ -96,18 +201,19 @@ - clock_id: clockid_t, - abstime: *const timespec, - ) -> c_int { -- if let Ok(()) = unsafe { get(sem) }.wait(Some(&unsafe { (*abstime).clone() }), clock_id) {}; // TODO handle error -- -- 0 -+ unsafe { get(sem) } -+ .wait(Some(&unsafe { (*abstime).clone() }), clock_id) -+ .map(|()| 0) -+ .or_minus_one_errno() - } - - /// See . - #[unsafe(no_mangle)] - pub unsafe extern "C" fn sem_timedwait(sem: *mut sem_t, abstime: *const timespec) -> c_int { -- if let Ok(()) = unsafe { get(sem) }.wait(Some(&unsafe { (*abstime).clone() }), CLOCK_REALTIME) { -- }; // TODO handle error -- -- 0 -+ unsafe { get(sem) } -+ .wait(Some(&unsafe { (*abstime).clone() }), CLOCK_REALTIME) -+ .map(|()| 0) -+ .or_minus_one_errno() - } - - unsafe fn get<'any>(sem: *mut sem_t) -> &'any RlctSempahore { -diff --git a/src/header/semaphore/cbindgen.toml b/src/header/semaphore/cbindgen.toml ---- a/src/header/semaphore/cbindgen.toml -+++ b/src/header/semaphore/cbindgen.toml -@@ -2,6 +2,9 @@ - include_guard = "_RELIBC_SEMAPHORE_H" - after_includes = """ - #include // for timespec -+""" -+trailer = """ -+#define SEM_FAILED ((sem_t *) -1) - """ - language = "C" - style = "Type" -diff --git a/tests/Makefile.tests.mk b/tests/Makefile.tests.mk ---- a/tests/Makefile.tests.mk -+++ b/tests/Makefile.tests.mk -@@ -312,6 +312,8 @@ - grp/getgrgid_r \ - grp/getgrnam_r \ - grp/gr_iter \ -+ semaphore/named \ -+ semaphore/unnamed \ - waitid \ - waitpid \ - waitpid_multiple \ -diff --git a/tests/semaphore/unnamed.c b/tests/semaphore/unnamed.c -new file mode 100644 ---- /dev/null -+++ b/tests/semaphore/unnamed.c -@@ -0,0 +1,57 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static sem_t sem; -+ -+static void *post_after_delay(void *arg) -+{ -+ (void)arg; -+ usleep(50000); -+ assert(sem_post(&sem) == 0); -+ return NULL; -+} -+ -+static long elapsed_ns(const struct timespec *start, const struct timespec *end) -+{ -+ return (end->tv_sec - start->tv_sec) * 1000000000L + (end->tv_nsec - start->tv_nsec); -+} -+ -+int main(void) -+{ -+ assert(sem_init(&sem, 0, 0) == 0); -+ -+ errno = 0; -+ assert(sem_trywait(&sem) == -1); -+ assert(errno == EAGAIN); -+ -+ struct timespec deadline; -+ assert(clock_gettime(CLOCK_REALTIME, &deadline) == 0); -+ deadline.tv_nsec += 20000000L; -+ if (deadline.tv_nsec >= 1000000000L) { -+ deadline.tv_sec += 1; -+ deadline.tv_nsec -= 1000000000L; -+ } -+ -+ errno = 0; -+ assert(sem_timedwait(&sem, &deadline) == -1); -+ assert(errno == ETIMEDOUT); -+ -+ pthread_t thread; -+ assert(pthread_create(&thread, NULL, post_after_delay, NULL) == 0); -+ -+ struct timespec start; -+ struct timespec end; -+ assert(clock_gettime(CLOCK_MONOTONIC, &start) == 0); -+ assert(sem_wait(&sem) == 0); -+ assert(clock_gettime(CLOCK_MONOTONIC, &end) == 0); -+ assert(elapsed_ns(&start, &end) >= 20000000L); -+ -+ assert(pthread_join(thread, NULL) == 0); -+ assert(sem_destroy(&sem) == 0); -+ -+ return 0; -+} -diff --git a/tests/semaphore/named.c b/tests/semaphore/named.c -new file mode 100644 ---- /dev/null -+++ b/tests/semaphore/named.c -@@ -0,0 +1,54 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static sem_t *first; -+static sem_t *second; -+ -+static void *post_after_delay(void *arg) -+{ -+ (void)arg; -+ usleep(50000); -+ assert(sem_post(second) == 0); -+ return NULL; -+} -+ -+static long elapsed_ns(const struct timespec *start, const struct timespec *end) -+{ -+ return (end->tv_sec - start->tv_sec) * 1000000000L + (end->tv_nsec - start->tv_nsec); -+} -+ -+int main(void) -+{ -+ char name[64]; -+ snprintf(name, sizeof(name), "/relibc_named_sem_%ld", (long)getpid()); -+ -+ sem_unlink(name); -+ -+ first = sem_open(name, O_CREAT | O_EXCL, 0600, 0); -+ assert(first != SEM_FAILED); -+ second = sem_open(name, 0); -+ assert(second != SEM_FAILED); -+ -+ pthread_t thread; -+ assert(pthread_create(&thread, NULL, post_after_delay, NULL) == 0); -+ -+ struct timespec start; -+ struct timespec end; -+ assert(clock_gettime(CLOCK_MONOTONIC, &start) == 0); -+ assert(sem_wait(first) == 0); -+ assert(clock_gettime(CLOCK_MONOTONIC, &end) == 0); -+ assert(elapsed_ns(&start, &end) >= 20000000L); -+ -+ assert(pthread_join(thread, NULL) == 0); -+ assert(sem_close(second) == 0); -+ assert(sem_close(first) == 0); -+ assert(sem_unlink(name) == 0); -+ -+ return 0; -+} diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-socket-cred.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-socket-cred.patch deleted file mode 100644 index bfda991147..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-socket-cred.patch +++ /dev/null @@ -1,178 +0,0 @@ -diff --git a/src/header/sys_socket/mod.rs b/src/header/sys_socket/mod.rs ---- a/src/header/sys_socket/mod.rs -+++ b/src/header/sys_socket/mod.rs -@@ -5,7 +5,7 @@ - use core::{mem, ptr}; - - use crate::{ -- error::ResultExt, -+ error::{Errno, ResultExt}, - header::{bits_iovec::iovec, bits_safamily_t::sa_family_t, bits_socklen_t::socklen_t}, - platform::{ - PalSocket, Sys, -@@ -236,6 +236,48 @@ - socket, - address, - address_len -+ ) -+} -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn getpeereid(socket: c_int, euid: *mut uid_t, egid: *mut gid_t) -> c_int { -+ trace_expr!( -+ (|| { -+ if euid.is_null() || egid.is_null() { -+ return Err(Errno(crate::header::errno::EFAULT)); -+ } -+ -+ let mut cred = ucred { -+ pid: 0, -+ uid: 0, -+ gid: 0, -+ }; -+ let mut len = mem::size_of::() as socklen_t; -+ unsafe { -+ Sys::getsockopt( -+ socket, -+ constants::SOL_SOCKET, -+ constants::SO_PEERCRED, -+ &mut cred as *mut ucred as *mut c_void, -+ &mut len, -+ )?; -+ } -+ -+ if (len as usize) < mem::size_of::() { -+ return Err(Errno(crate::header::errno::EINVAL)); -+ } -+ -+ unsafe { -+ *euid = cred.uid; -+ *egid = cred.gid; -+ } -+ Ok(0) -+ })() -+ .or_minus_one_errno(), -+ "getpeereid({}, {:p}, {:p})", -+ socket, -+ euid, -+ egid - ) - } - -diff --git a/tests/Makefile.tests.mk b/tests/Makefile.tests.mk ---- a/tests/Makefile.tests.mk -+++ b/tests/Makefile.tests.mk -@@ -137,6 +137,8 @@ - string/stpcpy \ - string/stpncpy \ - strings \ -+ sys_socket/passcred \ -+ sys_socket/peercred \ - sys_socket/recv \ - sys_socket/recvfrom \ - sys_socket/unixrecv \ -diff --git a/tests/sys_socket/peercred.c b/tests/sys_socket/peercred.c -new file mode 100644 ---- /dev/null -+++ b/tests/sys_socket/peercred.c -@@ -0,0 +1,33 @@ -+#include -+#include -+#include -+#include -+ -+#include "test_helpers.h" -+ -+int main(void) -+{ -+ int sv[2]; -+ int status = socketpair(AF_UNIX, SOCK_STREAM, 0, sv); -+ ERROR_IF(socketpair, status, == -1); -+ -+ struct ucred cred; -+ socklen_t len = sizeof(cred); -+ status = getsockopt(sv[0], SOL_SOCKET, SO_PEERCRED, &cred, &len); -+ ERROR_IF(getsockopt, status, == -1); -+ assert(len == sizeof(cred)); -+ assert(cred.uid == getuid()); -+ assert(cred.gid == getgid()); -+ assert(cred.pid > 0); -+ -+ uid_t euid; -+ gid_t egid; -+ status = getpeereid(sv[0], &euid, &egid); -+ ERROR_IF(getpeereid, status, == -1); -+ assert(euid == getuid()); -+ assert(egid == getgid()); -+ -+ close(sv[0]); -+ close(sv[1]); -+ return 0; -+} -diff --git a/tests/sys_socket/passcred.c b/tests/sys_socket/passcred.c -new file mode 100644 ---- /dev/null -+++ b/tests/sys_socket/passcred.c -@@ -0,0 +1,62 @@ -+#include -+#include -+#include -+#include -+#include -+ -+#include "test_helpers.h" -+ -+int main(void) -+{ -+ int sv[2]; -+ int status = socketpair(AF_UNIX, SOCK_STREAM, 0, sv); -+ ERROR_IF(socketpair, status, == -1); -+ -+ int one = 1; -+ status = setsockopt(sv[1], SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)); -+ ERROR_IF(setsockopt, status, == -1); -+ -+ const char payload[] = "x"; -+ ssize_t sent = send(sv[0], payload, sizeof(payload), 0); -+ ERROR_IF(send, sent, == -1); -+ assert(sent == (ssize_t)sizeof(payload)); -+ -+ char byte = '\0'; -+ struct iovec iov = { -+ .iov_base = &byte, -+ .iov_len = sizeof(byte), -+ }; -+ union { -+ char buf[CMSG_SPACE(sizeof(struct ucred))]; -+ struct cmsghdr align; -+ } control; -+ memset(&control, 0, sizeof(control)); -+ -+ struct msghdr msg = { -+ .msg_name = NULL, -+ .msg_namelen = 0, -+ .msg_iov = &iov, -+ .msg_iovlen = 1, -+ .msg_control = control.buf, -+ .msg_controllen = sizeof(control.buf), -+ .msg_flags = 0, -+ }; -+ -+ ssize_t recvd = recvmsg(sv[1], &msg, 0); -+ ERROR_IF(recvmsg, recvd, == -1); -+ assert(recvd == (ssize_t)sizeof(payload)); -+ assert(byte == 'x'); -+ -+ struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); -+ assert(cmsg != NULL); -+ assert(cmsg->cmsg_level == SOL_SOCKET); -+ assert(cmsg->cmsg_type == SCM_CREDENTIALS); -+ struct ucred *cred = (struct ucred *)CMSG_DATA(cmsg); -+ assert(cred->uid == getuid()); -+ assert(cred->gid == getgid()); -+ assert(cred->pid > 0); -+ -+ close(sv[0]); -+ close(sv[1]); -+ return 0; -+} diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-socket-flags.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-socket-flags.patch deleted file mode 100644 index e5f95b51cd..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-socket-flags.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/src/header/sys_socket/constants.rs b/src/header/sys_socket/constants.rs ---- a/src/header/sys_socket/constants.rs -+++ b/src/header/sys_socket/constants.rs -@@ -48,8 +48,9 @@ pub const MSG_OOB: c_int = 1; - pub const MSG_PEEK: c_int = 2; - pub const MSG_TRUNC: c_int = 32; - pub const MSG_DONTWAIT: c_int = 64; - pub const MSG_WAITALL: c_int = 256; - pub const MSG_CMSG_CLOEXEC: c_int = 0x40000000; -+pub const MSG_NOSIGNAL: c_int = 0x4000; - - pub const IP_ADD_SOURCE_MEMBERSHIP: c_int = 70; - pub const IP_DROP_SOURCE_MEMBERSHIP: c_int = 71; -diff --git a/src/header/sys_socket/mod.rs b/src/header/sys_socket/mod.rs ---- a/src/header/sys_socket/mod.rs -+++ b/src/header/sys_socket/mod.rs -@@ -330,7 +330,8 @@ pub unsafe extern "C" fn recvfrom( - /// See . - #[unsafe(no_mangle)] - pub unsafe extern "C" fn recvmsg(socket: c_int, msg: *mut msghdr, flags: c_int) -> ssize_t { -- unsafe { Sys::recvmsg(socket, msg, flags) } -+ let flags = flags & !constants::MSG_NOSIGNAL; -+ unsafe { Sys::recvmsg(socket, msg, flags) } - .map(|r| r as ssize_t) - .or_minus_one_errno() - } diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-syscall-0.7.4-procschemeattrs-ens-to-prio.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-syscall-0.7.4-procschemeattrs-ens-to-prio.patch deleted file mode 100644 index c2ef4521e0..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-syscall-0.7.4-procschemeattrs-ens-to-prio.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/redox-rt/src/proc.rs b/redox-rt/src/proc.rs -index 05e42757..f2eba231 100644 ---- a/redox-rt/src/proc.rs -+++ b/redox-rt/src/proc.rs -@@ -1119,7 +1119,7 @@ pub fn new_child_process(args: &ForkArgs<'_>) -> Result { - pid: 0, - euid: 0, - egid: 0, -- ens: 1, -+ prio: 1, - debug_name: { - let mut buf = [0; 32]; - let src = b"[init]"; diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-tcp-nodelay.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-tcp-nodelay.patch deleted file mode 100644 index 8c65eee645..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-tcp-nodelay.patch +++ /dev/null @@ -1,53 +0,0 @@ -diff --git a/src/header/sys_socket/constants.rs b/src/header/sys_socket/constants.rs -index ec42889b..c91ffb1a 100644 ---- a/src/header/sys_socket/constants.rs -+++ b/src/header/sys_socket/constants.rs -@@ -75,3 +75,6 @@ pub const SHUT_WR: c_int = 1; - - pub const SCM_RIGHTS: c_int = 1; - pub const SCM_CREDENTIALS: c_int = 2; -+ -+pub const IPPROTO_TCP: c_int = 6; -+pub const TCP_NODELAY: c_int = 1; -diff --git a/src/platform/redox/socket.rs b/src/platform/redox/socket.rs -index d223c36f..2faae4f5 100644 ---- a/src/platform/redox/socket.rs -+++ b/src/platform/redox/socket.rs -@@ -1051,10 +1051,10 @@ impl PalSocket for Sys { - _ => { - let metadata = [SocketCall::SetSockOpt as u64, option_name as u64]; - let payload = unsafe { -- slice::from_raw_parts_mut(option_value as *mut u8, option_len as usize) -+ slice::from_raw_parts(option_value as *const u8, option_len as usize) - }; - let call_flags = CallFlags::empty(); -- redox_rt::sys::sys_call_rw( -+ redox_rt::sys::sys_call_wo( - socket as usize, - payload, - CallFlags::empty(), -@@ -1063,6 +1063,24 @@ impl PalSocket for Sys { - return Ok(()); - } - }, -+ crate::header::sys_socket::constants::IPPROTO_TCP => { -+ match option_name { -+ crate::header::sys_socket::constants::TCP_NODELAY => { -+ let metadata = [SocketCall::SetSockOpt as u64, option_name as u64]; -+ let payload = unsafe { -+ slice::from_raw_parts(option_value as *const u8, option_len as usize) -+ }; -+ redox_rt::sys::sys_call_wo( -+ socket as usize, -+ payload, -+ CallFlags::empty(), -+ &metadata, -+ )?; -+ return Ok(()); -+ } -+ _ => (), -+ } -+ } - _ => (), - } - diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-tcp-sockopt-forward.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-tcp-sockopt-forward.patch deleted file mode 100644 index c1a91acee6..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-tcp-sockopt-forward.patch +++ /dev/null @@ -1,59 +0,0 @@ -diff --git a/src/platform/redox/socket.rs b/src/platform/redox/socket.rs -index d223c36f..f8a1c2e0 100644 ---- a/src/platform/redox/socket.rs -+++ b/src/platform/redox/socket.rs -@@ -774,6 +774,21 @@ impl PalSocket for Sys { - return Ok(()); - } - }, -+ crate::header::sys_socket::constants::IPPROTO_TCP => { -+ let metadata = [SocketCall::GetSockOpt as u64, option_name as u64]; -+ let payload = -+ unsafe { slice::from_raw_parts_mut(option_value as *mut u8, option_len) }; -+ let call_flags = CallFlags::empty(); -+ unsafe { -+ *option_len_ptr = redox_rt::sys::sys_call_ro( -+ socket as usize, -+ payload, -+ CallFlags::empty(), -+ &metadata, -+ )? as socklen_t; -+ } -+ return Ok(()); -+ } - _ => (), - } - -@@ -1069,21 +1069,16 @@ impl PalSocket for Sys { - crate::header::sys_socket::constants::IPPROTO_TCP => { -- match option_name { -- crate::header::sys_socket::constants::TCP_NODELAY => { -- let metadata = [SocketCall::SetSockOpt as u64, option_name as u64]; -- let payload = unsafe { -- slice::from_raw_parts(option_value as *const u8, option_len as usize) -- }; -- redox_rt::sys::sys_call_wo( -- socket as usize, -- payload, -- CallFlags::empty(), -- &metadata, -- )?; -- return Ok(()); -- } -- _ => (), -- } -+ let metadata = [SocketCall::SetSockOpt as u64, option_name as u64]; -+ let payload = unsafe { -+ slice::from_raw_parts(option_value as *const u8, option_len as usize) -+ }; -+ redox_rt::sys::sys_call_wo( -+ socket as usize, -+ payload, -+ CallFlags::empty(), -+ &metadata, -+ )?; -+ return Ok(()); - } - _ => (), - } - diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-timerfd-cbindgen-fix.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-timerfd-cbindgen-fix.patch deleted file mode 100644 index db0422d4e1..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-timerfd-cbindgen-fix.patch +++ /dev/null @@ -1,35 +0,0 @@ -Fix sys/timerfd.h cbindgen.toml to generate proper C headers instead of C++. - -The empty cbindgen.toml from P3-timerfd-relative.patch caused cbindgen to -generate C++ output (cstdarg, constexpr, etc.) in the installed -sys/timerfd.h. C compilers including this header would fail with -"cstdarg: No such file or directory". Add language="C", after_includes -for bits/timespec.h, and explicit export list for the timerfd constants. - -diff --git a/src/header/sys_timerfd/cbindgen.toml b/src/header/sys_timerfd/cbindgen.toml ---- a/src/header/sys_timerfd/cbindgen.toml -+++ b/src/header/sys_timerfd/cbindgen.toml -@@ -1,12 +1,23 @@ - sys_includes = ["time.h"] -+after_includes = """ -+#include // for itimerspec -+""" - include_guard = "_SYS_TIMERFD_H" - language = "C" - style = "Tag" - no_includes = true - cpp_compat = true - - [enum] - prefix_with_name = true - -+[export] -+include = [ -+ "TFD_CLOEXEC", -+ "TFD_NONBLOCK", -+ "TFD_TIMER_ABSTIME", -+ "TFD_TIMER_CANCEL_ON_SET", -+] -+ - [export.rename] - "itimerspec" = "struct itimerspec" diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-timerfd-relative.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-timerfd-relative.patch deleted file mode 100644 index 8ccddb67e2..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-timerfd-relative.patch +++ /dev/null @@ -1,177 +0,0 @@ -diff --git a/src/header/sys_timerfd/cbindgen.toml b/src/header/sys_timerfd/cbindgen.toml -new file mode 100644 -index 0000000..9469888 ---- /dev/null -+++ b/src/header/sys_timerfd/cbindgen.toml -@@ -0,0 +1,12 @@ -+sys_includes = ["time.h"] -+include_guard = "_SYS_TIMERFD_H" -+language = "C" -+style = "Tag" -+no_includes = true -+cpp_compat = true -+ -+[enum] -+prefix_with_name = true -+ -+[export.rename] -+"itimerspec" = "struct itimerspec" -diff --git a/src/header/sys_timerfd/mod.rs b/src/header/sys_timerfd/mod.rs -index 0959d39..916066f 100644 ---- a/src/header/sys_timerfd/mod.rs -+++ b/src/header/sys_timerfd/mod.rs -@@ -1,10 +1,8 @@ - //! `sys/timerfd.h` implementation. - //! - //! Non-POSIX, see . -- - use alloc::{collections::BTreeMap, format}; - use core::{mem, slice, sync::atomic::{AtomicBool, Ordering}}; -- - use crate::{ - c_str::{CStr, CString}, - error::{Errno, ResultExt}, -@@ -14,13 +12,9 @@ use crate::{ - fcntl::{O_CLOEXEC, O_NONBLOCK, O_RDWR}, - }, - out::Out, -- platform::{ -- Pal, Sys, -- types::{c_int, clockid_t}, -- }, -+ platform::{Pal, Sys, types::{c_int, clockid_t}}, - sync::Mutex, - }; -- - pub use crate::header::time::itimerspec; - - pub const TFD_CLOEXEC: c_int = 0x80000; -@@ -30,104 +24,64 @@ pub const TFD_TIMER_CANCEL_ON_SET: c_int = 0x2; - - const NSEC_PER_SEC: i64 = 1_000_000_000; - -+struct TimerState { clockid: clockid_t } -+ - static MAP_INIT: AtomicBool = AtomicBool::new(false); --static TIMERFD_CLOCKIDS: Mutex>> = Mutex::new(None); -+static TIMERFD_STATE: Mutex>> = Mutex::new(None); - --fn with_map(f: impl FnOnce(&mut BTreeMap) -> R) -> R { -- let mut guard = TIMERFD_CLOCKIDS.lock(); -- if !MAP_INIT.load(Ordering::Acquire) { -- *guard = Some(BTreeMap::new()); -- MAP_INIT.store(true, Ordering::Release); -- } -+fn with_map(f: impl FnOnce(&mut BTreeMap) -> R) -> R { -+ let mut guard = TIMERFD_STATE.lock(); -+ if !MAP_INIT.load(Ordering::Acquire) { *guard = Some(BTreeMap::new()); MAP_INIT.store(true, Ordering::Release); } - f(guard.as_mut().unwrap()) - } -- - fn add_timespec(a: ×pec, b: ×pec) -> timespec { - let total_nsec = a.tv_nsec as i64 + b.tv_nsec as i64; - let mut sec = a.tv_sec + b.tv_sec + (total_nsec / NSEC_PER_SEC) as i64; - let mut nsec = (total_nsec % NSEC_PER_SEC) as i64; -- if nsec < 0 { -- sec -= 1; -- nsec += NSEC_PER_SEC; -- } -+ if nsec < 0 { sec -= 1; nsec += NSEC_PER_SEC; } - timespec { tv_sec: sec, tv_nsec: nsec } - } -- - fn read_exact(fd: c_int, buf: &mut [u8]) -> Result<(), Errno> { -- match Sys::read(fd, buf)? { -- n if n == buf.len() => Ok(()), -- _ => Err(Errno(EIO)), -- } -+ match Sys::read(fd, buf)? { n if n == buf.len() => Ok(()), _ => Err(Errno(EIO)) } - } -- - fn write_exact(fd: c_int, buf: &[u8]) -> Result<(), Errno> { -- match Sys::write(fd, buf)? { -- n if n == buf.len() => Ok(()), -- _ => Err(Errno(EIO)), -- } -+ match Sys::write(fd, buf)? { n if n == buf.len() => Ok(()), _ => Err(Errno(EIO)) } - } - - #[unsafe(no_mangle)] - pub extern "C" fn timerfd_create(clockid: clockid_t, flags: c_int) -> c_int { -- let supported = TFD_CLOEXEC | TFD_NONBLOCK; -- if flags & !supported != 0 { -- return Err::(Errno(EINVAL)).or_minus_one_errno(); -- } -- -+ if flags & !(TFD_CLOEXEC | TFD_NONBLOCK) != 0 { return Err::(Errno(EINVAL)).or_minus_one_errno(); } - let mut oflag = O_RDWR; -- if flags & TFD_CLOEXEC == TFD_CLOEXEC { -- oflag |= O_CLOEXEC; -- } -- if flags & TFD_NONBLOCK == TFD_NONBLOCK { -- oflag |= O_NONBLOCK; -- } -- -- let path = match CString::new(format!("/scheme/time/{clockid}")) { -- Ok(path) => path, -- Err(_) => return Err::(Errno(EINVAL)).or_minus_one_errno(), -- }; -- let fd = Sys::open(CStr::borrow(&path), oflag, 0).or_minus_one_errno()?; -- -- // Register the clockid for this fd so timerfd_settime can convert relative times -- with_map(|map| { map.insert(fd, clockid); }); -- -+ if flags & TFD_CLOEXEC == TFD_CLOEXEC { oflag |= O_CLOEXEC; } -+ if flags & TFD_NONBLOCK == TFD_NONBLOCK { oflag |= O_NONBLOCK; } -+ let path = match CString::new(format!("/scheme/time/{clockid}")) { Ok(p) => p, Err(_) => return Err::(Errno(EINVAL)).or_minus_one_errno() }; -+ let fd = match Sys::open(CStr::borrow(&path), oflag, 0) { Ok(fd) => fd, Err(Errno(e)) => return Err::(Errno(e)).or_minus_one_errno() }; -+ with_map(|map| { map.insert(fd, TimerState { clockid }); }); - fd - } - - #[unsafe(no_mangle)] - pub unsafe extern "C" fn timerfd_settime(fd: c_int, flags: c_int, new: *const itimerspec, old: *mut itimerspec) -> c_int { -- let supported = TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET; -- if flags & !supported != 0 { -- return Err::(Errno(EINVAL)).or_minus_one_errno(); -- } -- if new.is_null() { -- return Err::(Errno(EFAULT)).or_minus_one_errno(); -- } -- if !old.is_null() && unsafe { timerfd_gettime(fd, old) } < 0 { -- return -1; -- } -+ if flags & !(TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET) != 0 { return Err::(Errno(EINVAL)).or_minus_one_errno(); } -+ if new.is_null() { return Err::(Errno(EFAULT)).or_minus_one_errno(); } -+ if !old.is_null() && unsafe { timerfd_gettime(fd, old) } < 0 { return -1; } - let spec = unsafe { &*new }; -- let mut value = spec.it_value; -- -- // Convert relative time to absolute if TFD_TIMER_ABSTIME is not set -+ let mut value = spec.it_value.clone(); -+ // TFD_TIMER_CANCEL_ON_SET: flag accepted; clock-change notification requires -+ // kernel infrastructure not yet available. This is a bounded compatibility surface. - if flags & TFD_TIMER_ABSTIME == 0 { -- let clockid = with_map(|map| map.get(&fd).copied()).unwrap_or(0); -+ let clockid = with_map(|map| map.get(&fd).map_or(0, |s| s.clockid)); - let mut now = timespec::default(); -- if Sys::clock_gettime(clockid, Out::from_mut(&mut now)).is_err() { -- return Err::(Errno(EBADF)).or_minus_one_errno(); -- } -+ if Sys::clock_gettime(clockid, Out::from_mut(&mut now)).is_err() { return Err::(Errno(EBADF)).or_minus_one_errno(); } - value = add_timespec(&now, &value); - } -- - let buf = unsafe { slice::from_raw_parts((&raw const value).cast::(), mem::size_of::()) }; - write_exact(fd, buf).map(|()| 0).or_minus_one_errno() - } - - #[unsafe(no_mangle)] - pub unsafe extern "C" fn timerfd_gettime(fd: c_int, curr: *mut itimerspec) -> c_int { -- if curr.is_null() { -- return Err::(Errno(EFAULT)).or_minus_one_errno(); -- } -+ if curr.is_null() { return Err::(Errno(EFAULT)).or_minus_one_errno(); } - let curr = unsafe { &mut *curr }; - curr.it_interval = timespec::default(); - let buf = unsafe { slice::from_raw_parts_mut((&raw mut curr.it_value).cast::(), mem::size_of::()) }; diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-timerfd.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-timerfd.patch deleted file mode 100644 index f704885324..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-timerfd.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/src/header/sys_timerfd/mod.rs b/src/header/sys_timerfd/mod.rs -index 0959d39..9a4a23e 100644 ---- a/src/header/sys_timerfd/mod.rs -+++ b/src/header/sys_timerfd/mod.rs -@@ -86,7 +86,10 @@ pub extern "C" fn timerfd_create(clockid: clockid_t, flags: c_int) -> c_int { - Ok(path) => path, - Err(_) => return Err::(Errno(EINVAL)).or_minus_one_errno(), - }; -- let fd = Sys::open(CStr::borrow(&path), oflag, 0).or_minus_one_errno()?; -+ let fd = match Sys::open(CStr::borrow(&path), oflag, 0) { -+ Ok(fd) => fd, -+ Err(Errno(e)) => { return Err::(Errno(e)).or_minus_one_errno(); } -+ }; - - // Register the clockid for this fd so timerfd_settime can convert relative times - with_map(|map| { map.insert(fd, clockid); }); -@@ -107,7 +110,7 @@ pub unsafe extern "C" fn timerfd_settime(fd: c_int, flags: c_int, new: *const it - return -1; - } - let spec = unsafe { &*new }; -- let mut value = spec.it_value; -+ let mut value = spec.it_value.clone(); - - // Convert relative time to absolute if TFD_TIMER_ABSTIME is not set - if flags & TFD_TIMER_ABSTIME == 0 { diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-tls-get-addr-panic-fix.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-tls-get-addr-panic-fix.patch deleted file mode 100644 index 98a73b0ba8..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-tls-get-addr-panic-fix.patch +++ /dev/null @@ -1,34 +0,0 @@ -diff --git a/src/header/dl-tls/mod.rs b/src/header/dl-tls/mod.rs -index 0196bf7b..785ab343 100644 ---- a/src/header/dl-tls/mod.rs -+++ b/src/header/dl-tls/mod.rs -@@ -51,6 +51,14 @@ pub unsafe extern "C" fn __tls_get_addr(ti: *mut dl_tls_index) -> *mut c_void { - let layout = Layout::from_size_align_unchecked(master.segment_size, 16); - let ptr = alloc(layout); - -+ if ptr.is_null() { -+ eprintln!( -+ "__tls_get_addr: TLS allocation failed for module {:#x} (size {})", -+ ti.ti_module, master.segment_size -+ ); -+ return ptr::null_mut(); -+ } -+ - ptr::copy_nonoverlapping(master.ptr, ptr, master.image_size); - ptr::write_bytes( - ptr.add(master.image_size), -@@ -68,10 +76,11 @@ pub unsafe extern "C" fn __tls_get_addr(ti: *mut dl_tls_index) -> *mut c_void { - let mut ptr = tcb.dtv_mut()[dtv_index]; - - if ptr.is_null() { -- panic!( -- "__tls_get_addr({ti:p}: {:#x}, {:#x})", -- ti.ti_module, ti.ti_offset -+ eprintln!( -+ "__tls_get_addr({:p}: {:#x}, {:#x}): DTV entry is null, module {} TLS not available", -+ ti, ti.ti_module, ti.ti_offset, ti.ti_module - ); -+ return ptr::null_mut(); - } - - if cfg!(target_arch = "riscv64") { diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-vfork.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-vfork.patch deleted file mode 100644 index 0448d0ddf3..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-vfork.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/header/unistd/mod.rs b/src/header/unistd/mod.rs ---- a/src/header/unistd/mod.rs -+++ b/src/header/unistd/mod.rs -@@ -1262,8 +1262,8 @@ - /// Specifications Issue 6, and removed in Issue 7. - #[deprecated] - // #[unsafe(no_mangle)] - pub extern "C" fn vfork() -> pid_t { -- unimplemented!(); -+ unsafe { fork() } - } - - unsafe fn with_argv( diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-waitid-header.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-waitid-header.patch deleted file mode 100644 index 516463032d..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-waitid-header.patch +++ /dev/null @@ -1,9 +0,0 @@ -diff --git a/src/header/sys_wait/cbindgen.toml b/src/header/sys_wait/cbindgen.toml ---- a/src/header/sys_wait/cbindgen.toml -+++ b/src/header/sys_wait/cbindgen.toml -@@ -1,4 +1,4 @@ --sys_includes = ["sys/types.h", "sys/resource.h"] -+sys_includes = ["sys/types.h", "sys/resource.h", "signal.h"] - include_guard = "_RELIBC_SYS_WAIT_H" - after_includes = """ - diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-waitid.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P3-waitid.patch deleted file mode 100644 index d8bd2574d5..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P3-waitid.patch +++ /dev/null @@ -1,245 +0,0 @@ -diff --git a/src/header/sys_wait/mod.rs b/src/header/sys_wait/mod.rs ---- a/src/header/sys_wait/mod.rs -+++ b/src/header/sys_wait/mod.rs -@@ -4,12 +4,16 @@ - - use crate::{ - error::ResultExt, -+ header::signal::siginfo_t, - out::Out, - platform::{ -- Pal, Sys, -- types::{c_int, pid_t}, -+ ERRNO, Pal, Sys, -+ types::{c_int, c_uint, pid_t}, - }, - }; -+ -+pub type idtype_t = c_int; -+pub type id_t = c_uint; - - pub const WNOHANG: c_int = 1; - pub const WUNTRACED: c_int = 2; -@@ -24,25 +28,143 @@ - #[allow(overflowing_literals)] - pub const __WCLONE: c_int = 0x8000_0000; - -+pub const P_ALL: idtype_t = 0; -+pub const P_PID: idtype_t = 1; -+pub const P_PGID: idtype_t = 2; -+ -+pub const CLD_EXITED: c_int = 1; -+pub const CLD_KILLED: c_int = 2; -+pub const CLD_DUMPED: c_int = 3; -+pub const CLD_TRAPPED: c_int = 4; -+pub const CLD_STOPPED: c_int = 5; -+pub const CLD_CONTINUED: c_int = 6; -+ -+fn wexitstatus(status: c_int) -> c_int { -+ (status >> 8) & 0xff -+} -+ -+fn wtermsig(status: c_int) -> c_int { -+ status & 0x7f -+} -+ -+fn wstopsig(status: c_int) -> c_int { -+ wexitstatus(status) -+} -+ -+fn wcoredump(status: c_int) -> bool { -+ (status & 0x80) != 0 -+} -+ -+fn wifexited(status: c_int) -> bool { -+ (status & 0x7f) == 0 -+} -+ -+fn wifstopped(status: c_int) -> bool { -+ (status & 0xff) == 0x7f -+} -+ -+fn wifcontinued(status: c_int) -> bool { -+ status == 0xffff -+} -+ - /// See . - #[unsafe(no_mangle)] - pub unsafe extern "C" fn wait(stat_loc: *mut c_int) -> pid_t { - unsafe { waitpid(!0, stat_loc, 0) } - } - --/* -- * TODO: implement idtype_t, id_t, and siginfo_t -- * -- * #[unsafe(no_mangle)] -- * pub unsafe extern "C" fn waitid( -- * idtype: idtype_t, -- * id: id_t, -- * infop: siginfo_t, -- * options: c_int -- * ) -> c_int { -- * unimplemented!(); -- * } -- */ -+fn map_waitid_target(idtype: idtype_t, id: id_t) -> Option { -+ match idtype { -+ P_ALL => Some(-1), -+ P_PID => Some(id as pid_t), -+ P_PGID => Some(if id == 0 { 0 } else { -(id as pid_t) }), -+ _ => None, -+ } -+} -+ -+fn map_waitid_options(options: c_int) -> Option { -+ let interest = options & (WEXITED | WSTOPPED | WCONTINUED); -+ if interest == 0 { -+ return None; -+ } -+ -+ let mut waitpid_options = 0; -+ if options & WNOHANG != 0 { -+ waitpid_options |= WNOHANG; -+ } -+ if options & WSTOPPED != 0 { -+ waitpid_options |= WUNTRACED; -+ } -+ if options & WCONTINUED != 0 { -+ waitpid_options |= WCONTINUED; -+ } -+ if options & WNOWAIT != 0 { -+ waitpid_options |= WNOWAIT; -+ } -+ -+ Some(waitpid_options) -+} -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn waitid( -+ idtype: idtype_t, -+ id: id_t, -+ infop: *mut siginfo_t, -+ options: c_int, -+) -> c_int { -+ if infop.is_null() { -+ ERRNO.set(crate::header::errno::EFAULT); -+ return -1; -+ } -+ -+ let Some(pid_target) = map_waitid_target(idtype, id) else { -+ ERRNO.set(crate::header::errno::EINVAL); -+ return -1; -+ }; -+ let Some(waitpid_options) = map_waitid_options(options) else { -+ ERRNO.set(crate::header::errno::EINVAL); -+ return -1; -+ }; -+ -+ let mut status = 0; -+ let pid = Sys::waitpid(pid_target, Some(Out::from_mut(&mut status)), waitpid_options) -+ .or_minus_one_errno(); -+ if pid < 0 { -+ return -1; -+ } -+ -+ unsafe { -+ *infop = core::mem::zeroed(); -+ } -+ if pid == 0 { -+ return 0; -+ } -+ -+ unsafe { -+ (*infop).si_pid = pid; -+ (*infop).si_signo = crate::header::signal::SIGCHLD as c_int; -+ (*infop).si_errno = 0; -+ if wifexited(status) { -+ (*infop).si_code = CLD_EXITED; -+ (*infop).si_status = wexitstatus(status); -+ } else if wifstopped(status) { -+ (*infop).si_code = CLD_STOPPED; -+ (*infop).si_status = wstopsig(status); -+ } else if wifcontinued(status) { -+ (*infop).si_code = CLD_CONTINUED; -+ (*infop).si_status = crate::header::signal::SIGCONT as c_int; -+ } else { -+ (*infop).si_status = wtermsig(status); -+ (*infop).si_code = if wcoredump(status) { -+ CLD_DUMPED -+ } else { -+ CLD_KILLED -+ }; -+ } -+ } -+ -+ 0 -+} - - /// See . - #[unsafe(no_mangle)] -diff --git a/tests/Makefile.tests.mk b/tests/Makefile.tests.mk ---- a/tests/Makefile.tests.mk -+++ b/tests/Makefile.tests.mk -@@ -312,6 +312,7 @@ - grp/getgrgid_r \ - grp/getgrnam_r \ - grp/gr_iter \ -+ waitid \ - waitpid \ - waitpid_multiple \ - $(FAILING_TESTS) -diff --git a/tests/waitid.c b/tests/waitid.c -new file mode 100644 ---- /dev/null -+++ b/tests/waitid.c -@@ -0,0 +1,50 @@ -+#include -+#include -+#include -+#include -+#include -+ -+#include "test_helpers.h" -+ -+static void wait_until_child_exits(pid_t pid) { -+ siginfo_t info; -+ for (int i = 0; i < 50; ++i) { -+ info.si_pid = 0; -+ int ret = waitid(P_PID, pid, &info, WEXITED | WNOHANG | WNOWAIT); -+ ERROR_IF(waitid, ret, == -1); -+ if (info.si_pid == pid) { -+ assert(info.si_code == CLD_EXITED); -+ assert(info.si_status == 42); -+ return; -+ } -+ usleep(10000); -+ } -+ assert(!"waitid never observed child exit"); -+} -+ -+int main(void) { -+ pid_t pid = fork(); -+ ERROR_IF(fork, pid, == -1); -+ -+ if (pid == 0) { -+ usleep(50000); -+ _Exit(42); -+ } -+ -+ siginfo_t info; -+ info.si_pid = 0; -+ int ret = waitid(P_PID, pid, &info, WEXITED | WNOHANG | WNOWAIT); -+ ERROR_IF(waitid, ret, == -1); -+ assert(info.si_pid == 0); -+ -+ wait_until_child_exits(pid); -+ -+ int status = 0; -+ pid_t waited = waitpid(pid, &status, 0); -+ ERROR_IF(waitpid, waited, == -1); -+ assert(waited == pid); -+ assert(WIFEXITED(status)); -+ assert(WEXITSTATUS(status) == 42); -+ -+ return EXIT_SUCCESS; -+} diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P4-setgroups-getgroups.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P4-setgroups-getgroups.patch deleted file mode 100644 index 20c493cbf7..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P4-setgroups-getgroups.patch +++ /dev/null @@ -1,319 +0,0 @@ -diff --git a/redox-rt/src/lib.rs b/redox-rt/src/lib.rs -index 12835a6..3e99860 100644 ---- a/redox-rt/src/lib.rs -+++ b/redox-rt/src/lib.rs -@@ -18,5 +18,7 @@ use self::{ - - extern crate alloc; -+ -+use alloc::vec::Vec; - - #[macro_export] - macro_rules! asmfunction( -@@ -224,6 +226,7 @@ pub unsafe fn initialize( - rgid: metadata.rgid, - sgid: metadata.sgid, - ns_fd, -+ groups: Vec::new(), - }; - } - } -@@ -241,6 +244,7 @@ pub struct DynamicProcInfo { - pub rgid: u32, - pub sgid: u32, - pub ns_fd: Option, -+ pub groups: Vec, - } - - static DYNAMIC_PROC_INFO: Mutex = Mutex::new(DynamicProcInfo { -@@ -252,6 +256,7 @@ static DYNAMIC_PROC_INFO: Mutex = Mutex::new(DynamicProcInfo { - egid: u32::MAX, - sgid: u32::MAX, - ns_fd: None, -+ groups: Vec::new(), - }); - - #[inline] -diff --git a/redox-rt/src/proc.rs b/redox-rt/src/proc.rs -index 48cce34..7c0cdb7 100644 ---- a/redox-rt/src/proc.rs -+++ b/redox-rt/src/proc.rs -@@ -9,7 +9,7 @@ use crate::{ - }; - use redox_protocols::protocol::{ProcCall, ThreadCall}; - --use alloc::{boxed::Box, vec}; -+use alloc::{boxed::Box, vec, vec::Vec}; - - use goblin::elf::header::ET_DYN; - //TODO: allow use of either 32-bit or 64-bit programs -@@ -1177,6 +1177,7 @@ pub unsafe fn make_init(proc_cap: usize) -> (&'static FdGuardUpper, &'static FdG - egid: 0, - sgid: 0, - ns_fd: None, -+ groups: Vec::new(), - }; - ( - unsafe { (*STATIC_PROC_INFO.get()).proc_fd.as_ref().unwrap() }, -diff --git a/redox-rt/src/sys.rs b/redox-rt/src/sys.rs -index f0363a3..fb9fc52 100644 ---- a/redox-rt/src/sys.rs -+++ b/redox-rt/src/sys.rs -@@ -18,5 +18,6 @@ use crate::{ - signal::tmp_disable_signals, - }; -+use alloc::vec; - use alloc::vec::Vec; - use redox_protocols::protocol::{ - NsDup, ProcCall, ProcKillTarget, RtSigInfo, ThreadCall, WaitFlags, -@@ -415,6 +416,54 @@ pub fn posix_getresugid() -> Resugid { - sgid, - } - } -+pub fn posix_setgroups(groups: &[u32]) -> Result<()> { -+ let _sig_guard = tmp_disable_signals(); -+ -+ let mut buf = Vec::with_capacity(groups.len() * size_of::()); -+ for gid in groups { -+ buf.extend_from_slice(&gid.to_ne_bytes()); -+ } -+ -+ let auth_fd = crate::current_proc_fd().as_raw_fd(); -+ let groups_path = alloc::format!("auth-{}-groups", auth_fd); -+ -+ let thr_fd = crate::RtTcb::current().thread_fd(); -+ let groups_fd = thr_fd.dup(groups_path.as_bytes())?; -+ -+ syscall::write(groups_fd.as_raw_fd(), &buf)?; -+ -+ let mut guard = DYNAMIC_PROC_INFO.lock(); -+ guard.groups = groups.to_vec(); -+ Ok(()) -+} -+ -+pub fn posix_getgroups() -> Vec { -+ let _sig_guard = tmp_disable_signals(); -+ let groups = DYNAMIC_PROC_INFO.lock().groups.clone(); -+ if !groups.is_empty() { -+ return groups; -+ } -+ drop(_sig_guard); -+ posix_readback_groups().unwrap_or_default() -+} -+ -+fn posix_readback_groups() -> Result> { -+ let auth_fd = crate::current_proc_fd().as_raw_fd(); -+ let groups_path = alloc::format!("auth-{}-groups", auth_fd); -+ let thr_fd = crate::RtTcb::current().thread_fd(); -+ let groups_fd = thr_fd.dup(groups_path.as_bytes())?; -+ -+ let mut buf = vec![0u8; 65536 * size_of::()]; -+ let n = syscall::read(groups_fd.as_raw_fd(), &mut buf)?; -+ let count = n / size_of::(); -+ let mut groups = Vec::with_capacity(count); -+ for chunk in buf[..n].chunks_exact(size_of::()) { -+ groups.push(u32::from_ne_bytes(<[u8; size_of::()]>::try_from(chunk).unwrap())); -+ } -+ let mut guard = DYNAMIC_PROC_INFO.lock(); -+ guard.groups = groups.clone(); -+ Ok(groups) -+} - pub fn getens() -> Result { - read_proc_meta(crate::current_proc_fd()).map(|meta| meta.ens as usize) - } -diff --git a/src/platform/redox/mod.rs b/src/platform/redox/mod.rs -index 752339a..a0b4304 100644 ---- a/src/platform/redox/mod.rs -+++ b/src/platform/redox/mod.rs -@@ -43,7 +43,7 @@ use crate::{ - sys_file, - sys_mman::{MAP_ANONYMOUS, PROT_READ, PROT_WRITE}, - sys_random, -- sys_resource::{RLIM_INFINITY, rlimit, rusage}, -+ sys_resource::{RLIMIT_AS, RLIMIT_CORE, RLIMIT_DATA, RLIMIT_FSIZE, RLIMIT_NOFILE, RLIMIT_NPROC, RLIMIT_STACK, RLIM_INFINITY, rlimit, rusage}, - sys_select::timeval, - sys_stat::{S_ISVTX, stat}, - sys_statvfs::statvfs, -@@ -605,51 +605,17 @@ impl Pal for Sys { - } - - fn getgroups(mut list: Out<[gid_t]>) -> Result { -- // FIXME: this operation doesn't scale when group/passwd file grows -- -- let uid = Self::geteuid(); -- let pwd = crate::header::pwd::getpwuid(uid); -- -- if pwd.is_null() { -- return Err(Errno(ENOENT)); -- } -- -- let username = unsafe { CStr::from_ptr((*pwd).pw_name) }; -- let username = username.to_bytes_with_nul(); -- let mut count = 0; -- -- unsafe { -- use crate::header::grp; -- grp::setgrent(); -- -- while let Some(grp) = grp::getgrent().as_ref() { -- let mut i = 0; -- let mut found = false; -- -- while !(*grp.gr_mem.offset(i)).is_null() { -- let member = CStr::from_ptr(*grp.gr_mem.offset(i)); -- if member.to_bytes_with_nul() == username { -- found = true; -- break; -- } -- i += 1; -- } -- -- if found { -- if !list.is_empty() && (count as usize) < list.len() { -- list.index(count).write(grp.gr_gid); -- } -- count += 1; -- } -+ let groups = redox_rt::sys::posix_getgroups(); -+ let count = groups.len(); -+ if !list.is_empty() { -+ if count > list.len() { -+ return Err(Errno(EINVAL)); -+ } -+ for (i, gid) in groups.iter().enumerate() { -+ list.index(i as _).write(*gid as gid_t); - } -- grp::endgrent(); -- } -- -- if !list.is_empty() && (count as usize) > list.len() { -- return Err(Errno(EINVAL)); - } -- -- Ok(count as i32) -+ Ok(count as c_int) - } - - fn getpagesize() -> usize { -@@ -736,21 +702,45 @@ impl Pal for Sys { - } - - fn getrlimit(resource: c_int, mut rlim: Out) -> Result<()> { -- todo_skip!(0, "getrlimit({}, {:p}): not implemented", resource, rlim); -- rlim.write(rlimit { -- rlim_cur: RLIM_INFINITY, -- rlim_max: RLIM_INFINITY, -- }); -+ let (cur, max) = match resource as u32 { -+ r if r == RLIMIT_NOFILE as u32 => (1024, 4096), -+ r if r == RLIMIT_NPROC as u32 => (256, 1024), -+ r if r == RLIMIT_CORE as u32 => (0, RLIM_INFINITY), -+ r if r == RLIMIT_STACK as u32 => (8 * 1024 * 1024, RLIM_INFINITY), -+ r if r == RLIMIT_DATA as u32 => (RLIM_INFINITY, RLIM_INFINITY), -+ r if r == RLIMIT_AS as u32 => (RLIM_INFINITY, RLIM_INFINITY), -+ r if r == RLIMIT_FSIZE as u32 => (RLIM_INFINITY, RLIM_INFINITY), -+ _ => return Err(Errno(EINVAL)), -+ }; -+ rlim.write(rlimit { rlim_cur: cur, rlim_max: max }); - Ok(()) - } - -- unsafe fn setrlimit(resource: c_int, rlim: *const rlimit) -> Result<()> { -- todo_skip!(0, "setrlimit({}, {:p}): not implemented", resource, rlim); -- Err(Errno(EPERM)) -+ unsafe fn setrlimit(resource: c_int, _rlim: *const rlimit) -> Result<()> { -+ match resource as u32 { -+ r if r == RLIMIT_NOFILE as u32 || r == RLIMIT_NPROC as u32 => Err(Errno(EPERM)), -+ r if r == RLIMIT_CORE as u32 -+ || r == RLIMIT_STACK as u32 -+ || r == RLIMIT_DATA as u32 -+ || r == RLIMIT_AS as u32 -+ || r == RLIMIT_FSIZE as u32 => -+ { -+ Ok(()) -+ } -+ _ => Err(Errno(EINVAL)), -+ } - } - -- fn getrusage(who: c_int, r_usage: Out) -> Result<()> { -- todo_skip!(0, "getrusage({}, {:p}): not implemented", who, r_usage); -+ fn getrusage(_who: c_int, mut r_usage: Out) -> Result<()> { -+ r_usage.write(rusage { -+ ru_utime: timeval { tv_sec: 0, tv_usec: 0 }, -+ ru_stime: timeval { tv_sec: 0, tv_usec: 0 }, -+ ru_maxrss: 0, ru_ixrss: 0, ru_idrss: 0, ru_isrss: 0, -+ ru_minflt: 0, ru_majflt: 0, ru_nswap: 0, -+ ru_inblock: 0, ru_oublock: 0, -+ ru_msgsnd: 0, ru_msgrcv: 0, ru_nsignals: 0, -+ ru_nvcsw: 0, ru_nivcsw: 0, -+ }); - Ok(()) - } - -@@ -913,23 +903,7 @@ impl Pal for Sys { - Ok(()) - } - -- unsafe fn msync(addr: *mut c_void, len: usize, flags: c_int) -> Result<()> { -- todo_skip!( -- 0, -- "msync({:p}, 0x{:x}, 0x{:x}): not implemented", -- addr, -- len, -- flags -- ); -- Err(Errno(ENOSYS)) -- /* TODO -- syscall::msync( -- addr as usize, -- round_up_to_page_size(len), -- flags -- )?; -- */ -- } -+ unsafe fn msync(_addr: *mut c_void, _len: usize, _flags: c_int) -> Result<()> { Ok(()) } - - unsafe fn munlock(addr: *const c_void, len: usize) -> Result<()> { - // Redox never swaps -@@ -953,16 +927,7 @@ impl Pal for Sys { - Ok(()) - } - -- unsafe fn madvise(addr: *mut c_void, len: usize, flags: c_int) -> Result<()> { -- todo_skip!( -- 0, -- "madvise({:p}, 0x{:x}, 0x{:x}): not implemented", -- addr, -- len, -- flags -- ); -- Err(Errno(ENOSYS)) -- } -+ unsafe fn madvise(_addr: *mut c_void, _len: usize, _flags: c_int) -> Result<()> { Ok(()) } - - unsafe fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> Result<()> { - let redox_rqtp = unsafe { redox_timespec::from(&*rqtp) }; -@@ -1220,9 +1185,19 @@ impl Pal for Sys { - } - - unsafe fn setgroups(size: size_t, list: *const gid_t) -> Result<()> { -- // TODO -- todo_skip!(0, "setgroups({}, {:p}): not implemented", size, list); -- Err(Errno(ENOSYS)) -+ if size as usize > crate::header::limits::NGROUPS_MAX { -+ return Err(Errno(EINVAL)); -+ } -+ if size > 0 && list.is_null() { -+ return Err(Errno(EFAULT)); -+ } -+ let groups: &[u32] = if size == 0 { -+ &[] -+ } else { -+ core::slice::from_raw_parts(list as *const u32, size as usize) -+ }; -+ redox_rt::sys::posix_setgroups(groups)?; -+ Ok(()) - } - - fn setpgid(pid: pid_t, pgid: pid_t) -> Result<()> { diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P4-setgroups-unsafe-fix.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P4-setgroups-unsafe-fix.patch deleted file mode 100644 index 5caf531d8a..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P4-setgroups-unsafe-fix.patch +++ /dev/null @@ -1,196 +0,0 @@ -diff --git a/src/platform/redox/mod.rs b/src/platform/redox/mod.rs -index 752339a..90413f2 100644 ---- a/src/platform/redox/mod.rs -+++ b/src/platform/redox/mod.rs -@@ -43,7 +43,7 @@ use crate::{ - sys_file, - sys_mman::{MAP_ANONYMOUS, PROT_READ, PROT_WRITE}, - sys_random, -- sys_resource::{RLIM_INFINITY, rlimit, rusage}, -+ sys_resource::{RLIMIT_AS, RLIMIT_CORE, RLIMIT_DATA, RLIMIT_FSIZE, RLIMIT_NOFILE, RLIMIT_NPROC, RLIMIT_STACK, RLIM_INFINITY, rlimit, rusage}, - sys_select::timeval, - sys_stat::{S_ISVTX, stat}, - sys_statvfs::statvfs, -@@ -605,51 +605,17 @@ impl Pal for Sys { - } - - fn getgroups(mut list: Out<[gid_t]>) -> Result { -- // FIXME: this operation doesn't scale when group/passwd file grows -- -- let uid = Self::geteuid(); -- let pwd = crate::header::pwd::getpwuid(uid); -- -- if pwd.is_null() { -- return Err(Errno(ENOENT)); -- } -- -- let username = unsafe { CStr::from_ptr((*pwd).pw_name) }; -- let username = username.to_bytes_with_nul(); -- let mut count = 0; -- -- unsafe { -- use crate::header::grp; -- grp::setgrent(); -- -- while let Some(grp) = grp::getgrent().as_ref() { -- let mut i = 0; -- let mut found = false; -- -- while !(*grp.gr_mem.offset(i)).is_null() { -- let member = CStr::from_ptr(*grp.gr_mem.offset(i)); -- if member.to_bytes_with_nul() == username { -- found = true; -- break; -- } -- i += 1; -- } -- -- if found { -- if !list.is_empty() && (count as usize) < list.len() { -- list.index(count).write(grp.gr_gid); -- } -- count += 1; -- } -+ let groups = redox_rt::sys::posix_getgroups(); -+ let count = groups.len(); -+ if !list.is_empty() { -+ if count > list.len() { -+ return Err(Errno(EINVAL)); -+ } -+ for (i, gid) in groups.iter().enumerate() { -+ list.index(i as _).write(*gid as gid_t); - } -- grp::endgrent(); -- } -- -- if !list.is_empty() && (count as usize) > list.len() { -- return Err(Errno(EINVAL)); - } -- -- Ok(count as i32) -+ Ok(count as c_int) - } - - fn getpagesize() -> usize { -@@ -736,21 +702,45 @@ impl Pal for Sys { - } - - fn getrlimit(resource: c_int, mut rlim: Out) -> Result<()> { -- todo_skip!(0, "getrlimit({}, {:p}): not implemented", resource, rlim); -- rlim.write(rlimit { -- rlim_cur: RLIM_INFINITY, -- rlim_max: RLIM_INFINITY, -- }); -+ let (cur, max) = match resource as u32 { -+ r if r == RLIMIT_NOFILE as u32 => (1024, 4096), -+ r if r == RLIMIT_NPROC as u32 => (256, 1024), -+ r if r == RLIMIT_CORE as u32 => (0, RLIM_INFINITY), -+ r if r == RLIMIT_STACK as u32 => (8 * 1024 * 1024, RLIM_INFINITY), -+ r if r == RLIMIT_DATA as u32 => (RLIM_INFINITY, RLIM_INFINITY), -+ r if r == RLIMIT_AS as u32 => (RLIM_INFINITY, RLIM_INFINITY), -+ r if r == RLIMIT_FSIZE as u32 => (RLIM_INFINITY, RLIM_INFINITY), -+ _ => return Err(Errno(EINVAL)), -+ }; -+ rlim.write(rlimit { rlim_cur: cur, rlim_max: max }); - Ok(()) - } - -- unsafe fn setrlimit(resource: c_int, rlim: *const rlimit) -> Result<()> { -- todo_skip!(0, "setrlimit({}, {:p}): not implemented", resource, rlim); -- Err(Errno(EPERM)) -+ unsafe fn setrlimit(resource: c_int, _rlim: *const rlimit) -> Result<()> { -+ match resource as u32 { -+ r if r == RLIMIT_NOFILE as u32 || r == RLIMIT_NPROC as u32 => Err(Errno(EPERM)), -+ r if r == RLIMIT_CORE as u32 -+ || r == RLIMIT_STACK as u32 -+ || r == RLIMIT_DATA as u32 -+ || r == RLIMIT_AS as u32 -+ || r == RLIMIT_FSIZE as u32 => -+ { -+ Ok(()) -+ } -+ _ => Err(Errno(EINVAL)), -+ } - } - -- fn getrusage(who: c_int, r_usage: Out) -> Result<()> { -- todo_skip!(0, "getrusage({}, {:p}): not implemented", who, r_usage); -+ fn getrusage(_who: c_int, mut r_usage: Out) -> Result<()> { -+ r_usage.write(rusage { -+ ru_utime: timeval { tv_sec: 0, tv_usec: 0 }, -+ ru_stime: timeval { tv_sec: 0, tv_usec: 0 }, -+ ru_maxrss: 0, ru_ixrss: 0, ru_idrss: 0, ru_isrss: 0, -+ ru_minflt: 0, ru_majflt: 0, ru_nswap: 0, -+ ru_inblock: 0, ru_oublock: 0, -+ ru_msgsnd: 0, ru_msgrcv: 0, ru_nsignals: 0, -+ ru_nvcsw: 0, ru_nivcsw: 0, -+ }); - Ok(()) - } - -@@ -913,23 +903,7 @@ impl Pal for Sys { - Ok(()) - } - -- unsafe fn msync(addr: *mut c_void, len: usize, flags: c_int) -> Result<()> { -- todo_skip!( -- 0, -- "msync({:p}, 0x{:x}, 0x{:x}): not implemented", -- addr, -- len, -- flags -- ); -- Err(Errno(ENOSYS)) -- /* TODO -- syscall::msync( -- addr as usize, -- round_up_to_page_size(len), -- flags -- )?; -- */ -- } -+ unsafe fn msync(_addr: *mut c_void, _len: usize, _flags: c_int) -> Result<()> { Ok(()) } - - unsafe fn munlock(addr: *const c_void, len: usize) -> Result<()> { - // Redox never swaps -@@ -953,16 +927,7 @@ impl Pal for Sys { - Ok(()) - } - -- unsafe fn madvise(addr: *mut c_void, len: usize, flags: c_int) -> Result<()> { -- todo_skip!( -- 0, -- "madvise({:p}, 0x{:x}, 0x{:x}): not implemented", -- addr, -- len, -- flags -- ); -- Err(Errno(ENOSYS)) -- } -+ unsafe fn madvise(_addr: *mut c_void, _len: usize, _flags: c_int) -> Result<()> { Ok(()) } - - unsafe fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> Result<()> { - let redox_rqtp = unsafe { redox_timespec::from(&*rqtp) }; -@@ -1220,9 +1185,19 @@ impl Pal for Sys { - } - - unsafe fn setgroups(size: size_t, list: *const gid_t) -> Result<()> { -- // TODO -- todo_skip!(0, "setgroups({}, {:p}): not implemented", size, list); -- Err(Errno(ENOSYS)) -+ if size as usize > crate::header::limits::NGROUPS_MAX { -+ return Err(Errno(EINVAL)); -+ } -+ if size > 0 && list.is_null() { -+ return Err(Errno(EFAULT)); -+ } -+ let groups: &[u32] = if size == 0 { -+ &[] -+ } else { -+ unsafe { core::slice::from_raw_parts(list as *const u32, size as usize) } -+ }; -+ redox_rt::sys::posix_setgroups(groups)?; -+ Ok(()) - } - - fn setpgid(pid: pid_t, pgid: pid_t) -> Result<()> { diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P5-fatal-handler-diagnostics.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P5-fatal-handler-diagnostics.patch deleted file mode 100644 index f9fcc1c0f2..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P5-fatal-handler-diagnostics.patch +++ /dev/null @@ -1,188 +0,0 @@ -diff --git a/src/lib.rs b/src/lib.rs ---- a/src/lib.rs -+++ b/src/lib.rs -@@ -57,16 +57,151 @@ pub mod start; - pub mod sync; - --use crate::platform::{Allocator, NEWALLOCATOR}; -+use crate::platform::{Allocator, NEWALLOCATOR, Pal, Sys}; - - #[global_allocator] - static ALLOCATOR: Allocator = NEWALLOCATOR; -+ -+const MAX_FATAL_BACKTRACE_FRAMES: usize = 16; -+const MAX_FATAL_FRAME_STRIDE: usize = 1024 * 1024; -+ -+#[inline(never)] -+fn write_process_thread_identity(w: &mut platform::FileWriter) { -+ use core::fmt::Write; -+ -+ let pid = Sys::getpid(); -+ let tid = Sys::gettid(); -+ -+ match crate::pthread::current_thread() { -+ Some(thread) => { -+ let _ = w.write_fmt(format_args!( -+ "RELIBC CONTEXT: pid={} tid={} pthread={:#x}\n", -+ pid, -+ tid, -+ thread as *const _ as usize, -+ )); -+ } -+ None => { -+ let _ = w.write_fmt(format_args!( -+ "RELIBC CONTEXT: pid={} tid={} pthread=\n", -+ pid, tid, -+ )); -+ } -+ } -+} -+ -+#[cfg(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"))] -+#[inline(never)] -+fn current_frame_pointer() -> *const usize { -+ let frame: *const usize; -+ -+ #[cfg(target_arch = "x86_64")] -+ unsafe { -+ core::arch::asm!("mov {}, rbp", out(reg) frame, options(nomem, nostack, preserves_flags)); -+ } -+ -+ #[cfg(target_arch = "x86")] -+ unsafe { -+ core::arch::asm!("mov {}, ebp", out(reg) frame, options(nomem, nostack, preserves_flags)); -+ } -+ -+ #[cfg(target_arch = "aarch64")] -+ unsafe { -+ core::arch::asm!("mov {}, x29", out(reg) frame, options(nomem, nostack, preserves_flags)); -+ } -+ -+ frame -+} -+ -+#[cfg(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"))] -+fn read_backtrace_frame(frame: *const usize) -> Option<(*const usize, usize)> { -+ let align = core::mem::align_of::(); -+ let frame_addr = frame as usize; -+ -+ if frame.is_null() || frame_addr % align != 0 { -+ return None; -+ } -+ -+ let next_frame = unsafe { frame.read() } as *const usize; -+ let return_address = unsafe { frame.add(1).read() }; -+ -+ if return_address == 0 { -+ return None; -+ } -+ -+ Some((next_frame, return_address)) -+} -+ -+#[cfg(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"))] -+fn is_sane_next_backtrace_frame(current: *const usize, next: *const usize) -> bool { -+ let align = core::mem::align_of::(); -+ let current_addr = current as usize; -+ let next_addr = next as usize; -+ -+ !next.is_null() -+ && next_addr % align == 0 -+ && next_addr > current_addr -+ && next_addr - current_addr <= MAX_FATAL_FRAME_STRIDE -+} -+ -+#[inline(never)] -+fn write_best_effort_backtrace(w: &mut platform::FileWriter) { -+ use core::fmt::Write; -+ -+ let _ = w.write_str("RELIBC: attempting best-effort backtrace\n"); -+ -+ #[cfg(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"))] -+ { -+ let mut frame = current_frame_pointer(); -+ let mut wrote_frame = false; -+ -+ for frame_index in 0..MAX_FATAL_BACKTRACE_FRAMES { -+ let Some((next_frame, return_address)) = read_backtrace_frame(frame) else { -+ break; -+ }; -+ -+ wrote_frame = true; -+ let _ = w.write_fmt(format_args!( -+ "RELIBC BACKTRACE[{frame_index:02}]: {:#x}\n", -+ return_address, -+ )); -+ -+ if !is_sane_next_backtrace_frame(frame, next_frame) { -+ break; -+ } -+ -+ frame = next_frame; -+ } -+ -+ if !wrote_frame { -+ let _ = w.write_str("RELIBC: backtrace attempt produced no frames\n"); -+ } -+ } -+ -+ #[cfg(not(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64")))] -+ { -+ let _ = w.write_str("RELIBC: backtrace unavailable on this architecture\n"); -+ } -+} - - #[unsafe(no_mangle)] - pub extern "C" fn relibc_panic(pi: &::core::panic::PanicInfo) -> ! { - use core::fmt::Write; - - let mut w = platform::FileWriter::new(2); -- let _ = w.write_fmt(format_args!("RELIBC PANIC: {}\n", pi)); -+ -+ if let Some(location) = pi.location() { -+ let _ = w.write_fmt(format_args!( -+ "RELIBC PANIC LOCATION: {}:{}:{}\n", -+ location.file(), -+ location.line(), -+ location.column(), -+ )); -+ } else { -+ let _ = w.write_str("RELIBC PANIC LOCATION: \n"); -+ } -+ -+ write_process_thread_identity(&mut w); -+ let _ = w.write_fmt(format_args!("RELIBC PANIC: {}\n", pi)); - - core::intrinsics::abort(); - } -@@ -95,23 +235,28 @@ pub extern "C" fn rust_oom(layout: ::core::alloc::Layout) -> ! { - - let mut w = platform::FileWriter::new(2); - let _ = w.write_fmt(format_args!( -- "RELIBC OOM: {} bytes aligned to {} bytes\n", -+ "RELIBC OOM: {} bytes aligned to {} bytes - process will abort\n", - layout.size(), - layout.align() - )); -+ write_process_thread_identity(&mut w); -+ write_best_effort_backtrace(&mut w); - - core::intrinsics::abort(); - } - - #[cfg(not(test))] - #[allow(non_snake_case)] - #[linkage = "weak"] - #[unsafe(no_mangle)] - pub extern "C" fn _Unwind_Resume() -> ! { - use core::fmt::Write; - - let mut w = platform::FileWriter::new(2); -- let _ = w.write_str("_Unwind_Resume\n"); -+ let _ = w.write_str( -+ "RELIBC: _Unwind_Resume called - exception propagation failed, aborting\n", -+ ); -+ write_process_thread_identity(&mut w); - - core::intrinsics::abort(); - } diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P5-pthread-sigmask-race.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P5-pthread-sigmask-race.patch deleted file mode 100644 index b7b1677ce0..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P5-pthread-sigmask-race.patch +++ /dev/null @@ -1,63 +0,0 @@ -diff --git a/src/header/signal/mod.rs b/src/header/signal/mod.rs -index f049573..f3d665c 100644 ---- a/src/header/signal/mod.rs -+++ b/src/header/signal/mod.rs -@@ -2,7 +2,10 @@ - //! - //! See . - --use core::{mem, ptr}; -+use core::{ -+ mem, ptr, -+ sync::atomic::Ordering, -+}; - - use cbitset::BitSet; - -@@ -32,6 +35,9 @@ pub mod sys; - #[path = "redox.rs"] - pub mod sys; - -+mod signalfd; -+pub use self::signalfd::*; -+ - type SigSet = BitSet<[u64; 1]>; - - pub(crate) const SIG_DFL: usize = 0; -@@ -154,10 +160,15 @@ pub extern "C" fn killpg(pgrp: pid_t, sig: c_int) -> c_int { - /// See . - #[unsafe(no_mangle)] - pub unsafe extern "C" fn pthread_kill(thread: pthread_t, sig: c_int) -> c_int { -- let os_tid = { -- let pthread = unsafe { &*(thread as *const crate::pthread::Pthread) }; -- unsafe { pthread.os_tid.get().read() } -- }; -+ let pthread = unsafe { &*(thread as *const crate::pthread::Pthread) }; -+ let os_tid = unsafe { pthread.os_tid.get().read() }; -+ let flags = crate::pthread::PthreadFlags::from_bits_retain( -+ pthread.flags.load(Ordering::Acquire), -+ ); -+ if flags.contains(crate::pthread::PthreadFlags::FINISHED) { -+ return errno::ESRCH; -+ } -+ - crate::header::pthread::e(unsafe { Sys::rlct_kill(os_tid, sig as usize) }) - } - -@@ -168,12 +179,10 @@ pub unsafe extern "C" fn pthread_sigmask( - set: *const sigset_t, - oldset: *mut sigset_t, - ) -> c_int { -- // On Linux and Redox, pthread_sigmask and sigprocmask are equivalent -- if unsafe { sigprocmask(how, set, oldset) } == 0 { -- 0 -- } else { -- //TODO: Fix race -- platform::ERRNO.get() -+ let filtered_set = unsafe { set.as_ref().map(|&block| block & !RLCT_SIGNAL_MASK) }; -+ match unsafe { Sys::sigprocmask(how, filtered_set.as_ref(), oldset.as_mut()) } { -+ Ok(()) => 0, -+ Err(errno) => errno.0, - } - } - diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P5-robust-mutex-enotrec-fix.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P5-robust-mutex-enotrec-fix.patch deleted file mode 100644 index 05377d5fe1..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P5-robust-mutex-enotrec-fix.patch +++ /dev/null @@ -1,64 +0,0 @@ -Fix ENOTRECOVERABLE returned for non-robust mutexes and register main -thread in OS_TID_TO_PTHREAD. - -The robust mutex liveness check (mutex_owner_id_is_live) was returning -ENOTRECOVERABLE for non-robust mutexes when the owner appeared dead. -Per POSIX, the behaviour of a non-robust mutex whose owner has died is -undefined; returning an error crashes every Rust std::sync::Mutex user. -For lock_inner, fall through to spin/futex-wait instead. For try_lock, -return EBUSY instead. - -Additionally, pthread::init() never registered the main thread in -OS_TID_TO_PTHREAD, so any mutex owned by the main thread would always -appear to have a dead owner, making the liveness check unreliable. - -diff --git a/src/pthread/mod.rs b/src/pthread/mod.rs -index 8243a48..c455a67 100644 ---- a/src/pthread/mod.rs -+++ b/src/pthread/mod.rs -@@ -43,9 +43,13 @@ pub unsafe fn init() { - thread.stack_size = STACK_SIZE; - } - -- unsafe { Tcb::current() } -- .expect_notls("no TCB present for main thread") -- .pthread = thread; -+ let tcb = unsafe { Tcb::current() } -+ .expect_notls("no TCB present for main thread"); -+ tcb.pthread = thread; -+ -+ OS_TID_TO_PTHREAD -+ .lock() -+ .insert(Sys::current_os_tid(), ForceSendSync(tcb as *const Tcb as *mut Tcb)); - } - - //static NEXT_INDEX: AtomicU32 = AtomicU32::new(FIRST_THREAD_IDX + 1); -diff --git a/src/sync/pthread_mutex.rs b/src/sync/pthread_mutex.rs -index af0c429..1b2b3ca 100644 ---- a/src/sync/pthread_mutex.rs -+++ b/src/sync/pthread_mutex.rs -@@ -136,11 +136,7 @@ impl RlctMutex { - Err(thread) => { - let owner = thread & INDEX_MASK; - -- if !crate::pthread::mutex_owner_id_is_live(owner) { -- if !self.robust { -- return Err(Errno(ENOTRECOVERABLE)); -- } -- -+ if !crate::pthread::mutex_owner_id_is_live(owner) && self.robust { - let new_value = (thread & WAITING_BIT) | FUTEX_OWNER_DIED | this_thread; - match self.inner.compare_exchange( - thread, -@@ -152,6 +155,11 @@ impl RlctMutex { - Ok(_) => return self.finish_lock_acquire(true), - Err(_) => continue, - } -+ } else if !crate::pthread::mutex_owner_id_is_live(owner) { -+ // Non-robust mutex with apparently-dead owner: per POSIX the -+ // behaviour is undefined. We conservatively keep spinning / -+ // futex-waiting rather than returning ENOTRECOVERABLE, which -+ // would crash any Rust std::sync::Mutex user. - } - - if spins_left > 0 { diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P5-robust-mutexes.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P5-robust-mutexes.patch deleted file mode 100644 index 1c5880a410..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P5-robust-mutexes.patch +++ /dev/null @@ -1,380 +0,0 @@ -diff --git a/src/sync/pthread_mutex.rs b/src/sync/pthread_mutex.rs -index 29bad63..af0c429 100644 ---- a/src/sync/pthread_mutex.rs -+++ b/src/sync/pthread_mutex.rs -@@ -1,3 +1,4 @@ -+use alloc::boxed::Box; - use core::{ - cell::Cell, - sync::atomic::{AtomicU32 as AtomicUint, Ordering}, -@@ -6,10 +7,9 @@ use core::{ - use crate::{ - error::Errno, - header::{bits_timespec::timespec, errno::*, pthread::*}, -+ platform::{Pal, Sys, types::c_int}, - }; - --use crate::platform::{Pal, Sys, types::c_int}; -- - use super::FutexWaitResult; - - pub struct RlctMutex { -@@ -21,15 +21,22 @@ pub struct RlctMutex { - robust: bool, - } - -+pub struct RobustMutexNode { -+ pub next: *mut RobustMutexNode, -+ pub prev: *mut RobustMutexNode, -+ pub mutex: *const RlctMutex, -+} -+ - const STATE_UNLOCKED: u32 = 0; - const WAITING_BIT: u32 = 1 << 31; --const INDEX_MASK: u32 = !WAITING_BIT; -+const FUTEX_OWNER_DIED: u32 = 1 << 30; -+const INDEX_MASK: u32 = !(WAITING_BIT | FUTEX_OWNER_DIED); - - // TODO: Lower limit is probably better. - const RECURSIVE_COUNT_MAX_INCLUSIVE: u32 = u32::MAX; - // TODO: How many spins should we do before it becomes more time-economical to enter kernel mode - // via futexes? --const SPIN_COUNT: usize = 0; -+const SPIN_COUNT: usize = 100; - - impl RlctMutex { - pub(crate) fn new(attr: &RlctMutexAttr) -> Result { -@@ -69,13 +76,25 @@ impl RlctMutex { - Ok(0) - } - pub fn make_consistent(&self) -> Result<(), Errno> { -- todo_skip!(0, "pthread robust mutexes: not implemented"); -- Ok(()) -+ debug_assert!(self.robust, "make_consistent called on non-robust mutex"); -+ -+ if !self.robust { -+ return Err(Errno(EINVAL)); -+ } -+ -+ let current = self.inner.load(Ordering::Relaxed); -+ let owner = current & INDEX_MASK; -+ -+ if owner == os_tid_invalid_after_fork() && current & FUTEX_OWNER_DIED != 0 { -+ self.inner.store(0, Ordering::Release); -+ Ok(()) -+ } else { -+ Err(Errno(EINVAL)) -+ } - } - fn lock_inner(&self, deadline: Option<×pec>) -> Result<(), Errno> { - let this_thread = os_tid_invalid_after_fork(); -- -- //let mut spins_left = SPIN_COUNT; -+ let mut spins_left = SPIN_COUNT; - - loop { - let result = self.inner.compare_exchange_weak( -@@ -86,45 +105,59 @@ impl RlctMutex { - ); - - match result { -- // CAS succeeded -- Ok(_) => { -- if self.ty == Ty::Recursive { -- self.increment_recursive_count()?; -- } -- return Ok(()); -- } -- // CAS failed, but the mutex was recursive and we already own the lock. -+ Ok(_) => return self.finish_lock_acquire(false), - Err(thread) if thread & INDEX_MASK == this_thread && self.ty == Ty::Recursive => { - self.increment_recursive_count()?; - return Ok(()); - } -- // CAS failed, but the mutex was error-checking and we already own the lock. - Err(thread) if thread & INDEX_MASK == this_thread && self.ty == Ty::Errck => { -- return Err(Errno(EAGAIN)); -+ return Err(Errno(EDEADLK)); - } -- // CAS spuriously failed, simply retry the CAS. TODO: Use core::hint::spin_loop()? -- Err(thread) if thread & INDEX_MASK == 0 => { -- continue; -+ Err(thread) if thread & FUTEX_OWNER_DIED != 0 && thread & INDEX_MASK == 0 => { -+ return Err(Errno(ENOTRECOVERABLE)); - } -- // CAS failed because some other thread owned the lock. We must now wait. -+ Err(thread) if thread & FUTEX_OWNER_DIED != 0 => { -+ if !self.robust { -+ return Err(Errno(ENOTRECOVERABLE)); -+ } -+ -+ let new_value = (thread & WAITING_BIT) | FUTEX_OWNER_DIED | this_thread; -+ match self.inner.compare_exchange( -+ thread, -+ new_value, -+ Ordering::Acquire, -+ Ordering::Relaxed, -+ ) { -+ Ok(_) => return self.finish_lock_acquire(true), -+ Err(_) => continue, -+ } -+ } -+ Err(thread) if thread & INDEX_MASK == 0 => continue, - Err(thread) => { -- /*if spins_left > 0 { -- // TODO: Faster to spin trying to load the flag, compared to CAS? -+ let owner = thread & INDEX_MASK; -+ -+ if !crate::pthread::mutex_owner_id_is_live(owner) { -+ if !self.robust { -+ return Err(Errno(ENOTRECOVERABLE)); -+ } -+ -+ let new_value = (thread & WAITING_BIT) | FUTEX_OWNER_DIED | this_thread; -+ match self.inner.compare_exchange( -+ thread, -+ new_value, -+ Ordering::Acquire, -+ Ordering::Relaxed, -+ ) { -+ Ok(_) => return self.finish_lock_acquire(true), -+ Err(_) => continue, -+ } -+ } -+ -+ if spins_left > 0 { - spins_left -= 1; - core::hint::spin_loop(); - continue; - } -- -- spins_left = SPIN_COUNT; -- -- let inner = self.inner.fetch_or(WAITING_BIT, Ordering::Relaxed); -- -- if inner == STATE_UNLOCKED { -- continue; -- }*/ -- -- // If the mutex is not robust, simply futex_wait until unblocked. -- //crate::sync::futex_wait(&self.inner, inner | WAITING_BIT, None); - if crate::sync::futex_wait(&self.inner, thread, deadline) - == FutexWaitResult::TimedOut - { -@@ -140,6 +173,20 @@ impl RlctMutex { - pub fn lock_with_timeout(&self, deadline: ×pec) -> Result<(), Errno> { - self.lock_inner(Some(deadline)) - } -+ fn finish_lock_acquire(&self, owner_dead: bool) -> Result<(), Errno> { -+ if self.ty == Ty::Recursive { -+ self.increment_recursive_count()?; -+ } -+ if self.robust { -+ add_to_robust_list(self); -+ } -+ -+ if owner_dead { -+ Err(Errno(EOWNERDEAD)) -+ } else { -+ Ok(()) -+ } -+ } - fn increment_recursive_count(&self) -> Result<(), Errno> { - // We don't have to worry about asynchronous signals here, since pthread_mutex_trylock - // is not async-signal-safe. -@@ -161,41 +208,65 @@ impl RlctMutex { - pub fn try_lock(&self) -> Result<(), Errno> { - let this_thread = os_tid_invalid_after_fork(); - -- // TODO: If recursive, omitting CAS may be faster if it is already owned by this thread. -- let result = self.inner.compare_exchange( -- STATE_UNLOCKED, -- this_thread, -- Ordering::Acquire, -- Ordering::Relaxed, -- ); -+ loop { -+ let current = self.inner.load(Ordering::Relaxed); -+ -+ if current == STATE_UNLOCKED { -+ match self.inner.compare_exchange( -+ STATE_UNLOCKED, -+ this_thread, -+ Ordering::Acquire, -+ Ordering::Relaxed, -+ ) { -+ Ok(_) => return self.finish_lock_acquire(false), -+ Err(_) => continue, -+ } -+ } - -- if self.ty == Ty::Recursive { -- match result { -- Err(index) if index & INDEX_MASK != this_thread => return Err(Errno(EBUSY)), -- _ => (), -+ let owner = current & INDEX_MASK; -+ -+ if owner == this_thread && self.ty == Ty::Recursive { -+ self.increment_recursive_count()?; -+ return Ok(()); - } - -- self.increment_recursive_count()?; -+ if owner == this_thread && self.ty == Ty::Errck { -+ return Err(Errno(EDEADLK)); -+ } - -- return Ok(()); -- } -+ if current & FUTEX_OWNER_DIED != 0 && owner == 0 { -+ return Err(Errno(ENOTRECOVERABLE)); -+ } - -- match result { -- Ok(_) => Ok(()), -- Err(index) if index & INDEX_MASK == this_thread && self.ty == Ty::Errck => { -- Err(Errno(EDEADLK)) -+ if current & FUTEX_OWNER_DIED != 0 || (owner != 0 && !crate::pthread::mutex_owner_id_is_live(owner)) { -+ if !self.robust { -+ return Err(Errno(ENOTRECOVERABLE)); -+ } -+ -+ let new_value = (current & WAITING_BIT) | FUTEX_OWNER_DIED | this_thread; -+ match self.inner.compare_exchange( -+ current, -+ new_value, -+ Ordering::Acquire, -+ Ordering::Relaxed, -+ ) { -+ Ok(_) => return self.finish_lock_acquire(true), -+ Err(_) => continue, -+ } - } -- Err(_) => Err(Errno(EBUSY)), -+ -+ return Err(Errno(EBUSY)); - } - } - // Safe because we are not protecting any data. - pub fn unlock(&self) -> Result<(), Errno> { -+ let current = self.inner.load(Ordering::Relaxed); -+ - if self.robust || matches!(self.ty, Ty::Recursive | Ty::Errck) { -- if self.inner.load(Ordering::Relaxed) & INDEX_MASK != os_tid_invalid_after_fork() { -+ if current & INDEX_MASK != os_tid_invalid_after_fork() { - return Err(Errno(EPERM)); - } - -- // TODO: Is this fence correct? - core::sync::atomic::fence(Ordering::Acquire); - } - -@@ -208,18 +279,47 @@ impl RlctMutex { - } - } - -- self.inner.store(STATE_UNLOCKED, Ordering::Release); -- crate::sync::futex_wake(&self.inner, i32::MAX); -- /*let was_waiting = self.inner.swap(STATE_UNLOCKED, Ordering::Release) & WAITING_BIT != 0; -+ if self.robust { -+ remove_from_robust_list(self); -+ } - -- if was_waiting { -- let _ = crate::sync::futex_wake(&self.inner, 1); -- }*/ -+ let new_state = if self.robust && current & FUTEX_OWNER_DIED != 0 { -+ FUTEX_OWNER_DIED -+ } else { -+ STATE_UNLOCKED -+ }; -+ -+ self.inner.store(new_state, Ordering::Release); -+ crate::sync::futex_wake(&self.inner, i32::MAX); - - Ok(()) - } - } - -+pub(crate) unsafe fn mark_robust_mutexes_dead(thread: &crate::pthread::Pthread) { -+ let head = thread.robust_list_head.get(); -+ let this_thread = os_tid_invalid_after_fork(); -+ let mut node = unsafe { *head }; -+ -+ unsafe { *head = core::ptr::null_mut() }; -+ -+ while !node.is_null() { -+ let next = unsafe { (*node).next }; -+ let mutex = unsafe { &*(*node).mutex }; -+ let current = mutex.inner.load(Ordering::Relaxed); -+ -+ if current & INDEX_MASK == this_thread { -+ mutex -+ .inner -+ .store((current & WAITING_BIT) | FUTEX_OWNER_DIED | this_thread, Ordering::Release); -+ crate::sync::futex_wake(&mutex.inner, i32::MAX); -+ } -+ -+ unsafe { drop(Box::from_raw(node)) }; -+ node = next; -+ } -+} -+ - #[repr(u8)] - #[derive(PartialEq)] - enum Ty { -@@ -237,6 +337,54 @@ enum Ty { - #[thread_local] - static CACHED_OS_TID_INVALID_AFTER_FORK: Cell = Cell::new(0); - -+fn add_to_robust_list(mutex: &RlctMutex) { -+ let thread = crate::pthread::current_thread().expect("current thread not present"); -+ let node_ptr = Box::into_raw(Box::new(RobustMutexNode { -+ next: core::ptr::null_mut(), -+ prev: core::ptr::null_mut(), -+ mutex: core::ptr::from_ref(mutex), -+ })); -+ -+ unsafe { -+ let head = thread.robust_list_head.get(); -+ if !(*head).is_null() { -+ (**head).prev = node_ptr; -+ } -+ (*node_ptr).next = *head; -+ *head = node_ptr; -+ } -+} -+ -+fn remove_from_robust_list(mutex: &RlctMutex) { -+ let thread = match crate::pthread::current_thread() { -+ Some(thread) => thread, -+ None => return, -+ }; -+ -+ unsafe { -+ let mut node = *thread.robust_list_head.get(); -+ -+ while !node.is_null() { -+ if core::ptr::eq((*node).mutex, core::ptr::from_ref(mutex)) { -+ if !(*node).prev.is_null() { -+ (*(*node).prev).next = (*node).next; -+ } else { -+ *thread.robust_list_head.get() = (*node).next; -+ } -+ -+ if !(*node).next.is_null() { -+ (*(*node).next).prev = (*node).prev; -+ } -+ -+ drop(Box::from_raw(node)); -+ return; -+ } -+ -+ node = (*node).next; -+ } -+ } -+} -+ - // Assumes TIDs are unique between processes, which I only know is true for Redox. - fn os_tid_invalid_after_fork() -> u32 { - // TODO: Coordinate better if using shared == PTHREAD_PROCESS_SHARED, with up to 2^32 separate diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P5-sched-api.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P5-sched-api.patch deleted file mode 100644 index b7bc9a27c7..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P5-sched-api.patch +++ /dev/null @@ -1,130 +0,0 @@ -diff --git a/src/header/sched/mod.rs b/src/header/sched/mod.rs -index bcdd346..6066550 100644 ---- a/src/header/sched/mod.rs -+++ b/src/header/sched/mod.rs -@@ -27,43 +27,110 @@ pub const SCHED_RR: c_int = 1; - pub const SCHED_OTHER: c_int = 2; - - /// See . --// #[unsafe(no_mangle)] -+#[unsafe(no_mangle)] - pub extern "C" fn sched_get_priority_max(policy: c_int) -> c_int { -- todo!() -+ match policy { -+ SCHED_FIFO | SCHED_RR => 99, -+ SCHED_OTHER => 0, -+ _ => { -+ crate::platform::ERRNO.set(crate::header::errno::EINVAL); -+ -1 -+ } -+ } - } - --/// See . --// #[unsafe(no_mangle)] -+/// See . -+#[unsafe(no_mangle)] - pub extern "C" fn sched_get_priority_min(policy: c_int) -> c_int { -- todo!() -+ match policy { -+ SCHED_FIFO | SCHED_RR => 1, -+ SCHED_OTHER => 0, -+ _ => { -+ crate::platform::ERRNO.set(crate::header::errno::EINVAL); -+ -1 -+ } -+ } - } - - /// See . --// #[unsafe(no_mangle)] -+#[unsafe(no_mangle)] - pub unsafe extern "C" fn sched_getparam(pid: pid_t, param: *mut sched_param) -> c_int { -- todo!() -+ if pid != 0 { -+ crate::platform::ERRNO.set(crate::header::errno::ESRCH); -+ return -1; -+ } -+ crate::platform::ERRNO.set(crate::header::errno::ENOSYS); -+ -1 -+} -+ -+/// See . -+#[unsafe(no_mangle)] -+pub extern "C" fn sched_getscheduler(pid: pid_t) -> c_int { -+ if pid != 0 { -+ crate::platform::ERRNO.set(crate::header::errno::ESRCH); -+ return -1; -+ } -+ crate::platform::ERRNO.set(crate::header::errno::ENOSYS); -+ -1 - } - - /// See . --// #[unsafe(no_mangle)] --pub extern "C" fn sched_rr_get_interval(pid: pid_t, time: *const timespec) -> c_int { -- todo!() -+#[unsafe(no_mangle)] -+pub extern "C" fn sched_rr_get_interval(pid: pid_t, tp: *mut timespec) -> c_int { -+ if pid != 0 { -+ crate::platform::ERRNO.set(crate::header::errno::ESRCH); -+ return -1; -+ } -+ if tp.is_null() { -+ crate::platform::ERRNO.set(crate::header::errno::EINVAL); -+ return -1; -+ } -+ unsafe { -+ (*tp).tv_sec = 0; -+ (*tp).tv_nsec = 100_000_000; // 100ms default SCHED_RR quantum -+ } -+ 0 - } - - /// See . --// #[unsafe(no_mangle)] --pub unsafe extern "C" fn sched_setparam(pid: pid_t, param: *const sched_param) -> c_int { -- todo!() -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn sched_setparam(pid: pid_t, _param: *const sched_param) -> c_int { -+ if pid != 0 { -+ crate::platform::ERRNO.set(crate::header::errno::ESRCH); -+ return -1; -+ } -+ crate::platform::ERRNO.set(crate::header::errno::ENOSYS); -+ -1 - } - - /// See . --// #[unsafe(no_mangle)] -+#[unsafe(no_mangle)] - pub extern "C" fn sched_setscheduler( - pid: pid_t, - policy: c_int, - param: *const sched_param, - ) -> c_int { -- todo!() -+ if pid != 0 { -+ crate::platform::ERRNO.set(crate::header::errno::ESRCH); -+ return -1; -+ } -+ match policy { -+ SCHED_OTHER => { -+ if !param.is_null() && unsafe { (*param).sched_priority } != 0 { -+ crate::platform::ERRNO.set(crate::header::errno::EINVAL); -+ return -1; -+ } -+ SCHED_OTHER -+ } -+ SCHED_FIFO | SCHED_RR => { -+ crate::platform::ERRNO.set(crate::header::errno::ENOSYS); -+ -1 -+ } -+ _ => { -+ crate::platform::ERRNO.set(crate::header::errno::EINVAL); -+ -1 -+ } -+ } - } - - /// See . diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P5-signal-handler-panic-hardening.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P5-signal-handler-panic-hardening.patch deleted file mode 100644 index 944a0e11ff..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P5-signal-handler-panic-hardening.patch +++ /dev/null @@ -1,112 +0,0 @@ -diff --git a/redox-rt/src/signal.rs b/redox-rt/src/signal.rs -index 022f873..ab96dea 100644 ---- a/redox-rt/src/signal.rs -+++ b/redox-rt/src/signal.rs -@@ -1,4 +1,10 @@ --use core::{ffi::c_int, ptr::NonNull, sync::atomic::Ordering}; -+use core::{ -+ ffi::c_int, -+ hint::unreachable_unchecked, -+ panic::AssertUnwindSafe, -+ ptr::NonNull, -+ sync::atomic::Ordering, -+}; - - use syscall::{ - CallFlags, EAGAIN, EINTR, EINVAL, ENOMEM, EPERM, Error, RawAction, Result, SenderInfo, -@@ -103,6 +109,47 @@ pub struct SiginfoAbi { - pub si_value: usize, // sigval - } - -+fn invoke_signal_handler(f: AssertUnwindSafe) -> bool { -+ fn do_call(data: *mut u8) { -+ let callback = unsafe { &mut *data.cast::>>() }; -+ if let Some(callback) = callback.take() { -+ callback.0(); -+ } -+ } -+ -+ fn do_catch(_data: *mut u8, _payload: *mut u8) {} -+ -+ let mut callback = Some(f); -+ unsafe { -+ core::intrinsics::catch_unwind( -+ do_call::, -+ (&mut callback as *mut Option>).cast(), -+ do_catch::, -+ ) != 0 -+ } -+} -+ -+#[inline(always)] -+unsafe fn return_ignored_signal( -+ os: &RtTcb, -+ stack: &SigStack, -+ signals_were_disabled: bool, -+) { -+ unsafe { -+ (*os.arch.get()).last_sig_was_restart = true; -+ (*os.arch.get()).last_sigstack = NonNull::new(stack.link); -+ } -+ -+ if !signals_were_disabled { -+ core::sync::atomic::compiler_fence(Ordering::Release); -+ let control_flags = &os.control.control_flags; -+ control_flags.store( -+ control_flags.load(Ordering::Relaxed) & !SigcontrolFlags::INHIBIT_DELIVERY.bits(), -+ Ordering::Relaxed, -+ ); -+ } -+} -+ - #[inline(always)] - unsafe fn inner(stack: &mut SigStack) { - let os = unsafe { &Tcb::current().unwrap().os_specific }; -@@ -168,7 +215,10 @@ unsafe fn inner(stack: &mut SigStack) { - // and reaching this code. If so, we do already know whether the signal is IGNORED *now*, - // and so we should return early ideally without even temporarily touching the signal mask. - SigactionKind::Ignore => { -- panic!("ctl {:#x?} signal {}", os.control, stack.sig_num) -+ unsafe { -+ return_ignored_signal(os, stack, signals_were_disabled); -+ } -+ return; - } - // this case should be treated equally as the one above - // -@@ -183,7 +233,9 @@ unsafe fn inner(stack: &mut SigStack) { - CallFlags::empty(), - &[ProcCall::Exit as u64, u64::from(sig) << 8], - ); -- panic!() -+ // SAFETY: ProcCall::Exit terminates the current process when it succeeds, so reaching -+ // this point would violate the proc manager exit contract. -+ unsafe { unreachable_unchecked() } - } - SigactionKind::Handled { handler } => handler, - }; -@@ -224,15 +276,21 @@ unsafe fn inner(stack: &mut SigStack) { - si_uid: sender_uid as i32, - si_value: stack.sival, - }; -- unsafe { -+ if invoke_signal_handler(AssertUnwindSafe(|| unsafe { - sigaction( - stack.sig_num as c_int, - core::ptr::addr_of!(info).cast(), - stack as *mut SigStack as *mut (), - ) -- }; -+ })) { -+ let _ = syscall::write(2, b"redox-rt: sa_siginfo handler panicked; continuing\n"); -+ } - } else if let Some(handler) = unsafe { handler.handler } { -- handler(stack.sig_num as c_int); -+ if invoke_signal_handler(AssertUnwindSafe(|| { -+ handler(stack.sig_num as c_int); -+ })) { -+ let _ = syscall::write(2, b"redox-rt: sa_handler panicked; continuing\n"); -+ } - } - - // Disable signals while we modify the sigmask again diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P5-startup-init-panic-hardening.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P5-startup-init-panic-hardening.patch deleted file mode 100644 index c887c019a8..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P5-startup-init-panic-hardening.patch +++ /dev/null @@ -1,101 +0,0 @@ -diff --git a/src/start.rs b/src/start.rs ---- a/src/start.rs -+++ b/src/start.rs -@@ -1,10 +1,7 @@ - //! Startup code. - - use alloc::{boxed::Box, vec::Vec}; --use core::{intrinsics, ptr}; -- --#[cfg(target_os = "redox")] --use generic_rt::ExpectTlsFree; -+use core::{fmt::Write, intrinsics, panic::AssertUnwindSafe, ptr}; - - use crate::{ - ALLOCATOR, -@@ -143,6 +141,29 @@ fn io_init() { - stdio::stderr = stdio::default_stderr().get(); - } - } -+ -+fn catch_unwind(f: AssertUnwindSafe) -> Result<(), ()> { -+ fn do_call(data: *mut u8) { -+ let callback = unsafe { &mut *data.cast::>>() }; -+ if let Some(callback) = callback.take() { -+ callback.0(); -+ } -+ } -+ -+ fn do_catch(_data: *mut u8, _payload: *mut u8) {} -+ -+ let mut callback = Some(f); -+ let panicked = unsafe { -+ intrinsics::catch_unwind( -+ do_call::, -+ (&mut callback as *mut Option>).cast(), -+ do_catch::, -+ ) != 0 -+ }; -+ -+ if panicked { Err(()) } else { Ok(()) } -+} -+ - #[cold] - fn abort_startup(args: core::fmt::Arguments<'_>) -> ! { - let mut w = platform::FileWriter::new(2); -@@ -164,14 +184,23 @@ pub unsafe extern "C" fn relibc_start_v1( - unsafe { relibc_verify_host() }; - - #[cfg(target_os = "redox")] -- let thr_fd = redox_rt::proc::FdGuard::new( -- unsafe { -- crate::platform::get_auxv_raw(sp.auxv().cast(), redox_rt::auxv_defs::AT_REDOX_THR_FD) -- } -- .expect_notls("no thread fd present"), -- ) -- .to_upper() -- .expect_notls("failed to move thread fd to upper table"); -+ let thr_fd = { -+ let thr_fd = match unsafe { -+ crate::platform::get_auxv_raw(sp.auxv().cast(), redox_rt::auxv_defs::AT_REDOX_THR_FD) -+ } { -+ Some(thr_fd) => thr_fd, -+ None => abort_startup(format_args!( -+ "relibc_start_v1: missing AT_REDOX_THR_FD auxv entry; no thread fd present\n" -+ )), -+ }; -+ -+ match redox_rt::proc::FdGuard::new(thr_fd).to_upper() { -+ Ok(thr_fd) => thr_fd, -+ Err(err) => abort_startup(format_args!( -+ "relibc_start_v1: failed to move thread fd to upper table: {err:?}\n" -+ )), -+ } -+ }; - - // Initialize TLS, if necessary - unsafe { -@@ -237,7 +266,10 @@ pub unsafe extern "C" fn relibc_start_v1( - let mut f = unsafe { &__preinit_array_start } as *const _; - #[allow(clippy::op_ref)] - while f < &raw const __preinit_array_end { -- (unsafe { *f })(); -+ let func = unsafe { *f }; -+ if catch_unwind(AssertUnwindSafe(|| unsafe { (*f)() })).is_err() { -+ log_initializer_panic(".preinit_array", func); -+ } - f = unsafe { f.offset(1) }; - } - } -@@ -247,7 +279,10 @@ pub unsafe extern "C" fn relibc_start_v1( - let mut f = unsafe { &__init_array_start } as *const _; - #[allow(clippy::op_ref)] - while f < &raw const __init_array_end { -- (unsafe { *f })(); -+ let func = unsafe { *f }; -+ if catch_unwind(AssertUnwindSafe(|| unsafe { (*f)() })).is_err() { -+ log_initializer_panic(".init_array", func); -+ } - f = unsafe { f.offset(1) }; - } - } diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P7-pthread-affinity.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P7-pthread-affinity.patch deleted file mode 100644 index 1657124162..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P7-pthread-affinity.patch +++ /dev/null @@ -1,231 +0,0 @@ -diff --git a/src/header/pthread/cbindgen.toml b/src/header/pthread/cbindgen.toml ---- a/src/header/pthread/cbindgen.toml -+++ b/src/header/pthread/cbindgen.toml -@@ -10,0 +11 @@ cpp_compat = true -+"cpu_set_t" = "struct cpu_set_t" -diff --git a/src/header/pthread/mod.rs b/src/header/pthread/mod.rs ---- a/src/header/pthread/mod.rs -+++ b/src/header/pthread/mod.rs -@@ -6 +6,8 @@ use alloc::collections::LinkedList; --use core::{cell::Cell, ptr::NonNull}; -+use core::{cell::Cell, mem::size_of, ptr::NonNull}; -+ -+#[cfg(target_os = "linux")] -+use sc::syscall; -+#[cfg(target_os = "redox")] -+use redox_rt::proc::FdGuard; -+#[cfg(target_os = "redox")] -+use syscall; -@@ -9,0 +17 @@ use crate::{ -+ header::errno::EINVAL, -@@ -14 +22 @@ use crate::{ -- c_int, c_uchar, c_uint, c_void, clockid_t, pthread_attr_t, pthread_barrier_t, -+ c_char, c_int, c_uchar, c_uint, c_void, clockid_t, pthread_attr_t, pthread_barrier_t, -@@ -22,0 +31,3 @@ use crate::{ -+#[cfg(target_os = "linux")] -+use crate::platform::sys::e_raw; -+ -@@ -29,0 +41,93 @@ pub fn e(result: Result<(), Errno>) -> i32 { -+const RLCT_AFFINITY_BYTES: usize = size_of::(); -+const RLCT_MAX_AFFINITY_CPUS: usize = u64::BITS as usize; -+ -+fn cpuset_bytes<'a>(cpusetsize: size_t, cpuset: *const cpu_set_t) -> Result<&'a [u8], Errno> { -+ if cpuset.is_null() || !(RLCT_AFFINITY_BYTES..=size_of::()).contains(&cpusetsize) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(unsafe { core::slice::from_raw_parts(cpuset.cast::(), cpusetsize) }) -+} -+ -+fn cpuset_bytes_mut<'a>( -+ cpusetsize: size_t, -+ cpuset: *mut cpu_set_t, -+) -> Result<&'a mut [u8], Errno> { -+ if cpuset.is_null() || !(RLCT_AFFINITY_BYTES..=size_of::()).contains(&cpusetsize) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(unsafe { core::slice::from_raw_parts_mut(cpuset.cast::(), cpusetsize) }) -+} -+ -+fn cpuset_to_u64(cpusetsize: size_t, cpuset: *const cpu_set_t) -> Result { -+ let bytes = cpuset_bytes(cpusetsize, cpuset)?; -+ let mut mask = 0_u64; -+ -+ for (byte_index, byte) in bytes.iter().copied().enumerate() { -+ for bit in 0..u8::BITS as usize { -+ if byte & (1 << bit) == 0 { -+ continue; -+ } -+ -+ let cpu = byte_index * u8::BITS as usize + bit; -+ if cpu >= RLCT_MAX_AFFINITY_CPUS { -+ return Err(Errno(EINVAL)); -+ } -+ -+ mask |= 1_u64 << cpu; -+ } -+ } -+ -+ Ok(mask) -+} -+ -+fn copy_u64_to_cpuset(mask: u64, cpusetsize: size_t, cpuset: *mut cpu_set_t) -> Result<(), Errno> { -+ let bytes = cpuset_bytes_mut(cpusetsize, cpuset)?; -+ bytes.fill(0); -+ -+ for (byte_index, dst) in bytes.iter_mut().take(RLCT_AFFINITY_BYTES).enumerate() { -+ *dst = (mask >> (byte_index * u8::BITS as usize)) as u8; -+ } -+ -+ Ok(()) -+} -+ -+#[cfg(target_os = "redox")] -+fn redox_set_thread_affinity(thread: &pthread::Pthread, mask: u64) -> Result<(), Errno> { -+ let mut kernel_cpuset = cpu_set_t::default(); -+ kernel_cpuset.__bits[0] = mask; -+ -+ let handle = FdGuard::new(unsafe { -+ syscall::dup(thread.os_tid.get().read().thread_fd, b"sched-affinity")? -+ }); -+ let _ = handle.write(unsafe { -+ core::slice::from_raw_parts( -+ core::ptr::from_ref(&kernel_cpuset).cast::(), -+ size_of::(), -+ ) -+ })?; -+ -+ Ok(()) -+} -+ -+#[cfg(target_os = "redox")] -+fn redox_get_thread_affinity(thread: &pthread::Pthread) -> Result { -+ let handle = FdGuard::new(unsafe { -+ syscall::dup(thread.os_tid.get().read().thread_fd, b"sched-affinity")? -+ }); -+ let mut kernel_cpuset = cpu_set_t::default(); -+ let _ = handle.read(unsafe { -+ core::slice::from_raw_parts_mut( -+ core::ptr::from_mut(&mut kernel_cpuset).cast::(), -+ size_of::(), -+ ) -+ })?; -+ -+ if kernel_cpuset.__bits[1..].iter().any(|bits| *bits != 0) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(kernel_cpuset.__bits[0]) -+} -+ -@@ -188,0 +293,36 @@ pub unsafe extern "C" fn pthread_getcpuclockid( -+/// GNU extension. See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_getaffinity_np( -+ thread: pthread_t, -+ cpusetsize: size_t, -+ cpuset: *mut cpu_set_t, -+) -> c_int { -+ let thread: &pthread::Pthread = unsafe { &*thread.cast() }; -+ -+ let result = { -+ #[cfg(target_os = "redox")] -+ { -+ redox_get_thread_affinity(thread).and_then(|mask| copy_u64_to_cpuset(mask, cpusetsize, cpuset)) -+ } -+ -+ #[cfg(target_os = "linux")] -+ { -+ if cpuset.is_null() { -+ Err(Errno(EINVAL)) -+ } else { -+ e_raw(unsafe { -+ syscall!( -+ SCHED_GETAFFINITY, -+ thread.os_tid.get().read().thread_id, -+ cpusetsize, -+ cpuset.cast::() -+ ) -+ }) -+ .map(|_| ()) -+ } -+ } -+ }; -+ -+ e(result) -+} -+ -@@ -237,0 +378,36 @@ pub unsafe extern "C" fn pthread_self() -> pthread_t { -+/// GNU extension. See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_setaffinity_np( -+ thread: pthread_t, -+ cpusetsize: size_t, -+ cpuset: *const cpu_set_t, -+) -> c_int { -+ let thread: &pthread::Pthread = unsafe { &*thread.cast() }; -+ -+ let result = { -+ #[cfg(target_os = "redox")] -+ { -+ cpuset_to_u64(cpusetsize, cpuset).and_then(|mask| redox_set_thread_affinity(thread, mask)) -+ } -+ -+ #[cfg(target_os = "linux")] -+ { -+ if cpuset.is_null() { -+ Err(Errno(EINVAL)) -+ } else { -+ e_raw(unsafe { -+ syscall!( -+ SCHED_SETAFFINITY, -+ thread.os_tid.get().read().thread_id, -+ cpusetsize, -+ cpuset.cast::() -+ ) -+ }) -+ .map(|_| ()) -+ } -+ } -+ }; -+ -+ e(result) -+} -+ -diff --git a/src/header/sched/cbindgen.toml b/src/header/sched/cbindgen.toml ---- a/src/header/sched/cbindgen.toml -+++ b/src/header/sched/cbindgen.toml -@@ -22,0 +23,14 @@ prefix_with_name = true -+ -+[export] -+include = [ -+ "sched_param", -+ "cpu_set_t", -+ "sched_get_priority_max", -+ "sched_get_priority_min", -+ "sched_getparam", -+ "sched_getscheduler", -+ "sched_rr_get_interval", -+ "sched_setparam", -+ "sched_setscheduler", -+ "sched_yield", -+] -diff --git a/src/header/sched/mod.rs b/src/header/sched/mod.rs ---- a/src/header/sched/mod.rs -+++ b/src/header/sched/mod.rs -@@ -12,0 +13,2 @@ -+pub const CPU_SETSIZE: usize = 1024; -+ -@@ -20,0 +23,7 @@ -+/// Linux-compatible CPU affinity mask storage. -+#[repr(C)] -+#[derive(Clone, Copy, Debug, Default)] -+pub struct cpu_set_t { -+ pub __bits: [u64; 16], -+} -+ -@@ -143,0 +153,3 @@ -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn cbindgen_stupid_struct_user_for_cpu_set_t(_: cpu_set_t) {} diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P7-pthread-setname.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P7-pthread-setname.patch deleted file mode 100644 index efcee1b879..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P7-pthread-setname.patch +++ /dev/null @@ -1,326 +0,0 @@ -diff --git a/src/header/pthread/mod.rs b/src/header/pthread/mod.rs -index c742a42..008090a 100644 ---- a/src/header/pthread/mod.rs -+++ b/src/header/pthread/mod.rs -@@ -3,15 +3,26 @@ - //! See . - - use alloc::collections::LinkedList; --use core::{cell::Cell, ptr::NonNull}; -+use core::{cell::Cell, mem::size_of, ptr::NonNull}; -+ -+#[cfg(target_os = "redox")] -+use redox_rt::proc::FdGuard; -+#[cfg(target_os = "linux")] -+use sc::syscall; -+#[cfg(target_os = "redox")] -+use syscall; - - use crate::{ - error::Errno, -- header::{bits_timespec::timespec, sched::*}, -+ header::{ -+ bits_timespec::timespec, -+ errno::{EINVAL, ERANGE}, -+ sched::*, -+ }, - platform::{ - Pal, Sys, - types::{ -- c_int, c_uchar, c_uint, c_void, clockid_t, pthread_attr_t, pthread_barrier_t, -+ c_char, c_int, c_uchar, c_uint, c_void, clockid_t, pthread_attr_t, pthread_barrier_t, - pthread_barrierattr_t, pthread_cond_t, pthread_condattr_t, pthread_key_t, - pthread_mutex_t, pthread_mutexattr_t, pthread_once_t, pthread_rwlock_t, - pthread_rwlockattr_t, pthread_spinlock_t, pthread_t, size_t, -@@ -20,6 +31,9 @@ use crate::{ - pthread, - }; - -+#[cfg(target_os = "linux")] -+use crate::platform::sys::e_raw; -+ - pub fn e(result: Result<(), Errno>) -> i32 { - match result { - Ok(()) => 0, -@@ -27,6 +41,96 @@ pub fn e(result: Result<(), Errno>) -> i32 { - } - } - -+const RLCT_AFFINITY_BYTES: usize = size_of::(); -+const RLCT_MAX_AFFINITY_CPUS: usize = u64::BITS as usize; -+ -+fn cpuset_bytes<'a>(cpusetsize: size_t, cpuset: *const cpu_set_t) -> Result<&'a [u8], Errno> { -+ if cpuset.is_null() || !(RLCT_AFFINITY_BYTES..=size_of::()).contains(&cpusetsize) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(unsafe { core::slice::from_raw_parts(cpuset.cast::(), cpusetsize) }) -+} -+ -+fn cpuset_bytes_mut<'a>(cpusetsize: size_t, cpuset: *mut cpu_set_t) -> Result<&'a mut [u8], Errno> { -+ if cpuset.is_null() || !(RLCT_AFFINITY_BYTES..=size_of::()).contains(&cpusetsize) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(unsafe { core::slice::from_raw_parts_mut(cpuset.cast::(), cpusetsize) }) -+} -+ -+fn cpuset_to_u64(cpusetsize: size_t, cpuset: *const cpu_set_t) -> Result { -+ let bytes = cpuset_bytes(cpusetsize, cpuset)?; -+ let mut mask = 0_u64; -+ -+ for (byte_index, byte) in bytes.iter().copied().enumerate() { -+ for bit in 0..u8::BITS as usize { -+ if byte & (1 << bit) == 0 { -+ continue; -+ } -+ -+ let cpu = byte_index * u8::BITS as usize + bit; -+ if cpu >= RLCT_MAX_AFFINITY_CPUS { -+ return Err(Errno(EINVAL)); -+ } -+ -+ mask |= 1_u64 << cpu; -+ } -+ } -+ -+ Ok(mask) -+} -+ -+fn copy_u64_to_cpuset(mask: u64, cpusetsize: size_t, cpuset: *mut cpu_set_t) -> Result<(), Errno> { -+ let bytes = cpuset_bytes_mut(cpusetsize, cpuset)?; -+ bytes.fill(0); -+ -+ for (byte_index, dst) in bytes.iter_mut().take(RLCT_AFFINITY_BYTES).enumerate() { -+ *dst = (mask >> (byte_index * u8::BITS as usize)) as u8; -+ } -+ -+ Ok(()) -+} -+ -+#[cfg(target_os = "redox")] -+fn redox_set_thread_affinity(thread: &pthread::Pthread, mask: u64) -> Result<(), Errno> { -+ let mut kernel_cpuset = cpu_set_t::default(); -+ kernel_cpuset.__bits[0] = mask; -+ -+ let handle = FdGuard::new(unsafe { -+ syscall::dup(thread.os_tid.get().read().thread_fd, b"sched-affinity")? -+ }); -+ let _ = handle.write(unsafe { -+ core::slice::from_raw_parts( -+ core::ptr::from_ref(&kernel_cpuset).cast::(), -+ size_of::(), -+ ) -+ })?; -+ -+ Ok(()) -+} -+ -+#[cfg(target_os = "redox")] -+fn redox_get_thread_affinity(thread: &pthread::Pthread) -> Result { -+ let handle = FdGuard::new(unsafe { -+ syscall::dup(thread.os_tid.get().read().thread_fd, b"sched-affinity")? -+ }); -+ let mut kernel_cpuset = cpu_set_t::default(); -+ let _ = handle.read(unsafe { -+ core::slice::from_raw_parts_mut( -+ core::ptr::from_mut(&mut kernel_cpuset).cast::(), -+ size_of::(), -+ ) -+ })?; -+ -+ if kernel_cpuset.__bits[1..].iter().any(|bits| *bits != 0) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(kernel_cpuset.__bits[0]) -+} -+ - #[derive(Clone)] - pub(crate) struct RlctAttr { - pub detachstate: c_uchar, -@@ -186,6 +290,43 @@ pub unsafe extern "C" fn pthread_getcpuclockid( - } - } - -+/// GNU extension. See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_getaffinity_np( -+ thread: pthread_t, -+ cpusetsize: size_t, -+ cpuset: *mut cpu_set_t, -+) -> c_int { -+ let thread: &pthread::Pthread = unsafe { &*thread.cast() }; -+ -+ let result = { -+ #[cfg(target_os = "redox")] -+ { -+ redox_get_thread_affinity(thread) -+ .and_then(|mask| copy_u64_to_cpuset(mask, cpusetsize, cpuset)) -+ } -+ -+ #[cfg(target_os = "linux")] -+ { -+ if cpuset.is_null() { -+ Err(Errno(EINVAL)) -+ } else { -+ e_raw(unsafe { -+ syscall!( -+ SCHED_GETAFFINITY, -+ thread.os_tid.get().read().thread_id, -+ cpusetsize, -+ cpuset.cast::() -+ ) -+ }) -+ .map(|_| ()) -+ } -+ } -+ }; -+ -+ e(result) -+} -+ - /// See . - #[unsafe(no_mangle)] - pub unsafe extern "C" fn pthread_getschedparam( -@@ -235,6 +376,43 @@ pub unsafe extern "C" fn pthread_self() -> pthread_t { - core::ptr::from_ref(unsafe { pthread::current_thread().unwrap_unchecked() }) as *mut _ - } - -+/// GNU extension. See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_setaffinity_np( -+ thread: pthread_t, -+ cpusetsize: size_t, -+ cpuset: *const cpu_set_t, -+) -> c_int { -+ let thread: &pthread::Pthread = unsafe { &*thread.cast() }; -+ -+ let result = { -+ #[cfg(target_os = "redox")] -+ { -+ cpuset_to_u64(cpusetsize, cpuset) -+ .and_then(|mask| redox_set_thread_affinity(thread, mask)) -+ } -+ -+ #[cfg(target_os = "linux")] -+ { -+ if cpuset.is_null() { -+ Err(Errno(EINVAL)) -+ } else { -+ e_raw(unsafe { -+ syscall!( -+ SCHED_SETAFFINITY, -+ thread.os_tid.get().read().thread_id, -+ cpusetsize, -+ cpuset.cast::() -+ ) -+ }) -+ .map(|_| ()) -+ } -+ } -+ }; -+ -+ e(result) -+} -+ - /// See . - #[unsafe(no_mangle)] - pub unsafe extern "C" fn pthread_setcancelstate(state: c_int, oldstate: *mut c_int) -> c_int { -@@ -307,6 +485,13 @@ pub unsafe extern "C" fn pthread_testcancel() { - unsafe { pthread::testcancel() }; - } - -+/// -+/// -+/// Non-standard GNU extension. Prefer `sched_yield()` instead. -+pub extern "C" fn pthread_yield() { -+ let _ = Sys::sched_yield(); -+} -+ - // Must be the same struct as defined in the pthread_cleanup_push macro. - #[repr(C)] - pub(crate) struct CleanupLinkedListEntry { -@@ -350,3 +535,82 @@ pub(crate) unsafe fn run_destructor_stack() { - (entry.routine)(entry.arg); - } - } -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_setname_np(thread: pthread_t, name: *const c_char) -> c_int { -+ if name.is_null() { -+ return EINVAL; -+ } -+ -+ let cstr = unsafe { core::ffi::CStr::from_ptr(name) }; -+ let name_bytes = cstr.to_bytes(); -+ let len = name_bytes.len().min(31); -+ -+ #[cfg(target_os = "redox")] -+ { -+ let thread = unsafe { &*thread.cast::() }; -+ let os_tid = unsafe { thread.os_tid.get().read() }; -+ let path = alloc::format!("proc:{}/name", os_tid.thread_fd); -+ let fd = match Sys::open(&path, crate::header::fcntl::O_WRONLY, 0) { -+ Ok(fd) => fd, -+ Err(Errno(code)) => return code, -+ }; -+ -+ let result = match Sys::write(fd, &name_bytes[..len]) { -+ Ok(written) if written == len => 0, -+ Ok(_) => crate::header::errno::EIO, -+ Err(Errno(code)) => code, -+ }; -+ let _ = Sys::close(fd); -+ result -+ } -+ #[cfg(not(target_os = "redox"))] -+ { -+ let _ = thread; -+ 0 -+ } -+} -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_getname_np( -+ thread: pthread_t, -+ name: *mut c_char, -+ len: size_t, -+) -> c_int { -+ if name.is_null() { -+ return EINVAL; -+ } -+ if len == 0 { -+ return ERANGE; -+ } -+ -+ #[cfg(target_os = "redox")] -+ { -+ let thread = unsafe { &*thread.cast::() }; -+ let os_tid = unsafe { thread.os_tid.get().read() }; -+ let path = alloc::format!("proc:{}/name", os_tid.thread_fd); -+ let fd = match Sys::open(&path, crate::header::fcntl::O_RDONLY, 0) { -+ Ok(fd) => fd, -+ Err(Errno(code)) => return code, -+ }; -+ -+ let mut buf = [0u8; 31]; -+ let result = match Sys::read(fd, &mut buf) { -+ Ok(read) if read < len => { -+ unsafe { core::ptr::copy_nonoverlapping(buf.as_ptr(), name.cast(), read) }; -+ unsafe { *name.add(read) = 0 }; -+ 0 -+ } -+ Ok(_) => ERANGE, -+ Err(Errno(code)) => code, -+ }; -+ let _ = Sys::close(fd); -+ result -+ } -+ #[cfg(not(target_os = "redox"))] -+ { -+ let _ = thread; -+ unsafe { *name = 0 }; -+ 0 -+ } -+} diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P7-setpriority.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P7-setpriority.patch deleted file mode 100644 index 34b328e30f..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P7-setpriority.patch +++ /dev/null @@ -1,104 +0,0 @@ -diff --git a/src/platform/redox/mod.rs b/src/platform/redox/mod.rs ---- a/src/platform/redox/mod.rs -+++ b/src/platform/redox/mod.rs -@@ -77,12 +77,74 @@ static mut BRK_CUR: *mut c_void = ptr::null_mut(); - static mut BRK_END: *mut c_void = ptr::null_mut(); - - const PAGE_SIZE: usize = 4096; -+const NICE_MIN: c_int = -20; -+const NICE_MAX: c_int = 19; - - fn round_up_to_page_size(val: usize) -> Option { - val.checked_add(PAGE_SIZE) - .map(|val| (val - 1) / PAGE_SIZE * PAGE_SIZE) - } -+ -+fn is_current_process_priority_target(which: c_int, who: id_t) -> bool { -+ which == crate::header::sys_resource::PRIO_PROCESS -+ && (who == 0 || who == redox_rt::sys::posix_getpid() as id_t) -+} -+ -+fn current_process_thread_handle(index: usize) -> Result> { -+ let thread_name = format!("thread-{index}"); -+ match redox_rt::current_proc_fd().dup(thread_name.as_bytes()) { -+ Ok(thread_fd) => Ok(Some(thread_fd)), -+ Err(error) if error.errno == ENOENT => Ok(None), -+ Err(error) => Err(Errno(error.errno)), -+ } -+} -+ -+fn current_process_priority_handle(index: usize) -> Result> { -+ let Some(thread_fd) = current_process_thread_handle(index)? else { -+ return Ok(None); -+ }; -+ -+ thread_fd -+ .dup(b"priority") -+ .map(Some) -+ .map_err(|error| Errno(error.errno)) -+} -+ -+fn read_current_process_nice() -> Result { -+ let Some(priority_fd) = current_process_priority_handle(0)? else { -+ return Err(Errno(ESRCH)); -+ }; -+ -+ let mut nice_bytes = [0_u8; size_of::()]; -+ if priority_fd.read(&mut nice_bytes)? != size_of::() { -+ return Err(Errno(EIO)); -+ } -+ -+ Ok(c_int::from_ne_bytes(nice_bytes)) -+} -+ -+fn write_current_process_nice(nice: c_int) -> Result<()> { -+ let mut updated_threads = 0; -+ let nice_bytes = nice.to_ne_bytes(); -+ -+ for index in 0.. { -+ let Some(priority_fd) = current_process_priority_handle(index)? else { -+ break; -+ }; -+ -+ if priority_fd.write(&nice_bytes)? != nice_bytes.len() { -+ return Err(Errno(EIO)); -+ } -+ updated_threads += 1; -+ } -+ -+ if updated_threads == 0 { -+ return Err(Errno(ESRCH)); -+ } -+ -+ Ok(()) -+} - - fn cvt_uid(id: c_int) -> Result> { - if id == -1 { - return Ok(None); -@@ -698,6 +761,11 @@ impl Pal for Sys { - } - - fn getpriority(which: c_int, who: id_t) -> Result { -+ if is_current_process_priority_target(which, who) { -+ let nice = read_current_process_nice()?; -+ return Ok(20 - nice); -+ } -+ - match redox_rt::sys::posix_getpriority(which, who as u32) { - Ok(kernel_prio) => { - let posix_prio = (kernel_prio as i32 * -1) + 40 as i32; -@@ -1274,7 +1342,12 @@ impl Pal for Sys { - } - - fn setpriority(which: c_int, who: id_t, prio: c_int) -> Result<()> { -- let clamped_prio = prio.clamp(-20, 19); -+ let clamped_prio = prio.clamp(NICE_MIN, NICE_MAX); -+ -+ if is_current_process_priority_target(which, who) { -+ return write_current_process_nice(clamped_prio); -+ } -+ - let kernel_prio = (20 + clamped_prio) as u32; - - match redox_rt::sys::posix_setpriority(which, who as u32, kernel_prio) { diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P9-pthread-open-fix.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P9-pthread-open-fix.patch deleted file mode 100644 index efcee1b879..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P9-pthread-open-fix.patch +++ /dev/null @@ -1,326 +0,0 @@ -diff --git a/src/header/pthread/mod.rs b/src/header/pthread/mod.rs -index c742a42..008090a 100644 ---- a/src/header/pthread/mod.rs -+++ b/src/header/pthread/mod.rs -@@ -3,15 +3,26 @@ - //! See . - - use alloc::collections::LinkedList; --use core::{cell::Cell, ptr::NonNull}; -+use core::{cell::Cell, mem::size_of, ptr::NonNull}; -+ -+#[cfg(target_os = "redox")] -+use redox_rt::proc::FdGuard; -+#[cfg(target_os = "linux")] -+use sc::syscall; -+#[cfg(target_os = "redox")] -+use syscall; - - use crate::{ - error::Errno, -- header::{bits_timespec::timespec, sched::*}, -+ header::{ -+ bits_timespec::timespec, -+ errno::{EINVAL, ERANGE}, -+ sched::*, -+ }, - platform::{ - Pal, Sys, - types::{ -- c_int, c_uchar, c_uint, c_void, clockid_t, pthread_attr_t, pthread_barrier_t, -+ c_char, c_int, c_uchar, c_uint, c_void, clockid_t, pthread_attr_t, pthread_barrier_t, - pthread_barrierattr_t, pthread_cond_t, pthread_condattr_t, pthread_key_t, - pthread_mutex_t, pthread_mutexattr_t, pthread_once_t, pthread_rwlock_t, - pthread_rwlockattr_t, pthread_spinlock_t, pthread_t, size_t, -@@ -20,6 +31,9 @@ use crate::{ - pthread, - }; - -+#[cfg(target_os = "linux")] -+use crate::platform::sys::e_raw; -+ - pub fn e(result: Result<(), Errno>) -> i32 { - match result { - Ok(()) => 0, -@@ -27,6 +41,96 @@ pub fn e(result: Result<(), Errno>) -> i32 { - } - } - -+const RLCT_AFFINITY_BYTES: usize = size_of::(); -+const RLCT_MAX_AFFINITY_CPUS: usize = u64::BITS as usize; -+ -+fn cpuset_bytes<'a>(cpusetsize: size_t, cpuset: *const cpu_set_t) -> Result<&'a [u8], Errno> { -+ if cpuset.is_null() || !(RLCT_AFFINITY_BYTES..=size_of::()).contains(&cpusetsize) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(unsafe { core::slice::from_raw_parts(cpuset.cast::(), cpusetsize) }) -+} -+ -+fn cpuset_bytes_mut<'a>(cpusetsize: size_t, cpuset: *mut cpu_set_t) -> Result<&'a mut [u8], Errno> { -+ if cpuset.is_null() || !(RLCT_AFFINITY_BYTES..=size_of::()).contains(&cpusetsize) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(unsafe { core::slice::from_raw_parts_mut(cpuset.cast::(), cpusetsize) }) -+} -+ -+fn cpuset_to_u64(cpusetsize: size_t, cpuset: *const cpu_set_t) -> Result { -+ let bytes = cpuset_bytes(cpusetsize, cpuset)?; -+ let mut mask = 0_u64; -+ -+ for (byte_index, byte) in bytes.iter().copied().enumerate() { -+ for bit in 0..u8::BITS as usize { -+ if byte & (1 << bit) == 0 { -+ continue; -+ } -+ -+ let cpu = byte_index * u8::BITS as usize + bit; -+ if cpu >= RLCT_MAX_AFFINITY_CPUS { -+ return Err(Errno(EINVAL)); -+ } -+ -+ mask |= 1_u64 << cpu; -+ } -+ } -+ -+ Ok(mask) -+} -+ -+fn copy_u64_to_cpuset(mask: u64, cpusetsize: size_t, cpuset: *mut cpu_set_t) -> Result<(), Errno> { -+ let bytes = cpuset_bytes_mut(cpusetsize, cpuset)?; -+ bytes.fill(0); -+ -+ for (byte_index, dst) in bytes.iter_mut().take(RLCT_AFFINITY_BYTES).enumerate() { -+ *dst = (mask >> (byte_index * u8::BITS as usize)) as u8; -+ } -+ -+ Ok(()) -+} -+ -+#[cfg(target_os = "redox")] -+fn redox_set_thread_affinity(thread: &pthread::Pthread, mask: u64) -> Result<(), Errno> { -+ let mut kernel_cpuset = cpu_set_t::default(); -+ kernel_cpuset.__bits[0] = mask; -+ -+ let handle = FdGuard::new(unsafe { -+ syscall::dup(thread.os_tid.get().read().thread_fd, b"sched-affinity")? -+ }); -+ let _ = handle.write(unsafe { -+ core::slice::from_raw_parts( -+ core::ptr::from_ref(&kernel_cpuset).cast::(), -+ size_of::(), -+ ) -+ })?; -+ -+ Ok(()) -+} -+ -+#[cfg(target_os = "redox")] -+fn redox_get_thread_affinity(thread: &pthread::Pthread) -> Result { -+ let handle = FdGuard::new(unsafe { -+ syscall::dup(thread.os_tid.get().read().thread_fd, b"sched-affinity")? -+ }); -+ let mut kernel_cpuset = cpu_set_t::default(); -+ let _ = handle.read(unsafe { -+ core::slice::from_raw_parts_mut( -+ core::ptr::from_mut(&mut kernel_cpuset).cast::(), -+ size_of::(), -+ ) -+ })?; -+ -+ if kernel_cpuset.__bits[1..].iter().any(|bits| *bits != 0) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(kernel_cpuset.__bits[0]) -+} -+ - #[derive(Clone)] - pub(crate) struct RlctAttr { - pub detachstate: c_uchar, -@@ -186,6 +290,43 @@ pub unsafe extern "C" fn pthread_getcpuclockid( - } - } - -+/// GNU extension. See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_getaffinity_np( -+ thread: pthread_t, -+ cpusetsize: size_t, -+ cpuset: *mut cpu_set_t, -+) -> c_int { -+ let thread: &pthread::Pthread = unsafe { &*thread.cast() }; -+ -+ let result = { -+ #[cfg(target_os = "redox")] -+ { -+ redox_get_thread_affinity(thread) -+ .and_then(|mask| copy_u64_to_cpuset(mask, cpusetsize, cpuset)) -+ } -+ -+ #[cfg(target_os = "linux")] -+ { -+ if cpuset.is_null() { -+ Err(Errno(EINVAL)) -+ } else { -+ e_raw(unsafe { -+ syscall!( -+ SCHED_GETAFFINITY, -+ thread.os_tid.get().read().thread_id, -+ cpusetsize, -+ cpuset.cast::() -+ ) -+ }) -+ .map(|_| ()) -+ } -+ } -+ }; -+ -+ e(result) -+} -+ - /// See . - #[unsafe(no_mangle)] - pub unsafe extern "C" fn pthread_getschedparam( -@@ -235,6 +376,43 @@ pub unsafe extern "C" fn pthread_self() -> pthread_t { - core::ptr::from_ref(unsafe { pthread::current_thread().unwrap_unchecked() }) as *mut _ - } - -+/// GNU extension. See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_setaffinity_np( -+ thread: pthread_t, -+ cpusetsize: size_t, -+ cpuset: *const cpu_set_t, -+) -> c_int { -+ let thread: &pthread::Pthread = unsafe { &*thread.cast() }; -+ -+ let result = { -+ #[cfg(target_os = "redox")] -+ { -+ cpuset_to_u64(cpusetsize, cpuset) -+ .and_then(|mask| redox_set_thread_affinity(thread, mask)) -+ } -+ -+ #[cfg(target_os = "linux")] -+ { -+ if cpuset.is_null() { -+ Err(Errno(EINVAL)) -+ } else { -+ e_raw(unsafe { -+ syscall!( -+ SCHED_SETAFFINITY, -+ thread.os_tid.get().read().thread_id, -+ cpusetsize, -+ cpuset.cast::() -+ ) -+ }) -+ .map(|_| ()) -+ } -+ } -+ }; -+ -+ e(result) -+} -+ - /// See . - #[unsafe(no_mangle)] - pub unsafe extern "C" fn pthread_setcancelstate(state: c_int, oldstate: *mut c_int) -> c_int { -@@ -307,6 +485,13 @@ pub unsafe extern "C" fn pthread_testcancel() { - unsafe { pthread::testcancel() }; - } - -+/// -+/// -+/// Non-standard GNU extension. Prefer `sched_yield()` instead. -+pub extern "C" fn pthread_yield() { -+ let _ = Sys::sched_yield(); -+} -+ - // Must be the same struct as defined in the pthread_cleanup_push macro. - #[repr(C)] - pub(crate) struct CleanupLinkedListEntry { -@@ -350,3 +535,82 @@ pub(crate) unsafe fn run_destructor_stack() { - (entry.routine)(entry.arg); - } - } -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_setname_np(thread: pthread_t, name: *const c_char) -> c_int { -+ if name.is_null() { -+ return EINVAL; -+ } -+ -+ let cstr = unsafe { core::ffi::CStr::from_ptr(name) }; -+ let name_bytes = cstr.to_bytes(); -+ let len = name_bytes.len().min(31); -+ -+ #[cfg(target_os = "redox")] -+ { -+ let thread = unsafe { &*thread.cast::() }; -+ let os_tid = unsafe { thread.os_tid.get().read() }; -+ let path = alloc::format!("proc:{}/name", os_tid.thread_fd); -+ let fd = match Sys::open(&path, crate::header::fcntl::O_WRONLY, 0) { -+ Ok(fd) => fd, -+ Err(Errno(code)) => return code, -+ }; -+ -+ let result = match Sys::write(fd, &name_bytes[..len]) { -+ Ok(written) if written == len => 0, -+ Ok(_) => crate::header::errno::EIO, -+ Err(Errno(code)) => code, -+ }; -+ let _ = Sys::close(fd); -+ result -+ } -+ #[cfg(not(target_os = "redox"))] -+ { -+ let _ = thread; -+ 0 -+ } -+} -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_getname_np( -+ thread: pthread_t, -+ name: *mut c_char, -+ len: size_t, -+) -> c_int { -+ if name.is_null() { -+ return EINVAL; -+ } -+ if len == 0 { -+ return ERANGE; -+ } -+ -+ #[cfg(target_os = "redox")] -+ { -+ let thread = unsafe { &*thread.cast::() }; -+ let os_tid = unsafe { thread.os_tid.get().read() }; -+ let path = alloc::format!("proc:{}/name", os_tid.thread_fd); -+ let fd = match Sys::open(&path, crate::header::fcntl::O_RDONLY, 0) { -+ Ok(fd) => fd, -+ Err(Errno(code)) => return code, -+ }; -+ -+ let mut buf = [0u8; 31]; -+ let result = match Sys::read(fd, &mut buf) { -+ Ok(read) if read < len => { -+ unsafe { core::ptr::copy_nonoverlapping(buf.as_ptr(), name.cast(), read) }; -+ unsafe { *name.add(read) = 0 }; -+ 0 -+ } -+ Ok(_) => ERANGE, -+ Err(Errno(code)) => code, -+ }; -+ let _ = Sys::close(fd); -+ result -+ } -+ #[cfg(not(target_os = "redox"))] -+ { -+ let _ = thread; -+ unsafe { *name = 0 }; -+ 0 -+ } -+} diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P9-spin-and-barrier.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P9-spin-and-barrier.patch deleted file mode 100644 index ef71957b8f..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P9-spin-and-barrier.patch +++ /dev/null @@ -1,43 +0,0 @@ -diff --git a/src/sync/pthread_mutex.rs b/src/sync/pthread_mutex.rs -index 2871a6149..3c8e73f15 100644 ---- a/src/sync/pthread_mutex.rs -+++ b/src/sync/pthread_mutex.rs -@@ -35,7 +35,7 @@ const FUTEX_OWNER_DIED: u32 = 1 << 30; - const INDEX_MASK: u32 = !(WAITING_BIT | FUTEX_OWNER_DIED); - // TODO: Lower limit is probably better. - const RECURSIVE_COUNT_MAX_INCLUSIVE: u32 = u32::MAX; --const SPIN_COUNT: usize = 0; -+const SPIN_COUNT: usize = 100; - - impl RlctMutex { - pub(crate) fn new(attr: &RlctMutexAttr) -> Result { -diff --git a/src/sync/barrier.rs b/src/sync/barrier.rs -index b5847b5..a8e3c2f0 100644 ---- a/src/sync/barrier.rs -+++ b/src/sync/barrier.rs -@@ -47,6 +47,8 @@ impl Barrier { - cvar: FutexState::new(count.get()), - } - } -+ pub fn destroy(&self) {} -+ - pub fn wait(&self) -> WaitResult { - let _ = &self.lock; - let sense = self.cvar.sense.load(Ordering::Acquire); -diff --git a/src/header/pthread/barrier.rs b/src/header/pthread/barrier.rs -index 1a5df3a..e69e2b9 100644 ---- a/src/header/pthread/barrier.rs -+++ b/src/header/pthread/barrier.rs -@@ -24,10 +24,8 @@ pub(crate) struct RlctBarrierAttr { - // Not async-signal-safe. - #[unsafe(no_mangle)] - pub unsafe extern "C" fn pthread_barrier_destroy(barrier: *mut pthread_barrier_t) -> c_int { -- // Behavior is undefined if any thread is currently waiting when this is called. -- -- // No-op, currently. -- unsafe { core::ptr::drop_in_place(barrier.cast::()) }; -+ let barrier = unsafe { &*barrier.cast::() }; -+ barrier.destroy(); - - 0 - } \ No newline at end of file diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/P9-spin-fix.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/P9-spin-fix.patch deleted file mode 100644 index 1c5880a410..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/P9-spin-fix.patch +++ /dev/null @@ -1,380 +0,0 @@ -diff --git a/src/sync/pthread_mutex.rs b/src/sync/pthread_mutex.rs -index 29bad63..af0c429 100644 ---- a/src/sync/pthread_mutex.rs -+++ b/src/sync/pthread_mutex.rs -@@ -1,3 +1,4 @@ -+use alloc::boxed::Box; - use core::{ - cell::Cell, - sync::atomic::{AtomicU32 as AtomicUint, Ordering}, -@@ -6,10 +7,9 @@ use core::{ - use crate::{ - error::Errno, - header::{bits_timespec::timespec, errno::*, pthread::*}, -+ platform::{Pal, Sys, types::c_int}, - }; - --use crate::platform::{Pal, Sys, types::c_int}; -- - use super::FutexWaitResult; - - pub struct RlctMutex { -@@ -21,15 +21,22 @@ pub struct RlctMutex { - robust: bool, - } - -+pub struct RobustMutexNode { -+ pub next: *mut RobustMutexNode, -+ pub prev: *mut RobustMutexNode, -+ pub mutex: *const RlctMutex, -+} -+ - const STATE_UNLOCKED: u32 = 0; - const WAITING_BIT: u32 = 1 << 31; --const INDEX_MASK: u32 = !WAITING_BIT; -+const FUTEX_OWNER_DIED: u32 = 1 << 30; -+const INDEX_MASK: u32 = !(WAITING_BIT | FUTEX_OWNER_DIED); - - // TODO: Lower limit is probably better. - const RECURSIVE_COUNT_MAX_INCLUSIVE: u32 = u32::MAX; - // TODO: How many spins should we do before it becomes more time-economical to enter kernel mode - // via futexes? --const SPIN_COUNT: usize = 0; -+const SPIN_COUNT: usize = 100; - - impl RlctMutex { - pub(crate) fn new(attr: &RlctMutexAttr) -> Result { -@@ -69,13 +76,25 @@ impl RlctMutex { - Ok(0) - } - pub fn make_consistent(&self) -> Result<(), Errno> { -- todo_skip!(0, "pthread robust mutexes: not implemented"); -- Ok(()) -+ debug_assert!(self.robust, "make_consistent called on non-robust mutex"); -+ -+ if !self.robust { -+ return Err(Errno(EINVAL)); -+ } -+ -+ let current = self.inner.load(Ordering::Relaxed); -+ let owner = current & INDEX_MASK; -+ -+ if owner == os_tid_invalid_after_fork() && current & FUTEX_OWNER_DIED != 0 { -+ self.inner.store(0, Ordering::Release); -+ Ok(()) -+ } else { -+ Err(Errno(EINVAL)) -+ } - } - fn lock_inner(&self, deadline: Option<×pec>) -> Result<(), Errno> { - let this_thread = os_tid_invalid_after_fork(); -- -- //let mut spins_left = SPIN_COUNT; -+ let mut spins_left = SPIN_COUNT; - - loop { - let result = self.inner.compare_exchange_weak( -@@ -86,45 +105,59 @@ impl RlctMutex { - ); - - match result { -- // CAS succeeded -- Ok(_) => { -- if self.ty == Ty::Recursive { -- self.increment_recursive_count()?; -- } -- return Ok(()); -- } -- // CAS failed, but the mutex was recursive and we already own the lock. -+ Ok(_) => return self.finish_lock_acquire(false), - Err(thread) if thread & INDEX_MASK == this_thread && self.ty == Ty::Recursive => { - self.increment_recursive_count()?; - return Ok(()); - } -- // CAS failed, but the mutex was error-checking and we already own the lock. - Err(thread) if thread & INDEX_MASK == this_thread && self.ty == Ty::Errck => { -- return Err(Errno(EAGAIN)); -+ return Err(Errno(EDEADLK)); - } -- // CAS spuriously failed, simply retry the CAS. TODO: Use core::hint::spin_loop()? -- Err(thread) if thread & INDEX_MASK == 0 => { -- continue; -+ Err(thread) if thread & FUTEX_OWNER_DIED != 0 && thread & INDEX_MASK == 0 => { -+ return Err(Errno(ENOTRECOVERABLE)); - } -- // CAS failed because some other thread owned the lock. We must now wait. -+ Err(thread) if thread & FUTEX_OWNER_DIED != 0 => { -+ if !self.robust { -+ return Err(Errno(ENOTRECOVERABLE)); -+ } -+ -+ let new_value = (thread & WAITING_BIT) | FUTEX_OWNER_DIED | this_thread; -+ match self.inner.compare_exchange( -+ thread, -+ new_value, -+ Ordering::Acquire, -+ Ordering::Relaxed, -+ ) { -+ Ok(_) => return self.finish_lock_acquire(true), -+ Err(_) => continue, -+ } -+ } -+ Err(thread) if thread & INDEX_MASK == 0 => continue, - Err(thread) => { -- /*if spins_left > 0 { -- // TODO: Faster to spin trying to load the flag, compared to CAS? -+ let owner = thread & INDEX_MASK; -+ -+ if !crate::pthread::mutex_owner_id_is_live(owner) { -+ if !self.robust { -+ return Err(Errno(ENOTRECOVERABLE)); -+ } -+ -+ let new_value = (thread & WAITING_BIT) | FUTEX_OWNER_DIED | this_thread; -+ match self.inner.compare_exchange( -+ thread, -+ new_value, -+ Ordering::Acquire, -+ Ordering::Relaxed, -+ ) { -+ Ok(_) => return self.finish_lock_acquire(true), -+ Err(_) => continue, -+ } -+ } -+ -+ if spins_left > 0 { - spins_left -= 1; - core::hint::spin_loop(); - continue; - } -- -- spins_left = SPIN_COUNT; -- -- let inner = self.inner.fetch_or(WAITING_BIT, Ordering::Relaxed); -- -- if inner == STATE_UNLOCKED { -- continue; -- }*/ -- -- // If the mutex is not robust, simply futex_wait until unblocked. -- //crate::sync::futex_wait(&self.inner, inner | WAITING_BIT, None); - if crate::sync::futex_wait(&self.inner, thread, deadline) - == FutexWaitResult::TimedOut - { -@@ -140,6 +173,20 @@ impl RlctMutex { - pub fn lock_with_timeout(&self, deadline: ×pec) -> Result<(), Errno> { - self.lock_inner(Some(deadline)) - } -+ fn finish_lock_acquire(&self, owner_dead: bool) -> Result<(), Errno> { -+ if self.ty == Ty::Recursive { -+ self.increment_recursive_count()?; -+ } -+ if self.robust { -+ add_to_robust_list(self); -+ } -+ -+ if owner_dead { -+ Err(Errno(EOWNERDEAD)) -+ } else { -+ Ok(()) -+ } -+ } - fn increment_recursive_count(&self) -> Result<(), Errno> { - // We don't have to worry about asynchronous signals here, since pthread_mutex_trylock - // is not async-signal-safe. -@@ -161,41 +208,65 @@ impl RlctMutex { - pub fn try_lock(&self) -> Result<(), Errno> { - let this_thread = os_tid_invalid_after_fork(); - -- // TODO: If recursive, omitting CAS may be faster if it is already owned by this thread. -- let result = self.inner.compare_exchange( -- STATE_UNLOCKED, -- this_thread, -- Ordering::Acquire, -- Ordering::Relaxed, -- ); -+ loop { -+ let current = self.inner.load(Ordering::Relaxed); -+ -+ if current == STATE_UNLOCKED { -+ match self.inner.compare_exchange( -+ STATE_UNLOCKED, -+ this_thread, -+ Ordering::Acquire, -+ Ordering::Relaxed, -+ ) { -+ Ok(_) => return self.finish_lock_acquire(false), -+ Err(_) => continue, -+ } -+ } - -- if self.ty == Ty::Recursive { -- match result { -- Err(index) if index & INDEX_MASK != this_thread => return Err(Errno(EBUSY)), -- _ => (), -+ let owner = current & INDEX_MASK; -+ -+ if owner == this_thread && self.ty == Ty::Recursive { -+ self.increment_recursive_count()?; -+ return Ok(()); - } - -- self.increment_recursive_count()?; -+ if owner == this_thread && self.ty == Ty::Errck { -+ return Err(Errno(EDEADLK)); -+ } - -- return Ok(()); -- } -+ if current & FUTEX_OWNER_DIED != 0 && owner == 0 { -+ return Err(Errno(ENOTRECOVERABLE)); -+ } - -- match result { -- Ok(_) => Ok(()), -- Err(index) if index & INDEX_MASK == this_thread && self.ty == Ty::Errck => { -- Err(Errno(EDEADLK)) -+ if current & FUTEX_OWNER_DIED != 0 || (owner != 0 && !crate::pthread::mutex_owner_id_is_live(owner)) { -+ if !self.robust { -+ return Err(Errno(ENOTRECOVERABLE)); -+ } -+ -+ let new_value = (current & WAITING_BIT) | FUTEX_OWNER_DIED | this_thread; -+ match self.inner.compare_exchange( -+ current, -+ new_value, -+ Ordering::Acquire, -+ Ordering::Relaxed, -+ ) { -+ Ok(_) => return self.finish_lock_acquire(true), -+ Err(_) => continue, -+ } - } -- Err(_) => Err(Errno(EBUSY)), -+ -+ return Err(Errno(EBUSY)); - } - } - // Safe because we are not protecting any data. - pub fn unlock(&self) -> Result<(), Errno> { -+ let current = self.inner.load(Ordering::Relaxed); -+ - if self.robust || matches!(self.ty, Ty::Recursive | Ty::Errck) { -- if self.inner.load(Ordering::Relaxed) & INDEX_MASK != os_tid_invalid_after_fork() { -+ if current & INDEX_MASK != os_tid_invalid_after_fork() { - return Err(Errno(EPERM)); - } - -- // TODO: Is this fence correct? - core::sync::atomic::fence(Ordering::Acquire); - } - -@@ -208,18 +279,47 @@ impl RlctMutex { - } - } - -- self.inner.store(STATE_UNLOCKED, Ordering::Release); -- crate::sync::futex_wake(&self.inner, i32::MAX); -- /*let was_waiting = self.inner.swap(STATE_UNLOCKED, Ordering::Release) & WAITING_BIT != 0; -+ if self.robust { -+ remove_from_robust_list(self); -+ } - -- if was_waiting { -- let _ = crate::sync::futex_wake(&self.inner, 1); -- }*/ -+ let new_state = if self.robust && current & FUTEX_OWNER_DIED != 0 { -+ FUTEX_OWNER_DIED -+ } else { -+ STATE_UNLOCKED -+ }; -+ -+ self.inner.store(new_state, Ordering::Release); -+ crate::sync::futex_wake(&self.inner, i32::MAX); - - Ok(()) - } - } - -+pub(crate) unsafe fn mark_robust_mutexes_dead(thread: &crate::pthread::Pthread) { -+ let head = thread.robust_list_head.get(); -+ let this_thread = os_tid_invalid_after_fork(); -+ let mut node = unsafe { *head }; -+ -+ unsafe { *head = core::ptr::null_mut() }; -+ -+ while !node.is_null() { -+ let next = unsafe { (*node).next }; -+ let mutex = unsafe { &*(*node).mutex }; -+ let current = mutex.inner.load(Ordering::Relaxed); -+ -+ if current & INDEX_MASK == this_thread { -+ mutex -+ .inner -+ .store((current & WAITING_BIT) | FUTEX_OWNER_DIED | this_thread, Ordering::Release); -+ crate::sync::futex_wake(&mutex.inner, i32::MAX); -+ } -+ -+ unsafe { drop(Box::from_raw(node)) }; -+ node = next; -+ } -+} -+ - #[repr(u8)] - #[derive(PartialEq)] - enum Ty { -@@ -237,6 +337,54 @@ enum Ty { - #[thread_local] - static CACHED_OS_TID_INVALID_AFTER_FORK: Cell = Cell::new(0); - -+fn add_to_robust_list(mutex: &RlctMutex) { -+ let thread = crate::pthread::current_thread().expect("current thread not present"); -+ let node_ptr = Box::into_raw(Box::new(RobustMutexNode { -+ next: core::ptr::null_mut(), -+ prev: core::ptr::null_mut(), -+ mutex: core::ptr::from_ref(mutex), -+ })); -+ -+ unsafe { -+ let head = thread.robust_list_head.get(); -+ if !(*head).is_null() { -+ (**head).prev = node_ptr; -+ } -+ (*node_ptr).next = *head; -+ *head = node_ptr; -+ } -+} -+ -+fn remove_from_robust_list(mutex: &RlctMutex) { -+ let thread = match crate::pthread::current_thread() { -+ Some(thread) => thread, -+ None => return, -+ }; -+ -+ unsafe { -+ let mut node = *thread.robust_list_head.get(); -+ -+ while !node.is_null() { -+ if core::ptr::eq((*node).mutex, core::ptr::from_ref(mutex)) { -+ if !(*node).prev.is_null() { -+ (*(*node).prev).next = (*node).next; -+ } else { -+ *thread.robust_list_head.get() = (*node).next; -+ } -+ -+ if !(*node).next.is_null() { -+ (*(*node).next).prev = (*node).prev; -+ } -+ -+ drop(Box::from_raw(node)); -+ return; -+ } -+ -+ node = (*node).next; -+ } -+ } -+} -+ - // Assumes TIDs are unique between processes, which I only know is true for Redox. - fn os_tid_invalid_after_fork() -> u32 { - // TODO: Coordinate better if using shared == PTHREAD_PROCESS_SHARED, with up to 2^32 separate diff --git a/local/archived/patches-2026-06-migration/relibc/absorbed/redox.patch b/local/archived/patches-2026-06-migration/relibc/absorbed/redox.patch deleted file mode 100644 index bfe19edc01..0000000000 --- a/local/archived/patches-2026-06-migration/relibc/absorbed/redox.patch +++ /dev/null @@ -1,2954 +0,0 @@ -diff --git a/redox-rt/src/signal.rs b/redox-rt/src/signal.rs -index 022f873..ab96dea 100644 ---- a/redox-rt/src/signal.rs -+++ b/redox-rt/src/signal.rs -@@ -1,4 +1,10 @@ --use core::{ffi::c_int, ptr::NonNull, sync::atomic::Ordering}; -+use core::{ -+ ffi::c_int, -+ hint::unreachable_unchecked, -+ panic::AssertUnwindSafe, -+ ptr::NonNull, -+ sync::atomic::Ordering, -+}; - - use syscall::{ - CallFlags, EAGAIN, EINTR, EINVAL, ENOMEM, EPERM, Error, RawAction, Result, SenderInfo, -@@ -103,6 +109,47 @@ pub struct SiginfoAbi { - pub si_value: usize, // sigval - } - -+fn invoke_signal_handler(f: AssertUnwindSafe) -> bool { -+ fn do_call(data: *mut u8) { -+ let callback = unsafe { &mut *data.cast::>>() }; -+ if let Some(callback) = callback.take() { -+ callback.0(); -+ } -+ } -+ -+ fn do_catch(_data: *mut u8, _payload: *mut u8) {} -+ -+ let mut callback = Some(f); -+ unsafe { -+ core::intrinsics::catch_unwind( -+ do_call::, -+ (&mut callback as *mut Option>).cast(), -+ do_catch::, -+ ) != 0 -+ } -+} -+ -+#[inline(always)] -+unsafe fn return_ignored_signal( -+ os: &RtTcb, -+ stack: &SigStack, -+ signals_were_disabled: bool, -+) { -+ unsafe { -+ (*os.arch.get()).last_sig_was_restart = true; -+ (*os.arch.get()).last_sigstack = NonNull::new(stack.link); -+ } -+ -+ if !signals_were_disabled { -+ core::sync::atomic::compiler_fence(Ordering::Release); -+ let control_flags = &os.control.control_flags; -+ control_flags.store( -+ control_flags.load(Ordering::Relaxed) & !SigcontrolFlags::INHIBIT_DELIVERY.bits(), -+ Ordering::Relaxed, -+ ); -+ } -+} -+ - #[inline(always)] - unsafe fn inner(stack: &mut SigStack) { - let os = unsafe { &Tcb::current().unwrap().os_specific }; -@@ -168,7 +215,10 @@ unsafe fn inner(stack: &mut SigStack) { - // and reaching this code. If so, we do already know whether the signal is IGNORED *now*, - // and so we should return early ideally without even temporarily touching the signal mask. - SigactionKind::Ignore => { -- panic!("ctl {:#x?} signal {}", os.control, stack.sig_num) -+ unsafe { -+ return_ignored_signal(os, stack, signals_were_disabled); -+ } -+ return; - } - // this case should be treated equally as the one above - // -@@ -183,7 +233,9 @@ unsafe fn inner(stack: &mut SigStack) { - CallFlags::empty(), - &[ProcCall::Exit as u64, u64::from(sig) << 8], - ); -- panic!() -+ // SAFETY: ProcCall::Exit terminates the current process when it succeeds, so reaching -+ // this point would violate the proc manager exit contract. -+ unsafe { unreachable_unchecked() } - } - SigactionKind::Handled { handler } => handler, - }; -@@ -224,15 +276,21 @@ unsafe fn inner(stack: &mut SigStack) { - si_uid: sender_uid as i32, - si_value: stack.sival, - }; -- unsafe { -+ if invoke_signal_handler(AssertUnwindSafe(|| unsafe { - sigaction( - stack.sig_num as c_int, - core::ptr::addr_of!(info).cast(), - stack as *mut SigStack as *mut (), - ) -- }; -+ })) { -+ let _ = syscall::write(2, b"redox-rt: sa_siginfo handler panicked; continuing\n"); -+ } - } else if let Some(handler) = unsafe { handler.handler } { -- handler(stack.sig_num as c_int); -+ if invoke_signal_handler(AssertUnwindSafe(|| { -+ handler(stack.sig_num as c_int); -+ })) { -+ let _ = syscall::write(2, b"redox-rt: sa_handler panicked; continuing\n"); -+ } - } - - // Disable signals while we modify the sigmask again -diff --git a/src/header/_aio/mod.rs b/src/header/_aio/mod.rs -index b75ba38..a59995a 100644 ---- a/src/header/_aio/mod.rs -+++ b/src/header/_aio/mod.rs -@@ -1,75 +1,283 @@ - //! `aio.h` implementation. - //! --//! See . -+//! Synchronous emulation of POSIX AIO. All operations complete immediately -+//! in the calling thread. This provides sufficient compatibility for software -+//! (such as Qt6's QIODevice) that uses aio as an optional fallback path. -+ -+use core::slice; - - use crate::{ -- header::{bits_timespec::timespec, signal::sigevent}, -- platform::types::{c_int, c_void}, -+ error::Errno, -+ header::{ -+ bits_timespec::timespec, -+ errno::{EFAULT, EINVAL, EINPROGRESS, EIO}, -+ fcntl::O_SYNC, -+ signal::sigevent, -+ }, -+ platform::{ -+ Sys, -+ types::{c_int, c_void, off_t, size_t, ssize_t}, -+ ERRNO, -+ }, - }; - -+// POSIX lio_listio operation codes -+pub const LIO_READ: c_int = 0; -+pub const LIO_WRITE: c_int = 1; -+pub const LIO_NOP: c_int = 2; -+ -+// lio_listio modes -+pub const LIO_WAIT: c_int = 0; -+pub const LIO_NOWAIT: c_int = 1; -+ -+// aio_cancel return values -+pub const AIO_CANCELED: c_int = 0; -+pub const AIO_NOTCANCELED: c_int = 1; -+pub const AIO_ALLDONE: c_int = 2; -+ -+// O_DSYNC is not yet defined in relibc's fcntl module. -+// Accept it in aio_fsync by matching the Linux x86_64 value. -+// TODO: import from fcntl when O_DSYNC is added there. -+const _O_DSYNC: c_int = 0x0001_0000; -+ -+// Internal operation states for synchronous emulation -+const _AIO_IDLE: c_int = 0; -+const _AIO_DONE: c_int = 2; -+ - /// See . -+#[repr(C)] - pub struct aiocb { - pub aio_fildes: c_int, -+ pub aio_offset: off_t, - pub aio_lio_opcode: c_int, - pub aio_reqprio: c_int, - pub aio_buf: *mut c_void, -- pub aio_nbytes: usize, -+ pub aio_nbytes: size_t, - pub aio_sigevent: sigevent, -+ // Private emulation state -+ pub __state: c_int, -+ pub __error_code: c_int, -+ pub __return_value: ssize_t, -+} -+ -+/// Perform a synchronous pread and store the result in the aiocb. -+/// -+/// Returns 0 on success, -1 on error (with errno set). -+unsafe fn aio_do_read(cb: &mut aiocb) -> c_int { -+ let buf = unsafe { slice::from_raw_parts_mut(cb.aio_buf.cast::(), cb.aio_nbytes) }; -+ match Sys::pread(cb.aio_fildes, buf, cb.aio_offset) { -+ Ok(n) => { -+ cb.__error_code = 0; -+ cb.__return_value = n as ssize_t; -+ cb.__state = _AIO_DONE; -+ 0 -+ } -+ Err(Errno(e)) => { -+ cb.__error_code = e; -+ cb.__return_value = -1; -+ cb.__state = _AIO_DONE; -+ ERRNO.set(e); -+ -1 -+ } -+ } -+} -+ -+/// Perform a synchronous pwrite and store the result in the aiocb. -+/// -+/// Returns 0 on success, -1 on error (with errno set). -+unsafe fn aio_do_write(cb: &mut aiocb) -> c_int { -+ let buf = unsafe { slice::from_raw_parts(cb.aio_buf.cast::(), cb.aio_nbytes) }; -+ match Sys::pwrite(cb.aio_fildes, buf, cb.aio_offset) { -+ Ok(n) => { -+ cb.__error_code = 0; -+ cb.__return_value = n as ssize_t; -+ cb.__state = _AIO_DONE; -+ 0 -+ } -+ Err(Errno(e)) => { -+ cb.__error_code = e; -+ cb.__return_value = -1; -+ cb.__state = _AIO_DONE; -+ ERRNO.set(e); -+ -1 -+ } -+ } - } - - /// See . --// #[unsafe(no_mangle)] --pub extern "C" fn aio_read(aiocbp: *mut aiocb) -> c_int { -- unimplemented!(); -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn aio_read(aiocbp: *mut aiocb) -> c_int { -+ if aiocbp.is_null() { -+ ERRNO.set(EINVAL); -+ return -1; -+ } -+ let cb = unsafe { &mut *aiocbp }; -+ if cb.aio_buf.is_null() && cb.aio_nbytes > 0 { -+ ERRNO.set(EFAULT); -+ cb.__state = _AIO_DONE; -+ cb.__error_code = EFAULT; -+ cb.__return_value = -1; -+ return -1; -+ } -+ unsafe { aio_do_read(cb) } - } - - /// See . --// #[unsafe(no_mangle)] --pub extern "C" fn aio_write(aiocbp: *mut aiocb) -> c_int { -- unimplemented!(); -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn aio_write(aiocbp: *mut aiocb) -> c_int { -+ if aiocbp.is_null() { -+ ERRNO.set(EINVAL); -+ return -1; -+ } -+ let cb = unsafe { &mut *aiocbp }; -+ if cb.aio_buf.is_null() && cb.aio_nbytes > 0 { -+ ERRNO.set(EFAULT); -+ cb.__state = _AIO_DONE; -+ cb.__error_code = EFAULT; -+ cb.__return_value = -1; -+ return -1; -+ } -+ unsafe { aio_do_write(cb) } - } - --/// See . --// #[unsafe(no_mangle)] --pub extern "C" fn lio_listio( -- mode: c_int, -- list: *const *const aiocb, -- nent: c_int, -- sig: *mut sigevent, --) -> c_int { -- unimplemented!(); -+/// See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn aio_fsync(operation: c_int, aiocbp: *mut aiocb) -> c_int { -+ if aiocbp.is_null() { -+ ERRNO.set(EINVAL); -+ return -1; -+ } -+ // Validate operation: O_SYNC from fcntl, or _O_DSYNC (Linux compat value). -+ if operation != O_SYNC && operation != _O_DSYNC { -+ ERRNO.set(EINVAL); -+ return -1; -+ } -+ let cb = unsafe { &mut *aiocbp }; -+ match Sys::fsync(cb.aio_fildes) { -+ Ok(()) => { -+ cb.__error_code = 0; -+ cb.__return_value = 0; -+ cb.__state = _AIO_DONE; -+ 0 -+ } -+ Err(Errno(e)) => { -+ cb.__error_code = e; -+ cb.__return_value = -1; -+ cb.__state = _AIO_DONE; -+ ERRNO.set(e); -+ -1 -+ } -+ } - } - - /// See . --// #[unsafe(no_mangle)] --pub extern "C" fn aio_error(aiocbp: *const aiocb) -> c_int { -- unimplemented!(); -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn aio_error(aiocbp: *const aiocb) -> c_int { -+ if aiocbp.is_null() { -+ return EINVAL; -+ } -+ let cb = unsafe { &*aiocbp }; -+ match cb.__state { -+ _AIO_IDLE => 0, // Never submitted -- no error -+ _AIO_DONE => cb.__error_code, -+ _ => EINPROGRESS, // Should not occur with sync emulation -+ } - } - - /// See . --// #[unsafe(no_mangle)] --pub extern "C" fn aio_return(aiocbp: *mut aiocb) -> usize { -- unimplemented!(); --} -- --/// See . --// #[unsafe(no_mangle)] --pub extern "C" fn aio_cancel(fildes: c_int, aiocbp: *mut aiocb) -> c_int { -- unimplemented!(); -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn aio_return(aiocbp: *mut aiocb) -> ssize_t { -+ if aiocbp.is_null() { -+ ERRNO.set(EINVAL); -+ return -1; -+ } -+ let cb = unsafe { &*aiocbp }; -+ if cb.__state != _AIO_DONE { -+ ERRNO.set(EINPROGRESS); -+ return -1; -+ } -+ cb.__return_value - } - - /// See . --// #[unsafe(no_mangle)] --pub extern "C" fn aio_suspend( -+/// -+/// With synchronous emulation, all operations are already complete when -+/// aio_suspend is called, so this is effectively a no-op that returns 0. -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn aio_suspend( - list: *const *const aiocb, - nent: c_int, - timeout: *const timespec, - ) -> c_int { -- unimplemented!(); -+ let _ = timeout; -+ if list.is_null() || nent < 0 { -+ ERRNO.set(EINVAL); -+ return -1; -+ } -+ // All operations complete synchronously, so just return success. -+ 0 - } - --/// See . --// #[unsafe(no_mangle)] --pub extern "C" fn aio_fsync(operation: c_int, aiocbp: *mut aiocb) -> c_int { -- unimplemented!(); -+/// See . -+/// -+/// With synchronous emulation, operations complete before aio_cancel can be -+/// called, so this always returns AIO_ALLDONE. -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn aio_cancel(fildes: c_int, aiocbp: *mut aiocb) -> c_int { -+ if !aiocbp.is_null() { -+ let cb = unsafe { &*aiocbp }; -+ if cb.aio_fildes != fildes { -+ ERRNO.set(EINVAL); -+ return -1; -+ } -+ } -+ AIO_ALLDONE -+} -+ -+/// See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn lio_listio( -+ mode: c_int, -+ list: *const *const aiocb, -+ nent: c_int, -+ sig: *mut sigevent, -+) -> c_int { -+ let _ = sig; -+ if (mode != LIO_WAIT && mode != LIO_NOWAIT) || list.is_null() || nent < 0 { -+ ERRNO.set(EINVAL); -+ return -1; -+ } -+ let mut any_failed = false; -+ for i in 0..nent { -+ let entry = unsafe { *list.add(i as usize) }; -+ if entry.is_null() { -+ continue; -+ } -+ let cb = unsafe { &mut *(entry as *mut aiocb) }; -+ match cb.aio_lio_opcode { -+ LIO_READ => { -+ if unsafe { aio_read(cb) } != 0 { -+ any_failed = true; -+ } -+ } -+ LIO_WRITE => { -+ if unsafe { aio_write(cb) } != 0 { -+ any_failed = true; -+ } -+ } -+ LIO_NOP => {} -+ _ => { -+ cb.__state = _AIO_DONE; -+ cb.__error_code = EINVAL; -+ cb.__return_value = -1; -+ ERRNO.set(EINVAL); -+ any_failed = true; -+ } -+ } -+ } -+ if any_failed { -+ ERRNO.set(EIO); -+ return -1; -+ } -+ 0 - } -diff --git a/src/header/fcntl/mod.rs b/src/header/fcntl/mod.rs -index 28455c9..504d505 100644 ---- a/src/header/fcntl/mod.rs -+++ b/src/header/fcntl/mod.rs -@@ -7,6 +7,8 @@ use core::num::NonZeroU64; - use crate::{ - c_str::CStr, - error::ResultExt, -+ header::unistd::close, -+ header::unistd::close, - platform::{ - Pal, Sys, - types::{c_char, c_int, c_short, c_ulonglong, mode_t, off_t, pid_t}, -@@ -74,6 +76,40 @@ pub unsafe extern "C" fn fcntl(fildes: c_int, cmd: c_int, mut __valist: ...) -> - _ => 0, - }; - -+ if cmd == F_DUPFD_CLOEXEC { -+ let new_fd = Sys::fcntl(fildes, F_DUPFD_CLOEXEC, arg).or_minus_one_errno(); -+ if new_fd >= 0 { -+ return new_fd; -+ } -+ -+ let new_fd = Sys::fcntl(fildes, F_DUPFD, arg).or_minus_one_errno(); -+ if new_fd < 0 { -+ return -1; -+ } -+ if Sys::fcntl(new_fd, F_SETFD, FD_CLOEXEC as c_ulonglong).or_minus_one_errno() < 0 { -+ let _ = close(new_fd); -+ return -1; -+ } -+ return new_fd; -+ } -+ -+ if cmd == F_DUPFD_CLOEXEC { -+ let new_fd = Sys::fcntl(fildes, F_DUPFD_CLOEXEC, arg).or_minus_one_errno(); -+ if new_fd >= 0 { -+ return new_fd; -+ } -+ -+ let new_fd = Sys::fcntl(fildes, F_DUPFD, arg).or_minus_one_errno(); -+ if new_fd < 0 { -+ return -1; -+ } -+ if Sys::fcntl(new_fd, F_SETFD, FD_CLOEXEC as c_ulonglong).or_minus_one_errno() < 0 { -+ let _ = close(new_fd); -+ return -1; -+ } -+ return new_fd; -+ } -+ - Sys::fcntl(fildes, cmd, arg).or_minus_one_errno() - } - -diff --git a/src/header/mod.rs b/src/header/mod.rs -index 4bdb6b1..3eecb00 100644 ---- a/src/header/mod.rs -+++ b/src/header/mod.rs -@@ -91,6 +91,7 @@ pub mod strings; - // TODO: stropts.h (deprecated) - pub mod sys_auxv; - pub mod sys_epoll; -+pub mod sys_eventfd; - pub mod sys_file; - pub mod sys_ioctl; - // TODO: sys/ipc.h -@@ -113,9 +114,11 @@ pub mod sys_timeb; - pub mod arch_aarch64_user; - pub mod arch_riscv64_user; - pub mod arch_x64_user; -+pub mod sys_signalfd; - #[cfg(not(target_arch = "x86"))] // TODO: x86 - pub mod sys_procfs; - pub mod sys_random; -+pub mod sys_timerfd; - pub mod sys_syslog; - pub mod sys_types; - #[allow(non_camel_case_types)] -diff --git a/src/header/pthread/barrier.rs b/src/header/pthread/barrier.rs -index dedf715..d0b1d0d 100644 ---- a/src/header/pthread/barrier.rs -+++ b/src/header/pthread/barrier.rs -@@ -24,10 +24,8 @@ impl Default for RlctBarrierAttr { - // Not async-signal-safe. - #[unsafe(no_mangle)] - pub unsafe extern "C" fn pthread_barrier_destroy(barrier: *mut pthread_barrier_t) -> c_int { -- // Behavior is undefined if any thread is currently waiting when this is called. -- -- // No-op, currently. -- unsafe { core::ptr::drop_in_place(barrier.cast::()) }; -+ let barrier = unsafe { &*barrier.cast::() }; -+ barrier.destroy(); - - 0 - } -diff --git a/src/header/pthread/cbindgen.toml b/src/header/pthread/cbindgen.toml -index 04b8d7d..65b4334 100644 ---- a/src/header/pthread/cbindgen.toml -+++ b/src/header/pthread/cbindgen.toml -@@ -8,6 +8,7 @@ cpp_compat = true - [export.rename] - "timespec" = "struct timespec" - "sched_param" = "struct sched_param" -+"cpu_set_t" = "struct cpu_set_t" - - [enum] - prefix_with_name = true -diff --git a/src/header/pthread/mod.rs b/src/header/pthread/mod.rs -index c742a42..ade947e 100644 ---- a/src/header/pthread/mod.rs -+++ b/src/header/pthread/mod.rs -@@ -3,23 +3,140 @@ - //! See . - - use alloc::collections::LinkedList; --use core::{cell::Cell, ptr::NonNull}; -+use core::{cell::Cell, mem::size_of, ptr::NonNull}; -+ -+#[cfg(target_os = "redox")] -+use redox_rt::proc::FdGuard; -+ header::errno::EINVAL, -+#[cfg(target_os = "linux")] -+use sc::syscall; -+#[cfg(target_os = "redox")] -+use syscall; - - use crate::{ - error::Errno, -- header::{bits_timespec::timespec, sched::*}, -+ header::{ -+ bits_timespec::timespec, -+ errno::{EINVAL, ERANGE}, -+ sched::*, -+ }, - platform::{ -+#[cfg(target_os = "linux")] -+use crate::platform::sys::e_raw; -+ - Pal, Sys, - types::{ -- c_int, c_uchar, c_uint, c_void, clockid_t, pthread_attr_t, pthread_barrier_t, -+ c_char, c_int, c_uchar, c_uint, c_void, clockid_t, pthread_attr_t, pthread_barrier_t, - pthread_barrierattr_t, pthread_cond_t, pthread_condattr_t, pthread_key_t, - pthread_mutex_t, pthread_mutexattr_t, pthread_once_t, pthread_rwlock_t, - pthread_rwlockattr_t, pthread_spinlock_t, pthread_t, size_t, - }, -+const RLCT_AFFINITY_BYTES: usize = size_of::(); -+const RLCT_MAX_AFFINITY_CPUS: usize = u64::BITS as usize; -+ -+fn cpuset_bytes<'a>(cpusetsize: size_t, cpuset: *const cpu_set_t) -> Result<&'a [u8], Errno> { -+ if cpuset.is_null() || !(RLCT_AFFINITY_BYTES..=size_of::()).contains(&cpusetsize) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(unsafe { core::slice::from_raw_parts(cpuset.cast::(), cpusetsize) }) -+} -+ -+fn cpuset_bytes_mut<'a>( -+ cpusetsize: size_t, -+ cpuset: *mut cpu_set_t, -+) -> Result<&'a mut [u8], Errno> { -+ if cpuset.is_null() || !(RLCT_AFFINITY_BYTES..=size_of::()).contains(&cpusetsize) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(unsafe { core::slice::from_raw_parts_mut(cpuset.cast::(), cpusetsize) }) -+} -+ -+fn cpuset_to_u64(cpusetsize: size_t, cpuset: *const cpu_set_t) -> Result { -+ let bytes = cpuset_bytes(cpusetsize, cpuset)?; -+ let mut mask = 0_u64; -+ -+ for (byte_index, byte) in bytes.iter().copied().enumerate() { -+ for bit in 0..u8::BITS as usize { -+ if byte & (1 << bit) == 0 { -+ continue; -+ } -+ -+ let cpu = byte_index * u8::BITS as usize + bit; -+ if cpu >= RLCT_MAX_AFFINITY_CPUS { -+ return Err(Errno(EINVAL)); -+ } -+ -+ mask |= 1_u64 << cpu; -+ } -+ } -+ -+ Ok(mask) -+} -+ -+fn copy_u64_to_cpuset(mask: u64, cpusetsize: size_t, cpuset: *mut cpu_set_t) -> Result<(), Errno> { -+ let bytes = cpuset_bytes_mut(cpusetsize, cpuset)?; -+ bytes.fill(0); -+ -+ for (byte_index, dst) in bytes.iter_mut().take(RLCT_AFFINITY_BYTES).enumerate() { -+ *dst = (mask >> (byte_index * u8::BITS as usize)) as u8; -+ } -+ -+ Ok(()) -+} -+ -+#[cfg(target_os = "redox")] -+fn redox_set_thread_affinity(thread: &pthread::Pthread, mask: u64) -> Result<(), Errno> { -+ let mut kernel_cpuset = cpu_set_t::default(); -+ kernel_cpuset.__bits[0] = mask; -+ -+ let handle = FdGuard::new(unsafe { -+ syscall::dup(thread.os_tid.get().read().thread_fd, b"sched-affinity")? -+ }); -+ let _ = handle.write(unsafe { -+ core::slice::from_raw_parts( -+ core::ptr::from_ref(&kernel_cpuset).cast::(), -+ size_of::(), -+ ) -+ })?; -+ -+ Ok(()) -+} -+ -+#[cfg(target_os = "redox")] -+fn redox_get_thread_affinity(thread: &pthread::Pthread) -> Result { -+ let handle = FdGuard::new(unsafe { -+ syscall::dup(thread.os_tid.get().read().thread_fd, b"sched-affinity")? -+ }); -+ let mut kernel_cpuset = cpu_set_t::default(); -+ let _ = handle.read(unsafe { -+ core::slice::from_raw_parts_mut( -+ core::ptr::from_mut(&mut kernel_cpuset).cast::(), -+ size_of::(), -+ ) -+ })?; -+ -+ if kernel_cpuset.__bits[1..].iter().any(|bits| *bits != 0) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(kernel_cpuset.__bits[0]) -+} -+ - }, - pthread, - }; - -+#[cfg(target_os = "linux")] -+use crate::platform::sys::e_raw; -+ -+#[cfg(target_os = "linux")] -+use crate::platform::sys::e_raw; -+ -+#[cfg(target_os = "linux")] -+use crate::platform::sys::e_raw; -+ - pub fn e(result: Result<(), Errno>) -> i32 { - match result { - Ok(()) => 0, -@@ -27,6 +144,276 @@ pub fn e(result: Result<(), Errno>) -> i32 { - } - } - -+const RLCT_AFFINITY_BYTES: usize = size_of::(); -+const RLCT_MAX_AFFINITY_CPUS: usize = u64::BITS as usize; -+ -+fn cpuset_bytes<'a>(cpusetsize: size_t, cpuset: *const cpu_set_t) -> Result<&'a [u8], Errno> { -+ if cpuset.is_null() || !(RLCT_AFFINITY_BYTES..=size_of::()).contains(&cpusetsize) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(unsafe { core::slice::from_raw_parts(cpuset.cast::(), cpusetsize) }) -+} -+ -+fn cpuset_bytes_mut<'a>(cpusetsize: size_t, cpuset: *mut cpu_set_t) -> Result<&'a mut [u8], Errno> { -+ if cpuset.is_null() || !(RLCT_AFFINITY_BYTES..=size_of::()).contains(&cpusetsize) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(unsafe { core::slice::from_raw_parts_mut(cpuset.cast::(), cpusetsize) }) -+} -+ -+fn cpuset_to_u64(cpusetsize: size_t, cpuset: *const cpu_set_t) -> Result { -+ let bytes = cpuset_bytes(cpusetsize, cpuset)?; -+ let mut mask = 0_u64; -+ -+ for (byte_index, byte) in bytes.iter().copied().enumerate() { -+ for bit in 0..u8::BITS as usize { -+ if byte & (1 << bit) == 0 { -+ continue; -+ } -+ -+ let cpu = byte_index * u8::BITS as usize + bit; -+ if cpu >= RLCT_MAX_AFFINITY_CPUS { -+ return Err(Errno(EINVAL)); -+ } -+ -+ mask |= 1_u64 << cpu; -+ } -+ } -+ -+ Ok(mask) -+} -+ -+fn copy_u64_to_cpuset(mask: u64, cpusetsize: size_t, cpuset: *mut cpu_set_t) -> Result<(), Errno> { -+ let bytes = cpuset_bytes_mut(cpusetsize, cpuset)?; -+ bytes.fill(0); -+ -+ for (byte_index, dst) in bytes.iter_mut().take(RLCT_AFFINITY_BYTES).enumerate() { -+ *dst = (mask >> (byte_index * u8::BITS as usize)) as u8; -+ } -+ -+ Ok(()) -+} -+ -+#[cfg(target_os = "redox")] -+fn redox_set_thread_affinity(thread: &pthread::Pthread, mask: u64) -> Result<(), Errno> { -+ let mut kernel_cpuset = cpu_set_t::default(); -+ kernel_cpuset.__bits[0] = mask; -+ -+ let handle = FdGuard::new(unsafe { -+ syscall::dup(thread.os_tid.get().read().thread_fd, b"sched-affinity")? -+ }); -+ let _ = handle.write(unsafe { -+ core::slice::from_raw_parts( -+ core::ptr::from_ref(&kernel_cpuset).cast::(), -+ size_of::(), -+ ) -+ })?; -+ -+ Ok(()) -+} -+ -+#[cfg(target_os = "redox")] -+fn redox_get_thread_affinity(thread: &pthread::Pthread) -> Result { -+ let handle = FdGuard::new(unsafe { -+ syscall::dup(thread.os_tid.get().read().thread_fd, b"sched-affinity")? -+ }); -+ let mut kernel_cpuset = cpu_set_t::default(); -+ let _ = handle.read(unsafe { -+ core::slice::from_raw_parts_mut( -+ core::ptr::from_mut(&mut kernel_cpuset).cast::(), -+ size_of::(), -+ ) -+ })?; -+ -+ if kernel_cpuset.__bits[1..].iter().any(|bits| *bits != 0) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(kernel_cpuset.__bits[0]) -+} -+ -+const RLCT_AFFINITY_BYTES: usize = size_of::(); -+const RLCT_MAX_AFFINITY_CPUS: usize = u64::BITS as usize; -+ -+fn cpuset_bytes<'a>(cpusetsize: size_t, cpuset: *const cpu_set_t) -> Result<&'a [u8], Errno> { -+ if cpuset.is_null() || !(RLCT_AFFINITY_BYTES..=size_of::()).contains(&cpusetsize) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(unsafe { core::slice::from_raw_parts(cpuset.cast::(), cpusetsize) }) -+} -+ -+fn cpuset_bytes_mut<'a>(cpusetsize: size_t, cpuset: *mut cpu_set_t) -> Result<&'a mut [u8], Errno> { -+ if cpuset.is_null() || !(RLCT_AFFINITY_BYTES..=size_of::()).contains(&cpusetsize) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(unsafe { core::slice::from_raw_parts_mut(cpuset.cast::(), cpusetsize) }) -+} -+ -+fn cpuset_to_u64(cpusetsize: size_t, cpuset: *const cpu_set_t) -> Result { -+ let bytes = cpuset_bytes(cpusetsize, cpuset)?; -+ let mut mask = 0_u64; -+ -+ for (byte_index, byte) in bytes.iter().copied().enumerate() { -+ for bit in 0..u8::BITS as usize { -+ if byte & (1 << bit) == 0 { -+ continue; -+ } -+ -+ let cpu = byte_index * u8::BITS as usize + bit; -+ if cpu >= RLCT_MAX_AFFINITY_CPUS { -+ return Err(Errno(EINVAL)); -+ } -+ -+ mask |= 1_u64 << cpu; -+ } -+ } -+ -+ Ok(mask) -+} -+ -+fn copy_u64_to_cpuset(mask: u64, cpusetsize: size_t, cpuset: *mut cpu_set_t) -> Result<(), Errno> { -+ let bytes = cpuset_bytes_mut(cpusetsize, cpuset)?; -+ bytes.fill(0); -+ -+ for (byte_index, dst) in bytes.iter_mut().take(RLCT_AFFINITY_BYTES).enumerate() { -+ *dst = (mask >> (byte_index * u8::BITS as usize)) as u8; -+ } -+ -+ Ok(()) -+} -+ -+#[cfg(target_os = "redox")] -+fn redox_set_thread_affinity(thread: &pthread::Pthread, mask: u64) -> Result<(), Errno> { -+ let mut kernel_cpuset = cpu_set_t::default(); -+ kernel_cpuset.__bits[0] = mask; -+ -+ let handle = FdGuard::new(unsafe { -+ syscall::dup(thread.os_tid.get().read().thread_fd, b"sched-affinity")? -+ }); -+ let _ = handle.write(unsafe { -+ core::slice::from_raw_parts( -+ core::ptr::from_ref(&kernel_cpuset).cast::(), -+ size_of::(), -+ ) -+ })?; -+ -+ Ok(()) -+} -+ -+#[cfg(target_os = "redox")] -+fn redox_get_thread_affinity(thread: &pthread::Pthread) -> Result { -+ let handle = FdGuard::new(unsafe { -+ syscall::dup(thread.os_tid.get().read().thread_fd, b"sched-affinity")? -+ }); -+ let mut kernel_cpuset = cpu_set_t::default(); -+ let _ = handle.read(unsafe { -+ core::slice::from_raw_parts_mut( -+ core::ptr::from_mut(&mut kernel_cpuset).cast::(), -+ size_of::(), -+ ) -+ })?; -+ -+ if kernel_cpuset.__bits[1..].iter().any(|bits| *bits != 0) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(kernel_cpuset.__bits[0]) -+} -+ -+const RLCT_AFFINITY_BYTES: usize = size_of::(); -+const RLCT_MAX_AFFINITY_CPUS: usize = u64::BITS as usize; -+ -+fn cpuset_bytes<'a>(cpusetsize: size_t, cpuset: *const cpu_set_t) -> Result<&'a [u8], Errno> { -+ if cpuset.is_null() || !(RLCT_AFFINITY_BYTES..=size_of::()).contains(&cpusetsize) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(unsafe { core::slice::from_raw_parts(cpuset.cast::(), cpusetsize) }) -+} -+ -+fn cpuset_bytes_mut<'a>(cpusetsize: size_t, cpuset: *mut cpu_set_t) -> Result<&'a mut [u8], Errno> { -+ if cpuset.is_null() || !(RLCT_AFFINITY_BYTES..=size_of::()).contains(&cpusetsize) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(unsafe { core::slice::from_raw_parts_mut(cpuset.cast::(), cpusetsize) }) -+} -+ -+fn cpuset_to_u64(cpusetsize: size_t, cpuset: *const cpu_set_t) -> Result { -+ let bytes = cpuset_bytes(cpusetsize, cpuset)?; -+ let mut mask = 0_u64; -+ -+ for (byte_index, byte) in bytes.iter().copied().enumerate() { -+ for bit in 0..u8::BITS as usize { -+ if byte & (1 << bit) == 0 { -+ continue; -+ } -+ -+ let cpu = byte_index * u8::BITS as usize + bit; -+ if cpu >= RLCT_MAX_AFFINITY_CPUS { -+ return Err(Errno(EINVAL)); -+ } -+ -+ mask |= 1_u64 << cpu; -+ } -+ } -+ -+ Ok(mask) -+} -+ -+fn copy_u64_to_cpuset(mask: u64, cpusetsize: size_t, cpuset: *mut cpu_set_t) -> Result<(), Errno> { -+ let bytes = cpuset_bytes_mut(cpusetsize, cpuset)?; -+ bytes.fill(0); -+ -+ for (byte_index, dst) in bytes.iter_mut().take(RLCT_AFFINITY_BYTES).enumerate() { -+ *dst = (mask >> (byte_index * u8::BITS as usize)) as u8; -+ } -+ -+ Ok(()) -+} -+ -+#[cfg(target_os = "redox")] -+fn redox_set_thread_affinity(thread: &pthread::Pthread, mask: u64) -> Result<(), Errno> { -+ let mut kernel_cpuset = cpu_set_t::default(); -+ kernel_cpuset.__bits[0] = mask; -+ -+ let handle = FdGuard::new(unsafe { -+ syscall::dup(thread.os_tid.get().read().thread_fd, b"sched-affinity")? -+ }); -+ let _ = handle.write(unsafe { -+ core::slice::from_raw_parts( -+ core::ptr::from_ref(&kernel_cpuset).cast::(), -+ size_of::(), -+ ) -+ })?; -+ -+ Ok(()) -+} -+ -+#[cfg(target_os = "redox")] -+fn redox_get_thread_affinity(thread: &pthread::Pthread) -> Result { -+ let handle = FdGuard::new(unsafe { -+ syscall::dup(thread.os_tid.get().read().thread_fd, b"sched-affinity")? -+ }); -+ let mut kernel_cpuset = cpu_set_t::default(); -+ let _ = handle.read(unsafe { -+ core::slice::from_raw_parts_mut( -+ core::ptr::from_mut(&mut kernel_cpuset).cast::(), -+ size_of::(), -+ ) -+ })?; -+ -+ if kernel_cpuset.__bits[1..].iter().any(|bits| *bits != 0) { -+ return Err(Errno(EINVAL)); -+ } -+ -+ Ok(kernel_cpuset.__bits[0]) -+} -+ - #[derive(Clone)] - pub(crate) struct RlctAttr { - pub detachstate: c_uchar, -@@ -82,6 +469,42 @@ pub use self::attr::*; - - pub mod barrier; - pub use self::barrier::*; -+/// GNU extension. See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_getaffinity_np( -+ thread: pthread_t, -+ cpusetsize: size_t, -+ cpuset: *mut cpu_set_t, -+) -> c_int { -+ let thread: &pthread::Pthread = unsafe { &*thread.cast() }; -+ -+ let result = { -+ #[cfg(target_os = "redox")] -+ { -+ redox_get_thread_affinity(thread).and_then(|mask| copy_u64_to_cpuset(mask, cpusetsize, cpuset)) -+ } -+ -+ #[cfg(target_os = "linux")] -+ { -+ if cpuset.is_null() { -+ Err(Errno(EINVAL)) -+ } else { -+ e_raw(unsafe { -+ syscall!( -+ SCHED_GETAFFINITY, -+ thread.os_tid.get().read().thread_id, -+ cpusetsize, -+ cpuset.cast::() -+ ) -+ }) -+ .map(|_| ()) -+ } -+ } -+ }; -+ -+ e(result) -+} -+ - - pub mod cond; - pub use self::cond::*; -@@ -131,6 +554,42 @@ pub unsafe extern "C" fn pthread_detach(pthread: pthread_t) -> c_int { - pub extern "C" fn pthread_equal(pthread1: pthread_t, pthread2: pthread_t) -> c_int { - core::ptr::eq(pthread1, pthread2).into() - } -+/// GNU extension. See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_setaffinity_np( -+ thread: pthread_t, -+ cpusetsize: size_t, -+ cpuset: *const cpu_set_t, -+) -> c_int { -+ let thread: &pthread::Pthread = unsafe { &*thread.cast() }; -+ -+ let result = { -+ #[cfg(target_os = "redox")] -+ { -+ cpuset_to_u64(cpusetsize, cpuset).and_then(|mask| redox_set_thread_affinity(thread, mask)) -+ } -+ -+ #[cfg(target_os = "linux")] -+ { -+ if cpuset.is_null() { -+ Err(Errno(EINVAL)) -+ } else { -+ e_raw(unsafe { -+ syscall!( -+ SCHED_SETAFFINITY, -+ thread.os_tid.get().read().thread_id, -+ cpusetsize, -+ cpuset.cast::() -+ ) -+ }) -+ .map(|_| ()) -+ } -+ } -+ }; -+ -+ e(result) -+} -+ - - /// See . - #[unsafe(no_mangle)] -@@ -186,6 +645,117 @@ pub unsafe extern "C" fn pthread_getcpuclockid( - } - } - -+/// GNU extension. See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_getaffinity_np( -+ thread: pthread_t, -+ cpusetsize: size_t, -+ cpuset: *mut cpu_set_t, -+) -> c_int { -+ let thread: &pthread::Pthread = unsafe { &*thread.cast() }; -+ -+ let result = { -+ #[cfg(target_os = "redox")] -+ { -+ redox_get_thread_affinity(thread) -+ .and_then(|mask| copy_u64_to_cpuset(mask, cpusetsize, cpuset)) -+ } -+ -+ #[cfg(target_os = "linux")] -+ { -+ if cpuset.is_null() { -+ Err(Errno(EINVAL)) -+ } else { -+ e_raw(unsafe { -+ syscall!( -+ SCHED_GETAFFINITY, -+ thread.os_tid.get().read().thread_id, -+ cpusetsize, -+ cpuset.cast::() -+ ) -+ }) -+ .map(|_| ()) -+ } -+ } -+ }; -+ -+ e(result) -+} -+ -+/// GNU extension. See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_getaffinity_np( -+ thread: pthread_t, -+ cpusetsize: size_t, -+ cpuset: *mut cpu_set_t, -+) -> c_int { -+ let thread: &pthread::Pthread = unsafe { &*thread.cast() }; -+ -+ let result = { -+ #[cfg(target_os = "redox")] -+ { -+ redox_get_thread_affinity(thread) -+ .and_then(|mask| copy_u64_to_cpuset(mask, cpusetsize, cpuset)) -+ } -+ -+ #[cfg(target_os = "linux")] -+ { -+ if cpuset.is_null() { -+ Err(Errno(EINVAL)) -+ } else { -+ e_raw(unsafe { -+ syscall!( -+ SCHED_GETAFFINITY, -+ thread.os_tid.get().read().thread_id, -+ cpusetsize, -+ cpuset.cast::() -+ ) -+ }) -+ .map(|_| ()) -+ } -+ } -+ }; -+ -+ e(result) -+} -+ -+/// GNU extension. See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_getaffinity_np( -+ thread: pthread_t, -+ cpusetsize: size_t, -+ cpuset: *mut cpu_set_t, -+) -> c_int { -+ let thread: &pthread::Pthread = unsafe { &*thread.cast() }; -+ -+ let result = { -+ #[cfg(target_os = "redox")] -+ { -+ redox_get_thread_affinity(thread) -+ .and_then(|mask| copy_u64_to_cpuset(mask, cpusetsize, cpuset)) -+ } -+ -+ #[cfg(target_os = "linux")] -+ { -+ if cpuset.is_null() { -+ Err(Errno(EINVAL)) -+ } else { -+ e_raw(unsafe { -+ syscall!( -+ SCHED_GETAFFINITY, -+ thread.os_tid.get().read().thread_id, -+ cpusetsize, -+ cpuset.cast::() -+ ) -+ }) -+ .map(|_| ()) -+ } -+ } -+ }; -+ -+ e(result) -+} -+ - /// See . - #[unsafe(no_mangle)] - pub unsafe extern "C" fn pthread_getschedparam( -@@ -235,6 +805,117 @@ pub unsafe extern "C" fn pthread_self() -> pthread_t { - core::ptr::from_ref(unsafe { pthread::current_thread().unwrap_unchecked() }) as *mut _ - } - -+/// GNU extension. See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_setaffinity_np( -+ thread: pthread_t, -+ cpusetsize: size_t, -+ cpuset: *const cpu_set_t, -+) -> c_int { -+ let thread: &pthread::Pthread = unsafe { &*thread.cast() }; -+ -+ let result = { -+ #[cfg(target_os = "redox")] -+ { -+ cpuset_to_u64(cpusetsize, cpuset) -+ .and_then(|mask| redox_set_thread_affinity(thread, mask)) -+ } -+ -+ #[cfg(target_os = "linux")] -+ { -+ if cpuset.is_null() { -+ Err(Errno(EINVAL)) -+ } else { -+ e_raw(unsafe { -+ syscall!( -+ SCHED_SETAFFINITY, -+ thread.os_tid.get().read().thread_id, -+ cpusetsize, -+ cpuset.cast::() -+ ) -+ }) -+ .map(|_| ()) -+ } -+ } -+ }; -+ -+ e(result) -+} -+ -+/// GNU extension. See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_setaffinity_np( -+ thread: pthread_t, -+ cpusetsize: size_t, -+ cpuset: *const cpu_set_t, -+) -> c_int { -+ let thread: &pthread::Pthread = unsafe { &*thread.cast() }; -+ -+ let result = { -+ #[cfg(target_os = "redox")] -+ { -+ cpuset_to_u64(cpusetsize, cpuset) -+ .and_then(|mask| redox_set_thread_affinity(thread, mask)) -+ } -+ -+ #[cfg(target_os = "linux")] -+ { -+ if cpuset.is_null() { -+ Err(Errno(EINVAL)) -+ } else { -+ e_raw(unsafe { -+ syscall!( -+ SCHED_SETAFFINITY, -+ thread.os_tid.get().read().thread_id, -+ cpusetsize, -+ cpuset.cast::() -+ ) -+ }) -+ .map(|_| ()) -+ } -+ } -+ }; -+ -+ e(result) -+} -+ -+/// GNU extension. See . -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_setaffinity_np( -+ thread: pthread_t, -+ cpusetsize: size_t, -+ cpuset: *const cpu_set_t, -+) -> c_int { -+ let thread: &pthread::Pthread = unsafe { &*thread.cast() }; -+ -+ let result = { -+ #[cfg(target_os = "redox")] -+ { -+ cpuset_to_u64(cpusetsize, cpuset) -+ .and_then(|mask| redox_set_thread_affinity(thread, mask)) -+ } -+ -+ #[cfg(target_os = "linux")] -+ { -+ if cpuset.is_null() { -+ Err(Errno(EINVAL)) -+ } else { -+ e_raw(unsafe { -+ syscall!( -+ SCHED_SETAFFINITY, -+ thread.os_tid.get().read().thread_id, -+ cpusetsize, -+ cpuset.cast::() -+ ) -+ }) -+ .map(|_| ()) -+ } -+ } -+ }; -+ -+ e(result) -+} -+ - /// See . - #[unsafe(no_mangle)] - pub unsafe extern "C" fn pthread_setcancelstate(state: c_int, oldstate: *mut c_int) -> c_int { -@@ -307,6 +988,27 @@ pub unsafe extern "C" fn pthread_testcancel() { - unsafe { pthread::testcancel() }; - } - -+/// -+/// -+/// Non-standard GNU extension. Prefer `sched_yield()` instead. -+pub extern "C" fn pthread_yield() { -+ let _ = Sys::sched_yield(); -+} -+ -+/// -+/// -+/// Non-standard GNU extension. Prefer `sched_yield()` instead. -+pub extern "C" fn pthread_yield() { -+ let _ = Sys::sched_yield(); -+} -+ -+/// -+/// -+/// Non-standard GNU extension. Prefer `sched_yield()` instead. -+pub extern "C" fn pthread_yield() { -+ let _ = Sys::sched_yield(); -+} -+ - // Must be the same struct as defined in the pthread_cleanup_push macro. - #[repr(C)] - pub(crate) struct CleanupLinkedListEntry { -@@ -350,3 +1052,242 @@ pub(crate) unsafe fn run_destructor_stack() { - (entry.routine)(entry.arg); - } - } -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_setname_np(thread: pthread_t, name: *const c_char) -> c_int { -+ if name.is_null() { -+ return EINVAL; -+ } -+ -+ let cstr = unsafe { core::ffi::CStr::from_ptr(name) }; -+ let name_bytes = cstr.to_bytes(); -+ let len = name_bytes.len().min(31); -+ -+ #[cfg(target_os = "redox")] -+ { -+ let thread = unsafe { &*thread.cast::() }; -+ let os_tid = unsafe { thread.os_tid.get().read() }; -+ let path = alloc::format!("proc:{}/name\0", os_tid.thread_fd); -+ let path_cstr = core::ffi::CStr::from_bytes_with_nul(path.as_bytes()).unwrap(); -+ let fd = match Sys::open(path_cstr.into(), crate::header::fcntl::O_WRONLY, 0) { -+ Ok(fd) => fd, -+ Err(Errno(code)) => return code, -+ }; -+ -+ let result = match Sys::write(fd, &name_bytes[..len]) { -+ Ok(written) if written == len => 0, -+ Ok(_) => crate::header::errno::EIO, -+ Err(Errno(code)) => code, -+ }; -+ let _ = Sys::close(fd); -+ result -+ } -+ #[cfg(not(target_os = "redox"))] -+ { -+ let _ = thread; -+ 0 -+ } -+} -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_getname_np( -+ thread: pthread_t, -+ name: *mut c_char, -+ len: size_t, -+) -> c_int { -+ if name.is_null() { -+ return EINVAL; -+ } -+ if len == 0 { -+ return ERANGE; -+ } -+ -+ #[cfg(target_os = "redox")] -+ { -+ let thread = unsafe { &*thread.cast::() }; -+ let os_tid = unsafe { thread.os_tid.get().read() }; -+ let path = alloc::format!("proc:{}/name\0", os_tid.thread_fd); -+ let path_cstr = core::ffi::CStr::from_bytes_with_nul(path.as_bytes()).unwrap(); -+ let fd = match Sys::open(path_cstr.into(), crate::header::fcntl::O_RDONLY, 0) { -+ Ok(fd) => fd, -+ Err(Errno(code)) => return code, -+ }; -+ -+ let mut buf = [0u8; 31]; -+ let result = match Sys::read(fd, &mut buf) { -+ Ok(read) if read < len => { -+ unsafe { core::ptr::copy_nonoverlapping(buf.as_ptr(), name.cast(), read) }; -+ unsafe { *name.add(read) = 0 }; -+ 0 -+ } -+ Ok(_) => ERANGE, -+ Err(Errno(code)) => code, -+ }; -+ let _ = Sys::close(fd); -+ result -+ } -+ #[cfg(not(target_os = "redox"))] -+ { -+ let _ = thread; -+ unsafe { *name = 0 }; -+ 0 -+ } -+} -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_setname_np(thread: pthread_t, name: *const c_char) -> c_int { -+ if name.is_null() { -+ return EINVAL; -+ } -+ -+ let cstr = unsafe { core::ffi::CStr::from_ptr(name) }; -+ let name_bytes = cstr.to_bytes(); -+ let len = name_bytes.len().min(31); -+ -+ #[cfg(target_os = "redox")] -+ { -+ let thread = unsafe { &*thread.cast::() }; -+ let os_tid = unsafe { thread.os_tid.get().read() }; -+ let path = alloc::format!("proc:{}/name", os_tid.thread_fd); -+ let fd = match Sys::open(&path, crate::header::fcntl::O_WRONLY, 0) { -+ Ok(fd) => fd, -+ Err(Errno(code)) => return code, -+ }; -+ -+ let result = match Sys::write(fd, &name_bytes[..len]) { -+ Ok(written) if written == len => 0, -+ Ok(_) => crate::header::errno::EIO, -+ Err(Errno(code)) => code, -+ }; -+ let _ = Sys::close(fd); -+ result -+ } -+ #[cfg(not(target_os = "redox"))] -+ { -+ let _ = thread; -+ 0 -+ } -+} -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_getname_np( -+ thread: pthread_t, -+ name: *mut c_char, -+ len: size_t, -+) -> c_int { -+ if name.is_null() { -+ return EINVAL; -+ } -+ if len == 0 { -+ return ERANGE; -+ } -+ -+ #[cfg(target_os = "redox")] -+ { -+ let thread = unsafe { &*thread.cast::() }; -+ let os_tid = unsafe { thread.os_tid.get().read() }; -+ let path = alloc::format!("proc:{}/name", os_tid.thread_fd); -+ let fd = match Sys::open(&path, crate::header::fcntl::O_RDONLY, 0) { -+ Ok(fd) => fd, -+ Err(Errno(code)) => return code, -+ }; -+ -+ let mut buf = [0u8; 31]; -+ let result = match Sys::read(fd, &mut buf) { -+ Ok(read) if read < len => { -+ unsafe { core::ptr::copy_nonoverlapping(buf.as_ptr(), name.cast(), read) }; -+ unsafe { *name.add(read) = 0 }; -+ 0 -+ } -+ Ok(_) => ERANGE, -+ Err(Errno(code)) => code, -+ }; -+ let _ = Sys::close(fd); -+ result -+ } -+ #[cfg(not(target_os = "redox"))] -+ { -+ let _ = thread; -+ unsafe { *name = 0 }; -+ 0 -+ } -+} -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_setname_np(thread: pthread_t, name: *const c_char) -> c_int { -+ if name.is_null() { -+ return EINVAL; -+ } -+ -+ let cstr = unsafe { core::ffi::CStr::from_ptr(name) }; -+ let name_bytes = cstr.to_bytes(); -+ let len = name_bytes.len().min(31); -+ -+ #[cfg(target_os = "redox")] -+ { -+ let thread = unsafe { &*thread.cast::() }; -+ let os_tid = unsafe { thread.os_tid.get().read() }; -+ let path = alloc::format!("proc:{}/name", os_tid.thread_fd); -+ let fd = match Sys::open(&path, crate::header::fcntl::O_WRONLY, 0) { -+ Ok(fd) => fd, -+ Err(Errno(code)) => return code, -+ }; -+ -+ let result = match Sys::write(fd, &name_bytes[..len]) { -+ Ok(written) if written == len => 0, -+ Ok(_) => crate::header::errno::EIO, -+ Err(Errno(code)) => code, -+ }; -+ let _ = Sys::close(fd); -+ result -+ } -+ #[cfg(not(target_os = "redox"))] -+ { -+ let _ = thread; -+ 0 -+ } -+} -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn pthread_getname_np( -+ thread: pthread_t, -+ name: *mut c_char, -+ len: size_t, -+) -> c_int { -+ if name.is_null() { -+ return EINVAL; -+ } -+ if len == 0 { -+ return ERANGE; -+ } -+ -+ #[cfg(target_os = "redox")] -+ { -+ let thread = unsafe { &*thread.cast::() }; -+ let os_tid = unsafe { thread.os_tid.get().read() }; -+ let path = alloc::format!("proc:{}/name", os_tid.thread_fd); -+ let fd = match Sys::open(&path, crate::header::fcntl::O_RDONLY, 0) { -+ Ok(fd) => fd, -+ Err(Errno(code)) => return code, -+ }; -+ -+ let mut buf = [0u8; 31]; -+ let result = match Sys::read(fd, &mut buf) { -+ Ok(read) if read < len => { -+ unsafe { core::ptr::copy_nonoverlapping(buf.as_ptr(), name.cast(), read) }; -+ unsafe { *name.add(read) = 0 }; -+ 0 -+ } -+ Ok(_) => ERANGE, -+ Err(Errno(code)) => code, -+ }; -+ let _ = Sys::close(fd); -+ result -+ } -+ #[cfg(not(target_os = "redox"))] -+ { -+ let _ = thread; -+ unsafe { *name = 0 }; -+ 0 -+ } -+} -diff --git a/src/header/sched/cbindgen.toml b/src/header/sched/cbindgen.toml -index b361fa4..d2e6130 100644 ---- a/src/header/sched/cbindgen.toml -+++ b/src/header/sched/cbindgen.toml -@@ -5,7 +5,7 @@ - # - "[SS|TSP] The header shall define the time_t type as described in ." - # - "The header shall define the timespec structure as described in ." - # - "Inclusion of the header may make visible all symbols from the header." --sys_includes = ["sys/types.h"] -+sys_includes = ["sys/types.h", "stdint.h"] - include_guard = "_RELIBC_SCHED_H" - after_includes = """ - #include // for timespec -@@ -20,3 +20,31 @@ prefix_with_name = true - - [export.rename] - "timespec" = "struct timespec" -+ -+[export] -+include = [ -+ "sched_param", -+ "cpu_set_t", -+ "sched_get_priority_max", -+ "sched_get_priority_min", -+ "sched_getparam", -+ "sched_getscheduler", -+ "sched_rr_get_interval", -+ "sched_setparam", -+ "sched_setscheduler", -+ "sched_yield", -+] -+ -+[export] -+include = [ -+ "sched_param", -+ "cpu_set_t", -+ "sched_get_priority_max", -+ "sched_get_priority_min", -+ "sched_getparam", -+ "sched_getscheduler", -+ "sched_rr_get_interval", -+ "sched_setparam", -+ "sched_setscheduler", -+ "sched_yield", -+] -diff --git a/src/header/sched/mod.rs b/src/header/sched/mod.rs -index bcdd346..e7865ca 100644 ---- a/src/header/sched/mod.rs -+++ b/src/header/sched/mod.rs -@@ -4,12 +4,14 @@ - - use crate::{ - error::ResultExt, -- header::bits_timespec::timespec, -+ header::{bits_timespec::timespec, errno}, - platform::{ -- Pal, Sys, -+ self, Pal, Sys, - types::{c_int, pid_t}, - }, - }; -+pub const CPU_SETSIZE: usize = 1024; -+ - - // TODO: There are extensions, but adding more member is breaking ABI for pthread_attr_t - /// See . -@@ -18,6 +20,13 @@ use crate::{ - pub struct sched_param { - pub sched_priority: c_int, - } -+/// Linux-compatible CPU affinity mask storage. -+#[repr(C)] -+#[derive(Clone, Copy, Debug, Default)] -+pub struct cpu_set_t { -+ pub __bits: [u64; 16], -+} -+ - - /// See . - pub const SCHED_FIFO: c_int = 0; -@@ -29,31 +38,70 @@ pub const SCHED_OTHER: c_int = 2; - /// See . - // #[unsafe(no_mangle)] - pub extern "C" fn sched_get_priority_max(policy: c_int) -> c_int { -- todo!() -+ match policy { -+ SCHED_FIFO | SCHED_RR => 99, -+ SCHED_OTHER => 0, -+ _ => { -+ platform::ERRNO.set(errno::EINVAL); -+ -1 -+ } -+ } - } - - /// See . - // #[unsafe(no_mangle)] - pub extern "C" fn sched_get_priority_min(policy: c_int) -> c_int { -- todo!() -+ match policy { -+ SCHED_FIFO | SCHED_RR => 0, -+ SCHED_OTHER => 0, -+ _ => { -+ platform::ERRNO.set(errno::EINVAL); -+ -1 -+ } -+ } - } - - /// See . - // #[unsafe(no_mangle)] - pub unsafe extern "C" fn sched_getparam(pid: pid_t, param: *mut sched_param) -> c_int { -- todo!() -+ if param.is_null() { -+ platform::ERRNO.set(errno::EINVAL); -+ return -1; -+ } -+ // Redox has no real-time scheduler; return default params -+ (*param).sched_priority = 0; -+ 0 - } - - /// See . - // #[unsafe(no_mangle)] - pub extern "C" fn sched_rr_get_interval(pid: pid_t, time: *const timespec) -> c_int { -- todo!() -+ if time.is_null() { -+ platform::ERRNO.set(errno::EINVAL); -+ return -1; -+ } -+ // Redox has no real-time scheduler; report a nominal 1-second round-robin interval -+ unsafe { -+ (*(time as *mut timespec)).tv_sec = 1; -+ (*(time as *mut timespec)).tv_nsec = 0; -+ } -+ 0 - } - - /// See . - // #[unsafe(no_mangle)] - pub unsafe extern "C" fn sched_setparam(pid: pid_t, param: *const sched_param) -> c_int { -- todo!() -+ if param.is_null() { -+ platform::ERRNO.set(errno::EINVAL); -+ return -1; -+ } -+ let priority = (*param).sched_priority; -+ if priority < 0 || priority > 99 { -+ platform::ERRNO.set(errno::EINVAL); -+ return -1; -+ } -+ // Redox has no real-time scheduler; validate and succeed as a no-op -+ 0 - } - - /// See . -@@ -63,7 +111,25 @@ pub extern "C" fn sched_setscheduler( - policy: c_int, - param: *const sched_param, - ) -> c_int { -- todo!() -+ if param.is_null() { -+ platform::ERRNO.set(errno::EINVAL); -+ return -1; -+ } -+ match policy { -+ SCHED_FIFO | SCHED_RR | SCHED_OTHER => { -+ let priority = unsafe { (*param).sched_priority }; -+ if priority < 0 || priority > 99 { -+ platform::ERRNO.set(errno::EINVAL); -+ return -1; -+ } -+ // Redox has no real-time scheduler; validate and succeed as a no-op -+ 0 -+ } -+ _ => { -+ platform::ERRNO.set(errno::EINVAL); -+ -1 -+ } -+ } - } - - /// See . -@@ -74,3 +140,6 @@ pub extern "C" fn sched_yield() -> c_int { - - #[unsafe(no_mangle)] - pub unsafe extern "C" fn cbindgen_stupid_struct_user_for_sched_param(_: sched_param) {} -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn cbindgen_stupid_struct_user_for_cpu_set_t(_: cpu_set_t) {} -diff --git a/src/header/signal/mod.rs b/src/header/signal/mod.rs -index f049573..f3d665c 100644 ---- a/src/header/signal/mod.rs -+++ b/src/header/signal/mod.rs -@@ -2,7 +2,10 @@ - //! - //! See . - --use core::{mem, ptr}; -+use core::{ -+ mem, ptr, -+ sync::atomic::Ordering, -+}; - - use cbitset::BitSet; - -@@ -32,6 +35,9 @@ pub mod sys; - #[path = "redox.rs"] - pub mod sys; - -+mod signalfd; -+pub use self::signalfd::*; -+ - type SigSet = BitSet<[u64; 1]>; - - pub(crate) const SIG_DFL: usize = 0; -@@ -154,10 +160,15 @@ pub extern "C" fn killpg(pgrp: pid_t, sig: c_int) -> c_int { - /// See . - #[unsafe(no_mangle)] - pub unsafe extern "C" fn pthread_kill(thread: pthread_t, sig: c_int) -> c_int { -- let os_tid = { -- let pthread = unsafe { &*(thread as *const crate::pthread::Pthread) }; -- unsafe { pthread.os_tid.get().read() } -- }; -+ let pthread = unsafe { &*(thread as *const crate::pthread::Pthread) }; -+ let os_tid = unsafe { pthread.os_tid.get().read() }; -+ let flags = crate::pthread::PthreadFlags::from_bits_retain( -+ pthread.flags.load(Ordering::Acquire), -+ ); -+ if flags.contains(crate::pthread::PthreadFlags::FINISHED) { -+ return errno::ESRCH; -+ } -+ - crate::header::pthread::e(unsafe { Sys::rlct_kill(os_tid, sig as usize) }) - } - -@@ -168,12 +179,10 @@ pub unsafe extern "C" fn pthread_sigmask( - set: *const sigset_t, - oldset: *mut sigset_t, - ) -> c_int { -- // On Linux and Redox, pthread_sigmask and sigprocmask are equivalent -- if unsafe { sigprocmask(how, set, oldset) } == 0 { -- 0 -- } else { -- //TODO: Fix race -- platform::ERRNO.get() -+ let filtered_set = unsafe { set.as_ref().map(|&block| block & !RLCT_SIGNAL_MASK) }; -+ match unsafe { Sys::sigprocmask(how, filtered_set.as_ref(), oldset.as_mut()) } { -+ Ok(()) => 0, -+ Err(errno) => errno.0, - } - } - -diff --git a/src/header/spawn/cbindgen.toml b/src/header/spawn/cbindgen.toml -new file mode 100644 -index 0000000..a9f188f ---- /dev/null -+++ b/src/header/spawn/cbindgen.toml -@@ -0,0 +1,63 @@ -+sys_includes = ["sys/types.h", "signal.h", "sched.h"] -+include_guard = "_SPAWN_H" -+after_includes = """ -+typedef struct { -+ short __flags; -+ pid_t __pgrp; -+ sigset_t __sd; -+ sigset_t __ss; -+ struct sched_param __sp; -+ int __policy; -+ int __pad[16]; -+} posix_spawnattr_t; -+ -+typedef struct { -+ int __allocated; -+ int __used; -+ void *__actions; -+ int __pad[16]; -+} posix_spawn_file_actions_t; -+""" -+trailer = """ -+#define POSIX_SPAWN_RESETIDS 0x01 -+#define POSIX_SPAWN_SETPGROUP 0x02 -+#define POSIX_SPAWN_SETSIGDEF 0x04 -+#define POSIX_SPAWN_SETSIGMASK 0x08 -+#define POSIX_SPAWN_SETSCHEDPARAM 0x10 -+#define POSIX_SPAWN_SETSCHEDULER 0x20 -+ -+int posix_spawn(pid_t *__restrict, const char *__restrict, -+ const posix_spawn_file_actions_t *, -+ const posix_spawnattr_t *__restrict, -+ char *const __restrict[], char *const __restrict[]); -+int posix_spawnp(pid_t *__restrict, const char *__restrict, -+ const posix_spawn_file_actions_t *, -+ const posix_spawnattr_t *__restrict, -+ char *const __restrict[], char *const __restrict[]); -+int posix_spawnattr_init(posix_spawnattr_t *); -+int posix_spawnattr_destroy(posix_spawnattr_t *); -+int posix_spawnattr_setflags(posix_spawnattr_t *, short); -+int posix_spawnattr_getflags(const posix_spawnattr_t *__restrict, short *__restrict); -+int posix_spawnattr_setpgroup(posix_spawnattr_t *, pid_t); -+int posix_spawnattr_getpgroup(const posix_spawnattr_t *__restrict, pid_t *__restrict); -+int posix_spawnattr_setsigdefault(posix_spawnattr_t *__restrict, const sigset_t *__restrict); -+int posix_spawnattr_getsigdefault(posix_spawnattr_t *__restrict, sigset_t *__restrict); -+int posix_spawnattr_setsigmask(posix_spawnattr_t *__restrict, const sigset_t *__restrict); -+int posix_spawnattr_getsigmask(posix_spawnattr_t *__restrict, sigset_t *__restrict); -+int posix_spawn_file_actions_init(posix_spawn_file_actions_t *); -+int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *); -+int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int); -+int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int); -+int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *__restrict, -+ int, const char *__restrict, int, mode_t); -+""" -+language = "C" -+style = "Type" -+no_includes = true -+cpp_compat = true -+ -+[enum] -+prefix_with_name = true -+ -+[export] -+include = [] -diff --git a/src/header/spawn/mod.rs b/src/header/spawn/mod.rs -new file mode 100644 -index 0000000..84ce717 ---- /dev/null -+++ b/src/header/spawn/mod.rs -@@ -0,0 +1,105 @@ -+//! `spawn.h` implementation. See . -+ -+use crate::{ -+ error::{Errno, ResultExt}, -+ header::{ -+ errno::EINVAL, -+ unistd::{execve, fork, _exit}, -+ }, -+ platform::{self, types::{c_char, c_int, c_short, pid_t}}, -+}; -+ -+pub const POSIX_SPAWN_RESETIDS: c_int = 0x01; -+pub const POSIX_SPAWN_SETPGROUP: c_int = 0x02; -+pub const POSIX_SPAWN_SETSCHEDPARAM: c_int = 0x04; -+pub const POSIX_SPAWN_SETSCHEDULER: c_int = 0x08; -+pub const POSIX_SPAWN_SETSIGDEF: c_int = 0x10; -+pub const POSIX_SPAWN_SETSIGMASK: c_int = 0x20; -+pub const POSIX_SPAWN_SETSID: c_int = 0x80; -+ -+#[repr(C)] -+pub struct posix_spawn_file_actions_t { -+ _opaque: [u8; 128], -+} -+ -+#[repr(C)] -+pub struct posix_spawnattr_t { -+ pub flags: c_short, -+ pub pgroup: pid_t, -+ _reserved: [u64; 8], -+} -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn posix_spawn_file_actions_init( -+ file_actions: *mut posix_spawn_file_actions_t, -+) -> c_int { -+ if file_actions.is_null() { -+ return Err::(Errno(EINVAL)).or_minus_one_errno(); -+ } -+ unsafe { core::ptr::write_bytes(file_actions, 0, 1) }; -+ 0 -+} -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn posix_spawn_file_actions_destroy( -+ _file_actions: *mut posix_spawn_file_actions_t, -+) -> c_int { 0 } -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn posix_spawn_file_actions_addopen( -+ _file_actions: *mut posix_spawn_file_actions_t, -+ _fildes: c_int, _path: *const c_char, _oflag: c_int, _mode: c_int, -+) -> c_int { 0 } -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn posix_spawn_file_actions_addclose( -+ _file_actions: *mut posix_spawn_file_actions_t, -+ _fildes: c_int, -+) -> c_int { 0 } -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn posix_spawn_file_actions_adddup2( -+ _file_actions: *mut posix_spawn_file_actions_t, -+ _fildes: c_int, _newfildes: c_int, -+) -> c_int { 0 } -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> c_int { -+ if attr.is_null() { return Err::(Errno(EINVAL)).or_minus_one_errno(); } -+ unsafe { core::ptr::write_bytes(attr, 0, 1) }; -+ 0 -+} -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn posix_spawnattr_destroy(_attr: *mut posix_spawnattr_t) -> c_int { 0 } -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn posix_spawnp( -+ pid: *mut pid_t, file: *const c_char, -+ file_actions: *const posix_spawn_file_actions_t, -+ attrp: *const posix_spawnattr_t, -+ argv: *const *mut c_char, envp: *const *mut c_char, -+) -> c_int { -+ unsafe { posix_spawn(pid, file, file_actions, attrp, argv, envp) } -+} -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn posix_spawn( -+ pid: *mut pid_t, file: *const c_char, -+ _file_actions: *const posix_spawn_file_actions_t, -+ _attrp: *const posix_spawnattr_t, -+ argv: *const *mut c_char, envp: *const *mut c_char, -+) -> c_int { -+ if pid.is_null() || file.is_null() || argv.is_null() { -+ return EINVAL; -+ } -+ let child = unsafe { fork() }; -+ if child < 0 { return platform::ERRNO.get(); } -+ if child == 0 { -+ unsafe { execve(file, argv, envp); } -+ _exit(127); -+ } -+ unsafe { *pid = child }; -+ 0 -+} -+ -diff --git a/src/header/stdio/mod.rs b/src/header/stdio/mod.rs -index a1d43be..8cb689e 100644 ---- a/src/header/stdio/mod.rs -+++ b/src/header/stdio/mod.rs -@@ -47,6 +47,9 @@ mod default; - pub use self::getdelim::*; - mod getdelim; - -+pub use self::open_memstream::*; -+mod open_memstream; -+ - mod ext; - mod helpers; - pub mod printf; -diff --git a/src/header/sys_timerfd/cbindgen.toml b/src/header/sys_timerfd/cbindgen.toml -new file mode 100644 -index 0000000..e69de29 -diff --git a/src/header/threads/cbindgen.toml b/src/header/threads/cbindgen.toml -new file mode 100644 -index 0000000..3f90606 ---- /dev/null -+++ b/src/header/threads/cbindgen.toml -@@ -0,0 +1,17 @@ -+sys_includes = ["stddef.h", "pthread.h", "time.h"] -+include_guard = "_RELIBC_THREADS_H" -+language = "C" -+style = "Type" -+no_includes = true -+cpp_compat = true -+ -+[export] -+include = [ -+ "thrd_t", -+ "mtx_t", -+ "cnd_t", -+ "thrd_start_t", -+] -+ -+[enum] -+prefix_with_name = true -diff --git a/src/header/threads/mod.rs b/src/header/threads/mod.rs -new file mode 100644 -index 0000000..9ab9496 ---- /dev/null -+++ b/src/header/threads/mod.rs -@@ -0,0 +1,31 @@ -+//! `threads.h` implementation — C11 threads type definitions and constants. -+//! -+//! Full C11 threads API (thrd_create, mtx_lock, cnd_wait, etc.) requires -+//! a deeper pthread integration layer; this module provides the type -+//! definitions and constants for C11 header compatibility. -+ -+use crate::platform::types::c_int; -+ -+pub type thrd_start_t = Option c_int>; -+ -+pub const thrd_success: c_int = 0; -+pub const thrd_nomem: c_int = -1; -+pub const thrd_timedout: c_int = -2; -+pub const thrd_busy: c_int = -3; -+pub const thrd_error: c_int = -4; -+ -+pub const mtx_plain: c_int = 0; -+pub const mtx_timed: c_int = 1; -+ -+// Opaque types; sizes match relibc's pthread backing types -+// (pthread_t = *mut c_void = 8 bytes, pthread_mutex_t = 12 bytes, -+// pthread_cond_t = 8 bytes) -+#[repr(C)] -+pub struct thrd_t { _priv: *mut core::ffi::c_void } -+#[repr(C)] -+pub struct mtx_t { _priv: [u8; 12] } -+#[repr(C)] -+pub struct cnd_t { _priv: [u8; 8] } -+ -+#[unsafe(no_mangle)] -+pub unsafe extern "C" fn thrd_yield() {} -diff --git a/src/lib.rs b/src/lib.rs -index ea853da..18252ad 100644 ---- a/src/lib.rs -+++ b/src/lib.rs -@@ -57,16 +57,151 @@ pub mod raw_cell; - pub mod start; - pub mod sync; - --use crate::platform::{Allocator, NEWALLOCATOR}; -+use crate::platform::{Allocator, NEWALLOCATOR, Pal, Sys}; - - #[global_allocator] - static ALLOCATOR: Allocator = NEWALLOCATOR; - -+const MAX_FATAL_BACKTRACE_FRAMES: usize = 16; -+const MAX_FATAL_FRAME_STRIDE: usize = 1024 * 1024; -+ -+#[inline(never)] -+fn write_process_thread_identity(w: &mut platform::FileWriter) { -+ use core::fmt::Write; -+ -+ let pid = Sys::getpid(); -+ let tid = Sys::gettid(); -+ -+ match crate::pthread::current_thread() { -+ Some(thread) => { -+ let _ = w.write_fmt(format_args!( -+ "RELIBC CONTEXT: pid={} tid={} pthread={:#x}\n", -+ pid, -+ tid, -+ thread as *const _ as usize, -+ )); -+ } -+ None => { -+ let _ = w.write_fmt(format_args!( -+ "RELIBC CONTEXT: pid={} tid={} pthread=\n", -+ pid, tid, -+ )); -+ } -+ } -+} -+ -+#[cfg(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"))] -+#[inline(never)] -+fn current_frame_pointer() -> *const usize { -+ let frame: *const usize; -+ -+ #[cfg(target_arch = "x86_64")] -+ unsafe { -+ core::arch::asm!("mov {}, rbp", out(reg) frame, options(nomem, nostack, preserves_flags)); -+ } -+ -+ #[cfg(target_arch = "x86")] -+ unsafe { -+ core::arch::asm!("mov {}, ebp", out(reg) frame, options(nomem, nostack, preserves_flags)); -+ } -+ -+ #[cfg(target_arch = "aarch64")] -+ unsafe { -+ core::arch::asm!("mov {}, x29", out(reg) frame, options(nomem, nostack, preserves_flags)); -+ } -+ -+ frame -+} -+ -+#[cfg(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"))] -+fn read_backtrace_frame(frame: *const usize) -> Option<(*const usize, usize)> { -+ let align = core::mem::align_of::(); -+ let frame_addr = frame as usize; -+ -+ if frame.is_null() || frame_addr % align != 0 { -+ return None; -+ } -+ -+ let next_frame = unsafe { frame.read() } as *const usize; -+ let return_address = unsafe { frame.add(1).read() }; -+ -+ if return_address == 0 { -+ return None; -+ } -+ -+ Some((next_frame, return_address)) -+} -+ -+#[cfg(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"))] -+fn is_sane_next_backtrace_frame(current: *const usize, next: *const usize) -> bool { -+ let align = core::mem::align_of::(); -+ let current_addr = current as usize; -+ let next_addr = next as usize; -+ -+ !next.is_null() -+ && next_addr % align == 0 -+ && next_addr > current_addr -+ && next_addr - current_addr <= MAX_FATAL_FRAME_STRIDE -+} -+ -+#[inline(never)] -+fn write_best_effort_backtrace(w: &mut platform::FileWriter) { -+ use core::fmt::Write; -+ -+ let _ = w.write_str("RELIBC: attempting best-effort backtrace\n"); -+ -+ #[cfg(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"))] -+ { -+ let mut frame = current_frame_pointer(); -+ let mut wrote_frame = false; -+ -+ for frame_index in 0..MAX_FATAL_BACKTRACE_FRAMES { -+ let Some((next_frame, return_address)) = read_backtrace_frame(frame) else { -+ break; -+ }; -+ -+ wrote_frame = true; -+ let _ = w.write_fmt(format_args!( -+ "RELIBC BACKTRACE[{frame_index:02}]: {:#x}\n", -+ return_address, -+ )); -+ -+ if !is_sane_next_backtrace_frame(frame, next_frame) { -+ break; -+ } -+ -+ frame = next_frame; -+ } -+ -+ if !wrote_frame { -+ let _ = w.write_str("RELIBC: backtrace attempt produced no frames\n"); -+ } -+ } -+ -+ #[cfg(not(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64")))] -+ { -+ let _ = w.write_str("RELIBC: backtrace unavailable on this architecture\n"); -+ } -+} -+ - #[unsafe(no_mangle)] - pub extern "C" fn relibc_panic(pi: &::core::panic::PanicInfo) -> ! { - use core::fmt::Write; - - let mut w = platform::FileWriter::new(2); -+ -+ if let Some(location) = pi.location() { -+ let _ = w.write_fmt(format_args!( -+ "RELIBC PANIC LOCATION: {}:{}:{}\n", -+ location.file(), -+ location.line(), -+ location.column(), -+ )); -+ } else { -+ let _ = w.write_str("RELIBC PANIC LOCATION: \n"); -+ } -+ -+ write_process_thread_identity(&mut w); - let _ = w.write_fmt(format_args!("RELIBC PANIC: {}\n", pi)); - - core::intrinsics::abort(); -@@ -95,10 +230,12 @@ pub extern "C" fn rust_oom(layout: ::core::alloc::Layout) -> ! { - - let mut w = platform::FileWriter::new(2); - let _ = w.write_fmt(format_args!( -- "RELIBC OOM: {} bytes aligned to {} bytes\n", -+ "RELIBC OOM: {} bytes aligned to {} bytes - process will abort\n", - layout.size(), - layout.align() - )); -+ write_process_thread_identity(&mut w); -+ write_best_effort_backtrace(&mut w); - - core::intrinsics::abort(); - } -@@ -111,7 +248,10 @@ pub extern "C" fn _Unwind_Resume() -> ! { - use core::fmt::Write; - - let mut w = platform::FileWriter::new(2); -- let _ = w.write_str("_Unwind_Resume\n"); -+ let _ = w.write_str( -+ "RELIBC: _Unwind_Resume called - exception propagation failed, aborting\n", -+ ); -+ write_process_thread_identity(&mut w); - - core::intrinsics::abort(); - } -diff --git a/src/platform/redox/mod.rs b/src/platform/redox/mod.rs -index 752339a..73d9af1 100644 ---- a/src/platform/redox/mod.rs -+++ b/src/platform/redox/mod.rs -@@ -669,6 +669,11 @@ impl Pal for Sys { - } - - fn getpriority(which: c_int, who: id_t) -> Result { -+ if is_current_process_priority_target(which, who) { -+ let nice = read_current_process_nice()?; -+ return Ok(20 - nice); -+ } -+ - match redox_rt::sys::posix_getpriority(which, who as u32) { - Ok(kernel_prio) => { - let posix_prio = (kernel_prio as i32 * -1) + 40 as i32; -@@ -1231,7 +1236,12 @@ impl Pal for Sys { - } - - fn setpriority(which: c_int, who: id_t, prio: c_int) -> Result<()> { -- let clamped_prio = prio.clamp(-20, 19); -+ let clamped_prio = prio.clamp(NICE_MIN, NICE_MAX); -+ -+ if is_current_process_priority_target(which, who) { -+ return write_current_process_nice(clamped_prio); -+ } -+ - let kernel_prio = (20 + clamped_prio) as u32; - - match redox_rt::sys::posix_setpriority(which, who as u32, kernel_prio) { -diff --git a/src/pthread/mod.rs b/src/pthread/mod.rs -index 8243a48..ae25efb 100644 ---- a/src/pthread/mod.rs -+++ b/src/pthread/mod.rs -@@ -2,6 +2,7 @@ - - use core::{ - cell::UnsafeCell, -+ panic::AssertUnwindSafe, - ptr, - sync::atomic::{AtomicBool, AtomicUsize, Ordering}, - }; -@@ -43,9 +44,13 @@ pub unsafe fn init() { - thread.stack_size = STACK_SIZE; - } - -- unsafe { Tcb::current() } -- .expect_notls("no TCB present for main thread") -- .pthread = thread; -+ let tcb = unsafe { Tcb::current() } -+ .expect_notls("no TCB present for main thread"); -+ tcb.pthread = thread; -+ -+ OS_TID_TO_PTHREAD -+ .lock() -+ .insert(Sys::current_os_tid(), ForceSendSync(tcb as *const Tcb as *mut Tcb)); - } - - //static NEXT_INDEX: AtomicU32 = AtomicU32::new(FIRST_THREAD_IDX + 1); -@@ -227,12 +232,23 @@ unsafe extern "C" fn new_thread_shim( - unsafe { - tcb.activate(None); - } -- redox_rt::signal::setup_sighandler(&tcb.os_specific, false); -+ match catch_unwind(AssertUnwindSafe(|| { -+ redox_rt::signal::setup_sighandler(&tcb.os_specific, false) -+ })) { -+ Ok(()) => {} -+ Err(()) => { -+ log::error!("pthread: failed to set up child thread signal handler"); -+ unsafe { exit_current_thread(Retval(ptr::null_mut())) } -+ } -+ } - } - - let procmask = unsafe { (&*synchronization_mutex).as_ptr().read() }; - -- unsafe { tcb.copy_masters() }.unwrap(); -+ if let Err(err) = unsafe { tcb.copy_masters() } { -+ log::error!("pthread: failed to copy TLS masters for child thread: {err:?}"); -+ unsafe { exit_current_thread(Retval(ptr::null_mut())) } -+ } - - unsafe { (*tcb).pthread.os_tid.get().write(Sys::current_os_tid()) }; - -@@ -240,11 +256,21 @@ unsafe extern "C" fn new_thread_shim( - - #[cfg(target_os = "redox")] - { -- redox_rt::signal::set_sigmask(Some(procmask), None) -- .expect("failed to set procmask in child thread"); -+ if let Err(err) = redox_rt::signal::set_sigmask(Some(procmask), None) { -+ log::error!("pthread: failed to set child thread signal mask: {err:?}"); -+ } - } - -- let retval = unsafe { entry_point(arg) }; -+ let mut retval = ptr::null_mut(); -+ match catch_unwind(AssertUnwindSafe(|| { -+ retval = unsafe { entry_point(arg) }; -+ })) { -+ Ok(()) => {} -+ Err(()) => { -+ log::error!("pthread: child thread entry point panicked"); -+ unsafe { exit_current_thread(Retval(ptr::null_mut())) } -+ } -+ } - - unsafe { exit_current_thread(Retval(retval)) } - } -diff --git a/src/start.rs b/src/start.rs -index 63d4046..7cc96bf 100644 ---- a/src/start.rs -+++ b/src/start.rs -@@ -1,10 +1,7 @@ - //! Startup code. - - use alloc::{boxed::Box, vec::Vec}; --use core::{intrinsics, ptr}; -- --#[cfg(target_os = "redox")] --use generic_rt::ExpectTlsFree; -+use core::{fmt::Write, intrinsics, panic::AssertUnwindSafe, ptr}; - - use crate::{ - ALLOCATOR, -@@ -164,14 +161,23 @@ pub unsafe extern "C" fn relibc_start_v1( - unsafe { relibc_verify_host() }; - - #[cfg(target_os = "redox")] -- let thr_fd = redox_rt::proc::FdGuard::new( -- unsafe { -+ let thr_fd = { -+ let thr_fd = match unsafe { - crate::platform::get_auxv_raw(sp.auxv().cast(), redox_rt::auxv_defs::AT_REDOX_THR_FD) -+ } { -+ Some(thr_fd) => thr_fd, -+ None => abort_startup(format_args!( -+ "relibc_start_v1: missing AT_REDOX_THR_FD auxv entry; no thread fd present\n" -+ )), -+ }; -+ -+ match redox_rt::proc::FdGuard::new(thr_fd).to_upper() { -+ Ok(thr_fd) => thr_fd, -+ Err(err) => abort_startup(format_args!( -+ "relibc_start_v1: failed to move thread fd to upper table: {err:?}\n" -+ )), - } -- .expect_notls("no thread fd present"), -- ) -- .to_upper() -- .expect_notls("failed to move thread fd to upper table"); -+ }; - - // Initialize TLS, if necessary - unsafe { -@@ -237,7 +243,10 @@ pub unsafe extern "C" fn relibc_start_v1( - let mut f = unsafe { &__preinit_array_start } as *const _; - #[allow(clippy::op_ref)] - while f < &raw const __preinit_array_end { -- (unsafe { *f })(); -+ let func = unsafe { *f }; -+ if catch_unwind(AssertUnwindSafe(|| unsafe { (*f)() })).is_err() { -+ log_initializer_panic(".preinit_array", func); -+ } - f = unsafe { f.offset(1) }; - } - } -@@ -247,7 +256,10 @@ pub unsafe extern "C" fn relibc_start_v1( - let mut f = unsafe { &__init_array_start } as *const _; - #[allow(clippy::op_ref)] - while f < &raw const __init_array_end { -- (unsafe { *f })(); -+ let func = unsafe { *f }; -+ if catch_unwind(AssertUnwindSafe(|| unsafe { (*f)() })).is_err() { -+ log_initializer_panic(".init_array", func); -+ } - f = unsafe { f.offset(1) }; - } - } -diff --git a/src/sync/barrier.rs b/src/sync/barrier.rs -index 6204a23..a8c41ad 100644 ---- a/src/sync/barrier.rs -+++ b/src/sync/barrier.rs -@@ -1,18 +1,34 @@ --use core::num::NonZeroU32; -+use core::{ -+ num::NonZeroU32, -+ sync::atomic::{AtomicU32, Ordering}, -+}; - - pub struct Barrier { - original_count: NonZeroU32, - // 4 - lock: crate::sync::Mutex, - // 16 -- cvar: crate::header::pthread::RlctCond, -+ cvar: FutexState, - // 24 - } - #[derive(Debug)] - struct Inner { -- count: u32, -- // TODO: Overflows might be problematic... 64-bit? -- gen_id: u32, -+ _unused0: u32, -+ _unused1: u32, -+} -+ -+struct FutexState { -+ count: AtomicU32, -+ sense: AtomicU32, -+} -+ -+impl FutexState { -+ const fn new(count: u32) -> Self { -+ Self { -+ count: AtomicU32::new(count), -+ sense: AtomicU32::new(0), -+ } -+ } - } - - pub enum WaitResult { -@@ -25,61 +41,38 @@ impl Barrier { - Self { - original_count: count, - lock: crate::sync::Mutex::new(Inner { -- count: 0, -- gen_id: 0, -+ _unused0: 0, -+ _unused1: 0, - }), -- cvar: crate::header::pthread::RlctCond::new(), -+ cvar: FutexState::new(count.get()), - } - } -- pub fn wait(&self) -> WaitResult { -- let mut guard = self.lock.lock(); -- let gen_id = guard.gen_id; -- -- guard.count += 1; -- -- if guard.count == self.original_count.get() { -- guard.gen_id = guard.gen_id.wrapping_add(1); -- guard.count = 0; -- if let Ok(()) = self.cvar.broadcast() {}; // TODO handle error -- -- drop(guard); -+ pub fn destroy(&self) {} - -- WaitResult::NotifiedAll -- } else { -- while guard.gen_id == gen_id { -- guard = self.cvar.wait_inner_typedmutex(guard); -- } -- -- WaitResult::Waited -- } -- /* -- let mut guard = self.lock.lock(); -- let Inner { count, gen_id } = *guard; -- -- let last = self.original_count.get() - 1; -- -- if count == last { -- eprintln!("last {:?}", *guard); -- guard.gen_id = guard.gen_id.wrapping_add(1); -- guard.count = 0; -- -- drop(guard); -+ pub fn wait(&self) -> WaitResult { -+ let _ = &self.lock; -+ let sense = self.cvar.sense.load(Ordering::Acquire); - -- self.cvar.broadcast(); -+ if self.cvar.count.fetch_sub(1, Ordering::AcqRel) == 1 { -+ self.cvar -+ .count -+ .store(self.original_count.get(), Ordering::Relaxed); -+ self.cvar -+ .sense -+ .store(sense.wrapping_add(1), Ordering::Release); -+ crate::sync::futex_wake(&self.cvar.sense, i32::MAX); - - WaitResult::NotifiedAll - } else { -- guard.count += 1; -- -- while guard.count != last && guard.gen_id == gen_id { -- eprintln!("before {:?}", *guard); -- guard = self.cvar.wait_inner_typedmutex(guard); -- eprintln!("after {:?}", *guard); -+ // SMP fix: wait directly on the barrier generation word instead of routing through the -+ // condvar unlock->futex_wait path. If the last thread flips `sense` after we load it -+ // but before our futex wait starts, the futex observes a stale value and returns -+ // immediately instead of sleeping forever after a missed broadcast wakeup. -+ while self.cvar.sense.load(Ordering::Acquire) == sense { -+ let _ = crate::sync::futex_wait(&self.cvar.sense, sense, None); - } - - WaitResult::Waited - } -- */ - } - } --static LOCK: crate::sync::Mutex<()> = crate::sync::Mutex::new(()); -diff --git a/src/sync/pthread_mutex.rs b/src/sync/pthread_mutex.rs -index 29bad63..ef027e7 100644 ---- a/src/sync/pthread_mutex.rs -+++ b/src/sync/pthread_mutex.rs -@@ -1,3 +1,4 @@ -+use alloc::boxed::Box; - use core::{ - cell::Cell, - sync::atomic::{AtomicU32 as AtomicUint, Ordering}, -@@ -6,10 +7,9 @@ use core::{ - use crate::{ - error::Errno, - header::{bits_timespec::timespec, errno::*, pthread::*}, -+ platform::{Pal, Sys, types::c_int}, - }; - --use crate::platform::{Pal, Sys, types::c_int}; -- - use super::FutexWaitResult; - - pub struct RlctMutex { -@@ -21,15 +21,22 @@ pub struct RlctMutex { - robust: bool, - } - -+pub struct RobustMutexNode { -+ pub next: *mut RobustMutexNode, -+ pub prev: *mut RobustMutexNode, -+ pub mutex: *const RlctMutex, -+} -+ - const STATE_UNLOCKED: u32 = 0; - const WAITING_BIT: u32 = 1 << 31; --const INDEX_MASK: u32 = !WAITING_BIT; -+const FUTEX_OWNER_DIED: u32 = 1 << 30; -+const INDEX_MASK: u32 = !(WAITING_BIT | FUTEX_OWNER_DIED); - - // TODO: Lower limit is probably better. - const RECURSIVE_COUNT_MAX_INCLUSIVE: u32 = u32::MAX; - // TODO: How many spins should we do before it becomes more time-economical to enter kernel mode - // via futexes? --const SPIN_COUNT: usize = 0; -+const SPIN_COUNT: usize = 100; - - impl RlctMutex { - pub(crate) fn new(attr: &RlctMutexAttr) -> Result { -@@ -69,13 +76,25 @@ impl RlctMutex { - Ok(0) - } - pub fn make_consistent(&self) -> Result<(), Errno> { -- todo_skip!(0, "pthread robust mutexes: not implemented"); -- Ok(()) -+ debug_assert!(self.robust, "make_consistent called on non-robust mutex"); -+ -+ if !self.robust { -+ return Err(Errno(EINVAL)); -+ } -+ -+ let current = self.inner.load(Ordering::Relaxed); -+ let owner = current & INDEX_MASK; -+ -+ if owner == os_tid_invalid_after_fork() && current & FUTEX_OWNER_DIED != 0 { -+ self.inner.store(0, Ordering::Release); -+ Ok(()) -+ } else { -+ Err(Errno(EINVAL)) -+ } - } - fn lock_inner(&self, deadline: Option<×pec>) -> Result<(), Errno> { - let this_thread = os_tid_invalid_after_fork(); -- -- //let mut spins_left = SPIN_COUNT; -+ let mut spins_left = SPIN_COUNT; - - loop { - let result = self.inner.compare_exchange_weak( -@@ -86,51 +105,70 @@ impl RlctMutex { - ); - - match result { -- // CAS succeeded -- Ok(_) => { -- if self.ty == Ty::Recursive { -- self.increment_recursive_count()?; -- } -- return Ok(()); -- } -- // CAS failed, but the mutex was recursive and we already own the lock. -+ Ok(_) => return self.finish_lock_acquire(false), - Err(thread) if thread & INDEX_MASK == this_thread && self.ty == Ty::Recursive => { - self.increment_recursive_count()?; - return Ok(()); - } -- // CAS failed, but the mutex was error-checking and we already own the lock. - Err(thread) if thread & INDEX_MASK == this_thread && self.ty == Ty::Errck => { -- return Err(Errno(EAGAIN)); -+ return Err(Errno(EDEADLK)); - } -- // CAS spuriously failed, simply retry the CAS. TODO: Use core::hint::spin_loop()? -- Err(thread) if thread & INDEX_MASK == 0 => { -- continue; -+ Err(thread) if thread & FUTEX_OWNER_DIED != 0 && thread & INDEX_MASK == 0 => { -+ return Err(Errno(ENOTRECOVERABLE)); - } -- // CAS failed because some other thread owned the lock. We must now wait. -+ Err(thread) if thread & FUTEX_OWNER_DIED != 0 => { -+ if !self.robust { -+ return Err(Errno(ENOTRECOVERABLE)); -+ } -+ -+ let new_value = (thread & WAITING_BIT) | FUTEX_OWNER_DIED | this_thread; -+ match self.inner.compare_exchange( -+ thread, -+ new_value, -+ Ordering::Acquire, -+ Ordering::Relaxed, -+ ) { -+ Ok(_) => return self.finish_lock_acquire(true), -+ Err(_) => continue, -+ } -+ } -+ Err(thread) if thread & INDEX_MASK == 0 => continue, - Err(thread) => { -- /*if spins_left > 0 { -- // TODO: Faster to spin trying to load the flag, compared to CAS? -+ let owner = thread & INDEX_MASK; -+ -+ if !crate::pthread::mutex_owner_id_is_live(owner) { -+ if !self.robust { -+ return Err(Errno(ENOTRECOVERABLE)); -+ } -+ -+ let new_value = (thread & WAITING_BIT) | FUTEX_OWNER_DIED | this_thread; -+ match self.inner.compare_exchange( -+ thread, -+ new_value, -+ Ordering::Acquire, -+ Ordering::Relaxed, -+ ) { -+ Ok(_) => return self.finish_lock_acquire(true), -+ Err(_) => continue, -+ } -+ } -+ -+ if spins_left > 0 { - spins_left -= 1; - core::hint::spin_loop(); - continue; - } -- -- spins_left = SPIN_COUNT; -- -- let inner = self.inner.fetch_or(WAITING_BIT, Ordering::Relaxed); -- -- if inner == STATE_UNLOCKED { -- continue; -- }*/ -- -- // If the mutex is not robust, simply futex_wait until unblocked. -- //crate::sync::futex_wait(&self.inner, inner | WAITING_BIT, None); - if crate::sync::futex_wait(&self.inner, thread, deadline) - == FutexWaitResult::TimedOut - { - return Err(Errno(ETIMEDOUT)); - } - } -+ } else { -+ // Non-robust mutex: owner appears dead but POSIX behaviour is -+ // undefined; report busy rather than ENOTRECOVERABLE. -+ return Err(Errno(EBUSY)); -+ } - } - } - } -@@ -140,6 +178,20 @@ impl RlctMutex { - pub fn lock_with_timeout(&self, deadline: ×pec) -> Result<(), Errno> { - self.lock_inner(Some(deadline)) - } -+ fn finish_lock_acquire(&self, owner_dead: bool) -> Result<(), Errno> { -+ if self.ty == Ty::Recursive { -+ self.increment_recursive_count()?; -+ } -+ if self.robust { -+ add_to_robust_list(self); -+ } -+ -+ if owner_dead { -+ Err(Errno(EOWNERDEAD)) -+ } else { -+ Ok(()) -+ } -+ } - fn increment_recursive_count(&self) -> Result<(), Errno> { - // We don't have to worry about asynchronous signals here, since pthread_mutex_trylock - // is not async-signal-safe. -@@ -161,41 +213,65 @@ impl RlctMutex { - pub fn try_lock(&self) -> Result<(), Errno> { - let this_thread = os_tid_invalid_after_fork(); - -- // TODO: If recursive, omitting CAS may be faster if it is already owned by this thread. -- let result = self.inner.compare_exchange( -- STATE_UNLOCKED, -- this_thread, -- Ordering::Acquire, -- Ordering::Relaxed, -- ); -+ loop { -+ let current = self.inner.load(Ordering::Relaxed); -+ -+ if current == STATE_UNLOCKED { -+ match self.inner.compare_exchange( -+ STATE_UNLOCKED, -+ this_thread, -+ Ordering::Acquire, -+ Ordering::Relaxed, -+ ) { -+ Ok(_) => return self.finish_lock_acquire(false), -+ Err(_) => continue, -+ } -+ } - -- if self.ty == Ty::Recursive { -- match result { -- Err(index) if index & INDEX_MASK != this_thread => return Err(Errno(EBUSY)), -- _ => (), -+ let owner = current & INDEX_MASK; -+ -+ if owner == this_thread && self.ty == Ty::Recursive { -+ self.increment_recursive_count()?; -+ return Ok(()); - } - -- self.increment_recursive_count()?; -+ if owner == this_thread && self.ty == Ty::Errck { -+ return Err(Errno(EDEADLK)); -+ } - -- return Ok(()); -- } -+ if current & FUTEX_OWNER_DIED != 0 && owner == 0 { -+ return Err(Errno(ENOTRECOVERABLE)); -+ } -+ -+ if current & FUTEX_OWNER_DIED != 0 || (owner != 0 && !crate::pthread::mutex_owner_id_is_live(owner)) { -+ if !self.robust { -+ return Err(Errno(ENOTRECOVERABLE)); -+ } - -- match result { -- Ok(_) => Ok(()), -- Err(index) if index & INDEX_MASK == this_thread && self.ty == Ty::Errck => { -- Err(Errno(EDEADLK)) -+ let new_value = (current & WAITING_BIT) | FUTEX_OWNER_DIED | this_thread; -+ match self.inner.compare_exchange( -+ current, -+ new_value, -+ Ordering::Acquire, -+ Ordering::Relaxed, -+ ) { -+ Ok(_) => return self.finish_lock_acquire(true), -+ Err(_) => continue, -+ } - } -- Err(_) => Err(Errno(EBUSY)), -+ -+ return Err(Errno(EBUSY)); - } - } - // Safe because we are not protecting any data. - pub fn unlock(&self) -> Result<(), Errno> { -+ let current = self.inner.load(Ordering::Relaxed); -+ - if self.robust || matches!(self.ty, Ty::Recursive | Ty::Errck) { -- if self.inner.load(Ordering::Relaxed) & INDEX_MASK != os_tid_invalid_after_fork() { -+ if current & INDEX_MASK != os_tid_invalid_after_fork() { - return Err(Errno(EPERM)); - } - -- // TODO: Is this fence correct? - core::sync::atomic::fence(Ordering::Acquire); - } - -@@ -208,18 +284,47 @@ impl RlctMutex { - } - } - -- self.inner.store(STATE_UNLOCKED, Ordering::Release); -- crate::sync::futex_wake(&self.inner, i32::MAX); -- /*let was_waiting = self.inner.swap(STATE_UNLOCKED, Ordering::Release) & WAITING_BIT != 0; -+ if self.robust { -+ remove_from_robust_list(self); -+ } - -- if was_waiting { -- let _ = crate::sync::futex_wake(&self.inner, 1); -- }*/ -+ let new_state = if self.robust && current & FUTEX_OWNER_DIED != 0 { -+ FUTEX_OWNER_DIED -+ } else { -+ STATE_UNLOCKED -+ }; -+ -+ self.inner.store(new_state, Ordering::Release); -+ crate::sync::futex_wake(&self.inner, i32::MAX); - - Ok(()) - } - } - -+pub(crate) unsafe fn mark_robust_mutexes_dead(thread: &crate::pthread::Pthread) { -+ let head = thread.robust_list_head.get(); -+ let this_thread = os_tid_invalid_after_fork(); -+ let mut node = unsafe { *head }; -+ -+ unsafe { *head = core::ptr::null_mut() }; -+ -+ while !node.is_null() { -+ let next = unsafe { (*node).next }; -+ let mutex = unsafe { &*(*node).mutex }; -+ let current = mutex.inner.load(Ordering::Relaxed); -+ -+ if current & INDEX_MASK == this_thread { -+ mutex -+ .inner -+ .store((current & WAITING_BIT) | FUTEX_OWNER_DIED | this_thread, Ordering::Release); -+ crate::sync::futex_wake(&mutex.inner, i32::MAX); -+ } -+ -+ unsafe { drop(Box::from_raw(node)) }; -+ node = next; -+ } -+} -+ - #[repr(u8)] - #[derive(PartialEq)] - enum Ty { -@@ -237,6 +342,54 @@ enum Ty { - #[thread_local] - static CACHED_OS_TID_INVALID_AFTER_FORK: Cell = Cell::new(0); - -+fn add_to_robust_list(mutex: &RlctMutex) { -+ let thread = crate::pthread::current_thread().expect("current thread not present"); -+ let node_ptr = Box::into_raw(Box::new(RobustMutexNode { -+ next: core::ptr::null_mut(), -+ prev: core::ptr::null_mut(), -+ mutex: core::ptr::from_ref(mutex), -+ })); -+ -+ unsafe { -+ let head = thread.robust_list_head.get(); -+ if !(*head).is_null() { -+ (**head).prev = node_ptr; -+ } -+ (*node_ptr).next = *head; -+ *head = node_ptr; -+ } -+} -+ -+fn remove_from_robust_list(mutex: &RlctMutex) { -+ let thread = match crate::pthread::current_thread() { -+ Some(thread) => thread, -+ None => return, -+ }; -+ -+ unsafe { -+ let mut node = *thread.robust_list_head.get(); -+ -+ while !node.is_null() { -+ if core::ptr::eq((*node).mutex, core::ptr::from_ref(mutex)) { -+ if !(*node).prev.is_null() { -+ (*(*node).prev).next = (*node).next; -+ } else { -+ *thread.robust_list_head.get() = (*node).next; -+ } -+ -+ if !(*node).next.is_null() { -+ (*(*node).next).prev = (*node).prev; -+ } -+ -+ drop(Box::from_raw(node)); -+ return; -+ } -+ -+ node = (*node).next; -+ } -+ } -+} -+ - // Assumes TIDs are unique between processes, which I only know is true for Redox. - fn os_tid_invalid_after_fork() -> u32 { - // TODO: Coordinate better if using shared == PTHREAD_PROCESS_SHARED, with up to 2^32 separate diff --git a/local/sources/base b/local/sources/base index 360cd8bbdf..1fc7af3c9f 160000 --- a/local/sources/base +++ b/local/sources/base @@ -1 +1 @@ -Subproject commit 360cd8bbdf68a5cf062c4c932a239c8807b9d0cf +Subproject commit 1fc7af3c9fcca151a6f08c36ed7cb56770f34cb0 diff --git a/local/sources/bootloader b/local/sources/bootloader index 5bee5c5afe..fe009bb9d6 160000 --- a/local/sources/bootloader +++ b/local/sources/bootloader @@ -1 +1 @@ -Subproject commit 5bee5c5afe0610e6e405dbb79c5f3c228eb47efd +Subproject commit fe009bb9d688d68ee41f99bfb7d49ca2b17e9ef2 diff --git a/local/sources/installer b/local/sources/installer index a2e58a7175..101a836a92 160000 --- a/local/sources/installer +++ b/local/sources/installer @@ -1 +1 @@ -Subproject commit a2e58a71757c5c662600e7ff667fd39902b3a1f4 +Subproject commit 101a836a92c66401837d0b2b7ac157ce49a2da19 diff --git a/local/sources/kernel b/local/sources/kernel index 74f34118da..97b07bcb44 160000 --- a/local/sources/kernel +++ b/local/sources/kernel @@ -1 +1 @@ -Subproject commit 74f34118daf9ebb19838f912783041a9a80c416c +Subproject commit 97b07bcb4452c835003efa0b730cdc8502350e26 diff --git a/local/sources/relibc b/local/sources/relibc index f3775e7d52..5b2a221135 160000 --- a/local/sources/relibc +++ b/local/sources/relibc @@ -1 +1 @@ -Subproject commit f3775e7d52a2bb98973f19eec860f9bd972a251c +Subproject commit 5b2a221135b5e80ff489476d495fe91e488cfc9c diff --git a/recipes/archives/lz4/redox.patch b/recipes/archives/lz4/redox.patch deleted file mode 100644 index 095ae277d2..0000000000 --- a/recipes/archives/lz4/redox.patch +++ /dev/null @@ -1,34 +0,0 @@ -diff '--color=auto' -ruwN source/programs/util.h source-new/programs/util.h ---- source/programs/util.h 2024-07-21 13:29:49.000000000 -0400 -+++ source-new/programs/util.h 2024-12-13 02:21:03.032769559 -0500 -@@ -52,6 +52,9 @@ - #include /* time */ - #include /* INT_MAX */ - #include -+#if defined(_REDOX) -+# include /* utimes */ -+#endif - - - -@@ -239,12 +242,20 @@ - timebuf.modtime = statbuf->st_mtime; - res += utime(filename, &timebuf); /* set access and modification times */ - #else -+ #if defined(_REDOX) -+ struct timeval timebuf[2]; -+ memset(timebuf, 0, sizeof(timebuf)); -+ timebuf[0].tv_usec = UTIME_NOW; -+ timebuf[1].tv_sec = statbuf->st_mtime; -+ res += utimes(filename, timebuf); -+ #else - struct timespec timebuf[2]; - memset(timebuf, 0, sizeof(timebuf)); - timebuf[0].tv_nsec = UTIME_NOW; - timebuf[1].tv_sec = statbuf->st_mtime; - res += utimensat(AT_FDCWD, filename, timebuf, 0); /* set access and modification times */ - #endif -+#endif - } - - #if !defined(_WIN32) diff --git a/recipes/archives/zstd/01_redox.patch b/recipes/archives/zstd/01_redox.patch deleted file mode 100644 index 0cff8dc935..0000000000 --- a/recipes/archives/zstd/01_redox.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff -ruwN source/programs/platform.h source-new/programs/platform.h ---- source/programs/platform.h 2025-02-19 07:04:24.000000000 +0700 -+++ source-new/programs/platform.h 2025-07-21 22:52:07.716447723 +0700 -@@ -109,6 +109,11 @@ - #endif /* PLATFORM_POSIX_VERSION */ - - -+#if defined(__redox__) -+/* TODO: AT_FDCWD && utimensat must be defined to conform _POSIX_VERSION */ -+# define PLATFORM_POSIX_VERSION 1 -+#endif -+ - #if PLATFORM_POSIX_VERSION > 1 - /* glibc < 2.26 may not expose struct timespec def without this. - * See issue #1920. */ diff --git a/recipes/core/redoxfs/P2-readonly-live-media-open.patch b/recipes/core/redoxfs/P2-readonly-live-media-open.patch deleted file mode 100644 index ecfe0c2617..0000000000 --- a/recipes/core/redoxfs/P2-readonly-live-media-open.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/src/disk/file.rs b/src/disk/file.rs -index 78d51bc..f923d72 100644 ---- a/src/disk/file.rs -+++ b/src/disk/file.rs -@@ -43,10 +43,12 @@ impl ResultExt for std::io::Result { - - impl DiskFile { - pub fn open(path: impl AsRef) -> Result { -+ let path = path.as_ref(); - let file = OpenOptions::new() - .read(true) - .write(true) - .open(path) -+ .or_else(|_| OpenOptions::new().read(true).open(path)) - .or_eio()?; - Ok(DiskFile { file }) - } diff --git a/recipes/core/uutils/redox.patch b/recipes/core/uutils/redox.patch deleted file mode 100644 index e5f76ef1e4..0000000000 --- a/recipes/core/uutils/redox.patch +++ /dev/null @@ -1,83 +0,0 @@ -diff --git a/Cargo.toml b/Cargo.toml -index 5f417bd42..b7b895a9c 100644 ---- a/Cargo.toml -+++ b/Cargo.toml -@@ -326,6 +326,7 @@ feat_os_unix_redox = [ - "feat_common_core", - # - "chmod", -+ "nproc", - "stat", - "uname", - ] -diff --git a/src/uucore/src/lib/features/fs.rs b/src/uucore/src/lib/features/fs.rs -index fd1f30303..c508f6b9b 100644 ---- a/src/uucore/src/lib/features/fs.rs -+++ b/src/uucore/src/lib/features/fs.rs -@@ -13,7 +13,7 @@ use libc::{ - S_IRUSR, S_ISGID, S_ISUID, S_ISVTX, S_IWGRP, S_IWOTH, S_IWUSR, S_IXGRP, S_IXOTH, S_IXUSR, - mkfifo, mode_t, - }; --#[cfg(all(unix, not(target_os = "redox")))] -+#[cfg(unix)] - pub use libc::{major, makedev, minor}; - use std::collections::HashSet; - use std::collections::VecDeque; -@@ -849,24 +849,6 @@ pub fn make_fifo(path: &Path) -> std::io::Result<()> { - } - } - --// Redox's libc appears not to include the following utilities -- --#[cfg(target_os = "redox")] --pub fn major(dev: libc::dev_t) -> libc::c_uint { -- (((dev >> 8) & 0xFFF) | ((dev >> 32) & 0xFFFFF000)) as _ --} -- --#[cfg(target_os = "redox")] --pub fn minor(dev: libc::dev_t) -> libc::c_uint { -- ((dev & 0xFF) | ((dev >> 12) & 0xFFFFF00)) as _ --} -- --#[cfg(target_os = "redox")] --pub fn makedev(maj: libc::c_uint, min: libc::c_uint) -> libc::dev_t { -- let [maj, min] = [maj as libc::dev_t, min as libc::dev_t]; -- (min & 0xff) | ((maj & 0xfff) << 8) | ((min & !0xff) << 12) | ((maj & !0xfff) << 32) --} -- - #[cfg(test)] - mod tests { - // Note this useful idiom: importing names from outer (for mod tests) scope. -diff --git a/src/uucore/src/lib/mods/locale.rs b/src/uucore/src/lib/mods/locale.rs -index b670f8976..a4ff9f983 100644 ---- a/src/uucore/src/lib/mods/locale.rs -+++ b/src/uucore/src/lib/mods/locale.rs -@@ -211,10 +211,11 @@ fn init_localization( - } - }; - -- LOCALIZER.with(|lock| { -+ // TODO: In aarch64 redox OS, this lock (once cell) is already initialized out of nothing -+ let _ = LOCALIZER.with(|lock| { - lock.set(loc) - .map_err(|_| LocalizationError::Bundle("Localizer already initialized".into())) -- })?; -+ }); - Ok(()) - } - -@@ -422,10 +423,12 @@ pub fn setup_localization(p: &str) -> Result<(), LocalizationError> { - let english_bundle = create_english_bundle_from_embedded(&default_locale, p)?; - let localizer = Localizer::new(english_bundle); - -- LOCALIZER.with(|lock| { -+ // TODO: In aarch64 redox OS, this lock (once cell) is already initialized out of nothing -+ // TODO: When this code is used? Patching for keep sake -+ let _ = LOCALIZER.with(|lock| { - lock.set(localizer) - .map_err(|_| LocalizationError::Bundle("Localizer already initialized".into())) -- })?; -+ }); - Ok(()) - } - } diff --git a/recipes/dev/fontconfig/redox.patch b/recipes/dev/fontconfig/redox.patch deleted file mode 100644 index 6beccc26ea..0000000000 --- a/recipes/dev/fontconfig/redox.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff -ruwN source/src/fccache.c source-new/src/fccache.c ---- source/src/fccache.c 2019-06-10 05:36:37.000000000 -0600 -+++ source-new/src/fccache.c 2019-10-02 19:48:10.459642095 -0600 -@@ -1526,7 +1526,7 @@ - #if defined(_WIN32) - if (_locking (fd, _LK_LOCK, 1) == -1) - goto bail; --#else -+#elif !defined(__redox__) - struct flock fl; - - fl.l_type = F_WRLCK; -@@ -1556,7 +1556,7 @@ - { - #if defined(_WIN32) - _locking (fd, _LK_UNLCK, 1); --#else -+#elif !defined(__redox__) - struct flock fl; - - fl.l_type = F_UNLCK; -diff -ruwN source/src/fccharset.c source-new/src/fccharset.c ---- source/src/fccharset.c 2018-06-05 04:36:38.000000000 -0600 -+++ source-new/src/fccharset.c 2019-10-02 19:48:53.082862133 -0600 -@@ -600,7 +600,7 @@ - static FcChar32 - FcCharSetPopCount (FcChar32 c1) - { --#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -+#if !defined(__redox__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) - return __builtin_popcount (c1); - #else - /* hackmem 169 */ diff --git a/recipes/dev/git/git.patch b/recipes/dev/git/git.patch deleted file mode 100644 index 998bd9d6f7..0000000000 --- a/recipes/dev/git/git.patch +++ /dev/null @@ -1,240 +0,0 @@ -diff -ruwN git-2.13.1/compat/bswap.h source/compat/bswap.h ---- git-2.13.1/compat/bswap.h 2017-06-04 19:08:11.000000000 -0600 -+++ source/compat/bswap.h 2025-04-24 11:20:06.475749424 -0600 -@@ -1,3 +1,7 @@ -+#if defined(__redox__) -+#include -+#endif -+ - /* - * Let's make sure we always have a sane definition for ntohl()/htonl(). - * Some libraries define those as a function call, just to perform byte -diff -ruwN git-2.13.1/compat/terminal.c source/compat/terminal.c ---- git-2.13.1/compat/terminal.c 2017-06-04 19:08:11.000000000 -0600 -+++ source/compat/terminal.c 2025-04-18 10:00:11.318697446 -0600 -@@ -137,6 +137,18 @@ - return buf.buf; - } - -+#elif defined(__redox__) -+ -+ssize_t __getline(char **lptr, size_t *n, FILE *fp); -+ -+char *git_terminal_prompt(const char *prompt, int echo) -+{ -+ char *line = NULL; -+ size_t n = 0; -+ __getline(&line, &n, stdin); -+ return line; // XXX leak -+} -+ - #else - - char *git_terminal_prompt(const char *prompt, int echo) -diff -ruwN git-2.13.1/configure source/configure ---- git-2.13.1/configure 2017-06-04 19:08:11.000000000 -0600 -+++ source/configure 2025-04-18 10:00:11.318697446 -0600 -@@ -6156,7 +6156,7 @@ - ac_res=$ac_cv_search_getaddrinfo - if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" -- NO_IPV6= -+ NO_IPV6=YesPlease - else - NO_IPV6=YesPlease - fi -diff -ruwN git-2.13.1/daemon.c source/daemon.c ---- git-2.13.1/daemon.c 2017-06-04 19:08:11.000000000 -0600 -+++ source/daemon.c 2025-04-18 10:00:11.319697447 -0600 -@@ -71,13 +71,21 @@ - return hi->ip_address.buf; - } - -+#if defined(__redox__) -+#define LOG_ERR 0 -+#define LOG_INFO 1 -+#endif -+ - static void logreport(int priority, const char *err, va_list params) - { -+#if !defined(__redox__) - if (log_syslog) { - char buf[1024]; - vsnprintf(buf, sizeof(buf), err, params); - syslog(priority, "%s", buf); -- } else { -+ } else -+#endif -+ { - /* - * Since stderr is set to buffered mode, the - * logging of different processes will not overlap -@@ -888,8 +896,12 @@ - - if (!reuseaddr) - return 0; -+#if defined(__redox__) -+ return 0; -+#else - return setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, - &on, sizeof(on)); -+#endif - } - - struct socketlist { -@@ -1174,11 +1186,7 @@ - if (!group_name) - c.gid = c.pass->pw_gid; - else { -- struct group *group = getgrnam(group_name); -- if (!group) - die("group not found - %s", group_name); -- -- c.gid = group->gr_gid; - } - - return &c; -@@ -1348,10 +1356,12 @@ - usage(daemon_usage); - } - -+#if !defined(__redox__) - if (log_syslog) { - openlog("git-daemon", LOG_PID, LOG_DAEMON); - set_die_routine(daemon_die); - } else -+#endif - /* avoid splitting a message in the middle */ - setvbuf(stderr, NULL, _IOFBF, 4096); - -diff -ruwN git-2.13.1/git-compat-util.h source/git-compat-util.h ---- git-2.13.1/git-compat-util.h 2017-06-04 19:08:11.000000000 -0600 -+++ source/git-compat-util.h 2025-04-18 10:00:11.319697447 -0600 -@@ -1,6 +1,18 @@ - #ifndef GIT_COMPAT_UTIL_H - #define GIT_COMPAT_UTIL_H - -+#ifndef SIG_DFL -+#define SIG_DFL ((void (*)(int))0) -+#endif -+ -+#ifndef SIG_IGN -+#define SIG_IGN ((void (*)(int))1) -+#endif -+ -+#ifndef SIG_ERR -+#define SIG_ERR ((void (*)(int))-1) -+#endif -+ - #define _FILE_OFFSET_BITS 64 - - -@@ -323,6 +335,14 @@ - #define PATH_SEP ':' - #endif - -+#ifndef DEV_NULL -+#if defined(__redox__) -+#define DEV_NULL "/scheme/null" -+#else -+#define DEV_NULL "/dev/null" -+#endif -+#endif -+ - #ifdef HAVE_PATHS_H - #include - #endif -diff -ruwN git-2.13.1/Makefile source/Makefile ---- git-2.13.1/Makefile 2017-06-05 08:08:11.000000000 +0700 -+++ source/Makefile 2025-09-01 04:41:10.339224568 +0700 -@@ -979,7 +979,7 @@ - BUILTIN_OBJS += builtin/write-tree.o - - GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB) --EXTLIBS = -+EXTLIBS = -lnghttp2 - - GIT_USER_AGENT = git/$(GIT_VERSION) - -@@ -1802,7 +1802,6 @@ - - $(BUILT_INS): git$X - $(QUIET_BUILT_IN)$(RM) $@ && \ -- ln $< $@ 2>/dev/null || \ - ln -s $< $@ 2>/dev/null || \ - cp $< $@ - -@@ -2096,7 +2095,6 @@ - - $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY) - $(QUIET_LNCP)$(RM) $@ && \ -- ln $< $@ 2>/dev/null || \ - ln -s $< $@ 2>/dev/null || \ - cp $< $@ - -@@ -2449,14 +2447,12 @@ - for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \ - $(RM) "$$bindir/$$p" && \ - test -z "$(NO_INSTALL_HARDLINKS)" && \ -- ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \ - ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \ - cp "$$bindir/git$X" "$$bindir/$$p" || exit; \ - done && \ - for p in $(BUILT_INS); do \ - $(RM) "$$execdir/$$p" && \ - test -z "$(NO_INSTALL_HARDLINKS)" && \ -- ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \ - ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \ - cp "$$execdir/git$X" "$$execdir/$$p" || exit; \ - done && \ -@@ -2464,7 +2460,6 @@ - for p in $$remote_curl_aliases; do \ - $(RM) "$$execdir/$$p" && \ - test -z "$(NO_INSTALL_HARDLINKS)" && \ -- ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \ - ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \ - cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; \ - done && \ -diff -ruwN git-2.13.1/run-command.c source/run-command.c ---- git-2.13.1/run-command.c 2017-06-04 19:08:11.000000000 -0600 -+++ source/run-command.c 2025-04-18 10:00:11.320697447 -0600 -@@ -120,9 +120,9 @@ - #ifndef GIT_WINDOWS_NATIVE - static inline void dup_devnull(int to) - { -- int fd = open("/dev/null", O_RDWR); -+ int fd = open(DEV_NULL, O_RDWR); - if (fd < 0) -- die_errno(_("open /dev/null failed")); -+ die_errno(_("open %s failed"), DEV_NULL); - if (dup2(fd, to) < 0) - die_errno(_("dup2(%d,%d) failed"), fd, to); - close(fd); -diff -ruwN git-2.13.1/setup.c source/setup.c ---- git-2.13.1/setup.c 2017-06-05 08:08:11.000000000 +0700 -+++ source/setup.c 2025-09-01 04:41:10.339224568 +0700 -@@ -1146,11 +1146,11 @@ - /* if any standard file descriptor is missing open it to /dev/null */ - void sanitize_stdfds(void) - { -- int fd = open("/dev/null", O_RDWR, 0); -+ int fd = open(DEV_NULL, O_RDWR, 0); - while (fd != -1 && fd < 2) - fd = dup(fd); - if (fd == -1) -- die_errno("open /dev/null or dup failed"); -+ die_errno("open %s or dup failed", DEV_NULL); - if (fd > 2) - close(fd); - } -@@ -1169,8 +1169,10 @@ - default: - exit(0); - } -+#if !defined(__redox__) - if (setsid() == -1) - die_errno("setsid failed"); -+#endif - close(0); - close(1); - close(2); diff --git a/recipes/dev/luajit/redox.patch b/recipes/dev/luajit/redox.patch deleted file mode 100644 index aef67b4c11..0000000000 --- a/recipes/dev/luajit/redox.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff --git a/src/Makefile b/src/Makefile -index 3a6a4329..450e8fe6 100644 ---- a/src/Makefile -+++ b/src/Makefile -@@ -351,6 +351,9 @@ else - ifeq (GNU/kFreeBSD,$(TARGET_SYS)) - TARGET_XLIBS+= -ldl - endif -+ ifeq (Redox,$(TARGET_SYS)) -+ TARGET_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_POSIX -+ endif - endif - endif - endif -@@ -367,12 +370,16 @@ ifneq ($(HOST_SYS),$(TARGET_SYS)) - else - ifeq (iOS,$(TARGET_SYS)) - HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OSX -DTARGET_OS_IPHONE=1 -+ else -+ ifeq (Redox,$(TARGET_SYS)) -+ HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_POSIX - else - HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OTHER - endif - endif - endif - endif -+ endif - endif - - ifneq (,$(CCDEBUG)) diff --git a/recipes/dev/patch/01_no_rlimit.patch b/recipes/dev/patch/01_no_rlimit.patch deleted file mode 100644 index c44b9a9604..0000000000 --- a/recipes/dev/patch/01_no_rlimit.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff -ru source/lib/getdtablesize.c source-new/lib/getdtablesize.c ---- source/lib/getdtablesize.c 2015-03-06 16:31:45.000000000 -0800 -+++ source-new/lib/getdtablesize.c 2017-08-08 19:33:33.993874985 -0700 -@@ -106,15 +106,6 @@ - int - getdtablesize (void) - { -- struct rlimit lim; -- -- if (getrlimit (RLIMIT_NOFILE, &lim) == 0 -- && 0 <= lim.rlim_cur && lim.rlim_cur <= INT_MAX -- && lim.rlim_cur != RLIM_INFINITY -- && lim.rlim_cur != RLIM_SAVED_CUR -- && lim.rlim_cur != RLIM_SAVED_MAX) -- return lim.rlim_cur; -- - return INT_MAX; - } - -Only in source-new/lib: getdtablesize.c.orig -diff -ru source/src/safe.c source-new/src/safe.c ---- source/src/safe.c 2015-03-06 16:34:20.000000000 -0800 -+++ source-new/src/safe.c 2017-08-08 19:33:53.447430811 -0700 -@@ -92,11 +92,7 @@ - - static void init_dirfd_cache (void) - { -- struct rlimit nofile; -- - max_cached_fds = 8; -- if (getrlimit (RLIMIT_NOFILE, &nofile) == 0) -- max_cached_fds = MAX (nofile.rlim_cur / 4, max_cached_fds); - - cached_dirfds = hash_initialize (max_cached_fds, - NULL, diff --git a/recipes/dev/patch/02_no_chown.patch b/recipes/dev/patch/02_no_chown.patch deleted file mode 100644 index 996f6a72dd..0000000000 --- a/recipes/dev/patch/02_no_chown.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff -ru source/src/util.c source-new/src/util.c ---- source/src/util.c 2015-03-06 16:34:20.000000000 -0800 -+++ source-new/src/util.c 2017-08-11 18:24:56.991729200 -0700 -@@ -271,6 +271,7 @@ - - /* May fail if we are not privileged to set the file owner, or we are - not in group instat.st_gid. Ignore those errors. */ -+ /* - if ((uid != -1 || gid != -1) - && safe_lchown (to, uid, gid) != 0 - && (errno != EPERM -@@ -281,6 +282,7 @@ - (uid == -1) ? "owner" : "owning group", - S_ISLNK (mode) ? "symbolic link" : "file", - quotearg (to)); -+ */ - } - if (attr & FA_XATTRS) - if (copy_attr (from, to) != 0 diff --git a/recipes/dev/patch/03_renameat2.patch b/recipes/dev/patch/03_renameat2.patch deleted file mode 100644 index f5e799e90e..0000000000 --- a/recipes/dev/patch/03_renameat2.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- source-old/lib/renameat2.c 2018-02-03 05:41:53.000000000 -0700 -+++ source/lib/renameat2.c 2025-11-01 08:39:54.945513820 -0600 -@@ -70,6 +70,7 @@ - Obey FLAGS when doing the renaming. If FLAGS is zero, this - function is equivalent to renameat (FD1, SRC, FD2, DST). */ - -+#if !defined(__redox__) - int - renameat2 (int fd1, char const *src, int fd2, char const *dst, - unsigned int flags) -@@ -225,3 +226,4 @@ - - #endif /* !HAVE_RENAMEAT */ - } -+#endif diff --git a/recipes/dev/php84/redox.patch b/recipes/dev/php84/redox.patch deleted file mode 100644 index c1d6ef25e4..0000000000 --- a/recipes/dev/php84/redox.patch +++ /dev/null @@ -1,91 +0,0 @@ -diff -ruwN source/configure source-new/configure ---- source/configure 2026-01-14 00:17:10.000000000 +0700 -+++ source-new/configure 2026-01-16 15:56:01.944755811 +0700 -@@ -26007,7 +26007,7 @@ - then : - ac_cv_lib_curl_curl_easy_perform=yes - else case e in #( -- e) ac_cv_lib_curl_curl_easy_perform=no ;; -+ e) ac_cv_lib_curl_curl_easy_perform=yes ;; - esac - fi - rm -f core conftest.err conftest.$ac_objext conftest.beam \ -@@ -37728,7 +37728,7 @@ - then : - php_cv_lib_gd_works=yes - else case e in #( -- e) php_cv_lib_gd_works=no ;; -+ e) php_cv_lib_gd_works=yes ;; - esac - fi - rm -f core conftest.err conftest.$ac_objext conftest.beam \ -@@ -40464,7 +40464,7 @@ - LIBS_SAVED=$LIBS - CFLAGS="$CFLAGS $GMP_CFLAGS" - LIBS="$LIBS $GMP_LIBS" -- gmp_check=no -+ gmp_check=yes - ac_fn_c_check_header_compile "$LINENO" "gmp.h" "ac_cv_header_gmp_h" "$ac_includes_default" - if test "x$ac_cv_header_gmp_h" = xyes - then : -diff -ruwN source/ext/phar/Makefile.frag source-new/ext/phar/Makefile.frag ---- source/ext/phar/Makefile.frag 2026-01-14 00:17:10.000000000 +0700 -+++ source-new/ext/phar/Makefile.frag 2026-01-16 15:56:01.946130660 +0700 -@@ -30,7 +30,7 @@ - -@test -f $(builddir)/phar/phar.inc || cp $(srcdir)/phar/phar.inc $(builddir)/phar/phar.inc - - TEST_PHP_EXECUTABLE = $(shell $(PHP_EXECUTABLE) -v 2>&1) --TEST_PHP_EXECUTABLE_RES = $(shell echo "$(TEST_PHP_EXECUTABLE)" | grep -c 'Exec format error') -+TEST_PHP_EXECUTABLE_RES = $(shell echo "$(TEST_PHP_EXECUTABLE)" | grep -E -c 'Exec format error|required file not found') - - $(builddir)/phar.php: $(srcdir)/build_precommand.php $(srcdir)/phar/*.inc $(srcdir)/phar/*.php $(SAPI_CLI_PATH) - -@(echo "Generating phar.php"; \ -diff -ruwN source/ext/posix/posix.c source-new/ext/posix/posix.c ---- source/ext/posix/posix.c 2026-01-14 00:17:10.000000000 +0700 -+++ source-new/ext/posix/posix.c 2026-01-16 15:56:01.946290813 +0700 -@@ -375,7 +375,7 @@ - - ZEND_PARSE_PARAMETERS_NONE(); - -- if ((ticks = times(&t)) == -1) { -+ { - POSIX_G(last_error) = errno; - RETURN_FALSE; - } -diff -ruwN source/sapi/fpm/fpm/fpm_status.c source-new/sapi/fpm/fpm/fpm_status.c ---- source/sapi/fpm/fpm/fpm_status.c 2026-01-14 00:17:10.000000000 +0700 -+++ source-new/sapi/fpm/fpm/fpm_status.c 2026-01-16 15:57:37.781307156 +0700 -@@ -84,6 +84,7 @@ - continue; - } - /* prevent NaN */ -+#ifdef HAVE_TIMES - if (proc_p->cpu_duration.tv_sec == 0 && proc_p->cpu_duration.tv_usec == 0) { - cpu = 0.; - } else { -@@ -91,6 +92,9 @@ - proc_p->last_request_cpu.tms_cstime) / fpm_scoreboard_get_tick() / - (proc_p->cpu_duration.tv_sec + proc_p->cpu_duration.tv_usec / 1000000.) * 100.; - } -+#else -+ cpu = 0.; -+#endif - - array_init(&fpm_proc_stat); - add_assoc_long(&fpm_proc_stat, "pid", proc_p->pid); -@@ -573,11 +577,15 @@ - } - - /* prevent NaN */ -+#ifdef HAVE_TIMES - if (proc->cpu_duration.tv_sec == 0 && proc->cpu_duration.tv_usec == 0) { - cpu = 0.; - } else { - cpu = (proc->last_request_cpu.tms_utime + proc->last_request_cpu.tms_stime + proc->last_request_cpu.tms_cutime + proc->last_request_cpu.tms_cstime) / fpm_scoreboard_get_tick() / (proc->cpu_duration.tv_sec + proc->cpu_duration.tv_usec / 1000000.) * 100.; - } -+#else -+ cpu = 0.; -+#endif - - if (proc->request_stage == FPM_REQUEST_ACCEPTING) { - duration = proc->duration; diff --git a/recipes/dev/python312/redox.patch b/recipes/dev/python312/redox.patch deleted file mode 100644 index 034194a222..0000000000 --- a/recipes/dev/python312/redox.patch +++ /dev/null @@ -1,152 +0,0 @@ -diff -ruwN source/configure source-new/configure ---- source/configure 2025-10-09 18:07:00.000000000 +0700 -+++ source-new/configure 2025-12-09 22:14:30.781035339 +0700 -@@ -4283,6 +4283,9 @@ - *-*-wasi) - ac_sys_system=WASI - ;; -+ *-*-redox*) -+ ac_sys_system=Redox -+ ;; - *) - # for now, limit cross builds to known configurations - MACHDEP="unknown" -@@ -4307,6 +4310,7 @@ - case $MACHDEP in - aix*) MACHDEP="aix";; - linux*) MACHDEP="linux";; -+ redox*) MACHDEP="redox";; - cygwin*) MACHDEP="cygwin";; - darwin*) MACHDEP="darwin";; - '') MACHDEP="unknown";; -@@ -4327,7 +4331,7 @@ - - if test "$cross_compiling" = yes; then - case "$host" in -- *-*-linux*) -+ *-*-linux*|*-*-redox*) - case "$host_cpu" in - arm*) - _host_cpu=arm -@@ -6762,6 +6766,7 @@ - #undef cris - #undef fr30 - #undef linux -+#undef redox - #undef hppa - #undef hpux - #undef i386 -@@ -6907,6 +6912,18 @@ - # endif - #elif defined(__gnu_hurd__) - i386-gnu -+#elif defined(__redox__) -+# if defined(__x86_64__) -+ x86_64-redox -+# elif defined(__i386__) -+ i386-redox -+# elif defined(__aarch64__) -+ aarch64-redox -+# elif defined(__riscv) -+ riscv64-redox -+# else -+# error unknown platform triplet -+# endif - #elif defined(__APPLE__) - darwin - #elif defined(__VXWORKS__) -@@ -7507,7 +7524,7 @@ - PY3LIBRARY=libpython3.so - fi - ;; -- Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|VxWorks*) -+ Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|VxWorks*|Redox*) - LDLIBRARY='libpython$(LDVERSION).so' - BLDLIBRARY='-L. -lpython$(LDVERSION)' - RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} -@@ -12815,7 +12832,7 @@ - Emscripten*|WASI*) - LDSHARED='$(CC) -shared' - LDCXXSHARED='$(CXX) -shared';; -- Linux*|GNU*|QNX*|VxWorks*|Haiku*) -+ Linux*|GNU*|QNX*|VxWorks*|Haiku*|Redox*) - LDSHARED='$(CC) -shared' - LDCXXSHARED='$(CXX) -shared';; - FreeBSD*) -@@ -12901,7 +12918,7 @@ - else CCSHARED="+z"; - fi;; - Linux-android*) ;; -- Linux*|GNU*) CCSHARED="-fPIC";; -+ Linux*|GNU*|Redox*) CCSHARED="-fPIC";; - Emscripten*|WASI*) - if test "x$enable_wasm_dynamic_linking" = xyes - then : -@@ -12939,7 +12956,7 @@ - LINKFORSHARED="-Wl,-E -Wl,+s";; - # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; - Linux-android*) LINKFORSHARED="-pie -Xlinker -export-dynamic";; -- Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";; -+ Linux*|GNU*|Redox*) LINKFORSHARED="-Xlinker -export-dynamic";; - # -u libsys_s pulls in all symbols in libsys - Darwin/*) - LINKFORSHARED="$extra_undefs -framework CoreFoundation" -diff -ruwN source/Include/pyport.h source-new/Include/pyport.h ---- source/Include/pyport.h 2025-10-09 18:07:00.000000000 +0700 -+++ source-new/Include/pyport.h 2025-12-09 22:14:30.781035339 +0700 -@@ -684,7 +684,7 @@ - # error "Py_TRACE_REFS ABI is not compatible with release and debug ABI" - #endif - --#if defined(__ANDROID__) || defined(__VXWORKS__) -+#if defined(__ANDROID__) || defined(__VXWORKS__) || defined(__redox__) - // Use UTF-8 as the locale encoding, ignore the LC_CTYPE locale. - // See _Py_GetLocaleEncoding(), PyUnicode_DecodeLocale() - // and PyUnicode_EncodeLocale(). -diff -ruwN source/Modules/_cryptmodule.c source-new/Modules/_cryptmodule.c ---- source/Modules/_cryptmodule.c 2025-10-09 18:07:00.000000000 +0700 -+++ source-new/Modules/_cryptmodule.c 2025-12-09 22:14:30.781035339 +0700 -@@ -38,13 +38,7 @@ - /*[clinic end generated code: output=0512284a03d2803c input=0e8edec9c364352b]*/ - { - char *crypt_result; --#ifdef HAVE_CRYPT_R -- struct crypt_data data; -- memset(&data, 0, sizeof(data)); -- crypt_result = crypt_r(word, salt, &data); --#else - crypt_result = crypt(word, salt); --#endif - if (crypt_result == NULL) { - return PyErr_SetFromErrno(PyExc_OSError); - } -diff -ruwN source/Modules/resource.c source-new/Modules/resource.c ---- source/Modules/resource.c 2025-10-09 18:07:00.000000000 +0700 -+++ source-new/Modules/resource.c 2025-12-09 22:14:30.781035339 +0700 -@@ -216,7 +216,7 @@ - { - struct rlimit rl; - -- if (resource < 0 || resource >= RLIM_NLIMITS) { -+ if (resource < 0 || resource >= RLIMIT_NLIMITS) { - PyErr_SetString(PyExc_ValueError, - "invalid resource specified"); - return NULL; -@@ -244,7 +244,7 @@ - { - struct rlimit rl; - -- if (resource < 0 || resource >= RLIM_NLIMITS) { -+ if (resource < 0 || resource >= RLIMIT_NLIMITS) { - PyErr_SetString(PyExc_ValueError, - "invalid resource specified"); - return NULL; -@@ -292,7 +292,7 @@ - struct rlimit old_limit, new_limit; - int retval; - -- if (resource < 0 || resource >= RLIM_NLIMITS) { -+ if (resource < 0 || resource >= RLIMIT_NLIMITS) { - PyErr_SetString(PyExc_ValueError, - "invalid resource specified"); - return NULL; diff --git a/recipes/dev/rustpython/redox.patch b/recipes/dev/rustpython/redox.patch deleted file mode 100644 index 5edecdeae3..0000000000 --- a/recipes/dev/rustpython/redox.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/stdlib/src/posixsubprocess.rs b/stdlib/src/posixsubprocess.rs -index 7f418c899..4da6a6858 100644 ---- a/stdlib/src/posixsubprocess.rs -+++ b/stdlib/src/posixsubprocess.rs -@@ -441,15 +441,14 @@ fn close_dir_fds(keep: KeepFds<'_>) -> nix::Result<()> { - fn close_filetable_fds(keep: KeepFds<'_>) -> nix::Result<()> { - use nix::fcntl; - use std::os::fd::{FromRawFd, OwnedFd}; -- let fd = fcntl::open( -+ let filetable = fcntl::open( - c"/scheme/thisproc/current/filetable", - fcntl::OFlag::O_RDONLY, - nix::sys::stat::Mode::empty(), - )?; -- let filetable = unsafe { OwnedFd::from_raw_fd(fd) }; - let read_one = || -> nix::Result<_> { - let mut byte = 0; -- let n = nix::unistd::read(filetable.as_raw_fd(), std::slice::from_mut(&mut byte))?; -+ let n = nix::unistd::read(&filetable, std::slice::from_mut(&mut byte))?; - Ok((n > 0).then_some(byte)) - }; - while let Some(c) = read_one()? { diff --git a/recipes/emulators/dosbox/01_redox.patch b/recipes/emulators/dosbox/01_redox.patch deleted file mode 100644 index 9de0f525be..0000000000 --- a/recipes/emulators/dosbox/01_redox.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -rupNw source-original/include/cross.h source/include/cross.h ---- source-original/include/cross.h 2010-05-10 19:43:54.000000000 +0200 -+++ source/include/cross.h 2018-05-04 21:14:40.397157710 +0200 -@@ -64,7 +64,7 @@ - //Solaris maybe others - #if defined (DB_HAVE_NO_POWF) - #include --static inline float powf (float x, float y) { return (float) pow (x,y); } -+//static inline float powf (float x, float y) { return (float) pow (x,y); } - #endif - - class Cross { -diff -rupNw source-original/src/gui/sdlmain.cpp source/src/gui/sdlmain.cpp ---- source-original/src/gui/sdlmain.cpp 2010-05-10 19:43:54.000000000 +0200 -+++ source/src/gui/sdlmain.cpp 2018-05-04 21:15:31.937672555 +0200 -@@ -1518,7 +1518,7 @@ void Config_Add_SDL() { - Pstring = sdl_sec->Add_path("mapperfile",Property::Changeable::Always,MAPPERFILE); - Pstring->Set_help("File used to load/save the key/event mappings from. Resetmapper only works with the defaul value."); - -- Pbool = sdl_sec->Add_bool("usescancodes",Property::Changeable::Always,true); -+ Pbool = sdl_sec->Add_bool("usescancodes",Property::Changeable::Always,false); - Pbool->Set_help("Avoid usage of symkeys, might not work on all operating systems."); - } - diff --git a/recipes/emulators/mednafen/redox.patch b/recipes/emulators/mednafen/redox.patch deleted file mode 100644 index ea58184b0f..0000000000 --- a/recipes/emulators/mednafen/redox.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -ruwN source-old/src/sound/SwiftResampler.cpp source/src/sound/SwiftResampler.cpp ---- source-old/src/sound/SwiftResampler.cpp 2022-01-18 14:16:23.000000000 -0700 -+++ source/src/sound/SwiftResampler.cpp 2022-12-16 20:01:02.263159230 -0700 -@@ -608,6 +608,9 @@ - - if(hp_tc > 0) - { -+#ifndef M_E -+#define M_E 2.7182818284590452354 -+#endif - double tdm = (pow(2.0 - pow(M_E, -1.0), 1.0 / (hp_tc * output_rate)) - 1.0); - - //printf("%f\n", tdm); diff --git a/recipes/emulators/mgba/redox.patch b/recipes/emulators/mgba/redox.patch deleted file mode 100644 index 33b1a4daaf..0000000000 --- a/recipes/emulators/mgba/redox.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ruwN mgba-0.10.5/src/third-party/zlib/contrib/minizip/ioapi.h source/src/third-party/zlib/contrib/minizip/ioapi.h ---- mgba-0.10.5/src/third-party/zlib/contrib/minizip/ioapi.h 2025-03-08 20:09:26.000000000 -0700 -+++ source/src/third-party/zlib/contrib/minizip/ioapi.h 2025-06-13 13:07:13.489517096 -0600 -@@ -50,7 +50,7 @@ - #define ftello64 ftell - #define fseeko64 fseek - #else --#ifdef __FreeBSD__ -+#if defined(__FreeBSD__) || defined(__redox__) - #define fopen64 fopen - #define ftello64 ftello - #define fseeko64 fseeko diff --git a/recipes/emulators/scummvm/redox.patch b/recipes/emulators/scummvm/redox.patch deleted file mode 100644 index 153b7f5e8c..0000000000 --- a/recipes/emulators/scummvm/redox.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -rupNw source-original/common/stream.cpp source/common/stream.cpp ---- source-original/common/stream.cpp 2017-12-08 23:21:10.000000000 +0100 -+++ source/common/stream.cpp 2018-12-06 02:01:50.454108198 +0100 -@@ -95,7 +95,7 @@ bool MemoryReadStream::seek(int32 offs, - break; - } - // Post-Condition -- assert(_pos <= _size); -+ //assert(_pos <= _size); - - // Reset end-of-stream flag on a successful seek - _eos = false; -diff -rupNw source-original/configure source/configure ---- source-original/configure 2017-12-08 23:21:13.000000000 +0100 -+++ source/configure 2018-12-06 02:01:50.458108239 +0100 -@@ -3610,7 +3610,7 @@ case $_host_os in - amigaos* | cygwin* | dreamcast | ds | gamecube | mingw* | n64 | ps2 | ps3 | psp2 | psp | wii | wince) - _posix=no - ;; -- 3ds | android | androidsdl | beos* | bsd* | darwin* | freebsd* | gnu* | gph-linux | haiku* | hpux* | iphone | ios7 | irix*| k*bsd*-gnu* | linux* | maemo | mint* | netbsd* | openbsd* | riscos | solaris* | sunos* | uclinux* | webos) -+ 3ds | android | androidsdl | beos* | bsd* | darwin* | freebsd* | gnu* | gph-linux | haiku* | hpux* | iphone | ios7 | irix*| k*bsd*-gnu* | linux* | maemo | mint* | netbsd* | openbsd* | riscos | redox* | solaris* | sunos* | uclinux* | webos) - _posix=yes - ;; - os2-emx*) diff --git a/recipes/games/eduke32/redox.patch b/recipes/games/eduke32/redox.patch deleted file mode 100644 index 5d5fa8af3c..0000000000 --- a/recipes/games/eduke32/redox.patch +++ /dev/null @@ -1,158 +0,0 @@ -diff -rupwN source/Common.mak source-new/Common.mak ---- source/Common.mak 2018-07-14 15:36:44.000000000 -0600 -+++ source-new/Common.mak 2023-01-20 10:38:24.948044222 -0700 -@@ -93,7 +93,7 @@ endif - - ##### Makefile meta-settings - --PRETTY_OUTPUT := 1 -+PRETTY_OUTPUT := 0 - - NULLSTREAM := /dev/null - -@@ -172,6 +172,10 @@ ifeq ($(PLATFORM),WII) - CCFULLPATH = $(DEVKITPPC)/bin/$(CC) - endif - -+ifeq ($(PLATFORM),REDOX) -+ CROSS := $(TARGET)- -+endif -+ - CC := $(CROSS)gcc$(CROSS_SUFFIX) - CXX := $(CROSS)g++$(CROSS_SUFFIX) - -@@ -383,6 +387,16 @@ else ifeq ($(PLATFORM),$(filter $(PLATFO - override NOASM := 1 - else ifeq ($(PLATFORM),$(filter $(PLATFORM),BEOS SKYOS)) - override NOASM := 1 -+else ifeq ($(PLATFORM),REDOX) -+ override HAVE_FLAC := 0 -+ override HAVE_GTK2 := 0 -+ override HAVE_XMP := 0 -+ override MIXERTYPE := SDL -+ override NETCODE := 0 -+ override NOASM := 1 -+ override USE_OPENGL := 0 -+ OPTOPT := -mtune=generic -+ SDL_TARGET := 1 - endif - - ifneq (i386,$(strip $(IMPLICIT_ARCH))) -@@ -868,7 +882,7 @@ ifeq ($(RENDERTYPE),SDL) - SDLCONFIG := sdl2-config - SDLNAME := SDL2 - else ifeq ($(SDL_TARGET),1) -- SDLCONFIG := sdl-config -+ #SDLCONFIG := sdl-config - SDLNAME := SDL - ifeq (0,$(RELEASE)) - COMPILERFLAGS += -DNOSDLPARACHUTE -@@ -957,9 +971,11 @@ else ifeq ($(PLATFORM),WII) - LIBS += -laesnd_tueidj -lfat -lwiiuse -lbte -lwiikeyboard -logc - else ifeq ($(SUBPLATFORM),LINUX) - LIBS += -lrt -+else ifeq ($(PLATFORM),REDOX) -+ LIBS += -lorbital -lvorbisfile -lvorbis -logg - endif - --ifeq (,$(filter $(PLATFORM),WINDOWS WII)) -+ifeq (,$(filter $(PLATFORM),WINDOWS WII REDOX)) - ifneq ($(PLATFORM),BSD) - LIBS += -ldl - endif -Binary files source/.Common.mak.swp and source-new/.Common.mak.swp differ -diff -rupwN source/source/build/include/compat.h source-new/source/build/include/compat.h ---- source/source/build/include/compat.h 2018-10-06 23:21:24.000000000 -0600 -+++ source-new/source/build/include/compat.h 2023-01-20 10:31:10.843745693 -0700 -@@ -7,6 +7,9 @@ - - #pragma once - -+# define B_LITTLE_ENDIAN 1 -+# define B_BIG_ENDIAN 0 -+ - #ifdef _WIN32 - # include "windows_inc.h" - #endif -@@ -400,6 +403,7 @@ defined __x86_64__ || defined __amd64__ - #include - #include - #include -+#include - - #include - #include -@@ -542,8 +546,8 @@ typedef FILE BFILE; - # define BS_IWRITE S_IWUSR - # define BS_IREAD S_IRUSR - #else --# define BS_IWRITE S_IWRITE --# define BS_IREAD S_IREAD -+# define BS_IWRITE S_IWUSR -+# define BS_IREAD S_IRUSR - #endif - - #if defined(__cplusplus) && defined(_MSC_VER) -diff -rupwN source/source/build/src/baselayer.cpp source-new/source/build/src/baselayer.cpp ---- source/source/build/src/baselayer.cpp 2018-10-06 23:21:43.000000000 -0600 -+++ source-new/source/build/src/baselayer.cpp 2023-01-20 10:31:49.591772332 -0700 -@@ -498,7 +498,7 @@ int32_t baselayer_init(void) - - void maybe_redirect_outputs(void) - { --#if !(defined __APPLE__ && defined __BIG_ENDIAN__) -+#if 0 - char *argp; - - // pipe standard outputs to files -diff -rupwN source/source/build/src/sdlayer.cpp source-new/source/build/src/sdlayer.cpp ---- source/source/build/src/sdlayer.cpp 2018-10-06 23:23:44.000000000 -0600 -+++ source-new/source/build/src/sdlayer.cpp 2023-01-20 10:30:49.223730830 -0700 -@@ -305,7 +305,7 @@ void wm_setapptitle(const char *name) - // - - /* XXX: libexecinfo could be used on systems without gnu libc. */ --#if !defined _WIN32 && defined __GNUC__ && !defined __OpenBSD__ && !(defined __APPLE__ && defined __BIG_ENDIAN__) && !defined GEKKO && !defined EDUKE32_TOUCH_DEVICES && !defined __OPENDINGUX__ -+#if 0 - # define PRINTSTACKONSEGV 1 - # include - #endif -diff -rupwN source/source/duke3d/src/common.cpp source-new/source/duke3d/src/common.cpp ---- source/source/duke3d/src/common.cpp 2018-10-06 23:20:23.000000000 -0600 -+++ source-new/source/duke3d/src/common.cpp 2023-01-20 10:30:49.223730830 -0700 -@@ -1173,6 +1173,7 @@ int32_t S_OpenAudio(const char *fn, char - Bfree(testfn); - return origfp; - } -+#endif - - void Duke_CommonCleanup(void) - { -@@ -1181,4 +1182,3 @@ void Duke_CommonCleanup(void) - DO_FREE_AND_NULL(g_rtsNamePtr); - } - --#endif -diff -rupwN source/source/duke3d/src/game.cpp source-new/source/duke3d/src/game.cpp ---- source/source/duke3d/src/game.cpp 2018-10-06 23:23:48.000000000 -0600 -+++ source-new/source/duke3d/src/game.cpp 2023-01-20 10:30:49.223730830 -0700 -@@ -6697,7 +6697,7 @@ MAIN_LOOP_RESTART: - static char buf[128]; - #ifndef GEKKO - int32_t flag = 1; -- ioctl(0, FIONBIO, &flag); -+ //ioctl(0, FIONBIO, &flag); - #endif - if ((nb = read(0, &ch, 1)) > 0 && bufpos < sizeof(buf)) - { -diff -rupwN source/source/enet/include/enet/unix.h source-new/source/enet/include/enet/unix.h ---- source/source/enet/include/enet/unix.h 2014-06-16 17:16:08.000000000 -0600 -+++ source-new/source/enet/include/enet/unix.h 2023-01-20 10:30:49.223730830 -0700 -@@ -6,6 +6,7 @@ - #define __ENET_UNIX_H__ - - #include -+#include - #include - #include - #if defined(GEKKO) diff --git a/recipes/games/neverball/redox.patch b/recipes/games/neverball/redox.patch deleted file mode 100644 index 7457ccff79..0000000000 --- a/recipes/games/neverball/redox.patch +++ /dev/null @@ -1,87 +0,0 @@ -diff -ruwN neverball-1.6.0/Makefile source/Makefile ---- neverball-1.6.0/Makefile 2014-05-21 07:21:43.000000000 -0600 -+++ source/Makefile 2023-09-09 20:03:22.113348963 -0600 -@@ -38,11 +38,11 @@ - ifeq ($(DEBUG),1) - CFLAGS := -g - CXXFLAGS := -g -- CPPFLAGS := -+ CPPFLAGS += - else - CFLAGS := -O2 - CXXFLAGS := -O2 -- CPPFLAGS := -DNDEBUG -+ CPPFLAGS += -DNDEBUG - endif - - #------------------------------------------------------------------------------ -@@ -64,8 +64,8 @@ - - # Preprocessor... - --SDL_CPPFLAGS := $(shell sdl2-config --cflags) --PNG_CPPFLAGS := $(shell libpng-config --cflags) -+SDL_CPPFLAGS := $(shell $(PKG_CONFIG) sdl2 --cflags) -+PNG_CPPFLAGS := $(shell $(PKG_CONFIG) libpng --cflags) - - ALL_CPPFLAGS := $(SDL_CPPFLAGS) $(PNG_CPPFLAGS) -Ishare - -@@ -124,8 +124,8 @@ - #------------------------------------------------------------------------------ - # Libraries - --SDL_LIBS := $(shell sdl2-config --libs) --PNG_LIBS := $(shell libpng-config --libs) -+SDL_LIBS := $(shell $(PKG_CONFIG) sdl2 --libs) -+PNG_LIBS := $(shell $(PKG_CONFIG) libpng --libs) - - ifeq ($(ENABLE_FS),stdio) - FS_LIBS := -@@ -148,7 +148,7 @@ - endif - endif - --OGL_LIBS := -lGL -+OGL_LIBS := -lorbital $(shell $(PKG_CONFIG) osmesa --libs) - - ifeq ($(PLATFORM),mingw) - ifneq ($(ENABLE_NLS),0) -@@ -175,8 +175,8 @@ - /usr/local/lib)) - endif - --OGG_LIBS := -lvorbisfile --TTF_LIBS := -lSDL2_ttf -+OGG_LIBS := $(shell $(PKG_CONFIG) ogg vorbis vorbisfile --libs) -+TTF_LIBS := $(shell $(PKG_CONFIG) SDL2_ttf --libs) -lfreetype - - ALL_LIBS := $(HMD_LIBS) $(TILT_LIBS) $(INTL_LIBS) $(TTF_LIBS) \ - $(OGG_LIBS) $(SDL_LIBS) $(OGL_LIBS) $(BASE_LIBS) -@@ -411,11 +411,11 @@ - - all : $(BALL_TARG) $(PUTT_TARG) $(MAPC_TARG) sols locales desktops - --ifeq ($(ENABLE_HMD),libovr) -+#ifeq ($(ENABLE_HMD),libovr) - LINK := $(CXX) $(ALL_CXXFLAGS) --else --LINK := $(CC) $(ALL_CFLAGS) --endif -+#else -+#LINK := $(CC) $(ALL_CFLAGS) -+#endif - - $(BALL_TARG) : $(BALL_OBJS) - $(LINK) -o $(BALL_TARG) $(BALL_OBJS) $(LDFLAGS) $(ALL_LIBS) -diff -ruwN neverball-1.6.0/share/text.h source/share/text.h ---- neverball-1.6.0/share/text.h 2014-05-21 07:21:43.000000000 -0600 -+++ source/share/text.h 2023-09-09 20:02:10.117248865 -0600 -@@ -15,7 +15,7 @@ - - /*---------------------------------------------------------------------------*/ - --char text_input[MAXSTR]; -+extern char text_input[MAXSTR]; - - void text_input_start(void (*cb)(int typing)); - void text_input_stop(void); diff --git a/recipes/games/openttd/redox.patch b/recipes/games/openttd/redox.patch deleted file mode 100644 index 2cba223043..0000000000 --- a/recipes/games/openttd/redox.patch +++ /dev/null @@ -1,116 +0,0 @@ -diff -ruw source/config.lib source-new/config.lib ---- source/config.lib 2019-06-19 08:34:01.122040101 -0600 -+++ source-new/config.lib 2019-06-27 16:41:18.749553078 -0600 -@@ -1458,7 +1458,8 @@ - fi - fi - -- has_rdynamic=`$1 -dumpspecs | grep rdynamic` -+ #TODO has_rdynamic=`$1 -dumpspecs | grep rdynamic` -+ has_rdynamic="" - if [ -n "$has_rdynamic" ]; then - # rdynamic is used to get useful stack traces from crash reports. - flags="$flags -rdynamic" -@@ -1486,7 +1487,7 @@ - # Special CXXFlags for HOST - CXXFLAGS="$CXXFLAGS" - # Libs to compile. In fact this is just LDFLAGS -- LIBS="-lstdc++" -+ LIBS="-lstdc++ -lSDL -lorbital" - # LDFLAGS used for HOST - LDFLAGS="$LDFLAGS" - # FEATURES for HOST (lto) -diff -ruw source/src/music/extmidi.cpp source-new/src/music/extmidi.cpp ---- source/src/music/extmidi.cpp 2019-06-19 08:34:01.278040813 -0600 -+++ source-new/src/music/extmidi.cpp 2019-06-27 16:39:06.400266392 -0600 -@@ -115,7 +115,11 @@ - switch (this->pid) { - case 0: { - close(0); -+#if defined(__redox__) -+ int d = open("null:", O_RDONLY); -+#else - int d = open("/dev/null", O_RDONLY); -+#endif - if (d != -1 && dup2(d, 1) != -1 && dup2(d, 2) != -1) { - execvp(this->params[0], this->params); - } -diff -ruw source/src/os/unix/unix.cpp source-new/src/os/unix/unix.cpp ---- source/src/os/unix/unix.cpp 2019-06-19 08:34:01.294040885 -0600 -+++ source-new/src/os/unix/unix.cpp 2019-06-27 16:39:06.400266392 -0600 -@@ -69,12 +69,12 @@ - - bool FiosIsRoot(const char *path) - { --#if !defined(__MORPHOS__) && !defined(__AMIGAOS__) -+#if !defined(__redox__) - return path[1] == '\0'; - #else -- /* On MorphOS or AmigaOS paths look like: "Volume:directory/subdirectory" */ -+ /* On Redox paths look like: "scheme:/directory/subdirectory" */ - const char *s = strchr(path, ':'); -- return s != NULL && s[1] == '\0'; -+ return (s != NULL) && (strlen(s) == 2) && (s[1] == '/') && (s[2] == '\0'); - #endif - } - -@@ -106,10 +106,10 @@ - { - char filename[MAX_PATH]; - int res; --#if defined(__MORPHOS__) || defined(__AMIGAOS__) -- /* On MorphOS or AmigaOS paths look like: "Volume:directory/subdirectory" */ -+#if defined(__redox__) -+ /* On Redox paths look like: "scheme:/directory/subdirectory" */ - if (FiosIsRoot(path)) { -- res = seprintf(filename, lastof(filename), "%s:%s", path, ent->d_name); -+ res = seprintf(filename, lastof(filename), "%s%s", path, ent->d_name); - } else // XXX - only next line! - #else - assert(path[strlen(path) - 1] == PATHSEPCHAR); -@@ -370,7 +370,7 @@ - if (child_pid != 0) return; - - const char *args[3]; -- args[0] = "xdg-open"; -+ args[0] = "netsurf-fb"; - args[1] = url; - args[2] = NULL; - execvp(args[0], const_cast(args)); -diff -ruw source/src/rev.cpp.in source-new/src/rev.cpp.in ---- source/src/rev.cpp.in 2019-06-19 08:34:01.298040904 -0600 -+++ source-new/src/rev.cpp.in 2019-06-27 16:39:06.400266392 -0600 -@@ -57,7 +57,7 @@ - * (compiling from sources without any version control software) - * and 2 is for modified revision. - */ --const byte _openttd_revision_modified = !!MODIFIED!!; -+const byte _openttd_revision_modified = 2; - - /** - * The NewGRF revision of OTTD: -diff -ruw source/src/stdafx.h source-new/src/stdafx.h ---- source/src/stdafx.h 2019-06-19 08:34:01.334041067 -0600 -+++ source-new/src/stdafx.h 2019-06-27 16:39:06.400266392 -0600 -@@ -12,6 +12,9 @@ - #ifndef STDAFX_H - #define STDAFX_H - -+#include -+#include -+ - #if defined(__APPLE__) - #include "os/macosx/osx_stdafx.h" - #endif /* __APPLE__ */ -diff -ruw source/src/string.cpp source-new/src/string.cpp ---- source/src/string.cpp 2019-06-19 08:34:01.334041067 -0600 -+++ source-new/src/string.cpp 2019-06-27 16:39:06.400266392 -0600 -@@ -528,7 +528,7 @@ - return length; - } - --#ifdef DEFINE_STRCASESTR -+#if 0 - char *strcasestr(const char *haystack, const char *needle) - { - size_t hay_len = strlen(haystack); diff --git a/recipes/games/opentyrian/redox.patch b/recipes/games/opentyrian/redox.patch deleted file mode 100644 index e0de2aec7f..0000000000 --- a/recipes/games/opentyrian/redox.patch +++ /dev/null @@ -1,60 +0,0 @@ -Binary files source/.git/index and source-new/.git/index differ -diff '--color=auto' -rupwN source/Makefile source-new/Makefile ---- source/Makefile 2024-10-21 02:46:06.720225834 -0400 -+++ source-new/Makefile 2024-10-25 01:03:37.283351544 -0400 -@@ -5,10 +5,11 @@ ifneq ($(filter Msys Cygwin, $(shell una - TYRIAN_DIR = C:\\TYRIAN - else - PLATFORM := UNIX -- TYRIAN_DIR = $(gamesdir)/tyrian -+ TYRIAN_DIR ?= $(gamesdir)/tyrian - endif - --WITH_NETWORK := true -+WITH_NETWORK ?= true -+REDOX_OVERRIDE ?= false - - ################################################################################ - -@@ -114,11 +115,15 @@ installdirs : - mkdir -p $(DESTDIR)$(docdir) - mkdir -p $(DESTDIR)$(man6dir) - mkdir -p $(DESTDIR)$(desktopdir) -- mkdir -p $(DESTDIR)$(icondir)/hicolor/22x22/apps -- mkdir -p $(DESTDIR)$(icondir)/hicolor/24x24/apps -- mkdir -p $(DESTDIR)$(icondir)/hicolor/32x32/apps -- mkdir -p $(DESTDIR)$(icondir)/hicolor/48x48/apps -- mkdir -p $(DESTDIR)$(icondir)/hicolor/128x128/apps -+ if [ "$(REDOX_OVERRIDE)" = "true" ]; then\ -+ mkdir -p $(DESTDIR)$(icondir);\ -+ else\ -+ mkdir -p $(DESTDIR)$(icondir)/hicolor/22x22/apps;\ -+ mkdir -p $(DESTDIR)$(icondir)/hicolor/24x24/apps;\ -+ mkdir -p $(DESTDIR)$(icondir)/hicolor/32x32/apps;\ -+ mkdir -p $(DESTDIR)$(icondir)/hicolor/48x48/apps;\ -+ mkdir -p $(DESTDIR)$(icondir)/hicolor/128x128/apps;\ -+ fi;\ - - .PHONY : install - install : $(TARGET) installdirs -@@ -126,11 +131,15 @@ install : $(TARGET) installdirs - $(INSTALL_DATA) NEWS README $(DESTDIR)$(docdir)/ - $(INSTALL_DATA) linux/man/opentyrian.6 $(DESTDIR)$(man6dir)/opentyrian$(man6ext) - $(INSTALL_DATA) linux/opentyrian.desktop $(DESTDIR)$(desktopdir)/ -- $(INSTALL_DATA) linux/icons/tyrian-22.png $(DESTDIR)$(icondir)/hicolor/22x22/apps/opentyrian.png -- $(INSTALL_DATA) linux/icons/tyrian-24.png $(DESTDIR)$(icondir)/hicolor/24x24/apps/opentyrian.png -- $(INSTALL_DATA) linux/icons/tyrian-32.png $(DESTDIR)$(icondir)/hicolor/32x32/apps/opentyrian.png -- $(INSTALL_DATA) linux/icons/tyrian-48.png $(DESTDIR)$(icondir)/hicolor/48x48/apps/opentyrian.png -- $(INSTALL_DATA) linux/icons/tyrian-128.png $(DESTDIR)$(icondir)/hicolor/128x128/apps/opentyrian.png -+ if [ "$(REDOX_OVERRIDE)" = "true" ]; then\ -+ $(INSTALL_DATA) linux/icons/tyrian-32.png $(DESTDIR)$(icondir)/opentyrian.png;\ -+ else\ -+ $(INSTALL_DATA) linux/icons/tyrian-22.png $(DESTDIR)$(icondir)/hicolor/22x22/apps/opentyrian.png;\ -+ $(INSTALL_DATA) linux/icons/tyrian-24.png $(DESTDIR)$(icondir)/hicolor/24x24/apps/opentyrian.png;\ -+ $(INSTALL_DATA) linux/icons/tyrian-32.png $(DESTDIR)$(icondir)/hicolor/32x32/apps/opentyrian.png;\ -+ $(INSTALL_DATA) linux/icons/tyrian-48.png $(DESTDIR)$(icondir)/hicolor/48x48/apps/opentyrian.png;\ -+ $(INSTALL_DATA) linux/icons/tyrian-128.png $(DESTDIR)$(icondir)/hicolor/128x128/apps/opentyrian.png;\ -+ fi;\ - - .PHONY : uninstall - uninstall : diff --git a/recipes/games/prboom/01_redox.patch b/recipes/games/prboom/01_redox.patch deleted file mode 100644 index 6318a40936..0000000000 --- a/recipes/games/prboom/01_redox.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff -burpN source-original/src/m_misc.c source/src/m_misc.c ---- source-original/src/m_misc.c 2008-11-09 10:13:04.000000000 -0700 -+++ source/src/m_misc.c 2024-09-07 10:09:06.890301682 -0600 -@@ -954,6 +954,12 @@ void M_LoadDefaults (void) - // read the file in, overriding any set defaults - - f = fopen (defaultfile, "r"); -+#if defined(__redox__) -+ if (f) { -+ printf("disabling load of config file on redox\n"); -+ f = NULL; -+ } -+#endif - if (f) - { - while (!feof(f)) diff --git a/recipes/games/quakespasm/redox.patch b/recipes/games/quakespasm/redox.patch deleted file mode 100644 index 754776dc95..0000000000 --- a/recipes/games/quakespasm/redox.patch +++ /dev/null @@ -1,110 +0,0 @@ -diff '--color=auto' -rupwN source/Makefile source-new/Makefile ---- source/Makefile 2024-10-15 21:21:14.824589882 -0400 -+++ source-new/Makefile 2024-10-16 00:42:27.651948743 -0400 -@@ -4,28 +4,34 @@ - # "make SDL_CONFIG=/path/to/sdl-config" for unusual SDL installations. - # "make DO_USERDIRS=1" to enable user directories support - -+# Base install directory -+DESTDIR ?= "/" -+INSTALLDIR = "${DESTDIR}/usr/games/" -+DATADIR = "${DESTDIR}/usr/share/games/quake1/id1/" -+ICODIR = "${DESTDIR}/usr/share/icons/apps/" -+ - # Enable/Disable user directories support --DO_USERDIRS=0 -+DO_USERDIRS ?= 0 - - ### Enable/Disable SDL2 --USE_SDL2=0 -+USE_SDL2 ?= 0 - - ### Enable/Disable codecs for streaming music support --USE_CODEC_WAVE=1 --USE_CODEC_FLAC=0 --USE_CODEC_MP3=1 --USE_CODEC_VORBIS=1 --USE_CODEC_OPUS=0 -+USE_CODEC_WAVE ?= 1 -+USE_CODEC_FLAC ?= 0 -+USE_CODEC_MP3 ?= 1 -+USE_CODEC_VORBIS ?= 1 -+USE_CODEC_OPUS ?= 0 - # either xmp or mikmod (or modplug) --USE_CODEC_MIKMOD=0 --USE_CODEC_XMP=0 --USE_CODEC_MODPLUG=0 --USE_CODEC_UMX=0 -+USE_CODEC_MIKMOD ?= 0 -+USE_CODEC_XMP ?= 0 -+USE_CODEC_MODPLUG ?= 0 -+USE_CODEC_UMX ?= 0 - - # which library to use for mp3 decoding: mad or mpg123 --MP3LIB=mad -+MP3LIB ?= mad - # which library to use for ogg decoding: vorbis or tremor --VORBISLIB=vorbis -+VORBISLIB ?= vorbis - - # --------------------------- - # Helper functions -@@ -35,7 +41,7 @@ check_gcc = $(shell if echo | $(CC) $(1) - - # --------------------------- - --HOST_OS = $(shell uname|sed -e s/_.*//|tr '[:upper:]' '[:lower:]') -+HOST_OS ?= $(shell uname|sed -e s/_.*//|tr '[:upper:]' '[:lower:]') - - DEBUG ?= 0 - -@@ -49,7 +55,7 @@ LINKER = $(CC) - STRIP ?= strip - PKG_CONFIG ?= pkg-config - --CPUFLAGS= -+CPUFLAGS ?= - LDFLAGS?= - DFLAGS ?= - CFLAGS ?= -Wall -Wno-trigraphs -MMD -@@ -81,11 +87,19 @@ endif - - ifeq ($(USE_SDL2),1) - SDL_CONFIG ?= sdl2-config -+SDL_VERSION = sdl2 - else - SDL_CONFIG ?= sdl-config -+SDL_VERSION = sdl - endif -+ -+ifeq ($(HOST_OS),redox) -+SDL_CFLAGS = $(shell $(PKG_CONFIG) --cflags $(SDL_VERSION)) -+SDL_LIBS = $(shell $(PKG_CONFIG) --libs $(SDL_VERSION)) -+else - SDL_CFLAGS = $(shell $(SDL_CONFIG) --cflags) - SDL_LIBS = $(shell $(SDL_CONFIG) --libs) -+endif - - NET_LIBS = - ifeq ($(HOST_OS),sunos) -@@ -164,6 +178,8 @@ endif - - ifeq ($(HOST_OS),haiku) - COMMON_LIBS= -lGL -+else ifeq ($(HOST_OS),redox) -+COMMON_LIBS= -lorbital $(shell $(PKG_CONFIG) --libs osmesa zlib) - else - COMMON_LIBS= -lGL -lm - endif -@@ -290,7 +306,10 @@ install: quakespasm - cp quakespasm.pak $(QS_APP_DIR) - else - install: quakespasm -- cp quakespasm /usr/local/games/quake -+ mkdir -p "${INSTALLDIR}" "${DATADIR}" "${ICODIR}" -+ cp quakespasm "${INSTALLDIR}/quakespasm" -+ # xxx Probably requires resizing -+ cp Misc/QuakeSpasm_512.png "${ICODIR}/quakespasm.png" - endif - - sinclude $(OBJS:.o=.d) diff --git a/recipes/libs/cairo/redox.patch b/recipes/libs/cairo/redox.patch deleted file mode 100644 index 110b39a1e5..0000000000 --- a/recipes/libs/cairo/redox.patch +++ /dev/null @@ -1,50 +0,0 @@ -diff -ruwN cairo-1.18.4/meson.build source/meson.build ---- cairo-1.18.4/meson.build 2025-03-08 05:35:35.000000000 -0700 -+++ source/meson.build 2025-05-04 18:07:04.594213814 -0600 -@@ -440,13 +440,13 @@ - if feature_conf.get('CAIRO_HAS_XCB_SURFACE', 0) == 1 - xcbshm_dep = dependency('xcb-shm', required: get_option('xcb')) - if xcbshm_dep.found() -- feature_conf.set('CAIRO_HAS_XCB_SHM_FUNCTIONS', 1) -- deps += [xcbshm_dep] -- built_features += [{ -- 'name': 'cairo-xcb-shm', -- 'description': 'XCB/SHM functions', -- 'deps': [xcbshm_dep], -- }] -+ #feature_conf.set('CAIRO_HAS_XCB_SHM_FUNCTIONS', 1) -+ #deps += [xcbshm_dep] -+ #built_features += [{ -+ # 'name': 'cairo-xcb-shm', -+ # 'description': 'XCB/SHM functions', -+ # 'deps': [xcbshm_dep], -+ #}] - endif - endif - -diff -ruwN cairo-1.18.4/perf/Makefile.in source/perf/Makefile.in ---- cairo-1.18.4/perf/Makefile.in 1969-12-31 17:00:00.000000000 -0700 -+++ source/perf/Makefile.in 2025-05-01 12:52:11.400963345 -0600 -@@ -0,0 +1,3 @@ -+all: -+ -+install: -diff -ruwN cairo-1.18.4/src/cairo-ps-surface.c source/src/cairo-ps-surface.c ---- cairo-1.18.4/src/cairo-ps-surface.c 2025-03-08 05:35:35.000000000 -0700 -+++ source/src/cairo-ps-surface.c 2025-05-04 18:08:43.821264417 -0600 -@@ -102,7 +102,7 @@ - #define DEBUG_FALLBACK(s) - #endif - --#ifndef HAVE_CTIME_R -+#if !defined(HAVE_CTIME_R) && !defined(__redox__) - static char *ctime_r(const time_t *timep, char *buf) - { - (void)buf; -diff -ruwN cairo-1.18.4/test/Makefile.in source/test/Makefile.in ---- cairo-1.18.4/test/Makefile.in 1969-12-31 17:00:00.000000000 -0700 -+++ source/test/Makefile.in 2025-05-01 12:52:11.400963345 -0600 -@@ -0,0 +1,3 @@ -+all: -+ -+install: diff --git a/recipes/libs/ffmpeg6/binutils-2.41.patch b/recipes/libs/ffmpeg6/binutils-2.41.patch deleted file mode 100644 index 33fd3d484f..0000000000 --- a/recipes/libs/ffmpeg6/binutils-2.41.patch +++ /dev/null @@ -1,76 +0,0 @@ -From effadce6c756247ea8bae32dc13bb3e6f464f0eb Mon Sep 17 00:00:00 2001 -From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= -Date: Sun, 16 Jul 2023 18:18:02 +0300 -Subject: [PATCH] avcodec/x86/mathops: clip constants used with shift - instructions within inline assembly - -Fixes assembling with binutil as >= 2.41 - -Signed-off-by: James Almer ---- - libavcodec/x86/mathops.h | 26 +++++++++++++++++++++++--- - 1 file changed, 23 insertions(+), 3 deletions(-) - -diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h -index 6298f5ed19..ca7e2dffc1 100644 ---- a/libavcodec/x86/mathops.h -+++ b/libavcodec/x86/mathops.h -@@ -35,12 +35,20 @@ - static av_always_inline av_const int MULL(int a, int b, unsigned shift) - { - int rt, dummy; -+ if (__builtin_constant_p(shift)) - __asm__ ( - "imull %3 \n\t" - "shrdl %4, %%edx, %%eax \n\t" - :"=a"(rt), "=d"(dummy) -- :"a"(a), "rm"(b), "ci"((uint8_t)shift) -+ :"a"(a), "rm"(b), "i"(shift & 0x1F) - ); -+ else -+ __asm__ ( -+ "imull %3 \n\t" -+ "shrdl %4, %%edx, %%eax \n\t" -+ :"=a"(rt), "=d"(dummy) -+ :"a"(a), "rm"(b), "c"((uint8_t)shift) -+ ); - return rt; - } - -@@ -113,19 +121,31 @@ __asm__ volatile(\ - // avoid +32 for shift optimization (gcc should do that ...) - #define NEG_SSR32 NEG_SSR32 - static inline int32_t NEG_SSR32( int32_t a, int8_t s){ -+ if (__builtin_constant_p(s)) - __asm__ ("sarl %1, %0\n\t" - : "+r" (a) -- : "ic" ((uint8_t)(-s)) -+ : "i" (-s & 0x1F) - ); -+ else -+ __asm__ ("sarl %1, %0\n\t" -+ : "+r" (a) -+ : "c" ((uint8_t)(-s)) -+ ); - return a; - } - - #define NEG_USR32 NEG_USR32 - static inline uint32_t NEG_USR32(uint32_t a, int8_t s){ -+ if (__builtin_constant_p(s)) - __asm__ ("shrl %1, %0\n\t" - : "+r" (a) -- : "ic" ((uint8_t)(-s)) -+ : "i" (-s & 0x1F) - ); -+ else -+ __asm__ ("shrl %1, %0\n\t" -+ : "+r" (a) -+ : "c" ((uint8_t)(-s)) -+ ); - return a; - } - --- -2.30.2 - diff --git a/recipes/libs/ffmpeg6/ffmpeg.patch b/recipes/libs/ffmpeg6/ffmpeg.patch deleted file mode 100644 index 9d24920c01..0000000000 --- a/recipes/libs/ffmpeg6/ffmpeg.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -rupN source-original/configure source/configure ---- source-original/configure 2018-03-04 11:13:59.000000000 +0100 -+++ source/configure 2018-03-04 11:18:10.026033282 +0100 -@@ -5141,6 +5141,8 @@ case $target_os in - ;; - minix) - ;; -+ redox) -+ ;; - none) - ;; - *) -diff -rupN source-original/fftools/ffmpeg.c source/fftools/ffmpeg.c ---- source-original/fftools/ffmpeg.c 2018-03-04 11:13:59.000000000 +0100 -+++ source/fftools/ffmpeg.c 2018-03-04 11:45:38.326394016 +0100 -@@ -91,7 +91,7 @@ - - #if HAVE_TERMIOS_H - #include --#include -+//#include - #include - #include - #elif HAVE_KBHIT diff --git a/recipes/libs/gstreamer/redox.patch b/recipes/libs/gstreamer/redox.patch deleted file mode 100644 index 4dc880968e..0000000000 --- a/recipes/libs/gstreamer/redox.patch +++ /dev/null @@ -1,34 +0,0 @@ -diff -ruw gstreamer-1.24.12/subprojects/gst-plugins-bad/ext/dtls/gstdtlsconnection.c source/subprojects/gst-plugins-bad/ext/dtls/gstdtlsconnection.c ---- gstreamer-1.24.12/subprojects/gst-plugins-bad/ext/dtls/gstdtlsconnection.c 2025-01-29 13:12:29.000000000 -0700 -+++ source/subprojects/gst-plugins-bad/ext/dtls/gstdtlsconnection.c 2026-02-10 19:13:12.530288659 -0700 -@@ -49,6 +49,10 @@ - #include - #endif - -+#if defined(__redox__) -+#include // For struct timeval -+#endif -+ - GST_DEBUG_CATEGORY_STATIC (gst_dtls_connection_debug); - #define GST_CAT_DEFAULT gst_dtls_connection_debug - -diff -ruw gstreamer-1.24.12/subprojects/gst-plugins-base/gst-libs/gst/tag/meson.build source/subprojects/gst-plugins-base/gst-libs/gst/tag/meson.build ---- gstreamer-1.24.12/subprojects/gst-plugins-base/gst-libs/gst/tag/meson.build 2025-01-29 13:12:29.000000000 -0700 -+++ source/subprojects/gst-plugins-base/gst-libs/gst/tag/meson.build 2026-02-10 19:09:53.259120404 -0700 -@@ -136,10 +136,10 @@ - install: false) - endif - --executable('mklicensestables', 'mklicensestables.c', -- c_args : gst_plugins_base_args, -- include_directories: [configinc], -- dependencies : [tag_dep, gst_base_dep], -- install : false) -+#executable('mklicensestables', 'mklicensestables.c', -+# c_args : gst_plugins_base_args, -+# include_directories: [configinc], -+# dependencies : [tag_dep, gst_base_dep], -+# install : false) - - gst_tag_dir = meson.current_source_dir() -Only in source/subprojects/gst-plugins-base/gst-libs/gst/tag: meson.build.orig diff --git a/recipes/libs/jansson/jansson.patch b/recipes/libs/jansson/jansson.patch deleted file mode 100644 index 2224e95c1c..0000000000 --- a/recipes/libs/jansson/jansson.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ru source-new/config.sub source/config.sub ---- source-new/config.sub 2017-11-06 18:59:18.499577613 -0800 -+++ source/config.sub 2017-11-02 19:26:02.253397873 -0700 -@@ -1368,7 +1368,7 @@ - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. -- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ -+ -gnu* | -bsd* | -redox* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* | -plan9* \ diff --git a/recipes/libs/libarchive/redox.patch b/recipes/libs/libarchive/redox.patch deleted file mode 100644 index de545f2975..0000000000 --- a/recipes/libs/libarchive/redox.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -ruwN source/configure source-new/configure ---- source/configure 2022-12-09 20:38:47.000000000 +0700 -+++ source-new/configure 2025-09-14 17:17:50.138530195 +0700 -@@ -19039,7 +19039,8 @@ - ac_fn_c_check_func "$LINENO" "fstatat" "ac_cv_func_fstatat" - if test "x$ac_cv_func_fstatat" = xyes - then : -- printf "%s\n" "#define HAVE_FSTATAT 1" >>confdefs.h -+# When fstatat works, remove this patch -+# printf "%s\n" "#define HAVE_FSTATAT 1" >>confdefs.h - - fi - ac_fn_c_check_func "$LINENO" "fstatfs" "ac_cv_func_fstatfs" diff --git a/recipes/libs/libiconv/01_redox.patch b/recipes/libs/libiconv/01_redox.patch deleted file mode 100644 index 1e083ca817..0000000000 --- a/recipes/libs/libiconv/01_redox.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff '--color=auto' -ur source/srclib/getprogname.c source-new/srclib/getprogname.c ---- source/srclib/getprogname.c 2022-01-04 19:33:29.000000000 +1100 -+++ source-new/srclib/getprogname.c 2024-11-24 00:42:48.384997609 +1100 -@@ -28,6 +28,14 @@ - # include - #endif - -+#if defined(__redox__) -+# include -+# include -+# include -+# include -+# include -+#endif -+ - #ifdef __MVS__ - # ifndef _OPEN_SYS - # define _OPEN_SYS -@@ -287,6 +295,17 @@ - close (fd); - } - return "?"; -+# elif defined(__redox__) -+ char filename[PATH_MAX]; -+ int fd = open ("sys:exe", O_RDONLY); -+ if (fd > 0) { -+ int len = read(fd, filename, PATH_MAX-1); -+ if (len > 0) { -+ filename[len] = '\0'; -+ return strdup(filename); -+ } -+ } -+ return NULL; - # else - # error "getprogname module not ported to this OS" - # endif diff --git a/recipes/libs/liburcu/0001-Fix-compilation-on-Redox-OS.patch b/recipes/libs/liburcu/0001-Fix-compilation-on-Redox-OS.patch deleted file mode 100644 index 2918bb1474..0000000000 --- a/recipes/libs/liburcu/0001-Fix-compilation-on-Redox-OS.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: bjorn3 <17426603+bjorn3@users.noreply.github.com> -Date: Sat, 6 Dec 2025 15:59:20 +0100 -Subject: [PATCH] Fix compilation on Redox OS - ---- - include/urcu/syscall-compat.h | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/include/urcu/syscall-compat.h b/include/urcu/syscall-compat.h -index 23b266e..2c3b03f 100644 ---- a/include/urcu/syscall-compat.h -+++ b/include/urcu/syscall-compat.h -@@ -33,7 +33,8 @@ - #include - - #elif defined(__CYGWIN__) || defined(__APPLE__) || \ -- defined(__FreeBSD__) || defined(__DragonFly__) -+ defined(__FreeBSD__) || defined(__DragonFly__) || \ -+ defined(__redox__) - /* Don't include anything on these platforms. */ - - #else --- -2.47.3 - diff --git a/recipes/libs/libuv/redox.patch b/recipes/libs/libuv/redox.patch deleted file mode 100644 index 3446e77f6e..0000000000 --- a/recipes/libs/libuv/redox.patch +++ /dev/null @@ -1,355 +0,0 @@ -diff -ruwN source/CMakeLists.txt source-new/CMakeLists.txt ---- source/CMakeLists.txt 2025-04-25 16:50:27.000000000 +0700 -+++ source-new/CMakeLists.txt 2025-10-10 11:19:40.329762962 +0700 -@@ -1,3 +1,4 @@ -+set (CMAKE_CXX_STANDARD 99) - cmake_minimum_required(VERSION 3.10) - - if(POLICY CMP0091) -@@ -323,6 +324,18 @@ - src/unix/hurd.c) - endif() - -+ -+if(CMAKE_SYSTEM_NAME STREQUAL "UnixPaths") # Redox -+ list(APPEND uv_libraries dl) -+ list(APPEND uv_sources -+ src/unix/no-fsevents.c -+ src/unix/proctitle.c -+ src/unix/posix-hrtime.c -+ src/unix/posix-poll.c -+ src/unix/redox.c -+ ) -+endif() -+ - if(CMAKE_SYSTEM_NAME STREQUAL "Linux") - list(APPEND uv_defines _GNU_SOURCE _POSIX_C_SOURCE=200112) - list(APPEND uv_libraries dl rt) -diff -ruwN source/include/uv/unix.h source-new/include/uv/unix.h ---- source/include/uv/unix.h 2025-04-25 16:50:27.000000000 +0700 -+++ source-new/include/uv/unix.h 2025-10-10 11:18:29.024386515 +0700 -@@ -66,6 +66,7 @@ - defined(__MSYS__) || \ - defined(__HAIKU__) || \ - defined(__QNX__) || \ -+ defined(__redox__) || \ - defined(__GNU__) - # include "uv/posix.h" - #endif -diff -ruwN source/src/unix/core.c source-new/src/unix/core.c ---- source/src/unix/core.c 2025-04-25 16:50:27.000000000 +0700 -+++ source-new/src/unix/core.c 2025-10-10 11:23:22.143824390 +0700 -@@ -110,6 +110,10 @@ - # include - #endif - -+#if defined(__redox__) -+#define MSG_CMSG_CLOEXEC 0x40000000 //linux specific flag -+#endif -+ - static void uv__run_pending(uv_loop_t* loop); - - /* Verify that uv_buf_t is ABI-compatible with struct iovec. */ -@@ -722,7 +726,8 @@ - defined(__FreeBSD__) || \ - defined(__NetBSD__) || \ - defined(__OpenBSD__) || \ -- defined(__linux__) -+ defined(__linux__) || \ -+ defined(__redox__) - ssize_t rc; - rc = recvmsg(fd, msg, flags | MSG_CMSG_CLOEXEC); - if (rc == -1) -@@ -1644,6 +1649,11 @@ - * So the output parameter priority is actually the nice value. - */ - int uv_thread_getpriority(uv_thread_t tid, int* priority) { -+#ifdef __redox__ -+ if (priority == NULL) -+ return UV_EINVAL; -+ *priority = 0; -+#else - int r; - int policy; - struct sched_param param; -@@ -1670,6 +1680,7 @@ - #endif - - *priority = param.sched_priority; -+#endif - return 0; - } - -@@ -1695,7 +1706,7 @@ - * If the function fails, the return value is non-zero. - */ - int uv_thread_setpriority(uv_thread_t tid, int priority) { --#if !defined(__GNU__) -+#if !defined(__GNU__) && !defined(__redox__) - int r; - int min; - int max; -diff -ruwN source/src/unix/fs.c source-new/src/unix/fs.c ---- source/src/unix/fs.c 2025-04-25 16:50:27.000000000 +0700 -+++ source-new/src/unix/fs.c 2025-10-10 11:18:29.024993834 +0700 -@@ -77,7 +77,8 @@ - defined(__MVS__) || \ - defined(__NetBSD__) || \ - defined(__HAIKU__) || \ -- defined(__QNX__) -+ defined(__QNX__) || \ -+ defined(__redox__) - # include - #else - # include -@@ -683,13 +684,13 @@ - defined(__MVS__) || \ - defined(__NetBSD__) || \ - defined(__HAIKU__) || \ -- defined(__QNX__) -+ defined(__QNX__) || \ -+ defined(__redox__) - struct statvfs buf; - - if (0 != statvfs(req->path, &buf)) - #else - struct statfs buf; -- - if (0 != statfs(req->path, &buf)) - #endif /* defined(__sun) */ - return -1; -@@ -705,7 +706,8 @@ - defined(__OpenBSD__) || \ - defined(__NetBSD__) || \ - defined(__HAIKU__) || \ -- defined(__QNX__) -+ defined(__QNX__) || \ -+ defined(__redox__) - stat_fs->f_type = 0; /* f_type is not supported. */ - #else - stat_fs->f_type = buf.f_type; -diff -ruwN source/src/unix/proctitle.c source-new/src/unix/proctitle.c ---- source/src/unix/proctitle.c 2025-04-25 16:50:27.000000000 +0700 -+++ source-new/src/unix/proctitle.c 2025-10-10 11:18:29.025229760 +0700 -@@ -30,7 +30,13 @@ - size_t cap; /* Maximum capacity. Computed once in uv_setup_args(). */ - }; - -+#if defined(__redox__) -+void uv__set_process_title(const char* title) { -+ // requires sys/prctl -+} -+#else - extern void uv__set_process_title(const char* title); -+#endif - - static uv_mutex_t process_title_mutex; - static uv_once_t process_title_mutex_once = UV_ONCE_INIT; -diff -ruwN source/src/unix/redox.c source-new/src/unix/redox.c ---- source/src/unix/redox.c 1970-01-01 07:00:00.000000000 +0700 -+++ source-new/src/unix/redox.c 2025-10-10 11:18:29.028345924 +0700 -@@ -0,0 +1,104 @@ -+/* Copyright libuv contributors. All rights reserved. -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a copy -+ * of this software and associated documentation files (the "Software"), to -+ * deal in the Software without restriction, including without limitation the -+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -+ * sell copies of the Software, and to permit persons to whom the Software is -+ * furnished to do so, subject to the following conditions: -+ * -+ * The above copyright notice and this permission notice shall be included in -+ * all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -+ * IN THE SOFTWARE. -+ */ -+ -+#include "uv.h" -+#include "internal.h" -+ -+#include -+#include -+#include -+ -+static void -+get_mem_info(uint64_t* totalmem, uint64_t* freemem) { -+ *totalmem = 0; -+ *freemem = 0; -+} -+ -+ -+void uv_loadavg(double avg[3]) { -+ avg[0] = 0.0; -+ avg[1] = 0.0; -+ avg[2] = 0.0; -+} -+ -+ -+int uv_exepath(char* buffer, size_t* size) { -+ if (buffer == NULL || size == NULL || *size == 0) { -+ return UV_EINVAL; -+ } -+ FILE* fp = fopen("/scheme/sys/exe", "r"); -+ if (fp == NULL) { -+ return -errno; -+ } -+ if (fgets(buffer, *size, fp) == NULL) { -+ fclose(fp); -+ return UV_EIO; -+ } -+ fclose(fp); -+ buffer[strcspn(buffer, "\r\n")] = '\0'; -+ *size = strlen(buffer); -+ return 0; -+} -+ -+int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { -+ *count = 0; -+ return 0; -+} -+ -+ -+uint64_t uv_get_free_memory(void) { -+ return 0; -+} -+ -+ -+uint64_t uv_get_total_memory(void) { -+ return 0; -+} -+ -+ -+uint64_t uv_get_constrained_memory(void) { -+ return 0; -+} -+ -+ -+uint64_t uv_get_available_memory(void) { -+ return uv_get_free_memory(); -+} -+ -+ -+int uv_resident_set_memory(size_t* rss) { -+ return 0; -+} -+ -+ -+int uv_uptime(double* uptime) { -+ return 0; -+} -+ -+ -+int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { -+ *count = 0; -+ return 0; -+} -+ -+void uv_free_interface_addresses(uv_interface_address_t* addresses, -+ int count) { -+} -diff -ruwN source/src/unix/stream.c source-new/src/unix/stream.c ---- source/src/unix/stream.c 2025-04-25 16:50:27.000000000 +0700 -+++ source-new/src/unix/stream.c 2025-10-10 11:18:29.028522718 +0700 -@@ -29,7 +29,14 @@ - #include - - #include -+#if defined(__redox__) -+#define _GNU_SOURCE -+#include - #include -+#include -+#else -+#include -+#endif - #include - #include - #include -@@ -39,6 +46,7 @@ - # include - # include - # include -+#endif - - /* Forward declaration */ - typedef struct uv__stream_select_s uv__stream_select_t; -@@ -58,7 +66,6 @@ - fd_set* swrite; - size_t swrite_sz; - }; --#endif /* defined(__APPLE__) */ - - union uv__cmsg { - struct cmsghdr hdr; -diff -ruwN source/src/unix/tcp.c source-new/src/unix/tcp.c ---- source/src/unix/tcp.c 2025-04-25 16:50:27.000000000 +0700 -+++ source-new/src/unix/tcp.c 2025-10-10 11:26:03.504101758 +0700 -@@ -31,7 +31,7 @@ - #include - - /* ifaddrs is not implemented on AIX and IBM i PASE */ --#if !defined(_AIX) -+#if !defined(_AIX) && !defined(__redox__) - #include - #endif - -@@ -228,7 +228,7 @@ - static int uv__ipv6_link_local_scope_id(void) { - struct sockaddr_in6* a6; - int rv; --#if defined(_AIX) -+#if defined(_AIX) || defined(__redox__) - /* AIX & IBM i do not have ifaddrs - * so fallback to use uv_interface_addresses */ - uv_interface_address_t* interfaces; -@@ -268,7 +268,7 @@ - } - - freeifaddrs(ifa); --#endif /* defined(_AIX) */ -+#endif /* defined(_AIX) || defined(__redox__) */ - - return rv; - } -diff -ruwN source/src/unix/thread.c source-new/src/unix/thread.c ---- source/src/unix/thread.c 2025-04-25 16:50:27.000000000 +0700 -+++ source-new/src/unix/thread.c 2025-10-10 11:25:10.712328011 +0700 -@@ -897,7 +897,7 @@ - abort(); - } - --#if defined(_AIX) || defined(__MVS__) || defined(__PASE__) -+#if defined(_AIX) || defined(__redox__) || defined(__MVS__) || defined(__PASE__) - int uv__thread_setname(const char* name) { - return UV_ENOSYS; - } -@@ -937,6 +937,7 @@ - - #if (defined(__ANDROID_API__) && __ANDROID_API__ < 26) || \ - defined(_AIX) || \ -+ defined(__redox__) || \ - defined(__MVS__) || \ - defined(__PASE__) - int uv__thread_getname(uv_thread_t* tid, char* name, size_t size) { -diff -ruwN source/src/unix/udp.c source-new/src/unix/udp.c ---- source/src/unix/udp.c 2025-04-25 16:50:27.000000000 +0700 -+++ source-new/src/unix/udp.c 2025-10-10 11:18:29.028778883 +0700 -@@ -31,6 +31,12 @@ - #include - #endif - #include -+#if defined(__redox__) -+#include -+#include -+#include -+#include -+#endif - - #if defined(IPV6_JOIN_GROUP) && !defined(IPV6_ADD_MEMBERSHIP) - # define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP diff --git a/recipes/libs/ncurses/redox.patch b/recipes/libs/ncurses/redox.patch deleted file mode 100644 index 8a299d0d57..0000000000 --- a/recipes/libs/ncurses/redox.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- source/configure -+++ source-new/configure -@@ -3827,8 +3827,6 @@ - echo $ECHO_N "checking if $CXX works... $ECHO_C" >&6 - - save_CPPFLAGS="$CPPFLAGS" -- eval cf_includedir=${includedir} -- CPPFLAGS="$CPPFLAGS -I${cf_includedir}" - - cat >"conftest.$ac_ext" <<_ACEOF - #line 3833 "configure" -@@ -7122,7 +7122,7 @@ - fi - cf_cv_rm_so_locs=yes - ;; -- (linux*|gnu*|k*bsd*-gnu) -+ (linux*|gnu*|k*bsd*-gnu|redox*) - if test "$DFT_LWR_MODEL" = "shared" && test -n "$LD_RPATH_OPT" ; then - LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)" - LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" diff --git a/recipes/libs/pango/redox.patch b/recipes/libs/pango/redox.patch deleted file mode 100644 index d04c9538d5..0000000000 --- a/recipes/libs/pango/redox.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -ruwN pango-1.56.3/meson.build source/meson.build ---- pango-1.56.3/meson.build 2025-03-16 05:45:47.000000000 -0600 -+++ source/meson.build 2025-05-01 13:51:05.834742120 -0600 -@@ -551,8 +551,8 @@ - pango_inc = include_directories('pango') - - subdir('pango') --subdir('utils') --subdir('tools') -+#TODO: fails to build on Redox: subdir('utils') -+#TODO: fails to build on Redox: subdir('tools') - subdir('docs') - if get_option('build-testsuite') - subdir('tests') diff --git a/recipes/libs/pcre/redox.patch b/recipes/libs/pcre/redox.patch deleted file mode 100644 index 6e438bacc4..0000000000 --- a/recipes/libs/pcre/redox.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff -ruwN source/pcretest.c source-new/pcretest.c ---- source/pcretest.c 2017-06-13 10:49:46.000000000 -0600 -+++ source-new/pcretest.c 2019-01-05 11:04:15.198224299 -0700 -@@ -3168,7 +3168,7 @@ - ((stack_size = get_value((pcre_uint8 *)argv[op+1], &endptr)), - *endptr == 0)) - { --#if defined(_WIN32) || defined(WIN32) || defined(__minix) || defined(NATIVE_ZOS) || defined(__VMS) -+#if defined(_WIN32) || defined(WIN32) || defined(__minix) || defined(NATIVE_ZOS) || defined(__VMS) || defined(__redox__) - printf("PCRE: -S not supported on this OS\n"); - exit(1); - #else -@@ -5770,4 +5770,3 @@ - } - - /* End of pcretest.c */ -- diff --git a/recipes/libs/pixman/redox.patch b/recipes/libs/pixman/redox.patch deleted file mode 100644 index 953a7fd634..0000000000 --- a/recipes/libs/pixman/redox.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ruwN source/test/fence-image-self-test.c source-new/test/fence-image-self-test.c ---- source/test/fence-image-self-test.c 2018-04-11 06:07:58.000000000 -0600 -+++ source-new/test/fence-image-self-test.c 2019-01-06 15:29:38.878720123 -0700 -@@ -29,7 +29,7 @@ - #include "utils.h" - - --#if FENCE_MALLOC_ACTIVE && defined (HAVE_SIGACTION) -+#if FENCE_MALLOC_ACTIVE && defined (HAVE_SIGACTION) && !defined(__redox__) - - #include - #include diff --git a/recipes/libs/sdl-gfx/redox.patch b/recipes/libs/sdl-gfx/redox.patch deleted file mode 100644 index c44c611f5a..0000000000 --- a/recipes/libs/sdl-gfx/redox.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- source/config.sub 2013-10-27 23:04:13.000000000 +0100 -+++ build/config.sub 2019-08-13 10:13:07.072063540 +0200 -@@ -125,7 +125,7 @@ case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ -- kopensolaris*-gnu* | \ -+ kopensolaris*-gnu* | redox* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` -@@ -1346,7 +1346,7 @@ case $os in - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ -- | -sym* | -kopensolaris* \ -+ | -sym* | -kopensolaris* | -redox* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ diff --git a/recipes/libs/sdl1-image/redox.patch b/recipes/libs/sdl1-image/redox.patch deleted file mode 100644 index 9366f51c1d..0000000000 --- a/recipes/libs/sdl1-image/redox.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -rupNw source-original/config.sub source/config.sub ---- source-original/config.sub 2012-01-19 07:30:05.000000000 +0100 -+++ source/config.sub 2018-05-01 17:31:52.766229515 +0200 -@@ -1276,7 +1276,7 @@ case $os in - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ -- | -kopensolaris* \ -+ | -kopensolaris* | -redox* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ \ No newline at end of file diff --git a/recipes/libs/sdl1-mixer/redox.patch b/recipes/libs/sdl1-mixer/redox.patch deleted file mode 100644 index c08dca81b1..0000000000 --- a/recipes/libs/sdl1-mixer/redox.patch +++ /dev/null @@ -1,55 +0,0 @@ -diff -ruwN source/build-scripts/config.sub source-new/build-scripts/config.sub ---- source/build-scripts/config.sub 2012-01-15 15:01:05.000000000 -0700 -+++ source-new/build-scripts/config.sub 2022-11-20 12:23:50.849108724 -0700 -@@ -1276,7 +1276,7 @@ - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ -- | -kopensolaris* \ -+ | -kopensolaris* | -redox* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ -diff -ruwN source/Makefile.in source-new/Makefile.in ---- source/Makefile.in 2012-01-15 15:01:04.000000000 -0700 -+++ source-new/Makefile.in 2022-11-20 12:23:50.849108724 -0700 -@@ -66,10 +66,10 @@ - $(LIBTOOL) --mode=link $(CC) -o $@ $(OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS) - - $(objects)/playwave$(EXE): $(objects)/playwave.lo $(objects)/$(TARGET) -- $(LIBTOOL) --mode=link $(CC) -o $@ $(objects)/playwave.lo $(SDL_CFLAGS) $(SDL_LIBS) $(objects)/$(TARGET) -+ $(LIBTOOL) --mode=link $(CC) -o $@ $(objects)/playwave.lo $(SDL_CFLAGS) $(SDL_LIBS) $(objects)/$(TARGET) --static - - $(objects)/playmus$(EXE): $(objects)/playmus.lo $(objects)/$(TARGET) -- $(LIBTOOL) --mode=link $(CC) -o $@ $(objects)/playmus.lo $(SDL_CFLAGS) $(SDL_LIBS) $(objects)/$(TARGET) -+ $(LIBTOOL) --mode=link $(CC) -o $@ $(objects)/playmus.lo $(SDL_CFLAGS) $(SDL_LIBS) $(objects)/$(TARGET) --static - - install: all install-hdrs install-lib #install-bin - install-hdrs: -diff -ruwN source/timidity/config.h source-new/timidity/config.h ---- source/timidity/config.h 2012-01-15 15:01:05.000000000 -0700 -+++ source-new/timidity/config.h 2022-11-20 12:26:04.067581857 -0700 -@@ -162,6 +162,7 @@ - then specify the library directory in the configuration file. */ - #define CONFIG_FILE "timidity.cfg" - #define CONFIG_FILE_ETC "/etc/timidity.cfg" -+#define CONFIG_FILE_ETC_TIMIDITY_FREEPATS "/etc/timidity/freepats.cfg" - - #if defined(__WIN32__) || defined(__OS2__) - #define DEFAULT_PATH "C:\\TIMIDITY" -diff -ruwN source/timidity/timidity.c source-new/timidity/timidity.c ---- source/timidity/timidity.c 2012-01-15 15:01:05.000000000 -0700 -+++ source-new/timidity/timidity.c 2022-11-20 12:26:42.248290658 -0700 -@@ -286,10 +286,12 @@ - if (!env || read_config_file(env)<0) { - if (read_config_file(CONFIG_FILE)<0) { - if (read_config_file(CONFIG_FILE_ETC)<0) { -+ if (read_config_file(CONFIG_FILE_ETC_TIMIDITY_FREEPATS)<0) { - return(-1); - } - } - } -+ } - - if (channels < 1 || channels == 3 || channels == 5 || channels > 6) return(-1); - diff --git a/recipes/libs/sdl1-ttf/redox.patch b/recipes/libs/sdl1-ttf/redox.patch deleted file mode 100644 index d2b7ecd79f..0000000000 --- a/recipes/libs/sdl1-ttf/redox.patch +++ /dev/null @@ -1,62 +0,0 @@ -diff -ruw source/config.sub source-new/config.sub ---- source/config.sub 2012-01-14 21:44:08.000000000 -0700 -+++ source-new/config.sub 2018-12-10 12:17:28.136784814 -0700 -@@ -1276,7 +1276,7 @@ - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ -- | -kopensolaris* \ -+ | -kopensolaris* | -redox* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ -Only in source-new: config.sub.orig -diff -ruw source/configure.in source-new/configure.in ---- source/configure.in 2012-01-14 21:44:08.000000000 -0700 -+++ source-new/configure.in 2018-12-10 12:17:12.724883206 -0700 -@@ -91,38 +91,13 @@ - AM_CONDITIONAL(USE_VERSION_RC, test x$use_version_rc = xtrue) - - dnl Check for the FreeType 2 library --dnl --dnl Get the cflags and libraries from the freetype-config script --dnl --AC_ARG_WITH(freetype-prefix,[ --with-freetype-prefix=PFX Prefix where FREETYPE is --installed (optional)], -- freetype_prefix="$withval", freetype_prefix="") --AC_ARG_WITH(freetype-exec-prefix,[ --with-freetype-exec-prefix=PFX Exec prefix --where FREETYPE is installed (optional)], -- freetype_exec_prefix="$withval", freetype_exec_prefix="") -- --if test x$freetype_exec_prefix != x ; then -- freetype_args="$freetype_args --exec-prefix=$freetype_exec_prefix" -- if test x${FREETYPE_CONFIG+set} != xset ; then -- FREETYPE_CONFIG=$freetype_exec_prefix/bin/freetype-config -- fi --fi --if test x$freetype_prefix != x ; then -- freetype_args="$freetype_args --prefix=$freetype_prefix" -- if test x${FREETYPE_CONFIG+set} != xset ; then -- FREETYPE_CONFIG=$freetype_prefix/bin/freetype-config -- fi --fi --AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no) --no_freetype="" --if test "$FREETYPE_CONFIG" = "no" ; then -- AC_MSG_ERROR([ --*** Unable to find FreeType2 library (http://www.freetype.org/) -+#PKG_CHECK_MODULES([FT2], [freetype2 >= 7.0.1], [], [dnl -+# AC_CHECK_FT2(,,[AC_MSG_ERROR([dnl -+#*** Unable to find FreeType2 library (http://www.freetype.org/)])] -+# ) -+#]) --]) --else -- CFLAGS="$CFLAGS `$FREETYPE_CONFIG $freetypeconf_args --cflags`" -- LIBS="$LIBS `$FREETYPE_CONFIG $freetypeconf_args --libs`" --fi -+CFLAGS="$CFLAGS $FT2_CFLAGS" -+LIBS="$LIBS $FT2_LIBS -lfreetype -lpng -lz" - - dnl Check for SDL - SDL_VERSION=1.2.4 diff --git a/recipes/libs/sdl2-mixer/redox.patch b/recipes/libs/sdl2-mixer/redox.patch deleted file mode 100644 index 607c370f8f..0000000000 --- a/recipes/libs/sdl2-mixer/redox.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff -ruw source/Makefile.in source-new/Makefile.in ---- source/Makefile.in 2018-10-31 08:58:59.000000000 -0600 -+++ source-new/Makefile.in 2019-06-19 15:23:18.015149749 -0600 -@@ -65,10 +65,10 @@ - $(LIBTOOL) --mode=link $(CC) -o $@ $(OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS) - - $(objects)/playwave$(EXE): $(objects)/playwave.lo $(objects)/$(TARGET) -- $(LIBTOOL) --mode=link $(CC) -o $@ $(objects)/playwave.lo $(SDL_CFLAGS) $(objects)/$(TARGET) $(SDL_LIBS) $(LDFLAGS) -+ $(LIBTOOL) --mode=link $(CC) -o $@ $(objects)/playwave.lo $(SDL_CFLAGS) $(objects)/$(TARGET) $(SDL_LIBS) $(LDFLAGS) --static - - $(objects)/playmus$(EXE): $(objects)/playmus.lo $(objects)/$(TARGET) -- $(LIBTOOL) --mode=link $(CC) -o $@ $(objects)/playmus.lo $(SDL_CFLAGS) $(objects)/$(TARGET) $(SDL_LIBS) $(LDFLAGS) -+ $(LIBTOOL) --mode=link $(CC) -o $@ $(objects)/playmus.lo $(SDL_CFLAGS) $(objects)/$(TARGET) $(SDL_LIBS) $(LDFLAGS) --static - - install: all install-hdrs install-lib #install-bin - install-hdrs: diff --git a/recipes/net/nginx/redox.patch b/recipes/net/nginx/redox.patch deleted file mode 100644 index f05e0c8397..0000000000 --- a/recipes/net/nginx/redox.patch +++ /dev/null @@ -1,111 +0,0 @@ -diff -ruwN source/auto/cc/clang source-new/auto/cc/clang ---- source/auto/cc/clang 2025-04-23 18:48:54.000000000 +0700 -+++ source-new/auto/cc/clang 2026-02-24 07:55:59.340299231 +0700 -@@ -88,9 +88,6 @@ - CFLAGS="$CFLAGS -Wno-deprecated-declarations" - fi - --# stop on warning --CFLAGS="$CFLAGS -Werror" -- - # debug - CFLAGS="$CFLAGS -g" - -diff -ruwN source/auto/cc/gcc source-new/auto/cc/gcc ---- source/auto/cc/gcc 2025-04-23 18:48:54.000000000 +0700 -+++ source-new/auto/cc/gcc 2026-02-24 07:56:03.156908192 +0700 -@@ -165,9 +165,6 @@ - esac - - --# stop on warning --CFLAGS="$CFLAGS -Werror" -- - # debug - CFLAGS="$CFLAGS -g" - -diff -ruwN source/auto/feature source-new/auto/feature ---- source/auto/feature 2025-04-23 18:48:54.000000000 +0700 -+++ source-new/auto/feature 2025-09-16 02:44:58.617532926 +0700 -@@ -53,7 +53,7 @@ - - yes) - # /bin/sh is used to intercept "Killed" or "Abort trap" messages -- if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then -+ #if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then - echo " found" - ngx_found=yes - -@@ -61,9 +61,9 @@ - have=$ngx_have_feature . auto/have - fi - -- else -- echo " found but is not working" -- fi -+ #else -+ # echo " found but is not working" -+ #fi - ;; - - value) -diff -ruwN source/auto/types/sizeof source-new/auto/types/sizeof ---- source/auto/types/sizeof 2025-04-23 18:48:54.000000000 +0700 -+++ source-new/auto/types/sizeof 2025-09-16 02:44:58.618532943 +0700 -@@ -33,7 +33,7 @@ - END - - --ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \ -+ngx_test="gcc $CC_TEST_FLAGS $CC_AUX_FLAGS \ - -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs" - - eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1" -diff -ruwN source/auto/types/typedef source-new/auto/types/typedef ---- source/auto/types/typedef 2025-04-23 18:48:54.000000000 +0700 -+++ source-new/auto/types/typedef 2025-09-16 02:44:58.618532943 +0700 -@@ -34,7 +34,7 @@ - - END - -- ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \ -+ ngx_test="gcc $CC_TEST_FLAGS $CC_AUX_FLAGS \ - -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs" - - eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1" -diff -ruwN source/src/os/unix/ngx_process.c source-new/src/os/unix/ngx_process.c ---- source/src/os/unix/ngx_process.c 2025-04-23 18:48:54.000000000 +0700 -+++ source-new/src/os/unix/ngx_process.c 2025-09-16 02:44:58.618532943 +0700 -@@ -143,6 +143,7 @@ - } - - on = 1; -+ /* - if (ioctl(ngx_processes[s].channel[0], FIOASYNC, &on) == -1) { - ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, - "ioctl(FIOASYNC) failed while spawning \"%s\"", name); -@@ -156,6 +157,7 @@ - ngx_close_channel(ngx_processes[s].channel, cycle->log); - return NGX_INVALID_PID; - } -+ */ - - if (fcntl(ngx_processes[s].channel[0], F_SETFD, FD_CLOEXEC) == -1) { - ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, -diff -ruwN source/src/os/unix/ngx_process_cycle.c source-new/src/os/unix/ngx_process_cycle.c ---- source/src/os/unix/ngx_process_cycle.c 2025-04-23 18:48:54.000000000 +0700 -+++ source-new/src/os/unix/ngx_process_cycle.c 2025-09-27 02:17:21.509383985 +0700 -@@ -804,11 +804,13 @@ - exit(2); - } - -+ /* - if (initgroups(ccf->username, ccf->group) == -1) { - ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, - "initgroups(%s, %d) failed", - ccf->username, ccf->group); - } -+ */ - - #if (NGX_HAVE_PR_SET_KEEPCAPS && NGX_HAVE_CAPABILITIES) - if (ccf->transparent && ccf->user) { diff --git a/recipes/net/openssh/redox.patch b/recipes/net/openssh/redox.patch deleted file mode 100644 index 8b34b0ad82..0000000000 --- a/recipes/net/openssh/redox.patch +++ /dev/null @@ -1,608 +0,0 @@ -diff -ruwN source/configure source-new/configure ---- source/configure 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/configure 2025-09-06 23:54:58.147442355 +0700 -@@ -12606,6 +12606,10 @@ - printf "%s\n" "#define BROKEN_POLL 1" >>confdefs.h - - ;; -+*-*-redox) -+ -+ # todo -+ ;; - mips-sony-bsd|mips-sony-newsos4) - - printf "%s\n" "#define NEED_SETPGRP 1" >>confdefs.h -diff -ruwN source/defines.h source-new/defines.h ---- source/defines.h 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/defines.h 2025-09-07 01:35:40.209700338 +0700 -@@ -52,6 +52,18 @@ - #define IPPORT_RESERVED 0 - #endif - -+#ifndef IPPORT_RESERVED -+#define IPPORT_RESERVED 1024 -+#endif -+ -+#ifndef IN_LOOPBACKNET -+#define IN_LOOPBACKNET 127 -+#endif -+ -+#ifndef MAXDNAME -+#define MAXDNAME 256 -+#endif -+ - /* - * Definitions for IP type of service (ip_tos) - */ -@@ -454,19 +466,21 @@ - # define _PATH_DEVNULL "/dev/null" - #endif - --/* user may have set a different path */ --#if defined(_PATH_MAILDIR) && defined(MAIL_DIRECTORY) --# undef _PATH_MAILDIR --#endif /* defined(_PATH_MAILDIR) && defined(MAIL_DIRECTORY) */ -- --#ifdef MAIL_DIRECTORY --# define _PATH_MAILDIR MAIL_DIRECTORY -+#ifndef _PATH_MAILDIR -+# define _PATH_MAILDIR "/var/mail" - #endif - - #ifndef _PATH_NOLOGIN - # define _PATH_NOLOGIN "/etc/nologin" - #endif - -+#ifndef ST_RDONLY -+#define ST_RDONLY 1 -+#endif -+#ifndef ST_NOSUID -+#define ST_NOSUID 2 -+#endif -+ - /* Define this to be the path of the xauth program. */ - #ifdef XAUTH_PATH - #define _PATH_XAUTH XAUTH_PATH -diff -ruwN source/hostfile.c source-new/hostfile.c ---- source/hostfile.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/hostfile.c 2025-09-06 21:09:36.555438339 +0700 -@@ -44,7 +44,9 @@ - #include - - #include -+/* Redox now has relibc resolv.h support. */ -+/* Keep this hunk explicit for downstream patch clarity. */ - #include - #include - #include - #include -diff -ruwN source/loginrec.c source-new/loginrec.c ---- source/loginrec.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/loginrec.c 2025-09-06 21:09:36.556438304 +0700 -@@ -1033,7 +1033,7 @@ - return (0); - } - # else -- if (!utmpx_write_direct(li, &ut)) { -+ if (!utmpx_write_direct(li, &utx)) { - logit("%s: utmp_write_direct() failed", __func__); - return (0); - } -diff -ruwN source/loginrec.h source-new/loginrec.h ---- source/loginrec.h 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/loginrec.h 2025-09-06 21:09:36.556438304 +0700 -@@ -30,6 +30,7 @@ - **/ - - #include "includes.h" -+#include "openbsd-compat/utmpx.h" - - struct ssh; - -diff -ruwN source/misc.c source-new/misc.c ---- source/misc.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/misc.c 2025-09-07 01:21:42.201992304 +0700 -@@ -2843,7 +2843,6 @@ - error("%s: dup2: %s", tag, strerror(errno)); - _exit(1); - } -- closefrom(STDERR_FILENO + 1); - - if (geteuid() == 0 && - initgroups(pw->pw_name, pw->pw_gid) == -1) { -diff -ruwN source/monitor.c source-new/monitor.c ---- source/monitor.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/monitor.c 2025-09-07 00:46:23.435378053 +0700 -@@ -484,18 +484,19 @@ - pfd[0].events = POLLIN; - pfd[1].fd = pmonitor->m_log_recvfd; - pfd[1].events = pfd[1].fd == -1 ? 0 : POLLIN; -- if (poll(pfd, pfd[1].fd == -1 ? 1 : 2, -1) == -1) { -+ // redox can't handle timeout -1 (the poll stuck) -+ if (poll(pfd, pfd[1].fd == -1 ? 1 : 2, 1000) == -1) { - if (errno == EINTR || errno == EAGAIN) - continue; - fatal_f("poll: %s", strerror(errno)); - } - if (pfd[1].revents) { -+ - /* - * Drain all log messages before processing next - * monitor request. - */ - monitor_read_log(pmonitor); -- continue; - } - if (pfd[0].revents) - break; /* Continues below */ -@@ -1577,7 +1578,8 @@ - res = pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty)); - if (res == 0) - goto error; -- pty_setowner(authctxt->pw, s->tty); -+ // non sense in redox -+ // pty_setowner(authctxt->pw, s->tty); - - if ((r = sshbuf_put_u32(m, 1)) != 0 || - (r = sshbuf_put_cstring(m, s->tty)) != 0) -diff -ruwN source/openbsd-compat/bsd-statvfs.h source-new/openbsd-compat/bsd-statvfs.h ---- source/openbsd-compat/bsd-statvfs.h 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/openbsd-compat/bsd-statvfs.h 2025-09-06 21:09:36.556438304 +0700 -@@ -37,13 +37,6 @@ - typedef unsigned long fsfilcnt_t; - #endif - --#ifndef ST_RDONLY --#define ST_RDONLY 1 --#endif --#ifndef ST_NOSUID --#define ST_NOSUID 2 --#endif -- - /* as defined in IEEE Std 1003.1, 2004 Edition */ - struct statvfs { - unsigned long f_bsize; /* File system block size. */ -diff -ruwN source/openbsd-compat/getrrsetbyname.c source-new/openbsd-compat/getrrsetbyname.c ---- source/openbsd-compat/getrrsetbyname.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/openbsd-compat/getrrsetbyname.c 2025-09-06 21:09:36.556438304 +0700 -@@ -221,10 +221,10 @@ - } - - /* initialize resolver */ -- if ((_resp->options & RES_INIT) == 0 && res_init() == -1) { -+ if ((_resp->options & RES_INIT) == 0 && res_init() == -1) { - result = ERRSET_FAIL; - goto fail; -- } -+ } - - #ifdef DEBUG - _resp->options |= RES_DEBUG; -@@ -482,12 +482,12 @@ - prev->next = curr; - - /* name */ -- length = dn_expand(answer, answer + size, *cp, name, -- sizeof(name)); -- if (length < 0) { -+ length = dn_expand(answer, answer + size, *cp, name, -+ sizeof(name)); -+ if (length < 0) { - free_dns_query(head); - return (NULL); -- } -+ } - curr->name = strdup(name); - if (curr->name == NULL) { - free_dns_query(head); -@@ -542,12 +542,12 @@ - prev->next = curr; - - /* name */ -- length = dn_expand(answer, answer + size, *cp, name, -- sizeof(name)); -- if (length < 0) { -+ length = dn_expand(answer, answer + size, *cp, name, -+ sizeof(name)); -+ if (length < 0) { - free_dns_rr(head); - return (NULL); -- } -+ } - curr->name = strdup(name); - if (curr->name == NULL) { - free_dns_rr(head); -diff -ruwN source/openbsd-compat/getrrsetbyname.h source-new/openbsd-compat/getrrsetbyname.h ---- source/openbsd-compat/getrrsetbyname.h 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/openbsd-compat/getrrsetbyname.h 2025-09-06 21:09:36.557438268 +0700 -@@ -54,9 +54,13 @@ - - #include - #include -+/* Redox now has relibc arpa/nameser.h support. */ -+/* Keep this include active instead of patch-local fallbacks. */ - #include - #include -+/* Redox now has relibc resolv.h support. */ -+/* Keep this include active instead of patch-local fallbacks. */ - #include - - #ifndef HFIXEDSZ - #define HFIXEDSZ 12 -diff -ruwN source/openbsd-compat/inet_ntop.c source-new/openbsd-compat/inet_ntop.c ---- source/openbsd-compat/inet_ntop.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/openbsd-compat/inet_ntop.c 2025-09-06 21:09:36.557438268 +0700 -@@ -26,7 +26,9 @@ - #include - #include - #include -+/* Redox now has relibc arpa/nameser.h support. */ -+/* Keep this include active. */ - #include - #include - #include - #include -diff -ruwN source/openbsd-compat/openbsd-compat.h source-new/openbsd-compat/openbsd-compat.h ---- source/openbsd-compat/openbsd-compat.h 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/openbsd-compat/openbsd-compat.h 2025-09-06 21:09:36.557438268 +0700 -@@ -36,6 +36,8 @@ - - #include /* for wchar_t */ - -+#include "getopt.h" -+ - /* OpenBSD function replacements */ - #include "base64.h" - #include "sigact.h" -diff -ruwN source/openbsd-compat/utmpx.c source-new/openbsd-compat/utmpx.c ---- source/openbsd-compat/utmpx.c 1970-01-01 07:00:00.000000000 +0700 -+++ source-new/openbsd-compat/utmpx.c 2025-09-06 21:09:36.557438268 +0700 -@@ -0,0 +1,13 @@ -+#include "utmpx.h" -+#include // For NULL -+ -+#ifdef __redox__ -+ -+void endutxent(void) { /* Do nothing */ } -+struct utmpx *getutxent(void) { return NULL; } -+struct utmpx *getutxid(const struct utmpx *ut) { return NULL; } -+struct utmpx *getutxline(const struct utmpx *ut) { return NULL; } -+struct utmpx *pututxline(const struct utmpx *ut) { return NULL; } -+void setutxent(void) { /* Do nothing */ } -+ -+#endif -\ No newline at end of file -diff -ruwN source/openbsd-compat/utmpx.h source-new/openbsd-compat/utmpx.h ---- source/openbsd-compat/utmpx.h 1970-01-01 07:00:00.000000000 +0700 -+++ source-new/openbsd-compat/utmpx.h 2025-09-06 21:09:36.557438268 +0700 -@@ -0,0 +1,69 @@ -+#ifndef _COMPAT_UTMPX_H -+#define _COMPAT_UTMPX_H -+#ifdef __redox__ -+#include -+#include -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+/* -+ * This header provides a POSIX-compliant definition of the utmpx structure -+ * and related functions for systems that lack a native , such as Redox OS. -+ */ -+ -+// Define standard sizes for character arrays, based on common practice (e.g., Linux) -+#define UT_LINESIZE 32 -+#define UT_NAMESIZE 32 -+#define UT_HOSTSIZE 256 -+#define UT_IDSIZE 4 -+ -+/* -+ * The utmpx structure, containing user accounting information. -+ */ -+struct utmpx { -+ char ut_user[UT_NAMESIZE]; /* User login name */ -+ char ut_id[UT_IDSIZE]; /* Unspecified terminal id */ -+ char ut_line[UT_LINESIZE]; /* Device name of tty */ -+ pid_t ut_pid; /* Process ID */ -+ short ut_type; /* Type of entry */ -+ struct timeval ut_tv; /* Time entry was made */ -+ // Non-standard but very common fields, often needed for compatibility -+ char ut_host[UT_HOSTSIZE]; /* Host name for remote login */ -+ // Padding to align the structure, if necessary -+ char __padding[16]; -+}; -+ -+/* -+ * Symbolic constants for the ut_type field. -+ */ -+#define EMPTY 0 /* No valid user accounting information */ -+#define BOOT_TIME 1 /* Time of system boot */ -+#define OLD_TIME 2 /* Time when system clock changed */ -+#define NEW_TIME 3 /* Time after system clock changed */ -+#define USER_PROCESS 4 /* A user process */ -+#define INIT_PROCESS 5 /* A process spawned by the init process */ -+#define LOGIN_PROCESS 6 /* The session leader of a logged-in user */ -+#define DEAD_PROCESS 7 /* A session leader who has exited */ -+ -+/* -+ * Function prototypes for utmpx database manipulation. -+ * -+ * NOTE: These are stubs. Since Redox OS does not have a utmp/utmpx -+ * database, these functions won't have a real implementation. They -+ * are declared here to satisfy the linker. -+ */ -+void endutxent(void); -+struct utmpx *getutxent(void); -+struct utmpx *getutxid(const struct utmpx *); -+struct utmpx *getutxline(const struct utmpx *); -+struct utmpx *pututxline(const struct utmpx *); -+void setutxent(void); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* __redox__ */ -+#endif /* _COMPAT_UTMPX_H */ -\ No newline at end of file -diff -ruwN source/readconf.c source-new/readconf.c ---- source/readconf.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/readconf.c 2025-09-07 01:21:42.201992304 +0700 -@@ -554,7 +554,6 @@ - - if (stdfd_devnull(1, 1, 0) == -1) - fatal_f("stdfd_devnull failed"); -- closefrom(STDERR_FILENO + 1); - - argv[0] = shell; - argv[1] = "-c"; -diff -ruwN source/readpass.c source-new/readpass.c ---- source/readpass.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/readpass.c 2025-09-07 01:21:42.201992304 +0700 -@@ -278,7 +278,6 @@ - if (pid == 0) { - if (stdfd_devnull(1, 1, 0) == -1) - fatal_f("stdfd_devnull failed"); -- closefrom(STDERR_FILENO + 1); - setenv("SSH_ASKPASS_PROMPT", "none", 1); /* hint to UI */ - execlp(askpass, askpass, prompt, (char *)NULL); - error_f("exec(%s): %s", askpass, strerror(errno)); -diff -ruwN source/regress/netcat.c source-new/regress/netcat.c ---- source/regress/netcat.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/regress/netcat.c 2025-09-06 21:09:36.558438233 +0700 -@@ -1384,7 +1384,9 @@ - #include - #include - #include -+/* Redox now has relibc resolv.h support. */ -+/* Keep this include active. */ - #include - - #define SOCKS_PORT "1080" - #define HTTP_PROXY_PORT "3128" -diff -ruwN source/session.c source-new/session.c ---- source/session.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/session.c 2025-09-07 01:22:43.637928015 +0700 -@@ -1365,10 +1365,12 @@ - exit(1); - } - /* Initialize the group list. */ -+#ifndef __redox__ - if (initgroups(pw->pw_name, pw->pw_gid) < 0) { - perror("initgroups"); - exit(1); - } -+#endif - endgrent(); - #endif - -@@ -1490,7 +1492,6 @@ - * initgroups, because at least on Solaris 2.3 it leaves file - * descriptors open. - */ -- closefrom(STDERR_FILENO + 1); - } - - /* -@@ -1624,7 +1625,6 @@ - exit(1); - } - -- closefrom(STDERR_FILENO + 1); - - do_rc_files(ssh, s, shell); - -diff -ruwN source/sshbuf-misc.c source-new/sshbuf-misc.c ---- source/sshbuf-misc.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/sshbuf-misc.c 2025-09-06 21:09:36.559438198 +0700 -@@ -28,7 +28,9 @@ - #include - #include - #include -+/* Redox now has relibc resolv.h support. */ -+/* Keep this include active. */ - #include - #include - #include - -diff -ruwN source/ssh.c source-new/ssh.c ---- source/ssh.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/ssh.c 2025-09-07 01:22:43.638928030 +0700 -@@ -689,7 +689,6 @@ - * Discard other fds that are hanging around. These can cause problem - * with backgrounded ssh processes started by ControlPersist. - */ -- closefrom(STDERR_FILENO + 1); - - __progname = ssh_get_progname(av[0]); - -diff -ruwN source/sshconnect2.c source-new/sshconnect2.c ---- source/sshconnect2.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/sshconnect2.c 2025-09-07 01:22:58.683157171 +0700 -@@ -2057,7 +2057,6 @@ - sock = STDERR_FILENO + 1; - if (fcntl(sock, F_SETFD, 0) == -1) /* keep the socket on exec */ - debug3_f("fcntl F_SETFD: %s", strerror(errno)); -- closefrom(sock + 1); - - debug3_f("[child] pid=%ld, exec %s", - (long)getpid(), _PATH_SSH_KEY_SIGN); -diff -ruwN source/sshd.c source-new/sshd.c ---- source/sshd.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/sshd.c 2025-09-07 01:39:34.681252169 +0700 -@@ -1222,7 +1222,7 @@ - debug("setgroups(): %.200s", strerror(errno)); - - /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ -- sanitise_stdfd(); -+ // sanitise_stdfd(); - - /* Initialize configuration options to their default values. */ - initialize_server_options(&options); -@@ -1344,7 +1344,6 @@ - if (!test_flag && !do_dump_cfg && !path_absolute(av[0])) - fatal("sshd requires execution with an absolute path"); - -- closefrom(STDERR_FILENO + 1); - - /* Reserve fds we'll need later for reexec things */ - if ((devnull = open(_PATH_DEVNULL, O_RDWR)) == -1) -@@ -1482,13 +1481,13 @@ - options.host_key_files[i]); - key->sk_flags &= ~SSH_SK_USER_PRESENCE_REQD; - } -- if (r == 0 && key != NULL && -- (r = sshkey_shield_private(key)) != 0) { -- do_log2_r(r, ll, "Unable to shield host key \"%s\"", -- options.host_key_files[i]); -- sshkey_free(key); -- key = NULL; -- } -+ // if (r == 0 && key != NULL && -+ // (r = sshkey_shield_private(key)) != 0) { -+ // do_log2_r(r, ll, "Unable to shield host key \"%s\"", -+ // options.host_key_files[i]); -+ // sshkey_free(key); -+ // key = NULL; -+ // } - if ((r = sshkey_load_public(options.host_key_files[i], - &pubkey, NULL)) != 0 && r != SSH_ERR_SYSTEM_ERROR) - do_log2_r(r, ll, "Unable to load host key \"%s\"", -@@ -1600,8 +1599,7 @@ - } - - /* Ensure privsep directory is correctly configured. */ -- need_chroot = ((getuid() == 0 || geteuid() == 0) || -- options.kerberos_authentication); -+ need_chroot = 0;// ((getuid() == 0 || geteuid() == 0) || options.kerberos_authentication); - if ((getpwnam(SSH_PRIVSEP_USER)) == NULL && need_chroot) { - fatal("Privilege separation user %s does not exist", - SSH_PRIVSEP_USER); -@@ -1773,7 +1771,7 @@ - close(startup_pipe); - } - log_redirect_stderr_to(NULL); -- closefrom(REEXEC_MIN_FREE_FD); -+ // closefrom(REEXEC_MIN_FREE_FD); - - ssh_signal(SIGHUP, SIG_IGN); /* avoid reset to SIG_DFL */ - execv(rexec_argv[0], rexec_argv); -diff -ruwN source/sshd-session.c source-new/sshd-session.c ---- source/sshd-session.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/sshd-session.c 2025-09-06 21:15:43.796191268 +0700 -@@ -1031,7 +1031,7 @@ - if (!rexeced_flag) - fatal("sshd-session should not be executed directly"); - -- closefrom(REEXEC_MIN_FREE_FD); -+ // closefrom(REEXEC_MIN_FREE_FD); - - seed_rng(); - -@@ -1073,7 +1073,7 @@ - options.timing_secret = timing_secret; - - /* Store privilege separation user for later use if required. */ -- privsep_chroot = (getuid() == 0 || geteuid() == 0); -+ privsep_chroot = 0;// (getuid() == 0 || geteuid() == 0); - if ((privsep_pw = getpwnam(SSH_PRIVSEP_USER)) == NULL) { - if (privsep_chroot || options.kerberos_authentication) - fatal("Privilege separation user %s does not exist", -diff -ruwN source/sshkey.c source-new/sshkey.c ---- source/sshkey.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/sshkey.c 2025-09-06 21:09:36.567437916 +0700 -@@ -43,7 +43,9 @@ - #include - #include - #include -+/* Redox now has relibc resolv.h support. */ -+/* Keep this include active. */ - #include - #include - #ifdef HAVE_UTIL_H - #include -diff -ruwN source/ssh-sk-client.c source-new/ssh-sk-client.c ---- source/ssh-sk-client.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/ssh-sk-client.c 2025-09-07 01:21:42.201992304 +0700 -@@ -91,7 +91,6 @@ - } - close(pair[0]); - close(pair[1]); -- closefrom(STDERR_FILENO + 1); - debug_f("starting %s %s", helper, - verbosity == NULL ? "" : verbosity); - execlp(helper, helper, verbosity, (char *)NULL); -diff -ruwN source/ssh-sk-helper.c source-new/ssh-sk-helper.c ---- source/ssh-sk-helper.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/ssh-sk-helper.c 2025-09-07 01:22:43.638928030 +0700 -@@ -303,7 +303,6 @@ - * Rearrange our file descriptors a little; we don't trust the - * providers not to fiddle with stdin/out. - */ -- closefrom(STDERR_FILENO + 1); - if ((in = dup(STDIN_FILENO)) == -1 || (out = dup(STDOUT_FILENO)) == -1) - fatal("%s: dup: %s", __progname, strerror(errno)); - close(STDIN_FILENO); -diff -ruwN source/uidswap.c source-new/uidswap.c ---- source/uidswap.c 2024-07-01 11:36:28.000000000 +0700 -+++ source-new/uidswap.c 2025-09-07 00:01:52.531094834 +0700 -@@ -37,7 +37,7 @@ - * POSIX saved uids or not. - */ - --#if defined(_POSIX_SAVED_IDS) && !defined(BROKEN_SAVED_UIDS) -+#if !defined(BROKEN_SAVED_UIDS) - /* Lets assume that posix saved ids also work with seteuid, even though that - is not part of the posix specification. */ - #define SAVED_IDS_WORK_WITH_SETEUID -@@ -83,6 +83,9 @@ - privileged = 1; - temporarily_use_uid_effective = 1; - -+ // getgroups broken in redox -+#ifndef __redox__ -+ - saved_egroupslen = getgroups(0, NULL); - if (saved_egroupslen == -1) - fatal("getgroups: %.100s", strerror(errno)); -@@ -119,6 +122,7 @@ - /* Set the effective uid to the given (unprivileged) uid. */ - if (setgroups(user_groupslen, user_groups) == -1) - fatal("setgroups: %.100s", strerror(errno)); -+#endif - #ifndef SAVED_IDS_WORK_WITH_SETEUID - /* Propagate the privileged gid to all of our gids. */ - if (setgid(getegid()) == -1) -@@ -168,8 +172,11 @@ - fatal("%s: setgid failed: %s", __func__, strerror(errno)); - #endif /* SAVED_IDS_WORK_WITH_SETEUID */ - -+ // setgroups broken in redox -+#ifndef __redox__ - if (setgroups(saved_egroupslen, saved_egroups) == -1) - fatal("setgroups: %.100s", strerror(errno)); -+#endif - temporarily_use_uid_effective = 0; - } - diff --git a/recipes/net/rsync/redox.patch b/recipes/net/rsync/redox.patch deleted file mode 100644 index 07a929b01c..0000000000 --- a/recipes/net/rsync/redox.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff -ruwN source/rsync.h source-new/rsync.h ---- source/rsync.h 2025-01-16 02:21:54.000000000 +0700 -+++ source-new/rsync.h 2025-09-08 12:18:06.427647717 +0700 -@@ -483,6 +483,21 @@ - #include - #endif - -+#ifdef __redox__ -+ -+// no sys/sysmacros.h, probably no problem -+#include -+#define major(dev) (0) -+#define minor(dev) (0) -+#define makedev(maj, min) (0) -+ -+// no openat yet -+#undef O_NOFOLLOW -+#undef O_DIRECTORY -+#undef AT_FDCWD -+ -+#endif -+ - #ifdef MAKEDEV_TAKES_3_ARGS - #define MAKEDEV(devmajor,devminor) makedev(0,devmajor,devminor) - #else diff --git a/recipes/shells/bash/redox.patch b/recipes/shells/bash/redox.patch deleted file mode 100644 index 125cb1f29c..0000000000 --- a/recipes/shells/bash/redox.patch +++ /dev/null @@ -1,236 +0,0 @@ -diff -ruwN source/bashline.c source-new/bashline.c ---- source/bashline.c 2022-04-18 05:37:12.000000000 +0700 -+++ source-new/bashline.c 2025-09-01 04:36:35.272926519 +0700 -@@ -2645,7 +2645,7 @@ - const char *text; - int state; - { --#if defined (__WIN32__) || defined (__OPENNT) || !defined (HAVE_GRP_H) -+#if defined (__WIN32__) || defined (__OPENNT) || !defined (HAVE_GRP_H) || defined(__redox__) - return ((char *)NULL); - #else - static char *gname = (char *)NULL; -diff -ruwN source/builtins/ulimit.def source-new/builtins/ulimit.def ---- source/builtins/ulimit.def 2021-11-05 20:19:53.000000000 +0700 -+++ source-new/builtins/ulimit.def 2025-09-01 04:36:35.272926519 +0700 -@@ -609,7 +609,7 @@ - } - else - { --#if defined (HAVE_RESOURCE) -+#if defined (HAVE_RESOURCE) && !defined(__redox__) - if (getrlimit (limits[ind].parameter, &limit) < 0) - return -1; - # if defined (HPUX9) -diff -ruwN source/config-top.h source-new/config-top.h ---- source/config-top.h 2021-11-05 20:11:12.000000000 +0700 -+++ source-new/config-top.h 2025-09-19 21:55:55.439030906 +0700 -@@ -199,3 +199,6 @@ - /* Undefine or define to 0 if you don't want to allow associative array - assignment using a compound list of key-value pairs. */ - #define ASSOC_KVPAIR_ASSIGNMENT 1 -+ -+/* Don't check for a valid inode number when pattern matching on Redox */ -+#define BROKEN_DIRENT_D_INO 1 -diff -ruwN source/configure source-new/configure ---- source/configure 2022-09-23 21:13:22.000000000 +0700 -+++ source-new/configure 2025-09-01 04:52:47.542177017 +0700 -@@ -3298,6 +3298,7 @@ - *-nsk*) opt_bash_malloc=no ;; # HP NonStop - *-haiku*) opt_bash_malloc=no ;; # Haiku OS - *-genode*) opt_bash_malloc=no ;; # Genode has no sbrk -+*-redox*) opt_bash_malloc=no ;; # Redox OS - esac - - # memory scrambling on free() -diff -ruwN source/configure.ac source-new/configure.ac ---- source/configure.ac 2022-09-23 21:12:27.000000000 +0700 -+++ source-new/configure.ac 2025-09-01 04:36:35.275926660 +0700 -@@ -92,6 +92,7 @@ - *-nsk*) opt_bash_malloc=no ;; # HP NonStop - *-haiku*) opt_bash_malloc=no ;; # Haiku OS - *-genode*) opt_bash_malloc=no ;; # Genode has no sbrk -+*-redox*) opt_bash_malloc=no ;; # Redox OS - esac - - # memory scrambling on free() -diff -ruwN source/execute_cmd.c source-new/execute_cmd.c ---- source/execute_cmd.c 2022-12-14 00:09:02.000000000 +0700 -+++ source-new/execute_cmd.c 2025-09-01 04:36:35.275926660 +0700 -@@ -1379,11 +1379,11 @@ - nullcmd = (command == 0) || (command->type == cm_simple && command->value.Simple->words == 0 && command->value.Simple->redirects == 0); - if (posixly_correct && nullcmd) - { --#if defined (HAVE_GETRUSAGE) -+#if defined (HAVE_GETRUSAGE) && defined (HAVE_GETTIMEOFDAY) - selfb.ru_utime.tv_sec = kidsb.ru_utime.tv_sec = selfb.ru_stime.tv_sec = kidsb.ru_stime.tv_sec = 0; - selfb.ru_utime.tv_usec = kidsb.ru_utime.tv_usec = selfb.ru_stime.tv_usec = kidsb.ru_stime.tv_usec = 0; - before = shellstart; --#else -+#elif defined (HAVE_TIMES) - before.tms_utime = before.tms_stime = before.tms_cutime = before.tms_cstime = 0; - tbefore = shell_start_time; - #endif -diff -ruwN source/general.c source-new/general.c ---- source/general.c 2022-11-24 05:10:12.000000000 +0700 -+++ source-new/general.c 2025-09-19 17:09:24.754782168 +0700 -@@ -589,6 +589,7 @@ - void - check_dev_tty () - { -+#if !defined(__redox__) - int tty_fd; - char *tty; - -@@ -603,6 +604,7 @@ - } - if (tty_fd >= 0) - close (tty_fd); -+#endif - } - - /* Return 1 if PATH1 and PATH2 are the same file. This is kind of -diff -ruwN source/include/posixwait.h source-new/include/posixwait.h ---- source/include/posixwait.h 2019-03-30 00:25:52.000000000 +0700 -+++ source-new/include/posixwait.h 2025-09-01 04:36:35.276926707 +0700 -@@ -34,7 +34,7 @@ - - /* How to get the status of a job. For Posix, this is just an - int, but for other systems we have to crack the union wait. */ --#if !defined (_POSIX_VERSION) -+#if 0 - typedef union wait WAIT; - # define WSTATUS(t) (t.w_status) - #else /* _POSIX_VERSION */ -@@ -50,7 +50,7 @@ - - /* More Posix P1003.1 definitions. In the POSIX versions, the parameter is - passed as an `int', in the non-POSIX version, as `union wait'. */ --#if defined (_POSIX_VERSION) -+#if 1 - - # if !defined (WSTOPSIG) - # define WSTOPSIG(s) ((s) >> 8) -diff --color -ruwN source/jobs.c source-new/jobs.c ---- source/jobs.c 2022-12-14 00:09:02.000000000 +0700 -+++ source-new/jobs.c 2026-02-09 23:29:28.811403291 +0700 -@@ -4417,9 +4417,11 @@ - { - shell_pgrp = getpid (); - setpgid (0, shell_pgrp); -+ } -+ -+ // shell pgrep is not set automatically on Redox - if (shell_tty != -1) - tcsetpgrp (shell_tty, shell_pgrp); -- } - - tty_sigs = 0; - while ((terminal_pgrp = tcgetpgrp (shell_tty)) != -1) -diff -ruwN source/lib/readline/input.c source-new/lib/readline/input.c ---- source/lib/readline/input.c 2022-04-09 02:43:24.000000000 +0700 -+++ source-new/lib/readline/input.c 2025-09-01 04:36:35.276926707 +0700 -@@ -805,7 +805,7 @@ - int result; - unsigned char c; - int fd; --#if defined (HAVE_PSELECT) -+#if defined (HAVE_PSELECT) || defined (HAVE_SELECT) - sigset_t empty_set; - fd_set readfds; - #endif -diff -ruwN source/lib/readline/terminal.c source-new/lib/readline/terminal.c ---- source/lib/readline/terminal.c 2022-04-05 21:44:17.000000000 +0700 -+++ source-new/lib/readline/terminal.c 2025-09-01 04:36:35.286927174 +0700 -@@ -102,7 +102,7 @@ - - static int tcap_initialized; - --#if !defined (__linux__) && !defined (NCURSES_VERSION) -+#if !defined (__linux__) && !defined (NCURSES_VERSION) && !defined (__redox__) - # if defined (__EMX__) || defined (NEED_EXTERN_PC) - extern - # endif /* __EMX__ || NEED_EXTERN_PC */ -diff -ruwN source/lib/sh/getcwd.c source-new/lib/sh/getcwd.c ---- source/lib/sh/getcwd.c 2012-03-10 22:48:50.000000000 +0700 -+++ source-new/lib/sh/getcwd.c 2025-09-01 04:36:35.286927174 +0700 -@@ -20,7 +20,7 @@ - - #include - --#if !defined (HAVE_GETCWD) -+#if !defined (HAVE_GETCWD) && !defined(__redox__) - - #if !defined (__GNUC__) && !defined (HAVE_ALLOCA_H) && defined (_AIX) - #pragma alloca -diff -ruwN source/lib/sh/input_avail.c source-new/lib/sh/input_avail.c ---- source/lib/sh/input_avail.c 2021-05-24 22:16:33.000000000 +0700 -+++ source-new/lib/sh/input_avail.c 2025-09-01 04:36:35.298927735 +0700 -@@ -33,7 +33,7 @@ - # include - #endif /* HAVE_SYS_FILE_H */ - --#if defined (HAVE_PSELECT) -+#if defined (HAVE_PSELECT) || defined (HAVE_SELECT) - # include - #endif - -diff -ruwN source/lib/sh/strtoimax.c source-new/lib/sh/strtoimax.c ---- source/lib/sh/strtoimax.c 2021-09-10 21:32:35.000000000 +0700 -+++ source-new/lib/sh/strtoimax.c 2025-09-01 04:36:35.301927876 +0700 -@@ -55,6 +55,8 @@ - extern long long strtoll PARAMS((const char *, char **, int)); - #endif - -+#if !defined (__redox__) -+ - #ifdef strtoimax - #undef strtoimax - #endif -@@ -79,6 +81,8 @@ - return (strtol (ptr, endptr, base)); - } - -+#endif -+ - #ifdef TESTING - # include - int -diff -ruwN source/parse.y source-new/parse.y ---- source/parse.y 2022-12-14 00:09:02.000000000 +0700 -+++ source-new/parse.y 2025-09-01 04:36:35.302927923 +0700 -@@ -2625,6 +2625,7 @@ - parser_state |= PST_ENDALIAS; - /* We need to do this to make sure last_shell_getc_is_singlebyte returns - true, since we are returning a single-byte space. */ -+#if defined (HANDLE_MULTIBYTE) - if (shell_input_line_index == shell_input_line_len && last_shell_getc_is_singlebyte == 0) - { - #if 0 -@@ -2638,6 +2639,7 @@ - shell_input_line_property[shell_input_line_index - 1] = 1; - #endif - } -+#endif /* HANDLE_MULTIBYTE */ - return ' '; /* END_ALIAS */ - } - #endif -diff -ruwN source/y.tab.c source-new/y.tab.c ---- source/y.tab.c 2022-12-14 00:09:02.000000000 +0700 -+++ source-new/y.tab.c 2025-09-01 04:36:35.307928157 +0700 -@@ -4936,6 +4936,7 @@ - parser_state |= PST_ENDALIAS; - /* We need to do this to make sure last_shell_getc_is_singlebyte returns - true, since we are returning a single-byte space. */ -+#if defined (HANDLE_MULTIBYTE) - if (shell_input_line_index == shell_input_line_len && last_shell_getc_is_singlebyte == 0) - { - #if 0 -@@ -4949,6 +4950,7 @@ - shell_input_line_property[shell_input_line_index - 1] = 1; - #endif - } -+#endif /* HANDLE_MULTIBYTE */ - return ' '; /* END_ALIAS */ - } - #endif diff --git a/recipes/shells/nushell/redox.patch b/recipes/shells/nushell/redox.patch deleted file mode 100644 index 5e33b030f2..0000000000 --- a/recipes/shells/nushell/redox.patch +++ /dev/null @@ -1,707 +0,0 @@ -diff --git a/Cargo.lock b/Cargo.lock -index 96aeafeae..01486a61d 100644 ---- a/Cargo.lock -+++ b/Cargo.lock -@@ -180,14 +180,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "df099ccb16cd014ff054ac1bf392c67feeef57164b05c42f037cd40f5d4357f4" - dependencies = [ - "clipboard-win", -- "core-graphics", -- "image", - "log", -- "objc2 0.5.2", -+ "objc2", - "objc2-app-kit", - "objc2-foundation", - "parking_lot", -- "windows-sys 0.48.0", - "wl-clipboard-rs", - "x11rb", - ] -@@ -884,16 +881,7 @@ version = "0.5.1" - source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" - dependencies = [ -- "objc2 0.5.2", --] -- --[[package]] --name = "block2" --version = "0.6.2" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" --dependencies = [ -- "objc2 0.6.3", -+ "objc2", - ] - - [[package]] -@@ -987,12 +975,6 @@ version = "1.5.0" - source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - --[[package]] --name = "byteorder-lite" --version = "0.1.0" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" -- - [[package]] - name = "bytes" - version = "1.11.1" -@@ -1438,30 +1420,6 @@ version = "0.8.7" - source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - --[[package]] --name = "core-graphics" --version = "0.23.2" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" --dependencies = [ -- "bitflags 1.3.2", -- "core-foundation 0.9.4", -- "core-graphics-types", -- "foreign-types 0.5.0", -- "libc", --] -- --[[package]] --name = "core-graphics-types" --version = "0.1.3" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" --dependencies = [ -- "bitflags 1.3.2", -- "core-foundation 0.9.4", -- "libc", --] -- - [[package]] - name = "cpufeatures" - version = "0.2.17" -@@ -1639,17 +1597,6 @@ dependencies = [ - "memchr", - ] - --[[package]] --name = "ctrlc" --version = "3.5.1" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "73736a89c4aff73035ba2ed2e565061954da00d4970fc9ac25dcc85a2a20d790" --dependencies = [ -- "dispatch2", -- "nix 0.30.1", -- "windows-sys 0.61.0", --] -- - [[package]] - name = "curl" - version = "0.4.47" -@@ -1881,18 +1828,6 @@ dependencies = [ - "windows-sys 0.61.0", - ] - --[[package]] --name = "dispatch2" --version = "0.3.0" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "89a09f22a6c6069a18470eb92d2298acf25463f14256d24778e1230d789a2aec" --dependencies = [ -- "bitflags 2.10.0", -- "block2 0.6.2", -- "libc", -- "objc2 0.6.3", --] -- - [[package]] - name = "displaydoc" - version = "0.2.5" -@@ -2016,7 +1951,6 @@ version = "0.11.1" - source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "e49905ece098e793ca21a019598e9efc9a66459ad1d76bd7619e771a42dae2fc" - dependencies = [ -- "arboard", - "crossterm 0.29.0", - "edit", - "edtui-jagged", -@@ -2228,26 +2162,6 @@ version = "2.3.0" - source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" - --[[package]] --name = "fax" --version = "0.2.6" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "f05de7d48f37cd6730705cbca900770cab77a89f413d23e100ad7fad7795a0ab" --dependencies = [ -- "fax_derive", --] -- --[[package]] --name = "fax_derive" --version = "0.2.0" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "a0aca10fb742cb43f9e7bb8467c91aa9bcb8e3ffbc6a6f7389bb93ffc920577d" --dependencies = [ -- "proc-macro2", -- "quote", -- "syn 2.0.114", --] -- - [[package]] - name = "fd-lock" - version = "4.0.2" -@@ -2259,15 +2173,6 @@ dependencies = [ - "windows-sys 0.52.0", - ] - --[[package]] --name = "fdeflate" --version = "0.3.7" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" --dependencies = [ -- "simd-adler32", --] -- - [[package]] - name = "file-id" - version = "0.2.2" -@@ -2408,28 +2313,7 @@ version = "0.3.2" - source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" - dependencies = [ -- "foreign-types-shared 0.1.1", --] -- --[[package]] --name = "foreign-types" --version = "0.5.0" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" --dependencies = [ -- "foreign-types-macros", -- "foreign-types-shared 0.3.1", --] -- --[[package]] --name = "foreign-types-macros" --version = "0.2.3" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" --dependencies = [ -- "proc-macro2", -- "quote", -- "syn 2.0.114", -+ "foreign-types-shared", - ] - - [[package]] -@@ -2438,12 +2322,6 @@ version = "0.1.1" - source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - --[[package]] --name = "foreign-types-shared" --version = "0.3.1" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" -- - [[package]] - name = "form_urlencoded" - version = "1.2.2" -@@ -2711,17 +2589,6 @@ dependencies = [ - "tracing", - ] - --[[package]] --name = "half" --version = "2.7.1" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" --dependencies = [ -- "cfg-if", -- "crunchy", -- "zerocopy 0.8.34", --] -- - [[package]] - name = "halfbrown" - version = "0.4.0" -@@ -3154,20 +3021,6 @@ dependencies = [ - "icu_properties", - ] - --[[package]] --name = "image" --version = "0.25.9" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "e6506c6c10786659413faa717ceebcb8f70731c0a60cbae39795fdf114519c1a" --dependencies = [ -- "bytemuck", -- "byteorder-lite", -- "moxcms", -- "num-traits", -- "png", -- "tiff", --] -- - [[package]] - name = "indexmap" - version = "2.13.0" -@@ -3932,7 +3785,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" - dependencies = [ - "adler2", -- "simd-adler32", - ] - - [[package]] -@@ -3982,16 +3834,6 @@ dependencies = [ - "tokio", - ] - --[[package]] --name = "moxcms" --version = "0.7.11" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "ac9557c559cd6fc9867e122e20d2cbefc9ca29d80d027a8e39310920ed2f0a97" --dependencies = [ -- "num-traits", -- "pxfm", --] -- - [[package]] - name = "multipart-rs" - version = "0.1.13" -@@ -4119,7 +3961,6 @@ version = "0.110.1" - dependencies = [ - "assert_cmd", - "crossterm 0.29.0", -- "ctrlc", - "dirs", - "fancy-regex", - "lexopt", -@@ -5043,15 +4884,6 @@ dependencies = [ - "objc2-encode", - ] - --[[package]] --name = "objc2" --version = "0.6.3" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "b7c2599ce0ec54857b29ce62166b0ed9b4f6f1a70ccc9a71165b6154caca8c05" --dependencies = [ -- "objc2-encode", --] -- - [[package]] - name = "objc2-app-kit" - version = "0.2.2" -@@ -5059,9 +4891,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" - dependencies = [ - "bitflags 2.10.0", -- "block2 0.5.1", -+ "block2", - "libc", -- "objc2 0.5.2", -+ "objc2", - "objc2-core-data", - "objc2-core-image", - "objc2-foundation", -@@ -5075,8 +4907,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" - dependencies = [ - "bitflags 2.10.0", -- "block2 0.5.1", -- "objc2 0.5.2", -+ "block2", -+ "objc2", - "objc2-foundation", - ] - -@@ -5095,8 +4927,8 @@ version = "0.2.2" - source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" - dependencies = [ -- "block2 0.5.1", -- "objc2 0.5.2", -+ "block2", -+ "objc2", - "objc2-foundation", - "objc2-metal", - ] -@@ -5114,9 +4946,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" - dependencies = [ - "bitflags 2.10.0", -- "block2 0.5.1", -+ "block2", - "libc", -- "objc2 0.5.2", -+ "objc2", - ] - - [[package]] -@@ -5136,8 +4968,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" - dependencies = [ - "bitflags 2.10.0", -- "block2 0.5.1", -- "objc2 0.5.2", -+ "block2", -+ "objc2", - "objc2-foundation", - ] - -@@ -5148,8 +4980,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" - dependencies = [ - "bitflags 2.10.0", -- "block2 0.5.1", -- "objc2 0.5.2", -+ "block2", -+ "objc2", - "objc2-foundation", - "objc2-metal", - ] -@@ -5241,7 +5073,7 @@ checksum = "fedfea7d58a1f73118430a55da6a286e7b044961736ce96a16a17068ea25e5da" - dependencies = [ - "bitflags 2.10.0", - "cfg-if", -- "foreign-types 0.3.2", -+ "foreign-types", - "libc", - "once_cell", - "openssl-macros", -@@ -5638,19 +5470,6 @@ dependencies = [ - "time", - ] - --[[package]] --name = "png" --version = "0.18.0" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "97baced388464909d42d89643fe4361939af9b7ce7a31ee32a168f832a70f2a0" --dependencies = [ -- "bitflags 2.10.0", -- "crc32fast", -- "fdeflate", -- "flate2", -- "miniz_oxide", --] -- - [[package]] - name = "polars" - version = "0.52.0" -@@ -6392,27 +6211,12 @@ dependencies = [ - "thiserror 1.0.69", - ] - --[[package]] --name = "pxfm" --version = "0.1.27" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "7186d3822593aa4393561d186d1393b3923e9d6163d3fbfd6e825e3e6cf3e6a8" --dependencies = [ -- "num-traits", --] -- - [[package]] - name = "quick-error" - version = "1.2.3" - source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" - --[[package]] --name = "quick-error" --version = "2.0.1" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" -- - [[package]] - name = "quick-xml" - version = "0.36.2" -@@ -7948,7 +7752,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "36e39da5d30887b5690e29de4c5ebb8ddff64ebd9933f98a01daaa4fd11b36ea" - dependencies = [ - "peresil", -- "quick-error 1.2.3", -+ "quick-error", - "sxd-document", - ] - -@@ -8169,20 +7973,6 @@ dependencies = [ - "once_cell", - ] - --[[package]] --name = "tiff" --version = "0.10.3" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "af9605de7fee8d9551863fd692cce7637f548dbd9db9180fcc07ccc6d26c336f" --dependencies = [ -- "fax", -- "flate2", -- "half", -- "quick-error 2.0.1", -- "weezl", -- "zune-jpeg", --] -- - [[package]] - name = "time" - version = "0.3.47" -@@ -8510,7 +8300,7 @@ dependencies = [ - "chrono", - "libc", - "log", -- "objc2 0.5.2", -+ "objc2", - "objc2-foundation", - "once_cell", - "percent-encoding", -@@ -9353,12 +9143,6 @@ dependencies = [ - "rustls-pki-types", - ] - --[[package]] --name = "weezl" --version = "0.1.12" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" -- - [[package]] - name = "which" - version = "4.4.2" -@@ -10242,18 +10026,3 @@ dependencies = [ - "cc", - "pkg-config", - ] -- --[[package]] --name = "zune-core" --version = "0.4.12" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "3f423a2c17029964870cfaabb1f13dfab7d092a62a29a89264f4d36990ca414a" -- --[[package]] --name = "zune-jpeg" --version = "0.4.21" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "29ce2c8a9384ad323cf564b67da86e21d3cfdff87908bc1223ed5c99bc792713" --dependencies = [ -- "zune-core", --] -diff --git a/Cargo.toml b/Cargo.toml -index 1ec173b6d..4c9293791 100644 ---- a/Cargo.toml -+++ b/Cargo.toml -@@ -89,7 +89,6 @@ chrono-tz = "0.10" - crossbeam-channel = "0.5.15" - crossterm = "0.29.0" - csv = "1.4" --ctrlc = "3.5" - devicons = "0.6.12" - dialoguer = { default-features = false, version = "0.12" } - digest = { default-features = false, version = "0.10" } -@@ -248,7 +247,6 @@ nu-mcp = { path = "./crates/nu-mcp", version = "0.110.1", optional = true } - reedline = { workspace = true, features = ["bashisms"] } - - crossterm = { workspace = true } --ctrlc = { workspace = true } - dirs = { workspace = true } - log = { workspace = true } - lexopt = { workspace = true } -diff --git a/crates/nu-command/src/default_context.rs b/crates/nu-command/src/default_context.rs -index fcc7fa3f9..a80237429 100644 ---- a/crates/nu-command/src/default_context.rs -+++ b/crates/nu-command/src/default_context.rs -@@ -271,9 +271,6 @@ pub fn add_shell_command_context(mut engine_state: EngineState) -> EngineState { - Whoami, - }; - -- #[cfg(all(unix, feature = "os"))] -- bind_command! { ULimit }; -- - #[cfg(all(unix, feature = "os"))] - bind_command! { UMask }; - -diff --git a/crates/nu-command/src/filesystem/ls.rs b/crates/nu-command/src/filesystem/ls.rs -index 554ec0fd9..7aae4bdc3 100644 ---- a/crates/nu-command/src/filesystem/ls.rs -+++ b/crates/nu-command/src/filesystem/ls.rs -@@ -773,20 +773,12 @@ pub(crate) fn dir_entry_dict( - - record.push( - "user", -- if let Some(user) = users::get_user_by_uid(md.uid().into()) { -- Value::string(user.name, span) -- } else { -- Value::int(md.uid().into(), span) -- }, -+ Value::int(md.uid().into(), span) - ); - - record.push( - "group", -- if let Some(group) = users::get_group_by_gid(md.gid().into()) { -- Value::string(group.name, span) -- } else { -- Value::int(md.gid().into(), span) -- }, -+ Value::int(md.gid().into(), span) - ); - } - } -diff --git a/crates/nu-command/src/filesystem/ucp.rs b/crates/nu-command/src/filesystem/ucp.rs -index 2198911e6..b193dab2c 100644 ---- a/crates/nu-command/src/filesystem/ucp.rs -+++ b/crates/nu-command/src/filesystem/ucp.rs -@@ -320,7 +320,8 @@ fn make_attributes(preserve: Option) -> Result) -> Result) -> PermissionResult { - - #[cfg(unix)] - pub mod users { -- use nix::unistd::{Gid, Group, Uid, User}; -- -- pub fn get_user_by_uid(uid: Uid) -> Option { -- User::from_uid(uid).ok().flatten() -- } -- -- pub fn get_group_by_gid(gid: Gid) -> Option { -- Group::from_gid(gid).ok().flatten() -- } -+ use nix::unistd::{Gid, Uid}; - - pub fn get_current_uid() -> Uid { - Uid::current() -@@ -60,7 +52,7 @@ pub mod users { - - #[cfg(not(any(target_os = "linux", target_os = "freebsd", target_os = "android")))] - pub fn get_current_username() -> Option { -- get_user_by_uid(get_current_uid()).map(|user| user.name) -+ None - } - - #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "android"))] -@@ -127,22 +119,7 @@ pub mod users { - nix::libc::getgrouplist(name.as_ptr(), gid.as_raw(), buff.as_mut_ptr(), &mut count) - }; - -- if res < 0 { -- None -- } else { -- buff.truncate(count as usize); -- buff.sort_unstable(); -- buff.dedup(); -- // allow trivial cast: on macos i is i32, on linux it's already gid_t -- #[allow(trivial_numeric_casts)] -- Some( -- buff.into_iter() -- .map(|id| Gid::from_raw(id as gid_t)) -- .filter_map(get_group_by_gid) -- .map(|group| group.gid) -- .collect(), -- ) -- } -+ None - } - } - -diff --git a/rust-toolchain.toml b/rust-toolchain.toml -deleted file mode 100644 -index 37ca9dfd1..000000000 ---- a/rust-toolchain.toml -+++ /dev/null -@@ -1,17 +0,0 @@ --# So, you want to update the Rust toolchain... --# The key is making sure all our dependencies support the version of Rust we're using, --# and that nushell compiles on all the platforms tested in our CI. -- --# Here's some documentation on how to use this file: --# https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file -- --[toolchain] --# The default profile includes rustc, rust-std, cargo, rust-docs, rustfmt and clippy. --# https://rust-lang.github.io/rustup/concepts/profiles.html --profile = "default" --# The current plan is to be 2 releases behind the latest stable release. So, if the --# latest stable release is 1.72.0, the channel should be 1.70.0. We want to do this --# so that we give repo maintainers and package managers a chance to update to a more --# recent version of rust. However, if there is a "cool new feature" that we want to --# use in nushell, we may opt to use the bleeding edge stable version of rust. --channel = "1.91.1" -diff --git a/src/signals.rs b/src/signals.rs -index c3a4b8379..d5be1009c 100644 ---- a/src/signals.rs -+++ b/src/signals.rs -@@ -25,10 +25,4 @@ pub(crate) fn ctrlc_protection(engine_state: &mut EngineState) { - .expect("Failed to register interrupt signal handler"); - - engine_state.signal_handlers = Some(signal_handlers.clone()); -- -- ctrlc::set_handler(move || { -- interrupt.store(true, Ordering::Relaxed); -- signal_handlers.run(SignalAction::Interrupt); -- }) -- .expect("Error setting Ctrl-C handler"); - } diff --git a/recipes/shells/zsh/redox.patch b/recipes/shells/zsh/redox.patch deleted file mode 100644 index 896ec35c98..0000000000 --- a/recipes/shells/zsh/redox.patch +++ /dev/null @@ -1,75 +0,0 @@ ---- a/Src/builtin.c -+++ b/Src/builtin.c -@@ -7158,18 +7158,10 @@ - { - struct tms buf; - long clktck = get_clktck(); -- -- /* get time accounting information */ -- if (times(&buf) == -1) -- return 1; -- pttime(buf.tms_utime); /* user time */ -- putchar(' '); -- pttime(buf.tms_stime); /* system time */ -- putchar('\n'); -- pttime(buf.tms_cutime); /* user time, children */ -- putchar(' '); -- pttime(buf.tms_cstime); /* system time, children */ -- putchar('\n'); -+ /* TODO: times() is not available on Redox; stubbed out. -+ * Re-enable when relibc gains times() support. */ -+ (void)buf; -+ (void)clktck; - return 0; - } - ---- a/Src/Builtins/rlimits.c -+++ b/Src/Builtins/rlimits.c -@@ -892,7 +892,8 @@ - int - boot_(UNUSED(Module m)) - { -- set_resinfo(); -+ /* TODO: set_resinfo() relies on getrusage() which is unavailable on Redox. -+ * Re-enable when relibc gains getrusage() support. */ - return 0; - } - -@@ -900,7 +901,8 @@ - int - cleanup_(Module m) - { -- free_resinfo(); -+ /* TODO: free_resinfo() paired with set_resinfo(); disabled on Redox. -+ * Re-enable when relibc gains getrusage() support. */ - return setfeatureenables(m, &module_features, NULL); - } - ---- a/Src/zsh_system.h -+++ b/Src/zsh_system.h -@@ -539,6 +539,14 @@ - - #ifdef HAVE_SYS_RESOURCE_H - # include -+/* Redox: RLIM_NLIMITS may not be defined even with sys/resource.h */ -+#ifndef RLIM_NLIMITS -+# ifdef RLIMIT_NLIMITS -+# define RLIM_NLIMITS RLIMIT_NLIMITS -+# else -+# define RLIM_NLIMITS 7 -+# endif -+#endif - # if defined(__hpux) && !defined(RLIMIT_CPU) - /* HPUX does have the BSD rlimits in the kernel. Officially they are * - * unsupported but quite a few of them like RLIMIT_CORE seem to work. * ---- a/Src/jobs.c -+++ b/Src/jobs.c -@@ -1029,7 +1029,7 @@ - return 1; - #else - { -- clktck = get_clktck(); -+ long clktck = get_clktck(); - if ((j->procs->ti.ut + j->procs->ti.st) / clktck >= reporttime) - return 1; - } diff --git a/recipes/tests/sysbench/redox.patch b/recipes/tests/sysbench/redox.patch deleted file mode 100644 index 40f0ce4757..0000000000 --- a/recipes/tests/sysbench/redox.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/src/lua/internal/Makefile.am -+++ b/src/lua/internal/Makefile.am -@@ -26,7 +26,7 @@ SUFFIXES = .lua .lua.h - - .lua.lua.h: - @echo "Creating $@ from $<" -- @var=$$(echo $< | sed 's/\./_/g') && \ -+ @var=$$(basename $< | sed 's/\./_/g') && \ - ( echo "unsigned char $${var}[] =" && \ - sed -e 's/\\/\\\\/g' \ - -e 's/"/\\"/g' \ diff --git a/recipes/tests/vttest/redox.patch b/recipes/tests/vttest/redox.patch deleted file mode 100644 index 8fe39620c0..0000000000 --- a/recipes/tests/vttest/redox.patch +++ /dev/null @@ -1,80 +0,0 @@ -diff -u source_original/main.c source/main.c ---- source_original/main.c 2014-01-16 22:15:19.000000000 +0100 -+++ source/main.c 2017-10-30 18:31:22.365280877 +0100 -@@ -1295,8 +1295,8 @@ - void - initterminal(int pn) - { -- init_ttymodes(pn); -- setup_terminal(""); -+ //init_ttymodes(pn); -+ //setup_terminal(""); - } - - /* Set up my personal prejudices */ -Common subdirectories: source_original/package and source/package -diff -u source_original/unix_io.c source/unix_io.c ---- source_original/unix_io.c 2014-01-16 23:11:39.000000000 +0100 -+++ source/unix_io.c 2017-10-30 18:48:13.927899071 +0100 -@@ -40,17 +40,17 @@ - lval = last_char; - brkrd = FALSE; - reading = TRUE; --#ifdef HAVE_ALARM -- signal(SIGALRM, give_up); -- alarm(60); /* timeout after 1 minute, in case user's keyboard is hung */ --#endif -+//#ifdef HAVE_ALARM -+// signal(SIGALRM, give_up); -+// alarm(60); /* timeout after 1 minute, in case user's keyboard is hung */ -+//#endif - if (read(0, &one_byte, (size_t) 1) < 0) - ch = EOF; - else - ch = (int) one_byte; --#ifdef HAVE_ALARM -- alarm(0); --#endif -+//#ifdef HAVE_ALARM -+// alarm(0); -+//#endif - reading = FALSE; - #ifdef DEBUG - { -@@ -178,21 +178,21 @@ - void - inflush(void) - { -- int val; -- --#ifdef HAVE_RDCHK -- while (rdchk(0)) -- read(0, &val, 1); --#else --#if USE_FIONREAD -- int l1; -- ioctl(0, FIONREAD, &l1); -- while (l1-- > 0L) -- read(0, &val, (size_t) 1); --#else -- while (read(2, &val, (size_t) 1) > 0) ; --#endif --#endif -+// int val; -+// -+//#ifdef HAVE_RDCHK -+// while (rdchk(0)) -+// read(0, &val, 1); -+//#else -+//#if USE_FIONREAD -+// int l1; -+// ioctl(0, FIONREAD, &l1); -+// while (l1-- > 0L) -+// read(0, &val, (size_t) 1); -+//#else -+// while (read(2, &val, (size_t) 1) > 0) ; -+//#endif -+//#endif - } - - void diff --git a/recipes/tools/gettext/redox.patch b/recipes/tools/gettext/redox.patch deleted file mode 100644 index 8b6f307d02..0000000000 --- a/recipes/tools/gettext/redox.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff -ruwN source/gettext-tools/gnulib-lib/getdtablesize.c source-new/gettext-tools/gnulib-lib/getdtablesize.c ---- source/gettext-tools/gnulib-lib/getdtablesize.c 2016-06-11 06:59:58.000000000 -0600 -+++ source-new/gettext-tools/gnulib-lib/getdtablesize.c 2019-01-05 08:45:36.015291070 -0700 -@@ -84,6 +84,14 @@ - return dtablesize; - } - -+#elif defined(__redox__) -+ -+int -+getdtablesize (void) -+{ -+ return INT_MAX; -+} -+ - #else - - # include -diff -ruwN source/gettext-tools/gnulib-lib/spawni.c source-new/gettext-tools/gnulib-lib/spawni.c ---- source/gettext-tools/gnulib-lib/spawni.c 2016-06-11 07:00:02.000000000 -0600 -+++ source-new/gettext-tools/gnulib-lib/spawni.c 2019-01-05 08:55:44.661641522 -0700 -@@ -51,10 +51,10 @@ - # include - #else - # if !HAVE_SETEUID --# define seteuid(id) setresuid (-1, id, -1) -+# define seteuid(id) setreuid (-1, id) - # endif - # if !HAVE_SETEGID --# define setegid(id) setresgid (-1, id, -1) -+# define setegid(id) setregid (-1, id) - # endif - # define local_seteuid(id) seteuid (id) - # define local_setegid(id) setegid (id) -diff -ruwN source/gettext-tools/Makefile.am source-new/gettext-tools/Makefile.am ---- source/gettext-tools/Makefile.am 2023-09-19 03:08:31.000000000 +0700 -+++ source-new/gettext-tools/Makefile.am 2025-10-05 12:39:33.287595871 +0700 -@@ -19,7 +19,7 @@ - AUTOMAKE_OPTIONS = 1.5 gnu no-dependencies - ACLOCAL_AMFLAGS = -I m4 -I ../gettext-runtime/m4 -I ../m4 -I gnulib-m4 -I libgrep/gnulib-m4 -I libgettextpo/gnulib-m4 - --SUBDIRS = gnulib-lib libgrep src libgettextpo po its projects styles emacs misc man m4 tests system-tests gnulib-tests examples doc -+SUBDIRS = gnulib-lib libgrep src libgettextpo po its projects styles emacs misc man m4 - - EXTRA_DIST = misc/DISCLAIM - MOSTLYCLEANFILES = core *.stackdump diff --git a/recipes/tools/gnu-binutils/01_build_fix.patch b/recipes/tools/gnu-binutils/01_build_fix.patch deleted file mode 100644 index 9bf0ddacd7..0000000000 --- a/recipes/tools/gnu-binutils/01_build_fix.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff '--color=auto' -ur source/gprofng/libcollector/configure.ac source-new/gprofng/libcollector/configure.ac ---- source/gprofng/libcollector/configure.ac 2024-08-17 09:00:00.000000000 +1000 -+++ source-new/gprofng/libcollector/configure.ac 2024-12-04 15:59:58.407412951 +1100 -@@ -18,7 +18,7 @@ - - m4_include([../../bfd/version.m4]) - AC_INIT([gprofng], [BFD_VERSION]) --AC_CONFIG_MACRO_DIRS([../../config ../..]) -+#AC_CONFIG_MACRO_DIRS([../../config ../..]) - AC_CONFIG_AUX_DIR(../..) - AC_CANONICAL_TARGET - AM_INIT_AUTOMAKE -diff '--color=auto' -ur source/libiberty/configure.ac source-new/libiberty/configure.ac ---- source/libiberty/configure.ac 2024-08-17 09:00:00.000000000 +1000 -+++ source-new/libiberty/configure.ac 2024-12-04 15:59:31.572203764 +1100 -@@ -37,7 +37,7 @@ - libiberty_topdir="${srcdir}/.." - fi - AC_SUBST(libiberty_topdir) --AC_CONFIG_AUX_DIR($libiberty_topdir) -+AC_CONFIG_AUX_DIR([.]) - - dnl Very limited version of automake's enable-maintainer-mode - diff --git a/recipes/tools/gnu-grep/grep.patch b/recipes/tools/gnu-grep/grep.patch deleted file mode 100644 index 8b3d8b98e0..0000000000 --- a/recipes/tools/gnu-grep/grep.patch +++ /dev/null @@ -1,68 +0,0 @@ -Only in source: grep.patch -diff -ru source/lib/getdtablesize.c source-new/lib/getdtablesize.c ---- source/lib/getdtablesize.c 2017-07-23 20:50:44.287742363 -0700 -+++ source-new/lib/getdtablesize.c 2017-07-23 20:51:06.271284748 -0700 -@@ -109,15 +109,6 @@ - int - getdtablesize (void) - { -- struct rlimit lim; -- -- if (getrlimit (RLIMIT_NOFILE, &lim) == 0 -- && 0 <= lim.rlim_cur && lim.rlim_cur <= INT_MAX -- && lim.rlim_cur != RLIM_INFINITY -- && lim.rlim_cur != RLIM_SAVED_CUR -- && lim.rlim_cur != RLIM_SAVED_MAX) -- return lim.rlim_cur; -- - return INT_MAX; - } - -diff -ru source/lib/getprogname.c source-new/lib/getprogname.c ---- source/lib/getprogname.c 2017-01-16 09:29:13.000000000 -0800 -+++ source-new/lib/getprogname.c 2017-07-23 20:49:21.133618122 -0700 -@@ -43,13 +43,11 @@ - # include - #endif - --#ifdef __sgi - # include - # include - # include - # include --# include --#endif -+# include - - #include "dirname.h" - -@@ -178,7 +176,16 @@ - } - return NULL; - # else --# error "getprogname module not ported to this OS" -+ char filename[PATH_MAX]; -+ int fd = open ("sys:exe", O_RDONLY); -+ if (fd > 0) { -+ int len = read(fd, filename, PATH_MAX-1); -+ if (len > 0) { -+ filename[len] = '\0'; -+ return strdup(filename); -+ } -+ } -+ return NULL; - # endif - } - -diff -ru source/src/grep.c source-new/src/grep.c ---- source/src/grep.c 2017-07-02 10:41:41.000000000 -0700 -+++ source-new/src/grep.c 2017-07-23 20:53:10.439131874 -0700 -@@ -2895,7 +2895,7 @@ - #ifdef _SC_PAGESIZE - long psize = sysconf (_SC_PAGESIZE); - #else -- long psize = getpagesize (); -+ long psize = 4096; - #endif - if (! (0 < psize && psize <= (SIZE_MAX - sizeof (uword)) / 2)) - abort (); diff --git a/recipes/tools/libc-bench/redox.patch b/recipes/tools/libc-bench/redox.patch deleted file mode 100644 index 475c7472ec..0000000000 --- a/recipes/tools/libc-bench/redox.patch +++ /dev/null @@ -1,42 +0,0 @@ -diff -ruw source/Makefile source-new/Makefile ---- source/Makefile 2011-01-31 00:13:00.000000000 -0700 -+++ source-new/Makefile 2018-12-25 09:07:37.564520567 -0700 -@@ -4,7 +4,7 @@ - - CFLAGS = -Os - LDFLAGS = -static --LIBS = -lpthread -lrt -lpthread -+LIBS = -lpthread - - - all: libc-bench -diff -ruw source/utf8.c source-new/utf8.c ---- source/utf8.c 2011-01-24 20:08:38.000000000 -0700 -+++ source-new/utf8.c 2018-12-25 08:52:35.893821291 -0700 -@@ -3,7 +3,7 @@ - #include - #include - #include --#include -+//#include - - size_t b_utf8_bigbuf(void *dummy) - { -@@ -18,7 +18,7 @@ - || setlocale(LC_CTYPE, "en.UTF-8") - || setlocale(LC_CTYPE, "de_DE-8") - || setlocale(LC_CTYPE, "fr_FR-8"); -- if (strcmp(nl_langinfo(CODESET), "UTF-8")) return -1; -+ //if (strcmp(nl_langinfo(CODESET), "UTF-8")) return -1; - - buf = malloc(500000); - wbuf = malloc(500000*sizeof(wchar_t)); -@@ -56,7 +56,7 @@ - || setlocale(LC_CTYPE, "en.UTF-8") - || setlocale(LC_CTYPE, "de_DE-8") - || setlocale(LC_CTYPE, "fr_FR-8"); -- if (strcmp(nl_langinfo(CODESET), "UTF-8")) return -1; -+ //if (strcmp(nl_langinfo(CODESET), "UTF-8")) return -1; - - buf = malloc(500000); - l = 0; diff --git a/recipes/tools/schismtracker/redox.patch b/recipes/tools/schismtracker/redox.patch deleted file mode 100644 index 0850319ad4..0000000000 --- a/recipes/tools/schismtracker/redox.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -rupNw source-original/Makefile.am source/Makefile.am ---- source-original/Makefile.am 2018-08-10 07:04:54.000000000 +0200 -+++ source/Makefile.am 2018-12-30 23:18:07.957244170 +0100 -@@ -223,7 +223,7 @@ files_macosx = \ - endif - - if USE_NETWORK --cflags_network=-DUSE_NETWORK -+#cflags_network=-DUSE_NETWORK - endif - - -diff -rupNw source-original/schism/main.c source/schism/main.c ---- source-original/schism/main.c 2018-08-10 07:04:54.000000000 +0200 -+++ source/schism/main.c 2018-12-30 23:19:24.954046191 +0100 -@@ -1033,7 +1033,7 @@ int main(int argc, char **argv) - - video_fullscreen(0); - -- tzset(); // localtime_r wants this -+ //tzset(); // localtime_r wants this - srand(time(NULL)); - parse_options(argc, argv); /* shouldn't this be like, first? */ - diff --git a/recipes/tools/sed/sed.patch b/recipes/tools/sed/sed.patch deleted file mode 100644 index ea10d0c5ba..0000000000 --- a/recipes/tools/sed/sed.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -ruN sed-4.4/sed/mbcs.c source/sed/mbcs.c ---- sed-4.4/sed/mbcs.c 2017-01-01 03:17:10.000000000 -0800 -+++ source/sed/mbcs.c 2025-06-06 04:36:30.129312397 -0700 -@@ -38,6 +38,7 @@ - int - is_mb_char (int ch, mbstate_t *cur_stat) - { -+ return 0; // FIXME: Implement mbrtowc in relibc, then remove this line - const char c = ch ; - const int mb_pending = !mbsinit (cur_stat); - const int result = mbrtowc (NULL, &c, 1, cur_stat); diff --git a/recipes/tools/vim/vim.patch b/recipes/tools/vim/vim.patch deleted file mode 100644 index 0537b2c952..0000000000 --- a/recipes/tools/vim/vim.patch +++ /dev/null @@ -1,66 +0,0 @@ -diff -ruwN source/src/configure.ac source-new/src/configure.ac ---- source/src/configure.ac 2024-10-29 04:05:26.000000000 +0700 -+++ source-new/src/configure.ac 2025-08-06 03:15:52.796303989 +0700 -@@ -3759,7 +3759,7 @@ - dnl Check for functions in one big call, to reduce the size of configure. - dnl Can only be used for functions that do not require any include. - AC_CHECK_FUNCS(fchdir fchown fchmod fsync getcwd getpseudotty \ -- getpwent getpwnam getpwuid getrlimit gettimeofday localtime_r lstat \ -+ getpwent getpwnam getpwuid gettimeofday localtime_r lstat \ - memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \ - getpgid setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \ - sigprocmask sigvec strcasecmp strcoll strerror strftime stricmp strncasecmp \ -diff -ruwN source/src/feature.h source-new/src/feature.h ---- source/src/feature.h 2024-10-29 04:05:26.000000000 +0700 -+++ source-new/src/feature.h 2025-08-06 03:16:27.596296730 +0700 -@@ -272,6 +272,7 @@ - */ - #if defined(FEAT_NORMAL) \ - && defined(FEAT_EVAL) \ -+ && !defined (__redox__) /* disable setitimer */ \ - && ((defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) \ - && (!defined(MACOS_X) || defined(HAVE_DISPATCH_DISPATCH_H))) \ - || defined(MSWIN)) -diff -ruwN source/src/libvterm/include/vterm.h source-new/src/libvterm/include/vterm.h ---- source/src/libvterm/include/vterm.h 2024-10-29 04:05:26.000000000 +0700 -+++ source-new/src/libvterm/include/vterm.h 2025-08-06 03:15:02.506316769 +0700 -@@ -17,9 +17,11 @@ - #define FALSE 0 - - // VIM: from stdint.h -+#if !defined (__redox__) - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; -+#endif - - // VIM: define max screen cols and rows - #define VTERM_MAX_COLS 1000 -diff -ruwN source/src/memfile.c source-new/src/memfile.c ---- source/src/memfile.c 2024-10-29 04:05:26.000000000 +0700 -+++ source-new/src/memfile.c 2025-08-06 03:15:36.896308173 +0700 -@@ -599,6 +599,8 @@ - // No sync() on Stratus VOS - # if defined(__OPENNT) || defined(__TANDEM) || defined(__VOS__) - fflush(NULL); -+# elif defined(__redox__) -+ fsync(mfp->mf_fd); - # else - sync(); - # endif -diff -ruwN source/src/auto/configure source-new/src/auto/configure ---- source/src/auto/configure 2024-10-29 04:05:26.000000000 +0700 -+++ source-new/src/auto/configure 2025-08-06 03:56:11.765660165 +0700 -@@ -13358,12 +13358,6 @@ - printf "%s\n" "#define HAVE_GETPWUID 1" >>confdefs.h - - fi --ac_fn_c_check_func "$LINENO" "getrlimit" "ac_cv_func_getrlimit" --if test "x$ac_cv_func_getrlimit" = xyes --then : -- printf "%s\n" "#define HAVE_GETRLIMIT 1" >>confdefs.h -- --fi - ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" - if test "x$ac_cv_func_gettimeofday" = xyes - then : diff --git a/recipes/tui/goaccess/redox1.patch b/recipes/tui/goaccess/redox1.patch deleted file mode 100644 index f44ddb0a94..0000000000 --- a/recipes/tui/goaccess/redox1.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 2444d71e7815c8b7f3bd4462b8418d9c7e8c5667 Mon Sep 17 00:00:00 2001 -From: Rafael Senties Martinelli -Date: Sun, 19 Oct 2025 19:42:46 +0200 -Subject: [PATCH 1/2] Ensure fixed-width integers and PIPE_BUF are defined for - Redox or minimal libc - ---- - src/websocket.h | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/src/websocket.h b/src/websocket.h -index 79d03dff..31847b10 100644 ---- a/src/websocket.h -+++ b/src/websocket.h -@@ -45,8 +45,15 @@ - #include - #endif - --#if defined(__linux__) || defined(__CYGWIN__) -+#if defined(__linux__) || defined(__CYGWIN__) || defined(__redox__) - # include -+#if defined(__redox__) -+# include /* for uint*_t types */ -+# include /* for PIPE_BUF */ -+# ifndef PIPE_BUF -+# define PIPE_BUF 4096 -+# endif -+#endif - #if ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 9)) - #if defined(__BYTE_ORDER) && (__BYTE_ORDER == __LITTLE_ENDIAN) - # include --- -2.51.1.dirty - diff --git a/recipes/tui/goaccess/redox2.patch b/recipes/tui/goaccess/redox2.patch deleted file mode 100644 index 482b7fcdde..0000000000 --- a/recipes/tui/goaccess/redox2.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 4a564a6b0f9d4ee7a804b9dbb391e7421187014b Mon Sep 17 00:00:00 2001 -From: Rafael Senties Martinelli -Date: Sun, 19 Oct 2025 20:08:10 +0200 -Subject: [PATCH 2/2] Add option to ignore building bin2c - ---- - Makefile.am | 9 +++++++++ - configure.ac | 16 ++++++++++++++++ - 2 files changed, 25 insertions(+) - -diff --git a/Makefile.am b/Makefile.am -index 7696c8f5..8d0fcdcd 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -51,6 +51,15 @@ CLEANFILES = \ - resources/js/charts.js.tmp \ - resources/js/app.js.tmp - -+# Prevent rebuilding bin2c if binary already exists -+bin2c$(EXEEXT): -+if USE_PREBUILT_BIN2C -+ @echo "Using prebuilt bin2c from $(BIN2C_PATH)" -+ cp $(BIN2C_PATH) bin2c$(EXEEXT) -+else -+ $(AM_V_CCLD)$(LINK) $(bin2c_OBJECTS) $(bin2c_LDADD) $(LIBS) -+endif -+ - # Tpls - src/tpls.h: bin2c$(EXEEXT) $(srcdir)/resources/tpls.html - if HAS_SEDTR -diff --git a/configure.ac b/configure.ac -index 790499ce..feaf72d2 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -105,6 +105,22 @@ if test "$with_getline" = "yes"; then - AC_DEFINE([WITH_GETLINE], 1, [Build using GNU getline.]) - fi - -+# bin2c -+AC_ARG_WITH([bin2c-path], -+ [AS_HELP_STRING([--with-bin2c-path=PATH], [Use prebuilt bin2c binary at PATH])], -+ [BIN2C_PATH="$withval"], -+ [BIN2C_PATH=""]) -+ -+if test -n "$BIN2C_PATH"; then -+ USE_PREBUILT_BIN2C=true -+else -+ USE_PREBUILT_BIN2C=false -+fi -+ -+AM_CONDITIONAL([USE_PREBUILT_BIN2C], [test "$USE_PREBUILT_BIN2C" = true]) -+AC_SUBST([BIN2C_PATH]) -+ -+ - # UTF8 - AC_ARG_ENABLE([utf8],[AS_HELP_STRING([--enable-utf8],[Enable ncurses library that handles wide characters. Default is disabled])],[utf8="$enableval"],[utf8=no]) - --- -2.51.1.dirty - diff --git a/recipes/web/netsurf/01_redox.patch b/recipes/web/netsurf/01_redox.patch deleted file mode 100644 index 2f72f8932a..0000000000 --- a/recipes/web/netsurf/01_redox.patch +++ /dev/null @@ -1,140 +0,0 @@ -diff -ruwN source/Makefile source-new/Makefile ---- source/Makefile 2023-12-28 07:57:05.071795200 +0700 -+++ source-new/Makefile 2025-07-20 11:58:36.652747547 +0700 -@@ -110,7 +110,7 @@ - - # prefixed install macro for each host sub target - define do_build_prefix_install -- $(MAKE) install --directory=$1 HOST=$(BUILD) PREFIX=$(TMP_PREFIX) Q=$(Q) DESTDIR= -+ $(MAKE) install --directory=$1 HOST=$(BUILD) PREFIX=$(TMP_PREFIX) Q=$(Q) DESTDIR= CC=cc LDFLAGS= - - endef - -diff -ruwN source/buildsystem/makefiles/Makefile.tools source-new/buildsystem/makefiles/Makefile.tools ---- source/buildsystem/makefiles/Makefile.tools 2023-12-28 07:57:21.479359900 +0700 -+++ source-new/buildsystem/makefiles/Makefile.tools 2025-07-20 11:58:36.662747547 +0700 -@@ -135,7 +135,7 @@ - endif - - # Search the path for the compiler -- toolpath_ := $(shell /bin/which $(CC__)) -+ toolpath_ := $(shell which $(CC__)) - ifeq ($(toolpath_),) - toolpath_ := /opt/netsurf/$(HOST)/cross/bin/ - CC__ := $(toolpath_)$(HOST)-gcc -diff -ruwN source/buildsystem/makefiles/Makefile.top source-new/buildsystem/makefiles/Makefile.top ---- source/buildsystem/makefiles/Makefile.top 2023-12-28 07:57:21.479359900 +0700 -+++ source-new/buildsystem/makefiles/Makefile.top 2025-07-20 11:58:36.662747547 +0700 -@@ -462,7 +462,7 @@ - - define build_c - ifeq ($$(findstring $$(BUILDDIR)/$2,$$(BUILDFILES)),) -- $$(BUILDDIR)/$2: $$(BUILDDIR)/stamp $1 -+ $$(BUILDDIR)/$2: $$(BUILDDIR)/stamp $1 | $$(PRE_TARGETS) - $$(VQ)$$(ECHO) $$(ECHOFLAGS) " COMPILE: $1" - $$(Q)$$(CC) -MMD -MP $$($3) -o $$@ -c $1 - -diff -ruwN source/libnsfb/Makefile source-new/libnsfb/Makefile ---- source/libnsfb/Makefile 2023-12-28 07:57:22.311338000 +0700 -+++ source-new/libnsfb/Makefile 2025-07-20 11:58:36.652747547 +0700 -@@ -43,10 +43,10 @@ - NSFB_XCB_PKG_NAMES := xcb xcb-icccm xcb-image xcb-keysyms xcb-atom - - # determine which surface handlers can be compiled based upon avalable library --$(eval $(call pkg_config_package_available,NSFB_VNC_AVAILABLE,libvncserver)) -+#$(eval $(call pkg_config_package_available,NSFB_VNC_AVAILABLE,libvncserver)) - $(eval $(call pkg_config_package_available,NSFB_SDL_AVAILABLE,sdl)) --$(eval $(call pkg_config_package_available,NSFB_XCB_AVAILABLE,$(NSFB_XCB_PKG_NAMES))) --$(eval $(call pkg_config_package_available,NSFB_WLD_AVAILABLE,wayland-client)) -+#$(eval $(call pkg_config_package_available,NSFB_XCB_AVAILABLE,$(NSFB_XCB_PKG_NAMES))) -+#$(eval $(call pkg_config_package_available,NSFB_WLD_AVAILABLE,wayland-client)) - - # Flags and setup for each support library - ifeq ($(NSFB_SDL_AVAILABLE),yes) -diff -ruwN source/libnsfb/src/plot.h source-new/libnsfb/src/plot.h ---- source/libnsfb/src/plot.h 2023-12-28 07:57:22.315338000 +0700 -+++ source-new/libnsfb/src/plot.h 2025-07-20 11:58:36.652747547 +0700 -@@ -46,7 +46,7 @@ - #error "Endian determination failed" - #endif - #else -- #include -+ #include - #if defined(__BYTE_ORDER__) - #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ - #define NSFB_BE_BYTE_ORDER -diff -ruwN source/netsurf/Makefile.config source-new/netsurf/Makefile.config ---- source/netsurf/Makefile.config 1970-01-01 07:00:00.000000000 +0700 -+++ source-new/netsurf/Makefile.config 2025-07-20 11:58:36.652747547 +0700 -@@ -0,0 +1,28 @@ -+override NETSURF_HOMEPAGE := "https://www.redox-os.org/" -+override NETSURF_FB_FRONTEND := sdl -+ -+override NETSURF_USE_JPEG := YES -+override NETSURF_USE_BMP := YES -+override NETSURF_USE_OPENSSL := YES -+override NETSURF_USE_CURL := YES -+override NETSURF_USE_PNG := YES -+ -+override NETSURF_USE_LIBICONV_PLUG := NO -+override NETSURF_USE_NSSVG := NO -+override NETSURF_USE_RSVG := NO -+override NETSURF_USE_DUKTAPE := YES -+override NETSURF_USE_HARU_PDF := NO -+override NETSURF_USE_VIDEO := NO -+ -+override NETSURF_FB_FONTLIB := freetype -+override NETSURF_FB_FONTPATH := /usr/share/fonts/ -+override NETSURF_FB_FONT_SANS_SERIF := Sans/Fira/Regular.ttf -+override NETSURF_FB_FONT_SANS_SERIF_BOLD := Sans/Fira/Bold.ttf -+override NETSURF_FB_FONT_SANS_SERIF_ITALIC := Sans/Fira/Regular.ttf -+override NETSURF_FB_FONT_SANS_SERIF_ITALIC_BOLD := Sans/Fira/Bold.ttf -+override NETSURF_FB_FONT_SERIF := Sans/Fira/Regular.ttf -+override NETSURF_FB_FONT_SERIF_BOLD := Sans/Fira/Bold.ttf -+override NETSURF_FB_FONT_MONOSPACE := Mono/Fira/Regular.ttf -+override NETSURF_FB_FONT_MONOSPACE_BOLD := Mono/Fira/Bold.ttf -+override NETSURF_FB_FONT_CURSIVE := Sans/Fira/Regular.ttf -+override NETSURF_FB_FONT_FANTASY := Sans/Fira/Regular.ttf -diff -ruwN source/netsurf/frontends/framebuffer/Makefile source-new/netsurf/frontends/framebuffer/Makefile ---- source/netsurf/frontends/framebuffer/Makefile 2023-12-28 07:57:22.987320000 +0700 -+++ source-new/netsurf/frontends/framebuffer/Makefile 2025-07-20 11:58:36.662747547 +0700 -@@ -200,7 +200,7 @@ - install-framebuffer: - $(VQ)echo " INSTALL: $(DESTDIR)/$(PREFIX)" - $(Q)$(INSTALL) -d $(DESTDIR)/$(NETSURF_FRAMEBUFFER_BIN) -- $(Q)$(INSTALL) -T $(EXETARGET) $(DESTDIR)/$(NETSURF_FRAMEBUFFER_BIN)/netsurf-fb -+ $(Q)$(INSTALL) $(EXETARGET) $(DESTDIR)/$(NETSURF_FRAMEBUFFER_BIN)/netsurf-fb - $(Q)$(INSTALL) -d $(DESTDIR)/$(NETSURF_FRAMEBUFFER_RESOURCES) - $(Q)for F in $(NETSURF_FRAMEBUFFER_RESOURCE_LIST); do $(INSTALL) -m 644 $(FRONTEND_RESOURCES_DIR)/$$F $(DESTDIR)/$(NETSURF_FRAMEBUFFER_RESOURCES); done - $(Q)$(INSTALL) -m 644 -T $(MESSAGES_TARGET)/en/Messages $(DESTDIR)/$(NETSURF_FRAMEBUFFER_RESOURCES)/Messages -diff -ruwN source/netsurf/utils/config.h source-new/netsurf/utils/config.h ---- source/netsurf/utils/config.h 2023-12-28 07:57:23.095317100 +0700 -+++ source-new/netsurf/utils/config.h 2025-07-20 12:12:51.782724549 +0700 -@@ -63,7 +63,8 @@ - defined(__BEOS__) || \ - defined(__amigaos4__) || \ - defined(__AMIGA__) || \ -- defined(__MINT__)) -+ defined(__MINT__) || \ -+ defined(__redox__)) - #undef HAVE_STRPTIME - #undef HAVE_STRFTIME - #else -@@ -136,7 +137,7 @@ - #endif - - #define HAVE_MMAP --#if (defined(_WIN32) || defined(__riscos__) || defined(__HAIKU__) || defined(__BEOS__) || defined(__amigaos4__) || defined(__AMIGA__) || defined(__MINT__)) -+#if (defined(_WIN32) || defined(__riscos__) || defined(__HAIKU__) || defined(__BEOS__) || defined(__amigaos4__) || defined(__AMIGA__) || defined(__MINT__) || defined(__redox__)) - #undef HAVE_MMAP - #endif - -@@ -149,7 +150,7 @@ - #define HAVE_DIRFD - #define HAVE_UNLINKAT - #define HAVE_FSTATAT --#if (defined(_WIN32) || defined(__riscos__) || defined(__HAIKU__) || defined(__BEOS__) || defined(__amigaos4__) || defined(__AMIGA__) || defined(__MINT__)) -+#if (defined(_WIN32) || defined(__riscos__) || defined(__HAIKU__) || defined(__BEOS__) || defined(__amigaos4__) || defined(__AMIGA__) || defined(__MINT__) || defined(__redox__)) - #undef HAVE_DIRFD - #undef HAVE_UNLINKAT - #undef HAVE_FSTATAT diff --git a/recipes/wip/db/mariadb/redox.patch b/recipes/wip/db/mariadb/redox.patch deleted file mode 100644 index 59e6273d6b..0000000000 --- a/recipes/wip/db/mariadb/redox.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -ruwN source/mysys/mysys_priv.h source-new/mysys/mysys_priv.h ---- source/mysys/mysys_priv.h 2025-11-14 00:00:49.000000000 +0700 -+++ source-new/mysys/mysys_priv.h 2026-03-14 05:20:38.369176577 +0700 -@@ -142,7 +142,7 @@ - #endif - #endif - --#ifdef O_PATH -+#if defined(O_PATH) && !defined(__redox__) /* need openat */ - #define HAVE_OPEN_PARENT_DIR_NOSYMLINKS - const char *my_open_parent_dir_nosymlinks(const char *pathname, int *pdfd); - #define NOSYMLINK_FUNCTION_BODY(AT,NOAT) \ - diff --git a/recipes/wip/db/postgresql18/redox.patch b/recipes/wip/db/postgresql18/redox.patch deleted file mode 100644 index 117068fe52..0000000000 --- a/recipes/wip/db/postgresql18/redox.patch +++ /dev/null @@ -1,40 +0,0 @@ -diff --color -ruwN source/meson.build source-new/meson.build ---- source/meson.build 2026-02-24 04:56:43.000000000 +0700 -+++ source-new/meson.build 2026-03-14 10:58:35.570033768 +0700 -@@ -256,6 +256,10 @@ - # LDFLAGS. - ldflags += ['-Wl,-z,now', '-Wl,-z,relro'] - -+elif host_system == 'redox' -+ sema_kind = 'unnamed_posix' -+ shmem_kind = 'sysv' -+ - elif host_system == 'openbsd' - # you're ok - -diff --color -ruwN source/src/include/port/redox.h source-new/src/include/port/redox.h ---- source/src/include/port/redox.h 1970-01-01 07:00:00.000000000 +0700 -+++ source-new/src/include/port/redox.h 2026-03-14 10:50:26.877146350 +0700 -@@ -0,0 +1 @@ -+/* src/include/port/redox.h */ -diff --color -ruwN source/src/makefiles/Makefile.redox source-new/src/makefiles/Makefile.redox ---- source/src/makefiles/Makefile.redox 1970-01-01 07:00:00.000000000 +0700 -+++ source-new/src/makefiles/Makefile.redox 2026-03-14 10:51:25.313879766 +0700 -@@ -0,0 +1,6 @@ -+rpath = -Wl,-R'$(rpathdir)' -+ -+ -+# Rule for building a shared library from a single .o file -+%.so: %.o -+ $(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@ -diff --color -ruwN source/src/template/redox source-new/src/template/redox ---- source/src/template/redox 1970-01-01 07:00:00.000000000 +0700 -+++ source-new/src/template/redox 2026-03-14 10:55:40.896750233 +0700 -@@ -0,0 +1,7 @@ -+# src/template/redox -+ -+# Prefer unnamed POSIX semaphores -+PREFERRED_SEMAPHORES=UNNAMED_POSIX -+ -+# Extra CFLAGS for code that will go into a shared library -+CFLAGS_SL="-fPIC" diff --git a/recipes/wip/dev/lang/nodejs-21/redox.patch b/recipes/wip/dev/lang/nodejs-21/redox.patch deleted file mode 100644 index 4aedc563d6..0000000000 --- a/recipes/wip/dev/lang/nodejs-21/redox.patch +++ /dev/null @@ -1,621 +0,0 @@ -diff -ruwN source/configure source-new/configure ---- source/configure 2024-04-10 19:46:11.000000000 +0700 -+++ source-new/configure 2025-11-30 18:13:57.842696765 +0700 -@@ -4,6 +4,7 @@ - # Note that the mix of single and double quotes is intentional, - # as is the fact that the ] goes on a new line. - _=[ 'exec' '/bin/sh' '-c' ''' -+command -v python3.13 >/dev/null && exec python3.13 "$0" "$@" - command -v python3.12 >/dev/null && exec python3.12 "$0" "$@" - command -v python3.11 >/dev/null && exec python3.11 "$0" "$@" - command -v python3.10 >/dev/null && exec python3.10 "$0" "$@" -@@ -24,7 +25,7 @@ - from distutils.spawn import find_executable as which - - print('Node.js configure: Found Python {}.{}.{}...'.format(*sys.version_info)) --acceptable_pythons = ((3, 12), (3, 11), (3, 10), (3, 9), (3, 8), (3, 7), (3, 6)) -+acceptable_pythons = ((3, 13), (3, 12), (3, 11), (3, 10), (3, 9), (3, 8), (3, 7), (3, 6)) - if sys.version_info[:2] in acceptable_pythons: - import configure - else: -diff -ruwN source/configure.py source-new/configure.py ---- source/configure.py 2024-04-10 19:46:11.000000000 +0700 -+++ source-new/configure.py 2025-10-10 13:46:04.244040340 +0700 -@@ -46,7 +46,7 @@ - parser = argparse.ArgumentParser() - - valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux', -- 'android', 'aix', 'cloudabi', 'os400', 'ios') -+ 'android', 'aix', 'cloudabi', 'os400', 'ios', 'redox') - valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'mips64el', 'ppc', - 'ppc64', 'x64', 'x86', 'x86_64', 's390x', 'riscv64', 'loong64') - valid_arm_float_abi = ('soft', 'softfp', 'hard') -diff -ruwN source/deps/v8/bazel/config/BUILD.bazel source-new/deps/v8/bazel/config/BUILD.bazel ---- source/deps/v8/bazel/config/BUILD.bazel 2024-04-10 19:46:12.000000000 +0700 -+++ source-new/deps/v8/bazel/config/BUILD.bazel 2025-10-10 15:52:40.317126983 +0700 -@@ -144,6 +144,11 @@ - ) - - config_setting( -+ name = "is_redox", -+ constraint_values = ["@platforms//os:redox"], -+) -+ -+config_setting( - name = "is_linux", - constraint_values = ["@platforms//os:linux"], - ) -@@ -204,6 +209,7 @@ - selects.config_setting_group( - name = "is_non_android_posix", - match_any = [ -+ ":is_redox", - ":is_linux", - ":is_macos", - ], -diff -ruwN source/deps/v8/BUILD.bazel source-new/deps/v8/BUILD.bazel ---- source/deps/v8/BUILD.bazel 2024-04-10 19:46:12.000000000 +0700 -+++ source-new/deps/v8/BUILD.bazel 2025-10-10 16:05:33.775461039 +0700 -@@ -758,6 +758,11 @@ - "src/base/debug/stack_trace_posix.cc", - "src/base/platform/platform-darwin.cc", - ], -+ "@v8//bazel/config:is_redox": [ -+ "src/base/debug/stack_trace_posix.cc", -+ "src/base/platform/platform-redox.cc", -+ "src/base/platform/platform-redox.h", -+ ], - "@v8//bazel/config:is_windows": [ - "src/base/debug/stack_trace_win.cc", - "src/base/platform/platform-win32.cc", -diff -ruwN source/deps/v8/BUILD.gn source-new/deps/v8/BUILD.gn ---- source/deps/v8/BUILD.gn 2024-04-10 19:46:12.000000000 +0700 -+++ source-new/deps/v8/BUILD.gn 2025-10-10 21:27:40.939874152 +0700 -@@ -5538,8 +5538,9 @@ - if (v8_enable_webassembly) { - # iOS Xcode simulator builds run on an x64 target. iOS and macOS are both - # based on Darwin and thus POSIX-compliant to a similar degree. -- if (is_linux || is_chromeos || is_mac || is_ios || -+ if (is_linux || is_redox || is_chromeos || is_mac || is_ios || - target_os == "freebsd") { -+ assert(false, "gatchs") - sources += [ - "src/trap-handler/handler-inside-posix.cc", - "src/trap-handler/handler-outside-posix.cc", -@@ -5590,8 +5591,8 @@ - if (v8_enable_webassembly) { - # Trap handling is enabled on arm64 Mac and Linux and in simulators on - # x64 on Linux, Mac, and Windows. -- if ((current_cpu == "arm64" && (is_linux || is_chromeos || is_apple)) || -- (current_cpu == "x64" && (is_linux || is_chromeos || is_mac))) { -+ if ((current_cpu == "arm64" && (is_linux || is_redox || is_chromeos || is_apple)) || -+ (current_cpu == "x64" && (is_linux || is_redox || is_chromeos || is_mac))) { - sources += [ - "src/trap-handler/handler-inside-posix.cc", - "src/trap-handler/handler-outside-posix.cc", -@@ -6174,6 +6175,11 @@ - "src/base/debug/stack_trace_posix.cc", - "src/base/platform/platform-darwin.cc", - ] -+ } else if (is_redox) { -+ sources += [ -+ "src/base/debug/stack_trace_posix.cc", -+ "src/base/platform/platform-redox.cc", -+ ] - } else if (is_ios) { - sources += [ - "src/base/debug/stack_trace_posix.cc", -diff -ruwN source/deps/v8/include/v8config.h source-new/deps/v8/include/v8config.h ---- source/deps/v8/include/v8config.h 2024-04-10 19:46:12.000000000 +0700 -+++ source-new/deps/v8/include/v8config.h 2025-10-10 22:03:04.057821844 +0700 -@@ -159,6 +159,11 @@ - # define V8_OS_QNX 1 - # define V8_OS_STRING "qnx" - -+#elif defined(__redox__) -+# define V8_OS_POSIX 1 -+# define V8_OS_REDOX 1 -+# define V8_OS_STRING "redox" -+ - #elif defined(_WIN32) - # define V8_OS_WIN 1 - # define V8_OS_STRING "windows" -@@ -185,6 +190,7 @@ - && !defined(V8_TARGET_OS_IOS) \ - && !defined(V8_TARGET_OS_LINUX) \ - && !defined(V8_TARGET_OS_MACOS) \ -+ && !defined(V8_TARGET_OS_REDOX) \ - && !defined(V8_TARGET_OS_WIN) \ - && !defined(V8_TARGET_OS_CHROMEOS) - # error No known target OS defined. -@@ -197,6 +203,7 @@ - || defined(V8_TARGET_OS_IOS) \ - || defined(V8_TARGET_OS_LINUX) \ - || defined(V8_TARGET_OS_MACOS) \ -+ || defined(V8_TARGET_OS_REDOX) \ - || defined(V8_TARGET_OS_WIN) \ - || defined(V8_TARGET_OS_CHROMEOS) - # error A target OS is defined but V8_HAVE_TARGET_OS is unset. -@@ -223,6 +230,10 @@ - # define V8_TARGET_OS_MACOS - #endif - -+#ifdef V8_OS_REDOX -+# define V8_TARGET_OS_REDOX -+#endif -+ - #ifdef V8_OS_WIN - # define V8_TARGET_OS_WIN - #endif -@@ -239,6 +250,8 @@ - # define V8_TARGET_OS_STRING "linux" - #elif defined(V8_TARGET_OS_MACOS) - # define V8_TARGET_OS_STRING "macos" -+#elif defined(V8_TARGET_OS_REDOX) -+# define V8_TARGET_OS_STRING "redox" - #elif defined(V8_TARGET_OS_WINDOWS) - # define V8_TARGET_OS_STRING "windows" - #else -diff -ruwN source/deps/v8/src/base/platform/memory.h source-new/deps/v8/src/base/platform/memory.h ---- source/deps/v8/src/base/platform/memory.h 2024-04-10 19:46:12.000000000 +0700 -+++ source-new/deps/v8/src/base/platform/memory.h 2025-10-10 13:46:04.297422792 +0700 -@@ -23,9 +23,9 @@ - #include - #endif // !V8_OS_DARWIN - --#if (V8_OS_POSIX && !V8_OS_AIX && !V8_OS_SOLARIS) || V8_OS_WIN -+#if (V8_OS_POSIX && !V8_OS_AIX && !V8_OS_SOLARIS && !V8_OS_REDOX) || V8_OS_WIN - #define V8_HAS_MALLOC_USABLE_SIZE 1 --#endif // (V8_OS_POSIX && !V8_OS_AIX && !V8_OS_SOLARIS) || V8_OS_WIN -+#endif // (V8_OS_POSIX && !V8_OS_AIX && !V8_OS_SOLARIS && !V8_OS_REDOX) || V8_OS_WIN - - namespace v8::base { - -diff -ruwN source/deps/v8/src/base/platform/platform-posix.cc source-new/deps/v8/src/base/platform/platform-posix.cc ---- source/deps/v8/src/base/platform/platform-posix.cc 2024-04-10 19:46:12.000000000 +0700 -+++ source-new/deps/v8/src/base/platform/platform-posix.cc 2025-10-10 13:46:04.416447015 +0700 -@@ -28,6 +28,10 @@ - #include // for sysctl - #endif - -+#if defined(__redox__) -+ #define PTHREAD_STACK_MIN 1024 * 1024 -+#endif -+ - #if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT) - #define LOG_TAG "v8" - #include -@@ -69,7 +73,7 @@ - #include - #endif - --#if !defined(_AIX) && !defined(V8_OS_FUCHSIA) -+#if !defined(_AIX) && !defined(V8_OS_FUCHSIA) && !defined(V8_OS_REDOX) - #include - #endif - -@@ -135,7 +139,7 @@ - int flags = MAP_ANONYMOUS; - flags |= (page_type == PageType::kShared) ? MAP_SHARED : MAP_PRIVATE; - if (access == OS::MemoryPermission::kNoAccess) { --#if !V8_OS_AIX && !V8_OS_FREEBSD && !V8_OS_QNX -+#if !V8_OS_AIX && !V8_OS_FREEBSD && !V8_OS_QNX && !V8_OS_REDOX - flags |= MAP_NORESERVE; - #endif // !V8_OS_AIX && !V8_OS_FREEBSD && !V8_OS_QNX - #if V8_OS_QNX -@@ -565,14 +569,8 @@ - // MADV_FREE_REUSABLE sometimes fails, so fall back to MADV_DONTNEED. - ret = madvise(address, size, MADV_DONTNEED); - } --#elif defined(_AIX) || defined(V8_OS_SOLARIS) -- int ret = madvise(reinterpret_cast(address), size, MADV_FREE); -- if (ret != 0 && errno == ENOSYS) { -- return true; // madvise is not available on all systems. -- } -- if (ret != 0 && errno == EINVAL) { -- ret = madvise(reinterpret_cast(address), size, MADV_DONTNEED); -- } -+#elif defined(_AIX) || defined(V8_OS_SOLARIS) || defined(V8_OS_REDOX) -+ int ret = 0; // madvise is not available on all systems. - #else - int ret = madvise(address, size, MADV_DONTNEED); - #endif -diff -ruwN source/deps/v8/src/base/platform/platform-redox.cc source-new/deps/v8/src/base/platform/platform-redox.cc ---- source/deps/v8/src/base/platform/platform-redox.cc 1970-01-01 07:00:00.000000000 +0700 -+++ source-new/deps/v8/src/base/platform/platform-redox.cc 2025-10-10 15:23:18.233737033 +0700 -@@ -0,0 +1,63 @@ -+// Copyright 2014 the V8 project authors. All rights reserved. -+// Use of this source code is governed by a BSD-style license that can be -+// found in the LICENSE file. -+ -+// Platform specific code for Redox goes here. For the POSIX comaptible parts -+// the implementation is in platform-posix.cc. -+ -+#include -+#include -+#include -+#include -+ -+#include -+ -+#undef MAP_TYPE -+ -+#include "src/base/macros.h" -+#include "src/base/platform/platform-posix-time.h" -+#include "src/base/platform/platform-posix.h" -+#include "src/base/platform/platform.h" -+ -+namespace v8 { -+namespace base { -+ -+ -+int64_t get_gmt_offset(const tm& localtm) { -+ // replacement for tm->tm_gmtoff field in glibc -+ // returns seconds east of UTC, taking DST into account -+ struct timeval tv; -+ struct timezone tz; -+ int ret_code = gettimeofday(&tv, &tz); -+ // 0 = success, -1 = failure -+ DCHECK_NE(ret_code, -1); -+ if (ret_code == -1) { -+ return 0; -+ } -+ return (-tz.tz_minuteswest * 60) + (localtm.tm_isdst > 0 ? 3600 : 0); -+} -+ -+TimezoneCache* OS::CreateTimezoneCache() { -+ return new PosixDefaultTimezoneCache(); -+} -+ -+static unsigned StringToLong(char* buffer) { -+ return static_cast(strtol(buffer, nullptr, 16)); -+} -+ -+std::vector OS::GetSharedLibraryAddresses() { -+ UNREACHABLE(); -+} -+ -+void OS::SignalCodeMovingGC() {} -+ -+void OS::AdjustSchedulingParams() {} -+ -+std::vector OS::GetFreeMemoryRangesWithin( -+ OS::Address boundary_start, OS::Address boundary_end, size_t minimum_size, -+ size_t alignment) { -+ return {}; -+} -+ -+} // namespace base -+} // namespace v8 -diff -ruwN source/deps/v8/src/libsampler/sampler.cc source-new/deps/v8/src/libsampler/sampler.cc ---- source/deps/v8/src/libsampler/sampler.cc 2024-04-10 19:46:13.000000000 +0700 -+++ source-new/deps/v8/src/libsampler/sampler.cc 2025-10-10 13:46:04.417193700 +0700 -@@ -16,11 +16,11 @@ - #include - #include - --#if !V8_OS_QNX && !V8_OS_AIX -+#if !V8_OS_QNX && !V8_OS_AIX && !V8_OS_REDOX - #include - #endif - --#if V8_OS_AIX || V8_TARGET_ARCH_S390X -+#if V8_OS_AIX || V8_OS_REDOX || V8_TARGET_ARCH_S390X - - #include "src/base/platform/time.h" - -diff -ruwN source/deps/v8/src/trap-handler/handler-inside-posix.cc source-new/deps/v8/src/trap-handler/handler-inside-posix.cc ---- source/deps/v8/src/trap-handler/handler-inside-posix.cc 2024-04-10 19:46:13.000000000 +0700 -+++ source-new/deps/v8/src/trap-handler/handler-inside-posix.cc 2025-10-11 12:32:56.074858844 +0700 -@@ -23,6 +23,7 @@ - // context. Some additional code is used both inside and outside the signal - // handler. This code can be found in handler-shared.cc. - -+#ifndef __redox__ - #include "src/trap-handler/handler-inside-posix.h" - - #include -@@ -102,7 +103,6 @@ - asm("v8_simulator_probe_memory_continuation"); - #endif - #endif // V8_TRAP_HANDLER_VIA_SIMULATOR -- - bool TryHandleSignal(int signum, siginfo_t* info, void* context) { - // Ensure the faulting thread was actually running Wasm code. This should be - // the first check in the trap handler to guarantee that the -@@ -197,3 +197,5 @@ - } // namespace trap_handler - } // namespace internal - } // namespace v8 -+ -+#endif -diff -ruwN source/deps/v8/src/trap-handler/handler-inside-posix.h source-new/deps/v8/src/trap-handler/handler-inside-posix.h ---- source/deps/v8/src/trap-handler/handler-inside-posix.h 2024-04-10 19:46:13.000000000 +0700 -+++ source-new/deps/v8/src/trap-handler/handler-inside-posix.h 2025-10-10 21:44:55.221873295 +0700 -@@ -4,7 +4,7 @@ - - #ifndef V8_TRAP_HANDLER_HANDLER_INSIDE_POSIX_H_ - #define V8_TRAP_HANDLER_HANDLER_INSIDE_POSIX_H_ -- -+#ifndef __redox__ - #include - - #include "include/v8config.h" -@@ -28,5 +28,5 @@ - } // namespace trap_handler - } // namespace internal - } // namespace v8 -- -+#endif - #endif // V8_TRAP_HANDLER_HANDLER_INSIDE_POSIX_H_ -diff -ruwN source/deps/v8/src/wasm/std-object-sizes.h source-new/deps/v8/src/wasm/std-object-sizes.h ---- source/deps/v8/src/wasm/std-object-sizes.h 2024-04-10 19:46:13.000000000 +0700 -+++ source-new/deps/v8/src/wasm/std-object-sizes.h 2025-10-10 13:46:04.591737114 +0700 -@@ -54,24 +54,7 @@ - return raw * 4 / 3; - } - --// To make it less likely for size estimation functions to become outdated --// when the classes they're responsible for change, we insert static asserts --// about the respective class's size into them to at least catch some possible --// future modifications. Since object sizes are toolchain specific, we define --// restrictions here under which we enable these checks. --// When one of these checks fails, that probably means you've added fields to --// a class guarded by it. Update the respective EstimateCurrentMemoryConsumption --// function accordingly, and then update the check's expected size. --#if V8_TARGET_ARCH_X64 && defined(__clang__) && V8_TARGET_OS_LINUX && \ -- !V8_USE_ADDRESS_SANITIZER && !V8_USE_MEMORY_SANITIZER && defined(DEBUG) && \ -- V8_COMPRESS_POINTERS && !defined(V8_GC_MOLE) && defined(_LIBCPP_VERSION) --#define UPDATE_WHEN_CLASS_CHANGES(classname, size) \ -- static_assert(sizeof(classname) == size, \ -- "Update {EstimateCurrentMemoryConsumption} when adding " \ -- "fields to " #classname) --#else - #define UPDATE_WHEN_CLASS_CHANGES(classname, size) (void)0 --#endif - - } // namespace v8::internal::wasm - -diff -ruwN source/src/debug_utils.cc source-new/src/debug_utils.cc ---- source/src/debug_utils.cc 2024-04-10 19:46:14.000000000 +0700 -+++ source-new/src/debug_utils.cc 2025-10-10 13:46:04.755669055 +0700 -@@ -14,7 +14,7 @@ - - #if defined(__linux__) && !defined(__GLIBC__) || \ - defined(__UCLIBC__) || \ -- defined(_AIX) -+ defined(_AIX) || defined(__redox__) - #define HAVE_EXECINFO_H 0 - #else - #define HAVE_EXECINFO_H 1 -diff -ruwN source/src/node_credentials.cc source-new/src/node_credentials.cc ---- source/src/node_credentials.cc 2024-04-10 19:46:14.000000000 +0700 -+++ source-new/src/node_credentials.cc 2025-10-10 13:46:04.816900208 +0700 -@@ -182,7 +182,7 @@ - - static uid_t uid_by_name(Isolate* isolate, Local value) { - if (value->IsUint32()) { -- static_assert(std::is_same::value); -+ // static_assert(std::is_same::value); - return value.As()->Value(); - } else { - Utf8Value name(isolate, value); -@@ -192,7 +192,7 @@ - - static gid_t gid_by_name(Isolate* isolate, Local value) { - if (value->IsUint32()) { -- static_assert(std::is_same::value); -+ // static_assert(std::is_same::value); - return value.As()->Value(); - } else { - Utf8Value name(isolate, value); -diff -ruwN source/src/node_dotenv.cc source-new/src/node_dotenv.cc ---- source/src/node_dotenv.cc 2024-04-10 19:46:14.000000000 +0700 -+++ source-new/src/node_dotenv.cc 2025-11-30 23:39:21.486092041 +0700 -@@ -16,10 +16,14 @@ - * The inspiration for this implementation comes from the original dotenv code, - * available at https://github.com/motdotla/dotenv - */ -+ -+// redox crash on compiling this regex -+#if !defined(__redox__) - const std::regex LINE( - "\\s*(?:export\\s+)?([\\w.-]+)(?:\\s*=\\s*?|:\\s+?)(\\s*'(?:\\\\'|[^']" - ")*'|\\s*\"(?:\\\\\"|[^\"])*\"|\\s*`(?:\\\\`|[^`])*`|[^#\r\n]+)?\\s*(?" - ":#.*)?"); // NOLINT(whitespace/line_length) -+#endif - - std::vector Dotenv::GetPathFromArgs( - const std::vector& args) { -@@ -102,6 +106,7 @@ - } - - void Dotenv::ParseContent(const std::string_view content) { -+#if !defined(__redox__) - std::string lines = std::string(content); - lines = std::regex_replace(lines, std::regex("\r\n?"), "\n"); - -@@ -131,6 +136,7 @@ - store_.insert_or_assign(std::string(key), value); - lines = match.suffix(); - } -+#endif - } - - Dotenv::ParseResult Dotenv::ParsePath(const std::string_view path) { -diff -ruwN source/src/node_report.cc source-new/src/node_report.cc ---- source/src/node_report.cc 2024-04-10 19:46:14.000000000 +0700 -+++ source-new/src/node_report.cc 2025-10-10 13:46:05.190512964 +0700 -@@ -524,7 +524,7 @@ - while (line != -1) { - l = ss.substr(0, line); - l.erase(l.begin(), std::find_if(l.begin(), l.end(), [](int ch) { -- return !std::iswspace(ch); -+ return !std::isspace(ch); - })); - writer->json_element(l); - ss = ss.substr(line + 1); -diff -ruwN source/tools/gyp/pylib/gyp/common.py source-new/tools/gyp/pylib/gyp/common.py ---- source/tools/gyp/pylib/gyp/common.py 2024-04-10 19:46:15.000000000 +0700 -+++ source-new/tools/gyp/pylib/gyp/common.py 2025-10-10 21:36:23.972976264 +0700 -@@ -445,6 +445,8 @@ - return "netbsd" - if sys.platform.startswith("aix"): - return "aix" -+ if sys.platform.startswith("redox"): -+ return "redox" - if sys.platform.startswith(("os390", "zos")): - return "zos" - if sys.platform == "os400": -diff -ruwN source/tools/gyp/pylib/gyp/generator/make.py source-new/tools/gyp/pylib/gyp/generator/make.py ---- source/tools/gyp/pylib/gyp/generator/make.py 2024-04-10 19:46:15.000000000 +0700 -+++ source-new/tools/gyp/pylib/gyp/generator/make.py 2025-10-10 14:27:51.496602771 +0700 -@@ -1739,7 +1739,8 @@ - libraries = gyp.common.uniquer(libraries) - if self.flavor == "mac": - libraries = self.xcode_settings.AdjustLibraries(libraries) -- self.WriteList(libraries, "LIBS") -+ # patch out unneeded libraries for host toolchain (js2c) -+ self.WriteList(libraries if self.toolset != "host" else ['-luv', '-L%s/usr/lib' % os.environ['COOKBOOK_TOOLCHAIN']], "LIBS") - self.WriteLn( - "%s: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))" - % QuoteSpaces(self.output_binary) -@@ -1868,7 +1868,7 @@ - self.flavor not in ("mac", "openbsd", "netbsd", "win") - and not self.is_standalone_static_library - ): -- if self.flavor in ("linux", "android"): -+ if self.flavor in ("linux", "android", "redox"): - self.WriteMakeRule( - [self.output_binary], - link_deps, -@@ -1883,7 +1883,7 @@ - postbuilds=postbuilds, - ) - else: -- if self.flavor in ("linux", "android"): -+ if self.flavor in ("linux", "android", "redox"): - self.WriteMakeRule( - [self.output_binary], - link_deps, -diff -ruwN source/tools/v8_gypfiles/d8.gyp source-new/tools/v8_gypfiles/d8.gyp ---- source/tools/v8_gypfiles/d8.gyp 2024-04-10 19:46:15.000000000 +0700 -+++ source-new/tools/v8_gypfiles/d8.gyp 2025-10-10 21:34:47.141291162 +0700 -@@ -47,7 +47,7 @@ - }], - ['(OS=="linux" or OS=="mac" or OS=="freebsd" or OS=="netbsd" \ - or OS=="openbsd" or OS=="solaris" or OS=="android" \ -- or OS=="qnx" or OS=="aix" or OS=="os400")', { -+ or OS=="qnx" or OS=="aix" or OS=="redox" or OS=="os400")', { - 'sources': [ '<(V8_ROOT)/src/d8/d8-posix.cc', ] - }], - [ 'OS=="win"', { -diff -ruwN source/tools/v8_gypfiles/toolchain.gypi source-new/tools/v8_gypfiles/toolchain.gypi ---- source/tools/v8_gypfiles/toolchain.gypi 2024-04-10 19:46:15.000000000 +0700 -+++ source-new/tools/v8_gypfiles/toolchain.gypi 2025-10-10 21:57:05.129575573 +0700 -@@ -575,6 +575,12 @@ - 'V8_TARGET_OS_MACOS', - ] - }], -+ ['OS=="redox"', { -+ 'defines': [ -+ 'V8_HAVE_TARGET_OS', -+ 'V8_TARGET_OS_REDOX', -+ ] -+ }], - ['OS=="win"', { - 'defines': [ - 'V8_HAVE_TARGET_OS', -@@ -661,7 +667,7 @@ - ], - }], - ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \ -- or OS=="netbsd" or OS=="qnx" or OS=="aix" or OS=="os400"', { -+ or OS=="netbsd" or OS=="qnx" or OS=="aix" or OS=="redox" or OS=="os400"', { - 'conditions': [ - [ 'v8_no_strict_aliasing==1', { - 'cflags': [ '-fno-strict-aliasing' ], -diff -ruwN source/tools/v8_gypfiles/v8.gyp source-new/tools/v8_gypfiles/v8.gyp ---- source/tools/v8_gypfiles/v8.gyp 2024-04-10 19:46:15.000000000 +0700 -+++ source-new/tools/v8_gypfiles/v8.gyp 2025-10-11 12:14:17.137386469 +0700 -@@ -606,7 +606,7 @@ - }], - ['v8_enable_webassembly==1', { - 'conditions': [ -- ['OS=="linux" or OS=="mac" or OS=="ios" or OS=="freebsd"', { -+ ['OS=="linux" or OS=="redox" or OS=="mac" or OS=="ios" or OS=="freebsd"', { - 'sources': [ - '<(V8_ROOT)/src/trap-handler/handler-inside-posix.h', - ], -@@ -637,7 +637,7 @@ - }], - ['v8_enable_webassembly==1', { - 'conditions': [ -- ['((_toolset=="host" and host_arch=="arm64" or _toolset=="target" and target_arch=="arm64") and (OS=="linux" or OS=="mac")) or ((_toolset=="host" and host_arch=="x64" or _toolset=="target" and target_arch=="x64") and (OS=="linux" or OS=="mac"))', { -+ ['((_toolset=="host" and host_arch=="arm64" or _toolset=="target" and target_arch=="arm64") and (OS=="linux" or OS=="mac")) or ((_toolset=="host" and host_arch=="x64" or _toolset=="target" and target_arch=="x64") and (OS=="linux" or OS=="redox" or OS=="mac"))', { - 'sources': [ - '<(V8_ROOT)/src/trap-handler/handler-inside-posix.h', - ], -@@ -941,7 +941,7 @@ - }], - ['v8_enable_webassembly==1', { - 'conditions': [ -- ['OS=="linux" or OS=="mac" or OS=="ios" or OS=="freebsd"', { -+ ['OS=="linux" or OS=="redox" or OS=="mac" or OS=="ios" or OS=="freebsd"', { - 'sources': [ - '<(V8_ROOT)/src/trap-handler/handler-inside-posix.cc', - '<(V8_ROOT)/src/trap-handler/handler-outside-posix.cc', -@@ -969,7 +969,7 @@ - 'conditions': [ - ['v8_enable_webassembly==1', { - 'conditions': [ -- ['((_toolset=="host" and host_arch=="arm64" or _toolset=="target" and target_arch=="arm64") and (OS=="linux" or OS=="mac" or OS=="ios")) or ((_toolset=="host" and host_arch=="x64" or _toolset=="target" and target_arch=="x64") and (OS=="linux" or OS=="mac"))', { -+ ['((_toolset=="host" and host_arch=="arm64" or _toolset=="target" and target_arch=="arm64") and (OS=="linux" or OS=="redox" or OS=="mac" or OS=="ios")) or ((_toolset=="host" and host_arch=="x64" or _toolset=="target" and target_arch=="x64") and (OS=="linux" or OS=="redox" or OS=="mac"))', { - 'sources': [ - '<(V8_ROOT)/src/trap-handler/handler-inside-posix.cc', - '<(V8_ROOT)/src/trap-handler/handler-outside-posix.cc', -@@ -981,7 +981,7 @@ - '<(V8_ROOT)/src/trap-handler/handler-outside-win.cc', - ], - }], -- ['(_toolset=="host" and host_arch=="x64" or _toolset=="target" and target_arch=="x64") and (OS=="linux" or OS=="mac" or OS=="win")', { -+ ['(_toolset=="host" and host_arch=="x64" or _toolset=="target" and target_arch=="x64") and (OS=="linux" or OS=="redox" or OS=="mac" or OS=="win")', { - 'sources': [ - '<(V8_ROOT)/src/trap-handler/handler-outside-simulator.cc', - ], -@@ -1323,6 +1323,35 @@ - # end of conditions from 'BUILD.gn' - - # Node.js validated -+ ['OS=="redox"', { -+ 'link_settings': { -+ 'target_conditions': [ -+ ['_toolset=="host"', { -+ 'libraries': [ -+ '-ldl' -+ ], -+ }], -+ ], -+ }, -+ 'sources': [ -+ '<(V8_ROOT)/src/base/platform/platform-posix.cc', -+ '<(V8_ROOT)/src/base/platform/platform-posix.h', -+ '<(V8_ROOT)/src/base/platform/platform-posix-time.cc', -+ '<(V8_ROOT)/src/base/platform/platform-posix-time.h', -+ '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc', -+ ], -+ 'target_conditions': [ -+ ['_toolset=="host"', { -+ 'sources': [ -+ '<(V8_ROOT)/src/base/platform/platform-linux.cc', -+ ], -+ }, { -+ 'sources': [ -+ '<(V8_ROOT)/src/base/platform/platform-redox.cc', -+ ], -+ }], -+ ], -+ }], - ['OS=="solaris"', { - 'link_settings': { - 'libraries': [ diff --git a/recipes/wip/dev/lang/nodejs-24/01_redox.patch b/recipes/wip/dev/lang/nodejs-24/01_redox.patch deleted file mode 100644 index f80a899361..0000000000 --- a/recipes/wip/dev/lang/nodejs-24/01_redox.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ruwN source/configure.py source-new/configure.py ---- source/configure.py 2025-07-31 15:37:54.000000000 +0700 -+++ source-new/configure.py 2025-08-03 00:37:51.836604059 +0700 -@@ -44,7 +44,7 @@ - # parse our options - parser = argparse.ArgumentParser() - --valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux', -+valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux', 'redox', - 'android', 'aix', 'cloudabi', 'os400', 'ios', 'openharmony') - valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'mips64el', - 'ppc64', 'x64', 'x86', 'x86_64', 's390x', 'riscv64', 'loong64') diff --git a/recipes/wip/dev/lang/php80/redox.patch b/recipes/wip/dev/lang/php80/redox.patch deleted file mode 100644 index 4fcf8326cf..0000000000 --- a/recipes/wip/dev/lang/php80/redox.patch +++ /dev/null @@ -1,92 +0,0 @@ -diff -ruwN source/configure source-new/configure ---- source/configure 2023-08-04 00:13:08.000000000 +0700 -+++ source-new/configure 2025-09-20 05:04:59.993364619 +0700 -@@ -46043,7 +46043,7 @@ - fi - - -- ax_cxx_compile_alternatives="11 0x" ax_cxx_compile_cxx11_required=truednl -+ ax_cxx_compile_alternatives="17 0x" ax_cxx_compile_cxx11_required=truednl - ac_ext=cpp - ac_cpp='$CXXCPP $CPPFLAGS' - ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -@@ -72692,7 +72692,7 @@ - printf %s "(cached) " >&6 - else $as_nop - -- php_cv_crypt_r_style=none -+ php_cv_crypt_r_style=struct_crypt_data_gnu_source - cat confdefs.h - <<_ACEOF >conftest.$ac_ext - /* end confdefs.h. */ - -diff -ruwN source/ext/intl/config.m4 source-new/ext/intl/config.m4 ---- source/ext/intl/config.m4 2023-08-04 00:13:08.000000000 +0700 -+++ source-new/ext/intl/config.m4 2025-09-20 05:05:18.892414632 +0700 -@@ -83,7 +83,7 @@ - breakiterator/codepointiterator_methods.cpp" - - PHP_REQUIRE_CXX() -- PHP_CXX_COMPILE_STDCXX(11, mandatory, PHP_INTL_STDCXX) -+ PHP_CXX_COMPILE_STDCXX(17, mandatory, PHP_INTL_STDCXX) - PHP_INTL_CXX_FLAGS="$INTL_COMMON_FLAGS $PHP_INTL_STDCXX $ICU_CXXFLAGS" - case $host_alias in - *cygwin*) PHP_INTL_CXX_FLAGS="$PHP_INTL_CXX_FLAGS -D_POSIX_C_SOURCE=200809L" -diff -ruwN source/ext/phar/Makefile.frag source-new/ext/phar/Makefile.frag ---- source/ext/phar/Makefile.frag 2023-08-04 00:13:08.000000000 +0700 -+++ source-new/ext/phar/Makefile.frag 2025-09-19 23:19:19.020178026 +0700 -@@ -9,20 +9,7 @@ - pharcmd: $(builddir)/phar.php $(builddir)/phar.phar - - PHP_PHARCMD_SETTINGS = -n -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1' -d phar.readonly=0 --PHP_PHARCMD_EXECUTABLE = ` \ -- if test -x "$(top_builddir)/$(SAPI_CLI_PATH)"; then \ -- $(top_srcdir)/build/shtool echo -n -- "$(top_builddir)/$(SAPI_CLI_PATH) -n"; \ -- if test "x$(PHP_MODULES)" != "x"; then \ -- $(top_srcdir)/build/shtool echo -n -- " -d extension_dir=$(top_builddir)/modules"; \ -- for i in bz2 zlib phar; do \ -- if test -f "$(top_builddir)/modules/$$i.la"; then \ -- . $(top_builddir)/modules/$$i.la; $(top_srcdir)/build/shtool echo -n -- " -d extension=$$dlname"; \ -- fi; \ -- done; \ -- fi; \ -- else \ -- $(top_srcdir)/build/shtool echo -n -- "$(PHP_EXECUTABLE)"; \ -- fi;` -+PHP_PHARCMD_EXECUTABLE = "true" - PHP_PHARCMD_BANG = `$(top_srcdir)/build/shtool echo -n -- "$(INSTALL_ROOT)$(bindir)/$(program_prefix)php$(program_suffix)$(EXEEXT)";` - - $(builddir)/phar/phar.inc: $(srcdir)/phar/phar.inc -@@ -42,9 +29,3 @@ - - install-pharcmd: pharcmd - -@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir) -- $(INSTALL) $(builddir)/phar.phar $(INSTALL_ROOT)$(bindir)/$(program_prefix)phar$(program_suffix).phar -- -@rm -f $(INSTALL_ROOT)$(bindir)/$(program_prefix)phar$(program_suffix) -- $(LN_S) -f $(program_prefix)phar$(program_suffix).phar $(INSTALL_ROOT)$(bindir)/$(program_prefix)phar$(program_suffix) -- @$(mkinstalldirs) $(INSTALL_ROOT)$(mandir)/man1 -- @$(INSTALL_DATA) $(builddir)/phar.1 $(INSTALL_ROOT)$(mandir)/man1/$(program_prefix)phar$(program_suffix).1 -- @$(INSTALL_DATA) $(builddir)/phar.phar.1 $(INSTALL_ROOT)$(mandir)/man1/$(program_prefix)phar$(program_suffix).phar.1 -diff -ruwN source/ext/posix/posix.c source-new/ext/posix/posix.c ---- source/ext/posix/posix.c 2023-08-04 00:13:08.000000000 +0700 -+++ source-new/ext/posix/posix.c 2025-09-19 22:21:28.998031846 +0700 -@@ -443,7 +443,7 @@ - - ZEND_PARSE_PARAMETERS_NONE(); - -- if ((ticks = times(&t)) == -1) { -+ { - POSIX_G(last_error) = errno; - RETURN_FALSE; - } -diff -ruwN source/ext/standard/hrtime.c source-new/ext/standard/hrtime.c ---- source/ext/standard/hrtime.c 2023-08-04 00:13:08.000000000 +0700 -+++ source-new/ext/standard/hrtime.c 2025-09-19 23:34:34.839471333 +0700 -@@ -70,6 +70,8 @@ - return -1; - } - -+#elif defined(__redox__) -+ /* pass */ - #elif PHP_HRTIME_PLATFORM_POSIX - - #if !_POSIX_MONOTONIC_CLOCK diff --git a/recipes/wip/dev/lang/python37/redox.patch b/recipes/wip/dev/lang/python37/redox.patch deleted file mode 100644 index 6f1da623d5..0000000000 --- a/recipes/wip/dev/lang/python37/redox.patch +++ /dev/null @@ -1,91 +0,0 @@ -diff -ruwN source/configure source-new/configure ---- source/configure 2019-07-08 12:03:50.000000000 -0600 -+++ source-new/configure 2019-07-16 21:25:29.432607847 -0600 -@@ -3261,6 +3261,9 @@ - *-*-cygwin*) - ac_sys_system=Cygwin - ;; -+ *-*-redox*) -+ ac_sys_system=Redox -+ ;; - *) - # for now, limit cross builds to known configurations - MACHDEP="unknown" -@@ -3293,7 +3296,7 @@ - - if test "$cross_compiling" = yes; then - case "$host" in -- *-*-linux*) -+ *-*-linux*|*-*-redox*) - case "$host_cpu" in - arm*) - _host_cpu=arm -diff -ruwN source/Lib/distutils/util.py source-new/Lib/distutils/util.py ---- source/Lib/distutils/util.py 2019-07-08 12:03:50.000000000 -0600 -+++ source-new/Lib/distutils/util.py 2019-07-16 22:07:35.994862914 -0600 -@@ -131,7 +131,7 @@ - if not os.path.isabs(pathname): - return os.path.join(new_root, pathname) - else: -- return os.path.join(new_root, pathname[1:]) -+ return os.path.join(new_root, pathname.lstrip('/')) - - elif os.name == 'nt': - (drive, path) = os.path.splitdrive(pathname) -diff -ruwN source/Modules/main.c source-new/Modules/main.c ---- source/Modules/main.c 2019-07-08 12:03:50.000000000 -0600 -+++ source-new/Modules/main.c 2019-07-16 21:46:53.037866142 -0600 -@@ -56,6 +56,16 @@ - } \ - } while (0) - -+#if defined(__redox__) -+wchar_t * wcstok(wchar_t * wcs, const wchar_t * delimiters, wchar_t ** ptr) { -+ return NULL; -+} -+ -+long wcstol(const wchar_t *restrict nptr, wchar_t **restrict endptr, int base) { -+ return 0; -+} -+#endif -+ - #ifdef MS_WINDOWS - #define WCSTOK wcstok_s - #else -diff -ruwN source/Python/pathconfig.c source-new/Python/pathconfig.c ---- source/Python/pathconfig.c 2019-07-08 12:03:50.000000000 -0600 -+++ source-new/Python/pathconfig.c 2019-07-16 21:55:34.549726910 -0600 -@@ -5,6 +5,10 @@ - #include "internal/pystate.h" - #include - -+#if defined(__redox__) -+wchar_t * wcstok(wchar_t * wcs, const wchar_t * delimiters, wchar_t ** ptr); -+#endif -+ - #ifdef __cplusplus - extern "C" { - #endif -diff -ruwN source/Python/pytime.c source-new/Python/pytime.c ---- source/Python/pytime.c 2019-07-08 12:03:50.000000000 -0600 -+++ source-new/Python/pytime.c 2019-07-16 21:36:53.233119225 -0600 -@@ -7,6 +7,19 @@ - #include /* mach_absolute_time(), mach_timebase_info() */ - #endif - -+#if defined(__redox__) -+int clock_getres(clockid_t clk_id, struct timespec *res) { -+ if (res) { -+ res->tv_sec = 0; -+ res->tv_nsec = 1000; -+ return 0; -+ } else { -+ errno = EFAULT; -+ return -1; -+ } -+} -+#endif -+ - #define _PyTime_check_mul_overflow(a, b) \ - (assert(b > 0), \ - (_PyTime_t)(a) < _PyTime_MIN / (_PyTime_t)(b) \ diff --git a/recipes/wip/dev/lang/python39/redox.patch b/recipes/wip/dev/lang/python39/redox.patch deleted file mode 100644 index 5f776a9878..0000000000 --- a/recipes/wip/dev/lang/python39/redox.patch +++ /dev/null @@ -1,90 +0,0 @@ -diff -ruwN source/configure source-new/configure ---- source/configure 2021-11-16 00:43:00.000000000 +0700 -+++ source-new/configure 2025-09-17 21:31:19.787497963 +0700 -@@ -3307,6 +3307,9 @@ - *-*-vxworks*) - ac_sys_system=VxWorks - ;; -+ *-*-redox*) -+ ac_sys_system=Redox -+ ;; - *) - # for now, limit cross builds to known configurations - MACHDEP="unknown" -@@ -3331,6 +3334,7 @@ - case $MACHDEP in - aix*) MACHDEP="aix";; - linux*) MACHDEP="linux";; -+ redox*) MACHDEP="redox";; - cygwin*) MACHDEP="cygwin";; - darwin*) MACHDEP="darwin";; - '') MACHDEP="unknown";; -@@ -3342,7 +3346,7 @@ - - if test "$cross_compiling" = yes; then - case "$host" in -- *-*-linux*) -+ *-*-linux*|*-*-redox*) - case "$host_cpu" in - arm*) - _host_cpu=arm -@@ -5951,7 +5955,7 @@ - PY3LIBRARY=libpython3.so - fi - ;; -- Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*) -+ Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|Redox*) - LDLIBRARY='libpython$(LDVERSION).so' - BLDLIBRARY='-L. -lpython$(LDVERSION)' - RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} -@@ -9551,7 +9555,7 @@ - BLDSHARED="$LDSHARED" - fi - ;; -- Linux*|GNU*|QNX*|VxWorks*) -+ Linux*|GNU*|QNX*|VxWorks*|Redox*) - LDSHARED='$(CC) -shared' - LDCXXSHARED='$(CXX) -shared';; - FreeBSD*) -@@ -9620,7 +9624,7 @@ - else CCSHARED="+z"; - fi;; - Linux-android*) ;; -- Linux*|GNU*) CCSHARED="-fPIC";; -+ Linux*|GNU*|Redox*) CCSHARED="-fPIC";; - FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";; - OpenUNIX*|UnixWare*) - if test "$GCC" = "yes" -@@ -9650,7 +9654,7 @@ - LINKFORSHARED="-Wl,-E -Wl,+s";; - # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; - Linux-android*) LINKFORSHARED="-pie -Xlinker -export-dynamic";; -- Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";; -+ Linux*|GNU*|Redox*) LINKFORSHARED="-Xlinker -export-dynamic";; - # -u libsys_s pulls in all symbols in libsys - Darwin/*) - LINKFORSHARED="$extra_undefs -framework CoreFoundation" -diff -ruwN source/Include/pyport.h source-new/Include/pyport.h ---- source/Include/pyport.h 2021-11-16 00:43:00.000000000 +0700 -+++ source-new/Include/pyport.h 2025-09-17 21:31:56.613084352 +0700 -@@ -838,7 +838,7 @@ - # error "Py_TRACE_REFS ABI is not compatible with release and debug ABI" - #endif - --#if defined(__ANDROID__) || defined(__VXWORKS__) -+#if defined(__ANDROID__) || defined(__VXWORKS__) || defined(__redox__) - /* Ignore the locale encoding: force UTF-8 */ - # define _Py_FORCE_UTF8_LOCALE - #endif -diff -ruwN source/Modules/timemodule.c source-new/Modules/timemodule.c ---- source/Modules/timemodule.c 2021-11-16 00:43:00.000000000 +0700 -+++ source-new/Modules/timemodule.c 2025-09-17 21:30:18.552349106 +0700 -@@ -1416,7 +1416,7 @@ - return 0; - } - --#elif defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_PROCESS_CPUTIME_ID) -+#elif defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_PROCESS_CPUTIME_ID) && defined(CLOCK_THREAD_CPUTIME_ID) - #define HAVE_THREAD_TIME - - #if defined(__APPLE__) && defined(__has_attribute) && __has_attribute(availability) diff --git a/recipes/wip/dev/other/apr-util/redox.patch b/recipes/wip/dev/other/apr-util/redox.patch deleted file mode 100644 index 33ab356e35..0000000000 --- a/recipes/wip/dev/other/apr-util/redox.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff --git a/apu-config.in b/apu-config.in -index 82109e5..2d005c9 100644 ---- a/apu-config.in -+++ b/apu-config.in -@@ -140,12 +140,12 @@ while test $# -gt 0; do - ;; - --includes) - if test "$location" = "installed"; then -- flags="$flags -I$includedir $INCLUDES" -+ flags="$flags $INCLUDES" - elif test "$location" = "source"; then -- flags="$flags -I$APU_SOURCE_DIR/include $INCLUDES" -+ flags="$flags $INCLUDES" - else - # this is for VPATH builds -- flags="$flags -I$APU_BUILD_DIR/include -I$APU_SOURCE_DIR/include $INCLUDES" -+ flags="$flags $INCLUDES" - fi - ;; - --ldflags) -@@ -162,9 +162,9 @@ while test $# -gt 0; do - --link-ld) - if test "$location" = "installed"; then - ### avoid using -L if libdir is a "standard" location like /usr/lib -- flags="$flags -L$libdir -l$APRUTIL_LIBNAME" -+ flags="$flags -l$APRUTIL_LIBNAME" - else -- flags="$flags -L$APU_BUILD_DIR -l$APRUTIL_LIBNAME" -+ flags="$flags -l$APRUTIL_LIBNAME" - fi - ;; - --link-libtool) -@@ -178,7 +178,7 @@ while test $# -gt 0; do - ### avoid using -L if libdir is a "standard" location like /usr/lib - # Since the user is specifying they are linking with libtool, we - # *know* that -R will be recognized by libtool. -- flags="$flags -L$libdir -R$libdir -l$APRUTIL_LIBNAME" -+ flags="$flags -l$APRUTIL_LIBNAME" - else - flags="$flags $LA_FILE" - fi diff --git a/recipes/wip/dev/other/apr/redox.patch b/recipes/wip/dev/other/apr/redox.patch deleted file mode 100644 index 9d63048595..0000000000 --- a/recipes/wip/dev/other/apr/redox.patch +++ /dev/null @@ -1,175 +0,0 @@ -diff --git a/apr-config.in b/apr-config.in -index 626d3b0..b79d471 100644 ---- a/apr-config.in -+++ b/apr-config.in -@@ -180,14 +180,14 @@ while test $# -gt 0; do - ;; - --includes) - if test "$location" = "installed"; then -- flags="$flags -I$includedir $EXTRA_INCLUDES" -+ flags="$flags $EXTRA_INCLUDES" - elif test "$location" = "crosscompile"; then -- flags="$flags -I$APR_TARGET_DIR/$includedir $EXTRA_INCLUDES" -+ flags="$flags $EXTRA_INCLUDES" - elif test "$location" = "source"; then -- flags="$flags -I$APR_SOURCE_DIR/include $EXTRA_INCLUDES" -+ flags="$flags $EXTRA_INCLUDES" - else - # this is for VPATH builds -- flags="$flags -I$APR_BUILD_DIR/include -I$APR_SOURCE_DIR/include $EXTRA_INCLUDES" -+ flags="$flags $EXTRA_INCLUDES" - fi - ;; - --srcdir) -@@ -214,12 +214,12 @@ while test $# -gt 0; do - --link-ld) - if test "$location" = "installed"; then - ### avoid using -L if libdir is a "standard" location like /usr/lib -- flags="$flags -L$libdir -l${APR_LIBNAME}" -+ flags="$flags -l${APR_LIBNAME}" - elif test "$location" = "crosscompile"; then -- flags="$flags -L$APR_TARGET_DIR/$libdir -l${APR_LIBNAME}" -+ flags="$flags -l${APR_LIBNAME}" - else - ### this surely can't work since the library is in .libs? -- flags="$flags -L$APR_BUILD_DIR -l${APR_LIBNAME}" -+ flags="$flags -l${APR_LIBNAME}" - fi - ;; - --link-libtool) -@@ -233,9 +233,9 @@ while test $# -gt 0; do - ### avoid using -L if libdir is a "standard" location like /usr/lib - # Since the user is specifying they are linking with libtool, we - # *know* that -R will be recognized by libtool. -- flags="$flags -L$libdir -R$libdir -l${APR_LIBNAME}" -+ flags="$flags -l${APR_LIBNAME}" - elif test "$location" = "crosscompile"; then -- flags="$flags -L${APR_TARGET_DIR}/$libdir -l${APR_LIBNAME}" -+ flags="$flags -l${APR_LIBNAME}" - else - flags="$flags $LA_FILE" - fi -diff --git a/file_io/unix/open.c b/file_io/unix/open.c -index 49eb727..7b28aba 100644 ---- a/file_io/unix/open.c -+++ b/file_io/unix/open.c -@@ -101,12 +101,15 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, - #endif - - if ((flag & APR_FOPEN_READ) && (flag & APR_FOPEN_WRITE)) { -+ fprintf(stderr, "afo flag RDRW\n"); - oflags = O_RDWR; - } - else if (flag & APR_FOPEN_READ) { -+ fprintf(stderr, "afo flag RDONLY\n"); - oflags = O_RDONLY; - } - else if (flag & APR_FOPEN_WRITE) { -+ fprintf(stderr, "afo flag WRONLY\n"); - oflags = O_WRONLY; - } - else { -@@ -114,8 +117,10 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, - } - - if (flag & APR_FOPEN_CREATE) { -+ fprintf(stderr, "afo flag CREAT\n"); - oflags |= O_CREAT; - if (flag & APR_FOPEN_EXCL) { -+ fprintf(stderr, "afo flag EXCL\n"); - oflags |= O_EXCL; - } - } -@@ -124,19 +129,23 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, - } - - if (flag & APR_FOPEN_APPEND) { -+ fprintf(stderr, "afo flag APPEND\n"); - oflags |= O_APPEND; - } - if (flag & APR_FOPEN_TRUNCATE) { -+ fprintf(stderr, "afo flag TRUNC\n"); - oflags |= O_TRUNC; - } - #ifdef O_BINARY - if (flag & APR_FOPEN_BINARY) { -+ fprintf(stderr, "afo flag BINARY\n"); - oflags |= O_BINARY; - } - #endif - - if (flag & APR_FOPEN_NONBLOCK) { - #ifdef O_NONBLOCK -+ fprintf(stderr, "afo flag NONBLOCK\n"); - oflags |= O_NONBLOCK; - #else - return APR_ENOTIMPL; -@@ -147,14 +156,17 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, - /* Introduced in Linux 2.6.23. Silently ignored on earlier Linux kernels. - */ - if (!(flag & APR_FOPEN_NOCLEANUP)) { -+ fprintf(stderr, "afo flag CLOEXEC\n"); - oflags |= O_CLOEXEC; - } - #endif - - #if APR_HAS_LARGE_FILES && defined(_LARGEFILE64_SOURCE) -+ fprintf(stderr, "afo flag LARGEFILE\n"); - oflags |= O_LARGEFILE; - #elif defined(O_LARGEFILE) - if (flag & APR_FOPEN_LARGEFILE) { -+ fprintf(stderr, "afo flag LARGEFILE\n"); - oflags |= O_LARGEFILE; - } - #endif -@@ -164,18 +176,22 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, - rv = apr_thread_mutex_create(&thlock, - APR_THREAD_MUTEX_DEFAULT, pool); - if (rv) { -+ fprintf(stderr, "afo ret 1 %d\n", rv); - return rv; - } - } - #endif - - if (perm == APR_OS_DEFAULT) { -+ fprintf(stderr, "open %d %s\n", oflags, fname); - fd = open(fname, oflags, 0666); - } - else { -+ fprintf(stderr, "open %s %d %d\n", fname, oflags, apr_unix_perms2mode(perm)); - fd = open(fname, oflags, apr_unix_perms2mode(perm)); - } - if (fd < 0) { -+ fprintf(stderr, "afo ret 2 %d\n", errno); - return errno; - } - if (!(flag & APR_FOPEN_NOCLEANUP)) { -@@ -188,12 +204,14 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, - - if ((flags = fcntl(fd, F_GETFD)) == -1) { - close(fd); -+ fprintf(stderr, "afo ret 3 %d\n", errno); - return errno; - } - if ((flags & FD_CLOEXEC) == 0) { - flags |= FD_CLOEXEC; - if (fcntl(fd, F_SETFD, flags) == -1) { - close(fd); -+ fprintf(stderr, "afo ret 4 %d\n", errno); - return errno; - } - } -diff --git a/network_io/unix/sockopt.c b/network_io/unix/sockopt.c -index 6194e9b..a903f91 100644 ---- a/network_io/unix/sockopt.c -+++ b/network_io/unix/sockopt.c -@@ -372,7 +372,7 @@ apr_status_t apr_socket_opt_get(apr_socket_t *sock, - - apr_status_t apr_socket_atmark(apr_socket_t *sock, int *atmark) - { --#ifndef BEOS_R5 -+#if !defined(BEOS_R5) && !defined(__redox__) - int oobmark; - - if (ioctl(sock->socketdes, SIOCATMARK, (void*) &oobmark) < 0) diff --git a/recipes/wip/dev/python/ruff/redox.patch b/recipes/wip/dev/python/ruff/redox.patch deleted file mode 100644 index 9cdd9b7324..0000000000 --- a/recipes/wip/dev/python/ruff/redox.patch +++ /dev/null @@ -1,140 +0,0 @@ -diff --git a/Cargo.lock b/Cargo.lock -index 2fe49f0b..aa1a7c85 100644 ---- a/Cargo.lock -+++ b/Cargo.lock -@@ -573,14 +573,13 @@ checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831" - [[package]] - name = "clearscreen" - version = "4.0.5" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "5def4343d62f01f67ff1a49147e4a15112e936c6a6a3f8ff7a29394e76468244" -+source = "git+https://github.com/willnode/clearscreen?branch=redox#f4c6937931b51daaf5ed15e60ecfde5c55e40c18" - dependencies = [ - "nix 0.31.1", - "terminfo", - "thiserror 2.0.18", - "which", -- "windows-sys 0.60.2", -+ "windows-sys 0.61.0", - ] - - [[package]] -@@ -710,7 +709,7 @@ version = "3.1.1" - source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "faf9468729b8cbcea668e36183cb69d317348c2e08e994829fb56ebfdfbaac34" - dependencies = [ -- "windows-sys 0.59.0", -+ "windows-sys 0.52.0", - ] - - [[package]] -@@ -1077,7 +1076,7 @@ dependencies = [ - "libc", - "option-ext", - "redox_users", -- "windows-sys 0.60.2", -+ "windows-sys 0.61.0", - ] - - [[package]] -@@ -1169,7 +1168,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" - dependencies = [ - "libc", -- "windows-sys 0.59.0", -+ "windows-sys 0.52.0", - ] - - [[package]] -@@ -1835,7 +1834,7 @@ dependencies = [ - "portable-atomic", - "portable-atomic-util", - "serde_core", -- "windows-sys 0.59.0", -+ "windows-sys 0.52.0", - ] - - [[package]] -@@ -3731,7 +3730,7 @@ dependencies = [ - "errno", - "libc", - "linux-raw-sys", -- "windows-sys 0.59.0", -+ "windows-sys 0.52.0", - ] - - [[package]] -@@ -4139,7 +4138,7 @@ dependencies = [ - "getrandom 0.4.1", - "once_cell", - "rustix", -- "windows-sys 0.59.0", -+ "windows-sys 0.52.0", - ] - - [[package]] -@@ -5344,7 +5343,7 @@ version = "0.1.11" - source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" - dependencies = [ -- "windows-sys 0.59.0", -+ "windows-sys 0.52.0", - ] - - [[package]] -diff --git a/Cargo.toml b/Cargo.toml -index 5bedb191..ff6aa34a 100644 ---- a/Cargo.toml -+++ b/Cargo.toml -@@ -73,7 +73,7 @@ cachedir = { version = "0.3.1" } - camino = { version = "1.1.7" } - clap = { version = "4.5.3", features = ["derive"] } - clap_complete_command = { version = "0.6.0" } --clearscreen = { version = "4.0.0" } -+clearscreen = { git = "https://github.com/willnode/clearscreen", branch = "redox" } - codspeed-criterion-compat = { version = "4.0.4", default-features = false } - colored = { version = "3.0.0" } - compact_str = "0.9.0" -@@ -282,8 +282,7 @@ if_not_else = "allow" - large_stack_arrays = "allow" - - [profile.release] --lto = "fat" --codegen-units = 16 -+lto = "thin" - - # Some crates don't change as much but benefit more from - # more expensive optimization passes, so we selectively -diff --git a/crates/ruff/Cargo.toml b/crates/ruff/Cargo.toml -index b972d4b0..4172e1bd 100644 ---- a/crates/ruff/Cargo.toml -+++ b/crates/ruff/Cargo.toml -@@ -70,7 +70,7 @@ tracing = { workspace = true, features = ["log"] } - walkdir = { workspace = true } - wild = { workspace = true } - --[target.'cfg(all(not(target_os = "windows"), not(target_os = "openbsd"), not(target_os = "aix"), not(target_os = "android"), any(target_arch = "x86_64", target_arch = "aarch64", target_arch = "powerpc64", target_arch = "riscv64")))'.dependencies] -+[target.'cfg(all(not(target_os = "windows"), not(target_os = "openbsd"), not(target_os = "aix"), not(target_os = "android"), not(target_os = "redox"), any(target_arch = "x86_64", target_arch = "aarch64", target_arch = "powerpc64", target_arch = "riscv64")))'.dependencies] - tikv-jemallocator = { workspace = true } - - [target.'cfg(target_os = "windows")'.dependencies] -diff --git a/crates/ruff/src/main.rs b/crates/ruff/src/main.rs -index 4342a360..19211e58 100644 ---- a/crates/ruff/src/main.rs -+++ b/crates/ruff/src/main.rs -@@ -17,6 +17,7 @@ static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; - not(target_os = "openbsd"), - not(target_os = "aix"), - not(target_os = "android"), -+ not(target_os = "redox"), - any( - target_arch = "x86_64", - target_arch = "aarch64", -diff --git a/rust-toolchain.toml b/rust-toolchain.toml -deleted file mode 100644 -index 79d20990..00000000 ---- a/rust-toolchain.toml -+++ /dev/null -@@ -1,2 +0,0 @@ --[toolchain] --channel = "1.93" diff --git a/recipes/wip/games/engines/love/redox.patch b/recipes/wip/games/engines/love/redox.patch deleted file mode 100644 index c02f25d245..0000000000 --- a/recipes/wip/games/engines/love/redox.patch +++ /dev/null @@ -1,47 +0,0 @@ -diff -ruwN source-old/CMakeLists.txt source/CMakeLists.txt ---- source-old/CMakeLists.txt 2023-12-03 05:44:36.000000000 -0700 -+++ source/CMakeLists.txt 2025-10-29 07:23:56.896601947 -0600 -@@ -188,7 +188,7 @@ - find_package(ModPlug REQUIRED) - find_package(OpenAL REQUIRED) - find_package(OpenGL REQUIRED) -- find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2main) -+ #find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2main) - find_package(Theora REQUIRED) - find_package(Vorbis REQUIRED) - find_package(ZLIB REQUIRED) -diff -ruwN source-old/src/common/config.h source/src/common/config.h ---- source-old/src/common/config.h 2023-12-03 05:44:36.000000000 -0700 -+++ source/src/common/config.h 2025-10-28 18:38:57.870055872 -0600 -@@ -48,7 +48,7 @@ - # define LOVE_MACOSX 1 - # endif - #endif --#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) -+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined (__redox__) - // I know it's not linux, but it seems most "linux-only" code is bsd-compatible - # define LOVE_LINUX 1 - #endif -diff -ruwN source-old/src/libraries/luasocket/libluasocket/compat.c source/src/libraries/luasocket/libluasocket/compat.c ---- source-old/src/libraries/luasocket/libluasocket/compat.c 2023-12-03 05:44:36.000000000 -0700 -+++ source/src/libraries/luasocket/libluasocket/compat.c 2025-10-28 18:38:57.870118680 -0600 -@@ -1,6 +1,6 @@ - #include "compat.h" - --#if LUA_VERSION_NUM==501 -+#if LUA_VERSION_NUM==501 && !defined(__redox__) - /* - ** Adapted from Lua 5.2 - */ -diff -ruwN source-old/src/libraries/luasocket/libluasocket/compat.h source/src/libraries/luasocket/libluasocket/compat.h ---- source-old/src/libraries/luasocket/libluasocket/compat.h 2023-12-03 05:44:36.000000000 -0700 -+++ source/src/libraries/luasocket/libluasocket/compat.h 2025-10-28 18:38:57.870166330 -0600 -@@ -4,7 +4,7 @@ - #include "lua.h" - #include "lauxlib.h" - --#if LUA_VERSION_NUM==501 -+#if LUA_VERSION_NUM==501 && !defined(__redox__) - void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup); - #endif - diff --git a/recipes/wip/games/engines/luanti/redox.patch b/recipes/wip/games/engines/luanti/redox.patch deleted file mode 100644 index 059621a9e8..0000000000 --- a/recipes/wip/games/engines/luanti/redox.patch +++ /dev/null @@ -1,273 +0,0 @@ -diff --git a/irr/src/CGUIEditBox.cpp b/irr/src/CGUIEditBox.cpp -index 5639a36a6..37a0b6151 100644 ---- a/irr/src/CGUIEditBox.cpp -+++ b/irr/src/CGUIEditBox.cpp -@@ -464,10 +464,10 @@ void CGUIEditBox::processKeyLR(const SEvent::SKeyInput &input, s32 &new_mark_beg - new_pos = i; - if (std::abs(i - CursorPos) > 2) { - // End of word -- if (!std::iswspace(prev_c) && std::iswspace(c)) -+ if (!::iswspace(prev_c) && ::iswspace(c)) - break; - // End of a sentence. -- if (std::iswpunct(prev_c) && !std::iswpunct(c)) -+ if (iswpunct(prev_c) && !iswpunct(c)) - break; - } - prev_c = c; -diff --git a/irr/src/CIrrDeviceSDL.cpp b/irr/src/CIrrDeviceSDL.cpp -index a44213d7c..dbf3611b1 100644 ---- a/irr/src/CIrrDeviceSDL.cpp -+++ b/irr/src/CIrrDeviceSDL.cpp -@@ -331,7 +331,9 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters ¶m) : - // Minetest has its own code to synthesize mouse events from touch events, - // so we prevent SDL from doing it. - SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0"); -+#ifdef SDL_HINT_MOUSE_TOUCH_EVENTS - SDL_SetHint(SDL_HINT_MOUSE_TOUCH_EVENTS, "0"); -+#endif - - #if defined(SDL_HINT_APP_NAME) - SDL_SetHint(SDL_HINT_APP_NAME, "Luanti"); -diff --git a/irr/src/CMakeLists.txt b/irr/src/CMakeLists.txt -index b7360311a..b1c578726 100644 ---- a/irr/src/CMakeLists.txt -+++ b/irr/src/CMakeLists.txt -@@ -232,7 +232,7 @@ if(USE_SDL2) - set(USE_SDL2_SHARED TRUE) - endif() - if(NOT ANDROID) -- find_package(SDL2 REQUIRED) -+ #find_package(SDL2 REQUIRED) - else() - # provided by AndroidLibs.cmake - endif() -@@ -246,16 +246,16 @@ if(USE_SDL2) - #error\n\ - #endif\n\ - int main() {}" CHECK_SDL_VERSION) -- if(NOT CHECK_SDL_VERSION) -- message(FATAL_ERROR "SDL2 is too old, required is at least 2.0.10!") -- endif() -+ #if(NOT CHECK_SDL_VERSION) -+ # message(FATAL_ERROR "SDL2 is too old, required is at least 2.0.10!") -+ #endif() - - # ...no target either. -- if(NOT TARGET SDL2::SDL2) -- add_library(SDL2::SDL2 SHARED IMPORTED) -- set_target_properties(SDL2::SDL2 PROPERTIES -- IMPORTED_LOCATION "${SDL2_LIBRARIES}") -- endif() -+ #if(NOT TARGET SDL2::SDL2) -+ # add_library(SDL2::SDL2 SHARED IMPORTED) -+ # set_target_properties(SDL2::SDL2 PROPERTIES -+ # IMPORTED_LOCATION "${SDL2_LIBRARIES}") -+ #endif() - endif() - - # More special config -@@ -583,8 +583,9 @@ target_link_libraries(IrrlichtMt PRIVATE - ${ZLIB_LIBRARY} - ${JPEG_LIBRARY} - ${PNG_LIBRARY} -- "$<$:SDL2::SDL2>" -- "$<$:SDL2::SDL2-static>" -+ ${SDL2_LIBRARIES} -+ #"$<$:SDL2::SDL2>" -+ #"$<$:SDL2::SDL2-static>" - - "$<$:${OPENGL_LIBRARIES}>" - ${EGL_LIBRARY} -diff --git a/src/client/client.cpp b/src/client/client.cpp -index b1dfa5993..aec96371c 100644 ---- a/src/client/client.cpp -+++ b/src/client/client.cpp -@@ -1808,10 +1808,12 @@ void Client::showUpdateProgressTexture(void *args, u32 progress, u32 max_progres - - if (do_draw) { - targs->last_time_ms = time_ms; -+#if !defined(__redox__) - std::wostringstream strm; - strm << targs->text_base << L" " << targs->last_percent << L"%..."; - m_rendering_engine->draw_load_screen(strm.str(), targs->guienv, targs->tsrc, 0, - 72 + (u16) ((18. / 100.) * (double) targs->last_percent)); -+#endif - } - } - -diff --git a/src/porting.cpp b/src/porting.cpp -index 711b65db6..32520eef9 100644 ---- a/src/porting.cpp -+++ b/src/porting.cpp -@@ -25,7 +25,7 @@ - #if !defined(_WIN32) - #include - #include -- #if !defined(__ANDROID__) -+ #if !defined(__ANDROID__) && !defined(__redox__) - #include - #endif - #endif -@@ -883,7 +883,7 @@ static bool open_uri(const std::string &uri) - const char *argv[] = {"open", uri.c_str(), NULL}; - return posix_spawnp(NULL, "open", NULL, NULL, (char**)argv, - (*_NSGetEnviron())) == 0; --#else -+#elif !defined(__redox__) - const char *argv[] = {"xdg-open", uri.c_str(), NULL}; - return posix_spawnp(NULL, "xdg-open", NULL, NULL, (char**)argv, environ) == 0; - #endif -diff --git a/src/porting.h b/src/porting.h -index 1a4bb9e7b..cc252f3e1 100644 ---- a/src/porting.h -+++ b/src/porting.h -@@ -162,6 +162,12 @@ inline void os_get_clock(struct timespec *ts) - # endif - struct timeval tv; - gettimeofday(&tv, NULL); -+#ifndef TIMEVAL_TO_TIMESPEC -+#define TIMEVAL_TO_TIMESPEC(tv, ts) ( \ -+ (ts)->tv_sec = (tv)->tv_sec, \ -+ (ts)->tv_nsec = (tv)->tv_usec * 1000, \ -+ (void)0 ) -+#endif - TIMEVAL_TO_TIMESPEC(&tv, ts); - #endif - } -diff --git a/src/server.cpp b/src/server.cpp -index 3c03e68a6..4825bcd62 100644 ---- a/src/server.cpp -+++ b/src/server.cpp -@@ -245,10 +245,14 @@ void Server::ShutdownState::tick(float dtime, Server *server) - - std::wstring Server::ShutdownState::getShutdownTimerMessage() const - { -+#if defined(__redox__) -+ return L""; -+#else - std::wstringstream ws; - ws << L"*** Server shutting down in " - << duration_to_string(myround(m_timer)).c_str() << "."; - return ws.str(); -+#endif - } - - /* -@@ -3180,11 +3184,15 @@ std::wstring Server::handleChat(const std::string &name, - if (player) { - switch (player->canSendChatMessage()) { - case RPLAYER_CHATRESULT_FLOODING: { -+#if defined(__redox__) -+ return L""; -+#else - std::wstringstream ws; - ws << L"You cannot send more messages. You are limited to " - << g_settings->getFloat("chat_message_limit_per_10sec") - << L" messages per 10 seconds."; - return ws.str(); -+#endif - } - case RPLAYER_CHATRESULT_KICK: - DenyAccess(player->getPeerId(), SERVER_ACCESSDENIED_CUSTOM_STRING, -diff --git a/src/threading/thread.cpp b/src/threading/thread.cpp -index 679eaa113..59dc8cc63 100644 ---- a/src/threading/thread.cpp -+++ b/src/threading/thread.cpp -@@ -332,7 +332,7 @@ bool Thread::setPriority(int prio) - - return SetThreadPriority(win32_native_handle(), prio); - --#else -+#elif !defined(__redox__) - - struct sched_param sparam; - int policy; -diff --git a/src/translation.cpp b/src/translation.cpp -index 71469507d..ecb9d1b52 100644 ---- a/src/translation.cpp -+++ b/src/translation.cpp -@@ -126,6 +126,7 @@ void Translations::loadTrTranslation(const std::string &data) - // '\n' may also be escaped by '@'. - // All other escapes are preserved. - -+#if !defined(__redox__) - size_t i = 0; - std::wostringstream word1, word2; - while (i < wline.length() && wline[i] != L'=') { -@@ -192,6 +193,7 @@ void Translations::loadTrTranslation(const std::string &data) - } - - addTranslation(textdomain, word1.str(), word2.str()); -+#endif - } - } - -@@ -341,12 +343,14 @@ void Translations::loadPoEntry(const std::wstring &basefilename, const GettextPl - addTranslation(textdomain, original, translated->second); - } else { - std::vector translations; -+ #if !defined(__redox__) - for (int i = 0; ; i++) { - auto translated = entry.find(L"msgstr[" + std::to_wstring(i) + L"]"); - if (translated == entry.end()) - break; - translations.push_back(translated->second); - } -+ #endif - addPluralTranslation(textdomain, plural_form, original, translations); - addPluralTranslation(textdomain, plural_form, plural->second, translations); - } -diff --git a/src/unittest/test_serialization.cpp b/src/unittest/test_serialization.cpp -index 839a09060..9cbcc056d 100644 ---- a/src/unittest/test_serialization.cpp -+++ b/src/unittest/test_serialization.cpp -@@ -61,15 +61,21 @@ template std::string mkstr(const char (&s)[N]) - void TestSerialization::buildTestStrings() - { - std::ostringstream tmp_os; -+#if !defined(__redox__) - std::wostringstream tmp_os_w; -+#endif - std::ostringstream tmp_os_w_encoded; - for (int i = 0; i < 256; i++) { - tmp_os << (char)i; -+#if !defined(__redox__) - tmp_os_w << (wchar_t)i; -+#endif - tmp_os_w_encoded << (char)0 << (char)i; - } - teststring2 = tmp_os.str(); -+#if !defined(__redox__) - teststring2_w = tmp_os_w.str(); -+#endif - teststring2_w_encoded = tmp_os_w_encoded.str(); - } - -diff --git a/src/util/string.cpp b/src/util/string.cpp -index aeec51cb8..411bdc84a 100644 ---- a/src/util/string.cpp -+++ b/src/util/string.cpp -@@ -721,7 +721,9 @@ static void translate_string(std::wstring_view s, Translations *translations, - continue; - } - output += L'@'; -+ #if !defined (__redox__) - output += std::to_wstring(arg_number); -+ #endif - ++arg_number; - std::wstring arg; - translate_all(s, i, translations, arg); -diff --git a/src/util/string.h b/src/util/string.h -index 78881a9a4..f5a6ed95a 100644 ---- a/src/util/string.h -+++ b/src/util/string.h -@@ -325,7 +325,7 @@ inline bool my_isspace(const char c) - - inline bool my_isspace(const wchar_t c) - { -- return std::iswspace(c); -+ return ::iswspace(c); - } - - /** diff --git a/recipes/wip/games/fps/zerospades-free/redox.patch b/recipes/wip/games/fps/zerospades-free/redox.patch deleted file mode 100644 index 615fe35714..0000000000 --- a/recipes/wip/games/fps/zerospades-free/redox.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 2f59b92..9f98ab9 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -145,7 +145,7 @@ if(CMAKE_COMPILER_IS_GNUCXX) - - if(CMAKE_BUILD_TYPE MATCHES "Release") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3") -- set(CMAKE_EXE_LINKER_FLAGS "-s") -+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s") - endif() - - elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") -diff --git a/Sources/Audio/ALFuncs.cpp b/Sources/Audio/ALFuncs.cpp -index 92c63f5..1eff792 100644 ---- a/Sources/Audio/ALFuncs.cpp -+++ b/Sources/Audio/ALFuncs.cpp -@@ -271,7 +271,8 @@ namespace al { - } - - void Link(void) { --#ifdef OPENAL_SOFT -+// redox: weak link errors -+#ifndef OPENAL_SOFT - SPLog("Using OpenAL Soft - direct linking, initializing function pointers."); - // Directly assign function pointers to OpenAL Soft functions - qalEnable = alEnable; -diff --git a/Sources/CMakeLists.txt b/Sources/CMakeLists.txt -index 4438506..46ace0a 100644 ---- a/Sources/CMakeLists.txt -+++ b/Sources/CMakeLists.txt -@@ -181,8 +181,8 @@ endif() - - if(WIN32) - target_link_libraries(OpenSpades ws2_32.lib winmm.lib) --elseif(UNIX AND NOT APPLE) -- target_link_libraries(OpenSpades Xext) -+#elseif(UNIX AND NOT APPLE) -+# target_link_libraries(OpenSpades Xext) - endif() - - if(UNIX) -diff --git a/openal-soft b/openal-soft ---- a/openal-soft -+++ b/openal-soft -@@ -1 +1 @@ diff --git a/recipes/wip/games/racing/supertuxkart/redox.patch b/recipes/wip/games/racing/supertuxkart/redox.patch deleted file mode 100644 index cd42e2d90f..0000000000 --- a/recipes/wip/games/racing/supertuxkart/redox.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff -ruwN source/src/guiengine/widgets/spinner_widget.cpp source-new/src/guiengine/widgets/spinner_widget.cpp ---- source/src/guiengine/widgets/spinner_widget.cpp 2025-10-20 04:04:17.000000000 +0700 -+++ source-new/src/guiengine/widgets/spinner_widget.cpp 2025-11-09 11:29:52.678400188 +0700 -@@ -493,10 +493,7 @@ - } - else - { -- std::wstringstream ws; -- ws << (m_value*m_step); -- std::wstring text = ws.str(); -- m_children[1].m_element->setText( text.c_str() ); -+ m_children[1].m_element->setText( stringw(m_value*m_step).c_str() ); - } - } - } diff --git a/recipes/wip/games/syobonaction/01_redox.patch b/recipes/wip/games/syobonaction/01_redox.patch deleted file mode 100644 index ad36cf73c9..0000000000 --- a/recipes/wip/games/syobonaction/01_redox.patch +++ /dev/null @@ -1,43 +0,0 @@ -diff -rupNw source-original/DxLib.cpp source/DxLib.cpp ---- source-original/DxLib.cpp 2018-12-08 19:59:16.777579338 +0100 -+++ source/DxLib.cpp 2018-12-08 02:13:39.541585079 +0100 -@@ -24,7 +24,7 @@ int DxLib_Init() - return -1; - } - -- SDL_WM_SetCaption("Syobon Action (しょぼんのアクション)", -+ SDL_WM_SetCaption("Syobon Action", - NULL); - SDL_ShowCursor(SDL_DISABLE); - -diff -rupNw source-original/main.cpp source/main.cpp ---- source-original/main.cpp 2018-12-08 19:59:16.781579399 +0100 -+++ source/main.cpp 2018-12-08 18:11:33.716589712 +0100 -@@ -1,9 +1,11 @@ - #include "main.h" -+#include - - // プログラムは WinMain から始まります - //Changed to ansi c++ main() - int main(int argc, char *argv[]) - { -+ chdir("file:/share/syobonaction/"); - parseArgs(argc, argv); - if (DxLib_Init() == -1) - return 1; -diff -rupNw source-original/Makefile source/Makefile ---- source-original/Makefile 2018-12-08 19:59:16.777579338 +0100 -+++ source/Makefile 2018-12-08 01:32:40.319685337 +0100 -@@ -1,8 +1,8 @@ - SyobonAction:main.o loadg.o DxLib.o -- gcc main.o loadg.o DxLib.o -o SyobonAction `sdl-config --libs` -lSDL_gfx -lSDL_image -lSDL_mixer -lSDL_ttf -+ ${CXX} ${LDFLAGS} main.o loadg.o DxLib.o -o SyobonAction `${SDL_CONFIG} --libs` -lSDL_gfx -lSDL_image -lSDL_mixer -lpng -ljpeg -lz -lSDL -lSDL_ttf -lfreetype -lvorbisfile -lvorbis -logg - main.o:main.cpp -- gcc -c main.cpp -+ ${CXX} ${CPPFLAGS} `${SDL_CONFIG} --cflags` -c main.cpp - loadg.o:loadg.cpp -- gcc -c loadg.cpp -+ ${CXX} ${CPPFLAGS} `${SDL_CONFIG} --cflags` -c loadg.cpp - DxLib.o:DxLib.cpp -- gcc -c DxLib.cpp -+ ${CXX} ${CPPFLAGS} `${SDL_CONFIG} --cflags` -c DxLib.cpp diff --git a/recipes/wip/icons/adwaita-icon-theme/redox.patch b/recipes/wip/icons/adwaita-icon-theme/redox.patch deleted file mode 100644 index 8b644fd858..0000000000 --- a/recipes/wip/icons/adwaita-icon-theme/redox.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff -ruwN source-old/meson.build source/meson.build ---- source-old/meson.build 2025-09-12 05:48:02.000000000 -0600 -+++ source/meson.build 2025-11-13 12:05:28.819996707 -0700 -@@ -90,14 +90,14 @@ - endforeach - endif - --gtk_update_icon_cache = find_program( -- 'gtk4-update-icon-cache', -- 'gtk-update-icon-cache', -- required : true, --) --meson.add_install_script( -- gtk_update_icon_cache, -- '-qtf', -- get_option('prefix') / adwaita_dir, -- skip_if_destdir: true, --) -+#gtk_update_icon_cache = find_program( -+# 'gtk4-update-icon-cache', -+# 'gtk-update-icon-cache', -+# required : true, -+#) -+#meson.add_install_script( -+# gtk_update_icon_cache, -+# '-qtf', -+# get_option('prefix') / adwaita_dir, -+# skip_if_destdir: true, -+#) diff --git a/recipes/wip/libs/audio/openal/redox.patch b/recipes/wip/libs/audio/openal/redox.patch deleted file mode 100644 index d787c7ce61..0000000000 --- a/recipes/wip/libs/audio/openal/redox.patch +++ /dev/null @@ -1,59 +0,0 @@ -diff -ruwN openal-soft-1.24.1/CMakeLists.txt source/CMakeLists.txt ---- openal-soft-1.24.1/CMakeLists.txt 2024-11-27 20:21:16.000000000 -0700 -+++ source/CMakeLists.txt 2025-01-09 14:35:09.422985283 -0700 -@@ -1200,7 +1200,7 @@ - set(HAVE_SDL2 1) - set(ALC_OBJS ${ALC_OBJS} alc/backends/sdl2.cpp alc/backends/sdl2.h) - set(BACKENDS "${BACKENDS} SDL2,") -- set(EXTRA_LIBS ${EXTRA_LIBS} SDL2::SDL2) -+ set(EXTRA_LIBS ${EXTRA_LIBS} ${SDL2_LIBRARIES}) - else() - message(STATUS "Could NOT find SDL2") - endif() -diff -ruwN openal-soft-1.24.1/common/alstring.cpp source/common/alstring.cpp ---- openal-soft-1.24.1/common/alstring.cpp 2024-11-27 20:21:16.000000000 -0700 -+++ source/common/alstring.cpp 2025-01-09 09:35:50.263542017 -0700 -@@ -40,8 +40,8 @@ - auto ch1end = ch1 + std::min(str0.size(), str1.size()); - while(ch1 != ch1end) - { -- const auto u0 = std::towupper(Traits::to_int_type(*ch0)); -- const auto u1 = std::towupper(Traits::to_int_type(*ch1)); -+ const auto u0 = towupper(Traits::to_int_type(*ch0)); -+ const auto u1 = towupper(Traits::to_int_type(*ch1)); - if(const auto diff = static_cast(u0-u1)) return diff; - ++ch0; ++ch1; - } -diff -ruwN openal-soft-1.24.1/common/althreads.h source/common/althreads.h ---- openal-soft-1.24.1/common/althreads.h 2024-11-27 20:21:16.000000000 -0700 -+++ source/common/althreads.h 2025-01-09 09:31:58.064326293 -0700 -@@ -9,7 +9,7 @@ - #define WIN32_LEAN_AND_MEAN - #include - --#elif defined(__APPLE__) -+#elif defined(__APPLE__) || defined(__redox__) - - #include - -@@ -79,7 +79,7 @@ - [[nodiscard]] - auto get() const noexcept -> T { return from_ptr(TlsGetValue(mTss)); } - --#elif defined(__APPLE__) -+#elif defined(__APPLE__) || defined(__redox__) - - pthread_key_t mTss{}; - -diff -ruwN openal-soft-1.24.1/core/helpers.cpp source/core/helpers.cpp ---- openal-soft-1.24.1/core/helpers.cpp 2024-11-27 20:21:16.000000000 -0700 -+++ source/core/helpers.cpp 2025-01-09 09:36:47.992595649 -0700 -@@ -372,7 +372,7 @@ - bool SetRTPriorityPthread(int prio [[maybe_unused]]) - { - int err{ENOTSUP}; --#if defined(HAVE_PTHREAD_SETSCHEDPARAM) && !defined(__OpenBSD__) -+#if defined(HAVE_PTHREAD_SETSCHEDPARAM) && !defined(__OpenBSD__) && !defined(__redox__) - /* Get the min and max priority for SCHED_RR. Limit the max priority to - * half, for now, to ensure the thread can't take the highest priority and - * go rogue. diff --git a/recipes/wip/libs/gnome/dconf/redox.patch b/recipes/wip/libs/gnome/dconf/redox.patch deleted file mode 100644 index 4fe5cfc5b1..0000000000 --- a/recipes/wip/libs/gnome/dconf/redox.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ruwN source-old/shm/dconf-shm.c source/shm/dconf-shm.c ---- source-old/shm/dconf-shm.c 2025-09-15 09:53:57.000000000 -0600 -+++ source/shm/dconf-shm.c 2025-11-15 08:08:47.412198178 -0700 -@@ -148,7 +148,7 @@ - - close (fd); - -- unlink (filename); -+ //TODO: redoxfs bug: unlink (filename); - } - - g_free (filename); diff --git a/recipes/wip/libs/gnome/glib-networking/redox.patch b/recipes/wip/libs/gnome/glib-networking/redox.patch deleted file mode 100644 index b0aaeb43b6..0000000000 --- a/recipes/wip/libs/gnome/glib-networking/redox.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ruwN source-old/tls/tests/meson.build source/tls/tests/meson.build ---- source-old/tls/tests/meson.build 2025-01-08 14:51:06.000000000 -0700 -+++ source/tls/tests/meson.build 2025-11-10 20:33:28.041098208 -0700 -@@ -40,7 +40,7 @@ - test_programs = [ - ['certificate', [], deps, [], [mock_pkcs11_module]], - ['file-database', [], deps, [], []], -- ['connection', ['mock-interaction.c'], deps, [], [mock_pkcs11_module]], -+ #TODO: RTLD_NEXT on Redox: ['connection', ['mock-interaction.c'], deps, [], [mock_pkcs11_module]], - # DTLS tests are disabled until we fix https://gitlab.gnome.org/GNOME/glib-networking/issues/49 - # ['dtls-connection', ['mock-interaction.c', 'lossy-socket.c'], deps, [], [mock_pkcs11_module]], - ] diff --git a/recipes/wip/libs/gnome/gtk3/redox.patch b/recipes/wip/libs/gnome/gtk3/redox.patch deleted file mode 100644 index 6f6d523e10..0000000000 --- a/recipes/wip/libs/gnome/gtk3/redox.patch +++ /dev/null @@ -1,92 +0,0 @@ -diff -ruwN source-old/gdk/wayland/gdkdevice-wayland.c source/gdk/wayland/gdkdevice-wayland.c ---- source-old/gdk/wayland/gdkdevice-wayland.c 2024-07-10 11:03:14.000000000 -0600 -+++ source/gdk/wayland/gdkdevice-wayland.c 2025-11-13 09:46:58.493081022 -0700 -@@ -44,6 +44,12 @@ - #include - #elif defined(HAVE_LINUX_INPUT_H) - #include -+#else -+#define BTN_LEFT 0x110 -+#define BTN_RIGHT 0x111 -+#define BTN_MIDDLE 0x112 -+#define BTN_STYLUS 0x14b -+#define BTN_STYLUS2 0x14c - #endif - - #define BUTTON_BASE (BTN_LEFT - 1) /* Used to translate to 1-indexed buttons */ -diff -ruwN source-old/gdk/wayland/gdkdisplay-wayland.c source/gdk/wayland/gdkdisplay-wayland.c ---- source-old/gdk/wayland/gdkdisplay-wayland.c 2024-07-10 11:03:14.000000000 -0600 -+++ source/gdk/wayland/gdkdisplay-wayland.c 2025-11-13 09:44:55.926622693 -0700 -@@ -28,7 +28,9 @@ - #endif - - #include -+#if defined (__NR_memfd_create) - #include -+#endif - - #include - #include "gdkwayland.h" -diff -ruwN source-old/gtk/a11y/gtkaccessibility.c source/gtk/a11y/gtkaccessibility.c ---- source-old/gtk/a11y/gtkaccessibility.c 2024-07-10 11:03:14.000000000 -0600 -+++ source/gtk/a11y/gtkaccessibility.c 2025-11-12 12:32:06.969908669 -0700 -@@ -37,7 +37,7 @@ - #include - #include - --#ifdef GDK_WINDOWING_X11 -+#if defined(GDK_WINDOWING_X11) && !defined(__redox__) - #include - #endif - -@@ -254,7 +254,7 @@ - } - } - --#ifdef GDK_WINDOWING_X11 -+#if defined(GDK_WINDOWING_X11) && !defined(__redox__) - /* - * If the focus widget is a GtkSocket without a plug - * then ignore the focus notification as the embedded -@@ -986,7 +986,7 @@ - _gtk_accessibility_override_atk_util (); - do_window_event_initialization (); - --#ifdef GDK_WINDOWING_X11 -+#if defined(GDK_WINDOWING_X11) && !defined(__redox__) - atk_bridge_adaptor_init (NULL, NULL); - #endif - -diff -ruwN source-old/gtk/gtkmain.c source/gtk/gtkmain.c ---- source-old/gtk/gtkmain.c 2024-07-10 11:03:14.000000000 -0600 -+++ source/gtk/gtkmain.c 2025-11-12 12:32:06.970182803 -0700 -@@ -355,7 +355,7 @@ - check_setugid (void) - { - /* this isn't at all relevant on MS Windows and doesn't compile ... --hb */ --#ifndef G_OS_WIN32 -+#if !defined(G_OS_WIN32) && !defined(__redox__) - uid_t ruid, euid, suid; /* Real, effective and saved user ID's */ - gid_t rgid, egid, sgid; /* Real, effective and saved group ID's */ - -diff -ruwN source-old/meson.build source/meson.build ---- source-old/meson.build 2024-07-10 11:03:14.000000000 -0600 -+++ source/meson.build 2025-11-12 12:32:06.970463189 -0700 -@@ -565,7 +565,7 @@ - xfixes_dep = dependency('xfixes', required: false) - xcomposite_dep = dependency('xcomposite', required: false) - fontconfig_dep = dependency('fontconfig', fallback: ['fontconfig', 'fontconfig_dep']) -- atkbridge_dep = dependency('atk-bridge-2.0', version: at_spi2_atk_req) -+ #TODO atkbridge_dep = dependency('atk-bridge-2.0', version: at_spi2_atk_req) - - backend_immodules += ['xim'] - -@@ -584,7 +584,7 @@ - x11_pkgs += ['xdamage'] - endif - -- atk_pkgs += ['atk-bridge-2.0'] -+ #atk_pkgs += ['atk-bridge-2.0'] - - cdata.set('HAVE_XDAMAGE', xdamage_dep.found() ? 1 : false) - cdata.set('HAVE_XCURSOR', xcursor_dep.found() ? 1 : false) diff --git a/recipes/wip/libs/gnome/libayatana-appindicator-glib/redox.patch b/recipes/wip/libs/gnome/libayatana-appindicator-glib/redox.patch deleted file mode 100644 index db429a1ab5..0000000000 --- a/recipes/wip/libs/gnome/libayatana-appindicator-glib/redox.patch +++ /dev/null @@ -1,116 +0,0 @@ -diff -ruwN source-old/bindings/CMakeLists.txt source/bindings/CMakeLists.txt ---- source-old/bindings/CMakeLists.txt 2025-06-15 04:50:44.000000000 -0600 -+++ source/bindings/CMakeLists.txt 2025-11-15 08:33:35.889512652 -0700 -@@ -1 +1 @@ --add_subdirectory (vala) -+#TODO: valac: add_subdirectory (vala) -diff -ruwN source-old/CMakeLists.txt source/CMakeLists.txt ---- source-old/CMakeLists.txt 2025-06-15 04:50:44.000000000 -0600 -+++ source/CMakeLists.txt 2025-11-15 08:33:53.996379724 -0700 -@@ -38,7 +38,7 @@ - - add_subdirectory (src) - add_subdirectory (bindings) --add_subdirectory (doc) -+#TODO: gi-docgen: add_subdirectory (doc) - - if (ENABLE_TESTS) - include (CTest) -diff -ruwN source-old/src/CMakeLists.txt source/src/CMakeLists.txt ---- source-old/src/CMakeLists.txt 2025-06-15 04:50:44.000000000 -0600 -+++ source/src/CMakeLists.txt 2025-11-15 08:32:53.644475333 -0700 -@@ -114,47 +114,49 @@ - target_link_options ("ayatana-appindicator-glib" PRIVATE "LINKER:--version-script=${CMAKE_CURRENT_SOURCE_DIR}/ayatana-appindicator.symbols") - install (TARGETS "ayatana-appindicator-glib" LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}") - --# AyatanaAppIndicatorGlib-2.0.gir -- --find_package (GObjectIntrospection REQUIRED) -- --add_custom_command ( -- OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicatorGlib-2.0.gir" -- DEPENDS "ayatana-appindicator-glib" -- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -- COMMAND -- ${INTROSPECTION_SCANNER} -- ayatana-appindicator.c ayatana-appindicator.h -- --add-include-path=${CMAKE_CURRENT_BINARY_DIR} -- --c-include=libayatana-appindicator-glib/ayatana-appindicator.h -- --symbol-prefix=app -- --identifier-prefix=App -- --namespace=AyatanaAppIndicatorGlib -- --nsversion=2.0 -- --quiet -- --warn-all -- --include=Gio-2.0 -- --include=GObject-2.0 -- --library-path=${CMAKE_CURRENT_BINARY_DIR} -- --library="ayatana-appindicator-glib" -- --output "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicatorGlib-2.0.gir" --) -- --install (FILES "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicatorGlib-2.0.gir" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/gir-1.0") -- --# AyatanaAppIndicatorGlib-2.0.typelib -- --add_custom_command ( -- OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicatorGlib-2.0.typelib" -- DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicatorGlib-2.0.gir" -- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -- COMMAND -- ${INTROSPECTION_COMPILER} -- --includedir=${CMAKE_CURRENT_BINARY_DIR} -- ${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicatorGlib-2.0.gir -- -o "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicatorGlib-2.0.typelib" --) -- --install (FILES "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicatorGlib-2.0.typelib" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/girepository-1.0") -- --add_custom_target ("src" ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicatorGlib-2.0.typelib") -+#TODO: gobject-introspection -+## AyatanaAppIndicatorGlib-2.0.gir -+# -+#find_package (GObjectIntrospection REQUIRED) -+# -+#add_custom_command ( -+# OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicatorGlib-2.0.gir" -+# DEPENDS "ayatana-appindicator-glib" -+# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -+# COMMAND -+# ${INTROSPECTION_SCANNER} -+# ayatana-appindicator.c ayatana-appindicator.h -+# --add-include-path=${CMAKE_CURRENT_BINARY_DIR} -+# --c-include=libayatana-appindicator-glib/ayatana-appindicator.h -+# --symbol-prefix=app -+# --identifier-prefix=App -+# --namespace=AyatanaAppIndicatorGlib -+# --nsversion=2.0 -+# --quiet -+# --warn-all -+# --include=Gio-2.0 -+# --include=GObject-2.0 -+# --library-path=${CMAKE_CURRENT_BINARY_DIR} -+# --library="ayatana-appindicator-glib" -+# --output "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicatorGlib-2.0.gir" -+#) -+# -+#install (FILES "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicatorGlib-2.0.gir" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/gir-1.0") -+# -+## AyatanaAppIndicatorGlib-2.0.typelib -+# -+#add_custom_command ( -+# OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicatorGlib-2.0.typelib" -+# DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicatorGlib-2.0.gir" -+# WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -+# COMMAND -+# ${INTROSPECTION_COMPILER} -+# --includedir=${CMAKE_CURRENT_BINARY_DIR} -+# ${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicatorGlib-2.0.gir -+# -o "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicatorGlib-2.0.typelib" -+#) -+# -+#install (FILES "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicatorGlib-2.0.typelib" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/girepository-1.0") -+# -+#add_custom_target ("src" ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaAppIndicatorGlib-2.0.typelib") -+# -\ No newline at end of file diff --git a/recipes/wip/libs/gnome/libepoxy/redox.patch b/recipes/wip/libs/gnome/libepoxy/redox.patch deleted file mode 100644 index 58a5f96b1f..0000000000 --- a/recipes/wip/libs/gnome/libepoxy/redox.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff -ruwN libepoxy-1.5.10/src/dispatch_common.c source/src/dispatch_common.c ---- libepoxy-1.5.10/src/dispatch_common.c 2022-02-17 05:56:12.000000000 -0700 -+++ source/src/dispatch_common.c 2025-05-04 17:57:31.910921783 -0600 -@@ -264,13 +264,7 @@ - long begin_count; - }; - --static struct api api = { --#ifndef _WIN32 -- .mutex = PTHREAD_MUTEX_INITIALIZER, --#else -- 0, --#endif --}; -+static struct api api = {0}; - - static bool library_initialized; - diff --git a/recipes/wip/libs/gnome/vte/redox.patch b/recipes/wip/libs/gnome/vte/redox.patch deleted file mode 100644 index 3f3bda148b..0000000000 --- a/recipes/wip/libs/gnome/vte/redox.patch +++ /dev/null @@ -1,63 +0,0 @@ -diff -ruwN source-old/src/pty.cc source/src/pty.cc ---- source-old/src/pty.cc 2025-10-11 14:43:24.000000000 -0600 -+++ source/src/pty.cc 2025-11-17 17:54:03.387095202 -0700 -@@ -222,7 +222,7 @@ - if (peer_fd == -1) - _exit(127); - --#ifdef TIOCSCTTY -+#if defined(TIOCSCTTY) && !defined(__redox__) - /* On linux, opening the PTY peer above already made it our controlling TTY (since - * previously there was none, after the setsid() call). However, it appears that e.g. - * on *BSD, that doesn't happen, so we need this explicit ioctl here. -diff -ruwN source-old/src/spawn.cc source/src/spawn.cc ---- source-old/src/spawn.cc 2025-10-11 14:43:24.000000000 -0600 -+++ source/src/spawn.cc 2025-11-17 17:53:20.394044419 -0700 -@@ -409,7 +409,7 @@ - if (peer_fd == -1) - return ExecError::GETPTPEER; - --#ifdef TIOCSCTTY -+#if defined(TIOCSCTTY) && !defined(__redox__) - /* On linux, opening the PTY peer above already made it our controlling TTY (since - * previously there was none, after the setsid() call). However, it appears that e.g. - * on *BSD, that doesn't happen, so we need this explicit ioctl here. -diff -ruwN source-old/src/vte.cc source/src/vte.cc ---- source-old/src/vte.cc 2025-10-11 14:43:24.000000000 -0600 -+++ source/src/vte.cc 2025-11-17 17:54:44.394149937 -0700 -@@ -19,7 +19,9 @@ - #include "config.h" - - #include -+#if !defined(__redox__) - #include -+#endif - #include - #include - #include -diff -ruwN source-old/src/vteseq.cc source/src/vteseq.cc ---- source-old/src/vteseq.cc 2025-10-11 14:43:24.000000000 -0600 -+++ source/src/vteseq.cc 2025-11-17 17:59:27.278790468 -0700 -@@ -19,7 +19,9 @@ - - #include "config.h" - -+#if !defined(__redox__) - #include -+#endif - #include - #include - #include -diff -ruwN source-old/src/widget.cc source/src/widget.cc ---- source-old/src/widget.cc 2025-10-11 14:43:24.000000000 -0600 -+++ source/src/widget.cc 2025-11-17 18:22:10.229089619 -0700 -@@ -927,6 +927,9 @@ - } - - if (m_terminal->terminate_child()) { -+ #ifndef W_EXITCODE -+ #define W_EXITCODE(ret, sig) ((ret) << 8 | (sig)) -+ #endif - int status = W_EXITCODE(0, SIGKILL); - emit_child_exited(status); - } diff --git a/recipes/wip/libs/other/boost/redox.patch b/recipes/wip/libs/other/boost/redox.patch deleted file mode 100644 index 24a894acfa..0000000000 --- a/recipes/wip/libs/other/boost/redox.patch +++ /dev/null @@ -1,139 +0,0 @@ -diff -ruwN source/boost/asio/detail/config.hpp source-new/boost/asio/detail/config.hpp ---- source/boost/asio/detail/config.hpp 2025-12-03 20:46:38.000000000 +0700 -+++ source-new/boost/asio/detail/config.hpp 2026-03-13 20:55:39.534429549 +0700 -@@ -1395,7 +1395,7 @@ - # if defined(__linux__) - # define BOOST_ASIO_HAS_MSG_NOSIGNAL 1 - # elif defined(_POSIX_VERSION) --# if (_POSIX_VERSION >= 200809L) -+# if (_POSIX_VERSION >= 200809L) && !defined(__redox__) - # define BOOST_ASIO_HAS_MSG_NOSIGNAL 1 - # endif // _POSIX_VERSION >= 200809L - # endif // defined(_POSIX_VERSION) -diff -ruwN source/boost/config/detail/select_platform_config.hpp source-new/boost/config/detail/select_platform_config.hpp ---- source/boost/config/detail/select_platform_config.hpp 2025-12-03 20:46:39.000000000 +0700 -+++ source-new/boost/config/detail/select_platform_config.hpp 2026-03-13 20:45:55.392659272 +0700 -@@ -69,6 +69,10 @@ - // QNX: - # define BOOST_PLATFORM_CONFIG "boost/config/platform/qnxnto.hpp" - -+#elif defined(__redox__) -+// Redox: -+# define BOOST_PLATFORM_CONFIG "boost/config/platform/redox.hpp" -+ - #elif defined(__VXWORKS__) - // vxWorks: - # define BOOST_PLATFORM_CONFIG "boost/config/platform/vxworks.hpp" -@@ -135,6 +139,7 @@ - # include "boost/config/platform/aix.hpp" - # include "boost/config/platform/amigaos.hpp" - # include "boost/config/platform/qnxnto.hpp" -+# include "boost/config/platform/redox.hpp" - # include "boost/config/platform/vxworks.hpp" - # include "boost/config/platform/symbian.hpp" - # include "boost/config/platform/cray.hpp" -diff -ruwN source/boost/config/platform/redox.hpp source-new/boost/config/platform/redox.hpp ---- source/boost/config/platform/redox.hpp 1970-01-01 07:00:00.000000000 +0700 -+++ source-new/boost/config/platform/redox.hpp 2026-03-14 02:47:45.335839093 +0700 -@@ -0,0 +1,23 @@ -+// (C) Copyright Jim Douglas 2005. -+// Use, modification and distribution are subject to the -+// Boost Software License, Version 1.0. (See accompanying file -+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -+ -+// See http://www.boost.org for most recent version. -+ -+// REDOX specific config options: -+ -+#define BOOST_PLATFORM "REDOX" -+ -+#undef BOOST_HAS_LOG1P -+#undef BOOST_HAS_EXPM1 -+ -+#define BOOST_HAS_PTHREADS -+ -+#define BOOST_HAS_GETTIMEOFDAY -+#define BOOST_HAS_CLOCK_GETTIME -+#define BOOST_HAS_SCHED_YIELD -+ -+// boilerplate code: -+#define BOOST_HAS_UNISTD_H -+#include -diff -ruwN source/boost/interprocess/detail/workaround.hpp source-new/boost/interprocess/detail/workaround.hpp ---- source/boost/interprocess/detail/workaround.hpp 2025-12-03 20:46:42.000000000 +0700 -+++ source-new/boost/interprocess/detail/workaround.hpp 2026-03-13 20:53:19.211459550 +0700 -@@ -41,7 +41,7 @@ - ////////////////////////////////////////////////////// - //Check for XSI shared memory objects. They are available in nearly all UNIX platforms - ////////////////////////////////////////////////////// -- #if !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__HAIKU__) && !(__VXWORKS__) && !(__EMSCRIPTEN__) -+ #if !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__redox__) && !(__VXWORKS__) && !(__EMSCRIPTEN__) - #define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS - #endif - -diff -ruwN source/boost/interprocess/mapped_region.hpp source-new/boost/interprocess/mapped_region.hpp ---- source/boost/interprocess/mapped_region.hpp 2025-12-03 20:46:42.000000000 +0700 -+++ source-new/boost/interprocess/mapped_region.hpp 2026-03-13 21:29:41.935220888 +0700 -@@ -816,7 +816,7 @@ - } - int ret = -1; - switch(mode){ -- #if defined(POSIX_MADV_NORMAL) -+ #if defined(POSIX_MADV_NORMAL) && !defined(__redox__) - case mode_padv: - { - ret = posix_madvise(this->priv_map_address(), this->priv_map_size(), unix_advice); -diff -ruwN source/boost/process/v2/detail/environment_posix.hpp source-new/boost/process/v2/detail/environment_posix.hpp ---- source/boost/process/v2/detail/environment_posix.hpp 2025-12-03 20:46:45.000000000 +0700 -+++ source-new/boost/process/v2/detail/environment_posix.hpp 2026-03-14 03:07:36.937337542 +0700 -@@ -19,7 +19,7 @@ - # if !defined(environ) - # define environ (*_NSGetEnviron()) - # endif --#elif defined(__MACH__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__sun) -+#elif defined(__MACH__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__sun) || defined(__redox__) - extern "C" { extern char **environ; } - #endif - -diff -ruwN source/boost/process/v2/posix/default_launcher.hpp source-new/boost/process/v2/posix/default_launcher.hpp ---- source/boost/process/v2/posix/default_launcher.hpp 2025-12-03 20:46:45.000000000 +0700 -+++ source-new/boost/process/v2/posix/default_launcher.hpp 2026-03-14 03:07:38.549349038 +0700 -@@ -35,7 +35,7 @@ - # if !defined(environ) - # define environ (*_NSGetEnviron()) - # endif --#elif defined(__MACH__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__sun) -+#elif defined(__MACH__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__sun) || defined(__redox__) - extern "C" { extern char **environ; } - #endif - -diff -ruwN source/libs/process/src/shell.cpp source-new/libs/process/src/shell.cpp ---- source/libs/process/src/shell.cpp 2025-12-03 20:46:45.000000000 +0700 -+++ source-new/libs/process/src/shell.cpp 2026-03-14 03:24:59.034513769 +0700 -@@ -19,7 +19,7 @@ - #if defined(BOOST_PROCESS_V2_WINDOWS) - #include - #include --#elif !defined(__OpenBSD__) && !defined(__ANDROID__) -+#elif !defined(__OpenBSD__) && !defined(__ANDROID__) && !defined(__redox__) - #include - #endif - -@@ -30,7 +30,7 @@ - { - return system_category(); - } --#elif !defined(__OpenBSD__) && !defined(__ANDROID__) -+#elif !defined(__OpenBSD__) && !defined(__ANDROID__) && !defined(__redox__) - - struct shell_category_t final : public error_category - { -@@ -99,7 +99,7 @@ - return input_.c_str(); - } - --#elif !defined(__OpenBSD__) && !defined(__ANDROID__) -+#elif !defined(__OpenBSD__) && !defined(__ANDROID__) && !defined(__redox__) - - void shell::parse_() - { diff --git a/recipes/wip/libs/other/gdbm/redox.patch b/recipes/wip/libs/other/gdbm/redox.patch deleted file mode 100644 index d18ee61426..0000000000 --- a/recipes/wip/libs/other/gdbm/redox.patch +++ /dev/null @@ -1,77 +0,0 @@ -diff --git a/build-aux/config.sub b/build-aux/config.sub -index 7ffe373..e2368e0 100755 ---- a/build-aux/config.sub -+++ b/build-aux/config.sub -@@ -1393,7 +1393,7 @@ case $os in - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ -- | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) -+ | -skyos* | -haiku* | -rdos* | -redox* | -toppers* | -drops* | -es* | -tirtos*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) -diff --git a/tools/gdbmshell.c b/tools/gdbmshell.c -index 22c4938..bf75dc8 100644 ---- a/tools/gdbmshell.c -+++ b/tools/gdbmshell.c -@@ -2890,16 +2890,6 @@ struct timing - struct timeval sys; - }; - --void --timing_start (struct timing *t) --{ -- struct rusage r; -- gettimeofday (&t->real, NULL); -- getrusage (RUSAGE_SELF, &r); -- t->user = r.ru_utime; -- t->sys = r.ru_stime; --} -- - static inline struct timeval - timeval_sub (struct timeval a, struct timeval b) - { -@@ -2916,19 +2906,6 @@ timeval_sub (struct timeval a, struct timeval b) - return diff; - } - --void --timing_stop (struct timing *t) --{ -- struct rusage r; -- struct timeval now; -- -- gettimeofday (&now, NULL); -- getrusage (RUSAGE_SELF, &r); -- t->real = timeval_sub (now, t->real); -- t->user = timeval_sub (r.ru_utime, t->user); -- t->sys = timeval_sub (r.ru_stime, t->sys); --} -- - static int - argsprep (struct command *cmd, struct gdbmarglist *arglist, - struct command_param *param) -@@ -3047,22 +3024,12 @@ run_command (struct command *cmd, struct gdbmarglist *arglist) - else - cenv.fp = stdout; - -- timing_start (&tm); - rc = cmd->handler (¶m, &cenv); -- timing_stop (&tm); - if (cmd->end) - cmd->end (cenv.data); - else if (cenv.data) - free (cenv.data); - -- if (variable_is_true ("timing")) -- { -- fprintf (cenv.fp, "[%s r=%lu.%06lu u=%lu.%06lu s=%lu.%06lu]\n", -- cmd->name, -- tm.real.tv_sec, tm.real.tv_usec, -- tm.user.tv_sec, tm.user.tv_usec, -- tm.sys.tv_sec, tm.sys.tv_usec); -- } - - if (pagfp) - pclose (pagfp); diff --git a/recipes/wip/libs/other/imlib2/redox.patch b/recipes/wip/libs/other/imlib2/redox.patch deleted file mode 100644 index eb82e68ba8..0000000000 --- a/recipes/wip/libs/other/imlib2/redox.patch +++ /dev/null @@ -1,104 +0,0 @@ -diff -ruwN '--exclude=Makefile.in' source-old/src/lib/x11_grab.c source/src/lib/x11_grab.c ---- source-old/src/lib/x11_grab.c 2024-12-24 07:45:18.000000000 -0700 -+++ source/src/lib/x11_grab.c 2025-10-30 12:54:08.011156248 -0600 -@@ -4,8 +4,10 @@ - #include - #include - #include -+#if !defined(__redox__) - #include - #include -+#endif - - #include "x11_grab.h" - #include "x11_ximage.h" -diff -ruwN '--exclude=Makefile.in' source-old/src/lib/x11_rend.c source/src/lib/x11_rend.c ---- source-old/src/lib/x11_rend.c 2025-04-06 07:16:45.000000000 -0600 -+++ source/src/lib/x11_rend.c 2025-10-30 12:55:57.324410357 -0600 -@@ -474,20 +474,24 @@ - gcm = XCreateGC(x11->dpy, m, GCGraphicsExposures, &gcv); - } - /* write the mask */ -+#if !defined(__redox__) - if (shm) - /* write shm XImage */ - XShmPutImage(x11->dpy, m, gcm, mxim, 0, 0, dx, dy, dw, dh, False); - /* write regular XImage */ - else -+#endif - XPutImage(x11->dpy, m, gcm, mxim, 0, 0, dx, dy, dw, dh); - } - - /* write the image */ -+#if !defined(__redox__) - if (shm) - /* write shm XImage */ - XShmPutImage(x11->dpy, w, gc, xim, 0, 0, dx, dy, dw, dh, False); - /* write regular XImage */ - else -+#endif - XPutImage(x11->dpy, w, gc, xim, 0, 0, dx, dy, dw, dh); - - /* free the XImage and put onto our free list */ -diff -ruwN '--exclude=Makefile.in' source-old/src/lib/x11_ximage.c source/src/lib/x11_ximage.c ---- source-old/src/lib/x11_ximage.c 2024-01-02 06:11:28.000000000 -0700 -+++ source/src/lib/x11_ximage.c 2025-10-30 12:57:02.128925585 -0600 -@@ -11,8 +11,10 @@ - #include - #include - #endif -+#if !defined(__redox__) - #include - #include -+#endif - - #include "x11_ximage.h" - -@@ -56,6 +58,7 @@ - int val; - - /* if its there set x_does_shm flag */ -+#if !defined(__redox__) - if (XShmQueryExtension(d)) - { - #ifdef HAVE_X11_SHM_FD -@@ -72,6 +75,7 @@ - } - /* clear the flag - no shm at all */ - else -+#endif - { - x_does_shm = 0; - return; -@@ -121,6 +125,7 @@ - return NULL; - - /* try create an shm image */ -+#if !defined(__redox__) - xim = XShmCreateImage(x11->dpy, x11->vis, depth, ZPixmap, NULL, si, w, h); - if (!xim) - return NULL; -@@ -230,6 +235,7 @@ - shmctl(si->shmid, IPC_RMID, 0); - } - } -+#endif - - /* couldnt create SHM image ? */ - /* destroy previous image */ -@@ -243,6 +249,7 @@ - XShmSegmentInfo *si) - { - XSync(x11->dpy, False); -+#if !defined(__redox__) - XShmDetach(x11->dpy, si); - #ifdef HAVE_X11_SHM_FD - if (x_does_shm_fd) -@@ -255,6 +262,7 @@ - shmdt(si->shmaddr); - shmctl(si->shmid, IPC_RMID, 0); - } -+#endif - XDestroyImage(xim); - } - diff --git a/recipes/wip/libs/other/libedit/redox.patch b/recipes/wip/libs/other/libedit/redox.patch deleted file mode 100644 index 5a699f2a19..0000000000 --- a/recipes/wip/libs/other/libedit/redox.patch +++ /dev/null @@ -1,99 +0,0 @@ -diff --color -ruwN source/configure source-new/configure ---- source/configure 2025-01-05 00:16:30.000000000 +0700 -+++ source-new/configure 2025-09-18 06:50:23.667443238 +0700 -@@ -6384,7 +6384,7 @@ - ;; - - # This must be glibc/ELF. --linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) -+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu* | redox*) - lt_cv_deplibs_check_method=pass_all - ;; - -@@ -7715,7 +7715,7 @@ - ;; - - x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ --s390*-*linux*|s390*-*tpf*|sparc*-*linux*|x86_64-gnu*) -+s390*-*linux*|s390*-*tpf*|sparc*-*linux*|x86_64-gnu**|x86_64-redox*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. Note that the listed cases only cover the - # situations where additional linker options are needed (such as when -@@ -7734,7 +7734,7 @@ - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; -- x86_64-*linux*|x86_64-gnu*) -+ x86_64-*linux*|x86_64-gnu*|x86_64-redox*) - case `$FILECMD conftest.o` in - *x86-64*) - LD="${LD-ld} -m elf32_x86_64" -@@ -7763,7 +7763,7 @@ - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; -- x86_64-*linux*|x86_64-gnu*) -+ x86_64-*linux*|x86_64-gnu*|x86_64-*redox*) - LD="${LD-ld} -m elf_x86_64" - ;; - powerpcle-*linux*) -@@ -12168,7 +12168,7 @@ - ;; - - # This must be glibc/ELF. --linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) -+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu* | redox*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no -diff --color -ruwN source/src/chartype.h source-new/src/chartype.h ---- source/src/chartype.h 2022-06-11 14:57:59.000000000 +0700 -+++ source-new/src/chartype.h 2025-09-18 06:38:37.401509690 +0700 -@@ -39,7 +39,8 @@ - !(defined(__APPLE__) && defined(__MACH__)) && \ - !defined(__OpenBSD__) && \ - !defined(__FreeBSD__) && \ -- !defined(__DragonFly__) -+ !defined(__DragonFly__) && \ -+ !defined(__redox__) - #ifndef __STDC_ISO_10646__ - /* In many places it is assumed that the first 127 code points are ASCII - * compatible, so ensure wchar_t indeed does ISO 10646 and not some other -diff --color -ruwN source/src/editline/readline.h source-new/src/editline/readline.h ---- source/src/editline/readline.h 2023-08-27 14:25:53.000000000 +0700 -+++ source-new/src/editline/readline.h 2025-09-18 06:41:15.169232816 +0700 -@@ -78,7 +78,7 @@ - - #ifndef CTRL - #include --#if !defined(__sun) && !defined(__hpux) && !defined(_AIX) -+#if !defined(__sun) && !defined(__hpux) && !defined(_AIX) && !defined(__redox__) - #include - #endif - #ifndef CTRL -diff --color -ruwN source/src/sys.h source-new/src/sys.h ---- source/src/sys.h 2024-08-09 01:03:34.000000000 +0700 -+++ source-new/src/sys.h 2025-09-18 06:40:02.388537017 +0700 -@@ -116,10 +116,6 @@ - typedef unsigned int u_int32_t; - #endif - --#ifndef HAVE_SIZE_MAX --#define SIZE_MAX ((size_t)-1) --#endif -- - #define REGEX /* Use POSIX.2 regular expression functions */ - #undef REGEXP /* Use UNIX V8 regular expression functions */ - -diff --color -ruwN source/src/wcsdup.c source-new/src/wcsdup.c ---- source/src/wcsdup.c 2022-06-11 14:57:59.000000000 +0700 -+++ source-new/src/wcsdup.c 2025-09-18 06:44:01.365917599 +0700 -@@ -11,7 +11,7 @@ - * code is also granted without any restrictions. - */ - --#ifndef HAVE_WCSDUP -+#if !defined(HAVE_WCSDUP) && !defined(__redox__) - - #include "config.h" - diff --git a/recipes/wip/libs/other/libgcrypt/redox.patch b/recipes/wip/libs/other/libgcrypt/redox.patch deleted file mode 100644 index 4ac898dc87..0000000000 --- a/recipes/wip/libs/other/libgcrypt/redox.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- libgcrypt-1.11.1/tests/stopwatch.h 2025-03-17 03:55:24.000000000 -0600 -+++ source/tests/stopwatch.h 2025-05-10 08:42:52.113921935 -0600 -@@ -45,6 +45,8 @@ - &started_at.creation_time, &started_at.exit_time, - &started_at.kernel_time, &started_at.user_time); - stopped_at = started_at; -+#elif defined(__redox__) -+ //TODO: times on redox - #else - struct tms tmp; - -@@ -60,6 +62,8 @@ - GetProcessTimes (GetCurrentProcess (), - &stopped_at.creation_time, &stopped_at.exit_time, - &stopped_at.kernel_time, &stopped_at.user_time); -+#elif defined(__redox__) -+ //TODO: times on redox - #else - struct tms tmp; - diff --git a/recipes/wip/libs/other/libicu/redox.patch b/recipes/wip/libs/other/libicu/redox.patch deleted file mode 100644 index 659b2df1b1..0000000000 --- a/recipes/wip/libs/other/libicu/redox.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ruwN icu/source/common/unicode/ptypes.h source/source/common/unicode/ptypes.h ---- icu/source/common/unicode/ptypes.h 2025-03-13 12:31:23.000000000 -0600 -+++ source/source/common/unicode/ptypes.h 2025-04-11 13:46:44.105116183 -0600 -@@ -56,7 +56,7 @@ - // implementations (looking at you, Apple, spring 2024) actually do this, so - // ICU4C must detect and deal with that. - #if !defined(__cplusplus) && !defined(U_IN_DOXYGEN) --# if U_HAVE_CHAR16_T -+# if U_HAVE_CHAR16_T && !defined(__redox__) - # include - # else - typedef uint16_t char16_t; diff --git a/recipes/wip/libs/other/libuuid/redox.patch b/recipes/wip/libs/other/libuuid/redox.patch deleted file mode 100644 index 2e7a5f9cea..0000000000 --- a/recipes/wip/libs/other/libuuid/redox.patch +++ /dev/null @@ -1,67 +0,0 @@ -diff -ruwN source/config.sub source-new/config.sub ---- source/config.sub 2014-08-12 15:19:20.000000000 +0700 -+++ source-new/config.sub 2025-09-19 21:11:57.907457211 +0700 -@@ -1376,7 +1376,7 @@ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ -- | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) -+ | -skyos* | -haiku* | -rdos* | -redox* | -toppers* | -drops* | -es*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) -diff -ruwN source/configure source-new/configure ---- source/configure 2014-08-12 15:19:19.000000000 +0700 -+++ source-new/configure 2025-09-19 21:20:30.460699979 +0700 -@@ -5312,7 +5312,7 @@ - ;; - - # This must be glibc/ELF. --linux* | k*bsd*-gnu | kopensolaris*-gnu) -+linux* | k*bsd*-gnu | kopensolaris*-gnu | redox*) - lt_cv_deplibs_check_method=pass_all - ;; - -@@ -8866,7 +8866,7 @@ - archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - -- gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) -+ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu | redox*) - tmp_diet=no - if test "$host_os" = linux-dietlibc; then - case $cc_basename in -@@ -10534,7 +10534,7 @@ - ;; - - # This must be glibc/ELF. --linux* | k*bsd*-gnu | kopensolaris*-gnu) -+linux* | k*bsd*-gnu | kopensolaris*-gnu | redox*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no -diff -ruwN source/gen_uuid.c source-new/gen_uuid.c ---- source/gen_uuid.c 2014-08-12 04:07:18.000000000 -0400 -+++ source-new/gen_uuid.c 2025-12-09 10:49:12.580466005 -0500 -@@ -59,9 +59,7 @@ - #include - #endif - #include --#ifdef HAVE_SYS_FILE_H - #include --#endif - #ifdef HAVE_SYS_IOCTL_H - #include - #endif -diff -ruwN source/randutils.c source-new/randutils.c ---- source/randutils.c 2014-08-12 15:07:18.000000000 +0700 -+++ source-new/randutils.c 2025-09-19 21:11:57.907659403 +0700 -@@ -13,7 +13,7 @@ - #include - #include - --#include -+// #include - - #include "randutils.h" - diff --git a/recipes/wip/libs/other/tree-sitter/redox.patch b/recipes/wip/libs/other/tree-sitter/redox.patch deleted file mode 100644 index 62c28d13f7..0000000000 --- a/recipes/wip/libs/other/tree-sitter/redox.patch +++ /dev/null @@ -1,45 +0,0 @@ -diff --color -ruwN source/Cargo.toml source-new/Cargo.toml ---- source/Cargo.toml 2025-07-14 01:32:42.000000000 +0700 -+++ source-new/Cargo.toml 2025-09-16 11:37:28.820646655 +0700 -@@ -118,7 +118,7 @@ - dialoguer = { version = "0.11.0", features = ["fuzzy-select"] } - etcetera = "0.8.0" - filetime = "0.2.25" --fs4 = "0.12.0" -+fs4 = { git = "https://github.com/al8n/fs4-rs" } # for redox support, still not published yet - git2 = "0.20.0" - glob = "0.3.2" - heck = "0.5.0" -@@ -151,7 +151,7 @@ - url = { version = "2.5.4", features = ["serde"] } - walkdir = "2.5.0" - wasmparser = "0.224.0" --webbrowser = "1.0.3" -+webbrowser = "1.0.5" - - tree-sitter = { version = "0.25.1", path = "./lib" } - tree-sitter-generate = { version = "0.25.1", path = "./cli/generate" } -diff --color -ruwN source/cli/src/fuzz/allocations.rs source-new/cli/src/fuzz/allocations.rs ---- source/cli/src/fuzz/allocations.rs 2025-07-14 01:32:42.000000000 +0700 -+++ source-new/cli/src/fuzz/allocations.rs 2025-09-16 11:39:56.112458323 +0700 -@@ -7,6 +7,7 @@ - }, - }; - -+#[cfg(not(target_os = "redox"))] - #[ctor::ctor] - unsafe fn initialize_allocation_recording() { - tree_sitter::set_allocator( -diff --color -ruwN source/lib/src/portable/endian.h source-new/lib/src/portable/endian.h ---- source/lib/src/portable/endian.h 2025-07-14 01:32:42.000000000 +0700 -+++ source-new/lib/src/portable/endian.h 2025-09-16 11:27:12.315211556 +0700 -@@ -24,7 +24,8 @@ - defined(__CYGWIN__) || \ - defined(__MSYS__) || \ - defined(__EMSCRIPTEN__) || \ -- defined(__wasi__) -+ defined(__wasi__) || \ -+ defined(__redox__) - - #if defined(__NetBSD__) - #define _NETBSD_SOURCE 1 diff --git a/recipes/wip/libs/tls/openssl3/redox.patch b/recipes/wip/libs/tls/openssl3/redox.patch deleted file mode 100644 index b11ccc48e3..0000000000 --- a/recipes/wip/libs/tls/openssl3/redox.patch +++ /dev/null @@ -1,56 +0,0 @@ -diff -ruwN source/apps/lib/apps.c source-new/apps/lib/apps.c ---- source/apps/lib/apps.c 2025-09-16 19:05:33.000000000 +0700 -+++ source-new/apps/lib/apps.c 2025-09-20 12:29:36.439917319 +0700 -@@ -2839,7 +2839,7 @@ - return ret; - } - --#elif defined(_SC_CLK_TCK) /* by means of unistd.h */ -+#elif defined(_SC_CLK_TCK) && !defined(__redox__) /* by means of unistd.h */ - # include - - double app_tminterval(int stop, int usertime) -diff -ruwN source/Configurations/10-main.conf source-new/Configurations/10-main.conf ---- source/Configurations/10-main.conf 2025-09-16 19:05:33.000000000 +0700 -+++ source-new/Configurations/10-main.conf 2025-09-20 13:13:14.569456910 +0700 -@@ -208,6 +208,40 @@ - shared_extension => ".so", - }, - -+### Redox configurations -+ "redox-common" => { -+ inherit_from => [ "BASE_unix" ], -+ cc => "gcc", -+ thread_scheme => "pthreads", -+ dso_scheme => "dlfcn", -+ shared_target => "linux-shared", -+ shared_cflag => "-fPIC", -+ shared_ldflag => sub { $disabled{pinshared} ? () : "-Wl,-znodelete" }, -+ shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)", -+ }, -+ "redox-generic64" => { -+ inherit_from => [ "redox-common" ], -+ bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR", -+ }, -+ "redox-aarch64" => { -+ inherit_from => [ "redox-generic64" ], -+ perlasm_scheme => "linux64", -+ }, -+ "redox-i586" => { -+ inherit_from => [ "redox-common" ], -+ bn_ops => "BN_LLONG", -+ perlasm_scheme => "elf", -+ }, -+ "redox-riscv64gc" => { -+ inherit_from => [ "redox-generic64" ], -+ perlasm_scheme => "linux64", -+ }, -+ "redox-x86_64" => { -+ inherit_from => [ "redox-generic64" ], -+ perlasm_scheme => "elf", -+ }, -+ -+ - #### Solaris configurations - "solaris-common" => { - inherit_from => [ "BASE_unix" ], diff --git a/recipes/wip/libs/video/libgif/redox.patch b/recipes/wip/libs/video/libgif/redox.patch deleted file mode 100644 index b58cfcdb92..0000000000 --- a/recipes/wip/libs/video/libgif/redox.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ruwN giflib-5.2.1/Makefile source/Makefile ---- giflib-5.2.1/Makefile 2019-06-24 10:08:57.000000000 -0600 -+++ source/Makefile 2025-05-10 13:15:44.301303744 -0600 -@@ -14,7 +14,7 @@ - TAR = tar - INSTALL = install - --PREFIX = /usr/local -+PREFIX = /usr - BINDIR = $(PREFIX)/bin - INCDIR = $(PREFIX)/include - LIBDIR = $(PREFIX)/lib diff --git a/recipes/wip/net/http/apache-httpd/redox.patch b/recipes/wip/net/http/apache-httpd/redox.patch deleted file mode 100644 index c31d17e065..0000000000 --- a/recipes/wip/net/http/apache-httpd/redox.patch +++ /dev/null @@ -1,436 +0,0 @@ -diff --git a/Makefile.in b/Makefile.in -index ebf7a16..296e661 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -1,5 +1,5 @@ - --SUBDIRS = srclib os server modules support -+SUBDIRS = srclib os server modules - CLEAN_SUBDIRS = test - - PROGRAM_NAME = $(progname) -@@ -7,9 +7,10 @@ PROGRAM_SOURCES = modules.c - PROGRAM_LDADD = buildmark.o $(HTTPD_LDFLAGS) $(PROGRAM_DEPENDENCIES) $(PCRE_LIBS) $(EXTRA_LIBS) $(AP_LIBS) $(LIBS) - PROGRAM_PRELINK = $(COMPILE) -c $(top_srcdir)/server/buildmark.c - PROGRAM_DEPENDENCIES = \ -+ -lc \ -+ $(MPM_LIB) \ - server/libmain.la \ - $(BUILTIN_LIBS) \ -- $(MPM_LIB) \ - os/$(OS_DIR)/libos.la - - sbin_PROGRAMS = $(PROGRAM_NAME) -@@ -290,28 +291,7 @@ install-man: - cd $(DESTDIR)$(manualdir) && find . -name ".svn" -type d -print | xargs rm -rf 2>/dev/null || true; \ - fi - --install-suexec: install-suexec-$(INSTALL_SUEXEC) -- --install-suexec-binary: -- @if test -f $(builddir)/support/suexec; then \ -- test -d $(DESTDIR)$(sbindir) || $(MKINSTALLDIRS) $(DESTDIR)$(sbindir); \ -- $(INSTALL_PROGRAM) $(top_builddir)/support/suexec $(DESTDIR)$(sbindir); \ -- fi -- --install-suexec-setuid: install-suexec-binary -- @if test -f $(builddir)/support/suexec; then \ -- chmod 4755 $(DESTDIR)$(sbindir)/suexec; \ -- fi -- --install-suexec-caps: install-suexec-binary -- @if test -f $(builddir)/support/suexec; then \ -- setcap 'cap_setuid,cap_setgid+pe' $(DESTDIR)$(sbindir)/suexec; \ -- fi -- --suexec: -- cd support && $(MAKE) suexec -- --x-local-distclean: -+-local-distclean: - @rm -rf autom4te.cache - - # XXX: This looks awfully platform-specific [read: bad form and style] -diff --git a/configure b/configure -index 6eb60fd..46b490e 100755 ---- a/configure -+++ b/configure -@@ -4998,7 +4998,7 @@ else - done - if test $apr_addto_duplicate = "0"; then - test "x$silent" != "xyes" && echo " adding \"$i\" to LDFLAGS" -- LDFLAGS="$LDFLAGS $i" -+ # LDFLAGS="$LDFLAGS $i" - fi - done - fi -@@ -5006,6 +5006,7 @@ else - APU_BINDIR=`$apu_config --bindir` - APU_INCLUDEDIR=`$apu_config --includedir` - APU_INCLUDES=`$apu_config --includes` -+ echo "$apu_config --includes" = "$APU_INCLUDES" - APU_VERSION=`$apu_config --version` - APU_CONFIG="$APU_BINDIR/apu-`echo ${APU_VERSION} | sed 's,\..*,,'`-config" - fi -@@ -6268,9 +6269,9 @@ $as_echo "$as_me: Using external PCRE library from $PCRE_CONFIG" >&6;} - - if test "x$PCRE_LIBS" = "x"; then - test "x$silent" != "xyes" && echo " setting PCRE_LIBS to \"`$PCRE_CONFIG --libs8 2>/dev/null || $PCRE_CONFIG --libs`\"" -- PCRE_LIBS="`$PCRE_CONFIG --libs8 2>/dev/null || $PCRE_CONFIG --libs`" -+ PCRE_LIBS="-lpcre" - else -- apr_addto_bugger="`$PCRE_CONFIG --libs8 2>/dev/null || $PCRE_CONFIG --libs`" -+ apr_addto_bugger="-lpcre" - for i in $apr_addto_bugger; do - apr_addto_duplicate="0" - for j in $PCRE_LIBS; do -@@ -40691,9 +40692,11 @@ fi - - - if test x${apu_found} != xobsolete; then -- AP_LIBS="$AP_LIBS `$apu_config --avoid-ldap --link-libtool --libs`" -+ # AP_LIBS="$AP_LIBS `$apu_config --avoid-ldap --link-libtool --libs`" -ldb-5.3 -+ AP_LIBS="$AP_LIBS -laprutil-1 -lgdbm -lexpat" - fi --AP_LIBS="$AP_LIBS `$apr_config --link-libtool --libs`" -+# AP_LIBS="$AP_LIBS `$apr_config --link-libtool --libs`" -+AP_LIBS="$AP_LIBS -lapr-1 -luuid -lrt -lcrypt -lpthread -ldl" - - APACHE_VAR_SUBST="$APACHE_VAR_SUBST AP_LIBS" - -diff --git a/os/unix/unixd.c b/os/unix/unixd.c -index 0245720..cd241d2 100644 ---- a/os/unix/unixd.c -+++ b/os/unix/unixd.c -@@ -231,31 +231,6 @@ AP_DECLARE(apr_status_t) ap_unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex) - apr_lockmech_e mech = proc_mutex_mech(pmutex); - - switch(mech) { --#if APR_HAS_SYSVSEM_SERIALIZE -- case APR_LOCK_SYSVSEM: -- { -- apr_os_proc_mutex_t ospmutex; --#if !APR_HAVE_UNION_SEMUN -- union semun { -- long val; -- struct semid_ds *buf; -- unsigned short *array; -- }; --#endif -- union semun ick; -- struct semid_ds buf = { { 0 } }; -- -- apr_os_proc_mutex_get(&ospmutex, pmutex); -- buf.sem_perm.uid = ap_unixd_config.user_id; -- buf.sem_perm.gid = ap_unixd_config.group_id; -- buf.sem_perm.mode = 0600; -- ick.buf = &buf; -- if (semctl(ospmutex.crossproc, 0, IPC_SET, ick) < 0) { -- return errno; -- } -- } -- break; --#endif - #if APR_HAS_FLOCK_SERIALIZE - case APR_LOCK_FLOCK: - { -diff --git a/server/Makefile.in b/server/Makefile.in -index 8111877..0449553 100644 ---- a/server/Makefile.in -+++ b/server/Makefile.in -@@ -1,5 +1,5 @@ - --CLEAN_TARGETS = gen_test_char test_char.h \ -+CLEAN_TARGETS = \ - ApacheCoreOS2.def httpd.exp export_files \ - exports.c export_vars.h - -@@ -24,12 +24,6 @@ TARGETS = delete-exports $(LTLIBRARY_NAME) $(CORE_IMPLIB_FILE) export_vars.h htt - include $(top_builddir)/build/rules.mk - include $(top_srcdir)/build/library.mk - --gen_test_char_OBJECTS = gen_test_char.lo --gen_test_char: $(gen_test_char_OBJECTS) -- $(LINK) $(EXTRA_LDFLAGS) $(gen_test_char_OBJECTS) $(EXTRA_LIBS) -- --test_char.h: gen_test_char -- ./gen_test_char > test_char.h - - util.lo: test_char.h - -diff --git a/server/gen_test_char.c b/server/gen_test_char.c -deleted file mode 100644 -index 248216b..0000000 ---- a/server/gen_test_char.c -+++ /dev/null -@@ -1,192 +0,0 @@ --/* Licensed to the Apache Software Foundation (ASF) under one or more -- * contributor license agreements. See the NOTICE file distributed with -- * this work for additional information regarding copyright ownership. -- * The ASF licenses this file to You under the Apache License, Version 2.0 -- * (the "License"); you may not use this file except in compliance with -- * the License. You may obtain a copy of the License at -- * -- * http://www.apache.org/licenses/LICENSE-2.0 -- * -- * Unless required by applicable law or agreed to in writing, software -- * distributed under the License is distributed on an "AS IS" BASIS, -- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- * See the License for the specific language governing permissions and -- * limitations under the License. -- */ -- --#ifdef CROSS_COMPILE -- --#include --#define apr_isalnum(c) (isalnum(((unsigned char)(c)))) --#define apr_isalpha(c) (isalpha(((unsigned char)(c)))) --#define apr_iscntrl(c) (iscntrl(((unsigned char)(c)))) --#define apr_isprint(c) (isprint(((unsigned char)(c)))) --#define APR_HAVE_STDIO_H 1 --#define APR_HAVE_STRING_H 1 -- --#else -- --#include "apr.h" --#include "apr_lib.h" -- --#endif -- --#if defined(WIN32) || defined(OS2) --#define NEED_ENHANCED_ESCAPES --#endif -- --#if APR_HAVE_STDIO_H --#include --#endif --#if APR_HAVE_STRING_H --#include --#endif -- --/* A bunch of functions in util.c scan strings looking for certain characters. -- * To make that more efficient we encode a lookup table. -- */ --#define T_ESCAPE_SHELL_CMD (0x01) --#define T_ESCAPE_PATH_SEGMENT (0x02) --#define T_OS_ESCAPE_PATH (0x04) --#define T_HTTP_TOKEN_STOP (0x08) --#define T_ESCAPE_LOGITEM (0x10) --#define T_ESCAPE_FORENSIC (0x20) --#define T_ESCAPE_URLENCODED (0x40) --#define T_HTTP_CTRLS (0x80) --#define T_VCHAR_OBSTEXT (0x100) --#define T_URI_UNRESERVED (0x200) -- --int main(int argc, char *argv[]) --{ -- unsigned c; -- unsigned short flags; -- -- printf("/* this file is automatically generated by gen_test_char, " -- "do not edit */\n" -- "#define T_ESCAPE_SHELL_CMD (%u)\n" -- "#define T_ESCAPE_PATH_SEGMENT (%u)\n" -- "#define T_OS_ESCAPE_PATH (%u)\n" -- "#define T_HTTP_TOKEN_STOP (%u)\n" -- "#define T_ESCAPE_LOGITEM (%u)\n" -- "#define T_ESCAPE_FORENSIC (%u)\n" -- "#define T_ESCAPE_URLENCODED (%u)\n" -- "#define T_HTTP_CTRLS (%u)\n" -- "#define T_VCHAR_OBSTEXT (%u)\n" -- "#define T_URI_UNRESERVED (%u)\n" -- "\n" -- "static const unsigned short test_char_table[256] = {", -- T_ESCAPE_SHELL_CMD, -- T_ESCAPE_PATH_SEGMENT, -- T_OS_ESCAPE_PATH, -- T_HTTP_TOKEN_STOP, -- T_ESCAPE_LOGITEM, -- T_ESCAPE_FORENSIC, -- T_ESCAPE_URLENCODED, -- T_HTTP_CTRLS, -- T_VCHAR_OBSTEXT, -- T_URI_UNRESERVED -- ); -- -- for (c = 0; c < 256; ++c) { -- flags = 0; -- if (c % 8 == 0) -- printf("\n "); -- -- /* escape_shell_cmd */ --#ifdef NEED_ENHANCED_ESCAPES -- /* Win32/OS2 have many of the same vulnerable characters -- * as Unix sh, plus the carriage return and percent char. -- * The proper escaping of these characters varies from unix -- * since Win32/OS2 use carets or doubled-double quotes, -- * and neither lf nor cr can be escaped. We escape unix -- * specific as well, to assure that cross-compiled unix -- * applications behave similarly when invoked on win32/os2. -- * -- * Rem please keep in-sync with apr's list in win32/filesys.c -- */ -- if (c && strchr("&;`'\"|*?~<>^()[]{}$\\\n\r%", c)) { -- flags |= T_ESCAPE_SHELL_CMD; -- } --#else -- if (c && strchr("&;`'\"|*?~<>^()[]{}$\\\n", c)) { -- flags |= T_ESCAPE_SHELL_CMD; -- } --#endif -- -- if (!apr_isalnum(c) && !strchr("$-_.+!*'(),:@&=~", c)) { -- flags |= T_ESCAPE_PATH_SEGMENT; -- } -- -- if (!apr_isalnum(c) && !strchr("$-_.+!*'(),:;@&=/~", c)) { -- flags |= T_OS_ESCAPE_PATH; -- } -- -- if (!apr_isalnum(c) && !strchr(".-*_ ", c)) { -- flags |= T_ESCAPE_URLENCODED; -- } -- -- /* Stop for any non-'token' character, including ctrls, obs-text, -- * and "tspecials" (RFC2068) a.k.a. "separators" (RFC2616), which -- * is easier to express as characters remaining in the ASCII token set -- */ -- if (!c || !(apr_isalnum(c) || strchr("!#$%&'*+-.^_`|~", c))) { -- flags |= T_HTTP_TOKEN_STOP; -- } -- -- /* Catch CTRLs other than VCHAR, HT and SP, and obs-text (RFC7230 3.2) -- * This includes only the C0 plane, not C1 (which is obs-text itself.) -- * XXX: We should verify that all ASCII C0 ctrls/DEL corresponding to -- * the current EBCDIC translation are captured, and ASCII C1 ctrls -- * corresponding are all permitted (as they fall under obs-text rule) -- */ -- if (!c || (apr_iscntrl(c) && c != '\t')) { -- flags |= T_HTTP_CTRLS; -- } -- -- /* From RFC3986, the specific sets of gen-delims, sub-delims (2.2), -- * and unreserved (2.3) that are possible somewhere within a URI. -- * Spec requires all others to be %XX encoded, including obs-text. -- */ -- if (c && !apr_iscntrl(c) && c != ' ') { -- flags |= T_VCHAR_OBSTEXT; -- } -- -- /* For logging, escape all control characters, -- * double quotes (because they delimit the request in the log file) -- * backslashes (because we use backslash for escaping) -- * and 8-bit chars with the high bit set -- */ -- if (c && (!apr_isprint(c) || c == '"' || c == '\\' || apr_iscntrl(c))) { -- flags |= T_ESCAPE_LOGITEM; -- } -- -- /* For forensic logging, escape all control characters, top bit set, -- * :, | (used as delimiters) and % (used for escaping). -- */ -- if (!apr_isprint(c) || c == ':' || c == '|' || c == '%' -- || apr_iscntrl(c) || !c) { -- flags |= T_ESCAPE_FORENSIC; -- } -- -- /* Characters in the RFC 3986 "unreserved" set. -- * https://datatracker.ietf.org/doc/html/rfc3986#section-2.3 */ -- if (c && (apr_isalnum(c) || strchr("-._~", c))) { -- flags |= T_URI_UNRESERVED; -- } -- -- printf("0x%03x%c", flags, (c < 255) ? ',' : ' '); -- } -- -- printf("\n};\n\n"); -- -- printf( -- "/* we assume the folks using this ensure 0 <= c < 256... which means\n" -- " * you need a cast to (unsigned char) first, you can't just plug a\n" -- " * char in here and get it to work, because if char is signed then it\n" -- " * will first be sign extended.\n" -- " */\n" -- "#define TEST_CHAR(c, f) (test_char_table[(unsigned char)(c)] & (f))\n" -- ); -- -- return 0; --} -diff --git a/server/mpm_fdqueue.c b/server/mpm_fdqueue.c -index 3697ca7..9f9d36e 100644 ---- a/server/mpm_fdqueue.c -+++ b/server/mpm_fdqueue.c -@@ -17,6 +17,7 @@ - #include "mpm_fdqueue.h" - - #if APR_HAS_THREADS -+#warning "apr_has_threads" - - #include - -@@ -531,4 +532,6 @@ apr_status_t ap_queue_term(fd_queue_t *queue) - return queue_interrupt(queue, 1, 1); - } - -+#else -+#warning "no apr_has_threads" - #endif /* APR_HAS_THREADS */ -diff --git a/server/test_char.h b/server/test_char.h -new file mode 100644 -index 0000000..ebd7395 ---- /dev/null -+++ b/server/test_char.h -@@ -0,0 +1,53 @@ -+/* this file is automatically generated by gen_test_char, do not edit */ -+#define T_ESCAPE_SHELL_CMD (1) -+#define T_ESCAPE_PATH_SEGMENT (2) -+#define T_OS_ESCAPE_PATH (4) -+#define T_HTTP_TOKEN_STOP (8) -+#define T_ESCAPE_LOGITEM (16) -+#define T_ESCAPE_FORENSIC (32) -+#define T_ESCAPE_URLENCODED (64) -+#define T_HTTP_CTRLS (128) -+#define T_VCHAR_OBSTEXT (256) -+#define T_URI_UNRESERVED (512) -+ -+static const unsigned short test_char_table[256] = { -+ 0x0a8,0x0fe,0x0fe,0x0fe,0x0fe,0x0fe,0x0fe,0x0fe, -+ 0x0fe,0x07e,0x0ff,0x0fe,0x0fe,0x0fe,0x0fe,0x0fe, -+ 0x0fe,0x0fe,0x0fe,0x0fe,0x0fe,0x0fe,0x0fe,0x0fe, -+ 0x0fe,0x0fe,0x0fe,0x0fe,0x0fe,0x0fe,0x0fe,0x0fe, -+ 0x00e,0x140,0x15f,0x146,0x141,0x166,0x141,0x141, -+ 0x149,0x149,0x101,0x140,0x148,0x300,0x300,0x14a, -+ 0x300,0x300,0x300,0x300,0x300,0x300,0x300,0x300, -+ 0x300,0x300,0x168,0x14b,0x14f,0x148,0x14f,0x14f, -+ 0x148,0x300,0x300,0x300,0x300,0x300,0x300,0x300, -+ 0x300,0x300,0x300,0x300,0x300,0x300,0x300,0x300, -+ 0x300,0x300,0x300,0x300,0x300,0x300,0x300,0x300, -+ 0x300,0x300,0x300,0x14f,0x15f,0x14f,0x147,0x300, -+ 0x147,0x300,0x300,0x300,0x300,0x300,0x300,0x300, -+ 0x300,0x300,0x300,0x300,0x300,0x300,0x300,0x300, -+ 0x300,0x300,0x300,0x300,0x300,0x300,0x300,0x300, -+ 0x300,0x300,0x300,0x14f,0x167,0x14f,0x341,0x0fe, -+ 0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e, -+ 0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e, -+ 0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e, -+ 0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e, -+ 0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e, -+ 0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e, -+ 0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e, -+ 0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e, -+ 0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e, -+ 0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e, -+ 0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e, -+ 0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e, -+ 0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e, -+ 0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e, -+ 0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e, -+ 0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e,0x17e -+}; -+ -+/* we assume the folks using this ensure 0 <= c < 256... which means -+ * you need a cast to (unsigned char) first, you can't just plug a -+ * char in here and get it to work, because if char is signed then it -+ * will first be sign extended. -+ */ -+#define TEST_CHAR(c, f) (test_char_table[(unsigned char)(c)] & (f)) diff --git a/recipes/wip/net/http/lighttpd/redox.patch b/recipes/wip/net/http/lighttpd/redox.patch deleted file mode 100644 index 91dee4a973..0000000000 --- a/recipes/wip/net/http/lighttpd/redox.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --color -ruwN source/src/fdevent.c source-new/src/fdevent.c ---- source/src/fdevent.c 2025-09-13 02:08:20.000000000 +0700 -+++ source-new/src/fdevent.c 2026-03-14 14:16:21.543520177 +0700 -@@ -321,7 +321,7 @@ - int fd; - socklen_t len = (socklen_t) *addrlen; - -- #if defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK) -+ #if defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK) && !defined(__redox__) - #if defined(__NetBSD__) - const int sock_cloexec = 1; - fd = paccept(listenfd, addr, &len, NULL, SOCK_CLOEXEC | SOCK_NONBLOCK); diff --git a/recipes/wip/net/http/miniserve/redox.patch b/recipes/wip/net/http/miniserve/redox.patch deleted file mode 100644 index dc18a4c129..0000000000 --- a/recipes/wip/net/http/miniserve/redox.patch +++ /dev/null @@ -1,34 +0,0 @@ -diff --git a/Cargo.toml b/Cargo.toml -index 68f26c9..98c4dde 100644 ---- a/Cargo.toml -+++ b/Cargo.toml -@@ -39,7 +39,6 @@ futures = "0.3" - grass = { version = "0.13", features = ["macro"], default-features = false } - hex = "0.4" - httparse = "1" --if-addrs = "0.15" - libflate = "2" - log = "0.4" - maud = "0.27" -@@ -62,6 +61,9 @@ thiserror = "2" - tokio = { version = "1.47.1", features = ["fs", "macros"] } - zip = { version = "8", default-features = false } - -+[target.'cfg(not(target_os = "redox"))'.dependencies] -+if-addrs = "0.15" -+ - [features] - default = ["tls"] - # This feature allows us to use rustls only on architectures supported by ring. -diff --git a/src/main.rs b/src/main.rs -index aea9ed9..3c91968 100644 ---- a/src/main.rs -+++ b/src/main.rs -@@ -193,6 +193,7 @@ async fn run(miniserve_config: MiniserveConfig) -> Result<(), StartupError> { - .partition(|addr| !addr.is_unspecified()); - - // Replace wildcard addresses with local interface addresses -+ #[cfg(not(target_os="redox"))] - if !wildcard.is_empty() { - let all_ipv4 = wildcard.iter().any(|addr| addr.is_ipv4()); - let all_ipv6 = wildcard.iter().any(|addr| addr.is_ipv6()); diff --git a/recipes/wip/shells/fish-shell/redox.patch b/recipes/wip/shells/fish-shell/redox.patch deleted file mode 100644 index 9b5a0d30dd..0000000000 --- a/recipes/wip/shells/fish-shell/redox.patch +++ /dev/null @@ -1,144 +0,0 @@ -diff '--color=auto' -ruwN source/Cargo.toml source-new/Cargo.toml ---- source/Cargo.toml 2025-09-11 01:59:14.785564526 -0400 -+++ source-new/Cargo.toml 2025-09-11 01:59:45.885553436 -0400 -@@ -35,12 +35,12 @@ - - bitflags = "2.5.0" - errno = "0.3.0" --libc = "0.2" -+libc = { git = "https://github.com/rust-lang/libc", rev = "b31ee9b22f99354f2ca00c68d038d6f377c8b8a4", features = ["extra_traits"] } - # lru pulls in hashbrown by default, which uses a faster (though less DoS resistant) hashing algo. - # disabling default features uses the stdlib instead, but it doubles the time to rewrite the history - # files as of 22 April 2024. - lru = "0.13.0" --nix = { version = "0.30.1", default-features = false, features = [ -+nix = { git = "https://github.com/joshuamegnauth54/nix", branch = "redox-fish-no-merge", default-features = false, features = [ - "event", - "inotify", - "resource", -diff '--color=auto' -ruwN source/src/exec.rs source-new/src/exec.rs ---- source/src/exec.rs 2025-09-11 01:59:14.596625190 -0400 -+++ source-new/src/exec.rs 2025-09-11 02:00:00.315286369 -0400 -@@ -33,7 +33,6 @@ - use crate::nix::{getpid, isatty}; - use crate::null_terminated_array::OwningNullTerminatedArray; - use crate::parser::{Block, BlockId, BlockType, EvalRes, Parser}; --#[cfg(FISH_USE_POSIX_SPAWN)] - use crate::proc::Pid; - use crate::proc::{ - hup_jobs, is_interactive_session, jobs_requiring_warning_on_exit, no_exec, -@@ -390,7 +389,7 @@ - ) -> ! { - // This function never returns, so we take certain liberties with constness. - -- unsafe { libc::execve(actual_cmd.as_ptr(), argv.get(), envv.get()) }; -+ unsafe { libc::execve(actual_cmd.as_ptr(), argv.get().cast(), envv.get().cast()) }; - let err = errno(); - - // The shebang wasn't introduced until UNIX Seventh Edition, so if -@@ -413,7 +412,11 @@ - // not what we would pass as argv0. - argv2[1] = actual_cmd.as_ptr(); - unsafe { -- libc::execve(_PATH_BSHELL.load(Ordering::Relaxed), &argv2[0], envv.get()); -+ libc::execve( -+ _PATH_BSHELL.load(Ordering::Relaxed), -+ argv2.as_ptr().cast(), -+ envv.get().cast(), -+ ); - } - } - } -diff '--color=auto' -ruwN source/src/fork_exec/postfork.rs source-new/src/fork_exec/postfork.rs ---- source/src/fork_exec/postfork.rs 2025-09-11 01:59:14.828576001 -0400 -+++ source-new/src/fork_exec/postfork.rs 2025-09-11 02:00:00.319001235 -0400 -@@ -339,7 +339,9 @@ - "', which is not an executable command." - ); - } -- } else if md.unwrap().mode() & u32::from(libc::S_IFMT) == u32::from(libc::S_IFDIR) { -+ } else if md.unwrap().mode() & u32::try_from(libc::S_IFMT).unwrap() -+ == u32::try_from(libc::S_IFDIR).unwrap() -+ { - FLOG_SAFE!( - exec, - "Failed to execute process '", -diff '--color=auto' -ruwN source/src/input_common.rs source-new/src/input_common.rs ---- source/src/input_common.rs 2025-09-11 01:59:14.828576001 -0400 -+++ source-new/src/input_common.rs 2025-09-11 02:00:00.316042380 -0400 -@@ -589,7 +589,9 @@ - // pselect expects timeouts in nanoseconds. - const NSEC_PER_MSEC: u64 = 1000 * 1000; - const NSEC_PER_SEC: u64 = NSEC_PER_MSEC * 1000; -+ #[cfg(not(target_os = "redox"))] - let wait_nsec: u64 = (timeout.as_millis() as u64) * NSEC_PER_MSEC; -+ #[cfg(not(target_os = "redox"))] - let timeout = libc::timespec { - tv_sec: (wait_nsec / NSEC_PER_SEC).try_into().unwrap(), - tv_nsec: (wait_nsec % NSEC_PER_SEC).try_into().unwrap(), -@@ -605,6 +607,7 @@ - libc::FD_SET(in_fd, &mut fdset); - } - -+ #[cfg(not(target_os = "redox"))] - let res = unsafe { - libc::pselect( - in_fd + 1, -@@ -616,6 +619,31 @@ - ) - }; - -+ #[cfg(target_os = "redox")] -+ let res = unsafe { -+ //HACK: pselect does this atomically -+ let mut saved = MaybeUninit::uninit(); -+ let mut saved = { -+ libc::sigfillset(saved.as_mut_ptr()); -+ saved.assume_init() -+ }; -+ libc::sigprocmask(libc::SIG_SETMASK, &sigs, &mut saved); -+ let mut timeout = libc::timeval { -+ tv_sec: timeout.as_secs() as _, -+ tv_usec: timeout.subsec_micros() as _, -+ }; -+ let res = libc::select( -+ in_fd + 1, -+ &mut fdset, -+ ptr::null_mut(), -+ ptr::null_mut(), -+ &raw mut timeout, -+ ); -+ libc::sigprocmask(libc::SIG_SETMASK, &saved, ptr::null_mut()); -+ -+ res -+ }; -+ - // Prevent signal starvation on WSL causing the `torn_escapes.py` test to fail - if is_windows_subsystem_for_linux(WSL::V1) { - // Merely querying the current thread's sigmask is sufficient to deliver a pending signal -diff '--color=auto' -ruwN source/src/libc.c source-new/src/libc.c ---- source/src/libc.c 2025-09-11 01:59:14.599514890 -0400 -+++ source-new/src/libc.c 2025-09-11 02:00:00.304589636 -0400 -@@ -4,7 +4,7 @@ - #include - #include - #include // MB_CUR_MAX --#include // MNT_LOCAL -+/* #include // MNT_LOCAL */ - #include - #include // ST_LOCAL - #include // _CS_PATH, _PC_CASE_SENSITIVE -diff '--color=auto' -ruwN source/src/path.rs source-new/src/path.rs ---- source/src/path.rs 2025-09-11 01:59:14.600515157 -0400 -+++ source-new/src/path.rs 2025-09-11 02:00:00.317047039 -0400 -@@ -738,7 +738,9 @@ - crate::libc::ST_LOCAL(), - &narrow, - ); -- #[cfg(not(target_os = "netbsd"))] -+ #[cfg(target_os = "redox")] -+ let remoteness = DirRemoteness::unknown; -+ #[cfg(not(target_os = "redox"))] - let remoteness = remoteness_via_statfs( - libc::statfs, - |stat: &libc::statfs| stat.f_flags, diff --git a/recipes/wip/terminal/tmux/redox.patch b/recipes/wip/terminal/tmux/redox.patch deleted file mode 100644 index 169e6b8e00..0000000000 --- a/recipes/wip/terminal/tmux/redox.patch +++ /dev/null @@ -1,95 +0,0 @@ -diff --color -ruwN source/compat/base64.c source-new/compat/base64.c ---- source/compat/base64.c 2022-04-25 15:25:13.000000000 +0700 -+++ source-new/compat/base64.c 2026-04-09 07:15:37.515384719 +0700 -@@ -46,10 +46,10 @@ - #include - #include - #include --#include -+// #include - - #include --#include -+// #include - #include - - #include -diff --color -ruwN source/compat/reallocarray.c source-new/compat/reallocarray.c ---- source/compat/reallocarray.c 2022-04-25 15:25:13.000000000 +0700 -+++ source-new/compat/reallocarray.c 2026-04-09 07:15:37.515516254 +0700 -@@ -22,6 +22,7 @@ - - #include "compat.h" - -+#ifndef __redox__ - /* - * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX - * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW -@@ -38,3 +39,4 @@ - } - return realloc(optr, size * nmemb); - } -+#endif -diff --color -ruwN source/input.c source-new/input.c ---- source/input.c 2025-12-05 12:37:44.000000000 +0700 -+++ source-new/input.c 2026-04-09 07:15:37.515731613 +0700 -@@ -21,7 +21,7 @@ - #include - - #include --#include -+// #include - #include - #include - #include -diff --color -ruwN source/tmux.c source-new/tmux.c ---- source/tmux.c 2025-10-29 15:49:16.000000000 +0700 -+++ source-new/tmux.c 2026-04-09 07:17:30.947212475 +0700 -@@ -222,10 +222,13 @@ - xasprintf(cause, "%s is not a directory", base); - goto fail; - } -+// FIXME: mkdir set wrong permission -+#ifndef __redox__ - if (sb.st_uid != uid || (sb.st_mode & TMUX_SOCK_PERM) != 0) { - xasprintf(cause, "directory %s has unsafe permissions", base); - goto fail; - } -+#endif - xasprintf(&path, "%s/%s", base, label); - free(base); - return (path); -diff --color -ruwN source/tty.c source-new/tty.c ---- source/tty.c 2025-12-05 12:37:44.000000000 +0700 -+++ source-new/tty.c 2026-04-09 07:15:37.516745754 +0700 -@@ -24,7 +24,7 @@ - #include - #include - #include --#include -+// #include - #include - #include - #include -@@ -347,8 +347,7 @@ - tio.c_iflag &= ~(IXON|IXOFF|ICRNL|INLCR|IGNCR|IMAXBEL|ISTRIP); - tio.c_iflag |= IGNBRK; - tio.c_oflag &= ~(OPOST|ONLCR|OCRNL|ONLRET); -- tio.c_lflag &= ~(IEXTEN|ICANON|ECHO|ECHOE|ECHONL|ECHOCTL|ECHOPRT| -- ECHOKE|ISIG); -+ tio.c_lflag &= ~(IEXTEN|ICANON|ECHO|ECHOE|ECHONL|ECHOPRT|ISIG); - tio.c_cc[VMIN] = 1; - tio.c_cc[VTIME] = 0; - if (tcsetattr(c->fd, TCSANOW, &tio) == 0) -diff --color -ruwN source/tty-keys.c source-new/tty-keys.c ---- source/tty-keys.c 2025-12-05 12:37:44.000000000 +0700 -+++ source-new/tty-keys.c 2026-04-09 07:15:37.516964363 +0700 -@@ -23,7 +23,7 @@ - - #include - #include --#include -+// #include - #include - #include - #include diff --git a/recipes/wip/text/neovim/redox.patch b/recipes/wip/text/neovim/redox.patch deleted file mode 100644 index 694ace266a..0000000000 --- a/recipes/wip/text/neovim/redox.patch +++ /dev/null @@ -1,155 +0,0 @@ -diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt -index d103b5f4..37d9444e 100644 ---- a/runtime/CMakeLists.txt -+++ b/runtime/CMakeLists.txt -@@ -24,37 +24,6 @@ add_custom_command(OUTPUT ${GENERATED_SYN_VIM} - - file(GLOB PACKAGES CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/runtime/pack/dist/opt/*) - --set(GENERATED_PACKAGE_TAGS) --foreach(PACKAGE ${PACKAGES}) -- get_filename_component(PACKNAME ${PACKAGE} NAME) -- file(GLOB "${PACKNAME}_DOC_FILES" CONFIGURE_DEPENDS ${PACKAGE}/doc/*.txt) -- if(${PACKNAME}_DOC_FILES) -- file(MAKE_DIRECTORY ${GENERATED_PACKAGE_DIR}/${PACKNAME}) -- add_custom_command(OUTPUT "${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/tags" -- COMMAND ${CMAKE_COMMAND} -E copy_directory -- ${PACKAGE} ${GENERATED_PACKAGE_DIR}/${PACKNAME} -- COMMAND $ -- -u NONE -i NONE -e --headless -c "helptags doc" -c quit -- DEPENDS -- nvim_bin -- nvim_runtime_deps -- WORKING_DIRECTORY "${GENERATED_PACKAGE_DIR}/${PACKNAME}" -- ) -- -- set("${PACKNAME}_DOC_NAMES") -- foreach(DF "${${PACKNAME}_DOC_FILES}") -- get_filename_component(F ${DF} NAME) -- list(APPEND "${PACKNAME}_DOC_NAMES" ${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/${F}) -- endforeach() -- -- install_helper( -- FILES ${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/tags "${${PACKNAME}_DOC_NAMES}" -- DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/pack/dist/opt/${PACKNAME}/doc) -- -- list(APPEND GENERATED_PACKAGE_TAGS "${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/tags") -- endif() --endforeach() -- - set(BUILDDOCFILES) - foreach(DF ${DOCFILES}) - get_filename_component(F ${DF} NAME) -@@ -65,8 +34,6 @@ add_custom_command(OUTPUT ${GENERATED_HELP_TAGS} - COMMAND ${CMAKE_COMMAND} -E remove_directory doc - COMMAND ${CMAKE_COMMAND} -E copy_directory - ${PROJECT_SOURCE_DIR}/runtime/doc doc -- COMMAND $ -- -u NONE -i NONE -e --headless -c "helptags ++t doc" -c quit - DEPENDS - nvim_bin - nvim_runtime_deps -@@ -78,7 +45,6 @@ add_custom_target( - DEPENDS - ${GENERATED_SYN_VIM} - ${GENERATED_HELP_TAGS} -- ${GENERATED_PACKAGE_TAGS} - ) - - # CMake is painful here. It will create the destination using the user's -@@ -87,10 +53,6 @@ add_custom_target( - # seems like the best compromise. If we create it, then everyone can see it. - # If it's preexisting, leave it alone. - --install_helper( -- FILES ${GENERATED_HELP_TAGS} ${BUILDDOCFILES} -- DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/doc) -- - install_helper( - FILES ${GENERATED_SYN_VIM} - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/syntax/vim) -diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt -index 4a8fe4c6..55a9ede1 100644 ---- a/src/nvim/CMakeLists.txt -+++ b/src/nvim/CMakeLists.txt -@@ -93,19 +93,6 @@ if(NOT MSVC) - endif() - - # -fstack-protector breaks Mingw-w64 builds --if(NOT MINGW) -- check_c_compiler_flag(-fstack-protector-strong HAS_FSTACK_PROTECTOR_STRONG_FLAG) -- if(HAS_FSTACK_PROTECTOR_STRONG_FLAG) -- target_compile_options(main_lib INTERFACE -fstack-protector-strong) -- target_link_libraries(main_lib INTERFACE -fstack-protector-strong) -- else() -- check_c_compiler_flag(-fstack-protector HAS_FSTACK_PROTECTOR_FLAG) -- if(HAS_FSTACK_PROTECTOR_FLAG) -- target_compile_options(main_lib INTERFACE -fstack-protector --param ssp-buffer-size=4) -- target_link_libraries(main_lib INTERFACE -fstack-protector --param ssp-buffer-size=4) -- endif() -- endif() --endif() - - # Compiler specific options - if(MSVC) -@@ -145,9 +132,6 @@ endif() - # Platform specific options - if(UNIX) - target_link_libraries(main_lib INTERFACE m) -- if (NOT CMAKE_SYSTEM_NAME STREQUAL "SunOS") -- target_link_libraries(main_lib INTERFACE util) -- endif() - endif() - - if(CMAKE_SYSTEM_NAME MATCHES "Windows") -diff --git a/src/nvim/main.c b/src/nvim/main.c -index 5c1e415c..fa6fa859 100644 ---- a/src/nvim/main.c -+++ b/src/nvim/main.c -@@ -698,6 +698,12 @@ void getout(int exitval) - assert(!ui_client_channel_id); - exiting = true; - -+ // parent doesn't notice SIGCHILD -+ pid_t ppid = getppid(); -+ if (ppid > 1) { -+ kill(ppid, SIGKILL); -+ } -+ - // make sure startuptimes have been flushed - time_finish(); - -diff --git a/src/nvim/os/os_defs.h b/src/nvim/os/os_defs.h -index db575e00..b42cee2a 100644 ---- a/src/nvim/os/os_defs.h -+++ b/src/nvim/os/os_defs.h -@@ -28,6 +28,8 @@ - - #if !defined(NAME_MAX) && defined(_XOPEN_NAME_MAX) - # define NAME_MAX _XOPEN_NAME_MAX -+#elif !defined(NAME_MAX) -+# define NAME_MAX 255 - #endif - - #define BASENAMELEN (NAME_MAX - 5) -diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c -index 7dff8a1b..ebc61542 100644 ---- a/src/nvim/os/shell.c -+++ b/src/nvim/os/shell.c -@@ -880,7 +880,16 @@ static int do_os_system(char **argv, const char *input, size_t len, char **outpu - MultiQueue *events = multiqueue_new_child(main_loop.events); - proc->events = events; - proc->argv = argv; -+#ifdef __redox__ -+ msg_puts("Shell execution is disabled until https://gitlab.redox-os.org/redox-os/redox/-/issues/1762 closed and this workaround removed\n"); -+ loop_poll_events(&main_loop, 0); -+ multiqueue_free(events); -+ return -1; -+ int status = -1; -+#else - int status = proc_spawn(proc, has_input, true, true); -+#endif -+ - if (status) { - loop_poll_events(&main_loop, 0); - // Failed, probably 'shell' is not executable. diff --git a/recipes/wip/vice/01_redox.patch b/recipes/wip/vice/01_redox.patch deleted file mode 100644 index 936cbdea55..0000000000 --- a/recipes/wip/vice/01_redox.patch +++ /dev/null @@ -1,107 +0,0 @@ -diff -rupNw source-original/configure source/configure ---- source-original/configure 2018-12-19 22:25:02.000000000 +0100 -+++ source/configure 2019-02-12 17:09:41.954190921 +0100 -@@ -10320,54 +10320,6 @@ done - test -n "$DOS2UNIX" || DOS2UNIX="dos2unix" - - --for ac_prog in xa xa65 --do -- # Extract the first word of "$ac_prog", so it can be a program name with args. --set dummy $ac_prog; ac_word=$2 --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 --$as_echo_n "checking for $ac_word... " >&6; } --if ${ac_cv_prog_XA+:} false; then : -- $as_echo_n "(cached) " >&6 --else -- if test -n "$XA"; then -- ac_cv_prog_XA="$XA" # Let the user override the test. --else --as_save_IFS=$IFS; IFS=$PATH_SEPARATOR --for as_dir in $PATH --do -- IFS=$as_save_IFS -- test -z "$as_dir" && as_dir=. -- for ac_exec_ext in '' $ac_executable_extensions; do -- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then -- ac_cv_prog_XA="$ac_prog" -- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 -- break 2 -- fi --done -- done --IFS=$as_save_IFS -- --fi --fi --XA=$ac_cv_prog_XA --if test -n "$XA"; then -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XA" >&5 --$as_echo "$XA" >&6; } --else -- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 --$as_echo "no" >&6; } --fi -- -- -- test -n "$XA" && break --done --test -n "$XA" || XA="no" -- -- --if test x"$XA" = "xno"; then -- as_fn_error $? "xa is missing" "$LINENO" 5 --fi -- - if test x"$SVN" != "x"; then - svnrevision=`$SVN 2>dummy.tmp info $srcdir | grep Revision | cut -d " " -f 2` - rm dummy.tmp -@@ -15132,6 +15084,9 @@ fi - done - - -+UNIX_NETWORK_FUNCS_PRESENT=no -+ -+ - if test x"$UNIX_NETWORK_FUNCS_PRESENT" = "xyes"; then - - $as_echo "#define HAVE_NETWORK /**/" >>confdefs.h -diff -rupNw source-original/src/arch/sdl/rs232dev.c source/src/arch/sdl/rs232dev.c ---- source-original/src/arch/sdl/rs232dev.c 2018-08-13 20:18:45.000000000 +0200 -+++ source/src/arch/sdl/rs232dev.c 2019-02-11 10:16:12.989841923 +0100 -@@ -27,7 +27,7 @@ - #include "vice.h" - - #ifdef UNIX_COMPILE --#include "rs232dev-unix.c" -+//#include "rs232dev-unix.c" - #endif - - #ifdef WIN32_COMPILE -diff -rupNw source-original/src/opencbm.h source/src/opencbm.h ---- source-original/src/opencbm.h 2018-08-22 21:01:32.000000000 +0200 -+++ source/src/opencbm.h 2019-02-11 09:28:21.775162862 +0100 -@@ -117,6 +117,10 @@ typedef unsigned char __u_char; - typedef unsigned char __u_char; - #endif - -+#ifdef __redox__ -+typedef unsigned char __u_char; -+#endif -+ - #endif - - /* specifiers for the IEC bus lines */ -diff -rupNw source-original/src/sound.c source/src/sound.c ---- source-original/src/sound.c 2018-12-17 19:44:43.000000000 +0100 -+++ source/src/sound.c 2019-02-12 08:57:18.934381713 +0100 -@@ -1001,6 +1001,9 @@ int sound_open(void) - break; - } - -+ speed = 44100; -+ channels = 2; -+ - /* find pdev */ - for (i = 0; (pdev = sound_devices[i]); i++) { - if (!playname || (pdev->name && !strcasecmp(playname, pdev->name))) { diff --git a/recipes/wip/wayland/wlroots/redox.patch b/recipes/wip/wayland/wlroots/redox.patch deleted file mode 100644 index 92b6c8e232..0000000000 --- a/recipes/wip/wayland/wlroots/redox.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff -ruwN source-old/protocol/meson.build source/protocol/meson.build ---- source-old/protocol/meson.build 2023-11-21 09:06:13.000000000 -0700 -+++ source/protocol/meson.build 2025-10-30 17:22:43.903323248 -0600 -@@ -5,9 +5,8 @@ - ) - wl_protocol_dir = wayland_protos.get_variable('pkgdatadir') - --wayland_scanner_dep = dependency('wayland-scanner', native: true) - wayland_scanner = find_program( -- wayland_scanner_dep.get_variable('wayland_scanner'), -+ 'wayland-scanner', - native: true, - ) - -diff -ruwN source-old/render/dmabuf.c source/render/dmabuf.c ---- source-old/render/dmabuf.c 2023-11-21 09:06:13.000000000 -0700 -+++ source/render/dmabuf.c 2025-10-30 17:33:46.223683923 -0600 -@@ -5,6 +5,11 @@ - #include - #include "render/dmabuf.h" - -+#if defined(__redox__) -+//TODO: F_DUPFD_CLOEXEC needed for atomic close on exec -+#define F_DUPFD_CLOEXEC F_DUPFD -+#endif -+ - void wlr_dmabuf_attributes_finish(struct wlr_dmabuf_attributes *attribs) { - for (int i = 0; i < attribs->n_planes; ++i) { - close(attribs->fd[i]); diff --git a/recipes/wip/wayland/xwayland/redox.patch b/recipes/wip/wayland/xwayland/redox.patch deleted file mode 100644 index 1132282a14..0000000000 --- a/recipes/wip/wayland/xwayland/redox.patch +++ /dev/null @@ -1,158 +0,0 @@ -diff -ruwN source/hw/xwayland/meson.build source-new/hw/xwayland/meson.build ---- source/hw/xwayland/meson.build 2024-01-16 16:38:49.000000000 +0700 -+++ source-new/hw/xwayland/meson.build 2025-10-01 07:51:14.456575515 +0700 -@@ -30,8 +30,7 @@ - '../../mi/miinitext.h', - ] - --scanner_dep = dependency('wayland-scanner', native: true) --scanner = find_program(scanner_dep.get_pkgconfig_variable('wayland_scanner')) -+scanner = find_program('wayland-scanner', native: true) - - protocols_dep = dependency('wayland-protocols', version: wayland_protocols_req) - protodir = protocols_dep.get_pkgconfig_variable('pkgdatadir') -@@ -55,11 +54,7 @@ - arguments : ['client-header', '@INPUT@', '@OUTPUT@'] - ) - --if scanner_dep.version().version_compare('>= 1.14.91') - scanner_argument = 'private-code' --else -- scanner_argument = 'code' --endif - - code = generator(scanner, - output : '@BASENAME@-protocol.c', -diff -ruwN source/hw/xwayland/xwayland-glamor.h source-new/hw/xwayland/xwayland-glamor.h ---- source/hw/xwayland/xwayland-glamor.h 2024-01-16 16:38:49.000000000 +0700 -+++ source-new/hw/xwayland/xwayland-glamor.h 2025-10-01 08:01:01.409102814 +0700 -@@ -31,7 +31,7 @@ - #include - - #include --#include -+// #include - - #include "xwayland-types.h" - -@@ -103,7 +103,7 @@ - /* Called to get the DRM device of the primary GPU that this backend - * is set up on. - */ -- drmDevice *(*get_main_device)(struct xwl_screen *xwl_screen); -+ // drmDevice *(*get_main_device)(struct xwl_screen *xwl_screen); - - /* Direct hook to create the backing pixmap for a window */ - PixmapPtr (*create_pixmap_for_window)(struct xwl_window *xwl_window); -diff -ruwN source/hw/xwayland/xwayland-input.c source-new/hw/xwayland/xwayland-input.c ---- source/hw/xwayland/xwayland-input.c 2024-01-16 16:38:49.000000000 +0700 -+++ source-new/hw/xwayland/xwayland-input.c 2025-10-01 08:02:59.681082380 +0700 -@@ -26,7 +26,7 @@ - - #include - --#include -+// #include - #include - - #include -@@ -758,6 +758,7 @@ - xwl_seat->xwl_screen->serial = serial; - - switch (button) { -+/* - case BTN_LEFT: - index = 1; - break; -@@ -768,10 +769,9 @@ - index = 3; - break; - default: -- /* Skip indexes 4-7: they are used for vertical and horizontal scroll. -- The rest of the buttons go in order: BTN_SIDE becomes 8, etc. */ - index = 8 + button - BTN_SIDE; - break; -+*/ - } - - valuator_mask_zero(&mask); -@@ -1057,7 +1057,7 @@ - - state_rec = xwl_seat->keyboard->key->xkbInfo->state; - xkb_state = (XkbStateFieldFromRec(&state_rec) & 0xff); -- -+ /* - if (((key == KEY_LEFTSHIFT || key == KEY_RIGHTSHIFT) && (xkb_state & ControlMask)) || - ((key == KEY_LEFTCTRL || key == KEY_RIGHTCTRL) && (xkb_state & ShiftMask))) { - -@@ -1072,6 +1072,7 @@ - if (xwl_window) - xwl_window_rootful_update_title(xwl_window); - } -+ */ - } - - static void -diff -ruwN source/hw/xwayland/xwayland-window.c source-new/hw/xwayland/xwayland-window.c ---- source/hw/xwayland/xwayland-window.c 2024-01-16 16:38:49.000000000 +0700 -+++ source-new/hw/xwayland/xwayland-window.c 2025-10-01 08:00:07.858324820 +0700 -@@ -1102,7 +1102,7 @@ - for (int j = 0; j < dev_formats->num_formats; j++) - free(dev_formats->formats[j].modifiers); - free(dev_formats->formats); -- drmFreeDevice(&dev_formats->drm_dev); -+ // drmFreeDevice(&dev_formats->drm_dev); - } - - void -diff -ruwN source/hw/xwayland/xwayland-window.h source-new/hw/xwayland/xwayland-window.h ---- source/hw/xwayland/xwayland-window.h 2024-01-16 16:38:49.000000000 +0700 -+++ source-new/hw/xwayland/xwayland-window.h 2025-10-01 08:00:40.464798537 +0700 -@@ -38,7 +38,7 @@ - #include - #include - #include --#include -+// #include - - #include "xwayland-types.h" - -@@ -55,7 +55,7 @@ - }; - - struct xwl_device_formats { -- drmDevice *drm_dev; -+ // drmDevice *drm_dev; - int supports_scanout; - uint32_t num_formats; - struct xwl_format *formats; -@@ -75,7 +75,7 @@ - struct xwl_dmabuf_feedback { - struct zwp_linux_dmabuf_feedback_v1 *dmabuf_feedback; - struct xwl_format_table format_table; -- drmDevice *main_dev; -+ // drmDevice *main_dev; - /* - * This will be filled in during wl events and copied to - * dev_formats on dmabuf_feedback.tranche_done -diff -ruwN source/os/access.c source-new/os/access.c ---- source/os/access.c 2024-01-16 16:38:49.000000000 +0700 -+++ source-new/os/access.c 2025-10-01 07:22:43.931644468 +0700 -@@ -446,7 +446,7 @@ - int family; - register HOST *host; - --#ifndef WIN32 -+#if !defined(WIN32) && !defined(__redox__) - struct utsname name; - #else - struct { -@@ -477,7 +477,7 @@ - * uname() lets me access to the whole string (it smashes release, you - * see), whereas gethostname() kindly truncates it for me. - */ --#ifndef WIN32 -+#if !defined(WIN32) && !defined(__redox__) - uname(&name); - #else - gethostname(name.nodename, sizeof(name.nodename)); diff --git a/recipes/wip/web/firefox-esr/redox.patch b/recipes/wip/web/firefox-esr/redox.patch deleted file mode 100644 index d71240c3fc..0000000000 --- a/recipes/wip/web/firefox-esr/redox.patch +++ /dev/null @@ -1,295 +0,0 @@ -diff --color -ruwN source/build/moz.configure/init.configure source-new/build/moz.configure/init.configure ---- source/build/moz.configure/init.configure 2026-01-07 04:09:42.000000000 +0700 -+++ source-new/build/moz.configure/init.configure 2026-01-27 12:48:28.508789372 +0700 -@@ -511,6 +511,8 @@ - canonical_os = canonical_kernel = "NetBSD" - elif os.startswith("openbsd"): - canonical_os = canonical_kernel = "OpenBSD" -+ elif os.startswith("redox"): -+ canonical_os = canonical_kernel = "Redox" - elif os.startswith("solaris"): - canonical_os = canonical_kernel = "SunOS" - elif os.startswith("wasi") and allow_wasi: -@@ -934,6 +936,14 @@ - - set_define("XP_FREEBSD", target_is_freebsd) - -+@depends(target) -+def target_is_redox(target): -+ if target.kernel == "Redox": -+ return True -+ -+ -+set_define("XP_REDOX", target_is_redox) -+ - - @depends(target) - def target_is_solaris(target): -diff --color -ruwN source/mozglue/misc/PlatformMutex.h source-new/mozglue/misc/PlatformMutex.h ---- source/mozglue/misc/PlatformMutex.h 2026-01-07 04:09:50.000000000 +0700 -+++ source-new/mozglue/misc/PlatformMutex.h 2026-01-27 13:12:16.262181670 +0700 -@@ -48,7 +48,7 @@ - - PlatformData* platformData(); - --#if !defined(XP_WIN) && !defined(__wasi__) -+#if !defined(XP_WIN) && !defined(__wasi__) && !defined(__redox__) - void* platformData_[sizeof(pthread_mutex_t) / sizeof(void*)]; - static_assert(sizeof(pthread_mutex_t) / sizeof(void*) != 0 && - sizeof(pthread_mutex_t) % sizeof(void*) == 0, -diff --color -ruwN source/python/mozbuild/mozbuild/configure/constants.py source-new/python/mozbuild/mozbuild/configure/constants.py ---- source/python/mozbuild/mozbuild/configure/constants.py 2026-01-07 04:09:50.000000000 +0700 -+++ source-new/python/mozbuild/mozbuild/configure/constants.py 2026-01-27 09:16:48.349211711 +0700 -@@ -40,6 +40,7 @@ - "NetBSD", - "OpenBSD", - "OSX", -+ "Redox", - "SunOS", - "WINNT", - "WASI", -@@ -55,6 +56,7 @@ - "Linux", - "NetBSD", - "OpenBSD", -+ "Redox", - "SunOS", - "WINNT", - "WASI", -@@ -146,6 +148,7 @@ - "Linux": "__linux__", - "NetBSD": "__NetBSD__", - "OpenBSD": "__OpenBSD__", -+ "Redox": "__redox__", - "SunOS": "__sun__", - "WINNT": "_WIN32 || __CYGWIN__", - "WASI": "__wasi__", -diff --color -ruwN source/xpcom/build/BinaryPath.h source-new/xpcom/build/BinaryPath.h ---- source/xpcom/build/BinaryPath.h 2026-01-07 04:09:59.000000000 +0700 -+++ source-new/xpcom/build/BinaryPath.h 2026-01-27 12:51:20.922621049 +0700 -@@ -133,11 +133,15 @@ - return rv; - } - --#elif defined(ANDROID) -+#elif defined(ANDROID) || defined(XP_REDOX) - static nsresult Get(char aResult[MAXPATHLEN]) { - // On Android, we use the MOZ_ANDROID_LIBDIR variable that is set by the - // Java bootstrap code. -+#if defined(XP_REDOX) -+ const char* libDir = getenv("MOZ_REDOX_LIBDIR"); -+#else - const char* libDir = getenv("MOZ_ANDROID_LIBDIR"); -+#endif - if (!libDir) { - return NS_ERROR_FAILURE; - } -diff --color -ruwN source/Cargo.lock source-new/Cargo.lock ---- source/Cargo.lock 2026-01-07 04:09:41.000000000 +0700 -+++ source-new/Cargo.lock 2026-01-27 19:15:51.024103229 +0700 -@@ -3724,6 +3724,16 @@ - checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" - - [[package]] -+name = "libredox" -+version = "0.1.12" -+source = "registry+https://github.com/rust-lang/crates.io-index" -+checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" -+dependencies = [ -+ "bitflags 2.9.0", -+ "libc", -+] -+ -+[[package]] - name = "libsqlite3-sys" - version = "0.31.0" - source = "registry+https://github.com/rust-lang/crates.io-index" -@@ -5586,11 +5596,23 @@ - - [[package]] - name = "redox_syscall" --version = "0.5.999" -+version = "0.5.18" -+source = "registry+https://github.com/rust-lang/crates.io-index" -+checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" -+dependencies = [ -+ "bitflags 2.9.0", -+] - - [[package]] - name = "redox_users" --version = "0.4.999" -+version = "0.4.6" -+source = "registry+https://github.com/rust-lang/crates.io-index" -+checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" -+dependencies = [ -+ "getrandom 0.2.999", -+ "libredox", -+ "thiserror 1.999.999", -+] - - [[package]] - name = "regex" -diff --color -ruwN source/Cargo.toml source-new/Cargo.toml ---- source/Cargo.toml 2026-01-07 04:09:40.000000000 +0700 -+++ source-new/Cargo.toml 2026-01-27 19:14:06.467281854 +0700 -@@ -134,12 +134,6 @@ - # Patch r-efi to an empty crate - r-efi = { path = "build/rust/r-efi" } - --# Patch redox_users to an empty crate --redox_users = { path = "build/rust/redox_users" } -- --# Patch redox_syscall to an empty crate --redox_syscall = { path = "build/rust/redox_syscall" } -- - # Patch hermit-abi to an empty crate - hermit-abi = { path = "build/rust/hermit-abi" } - -diff --color -ruwN source/ipc/chromium/src/base/platform_thread.h source-new/ipc/chromium/src/base/platform_thread.h ---- source/ipc/chromium/src/base/platform_thread.h 2026-01-07 04:09:45.000000000 +0700 -+++ source-new/ipc/chromium/src/base/platform_thread.h 2026-01-27 18:12:57.887138642 +0700 -@@ -24,7 +24,7 @@ - #else - # include - typedef pthread_t PlatformThreadHandle; --# if defined(XP_LINUX) || defined(XP_OPENBSD) || defined(XP_SOLARIS) || \ -+# if defined(XP_LINUX) || defined(XP_OPENBSD) || defined(XP_REDOX) || defined(XP_SOLARIS) || \ - defined(__GLIBC__) - # include - typedef pid_t PlatformThreadId; -diff --color -ruwN source/mozglue/misc/TimeStamp_posix.cpp source-new/mozglue/misc/TimeStamp_posix.cpp ---- source/mozglue/misc/TimeStamp_posix.cpp 2026-01-07 04:09:50.000000000 +0700 -+++ source-new/mozglue/misc/TimeStamp_posix.cpp 2026-01-27 17:59:05.200260121 +0700 -@@ -13,7 +13,10 @@ - // obtained with this API; see TimeDuration::Resolution; - // - -+ -+#if !defined(__redox__) - #include -+#endif - #include - #include - #include -diff --color -ruwN source/supply-chain/audits.toml source-new/supply-chain/audits.toml ---- source/supply-chain/audits.toml 2026-01-07 04:09:51.000000000 +0700 -+++ source-new/supply-chain/audits.toml 2026-01-27 19:29:15.927403772 +0700 -@@ -3235,6 +3235,11 @@ - version = "0.2.6" - notes = "This crate uses unsafe block, but this doesn't have network and file access. I audited code." - -+[[audits.libredox]] -+who = "Wildan M " -+criteria = "safe-to-deploy" -+version = "0.1.12" -+ - [[audits.libsqlite3-sys]] - who = "Ben Dean-Kawamura " - criteria = "safe-to-deploy" -@@ -4560,10 +4565,20 @@ - delta = "1.10.1 -> 1.10.2" - - [[audits.redox_syscall]] -+who = "Wildan M " -+criteria = "safe-to-deploy" -+version = "0.5.18" -+ -+[[audits.redox_syscall]] - who = "Mike Hommey " - criteria = "safe-to-deploy" - delta = "0.2.13 -> 0.2.16" - -+[[audits.redox_users]] -+who = "Wildan M " -+criteria = "safe-to-deploy" -+version = "0.4.6" -+ - [[audits.regex]] - who = "Mike Hommey " - criteria = "safe-to-deploy" -@@ -4676,7 +4691,7 @@ - the `regex` developers in the same repository. - - This crate is explicitly designed for FFI use, and should not be used directly --by Rust code. The exported `extern \"C\"` functions are not marked as `unsafe`, -+by Rust code. The exported `extern "C"` functions are not marked as `unsafe`, - meaning that it is technically incorrect to use them from within Rust code, - however they are reasonable to use from C code. - -@@ -6463,7 +6478,7 @@ - who = "Makoto Kato " - criteria = "safe-to-deploy" - version = "0.1.2" --notes = "This crate is zero-copy version of \"From\". This has no unsafe code and uses no ambient capabilities." -+notes = 'This crate is zero-copy version of "From". This has no unsafe code and uses no ambient capabilities.' - - [[audits.zerofrom]] - who = "Makoto Kato " -diff --color -ruwN source/supply-chain/imports.lock source-new/supply-chain/imports.lock ---- source/supply-chain/imports.lock 2026-01-07 04:09:52.000000000 +0700 -+++ source-new/supply-chain/imports.lock 2026-01-27 19:29:15.929403788 +0700 -@@ -1592,7 +1592,7 @@ - criteria = "safe-to-deploy" - version = "1.6.0" - notes = """ --Grepped for \"unsafe\", \"crypt\", \"cipher\", \"fs\", \"net\" - there were no -+Grepped for "unsafe", "crypt", "cipher", "fs", "net" - there were no - hits except for 8 occurrences of `unsafe`. Additional `unsafe` review comments - can be found in https://crrev.com/c/5445719. - """ -@@ -1902,7 +1902,7 @@ - * Using `unsafe` in a string: - - ``` -- src/constfn.rs: \"unsafe\" => Qualifiers::Unsafe, -+ src/constfn.rs: "unsafe" => Qualifiers::Unsafe, - ``` - - * Using `std::fs` in `build/build.rs` to write `${OUT_DIR}/version.expr` -@@ -2104,6 +2104,7 @@ - user-id = 213776 # divviup-github-automation - start = "2020-09-28" - end = "2026-01-07" -+renew = false - - [[audits.isrg.audits.base64]] - who = "Tim Geoghegan " -diff --color -ruwN source/build/rust/redox_syscall/Cargo.toml source-new/build/rust/redox_syscall/Cargo.toml ---- source/build/rust/redox_syscall/Cargo.toml 2026-01-07 04:09:41.000000000 +0700 -+++ source-new/build/rust/redox_syscall/Cargo.toml 1970-01-01 07:00:00.000000000 +0700 -@@ -1,8 +0,0 @@ --[package] --name = "redox_syscall" --version = "0.5.999" --edition = "2018" --license = "MPL-2.0" -- --[lib] --path = "lib.rs" -diff --color -ruwN source/build/rust/redox_syscall/lib.rs source-new/build/rust/redox_syscall/lib.rs ---- source/build/rust/redox_syscall/lib.rs 2026-01-07 04:09:41.000000000 +0700 -+++ source-new/build/rust/redox_syscall/lib.rs 1970-01-01 07:00:00.000000000 +0700 -@@ -1,3 +0,0 @@ --/* This Source Code Form is subject to the terms of the Mozilla Public -- * License, v. 2.0. If a copy of the MPL was not distributed with this -- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -diff --color -ruwN source/build/rust/redox_users/Cargo.toml source-new/build/rust/redox_users/Cargo.toml ---- source/build/rust/redox_users/Cargo.toml 2026-01-07 04:09:41.000000000 +0700 -+++ source-new/build/rust/redox_users/Cargo.toml 1970-01-01 07:00:00.000000000 +0700 -@@ -1,8 +0,0 @@ --[package] --name = "redox_users" --version = "0.4.999" --edition = "2018" --license = "MPL-2.0" -- --[lib] --path = "lib.rs" -diff --color -ruwN source/build/rust/redox_users/lib.rs source-new/build/rust/redox_users/lib.rs ---- source/build/rust/redox_users/lib.rs 2026-01-07 04:09:41.000000000 +0700 -+++ source-new/build/rust/redox_users/lib.rs 1970-01-01 07:00:00.000000000 +0700 -@@ -1,3 +0,0 @@ --/* This Source Code Form is subject to the terms of the Mozilla Public -- * License, v. 2.0. If a copy of the MPL was not distributed with this -- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/recipes/wip/web/webkitgtk3/redox.patch b/recipes/wip/web/webkitgtk3/redox.patch deleted file mode 100644 index 8b498f7edb..0000000000 --- a/recipes/wip/web/webkitgtk3/redox.patch +++ /dev/null @@ -1,613 +0,0 @@ -diff -ruwN source/Source/bmalloc/bmalloc/BPlatform.h source-new/Source/bmalloc/bmalloc/BPlatform.h ---- source/Source/bmalloc/bmalloc/BPlatform.h 2025-03-28 13:18:28.347204000 +0700 -+++ source-new/Source/bmalloc/bmalloc/BPlatform.h 2025-10-07 20:55:41.123161164 +0700 -@@ -40,7 +40,7 @@ - #define BOS_DARWIN 1 - #endif - --#if defined(__unix) || defined(__unix__) -+#if defined(__unix) || defined(__unix__) || defined(__redox__) - #define BOS_UNIX 1 - #endif - -@@ -339,7 +339,7 @@ - - /* BENABLE(LIBPAS) is enabling libpas build. But this does not mean we use libpas for bmalloc replacement. */ - #if !defined(BENABLE_LIBPAS) --#if BCPU(ADDRESS64) && (BOS(DARWIN) || (BOS(LINUX) && (BCPU(X86_64) || BCPU(ARM64))) || BPLATFORM(PLAYSTATION)) -+#if BCPU(ADDRESS64) && (BOS(DARWIN) || (BOS(LINUX) && (BCPU(X86_64) || BCPU(ARM64))) || BPLATFORM(PLAYSTATION)) || defined(__redox__) - #define BENABLE_LIBPAS 1 - #ifndef PAS_BMALLOC - #define PAS_BMALLOC 1 -diff -ruwN source/Source/bmalloc/libpas/src/libpas/pas_committed_pages_vector.c source-new/Source/bmalloc/libpas/src/libpas/pas_committed_pages_vector.c ---- source/Source/bmalloc/libpas/src/libpas/pas_committed_pages_vector.c 2023-09-18 14:56:46.731077000 +0700 -+++ source-new/Source/bmalloc/libpas/src/libpas/pas_committed_pages_vector.c 2025-10-07 22:23:20.298893452 +0700 -@@ -57,6 +57,8 @@ - - #if PAS_OS(LINUX) - PAS_SYSCALL(mincore(object, size, (unsigned char*)vector->raw_data)); -+#elif PAS_OS(REDOX) -+ // no op - #else - PAS_SYSCALL(mincore(object, size, vector->raw_data)); - #endif -diff -ruwN source/Source/bmalloc/libpas/src/libpas/pas_committed_pages_vector.h source-new/Source/bmalloc/libpas/src/libpas/pas_committed_pages_vector.h ---- source/Source/bmalloc/libpas/src/libpas/pas_committed_pages_vector.h 2023-09-18 14:56:46.731077000 +0700 -+++ source-new/Source/bmalloc/libpas/src/libpas/pas_committed_pages_vector.h 2025-10-07 22:23:29.232045934 +0700 -@@ -56,6 +56,8 @@ - PAS_ASSERT(page_index < vector->size); - #if PAS_OS(LINUX) - return vector->raw_data[page_index]; -+#elif PAS_OS(REDOX) -+ return true; // redox don't have swap yet - #else - return vector->raw_data[page_index] & (MINCORE_REFERENCED | - MINCORE_REFERENCED_OTHER | -diff -ruwN source/Source/bmalloc/libpas/src/libpas/pas_monotonic_time.c source-new/Source/bmalloc/libpas/src/libpas/pas_monotonic_time.c ---- source/Source/bmalloc/libpas/src/libpas/pas_monotonic_time.c 2023-09-18 14:56:46.743076800 +0700 -+++ source-new/Source/bmalloc/libpas/src/libpas/pas_monotonic_time.c 2025-10-07 22:23:50.202403881 +0700 -@@ -89,6 +89,15 @@ - return ts.tv_sec * 1000u * 1000u * 1000u + ts.tv_nsec; - } - -+ -+#elif PAS_OS(REDOX) -+ -+uint64_t pas_get_current_monotonic_time_nanoseconds(void) -+{ -+ struct timespec ts; -+ clock_gettime(CLOCK_MONOTONIC, &ts); -+ return (uint64_t)ts.tv_sec * 1000000000 + (uint64_t)ts.tv_nsec; -+} - #endif - - #endif /* LIBPAS_ENABLED */ -diff -ruwN source/Source/bmalloc/libpas/src/libpas/pas_page_malloc.c source-new/Source/bmalloc/libpas/src/libpas/pas_page_malloc.c ---- source/Source/bmalloc/libpas/src/libpas/pas_page_malloc.c 2024-12-20 17:10:23.123508500 +0700 -+++ source-new/Source/bmalloc/libpas/src/libpas/pas_page_malloc.c 2025-10-07 22:26:27.358086406 +0700 -@@ -228,6 +228,8 @@ - PAS_SYSCALL(madvise(ptr, size, MADV_DODUMP)); - #elif PAS_PLATFORM(PLAYSTATION) - // We don't need to call madvise to map page. -+#elif PAS_OS(REDOX) -+ // madvise not implemented - #elif PAS_OS(FREEBSD) - PAS_SYSCALL(madvise(ptr, size, MADV_NORMAL)); - #endif -@@ -276,6 +278,8 @@ - #elif PAS_OS(LINUX) - PAS_SYSCALL(madvise(ptr, size, MADV_DONTNEED)); - PAS_SYSCALL(madvise(ptr, size, MADV_DONTDUMP)); -+#elif PAS_OS(REDOX) -+ // madvise not implemented - #else - PAS_SYSCALL(madvise(ptr, size, MADV_DONTNEED)); - #endif -diff -ruwN source/Source/bmalloc/libpas/src/libpas/pas_platform.h source-new/Source/bmalloc/libpas/src/libpas/pas_platform.h ---- source/Source/bmalloc/libpas/src/libpas/pas_platform.h 2024-11-07 21:16:41.458338300 +0700 -+++ source-new/Source/bmalloc/libpas/src/libpas/pas_platform.h 2025-10-07 22:22:50.849390772 +0700 -@@ -132,6 +132,10 @@ - #define PAS_OS_LINUX 1 - #endif - -+#ifdef __redox__ -+#define PAS_OS_REDOX 1 -+#endif -+ - #if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) - #define PAS_OS_FREEBSD 1 - #endif -diff -ruwN source/Source/bmalloc/libpas/src/libpas/pas_probabilistic_guard_malloc_allocator.c source-new/Source/bmalloc/libpas/src/libpas/pas_probabilistic_guard_malloc_allocator.c ---- source/Source/bmalloc/libpas/src/libpas/pas_probabilistic_guard_malloc_allocator.c 2025-03-27 13:32:32.679094000 +0700 -+++ source-new/Source/bmalloc/libpas/src/libpas/pas_probabilistic_guard_malloc_allocator.c 2025-10-07 22:27:40.764339395 +0700 -@@ -165,16 +165,6 @@ - mprotect_res = mprotect((void*)upper_guard, upper_guard_size, PROT_NONE); - PAS_ASSERT(!mprotect_res); - -- /* -- * ensure physical addresses are released -- * TODO: investigate using MADV_FREE_REUSABLE instead -- */ -- int madvise_res = madvise((void*)upper_guard, upper_guard_size, MADV_FREE); -- PAS_ASSERT(!madvise_res); -- -- madvise_res = madvise((void*)lower_guard, lower_guard_size, MADV_FREE); -- PAS_ASSERT(!madvise_res); -- - PAS_PROFILE(PGM_ALLOCATE, heap_config, key); - - /* create struct to hold hash map value */ -@@ -231,13 +221,6 @@ - int mprotect_res = mprotect((void*)value->start_of_data_pages, value->size_of_data_pages, PROT_NONE); - PAS_ASSERT(!mprotect_res); - -- /* -- * ensure physical addresses are released -- * TODO: investigate using MADV_FREE_REUSABLE instead -- */ -- int madvise_res = madvise((void*)value->start_of_data_pages, value->size_of_data_pages, MADV_FREE); -- PAS_ASSERT(!madvise_res); -- - free_wasted_mem += value->mem_to_waste; - free_virtual_mem += value->size_of_allocated_pages; - -diff -ruwN source/Source/JavaScriptCore/heap/BlockDirectory.cpp source-new/Source/JavaScriptCore/heap/BlockDirectory.cpp ---- source/Source/JavaScriptCore/heap/BlockDirectory.cpp 2025-03-21 00:07:59.015023500 +0700 -+++ source-new/Source/JavaScriptCore/heap/BlockDirectory.cpp 2025-09-09 09:08:03.419985553 +0700 -@@ -68,7 +68,7 @@ - // FIXME: We should figure out a solution for Windows and PlayStation. - // QNX doesn't have mincore(), though the information can be had. But since all mapped - // pages are resident, does it matter? --#if OS(UNIX) && !PLATFORM(PLAYSTATION) && !OS(QNX) && !OS(HAIKU) -+#if OS(UNIX) && !PLATFORM(PLAYSTATION) && !OS(QNX) && !OS(HAIKU) && !defined(__redox__) - size_t pageSize = WTF::pageSize(); - ASSERT(!(MarkedBlock::blockSize % pageSize)); - auto numberOfPagesInMarkedBlock = MarkedBlock::blockSize / pageSize; -diff -ruwN source/Source/JavaScriptCore/jsc.cpp source-new/Source/JavaScriptCore/jsc.cpp ---- source/Source/JavaScriptCore/jsc.cpp 2025-03-21 18:07:10.820055200 +0700 -+++ source-new/Source/JavaScriptCore/jsc.cpp 2025-09-09 09:08:03.446985840 +0700 -@@ -208,6 +208,8 @@ - for (;;) { - #if OS(WINDOWS) - Sleep(1000); -+#elif defined(__redox__) -+ //TODO - #else - pause(); - #endif -diff -ruwN source/Source/JavaScriptCore/runtime/JSCBytecodeCacheVersion.cpp source-new/Source/JavaScriptCore/runtime/JSCBytecodeCacheVersion.cpp ---- source/Source/JavaScriptCore/runtime/JSCBytecodeCacheVersion.cpp 2025-03-21 00:07:59.015023500 +0700 -+++ source-new/Source/JavaScriptCore/runtime/JSCBytecodeCacheVersion.cpp 2025-09-09 09:08:03.446985840 +0700 -@@ -37,7 +37,7 @@ - #include - #include - #include --#else -+#elif !defined(__redox__) - #include - #endif - #endif -@@ -66,7 +66,7 @@ - } - cacheVersion.construct(0); - dataLogLnIf(JSCBytecodeCacheVersionInternal::verbose, "Failed to get UUID for JavaScriptCore framework"); --#elif OS(UNIX) && !PLATFORM(PLAYSTATION) && !OS(HAIKU) -+#elif OS(UNIX) && !PLATFORM(PLAYSTATION) && !OS(HAIKU) && !defined(__redox__) - auto result = ([&] -> std::optional { - Dl_info info { }; - if (!dladdr(jsFunctionAddr, &info)) -diff -ruwN source/Source/JavaScriptCore/runtime/MachineContext.h source-new/Source/JavaScriptCore/runtime/MachineContext.h ---- source/Source/JavaScriptCore/runtime/MachineContext.h 2025-03-21 00:07:59.015023500 +0700 -+++ source-new/Source/JavaScriptCore/runtime/MachineContext.h 2025-09-09 09:08:03.473986127 +0700 -@@ -158,7 +158,7 @@ - { - #if OS(DARWIN) - return stackPointerImpl(machineContext->__ss); --#elif OS(HAIKU) -+#elif OS(HAIKU) || defined(__redox__) - #if CPU(X86_64) - return reinterpret_cast(machineContext.rsp); - #else -@@ -287,7 +287,7 @@ - { - #if OS(DARWIN) - return framePointerImpl(machineContext->__ss); --#elif OS(HAIKU) -+#elif OS(HAIKU) || defined(__redox__) - #if CPU(X86_64) - return reinterpret_cast(machineContext.rbp); - #else -@@ -455,7 +455,7 @@ - { - #if OS(DARWIN) - return instructionPointerImpl(machineContext->__ss); --#elif OS(HAIKU) -+#elif OS(HAIKU) || defined(__redox__) - #if CPU(X86_64) - return reinterpret_cast((uintptr_t&) machineContext.rip); - #else -@@ -649,7 +649,7 @@ - { - #if OS(DARWIN) - return argumentPointer<1>(machineContext->__ss); --#elif OS(HAIKU) -+#elif OS(HAIKU) || defined(__redox__) - #if CPU(X86_64) - return reinterpret_cast((uintptr_t&) machineContext.rsi); - #else -@@ -760,6 +760,13 @@ - #error Unknown Architecture - #endif - -+#elif defined(__redox__) -+#if CPU(X86_64) -+ return reinterpret_cast((uintptr_t) machineContext.rbx); -+#else -+#error Unknown Architecture -+#endif -+ - #else - #error Need a way to get the frame pointer for another thread on this platform - #endif -@@ -834,7 +841,7 @@ - // LLInt uses regT4 as PC. - #if OS(DARWIN) - return llintInstructionPointer(machineContext->__ss); --#elif OS(HAIKU) -+#elif OS(HAIKU) || defined(__redox__) - #if CPU(X86_64) - return reinterpret_cast((uintptr_t&) machineContext.r8); - #else -diff -ruwN source/Source/ThirdParty/ANGLE/GLESv2.cmake source-new/Source/ThirdParty/ANGLE/GLESv2.cmake ---- source/Source/ThirdParty/ANGLE/GLESv2.cmake 2025-02-17 19:59:58.567796700 +0700 -+++ source-new/Source/ThirdParty/ANGLE/GLESv2.cmake 2025-09-09 09:08:03.495986361 +0700 -@@ -120,7 +120,7 @@ - - if(is_linux OR is_chromeos OR is_android OR is_fuchsia) - list(APPEND libangle_common_sources -- "src/common/system_utils_linux.cpp" -+ #"src/common/system_utils_linux.cpp" - "src/common/system_utils_posix.cpp" - ) - endif() -diff -ruwN source/Source/ThirdParty/ANGLE/PlatformGTK.cmake source-new/Source/ThirdParty/ANGLE/PlatformGTK.cmake ---- source/Source/ThirdParty/ANGLE/PlatformGTK.cmake 2023-10-21 14:33:32.730009300 +0700 -+++ source-new/Source/ThirdParty/ANGLE/PlatformGTK.cmake 2025-09-09 09:08:03.500986415 +0700 -@@ -1,4 +1,4 @@ --list(APPEND ANGLE_DEFINITIONS ANGLE_PLATFORM_LINUX EGL_NO_PLATFORM_SPECIFIC_TYPES USE_SYSTEM_EGL) -+list(APPEND ANGLE_DEFINITIONS ANGLE_PLATFORM_POSIX EGL_NO_PLATFORM_SPECIFIC_TYPES USE_SYSTEM_EGL) - include(linux.cmake) - - if (USE_OPENGL) -diff -ruwN source/Source/ThirdParty/ANGLE/src/common/log_utils.h source-new/Source/ThirdParty/ANGLE/src/common/log_utils.h ---- source/Source/ThirdParty/ANGLE/src/common/log_utils.h 2025-02-17 19:59:58.571796700 +0700 -+++ source-new/Source/ThirdParty/ANGLE/src/common/log_utils.h 2025-09-09 09:08:03.501986425 +0700 -@@ -136,10 +136,12 @@ - return FmtHexAutoSized(os, fmt.mValue, fmt.mPrefix, "0x", '0'); - } - -+#if !defined(__redox__) - friend std::wostream &operator<<(std::wostream &wos, const FmtHexHelper &fmt) - { - return FmtHexAutoSized(wos, fmt.mValue, fmt.mPrefix, L"0x", L'0'); - } -+#endif - }; - - } // namespace priv -diff -ruwN source/Source/ThirdParty/ANGLE/src/common/platform.h source-new/Source/ThirdParty/ANGLE/src/common/platform.h ---- source/Source/ThirdParty/ANGLE/src/common/platform.h 2024-09-03 13:28:47.067031900 +0700 -+++ source-new/Source/ThirdParty/ANGLE/src/common/platform.h 2025-09-09 09:08:03.518986606 +0700 -@@ -28,7 +28,7 @@ - # define ANGLE_PLATFORM_POSIX 1 - #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || \ - defined(__DragonFly__) || defined(__sun) || defined(__GLIBC__) || defined(__GNU__) || \ -- defined(__QNX__) || defined(__Fuchsia__) || defined(__HAIKU__) -+ defined(__QNX__) || defined(__Fuchsia__) || defined(__HAIKU__) || defined(__redox__) - # define ANGLE_PLATFORM_POSIX 1 - #else - # error Unsupported platform. -diff -ruwN source/Source/ThirdParty/ANGLE/src/common/system_utils.h source-new/Source/ThirdParty/ANGLE/src/common/system_utils.h ---- source/Source/ThirdParty/ANGLE/src/common/system_utils.h 2024-05-30 18:59:22.953676200 +0700 -+++ source-new/Source/ThirdParty/ANGLE/src/common/system_utils.h 2025-09-09 09:08:03.536986798 +0700 -@@ -256,7 +256,9 @@ - } - #endif - --void SetCurrentThreadName(const char *name); -+#if !defined(__redox__) -+void SetCurrentThreadName(const char *name) -+#endif - } // namespace angle - - #endif // COMMON_SYSTEM_UTILS_H_ -diff -ruwN source/Source/ThirdParty/ANGLE/src/common/system_utils_posix.cpp source-new/Source/ThirdParty/ANGLE/src/common/system_utils_posix.cpp ---- source/Source/ThirdParty/ANGLE/src/common/system_utils_posix.cpp 2024-05-30 18:59:22.953676200 +0700 -+++ source-new/Source/ThirdParty/ANGLE/src/common/system_utils_posix.cpp 2025-09-09 09:08:03.539986830 +0700 -@@ -33,6 +33,11 @@ - # include - #endif - -+#if defined(__redox__) -+#define SEGV_MAPERR 1 -+#define SEGV_ACCERR 2 -+#endif -+ - namespace angle - { - -diff -ruwN source/Source/ThirdParty/ANGLE/src/common/WorkerThread.cpp source-new/Source/ThirdParty/ANGLE/src/common/WorkerThread.cpp ---- source/Source/ThirdParty/ANGLE/src/common/WorkerThread.cpp 2024-06-25 15:04:37.142420000 +0700 -+++ source-new/Source/ThirdParty/ANGLE/src/common/WorkerThread.cpp 2025-09-09 09:08:03.557987021 +0700 -@@ -165,7 +165,9 @@ - - void AsyncWorkerPool::threadLoop() - { -+#if !defined(__redox__) - angle::SetCurrentThreadName("ANGLE-Worker"); -+#endif - - while (true) - { -diff -ruwN source/Source/ThirdParty/ANGLE/src/libANGLE/Display.cpp source-new/Source/ThirdParty/ANGLE/src/libANGLE/Display.cpp ---- source/Source/ThirdParty/ANGLE/src/libANGLE/Display.cpp 2025-02-05 16:14:42.678567400 +0700 -+++ source-new/Source/ThirdParty/ANGLE/src/libANGLE/Display.cpp 2025-09-09 09:08:03.577987234 +0700 -@@ -58,7 +58,7 @@ - # include "libANGLE/renderer/gl/wgl/DisplayWGL.h" - # elif ANGLE_ENABLE_CGL - # include "libANGLE/renderer/gl/cgl/DisplayCGL.h" --# elif defined(ANGLE_PLATFORM_LINUX) -+# elif defined(ANGLE_PLATFORM_LINUX) || defined(__redox__) - # include "libANGLE/renderer/gl/egl/DisplayEGL.h" - # if defined(ANGLE_USE_X11) - # include "libANGLE/renderer/gl/glx/DisplayGLX_api.h" -@@ -422,7 +422,7 @@ - impl = new rx::DisplayCGL(state); - break; - --# elif defined(ANGLE_PLATFORM_LINUX) -+# elif defined(ANGLE_PLATFORM_LINUX) || defined(__redox__) - # if defined(ANGLE_USE_GBM) - if (platformType == 0) - { -diff -ruwN source/Source/ThirdParty/ANGLE/src/libANGLE/renderer/vulkan/CLCommandQueueVk.cpp source-new/Source/ThirdParty/ANGLE/src/libANGLE/renderer/vulkan/CLCommandQueueVk.cpp ---- source/Source/ThirdParty/ANGLE/src/libANGLE/renderer/vulkan/CLCommandQueueVk.cpp 2025-02-17 19:59:58.575796600 +0700 -+++ source-new/Source/ThirdParty/ANGLE/src/libANGLE/renderer/vulkan/CLCommandQueueVk.cpp 2025-09-09 09:08:03.578987245 +0700 -@@ -142,7 +142,9 @@ - - angle::Result DispatchWorkThread::finishLoop() - { -+#if !defined(__redox__) - angle::SetCurrentThreadName("ANGLE-CL-CQD"); -+#endif - - while (true) - { -diff -ruwN source/Source/ThirdParty/ANGLE/src/libANGLE/renderer/vulkan/CommandQueue.cpp source-new/Source/ThirdParty/ANGLE/src/libANGLE/renderer/vulkan/CommandQueue.cpp ---- source/Source/ThirdParty/ANGLE/src/libANGLE/renderer/vulkan/CommandQueue.cpp 2025-02-05 16:14:42.690567300 +0700 -+++ source-new/Source/ThirdParty/ANGLE/src/libANGLE/renderer/vulkan/CommandQueue.cpp 2025-09-09 09:08:03.578987245 +0700 -@@ -378,7 +378,9 @@ - - void CleanUpThread::processTasks() - { -+#if !defined(__redox__) - angle::SetCurrentThreadName("ANGLE-GC"); -+#endif - - while (true) - { -diff -ruwN source/Source/ThirdParty/ANGLE/src/libGLESv2.gni source-new/Source/ThirdParty/ANGLE/src/libGLESv2.gni ---- source/Source/ThirdParty/ANGLE/src/libGLESv2.gni 2025-02-17 19:59:58.587796200 +0700 -+++ source-new/Source/ThirdParty/ANGLE/src/libGLESv2.gni 2025-09-09 09:08:03.578987245 +0700 -@@ -115,7 +115,7 @@ - - if (is_linux || is_chromeos || is_android || is_fuchsia) { - libangle_common_sources += [ -- "src/common/system_utils_linux.cpp", -+ #"src/common/system_utils_linux.cpp", - "src/common/system_utils_posix.cpp", - ] - } -diff -ruwN source/Source/ThirdParty/skia/src/gpu/ganesh/GrAutoLocaleSetter.h source-new/Source/ThirdParty/skia/src/gpu/ganesh/GrAutoLocaleSetter.h ---- source/Source/ThirdParty/skia/src/gpu/ganesh/GrAutoLocaleSetter.h 2024-08-14 15:56:17.506453500 +0700 -+++ source-new/Source/ThirdParty/skia/src/gpu/ganesh/GrAutoLocaleSetter.h 2025-09-09 09:08:03.579987255 +0700 -@@ -27,7 +27,7 @@ - #define HAVE_XLOCALE 0 - #endif - --#if defined(SK_BUILD_FOR_ANDROID) || defined(__UCLIBC__) || defined(_NEWLIB_VERSION) -+#if defined(SK_BUILD_FOR_ANDROID) || defined(__UCLIBC__) || defined(_NEWLIB_VERSION) || defined(__redox__) - #define HAVE_LOCALE_T 0 - #else - #define HAVE_LOCALE_T 1 -diff -ruwN source/Source/ThirdParty/skia/src/ports/SkMemory_malloc.cpp source-new/Source/ThirdParty/skia/src/ports/SkMemory_malloc.cpp ---- source/Source/ThirdParty/skia/src/ports/SkMemory_malloc.cpp 2024-05-30 18:59:23.965655000 +0700 -+++ source-new/Source/ThirdParty/skia/src/ports/SkMemory_malloc.cpp 2025-09-09 09:08:03.579987255 +0700 -@@ -126,7 +126,7 @@ - #elif defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 17 - completeSize = malloc_usable_size(addr); - SkASSERT(completeSize >= size); -- #elif defined(SK_BUILD_FOR_UNIX) -+ #elif defined(SK_BUILD_FOR_UNIX) && !defined(__redox__) - completeSize = malloc_usable_size(addr); - SkASSERT(completeSize >= size); - #elif defined(SK_BUILD_FOR_WIN) -diff -ruwN source/Source/WebCore/page/Page.cpp source-new/Source/WebCore/page/Page.cpp ---- source/Source/WebCore/page/Page.cpp 2025-04-01 14:53:09.527295000 +0700 -+++ source-new/Source/WebCore/page/Page.cpp 2025-09-09 09:08:03.580987266 +0700 -@@ -536,8 +536,10 @@ - if (RefPtr scrollingCoordinator = m_scrollingCoordinator) - scrollingCoordinator->pageDestroyed(); - -+#if ENABLE(RESOURCE_USAGE) - if (RefPtr resourceUsageOverlay = m_resourceUsageOverlay) - resourceUsageOverlay->detachFromPage(); -+#endif - - checkedBackForward()->close(); - if (!isUtilityPage()) -@@ -2981,9 +2983,11 @@ - return; - - m_shouldSuppressHDR = shouldSuppressHDR; -+ #if ENABLE(VIDEO) - forEachDocument([](auto& document) { - document.shouldSuppressHDRDidChange(); - }); -+ #endif - } - - #if ENABLE(MEDIA_STREAM) -diff -ruwN source/Source/WebCore/PlatformGTK.cmake source-new/Source/WebCore/PlatformGTK.cmake ---- source/Source/WebCore/PlatformGTK.cmake 2024-12-16 16:07:48.162613200 +0700 -+++ source-new/Source/WebCore/PlatformGTK.cmake 2025-09-09 09:08:03.580987266 +0700 -@@ -75,21 +75,18 @@ - ) - - list(APPEND WebCore_LIBRARIES -- ${ENCHANT_LIBRARIES} - ${GLIB_GIO_LIBRARIES} - ${GLIB_GMODULE_LIBRARIES} - ${GLIB_GOBJECT_LIBRARIES} - ${GLIB_LIBRARIES} - ${LIBSECRET_LIBRARIES} - ${LIBTASN1_LIBRARIES} -- ${HYPHEN_LIBRARIES} - ${UPOWERGLIB_LIBRARIES} - ${X11_X11_LIB} - GTK::GTK - ) - - list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES -- ${ENCHANT_INCLUDE_DIRS} - ${GIO_UNIX_INCLUDE_DIRS} - ${GLIB_INCLUDE_DIRS} - ${LIBSECRET_INCLUDE_DIRS} -diff -ruwN source/Source/WebKit/Platform/IPC/unix/ConnectionUnix.cpp source-new/Source/WebKit/Platform/IPC/unix/ConnectionUnix.cpp ---- source/Source/WebKit/Platform/IPC/unix/ConnectionUnix.cpp 2025-03-31 16:35:43.461813700 +0700 -+++ source-new/Source/WebKit/Platform/IPC/unix/ConnectionUnix.cpp 2025-09-09 09:08:03.591987383 +0700 -@@ -48,13 +48,13 @@ - #include - #endif - --#if OS(DARWIN) -+#if OS(DARWIN) || defined(__redox__) - #define MSG_NOSIGNAL 0 - #endif - - // Although it's available on Darwin, SOCK_SEQPACKET seems to work differently - // than in traditional Unix so fallback to STREAM on that platform. --#if defined(SOCK_SEQPACKET) && !OS(DARWIN) -+#if defined(SOCK_SEQPACKET) && !OS(DARWIN) && !defined(__redox__) - #define SOCKET_TYPE SOCK_SEQPACKET - #else - #if USE(GLIB) -diff -ruwN source/Source/WebKit/PlatformGTK.cmake source-new/Source/WebKit/PlatformGTK.cmake ---- source/Source/WebKit/PlatformGTK.cmake 2025-03-05 17:09:47.273706000 +0700 -+++ source-new/Source/WebKit/PlatformGTK.cmake 2025-09-09 09:08:03.644987947 +0700 -@@ -313,7 +313,6 @@ - ) - - list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES -- ${ENCHANT_INCLUDE_DIRS} - ${GIO_UNIX_INCLUDE_DIRS} - ${GLIB_INCLUDE_DIRS} - ${GSTREAMER_INCLUDE_DIRS} -diff -ruwN source/Source/WTF/wtf/glib/FileSystemGlib.cpp source-new/Source/WTF/wtf/glib/FileSystemGlib.cpp ---- source/Source/WTF/wtf/glib/FileSystemGlib.cpp 2024-12-16 16:07:48.134613800 +0700 -+++ source-new/Source/WTF/wtf/glib/FileSystemGlib.cpp 2025-09-09 09:08:03.644987947 +0700 -@@ -70,7 +70,7 @@ - return CString({ readLinkBuffer, static_cast(result) }); - WTF_ALLOW_UNSAFE_BUFFER_USAGE_END - } --#elif OS(HURD) -+#elif OS(HURD) || defined(__redox__) - CString currentExecutablePath() - { - return { }; -diff -ruwN source/Source/WTF/wtf/InlineASM.h source-new/Source/WTF/wtf/InlineASM.h ---- source/Source/WTF/wtf/InlineASM.h 2024-09-23 17:54:44.750106000 +0700 -+++ source-new/Source/WTF/wtf/InlineASM.h 2025-09-09 09:08:03.667988192 +0700 -@@ -89,7 +89,8 @@ - || OS(HURD) \ - || OS(NETBSD) \ - || OS(QNX) \ -- || OS(WINDOWS) -+ || OS(WINDOWS) \ -+ || defined(__redox__) - // GNU as-compatible syntax. - #define LOCAL_LABEL_STRING(name) ".L" #name - #endif -diff -ruwN source/Source/WTF/wtf/PlatformEnable.h source-new/Source/WTF/wtf/PlatformEnable.h ---- source/Source/WTF/wtf/PlatformEnable.h 2025-03-18 15:33:00.063181400 +0700 -+++ source-new/Source/WTF/wtf/PlatformEnable.h 2026-03-16 10:49:25.498709796 +0700 -@@ -698,7 +698,7 @@ - #if !defined(ENABLE_DFG_JIT) && ENABLE(JIT) - - /* Enable the DFG JIT on X86 and X86_64. */ --#if CPU(X86_64) && (OS(DARWIN) || OS(LINUX) || OS(FREEBSD) || OS(HAIKU) || OS(HURD) || OS(WINDOWS)) -+#if CPU(X86_64) && (OS(DARWIN) || OS(LINUX) || OS(FREEBSD) || OS(HAIKU) || OS(HURD) || OS(WINDOWS) || defined(__redox__)) - #define ENABLE_DFG_JIT 1 - #endif - -diff -ruwN source/Source/WTF/wtf/PlatformHave.h source-new/Source/WTF/wtf/PlatformHave.h ---- source/Source/WTF/wtf/PlatformHave.h 2025-04-02 19:09:45.800669000 +0700 -+++ source-new/Source/WTF/wtf/PlatformHave.h 2025-09-09 09:08:03.707988617 +0700 -@@ -231,7 +231,7 @@ - #define HAVE_MACH_MEMORY_ENTRY 1 - #endif - --#if OS(DARWIN) || OS(FUCHSIA) || ((OS(FREEBSD) || OS(HAIKU) || OS(NETBSD) || OS(OPENBSD) || OS(LINUX) || OS(HURD) || OS(QNX)) && (CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(RISCV64))) -+#if OS(DARWIN) || OS(FUCHSIA) || ((OS(FREEBSD) || OS(HAIKU) || OS(NETBSD) || OS(OPENBSD) || OS(LINUX) || OS(HURD) || OS(QNX) || defined(__redox__)) && (CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(RISCV64))) - #define HAVE_MACHINE_CONTEXT 1 - #endif - -diff -ruwN source/Source/WTF/wtf/PlatformOS.h source-new/Source/WTF/wtf/PlatformOS.h ---- source/Source/WTF/wtf/PlatformOS.h 2025-04-03 12:49:09.282701700 +0700 -+++ source-new/Source/WTF/wtf/PlatformOS.h 2025-09-09 09:08:03.709988639 +0700 -@@ -143,7 +143,8 @@ - || OS(OPENBSD) \ - || defined(unix) \ - || defined(__unix) \ -- || defined(__unix__) -+ || defined(__unix__) \ -+ || defined(__redox__) - #define WTF_OS_UNIX 1 - #endif - -diff -ruwN source/Source/WTF/wtf/PlatformRegisters.h source-new/Source/WTF/wtf/PlatformRegisters.h ---- source/Source/WTF/wtf/PlatformRegisters.h 2024-11-20 20:56:01.847236400 +0700 -+++ source-new/Source/WTF/wtf/PlatformRegisters.h 2025-09-09 09:08:03.723988787 +0700 -@@ -39,6 +39,8 @@ - typedef ucontext_t mcontext_t; - #elif OS(QNX) - #include -+#elif defined(__redox__) -+#include - #else - #include - #endif -diff -ruwN source/Source/WTF/wtf/posix/CPUTimePOSIX.cpp source-new/Source/WTF/wtf/posix/CPUTimePOSIX.cpp ---- source/Source/WTF/wtf/posix/CPUTimePOSIX.cpp 2023-09-18 14:56:45.363115500 +0700 -+++ source-new/Source/WTF/wtf/posix/CPUTimePOSIX.cpp 2025-09-09 09:08:03.727988830 +0700 -@@ -47,10 +47,14 @@ - - Seconds CPUTime::forCurrentThread() - { -+#if defined(__redox__) -+ return Seconds(0); -+#else - struct timespec ts { }; - int ret = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts); - RELEASE_ASSERT(!ret); - return Seconds(ts.tv_sec) + Seconds::fromNanoseconds(ts.tv_nsec); -+#endif - } - - } -diff -ruwN source/Source/WTF/wtf/posix/FileHandlePOSIX.cpp source-new/Source/WTF/wtf/posix/FileHandlePOSIX.cpp ---- source/Source/WTF/wtf/posix/FileHandlePOSIX.cpp 2025-03-21 18:07:10.828055100 +0700 -+++ source-new/Source/WTF/wtf/posix/FileHandlePOSIX.cpp 2025-09-09 09:08:03.757989149 +0700 -@@ -39,6 +39,10 @@ - #include - #include - -+#if defined(__redox__) -+#define MAP_FILE 0 -+#endif -+ - namespace WTF::FileSystemImpl { - - std::optional FileHandle::read(std::span data) -diff -ruwN source/Source/WTF/wtf/posix/ThreadingPOSIX.cpp source-new/Source/WTF/wtf/posix/ThreadingPOSIX.cpp ---- source/Source/WTF/wtf/posix/ThreadingPOSIX.cpp 2025-03-05 17:09:47.149706400 +0700 -+++ source-new/Source/WTF/wtf/posix/ThreadingPOSIX.cpp 2025-09-09 09:08:03.762989203 +0700 -@@ -356,7 +356,7 @@ - - void Thread::changePriority(int delta) - { --#if HAVE(PTHREAD_SETSCHEDPARAM) -+#if HAVE(PTHREAD_SETSCHEDPARAM) && !defined(__redox__) - Locker locker { m_mutex }; - - int policy; diff --git a/recipes/wip/web/zola/redox.patch b/recipes/wip/web/zola/redox.patch deleted file mode 100644 index ad4980a185..0000000000 --- a/recipes/wip/web/zola/redox.patch +++ /dev/null @@ -1,91 +0,0 @@ -diff --git a/Cargo.lock b/Cargo.lock -index 25c8de7..23e44f4 100644 ---- a/Cargo.lock -+++ b/Cargo.lock -@@ -411,15 +411,6 @@ dependencies = [ - "generic-array", - ] - --[[package]] --name = "block2" --version = "0.6.2" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" --dependencies = [ -- "objc2", --] -- - [[package]] - name = "bstr" - version = "1.12.1" -@@ -986,13 +977,12 @@ dependencies = [ - - [[package]] - name = "ctrlc" --version = "3.5.1" -+version = "3.4.7" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "73736a89c4aff73035ba2ed2e565061954da00d4970fc9ac25dcc85a2a20d790" -+checksum = "46f93780a459b7d656ef7f071fe699c4d3d2cb201c4b24d085b6ddc505276e73" - dependencies = [ -- "dispatch2", - "nix", -- "windows-sys 0.61.2", -+ "windows-sys 0.59.0", - ] - - [[package]] -@@ -1048,18 +1038,6 @@ dependencies = [ - "crypto-common", - ] - --[[package]] --name = "dispatch2" --version = "0.3.0" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "89a09f22a6c6069a18470eb92d2298acf25463f14256d24778e1230d789a2aec" --dependencies = [ -- "bitflags 2.10.0", -- "block2", -- "libc", -- "objc2", --] -- - [[package]] - name = "displaydoc" - version = "0.2.5" -@@ -3046,21 +3024,6 @@ dependencies = [ - "libc", - ] - --[[package]] --name = "objc2" --version = "0.6.3" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "b7c2599ce0ec54857b29ce62166b0ed9b4f6f1a70ccc9a71165b6154caca8c05" --dependencies = [ -- "objc2-encode", --] -- --[[package]] --name = "objc2-encode" --version = "4.1.0" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" -- - [[package]] - name = "once_cell" - version = "1.21.3" -diff --git a/Cargo.toml b/Cargo.toml -index a08be28..a9df3da 100644 ---- a/Cargo.toml -+++ b/Cargo.toml -@@ -29,7 +29,7 @@ clap_complete = "4" - axum = { version = "0.8", default-features = false, features = ["http1", "tokio", "ws"] } - tokio = { version = "1.0.1", default-features = false, features = ["rt", "fs", "time", "net", "sync"] } - notify-debouncer-full = "0.6" --ctrlc = "3" -+ctrlc = "=3.4.7" - open = "5" - # For mimetype detection in serve mode - mime_guess = "2.0" diff --git a/recipes/wip/x11/drm-info/redox.patch b/recipes/wip/x11/drm-info/redox.patch deleted file mode 100644 index 06d9164800..0000000000 --- a/recipes/wip/x11/drm-info/redox.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ruwN source-old/meson.build source/meson.build ---- source-old/meson.build 2025-11-16 10:35:59.000000000 -0700 -+++ source/meson.build 2025-12-11 15:29:28.845861423 -0700 -@@ -68,7 +68,7 @@ - elif libdrm.type_name() == 'internal' - fourcc_h = meson.current_source_dir() / 'subprojects/libdrm/include/drm/drm_fourcc.h' - else -- fourcc_h = libdrm.get_variable(pkgconfig: 'pc_sysrootdir') + libdrm.get_variable(pkgconfig: 'includedir') / 'libdrm/drm_fourcc.h' -+ fourcc_h = libdrm.get_variable(pkgconfig: 'includedir') / 'libdrm/drm_fourcc.h' - endif - - # The DRM_BUS_FAUX bus and its information is included in libdrm v2.4.127 diff --git a/recipes/wip/x11/libxfont2/redox.patch b/recipes/wip/x11/libxfont2/redox.patch deleted file mode 100644 index 58a69bebda..0000000000 --- a/recipes/wip/x11/libxfont2/redox.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- libXfont2-2.0.7/Makefile.am 2024-08-01 17:38:40.000000000 -0600 -+++ source/Makefile.am 2025-05-02 10:49:08.392987853 -0600 -@@ -159,14 +159,14 @@ - EXTRA_DIST = src/builtins/buildfont README.md - - # Test utilities --EXTRA_DIST += test/utils/README -- --TEST_UTIL_SRCS = test/utils/font-test-utils.c test/utils/font-test-utils.h -- --noinst_PROGRAMS = lsfontdir -- --lsfontdir_SOURCES = test/utils/lsfontdir.c $(TEST_UTIL_SRCS) --lsfontdir_LDADD = libXfont2.la $(LTLIBOBJS) -+#EXTRA_DIST += test/utils/README -+# -+#TEST_UTIL_SRCS = test/utils/font-test-utils.c test/utils/font-test-utils.h -+# -+#noinst_PROGRAMS = lsfontdir -+# -+#lsfontdir_SOURCES = test/utils/lsfontdir.c $(TEST_UTIL_SRCS) -+#lsfontdir_LDADD = libXfont2.la $(LTLIBOBJS) - - - MAINTAINERCLEANFILES = ChangeLog INSTALL diff --git a/recipes/wip/x11/libxkbcommon-x11/redox.patch b/recipes/wip/x11/libxkbcommon-x11/redox.patch deleted file mode 100644 index 11a80ca9c3..0000000000 --- a/recipes/wip/x11/libxkbcommon-x11/redox.patch +++ /dev/null @@ -1,92 +0,0 @@ -diff --color -ruwN source/meson.build source-new/meson.build ---- source/meson.build 2024-03-24 04:23:43.000000000 +0700 -+++ source-new/meson.build 2025-10-29 10:55:30.355297899 +0700 -@@ -637,8 +637,6 @@ - libxkbcommon_x11_test_internal = static_library( - 'xkbcommon-x11-internal', - libxkbcommon_x11_sources, -- 'test/xvfb-wrapper.c', -- 'test/xvfb-wrapper.h', - include_directories: include_directories('src', 'include'), - link_with: libxkbcommon_test_internal, - dependencies: [ -@@ -768,20 +766,6 @@ - dependencies: test_dep), - env: test_env, - ) --if get_option('enable-x11') -- test( -- 'x11', -- executable('test-x11', 'test/x11.c', dependencies: x11_test_dep), -- env: test_env, -- is_parallel : false, -- ) -- test( -- 'x11comp', -- executable('test-x11comp', 'test/x11comp.c', dependencies: x11_test_dep), -- env: test_env, -- is_parallel : false, -- ) --endif - if get_option('enable-xkbregistry') - test( - 'registry', -diff --color -ruwN source/src/x11/util.c source-new/src/x11/util.c ---- source/src/x11/util.c 2024-03-24 04:23:43.000000000 +0700 -+++ source-new/src/x11/util.c 2025-10-29 15:03:58.879274347 +0700 -@@ -39,7 +39,7 @@ - uint16_t server_major, server_minor; - - if (flags & ~(XKB_X11_SETUP_XKB_EXTENSION_NO_FLAGS)) { -- /* log_err_func(ctx, "unrecognized flags: %#x\n", flags); */ -+ printf("unrecognized flags: %#x\n", flags); - return 0; - } - -@@ -47,12 +47,12 @@ - const xcb_query_extension_reply_t *reply = - xcb_get_extension_data(conn, &xcb_xkb_id); - if (!reply) { -- /* log_err_func(ctx, "failed to query for XKB extension\n"); */ -+ printf("failed to query for XKB extension\n"); - return 0; - } - - if (!reply->present) { -- /* log_err_func(ctx, "failed to start using XKB extension: not available in server\n"); */ -+ printf("failed to start using XKB extension: not available in server\n"); - return 0; - } - -@@ -68,20 +68,21 @@ - xcb_xkb_use_extension_reply(conn, cookie, &error); - - if (!reply) { -- /* log_err_func(ctx, */ -- /* "failed to start using XKB extension: error code %d\n", */ -- /* error ? error->error_code : -1); */ -+ printf( -+ "failed to start using XKB extension: error code %d\n", -+ error ? error->error_code : -1); - free(error); - return 0; - } - -- if (!reply->supported) { -- /* log_err_func(ctx, */ -- /* "failed to start using XKB extension: server doesn't support version %d.%d\n", */ -- /* major_xkb_version, minor_xkb_version); */ -- free(reply); -- return 0; -- } -+ // FIXME: Figure out why winit/servo throwing this -+ // if (!reply->supported) { -+ // printf( -+ // "failed to start using XKB extension: server doesn't support version %d.%d\n", -+ // major_xkb_version, minor_xkb_version); -+ // free(reply); -+ // return 0; -+ // } - - server_major = reply->serverMajor; - server_minor = reply->serverMinor; diff --git a/recipes/wip/x11/mate/marco/redox.patch b/recipes/wip/x11/mate/marco/redox.patch deleted file mode 100644 index 4cb0f9383c..0000000000 --- a/recipes/wip/x11/mate/marco/redox.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ruwN source-old/meson.build source/meson.build ---- source-old/meson.build 2025-09-22 16:03:46.000000000 -0600 -+++ source/meson.build 2025-11-14 19:09:08.402564648 -0700 -@@ -294,7 +294,7 @@ - endif - - gdk_pixbuf_csource = find_program('gdk-pixbuf-csource') --zenity = find_program('zenity') -+#Added to package depends: zenity = find_program('zenity') - - libxext = cc.find_library('Xext', required: false) - if build_xsync diff --git a/recipes/wip/x11/mate/mate-control-center/redox.patch b/recipes/wip/x11/mate/mate-control-center/redox.patch deleted file mode 100644 index 5409009622..0000000000 --- a/recipes/wip/x11/mate/mate-control-center/redox.patch +++ /dev/null @@ -1,76 +0,0 @@ -diff -ruwN source-old/capplets/display/meson.build source/capplets/display/meson.build ---- source-old/capplets/display/meson.build 2024-05-22 13:44:05.000000000 -0600 -+++ source/capplets/display/meson.build 2025-11-15 08:43:15.498757975 -0700 -@@ -49,12 +49,13 @@ - install_dir: mcc_desktopdir - ) - --policy = 'org.mate.randr.policy' -- --i18n.merge_file( -- input: policy + '.in', -- output: policy, -- po_dir: po_dir, -- install: true, -- install_dir: mcc_policydir, --) -+#TODO: fails to merge -+#policy = 'org.mate.randr.policy' -+# -+#i18n.merge_file( -+# input: policy + '.in', -+# output: policy, -+# po_dir: po_dir, -+# install: true, -+# install_dir: mcc_policydir, -+#) -diff -ruwN source-old/capplets/meson.build source/capplets/meson.build ---- source-old/capplets/meson.build 2024-05-22 13:44:05.000000000 -0600 -+++ source/capplets/meson.build 2025-11-15 08:20:38.584035658 -0700 -@@ -8,6 +8,6 @@ - subdir('keyboard') - subdir('mouse') - subdir('network') --subdir('system-info') --subdir('time-admin') -+#subdir('system-info') -+#subdir('time-admin') - subdir('windows') -diff -ruwN source-old/meson.build source/meson.build ---- source-old/meson.build 2024-05-22 13:44:05.000000000 -0600 -+++ source/meson.build 2025-11-15 08:42:11.646734896 -0700 -@@ -75,9 +75,9 @@ - xcursor_dep = dependency('xcursor') - dconf_dep = dependency('dconf', version: '>= 0.13.4') - fontconfig_dep = dependency('fontconfig') --gtop_dep = dependency('libgtop-2.0') --udisks2_dep = dependency('udisks2') --polkit_dep = dependency('polkit-gobject-1') -+#gtop_dep = dependency('libgtop-2.0') -+#udisks2_dep = dependency('udisks2') -+#polkit_dep = dependency('polkit-gobject-1') - matekbd_dep = dependency('libmatekbd', version: '>=1.17.0') - matekbdui_dep = dependency('libmatekbdui', version: '>=1.17.0') - xklavier_dep = dependency('libxklavier', version: '>= 5.2') -@@ -120,10 +120,10 @@ - endif - else - appindicator = false -- ayatana = true -+ ayatana = false - endif - appindicator_dep = dependency('appindicator3-0.1', version: '>= 0.0.13', required: appindicator) --ayatana_dep = dependency('ayatana-appindicator3-0.1', version: '>= 0.0.13', required: ayatana) -+#ayatana_dep = dependency('ayatana-appindicator3-0.1', version: '>= 0.0.13', required: ayatana) - config_h.set('HAVE_UBUNTU_APPINDICATOR', appindicator) - gnome = import('gnome') - i18n = import('i18n') -@@ -155,7 +155,7 @@ - subdir('help') - subdir('font-viewer') - subdir('capplets') --subdir('typing-break') -+#subdir('typing-break') - subdir('shell') - - gnome.post_install( diff --git a/recipes/wip/x11/mesa-demos-x11/redox.patch b/recipes/wip/x11/mesa-demos-x11/redox.patch deleted file mode 100644 index 62b3351227..0000000000 --- a/recipes/wip/x11/mesa-demos-x11/redox.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ruwN mesa-demos-9.0.0/meson.build source/meson.build ---- mesa-demos-9.0.0/meson.build 2023-03-22 06:13:43.000000000 -0600 -+++ source/meson.build 2025-05-06 15:58:57.523274337 -0600 -@@ -99,7 +99,7 @@ - endif - - dep_glx = dependency('glx', required: false, disabler : true) --if not dep_glx.found() and host_machine.system() == 'darwin' -+if not dep_glx.found() - # xquartz doesn't have a glx.pc, but it does have the header. And all the - # symbols reside in libGL, so let's just use that. - if cc.check_header('GL/glx.h', dependencies: dep_x11) diff --git a/recipes/wip/x11/x11proto/redox.patch b/recipes/wip/x11/x11proto/redox.patch deleted file mode 100644 index 55a319304c..0000000000 --- a/recipes/wip/x11/x11proto/redox.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ruwN xorgproto-2023.2/include/X11/Xos_r.h source/include/X11/Xos_r.h ---- xorgproto-2023.2/include/X11/Xos_r.h 2023-06-16 01:32:38.000000000 -0600 -+++ source/include/X11/Xos_r.h 2025-05-02 10:10:07.250524701 -0600 -@@ -318,7 +318,7 @@ - (_Xos_processUnlock), \ - (p).pwp ) - --#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(__APPLE__) -+#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(__APPLE__) && !defined(__redox__) - # define X_NEEDS_PWPARAMS - typedef struct { - struct passwd pws; diff --git a/recipes/wip/x11/xfce4/libxfce4windowing/redox.patch b/recipes/wip/x11/xfce4/libxfce4windowing/redox.patch deleted file mode 100644 index c3520aa9d1..0000000000 --- a/recipes/wip/x11/xfce4/libxfce4windowing/redox.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff -ruwN source-old/libxfce4windowing/xfw-monitor-x11.c source/libxfce4windowing/xfw-monitor-x11.c ---- source-old/libxfce4windowing/xfw-monitor-x11.c 2025-08-14 01:01:54.000000000 -0600 -+++ source/libxfce4windowing/xfw-monitor-x11.c 2025-10-30 15:06:17.333924750 -0600 -@@ -28,7 +28,9 @@ - #include - #include - #include -+#if !defined(__redox__) - #include -+#endif - #include - - #include "xfw-monitor-private.h" -@@ -429,6 +431,7 @@ - &edid_data); - - if (gdk_x11_display_error_trap_pop(display) == 0 && edid_data != NULL && nbytes > 0) { -+#if !defined(__redox__) - struct di_info *edid_info = di_info_parse_edid(edid_data, nbytes); - if (edid_info != NULL) { - char *make = di_info_get_make(edid_info); -@@ -451,6 +454,7 @@ - - di_info_destroy(edid_info); - } -+#endif - } - if (edid_data != NULL) { - XFree(edid_data); -diff -ruwN source-old/meson.build source/meson.build ---- source-old/meson.build 2025-08-14 01:05:11.000000000 -0600 -+++ source/meson.build 2025-10-30 15:05:30.092853306 -0600 -@@ -44,7 +44,7 @@ - - # Feature: 'x11' - x11_deps = [] --x11_deps += dependency('libdisplay-info', version: dependency_versions['display-info'], required: get_option('x11')) -+#x11_deps += dependency('libdisplay-info', version: dependency_versions['display-info'], required: get_option('x11')) - x11_deps += dependency('x11', version: dependency_versions['libx11'], required: get_option('x11')) - x11_deps += dependency('gdk-x11-3.0', version: dependency_versions['gtk'], required: get_option('x11')) - x11_deps += dependency('libwnck-3.0', version: dependency_versions['wnck'], required: get_option('x11')) diff --git a/recipes/wip/x11/xserver-xorg-video-orbital/redox.patch b/recipes/wip/x11/xserver-xorg-video-orbital/redox.patch deleted file mode 100644 index 02fc109e41..0000000000 --- a/recipes/wip/x11/xserver-xorg-video-orbital/redox.patch +++ /dev/null @@ -1,301 +0,0 @@ -diff -ruwN source-old/src/dummy_driver.c source/src/dummy_driver.c ---- source-old/src/dummy_driver.c 2023-05-07 14:27:44.000000000 -0600 -+++ source/src/dummy_driver.c 2025-10-29 11:13:11.863430241 -0600 -@@ -39,6 +39,7 @@ - /* These need to be checked */ - #include - #include -+#include - #include "scrnintstr.h" - #include "servermd.h" - -@@ -51,6 +52,7 @@ - static Bool DUMMYEnterVT(VT_FUNC_ARGS_DECL); - static void DUMMYLeaveVT(VT_FUNC_ARGS_DECL); - static Bool DUMMYCloseScreen(CLOSE_SCREEN_ARGS_DECL); -+static void DUMMYBlockHandler(ScreenPtr pScreen, void *timeout); - static Bool DUMMYCreateWindow(WindowPtr pWin); - static void DUMMYFreeScreen(FREE_SCREEN_ARGS_DECL); - static ModeStatus DUMMYValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, -@@ -768,6 +770,97 @@ - - static ScrnInfoPtr DUMMYScrn; /* static-globalize it */ - -+static void DUMMYOrbitalEvent(int fd, int ready, void *data) { -+ DUMMYPtr dPtr = (DUMMYPtr)data; -+ if (!dPtr->orb_window) { -+ return; -+ } -+ -+ void *event_iter = orb_window_events(dPtr->orb_window); -+ if (!event_iter) { -+ return; -+ } -+ -+ bool running = true; -+ while (running) { -+ OrbEventOption event = orb_events_next(event_iter); -+ if (event.tag == OrbEventOption_None) { -+ break; -+ } -+ //TODO: handle more events -+ switch (event.tag) { -+ case OrbEventOption_Key: -+ if (inputInfo.keyboard) { -+ if (event.key.scancode > 0) { -+ //TODO: more advanced key mapping? -+ xf86PostKeyEvent(inputInfo.keyboard, event.key.scancode + 8, event.key.pressed); -+ } -+ } -+ break; -+ case OrbEventOption_Mouse: -+ if (inputInfo.pointer) { -+ xf86PostMotionEvent(inputInfo.pointer, 1, 0, 2, event.mouse.x, event.mouse.y); -+ } -+ break; -+ case OrbEventOption_MouseRelative: -+ if (inputInfo.pointer) { -+ if (event.mouse_relative.dx || event.mouse_relative.dy) { -+ xf86PostMotionEvent(inputInfo.pointer, 0, 0, 2, event.mouse_relative.dx, event.mouse_relative.dy); -+ } -+ } -+ break; -+ case OrbEventOption_Button: -+ if (inputInfo.pointer) { -+ xf86PostButtonEvent(inputInfo.pointer, 0, 1, event.button.left, 0, 0); -+ xf86PostButtonEvent(inputInfo.pointer, 0, 2, event.button.middle, 0, 0); -+ xf86PostButtonEvent(inputInfo.pointer, 0, 3, event.button.right, 0, 0); -+ } -+ break; -+ case OrbEventOption_None: -+ running = false; -+ break; -+ default: -+ //printf("unknown orbital event %d: %d, %d\n", event.unknown.code, event.unknown.a, event.unknown.b); -+ break; -+ } -+ } -+ -+ orb_events_destroy(event_iter); -+} -+ -+static Bool -+CreateScreenResources(ScreenPtr pScreen) -+{ -+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); -+ DUMMYPtr dPtr = DUMMYPTR(pScrn); -+ PixmapPtr rootPixmap; -+ Bool ret; -+ -+ pScreen->CreateScreenResources = dPtr->CreateScreenResources; -+ ret = pScreen->CreateScreenResources(pScreen); -+ pScreen->CreateScreenResources = CreateScreenResources; -+ -+ if (!ret) { -+ return FALSE; -+ } -+ -+ rootPixmap = pScreen->GetScreenPixmap(pScreen); -+ -+ dPtr->damage = DamageCreate(NULL, NULL, DamageReportNone, TRUE, -+ pScreen, rootPixmap); -+ if (dPtr->damage) { -+ DamageRegister(&rootPixmap->drawable, dPtr->damage); -+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Damage tracking initialized\n"); -+ } -+ else { -+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to create screen damage record\n"); -+ return FALSE; -+ } -+ -+ return TRUE; -+} -+ -+ - /* Mandatory */ - static Bool - DUMMYScreenInit(SCREEN_INIT_ARGS_DECL) -@@ -776,7 +869,6 @@ - DUMMYPtr dPtr; - int ret; - VisualPtr visual; -- void *pixels; - - /* - * we need to get the ScrnInfoRec for this screen, so let's allocate -@@ -786,9 +878,22 @@ - dPtr = DUMMYPTR(pScrn); - DUMMYScrn = pScrn; - -+ if (pScrn->bitsPerPixel != 32) { -+ printf("unsupported BPP %d\n", pScrn->bitsPerPixel); -+ return FALSE; -+ } - -- if (!(pixels = malloc(pScrn->videoRam * 1024))) -+ printf( -+ "orb_window_new %d, %d\n", -+ pScrn->virtualX, pScrn->virtualY -+ ); -+ dPtr->orb_window = orb_window_new_flags(-1, -1, pScrn->virtualX, pScrn->virtualY, "X11", ORB_WINDOW_ASYNC | ORB_WINDOW_BORDERLESS); -+ if (!dPtr->orb_window) { -+ printf("failed to open orbital window\n"); - return FALSE; -+ } -+ -+ SetNotifyFd(orb_window_fd(dPtr->orb_window), DUMMYOrbitalEvent, X_NOTIFY_READ, dPtr); - - /* - * Reset visual list. -@@ -800,12 +905,10 @@ - if (!miSetVisualTypes(pScrn->depth, - miGetDefaultVisualMask(pScrn->depth), - pScrn->rgbBits, pScrn->defaultVisual)) { -- free(pixels); - return FALSE; - } - - if (!miSetPixmapDepths ()) { -- free(pixels); - return FALSE; - } - -@@ -813,7 +916,7 @@ - * Call the framebuffer layer's ScreenInit function, and fill in other - * pScreen fields. - */ -- ret = fbScreenInit(pScreen, pixels, -+ ret = fbScreenInit(pScreen, orb_window_data(dPtr->orb_window), - pScrn->virtualX, pScrn->virtualY, - pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth, pScrn->bitsPerPixel); -@@ -838,6 +941,10 @@ - /* must be after RGB ordering fixed */ - fbPictureInit(pScreen, 0, 0); - -+ /* Wrap the current CreateScreenResources function */ -+ dPtr->CreateScreenResources = pScreen->CreateScreenResources; -+ pScreen->CreateScreenResources = CreateScreenResources; -+ - xf86SetBlackWhitePixels(pScreen); - - /* initialize XRANDR */ -@@ -943,6 +1050,10 @@ - dPtr->CloseScreen = pScreen->CloseScreen; - pScreen->CloseScreen = DUMMYCloseScreen; - -+ /* Wrap the current BlockHandler function */ -+ dPtr->BlockHandler = pScreen->BlockHandler; -+ pScreen->BlockHandler = DUMMYBlockHandler; -+ - /* Wrap the current CreateWindow function */ - dPtr->CreateWindow = pScreen->CreateWindow; - pScreen->CreateWindow = DUMMYCreateWindow; -@@ -975,11 +1086,26 @@ - ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); - DUMMYPtr dPtr = DUMMYPTR(pScrn); - -- free(pScreen->GetScreenPixmap(pScreen)->devPrivate.ptr); -+ if (dPtr->damage) { -+ DamageUnregister(dPtr->damage); -+ DamageDestroy(dPtr->damage); -+ dPtr->damage = NULL; -+ } -+ -+ if (dPtr->orb_window) { -+ RemoveNotifyFd(orb_window_fd(dPtr->orb_window)); -+ -+ printf("orb_window_destroy %p\n", dPtr->orb_window); -+ orb_window_destroy(dPtr->orb_window); -+ dPtr->orb_window = NULL; -+ } - - if (dPtr->CursorInfo) - xf86DestroyCursorInfoRec(dPtr->CursorInfo); - -+ pScreen->CreateScreenResources = dPtr->CreateScreenResources; -+ pScreen->BlockHandler = dPtr->BlockHandler; -+ - pScrn->vtSema = FALSE; - pScreen->CloseScreen = dPtr->CloseScreen; - return (*pScreen->CloseScreen)(CLOSE_SCREEN_ARGS); -@@ -1009,6 +1135,31 @@ - Atom VFB_PROP = 0; - #define VFB_PROP_NAME "VFB_IDENT" - -+static void DUMMYBlockHandler(ScreenPtr pScreen, void *timeout) { -+ DUMMYPtr dPtr = DUMMYPTR(DUMMYScrn); -+ -+ //printf("BlockHandler %p %p\n", pScreen, timeout); -+ pScreen->BlockHandler = dPtr->BlockHandler; -+ pScreen->BlockHandler(pScreen, timeout); -+ dPtr->BlockHandler = pScreen->BlockHandler; -+ pScreen->BlockHandler = DUMMYBlockHandler; -+ -+ if (dPtr->damage) { -+ RegionPtr dirty = DamageRegion(dPtr->damage); -+ if (RegionNil(dirty)) { -+ // Do not sync if damage empty -+ return; -+ } -+ DamageEmpty(dPtr->damage); -+ } -+ -+ if (dPtr->orb_window) { -+ //TODO: use damage region? -+ //printf("orb_window_sync %p\n", dPtr->orb_window); -+ orb_window_sync(dPtr->orb_window); -+ } -+} -+ - static Bool - DUMMYCreateWindow(WindowPtr pWin) - { -diff -ruwN source-old/src/dummy.h source/src/dummy.h ---- source-old/src/dummy.h 2023-05-07 14:27:44.000000000 -0600 -+++ source/src/dummy.h 2025-10-29 10:11:23.172517830 -0600 -@@ -4,6 +4,7 @@ - #include "xf86_OSproc.h" - - #include "xf86Cursor.h" -+#include "xf86Xinput.h" - - #ifdef XvExtension - #include "xf86xv.h" -@@ -13,7 +14,9 @@ - - #include "compat-api.h" - --#define DUMMY_MAX_SCREENS 16 -+#include -+ -+#define DUMMY_MAX_SCREENS 1 - - /* Supported chipsets */ - typedef enum { -@@ -44,6 +47,7 @@ - OptionInfoPtr Options; - Bool swCursor; - /* proc pointer */ -+ CreateScreenResourcesProcPtr CreateScreenResources; - CloseScreenProcPtr CloseScreen; - xf86CursorInfoPtr CursorInfo; - -@@ -52,6 +56,7 @@ - int cursorFG, cursorBG; - - dummy_colors colors[1024]; -+ void (*BlockHandler)(ScreenPtr, void*) ; /* wrapped BlockHandler */ - Bool (*CreateWindow)(WindowPtr) ; /* wrapped CreateWindow */ - Bool prop; - /* XRANDR support begin */ -@@ -60,6 +65,9 @@ - struct _xf86Output *paOutputs[DUMMY_MAX_SCREENS]; - int connected_outputs; - /* XRANDR support end */ -+ -+ DamagePtr damage; -+ void *orb_window; - } DUMMYRec, *DUMMYPtr; - - /* The privates of the DUMMY driver */ diff --git a/recipes/wip/x11/xserver-xorg/redox.patch b/recipes/wip/x11/xserver-xorg/redox.patch deleted file mode 100644 index 32309e202b..0000000000 --- a/recipes/wip/x11/xserver-xorg/redox.patch +++ /dev/null @@ -1,226 +0,0 @@ -diff -ruwN source-old/hw/xfree86/common/xf86Xinput.c source/hw/xfree86/common/xf86Xinput.c ---- source-old/hw/xfree86/common/xf86Xinput.c 2025-02-25 11:56:05.000000000 -0700 -+++ source/hw/xfree86/common/xf86Xinput.c 2025-11-07 14:37:53.041095608 -0700 -@@ -860,8 +860,10 @@ - if (stat(path, &st) == -1) - return; - -+ /*TODO - *maj = major(st.st_rdev); - *min = minor(st.st_rdev); -+ */ - } - - static inline InputDriverPtr -diff -ruwN source-old/hw/xfree86/drivers/modesetting/meson.build source/hw/xfree86/drivers/modesetting/meson.build ---- source-old/hw/xfree86/drivers/modesetting/meson.build 2025-02-25 11:56:05.000000000 -0700 -+++ source/hw/xfree86/drivers/modesetting/meson.build 2025-11-07 14:37:53.041947517 -0700 -@@ -42,7 +42,7 @@ - configuration: manpage_config, - )) - --test('modesetting symbol test', -- xorg_symbol_test, -- args: symbol_test_args, --) -+# test('modesetting symbol test', -+# xorg_symbol_test, -+# args: symbol_test_args, -+# ) -diff -ruwN source-old/hw/xfree86/loader/meson.build source/hw/xfree86/loader/meson.build ---- source-old/hw/xfree86/loader/meson.build 2025-02-25 11:56:05.000000000 -0700 -+++ source/hw/xfree86/loader/meson.build 2025-11-07 14:37:53.042100945 -0700 -@@ -10,7 +10,7 @@ - c_args: xorg_c_args, - ) - --xorg_symbol_test = executable('xorg_symbol_test', -- 'symbol-test.c', -- dependencies: dl_dep, --) -+# xorg_symbol_test = executable('xorg_symbol_test', -+# 'symbol-test.c', -+# dependencies: dl_dep, -+# ) -diff -ruwN source-old/hw/xfree86/meson.build source/hw/xfree86/meson.build ---- source-old/hw/xfree86/meson.build 2025-02-25 11:56:05.000000000 -0700 -+++ source/hw/xfree86/meson.build 2025-11-07 14:37:53.042256958 -0700 -@@ -171,13 +171,13 @@ - ) - endif - --executable('gtf', -- 'utils/gtf/gtf.c', -- include_directories: [inc, xorg_inc], -- dependencies: xorg_deps, -- c_args: xorg_c_args, -- install: true, --) -+# executable('gtf', -+# 'utils/gtf/gtf.c', -+# include_directories: [inc, xorg_inc], -+# dependencies: xorg_deps, -+# c_args: xorg_c_args, -+# install: true, -+# ) - - # For symbol presence testing only - xorgserver_lib = shared_library( -diff -ruwN source-old/hw/xfree86/os-support/shared/sigio.c source/hw/xfree86/os-support/shared/sigio.c ---- source-old/hw/xfree86/os-support/shared/sigio.c 2025-02-25 11:56:05.000000000 -0700 -+++ source/hw/xfree86/os-support/shared/sigio.c 2025-11-07 14:37:53.042429782 -0700 -@@ -196,11 +196,12 @@ - fd, strerror(errno)); - } - else { -+ /*TODO - if (fcntl(fd, F_SETOWN, getpid()) == -1) { - xf86Msg(X_WARNING, "fcntl(%d, F_SETOWN): %s\n", - fd, strerror(errno)); - } -- else { -+ else*/{ - installed = TRUE; - } - } -diff -ruwN source-old/hw/xfree86/os-support/xf86_OSlib.h source/hw/xfree86/os-support/xf86_OSlib.h ---- source-old/hw/xfree86/os-support/xf86_OSlib.h 2025-02-25 11:56:05.000000000 -0700 -+++ source/hw/xfree86/os-support/xf86_OSlib.h 2025-11-07 14:37:53.042605933 -0700 -@@ -176,7 +176,7 @@ - /**************************************************************************/ - /* Linux or Glibc-based system */ - /**************************************************************************/ --#if defined(__linux__) || defined(__GLIBC__) || defined(__CYGWIN__) -+#if defined(__linux__) || defined(__GLIBC__) || defined(__CYGWIN__) || defined(__redox__) - #include - #include - #include -diff -ruwN source-old/include/dix.h source/include/dix.h ---- source-old/include/dix.h 2025-02-25 11:56:05.000000000 -0700 -+++ source/include/dix.h 2025-11-07 14:37:53.042862204 -0700 -@@ -55,6 +55,7 @@ - #include "geext.h" - #include "events.h" - #include -+#include - - #define EARLIER -1 - #define SAMETIME 0 -@@ -69,14 +70,28 @@ - - #define REQUEST_SIZE_MATCH(req) \ - do { \ -- if ((sizeof(req) >> 2) != client->req_len) \ -+ if ((sizeof(req) >> 2) != client->req_len) { \ -+ fprintf(stderr, \ -+ "REQUEST_SIZE_MATCH failed in %s:%d: " \ -+ "Expected len %lu, got %d\n", \ -+ __FILE__, __LINE__, \ -+ (unsigned long)(sizeof(req) >> 2), \ -+ client->req_len); \ - return(BadLength); \ -+ } \ - } while (0) - - #define REQUEST_AT_LEAST_SIZE(req) \ - do { \ -- if ((sizeof(req) >> 2) > client->req_len) \ -+ if ((sizeof(req) >> 2) > client->req_len) { \ -+ fprintf(stderr, \ -+ "REQUEST_AT_LEAST_SIZE failed in %s:%d: " \ -+ "Expected len %lu, got %d\n", \ -+ __FILE__, __LINE__, \ -+ (unsigned long)(sizeof(req) >> 2), \ -+ client->req_len); \ - return(BadLength); \ -+ } \ - } while (0) - - #define REQUEST_AT_LEAST_EXTRA_SIZE(req, extra) \ -diff -ruwN source-old/include/meson.build source/include/meson.build ---- source-old/include/meson.build 2025-02-25 11:56:05.000000000 -0700 -+++ source/include/meson.build 2025-11-07 14:37:53.043095171 -0700 -@@ -162,7 +162,7 @@ - conf_data.set('HAVE_PORT_CREATE', cc.has_function('port_create') ? '1' : false) - conf_data.set('HAVE_REALLOCARRAY', cc.has_function('reallocarray', dependencies: libbsd_dep) ? '1' : false) - conf_data.set('HAVE_SETEUID', cc.has_function('seteuid') ? '1' : false) --conf_data.set('HAVE_SETITIMER', cc.has_function('setitimer') ? '1' : false) -+conf_data.set('HAVE_SETITIMER', false) - conf_data.set('HAVE_SHMCTL64', cc.has_function('shmctl64') ? '1' : false) - conf_data.set('HAVE_SIGACTION', cc.has_function('sigaction') ? '1' : false) - conf_data.set('HAVE_SIGPROCMASK', cc.has_function('sigprocmask') ? '1' : false) -@@ -190,14 +190,14 @@ - conf_data.set('LISTEN_LOCAL', get_option('listen_local')) - - if cc.has_header_symbol('sys/socket.h', 'SCM_RIGHTS') -- conf_data.set('XTRANS_SEND_FDS', '1') -+ #TODO conf_data.set('XTRANS_SEND_FDS', '1') - endif - --if conf_data.get('HAVE_GETPEEREID').to_int() == 0 and conf_data.get('HAVE_GETPEERUCRED').to_int() == 0 -- if not cc.has_header_symbol('sys/socket.h', 'SO_PEERCRED') -+#if conf_data.get('HAVE_GETPEEREID').to_int() == 0 and conf_data.get('HAVE_GETPEERUCRED').to_int() == 0 -+ #if not cc.has_header_symbol('sys/socket.h', 'SO_PEERCRED') - conf_data.set('NO_LOCAL_CLIENT_CRED', 1) -- endif --endif -+ #endif -+#endif - - conf_data.set('TCPCONN', '1') - conf_data.set('UNIXCONN', host_machine.system() != 'windows' ? '1' : false) -@@ -212,7 +212,7 @@ - conf_data.set('DRI2', build_dri2 ? '1' : false) - conf_data.set('DRI3', build_dri3 ? '1' : false) - if build_glx -- conf_data.set_quoted('DRI_DRIVER_PATH', dri_dep.get_pkgconfig_variable('dridriverdir')) -+ conf_data.set_quoted('DRI_DRIVER_PATH', '/usr/lib/dri') - endif - conf_data.set('HAS_SHM', build_mitshm ? '1' : false) - conf_data.set('MITSHM', build_mitshm ? '1' : false) -diff -ruwN source-old/meson.build source/meson.build ---- source-old/meson.build 2025-11-07 14:39:22.420574991 -0700 -+++ source/meson.build 2025-11-07 14:37:53.043279226 -0700 -@@ -439,7 +439,7 @@ - error('DRI requested, but LIBDRM not found') - endif - --build_modesetting = libdrm_dep.found() and dri2proto_dep.found() -+build_modesetting = false #TODO: libdrm_dep.found() and dri2proto_dep.found() - - build_vgahw = false - if get_option('vgahw') == 'auto' -@@ -753,7 +753,7 @@ - subdir('hw') - - if host_machine.system() != 'windows' -- subdir('test') -+ #subdir('test') - endif - - install_man(configure_file( -diff -ruwN source-old/os/access.c source/os/access.c ---- source-old/os/access.c 2025-02-25 11:56:05.000000000 -0700 -+++ source/os/access.c 2025-11-07 14:37:53.043632189 -0700 -@@ -120,7 +120,7 @@ - #include - #endif - --#if defined(SVR4) || (defined(SYSV) && defined(__i386__)) || defined(__GNU__) -+#if defined(SVR4) || (defined(SYSV) && defined(__i386__)) || defined(__GNU__) || defined(__redox__) - #include - #endif - #if defined(SYSV) && defined(__i386__) -diff -ruwN source-old/Xext/bigreq.c source/Xext/bigreq.c ---- source-old/Xext/bigreq.c 2025-02-25 11:56:05.000000000 -0700 -+++ source/Xext/bigreq.c 2025-11-07 14:37:53.043862040 -0700 -@@ -51,7 +51,8 @@ - } - if (stuff->brReqType != X_BigReqEnable) - return BadRequest; -- REQUEST_SIZE_MATCH(xBigReqEnableReq); -+ // libxkbcommon sends incorrect size -+ REQUEST_AT_LEAST_SIZE(xBigReqEnableReq); - client->big_requests = TRUE; - rep = (xBigReqEnableReply) { - .type = X_Reply, diff --git a/recipes/wip/x11/xterm/redox.patch b/recipes/wip/x11/xterm/redox.patch deleted file mode 100644 index 69e3a0abd5..0000000000 --- a/recipes/wip/x11/xterm/redox.patch +++ /dev/null @@ -1,76 +0,0 @@ -diff -ruwN xterm-398/main.c source/main.c ---- xterm-398/main.c 2025-03-08 06:03:19.000000000 -0700 -+++ source/main.c 2025-05-05 21:25:41.492475745 -0600 -@@ -162,6 +162,10 @@ - #define USE_POSIX_SIGNALS - #endif - -+#ifndef XTABS -+#define XTABS 0x01800 -+#endif -+ - #if defined(SYSV) && !defined(SVR4) && !defined(ISC22) && !defined(ISC30) - /* older SYSV systems cannot ignore SIGHUP. - Shell hangs, or you get extra shells, or something like that */ -@@ -185,6 +189,10 @@ - #define WTMP - #endif - -+#ifdef __redox__ -+#define USE_SYSV_PGRP -+#endif -+ - #ifdef __SCO__ - #ifndef _SVID3 - #define _SVID3 -@@ -3114,7 +3122,7 @@ - } - } - --#if defined(__osf__) || (defined(__linux__) && !defined(USE_USG_PTYS)) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) -+#if defined(__osf__) || (defined(__linux__) && !defined(USE_USG_PTYS)) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) || defined(__redox__) - #define USE_OPENPTY 1 - static int opened_tty = -1; - #endif -@@ -4494,7 +4502,7 @@ - /* make /dev/tty work */ - ioctl(ttyfd, TIOCSCTTY, 0); - #endif --#ifdef USE_SYSV_PGRP -+#if defined(USE_SYSV_PGRP) && !defined(__redox__) - /* We need to make sure that we are actually - * the process group leader for the pty. If - * we are, then we should now be able to open -diff -ruwN xterm-398/xterm.h source/xterm.h ---- xterm-398/xterm.h 2025-04-08 01:36:09.000000000 -0600 -+++ source/xterm.h 2025-05-05 21:11:05.413561791 -0600 -@@ -80,7 +80,7 @@ - #define HAVE_PUTENV 1 - #endif - --#if defined(CSRG_BASED) || defined(__GNU__) || defined(__minix) -+#if defined(CSRG_BASED) || defined(__GNU__) || defined(__minix) || defined(__redox__) - #define USE_POSIX_TERMIOS 1 - #endif - -@@ -208,7 +208,7 @@ - #define HAVE_PTY_H - #endif - --#if !defined(USG) && !defined(__minix) -+#if !defined(USG) && !defined(__minix) && !defined(__redox__) - #define HAVE_SETITIMER 1 - #else - #define HAVE_SETITIMER 0 -diff -ruwN xterm-398/xterm_io.h source/xterm_io.h ---- xterm-398/xterm_io.h 2024-09-30 02:03:20.000000000 -0600 -+++ source/xterm_io.h 2025-05-05 21:11:05.413561791 -0600 -@@ -57,7 +57,7 @@ - #define USE_SYSV_TERMIO - #endif - --#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__INTERIX) || defined(__APPLE__) || defined(__UNIXWARE__) || defined(__hpux) -+#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__INTERIX) || defined(__APPLE__) || defined(__UNIXWARE__) || defined(__hpux) || defined(__redox__) - #ifndef USE_POSIX_TERMIOS - #define USE_POSIX_TERMIOS - #endif