dirstream.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* -*-comment-start: "//";comment-end:""-*-
  2. * GNU Mes --- Maxwell Equations of Software
  3. *Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
  4. * Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  5. *
  6. * This file is part of GNU Mes.
  7. *
  8. * GNU Mes is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 3 of the License, or (at
  11. * your option) any later version.
  12. *
  13. * GNU Mes is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. #ifndef __MES_DIRSTREAM_H
  22. #define __MES_DIRSTREAM_H 1
  23. #if SYSTEM_LIBC && HAVE_DIRSTREAM_H
  24. #ifndef _GNU_SOURCE
  25. #define _GNU_SOURCE
  26. #endif
  27. #undef __MES_DIRSTREAM_H
  28. #include_next <dirstream.h>
  29. #else // ! SYSTEM_LIBC
  30. #include <sys/types.h>
  31. // Taken from GNU C Library 2.2.5
  32. /* Directory stream type. */
  33. struct __dirstream
  34. {
  35. int fd; /* File descriptor. */
  36. char *data; /* Directory block. */
  37. size_t allocation; /* Space allocated for the block. */
  38. size_t size; /* Total valid data in the block. */
  39. size_t offset; /* Current offset into the block. */
  40. off_t filepos; /* Position of next entry to read. */
  41. };
  42. typedef struct __dirstream DIR;
  43. #endif // ! SYSTEM_LIBC
  44. #endif // __MES_DIRSTREAM_H