statfix64.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef STATFIX_H
  2. #define STATFIX_H
  3. #include <features.h>
  4. #include <limits.h>
  5. #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64
  6. #undef _FILE_OFFSET_BITS
  7. #define _FILE_OFFSET_BITS 64
  8. #endif
  9. #ifndef __USE_LARGEFILE64
  10. # define __USE_LARGEFILE64 1
  11. #endif
  12. /* We absolutely do _NOT_ want interfaces silently
  13. * * renamed under us or very bad things will happen... */
  14. #ifdef __USE_FILE_OFFSET64
  15. # undef __USE_FILE_OFFSET64
  16. #endif
  17. #ifdef __UCLIBC_HAVE_LFS__
  18. #if defined __WORDSIZE && __WORDSIZE < 64
  19. #include <sys/types.h>
  20. /* Pull in whatever this particular arch's kernel thinks the kernel version of
  21. * struct stat should look like. It turns out that each arch has a different
  22. * opinion on the subject, and different kernel revs use different names... */
  23. #define stat kernel_stat
  24. #define new_stat kernel_stat
  25. #define stat64 kernel_stat64
  26. #define new_stat64 kernel_stat64
  27. #include <asm/stat.h>
  28. #undef new_stat64
  29. #undef stat64
  30. #undef new_stat
  31. #undef stat
  32. /* Now pull in libc's version of stat */
  33. #define stat libc_stat
  34. #define stat64 libc_stat64
  35. #include <sys/stat.h>
  36. #undef stat64
  37. #undef stat
  38. extern void statfix64(struct libc_stat64 *libcstat, struct kernel_stat64 *kstat);
  39. extern int __fxstat64(int version, int fd, struct libc_stat64 * statbuf);
  40. #else /* __WORDSIZE */
  41. #include <sys/types.h>
  42. /* Pull in whatever this particular arch's kernel thinks the kernel version of
  43. * struct stat should look like. It turns out that each arch has a different
  44. * opinion on the subject, and different kernel revs use different names... */
  45. #define stat kernel_stat
  46. #define new_stat kernel_stat
  47. #define kernel_stat64 kernel_stat
  48. #include <asm/stat.h>
  49. #undef new_stat64
  50. #undef stat64
  51. #undef new_stat
  52. #undef stat
  53. /* Now pull in libc's version of stat */
  54. #define stat libc_stat
  55. #define stat64 libc_stat64
  56. #include <sys/stat.h>
  57. #undef stat64
  58. #undef stat
  59. extern void statfix64(struct libc_stat64 *libcstat, struct kernel_stat64 *kstat);
  60. extern int __fxstat64(int version, int fd, struct libc_stat64 * statbuf);
  61. #endif /* __WORDSIZE */
  62. #endif /* __UCLIBC_HAVE_LFS__ */
  63. #endif