Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 33 additions & 12 deletions intel-sgx/enclave-runner/src/usercalls/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,24 +304,45 @@ impl<'a> Drop for OutputBuffer<'a> {

fn result_from_io_error(err: IoError) -> Result {
let ret = match err.kind() {
IoErrorKind::NotFound => Error::NotFound,
IoErrorKind::PermissionDenied => Error::PermissionDenied,
IoErrorKind::ConnectionRefused => Error::ConnectionRefused,
IoErrorKind::ConnectionReset => Error::ConnectionReset,
IoErrorKind::ConnectionAborted => Error::ConnectionAborted,
IoErrorKind::NotConnected => Error::NotConnected,
IoErrorKind::AddrInUse => Error::AddrInUse,
IoErrorKind::AddrNotAvailable => Error::AddrNotAvailable,
IoErrorKind::BrokenPipe => Error::BrokenPipe,
IoErrorKind::AlreadyExists => Error::AlreadyExists,
IoErrorKind::NotFound => Error::NotFound,
IoErrorKind::Interrupted => Error::Interrupted,
IoErrorKind::ArgumentListTooLong => Error::ArgumentListTooLong,
IoErrorKind::WouldBlock => Error::WouldBlock,
IoErrorKind::OutOfMemory => Error::OutOfMemory,
IoErrorKind::ResourceBusy => Error::ResourceBusy,
IoErrorKind::AlreadyExists => Error::AlreadyExists,
IoErrorKind::CrossesDevices => Error::CrossesDevices,
IoErrorKind::NotADirectory => Error::NotADirectory,
IoErrorKind::IsADirectory => Error::IsADirectory,
IoErrorKind::InvalidInput => Error::InvalidInput,
IoErrorKind::InvalidData => Error::InvalidData,
IoErrorKind::ExecutableFileBusy => Error::ExecutableFileBusy,
IoErrorKind::FileTooLarge => Error::FileTooLarge,
IoErrorKind::StorageFull => Error::StorageFull,
IoErrorKind::NotSeekable => Error::NotSeekable,
IoErrorKind::ReadOnlyFilesystem => Error::ReadOnlyFilesystem,
IoErrorKind::TooManyLinks => Error::TooManyLinks,
IoErrorKind::BrokenPipe => Error::BrokenPipe,
IoErrorKind::Deadlock => Error::DeadLock,
IoErrorKind::InvalidFilename => Error::InvalidFileName,
IoErrorKind::Unsupported => Error::UnSupported,
IoErrorKind::DirectoryNotEmpty => Error::DirectoryNotEmpty,
IoErrorKind::AddrInUse => Error::AddrInUse,
IoErrorKind::AddrNotAvailable => Error::AddrNotAvailable,
IoErrorKind::NetworkDown => Error::NetworkDown,
IoErrorKind::NetworkUnreachable => Error::NetworkUnreachable,
IoErrorKind::ConnectionAborted => Error::ConnectionAborted,
IoErrorKind::ConnectionReset => Error::ConnectionReset,
IoErrorKind::NotConnected => Error::NotConnected,
IoErrorKind::TimedOut => Error::TimedOut,
IoErrorKind::ConnectionRefused => Error::ConnectionRefused,
IoErrorKind::HostUnreachable => Error::HostUnreachable,
IoErrorKind::StaleNetworkFileHandle => Error::StaleNetworkFileHandle,
IoErrorKind::QuotaExceeded => Error::QuotaExceeded,
IoErrorKind::InvalidData => Error::InvalidData,
IoErrorKind::WriteZero => Error::WriteZero,
IoErrorKind::Interrupted => Error::Interrupted,
IoErrorKind::Other => Error::Other,
IoErrorKind::UnexpectedEof => Error::UnexpectedEof,
IoErrorKind::Other => Error::Other,
_ => Error::Other,
};
ret as _
Expand Down
61 changes: 41 additions & 20 deletions intel-sgx/fortanix-sgx-abi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,30 +200,51 @@ unsafe impl Send for ByteBuffer {}
#[derive(Copy, Clone, Eq, PartialEq)]
#[cfg_attr(feature = "rustc-dep-of-std", unstable(feature = "sgx_platform", issue = "56975"))]
pub enum Error {
PermissionDenied = 0x01,
NotFound = 0x02,
Interrupted = 0x04,
WouldBlock = 0x0b,
AlreadyExists = 0x11,
InvalidInput = 0x16,
BrokenPipe = 0x20,
AddrInUse = 0x62,
AddrNotAvailable = 0x63,
ConnectionAborted = 0x67,
ConnectionReset = 0x68,
NotConnected = 0x6b,
TimedOut = 0x6e,
ConnectionRefused = 0x6f,
InvalidData = 0x2000_0000,
WriteZero = 0x2000_0001,
UnexpectedEof = 0x2000_0002,
PermissionDenied = 0x01,
NotFound = 0x02,
Interrupted = 0x04,
ArgumentListTooLong = 0x07,
WouldBlock = 0x0b,
OutOfMemory = 0x0c,
ResourceBusy = 0x10,
AlreadyExists = 0x11,
CrossesDevices = 0x12,
NotADirectory = 0x14,
IsADirectory = 0x15,
InvalidInput = 0x16,
ExecutableFileBusy = 0x1a,
FileTooLarge = 0x1b,
StorageFull = 0x1c,
NotSeekable = 0x1d,
ReadOnlyFilesystem = 0x1e,
TooManyLinks = 0x1f,
BrokenPipe = 0x20,
DeadLock = 0x23,
InvalidFileName = 0x24,
UnSupported = 0x26,
DirectoryNotEmpty = 0x27,
AddrInUse = 0x62,
AddrNotAvailable = 0x63,
NetworkDown = 0x64,
NetworkUnreachable = 0x65,
ConnectionAborted = 0x67,
ConnectionReset = 0x68,
NotConnected = 0x6b,
TimedOut = 0x6e,
ConnectionRefused = 0x6f,
HostUnreachable = 0x71,
StaleNetworkFileHandle = 0x74,
QuotaExceeded = 0x7a,
InvalidData = 0x2000_0000,
WriteZero = 0x2000_0001,
UnexpectedEof = 0x2000_0002,
/// This value is reserved for `Other`, but all undefined values also map
/// to `Other`.
Other = 0x3fff_ffff,
Other = 0x3fff_ffff,
/// Start of the range of values reserved for user-defined errors.
UserRangeStart = 0x4000_0000,
UserRangeStart = 0x4000_0000,
/// End (inclusive) of the range of values reserved for user-defined errors.
UserRangeEnd = 0x7fff_ffff,
UserRangeEnd = 0x7fff_ffff,
}

/// A value indicating that the operation was successful.
Expand Down