diff mbox

[RFC] sync_file_range: fix the incorrect args order

Message ID 1413189677-14018-1-git-send-email-zhengjunling@huawei.com
State Superseded
Headers show

Commit Message

Zheng Junling Oct. 13, 2014, 8:41 a.m. UTC
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@huawei.com>
---
 libc/sysdeps/linux/common/sync_file_range.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Zheng Junling Oct. 15, 2014, 6:37 a.m. UTC | #1
Is there anybody encountering or knowing this bug?

Thanks!

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@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))
>
Zheng Junling Oct. 27, 2014, 7:10 a.m. UTC | #2
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@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))
>
Bernhard Reutner-Fischer Feb. 18, 2015, 8:19 a.m. UTC | #3
On October 27, 2014 8:10:46 AM GMT+01:00, Zheng Junling <zhengjunling@huawei.com> wrote:
>Hi, Bernhard:
>
>Do you encounter this bug?

Fixed on master now.
Thanks,

>
>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@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))
>>
diff mbox

Patch

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))