mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-05 13:20:11 +00:00
Porpoise PPSA99764 stops after pthread_attr_* (#3494) with the predicted `FAIL: unresolved ELF import h05OHOMZNMw from libSceLibcInternal.prx` (idx 311, call site 0x8EC37); RetroArch PPSA99169 imports it at idx 448 (call site 0xA4A27). h05OHOMZNMw is ftrylockfile by tools/nid_names.py and aerolib.csv (zecoxao/sce_symbols 2883963a); ps5-payload-dev/sdk f5d40f02 declares `int ftrylockfile(FILE *)` in include/freebsd/stdio.h. ftrylockfile tries the same host CRT stream lock that flockfile, funlockfile and every locking host stdio call on the stream take, so no second lock exists beside the one stdio uses. It returns 0 when the lock is acquired or already owned by the caller (recursive, released by as many funlockfile calls) and -1 when another thread holds it, as FreeBSD 8c639945 lib/libc/stdio/_flock_stub.c:89-104 does. Linux calls glibc ftrylockfile. UCRT has no try variant of _lock_file, so Windows calls TryEnterCriticalSection on the CRITICAL_SECTION that _lock_file enters (__crt_stdio_stream_data::_lock, ucrt/inc/corecrt_internal_stdio.h, same layout in Windows SDK 10.0.19041, 10.0.22621 and 10.0.26100). A null or closed stream throws. The UCRT layout dependency is recorded in TechnicalDebt. guest_standard_streams covers trylock on an unlocked stream, re-entry by the owner, failure from another thread while held (also after one of two unlocks and while another thread holds flockfile), stdio calls from another thread blocking on the trylock-held lock, release order, and null and closed streams. Co-Authored-By: Claude Fable 5.1 <[email protected]>