From 58e3e5d957b7b1b2b166bdd9452778387427116a Mon Sep 17 00:00:00 2001
From: Dan Gohman
An error type returned from a stream operation. Currently this doesn't provide any additional information.
type output-stream
u32
An output bytestream. In the future, this will be replaced by handle -types. -
This conceptually represents a stream<u8, _>
. It's temporary
-scaffolding until component-model's async features are ready.
output-stream
s are non-blocking to the extent practical on
-underlying platforms. Except where specified otherwise, I/O operations also
-always return promptly, after the number of bytes that can be written
-promptly, which could even be zero. To wait for the stream to be ready to
-accept data, the subscribe-to-output-stream
function to obtain a
-pollable
which can be polled for using wasi_poll
.
And at present, it is a u32
instead of being an actual handle, until
-the wit-bindgen implementation of handles and resources is ready.
This represents a resource.
type input-stream
u32
An input bytestream. In the future, this will be replaced by handle
@@ -101,6 +86,21 @@ can be polled for using wasi_poll
.
And at present, it is a u32
instead of being an actual handle, until
the wit-bindgen implementation of handles and resources is ready.
This represents a resource.
+type output-stream
u32
An output bytestream. In the future, this will be replaced by handle +types. +
This conceptually represents a stream<u8, _>
. It's temporary
+scaffolding until component-model's async features are ready.
output-stream
s are non-blocking to the extent practical on
+underlying platforms. Except where specified otherwise, I/O operations also
+always return promptly, after the number of bytes that can be written
+promptly, which could even be zero. To wait for the stream to be ready to
+accept data, the subscribe-to-output-stream
function to obtain a
+pollable
which can be polled for using wasi_poll
.
And at present, it is a u32
instead of being an actual handle, until
+the wit-bindgen implementation of handles and resources is ready.
This represents a resource.
read: func
-#### `flags path-flags` +#### `type filesize` +`u64` +
File size or length of a region within a file. +
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
Descriptor flags.
+Note: This was called fdflags
in earlier versions of WASI.
read
:
Read mode: Data can be read. +
Write mode: Data can be written to. +
Requests non-blocking operation. +
When this flag is enabled, functions may return immediately with an
+error-code::would-block
error code in situations where they would
+otherwise block. However, this non-blocking behavior is not
+required. Implementations are permitted to ignore this flag and
+block. This is similar to O_NONBLOCK
in POSIX.
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. +
The precise semantics of this operation have not yet been defined for +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. +
The precise semantics of this operation have not yet been defined for +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 integrety +requested for writes. This is similar to `O_RSYNC` in POSIX. +
The precise semantics of this operation have not yet been defined for +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
+metadata of filesystem objects, or obtain another handle which
+would permit any of those, shall fail with error-code::read-only
if
+they would otherwise succeed.
This may only be set on directories.
+flags path-flags
Flags determining the method of how paths are resolved.
variant access-type
Access type used by access-at
.
Test for readability, writeability, or executability. +
Test whether the path exists. +
type link-count
u64
Number of hard links to an inode. -
type inode
u64
Filesystem object serial number that is unique within its file system. -
type filesize
u64
File size or length of a region within a file. +
record descriptor-stat
File attributes.
+Note: This was called filestat
in earlier versions of WASI.
File type. +
Number of hard links to the file. +
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
: datetime
Last data access timestamp. +
data-modification-timestamp
: datetime
Last data modification timestamp. +
status-change-timestamp
: datetime
Last file status change 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. +
Set the timestamp to the given value. +
record directory-entry
A directory entry.
+The type of the file referred to by this directory entry. +
name
: string
The name of the object. +
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
@@ -592,197 +762,6 @@ merely for alignment with POSIX.
Cross-device link, similar to `EXDEV` in POSIX. -
type directory-entry-stream
u32
A stream of directory entries. -
This represents a stream of dir-entry
.
type device
u64
Identifier for a device containing a file system. Can be used in -combination with `inode` to uniquely identify a file or directory in -the filesystem. -
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. -
record directory-entry
A directory entry.
-The serial number of the object referred to by this directory entry. -May be none if the inode value is not known. -
When this is none, libc implementations might do an extra stat-at
-call to retrieve the inode number to fill their d_ino
fields, so
-implementations which can set this to a non-none value should do so.
The type of the file referred to by this directory entry. -
name
: string
The name of the object. -
flags descriptor-flags
Descriptor flags.
-Note: This was called fdflags
in earlier versions of WASI.
read
:
Read mode: Data can be read. -
Write mode: Data can be written to. -
Requests non-blocking operation. -
When this flag is enabled, functions may return immediately with an
-error-code::would-block
error code in situations where they would
-otherwise block. However, this non-blocking behavior is not
-required. Implementations are permitted to ignore this flag and
-block. This is similar to O_NONBLOCK
in POSIX.
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. -
The precise semantics of this operation have not yet been defined for -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. -
The precise semantics of this operation have not yet been defined for -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 integrety -requested for writes. This is similar to `O_RSYNC` in POSIX. -
The precise semantics of this operation have not yet been defined for -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
-metadata of filesystem objects, or obtain another handle which
-would permit any of those, shall fail with error-code::read-only
if
-they would otherwise succeed.
This may only be set on directories.
-type descriptor
u32
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. -
This represents a resource.
-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. -
Set the timestamp to the given value. -
record descriptor-stat
File attributes.
-Note: This was called filestat
in earlier versions of WASI.
Device ID of device containing the file. -
File serial number. -
File type. -
Number of hard links to the file. -
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
: datetime
Last data access timestamp. -
data-modification-timestamp
: datetime
Last data modification timestamp. -
status-change-timestamp
: datetime
Last file status change timestamp. -
enum advice
File or memory access pattern advisory information.
variant access-type
Access type used by access-at
.
Test for readability, writeability, or executability. -
Test whether the path exists. -
type descriptor
u32
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. +
This represents a resource.
+type directory-entry-stream
u32
A stream of directory entries. +
This represents a stream of dir-entry
.
read-via-stream: func
stat: func
Return the attributes of an open file or directory.
-Note: This is similar to fstat
in POSIX.
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
+the same underlying filesystem object, use is-same-object
. To obtain
+additional data that can be used do determine whether a file has been
+modified, use metadata-hash
.
Note: This was called fd_filestat_get
in earlier versions of WASI.
stat-at: func
Return the attributes of a file or directory.
-Note: This is similar to fstatat
in POSIX.
Note: This is similar to fstatat
in POSIX, except that it does not
+return device and inode information. See the stat
description for a
+discussion of alternatives.
Note: This was called path_filestat_get
in earlier versions of WASI.
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.
+wasi-filesystem does not expose device and inode numbers, so this function
+may be used instead.
other
: 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 +may also include the inode number, device number, birth timestamp, and +other metadata fields that may change when the file is modified or +replaced.
+Implementations are encourated to provide the following properties:
+However, none of these is required.
+u64
, u64
), error-code
>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
.
path-flags
: path-flags
path
: string
u64
, u64
), error-code
>