Stream: general

Topic: I want to propose adding file system locking to WASI


view this post on Zulip Andrew Kelley (Dec 01 2022 at 21:42):

I'm exploring using a WASI binary committed to source control as a way to portably build Zig from source. The experiment is a success, however, I have an issue that the cache system doesn't work properly because WASI does not support an advisory file system locking mechanism. How can I propose to add this to the WASI specification?

https://github.com/ziglang/zig/issues/13589

https://github.com/ziglang/zig/blob/2823fcabd1974550b889a56e8ada0eb52f3d2080/src/Cache.zig#L859-L886

https://github.com/WebAssembly/wasi-filesystem/issues/2

Zig Version 9f317bf Steps to Reproduce and Observed Behavior git checkout wasi-bootstrap mkdir build && cd build && cmake .. [stuff] make -j$N # where N > 1 Expected Behavior The...
General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software. - zig/Cache.zig at 2823fcabd1974550b889a56e8ada0eb52f3d2080 · ziglang/zig
Sqlite and the Emscripten cache file are two cases where file locking has come up in real-world use cases. The POSIX way to do file locking, with fcntl and F_SETLK/F_GETLK-style locks has the unfor...

view this post on Zulip Dan Gohman (Dec 02 2022 at 15:44):

The PR to add it to the wasi-filesystem proposal is here: https://github.com/WebAssembly/wasi-filesystem/pull/69

Add functions which correspond to flock in Unix. This is not a POSIX interface, but it's sufficiently portable, there's a way to implement it on Windows, and it doesn't have problematic process-ass...

view this post on Zulip Dan Gohman (Dec 02 2022 at 15:45):

That said, it won't be immediately available in wasm engines, because new spec work is being done in the wit IDL, which replaces the old witx IDL, and WASI is currently still working on transitioning everything over to wit.


Last updated: Oct 23 2024 at 20:03 UTC