The fd_readdir()
function reads directory entries from a directory identified by the provided file descriptor (fd
). It stores the directory entries in the buffer specified by buf
and returns the number of bytes stored in the buffer via the bufused
pointer.
Note
The fd_readdir()
function reads directory entries from a directory identified by the file descriptor fd
. It takes the file descriptor, a buffer where the directory entries will be stored, the length of the buffer in bytes, the directory cookie indicating the position to start reading from, and a pointer to store the number of bytes stored in the buffer.
The function reads the directory entries and stores them in the buffer according to the specified format. The bufused
pointer will be updated with the number of bytes stored in the buffer. If the entire directory has been read and there is no more data to read, the function will indicate this by storing a value less than buf_len
in bufused
.
The function returns an Errno
value to indicate the success or failure of the operation. If the directory entries are successfully read and stored in the buffer, it returns Errno::Success
. Otherwise, it returns an appropriate error code.