[PATCH trivial 1/7] linux-user/syscall.c: assume splice is always present

Michael Tokarev posted 7 patches 3 weeks, 6 days ago
Maintainers: Laurent Vivier <laurent@vivier.eu>, Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Stefan Hajnoczi <stefanha@redhat.com>, Fam Zheng <fam@euphon.net>
There is a newer version of this series
[PATCH trivial 1/7] linux-user/syscall.c: assume splice is always present
Posted by Michael Tokarev 3 weeks, 6 days ago
splice() &Co are defined since linux 2.6.17.
Assume it is always present.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 linux-user/syscall.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 67ad681098..9cc9ed2fbc 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -13450,15 +13450,9 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
         return ret;
 #endif
 
-#ifdef CONFIG_SPLICE
-#ifdef TARGET_NR_tee
     case TARGET_NR_tee:
-        {
-            ret = get_errno(tee(arg1,arg2,arg3,arg4));
-        }
+        ret = get_errno(tee(arg1, arg2, arg3, arg4));
         return ret;
-#endif
-#ifdef TARGET_NR_splice
     case TARGET_NR_splice:
         {
             loff_t loff_in, loff_out;
@@ -13488,9 +13482,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
             }
         }
         return ret;
-#endif
-#ifdef TARGET_NR_vmsplice
-	case TARGET_NR_vmsplice:
+    case TARGET_NR_vmsplice:
         {
             struct iovec *vec = lock_iovec(VERIFY_READ, arg2, arg3, 1);
             if (vec != NULL) {
@@ -13501,8 +13493,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
             }
         }
         return ret;
-#endif
-#endif /* CONFIG_SPLICE */
+
 #ifdef CONFIG_EVENTFD
 #if defined(TARGET_NR_eventfd)
     case TARGET_NR_eventfd:
-- 
2.47.3
Re: [PATCH trivial 1/7] linux-user/syscall.c: assume splice is always present
Posted by Richard Henderson 3 weeks, 1 day ago
On 1/13/26 23:59, Michael Tokarev wrote:
> splice() &Co are defined since linux 2.6.17.
> Assume it is always present.
> 
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> ---
>   linux-user/syscall.c | 15 +++------------
>   1 file changed, 3 insertions(+), 12 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

Separately, I wonder if these require safe_* versions to properly handle restart from 
signal delivery during a blocking operation.


r~

> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 67ad681098..9cc9ed2fbc 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -13450,15 +13450,9 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
>           return ret;
>   #endif
>   
> -#ifdef CONFIG_SPLICE
> -#ifdef TARGET_NR_tee
>       case TARGET_NR_tee:
> -        {
> -            ret = get_errno(tee(arg1,arg2,arg3,arg4));
> -        }
> +        ret = get_errno(tee(arg1, arg2, arg3, arg4));
>           return ret;
> -#endif
> -#ifdef TARGET_NR_splice
>       case TARGET_NR_splice:
>           {
>               loff_t loff_in, loff_out;
> @@ -13488,9 +13482,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
>               }
>           }
>           return ret;
> -#endif
> -#ifdef TARGET_NR_vmsplice
> -	case TARGET_NR_vmsplice:
> +    case TARGET_NR_vmsplice:
>           {
>               struct iovec *vec = lock_iovec(VERIFY_READ, arg2, arg3, 1);
>               if (vec != NULL) {
> @@ -13501,8 +13493,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
>               }
>           }
>           return ret;
> -#endif
> -#endif /* CONFIG_SPLICE */
> +
>   #ifdef CONFIG_EVENTFD
>   #if defined(TARGET_NR_eventfd)
>       case TARGET_NR_eventfd:
Re: [PATCH trivial 1/7] linux-user/syscall.c: assume splice is always present
Posted by Peter Maydell 3 weeks, 6 days ago
On Tue, 13 Jan 2026 at 13:00, Michael Tokarev <mjt@tls.msk.ru> wrote:
>
> splice() &Co are defined since linux 2.6.17.
> Assume it is always present.

Since we're calling the C functions here, the
relevant version is glibc 2.5, but either way these
have been around way longer than our minimum supported
version.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM