dirent.h 904 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <Kernel/API/POSIX/dirent.h>
  8. __BEGIN_DECLS
  9. struct dirent {
  10. ino_t d_ino;
  11. off_t d_off;
  12. unsigned short d_reclen;
  13. unsigned char d_type;
  14. char d_name[256];
  15. };
  16. struct __DIR {
  17. int fd;
  18. struct dirent cur_ent;
  19. char* buffer;
  20. size_t buffer_size;
  21. char* nextptr;
  22. };
  23. typedef struct __DIR DIR;
  24. DIR* fdopendir(int fd);
  25. DIR* opendir(char const* name);
  26. int closedir(DIR*);
  27. void rewinddir(DIR*);
  28. struct dirent* readdir(DIR*);
  29. int readdir_r(DIR*, struct dirent*, struct dirent**);
  30. int dirfd(DIR*);
  31. int alphasort(const struct dirent** d1, const struct dirent** d2);
  32. int scandir(char const* dirp, struct dirent*** namelist,
  33. int (*filter)(const struct dirent*),
  34. int (*compar)(const struct dirent**, const struct dirent**));
  35. __END_DECLS