[erlang-questions] multiple processes using a raw mode file

Raimo Niskanen raimo+erlang-questions@REDACTED
Thu Oct 21 11:41:53 CEST 2010


On Wed, Oct 20, 2010 at 03:17:43PM +0100, Joel Reymont wrote:
> Why is there a limitation of only the process that opened a raw file being able to use that file?
> 
> file:open returns a port, shouldn't any process be able to use that port?
> 
> I'd like multiple processes to be able to use a file opened in raw mode.

That would require some rewriting of efile_drv. prim_file and efile_drv
assume the old port model where only the port owner communicates with
the driver. The driver replies to the port owner. Later prim_file
has been rewritten to use port_command instead of Port ! {command,...}
to improve error detection. But efile_drv still replies to the port owner.

If you use raw filehandle from another process I actually do not know
what happens. Maybe efile_drv gets the the request and replies to
the owner. Nevertheless it does not behave correctly.

For it to behave correctly it would have to reply to the requester
_and_ be rewritten for simultaneous requests from any number of
processes, presumably a queue to serialize the requests, making
it annoyingly similar to the "port owner does all requests" model.

> 
> 	Thanks, Joel
> 
> ---
> http://twitter.com/wagerlabs
> 
> 
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
> 

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB


More information about the erlang-questions mailing list