LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 07-11-2004, 05:48 PM   #1
pwangee
LQ Newbie
 
Registered: Mar 2004
Posts: 19

Rep: Reputation: 0
how to use c functions in linux kernel mode


Hi,

I used some c functions in my program such as pow, log, puts. When I try to make the program work as a module, it gives some errors.

% /usr/local/sbin/click-install wp-wire-dem.click
/usr/local/lib/click.o: unresolved symbol pow
/usr/local/lib/click.o: unresolved symbol log
/usr/local/lib/click.o: unresolved symbol puts
/usr/local/lib/click.o: unresolved symbol printf
click-install: /sbin/insmod /usr/local/lib/click.o failed

Can I use the c functions in the kernel program? If can, how to use it? Thanks

Peng
 
Old 07-11-2004, 06:14 PM   #2
kevinalm
Member
 
Registered: Oct 2003
Location: Iowa
Distribution: LFS 5.0, building 6.3, win98se, multiboot
Posts: 288

Rep: Reputation: 30
I don't know anything about kernel programing myself, but I do know there is a Kernel Programming Howto. Check the Linux Documentation Project website.
 
Old 07-11-2004, 07:29 PM   #3
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
as far as i know, you cant use glibc in kernel mode, or any lib in the kernel, you have to use what the kernel provides
 
Old 07-12-2004, 05:30 PM   #4
kevinalm
Member
 
Registered: Oct 2003
Location: Iowa
Distribution: LFS 5.0, building 6.3, win98se, multiboot
Posts: 288

Rep: Reputation: 30
Quote:
Originally posted by SciYro
as far as i know, you cant use glibc in kernel mode, or any lib in the kernel, you have to use what the kernel provides
Maybe you could link statically to the libs? Just a thought.
 
Old 07-12-2004, 10:48 PM   #5
jspenguin
Member
 
Registered: Feb 2003
Location: Wichita, KS
Distribution: Heavily modified Redhat
Posts: 194

Rep: Reputation: 30
Quote:
Originally posted by kevinalm
Maybe you could link statically to the libs? Just a thought.
Probably won't work. The C library expects to be run in usermode, and it could seriously confuse it if you run it in kernel mode. If you just need a small function like pow, you can hunt through the C library source and just copy the function into your code. As long as your module is GPL or LGPL there should be no licensing issues.
 
Old 07-12-2004, 11:21 PM   #6
kevinalm
Member
 
Registered: Oct 2003
Location: Iowa
Distribution: LFS 5.0, building 6.3, win98se, multiboot
Posts: 288

Rep: Reputation: 30
I thought that was what static linking did, copy the relavent code from the library into your executable. I could be wrong though, I frequently am.
Regards.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
searching functions in emacs dire mode tacca Linux - Software 2 07-03-2005 04:49 PM
kernel functions sunfzam Linux - Software 14 04-10-2005 01:27 AM
UML--->compiling user mode linux in kernel 2.6 waqasgujjar Red Hat 0 12-18-2004 04:20 PM
how to use c functions in linux kernel mode pwangee Linux - Software 2 07-12-2004 12:23 AM
Multihead Text mode in Linux Kernel 2.6 RicheBright Linux - General 0 05-30-2004 10:50 PM


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