|
1 | 1 | pub type __priority_which_t = ::c_uint;
|
2 | 2 |
|
| 3 | +#[repr(C)] |
| 4 | +#[derive(Copy, Clone)] |
| 5 | +struct addr_bnd_t { |
| 6 | + lower: *mut ::c_void, |
| 7 | + upper: *mut ::c_void, |
| 8 | +} |
| 9 | + |
| 10 | +#[repr(C)] |
| 11 | +#[derive(Copy, Clone)] |
| 12 | +union sigfault_t_anonymous_union { |
| 13 | + addr_bnd: addr_bnd_t, |
| 14 | + pkey: u32, |
| 15 | +} |
| 16 | + |
| 17 | +#[repr(C)] |
| 18 | +#[derive(Copy, Clone)] |
| 19 | +struct sigfault_t { |
| 20 | + addr: *mut ::c_void, |
| 21 | + #[cfg(target_arch = "sparc")] |
| 22 | + trapno: ::c_int, |
| 23 | + addr_lsb: ::c_short, |
| 24 | + anonymous_union: sigfault_t_anonymous_union, |
| 25 | +} |
| 26 | + |
| 27 | +#[repr(C, packed)] |
| 28 | +#[derive(Copy, Clone)] |
| 29 | +union sifields_t { |
| 30 | + _pad: [::c_int; 29], |
| 31 | + sigfault: sigfault_t, |
| 32 | +} |
| 33 | + |
| 34 | +#[repr(C)] |
| 35 | +#[derive(Copy, Clone)] |
| 36 | +pub struct siginfo_t { |
| 37 | + pub si_signo: ::c_int, |
| 38 | + pub si_errno: ::c_int, |
| 39 | + pub si_code: ::c_int, |
| 40 | + sifields: sifields_t, |
| 41 | + #[cfg(target_arch = "x86_64")] |
| 42 | + _align: [u64; 0], |
| 43 | + #[cfg(not(target_arch = "x86_64"))] |
| 44 | + _align: [usize; 0], |
| 45 | +} |
| 46 | + |
| 47 | +impl ::fmt::Debug for sigfault_t_anonymous_union { |
| 48 | + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { |
| 49 | + // TODO: no idea how to tell which of the members is used |
| 50 | + f.debug_struct("sigfault_t_anonymous_union") |
| 51 | + .finish() |
| 52 | + } |
| 53 | +} |
| 54 | + |
| 55 | +impl ::fmt::Debug for sigfault_t { |
| 56 | + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { |
| 57 | + // TODO: include trapno on Sparc |
| 58 | + f.debug_struct("sigfault_t") |
| 59 | + .field("addr", &self.addr) |
| 60 | + .field("addr_lsb", &self.addr_lsb) |
| 61 | + .field("anonymous_union", &self.anonymous_union) |
| 62 | + .finish() |
| 63 | + } |
| 64 | +} |
| 65 | + |
| 66 | +impl ::fmt::Debug for sifields_t { |
| 67 | + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { |
| 68 | + // No way to print anything more detailed without the discriminant from |
| 69 | + // siginfo_t |
| 70 | + f.debug_struct("sifields_t").finish() |
| 71 | + } |
| 72 | +} |
| 73 | + |
| 74 | +impl siginfo_t { |
| 75 | + pub unsafe fn si_addr(&self) -> *mut ::c_void { |
| 76 | + self.sifields.sigfault.addr |
| 77 | + } |
| 78 | +} |
| 79 | + |
| 80 | +impl ::fmt::Debug for siginfo_t { |
| 81 | + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { |
| 82 | + // TODO: include fields from sifields |
| 83 | + f.debug_struct("siginfo_t") |
| 84 | + .field("si_signo", &self.si_signo) |
| 85 | + .field("si_errno", &self.si_errno) |
| 86 | + .field("si_code", &self.si_code) |
| 87 | + .finish() |
| 88 | + } |
| 89 | +} |
| 90 | + |
3 | 91 | s! {
|
4 | 92 | pub struct aiocb {
|
5 | 93 | pub aio_fildes: ::c_int,
|
|
44 | 132 | pub ss_size: ::size_t
|
45 | 133 | }
|
46 | 134 |
|
47 |
| - pub struct siginfo_t { |
48 |
| - pub si_signo: ::c_int, |
49 |
| - pub si_errno: ::c_int, |
50 |
| - pub si_code: ::c_int, |
51 |
| - pub _pad: [::c_int; 29], |
52 |
| - #[cfg(target_arch = "x86_64")] |
53 |
| - _align: [u64; 0], |
54 |
| - #[cfg(not(target_arch = "x86_64"))] |
55 |
| - _align: [usize; 0], |
56 |
| - } |
57 |
| - |
58 | 135 | pub struct glob64_t {
|
59 | 136 | pub gl_pathc: ::size_t,
|
60 | 137 | pub gl_pathv: *mut *mut ::c_char,
|
|
0 commit comments