|SCANDIRAT(3)||Linux Programmer's Manual||SCANDIRAT(3)|
NAMEscandirat - scan a directory relative to a directory file descriptor
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <fcntl.h> /* Definition of AT_* constants */ #include
int scandirat(int dirfd, const char *dirp, struct dirent ***namelist,
int (* filter )(const struct dirent *),
int (* compar )(const struct dirent **, const struct dirent **));
DESCRIPTIONThe scandirat() system call operates in exactly the same way as scandir(3), except for the differences described in this manual page.
RETURN VALUEOn success, scandirat() returns the number of directory entries selected. On error, -1 is returned and errno is set to indicate the error.
ERRORSThe same errors that occur for scandir(3) can also occur for scandirat(). The following additional errors can occur for scandirat():
- dirfd is not a valid file descriptor.
- dirp is a relative path and dirfd is a file descriptor referring to a file other than a directory.
VERSIONSscandirat() was added to glibc in version 2.15.
CONFORMING TOThis function is a GNU extension.
NOTESSee openat(2) for an explanation of the need for scandirat().
SEE ALSOopenat(2), scandir(3), path_resolution(7)
COLOPHONThis page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/.