refactor(libc): share the guest errno failure return #26274
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/26274"
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 LeandroLP23 on 2026-11-23T15:45:13Z.
What
Eighteen functions in
libkernel,libkernel_sysandlibScePosixForWebKithave the same body: they set the guesterrnothrough__error_nid_postfix()and return -1. They go by six names (Fail,Failure,PosixFailure,SysarchFailure,SchedFailure,_fail).libc/include/GuestErrno.hpp, which declares__error_nid_postfix, gets that body once, asinline int FailWithGuestErrno(int error).SysarchFailureinlibkernel/System/src/Process.cpp,Failinlibkernel_sys/NamedObject.cppandFailureinlibScePosixForWebKit/Filesystem.cpp. Their callers callFailWithGuestErrnowith the same argument.Failinlibkernel/Pthread/Posix/Sem.cppwrites the hosterrno, andFailinlibkernel/System/src/ThermalSensors.cppreturns a kernel error code.29 lines removed and 22 added.
No change in behaviour.
Tested
Windows 11 (10.0.26300), WinLibs GCC 15.2.0 r7, Release.
ctest -R 'kernel|named_?object|resolver_access|guest_posix', with its 132 build outputs fromtools/select_tests.py targets: 178 of 178 onmainc3aec4c2f3and 178 of 178 with this change applied to it.tools/check_conventions.pypasses.tools/pr_overlap.py --branchfinds no overlap with the 2585 open pull requests.Not run: Linux and macOS.
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)Pull request closed