pub unsafe fn fd_readdir(
    fd: Fd,
    buf: *mut u8,
    buf_len: Size,
    cookie: Dircookie
) -> Result<Size, Errno>
Expand description

Read directory entries from a directory. When successful, the contents of the output buffer consist of a sequence of directory entries. Each directory entry consists of a dirent object, followed by dirent::d_namlen bytes holding the name of the directory entry. This function fills the output buffer as much as possible, potentially truncating the last directory entry. This allows the caller to grow its read buffer size in case it’s too small to fit a single large directory entry, or skip the oversized directory entry.

Parameters

  • buf - The buffer where directory entries are stored
  • cookie - The location within the directory to start reading

Return

The number of bytes stored in the read buffer. If less than the size of the read buffer, the end of the directory has been reached.