1READDIR(2)                 Linux Programmer's Manual                READDIR(2)
2
3
4

NAME

6       readdir - read directory entry
7

SYNOPSIS

9       int readdir(unsigned int fd, struct old_linux_dirent *dirp,
10                   unsigned int count);
11
12       Note: There is no glibc wrapper for this system call; see NOTES.
13

DESCRIPTION

15       This is not the function you are interested in.  Look at readdir(3) for
16       the POSIX conforming C library interface.  This page documents the bare
17       kernel system call interface, which is superseded by getdents(2).
18
19       readdir()  reads  one  old_linux_dirent  structure  from  the directory
20       referred to by the file descriptor fd into the  buffer  pointed  to  by
21       dirp.   The  argument  count  is  ignored; at most one old_linux_dirent
22       structure is read.
23
24       The old_linux_dirent structure is declared (privately in  Linux  kernel
25       file fs/readdir.c) as follows:
26
27           struct old_linux_dirent {
28               unsigned long d_ino;     /* inode number */
29               unsigned long d_offset;  /* offset to this old_linux_dirent */
30               unsigned short d_namlen; /* length of this d_name */
31               char  d_name[1];         /* filename (null-terminated) */
32           }
33
34       d_ino  is  an inode number.  d_offset is the distance from the start of
35       the directory to  this  old_linux_dirent.   d_reclen  is  the  size  of
36       d_name,  not  counting  the  terminating null byte ('\0').  d_name is a
37       null-terminated filename.
38

RETURN VALUE

40       On success, 1 is returned.  On end of directory,  0  is  returned.   On
41       error, -1 is returned, and errno is set appropriately.
42

ERRORS

44       EBADF  Invalid file descriptor fd.
45
46       EFAULT Argument points outside the calling process's address space.
47
48       EINVAL Result buffer is too small.
49
50       ENOENT No such directory.
51
52       ENOTDIR
53              File descriptor does not refer to a directory.
54

CONFORMING TO

56       This system call is Linux-specific.
57

NOTES

59       Glibc  does  not  provide a wrapper for this system call; call it using
60       syscall(2).  You will need to  define  the  old_linux_dirent  structure
61       yourself.  However, probably you should use readdir(3) instead.
62
63       This system call does not exist on x86-64.
64

SEE ALSO

66       getdents(2), readdir(3)
67

COLOPHON

69       This  page  is  part of release 5.02 of the Linux man-pages project.  A
70       description of the project, information about reporting bugs,  and  the
71       latest     version     of     this    page,    can    be    found    at
72       https://www.kernel.org/doc/man-pages/.
73
74
75
76Linux                             2019-03-06                        READDIR(2)
Impressum