diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2020-07-18 08:00:00 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2020-07-18 08:00:00 +0000 |
commit | 03a436fdfb0482f1e228124260ec6dbe0421c35b (patch) | |
tree | f0d295ed390bbc54527db90d06e0297703a11046 | |
parent | b8b11a1766567574cf884953e0fc69e5e2b0e7a3 (diff) | |
download | strace-03a436fdfb0482f1e228124260ec6dbe0421c35b.tar.gz |
Introduce PRINT_FIELD_NUMERIC_UMODE_T
* print_fields.h (PRINT_FIELD_NUMERIC_UMODE_T): New macro.
* ipc_msgctl.c (print_msqid_ds): Use it instead of print_numeric_umode_t.
* ipc_shmctl.c (print_shmid_ds): Likewise.
* open.c (print_open_how): Use it instead of print_numeric_ll_umode_t.
-rw-r--r-- | ipc_msgctl.c | 3 | ||||
-rw-r--r-- | ipc_shmctl.c | 3 | ||||
-rw-r--r-- | open.c | 6 | ||||
-rw-r--r-- | print_fields.h | 7 |
4 files changed, 11 insertions, 8 deletions
diff --git a/ipc_msgctl.c b/ipc_msgctl.c index 920ed72a3..cc20d7062 100644 --- a/ipc_msgctl.c +++ b/ipc_msgctl.c @@ -40,8 +40,7 @@ print_msqid_ds(struct tcb *const tcp, const kernel_ulong_t addr, int cmd) PRINT_FIELD_UID("{msg_perm={", msqid_ds.msg_perm, uid); PRINT_FIELD_UID(", ", msqid_ds.msg_perm, gid); - tprints(", mode="); - print_numeric_umode_t(msqid_ds.msg_perm.mode); + PRINT_FIELD_NUMERIC_UMODE_T(", ", msqid_ds.msg_perm, mode); if (cmd != IPC_STAT) { tprints("}, ...}"); diff --git a/ipc_shmctl.c b/ipc_shmctl.c index 83e36f342..c06fc4777 100644 --- a/ipc_shmctl.c +++ b/ipc_shmctl.c @@ -40,8 +40,7 @@ print_shmid_ds(struct tcb *const tcp, const kernel_ulong_t addr, int cmd) PRINT_FIELD_UID("{shm_perm={", shmid_ds.shm_perm, uid); PRINT_FIELD_UID(", ", shmid_ds.shm_perm, gid); - tprints(", mode="); - print_numeric_umode_t(shmid_ds.shm_perm.mode); + PRINT_FIELD_NUMERIC_UMODE_T(", ", shmid_ds.shm_perm, mode); if (cmd != IPC_STAT) { tprints("}, ...}"); @@ -136,10 +136,8 @@ print_open_how(struct tcb *tcp, kernel_ulong_t addr, kernel_ulong_t size) tprints("{flags="); tprint_open_modes64(how.flags); - if ((how.flags & (O_CREAT| __O_TMPFILE)) || how.mode) { - tprints(", mode="); - print_numeric_ll_umode_t((unsigned long long) how.mode); - } + if ((how.flags & (O_CREAT| __O_TMPFILE)) || how.mode) + PRINT_FIELD_NUMERIC_UMODE_T(", ", how, mode); PRINT_FIELD_FLAGS(", ", how, resolve, open_resolve_flags, "RESOLVE_???"); diff --git a/print_fields.h b/print_fields.h index d6c96be22..894994597 100644 --- a/print_fields.h +++ b/print_fields.h @@ -244,6 +244,13 @@ print_dev_t((where_).field_); \ } while (0) +# define PRINT_FIELD_NUMERIC_UMODE_T(prefix_, where_, field_) \ + do { \ + STRACE_PRINTF("%s%s=", (prefix_), #field_); \ + print_numeric_ll_umode_t( \ + zero_extend_signed_to_ull((where_).field_)); \ + } while (0) + # define PRINT_FIELD_PTR(prefix_, where_, field_) \ do { \ STRACE_PRINTF("%s%s=", (prefix_), #field_); \ |