1 .\" Copyright (C) 1995 Andries Brouwer (aeb@cwi.nl)
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" Written 11 June 1995 by Andries Brouwer <aeb@cwi.nl>
24 .\" Modified 22 July 1995 by Michael Chastain <mec@duracef.shout.net>:
25 .\" In 1.3.X, returns only one entry each time; return value is different.
26 .\" Modified 2004-12-01, mtk, fixed headers listed in SYNOPSIS
28 .TH READDIR 2 2008-10-02 "Linux" "Linux Programmer's Manual"
30 readdir \- read directory entry
34 .BI "int readdir(unsigned int " fd ", struct old_linux_dirent *" dirp ","
35 .BI " unsigned int " count );
38 This is not the function you are interested in.
41 for the POSIX conforming C library interface.
42 This page documents the bare kernel system call interface,
43 which is superseded by
49 structure from the directory
50 referred to by the file descriptor
52 into the buffer pointed to by
56 is ignored; at most one
62 structure is declared as follows:
66 struct old_linux_dirent {
67 long d_ino; /* inode number */
68 off_t d_off; /* offset to this \fIold_linux_dirent\fP */
69 unsigned short d_reclen; /* length of this \fId_name\fP */
70 char d_name[NAME_MAX+1]; /* filename (null-terminated) */
78 is the distance from the start of the directory to this
79 .IR old_linux_dirent .
83 not counting the terminating null byte.
85 is a null-terminated filename.
87 On success, 1 is returned.
88 On end of directory, 0 is returned.
89 On error, \-1 is returned, and
95 Invalid file descriptor
99 Argument points outside the calling process's address space.
102 Result buffer is too small.
108 File descriptor does not refer to a directory.
110 This system call is Linux-specific.
112 Glibc does not provide a wrapper for this system call; call it using
114 You will need to define the