sys_getdents  [fs/readdir.c]


Gets directory entries.

Arguments

eax 141
ebx File descriptor.
ecx Pointer to an array which will receive a number of variable length dirent structures:
struc dirent
{
.d_ino    rd 1
.d_off    rd 1
.d_reclen rw 1
.d_name   rb 256 ; see below!
}

rtentry members:

d_ino
inode number.
d_off
Zero based index of the next dirent structure in the array.
d_reclen
Size of this dirent structure.
d_name
Null-terminated directory name. This member is actually has a variable size, but cannot exceed NAME_MAX+1 (256) bytes.
edx Size of the array pointed by ecx.

Return values

If the system call succeeds the return value is number of bytes read. If directory end is reached, 0 is returned.
If the system call fails the return value is one of the following errno values:

-EBADF Invalid file descriptor.
-ENOTDIR File descriptor does not refer to a directory.
-ENOENT No such directory.
-EINVAL Result buffer is too small.
-EFAULT Argument points outside the calling process's address space.

Remarks

See /samples/basic/getdir.asm for an example.

Compatibility

n/a