Linux arch/arm64 Add system calls

Source: Internet
Author: User

1, add a system call, increase the total number of system calls +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, statement

diff in Kernel/include/linux/syscalls.h

+ + asmlinkage long sys_mysyscall (const char __USER * process)

#endif

3, realize

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 Layer Call

#include <sys/syscall.h>

#define __nr_mysyscall 285

int Ch=syscall (__nr_mysyscall,process);

Linux arch/arm64 Add system calls

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.