This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[RFC PATCH] Consolidate __lseek(), __llseek implementation
- From: Yury Norov <ynorov at caviumnetworks dot com>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Cc: Yury Norov <ynorov at caviumnetworks dot com>, <libc-alpha at sourceware dot org>
- Date: Wed, 24 Aug 2016 15:24:36 +0300
- Subject: [RFC PATCH] Consolidate __lseek(), __llseek implementation
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Yuri dot Norov at caviumnetworks dot com;
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
Hi Adhemerval,
Current __lseek() implementation under
sysdeps/unix/sysv/linux/generic/wordsize-32/lseek.c
is broken if off_t is 64-bit type. In this patch it is redirected to 64-bit
__llseek() version. It helps to avoid introducing platform implementation for
__lseek() under aarch64/ilp32.
Notice that using SYSCALL_LL64() makes LTP hang for me (ltp-pan itself),
so I don't use it. I am also not sure this patch does not affect other
ports, and that there's no alternative implementations in glibc that we'd
cleenup. So I marked it as RFC. Please take a look. If you find it helpful,
I'll handle SYSCALL_LL64() issue and resend it.
Yury.
Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
sysdeps/unix/sysv/linux/generic/wordsize-32/llseek.c | 7 +++++++
sysdeps/unix/sysv/linux/generic/wordsize-32/lseek.c | 2 ++
2 files changed, 9 insertions(+)
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/llseek.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/llseek.c
index 458964c..3352ffd 100644
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/llseek.c
+++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/llseek.c
@@ -39,6 +39,13 @@ strong_alias (__llseek, __libc_lseek64)
strong_alias (__llseek, __lseek64)
weak_alias (__llseek, lseek64)
+#ifdef __OFF_T_MATCHES_OFF64_T
+strong_alias (__llseek, __lseek)
+libc_hidden_ver (__llseek,__lseek)
+weak_alias (__llseek, lseek)
+strong_alias (__llseek, __libc_lseek)
+#endif
+
/* llseek doesn't have a prototype. Since the second parameter is a
64bit type, this results in wrong behaviour if no prototype is
provided. */
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/lseek.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/lseek.c
index dbf0b26..c953e79 100644
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/lseek.c
+++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/lseek.c
@@ -23,6 +23,7 @@
#include <sysdep.h>
#include <sys/syscall.h>
+#ifndef __OFF_T_MATCHES_OFF64_T
#include "overflow.h"
off_t
@@ -36,3 +37,4 @@ __lseek (int fd, off_t offset, int whence)
libc_hidden_def (__lseek)
weak_alias (__lseek, lseek)
strong_alias (__lseek, __libc_lseek)
+#endif
--
2.7.4