@@ -76,18 +76,27 @@ pub struct EpollReadyEvents {
7676 /// epollrdhup also gets set when only the write half is closed, which is possible
7777 /// via `shutdown(_, SHUT_WR)`.
7878 pub epollhup : bool ,
79+ /// Error condition happened on the associated file descriptor.
80+ pub epollerr : bool ,
7981}
8082
8183impl EpollReadyEvents {
8284 pub fn new ( ) -> Self {
83- EpollReadyEvents { epollin : false , epollout : false , epollrdhup : false , epollhup : false }
85+ EpollReadyEvents {
86+ epollin : false ,
87+ epollout : false ,
88+ epollrdhup : false ,
89+ epollhup : false ,
90+ epollerr : false ,
91+ }
8492 }
8593
8694 pub fn get_event_bitmask < ' tcx > ( & self , ecx : & MiriInterpCx < ' tcx > ) -> u32 {
8795 let epollin = ecx. eval_libc_u32 ( "EPOLLIN" ) ;
8896 let epollout = ecx. eval_libc_u32 ( "EPOLLOUT" ) ;
8997 let epollrdhup = ecx. eval_libc_u32 ( "EPOLLRDHUP" ) ;
9098 let epollhup = ecx. eval_libc_u32 ( "EPOLLHUP" ) ;
99+ let epollerr = ecx. eval_libc_u32 ( "EPOLLERR" ) ;
91100
92101 let mut bitmask = 0 ;
93102 if self . epollin {
@@ -102,6 +111,9 @@ impl EpollReadyEvents {
102111 if self . epollhup {
103112 bitmask |= epollhup;
104113 }
114+ if self . epollerr {
115+ bitmask |= epollerr;
116+ }
105117 bitmask
106118 }
107119}
@@ -229,6 +241,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
229241 let epollrdhup = this. eval_libc_u32 ( "EPOLLRDHUP" ) ;
230242 let epollet = this. eval_libc_u32 ( "EPOLLET" ) ;
231243 let epollhup = this. eval_libc_u32 ( "EPOLLHUP" ) ;
244+ let epollerr = this. eval_libc_u32 ( "EPOLLERR" ) ;
232245
233246 // Fail on unsupported operations.
234247 if op & epoll_ctl_add != epoll_ctl_add
@@ -261,10 +274,11 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
261274
262275 // Unset the flag we support to discover if any unsupported flags are used.
263276 let mut flags = events;
264- // epoll_wait(2) will always wait for epollhup; it is not
277+ // epoll_wait(2) will always wait for epollhup and epoller ; it is not
265278 // necessary to set it in events when calling epoll_ctl().
266- // So we will always set this event type .
279+ // So we will always set these two event types .
267280 events |= epollhup;
281+ events |= epollerr;
268282
269283 if events & epollet != epollet {
270284 // We only support edge-triggered notification for now.
@@ -284,6 +298,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
284298 if flags & epollhup == epollhup {
285299 flags &= !epollhup;
286300 }
301+ if flags & epollerr == epollerr {
302+ flags &= !epollerr;
303+ }
287304 if flags != 0 {
288305 throw_unsup_format ! (
289306 "epoll_ctl: encountered unknown unsupported flags {:#x}" ,
0 commit comments