Merge pull request #105 from alexcrichton/fix-bsd

Fix compiles on various BSDs
This commit is contained in:
Alex Crichton 2015-12-17 13:58:05 -08:00
commit 9863d5645f
4 changed files with 42 additions and 15 deletions

View File

@ -54,9 +54,24 @@
#![cfg_attr(all(windows, target_arch = "x86", target_env = "msvc"), doc(
html_root_url = "https://doc.rust-lang.org/libc/i686-pc-windows-msvc"
))]
#![cfg_attr(all(target_os = "android"), doc(
#![cfg_attr(target_os = "android", doc(
html_root_url = "https://doc.rust-lang.org/libc/arm-linux-androideabi"
))]
#![cfg_attr(target_os = "freebsd", doc(
html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-freebsd"
))]
#![cfg_attr(target_os = "openbsd", doc(
html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-openbsd"
))]
#![cfg_attr(target_os = "bitrig", doc(
html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-bitrig"
))]
#![cfg_attr(target_os = "netbsd", doc(
html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-netbsd"
))]
#![cfg_attr(target_os = "dragonfly", doc(
html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-dragonfly"
))]
// Attributes needed when building as part of the standard library
#![cfg_attr(stdbuild, feature(no_std, core, core_slice_ext, staged_api, custom_attribute))]

View File

@ -14,6 +14,8 @@ pub type pthread_rwlock_t = *mut ::c_void;
pub type pthread_key_t = ::c_int;
pub type fsblkcnt_t = ::c_uint;
pub type fsfilcnt_t = ::c_uint;
pub type tcflag_t = ::c_uint;
pub type speed_t = ::c_uint;
pub enum timezone {}
@ -120,6 +122,16 @@ s! {
pub sin_addr: ::in_addr,
pub sin_zero: [::c_char; 8],
}
pub struct termios {
pub c_iflag: ::tcflag_t,
pub c_oflag: ::tcflag_t,
pub c_cflag: ::tcflag_t,
pub c_lflag: ::tcflag_t,
pub c_cc: [::cc_t; ::NCCS],
pub c_ispeed: ::speed_t,
pub c_ospeed: ::speed_t,
}
}
pub const EXIT_FAILURE: ::c_int = 1;
@ -547,8 +559,8 @@ pub const HW_AVAILCPU: ::c_int = 25;
extern {
pub fn mincore(addr: *const ::c_void, len: ::size_t,
vec: *mut c_char) -> ::c_int;
pub fn sysctlnametomib(name: *const c_char,
vec: *mut ::c_char) -> ::c_int;
pub fn sysctlnametomib(name: *const ::c_char,
mibp: *mut ::c_int,
sizep: *mut ::size_t)
-> ::c_int;

View File

@ -6,6 +6,8 @@ pub type nlink_t = ::uint32_t;
pub type ino_t = ::uint64_t;
pub type pthread_key_t = ::c_int;
pub type rlim_t = u64;
pub type speed_t = ::c_uint;
pub type tcflag_t = ::c_uint;
pub enum timezone {}
@ -36,6 +38,16 @@ s! {
pub sin_addr: ::in_addr,
pub sin_zero: [::int8_t; 8],
}
pub struct termios {
pub c_iflag: ::tcflag_t,
pub c_oflag: ::tcflag_t,
pub c_cflag: ::tcflag_t,
pub c_lflag: ::tcflag_t,
pub c_cc: [::cc_t; ::NCCS],
pub c_ispeed: ::c_int,
pub c_ospeed: ::c_int,
}
}
pub const EXIT_FAILURE : ::c_int = 1;

View File

@ -4,8 +4,6 @@ pub type dev_t = u64;
pub type blksize_t = ::int32_t;
pub type fsblkcnt_t = ::uint64_t;
pub type fsfilcnt_t = ::uint64_t;
pub type speed_t = ::c_uint;
pub type tcflag_t = ::c_uint;
s! {
pub struct dirent {
@ -184,16 +182,6 @@ s! {
pub dqb_btime: ::int32_t,
pub dqb_itime: ::int32_t,
}
pub struct termios {
pub c_iflag: ::tcflag_t,
pub c_oflag: ::tcflag_t,
pub c_cflag: ::tcflag_t,
pub c_lflag: ::tcflag_t,
pub c_cc: [::cc_t; ::NCCS],
pub c_ispeed: ::c_int,
pub c_ospeed: ::c_int,
}
}
pub const O_CLOEXEC: ::c_int = 0x400000;