fastat-64bithost.patch 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. diff -Nur uClibc-0.9.30.2.orig/libc/sysdeps/linux/common/fstatat64.c uClibc-0.9.30.2/libc/sysdeps/linux/common/fstatat64.c
  2. --- uClibc-0.9.30.2.orig/libc/sysdeps/linux/common/fstatat64.c 2010-01-13 22:22:31.000000000 +0100
  3. +++ uClibc-0.9.30.2/libc/sysdeps/linux/common/fstatat64.c 2010-01-23 11:55:14.000000000 +0100
  4. @@ -12,6 +12,11 @@
  5. #ifdef __UCLIBC_HAS_LFS__
  6. +/* 64bit ports tend to favor newfstatat() */
  7. +#ifdef __NR_newfstatat
  8. +# define __NR_fstatat64 __NR_newfstatat
  9. +#endif
  10. +
  11. #ifdef __NR_fstatat64
  12. int fstatat64(int fd, const char *file, struct stat64 *buf, int flag)
  13. {
  14. diff -Nur uClibc-0.9.30.2.orig/libc/sysdeps/linux/common/fstatat.c uClibc-0.9.30.2/libc/sysdeps/linux/common/fstatat.c
  15. --- uClibc-0.9.30.2.orig/libc/sysdeps/linux/common/fstatat.c 2010-01-13 22:22:31.000000000 +0100
  16. +++ uClibc-0.9.30.2/libc/sysdeps/linux/common/fstatat.c 2010-01-23 11:54:50.000000000 +0100
  17. @@ -10,15 +10,20 @@
  18. #include <sys/stat.h>
  19. #include "xstatconv.h"
  20. +/* 64bit ports tend to favor newfstatat() */
  21. +#ifdef __NR_newfstatat
  22. +# define __NR_fstatat64 __NR_newfstatat
  23. +#endif
  24. +
  25. #ifdef __NR_fstatat64
  26. int fstatat(int fd, const char *file, struct stat *buf, int flag)
  27. {
  28. int ret;
  29. - struct kernel_stat kbuf;
  30. + struct kernel_stat64 kbuf;
  31. ret = INLINE_SYSCALL(fstatat64, 4, fd, file, &kbuf, flag);
  32. if (ret == 0)
  33. - __xstat_conv(&kbuf, buf);
  34. + __xstat32_conv(&kbuf, buf);
  35. return ret;
  36. }
  37. diff -Nur uClibc-0.9.30.2.orig/libc/sysdeps/linux/common/xstatconv.c uClibc-0.9.30.2/libc/sysdeps/linux/common/xstatconv.c
  38. --- uClibc-0.9.30.2.orig/libc/sysdeps/linux/common/xstatconv.c 2010-01-13 22:22:31.000000000 +0100
  39. +++ uClibc-0.9.30.2/libc/sysdeps/linux/common/xstatconv.c 2010-01-23 11:56:07.000000000 +0100
  40. @@ -70,4 +70,23 @@
  41. buf->st_ctim = kbuf->st_ctim;
  42. }
  43. +void __xstat32_conv(struct kernel_stat64 *kbuf, struct stat *buf)
  44. +{
  45. + /* Convert to current kernel version of `struct stat64'. */
  46. + memset(buf, 0x00, sizeof(*buf));
  47. + buf->st_dev = kbuf->st_dev;
  48. + buf->st_ino = kbuf->st_ino;
  49. + buf->st_mode = kbuf->st_mode;
  50. + buf->st_nlink = kbuf->st_nlink;
  51. + buf->st_uid = kbuf->st_uid;
  52. + buf->st_gid = kbuf->st_gid;
  53. + buf->st_rdev = kbuf->st_rdev;
  54. + buf->st_size = kbuf->st_size;
  55. + buf->st_blksize = kbuf->st_blksize;
  56. + buf->st_blocks = kbuf->st_blocks;
  57. + buf->st_atim = kbuf->st_atim;
  58. + buf->st_mtim = kbuf->st_mtim;
  59. + buf->st_ctim = kbuf->st_ctim;
  60. +}
  61. +
  62. #endif /* __UCLIBC_HAS_LFS__ */
  63. diff -Nur uClibc-0.9.30.2.orig/libc/sysdeps/linux/common/xstatconv.h uClibc-0.9.30.2/libc/sysdeps/linux/common/xstatconv.h
  64. --- uClibc-0.9.30.2.orig/libc/sysdeps/linux/common/xstatconv.h 2010-01-13 22:22:31.000000000 +0100
  65. +++ uClibc-0.9.30.2/libc/sysdeps/linux/common/xstatconv.h 2010-01-23 11:56:38.000000000 +0100
  66. @@ -26,6 +26,7 @@
  67. #include <bits/kernel_stat.h>
  68. extern void __xstat_conv(struct kernel_stat *kbuf, struct stat *buf) attribute_hidden;
  69. +extern void __xstat32_conv(struct kernel_stat64 *kbuf, struct stat *buf) attribute_hidden;
  70. #if defined __UCLIBC_HAS_LFS__
  71. extern void __xstat64_conv(struct kernel_stat64 *kbuf, struct stat64 *buf) attribute_hidden;
  72. #endif