@@ -108,7 +108,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
108
108
& mut self ,
109
109
fd_op : OpTy < ' tcx , Tag > ,
110
110
cmd_op : OpTy < ' tcx , Tag > ,
111
- arg_op : Option < OpTy < ' tcx , Tag > > ,
111
+ _arg_op : Option < OpTy < ' tcx , Tag > > ,
112
112
) -> InterpResult < ' tcx , i32 > {
113
113
let this = self . eval_context_mut ( ) ;
114
114
@@ -118,29 +118,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
118
118
119
119
let fd = this. read_scalar ( fd_op) ?. to_i32 ( ) ?;
120
120
let cmd = this. read_scalar ( cmd_op) ?. to_i32 ( ) ?;
121
-
122
- if cmd == this. eval_libc_i32 ( "F_SETFD" ) ? {
123
- // This does not affect the file itself. Certain flags might require changing the file
124
- // or the way it is accessed somehow.
125
- let flag = this. read_scalar ( arg_op. unwrap ( ) ) ?. to_i32 ( ) ?;
126
- // The only usage of this in stdlib at the moment is to enable the `FD_CLOEXEC` flag.
127
- let fd_cloexec = this. eval_libc_i32 ( "FD_CLOEXEC" ) ?;
128
- if let Some ( FileHandle { flag : old_flag, .. } ) =
129
- this. machine . file_handler . handles . get_mut ( & fd)
130
- {
131
- // Check that the only difference between the old flag and the current flag is
132
- // exactly the `FD_CLOEXEC` value.
133
- if flag ^ * old_flag == fd_cloexec {
134
- * old_flag = flag;
135
- } else {
136
- throw_unsup_format ! ( "Unsupported arg {:#x} for `F_SETFD`" , flag) ;
137
- }
138
- }
139
- Ok ( 0 )
140
- } else if cmd == this. eval_libc_i32 ( "F_GETFD" ) ? {
121
+ // We only support getting the flags for a descriptor
122
+ if cmd == this. eval_libc_i32 ( "F_GETFD" ) ? {
141
123
this. get_handle_and ( fd, |handle| Ok ( handle. flag ) )
142
124
} else {
143
- throw_unsup_format ! ( "Unsupported command {:#x}" , cmd) ;
125
+ throw_unsup_format ! ( "The {:#x} command is not supported for `fcntl`) " , cmd) ;
144
126
}
145
127
}
146
128
0 commit comments