readdir_r(3) readdir_r(3)
NAME
readdirr - thread-safe read directory
SYNOPSIS
#include <sys/types.h>
#include <dirent.h>
int readdirr(DIR *dirp, struct dirent *entry,
struct dirent **result);
DESCRIPTION
The readdirr() is the tread-safe version of the readdir() function.
The readdirr() function initialises the dirent structure referenced
by entry to represent the directory entry at the current position in
the directory stream referred to by dirp, store a pointer to this
structure at the location referenced by result, and positions the
directory stream at the next entry.
The storage pointed to by entry will be large enough for a dirent with
an array of char dname member containing at least NAMEMAX plus one
elements.
On successful return, the pointer returned at result will have the
same value as the argument entry. Upon reaching the end of the direc-
tory stream, this pointer will have the value NULL.
The readdirr() function will not return directory entries containing
empty names. It is unspecified whether entries are returned for dot or
dot-dot.
If a file is removed from or added to the directory after the most
recent call to opendir() or rewinddir(), whether a subsequent call to
readdirr() returns an entry to that file is unspecified.
The readdirr() function may buffer several directory entries per
actual read operation; the readdirr() function marks for update the
statime field of the directory each time the directory is actually
read.
RETURN VALUE
If successful, the readdirr() function returns zero. Otherwise, an
error number is returned to indicate the error.
ERRORS
The readdirr() function may fail if:
EBADF The dirp argument does not refer to an open directory
stream.
SEE ALSO
readdir(3C), dirent(4), types(5).
Page 1 Reliant UNIX 5.44 Printed 11/98