bytecodealliance / bytecodealliance/cap-std

Support for renameat2?

Offen
#406 1 Kommentar 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
821
Forks
57
Ø Merge
1 Std. 16 Min.
Gemergte PRs (30 T.)
4

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.