@@ -6,6 +6,41 @@ pub type time_t = i32;
66pub type suseconds_t = i32 ;
77pub type register_t = i32 ;
88
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+
944s ! {
1045 pub struct stat {
1146 pub st_dev: :: dev_t,
3166 pub st_birthtime_nsec: :: c_long,
3267 __unused: [ u8 ; 8 ] ,
3368 }
69+
70+ pub struct ucontext_t {
71+ pub uc_sigmask: :: sigset_t,
72+ pub uc_mcontext: :: mcontext_t,
73+ pub uc_link: * mut :: ucontext_t,
74+ pub uc_stack: :: stack_t,
75+ pub uc_flags: :: c_int,
76+ __spare__: [ :: c_int; 4 ] ,
77+ }
3478}
3579
3680// should be pub(crate), but that requires Rust 1.18.0
@@ -43,4 +87,115 @@ cfg_if! {
4387 pub const _ALIGNBYTES: usize = 4 - 1 ;
4488 }
4589}
90+
91+ cfg_if ! {
92+ if #[ cfg( feature = "extra_traits" ) ] {
93+ impl PartialEq for mcontext_t {
94+ fn eq( & self , other: & mcontext_t) -> bool {
95+ self . mc_onstack == other. mc_onstack &&
96+ self . mc_gs == other. mc_gs &&
97+ self . mc_fs == other. mc_fs &&
98+ self . mc_es == other. mc_es &&
99+ self . mc_ds == other. mc_ds &&
100+ self . mc_edi == other. mc_edi &&
101+ self . mc_esi == other. mc_esi &&
102+ self . mc_ebp == other. mc_ebp &&
103+ self . mc_isp == other. mc_isp &&
104+ self . mc_ebx == other. mc_ebx &&
105+ self . mc_edx == other. mc_edx &&
106+ self . mc_ecx == other. mc_ecx &&
107+ self . mc_eax == other. mc_eax &&
108+ self . mc_trapno == other. mc_trapno &&
109+ self . mc_err == other. mc_err &&
110+ self . mc_eip == other. mc_eip &&
111+ self . mc_cs == other. mc_cs &&
112+ self . mc_eflags == other. mc_eflags &&
113+ self . mc_esp == other. mc_esp &&
114+ self . mc_ss == other. mc_ss &&
115+ self . mc_len == other. mc_len &&
116+ self . mc_fpformat == other. mc_fpformat &&
117+ self . mc_ownedfp == other. mc_ownedfp &&
118+ self . mc_flags == other. mc_flags &&
119+ self . mc_fpstate. iter( ) . zip( other. mc_fpstate. iter( ) ) . all( |( a, b) | a == b) &&
120+ self . mc_fsbase == other. mc_fsbase &&
121+ self . mc_gsbase == other. mc_gsbase &&
122+ self . mc_xfpustate == other. mc_xfpustate &&
123+ self . mc_xfpustate_len == other. mc_xfpustate_len &&
124+ self . mc_spare2. iter( ) . zip( other. mc_spare2. iter( ) ) . all( |( a, b) | a == b)
125+ }
126+ }
127+ impl Eq for mcontext_t { }
128+ impl :: fmt:: Debug for mcontext_t {
129+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
130+ f. debug_struct( "mcontext_t" )
131+ . field( "mc_onstack" , & self . mc_onstack)
132+ . field( "mc_gs" , & self . mc_gs)
133+ . field( "mc_fs" , & self . mc_fs)
134+ . field( "mc_es" , & self . mc_es)
135+ . field( "mc_ds" , & self . mc_ds)
136+ . field( "mc_edi" , & self . mc_edi)
137+ . field( "mc_esi" , & self . mc_esi)
138+ . field( "mc_ebp" , & self . mc_ebp)
139+ . field( "mc_isp" , & self . mc_isp)
140+ . field( "mc_ebx" , & self . mc_ebx)
141+ . field( "mc_edx" , & self . mc_edx)
142+ . field( "mc_ecx" , & self . mc_ecx)
143+ . field( "mc_eax" , & self . mc_eax)
144+ . field( "mc_trapno" , & self . mc_trapno)
145+ . field( "mc_err" , & self . mc_err)
146+ . field( "mc_eip" , & self . mc_eip)
147+ . field( "mc_cs" , & self . mc_cs)
148+ . field( "mc_eflags" , & self . mc_eflags)
149+ . field( "mc_esp" , & self . mc_esp)
150+ . field( "mc_ss" , & self . mc_ss)
151+ . field( "mc_len" , & self . mc_len)
152+ . field( "mc_fpformat" , & self . mc_fpformat)
153+ . field( "mc_ownedfp" , & self . mc_ownedfp)
154+ . field( "mc_flags" , & self . mc_flags)
155+ . field( "mc_fpstate" , & self . mc_fpstate)
156+ . field( "mc_fsbase" , & self . mc_fsbase)
157+ . field( "mc_gsbase" , & self . mc_gsbase)
158+ . field( "mc_xfpustate" , & self . mc_xfpustate)
159+ . field( "mc_xfpustate_len" , & self . mc_xfpustate_len)
160+ . field( "mc_spare2" , & self . mc_spare2)
161+ . finish( )
162+ }
163+ }
164+ impl :: hash:: Hash for mcontext_t {
165+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
166+ self . mc_onstack. hash( state) ;
167+ self . mc_gs. hash( state) ;
168+ self . mc_fs. hash( state) ;
169+ self . mc_es. hash( state) ;
170+ self . mc_ds. hash( state) ;
171+ self . mc_edi. hash( state) ;
172+ self . mc_esi. hash( state) ;
173+ self . mc_ebp. hash( state) ;
174+ self . mc_isp. hash( state) ;
175+ self . mc_ebx. hash( state) ;
176+ self . mc_edx. hash( state) ;
177+ self . mc_ecx. hash( state) ;
178+ self . mc_eax. hash( state) ;
179+ self . mc_trapno. hash( state) ;
180+ self . mc_err. hash( state) ;
181+ self . mc_eip. hash( state) ;
182+ self . mc_cs. hash( state) ;
183+ self . mc_eflags. hash( state) ;
184+ self . mc_esp. hash( state) ;
185+ self . mc_ss. hash( state) ;
186+ self . mc_len. hash( state) ;
187+ self . mc_fpformat. hash( state) ;
188+ self . mc_ownedfp. hash( state) ;
189+ self . mc_flags. hash( state) ;
190+ self . mc_fpstate. hash( state) ;
191+ self . mc_fsbase. hash( state) ;
192+ self . mc_gsbase. hash( state) ;
193+ self . mc_xfpustate. hash( state) ;
194+ self . mc_xfpustate_len. hash( state) ;
195+ self . mc_spare2. hash( state) ;
196+ }
197+ }
198+ }
199+ }
200+
46201pub const MINSIGSTKSZ : :: size_t = 2048 ; // 512 * 4
0 commit comments