dirstream.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public License as
  5. published by the Free Software Foundation; either version 2 of the
  6. License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public
  12. License along with the GNU C Library; see the file COPYING.LIB. If
  13. not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
  14. Cambridge, MA 02139, USA. */
  15. /*
  16. * POSIX Standard: 5.1.2 Directory Operations <dirent.h>
  17. */
  18. #ifndef _DIRSTREAM_H
  19. #define _DIRSTREAM_H 1
  20. #include <features.h>
  21. #include <sys/types.h>
  22. #ifdef __UCLIBC_HAS_THREADS__
  23. #include <pthread.h>
  24. #endif
  25. /* For now, syscall readdir () only supports one entry at a time. It
  26. * will be changed in the future.
  27. #define NUMENT 3
  28. */
  29. #ifndef NUMENT
  30. #define NUMENT 1
  31. #endif
  32. #define SINGLE_READDIR 11
  33. #define MULTI_READDIR 12
  34. #define NEW_READDIR 13
  35. /* Directory stream type. */
  36. struct __dirstream {
  37. /* file descriptor */
  38. int dd_fd;
  39. /* offset of the next dir entry in buffer */
  40. size_t dd_nextloc;
  41. /* bytes of valid entries in buffer */
  42. size_t dd_size;
  43. /* -> directory buffer */
  44. void *dd_buf;
  45. /* offset of the next dir entry in directory. */
  46. off_t dd_nextoff;
  47. /* total size of buffer */
  48. size_t dd_max;
  49. /* lock */
  50. #ifdef __UCLIBC_HAS_THREADS__
  51. pthread_mutex_t dd_lock;
  52. #else
  53. void *dd_lock;
  54. #endif
  55. }; /* stream data from opendir() */
  56. extern ssize_t __getdents(int fd, char *buf, size_t count) attribute_hidden;
  57. #ifdef __UCLIBC_HAS_LFS__
  58. extern ssize_t __getdents64 (int fd, char *buf, size_t count) attribute_hidden;
  59. #endif
  60. #endif /* dirent.h */