1,添加一个系统调用,增加系统总调用数+1
diff in kernel/include/uapi/asm-generic/unistd.h
++ #define __NR_mysyscall 285
++ SYSCALL(__NR_mysyscall, sys_mysyscall)
#undef __NR_syscalls
-- #define __NR_syscalls 285
++ #define __NR_syscalls 286
2,声明
diff in kernel/include/linux/syscalls.h
++ asmlinkage long sys_mysyscall(const char __user * process)
#endif
3,实现
diff in kernel/kernel/sys.c
++ SYSCALL_DEFINE1(mysyscall, const char __user *, process)
++ {
++ struct task_struct * p=current;
++ PRINT_LOG("add syscall %s %s\n",p->comm,process);
++ return 1;
++ }
4,JNI层调用
#include <sys/syscall.h>
#define __NR_mysyscall 285
int ch=syscall(__NR_mysyscall,process);