Re: Adding a new system call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I tried to implement a new system call. I used the instructions of
> http://user-mode-linux.sourceforge.net/lksct/index.html
> 
> in the linux kernel 2.6.11.8
> 
> I compiled and I made a program example:
> 
> #include <stdio.h>
> #include <errno.h>
> #include <asm/arch/unistd.h>
> #include <linux/linkage.h>
> 
> _syscall0(int,cloak)
> 
> int main(){
> 
>         printf("Chamando cloak com pid 1\n");
>         cloak();
>         return 0;
> }
> 
> The coak() is supposed to print a message, we could see it using
> dmesg. But, it doesnt happen.
> 
> I also added the system call in the entry.S file.
> 
> What can I do to solve this problem? The sample program runs, but the
> system call has no effect.
> 

1) Add you system call at the bottom of file asm/unistd.h list of sys
calls. Don't forget to update NR_syscalls to the new number of systems
calls.
You should check if /usr/include/asm/unistd.h is linked to
/usr/src/your_path_to_kernel_sources/include/asm/unistd.h. If it is
not linked you should update both files.
2)Add your system call and change the total number of system calls in
arch/i386/kernel/entry.S.
3)Add your code in kerrnel/sys.c or or whereever you want. Recompile the kernel.
4)See man 2 intro for further information on how to call your sys call.

Hope this help ...

Omar

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux