MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / wake

Function wake

vmm/src/uffd.rs:187–201  ·  view source on GitHub ↗

Wake threads waiting on a fault in the given range without copying data. Needed after UFFDIO_COPY returns EEXIST: the page was already resolved by a concurrent fault, but any additional threads blocked on that page may not have been woken.

(fd: BorrowedFd<'_>, addr: u64, len: u64)

Source from the content-addressed store, hash-verified

185/// by a concurrent fault, but any additional threads blocked on that page
186/// may not have been woken.
187pub(crate) fn wake(fd: BorrowedFd<'_>, addr: u64, len: u64) -> Result<(), Error> {
188 let mut range = UffdioRange { start: addr, len };
189 // SAFETY: `range` is a valid, correctly-sized struct for this ioctl.
190 let ret = unsafe {
191 libc::ioctl(
192 fd.as_raw_fd(),
193 userfaultfd::UFFDIO_WAKE as libc::Ioctl,
194 &mut range,
195 )
196 };
197 if ret < 0 {
198 return Err(Error::last_os_error());
199 }
200 Ok(())
201}

Callers 1

uffd_handler_loopMethod · 0.85

Calls 1

as_raw_fdMethod · 0.45

Tested by

no test coverage detected