From cff00de82d37d46b4a1825d1584fb99e14b4f7eb Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Wed, 22 Feb 2012 00:37:58 +0400 Subject: [PATCH] syscalls: Introduce sys_kcmp syscall Though we can use libc's syscall() wrapper I would prefer to have own implementation in case if we will need it in non-libc bindable code. Signed-off-by: Cyrill Gorcunov Acked-by: Pavel Emelyanov --- include/syscall-codes.h | 1 + include/syscall.h | 6 ++++++ include/types.h | 13 +++++++++++++ 3 files changed, 20 insertions(+) diff --git a/include/syscall-codes.h b/include/syscall-codes.h index 2a470c66c..79517713b 100644 --- a/include/syscall-codes.h +++ b/include/syscall-codes.h @@ -51,6 +51,7 @@ #define __NR_restart_syscall 219 #define __NR_msync 227 #define __NR_setns 308 +#define __NR_kcmp 312 #else /* CONFIG_X86_64 */ # error x86-32 bit mode not yet implemented diff --git a/include/syscall.h b/include/syscall.h index f759587c3..a2b1a9ed8 100644 --- a/include/syscall.h +++ b/include/syscall.h @@ -391,6 +391,12 @@ static void sys_set_tid_address(int *tid_addr) { syscall1(__NR_set_tid_address, (long) tid_addr); } +static long always_inline +sys_kcmp(pid_t pid1, pid_t pid2, int type, unsigned long idx1, unsigned long idx2) +{ + return syscall5(__NR_kcmp, (long)pid1, (long)pid2, (long)type, idx1, idx2); +} + #ifndef CLONE_NEWUTS #define CLONE_NEWUTS 0x04000000 #endif diff --git a/include/types.h b/include/types.h index 63799cf8d..0f87b4b93 100644 --- a/include/types.h +++ b/include/types.h @@ -182,4 +182,17 @@ typedef struct { # define PAGE_SIZE 4096 #endif +/* For sys_kcmp */ +enum kcmp_type { + KCMP_FILE, + KCMP_VM, + KCMP_FILES, + KCMP_FS, + KCMP_SIGHAND, + KCMP_IO, + KCMP_SYSVSEM, + + KCMP_TYPES, +}; + #endif /* CR_TYPES_H_ */