READDIR_R(3) | Linux Programmer's Manual | READDIR_R(3) |
readdir_r - read a directory
#include <dirent.h>
int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
readdir_r():
This function is deprecated; use readdir(3) instead.
The readdir_r() function was invented as a reentrant version of readdir(3). It reads the next directory entry from the directory stream dirp, and returns it in the caller-allocated buffer pointed to by entry. For details of the dirent structure, see readdir(3).
A pointer to the returned buffer is placed in *result; if the end of the directory stream was encountered, then NULL is instead returned in *result.
It is recommended that applications use readdir(3) instead of readdir_r(). Furthermore, since version 2.24, glibc deprecates readdir_r(). The reasons are as follows:
The readdir_r() function returns 0 on success. On error, it returns a positive error number (listed under ERRORS). If the end of the directory stream is reached, readdir_r() returns 0, and returns NULL in *result.
For an explanation of the terms used in this section, see attributes(7).
Interface | Attribute | Value |
readdir_r () | Thread safety | MT-Safe |
POSIX.1-2001, POSIX.1-2008.
This page is part of release 4.16 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
2016-03-01 |