Hey,
when I have created and filled a file in tmpfs, reading normally (-> read() ) from it works fine. However, I cannot get the associated dataspace. The call would just block forever.
Here is an example code snippet:
==========================
const char* filename="/tmp/test"; mount("/", "tmp", "tmpfs", 0, 0); int fd=open(filename,O_WRONLY|O_CREAT); write(fd,"Hello",6); close(fd); fd=open(filename,O_RDONLY); char buf[15]; read(fd,buf,15); printf("file content: %s\n",buf); cxx::Ref_ptrL4Re::Vfs::File fp = L4Re::Vfs::vfs_ops->get_file(fd); printf("Got file!\n"); L4::CapL4Re::Dataspace ds = fp->data_space(); printf("Got Dataspace!"); long int size = ds->size(); printf("Dataspace size: %li\n",size); printf("Done.\n"); close(fd);
============================
It would just output file content: Hello Got file! but nothing more, which tells me that reading normally from the file works, but the fp->data_space() call blocks.
If I tried the same with an existing file in /rom/, it works just fine (except for the writing part, obviously).
How can I make this work?
Thanks, Josef