readdir(2) System Calls Manual readdir(2) readdir - C (libc, -lc) #include /* SYS_* */ #include int syscall(SYS_readdir, unsigned int fd, struct old_linux_dirent *dirp, unsigned int count); Note: There is no definition of struct old_linux_dirent; see NOTES. , . readdir(3), C, POSIX. , getdents(2). readdir() old_linux_dirent , fd, , dirp. count ; old_linux_dirent. old_linux_dirent ( Linux fs/readdir.c, ) : struct old_linux_dirent { unsigned long d_ino; /* */ unsigned long d_offset; /* old_linux_dirent */ unsigned short d_namlen; /* d_name */ char d_name[1]; /* ( null ) */ } d_ino is an inode number. d_offset is the distance from the start of the directory to this old_linux_dirent. d_reclen is the size of d_name, not counting the terminating null byte ('\0'). d_name is a null-terminated filename. On success, 1 is returned. On end of directory, 0 is returned. On error, -1 is returned, and errno is set to indicate the error. EBADF fd. EFAULT . EINVAL . ENOENT . ENOTDIR . old_linux_dirent . readdir(3). x86-64. Linux. getdents(2), readdir(3) () aereiae , Azamat Hackimov , Dmitriy S. Seregin , Katrin Kutepova , Lockal , Yuri Kozlov , , Kirill Rekhov ; GNU (GNU General Public License - GPL, 3 ) , - . - , , () () () <>. Linux 6.9.1 15 2024 . readdir(2)