Re: Accessing a user space variable from a kernel module

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

 



--- Jeremy Andrus <jandru39@calvin.edu> wrote:
> Everyone's responses have been helpful so far :-)
> I have another question. I've decided to use the 'copy_from_user' 
> function, but I don't know how I'm supposed to discover the
> userspace 
> address I need to copy from. The data I want to get into the kernel
> is 
> in a variable in a userspace function.
> 

Usually, the address is passed to the driver in a call to one of its
entry points.  The ioctl entry point is commonly used for such
things.

Implement an ioctl entry point, then call it from your application
and pass the address.  In the driver, save the address in a variable
or data structure for when you need it for the copy_from_user call.

Perhaps this link will help:
http://www.xml.com/ldd/chapter/book/ch05.html#t1

Harmony,

--Christine


__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com
--
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