bytecodealliance / bytecodealliance/cap-std

`create_dir_all` performs a quadradic number of system calls

Đang mở
#51 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
good first issue
Ngôn ngữ chính
Rust
Star
821
Fork
57
Merge trung bình
1 giờ 16 phút
Pull request đã merge (30 ngày)
4

Mô tả

`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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách đọc các triển khai mkdir và open_manually hiện có của cap-primitives, sau đó kiểm tra các routine create_dir_all của cap-std và cap-async-std, những routine này nên sử dụng primitive mới. Công việc hoàn tất khi việc tạo component sử dụng các directory handle, xử lý AlreadyExists và .. bằng một handle stack, và các routine cấp cao hơn ủy quyền cho nó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
rust
Lĩnh vực
operating-systems, security
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
38/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.