Getting dataspace of a tmpfs-file blocks forever

"Stark, Josef" <[email protected]>
Newsgroups gmane.comp.micro-kernel.l4.devel
Message-ID <[email protected]>
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_ptr<L4Re::Vfs::File> fp = L4Re::Vfs::vfs_ops->get_file(fd);
	printf("Got file!\n");
	L4::Cap<L4Re::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
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.