Skip to content

feat(libSceLibcInternal): implement posix_spawn actions - #3651

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
MarcZX10:codex/libc-posix-spawn-3624
Oct 13, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
MarcZX10:codex/libc-posix-spawn-3624

Conversation

@MarcZX10

@MarcZX10 MarcZX10 commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What

Carries David's posix_spawn implementation from issue #3624, preserving his authorship. This PR covers process creation and spawn-configuration functions. The attribute and file-action calls follow FreeBSD 11.4: initialize/destroy the opaque objects, store attributes and ordered open/dup2/close actions, copy addopen paths, and return EBADF for negative descriptors. posix_spawn and posix_spawnp throw because process creation is not implemented; callers do not receive a guessed process ID.

Current title evidence

On main 88107b7de, Windows 11 catalog runs of both Dusklight (PPSA99305) and Wind Waker (PPSA99309) stop at unresolved import 44hlATrd47U (posix_spawnattr_init). This addresses their first reported import stop; it does not claim either title reaches gameplay with process creation still unsupported.

Tested

Checklist

  • Rebased onto current main 42e5edadb; no other open PR implements these functions
  • One topic: POSIX spawn configuration and its explicit unsupported process-creation boundary
  • No comments in code except technical debt
  • No notes or investigation files added
  • Generic behavior, not title-specific
  • Depends on: none
  • Addresses the first reported import stop for PPSA99305 (libc: isnanf, __signbitl and the posix_spawn family are absent (XPSemu); fix branch ready #3624) and PPSA99309
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Progress report (42e5eda → 7bb59f7)

📉 System libraries: 87.87% (-0.02%, +9 implemented, +2 declared functions)

✅ 9 implemented
Library Name
libSceLibcInternal posix_spawn_file_actions_addclose_nid_postfix
libSceLibcInternal posix_spawn_file_actions_adddup2_nid_postfix
libSceLibcInternal posix_spawn_file_actions_addopen_nid_postfix
libSceLibcInternal posix_spawn_file_actions_destroy_nid_postfix
libSceLibcInternal posix_spawn_file_actions_init_nid_postfix
libSceLibcInternal posix_spawnattr_destroy_nid_postfix
libSceLibcInternal posix_spawnattr_init_nid_postfix
libSceLibcInternal posix_spawnattr_setflags_nid_postfix
libSceLibcInternal posix_spawnattr_setsigdefault_nid_postfix
🆕 2 declared as stubs
Library Name
libSceLibcInternal posix_spawn_nid_postfix
libSceLibcInternal posix_spawnp_nid_postfix

@blawesom

Copy link
Copy Markdown
Contributor

Independent pre-review on Linux (full CI runs only happen on manual trigger, so recording one): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON.

  • Builds; tools/check_conventions.py --base origin/main passes.
  • Full suite: 833/833 passed (all tests including the Vulkan suites on AMD RX 9070 XT / RADV).

@github-actions github-actions Bot added build docs prx needs rebase Conflicts with main, rebase needed labels Oct 11, 2026
@babyhuey babyhuey mentioned this pull request Oct 11, 2026
9 tasks done
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Closing: no title run reaches posix_spawn or the attribute and file-action calls on main; the evidence is the import list, and posix_spawn itself still throws. Reopen with the title ID and the log line where a run stops at one of them.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Reopened: #3640 has a title stopping on it now (PPSA99305, #3624), and this is its next stop after that. The close was premature.

@oneandonlydean oneandonlydean self-assigned this Oct 12, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Conflicts with main in docs/dev/TechnicalDebt.md, so the full build can't start; please rebase.

@overlordxrz-source

Copy link
Copy Markdown
Contributor

Run evidence for this one: on our Linux rig (lavapipe, main b42ef24), Dusklight (PPSA99305) stops on the unresolved import posix_spawnattr_init (44hlATrd47U):
./app.elf: symbol lookup error: ./app.elf: undefined symbol: 44hlATrd47U
I can rerun it with this PR applied if that helps.

@reyani-dev

Copy link
Copy Markdown
Contributor

A title whose first stop on main is this family: Dusklight (PPSA99305, v0.2.0, griches/PS5_Dusklight, GPL-3.0), which was added to the homebrew catalog this week. On main 9fca13b (Windows 11, catalog build with eboot.bin and sce_module/libc.prx unwrapped) it fails to load with

FAIL: unresolved ELF import 44hlATrd47U from libSceLibcInternal.prx

44hlATrd47U is posix_spawnattr_init. It's the title's first stop, with no other PR needed before it, unlike XPSemu, which needs several merges before it gets here.

@MarcZX10
MarcZX10 force-pushed the codex/libc-posix-spawn-3624 branch from b6509c7 to f85a8b3 Compare October 12, 2026 16:59
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@MarcZX10
MarcZX10 force-pushed the codex/libc-posix-spawn-3624 branch from f85a8b3 to 859df8c Compare October 12, 2026 18:36
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@MarcZX10
MarcZX10 force-pushed the codex/libc-posix-spawn-3624 branch from 859df8c to b89ece8 Compare October 12, 2026 18:48
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@babyhuey babyhuey mentioned this pull request Oct 13, 2026
10 tasks done
@LeandroLP23

Copy link
Copy Markdown
Contributor

A second catalog title now stops on this family: Wind Waker (PPSA99309, catalog 1.0.1, GPL-3.0), new this week. On main 88107b7de, Windows 11, relinked with --windows --trap-sdk-syscall-stubs, it exits after 4 s with FAIL: unresolved ELF import 44hlATrd47U from libSceLibcInternal.prx (posix_spawnattr_init), the same first stop as Dusklight (PPSA99305). The PR conflicts with main now; once it's rebased I can run both titles with it on Windows.

AI-assisted: yes (Claude Code)

@MarcZX10

Copy link
Copy Markdown
Contributor Author

Thanks for the additional title report. Wind Waker (PPSA99309) independently confirms the same posix_spawnattr_init load stop as Dusklight, and a Windows run of the PR would be useful. The PR currently conflicts with main, so please hold the comparison until there is a rebased head; I will post again when that is ready.

@MarcZX10
MarcZX10 force-pushed the codex/libc-posix-spawn-3624 branch from b89ece8 to 4789561 Compare October 13, 2026 07:40
@MarcZX10

Copy link
Copy Markdown
Contributor Author

Rebased onto current main and preserved the current libSceLibcInternal CMake entries and debt documentation. The new debt entry records the updated evidence: both Dusklight (PPSA99305) and Wind Waker (PPSA99309) stop on main 88107b7de at unresolved import 44hlATrd47U (posix_spawnattr_init). The previous Linux and Windows results predate this rebase; I have not rerun the current head locally.

@LeandroLP23, you offered to rerun both titles once the PR was rebased. Could you check this exact head and report the first stop after it, if convenient? posix_spawn/posix_spawnp still throw, so this PR does not claim the titles reach gameplay.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 13, 2026
David and others added 2 commits October 13, 2026 07:56
…e action calls

XPSemu (PPSA97358) imports eleven posix_spawn calls from
libSceLibcInternal.prx, one reference each, and no call site is known.
Predicted stop (import order, not measured), behind isnanf (idx 296):
`FAIL: unresolved ELF import 44hlATrd47U from libSceLibcInternal.prx`
(posix_spawnattr_init, idx 347), followed by p--TkNVsXjA, LG6O0oW9bQU,
Sj7y+JO5PcM, Ud8CbISKRGM, Hq9-2AMG+ks, IUfBO5UIZNc, Heh4KJwyoX8 (348-355),
UV4m0bznVtU, Ani6e+T-y6Q and 3Nr9caNHhyg (379-381).

The nine object calls follow FreeBSD release/11.4.0 (8c639945a445)
lib/libc/gen/posix_spawn.c: posix_spawnattr_init allocates a zeroed
attribute object (ENOMEM on failure), _destroy frees it, _setflags and
_setsigdefault store the value; posix_spawn_file_actions_init allocates an
empty list (-1 on failure, as in 11.4), _destroy frees it with its
entries, and _addopen (path copied), _adddup2 and _addclose append in
order after returning EBADF for a negative descriptor. Null or
uninitialized objects, which FreeBSD dereferences, throw.

posix_spawn and posix_spawnp throw "process creation not implemented",
as execvp does: FreeBSD validates no argument before rfork/vfork, and no
child process can be created here. TechnicalDebt records them.
guest_posix_spawn covers the attribute round trips, the recorded action
sequence, the EBADF cases and the throws. NIDs computed with
tools/nid_names.py and present in aerolib.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@MarcZX10
MarcZX10 force-pushed the codex/libc-posix-spawn-3624 branch from 5e3e741 to 7bb59f7 Compare October 13, 2026 07:56
@MarcZX10

Copy link
Copy Markdown
Contributor Author

The branch is now rebased onto current main (42e5edadb), with David’s implementation commit preserved. The two reported catalog stops are still the stated basis; I have not rerun either title locally. @LeandroLP23, could you rerun Dusklight and Wind Waker on this exact head and report the next stop (or successful load), when convenient? posix_spawn and posix_spawnp remain explicitly unsupported, so the expected result may simply be a later stop.

@LeandroLP23

Copy link
Copy Markdown
Contributor

Ran both titles on this exact head, 7bb59f73b, merged onto main 4bb2c7f39. The base needs #5014: on 42e5edadb alone, no title loads on Windows, because libSceAgcDriver.prx imports LibcUnwind::CursorSlots from libc.prx. Setup: Windows 11 (26300), WinLibs GCC 15.2.0, Release, relinked with --windows --trap-sdk-syscall-stubs.

  • ctest -R posix_spawn: 3/3.
  • Dusklight (PPSA99305): gets past posix_spawnattr_init and stops next at FAIL: unresolved ELF import cPGyc5FGjy0 from libSceLibcInternal.prx (atanhf), after 3 s.
  • Wind Waker (PPSA99309): the same, now stopping at atanhf.
  • DOOM on the same build runs 60 s, as on main.

So this PR moves both titles one import further. The next stop for both is atanhf.

AI-assisted: yes (Claude Code)

@0xRickx 0xRickx mentioned this pull request Oct 13, 2026
10 tasks done
@oneandonlydean
oneandonlydean merged commit e09ee16 into boykopovar:main Oct 13, 2026
8 checks passed
@LeandroLP23

Copy link
Copy Markdown
Contributor

Dusklight (PPSA99305) reaches Menus on main now that this PR and #5036 are merged: Windows 11 (26300), Radeon 860M, WinLibs GCC 15.2.0, Release, main 6cd052848 with no patches, catalog release relinked with --windows --trap-sdk-syscall-stubs, 60 s with APS5_PAD_INPUT_FILE pulses from 30 s, frames dumped with APS5_DUMP_FRAMES. It draws its title menu (Select disc image, Settings, Mods, Quit; "No disc image found."), and it responds to the controller: D-pad down moves the selection from Select disc image to Settings, then to Quit. No disc image was used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants