bytecodealliance / bytecodealliance/cap-std
Support for renameat2?
- 主要语言
- Rust
- 星标
- 821
- 派生
- 57
- 平均合并
- 1 小时 16 分钟
- 30 天内合并 PR
- 4
描述
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.
贡献指南
调研方向
先从 cap-std 的 Dir::rename 和 rustix::fs::renameat_with 开始,然后比较文件系统操作在受支持平台上的公开方式。阅读 cap-std-ext 的原子写入实现,以了解 RENAME_NOREPLACE 的使用场景。在可用的平台上支持 renameat2 风格的标志,并且原子创建能够避免覆盖已有文件,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- rust
- 领域
- operating-systems
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 55/100