WebAssembly / wasi-libc

WASI libc implementation for WebAssembly
https://wasi.dev
Other
812 stars 188 forks source link

add stubs for `statvfs`, `chmod`, etc. #463

Closed dicej closed 4 months ago

dicej commented 4 months ago

Per https://github.com/WebAssembly/wasi-sdk/issues/373, LLVM's libc++ no longer allows us to enable <fstream> and <filesystem> separately -- it's both or neither. Consequently, we either need to patch libc++ to not use statvfs, chmod, etc. or add stub functions for those features to wasi-libc. Since we're planning to eventually support those features with WASI Preview 2 and beyond, it makes sense to do the latter.

Note that since libc++ uses DT_SOCK, I've added a definition for it -- even though WASI Preview 1 does not define it. No Preview 1 file will ever have that type, so code that handles that type will never be reached, but defining it allows us to avoid WASI-specific patches to libc++.

Related to DT_SOCK, I had to change the S_IFIFO value so it does not conflict with S_IFSOCK, thereby avoiding ambiguity in __wasilibc_iftodt.