refactor(systemservice): drop errno saves around guest copies #26191

Merged
LeandroLP23 merged 1 commit from upstream-pr/26191 into main 2026-11-23 13:00:39 +00:00
LeandroLP23 commented 2026-11-23 12:28:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-11-23T12:28:39Z.


What

Same change as #25937, #25944 and #25945, for libSceSystemService. GuestCopyIn_nid_no_patch, GuestCopyOut_nid_no_patch and GuestWritable_nid_no_patch restore errno themselves since #21243 (RestoreErrno in libc/src/General.cpp), so saving and restoring errno around them does nothing.

20 inline saves around a guest copy are removed, in Export.cpp and PendingExports.cpp. A save is kept where the saved value is used again later in the function. 40 lines removed.

No open pull request touches these files.

No change in behaviour.

Tested

Windows 11 (10.0.26300), WinLibs GCC 15.2.0 r7, Release. ctest -R 'system_?service', with its 20 build outputs from tools/select_tests.py targets: 27 of 27 on main 709342e209 and 27 of 27 with this change applied to it. tools/check_conventions.py passes. tools/pr_overlap.py --branch finds no overlap with the 2550 open pull requests.

Not run: Linux and macOS.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5453108836 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26191). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-11-23T12:28:39Z. --- ### What Same change as #25937, #25944 and #25945, for `libSceSystemService`. `GuestCopyIn_nid_no_patch`, `GuestCopyOut_nid_no_patch` and `GuestWritable_nid_no_patch` restore `errno` themselves since #21243 (`RestoreErrno` in `libc/src/General.cpp`), so saving and restoring `errno` around them does nothing. 20 inline saves around a guest copy are removed, in `Export.cpp` and `PendingExports.cpp`. A save is kept where the saved value is used again later in the function. 40 lines removed. No open pull request touches these files. No change in behaviour. ### Tested Windows 11 (10.0.26300), WinLibs GCC 15.2.0 r7, Release. `ctest -R 'system_?service'`, with its 20 build outputs from `tools/select_tests.py targets`: 27 of 27 on `main` `709342e209` and 27 of 27 with this change applied to it. `tools/check_conventions.py` passes. `tools/pr_overlap.py --branch` finds no overlap with the 2550 open pull requests. Not run: Linux and macOS. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
mihiii1337 commented 2026-11-23 12:49:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T12:49:19Z.

Review: APPROVED


Reviewed 2f0a253b22. All 20 removals surround unchanged checked-copy expressions, and the shared RestoreErrno implementation is identical to the base.

A focused native Windows fixture passed 57/57 on the base and on this head. Per arm, the registered errno-changing hooks ran 21 times for reads and 42 times for writes. It covered the two ordered activation outputs, the PS Button read-to-write path, short-circuiting on failure, and preservation of the errno value left by the application category lookup before the copy. With the shared RestoreErrno guards removed in a local negative control, 45 cases failed. The fixture uses the extracted export and checked-copy paths, real Windows page permissions, and test doubles for title metadata and mapping ownership.

I also found open PRs that edit other hunks in the same files (#20896, #14202, #24962, #17144, #8651 and #17090). None changes these save/restore sites or introduces a conflict in these files in a merge-tree check against this PR.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6021969911 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26191#pullrequestreview-6021969911). Originally posted by [mihiii1337](https://github.com/mihiii1337) on 2026-11-23T12:49:19Z. **Review:** APPROVED --- Reviewed 2f0a253b22. All 20 removals surround unchanged checked-copy expressions, and the shared RestoreErrno implementation is identical to the base. A focused native Windows fixture passed 57/57 on the base and on this head. Per arm, the registered errno-changing hooks ran 21 times for reads and 42 times for writes. It covered the two ordered activation outputs, the PS Button read-to-write path, short-circuiting on failure, and preservation of the errno value left by the application category lookup before the copy. With the shared RestoreErrno guards removed in a local negative control, 45 cases failed. The fixture uses the extracted export and checked-copy paths, real Windows page permissions, and test doubles for title metadata and mapping ownership. I also found open PRs that edit other hunks in the same files (#20896, #14202, #24962, #17144, #8651 and #17090). None changes these save/restore sites or introduces a conflict in these files in a merge-tree check against this PR. AI-assisted: yes
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!26191
No description provided.