Where is the system call table in linux kernel?

I read Robert Love's Linux Kernel Development, and one of the exercises he does is create a system call (p. 106). The problem is that I cannot find the system call table file in version 3.9 for the x86_32 architecture. I know that it uses version 2.6.xx, but I do not know if this version will work with the distribution that I use, since it is quite old, so I would prefer v3.9.

Additional Information: The control I'm talking about is the following: Add an entry to the end of the system call table. This must be done for each architecture that supports a system call (which for most calls is all architecture). The position of the scale in the table, starting from zero, is the number of its system call. For example, the tenth entry in the list is assigned the number of the ninth scale.

It was decided to use the following approach: The system call table is located in arch / x86 / syscalls / syscall_32.tbl for the x86 architecture. Thanks to Sudip Mukherjee for your help.

Another approach is: http://lists.kernelnewbies.org/pipermail/kernelnewbies/2013-July/008598.html Thanks to Shrinivas Ganji for his help.

+6
source share
3 answers

From linux kernel 4.2, the system call table was moved from arch/x86/syscalls/syscall_64.tbl to arch/x86/entry/syscalls/syscall_64.tbl

Here is the corresponding commit :

 commit 1f57d5d85ba7f1f467173ff33f51d01a91f9aaf1 Author: Ingo Molnar < mingo@kernel.org > Date: Wed Jun 3 18:36:41 2015 +0200 x86/asm/entry: Move the arch/x86/syscalls/ definitions to arch/x86/entry/syscalls/ The build time generated syscall definitions are entry code related, move them into the arch/x86/entry/ directory. 
+8
source

Create a test folder in the root src: src/linux-3.4/testing/ , then paste it into this folder:
- file containing syscall code: strcpy.c

 #include <linux/linkage.h> #include <linux/kernel.h> asmlinkage long sys_strcpy(char *dest, char *src) { int i=0; while(src[i]!='\0') { dest[i]=src[i++]; } dest[i]='\0'; printk(" Done it "); return 0; } 

and a Makefile that contains only the following line:

 obj-y:=strcpy.o 

Add an entry to the syscall table and the function prototype:
- edit the src/linux-3.4/arch/x86/syscalls/syscall_32.tbl , adding this line to record 223, free

  223 i386 strcpy sys_strcpy 

Edit the src/linux-3.4/include/linux/syscalls.h file by adding a function prototype

 asmlinkage long sys_strcpy(char *dest, char *src); 

Edit the main Makefile in the src root ( src/linux-3.4/Makefile ), adding the previously created test folder, as shown below:

 core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ testing/ 
+6
source

A similar question about SO, where the OP seems to have solved it:

New syscall not found (linux kernel 3.0.0), where should I start looking?

The file looks like arch/x86/kernel/syscall_table_32.c .

0
source

Source: https://habr.com/ru/post/949459/


All Articles