[RFC PATCH] sync_file_range: fix the incorrect args order

Zheng Junling zhengjunling at huawei.com
Mon Oct 27 07:10:46 UTC 2014


Hi, Bernhard:

Do you encounter this bug?

Or could you give me some suggestions for this problem?

Thanks!

Junling

On 2014/10/13 16:41, Zheng Junling wrote:
> uClibc handles the sync_file_range2 syscall as well as sync_file_range,
> passes "flags" as the last argument. However, "flags" should be the
> second argument in sync_file_range2 syscall.
> 
> This patch only fixes this bug in arm, not in powerpc and mips yet. And
> I expect a complete patch. Thanks!
> 
> ----------------------------------------
> 
> Signed-off-by: Zheng Junling <zhengjunling at huawei.com>
> ---
>  libc/sysdeps/linux/common/sync_file_range.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/libc/sysdeps/linux/common/sync_file_range.c b/libc/sysdeps/linux/common/sync_file_range.c
> index 8d4ed92..db4f800 100644
> --- a/libc/sysdeps/linux/common/sync_file_range.c
> +++ b/libc/sysdeps/linux/common/sync_file_range.c
> @@ -28,8 +28,13 @@ static int __NC(sync_file_range)(int fd, off64_t offset, off64_t nbytes, unsigne
>  	return INLINE_SYSCALL(sync_file_range, 7, fd, 0,
>  			OFF64_HI_LO(offset), OFF64_HI_LO(nbytes), flags);
>  #  else
> +#   ifdef __NR_sync_file_range2
> +	return INLINE_SYSCALL(sync_file_range, 6, fd, flags,
> +			OFF64_HI_LO(offset), OFF64_HI_LO(nbytes));
> +#   else
>  	return INLINE_SYSCALL(sync_file_range, 6, fd,
>  			OFF64_HI_LO(offset), OFF64_HI_LO(nbytes), flags);
> +#   endif
>  #  endif
>  }
>  CANCELLABLE_SYSCALL(int, sync_file_range, (int fd, off64_t offset, off64_t nbytes, unsigned int flags), (fd, offset, nbytes, flags))
> 




More information about the uClibc mailing list