system call does not work

Ulka Vaze ulka.vaze at l2it.com
Thu Oct 10 07:17:03 EDT 2013


Hi All,

I have Implemented sample system call on tree 3.4.6
Following are the steps i did -
- >I created directory hello in kernel sources base directory i.e
/usr/src/kernels/linux3.4.6/hello

-> I have created hello.c file in which i added system call definition
#include <linux/kernel.h>
asmlinkage long sys_helloworld()
{
    printk(KERN_NOTICE "\n hello system call ");
   return 0;
}

In makefile
obj-y:= hello.c
In main makefile added directory in core-y

-> In syscall tabel  arch/x86/syscalls/syscall_32.tbl
added -
349 i386 helloworld sys_helloworld

Then compiled the kernel and installed it.
However when i run application strace ouput shows enosys(function not
implemneted)

application as below

int main()
{
   syscall(349)
   return 0;
}

strace shows
SYS_349(0x1000,0x804843b,..,..,0)=-1 ENOSYS(function not implemneted)

I checked /proc/kallsyms it shows the sys_helloworld symbol
I also tried adding entry in syscall_64.tbl as common though i am
running 32 bit kernel.
gdb syscall 349 doesnot give anything

Can anyone tell what is wrong here ?

Thanks,
-Ulka

-- 
Director
L2IT -Learn & Leverage Information Technology
Leading Professional Training Institute in Pune
www.l2it.com



More information about the Kernelnewbies mailing list