1 //! 64-bit specific Apple (ios/darwin) definitions
2 
3 pub type c_long = i64;
4 pub type c_ulong = u64;
5 pub type boolean_t = ::c_uint;
6 
7 s! {
8     pub struct timeval32 {
9         pub tv_sec: i32,
10         pub tv_usec: i32,
11     }
12 
13     pub struct if_data {
14         pub ifi_type: ::c_uchar,
15         pub ifi_typelen: ::c_uchar,
16         pub ifi_physical: ::c_uchar,
17         pub ifi_addrlen: ::c_uchar,
18         pub ifi_hdrlen: ::c_uchar,
19         pub ifi_recvquota: ::c_uchar,
20         pub ifi_xmitquota: ::c_uchar,
21         pub ifi_unused1: ::c_uchar,
22         pub ifi_mtu: u32,
23         pub ifi_metric: u32,
24         pub ifi_baudrate: u32,
25         pub ifi_ipackets: u32,
26         pub ifi_ierrors: u32,
27         pub ifi_opackets: u32,
28         pub ifi_oerrors: u32,
29         pub ifi_collisions: u32,
30         pub ifi_ibytes: u32,
31         pub ifi_obytes: u32,
32         pub ifi_imcasts: u32,
33         pub ifi_omcasts: u32,
34         pub ifi_iqdrops: u32,
35         pub ifi_noproto: u32,
36         pub ifi_recvtiming: u32,
37         pub ifi_xmittiming: u32,
38         pub ifi_lastchange: timeval32,
39         pub ifi_unused2: u32,
40         pub ifi_hwassist: u32,
41         pub ifi_reserved1: u32,
42         pub ifi_reserved2: u32,
43     }
44 
45     pub struct bpf_hdr {
46         pub bh_tstamp: ::timeval32,
47         pub bh_caplen: ::uint32_t,
48         pub bh_datalen: ::uint32_t,
49         pub bh_hdrlen: ::c_ushort,
50     }
51 }
52 
53 s_no_extra_traits!{
54     pub struct pthread_attr_t {
55         __sig: c_long,
56         __opaque: [::c_char; 56]
57     }
58 }
59 
60 cfg_if! {
61     if #[cfg(feature = "extra_traits")] {
62         impl PartialEq for pthread_attr_t {
63             fn eq(&self, other: &pthread_attr_t) -> bool {
64                 self.__sig == other.__sig
65                     && self.__opaque
66                     .iter()
67                     .zip(other.__opaque.iter())
68                     .all(|(a,b)| a == b)
69             }
70         }
71         impl Eq for pthread_attr_t {}
72         impl ::fmt::Debug for pthread_attr_t {
73             fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
74                 f.debug_struct("pthread_attr_t")
75                     .field("__sig", &self.__sig)
76                 // FIXME: .field("__opaque", &self.__opaque)
77                     .finish()
78             }
79         }
80         impl ::hash::Hash for pthread_attr_t {
81             fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
82                 self.__sig.hash(state);
83                 self.__opaque.hash(state);
84             }
85         }
86     }
87 }
88 
89 pub const __PTHREAD_MUTEX_SIZE__: usize = 56;
90 pub const __PTHREAD_COND_SIZE__: usize = 40;
91 pub const __PTHREAD_CONDATTR_SIZE__: usize = 8;
92 pub const __PTHREAD_RWLOCK_SIZE__: usize = 192;
93 pub const __PTHREAD_RWLOCKATTR_SIZE__: usize = 16;
94 
95 pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;
96 pub const TIOCDCDTIMESTAMP: ::c_ulong = 0x40107458;
97 
98 extern {
exchangedata(path1: *const ::c_char, path2: *const ::c_char, options: ::c_uint) -> ::c_int99     pub fn exchangedata(path1: *const ::c_char,
100                         path2: *const ::c_char,
101                         options: ::c_uint) -> ::c_int;
102 }
103