bytecodealliance / bytecodealliance/cap-std
Support for renameat2?
- Lingua principale
- Rust
- Stelle
- 821
- Fork
- 57
- Merge medio
- 1h 16m
- PR unite (30g)
- 4
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Start with cap-std's Dir::rename and rustix::fs::renameat_with, then compare how filesystem operations are exposed across supported platforms. Read cap-std-ext's atomic-write implementation to understand the RENAME_NOREPLACE use case. Done means renameat2-style flags are supported where available and atomic creation can avoid overwriting an existing file.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- rust
- Ambito
- operating-systems
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 55/100