@@ -9,6 +9,8 @@ pub type blksize_t = i64;
9
9
pub type suseconds_t = i64 ;
10
10
pub type __u64 = c_ulong ;
11
11
pub type __s64 = c_long ;
12
+ pub type gregset_t = [ c_ulong ; __NGREG] ;
13
+ pub type fpregset_t = [ c_ulong ; __NFPREG] ;
12
14
13
15
s ! {
14
16
// FIXME(1.0): This should not implement `PartialEq`
@@ -191,13 +193,86 @@ s! {
191
193
pub ss_flags: c_int,
192
194
pub ss_size: size_t,
193
195
}
196
+
197
+ #[ repr( align( 8 ) ) ]
198
+ pub struct clone_args {
199
+ pub flags: c_ulonglong,
200
+ pub pidfd: c_ulonglong,
201
+ pub child_tid: c_ulonglong,
202
+ pub parent_tid: c_ulonglong,
203
+ pub exit_signal: c_ulonglong,
204
+ pub stack: c_ulonglong,
205
+ pub stack_size: c_ulonglong,
206
+ pub tls: c_ulonglong,
207
+ pub set_tid: c_ulonglong,
208
+ pub set_tid_size: c_ulonglong,
209
+ pub cgroup: c_ulonglong,
210
+ }
194
211
}
195
212
196
213
s_no_extra_traits ! {
197
214
#[ repr( align( 16 ) ) ]
198
215
pub struct max_align_t {
199
216
priv_: [ i64 ; 4 ] ,
200
217
}
218
+
219
+ pub struct ucontext_t {
220
+ pub uc_flags: c_ulong,
221
+ pub uc_link: * mut ucontext_t,
222
+ pub uc_stack: crate :: stack_t,
223
+ pub uc_sigmask: crate :: sigset_t,
224
+ pub uc_mcontext: mcontext_t,
225
+ }
226
+
227
+ pub struct pt_regs {
228
+ pub gpr: [ c_ulong; 32 ] ,
229
+ pub nip: c_ulong,
230
+ pub msr: c_ulong,
231
+ pub orig_gpr3: c_ulong,
232
+ pub ctr: c_ulong,
233
+ pub link: c_ulong,
234
+ pub xer: c_ulong,
235
+ pub ccr: c_ulong,
236
+ pub softe: c_ulong,
237
+ pub trap: c_ulong,
238
+ pub dar: c_ulong,
239
+ pub dsisr: c_ulong,
240
+ pub result: c_ulong,
241
+ }
242
+
243
+ pub struct mcontext_t {
244
+ __glibc_reserved: [ c_ulong; 4 ] ,
245
+ pub signal: c_int,
246
+ __pad0: c_int,
247
+ pub handler: c_ulong,
248
+ pub oldmask: c_ulong,
249
+ pub regs: * mut pt_regs,
250
+ pub gp_regs: crate :: gregset_t,
251
+ pub fp_regs: crate :: fpregset_t,
252
+ pub v_regs: * mut vrregset_t,
253
+ pub vmx_reserve: [ c_long; __NVRREG + __NVRREG + 1 ] ,
254
+ }
255
+
256
+ #[ repr( align( 16 ) ) ]
257
+ pub struct vrregset_t {
258
+ pub vrregs: [ [ c_uint; 4 ] ; 32 ] ,
259
+ pub vscr: vscr_t,
260
+ pub vrsave: c_uint,
261
+ __pad: [ c_uint; 3 ] ,
262
+ }
263
+
264
+ #[ repr( align( 4 ) ) ]
265
+ pub struct vscr_t {
266
+ #[ cfg( target_endian = "big" ) ]
267
+ __pad: [ c_uint; 3 ] ,
268
+ #[ cfg( target_endian = "big" ) ]
269
+ pub vscr_word: c_uint,
270
+
271
+ #[ cfg( target_endian = "little" ) ]
272
+ pub vscr_word: c_uint,
273
+ #[ cfg( target_endian = "little" ) ]
274
+ __pad: [ c_uint; 3 ] ,
275
+ }
201
276
}
202
277
203
278
pub const POSIX_FADV_DONTNEED : c_int = 4 ;
@@ -210,6 +285,10 @@ pub const VEOF: usize = 4;
210
285
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56 ;
211
286
pub const __SIZEOF_PTHREAD_BARRIER_T: usize = 32 ;
212
287
288
+ pub const __NGREG: usize = 48 ;
289
+ pub const __NFPREG: usize = 33 ;
290
+ pub const __NVRREG: usize = 34 ;
291
+
213
292
pub const O_APPEND : c_int = 1024 ;
214
293
pub const O_CREAT : c_int = 64 ;
215
294
pub const O_EXCL : c_int = 128 ;
@@ -971,4 +1050,9 @@ extern "C" {
971
1050
newp : * mut c_void ,
972
1051
newlen : size_t ,
973
1052
) -> c_int ;
1053
+
1054
+ pub fn getcontext ( ucp : * mut ucontext_t ) -> c_int ;
1055
+ pub fn setcontext ( ucp : * const ucontext_t ) -> c_int ;
1056
+ pub fn swapcontext ( oucp : * mut ucontext_t , ucp : * const ucontext_t ) -> c_int ;
1057
+ pub fn makecontext ( ucp : * mut ucontext_t , func : extern "C" fn ( ) , argc : c_int , ...) ;
974
1058
}
0 commit comments