readdir(2) System Calls Manual readdir(2) readdir - (libc -lc) #include /* SYS_* */ #include int syscall(SYS_readdir, unsigned int fd, struct old_linux_dirent *dirp, unsigned int count); : struct old_linux_dirent . . readdir(3) C POSIX. getdents(2). readdir() old_linux_dirent fd dirp. count old_linux_dirent . old_linux_dirent ( fs/readdir.c) : struct old_linux_dirent { unsigned long d_ino; /* inode number */ unsigned long d_offset; /* offset to this old_linux_dirent */ unsigned short d_namlen; /* length of this d_name */ char d_name[1]; /* filename (null-terminated) */ } d_ino inode. d_offset old_linux_dirent. d_reclen d_name ('\0'). d_name . 1. 0. -1 errno . EBADF (file descriptor) fd. EFAULT (arguments) . EINVAL . ENOENT . ENOTDIR . old_linux_dirent . readdir(3) . x86-64. . getdents(2), readdir(3) 3 . . : . 6.18 8 2026 readdir(2)