@@ -3,6 +3,8 @@ use rustc_span::Symbol;
33use rustc_target:: callconv:: { Conv , FnAbi } ;
44
55use crate :: shims:: unix:: foreign_items:: EvalContextExt as _;
6+ use crate :: shims:: unix:: linux_like:: epoll:: EvalContextExt as _;
7+ use crate :: shims:: unix:: linux_like:: eventfd:: EvalContextExt as _;
68use crate :: shims:: unix:: * ;
79use crate :: * ;
810
@@ -21,6 +23,32 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
2123 ) -> InterpResult < ' tcx , EmulateItemResult > {
2224 let this = self . eval_context_mut ( ) ;
2325 match link_name. as_str ( ) {
26+ // epoll, eventfd (NOT available on Solaris!)
27+ "epoll_create1" => {
28+ this. assert_target_os ( "illumos" , "epoll_create1" ) ;
29+ let [ flag] = this. check_shim ( abi, Conv :: C , link_name, args) ?;
30+ let result = this. epoll_create1 ( flag) ?;
31+ this. write_scalar ( result, dest) ?;
32+ }
33+ "epoll_ctl" => {
34+ this. assert_target_os ( "illumos" , "epoll_ctl" ) ;
35+ let [ epfd, op, fd, event] = this. check_shim ( abi, Conv :: C , link_name, args) ?;
36+ let result = this. epoll_ctl ( epfd, op, fd, event) ?;
37+ this. write_scalar ( result, dest) ?;
38+ }
39+ "epoll_wait" => {
40+ this. assert_target_os ( "illumos" , "epoll_wait" ) ;
41+ let [ epfd, events, maxevents, timeout] =
42+ this. check_shim ( abi, Conv :: C , link_name, args) ?;
43+ this. epoll_wait ( epfd, events, maxevents, timeout, dest) ?;
44+ }
45+ "eventfd" => {
46+ this. assert_target_os ( "illumos" , "eventfd" ) ;
47+ let [ val, flag] = this. check_shim ( abi, Conv :: C , link_name, args) ?;
48+ let result = this. eventfd ( val, flag) ?;
49+ this. write_scalar ( result, dest) ?;
50+ }
51+
2452 // Threading
2553 "pthread_setname_np" => {
2654 let [ thread, name] = this. check_shim ( abi, Conv :: C , link_name, args) ?;
0 commit comments