#include "dir.h" #include #include #include #include #include #include extern struct __opaque_dir *opendir(const char *name) { struct __opaque_dir *out = malloc(sizeof *out); if (!out) { __set_errno(ENOMEM); return NULL; } memset(out, 0x0, sizeof *out); int fd = open(name, O_RDONLY | O_DIRECTORY); if (fd < 0) { free(out); return NULL; } out->d_flags = 0; out->d_fd = fd; return out; }