mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-09 13:00:27 +02:00
We shouldn't use O_EXCL, since we need to overwrite previous entry PIDs if they happen to exist. The kernel ensures that PIDs don't overlap, but in some kernel configurations PIDs are aggressively reused, resulting in O_EXCL quickly hitting an issue when writing stale files. Additionally O_DIRECT, this doesn't allow us to write to files, so all write functions were failing. Additionally use O_APPEND, we are only ever appending, so let the kernel know. Additionally use O_TRUNC, in the case that a stale perf file exists, this will immediately truncate the file to zero.