diff options
author | Dmitry V. Levin <ldv@strace.io> | 2021-04-15 08:00:00 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2021-04-15 08:00:00 +0000 |
commit | 473f0dec82c33f4d0761ede1244c957106765add (patch) | |
tree | 91e17cd740a1ed391691603f8d501d4370dc100a | |
parent | cef1b25c7d8f908704bce6848258b14d91c1e0ca (diff) | |
download | strace-473f0dec82c33f4d0761ede1244c957106765add.tar.gz |
ipc_sem: use print_fields.h helpers
* src/ipc_sem.c (tprint_sembuf_array, SYS_FUNC(semop), do_semtimedop,
SYS_FUNC(semget)): Use tprint_arg_next, PRINT_VAL_U, and PRINT_VAL_D.
-rw-r--r-- | src/ipc_sem.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/src/ipc_sem.c b/src/ipc_sem.c index 82407f165..b9d048e2c 100644 --- a/src/ipc_sem.c +++ b/src/ipc_sem.c @@ -38,15 +38,22 @@ static void tprint_sembuf_array(struct tcb *const tcp, const kernel_ulong_t addr, const unsigned int count) { + /* sops */ struct sembuf sb; print_array(tcp, addr, count, &sb, sizeof(sb), tfetch_mem, print_sembuf, 0); - tprintf(", %u", count); + tprint_arg_next(); + + /* nsops */ + PRINT_VAL_U(count); } SYS_FUNC(semop) { - tprintf("%d, ", (int) tcp->u_arg[0]); + /* semid */ + PRINT_VAL_D((int) tcp->u_arg[0]); + tprint_arg_next(); + if (indirect_ipccall(tcp)) { tprint_sembuf_array(tcp, tcp->u_arg[3], tcp->u_arg[1]); } else { @@ -58,10 +65,15 @@ SYS_FUNC(semop) static int do_semtimedop(struct tcb *const tcp, const print_obj_by_addr_fn print_ts) { - tprintf("%d, ", (int) tcp->u_arg[0]); + /* semid */ + PRINT_VAL_D((int) tcp->u_arg[0]); + tprint_arg_next(); + if (indirect_ipccall(tcp)) { tprint_sembuf_array(tcp, tcp->u_arg[3], tcp->u_arg[1]); - tprints(", "); + tprint_arg_next(); + + /* timeout */ #if defined(S390) || defined(S390X) print_ts(tcp, tcp->u_arg[2]); #else @@ -69,7 +81,9 @@ do_semtimedop(struct tcb *const tcp, const print_obj_by_addr_fn print_ts) #endif } else { tprint_sembuf_array(tcp, tcp->u_arg[1], tcp->u_arg[2]); - tprints(", "); + tprint_arg_next(); + + /* timeout */ print_ts(tcp, tcp->u_arg[3]); } return RVAL_DECODED; @@ -89,8 +103,15 @@ SYS_FUNC(semtimedop_time64) SYS_FUNC(semget) { + /* key */ printxval(ipc_private, (unsigned int) tcp->u_arg[0], NULL); - tprintf(", %d, ", (int) tcp->u_arg[1]); + tprint_arg_next(); + + /* nsems */ + PRINT_VAL_D((int) tcp->u_arg[1]); + tprint_arg_next(); + + /* semflg */ if (printflags(resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0) tprints("|"); print_numeric_umode_t(tcp->u_arg[2] & 0777); |