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.
This commit is contained in:
Дмитрий Левин 2016-05-12 14:23:50 +00:00
parent 01d16ccb96
commit 50a26514a5
2 changed files with 7 additions and 7 deletions

3
defs.h
View File

@ -652,7 +652,8 @@ extern void tprint_iov(struct tcb *, unsigned long, unsigned long, int decode_io
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);

View File

@ -171,11 +171,9 @@ print_bpf_filter(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
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_seccomp_fprog(struct tcb *tcp, unsigned long addr, unsigned short len)
print_array(tcp, addr, len, &filter, sizeof(filter),
umoven_or_printaddr, print_bpf_filter, &insns);
}
tprints("}");
}
#include "seccomp_fprog.h"
@ -196,8 +192,11 @@ print_seccomp_filter(struct tcb *tcp, unsigned long addr)
{
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