11use rustc_abi:: ExternAbi ;
22use rustc_span:: Symbol ;
33
4+ use self :: shims:: unix:: linux:: epoll:: EvalContextExt as _;
5+ use self :: shims:: unix:: linux:: eventfd:: EvalContextExt as _;
46use crate :: shims:: unix:: android:: thread:: prctl;
57use crate :: shims:: unix:: linux:: syscall:: syscall;
68use crate :: * ;
@@ -20,6 +22,31 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
2022 ) -> InterpResult < ' tcx , EmulateItemResult > {
2123 let this = self . eval_context_mut ( ) ;
2224 match link_name. as_str ( ) {
25+ // epoll, eventfd
26+ "epoll_create1" => {
27+ let [ flag] =
28+ this. check_shim ( abi, ExternAbi :: C { unwind : false } , link_name, args) ?;
29+ let result = this. epoll_create1 ( flag) ?;
30+ this. write_scalar ( result, dest) ?;
31+ }
32+ "epoll_ctl" => {
33+ let [ epfd, op, fd, event] =
34+ this. check_shim ( abi, ExternAbi :: C { unwind : false } , link_name, args) ?;
35+ let result = this. epoll_ctl ( epfd, op, fd, event) ?;
36+ this. write_scalar ( result, dest) ?;
37+ }
38+ "epoll_wait" => {
39+ let [ epfd, events, maxevents, timeout] =
40+ this. check_shim ( abi, ExternAbi :: C { unwind : false } , link_name, args) ?;
41+ this. epoll_wait ( epfd, events, maxevents, timeout, dest) ?;
42+ }
43+ "eventfd" => {
44+ let [ val, flag] =
45+ this. check_shim ( abi, ExternAbi :: C { unwind : false } , link_name, args) ?;
46+ let result = this. eventfd ( val, flag) ?;
47+ this. write_scalar ( result, dest) ?;
48+ }
49+
2350 // Miscellaneous
2451 "__errno" => {
2552 let [ ] = this. check_shim ( abi, ExternAbi :: C { unwind : false } , link_name, args) ?;
0 commit comments