Repository navigation
feat(libc): implement generic error category messages - #5102
Merged
Merged
Conversation
This was referenced Oct 13, 2026
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
|
Collaborator
|
Checked the message table against VC12 |
danielradosa
added a commit
to danielradosa/AnyPS5
that referenced
this pull request
Oct 13, 2026
Error map uses Sony SDK errno numbering (KytyPS5/shadPS4): drop 95/96, add 1040/1050/1051/1056/1064/1074 (76 entries); test scans 1..1100 and expects 76 with 95/96/1062 unknown; debt entry merged by hand and cites the SDK numbering.
10 tasks done
Open
This was referenced Oct 14, 2026
11 tasks done
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
Calling
message()on the generic category stored in a gueststd::system_errorcurrently throwsstd::_Generic_error_category::message not implemented. Return an owned guest string instead, and export the related runtime entry points:std::_Syserror_map(int)—PDX01ziUz+4std::generic_category()—YxwfcCH5Q0Istd::_Generic_error_category::message(int) const—KZ++filsCL4The map covers the 72 distinct Dinkumware errc values present in FreeBSD 11.4's errno header. Unmapped values return null from
_Syserror_mapand produceunknown errorfrom the category. Lookup follows the first matching entry: FreeBSD aliases EAGAIN/EWOULDBLOCK selectoperation would block, and ENOTSUP/EOPNOTSUPP selectnot supported. Use the same lookup for the suffix of_Throw_Cpp_error's message; its EAGAIN case previously assumed both parts were identical.Messages use the existing GuestLocale::String model and the registered guest allocator. The accessor returns the same category object stored by
_Throw_Cpp_error. Enable the existing assembly exception fixture on Linux as well as MinGW.Semantics are based on VC12 system_error, its syserror.cpp, Microsoft STL's table, and FreeBSD 11.4 errno.h.
Tested
Windows, WinLibs MinGW-w64 GCC 15.2.0 r7, Release; WSL2 Ubuntu 26.04, GCC, Release. A focused CMake harness builds the complete libc, libkernel and libSceAmpr targets from this branch.
On the final commit, all six selected CTests pass on both hosts:
guest_generic_category,guest_ampr_cpp_error,guest_errors,guest_collate,guest_new_handler,guest_new_handler_default_heap.The new test checks direct and virtual message calls, the 15-character inline boundary, allocated strings, independent ownership, surrounding sentinels, errno preservation, unknown/extreme values and null-result rejection. The existing exception fixture checks the category attached to the actual guest exception. With the previous StandardExceptions.cpp restored through a separate baseline build source, the updated Windows fixture fails with
std::_Generic_error_category::message not implemented; restoring the change passes.An independent comparison of the source tables and FreeBSD errno assignments matches all 72 map entries. Patching the built Windows libc succeeds, and the PE export table contains all three NIDs above. Conventions and whitespace checks pass.
No console or title run, full top-level graphics build, or performance claim. The 40-byte string model and virtual return ABI are not validated against a console library; this is recorded in TechnicalDebt. A title's inline category in a bundled libc may still have a different object identity. STREAMS errno assignments absent from the FreeBSD header are not invented.
The locally available public DOOM libc was inspected for these symbols, but they point to a shared zero-return stub; it is not used as a semantic or ABI oracle.
Checklist
main; no other open PR implements the same functions