RE: Global variable from kernel module!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hii,
  AFAIK Global Variables defined in Kernel CANNOT be accessed from user
level programs directly.
   This is because, the address space of the User Level program is different
from that of the kernel (assumption is   you are working in Normal Linux on
a processor in Protected mode). Hence kernel Global veriables cannot be
mapped correctly to the user level programs.

   If its only a global variable that u need to access, make the kernel
module a driver & access the global variable using on ioctl. But be aware
that u cant pass kernel addresses to user space and expect the user level
program to access it . It just wont work. (Ref above).

   For IPC mechanism between user & kernel modules, i can think of only the
{ open, close, read, write, ioctl } interfaces of a device driver.

-bharani.

-----Original Message-----
From: kernelnewbies-bounce@nl.linux.org
[mailto:kernelnewbies-bounce@nl.linux.org]On Behalf Of karthik
Sent: Monday, 1 April 2002 3:01 PM
To: kernel newbies
Subject: Global variable from kernel module!


Hi,
Is it possible to define a global variable in a kernel module and access
it a user level program?
I have created a queue head at kernel module
wait_queue_head_t temp;
and i wanted to add my queue to this list using user level program for
sync.
add_wait_queue(&temp,my_queue);
but when i compile its not able to resolve the queue head variable.
Cant i use queue for IPC between a kernel module and a user level
program.
Any hints appreciated.
Thanks
Karthik

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/

***************************************************************************
This message is proprietary to Future Software Limited (FSL) 
and is intended solely for the use of the individual to whom it
is addressed. It may contain  privileged or confidential information 
and should not be circulated or used for any purpose other than for 
what it is intended. 

If you have received this message in error, please notify the
originator immediately. If you are not the intended recipient,
you are notified that you are strictly prohibited from using,
copying, altering, or disclosing the contents of this message. 
FSL accepts no responsibility for loss or damage arising from 
the use of the information transmitted by this email including
damage from virus.
***************************************************************************
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux