LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-27-2005, 08:42 PM   #1
linux_lover2005
Member
 
Registered: Dec 2004
Posts: 44

Rep: Reputation: 15
add new system call


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

Last edited by linux_lover2005; 03-27-2005 at 08:44 PM.
 
Old 03-27-2005, 09:28 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
I'm pretty sure that the syscall number in user space and the syscall number in the kernel are supposed to match up. The program traps into kernel space (via int 0x80) with the system call number, which is how the kernel knows which system call to execute. Try calling your syscall via an indirect syscall (using number 259, see syscall(2) for more details), and see if that doesn't work...
 
Old 10-14-2006, 01:37 AM   #3
Cappuccino
LQ Newbie
 
Registered: Oct 2006
Posts: 1

Rep: Reputation: 0
I think the header file /linux-2.x/include/linux/sys.h in your case has the line #define NR_syscalls 270 which probably accounts for the total number of system calls already defined which may not conform with the entries in unistd.h .... try giving the value 271 to your system call entry in the unistd.h header file and see if it works.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
kernel : how to add sys call through modules only? pinkeshzaveri Programming 1 09-14-2005 03:17 AM
how to add my own system call in RedHat linux9.0(2.4.7-20kernel) tyler28 Programming 0 06-15-2005 04:06 AM
Is it possible to use system() and get the return value from the system call newguy21 Programming 1 08-11-2004 01:37 PM
Error when add a new system call in RH9.0. GreenStar Linux - Newbie 2 11-01-2003 01:52 PM
Samba 2.2.7a fails to call add user script on Red Hat 9 DrFooMod2 Linux - Networking 4 07-17-2003 09:33 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration