strace/fetch_seccomp_fprog.c
Dmitry V. Levin 7a12974e95 Convert parser of seccomp filter program to new mpers infrastructure
* seccomp_fprog.h: New file.
* fetch_seccomp_fprog.c: New file.
* Makefile.am (strace_SOURCES): Add them.
* seccomp.c: Include "seccomp_fprog.h".
(print_seccomp_filter): Use fetch_seccomp_fprog.
2015-09-20 00:02:26 +00:00

25 lines
506 B
C

#include "defs.h"
#include DEF_MPERS_TYPE(seccomp_fprog_t)
#include "seccomp_fprog.h"
typedef struct seccomp_fprog seccomp_fprog_t;
#include MPERS_DEFS
MPERS_PRINTER_DECL(bool, fetch_seccomp_fprog)(struct tcb *tcp, const long addr, void *p)
{
struct seccomp_fprog *pfp = p;
seccomp_fprog_t mfp;
if (sizeof(*pfp) == sizeof(mfp))
return !umove_or_printaddr(tcp, addr, pfp);
if (umove_or_printaddr(tcp, addr, &mfp))
return false;
pfp->len = mfp.len;
pfp->filter = mfp.filter;
return true;
}