2306 lines
81 KiB
Markdown
2306 lines
81 KiB
Markdown
<!--
|
|
This document is derived from the file docs/cloudabi.md at revision
|
|
af51ede669dbca0875d20893dae7f760b052b238 of the CloudABI repository
|
|
hosted here: https://github.com/NuxiNL/cloudabi
|
|
|
|
The upstream file bears the following notice, though note that the
|
|
file is no longer generated, and contains significant edits:
|
|
|
|
Copyright (c) 2016-2017 Nuxi (https://nuxi.nl/) and contributors.
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
modification, are permitted provided that the following conditions
|
|
are met:
|
|
1. Redistributions of source code must retain the above copyright
|
|
notice, this list of conditions and the following disclaimer.
|
|
2. Redistributions in binary form must reproduce the above copyright
|
|
notice, this list of conditions and the following disclaimer in the
|
|
documentation and/or other materials provided with the distribution.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
SUCH DAMAGE.
|
|
|
|
This file is automatically generated. Do not edit.
|
|
|
|
Source: https://github.com/NuxiNL/cloudabi
|
|
-->
|
|
|
|
# WASI Core API
|
|
|
|
This is the API-level documentation for WASI Core. The function names
|
|
are prefixed with "\_\_wasi\_" to reflect how they are spelled in
|
|
flat-namespace contexts, however at the wasm module level, they are
|
|
unprefixed, because they're inside a module namespace (currently
|
|
"wasi\_unstable").
|
|
|
|
Functions that start with `__wasi_fd_` operate on file descriptors,
|
|
while functions that start with `__wasi_path_` operate on filesystem
|
|
paths, which are relative to directory file descriptors.
|
|
|
|
Much inspiration and content here is derived from [CloudABI] and [POSIX],
|
|
though there are also several differences from CloudABI and POSIX. For
|
|
example, WASI Core has no concept of processes in the traditional Unix
|
|
sense. While wasm linear memories have some of the aspects of processes,
|
|
and it's possible to *emulate* the full semantics of processes on top of
|
|
them, this can sometimes be unnatural and inefficient. The goal for
|
|
WASI Core is to be a WebAssembly-native API that exposes APIs that fit
|
|
well into the underlying WebAssembly platform, rather than to directly
|
|
emulate other platforms.
|
|
|
|
This is also a work in progress, and the API here is still evolving.
|
|
|
|
[CloudABI]: https://github.com/NuxiNL/cloudabi
|
|
[POSIX]: http://pubs.opengroup.org/onlinepubs/9699919799/
|
|
|
|
## System calls
|
|
|
|
- [`__wasi_args_get()`](#args_get)
|
|
- [`__wasi_args_sizes_get()`](#args_sizes_get)
|
|
- [`__wasi_clock_res_get()`](#clock_res_get)
|
|
- [`__wasi_clock_time_get()`](#clock_time_get)
|
|
- [`__wasi_environ_get()`](#environ_get)
|
|
- [`__wasi_environ_sizes_get()`](#environ_sizes_get)
|
|
- [`__wasi_fd_advise()`](#fd_advise)
|
|
- [`__wasi_fd_allocate()`](#fd_allocate)
|
|
- [`__wasi_fd_close()`](#fd_close)
|
|
- [`__wasi_fd_datasync()`](#fd_datasync)
|
|
- [`__wasi_fd_fdstat_get()`](#fd_fdstat_get)
|
|
- [`__wasi_fd_fdstat_set_flags()`](#fd_fdstat_set_flags)
|
|
- [`__wasi_fd_fdstat_set_rights()`](#fd_fdstat_set_rights)
|
|
- [`__wasi_fd_filestat_get()`](#fd_filestat_get)
|
|
- [`__wasi_fd_filestat_set_size()`](#fd_filestat_set_size)
|
|
- [`__wasi_fd_filestat_set_times()`](#fd_filestat_set_times)
|
|
- [`__wasi_fd_pread()`](#fd_pread)
|
|
- [`__wasi_fd_prestat_get()`](#fd_prestat_get)
|
|
- [`__wasi_fd_prestat_dir_name()`](#fd_prestat_dir_name)
|
|
- [`__wasi_fd_pwrite()`](#fd_pwrite)
|
|
- [`__wasi_fd_read()`](#fd_read)
|
|
- [`__wasi_fd_readdir()`](#fd_readdir)
|
|
- [`__wasi_fd_renumber()`](#fd_renumber)
|
|
- [`__wasi_fd_seek()`](#fd_seek)
|
|
- [`__wasi_fd_sync()`](#fd_sync)
|
|
- [`__wasi_fd_tell()`](#fd_tell)
|
|
- [`__wasi_fd_write()`](#fd_write)
|
|
- [`__wasi_path_create_directory()`](#path_create_directory)
|
|
- [`__wasi_path_filestat_get()`](#path_filestat_get)
|
|
- [`__wasi_path_filestat_set_times()`](#path_filestat_set_times)
|
|
- [`__wasi_path_link()`](#path_link)
|
|
- [`__wasi_path_open()`](#path_open)
|
|
- [`__wasi_path_readlink()`](#path_readlink)
|
|
- [`__wasi_path_remove_directory()`](#path_remove_directory)
|
|
- [`__wasi_path_rename()`](#path_rename)
|
|
- [`__wasi_path_symlink()`](#path_symlink)
|
|
- [`__wasi_path_unlink_file()`](#path_unlink_file)
|
|
- [`__wasi_poll_oneoff()`](#poll_oneoff)
|
|
- [`__wasi_proc_exit()`](#proc_exit)
|
|
- [`__wasi_proc_raise()`](#proc_raise)
|
|
- [`__wasi_random_get()`](#random_get)
|
|
- [`__wasi_sched_yield()`](#sched_yield)
|
|
- [`__wasi_sock_recv()`](#sock_recv)
|
|
- [`__wasi_sock_send()`](#sock_send)
|
|
- [`__wasi_sock_shutdown()`](#sock_shutdown)
|
|
|
|
### <a href="#args_get" name="args_get"></a>`__wasi_args_get()`
|
|
|
|
Read command-line argument data.
|
|
|
|
The sizes of the buffers should match that returned by [`__wasi_args_sizes_get()`](#args_sizes_get).
|
|
|
|
Inputs:
|
|
|
|
- <a href="#args_get.argv" name="args_get.argv"></a><code>char \*\*<strong>argv</strong></code>
|
|
|
|
A pointer to a buffer to write the argument pointers.
|
|
|
|
- <a href="#args_get.argv_buf" name="args_get.argv_buf"></a><code>char \*<strong>argv\_buf</strong></code>
|
|
|
|
A pointer to a buffer to write the argument string data.
|
|
|
|
### <a href="#args_sizes_get" name="args_sizes_get"></a>`__wasi_args_sizes_get()`
|
|
|
|
Return command-line argument data sizes.
|
|
|
|
Outputs:
|
|
|
|
- <a href="#args_sizes_get.argc" name="args_sizes_get.argc"></a><code>size\_t \*<strong>argc</strong></code>
|
|
|
|
The number of arguments.
|
|
|
|
- <a href="#args_sizes_get.argv_buf_size" name="args_sizes_get.argv_buf_size"></a><code>size\_t \*<strong>argv\_buf\_size</strong></code>
|
|
|
|
The size of the argument string data.
|
|
|
|
### <a href="#clock_res_get" name="clock_res_get"></a>`__wasi_clock_res_get()`
|
|
|
|
Return the resolution of a clock.
|
|
|
|
Implementations are required to provide a non-zero value for supported clocks.
|
|
For unsupported clocks, return [`__WASI_EINVAL`](#errno.inval).
|
|
|
|
Note: This is similar to `clock_getres` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#clock_res_get.clock_id" name="clock_res_get.clock_id"></a><code>[\_\_wasi\_clockid\_t](#clockid) <strong>clock\_id</strong></code>
|
|
|
|
The clock for which to return the resolution.
|
|
|
|
Outputs:
|
|
|
|
- <a href="#clock_res_get.resolution" name="clock_res_get.resolution"></a><code>[\_\_wasi\_timestamp\_t](#timestamp) <strong>resolution</strong></code>
|
|
|
|
The resolution of the clock.
|
|
|
|
### <a href="#clock_time_get" name="clock_time_get"></a>`__wasi_clock_time_get()`
|
|
|
|
Return the time value of a clock.
|
|
|
|
Note: This is similar to `clock_gettime` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#clock_time_get.clock_id" name="clock_time_get.clock_id"></a><code>[\_\_wasi\_clockid\_t](#clockid) <strong>clock\_id</strong></code>
|
|
|
|
The clock for which to return the time.
|
|
|
|
- <a href="#clock_time_get.precision" name="clock_time_get.precision"></a><code>[\_\_wasi\_timestamp\_t](#timestamp) <strong>precision</strong></code>
|
|
|
|
The maximum lag (exclusive) that the returned
|
|
time value may have, compared to its actual
|
|
value.
|
|
|
|
Outputs:
|
|
|
|
- <a href="#clock_time_get.time" name="clock_time_get.time"></a><code>[\_\_wasi\_timestamp\_t](#timestamp) <strong>time</strong></code>
|
|
|
|
The time value of the clock.
|
|
|
|
### <a href="#environ_get" name="environ_get"></a>`__wasi_environ_get()`
|
|
|
|
Read environment variable data.
|
|
|
|
The sizes of the buffers should match that returned by [`__wasi_environ_sizes_get()`](#environ_sizes_get).
|
|
|
|
Inputs:
|
|
|
|
- <a href="#environ_get.environ" name="environ_get.environ"></a><code>char \*\*<strong>environ</strong></code>
|
|
|
|
A pointer to a buffer to write the environment variable pointers.
|
|
|
|
- <a href="#environ_get.environ_buf" name="environ_get.environ_buf"></a><code>char \*<strong>environ\_buf</strong></code>
|
|
|
|
A pointer to a buffer to write the environment variable string data.
|
|
|
|
### <a href="#environ_sizes_get" name="environ_sizes_get"></a>`__wasi_environ_sizes_get()`
|
|
|
|
Return command-line argument data sizes.
|
|
|
|
Outputs:
|
|
|
|
- <a href="#environ_sizes_get.environ_count" name="environ_sizes_get.environ_count"></a><code>size\_t \*<strong>environ\_count</strong></code>
|
|
|
|
The number of environment variables.
|
|
|
|
- <a href="#environ_sizes_get.environ_buf_size" name="environ_sizes_get.environ_buf_size"></a><code>size\_t \*<strong>environ\_buf\_size</strong></code>
|
|
|
|
The size of the environment variable string data.
|
|
|
|
### <a href="#fd_advise" name="fd_advise"></a>`__wasi_fd_advise()`
|
|
|
|
Provide file advisory information on a file descriptor.
|
|
|
|
Note: This is similar to `posix_fadvise` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#fd_advise.fd" name="fd_advise.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The file descriptor for the file for which to provide file advisory information.
|
|
|
|
- <a href="#fd_advise.offset" name="fd_advise.offset"></a><code>[\_\_wasi\_filesize\_t](#filesize) <strong>offset</strong></code>
|
|
|
|
The offset within the file to which the advisory applies.
|
|
|
|
- <a href="#fd_advise.len" name="fd_advise.len"></a><code>[\_\_wasi\_filesize\_t](#filesize) <strong>len</strong></code>
|
|
|
|
The length of the region to which the advisory applies.
|
|
|
|
- <a href="#fd_advise.advice" name="fd_advise.advice"></a><code>[\_\_wasi\_advice\_t](#advice) <strong>advice</strong></code>
|
|
|
|
The advice.
|
|
|
|
### <a href="#fd_allocate" name="fd_allocate"></a>`__wasi_fd_allocate()`
|
|
|
|
Force the allocation of space in a file.
|
|
|
|
Note: This is similar to `posix_fallocate` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#fd_allocate.fd" name="fd_allocate.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The file descriptor for the file in which to allocate space.
|
|
|
|
- <a href="#fd_allocate.offset" name="fd_allocate.offset"></a><code>[\_\_wasi\_filesize\_t](#filesize) <strong>offset</strong></code>
|
|
|
|
The offset at which to start the allocation.
|
|
|
|
- <a href="#fd_allocate.len" name="fd_allocate.len"></a><code>[\_\_wasi\_filesize\_t](#filesize) <strong>len</strong></code>
|
|
|
|
The length of the area that is allocated.
|
|
|
|
### <a href="#fd_close" name="fd_close"></a>`__wasi_fd_close()`
|
|
|
|
Close a file descriptor.
|
|
|
|
Note: This is similar to `close` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#fd_close.fd" name="fd_close.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The file descriptor to close.
|
|
|
|
### <a href="#fd_datasync" name="fd_datasync"></a>`__wasi_fd_datasync()`
|
|
|
|
Synchronize the data of a file to disk.
|
|
|
|
Note: This is similar to `fdatasync` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#fd_datasync.fd" name="fd_datasync.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The file descriptor of the file to synchronize to disk.
|
|
|
|
### <a href="#fd_fdstat_get" name="fd_fdstat_get"></a>`__wasi_fd_fdstat_get()`
|
|
|
|
Get the attributes of a file descriptor.
|
|
|
|
Note: This returns similar flags to `fsync(fd, F_GETFL)` in POSIX, as well
|
|
as additional fields.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#fd_fdstat_get.fd" name="fd_fdstat_get.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The file descriptor to inspect.
|
|
|
|
- <a href="#fd_fdstat_get.buf" name="fd_fdstat_get.buf"></a><code>[\_\_wasi\_fdstat\_t](#fdstat) \*<strong>buf</strong></code>
|
|
|
|
The buffer where the file descriptor's attributes are stored.
|
|
|
|
### <a href="#fd_fdstat_set_flags" name="fd_fdstat_set_flags"></a>`__wasi_fd_fdstat_set_flags()`
|
|
|
|
Adjust the flags associated with a file descriptor.
|
|
|
|
Note: This is similar to `fcntl(fd, F_SETFL, flags)` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#fd_fdstat_set_flags.fd" name="fd_fdstat_set_flags.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The file descriptor to operate on.
|
|
|
|
- <a href="#fd_fdstat_set_flags.flags" name="fd_fdstat_set_flags.flags"></a><code>[\_\_wasi\_fdflags\_t](#fdflags) <strong>flags</strong></code>
|
|
|
|
The desired values of the file descriptor
|
|
flags.
|
|
|
|
### <a href="#fd_fdstat_set_rights" name="fd_fdstat_set_rights"></a>`__wasi_fd_fdstat_set_rights()`
|
|
|
|
Adjust the rights associated with a file descriptor.
|
|
|
|
This can only be used to remove rights, and returns
|
|
[`__WASI_ENOTCAPABLE`](#errno.notcapable) if called in a way that would attempt
|
|
to add rights.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#fd_fdstat_set_rights.fd" name="fd_fdstat_set_rights.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The file descriptor to operate on.
|
|
|
|
- <a href="#fd_fdstat_set_rights.fs_rights_base" name="fd_fdstat_set_rights.fs_rights_base"></a><code>[\_\_wasi\_rights\_t](#rights) <strong>fs\_rights\_base</strong></code> and <a href="#fd_fdstat_set_rights.fs_rights_inheriting" name="fd_fdstat_set_rights.fs_rights_inheriting"></a><code>[\_\_wasi\_rights\_t](#rights) <strong>fs\_rights\_inheriting</strong></code>
|
|
|
|
The desired rights of the file descriptor.
|
|
|
|
### <a href="#fd_filestat_get" name="fd_filestat_get"></a>`__wasi_fd_filestat_get()`
|
|
|
|
Return the attributes of an open file.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#fd_filestat_get.fd" name="fd_filestat_get.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The file descriptor to inspect.
|
|
|
|
- <a href="#fd_filestat_get.buf" name="fd_filestat_get.buf"></a><code>[\_\_wasi\_filestat\_t](#filestat) \*<strong>buf</strong></code>
|
|
|
|
The buffer where the file's attributes are
|
|
stored.
|
|
|
|
### <a href="#fd_filestat_set_size" name="fd_filestat_set_size"></a>`__wasi_fd_filestat_set_size()`
|
|
|
|
Adjust the size of an open file. If this increases the file's size, the extra
|
|
bytes are filled with zeros.
|
|
|
|
Note: This is similar to `ftruncate` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#fd_filestat_set_size.fd" name="fd_filestat_set_size.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
A file descriptor for the file to adjust.
|
|
|
|
- <a href="#fd_filestat_set_size.st_size" name="fd_filestat_set_size.st_size"></a><code>[\_\_wasi\_filesize\_t](#filesize) <strong>st\_size</strong></code>
|
|
|
|
The desired file size.
|
|
|
|
### <a href="#fd_filestat_set_times" name="fd_filestat_set_times"></a>`__wasi_fd_filestat_set_times()`
|
|
|
|
Adjust the timestamps of an open file or directory.
|
|
|
|
Note: This is similar to `futimens` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#fd_filestat_set_times.fd" name="fd_filestat_set_times.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The file descriptor to operate on.
|
|
|
|
- <a href="#fd_filestat_set_times.st_atim" name="fd_filestat_set_times.st_atim"></a><code>[\_\_wasi\_timestamp\_t](#timestamp) <strong>st\_atim</strong></code>
|
|
|
|
The desired values of the data access timestamp.
|
|
|
|
- <a href="#fd_filestat_set_times.st_mtim" name="fd_filestat_set_times.st_mtim"></a><code>[\_\_wasi\_timestamp\_t](#timestamp) <strong>st\_mtim</strong></code>
|
|
|
|
The desired values of the data modification timestamp.
|
|
|
|
- <a href="#fd_filestat_set_times.fst_flags" name="fd_filestat_set_times.fst_flags"></a><code>[\_\_wasi\_fstflags\_t](#fstflags) <strong>fst\_flags</strong></code>
|
|
|
|
A bitmask indicating which timestamps to adjust.
|
|
|
|
### <a href="#fd_pread" name="fd_pread"></a>`__wasi_fd_pread()`
|
|
|
|
Read from a file descriptor, without using and updating the
|
|
file descriptor's offset.
|
|
|
|
Note: This is similar to `preadv` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#fd_pread.fd" name="fd_pread.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The file descriptor from which to read data.
|
|
|
|
- <a href="#fd_pread.iovs" name="fd_pread.iovs"></a><code>const [\_\_wasi\_iovec\_t](#iovec) \*<strong>iovs</strong></code> and <a href="#fd_pread.iovs_len" name="fd_pread.iovs_len"></a><code>size\_t <strong>iovs\_len</strong></code>
|
|
|
|
List of scatter/gather vectors in which to store data.
|
|
|
|
- <a href="#fd_pread.offset" name="fd_pread.offset"></a><code>[\_\_wasi\_filesize\_t](#filesize) <strong>offset</strong></code>
|
|
|
|
The offset within the file at which to read.
|
|
|
|
Outputs:
|
|
|
|
- <a href="#fd_pread.nread" name="fd_pread.nread"></a><code>size\_t <strong>nread</strong></code>
|
|
|
|
The number of bytes read.
|
|
|
|
### <a href="#fd_prestat_get" name="fd_prestat_get"></a>`__wasi_fd_prestat_get()`
|
|
|
|
Return a description of the given preopened file descriptor.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#fd_prestat_get.fd" name="fd_prestat_get.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The file descriptor about which to retrieve information.
|
|
|
|
- <a href="#fd_prestat_get.buf" name="fd_prestat_get.buf"></a><code>[\_\_wasi\_prestat\_t](#prestat) \*<strong>buf</strong></code>
|
|
|
|
The buffer where the description is stored.
|
|
|
|
### <a href="#fd_prestat_dir_name" name="fd_prestat_dir_name"></a>`__wasi_fd_prestat_dir_name()`
|
|
|
|
Return a description of the given preopened file descriptor.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#fd_prestat_dir_name.fd" name="fd_prestat_dir_name.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The file descriptor about which to retrieve information.
|
|
|
|
- <a href="#fd_prestat_dir_name.path" name="fd_prestat_dir_name.path"></a><code>const char \*<strong>path</strong></code> and <a href="#fd_prestat_dir_name.path_len" name="fd_prestat_dir_name.path_len"></a><code>size\_t <strong>path\_len</strong></code>
|
|
|
|
A buffer into which to write the preopened directory name.
|
|
|
|
### <a href="#fd_pwrite" name="fd_pwrite"></a>`__wasi_fd_pwrite()`
|
|
|
|
Write to a file descriptor, without using and updating the
|
|
file descriptor's offset.
|
|
|
|
Note: This is similar to `pwritev` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#fd_pwrite.fd" name="fd_pwrite.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The file descriptor to which to write data.
|
|
|
|
- <a href="#fd_pwrite.iovs" name="fd_pwrite.iovs"></a><code>const [\_\_wasi\_ciovec\_t](#ciovec) \*<strong>iovs</strong></code> and <a href="#fd_pwrite.iovs_len" name="fd_pwrite.iovs_len"></a><code>size\_t <strong>iovs\_len</strong></code>
|
|
|
|
List of scatter/gather vectors from which to retrieve data.
|
|
|
|
- <a href="#fd_pwrite.offset" name="fd_pwrite.offset"></a><code>[\_\_wasi\_filesize\_t](#filesize) <strong>offset</strong></code>
|
|
|
|
The offset within the file at which to write.
|
|
|
|
Outputs:
|
|
|
|
- <a href="#fd_pwrite.nwritten" name="fd_pwrite.nwritten"></a><code>size\_t <strong>nwritten</strong></code>
|
|
|
|
The number of bytes written.
|
|
|
|
### <a href="#fd_read" name="fd_read"></a>`__wasi_fd_read()`
|
|
|
|
Read from a file descriptor.
|
|
|
|
Note: This is similar to `readv` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#fd_read.fd" name="fd_read.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The file descriptor from which to read data.
|
|
|
|
- <a href="#fd_read.iovs" name="fd_read.iovs"></a><code>const [\_\_wasi\_iovec\_t](#iovec) \*<strong>iovs</strong></code> and <a href="#fd_read.iovs_len" name="fd_read.iovs_len"></a><code>size\_t <strong>iovs\_len</strong></code>
|
|
|
|
List of scatter/gather vectors to which to store data.
|
|
|
|
Outputs:
|
|
|
|
- <a href="#fd_read.nread" name="fd_read.nread"></a><code>size\_t <strong>nread</strong></code>
|
|
|
|
The number of bytes read.
|
|
|
|
### <a href="#fd_readdir" name="fd_readdir"></a>`__wasi_fd_readdir()`
|
|
|
|
Read directory entries from a directory.
|
|
|
|
When successful, the contents of the output buffer consist of
|
|
a sequence of directory entries. Each directory entry consists
|
|
of a [`__wasi_dirent_t`](#dirent) object, followed by [`__wasi_dirent_t::d_namlen`](#dirent.d_namlen) bytes
|
|
holding the name of the directory entry.
|
|
|
|
This function fills the output buffer as much as possible,
|
|
potentially truncating the last directory entry. This allows
|
|
the caller to grow its read buffer size in case it's too small
|
|
to fit a single large directory entry, or skip the oversized
|
|
directory entry.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#fd_readdir.fd" name="fd_readdir.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The directory from which to read the directory
|
|
entries.
|
|
|
|
- <a href="#fd_readdir.buf" name="fd_readdir.buf"></a><code>void \*<strong>buf</strong></code> and <a href="#fd_readdir.buf_len" name="fd_readdir.buf_len"></a><code>size\_t <strong>buf\_len</strong></code>
|
|
|
|
The buffer where directory entries are stored.
|
|
|
|
- <a href="#fd_readdir.cookie" name="fd_readdir.cookie"></a><code>[\_\_wasi\_dircookie\_t](#dircookie) <strong>cookie</strong></code>
|
|
|
|
The location within the directory to start
|
|
reading.
|
|
|
|
Outputs:
|
|
|
|
- <a href="#fd_readdir.bufused" name="fd_readdir.bufused"></a><code>size\_t <strong>bufused</strong></code>
|
|
|
|
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.
|
|
|
|
### <a href="#fd_renumber" name="fd_renumber"></a>`__wasi_fd_renumber()`
|
|
|
|
Atomically replace a file descriptor by renumbering another
|
|
file descriptor.
|
|
|
|
Due to the strong focus on thread safety, this environment
|
|
does not provide a mechanism to duplicate or renumber a file
|
|
descriptor to an arbitrary number, like dup2(). This would be
|
|
prone to race conditions, as an actual file descriptor with the
|
|
same number could be allocated by a different thread at the same
|
|
time.
|
|
|
|
This function provides a way to atomically renumber file
|
|
descriptors, which would disappear if dup2() were to be
|
|
removed entirely.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#fd_renumber.from" name="fd_renumber.from"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>from</strong></code>
|
|
|
|
The file descriptor to renumber.
|
|
|
|
- <a href="#fd_renumber.to" name="fd_renumber.to"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>to</strong></code>
|
|
|
|
The file descriptor to overwrite.
|
|
|
|
### <a href="#fd_seek" name="fd_seek"></a>`__wasi_fd_seek()`
|
|
|
|
Move the offset of a file descriptor.
|
|
|
|
Note: This is similar to `lseek` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#fd_seek.fd" name="fd_seek.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The file descriptor to operate on.
|
|
|
|
- <a href="#fd_seek.offset" name="fd_seek.offset"></a><code>[\_\_wasi\_filedelta\_t](#filedelta) <strong>offset</strong></code>
|
|
|
|
The number of bytes to move.
|
|
|
|
- <a href="#fd_seek.whence" name="fd_seek.whence"></a><code>[\_\_wasi\_whence\_t](#whence) <strong>whence</strong></code>
|
|
|
|
The base from which the offset is relative.
|
|
|
|
Outputs:
|
|
|
|
- <a href="#fd_seek.newoffset" name="fd_seek.newoffset"></a><code>[\_\_wasi\_filesize\_t](#filesize) <strong>newoffset</strong></code>
|
|
|
|
The new offset of the file descriptor,
|
|
relative to the start of the file.
|
|
|
|
### <a href="#fd_sync" name="fd_sync"></a>`__wasi_fd_sync()`
|
|
|
|
Synchronize the data and metadata of a file to disk.
|
|
|
|
Note: This is similar to `fsync` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#fd_sync.fd" name="fd_sync.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The file descriptor of the file containing the data
|
|
and metadata to synchronize to disk.
|
|
|
|
### <a href="#fd_tell" name="fd_tell"></a>`__wasi_fd_tell()`
|
|
|
|
Return the current offset of a file descriptor.
|
|
|
|
Note: This is similar to `lseek(fd, 0, SEEK_CUR)` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#fd_tell.fd" name="fd_tell.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The file descriptor to inspect.
|
|
|
|
Outputs:
|
|
|
|
- <a href="#fd_tell.offset" name="fd_tell.offset"></a><code>[\_\_wasi\_filesize\_t](#filesize) <strong>offset</strong></code>
|
|
|
|
The current offset of the file descriptor, relative to the start of the file.
|
|
|
|
### <a href="#fd_write" name="fd_write"></a>`__wasi_fd_write()`
|
|
|
|
Write to a file descriptor.
|
|
|
|
Note: This is similar to `writev` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#fd_write.fd" name="fd_write.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The file descriptor to which to write data.
|
|
|
|
- <a href="#fd_write.iovs" name="fd_write.iovs"></a><code>const [\_\_wasi\_ciovec\_t](#ciovec) \*<strong>iovs</strong></code> and <a href="#fd_write.iovs_len" name="fd_write.iovs_len"></a><code>size\_t <strong>iovs\_len</strong></code>
|
|
|
|
List of scatter/gather vectors from which to retrieve data.
|
|
|
|
Outputs:
|
|
|
|
- <a href="#fd_write.nwritten" name="fd_write.nwritten"></a><code>size\_t <strong>nwritten</strong></code>
|
|
|
|
The number of bytes written.
|
|
|
|
### <a href="#path_create_directory" name="path_create_directory"></a>`__wasi_path_create_directory()`
|
|
|
|
Create a directory.
|
|
|
|
Note: This is similar to `mkdirat` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#path_create_directory.fd" name="path_create_directory.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The working directory at which the resolution of the path starts.
|
|
|
|
- <a href="#path_create_directory.path" name="path_create_directory.path"></a><code>const char \*<strong>path</strong></code> and <a href="#path_create_directory.path_len" name="path_create_directory.path_len"></a><code>size\_t <strong>path\_len</strong></code>
|
|
|
|
The path at which to create the directory.
|
|
|
|
### <a href="#path_filestat_get" name="path_filestat_get"></a>`__wasi_path_filestat_get()`
|
|
|
|
Return the attributes of a file or directory.
|
|
|
|
Note: This is similar to `stat` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#path_filestat_get.fd" name="path_filestat_get.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The working directory at which the resolution of the path starts.
|
|
|
|
- <a href="#path_filestat_get.flags" name="path_filestat_get.flags"></a><code>[\_\_wasi\_lookupflags\_t](#lookupflags) <strong>flags</strong></code>
|
|
|
|
Flags determining the method of how the path is resolved.
|
|
|
|
- <a href="#path_filestat_get.path" name="path_filestat_get.path"></a><code>const char \*<strong>path</strong></code> and <a href="#path_filestat_get.path_len" name="path_filestat_get.path_len"></a><code>size\_t <strong>path\_len</strong></code>
|
|
|
|
The path of the file or directory to inspect.
|
|
|
|
- <a href="#path_filestat_get.buf" name="path_filestat_get.buf"></a><code>[\_\_wasi\_filestat\_t](#filestat) \*<strong>buf</strong></code>
|
|
|
|
The buffer where the file's attributes are
|
|
stored.
|
|
|
|
### <a href="#path_filestat_set_times" name="path_filestat_set_times"></a>`__wasi_path_filestat_set_times()`
|
|
|
|
Adjust the timestamps of a file or directory.
|
|
|
|
Note: This is similar to `utimensat` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#path_filestat_set_times.fd" name="path_filestat_set_times.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The working directory at which the resolution of the path starts.
|
|
|
|
- <a href="#path_filestat_set_times.flags" name="path_filestat_set_times.flags"></a><code>[\_\_wasi\_lookupflags\_t](#lookupflags) <strong>flags</strong></code>
|
|
|
|
Flags determining the method of how the path is resolved.
|
|
|
|
- <a href="#path_filestat_set_times.path" name="path_filestat_set_times.path"></a><code>const char \*<strong>path</strong></code> and <a href="#path_filestat_set_times.path_len" name="path_filestat_set_times.path_len"></a><code>size\_t <strong>path\_len</strong></code>
|
|
|
|
The path of the file or directory to operate on.
|
|
|
|
- <a href="#path_filestat_set_times.st_atim" name="path_filestat_set_times.st_atim"></a><code>[\_\_wasi\_timestamp\_t](#timestamp) <strong>st\_atim</strong></code>
|
|
|
|
The desired values of the data access timestamp.
|
|
|
|
- <a href="#path_filestat_set_times.st_mtim" name="path_filestat_set_times.st_mtim"></a><code>[\_\_wasi\_timestamp\_t](#timestamp) <strong>st\_mtim</strong></code>
|
|
|
|
The desired values of the data modification timestamp.
|
|
|
|
- <a href="#path_filestat_set_times.fst_flags" name="path_filestat_set_times.fst_flags"></a><code>[\_\_wasi\_fstflags\_t](#fstflags) <strong>fst\_flags</strong></code>
|
|
|
|
A bitmask indicating which timestamps to adjust.
|
|
|
|
### <a href="#path_link" name="path_link"></a>`__wasi_path_link()`
|
|
|
|
Create a hard link.
|
|
|
|
Note: This is similar to `linkat` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#path_link.old_fd" name="path_link.old_fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>old\_fd</strong></code>
|
|
|
|
The working directory at which the resolution of the old path starts.
|
|
|
|
- <a href="#path_link.old_flags" name="path_link.old_flags"></a><code>[\_\_wasi\_lookupflags\_t](#lookupflags) <strong>old\_flags</strong></code>
|
|
|
|
Flags determining the method of how the path is resolved.
|
|
|
|
- <a href="#path_link.old_path" name="path_link.old_path"></a><code>const char \*<strong>old\_path</strong></code> and <a href="#path_link.old_path_len" name="path_link.old_path_len"></a><code>size\_t <strong>old\_path\_len</strong></code>
|
|
|
|
The source path from which to link.
|
|
|
|
- <a href="#path_link.new_fd" name="path_link.new_fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>new\_fd</strong></code>
|
|
|
|
The working directory at which the resolution of the new path starts.
|
|
|
|
- <a href="#path_link.new_path" name="path_link.new_path"></a><code>const char \*<strong>new\_path</strong></code> and <a href="#path_link.new_path_len" name="path_link.new_path_len"></a><code>size\_t <strong>new\_path\_len</strong></code>
|
|
|
|
The destination path at which to create the hard link.
|
|
|
|
### <a href="#path_open" name="path_open"></a>`__wasi_path_open()`
|
|
|
|
Open a file or directory.
|
|
|
|
Note: This is similar to `openat` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#path_open.dirfd" name="path_open.dirfd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>dirfd</strong></code>
|
|
|
|
The working directory at which the resolution of the path starts.
|
|
|
|
- <a href="#path_open.dirflags" name="path_open.dirflags"></a><code>[\_\_wasi\_lookupflags\_t](#lookupflags) <strong>dirflags</strong></code>
|
|
|
|
Flags determining the method of how the path is resolved.
|
|
|
|
- <a href="#path_open.path" name="path_open.path"></a><code>const char \*<strong>path</strong></code> and <a href="#path_open.path_len" name="path_open.path_len"></a><code>size\_t <strong>path\_len</strong></code>
|
|
|
|
The path of the file or directory to open.
|
|
|
|
- <a href="#path_open.o_flags" name="path_open.o_flags"></a><code>[\_\_wasi\_oflags\_t](#oflags) <strong>o_flags</strong></code>
|
|
|
|
The method by which to open the file.
|
|
|
|
- <a href="#path_open.fs_rights_base" name="path_open.fs_rights_base"></a><code>[\_\_wasi\_rights\_t](#rights) <strong>fs\_rights\_base</strong></code> and <a href="#path_open.fs_rights_inheriting" name="path_open.fs_rights_inheriting"></a><code>[\_\_wasi\_rights\_t](#rights) <strong>fs\_rights\_inheriting</strong></code>
|
|
|
|
The initial rights of the newly created file descriptor. The
|
|
implementation is allowed to return a file descriptor with fewer
|
|
rights than specified, if and only if those rights do not apply
|
|
to the type of file being opened.
|
|
|
|
The *base* rights are rights that will apply to operations using
|
|
the file descriptor itself, while the *inheriting* rights are
|
|
rights that apply to file descriptors derived from it.
|
|
|
|
- <a href="#path_open.fs_flags" name="path_open.fs_flags"></a><code>[\_\_wasi\_fdflags\_t](#fdflags) <strong>fs\_flags</strong></code>
|
|
|
|
The initial flags of the file descriptor.
|
|
|
|
Outputs:
|
|
|
|
- <a href="#path_open.fd" name="path_open.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The file descriptor of the file that has been
|
|
opened.
|
|
|
|
### <a href="#path_readlink" name="path_readlink"></a>`__wasi_path_readlink()`
|
|
|
|
Read the contents of a symbolic link.
|
|
|
|
Note: This is similar to `readlinkat` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#path_readlink.fd" name="path_readlink.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The working directory at which the resolution of the path starts.
|
|
|
|
- <a href="#path_readlink.path" name="path_readlink.path"></a><code>const char \*<strong>path</strong></code> and <a href="#path_readlink.path_len" name="path_readlink.path_len"></a><code>size\_t <strong>path\_len</strong></code>
|
|
|
|
The path of the symbolic link from which to read.
|
|
|
|
- <a href="#path_readlink.buf" name="path_readlink.buf"></a><code>char \*<strong>buf</strong></code> and <a href="#path_readlink.buf_len" name="path_readlink.buf_len"></a><code>size\_t <strong>buf\_len</strong></code>
|
|
|
|
The buffer to which to write the contents of the symbolic link.
|
|
|
|
Outputs:
|
|
|
|
- <a href="#path_readlink.bufused" name="path_readlink.bufused"></a><code>size\_t <strong>bufused</strong></code>
|
|
|
|
The number of bytes placed in the buffer.
|
|
|
|
### <a href="#path_remove_directory" name="path_remove_directory"></a>`__wasi_path_remove_directory()`
|
|
|
|
Remove a directory.
|
|
|
|
Return [`__WASI_ENOTEMPTY`](#errno.notempty) if the directory is not empty.
|
|
|
|
Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#path_remove_directory.fd" name="path_remove_directory.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The working directory at which the resolution of the path starts.
|
|
|
|
- <a href="#path_remove_directory.path" name="path_remove_directory.path"></a><code>const char \*<strong>path</strong></code> and <a href="#path_remove_directory.path_len" name="path_remove_directory.path_len"></a><code>size\_t <strong>path\_len</strong></code>
|
|
|
|
The path to a directory to remove.
|
|
|
|
### <a href="#path_rename" name="path_rename"></a>`__wasi_path_rename()`
|
|
|
|
Rename a file or directory.
|
|
|
|
Note: This is similar to `renameat` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#path_rename.old_fd" name="path_rename.old_fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>old\_fd</strong></code>
|
|
|
|
The working directory at which the resolution of the old path starts.
|
|
|
|
- <a href="#path_rename.old_path" name="path_rename.old_path"></a><code>const char \*<strong>old\_path</strong></code> and <a href="#path_rename.old_path_len" name="path_rename.old_path_len"></a><code>size\_t <strong>old\_path\_len</strong></code>
|
|
|
|
The source path of the file or directory to rename.
|
|
|
|
- <a href="#path_rename.new_fd" name="path_rename.new_fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>new\_fd</strong></code>
|
|
|
|
The working directory at which the resolution of the new path starts.
|
|
|
|
- <a href="#path_rename.new_path" name="path_rename.new_path"></a><code>const char \*<strong>new\_path</strong></code> and <a href="#path_rename.new_path_len" name="path_rename.new_path_len"></a><code>size\_t <strong>new\_path\_len</strong></code>
|
|
|
|
The destination path to which to rename the file or directory.
|
|
|
|
### <a href="#path_symlink" name="path_symlink"></a>`__wasi_path_symlink()`
|
|
|
|
Create a symbolic link.
|
|
|
|
Note: This is similar to `symlinkat` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#path_symlink.old_path" name="path_symlink.old_path"></a><code>const char \*<strong>old\_path</strong></code> and <a href="#path_symlink.old_path_len" name="path_symlink.old_path_len"></a><code>size\_t <strong>old_path\_len</strong></code>
|
|
|
|
The contents of the symbolic link.
|
|
|
|
- <a href="#path_symlink.fd" name="path_symlink.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The working directory at which the resolution of the path starts.
|
|
|
|
- <a href="#path_symlink.new_path" name="path_symlink.new_path"></a><code>const char \*<strong>new\_path</strong></code> and <a href="#path_symlink.new_path_len" name="path_symlink.new_path_len"></a><code>size\_t <strong>new\_path\_len</strong></code>
|
|
|
|
The destination path at which to create the symbolic link.
|
|
|
|
### <a href="#path_unlink_file" name="path_unlink_file"></a>`__wasi_path_unlink_file()`
|
|
|
|
Unlink a file.
|
|
|
|
Return [`__WASI_EISDIR`](#errno.isdir) if the path refers to a directory.
|
|
|
|
Note: This is similar to `unlinkat(fd, path, 0)` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#path_unlink_file.fd" name="path_unlink_file.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The working directory at which the resolution of the path starts.
|
|
|
|
- <a href="#path_unlink_file.path" name="path_unlink_file.path"></a><code>const char \*<strong>path</strong></code> and <a href="#path_unlink_file.path_len" name="path_unlink_file.path_len"></a><code>size\_t <strong>path\_len</strong></code>
|
|
|
|
The path to a file to unlink.
|
|
|
|
### <a href="#poll_oneoff" name="poll_oneoff"></a>`__wasi_poll_oneoff()`
|
|
|
|
Concurrently poll for the occurrence of a set of events.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#poll_oneoff.in" name="poll_oneoff.in"></a><code>const [\_\_wasi\_subscription\_t](#subscription) \*<strong>in</strong></code>
|
|
|
|
The events to which to subscribe.
|
|
|
|
- <a href="#poll_oneoff.out" name="poll_oneoff.out"></a><code>[\_\_wasi\_event\_t](#event) \*<strong>out</strong></code>
|
|
|
|
The events that have occurred.
|
|
|
|
- <a href="#poll_oneoff.nsubscriptions" name="poll_oneoff.nsubscriptions"></a><code>size\_t <strong>nsubscriptions</strong></code>
|
|
|
|
Both the number of subscriptions and events.
|
|
|
|
Outputs:
|
|
|
|
- <a href="#poll_oneoff.nevents" name="poll_oneoff.nevents"></a><code>size\_t <strong>nevents</strong></code>
|
|
|
|
The number of events stored.
|
|
|
|
### <a href="#proc_exit" name="proc_exit"></a>`__wasi_proc_exit()`
|
|
|
|
Terminate the process normally. An exit code of 0 indicates successful
|
|
termination of the program. The meanings of other values is dependent on
|
|
the environment.
|
|
|
|
Note: This is similar to `_Exit` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#proc_exit.rval" name="proc_exit.rval"></a><code>[\_\_wasi\_exitcode\_t](#exitcode) <strong>rval</strong></code>
|
|
|
|
The exit code returned by the process.
|
|
|
|
Does not return.
|
|
|
|
### <a href="#proc_raise" name="proc_raise"></a>`__wasi_proc_raise()`
|
|
|
|
Send a signal to the process of the calling thread.
|
|
|
|
Note: This is similar to `raise` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#proc_raise.sig" name="proc_raise.sig"></a><code>[\_\_wasi\_signal\_t](#signal) <strong>sig</strong></code>
|
|
|
|
The signal condition to trigger.
|
|
|
|
### <a href="#random_get" name="random_get"></a>`__wasi_random_get()`
|
|
|
|
Write high-quality random data into a buffer.
|
|
|
|
This function may execute slowly, so when large mounts of random
|
|
data are required, it's advisable to use this function to seed a
|
|
pseudo-random number generator, rather than to provide the
|
|
random data directly.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#random_get.buf" name="random_get.buf"></a><code>void \*<strong>buf</strong></code> and <a href="#random_get.buf_len" name="random_get.buf_len"></a><code>size\_t <strong>buf\_len</strong></code>
|
|
|
|
The buffer to fill with random data.
|
|
|
|
### <a href="#sched_yield" name="sched_yield"></a>`__wasi_sched_yield()`
|
|
|
|
Temporarily yield execution of the calling thread.
|
|
|
|
Note: This is similar to `sched_yield` in POSIX.
|
|
|
|
### <a href="#sock_recv" name="sock_recv"></a>`__wasi_sock_recv()`
|
|
|
|
Receive a message from a socket.
|
|
|
|
Note: This is similar to `recv` in POSIX, though it also supports reading
|
|
the data into multiple buffers in the manner of `readv`.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#sock_recv.sock" name="sock_recv.sock"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>sock</strong></code>
|
|
|
|
The socket on which to receive data.
|
|
|
|
- <a href="#sock_recv.ri_data" name="sock_recv.ri_data"></a><code>const [\_\_wasi\_iovec\_t](#iovec) \*<strong>ri\_data</strong></code> and <a href="#sock_recv.ri_data_len" name="sock_recv.ri_data_len"></a><code>size\_t <strong>ri\_data\_len</strong></code>
|
|
|
|
List of scatter/gather vectors to which to store data.
|
|
|
|
- <a href="#sock_recv.ri_flags" name="sock_recv.ri_flags"></a><code>[\_\_wasi\_riflags\_t](#riflags) <strong>ri\_flags</strong></code>
|
|
|
|
Message flags.
|
|
|
|
Outputs:
|
|
|
|
- <a href="#sock_recv.ro_datalen" name="sock_recv.ro_datalen"></a><code>size\_t <strong>ro\_datalen</strong></code>
|
|
|
|
Number of bytes stored in [`ri_data`](#sock_recv.ri_data).
|
|
|
|
- <a href="#sock_recv.ro_flags" name="sock_recv.ro_flags"></a><code>[\_\_wasi\_roflags\_t](#roflags) <strong>ro\_flags</strong></code>
|
|
|
|
Message flags.
|
|
|
|
### <a href="#sock_send" name="sock_send"></a>`__wasi_sock_send()`
|
|
|
|
Send a message on a socket.
|
|
|
|
Note: This is similar to `send` in POSIX, though it also supports writing
|
|
the data from multiple buffers in the manner of `writev`.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#sock_send.sock" name="sock_send.sock"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>sock</strong></code>
|
|
|
|
The socket on which to send data.
|
|
|
|
- <a href="#sock_send.si_data" name="sock_send.si_data"></a><code>const [\_\_wasi\_ciovec\_t](#ciovec) \*<strong>si\_data</strong></code> and <a href="#sock_send.si_data_len" name="sock_send.si_data_len"></a><code>size\_t <strong>si\_data\_len</strong></code>
|
|
|
|
List of scatter/gather vectors to which to retrieve data
|
|
|
|
- <a href="#sock_send.si_flags" name="sock_send.si_flags"></a><code>[\_\_wasi\_siflags\_t](#siflags) <strong>si\_flags</strong></code>
|
|
|
|
Message flags.
|
|
|
|
Outputs:
|
|
|
|
- <a href="#sock_send.so_datalen" name="sock_send.so_datalen"></a><code>size\_t <strong>so\_datalen</strong></code>
|
|
|
|
Number of bytes transmitted.
|
|
|
|
### <a href="#sock_shutdown" name="sock_shutdown"></a>`__wasi_sock_shutdown()`
|
|
|
|
Shut down socket send and receive channels.
|
|
|
|
Note: This is similar to `shutdown` in POSIX.
|
|
|
|
Inputs:
|
|
|
|
- <a href="#sock_shutdown.sock" name="sock_shutdown.sock"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>sock</strong></code>
|
|
|
|
The socket on which to shutdown channels.
|
|
|
|
- <a href="#sock_shutdown.how" name="sock_shutdown.how"></a><code>[\_\_wasi\_sdflags\_t](#sdflags) <strong>how</strong></code>
|
|
|
|
Which channels on the socket to shut down.
|
|
|
|
## Types
|
|
|
|
### <a href="#advice" name="advice"></a>`__wasi_advice_t` (`uint8_t`)
|
|
|
|
File or memory access pattern advisory information.
|
|
|
|
Used by [`__wasi_fd_advise()`](#fd_advise).
|
|
|
|
Possible values:
|
|
|
|
- <a href="#advice.dontneed" name="advice.dontneed"></a>**`__WASI_ADVICE_DONTNEED`**
|
|
|
|
The application expects that it will not access the
|
|
specified data in the near future.
|
|
|
|
- <a href="#advice.noreuse" name="advice.noreuse"></a>**`__WASI_ADVICE_NOREUSE`**
|
|
|
|
The application expects to access the specified data
|
|
once and then not reuse it thereafter.
|
|
|
|
- <a href="#advice.normal" name="advice.normal"></a>**`__WASI_ADVICE_NORMAL`**
|
|
|
|
The application has no advice to give on its behavior
|
|
with respect to the specified data.
|
|
|
|
- <a href="#advice.random" name="advice.random"></a>**`__WASI_ADVICE_RANDOM`**
|
|
|
|
The application expects to access the specified data
|
|
in a random order.
|
|
|
|
- <a href="#advice.sequential" name="advice.sequential"></a>**`__WASI_ADVICE_SEQUENTIAL`**
|
|
|
|
The application expects to access the specified data
|
|
sequentially from lower offsets to higher offsets.
|
|
|
|
- <a href="#advice.willneed" name="advice.willneed"></a>**`__WASI_ADVICE_WILLNEED`**
|
|
|
|
The application expects to access the specified data
|
|
in the near future.
|
|
|
|
### <a href="#ciovec" name="ciovec"></a>`__wasi_ciovec_t` (`struct`)
|
|
|
|
A region of memory for scatter/gather writes.
|
|
|
|
Used by [`__wasi_fd_pwrite()`](#fd_pwrite), [`__wasi_fd_write()`](#fd_write), and [`__wasi_sock_send()`](#sock_send).
|
|
|
|
Members:
|
|
|
|
- <a href="#ciovec.buf" name="ciovec.buf"></a><code>const void \*<strong>buf</strong></code> and <a href="#ciovec.buf_len" name="ciovec.buf_len"></a><code>size\_t <strong>buf\_len</strong></code>
|
|
|
|
The address and length of the buffer to be written.
|
|
|
|
### <a href="#clockid" name="clockid"></a>`__wasi_clockid_t` (`uint32_t`)
|
|
|
|
Identifiers for clocks.
|
|
|
|
Used by [`__wasi_subscription_t`](#subscription), [`__wasi_clock_res_get()`](#clock_res_get), and [`__wasi_clock_time_get()`](#clock_time_get).
|
|
|
|
Possible values:
|
|
|
|
- <a href="#clockid.monotonic" name="clockid.monotonic"></a>**`__WASI_CLOCK_MONOTONIC`**
|
|
|
|
The store-wide monotonic clock, which is defined as a
|
|
clock measuring real time, whose value cannot be
|
|
adjusted and which cannot have negative clock jumps.
|
|
|
|
The epoch of this clock is undefined. The absolute
|
|
time value of this clock therefore has no meaning.
|
|
|
|
- <a href="#clockid.process_cputime_id" name="clockid.process_cputime_id"></a>**`__WASI_CLOCK_PROCESS_CPUTIME_ID`**
|
|
|
|
The CPU-time clock associated with the current
|
|
process.
|
|
|
|
- <a href="#clockid.realtime" name="clockid.realtime"></a>**`__WASI_CLOCK_REALTIME`**
|
|
|
|
The clock measuring real time. Time value
|
|
zero corresponds with 1970-01-01T00:00:00Z.
|
|
|
|
- <a href="#clockid.thread_cputime_id" name="clockid.thread_cputime_id"></a>**`__WASI_CLOCK_THREAD_CPUTIME_ID`**
|
|
|
|
The CPU-time clock associated with the current thread.
|
|
|
|
### <a href="#device" name="device"></a>`__wasi_device_t` (`uint64_t`)
|
|
|
|
Identifier for a device containing a file system. Can be used
|
|
in combination with [`__wasi_inode_t`](#inode) to uniquely identify a file or
|
|
directory in the filesystem.
|
|
|
|
Used by [`__wasi_filestat_t`](#filestat).
|
|
|
|
### <a href="#dircookie" name="dircookie"></a>`__wasi_dircookie_t` (`uint64_t`)
|
|
|
|
A reference to the offset of a directory entry.
|
|
|
|
Used by [`__wasi_dirent_t`](#dirent) and [`__wasi_fd_readdir()`](#fd_readdir).
|
|
|
|
Special values:
|
|
|
|
- <a href="#dircookie.start" name="dircookie.start"></a>**`__WASI_DIRCOOKIE_START`**
|
|
|
|
Permanent reference to the first directory entry
|
|
within a directory.
|
|
|
|
### <a href="#dirent" name="dirent"></a>`__wasi_dirent_t` (`struct`)
|
|
|
|
A directory entry.
|
|
|
|
Members:
|
|
|
|
- <a href="#dirent.d_next" name="dirent.d_next"></a><code>[\_\_wasi\_dircookie\_t](#dircookie) <strong>d\_next</strong></code>
|
|
|
|
The offset of the next directory entry stored in this
|
|
directory.
|
|
|
|
- <a href="#dirent.d_ino" name="dirent.d_ino"></a><code>[\_\_wasi\_inode\_t](#inode) <strong>d\_ino</strong></code>
|
|
|
|
The serial number of the file referred to by this
|
|
directory entry.
|
|
|
|
- <a href="#dirent.d_namlen" name="dirent.d_namlen"></a><code>uint32\_t <strong>d\_namlen</strong></code>
|
|
|
|
The length of the name of the directory entry.
|
|
|
|
- <a href="#dirent.d_type" name="dirent.d_type"></a><code>[\_\_wasi\_filetype\_t](#filetype) <strong>d\_type</strong></code>
|
|
|
|
The type of the file referred to by this directory
|
|
entry.
|
|
|
|
### <a href="#errno" name="errno"></a>`__wasi_errno_t` (`uint16_t`)
|
|
|
|
Error codes returned by functions.
|
|
|
|
Not all of these error codes are returned by the functions
|
|
provided by this API; some are used in higher-level library layers,
|
|
and others are provided merely for alignment with POSIX.
|
|
|
|
Used by [`__wasi_event_t`](#event).
|
|
|
|
Possible values:
|
|
|
|
- <a href="#errno.success" name="errno.success"></a>**`__WASI_ESUCCESS`**
|
|
|
|
No error occurred. System call completed successfully.
|
|
|
|
- <a href="#errno.2big" name="errno.2big"></a>**`__WASI_E2BIG`**
|
|
|
|
Argument list too long.
|
|
|
|
- <a href="#errno.acces" name="errno.acces"></a>**`__WASI_EACCES`**
|
|
|
|
Permission denied.
|
|
|
|
- <a href="#errno.addrinuse" name="errno.addrinuse"></a>**`__WASI_EADDRINUSE`**
|
|
|
|
Address in use.
|
|
|
|
- <a href="#errno.addrnotavail" name="errno.addrnotavail"></a>**`__WASI_EADDRNOTAVAIL`**
|
|
|
|
Address not available.
|
|
|
|
- <a href="#errno.afnosupport" name="errno.afnosupport"></a>**`__WASI_EAFNOSUPPORT`**
|
|
|
|
Address family not supported.
|
|
|
|
- <a href="#errno.again" name="errno.again"></a>**`__WASI_EAGAIN`**
|
|
|
|
Resource unavailable, or operation would block.
|
|
|
|
- <a href="#errno.already" name="errno.already"></a>**`__WASI_EALREADY`**
|
|
|
|
Connection already in progress.
|
|
|
|
- <a href="#errno.badf" name="errno.badf"></a>**`__WASI_EBADF`**
|
|
|
|
Bad file descriptor.
|
|
|
|
- <a href="#errno.badmsg" name="errno.badmsg"></a>**`__WASI_EBADMSG`**
|
|
|
|
Bad message.
|
|
|
|
- <a href="#errno.busy" name="errno.busy"></a>**`__WASI_EBUSY`**
|
|
|
|
Device or resource busy.
|
|
|
|
- <a href="#errno.canceled" name="errno.canceled"></a>**`__WASI_ECANCELED`**
|
|
|
|
Operation canceled.
|
|
|
|
- <a href="#errno.child" name="errno.child"></a>**`__WASI_ECHILD`**
|
|
|
|
No child processes.
|
|
|
|
- <a href="#errno.connaborted" name="errno.connaborted"></a>**`__WASI_ECONNABORTED`**
|
|
|
|
Connection aborted.
|
|
|
|
- <a href="#errno.connrefused" name="errno.connrefused"></a>**`__WASI_ECONNREFUSED`**
|
|
|
|
Connection refused.
|
|
|
|
- <a href="#errno.connreset" name="errno.connreset"></a>**`__WASI_ECONNRESET`**
|
|
|
|
Connection reset.
|
|
|
|
- <a href="#errno.deadlk" name="errno.deadlk"></a>**`__WASI_EDEADLK`**
|
|
|
|
Resource deadlock would occur.
|
|
|
|
- <a href="#errno.destaddrreq" name="errno.destaddrreq"></a>**`__WASI_EDESTADDRREQ`**
|
|
|
|
Destination address required.
|
|
|
|
- <a href="#errno.dom" name="errno.dom"></a>**`__WASI_EDOM`**
|
|
|
|
Mathematics argument out of domain of function.
|
|
|
|
- <a href="#errno.dquot" name="errno.dquot"></a>**`__WASI_EDQUOT`**
|
|
|
|
Reserved.
|
|
|
|
- <a href="#errno.exist" name="errno.exist"></a>**`__WASI_EEXIST`**
|
|
|
|
File exists.
|
|
|
|
- <a href="#errno.fault" name="errno.fault"></a>**`__WASI_EFAULT`**
|
|
|
|
Bad address.
|
|
|
|
- <a href="#errno.fbig" name="errno.fbig"></a>**`__WASI_EFBIG`**
|
|
|
|
File too large.
|
|
|
|
- <a href="#errno.hostunreach" name="errno.hostunreach"></a>**`__WASI_EHOSTUNREACH`**
|
|
|
|
Host is unreachable.
|
|
|
|
- <a href="#errno.idrm" name="errno.idrm"></a>**`__WASI_EIDRM`**
|
|
|
|
Identifier removed.
|
|
|
|
- <a href="#errno.ilseq" name="errno.ilseq"></a>**`__WASI_EILSEQ`**
|
|
|
|
Illegal byte sequence.
|
|
|
|
- <a href="#errno.inprogress" name="errno.inprogress"></a>**`__WASI_EINPROGRESS`**
|
|
|
|
Operation in progress.
|
|
|
|
- <a href="#errno.intr" name="errno.intr"></a>**`__WASI_EINTR`**
|
|
|
|
Interrupted function.
|
|
|
|
- <a href="#errno.inval" name="errno.inval"></a>**`__WASI_EINVAL`**
|
|
|
|
Invalid argument.
|
|
|
|
- <a href="#errno.io" name="errno.io"></a>**`__WASI_EIO`**
|
|
|
|
I/O error.
|
|
|
|
- <a href="#errno.isconn" name="errno.isconn"></a>**`__WASI_EISCONN`**
|
|
|
|
Socket is connected.
|
|
|
|
- <a href="#errno.isdir" name="errno.isdir"></a>**`__WASI_EISDIR`**
|
|
|
|
Is a directory.
|
|
|
|
- <a href="#errno.loop" name="errno.loop"></a>**`__WASI_ELOOP`**
|
|
|
|
Too many levels of symbolic links.
|
|
|
|
- <a href="#errno.mfile" name="errno.mfile"></a>**`__WASI_EMFILE`**
|
|
|
|
File descriptor value too large.
|
|
|
|
- <a href="#errno.mlink" name="errno.mlink"></a>**`__WASI_EMLINK`**
|
|
|
|
Too many links.
|
|
|
|
- <a href="#errno.msgsize" name="errno.msgsize"></a>**`__WASI_EMSGSIZE`**
|
|
|
|
Message too large.
|
|
|
|
- <a href="#errno.multihop" name="errno.multihop"></a>**`__WASI_EMULTIHOP`**
|
|
|
|
Reserved.
|
|
|
|
- <a href="#errno.nametoolong" name="errno.nametoolong"></a>**`__WASI_ENAMETOOLONG`**
|
|
|
|
Filename too long.
|
|
|
|
- <a href="#errno.netdown" name="errno.netdown"></a>**`__WASI_ENETDOWN`**
|
|
|
|
Network is down.
|
|
|
|
- <a href="#errno.netreset" name="errno.netreset"></a>**`__WASI_ENETRESET`**
|
|
|
|
Connection aborted by network.
|
|
|
|
- <a href="#errno.netunreach" name="errno.netunreach"></a>**`__WASI_ENETUNREACH`**
|
|
|
|
Network unreachable.
|
|
|
|
- <a href="#errno.nfile" name="errno.nfile"></a>**`__WASI_ENFILE`**
|
|
|
|
Too many files open in system.
|
|
|
|
- <a href="#errno.nobufs" name="errno.nobufs"></a>**`__WASI_ENOBUFS`**
|
|
|
|
No buffer space available.
|
|
|
|
- <a href="#errno.nodev" name="errno.nodev"></a>**`__WASI_ENODEV`**
|
|
|
|
No such device.
|
|
|
|
- <a href="#errno.noent" name="errno.noent"></a>**`__WASI_ENOENT`**
|
|
|
|
No such file or directory.
|
|
|
|
- <a href="#errno.noexec" name="errno.noexec"></a>**`__WASI_ENOEXEC`**
|
|
|
|
Executable file format error.
|
|
|
|
- <a href="#errno.nolck" name="errno.nolck"></a>**`__WASI_ENOLCK`**
|
|
|
|
No locks available.
|
|
|
|
- <a href="#errno.nolink" name="errno.nolink"></a>**`__WASI_ENOLINK`**
|
|
|
|
Reserved.
|
|
|
|
- <a href="#errno.nomem" name="errno.nomem"></a>**`__WASI_ENOMEM`**
|
|
|
|
Not enough space.
|
|
|
|
- <a href="#errno.nomsg" name="errno.nomsg"></a>**`__WASI_ENOMSG`**
|
|
|
|
No message of the desired type.
|
|
|
|
- <a href="#errno.noprotoopt" name="errno.noprotoopt"></a>**`__WASI_ENOPROTOOPT`**
|
|
|
|
Protocol not available.
|
|
|
|
- <a href="#errno.nospc" name="errno.nospc"></a>**`__WASI_ENOSPC`**
|
|
|
|
No space left on device.
|
|
|
|
- <a href="#errno.nosys" name="errno.nosys"></a>**`__WASI_ENOSYS`**
|
|
|
|
Function not supported.
|
|
|
|
- <a href="#errno.notconn" name="errno.notconn"></a>**`__WASI_ENOTCONN`**
|
|
|
|
The socket is not connected.
|
|
|
|
- <a href="#errno.notdir" name="errno.notdir"></a>**`__WASI_ENOTDIR`**
|
|
|
|
Not a directory or a symbolic link to a directory.
|
|
|
|
- <a href="#errno.notempty" name="errno.notempty"></a>**`__WASI_ENOTEMPTY`**
|
|
|
|
Directory not empty.
|
|
|
|
- <a href="#errno.notrecoverable" name="errno.notrecoverable"></a>**`__WASI_ENOTRECOVERABLE`**
|
|
|
|
State not recoverable.
|
|
|
|
- <a href="#errno.notsock" name="errno.notsock"></a>**`__WASI_ENOTSOCK`**
|
|
|
|
Not a socket.
|
|
|
|
- <a href="#errno.notsup" name="errno.notsup"></a>**`__WASI_ENOTSUP`**
|
|
|
|
Not supported, or operation not supported on socket.
|
|
|
|
- <a href="#errno.notty" name="errno.notty"></a>**`__WASI_ENOTTY`**
|
|
|
|
Inappropriate I/O control operation.
|
|
|
|
- <a href="#errno.nxio" name="errno.nxio"></a>**`__WASI_ENXIO`**
|
|
|
|
No such device or address.
|
|
|
|
- <a href="#errno.overflow" name="errno.overflow"></a>**`__WASI_EOVERFLOW`**
|
|
|
|
Value too large to be stored in data type.
|
|
|
|
- <a href="#errno.ownerdead" name="errno.ownerdead"></a>**`__WASI_EOWNERDEAD`**
|
|
|
|
Previous owner died.
|
|
|
|
- <a href="#errno.perm" name="errno.perm"></a>**`__WASI_EPERM`**
|
|
|
|
Operation not permitted.
|
|
|
|
- <a href="#errno.pipe" name="errno.pipe"></a>**`__WASI_EPIPE`**
|
|
|
|
Broken pipe.
|
|
|
|
- <a href="#errno.proto" name="errno.proto"></a>**`__WASI_EPROTO`**
|
|
|
|
Protocol error.
|
|
|
|
- <a href="#errno.protonosupport" name="errno.protonosupport"></a>**`__WASI_EPROTONOSUPPORT`**
|
|
|
|
Protocol not supported.
|
|
|
|
- <a href="#errno.prototype" name="errno.prototype"></a>**`__WASI_EPROTOTYPE`**
|
|
|
|
Protocol wrong type for socket.
|
|
|
|
- <a href="#errno.range" name="errno.range"></a>**`__WASI_ERANGE`**
|
|
|
|
Result too large.
|
|
|
|
- <a href="#errno.rofs" name="errno.rofs"></a>**`__WASI_EROFS`**
|
|
|
|
Read-only file system.
|
|
|
|
- <a href="#errno.spipe" name="errno.spipe"></a>**`__WASI_ESPIPE`**
|
|
|
|
Invalid seek.
|
|
|
|
- <a href="#errno.srch" name="errno.srch"></a>**`__WASI_ESRCH`**
|
|
|
|
No such process.
|
|
|
|
- <a href="#errno.stale" name="errno.stale"></a>**`__WASI_ESTALE`**
|
|
|
|
Reserved.
|
|
|
|
- <a href="#errno.timedout" name="errno.timedout"></a>**`__WASI_ETIMEDOUT`**
|
|
|
|
Connection timed out.
|
|
|
|
- <a href="#errno.txtbsy" name="errno.txtbsy"></a>**`__WASI_ETXTBSY`**
|
|
|
|
Text file busy.
|
|
|
|
- <a href="#errno.xdev" name="errno.xdev"></a>**`__WASI_EXDEV`**
|
|
|
|
Cross-device link.
|
|
|
|
- <a href="#errno.notcapable" name="errno.notcapable"></a>**`__WASI_ENOTCAPABLE`**
|
|
|
|
Extension: Capabilities insufficient.
|
|
|
|
### <a href="#event" name="event"></a>`__wasi_event_t` (`struct`)
|
|
|
|
An event that occurred.
|
|
|
|
Used by [`__wasi_poll_oneoff()`](#poll_oneoff).
|
|
|
|
Members:
|
|
|
|
- <a href="#event.userdata" name="event.userdata"></a><code>[\_\_wasi\_userdata\_t](#userdata) <strong>userdata</strong></code>
|
|
|
|
User-provided value that got attached to
|
|
[`__wasi_subscription_t::userdata`](#subscription.userdata).
|
|
|
|
- <a href="#event.error" name="event.error"></a><code>[\_\_wasi\_errno\_t](#errno) <strong>error</strong></code>
|
|
|
|
If non-zero, an error that occurred while processing
|
|
the subscription request.
|
|
|
|
- <a href="#event.type" name="event.type"></a><code>[\_\_wasi\_eventtype\_t](#eventtype) <strong>type</strong></code>
|
|
|
|
The type of the event that occurred.
|
|
|
|
- When `type` is [`__WASI_EVENTTYPE_FD_READ`](#eventtype.fd_read) or [`__WASI_EVENTTYPE_FD_WRITE`](#eventtype.fd_write):
|
|
|
|
- <a href="#event.u.fd_readwrite" name="event.u.fd_readwrite"></a>**`u.fd_readwrite`**
|
|
|
|
- <a href="#event.u.fd_readwrite.nbytes" name="event.u.fd_readwrite.nbytes"></a><code>[\_\_wasi\_filesize\_t](#filesize) <strong>nbytes</strong></code>
|
|
|
|
The number of bytes available for reading or writing.
|
|
|
|
- <a href="#event.u.fd_readwrite.flags" name="event.u.fd_readwrite.flags"></a><code>[\_\_wasi\_eventrwflags\_t](#eventrwflags) <strong>flags</strong></code>
|
|
|
|
The state of the file descriptor.
|
|
|
|
### <a href="#eventrwflags" name="eventrwflags"></a>`__wasi_eventrwflags_t` (`uint16_t` bitfield)
|
|
|
|
The state of the file descriptor subscribed to with
|
|
[`__WASI_EVENTTYPE_FD_READ`](#eventtype.fd_read) or [`__WASI_EVENTTYPE_FD_WRITE`](#eventtype.fd_write).
|
|
|
|
Used by [`__wasi_event_t`](#event).
|
|
|
|
Possible values:
|
|
|
|
- <a href="#eventrwflags.hangup" name="eventrwflags.hangup"></a>**`__WASI_EVENT_FD_READWRITE_HANGUP`**
|
|
|
|
The peer of this socket has closed or disconnected.
|
|
|
|
### <a href="#eventtype" name="eventtype"></a>`__wasi_eventtype_t` (`uint8_t`)
|
|
|
|
Type of a subscription to an event or its occurrence.
|
|
|
|
Used by [`__wasi_event_t`](#event) and [`__wasi_subscription_t`](#subscription).
|
|
|
|
Possible values:
|
|
|
|
- <a href="#eventtype.u.clock" name="eventtype.u.clock"></a>**`__WASI_EVENTTYPE_CLOCK`**
|
|
|
|
The time value of clock [`__wasi_subscription_t::u.clock.clock_id`](#subscription.u.clock.clock_id)
|
|
has reached timestamp [`__wasi_subscription_t::u.clock.timeout`](#subscription.u.clock.timeout).
|
|
|
|
- <a href="#eventtype.fd_read" name="eventtype.fd_read"></a>**`__WASI_EVENTTYPE_FD_READ`**
|
|
|
|
File descriptor [`__wasi_subscription_t::u.fd_readwrite.fd`](#subscription.u.fd_readwrite.fd) has
|
|
data available for reading. This event always triggers
|
|
for regular files.
|
|
|
|
- <a href="#eventtype.fd_write" name="eventtype.fd_write"></a>**`__WASI_EVENTTYPE_FD_WRITE`**
|
|
|
|
File descriptor [`__wasi_subscription_t::u.fd_readwrite.fd`](#subscription.u.fd_readwrite.fd) has
|
|
capacity available for writing. This event always
|
|
triggers for regular files.
|
|
|
|
### <a href="#exitcode" name="exitcode"></a>`__wasi_exitcode_t` (`uint32_t`)
|
|
|
|
Exit code generated by a process when exiting.
|
|
|
|
Used by [`__wasi_proc_exit()`](#proc_exit).
|
|
|
|
### <a href="#fd" name="fd"></a>`__wasi_fd_t` (`uint32_t`)
|
|
|
|
A file descriptor number.
|
|
|
|
Used by many functions in this API.
|
|
|
|
As in POSIX, three file descriptor numbers are provided to instances
|
|
on startup -- 0, 1, and 2, (a.k.a. `STDIN_FILENO`, `STDOUT_FILENO`,
|
|
and `STDERR_FILENO`).
|
|
|
|
Other than these, WASI implementations are not required to allocate
|
|
new file descriptors in ascending order.
|
|
|
|
### <a href="#fdflags" name="fdflags"></a>`__wasi_fdflags_t` (`uint16_t` bitfield)
|
|
|
|
File descriptor flags.
|
|
|
|
Used by [`__wasi_fdstat_t`](#fdstat), [`__wasi_fd_fdstat_set_flags()`](#fd_fdstat_set_flags), and [`__wasi_path_open()`](#path_open).
|
|
|
|
Possible values:
|
|
|
|
- <a href="#fdflags.append" name="fdflags.append"></a>**`__WASI_FDFLAG_APPEND`**
|
|
|
|
Append mode: Data written to the file is always
|
|
appended to the file's end.
|
|
|
|
- <a href="#fdflags.dsync" name="fdflags.dsync"></a>**`__WASI_FDFLAG_DSYNC`**
|
|
|
|
Write according to synchronized I/O data integrity
|
|
completion. Only the data stored in the file is
|
|
synchronized.
|
|
|
|
- <a href="#fdflags.nonblock" name="fdflags.nonblock"></a>**`__WASI_FDFLAG_NONBLOCK`**
|
|
|
|
Non-blocking mode.
|
|
|
|
- <a href="#fdflags.rsync" name="fdflags.rsync"></a>**`__WASI_FDFLAG_RSYNC`**
|
|
|
|
Synchronized read I/O operations.
|
|
|
|
- <a href="#fdflags.sync" name="fdflags.sync"></a>**`__WASI_FDFLAG_SYNC`**
|
|
|
|
Write according to synchronized I/O file integrity completion.
|
|
In addition to synchronizing the data stored in the file, the
|
|
implementation may also synchronously update the file's metadata.
|
|
|
|
### <a href="#fdstat" name="fdstat"></a>`__wasi_fdstat_t` (`struct`)
|
|
|
|
File descriptor attributes.
|
|
|
|
Used by [`__wasi_fd_fdstat_get()`](#fd_fdstat_get).
|
|
|
|
Members:
|
|
|
|
- <a href="#fdstat.fs_filetype" name="fdstat.fs_filetype"></a><code>[\_\_wasi\_filetype\_t](#filetype) <strong>fs\_filetype</strong></code>
|
|
|
|
File type.
|
|
|
|
- <a href="#fdstat.fs_flags" name="fdstat.fs_flags"></a><code>[\_\_wasi\_fdflags\_t](#fdflags) <strong>fs\_flags</strong></code>
|
|
|
|
File descriptor flags.
|
|
|
|
- <a href="#fdstat.fs_rights_base" name="fdstat.fs_rights_base"></a><code>[\_\_wasi\_rights\_t](#rights) <strong>fs\_rights\_base</strong></code>
|
|
|
|
Rights that apply to this file descriptor.
|
|
|
|
- <a href="#fdstat.fs_rights_inheriting" name="fdstat.fs_rights_inheriting"></a><code>[\_\_wasi\_rights\_t](#rights) <strong>fs\_rights\_inheriting</strong></code>
|
|
|
|
Maximum set of rights that may be installed on new
|
|
file descriptors that are created through this file
|
|
descriptor, e.g., through [`__wasi_path_open()`](#path_open).
|
|
|
|
### <a href="#filedelta" name="filedelta"></a>`__wasi_filedelta_t` (`int64_t`)
|
|
|
|
Relative offset within a file.
|
|
|
|
Used by [`__wasi_fd_seek()`](#fd_seek).
|
|
|
|
### <a href="#filesize" name="filesize"></a>`__wasi_filesize_t` (`uint64_t`)
|
|
|
|
Non-negative file size or length of a region within a file.
|
|
|
|
Used by [`__wasi_event_t`](#event), [`__wasi_filestat_t`](#filestat), [`__wasi_fd_pread()`](#fd_pread), [`__wasi_fd_pwrite()`](#fd_pwrite), [`__wasi_fd_seek()`](#fd_seek), [`__wasi_path_tell()`](#path_tell), [`__wasi_fd_advise()`](#fd_advise), [`__wasi_fd_allocate()`](#fd_allocate), and [`__wasi_fd_filestat_set_size()`](#fd_filestat_set_size).
|
|
|
|
### <a href="#filestat" name="filestat"></a>`__wasi_filestat_t` (`struct`)
|
|
|
|
File attributes.
|
|
|
|
Used by [`__wasi_fd_filestat_get()`](#fd_filestat_get) and [`__wasi_path_filestat_get()`](#path_filestat_get).
|
|
|
|
Members:
|
|
|
|
- <a href="#filestat.st_dev" name="filestat.st_dev"></a><code>[\_\_wasi\_device\_t](#device) <strong>st\_dev</strong></code>
|
|
|
|
Device ID of device containing the file.
|
|
|
|
- <a href="#filestat.st_ino" name="filestat.st_ino"></a><code>[\_\_wasi\_inode\_t](#inode) <strong>st\_ino</strong></code>
|
|
|
|
File serial number.
|
|
|
|
- <a href="#filestat.st_filetype" name="filestat.st_filetype"></a><code>[\_\_wasi\_filetype\_t](#filetype) <strong>st\_filetype</strong></code>
|
|
|
|
File type.
|
|
|
|
- <a href="#filestat.st_nlink" name="filestat.st_nlink"></a><code>[\_\_wasi\_linkcount\_t](#linkcount) <strong>st\_nlink</strong></code>
|
|
|
|
Number of hard links to the file.
|
|
|
|
- <a href="#filestat.st_size" name="filestat.st_size"></a><code>[\_\_wasi\_filesize\_t](#filesize) <strong>st\_size</strong></code>
|
|
|
|
For regular files, the file size in bytes. For
|
|
symbolic links, the length in bytes of the pathname
|
|
contained in the symbolic link.
|
|
|
|
- <a href="#filestat.st_atim" name="filestat.st_atim"></a><code>[\_\_wasi\_timestamp\_t](#timestamp) <strong>st\_atim</strong></code>
|
|
|
|
Last data access timestamp.
|
|
|
|
- <a href="#filestat.st_mtim" name="filestat.st_mtim"></a><code>[\_\_wasi\_timestamp\_t](#timestamp) <strong>st\_mtim</strong></code>
|
|
|
|
Last data modification timestamp.
|
|
|
|
- <a href="#filestat.st_ctim" name="filestat.st_ctim"></a><code>[\_\_wasi\_timestamp\_t](#timestamp) <strong>st\_ctim</strong></code>
|
|
|
|
Last file status change timestamp.
|
|
|
|
### <a href="#filetype" name="filetype"></a>`__wasi_filetype_t` (`uint8_t`)
|
|
|
|
The type of a file descriptor or file.
|
|
|
|
Used by [`__wasi_dirent_t`](#dirent), [`__wasi_fdstat_t`](#fdstat), and [`__wasi_filestat_t`](#filestat).
|
|
|
|
Possible values:
|
|
|
|
- <a href="#filetype.unknown" name="filetype.unknown"></a>**`__WASI_FILETYPE_UNKNOWN`**
|
|
|
|
The type of the file descriptor or file is unknown or
|
|
is different from any of the other types specified.
|
|
|
|
- <a href="#filetype.block_device" name="filetype.block_device"></a>**`__WASI_FILETYPE_BLOCK_DEVICE`**
|
|
|
|
The file descriptor or file refers to a block device
|
|
inode.
|
|
|
|
- <a href="#filetype.character_device" name="filetype.character_device"></a>**`__WASI_FILETYPE_CHARACTER_DEVICE`**
|
|
|
|
The file descriptor or file refers to a character
|
|
device inode.
|
|
|
|
- <a href="#filetype.directory" name="filetype.directory"></a>**`__WASI_FILETYPE_DIRECTORY`**
|
|
|
|
The file descriptor or file refers to a directory
|
|
inode.
|
|
|
|
- <a href="#filetype.regular_file" name="filetype.regular_file"></a>**`__WASI_FILETYPE_REGULAR_FILE`**
|
|
|
|
The file descriptor or file refers to a regular file
|
|
inode.
|
|
|
|
- <a href="#filetype.socket_dgram" name="filetype.socket_dgram"></a>**`__WASI_FILETYPE_SOCKET_DGRAM`**
|
|
|
|
The file descriptor or file refers to a datagram
|
|
socket.
|
|
|
|
- <a href="#filetype.socket_stream" name="filetype.socket_stream"></a>**`__WASI_FILETYPE_SOCKET_STREAM`**
|
|
|
|
The file descriptor or file refers to a byte-stream
|
|
socket.
|
|
|
|
- <a href="#filetype.symbolic_link" name="filetype.symbolic_link"></a>**`__WASI_FILETYPE_SYMBOLIC_LINK`**
|
|
|
|
The file refers to a symbolic link inode.
|
|
|
|
### <a href="#fstflags" name="fstflags"></a>`__wasi_fstflags_t` (`uint16_t` bitfield)
|
|
|
|
Which file time attributes to adjust.
|
|
|
|
Used by [`__wasi_fd_filestat_set_times()`](#fd_filestat_set_times) and [`__wasi_path_filestat_set_times()`](#path_filestat_set_times).
|
|
|
|
Possible values:
|
|
|
|
- <a href="#fstflags.atim" name="fstflags.atim"></a>**`__WASI_FILESTAT_SET_ATIM`**
|
|
|
|
Adjust the last data access timestamp to the value
|
|
stored in [`__wasi_filestat_t::st_atim`](#filestat.st_atim).
|
|
|
|
- <a href="#fstflags.atim_now" name="fstflags.atim_now"></a>**`__WASI_FILESTAT_SET_ATIM_NOW`**
|
|
|
|
Adjust the last data access timestamp to the time
|
|
of clock [`__WASI_CLOCK_REALTIME`](#clockid.realtime).
|
|
|
|
- <a href="#fstflags.mtim" name="fstflags.mtim"></a>**`__WASI_FILESTAT_SET_MTIM`**
|
|
|
|
Adjust the last data modification timestamp to the
|
|
value stored in [`__wasi_filestat_t::st_mtim`](#filestat.st_mtim).
|
|
|
|
- <a href="#fstflags.mtim_now" name="fstflags.mtim_now"></a>**`__WASI_FILESTAT_SET_MTIM_NOW`**
|
|
|
|
Adjust the last data modification timestamp to the
|
|
time of clock [`__WASI_CLOCK_REALTIME`](#clockid.realtime).
|
|
|
|
### <a href="#inode" name="inode"></a>`__wasi_inode_t` (`uint64_t`)
|
|
|
|
File serial number that is unique within its file system.
|
|
|
|
Used by [`__wasi_dirent_t`](#dirent) and [`__wasi_filestat_t`](#filestat).
|
|
|
|
### <a href="#iovec" name="iovec"></a>`__wasi_iovec_t` (`struct`)
|
|
|
|
A region of memory for scatter/gather reads.
|
|
|
|
Used by [`__wasi_fd_pread()`](#fd_pread), [`__wasi_fd_read()`](#fd_read), and [`__wasi_sock_recv()`](#sock_recv).
|
|
|
|
Members:
|
|
|
|
- <a href="#iovec.buf" name="iovec.buf"></a><code>void \*<strong>buf</strong></code> and <a href="#iovec.buf_len" name="iovec.buf_len"></a><code>size\_t <strong>buf\_len</strong></code>
|
|
|
|
The address and length of the buffer to be filled.
|
|
|
|
### <a href="#linkcount" name="linkcount"></a>`__wasi_linkcount_t` (`uint32_t`)
|
|
|
|
Number of hard links to an inode.
|
|
|
|
Used by [`__wasi_filestat_t`](#filestat).
|
|
|
|
### <a href="#lookupflags" name="lookupflags"></a>`__wasi_lookupflags_t` (`uint32_t` bitfield)
|
|
|
|
Flags determining the method of how paths are resolved.
|
|
|
|
Used by [`__wasi_path_filestat_get()`](#path_filestat_get), [`__wasi_path_filestat_set_times()`](#path_filestat_set_times), [`__wasi_path_link()`](#path_link), and [`__wasi_path_open()`](#path_open).
|
|
|
|
Possible values:
|
|
|
|
- <a href="#lookupflags.symlink_follow" name="lookupflags.symlink_follow"></a>**`__WASI_LOOKUP_SYMLINK_FOLLOW`**
|
|
|
|
As long as the resolved path corresponds to a symbolic
|
|
link, it is expanded.
|
|
|
|
### <a href="#oflags" name="oflags"></a>`__wasi_oflags_t` (`uint16_t` bitfield)
|
|
|
|
Open flags used by [`__wasi_path_open()`](#path_open).
|
|
|
|
Used by [`__wasi_path_open()`](#path_open).
|
|
|
|
Possible values:
|
|
|
|
- <a href="#oflags.creat" name="oflags.creat"></a>**`__WASI_O_CREAT`**
|
|
|
|
Create file if it does not exist.
|
|
|
|
- <a href="#oflags.directory" name="oflags.directory"></a>**`__WASI_O_DIRECTORY`**
|
|
|
|
Fail if not a directory.
|
|
|
|
- <a href="#oflags.excl" name="oflags.excl"></a>**`__WASI_O_EXCL`**
|
|
|
|
Fail if file already exists.
|
|
|
|
- <a href="#oflags.trunc" name="oflags.trunc"></a>**`__WASI_O_TRUNC`**
|
|
|
|
Truncate file to size 0.
|
|
|
|
### <a href="#riflags" name="riflags"></a>`__wasi_riflags_t` (`uint16_t` bitfield)
|
|
|
|
Flags provided to [`__wasi_sock_recv()`](#sock_recv).
|
|
|
|
Used by [`__wasi_sock_recv()`](#sock_recv).
|
|
|
|
Possible values:
|
|
|
|
- <a href="#riflags.peek" name="riflags.peek"></a>**`__WASI_SOCK_RECV_PEEK`**
|
|
|
|
Returns the message without removing it from the
|
|
socket's receive queue.
|
|
|
|
- <a href="#riflags.waitall" name="riflags.waitall"></a>**`__WASI_SOCK_RECV_WAITALL`**
|
|
|
|
On byte-stream sockets, block until the full amount
|
|
of data can be returned.
|
|
|
|
### <a href="#rights" name="rights"></a>`__wasi_rights_t` (`uint64_t` bitfield)
|
|
|
|
File descriptor rights, determining which actions may be
|
|
performed.
|
|
|
|
Used by [`__wasi_fdstat_t`](#fdstat), [`__wasi_fd_fdstat_set_rights()`](#fd_fdstat_set_rights), and [`__wasi_path_open()`](#path_open).
|
|
|
|
Possible values:
|
|
|
|
- <a href="#rights.fd_datasync" name="rights.fd_datasync"></a>**`__WASI_RIGHT_FD_DATASYNC`**
|
|
|
|
The right to invoke [`__wasi_fd_datasync()`](#fd_datasync).
|
|
|
|
If [`__WASI_RIGHT_PATH_OPEN`](#rights.path_open) is set, includes the right to
|
|
invoke [`__wasi_path_open()`](#path_open) with [`__WASI_FDFLAG_DSYNC`](#fdflags.dsync).
|
|
|
|
- <a href="#rights.fd_read" name="rights.fd_read"></a>**`__WASI_RIGHT_FD_READ`**
|
|
|
|
The right to invoke [`__wasi_fd_read()`](#fd_read) and [`__wasi_sock_recv()`](#sock_recv).
|
|
|
|
If [`__WASI_RIGHT_FD_SEEK`](#rights.fd_seek) is set, includes the right to invoke
|
|
[`__wasi_fd_pread()`](#fd_pread).
|
|
|
|
- <a href="#rights.fd_seek" name="rights.fd_seek"></a>**`__WASI_RIGHT_FD_SEEK`**
|
|
|
|
The right to invoke [`__wasi_fd_seek()`](#fd_seek). This flag implies
|
|
[`__WASI_RIGHT_FD_TELL`](#rights.fd_tell).
|
|
|
|
- <a href="#rights.fd_fdstat_set_flags" name="rights.fd_fdstat_set_flags"></a>**`__WASI_RIGHT_FD_FDSTAT_SET_FLAGS`**
|
|
|
|
The right to invoke [`__wasi_fd_fdstat_set_flags()`](#fd_fdstat_set_flags).
|
|
|
|
- <a href="#rights.fd_sync" name="rights.fd_sync"></a>**`__WASI_RIGHT_FD_SYNC`**
|
|
|
|
The right to invoke [`__wasi_fd_sync()`](#fd_sync).
|
|
|
|
If [`__WASI_RIGHT_PATH_OPEN`](#rights.path_open) is set, includes the right to
|
|
invoke [`__wasi_path_open()`](#path_open) with [`__WASI_FDFLAG_RSYNC`](#fdflags.rsync) and
|
|
[`__WASI_FDFLAG_DSYNC`](#fdflags.dsync).
|
|
|
|
- <a href="#rights.fd_tell" name="rights.fd_tell"></a>**`__WASI_RIGHT_FD_TELL`**
|
|
|
|
The right to invoke [`__wasi_fd_seek()`](#fd_seek) in such a way that the
|
|
file offset remains unaltered (i.e., [`__WASI_WHENCE_CUR`](#whence.cur) with
|
|
offset zero), or to invoke [`__wasi_fd_tell()`](#fd_tell).
|
|
|
|
- <a href="#rights.fd_write" name="rights.fd_write"></a>**`__WASI_RIGHT_FD_WRITE`**
|
|
|
|
The right to invoke [`__wasi_fd_write()`](#fd_write) and [`__wasi_sock_send()`](#sock_send).
|
|
|
|
If [`__WASI_RIGHT_FD_SEEK`](#rights.fd_seek) is set, includes the right to
|
|
invoke [`__wasi_fd_pwrite()`](#fd_pwrite).
|
|
|
|
- <a href="#rights.fd_advise" name="rights.fd_advise"></a>**`__WASI_RIGHT_FD_ADVISE`**
|
|
|
|
The right to invoke [`__wasi_fd_advise()`](#fd_advise).
|
|
|
|
- <a href="#rights.fd_allocate" name="rights.fd_allocate"></a>**`__WASI_RIGHT_FD_ALLOCATE`**
|
|
|
|
The right to invoke [`__wasi_fd_allocate()`](#fd_allocate).
|
|
|
|
- <a href="#rights.path_create_directory" name="rights.path_create_directory"></a>**`__WASI_RIGHT_PATH_CREATE_DIRECTORY`**
|
|
|
|
The right to invoke [`__wasi_path_create_directory()`](#path_create_directory).
|
|
|
|
- <a href="#rights.path_create_file" name="rights.path_create_file"></a>**`__WASI_RIGHT_PATH_CREATE_FILE`**
|
|
|
|
If [`__WASI_RIGHT_PATH_OPEN`](#rights.path_open) is set, the right to invoke
|
|
[`__wasi_path_open()`](#path_open) with [`__WASI_O_CREAT`](#oflags.creat).
|
|
|
|
- <a href="#rights.path_link_source" name="rights.path_link_source"></a>**`__WASI_RIGHT_PATH_LINK_SOURCE`**
|
|
|
|
The right to invoke [`__wasi_path_link()`](#path_link) with the file
|
|
descriptor as the source directory.
|
|
|
|
- <a href="#rights.path_link_target" name="rights.path_link_target"></a>**`__WASI_RIGHT_PATH_LINK_TARGET`**
|
|
|
|
The right to invoke [`__wasi_path_link()`](#path_link) with the file
|
|
descriptor as the target directory.
|
|
|
|
- <a href="#rights.path_open" name="rights.path_open"></a>**`__WASI_RIGHT_PATH_OPEN`**
|
|
|
|
The right to invoke [`__wasi_path_open()`](#path_open).
|
|
|
|
- <a href="#rights.fd_readdir" name="rights.fd_readdir"></a>**`__WASI_RIGHT_FD_READDIR`**
|
|
|
|
The right to invoke [`__wasi_fd_readdir()`](#fd_readdir).
|
|
|
|
- <a href="#rights.path_readlink" name="rights.path_readlink"></a>**`__WASI_RIGHT_PATH_READLINK`**
|
|
|
|
The right to invoke [`__wasi_path_readlink()`](#path_readlink).
|
|
|
|
- <a href="#rights.path_rename_source" name="rights.path_rename_source"></a>**`__WASI_RIGHT_PATH_RENAME_SOURCE`**
|
|
|
|
The right to invoke [`__wasi_path_rename()`](#path_rename) with the file
|
|
descriptor as the source directory.
|
|
|
|
- <a href="#rights.path_rename_target" name="rights.path_rename_target"></a>**`__WASI_RIGHT_PATH_RENAME_TARGET`**
|
|
|
|
The right to invoke [`__wasi_path_rename()`](#path_rename) with the file
|
|
descriptor as the target directory.
|
|
|
|
- <a href="#rights.path_filestat_get" name="rights.path_filestat_get"></a>**`__WASI_RIGHT_PATH_FILESTAT_GET`**
|
|
|
|
The right to invoke [`__wasi_path_filestat_get()`](#path_filestat_get).
|
|
|
|
- <a href="#rights.path_filestat_set_size" name="rights.path_filestat_set_size"></a>**`__WASI_RIGHT_PATH_FILESTAT_SET_SIZE`**
|
|
|
|
The right to change a file's size (there is no `__wasi_path_filestat_set_size()`).
|
|
|
|
If [`__WASI_RIGHT_PATH_OPEN`](#rights.path_open) is set, includes the right to
|
|
invoke [`__wasi_path_open()`](#path_open) with [`__WASI_O_TRUNC`](#oflags.trunc).
|
|
|
|
- <a href="#rights.path_filestat_set_times" name="rights.path_filestat_set_times"></a>**`__WASI_RIGHT_PATH_FILESTAT_SET_TIMES`**
|
|
|
|
The right to invoke [`__wasi_path_filestat_set_times()`](#path_filestat_set_times).
|
|
|
|
- <a href="#rights.fd_filestat_get" name="rights.fd_filestat_get"></a>**`__WASI_RIGHT_FD_FILESTAT_GET`**
|
|
|
|
The right to invoke [`__wasi_fd_filestat_get()`](#fd_filestat_get).
|
|
|
|
- <a href="#rights.fd_filestat_set_size" name="rights.fd_filestat_set_size"></a>**`__WASI_RIGHT_FD_FILESTAT_SET_SIZE`**
|
|
|
|
The right to invoke [`__wasi_fd_filestat_set_size()`](#fd_filestat_set_size).
|
|
|
|
- <a href="#rights.fd_filestat_set_times" name="rights.fd_filestat_set_times"></a>**`__WASI_RIGHT_FD_FILESTAT_SET_TIMES`**
|
|
|
|
The right to invoke [`__wasi_fd_filestat_set_times()`](#fd_filestat_set_times).
|
|
|
|
- <a href="#rights.path_symlink" name="rights.path_symlink"></a>**`__WASI_RIGHT_PATH_SYMLINK`**
|
|
|
|
The right to invoke [`__wasi_path_symlink()`](#path_symlink).
|
|
|
|
- <a href="#rights.path_unlink_file" name="rights.path_unlink_file"></a>**`__WASI_RIGHT_PATH_UNLINK_FILE`**
|
|
|
|
The right to invoke [`__wasi_path_unlink_file()`](#path_unlink_file).
|
|
|
|
- <a href="#rights.path_remove_directory" name="rights.path_remove_directory"></a>**`__WASI_RIGHT_PATH_REMOVE_DIRECTORY`**
|
|
|
|
The right to invoke [`__wasi_path_remove_directory()`](#path_remove_directory).
|
|
|
|
- <a href="#rights.poll_fd_readwrite" name="rights.poll_fd_readwrite"></a>**`__WASI_RIGHT_POLL_FD_READWRITE`**
|
|
|
|
If [`__WASI_RIGHT_FD_READ`](#rights.fd_read) is set, includes the right to
|
|
invoke [`__wasi_poll_oneoff()`](#poll_oneoff) to subscribe to [`__WASI_EVENTTYPE_FD_READ`](#eventtype.fd_read).
|
|
|
|
If [`__WASI_RIGHT_FD_WRITE`](#rights.fd_write) is set, includes the right to
|
|
invoke [`__wasi_poll_oneoff()`](#poll_oneoff) to subscribe to [`__WASI_EVENTTYPE_FD_WRITE`](#eventtype.fd_write).
|
|
|
|
- <a href="#rights.sock_shutdown" name="rights.sock_shutdown"></a>**`__WASI_RIGHT_SOCK_SHUTDOWN`**
|
|
|
|
The right to invoke [`__wasi_sock_shutdown()`](#sock_shutdown).
|
|
|
|
### <a href="#roflags" name="roflags"></a>`__wasi_roflags_t` (`uint16_t` bitfield)
|
|
|
|
Flags returned by [`__wasi_sock_recv()`](#sock_recv).
|
|
|
|
Used by [`__wasi_sock_recv()`](#sock_recv).
|
|
|
|
Possible values:
|
|
|
|
- <a href="#roflags.data_truncated" name="roflags.data_truncated"></a>**`__WASI_SOCK_RECV_DATA_TRUNCATED`**
|
|
|
|
Returned by [`__wasi_sock_recv()`](#sock_recv): Message data has been
|
|
truncated.
|
|
|
|
### <a href="#sdflags" name="sdflags"></a>`__wasi_sdflags_t` (`uint8_t` bitfield)
|
|
|
|
Which channels on a socket to shut down.
|
|
|
|
Used by [`__wasi_sock_shutdown()`](#sock_shutdown).
|
|
|
|
Possible values:
|
|
|
|
- <a href="#sdflags.rd" name="sdflags.rd"></a>**`__WASI_SHUT_RD`**
|
|
|
|
Disables further receive operations.
|
|
|
|
- <a href="#sdflags.wr" name="sdflags.wr"></a>**`__WASI_SHUT_WR`**
|
|
|
|
Disables further send operations.
|
|
|
|
### <a href="#siflags" name="siflags"></a>`__wasi_siflags_t` (`uint16_t` bitfield)
|
|
|
|
Flags provided to [`__wasi_sock_send()`](#sock_send). As there are currently no flags
|
|
defined, it must be set to zero.
|
|
|
|
Used by [`__wasi_sock_send()`](#sock_send).
|
|
|
|
### <a href="#signal" name="signal"></a>`__wasi_signal_t` (`uint8_t`)
|
|
|
|
Signal condition.
|
|
|
|
Used by [`__wasi_proc_raise()`](#proc_raise).
|
|
|
|
Possible values:
|
|
|
|
- <a href="#signal.abrt" name="signal.abrt"></a>**`__WASI_SIGABRT`**
|
|
|
|
Process abort signal.
|
|
|
|
Action: Terminates the process.
|
|
|
|
- <a href="#signal.alrm" name="signal.alrm"></a>**`__WASI_SIGALRM`**
|
|
|
|
Alarm clock.
|
|
|
|
Action: Terminates the process.
|
|
|
|
- <a href="#signal.bus" name="signal.bus"></a>**`__WASI_SIGBUS`**
|
|
|
|
Access to an undefined portion of a memory object.
|
|
|
|
Action: Terminates the process.
|
|
|
|
- <a href="#signal.chld" name="signal.chld"></a>**`__WASI_SIGCHLD`**
|
|
|
|
Child process terminated, stopped, or continued.
|
|
|
|
Action: Ignored.
|
|
|
|
- <a href="#signal.cont" name="signal.cont"></a>**`__WASI_SIGCONT`**
|
|
|
|
Continue executing, if stopped.
|
|
|
|
Action: Continues executing, if stopped.
|
|
|
|
- <a href="#signal.fpe" name="signal.fpe"></a>**`__WASI_SIGFPE`**
|
|
|
|
Erroneous arithmetic operation.
|
|
|
|
Action: Terminates the process.
|
|
|
|
- <a href="#signal.hup" name="signal.hup"></a>**`__WASI_SIGHUP`**
|
|
|
|
Hangup.
|
|
|
|
Action: Terminates the process.
|
|
|
|
- <a href="#signal.ill" name="signal.ill"></a>**`__WASI_SIGILL`**
|
|
|
|
Illegal instruction.
|
|
|
|
Action: Terminates the process.
|
|
|
|
- <a href="#signal.int" name="signal.int"></a>**`__WASI_SIGINT`**
|
|
|
|
Terminate interrupt signal.
|
|
|
|
Action: Terminates the process.
|
|
|
|
- <a href="#signal.kill" name="signal.kill"></a>**`__WASI_SIGKILL`**
|
|
|
|
Kill.
|
|
|
|
Action: Terminates the process.
|
|
|
|
- <a href="#signal.pipe" name="signal.pipe"></a>**`__WASI_SIGPIPE`**
|
|
|
|
Write on a pipe with no one to read it.
|
|
|
|
Action: Ignored.
|
|
|
|
- <a href="#signal.quit" name="signal.quit"></a>**`__WASI_SIGQUIT`**
|
|
|
|
Terminal quit signal.
|
|
|
|
Action: Terminates the process.
|
|
|
|
- <a href="#signal.segv" name="signal.segv"></a>**`__WASI_SIGSEGV`**
|
|
|
|
Invalid memory reference.
|
|
|
|
Action: Terminates the process.
|
|
|
|
- <a href="#signal.stop" name="signal.stop"></a>**`__WASI_SIGSTOP`**
|
|
|
|
Stop executing.
|
|
|
|
Action: Stops executing.
|
|
|
|
- <a href="#signal.sys" name="signal.sys"></a>**`__WASI_SIGSYS`**
|
|
|
|
Bad system call.
|
|
|
|
Action: Terminates the process.
|
|
|
|
- <a href="#signal.term" name="signal.term"></a>**`__WASI_SIGTERM`**
|
|
|
|
Termination signal.
|
|
|
|
Action: Terminates the process.
|
|
|
|
- <a href="#signal.trap" name="signal.trap"></a>**`__WASI_SIGTRAP`**
|
|
|
|
Trace/breakpoint trap.
|
|
|
|
Action: Terminates the process.
|
|
|
|
- <a href="#signal.tstp" name="signal.tstp"></a>**`__WASI_SIGTSTP`**
|
|
|
|
Terminal stop signal.
|
|
|
|
Action: Stops executing.
|
|
|
|
- <a href="#signal.ttin" name="signal.ttin"></a>**`__WASI_SIGTTIN`**
|
|
|
|
Background process attempting read.
|
|
|
|
Action: Stops executing.
|
|
|
|
- <a href="#signal.ttou" name="signal.ttou"></a>**`__WASI_SIGTTOU`**
|
|
|
|
Background process attempting write.
|
|
|
|
Action: Stops executing.
|
|
|
|
- <a href="#signal.urg" name="signal.urg"></a>**`__WASI_SIGURG`**
|
|
|
|
High bandwidth data is available at a socket.
|
|
|
|
Action: Ignored.
|
|
|
|
- <a href="#signal.usr1" name="signal.usr1"></a>**`__WASI_SIGUSR1`**
|
|
|
|
User-defined signal 1.
|
|
|
|
Action: Terminates the process.
|
|
|
|
- <a href="#signal.usr2" name="signal.usr2"></a>**`__WASI_SIGUSR2`**
|
|
|
|
User-defined signal 2.
|
|
|
|
Action: Terminates the process.
|
|
|
|
- <a href="#signal.vtalrm" name="signal.vtalrm"></a>**`__WASI_SIGVTALRM`**
|
|
|
|
Virtual timer expired.
|
|
|
|
Action: Terminates the process.
|
|
|
|
- <a href="#signal.xcpu" name="signal.xcpu"></a>**`__WASI_SIGXCPU`**
|
|
|
|
CPU time limit exceeded.
|
|
|
|
Action: Terminates the process.
|
|
|
|
- <a href="#signal.xfsz" name="signal.xfsz"></a>**`__WASI_SIGXFSZ`**
|
|
|
|
File size limit exceeded.
|
|
|
|
Action: Terminates the process.
|
|
|
|
### <a href="#subclockflags" name="subclockflags"></a>`__wasi_subclockflags_t` (`uint16_t` bitfield)
|
|
|
|
Flags determining how to interpret the timestamp provided in
|
|
[`__wasi_subscription_t::u.clock.timeout`](#subscription.u.clock.timeout).
|
|
|
|
Used by [`__wasi_subscription_t`](#subscription).
|
|
|
|
Possible values:
|
|
|
|
- <a href="#subclockflags.abstime" name="subclockflags.abstime"></a>**`__WASI_SUBSCRIPTION_CLOCK_ABSTIME`**
|
|
|
|
If set, treat the timestamp provided in
|
|
[`__wasi_subscription_t::u.clock.timeout`](#subscription.u.clock.timeout) as an absolute timestamp
|
|
of clock [`__wasi_subscription_t::u.clock.clock_id`](#subscription.u.clock.clock_id).
|
|
|
|
If clear, treat the timestamp provided in
|
|
[`__wasi_subscription_t::u.clock.timeout`](#subscription.u.clock.timeout) relative to the current
|
|
time value of clock [`__wasi_subscription_t::u.clock.clock_id`](#subscription.u.clock.clock_id).
|
|
|
|
### <a href="#subscription" name="subscription"></a>`__wasi_subscription_t` (`struct`)
|
|
|
|
Subscription to an event.
|
|
|
|
Used by [`__wasi_poll_oneoff()`](#poll_oneoff).
|
|
|
|
Members:
|
|
|
|
- <a href="#subscription.userdata" name="subscription.userdata"></a><code>[\_\_wasi\_userdata\_t](#userdata) <strong>userdata</strong></code>
|
|
|
|
User-provided value that is attached to the subscription in the
|
|
implementation and returned through
|
|
[`__wasi_event_t::userdata`](#event.userdata).
|
|
|
|
- <a href="#subscription.type" name="subscription.type"></a><code>[\_\_wasi\_eventtype\_t](#eventtype) <strong>type</strong></code>
|
|
|
|
The type of the event to which to subscribe.
|
|
|
|
- When `type` is [`__WASI_EVENTTYPE_CLOCK`](#eventtype.u.clock):
|
|
|
|
- <a href="#subscription.u.clock" name="subscription.u.clock"></a>**`u.clock`**
|
|
|
|
- <a href="#subscription.u.clock.identifier" name="subscription.u.clock.identifier"></a><code>[\_\_wasi\_userdata\_t](#userdata) <strong>identifier</strong></code>
|
|
|
|
The user-defined unique identifier of the clock.
|
|
|
|
- <a href="#subscription.u.clock.clock_id" name="subscription.u.clock.clock_id"></a><code>[\_\_wasi\_clockid\_t](#clockid) <strong>clock\_id</strong></code>
|
|
|
|
The clock against which to compare the timestamp.
|
|
|
|
- <a href="#subscription.u.clock.timeout" name="subscription.u.clock.timeout"></a><code>[\_\_wasi\_timestamp\_t](#timestamp) <strong>timeout</strong></code>
|
|
|
|
The absolute or relative timestamp.
|
|
|
|
- <a href="#subscription.u.clock.precision" name="subscription.u.clock.precision"></a><code>[\_\_wasi\_timestamp\_t](#timestamp) <strong>precision</strong></code>
|
|
|
|
The amount of time that the implementation may wait additionally
|
|
to coalesce with other events.
|
|
|
|
- <a href="#subscription.u.clock.flags" name="subscription.u.clock.flags"></a><code>[\_\_wasi\_subclockflags\_t](#subclockflags) <strong>flags</strong></code>
|
|
|
|
Flags specifying whether the timeout is absolute or relative.
|
|
|
|
- When `type` is [`__WASI_EVENTTYPE_FD_READ`](#eventtype.fd_read) or [`__WASI_EVENTTYPE_FD_WRITE`](#eventtype.fd_write):
|
|
|
|
- <a href="#subscription.u.fd_readwrite" name="subscription.u.fd_readwrite"></a>**`u.fd_readwrite`**
|
|
|
|
- <a href="#subscription.u.fd_readwrite.fd" name="subscription.u.fd_readwrite.fd"></a><code>[\_\_wasi\_fd\_t](#fd) <strong>fd</strong></code>
|
|
|
|
The file descriptor on which to wait for it to become ready
|
|
for reading or writing.
|
|
|
|
### <a href="#timestamp" name="timestamp"></a>`__wasi_timestamp_t` (`uint64_t`)
|
|
|
|
Timestamp in nanoseconds.
|
|
|
|
Used by [`__wasi_filestat_t`](#filestat), [`__wasi_subscription_t`](#subscription), [`__wasi_clock_res_get()`](#clock_res_get), [`__wasi_clock_time_get()`](#clock_time_get), [`__wasi_fd_filestat_set_times()`](#fd_filestat_set_times), and [`__wasi_path_filestat_set_times()`](#path_filestat_set_times).
|
|
|
|
### <a href="#userdata" name="userdata"></a>`__wasi_userdata_t` (`uint64_t`)
|
|
|
|
User-provided value that may be attached to objects that is
|
|
retained when extracted from the implementation.
|
|
|
|
Used by [`__wasi_event_t`](#event) and [`__wasi_subscription_t`](#subscription).
|
|
|
|
### <a href="#whence" name="whence"></a>`__wasi_whence_t` (`uint8_t`)
|
|
|
|
The position relative to which to set the offset of the file descriptor.
|
|
|
|
Used by [`__wasi_fd_seek()`](#fd_seek).
|
|
|
|
Possible values:
|
|
|
|
- <a href="#whence.cur" name="whence.cur"></a>**`__WASI_WHENCE_CUR`**
|
|
|
|
Seek relative to current position.
|
|
|
|
- <a href="#whence.end" name="whence.end"></a>**`__WASI_WHENCE_END`**
|
|
|
|
Seek relative to end-of-file.
|
|
|
|
- <a href="#whence.set" name="whence.set"></a>**`__WASI_WHENCE_SET`**
|
|
|
|
Seek relative to start-of-file.
|
|
|