diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 52a7b9e..d42ff77 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,6 +18,6 @@ jobs: ./wit-deps lock git add -N wit/deps git diff --exit-code - - uses: WebAssembly/wit-abi-up-to-date@v21 + - uses: WebAssembly/wit-abi-up-to-date@v22 with: - wit-bindgen: '0.28.0' + wit-bindgen: '0.33.0' diff --git a/imports.md b/imports.md index ba18125..6d958ee 100644 --- a/imports.md +++ b/imports.md @@ -1,20 +1,20 @@ -
wasi:io/error@0.2.1
wasi:io/poll@0.2.1
wasi:io/streams@0.2.1
wasi:clocks/wall-clock@0.2.1
wasi:filesystem/types@0.2.1
wasi:filesystem/preopens@0.2.1
wasi:io/error@0.2.2
wasi:io/poll@0.2.2
wasi:io/streams@0.2.2
wasi:clocks/wall-clock@0.2.2
wasi:filesystem/types@0.2.2
wasi:filesystem/preopens@0.2.2
resource error
resource error
A resource which represents some error information.
The only method provided by this resource is to-debug-string
,
which provides some human-readable information about the error.
option<wasi:filesystem/types/error-code>The set of functions which can "downcast" an error
into a more
concrete type is open.
Functions
-[method]error.to-debug-string: func
+[method]error.to-debug-string: func
Returns a string that is suitable to assist humans in debugging
this error.
WARNING: The returned string should not be consumed mechanically!
@@ -38,41 +38,41 @@ details. Parsing this string is a major platform-compatibility
hazard.
Params
Return values
-Import interface wasi:io/poll@0.2.1
+Import interface wasi:io/poll@0.2.2
A poll API intended to let users wait for I/O events on multiple handles
at once.
Types
-resource pollable
+resource pollable
pollable
represents a single I/O event which may be ready, or not.
Functions
-[method]pollable.ready: func
+[method]pollable.ready: func
Return the readiness of a pollable. This function never blocks.
Returns true
when the pollable is ready, and false
otherwise.
Params
Return values
-[method]pollable.block: func
+[method]pollable.block: func
block
returns immediately if the pollable is ready, and otherwise
blocks until ready.
This function is equivalent to calling poll.poll
on a list
containing only this pollable.
Params
-poll: func
+poll: func
Poll for completion on a set of pollables.
This function takes a list of pollables, which identify I/O sources of
interest, and waits until one or more of the events is ready for I/O.
@@ -91,42 +91,44 @@ the pollables has an error, it is indicated by marking the source as
being ready for I/O.
Params
Return values
-Import interface wasi:io/streams@0.2.1
+Import interface wasi:io/streams@0.2.2
WASI I/O is an I/O abstraction API which is currently focused on providing
stream types.
In the future, the component model is expected to add built-in stream types;
when it does, they are expected to subsume this API.
Types
-type error
+type error
-#### `type pollable`
+#### `type pollable`
[`pollable`](#pollable)
-#### `variant stream-error`
+#### `variant stream-error`
An error for input-stream and output-stream operations.
Variant Cases
-
-
last-operation-failed
: own<error
>
+last-operation-failed
: own<error
>
The last operation (a write or flush) failed before completion.
More information is available in the error
payload.
+After this, the stream will be closed. All future operations return
+stream-error::closed
.
-
-
+
The stream is closed: no more input will be accepted by the
stream. A closed output-stream will return this error on all
future operations.
-resource input-stream
+resource input-stream
An input bytestream.
input-stream
s are non-blocking to the extent practical on underlying
platforms. I/O operations always return promptly; if fewer bytes are
@@ -134,7 +136,7 @@ promptly available than requested, they return the number of bytes promptly
available, which could even be zero. To wait for data to be available,
use the subscribe
function to obtain a pollable
which can be polled
for using wasi:io/poll
.
-resource output-stream
+resource output-stream
An output bytestream.
output-stream
s are non-blocking to the extent practical on
underlying platforms. Except where specified otherwise, I/O operations also
@@ -146,7 +148,7 @@ polled for using wasi:io/poll
.
progress may result in the data being lost. Before dropping the stream,
be sure to fully flush your writes.
Functions
-[method]input-stream.read: func
+[method]input-stream.read: func
Perform a non-blocking read from the stream.
When the source of a read
is binary data, the bytes from the source
are returned verbatim. When the source of a read
is known to the
@@ -170,51 +172,51 @@ as a return value by the callee. The callee may return a list of bytes
less than len
in size while more bytes are available for reading.
Params
-self
: borrow<input-stream
>
-len
: u64
+self
: borrow<input-stream
>
+len
: u64
Return values
-- result<list<
u8
>, stream-error
>
+- result<list<
u8
>, stream-error
>
-[method]input-stream.blocking-read: func
+[method]input-stream.blocking-read: func
Read bytes from a stream, after blocking until at least one byte can
be read. Except for blocking, behavior is identical to read
.
Params
-self
: borrow<input-stream
>
-len
: u64
+self
: borrow<input-stream
>
+len
: u64
Return values
-- result<list<
u8
>, stream-error
>
+- result<list<
u8
>, stream-error
>
-[method]input-stream.skip: func
+[method]input-stream.skip: func
Skip bytes from a stream. Returns number of bytes skipped.
Behaves identical to read
, except instead of returning a list
of bytes, returns the number of bytes consumed from the stream.
Params
-self
: borrow<input-stream
>
-len
: u64
+self
: borrow<input-stream
>
+len
: u64
Return values
-- result<
u64
, stream-error
>
+- result<
u64
, stream-error
>
-[method]input-stream.blocking-skip: func
+[method]input-stream.blocking-skip: func
Skip bytes from a stream, after blocking until at least one byte
can be skipped. Except for blocking behavior, identical to skip
.
Params
-self
: borrow<input-stream
>
-len
: u64
+self
: borrow<input-stream
>
+len
: u64
Return values
-- result<
u64
, stream-error
>
+- result<
u64
, stream-error
>
-[method]input-stream.subscribe: func
+[method]input-stream.subscribe: func
Create a pollable
which will resolve once either the specified stream
has bytes available to read or the other end of the stream has been
closed.
@@ -223,13 +225,13 @@ Implementations may trap if the input-stream
pollable
s created with this function are dropped.
Params
-self
: borrow<input-stream
>
+self
: borrow<input-stream
>
Return values
-[method]output-stream.check-write: func
+[method]output-stream.check-write: func
Check readiness for writing. This function never blocks.
Returns the number of bytes permitted for the next call to write
,
or an error. Calling write
with more bytes than this function has
@@ -239,13 +241,13 @@ become ready when this function will report at least 1 byte, or an
error.
Params
-self
: borrow<output-stream
>
+self
: borrow<output-stream
>
Return values
-- result<
u64
, stream-error
>
+- result<
u64
, stream-error
>
-[method]output-stream.write: func
+[method]output-stream.write: func
Perform a write. This function never blocks.
When the destination of a write
is binary data, the bytes from
contents
are written verbatim. When the destination of a write
is
@@ -258,14 +260,14 @@ length of less than or equal to n. Otherwise, this function will trap.
the last call to check-write provided a permit.
Params
-self
: borrow<output-stream
>
-contents
: list<u8
>
+self
: borrow<output-stream
>
+contents
: list<u8
>
Return values
-- result<_,
stream-error
>
+- result<_,
stream-error
>
-[method]output-stream.blocking-write-and-flush: func
+[method]output-stream.blocking-write-and-flush: func
Perform a write of up to 4096 bytes, and then flush the stream. Block
until all of these operations are complete, or an error occurs.
This is a convenience wrapper around the use of check-write
,
@@ -289,14 +291,14 @@ let _ = this.check-write(); // eliding error handling
self
: borrow<output-stream
>contents
: list<u8
>self
: borrow<output-stream
>contents
: list<u8
>stream-error
>stream-error
>[method]output-stream.flush: func
[method]output-stream.flush: func
Request to flush buffered output. This function never blocks.
This tells the output-stream that the caller intends any buffered
output to be flushed. the output which is expected to be flushed
@@ -307,24 +309,24 @@ completed. The subscribe
pollable will become ready when the
flush has completed and the stream can accept more writes.
self
: borrow<output-stream
>self
: borrow<output-stream
>stream-error
>stream-error
>[method]output-stream.blocking-flush: func
[method]output-stream.blocking-flush: func
Request to flush buffered output, and block until flush completes and stream is ready for writing again.
self
: borrow<output-stream
>self
: borrow<output-stream
>stream-error
>stream-error
>[method]output-stream.subscribe: func
[method]output-stream.subscribe: func
Create a pollable
which will resolve once the output-stream
is ready for more writing, or an error has occurred. When this
pollable is ready, check-write
will return ok(n)
with n>0, or an
@@ -335,13 +337,13 @@ Implementations may trap if the output-stream
s created with this function are dropped.pollable
self
: borrow<output-stream
>self
: borrow<output-stream
>[method]output-stream.write-zeroes: func
[method]output-stream.write-zeroes: func
Write zeroes to a stream.
This should be used precisely like write
with the exact same
preconditions (must use check-write first), but instead of
@@ -349,14 +351,14 @@ passing a list of bytes, you simply pass the number of zero-bytes
that should be written.
self
: borrow<output-stream
>len
: u64
self
: borrow<output-stream
>len
: u64
stream-error
>stream-error
>[method]output-stream.blocking-write-zeroes-and-flush: func
[method]output-stream.blocking-write-zeroes-and-flush: func
Perform a write of up to 4096 zeroes, and then flush the stream. Block until all of these operations are complete, or an error occurs.
@@ -380,14 +382,14 @@ let _ = this.check-write(); // eliding error handlingself
: borrow<output-stream
>len
: u64
self
: borrow<output-stream
>len
: u64
stream-error
>stream-error
>[method]output-stream.splice: func
[method]output-stream.splice: func
Read from one stream and write to another.
The behavior of splice is equivalent to:
len
.
self
: borrow<output-stream
>src
: borrow<input-stream
>len
: u64
self
: borrow<output-stream
>src
: borrow<input-stream
>len
: u64
u64
, stream-error
>u64
, stream-error
>[method]output-stream.blocking-splice: func
[method]output-stream.blocking-splice: func
Read from one stream and write to another, with blocking.
This is similar to splice
, except that it blocks until the
output-stream
is ready for writing, and the input-stream
is ready for reading, before performing the splice
.
self
: borrow<output-stream
>src
: borrow<input-stream
>len
: u64
self
: borrow<output-stream
>src
: borrow<input-stream
>len
: u64
u64
, stream-error
>u64
, stream-error
>WASI Wall Clock is a clock API intended to let users query the current time. The name "wall" makes an analogy to a "clock on the wall", which is not necessarily monotonic as it may be reset.
@@ -438,16 +440,16 @@ monotonic, making it unsuitable for measuring elapsed time.It is intended for reporting the current date and time for humans.
record datetime
record datetime
A time and date in seconds plus nanoseconds.
now: func
now: func
Read the current value of the clock.
This clock is not monotonic, therefore calling this function repeatedly will not necessarily produce a sequence of non-decreasing values.
@@ -457,16 +459,16 @@ also known as Unix Time.The nanoseconds field of the output is always less than 1000000000.
resolution: func
resolution: func
Query the resolution of the clock.
The nanoseconds field of the output is always less than 1000000000.
WASI filesystem is a filesystem API primarily intended to let users run WASI programs that access their files on their existing filesystems, without significant overhead.
@@ -486,75 +488,75 @@ underlying filesystem, the function fails with WASI filesystem path resolution.type input-stream
type input-stream
-#### `type output-stream` +#### `type output-stream` [`output-stream`](#output_stream)
-#### `type error` +#### `type error` [`error`](#error)
-#### `type datetime` +#### `type datetime` [`datetime`](#datetime)
-#### `type filesize` +#### `type filesize` `u64`
File size or length of a region within a file. -
enum descriptor-type
enum descriptor-type
The type of a filesystem object referenced by a descriptor.
Note: This was called filetype
in earlier versions of WASI.
The type of the descriptor or file is unknown or is different from any of the other types specified.
The descriptor refers to a block device inode.
The descriptor refers to a character device inode.
The descriptor refers to a directory inode.
The descriptor refers to a named pipe.
The file refers to a symbolic link inode.
The descriptor refers to a regular file inode.
The descriptor refers to a socket.
flags descriptor-flags
flags descriptor-flags
Descriptor flags.
Note: This was called fdflags
in earlier versions of WASI.
Read mode: Data can be read.
Write mode: Data can be written to.
Request that writes be performed according to synchronized I/O file integrity completion. The data stored in the file and the file's metadata are synchronized. This is similar to `O_SYNC` in POSIX. @@ -563,7 +565,7 @@ WASI. At this time, it should be interpreted as a request, and not a requirement.
Request that writes be performed according to synchronized I/O data integrity completion. Only the data stored in the file is synchronized. This is similar to `O_DSYNC` in POSIX. @@ -572,7 +574,7 @@ WASI. At this time, it should be interpreted as a request, and not a requirement.
Requests that reads be performed at the same level of integrity requested for writes. This is similar to `O_RSYNC` in POSIX.
The precise semantics of this operation have not yet been defined for @@ -580,7 +582,7 @@ WASI. At this time, it should be interpreted as a request, and not a requirement.
Mutating directories mode: Directory contents may be mutated.
When this flag is unset on a descriptor, operations using the descriptor which would create, rename, delete, modify the data or @@ -590,107 +592,107 @@ they would otherwise succeed.
This may only be set on directories.
flags path-flags
flags path-flags
Flags determining the method of how paths are resolved.
symlink-follow
: As long as the resolved path corresponds to a symbolic link, it is +
symlink-follow
: As long as the resolved path corresponds to a symbolic link, it is expanded.
flags open-flags
flags open-flags
Open flags used by open-at
.
Create file if it does not exist, similar to `O_CREAT` in POSIX.
Fail if not a directory, similar to `O_DIRECTORY` in POSIX.
Fail if file already exists, similar to `O_EXCL` in POSIX.
Truncate file to size 0, similar to `O_TRUNC` in POSIX.
type link-count
type link-count
u64
Number of hard links to an inode. -
record descriptor-stat
record descriptor-stat
File attributes.
Note: This was called filestat
in earlier versions of WASI.
type
: descriptor-type
type
: descriptor-type
File type.
Number of hard links to the file.
size
: filesize
size
: filesize
For regular files, the file size in bytes. For symbolic links, the length in bytes of the pathname contained in the symbolic link.
data-access-timestamp
: option<datetime
>
data-access-timestamp
: option<datetime
>
Last data access timestamp.
If the option
is none, the platform doesn't maintain an access
timestamp for this file.
data-modification-timestamp
: option<datetime
>
data-modification-timestamp
: option<datetime
>
Last data modification timestamp.
If the option
is none, the platform doesn't maintain a
modification timestamp for this file.
status-change-timestamp
: option<datetime
>
status-change-timestamp
: option<datetime
>
Last file status-change timestamp.
If the option
is none, the platform doesn't maintain a
status-change timestamp for this file.
variant new-timestamp
variant new-timestamp
When setting a timestamp, this gives the value to set it to.
Leave the timestamp set to its previous value.
Set the timestamp to the current time of the system clock associated with the filesystem.
timestamp
: datetime
timestamp
: datetime
Set the timestamp to the given value.
record directory-entry
record directory-entry
A directory entry.
type
: descriptor-type
type
: descriptor-type
The type of the file referred to by this directory entry.
The name of the object.
enum error-code
enum error-code
Error codes returned by functions, similar to errno
in POSIX.
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
@@ -698,211 +700,211 @@ merely for alignment with POSIX.
Permission denied, similar to `EACCES` in POSIX.
Resource unavailable, or operation would block, similar to `EAGAIN` and `EWOULDBLOCK` in POSIX.
Connection already in progress, similar to `EALREADY` in POSIX.
Bad descriptor, similar to `EBADF` in POSIX.
Device or resource busy, similar to `EBUSY` in POSIX.
Resource deadlock would occur, similar to `EDEADLK` in POSIX.
Storage quota exceeded, similar to `EDQUOT` in POSIX.
File exists, similar to `EEXIST` in POSIX.
File too large, similar to `EFBIG` in POSIX.
Illegal byte sequence, similar to `EILSEQ` in POSIX.
Operation in progress, similar to `EINPROGRESS` in POSIX.
Interrupted function, similar to `EINTR` in POSIX.
Invalid argument, similar to `EINVAL` in POSIX.
I/O error, similar to `EIO` in POSIX.
Is a directory, similar to `EISDIR` in POSIX.
Too many levels of symbolic links, similar to `ELOOP` in POSIX.
Too many links, similar to `EMLINK` in POSIX.
Message too large, similar to `EMSGSIZE` in POSIX.
Filename too long, similar to `ENAMETOOLONG` in POSIX.
No such device, similar to `ENODEV` in POSIX.
No such file or directory, similar to `ENOENT` in POSIX.
No locks available, similar to `ENOLCK` in POSIX.
Not enough space, similar to `ENOMEM` in POSIX.
No space left on device, similar to `ENOSPC` in POSIX.
Not a directory or a symbolic link to a directory, similar to `ENOTDIR` in POSIX.
Directory not empty, similar to `ENOTEMPTY` in POSIX.
State not recoverable, similar to `ENOTRECOVERABLE` in POSIX.
Not supported, similar to `ENOTSUP` and `ENOSYS` in POSIX.
Inappropriate I/O control operation, similar to `ENOTTY` in POSIX.
No such device or address, similar to `ENXIO` in POSIX.
Value too large to be stored in data type, similar to `EOVERFLOW` in POSIX.
Operation not permitted, similar to `EPERM` in POSIX.
Broken pipe, similar to `EPIPE` in POSIX.
Read-only file system, similar to `EROFS` in POSIX.
Invalid seek, similar to `ESPIPE` in POSIX.
Text file busy, similar to `ETXTBSY` in POSIX.
Cross-device link, similar to `EXDEV` in POSIX.
enum advice
enum advice
File or memory access pattern advisory information.
The application has no advice to give on its behavior with respect to the specified data.
The application expects to access the specified data sequentially from lower offsets to higher offsets.
The application expects to access the specified data in a random order.
The application expects to access the specified data in the near future.
The application expects that it will not access the specified data in the near future.
The application expects to access the specified data once and then not reuse it thereafter.
record metadata-hash-value
record metadata-hash-value
A 128-bit hash value, split into parts because wasm doesn't have a 128-bit integer type.
64 bits of a 128-bit hash value.
Another 64 bits of a 128-bit hash value.
resource descriptor
resource descriptor
A descriptor is a reference to a filesystem object, which may be a file, directory, named pipe, special file, or other object on which filesystem calls may be made.
-resource directory-entry-stream
resource directory-entry-stream
[method]descriptor.read-via-stream: func
[method]descriptor.read-via-stream: func
Return a stream for reading from a file, if available.
May fail with an error-code describing why the file cannot be read.
Multiple read, write, and append streams may be active on the same open @@ -910,81 +912,81 @@ file and they do not interfere with each other.
Note: This allows using read-stream
, which is similar to read
in POSIX.
self
: borrow<descriptor
>offset
: filesize
self
: borrow<descriptor
>offset
: filesize
input-stream
>, error-code
>input-stream
>, error-code
>[method]descriptor.write-via-stream: func
[method]descriptor.write-via-stream: func
Return a stream for writing to a file, if available.
May fail with an error-code describing why the file cannot be written.
Note: This allows using write-stream
, which is similar to write
in
POSIX.
self
: borrow<descriptor
>offset
: filesize
self
: borrow<descriptor
>offset
: filesize
output-stream
>, error-code
>output-stream
>, error-code
>[method]descriptor.append-via-stream: func
[method]descriptor.append-via-stream: func
Return a stream for appending to a file, if available.
May fail with an error-code describing why the file cannot be appended.
Note: This allows using write-stream
, which is similar to write
with
O_APPEND
in in POSIX.
self
: borrow<descriptor
>self
: borrow<descriptor
>output-stream
>, error-code
>output-stream
>, error-code
>[method]descriptor.advise: func
[method]descriptor.advise: func
Provide file advisory information on a descriptor.
This is similar to posix_fadvise
in POSIX.
self
: borrow<descriptor
>offset
: filesize
length
: filesize
advice
: advice
self
: borrow<descriptor
>offset
: filesize
length
: filesize
advice
: advice
error-code
>error-code
>[method]descriptor.sync-data: func
[method]descriptor.sync-data: func
Synchronize the data of a file to disk.
This function succeeds with no effect if the file descriptor is not opened for writing.
Note: This is similar to fdatasync
in POSIX.
self
: borrow<descriptor
>self
: borrow<descriptor
>error-code
>error-code
>[method]descriptor.get-flags: func
[method]descriptor.get-flags: func
Get flags associated with a descriptor.
Note: This returns similar flags to fcntl(fd, F_GETFL)
in POSIX.
Note: This returns the value that was the fs_flags
value returned
from fdstat_get
in earlier versions of WASI.
self
: borrow<descriptor
>self
: borrow<descriptor
>descriptor-flags
, error-code
>descriptor-flags
, error-code
>[method]descriptor.get-type: func
[method]descriptor.get-type: func
Get the dynamic type of a descriptor.
Note: This returns the same value as the type
field of the fd-stat
returned by stat
, stat-at
and similar.
fstat
in POSIX.
from fdstat_get
in earlier versions of WASI.
self
: borrow<descriptor
>self
: borrow<descriptor
>descriptor-type
, error-code
>descriptor-type
, error-code
>[method]descriptor.set-size: func
[method]descriptor.set-size: func
Adjust the size of an open file. If this increases the file's size, the extra bytes are filled with zeros.
Note: This was called fd_filestat_set_size
in earlier versions of WASI.
self
: borrow<descriptor
>size
: filesize
self
: borrow<descriptor
>size
: filesize
error-code
>error-code
>[method]descriptor.set-times: func
[method]descriptor.set-times: func
Adjust the timestamps of an open file or directory.
Note: This is similar to futimens
in POSIX.
Note: This was called fd_filestat_set_times
in earlier versions of WASI.
self
: borrow<descriptor
>data-access-timestamp
: new-timestamp
data-modification-timestamp
: new-timestamp
self
: borrow<descriptor
>data-access-timestamp
: new-timestamp
data-modification-timestamp
: new-timestamp
error-code
>error-code
>[method]descriptor.read: func
[method]descriptor.read: func
Read from a descriptor, without using and updating the descriptor's offset.
This function returns a list of bytes containing the data that was read, along with a bool which, when true, indicates that the end of the @@ -1038,15 +1040,15 @@ if the I/O operation is interrupted.
Note: This is similar to pread
in POSIX.
self
: borrow<descriptor
>length
: filesize
offset
: filesize
self
: borrow<descriptor
>length
: filesize
offset
: filesize
u8
>, bool
), error-code
>u8
>, bool
), error-code
>[method]descriptor.write: func
[method]descriptor.write: func
Write to a descriptor, without using and updating the descriptor's offset.
It is valid to write past the end of a file; the file is extended to the extent of the write, with bytes between the previous end and the start of @@ -1055,15 +1057,15 @@ the write set to zero.
Note: This is similar to pwrite
in POSIX.
self
: borrow<descriptor
>buffer
: list<u8
>offset
: filesize
self
: borrow<descriptor
>buffer
: list<u8
>offset
: filesize
filesize
, error-code
>filesize
, error-code
>[method]descriptor.read-directory: func
[method]descriptor.read-directory: func
Read directory entries from a directory.
On filesystems where directories contain entries referring to themselves
and their parents, often named .
and ..
respectively, these entries
@@ -1073,38 +1075,38 @@ directory. Multiple streams may be active on the same directory, and they
do not interfere with each other.
self
: borrow<descriptor
>self
: borrow<descriptor
>directory-entry-stream
>, error-code
>directory-entry-stream
>, error-code
>[method]descriptor.sync: func
[method]descriptor.sync: func
Synchronize the data and metadata of a file to disk.
This function succeeds with no effect if the file descriptor is not opened for writing.
Note: This is similar to fsync
in POSIX.
self
: borrow<descriptor
>self
: borrow<descriptor
>error-code
>error-code
>[method]descriptor.create-directory-at: func
[method]descriptor.create-directory-at: func
Create a directory.
Note: This is similar to mkdirat
in POSIX.
self
: borrow<descriptor
>path
: string
self
: borrow<descriptor
>path
: string
error-code
>error-code
>[method]descriptor.stat: func
[method]descriptor.stat: func
Return the attributes of an open file or directory.
Note: This is similar to fstat
in POSIX, except that it does not return
device and inode information. For testing whether two descriptors refer to
@@ -1114,13 +1116,13 @@ modified, use metadata-hash
.
Note: This was called fd_filestat_get
in earlier versions of WASI.
self
: borrow<descriptor
>self
: borrow<descriptor
>descriptor-stat
, error-code
>descriptor-stat
, error-code
>[method]descriptor.stat-at: func
[method]descriptor.stat-at: func
Return the attributes of a file or directory.
Note: This is similar to fstatat
in POSIX, except that it does not
return device and inode information. See the stat
description for a
@@ -1128,47 +1130,47 @@ discussion of alternatives.
Note: This was called path_filestat_get
in earlier versions of WASI.
self
: borrow<descriptor
>path-flags
: path-flags
path
: string
self
: borrow<descriptor
>path-flags
: path-flags
path
: string
descriptor-stat
, error-code
>descriptor-stat
, error-code
>[method]descriptor.set-times-at: func
[method]descriptor.set-times-at: func
Adjust the timestamps of a file or directory.
Note: This is similar to utimensat
in POSIX.
Note: This was called path_filestat_set_times
in earlier versions of
WASI.
self
: borrow<descriptor
>path-flags
: path-flags
path
: string
data-access-timestamp
: new-timestamp
data-modification-timestamp
: new-timestamp
self
: borrow<descriptor
>path-flags
: path-flags
path
: string
data-access-timestamp
: new-timestamp
data-modification-timestamp
: new-timestamp
error-code
>error-code
>[method]descriptor.link-at: func
[method]descriptor.link-at: func
Create a hard link.
Note: This is similar to linkat
in POSIX.
self
: borrow<descriptor
>old-path-flags
: path-flags
old-path
: string
new-descriptor
: borrow<descriptor
>new-path
: string
self
: borrow<descriptor
>old-path-flags
: path-flags
old-path
: string
new-descriptor
: borrow<descriptor
>new-path
: string
error-code
>error-code
>[method]descriptor.open-at: func
[method]descriptor.open-at: func
Open a file or directory.
If flags
contains descriptor-flags::mutate-directory
, and the base
descriptor doesn't have descriptor-flags::mutate-directory
set,
@@ -1180,86 +1182,86 @@ contains truncate
or create
, and the base descriptor d
Note: This is similar to openat
in POSIX.
self
: borrow<descriptor
>path-flags
: path-flags
path
: string
open-flags
: open-flags
flags
: descriptor-flags
self
: borrow<descriptor
>path-flags
: path-flags
path
: string
open-flags
: open-flags
flags
: descriptor-flags
descriptor
>, error-code
>descriptor
>, error-code
>[method]descriptor.readlink-at: func
[method]descriptor.readlink-at: func
Read the contents of a symbolic link.
If the contents contain an absolute or rooted path in the underlying
filesystem, this function fails with error-code::not-permitted
.
Note: This is similar to readlinkat
in POSIX.
self
: borrow<descriptor
>path
: string
self
: borrow<descriptor
>path
: string
string
, error-code
>string
, error-code
>[method]descriptor.remove-directory-at: func
[method]descriptor.remove-directory-at: func
Remove a directory.
Return error-code::not-empty
if the directory is not empty.
Note: This is similar to unlinkat(fd, path, AT_REMOVEDIR)
in POSIX.
self
: borrow<descriptor
>path
: string
self
: borrow<descriptor
>path
: string
error-code
>error-code
>[method]descriptor.rename-at: func
[method]descriptor.rename-at: func
Rename a filesystem object.
Note: This is similar to renameat
in POSIX.
self
: borrow<descriptor
>old-path
: string
new-descriptor
: borrow<descriptor
>new-path
: string
self
: borrow<descriptor
>old-path
: string
new-descriptor
: borrow<descriptor
>new-path
: string
error-code
>error-code
>[method]descriptor.symlink-at: func
[method]descriptor.symlink-at: func
Create a symbolic link (also known as a "symlink").
If old-path
starts with /
, the function fails with
error-code::not-permitted
.
Note: This is similar to symlinkat
in POSIX.
self
: borrow<descriptor
>old-path
: string
new-path
: string
self
: borrow<descriptor
>old-path
: string
new-path
: string
error-code
>error-code
>[method]descriptor.unlink-file-at: func
[method]descriptor.unlink-file-at: func
Unlink a filesystem object that is not a directory.
Return error-code::is-directory
if the path refers to a directory.
Note: This is similar to unlinkat(fd, path, 0)
in POSIX.
self
: borrow<descriptor
>path
: string
self
: borrow<descriptor
>path
: string
error-code
>error-code
>[method]descriptor.is-same-object: func
[method]descriptor.is-same-object: func
Test whether two descriptors refer to the same filesystem object.
In POSIX, this corresponds to testing whether the two descriptors have the
same device (st_dev
) and inode (st_ino
or d_ino
) numbers.
@@ -1267,14 +1269,14 @@ wasi-filesystem does not expose device and inode numbers, so this function
may be used instead.
self
: borrow<descriptor
>other
: borrow<descriptor
>self
: borrow<descriptor
>other
: borrow<descriptor
>[method]descriptor.metadata-hash: func
[method]descriptor.metadata-hash: func
Return a hash of the metadata associated with a filesystem object referred to by a descriptor.
This returns a hash of the last-modification timestamp and file size, and @@ -1294,37 +1296,37 @@ computed hash.
However, none of these is required.
self
: borrow<descriptor
>self
: borrow<descriptor
>metadata-hash-value
, error-code
>metadata-hash-value
, error-code
>[method]descriptor.metadata-hash-at: func
[method]descriptor.metadata-hash-at: func
Return a hash of the metadata associated with a filesystem object referred to by a directory descriptor and a relative path.
This performs the same hash computation as metadata-hash
.
self
: borrow<descriptor
>path-flags
: path-flags
path
: string
self
: borrow<descriptor
>path-flags
: path-flags
path
: string
metadata-hash-value
, error-code
>metadata-hash-value
, error-code
>[method]directory-entry-stream.read-directory-entry: func
[method]directory-entry-stream.read-directory-entry: func
Read a single directory entry from a directory-entry-stream
.
self
: borrow<directory-entry-stream
>self
: borrow<directory-entry-stream
>directory-entry
>, error-code
>directory-entry
>, error-code
>filesystem-error-code: func
filesystem-error-code: func
Attempts to extract a filesystem-related error-code
from the stream
error
provided.
Stream operations which return stream-error::last-operation-failed
@@ -1335,23 +1337,23 @@ filesystem-related information about the error to return.
error-code
>error-code
>type descriptor
type descriptor
----
get-directories: func
get-directories: func
Return the set of preopened directories, and their path.
descriptor
>, string
)>descriptor
>, string
)>