<script>
<style>
/* force tight list */
.markdown-body li > p { margin-top: 0; margin-bottom: 0; }
</style>
Refer to https://hackmd.io/@q/wasi-preview1-api for modules.
# Types
## <a href="#size" id="size"></a> `size`: `u32`
- **Size**: 4
- **Alignment**: 4
## <a href="#filesize" id="filesize"></a> `filesize`: `u64`
Non-negative file size or length of a region within a file.
- **Size**: 8
- **Alignment**: 8
## <a href="#timestamp" id="timestamp"></a> `timestamp`: `u64`
Timestamp in nanoseconds.
- **Size**: 8
- **Alignment**: 8
## <a href="#clockid" id="clockid"></a> `clockid`: `Variant`
Identifiers for clocks.
- **Size**: 4
- **Alignment**: 4
- **Cases**:
* <a href="#clockid.realtime" id="clockid.realtime"></a> `realtime` \
The clock measuring real time. Time value zero corresponds with
1970-01-01T00:00:00Z.
* <a href="#clockid.monotonic" id="clockid.monotonic"></a> `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" id="clockid.process_cputime_id"></a> `process_cputime_id` \
The CPU-time clock associated with the current process.
* <a href="#clockid.thread_cputime_id" id="clockid.thread_cputime_id"></a> `thread_cputime_id` \
The CPU-time clock associated with the current thread.
## <a href="#errno" id="errno"></a> `errno`: `Variant`
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.
- **Size**: 2
- **Alignment**: 2
- **Cases**:
* <a href="#errno.success" id="errno.success"></a> `success` \
No error occurred. System call completed successfully.
* <a href="#errno.2big" id="errno.2big"></a> `2big` \
Argument list too long.
* <a href="#errno.acces" id="errno.acces"></a> `acces` \
Permission denied.
* <a href="#errno.addrinuse" id="errno.addrinuse"></a> `addrinuse` \
Address in use.
* <a href="#errno.addrnotavail" id="errno.addrnotavail"></a> `addrnotavail` \
Address not available.
* <a href="#errno.afnosupport" id="errno.afnosupport"></a> `afnosupport` \
Address family not supported.
* <a href="#errno.again" id="errno.again"></a> `again` \
Resource unavailable, or operation would block.
* <a href="#errno.already" id="errno.already"></a> `already` \
Connection already in progress.
* <a href="#errno.badf" id="errno.badf"></a> `badf` \
Bad file descriptor.
* <a href="#errno.badmsg" id="errno.badmsg"></a> `badmsg` \
Bad message.
* <a href="#errno.busy" id="errno.busy"></a> `busy` \
Device or resource busy.
* <a href="#errno.canceled" id="errno.canceled"></a> `canceled` \
Operation canceled.
* <a href="#errno.child" id="errno.child"></a> `child` \
No child processes.
* <a href="#errno.connaborted" id="errno.connaborted"></a> `connaborted` \
Connection aborted.
* <a href="#errno.connrefused" id="errno.connrefused"></a> `connrefused` \
Connection refused.
* <a href="#errno.connreset" id="errno.connreset"></a> `connreset` \
Connection reset.
* <a href="#errno.deadlk" id="errno.deadlk"></a> `deadlk` \
Resource deadlock would occur.
* <a href="#errno.destaddrreq" id="errno.destaddrreq"></a> `destaddrreq` \
Destination address required.
* <a href="#errno.dom" id="errno.dom"></a> `dom` \
Mathematics argument out of domain of function.
* <a href="#errno.dquot" id="errno.dquot"></a> `dquot` \
Reserved.
* <a href="#errno.exist" id="errno.exist"></a> `exist` \
File exists.
* <a href="#errno.fault" id="errno.fault"></a> `fault` \
Bad address.
* <a href="#errno.fbig" id="errno.fbig"></a> `fbig` \
File too large.
* <a href="#errno.hostunreach" id="errno.hostunreach"></a> `hostunreach` \
Host is unreachable.
* <a href="#errno.idrm" id="errno.idrm"></a> `idrm` \
Identifier removed.
* <a href="#errno.ilseq" id="errno.ilseq"></a> `ilseq` \
Illegal byte sequence.
* <a href="#errno.inprogress" id="errno.inprogress"></a> `inprogress` \
Operation in progress.
* <a href="#errno.intr" id="errno.intr"></a> `intr` \
Interrupted function.
* <a href="#errno.inval" id="errno.inval"></a> `inval` \
Invalid argument.
* <a href="#errno.io" id="errno.io"></a> `io` \
I/O error.
* <a href="#errno.isconn" id="errno.isconn"></a> `isconn` \
Socket is connected.
* <a href="#errno.isdir" id="errno.isdir"></a> `isdir` \
Is a directory.
* <a href="#errno.loop" id="errno.loop"></a> `loop` \
Too many levels of symbolic links.
* <a href="#errno.mfile" id="errno.mfile"></a> `mfile` \
File descriptor value too large.
* <a href="#errno.mlink" id="errno.mlink"></a> `mlink` \
Too many links.
* <a href="#errno.msgsize" id="errno.msgsize"></a> `msgsize` \
Message too large.
* <a href="#errno.multihop" id="errno.multihop"></a> `multihop` \
Reserved.
* <a href="#errno.nametoolong" id="errno.nametoolong"></a> `nametoolong` \
Filename too long.
* <a href="#errno.netdown" id="errno.netdown"></a> `netdown` \
Network is down.
* <a href="#errno.netreset" id="errno.netreset"></a> `netreset` \
Connection aborted by network.
* <a href="#errno.netunreach" id="errno.netunreach"></a> `netunreach` \
Network unreachable.
* <a href="#errno.nfile" id="errno.nfile"></a> `nfile` \
Too many files open in system.
* <a href="#errno.nobufs" id="errno.nobufs"></a> `nobufs` \
No buffer space available.
* <a href="#errno.nodev" id="errno.nodev"></a> `nodev` \
No such device.
* <a href="#errno.noent" id="errno.noent"></a> `noent` \
No such file or directory.
* <a href="#errno.noexec" id="errno.noexec"></a> `noexec` \
Executable file format error.
* <a href="#errno.nolck" id="errno.nolck"></a> `nolck` \
No locks available.
* <a href="#errno.nolink" id="errno.nolink"></a> `nolink` \
Reserved.
* <a href="#errno.nomem" id="errno.nomem"></a> `nomem` \
Not enough space.
* <a href="#errno.nomsg" id="errno.nomsg"></a> `nomsg` \
No message of the desired type.
* <a href="#errno.noprotoopt" id="errno.noprotoopt"></a> `noprotoopt` \
Protocol not available.
* <a href="#errno.nospc" id="errno.nospc"></a> `nospc` \
No space left on device.
* <a href="#errno.nosys" id="errno.nosys"></a> `nosys` \
Function not supported.
* <a href="#errno.notconn" id="errno.notconn"></a> `notconn` \
The socket is not connected.
* <a href="#errno.notdir" id="errno.notdir"></a> `notdir` \
Not a directory or a symbolic link to a directory.
* <a href="#errno.notempty" id="errno.notempty"></a> `notempty` \
Directory not empty.
* <a href="#errno.notrecoverable" id="errno.notrecoverable"></a> `notrecoverable` \
State not recoverable.
* <a href="#errno.notsock" id="errno.notsock"></a> `notsock` \
Not a socket.
* <a href="#errno.notsup" id="errno.notsup"></a> `notsup` \
Not supported, or operation not supported on socket.
* <a href="#errno.notty" id="errno.notty"></a> `notty` \
Inappropriate I/O control operation.
* <a href="#errno.nxio" id="errno.nxio"></a> `nxio` \
No such device or address.
* <a href="#errno.overflow" id="errno.overflow"></a> `overflow` \
Value too large to be stored in data type.
* <a href="#errno.ownerdead" id="errno.ownerdead"></a> `ownerdead` \
Previous owner died.
* <a href="#errno.perm" id="errno.perm"></a> `perm` \
Operation not permitted.
* <a href="#errno.pipe" id="errno.pipe"></a> `pipe` \
Broken pipe.
* <a href="#errno.proto" id="errno.proto"></a> `proto` \
Protocol error.
* <a href="#errno.protonosupport" id="errno.protonosupport"></a> `protonosupport` \
Protocol not supported.
* <a href="#errno.prototype" id="errno.prototype"></a> `prototype` \
Protocol wrong type for socket.
* <a href="#errno.range" id="errno.range"></a> `range` \
Result too large.
* <a href="#errno.rofs" id="errno.rofs"></a> `rofs` \
Read-only file system.
* <a href="#errno.spipe" id="errno.spipe"></a> `spipe` \
Invalid seek.
* <a href="#errno.srch" id="errno.srch"></a> `srch` \
No such process.
* <a href="#errno.stale" id="errno.stale"></a> `stale` \
Reserved.
* <a href="#errno.timedout" id="errno.timedout"></a> `timedout` \
Connection timed out.
* <a href="#errno.txtbsy" id="errno.txtbsy"></a> `txtbsy` \
Text file busy.
* <a href="#errno.xdev" id="errno.xdev"></a> `xdev` \
Cross-device link.
* <a href="#errno.notcapable" id="errno.notcapable"></a> `notcapable` \
Extension: Capabilities insufficient.
## <a href="#rights" id="rights"></a> `rights`: `Record`
File descriptor rights, determining which actions may be performed.
- **Size**: 8
- **Alignment**: 8
* (Bit: **0**) <a href="#rights.fd_datasync" id="rights.fd_datasync"></a> `fd_datasync`: `bool` \
The right to invoke [`fd_datasync`](#fd_datasync).
If [`path_open`](#path_open) is set, includes the right to invoke
[`path_open`](#path_open) with [`fdflags::dsync`](#fdflags.dsync).
* (Bit: **1**) <a href="#rights.fd_read" id="rights.fd_read"></a> `fd_read`: `bool` \
The right to invoke [`fd_read`](#fd_read) and [`sock_recv`](#sock_recv).
If [`rights::fd_seek`](#rights.fd_seek) is set, includes the right to invoke [`fd_pread`](#fd_pread).
* (Bit: **2**) <a href="#rights.fd_seek" id="rights.fd_seek"></a> `fd_seek`: `bool` \
The right to invoke [`fd_seek`](#fd_seek). This flag implies [`rights::fd_tell`](#rights.fd_tell).
* (Bit: **3**) <a href="#rights.fd_fdstat_set_flags" id="rights.fd_fdstat_set_flags"></a> `fd_fdstat_set_flags`: `bool` \
The right to invoke [`fd_fdstat_set_flags`](#fd_fdstat_set_flags).
* (Bit: **4**) <a href="#rights.fd_sync" id="rights.fd_sync"></a> `fd_sync`: `bool` \
The right to invoke [`fd_sync`](#fd_sync).
If [`path_open`](#path_open) is set, includes the right to invoke
[`path_open`](#path_open) with [`fdflags::rsync`](#fdflags.rsync) and [`fdflags::dsync`](#fdflags.dsync).
* (Bit: **5**) <a href="#rights.fd_tell" id="rights.fd_tell"></a> `fd_tell`: `bool` \
The right to invoke [`fd_seek`](#fd_seek) in such a way that the file offset
remains unaltered (i.e., [`whence::cur`](#whence.cur) with offset zero), or to
invoke [`fd_tell`](#fd_tell).
* (Bit: **6**) <a href="#rights.fd_write" id="rights.fd_write"></a> `fd_write`: `bool` \
The right to invoke [`fd_write`](#fd_write) and [`sock_send`](#sock_send).
If [`rights::fd_seek`](#rights.fd_seek) is set, includes the right to invoke [`fd_pwrite`](#fd_pwrite).
* (Bit: **7**) <a href="#rights.fd_advise" id="rights.fd_advise"></a> `fd_advise`: `bool` \
The right to invoke [`fd_advise`](#fd_advise).
* (Bit: **8**) <a href="#rights.fd_allocate" id="rights.fd_allocate"></a> `fd_allocate`: `bool` \
The right to invoke [`fd_allocate`](#fd_allocate).
* (Bit: **9**) <a href="#rights.path_create_directory" id="rights.path_create_directory"></a> `path_create_directory`: `bool` \
The right to invoke [`path_create_directory`](#path_create_directory).
* (Bit: **10**) <a href="#rights.path_create_file" id="rights.path_create_file"></a> `path_create_file`: `bool` \
If [`path_open`](#path_open) is set, the right to invoke [`path_open`](#path_open) with [`oflags::creat`](#oflags.creat).
* (Bit: **11**) <a href="#rights.path_link_source" id="rights.path_link_source"></a> `path_link_source`: `bool` \
The right to invoke [`path_link`](#path_link) with the file descriptor as the
source directory.
* (Bit: **12**) <a href="#rights.path_link_target" id="rights.path_link_target"></a> `path_link_target`: `bool` \
The right to invoke [`path_link`](#path_link) with the file descriptor as the
target directory.
* (Bit: **13**) <a href="#rights.path_open" id="rights.path_open"></a> `path_open`: `bool` \
The right to invoke [`path_open`](#path_open).
* (Bit: **14**) <a href="#rights.fd_readdir" id="rights.fd_readdir"></a> `fd_readdir`: `bool` \
The right to invoke [`fd_readdir`](#fd_readdir).
* (Bit: **15**) <a href="#rights.path_readlink" id="rights.path_readlink"></a> `path_readlink`: `bool` \
The right to invoke [`path_readlink`](#path_readlink).
* (Bit: **16**) <a href="#rights.path_rename_source" id="rights.path_rename_source"></a> `path_rename_source`: `bool` \
The right to invoke [`path_rename`](#path_rename) with the file descriptor as the source directory.
* (Bit: **17**) <a href="#rights.path_rename_target" id="rights.path_rename_target"></a> `path_rename_target`: `bool` \
The right to invoke [`path_rename`](#path_rename) with the file descriptor as the target directory.
* (Bit: **18**) <a href="#rights.path_filestat_get" id="rights.path_filestat_get"></a> `path_filestat_get`: `bool` \
The right to invoke [`path_filestat_get`](#path_filestat_get).
* (Bit: **19**) <a href="#rights.path_filestat_set_size" id="rights.path_filestat_set_size"></a> `path_filestat_set_size`: `bool` \
The right to change a file's size.
If [`path_open`](#path_open) is set, includes the right to invoke [`path_open`](#path_open) with [`oflags::trunc`](#oflags.trunc).
Note: there is no function named `path_filestat_set_size`. This follows POSIX design,
which only has `ftruncate` and does not provide `ftruncateat`.
While such function would be desirable from the API design perspective, there are virtually
no use cases for it since no code written for POSIX systems would use it.
Moreover, implementing it would require multiple syscalls, leading to inferior performance.
* (Bit: **20**) <a href="#rights.path_filestat_set_times" id="rights.path_filestat_set_times"></a> `path_filestat_set_times`: `bool` \
The right to invoke [`path_filestat_set_times`](#path_filestat_set_times).
* (Bit: **21**) <a href="#rights.fd_filestat_get" id="rights.fd_filestat_get"></a> `fd_filestat_get`: `bool` \
The right to invoke [`fd_filestat_get`](#fd_filestat_get).
* (Bit: **22**) <a href="#rights.fd_filestat_set_size" id="rights.fd_filestat_set_size"></a> `fd_filestat_set_size`: `bool` \
The right to invoke [`fd_filestat_set_size`](#fd_filestat_set_size).
* (Bit: **23**) <a href="#rights.fd_filestat_set_times" id="rights.fd_filestat_set_times"></a> `fd_filestat_set_times`: `bool` \
The right to invoke [`fd_filestat_set_times`](#fd_filestat_set_times).
* (Bit: **24**) <a href="#rights.path_symlink" id="rights.path_symlink"></a> `path_symlink`: `bool` \
The right to invoke [`path_symlink`](#path_symlink).
* (Bit: **25**) <a href="#rights.path_remove_directory" id="rights.path_remove_directory"></a> `path_remove_directory`: `bool` \
The right to invoke [`path_remove_directory`](#path_remove_directory).
* (Bit: **26**) <a href="#rights.path_unlink_file" id="rights.path_unlink_file"></a> `path_unlink_file`: `bool` \
The right to invoke [`path_unlink_file`](#path_unlink_file).
* (Bit: **27**) <a href="#rights.poll_fd_readwrite" id="rights.poll_fd_readwrite"></a> `poll_fd_readwrite`: `bool` \
If [`rights::fd_read`](#rights.fd_read) is set, includes the right to invoke [`poll_oneoff`](#poll_oneoff) to subscribe to [`eventtype::fd_read`](#eventtype.fd_read).
If [`rights::fd_write`](#rights.fd_write) is set, includes the right to invoke [`poll_oneoff`](#poll_oneoff) to subscribe to [`eventtype::fd_write`](#eventtype.fd_write).
* (Bit: **28**) <a href="#rights.sock_shutdown" id="rights.sock_shutdown"></a> `sock_shutdown`: `bool` \
The right to invoke [`sock_shutdown`](#sock_shutdown).
* (Bit: **29**) <a href="#rights.sock_accept" id="rights.sock_accept"></a> `sock_accept`: `bool` \
The right to invoke [`sock_accept`](#sock_accept).
## <a href="#fd" id="fd"></a> `fd`: `Handle`
A file descriptor handle.
- **Size**: 4
- **Alignment**: 4
## <a href="#iovec" id="iovec"></a> `iovec`: `Record`
A region of memory for scatter/gather reads.
- **Size**: 8
- **Alignment**: 4
* (Offset: **0**) <a href="#iovec.buf" id="iovec.buf"></a> `buf`: `Pointer<u8>` \
The address of the buffer to be filled.
* (Offset: **4**) <a href="#iovec.buf_len" id="iovec.buf_len"></a> `buf_len`: [`size`](#size) \
The length of the buffer to be filled.
## <a href="#ciovec" id="ciovec"></a> `ciovec`: `Record`
A region of memory for scatter/gather writes.
- **Size**: 8
- **Alignment**: 4
* (Offset: **0**) <a href="#ciovec.buf" id="ciovec.buf"></a> `buf`: `ConstPointer<u8>` \
The address of the buffer to be written.
* (Offset: **4**) <a href="#ciovec.buf_len" id="ciovec.buf_len"></a> `buf_len`: [`size`](#size) \
The length of the buffer to be written.
## <a href="#iovec_array" id="iovec_array"></a> `iovec_array`: `List<iovec>`
- **Size**: 8
- **Alignment**: 4
## <a href="#ciovec_array" id="ciovec_array"></a> `ciovec_array`: `List<ciovec>`
- **Size**: 8
- **Alignment**: 4
## <a href="#filedelta" id="filedelta"></a> `filedelta`: `s64`
Relative offset within a file.
- **Size**: 8
- **Alignment**: 8
## <a href="#whence" id="whence"></a> `whence`: `Variant`
The position relative to which to set the offset of the file descriptor.
- **Size**: 1
- **Alignment**: 1
- **Cases**:
* <a href="#whence.set" id="whence.set"></a> `set` \
Seek relative to start-of-file.
* <a href="#whence.cur" id="whence.cur"></a> `cur` \
Seek relative to current position.
* <a href="#whence.end" id="whence.end"></a> `end` \
Seek relative to end-of-file.
## <a href="#dircookie" id="dircookie"></a> `dircookie`: `u64`
A reference to the offset of a directory entry.
The value 0 signifies the start of the directory.
- **Size**: 8
- **Alignment**: 8
## <a href="#dirnamlen" id="dirnamlen"></a> `dirnamlen`: `u32`
The type for the [`dirent::d_namlen`](#dirent.d_namlen) field of [`dirent`](#dirent) struct.
- **Size**: 4
- **Alignment**: 4
## <a href="#inode" id="inode"></a> `inode`: `u64`
File serial number that is unique within its file system.
- **Size**: 8
- **Alignment**: 8
## <a href="#filetype" id="filetype"></a> `filetype`: `Variant`
The type of a file descriptor or file.
- **Size**: 1
- **Alignment**: 1
- **Cases**:
* <a href="#filetype.unknown" id="filetype.unknown"></a> `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" id="filetype.block_device"></a> `block_device` \
The file descriptor or file refers to a block device inode.
* <a href="#filetype.character_device" id="filetype.character_device"></a> `character_device` \
The file descriptor or file refers to a character device inode.
* <a href="#filetype.directory" id="filetype.directory"></a> `directory` \
The file descriptor or file refers to a directory inode.
* <a href="#filetype.regular_file" id="filetype.regular_file"></a> `regular_file` \
The file descriptor or file refers to a regular file inode.
* <a href="#filetype.socket_dgram" id="filetype.socket_dgram"></a> `socket_dgram` \
The file descriptor or file refers to a datagram socket.
* <a href="#filetype.socket_stream" id="filetype.socket_stream"></a> `socket_stream` \
The file descriptor or file refers to a byte-stream socket.
* <a href="#filetype.symbolic_link" id="filetype.symbolic_link"></a> `symbolic_link` \
The file refers to a symbolic link inode.
## <a href="#dirent" id="dirent"></a> `dirent`: `Record`
A directory entry.
- **Size**: 24
- **Alignment**: 8
* (Offset: **0**) <a href="#dirent.d_next" id="dirent.d_next"></a> `d_next`: [`dircookie`](#dircookie) \
The offset of the next directory entry stored in this directory.
* (Offset: **8**) <a href="#dirent.d_ino" id="dirent.d_ino"></a> `d_ino`: [`inode`](#inode) \
The serial number of the file referred to by this directory entry.
* (Offset: **16**) <a href="#dirent.d_namlen" id="dirent.d_namlen"></a> `d_namlen`: [`dirnamlen`](#dirnamlen) \
The length of the name of the directory entry.
* (Offset: **20**) <a href="#dirent.d_type" id="dirent.d_type"></a> `d_type`: [`filetype`](#filetype) \
The type of the file referred to by this directory entry.
## <a href="#advice" id="advice"></a> `advice`: `Variant`
File or memory access pattern advisory information.
- **Size**: 1
- **Alignment**: 1
- **Cases**:
* <a href="#advice.normal" id="advice.normal"></a> `normal` \
The application has no advice to give on its behavior with respect to the specified data.
* <a href="#advice.sequential" id="advice.sequential"></a> `sequential` \
The application expects to access the specified data sequentially from lower offsets to higher offsets.
* <a href="#advice.random" id="advice.random"></a> `random` \
The application expects to access the specified data in a random order.
* <a href="#advice.willneed" id="advice.willneed"></a> `willneed` \
The application expects to access the specified data in the near future.
* <a href="#advice.dontneed" id="advice.dontneed"></a> `dontneed` \
The application expects that it will not access the specified data in the near future.
* <a href="#advice.noreuse" id="advice.noreuse"></a> `noreuse` \
The application expects to access the specified data once and then not reuse it thereafter.
## <a href="#fdflags" id="fdflags"></a> `fdflags`: `Record`
File descriptor flags.
- **Size**: 2
- **Alignment**: 2
* (Bit: **0**) <a href="#fdflags.append" id="fdflags.append"></a> `append`: `bool` \
Append mode: Data written to the file is always appended to the file's end.
* (Bit: **1**) <a href="#fdflags.dsync" id="fdflags.dsync"></a> `dsync`: `bool` \
Write according to synchronized I/O data integrity completion. Only the data stored in the file is synchronized.
* (Bit: **2**) <a href="#fdflags.nonblock" id="fdflags.nonblock"></a> `nonblock`: `bool` \
Non-blocking mode.
* (Bit: **3**) <a href="#fdflags.rsync" id="fdflags.rsync"></a> `rsync`: `bool` \
Synchronized read I/O operations.
* (Bit: **4**) <a href="#fdflags.sync" id="fdflags.sync"></a> `sync`: `bool` \
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" id="fdstat"></a> `fdstat`: `Record`
File descriptor attributes.
- **Size**: 24
- **Alignment**: 8
* (Offset: **0**) <a href="#fdstat.fs_filetype" id="fdstat.fs_filetype"></a> `fs_filetype`: [`filetype`](#filetype) \
File type.
* (Offset: **2**) <a href="#fdstat.fs_flags" id="fdstat.fs_flags"></a> `fs_flags`: [`fdflags`](#fdflags) \
File descriptor flags.
* (Offset: **8**) <a href="#fdstat.fs_rights_base" id="fdstat.fs_rights_base"></a> `fs_rights_base`: [`rights`](#rights) \
Rights that apply to this file descriptor.
* (Offset: **16**) <a href="#fdstat.fs_rights_inheriting" id="fdstat.fs_rights_inheriting"></a> `fs_rights_inheriting`: [`rights`](#rights) \
Maximum set of rights that may be installed on new file descriptors that
are created through this file descriptor, e.g., through [`path_open`](#path_open).
## <a href="#device" id="device"></a> `device`: `u64`
Identifier for a device containing a file system. Can be used in combination
with [`inode`](#inode) to uniquely identify a file or directory in the filesystem.
- **Size**: 8
- **Alignment**: 8
## <a href="#fstflags" id="fstflags"></a> `fstflags`: `Record`
Which file time attributes to adjust.
- **Size**: 2
- **Alignment**: 2
* (Bit: **0**) <a href="#fstflags.atim" id="fstflags.atim"></a> `atim`: `bool` \
Adjust the last data access timestamp to the value stored in [`filestat::atim`](#filestat.atim).
* (Bit: **1**) <a href="#fstflags.atim_now" id="fstflags.atim_now"></a> `atim_now`: `bool` \
Adjust the last data access timestamp to the time of clock [`clockid::realtime`](#clockid.realtime).
* (Bit: **2**) <a href="#fstflags.mtim" id="fstflags.mtim"></a> `mtim`: `bool` \
Adjust the last data modification timestamp to the value stored in [`filestat::mtim`](#filestat.mtim).
* (Bit: **3**) <a href="#fstflags.mtim_now" id="fstflags.mtim_now"></a> `mtim_now`: `bool` \
Adjust the last data modification timestamp to the time of clock [`clockid::realtime`](#clockid.realtime).
## <a href="#lookupflags" id="lookupflags"></a> `lookupflags`: `Record`
Flags determining the method of how paths are resolved.
- **Size**: 4
- **Alignment**: 4
* (Bit: **0**) <a href="#lookupflags.symlink_follow" id="lookupflags.symlink_follow"></a> `symlink_follow`: `bool` \
As long as the resolved path corresponds to a symbolic link, it is expanded.
## <a href="#oflags" id="oflags"></a> `oflags`: `Record`
Open flags used by [`path_open`](#path_open).
- **Size**: 2
- **Alignment**: 2
* (Bit: **0**) <a href="#oflags.creat" id="oflags.creat"></a> `creat`: `bool` \
Create file if it does not exist.
* (Bit: **1**) <a href="#oflags.directory" id="oflags.directory"></a> `directory`: `bool` \
Fail if not a directory.
* (Bit: **2**) <a href="#oflags.excl" id="oflags.excl"></a> `excl`: `bool` \
Fail if file already exists.
* (Bit: **3**) <a href="#oflags.trunc" id="oflags.trunc"></a> `trunc`: `bool` \
Truncate file to size 0.
## <a href="#linkcount" id="linkcount"></a> `linkcount`: `u64`
Number of hard links to an inode.
- **Size**: 8
- **Alignment**: 8
## <a href="#filestat" id="filestat"></a> `filestat`: `Record`
File attributes.
- **Size**: 64
- **Alignment**: 8
* (Offset: **0**) <a href="#filestat.dev" id="filestat.dev"></a> `dev`: [`device`](#device) \
Device ID of device containing the file.
* (Offset: **8**) <a href="#filestat.ino" id="filestat.ino"></a> `ino`: [`inode`](#inode) \
File serial number.
* (Offset: **16**) <a href="#filestat.filetype" id="filestat.filetype"></a> `filetype`: [`filetype`](#filetype) \
File type.
* (Offset: **24**) <a href="#filestat.nlink" id="filestat.nlink"></a> `nlink`: [`linkcount`](#linkcount) \
Number of hard links to the file.
* (Offset: **32**) <a href="#filestat.size" id="filestat.size"></a> `size`: [`filesize`](#filesize) \
For regular files, the file size in bytes. For symbolic links, the length in bytes of the pathname contained in the symbolic link.
* (Offset: **40**) <a href="#filestat.atim" id="filestat.atim"></a> `atim`: [`timestamp`](#timestamp) \
Last data access timestamp.
This can be 0 if the underlying platform doesn't provide suitable
timestamp for this file.
* (Offset: **48**) <a href="#filestat.mtim" id="filestat.mtim"></a> `mtim`: [`timestamp`](#timestamp) \
Last data modification timestamp.
This can be 0 if the underlying platform doesn't provide suitable
timestamp for this file.
* (Offset: **56**) <a href="#filestat.ctim" id="filestat.ctim"></a> `ctim`: [`timestamp`](#timestamp) \
Last file status change timestamp.
This can be 0 if the underlying platform doesn't provide suitable
timestamp for this file.
## <a href="#userdata" id="userdata"></a> `userdata`: `u64`
User-provided value that may be attached to objects that is retained when
extracted from the implementation.
- **Size**: 8
- **Alignment**: 8
## <a href="#eventtype" id="eventtype"></a> `eventtype`: `Variant`
Type of a subscription to an event or its occurrence.
- **Size**: 1
- **Alignment**: 1
- **Cases**:
* <a href="#eventtype.clock" id="eventtype.clock"></a> `clock` \
The time value of clock [`subscription_clock::id`](#subscription_clock.id) has
reached timestamp [`subscription_clock::timeout`](#subscription_clock.timeout).
* <a href="#eventtype.fd_read" id="eventtype.fd_read"></a> `fd_read` \
File descriptor [`subscription_fd_readwrite::file_descriptor`](#subscription_fd_readwrite.file_descriptor) has data
available for reading. This event always triggers for regular files.
* <a href="#eventtype.fd_write" id="eventtype.fd_write"></a> `fd_write` \
File descriptor [`subscription_fd_readwrite::file_descriptor`](#subscription_fd_readwrite.file_descriptor) has capacity
available for writing. This event always triggers for regular files.
## <a href="#eventrwflags" id="eventrwflags"></a> `eventrwflags`: `Record`
The state of the file descriptor subscribed to with
[`eventtype::fd_read`](#eventtype.fd_read) or [`eventtype::fd_write`](#eventtype.fd_write).
- **Size**: 2
- **Alignment**: 2
* (Bit: **0**) <a href="#eventrwflags.fd_readwrite_hangup" id="eventrwflags.fd_readwrite_hangup"></a> `fd_readwrite_hangup`: `bool` \
The peer of this socket has closed or disconnected.
## <a href="#event_fd_readwrite" id="event_fd_readwrite"></a> `event_fd_readwrite`: `Record`
The contents of an [`event`](#event) when type is [`eventtype::fd_read`](#eventtype.fd_read) or
[`eventtype::fd_write`](#eventtype.fd_write).
- **Size**: 16
- **Alignment**: 8
* (Offset: **0**) <a href="#event_fd_readwrite.nbytes" id="event_fd_readwrite.nbytes"></a> `nbytes`: [`filesize`](#filesize) \
The number of bytes available for reading or writing.
* (Offset: **8**) <a href="#event_fd_readwrite.flags" id="event_fd_readwrite.flags"></a> `flags`: [`eventrwflags`](#eventrwflags) \
The state of the file descriptor.
## <a href="#event" id="event"></a> `event`: `Record`
An event that occurred.
- **Size**: 32
- **Alignment**: 8
* (Offset: **0**) <a href="#event.userdata" id="event.userdata"></a> `userdata`: [`userdata`](#userdata) \
User-provided value that got attached to [`subscription::userdata`](#subscription.userdata).
* (Offset: **8**) <a href="#event.error" id="event.error"></a> `error`: [`errno`](#errno) \
If non-zero, an error that occurred while processing the subscription request.
* (Offset: **10**) <a href="#event.type" id="event.type"></a> `type`: [`eventtype`](#eventtype) \
The type of event that occured
* (Offset: **16**) <a href="#event.fd_readwrite" id="event.fd_readwrite"></a> `fd_readwrite`: [`event_fd_readwrite`](#event_fd_readwrite) \
The contents of the event, if it is an [`eventtype::fd_read`](#eventtype.fd_read) or
[`eventtype::fd_write`](#eventtype.fd_write). [`eventtype::clock`](#eventtype.clock) events ignore this field.
## <a href="#subclockflags" id="subclockflags"></a> `subclockflags`: `Record`
Flags determining how to interpret the timestamp provided in
[`subscription_clock::timeout`](#subscription_clock.timeout).
- **Size**: 2
- **Alignment**: 2
* (Bit: **0**) <a href="#subclockflags.subscription_clock_abstime" id="subclockflags.subscription_clock_abstime"></a> `subscription_clock_abstime`: `bool` \
If set, treat the timestamp provided in
[`subscription_clock::timeout`](#subscription_clock.timeout) as an absolute timestamp of clock
[`subscription_clock::id`](#subscription_clock.id). If clear, treat the timestamp
provided in [`subscription_clock::timeout`](#subscription_clock.timeout) relative to the
current time value of clock [`subscription_clock::id`](#subscription_clock.id).
## <a href="#subscription_clock" id="subscription_clock"></a> `subscription_clock`: `Record`
The contents of a [`subscription`](#subscription) when type is [`eventtype::clock`](#eventtype.clock).
- **Size**: 32
- **Alignment**: 8
* (Offset: **0**) <a href="#subscription_clock.id" id="subscription_clock.id"></a> `id`: [`clockid`](#clockid) \
The clock against which to compare the timestamp.
* (Offset: **8**) <a href="#subscription_clock.timeout" id="subscription_clock.timeout"></a> `timeout`: [`timestamp`](#timestamp) \
The absolute or relative timestamp.
* (Offset: **16**) <a href="#subscription_clock.precision" id="subscription_clock.precision"></a> `precision`: [`timestamp`](#timestamp) \
The amount of time that the implementation may wait additionally
to coalesce with other events.
* (Offset: **24**) <a href="#subscription_clock.flags" id="subscription_clock.flags"></a> `flags`: [`subclockflags`](#subclockflags) \
Flags specifying whether the timeout is absolute or relative
## <a href="#subscription_fd_readwrite" id="subscription_fd_readwrite"></a> `subscription_fd_readwrite`: `Record`
The contents of a [`subscription`](#subscription) when type is type is
[`eventtype::fd_read`](#eventtype.fd_read) or [`eventtype::fd_write`](#eventtype.fd_write).
- **Size**: 4
- **Alignment**: 4
* (Offset: **0**) <a href="#subscription_fd_readwrite.file_descriptor" id="subscription_fd_readwrite.file_descriptor"></a> `file_descriptor`: [`fd`](#fd) \
The file descriptor on which to wait for it to become ready for reading or writing.
## <a href="#subscription_u" id="subscription_u"></a> `subscription_u`: `Variant`
The contents of a [`subscription`](#subscription).
- **Size**: 40
- **Alignment**: 8
### Variants
- *size*: **40**; *align*: 8; *tag_size*: 1
- **Cases**:
* <a href="#subscription_u.clock" id="subscription_u.clock"></a> `clock`: [`subscription_clock`](#subscription_clock)
* <a href="#subscription_u.fd_read" id="subscription_u.fd_read"></a> `fd_read`: [`subscription_fd_readwrite`](#subscription_fd_readwrite)
* <a href="#subscription_u.fd_write" id="subscription_u.fd_write"></a> `fd_write`: [`subscription_fd_readwrite`](#subscription_fd_readwrite)
## <a href="#subscription" id="subscription"></a> `subscription`: `Record`
Subscription to an event.
- **Size**: 48
- **Alignment**: 8
* (Offset: **0**) <a href="#subscription.userdata" id="subscription.userdata"></a> `userdata`: [`userdata`](#userdata) \
User-provided value that is attached to the subscription in the
implementation and returned through [`event::userdata`](#event.userdata).
* (Offset: **8**) <a href="#subscription.u" id="subscription.u"></a> `u`: [`subscription_u`](#subscription_u) \
The type of the event to which to subscribe, and its contents
## <a href="#exitcode" id="exitcode"></a> `exitcode`: `u32`
Exit code generated by a process when exiting.
- **Size**: 4
- **Alignment**: 4
## <a href="#signal" id="signal"></a> `signal`: `Variant`
Signal condition.
- **Size**: 1
- **Alignment**: 1
- **Cases**:
* <a href="#signal.none" id="signal.none"></a> `none` \
No signal. Note that POSIX has special semantics for `kill(pid, 0)`,
so this value is reserved.
* <a href="#signal.hup" id="signal.hup"></a> `hup` \
Hangup.
Action: Terminates the process.
* <a href="#signal.int" id="signal.int"></a> `int` \
Terminate interrupt signal.
Action: Terminates the process.
* <a href="#signal.quit" id="signal.quit"></a> `quit` \
Terminal quit signal.
Action: Terminates the process.
* <a href="#signal.ill" id="signal.ill"></a> `ill` \
Illegal instruction.
Action: Terminates the process.
* <a href="#signal.trap" id="signal.trap"></a> `trap` \
Trace/breakpoint trap.
Action: Terminates the process.
* <a href="#signal.abrt" id="signal.abrt"></a> `abrt` \
Process abort signal.
Action: Terminates the process.
* <a href="#signal.bus" id="signal.bus"></a> `bus` \
Access to an undefined portion of a memory object.
Action: Terminates the process.
* <a href="#signal.fpe" id="signal.fpe"></a> `fpe` \
Erroneous arithmetic operation.
Action: Terminates the process.
* <a href="#signal.kill" id="signal.kill"></a> `kill` \
Kill.
Action: Terminates the process.
* <a href="#signal.usr1" id="signal.usr1"></a> `usr1` \
User-defined signal 1.
Action: Terminates the process.
* <a href="#signal.segv" id="signal.segv"></a> `segv` \
Invalid memory reference.
Action: Terminates the process.
* <a href="#signal.usr2" id="signal.usr2"></a> `usr2` \
User-defined signal 2.
Action: Terminates the process.
* <a href="#signal.pipe" id="signal.pipe"></a> `pipe` \
Write on a pipe with no one to read it.
Action: Ignored.
* <a href="#signal.alrm" id="signal.alrm"></a> `alrm` \
Alarm clock.
Action: Terminates the process.
* <a href="#signal.term" id="signal.term"></a> `term` \
Termination signal.
Action: Terminates the process.
* <a href="#signal.chld" id="signal.chld"></a> `chld` \
Child process terminated, stopped, or continued.
Action: Ignored.
* <a href="#signal.cont" id="signal.cont"></a> `cont` \
Continue executing, if stopped.
Action: Continues executing, if stopped.
* <a href="#signal.stop" id="signal.stop"></a> `stop` \
Stop executing.
Action: Stops executing.
* <a href="#signal.tstp" id="signal.tstp"></a> `tstp` \
Terminal stop signal.
Action: Stops executing.
* <a href="#signal.ttin" id="signal.ttin"></a> `ttin` \
Background process attempting read.
Action: Stops executing.
* <a href="#signal.ttou" id="signal.ttou"></a> `ttou` \
Background process attempting write.
Action: Stops executing.
* <a href="#signal.urg" id="signal.urg"></a> `urg` \
High bandwidth data is available at a socket.
Action: Ignored.
* <a href="#signal.xcpu" id="signal.xcpu"></a> `xcpu` \
CPU time limit exceeded.
Action: Terminates the process.
* <a href="#signal.xfsz" id="signal.xfsz"></a> `xfsz` \
File size limit exceeded.
Action: Terminates the process.
* <a href="#signal.vtalrm" id="signal.vtalrm"></a> `vtalrm` \
Virtual timer expired.
Action: Terminates the process.
* <a href="#signal.prof" id="signal.prof"></a> `prof` \
Profiling timer expired.
Action: Terminates the process.
* <a href="#signal.winch" id="signal.winch"></a> `winch` \
Window changed.
Action: Ignored.
* <a href="#signal.poll" id="signal.poll"></a> `poll` \
I/O possible.
Action: Terminates the process.
* <a href="#signal.pwr" id="signal.pwr"></a> `pwr` \
Power failure.
Action: Terminates the process.
* <a href="#signal.sys" id="signal.sys"></a> `sys` \
Bad system call.
Action: Terminates the process.
## <a href="#riflags" id="riflags"></a> `riflags`: `Record`
Flags provided to [`sock_recv`](#sock_recv).
- **Size**: 2
- **Alignment**: 2
* (Bit: **0**) <a href="#riflags.recv_peek" id="riflags.recv_peek"></a> `recv_peek`: `bool` \
Returns the message without removing it from the socket's receive queue.
* (Bit: **1**) <a href="#riflags.recv_waitall" id="riflags.recv_waitall"></a> `recv_waitall`: `bool` \
On byte-stream sockets, block until the full amount of data can be returned.
## <a href="#roflags" id="roflags"></a> `roflags`: `Record`
Flags returned by [`sock_recv`](#sock_recv).
- **Size**: 2
- **Alignment**: 2
* (Bit: **0**) <a href="#roflags.recv_data_truncated" id="roflags.recv_data_truncated"></a> `recv_data_truncated`: `bool` \
Returned by [`sock_recv`](#sock_recv): Message data has been truncated.
## <a href="#siflags" id="siflags"></a> `siflags`: `u16`
Flags provided to [`sock_send`](#sock_send). As there are currently no flags
defined, it must be set to zero.
- **Size**: 2
- **Alignment**: 2
## <a href="#sdflags" id="sdflags"></a> `sdflags`: `Record`
Which channels on a socket to shut down.
- **Size**: 1
- **Alignment**: 1
* (Bit: **0**) <a href="#sdflags.rd" id="sdflags.rd"></a> `rd`: `bool` \
Disables further receive operations.
* (Bit: **1**) <a href="#sdflags.wr" id="sdflags.wr"></a> `wr`: `bool` \
Disables further send operations.
## <a href="#preopentype" id="preopentype"></a> `preopentype`: `Variant`
Identifiers for preopened capabilities.
- **Size**: 1
- **Alignment**: 1
- **Cases**:
* <a href="#preopentype.dir" id="preopentype.dir"></a> `dir` \
A pre-opened directory.
## <a href="#prestat_dir" id="prestat_dir"></a> `prestat_dir`: `Record`
The contents of a [`prestat`](#prestat) when type is [`preopentype::dir`](#preopentype.dir).
- **Size**: 4
- **Alignment**: 4
* (Offset: **0**) <a href="#prestat_dir.pr_name_len" id="prestat_dir.pr_name_len"></a> `pr_name_len`: [`size`](#size) \
The length of the directory name for use with [`fd_prestat_dir_name`](#fd_prestat_dir_name).
## <a href="#prestat" id="prestat"></a> `prestat`: `Variant`
Information about a pre-opened capability.
- **Size**: 8
- **Alignment**: 4
### Variants
- *size*: **8**; *align*: 4; *tag_size*: 1
- **Cases**:
* <a href="#prestat.dir" id="prestat.dir"></a> `dir`: [`prestat_dir`](#prestat_dir)