* [PATCH] linux: Use long int for syscall return value
@ 2022-11-29 11:24 XingLi
2022-11-30 13:53 ` Adhemerval Zanella Netto
0 siblings, 1 reply; 2+ messages in thread
From: XingLi @ 2022-11-29 11:24 UTC (permalink / raw)
To: adhemerval.zanella
Cc: libc-alpha, i.swmail, xry111, caiyinyu, wanghongliang, hejinyang,
szabolcs.nagy, Xing Li
From: Xing Li <lixing@loongson.cn>
The linux syscall ABI returns long, so the generic syscall code for
linux should use long for the return value.
This fixes the truncation of the return value of the syscall function
when that does not fit into an int.
---
sysdeps/unix/sysv/linux/syscall.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sysdeps/unix/sysv/linux/syscall.c b/sysdeps/unix/sysv/linux/syscall.c
index 7303ba7188..8cb0b66b1c 100644
--- a/sysdeps/unix/sysv/linux/syscall.c
+++ b/sysdeps/unix/sysv/linux/syscall.c
@@ -33,7 +33,7 @@ syscall (long int number, ...)
long int a5 = va_arg (args, long int);
va_end (args);
- int r = INTERNAL_SYSCALL_NCS_CALL (number, a0, a1, a2, a3, a4, a5);
+ long int r = INTERNAL_SYSCALL_NCS_CALL (number, a0, a1, a2, a3, a4, a5);
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (r)))
{
__set_errno (-r);
--
2.31.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] linux: Use long int for syscall return value
2022-11-29 11:24 [PATCH] linux: Use long int for syscall return value XingLi
@ 2022-11-30 13:53 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 2+ messages in thread
From: Adhemerval Zanella Netto @ 2022-11-30 13:53 UTC (permalink / raw)
To: XingLi
Cc: libc-alpha, i.swmail, xry111, caiyinyu, wanghongliang, hejinyang,
szabolcs.nagy
On 29/11/22 08:24, XingLi wrote:
> From: Xing Li <lixing@loongson.cn>
>
> The linux syscall ABI returns long, so the generic syscall code for
> linux should use long for the return value.
>
> This fixes the truncation of the return value of the syscall function
> when that does not fit into an int.
> ---
> sysdeps/unix/sysv/linux/syscall.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sysdeps/unix/sysv/linux/syscall.c b/sysdeps/unix/sysv/linux/syscall.c
> index 7303ba7188..8cb0b66b1c 100644
> --- a/sysdeps/unix/sysv/linux/syscall.c
> +++ b/sysdeps/unix/sysv/linux/syscall.c
> @@ -33,7 +33,7 @@ syscall (long int number, ...)
> long int a5 = va_arg (args, long int);
> va_end (args);
>
> - int r = INTERNAL_SYSCALL_NCS_CALL (number, a0, a1, a2, a3, a4, a5);
> + long int r = INTERNAL_SYSCALL_NCS_CALL (number, a0, a1, a2, a3, a4, a5);
> if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (r)))
> {
> __set_errno (-r);
LGTM, thanks.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-30 13:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-29 11:24 [PATCH] linux: Use long int for syscall return value XingLi
2022-11-30 13:53 ` Adhemerval Zanella Netto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).