Fix compiles on various BSDs
Also document them to prevent future regressions
This commit is contained in:
parent
3e1791cf98
commit
37b71423c9
17
src/lib.rs
17
src/lib.rs
@ -54,9 +54,24 @@
|
|||||||
#![cfg_attr(all(windows, target_arch = "x86", target_env = "msvc"), doc(
|
#![cfg_attr(all(windows, target_arch = "x86", target_env = "msvc"), doc(
|
||||||
html_root_url = "https://doc.rust-lang.org/libc/i686-pc-windows-msvc"
|
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"
|
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
|
// Attributes needed when building as part of the standard library
|
||||||
#![cfg_attr(stdbuild, feature(no_std, core, core_slice_ext, staged_api, custom_attribute))]
|
#![cfg_attr(stdbuild, feature(no_std, core, core_slice_ext, staged_api, custom_attribute))]
|
||||||
|
@ -14,6 +14,8 @@ pub type pthread_rwlock_t = *mut ::c_void;
|
|||||||
pub type pthread_key_t = ::c_int;
|
pub type pthread_key_t = ::c_int;
|
||||||
pub type fsblkcnt_t = ::c_uint;
|
pub type fsblkcnt_t = ::c_uint;
|
||||||
pub type fsfilcnt_t = ::c_uint;
|
pub type fsfilcnt_t = ::c_uint;
|
||||||
|
pub type tcflag_t = ::c_uint;
|
||||||
|
pub type speed_t = ::c_uint;
|
||||||
|
|
||||||
pub enum timezone {}
|
pub enum timezone {}
|
||||||
|
|
||||||
@ -120,6 +122,16 @@ s! {
|
|||||||
pub sin_addr: ::in_addr,
|
pub sin_addr: ::in_addr,
|
||||||
pub sin_zero: [::c_char; 8],
|
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;
|
pub const EXIT_FAILURE: ::c_int = 1;
|
||||||
@ -547,8 +559,8 @@ pub const HW_AVAILCPU: ::c_int = 25;
|
|||||||
|
|
||||||
extern {
|
extern {
|
||||||
pub fn mincore(addr: *const ::c_void, len: ::size_t,
|
pub fn mincore(addr: *const ::c_void, len: ::size_t,
|
||||||
vec: *mut c_char) -> ::c_int;
|
vec: *mut ::c_char) -> ::c_int;
|
||||||
pub fn sysctlnametomib(name: *const c_char,
|
pub fn sysctlnametomib(name: *const ::c_char,
|
||||||
mibp: *mut ::c_int,
|
mibp: *mut ::c_int,
|
||||||
sizep: *mut ::size_t)
|
sizep: *mut ::size_t)
|
||||||
-> ::c_int;
|
-> ::c_int;
|
||||||
|
@ -6,6 +6,8 @@ pub type nlink_t = ::uint32_t;
|
|||||||
pub type ino_t = ::uint64_t;
|
pub type ino_t = ::uint64_t;
|
||||||
pub type pthread_key_t = ::c_int;
|
pub type pthread_key_t = ::c_int;
|
||||||
pub type rlim_t = u64;
|
pub type rlim_t = u64;
|
||||||
|
pub type speed_t = ::c_uint;
|
||||||
|
pub type tcflag_t = ::c_uint;
|
||||||
|
|
||||||
pub enum timezone {}
|
pub enum timezone {}
|
||||||
|
|
||||||
@ -36,6 +38,16 @@ s! {
|
|||||||
pub sin_addr: ::in_addr,
|
pub sin_addr: ::in_addr,
|
||||||
pub sin_zero: [::int8_t; 8],
|
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;
|
pub const EXIT_FAILURE : ::c_int = 1;
|
||||||
|
@ -4,8 +4,6 @@ pub type dev_t = u64;
|
|||||||
pub type blksize_t = ::int32_t;
|
pub type blksize_t = ::int32_t;
|
||||||
pub type fsblkcnt_t = ::uint64_t;
|
pub type fsblkcnt_t = ::uint64_t;
|
||||||
pub type fsfilcnt_t = ::uint64_t;
|
pub type fsfilcnt_t = ::uint64_t;
|
||||||
pub type speed_t = ::c_uint;
|
|
||||||
pub type tcflag_t = ::c_uint;
|
|
||||||
|
|
||||||
s! {
|
s! {
|
||||||
pub struct dirent {
|
pub struct dirent {
|
||||||
@ -184,16 +182,6 @@ s! {
|
|||||||
pub dqb_btime: ::int32_t,
|
pub dqb_btime: ::int32_t,
|
||||||
pub dqb_itime: ::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;
|
pub const O_CLOEXEC: ::c_int = 0x400000;
|
||||||
|
Loading…
Reference in New Issue
Block a user