Skip to main content

sys_posix_getdents

Function sys_posix_getdents 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn sys_posix_getdents( fd: i32, buf: *mut PosixDent, nbyte: usize, flags: i32, ) -> isize
Expand description

Read the entries of a directory as defined by POSIX.1-2024, posix_getdents.

This reads up to nbyte bytes of PosixDent entries into buf 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.
  • buf: Memory for the kernel to store the filled PosixDent objects including the c-strings with the filenames to.
  • nbyte: Size of the memory region described by buf in bytes.
  • flags: Must be zero; no flags are supported yet.

Return:

The number of bytes read into buf on success. Zero indicates that the end of the directory was reached. Negative numbers encode errors.