-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Trusty platform support #2987
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
pub use core::ffi::c_void; | ||
|
||
pub type size_t = usize; | ||
pub type ssize_t = isize; | ||
|
||
cfg_if! { | ||
if #[cfg(any(target_arch = "aarch64", target_arch = "arm"))] { | ||
pub type c_char = u8; | ||
} else if #[cfg(target_arch = "x86_64")] { | ||
pub type c_char = i8; | ||
} | ||
} | ||
|
||
pub type c_schar = i8; | ||
pub type c_uchar = u8; | ||
pub type c_short = i16; | ||
pub type c_ushort = u16; | ||
pub type c_int = i32; | ||
pub type c_uint = u32; | ||
|
||
cfg_if! { | ||
if #[cfg(target_pointer_width = "32")] { | ||
pub type c_long = i32; | ||
pub type c_ulong = u32; | ||
} else if #[cfg(target_pointer_width = "64")] { | ||
pub type c_long = i64; | ||
pub type c_ulong = u64; | ||
} | ||
} | ||
|
||
pub type c_longlong = i64; | ||
pub type c_ulonglong = u64; | ||
|
||
pub type c_uint8_t = u8; | ||
pub type c_uint16_t = u16; | ||
pub type c_uint32_t = u32; | ||
pub type c_uint64_t = u64; | ||
|
||
pub type c_int8_t = i8; | ||
pub type c_int16_t = i16; | ||
pub type c_int32_t = i32; | ||
pub type c_int64_t = i64; | ||
|
||
pub type time_t = c_long; | ||
|
||
s! { | ||
pub struct iovec { | ||
pub iov_base: *mut ::c_void, | ||
pub iov_len: ::size_t, | ||
} | ||
} | ||
|
||
pub const STDOUT_FILENO: ::c_int = 1; | ||
pub const STDERR_FILENO: ::c_int = 2; | ||
|
||
extern "C" { | ||
pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void; | ||
pub fn malloc(size: size_t) -> *mut c_void; | ||
pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void; | ||
pub fn free(p: *mut c_void); | ||
pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; | ||
pub fn posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int; | ||
pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> ::ssize_t; | ||
pub fn writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t; | ||
pub fn strlen(cs: *const c_char) -> size_t; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we could move the module under linux_like or somewhere else similar to that. I'm not familiar with Trusty but is it completely different from Linux-like OS (i.e. exposing linux-like items on Trusty is harmful)?