bytecodealliance / bytecodealliance/cap-std

`create_dir_all` performs a quadradic number of system calls

未关闭
#51 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
good first issue
主要语言
Rust
星标
821
派生
57
平均合并
1 小时 16 分钟
30 天内合并 PR
4

描述

`create_dir_all` uses the algorithm from `libstd` for recursively creating all components. However, `cap-primitives`' `mkdir` function performs a system call per path component per call, so calling it once per path component leads to a quadratic number of system calls.

We should add a `create_dir_all` function in `cap-primitives` which, for each path component, creates a directory for that component (ignoring a `io::ErrorKind::AlreadyExists` error), opens the newly created directory, and then uses the resulting handle as the base for handling the next component.

Similar to `open_manually`, it should handle `..` components by keeping a stack of handles as it goes, so that it can simply pop an entry from that stack to ascend to the parent.

And then, the `cap-std` and `cap-async-std` `create_dir_all` routines can use it.

贡献指南

打开贡献指南

调研方向

首先阅读现有的 cap-primitives mkdir 和 open_manually 实现,然后检查 cap-std 和 cap-async-std 中应该使用新 primitive 的 create_dir_all 例程。当组件创建使用目录句柄,通过句柄栈处理 AlreadyExists 和 ..,并且更高层的例程委托给它时,工作就完成了。

由索引模型根据 Issue 内容生成。

评估

技术栈
rust
领域
operating-systems, security
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。