1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use crate::*;
use crate::shims::unix::fs::FileDescriptor;
use rustc_data_structures::fx::FxHashMap;
use std::io;
#[derive(Clone, Debug, Default)]
pub struct Epoll {
pub file_descriptors: FxHashMap<i32, EpollEvent>,
}
#[derive(Clone, Debug)]
pub struct EpollEvent {
pub events: u32,
pub data: Scalar<Provenance>,
}
impl FileDescriptor for Epoll {
fn name(&self) -> &'static str {
"epoll"
}
fn as_epoll_handle<'tcx>(&mut self) -> InterpResult<'tcx, &mut Epoll> {
Ok(self)
}
fn dup(&mut self) -> io::Result<Box<dyn FileDescriptor>> {
Ok(Box::new(self.clone()))
}
fn is_tty(&self) -> bool {
false
}
fn close<'tcx>(
self: Box<Self>,
_communicate_allowed: bool,
) -> InterpResult<'tcx, io::Result<i32>> {
Ok(Ok(0))
}
}