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

NAME

6       readdir - read directory entry
7

SYNOPSIS

9       #include <linux/types.h>
10       #include <linux/dirent.h>
11       #include <linux/unistd.h>
12       #include <errno.h>
13
14       _syscall3(int, readdir, unsigned int, fd, struct dirent *, dirp,
15                 unsigned int, count)
16                 /* Using syscall(2) may be preferable; see intro(2) */
17
18       int readdir(unsigned int fd, struct dirent *dirp,
19                   unsigned int count);
20

DESCRIPTION

22       This is not the function you are interested in.  Look at readdir(3) for
23       the POSIX conforming C library interface.  This page documents the bare
24       kernel system call interface, which can change, and which is superseded
25       by getdents(2).
26
27       readdir() reads one dirent structure from the directory pointed  at  by
28       fd  into  the  memory  area pointed to by dirp.  The parameter count is
29       ignored; at most one dirent structure is read.
30
31       The dirent structure is declared as follows:
32
33              struct dirent
34              {
35                  long d_ino;                 /* inode number */
36                  off_t d_off;                /* offset to this dirent */
37                  unsigned short d_reclen;    /* length of this d_name */
38                  char d_name [NAME_MAX+1];   /* filename (null-terminated) */
39              }
40
41       d_ino is an inode number.  d_off is the distance from the start of  the
42       directory to this dirent.  d_reclen is the size of d_name, not counting
43       the null terminator.  d_name is a null-terminated filename.
44

RETURN VALUE

46       On success, 1 is returned.  On end of directory,  0  is  returned.   On
47       error, -1 is returned, and errno is set appropriately.
48

ERRORS

50       EBADF  Invalid file descriptor fd.
51
52       EFAULT Argument points outside the calling process's address space.
53
54       EINVAL Result buffer is too small.
55
56       ENOENT No such directory.
57
58       ENOTDIR
59              File descriptor does not refer to a directory.
60

CONFORMING TO

62       This system call is Linux specific.
63

SEE ALSO

65       getdents(2), readdir(3)
66
67
68
69Linux 1.3.6                       1995-07-22                        READDIR(2)
Impressum