PDA

View Full Version : adding a new system call



glugT
May 11th, 2012, 10:25 AM
hi,

I am trying to add a new custom system call to my kernel.
kernel version 3.4.0.
can anyone give a detailed step by step instruction on how to do it.

lisati
May 11th, 2012, 10:42 AM
Not exactly a task for an absolute beginner?

Thread moved to Programming Talk.

codemaniac
May 11th, 2012, 12:38 PM
You can find the below links useful , however it assumes you are familiar with bulding kernel .
http://www.cs.brynmawr.edu/cs355/howto_add_systemcall.html
http://tldp.org/HOWTO/html_single/Implement-Sys-Call-Linux-2.6-i386/

glugT
May 11th, 2012, 02:40 PM
hi,
sorry for posting it in the absolute beginner.I am not a beginner.And i got how to do it.thanks

lisati
May 11th, 2012, 11:00 PM
hi,
sorry for posting it in the absolute beginner.I am not a beginner.And i got how to do it.thanks

Were the links provided by codemaniac any help?

PeterP24
May 12th, 2012, 12:18 AM
sorry for stepping by - You do realise that this thread will step over in searches for "how to add a new custom system call to Linux kernel"?

So if you found an immediate and nice solution: it is too much to ask you to share it with us?

Thanks!

glugT
May 14th, 2012, 05:11 AM
hi,

I would love to share it.

let the place where you downloaded the kernel be called linux-3.4

First add the system call code to linux-3.4/fs/open.c

and then add your system call number and name in the file syscall_32.tbl which will be in linux-3.4/arch/x86/syscalls/syscall_32.tbl

then build your kernel and boot into it.

glugT
May 14th, 2012, 05:13 AM
Were the links provided by codemaniac any help?


I guess they were for older kernels.I had tried them before.I may have made errors too but they did not seem to work for me.

codemaniac
May 14th, 2012, 08:15 AM
I guess they were for older kernels.I had tried them before.I may have made errors too but they did not seem to work for me.

It was there just to get you started with the basics .
Can you share the errors you are getting while you compile ?

glugT
May 15th, 2012, 09:55 AM
It was there just to get you started with the basics .
Can you share the errors you are getting while you compile ?


The directories and files mentioned were not present in my kernel.the paths were different and in some files were not present.

So the method i had mentioned worked.To add systems call in older kernels like 2.6 leads to many make errors.gcc 4.6 compilers are not compatible with older kernels