Verified Commit 4080e5dd authored by 4lDO2's avatar 4lDO2 🖖
Browse files

Update syscall.

parent 0c5c45c5
Pipeline #9418 failed with stages
in 2 minutes and 3 seconds
......@@ -15,9 +15,9 @@ dependencies = [
[[package]]
name = "redox_syscall"
version = "0.2.4"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05ec8ca9416c5ea37062b502703cd7fcb207736bc294f6e0cf367ac6fc234570"
checksum = "5ab49abadf3f9e1c4bc499e8845e152ad87d2ad2d30371841171169e9d75feee"
dependencies = [
"bitflags",
]
......@@ -3,4 +3,4 @@ edition = "2018"
name = "ipcd"
version = "0.1.0"
[dependencies]
redox_syscall = "0.2.4"
redox_syscall = "0.2.9"
......@@ -121,9 +121,7 @@ impl SchemeBlockMut for ChanScheme {
// | |_| | __/| |___| |\ |
// \___/|_| |_____|_| \_|
fn open(&mut self, path: &[u8], flags: usize, _uid: u32, _gid: u32) -> Result<Option<usize>> {
let path = ::std::str::from_utf8(path).or(Err(Error::new(EPERM)))?;
fn open(&mut self, path: &str, flags: usize, _uid: u32, _gid: u32) -> Result<Option<usize>> {
let new_id = self.next_id;
let mut new = Handle::default();
new.flags = flags;
......@@ -220,13 +218,15 @@ impl SchemeBlockMut for ChanScheme {
return Err(Error::new(EBADF));
}
let path = core::str::from_utf8(buf).map_err(|_| Error::new(EBADF))?;
let handle = self.handles.get_mut(&id).ok_or(Error::new(EBADF))?;
if handle.path.is_some() {
return Err(Error::new(EBADF));
}
let flags = handle.flags;
return self.open(buf, flags, 0, 0);
return self.open(path, flags, 0, 0);
}
}
}
......
......@@ -36,8 +36,8 @@ impl ShmScheme {
}
impl SchemeMut for ShmScheme {
fn open(&mut self, path: &[u8], _flags: usize, _uid: u32, _gid: u32) -> Result<usize> {
let path = std::str::from_utf8(path).or(Err(Error::new(EPERM)))?.into();
fn open(&mut self, path: &str, _flags: usize, _uid: u32, _gid: u32) -> Result<usize> {
let path = Rc::from(path);
let entry = self.maps.entry(Rc::clone(&path)).or_insert(ShmHandle::default());
entry.refs += 1;
self.handles.insert(self.next_id, path);
......
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