file: module and character special files

Joachim Durchholz joachim.durchholz@REDACTED
Mon Feb 2 19:34:02 CET 2004

Patrik Nyblom wrote:
> Let's look at the options here. [...]
> 3) We could ignore the problem and let the user take responsibility
> for his or her actions, meaning we would open any file without
> questioning. [...]
> 3) would not be all that bad, but unfortunately that would put us in
> a "support situation" we cannot handle.

I don't see any "support situation" here.
The general guideline that has served me well in the past is:
If a library cannot handle a situation,
a) hand the responsibility over to the application programmer,
b) give the application programmer access to all pertinent data.

(Erlang has a third option, "let it crash", but I don't think it would
work for this special case.)

Applying the guideline to this situation would be to simply open the
file. And put some fat warnings into the documentation, telling the
application programmer that opening a file will block the entire Erlang
node, at least on some variants of Unix.

If a programmer is concerned with file latencies, he can always create a
separate Erlang node and use it to do the file handling. That's a
heavyweight solution, and should be avoided unless there are no kernel
threads, but it's possible.
Ideally, Erlang would come with two libraries: one for situations where
kernel threads are available, and one for situations where they aren't.
An Erlang program could use one of the libraries by default (determined
at VM installation time), or run some tests and use the appropriate
library. (That's just an ideal. I know that implementing this would
require some work, and am aware that this might be a low-priority item.)

> It's of course easy to patch the file driver to allow any file for
> you open source users, so in conjunction with the +A switch, a
> working solution is already at hand for most of you.

It's a working solution, but it's yet another thing that might be
overlooked when installing a new version of Erlang :-(

Oh, and, please, snip the Ericsson footers before responding. They are
already too long once, there's no need to send them twice.
And, while I'm at it: I'd be glad if you (and others) would snip those 
parts of a message that they don't respond to. Having to scroll down to 
see whether there's anything else you wanted to say forces all your 
readers into wasting some mental bandwidth - not by much, but reading 
lists already takes too much time...
Thanks to everybody who cares to oblige :-)

Currently looking for a new job.

More information about the erlang-questions mailing list