Break apart src/unix/other.rs a bit
Also sysctl isn't defined on MUSL
This commit is contained in:
parent
87fdebdeb2
commit
9e97afd91f
|
@ -1,5 +1,7 @@
|
|||
#![feature(alloc_system)]
|
||||
#![allow(bad_style, unused_imports)]
|
||||
|
||||
extern crate alloc_system;
|
||||
extern crate libc;
|
||||
extern crate libc_test;
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
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)
|
||||
-> ::c_int;
|
||||
}
|
|
@ -13,12 +13,6 @@ extern {
|
|||
pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int)
|
||||
-> ::c_int;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
pub fn shm_open(name: *const ::c_char, oflag: ::c_int, ...)
|
||||
-> ::c_int;
|
||||
#[cfg(target_os = "linux")]
|
||||
pub fn shm_open(name: *const ::c_char, oflag: ::c_int,
|
||||
mode: ::mode_t) -> ::c_int;
|
||||
pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
|
||||
|
@ -80,38 +74,10 @@ cfg_if! {
|
|||
target_os = "bitrig",
|
||||
target_os = "netbsd",
|
||||
target_os = "openbsd"))] {
|
||||
extern {
|
||||
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)
|
||||
-> ::c_int;
|
||||
}
|
||||
mod bsdlike;
|
||||
pub use self::bsdlike::*;
|
||||
} else {
|
||||
extern {
|
||||
pub fn sysctl(name: *mut ::c_int,
|
||||
namelen: ::c_int,
|
||||
oldp: *mut ::c_void,
|
||||
oldlenp: *mut ::size_t,
|
||||
newp: *mut ::c_void,
|
||||
newlen: ::size_t)
|
||||
-> ::c_int;
|
||||
pub fn mincore(addr: *mut ::c_void, len: ::size_t,
|
||||
vec: *mut ::c_uchar) -> ::c_int;
|
||||
}
|
||||
mod notbsd;
|
||||
pub use self::notbsd::*;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
extern {
|
||||
pub fn shm_open(name: *const ::c_char, oflag: ::c_int,
|
||||
mode: ::mode_t) -> ::c_int;
|
||||
#[cfg(not(target_env = "musl"))]
|
||||
pub fn sysctl(name: *mut ::c_int,
|
||||
namelen: ::c_int,
|
||||
oldp: *mut ::c_void,
|
||||
oldlenp: *mut ::size_t,
|
||||
newp: *mut ::c_void,
|
||||
newlen: ::size_t)
|
||||
-> ::c_int;
|
||||
pub fn mincore(addr: *mut ::c_void, len: ::size_t,
|
||||
vec: *mut ::c_uchar) -> ::c_int;
|
||||
}
|
Loading…
Reference in New Issue