bytecodealliance / bytecodealliance/rustix
access to getdents
- Dominant language
- Rust
- Stars
- 2.1k
- Forks
- 294
- Avg merge
- 4h 7m
- Merged PRs (30d)
- 2
Description
Following the use-case and the failure of #1552 , it would be nice for rustix to export in some way a more direct access to `getdents`. I am just unsure how this would look like.
I see 2 easy possible options:
- make `getdents_uninit` public.
- `RawDir` could export the value of `initialized` so `RawDir::new(...).next()` could be used to fill the buffer once and, with the value of `initialized` the parsing of the buffer could be delayed for later. But this rely on the first call to `next()` to always call the syscall and fill the buffer which is an underlying behavior of the library and not really future proof.
With the `Unsized` nature of `linux_dirent64` I cannot think of any safe implementation, maybe a new getdents method that takes in the rustix' `Buffer` trait (but then nothing about alignment there).
I can implement any of the above approaches.
Contributor guide
Assessment
This issue has not been assessed yet.