summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabrice Le Fessant <fabrice.le_fessant@ocamlpro.com>2022-10-18 11:23:15 +0200
committerDmitry V. Levin <ldv@strace.io>2022-12-17 08:00:00 +0000
commita6e43b0be3bdc6d1098da70b079f016be2454c75 (patch)
tree32b6ad1a5dba03114581d7b3f98930fa343f7b92
parent75318579cb1b8c7ff42e3f4254b4133d23c7a937 (diff)
downloadstrace-a6e43b0be3bdc6d1098da70b079f016be2454c75.tar.gz
src: introduce tprint_flags_begin and tprint_flags_end helpers
* src/print_fields.h (tprint_flags_begin, tprint_flags_end): New functions. (PRINT_FIELD_FLAGS_VERBOSE): Use them. * src/bpf_filter.c (print_bpf_filter_code): Likewise. * src/bpf_seccomp_filter.c (print_seccomp_filter_k): Likewise. * src/capability.c (print_cap_bits): Likewise. * src/clone.c (SYS_FUNC(clone), SYS_FUNC(clone3)): Likewise. * src/fanotify.c (SYS_FUNC(fanotify_init)): Likewise. * src/futex.c (do_futex): Likewise. * src/ioctl.c (ioctl_print_code): Likewise. * src/ipc.c (SYS_FUNC(ipc)): Likewise. * src/ipc_defs.h (PRINTCTL): Likewise. * src/ipc_msg.c (SYS_FUNC(msgget)): Likewise. * src/ipc_sem.c (SYS_FUNC(semget)): Likewise. * src/ipc_shm.c (SYS_FUNC(shmget)): Likewise. * src/kd_ioctl.c (kd_mk_tone): Likewise. * src/kexec.c (SYS_FUNC(kexec_load)): Likewise. * src/mem.c (print_mmap_flags): Likewise. * src/memfd_create.c (SYS_FUNC(memfd_create)): Likewise. * src/mount.c (SYS_FUNC(mount)): Likewise. * src/net.c (tprint_sock_type): Likewise. * src/netlink.c (decode_nlmsg_type_netfilter, decode_nlmsg_flags): Likewise. * src/nlattr.c (print_nlattr, decode_nla_flags): Likewise. * src/numa.c (print_mode): Likewise. * src/perf.c (print_perf_event_attr): Likewise. * src/personality.c (SYS_FUNC(personality)): Likewise. * src/sched.c (SYS_FUNC(sched_getattr)): Likewise. * src/scsi.c (scsi_ioctl): Likewise. * src/statx.c (SYS_FUNC(statx)): Likewise. * src/swapon.c (SYS_FUNC(swapon)): Likewise. * src/tee.c (tee_print_param_fn): Likewise. * src/term.c (decode_oflag, decode_cflag): Likewise. * src/v4l2.c (print_v4l2_buffer_flags, print_v4l2_cid): Likewise. * src/wait.c (printstatus): Likewise. Co-authored-by: Dmitry V. Levin <ldv@strace.io>
-rw-r--r--src/bpf_filter.c2
-rw-r--r--src/bpf_seccomp_filter.c2
-rw-r--r--src/capability.c2
-rw-r--r--src/clone.c4
-rw-r--r--src/fanotify.c2
-rw-r--r--src/futex.c2
-rw-r--r--src/ioctl.c2
-rw-r--r--src/ipc.c3
-rw-r--r--src/ipc_defs.h2
-rw-r--r--src/ipc_msg.c2
-rw-r--r--src/ipc_sem.c2
-rw-r--r--src/ipc_shm.c2
-rw-r--r--src/kd_ioctl.c2
-rw-r--r--src/kexec.c2
-rw-r--r--src/mem.c4
-rw-r--r--src/memfd_create.c4
-rw-r--r--src/mount.c2
-rw-r--r--src/net.c2
-rw-r--r--src/netlink.c4
-rw-r--r--src/nlattr.c4
-rw-r--r--src/numa.c2
-rw-r--r--src/perf.c4
-rw-r--r--src/personality.c2
-rw-r--r--src/print_fields.h14
-rw-r--r--src/sched.c10
-rw-r--r--src/scsi.c2
-rw-r--r--src/statx.c2
-rw-r--r--src/swapon.c2
-rw-r--r--src/tee.c2
-rw-r--r--src/term.c4
-rw-r--r--src/v4l2.c6
-rw-r--r--src/wait.c3
32 files changed, 100 insertions, 4 deletions
diff --git a/src/bpf_filter.c b/src/bpf_filter.c
index e0815b2c2..61ab06acf 100644
--- a/src/bpf_filter.c
+++ b/src/bpf_filter.c
@@ -36,6 +36,7 @@ print_bpf_filter_code(const uint16_t code, bool extended)
const struct xlat *mode = extended ? ebpf_mode : bpf_mode;
uint16_t i = code & ~BPF_CLASS(code);
+ tprint_flags_begin();
printxval(extended ? ebpf_class : bpf_class, BPF_CLASS(code),
"BPF_???");
switch (BPF_CLASS(code)) {
@@ -106,6 +107,7 @@ print_bpf_filter_code(const uint16_t code, bool extended)
break;
}
+ tprint_flags_end();
}
static void
diff --git a/src/bpf_seccomp_filter.c b/src/bpf_seccomp_filter.c
index 82188f5c2..038dd3133 100644
--- a/src/bpf_seccomp_filter.c
+++ b/src/bpf_seccomp_filter.c
@@ -22,11 +22,13 @@ print_seccomp_filter_k(const struct bpf_filter_block *const fp)
unsigned int action = SECCOMP_RET_ACTION_FULL & fp->k;
unsigned int data = fp->k & ~action;
+ tprint_flags_begin();
printxval(seccomp_ret_action, action, "SECCOMP_RET_???");
if (data) {
tprint_flags_or();
PRINT_VAL_X(data);
}
+ tprint_flags_end();
return true;
}
diff --git a/src/capability.c b/src/capability.c
index 9ef5dac5d..1d4bf899c 100644
--- a/src/capability.c
+++ b/src/capability.c
@@ -78,6 +78,7 @@ print_cap_header(struct tcb *const tcp, const kernel_ulong_t addr,
static void
print_cap_bits(const uint32_t lo, const uint32_t hi)
{
+ tprint_flags_begin();
if (lo || !hi)
printflags(cap_mask0, lo, "CAP_???");
@@ -86,6 +87,7 @@ print_cap_bits(const uint32_t lo, const uint32_t hi)
tprint_flags_or();
printflags(cap_mask1, hi, "CAP_???");
}
+ tprint_flags_end();
}
static void
diff --git a/src/clone.c b/src/clone.c
index 65c71bb7f..f77538636 100644
--- a/src/clone.c
+++ b/src/clone.c
@@ -87,11 +87,13 @@ SYS_FUNC(clone)
#endif
tprints_arg_name("flags");
if (flags) {
+ tprint_flags_begin();
printflags64(clone_flags, flags, "CLONE_???");
if (sig) {
tprint_flags_or();
printsignal(sig);
}
+ tprint_flags_end();
} else {
printsignal(sig);
}
@@ -165,8 +167,10 @@ SYS_FUNC(clone3)
tprint_struct_begin();
tprints_field_name("flags");
+ tprint_flags_begin();
printflags_ex(arg.flags, "CLONE_???", XLAT_STYLE_DEFAULT,
clone_flags, clone3_flags, NULL);
+ tprint_flags_end();
if (arg.flags & CLONE_PIDFD) {
tprint_struct_next();
diff --git a/src/fanotify.c b/src/fanotify.c
index 606f5cf10..36126d643 100644
--- a/src/fanotify.c
+++ b/src/fanotify.c
@@ -23,12 +23,14 @@ SYS_FUNC(fanotify_init)
/* flags */
unsigned int flags = tcp->u_arg[0];
+ tprint_flags_begin();
printxval(fan_classes, flags & FAN_ALL_CLASS_BITS, "FAN_CLASS_???");
flags &= ~FAN_ALL_CLASS_BITS;
if (flags) {
tprint_flags_or();
printflags(fan_init_flags, flags, "FAN_???");
}
+ tprint_flags_end();
tprint_arg_next();
/* event_f_flags */
diff --git a/src/futex.c b/src/futex.c
index 483ad14b5..ac2c7ffd8 100644
--- a/src/futex.c
+++ b/src/futex.c
@@ -111,6 +111,7 @@ do_futex(struct tcb *const tcp, const print_obj_by_addr_fn print_ts)
printaddr(uaddr2);
tprint_arg_next();
+ tprint_flags_begin();
if ((val3 >> 28) & FUTEX_OP_OPARG_SHIFT) {
tprint_shift_begin();
print_xlat(FUTEX_OP_OPARG_SHIFT);
@@ -142,6 +143,7 @@ do_futex(struct tcb *const tcp, const print_obj_by_addr_fn print_ts)
tprints_comment(comment);
tprint_flags_or();
PRINT_VAL_X(val3 & 0xfff);
+ tprint_flags_end();
break;
case FUTEX_WAIT_REQUEUE_PI:
tprint_arg_next();
diff --git a/src/ioctl.c b/src/ioctl.c
index 5d97c2f51..33f0deca9 100644
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -78,9 +78,11 @@ ioctl_print_code(const unsigned int code)
tprints_arg_begin("_IOC");
+ tprint_flags_begin();
printflags_ex(_IOC_DIR(code), abbrev ? "_IOC_???" : "",
abbrev ? XLAT_STYLE_DEFAULT : XLAT_STYLE_ABBREV,
ioctl_dirs, NULL);
+ tprint_flags_end();
tprint_arg_next();
PRINT_VAL_X(_IOC_TYPE(code));
diff --git a/src/ipc.c b/src/ipc.c
index 277e5fb24..c9ccf2687 100644
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -15,6 +15,7 @@ SYS_FUNC(ipc)
unsigned int version = call >> 16;
call &= 0xffff;
+ tprint_flags_begin();
if (version) {
tprint_shift_begin();
PRINT_VAL_U(version);
@@ -23,8 +24,8 @@ SYS_FUNC(ipc)
tprint_shift_end();
tprint_flags_or();
}
-
printxval_u(ipccalls, call, NULL);
+ tprint_flags_end();
for (unsigned int i = 1; i < n_args(tcp); ++i) {
tprint_arg_next();
diff --git a/src/ipc_defs.h b/src/ipc_defs.h
index 8b7c4c8df..757a8fa99 100644
--- a/src/ipc_defs.h
+++ b/src/ipc_defs.h
@@ -61,11 +61,13 @@
# define PRINTCTL(flagset, arg, dflt) \
do { \
+ tprint_flags_begin(); \
if ((arg) & IPC_64) { \
print_xlat(IPC_64); \
tprint_flags_or(); \
} \
printxval((flagset), (arg) & ~IPC_64, dflt); \
+ tprint_flags_end(); \
} while (0)
#endif /* !STRACE_IPC_DEFS_H */
diff --git a/src/ipc_msg.c b/src/ipc_msg.c
index 88ac4e7c1..91f8d5f1a 100644
--- a/src/ipc_msg.c
+++ b/src/ipc_msg.c
@@ -27,9 +27,11 @@ SYS_FUNC(msgget)
tprint_arg_next();
/* msgflg */
+ tprint_flags_begin();
if (printflags(resource_flags, tcp->u_arg[1] & ~0777, NULL) != 0)
tprint_flags_or();
print_numeric_umode_t(tcp->u_arg[1] & 0777);
+ tprint_flags_end();
return RVAL_DECODED;
}
diff --git a/src/ipc_sem.c b/src/ipc_sem.c
index 63fbc2bbf..abca5c9ab 100644
--- a/src/ipc_sem.c
+++ b/src/ipc_sem.c
@@ -112,8 +112,10 @@ SYS_FUNC(semget)
tprint_arg_next();
/* semflg */
+ tprint_flags_begin();
if (printflags(resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
tprint_flags_or();
print_numeric_umode_t(tcp->u_arg[2] & 0777);
+ tprint_flags_end();
return RVAL_DECODED;
}
diff --git a/src/ipc_shm.c b/src/ipc_shm.c
index e211d09ce..62da796ca 100644
--- a/src/ipc_shm.c
+++ b/src/ipc_shm.c
@@ -43,6 +43,7 @@ SYS_FUNC(shmget)
const unsigned int hugetlb_value = flags & mask;
flags &= ~mask;
+ tprint_flags_begin();
if (flags || !hugetlb_value)
printflags(shm_resource_flags, flags, NULL);
@@ -59,6 +60,7 @@ SYS_FUNC(shmget)
if (flags || hugetlb_value)
tprint_flags_or();
print_numeric_umode_t(tcp->u_arg[2] & 0777);
+ tprint_flags_end();
return RVAL_DECODED;
}
diff --git a/src/kd_ioctl.c b/src/kd_ioctl.c
index c9c7cfd61..44b3ddd0c 100644
--- a/src/kd_ioctl.c
+++ b/src/kd_ioctl.c
@@ -91,6 +91,7 @@ kd_mk_tone(struct tcb *const tcp, const unsigned int arg)
unsigned int freq = ticks && count ? KERNEL_PIT_TICK_RATE / count : 0;
tprint_arg_next();
+ tprint_flags_begin();
if (ticks) {
tprint_shift_begin();
PRINT_VAL_U(ticks);
@@ -100,6 +101,7 @@ kd_mk_tone(struct tcb *const tcp, const unsigned int arg)
tprint_flags_or();
}
PRINT_VAL_U(count);
+ tprint_flags_end();
if (xlat_verbose(xlat_verbosity) != XLAT_STYLE_RAW) {
if (freq)
diff --git a/src/kexec.c b/src/kexec.c
index 566d8b93b..bf74c9c82 100644
--- a/src/kexec.c
+++ b/src/kexec.c
@@ -75,12 +75,14 @@ SYS_FUNC(kexec_load)
/* flags */
kernel_ulong_t n = tcp->u_arg[3];
+ tprint_flags_begin();
printxval64(kexec_arch_values, n & KEXEC_ARCH_MASK, "KEXEC_ARCH_???");
n &= ~(kernel_ulong_t) KEXEC_ARCH_MASK;
if (n) {
tprint_flags_or();
printflags64(kexec_load_flags, n, "KEXEC_???");
}
+ tprint_flags_end();
return RVAL_DECODED;
}
diff --git a/src/mem.c b/src/mem.c
index ee919d291..38695a578 100644
--- a/src/mem.c
+++ b/src/mem.c
@@ -65,6 +65,8 @@ print_mmap_flags(kernel_ulong_t flags)
if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE)
tprint_comment_begin();
+ tprint_flags_begin();
+
printxvals_ex(flags & MAP_TYPE, "MAP_???", XLAT_STYLE_ABBREV,
mmap_flags, NULL);
flags &= ~MAP_TYPE;
@@ -92,6 +94,8 @@ print_mmap_flags(kernel_ulong_t flags)
tprint_shift_end();
}
+ tprint_flags_end();
+
if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE)
tprint_comment_end();
}
diff --git a/src/memfd_create.c b/src/memfd_create.c
index 68eb48781..8e9faeb0c 100644
--- a/src/memfd_create.c
+++ b/src/memfd_create.c
@@ -36,6 +36,8 @@ SYS_FUNC(memfd_create)
const unsigned int hugetlb_value = flags & mask;
flags &= ~mask;
+ tprint_flags_begin();
+
if (flags || !hugetlb_value)
printflags_ex(flags, "MFD_???", XLAT_STYLE_ABBREV,
memfd_create_flags, NULL);
@@ -54,6 +56,8 @@ SYS_FUNC(memfd_create)
tprint_shift_end();
}
+ tprint_flags_end();
+
if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE)
tprint_comment_end();
diff --git a/src/mount.c b/src/mount.c
index a76e21ca2..28fcdef93 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -53,6 +53,7 @@ SYS_FUNC(mount)
tprint_arg_next();
/* mountflags */
+ tprint_flags_begin();
if (old_magic) {
print_xlat(MS_MGC_VAL);
if (flags)
@@ -60,6 +61,7 @@ SYS_FUNC(mount)
}
if (flags || !old_magic)
printflags64(mount_flags, flags, "MS_???");
+ tprint_flags_end();
tprint_arg_next();
/* data */
diff --git a/src/net.c b/src/net.c
index 4694fcd4d..6c8746661 100644
--- a/src/net.c
+++ b/src/net.c
@@ -95,6 +95,7 @@ tprint_sock_type(unsigned int flags)
{
const char *str = xlookup(socktypes, flags & SOCK_TYPE_MASK);
+ tprint_flags_begin();
if (str) {
print_xlat_ex(flags & SOCK_TYPE_MASK, str, XLAT_STYLE_DEFAULT);
flags &= ~SOCK_TYPE_MASK;
@@ -103,6 +104,7 @@ tprint_sock_type(unsigned int flags)
tprint_flags_or();
}
printflags(sock_type_flags, flags, "SOCK_???");
+ tprint_flags_end();
}
SYS_FUNC(socket)
diff --git a/src/netlink.c b/src/netlink.c
index fb136feca..7f56fa3aa 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -178,6 +178,7 @@ decode_nlmsg_type_netfilter(struct tcb *tcp, const struct xlat *const xlat,
const uint8_t subsys_id = (uint8_t) (type >> 8);
const uint8_t msg_type = (uint8_t) type;
+ tprint_flags_begin();
tprint_shift_begin();
printxval(xlat, subsys_id, dflt);
tprint_shift();
@@ -190,6 +191,7 @@ decode_nlmsg_type_netfilter(struct tcb *tcp, const struct xlat *const xlat,
msg_type, nf_nlmsg_types[subsys_id].dflt);
else
PRINT_VAL_X(msg_type);
+ tprint_flags_end();
}
typedef void (*nlmsg_types_decoder_t)(struct tcb *, const struct xlat *,
@@ -449,8 +451,10 @@ decode_nlmsg_flags(const uint16_t flags, const uint16_t type,
} else if (family < ARRAY_SIZE(nlmsg_flags) && nlmsg_flags[family])
table = nlmsg_flags[family](type);
+ tprint_flags_begin();
printflags_ex(flags, "NLM_F_???", XLAT_STYLE_DEFAULT,
netlink_flags, table, NULL);
+ tprint_flags_end();
}
static void
diff --git a/src/nlattr.c b/src/nlattr.c
index 638cbbc5f..a9db9576b 100644
--- a/src/nlattr.c
+++ b/src/nlattr.c
@@ -53,6 +53,7 @@ print_nlattr(const struct nlattr *const nla,
PRINT_FIELD_U(*nla, nla_len);
tprint_struct_next();
tprints_field_name("nla_type");
+ tprint_flags_begin();
if (nla->nla_type & NLA_F_NESTED) {
print_xlat(NLA_F_NESTED);
tprint_flags_or();
@@ -62,6 +63,7 @@ print_nlattr(const struct nlattr *const nla,
tprint_flags_or();
}
printxval(table, nla->nla_type & NLA_TYPE_MASK, dflt);
+ tprint_flags_end();
tprint_struct_end();
}
@@ -418,7 +420,9 @@ decode_nla_flags(struct tcb *const tcp,
data = opts->process_fn(data);
if (opts->fn_str)
tprints_arg_begin(opts->fn_str);
+ tprint_flags_begin();
printflags_ex(data, opts->dflt, opts->style, opts->xlat, NULL);
+ tprint_flags_end();
if (opts->fn_str)
tprint_arg_end();
}
diff --git a/src/numa.c b/src/numa.c
index 0c9cd3ec5..32aee6245 100644
--- a/src/numa.c
+++ b/src/numa.c
@@ -95,9 +95,11 @@ print_mode(struct tcb *const tcp, const kernel_ulong_t mode_arg)
if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE)
tprint_comment_begin();
+ tprint_flags_begin();
tprints(mode_str);
tprint_flags_or();
printflags_ex(flags, NULL, XLAT_STYLE_ABBREV, mpol_mode_flags, NULL);
+ tprint_flags_end();
if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE)
tprint_comment_end();
diff --git a/src/perf.c b/src/perf.c
index 49a406850..76c4fab08 100644
--- a/src/perf.c
+++ b/src/perf.c
@@ -157,6 +157,7 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr)
*/
tprint_struct_next();
tprints_field_name("config");
+ tprint_flags_begin();
if (attr->config >> 32) {
tprint_shift_begin();
PRINT_VAL_X(attr->config >> 32);
@@ -167,6 +168,7 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr)
}
printxval(perf_hw_id, attr->config & PERF_HW_EVENT_MASK,
"PERF_COUNT_HW_???");
+ tprint_flags_end();
break;
case PERF_TYPE_SOFTWARE:
tprint_struct_next();
@@ -192,6 +194,7 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr)
*/
tprint_struct_next();
tprints_field_name("config");
+ tprint_flags_begin();
if (attr->config >> 32){
tprint_shift_begin();
PRINT_VAL_X(attr->config >> 32);
@@ -227,6 +230,7 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr)
tprint_flags_or();
printxval(perf_hw_cache_id, attr->config & 0xFF,
"PERF_COUNT_HW_CACHE_???");
+ tprint_flags_end();
break;
case PERF_TYPE_RAW:
/*
diff --git a/src/personality.c b/src/personality.c
index 99d7558c3..6a60753ba 100644
--- a/src/personality.c
+++ b/src/personality.c
@@ -20,12 +20,14 @@ SYS_FUNC(personality)
if (0xffffffff == pers) {
PRINT_VAL_X(0xffffffff);
} else {
+ tprint_flags_begin();
printxval(personality_types, pers & PER_MASK, "PER_???");
pers &= ~PER_MASK;
if (pers) {
tprint_flags_or();
printflags(personality_flags, pers, NULL);
}
+ tprint_flags_end();
}
return 0;
}
diff --git a/src/print_fields.h b/src/print_fields.h
index ab1810ed7..38a0f15c1 100644
--- a/src/print_fields.h
+++ b/src/print_fields.h
@@ -226,12 +226,22 @@ tprint_shift(void)
}
static inline void
+tprint_flags_begin(void)
+{
+}
+
+static inline void
tprint_flags_or(void)
{
STRACE_PRINTS("|");
}
static inline void
+tprint_flags_end(void)
+{
+}
+
+static inline void
tprint_plus(void)
{
STRACE_PRINTS("+");
@@ -408,11 +418,13 @@ tprints_arg_begin(const char *name)
# define PRINT_FIELD_FLAGS_VERBOSE(where_, field_, xlat_, dflt_) \
do { \
tprints_field_name(#field_); \
+ tprint_flags_begin(); \
printflags_ex(zero_extend_signed_to_ull((where_).field_), \
(dflt_), \
xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW \
? XLAT_STYLE_RAW : XLAT_STYLE_VERBOSE, \
- (xlat_), NULL); \
+ (xlat_), NULL); \
+ tprint_flags_end(); \
} while (0)
# define PRINT_FIELD_XVAL(where_, field_, xlat_, dflt_) \
diff --git a/src/sched.c b/src/sched.c
index acd4d32cf..057d482b1 100644
--- a/src/sched.c
+++ b/src/sched.c
@@ -235,10 +235,16 @@ SYS_FUNC(sched_getattr)
* as on other architectures. For more details see
* https://lists.strace.io/pipermail/strace-devel/2017-March/006085.html
*/
- if (syserror(tcp))
+ if (syserror(tcp)) {
+ tprint_flags_begin();
print_abnormal_hi(tcp->u_arg[2]);
+ PRINT_VAL_U(size);
+ tprint_flags_end();
+ } else
#endif
- PRINT_VAL_U(size);
+ {
+ PRINT_VAL_U(size);
+ }
tprint_arg_next();
/* flags */
diff --git a/src/scsi.c b/src/scsi.c
index 128047186..15e01137e 100644
--- a/src/scsi.c
+++ b/src/scsi.c
@@ -107,6 +107,7 @@ scsi_ioctl(struct tcb *const tcp, const unsigned int code,
tprint_arg_next();
if (!umove_or_printaddr(tcp, arg, &val)) {
tprint_indirect_begin();
+ tprint_flags_begin();
if (val & SG_SCSI_RESET_NO_ESCALATE) {
printxval(sg_scsi_reset,
SG_SCSI_RESET_NO_ESCALATE, 0);
@@ -115,6 +116,7 @@ scsi_ioctl(struct tcb *const tcp, const unsigned int code,
printxval(sg_scsi_reset,
val & ~SG_SCSI_RESET_NO_ESCALATE,
"SG_SCSI_RESET_???");
+ tprint_flags_end();
tprint_indirect_end();
}
diff --git a/src/statx.c b/src/statx.c
index 8af2969e3..f3896af2e 100644
--- a/src/statx.c
+++ b/src/statx.c
@@ -40,6 +40,7 @@ SYS_FUNC(statx)
/* flags */
unsigned int flags = tcp->u_arg[2];
+ tprint_flags_begin();
printflags(at_statx_sync_types, flags & AT_STATX_SYNC_TYPE,
NULL);
flags &= ~AT_STATX_SYNC_TYPE;
@@ -47,6 +48,7 @@ SYS_FUNC(statx)
tprint_flags_or();
printflags(at_flags, flags, NULL);
}
+ tprint_flags_end();
tprint_arg_next();
/* mask */
diff --git a/src/swapon.c b/src/swapon.c
index 9d7632f6c..3c92eebd6 100644
--- a/src/swapon.c
+++ b/src/swapon.c
@@ -22,11 +22,13 @@ SYS_FUNC(swapon)
tprint_arg_next();
/* swapflags */
+ tprint_flags_begin();
if (flags) {
printflags(swap_flags, flags, "SWAP_FLAG_???");
tprint_flags_or();
}
PRINT_VAL_U(prio);
+ tprint_flags_end();
return RVAL_DECODED;
}
diff --git a/src/tee.c b/src/tee.c
index 39ad05524..b1d135217 100644
--- a/src/tee.c
+++ b/src/tee.c
@@ -101,6 +101,7 @@ tee_print_param_fn(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data
tprint_struct_begin();
tprints_field_name("attr");
+ tprint_flags_begin();
printxval(tee_ioctl_param_attr_types,
param->attr & ~TEE_IOCTL_PARAM_ATTR_META,
"TEE_IOCTL_PARAM_ATTR_");
@@ -108,6 +109,7 @@ tee_print_param_fn(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data
tprint_flags_or();
tprints("TEE_IOCTL_PARAM_ATTR_META");
}
+ tprint_flags_end();
switch (param->attr) {
case TEE_IOCTL_PARAM_ATTR_TYPE_NONE:
diff --git a/src/term.c b/src/term.c
index 7c9d3c536..54618c286 100644
--- a/src/term.c
+++ b/src/term.c
@@ -56,6 +56,7 @@ decode_oflag(uint64_t val)
{ term_oflags_ffdly, FFDLY, "FF?" },
};
+ tprint_flags_begin();
for (unsigned int i = 0; i < ARRAY_SIZE(xlats); i++) {
printxval64(xlats[i].xl, val & xlats[i].mask, xlats[i].dfl);
tprint_flags_or();
@@ -64,11 +65,13 @@ decode_oflag(uint64_t val)
}
printflags64(term_oflags, val, NULL);
+ tprint_flags_end();
}
static void
decode_cflag(uint64_t val)
{
+ tprint_flags_begin();
printxval64(baud_options, val & CBAUD, "B???");
tprint_flags_or();
@@ -86,6 +89,7 @@ decode_cflag(uint64_t val)
val &= ~(CBAUD | CIBAUD | CSIZE);
printflags64(term_cflags, val, NULL);
+ tprint_flags_end();
}
static void
diff --git a/src/v4l2.c b/src/v4l2.c
index 90d1eeca8..c87bdc6fe 100644
--- a/src/v4l2.c
+++ b/src/v4l2.c
@@ -503,6 +503,7 @@ print_v4l2_buffer_flags(uint32_t val)
return;
}
+ tprint_flags_begin();
if (flags) {
printflags(v4l2_buf_flags, flags, "V4L2_BUF_FLAG_???");
tprint_flags_or();
@@ -512,6 +513,7 @@ print_v4l2_buffer_flags(uint32_t val)
tprint_flags_or();
printxval(v4l2_buf_flags_ts_src, ts_src,
"V4L2_BUF_FLAG_TSTAMP_SRC_???");
+ tprint_flags_end();
}
#define PRINT_FIELD_V4L2_BUFFER_FLAGS(where_, field_) \
@@ -809,6 +811,7 @@ print_v4l2_cid(uint32_t cid, bool next_flags)
return;
}
+ tprint_flags_begin();
if (next_flags) {
uint32_t flags = cid & v4l2_control_query_flags->flags_mask;
@@ -824,6 +827,7 @@ print_v4l2_cid(uint32_t cid, bool next_flags)
if (id_name) {
print_xlat_ex(cid, id_name, XLAT_STYLE_DEFAULT);
+ tprint_flags_end();
return;
}
@@ -832,6 +836,7 @@ print_v4l2_cid(uint32_t cid, bool next_flags)
if (!class_str || (cid - class_id) >= 0x10000) {
print_xlat_ex(cid, "V4L2_CID_???", PXF_DEFAULT_STR);
+ tprint_flags_end();
return;
}
@@ -843,6 +848,7 @@ print_v4l2_cid(uint32_t cid, bool next_flags)
xsprintf(tmp_str, "%s+%#" PRIx64, class_str, cid - class_id);
print_xlat_ex(cid, tmp_str, XLAT_STYLE_DEFAULT);
+ tprint_flags_end();
}
#define PRINT_FIELD_V4L2_CID(where_, field_, next_) \
diff --git a/src/wait.c b/src/wait.c
index 09a8a8916..4c1715db8 100644
--- a/src/wait.c
+++ b/src/wait.c
@@ -32,6 +32,7 @@ printstatus(int status)
* are no wait status constructors it will have to do.
*/
tprint_indirect_begin();
+ tprint_flags_begin();
if (WIFSTOPPED(status)) {
int sig = WSTOPSIG(status);
tprintf("{WIFSTOPPED(s) && WSTOPSIG(s) == %s%s}",
@@ -57,6 +58,7 @@ printstatus(int status)
#endif
else {
PRINT_VAL_X(status);
+ tprint_flags_end();
tprint_indirect_end();
return 0;
}
@@ -77,6 +79,7 @@ printstatus(int status)
PRINT_VAL_X(status);
}
}
+ tprint_flags_end();
tprint_indirect_end();
return exited;