Repository navigation
feat(libkernel): implement pthread_timedjoin_np - #8890
oneandonlydean merged 4 commits into
Conversation
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
I checked the overlap report against #8837: that PR adds the same |
|
I checked the public PS5 3.20 export bindings: NID So the inventory shows this export in both providers, not only |
|
Linux integration validation of exact head The tests load the actual full-project Negative control: kept the same test executables, replaced only the two changed pthread implementation files with merge-base Also ran the repository's NID packaging commands on a temporary kernel copy, using an export-preservation list generated from the same built libc. The patched ELF contains exactly one defined Environment: Debian 13.7 x86-64, Linux ctest --test-dir build \
-R '^(guest_timed_join_(normal|coarse)|guest_pthread_(join_detach|join_self|second_join|cancel|cancel_recovery|cancel_recovery_coarse)|guest_sleep_cancel_.*)$' \
--parallel 2 -V
ctest --test-dir build -R '^guest_timed_join_(normal|coarse)$' --repeat until-fail:3 -VTracked sources restored to the named head. This run uses canonical AI-assisted testing and report. |
|
The inventory is not limited to libkernel: the pinned public 3.20 table also lists #8837 is merged with a throwing libkernel_sys declaration. Although #8867 is also merged and #8853 is closed, its requested-variant-first search means an existing variant stub can shadow the canonical implementation. That fallback change alone does not establish working timed-join calls through the stub, and I am not claiming sys/web-scoped behavior here. The separate provider gap remains outside this focused runtime implementation. I also recorded Filip722's canonical-libkernel Linux results with the exact tested head and attribution. No runtime code changed in this follow-up; existing validation limits remain. |
|
The remaining provider limitation is addressed in dependent follow-up #9582, keeping this PR's canonical implementation unchanged. It removes libkernel_sys's throwing declaration so the existing requested-variant-first resolver can fall through to libkernel. libkernel_web already falls through correctly and is retained as a passing control. No duplicate export or resolver-priority change is introduced. The regressions relink synthetic ELF executables with actual NID-scoped imports and load real patched libraries. They cover null/invalid deadlines, validation before an invalid thread pointer, and a create/timed-join round trip with the full-width return value. With identical generated executables and only the variant DLL swapped, baseline gives four sys failures/four web passes; candidate passes all eight cases, then 80 repeated executions. The full Windows libs build and 20 selected suites pass, including the 360-library loader. #9582 records the initial sandbox filesystem failure, normal-permission baseline comparison, skipped symlink cases and unavailable platform/hardware validation. #9582 declares Depends on #8890. Neither PR has been merged by me. AI-assisted: yes. |
|
Refreshed onto main 329efe1 with history-preserving merges. #8890 is now 235ea5f; #9582 is da52d09. All 20 selected Windows suites pass, including actual sys/web imports, canonical normal/coarse timed join, lifecycle/cancellation, kernel-sys and patched-library loading. Conventions, registration (1176 executables, none unregistered) and whitespace pass. No Linux/macOS or console retest; the full repository suite was not run. The current conventions checker newly rejects the prerequisite alone while the duplicate sys discovery declaration exists. I therefore included that deletion in #8890; #9582 now retains the scoped-import regressions. The final combined tree is identical to the tested 4158a67 tree, and the regression-first baseline evidence remains in the PR description. No published history was rewritten. The invalid-deadline/valid-self precedence control is retained. Proposed order: #8890, then #9582. @Pouare514 (#7149), preserve your successful Windows join ReapRetiredWinStacks call in the shared success path, and the detach/exit retirement logic. @poonasor (#4563), the Reap-before-native-wait handshake similarly belongs in that shared path if your protocol lands, preserving AwaitReap and detach handling. @simonbronk (#9713), retain your five sys implementations and remove their discovery stubs together with the timed-join stub; this is an adjacent deletion conflict. @giannireale (#9770), your removal/reorganization of the adjacent registration block must retain the timed-join wrapper and correct registration. @TaymKal (#6044), if the test reorganization lands first, I will adapt the canonical and sys/web fixtures to its final paths/helpers/labels. Please confirm the intended landing order for these overlaps. These external branches were not combined/tested here, and agreement remains pending. The refreshed overlap scan reports #9713/#9770 textual conflicts and 22 base-conflicted shared-file warnings; their shared diffs were inspected, including the lifecycle interactions above. The generic intake hold was withdrawn, so I am not treating it as a blocker. The wider audit will pause after this review-follow-up pass. |
What
Implement
pthread_timedjoin_np(PkS44IGrDkM) through the existing guest join lifecycle. A timed-out or canceled join releases its claim and leaves the target joinable; success retains the existing native teardown and return-value handling. Validate deadlines before thread arguments, preserve POSIX errno, and convert absolute realtime deadlines without overflowing on distant dates.The public PS5 SDK supplies the prototype, the public 3.20 table and symbol database corroborate the NID, and FreeBSD libthr supplies the behavior reference. PS5 behavior and module/library versions remain unmeasured. The debt entry records realtime recheck granularity and the limitation that final native teardown after guest completion is unbounded. General scoped sys/web fallback merged in #8867; the remaining throwing sys declaration is removed here to satisfy the current duplicate-export rule, with actual-library sys/web regression coverage in dependent #9582.
Tested
Windows x86-64, GCC 15.2, Release; isolated checkout based on
aa408677b0e794cf59f314ebcf9a716ede638295. No games or USB hardware used.Regression added first: both normal/coarse modes fail on the baseline's missing export. With identical test executables and only the unpatched kernel swapped, baseline passes 14 existing tests and fails the two new cases; candidate passes all 16. After rebasing, the full affected
libsbuild succeeds and 17/17 tests pass, including all 354 patched libraries loading with zero failures. Loading checks linkage only.Coverage includes invalid/null deadline precedence, null/self/detached/already-joined targets, past/future/distant deadlines, completed-target success with an expired deadline, unchanged deadline/errno, return-slot bounds, timeout-and-retry, competing joiners, cancellation and claim release. Existing join/detach/self/second-join, cancellation/recovery and sleep-cancellation cases pass. Tests run in normal and coarse modes where registered. No Linux/macOS or console execution; host scheduling latency and wall-clock adjustment were not injected.
Conventions, whitespace and test registration pass (1146 targets, none unregistered). Independent read-only review found no actionable defect and did not rerun tests. The required overlap report was reviewed manually, including its base-conflicted shared-file warnings: no duplicate timed-join export. #7149 adds stack reaping to the native join tail and may need adaptation to the shared helper if merged; #6044 reorganizes tests. No dependency on either.
Review follow-up
Merged current main
329efe1bfdaff116c57cdf62718026ee4f5521aewithout rewriting published history. Canonical #8890 head:235ea5fd2260c6327eab43a82f08fd70c2236925; dependent #9582 head:da52d09106ac0353b8b0d9f4de526d1c1b4caeb7. The shared Thread.cpp is identical between these heads. The refreshed combined stack rebuilt affected Windows libraries and passed all 20 selected timed-join, sys/web import, lifecycle/cancellation, kernel-sys and patched-library suites. This is a combined-stack run, not a separate run of the prerequisite-only DLL. Linux/macOS and console execution remain unavailable locally. Test registration and conventions were rechecked. The refreshed checker rejects #8890 alone while the duplicate sys discovery declaration exists, so its deletion is now included in #8890 (235ea5f). #9582 retains the actual-library sys/web regression coverage. The final combined tree is byte-for-byte identical to tested stack 4158a67; this history adjustment changes no tested source.Proposed integration order is #8890 followed by #9582. Coordination with #7149 must retain its successful Windows join stack reaping in the shared join-success path and its detach/exit behavior. #9713 must retain its five sys implementations while dropping their discovery declarations and this follow-up's timed-join declaration. If #6044 lands first, move/register the new tests according to its final directory/helper/label conventions. These external landing agreements are pending; the unrelated branches were not combined or tested here. There is no duplicate timed-join provider.
The latest overlap scan (upstream snapshot b7d1d47) reports textual conflicts with #9713 and #9770, plus 22 base-conflicted shared-file warnings. Manual inspection also identifies #4563: its Reap-before-native-wait protocol must be retained inside the shared success path if combined, with AwaitReap/detach handling preserved. #9770 removes/reorganizes the adjacent registration block; keep the timed-join wrapper and verify registration after either landing order. No combined validation of these external branches is claimed. These coordination items remain open rather than being presented as clean integration.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)