LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-22-2006, 01:17 AM   #1
aluser
Member
 
Registered: Mar 2004
Location: Massachusetts
Distribution: Debian
Posts: 557

Rep: Reputation: 42
Read file in kernel space


I want to write some kernel code that reads and writes files, but I'm a bit stumped because vfs_read() and vfs_write() take pointers to userspace buffers. I assume that, if I just pass a kmalloc'd one, the filesystem code will call access_ok() or similar and choke.

So, how can I avoid this *OR* how do I temporarily allocate a userspace buffer that I can pass to vfs_read() and vfs_write()?

thanks
 
Old 08-22-2006, 04:51 AM   #2
__J
Senior Member
 
Registered: Dec 2004
Distribution: Slackware, ROCK
Posts: 1,973

Rep: Reputation: 46
http://www.linuxjournal.com/article/8110

try this, I read this a while ago and it seems to be what you want.

HTH.
 
Old 08-22-2006, 09:28 AM   #3
aluser
Member
 
Registered: Mar 2004
Location: Massachusetts
Distribution: Debian
Posts: 557

Original Poster
Rep: Reputation: 42
fantastic. Thanks a lot.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
notify user space application from the kernel space lordofring Linux - Software 2 06-22-2009 12:32 PM
creation of new file in kernel space vishalbutte Programming 3 03-14-2006 02:32 AM
Accessing file in kernel space manali Programming 1 02-28-2006 05:03 PM
read file from running kernel b123coder Programming 1 11-18-2004 04:05 AM
How can I read regular file in kernel module jooboo Programming 5 12-30-2003 07:11 PM


All times are GMT -5. The time now is 04:28 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration