/**1* THIS FILE IS AUTO-GENERATED from the following files:2* typenames.witx, wasi_snapshot_preview1.witx3*4* @file5* This file describes the [WASI] interface, consisting of functions, types,6* and defined values (macros).7*8* The interface described here is greatly inspired by [CloudABI]'s clean,9* thoughtfully-designed, capability-oriented, POSIX-style API.10*11* [CloudABI]: https://github.com/NuxiNL/cloudlibc12* [WASI]: https://github.com/WebAssembly/WASI/13*/1415/*16* File origin:17* https://github.com/WebAssembly/wasi-libc/blob/main/libc-bottom-half/headers/public/wasi/api.h18* Revision:19* 2c2fc9a2fddd0927a66f1c142e65c8dab6f5c5d720* License:21* CC0 1.0 Universal (CC0 1.0) Public Domain Dedication22* https://creativecommons.org/publicdomain/zero/1.0/23*/2425#ifndef __wasi_api_h26#define __wasi_api_h2728#include <stddef.h>29#include <stdint.h>3031#pragma push_macro("_Static_assert")32#undef _Static_assert33#define _Static_assert(X, Y)3435_Static_assert(_Alignof(int8_t) == 1, "non-wasi data layout");36_Static_assert(_Alignof(uint8_t) == 1, "non-wasi data layout");37_Static_assert(_Alignof(int16_t) == 2, "non-wasi data layout");38_Static_assert(_Alignof(uint16_t) == 2, "non-wasi data layout");39_Static_assert(_Alignof(int32_t) == 4, "non-wasi data layout");40_Static_assert(_Alignof(uint32_t) == 4, "non-wasi data layout");41_Static_assert(_Alignof(int64_t) == 8, "non-wasi data layout");42_Static_assert(_Alignof(uint64_t) == 8, "non-wasi data layout");43_Static_assert(_Alignof(void*) == 4, "non-wasi data layout");4445#ifdef __cplusplus46extern "C" {47#endif4849// TODO: Encoding this in witx.50#define __WASI_DIRCOOKIE_START (UINT64_C(0))51typedef __SIZE_TYPE__ __wasi_size_t;5253_Static_assert(sizeof(__wasi_size_t) == 4, "witx calculated size");54_Static_assert(_Alignof(__wasi_size_t) == 4, "witx calculated align");5556/**57* Non-negative file size or length of a region within a file.58*/59typedef uint64_t __wasi_filesize_t;6061_Static_assert(sizeof(__wasi_filesize_t) == 8, "witx calculated size");62_Static_assert(_Alignof(__wasi_filesize_t) == 8, "witx calculated align");6364/**65* Timestamp in nanoseconds.66*/67typedef uint64_t __wasi_timestamp_t;6869_Static_assert(sizeof(__wasi_timestamp_t) == 8, "witx calculated size");70_Static_assert(_Alignof(__wasi_timestamp_t) == 8, "witx calculated align");7172/**73* Identifiers for clocks.74*/75typedef uint32_t __wasi_clockid_t;7677/**78* The clock measuring real time. Time value zero corresponds with79* 1970-01-01T00:00:00Z.80*/81#define __WASI_CLOCKID_REALTIME (UINT32_C(0))8283/**84* The store-wide monotonic clock, which is defined as a clock measuring85* real time, whose value cannot be adjusted and which cannot have negative86* clock jumps. The epoch of this clock is undefined. The absolute time87* value of this clock therefore has no meaning.88*/89#define __WASI_CLOCKID_MONOTONIC (UINT32_C(1))9091/**92* The CPU-time clock associated with the current process.93*/94#define __WASI_CLOCKID_PROCESS_CPUTIME_ID (UINT32_C(2))9596/**97* The CPU-time clock associated with the current thread.98*/99#define __WASI_CLOCKID_THREAD_CPUTIME_ID (UINT32_C(3))100101_Static_assert(sizeof(__wasi_clockid_t) == 4, "witx calculated size");102_Static_assert(_Alignof(__wasi_clockid_t) == 4, "witx calculated align");103104/**105* Error codes returned by functions.106* Not all of these error codes are returned by the functions provided by this107* API; some are used in higher-level library layers, and others are provided108* merely for alignment with POSIX.109*/110typedef uint16_t __wasi_errno_t;111112/**113* No error occurred. System call completed successfully.114*/115#define __WASI_ERRNO_SUCCESS (UINT16_C(0))116117/**118* Argument list too long.119*/120#define __WASI_ERRNO_2BIG (UINT16_C(1))121122/**123* Permission denied.124*/125#define __WASI_ERRNO_ACCES (UINT16_C(2))126127/**128* Address in use.129*/130#define __WASI_ERRNO_ADDRINUSE (UINT16_C(3))131132/**133* Address not available.134*/135#define __WASI_ERRNO_ADDRNOTAVAIL (UINT16_C(4))136137/**138* Address family not supported.139*/140#define __WASI_ERRNO_AFNOSUPPORT (UINT16_C(5))141142/**143* Resource unavailable, or operation would block.144*/145#define __WASI_ERRNO_AGAIN (UINT16_C(6))146147/**148* Connection already in progress.149*/150#define __WASI_ERRNO_ALREADY (UINT16_C(7))151152/**153* Bad file descriptor.154*/155#define __WASI_ERRNO_BADF (UINT16_C(8))156157/**158* Bad message.159*/160#define __WASI_ERRNO_BADMSG (UINT16_C(9))161162/**163* Device or resource busy.164*/165#define __WASI_ERRNO_BUSY (UINT16_C(10))166167/**168* Operation canceled.169*/170#define __WASI_ERRNO_CANCELED (UINT16_C(11))171172/**173* No child processes.174*/175#define __WASI_ERRNO_CHILD (UINT16_C(12))176177/**178* Connection aborted.179*/180#define __WASI_ERRNO_CONNABORTED (UINT16_C(13))181182/**183* Connection refused.184*/185#define __WASI_ERRNO_CONNREFUSED (UINT16_C(14))186187/**188* Connection reset.189*/190#define __WASI_ERRNO_CONNRESET (UINT16_C(15))191192/**193* Resource deadlock would occur.194*/195#define __WASI_ERRNO_DEADLK (UINT16_C(16))196197/**198* Destination address required.199*/200#define __WASI_ERRNO_DESTADDRREQ (UINT16_C(17))201202/**203* Mathematics argument out of domain of function.204*/205#define __WASI_ERRNO_DOM (UINT16_C(18))206207/**208* Reserved.209*/210#define __WASI_ERRNO_DQUOT (UINT16_C(19))211212/**213* File exists.214*/215#define __WASI_ERRNO_EXIST (UINT16_C(20))216217/**218* Bad address.219*/220#define __WASI_ERRNO_FAULT (UINT16_C(21))221222/**223* File too large.224*/225#define __WASI_ERRNO_FBIG (UINT16_C(22))226227/**228* Host is unreachable.229*/230#define __WASI_ERRNO_HOSTUNREACH (UINT16_C(23))231232/**233* Identifier removed.234*/235#define __WASI_ERRNO_IDRM (UINT16_C(24))236237/**238* Illegal byte sequence.239*/240#define __WASI_ERRNO_ILSEQ (UINT16_C(25))241242/**243* Operation in progress.244*/245#define __WASI_ERRNO_INPROGRESS (UINT16_C(26))246247/**248* Interrupted function.249*/250#define __WASI_ERRNO_INTR (UINT16_C(27))251252/**253* Invalid argument.254*/255#define __WASI_ERRNO_INVAL (UINT16_C(28))256257/**258* I/O error.259*/260#define __WASI_ERRNO_IO (UINT16_C(29))261262/**263* Socket is connected.264*/265#define __WASI_ERRNO_ISCONN (UINT16_C(30))266267/**268* Is a directory.269*/270#define __WASI_ERRNO_ISDIR (UINT16_C(31))271272/**273* Too many levels of symbolic links.274*/275#define __WASI_ERRNO_LOOP (UINT16_C(32))276277/**278* File descriptor value too large.279*/280#define __WASI_ERRNO_MFILE (UINT16_C(33))281282/**283* Too many links.284*/285#define __WASI_ERRNO_MLINK (UINT16_C(34))286287/**288* Message too large.289*/290#define __WASI_ERRNO_MSGSIZE (UINT16_C(35))291292/**293* Reserved.294*/295#define __WASI_ERRNO_MULTIHOP (UINT16_C(36))296297/**298* Filename too long.299*/300#define __WASI_ERRNO_NAMETOOLONG (UINT16_C(37))301302/**303* Network is down.304*/305#define __WASI_ERRNO_NETDOWN (UINT16_C(38))306307/**308* Connection aborted by network.309*/310#define __WASI_ERRNO_NETRESET (UINT16_C(39))311312/**313* Network unreachable.314*/315#define __WASI_ERRNO_NETUNREACH (UINT16_C(40))316317/**318* Too many files open in system.319*/320#define __WASI_ERRNO_NFILE (UINT16_C(41))321322/**323* No buffer space available.324*/325#define __WASI_ERRNO_NOBUFS (UINT16_C(42))326327/**328* No such device.329*/330#define __WASI_ERRNO_NODEV (UINT16_C(43))331332/**333* No such file or directory.334*/335#define __WASI_ERRNO_NOENT (UINT16_C(44))336337/**338* Executable file format error.339*/340#define __WASI_ERRNO_NOEXEC (UINT16_C(45))341342/**343* No locks available.344*/345#define __WASI_ERRNO_NOLCK (UINT16_C(46))346347/**348* Reserved.349*/350#define __WASI_ERRNO_NOLINK (UINT16_C(47))351352/**353* Not enough space.354*/355#define __WASI_ERRNO_NOMEM (UINT16_C(48))356357/**358* No message of the desired type.359*/360#define __WASI_ERRNO_NOMSG (UINT16_C(49))361362/**363* Protocol not available.364*/365#define __WASI_ERRNO_NOPROTOOPT (UINT16_C(50))366367/**368* No space left on device.369*/370#define __WASI_ERRNO_NOSPC (UINT16_C(51))371372/**373* Function not supported.374*/375#define __WASI_ERRNO_NOSYS (UINT16_C(52))376377/**378* The socket is not connected.379*/380#define __WASI_ERRNO_NOTCONN (UINT16_C(53))381382/**383* Not a directory or a symbolic link to a directory.384*/385#define __WASI_ERRNO_NOTDIR (UINT16_C(54))386387/**388* Directory not empty.389*/390#define __WASI_ERRNO_NOTEMPTY (UINT16_C(55))391392/**393* State not recoverable.394*/395#define __WASI_ERRNO_NOTRECOVERABLE (UINT16_C(56))396397/**398* Not a socket.399*/400#define __WASI_ERRNO_NOTSOCK (UINT16_C(57))401402/**403* Not supported, or operation not supported on socket.404*/405#define __WASI_ERRNO_NOTSUP (UINT16_C(58))406407/**408* Inappropriate I/O control operation.409*/410#define __WASI_ERRNO_NOTTY (UINT16_C(59))411412/**413* No such device or address.414*/415#define __WASI_ERRNO_NXIO (UINT16_C(60))416417/**418* Value too large to be stored in data type.419*/420#define __WASI_ERRNO_OVERFLOW (UINT16_C(61))421422/**423* Previous owner died.424*/425#define __WASI_ERRNO_OWNERDEAD (UINT16_C(62))426427/**428* Operation not permitted.429*/430#define __WASI_ERRNO_PERM (UINT16_C(63))431432/**433* Broken pipe.434*/435#define __WASI_ERRNO_PIPE (UINT16_C(64))436437/**438* Protocol error.439*/440#define __WASI_ERRNO_PROTO (UINT16_C(65))441442/**443* Protocol not supported.444*/445#define __WASI_ERRNO_PROTONOSUPPORT (UINT16_C(66))446447/**448* Protocol wrong type for socket.449*/450#define __WASI_ERRNO_PROTOTYPE (UINT16_C(67))451452/**453* Result too large.454*/455#define __WASI_ERRNO_RANGE (UINT16_C(68))456457/**458* Read-only file system.459*/460#define __WASI_ERRNO_ROFS (UINT16_C(69))461462/**463* Invalid seek.464*/465#define __WASI_ERRNO_SPIPE (UINT16_C(70))466467/**468* No such process.469*/470#define __WASI_ERRNO_SRCH (UINT16_C(71))471472/**473* Reserved.474*/475#define __WASI_ERRNO_STALE (UINT16_C(72))476477/**478* Connection timed out.479*/480#define __WASI_ERRNO_TIMEDOUT (UINT16_C(73))481482/**483* Text file busy.484*/485#define __WASI_ERRNO_TXTBSY (UINT16_C(74))486487/**488* Cross-device link.489*/490#define __WASI_ERRNO_XDEV (UINT16_C(75))491492/**493* Extension: Capabilities insufficient.494*/495#define __WASI_ERRNO_NOTCAPABLE (UINT16_C(76))496497_Static_assert(sizeof(__wasi_errno_t) == 2, "witx calculated size");498_Static_assert(_Alignof(__wasi_errno_t) == 2, "witx calculated align");499500/**501* File descriptor rights, determining which actions may be performed.502*/503typedef uint64_t __wasi_rights_t;504505/**506* The right to invoke `fd_datasync`.507* If `path_open` is set, includes the right to invoke508* `path_open` with `fdflags::dsync`.509*/510#define __WASI_RIGHTS_FD_DATASYNC (UINT64_C(1))511512/**513* The right to invoke `fd_read` and `sock_recv`.514* If `rights::fd_seek` is set, includes the right to invoke `fd_pread`.515*/516#define __WASI_RIGHTS_FD_READ (UINT64_C(2))517518/**519* The right to invoke `fd_seek`. This flag implies `rights::fd_tell`.520*/521#define __WASI_RIGHTS_FD_SEEK (UINT64_C(4))522523/**524* The right to invoke `fd_fdstat_set_flags`.525*/526#define __WASI_RIGHTS_FD_FDSTAT_SET_FLAGS (UINT64_C(8))527528/**529* The right to invoke `fd_sync`.530* If `path_open` is set, includes the right to invoke531* `path_open` with `fdflags::rsync` and `fdflags::dsync`.532*/533#define __WASI_RIGHTS_FD_SYNC (UINT64_C(16))534535/**536* The right to invoke `fd_seek` in such a way that the file offset537* remains unaltered (i.e., `whence::cur` with offset zero), or to538* invoke `fd_tell`.539*/540#define __WASI_RIGHTS_FD_TELL (UINT64_C(32))541542/**543* The right to invoke `fd_write` and `sock_send`.544* If `rights::fd_seek` is set, includes the right to invoke `fd_pwrite`.545*/546#define __WASI_RIGHTS_FD_WRITE (UINT64_C(64))547548/**549* The right to invoke `fd_advise`.550*/551#define __WASI_RIGHTS_FD_ADVISE (UINT64_C(128))552553/**554* The right to invoke `fd_allocate`.555*/556#define __WASI_RIGHTS_FD_ALLOCATE (UINT64_C(256))557558/**559* The right to invoke `path_create_directory`.560*/561#define __WASI_RIGHTS_PATH_CREATE_DIRECTORY (UINT64_C(512))562563/**564* If `path_open` is set, the right to invoke `path_open` with `oflags::creat`.565*/566#define __WASI_RIGHTS_PATH_CREATE_FILE (UINT64_C(1024))567568/**569* The right to invoke `path_link` with the file descriptor as the570* source directory.571*/572#define __WASI_RIGHTS_PATH_LINK_SOURCE (UINT64_C(2048))573574/**575* The right to invoke `path_link` with the file descriptor as the576* target directory.577*/578#define __WASI_RIGHTS_PATH_LINK_TARGET (UINT64_C(4096))579580/**581* The right to invoke `path_open`.582*/583#define __WASI_RIGHTS_PATH_OPEN (UINT64_C(8192))584585/**586* The right to invoke `fd_readdir`.587*/588#define __WASI_RIGHTS_FD_READDIR (UINT64_C(16384))589590/**591* The right to invoke `path_readlink`.592*/593#define __WASI_RIGHTS_PATH_READLINK (UINT64_C(32768))594595/**596* The right to invoke `path_rename` with the file descriptor as the source directory.597*/598#define __WASI_RIGHTS_PATH_RENAME_SOURCE (UINT64_C(65536))599600/**601* The right to invoke `path_rename` with the file descriptor as the target directory.602*/603#define __WASI_RIGHTS_PATH_RENAME_TARGET (UINT64_C(131072))604605/**606* The right to invoke `path_filestat_get`.607*/608#define __WASI_RIGHTS_PATH_FILESTAT_GET (UINT64_C(262144))609610/**611* The right to change a file's size (there is no `path_filestat_set_size`).612* If `path_open` is set, includes the right to invoke `path_open` with `oflags::trunc`.613*/614#define __WASI_RIGHTS_PATH_FILESTAT_SET_SIZE (UINT64_C(524288))615616/**617* The right to invoke `path_filestat_set_times`.618*/619#define __WASI_RIGHTS_PATH_FILESTAT_SET_TIMES (UINT64_C(1048576))620621/**622* The right to invoke `fd_filestat_get`.623*/624#define __WASI_RIGHTS_FD_FILESTAT_GET (UINT64_C(2097152))625626/**627* The right to invoke `fd_filestat_set_size`.628*/629#define __WASI_RIGHTS_FD_FILESTAT_SET_SIZE (UINT64_C(4194304))630631/**632* The right to invoke `fd_filestat_set_times`.633*/634#define __WASI_RIGHTS_FD_FILESTAT_SET_TIMES (UINT64_C(8388608))635636/**637* The right to invoke `path_symlink`.638*/639#define __WASI_RIGHTS_PATH_SYMLINK (UINT64_C(16777216))640641/**642* The right to invoke `path_remove_directory`.643*/644#define __WASI_RIGHTS_PATH_REMOVE_DIRECTORY (UINT64_C(33554432))645646/**647* The right to invoke `path_unlink_file`.648*/649#define __WASI_RIGHTS_PATH_UNLINK_FILE (UINT64_C(67108864))650651/**652* If `rights::fd_read` is set, includes the right to invoke `poll_oneoff` to subscribe to `eventtype::fd_read`.653* If `rights::fd_write` is set, includes the right to invoke `poll_oneoff` to subscribe to `eventtype::fd_write`.654*/655#define __WASI_RIGHTS_POLL_FD_READWRITE (UINT64_C(134217728))656657/**658* The right to invoke `sock_shutdown`.659*/660#define __WASI_RIGHTS_SOCK_SHUTDOWN (UINT64_C(268435456))661662_Static_assert(sizeof(__wasi_rights_t) == 8, "witx calculated size");663_Static_assert(_Alignof(__wasi_rights_t) == 8, "witx calculated align");664665/**666* A file descriptor index.667*/668typedef uint32_t __wasi_fd_t;669670_Static_assert(sizeof(__wasi_fd_t) == 4, "witx calculated size");671_Static_assert(_Alignof(__wasi_fd_t) == 4, "witx calculated align");672673/**674* A region of memory for scatter/gather reads.675*/676typedef struct __wasi_iovec_t {677/**678* The address of the buffer to be filled.679*/680uint8_t * buf;681682/**683* The length of the buffer to be filled.684*/685__wasi_size_t buf_len;686687} __wasi_iovec_t;688689_Static_assert(sizeof(__wasi_iovec_t) == 8, "witx calculated size");690_Static_assert(_Alignof(__wasi_iovec_t) == 4, "witx calculated align");691_Static_assert(offsetof(__wasi_iovec_t, buf) == 0, "witx calculated offset");692_Static_assert(offsetof(__wasi_iovec_t, buf_len) == 4, "witx calculated offset");693694/**695* A region of memory for scatter/gather writes.696*/697typedef struct __wasi_ciovec_t {698/**699* The address of the buffer to be written.700*/701const uint8_t * buf;702703/**704* The length of the buffer to be written.705*/706__wasi_size_t buf_len;707708} __wasi_ciovec_t;709710_Static_assert(sizeof(__wasi_ciovec_t) == 8, "witx calculated size");711_Static_assert(_Alignof(__wasi_ciovec_t) == 4, "witx calculated align");712_Static_assert(offsetof(__wasi_ciovec_t, buf) == 0, "witx calculated offset");713_Static_assert(offsetof(__wasi_ciovec_t, buf_len) == 4, "witx calculated offset");714715/**716* Relative offset within a file.717*/718typedef int64_t __wasi_filedelta_t;719720_Static_assert(sizeof(__wasi_filedelta_t) == 8, "witx calculated size");721_Static_assert(_Alignof(__wasi_filedelta_t) == 8, "witx calculated align");722723/**724* The position relative to which to set the offset of the file descriptor.725*/726typedef uint8_t __wasi_whence_t;727728/**729* Seek relative to start-of-file.730*/731#define __WASI_WHENCE_SET (UINT8_C(0))732733/**734* Seek relative to current position.735*/736#define __WASI_WHENCE_CUR (UINT8_C(1))737738/**739* Seek relative to end-of-file.740*/741#define __WASI_WHENCE_END (UINT8_C(2))742743_Static_assert(sizeof(__wasi_whence_t) == 1, "witx calculated size");744_Static_assert(_Alignof(__wasi_whence_t) == 1, "witx calculated align");745746/**747* A reference to the offset of a directory entry.748*749* The value 0 signifies the start of the directory.750*/751typedef uint64_t __wasi_dircookie_t;752753_Static_assert(sizeof(__wasi_dircookie_t) == 8, "witx calculated size");754_Static_assert(_Alignof(__wasi_dircookie_t) == 8, "witx calculated align");755756/**757* The type for the $d_namlen field of $dirent.758*/759typedef uint32_t __wasi_dirnamlen_t;760761_Static_assert(sizeof(__wasi_dirnamlen_t) == 4, "witx calculated size");762_Static_assert(_Alignof(__wasi_dirnamlen_t) == 4, "witx calculated align");763764/**765* File serial number that is unique within its file system.766*/767typedef uint64_t __wasi_inode_t;768769_Static_assert(sizeof(__wasi_inode_t) == 8, "witx calculated size");770_Static_assert(_Alignof(__wasi_inode_t) == 8, "witx calculated align");771772/**773* The type of a file descriptor or file.774*/775typedef uint8_t __wasi_filetype_t;776777/**778* The type of the file descriptor or file is unknown or is different from any of the other types specified.779*/780#define __WASI_FILETYPE_UNKNOWN (UINT8_C(0))781782/**783* The file descriptor or file refers to a block device inode.784*/785#define __WASI_FILETYPE_BLOCK_DEVICE (UINT8_C(1))786787/**788* The file descriptor or file refers to a character device inode.789*/790#define __WASI_FILETYPE_CHARACTER_DEVICE (UINT8_C(2))791792/**793* The file descriptor or file refers to a directory inode.794*/795#define __WASI_FILETYPE_DIRECTORY (UINT8_C(3))796797/**798* The file descriptor or file refers to a regular file inode.799*/800#define __WASI_FILETYPE_REGULAR_FILE (UINT8_C(4))801802/**803* The file descriptor or file refers to a datagram socket.804*/805#define __WASI_FILETYPE_SOCKET_DGRAM (UINT8_C(5))806807/**808* The file descriptor or file refers to a byte-stream socket.809*/810#define __WASI_FILETYPE_SOCKET_STREAM (UINT8_C(6))811812/**813* The file refers to a symbolic link inode.814*/815#define __WASI_FILETYPE_SYMBOLIC_LINK (UINT8_C(7))816817_Static_assert(sizeof(__wasi_filetype_t) == 1, "witx calculated size");818_Static_assert(_Alignof(__wasi_filetype_t) == 1, "witx calculated align");819820/**821* A directory entry.822*/823typedef struct __wasi_dirent_t {824/**825* The offset of the next directory entry stored in this directory.826*/827__wasi_dircookie_t d_next;828829/**830* The serial number of the file referred to by this directory entry.831*/832__wasi_inode_t d_ino;833834/**835* The length of the name of the directory entry.836*/837__wasi_dirnamlen_t d_namlen;838839/**840* The type of the file referred to by this directory entry.841*/842__wasi_filetype_t d_type;843844} __wasi_dirent_t;845846_Static_assert(sizeof(__wasi_dirent_t) == 24, "witx calculated size");847_Static_assert(_Alignof(__wasi_dirent_t) == 8, "witx calculated align");848_Static_assert(offsetof(__wasi_dirent_t, d_next) == 0, "witx calculated offset");849_Static_assert(offsetof(__wasi_dirent_t, d_ino) == 8, "witx calculated offset");850_Static_assert(offsetof(__wasi_dirent_t, d_namlen) == 16, "witx calculated offset");851_Static_assert(offsetof(__wasi_dirent_t, d_type) == 20, "witx calculated offset");852853/**854* File or memory access pattern advisory information.855*/856typedef uint8_t __wasi_advice_t;857858/**859* The application has no advice to give on its behavior with respect to the specified data.860*/861#define __WASI_ADVICE_NORMAL (UINT8_C(0))862863/**864* The application expects to access the specified data sequentially from lower offsets to higher offsets.865*/866#define __WASI_ADVICE_SEQUENTIAL (UINT8_C(1))867868/**869* The application expects to access the specified data in a random order.870*/871#define __WASI_ADVICE_RANDOM (UINT8_C(2))872873/**874* The application expects to access the specified data in the near future.875*/876#define __WASI_ADVICE_WILLNEED (UINT8_C(3))877878/**879* The application expects that it will not access the specified data in the near future.880*/881#define __WASI_ADVICE_DONTNEED (UINT8_C(4))882883/**884* The application expects to access the specified data once and then not reuse it thereafter.885*/886#define __WASI_ADVICE_NOREUSE (UINT8_C(5))887888_Static_assert(sizeof(__wasi_advice_t) == 1, "witx calculated size");889_Static_assert(_Alignof(__wasi_advice_t) == 1, "witx calculated align");890891/**892* File descriptor flags.893*/894typedef uint16_t __wasi_fdflags_t;895896/**897* Append mode: Data written to the file is always appended to the file's end.898*/899#define __WASI_FDFLAGS_APPEND (UINT16_C(1))900901/**902* Write according to synchronized I/O data integrity completion. Only the data stored in the file is synchronized.903*/904#define __WASI_FDFLAGS_DSYNC (UINT16_C(2))905906/**907* Non-blocking mode.908*/909#define __WASI_FDFLAGS_NONBLOCK (UINT16_C(4))910911/**912* Synchronized read I/O operations.913*/914#define __WASI_FDFLAGS_RSYNC (UINT16_C(8))915916/**917* Write according to synchronized I/O file integrity completion. In918* addition to synchronizing the data stored in the file, the implementation919* may also synchronously update the file's metadata.920*/921#define __WASI_FDFLAGS_SYNC (UINT16_C(16))922923_Static_assert(sizeof(__wasi_fdflags_t) == 2, "witx calculated size");924_Static_assert(_Alignof(__wasi_fdflags_t) == 2, "witx calculated align");925926/**927* File descriptor attributes.928*/929typedef struct __wasi_fdstat_t {930/**931* File type.932*/933__wasi_filetype_t fs_filetype;934935/**936* File descriptor flags.937*/938__wasi_fdflags_t fs_flags;939940/**941* Rights that apply to this file descriptor.942*/943__wasi_rights_t fs_rights_base;944945/**946* Maximum set of rights that may be installed on new file descriptors that947* are created through this file descriptor, e.g., through `path_open`.948*/949__wasi_rights_t fs_rights_inheriting;950951} __wasi_fdstat_t;952953_Static_assert(sizeof(__wasi_fdstat_t) == 24, "witx calculated size");954_Static_assert(_Alignof(__wasi_fdstat_t) == 8, "witx calculated align");955_Static_assert(offsetof(__wasi_fdstat_t, fs_filetype) == 0, "witx calculated offset");956_Static_assert(offsetof(__wasi_fdstat_t, fs_flags) == 2, "witx calculated offset");957_Static_assert(offsetof(__wasi_fdstat_t, fs_rights_base) == 8, "witx calculated offset");958_Static_assert(offsetof(__wasi_fdstat_t, fs_rights_inheriting) == 16, "witx calculated offset");959960/**961* Identifier for a device containing a file system. Can be used in combination962* with `inode` to uniquely identify a file or directory in the filesystem.963*/964typedef uint64_t __wasi_device_t;965966_Static_assert(sizeof(__wasi_device_t) == 8, "witx calculated size");967_Static_assert(_Alignof(__wasi_device_t) == 8, "witx calculated align");968969/**970* Which file time attributes to adjust.971*/972typedef uint16_t __wasi_fstflags_t;973974/**975* Adjust the last data access timestamp to the value stored in `filestat::atim`.976*/977#define __WASI_FSTFLAGS_ATIM (UINT16_C(1))978979/**980* Adjust the last data access timestamp to the time of clock `clockid::realtime`.981*/982#define __WASI_FSTFLAGS_ATIM_NOW (UINT16_C(2))983984/**985* Adjust the last data modification timestamp to the value stored in `filestat::mtim`.986*/987#define __WASI_FSTFLAGS_MTIM (UINT16_C(4))988989/**990* Adjust the last data modification timestamp to the time of clock `clockid::realtime`.991*/992#define __WASI_FSTFLAGS_MTIM_NOW (UINT16_C(8))993994_Static_assert(sizeof(__wasi_fstflags_t) == 2, "witx calculated size");995_Static_assert(_Alignof(__wasi_fstflags_t) == 2, "witx calculated align");996997/**998* Flags determining the method of how paths are resolved.999*/1000typedef uint32_t __wasi_lookupflags_t;10011002/**1003* As long as the resolved path corresponds to a symbolic link, it is expanded.1004*/1005#define __WASI_LOOKUPFLAGS_SYMLINK_FOLLOW (UINT32_C(1))10061007_Static_assert(sizeof(__wasi_lookupflags_t) == 4, "witx calculated size");1008_Static_assert(_Alignof(__wasi_lookupflags_t) == 4, "witx calculated align");10091010/**1011* Open flags used by `path_open`.1012*/1013typedef uint16_t __wasi_oflags_t;10141015/**1016* Create file if it does not exist.1017*/1018#define __WASI_OFLAGS_CREAT (UINT16_C(1))10191020/**1021* Fail if not a directory.1022*/1023#define __WASI_OFLAGS_DIRECTORY (UINT16_C(2))10241025/**1026* Fail if file already exists.1027*/1028#define __WASI_OFLAGS_EXCL (UINT16_C(4))10291030/**1031* Truncate file to size 0.1032*/1033#define __WASI_OFLAGS_TRUNC (UINT16_C(8))10341035_Static_assert(sizeof(__wasi_oflags_t) == 2, "witx calculated size");1036_Static_assert(_Alignof(__wasi_oflags_t) == 2, "witx calculated align");10371038/**1039* Number of hard links to an inode.1040*/1041typedef uint64_t __wasi_linkcount_t;10421043_Static_assert(sizeof(__wasi_linkcount_t) == 8, "witx calculated size");1044_Static_assert(_Alignof(__wasi_linkcount_t) == 8, "witx calculated align");10451046/**1047* File attributes.1048*/1049typedef struct __wasi_filestat_t {1050/**1051* Device ID of device containing the file.1052*/1053__wasi_device_t dev;10541055/**1056* File serial number.1057*/1058__wasi_inode_t ino;10591060/**1061* File type.1062*/1063__wasi_filetype_t filetype;10641065/**1066* Number of hard links to the file.1067*/1068__wasi_linkcount_t nlink;10691070/**1071* For regular files, the file size in bytes. For symbolic links, the length in bytes of the pathname contained in the symbolic link.1072*/1073__wasi_filesize_t size;10741075/**1076* Last data access timestamp.1077*/1078__wasi_timestamp_t atim;10791080/**1081* Last data modification timestamp.1082*/1083__wasi_timestamp_t mtim;10841085/**1086* Last file status change timestamp.1087*/1088__wasi_timestamp_t ctim;10891090} __wasi_filestat_t;10911092_Static_assert(sizeof(__wasi_filestat_t) == 64, "witx calculated size");1093_Static_assert(_Alignof(__wasi_filestat_t) == 8, "witx calculated align");1094_Static_assert(offsetof(__wasi_filestat_t, dev) == 0, "witx calculated offset");1095_Static_assert(offsetof(__wasi_filestat_t, ino) == 8, "witx calculated offset");1096_Static_assert(offsetof(__wasi_filestat_t, filetype) == 16, "witx calculated offset");1097_Static_assert(offsetof(__wasi_filestat_t, nlink) == 24, "witx calculated offset");1098_Static_assert(offsetof(__wasi_filestat_t, size) == 32, "witx calculated offset");1099_Static_assert(offsetof(__wasi_filestat_t, atim) == 40, "witx calculated offset");1100_Static_assert(offsetof(__wasi_filestat_t, mtim) == 48, "witx calculated offset");1101_Static_assert(offsetof(__wasi_filestat_t, ctim) == 56, "witx calculated offset");11021103/**1104* User-provided value that may be attached to objects that is retained when1105* extracted from the implementation.1106*/1107typedef uint64_t __wasi_userdata_t;11081109_Static_assert(sizeof(__wasi_userdata_t) == 8, "witx calculated size");1110_Static_assert(_Alignof(__wasi_userdata_t) == 8, "witx calculated align");11111112/**1113* Type of a subscription to an event or its occurrence.1114*/1115typedef uint8_t __wasi_eventtype_t;11161117/**1118* The time value of clock `subscription_clock::id` has1119* reached timestamp `subscription_clock::timeout`.1120*/1121#define __WASI_EVENTTYPE_CLOCK (UINT8_C(0))11221123/**1124* File descriptor `subscription_fd_readwrite::file_descriptor` has data1125* available for reading. This event always triggers for regular files.1126*/1127#define __WASI_EVENTTYPE_FD_READ (UINT8_C(1))11281129/**1130* File descriptor `subscription_fd_readwrite::file_descriptor` has capacity1131* available for writing. This event always triggers for regular files.1132*/1133#define __WASI_EVENTTYPE_FD_WRITE (UINT8_C(2))11341135_Static_assert(sizeof(__wasi_eventtype_t) == 1, "witx calculated size");1136_Static_assert(_Alignof(__wasi_eventtype_t) == 1, "witx calculated align");11371138/**1139* The state of the file descriptor subscribed to with1140* `eventtype::fd_read` or `eventtype::fd_write`.1141*/1142typedef uint16_t __wasi_eventrwflags_t;11431144/**1145* The peer of this socket has closed or disconnected.1146*/1147#define __WASI_EVENTRWFLAGS_FD_READWRITE_HANGUP (UINT16_C(1))11481149_Static_assert(sizeof(__wasi_eventrwflags_t) == 2, "witx calculated size");1150_Static_assert(_Alignof(__wasi_eventrwflags_t) == 2, "witx calculated align");11511152/**1153* The contents of an $event when type is `eventtype::fd_read` or1154* `eventtype::fd_write`.1155*/1156typedef struct __wasi_event_fd_readwrite_t {1157/**1158* The number of bytes available for reading or writing.1159*/1160__wasi_filesize_t nbytes;11611162/**1163* The state of the file descriptor.1164*/1165__wasi_eventrwflags_t flags;11661167} __wasi_event_fd_readwrite_t;11681169_Static_assert(sizeof(__wasi_event_fd_readwrite_t) == 16, "witx calculated size");1170_Static_assert(_Alignof(__wasi_event_fd_readwrite_t) == 8, "witx calculated align");1171_Static_assert(offsetof(__wasi_event_fd_readwrite_t, nbytes) == 0, "witx calculated offset");1172_Static_assert(offsetof(__wasi_event_fd_readwrite_t, flags) == 8, "witx calculated offset");11731174/**1175* The contents of an $event.1176*/1177typedef union __wasi_event_u_t {1178/**1179* When type is `eventtype::fd_read` or `eventtype::fd_write`:1180*/1181__wasi_event_fd_readwrite_t fd_readwrite;11821183} __wasi_event_u_t;11841185_Static_assert(sizeof(__wasi_event_u_t) == 16, "witx calculated size");1186_Static_assert(_Alignof(__wasi_event_u_t) == 8, "witx calculated align");11871188/**1189* An event that occurred.1190*/1191typedef struct __wasi_event_t {1192/**1193* User-provided value that got attached to `subscription::userdata`.1194*/1195__wasi_userdata_t userdata;11961197/**1198* If non-zero, an error that occurred while processing the subscription request.1199*/1200__wasi_errno_t error;12011202/**1203* The type of the event that occurred.1204*/1205__wasi_eventtype_t type;12061207/**1208* The contents of the event.1209*/1210__wasi_event_u_t u;12111212} __wasi_event_t;12131214_Static_assert(sizeof(__wasi_event_t) == 32, "witx calculated size");1215_Static_assert(_Alignof(__wasi_event_t) == 8, "witx calculated align");1216_Static_assert(offsetof(__wasi_event_t, userdata) == 0, "witx calculated offset");1217_Static_assert(offsetof(__wasi_event_t, error) == 8, "witx calculated offset");1218_Static_assert(offsetof(__wasi_event_t, type) == 10, "witx calculated offset");1219_Static_assert(offsetof(__wasi_event_t, u) == 16, "witx calculated offset");12201221/**1222* Flags determining how to interpret the timestamp provided in1223* `subscription_clock::timeout`.1224*/1225typedef uint16_t __wasi_subclockflags_t;12261227/**1228* If set, treat the timestamp provided in1229* `subscription_clock::timeout` as an absolute timestamp of clock1230* `subscription_clock::id`. If clear, treat the timestamp1231* provided in `subscription_clock::timeout` relative to the1232* current time value of clock `subscription_clock::id`.1233*/1234#define __WASI_SUBCLOCKFLAGS_SUBSCRIPTION_CLOCK_ABSTIME (UINT16_C(1))12351236_Static_assert(sizeof(__wasi_subclockflags_t) == 2, "witx calculated size");1237_Static_assert(_Alignof(__wasi_subclockflags_t) == 2, "witx calculated align");12381239/**1240* The contents of a $subscription when type is `eventtype::clock`.1241*/1242typedef struct __wasi_subscription_clock_t {1243/**1244* The clock against which to compare the timestamp.1245*/1246__wasi_clockid_t id;12471248/**1249* The absolute or relative timestamp.1250*/1251__wasi_timestamp_t timeout;12521253/**1254* The amount of time that the implementation may wait additionally1255* to coalesce with other events.1256*/1257__wasi_timestamp_t precision;12581259/**1260* Flags specifying whether the timeout is absolute or relative1261*/1262__wasi_subclockflags_t flags;12631264} __wasi_subscription_clock_t;12651266_Static_assert(sizeof(__wasi_subscription_clock_t) == 32, "witx calculated size");1267_Static_assert(_Alignof(__wasi_subscription_clock_t) == 8, "witx calculated align");1268_Static_assert(offsetof(__wasi_subscription_clock_t, id) == 0, "witx calculated offset");1269_Static_assert(offsetof(__wasi_subscription_clock_t, timeout) == 8, "witx calculated offset");1270_Static_assert(offsetof(__wasi_subscription_clock_t, precision) == 16, "witx calculated offset");1271_Static_assert(offsetof(__wasi_subscription_clock_t, flags) == 24, "witx calculated offset");12721273/**1274* The contents of a $subscription when type is1275* `eventtype::fd_read` or `eventtype::fd_write`.1276*/1277typedef struct __wasi_subscription_fd_readwrite_t {1278/**1279* The file descriptor on which to wait for it to become ready for reading or writing.1280*/1281__wasi_fd_t file_descriptor;12821283} __wasi_subscription_fd_readwrite_t;12841285_Static_assert(sizeof(__wasi_subscription_fd_readwrite_t) == 4, "witx calculated size");1286_Static_assert(_Alignof(__wasi_subscription_fd_readwrite_t) == 4, "witx calculated align");1287_Static_assert(offsetof(__wasi_subscription_fd_readwrite_t, file_descriptor) == 0, "witx calculated offset");12881289/**1290* The contents of a $subscription.1291*/1292typedef union __wasi_subscription_u_t {1293/**1294* When type is `eventtype::clock`:1295*/1296__wasi_subscription_clock_t clock;12971298/**1299* When type is `eventtype::fd_read` or `eventtype::fd_write`:1300*/1301__wasi_subscription_fd_readwrite_t fd_readwrite;13021303} __wasi_subscription_u_t;13041305_Static_assert(sizeof(__wasi_subscription_u_t) == 32, "witx calculated size");1306_Static_assert(_Alignof(__wasi_subscription_u_t) == 8, "witx calculated align");13071308/**1309* Subscription to an event.1310*/1311typedef struct __wasi_subscription_t {1312/**1313* User-provided value that is attached to the subscription in the1314* implementation and returned through `event::userdata`.1315*/1316__wasi_userdata_t userdata;13171318/**1319* The type of the event to which to subscribe.1320*/1321__wasi_eventtype_t type;13221323/**1324* The contents of the subscription.1325*/1326__wasi_subscription_u_t u;13271328} __wasi_subscription_t;13291330_Static_assert(sizeof(__wasi_subscription_t) == 48, "witx calculated size");1331_Static_assert(_Alignof(__wasi_subscription_t) == 8, "witx calculated align");1332_Static_assert(offsetof(__wasi_subscription_t, userdata) == 0, "witx calculated offset");1333_Static_assert(offsetof(__wasi_subscription_t, type) == 8, "witx calculated offset");1334_Static_assert(offsetof(__wasi_subscription_t, u) == 16, "witx calculated offset");13351336/**1337* Exit code generated by a process when exiting.1338*/1339typedef uint32_t __wasi_exitcode_t;13401341_Static_assert(sizeof(__wasi_exitcode_t) == 4, "witx calculated size");1342_Static_assert(_Alignof(__wasi_exitcode_t) == 4, "witx calculated align");13431344/**1345* Signal condition.1346*/1347typedef uint8_t __wasi_signal_t;13481349/**1350* No signal. Note that POSIX has special semantics for `kill(pid, 0)`,1351* so this value is reserved.1352*/1353#define __WASI_SIGNAL_NONE (UINT8_C(0))13541355/**1356* Hangup.1357* Action: Terminates the process.1358*/1359#define __WASI_SIGNAL_HUP (UINT8_C(1))13601361/**1362* Terminate interrupt signal.1363* Action: Terminates the process.1364*/1365#define __WASI_SIGNAL_INT (UINT8_C(2))13661367/**1368* Terminal quit signal.1369* Action: Terminates the process.1370*/1371#define __WASI_SIGNAL_QUIT (UINT8_C(3))13721373/**1374* Illegal instruction.1375* Action: Terminates the process.1376*/1377#define __WASI_SIGNAL_ILL (UINT8_C(4))13781379/**1380* Trace/breakpoint trap.1381* Action: Terminates the process.1382*/1383#define __WASI_SIGNAL_TRAP (UINT8_C(5))13841385/**1386* Process abort signal.1387* Action: Terminates the process.1388*/1389#define __WASI_SIGNAL_ABRT (UINT8_C(6))13901391/**1392* Access to an undefined portion of a memory object.1393* Action: Terminates the process.1394*/1395#define __WASI_SIGNAL_BUS (UINT8_C(7))13961397/**1398* Erroneous arithmetic operation.1399* Action: Terminates the process.1400*/1401#define __WASI_SIGNAL_FPE (UINT8_C(8))14021403/**1404* Kill.1405* Action: Terminates the process.1406*/1407#define __WASI_SIGNAL_KILL (UINT8_C(9))14081409/**1410* User-defined signal 1.1411* Action: Terminates the process.1412*/1413#define __WASI_SIGNAL_USR1 (UINT8_C(10))14141415/**1416* Invalid memory reference.1417* Action: Terminates the process.1418*/1419#define __WASI_SIGNAL_SEGV (UINT8_C(11))14201421/**1422* User-defined signal 2.1423* Action: Terminates the process.1424*/1425#define __WASI_SIGNAL_USR2 (UINT8_C(12))14261427/**1428* Write on a pipe with no one to read it.1429* Action: Ignored.1430*/1431#define __WASI_SIGNAL_PIPE (UINT8_C(13))14321433/**1434* Alarm clock.1435* Action: Terminates the process.1436*/1437#define __WASI_SIGNAL_ALRM (UINT8_C(14))14381439/**1440* Termination signal.1441* Action: Terminates the process.1442*/1443#define __WASI_SIGNAL_TERM (UINT8_C(15))14441445/**1446* Child process terminated, stopped, or continued.1447* Action: Ignored.1448*/1449#define __WASI_SIGNAL_CHLD (UINT8_C(16))14501451/**1452* Continue executing, if stopped.1453* Action: Continues executing, if stopped.1454*/1455#define __WASI_SIGNAL_CONT (UINT8_C(17))14561457/**1458* Stop executing.1459* Action: Stops executing.1460*/1461#define __WASI_SIGNAL_STOP (UINT8_C(18))14621463/**1464* Terminal stop signal.1465* Action: Stops executing.1466*/1467#define __WASI_SIGNAL_TSTP (UINT8_C(19))14681469/**1470* Background process attempting read.1471* Action: Stops executing.1472*/1473#define __WASI_SIGNAL_TTIN (UINT8_C(20))14741475/**1476* Background process attempting write.1477* Action: Stops executing.1478*/1479#define __WASI_SIGNAL_TTOU (UINT8_C(21))14801481/**1482* High bandwidth data is available at a socket.1483* Action: Ignored.1484*/1485#define __WASI_SIGNAL_URG (UINT8_C(22))14861487/**1488* CPU time limit exceeded.1489* Action: Terminates the process.1490*/1491#define __WASI_SIGNAL_XCPU (UINT8_C(23))14921493/**1494* File size limit exceeded.1495* Action: Terminates the process.1496*/1497#define __WASI_SIGNAL_XFSZ (UINT8_C(24))14981499/**1500* Virtual timer expired.1501* Action: Terminates the process.1502*/1503#define __WASI_SIGNAL_VTALRM (UINT8_C(25))15041505/**1506* Profiling timer expired.1507* Action: Terminates the process.1508*/1509#define __WASI_SIGNAL_PROF (UINT8_C(26))15101511/**1512* Window changed.1513* Action: Ignored.1514*/1515#define __WASI_SIGNAL_WINCH (UINT8_C(27))15161517/**1518* I/O possible.1519* Action: Terminates the process.1520*/1521#define __WASI_SIGNAL_POLL (UINT8_C(28))15221523/**1524* Power failure.1525* Action: Terminates the process.1526*/1527#define __WASI_SIGNAL_PWR (UINT8_C(29))15281529/**1530* Bad system call.1531* Action: Terminates the process.1532*/1533#define __WASI_SIGNAL_SYS (UINT8_C(30))15341535_Static_assert(sizeof(__wasi_signal_t) == 1, "witx calculated size");1536_Static_assert(_Alignof(__wasi_signal_t) == 1, "witx calculated align");15371538/**1539* Flags provided to `sock_recv`.1540*/1541typedef uint16_t __wasi_riflags_t;15421543/**1544* Returns the message without removing it from the socket's receive queue.1545*/1546#define __WASI_RIFLAGS_RECV_PEEK (UINT16_C(1))15471548/**1549* On byte-stream sockets, block until the full amount of data can be returned.1550*/1551#define __WASI_RIFLAGS_RECV_WAITALL (UINT16_C(2))15521553_Static_assert(sizeof(__wasi_riflags_t) == 2, "witx calculated size");1554_Static_assert(_Alignof(__wasi_riflags_t) == 2, "witx calculated align");15551556/**1557* Flags returned by `sock_recv`.1558*/1559typedef uint16_t __wasi_roflags_t;15601561/**1562* Returned by `sock_recv`: Message data has been truncated.1563*/1564#define __WASI_ROFLAGS_RECV_DATA_TRUNCATED (UINT16_C(1))15651566_Static_assert(sizeof(__wasi_roflags_t) == 2, "witx calculated size");1567_Static_assert(_Alignof(__wasi_roflags_t) == 2, "witx calculated align");15681569/**1570* Flags provided to `sock_send`. As there are currently no flags1571* defined, it must be set to zero.1572*/1573typedef uint16_t __wasi_siflags_t;15741575_Static_assert(sizeof(__wasi_siflags_t) == 2, "witx calculated size");1576_Static_assert(_Alignof(__wasi_siflags_t) == 2, "witx calculated align");15771578/**1579* Which channels on a socket to shut down.1580*/1581typedef uint8_t __wasi_sdflags_t;15821583/**1584* Disables further receive operations.1585*/1586#define __WASI_SDFLAGS_RD (UINT8_C(1))15871588/**1589* Disables further send operations.1590*/1591#define __WASI_SDFLAGS_WR (UINT8_C(2))15921593_Static_assert(sizeof(__wasi_sdflags_t) == 1, "witx calculated size");1594_Static_assert(_Alignof(__wasi_sdflags_t) == 1, "witx calculated align");15951596/**1597* Identifiers for preopened capabilities.1598*/1599typedef uint8_t __wasi_preopentype_t;16001601/**1602* A pre-opened directory.1603*/1604#define __WASI_PREOPENTYPE_DIR (UINT8_C(0))16051606_Static_assert(sizeof(__wasi_preopentype_t) == 1, "witx calculated size");1607_Static_assert(_Alignof(__wasi_preopentype_t) == 1, "witx calculated align");16081609/**1610* The contents of a $prestat when type is `preopentype::dir`.1611*/1612typedef struct __wasi_prestat_dir_t {1613/**1614* The length of the directory name for use with `fd_prestat_dir_name`.1615*/1616__wasi_size_t pr_name_len;16171618} __wasi_prestat_dir_t;16191620_Static_assert(sizeof(__wasi_prestat_dir_t) == 4, "witx calculated size");1621_Static_assert(_Alignof(__wasi_prestat_dir_t) == 4, "witx calculated align");1622_Static_assert(offsetof(__wasi_prestat_dir_t, pr_name_len) == 0, "witx calculated offset");16231624/**1625* The contents of an $prestat.1626*/1627typedef union __wasi_prestat_u_t {1628/**1629* When type is `preopentype::dir`:1630*/1631__wasi_prestat_dir_t dir;16321633} __wasi_prestat_u_t;16341635_Static_assert(sizeof(__wasi_prestat_u_t) == 4, "witx calculated size");1636_Static_assert(_Alignof(__wasi_prestat_u_t) == 4, "witx calculated align");16371638/**1639* Information about a pre-opened capability.1640*/1641typedef struct __wasi_prestat_t {1642/**1643* The type of the pre-opened capability.1644*/1645__wasi_preopentype_t pr_type;16461647/**1648* The contents of the information.1649*/1650__wasi_prestat_u_t u;16511652} __wasi_prestat_t;16531654_Static_assert(sizeof(__wasi_prestat_t) == 8, "witx calculated size");1655_Static_assert(_Alignof(__wasi_prestat_t) == 4, "witx calculated align");1656_Static_assert(offsetof(__wasi_prestat_t, pr_type) == 0, "witx calculated offset");1657_Static_assert(offsetof(__wasi_prestat_t, u) == 4, "witx calculated offset");16581659/**1660* @defgroup wasi_snapshot_preview11661* @{1662*/16631664/**1665* Read command-line argument data.1666* The size of the array should match that returned by `args_sizes_get`1667*/1668__wasi_errno_t __wasi_args_get(1669uint8_t * * argv,16701671uint8_t * argv_buf1672) __attribute__((1673__import_module__("wasi_snapshot_preview1"),1674__import_name__("args_get"),1675__warn_unused_result__1676));16771678/**1679* Return command-line argument data sizes.1680*/1681__wasi_errno_t __wasi_args_sizes_get(1682/**1683* The number of arguments.1684*/1685__wasi_size_t *argc,1686/**1687* The size of the argument string data.1688*/1689__wasi_size_t *argv_buf_size1690) __attribute__((1691__import_module__("wasi_snapshot_preview1"),1692__import_name__("args_sizes_get"),1693__warn_unused_result__1694));16951696/**1697* Read environment variable data.1698* The sizes of the buffers should match that returned by `environ_sizes_get`.1699*/1700__wasi_errno_t __wasi_environ_get(1701uint8_t * * environ,17021703uint8_t * environ_buf1704) __attribute__((1705__import_module__("wasi_snapshot_preview1"),1706__import_name__("environ_get"),1707__warn_unused_result__1708));17091710/**1711* Return command-line argument data sizes.1712*/1713__wasi_errno_t __wasi_environ_sizes_get(1714/**1715* The number of arguments.1716*/1717__wasi_size_t *argc,1718/**1719* The size of the argument string data.1720*/1721__wasi_size_t *argv_buf_size1722) __attribute__((1723__import_module__("wasi_snapshot_preview1"),1724__import_name__("environ_sizes_get"),1725__warn_unused_result__1726));17271728/**1729* Return the resolution of a clock.1730* Implementations are required to provide a non-zero value for supported clocks. For unsupported clocks,1731* return `errno::inval`.1732* Note: This is similar to `clock_getres` in POSIX.1733*/1734__wasi_errno_t __wasi_clock_res_get(1735/**1736* The clock for which to return the resolution.1737*/1738__wasi_clockid_t id,17391740/**1741* The resolution of the clock.1742*/1743__wasi_timestamp_t *resolution1744) __attribute__((1745__import_module__("wasi_snapshot_preview1"),1746__import_name__("clock_res_get"),1747__warn_unused_result__1748));17491750/**1751* Return the time value of a clock.1752* Note: This is similar to `clock_gettime` in POSIX.1753*/1754__wasi_errno_t __wasi_clock_time_get(1755/**1756* The clock for which to return the time.1757*/1758__wasi_clockid_t id,17591760/**1761* The maximum lag (exclusive) that the returned time value may have, compared to its actual value.1762*/1763__wasi_timestamp_t precision,17641765/**1766* The time value of the clock.1767*/1768__wasi_timestamp_t *time1769) __attribute__((1770__import_module__("wasi_snapshot_preview1"),1771__import_name__("clock_time_get"),1772__warn_unused_result__1773));17741775/**1776* Provide file advisory information on a file descriptor.1777* Note: This is similar to `posix_fadvise` in POSIX.1778*/1779__wasi_errno_t __wasi_fd_advise(1780__wasi_fd_t fd,17811782/**1783* The offset within the file to which the advisory applies.1784*/1785__wasi_filesize_t offset,17861787/**1788* The length of the region to which the advisory applies.1789*/1790__wasi_filesize_t len,17911792/**1793* The advice.1794*/1795__wasi_advice_t advice1796) __attribute__((1797__import_module__("wasi_snapshot_preview1"),1798__import_name__("fd_advise"),1799__warn_unused_result__1800));18011802/**1803* Force the allocation of space in a file.1804* Note: This is similar to `posix_fallocate` in POSIX.1805*/1806__wasi_errno_t __wasi_fd_allocate(1807__wasi_fd_t fd,18081809/**1810* The offset at which to start the allocation.1811*/1812__wasi_filesize_t offset,18131814/**1815* The length of the area that is allocated.1816*/1817__wasi_filesize_t len1818) __attribute__((1819__import_module__("wasi_snapshot_preview1"),1820__import_name__("fd_allocate"),1821__warn_unused_result__1822));18231824/**1825* Close a file descriptor.1826* Note: This is similar to `close` in POSIX.1827*/1828__wasi_errno_t __wasi_fd_close(1829__wasi_fd_t fd1830) __attribute__((1831__import_module__("wasi_snapshot_preview1"),1832__import_name__("fd_close"),1833__warn_unused_result__1834));18351836/**1837* Synchronize the data of a file to disk.1838* Note: This is similar to `fdatasync` in POSIX.1839*/1840__wasi_errno_t __wasi_fd_datasync(1841__wasi_fd_t fd1842) __attribute__((1843__import_module__("wasi_snapshot_preview1"),1844__import_name__("fd_datasync"),1845__warn_unused_result__1846));18471848/**1849* Get the attributes of a file descriptor.1850* Note: This returns similar flags to `fsync(fd, F_GETFL)` in POSIX, as well as additional fields.1851*/1852__wasi_errno_t __wasi_fd_fdstat_get(1853__wasi_fd_t fd,18541855/**1856* The buffer where the file descriptor's attributes are stored.1857*/1858__wasi_fdstat_t *stat1859) __attribute__((1860__import_module__("wasi_snapshot_preview1"),1861__import_name__("fd_fdstat_get"),1862__warn_unused_result__1863));18641865/**1866* Adjust the flags associated with a file descriptor.1867* Note: This is similar to `fcntl(fd, F_SETFL, flags)` in POSIX.1868*/1869__wasi_errno_t __wasi_fd_fdstat_set_flags(1870__wasi_fd_t fd,18711872/**1873* The desired values of the file descriptor flags.1874*/1875__wasi_fdflags_t flags1876) __attribute__((1877__import_module__("wasi_snapshot_preview1"),1878__import_name__("fd_fdstat_set_flags"),1879__warn_unused_result__1880));18811882/**1883* Adjust the rights associated with a file descriptor.1884* This can only be used to remove rights, and returns `errno::notcapable` if called in a way that would attempt to add rights1885*/1886__wasi_errno_t __wasi_fd_fdstat_set_rights(1887__wasi_fd_t fd,18881889/**1890* The desired rights of the file descriptor.1891*/1892__wasi_rights_t fs_rights_base,18931894__wasi_rights_t fs_rights_inheriting1895) __attribute__((1896__import_module__("wasi_snapshot_preview1"),1897__import_name__("fd_fdstat_set_rights"),1898__warn_unused_result__1899));19001901/**1902* Return the attributes of an open file.1903*/1904__wasi_errno_t __wasi_fd_filestat_get(1905__wasi_fd_t fd,19061907/**1908* The buffer where the file's attributes are stored.1909*/1910__wasi_filestat_t *buf1911) __attribute__((1912__import_module__("wasi_snapshot_preview1"),1913__import_name__("fd_filestat_get"),1914__warn_unused_result__1915));19161917/**1918* Adjust the size of an open file. If this increases the file's size, the extra bytes are filled with zeros.1919* Note: This is similar to `ftruncate` in POSIX.1920*/1921__wasi_errno_t __wasi_fd_filestat_set_size(1922__wasi_fd_t fd,19231924/**1925* The desired file size.1926*/1927__wasi_filesize_t size1928) __attribute__((1929__import_module__("wasi_snapshot_preview1"),1930__import_name__("fd_filestat_set_size"),1931__warn_unused_result__1932));19331934/**1935* Adjust the timestamps of an open file or directory.1936* Note: This is similar to `futimens` in POSIX.1937*/1938__wasi_errno_t __wasi_fd_filestat_set_times(1939__wasi_fd_t fd,19401941/**1942* The desired values of the data access timestamp.1943*/1944__wasi_timestamp_t atim,19451946/**1947* The desired values of the data modification timestamp.1948*/1949__wasi_timestamp_t mtim,19501951/**1952* A bitmask indicating which timestamps to adjust.1953*/1954__wasi_fstflags_t fst_flags1955) __attribute__((1956__import_module__("wasi_snapshot_preview1"),1957__import_name__("fd_filestat_set_times"),1958__warn_unused_result__1959));19601961/**1962* Read from a file descriptor, without using and updating the file descriptor's offset.1963* Note: This is similar to `preadv` in POSIX.1964*/1965__wasi_errno_t __wasi_fd_pread(1966__wasi_fd_t fd,19671968/**1969* List of scatter/gather vectors in which to store data.1970*/1971const __wasi_iovec_t *iovs,19721973/**1974* The length of the array pointed to by `iovs`.1975*/1976size_t iovs_len,19771978/**1979* The offset within the file at which to read.1980*/1981__wasi_filesize_t offset,19821983/**1984* The number of bytes read.1985*/1986__wasi_size_t *nread1987) __attribute__((1988__import_module__("wasi_snapshot_preview1"),1989__import_name__("fd_pread"),1990__warn_unused_result__1991));19921993/**1994* Return a description of the given preopened file descriptor.1995*/1996__wasi_errno_t __wasi_fd_prestat_get(1997__wasi_fd_t fd,19981999/**2000* The buffer where the description is stored.2001*/2002__wasi_prestat_t *buf2003) __attribute__((2004__import_module__("wasi_snapshot_preview1"),2005__import_name__("fd_prestat_get"),2006__warn_unused_result__2007));20082009/**2010* Return a description of the given preopened file descriptor.2011*/2012__wasi_errno_t __wasi_fd_prestat_dir_name(2013__wasi_fd_t fd,20142015/**2016* A buffer into which to write the preopened directory name.2017*/2018uint8_t * path,20192020__wasi_size_t path_len2021) __attribute__((2022__import_module__("wasi_snapshot_preview1"),2023__import_name__("fd_prestat_dir_name"),2024__warn_unused_result__2025));20262027/**2028* Write to a file descriptor, without using and updating the file descriptor's offset.2029* Note: This is similar to `pwritev` in POSIX.2030*/2031__wasi_errno_t __wasi_fd_pwrite(2032__wasi_fd_t fd,20332034/**2035* List of scatter/gather vectors from which to retrieve data.2036*/2037const __wasi_ciovec_t *iovs,20382039/**2040* The length of the array pointed to by `iovs`.2041*/2042size_t iovs_len,20432044/**2045* The offset within the file at which to write.2046*/2047__wasi_filesize_t offset,20482049/**2050* The number of bytes written.2051*/2052__wasi_size_t *nwritten2053) __attribute__((2054__import_module__("wasi_snapshot_preview1"),2055__import_name__("fd_pwrite"),2056__warn_unused_result__2057));20582059/**2060* Read from a file descriptor.2061* Note: This is similar to `readv` in POSIX.2062*/2063__wasi_errno_t __wasi_fd_read(2064__wasi_fd_t fd,20652066/**2067* List of scatter/gather vectors to which to store data.2068*/2069const __wasi_iovec_t *iovs,20702071/**2072* The length of the array pointed to by `iovs`.2073*/2074size_t iovs_len,20752076/**2077* The number of bytes read.2078*/2079__wasi_size_t *nread2080) __attribute__((2081__import_module__("wasi_snapshot_preview1"),2082__import_name__("fd_read"),2083__warn_unused_result__2084));20852086/**2087* Read directory entries from a directory.2088* When successful, the contents of the output buffer consist of a sequence of2089* directory entries. Each directory entry consists of a dirent_t object,2090* followed by dirent_t::d_namlen bytes holding the name of the directory2091* entry.2092* This function fills the output buffer as much as possible, potentially2093* truncating the last directory entry. This allows the caller to grow its2094* read buffer size in case it's too small to fit a single large directory2095* entry, or skip the oversized directory entry.2096*/2097__wasi_errno_t __wasi_fd_readdir(2098__wasi_fd_t fd,20992100/**2101* The buffer where directory entries are stored2102*/2103uint8_t * buf,21042105__wasi_size_t buf_len,21062107/**2108* The location within the directory to start reading2109*/2110__wasi_dircookie_t cookie,21112112/**2113* The number of bytes stored in the read buffer. If less than the size of the read buffer, the end of the directory has been reached.2114*/2115__wasi_size_t *bufused2116) __attribute__((2117__import_module__("wasi_snapshot_preview1"),2118__import_name__("fd_readdir"),2119__warn_unused_result__2120));21212122/**2123* Atomically replace a file descriptor by renumbering another file descriptor.2124* Due to the strong focus on thread safety, this environment does not provide2125* a mechanism to duplicate or renumber a file descriptor to an arbitrary2126* number, like `dup2()`. This would be prone to race conditions, as an actual2127* file descriptor with the same number could be allocated by a different2128* thread at the same time.2129* This function provides a way to atomically renumber file descriptors, which2130* would disappear if `dup2()` were to be removed entirely.2131*/2132__wasi_errno_t __wasi_fd_renumber(2133__wasi_fd_t fd,21342135/**2136* The file descriptor to overwrite.2137*/2138__wasi_fd_t to2139) __attribute__((2140__import_module__("wasi_snapshot_preview1"),2141__import_name__("fd_renumber"),2142__warn_unused_result__2143));21442145/**2146* Move the offset of a file descriptor.2147* Note: This is similar to `lseek` in POSIX.2148*/2149__wasi_errno_t __wasi_fd_seek(2150__wasi_fd_t fd,21512152/**2153* The number of bytes to move.2154*/2155__wasi_filedelta_t offset,21562157/**2158* The base from which the offset is relative.2159*/2160__wasi_whence_t whence,21612162/**2163* The new offset of the file descriptor, relative to the start of the file.2164*/2165__wasi_filesize_t *newoffset2166) __attribute__((2167__import_module__("wasi_snapshot_preview1"),2168__import_name__("fd_seek"),2169__warn_unused_result__2170));21712172/**2173* Synchronize the data and metadata of a file to disk.2174* Note: This is similar to `fsync` in POSIX.2175*/2176__wasi_errno_t __wasi_fd_sync(2177__wasi_fd_t fd2178) __attribute__((2179__import_module__("wasi_snapshot_preview1"),2180__import_name__("fd_sync"),2181__warn_unused_result__2182));21832184/**2185* Return the current offset of a file descriptor.2186* Note: This is similar to `lseek(fd, 0, SEEK_CUR)` in POSIX.2187*/2188__wasi_errno_t __wasi_fd_tell(2189__wasi_fd_t fd,21902191/**2192* The current offset of the file descriptor, relative to the start of the file.2193*/2194__wasi_filesize_t *offset2195) __attribute__((2196__import_module__("wasi_snapshot_preview1"),2197__import_name__("fd_tell"),2198__warn_unused_result__2199));22002201/**2202* Write to a file descriptor.2203* Note: This is similar to `writev` in POSIX.2204*/2205__wasi_errno_t __wasi_fd_write(2206__wasi_fd_t fd,22072208/**2209* List of scatter/gather vectors from which to retrieve data.2210*/2211const __wasi_ciovec_t *iovs,22122213/**2214* The length of the array pointed to by `iovs`.2215*/2216size_t iovs_len,22172218/**2219* The number of bytes written.2220*/2221__wasi_size_t *nwritten2222) __attribute__((2223__import_module__("wasi_snapshot_preview1"),2224__import_name__("fd_write"),2225__warn_unused_result__2226));22272228/**2229* Create a directory.2230* Note: This is similar to `mkdirat` in POSIX.2231*/2232__wasi_errno_t __wasi_path_create_directory(2233__wasi_fd_t fd,22342235/**2236* The path at which to create the directory.2237*/2238const char *path,22392240/**2241* The length of the buffer pointed to by `path`.2242*/2243size_t path_len2244) __attribute__((2245__import_module__("wasi_snapshot_preview1"),2246__import_name__("path_create_directory"),2247__warn_unused_result__2248));22492250/**2251* Return the attributes of a file or directory.2252* Note: This is similar to `stat` in POSIX.2253*/2254__wasi_errno_t __wasi_path_filestat_get(2255__wasi_fd_t fd,22562257/**2258* Flags determining the method of how the path is resolved.2259*/2260__wasi_lookupflags_t flags,22612262/**2263* The path of the file or directory to inspect.2264*/2265const char *path,22662267/**2268* The length of the buffer pointed to by `path`.2269*/2270size_t path_len,22712272/**2273* The buffer where the file's attributes are stored.2274*/2275__wasi_filestat_t *buf2276) __attribute__((2277__import_module__("wasi_snapshot_preview1"),2278__import_name__("path_filestat_get"),2279__warn_unused_result__2280));22812282/**2283* Adjust the timestamps of a file or directory.2284* Note: This is similar to `utimensat` in POSIX.2285*/2286__wasi_errno_t __wasi_path_filestat_set_times(2287__wasi_fd_t fd,22882289/**2290* Flags determining the method of how the path is resolved.2291*/2292__wasi_lookupflags_t flags,22932294/**2295* The path of the file or directory to operate on.2296*/2297const char *path,22982299/**2300* The length of the buffer pointed to by `path`.2301*/2302size_t path_len,23032304/**2305* The desired values of the data access timestamp.2306*/2307__wasi_timestamp_t atim,23082309/**2310* The desired values of the data modification timestamp.2311*/2312__wasi_timestamp_t mtim,23132314/**2315* A bitmask indicating which timestamps to adjust.2316*/2317__wasi_fstflags_t fst_flags2318) __attribute__((2319__import_module__("wasi_snapshot_preview1"),2320__import_name__("path_filestat_set_times"),2321__warn_unused_result__2322));23232324/**2325* Create a hard link.2326* Note: This is similar to `linkat` in POSIX.2327*/2328__wasi_errno_t __wasi_path_link(2329__wasi_fd_t old_fd,23302331/**2332* Flags determining the method of how the path is resolved.2333*/2334__wasi_lookupflags_t old_flags,23352336/**2337* The source path from which to link.2338*/2339const char *old_path,23402341/**2342* The length of the buffer pointed to by `old_path`.2343*/2344size_t old_path_len,23452346/**2347* The working directory at which the resolution of the new path starts.2348*/2349__wasi_fd_t new_fd,23502351/**2352* The destination path at which to create the hard link.2353*/2354const char *new_path,23552356/**2357* The length of the buffer pointed to by `new_path`.2358*/2359size_t new_path_len2360) __attribute__((2361__import_module__("wasi_snapshot_preview1"),2362__import_name__("path_link"),2363__warn_unused_result__2364));23652366/**2367* Open a file or directory.2368* The returned file descriptor is not guaranteed to be the lowest-numbered2369* file descriptor not currently open; it is randomized to prevent2370* applications from depending on making assumptions about indexes, since this2371* is error-prone in multi-threaded contexts. The returned file descriptor is2372* guaranteed to be less than 2**31.2373* Note: This is similar to `openat` in POSIX.2374*/2375__wasi_errno_t __wasi_path_open(2376__wasi_fd_t fd,23772378/**2379* Flags determining the method of how the path is resolved.2380*/2381__wasi_lookupflags_t dirflags,23822383/**2384* The relative path of the file or directory to open, relative to the2385* `path_open::fd` directory.2386*/2387const char *path,23882389/**2390* The length of the buffer pointed to by `path`.2391*/2392size_t path_len,23932394/**2395* The method by which to open the file.2396*/2397__wasi_oflags_t oflags,23982399/**2400* The initial rights of the newly created file descriptor. The2401* implementation is allowed to return a file descriptor with fewer rights2402* than specified, if and only if those rights do not apply to the type of2403* file being opened.2404* The *base* rights are rights that will apply to operations using the file2405* descriptor itself, while the *inheriting* rights are rights that apply to2406* file descriptors derived from it.2407*/2408__wasi_rights_t fs_rights_base,24092410__wasi_rights_t fs_rights_inheriting,24112412__wasi_fdflags_t fdflags,24132414/**2415* The file descriptor of the file that has been opened.2416*/2417__wasi_fd_t *opened_fd2418) __attribute__((2419__import_module__("wasi_snapshot_preview1"),2420__import_name__("path_open"),2421__warn_unused_result__2422));24232424/**2425* Read the contents of a symbolic link.2426* Note: This is similar to `readlinkat` in POSIX.2427*/2428__wasi_errno_t __wasi_path_readlink(2429__wasi_fd_t fd,24302431/**2432* The path of the symbolic link from which to read.2433*/2434const char *path,24352436/**2437* The length of the buffer pointed to by `path`.2438*/2439size_t path_len,24402441/**2442* The buffer to which to write the contents of the symbolic link.2443*/2444uint8_t * buf,24452446__wasi_size_t buf_len,24472448/**2449* The number of bytes placed in the buffer.2450*/2451__wasi_size_t *bufused2452) __attribute__((2453__import_module__("wasi_snapshot_preview1"),2454__import_name__("path_readlink"),2455__warn_unused_result__2456));24572458/**2459* Remove a directory.2460* Return `errno::notempty` if the directory is not empty.2461* Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX.2462*/2463__wasi_errno_t __wasi_path_remove_directory(2464__wasi_fd_t fd,24652466/**2467* The path to a directory to remove.2468*/2469const char *path,24702471/**2472* The length of the buffer pointed to by `path`.2473*/2474size_t path_len2475) __attribute__((2476__import_module__("wasi_snapshot_preview1"),2477__import_name__("path_remove_directory"),2478__warn_unused_result__2479));24802481/**2482* Rename a file or directory.2483* Note: This is similar to `renameat` in POSIX.2484*/2485__wasi_errno_t __wasi_path_rename(2486__wasi_fd_t fd,24872488/**2489* The source path of the file or directory to rename.2490*/2491const char *old_path,24922493/**2494* The length of the buffer pointed to by `old_path`.2495*/2496size_t old_path_len,24972498/**2499* The working directory at which the resolution of the new path starts.2500*/2501__wasi_fd_t new_fd,25022503/**2504* The destination path to which to rename the file or directory.2505*/2506const char *new_path,25072508/**2509* The length of the buffer pointed to by `new_path`.2510*/2511size_t new_path_len2512) __attribute__((2513__import_module__("wasi_snapshot_preview1"),2514__import_name__("path_rename"),2515__warn_unused_result__2516));25172518/**2519* Create a symbolic link.2520* Note: This is similar to `symlinkat` in POSIX.2521*/2522__wasi_errno_t __wasi_path_symlink(2523/**2524* The contents of the symbolic link.2525*/2526const char *old_path,25272528/**2529* The length of the buffer pointed to by `old_path`.2530*/2531size_t old_path_len,25322533__wasi_fd_t fd,25342535/**2536* The destination path at which to create the symbolic link.2537*/2538const char *new_path,25392540/**2541* The length of the buffer pointed to by `new_path`.2542*/2543size_t new_path_len2544) __attribute__((2545__import_module__("wasi_snapshot_preview1"),2546__import_name__("path_symlink"),2547__warn_unused_result__2548));25492550/**2551* Unlink a file.2552* Return `errno::isdir` if the path refers to a directory.2553* Note: This is similar to `unlinkat(fd, path, 0)` in POSIX.2554*/2555__wasi_errno_t __wasi_path_unlink_file(2556__wasi_fd_t fd,25572558/**2559* The path to a file to unlink.2560*/2561const char *path,25622563/**2564* The length of the buffer pointed to by `path`.2565*/2566size_t path_len2567) __attribute__((2568__import_module__("wasi_snapshot_preview1"),2569__import_name__("path_unlink_file"),2570__warn_unused_result__2571));25722573/**2574* Concurrently poll for the occurrence of a set of events.2575*/2576__wasi_errno_t __wasi_poll_oneoff(2577/**2578* The events to which to subscribe.2579*/2580const __wasi_subscription_t * in,25812582/**2583* The events that have occurred.2584*/2585__wasi_event_t * out,25862587/**2588* Both the number of subscriptions and events.2589*/2590__wasi_size_t nsubscriptions,25912592/**2593* The number of events stored.2594*/2595__wasi_size_t *nevents2596) __attribute__((2597__import_module__("wasi_snapshot_preview1"),2598__import_name__("poll_oneoff"),2599__warn_unused_result__2600));26012602/**2603* Terminate the process normally. An exit code of 0 indicates successful2604* termination of the program. The meanings of other values is dependent on2605* the environment.2606*/2607_Noreturn void __wasi_proc_exit(2608/**2609* The exit code returned by the process.2610*/2611__wasi_exitcode_t rval2612) __attribute__((2613__import_module__("wasi_snapshot_preview1"),2614__import_name__("proc_exit")));26152616/**2617* Send a signal to the process of the calling thread.2618* Note: This is similar to `raise` in POSIX.2619*/2620__wasi_errno_t __wasi_proc_raise(2621/**2622* The signal condition to trigger.2623*/2624__wasi_signal_t sig2625) __attribute__((2626__import_module__("wasi_snapshot_preview1"),2627__import_name__("proc_raise"),2628__warn_unused_result__2629));26302631/**2632* Temporarily yield execution of the calling thread.2633* Note: This is similar to `sched_yield` in POSIX.2634*/2635__wasi_errno_t __wasi_sched_yield(2636void2637) __attribute__((2638__import_module__("wasi_snapshot_preview1"),2639__import_name__("sched_yield"),2640__warn_unused_result__2641));26422643/**2644* Write high-quality random data into a buffer.2645* This function blocks when the implementation is unable to immediately2646* provide sufficient high-quality random data.2647* This function may execute slowly, so when large mounts of random data are2648* required, it's advisable to use this function to seed a pseudo-random2649* number generator, rather than to provide the random data directly.2650*/2651__wasi_errno_t __wasi_random_get(2652/**2653* The buffer to fill with random data.2654*/2655uint8_t * buf,26562657__wasi_size_t buf_len2658) __attribute__((2659__import_module__("wasi_snapshot_preview1"),2660__import_name__("random_get"),2661__warn_unused_result__2662));26632664/**2665* Receive a message from a socket.2666* Note: This is similar to `recv` in POSIX, though it also supports reading2667* the data into multiple buffers in the manner of `readv`.2668*/2669__wasi_errno_t __wasi_sock_recv(2670__wasi_fd_t fd,26712672/**2673* List of scatter/gather vectors to which to store data.2674*/2675const __wasi_iovec_t *ri_data,26762677/**2678* The length of the array pointed to by `ri_data`.2679*/2680size_t ri_data_len,26812682/**2683* Message flags.2684*/2685__wasi_riflags_t ri_flags,26862687/**2688* Number of bytes stored in ri_data.2689*/2690__wasi_size_t *ro_datalen,2691/**2692* Message flags.2693*/2694__wasi_roflags_t *ro_flags2695) __attribute__((2696__import_module__("wasi_snapshot_preview1"),2697__import_name__("sock_recv"),2698__warn_unused_result__2699));27002701/**2702* Send a message on a socket.2703* Note: This is similar to `send` in POSIX, though it also supports writing2704* the data from multiple buffers in the manner of `writev`.2705*/2706__wasi_errno_t __wasi_sock_send(2707__wasi_fd_t fd,27082709/**2710* List of scatter/gather vectors to which to retrieve data2711*/2712const __wasi_ciovec_t *si_data,27132714/**2715* The length of the array pointed to by `si_data`.2716*/2717size_t si_data_len,27182719/**2720* Message flags.2721*/2722__wasi_siflags_t si_flags,27232724/**2725* Number of bytes transmitted.2726*/2727__wasi_size_t *so_datalen2728) __attribute__((2729__import_module__("wasi_snapshot_preview1"),2730__import_name__("sock_send"),2731__warn_unused_result__2732));27332734/**2735* Shut down socket send and receive channels.2736* Note: This is similar to `shutdown` in POSIX.2737*/2738__wasi_errno_t __wasi_sock_shutdown(2739__wasi_fd_t fd,27402741/**2742* Which channels on the socket to shut down.2743*/2744__wasi_sdflags_t how2745) __attribute__((2746__import_module__("wasi_snapshot_preview1"),2747__import_name__("sock_shutdown"),2748__warn_unused_result__2749));27502751/** @} */27522753#ifdef __cplusplus2754}2755#endif27562757#pragma pop_macro("_Static_assert")27582759#endif276027612762