stub out set_oflags for unix i guess?
what do we do about unsupported stuff like that? silently return OK?
This commit is contained in:
@@ -34,6 +34,9 @@ pub enum Error {
|
|||||||
#[error("Unexpected IoError: {0}")]
|
#[error("Unexpected IoError: {0}")]
|
||||||
UnexpectedIo(#[source] std::io::Error),
|
UnexpectedIo(#[source] std::io::Error),
|
||||||
|
|
||||||
|
#[error("Unsupported operation: {0}")]
|
||||||
|
Unsupported(String),
|
||||||
|
|
||||||
// Below this, all variants are from the `$errno` type:
|
// Below this, all variants are from the `$errno` type:
|
||||||
/// Errno::TooBig: Argument list too long
|
/// Errno::TooBig: Argument list too long
|
||||||
#[error("TooBig: Argument list too long")]
|
#[error("TooBig: Argument list too long")]
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ pub enum Filetype {
|
|||||||
SocketStream,
|
SocketStream,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||||
pub struct FdFlags {
|
pub struct FdFlags {
|
||||||
flags: u32,
|
flags: u32,
|
||||||
}
|
}
|
||||||
@@ -42,6 +43,7 @@ impl FdFlags {
|
|||||||
// etc
|
// etc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||||
pub struct OFlags {
|
pub struct OFlags {
|
||||||
flags: u32,
|
flags: u32,
|
||||||
}
|
}
|
||||||
@@ -187,10 +189,19 @@ impl WasiFile for cap_std::fs::File {
|
|||||||
Ok(OFlags::RDWR)
|
Ok(OFlags::RDWR)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn set_oflags(&self, _flags: OFlags) -> Result<(), Error> {
|
fn set_oflags(&self, flags: OFlags) -> Result<(), Error> {
|
||||||
// XXX cap-std::fs::Permissions does not export a constructor to build this out of
|
#![allow(unreachable_code, unused_variables)]
|
||||||
#[allow(unreachable_code)]
|
cfg_if! {
|
||||||
self.set_permissions(todo!())?;
|
if #[cfg(unix)] {
|
||||||
|
use std::os::unix::fs::PermissionsExt;
|
||||||
|
use cap_std::fs::Permissions;
|
||||||
|
use std::fs::Permissions as StdPermissions;
|
||||||
|
let flags = todo!("normalize to unix flags {:?}", flags);
|
||||||
|
self.set_permissions(Permissions::from_std(StdPermissions::from_mode(flags)))?;
|
||||||
|
} else {
|
||||||
|
Err(Error::Unsupported("set oflags on non-unix host system".to_owned()))
|
||||||
|
}
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
fn get_filestat(&self) -> Result<Filestat, Error> {
|
fn get_filestat(&self) -> Result<Filestat, Error> {
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ impl From<Error> for types::Errno {
|
|||||||
Error::DirNotCapable { .. } => Errno::Notcapable,
|
Error::DirNotCapable { .. } => Errno::Notcapable,
|
||||||
Error::NotCapable => Errno::Notcapable,
|
Error::NotCapable => Errno::Notcapable,
|
||||||
Error::TableOverflow => Errno::Overflow,
|
Error::TableOverflow => Errno::Overflow,
|
||||||
|
Error::Unsupported { .. } => Errno::Notcapable, // XXX is this reasonable?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user