Fedora Linux Support Community & Resources Center
  #1  
Old 5th November 2007, 12:16 PM
fracipo Offline
Registered User
 
Join Date: Sep 2007
Posts: 7
Question [c] Problem with memory writing

Hallo!

I have a problem writing into a memory segment from inside the kernel.

I allocated a segment of memory (an array of char) in USER-SPACE
and read it correctly from KERNEL-SPACE with the function copy_from_user().

The problem comes when writing into such segment using the copy_to_user() function!

The segment of memory is an array and should be writable...
I've tried to set the memory flags of the memory segment
(form task_struct->mm_struct->vm_area_struct of the user space program)
by using:
((program->mm)->mmap)->vm_flags = VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC | VM_READ | VM_WRITE;

(where program is the pointer to the task_struct of the program)

but copy_to_user returns and the number of bytes it fails to write is nonzero...

copy to user: http://www.gelato.unsw.edu.au/~dsw/p...api/r4037.html
copy from user: http://www.gelato.unsw.edu.au/~dsw/p...api/r4081.html


Can someone please help me solve this issue?


thanks in advance,

Francesco

UPDATE:

doing some debugging and changes I see that only sometimes it writes...
copy to user returns a 0 value only sometimes...
someone can tell me why?

Last edited by fracipo; 5th November 2007 at 05:05 PM.
Reply With Quote
Reply

Tags
memory, problem, writing

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help, please... CD writing and webcam problem Nole1 Hardware & Laptops 20 4th January 2008 11:18 AM
FC6: Problem writing to FAT32 partition cmoraes EOL (End Of Life) Versions 1 9th February 2007 09:49 AM
writing to tape problem master_wa Using Fedora 0 11th October 2005 09:04 PM
HELP!!! problem with writing audio cds with k3b andreaspf8585 Using Fedora 8 29th October 2004 12:05 AM


Current GMT-time: 17:51 (Monday, 20-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat