1#include "../platform.h"
2#include "../../error.h"
11 auto fd = (int)(intptr_t)d;
12 fd = fcntl(fd, F_DUPFD, 0);
16 DIR *dirp = fdopendir(fd);
22 *iter = (uintptr_t)dirp;
26 auto const dirp = (DIR *)iter;
33 auto const dirp = (DIR *)iter;
37 struct dirent *ent = readdir(dirp);
46#ifdef _DIRENT_HAVE_D_TYPE
47 if (ent->d_type != DT_UNKNOWN) {
48 if (ent->d_type != DT_REG)
goto next_entry;
53 const int fd = dirfd(dirp);
58 if (fstatat(fd, ent->d_name, &st, 0) != 0) {
61 if (!S_ISREG(st.st_mode))
goto next_entry;
@ CLOD_REGION_INVALID_USAGE