build: compile FileStream, error categories, thread priority and two tests on macOS #10419

Merged
iamthehimansh merged 43 commits from upstream-pr/10419 into main 2026-10-25 21:35:30 +00:00
iamthehimansh commented 2026-10-23 23:32:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by iamthehimansh on 2026-10-23T23:32:53Z.


What

Part 1 of splitting #8658 into topic PRs, as @adriadam10 asked: the shared-file build fixes that let main compile further on macOS. #4627 (@mugurc) has since landed the Formatting.cpp and ExportMacros.hpp parts, so this PR carries only what is still missing on main. All changes are macOS-only; Linux and Windows compile the same code as before.

  • FileStream.hpp: call feof_unlocked / ferror_unlocked unqualified. The macOS SDK defines them as macros, so ::feof_unlocked does not exist.
  • StandardExceptions.cpp: const_cast the error-category vtable slot before the function-pointer reinterpret_cast, which Apple clang rejects as casting away qualifiers. Without it libc/src/exception/Exports.cpp fails to build since std::system_category landed.
  • ThreadPriority.cpp: macOS has no rtkit or RLIMIT_RTTIME. high asks for the user-interactive QoS class, and rt for a Mach time-constraint policy (period 1 ms, computation 0.5 ms), documented in docs/dev/ENVIRONMENT.md.
  • GuestContentSearch.cpp and GuestNpWebApi2.cpp: include <initializer_list>.

On macOS, main still fails 13 objects with this PR, each in a file another open macOS PR changes: GuestAllocations.cpp (branch), DirectMemory.cpp (#7631), Thread.cpp and Process.cpp (#7804), Exception.cpp and GuestRaiseException.cpp (#4630), and NativeStat.cpp, SharedMemory.cpp, Stdio.cpp, DynamicLoader.cpp, ModuleInfo.cpp and Rtld.cpp (#7201).

With BUILD_TESTING=ON, libSceAgcDriver also fails in Driver/Lifecycle.cpp (MAP_FIXED_NOREPLACE), Execution/src/GuestMemory.cpp (link.h), GuestBufferMemory.cpp (linux/udmabuf.h) and Texture.cpp (is_trivially_copyable on a std::shared_ptr). Those fixes were in #8658 and come in the AGC driver part of the split, since they need the driver memory and dma-buf changes there.

Tested

macOS 26 on an Apple M2 Pro, x86_64 under Rosetta 2, Release with Ninja, on main at a23f8fc9f. The library build's remaining failures are the 13 objects above. For Linux and Windows, I checked each changed file's view under unifdef -U__APPLE__, with -D__linux__ and with -D_WIN32: it equals main. python3 tools/check_conventions.py --base origin/main passes.

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
  • 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 (Cana)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4990560924 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10419). Originally posted by [iamthehimansh](https://github.com/iamthehimansh) on 2026-10-23T23:32:53Z. --- ### What Part 1 of splitting #8658 into topic PRs, as @adriadam10 asked: the shared-file build fixes that let `main` compile further on macOS. #4627 (@mugurc) has since landed the `Formatting.cpp` and `ExportMacros.hpp` parts, so this PR carries only what is still missing on `main`. All changes are macOS-only; Linux and Windows compile the same code as before. - `FileStream.hpp`: call `feof_unlocked` / `ferror_unlocked` unqualified. The macOS SDK defines them as macros, so `::feof_unlocked` does not exist. - `StandardExceptions.cpp`: `const_cast` the error-category vtable slot before the function-pointer `reinterpret_cast`, which Apple clang rejects as casting away qualifiers. Without it `libc/src/exception/Exports.cpp` fails to build since `std::system_category` landed. - `ThreadPriority.cpp`: macOS has no rtkit or `RLIMIT_RTTIME`. `high` asks for the user-interactive QoS class, and `rt` for a Mach time-constraint policy (period 1 ms, computation 0.5 ms), documented in `docs/dev/ENVIRONMENT.md`. - `GuestContentSearch.cpp` and `GuestNpWebApi2.cpp`: include `<initializer_list>`. On macOS, `main` still fails 13 objects with this PR, each in a file another open macOS PR changes: `GuestAllocations.cpp` ([branch](https://github.com/iamthehimansh/AnyPS5/tree/fix/macos-guest-allocations-dyld)), `DirectMemory.cpp` (#7631), `Thread.cpp` and `Process.cpp` (#7804), `Exception.cpp` and `GuestRaiseException.cpp` (#4630), and `NativeStat.cpp`, `SharedMemory.cpp`, `Stdio.cpp`, `DynamicLoader.cpp`, `ModuleInfo.cpp` and `Rtld.cpp` (#7201). With `BUILD_TESTING=ON`, `libSceAgcDriver` also fails in `Driver/Lifecycle.cpp` (`MAP_FIXED_NOREPLACE`), `Execution/src/GuestMemory.cpp` (`link.h`), `GuestBufferMemory.cpp` (`linux/udmabuf.h`) and `Texture.cpp` (`is_trivially_copyable` on a `std::shared_ptr`). Those fixes were in #8658 and come in the AGC driver part of the split, since they need the driver memory and dma-buf changes there. ### Tested macOS 26 on an Apple M2 Pro, x86_64 under Rosetta 2, Release with Ninja, on `main` at `a23f8fc9f`. The library build's remaining failures are the 13 objects above. For Linux and Windows, I checked each changed file's view under `unifdef -U__APPLE__`, with `-D__linux__` and with `-D_WIN32`: it equals `main`. `python3 tools/check_conventions.py --base origin/main` passes. ### Checklist - [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) - [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 ([Cana](https://cana.build))
MarcZX10 commented 2026-10-23 23:39:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T23:39:27Z.

Review: APPROVED


Reviewed the current diff and hosted checks. The macOS-only branches address the reported SDK/compiler failures, the Linux/Windows paths remain unchanged, and the author reports a focused Apple Silicon build plus Rosetta x86_64 compile. Hosted conventions, eligibility, intake, labels, register-context, and write-watch checks pass; Linux and Windows product jobs were skipped by the repository path policy. I found no blocking issue.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5635548499 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10419#pullrequestreview-5635548499). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T23:39:27Z. **Review:** APPROVED --- Reviewed the current diff and hosted checks. The macOS-only branches address the reported SDK/compiler failures, the Linux/Windows paths remain unchanged, and the author reports a focused Apple Silicon build plus Rosetta x86_64 compile. Hosted conventions, eligibility, intake, labels, register-context, and write-watch checks pass; Linux and Windows product jobs were skipped by the repository path policy. I found no blocking issue.
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!10419
No description provided.