www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - weird /proc reading bug in linux

reply Andrew Luecke <Andrew_member pathlink.com> writes:
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
Jun 24 2004
next sibling parent Ant <duitoolkit yahoo.ca> writes:
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
Jun 25 2004
prev sibling parent Walter Bright <foo bar.com> writes:
Added to bugzill as
http://d.puremagic.com/issues/show_bug.cgi?id=2670
Feb 16 2009