Re: please help to implement a simple system call

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

 



On 5/11/06, Soorej P <mr.soorej@xxxxxxxxx> wrote:
ive tried to implement a simple system call: (kernel version 2.6.16) i use
FC4

in kernel/sys.c

 asmlinkage long sys_soorejpid(void)
{
 return current->pid;
}

in arch/i386/kernel/syscall_table.S, after line ".long
sys_unshare" i add
.long sys_soorejpid

in include/asm/unistd.h, after the line "#define NR_syscalls 311" i add
#define __NR_soorejpid          312

compiled and loaded the new kernel.

i made a small C code to check it.


try adding

#include <linux/unistd.h>
#define __NR_soorejpid 312
__syscall0(long,soorejpid)
#include <stdio.h>

main()
{
printf("%ld\n",soorejpid());
}

got a whole lot of errors.. im pasting first few errors here:

syscall.c:2: error: syntax error before 'soorejpid'
In file included from /usr/include/stdio.h:34,
                 from syscall.c:3:
/usr/lib/gcc/i386-redhat-linux/4.0.0/include/stddef.h: In
function
'__syscall0':/usr/lib/gcc/i386-redhat-linux/4.0.0/include/stddef.h:214:
error: storage class
specified for parameter 'size_t'
In file included from /usr/include/stdio.h:36,
                 from syscall.c:3:
/usr/include/bits/types.h:34: error: storage class specified for parameter
'__u_char'
/usr/include/bits/types.h:35: error: storage class specified for parameter
'__u_short'
/usr/include/bits/types.h:36: error: storage class specified for parameter
'__u_int'
/usr/include/bits/types.h:37: error: storage class specified for parameter
'__u_long'

/////////////////////////////

  and how do i know if sys_call_table is already exported in kernel and how
to export it if not.

sys_call_table is not exported, if you want to export it, use
EXPORT_SYMBOL() macro

regards,
Gaurav


///////////////////////////////
Please Help..
~




--
Gaurav
Email: gauravd.chd@xxxxxxxxx
--------------------------------------------
Read my Linux Kernel blog at: http://lkdp.blogspot.com/
--------------------------------------------

--
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