@@ -179,11 +179,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
179
179
fn pthread_mutexattr_init ( & mut self , attr_op : OpTy < ' tcx , Tag > ) -> InterpResult < ' tcx , i32 > {
180
180
let this = self . eval_context_mut ( ) ;
181
181
182
- let attr = this. read_scalar ( attr_op) ?. not_undef ( ) ?;
183
- if this. is_null ( attr) ? {
184
- return this. eval_libc_i32 ( "EINVAL" ) ;
185
- }
186
-
187
182
let default_kind = this. eval_libc ( "PTHREAD_MUTEX_DEFAULT" ) ?;
188
183
mutexattr_set_kind ( this, attr_op, default_kind) ?;
189
184
@@ -197,11 +192,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
197
192
) -> InterpResult < ' tcx , i32 > {
198
193
let this = self . eval_context_mut ( ) ;
199
194
200
- let attr = this. read_scalar ( attr_op) ?. not_undef ( ) ?;
201
- if this. is_null ( attr) ? {
202
- return this. eval_libc_i32 ( "EINVAL" ) ;
203
- }
204
-
205
195
let kind = this. read_scalar ( kind_op) ?. not_undef ( ) ?;
206
196
if kind == this. eval_libc ( "PTHREAD_MUTEX_NORMAL" ) ?
207
197
|| kind == this. eval_libc ( "PTHREAD_MUTEX_ERRORCHECK" ) ?
@@ -219,11 +209,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
219
209
fn pthread_mutexattr_destroy ( & mut self , attr_op : OpTy < ' tcx , Tag > ) -> InterpResult < ' tcx , i32 > {
220
210
let this = self . eval_context_mut ( ) ;
221
211
222
- let attr = this. read_scalar ( attr_op) ?. not_undef ( ) ?;
223
- if this. is_null ( attr) ? {
224
- return this. eval_libc_i32 ( "EINVAL" ) ;
225
- }
226
-
227
212
mutexattr_set_kind ( this, attr_op, ScalarMaybeUndef :: Undef ) ?;
228
213
229
214
Ok ( 0 )
@@ -236,11 +221,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
236
221
) -> InterpResult < ' tcx , i32 > {
237
222
let this = self . eval_context_mut ( ) ;
238
223
239
- let mutex = this. read_scalar ( mutex_op) ?. not_undef ( ) ?;
240
- if this. is_null ( mutex) ? {
241
- return this. eval_libc_i32 ( "EINVAL" ) ;
242
- }
243
-
244
224
let attr = this. read_scalar ( attr_op) ?. not_undef ( ) ?;
245
225
let kind = if this. is_null ( attr) ? {
246
226
this. eval_libc ( "PTHREAD_MUTEX_DEFAULT" ) ?
@@ -257,11 +237,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
257
237
fn pthread_mutex_lock ( & mut self , mutex_op : OpTy < ' tcx , Tag > ) -> InterpResult < ' tcx , i32 > {
258
238
let this = self . eval_context_mut ( ) ;
259
239
260
- let mutex = this. read_scalar ( mutex_op) ?. not_undef ( ) ?;
261
- if this. is_null ( mutex) ? {
262
- return this. eval_libc_i32 ( "EINVAL" ) ;
263
- }
264
-
265
240
let kind = mutex_get_kind ( this, mutex_op) ?. not_undef ( ) ?;
266
241
let locked_count = mutex_get_locked_count ( this, mutex_op) ?. to_u32 ( ) ?;
267
242
@@ -295,11 +270,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
295
270
fn pthread_mutex_trylock ( & mut self , mutex_op : OpTy < ' tcx , Tag > ) -> InterpResult < ' tcx , i32 > {
296
271
let this = self . eval_context_mut ( ) ;
297
272
298
- let mutex = this. read_scalar ( mutex_op) ?. not_undef ( ) ?;
299
- if this. is_null ( mutex) ? {
300
- return this. eval_libc_i32 ( "EINVAL" ) ;
301
- }
302
-
303
273
let kind = mutex_get_kind ( this, mutex_op) ?. not_undef ( ) ?;
304
274
let locked_count = mutex_get_locked_count ( this, mutex_op) ?. to_u32 ( ) ?;
305
275
@@ -328,11 +298,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
328
298
fn pthread_mutex_unlock ( & mut self , mutex_op : OpTy < ' tcx , Tag > ) -> InterpResult < ' tcx , i32 > {
329
299
let this = self . eval_context_mut ( ) ;
330
300
331
- let mutex = this. read_scalar ( mutex_op) ?. not_undef ( ) ?;
332
- if this. is_null ( mutex) ? {
333
- return this. eval_libc_i32 ( "EINVAL" ) ;
334
- }
335
-
336
301
let kind = mutex_get_kind ( this, mutex_op) ?. not_undef ( ) ?;
337
302
let locked_count = mutex_get_locked_count ( this, mutex_op) ?. to_u32 ( ) ?;
338
303
@@ -371,11 +336,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
371
336
fn pthread_mutex_destroy ( & mut self , mutex_op : OpTy < ' tcx , Tag > ) -> InterpResult < ' tcx , i32 > {
372
337
let this = self . eval_context_mut ( ) ;
373
338
374
- let mutex = this. read_scalar ( mutex_op) ?. not_undef ( ) ?;
375
- if this. is_null ( mutex) ? {
376
- return this. eval_libc_i32 ( "EINVAL" ) ;
377
- }
378
-
379
339
if mutex_get_locked_count ( this, mutex_op) ?. to_u32 ( ) ? != 0 {
380
340
return this. eval_libc_i32 ( "EBUSY" ) ;
381
341
}
@@ -389,11 +349,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
389
349
fn pthread_rwlock_rdlock ( & mut self , rwlock_op : OpTy < ' tcx , Tag > ) -> InterpResult < ' tcx , i32 > {
390
350
let this = self . eval_context_mut ( ) ;
391
351
392
- let rwlock = this. read_scalar ( rwlock_op) ?. not_undef ( ) ?;
393
- if this. is_null ( rwlock) ? {
394
- return this. eval_libc_i32 ( "EINVAL" ) ;
395
- }
396
-
397
352
let readers = rwlock_get_readers ( this, rwlock_op) ?. to_u32 ( ) ?;
398
353
let writers = rwlock_get_writers ( this, rwlock_op) ?. to_u32 ( ) ?;
399
354
if writers != 0 {
@@ -414,11 +369,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
414
369
fn pthread_rwlock_tryrdlock ( & mut self , rwlock_op : OpTy < ' tcx , Tag > ) -> InterpResult < ' tcx , i32 > {
415
370
let this = self . eval_context_mut ( ) ;
416
371
417
- let rwlock = this. read_scalar ( rwlock_op) ?. not_undef ( ) ?;
418
- if this. is_null ( rwlock) ? {
419
- return this. eval_libc_i32 ( "EINVAL" ) ;
420
- }
421
-
422
372
let readers = rwlock_get_readers ( this, rwlock_op) ?. to_u32 ( ) ?;
423
373
let writers = rwlock_get_writers ( this, rwlock_op) ?. to_u32 ( ) ?;
424
374
if writers != 0 {
@@ -437,11 +387,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
437
387
fn pthread_rwlock_wrlock ( & mut self , rwlock_op : OpTy < ' tcx , Tag > ) -> InterpResult < ' tcx , i32 > {
438
388
let this = self . eval_context_mut ( ) ;
439
389
440
- let rwlock = this. read_scalar ( rwlock_op) ?. not_undef ( ) ?;
441
- if this. is_null ( rwlock) ? {
442
- return this. eval_libc_i32 ( "EINVAL" ) ;
443
- }
444
-
445
390
let readers = rwlock_get_readers ( this, rwlock_op) ?. to_u32 ( ) ?;
446
391
let writers = rwlock_get_writers ( this, rwlock_op) ?. to_u32 ( ) ?;
447
392
if readers != 0 {
@@ -461,11 +406,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
461
406
fn pthread_rwlock_trywrlock ( & mut self , rwlock_op : OpTy < ' tcx , Tag > ) -> InterpResult < ' tcx , i32 > {
462
407
let this = self . eval_context_mut ( ) ;
463
408
464
- let rwlock = this. read_scalar ( rwlock_op) ?. not_undef ( ) ?;
465
- if this. is_null ( rwlock) ? {
466
- return this. eval_libc_i32 ( "EINVAL" ) ;
467
- }
468
-
469
409
let readers = rwlock_get_readers ( this, rwlock_op) ?. to_u32 ( ) ?;
470
410
let writers = rwlock_get_writers ( this, rwlock_op) ?. to_u32 ( ) ?;
471
411
if readers != 0 || writers != 0 {
@@ -479,11 +419,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
479
419
fn pthread_rwlock_unlock ( & mut self , rwlock_op : OpTy < ' tcx , Tag > ) -> InterpResult < ' tcx , i32 > {
480
420
let this = self . eval_context_mut ( ) ;
481
421
482
- let rwlock = this. read_scalar ( rwlock_op) ?. not_undef ( ) ?;
483
- if this. is_null ( rwlock) ? {
484
- return this. eval_libc_i32 ( "EINVAL" ) ;
485
- }
486
-
487
422
let readers = rwlock_get_readers ( this, rwlock_op) ?. to_u32 ( ) ?;
488
423
let writers = rwlock_get_writers ( this, rwlock_op) ?. to_u32 ( ) ?;
489
424
if let Some ( new_readers) = readers. checked_sub ( 1 ) {
@@ -500,11 +435,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
500
435
fn pthread_rwlock_destroy ( & mut self , rwlock_op : OpTy < ' tcx , Tag > ) -> InterpResult < ' tcx , i32 > {
501
436
let this = self . eval_context_mut ( ) ;
502
437
503
- let rwlock = this. read_scalar ( rwlock_op) ?. not_undef ( ) ?;
504
- if this. is_null ( rwlock) ? {
505
- return this. eval_libc_i32 ( "EINVAL" ) ;
506
- }
507
-
508
438
if rwlock_get_readers ( this, rwlock_op) ?. to_u32 ( ) ? != 0 {
509
439
return this. eval_libc_i32 ( "EBUSY" ) ;
510
440
}
0 commit comments