bytecodealliance / bytecodealliance/cap-std
Support for renameat2?
- Dominant language
- Rust
- Stars
- 821
- Forks
- 57
- Avg merge
- 1h 16m
- Merged PRs (30d)
- 4
Description
On Linux, `cap-std` implements `Dir::rename` via `rustix::fs::renameat`, which is the `renameat` function.
Since Linux 3.15, there is another version of this call, `renameat2`, which supports an additional `flags` argument. `rustix` already supports this function as `rustix::fs::renameat_with`.
Could `cap-std` add support for this function as well?
## Additional Context
The external `cap-std-ext` crate implements atomic writes by writing a temporary file and renaming it in place. However, it is not possible to atomically create a file in this way.
`renameat2` supports the `RENAME_NOREPLACE` flag, which ensures that no existing file is overwritten by the rename. As such, an `atomic_create` could be implemented based on this change.
Contributor guide
Assessment
This issue has not been assessed yet.