From: Dmitry V. Levin Date: Sun, 22 Nov 2015 18:35:27 +0000 (+0000) Subject: Implement kcmp syscall decoding X-Git-Tag: v4.11~124 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7aa9c0d2999671aa018172e41d52a55ddeac1723;p=strace Implement kcmp syscall decoding * kcmp.c: New file. * Makefile.am (strace_SOURCES): Add it. * linux/dummy.h (sys_kcmp): Remove stub alias. * xlat/kcmp_types.in: New file. --- diff --git a/Makefile.am b/Makefile.am index f4271adc..92dbc10b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -82,6 +82,7 @@ strace_SOURCES = \ ipc_sem.c \ ipc_shm.c \ ipc_shmctl.c \ + kcmp.c \ kexec.c \ keyctl.c \ ldt.c \ diff --git a/kcmp.c b/kcmp.c new file mode 100644 index 00000000..aba5a613 --- /dev/null +++ b/kcmp.c @@ -0,0 +1,31 @@ +#include "defs.h" +#include "xlat/kcmp_types.h" + +SYS_FUNC(kcmp) +{ + pid_t pid1 = tcp->u_arg[0]; + pid_t pid2 = tcp->u_arg[1]; + int type = tcp->u_arg[2]; + unsigned long idx1 = tcp->u_arg[3]; + unsigned long idx2 = tcp->u_arg[4]; + + tprintf("%d, %d, ", pid1, pid2); + printxval(kcmp_types, type, "KCMP_???"); + + switch(type) { + case KCMP_FILE: + tprintf(", %u, %u", (unsigned) idx1, (unsigned) idx2); + break; + case KCMP_FILES: + case KCMP_FS: + case KCMP_IO: + case KCMP_SIGHAND: + case KCMP_SYSVSEM: + case KCMP_VM: + break; + default: + tprintf(", %#lx, %#lx", idx1, idx2); + } + + return RVAL_DECODED; +} diff --git a/linux/dummy.h b/linux/dummy.h index 65f6f245..e9947457 100644 --- a/linux/dummy.h +++ b/linux/dummy.h @@ -32,7 +32,6 @@ #endif /* still unfinished */ -#define sys_kcmp printargs #define sys_kexec_file_load printargs #define sys_lookup_dcookie printargs #define sys_name_to_handle_at printargs diff --git a/xlat/kcmp_types.in b/xlat/kcmp_types.in new file mode 100644 index 00000000..4357776c --- /dev/null +++ b/xlat/kcmp_types.in @@ -0,0 +1,7 @@ +KCMP_FILE 0 +KCMP_VM 1 +KCMP_FILES 2 +KCMP_FS 3 +KCMP_SIGHAND 4 +KCMP_IO 5 +KCMP_SYSVSEM 6