LinuxQuestions.org
Visit Jeremy's Blog.
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 01-06-2004, 02:07 PM   #1
h/w
Senior Member
 
Registered: Mar 2003
Location: New York, NY
Distribution: Debian Testing
Posts: 1,286

Rep: Reputation: 45
on modules and user-space programs


i have a few questions about how things work on linux. all ideas welcome.

first is the way the kernel works with modules. i have my kernel image sitting in /boot. i have my modules in the right places after compiling and installing them. i have the kernel source tree sitting someplace in my home dir. now, when we build the new kernel, all the object files are created, and im guessing that those are what are being used by the kernel to load the modules. i wouldnt think that the source tree is of any use once the kernel modules have been built. but ... when i go make a modification in one of the kernel files (i made changes to the sis900.c file under /net), i see the changes immediately when i reboot the kernel. i didnt compile or build or do anything with the sis900.c file to affect the sis900. o file. how is this possible that it does this? is it actually, compiling, building and then loading the obj file everytime its brought up?

then, i made some changes to an user-space application (iwconfig, in my case), and added a simple 'printf()' stmt in it. again, i didnt compile it or do anything to affect the .o files, but it somehow reflects the changes. but ... in this case, i get a nice kernel panic.

how is it that changes i make in the source are reflected without me doing any compile/linking of these files? and why is it that one works fine with a change in a loop count, while another gives a kernel panic with a printf();?

thanks!
 
Old 01-06-2004, 03:38 PM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 108Reputation: 108
Re: on modules and user-space programs

Quote:
Originally posted by h/w
when i go make a modification in one of the kernel files (i made changes to the sis900.c file under /net), i see the changes immediately when i reboot the kernel. i didnt compile or build or do anything with the sis900.c file to affect the sis900. o file. how is this possible that it does this? is it actually, compiling, building and then loading the obj file everytime its brought up?
Of course some distro could arranged for this kernel-making at boot-time, but it does sound hard to believe. You said the sources are in some home-dir. How could the boot process (init script) know where it is?

Are you really sure that this is what happens. Like you, I would be quite surprised.
What happens if you put a syntax error deliberately in the sis900.c?
 
Old 01-06-2004, 03:42 PM   #3
h/w
Senior Member
 
Registered: Mar 2003
Location: New York, NY
Distribution: Debian Testing
Posts: 1,286

Original Poster
Rep: Reputation: 45
my kernel sources are sitting in /home/ksrc/linux-2.6.0
i have a symlink "linux" in /usr/src/ which points to the above.
my module object files are in /lib/modules/linux-2.6.0

so when i make changes to the file in /home/ksrc/linux-2.6.0/.../net/sis900.c, i see the changes, without doing anything afterwards to affect the obj file in /lib/modules. im sure you would see the same too.

the change i made to it was to reduce the count in the for loop from 32 to 2. right now, im not on my laptop, or else i would have tried putting the error in and checking (im guessing it would cause a kernel panic?)
 
  


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
notify user space application from the kernel space lordofring Linux - Software 2 06-22-2009 12:32 PM
Calling User-space program functions from Kernel modules shivanu Programming 1 03-05-2005 02:11 PM
user space daemons, kernel patches, modules ajitkth Linux - General 0 02-21-2005 08:01 AM
array size/C++ memory limits for user space programs? thrifteed Programming 4 09-05-2004 04:42 AM
calling modules from user space adhiraj Linux - Newbie 1 01-29-2004 11:44 AM


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

Main Menu
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