1#![cfg_attr(not(feature = "std"), no_std)]
2
3pub mod errors {
4 pub use safa_abi::errors::{ErrorStatus, SysResult};
5
6 #[cfg(any(feature = "rustc-dep-of-std", feature = "std"))]
7 #[cfg_attr(feature = "rustc-dep-of-std", macro_export)]
8 macro_rules! err_from_io_error_kind {
9 ($io_err_ty: path, $io_err: ident) => {
10 use $crate::errors::ErrorStatus::*;
11 use $io_err_ty as IoErrorKind;
12
13 return match $io_err {
14 IoErrorKind::NotFound => NoSuchAFileOrDirectory,
15 IoErrorKind::AlreadyExists => AlreadyExists,
16 IoErrorKind::PermissionDenied => MissingPermissions,
17 IoErrorKind::ResourceBusy => Busy,
18 IoErrorKind::NotADirectory => NotADirectory,
19 IoErrorKind::IsADirectory => NotAFile,
20 IoErrorKind::OutOfMemory => OutOfMemory,
21 IoErrorKind::Other => Generic,
22 IoErrorKind::DirectoryNotEmpty => DirectoryNotEmpty,
23 IoErrorKind::Unsupported => OperationNotSupported,
24
25 _ => Generic,
26 };
27 };
28 }
29
30 #[cfg(feature = "std")]
31 pub fn err_from_io_error_kind(io_err: std::io::ErrorKind) -> ErrorStatus {
32 err_from_io_error_kind!(std::io::ErrorKind, io_err);
33 }
34}
35
36pub mod alloc;
37pub mod raw;
38pub mod syscalls;