Adding system calls to the Linux kernel compare the old and new kernels

Source: Internet
Author: User

2.6 Cores
1> Change the linux-source-2.6.31/kernel/sys.c file, add the system response function at the end of the file. Function implementations such as the following:asmlinkage int Sys_mycall (int number)  {
PRINTK ("This is the first system call I joined");
return number;
 }
2> in linux-source-2.6.31/arch/x86/kernel/syscall_table_32.s add:. Long Sys_mycallsuch as:. Long Sys_mycall/* 341 */
3> joined in the Linux-2.6.31/arch/x86/include/asm/unistd_32.hsuch as:#define __nr_mycall Sequence Number (for example, 341), enter the entry parameters of the system call (note: The ordinal number of the entry is defined in order.) The added number is based on the original maximum value of +1)
4> once again, you can configure the compiler kernel to
latest 3. X Core
1> inAdd a new system call function at the end of the linux-3.8.4/kernel/sys.c filesuch as:asmlinkage int Sys_mycall (int number)  {
PRINTK ("This is the first system call I joined");
return number;
 }2> found unused number No. 223 in ARCH/X86/SYSCALL_32.TBL and replaced it with the following:223 i386 mycallsys_mycall
once again, the 3> compiles to
There is also a method, because the 64-bit operating system is compatible with 32-bit, the following use 64-bit case
1> The first step with the above
2> found system call number No. 313 under ARCH/X86/SYSCALLS/SYSCALL_64.TBL. And then add the number No. 314 to its own interrupt below.such as:314 common mycallsys_mycall once again, the 3> compiles to
Transfer from www.360doc.com/content/13/0502/16/12139495_282464589.html

Adding system calls to the Linux kernel compare the old and new kernels

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.