Skip to content

Commit bc01bab

Browse files
author
Jethro Beekman
committed
Add SGX target
1 parent c75ca64 commit bc01bab

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/lib.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,15 @@ cfg_if! {
158158
pub type uintptr_t = usize;
159159
pub type ssize_t = isize;
160160

161+
#[cfg(not(target_env = "sgx"))]
161162
pub enum FILE {}
163+
#[cfg(not(target_env = "sgx"))]
162164
pub enum fpos_t {} // TODO: fill this out with a struct
163165

164166
pub const INT_MIN: c_int = -2147483648;
165167
pub const INT_MAX: c_int = 2147483647;
166168

169+
#[cfg(not(target_env = "sgx"))]
167170
extern {
168171
pub fn isalnum(c: c_int) -> c_int;
169172
pub fn isalpha(c: c_int) -> c_int;
@@ -284,7 +287,7 @@ cfg_if! {
284287

285288
// These are all inline functions on android, so they end up just being entirely
286289
// missing on that platform.
287-
#[cfg(not(target_os = "android"))]
290+
#[cfg(not(any(target_os = "android", target_env = "sgx")))]
288291
extern {
289292
pub fn abs(i: c_int) -> c_int;
290293
pub fn atof(s: *const c_char) -> c_double;
@@ -314,6 +317,9 @@ cfg_if! {
314317
} else if #[cfg(unix)] {
315318
mod unix;
316319
pub use unix::*;
320+
} else if #[cfg(target_env = "sgx")] {
321+
mod sgx;
322+
pub use sgx::*;
317323
} else {
318324
// Unknown target_family
319325
}

src/sgx.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pub type c_char = i8;
2+
pub type c_long = i64;
3+
pub type c_ulong = u64;

0 commit comments

Comments
 (0)