Thread overview
weird /proc reading bug in linux
Jun 25, 2004
Andrew Luecke
Jun 26, 2004
Ant
Feb 16, 2009
Walter Bright
June 25, 2004
when reading /proc/sys/kernel/osrelease using:

char[] thing = cast(char[])std.file.read("/proc/sys/kernel/osrelease")

the string returned is completely empty.. its not a permission prob because cat has no probs, and either does C/C++..

And std.file.read works for other files it seems, just not ones in /proc (haven't tried to see if /dev reacts the same way). I'm guessing it might be because proc using procFS, not a standard filesystem


Auzy
http://driverondemand.sourceforge.net
June 26, 2004
On Fri, 25 Jun 2004 06:42:34 +0000, Andrew Luecke wrote:

> when reading /proc/sys/kernel/osrelease using:
> 
> char[] thing = cast(char[])std.file.read("/proc/sys/kernel/osrelease")
> 
> the string returned is completely empty.. its not a permission prob because cat has no probs, and either does C/C++..
> 
> And std.file.read works for other files it seems, just not ones in /proc (haven't tried to see if /dev reacts the same way). I'm guessing it might be because proc using procFS, not a standard filesystem
> 
> 
> Auzy
> http://driverondemand.sourceforge.net

proc files have 0 length
std.file.read gets the length of the file
and then gets that number of bytes - exactly 0 bytes.

Ant

February 16, 2009
Added to bugzill as http://d.puremagic.com/issues/show_bug.cgi?id=2670