dirent.h 927 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. #include <sys/cdefs.h>
  9. __BEGIN_DECLS
  10. struct dirent {
  11. ino_t d_ino;
  12. off_t d_off;
  13. unsigned short d_reclen;
  14. unsigned char d_type;
  15. char d_name[256];
  16. };
  17. struct __DIR {
  18. int fd;
  19. struct dirent cur_ent;
  20. char* buffer;
  21. size_t buffer_size;
  22. char* nextptr;
  23. };
  24. typedef struct __DIR DIR;
  25. DIR* fdopendir(int fd);
  26. DIR* opendir(char const* name);
  27. int closedir(DIR*);
  28. void rewinddir(DIR*);
  29. struct dirent* readdir(DIR*);
  30. int readdir_r(DIR*, struct dirent*, struct dirent**);
  31. int dirfd(DIR*);
  32. int alphasort(const struct dirent** d1, const struct dirent** d2);
  33. int scandir(char const* dirp, struct dirent*** namelist,
  34. int (*filter)(const struct dirent*),
  35. int (*compar)(const struct dirent**, const struct dirent**));
  36. __END_DECLS