feat(libc): implement ftrylockfile #3564
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3564"
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 Aathish-D on 2026-10-11T13:16:53Z.
What
Implement
ftrylockfile(NIDh05OHOMZNMw) inlibc. Resolves #3548.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).
ftrylockfiletries the same host CRT stream lock thatflockfile,funlockfileand every locking host stdio call on the stream take. It returns0when acquired or already owned by the caller, and-1when another thread holds it, following FreeBSD 11.4_flock_stub.c(8c639945). Linux calls glibcftrylockfile; Windows callsTryEnterCriticalSectionon the UCRT stream lock (__crt_stdio_stream_data::_lock). Null or closed streams throw. Recorded inTechnicalDebt.md.Carried from @screamm's branch referenced in #3548.
Tested
Linux (x86_64, GCC 15, Ninja, Release), full build with
libs:ctest --test-dir build -R "^guest_standard_streams$" --output-on-failurepassed (0.16 s)python3 tools/check_conventions.py --base upstream/mainpassedpython3 tools/check_test_registration.py buildpassed (647 tests registered)readelf -s build/core/libs/libs/libc.prxexportsh05OHOMZNMwChecklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T13:29:08Z.
Progress report (
a11c8f7→9c7aa0d)📈 System libraries: 85.82% (+0.01%, +1 implemented functions)
✅ 1 implemented
ftrylockfile_nid_postfixImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T21:33:57Z.
Checked build and ctest on Linux (
guest_standard_streamspasses, and fails to link without the change),ftrylockfilesemantics against FreeBSD_flock_stub.c, TechnicalDebt entry, no overlap with #3527/#3412; merging.