LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-30-2006, 03:23 AM   #1
hegdeshashi
Member
 
Registered: Dec 2005
Posts: 73
Blog Entries: 3

Rep: Reputation: 15
undefined refernce to 'errno'


Hi,

when I run a small program after building a new kernel ( after adding my own new system call), I am getting this error..

===============================
/tmp/cceoGVXN.o(.text+0x23):In function 'mysystemcall'
:undefined reference to 'errno'
collect2?:ld returned 1 exit status

=========================================

thanks in advance...

rgds,
hegdeshashi
 
Old 01-30-2006, 04:10 AM   #2
paragn
Member
 
Registered: Jan 2006
Distribution: Red Hat EL5, Fedora 7
Posts: 259

Rep: Reputation: 30
hi,
You need to add errno.h to source file
 
Old 01-30-2006, 10:14 PM   #3
hegdeshashi
Member
 
Registered: Dec 2005
Posts: 73

Original Poster
Blog Entries: 3

Rep: Reputation: 15
Hi,

I included errno.h in source file.It is compiling ..but the output is -1 ..
what is the problem? is it kernel compilation problem or something else..


thanks in advance.
hegdeshashi
 
Old 01-30-2006, 10:31 PM   #4
paragn
Member
 
Registered: Jan 2006
Distribution: Red Hat EL5, Fedora 7
Posts: 259

Rep: Reputation: 30
hi,
i dont think so but it will be great if you tell me what steps you followed and show your user mode code here.
 
Old 01-30-2006, 10:47 PM   #5
hegdeshashi
Member
 
Registered: Dec 2005
Posts: 73

Original Poster
Blog Entries: 3

Rep: Reputation: 15
Hi,

I followed all steps of kernel compilation (for linux-2.4.24)
In a new kernel, I am running my sample program to check my new implemented system call . But compilation is going smoothly..output is -1...it means that , function is not implemented?
after I am checking using this cmd..
strace ./a.out( executable of user mode code)

function not implemented..-1

code is...

#include<linux/myroutine.h> // myroutine is my new system call program.
main(){
int sum=0;
sum=myroutine(10,10);
printf("%d",sum);
}

I am referring this url:
http://www.linuxgazette.com/node/9793



thanks in advance...
 
Old 01-30-2006, 11:17 PM   #6
paragn
Member
 
Registered: Jan 2006
Distribution: Red Hat EL5, Fedora 7
Posts: 259

Rep: Reputation: 30
Hi,
I assume from that link you have implemented
1)kernel space header for new syscall
2)Actual syscall implementaion
3)User spcae header
4)user space sample prog to test syscall
5)then modify entry.S
6)modify unistd.h in kernel source as well as user space
Have you done all these things
i thing you have not done user spcae modification to
/usr/include/asm-i386/unistd.h
 
Old 01-30-2006, 11:27 PM   #7
hegdeshashi
Member
 
Registered: Dec 2005
Posts: 73

Original Poster
Blog Entries: 3

Rep: Reputation: 15
Hi,

I did all modifications modificaitons both in kernel and usr space..

I am getting strange error like -1 ..
 
Old 01-30-2006, 11:33 PM   #8
paragn
Member
 
Registered: Jan 2006
Distribution: Red Hat EL5, Fedora 7
Posts: 259

Rep: Reputation: 30
hi,
I am sure that you must be missing something that is giving you error -1
 
Old 01-30-2006, 11:42 PM   #9
paragn
Member
 
Registered: Jan 2006
Distribution: Red Hat EL5, Fedora 7
Posts: 259

Rep: Reputation: 30
hi,
you can crosscheck your implementation at http://fossil.wpi.edu/docs/howto_add_systemcall.html

moreover you can check whether you have got your new syscall function entry in /proc/ksyms

Last edited by paragn; 01-30-2006 at 11:44 PM.
 
Old 01-30-2006, 11:55 PM   #10
hegdeshashi
Member
 
Registered: Dec 2005
Posts: 73

Original Poster
Blog Entries: 3

Rep: Reputation: 15
Hi,
we checked in /proc/ksyms

mysystem call is not found..
but it is in system.map
 
Old 01-31-2006, 12:18 AM   #11
paragn
Member
 
Registered: Jan 2006
Distribution: Red Hat EL5, Fedora 7
Posts: 259

Rep: Reputation: 30
hi,
show me your last lines from unistd.h file from both kernel header and user header files.
 
Old 01-31-2006, 12:42 AM   #12
hegdeshashi
Member
 
Registered: Dec 2005
Posts: 73

Original Poster
Blog Entries: 3

Rep: Reputation: 15
hi,,

In /usr/src/linux-2.4.24/include/asm-i386/unistd.h

#define __NR_exit_group 252
#define __NR_myroutine 268 //my new system call


in /usr/include/asm/unistd.h

#define __NR_set_tid_address 258
#define __NR_myroutine 268



================================
 
Old 01-31-2006, 01:17 AM   #13
paragn
Member
 
Registered: Jan 2006
Distribution: Red Hat EL5, Fedora 7
Posts: 259

Rep: Reputation: 30
hi,
it looks ok. i am still not able to determine what can be the problem? but somehow syscall is not getting called from user spcae program. check if you have forgotten to modify Makefile===>
Quote:
You can place the system call file in any directory,only thing you have to do is add a line makefile corresponding to that directory,such that the myroutine file gets compiled. This is done by adding the line O_OBJS += myoroutine.o in the make file .
 
Old 02-06-2006, 06:17 AM   #14
hegdeshashi
Member
 
Registered: Dec 2005
Posts: 73

Original Poster
Blog Entries: 3

Rep: Reputation: 15
Hi,



I did all the modifications ,but when I run the sample program which I wrote for my own system call , gives -1 . This means system call is not implemeted?

I followed this url:

http://www.linuxgazette.com/node/9793
 
  


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
linux api refernce site mail4sasi@gmail.com Linux - Newbie 3 05-19-2005 01:55 PM
subject: undefined reference to errno ashi_sheetal Programming 0 01-04-2005 06:12 AM
errno cynthia Linux - Networking 3 09-24-2004 01:58 PM
undefined reference to 'errno' kbridger Programming 2 10-07-2003 05:44 PM
Mysql install error in RH9 -undefined reference to errno murugesan_n Linux - Software 0 09-09-2003 10:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:58 PM.

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