Skip to content

Commit 045bcab

Browse files
committed
Add FIXME's for dup and other syscalls to support stdin/out/err
1 parent 773dfb3 commit 045bcab

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/shims/posix/fs.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
485485
let fh = &mut this.machine.file_handler;
486486
let (file_result, writable) = match fh.handles.get(&fd) {
487487
Some(file_descriptor) => {
488+
// FIXME: Support "dup" for all FDs(stdin, etc)
488489
let FileHandle { file, writable } = file_descriptor.as_file_handle()?;
489490
(file.try_clone(), *writable)
490491
},
@@ -499,6 +500,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
499500
{
500501
let &[_, _] = check_arg_count(args)?;
501502
if let Some(file_descriptor) = this.machine.file_handler.handles.get(&fd) {
503+
// FIXME: Support fullfsync for all FDs
502504
match file_descriptor.as_file_handle() {
503505
Ok(FileHandle { file, writable }) => {
504506
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
522524
let fd = this.read_scalar(fd_op)?.to_i32()?;
523525

524526
if let Some(file_descriptor) = this.machine.file_handler.handles.remove(&fd) {
527+
// FIXME: Support `close` for all FDs(stdin, etc)
525528
let FileHandle { file, writable } = file_descriptor.as_file_handle()?;
526529
// We sync the file if it was opened in a mode different than read-only.
527530
if *writable {
@@ -1219,6 +1222,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
12191222
let fd = this.read_scalar(fd_op)?.to_i32()?;
12201223
let length = this.read_scalar(length_op)?.to_i64()?;
12211224
if let Some(file_descriptor) = this.machine.file_handler.handles.get_mut(&fd) {
1225+
// FIXME: Support ftruncate64 for all FDs
12221226
let FileHandle { file, writable } = file_descriptor.as_file_handle()?;
12231227
if *writable {
12241228
if let Ok(length) = length.try_into() {
@@ -1252,6 +1256,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
12521256

12531257
let fd = this.read_scalar(fd_op)?.to_i32()?;
12541258
if let Some(file_descriptor) = this.machine.file_handler.handles.get(&fd) {
1259+
// FIXME: Support fsync for all FDs
12551260
let FileHandle { file, writable } = file_descriptor.as_file_handle()?;
12561261
let io_result = maybe_sync_file(&file, *writable, File::sync_all);
12571262
this.try_unwrap_io_result(io_result)
@@ -1267,6 +1272,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
12671272

12681273
let fd = this.read_scalar(fd_op)?.to_i32()?;
12691274
if let Some(file_descriptor) = this.machine.file_handler.handles.get(&fd) {
1275+
// FIXME: Support fdatasync for all FDs
12701276
let FileHandle { file, writable } = file_descriptor.as_file_handle()?;
12711277
let io_result = maybe_sync_file(&file, *writable, File::sync_data);
12721278
this.try_unwrap_io_result(io_result)
@@ -1306,6 +1312,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
13061312
}
13071313

13081314
if let Some(file_descriptor) = this.machine.file_handler.handles.get(&fd) {
1315+
// FIXME: Support sync_data_range for all FDs
13091316
let FileHandle { file, writable } = file_descriptor.as_file_handle()?;
13101317
let io_result = maybe_sync_file(&file, *writable, File::sync_data);
13111318
this.try_unwrap_io_result(io_result)

0 commit comments

Comments
 (0)