[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 01/14] linux-user: Fix "print_fdset()" in "strace.c" to not print
From: |
Laurent Vivier |
Subject: |
[PULL 01/14] linux-user: Fix "print_fdset()" in "strace.c" to not print ", " after last value |
Date: |
Thu, 13 Aug 2020 08:49:10 +0200 |
From: Filip Bozuta <Filip.Bozuta@syrmia.com>
Function "print_fdset()" in "strace.c" is used to print the file descriptor
values in "print__newselect()" which prints arguments of syscall _newselect().
Until changes from this patch, this function was printing "," even after the
last value of the fd_set argument. This was changed in this patch by removing
this unnecessary "," after the last fd value and thus improving the estetics of
the _newselect() "-strace" print.
Implementation notes:
The printing fix was made possible by using an existing function
"get_comma()"
which returns a "," or an empty string "" based on its argument (0 for ","
and
other for "").
Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200702160915.9517-1-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/strace.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/linux-user/strace.c b/linux-user/strace.c
index 13981341b327..5e380486433c 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -541,6 +541,7 @@ static void
print_fdset(int n, abi_ulong target_fds_addr)
{
int i;
+ int first = 1;
qemu_log("[");
if( target_fds_addr ) {
@@ -555,9 +556,12 @@ print_fdset(int n, abi_ulong target_fds_addr)
return;
for (i=n; i>=0; i--) {
- if ((tswapal(target_fds[i / TARGET_ABI_BITS]) >> (i &
(TARGET_ABI_BITS - 1))) & 1)
- qemu_log("%d,", i);
+ if ((tswapal(target_fds[i / TARGET_ABI_BITS]) >>
+ (i & (TARGET_ABI_BITS - 1))) & 1) {
+ qemu_log("%s%d", get_comma(first), i);
+ first = 0;
}
+ }
unlock_user(target_fds, target_fds_addr, 0);
}
qemu_log("]");
--
2.26.2
- [PULL 00/14] Linux user for 5.2 patches, Laurent Vivier, 2020/08/13
- [PULL 01/14] linux-user: Fix "print_fdset()" in "strace.c" to not print ", " after last value,
Laurent Vivier <=
- [PULL 02/14] linux-user: Validate mmap/mprotect prot value, Laurent Vivier, 2020/08/13
- [PULL 03/14] linux-user: Adjust guest page protection for the host, Laurent Vivier, 2020/08/13
- [PULL 07/14] linux-user: Add support for a group of btrfs ioctls used for snapshots, Laurent Vivier, 2020/08/13
- [PULL 06/14] linux-user: Add support for a group of btrfs ioctls used for subvolumes, Laurent Vivier, 2020/08/13
- [PULL 05/14] linux-user: Add support for a group of 2038 safe syscalls, Laurent Vivier, 2020/08/13
- [PULL 08/14] linux-user: Add support for btrfs ioctls used to manipulate with devices, Laurent Vivier, 2020/08/13
- [PULL 04/14] linux-user: Modify 'target_to_host/host_to_target_itimerspec()', Laurent Vivier, 2020/08/13
- [PULL 09/14] linux-user: Add support for btrfs ioctls used to get/set features, Laurent Vivier, 2020/08/13
- [PULL 13/14] linux-user: Add support for btrfs ioctls used to scrub a filesystem, Laurent Vivier, 2020/08/13
- [PULL 10/14] linux-user: Add support for a group of btrfs inode ioctls, Laurent Vivier, 2020/08/13