From cd8f31759fd04b9ce9c903fa00cae81dc5bba546 Mon Sep 17 00:00:00 2001 From: Dave Huseby Date: Fri, 16 Jan 2015 23:51:04 -0800 Subject: bitrig integration --- src/libstd/sys/common/net.rs | 3 ++- src/libstd/sys/common/stack.rs | 17 +++++++++++-- src/libstd/sys/unix/backtrace.rs | 1 + src/libstd/sys/unix/c.rs | 46 ++++++++++++++++++++++++++++++++++- src/libstd/sys/unix/fs.rs | 33 ++++++++++++++++++++++--- src/libstd/sys/unix/os.rs | 14 +++++++++-- src/libstd/sys/unix/process.rs | 1 + src/libstd/sys/unix/stack_overflow.rs | 15 +++++++++--- src/libstd/sys/unix/sync.rs | 1 + src/libstd/sys/unix/thread.rs | 35 ++++++++++++++++++++++++-- src/libstd/sys/unix/thread_local.rs | 2 ++ src/libstd/sys/unix/time.rs | 5 +++- src/libstd/sys/unix/tty.rs | 2 ++ 13 files changed, 159 insertions(+), 16 deletions(-) (limited to 'src/libstd/sys') diff --git a/src/libstd/sys/common/net.rs b/src/libstd/sys/common/net.rs index 7325e0a5ac8..aa0883e097e 100644 --- a/src/libstd/sys/common/net.rs +++ b/src/libstd/sys/common/net.rs @@ -689,7 +689,8 @@ impl TcpStream { setsockopt(self.fd(), libc::IPPROTO_TCP, libc::TCP_KEEPALIVE, seconds as libc::c_int) } - #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] + #[cfg(any(target_os = "freebsd", + target_os = "dragonfly"))] fn set_tcp_keepalive(&mut self, seconds: uint) -> IoResult<()> { setsockopt(self.fd(), libc::IPPROTO_TCP, libc::TCP_KEEPIDLE, seconds as libc::c_int) diff --git a/src/libstd/sys/common/stack.rs b/src/libstd/sys/common/stack.rs index 8dd2f154fa8..bc4ea662318 100644 --- a/src/libstd/sys/common/stack.rs +++ b/src/libstd/sys/common/stack.rs @@ -189,11 +189,18 @@ pub unsafe fn record_sp_limit(limit: uint) { unsafe fn target_record_sp_limit(limit: uint) { asm!("movq $0, %fs:24" :: "r"(limit) :: "volatile") } - #[cfg(all(target_arch = "x86_64", target_os = "dragonfly"))] #[inline(always)] + #[cfg(all(target_arch = "x86_64", target_os = "dragonfly"))] + #[inline(always)] unsafe fn target_record_sp_limit(limit: uint) { asm!("movq $0, %fs:32" :: "r"(limit) :: "volatile") } + #[cfg(target_os = "bitrig")] + #[inline(always)] + unsafe fn target_record_sp_limit(_: uint) { + // segmented stacks are disabled + } + // x86 #[cfg(all(target_arch = "x86", any(target_os = "macos", target_os = "ios")))] @@ -276,12 +283,18 @@ pub unsafe fn get_sp_limit() -> uint { asm!("movq %fs:24, $0" : "=r"(limit) ::: "volatile"); return limit; } - #[cfg(all(target_arch = "x86_64", target_os = "dragonfly"))] #[inline(always)] + #[cfg(all(target_arch = "x86_64", target_os = "dragonfly"))] + #[inline(always)] unsafe fn target_get_sp_limit() -> uint { let limit; asm!("movq %fs:32, $0" : "=r"(limit) ::: "volatile"); return limit; } + #[cfg(target_os = "bitrig")] + #[inline(always)] + unsafe fn target_get_sp_limit() -> uint { + return 2048; + } // x86 diff --git a/src/libstd/sys/unix/backtrace.rs b/src/libstd/sys/unix/backtrace.rs index 5e512e9261b..258e7058452 100644 --- a/src/libstd/sys/unix/backtrace.rs +++ b/src/libstd/sys/unix/backtrace.rs @@ -319,6 +319,7 @@ fn print(w: &mut Writer, idx: int, addr: *mut libc::c_void) -> IoResult<()> { if !STATE.is_null() { return STATE } let selfname = if cfg!(target_os = "freebsd") || cfg!(target_os = "dragonfly") || + cfg!(target_os = "bitrig") || cfg!(target_os = "openbsd") { env::current_exe().ok() } else { diff --git a/src/libstd/sys/unix/c.rs b/src/libstd/sys/unix/c.rs index cf05733cc18..06e5333239e 100644 --- a/src/libstd/sys/unix/c.rs +++ b/src/libstd/sys/unix/c.rs @@ -24,6 +24,7 @@ use libc; target_os = "ios", target_os = "freebsd", target_os = "dragonfly", + target_os = "bitrig", target_os = "openbsd"))] pub const FIONBIO: libc::c_ulong = 0x8004667e; #[cfg(any(all(target_os = "linux", @@ -43,6 +44,7 @@ pub const FIONBIO: libc::c_ulong = 0x667e; target_os = "ios", target_os = "freebsd", target_os = "dragonfly", + target_os = "bitrig", target_os = "openbsd"))] pub const FIOCLEX: libc::c_ulong = 0x20006601; #[cfg(any(all(target_os = "linux", @@ -62,6 +64,7 @@ pub const FIOCLEX: libc::c_ulong = 0x6601; target_os = "ios", target_os = "freebsd", target_os = "dragonfly", + target_os = "bitrig", target_os = "openbsd"))] pub const MSG_DONTWAIT: libc::c_int = 0x80; #[cfg(any(target_os = "linux", target_os = "android"))] @@ -75,7 +78,8 @@ pub const _SC_GETPW_R_SIZE_MAX: libc::c_int = 70; target_os = "freebsd", target_os = "dragonfly"))] pub const _SC_GETPW_R_SIZE_MAX: libc::c_int = 71; -#[cfg(target_os = "openbsd")] +#[cfg(any(target_os = "bitrig", + target_os = "openbsd"))] pub const _SC_GETPW_R_SIZE_MAX: libc::c_int = 101; #[cfg(target_os = "android")] pub const _SC_GETPW_R_SIZE_MAX: libc::c_int = 0x0048; @@ -96,6 +100,7 @@ pub struct passwd { #[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", + target_os = "bitrig", target_os = "openbsd"))] pub struct passwd { pub pw_name: *mut libc::c_char, @@ -176,6 +181,7 @@ mod select { #[cfg(any(target_os = "android", target_os = "freebsd", target_os = "dragonfly", + target_os = "bitrig", target_os = "openbsd", target_os = "linux"))] mod select { @@ -344,3 +350,41 @@ mod signal { pub sa_mask: sigset_t, } } + +#[cfg(target_os = "bitrig")] +mod signal { + use libc; + + pub const SA_ONSTACK: libc::c_int = 0x0001; + pub const SA_RESTART: libc::c_int = 0x0002; + pub const SA_RESETHAND: libc::c_int = 0x0004; + pub const SA_NOCLDSTOP: libc::c_int = 0x0008; + pub const SA_NODEFER: libc::c_int = 0x0010; + pub const SA_NOCLDWAIT: libc::c_int = 0x0020; + pub const SA_SIGINFO: libc::c_int = 0x0040; + pub const SIGCHLD: libc::c_int = 20; + + pub type sigset_t = libc::c_uint; + + // This structure has more fields, but we're not all that interested in + // them. + #[repr(C)] + pub struct siginfo { + pub si_signo: libc::c_int, + pub si_code: libc::c_int, + pub si_errno: libc::c_int, + // FIXME: Bitrig has a crazy union here in the siginfo, I think this + // layout will still work tho. The status might be off by the size of + // a clock_t by my reading, but we can fix this later. + pub pid: libc::pid_t, + pub uid: libc::uid_t, + pub status: libc::c_int, + } + + #[repr(C)] + pub struct sigaction { + pub sa_handler: extern fn(libc::c_int), + pub sa_mask: sigset_t, + pub sa_flags: libc::c_int, + } +} diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index 66ae018cb36..9bde7ed9d7e 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -291,6 +291,33 @@ fn mkstat(stat: &libc::stat) -> FileStat { // FileStat times are in milliseconds fn mktime(secs: u64, nsecs: u64) -> u64 { secs * 1000 + nsecs / 1000000 } + #[cfg(target_os = "bitrig")] + fn ctime(stat: &libc::stat) -> u64 { + mktime(stat.st_ctim.tv_sec as u64, stat.st_ctim.tv_nsec as u64) + } + #[cfg(not(target_os = "bitrig"))] + fn ctime(stat: &libc::stat) -> u64 { + mktime(stat.st_ctime as u64, stat.st_ctime_nsec as u64) + } + + #[cfg(target_os = "bitrig")] + fn atime(stat: &libc::stat) -> u64 { + mktime(stat.st_atim.tv_sec as u64, stat.st_atim.tv_nsec as u64) + } + #[cfg(not(target_os = "bitrig"))] + fn atime(stat: &libc::stat) -> u64 { + mktime(stat.st_atime as u64, stat.st_atime_nsec as u64) + } + + #[cfg(target_os = "bitrig")] + fn mtime(stat: &libc::stat) -> u64 { + mktime(stat.st_mtim.tv_sec as u64, stat.st_mtim.tv_nsec as u64) + } + #[cfg(not(target_os = "bitrig"))] + fn mtime(stat: &libc::stat) -> u64 { + mktime(stat.st_mtime as u64, stat.st_mtime_nsec as u64) + } + #[cfg(not(any(target_os = "linux", target_os = "android")))] fn flags(stat: &libc::stat) -> u64 { stat.st_flags as u64 } #[cfg(any(target_os = "linux", target_os = "android"))] @@ -312,9 +339,9 @@ fn mkstat(stat: &libc::stat) -> FileStat { _ => old_io::FileType::Unknown, }, perm: FilePermission::from_bits_truncate(stat.st_mode as u32), - created: mktime(stat.st_ctime as u64, stat.st_ctime_nsec as u64), - modified: mktime(stat.st_mtime as u64, stat.st_mtime_nsec as u64), - accessed: mktime(stat.st_atime as u64, stat.st_atime_nsec as u64), + created: ctime(stat), + modified: mtime(stat), + accessed: atime(stat), unstable: UnstableFileStat { device: stat.st_dev as u64, inode: stat.st_ino as u64, diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index b191eda583c..67098ac4689 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -40,6 +40,16 @@ pub fn errno() -> i32 { __error() } + #[cfg(target_os = "bitrig")] + fn errno_location() -> *const c_int { + extern { + fn __errno() -> *const c_int; + } + unsafe { + __errno() + } + } + #[cfg(target_os = "dragonfly")] unsafe fn errno_location() -> *const c_int { extern { fn __dfly_error() -> *const c_int; } @@ -192,10 +202,9 @@ pub fn current_exe() -> IoResult { fs::readlink(&Path::new("/proc/curproc/file")) } -#[cfg(target_os = "openbsd")] +#[cfg(any(target_os = "bitrig", target_os = "openbsd"))] pub fn current_exe() -> IoResult { use sync::{StaticMutex, MUTEX_INIT}; - static LOCK: StaticMutex = MUTEX_INIT; extern { @@ -330,6 +339,7 @@ pub fn args() -> Args { target_os = "android", target_os = "freebsd", target_os = "dragonfly", + target_os = "bitrig", target_os = "openbsd"))] pub fn args() -> Args { use rt; diff --git a/src/libstd/sys/unix/process.rs b/src/libstd/sys/unix/process.rs index 52a8ac9c338..4438d5d1b1f 100644 --- a/src/libstd/sys/unix/process.rs +++ b/src/libstd/sys/unix/process.rs @@ -593,6 +593,7 @@ fn translate_status(status: c_int) -> ProcessExit { target_os = "ios", target_os = "freebsd", target_os = "dragonfly", + target_os = "bitrig", target_os = "openbsd"))] mod imp { pub fn WIFEXITED(status: i32) -> bool { (status & 0x7f) == 0 } diff --git a/src/libstd/sys/unix/stack_overflow.rs b/src/libstd/sys/unix/stack_overflow.rs index 3512fa36eb3..efcb92e4826 100644 --- a/src/libstd/sys/unix/stack_overflow.rs +++ b/src/libstd/sys/unix/stack_overflow.rs @@ -34,6 +34,7 @@ impl Drop for Handler { #[cfg(any(target_os = "linux", target_os = "macos", + target_os = "bitrig", target_os = "openbsd"))] mod imp { use core::prelude::*; @@ -205,7 +206,9 @@ mod imp { } - #[cfg(any(target_os = "macos", target_os = "openbsd"))] + #[cfg(any(target_os = "macos", + target_os = "bitrig", + target_os = "openbsd"))] mod signal { use libc; use super::sighandler_t; @@ -219,6 +222,9 @@ mod imp { #[cfg(target_os = "openbsd")] pub const SIGSTKSZ: libc::size_t = 40960; + #[cfg(target_os = "bitrig")] + pub const SIGSTKSZ: libc::size_t = 40960; + pub const SIG_DFL: sighandler_t = 0 as sighandler_t; pub type sigset_t = u32; @@ -237,14 +243,14 @@ mod imp { pub si_addr: *mut libc::c_void } - #[cfg(target_os = "openbsd")] + #[cfg(any(target_os = "bitrig", target_os = "openbsd"))] #[repr(C)] pub struct siginfo { pub si_signo: libc::c_int, pub si_code: libc::c_int, pub si_errno: libc::c_int, - // union - pub si_addr: *mut libc::c_void, + //union + pub si_addr: *mut libc::c_void } #[repr(C)] @@ -277,6 +283,7 @@ mod imp { #[cfg(not(any(target_os = "linux", target_os = "macos", + target_os = "bitrig", target_os = "openbsd")))] mod imp { use libc; diff --git a/src/libstd/sys/unix/sync.rs b/src/libstd/sys/unix/sync.rs index bc93513af63..c7d704922cb 100644 --- a/src/libstd/sys/unix/sync.rs +++ b/src/libstd/sys/unix/sync.rs @@ -46,6 +46,7 @@ extern { #[cfg(any(target_os = "freebsd", target_os = "dragonfly", + target_os = "bitrig", target_os = "openbsd"))] mod os { use libc; diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index 6f030ee91fe..2a9531fa528 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -33,6 +33,7 @@ pub extern fn thread_start(main: *mut libc::c_void) -> rust_thread_return { #[cfg(all(not(target_os = "linux"), not(target_os = "macos"), + not(target_os = "bitrig"), not(target_os = "openbsd")))] pub mod guard { pub unsafe fn current() -> uint { @@ -50,11 +51,13 @@ pub mod guard { #[cfg(any(target_os = "linux", target_os = "macos", + target_os = "bitrig", target_os = "openbsd"))] pub mod guard { use super::*; #[cfg(any(target_os = "linux", target_os = "android", + target_os = "bitrig", target_os = "openbsd"))] use mem; #[cfg(any(target_os = "linux", target_os = "android"))] @@ -71,7 +74,9 @@ pub mod guard { static mut PAGE_SIZE: uint = 0; static mut GUARD_PAGE: uint = 0; - #[cfg(any(target_os = "macos", target_os = "openbsd"))] + #[cfg(any(target_os = "macos", + target_os = "bitrig", + target_os = "openbsd"))] unsafe fn get_stack_start() -> *mut libc::c_void { current() as *mut libc::c_void } @@ -189,6 +194,22 @@ pub mod guard { stackaddr as uint + guardsize as uint } + + #[cfg(target_os = "bitrig")] + pub unsafe fn current() -> uint { + let mut current_stack: stack_t = mem::zeroed(); + if pthread_stackseg_np(pthread_self(), &mut current_stack) != 0 { + panic!("failed to get current stack: pthread_stackseg_np") + } + + if pthread_main_np() == 1 { + // main thread + current_stack.ss_sp as uint - current_stack.ss_size as uint + 3 * PAGE_SIZE as uint + } else { + // new thread + current_stack.ss_sp as uint - current_stack.ss_size as uint + } + } } pub unsafe fn create(stack: uint, p: Thunk) -> rust_thread { @@ -250,6 +271,7 @@ pub unsafe fn set_name(name: &str) { #[cfg(any(target_os = "freebsd", target_os = "dragonfly", + target_os = "bitrig", target_os = "openbsd"))] pub unsafe fn set_name(name: &str) { // pthread_set_name_np() since almost forever on all BSDs @@ -332,6 +354,15 @@ extern { fn pthread_setname_np(name: *const libc::c_char) -> libc::c_int; } +#[cfg(target_os = "bitrig")] +extern { + pub fn pthread_self() -> libc::pthread_t; + pub fn pthread_stackseg_np(thread: libc::pthread_t, + sinfo: *mut stack_t) -> libc::c_uint; + pub fn pthread_main_np() -> libc::c_uint; + fn pthread_set_name_np(tid: libc::pthread_t, name: *const libc::c_char); +} + #[cfg(target_os = "openbsd")] extern { pub fn pthread_stackseg_np(thread: libc::pthread_t, @@ -339,7 +370,7 @@ extern { pub fn pthread_main_np() -> libc::c_uint; } -#[cfg(target_os = "openbsd")] +#[cfg(any(target_os = "bitrig", target_os = "openbsd"))] #[repr(C)] pub struct stack_t { pub ss_sp: *mut libc::c_void, diff --git a/src/libstd/sys/unix/thread_local.rs b/src/libstd/sys/unix/thread_local.rs index 62d9a33c83d..9b7079ee108 100644 --- a/src/libstd/sys/unix/thread_local.rs +++ b/src/libstd/sys/unix/thread_local.rs @@ -43,6 +43,7 @@ type pthread_key_t = ::libc::c_ulong; #[cfg(any(target_os = "freebsd", target_os = "dragonfly", + target_os = "bitrig", target_os = "openbsd"))] type pthread_key_t = ::libc::c_int; @@ -50,6 +51,7 @@ type pthread_key_t = ::libc::c_int; target_os = "ios", target_os = "freebsd", target_os = "dragonfly", + target_os = "bitrig", target_os = "openbsd")))] type pthread_key_t = ::libc::c_uint; diff --git a/src/libstd/sys/unix/time.rs b/src/libstd/sys/unix/time.rs index bddf7b075df..7016a700dd8 100644 --- a/src/libstd/sys/unix/time.rs +++ b/src/libstd/sys/unix/time.rs @@ -80,8 +80,11 @@ mod inner { } // Apparently android provides this in some other library? + // Bitrig's RT extensions are in the C library, not a separate librt // OpenBSD provide it via libc - #[cfg(not(any(target_os = "android", target_os = "openbsd")))] + #[cfg(not(any(target_os = "android", + target_os = "bitrig", + target_os = "openbsd")))] #[link(name = "rt")] extern {} diff --git a/src/libstd/sys/unix/tty.rs b/src/libstd/sys/unix/tty.rs index 3a79047445c..8e60bbf4cbd 100644 --- a/src/libstd/sys/unix/tty.rs +++ b/src/libstd/sys/unix/tty.rs @@ -22,6 +22,7 @@ pub struct TTY { #[cfg(any(target_os = "macos", target_os = "freebsd", + target_os = "bitrig", target_os = "openbsd"))] const TIOCGWINSZ: c_ulong = 0x40087468; @@ -55,6 +56,7 @@ impl TTY { target_os = "android", target_os = "macos", target_os = "freebsd", + target_os = "bitrig", target_os = "openbsd"))] pub fn get_winsize(&mut self) -> IoResult<(int, int)> { unsafe { -- cgit 1.4.1-3-g733a5 From 1386ad489d7dda6a85a52ff042a7d4a47c56e808 Mon Sep 17 00:00:00 2001 From: Dave Huseby Date: Wed, 4 Feb 2015 23:53:02 -0800 Subject: fixing trailing whitespace errors --- src/librustdoc/flock.rs | 2 +- src/libstd/rtdeps.rs | 2 +- src/libstd/sys/unix/fs.rs | 12 ++++++------ src/libstd/sys/unix/stack_overflow.rs | 2 +- src/libstd/sys/unix/thread.rs | 2 +- src/libstd/sys/unix/time.rs | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/libstd/sys') diff --git a/src/librustdoc/flock.rs b/src/librustdoc/flock.rs index 099be92374d..b08e9336fb7 100644 --- a/src/librustdoc/flock.rs +++ b/src/librustdoc/flock.rs @@ -64,7 +64,7 @@ mod imp { pub const F_SETLKW: libc::c_int = 13; } - #[cfg(any(target_os = "dragonfly", + #[cfg(any(target_os = "dragonfly", target_os = "bitrig", target_os = "openbsd"))] mod os { diff --git a/src/libstd/rtdeps.rs b/src/libstd/rtdeps.rs index a2f5e8680fd..96c4bcec853 100644 --- a/src/libstd/rtdeps.rs +++ b/src/libstd/rtdeps.rs @@ -39,7 +39,7 @@ extern {} #[link(name = "pthread")] extern {} -#[cfg(any(target_os = "dragonfly", +#[cfg(any(target_os = "dragonfly", target_os = "bitrig", target_os = "openbsd"))] #[link(name = "pthread")] diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index 9bde7ed9d7e..b53a480f853 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -292,29 +292,29 @@ fn mkstat(stat: &libc::stat) -> FileStat { fn mktime(secs: u64, nsecs: u64) -> u64 { secs * 1000 + nsecs / 1000000 } #[cfg(target_os = "bitrig")] - fn ctime(stat: &libc::stat) -> u64 { + fn ctime(stat: &libc::stat) -> u64 { mktime(stat.st_ctim.tv_sec as u64, stat.st_ctim.tv_nsec as u64) } #[cfg(not(target_os = "bitrig"))] - fn ctime(stat: &libc::stat) -> u64 { + fn ctime(stat: &libc::stat) -> u64 { mktime(stat.st_ctime as u64, stat.st_ctime_nsec as u64) } #[cfg(target_os = "bitrig")] - fn atime(stat: &libc::stat) -> u64 { + fn atime(stat: &libc::stat) -> u64 { mktime(stat.st_atim.tv_sec as u64, stat.st_atim.tv_nsec as u64) } #[cfg(not(target_os = "bitrig"))] - fn atime(stat: &libc::stat) -> u64 { + fn atime(stat: &libc::stat) -> u64 { mktime(stat.st_atime as u64, stat.st_atime_nsec as u64) } #[cfg(target_os = "bitrig")] - fn mtime(stat: &libc::stat) -> u64 { + fn mtime(stat: &libc::stat) -> u64 { mktime(stat.st_mtim.tv_sec as u64, stat.st_mtim.tv_nsec as u64) } #[cfg(not(target_os = "bitrig"))] - fn mtime(stat: &libc::stat) -> u64 { + fn mtime(stat: &libc::stat) -> u64 { mktime(stat.st_mtime as u64, stat.st_mtime_nsec as u64) } diff --git a/src/libstd/sys/unix/stack_overflow.rs b/src/libstd/sys/unix/stack_overflow.rs index efcb92e4826..04dd36a24ab 100644 --- a/src/libstd/sys/unix/stack_overflow.rs +++ b/src/libstd/sys/unix/stack_overflow.rs @@ -206,7 +206,7 @@ mod imp { } - #[cfg(any(target_os = "macos", + #[cfg(any(target_os = "macos", target_os = "bitrig", target_os = "openbsd"))] mod signal { diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index 2a9531fa528..ae9261d87c6 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -74,7 +74,7 @@ pub mod guard { static mut PAGE_SIZE: uint = 0; static mut GUARD_PAGE: uint = 0; - #[cfg(any(target_os = "macos", + #[cfg(any(target_os = "macos", target_os = "bitrig", target_os = "openbsd"))] unsafe fn get_stack_start() -> *mut libc::c_void { diff --git a/src/libstd/sys/unix/time.rs b/src/libstd/sys/unix/time.rs index 7016a700dd8..1104bc995c6 100644 --- a/src/libstd/sys/unix/time.rs +++ b/src/libstd/sys/unix/time.rs @@ -82,7 +82,7 @@ mod inner { // Apparently android provides this in some other library? // Bitrig's RT extensions are in the C library, not a separate librt // OpenBSD provide it via libc - #[cfg(not(any(target_os = "android", + #[cfg(not(any(target_os = "android", target_os = "bitrig", target_os = "openbsd")))] #[link(name = "rt")] -- cgit 1.4.1-3-g733a5 From 45165d0ee9ddbfa3f81bb83305972a3d3bd9c1b0 Mon Sep 17 00:00:00 2001 From: Dave Huseby Date: Wed, 4 Feb 2015 23:59:39 -0800 Subject: fixing more trailing whitespace --- src/libstd/sys/unix/fs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libstd/sys') diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index b53a480f853..434e1d06963 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -297,7 +297,7 @@ fn mkstat(stat: &libc::stat) -> FileStat { } #[cfg(not(target_os = "bitrig"))] fn ctime(stat: &libc::stat) -> u64 { - mktime(stat.st_ctime as u64, stat.st_ctime_nsec as u64) + mktime(stat.st_ctime as u64, stat.st_ctime_nsec as u64) } #[cfg(target_os = "bitrig")] -- cgit 1.4.1-3-g733a5 From 2ece7a6831ed3cc034ff0526236c68d92b1b7510 Mon Sep 17 00:00:00 2001 From: Dave Huseby Date: Thu, 5 Feb 2015 11:34:59 -0800 Subject: PR review fixes --- mk/platform.mk | 18 +++++++++--------- src/libstd/sys/common/stack.rs | 14 ++------------ 2 files changed, 11 insertions(+), 21 deletions(-) (limited to 'src/libstd/sys') diff --git a/mk/platform.mk b/mk/platform.mk index 3b172e87bda..ed50585822e 100644 --- a/mk/platform.mk +++ b/mk/platform.mk @@ -144,14 +144,14 @@ FIND_COMPILER = $(word 1,$(1:ccache=)) define CFG_MAKE_TOOLCHAIN # Prepend the tools with their prefix if cross compiling ifneq ($(CFG_BUILD),$(1)) - CC_$(1)=$(CROSS_PREFIX_$(1))$(CC_$(1)) - CXX_$(1)=$(CROSS_PREFIX_$(1))$(CXX_$(1)) - CPP_$(1)=$(CROSS_PREFIX_$(1))$(CPP_$(1)) - AR_$(1)=$(CROSS_PREFIX_$(1))$(AR_$(1)) - RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(call FIND_COMPILER,$$(CC_$(1))) \ - -C ar=$$(call FIND_COMPILER,$$(AR_$(1))) $(RUSTC_CROSS_FLAGS_$(1)) - - RUSTC_FLAGS_$(1)=$$(RUSTC_CROSS_FLAGS_$(1)) $(RUSTC_FLAGS_$(1)) + CC_$(1)=$(CROSS_PREFIX_$(1))$(CC_$(1)) + CXX_$(1)=$(CROSS_PREFIX_$(1))$(CXX_$(1)) + CPP_$(1)=$(CROSS_PREFIX_$(1))$(CPP_$(1)) + AR_$(1)=$(CROSS_PREFIX_$(1))$(AR_$(1)) + RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(call FIND_COMPILER,$$(CC_$(1))) \ + -C ar=$$(call FIND_COMPILER,$$(AR_$(1))) $(RUSTC_CROSS_FLAGS_$(1)) + + RUSTC_FLAGS_$(1)=$$(RUSTC_CROSS_FLAGS_$(1)) $(RUSTC_FLAGS_$(1)) endif CFG_COMPILE_C_$(1) = $$(CC_$(1)) \ @@ -200,7 +200,7 @@ define CFG_MAKE_TOOLCHAIN # For the ARM, AARCH64, MIPS and POWER crosses, use the toolchain assembler # FIXME: We should be able to use the LLVM assembler CFG_ASSEMBLE_$(1)=$$(CC_$(1)) $$(CFG_GCCISH_CFLAGS_$(1)) \ - $$(CFG_DEPEND_FLAGS) $$(2) -c -o $$(1) + $$(CFG_DEPEND_FLAGS) $$(2) -c -o $$(1) endif diff --git a/src/libstd/sys/common/stack.rs b/src/libstd/sys/common/stack.rs index bc4ea662318..5ebc851e194 100644 --- a/src/libstd/sys/common/stack.rs +++ b/src/libstd/sys/common/stack.rs @@ -195,12 +195,6 @@ pub unsafe fn record_sp_limit(limit: uint) { asm!("movq $0, %fs:32" :: "r"(limit) :: "volatile") } - #[cfg(target_os = "bitrig")] - #[inline(always)] - unsafe fn target_record_sp_limit(_: uint) { - // segmented stacks are disabled - } - // x86 #[cfg(all(target_arch = "x86", any(target_os = "macos", target_os = "ios")))] @@ -240,6 +234,7 @@ pub unsafe fn record_sp_limit(limit: uint) { #[cfg(any(target_arch = "aarch64", target_arch = "powerpc", all(target_arch = "arm", target_os = "ios"), + target_os = "bitrig", target_os = "openbsd"))] unsafe fn target_record_sp_limit(_: uint) { } @@ -290,12 +285,6 @@ pub unsafe fn get_sp_limit() -> uint { asm!("movq %fs:32, $0" : "=r"(limit) ::: "volatile"); return limit; } - #[cfg(target_os = "bitrig")] - #[inline(always)] - unsafe fn target_get_sp_limit() -> uint { - return 2048; - } - // x86 #[cfg(all(target_arch = "x86", @@ -344,6 +333,7 @@ pub unsafe fn get_sp_limit() -> uint { #[cfg(any(target_arch = "aarch64", target_arch = "powerpc", all(target_arch = "arm", target_os = "ios"), + target_os = "bitrig", target_os = "openbsd"))] #[inline(always)] unsafe fn target_get_sp_limit() -> uint { -- cgit 1.4.1-3-g733a5 From 47ad1cdf564eb9488df9316f13eed710996d2277 Mon Sep 17 00:00:00 2001 From: Dave Huseby Date: Fri, 6 Feb 2015 17:59:35 -0800 Subject: fixing PR review comments --- src/liblibc/lib.rs | 417 +--------------------------------- src/librustc_back/x86.rs | 5 +- src/librustc_back/x86_64.rs | 7 +- src/libstd/sys/unix/c.rs | 8 +- src/libstd/sys/unix/stack_overflow.rs | 5 +- 5 files changed, 15 insertions(+), 427 deletions(-) (limited to 'src/libstd/sys') diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index 342e532fc91..25530666f71 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -1517,7 +1517,7 @@ pub mod types { pub mod posix01 { use types::common::c95::{c_void}; use types::common::c99::{uint32_t, uint64_t}; - use types::os::arch::c95::{time_t}; + use types::os::arch::c95::{c_long, time_t}; use types::os::arch::posix88::{dev_t, gid_t}; use types::os::arch::posix88::{mode_t, off_t}; use types::os::arch::posix88::{uid_t}; @@ -1538,15 +1538,19 @@ pub mod types { pub st_uid: uid_t, pub st_gid: gid_t, pub st_rdev: dev_t, - pub st_atim: timespec, - pub st_mtim: timespec, - pub st_ctim: timespec, + pub st_atime: time_t, + pub st_atime_nsec: c_long, + pub st_mtime: time_t, + pub st_mtime_nsec: c_long, + pub st_ctime: time_t, + pub st_ctime_nsec: c_long, pub st_size: off_t, pub st_blocks: blkcnt_t, pub st_blksize: blksize_t, pub st_flags: fflags_t, pub st_gen: uint32_t, - pub __st_birthtim: timespec, + pub st_birthtime: time_t, + pub st_birthtime_nsec: c_long, } #[repr(C)] #[derive(Copy)] pub struct utimbuf { @@ -4676,409 +4680,6 @@ pub mod consts { pub const _SC_TIMER_MAX : c_int = 93; } } - - #[cfg(any(target_os = "macos", target_os = "ios"))] - pub mod os { - pub mod c95 { - use types::os::arch::c95::{c_int, c_uint}; - - pub const EXIT_FAILURE : c_int = 1; - pub const EXIT_SUCCESS : c_int = 0; - pub const RAND_MAX : c_int = 2147483647; - pub const EOF : c_int = -1; - pub const SEEK_SET : c_int = 0; - pub const SEEK_CUR : c_int = 1; - 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_u32; - pub const FOPEN_MAX : c_uint = 20_u32; - pub const FILENAME_MAX : c_uint = 1024_u32; - pub const L_tmpnam : c_uint = 1024_u32; - pub const TMP_MAX : c_uint = 308915776_u32; - } - pub mod c99 { - } - pub mod posix88 { - use types::common::c95::c_void; - use types::os::arch::c95::c_int; - use types::os::arch::posix88::mode_t; - - pub const O_RDONLY : c_int = 0; - pub const O_WRONLY : c_int = 1; - pub const O_RDWR : c_int = 2; - pub const O_APPEND : c_int = 8; - pub const O_CREAT : c_int = 512; - pub const O_EXCL : c_int = 2048; - pub const O_TRUNC : c_int = 1024; - pub const S_IFIFO : mode_t = 4096; - pub const S_IFCHR : mode_t = 8192; - pub const S_IFBLK : mode_t = 24576; - pub const S_IFDIR : mode_t = 16384; - pub const S_IFREG : mode_t = 32768; - pub const S_IFLNK : mode_t = 40960; - pub const S_IFMT : mode_t = 61440; - pub const S_IEXEC : mode_t = 64; - pub const S_IWRITE : mode_t = 128; - pub const S_IREAD : mode_t = 256; - pub const S_IRWXU : mode_t = 448; - pub const S_IXUSR : mode_t = 64; - pub const S_IWUSR : mode_t = 128; - pub const S_IRUSR : mode_t = 256; - pub const F_OK : c_int = 0; - pub const R_OK : c_int = 4; - pub const W_OK : c_int = 2; - pub const X_OK : c_int = 1; - pub const STDIN_FILENO : c_int = 0; - pub const STDOUT_FILENO : c_int = 1; - pub const STDERR_FILENO : c_int = 2; - pub const F_LOCK : c_int = 1; - pub const F_TEST : c_int = 3; - pub const F_TLOCK : c_int = 2; - pub const F_ULOCK : c_int = 0; - pub const SIGHUP : c_int = 1; - pub const SIGINT : c_int = 2; - pub const SIGQUIT : c_int = 3; - pub const SIGILL : c_int = 4; - pub const SIGABRT : c_int = 6; - pub const SIGFPE : c_int = 8; - pub const SIGKILL : c_int = 9; - pub const SIGSEGV : c_int = 11; - pub const SIGPIPE : c_int = 13; - pub const SIGALRM : c_int = 14; - pub const SIGTERM : c_int = 15; - - pub const PROT_NONE : c_int = 0; - pub const PROT_READ : c_int = 1; - pub const PROT_WRITE : c_int = 2; - pub const PROT_EXEC : c_int = 4; - - pub const MAP_FILE : c_int = 0x0000; - pub const MAP_SHARED : c_int = 0x0001; - pub const MAP_PRIVATE : c_int = 0x0002; - pub const MAP_FIXED : c_int = 0x0010; - pub const MAP_ANON : c_int = 0x1000; - - pub const MAP_FAILED : *mut c_void = -1 as *mut c_void; - - pub const MCL_CURRENT : c_int = 0x0001; - pub const MCL_FUTURE : c_int = 0x0002; - - pub const MS_ASYNC : c_int = 0x0001; - pub const MS_INVALIDATE : c_int = 0x0002; - pub const MS_SYNC : c_int = 0x0010; - - pub const MS_KILLPAGES : c_int = 0x0004; - pub const MS_DEACTIVATE : c_int = 0x0008; - - pub const EPERM : c_int = 1; - pub const ENOENT : c_int = 2; - pub const ESRCH : c_int = 3; - pub const EINTR : c_int = 4; - pub const EIO : c_int = 5; - pub const ENXIO : c_int = 6; - pub const E2BIG : c_int = 7; - pub const ENOEXEC : c_int = 8; - pub const EBADF : c_int = 9; - pub const ECHILD : c_int = 10; - pub const EDEADLK : c_int = 11; - pub const ENOMEM : c_int = 12; - pub const EACCES : c_int = 13; - pub const EFAULT : c_int = 14; - pub const ENOTBLK : c_int = 15; - pub const EBUSY : c_int = 16; - pub const EEXIST : c_int = 17; - pub const EXDEV : c_int = 18; - pub const ENODEV : c_int = 19; - pub const ENOTDIR : c_int = 20; - pub const EISDIR : c_int = 21; - pub const EINVAL : c_int = 22; - pub const ENFILE : c_int = 23; - pub const EMFILE : c_int = 24; - pub const ENOTTY : c_int = 25; - pub const ETXTBSY : c_int = 26; - pub const EFBIG : c_int = 27; - pub const ENOSPC : c_int = 28; - pub const ESPIPE : c_int = 29; - pub const EROFS : c_int = 30; - pub const EMLINK : c_int = 31; - pub const EPIPE : c_int = 32; - pub const EDOM : c_int = 33; - pub const ERANGE : c_int = 34; - pub const EAGAIN : c_int = 35; - pub const EWOULDBLOCK : c_int = EAGAIN; - pub const EINPROGRESS : c_int = 36; - pub const EALREADY : c_int = 37; - pub const ENOTSOCK : c_int = 38; - pub const EDESTADDRREQ : c_int = 39; - pub const EMSGSIZE : c_int = 40; - pub const EPROTOTYPE : c_int = 41; - pub const ENOPROTOOPT : c_int = 42; - pub const EPROTONOSUPPORT : c_int = 43; - pub const ESOCKTNOSUPPORT : c_int = 44; - pub const ENOTSUP : c_int = 45; - pub const EPFNOSUPPORT : c_int = 46; - pub const EAFNOSUPPORT : c_int = 47; - pub const EADDRINUSE : c_int = 48; - pub const EADDRNOTAVAIL : c_int = 49; - pub const ENETDOWN : c_int = 50; - pub const ENETUNREACH : c_int = 51; - pub const ENETRESET : c_int = 52; - pub const ECONNABORTED : c_int = 53; - pub const ECONNRESET : c_int = 54; - pub const ENOBUFS : c_int = 55; - pub const EISCONN : c_int = 56; - pub const ENOTCONN : c_int = 57; - pub const ESHUTDOWN : c_int = 58; - pub const ETOOMANYREFS : c_int = 59; - pub const ETIMEDOUT : c_int = 60; - pub const ECONNREFUSED : c_int = 61; - pub const ELOOP : c_int = 62; - pub const ENAMETOOLONG : c_int = 63; - pub const EHOSTDOWN : c_int = 64; - pub const EHOSTUNREACH : c_int = 65; - pub const ENOTEMPTY : c_int = 66; - pub const EPROCLIM : c_int = 67; - pub const EUSERS : c_int = 68; - pub const EDQUOT : c_int = 69; - pub const ESTALE : c_int = 70; - pub const EREMOTE : c_int = 71; - pub const EBADRPC : c_int = 72; - pub const ERPCMISMATCH : c_int = 73; - pub const EPROGUNAVAIL : c_int = 74; - pub const EPROGMISMATCH : c_int = 75; - pub const EPROCUNAVAIL : c_int = 76; - pub const ENOLCK : c_int = 77; - pub const ENOSYS : c_int = 78; - pub const EFTYPE : c_int = 79; - pub const EAUTH : c_int = 80; - pub const ENEEDAUTH : c_int = 81; - pub const EPWROFF : c_int = 82; - pub const EDEVERR : c_int = 83; - pub const EOVERFLOW : c_int = 84; - pub const EBADEXEC : c_int = 85; - pub const EBADARCH : c_int = 86; - pub const ESHLIBVERS : c_int = 87; - pub const EBADMACHO : c_int = 88; - pub const ECANCELED : c_int = 89; - pub const EIDRM : c_int = 90; - pub const ENOMSG : c_int = 91; - pub const EILSEQ : c_int = 92; - pub const ENOATTR : c_int = 93; - pub const EBADMSG : c_int = 94; - pub const EMULTIHOP : c_int = 95; - pub const ENODATA : c_int = 96; - pub const ENOLINK : c_int = 97; - pub const ENOSR : c_int = 98; - pub const ENOSTR : c_int = 99; - pub const EPROTO : c_int = 100; - pub const ETIME : c_int = 101; - pub const EOPNOTSUPP : c_int = 102; - pub const ENOPOLICY : c_int = 103; - pub const ENOTRECOVERABLE : c_int = 104; - pub const EOWNERDEAD : c_int = 105; - pub const EQFULL : c_int = 106; - pub const ELAST : c_int = 106; - } - pub mod posix01 { - use types::os::arch::c95::{c_int, size_t}; - - pub const F_DUPFD : c_int = 0; - pub const F_GETFD : c_int = 1; - pub const F_SETFD : c_int = 2; - pub const F_GETFL : c_int = 3; - pub const F_SETFL : c_int = 4; - - pub const SIGTRAP : c_int = 5; - pub const SIGPIPE: c_int = 13; - pub const SIG_IGN: size_t = 1; - - pub const GLOB_APPEND : c_int = 0x0001; - pub const GLOB_DOOFFS : c_int = 0x0002; - pub const GLOB_ERR : c_int = 0x0004; - pub const GLOB_MARK : c_int = 0x0008; - pub const GLOB_NOCHECK : c_int = 0x0010; - pub const GLOB_NOSORT : c_int = 0x0020; - pub const GLOB_NOESCAPE : c_int = 0x2000; - - pub const GLOB_NOSPACE : c_int = -1; - pub const GLOB_ABORTED : c_int = -2; - pub const GLOB_NOMATCH : c_int = -3; - - pub const POSIX_MADV_NORMAL : c_int = 0; - pub const POSIX_MADV_RANDOM : c_int = 1; - pub const POSIX_MADV_SEQUENTIAL : c_int = 2; - pub const POSIX_MADV_WILLNEED : c_int = 3; - pub const POSIX_MADV_DONTNEED : c_int = 4; - - pub const _SC_IOV_MAX : c_int = 56; - pub const _SC_GETGR_R_SIZE_MAX : c_int = 70; - pub const _SC_GETPW_R_SIZE_MAX : c_int = 71; - pub const _SC_LOGIN_NAME_MAX : c_int = 73; - pub const _SC_MQ_PRIO_MAX : c_int = 75; - pub const _SC_THREAD_ATTR_STACKADDR : c_int = 82; - pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 83; - pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 85; - pub const _SC_THREAD_KEYS_MAX : c_int = 86; - pub const _SC_THREAD_PRIO_INHERIT : c_int = 87; - pub const _SC_THREAD_PRIO_PROTECT : c_int = 88; - pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 89; - pub const _SC_THREAD_PROCESS_SHARED : c_int = 90; - pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 91; - pub const _SC_THREAD_STACK_MIN : c_int = 93; - pub const _SC_THREAD_THREADS_MAX : c_int = 94; - pub const _SC_THREADS : c_int = 96; - pub const _SC_TTY_NAME_MAX : c_int = 101; - pub const _SC_ATEXIT_MAX : c_int = 107; - pub const _SC_XOPEN_CRYPT : c_int = 108; - pub const _SC_XOPEN_ENH_I18N : c_int = 109; - pub const _SC_XOPEN_LEGACY : c_int = 110; - pub const _SC_XOPEN_REALTIME : c_int = 111; - pub const _SC_XOPEN_REALTIME_THREADS : c_int = 112; - pub const _SC_XOPEN_SHM : c_int = 113; - pub const _SC_XOPEN_UNIX : c_int = 115; - pub const _SC_XOPEN_VERSION : c_int = 116; - pub const _SC_XOPEN_XCU_VERSION : c_int = 121; - - pub const PTHREAD_CREATE_JOINABLE: c_int = 1; - pub const PTHREAD_CREATE_DETACHED: c_int = 2; - pub const PTHREAD_STACK_MIN: size_t = 8192; - } - pub mod posix08 { - } - pub mod bsd44 { - use types::os::arch::c95::c_int; - - pub const MADV_NORMAL : c_int = 0; - pub const MADV_RANDOM : c_int = 1; - pub const MADV_SEQUENTIAL : c_int = 2; - pub const MADV_WILLNEED : c_int = 3; - pub const MADV_DONTNEED : c_int = 4; - pub const MADV_FREE : c_int = 5; - pub const MADV_ZERO_WIRED_PAGES : c_int = 6; - pub const MADV_FREE_REUSABLE : c_int = 7; - pub const MADV_FREE_REUSE : c_int = 8; - pub const MADV_CAN_REUSE : c_int = 9; - - pub const MINCORE_INCORE : c_int = 0x1; - pub const MINCORE_REFERENCED : c_int = 0x2; - pub const MINCORE_MODIFIED : c_int = 0x4; - pub const MINCORE_REFERENCED_OTHER : c_int = 0x8; - pub const MINCORE_MODIFIED_OTHER : c_int = 0x10; - - pub const AF_UNIX: c_int = 1; - pub const AF_INET: c_int = 2; - pub const AF_INET6: c_int = 30; - pub const SOCK_STREAM: c_int = 1; - pub const SOCK_DGRAM: c_int = 2; - pub const SOCK_RAW: c_int = 3; - pub const IPPROTO_TCP: c_int = 6; - pub const IPPROTO_IP: c_int = 0; - pub const IPPROTO_IPV6: c_int = 41; - pub const IP_MULTICAST_TTL: c_int = 10; - pub const IP_MULTICAST_LOOP: c_int = 11; - 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 TCP_NODELAY: c_int = 0x01; - pub const TCP_KEEPALIVE: c_int = 0x10; - pub const SOL_SOCKET: c_int = 0xffff; - pub const SO_KEEPALIVE: c_int = 0x0008; - pub const SO_BROADCAST: c_int = 0x0020; - pub const SO_REUSEADDR: c_int = 0x0004; - pub const SO_ERROR: c_int = 0x1007; - - pub const IFF_LOOPBACK: c_int = 0x8; - - pub const SHUT_RD: c_int = 0; - pub const SHUT_WR: c_int = 1; - pub const SHUT_RDWR: c_int = 2; - } - pub mod extra { - use types::os::arch::c95::c_int; - - pub const O_DSYNC : c_int = 4194304; - pub const O_SYNC : c_int = 128; - pub const O_NONBLOCK : c_int = 4; - pub const F_FULLFSYNC : c_int = 51; - - pub const MAP_COPY : c_int = 0x0002; - pub const MAP_RENAME : c_int = 0x0020; - pub const MAP_NORESERVE : c_int = 0x0040; - pub const MAP_NOEXTEND : c_int = 0x0100; - pub const MAP_HASSEMAPHORE : c_int = 0x0200; - pub const MAP_NOCACHE : c_int = 0x0400; - pub const MAP_JIT : c_int = 0x0800; - pub const MAP_STACK : c_int = 0; - - pub const IPPROTO_RAW : c_int = 255; - } - pub mod sysconf { - use types::os::arch::c95::c_int; - - pub const _SC_ARG_MAX : c_int = 1; - pub const _SC_CHILD_MAX : c_int = 2; - pub const _SC_CLK_TCK : c_int = 3; - pub const _SC_NGROUPS_MAX : c_int = 4; - pub const _SC_OPEN_MAX : c_int = 5; - pub const _SC_JOB_CONTROL : c_int = 6; - pub const _SC_SAVED_IDS : c_int = 7; - pub const _SC_VERSION : c_int = 8; - pub const _SC_BC_BASE_MAX : c_int = 9; - pub const _SC_BC_DIM_MAX : c_int = 10; - pub const _SC_BC_SCALE_MAX : c_int = 11; - pub const _SC_BC_STRING_MAX : c_int = 12; - pub const _SC_COLL_WEIGHTS_MAX : c_int = 13; - pub const _SC_EXPR_NEST_MAX : c_int = 14; - pub const _SC_LINE_MAX : c_int = 15; - pub const _SC_RE_DUP_MAX : c_int = 16; - pub const _SC_2_VERSION : c_int = 17; - pub const _SC_2_C_BIND : c_int = 18; - pub const _SC_2_C_DEV : c_int = 19; - pub const _SC_2_CHAR_TERM : c_int = 20; - pub const _SC_2_FORT_DEV : c_int = 21; - pub const _SC_2_FORT_RUN : c_int = 22; - pub const _SC_2_LOCALEDEF : c_int = 23; - pub const _SC_2_SW_DEV : c_int = 24; - pub const _SC_2_UPE : c_int = 25; - pub const _SC_STREAM_MAX : c_int = 26; - pub const _SC_TZNAME_MAX : c_int = 27; - pub const _SC_ASYNCHRONOUS_IO : c_int = 28; - pub const _SC_PAGESIZE : c_int = 29; - pub const _SC_MEMLOCK : c_int = 30; - pub const _SC_MEMLOCK_RANGE : c_int = 31; - pub const _SC_MEMORY_PROTECTION : c_int = 32; - pub const _SC_MESSAGE_PASSING : c_int = 33; - pub const _SC_PRIORITIZED_IO : c_int = 34; - pub const _SC_PRIORITY_SCHEDULING : c_int = 35; - pub const _SC_REALTIME_SIGNALS : c_int = 36; - pub const _SC_SEMAPHORES : c_int = 37; - pub const _SC_FSYNC : c_int = 38; - pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 39; - pub const _SC_SYNCHRONIZED_IO : c_int = 40; - pub const _SC_TIMERS : c_int = 41; - pub const _SC_AIO_LISTIO_MAX : c_int = 42; - pub const _SC_AIO_MAX : c_int = 43; - pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 44; - pub const _SC_DELAYTIMER_MAX : c_int = 45; - pub const _SC_MQ_OPEN_MAX : c_int = 46; - pub const _SC_MAPPED_FILES : c_int = 47; - pub const _SC_RTSIG_MAX : c_int = 48; - pub const _SC_SEM_NSEMS_MAX : c_int = 49; - 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; - pub const _SC_XBS5_ILP32_OFF32 : c_int = 122; - pub const _SC_XBS5_ILP32_OFFBIG : c_int = 123; - pub const _SC_XBS5_LP64_OFF64 : c_int = 124; - pub const _SC_XBS5_LPBIG_OFFBIG : c_int = 125; - } - } } diff --git a/src/librustc_back/x86.rs b/src/librustc_back/x86.rs index 0569de6ded0..1c6eacc3559 100644 --- a/src/librustc_back/x86.rs +++ b/src/librustc_back/x86.rs @@ -45,10 +45,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string() } - abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig => { - "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string() - } - abi::OsOpenbsd => { + abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | abi::OsOpenbsd => { "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string() } diff --git a/src/librustc_back/x86_64.rs b/src/librustc_back/x86_64.rs index 12d717eb130..4c947f74625 100644 --- a/src/librustc_back/x86_64.rs +++ b/src/librustc_back/x86_64.rs @@ -47,12 +47,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs s0:64:64-f80:128:128-n8:16:32:64-S128".to_string() } - abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig => { - "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ - f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\ - s0:64:64-f80:128:128-n8:16:32:64-S128".to_string() - } - abi::OsOpenbsd => { + abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | abi::Openbsd => { "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\ s0:64:64-f80:128:128-n8:16:32:64-S128".to_string() diff --git a/src/libstd/sys/unix/c.rs b/src/libstd/sys/unix/c.rs index 06e5333239e..2da9c2f9d86 100644 --- a/src/libstd/sys/unix/c.rs +++ b/src/libstd/sys/unix/c.rs @@ -307,8 +307,7 @@ mod signal { #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd", - target_os = "dragonfly", - target_os = "openbsd"))] + target_os = "dragonfly"))] mod signal { use libc; @@ -322,8 +321,7 @@ mod signal { pub const SIGCHLD: libc::c_int = 20; #[cfg(any(target_os = "macos", - target_os = "ios", - target_os = "openbsd"))] + target_os = "ios"))] pub type sigset_t = u32; #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] #[repr(C)] @@ -351,7 +349,7 @@ mod signal { } } -#[cfg(target_os = "bitrig")] +#[cfg(any(target_os = "bitrig", target_os = "openbsd"))] mod signal { use libc; diff --git a/src/libstd/sys/unix/stack_overflow.rs b/src/libstd/sys/unix/stack_overflow.rs index 04dd36a24ab..c2044c502b7 100644 --- a/src/libstd/sys/unix/stack_overflow.rs +++ b/src/libstd/sys/unix/stack_overflow.rs @@ -219,10 +219,7 @@ mod imp { #[cfg(target_os = "macos")] pub const SIGSTKSZ: libc::size_t = 131072; - #[cfg(target_os = "openbsd")] - pub const SIGSTKSZ: libc::size_t = 40960; - - #[cfg(target_os = "bitrig")] + #[cfg(any(target_os = "bitrig", target_os = "openbsd"))] pub const SIGSTKSZ: libc::size_t = 40960; pub const SIG_DFL: sighandler_t = 0 as sighandler_t; -- cgit 1.4.1-3-g733a5