@@ -432,7 +432,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
432432 let mut array_iter = this. project_array_fields ( & event) ?;
433433
434434 while let Some ( des) = array_iter. next ( this) ? {
435- if let Some ( epoll_event_instance) = this . ready_list_next ( & mut ready_list) {
435+ if let Some ( epoll_event_instance) = ready_list_next ( this , & mut ready_list) {
436436 this. write_int_fields_named (
437437 & [
438438 ( "events" , epoll_event_instance. events . into ( ) ) ,
@@ -448,25 +448,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
448448 Ok ( Scalar :: from_i32 ( num_of_events) )
449449 }
450450
451- /// This function takes in ready list and returns EpollEventInstance with file description
452- /// that is not closed.
453- fn ready_list_next (
454- & self ,
455- ready_list : & mut BTreeMap < ( FdId , i32 ) , EpollEventInstance > ,
456- ) -> Option < EpollEventInstance > {
457- let this = self . eval_context_ref ( ) ;
458- while let Some ( ( epoll_key, epoll_event_instance) ) = ready_list. pop_first ( ) {
459- // This ensures that we only return events that we are interested. The FD might have been closed since
460- // the event was generated, in which case we are not interested anymore.
461- // When a file description is fully closed, it gets removed from `machine.epoll_interests`,
462- // so we skip events whose FD is not in that map any more.
463- if this. machine . epoll_interests . get_epoll_interest ( epoll_key. 0 ) . is_some ( ) {
464- return Some ( epoll_event_instance) ;
465- }
466- }
467- return None ;
468- }
469-
470451 /// For a specific file description, get its ready events and update the corresponding ready
471452 /// list. This function should be called whenever an event causes more bytes or an EOF to become
472453 /// newly readable from an FD, and whenever more bytes can be written to an FD or no more future
@@ -504,3 +485,21 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
504485 Ok ( ( ) )
505486 }
506487}
488+
489+ /// This function takes in ready list and returns EpollEventInstance with file description
490+ /// that is not closed.
491+ fn ready_list_next (
492+ ecx : & MiriInterpCx < ' _ > ,
493+ ready_list : & mut BTreeMap < ( FdId , i32 ) , EpollEventInstance > ,
494+ ) -> Option < EpollEventInstance > {
495+ while let Some ( ( epoll_key, epoll_event_instance) ) = ready_list. pop_first ( ) {
496+ // This ensures that we only return events that we are interested. The FD might have been closed since
497+ // the event was generated, in which case we are not interested anymore.
498+ // When a file description is fully closed, it gets removed from `machine.epoll_interests`,
499+ // so we skip events whose FD is not in that map anymore.
500+ if ecx. machine . epoll_interests . get_epoll_interest ( epoll_key. 0 ) . is_some ( ) {
501+ return Some ( epoll_event_instance) ;
502+ }
503+ }
504+ return None ;
505+ }
0 commit comments