Skip to content

access to getdents #1554

@gmorer

Description

@gmorer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions