|
34 | 34 | pub sin_zero: [::int8_t; 8],
|
35 | 35 | }
|
36 | 36 |
|
37 |
| - pub struct dirent { |
38 |
| - pub d_fileno: ::ino_t, |
39 |
| - pub d_off: ::off_t, |
40 |
| - pub d_reclen: u16, |
41 |
| - pub d_type: u8, |
42 |
| - pub d_namlen: u8, |
43 |
| - __d_padding: [u8; 4], |
44 |
| - pub d_name: [::c_char; 256], |
45 |
| - } |
46 |
| - |
47 | 37 | pub struct glob_t {
|
48 | 38 | pub gl_pathc: ::c_int,
|
49 | 39 | pub gl_matchc: ::c_int,
|
@@ -116,45 +106,13 @@ s! {
|
116 | 106 | pub ai_next: *mut ::addrinfo,
|
117 | 107 | }
|
118 | 108 |
|
119 |
| - pub struct sockaddr_storage { |
120 |
| - pub ss_len: u8, |
121 |
| - pub ss_family: ::sa_family_t, |
122 |
| - __ss_pad1: [u8; 6], |
123 |
| - __ss_pad2: i64, |
124 |
| - __ss_pad3: [u8; 240], |
125 |
| - } |
126 |
| - |
127 |
| - pub struct siginfo_t { |
128 |
| - pub si_signo: ::c_int, |
129 |
| - pub si_code: ::c_int, |
130 |
| - pub si_errno: ::c_int, |
131 |
| - pub si_addr: *mut ::c_char, |
132 |
| - #[cfg(target_pointer_width = "32")] |
133 |
| - __pad: [u8; 112], |
134 |
| - #[cfg(target_pointer_width = "64")] |
135 |
| - __pad: [u8; 108], |
136 |
| - } |
137 |
| - |
138 | 109 | pub struct Dl_info {
|
139 | 110 | pub dli_fname: *const ::c_char,
|
140 | 111 | pub dli_fbase: *mut ::c_void,
|
141 | 112 | pub dli_sname: *const ::c_char,
|
142 | 113 | pub dli_saddr: *mut ::c_void,
|
143 | 114 | }
|
144 | 115 |
|
145 |
| - pub struct lastlog { |
146 |
| - ll_time: ::time_t, |
147 |
| - ll_line: [::c_char; UT_LINESIZE], |
148 |
| - ll_host: [::c_char; UT_HOSTSIZE], |
149 |
| - } |
150 |
| - |
151 |
| - pub struct utmp { |
152 |
| - pub ut_line: [::c_char; UT_LINESIZE], |
153 |
| - pub ut_name: [::c_char; UT_NAMESIZE], |
154 |
| - pub ut_host: [::c_char; UT_HOSTSIZE], |
155 |
| - pub ut_time: ::time_t, |
156 |
| - } |
157 |
| - |
158 | 116 | pub struct if_data {
|
159 | 117 | pub ifi_type: ::c_uchar,
|
160 | 118 | pub ifi_addrlen: ::c_uchar,
|
@@ -221,6 +179,231 @@ s! {
|
221 | 179 | }
|
222 | 180 | }
|
223 | 181 |
|
| 182 | +s_no_extra_traits! { |
| 183 | + pub struct dirent { |
| 184 | + pub d_fileno: ::ino_t, |
| 185 | + pub d_off: ::off_t, |
| 186 | + pub d_reclen: u16, |
| 187 | + pub d_type: u8, |
| 188 | + pub d_namlen: u8, |
| 189 | + __d_padding: [u8; 4], |
| 190 | + pub d_name: [::c_char; 256], |
| 191 | + } |
| 192 | + |
| 193 | + pub struct sockaddr_storage { |
| 194 | + pub ss_len: u8, |
| 195 | + pub ss_family: ::sa_family_t, |
| 196 | + __ss_pad1: [u8; 6], |
| 197 | + __ss_pad2: i64, |
| 198 | + __ss_pad3: [u8; 240], |
| 199 | + } |
| 200 | + |
| 201 | + pub struct siginfo_t { |
| 202 | + pub si_signo: ::c_int, |
| 203 | + pub si_code: ::c_int, |
| 204 | + pub si_errno: ::c_int, |
| 205 | + pub si_addr: *mut ::c_char, |
| 206 | + #[cfg(target_pointer_width = "32")] |
| 207 | + __pad: [u8; 112], |
| 208 | + #[cfg(target_pointer_width = "64")] |
| 209 | + __pad: [u8; 108], |
| 210 | + } |
| 211 | + |
| 212 | + pub struct lastlog { |
| 213 | + ll_time: ::time_t, |
| 214 | + ll_line: [::c_char; UT_LINESIZE], |
| 215 | + ll_host: [::c_char; UT_HOSTSIZE], |
| 216 | + } |
| 217 | + |
| 218 | + pub struct utmp { |
| 219 | + pub ut_line: [::c_char; UT_LINESIZE], |
| 220 | + pub ut_name: [::c_char; UT_NAMESIZE], |
| 221 | + pub ut_host: [::c_char; UT_HOSTSIZE], |
| 222 | + pub ut_time: ::time_t, |
| 223 | + } |
| 224 | +} |
| 225 | + |
| 226 | +#[cfg(feature = "extra_traits")] |
| 227 | +impl PartialEq for dirent { |
| 228 | + fn eq(&self, other: &dirent) -> bool { |
| 229 | + self.d_fileno == other.d_fileno |
| 230 | + && self.d_off == other.d_off |
| 231 | + && self.d_reclen == other.d_reclen |
| 232 | + && self.d_type == other.d_type |
| 233 | + && self.d_namlen == other.d_namlen |
| 234 | + && self |
| 235 | + .d_name |
| 236 | + .iter() |
| 237 | + .zip(other.d_name.iter()) |
| 238 | + .all(|(a,b)| a == b) |
| 239 | + } |
| 240 | +} |
| 241 | +#[cfg(feature = "extra_traits")] |
| 242 | +impl Eq for dirent {} |
| 243 | +#[cfg(feature = "extra_traits")] |
| 244 | +impl std::fmt::Debug for dirent { |
| 245 | + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
| 246 | + f.debug_struct("dirent") |
| 247 | + .field("d_fileno", &self.d_fileno) |
| 248 | + .field("d_off", &self.d_off) |
| 249 | + .field("d_reclen", &self.d_reclen) |
| 250 | + .field("d_type", &self.d_type) |
| 251 | + .field("d_namlen", &self.d_namlen) |
| 252 | + // FIXME: .field("d_name", &self.d_name) |
| 253 | + .finish() |
| 254 | + } |
| 255 | +} |
| 256 | +#[cfg(feature = "extra_traits")] |
| 257 | +impl std::hash::Hash for dirent { |
| 258 | + fn hash<H: std::hash::Hasher>(&self, state: &mut H) { |
| 259 | + self.d_fileno.hash(state); |
| 260 | + self.d_off.hash(state); |
| 261 | + self.d_reclen.hash(state); |
| 262 | + self.d_type.hash(state); |
| 263 | + self.d_namlen.hash(state); |
| 264 | + self.d_name.hash(state); |
| 265 | + } |
| 266 | +} |
| 267 | + |
| 268 | +#[cfg(feature = "extra_traits")] |
| 269 | +impl PartialEq for sockaddr_storage { |
| 270 | + fn eq(&self, other: &sockaddr_storage) -> bool { |
| 271 | + self.ss_len == other.ss_len |
| 272 | + && self.ss_family == other.ss_family |
| 273 | + } |
| 274 | +} |
| 275 | +#[cfg(feature = "extra_traits")] |
| 276 | +impl Eq for sockaddr_storage {} |
| 277 | +#[cfg(feature = "extra_traits")] |
| 278 | +impl std::fmt::Debug for sockaddr_storage { |
| 279 | + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
| 280 | + f.debug_struct("sockaddr_storage") |
| 281 | + .field("ss_len", &self.ss_len) |
| 282 | + .field("ss_family", &self.ss_family) |
| 283 | + .finish() |
| 284 | + } |
| 285 | +} |
| 286 | +#[cfg(feature = "extra_traits")] |
| 287 | +impl std::hash::Hash for sockaddr_storage { |
| 288 | + fn hash<H: std::hash::Hasher>(&self, state: &mut H) { |
| 289 | + self.ss_len.hash(state); |
| 290 | + self.ss_family.hash(state); |
| 291 | + } |
| 292 | +} |
| 293 | + |
| 294 | +#[cfg(feature = "extra_traits")] |
| 295 | +impl PartialEq for siginfo_t { |
| 296 | + fn eq(&self, other: &siginfo_t) -> bool { |
| 297 | + self.si_signo == other.si_signo |
| 298 | + && self.si_code == other.si_code |
| 299 | + && self.si_errno == other.si_errno |
| 300 | + && self.si_addr == other.si_addr |
| 301 | + } |
| 302 | +} |
| 303 | +#[cfg(feature = "extra_traits")] |
| 304 | +impl Eq for siginfo_t {} |
| 305 | +#[cfg(feature = "extra_traits")] |
| 306 | +impl std::fmt::Debug for siginfo_t { |
| 307 | + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
| 308 | + f.debug_struct("siginfo_t") |
| 309 | + .field("si_signo", &self.si_signo) |
| 310 | + .field("si_code", &self.si_code) |
| 311 | + .field("si_errno", &self.si_errno) |
| 312 | + .field("si_addr", &self.si_addr) |
| 313 | + .finish() |
| 314 | + } |
| 315 | +} |
| 316 | +#[cfg(feature = "extra_traits")] |
| 317 | +impl std::hash::Hash for siginfo_t { |
| 318 | + fn hash<H: std::hash::Hasher>(&self, state: &mut H) { |
| 319 | + self.si_signo.hash(state); |
| 320 | + self.si_code.hash(state); |
| 321 | + self.si_errno.hash(state); |
| 322 | + self.si_addr.hash(state); |
| 323 | + } |
| 324 | +} |
| 325 | + |
| 326 | +#[cfg(feature = "extra_traits")] |
| 327 | +impl PartialEq for lastlog { |
| 328 | + fn eq(&self, other: &lastlog) -> bool { |
| 329 | + self.ll_time == other.ll_time |
| 330 | + && self |
| 331 | + .ll_line |
| 332 | + .iter() |
| 333 | + .zip(other.ll_line.iter()) |
| 334 | + .all(|(a,b)| a == b) |
| 335 | + && self |
| 336 | + .ll_host |
| 337 | + .iter() |
| 338 | + .zip(other.ll_host.iter()) |
| 339 | + .all(|(a,b)| a == b) |
| 340 | + } |
| 341 | +} |
| 342 | +#[cfg(feature = "extra_traits")] |
| 343 | +impl Eq for lastlog {} |
| 344 | +#[cfg(feature = "extra_traits")] |
| 345 | +impl std::fmt::Debug for lastlog { |
| 346 | + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
| 347 | + f.debug_struct("lastlog") |
| 348 | + .field("ll_time", &self.ll_time) |
| 349 | + // FIXME: .field("ll_line", &self.ll_line) |
| 350 | + // FIXME: .field("ll_host", &self.ll_host) |
| 351 | + .finish() |
| 352 | + } |
| 353 | +} |
| 354 | +#[cfg(feature = "extra_traits")] |
| 355 | +impl std::hash::Hash for lastlog { |
| 356 | + fn hash<H: std::hash::Hasher>(&self, state: &mut H) { |
| 357 | + self.ll_time.hash(state); |
| 358 | + self.ll_line.hash(state); |
| 359 | + self.ll_host.hash(state); |
| 360 | + } |
| 361 | +} |
| 362 | + |
| 363 | +#[cfg(feature = "extra_traits")] |
| 364 | +impl PartialEq for utmp { |
| 365 | + fn eq(&self, other: &utmp) -> bool { |
| 366 | + self.ut_time == other.ut_time |
| 367 | + && self |
| 368 | + .ut_line |
| 369 | + .iter() |
| 370 | + .zip(other.ut_line.iter()) |
| 371 | + .all(|(a,b)| a == b) |
| 372 | + && self |
| 373 | + .ut_name |
| 374 | + .iter() |
| 375 | + .zip(other.ut_name.iter()) |
| 376 | + .all(|(a,b)| a == b) |
| 377 | + && self |
| 378 | + .ut_host |
| 379 | + .iter() |
| 380 | + .zip(other.ut_host.iter()) |
| 381 | + .all(|(a,b)| a == b) |
| 382 | + } |
| 383 | +} |
| 384 | +#[cfg(feature = "extra_traits")] |
| 385 | +impl Eq for utmp {} |
| 386 | +#[cfg(feature = "extra_traits")] |
| 387 | +impl std::fmt::Debug for utmp { |
| 388 | + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
| 389 | + f.debug_struct("utmp") |
| 390 | + // FIXME: .field("ut_line", &self.ut_line) |
| 391 | + // FIXME: .field("ut_name", &self.ut_name) |
| 392 | + // FIXME: .field("ut_host", &self.ut_host) |
| 393 | + .field("ut_time", &self.ut_time) |
| 394 | + .finish() |
| 395 | + } |
| 396 | +} |
| 397 | +#[cfg(feature = "extra_traits")] |
| 398 | +impl std::hash::Hash for utmp { |
| 399 | + fn hash<H: std::hash::Hasher>(&self, state: &mut H) { |
| 400 | + self.ut_line.hash(state); |
| 401 | + self.ut_name.hash(state); |
| 402 | + self.ut_host.hash(state); |
| 403 | + self.ut_time.hash(state); |
| 404 | + } |
| 405 | +} |
| 406 | + |
224 | 407 | pub const UT_NAMESIZE: usize = 32;
|
225 | 408 | pub const UT_LINESIZE: usize = 8;
|
226 | 409 | pub const UT_HOSTSIZE: usize = 256;
|
|
0 commit comments