Linux VM can't read files from /proc

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Linux VM can't read files from /proc

laza
 
Does anybody know why the linux vm can't read files from the /proc filesystem? The VM is able to open the files but the size is 0!? A simple less or cat on these files just works fine ...

Alex
Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Linux VM can't read files from /proc

laza
 
Ah, you're right. The Squeak VM gets the file size via stat and does not just read the contents from the file. So for squeak the file looks just empty.
That's a shame because /proc/self/environ would be an easy way to access the environment variables from within the image without any need to add a specific primitive to the VM or use FFI.

Alex

2011/2/21 Tony Garnock-Jones <[hidden email]>
On 2011-02-21 4:35 PM, Alexander Lazarević wrote:
Does anybody know why the linux vm can't read files from the /proc
filesystem? The VM is able to open the files but the size is 0!? A
simple less or cat on these files just works fine ...

Is it just the sizes that are zero, or does actually reading from them fail too? A stat() (or for that matter an ls -l) will return a zero size, but a read() in C will return data.

Regards,
 Tony

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Linux VM can't read files from /proc

Bert Freudenberg

On 21.02.2011, at 14:19, Alexander Lazarević wrote:

> Ah, you're right. The Squeak VM gets the file size via stat and does not just read the contents from the file. So for squeak the file looks just empty.

(FileStream readOnlyFileNamed: '/proc/self/environ') next: 1e6

works for me

- Bert -


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Linux VM can't read files from /proc

laza
 
2011/2/21 Bert Freudenberg <[hidden email]>

On 21.02.2011, at 14:19, Alexander Lazarević wrote:

> Ah, you're right. The Squeak VM gets the file size via stat and does not just read the contents from the file. So for squeak the file looks just empty.

(FileStream readOnlyFileNamed: '/proc/self/environ') next: 1e6

works for me

And so

(FileStream readOnlyFileNamed: '/proc/self/environ') upToEnd

also works nicely. conentsOfEntireFile (which is used by the FileList) looks for a size which it gets from a stat and returns no content. Looking at the strace log I was lead to believe it was the VM itself.

Thanks,
 Bert