1 //! 32-bit specific Apple (ios/darwin) definitions 2 3 pub type c_long = i32; 4 pub type c_ulong = u32; 5 pub type boolean_t = ::c_int; 6 7 s! { 8 pub struct if_data { 9 pub ifi_type: ::c_uchar, 10 pub ifi_typelen: ::c_uchar, 11 pub ifi_physical: ::c_uchar, 12 pub ifi_addrlen: ::c_uchar, 13 pub ifi_hdrlen: ::c_uchar, 14 pub ifi_recvquota: ::c_uchar, 15 pub ifi_xmitquota: ::c_uchar, 16 pub ifi_unused1: ::c_uchar, 17 pub ifi_mtu: u32, 18 pub ifi_metric: u32, 19 pub ifi_baudrate: u32, 20 pub ifi_ipackets: u32, 21 pub ifi_ierrors: u32, 22 pub ifi_opackets: u32, 23 pub ifi_oerrors: u32, 24 pub ifi_collisions: u32, 25 pub ifi_ibytes: u32, 26 pub ifi_obytes: u32, 27 pub ifi_imcasts: u32, 28 pub ifi_omcasts: u32, 29 pub ifi_iqdrops: u32, 30 pub ifi_noproto: u32, 31 pub ifi_recvtiming: u32, 32 pub ifi_xmittiming: u32, 33 pub ifi_lastchange: ::timeval, 34 pub ifi_unused2: u32, 35 pub ifi_hwassist: u32, 36 pub ifi_reserved1: u32, 37 pub ifi_reserved2: u32, 38 } 39 40 pub struct bpf_hdr { 41 pub bh_tstamp: ::timeval, 42 pub bh_caplen: u32, 43 pub bh_datalen: u32, 44 pub bh_hdrlen: ::c_ushort, 45 } 46 47 pub struct malloc_zone_t { 48 __private: [::uintptr_t; 18], // FIXME: keeping private for now 49 } 50 } 51 52 s_no_extra_traits! { 53 pub struct pthread_attr_t { 54 __sig: c_long, 55 __opaque: [::c_char; 36] 56 } 57 58 pub struct pthread_once_t { 59 __sig: c_long, 60 __opaque: [::c_char; ::__PTHREAD_ONCE_SIZE__], 61 } 62 } 63 64 cfg_if! { 65 if #[cfg(feature = "extra_traits")] { 66 impl PartialEq for pthread_attr_t { 67 fn eq(&self, other: &pthread_attr_t) -> bool { 68 self.__sig == other.__sig 69 && self.__opaque 70 .iter() 71 .zip(other.__opaque.iter()) 72 .all(|(a,b)| a == b) 73 } 74 } 75 impl Eq for pthread_attr_t {} 76 impl ::fmt::Debug for pthread_attr_t { 77 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 78 f.debug_struct("pthread_attr_t") 79 .field("__sig", &self.__sig) 80 // FIXME: .field("__opaque", &self.__opaque) 81 .finish() 82 } 83 } 84 impl ::hash::Hash for pthread_attr_t { 85 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 86 self.__sig.hash(state); 87 self.__opaque.hash(state); 88 } 89 } 90 impl PartialEq for pthread_once_t { 91 fn eq(&self, other: &pthread_once_t) -> bool { 92 self.__sig == other.__sig 93 && self.__opaque 94 .iter() 95 .zip(other.__opaque.iter()) 96 .all(|(a,b)| a == b) 97 } 98 } 99 impl Eq for pthread_once_t {} 100 impl ::fmt::Debug for pthread_once_t { 101 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 102 f.debug_struct("pthread_once_t") 103 .field("__sig", &self.__sig) 104 .finish() 105 } 106 } 107 impl ::hash::Hash for pthread_once_t { 108 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 109 self.__sig.hash(state); 110 self.__opaque.hash(state); 111 } 112 } 113 } 114 } 115 116 #[doc(hidden)] 117 #[deprecated(since = "0.2.55")] 118 pub const NET_RT_MAXID: ::c_int = 10; 119 120 pub const __PTHREAD_MUTEX_SIZE__: usize = 40; 121 pub const __PTHREAD_COND_SIZE__: usize = 24; 122 pub const __PTHREAD_CONDATTR_SIZE__: usize = 4; 123 pub const __PTHREAD_ONCE_SIZE__: usize = 4; 124 pub const __PTHREAD_RWLOCK_SIZE__: usize = 124; 125 pub const __PTHREAD_RWLOCKATTR_SIZE__: usize = 12; 126 127 pub const TIOCTIMESTAMP: ::c_ulong = 0x40087459; 128 pub const TIOCDCDTIMESTAMP: ::c_ulong = 0x40087458; 129 130 pub const BIOCSETF: ::c_ulong = 0x80084267; 131 pub const BIOCSRTIMEOUT: ::c_ulong = 0x8008426d; 132 pub const BIOCGRTIMEOUT: ::c_ulong = 0x4008426e; 133 pub const BIOCSETFNR: ::c_ulong = 0x8008427e; 134 135 const _PTHREAD_ONCE_SIG_INIT: c_long = 0x30B1BCBA; 136 pub const PTHREAD_ONCE_INIT: ::pthread_once_t = ::pthread_once_t { 137 __sig: _PTHREAD_ONCE_SIG_INIT, 138 __opaque: [0; 4], 139 }; 140 141 extern "C" { exchangedata( path1: *const ::c_char, path2: *const ::c_char, options: ::c_ulong, ) -> ::c_int142 pub fn exchangedata( 143 path1: *const ::c_char, 144 path2: *const ::c_char, 145 options: ::c_ulong, 146 ) -> ::c_int; 147 } 148 149 cfg_if! { 150 if #[cfg(libc_align)] { 151 mod align; 152 pub use self::align::*; 153 } 154 } 155