fix(libkernel): keep errno across timed condition waits on macOS #28369
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/28369"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Jazeupoi on 2026-11-30T10:00:20Z.
What
On macOS
guest_event_flag_wakeaborts on every run. Its read-only timeout case (added in #22055) expectssceKernelWaitEventFlagto returnSCE_KERNEL_ERROR_EFAULTwitherrnounchanged, and the call returnsEFAULTwitherrnoat 316.TimedWait::Conditionwaits throughstd::condition_variable_any; when that wait times out on macOS, libpthread leaves the raw__psynch_cvwaitstatus inerrno: 316 isETIMEDOUT(60) withECVCLEARED(0x100). glibc's condition wait does not toucherrno, which is why the test passes on Linux.Condition::WaitandCondition::WaitUntilnow saveerrnobefore the wait and restore it afterwards, so a guest call that waits keeps theerrnoit was called with on every host.Tested
macOS 27.0.1, Apple M4, x86_64 Release under Rosetta 2, Apple clang 21.0.0. The tree was
main1b8f79a5b5plus #26739, #27739 and #17425, which macOS needs to build; none of them touches this code, andTimedWait.hpp,EventFlag.cppand the test are unchanged up tob3c7769bc5.guest_event_flag_wake: 50/50. Without the change: 0/3, aborting on the read-only timeout check (rc=0x8002000e errno=316 pattern=0x5 timeout=1000).main. The 8 that still fail on this Mac also fail without the change, and each already has an open PR or issue.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)Summary by CodeRabbit
errnovalue after waiting.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T10:01:34Z.
Review: COMMENTED
Review not completed — comments
I could not inspect the prepared review or repository files because this session exposes no reader or filesystem tools, so no verdict on the change is supported by evidence.
What I ran
No commands. The pinned head was provided as
e44c9a2e173ffb2b8c41b7de985549203dc944d9.Results
repo_read.pyunavailableFindings
Blocking
None verified.
Non-blocking
None verified.
Not verified
description.md,commits.md,diff.patch,manifest.json, andfiles.jsonwere not read. No changed files were read; the files listed for review could not be determined.To get this to a good state
Provide access to the prepared review folder and the pinned repository reader so the review can be completed.
Imported from boykopovar/AnyPS5. Originally posted by NobleBrains on 2026-11-30T23:36:47Z.
Review: APPROVED
Confirmed on macOS 15, the OS of the
macos-15runner, in addition to the macOS 27 run in the description.Setup: Apple M4, macOS 15.7.9, Apple clang 17.0.0 (clang-1700.6.3.2), x86_64 Release under Rosetta,
BUILD_TESTING=ON.Tree:
main93d64f2d1e+ the open macOS build fixes #27201, #27739, #27843, #17425, #27827, #27767 (maindoes not build on macOS without them, see #28168), + #22091, then this PR ate44c9a2e17. It merges cleanly.guest_event_flag_wake, 30 sequential runsI also had an earlier, independent patch for the timed wait only (save and restore
errnoaroundcoarse.wait_for). That version made the same test pass on this Mac too. This PR also covers the untimedcoarse.wait, so I'm dropping mine in favour of this one.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T06:37:03Z.
Review: COMMENTED
Tested the before and after
TimedWait::Conditionheaders on Linux with a lock that deliberately changeserrnowhencondition_variable_anyunlocks and reacquires it. The pre-change header returnedEAGAINfrom both the notified wait and the timed-out wait. The PR preserved the caller’sEBUSYin both cases. This exercise used the real kernel library for notification and deadline calculation.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.