LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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 08-14-2009, 10:09 PM   #1
corone
Member
 
Registered: Jul 2009
Posts: 46

Rep: Reputation: 1
After adding a system call in the kernel, an error occured.


Hi,

I added a temporary system call in the kernel for a test,
But when a program calls the system call, an error occurs.

When I compiled the following program, an error occured.
# vi testcall_test.c
Code:
#include <linux/unistd.h>

_syscall0(int,testcall);

int main(void)
{
testcall();
return 0;
}
The error messages are...
# gcc -I /usr/src/linux-2.6.14.6/include testcall_test.c -o testcall_test
Code:
/usr/bin/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches non-TLS reference in /tmp/ccCGdJnX.o
/lib/libc.so.6: could not read symbols: Bad value
collect2: ld returned 1 exit status
But when the program calls the system call as the number,
it works properly.
WHAT IS WRONG WITH THE ABOVE?
And how can I solve the problem?
Please, help me.
# vi testcall_test.c
Code:
#include <linux/unistd.h>

// _syscall0(int,testcall);

int main(void)
{
// testcall();

syscall(294);


return 0;
}
(or)
# vi testcall_test.c
Code:
#include <linux/unistd.h>

// _syscall0(int,testcall);

int main(void)
{
// testcall();

syscall(__NR_testcall);


return 0;
}
# gcc -I /usr/src/linux-2.6.14.6/include testcall_test.c -o testcall_test
#

# ls
testcall_test testcall_test.c
# ./testcall_test
testcall success!
#

I heard that the _syscallN() macros are gone in 2.6.20 and later.
But the current kernel version is 2.6.14.6

Last edited by corone; 08-26-2009 at 05:47 AM.
 
Old 08-26-2009, 05:47 AM   #2
corone
Member
 
Registered: Jul 2009
Posts: 46

Original Poster
Rep: Reputation: 1
I should have added "#include <error.h>"

Thank you.

Last edited by corone; 04-09-2012 at 02:31 AM.
 
  


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
adding a new system call to kernel in LFS lfs_rocks Linux From Scratch 1 05-03-2008 11:12 PM
adding a new system call to kernel in LFS lfs_rocks Linux - Kernel 1 04-28-2008 10:17 AM
"expected specifier-qualifier-list" ERROR while adding a new system call ahm_irf Linux - Kernel 0 04-29-2007 11:52 PM
Try to add a system call but compilation error occured ahm_irf Linux - Newbie 0 04-28-2007 02:27 AM
Adding new System Call to Kernel kurt_ram Linux - General 1 10-22-2002 04:59 PM


All times are GMT -5. The time now is 03:30 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration