3 ms·
> - atomic file create with content No FS guarantees this. You can emulate this by writing to a tmp location, syncing and performing a move.
by blattimwind 7y ago
> - atomic file create with content
No FS guarantees this. You can emulate this by writing to a tmp location, syncing and performing a move.
- gizmo686 7y agoWhen you use rename to overwrite a file, it guarentees that at any point in time, newpath will refer to either the original file, or the new file. This is atomic enough to give you effectivly atomic file creation with contents. It is not technically atomic, because there is a period where oldpath and newpath both refer to the same file, but I don't think that is an issue for this usecase.
- manwe150 7y agoLinux has the O_TMPFILE flag to open, for which this is one of the use cases described in the man page. I can’t say about “guaranteed” though. I assume Microsoft Transactional NTFS (TxF) also had (or has) this capability—but deprecated.
- blattimwind 7y agoTxF is a corner stone of Windows Update, I can't really imagine them removing it. I always assumed they marked it deprecated to avoid supporting it towards customers.