1 .\" Copyright (C) 1995 Andries Brouwer (aeb@cwi.nl)
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" Written 11 June 1995 by Andries Brouwer <aeb@cwi.nl>
26 .\" Modified 22 July 1995 by Michael Chastain <mec@duracef.shout.net>:
27 .\" In 1.3.X, returns only one entry each time; return value is different.
28 .\" Modified 2004-12-01, mtk, fixed headers listed in SYNOPSIS
30 .TH READDIR 2 2012-07-13 "Linux" "Linux Programmer's Manual"
32 readdir \- read directory entry
36 .BI "int readdir(unsigned int " fd ", struct old_linux_dirent *" dirp ","
37 .BI " unsigned int " count );
41 There is no glibc wrapper for this system call; see NOTES.
43 This is not the function you are interested in.
46 for the POSIX conforming C library interface.
47 This page documents the bare kernel system call interface,
48 which is superseded by
54 structure from the directory
55 referred to by the file descriptor
57 into the buffer pointed to by
61 is ignored; at most one
67 structure is declared as follows:
71 struct old_linux_dirent {
72 long d_ino; /* inode number */
73 off_t d_off; /* offset to this \fIold_linux_dirent\fP */
74 unsigned short d_reclen; /* length of this \fId_name\fP */
75 char d_name[NAME_MAX+1]; /* filename (null-terminated) */
83 is the distance from the start of the directory to this
84 .IR old_linux_dirent .
88 not counting the terminating null byte.
90 is a null-terminated filename.
92 On success, 1 is returned.
93 On end of directory, 0 is returned.
94 On error, \-1 is returned, and
100 Invalid file descriptor
104 Argument points outside the calling process's address space.
107 Result buffer is too small.
113 File descriptor does not refer to a directory.
115 This system call is Linux-specific.
117 Glibc does not provide a wrapper for this system call; call it using
119 You will need to define the
122 However, probably you should use