mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-23 06:05:21 +00:00
vmm: add a safety comment for EpollContext
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
32af6f9723
commit
ff0e92ab88
@ -178,6 +178,7 @@ impl EpollContext {
|
|||||||
pub fn new() -> result::Result<EpollContext, io::Error> {
|
pub fn new() -> result::Result<EpollContext, io::Error> {
|
||||||
let epoll_fd = epoll::create(true)?;
|
let epoll_fd = epoll::create(true)?;
|
||||||
// Use 'File' to enforce closing on 'epoll_fd'
|
// Use 'File' to enforce closing on 'epoll_fd'
|
||||||
|
// SAFETY: the epoll_fd returned by epoll::create is valid and owned by us.
|
||||||
let epoll_file = unsafe { File::from_raw_fd(epoll_fd) };
|
let epoll_file = unsafe { File::from_raw_fd(epoll_fd) };
|
||||||
|
|
||||||
Ok(EpollContext { epoll_file })
|
Ok(EpollContext { epoll_file })
|
||||||
|
Loading…
Reference in New Issue
Block a user