Verified Commit 97179331 authored by jD91mZM2's avatar jD91mZM2
Browse files

Add more messages to event test & delete unused variable

parent 879bbf0d
......@@ -22,8 +22,6 @@ fn dup(file: &File, buf: &str) -> io::Result<File> {
fn main() -> io::Result<()> {
let server = File::create("chan:hello_world")?;
println!("Testing events...");
nonblock(&server)?;
let mut event_file = File::open("event:")?;
......@@ -56,6 +54,8 @@ fn main() -> io::Result<()> {
let mut event = syscall::Event::default();
println!("Testing accept events...");
event_file.read(&mut event)?;
assert_eq!(event.data, TOKEN_TIMER);
assert_eq!(event.flags, syscall::EVENT_READ);
......@@ -73,6 +73,8 @@ fn main() -> io::Result<()> {
assert_eq!(event.flags, syscall::EVENT_WRITE);
println!("-> Accept event");
println!("Testing write events...");
let mut stream = dup(&server, "listen")?;
event_file.read(&mut event)?;
......@@ -96,6 +98,8 @@ fn main() -> io::Result<()> {
assert_eq!(event.flags, syscall::EVENT_READ);
println!("-> Timed out");
println!("Testing read events...");
client.write(b"a")?;
let mut buf = [0; 5];
......
......@@ -40,7 +40,6 @@ impl Default for Connection {
#[derive(Debug, Default)]
pub struct Handle {
flags: usize,
fevent: usize,
notified_read: bool,
notified_write: bool,
......@@ -198,9 +197,8 @@ impl SchemeBlockMut for IpcScheme {
_ => Err(Error::new(EINVAL))
}
}
fn fevent(&mut self, id: usize, flags: usize) -> Result<Option<usize>> {
fn fevent(&mut self, id: usize, _flags: usize) -> Result<Option<usize>> {
let handle = self.handles.get_mut(&id).ok_or(Error::new(EBADF))?;
handle.fevent = flags;
handle.notified_read = false;
handle.notified_write = false;
Ok(Some(id))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment