1 pub type c_char = i8; 2 pub type c_long = i32; 3 pub type c_ulong = u32; 4 pub type wchar_t = i32; 5 pub type time_t = i32; 6 pub type suseconds_t = i32; 7 pub type register_t = i32; 8 9 s_no_extra_traits! { 10 pub struct mcontext_t { 11 pub mc_onstack: register_t, 12 pub mc_gs: register_t, 13 pub mc_fs: register_t, 14 pub mc_es: register_t, 15 pub mc_ds: register_t, 16 pub mc_edi: register_t, 17 pub mc_esi: register_t, 18 pub mc_ebp: register_t, 19 pub mc_isp: register_t, 20 pub mc_ebx: register_t, 21 pub mc_edx: register_t, 22 pub mc_ecx: register_t, 23 pub mc_eax: register_t, 24 pub mc_trapno: register_t, 25 pub mc_err: register_t, 26 pub mc_eip: register_t, 27 pub mc_cs: register_t, 28 pub mc_eflags: register_t, 29 pub mc_esp: register_t, 30 pub mc_ss: register_t, 31 pub mc_len: ::c_int, 32 pub mc_fpformat: ::c_int, 33 pub mc_ownedfp: ::c_int, 34 pub mc_flags: register_t, 35 pub mc_fpstate: [[::c_int; 32]; 4], 36 pub mc_fsbase: register_t, 37 pub mc_gsbase: register_t, 38 pub mc_xfpustate: register_t, 39 pub mc_xfpustate_len: register_t, 40 pub mc_spare2: [::c_int; 4], 41 } 42 } 43 44 s! { 45 pub struct ucontext_t { 46 pub uc_sigmask: ::sigset_t, 47 pub uc_mcontext: ::mcontext_t, 48 pub uc_link: *mut ::ucontext_t, 49 pub uc_stack: ::stack_t, 50 pub uc_flags: ::c_int, 51 __spare__: [::c_int; 4], 52 } 53 } 54 55 // should be pub(crate), but that requires Rust 1.18.0 56 cfg_if! { 57 if #[cfg(libc_const_size_of)] { 58 #[doc(hidden)] 59 pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1; 60 } else { 61 #[doc(hidden)] 62 pub const _ALIGNBYTES: usize = 4 - 1; 63 } 64 } 65 66 cfg_if! { 67 if #[cfg(feature = "extra_traits")] { 68 impl PartialEq for mcontext_t { 69 fn eq(&self, other: &mcontext_t) -> bool { 70 self.mc_onstack == other.mc_onstack && 71 self.mc_gs == other.mc_gs && 72 self.mc_fs == other.mc_fs && 73 self.mc_es == other.mc_es && 74 self.mc_ds == other.mc_ds && 75 self.mc_edi == other.mc_edi && 76 self.mc_esi == other.mc_esi && 77 self.mc_ebp == other.mc_ebp && 78 self.mc_isp == other.mc_isp && 79 self.mc_ebx == other.mc_ebx && 80 self.mc_edx == other.mc_edx && 81 self.mc_ecx == other.mc_ecx && 82 self.mc_eax == other.mc_eax && 83 self.mc_trapno == other.mc_trapno && 84 self.mc_err == other.mc_err && 85 self.mc_eip == other.mc_eip && 86 self.mc_cs == other.mc_cs && 87 self.mc_eflags == other.mc_eflags && 88 self.mc_esp == other.mc_esp && 89 self.mc_ss == other.mc_ss && 90 self.mc_len == other.mc_len && 91 self.mc_fpformat == other.mc_fpformat && 92 self.mc_ownedfp == other.mc_ownedfp && 93 self.mc_flags == other.mc_flags && 94 self.mc_fpstate.iter().zip(other.mc_fpstate.iter()).all(|(a, b)| a == b) && 95 self.mc_fsbase == other.mc_fsbase && 96 self.mc_gsbase == other.mc_gsbase && 97 self.mc_xfpustate == other.mc_xfpustate && 98 self.mc_xfpustate_len == other.mc_xfpustate_len && 99 self.mc_spare2.iter().zip(other.mc_spare2.iter()).all(|(a, b)| a == b) 100 } 101 } 102 impl Eq for mcontext_t {} 103 impl ::fmt::Debug for mcontext_t { 104 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { 105 f.debug_struct("mcontext_t") 106 .field("mc_onstack", &self.mc_onstack) 107 .field("mc_gs", &self.mc_gs) 108 .field("mc_fs", &self.mc_fs) 109 .field("mc_es", &self.mc_es) 110 .field("mc_ds", &self.mc_ds) 111 .field("mc_edi", &self.mc_edi) 112 .field("mc_esi", &self.mc_esi) 113 .field("mc_ebp", &self.mc_ebp) 114 .field("mc_isp", &self.mc_isp) 115 .field("mc_ebx", &self.mc_ebx) 116 .field("mc_edx", &self.mc_edx) 117 .field("mc_ecx", &self.mc_ecx) 118 .field("mc_eax", &self.mc_eax) 119 .field("mc_trapno", &self.mc_trapno) 120 .field("mc_err", &self.mc_err) 121 .field("mc_eip", &self.mc_eip) 122 .field("mc_cs", &self.mc_cs) 123 .field("mc_eflags", &self.mc_eflags) 124 .field("mc_esp", &self.mc_esp) 125 .field("mc_ss", &self.mc_ss) 126 .field("mc_len", &self.mc_len) 127 .field("mc_fpformat", &self.mc_fpformat) 128 .field("mc_ownedfp", &self.mc_ownedfp) 129 .field("mc_flags", &self.mc_flags) 130 .field("mc_fpstate", &self.mc_fpstate) 131 .field("mc_fsbase", &self.mc_fsbase) 132 .field("mc_gsbase", &self.mc_gsbase) 133 .field("mc_xfpustate", &self.mc_xfpustate) 134 .field("mc_xfpustate_len", &self.mc_xfpustate_len) 135 .field("mc_spare2", &self.mc_spare2) 136 .finish() 137 } 138 } 139 impl ::hash::Hash for mcontext_t { 140 fn hash<H: ::hash::Hasher>(&self, state: &mut H) { 141 self.mc_onstack.hash(state); 142 self.mc_gs.hash(state); 143 self.mc_fs.hash(state); 144 self.mc_es.hash(state); 145 self.mc_ds.hash(state); 146 self.mc_edi.hash(state); 147 self.mc_esi.hash(state); 148 self.mc_ebp.hash(state); 149 self.mc_isp.hash(state); 150 self.mc_ebx.hash(state); 151 self.mc_edx.hash(state); 152 self.mc_ecx.hash(state); 153 self.mc_eax.hash(state); 154 self.mc_trapno.hash(state); 155 self.mc_err.hash(state); 156 self.mc_eip.hash(state); 157 self.mc_cs.hash(state); 158 self.mc_eflags.hash(state); 159 self.mc_esp.hash(state); 160 self.mc_ss.hash(state); 161 self.mc_len.hash(state); 162 self.mc_fpformat.hash(state); 163 self.mc_ownedfp.hash(state); 164 self.mc_flags.hash(state); 165 self.mc_fpstate.hash(state); 166 self.mc_fsbase.hash(state); 167 self.mc_gsbase.hash(state); 168 self.mc_xfpustate.hash(state); 169 self.mc_xfpustate_len.hash(state); 170 self.mc_spare2.hash(state); 171 } 172 } 173 } 174 } 175 176 pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4 177 178 pub const KINFO_FILE_SIZE: ::c_int = 1392; 179