Re: How to read file in kernel module?

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

 



On Wed, Feb 02, 2005 at 12:53:58 +0530, shyamjith wrote:
> Hello,
>    I want to read file in kernel module. can anybody
> help me by giving code for that?
> Also whats suitable way to do that in kernel /proc or
> shared memory? what i want is to read and write a user
> file frequently.
> regards,
> linux_lover
> 
> 
> reply-----------------------------------------------
> 
> 
> Hi linux lover . Reading or wriring a file from kernel is possible . But  
> its not recomended . Its better to communicate with the kernel module  
> using Copyto_User() function or write to a /proc buffer . Still if you  

There is *NO* Copyto_User. There are copy_to_user and copy_from_user.
And anway, these are NOT a method of communication -- they are the
low-level mechanizm under some of them. The mechanizms available are:
1) Character device
2) ioctl on character device
3) procfs file
4) Netlink socket

> want to access
> the file from the kernel . The only possible way is to access the file is  
> to use the underlying functions to open , read  & write . I dont exactly  
> remembre the function names . But everything starts with file_XXX . Search  
> for that in www.
> 
> regards,
> shyam
> 
> -- 
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@xxxxxx>

Attachment: signature.asc
Description: Digital signature


[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