Get FreeBSD compiling

This commit is contained in:
Alex Crichton 2015-09-15 17:05:19 -07:00
parent eef03da0f9
commit 8293cede01
7 changed files with 71 additions and 36 deletions

View File

@ -228,6 +228,8 @@ impl<'a> TestGenerator<'a> {
("windows", "windows", "gnu")
} else if self.target.contains("android") {
("android", "unix", "")
} else if self.target.contains("unknown-freebsd") {
("freebsd", "unix", "")
} else {
panic!("unknown os/family width: {}", self.target)
};
@ -417,6 +419,7 @@ impl<'a> TestGenerator<'a> {
"float" |
"mach_timebase_info_data_t" |
"double" => return,
n if n.starts_with("pthread") => return,
_ => {}
}
t!(writeln!(self.c, r#"

View File

@ -602,8 +602,26 @@ pub const _SC_TRACE_USER_EVENT_MAX: c_int = 130;
pub const _SC_PASS_MAX: c_int = 131;
extern {
pub fn _NSGetExecutablePath(buf: *mut c_char,
bufsize: *mut ::uint32_t) -> c_int;
pub fn _NSGetExecutablePath(buf: *mut ::c_char,
bufsize: *mut ::uint32_t) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "mprotect$UNIX2003")]
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
-> ::c_int;
pub fn shm_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::c_int;
pub fn sysctl(name: *mut ::c_int,
namelen: ::c_uint,
oldp: *mut ::c_void,
oldlenp: *mut ::size_t,
newp: *mut ::c_void,
newlen: ::size_t)
-> ::c_int;
pub fn sysctlbyname(name: *const ::c_char,
oldp: *mut ::c_void,
oldlenp: *mut ::size_t,
newp: *mut ::c_void,
newlen: ::size_t)
-> ::c_int;
}
cfg_if! {

View File

@ -57,7 +57,7 @@ s! {
pub const EXIT_FAILURE: ::c_int = 1;
pub const EXIT_SUCCESS: ::c_int = 0;
pub const RAND_MAX: ::c_int = 2147483647;
pub const RAND_MAX: ::c_int = 0x7fff_fffd;
pub const EOF: ::c_int = -1;
pub const SEEK_SET: ::c_int = 0;
pub const SEEK_CUR: ::c_int = 1;
@ -238,14 +238,7 @@ pub const EBADMSG: ::c_int = 89;
pub const EMULTIHOP: ::c_int = 90;
pub const ENOLINK: ::c_int = 91;
pub const EPROTO: ::c_int = 92;
pub const ENOMEDIUM: ::c_int = 93;
pub const EUNUSED94: ::c_int = 94;
pub const EUNUSED95: ::c_int = 95;
pub const EUNUSED96: ::c_int = 96;
pub const EUNUSED97: ::c_int = 97;
pub const EUNUSED98: ::c_int = 98;
pub const EASYNC: ::c_int = 99;
pub const ELAST: ::c_int = 99;
pub const ELAST: ::c_int = 96;
pub const F_DUPFD: ::c_int = 0;
pub const F_GETFD: ::c_int = 1;
@ -323,9 +316,8 @@ pub const RLIMIT_VMEM: ::c_int = 10;
pub const RLIMIT_AS: ::c_int = RLIMIT_VMEM;
pub const RLIMIT_NPTS: ::c_int = 11;
pub const RLIMIT_SWAP: ::c_int = 12;
pub const RLIMIT_KQUEUES: ::c_int = 13;
pub const RLIM_NLIMITS: rlim_t = 14;
pub const RLIM_NLIMITS: rlim_t = 13;
pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff;
pub const RUSAGE_SELF: ::c_int = 0;
@ -366,8 +358,8 @@ pub const IP_TTL: ::c_int = 4;
pub const IP_HDRINCL: ::c_int = 2;
pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
pub const IPV6_ADD_MEMBERSHIP: ::c_int = 12;
pub const IPV6_DROP_MEMBERSHIP: ::c_int = 13;
pub const IPV6_JOIN_GROUP: ::c_int = 12;
pub const IPV6_LEAVE_GROUP: ::c_int = 13;
pub const TCP_NODELAY: ::c_int = 1;
pub const TCP_KEEPIDLE: ::c_int = 256;
@ -470,6 +462,26 @@ pub const _SC_SEM_VALUE_MAX: ::c_int = 50;
pub const _SC_SIGQUEUE_MAX: ::c_int = 51;
pub const _SC_TIMER_MAX: ::c_int = 52;
extern {
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,
oldp: *mut ::c_void,
oldlenp: *mut size_t,
newp: *const ::c_void,
newlen: size_t)
-> 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;
}
cfg_if! {
if #[cfg(target_arch = "x86")] {
mod x86;

View File

@ -30,22 +30,8 @@ s! {
}
extern {
pub fn shm_open(name: *const c_char, oflag: c_int, ...) -> c_int;
pub fn sysctl(name: *mut c_int,
namelen: c_uint,
oldp: *mut ::c_void,
oldlenp: *mut size_t,
newp: *mut ::c_void,
newlen: size_t)
-> c_int;
pub fn mincore(addr: *const ::c_void, len: size_t,
vec: *mut c_char) -> c_int;
pub fn sysctlbyname(name: *const c_char,
oldp: *mut ::c_void,
oldlenp: *mut size_t,
newp: *mut ::c_void,
newlen: size_t)
-> c_int;
pub fn sysctlnametomib(name: *const c_char,
mibp: *mut c_int,
sizep: *mut size_t)

View File

@ -710,4 +710,22 @@
pub const _SC_TIMERS : c_int = 94;
}
}
extern {
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: *mut c_int,
namelen: c_uint,
oldp: *mut ::c_void,
oldlenp: *mut size_t,
newp: *mut ::c_void,
newlen: size_t)
-> c_int;
pub fn sysctlbyname(name: *const c_char,
oldp: *mut ::c_void,
oldlenp: *mut size_t,
newp: *mut ::c_void,
newlen: size_t)
-> c_int;
}

View File

@ -336,10 +336,6 @@ extern {
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "msync$UNIX2003")]
pub fn msync(addr: *mut ::c_void, len: size_t, flags: c_int) -> c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "mprotect$UNIX2003")]
pub fn mprotect(addr: *mut ::c_void, len: size_t, prot: c_int)
-> c_int;
pub fn sysconf(name: c_int) -> c_long;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "usleep$UNIX2003")]

View File

@ -305,8 +305,10 @@ pub const LOCK_UN: ::c_int = 8;
extern {
pub fn fdatasync(fd: ::c_int) -> ::c_int;
pub fn mincore(addr: *mut ::c_void, len: size_t,
vec: *mut c_uchar) -> c_int;
pub fn mincore(addr: *mut ::c_void, len: ::size_t,
vec: *mut ::c_uchar) -> ::c_int;
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
-> ::c_int;
}
cfg_if! {