Coder Social home page Coder Social logo

erlang-efuse's People

Contributors

mwri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

erlang-efuse's Issues

Not building on OTP 22 (on Mac)

I'm on: Erlang/OTP 22 [erts-10.7.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Trying to build this, on a Mac if that matters, and it fails:

===> Compiling efuse
gcc -c -Wall -std=gnu99 -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -shared -g -Wall -fPIC -MMD  -I"/usr/lib/erlang/lib/erl_interface-3.10.1/include" -I"/usr/lib/erlang/erts-9.2/include" efuse.c -o efuse.o
clang: warning: argument unused during compilation: '-shared' [-Wunused-command-line-argument]
gcc efuse.o  -lerl_interface -lei -pthread -lnsl -lfuse -lrt -ldl -o efuse
ld: library not found for -lerl_interface
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [efuse] Error 1
===> Hook for compile failed!

Hope that tells you something. Was really keen on trying this in a small personal project. But not really wanting to roll backwards with Elixir and Erlang versions.

Has it been known to build on Mac okay?

Building against macFUSE and JIT-enabled OTP 25 potentially

I've tried building this on macOS (macFUSE -lfuse is on par witgh the Linux one) with OTP 25 (erts-13.0.2) but unfortunately ran into a bunch of issues, namely I've had to remove some links i.e.

diff --git a/c_src/Makefile b/c_src/Makefile
index 1e65fe2..198ff7e 100644
--- a/c_src/Makefile
+++ b/c_src/Makefile
@@ -1,10 +1,10 @@
 all: efuse

 efuse.o: efuse.c efuse_defs.h
-       gcc -c -Wall -std=gnu99 -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -shared -g -Wall -fPIC -MMD  -I"/usr/lib/erlang/lib/erl_interface-3.10.1/include" -I"/usr/lib/erlang/erts-9.2/include" efuse.c -o efuse.o
+       gcc -c -Wall -std=gnu99 -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -shared -g -Wall -fPIC -MMD efuse.c -o efuse.o

 efuse: efuse.o
-       gcc efuse.o  -lerl_interface -lei -pthread -lnsl -lfuse -lrt -ldl -o efuse
+       gcc efuse.o -pthread -lfuse -ldl -o efuse
        cp efuse ../priv/

This is something I've had to do because neither were available, and correct me if I'm wrong, libnsl is not available on darwin, I've only found this for amd64... Either way, having castrated a bunch of objects out of the resulting binary, I could successfully build efuse

/o/b/efuse$ make
rebar3 compile
===> Fetching rebar3_hex v7.0.2
===> Fetching hex_core v0.8.4
===> Fetching verl v1.1.1
===> Analyzing applications...
===> Compiling hex_core
===> Compiling verl
===> Compiling rebar3_hex
===> Verifying dependencies...
gcc -c -Wall -std=gnu99 -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -shared -g -Wall -fPIC -MMD efuse.c -o efuse.o
clang: warning: argument unused during compilation: '-shared' [-Wunused-command-line-argument]
gcc efuse.o -pthread -lfuse -ldl -o efuse
cp efuse ../priv/
===> Analyzing applications...
===> Compiling efuse

However improbable it would seem, only one of the tests has failed... I don't know if it says more about my approach, or the quality of your tests but either way here it is what it is:

/o/b/efuse$ make test
mkdir -p deps
rm -f deps/efuse
ln -s .. deps/efuse
rebar3 ct
===> Fetching coveralls v2.2.0
===> Fetching jsx v2.10.0
===> Analyzing applications...
===> Compiling jsx
===> Compiling coveralls
===> Verifying dependencies...
make[1]: Nothing to be done for `all'.
===> Analyzing applications...
===> Compiling efuse
test/efuse_SUITE.erl:4:2: Warning: export_all flag enabled - all functions will be exported

===> Running Common Test suites...
=INFO REPORT==== 1-Aug-2022::14:40:22.471780 ===
    application: efuse
    exited: stopped
    type: temporary

Failed 1 tests. Passed 8 tests.
Results written to "/opt/badt/efuse/_build/test/logs/index.html".
===> Failures occurred running tests: 1
make: *** [test] Error 1

The result is not comprehensive to me, yet I will provide it nonetheless.

=== Test case: [efuse_SUITE:read_files/1](https://github.com/mwri/erlang-efuse/issues/efuse_suite.src.html#read_files-1) (click for source code)

=== Config value:

    [{mount_dir,"/tmp/erlang_ct_mount_efuse_erlfs"},
     {erlfs_cbmod,efuse_erlfs},
     {file_reads,[{"apps/efuse/descr",
                   "Erlang FUSE (Filesystem in Userspace)\n"}]},
     {watchdog,<0.685.0>},
     {tc_logfile,"/opt/badt/efuse/_build/test/logs/[email protected]_14.40.21/lib.efuse.logs/run.2022-08-01_14.40.21/efuse_suite.read_files.html"},
     {tc_group_properties,[{name,efuse_erlfs}]},
     {tc_group_path,[]},
     {data_dir,"/opt/badt/efuse/_build/test/lib/efuse/test/efuse_SUITE_data/"},
     {priv_dir,"/opt/badt/efuse/_build/test/logs/[email protected]_14.40.21/lib.efuse.logs/run.2022-08-01_14.40.21/log_private/"}]

=== Current directory is "/opt/badt/efuse/_build/test/logs/[email protected]_14.40.21"

=== Started at 2022-08-01 14:40:21




*** CT Error Notification 2022-08-01 14:40:21.956 ***[🔗](https://github.com/mwri/erlang-efuse/issues/new#e-1)
efuse_SUITE:'-read_files/1-fun-0-' failed on line 74
Reason: {badmatch,"cat: /tmp/erlang_ct_mount_efuse_erlfs/apps/efuse/...}

[Full error description and stacktrace](https://github.com/mwri/erlang-efuse/issues/new#end)



=== Ended at 2022-08-01 14:40:21
=== Location: [{efuse_SUITE,'-read_files/1-fun-0-',[74](https://github.com/mwri/erlang-efuse/issues/efuse_suite.src.html#74)},
              {lists,foreach_1,1442},
              {efuse_SUITE,read_files,[72](https://github.com/mwri/erlang-efuse/issues/efuse_suite.src.html#72)},
              {test_server,ts_tc,1782},
              {test_server,run_test_case_eval1,1291},
              {test_server,run_test_case_eval,1223}]
=== === Reason: no match of right hand side value "cat: /tmp/erlang_ct_mount_efuse_erlfs/apps/efuse/descr: No such file or directory\n"
  in function  efuse_SUITE:'-read_files/1-fun-0-'/2 (/opt/badt/efuse/test/efuse_SUITE.erl, line 74)
  in call from lists:foreach_1/2 (lists.erl, line 1442)
  in call from efuse_SUITE:read_files/1 (/opt/badt/efuse/test/efuse_SUITE.erl, line 72)
  in call from test_server:ts_tc/3 (test_server.erl, line 1782)
  in call from test_server:run_test_case_eval1/6 (test_server.erl, line 1291)
  in call from test_server:run_test_case_eval/9 (test_server.erl, line 1223)

I really wonder if it would ever be possible to use FUSE/macFUSE in Elixir.

The reason why I'm going at such length, and why I believe it's worth the effort for you to help me out with this, is that I'm currently working on a pretty interesting project which is a FUSE-enabled supervision tree monitor tool akin to what observer does augmented with the state/scope debugging. Meaning: you would be able to run cat-grep/ripgrep-xargs pipelines on the actively running Elixir programs and extract runtime information in this way. You can think of it like as-if you had IO.inspect everywhere but you don't actually have to do this. Zero overhead unless grep begins to open() and read() various processes for information.

supmon /mountpoint
cd /mountpoint
ripgrep -l uuid | xargs ripgrep pattern
# will make a list of processes involved with `uuid` and—
# search for a `pattern` among these processes!
#
# nothing like this would normally be possible in Elixir, but with FUSE— very much so!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.