diff options
author | Eugene Syromyatnikov <evgsyr@gmail.com> | 2018-02-22 02:44:04 +0100 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2018-03-07 22:07:20 +0000 |
commit | ffcd3a837f734ddf3a55d40117edbb9a7c4e90e2 (patch) | |
tree | ab78dd347468a7cc4e8c7e28fce133020a6f8ad2 | |
parent | 8c209d1ad1e6cb4a4720354394c6c083c3744323 (diff) | |
download | strace-ffcd3a837f734ddf3a55d40117edbb9a7c4e90e2.tar.gz |
bpf: print kern_version in the form of KERNEL_VERSION macro
* bpf.c (DEF_BPF_CMD_DECODER(BPF_PROG_LOAD)): Print
union bpf_attr.kern_version in the form of KERNEL_VERSION macro call.
* tests/bpf.c: Update expected output.
-rw-r--r-- | bpf.c | 5 | ||||
-rw-r--r-- | tests/bpf.c | 7 |
2 files changed, 8 insertions, 4 deletions
@@ -213,7 +213,10 @@ DEF_BPF_CMD_DECODER(BPF_PROG_LOAD) PRINT_FIELD_U(", ", attr, log_level); PRINT_FIELD_U(", ", attr, log_size); PRINT_FIELD_X(", ", attr, log_buf); - PRINT_FIELD_U(", ", attr, kern_version); + tprintf(", kern_version=KERNEL_VERSION(%u, %u, %u)", + attr.kern_version >> 16, + (attr.kern_version >> 8) & 0xFF, + attr.kern_version & 0xFF); PRINT_FIELD_FLAGS(", ", attr, prog_flags, bpf_prog_flags, "BPF_F_???"); decode_attr_extra_data(tcp, data, size, sizeof(attr)); tprints("}"); diff --git a/tests/bpf.c b/tests/bpf.c index 3f963fa3f..a275fded7 100644 --- a/tests/bpf.c +++ b/tests/bpf.c @@ -376,7 +376,7 @@ print_BPF_PROG_LOAD_first(const unsigned long addr) printf("prog_type=BPF_PROG_TYPE_SOCKET_FILTER, insn_cnt=0, insns=0" ", license=NULL, log_level=0, log_size=0, log_buf=0" - ", kern_version=0, prog_flags=0"); + ", kern_version=KERNEL_VERSION(0, 0, 0), prog_flags=0"); } static const struct bpf_insn insns[] = { @@ -411,9 +411,10 @@ print_BPF_PROG_LOAD_attr(const unsigned long addr) { printf("prog_type=BPF_PROG_TYPE_SOCKET_FILTER, insn_cnt=%u, insns=%p" ", license=\"GPL\", log_level=42, log_size=4096, log_buf=%p" - ", kern_version=%u, prog_flags=BPF_F_STRICT_ALIGNMENT", + ", kern_version=KERNEL_VERSION(51966, 240, 13)" + ", prog_flags=BPF_F_STRICT_ALIGNMENT", (unsigned int) ARRAY_SIZE(insns), insns, - log_buf, 0xcafef00d); + log_buf); } # endif /* HAVE_UNION_BPF_ATTR_PROG_FLAGS */ |