[erlang-questions] Opening "Special" Files

Mark Wagner carnildo@REDACTED
Wed Aug 26 03:22:54 CEST 2009


On Mon, Aug 24, 2009 at 01:03, Jayson Vantuyl<kagato@REDACTED> wrote:
> Dear Erlang Questions,
>
> I really need to open a block device.  I'll treat it just like a file, I
> swear.  I'll open it.  I'll read from it.  I'll write to it.  I'll close it
> when I'm done.  I'll even cuddle if it wants to.  Where's the harm in that?
>
> Unfortunately, there's a rather bureaucratic function called
> efile_may_openfile in erts/emulator/drivers/unix/unix_efile.c.  It's on line
> 800.  It insists that anything but a purely vanilla file just won't do.

> ...

> Also, can anyone even tell me why this is there?  Is there some odd behavior
> on an embedded system?  Is it a primitive attempt at a security feature?
>  Are we really afraid of getting SIGPIPE?

My understanding based on discussions on the mailing list is that this
is an effort to avoid blocking I/O: a OS-level block on read or write
would result in all Erlang-level threads managed by the current
process being suspended until the I/O completes or times out.

-- 
Mark Wagner


More information about the erlang-questions mailing list