emscripten icon indicating copy to clipboard operation
emscripten copied to clipboard

Should we support inter-process file locking?

Open sbc100 opened this issue 1 year ago • 1 comments

Right now we simply stub out calls like flock and fcntl+F_SETLK.

At least for the OPFS wasmfs backend it seems like it could be usefull?

I assume that the OPFS filesystem can be shared between multiple running emscripten programs? (or the same program running in multiple tabs?)

Are there any other FS backends that could benefit?

sbc100 avatar Feb 18 '25 20:02 sbc100

This is something we are exploring with WordPress Playground for use with NODEFS (currently with the legacy FS).

I prototyped an async override for fcntl() to support F_GETLK and F_SETLK so multiple manually-created php-wasm workers could share a SQLite DB file without corruption.

brandonpayton avatar Apr 22 '25 18:04 brandonpayton

To close the loop, @brandonpayton implemented fcntl() for WordPress Playground's PHP.wasm in https://github.com/WordPress/wordpress-playground/pull/2231

adamziel avatar Jul 05 '25 18:07 adamziel