For example https://github.com/WebAssembly/wasi-libc/blob/ad5133410f66b93a2381db5b542aad5e0964db96/libc-bottom-half/headers/public/__header_fcntl.h#L20 compared to musl libc it is #define O_RDONLY 00
Seems like wasm-libc has always been like this, but it would be better if it used the same constants as wasm built with musl libc (e.g. emscripten), cannot be run with wasmtime.
This therefore means that runtimes, like dotnet, need 2 different runtimes depending on what the host is which is not great.
The original reason is that cloudlibc did it that way, and the code comes from there.
From a libc maintainer perspective, these values are implementation details. musl only has a single value because musl only supports Linux, where O_RDONLY
always has the same value. But across other platforms, it can have different values.
wasi-libc is not ABI-compatible with Emscripten in numerous ways, and no one has ever volunteered to do the work to make it be so.
That said, from a practical perspective, some C / POSIX constants are sufficiently "well known" that we do make efforts to align their values with the well-known values. This is somewhat subjective, so whether O_RDONLY
should qualify as having a well-known value would come down to how it's used in practice, how you're using it.
Thanks. Trying to use open
from the dotnet runtime to make the wasm runtime similar to the Unix runtime, reducing developer cost. I suppose the argument is that dotnet should not do that, but go straight to the wasi syscalls where the flags are well defined.
Which would be ok in the long run, but emscripten's wasi support is a WIP, whereas it's libc support is good.
Not that that helps much. The only system that is at fault here is the dotnet runtime, I just tried to take the libc route (emscripten and wasi-libc) and came unstuck.
Scott Waye has marked this topic as resolved.
Last updated: Dec 23 2024 at 13:07 UTC