This project does not currently provide the comprehensive file system security
properties provided by some WASI runtimes. Full support for secure file system sandboxing
may or may not be implemented in future. In the mean time, do not rely on it to run untrusted code.
uvwasi implements the WASI system call API, so that WebAssembly
runtimes can easily implement WASI calls. Under the hood, uvwasi
leverages libuv where possible for maximum portability.
|
WebAssembly code | WebAssembly application code
| |
| v
| WASI syscalls (inserted by compiler toolchain)
| |
------------------------------+ |
| v
WebAssembly runtime (Node.js) | uvwasi (implementation of WASI)
| |
| v
| libuv
| |
| v
| platform-specific calls
|
(Hence uvwasi isn’t for making C-programs-that-use-libuv-APIs execute on
WASI runtimes. That would either be a new platform added by libuv, or done
through POSIX emulation by the Emscripten or wasi-sdk toolchains.)
The WASI API is versioned. This documentation is based on the WASI preview 1
snapshot. uvwasi implements the WASI system call API with the following
additions/modifications:
Each system call takes an additional uvwasi_t* as its first argument. The
uvwasi_t is the sandbox under which system calls are issued. Each uvwasi_t
can have different command line arguments, environment variables, preopened
directories, file descriptor mappings, etc. This allows one controlling
process to host multiple WASI applications simultaneously.
Each system call returns a uvwasi_errno_t. This appears to be expected of
WASI system calls, but it is not explicitly part of the official API docs.
This detail is explicitly documented here.
Additional functions and data types are provided for interacting with WASI
sandboxes and the uvwasi library. These APIs are documented in the
Unofficial APIs section below.
Unofficial APIs
This section contains data types and functions for working with uvwasi. They
are not part of the official WASI API, but are used to embed uvwasi.
UVWASI_VERSION_MAJOR
The major release version of the uvwasi library. uvwasi follows semantic
versioning. Changes to this value represent breaking changes in the public API.
UVWASI_VERSION_MINOR
The minor release version of the uvwasi library. uvwasi follows semantic
versioning. Changes to this value represent feature additions in the public API.
UVWASI_VERSION_PATCH
The patch release version of the uvwasi library. uvwasi follows semantic
versioning. Changes to this value represent bug fixes in the public API.
UVWASI_VERSION_HEX
The major, minor, and patch versions of the uvwasi library encoded as a single
integer value.
UVWASI_VERSION_STRING
The major, minor, and patch versions of the uvwasi library encoded as a
version string.
List of scatter/gather vectors to which to store data.
Outputs:
__wasi_size_t nread
The number of bytes read.
uvwasi_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 uvwasi_dirent_t object, followed by uvwasi_dirent_t::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.
The location within the directory to start
reading.
Outputs:
__wasi_size_t bufused
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.
uvwasi_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.
The working directory at which the resolution of the new path starts.
const char *new_path and __wasi_size_t new_path_len
The destination path at which to create the hard link.
uvwasi_path_open()
Open a file or directory.
The returned file descriptor is not guaranteed to be the lowest-numbered
file descriptor not currently open; it is randomized to prevent
applications from depending on making assumptions about indexes, since
this is error-prone in multi-threaded contexts. The returned file
descriptor is guaranteed to be less than 231.
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.
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.
This function blocks when the implementation is unable to immediately
provide sufficient high-quality random data.
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:
void *buf and __wasi_size_t buf_len
The buffer to fill with random data.
uvwasi_sched_yield()
Temporarily yield execution of the calling thread.
Note: This is similar to sched_yield in POSIX.
uvwasi_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.
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.
UVWASI_CLOCK_PROCESS_CPUTIME_ID
The CPU-time clock associated with the current
process.
UVWASI_CLOCK_REALTIME
The clock measuring real time. Time value
zero corresponds with 1970-01-01T00:00:00Z.
UVWASI_CLOCK_THREAD_CPUTIME_ID
The CPU-time clock associated with the current thread.
uvwasi_device_t (uint64_t)
Identifier for a device containing a file system. Can be used
in combination with uvwasi_inode_t to uniquely identify a file or
directory in the filesystem.
The type of the file referred to by this directory
entry.
uvwasi_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.
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.
Append mode: Data written to the file is always
appended to the file’s end.
UVWASI_FDFLAG_DSYNC
Write according to synchronized I/O data integrity
completion. Only the data stored in the file is
synchronized.
UVWASI_FDFLAG_NONBLOCK
Non-blocking mode.
UVWASI_FDFLAG_RSYNC
Synchronized read I/O operations.
UVWASI_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.
Put together a list of notable changes.
See https://github.com/nodejs/uvwasi/releases/tag/v0.0.14
or any of the other releases for example. Use that list in the release commit,
the GitHub release, and the PR to update uvwasi in Node.js (or any other
projects where you update it)
PR the release commit. Once it lands, create a GitHub release with
the same notable changes. When doing the GitHub release you will need to select
Choose a tag and type in the new tag. That should result in
Create new tag: vX.Y.Z on publish where vX.Y.Z matches the tag you specified.
Update uvwasi in Node.js or any projects you want to update - there are several
other projects that use uvwasi.
Running fuzzers locally
We support fuzzing by way of ClusterFuzzLite,
which is run automatically against pull requests. You can run these fuzzers
locally with the OSS-Fuzz fuzzing
infrastructure, using the following steps:
git clone https://github.com/google/oss-fuzz
git clone https://github.com/nodejs/uvwasi
cd uvwasi
# Build the fuzzers in .clusterfuzzlite
python3 ../oss-fuzz/infra/helper.py build_fuzzers --external $PWD
# Run the fuzzer for 10 seconds
python3 ../oss-fuzz/infra/helper.py run_fuzzer --external $PWD fuzz_normalize_path -- -max_total_time=10
uvwasi
This project does not currently provide the comprehensive file system security properties provided by some WASI runtimes. Full support for secure file system sandboxing may or may not be implemented in future. In the mean time, do not rely on it to run untrusted code.
uvwasiimplements the WASI system call API, so that WebAssembly runtimes can easily implement WASI calls. Under the hood,uvwasileverages libuv where possible for maximum portability.(Hence uvwasi isn’t for making C-programs-that-use-libuv-APIs execute on WASI runtimes. That would either be a new platform added by libuv, or done through POSIX emulation by the Emscripten or wasi-sdk toolchains.)
Building Locally
To build with CMake:
Example Usage
API
The WASI API is versioned. This documentation is based on the WASI preview 1 snapshot.
uvwasiimplements the WASI system call API with the following additions/modifications:uvwasi_t*as its first argument. Theuvwasi_tis the sandbox under which system calls are issued. Eachuvwasi_tcan have different command line arguments, environment variables, preopened directories, file descriptor mappings, etc. This allows one controlling process to host multiple WASI applications simultaneously.uvwasi_errno_t. This appears to be expected of WASI system calls, but it is not explicitly part of the official API docs. This detail is explicitly documented here.uvwasilibrary. These APIs are documented in the Unofficial APIs section below.Unofficial APIs
This section contains data types and functions for working with
uvwasi. They are not part of the official WASI API, but are used to embeduvwasi.UVWASI_VERSION_MAJORThe major release version of the
uvwasilibrary.uvwasifollows semantic versioning. Changes to this value represent breaking changes in the public API.UVWASI_VERSION_MINORThe minor release version of the
uvwasilibrary.uvwasifollows semantic versioning. Changes to this value represent feature additions in the public API.UVWASI_VERSION_PATCHThe patch release version of the
uvwasilibrary.uvwasifollows semantic versioning. Changes to this value represent bug fixes in the public API.UVWASI_VERSION_HEXThe major, minor, and patch versions of the
uvwasilibrary encoded as a single integer value.UVWASI_VERSION_STRINGThe major, minor, and patch versions of the
uvwasilibrary encoded as a version string.UVWASI_VERSION_WASIThe version of the WASI API targeted by
uvwasi.uvwasi_tAn individual WASI sandbox instance.
uvwasi_preopen_tA data structure used to map a directory path within a WASI sandbox to a directory path on the WASI host platform.
uvwasi_options_tA data structure used to pass configuration options to
uvwasi_init().uvwasi_init()Initializes a sandbox represented by a
uvwasi_tusing the options represented by auvwasi_options_t.Inputs:
__wasi_t uvwasiThe sandbox to initialize.
__wasi_options_t optionsConfiguration options used when initializing the sandbox.
Outputs:
Returns:
__wasi_errno_t errnoA WASI errno.
uvwasi_destroy()Cleans up resources related to a WASI sandbox. This function notably does not return an error code.
Inputs:
__wasi_t uvwasiThe sandbox to clean up.
Outputs:
Returns:
System Calls
This section has been adapted from the official WASI API documentation.
uvwasi_args_get()uvwasi_args_sizes_get()uvwasi_clock_res_get()uvwasi_clock_time_get()uvwasi_environ_get()uvwasi_environ_sizes_get()uvwasi_fd_advise()uvwasi_fd_allocate()uvwasi_fd_close()uvwasi_fd_datasync()uvwasi_fd_fdstat_get()uvwasi_fd_fdstat_set_flags()uvwasi_fd_fdstat_set_rights()uvwasi_fd_filestat_get()uvwasi_fd_filestat_set_size()uvwasi_fd_filestat_set_times()uvwasi_fd_pread()uvwasi_fd_prestat_get()uvwasi_fd_prestat_dir_name()uvwasi_fd_pwrite()uvwasi_fd_read()uvwasi_fd_readdir()uvwasi_fd_renumber()uvwasi_fd_seek()uvwasi_fd_sync()uvwasi_fd_tell()uvwasi_fd_write()uvwasi_path_create_directory()uvwasi_path_filestat_get()uvwasi_path_filestat_set_times()uvwasi_path_link()uvwasi_path_open()uvwasi_path_readlink()uvwasi_path_remove_directory()uvwasi_path_rename()uvwasi_path_symlink()uvwasi_path_unlink_file()uvwasi_poll_oneoff()uvwasi_proc_exit()uvwasi_proc_raise()uvwasi_random_get()uvwasi_sched_yield()uvwasi_sock_recv()uvwasi_sock_send()uvwasi_sock_shutdown()uvwasi_args_get()Read command-line argument data.
The sizes of the buffers should match that returned by
uvwasi_args_sizes_get().Inputs:
char **argvA pointer to a buffer to write the argument pointers.
char *argv_bufA pointer to a buffer to write the argument string data.
uvwasi_args_sizes_get()Return command-line argument data sizes.
Outputs:
__wasi_size_t *argcThe number of arguments.
__wasi_size_t *argv_buf_sizeThe size of the argument string data.
uvwasi_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
UVWASI_EINVAL.Note: This is similar to
clock_getresin POSIX.Inputs:
__wasi_clockid_t clock_idThe clock for which to return the resolution.
Outputs:
__wasi_timestamp_t resolutionThe resolution of the clock.
uvwasi_clock_time_get()Return the time value of a clock.
Note: This is similar to
clock_gettimein POSIX.Inputs:
__wasi_clockid_t clock_idThe clock for which to return the time.
__wasi_timestamp_t precisionThe maximum lag (exclusive) that the returned time value may have, compared to its actual value.
Outputs:
__wasi_timestamp_t timeThe time value of the clock.
uvwasi_environ_get()Read environment variable data.
The sizes of the buffers should match that returned by
uvwasi_environ_sizes_get().Inputs:
char **environA pointer to a buffer to write the environment variable pointers.
char *environ_bufA pointer to a buffer to write the environment variable string data.
uvwasi_environ_sizes_get()Return command-line argument data sizes.
Outputs:
__wasi_size_t *environ_countThe number of environment variables.
__wasi_size_t *environ_buf_sizeThe size of the environment variable string data.
uvwasi_fd_advise()Provide file advisory information on a file descriptor.
Note: This is similar to
posix_fadvisein POSIX.Inputs:
__wasi_fd_t fdThe file descriptor for the file for which to provide file advisory information.
__wasi_filesize_t offsetThe offset within the file to which the advisory applies.
__wasi_filesize_t lenThe length of the region to which the advisory applies.
__wasi_advice_t adviceThe advice.
uvwasi_fd_allocate()Force the allocation of space in a file.
Note: This is similar to
posix_fallocatein POSIX.Inputs:
__wasi_fd_t fdThe file descriptor for the file in which to allocate space.
__wasi_filesize_t offsetThe offset at which to start the allocation.
__wasi_filesize_t lenThe length of the area that is allocated.
uvwasi_fd_close()Close a file descriptor.
Note: This is similar to
closein POSIX.Inputs:
__wasi_fd_t fdThe file descriptor to close.
uvwasi_fd_datasync()Synchronize the data of a file to disk.
Note: This is similar to
fdatasyncin POSIX.Inputs:
__wasi_fd_t fdThe file descriptor of the file to synchronize to disk.
uvwasi_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:
__wasi_fd_t fdThe file descriptor to inspect.
__wasi_fdstat_t *bufThe buffer where the file descriptor’s attributes are stored.
uvwasi_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:
__wasi_fd_t fdThe file descriptor to operate on.
__wasi_fdflags_t flagsThe desired values of the file descriptor flags.
uvwasi_fd_fdstat_set_rights()Adjust the rights associated with a file descriptor.
This can only be used to remove rights, and returns
UVWASI_ENOTCAPABLEif called in a way that would attempt to add rights.Inputs:
__wasi_fd_t fdThe file descriptor to operate on.
__wasi_rights_t fs_rights_baseand__wasi_rights_t fs_rights_inheritingThe desired rights of the file descriptor.
uvwasi_fd_filestat_get()Return the attributes of an open file.
Inputs:
__wasi_fd_t fdThe file descriptor to inspect.
__wasi_filestat_t *bufThe buffer where the file’s attributes are stored.
uvwasi_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
ftruncatein POSIX.Inputs:
__wasi_fd_t fdA file descriptor for the file to adjust.
__wasi_filesize_t st_sizeThe desired file size.
uvwasi_fd_filestat_set_times()Adjust the timestamps of an open file or directory.
Note: This is similar to
futimensin POSIX.Inputs:
__wasi_fd_t fdThe file descriptor to operate on.
__wasi_timestamp_t st_atimThe desired values of the data access timestamp.
__wasi_timestamp_t st_mtimThe desired values of the data modification timestamp.
__wasi_fstflags_t fst_flagsA bitmask indicating which timestamps to adjust.
uvwasi_fd_pread()Read from a file descriptor, without using and updating the file descriptor’s offset.
Note: This is similar to
preadvin POSIX.Inputs:
__wasi_fd_t fdThe file descriptor from which to read data.
const __wasi_iovec_t *iovsand__wasi_size_t iovs_lenList of scatter/gather vectors in which to store data.
__wasi_filesize_t offsetThe offset within the file at which to read.
Outputs:
__wasi_size_t nreadThe number of bytes read.
uvwasi_fd_prestat_get()Return a description of the given preopened file descriptor.
Inputs:
__wasi_fd_t fdThe file descriptor about which to retrieve information.
__wasi_prestat_t *bufThe buffer where the description is stored.
uvwasi_fd_prestat_dir_name()Return a description of the given preopened file descriptor.
Inputs:
__wasi_fd_t fdThe file descriptor about which to retrieve information.
const char *pathand__wasi_size_t path_lenA buffer into which to write the preopened directory name.
uvwasi_fd_pwrite()Write to a file descriptor, without using and updating the file descriptor’s offset.
Note: This is similar to
pwritevin POSIX.Inputs:
__wasi_fd_t fdThe file descriptor to which to write data.
const __wasi_ciovec_t *iovsand__wasi_size_t iovs_lenList of scatter/gather vectors from which to retrieve data.
__wasi_filesize_t offsetThe offset within the file at which to write.
Outputs:
__wasi_size_t nwrittenThe number of bytes written.
uvwasi_fd_read()Read from a file descriptor.
Note: This is similar to
readvin POSIX.Inputs:
__wasi_fd_t fdThe file descriptor from which to read data.
const __wasi_iovec_t *iovsand__wasi_size_t iovs_lenList of scatter/gather vectors to which to store data.
Outputs:
__wasi_size_t nreadThe number of bytes read.
uvwasi_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
uvwasi_dirent_tobject, followed byuvwasi_dirent_t::d_namlenbytes 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:
__wasi_fd_t fdThe directory from which to read the directory entries.
void *bufand__wasi_size_t buf_lenThe buffer where directory entries are stored.
__wasi_dircookie_t cookieThe location within the directory to start reading.
Outputs:
__wasi_size_t bufusedThe 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.
uvwasi_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:
__wasi_fd_t fromThe file descriptor to renumber.
__wasi_fd_t toThe file descriptor to overwrite.
uvwasi_fd_seek()Move the offset of a file descriptor.
Note: This is similar to
lseekin POSIX.Inputs:
__wasi_fd_t fdThe file descriptor to operate on.
__wasi_filedelta_t offsetThe number of bytes to move.
__wasi_whence_t whenceThe base from which the offset is relative.
Outputs:
__wasi_filesize_t newoffsetThe new offset of the file descriptor, relative to the start of the file.
uvwasi_fd_sync()Synchronize the data and metadata of a file to disk.
Note: This is similar to
fsyncin POSIX.Inputs:
__wasi_fd_t fdThe file descriptor of the file containing the data and metadata to synchronize to disk.
uvwasi_fd_tell()Return the current offset of a file descriptor.
Note: This is similar to
lseek(fd, 0, SEEK_CUR)in POSIX.Inputs:
__wasi_fd_t fdThe file descriptor to inspect.
Outputs:
__wasi_filesize_t offsetThe current offset of the file descriptor, relative to the start of the file.
uvwasi_fd_write()Write to a file descriptor.
Note: This is similar to
writevin POSIX.Inputs:
__wasi_fd_t fdThe file descriptor to which to write data.
const __wasi_ciovec_t *iovsand__wasi_size_t iovs_lenList of scatter/gather vectors from which to retrieve data.
Outputs:
__wasi_size_t nwrittenThe number of bytes written.
uvwasi_path_create_directory()Create a directory.
Note: This is similar to
mkdiratin POSIX.Inputs:
__wasi_fd_t fdThe working directory at which the resolution of the path starts.
const char *pathand__wasi_size_t path_lenThe path at which to create the directory.
uvwasi_path_filestat_get()Return the attributes of a file or directory.
Note: This is similar to
statin POSIX.Inputs:
__wasi_fd_t fdThe working directory at which the resolution of the path starts.
__wasi_lookupflags_t flagsFlags determining the method of how the path is resolved.
const char *pathand__wasi_size_t path_lenThe path of the file or directory to inspect.
__wasi_filestat_t *bufThe buffer where the file’s attributes are stored.
uvwasi_path_filestat_set_times()Adjust the timestamps of a file or directory.
Note: This is similar to
utimensatin POSIX.Inputs:
__wasi_fd_t fdThe working directory at which the resolution of the path starts.
__wasi_lookupflags_t flagsFlags determining the method of how the path is resolved.
const char *pathand__wasi_size_t path_lenThe path of the file or directory to operate on.
__wasi_timestamp_t st_atimThe desired values of the data access timestamp.
__wasi_timestamp_t st_mtimThe desired values of the data modification timestamp.
__wasi_fstflags_t fst_flagsA bitmask indicating which timestamps to adjust.
uvwasi_path_link()Create a hard link.
Note: This is similar to
linkatin POSIX.Inputs:
__wasi_fd_t old_fdThe working directory at which the resolution of the old path starts.
__wasi_lookupflags_t old_flagsFlags determining the method of how the path is resolved.
const char *old_pathand__wasi_size_t old_path_lenThe source path from which to link.
__wasi_fd_t new_fdThe working directory at which the resolution of the new path starts.
const char *new_pathand__wasi_size_t new_path_lenThe destination path at which to create the hard link.
uvwasi_path_open()Open a file or directory.
The returned file descriptor is not guaranteed to be the lowest-numbered file descriptor not currently open; it is randomized to prevent applications from depending on making assumptions about indexes, since this is error-prone in multi-threaded contexts. The returned file descriptor is guaranteed to be less than 231.
Note: This is similar to
openatin POSIX.Inputs:
__wasi_fd_t dirfdThe working directory at which the resolution of the path starts.
__wasi_lookupflags_t dirflagsFlags determining the method of how the path is resolved.
const char *pathand__wasi_size_t path_lenThe relative path of the file or directory to open, relative to the
dirfddirectory.__wasi_oflags_t o_flagsThe method by which to open the file.
__wasi_rights_t fs_rights_baseand__wasi_rights_t fs_rights_inheritingThe 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.
__wasi_fdflags_t fs_flagsThe initial flags of the file descriptor.
Outputs:
__wasi_fd_t fdThe file descriptor of the file that has been opened.
uvwasi_path_readlink()Read the contents of a symbolic link.
Note: This is similar to
readlinkatin POSIX.Inputs:
__wasi_fd_t fdThe working directory at which the resolution of the path starts.
const char *pathand__wasi_size_t path_lenThe path of the symbolic link from which to read.
char *bufand__wasi_size_t buf_lenThe buffer to which to write the contents of the symbolic link.
Outputs:
__wasi_size_t bufusedThe number of bytes placed in the buffer.
uvwasi_path_remove_directory()Remove a directory.
Return
UVWASI_ENOTEMPTYif the directory is not empty.Note: This is similar to
unlinkat(fd, path, AT_REMOVEDIR)in POSIX.Inputs:
__wasi_fd_t fdThe working directory at which the resolution of the path starts.
const char *pathand__wasi_size_t path_lenThe path to a directory to remove.
uvwasi_path_rename()Rename a file or directory.
Note: This is similar to
renameatin POSIX.Inputs:
__wasi_fd_t old_fdThe working directory at which the resolution of the old path starts.
const char *old_pathand__wasi_size_t old_path_lenThe source path of the file or directory to rename.
__wasi_fd_t new_fdThe working directory at which the resolution of the new path starts.
const char *new_pathand__wasi_size_t new_path_lenThe destination path to which to rename the file or directory.
uvwasi_path_symlink()Create a symbolic link.
Note: This is similar to
symlinkatin POSIX.Inputs:
const char *old_pathand__wasi_size_t old_path_lenThe contents of the symbolic link.
__wasi_fd_t fdThe working directory at which the resolution of the path starts.
const char *new_pathand__wasi_size_t new_path_lenThe destination path at which to create the symbolic link.
uvwasi_path_unlink_file()Unlink a file.
Return
UVWASI_EISDIRif the path refers to a directory.Note: This is similar to
unlinkat(fd, path, 0)in POSIX.Inputs:
__wasi_fd_t fdThe working directory at which the resolution of the path starts.
const char *pathand__wasi_size_t path_lenThe path to a file to unlink.
uvwasi_poll_oneoff()Concurrently poll for the occurrence of a set of events.
Inputs:
const __wasi_subscription_t *inThe events to which to subscribe.
__wasi_event_t *outThe events that have occurred.
__wasi_size_t nsubscriptionsBoth the number of subscriptions and events.
Outputs:
__wasi_size_t neventsThe number of events stored.
uvwasi_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
_Exitin POSIX.Inputs:
__wasi_exitcode_t rvalThe exit code returned by the process.
Does not return.
uvwasi_proc_raise()Send a signal to the process of the calling thread.
Note: This is similar to
raisein POSIX.Inputs:
__wasi_signal_t sigThe signal condition to trigger.
uvwasi_random_get()Write high-quality random data into a buffer.
This function blocks when the implementation is unable to immediately provide sufficient high-quality random data.
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:
void *bufand__wasi_size_t buf_lenThe buffer to fill with random data.
uvwasi_sched_yield()Temporarily yield execution of the calling thread.
Note: This is similar to
sched_yieldin POSIX.uvwasi_sock_recv()Receive a message from a socket.
Note: This is similar to
recvin POSIX, though it also supports reading the data into multiple buffers in the manner ofreadv.Inputs:
__wasi_fd_t sockThe socket on which to receive data.
const __wasi_iovec_t *ri_dataand__wasi_size_t ri_data_lenList of scatter/gather vectors to which to store data.
__wasi_riflags_t ri_flagsMessage flags.
Outputs:
__wasi_size_t ro_datalenNumber of bytes stored in
ri_data.__wasi_roflags_t ro_flagsMessage flags.
uvwasi_sock_send()Send a message on a socket.
Note: This is similar to
sendin POSIX, though it also supports writing the data from multiple buffers in the manner ofwritev.Inputs:
__wasi_fd_t sockThe socket on which to send data.
const __wasi_ciovec_t *si_dataand__wasi_size_t si_data_lenList of scatter/gather vectors to which to retrieve data
__wasi_siflags_t si_flagsMessage flags.
Outputs:
__wasi_size_t so_datalenNumber of bytes transmitted.
uvwasi_sock_shutdown()Shut down socket send and receive channels.
Note: This is similar to
shutdownin POSIX.Inputs:
__wasi_fd_t sockThe socket on which to shutdown channels.
__wasi_sdflags_t howWhich channels on the socket to shut down.
Types
uvwasi_advice_t(uint8_t)File or memory access pattern advisory information.
Used by
uvwasi_fd_advise().Possible values:
UVWASI_ADVICE_DONTNEEDThe application expects that it will not access the specified data in the near future.
UVWASI_ADVICE_NOREUSEThe application expects to access the specified data once and then not reuse it thereafter.
UVWASI_ADVICE_NORMALThe application has no advice to give on its behavior with respect to the specified data.
UVWASI_ADVICE_RANDOMThe application expects to access the specified data in a random order.
UVWASI_ADVICE_SEQUENTIALThe application expects to access the specified data sequentially from lower offsets to higher offsets.
UVWASI_ADVICE_WILLNEEDThe application expects to access the specified data in the near future.
uvwasi_ciovec_t(struct)A region of memory for scatter/gather writes.
Used by
uvwasi_fd_pwrite(),uvwasi_fd_write(), anduvwasi_sock_send().Members:
const void *bufand__wasi_size_t buf_lenThe address and length of the buffer to be written.
uvwasi_clockid_t(uint32_t)Identifiers for clocks.
Used by
uvwasi_subscription_t,uvwasi_clock_res_get(), anduvwasi_clock_time_get().Possible values:
UVWASI_CLOCK_MONOTONICThe 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.
UVWASI_CLOCK_PROCESS_CPUTIME_IDThe CPU-time clock associated with the current process.
UVWASI_CLOCK_REALTIMEThe clock measuring real time. Time value zero corresponds with 1970-01-01T00:00:00Z.
UVWASI_CLOCK_THREAD_CPUTIME_IDThe CPU-time clock associated with the current thread.
uvwasi_device_t(uint64_t)Identifier for a device containing a file system. Can be used in combination with
uvwasi_inode_tto uniquely identify a file or directory in the filesystem.Used by
uvwasi_filestat_t.uvwasi_dircookie_t(uint64_t)A reference to the offset of a directory entry.
Used by
uvwasi_dirent_tanduvwasi_fd_readdir().Special values:
UVWASI_DIRCOOKIE_STARTPermanent reference to the first directory entry within a directory.
uvwasi_dirent_t(struct)A directory entry.
Members:
__wasi_dircookie_t d_nextThe offset of the next directory entry stored in this directory.
__wasi_inode_t d_inoThe serial number of the file referred to by this directory entry.
uint32_t d_namlenThe length of the name of the directory entry.
__wasi_filetype_t d_typeThe type of the file referred to by this directory entry.
uvwasi_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
uvwasi_event_t.Possible values:
UVWASI_ESUCCESSNo error occurred. System call completed successfully.
UVWASI_E2BIGArgument list too long.
UVWASI_EACCESPermission denied.
UVWASI_EADDRINUSEAddress in use.
UVWASI_EADDRNOTAVAILAddress not available.
UVWASI_EAFNOSUPPORTAddress family not supported.
UVWASI_EAGAINResource unavailable, or operation would block.
UVWASI_EALREADYConnection already in progress.
UVWASI_EBADFBad file descriptor.
UVWASI_EBADMSGBad message.
UVWASI_EBUSYDevice or resource busy.
UVWASI_ECANCELEDOperation canceled.
UVWASI_ECHILDNo child processes.
UVWASI_ECONNABORTEDConnection aborted.
UVWASI_ECONNREFUSEDConnection refused.
UVWASI_ECONNRESETConnection reset.
UVWASI_EDEADLKResource deadlock would occur.
UVWASI_EDESTADDRREQDestination address required.
UVWASI_EDOMMathematics argument out of domain of function.
UVWASI_EDQUOTReserved.
UVWASI_EEXISTFile exists.
UVWASI_EFAULTBad address.
UVWASI_EFBIGFile too large.
UVWASI_EHOSTUNREACHHost is unreachable.
UVWASI_EIDRMIdentifier removed.
UVWASI_EILSEQIllegal byte sequence.
UVWASI_EINPROGRESSOperation in progress.
UVWASI_EINTRInterrupted function.
UVWASI_EINVALInvalid argument.
UVWASI_EIOI/O error.
UVWASI_EISCONNSocket is connected.
UVWASI_EISDIRIs a directory.
UVWASI_ELOOPToo many levels of symbolic links.
UVWASI_EMFILEFile descriptor value too large.
UVWASI_EMLINKToo many links.
UVWASI_EMSGSIZEMessage too large.
UVWASI_EMULTIHOPReserved.
UVWASI_ENAMETOOLONGFilename too long.
UVWASI_ENETDOWNNetwork is down.
UVWASI_ENETRESETConnection aborted by network.
UVWASI_ENETUNREACHNetwork unreachable.
UVWASI_ENFILEToo many files open in system.
UVWASI_ENOBUFSNo buffer space available.
UVWASI_ENODEVNo such device.
UVWASI_ENOENTNo such file or directory.
UVWASI_ENOEXECExecutable file format error.
UVWASI_ENOLCKNo locks available.
UVWASI_ENOLINKReserved.
UVWASI_ENOMEMNot enough space.
UVWASI_ENOMSGNo message of the desired type.
UVWASI_ENOPROTOOPTProtocol not available.
UVWASI_ENOSPCNo space left on device.
UVWASI_ENOSYSFunction not supported.
UVWASI_ENOTCONNThe socket is not connected.
UVWASI_ENOTDIRNot a directory or a symbolic link to a directory.
UVWASI_ENOTEMPTYDirectory not empty.
UVWASI_ENOTRECOVERABLEState not recoverable.
UVWASI_ENOTSOCKNot a socket.
UVWASI_ENOTSUPNot supported, or operation not supported on socket.
UVWASI_ENOTTYInappropriate I/O control operation.
UVWASI_ENXIONo such device or address.
UVWASI_EOVERFLOWValue too large to be stored in data type.
UVWASI_EOWNERDEADPrevious owner died.
UVWASI_EPERMOperation not permitted.
UVWASI_EPIPEBroken pipe.
UVWASI_EPROTOProtocol error.
UVWASI_EPROTONOSUPPORTProtocol not supported.
UVWASI_EPROTOTYPEProtocol wrong type for socket.
UVWASI_ERANGEResult too large.
UVWASI_EROFSRead-only file system.
UVWASI_ESPIPEInvalid seek.
UVWASI_ESRCHNo such process.
UVWASI_ESTALEReserved.
UVWASI_ETIMEDOUTConnection timed out.
UVWASI_ETXTBSYText file busy.
UVWASI_EXDEVCross-device link.
UVWASI_ENOTCAPABLEExtension: Capabilities insufficient.
uvwasi_event_t(struct)An event that occurred.
Used by
uvwasi_poll_oneoff().Members:
__wasi_userdata_t userdataUser-provided value that got attached to
uvwasi_subscription_t::userdata.__wasi_errno_t errorIf non-zero, an error that occurred while processing the subscription request.
__wasi_eventtype_t typeThe type of the event that occurred.
When
typeisUVWASI_EVENTTYPE_FD_READorUVWASI_EVENTTYPE_FD_WRITE:u.fd_readwrite__wasi_filesize_t nbytesThe number of bytes available for reading or writing.
__wasi_eventrwflags_t flagsThe state of the file descriptor.
uvwasi_eventrwflags_t(uint16_tbitfield)The state of the file descriptor subscribed to with
UVWASI_EVENTTYPE_FD_READorUVWASI_EVENTTYPE_FD_WRITE.Used by
uvwasi_event_t.Possible values:
UVWASI_EVENT_FD_READWRITE_HANGUPThe peer of this socket has closed or disconnected.
uvwasi_eventtype_t(uint8_t)Type of a subscription to an event or its occurrence.
Used by
uvwasi_event_tanduvwasi_subscription_t.Possible values:
UVWASI_EVENTTYPE_CLOCKThe time value of clock
uvwasi_subscription_t::u.clock.clock_idhas reached timestampuvwasi_subscription_t::u.clock.timeout.UVWASI_EVENTTYPE_FD_READFile descriptor
uvwasi_subscription_t::u.fd_readwrite.fdhas data available for reading. This event always triggers for regular files.UVWASI_EVENTTYPE_FD_WRITEFile descriptor
uvwasi_subscription_t::u.fd_readwrite.fdhas capacity available for writing. This event always triggers for regular files.uvwasi_exitcode_t(uint32_t)Exit code generated by a process when exiting.
Used by
uvwasi_proc_exit().uvwasi_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, andSTDERR_FILENO).Other than these, WASI implementations are not required to allocate new file descriptors in ascending order.
uvwasi_fdflags_t(uint16_tbitfield)File descriptor flags.
Used by
uvwasi_fdstat_t,uvwasi_fd_fdstat_set_flags(), anduvwasi_path_open().Possible values:
UVWASI_FDFLAG_APPENDAppend mode: Data written to the file is always appended to the file’s end.
UVWASI_FDFLAG_DSYNCWrite according to synchronized I/O data integrity completion. Only the data stored in the file is synchronized.
UVWASI_FDFLAG_NONBLOCKNon-blocking mode.
UVWASI_FDFLAG_RSYNCSynchronized read I/O operations.
UVWASI_FDFLAG_SYNCWrite 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.
uvwasi_fdstat_t(struct)File descriptor attributes.
Used by
uvwasi_fd_fdstat_get().Members:
__wasi_filetype_t fs_filetypeFile type.
__wasi_fdflags_t fs_flagsFile descriptor flags.
__wasi_rights_t fs_rights_baseRights that apply to this file descriptor.
__wasi_rights_t fs_rights_inheritingMaximum set of rights that may be installed on new file descriptors that are created through this file descriptor, e.g., through
uvwasi_path_open().uvwasi_filedelta_t(int64_t)Relative offset within a file.
Used by
uvwasi_fd_seek().uvwasi_filesize_t(uint64_t)Non-negative file size or length of a region within a file.
Used by
uvwasi_event_t,uvwasi_filestat_t,uvwasi_fd_pread(),uvwasi_fd_pwrite(),uvwasi_fd_seek(),uvwasi_path_tell(),uvwasi_fd_advise(),uvwasi_fd_allocate(), anduvwasi_fd_filestat_set_size().uvwasi_filestat_t(struct)File attributes.
Used by
uvwasi_fd_filestat_get()anduvwasi_path_filestat_get().Members:
__wasi_device_t st_devDevice ID of device containing the file.
__wasi_inode_t st_inoFile serial number.
__wasi_filetype_t st_filetypeFile type.
__wasi_linkcount_t st_nlinkNumber of hard links to the file.
__wasi_filesize_t st_sizeFor regular files, the file size in bytes. For symbolic links, the length in bytes of the pathname contained in the symbolic link.
__wasi_timestamp_t st_atimLast data access timestamp.
__wasi_timestamp_t st_mtimLast data modification timestamp.
__wasi_timestamp_t st_ctimLast file status change timestamp.
uvwasi_filetype_t(uint8_t)The type of a file descriptor or file.
Used by
uvwasi_dirent_t,uvwasi_fdstat_t, anduvwasi_filestat_t.Possible values:
UVWASI_FILETYPE_UNKNOWNThe type of the file descriptor or file is unknown or is different from any of the other types specified.
UVWASI_FILETYPE_BLOCK_DEVICEThe file descriptor or file refers to a block device inode.
UVWASI_FILETYPE_CHARACTER_DEVICEThe file descriptor or file refers to a character device inode.
UVWASI_FILETYPE_DIRECTORYThe file descriptor or file refers to a directory inode.
UVWASI_FILETYPE_REGULAR_FILEThe file descriptor or file refers to a regular file inode.
UVWASI_FILETYPE_SOCKET_DGRAMThe file descriptor or file refers to a datagram socket.
UVWASI_FILETYPE_SOCKET_STREAMThe file descriptor or file refers to a byte-stream socket.
UVWASI_FILETYPE_SYMBOLIC_LINKThe file refers to a symbolic link inode.
uvwasi_fstflags_t(uint16_tbitfield)Which file time attributes to adjust.
Used by
uvwasi_fd_filestat_set_times()anduvwasi_path_filestat_set_times().Possible values:
UVWASI_FILESTAT_SET_ATIMAdjust the last data access timestamp to the value stored in
uvwasi_filestat_t::st_atim.UVWASI_FILESTAT_SET_ATIM_NOWAdjust the last data access timestamp to the time of clock
UVWASI_CLOCK_REALTIME.UVWASI_FILESTAT_SET_MTIMAdjust the last data modification timestamp to the value stored in
uvwasi_filestat_t::st_mtim.UVWASI_FILESTAT_SET_MTIM_NOWAdjust the last data modification timestamp to the time of clock
UVWASI_CLOCK_REALTIME.uvwasi_inode_t(uint64_t)File serial number that is unique within its file system.
Used by
uvwasi_dirent_tanduvwasi_filestat_t.uvwasi_iovec_t(struct)A region of memory for scatter/gather reads.
Used by
uvwasi_fd_pread(),uvwasi_fd_read(), anduvwasi_sock_recv().Members:
void *bufand__wasi_size_t buf_lenThe address and length of the buffer to be filled.
uvwasi_linkcount_t(uint64_t)Number of hard links to an inode.
Used by
uvwasi_filestat_t.uvwasi_lookupflags_t(uint32_tbitfield)Flags determining the method of how paths are resolved.
Used by
uvwasi_path_filestat_get(),uvwasi_path_filestat_set_times(),uvwasi_path_link(), anduvwasi_path_open().Possible values:
UVWASI_LOOKUP_SYMLINK_FOLLOWAs long as the resolved path corresponds to a symbolic link, it is expanded.
uvwasi_oflags_t(uint16_tbitfield)Open flags used by
uvwasi_path_open().Used by
uvwasi_path_open().Possible values:
UVWASI_O_CREATCreate file if it does not exist.
UVWASI_O_DIRECTORYFail if not a directory.
UVWASI_O_EXCLFail if file already exists.
UVWASI_O_TRUNCTruncate file to size 0.
uvwasi_riflags_t(uint16_tbitfield)Flags provided to
uvwasi_sock_recv().Used by
uvwasi_sock_recv().Possible values:
UVWASI_SOCK_RECV_PEEKReturns the message without removing it from the socket’s receive queue.
UVWASI_SOCK_RECV_WAITALLOn byte-stream sockets, block until the full amount of data can be returned.
uvwasi_rights_t(uint64_tbitfield)File descriptor rights, determining which actions may be performed.
Used by
uvwasi_fdstat_t,uvwasi_fd_fdstat_set_rights(), anduvwasi_path_open().Possible values:
UVWASI_RIGHT_FD_DATASYNCThe right to invoke
uvwasi_fd_datasync().If
UVWASI_RIGHT_PATH_OPENis set, includes the right to invokeuvwasi_path_open()withUVWASI_FDFLAG_DSYNC.UVWASI_RIGHT_FD_READThe right to invoke
uvwasi_fd_read()anduvwasi_sock_recv().If
UVWASI_RIGHT_FD_SEEKis set, includes the right to invokeuvwasi_fd_pread().UVWASI_RIGHT_FD_SEEKThe right to invoke
uvwasi_fd_seek(). This flag impliesUVWASI_RIGHT_FD_TELL.UVWASI_RIGHT_FD_FDSTAT_SET_FLAGSThe right to invoke
uvwasi_fd_fdstat_set_flags().UVWASI_RIGHT_FD_SYNCThe right to invoke
uvwasi_fd_sync().If
UVWASI_RIGHT_PATH_OPENis set, includes the right to invokeuvwasi_path_open()withUVWASI_FDFLAG_RSYNCandUVWASI_FDFLAG_DSYNC.UVWASI_RIGHT_FD_TELLThe right to invoke
uvwasi_fd_seek()in such a way that the file offset remains unaltered (i.e.,UVWASI_WHENCE_CURwith offset zero), or to invokeuvwasi_fd_tell().UVWASI_RIGHT_FD_WRITEThe right to invoke
uvwasi_fd_write()anduvwasi_sock_send().If
UVWASI_RIGHT_FD_SEEKis set, includes the right to invokeuvwasi_fd_pwrite().UVWASI_RIGHT_FD_ADVISEThe right to invoke
uvwasi_fd_advise().UVWASI_RIGHT_FD_ALLOCATEThe right to invoke
uvwasi_fd_allocate().UVWASI_RIGHT_PATH_CREATE_DIRECTORYThe right to invoke
uvwasi_path_create_directory().UVWASI_RIGHT_PATH_CREATE_FILEIf
UVWASI_RIGHT_PATH_OPENis set, the right to invokeuvwasi_path_open()withUVWASI_O_CREAT.UVWASI_RIGHT_PATH_LINK_SOURCEThe right to invoke
uvwasi_path_link()with the file descriptor as the source directory.UVWASI_RIGHT_PATH_LINK_TARGETThe right to invoke
uvwasi_path_link()with the file descriptor as the target directory.UVWASI_RIGHT_PATH_OPENThe right to invoke
uvwasi_path_open().UVWASI_RIGHT_FD_READDIRThe right to invoke
uvwasi_fd_readdir().UVWASI_RIGHT_PATH_READLINKThe right to invoke
uvwasi_path_readlink().UVWASI_RIGHT_PATH_RENAME_SOURCEThe right to invoke
uvwasi_path_rename()with the file descriptor as the source directory.UVWASI_RIGHT_PATH_RENAME_TARGETThe right to invoke
uvwasi_path_rename()with the file descriptor as the target directory.UVWASI_RIGHT_PATH_FILESTAT_GETThe right to invoke
uvwasi_path_filestat_get().UVWASI_RIGHT_PATH_FILESTAT_SET_SIZEThe right to change a file’s size (there is no
uvwasi_path_filestat_set_size()).If
UVWASI_RIGHT_PATH_OPENis set, includes the right to invokeuvwasi_path_open()withUVWASI_O_TRUNC.UVWASI_RIGHT_PATH_FILESTAT_SET_TIMESThe right to invoke
uvwasi_path_filestat_set_times().UVWASI_RIGHT_FD_FILESTAT_GETThe right to invoke
uvwasi_fd_filestat_get().UVWASI_RIGHT_FD_FILESTAT_SET_SIZEThe right to invoke
uvwasi_fd_filestat_set_size().UVWASI_RIGHT_FD_FILESTAT_SET_TIMESThe right to invoke
uvwasi_fd_filestat_set_times().UVWASI_RIGHT_PATH_SYMLINKThe right to invoke
uvwasi_path_symlink().UVWASI_RIGHT_PATH_UNLINK_FILEThe right to invoke
uvwasi_path_unlink_file().UVWASI_RIGHT_PATH_REMOVE_DIRECTORYThe right to invoke
uvwasi_path_remove_directory().UVWASI_RIGHT_POLL_FD_READWRITEIf
UVWASI_RIGHT_FD_READis set, includes the right to invokeuvwasi_poll_oneoff()to subscribe toUVWASI_EVENTTYPE_FD_READ.If
UVWASI_RIGHT_FD_WRITEis set, includes the right to invokeuvwasi_poll_oneoff()to subscribe toUVWASI_EVENTTYPE_FD_WRITE.UVWASI_RIGHT_SOCK_SHUTDOWNThe right to invoke
uvwasi_sock_shutdown().uvwasi_roflags_t(uint16_tbitfield)Flags returned by
uvwasi_sock_recv().Used by
uvwasi_sock_recv().Possible values:
UVWASI_SOCK_RECV_DATA_TRUNCATEDReturned by
uvwasi_sock_recv(): Message data has been truncated.uvwasi_sdflags_t(uint8_tbitfield)Which channels on a socket to shut down.
Used by
uvwasi_sock_shutdown().Possible values:
UVWASI_SHUT_RDDisables further receive operations.
UVWASI_SHUT_WRDisables further send operations.
uvwasi_siflags_t(uint16_tbitfield)Flags provided to
uvwasi_sock_send(). As there are currently no flags defined, it must be set to zero.Used by
uvwasi_sock_send().uvwasi_signal_t(uint8_t)Signal condition.
Used by
uvwasi_proc_raise().Possible values:
UVWASI_SIGABRTProcess abort signal.
Action: Terminates the process.
UVWASI_SIGALRMAlarm clock.
Action: Terminates the process.
UVWASI_SIGBUSAccess to an undefined portion of a memory object.
Action: Terminates the process.
UVWASI_SIGCHLDChild process terminated, stopped, or continued.
Action: Ignored.
UVWASI_SIGCONTContinue executing, if stopped.
Action: Continues executing, if stopped.
UVWASI_SIGFPEErroneous arithmetic operation.
Action: Terminates the process.
UVWASI_SIGHUPHangup.
Action: Terminates the process.
UVWASI_SIGILLIllegal instruction.
Action: Terminates the process.
UVWASI_SIGINTTerminate interrupt signal.
Action: Terminates the process.
UVWASI_SIGKILLKill.
Action: Terminates the process.
UVWASI_SIGPIPEWrite on a pipe with no one to read it.
Action: Ignored.
UVWASI_SIGQUITTerminal quit signal.
Action: Terminates the process.
UVWASI_SIGSEGVInvalid memory reference.
Action: Terminates the process.
UVWASI_SIGSTOPStop executing.
Action: Stops executing.
UVWASI_SIGSYSBad system call.
Action: Terminates the process.
UVWASI_SIGTERMTermination signal.
Action: Terminates the process.
UVWASI_SIGTRAPTrace/breakpoint trap.
Action: Terminates the process.
UVWASI_SIGTSTPTerminal stop signal.
Action: Stops executing.
UVWASI_SIGTTINBackground process attempting read.
Action: Stops executing.
UVWASI_SIGTTOUBackground process attempting write.
Action: Stops executing.
UVWASI_SIGURGHigh bandwidth data is available at a socket.
Action: Ignored.
UVWASI_SIGUSR1User-defined signal 1.
Action: Terminates the process.
UVWASI_SIGUSR2User-defined signal 2.
Action: Terminates the process.
UVWASI_SIGVTALRMVirtual timer expired.
Action: Terminates the process.
UVWASI_SIGXCPUCPU time limit exceeded.
Action: Terminates the process.
UVWASI_SIGXFSZFile size limit exceeded.
Action: Terminates the process.
uvwasi_subclockflags_t(uint16_tbitfield)Flags determining how to interpret the timestamp provided in
uvwasi_subscription_t::u.clock.timeout.Used by
uvwasi_subscription_t.Possible values:
UVWASI_SUBSCRIPTION_CLOCK_ABSTIMEIf set, treat the timestamp provided in
uvwasi_subscription_t::u.clock.timeoutas an absolute timestamp of clockuvwasi_subscription_t::u.clock.clock_id.If clear, treat the timestamp provided in
uvwasi_subscription_t::u.clock.timeoutrelative to the current time value of clockuvwasi_subscription_t::u.clock.clock_id.uvwasi_subscription_t(struct)Subscription to an event.
Used by
uvwasi_poll_oneoff().Members:
__wasi_userdata_t userdataUser-provided value that is attached to the subscription in the implementation and returned through
uvwasi_event_t::userdata.__wasi_eventtype_t typeThe type of the event to which to subscribe.
When
typeisUVWASI_EVENTTYPE_CLOCK:u.clock__wasi_clockid_t clock_idThe clock against which to compare the timestamp.
__wasi_timestamp_t timeoutThe absolute or relative timestamp.
__wasi_timestamp_t precisionThe amount of time that the implementation may wait additionally to coalesce with other events.
__wasi_subclockflags_t flagsFlags specifying whether the timeout is absolute or relative.
When
typeisUVWASI_EVENTTYPE_FD_READorUVWASI_EVENTTYPE_FD_WRITE:u.fd_readwrite__wasi_fd_t fdThe file descriptor on which to wait for it to become ready for reading or writing.
uvwasi_timestamp_t(uint64_t)Timestamp in nanoseconds.
Used by
uvwasi_filestat_t,uvwasi_subscription_t,uvwasi_clock_res_get(),uvwasi_clock_time_get(),uvwasi_fd_filestat_set_times(), anduvwasi_path_filestat_set_times().uvwasi_userdata_t(uint64_t)User-provided value that may be attached to objects that is retained when extracted from the implementation.
Used by
uvwasi_event_tanduvwasi_subscription_t.uvwasi_whence_t(uint8_t)The position relative to which to set the offset of the file descriptor.
Used by
uvwasi_fd_seek().Possible values:
UVWASI_WHENCE_CURSeek relative to current position.
UVWASI_WHENCE_ENDSeek relative to end-of-file.
UVWASI_WHENCE_SETSeek relative to start-of-file.
Doing a release
To do a release complete the following steps:
Choose a tagand type in the new tag. That should result inCreate new tag: vX.Y.Z on publishwhere vX.Y.Z matches the tag you specified.Running fuzzers locally
We support fuzzing by way of ClusterFuzzLite, which is run automatically against pull requests. You can run these fuzzers locally with the OSS-Fuzz fuzzing infrastructure, using the following steps: