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 --- uClibc-0.9.30.2.orig/libc/sysdeps/linux/common/fstatat64.c 2010-01-13 22:22:31.000000000 +0100 +++ uClibc-0.9.30.2/libc/sysdeps/linux/common/fstatat64.c 2010-01-23 11:55:14.000000000 +0100 @@ -12,6 +12,11 @@ #ifdef __UCLIBC_HAS_LFS__ +/* 64bit ports tend to favor newfstatat() */ +#ifdef __NR_newfstatat +# define __NR_fstatat64 __NR_newfstatat +#endif + #ifdef __NR_fstatat64 int fstatat64(int fd, const char *file, struct stat64 *buf, int flag) { 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 --- uClibc-0.9.30.2.orig/libc/sysdeps/linux/common/fstatat.c 2010-01-13 22:22:31.000000000 +0100 +++ uClibc-0.9.30.2/libc/sysdeps/linux/common/fstatat.c 2010-01-23 11:54:50.000000000 +0100 @@ -10,15 +10,20 @@ #include #include "xstatconv.h" +/* 64bit ports tend to favor newfstatat() */ +#ifdef __NR_newfstatat +# define __NR_fstatat64 __NR_newfstatat +#endif + #ifdef __NR_fstatat64 int fstatat(int fd, const char *file, struct stat *buf, int flag) { int ret; - struct kernel_stat kbuf; + struct kernel_stat64 kbuf; ret = INLINE_SYSCALL(fstatat64, 4, fd, file, &kbuf, flag); if (ret == 0) - __xstat_conv(&kbuf, buf); + __xstat32_conv(&kbuf, buf); return ret; } 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 --- uClibc-0.9.30.2.orig/libc/sysdeps/linux/common/xstatconv.c 2010-01-13 22:22:31.000000000 +0100 +++ uClibc-0.9.30.2/libc/sysdeps/linux/common/xstatconv.c 2010-01-23 11:56:07.000000000 +0100 @@ -70,4 +70,23 @@ buf->st_ctim = kbuf->st_ctim; } +void __xstat32_conv(struct kernel_stat64 *kbuf, struct stat *buf) +{ + /* Convert to current kernel version of `struct stat64'. */ + memset(buf, 0x00, sizeof(*buf)); + buf->st_dev = kbuf->st_dev; + buf->st_ino = kbuf->st_ino; + buf->st_mode = kbuf->st_mode; + buf->st_nlink = kbuf->st_nlink; + buf->st_uid = kbuf->st_uid; + buf->st_gid = kbuf->st_gid; + buf->st_rdev = kbuf->st_rdev; + buf->st_size = kbuf->st_size; + buf->st_blksize = kbuf->st_blksize; + buf->st_blocks = kbuf->st_blocks; + buf->st_atim = kbuf->st_atim; + buf->st_mtim = kbuf->st_mtim; + buf->st_ctim = kbuf->st_ctim; +} + #endif /* __UCLIBC_HAS_LFS__ */ 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 --- uClibc-0.9.30.2.orig/libc/sysdeps/linux/common/xstatconv.h 2010-01-13 22:22:31.000000000 +0100 +++ uClibc-0.9.30.2/libc/sysdeps/linux/common/xstatconv.h 2010-01-23 11:56:38.000000000 +0100 @@ -26,6 +26,7 @@ #include extern void __xstat_conv(struct kernel_stat *kbuf, struct stat *buf) attribute_hidden; +extern void __xstat32_conv(struct kernel_stat64 *kbuf, struct stat *buf) attribute_hidden; #if defined __UCLIBC_HAS_LFS__ extern void __xstat64_conv(struct kernel_stat64 *kbuf, struct stat64 *buf) attribute_hidden; #endif