Re: how to use copy_to_user function...

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

 



On Tue, 4 Jan 2005 16:21:07 -0800 (PST), Jaydeep Chokshi
<jaydeepzap@xxxxxxxxx> wrote:
> I am confused, how to use copy_to_user function. I
> register a file thru module in /proc say test_proc.
> now
> i used copy_from_user function to copy data writtened
> to the file test_proc and stored in static global char
> array. now while reading back that file if i use
> copy_to_user function then it gives me Fault, so i
> used the snprintf() function to copy data in user
> buffer.
> 
> So anybody let me know how to use copy_to_user()
> function. I used gcc 3.x on RHEL 3, Pentium IV m/c.
> 
> Regards,
> Jaydeep.

Hi,
 copt_to_user is a function used in kernel to copy data from kernel
space to user space. The Source must be a kernel address and
Destination Must be User space.
snprintf and any other library function does not do inter address space copy.
use:

copy_to_user(to, from, size);

Can you tell in detail what did you want do?

Regards
-- 
Manish Regmi

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