Erlang filesystem

Chris Pressey cpressey@REDACTED
Sat May 10 23:38:19 CEST 2003


On Fri, 9 May 2003 23:54:05 +0200 (MEST)
Ulf Wiger <etxuwig@REDACTED> wrote:

> On Fri, 9 May 2003, Chris Pressey wrote:
> >  > {ok,H} = rpc:call(catbus@REDACTED, file, open, [".cshrc",
> >  [read]]).
> >  {ok,<3931.59.0>}
> >  > rpc:call(catbus@REDACTED, file, read, [H, 100]).
> >  {error,terminated}
> >  > file:format_error({error,terminated}).
> >  "unknown POSIX error"
> 
> Not sure why you get 'terminated', but a problem with doing
> it this way is that the rpc:call/3 will be executed in a
> temporary process on catbus; when the call completes, the
> process is terminated, and since it is the owner of the file
> descriptor, the file will be closed automatically.

Ah, that makes sense.

I tried various ways of working around this, but as they got
increasingly complex with still no luck, I gave up on this approach.

> I think what you want to do is to run your other nodes as
> loader slaves to catbus. It's not incredibly clear from the
> documentation (or I haven't found the place in the
> documentation where it's clearly described) how to do this.
> You may try with erl -loader inet -hosts ...

That's pretty neat :)  After I figured out that I had to start erl with
-mode embedded as well, I got catbus to load all its code from the other
computer (whose node started erl_boot_server, so actually catbus was the
loader slave) - and proved it to myself by removing $ROOT/lib ... neat!

Only weirdness was the following messages on catbus on startup:

  exec: ose_inet: not found

And on exiting:

  Error in process <0.2.0> with exit value: {badarg,[{erlang,unlink,
  [noport]},{erl_prim_loader,stop_port,1},{erl_prim_loader,loop,3}]}

But it otherwise worked fine.

> or reading the code in file_server.erl, one might perhaps
> try erl -master catbus@REDACTED, but that doesn't seem
> to work for me, and I don't find any documentation on it.

Me neither, it just hangs when I try it.

> (I'm sorry I can't give you a working example. From a
> cursory glance, it's not obvious to me how one tests an
> erlang node using another erlang node on the same host as a
> boot loader (it seems consistent with the erlang philosophy
> that one should be able to do this), and I'm not sure if you
> need to use a boot server in order to have a file server.
> I'm sure this is explained in the docs somewhere, but it's
> late, and I intend to go home and get some sleep.)
> 
> /Uffe

No problem, thanks for pointing me in what seems to be the right
direction.  I've gained a lot of insight just wrestling with this.

If the raison d'etre of the distributed file server is to load code,
then it might not be what I'm looking for (not that I know exactly what
I'm looking for...)

Feels like it'd be limited to erl_prim_loader:get_file/1.

Looking at file.erl, it mostly seems to look for processes named
file_server or file_server_2 on the *local* node.  I'm not sure how one
would tell it to look for that process on some external node, besides
hacking the source.

Although, an intuitive way from a usage perspective would be

  file:open(".cshrc", [read, {on_node, catbus@REDACTED}]).

Or, using "Joe logic", perhaps

  file:open({catbus@REDACTED, ".cshrc"}, [read]).

to make it orthogonal with file:delete({Node, FileName}) et al.

Other than that, I don't know where I'm going with this, and I'll have
to re-examine my assumptions.

-Chris



More information about the erlang-questions mailing list