[Ilugc] Communicating From User Space to Kernel Space

  • From: dandolls@xxxxxxxxxxx (amit saha)
  • Date: Sun Sep 10 19:02:25 2006



Girish Venkatachalam <girish1729@xxxxxxxxx> wrote: On Sun, Sep 10, 2006 at 
01:04:27PM +0100, amit saha wrote:
|struct rule{
|         int proto;
|          char source[15];
|        }instance;
|
|I have written this structure into a file in user space ,say rule.txt .
|Say this file contains 10 records , i. e 10 instances of the above
|structure.Now I would like to read the same file in kernel space by a
|kernel module by reading 1 record at a time. How can i do this ?
|
|Is there any other way to do this without using files ?  My objective
|is to read the 10 records from kernel  space one record at a time and
|not the individual bytes.
#include <"Std disclaimer: I am no kernel programmer".h>

Usually kernel code doesn't read files directly. It uses a helper
program running in  user space. If you are talking about reading user
memory from kernel space then I guess you are talking about mmap(2)

I think the standard approach is that of never making the kernel
do anything on its own save interrupt and other async
processing. Always the kernel acts on behalf of someone in user
space, IOW kernel code is always executed in user context. Don't
take this in the technical sense. I mean on behalf of a user
spaec process...

My two cents

Best,
Girish

Thanks for your prompt help. But,perhaps you didnt get me clearly.  I want some 
data which is generated by my user space program to be available to the kernel 
module. And i require the kernel module to be able to access those 
independently without requiring the intervention of a user process.

Any positive feedback wiil be acknowledged!


Amit Saha
  
http://amitsaha.in.googlepages.com
http://codejourno.blogspot.com
  
+91 9903140286  
    
         

---------------------------------
  Find out what India is talking about on  - Yahoo! Answers India 
  Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it 
NOW


Amit Saha
  
http://amitsaha.in.googlepages.com
http://codejourno.blogspot.com
  
+91 9903140286  
    

                                
---------------------------------
 Find out what India is talking about on  - Yahoo! Answers India 
 Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it 
NOW

Other related posts: