diff --git a/src/cloudabi/mod.rs b/src/cloudabi/mod.rs index e5027b935b1c9de5fc4bca6961adbb2899771985..81919675581fbfc6d9196c6ac599332d89683d31 100644 --- a/src/cloudabi/mod.rs +++ b/src/cloudabi/mod.rs @@ -1,5 +1,3 @@ -use dox::Option; - pub type int8_t = i8; pub type int16_t = i16; pub type int32_t = i32; @@ -124,14 +122,14 @@ pub const SOCK_STREAM: ::c_int = 130; #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum FILE {} -impl ::dox::Copy for FILE {} -impl ::dox::Clone for FILE { +impl ::Copy for FILE {} +impl ::Clone for FILE { fn clone(&self) -> FILE { *self } } #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos_t {} // TODO: fill this out with a struct -impl ::dox::Copy for fpos_t {} -impl ::dox::Clone for fpos_t { +impl ::Copy for fpos_t {} +impl ::Clone for fpos_t { fn clone(&self) -> fpos_t { *self } } @@ -281,7 +279,7 @@ extern { ) -> ::c_int; pub fn pthread_key_create( key: *mut pthread_key_t, - dtor: Option<unsafe extern fn(*mut ::c_void)>, + dtor: ::Option<unsafe extern fn(*mut ::c_void)>, ) -> ::c_int; pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int; pub fn pthread_setspecific( diff --git a/src/dox.rs b/src/dox.rs index 6296c6c0257f6930b063e475b5186b9c3788438d..d9899bb2249d38df8142a4ab1b239bbd8dc24753 100644 --- a/src/dox.rs +++ b/src/dox.rs @@ -1,224 +1,211 @@ -pub use self::imp::*; - -#[cfg(not(cross_platform_docs))] -mod imp { - pub use core::clone::Clone; - pub use core::marker::Copy; - pub use core::mem; - pub use core::option::Option; +pub enum Option<T> { + Some(T), + None, } - -#[cfg(cross_platform_docs)] -mod imp { - pub enum Option<T> { - Some(T), - None, - } - impl<T: Copy> Copy for Option<T> {} - impl<T: Clone> Clone for Option<T> { - fn clone(&self) -> Option<T> { - loop {} - } +impl<T: Copy> Copy for Option<T> {} +impl<T: Clone> Clone for Option<T> { + fn clone(&self) -> Option<T> { + loop {} } +} - impl<T> Copy for *mut T {} - impl<T> Clone for *mut T { - fn clone(&self) -> *mut T { - loop {} - } +impl<T> Copy for *mut T {} +impl<T> Clone for *mut T { + fn clone(&self) -> *mut T { + loop {} } +} - impl<T> Copy for *const T {} - impl<T> Clone for *const T { - fn clone(&self) -> *const T { - loop {} - } +impl<T> Copy for *const T {} +impl<T> Clone for *const T { + fn clone(&self) -> *const T { + loop {} } +} - pub trait Clone { - fn clone(&self) -> Self; - } +pub trait Clone { + fn clone(&self) -> Self; +} - #[lang = "copy"] - pub trait Copy {} - - #[lang = "freeze"] - pub trait Freeze {} - - #[lang = "sync"] - pub trait Sync {} - impl<T> Sync for T {} - - #[lang = "sized"] - pub trait Sized {} - - #[lang = "receiver"] - pub trait Receiver {} - impl<T: ?Sized> Receiver for &T {} - impl<T: ?Sized> Receiver for &mut T {} - - macro_rules! each_int { - ($mac:ident) => { - $mac!(u8); - $mac!(u16); - $mac!(u32); - $mac!(u64); - $mac!(usize); - each_signed_int!($mac); - }; - } +#[lang = "copy"] +pub trait Copy {} + +#[lang = "freeze"] +pub trait Freeze {} + +#[lang = "sync"] +pub trait Sync {} +impl<T> Sync for T {} + +#[lang = "sized"] +pub trait Sized {} + +#[lang = "receiver"] +pub trait Receiver {} +impl<T: ?Sized> Receiver for &T {} +impl<T: ?Sized> Receiver for &mut T {} + +macro_rules! each_int { + ($mac:ident) => { + $mac!(u8); + $mac!(u16); + $mac!(u32); + $mac!(u64); + $mac!(usize); + each_signed_int!($mac); + }; +} - macro_rules! each_signed_int { - ($mac:ident) => { - $mac!(i8); - $mac!(i16); - $mac!(i32); - $mac!(i64); - $mac!(isize); - }; - } +macro_rules! each_signed_int { + ($mac:ident) => { + $mac!(i8); + $mac!(i16); + $mac!(i32); + $mac!(i64); + $mac!(isize); + }; +} - #[lang = "div"] - pub trait Div<RHS = Self> { - type Output; - fn div(self, rhs: RHS) -> Self::Output; - } +#[lang = "div"] +pub trait Div<RHS = Self> { + type Output; + fn div(self, rhs: RHS) -> Self::Output; +} - #[lang = "shl"] - pub trait Shl<RHS = Self> { - type Output; - fn shl(self, rhs: RHS) -> Self::Output; - } +#[lang = "shl"] +pub trait Shl<RHS = Self> { + type Output; + fn shl(self, rhs: RHS) -> Self::Output; +} - #[lang = "mul"] - pub trait Mul<RHS = Self> { - type Output; - fn mul(self, rhs: RHS) -> Self::Output; - } +#[lang = "mul"] +pub trait Mul<RHS = Self> { + type Output; + fn mul(self, rhs: RHS) -> Self::Output; +} - #[lang = "sub"] - pub trait Sub<RHS = Self> { - type Output; - fn sub(self, rhs: RHS) -> Self::Output; - } +#[lang = "sub"] +pub trait Sub<RHS = Self> { + type Output; + fn sub(self, rhs: RHS) -> Self::Output; +} - #[lang = "bitand"] - pub trait BitAnd<RHS = Self> { - type Output; - fn bitand(self, rhs: RHS) -> Self::Output; - } +#[lang = "bitand"] +pub trait BitAnd<RHS = Self> { + type Output; + fn bitand(self, rhs: RHS) -> Self::Output; +} - #[lang = "bitand_assign"] - pub trait BitAndAssign<RHS = Self> { - fn bitand_assign(&mut self, rhs: RHS); - } +#[lang = "bitand_assign"] +pub trait BitAndAssign<RHS = Self> { + fn bitand_assign(&mut self, rhs: RHS); +} - #[lang = "bitor"] - pub trait BitOr<RHS = Self> { - type Output; - fn bitor(self, rhs: RHS) -> Self::Output; - } +#[lang = "bitor"] +pub trait BitOr<RHS = Self> { + type Output; + fn bitor(self, rhs: RHS) -> Self::Output; +} - #[lang = "bitor_assign"] - pub trait BitOrAssign<RHS = Self> { - fn bitor_assign(&mut self, rhs: RHS); - } +#[lang = "bitor_assign"] +pub trait BitOrAssign<RHS = Self> { + fn bitor_assign(&mut self, rhs: RHS); +} - #[lang = "bitxor"] - pub trait BitXor<RHS = Self> { - type Output; - fn bitxor(self, rhs: RHS) -> Self::Output; - } +#[lang = "bitxor"] +pub trait BitXor<RHS = Self> { + type Output; + fn bitxor(self, rhs: RHS) -> Self::Output; +} - #[lang = "bitxor_assign"] - pub trait BitXorAssign<RHS = Self> { - fn bitxor_assign(&mut self, rhs: RHS); - } +#[lang = "bitxor_assign"] +pub trait BitXorAssign<RHS = Self> { + fn bitxor_assign(&mut self, rhs: RHS); +} - #[lang = "neg"] - pub trait Neg { - type Output; - fn neg(self) -> Self::Output; - } +#[lang = "neg"] +pub trait Neg { + type Output; + fn neg(self) -> Self::Output; +} - #[lang = "not"] - pub trait Not { - type Output; - fn not(self) -> Self::Output; - } +#[lang = "not"] +pub trait Not { + type Output; + fn not(self) -> Self::Output; +} - #[lang = "add"] - pub trait Add<RHS = Self> { - type Output; - fn add(self, r: RHS) -> Self::Output; - } +#[lang = "add"] +pub trait Add<RHS = Self> { + type Output; + fn add(self, r: RHS) -> Self::Output; +} - macro_rules! impl_traits { - ($($i:ident)*) => ($( - impl Div<$i> for $i { - type Output = $i; - fn div(self, rhs: $i) -> $i { self / rhs } - } - impl Shl<$i> for $i { - type Output = $i; - fn shl(self, rhs: $i) -> $i { self << rhs } - } - impl Mul for $i { - type Output = $i; - fn mul(self, rhs: $i) -> $i { self * rhs } - } - - impl Sub for $i { - type Output = $i; - fn sub(self, rhs: $i) -> $i { self - rhs } - } - impl BitAnd for $i { - type Output = $i; - fn bitand(self, rhs: $i) -> $i { self & rhs } - } - impl BitAndAssign for $i { - fn bitand_assign(&mut self, rhs: $i) { *self &= rhs; } - } - impl BitOr for $i { - type Output = $i; - fn bitor(self, rhs: $i) -> $i { self | rhs } - } - impl BitOrAssign for $i { - fn bitor_assign(&mut self, rhs: $i) { *self |= rhs; } - } - impl BitXor for $i { - type Output = $i; - fn bitxor(self, rhs: $i) -> $i { self ^ rhs } - } - impl BitXorAssign for $i { - fn bitxor_assign(&mut self, rhs: $i) { *self ^= rhs; } - } - impl Neg for $i { - type Output = $i; - fn neg(self) -> $i { -self } - } - impl Not for $i { - type Output = $i; - fn not(self) -> $i { !self } - } - impl Add<$i> for $i { - type Output = $i; - fn add(self, other: $i) -> $i { self + other } - } - impl Copy for $i {} - impl Clone for $i { - fn clone(&self) -> $i { loop {} } - } - )*) - } - each_int!(impl_traits); +macro_rules! impl_traits { + ($($i:ident)*) => ($( + impl Div<$i> for $i { + type Output = $i; + fn div(self, rhs: $i) -> $i { self / rhs } + } + impl Shl<$i> for $i { + type Output = $i; + fn shl(self, rhs: $i) -> $i { self << rhs } + } + impl Mul for $i { + type Output = $i; + fn mul(self, rhs: $i) -> $i { self * rhs } + } - pub mod mem { - pub fn size_of_val<T>(_: &T) -> usize { - 4 + impl Sub for $i { + type Output = $i; + fn sub(self, rhs: $i) -> $i { self - rhs } + } + impl BitAnd for $i { + type Output = $i; + fn bitand(self, rhs: $i) -> $i { self & rhs } + } + impl BitAndAssign for $i { + fn bitand_assign(&mut self, rhs: $i) { *self &= rhs; } + } + impl BitOr for $i { + type Output = $i; + fn bitor(self, rhs: $i) -> $i { self | rhs } + } + impl BitOrAssign for $i { + fn bitor_assign(&mut self, rhs: $i) { *self |= rhs; } + } + impl BitXor for $i { + type Output = $i; + fn bitxor(self, rhs: $i) -> $i { self ^ rhs } } - pub const fn size_of<T>() -> usize { - 4 + impl BitXorAssign for $i { + fn bitxor_assign(&mut self, rhs: $i) { *self ^= rhs; } } + impl Neg for $i { + type Output = $i; + fn neg(self) -> $i { -self } + } + impl Not for $i { + type Output = $i; + fn not(self) -> $i { !self } + } + impl Add<$i> for $i { + type Output = $i; + fn add(self, other: $i) -> $i { self + other } + } + impl Copy for $i {} + impl Clone for $i { + fn clone(&self) -> $i { loop {} } + } + )*) +} +each_int!(impl_traits); + +pub mod mem { + pub fn size_of_val<T>(_: &T) -> usize { + 4 + } + pub const fn size_of<T>() -> usize { + 4 } } diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index 6f45cc19176ef9f8675ea0ddf2a3c6905c1781c7..cac0543b072b9b55fabf72ccd786ad1ebecd3794 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -3,8 +3,6 @@ //! More functions and definitions can be found in the more specific modules //! according to the platform in question. -use dox::{mem, Option}; - // PUB_TYPE pub type int8_t = i8; @@ -102,26 +100,26 @@ pub type c_ulong = u64; // Presumably these should be `()` or an `extern type` (when that stabilizes). #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} -impl ::dox::Copy for timezone {} -impl ::dox::Clone for timezone { +impl ::Copy for timezone {} +impl ::Clone for timezone { fn clone(&self) -> timezone { *self } } #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum DIR {} -impl ::dox::Copy for DIR {} -impl ::dox::Clone for DIR { +impl ::Copy for DIR {} +impl ::Clone for DIR { fn clone(&self) -> DIR { *self } } #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum locale_t {} -impl ::dox::Copy for locale_t {} -impl ::dox::Clone for locale_t { +impl ::Copy for locale_t {} +impl ::Clone for locale_t { fn clone(&self) -> locale_t { *self } } #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos64_t {} // TODO: fill this out with a struct -impl ::dox::Copy for fpos64_t {} -impl ::dox::Clone for fpos64_t { +impl ::Copy for fpos64_t {} +impl ::Clone for fpos64_t { fn clone(&self) -> fpos64_t { *self } } @@ -309,7 +307,7 @@ s! { pub sa_sigaction: ::sighandler_t, pub sa_mask: ::sigset_t, pub sa_flags: ::c_int, - pub sa_restorer: ::dox::Option<extern fn()>, + pub sa_restorer: ::Option<extern fn()>, } pub struct termios { @@ -1610,7 +1608,7 @@ pub const WEXITED: ::c_int = 0x00000004; pub const WCONTINUED: ::c_int = 0x00000008; pub const WNOWAIT: ::c_int = 0x01000000; -// Options set using PTRACE_SETOPTIONS. +// ::Options set using PTRACE_SETOPTIONS. pub const PTRACE_O_TRACESYSGOOD: ::c_int = 0x00000001; pub const PTRACE_O_TRACEFORK: ::c_int = 0x00000002; pub const PTRACE_O_TRACEVFORK: ::c_int = 0x00000004; @@ -2829,20 +2827,20 @@ cfg_if! { f! { pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { let fd = fd as usize; - let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; (*set).fds_bits[fd / size] &= !(1 << (fd % size)); return } pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool { let fd = fd as usize; - let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0 } pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { let fd = fd as usize; - let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; (*set).fds_bits[fd / size] |= 1 << (fd % size); return } @@ -2896,21 +2894,23 @@ f! { } pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let size_in_bits + = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.bits[idx] |= 1 << offset; () } pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let size_in_bits + = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.bits[idx] &= !(1 << offset); () } pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { - let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); + let size_in_bits = 8 * ::mem::size_of_val(&cpuset.bits[0]); let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); 0 != (cpuset.bits[idx] & (1 << offset)) } @@ -2953,14 +2953,14 @@ extern {} #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum FILE {} -impl ::dox::Copy for FILE {} -impl ::dox::Clone for FILE { +impl ::Copy for FILE {} +impl ::Clone for FILE { fn clone(&self) -> FILE { *self } } #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos_t {} // TODO: fill this out with a struct -impl ::dox::Copy for fpos_t {} -impl ::dox::Clone for fpos_t { +impl ::Copy for fpos_t {} +impl ::Clone for fpos_t { fn clone(&self) -> fpos_t { *self } } @@ -3290,7 +3290,7 @@ extern { pub fn pthread_detach(thread: ::pthread_t) -> ::c_int; pub fn sched_yield() -> ::c_int; pub fn pthread_key_create(key: *mut pthread_key_t, - dtor: Option<unsafe extern fn(*mut ::c_void)>) + dtor: ::Option<unsafe extern fn(*mut ::c_void)>) -> ::c_int; pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int; pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void; @@ -3795,7 +3795,7 @@ extern { pub fn glob(pattern: *const c_char, flags: ::c_int, - errfunc: Option<extern fn(epath: *const c_char, + errfunc: ::Option<extern fn(epath: *const c_char, errno: ::c_int) -> ::c_int>, pglob: *mut ::glob_t) -> ::c_int; pub fn globfree(pglob: *mut ::glob_t); @@ -3968,9 +3968,9 @@ extern { result: *mut *mut passwd) -> ::c_int; pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int; - pub fn pthread_atfork(prepare: Option<unsafe extern fn()>, - parent: Option<unsafe extern fn()>, - child: Option<unsafe extern fn()>) -> ::c_int; + pub fn pthread_atfork(prepare: ::Option<unsafe extern fn()>, + parent: ::Option<unsafe extern fn()>, + child: ::Option<unsafe extern fn()>) -> ::c_int; pub fn getgrgid(gid: ::gid_t) -> *mut ::group; pub fn getgrouplist(user: *const ::c_char, group: ::gid_t, @@ -3987,7 +3987,7 @@ extern { f: extern fn(*mut ::c_void) -> *mut ::c_void, value: *mut ::c_void) -> ::c_int; pub fn dl_iterate_phdr( - callback: Option<unsafe extern fn( + callback: ::Option<unsafe extern fn( info: *mut ::dl_phdr_info, size: ::size_t, data: *mut ::c_void diff --git a/src/lib.rs b/src/lib.rs index 72e93aaf62defa226027a723af426ef87e98b27a..5d8a097b79c2b5f0f7379a04fd4c4a9108f69783 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -193,6 +193,15 @@ cfg_if! { use core::num; #[allow(unused_imports)] use core::mem; + #[doc(hidden)] + #[allow(unused_imports)] + pub use core::clone::Clone; + #[doc(hidden)] + #[allow(unused_imports)] + pub use core::marker::Copy; + #[doc(hidden)] + #[allow(unused_imports)] + pub use core::option::Option; } else { #[doc(hidden)] #[allow(unused_imports)] @@ -206,12 +215,26 @@ cfg_if! { #[doc(hidden)] #[allow(unused_imports)] pub use core::mem; + #[doc(hidden)] + #[allow(unused_imports)] + pub use core::clone::Clone; + #[doc(hidden)] + #[allow(unused_imports)] + pub use core::marker::Copy; + #[doc(hidden)] + #[allow(unused_imports)] + pub use core::option::Option; } } } } -mod dox; +cfg_if! { + if #[cfg(cross_platform_docs)] { + mod dox; + pub use self::dox::*; + } +} cfg_if! { if #[cfg(windows)] { diff --git a/src/macros.rs b/src/macros.rs index 89eaeb5e0315712f3f8ef6b7ff02ae89b1ae1d5d..af7bbdd37bb94463cd11907371d0cfd78f9d12f2 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -77,8 +77,8 @@ macro_rules! s { $(#[$attr])* pub struct $i { $($field)* } } - impl ::dox::Copy for $i {} - impl ::dox::Clone for $i { + impl ::Copy for $i {} + impl ::Clone for $i { fn clone(&self) -> $i { *self } } ); @@ -98,8 +98,8 @@ macro_rules! s_no_extra_traits { pub union $i { $($field)* } } - impl ::dox::Copy for $i {} - impl ::dox::Clone for $i { + impl ::Copy for $i {} + impl ::Clone for $i { fn clone(&self) -> $i { *self } } } @@ -111,8 +111,8 @@ macro_rules! s_no_extra_traits { $(#[$attr])* pub struct $i { $($field)* } } - impl ::dox::Copy for $i {} - impl ::dox::Clone for $i { + impl ::Copy for $i {} + impl ::Clone for $i { fn clone(&self) -> $i { *self } } ); diff --git a/src/redox/mod.rs b/src/redox/mod.rs index cde619e98726e250a60f2036235c514e26cef504..ac0ae00bce10d63936fcc5ab42b307df9a6ad27f 100644 --- a/src/redox/mod.rs +++ b/src/redox/mod.rs @@ -221,14 +221,14 @@ pub const SIGSYS: ::c_int = 31; #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum FILE {} -impl ::dox::Copy for FILE {} -impl ::dox::Clone for FILE { +impl ::Copy for FILE {} +impl ::Clone for FILE { fn clone(&self) -> FILE { *self } } #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos_t {} // TODO: fill this out with a struct -impl ::dox::Copy for fpos_t {} -impl ::dox::Clone for fpos_t { +impl ::Copy for fpos_t {} +impl ::Clone for fpos_t { fn clone(&self) -> fpos_t { *self } } diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 670ef568b64351c6ec80a33b5edd6dc5f224c30c..f24b1ddf6f6775446f31629480b4de76b356bb58 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -1,8 +1,6 @@ //! Apple (ios/darwin)-specific definitions //! //! This covers *-apple-* triples currently -use dox::mem; - pub type c_char = i8; pub type clock_t = c_ulong; pub type time_t = c_long; @@ -36,8 +34,8 @@ pub type shmatt_t = ::c_ushort; #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} -impl ::dox::Copy for timezone {} -impl ::dox::Clone for timezone { +impl ::Copy for timezone {} +impl ::Clone for timezone { fn clone(&self) -> timezone { *self } } @@ -2782,12 +2780,12 @@ pub const UF_HIDDEN: ::c_uint = 0x00008000; cfg_if! { if #[cfg(libc_const_size_of)] { fn __DARWIN_ALIGN32(p: usize) -> usize { - const __DARWIN_ALIGNBYTES32: usize = mem::size_of::<u32>() - 1; + const __DARWIN_ALIGNBYTES32: usize = ::mem::size_of::<u32>() - 1; p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32 } } else { fn __DARWIN_ALIGN32(p: usize) -> usize { - let __DARWIN_ALIGNBYTES32: usize = mem::size_of::<u32>() - 1; + let __DARWIN_ALIGNBYTES32: usize = ::mem::size_of::<u32>() - 1; p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32 } } @@ -2803,7 +2801,7 @@ f! { let next = cmsg as usize + __DARWIN_ALIGN32(cmsg_len as usize); let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize; - if next + __DARWIN_ALIGN32(mem::size_of::<::cmsghdr>()) > max { + if next + __DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) > max { 0 as *mut ::cmsghdr } else { next as *mut ::cmsghdr @@ -2812,17 +2810,17 @@ f! { pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar { (cmsg as *mut ::c_uchar) - .offset(__DARWIN_ALIGN32(mem::size_of::<::cmsghdr>()) as isize) + .offset(__DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) as isize) } pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint { - (__DARWIN_ALIGN32(mem::size_of::<::cmsghdr>()) + (__DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) + __DARWIN_ALIGN32(length as usize)) as ::c_uint } pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint { - (__DARWIN_ALIGN32(mem::size_of::<::cmsghdr>()) + length as usize) + (__DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) + length as usize) as ::c_uint } diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs index 5656a26be67198384d6e596bb78e6c478b10a285..c4fc528439644fe487c72b88dd5873dc7b9deb9c 100644 --- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -20,13 +20,12 @@ pub type sem_t = *mut sem; #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum sem {} -impl ::dox::Copy for sem {} -impl ::dox::Clone for sem { +impl ::Copy for sem {} +impl ::Clone for sem { fn clone(&self) -> sem { *self } } s! { - pub struct exit_status { pub e_termination: u16, pub e_exit: u16 @@ -801,18 +800,18 @@ fn _CMSG_ALIGN(n: usize) -> usize { f! { pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar { (cmsg as *mut ::c_uchar) - .offset(_CMSG_ALIGN(mem::size_of::<::cmsghdr>()) as isize) + .offset(_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) as isize) } pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint { - _CMSG_ALIGN(mem::size_of::<::cmsghdr>()) + length as usize + _CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) + length as usize } pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr) -> *mut ::cmsghdr { let next = cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len) - + _CMSG_ALIGN(mem::size_of::<::cmsghdr>()); + + _CMSG_ALIGN(::mem::size_of::<::cmsghdr>()); let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize; if next <= max { @@ -823,7 +822,8 @@ f! { } pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint { - _CMSG_ALIGN(mem::size_of::<::cmsghdr>()) + _CMSG_ALIGN(length as usize) + _CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) + + _CMSG_ALIGN(length as usize) } } diff --git a/src/unix/bsd/freebsdlike/freebsd/aarch64.rs b/src/unix/bsd/freebsdlike/freebsd/aarch64.rs index dac614fd0a1cef594ab5df74b8d7c87b9720ad14..996abc5e3ad31807f3a2d64789e1f0c613c4ff6b 100644 --- a/src/unix/bsd/freebsdlike/freebsd/aarch64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/aarch64.rs @@ -1,5 +1,3 @@ -use dox::mem; - pub type c_char = u8; pub type c_long = i64; pub type c_ulong = u64; @@ -36,7 +34,7 @@ s! { cfg_if! { if #[cfg(libc_const_size_of)] { #[doc(hidden)] - pub const _ALIGNBYTES: usize = mem::size_of::<::c_longlong>() - 1; + pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1; } else { #[doc(hidden)] pub const _ALIGNBYTES: usize = 8 - 1; diff --git a/src/unix/bsd/freebsdlike/freebsd/arm.rs b/src/unix/bsd/freebsdlike/freebsd/arm.rs index 99a761eeef5287bd498e2d9cd8ed5a264c25ce6b..945aca98cff2df3b1a24c297ab382305b6a9096b 100644 --- a/src/unix/bsd/freebsdlike/freebsd/arm.rs +++ b/src/unix/bsd/freebsdlike/freebsd/arm.rs @@ -38,7 +38,7 @@ s! { cfg_if! { if #[cfg(libc_const_size_of)] { #[doc(hidden)] - pub const _ALIGNBYTES: usize = mem::size_of::<::c_int>() - 1; + pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1; } else { #[doc(hidden)] pub const _ALIGNBYTES: usize = 4 - 1; diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 0d0eb3f3b0ff5e674b9d4690d7c01aae1c3ccd7f..573c0966347e5b38c4cd2643fa3044c4d31dec4d 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -1,5 +1,3 @@ -use dox::mem; - pub type fflags_t = u32; pub type clock_t = i32; pub type ino_t = u32; @@ -983,11 +981,11 @@ fn _ALIGN(p: usize) -> usize { f! { pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar { (cmsg as *mut ::c_uchar) - .offset(_ALIGN(mem::size_of::<::cmsghdr>()) as isize) + .offset(_ALIGN(::mem::size_of::<::cmsghdr>()) as isize) } pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint { - _ALIGN(mem::size_of::<::cmsghdr>()) as ::c_uint + length + _ALIGN(::mem::size_of::<::cmsghdr>()) as ::c_uint + length } pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr) @@ -997,7 +995,7 @@ f! { return ::CMSG_FIRSTHDR(mhdr); }; let next = cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize) - + _ALIGN(mem::size_of::<::cmsghdr>()); + + _ALIGN(::mem::size_of::<::cmsghdr>()); let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize; if next > max { @@ -1009,7 +1007,7 @@ f! { } pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint { - (_ALIGN(mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize)) + (_ALIGN(::mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize)) as ::c_uint } diff --git a/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs b/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs index 517f2960240b8493cb0660b27fc3332f12868c12..9d893b69a34cf469402ea42d67a70ac4e615f7ce 100644 --- a/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs @@ -34,7 +34,7 @@ s! { cfg_if! { if #[cfg(libc_const_size_of)] { #[doc(hidden)] - pub const _ALIGNBYTES: usize = mem::size_of::<::c_long>() - 1; + pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1; } else { #[doc(hidden)] pub const _ALIGNBYTES: usize = 8 - 1; diff --git a/src/unix/bsd/freebsdlike/freebsd/x86.rs b/src/unix/bsd/freebsdlike/freebsd/x86.rs index b31e3353618540705e18853760585783eec2cb27..845124d0422b5bc12c9b439e002b5ba020736e6b 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86.rs @@ -1,5 +1,3 @@ -use dox::mem; - pub type c_char = i8; pub type c_long = i32; pub type c_ulong = u32; @@ -37,7 +35,7 @@ s! { cfg_if! { if #[cfg(libc_const_size_of)] { #[doc(hidden)] - pub const _ALIGNBYTES: usize = mem::size_of::<::c_long>() - 1; + pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1; } else { #[doc(hidden)] pub const _ALIGNBYTES: usize = 8 - 1; diff --git a/src/unix/bsd/freebsdlike/freebsd/x86_64.rs b/src/unix/bsd/freebsdlike/freebsd/x86_64.rs index 89819fde3c8aa19dd6477e18ba250a35b2accac2..323d1ab7b31488edaecd2472a5708120c33341e4 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86_64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86_64.rs @@ -1,5 +1,3 @@ -use dox::mem; - pub type c_char = i8; pub type c_long = i64; pub type c_ulong = u64; @@ -36,7 +34,7 @@ s! { cfg_if! { if #[cfg(libc_const_size_of)] { #[doc(hidden)] - pub const _ALIGNBYTES: usize = mem::size_of::<::c_long>() - 1; + pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1; } else { #[doc(hidden)] pub const _ALIGNBYTES: usize = 8 - 1; diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index ca9ed982be5faad4210e7c1bf81bfa196895e4f3..8eb3b0e2ac0174e426d618bdabb5516f6b969d60 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -17,8 +17,8 @@ pub type id_t = i64; #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} -impl ::dox::Copy for timezone {} -impl ::dox::Clone for timezone { +impl ::Copy for timezone {} +impl ::Clone for timezone { fn clone(&self) -> timezone { *self } } diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index 8b5ec8c54d766b75a92339b12417026c8b9511f9..8698d38bcec785974f2f129940445df2ddff6abd 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -1,5 +1,3 @@ -use dox::{mem, Option}; - pub type wchar_t = i32; pub type off_t = i64; pub type useconds_t = u32; @@ -435,7 +433,7 @@ pub const POLLWRBAND: ::c_short = 0x100; f! { pub fn CMSG_FIRSTHDR(mhdr: *const ::msghdr) -> *mut ::cmsghdr { - if (*mhdr).msg_controllen as usize >= mem::size_of::<::cmsghdr>() { + if (*mhdr).msg_controllen as usize >= ::mem::size_of::<::cmsghdr>() { (*mhdr).msg_control as *mut ::cmsghdr } else { 0 as *mut ::cmsghdr @@ -443,20 +441,20 @@ f! { } pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { - let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; + let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; let fd = fd as usize; (*set).fds_bits[fd / bits] &= !(1 << (fd % bits)); return } pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool { - let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; + let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; let fd = fd as usize; return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0 } pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { - let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; + let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; let fd = fd as usize; (*set).fds_bits[fd / bits] |= 1 << (fd % bits); return @@ -527,7 +525,7 @@ extern { #[cfg_attr(target_os = "freebsd", link_name = "glob@FBSD_1.0")] pub fn glob(pattern: *const ::c_char, flags: ::c_int, - errfunc: Option<extern fn(epath: *const ::c_char, + errfunc: ::Option<extern fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>, pglob: *mut ::glob_t) -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__globfree30")] @@ -645,9 +643,9 @@ extern { #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")] pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int; - pub fn pthread_atfork(prepare: Option<unsafe extern fn()>, - parent: Option<unsafe extern fn()>, - child: Option<unsafe extern fn()>) -> ::c_int; + pub fn pthread_atfork(prepare: ::Option<unsafe extern fn()>, + parent: ::Option<unsafe extern fn()>, + child: ::Option<unsafe extern fn()>) -> ::c_int; pub fn getgrgid(gid: ::gid_t) -> *mut ::group; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "popen$UNIX2003")] diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs index d03529662faa41c96a6bef6707def8986a181d44..7ba19931fd824439645149aaac1cdc0da2b311c0 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -1,5 +1,3 @@ -use dox::mem; - pub type time_t = i64; pub type mode_t = u32; pub type nlink_t = ::uint32_t; @@ -15,14 +13,14 @@ pub type sem_t = *mut sem; #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} -impl ::dox::Copy for timezone {} -impl ::dox::Clone for timezone { +impl ::Copy for timezone {} +impl ::Clone for timezone { fn clone(&self) -> timezone { *self } } #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum sem {} -impl ::dox::Copy for sem {} -impl ::dox::Clone for sem { +impl ::Copy for sem {} +impl ::Clone for sem { fn clone(&self) -> sem { *self } } @@ -604,11 +602,11 @@ fn _ALIGN(p: usize) -> usize { f! { pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar { (cmsg as *mut ::c_uchar) - .offset(_ALIGN(mem::size_of::<::cmsghdr>()) as isize) + .offset(_ALIGN(::mem::size_of::<::cmsghdr>()) as isize) } pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint { - _ALIGN(mem::size_of::<::cmsghdr>()) as ::c_uint + length + _ALIGN(::mem::size_of::<::cmsghdr>()) as ::c_uint + length } pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr) @@ -618,7 +616,7 @@ f! { return ::CMSG_FIRSTHDR(mhdr); }; let next = cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize) - + _ALIGN(mem::size_of::<::cmsghdr>()); + + _ALIGN(::mem::size_of::<::cmsghdr>()); let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize; if next > max { @@ -630,7 +628,7 @@ f! { } pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint { - (_ALIGN(mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize)) + (_ALIGN(::mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize)) as ::c_uint } diff --git a/src/unix/bsd/netbsdlike/netbsd/aarch64.rs b/src/unix/bsd/netbsdlike/netbsd/aarch64.rs index e30d731bbf3cac2c84669fdb2cf4e7d079bb29fe..58c4cf7c4552639f2e6defc6a00e510f13be308c 100644 --- a/src/unix/bsd/netbsdlike/netbsd/aarch64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/aarch64.rs @@ -1,5 +1,3 @@ -use dox::mem; - use PT_FIRSTMACH; pub type c_long = i64; @@ -11,7 +9,7 @@ pub type __cpu_simple_lock_nv_t = ::c_uchar; cfg_if! { if #[cfg(libc_const_size_of)] { #[doc(hidden)] - pub const _ALIGNBYTES: usize = mem::size_of::<::c_int>() - 1; + pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1; } else { #[doc(hidden)] pub const _ALIGNBYTES: usize = 4 - 1; diff --git a/src/unix/bsd/netbsdlike/netbsd/arm.rs b/src/unix/bsd/netbsdlike/netbsd/arm.rs index cfcc1396472915a3e52922db8feaa1e60a5e1813..4bf3ccd02b2c4cdc091f4238df920cfa37c1c78d 100644 --- a/src/unix/bsd/netbsdlike/netbsd/arm.rs +++ b/src/unix/bsd/netbsdlike/netbsd/arm.rs @@ -1,5 +1,3 @@ -use dox::mem; - use PT_FIRSTMACH; pub type c_long = i32; @@ -11,7 +9,7 @@ pub type __cpu_simple_lock_nv_t = ::c_int; cfg_if! { if #[cfg(libc_const_size_of)] { #[doc(hidden)] - pub const _ALIGNBYTES: usize = mem::size_of::<::c_longlong>() - 1; + pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1; } else { #[doc(hidden)] pub const _ALIGNBYTES: usize = 8 - 1; diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 36a5366e6824c429212d1a9aa3f30e0840337dc6..4517244370258a47b1044a1f9aad2a932ce8dc2b 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -1,5 +1,3 @@ -use dox::mem; - pub type clock_t = ::c_uint; pub type suseconds_t = ::c_int; pub type dev_t = u64; @@ -1075,7 +1073,7 @@ f! { } else { 0 }; - mem::size_of::<sockcred>() + mem::size_of::<::gid_t>() * ngrps + ::mem::size_of::<sockcred>() + ::mem::size_of::<::gid_t>() * ngrps } } diff --git a/src/unix/bsd/netbsdlike/netbsd/powerpc.rs b/src/unix/bsd/netbsdlike/netbsd/powerpc.rs index 10cdc73c8142a36466422483eac91cc2b43e646f..e12fd5e11233279d7cec5debf4f939ea859b353e 100644 --- a/src/unix/bsd/netbsdlike/netbsd/powerpc.rs +++ b/src/unix/bsd/netbsdlike/netbsd/powerpc.rs @@ -1,5 +1,3 @@ -use dox::mem; - use PT_FIRSTMACH; pub type c_long = i32; @@ -11,7 +9,7 @@ pub type __cpu_simple_lock_nv_t = ::c_int; cfg_if! { if #[cfg(libc_const_size_of)] { #[doc(hidden)] - pub const _ALIGNBYTES: usize = mem::size_of::<::c_double>() - 1; + pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_double>() - 1; } else { #[doc(hidden)] pub const _ALIGNBYTES: usize = 8 - 1; diff --git a/src/unix/bsd/netbsdlike/netbsd/x86.rs b/src/unix/bsd/netbsdlike/netbsd/x86.rs index 895e7f8908dd6cb056b251380b1f9c3d2e5db657..daa89a11a67cbc9c6fa363c0bc5055faa46cd8ed 100644 --- a/src/unix/bsd/netbsdlike/netbsd/x86.rs +++ b/src/unix/bsd/netbsdlike/netbsd/x86.rs @@ -1,5 +1,3 @@ -use dox::mem; - pub type c_long = i32; pub type c_ulong = u32; pub type c_char = i8; @@ -9,7 +7,7 @@ pub type __cpu_simple_lock_nv_t = ::c_uchar; cfg_if! { if #[cfg(libc_const_size_of)] { #[doc(hidden)] - pub const _ALIGNBYTES: usize = mem::size_of::<::c_int>() - 1; + pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1; } else { #[doc(hidden)] pub const _ALIGNBYTES: usize = 4 - 1; diff --git a/src/unix/bsd/netbsdlike/netbsd/x86_64.rs b/src/unix/bsd/netbsdlike/netbsd/x86_64.rs index e71a82c99bb57a7fc3ac9a32294005d4b6fb3011..0860d4f6c7b57e3f0e073cc4d2a23fdb7ceab723 100644 --- a/src/unix/bsd/netbsdlike/netbsd/x86_64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/x86_64.rs @@ -1,5 +1,3 @@ -use dox::mem; - use PT_FIRSTMACH; pub type c_long = i64; @@ -11,7 +9,7 @@ pub type __cpu_simple_lock_nv_t = ::c_uchar; cfg_if! { if #[cfg(libc_const_size_of)] { #[doc(hidden)] - pub const _ALIGNBYTES: usize = mem::size_of::<::c_long>() - 1; + pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1; } else { #[doc(hidden)] pub const _ALIGNBYTES: usize = 8 - 1; diff --git a/src/unix/bsd/netbsdlike/openbsdlike/mod.rs b/src/unix/bsd/netbsdlike/openbsdlike/mod.rs index cf67747113507fe33209cab506c3e2d107ba961d..a003a0d0cea723a9c669f35fa5137aa4dcba0c02 100644 --- a/src/unix/bsd/netbsdlike/openbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsdlike/mod.rs @@ -223,184 +223,183 @@ s_no_extra_traits! { } } -#[cfg(feature = "extra_traits")] -impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_fileno == other.d_fileno - && self.d_off == other.d_off - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self.d_namlen == other.d_namlen - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } -} -#[cfg(feature = "extra_traits")] -impl Eq for dirent {} -#[cfg(feature = "extra_traits")] -impl std::fmt::Debug for dirent { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.debug_struct("dirent") - .field("d_fileno", &self.d_fileno) - .field("d_off", &self.d_off) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - .field("d_namlen", &self.d_namlen) - // FIXME: .field("d_name", &self.d_name) - .finish() - } -} -#[cfg(feature = "extra_traits")] -impl std::hash::Hash for dirent { - fn hash<H: std::hash::Hasher>(&self, state: &mut H) { - self.d_fileno.hash(state); - self.d_off.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_namlen.hash(state); - self.d_name.hash(state); - } -} - -#[cfg(feature = "extra_traits")] -impl PartialEq for sockaddr_storage { - fn eq(&self, other: &sockaddr_storage) -> bool { - self.ss_len == other.ss_len - && self.ss_family == other.ss_family - } -} -#[cfg(feature = "extra_traits")] -impl Eq for sockaddr_storage {} -#[cfg(feature = "extra_traits")] -impl std::fmt::Debug for sockaddr_storage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.debug_struct("sockaddr_storage") - .field("ss_len", &self.ss_len) - .field("ss_family", &self.ss_family) - .finish() - } -} -#[cfg(feature = "extra_traits")] -impl std::hash::Hash for sockaddr_storage { - fn hash<H: std::hash::Hasher>(&self, state: &mut H) { - self.ss_len.hash(state); - self.ss_family.hash(state); - } -} - -#[cfg(feature = "extra_traits")] -impl PartialEq for siginfo_t { - fn eq(&self, other: &siginfo_t) -> bool { - self.si_signo == other.si_signo - && self.si_code == other.si_code - && self.si_errno == other.si_errno - && self.si_addr == other.si_addr - } -} -#[cfg(feature = "extra_traits")] -impl Eq for siginfo_t {} -#[cfg(feature = "extra_traits")] -impl std::fmt::Debug for siginfo_t { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.debug_struct("siginfo_t") - .field("si_signo", &self.si_signo) - .field("si_code", &self.si_code) - .field("si_errno", &self.si_errno) - .field("si_addr", &self.si_addr) - .finish() - } -} -#[cfg(feature = "extra_traits")] -impl std::hash::Hash for siginfo_t { - fn hash<H: std::hash::Hasher>(&self, state: &mut H) { - self.si_signo.hash(state); - self.si_code.hash(state); - self.si_errno.hash(state); - self.si_addr.hash(state); - } -} - -#[cfg(feature = "extra_traits")] -impl PartialEq for lastlog { - fn eq(&self, other: &lastlog) -> bool { - self.ll_time == other.ll_time - && self - .ll_line - .iter() - .zip(other.ll_line.iter()) - .all(|(a,b)| a == b) - && self - .ll_host - .iter() - .zip(other.ll_host.iter()) - .all(|(a,b)| a == b) - } -} -#[cfg(feature = "extra_traits")] -impl Eq for lastlog {} -#[cfg(feature = "extra_traits")] -impl std::fmt::Debug for lastlog { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.debug_struct("lastlog") - .field("ll_time", &self.ll_time) - // FIXME: .field("ll_line", &self.ll_line) - // FIXME: .field("ll_host", &self.ll_host) - .finish() - } -} -#[cfg(feature = "extra_traits")] -impl std::hash::Hash for lastlog { - fn hash<H: std::hash::Hasher>(&self, state: &mut H) { - self.ll_time.hash(state); - self.ll_line.hash(state); - self.ll_host.hash(state); - } -} - -#[cfg(feature = "extra_traits")] -impl PartialEq for utmp { - fn eq(&self, other: &utmp) -> bool { - self.ut_time == other.ut_time - && self - .ut_line - .iter() - .zip(other.ut_line.iter()) - .all(|(a,b)| a == b) - && self - .ut_name - .iter() - .zip(other.ut_name.iter()) - .all(|(a,b)| a == b) - && self - .ut_host - .iter() - .zip(other.ut_host.iter()) - .all(|(a,b)| a == b) - } -} -#[cfg(feature = "extra_traits")] -impl Eq for utmp {} -#[cfg(feature = "extra_traits")] -impl std::fmt::Debug for utmp { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.debug_struct("utmp") - // FIXME: .field("ut_line", &self.ut_line) - // FIXME: .field("ut_name", &self.ut_name) - // FIXME: .field("ut_host", &self.ut_host) - .field("ut_time", &self.ut_time) - .finish() - } -} -#[cfg(feature = "extra_traits")] -impl std::hash::Hash for utmp { - fn hash<H: std::hash::Hasher>(&self, state: &mut H) { - self.ut_line.hash(state); - self.ut_name.hash(state); - self.ut_host.hash(state); - self.ut_time.hash(state); +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for dirent { + fn eq(&self, other: &dirent) -> bool { + self.d_fileno == other.d_fileno + && self.d_off == other.d_off + && self.d_reclen == other.d_reclen + && self.d_type == other.d_type + && self.d_namlen == other.d_namlen + && self + .d_name + .iter() + .zip(other.d_name.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for dirent {} + + impl std::fmt::Debug for dirent { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.debug_struct("dirent") + .field("d_fileno", &self.d_fileno) + .field("d_off", &self.d_off) + .field("d_reclen", &self.d_reclen) + .field("d_type", &self.d_type) + .field("d_namlen", &self.d_namlen) + // FIXME: .field("d_name", &self.d_name) + .finish() + } + } + + impl std::hash::Hash for dirent { + fn hash<H: std::hash::Hasher>(&self, state: &mut H) { + self.d_fileno.hash(state); + self.d_off.hash(state); + self.d_reclen.hash(state); + self.d_type.hash(state); + self.d_namlen.hash(state); + self.d_name.hash(state); + } + } + + impl PartialEq for sockaddr_storage { + fn eq(&self, other: &sockaddr_storage) -> bool { + self.ss_len == other.ss_len + && self.ss_family == other.ss_family + } + } + + impl Eq for sockaddr_storage {} + + impl std::fmt::Debug for sockaddr_storage { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.debug_struct("sockaddr_storage") + .field("ss_len", &self.ss_len) + .field("ss_family", &self.ss_family) + .finish() + } + } + + impl std::hash::Hash for sockaddr_storage { + fn hash<H: std::hash::Hasher>(&self, state: &mut H) { + self.ss_len.hash(state); + self.ss_family.hash(state); + } + } + + impl PartialEq for siginfo_t { + fn eq(&self, other: &siginfo_t) -> bool { + self.si_signo == other.si_signo + && self.si_code == other.si_code + && self.si_errno == other.si_errno + && self.si_addr == other.si_addr + } + } + + impl Eq for siginfo_t {} + + impl std::fmt::Debug for siginfo_t { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.debug_struct("siginfo_t") + .field("si_signo", &self.si_signo) + .field("si_code", &self.si_code) + .field("si_errno", &self.si_errno) + .field("si_addr", &self.si_addr) + .finish() + } + } + + impl std::hash::Hash for siginfo_t { + fn hash<H: std::hash::Hasher>(&self, state: &mut H) { + self.si_signo.hash(state); + self.si_code.hash(state); + self.si_errno.hash(state); + self.si_addr.hash(state); + } + } + + impl PartialEq for lastlog { + fn eq(&self, other: &lastlog) -> bool { + self.ll_time == other.ll_time + && self + .ll_line + .iter() + .zip(other.ll_line.iter()) + .all(|(a,b)| a == b) + && self + .ll_host + .iter() + .zip(other.ll_host.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for lastlog {} + + impl std::fmt::Debug for lastlog { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.debug_struct("lastlog") + .field("ll_time", &self.ll_time) + // FIXME: .field("ll_line", &self.ll_line) + // FIXME: .field("ll_host", &self.ll_host) + .finish() + } + } + + impl std::hash::Hash for lastlog { + fn hash<H: std::hash::Hasher>(&self, state: &mut H) { + self.ll_time.hash(state); + self.ll_line.hash(state); + self.ll_host.hash(state); + } + } + + impl PartialEq for utmp { + fn eq(&self, other: &utmp) -> bool { + self.ut_time == other.ut_time + && self + .ut_line + .iter() + .zip(other.ut_line.iter()) + .all(|(a,b)| a == b) + && self + .ut_name + .iter() + .zip(other.ut_name.iter()) + .all(|(a,b)| a == b) + && self + .ut_host + .iter() + .zip(other.ut_host.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for utmp {} + + impl std::fmt::Debug for utmp { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.debug_struct("utmp") + // FIXME: .field("ut_line", &self.ut_line) + // FIXME: .field("ut_name", &self.ut_name) + // FIXME: .field("ut_host", &self.ut_host) + .field("ut_time", &self.ut_time) + .finish() + } + } + + impl std::hash::Hash for utmp { + fn hash<H: std::hash::Hasher>(&self, state: &mut H) { + self.ut_line.hash(state); + self.ut_name.hash(state); + self.ut_host.hash(state); + self.ut_time.hash(state); + } + } } } diff --git a/src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs b/src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs index 268e5af4f8d11a1c696d103f02132a4a0a49a20f..6a8cbb5c4f7ea7ba0449a8eafa42d42b782146bc 100644 --- a/src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs +++ b/src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs @@ -1,5 +1,3 @@ -use dox::mem; - pub type c_long = i64; pub type c_ulong = u64; pub type c_char = u8; @@ -8,7 +6,7 @@ pub type c_char = u8; cfg_if! { if #[cfg(libc_const_size_of)] { #[doc(hidden)] - pub const _ALIGNBYTES: usize = mem::size_of::<::c_long>() - 1; + pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1; } else { #[doc(hidden)] pub const _ALIGNBYTES: usize = 8 - 1; diff --git a/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs index 661f1f435709203962fbf32439bbd93bfad0a96a..5c9eea1db4308b0263ac0dcae0fec73ec18e4cd3 100644 --- a/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs @@ -142,31 +142,34 @@ s_no_extra_traits! { } } -#[cfg(feature = "extra_traits")] -impl PartialEq for mount_info { - fn eq(&self, other: &mount_info) -> bool { - unsafe { - self.align - .iter() - .zip(other.align.iter()) - .all(|(a,b)| a == b) +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for mount_info { + fn eq(&self, other: &mount_info) -> bool { + unsafe { + self.align + .iter() + .zip(other.align.iter()) + .all(|(a,b)| a == b) + } + } + } + + impl Eq for mount_info { } + + impl std::fmt::Debug for mount_info { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.debug_struct("mount_info") + // FIXME: .field("align", &self.align) + .finish() + } + } + + impl std::hash::Hash for mount_info { + fn hash<H: std::hash::Hasher>(&self, state: &mut H) { + unsafe { self.align.hash(state) }; + } } - } -} -#[cfg(feature = "extra_traits")] -impl Eq for mount_info { } -#[cfg(feature = "extra_traits")] -impl std::fmt::Debug for mount_info { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.debug_struct("mount_info") - // FIXME: .field("align", &self.align) - .finish() - } -} -#[cfg(feature = "extra_traits")] -impl std::hash::Hash for mount_info { - fn hash<H: std::hash::Hasher>(&self, state: &mut H) { - unsafe { self.align.hash(state) }; } } @@ -200,105 +203,108 @@ cfg_if! { } } - #[cfg(feature = "extra_traits")] - impl PartialEq for statfs { - fn eq(&self, other: &statfs) -> bool { - self.f_flags == other.f_flags - && self.f_bsize == other.f_bsize - && self.f_iosize == other.f_iosize - && self.f_blocks == other.f_blocks - && self.f_bfree == other.f_bfree - && self.f_bavail == other.f_bavail - && self.f_files == other.f_files - && self.f_ffree == other.f_ffree - && self.f_favail == other.f_favail - && self.f_syncwrites == other.f_syncwrites - && self.f_syncreads == other.f_syncreads - && self.f_asyncwrites == other.f_asyncwrites - && self.f_asyncreads == other.f_asyncreads - && self.f_fsid == other.f_fsid - && self.f_namemax == other.f_namemax - && self.f_owner == other.f_owner - && self.f_ctime == other.f_ctime - && self.f_fstypename - .iter() - .zip(other.f_fstypename.iter()) - .all(|(a,b)| a == b) - && self.f_mntonname - .iter() - .zip(other.f_mntonname.iter()) - .all(|(a,b)| a == b) - && self.f_mntfromname - .iter() - .zip(other.f_mntfromname.iter()) - .all(|(a,b)| a == b) - && self.f_mntfromspec - .iter() - .zip(other.f_mntfromspec.iter()) - .all(|(a,b)| a == b) - && self.mount_info == other.mount_info - } - } - #[cfg(feature = "extra_traits")] - impl Eq for statfs { } - #[cfg(feature = "extra_traits")] - impl std::fmt::Debug for statfs { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.debug_struct("statfs") - .field("f_flags", &self.f_flags) - .field("f_bsize", &self.f_bsize) - .field("f_iosize", &self.f_iosize) - .field("f_blocks", &self.f_blocks) - .field("f_bfree", &self.f_bfree) - .field("f_bavail", &self.f_bavail) - .field("f_files", &self.f_files) - .field("f_ffree", &self.f_ffree) - .field("f_favail", &self.f_favail) - .field("f_syncwrites", &self.f_syncwrites) - .field("f_syncreads", &self.f_syncreads) - .field("f_asyncwrites", &self.f_asyncwrites) - .field("f_asyncreads", &self.f_asyncreads) - .field("f_fsid", &self.f_fsid) - .field("f_namemax", &self.f_namemax) - .field("f_owner", &self.f_owner) - .field("f_ctime", &self.f_ctime) - // FIXME: .field("f_fstypename", &self.f_fstypename) - // FIXME: .field("f_mntonname", &self.f_mntonname) - // FIXME: .field("f_mntfromname", &self.f_mntfromname) - // FIXME: .field("f_mntfromspec", &self.f_mntfromspec) - .field("mount_info", &self.mount_info) - .finish() - } - } - #[cfg(feature = "extra_traits")] - impl std::hash::Hash for statfs { - fn hash<H: std::hash::Hasher>(&self, state: &mut H) { - self.f_flags.hash(state); - self.f_bsize.hash(state); - self.f_iosize.hash(state); - self.f_blocks.hash(state); - self.f_bfree.hash(state); - self.f_bavail.hash(state); - self.f_files.hash(state); - self.f_ffree.hash(state); - self.f_favail.hash(state); - self.f_syncwrites.hash(state); - self.f_syncreads.hash(state); - self.f_asyncwrites.hash(state); - self.f_asyncreads.hash(state); - self.f_fsid.hash(state); - self.f_namemax.hash(state); - self.f_owner.hash(state); - self.f_ctime.hash(state); - self.f_fstypename.hash(state); - self.f_mntonname.hash(state); - self.f_mntfromname.hash(state); - self.f_mntfromspec.hash(state); - self.mount_info.hash(state); + cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for statfs { + fn eq(&self, other: &statfs) -> bool { + self.f_flags == other.f_flags + && self.f_bsize == other.f_bsize + && self.f_iosize == other.f_iosize + && self.f_blocks == other.f_blocks + && self.f_bfree == other.f_bfree + && self.f_bavail == other.f_bavail + && self.f_files == other.f_files + && self.f_ffree == other.f_ffree + && self.f_favail == other.f_favail + && self.f_syncwrites == other.f_syncwrites + && self.f_syncreads == other.f_syncreads + && self.f_asyncwrites == other.f_asyncwrites + && self.f_asyncreads == other.f_asyncreads + && self.f_fsid == other.f_fsid + && self.f_namemax == other.f_namemax + && self.f_owner == other.f_owner + && self.f_ctime == other.f_ctime + && self.f_fstypename + .iter() + .zip(other.f_fstypename.iter()) + .all(|(a,b)| a == b) + && self.f_mntonname + .iter() + .zip(other.f_mntonname.iter()) + .all(|(a,b)| a == b) + && self.f_mntfromname + .iter() + .zip(other.f_mntfromname.iter()) + .all(|(a,b)| a == b) + && self.f_mntfromspec + .iter() + .zip(other.f_mntfromspec.iter()) + .all(|(a,b)| a == b) + && self.mount_info == other.mount_info + } + } + + impl Eq for statfs { } + + impl std::fmt::Debug for statfs { + fn fmt(&self, f: &mut std::fmt::Formatter) + -> std::fmt::Result { + f.debug_struct("statfs") + .field("f_flags", &self.f_flags) + .field("f_bsize", &self.f_bsize) + .field("f_iosize", &self.f_iosize) + .field("f_blocks", &self.f_blocks) + .field("f_bfree", &self.f_bfree) + .field("f_bavail", &self.f_bavail) + .field("f_files", &self.f_files) + .field("f_ffree", &self.f_ffree) + .field("f_favail", &self.f_favail) + .field("f_syncwrites", &self.f_syncwrites) + .field("f_syncreads", &self.f_syncreads) + .field("f_asyncwrites", &self.f_asyncwrites) + .field("f_asyncreads", &self.f_asyncreads) + .field("f_fsid", &self.f_fsid) + .field("f_namemax", &self.f_namemax) + .field("f_owner", &self.f_owner) + .field("f_ctime", &self.f_ctime) + // FIXME: .field("f_fstypename", &self.f_fstypename) + // FIXME: .field("f_mntonname", &self.f_mntonname) + // FIXME: .field("f_mntfromname", &self.f_mntfromname) + // FIXME: .field("f_mntfromspec", &self.f_mntfromspec) + .field("mount_info", &self.mount_info) + .finish() + } + } + + impl std::hash::Hash for statfs { + fn hash<H: std::hash::Hasher>(&self, state: &mut H) { + self.f_flags.hash(state); + self.f_bsize.hash(state); + self.f_iosize.hash(state); + self.f_blocks.hash(state); + self.f_bfree.hash(state); + self.f_bavail.hash(state); + self.f_files.hash(state); + self.f_ffree.hash(state); + self.f_favail.hash(state); + self.f_syncwrites.hash(state); + self.f_syncreads.hash(state); + self.f_asyncwrites.hash(state); + self.f_asyncreads.hash(state); + self.f_fsid.hash(state); + self.f_namemax.hash(state); + self.f_owner.hash(state); + self.f_ctime.hash(state); + self.f_fstypename.hash(state); + self.f_mntonname.hash(state); + self.f_mntfromname.hash(state); + self.f_mntfromspec.hash(state); + self.mount_info.hash(state); + } + } } } } -} //https://github.com/openbsd/src/blob/master/sys/sys/mount.h pub const ISOFSMNT_NORRIP: ::c_int = 0x1; // disable Rock Ridge Ext diff --git a/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs b/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs index 959c87b42792fbc11fc44b72251f2755937835ef..05538cd0a9e814600400ee50949da7adec8717eb 100644 --- a/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs +++ b/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs @@ -1,5 +1,3 @@ -use dox::mem; - pub type c_long = i32; pub type c_ulong = u32; pub type c_char = i8; @@ -8,7 +6,7 @@ pub type c_char = i8; cfg_if! { if #[cfg(libc_const_size_of)] { #[doc(hidden)] - pub const _ALIGNBYTES: usize = mem::size_of::<::c_int>() - 1; + pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1; } else { #[doc(hidden)] pub const _ALIGNBYTES: usize = 4 - 1; diff --git a/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs b/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs index b2025a8a9c06b0439a0c35d8fa21249103929eda..7daa9d83664aae6b11fd8e6892f00e35a0cdd0ec 100644 --- a/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs +++ b/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs @@ -1,5 +1,3 @@ -use dox::mem; - use PT_FIRSTMACH; pub type c_long = i64; @@ -10,7 +8,7 @@ pub type c_char = i8; cfg_if! { if #[cfg(libc_const_size_of)] { #[doc(hidden)] - pub const _ALIGNBYTES: usize = mem::size_of::<::c_long>() - 1; + pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1; } else { #[doc(hidden)] pub const _ALIGNBYTES: usize = 8 - 1; diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs index e0365d913ce8c4e1fd53b51ebaff0ae2e4d3ce4b..4d2082fa2ccccf623a21829805d44f9b828e9a3e 100644 --- a/src/unix/haiku/mod.rs +++ b/src/unix/haiku/mod.rs @@ -1,5 +1,3 @@ -use dox::{mem, Option}; - pub type rlim_t = ::uintptr_t; pub type sa_family_t = u8; pub type pthread_key_t = ::c_int; @@ -33,8 +31,8 @@ pub type idtype_t = ::c_uint; #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} -impl ::dox::Copy for timezone {} -impl ::dox::Clone for timezone { +impl ::Copy for timezone {} +impl ::Clone for timezone { fn clone(&self) -> timezone { *self } } @@ -1042,20 +1040,20 @@ pub const TCIOFLUSH: ::c_int = 0x03; f! { pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { let fd = fd as usize; - let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; (*set).fds_bits[fd / size] &= !(1 << (fd % size)); return } pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool { let fd = fd as usize; - let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0 } pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { let fd = fd as usize; - let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; (*set).fds_bits[fd / size] |= 1 << (fd % size); return } @@ -1146,7 +1144,7 @@ extern { pub fn glob(pattern: *const ::c_char, flags: ::c_int, - errfunc: Option<extern fn(epath: *const ::c_char, + errfunc: ::Option<extern fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>, pglob: *mut ::glob_t) -> ::c_int; pub fn globfree(pglob: *mut ::glob_t); @@ -1238,9 +1236,9 @@ extern { #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")] pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int; - pub fn pthread_atfork(prepare: Option<unsafe extern fn()>, - parent: Option<unsafe extern fn()>, - child: Option<unsafe extern fn()>) -> ::c_int; + pub fn pthread_atfork(prepare: ::Option<unsafe extern fn()>, + parent: ::Option<unsafe extern fn()>, + child: ::Option<unsafe extern fn()>) -> ::c_int; pub fn getgrgid(gid: ::gid_t) -> *mut ::group; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "popen$UNIX2003")] diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 972c2c0dae89d022591e8b4b2500e6d2777b989e..cb0862f55ad6387554d8879bb599201f4ba8b76d 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -3,8 +3,6 @@ //! More functions and definitions can be found in the more specific modules //! according to the platform in question. -use dox::Option; - pub type int8_t = i8; pub type int16_t = i16; pub type int32_t = i32; @@ -43,14 +41,14 @@ pub type cc_t = ::c_uchar; #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum DIR {} -impl ::dox::Copy for DIR {} -impl ::dox::Clone for DIR { +impl ::Copy for DIR {} +impl ::Clone for DIR { fn clone(&self) -> DIR { *self } } #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum locale_t {} -impl ::dox::Copy for locale_t {} -impl ::dox::Clone for locale_t { +impl ::Copy for locale_t {} +impl ::Clone for locale_t { fn clone(&self) -> locale_t { *self } } @@ -364,14 +362,14 @@ cfg_if! { #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum FILE {} -impl ::dox::Copy for FILE {} -impl ::dox::Clone for FILE { +impl ::Copy for FILE {} +impl ::Clone for FILE { fn clone(&self) -> FILE { *self } } #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos_t {} // TODO: fill this out with a struct -impl ::dox::Copy for fpos_t {} -impl ::dox::Clone for fpos_t { +impl ::Copy for fpos_t {} +impl ::Clone for fpos_t { fn clone(&self) -> fpos_t { *self } } @@ -858,7 +856,7 @@ extern { #[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")] pub fn sched_yield() -> ::c_int; pub fn pthread_key_create(key: *mut pthread_key_t, - dtor: Option<unsafe extern fn(*mut ::c_void)>) + dtor: ::Option<unsafe extern fn(*mut ::c_void)>) -> ::c_int; pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int; pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void; diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index 94bce1e12f467c0c318247e0821a90633d41d33d..0550e82e6a21e740e0612f032ea2b756c63d1582 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -1,5 +1,3 @@ -use dox::mem; - pub type blkcnt_t = i32; pub type blksize_t = i32; pub type clock_t = i32; @@ -543,20 +541,20 @@ pub const EAI_SOCKTYPE: ::c_int = -307; f! { pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { - let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; + let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; let fd = fd as usize; (*set).fds_bits[fd / bits] &= !(1 << (fd % bits)); return } pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool { - let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; + let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; let fd = fd as usize; return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0 } pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { - let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; + let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; let fd = fd as usize; (*set).fds_bits[fd / bits] |= 1 << (fd % bits); return @@ -636,9 +634,9 @@ extern { #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")] pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int; - pub fn pthread_atfork(prepare: Option<unsafe extern fn()>, - parent: Option<unsafe extern fn()>, - child: Option<unsafe extern fn()>) -> ::c_int; + pub fn pthread_atfork(prepare: ::Option<unsafe extern fn()>, + parent: ::Option<unsafe extern fn()>, + child: ::Option<unsafe extern fn()>) -> ::c_int; pub fn getgrgid(gid: ::gid_t) -> *mut ::group; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "popen$UNIX2003")] diff --git a/src/unix/notbsd/android/b32/mod.rs b/src/unix/notbsd/android/b32/mod.rs index 394abe8fe24c774ea32704d53cd35af5be7441d8..a8cc51b2215c8a29edb8e375e2edfb217e70ae9a 100644 --- a/src/unix/notbsd/android/b32/mod.rs +++ b/src/unix/notbsd/android/b32/mod.rs @@ -14,7 +14,7 @@ s! { pub sa_sigaction: ::sighandler_t, pub sa_mask: ::sigset_t, pub sa_flags: ::c_ulong, - pub sa_restorer: ::dox::Option<extern fn()>, + pub sa_restorer: ::Option<extern fn()>, } pub struct rlimit64 { diff --git a/src/unix/notbsd/android/b64/mod.rs b/src/unix/notbsd/android/b64/mod.rs index fce9965b0017a71d6092cae06ff272772798865f..46becc53d4d383a098718f5cc5e0ebe4fe8eba7c 100644 --- a/src/unix/notbsd/android/b64/mod.rs +++ b/src/unix/notbsd/android/b64/mod.rs @@ -16,7 +16,7 @@ s! { pub sa_flags: ::c_uint, pub sa_sigaction: ::sighandler_t, pub sa_mask: ::sigset_t, - pub sa_restorer: ::dox::Option<extern fn()>, + pub sa_restorer: ::Option<extern fn()>, } pub struct rlimit64 { diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs index df4d5b81ad621068e9b66ec67cc7b3ac71ec8246..ce6120984b3a8e321119bd87d4f3a9e753eae130 100644 --- a/src/unix/notbsd/android/mod.rs +++ b/src/unix/notbsd/android/mod.rs @@ -1,7 +1,5 @@ //! Android-specific definitions for linux-like values -use dox::{mem, Option}; - pub type clock_t = ::c_long; pub type time_t = ::c_long; pub type suseconds_t = ::c_long; @@ -1716,21 +1714,21 @@ f! { } pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in___bits = 8 * mem::size_of_val(&cpuset.__bits[0]); + let size_in___bits = 8 * ::mem::size_of_val(&cpuset.__bits[0]); let (idx, offset) = (cpu / size_in___bits, cpu % size_in___bits); cpuset.__bits[idx] |= 1 << offset; () } pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in___bits = 8 * mem::size_of_val(&cpuset.__bits[0]); + let size_in___bits = 8 * ::mem::size_of_val(&cpuset.__bits[0]); let (idx, offset) = (cpu / size_in___bits, cpu % size_in___bits); cpuset.__bits[idx] &= !(1 << offset); () } pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { - let size_in___bits = 8 * mem::size_of_val(&cpuset.__bits[0]); + let size_in___bits = 8 * ::mem::size_of_val(&cpuset.__bits[0]); let (idx, offset) = (cpu / size_in___bits, cpu % size_in___bits); 0 != (cpuset.__bits[idx] & (1 << offset)) } @@ -1932,9 +1930,9 @@ extern { #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")] pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int; - pub fn pthread_atfork(prepare: Option<unsafe extern fn()>, - parent: Option<unsafe extern fn()>, - child: Option<unsafe extern fn()>) -> ::c_int; + pub fn pthread_atfork(prepare: ::Option<unsafe extern fn()>, + parent: ::Option<unsafe extern fn()>, + child: ::Option<unsafe extern fn()>) -> ::c_int; pub fn getgrgid(gid: ::gid_t) -> *mut ::group; pub fn getgrouplist(user: *const ::c_char, group: ::gid_t, diff --git a/src/unix/notbsd/emscripten/mod.rs b/src/unix/notbsd/emscripten/mod.rs index 5de7b5ac57608600db55424e1fab668adff5eb2a..e159175f75c83a5a802bc6b18ba15569ae3994e3 100644 --- a/src/unix/notbsd/emscripten/mod.rs +++ b/src/unix/notbsd/emscripten/mod.rs @@ -1,5 +1,3 @@ -use dox::{mem, Option}; - pub type c_char = i8; pub type wchar_t = i32; pub type useconds_t = u32; @@ -37,8 +35,8 @@ pub type nlink_t = u32; #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos64_t {} // TODO: fill this out with a struct -impl ::dox::Copy for fpos64_t {} -impl ::dox::Clone for fpos64_t { +impl ::Copy for fpos64_t {} +impl ::Clone for fpos64_t { fn clone(&self) -> fpos64_t { *self } } @@ -201,7 +199,7 @@ s! { pub sa_sigaction: ::sighandler_t, pub sa_mask: ::sigset_t, pub sa_flags: ::c_int, - pub sa_restorer: ::dox::Option<extern fn()>, + pub sa_restorer: ::Option<extern fn()>, } pub struct ipc_perm { @@ -1477,7 +1475,7 @@ pub const ATF_MAGIC: ::c_int = 0x80; f! { pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr { - if ((*cmsg).cmsg_len as usize) < mem::size_of::<cmsghdr>() { + if ((*cmsg).cmsg_len as usize) < ::mem::size_of::<cmsghdr>() { return 0 as *mut cmsghdr; }; let next = (cmsg as usize + @@ -1499,21 +1497,23 @@ f! { } pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let size_in_bits + = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.bits[idx] |= 1 << offset; () } pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let size_in_bits + = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.bits[idx] &= !(1 << offset); () } pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { - let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); + let size_in_bits = 8 * ::mem::size_of_val(&cpuset.bits[0]); let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); 0 != (cpuset.bits[idx] & (1 << offset)) } @@ -1622,7 +1622,7 @@ extern { pub fn glob(pattern: *const c_char, flags: ::c_int, - errfunc: Option<extern fn(epath: *const c_char, + errfunc: ::Option<extern fn(epath: *const c_char, errno: ::c_int) -> ::c_int>, pglob: *mut ::glob_t) -> ::c_int; pub fn globfree(pglob: *mut ::glob_t); diff --git a/src/unix/notbsd/linux/mips/mips32.rs b/src/unix/notbsd/linux/mips/mips32.rs index a6c08a5ad71b8af4aeb0a4f74b0a4e068da52fc9..991161395444ab7b2aaccdfe00eeee748d1286fd 100644 --- a/src/unix/notbsd/linux/mips/mips32.rs +++ b/src/unix/notbsd/linux/mips/mips32.rs @@ -133,7 +133,7 @@ s! { pub sa_flags: ::c_int, pub sa_sigaction: ::sighandler_t, pub sa_mask: sigset_t, - pub sa_restorer: ::dox::Option<extern fn()>, + pub sa_restorer: ::Option<extern fn()>, _resv: [::c_int; 1], } diff --git a/src/unix/notbsd/linux/mips/mips64.rs b/src/unix/notbsd/linux/mips/mips64.rs index e8b02a36b0e718b9296c8ff3a6c9d3a4be2921ad..c4247c976c9bd74684f62725e5414c3dea640c5f 100644 --- a/src/unix/notbsd/linux/mips/mips64.rs +++ b/src/unix/notbsd/linux/mips/mips64.rs @@ -131,7 +131,7 @@ s! { pub sa_flags: ::c_int, pub sa_sigaction: ::sighandler_t, pub sa_mask: sigset_t, - pub sa_restorer: ::dox::Option<extern fn()>, + pub sa_restorer: ::Option<extern fn()>, } pub struct stack_t { diff --git a/src/unix/notbsd/linux/mips/mod.rs b/src/unix/notbsd/linux/mips/mod.rs index 5d4dec79bf5e7ac57f4e33145bd13b48c97c7b2b..b7001866eba3aaf405db40da6764e27a3683e716 100644 --- a/src/unix/notbsd/linux/mips/mod.rs +++ b/src/unix/notbsd/linux/mips/mod.rs @@ -913,7 +913,7 @@ extern { sz: ::c_int) -> ::c_int; pub fn glob64(pattern: *const ::c_char, flags: ::c_int, - errfunc: ::dox::Option<extern fn(epath: *const ::c_char, + errfunc: ::Option<extern fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>, pglob: *mut glob64_t) -> ::c_int; diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index 1ec2a95f77058b0972103fa24f3e3980c8a1baaa..696b2a556c44c3728218b4075d3d99748cf97573 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -1,7 +1,5 @@ //! Linux-specific definitions for linux-like values -use dox::{mem, Option}; - pub type useconds_t = u32; pub type dev_t = u64; pub type socklen_t = u32; @@ -40,8 +38,8 @@ pub type Elf64_Section = u16; #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos64_t {} // TODO: fill this out with a struct -impl ::dox::Copy for fpos64_t {} -impl ::dox::Clone for fpos64_t { +impl ::Copy for fpos64_t {} +impl ::Clone for fpos64_t { fn clone(&self) -> fpos64_t { *self } } @@ -1758,7 +1756,7 @@ pub const SOF_TIMESTAMPING_RAW_HARDWARE: ::c_uint = 1 << 6; f! { pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr { - if ((*cmsg).cmsg_len as usize) < mem::size_of::<cmsghdr>() { + if ((*cmsg).cmsg_len as usize) < ::mem::size_of::<cmsghdr>() { return 0 as *mut cmsghdr; }; let next = (cmsg as usize + @@ -1782,21 +1780,23 @@ f! { } pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let size_in_bits + = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.bits[idx] |= 1 << offset; () } pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let size_in_bits + = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.bits[idx] &= !(1 << offset); () } pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { - let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); + let size_in_bits = 8 * ::mem::size_of_val(&cpuset.bits[0]); let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); 0 != (cpuset.bits[idx] & (1 << offset)) } @@ -2057,7 +2057,7 @@ extern { pub fn glob(pattern: *const c_char, flags: ::c_int, - errfunc: Option<extern fn(epath: *const c_char, + errfunc: ::Option<extern fn(epath: *const c_char, errno: ::c_int) -> ::c_int>, pglob: *mut ::glob_t) -> ::c_int; pub fn globfree(pglob: *mut ::glob_t); @@ -2230,9 +2230,9 @@ extern { #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")] pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int; - pub fn pthread_atfork(prepare: Option<unsafe extern fn()>, - parent: Option<unsafe extern fn()>, - child: Option<unsafe extern fn()>) -> ::c_int; + pub fn pthread_atfork(prepare: ::Option<unsafe extern fn()>, + parent: ::Option<unsafe extern fn()>, + child: ::Option<unsafe extern fn()>) -> ::c_int; pub fn getgrgid(gid: ::gid_t) -> *mut ::group; pub fn getgrouplist(user: *const ::c_char, group: ::gid_t, @@ -2251,7 +2251,7 @@ extern { f: extern fn(*mut ::c_void) -> *mut ::c_void, value: *mut ::c_void) -> ::c_int; pub fn dl_iterate_phdr( - callback: Option<unsafe extern fn( + callback: ::Option<unsafe extern fn( info: *mut ::dl_phdr_info, size: ::size_t, data: *mut ::c_void diff --git a/src/unix/notbsd/linux/musl/mod.rs b/src/unix/notbsd/linux/musl/mod.rs index d5351d624bea6fd358e3799539f78b14f700d02c..646d184f2ffb3f3fe24994f8afd69ba3196936f4 100644 --- a/src/unix/notbsd/linux/musl/mod.rs +++ b/src/unix/notbsd/linux/musl/mod.rs @@ -37,7 +37,7 @@ s! { pub sa_sigaction: ::sighandler_t, pub sa_mask: ::sigset_t, pub sa_flags: ::c_int, - pub sa_restorer: ::dox::Option<extern fn()>, + pub sa_restorer: ::Option<extern fn()>, } pub struct statvfs { diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs index 497ea6d70a93dc594ba814ffd5be91d717de270c..9d6af2bad8a75995ca314ec726441c6851a54f86 100644 --- a/src/unix/notbsd/linux/other/mod.rs +++ b/src/unix/notbsd/linux/other/mod.rs @@ -35,7 +35,7 @@ s! { #[cfg(target_arch = "sparc64")] __reserved0: ::c_int, pub sa_flags: ::c_int, - pub sa_restorer: ::dox::Option<extern fn()>, + pub sa_restorer: ::Option<extern fn()>, } pub struct stack_t { @@ -927,7 +927,7 @@ extern { sz: ::c_int) -> ::c_int; pub fn glob64(pattern: *const ::c_char, flags: ::c_int, - errfunc: ::dox::Option<extern fn(epath: *const ::c_char, + errfunc: ::Option<extern fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>, pglob: *mut glob64_t) -> ::c_int; diff --git a/src/unix/notbsd/linux/s390x/mod.rs b/src/unix/notbsd/linux/s390x/mod.rs index d4bc9bd2f4a102267d60b49dcd379bae162c89b2..ebe9d41710e629d05f4ec71079d2a983d03ae63d 100644 --- a/src/unix/notbsd/linux/s390x/mod.rs +++ b/src/unix/notbsd/linux/s390x/mod.rs @@ -1,4 +1,4 @@ -use pthread_mutex_t; +use ::pthread_mutex_t; pub type blkcnt_t = i64; pub type blksize_t = i64; @@ -92,7 +92,7 @@ s! { pub sa_sigaction: ::sighandler_t, __glibc_reserved0: ::c_int, pub sa_flags: ::c_int, - pub sa_restorer: ::dox::Option<extern fn()>, + pub sa_restorer: ::Option<extern fn()>, pub sa_mask: sigset_t, } @@ -1322,7 +1322,7 @@ extern { sz: ::c_int) -> ::c_int; pub fn glob64(pattern: *const ::c_char, flags: ::c_int, - errfunc: ::dox::Option<extern fn(epath: *const ::c_char, + errfunc: ::Option<extern fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>, pglob: *mut glob64_t) -> ::c_int; diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs index baabd6e84dadda46684f0bfea9ac523549e20293..7b59f4112d9f890baa385fdec7e82d35123ff4ea 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -1,5 +1,3 @@ -use dox::mem; - pub type sa_family_t = u16; pub type pthread_key_t = ::c_uint; pub type speed_t = ::c_uint; @@ -10,8 +8,8 @@ pub type id_t = ::c_uint; #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} -impl ::dox::Copy for timezone {} -impl ::dox::Clone for timezone { +impl ::Copy for timezone {} +impl ::Clone for timezone { fn clone(&self) -> timezone { *self } } @@ -1129,12 +1127,12 @@ pub const ARPHRD_VOID: u16 = 0xFFFF; pub const ARPHRD_NONE: u16 = 0xFFFE; fn CMSG_ALIGN(len: usize) -> usize { - len + mem::size_of::<usize>() - 1 & !(mem::size_of::<usize>() - 1) + len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1) } f! { pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr { - if (*mhdr).msg_controllen as usize >= mem::size_of::<cmsghdr>() { + if (*mhdr).msg_controllen as usize >= ::mem::size_of::<cmsghdr>() { (*mhdr).msg_control as *mut cmsghdr } else { 0 as *mut cmsghdr @@ -1146,30 +1144,30 @@ f! { } pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint { - (CMSG_ALIGN(length as usize) + CMSG_ALIGN(mem::size_of::<cmsghdr>())) + (CMSG_ALIGN(length as usize) + CMSG_ALIGN(::mem::size_of::<cmsghdr>())) as ::c_uint } pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint { - CMSG_ALIGN(mem::size_of::<cmsghdr>()) as ::c_uint + length + CMSG_ALIGN(::mem::size_of::<cmsghdr>()) as ::c_uint + length } pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { let fd = fd as usize; - let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; (*set).fds_bits[fd / size] &= !(1 << (fd % size)); return } pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool { let fd = fd as usize; - let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0 } pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { let fd = fd as usize; - let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; (*set).fds_bits[fd / size] |= 1 << (fd % size); return } diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index 8954fd242cf7a572e0d12690935fca2c9e3a0923..d859eba4a38ec39397695ad1b2e8754f4c2739a9 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -1,5 +1,3 @@ -use dox::{mem, Option}; - pub type c_char = i8; pub type c_long = i64; pub type c_ulong = u64; @@ -38,8 +36,8 @@ pub type idtype_t = ::c_uint; #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} -impl ::dox::Copy for timezone {} -impl ::dox::Clone for timezone { +impl ::Copy for timezone {} +impl ::Clone for timezone { fn clone(&self) -> timezone { *self } } @@ -1500,20 +1498,20 @@ pub const VERASE2: usize = 17; f! { pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { - let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; + let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; let fd = fd as usize; (*set).fds_bits[fd / bits] &= !(1 << (fd % bits)); return } pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool { - let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; + let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; let fd = fd as usize; return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0 } pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { - let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; + let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; let fd = fd as usize; (*set).fds_bits[fd / bits] |= 1 << (fd % bits); return @@ -1637,7 +1635,7 @@ extern { pub fn glob(pattern: *const ::c_char, flags: ::c_int, - errfunc: Option<extern fn(epath: *const ::c_char, + errfunc: ::Option<extern fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>, pglob: *mut ::glob_t) -> ::c_int; @@ -1779,9 +1777,9 @@ extern { link_name = "__posix_sigwait")] pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int; - pub fn pthread_atfork(prepare: Option<unsafe extern fn()>, - parent: Option<unsafe extern fn()>, - child: Option<unsafe extern fn()>) -> ::c_int; + pub fn pthread_atfork(prepare: ::Option<unsafe extern fn()>, + parent: ::Option<unsafe extern fn()>, + child: ::Option<unsafe extern fn()>) -> ::c_int; pub fn getgrgid(gid: ::gid_t) -> *mut ::group; pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE; diff --git a/src/unix/uclibc/mips/mips32/mod.rs b/src/unix/uclibc/mips/mips32/mod.rs index 8dc9429e60c1c24e50ed7d9811cf007b51646e0f..23b385424487e7932f843f556fd506844e168f19 100644 --- a/src/unix/uclibc/mips/mips32/mod.rs +++ b/src/unix/uclibc/mips/mips32/mod.rs @@ -610,7 +610,7 @@ extern { sz: ::c_int) -> ::c_int; pub fn glob64(pattern: *const ::c_char, flags: ::c_int, - errfunc: ::dox::Option<extern fn(epath: *const ::c_char, + errfunc: ::Option<extern fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>, pglob: *mut glob64_t) -> ::c_int; diff --git a/src/unix/uclibc/mod.rs b/src/unix/uclibc/mod.rs index cfaef3bd736d8b138babc4ff33125f11e6ed6ad5..7263a18cb611c9d148cddd15b49615403cc5267e 100644 --- a/src/unix/uclibc/mod.rs +++ b/src/unix/uclibc/mod.rs @@ -1,5 +1,3 @@ -use dox::{mem, Option}; - pub type sa_family_t = u16; pub type pthread_key_t = ::c_uint; pub type speed_t = ::c_uint; @@ -26,15 +24,15 @@ pub type idtype_t = ::c_uint; #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos64_t {} // TODO: fill this out with a struct -impl ::dox::Copy for fpos64_t {} -impl ::dox::Clone for fpos64_t { +impl ::Copy for fpos64_t {} +impl ::Clone for fpos64_t { fn clone(&self) -> fpos64_t { *self } } #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} -impl ::dox::Copy for timezone {} -impl ::dox::Clone for timezone { +impl ::Copy for timezone {} +impl ::Clone for timezone { fn clone(&self) -> timezone { *self } } @@ -1389,20 +1387,20 @@ pub const AF_MAX: ::c_int = 39; f! { pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { let fd = fd as usize; - let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; (*set).fds_bits[fd / size] &= !(1 << (fd % size)); return } pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool { let fd = fd as usize; - let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0 } pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { let fd = fd as usize; - let size = mem::size_of_val(&(*set).fds_bits[0]) * 8; + let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; (*set).fds_bits[fd / size] |= 1 << (fd % size); return } @@ -1452,21 +1450,23 @@ f! { } pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let size_in_bits + = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.bits[idx] |= 1 << offset; () } pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let size_in_bits + = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); cpuset.bits[idx] &= !(1 << offset); () } pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { - let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); + let size_in_bits = 8 * ::mem::size_of_val(&cpuset.bits[0]); let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); 0 != (cpuset.bits[idx] & (1 << offset)) } @@ -1787,7 +1787,7 @@ extern { pub fn glob(pattern: *const c_char, flags: ::c_int, - errfunc: Option<extern fn(epath: *const c_char, + errfunc: ::Option<extern fn(epath: *const c_char, errno: ::c_int) -> ::c_int>, pglob: *mut ::glob_t) -> ::c_int; pub fn globfree(pglob: *mut ::glob_t); @@ -1871,9 +1871,9 @@ extern { #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")] pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int; - pub fn pthread_atfork(prepare: Option<unsafe extern fn()>, - parent: Option<unsafe extern fn()>, - child: Option<unsafe extern fn()>) -> ::c_int; + pub fn pthread_atfork(prepare: ::Option<unsafe extern fn()>, + parent: ::Option<unsafe extern fn()>, + child: ::Option<unsafe extern fn()>) -> ::c_int; pub fn pthread_create(native: *mut ::pthread_t, attr: *const ::pthread_attr_t, f: extern fn(*mut ::c_void) -> *mut ::c_void, diff --git a/src/windows/mod.rs b/src/windows/mod.rs index acde2e9ee2261efa55e6ca9231cd27576f3c6a9d..70ca675bd6c18bba8cc3b899edd962afa406d5fc 100644 --- a/src/windows/mod.rs +++ b/src/windows/mod.rs @@ -49,8 +49,8 @@ pub type dev_t = u32; pub type ino_t = u16; #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} -impl ::dox::Copy for timezone {} -impl ::dox::Clone for timezone { +impl ::Copy for timezone {} +impl ::Clone for timezone { fn clone(&self) -> timezone { *self } } pub type time64_t = i64; @@ -208,14 +208,14 @@ extern {} #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum FILE {} -impl ::dox::Copy for FILE {} -impl ::dox::Clone for FILE { +impl ::Copy for FILE {} +impl ::Clone for FILE { fn clone(&self) -> FILE { *self } } #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos_t {} // TODO: fill this out with a struct -impl ::dox::Copy for fpos_t {} -impl ::dox::Clone for fpos_t { +impl ::Copy for fpos_t {} +impl ::Clone for fpos_t { fn clone(&self) -> fpos_t { *self } }