|
25 | 25 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
26 | 26 | .\" SUCH DAMAGE. |
27 | 27 | .\" |
28 | | -.Dd August 1, 2020 |
| 28 | +.Dd September 5, 2025 |
29 | 29 | .Dt DIRECTORY 3 |
30 | 30 | .Os |
31 | 31 | .Sh NAME |
32 | 32 | .Nm opendir , |
33 | 33 | .Nm fdopendir , |
34 | 34 | .Nm readdir , |
35 | | -.Nm readdir_r , |
36 | 35 | .Nm telldir , |
37 | 36 | .Nm seekdir , |
38 | 37 | .Nm rewinddir , |
|
50 | 49 | .Fn fdopendir "int fd" |
51 | 50 | .Ft struct dirent * |
52 | 51 | .Fn readdir "DIR *dirp" |
53 | | -.Ft int |
54 | | -.Fn readdir_r "DIR *dirp" "struct dirent *entry" "struct dirent **result" |
55 | 52 | .Ft long |
56 | 53 | .Fn telldir "DIR *dirp" |
57 | 54 | .Ft void |
|
65 | 62 | .Ft int |
66 | 63 | .Fn dirfd "DIR *dirp" |
67 | 64 | .Sh DESCRIPTION |
68 | | -.Bf -symbolic |
69 | | -The |
70 | | -.Fn readdir_r |
71 | | -interface is deprecated |
72 | | -because it cannot be used correctly unless |
73 | | -.Brq Va NAME_MAX |
74 | | -is a fixed value. |
75 | | -.Ef |
76 | | -.Pp |
77 | 65 | The |
78 | 66 | .Fn opendir |
79 | 67 | function |
@@ -112,7 +100,6 @@ or to modify the state of the associated description other than by means |
112 | 100 | of |
113 | 101 | .Fn closedir , |
114 | 102 | .Fn readdir , |
115 | | -.Fn readdir_r , |
116 | 103 | or |
117 | 104 | .Fn rewinddir , |
118 | 105 | the behavior is undefined. |
@@ -144,34 +131,6 @@ may be set to any of the values documented for the |
144 | 131 | system call. |
145 | 132 | .Pp |
146 | 133 | The |
147 | | -.Fn readdir_r |
148 | | -function |
149 | | -provides the same functionality as |
150 | | -.Fn readdir , |
151 | | -but the caller must provide a directory |
152 | | -.Fa entry |
153 | | -buffer to store the results in. |
154 | | -The buffer must be large enough for a |
155 | | -.Vt struct dirent |
156 | | -with a |
157 | | -.Va d_name |
158 | | -array with |
159 | | -.Brq Va NAME_MAX |
160 | | -+ 1 elements. |
161 | | -If the read succeeds, |
162 | | -.Fa result |
163 | | -is pointed at the |
164 | | -.Fa entry ; |
165 | | -upon reaching the end of the directory |
166 | | -.Fa result |
167 | | -is set to |
168 | | -.Dv NULL . |
169 | | -The |
170 | | -.Fn readdir_r |
171 | | -function |
172 | | -returns 0 on success or an error number to indicate failure. |
173 | | -.Pp |
174 | | -The |
175 | 134 | .Fn telldir |
176 | 135 | function |
177 | 136 | returns a token representing the current location associated with the named |
@@ -305,9 +264,7 @@ is not associated with a directory. |
305 | 264 | .Pp |
306 | 265 | The |
307 | 266 | .Fn readdir |
308 | | -and |
309 | | -.Fn readdir_r |
310 | | -functions may also fail and set |
| 267 | +function may also fail and set |
311 | 268 | .Va errno |
312 | 269 | for any of the errors specified for the routine |
313 | 270 | .Xr getdents 2 . |
|
338 | 295 | .Fn fdopendir , |
339 | 296 | .Fn opendir , |
340 | 297 | .Fn readdir , |
341 | | -.Fn readdir_r , |
342 | 298 | .Fn rewinddir , |
343 | 299 | .Fn seekdir |
344 | 300 | and |
@@ -391,7 +347,8 @@ will always set the correct location to return the same value as that last |
391 | 347 | .Fn readdir |
392 | 348 | performed. |
393 | 349 | This is enough for some applications which want to |
394 | | -"push back the last entry read", e.g., Samba. |
| 350 | +.Dq push back the last entry read , |
| 351 | +e.g. Samba. |
395 | 352 | Seeks back to any other location, |
396 | 353 | other than the beginning of the directory, |
397 | 354 | may result in unexpected behaviour if deletes are present. |
|
0 commit comments