X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=library%2Fstd%2Fsrc%2Fsys%2Fsgx%2Fmod.rs;h=059d6cb5ba13122994c69ee86439d1be1fe1181a;hb=e1b1081d2ff80f49129da2002ce3f5efa6186825;hp=da37d1aeb7e74842917668aea9e95f74a97fbde9;hpb=532609b01c6ba2ac9d57f6ad822e79c1defa8c97;p=rust.git diff --git a/library/std/src/sys/sgx/mod.rs b/library/std/src/sys/sgx/mod.rs index da37d1aeb7e..059d6cb5ba1 100644 --- a/library/std/src/sys/sgx/mod.rs +++ b/library/std/src/sys/sgx/mod.rs @@ -32,7 +32,6 @@ #[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; @@ -40,8 +39,17 @@ 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. @@ -115,11 +123,6 @@ pub fn decode_error_kind(code: i32) -> ErrorKind { } } -// 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 {