system call does not work

binoy.jayan at wipro.com binoy.jayan at wipro.com
Thu Oct 10 07:49:29 EDT 2013



Hi Ulka,

You need to add edit two more files.


Add the following in file "arch/x86/include/generated/uapi/asm/unistd_32.h":
#define __NR_helloworld 349


Add the following in "include/linux/syscalls.h" :

asmlinkage long sys_helloworld(void);



Regards,
Binoy Jayan
Mob: +91-9742870916, +91-9745783048

________________________________________
From: kernelnewbies-bounces at kernelnewbies.org [kernelnewbies-bounces at kernelnewbies.org] on behalf of Ulka Vaze [ulka.vaze at l2it.com]
Sent: Thursday, October 10, 2013 4:47 PM
To: Kernelnewbies at kernelnewbies.org
Subject: system call does not work

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

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. 

www.wipro.com



More information about the Kernelnewbies mailing list