mmap inside kernel memory.
"mmap" seems to be design for mapping file or device inside a process memory. Is it possible to map a file into the kernel virtual memory ?
kind regards,
j.
Signature · 1 line
Jérôme de Vivie
Quoted 2 lines · Jerome de Vivie
"mmap" seems to be design for mapping file or device inside a process memory. Is it possible to map a file into the kernel virtual memory ?
In theory yes (using vmalloc space), but you really don't want to.
Rik
Signature · 3 lines
Bravely reimplemented by the knights who say "NIH". http://www.surriel.com/ http://guru.conectiva.com/ Current spamtrap: <a href=mailto:"[email protected]">[email protected]</a>
Quoted 7 lines · Rik van Riel
Quoted 2 lines · Jerome de Vivie
"mmap" seems to be design for mapping file or device inside a process memory. Is it possible to map a file into the kernel virtual memory ?
In theory yes (using vmalloc space), but you really don't want to.
Yes, it's very tricky ! I have (naïvly) try this:
vaddr=vmalloc(len);do_mmap(file ,kvaddr ,len ,PROT_READ|PROT_WRITE ,MAP_FIXED|MAP_PRIVATE ,0);
Here, do_mmap check if the addresse match inside current process and return me -ENOMEM. Are there others functions which i could use to associate this file and a vmalloc'ed space ?
j.
Signature · 1 line
Jérôme de Vivie
Quoted 3 lines · Jerome de Vivie
Here,
do_mmapcheck if the addresse match inside current process and return me-ENOMEM. Are there others functions which i could use to associate this file and a vmalloc'ed space ?
As I said, you don't want to mmap a file in kernel memory. You only have 128 MB of vmalloc space and you don't want to waste it.
If you know which addresses within the file you want to access, why don't you access them through the page cache functions ?
regards,
Rik
Signature · 3 lines
Bravely reimplemented by the knights who say "NIH". http://www.surriel.com/ http://guru.conectiva.com/ Current spamtrap: <a href=mailto:"[email protected]">[email protected]</a>
Quoted 7 lines · Rik van Riel
Quoted 3 lines · Jerome de Vivie
Here,
do_mmapcheck if the addresse match inside current process and return me-ENOMEM. Are there others functions which i could use to associate this file and a vmalloc'ed space ?
Quoted 7 lines
As I said, you don't want to mmap a file in kernel memory. You only have 128 MB of vmalloc space and you don't want to waste it.
If you know which addresses within the file you want to access, why don't you access them through the page cache functions ?
Ok. I will go through the page cache.
regards,
j.
Signature · 1 line
Jérôme de Vivie