diff mbox series

[v8,8/9] linux-user/strace: Let print_sockaddr() have a 'last' argument

Message ID 20191021114857.20538-9-f4bug@amsat.org (mailing list archive)
State New, archived
Headers show
Series linux-user: strace improvements | expand

Commit Message

Philippe Mathieu-Daudé Oct. 21, 2019, 11:48 a.m. UTC
If the format is not the syscall last argument, a comma is append.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
---
v8: do not name prototype arguments

checkpatch error:
 ERROR: storage class should be at the beginning of the declaration
 #10: FILE: linux-user/strace.c:70:
 +UNUSED static void print_sockaddr(abi_ulong, abi_long, int);
---
 linux-user/strace.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Laurent Vivier Oct. 21, 2019, 12:54 p.m. UTC | #1
Le 21/10/2019 à 13:48, Philippe Mathieu-Daudé a écrit :
> If the format is not the syscall last argument, a comma is append.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
> ---
> v8: do not name prototype arguments
> 
> checkpatch error:
>  ERROR: storage class should be at the beginning of the declaration
>  #10: FILE: linux-user/strace.c:70:
>  +UNUSED static void print_sockaddr(abi_ulong, abi_long, int);
> ---
>  linux-user/strace.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/linux-user/strace.c b/linux-user/strace.c
> index cd92c77d33..3d4d684450 100644
> --- a/linux-user/strace.c
> +++ b/linux-user/strace.c
> @@ -67,7 +67,7 @@ UNUSED static void print_timeval(abi_ulong, int);
>  UNUSED static void print_timezone(abi_ulong, int);
>  UNUSED static void print_number(abi_long, int);
>  UNUSED static void print_signal(abi_ulong, int);
> -UNUSED static void print_sockaddr(abi_ulong addr, abi_long addrlen);
> +UNUSED static void print_sockaddr(abi_ulong, abi_long, int);
>  UNUSED static void print_socket_domain(int domain);
>  UNUSED static void print_socket_type(int type);
>  UNUSED static void print_socket_protocol(int domain, int type, int protocol);
> @@ -336,7 +336,7 @@ static void print_siginfo(const target_siginfo_t *tinfo)
>  }
>  
>  static void
> -print_sockaddr(abi_ulong addr, abi_long addrlen)
> +print_sockaddr(abi_ulong addr, abi_long addrlen, int last)
>  {
>      struct target_sockaddr *sa;
>      int i;
> @@ -418,7 +418,7 @@ print_sockaddr(abi_ulong addr, abi_long addrlen)
>      } else {
>          print_raw_param("0x"TARGET_ABI_FMT_lx, addr, 0);
>      }
> -    gemu_log(", "TARGET_ABI_FMT_ld, addrlen);
> +    gemu_log(", "TARGET_ABI_FMT_ld"%s", addrlen, get_comma(last));
>  }
>  
>  static void
> @@ -1751,7 +1751,7 @@ static void do_print_sockaddr(const char *name, abi_long arg1)
>  
>      gemu_log("%s(", name);
>      print_sockfd(sockfd, 0);
> -    print_sockaddr(addr, addrlen);
> +    print_sockaddr(addr, addrlen, 0);
>      gemu_log(")");
>  }
>  
> @@ -1821,7 +1821,7 @@ static void do_print_msgaddr(const char *name, abi_long arg1)
>      print_buf(msg, len, 0);
>      print_raw_param(TARGET_ABI_FMT_ld, len, 0);
>      print_flags(msg_flags, flags, 0);
> -    print_sockaddr(addr, addrlen);
> +    print_sockaddr(addr, addrlen, 0);
>      gemu_log(")");
>  }
>  
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Laurent Vivier Oct. 21, 2019, 1:28 p.m. UTC | #2
Le 21/10/2019 à 13:48, Philippe Mathieu-Daudé a écrit :
> If the format is not the syscall last argument, a comma is append.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
> ---
> v8: do not name prototype arguments
> 
> checkpatch error:
>  ERROR: storage class should be at the beginning of the declaration
>  #10: FILE: linux-user/strace.c:70:
>  +UNUSED static void print_sockaddr(abi_ulong, abi_long, int);
> ---
>  linux-user/strace.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/linux-user/strace.c b/linux-user/strace.c
> index cd92c77d33..3d4d684450 100644
> --- a/linux-user/strace.c
> +++ b/linux-user/strace.c
> @@ -67,7 +67,7 @@ UNUSED static void print_timeval(abi_ulong, int);
>  UNUSED static void print_timezone(abi_ulong, int);
>  UNUSED static void print_number(abi_long, int);
>  UNUSED static void print_signal(abi_ulong, int);
> -UNUSED static void print_sockaddr(abi_ulong addr, abi_long addrlen);
> +UNUSED static void print_sockaddr(abi_ulong, abi_long, int);
>  UNUSED static void print_socket_domain(int domain);
>  UNUSED static void print_socket_type(int type);
>  UNUSED static void print_socket_protocol(int domain, int type, int protocol);
> @@ -336,7 +336,7 @@ static void print_siginfo(const target_siginfo_t *tinfo)
>  }
>  
>  static void
> -print_sockaddr(abi_ulong addr, abi_long addrlen)
> +print_sockaddr(abi_ulong addr, abi_long addrlen, int last)
>  {
>      struct target_sockaddr *sa;
>      int i;
> @@ -418,7 +418,7 @@ print_sockaddr(abi_ulong addr, abi_long addrlen)
>      } else {
>          print_raw_param("0x"TARGET_ABI_FMT_lx, addr, 0);
>      }
> -    gemu_log(", "TARGET_ABI_FMT_ld, addrlen);
> +    gemu_log(", "TARGET_ABI_FMT_ld"%s", addrlen, get_comma(last));
>  }
>  
>  static void
> @@ -1751,7 +1751,7 @@ static void do_print_sockaddr(const char *name, abi_long arg1)
>  
>      gemu_log("%s(", name);
>      print_sockfd(sockfd, 0);
> -    print_sockaddr(addr, addrlen);
> +    print_sockaddr(addr, addrlen, 0);
>      gemu_log(")");
>  }
>  
> @@ -1821,7 +1821,7 @@ static void do_print_msgaddr(const char *name, abi_long arg1)
>      print_buf(msg, len, 0);
>      print_raw_param(TARGET_ABI_FMT_ld, len, 0);
>      print_flags(msg_flags, flags, 0);
> -    print_sockaddr(addr, addrlen);
> +    print_sockaddr(addr, addrlen, 0);
>      gemu_log(")");
>  }
>  
> 

Applied to my linux-user branch.

Thanks,
Laurent
diff mbox series

Patch

diff --git a/linux-user/strace.c b/linux-user/strace.c
index cd92c77d33..3d4d684450 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -67,7 +67,7 @@  UNUSED static void print_timeval(abi_ulong, int);
 UNUSED static void print_timezone(abi_ulong, int);
 UNUSED static void print_number(abi_long, int);
 UNUSED static void print_signal(abi_ulong, int);
-UNUSED static void print_sockaddr(abi_ulong addr, abi_long addrlen);
+UNUSED static void print_sockaddr(abi_ulong, abi_long, int);
 UNUSED static void print_socket_domain(int domain);
 UNUSED static void print_socket_type(int type);
 UNUSED static void print_socket_protocol(int domain, int type, int protocol);
@@ -336,7 +336,7 @@  static void print_siginfo(const target_siginfo_t *tinfo)
 }
 
 static void
-print_sockaddr(abi_ulong addr, abi_long addrlen)
+print_sockaddr(abi_ulong addr, abi_long addrlen, int last)
 {
     struct target_sockaddr *sa;
     int i;
@@ -418,7 +418,7 @@  print_sockaddr(abi_ulong addr, abi_long addrlen)
     } else {
         print_raw_param("0x"TARGET_ABI_FMT_lx, addr, 0);
     }
-    gemu_log(", "TARGET_ABI_FMT_ld, addrlen);
+    gemu_log(", "TARGET_ABI_FMT_ld"%s", addrlen, get_comma(last));
 }
 
 static void
@@ -1751,7 +1751,7 @@  static void do_print_sockaddr(const char *name, abi_long arg1)
 
     gemu_log("%s(", name);
     print_sockfd(sockfd, 0);
-    print_sockaddr(addr, addrlen);
+    print_sockaddr(addr, addrlen, 0);
     gemu_log(")");
 }
 
@@ -1821,7 +1821,7 @@  static void do_print_msgaddr(const char *name, abi_long arg1)
     print_buf(msg, len, 0);
     print_raw_param(TARGET_ABI_FMT_ld, len, 0);
     print_flags(msg_flags, flags, 0);
-    print_sockaddr(addr, addrlen);
+    print_sockaddr(addr, addrlen, 0);
     gemu_log(")");
 }