statfix64.h 2.1 KB

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