pradipta
pradipta

Reputation: 1744

How to implement a simple system call in kernel 2.6.26?

I gone through many questions here and in the other website I still having following questions .

I am implementing a simple system call ,for this the files I have changed as follows

 1. /arch/x86/kernel/syscal_table_32_S
 2. /include/asm-x86/unistd_32.h
 3. /include/linux/syscalls.h

I have doubt in the 2nd file because this ,I am not sure this file(/include/asm-x86/unistd_32.h) to modify or any other file ,as I know the file which containing the system calls number,We have to add our sys call and the last number + 1 ,the doubt here is this file(/include/asm-x86/unistd_32.h) doesn't contain the limit line (#define NR_syscalls <last syscall no + 1>) but there is another file (/include/asm-sh/unistd_32.h),which contain the syscall numbers and also the limit line.

So ,kindly tell me which files to modify with a simple example.

Upvotes: 0

Views: 324

Answers (1)

Alex
Alex

Reputation: 10136

I implemented new syscalls on the linux-kernel 3.2 and modified following files:

1. /arch/x86/kernel/syscal_table_32.S
2. /arch/x86/kernel/syscal_table_64.S
3. /arch/x86/include/asm/unistd_32.h - contains NR_syscalls for ia32
4. /arch/x86/include/asm/unistd_64.h
5. /arch/x86/include/asm/<new_file_with_syscall>
6. /arch/x86/include/asm/Makefile

The syscall itself I called with syscall(NUMBER_OF_SYSCALL) function.

Upvotes: 2

Related Questions