]>
Commit | Line | Data |
---|---|---|
353b0b11 FG |
1 | pub type c_long = i64; |
2 | pub type c_ulong = u64; | |
3 | ||
4 | s! { | |
5 | pub struct sigset_t { | |
6 | pub ss_set: [c_ulong; 4], | |
7 | } | |
8 | ||
9 | pub struct fd_set { | |
10 | pub fds_bits: [c_long; 1024], | |
11 | } | |
12 | ||
13 | pub struct flock { | |
14 | pub l_type: ::c_short, | |
15 | pub l_whence: ::c_short, | |
16 | pub l_sysid: ::c_uint, | |
17 | pub l_pid: ::pid_t, | |
18 | pub l_vfs: ::c_int, | |
19 | pub l_start: ::off_t, | |
20 | pub l_len: ::off_t, | |
21 | } | |
22 | ||
23 | pub struct statvfs { | |
24 | pub f_bsize: ::c_ulong, | |
25 | pub f_frsize: ::c_ulong, | |
26 | pub f_blocks: ::fsblkcnt_t, | |
27 | pub f_bfree: ::fsblkcnt_t, | |
28 | pub f_bavail: ::fsblkcnt_t, | |
29 | pub f_files: ::fsfilcnt_t, | |
30 | pub f_ffree: ::fsfilcnt_t, | |
31 | pub f_favail: ::fsfilcnt_t, | |
32 | pub f_fsid: ::c_ulong, | |
33 | pub f_basetype: [::c_char; 16], | |
34 | pub f_flag: ::c_ulong, | |
35 | pub f_namemax: ::c_ulong, | |
36 | pub f_fstr: [::c_char; 32], | |
37 | pub f_filler: [::c_ulong; 16] | |
38 | } | |
39 | ||
40 | pub struct pthread_rwlock_t { | |
41 | __rw_word: [::c_long; 10], | |
42 | } | |
43 | ||
44 | pub struct pthread_cond_t { | |
45 | __cv_word: [::c_long; 6], | |
46 | } | |
47 | ||
48 | pub struct pthread_mutex_t { | |
49 | __mt_word: [::c_long; 8], | |
50 | } | |
51 | ||
52 | pub struct stat { | |
53 | pub st_dev: ::dev_t, | |
54 | pub st_ino: ::ino_t, | |
55 | pub st_mode: ::mode_t, | |
56 | pub st_nlink: ::nlink_t, | |
57 | pub st_flag: ::c_ushort, | |
58 | pub st_uid: ::uid_t, | |
59 | pub st_gid: ::gid_t, | |
60 | pub st_rdev: ::dev_t, | |
61 | pub st_ssize: ::c_int, | |
62 | pub st_atime: ::st_timespec, | |
63 | pub st_mtime: ::st_timespec, | |
64 | pub st_ctime: ::st_timespec, | |
65 | pub st_blksize: ::blksize_t, | |
66 | pub st_blocks: ::blkcnt_t, | |
67 | pub st_vfstype: ::c_int, | |
68 | pub st_vfs: ::c_uint, | |
69 | pub st_type: ::c_uint, | |
70 | pub st_gen: ::c_uint, | |
71 | pub st_reserved: [::c_uint; 9], | |
72 | pub st_padto_ll: ::c_uint, | |
73 | pub st_size: ::off_t, | |
74 | } | |
75 | ||
76 | pub struct statfs { | |
77 | pub f_version: ::c_int, | |
78 | pub f_type: ::c_int, | |
79 | pub f_bsize: ::c_ulong, | |
80 | pub f_blocks: ::fsblkcnt_t, | |
81 | pub f_bfree: ::fsblkcnt_t, | |
82 | pub f_bavail: ::fsblkcnt_t, | |
83 | pub f_files: ::fsblkcnt_t, | |
84 | pub f_ffree: ::fsblkcnt_t, | |
85 | pub f_fsid: ::fsid64_t, | |
86 | pub f_vfstype: ::c_int, | |
87 | pub f_fsize: ::c_ulong, | |
88 | pub f_vfsnumber: ::c_int, | |
89 | pub f_vfsoff: ::c_int, | |
90 | pub f_vfslen: ::c_int, | |
91 | pub f_vfsvers: ::c_int, | |
92 | pub f_fname: [::c_char; 32], | |
93 | pub f_fpack: [::c_char; 32], | |
94 | pub f_name_max: ::c_int, | |
95 | } | |
353b0b11 | 96 | |
49aad941 FG |
97 | pub struct aiocb { |
98 | pub aio_lio_opcode: ::c_int, | |
99 | pub aio_fildes: ::c_int, | |
100 | pub aio_word1: ::c_int, | |
101 | pub aio_offset: ::off_t, | |
102 | pub aio_buf: *mut ::c_void, | |
103 | pub aio_return: ::ssize_t, | |
104 | pub aio_errno: ::c_int, | |
105 | pub aio_nbytes: ::size_t, | |
106 | pub aio_reqprio: ::c_int, | |
107 | pub aio_sigevent: ::sigevent, | |
108 | pub aio_word2: ::c_int, | |
109 | pub aio_fp: ::c_int, | |
110 | pub aio_handle: *mut aiocb, | |
111 | pub aio_reserved: [::c_uint; 2], | |
112 | pub aio_sigev_tid: c_long, | |
113 | } | |
114 | ||
115 | pub struct ucontext_t { | |
116 | pub __sc_onstack: ::c_int, | |
117 | pub uc_sigmask: ::sigset_t, | |
118 | pub __sc_uerror: ::c_int, | |
119 | pub uc_mcontext: ::mcontext_t, | |
120 | pub uc_link: *mut ucontext_t, | |
121 | pub uc_stack: ::stack_t, | |
122 | // Should be pointer to __extctx_t | |
123 | pub __extctx: *mut ::c_void, | |
124 | pub __extctx_magic: ::c_int, | |
125 | pub __pad: [::c_int; 1], | |
126 | } | |
127 | ||
128 | pub struct mcontext_t { | |
129 | pub gpr: [::c_ulonglong; 32], | |
130 | pub msr: ::c_ulonglong, | |
131 | pub iar: ::c_ulonglong, | |
132 | pub lr: ::c_ulonglong, | |
133 | pub ctr: ::c_ulonglong, | |
134 | pub cr: ::c_uint, | |
135 | pub xer: ::c_uint, | |
136 | pub fpscr: ::c_uint, | |
137 | pub fpscrx: ::c_uint, | |
138 | pub except: [::c_ulonglong; 1], | |
139 | // Should be array of double type | |
140 | pub fpr: [::uint64_t; 32], | |
141 | pub fpeu: ::c_char, | |
142 | pub fpinfo: ::c_char, | |
143 | pub fpscr24_31: ::c_char, | |
144 | pub pad: [::c_char; 1], | |
145 | pub excp_type: ::c_int, | |
146 | } | |
147 | ||
148 | pub struct utmpx { | |
149 | pub ut_user: [::c_char; 256], | |
150 | pub ut_id: [::c_char; 14], | |
151 | pub ut_line: [::c_char; 64], | |
152 | pub ut_pid: ::pid_t, | |
153 | pub ut_type: ::c_short, | |
154 | pub ut_tv: ::timeval, | |
155 | pub ut_host: [::c_char; 256], | |
156 | pub __dbl_word_pad: ::c_int, | |
157 | pub __reservedA: [::c_int; 2], | |
158 | pub __reservedV: [::c_int; 6], | |
159 | } | |
160 | ||
161 | pub struct pthread_spinlock_t { | |
162 | pub __sp_word: [::c_long; 3], | |
163 | } | |
164 | ||
165 | pub struct pthread_barrier_t { | |
166 | pub __br_word: [::c_long; 5], | |
167 | } | |
168 | ||
169 | pub struct msqid_ds { | |
170 | pub msg_perm: ::ipc_perm, | |
171 | pub msg_first: ::c_uint, | |
172 | pub msg_last: ::c_uint, | |
173 | pub msg_cbytes: ::c_uint, | |
174 | pub msg_qnum: ::c_uint, | |
175 | pub msg_qbytes: ::c_ulong, | |
176 | pub msg_lspid: ::pid_t, | |
177 | pub msg_lrpid: ::pid_t, | |
178 | pub msg_stime: ::time_t, | |
179 | pub msg_rtime: ::time_t, | |
180 | pub msg_ctime: ::time_t, | |
181 | pub msg_rwait: ::c_int, | |
182 | pub msg_wwait: ::c_int, | |
183 | pub msg_reqevents: ::c_ushort, | |
353b0b11 | 184 | } |
49aad941 | 185 | } |
353b0b11 | 186 | |
49aad941 | 187 | s_no_extra_traits! { |
353b0b11 FG |
188 | pub struct siginfo_t { |
189 | pub si_signo: ::c_int, | |
190 | pub si_errno: ::c_int, | |
191 | pub si_code: ::c_int, | |
192 | pub si_pid: ::pid_t, | |
193 | pub si_uid: ::uid_t, | |
194 | pub si_status: ::c_int, | |
195 | pub si_addr: *mut ::c_void, | |
196 | pub si_band: ::c_long, | |
49aad941 | 197 | pub si_value: ::sigval, |
353b0b11 FG |
198 | pub __si_flags: ::c_int, |
199 | pub __pad: [::c_int; 3], | |
200 | } | |
201 | ||
202 | #[cfg(libc_union)] | |
203 | pub union _kernel_simple_lock { | |
204 | pub _slock: ::c_long, | |
205 | // Should be pointer to 'lock_data_instrumented' | |
206 | pub _slockp: *mut ::c_void, | |
207 | } | |
208 | ||
209 | pub struct fileops_t { | |
210 | pub fo_rw: extern fn(file: *mut file, rw: ::uio_rw, io: *mut ::c_void, ext: ::c_long, | |
211 | secattr: *mut ::c_void) -> ::c_int, | |
212 | pub fo_ioctl: extern fn(file: *mut file, a: ::c_long, b: ::caddr_t, c: ::c_long, | |
213 | d: ::c_long) -> ::c_int, | |
214 | pub fo_select: extern fn(file: *mut file, a: ::c_int, b: *mut ::c_ushort, | |
215 | c: extern fn()) -> ::c_int, | |
216 | pub fo_close: extern fn(file: *mut file) -> ::c_int, | |
217 | pub fo_fstat: extern fn(file: *mut file, sstat: *mut ::stat) -> ::c_int, | |
218 | } | |
219 | ||
220 | pub struct file { | |
221 | pub f_flag: ::c_long, | |
222 | pub f_count: ::c_int, | |
223 | pub f_options: ::c_short, | |
224 | pub f_type: ::c_short, | |
225 | // Should be pointer to 'vnode' | |
226 | pub f_data: *mut ::c_void, | |
227 | pub f_offset: ::c_longlong, | |
228 | pub f_dir_off: ::c_long, | |
229 | // Should be pointer to 'cred' | |
230 | pub f_cred: *mut ::c_void, | |
231 | #[cfg(libc_union)] | |
232 | pub f_lock: _kernel_simple_lock, | |
233 | #[cfg(libc_union)] | |
234 | pub f_offset_lock: _kernel_simple_lock, | |
235 | pub f_vinfo: ::caddr_t, | |
236 | pub f_ops: *mut fileops_t, | |
237 | pub f_parentp: ::caddr_t, | |
238 | pub f_fnamep: ::caddr_t, | |
239 | pub f_fdata: [::c_char; 160], | |
240 | } | |
241 | ||
242 | #[cfg(libc_union)] | |
243 | pub union __ld_info_file { | |
244 | pub _ldinfo_fd: ::c_int, | |
245 | pub _ldinfo_fp: *mut file, | |
246 | pub _core_offset: ::c_long, | |
247 | } | |
248 | ||
249 | pub struct ld_info { | |
250 | pub ldinfo_next: ::c_uint, | |
251 | pub ldinfo_flags: ::c_uint, | |
252 | #[cfg(libc_union)] | |
253 | pub _file: __ld_info_file, | |
254 | pub ldinfo_textorg: *mut ::c_void, | |
255 | pub ldinfo_textsize: ::c_ulong, | |
256 | pub ldinfo_dataorg: *mut ::c_void, | |
257 | pub ldinfo_datasize: ::c_ulong, | |
258 | pub ldinfo_filename: [::c_char; 2], | |
259 | } | |
260 | ||
261 | #[cfg(libc_union)] | |
262 | pub union __pollfd_ext_u { | |
263 | pub addr: *mut ::c_void, | |
264 | pub data32: u32, | |
265 | pub data: u64, | |
266 | } | |
267 | ||
268 | pub struct pollfd_ext { | |
269 | pub fd: ::c_int, | |
270 | pub events: ::c_ushort, | |
271 | pub revents: ::c_ushort, | |
272 | #[cfg(libc_union)] | |
273 | pub data: __pollfd_ext_u, | |
274 | } | |
275 | } | |
276 | ||
49aad941 FG |
277 | impl siginfo_t { |
278 | pub unsafe fn si_addr(&self) -> *mut ::c_void { | |
279 | self.si_addr | |
280 | } | |
281 | ||
282 | pub unsafe fn si_value(&self) -> ::sigval { | |
283 | self.si_value | |
284 | } | |
285 | ||
286 | pub unsafe fn si_pid(&self) -> ::pid_t { | |
287 | self.si_pid | |
288 | } | |
289 | ||
290 | pub unsafe fn si_uid(&self) -> ::uid_t { | |
291 | self.si_uid | |
292 | } | |
293 | ||
294 | pub unsafe fn si_status(&self) -> ::c_int { | |
295 | self.si_status | |
296 | } | |
297 | } | |
298 | ||
353b0b11 FG |
299 | cfg_if! { |
300 | if #[cfg(feature = "extra_traits")] { | |
353b0b11 FG |
301 | impl PartialEq for siginfo_t { |
302 | fn eq(&self, other: &siginfo_t) -> bool { | |
303 | #[cfg(libc_union)] | |
304 | let value_eq = self.si_value == other.si_value; | |
305 | #[cfg(not(libc_union))] | |
306 | let value_eq = true; | |
307 | self.si_signo == other.si_signo | |
308 | && self.si_errno == other.si_errno | |
309 | && self.si_code == other.si_code | |
310 | && self.si_pid == other.si_pid | |
311 | && self.si_uid == other.si_uid | |
312 | && self.si_status == other.si_status | |
313 | && self.si_addr == other.si_addr | |
314 | && self.si_band == other.si_band | |
315 | && self.__si_flags == other.__si_flags | |
316 | && value_eq | |
317 | } | |
318 | } | |
319 | impl Eq for siginfo_t {} | |
320 | impl ::fmt::Debug for siginfo_t { | |
321 | fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { | |
322 | let mut struct_formatter = f.debug_struct("siginfo_t"); | |
323 | struct_formatter.field("si_signo", &self.si_signo); | |
324 | struct_formatter.field("si_errno", &self.si_errno); | |
325 | struct_formatter.field("si_code", &self.si_code); | |
326 | struct_formatter.field("si_pid", &self.si_pid); | |
327 | struct_formatter.field("si_uid", &self.si_uid); | |
328 | struct_formatter.field("si_status", &self.si_status); | |
329 | struct_formatter.field("si_addr", &self.si_addr); | |
330 | struct_formatter.field("si_band", &self.si_band); | |
331 | #[cfg(libc_union)] | |
332 | struct_formatter.field("si_value", &self.si_value); | |
333 | struct_formatter.field("__si_flags", &self.__si_flags); | |
334 | struct_formatter.finish() | |
335 | } | |
336 | } | |
337 | impl ::hash::Hash for siginfo_t { | |
338 | fn hash<H: ::hash::Hasher>(&self, state: &mut H) { | |
339 | self.si_signo.hash(state); | |
340 | self.si_errno.hash(state); | |
341 | self.si_code.hash(state); | |
342 | self.si_pid.hash(state); | |
343 | self.si_uid.hash(state); | |
344 | self.si_status.hash(state); | |
345 | self.si_addr.hash(state); | |
346 | self.si_band.hash(state); | |
347 | #[cfg(libc_union)] | |
348 | self.si_value.hash(state); | |
349 | self.__si_flags.hash(state); | |
350 | } | |
351 | } | |
352 | ||
353 | #[cfg(libc_union)] | |
354 | impl PartialEq for _kernel_simple_lock { | |
355 | fn eq(&self, other: &_kernel_simple_lock) -> bool { | |
356 | unsafe { | |
357 | self._slock == other._slock | |
358 | && self._slockp == other._slockp | |
359 | } | |
360 | } | |
361 | } | |
362 | #[cfg(libc_union)] | |
363 | impl Eq for _kernel_simple_lock {} | |
364 | #[cfg(libc_union)] | |
365 | impl ::fmt::Debug for _kernel_simple_lock { | |
366 | fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { | |
49aad941 | 367 | f.debug_struct("_kernel_simple_lock") |
353b0b11 FG |
368 | .field("_slock", unsafe { &self._slock }) |
369 | .field("_slockp", unsafe { &self._slockp }) | |
370 | .finish() | |
371 | } | |
372 | } | |
373 | #[cfg(libc_union)] | |
374 | impl ::hash::Hash for _kernel_simple_lock { | |
375 | fn hash<H: ::hash::Hasher>(&self, state: &mut H) { | |
376 | unsafe { | |
377 | self._slock.hash(state); | |
378 | self._slockp.hash(state); | |
379 | } | |
380 | } | |
381 | } | |
382 | ||
383 | impl PartialEq for fileops_t { | |
384 | fn eq(&self, other: &fileops_t) -> bool { | |
385 | self.fo_rw == other.fo_rw | |
386 | && self.fo_ioctl == other.fo_ioctl | |
387 | && self.fo_select == other.fo_select | |
388 | && self.fo_close == other.fo_close | |
389 | && self.fo_fstat == other.fo_fstat | |
390 | } | |
391 | } | |
392 | impl Eq for fileops_t {} | |
393 | impl ::fmt::Debug for fileops_t { | |
394 | fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { | |
395 | let mut struct_formatter = f.debug_struct("fileops_t"); | |
396 | struct_formatter.field("fo_rw", &self.fo_rw); | |
397 | struct_formatter.field("fo_ioctl", &self.fo_ioctl); | |
398 | struct_formatter.field("fo_select", &self.fo_select); | |
399 | struct_formatter.field("fo_close", &self.fo_close); | |
400 | struct_formatter.field("fo_fstat", &self.fo_fstat); | |
401 | struct_formatter.finish() | |
402 | } | |
403 | } | |
404 | impl ::hash::Hash for fileops_t { | |
405 | fn hash<H: ::hash::Hasher>(&self, state: &mut H) { | |
406 | self.fo_rw.hash(state); | |
407 | self.fo_ioctl.hash(state); | |
408 | self.fo_select.hash(state); | |
409 | self.fo_close.hash(state); | |
410 | self.fo_fstat.hash(state); | |
411 | } | |
412 | } | |
413 | ||
414 | impl PartialEq for file { | |
415 | fn eq(&self, other: &file) -> bool { | |
416 | #[cfg(libc_union)] | |
417 | let lock_eq = self.f_lock == other.f_lock | |
418 | && self.f_offset_lock == other.f_offset_lock; | |
419 | #[cfg(not(libc_union))] | |
420 | let lock_eq = true; | |
421 | self.f_flag == other.f_flag | |
422 | && self.f_count == other.f_count | |
423 | && self.f_options == other.f_options | |
424 | && self.f_type == other.f_type | |
425 | && self.f_data == other.f_data | |
426 | && self.f_offset == other.f_offset | |
427 | && self.f_dir_off == other.f_dir_off | |
428 | && self.f_cred == other.f_cred | |
429 | && self.f_vinfo == other.f_vinfo | |
430 | && self.f_ops == other.f_ops | |
431 | && self.f_parentp == other.f_parentp | |
432 | && self.f_fnamep == other.f_fnamep | |
433 | && self.f_fdata == other.f_fdata | |
434 | && lock_eq | |
435 | } | |
436 | } | |
437 | impl Eq for file {} | |
438 | impl ::fmt::Debug for file { | |
439 | fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { | |
440 | let mut struct_formatter = f.debug_struct("file"); | |
441 | struct_formatter.field("f_flag", &self.f_flag); | |
442 | struct_formatter.field("f_count", &self.f_count); | |
443 | struct_formatter.field("f_options", &self.f_options); | |
444 | struct_formatter.field("f_type", &self.f_type); | |
445 | struct_formatter.field("f_data", &self.f_data); | |
446 | struct_formatter.field("f_offset", &self.f_offset); | |
447 | struct_formatter.field("f_dir_off", &self.f_dir_off); | |
448 | struct_formatter.field("f_cred", &self.f_cred); | |
449 | #[cfg(libc_union)] | |
450 | struct_formatter.field("f_lock", &self.f_lock); | |
451 | #[cfg(libc_union)] | |
452 | struct_formatter.field("f_offset_lock", &self.f_offset_lock); | |
453 | struct_formatter.field("f_vinfo", &self.f_vinfo); | |
454 | struct_formatter.field("f_ops", &self.f_ops); | |
455 | struct_formatter.field("f_parentp", &self.f_parentp); | |
456 | struct_formatter.field("f_fnamep", &self.f_fnamep); | |
457 | struct_formatter.field("f_fdata", &self.f_fdata); | |
458 | struct_formatter.finish() | |
459 | } | |
460 | } | |
461 | impl ::hash::Hash for file { | |
462 | fn hash<H: ::hash::Hasher>(&self, state: &mut H) { | |
463 | self.f_flag.hash(state); | |
464 | self.f_count.hash(state); | |
465 | self.f_options.hash(state); | |
466 | self.f_type.hash(state); | |
467 | self.f_data.hash(state); | |
468 | self.f_offset.hash(state); | |
469 | self.f_dir_off.hash(state); | |
470 | self.f_cred.hash(state); | |
471 | #[cfg(libc_union)] | |
472 | self.f_lock.hash(state); | |
473 | #[cfg(libc_union)] | |
474 | self.f_offset_lock.hash(state); | |
475 | self.f_vinfo.hash(state); | |
476 | self.f_ops.hash(state); | |
477 | self.f_parentp.hash(state); | |
478 | self.f_fnamep.hash(state); | |
479 | self.f_fdata.hash(state); | |
480 | } | |
481 | } | |
482 | ||
483 | #[cfg(libc_union)] | |
484 | impl PartialEq for __ld_info_file { | |
485 | fn eq(&self, other: &__ld_info_file) -> bool { | |
486 | unsafe { | |
487 | self._ldinfo_fd == other._ldinfo_fd | |
488 | && self._ldinfo_fp == other._ldinfo_fp | |
489 | && self._core_offset == other._core_offset | |
490 | } | |
491 | } | |
492 | } | |
493 | #[cfg(libc_union)] | |
494 | impl Eq for __ld_info_file {} | |
495 | #[cfg(libc_union)] | |
496 | impl ::fmt::Debug for __ld_info_file { | |
497 | fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { | |
498 | f.debug_struct("__ld_info_file") | |
499 | .field("_ldinfo_fd", unsafe { &self._ldinfo_fd }) | |
500 | .field("_ldinfo_fp", unsafe { &self._ldinfo_fp }) | |
501 | .field("_core_offset", unsafe { &self._core_offset }) | |
502 | .finish() | |
503 | } | |
504 | } | |
505 | #[cfg(libc_union)] | |
506 | impl ::hash::Hash for __ld_info_file { | |
507 | fn hash<H: ::hash::Hasher>(&self, state: &mut H) { | |
508 | unsafe { | |
509 | self._ldinfo_fd.hash(state); | |
510 | self._ldinfo_fp.hash(state); | |
511 | self._core_offset.hash(state); | |
512 | } | |
513 | } | |
514 | } | |
515 | ||
516 | impl PartialEq for ld_info { | |
517 | fn eq(&self, other: &ld_info) -> bool { | |
518 | #[cfg(libc_union)] | |
519 | let file_eq = self._file == other._file; | |
520 | #[cfg(not(libc_union))] | |
521 | let file_eq = true; | |
522 | self.ldinfo_next == other.ldinfo_next | |
523 | && self.ldinfo_flags == other.ldinfo_flags | |
524 | && self.ldinfo_textorg == other.ldinfo_textorg | |
525 | && self.ldinfo_textsize == other.ldinfo_textsize | |
526 | && self.ldinfo_dataorg == other.ldinfo_dataorg | |
527 | && self.ldinfo_datasize == other.ldinfo_datasize | |
528 | && self.ldinfo_filename == other.ldinfo_filename | |
529 | && file_eq | |
530 | } | |
531 | } | |
532 | impl Eq for ld_info {} | |
533 | impl ::fmt::Debug for ld_info { | |
534 | fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { | |
535 | let mut struct_formatter = f.debug_struct("ld_info"); | |
536 | struct_formatter.field("ldinfo_next", &self.ldinfo_next); | |
537 | struct_formatter.field("ldinfo_flags", &self.ldinfo_flags); | |
538 | struct_formatter.field("ldinfo_textorg", &self.ldinfo_textorg); | |
539 | struct_formatter.field("ldinfo_textsize", &self.ldinfo_textsize); | |
540 | struct_formatter.field("ldinfo_dataorg", &self.ldinfo_dataorg); | |
541 | struct_formatter.field("ldinfo_datasize", &self.ldinfo_datasize); | |
542 | struct_formatter.field("ldinfo_filename", &self.ldinfo_filename); | |
543 | #[cfg(libc_union)] | |
544 | struct_formatter.field("_file", &self._file); | |
545 | struct_formatter.finish() | |
546 | } | |
547 | } | |
548 | impl ::hash::Hash for ld_info { | |
549 | fn hash<H: ::hash::Hasher>(&self, state: &mut H) { | |
550 | self.ldinfo_next.hash(state); | |
551 | self.ldinfo_flags.hash(state); | |
552 | self.ldinfo_textorg.hash(state); | |
553 | self.ldinfo_textsize.hash(state); | |
554 | self.ldinfo_dataorg.hash(state); | |
555 | self.ldinfo_datasize.hash(state); | |
556 | self.ldinfo_filename.hash(state); | |
557 | #[cfg(libc_union)] | |
558 | self._file.hash(state); | |
559 | } | |
560 | } | |
561 | ||
562 | #[cfg(libc_union)] | |
563 | impl PartialEq for __pollfd_ext_u { | |
564 | fn eq(&self, other: &__pollfd_ext_u) -> bool { | |
565 | unsafe { | |
566 | self.addr == other.addr | |
567 | && self.data32 == other.data32 | |
568 | && self.data == other.data | |
569 | } | |
570 | } | |
571 | } | |
572 | #[cfg(libc_union)] | |
573 | impl Eq for __pollfd_ext_u {} | |
574 | #[cfg(libc_union)] | |
575 | impl ::fmt::Debug for __pollfd_ext_u { | |
576 | fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { | |
577 | f.debug_struct("__pollfd_ext_u") | |
578 | .field("addr", unsafe { &self.addr }) | |
579 | .field("data32", unsafe { &self.data32 }) | |
580 | .field("data", unsafe { &self.data }) | |
581 | .finish() | |
582 | } | |
583 | } | |
584 | #[cfg(libc_union)] | |
585 | impl ::hash::Hash for __pollfd_ext_u { | |
586 | fn hash<H: ::hash::Hasher>(&self, state: &mut H) { | |
587 | unsafe { | |
588 | self.addr.hash(state); | |
589 | self.data.hash(state); | |
590 | self.data32.hash(state); | |
591 | } | |
592 | } | |
593 | } | |
594 | ||
595 | impl PartialEq for pollfd_ext { | |
596 | fn eq(&self, other: &pollfd_ext) -> bool { | |
597 | #[cfg(libc_union)] | |
598 | let data_eq = self.data == other.data; | |
599 | #[cfg(not(libc_union))] | |
600 | let data_eq = true; | |
601 | self.fd == other.fd | |
602 | && self.events == other.events | |
603 | && self.revents == other.revents | |
604 | && data_eq | |
605 | } | |
606 | } | |
607 | impl Eq for pollfd_ext {} | |
608 | impl ::fmt::Debug for pollfd_ext { | |
609 | fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { | |
610 | let mut struct_formatter = f.debug_struct("pollfd_ext"); | |
611 | struct_formatter.field("fd", &self.fd); | |
612 | struct_formatter.field("events", &self.events); | |
613 | struct_formatter.field("revents", &self.revents); | |
614 | #[cfg(libc_union)] | |
615 | struct_formatter.field("data", &self.data); | |
616 | struct_formatter.finish() | |
617 | } | |
618 | } | |
619 | impl ::hash::Hash for pollfd_ext { | |
620 | fn hash<H: ::hash::Hasher>(&self, state: &mut H) { | |
621 | self.fd.hash(state); | |
622 | self.events.hash(state); | |
623 | self.revents.hash(state); | |
624 | #[cfg(libc_union)] | |
625 | self.data.hash(state); | |
626 | } | |
627 | } | |
628 | } | |
629 | } | |
630 | ||
631 | pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { | |
632 | __mt_word: [0, 2, 0, 0, 0, 0, 0, 0], | |
633 | }; | |
634 | pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { | |
635 | __cv_word: [0, 0, 0, 0, 2, 0], | |
636 | }; | |
637 | pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { | |
638 | __rw_word: [2, 0, 0, 0, 0, 0, 0, 0, 0, 0], | |
639 | }; | |
640 | pub const RLIM_INFINITY: ::c_ulong = 0x7fffffffffffffff; | |
641 | ||
642 | extern "C" { | |
643 | pub fn getsystemcfg(label: ::c_int) -> ::c_ulong; | |
644 | } |