libc: ftrylockfile is absent (Porpoise, RetroArch); fix branch ready #3548
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 screamm on 2026-10-11T13:00:49Z.
libc (libSceLibcInternal) does not export
ftrylockfile(NIDh05OHOMZNMw) whileflockfile/funlockfileare merged (#3081). From the relink registry order it is the predicted next stop of Porpoise (PPSA99764, call site 0x8EC37) after its currentpathconfstop, and RetroArch (PPSA99169, 0xA4A27) imports it; not yet observed in a run.Fix branch ready:
screamm:feat/libc-ftrylockfile(f54d933b, one commit onmaina11c8f7f). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commit as is.ftrylockfile(FILE*)inRuntimeSupport.cpptries the same per-stream lockflockfileand every locking stdio call take (no second lock): 0 when acquired or already held by the caller (counted, so matchingfunlockfilecalls are needed), -1 when another thread holds it, as FreeBSD 11.4_flock_stub.c(8c639945); Linux uses glibc'sftrylockfile; Windows has no try variant of_lock_file, so it callsTryEnterCriticalSectionon the lock object_lock_fileenters, located through the UCRT stream layout (__crt_stdio_stream_data::_lock, identical in Windows SDK 10.0.19041, 10.0.22621 and 10.0.26100 sources). Null and closed streams throw. TechnicalDebt records what the lock protects and the UCRT layout dependency; the test would catch a layout change.guest_standard_streamsgains trylock on an unlocked stream and re-entrant by the owner, -1 from another thread while held and after one of two unlocks, anfputcfrom another thread blocking until the last unlock, -1 whileflockfileholds it, and the null/closed throws; a deliberately broken trylock makes it abort.Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release,
BUILD_TESTING=ON, full build includinglibs:guest_standard_streams3/3;ctest -j8 -E "^agc_driver_|^video_out_flip"532/536, the failures being the knownwindows_exceptions(#3411),guest_kernel_sys(symlink: Function not implemented, #3491/#3510),guest_filesystem(directory time, #3518) and oneagc_driverheap-corruption flake; withmain'sRuntimeSupport.cppthe extended test fails;tools/check_conventions.py --base mainandgit diff --checkpass. Not run on Linux.Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T14:01:56Z.
Independent verification on Linux (the gap noted in the report): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON.main— no rebase needed, the commit (f54d933bd) is unchanged.tools/check_conventions.py --base origin/mainandgit diff --checkpass.The branch is also mirrored at
blawesom:verify/3548for anyone carrying.