Mount chan and shm O_NONBLOCK

This commit is contained in:
Jeremy Soller
2019-07-18 20:22:38 -06:00
parent 2653a4ff98
commit b6cc9f2ebd
2 changed files with 19 additions and 7 deletions
+9 -3
View File
@@ -2,8 +2,9 @@ use crate::post_fevent;
use std::{
cmp,
collections::{HashMap, VecDeque},
fs::File,
io
fs::{File, OpenOptions},
io,
os::unix::fs::OpenOptionsExt,
};
use syscall::{flag::*, error::*, Error, SchemeBlockMut, Result};
@@ -102,7 +103,12 @@ impl ChanScheme {
handles: HashMap::new(),
listeners: HashMap::new(),
next_id: 0,
socket: File::create(":chan")?
socket: OpenOptions::new()
.read(true)
.write(true)
.create(true)
.custom_flags(O_NONBLOCK as i32)
.open(":chan")?
})
}
}
+10 -4
View File
@@ -1,11 +1,12 @@
use std::{
cmp,
collections::{HashMap, hash_map::Entry},
fs::File,
fs::{File, OpenOptions},
io,
rc::Rc
os::unix::fs::OpenOptionsExt,
rc::Rc,
};
use syscall::{error::*, Error, Map, SchemeMut, Result};
use syscall::{error::*, flag::O_NONBLOCK, Error, Map, SchemeMut, Result};
#[derive(Default)]
pub struct ShmHandle {
@@ -24,7 +25,12 @@ impl ShmScheme {
maps: HashMap::new(),
handles: HashMap::new(),
next_id: 0,
socket: File::create(":shm")?
socket: OpenOptions::new()
.read(true)
.write(true)
.create(true)
.custom_flags(O_NONBLOCK as i32)
.open(":shm")?
})
}
}