|
cwist
Modern C web framework with libttak runtime
|
WASI target feature detection shared by all CWIST sources. More...

Go to the source code of this file.
WASI target feature detection shared by all CWIST sources.
__wasi__ is defined by both WASI preview1 (wasm32-wasi) and WASI 0.2 (wasm32-wasip2) targets, but their libc capabilities differ sharply: preview1 has no sockets at all, while wasip2 exposes wasi:sockets through the standard <sys/socket.h> API (plus netdb, MSG_NOSIGNAL, poll). Neither has fork(2), signals, or rlimits, and both are single-threaded unless the -threads sysroot variant is used.
Feature-gate on what the sysroot actually provides instead of the bare __wasi__ macro:
Capability guards go through <cwist/sys/platform.h>, which folds these into CWIST_PLATFORM_NO_SOCKETS and CWIST_PLATFORM_NO_PROC (the fork/signals/rlimits/threads neither WASI flavour provides) so bare-metal targets share them. CWIST_WASI_SOCKETS stays for wasi:sockets quirks.
Definition in file wasi.h.