question about file mapping

[email protected]
Newsgroups gmane.comp.micro-kernel.l4.devel
Message-ID <OF540B6A40.A2BDB0DF-ON48257E44.00210C3E-48257E44.00233C36@zte.com.cn>
Hi,

I create a file on tmpfs, and it read/write works fine. However, it cannot 
mmap, and returns EINVAL.
I found the reason is that dataspace of the file is not valid. 

        L4::Cap<L4Re::Dataspace> fds = fi->data_space()
       if (!fds.is_valid())
        {
          return -EINVAL;
        }

How to make it valid?  Is there another method to do file mapping?


Here is an example code snippet:
==========================

const char* filename = "/tmp/testfile";
ret = mount("/", "tmp", "tmpfs", 0, 0);

fd = open(filename, O_RDWR|O_CREAT);

write 10K data into file

addr = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); //return 
-1, and errno is EINVAL


--------------------------------------------------------
ZTE Information Security Notice: The information contained in this mail (and any attachment transmitted herewith) is privileged and confidential and is intended for the exclusive use of the addressee(s).  If you are not an intended recipient, any disclosure, reproduction, distribution or other dissemination or use of the information contained is strictly prohibited.  If you have received this mail in error, please delete it and notify us immediately.

_______________________________________________
l4-hackers mailing list
[email protected]
http://os.inf.tu-dresden.de/mailman/listinfo/l4-hackers
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.