@@ -485,6 +485,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
485
485
let fh = & mut this. machine . file_handler ;
486
486
let ( file_result, writable) = match fh. handles . get ( & fd) {
487
487
Some ( file_descriptor) => {
488
+ // FIXME: Support "dup" for all FDs(stdin, etc)
488
489
let FileHandle { file, writable } = file_descriptor. as_file_handle ( ) ?;
489
490
( file. try_clone ( ) , * writable)
490
491
} ,
@@ -499,6 +500,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
499
500
{
500
501
let & [ _, _] = check_arg_count ( args) ?;
501
502
if let Some ( file_descriptor) = this. machine . file_handler . handles . get ( & fd) {
503
+ // FIXME: Support fullfsync for all FDs
502
504
match file_descriptor. as_file_handle ( ) {
503
505
Ok ( FileHandle { file, writable } ) => {
504
506
let io_result = maybe_sync_file ( & file, * writable, File :: sync_all) ;
@@ -522,6 +524,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
522
524
let fd = this. read_scalar ( fd_op) ?. to_i32 ( ) ?;
523
525
524
526
if let Some ( file_descriptor) = this. machine . file_handler . handles . remove ( & fd) {
527
+ // FIXME: Support `close` for all FDs(stdin, etc)
525
528
let FileHandle { file, writable } = file_descriptor. as_file_handle ( ) ?;
526
529
// We sync the file if it was opened in a mode different than read-only.
527
530
if * writable {
@@ -1219,6 +1222,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
1219
1222
let fd = this. read_scalar ( fd_op) ?. to_i32 ( ) ?;
1220
1223
let length = this. read_scalar ( length_op) ?. to_i64 ( ) ?;
1221
1224
if let Some ( file_descriptor) = this. machine . file_handler . handles . get_mut ( & fd) {
1225
+ // FIXME: Support ftruncate64 for all FDs
1222
1226
let FileHandle { file, writable } = file_descriptor. as_file_handle ( ) ?;
1223
1227
if * writable {
1224
1228
if let Ok ( length) = length. try_into ( ) {
@@ -1252,6 +1256,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
1252
1256
1253
1257
let fd = this. read_scalar ( fd_op) ?. to_i32 ( ) ?;
1254
1258
if let Some ( file_descriptor) = this. machine . file_handler . handles . get ( & fd) {
1259
+ // FIXME: Support fsync for all FDs
1255
1260
let FileHandle { file, writable } = file_descriptor. as_file_handle ( ) ?;
1256
1261
let io_result = maybe_sync_file ( & file, * writable, File :: sync_all) ;
1257
1262
this. try_unwrap_io_result ( io_result)
@@ -1267,6 +1272,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
1267
1272
1268
1273
let fd = this. read_scalar ( fd_op) ?. to_i32 ( ) ?;
1269
1274
if let Some ( file_descriptor) = this. machine . file_handler . handles . get ( & fd) {
1275
+ // FIXME: Support fdatasync for all FDs
1270
1276
let FileHandle { file, writable } = file_descriptor. as_file_handle ( ) ?;
1271
1277
let io_result = maybe_sync_file ( & file, * writable, File :: sync_data) ;
1272
1278
this. try_unwrap_io_result ( io_result)
@@ -1306,6 +1312,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
1306
1312
}
1307
1313
1308
1314
if let Some ( file_descriptor) = this. machine . file_handler . handles . get ( & fd) {
1315
+ // FIXME: Support sync_data_range for all FDs
1309
1316
let FileHandle { file, writable } = file_descriptor. as_file_handle ( ) ?;
1310
1317
let io_result = maybe_sync_file ( & file, * writable, File :: sync_data) ;
1311
1318
this. try_unwrap_io_result ( io_result)
0 commit comments