Repository navigation
feat(libkernel): implement pthread_rwlock_reltimedrdlock_np and pthread_rwlock_reltimedwrlock_np - #9265
Merged
oneandonlydean merged 1 commit intoOct 23, 2026
Conversation
…ad_rwlock_reltimedwrlock_np Both were missing from libkernel.prx, so a title importing either (dYv-+If2GPk, RRnSj8h8VR4) failed to load. They take a relative timeout in microseconds and are scePthreadRwlockTimedrdlock and scePthreadRwlockTimedwrlock with POSIX error numbers; a zero lock is initialized as by pthread_rwlock_rdlock. The signature comes from shadPS4, which registers one function for each NID and its scePthreadRwlockTimed* twin; FreeBSD 11.4 has no such calls. The throwing libkernel_sys copies are removed, as an export may live in one library only. Recorded in the libkernel debt file. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Progress report (d34da5d → 8f13fe7)📈 System libraries: 42.12% (+0.02%, +2 implemented, -2 removed functions) ✅ 2 implemented
🗑️ 2 removed
|
|
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.
|
harisibrar1
approved these changes
Oct 22, 2026
harisibrar1
left a comment
Contributor
There was a problem hiding this comment.
Checked against main a6646f8 and shadPS4 rwlock.cpp @3a9f57265d:
- The NIDs check out:
dYv-+If2GPkandRRnSj8h8VR4hash from the two names. - shadPS4 registers the same
(rwlock, u32 usec)function for these NIDs and, viaORBIS(...), forscePthreadRwlockTimedrdlock/Timedwrlock. Forwarding to main'sscePthreadRwlockTimed*lock(rwlock, KernelUseconds)is therefore consistent, and the error mapping (ETIMEDOUT, EINVAL for a destroyed lock, EDEADLK when the caller holds the write lock) is the same one main's absolutepthread_rwlock_timed*lockalready uses. - The branch still merges cleanly into current main, and main hasn't touched the rwlock sources or the test since your base. Looks good to me.
Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
pthread_rwlock_reltimedrdlock_np(dYv-+If2GPk) andpthread_rwlock_reltimedwrlock_np(RRnSj8h8VR4) were missing fromlibkernel.prx, so a title importing either stopped at load withFAIL: unresolved ELF import ... from libkernel.prx.pthread_rwlock_timed*lockcalls: a zero lock is initialized as bypthread_rwlock_rdlock, thenscePthreadRwlockTimedrdlock/scePthreadRwlockTimedwrlockrun with the microsecond count and the SCE error is turned into a POSIX error number, the same waypthread_cond_reltimedwait_npmaps ontoscePthreadCondTimedwait.libkernel_sys/Export.Discovery.cppare removed, sincecheck_conventionsallows an export in one library only (duplicate-export). An import of these two fromlibkernel_sysnow no longer resolves, as for the other libkernel pthread calls.(rwlock, u32 usec)comes only from shadPS4, which registers one function for each of these NIDs and for itsscePthreadRwlockTimed*twin (rwlock.cpp); FreeBSD 11.4 libthr has no such functions. This is recorded in the libkernel debt file.Tested
Linux (Ubuntu container, GCC, Release,
BUILD_TESTING=ON):guest_pthread_rwlockwith a new relative-timeout case: passed. It checks a zero lock initialized by both calls,EINVALafter destroy, a shared read beside another reader,ETIMEDOUTafter at least 15 ms for a 20 ms timeout and at once for 0 against a reader and a writer, and that a long timeout succeeds once the holder lets go. Breaking the write call (timeout forced to 0) makes it fail.guest_cond_timedwaitandguest_kernel_sys(unchanged): passed.nid_patcher, the patchedlibkernel.prxexportsdYv-+If2GPkandRRnSj8h8VR4(nm -D).python3 tools/check_conventions.py --base upstream/main: passed.Windows 10 (MinGW-w64 GCC 15.2.0 WinLibs
x86_64-ucrt-posix-sehr7, Release,BUILD_TESTING=ON), on 923eb03, which has the same implementation; the later commit only drops two test lines and moves the debt entry:guest_pthread_rwlock,guest_cond_timedwaitandguest_kernel_sys: 3 of 3 passed.Not tested: any title. None of the titles checked here import the two NIDs.
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)Duplicate and overlap check
Checked on 2026-10-21 against upstream
maincecb540 and the heads of all 918 open pull requests:mainadds or changespthread_rwlock_reltimedrdlock_nporpthread_rwlock_reltimedwrlock_np; onmainthey appear only as the libkernel_sys stubs this removes (44c531b).main, and merging it with each open pull request adds no conflict that the pull request does not already have withmain.scePthreadRwlockTimed*locktime out instead of returningEDEADLKwhen the caller holds the write lock. These two calls inherit that, and the new test makes no claim about that case; with fix(libkernel): time out timed locks of a lock the caller already holds #9165 merged in,guest_pthread_rwlockstill passes. feat(libkernel): add missing pthread attribute accessors #8373 (rwlock attributes) and feat(libkernel_sys): implement pthread attribute and initial-thread queries #9160 touch the same files in other places; the debt entry was placed away from feat(libkernel_sys): implement pthread attribute and initial-thread queries #9160's and fix(libkernel): time out timed locks of a lock the caller already holds #9165's insertions.pthread_timedjoin_np) and feat(libSceFiber): attach contexts on run and switch, internal option initialize #9072 (fiber attach) are other functions from the same scan.