file: module and character special files
Richard A. O'Keefe
Thu Jan 29 04:06:01 CET 2004
I'm running Erlang/OTP R9C on a SunBlade 100 running Solaris 2.9.
I wanted to test some file I/O code I had written, and for obvious
reasons used /dev/null as a test file. The results were surprising
and the cause disappointing (to put it politely).
Erlang (BEAM) emulator version 5.3 [source] [hipe] [threads:0]
Eshell V5.3 (abort with ^G)
1> file:open('/dev/null', [read]).
2> file:open('/dev/null', [write]).
/dev/null is a perfectly good file. It is not a directory.
In Solaris 2.9, /dev/null is a symbolic link to this
character special file:
crw-rw-rw- 1 root sys 13, 2 Jan 29 15:44 /devices/pseudo/mm@REDACTED:null
As you see, on my system there are no file permission reasons why
this important and useful file should be forbidden to Erlang code.
3> file:open('/dev/tty', [read]).
4> file:open('/dev/tty', [write]).
Poking around a bit more, I find that opening _any_
character special file seems to be forbidden.
I don't mind not being able to seek on these things,
but surely I don't have to be able to seek in order to
just plain read and write?
PS: I can't find documentation for inets/src/http.erl.
Where should I be looking?
More information about the erlang-questions