]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (C) 1995 Andries Brouwer (aeb@cwi.nl) |
2 | .\" | |
93015253 | 3 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
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. | |
7 | .\" | |
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. | |
c13182ef | 12 | .\" |
fea681da MK |
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 | |
19 | .\" professionally. | |
c13182ef | 20 | .\" |
fea681da MK |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
fea681da MK |
24 | .\" |
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. | |
b4c0e1cb MK |
28 | .\" Modified 2004-12-01, mtk, fixed headers listed in SYNOPSIS |
29 | .\" | |
f9293d98 | 30 | .TH READDIR 2 2013-06-21 "Linux" "Linux Programmer's Manual" |
fea681da MK |
31 | .SH NAME |
32 | readdir \- read directory entry | |
33 | .SH SYNOPSIS | |
34 | .nf | |
fea681da | 35 | .sp |
b82f860a | 36 | .BI "int readdir(unsigned int " fd ", struct old_linux_dirent *" dirp "," |
93e4c37f | 37 | .BI " unsigned int " count ); |
fea681da | 38 | .fi |
45c99e3e MK |
39 | |
40 | .IR Note : | |
41 | There is no glibc wrapper for this system call; see NOTES. | |
fea681da MK |
42 | .SH DESCRIPTION |
43 | This is not the function you are interested in. | |
44 | Look at | |
45 | .BR readdir (3) | |
46 | for the POSIX conforming C library interface. | |
47 | This page documents the bare kernel system call interface, | |
f8c4a808 | 48 | which is superseded by |
fea681da MK |
49 | .BR getdents (2). |
50 | .PP | |
e511ffb6 | 51 | .BR readdir () |
fea681da | 52 | reads one |
b82f860a | 53 | .I old_linux_dirent |
fea681da | 54 | structure from the directory |
602995ec | 55 | referred to by the file descriptor |
fea681da | 56 | .I fd |
602995ec | 57 | into the buffer pointed to by |
fea681da | 58 | .IR dirp . |
c4bb193f | 59 | The argument |
fea681da | 60 | .I count |
d3c8f8e2 | 61 | is ignored; at most one |
b82f860a | 62 | .I old_linux_dirent |
d3c8f8e2 | 63 | structure is read. |
fea681da MK |
64 | .PP |
65 | The | |
b82f860a | 66 | .I old_linux_dirent |
fea681da MK |
67 | structure is declared as follows: |
68 | .PP | |
088a639b | 69 | .in +4n |
fea681da | 70 | .nf |
b82f860a | 71 | struct old_linux_dirent { |
8c1e7c9c MK |
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) */ | |
fea681da MK |
76 | } |
77 | .fi | |
a08ea57c | 78 | .in |
fea681da MK |
79 | .PP |
80 | .I d_ino | |
81 | is an inode number. | |
82 | .I d_off | |
83 | is the distance from the start of the directory to this | |
b82f860a | 84 | .IR old_linux_dirent . |
fea681da MK |
85 | .I d_reclen |
86 | is the size of | |
a5e0a0e4 | 87 | .IR d_name , |
f24e3a3a | 88 | not counting the terminating null byte (\(aq\\0\(aq). |
fea681da | 89 | .I d_name |
2c5f1089 | 90 | is a null-terminated filename. |
47297adb | 91 | .SH RETURN VALUE |
fea681da MK |
92 | On success, 1 is returned. |
93 | On end of directory, 0 is returned. | |
94 | On error, \-1 is returned, and | |
95 | .I errno | |
96 | is set appropriately. | |
97 | .SH ERRORS | |
98 | .TP | |
99 | .B EBADF | |
100 | Invalid file descriptor | |
101 | .IR fd . | |
102 | .TP | |
103 | .B EFAULT | |
104 | Argument points outside the calling process's address space. | |
105 | .TP | |
106 | .B EINVAL | |
107 | Result buffer is too small. | |
108 | .TP | |
109 | .B ENOENT | |
110 | No such directory. | |
111 | .TP | |
112 | .B ENOTDIR | |
113 | File descriptor does not refer to a directory. | |
47297adb | 114 | .SH CONFORMING TO |
8382f16d | 115 | This system call is Linux-specific. |
c12fd10d MK |
116 | .SH NOTES |
117 | Glibc does not provide a wrapper for this system call; call it using | |
118 | .BR syscall (2). | |
1dfd87ee MK |
119 | You will need to define the |
120 | .I old_linux_dirent | |
121 | structure yourself. | |
45c99e3e MK |
122 | However, probably you should use |
123 | .BR readdir (3) | |
124 | instead. | |
d80cadc1 MK |
125 | |
126 | This system call does not exist on x86-64. | |
47297adb | 127 | .SH SEE ALSO |
fea681da MK |
128 | .BR getdents (2), |
129 | .BR readdir (3) |