[PATCH] generic/wordsize-32: don't duplicate truncate syscalls if not needed
Yury Norov
ynorov@caviumnetworks.com
Tue Sep 20 13:44:00 GMT 2016
On Tue, Sep 20, 2016 at 10:04:12AM -0300, Adhemerval Zanella wrote:
>
>
> On 19/09/2016 17:56, Yury Norov wrote:
> > If off_t is 64-bit, current implementation of truncate() and ftruncate()
> > is wrong, and proper implementation is identical to corresponding 64-bit
> > versions of syscalls. This patch creates aliases for it.
>
> I think we can try to go forward and consolidate both all truncate and
> ftruncate implementation on Linux. I sent a patchset last month [1] [2]
> and I will send an update today with some small fixes. I think it should
> work on aarch64 ilp32 as well, it uses the logic for:
>
> {f}truncate.c:
>
> #ifndef __OFF_T_MATCHES_OFF64_T
> __{f}truncate (..., off_t length)
> {
> # ifndef __NR_ftruncate
> return INLINE_SYSCALL_CALL (ftruncate64, ...,
> __ALIGNMENT_ARG SYSCALL_LL (length));
> # else
> return INLINE_SYSCALL_CALL (ftruncate, ..., length);
> # endif
> }
> weak_alias (__ftruncate, ftruncate)
> #endif
>
>
> {f}truncate64.c:
>
> #ifndef __NR_ftruncate64
> # define __NR_ftruncate64 __NR_ftruncate
> #endif
>
> int
> __{f}truncate64 (..., off_t length)
> {
> return INLINE_SYSCALL_CALL (ftruncate64, ...,
> __ALIGNMENT_ARG SYSCALL_LL64 (length));
> }
> weak_alias (__ftruncate64, ftruncate64)
>
> #ifdef __OFF_T_MATCHES_OFF64_T
> weak_alias (__ftruncate64, ftruncate);
> #endif
>
>
> [1] https://sourceware.org/ml/libc-alpha/2016-08/msg00811.html
> [2] https://sourceware.org/ml/libc-alpha/2016-08/msg00812.html
OK, looks good. I'll replace my patch with your version when you update it.
Could you also comment my patches on stat and getdents()?
https://sourceware.org/ml/libc-alpha/2016-09/msg00315.html
https://sourceware.org/ml/libc-alpha/2016-09/msg00240.html
Yury.
More information about the Libc-alpha
mailing list