Upward movement for BSD

This commit is contained in:
Alex Crichton 2015-09-18 16:20:02 -07:00
parent 2eb32ef455
commit a4e27ed77a
4 changed files with 52 additions and 112 deletions

View file

@ -2,44 +2,16 @@
//!
//! This covers *-apple-* triples currently
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;
pub type c_float = f32;
pub type c_double = f64;
pub type clock_t = c_ulong;
pub type time_t = c_long;
pub type suseconds_t = i32;
pub type wchar_t = i32;
pub type c_longlong = i64;
pub type c_ulonglong = u64;
pub type intmax_t = i64;
pub type uintmax_t = u64;
pub type off_t = i64;
pub type dev_t = i32;
pub type ino_t = u64;
pub type pid_t = i32;
pub type uid_t = u32;
pub type gid_t = u32;
pub type useconds_t = u32;
pub type mode_t = u16;
pub type ssize_t = c_long;
pub type nlink_t = u16;
pub type blksize_t = i32;
pub type blkcnt_t = i64;
pub type socklen_t = u32;
pub type sa_family_t = u8;
pub type in_port_t = u16;
pub type in_addr_t = u32;
pub type pthread_t = uintptr_t;
pub type rlim_t = u64;
pub type sighandler_t = size_t;
pub type mach_timebase_info_data_t = mach_timebase_info;
pub type pthread_key_t = c_ulong;
pub type sigset_t = u32;

View file

@ -1,39 +1,12 @@
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;
pub type c_float = f32;
pub type c_double = f64;
pub type clock_t = i32;
pub type wchar_t = i32;
pub type c_longlong = i64;
pub type c_ulonglong = u64;
pub type intmax_t = i64;
pub type uintmax_t = u64;
pub type off_t = i64;
pub type dev_t = u32;
pub type ino_t = u32;
pub type pid_t = i32;
pub type uid_t = u32;
pub type gid_t = u32;
pub type useconds_t = u32;
pub type mode_t = u16;
pub type nlink_t = u16;
pub type blksize_t = u32;
pub type blkcnt_t = i64;
pub type fflags_t = u32;
pub type pthread_attr_t = *mut ::c_void;
pub type pthread_t = uintptr_t;
pub type rlim_t = i64;
pub type sighandler_t = size_t;
pub type socklen_t = u32;
pub type sa_family_t = u8;
pub type in_port_t = u16;
pub type in_addr_t = u32;
pub type pthread_mutex_t = *mut ::c_void;
pub type pthread_mutexattr_t = *mut ::c_void;
pub type pthread_cond_t = *mut ::c_void;
@ -61,7 +34,7 @@ s! {
pub struct sockaddr_storage {
pub ss_len: u8,
pub ss_family: sa_family_t,
pub ss_family: ::sa_family_t,
__ss_pad1: [u8; 6],
__ss_align: i64,
__ss_pad2: [u8; 112],
@ -72,16 +45,16 @@ s! {
pub ai_family: ::c_int,
pub ai_socktype: ::c_int,
pub ai_protocol: ::c_int,
pub ai_addrlen: socklen_t,
pub ai_canonname: *mut c_char,
pub ai_addrlen: ::socklen_t,
pub ai_canonname: *mut ::c_char,
pub ai_addr: *mut ::sockaddr,
pub ai_next: *mut addrinfo,
}
pub struct ifaddrs {
pub ifa_next: *mut ifaddrs,
pub ifa_name: *mut c_char,
pub ifa_flags: c_uint,
pub ifa_name: *mut ::c_char,
pub ifa_flags: ::c_uint,
pub ifa_addr: *mut ::sockaddr,
pub ifa_netmask: *mut ::sockaddr,
pub ifa_dstaddr: *mut ::sockaddr,
@ -100,11 +73,11 @@ s! {
pub si_uid: ::uid_t,
pub si_status: ::c_int,
pub si_addr: *mut ::c_void,
_pad: [c_int; 12],
_pad: [::c_int; 12],
}
pub struct sigaction {
pub sa_sigaction: sighandler_t,
pub sa_sigaction: ::sighandler_t,
pub sa_flags: ::c_int,
pub sa_mask: sigset_t,
}
@ -126,11 +99,11 @@ pub const SEEK_END: ::c_int = 2;
pub const _IOFBF: ::c_int = 0;
pub const _IONBF: ::c_int = 2;
pub const _IOLBF: ::c_int = 1;
pub const BUFSIZ: c_uint = 1024;
pub const FOPEN_MAX: c_uint = 20;
pub const FILENAME_MAX: c_uint = 1024;
pub const L_tmpnam: c_uint = 1024;
pub const TMP_MAX: c_uint = 308915776;
pub const BUFSIZ: ::c_uint = 1024;
pub const FOPEN_MAX: ::c_uint = 20;
pub const FILENAME_MAX: ::c_uint = 1024;
pub const L_tmpnam: ::c_uint = 1024;
pub const TMP_MAX: ::c_uint = 308915776;
pub const O_RDONLY: ::c_int = 0;
pub const O_WRONLY: ::c_int = 1;
@ -527,30 +500,26 @@ pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _;
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _;
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
pub const SIGSTKSZ: ::size_t = 34816;
extern {
pub fn mprotect(addr: *const ::c_void, len: size_t, prot: c_int)
-> c_int;
pub fn mprotect(addr: *const ::c_void, len: size_t, prot: ::c_int)
-> ::c_int;
pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t)
-> ::c_int;
pub fn sysctl(name: *const c_int,
namelen: c_uint,
pub fn sysctl(name: *const ::c_int,
namelen: ::c_uint,
oldp: *mut ::c_void,
oldlenp: *mut size_t,
newp: *const ::c_void,
newlen: size_t)
-> c_int;
pub fn sysctlbyname(name: *const c_char,
-> ::c_int;
pub fn sysctlbyname(name: *const ::c_char,
oldp: *mut ::c_void,
oldlenp: *mut size_t,
newp: *const ::c_void,
newlen: size_t)
-> c_int;
-> ::c_int;
pub fn clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::c_int;
pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
pub fn backtrace(buf: *mut *mut ::c_void,
sz: ::size_t) -> ::size_t;
}
cfg_if! {

View file

@ -1,3 +1,30 @@
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;
pub type c_float = f32;
pub type c_double = f64;
pub type c_longlong = i64;
pub type c_ulonglong = u64;
pub type wchar_t = i32;
pub type intmax_t = i64;
pub type uintmax_t = u64;
pub type off_t = i64;
pub type pid_t = i32;
pub type uid_t = u32;
pub type gid_t = u32;
pub type useconds_t = u32;
pub type blkcnt_t = i64;
pub type socklen_t = u32;
pub type sa_family_t = u8;
pub type in_port_t = u16;
pub type in_addr_t = u32;
pub type pthread_t = uintptr_t;
pub type sighandler_t = size_t;
s! {
pub struct sockaddr {
pub sa_len: u8,

View file

@ -1,45 +1,18 @@
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;
pub type c_long = i64;
pub type c_ulong = u64;
pub type c_float = f32;
pub type c_double = f64;
pub type size_t = u64;
pub type ptrdiff_t = i64;
pub type clock_t = i64;
pub type time_t = i64;
pub type suseconds_t = i64;
pub type wchar_t = i32;
pub type c_longlong = i64;
pub type c_ulonglong = u64;
pub type intptr_t = i64;
pub type uintptr_t = u64;
pub type intmax_t = i64;
pub type uintmax_t = u64;
pub type off_t = i64;
pub type dev_t = i32;
pub type pid_t = i32;
pub type uid_t = u32;
pub type gid_t = u32;
pub type useconds_t = u32;
pub type mode_t = u32;
pub type ssize_t = c_long;
pub type sighandler_t = size_t;
pub type socklen_t = u32;
pub type sa_family_t = u8;
pub type in_port_t = u16;
pub type in_addr_t = u32;
pub type nlink_t = uint32_t;
pub type blksize_t = uint32_t;
pub type ino_t = uint64_t;
pub type blkcnt_t = i64;
pub type fflags_t = u32;
pub type pthread_attr_t = *mut c_void;
pub type sigset_t = ::c_uint;
@ -48,19 +21,12 @@ pub type pthread_mutex_t = *mut ::c_void;
pub type pthread_mutexattr_t = *mut ::c_void;
pub type pthread_cond_t = *mut ::c_void;
pub type pthread_rwlock_t = *mut ::c_void;
pub type pthread_t = uintptr_t;
pub type rlim_t = u64;
pub enum timezone {}
s! {
pub struct stack_t {
pub ss_sp: *mut ::c_void,
pub ss_size: ::size_t,
pub ss_flags: ::c_int,
}
pub struct siginfo_t {
pub si_signo: ::c_int,
pub si_code: ::c_int,
@ -131,6 +97,12 @@ s! {
pub st_birthtime: time_t,
pub st_birthtime_nsec: c_long,
}
pub struct stack_t {
pub ss_sp: *mut ::c_void,
pub ss_size: ::size_t,
pub ss_flags: ::c_int,
}
}
pub const EXIT_FAILURE : c_int = 1;