#[path = "../unsupported/process.rs"]
pub mod process;
pub mod rwlock;
-pub mod stack_overflow;
pub mod stdio;
pub mod thread;
pub mod thread_local_key;
pub use crate::sys_common::os_str_bytes as os_str;
-#[cfg(not(test))]
-pub fn init() {}
+// SAFETY: must be called only once during runtime initialization.
+// NOTE: this is not guaranteed to run, for example when Rust code is called externally.
+pub unsafe fn init(argc: isize, argv: *const *const u8) {
+ unsafe {
+ args::init(argc, argv);
+ }
+}
+
+// SAFETY: must be called only once during runtime cleanup.
+// NOTE: this is not guaranteed to run, for example when the program aborts.
+pub unsafe fn cleanup() {}
/// This function is used to implement functionality that simply doesn't exist.
/// Programs relying on this functionality will need to deal with the error.
}
pub fn unsupported_err() -> crate::io::Error {
- crate::io::Error::new_const(ErrorKind::NotSupported, &"operation not supported on SGX yet")
+ crate::io::Error::new_const(ErrorKind::Unsupported, &"operation not supported on SGX yet")
}
/// This function is used to implement various functions that doesn't exist,
}
}
-// This enum is used as the storage for a bunch of types which can't actually
-// exist.
-#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
-pub enum Void {}
-
pub unsafe fn strlen(mut s: *const c_char) -> usize {
let mut n = 0;
while unsafe { *s } != 0 {