Export print_seccomp_fprog for further use in parser of ptrace syscall
* defs.h (print_seccomp_fprog): New prototype.
* seccomp.c (print_seccomp_fprog): Remove "static" keyword.
Move printing of struct seccomp_fprog fields ...
(print_seccomp_filter): ... here.
diff --git a/defs.h b/defs.h
index a5aff96..a3b1dda 100644
--- a/defs.h
+++ b/defs.h
@@ -652,7 +652,8 @@
extern void tprint_iov_upto(struct tcb *, unsigned long, unsigned long, int decode_iov, unsigned long);
extern void tprint_open_modes(unsigned int);
extern const char *sprint_open_modes(unsigned int);
-extern void print_seccomp_filter(struct tcb *tcp, unsigned long);
+extern void print_seccomp_filter(struct tcb *, unsigned long);
+extern void print_seccomp_fprog(struct tcb *, unsigned long, unsigned short);
struct strace_statfs;
extern void print_struct_statfs(struct tcb *tcp, long);
diff --git a/seccomp.c b/seccomp.c
index 5d972f9..4d8d7e4 100644
--- a/seccomp.c
+++ b/seccomp.c
@@ -171,11 +171,9 @@
return true;
}
-static void
+void
print_seccomp_fprog(struct tcb *tcp, unsigned long addr, unsigned short len)
{
- tprintf("{len=%u, filter=", len);
-
if (abbrev(tcp)) {
printaddr(addr);
} else {
@@ -185,8 +183,6 @@
print_array(tcp, addr, len, &filter, sizeof(filter),
umoven_or_printaddr, print_bpf_filter, &insns);
}
-
- tprints("}");
}
#include "seccomp_fprog.h"
@@ -196,8 +192,11 @@
{
struct seccomp_fprog fprog;
- if (fetch_seccomp_fprog(tcp, addr, &fprog))
+ if (fetch_seccomp_fprog(tcp, addr, &fprog)) {
+ tprintf("{len=%hu, filter=", fprog.len);
print_seccomp_fprog(tcp, fprog.filter, fprog.len);
+ tprints("}");
+ }
}
static void