Stop returning NOTCAPABLE errors from WASI calls. (#4666)
* Stop returning `NOTCAPABLE` errors from WASI calls. `ENOTCAPABLE` was an error code that is used as part of the rights system, from CloudABI. There is a set of flags associated with each file descriptor listing which operations can be performed with the file descriptor, and if an attempt is made to perform an operation with a file descriptor that isn't permitted by its rights flags, it fails with `ENOTCAPABLE`. WASI is removing the rights system. For example, WebAssembly/wasi-libc#294 removed support for translating `ENOTCAPABLE` into POSIX error codes, on the assumption that engines should stop using it. So as another step to migrating away from the rights system, remove uses of the `ENOTCAPABLE` error. * Update crates/wasi-common/src/file.rs Co-authored-by: Jamey Sharp <jamey@minilop.net> * Update crates/wasi-common/src/dir.rs Co-authored-by: Jamey Sharp <jamey@minilop.net> Co-authored-by: Jamey Sharp <jamey@minilop.net>
This commit is contained in:
@@ -72,6 +72,9 @@ pub enum ErrorKind {
|
||||
/// Errno::Spipe: Invalid seek
|
||||
#[error("Spipe: Invalid seek")]
|
||||
Spipe,
|
||||
/// Errno::Perm: Permission denied
|
||||
#[error("Permission denied")]
|
||||
Perm,
|
||||
/// Errno::NotCapable: Not capable
|
||||
#[error("Not capable")]
|
||||
NotCapable,
|
||||
@@ -92,7 +95,7 @@ pub trait ErrorExt {
|
||||
fn overflow() -> Self;
|
||||
fn range() -> Self;
|
||||
fn seek_pipe() -> Self;
|
||||
fn not_capable() -> Self;
|
||||
fn perm() -> Self;
|
||||
}
|
||||
|
||||
impl ErrorExt for Error {
|
||||
@@ -138,7 +141,7 @@ impl ErrorExt for Error {
|
||||
fn seek_pipe() -> Self {
|
||||
ErrorKind::Spipe.into()
|
||||
}
|
||||
fn not_capable() -> Self {
|
||||
ErrorKind::NotCapable.into()
|
||||
fn perm() -> Self {
|
||||
ErrorKind::Perm.into()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user