Function sys_getdents64

Source
#[no_mangle]
pub unsafe extern "C" fn sys_getdents64(
    fd: i32,
    dirp: *mut Dirent64,
    count: usize,
) -> i64
Expand description

Read the entries of a directory. Similar as the Linux system-call, this reads up to count bytes and returns the number of bytes written. If the size was not sufficient to list all directory entries, subsequent calls to this fn return the next entries.

Parameters:

  • fd: File Descriptor of the directory in question. -dirp: Memory for the kernel to store the filled Dirent64 objects including the c-strings with the filenames to.
  • count: Size of the memory region described by dirp in bytes.

Return:

The number of bytes read into dirp on success. Zero indicates that no more entries remain and the directories readposition needs to be reset using sys_lseek. Negative numbers encode errors.