e9p - pure Erlang 9p implementation

Source: tangled.org
34 points by hauleth 8 hours ago on lobsters | 0 comments

Pure Erlang implementation of 9p2000 protocol

filesystem fs 9p2000 erlang 9p

27 1 1

Clone this repository

https://tangled.org/hauleth.dev/e9p

git@knot.hauleth.dev:hauleth.dev/e9p

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz

commits 27

While QID already contains that information, it is required to also
store it in `mode` field for some reason. Linux `v9fs` driver requires
that flag to be set, so we set it.

Currently `e9p` supports only "legacy" version (with no extensions) so
always report that, even if version with some extensions is requested.

It is basic, read-only, implementation of ERTS system information
filesystem. So far the implementation contains 3 directories:

- `processes` with list of processes containing basic process information
- `applications` with list of loaded applications as well as basic
information about these
- `system_info` with information about ERTS

Future improvements should add `memory` and `statistics` paths as well
and things like removing process directory as a way to kill process or
pseudo-file that will allow sending messages to processes.

Implementation of 9p2000 file protocol in Erlang

Goals#

  • Message parsing
  • Client implementation
    • Establishing connection
    • Tree walking
    • IO server implementation for reading/writing files
    • File/directory creation
    • File/directory deletion
    • File stats
  • Server implementation
    • Establishing connection
    • Tree walking
    • File/directory creation
    • File/directory deletion
    • File stats
    • Customisable FS implementations

Example FS#

  • UnixFs - which will simply allow accessing some "real" directory in system FS. WIP: Implemented directory traversal, file writing/reading/deletion, but so far no file nor directory creation.
  • ErlProcFS - which will expose Erlang process tree and other internal data via API similar to procfs from Linux. Read-only for the time of being.

Reasoning#

I want to implement procfs-like API for Erlang to allow non-Erlang-fluent operators to navigate through Erlang processes. There is something similar implemented in fuserl, but that uses libfuse, which is NIF implemented. That requires compilation of native code and can be problematic wrt cross compilation and stuff. On the other hand 9p2000 is network protocol that can be implemented fully in Erlang, thus do not require any additional tools or compilation steps. It can also be accessed remotely if needed.

License#

Apache-2.0 with exception to PropEr tests which are GPL-3.0-only. This do not affect possibility to run this project as dependency of non-GPL projects, as GPL code is not used in runtime. Unfortunately that workaround is needed due to PropEr licensing.