Section: Linux Programmer's Manual (3)
Return to Main Contents
scandirat - scan a directory relative to a directory file descriptor
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <fcntl.h> /* Definition of AT_* constants */
int scandirat(int dirfd, const char *dirp,
struct dirent ***namelist,
- int (*filter)(const struct dirent *),
int (*compar)(const struct dirent **, const struct dirent **));
system call operates in exactly the same way as
except for the differences described in this manual page.
If the pathname given in
is relative, then it is interpreted relative to the directory
referred to by the file descriptor
(rather than relative to the current working directory of
the calling process, as is done by
for a relative pathname).
is relative and
is the special value
is interpreted relative to the current working
directory of the calling process (like
is absolute, then
returns the number of directory entries selected.
On error, -1 is returned and
is set to indicate the error.
The same errors that occur for
can also occur for
The following additional errors can occur for
is not a valid file descriptor.
is a relative path and
is a file descriptor referring to a file other than a directory.
was added to glibc in version 2.15.
This function is a GNU extension.
for an explanation of the need for
This page is part of release 3.54 of the Linux
A description of the project,
and information about reporting bugs,
can be found at
- RETURN VALUE
- CONFORMING TO
- SEE ALSO
This document was created by
using the manual pages.
Time: 21:57:46 GMT, January 22, 2018