mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-09-09 08:17:53 -06:00
linux-user: Fix "print_fdset()" in "strace.c" to not print ", " after last value
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>
This commit is contained in:
parent
d7df0ceee0
commit
664441ea01
1 changed files with 6 additions and 2 deletions
|
@ -541,6 +541,7 @@ static void
|
||||||
print_fdset(int n, abi_ulong target_fds_addr)
|
print_fdset(int n, abi_ulong target_fds_addr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
int first = 1;
|
||||||
|
|
||||||
qemu_log("[");
|
qemu_log("[");
|
||||||
if( target_fds_addr ) {
|
if( target_fds_addr ) {
|
||||||
|
@ -555,8 +556,11 @@ print_fdset(int n, abi_ulong target_fds_addr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i=n; i>=0; i--) {
|
for (i=n; i>=0; i--) {
|
||||||
if ((tswapal(target_fds[i / TARGET_ABI_BITS]) >> (i & (TARGET_ABI_BITS - 1))) & 1)
|
if ((tswapal(target_fds[i / TARGET_ABI_BITS]) >>
|
||||||
qemu_log("%d,", i);
|
(i & (TARGET_ABI_BITS - 1))) & 1) {
|
||||||
|
qemu_log("%s%d", get_comma(first), i);
|
||||||
|
first = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
unlock_user(target_fds, target_fds_addr, 0);
|
unlock_user(target_fds, target_fds_addr, 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue