Debian Codegraph @

third_party/rust/libc/src/unix/bsd/apple/b64/mod.rs

raw
1 //! 64-bit specific Apple (ios/darwin) definitions
2
3 use crate::prelude::*;
4
5 s! {
6 pub struct timeval32 {
7 pub tv_sec: i32,
8 pub tv_usec: i32,
9 }
10
11 pub struct if_data {
12 pub ifi_type: c_uchar,
13 pub ifi_typelen: c_uchar,
14 pub ifi_physical: c_uchar,
15 pub ifi_addrlen: c_uchar,
16 pub ifi_hdrlen: c_uchar,
17 pub ifi_recvquota: c_uchar,
18 pub ifi_xmitquota: c_uchar,
19 pub ifi_unused1: c_uchar,
20 pub ifi_mtu: u32,
21 pub ifi_metric: u32,
22 pub ifi_baudrate: u32,
23 pub ifi_ipackets: u32,
24 pub ifi_ierrors: u32,
25 pub ifi_opackets: u32,
26 pub ifi_oerrors: u32,
27 pub ifi_collisions: u32,
28 pub ifi_ibytes: u32,
29 pub ifi_obytes: u32,
30 pub ifi_imcasts: u32,
31 pub ifi_omcasts: u32,
32 pub ifi_iqdrops: u32,
33 pub ifi_noproto: u32,
34 pub ifi_recvtiming: u32,
35 pub ifi_xmittiming: u32,
36 pub ifi_lastchange: timeval32,
37 pub ifi_unused2: u32,
38 pub ifi_hwassist: u32,
39 pub ifi_reserved1: u32,
40 pub ifi_reserved2: u32,
41 }
42
43 pub struct bpf_hdr {
44 pub bh_tstamp: crate::timeval32,
45 pub bh_caplen: u32,
46 pub bh_datalen: u32,
47 pub bh_hdrlen: c_ushort,
48 }
49 }
50
51 s_no_extra_traits! {
52 pub struct pthread_attr_t {
53 __sig: c_long,
54 __opaque: [c_char; 56],
55 }
56
57 pub struct pthread_once_t {
58 __sig: c_long,
59 __opaque: [c_char; __PTHREAD_ONCE_SIZE__],
60 }
61 }
62
63 cfg_if! {
64 if #[cfg(feature = "extra_traits")] {
65 impl PartialEq for pthread_attr_t {
66 fn eq(&self, other: &pthread_attr_t) -> bool {
67 self.__sig == other.__sig
68 && self
69 .__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(debug): .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
94 .__opaque
95 .iter()
96 .zip(other.__opaque.iter())
97 .all(|(a, b)| a == b)
98 }
99 }
100 impl Eq for pthread_once_t {}
101 impl fmt::Debug for pthread_once_t {
102 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
103 f.debug_struct("pthread_once_t")
104 .field("__sig", &self.__sig)
105 .finish()
106 }
107 }
108 impl hash::Hash for pthread_once_t {
109 fn hash<H: hash::Hasher>(&self, state: &mut H) {
110 self.__sig.hash(state);
111 self.__opaque.hash(state);
112 }
113 }
114 }
115 }
116
117 #[doc(hidden)]
118 #[deprecated(since = "0.2.55")]
119 pub const NET_RT_MAXID: c_int = 11;
120
121 pub const __PTHREAD_MUTEX_SIZE__: usize = 56;
122 pub const __PTHREAD_COND_SIZE__: usize = 40;
123 pub const __PTHREAD_CONDATTR_SIZE__: usize = 8;
124 pub const __PTHREAD_ONCE_SIZE__: usize = 8;
125 pub const __PTHREAD_RWLOCK_SIZE__: usize = 192;
126 pub const __PTHREAD_RWLOCKATTR_SIZE__: usize = 16;
127
128 pub const TIOCTIMESTAMP: c_ulong = 0x40107459;
129 pub const TIOCDCDTIMESTAMP: c_ulong = 0x40107458;
130
131 pub const BIOCSETF: c_ulong = 0x80104267;
132 pub const BIOCSRTIMEOUT: c_ulong = 0x8010426d;
133 pub const BIOCGRTIMEOUT: c_ulong = 0x4010426e;
134 pub const BIOCSETFNR: c_ulong = 0x8010427e;
135
136 const _PTHREAD_ONCE_SIG_INIT: c_long = 0x30B1BCBA;
137 pub const PTHREAD_ONCE_INIT: crate::pthread_once_t = crate::pthread_once_t {
138 __sig: _PTHREAD_ONCE_SIG_INIT,
139 __opaque: [0; 8],
140 };
141
142 extern "C" {
143 pub fn exchangedata(path1: *const c_char, path2: *const c_char, options: c_uint) -> c_int;
144 }
145
146 cfg_if! {
147 if #[cfg(target_arch = "x86_64")] {
148 mod x86_64;
149 pub use self::x86_64::*;
150 } else if #[cfg(target_arch = "aarch64")] {
151 mod aarch64;
152 pub use self::aarch64::*;
153 } else {
154 // Unknown target_arch
155 }
156 }