@@ -3,7 +3,6 @@ use libc::{self, c_void};
33use nix:: poll:: { poll, PollFd , PollFlags } ;
44use nix:: sys:: mman:: { mmap, MapFlags , ProtFlags } ;
55use nix:: unistd:: { sysconf, SysconfVar } ;
6- use std:: os:: unix:: io:: AsRawFd ;
76use std:: { convert:: TryInto , env} ;
87use userfaultfd:: { Event , Uffd , UffdBuilder } ;
98
@@ -18,7 +17,7 @@ fn fault_handler_thread(uffd: Uffd) {
1817 page_size. try_into ( ) . unwrap ( ) ,
1918 ProtFlags :: PROT_READ | ProtFlags :: PROT_WRITE ,
2019 MapFlags :: MAP_PRIVATE | MapFlags :: MAP_ANONYMOUS ,
21- - 1 ,
20+ None :: < std :: os :: fd :: BorrowedFd > ,
2221 0 ,
2322 )
2423 . expect ( "mmap" )
@@ -30,7 +29,7 @@ fn fault_handler_thread(uffd: Uffd) {
3029 loop {
3130 // See what poll() tells us about the userfaultfd
3231
33- let pollfd = PollFd :: new ( uffd. as_raw_fd ( ) , PollFlags :: POLLIN ) ;
32+ let pollfd = PollFd :: new ( & uffd, PollFlags :: POLLIN ) ;
3433 let nready = poll ( & mut [ pollfd] , -1 ) . expect ( "poll" ) ;
3534
3635 println ! ( "\n fault_handler_thread():" ) ;
@@ -101,7 +100,7 @@ fn main() {
101100 len. try_into ( ) . unwrap ( ) ,
102101 ProtFlags :: PROT_READ | ProtFlags :: PROT_WRITE ,
103102 MapFlags :: MAP_PRIVATE | MapFlags :: MAP_ANONYMOUS ,
104- - 1 ,
103+ None :: < std :: os :: fd :: BorrowedFd > ,
105104 0 ,
106105 )
107106 . expect ( "mmap" )
0 commit comments