@@ -20,6 +20,8 @@
#include <sysdep-cancel.h>
+#ifndef __OFF_T_MATCHES_OFF64_T
+
/* Reserve storage for the data of the file associated with FD. */
int
fallocate (int fd, int mode, __off_t offset, __off_t len)
@@ -33,3 +35,5 @@ fallocate (int fd, int mode, __off_t offset, __off_t len)
return -1;
#endif
}
+
+#endif /* __OFF_T_MATCHES_OFF64_T */
@@ -35,3 +35,7 @@ fallocate64 (int fd, int mode, __off64_t offset, __off64_t len)
return -1;
#endif
}
+
+#ifdef __OFF_T_MATCHES_OFF64_T
+weak_alias(fallocate64, fallocate)
+#endif
@@ -19,6 +19,8 @@
#include <fcntl.h>
#include <sysdep.h>
+#ifndef __OFF_T_MATCHES_OFF64_T
+
/* Advice the system about the expected behaviour of the application with
respect to the file associated with FD. */
@@ -46,3 +48,5 @@ posix_fadvise (int fd, off_t offset, off_t len, int advise)
return ENOSYS;
#endif
}
+
+#endif /* __OFF_T_MATCHES_OFF64_T */
@@ -56,3 +56,7 @@ compat_symbol (libc, __posix_fadvise64_l32, posix_fadvise64, GLIBC_2_2);
#else
strong_alias (__posix_fadvise64_l64, posix_fadvise64);
#endif
+
+#ifdef __OFF_T_MATCHES_OFF64_T
+weak_alias(__posix_fadvise64_l64, __posix_fadvise)
+#endif /* __OFF_T_MATCHES_OFF64_T */
@@ -18,6 +18,8 @@
#include <fcntl.h>
#include <sysdep.h>
+#ifndef __OFF_T_MATCHES_OFF64_T
+
#define posix_fallocate static internal_fallocate
#include <sysdeps/posix/posix_fallocate.c>
#undef posix_fallocate
@@ -37,3 +39,5 @@ posix_fallocate (int fd, __off_t offset, __off_t len)
return INTERNAL_SYSCALL_ERRNO (res, err);
return internal_fallocate (fd, offset, len);
}
+
+#endif /* __OFF_T_MATCHES_OFF64_T */
@@ -40,3 +40,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
return INTERNAL_SYSCALL_ERRNO (res, err);
return internal_fallocate64 (fd, offset, len);
}
+
+#ifdef __OFF_T_MATCHES_OFF64_T
+weak_alias(__posix_fallocate64_l64, posix_fallocate)
+#endif
There are 3 syscall wrappers under sysdeps/unix/sysv/linux that calculate register pair for off_t like this: __LONG_LONG_PAIR (offset >> 31, offset) While it works for 32-bit off_t, new 32-bit APIs that use 64-bit off_t will be broken with it. This patch redirects affected syscalls to their 64-bit versions. It also saves few instructions and symbols in glibc, as 32-bit syscall wrappers are not generated anymore. Tested on AARCH64/ILP32. Signed-off-by: Yury Norov <ynorov@caviumnetworks.com> --- sysdeps/unix/sysv/linux/fallocate.c | 4 ++++ sysdeps/unix/sysv/linux/fallocate64.c | 4 ++++ sysdeps/unix/sysv/linux/posix_fadvise.c | 4 ++++ sysdeps/unix/sysv/linux/posix_fadvise64.c | 4 ++++ sysdeps/unix/sysv/linux/posix_fallocate.c | 4 ++++ sysdeps/unix/sysv/linux/posix_fallocate64.c | 4 ++++ 6 files changed, 24 insertions(+) -- 2.7.4