[erlang-questions] file:read_file won't read from /proc

Attila Rajmund Nohl attila.r.nohl@REDACTED
Thu Mar 4 17:17:41 CET 2010


2010/3/4, Jachym Holecek <freza@REDACTED>:
[...]
> The read_file/1 thing check file size and then attempts to read exactly
> that many bytes. The size of /proc/cpuinfo is zero[*], thus read_file/1
> correctly reads zero bytes and represents the result with empty binary.
>
> Gotta love UN*X for its sense of consistency, right? ;-)

Even the classic UNIX utilities can't get it right occasionally:

ethanl@REDACTED: ~>wc /proc/sys/kernel/panic
1 1 2 /proc/sys/kernel/panic
ethanl@REDACTED: ~>wc -c /proc/sys/kernel/panic
0 /proc/sys/kernel/panic
ethanl@REDACTED: ~>cat /proc/sys/kernel/panic | wc -c
2


More information about the erlang-questions mailing list