LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   undefined refernce to 'errno' (https://www.linuxquestions.org/questions/linux-networking-3/undefined-refernce-to-errno-409540/)

hegdeshashi 01-30-2006 03:23 AM

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

paragn 01-30-2006 04:10 AM

hi,
You need to add errno.h to source file

hegdeshashi 01-30-2006 10:14 PM

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

paragn 01-30-2006 10:31 PM

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.

hegdeshashi 01-30-2006 10:47 PM

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

paragn 01-30-2006 11:17 PM

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

hegdeshashi 01-30-2006 11:27 PM

Hi,

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

I am getting strange error like -1 ..

paragn 01-30-2006 11:33 PM

hi,
I am sure that you must be missing something that is giving you error -1

paragn 01-30-2006 11:42 PM

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

hegdeshashi 01-30-2006 11:55 PM

Hi,
we checked in /proc/ksyms

mysystem call is not found..
but it is in system.map

paragn 01-31-2006 12:18 AM

hi,
show me your last lines from unistd.h file from both kernel header and user header files.

hegdeshashi 01-31-2006 12:42 AM

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



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

paragn 01-31-2006 01:17 AM

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 .

hegdeshashi 02-06-2006 06:17 AM

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


All times are GMT -5. The time now is 08:53 AM.