Re: which number to use for new system call ?

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

 



On Sun, 27 Mar 2005 22:12:22 -0800 (PST), linux lover
<linux_lover2004@xxxxxxxxx> wrote:
> Hello all,
>        How to resolve new system call number
> assignments. On Fedora Core 1 i got next
>  .long SYMBOL_NAME(sys_myservice)       /*259*/
>  number in entry.S
> Also  for include/asm/unistd.h gives me
>  #define __NR_myservice 259
> Then in user space include/asm/unistd.h i got next
> number as 271.
>     I proceed with 271 no. but got results that no
> syscall is defined.


Actually the number mentioned in user "unistd.h" should be the same
that was allocated to your system call in entry.S

Actually while making a system call, user process, picks the number
from user "unistd.h" and then makes a system call, as in your case the
number picked from user "unistd.h" is 271, which is different from the
number allocated to your new system call, that is 259.

Define the following line in your user "unistd.h"

#define __NR_myservice 259

Regards,
- Gaurav



I have successfully implemented new
> system call given in
> http://fossil.wpi.edu/docs/howto_add_systemcall.html
> on RH9 system. But now i want same thing to be
> implemeted on Fedora Core 1 but i am getting following
> strace results.
> [root@localhost root]# strace ./user-app
> execve("./user-app", ["./user-app"], [/* 41 vars */])
> = 0
> uname({sys="Linux", node="localhost.localdomain",
> ...}) = 0
> set_tid_address(0)                      = -1 ENOSYS
> (Function not implemented)
> brk(0)                                  = 0x80495bc
> open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT
> (No such file or
> directory)
> open("/etc/ld.so.cache", O_RDONLY)      = 3
> fstat64(3, {st_mode=S_IFREG|0644, st_size=84369, ...})
> = 0
> old_mmap(NULL, 84369, PROT_READ, MAP_PRIVATE, 3, 0) =
> 0x40000000
> close(3)                                = 0
> open("/lib/i686/libc.so.6", O_RDONLY)   = 3
> read(3,
> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0
> \\\1\000"..., 512) =
> 512
> fstat64(3, {st_mode=S_IFREG|0755, st_size=1564716,
> ...}) = 0
> old_mmap(NULL, 4096, PROT_READ|PROT_WRITE,
> MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> 0x40015000
> old_mmap(NULL, 1287652, PROT_READ|PROT_EXEC,
> MAP_PRIVATE, 3, 0) = 0x40016000
> old_mmap(0x4014b000, 12288, PROT_READ|PROT_WRITE,
> MAP_PRIVATE|MAP_FIXED, 3,
> 0x135000) = 0x4014b000
> old_mmap(0x4014e000, 9700, PROT_READ|PROT_WRITE,
> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) =
> 0x4014e000
> close(3)                                = 0
> munmap(0x40000000, 84369)               = 0
> utimes("string", {3221223448, 134513588}) = -1 ENOSYS
> (Function not
> implemented)
> --- SIGSEGV (Segmentation fault) @ 0 (0) ---
> +++ killed by SIGSEGV +++
> 
>          Now please help me how can i then assign
> sys_call_table no.?
> 
> regards,
> linux_lover.
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
>

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