Windows: flock does not follow BSD semantics; LOCK_UN without a lock aborts the process #1754
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 Zurisen on 2026-10-08T18:33:40Z.
On main (
17350cf5),flock_nid_postfixon Windows maps each call ontoLockFileEx/UnlockFileExover the whole file (Stdio.cpp). Windows byte-range locks stack per handle and are not converted, so the result differs from FreeBSDflock(2), where a descriptor holds at most one lock that a later call converts or releases. Linux calls the hostflockand already behaves like FreeBSD. Not specific to one title.LOCK_UNwithout a lockUnlockFileExfails withERROR_NOT_LOCKED(158);flock_nid_postfixthrows and the process abortsLOCK_EX,LOCK_EXLOCK_NB, fails withERROR_LOCK_VIOLATION(33) and throwsLOCK_SH,LOCK_EX | LOCK_NBLOCK_SH,LOCK_SH,LOCK_UNLOCK_EXMeasured on Windows 11 (10.0.26200), MinGW-w64 GCC 15.2.0, with
guest_filesystem_tests:Also: when
_get_osfhandlefails,errnois not set.Fixed in #1755.