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.
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:
getdents_uninitpublic.RawDircould export the value ofinitializedsoRawDir::new(...).next()could be used to fill the buffer once and, with the value ofinitializedthe parsing of the buffer could be delayed for later. But this rely on the first call tonext()to always call the syscall and fill the buffer which is an underlying behavior of the library and not really future proof.With the
Unsizednature oflinux_dirent64I cannot think of any safe implementation, maybe a new getdents method that takes in the rustix'Buffertrait (but then nothing about alignment there).I can implement any of the above approaches.