@@ -367,18 +367,15 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
367
367
clock_id : & OpTy < ' tcx > ,
368
368
flags : & OpTy < ' tcx > ,
369
369
req : & OpTy < ' tcx > ,
370
- rem : & OpTy < ' tcx > , // Signal handlers are not supported, so rem will never be written to.
370
+ rem : & OpTy < ' tcx > ,
371
371
) -> InterpResult < ' tcx , Scalar > {
372
372
let this = self . eval_context_mut ( ) ;
373
373
374
374
let clockid_t_size = this. libc_ty_layout ( "clockid_t" ) . size ;
375
- let clock_id = this. read_scalar ( clock_id_op) ?. to_int ( clockid_t_size) ?;
376
- let req = this. deref_pointer_as ( req_op, this. libc_ty_layout ( "timespec" ) ) ?;
377
- // TODO must be a better way to do this, also fix the
378
- // if compare of the flags later
379
- let int_size = this. libc_ty_layout ( "int" ) . size ;
380
- let flags = this. read_scalar ( flags) ?. to_int ( int_size) ;
381
- let rem = this. read_pointer ( ) ?;
375
+ let clock_id = this. read_scalar ( clock_id) ?. to_int ( clockid_t_size) ?;
376
+ let req = this. deref_pointer_as ( req, this. libc_ty_layout ( "timespec" ) ) ?;
377
+ let flags = this. read_scalar ( flags) ?. to_i32 ( ) ?;
378
+ let _rem = this. read_pointer ( rem) ?; // Signal handlers are not supported, so rem will never be written to.
382
379
383
380
// The standard lib through sleep_until only needs CLOCK_MONOTONIC
384
381
if clock_id != this. eval_libc ( "CLOCK_MONOTONIC" ) . to_int ( clockid_t_size) ? {
@@ -396,14 +393,14 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
396
393
// No flags set, the timespec should be interperted as a duration
397
394
// to sleep for
398
395
TimeoutAnchor :: Relative
399
- } else if flag == this. eval_libc ( "TIMER_ABSTIME" ) . to_int ( int_size ) {
396
+ } else if flags == this. eval_libc ( "TIMER_ABSTIME" ) . to_i32 ( ) ? {
400
397
// Only flag TIMER_ABSTIME set, the timespec should be interperted as
401
398
// an absolute time.
402
399
TimeoutAnchor :: Absolute
403
400
} else {
404
- // The standard lib through sleep_until only needs TIMER_ABSTIME
401
+ // The standard lib ( through ` sleep_until`) only needs TIMER_ABSTIME
405
402
throw_unsup_format ! (
406
- "`clock_nanosleep` unsupported flags {flags}, only no flags or\
403
+ "`clock_nanosleep` unsupported flags {flags}, only no flags or \
407
404
TIMER_ABSTIME is supported"
408
405
) ;
409
406
} ;
0 commit comments