Skip to content

[WASMFS] Placeholder for filesystem api change

enabling -s WASMFS shows two issues : 1.

warning: undefined symbol: $SOCKFS (referenced by $getSocketFromFD__deps: ['$SOCKFS','$FS'], referenced by __syscall_accept4__deps: ['$getSocketFromFD','$writeSockaddr','$DNS','$SYSCALLS'], referenced by top-level compiled C/C++ code)

linking with -lsockfs.js is not a solution because it will call .mount() with the wrong filesystem.

  1. Assuming we don't need this syscall for now, in the runtime we have an assert :
Uncaught RuntimeError: Aborted(Assertion failed: (flags & ~(O_CREAT | O_EXCL | O_DIRECTORY | O_TRUNC | O_APPEND | O_RDWR | O_WRONLY | O_RDONLY | O_LARGEFILE | O_CLOEXEC)) == 0, at: /b/s/w/ir/x/w/install/emscripten/system/lib/wasmfs/syscalls.cpp,388,doOpen)
    at abort (experimental.js:2171:11)
    at ___assert_fail (experimental.js:2860:7)
    at doOpen(wasmfs::path::ParsedParent, long, unsigned int, wasmfs::Backend*) (experimental.wasm:0xdac1d8)
    at __syscall_openat (experimental.wasm:0xdac4eb)
    at open (experimental.wasm:0xdc53e8)
    at vlc_open (experimental.wasm:0xda5407)
    at FileOpen (experimental.wasm:0x113eaa)
    at generic_start (experimental.wasm:0xd3069b)
    at vlc_module_load (experimental.wasm:0xd30529)
    at module_need (experimental.wasm:0xd3061b)

That means that some flags are not supported, if we remove the assert, the demo works.

Next step is to add a backend to allow reading a previously selected file in a dedicated pthread (or wasm worker)